require=function t(e,r,n){function i(o,a){if(!r[o]){if(!e[o]){var f="function"==typeof require&&require;if(!a&&f)return f(o,!0);if(s)return s(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var c=r[o]={exports:{}};e[o][0].call(c.exports,function(t){var r=e[o][1][t];return i(r?r:t)},c,c.exports,t,e,r,n)}return r[o].exports}for(var s="function"==typeof require&&require,o=0;o"},e.exports=n;var d=t("./script")}).call(this,t("buffer").Buffer)},{"./crypto/hash":8,"./encoding/base58check":13,"./errors":17,"./networks":22,"./publickey":25,"./script":26,"./util/js":44,"./util/preconditions":45,buffer:48,lodash:297}],2:[function(t,e,r){(function(r){"use strict";function n(t){return this instanceof n?(i.extend(this,n._from(t)),this):new n(t)}var i=t("lodash"),s=t("./blockheader"),o=t("../crypto/bn"),a=t("../util/buffer"),f=t("../encoding/bufferreader"),u=t("../encoding/bufferwriter"),c=t("../crypto/hash"),h=t("../transaction"),d=t("../util/preconditions");n.MAX_BLOCK_SIZE=1e6,n._from=function(t){var e={};if(a.isBuffer(t))e=n._fromBufferReader(f(t));else{if(!i.isObject(t))throw new TypeError("Unrecognized argument for Block");e=n._fromObject(t)}return e},n._fromObject=function(t){var e=[];t.transactions.forEach(function(t){t instanceof h?e.push(t):e.push(h().fromObject(t))});var r={header:s.fromObject(t.header),transactions:e};return r},n.fromObject=function(t){var e=n._fromObject(t);return new n(e)},n._fromBufferReader=function(t){var e={};d.checkState(!t.finished(),"No block data received"),e.header=s.fromBufferReader(t);var r=t.readVarintNum();e.transactions=[];for(var n=0;r>n;n++)e.transactions.push(h().fromBufferReader(t));return e},n.fromBufferReader=function(t){d.checkArgument(t,"br is required");var e=n._fromBufferReader(t);return new n(e)},n.fromBuffer=function(t){return n.fromBufferReader(new f(t))},n.fromString=function(t){var e=new r(t,"hex");return n.fromBuffer(e)},n.fromRawBlock=function(t){a.isBuffer(t)||(t=new r(t,"binary"));var e=f(t);e.pos=n.Values.START_OF_BLOCK;var i=n._fromBufferReader(e);return new n(i)},n.prototype.toObject=n.prototype.toJSON=function(){var t=[];return this.transactions.forEach(function(e){t.push(e.toObject())}),{header:this.header.toObject(),transactions:t}},n.prototype.toBuffer=function(){return this.toBufferWriter().concat()},n.prototype.toString=function(){return this.toBuffer().toString("hex")},n.prototype.toBufferWriter=function(t){t||(t=new u),t.write(this.header.toBuffer()),t.writeVarintNum(this.transactions.length);for(var e=0;e1;n=Math.floor((n+1)/2)){for(var i=0;n>i;i+=2){var s=Math.min(i+1,n-1),o=r.concat([t[e+i],t[e+s]]);t.push(c.sha256sha256(o))}e+=n}return t},n.prototype.getMerkleRoot=function(){var t=this.getMerkleTree();return t[t.length-1]},n.prototype.validMerkleRoot=function(){var t=new o(this.header.merkleRoot.toString("hex"),"hex"),e=new o(this.getMerkleRoot().toString("hex"),"hex");return 0!==t.cmp(e)?!1:!0},n.prototype._getHash=function(){return this.header._getHash()};var p={configurable:!1,enumerable:!0,get:function(){return this._id||(this._id=this.header.id),this._id},set:i.noop};Object.defineProperty(n.prototype,"id",p),Object.defineProperty(n.prototype,"hash",p),n.prototype.inspect=function(){return""},n.Values={START_OF_BLOCK:8,NULL_HASH:new r("0000000000000000000000000000000000000000000000000000000000000000","hex")},e.exports=n}).call(this,t("buffer").Buffer)},{"../crypto/bn":6,"../crypto/hash":8,"../encoding/bufferreader":14,"../encoding/bufferwriter":15,"../transaction":29,"../util/buffer":43,"../util/preconditions":45,"./blockheader":3,buffer:48,lodash:297}],3:[function(t,e,r){(function(r){"use strict";var n=t("lodash"),i=t("../crypto/bn"),s=t("../util/buffer"),o=t("../encoding/bufferreader"),a=t("../encoding/bufferwriter"),f=t("../crypto/hash"),u=(t("../util/js"),t("../util/preconditions")),c=486604799,h=function p(t){if(!(this instanceof p))return new p(t);var e=p._from(t);return this.version=e.version,this.prevHash=e.prevHash,this.merkleRoot=e.merkleRoot,this.time=e.time,this.timestamp=e.time,this.bits=e.bits,this.nonce=e.nonce,e.hash&&u.checkState(this.hash===e.hash,"Argument object hash property does not match block hash."),this};h._from=function(t){var e={};if(s.isBuffer(t))e=h._fromBufferReader(o(t));else{if(!n.isObject(t))throw new TypeError("Unrecognized argument for BlockHeader");e=h._fromObject(t)}return e},h._fromObject=function(t){u.checkArgument(t,"data is required");var e=t.prevHash,i=t.merkleRoot;n.isString(t.prevHash)&&(e=s.reverse(new r(t.prevHash,"hex"))),n.isString(t.merkleRoot)&&(i=s.reverse(new r(t.merkleRoot,"hex")));var o={hash:t.hash,version:t.version,prevHash:e,merkleRoot:i,time:t.time,timestamp:t.time,bits:t.bits,nonce:t.nonce};return o},h.fromObject=function(t){var e=h._fromObject(t);return new h(e)},h.fromRawBlock=function(t){s.isBuffer(t)||(t=new r(t,"binary"));var e=o(t);e.pos=h.Constants.START_OF_HEADER;var n=h._fromBufferReader(e);return new h(n)},h.fromBuffer=function(t){var e=h._fromBufferReader(o(t));return new h(e)},h.fromString=function(t){var e=new r(t,"hex");return h.fromBuffer(e)},h._fromBufferReader=function(t){var e={};return e.version=t.readUInt32LE(),e.prevHash=t.read(32),e.merkleRoot=t.read(32),e.time=t.readUInt32LE(),e.bits=t.readUInt32LE(),e.nonce=t.readUInt32LE(),e},h.fromBufferReader=function(t){var e=h._fromBufferReader(t);return new h(e)},h.prototype.toObject=h.prototype.toJSON=function(){return{hash:this.hash,version:this.version,prevHash:s.reverse(this.prevHash).toString("hex"),merkleRoot:s.reverse(this.merkleRoot).toString("hex"),time:this.time,bits:this.bits,nonce:this.nonce}},h.prototype.toBuffer=function(){return this.toBufferWriter().concat()},h.prototype.toString=function(){return this.toBuffer().toString("hex")},h.prototype.toBufferWriter=function(t){return t||(t=new a),t.writeUInt32LE(this.version),t.write(this.prevHash),t.write(this.merkleRoot),t.writeUInt32LE(this.time),t.writeUInt32LE(this.bits),t.writeUInt32LE(this.nonce),t},h.prototype.getTargetDifficulty=function(t){t=t||this.bits;for(var e=new i(16777215&t),r=8*((t>>>24)-3);r-- >0;)e=e.mul(new i(2));return e},h.prototype.getDifficulty=function(){var t=this.getTargetDifficulty(c).mul(new i(Math.pow(10,8))),e=this.getTargetDifficulty(),r=t.div(e).toString(10),n=r.length-8;return r=r.slice(0,n)+"."+r.slice(n),parseFloat(r)},h.prototype._getHash=function(){var t=this.toBuffer();return f.sha256sha256(t)};var d={configurable:!1,enumerable:!0,get:function(){return this._id||(this._id=o(this._getHash()).readReverse().toString("hex")),this._id},set:n.noop};Object.defineProperty(h.prototype,"id",d),Object.defineProperty(h.prototype,"hash",d),h.prototype.validTimestamp=function(){var t=Math.round((new Date).getTime()/1e3);return this.time>t+h.Constants.MAX_TIME_OFFSET?!1:!0},h.prototype.validProofOfWork=function(){var t=new i(this.id,"hex"),e=this.getTargetDifficulty();return t.cmp(e)>0?!1:!0},h.prototype.inspect=function(){return""},h.Constants={START_OF_HEADER:8,MAX_TIME_OFFSET:7200,LARGEST_HASH:new i("10000000000000000000000000000000000000000000000000000000000000000","hex")},e.exports=h}).call(this,t("buffer").Buffer)},{"../crypto/bn":6,"../crypto/hash":8,"../encoding/bufferreader":14,"../encoding/bufferwriter":15,"../util/buffer":43,"../util/js":44,"../util/preconditions":45,buffer:48,lodash:297}],4:[function(t,e,r){e.exports=t("./block"),e.exports.BlockHeader=t("./blockheader"),e.exports.MerkleBlock=t("./merkleblock")},{"./block":2,"./blockheader":3,"./merkleblock":5}],5:[function(t,e,r){(function(r){"use strict";function n(t){if(!(this instanceof n))return new n(t);var e={};if(o.isBuffer(t))e=n._fromBufferReader(a(t));else{if(!i.isObject(t))throw new TypeError("Unrecognized argument for MerkleBlock");var r;r=t.header instanceof s?t.header:s.fromObject(t.header),e={header:r,numTransactions:t.numTransactions,hashes:t.hashes,flags:t.flags}}return i.extend(this,e),this._flagBitsUsed=0,this._hashesUsed=0,this}var i=t("lodash"),s=t("./blockheader"),o=t("../util/buffer"),a=t("../encoding/bufferreader"),f=t("../encoding/bufferwriter"),u=t("../crypto/hash"),c=(t("../util/js"),t("../transaction")),h=t("../util/preconditions");n.fromBuffer=function(t){return n.fromBufferReader(a(t))},n.fromBufferReader=function(t){return new n(n._fromBufferReader(t))},n.prototype.toBuffer=function(){return this.toBufferWriter().concat()},n.prototype.toBufferWriter=function(t){t||(t=new f),t.write(this.header.toBuffer()),t.writeUInt32LE(this.numTransactions),t.writeVarintNum(this.hashes.length);for(var e=0;ethis.numTransactions)return!1;if(8*this.flags.length8*this.flags.length)return null;var i=this.flags[n.flagBitsUsed>>3]>>>(7&n.flagBitsUsed++)&1;if(0!==t&&i){var s=this._traverseMerkleTree(t-1,2*e,n),o=s;return 2*e+1=this.hashes.length)return null;var a=this.hashes[n.hashesUsed++];return 0===t&&i&&n.txs.push(a),new r(a,"hex")},n.prototype._calcTreeWidth=function(t){return this.numTransactions+(1<>t},n.prototype._calcTreeHeight=function(){for(var t=0;this._calcTreeWidth(t)>1;)t++;return t},n.prototype.hasTransaction=function(t){h.checkArgument(!i.isUndefined(t),"tx cannot be undefined"),h.checkArgument(t instanceof c||"string"==typeof t,'Invalid tx given, tx must be a "string" or "Transaction"');var e=t;t instanceof c&&(e=o.reverse(new r(t.id,"hex")).toString("hex"));var n=[],s=this._calcTreeHeight();return this._traverseMerkleTree(s,0,{txs:n}),-1!==n.indexOf(e)},n._fromBufferReader=function(t){h.checkState(!t.finished(),"No merkleblock data received");var e={};e.header=s.fromBufferReader(t),e.numTransactions=t.readUInt32LE();var r=t.readVarintNum();e.hashes=[];for(var n=0;r>n;n++)e.hashes.push(t.read(32).toString("hex"));var i=t.readVarintNum();for(e.flags=[],n=0;i>n;n++)e.flags.push(t.readUInt8());return e},n.fromObject=function(t){return new n(t)},e.exports=n}).call(this,t("buffer").Buffer)},{"../crypto/hash":8,"../encoding/bufferreader":14,"../encoding/bufferwriter":15,"../transaction":29,"../util/buffer":43,"../util/js":44,"../util/preconditions":45,"./blockheader":3,buffer:48,lodash:297}],6:[function(t,e,r){(function(r){"use strict";var n=t("bn.js"),i=t("../util/preconditions"),s=t("lodash"),o=function(t){for(var e=new r(t.length),n=0;nt.size?e=n.trim(e,s):s0&&0===(127&t[t.length-1])&&(t.length<=1||0===(128&t[t.length-2])))throw new Error("non-minimally encoded script number");return n.fromSM(t,{endian:"little"})},n.prototype.toScriptNumBuffer=function(){return this.toSM({endian:"little"})},n.prototype.gt=function(t){return this.cmp(t)>0},n.prototype.gte=function(t){return this.cmp(t)>=0},n.prototype.lt=function(t){return this.cmp(t)<0},n.trim=function(t,e){return t.slice(e-t.length,t.length)},n.pad=function(t,e,n){for(var i=new r(n),s=0;ss;s++)i[s]=0;return i},e.exports=n}).call(this,t("buffer").Buffer)},{"../util/preconditions":45,"bn.js":272,buffer:48,lodash:297}],7:[function(t,e,r){(function(r){"use strict";var n=t("./bn"),i=t("./point"),s=t("./signature"),o=t("../publickey"),a=t("./random"),f=t("./hash"),u=t("../util/buffer"),c=t("lodash"),h=t("../util/preconditions"),d=function p(t){return this instanceof p?void(t&&this.set(t)):new p(t)};d.prototype.set=function(t){return this.hashbuf=t.hashbuf||this.hashbuf,this.endian=t.endian||this.endian,this.privkey=t.privkey||this.privkey,this.pubkey=t.pubkey||(this.privkey?this.privkey.publicKey:this.pubkey),this.sig=t.sig||this.sig,this.k=t.k||this.k,this.verified=t.verified||this.verified,this},d.prototype.privkey2pubkey=function(){this.pubkey=this.privkey.toPublicKey()},d.prototype.calci=function(){for(var t=0;4>t;t++){this.sig.i=t;var e;try{e=this.toPublicKey()}catch(r){console.error(r);continue}if(e.point.eq(this.pubkey.point))return this.sig.compressed=this.pubkey.compressed,this}throw this.sig.i=void 0,new Error("Unable to find valid recovery factor")},d.fromString=function(t){var e=JSON.parse(t);return new d(e)},d.prototype.randomK=function(){var t,e=i.getN();do t=n.fromBuffer(a.getRandomBuffer(32));while(!t.lt(e)||!t.gt(n.Zero));return this.k=t,this},d.prototype.deterministicK=function(t){c.isUndefined(t)&&(t=0);var e=new r(32);e.fill(1);var s=new r(32);s.fill(0);var o=this.privkey.bn.toBuffer({size:32});s=f.sha256hmac(r.concat([e,new r([0]),o,this.hashbuf]),s),e=f.sha256hmac(e,s),s=f.sha256hmac(r.concat([e,new r([1]),o,this.hashbuf]),s),e=f.sha256hmac(e,s),e=f.sha256hmac(e,s);for(var a=n.fromBuffer(e),u=i.getN(),h=0;t>h||!a.lt(u)||!a.gt(n.Zero);h++)s=f.sha256hmac(r.concat([e,new r([0])]),s),e=f.sha256hmac(e,s),e=f.sha256hmac(e,s),a=n.fromBuffer(e);return this.k=a,this},d.prototype.toPublicKey=function(){var t=this.sig.i;h.checkArgument(0===t||1===t||2===t||3===t,new Error("i must be equal to 0, 1, 2, or 3"));var e=n.fromBuffer(this.hashbuf),r=this.sig.r,s=this.sig.s,a=1&t,f=t>>1,u=i.getN(),c=i.getG(),d=f?r.add(u):r,p=i.fromX(a,d),l=p.mul(u);if(!l.isInfinity())throw new Error("nR is not a valid curve point");var b=e.neg().mod(u),g=r.invm(u),m=p.mul(s).add(c.mul(b)).mul(g),y=o.fromPoint(m,this.sig.compressed);return y},d.prototype.sigError=function(){if(!u.isBuffer(this.hashbuf)||32!==this.hashbuf.length)return"hashbuf must be a 32 byte buffer";var t=this.sig.r,e=this.sig.s;if(!(t.gt(n.Zero)&&t.lt(i.getN())&&e.gt(n.Zero)&&e.lt(i.getN())))return"r and s not in range";var r=n.fromBuffer(this.hashbuf,this.endian?{endian:this.endian}:void 0),s=i.getN(),o=e.invm(s),a=o.mul(r).mod(s),f=o.mul(t).mod(s),c=i.getG().mulAdd(a,this.pubkey.point,f);return c.isInfinity()?"p is infinity":0!==c.getX().mod(s).cmp(t)?"Invalid signature":!1},d.toLowS=function(t){return t.gt(n.fromBuffer(new r("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex")))&&(t=i.getN().sub(t)),t},d.prototype._findSignature=function(t,e){var r,s,o,a,f=i.getN(),u=i.getG(),c=0;do(!this.k||c>0)&&this.deterministicK(c),c++,r=this.k,s=u.mul(r),o=s.x.mod(f),a=r.invm(f).mul(e.add(t.mul(o))).mod(f);while(o.cmp(n.Zero)<=0||a.cmp(n.Zero)<=0);return a=d.toLowS(a),{s:a,r:o}},d.prototype.sign=function(){var t=this.hashbuf,e=this.privkey,r=e.bn;h.checkState(t&&e&&r,new Error("invalid parameters")),h.checkState(u.isBuffer(t)&&32===t.length,new Error("hashbuf must be a 32 byte buffer"));var i=n.fromBuffer(t,this.endian?{endian:this.endian}:void 0),o=this._findSignature(r,i);return o.compressed=this.pubkey.compressed,this.sig=new s(o),this},d.prototype.signRandomK=function(){return this.randomK(),this.sign()},d.prototype.toString=function(){var t={};return this.hashbuf&&(t.hashbuf=this.hashbuf.toString("hex")),this.privkey&&(t.privkey=this.privkey.toString()),this.pubkey&&(t.pubkey=this.pubkey.toString()),this.sig&&(t.sig=this.sig.toString()),this.k&&(t.k=this.k.toString()),JSON.stringify(t)},d.prototype.verify=function(){return this.sigError()?this.verified=!1:this.verified=!0,this},d.sign=function(t,e,r){return d().set({hashbuf:t,endian:r,privkey:e}).sign().sig},d.verify=function(t,e,r,n){return d().set({hashbuf:t,endian:n,sig:e,pubkey:r}).verify().verified},e.exports=d}).call(this,t("buffer").Buffer)},{"../publickey":25,"../util/buffer":43,"../util/preconditions":45,"./bn":6,"./hash":8,"./point":9,"./random":10,"./signature":11,buffer:48,lodash:297}],8:[function(t,e,r){(function(r){"use strict";var n=t("sha512"),i=t("crypto"),s=t("../util/buffer"),o=t("../util/preconditions"),a=e.exports;a.sha1=function(t){return o.checkArgument(s.isBuffer(t)),i.createHash("sha1").update(t).digest()},a.sha1.blocksize=512,a.sha256=function(t){return o.checkArgument(s.isBuffer(t)),i.createHash("sha256").update(t).digest()},a.sha256.blocksize=512,a.sha256sha256=function(t){return o.checkArgument(s.isBuffer(t)),a.sha256(a.sha256(t))},a.ripemd160=function(t){return o.checkArgument(s.isBuffer(t)),i.createHash("ripemd160").update(t).digest()},a.sha256ripemd160=function(t){return o.checkArgument(s.isBuffer(t)),a.ripemd160(a.sha256(t))},a.sha512=function(t){o.checkArgument(s.isBuffer(t));var e=n(t);return new r(e)},a.sha512.blocksize=1024,a.hmac=function(t,e,n){o.checkArgument(s.isBuffer(e)),o.checkArgument(s.isBuffer(n)),o.checkArgument(t.blocksize);var i=t.blocksize/8;if(n.length>i)n=t(n);else if(i>n){var a=new r(i);a.fill(0),n.copy(a),n=a}var f=new r(i);f.fill(92);var u=new r(i);u.fill(54);for(var c=new r(i),h=new r(i),d=0;i>d;d++)c[d]=f[d]^n[d],h[d]=u[d]^n[d];return t(r.concat([c,t(r.concat([h,e]))]))},a.sha256hmac=function(t,e){return a.hmac(a.sha256,t,e)},a.sha512hmac=function(t,e){return a.hmac(a.sha512,t,e)}}).call(this,t("buffer").Buffer)},{"../util/buffer":43,"../util/preconditions":45,buffer:48,crypto:52,sha512:300}],9:[function(t,e,r){(function(r){"use strict";var n=t("./bn"),i=t("../util/buffer"),s=t("elliptic").curves.secp256k1,o=s.curve.point.bind(s.curve),a=s.curve.pointFromX.bind(s.curve),f=function(t,e,r){var n=o(t,e,r);return n.validate(),n};f.prototype=Object.getPrototypeOf(s.curve.point()),f.fromX=function(t,e){var r=a(t,e);return r.validate(),r},f.getG=function(){return s.curve.g},f.getN=function(){return new n(s.curve.n.toArray())},f.prototype._getX=f.prototype.getX,f.prototype.getX=function(){return new n(this._getX().toArray())},f.prototype._getY=f.prototype.getY,f.prototype.getY=function(){return new n(this._getY().toArray())},f.prototype.validate=function(){if(this.isInfinity())throw new Error("Point cannot be equal to Infinity");if(0===this.getX().cmp(n.Zero)||0===this.getY().cmp(n.Zero))throw new Error("Invalid x,y value for curve, cannot equal 0.");var t=a(this.getY().isOdd(),this.getX());if(0!==t.y.cmp(this.y))throw new Error("Invalid y value for curve.");var e=this.getX().gt(n.Minus1)&&this.getX().lt(f.getN()),r=this.getY().gt(n.Minus1)&&this.getY().lt(f.getN());if(!e||!r)throw new Error("Point does not lie on the curve");if(!this.mul(f.getN()).isInfinity())throw new Error("Point times N must be infinity");return this},f.pointToCompressed=function(t){var e,n=t.getX().toBuffer({size:32}),s=t.getY().toBuffer({size:32}),o=s[s.length-1]%2;return e=new r(o?[3]:[2]),i.concat([e,n])},e.exports=f}).call(this,t("buffer").Buffer)},{"../util/buffer":43,"./bn":6,buffer:48,elliptic:275}],10:[function(t,e,r){(function(r,n){"use strict";function i(){}i.getRandomBuffer=function(t){return r.browser?i.getRandomBufferBrowser(t):i.getRandomBufferNode(t)},i.getRandomBufferNode=function(e){var r=t("crypto");return r.randomBytes(e)},i.getRandomBufferBrowser=function(t){if(!window.crypto&&!window.msCrypto)throw new Error("window.crypto not available");if(window.crypto&&window.crypto.getRandomValues)var e=window.crypto;else{if(!window.msCrypto||!window.msCrypto.getRandomValues)throw new Error("window.crypto.getRandomValues not available");var e=window.msCrypto}var r=new Uint8Array(t);e.getRandomValues(r);var i=new n(r);return i},i.getPseudoRandomBuffer=function(t){for(var e,r=4294967296,i=new n(t),s=0;t>=s;s++){var o=Math.floor(s/4),a=s-4*o;0===a?(e=Math.random()*r,i[s]=255&e):i[s]=255&(e>>>=8)}return i},e.exports=i}).call(this,t("_process"),t("buffer").Buffer)},{_process:247,buffer:48,crypto:52}],11:[function(t,e,r){(function(r){"use strict";var n=t("./bn"),i=t("lodash"),s=t("../util/preconditions"),o=t("../util/buffer"),a=t("../util/js"),f=function u(t,e){if(!(this instanceof u))return new u(t,e);if(t instanceof n)this.set({r:t,s:e});else if(t){var r=t;this.set(r)}};f.prototype.set=function(t){return this.r=t.r||this.r||void 0,this.s=t.s||this.s||void 0,this.i="undefined"!=typeof t.i?t.i:this.i,this.compressed="undefined"!=typeof t.compressed?t.compressed:this.compressed,this.nhashtype=t.nhashtype||this.nhashtype||void 0,this},f.fromCompact=function(t){s.checkArgument(o.isBuffer(t),"Argument is expected to be a Buffer");var e=new f,r=!0,i=t.slice(0,1)[0]-27-4;0>i&&(r=!1,i+=4);var a=t.slice(1,33),u=t.slice(33,65);return s.checkArgument(0===i||1===i||2===i||3===i,new Error("i must be 0, 1, 2, or 3")),s.checkArgument(32===a.length,new Error("r must be 32 bytes")),s.checkArgument(32===u.length,new Error("s must be 32 bytes")),e.compressed=r,e.i=i,e.r=n.fromBuffer(a),e.s=n.fromBuffer(u),e},f.fromDER=f.fromBuffer=function(t,e){var r=f.parseDER(t,e),n=new f;return n.r=r.r,n.s=r.s,n},f.fromTxFormat=function(t){var e=t.readUInt8(t.length-1),r=t.slice(0,t.length-1),n=new f.fromDER(r,!1);return n.nhashtype=e,n},f.fromString=function(t){var e=new r(t,"hex");return f.fromDER(e)},f.parseDER=function(t,e){s.checkArgument(o.isBuffer(t),new Error("DER formatted signature should be a buffer")),i.isUndefined(e)&&(e=!0);var r=t[0];s.checkArgument(48===r,new Error("Header byte should be 0x30"));var a=t[1],f=t.slice(2).length;s.checkArgument(!e||a===f,new Error("Length byte should length of what follows")),a=f>a?a:f;var u=t[2];s.checkArgument(2===u,new Error("Integer byte for r should be 0x02"));var c=t[3],h=t.slice(4,4+c),d=n.fromBuffer(h),p=0===t[4]?!0:!1;s.checkArgument(c===h.length,new Error("Length of r incorrect"));var l=t[4+c+0];s.checkArgument(2===l,new Error("Integer byte for s should be 0x02"));var b=t[4+c+1],g=t.slice(4+c+2,4+c+2+b),m=n.fromBuffer(g),y=0===t[4+c+2+2]?!0:!1;s.checkArgument(b===g.length,new Error("Length of s incorrect"));var v=4+c+2+b;s.checkArgument(a===v-2,new Error("Length of signature incorrect"));var _={header:r,length:a,rheader:u,rlength:c,rneg:p,rbuf:h,r:d,sheader:l,slength:b,sneg:y,sbuf:g,s:m};return _},f.prototype.toCompact=function(t,e){if(t="number"==typeof t?t:this.i,e="boolean"==typeof e?e:this.compressed,0!==t&&1!==t&&2!==t&&3!==t)throw new Error("i must be equal to 0, 1, 2, or 3");var n=t+27+4;e===!1&&(n-=4);var i=new r([n]),s=this.r.toBuffer({size:32}),o=this.s.toBuffer({size:32});return r.concat([i,s,o])},f.prototype.toBuffer=f.prototype.toDER=function(){var t=this.r.toBuffer(),e=this.s.toBuffer(),n=128&t[0]?!0:!1,i=128&e[0]?!0:!1,s=n?r.concat([new r([0]),t]):t,o=i?r.concat([new r([0]),e]):e,a=s.length,f=o.length,u=2+a+2+f,c=2,h=2,d=48,p=r.concat([new r([d,u,c,a]),s,new r([h,f]),o]);return p},f.prototype.toString=function(){var t=this.toDER();return t.toString("hex")},f.isTxDER=function(t){if(t.length<9)return!1;if(t.length>73)return!1;if(48!==t[0])return!1;if(t[1]!==t.length-3)return!1;var e=t[3];if(5+e>=t.length)return!1;var r=t[5+e];if(e+r+7!==t.length)return!1;var n=t.slice(4);if(2!==t[2])return!1;if(0===e)return!1;if(128&n[0])return!1;if(e>1&&0===n[0]&&!(128&n[1]))return!1;var i=t.slice(6+e);return 2!==t[6+e-2]?!1:0===r?!1:128&i[0]?!1:r>1&&0===i[0]&&!(128&i[1])?!1:!0},f.prototype.hasLowS=function(){return this.s.lt(new n(1))||this.s.gt(new n("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex"))?!1:!0},f.prototype.hasDefinedHashtype=function(){if(!a.isNaturalNumber(this.nhashtype))return!1;var t=this.nhashtype&~f.SIGHASH_ANYONECANPAY;return tf.SIGHASH_SINGLE?!1:!0},f.prototype.toTxFormat=function(){var t=this.toDER(),e=new r(1);return e.writeUInt8(this.nhashtype,0),r.concat([t,e])},f.SIGHASH_ALL=1,f.SIGHASH_NONE=2,f.SIGHASH_SINGLE=3,f.SIGHASH_ANYONECANPAY=128,e.exports=f}).call(this,t("buffer").Buffer)},{"../util/buffer":43,"../util/js":44,"../util/preconditions":45,"./bn":6,buffer:48,lodash:297}],12:[function(t,e,r){(function(r){"use strict";var n=t("lodash"),i=t("bs58"),s=t("buffer"),o="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz".split(""),a=function f(t){if(!(this instanceof f))return new f(t);if(r.isBuffer(t)){var e=t;this.fromBuffer(e)}else if("string"==typeof t){var n=t;this.fromString(n)}else t&&this.set(t)};a.validCharacters=function(t){return s.Buffer.isBuffer(t)&&(t=t.toString()),n.all(n.map(t,function(t){return n.contains(o,t)}))},a.prototype.set=function(t){return this.buf=t.buf||this.buf||void 0,this},a.encode=function(t){if(!s.Buffer.isBuffer(t))throw new Error("Input should be a buffer");return i.encode(t)},a.decode=function(t){if("string"!=typeof t)throw new Error("Input should be a string");return new r(i.decode(t))},a.prototype.fromBuffer=function(t){ return this.buf=t,this},a.prototype.fromString=function(t){var e=a.decode(t);return this.buf=e,this},a.prototype.toBuffer=function(){return this.buf},a.prototype.toString=function(){return a.encode(this.buf)},e.exports=a}).call(this,t("buffer").Buffer)},{bs58:273,buffer:48,lodash:297}],13:[function(t,e,r){(function(r){"use strict";var n=t("lodash"),i=t("./base58"),s=t("buffer"),o=t("../crypto/hash").sha256sha256,a=function f(t){if(!(this instanceof f))return new f(t);if(r.isBuffer(t)){var e=t;this.fromBuffer(e)}else if("string"==typeof t){var n=t;this.fromString(n)}else t&&this.set(t)};a.prototype.set=function(t){return this.buf=t.buf||this.buf||void 0,this},a.validChecksum=function(t,e){return n.isString(t)&&(t=new s.Buffer(i.decode(t))),n.isString(e)&&(e=new s.Buffer(i.decode(e))),e||(e=t.slice(-4),t=t.slice(0,-4)),a.checksum(t).toString("hex")===e.toString("hex")},a.decode=function(t){if("string"!=typeof t)throw new Error("Input must be a string");var e=new r(i.decode(t));if(e.length<4)throw new Error("Input string too short");var n=e.slice(0,-4),s=e.slice(-4),a=o(n),f=a.slice(0,4);if(s.toString("hex")!==f.toString("hex"))throw new Error("Checksum mismatch");return n},a.checksum=function(t){return o(t).slice(0,4)},a.encode=function(t){if(!r.isBuffer(t))throw new Error("Input must be a buffer");var e=new r(t.length+4),n=a.checksum(t);return t.copy(e),n.copy(e,t.length),i.encode(e)},a.prototype.fromBuffer=function(t){return this.buf=t,this},a.prototype.fromString=function(t){var e=a.decode(t);return this.buf=e,this},a.prototype.toBuffer=function(){return this.buf},a.prototype.toString=function(){return a.encode(this.buf)},e.exports=a}).call(this,t("buffer").Buffer)},{"../crypto/hash":8,"./base58":12,buffer:48,lodash:297}],14:[function(t,e,r){(function(r){"use strict";var n=t("lodash"),i=t("../util/preconditions"),s=t("../util/buffer"),o=t("../crypto/bn"),a=function f(t){if(!(this instanceof f))return new f(t);if(!n.isUndefined(t))if(r.isBuffer(t))this.set({buf:t});else if(n.isString(t))this.set({buf:new r(t,"hex")});else{if(!n.isObject(t))throw new TypeError("Unrecognized argument for BufferReader");var e=t;this.set(e)}};a.prototype.set=function(t){return this.buf=t.buf||this.buf||void 0,this.pos=t.pos||this.pos||0,this},a.prototype.eof=function(){return this.pos>=this.buf.length},a.prototype.finished=a.prototype.eof,a.prototype.read=function(t){i.checkArgument(!n.isUndefined(t),"Must specify a length");var e=this.buf.slice(this.pos,this.pos+t);return this.pos=this.pos+t,e},a.prototype.readAll=function(){var t=this.buf.slice(this.pos,this.buf.length);return this.pos=this.buf.length,t},a.prototype.readUInt8=function(){var t=this.buf.readUInt8(this.pos);return this.pos=this.pos+1,t},a.prototype.readUInt16BE=function(){var t=this.buf.readUInt16BE(this.pos);return this.pos=this.pos+2,t},a.prototype.readUInt16LE=function(){var t=this.buf.readUInt16LE(this.pos);return this.pos=this.pos+2,t},a.prototype.readUInt32BE=function(){var t=this.buf.readUInt32BE(this.pos);return this.pos=this.pos+4,t},a.prototype.readUInt32LE=function(){var t=this.buf.readUInt32LE(this.pos);return this.pos=this.pos+4,t},a.prototype.readUInt64BEBN=function(){var t=this.buf.slice(this.pos,this.pos+8),e=o.fromBuffer(t);return this.pos=this.pos+8,e},a.prototype.readUInt64LEBN=function(){var t,e=this.buf.readUInt32LE(this.pos),r=this.buf.readUInt32LE(this.pos+4),n=4294967296*r+e;if(9007199254740991>=n)t=new o(n);else{var i=Array.prototype.slice.call(this.buf,this.pos,this.pos+8);t=new o(i,10,"le")}return this.pos=this.pos+8,t},a.prototype.readVarintNum=function(){var t=this.readUInt8();switch(t){case 253:return this.readUInt16LE();case 254:return this.readUInt32LE();case 255:var e=this.readUInt64LEBN(),r=e.toNumber();if(r<=Math.pow(2,53))return r;throw new Error("number too large to retain precision - use readVarintBN");default:return t}},a.prototype.readVarLengthBuffer=function(){var t=this.readVarintNum(),e=this.read(t);return i.checkState(e.length===t,"Invalid length while reading varlength buffer. Expected to read: "+t+" and read "+e.length),e},a.prototype.readVarintBuf=function(){var t=this.buf.readUInt8(this.pos);switch(t){case 253:return this.read(3);case 254:return this.read(5);case 255:return this.read(9);default:return this.read(1)}},a.prototype.readVarintBN=function(){var t=this.readUInt8();switch(t){case 253:return new o(this.readUInt16LE());case 254:return new o(this.readUInt32LE());case 255:return this.readUInt64LEBN();default:return new o(t)}},a.prototype.reverse=function(){for(var t=new r(this.buf.length),e=0;et?(e=new r(1),e.writeUInt8(t,0)):65536>t?(e=new r(3),e.writeUInt8(253,0),e.writeUInt16LE(t,1)):4294967296>t?(e=new r(5),e.writeUInt8(254,0),e.writeUInt32LE(t,1)):(e=new r(9),e.writeUInt8(255,0),e.writeInt32LE(-1&t,1),e.writeUInt32LE(Math.floor(t/4294967296),5)),e},s.varintBufBN=function(t){var e=void 0,n=t.toNumber();if(253>n)e=new r(1),e.writeUInt8(n,0);else if(65536>n)e=new r(3),e.writeUInt8(253,0),e.writeUInt16LE(n,1);else if(4294967296>n)e=new r(5),e.writeUInt8(254,0),e.writeUInt32LE(n,1);else{var i=new s;i.writeUInt8(255),i.writeUInt64LEBN(t);var e=i.concat()}return e},e.exports=s}).call(this,t("buffer").Buffer)},{"../util/buffer":43,assert:46,buffer:48}],16:[function(t,e,r){(function(r){"use strict";var n=t("./bufferwriter"),i=t("./bufferreader"),s=t("../crypto/bn"),o=function a(t){if(!(this instanceof a))return new a(t);if(r.isBuffer(t))this.buf=t;else if("number"==typeof t){var e=t;this.fromNumber(e)}else if(t instanceof s){var n=t;this.fromBN(n)}else if(t){var i=t;this.set(i)}};o.prototype.set=function(t){return this.buf=t.buf||this.buf,this},o.prototype.fromString=function(t){return this.set({buf:new r(t,"hex")}),this},o.prototype.toString=function(){return this.buf.toString("hex")},o.prototype.fromBuffer=function(t){return this.buf=t,this},o.prototype.fromBufferReader=function(t){return this.buf=t.readVarintBuf(),this},o.prototype.fromBN=function(t){return this.buf=n().writeVarintBN(t).concat(),this},o.prototype.fromNumber=function(t){return this.buf=n().writeVarintNum(t).concat(),this},o.prototype.toBuffer=function(){return this.buf},o.prototype.toBN=function(){return i(this.buf).readVarintBN()},o.prototype.toNumber=function(){return i(this.buf).readVarintNum()},e.exports=o}).call(this,t("buffer").Buffer)},{"../crypto/bn":6,"./bufferreader":14,"./bufferwriter":15,buffer:48}],17:[function(t,e,r){"use strict";function n(t,e){return t.replace("{0}",e[0]).replace("{1}",e[1]).replace("{2}",e[2])}var i=t("lodash"),s=function(t,e){var r=function(){if(i.isString(e.message))this.message=n(e.message,arguments);else{if(!i.isFunction(e.message))throw new Error("Invalid error definition for "+e.name);this.message=e.message.apply(null,arguments)}this.stack=this.message+"\n"+(new Error).stack};return r.prototype=Object.create(t.prototype),r.prototype.name=t.prototype.name+e.name,t[e.name]=r,e.errors&&o(r,e.errors),r},o=function(t,e){i.each(e,function(e){s(t,e)})},a=function(t,e){return o(t,e),t},f={};f.Error=function(){this.message="Internal error",this.stack=this.message+"\n"+(new Error).stack},f.Error.prototype=Object.create(Error.prototype),f.Error.prototype.name="bitcore.Error";var u=t("./spec");a(f.Error,u),e.exports=f.Error,e.exports.extend=function(t){return s(f.Error,t)}},{"./spec":18,lodash:297}],18:[function(t,e,r){"use strict";var n="http://bitcore.io/";e.exports=[{name:"InvalidB58Char",message:"Invalid Base58 character: {0} in {1}"},{name:"InvalidB58Checksum",message:"Invalid Base58 checksum for {0}"},{name:"InvalidNetwork",message:"Invalid version for network: got {0}"},{name:"InvalidState",message:"Invalid state: {0}"},{name:"NotImplemented",message:"Function {0} was not implemented yet"},{name:"InvalidNetworkArgument",message:'Invalid network: must be "livenet" or "testnet", got {0}'},{name:"InvalidArgument",message:function(){return"Invalid Argument"+(arguments[0]?": "+arguments[0]:"")+(arguments[1]?" Documentation: "+n+arguments[1]:"")}},{name:"AbstractMethodInvoked",message:"Abstract Method Invocation: {0}"},{name:"InvalidArgumentType",message:function(){return"Invalid Argument for "+arguments[2]+", expected "+arguments[1]+" but got "+typeof arguments[0]}},{name:"Unit",message:"Internal Error on Unit {0}",errors:[{name:"UnknownCode",message:"Unrecognized unit code: {0}"},{name:"InvalidRate",message:"Invalid exchange rate: {0}"}]},{name:"Transaction",message:"Internal Error on Transaction {0}",errors:[{name:"Input",message:"Internal Error on Input {0}",errors:[{name:"MissingScript",message:"Need a script to create an input"},{name:"UnsupportedScript",message:"Unsupported input script type: {0}"},{name:"MissingPreviousOutput",message:"No previous output information."}]},{name:"NeedMoreInfo",message:"{0}"},{name:"InvalidSorting",message:"The sorting function provided did not return the change output as one of the array elements"},{name:"InvalidOutputAmountSum",message:"{0}"},{name:"MissingSignatures",message:"Some inputs have not been fully signed"},{name:"InvalidIndex",message:"Invalid index: {0} is not between 0, {1}"},{name:"UnableToVerifySignature",message:"Unable to verify signature: {0}"},{name:"DustOutputs",message:"Dust amount detected in one output"},{name:"InvalidSatoshis",message:"Output satoshis are invalid"},{name:"FeeError",message:"Internal Error on Fee {0}",errors:[{name:"TooSmall",message:"Fee is too small: {0}"},{name:"TooLarge",message:"Fee is too large: {0}"},{name:"Different",message:"Unspent value is different from specified fee: {0}"}]},{name:"ChangeAddressMissing",message:"Change address is missing"},{name:"BlockHeightTooHigh",message:"Block Height can be at most 2^32 -1"},{name:"NLockTimeOutOfRange",message:"Block Height can only be between 0 and 499 999 999"},{name:"LockTimeTooEarly",message:"Lock Time can't be earlier than UNIX date 500 000 000"}]},{name:"Script",message:"Internal Error on Script {0}",errors:[{name:"UnrecognizedAddress",message:"Expected argument {0} to be an address"},{name:"CantDeriveAddress",message:"Can't derive address associated with script {0}, needs to be p2pkh in, p2pkh out, p2sh in, or p2sh out."},{name:"InvalidBuffer",message:"Invalid script buffer: can't parse valid script from given buffer {0}"}]},{name:"HDPrivateKey",message:"Internal Error on HDPrivateKey {0}",errors:[{name:"InvalidDerivationArgument",message:"Invalid derivation argument {0}, expected string, or number and boolean"},{name:"InvalidEntropyArgument",message:"Invalid entropy: must be an hexa string or binary buffer, got {0}",errors:[{name:"TooMuchEntropy",message:'Invalid entropy: more than 512 bits is non standard, got "{0}"'},{name:"NotEnoughEntropy",message:'Invalid entropy: at least 128 bits needed, got "{0}"'}]},{name:"InvalidLength",message:"Invalid length for xprivkey string in {0}"},{name:"InvalidPath",message:"Invalid derivation path: {0}"},{name:"UnrecognizedArgument",message:'Invalid argument: creating a HDPrivateKey requires a string, buffer, json or object, got "{0}"'}]},{name:"HDPublicKey",message:"Internal Error on HDPublicKey {0}",errors:[{name:"ArgumentIsPrivateExtended",message:"Argument is an extended private key: {0}"},{name:"InvalidDerivationArgument",message:"Invalid derivation argument: got {0}"},{name:"InvalidLength",message:'Invalid length for xpubkey: got "{0}"'},{name:"InvalidPath",message:'Invalid derivation path, it should look like: "m/1/100", got "{0}"'},{name:"InvalidIndexCantDeriveHardened",message:"Invalid argument: creating a hardened path requires an HDPrivateKey"},{name:"MustSupplyArgument",message:"Must supply an argument to create a HDPublicKey"},{name:"UnrecognizedArgument",message:"Invalid argument for creation, must be string, json, buffer, or object"}]}]},{}],19:[function(t,e,r){"use strict";e.exports={_cache:{},_count:0,_eraseIndex:0,_usedList:{},_usedIndex:{},_CACHE_SIZE:5e3,get:function(t,e,r){r=!!r;var n=t+"/"+e+"/"+r;return this._cache[n]?(this._cacheHit(n),this._cache[n]):void 0},set:function(t,e,r,n){r=!!r;var i=t+"/"+e+"/"+r;this._cache[i]=n,this._cacheHit(i)},_cacheHit:function(t){this._usedIndex[t]&&delete this._usedList[this._usedIndex[t]],this._usedList[this._count]=t,this._usedIndex[t]=this._count,this._count++,this._cacheRemove()},_cacheRemove:function(){for(;this._eraseIndex=0&&t=n.Hardened?!0:e,tI*S)throw new y.InvalidEntropyArgument.TooMuchEntropy(t);var i=h.sha512hmac(t,new s.Buffer("Bitcoin seed"));return new n({network:d.get(e)||d.defaultNetwork,depth:0,parentFingerPrint:0,childIndex:0,privateKey:i.slice(0,32),chainCode:i.slice(32,64)})},n.prototype._calcHDPublicKey=function(){if(!this._hdPublicKey){var e=t("./hdpublickey");this._hdPublicKey=new e(this)}},n.prototype._buildFromBuffers=function(t){n._validateBufferArguments(t),_.defineImmutable(this,{_buffers:t});var e=[t.version,t.depth,t.parentFingerPrint,t.childIndex,t.chainCode,v.emptyBuffer(1),t.privateKey],i=s.Buffer.concat(e);if(t.checksum&&t.checksum.length){if(t.checksum.toString()!==c.checksum(i).toString())throw new m.InvalidB58Checksum(i)}else t.checksum=c.checksum(i);var o,a=d.get(v.integerFromBuffer(t.version));o=c.encode(s.Buffer.concat(e)),t.xprivkey=new r(o);var u=new b(f.fromBuffer(t.privateKey),a),p=u.toPublicKey(),l=n.ParentFingerPrintSize,g=h.sha256ripemd160(p.toBuffer()).slice(0,l);return _.defineImmutable(this,{xprivkey:o,network:a,depth:v.integerFromSingleByteBuffer(t.depth),privateKey:u,publicKey:p,fingerPrint:g}),this._hdPublicKey=null,Object.defineProperty(this,"hdPublicKey",{configurable:!1,enumerable:!0,get:function(){return this._calcHDPublicKey(),this._hdPublicKey}}),Object.defineProperty(this,"xpubkey",{configurable:!1,enumerable:!0,get:function(){return this._calcHDPublicKey(),this._hdPublicKey.xpubkey}}),this},n._validateBufferArguments=function(t){var e=function(e,r){var n=t[e];i(v.isBuffer(n),e+" argument is not a buffer"),i(n.length===r,e+" has not the expected size: found "+n.length+", expected "+r)};e("version",n.VersionSize),e("depth",n.DepthSize),e("parentFingerPrint",n.ParentFingerPrintSize),e("childIndex",n.ChildIndexSize),e("chainCode",n.ChainCodeSize),e("privateKey",n.PrivateKeySize),t.checksum&&t.checksum.length&&e("checksum",n.CheckSumSize)},n.prototype.toString=function(){return this.xprivkey},n.prototype.inspect=function(){return""},n.prototype.toObject=n.prototype.toJSON=function(){return{network:d.get(v.integerFromBuffer(this._buffers.version),"xprivkey").name,depth:v.integerFromSingleByteBuffer(this._buffers.depth),fingerPrint:v.integerFromBuffer(this.fingerPrint),parentFingerPrint:v.integerFromBuffer(this._buffers.parentFingerPrint),childIndex:v.integerFromBuffer(this._buffers.childIndex),chainCode:v.bufferToHex(this._buffers.chainCode),privateKey:this.privateKey.toBuffer().toString("hex"),checksum:v.integerFromBuffer(this._buffers.checksum),xprivkey:this.xprivkey}},n.fromBuffer=function(t){return new n(t.toString())},n.prototype.toBuffer=function(){return v.copy(this._buffers.xprivkey)},n.DefaultDepth=0,n.DefaultFingerprint=0,n.DefaultChildIndex=0,n.Hardened=2147483648,n.MaxIndex=2*n.Hardened,n.RootElementAlias=["m","M","m'","M'"],n.VersionSize=4,n.DepthSize=1,n.ParentFingerPrintSize=4,n.ChildIndexSize=4,n.ChainCodeSize=32,n.PrivateKeySize=32,n.CheckSumSize=4,n.DataLength=78,n.SerializedByteSize=82,n.VersionStart=0,n.VersionEnd=n.VersionStart+n.VersionSize,n.DepthStart=n.VersionEnd,n.DepthEnd=n.DepthStart+n.DepthSize,n.ParentFingerPrintStart=n.DepthEnd,n.ParentFingerPrintEnd=n.ParentFingerPrintStart+n.ParentFingerPrintSize,n.ChildIndexStart=n.ParentFingerPrintEnd,n.ChildIndexEnd=n.ChildIndexStart+n.ChildIndexSize,n.ChainCodeStart=n.ChildIndexEnd,n.ChainCodeEnd=n.ChainCodeStart+n.ChainCodeSize,n.PrivateKeyStart=n.ChainCodeEnd+1,n.PrivateKeyEnd=n.PrivateKeyStart+n.PrivateKeySize,n.ChecksumStart=n.PrivateKeyEnd,n.ChecksumEnd=n.ChecksumStart+n.CheckSumSize,i(n.ChecksumEnd===n.SerializedByteSize),e.exports=n}).call(this,t("buffer").Buffer)},{"./crypto/bn":6,"./crypto/hash":8,"./crypto/point":9,"./crypto/random":10,"./encoding/base58":12,"./encoding/base58check":13,"./errors":17,"./hdkeycache":19,"./hdpublickey":21,"./networks":22,"./privatekey":24,"./util/buffer":43,"./util/js":44,"./util/preconditions":45,assert:46,buffer:48,lodash:297}],21:[function(t,e,r){(function(r){"use strict";function n(t){if(t instanceof n)return t;if(!(this instanceof n))return new n(t);if(t){if(i.isString(t)||_.isBuffer(t)){var e=n.getSerializedError(t);if(e){if(_.isBuffer(t)&&!n.getSerializedError(t.toString()))return this._buildFromSerialized(t.toString());if(e instanceof m.ArgumentIsPrivateExtended)return new c(t).hdPublicKey;throw e}return this._buildFromSerialized(t)}if(i.isObject(t))return t instanceof c?this._buildFromPrivate(t):this._buildFromObject(t);throw new m.UnrecognizedArgument(t)}throw new m.MustSupplyArgument}var i=t("lodash"),s=t("./util/preconditions"),o=t("./crypto/bn"),a=t("./encoding/base58"),f=t("./encoding/base58check"),u=t("./crypto/hash"),c=t("./hdprivatekey"),h=t("./hdkeycache"),d=t("./networks"),p=t("./crypto/point"),l=t("./publickey"),b=t("./errors"),g=b,m=b.HDPublicKey,y=t("assert"),v=t("./util/js"),_=t("./util/buffer");n.isValidPath=function(t){if(i.isString(t)){var e=c._getDerivationIndexes(t);return null!==e&&i.all(e,n.isValidPath)}return i.isNumber(t)?t>=0&&t=n.Hardened||e)throw new m.InvalidIndexCantDeriveHardened;if(0>t)throw new m.InvalidPath(t);var r=h.get(this.xpubkey,t,!1);if(r)return r;var i=_.integerAsBuffer(t),s=_.concat([this.publicKey.toBuffer(),i]),a=u.sha512hmac(s,this._buffers.chainCode),f=o.fromBuffer(a.slice(0,32),{size:32}),c=a.slice(32,64),d=l.fromPoint(p.getG().mul(f).add(this.publicKey.point)),b=new n({network:this.network,depth:this.depth+1,parentFingerPrint:this.fingerPrint,childIndex:t,chainCode:c,publicKey:d});return h.set(this.xpubkey,t,!1,b),b},n.prototype._deriveFromString=function(t){if(i.contains(t,"'"))throw new m.InvalidIndexCantDeriveHardened;if(!n.isValidPath(t))throw new m.InvalidPath(t);var e=c._getDerivationIndexes(t),r=e.reduce(function(t,e){return t._deriveWithNumber(e)},this);return r},n.isValidSerialized=function(t,e){return i.isNull(n.getSerializedError(t,e))},n.getSerializedError=function(t,e){if(!i.isString(t)&&!_.isBuffer(t))return new m.UnrecognizedArgument("expected buffer or string");if(!a.validCharacters(t))return new g.InvalidB58Char("(unknown)",t);try{t=f.decode(t)}catch(r){return new g.InvalidB58Checksum(t)}if(t.length!==n.DataSize)return new m.InvalidLength(t);if(!i.isUndefined(e)){var s=n._validateNetwork(t,e);if(s)return s}var o=_.integerFromBuffer(t.slice(0,4));return o===d.livenet.xprivkey||o===d.testnet.xprivkey?new m.ArgumentIsPrivateExtended:null},n._validateNetwork=function(t,e){var r=d.get(e);if(!r)return new g.InvalidNetworkArgument(e);var i=t.slice(n.VersionStart,n.VersionEnd);return _.integerFromBuffer(i)!==r.xpubkey?new g.InvalidNetwork(i):null},n.prototype._buildFromPrivate=function(t){var e=i.clone(t._buffers),r=p.getG().mul(o.fromBuffer(e.privateKey));return e.publicKey=p.pointToCompressed(r),e.version=_.integerAsBuffer(d.get(_.integerFromBuffer(e.version)).xpubkey),e.privateKey=void 0,e.checksum=void 0,e.xprivkey=void 0,this._buildFromBuffers(e)},n.prototype._buildFromObject=function(t){var e={version:t.network?_.integerAsBuffer(d.get(t.network).xpubkey):t.version,depth:i.isNumber(t.depth)?_.integerAsSingleByteBuffer(t.depth):t.depth,parentFingerPrint:i.isNumber(t.parentFingerPrint)?_.integerAsBuffer(t.parentFingerPrint):t.parentFingerPrint,childIndex:i.isNumber(t.childIndex)?_.integerAsBuffer(t.childIndex):t.childIndex,chainCode:i.isString(t.chainCode)?_.hexToBuffer(t.chainCode):t.chainCode,publicKey:i.isString(t.publicKey)?_.hexToBuffer(t.publicKey):_.isBuffer(t.publicKey)?t.publicKey:t.publicKey.toBuffer(),checksum:i.isNumber(t.checksum)?_.integerAsBuffer(t.checksum):t.checksum};return this._buildFromBuffers(e)},n.prototype._buildFromSerialized=function(t){var e=f.decode(t),r={version:e.slice(n.VersionStart,n.VersionEnd),depth:e.slice(n.DepthStart,n.DepthEnd),parentFingerPrint:e.slice(n.ParentFingerPrintStart,n.ParentFingerPrintEnd),childIndex:e.slice(n.ChildIndexStart,n.ChildIndexEnd),chainCode:e.slice(n.ChainCodeStart,n.ChainCodeEnd),publicKey:e.slice(n.PublicKeyStart,n.PublicKeyEnd),checksum:e.slice(n.ChecksumStart,n.ChecksumEnd),xpubkey:t};return this._buildFromBuffers(r)},n.prototype._buildFromBuffers=function(t){n._validateBufferArguments(t),v.defineImmutable(this,{_buffers:t});var e=[t.version,t.depth,t.parentFingerPrint,t.childIndex,t.chainCode,t.publicKey],i=_.concat(e),s=f.checksum(i);if(t.checksum&&t.checksum.length){if(t.checksum.toString("hex")!==s.toString("hex"))throw new g.InvalidB58Checksum(i,s)}else t.checksum=s;var o,a=d.get(_.integerFromBuffer(t.version));o=f.encode(_.concat(e)),t.xpubkey=new r(o);var c=new l(t.publicKey,{network:a}),h=n.ParentFingerPrintSize,p=u.sha256ripemd160(c.toBuffer()).slice(0,h);return v.defineImmutable(this,{xpubkey:o,network:a,depth:_.integerFromSingleByteBuffer(t.depth),publicKey:c,fingerPrint:p}),this},n._validateBufferArguments=function(t){var e=function(e,r){var n=t[e];y(_.isBuffer(n),e+" argument is not a buffer, it's "+typeof n),y(n.length===r,e+" has not the expected size: found "+n.length+", expected "+r)};e("version",n.VersionSize),e("depth",n.DepthSize),e("parentFingerPrint",n.ParentFingerPrintSize),e("childIndex",n.ChildIndexSize),e("chainCode",n.ChainCodeSize),e("publicKey",n.PublicKeySize),t.checksum&&t.checksum.length&&e("checksum",n.CheckSumSize)},n.fromString=function(t){return s.checkArgument(i.isString(t),"No valid string was provided"),new n(t)},n.fromObject=function(t){return s.checkArgument(i.isObject(t),"No valid argument was provided"),new n(t)},n.prototype.toString=function(){return this.xpubkey},n.prototype.inspect=function(){return""},n.prototype.toObject=n.prototype.toJSON=function(){return{network:d.get(_.integerFromBuffer(this._buffers.version)).name,depth:_.integerFromSingleByteBuffer(this._buffers.depth),fingerPrint:_.integerFromBuffer(this.fingerPrint),parentFingerPrint:_.integerFromBuffer(this._buffers.parentFingerPrint),childIndex:_.integerFromBuffer(this._buffers.childIndex),chainCode:_.bufferToHex(this._buffers.chainCode),publicKey:this.publicKey.toString(),checksum:_.integerFromBuffer(this._buffers.checksum),xpubkey:this.xpubkey}},n.fromBuffer=function(t){return new n(t)},n.prototype.toBuffer=function(){return _.copy(this._buffers.xpubkey)},n.Hardened=2147483648,n.RootElementAlias=["m","M"],n.VersionSize=4,n.DepthSize=1,n.ParentFingerPrintSize=4,n.ChildIndexSize=4,n.ChainCodeSize=32,n.PublicKeySize=33,n.CheckSumSize=4,n.DataSize=78,n.SerializedByteSize=82,n.VersionStart=0,n.VersionEnd=n.VersionStart+n.VersionSize,n.DepthStart=n.VersionEnd,n.DepthEnd=n.DepthStart+n.DepthSize,n.ParentFingerPrintStart=n.DepthEnd,n.ParentFingerPrintEnd=n.ParentFingerPrintStart+n.ParentFingerPrintSize,n.ChildIndexStart=n.ParentFingerPrintEnd,n.ChildIndexEnd=n.ChildIndexStart+n.ChildIndexSize,n.ChainCodeStart=n.ChildIndexEnd,n.ChainCodeEnd=n.ChainCodeStart+n.ChainCodeSize,n.PublicKeyStart=n.ChainCodeEnd,n.PublicKeyEnd=n.PublicKeyStart+n.PublicKeySize,n.ChecksumStart=n.PublicKeyEnd,n.ChecksumEnd=n.ChecksumStart+n.CheckSumSize,y(n.PublicKeyEnd===n.DataSize),y(n.ChecksumEnd===n.SerializedByteSize),e.exports=n}).call(this,t("buffer").Buffer)},{"./crypto/bn":6,"./crypto/hash":8,"./crypto/point":9,"./encoding/base58":12,"./encoding/base58check":13,"./errors":17,"./hdkeycache":19,"./hdprivatekey":20,"./networks":22,"./publickey":25,"./util/buffer":43,"./util/js":44,"./util/preconditions":45,assert:46,buffer:48,lodash:297}],22:[function(t,e,r){"use strict";function n(){}function i(t,e){if(~d.indexOf(t))return t;{if(!e)return p[t];u.isArray(e)||(e=[e]);var r=function(e){return d[n][e]===t};for(var n in d)if(u.any(e,r))return d[n]}}function s(t){var e=new n;return h.defineImmutable(e,{name:t.name,alias:t.alias,pubkeyhash:t.pubkeyhash,privatekey:t.privatekey,scripthash:t.scripthash,xpubkey:t.xpubkey,xprivkey:t.xprivkey}),t.networkMagic&&h.defineImmutable(e,{networkMagic:c.integerAsBuffer(t.networkMagic)}),t.port&&h.defineImmutable(e,{port:t.port}),t.dnsSeeds&&h.defineImmutable(e,{dnsSeeds:t.dnsSeeds}),u.each(e,function(t){u.isUndefined(t)||u.isObject(t)||(p[t]=e)}),d.push(e),e}function o(t){for(var e=0;e=0&&16>=t,"Invalid Argument: n must be between 0 and 16"),0===t?n("OP_0"):new n(n.map.OP_1+t-1)},n.map={OP_FALSE:0,OP_0:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_TRUE:81,OP_1:81,OP_2:82,OP_3:83,OP_4:84,OP_5:85,OP_6:86,OP_7:87,OP_8:88,OP_9:89,OP_10:90,OP_11:91,OP_12:92,OP_13:93,OP_14:94,OP_15:95,OP_16:96,OP_NOP:97,OP_VER:98,OP_IF:99,OP_NOTIF:100,OP_VERIF:101,OP_VERNOTIF:102,OP_ELSE:103,OP_ENDIF:104,OP_VERIFY:105,OP_RETURN:106,OP_TOALTSTACK:107,OP_FROMALTSTACK:108,OP_2DROP:109,OP_2DUP:110,OP_3DUP:111,OP_2OVER:112,OP_2ROT:113,OP_2SWAP:114,OP_IFDUP:115,OP_DEPTH:116,OP_DROP:117,OP_DUP:118,OP_NIP:119,OP_OVER:120,OP_PICK:121,OP_ROLL:122,OP_ROT:123,OP_SWAP:124,OP_TUCK:125,OP_CAT:126,OP_SUBSTR:127,OP_LEFT:128,OP_RIGHT:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_CHECKLOCKTIMEVERIFY:177,OP_NOP1:176,OP_NOP2:177,OP_NOP3:178,OP_NOP4:179,OP_NOP5:180,OP_NOP6:181,OP_NOP7:182,OP_NOP8:183,OP_NOP9:184,OP_NOP10:185,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255},n.reverseMap=[];for(var f in n.map)n.reverseMap[n.map[f]]=f;i.extend(n,n.map),n.isSmallIntOp=function(t){return t instanceof n&&(t=t.toNumber()),t===n.map.OP_0||t>=n.map.OP_1&&t<=n.map.OP_16},n.prototype.inspect=function(){return""},e.exports=n}).call(this,t("buffer").Buffer)},{"./util/buffer":43,"./util/js":44,"./util/preconditions":45,buffer:48,lodash:297}],24:[function(t,e,r){(function(r){"use strict";function n(t,e){if(!(this instanceof n))return new n(t,e);if(t instanceof n)return t;var r=this._classifyArguments(t,e);if(!r.bn||0===r.bn.cmp(new a(0)))throw new TypeError("Number can not be equal to zero, undefined, null or false");if(!r.bn.lt(c.getN()))throw new TypeError("Number must be less than N");if("undefined"==typeof r.network)throw new TypeError('Must specify the network ("livenet" or "testnet")');return f.defineImmutable(this,{bn:r.bn,compressed:r.compressed,network:r.network}),Object.defineProperty(this,"publicKey",{configurable:!1,enumerable:!0,get:this.toPublicKey.bind(this)}),this}var i=t("lodash"),s=t("./address"),o=t("./encoding/base58check"),a=t("./crypto/bn"),f=t("./util/js"),u=t("./networks"),c=t("./crypto/point"),h=t("./publickey"),d=t("./crypto/random"),p=t("./util/preconditions");n.prototype._classifyArguments=function(t,e){var s={compressed:!0,network:e?u.get(e):u.defaultNetwork};if(i.isUndefined(t)||i.isNull(t))s.bn=n._getRandomBN();else if(t instanceof a)s.bn=t;else if(t instanceof r||t instanceof Uint8Array)s=n._transformBuffer(t,e);else if(t.bn&&t.network)s=n._transformObject(t);else if(!e&&u.get(t))s.bn=n._getRandomBN(),s.network=u.get(t);else{if("string"!=typeof t)throw new TypeError("First argument is an unrecognized data type.");f.isHexa(t)?s.bn=new a(new r(t,"hex")):s=n._transformWIF(t,e)}return s},n._getRandomBN=function(){var t,e;do{var r=d.getRandomBuffer(32);e=a.fromBuffer(r),t=e.lt(c.getN())}while(!t);return e},n._transformBuffer=function(t,e){var r={};if(32===t.length)return n._transformBNBuffer(t,e);if(r.network=u.get(t[0],"privatekey"),!r.network)throw new Error("Invalid network");if(e&&r.network!==u.get(e))throw new TypeError("Private key network mismatch");if(34===t.length&&1===t[33])r.compressed=!0;else{if(33!==t.length)throw new Error("Length of buffer must be 33 (uncompressed) or 34 (compressed)");r.compressed=!1}return r.bn=a.fromBuffer(t.slice(1,33)),r},n._transformBNBuffer=function(t,e){var r={};return r.network=u.get(e)||u.defaultNetwork,r.bn=a.fromBuffer(t),r.compressed=!1,r},n._transformWIF=function(t,e){return n._transformBuffer(o.decode(t),e)},n.fromBuffer=function(t,e){return new n(t,e)},n._transformObject=function(t){var e=new a(t.bn,"hex"),r=u.get(t.network);return{bn:e,network:r,compressed:t.compressed}},n.fromString=n.fromWIF=function(t){return p.checkArgument(i.isString(t),"First argument is expected to be a string."),new n(t)},n.fromObject=function(t){return p.checkArgument(i.isObject(t),"First argument is expected to be an object."),new n(t)},n.fromRandom=function(t){var e=n._getRandomBN();return new n(e,t)},n.getValidationError=function(t,e){var r;try{new n(t,e)}catch(i){r=i}return r},n.isValid=function(t,e){return t?!n.getValidationError(t,e):!1},n.prototype.toString=function(){return this.toBuffer().toString("hex")},n.prototype.toWIF=function(){var t,e=this.network,n=this.compressed;return t=n?r.concat([new r([e.privatekey]),this.bn.toBuffer({size:32}),new r([1])]):r.concat([new r([e.privatekey]),this.bn.toBuffer({size:32})]),o.encode(t)},n.prototype.toBigNumber=function(){return this.bn},n.prototype.toBuffer=function(){return this.bn.toBuffer()},n.prototype.toPublicKey=function(){return this._pubkey||(this._pubkey=h.fromPrivateKey(this)),this._pubkey},n.prototype.toAddress=function(t){var e=this.toPublicKey();return s.fromPublicKey(e,t||this.network)},n.prototype.toObject=n.prototype.toJSON=function(){return{bn:this.bn.toString("hex"),compressed:this.compressed,network:this.network.toString()}},n.prototype.inspect=function(){var t=this.compressed?"":", uncompressed";return""},e.exports=n}).call(this,t("buffer").Buffer)},{"./address":1,"./crypto/bn":6,"./crypto/point":9,"./crypto/random":10,"./encoding/base58check":13,"./networks":22,"./publickey":25,"./util/js":44,"./util/preconditions":45,buffer:48,lodash:297}],25:[function(t,e,r){(function(r){"use strict";function n(t,e){if(!(this instanceof n))return new n(t,e);if(c.checkArgument(t,"First argument is required, please include public key data."),t instanceof n)return t;e=e||{};var r=this._classifyArgs(t,e);return r.point.validate(),a.defineImmutable(this,{point:r.point,compressed:r.compressed,network:r.network||f.defaultNetwork}),this}var i=t("./crypto/bn"),s=t("./crypto/point"),o=t("./crypto/hash"),a=t("./util/js"),f=t("./networks"),u=t("lodash"),c=t("./util/preconditions");n.prototype._classifyArgs=function(t,e){var i={compressed:u.isUndefined(e.compressed)||e.compressed};if(t instanceof s)i.point=t;else if(t.x&&t.y)i=n._transformObject(t);else if("string"==typeof t)i=n._transformDER(new r(t,"hex"));else if(n._isBuffer(t))i=n._transformDER(t);else{if(!n._isPrivateKey(t))throw new TypeError("First argument is an unrecognized data format.");i=n._transformPrivateKey(t)}return i.network||(i.network=u.isUndefined(e.network)?void 0:f.get(e.network)),i},n._isPrivateKey=function(e){var r=t("./privatekey");return e instanceof r},n._isBuffer=function(t){return t instanceof r||t instanceof Uint8Array},n._transformPrivateKey=function(t){c.checkArgument(n._isPrivateKey(t),"Must be an instance of PrivateKey");var e={};return e.point=s.getG().mul(t.bn),e.compressed=t.compressed,e.network=t.network,e},n._transformDER=function(t,e){c.checkArgument(n._isBuffer(t),"Must be a hex buffer of DER encoded public key");var r={};e=u.isUndefined(e)?!0:e;var o,a,f,h;if(4!==t[0]&&(e||6!==t[0]&&7!==t[0]))if(3===t[0])f=t.slice(1),o=new i(f),r=n._transformX(!0,o),r.compressed=!0;else{if(2!==t[0])throw new TypeError("Invalid DER format public key");f=t.slice(1),o=new i(f),r=n._transformX(!1,o),r.compressed=!0}else{if(f=t.slice(1,33),h=t.slice(33,65),32!==f.length||32!==h.length||65!==t.length)throw new TypeError("Length of x and y must be 32 bytes");o=new i(f),a=new i(h),r.point=new s(o,a),r.compressed=!1}return r},n._transformX=function(t,e){c.checkArgument("boolean"==typeof t,"Must specify whether y is odd or not (true or false)");var r={};return r.point=s.fromX(t,e),r},n._transformObject=function(t){var e=new i(t.x,"hex"),r=new i(t.y,"hex"),o=new s(e,r);return new n(o,{compressed:t.compressed})},n.fromPrivateKey=function(t){c.checkArgument(n._isPrivateKey(t),"Must be an instance of PrivateKey");var e=n._transformPrivateKey(t);return new n(e.point,{compressed:e.compressed,network:e.network})},n.fromDER=n.fromBuffer=function(t,e){c.checkArgument(n._isBuffer(t),"Must be a hex buffer of DER encoded public key");var r=n._transformDER(t,e);return new n(r.point,{compressed:r.compressed})},n.fromPoint=function(t,e){return c.checkArgument(t instanceof s,"First argument must be an instance of Point."),new n(t,{compressed:e})},n.fromString=function(t,e){var i=new r(t,e||"hex"),s=n._transformDER(i);return new n(s.point,{compressed:s.compressed})},n.fromX=function(t,e){var r=n._transformX(t,e);return new n(r.point,{compressed:r.compressed})},n.getValidationError=function(t){var e;try{new n(t)}catch(r){e=r}return e},n.isValid=function(t){return!n.getValidationError(t)},n.prototype.toObject=n.prototype.toJSON=function(){return{x:this.point.getX().toString("hex",2),y:this.point.getY().toString("hex",2),compressed:this.compressed}},n.prototype.toBuffer=n.prototype.toDER=function(){var t,e=this.point.getX(),n=this.point.getY(),i=e.toBuffer({size:32}),s=n.toBuffer({size:32});if(this.compressed){var o=s[s.length-1]%2;return t=new r(o?[3]:[2]),r.concat([t,i])}return t=new r([4]),r.concat([t,i,s])},n.prototype._getID=function(){return o.sha256ripemd160(this.toBuffer())},n.prototype.toAddress=function(e){var r=t("./address");return r.fromPublicKey(this,e||this.network)},n.prototype.toString=function(){return this.toDER().toString("hex")},n.prototype.inspect=function(){return""},e.exports=n}).call(this,t("buffer").Buffer)},{"./address":1,"./crypto/bn":6,"./crypto/hash":8,"./crypto/point":9,"./networks":22,"./privatekey":24,"./util/js":44,"./util/preconditions":45,buffer:48,lodash:297}],26:[function(t,e,r){e.exports=t("./script"),e.exports.Interpreter=t("./interpreter")},{"./interpreter":27,"./script":28}],27:[function(t,e,r){(function(r){"use strict";var n=t("lodash"),i=t("./script"),s=t("../opcode"),o=t("../crypto/bn"),a=t("../crypto/hash"),f=t("../crypto/signature"),u=t("../publickey"),c=function h(t){return this instanceof h?void(t?(this.initialize(),this.set(t)):this.initialize()):new h(t)};c.prototype.verify=function(e,r,s,o,a){var f=t("../transaction");n.isUndefined(s)&&(s=new f),n.isUndefined(o)&&(o=0),n.isUndefined(a)&&(a=0),this.set({script:e,tx:s,nin:o,flags:a});var u;if(0!==(a&c.SCRIPT_VERIFY_SIGPUSHONLY)&&!e.isPushOnly())return this.errstr="SCRIPT_ERR_SIG_PUSHONLY",!1;if(!this.evaluate())return!1;a&c.SCRIPT_VERIFY_P2SH&&(u=this.stack.slice());var h=this.stack;if(this.initialize(),this.set({script:r,stack:h,tx:s,nin:o,flags:a}),!this.evaluate())return!1;if(0===this.stack.length)return this.errstr="SCRIPT_ERR_EVAL_FALSE_NO_RESULT",!1;var d=this.stack[this.stack.length-1];if(!c.castToBool(d))return this.errstr="SCRIPT_ERR_EVAL_FALSE_IN_STACK",!1;if(a&c.SCRIPT_VERIFY_P2SH&&r.isScriptHashOut()){if(!e.isPushOnly())return this.errstr="SCRIPT_ERR_SIG_PUSHONLY",!1;if(0===u.length)throw new Error("internal error - stack copy empty");var p=u[u.length-1],l=i.fromBuffer(p);return u.pop(),this.initialize(),this.set({script:l,stack:u,tx:s,nin:o,flags:a}),this.evaluate()?0===u.length?(this.errstr="SCRIPT_ERR_EVAL_FALSE_NO_P2SH_STACK",!1):c.castToBool(u[u.length-1])?!0:(this.errstr="SCRIPT_ERR_EVAL_FALSE_IN_P2SH_STACK",!1):!1}return!0},e.exports=c,c.prototype.initialize=function(t){this.stack=[],this.altstack=[],this.pc=0,this.pbegincodehash=0,this.nOpCount=0,this.vfExec=[],this.errstr="",this.flags=0},c.prototype.set=function(t){this.script=t.script||this.script,this.tx=t.tx||this.tx,this.nin="undefined"!=typeof t.nin?t.nin:this.nin,this.stack=t.stack||this.stack,this.altstack=t.altack||this.altstack,this.pc="undefined"!=typeof t.pc?t.pc:this.pc,this.pbegincodehash="undefined"!=typeof t.pbegincodehash?t.pbegincodehash:this.pbegincodehash,this.nOpCount="undefined"!=typeof t.nOpCount?t.nOpCount:this.nOpCount,this.vfExec=t.vfExec||this.vfExec,this.errstr=t.errstr||this.errstr,this.flags="undefined"!=typeof t.flags?t.flags:this.flags},c["true"]=new r([1]),c["false"]=new r([]),c.MAX_SCRIPT_ELEMENT_SIZE=520,c.LOCKTIME_THRESHOLD=5e8,c.LOCKTIME_THRESHOLD_BN=new o(c.LOCKTIME_THRESHOLD),c.SCRIPT_VERIFY_NONE=0,c.SCRIPT_VERIFY_P2SH=1,c.SCRIPT_VERIFY_STRICTENC=2,c.SCRIPT_VERIFY_DERSIG=4,c.SCRIPT_VERIFY_LOW_S=8,c.SCRIPT_VERIFY_NULLDUMMY=16,c.SCRIPT_VERIFY_SIGPUSHONLY=32,c.SCRIPT_VERIFY_MINIMALDATA=64,c.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS=128,c.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY=512,c.castToBool=function(t){for(var e=0;e1e4)return this.errstr="SCRIPT_ERR_SCRIPT_SIZE",!1;try{for(;this.pc1e3)return this.errstr="SCRIPT_ERR_STACK_SIZE",!1}catch(e){return this.errstr="SCRIPT_ERR_UNKNOWN_ERROR: "+e,!1}return this.vfExec.length>0?(this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1):!0},c.prototype.checkLockTime=function(t){return this.tx.nLockTime=c.LOCKTIME_THRESHOLD&&t.gte(c.LOCKTIME_THRESHOLD_BN)?t.gt(new o(this.tx.nLockTime))?!1:this.tx.inputs[this.nin].isFinal()?!0:!1:!1},c.prototype.step=function(){var t,e,r,h,d,p,l,b,g,m,y,v,_,w,S,I,k,E=0!==(this.flags&c.SCRIPT_VERIFY_MINIMALDATA),A=-1===this.vfExec.indexOf(!1),x=this.script.chunks[this.pc];this.pc++;var P=x.opcodenum;if(n.isUndefined(P))return this.errstr="SCRIPT_ERR_UNDEFINED_OPCODE",!1;if(x.buf&&x.buf.length>c.MAX_SCRIPT_ELEMENT_SIZE)return this.errstr="SCRIPT_ERR_PUSH_SIZE",!1;if(P>s.OP_16&&++this.nOpCount>201)return this.errstr="SCRIPT_ERR_OP_COUNT",!1;if(P===s.OP_CAT||P===s.OP_SUBSTR||P===s.OP_LEFT||P===s.OP_RIGHT||P===s.OP_INVERT||P===s.OP_AND||P===s.OP_OR||P===s.OP_XOR||P===s.OP_2MUL||P===s.OP_2DIV||P===s.OP_MUL||P===s.OP_DIV||P===s.OP_MOD||P===s.OP_LSHIFT||P===s.OP_RSHIFT)return this.errstr="SCRIPT_ERR_DISABLED_OPCODE",!1;if(A&&P>=0&&P<=s.OP_PUSHDATA4){if(E&&!this.script.checkMinimalPush(this.pc-1))return this.errstr="SCRIPT_ERR_MINIMALDATA",!1;if(x.buf){if(x.len!==x.buf.length)throw new Error("Length of push value not equal to length of data");this.stack.push(x.buf)}else this.stack.push(c["false"])}else if(A||s.OP_IF<=P&&P<=s.OP_ENDIF)switch(P){case s.OP_1NEGATE:case s.OP_1:case s.OP_2:case s.OP_3:case s.OP_4:case s.OP_5:case s.OP_6:case s.OP_7:case s.OP_8:case s.OP_9:case s.OP_10:case s.OP_11:case s.OP_12:case s.OP_13:case s.OP_14:case s.OP_15:case s.OP_16:d=P-(s.OP_1-1),t=new o(d).toScriptNumBuffer(),this.stack.push(t);break;case s.OP_NOP:break;case s.OP_NOP2:case s.OP_CHECKLOCKTIMEVERIFY:if(!(this.flags&c.SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY)){if(this.flags&c.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break}if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;var O=o.fromScriptNumBuffer(this.stack[this.stack.length-1],E,5);if(O.lt(new o(0)))return this.errstr="SCRIPT_ERR_NEGATIVE_LOCKTIME",!1;if(!this.checkLockTime(O))return this.errstr="SCRIPT_ERR_UNSATISFIED_LOCKTIME",!1;break;case s.OP_NOP1:case s.OP_NOP3:case s.OP_NOP4:case s.OP_NOP5:case s.OP_NOP6:case s.OP_NOP7:case s.OP_NOP8:case s.OP_NOP9:case s.OP_NOP10:if(this.flags&c.SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS)return this.errstr="SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS",!1;break;case s.OP_IF:case s.OP_NOTIF:if(I=!1,A){if(this.stack.length<1)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;t=this.stack.pop(),I=c.castToBool(t),P===s.OP_NOTIF&&(I=!I)}this.vfExec.push(I);break;case s.OP_ELSE:if(0===this.vfExec.length)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;this.vfExec[this.vfExec.length-1]=!this.vfExec[this.vfExec.length-1];break;case s.OP_ENDIF:if(0===this.vfExec.length)return this.errstr="SCRIPT_ERR_UNBALANCED_CONDITIONAL",!1;this.vfExec.pop();break;case s.OP_VERIFY:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(t=this.stack[this.stack.length-1],I=c.castToBool(t),!I)return this.errstr="SCRIPT_ERR_VERIFY",!1;this.stack.pop();break;case s.OP_RETURN:return this.errstr="SCRIPT_ERR_OP_RETURN",!1;case s.OP_TOALTSTACK:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.altstack.push(this.stack.pop());break;case s.OP_FROMALTSTACK:if(this.altstack.length<1)return this.errstr="SCRIPT_ERR_INVALID_ALTSTACK_OPERATION",!1;this.stack.push(this.altstack.pop());break;case s.OP_2DROP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.pop(),this.stack.pop();break;case s.OP_2DUP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;e=this.stack[this.stack.length-2],r=this.stack[this.stack.length-1],this.stack.push(e),this.stack.push(r);break;case s.OP_3DUP:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;e=this.stack[this.stack.length-3],r=this.stack[this.stack.length-2];var B=this.stack[this.stack.length-1];this.stack.push(e),this.stack.push(r),this.stack.push(B);break;case s.OP_2OVER:if(this.stack.length<4)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;e=this.stack[this.stack.length-4],r=this.stack[this.stack.length-3],this.stack.push(e),this.stack.push(r);break;case s.OP_2ROT:if(this.stack.length<6)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;h=this.stack.splice(this.stack.length-6,2),this.stack.push(h[0]),this.stack.push(h[1]);break;case s.OP_2SWAP:if(this.stack.length<4)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;h=this.stack.splice(this.stack.length-4,2),this.stack.push(h[0]),this.stack.push(h[1]);break;case s.OP_IFDUP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;t=this.stack[this.stack.length-1],I=c.castToBool(t),I&&this.stack.push(t);break;case s.OP_DEPTH:t=new o(this.stack.length).toScriptNumBuffer(),this.stack.push(t);break;case s.OP_DROP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.pop();break;case s.OP_DUP:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.push(this.stack[this.stack.length-1]);break;case s.OP_NIP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.splice(this.stack.length-2,1);break;case s.OP_OVER:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.push(this.stack[this.stack.length-2]);break;case s.OP_PICK:case s.OP_ROLL:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(t=this.stack[this.stack.length-1],b=o.fromScriptNumBuffer(t,E),d=b.toNumber(),this.stack.pop(),0>d||d>=this.stack.length)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;t=this.stack[this.stack.length-d-1],P===s.OP_ROLL&&this.stack.splice(this.stack.length-d-1,1),this.stack.push(t);break;case s.OP_ROT:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;p=this.stack[this.stack.length-3],l=this.stack[this.stack.length-2];var M=this.stack[this.stack.length-1];this.stack[this.stack.length-3]=l,this.stack[this.stack.length-2]=M,this.stack[this.stack.length-1]=p;break;case s.OP_SWAP:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;p=this.stack[this.stack.length-2],l=this.stack[this.stack.length-1],this.stack[this.stack.length-2]=l,this.stack[this.stack.length-1]=p;break;case s.OP_TUCK:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;this.stack.splice(this.stack.length-2,0,this.stack[this.stack.length-1]);break;case s.OP_SIZE:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;b=new o(this.stack[this.stack.length-1].length),this.stack.push(b.toScriptNumBuffer());break;case s.OP_EQUAL:case s.OP_EQUALVERIFY:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;e=this.stack[this.stack.length-2],r=this.stack[this.stack.length-1];var R=e.toString("hex")===r.toString("hex");if(this.stack.pop(),this.stack.pop(),this.stack.push(R?c["true"]:c["false"]),P===s.OP_EQUALVERIFY){if(!R)return this.errstr="SCRIPT_ERR_EQUALVERIFY",!1;this.stack.pop()}break;case s.OP_1ADD:case s.OP_1SUB:case s.OP_NEGATE:case s.OP_ABS:case s.OP_NOT:case s.OP_0NOTEQUAL:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;switch(t=this.stack[this.stack.length-1],b=o.fromScriptNumBuffer(t,E),P){case s.OP_1ADD:b=b.add(o.One);break;case s.OP_1SUB:b=b.sub(o.One);break;case s.OP_NEGATE:b=b.neg();break;case s.OP_ABS:b.cmp(o.Zero)<0&&(b=b.neg());break;case s.OP_NOT:b=new o((0===b.cmp(o.Zero))+0);break;case s.OP_0NOTEQUAL:b=new o((0!==b.cmp(o.Zero))+0)}this.stack.pop(),this.stack.push(b.toScriptNumBuffer());break;case s.OP_ADD:case s.OP_SUB:case s.OP_BOOLAND:case s.OP_BOOLOR:case s.OP_NUMEQUAL:case s.OP_NUMEQUALVERIFY:case s.OP_NUMNOTEQUAL:case s.OP_LESSTHAN:case s.OP_GREATERTHAN:case s.OP_LESSTHANOREQUAL:case s.OP_GREATERTHANOREQUAL:case s.OP_MIN:case s.OP_MAX:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;switch(g=o.fromScriptNumBuffer(this.stack[this.stack.length-2],E),m=o.fromScriptNumBuffer(this.stack[this.stack.length-1],E),b=new o(0),P){case s.OP_ADD:b=g.add(m);break;case s.OP_SUB:b=g.sub(m);break;case s.OP_BOOLAND:b=new o((0!==g.cmp(o.Zero)&&0!==m.cmp(o.Zero))+0);break;case s.OP_BOOLOR:b=new o((0!==g.cmp(o.Zero)||0!==m.cmp(o.Zero))+0);break;case s.OP_NUMEQUAL:b=new o((0===g.cmp(m))+0);break;case s.OP_NUMEQUALVERIFY:b=new o((0===g.cmp(m))+0);break;case s.OP_NUMNOTEQUAL:b=new o((0!==g.cmp(m))+0);break;case s.OP_LESSTHAN:b=new o((g.cmp(m)<0)+0);break;case s.OP_GREATERTHAN:b=new o((g.cmp(m)>0)+0);break;case s.OP_LESSTHANOREQUAL:b=new o((g.cmp(m)<=0)+0);break;case s.OP_GREATERTHANOREQUAL:b=new o((g.cmp(m)>=0)+0);break;case s.OP_MIN:b=g.cmp(m)<0?g:m;break;case s.OP_MAX:b=g.cmp(m)>0?g:m}if(this.stack.pop(),this.stack.pop(),this.stack.push(b.toScriptNumBuffer()),P===s.OP_NUMEQUALVERIFY){if(!c.castToBool(this.stack[this.stack.length-1]))return this.errstr="SCRIPT_ERR_NUMEQUALVERIFY",!1;this.stack.pop()}break;case s.OP_WITHIN:if(this.stack.length<3)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;g=o.fromScriptNumBuffer(this.stack[this.stack.length-3],E),m=o.fromScriptNumBuffer(this.stack[this.stack.length-2],E);var T=o.fromScriptNumBuffer(this.stack[this.stack.length-1],E);I=m.cmp(g)<=0&&g.cmp(T)<0,this.stack.pop(),this.stack.pop(),this.stack.pop(),this.stack.push(I?c["true"]:c["false"]);break;case s.OP_RIPEMD160:case s.OP_SHA1:case s.OP_SHA256:case s.OP_HASH160:case s.OP_HASH256:if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;t=this.stack[this.stack.length-1];var C;P===s.OP_RIPEMD160?C=a.ripemd160(t):P===s.OP_SHA1?C=a.sha1(t):P===s.OP_SHA256?C=a.sha256(t):P===s.OP_HASH160?C=a.sha256ripemd160(t):P===s.OP_HASH256&&(C=a.sha256sha256(t)),this.stack.pop(),this.stack.push(C);break;case s.OP_CODESEPARATOR:this.pbegincodehash=this.pc;break;case s.OP_CHECKSIG:case s.OP_CHECKSIGVERIFY:if(this.stack.length<2)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;y=this.stack[this.stack.length-2],v=this.stack[this.stack.length-1],_=(new i).set({chunks:this.script.chunks.slice(this.pbegincodehash)});var N=(new i).add(y);if(_.findAndDelete(N),!this.checkSignatureEncoding(y)||!this.checkPubkeyEncoding(v))return!1;try{w=f.fromTxFormat(y),S=u.fromBuffer(v,!1),k=this.tx.verifySignature(w,S,this.nin,_)}catch(j){k=!1}if(this.stack.pop(),this.stack.pop(),this.stack.push(k?c["true"]:c["false"]),P===s.OP_CHECKSIGVERIFY){if(!k)return this.errstr="SCRIPT_ERR_CHECKSIGVERIFY",!1;this.stack.pop()}break;case s.OP_CHECKMULTISIG:case s.OP_CHECKMULTISIGVERIFY:var U=1;if(this.stack.lengthL||L>20)return this.errstr="SCRIPT_ERR_PUBKEY_COUNT",!1;if(this.nOpCount+=L,this.nOpCount>201)return this.errstr="SCRIPT_ERR_OP_COUNT",!1;var D=++U;if(U+=L,this.stack.lengthz||z>L)return this.errstr="SCRIPT_ERR_SIG_COUNT",!1;var F=++U;if(U+=z,this.stack.lengthK;K++)y=this.stack[this.stack.length-F-K],_.findAndDelete((new i).add(y));for(k=!0;k&&z>0;){if(y=this.stack[this.stack.length-F],v=this.stack[this.stack.length-D],!this.checkSignatureEncoding(y)||!this.checkPubkeyEncoding(v))return!1;var H;try{w=f.fromTxFormat(y),S=u.fromBuffer(v,!1),H=this.tx.verifySignature(w,S,this.nin,_)}catch(j){H=!1}H&&(F++,z--),D++,L--,z>L&&(k=!1)}for(;U-- >1;)this.stack.pop();if(this.stack.length<1)return this.errstr="SCRIPT_ERR_INVALID_STACK_OPERATION",!1;if(this.flags&c.SCRIPT_VERIFY_NULLDUMMY&&this.stack[this.stack.length-1].length)return this.errstr="SCRIPT_ERR_SIG_NULLDUMMY",!1;if(this.stack.pop(),this.stack.push(k?c["true"]:c["false"]),P===s.OP_CHECKMULTISIGVERIFY){if(!k)return this.errstr="SCRIPT_ERR_CHECKMULTISIGVERIFY",!1;this.stack.pop()}break;default:return this.errstr="SCRIPT_ERR_BAD_OPCODE",!1}return!0}}).call(this,t("buffer").Buffer)},{"../crypto/bn":6,"../crypto/hash":8,"../crypto/signature":11,"../opcode":23,"../publickey":25,"../transaction":29,"./script":28,buffer:48,lodash:297}],28:[function(t,e,r){(function(r){"use strict";var n=t("../address"),i=t("../encoding/bufferreader"),s=t("../encoding/bufferwriter"),o=t("../crypto/hash"),a=t("../opcode"),f=t("../publickey"),u=t("../crypto/signature"),c=t("../networks"),h=t("../util/preconditions"),d=t("lodash"),p=t("../errors"),l=t("buffer"),b=t("../util/buffer"),g=t("../util/js"),m=function y(t){return this instanceof y?(this.chunks=[],b.isBuffer(t)?y.fromBuffer(t):t instanceof n?y.fromAddress(t):t instanceof y?y.fromBuffer(t.toBuffer()):"string"==typeof t?y.fromString(t):void("undefined"!=typeof t&&this.set(t))):new y(t)};m.prototype.set=function(t){return this.chunks=t.chunks||this.chunks,this},m.fromBuffer=function(t){var e=new m;e.chunks=[];for(var r=new i(t);!r.finished();)try{var n,s,o=r.readUInt8();o>0&&o0&&f0&&(i=n?i+" "+t.buf.toString("hex"):i+" "+t.len+" 0x"+t.buf.toString("hex"));else if("undefined"!=typeof a.reverseMap[r])i=i+" "+a(r).toString();else{ var s=r.toString(16);s.length%2!==0&&(s="0"+s),i=n?i+" "+s:i+" 0x"+s}return i},m.prototype.toASM=function(){for(var t="",e=0;e"},m.prototype.isPublicKeyHashOut=function(){return!(5!==this.chunks.length||this.chunks[0].opcodenum!==a.OP_DUP||this.chunks[1].opcodenum!==a.OP_HASH160||!this.chunks[2].buf||20!==this.chunks[2].buf.length||this.chunks[3].opcodenum!==a.OP_EQUALVERIFY||this.chunks[4].opcodenum!==a.OP_CHECKSIG)},m.prototype.isPublicKeyHashIn=function(){if(2===this.chunks.length){var t=this.chunks[0].buf,e=this.chunks[1].buf;if(t&&t.length&&48===t[0]&&e&&e.length){var r=e[0];if((4===r||6===r||7===r)&&65===e.length)return!0;if((3===r||2===r)&&33===e.length)return!0}}return!1},m.prototype.getPublicKey=function(){return h.checkState(this.isPublicKeyOut(),"Can't retreive PublicKey from a non-PK output"),this.chunks[0].buf},m.prototype.getPublicKeyHash=function(){return h.checkState(this.isPublicKeyHashOut(),"Can't retrieve PublicKeyHash from a non-PKH output"),this.chunks[2].buf},m.prototype.isPublicKeyOut=function(){if(2===this.chunks.length&&this.chunks[0].buf&&this.chunks[0].buf.length&&this.chunks[1].opcodenum===a.OP_CHECKSIG){var t=this.chunks[0].buf,e=t[0],r=!1;if(4!==e&&6!==e&&7!==e||65!==t.length?3!==e&&2!==e||33!==t.length||(r=!0):r=!0,r)return f.isValid(t)}return!1},m.prototype.isPublicKeyIn=function(){if(1===this.chunks.length){var t=this.chunks[0].buf;if(t&&t.length&&48===t[0])return!0}return!1},m.prototype.isScriptHashOut=function(){var t=this.toBuffer();return 23===t.length&&t[0]===a.OP_HASH160&&20===t[1]&&t[t.length-1]===a.OP_EQUAL},m.prototype.isScriptHashIn=function(){if(this.chunks.length<=1)return!1;var t=this.chunks[this.chunks.length-1],e=t.buf;if(!e)return!1;var r;try{r=m.fromBuffer(e)}catch(n){if(n instanceof p.Script.InvalidBuffer)return!1;throw n}var i=r.classify();return i!==m.types.UNKNOWN},m.prototype.isMultisigOut=function(){return this.chunks.length>3&&a.isSmallIntOp(this.chunks[0].opcodenum)&&this.chunks.slice(1,this.chunks.length-2).every(function(t){return t.buf&&b.isBuffer(t.buf)})&&a.isSmallIntOp(this.chunks[this.chunks.length-2].opcodenum)&&this.chunks[this.chunks.length-1].opcodenum===a.OP_CHECKMULTISIG},m.prototype.isMultisigIn=function(){return this.chunks.length>=2&&0===this.chunks[0].opcodenum&&this.chunks.slice(1,this.chunks.length).every(function(t){return t.buf&&b.isBuffer(t.buf)&&u.isTxDER(t.buf)})},m.prototype.isDataOut=function(){return this.chunks.length>=1&&this.chunks[0].opcodenum===a.OP_RETURN&&(1===this.chunks.length||2===this.chunks.length&&this.chunks[1].buf&&this.chunks[1].buf.length<=m.OP_RETURN_STANDARD_SIZE&&this.chunks[1].length===this.chunks.len)},m.prototype.getData=function(){if(this.isDataOut()||this.isScriptHashOut())return new r(d.isUndefined(this.chunks[1])?0:this.chunks[1].buf);if(this.isPublicKeyHashOut())return new r(this.chunks[2].buf);throw new Error("Unrecognized script type to get data from")},m.prototype.isPushOnly=function(){return d.every(this.chunks,function(t){return t.opcodenum<=a.OP_16})},m.types={},m.types.UNKNOWN="Unknown",m.types.PUBKEY_OUT="Pay to public key",m.types.PUBKEY_IN="Spend from public key",m.types.PUBKEYHASH_OUT="Pay to public key hash",m.types.PUBKEYHASH_IN="Spend from public key hash",m.types.SCRIPTHASH_OUT="Pay to script hash",m.types.SCRIPTHASH_IN="Spend from script hash",m.types.MULTISIG_OUT="Pay to multisig",m.types.MULTISIG_IN="Spend from multisig",m.types.DATA_OUT="Data push",m.OP_RETURN_STANDARD_SIZE=80,m.identifiers={},m.identifiers.PUBKEY_OUT=m.prototype.isPublicKeyOut,m.identifiers.PUBKEY_IN=m.prototype.isPublicKeyIn,m.identifiers.PUBKEYHASH_OUT=m.prototype.isPublicKeyHashOut,m.identifiers.PUBKEYHASH_IN=m.prototype.isPublicKeyHashIn,m.identifiers.MULTISIG_OUT=m.prototype.isMultisigOut,m.identifiers.MULTISIG_IN=m.prototype.isMultisigIn,m.identifiers.SCRIPTHASH_OUT=m.prototype.isScriptHashOut,m.identifiers.SCRIPTHASH_IN=m.prototype.isScriptHashIn,m.identifiers.DATA_OUT=m.prototype.isDataOut,m.prototype.classify=function(){for(var t in m.identifiers)if(m.identifiers[t].bind(this)())return m.types[t];return m.types.UNKNOWN},m.prototype.isStandard=function(){return this.classify()!==m.types.UNKNOWN},m.prototype.prepend=function(t){return this._addByType(t,!0),this},m.prototype.equals=function(t){if(h.checkState(t instanceof m,"Must provide another script"),this.chunks.length!==t.chunks.length)return!1;var e;for(e=0;e=0&&n=1&&r[0]<=16?n===a.OP_1+(r[0]-1):1===r.length&&129===r[0]?n===a.OP_1NEGATE:r.length<=75?n===r.length:r.length<=255?n===a.OP_PUSHDATA1:r.length<=65535?n===a.OP_PUSHDATA2:!0:!0},m.prototype._decodeOP_N=function(t){if(t===a.OP_0)return 0;if(t>=a.OP_1&&t<=a.OP_16)return t-(a.OP_1-1);throw new Error("Invalid opcode: "+JSON.stringify(t))},m.prototype.getSignatureOperationsCount=function(t){t=d.isUndefined(t)?!0:t;var e=this,r=0,n=a.OP_INVALIDOPCODE;return d.each(e.chunks,function(i){var s=i.opcodenum;s==a.OP_CHECKSIG||s==a.OP_CHECKSIGVERIFY?r++:(s==a.OP_CHECKMULTISIG||s==a.OP_CHECKMULTISIGVERIFY)&&(r+=t&&n>=a.OP_1&&n<=a.OP_16?e._decodeOP_N(n):20),n=s}),r},e.exports=m}).call(this,t("buffer").Buffer)},{"../address":1,"../crypto/hash":8,"../crypto/signature":11,"../encoding/bufferreader":14,"../encoding/bufferwriter":15,"../errors":17,"../networks":22,"../opcode":23,"../publickey":25,"../util/buffer":43,"../util/js":44,"../util/preconditions":45,buffer:48,lodash:297}],29:[function(t,e,r){e.exports=t("./transaction"),e.exports.Input=t("./input"),e.exports.Output=t("./output"),e.exports.UnspentOutput=t("./unspentoutput"),e.exports.Signature=t("./signature"),e.exports.Sighash=t("./sighash")},{"./input":30,"./output":36,"./sighash":37,"./signature":38,"./transaction":39,"./unspentoutput":40}],30:[function(t,e,r){e.exports=t("./input"),e.exports.PublicKey=t("./publickey"),e.exports.PublicKeyHash=t("./publickeyhash"),e.exports.MultiSig=t("./multisig.js"),e.exports.MultiSigScriptHash=t("./multisigscripthash.js")},{"./input":31,"./multisig.js":32,"./multisigscripthash.js":33,"./publickey":34,"./publickeyhash":35}],31:[function(t,e,r){"use strict";function n(t){return this instanceof n?t?this._fromObject(t):void 0:new n(t)}var i=t("lodash"),s=t("../../util/preconditions"),o=t("../../errors"),a=t("../../encoding/bufferwriter"),f=t("buffer"),u=t("../../util/buffer"),c=t("../../util/js"),h=t("../../script"),d=t("../sighash"),p=t("../output"),l=4294967295,b=0;n.DEFAULT_SEQNUMBER=l,n.DEFAULT_LOCKTIME_SEQNUMBER=b,Object.defineProperty(n.prototype,"script",{configurable:!1,enumerable:!0,get:function(){return this.isNull()?null:(this._script||(this._script=new h(this._scriptBuffer),this._script._isInput=!0),this._script)}}),n.fromObject=function(t){s.checkArgument(i.isObject(t));var e=new n;return e._fromObject(t)},n.prototype._fromObject=function(t){var e;if(e=i.isString(t.prevTxId)&&c.isHexa(t.prevTxId)?new f.Buffer(t.prevTxId,"hex"):t.prevTxId,this.output=t.output?t.output instanceof p?t.output:new p(t.output):void 0,this.prevTxId=e||t.txidbuf,this.outputIndex=i.isUndefined(t.outputIndex)?t.txoutnum:t.outputIndex,this.sequenceNumber=i.isUndefined(t.sequenceNumber)?i.isUndefined(t.seqnum)?l:t.seqnum:t.sequenceNumber,i.isUndefined(t.script)&&i.isUndefined(t.scriptBuffer))throw new o.Transaction.Input.MissingScript;return this.setScript(t.scriptBuffer||t.script),this},n.prototype.toObject=n.prototype.toJSON=function(){var t={prevTxId:this.prevTxId.toString("hex"),outputIndex:this.outputIndex,sequenceNumber:this.sequenceNumber,script:this._scriptBuffer.toString("hex")};return this.script&&(t.scriptString=this.script.toString()),this.output&&(t.output=this.output.toObject()),t},n.fromBufferReader=function(t){var e=new n;return e.prevTxId=t.readReverse(32),e.outputIndex=t.readUInt32LE(),e._scriptBuffer=t.readVarLengthBuffer(),e.sequenceNumber=t.readUInt32LE(),e},n.prototype.toBufferWriter=function(t){t||(t=new a),t.writeReverse(this.prevTxId),t.writeUInt32LE(this.outputIndex);var e=this._scriptBuffer;return t.writeVarintNum(e.length),t.write(e),t.writeUInt32LE(this.sequenceNumber),t},n.prototype.setScript=function(t){if(this._script=null,t instanceof h)this._script=t,this._script._isInput=!0,this._scriptBuffer=t.toBuffer();else if(c.isHexa(t))this._scriptBuffer=new f.Buffer(t,"hex");else if(i.isString(t))this._script=new h(t),this._script._isInput=!0,this._scriptBuffer=this._script.toBuffer();else{if(!u.isBuffer(t))throw new TypeError("Invalid argument type: script");this._scriptBuffer=new f.Buffer(t)}return this},n.prototype.getSignatures=function(){throw new o.AbstractMethodInvoked("Trying to sign unsupported output type (only P2PKH and P2SH multisig inputs are supported) for input: "+JSON.stringify(this))},n.prototype.isFullySigned=function(){throw new o.AbstractMethodInvoked("Input#isFullySigned")},n.prototype.isFinal=function(){return 4294967295!==this.sequenceNumber},n.prototype.addSignature=function(){throw new o.AbstractMethodInvoked("Input#addSignature")},n.prototype.clearSignatures=function(){throw new o.AbstractMethodInvoked("Input#clearSignatures")},n.prototype.isValidSignature=function(t,e){return e.signature.nhashtype=e.sigtype,d.verify(t,e.signature,e.publicKey,e.inputIndex,this.output.script)},n.prototype.isNull=function(){return"0000000000000000000000000000000000000000000000000000000000000000"===this.prevTxId.toString("hex")&&4294967295===this.outputIndex},n.prototype._estimateSize=function(){return this.toBufferWriter().toBuffer().length},e.exports=n},{"../../encoding/bufferwriter":15,"../../errors":17,"../../script":26,"../../util/buffer":43,"../../util/js":44,"../../util/preconditions":45,"../output":36,"../sighash":37,buffer:48,lodash:297}],32:[function(t,e,r){"use strict";function n(t,e,r,n){o.apply(this,arguments);var s=this;e=e||t.publicKeys,r=r||t.threshold,n=n||t.signatures,this.publicKeys=i.sortBy(e,function(t){return t.toString("hex")}),f.checkState(u.buildMultisigOut(this.publicKeys,r).equals(this.output.script),"Provided public keys don't match to the provided output script"),this.publicKeyIndex={},i.each(this.publicKeys,function(t,e){s.publicKeyIndex[t.toString()]=e}),this.threshold=r,this.signatures=n?this._deserializeSignatures(n):new Array(this.publicKeys.length)}var i=t("lodash"),s=t("inherits"),o=(t("../transaction"),t("./input")),a=t("../output"),f=t("../../util/preconditions"),u=t("../../script"),c=t("../../crypto/signature"),h=t("../sighash"),d=(t("../../publickey"),t("../../util/buffer")),p=t("../signature");s(n,o),n.prototype.toObject=function(){var t=o.prototype.toObject.apply(this,arguments);return t.threshold=this.threshold,t.publicKeys=i.map(this.publicKeys,function(t){return t.toString()}),t.signatures=this._serializeSignatures(),t},n.prototype._deserializeSignatures=function(t){return i.map(t,function(t){return t?new p(t):void 0})},n.prototype._serializeSignatures=function(){return i.map(this.signatures,function(t){return t?t.toObject():void 0})},n.prototype.getSignatures=function(t,e,r,n){f.checkState(this.output instanceof a),n=n||c.SIGHASH_ALL;var s=this,o=[];return i.each(this.publicKeys,function(i){i.toString()===e.publicKey.toString()&&o.push(new p({publicKey:e.publicKey,prevTxId:s.prevTxId,outputIndex:s.outputIndex,inputIndex:r,signature:h.sign(t,e,n,r,s.output.script),sigtype:n}))}),o},n.prototype.addSignature=function(t,e){return f.checkState(!this.isFullySigned(),"All needed signatures have already been added"),f.checkArgument(!i.isUndefined(this.publicKeyIndex[e.publicKey.toString()]),"Signature has no matching public key"),f.checkState(this.isValidSignature(t,e)),this.signatures[this.publicKeyIndex[e.publicKey.toString()]]=e,this._updateScript(),this},n.prototype._updateScript=function(){return this.setScript(u.buildMultisigIn(this.publicKeys,this.threshold,this._createSignatures())),this},n.prototype._createSignatures=function(){return i.map(i.filter(this.signatures,function(t){return!i.isUndefined(t)}),function(t){return d.concat([t.signature.toDER(),d.integerAsSingleByteBuffer(t.sigtype)])})},n.prototype.clearSignatures=function(){this.signatures=new Array(this.publicKeys.length),this._updateScript()},n.prototype.isFullySigned=function(){return this.countSignatures()===this.threshold},n.prototype.countMissingSignatures=function(){return this.threshold-this.countSignatures()},n.prototype.countSignatures=function(){return i.reduce(this.signatures,function(t,e){return t+!!e},0)},n.prototype.publicKeysWithoutSignature=function(){var t=this;return i.filter(this.publicKeys,function(e){return!t.signatures[t.publicKeyIndex[e.toString()]]})},n.prototype.isValidSignature=function(t,e){return e.signature.nhashtype=e.sigtype,h.verify(t,e.signature,e.publicKey,e.inputIndex,this.output.script)},n.normalizeSignatures=function(t,e,r,n,i){return i.map(function(i){var s=null;return n=n.filter(function(n){if(s)return!0;var o=new p({signature:c.fromTxFormat(n),publicKey:i,prevTxId:e.prevTxId,outputIndex:e.outputIndex,inputIndex:r,sigtype:c.SIGHASH_ALL});o.signature.nhashtype=o.sigtype;var a=h.verify(t,o.signature,o.publicKey,o.inputIndex,e.output.script);return a?(s=o,!1):!0}),s?s:null})},n.OPCODES_SIZE=1,n.SIGNATURE_SIZE=73,n.prototype._estimateSize=function(){return n.OPCODES_SIZE+this.threshold*n.SIGNATURE_SIZE},e.exports=n},{"../../crypto/signature":11,"../../publickey":25,"../../script":26,"../../util/buffer":43,"../../util/preconditions":45,"../output":36,"../sighash":37,"../signature":38,"../transaction":39,"./input":31,inherits:296,lodash:297}],33:[function(t,e,r){"use strict";function n(t,e,r,n){o.apply(this,arguments);var s=this;e=e||t.publicKeys,r=r||t.threshold,n=n||t.signatures,this.publicKeys=i.sortBy(e,function(t){return t.toString("hex")}),this.redeemScript=u.buildMultisigOut(this.publicKeys,r),f.checkState(u.buildScriptHashOut(this.redeemScript).equals(this.output.script),"Provided public keys don't hash to the provided output"),this.publicKeyIndex={},i.each(this.publicKeys,function(t,e){s.publicKeyIndex[t.toString()]=e}),this.threshold=r,this.signatures=n?this._deserializeSignatures(n):new Array(this.publicKeys.length)}var i=t("lodash"),s=t("inherits"),o=t("./input"),a=t("../output"),f=t("../../util/preconditions"),u=t("../../script"),c=t("../../crypto/signature"),h=t("../sighash"),d=(t("../../publickey"),t("../../util/buffer")),p=t("../signature");s(n,o),n.prototype.toObject=function(){var t=o.prototype.toObject.apply(this,arguments);return t.threshold=this.threshold,t.publicKeys=i.map(this.publicKeys,function(t){return t.toString()}),t.signatures=this._serializeSignatures(),t},n.prototype._deserializeSignatures=function(t){return i.map(t,function(t){return t?new p(t):void 0})},n.prototype._serializeSignatures=function(){return i.map(this.signatures,function(t){return t?t.toObject():void 0})},n.prototype.getSignatures=function(t,e,r,n){f.checkState(this.output instanceof a),n=n||c.SIGHASH_ALL;var s=this,o=[];return i.each(this.publicKeys,function(i){i.toString()===e.publicKey.toString()&&o.push(new p({publicKey:e.publicKey,prevTxId:s.prevTxId,outputIndex:s.outputIndex,inputIndex:r,signature:h.sign(t,e,n,r,s.redeemScript),sigtype:n}))}),o},n.prototype.addSignature=function(t,e){return f.checkState(!this.isFullySigned(),"All needed signatures have already been added"),f.checkArgument(!i.isUndefined(this.publicKeyIndex[e.publicKey.toString()]),"Signature has no matching public key"),f.checkState(this.isValidSignature(t,e)),this.signatures[this.publicKeyIndex[e.publicKey.toString()]]=e,this._updateScript(),this},n.prototype._updateScript=function(){return this.setScript(u.buildP2SHMultisigIn(this.publicKeys,this.threshold,this._createSignatures(),{cachedMultisig:this.redeemScript})),this},n.prototype._createSignatures=function(){return i.map(i.filter(this.signatures,function(t){return!i.isUndefined(t)}),function(t){return d.concat([t.signature.toDER(),d.integerAsSingleByteBuffer(t.sigtype)])})},n.prototype.clearSignatures=function(){this.signatures=new Array(this.publicKeys.length),this._updateScript()},n.prototype.isFullySigned=function(){return this.countSignatures()===this.threshold},n.prototype.countMissingSignatures=function(){return this.threshold-this.countSignatures()},n.prototype.countSignatures=function(){return i.reduce(this.signatures,function(t,e){return t+!!e},0)},n.prototype.publicKeysWithoutSignature=function(){var t=this;return i.filter(this.publicKeys,function(e){return!t.signatures[t.publicKeyIndex[e.toString()]]})},n.prototype.isValidSignature=function(t,e){return e.signature.nhashtype=e.sigtype,h.verify(t,e.signature,e.publicKey,e.inputIndex,this.redeemScript)},n.OPCODES_SIZE=7,n.SIGNATURE_SIZE=74,n.PUBKEY_SIZE=34,n.prototype._estimateSize=function(){return n.OPCODES_SIZE+this.threshold*n.SIGNATURE_SIZE+this.publicKeys.length*n.PUBKEY_SIZE},e.exports=n},{"../../crypto/signature":11,"../../publickey":25,"../../script":26,"../../util/buffer":43,"../../util/preconditions":45,"../output":36,"../sighash":37,"../signature":38,"./input":31,inherits:296,lodash:297}],34:[function(t,e,r){"use strict";function n(){o.apply(this,arguments)}var i=t("inherits"),s=t("../../util/preconditions"),o=(t("../../util/buffer"),t("./input")),a=t("../output"),f=t("../sighash"),u=t("../../script"),c=t("../../crypto/signature"),h=t("../signature");i(n,o),n.prototype.getSignatures=function(t,e,r,n){s.checkState(this.output instanceof a),n=n||c.SIGHASH_ALL;var i=e.toPublicKey();return i.toString()===this.output.script.getPublicKey().toString("hex")?[new h({publicKey:i,prevTxId:this.prevTxId,outputIndex:this.outputIndex,inputIndex:r,signature:f.sign(t,e,n,r,this.output.script),sigtype:n})]:[]},n.prototype.addSignature=function(t,e){return s.checkState(this.isValidSignature(t,e),"Signature is invalid"),this.setScript(u.buildPublicKeyIn(e.signature.toDER(),e.sigtype)),this},n.prototype.clearSignatures=function(){return this.setScript(u.empty()),this},n.prototype.isFullySigned=function(){return this.script.isPublicKeyIn()},n.SCRIPT_MAX_SIZE=73,n.prototype._estimateSize=function(){return n.SCRIPT_MAX_SIZE},e.exports=n},{"../../crypto/signature":11,"../../script":26,"../../util/buffer":43,"../../util/preconditions":45,"../output":36,"../sighash":37,"../signature":38,"./input":31,inherits:296}],35:[function(t,e,r){"use strict";function n(){f.apply(this,arguments)}var i=t("inherits"),s=t("../../util/preconditions"),o=t("../../util/buffer"),a=t("../../crypto/hash"),f=t("./input"),u=t("../output"),c=t("../sighash"),h=t("../../script"),d=t("../../crypto/signature"),p=t("../signature");i(n,f),n.prototype.getSignatures=function(t,e,r,n,i){return s.checkState(this.output instanceof u),i=i||a.sha256ripemd160(e.publicKey.toBuffer()),n=n||d.SIGHASH_ALL,o.equals(i,this.output.script.getPublicKeyHash())?[new p({publicKey:e.publicKey,prevTxId:this.prevTxId,outputIndex:this.outputIndex,inputIndex:r,signature:c.sign(t,e,n,r,this.output.script),sigtype:n})]:[]},n.prototype.addSignature=function(t,e){return s.checkState(this.isValidSignature(t,e),"Signature is invalid"),this.setScript(h.buildPublicKeyHashIn(e.publicKey,e.signature.toDER(),e.sigtype)),this},n.prototype.clearSignatures=function(){return this.setScript(h.empty()),this},n.prototype.isFullySigned=function(){return this.script.isPublicKeyHashIn()},n.SCRIPT_MAX_SIZE=107,n.prototype._estimateSize=function(){return n.SCRIPT_MAX_SIZE},e.exports=n},{"../../crypto/hash":8,"../../crypto/signature":11,"../../script":26,"../../util/buffer":43,"../../util/preconditions":45,"../output":36,"../sighash":37,"../signature":38,"./input":31,inherits:296}],36:[function(t,e,r){"use strict";function n(t){if(!(this instanceof n))return new n(t);if(!i.isObject(t))throw new TypeError("Unrecognized argument for Output");if(this.satoshis=t.satoshis,a.isBuffer(t.script))this._scriptBuffer=t.script;else{var e;e=i.isString(t.script)&&f.isHexa(t.script)?new o.Buffer(t.script,"hex"):t.script,this.setScript(e)}}var i=t("lodash"),s=t("../crypto/bn"),o=t("buffer"),a=t("../util/buffer"),f=t("../util/js"),u=t("../encoding/bufferwriter"),c=t("../script"),h=t("../util/preconditions"),d=t("../errors"),p=9007199254740991;Object.defineProperty(n.prototype,"script",{configurable:!1,enumerable:!0,get:function(){return this._script?this._script:(this.setScriptFromBuffer(this._scriptBuffer),this._script)}}),Object.defineProperty(n.prototype,"satoshis",{configurable:!1,enumerable:!0,get:function(){return this._satoshis},set:function(t){t instanceof s?(this._satoshisBN=t,this._satoshis=t.toNumber()):i.isString(t)?(this._satoshis=parseInt(t),this._satoshisBN=s.fromNumber(this._satoshis)):(h.checkArgument(f.isNaturalNumber(t),"Output satoshis is not a natural number"),this._satoshisBN=s.fromNumber(t),this._satoshis=t),h.checkState(f.isNaturalNumber(this._satoshis),"Output satoshis is not a natural number")}}),n.prototype.invalidSatoshis=function(){return this._satoshis>p?"transaction txout satoshis greater than max safe integer":this._satoshis!==this._satoshisBN.toNumber()?"transaction txout satoshis has corrupted value":this._satoshis<0?"transaction txout negative":!1},n.prototype.toObject=n.prototype.toJSON=function(){var t={satoshis:this.satoshis};return t.script=this._scriptBuffer.toString("hex"),t},n.fromObject=function(t){return new n(t)},n.prototype.setScriptFromBuffer=function(t){this._scriptBuffer=t;try{this._script=c.fromBuffer(this._scriptBuffer),this._script._isOutput=!0}catch(e){if(!(e instanceof d.Script.InvalidBuffer))throw e;this._script=null}},n.prototype.setScript=function(t){if(t instanceof c)this._scriptBuffer=t.toBuffer(),this._script=t,this._script._isOutput=!0;else if(i.isString(t))this._script=c.fromString(t),this._scriptBuffer=this._script.toBuffer(),this._script._isOutput=!0;else{if(!a.isBuffer(t))throw new TypeError("Invalid argument type: script");this.setScriptFromBuffer(t)}return this},n.prototype.inspect=function(){var t;return t=this.script?this.script.inspect():this._scriptBuffer.toString("hex"),""},n.fromBufferReader=function(t){var e={};e.satoshis=t.readUInt64LEBN();var r=t.readVarintNum();return 0!==r?e.script=t.read(r):e.script=new o.Buffer([]),new n(e)},n.prototype.toBufferWriter=function(t){t||(t=new u),t.writeUInt64LEBN(this._satoshisBN);var e=this._scriptBuffer;return t.writeVarintNum(e.length),t.write(e),t},e.exports=n},{"../crypto/bn":6,"../encoding/bufferwriter":15,"../errors":17,"../script":26,"../util/buffer":43,"../util/js":44,"../util/preconditions":45,buffer:48,lodash:297}],37:[function(t,e,r){(function(r){"use strict";function n(t,e,r,n,i){var s=y(t,r,n,i),o=p.sign(s,e,"little").set({nhashtype:r});return o}function i(t,e,r,n,i){l.checkArgument(!b.isUndefined(t)),l.checkArgument(!b.isUndefined(e)&&!b.isUndefined(e.nhashtype));var s=y(t,e.nhashtype,n,i);return p.verify(s,e,r,"little")}var s=t("buffer"),o=t("../crypto/signature"),a=t("../script"),f=t("./output"),u=t("../encoding/bufferreader"),c=t("../encoding/bufferwriter"),h=t("../crypto/bn"),d=t("../crypto/hash"),p=t("../crypto/ecdsa"),l=t("../util/preconditions"),b=t("lodash"),g="0000000000000000000000000000000000000000000000000000000000000001",m="ffffffffffffffff",y=function(e,n,i,p){var l,b=t("./transaction"),y=t("./input"),v=b.shallowCopy(e);for(p=new a(p),p.removeCodeseparators(),l=0;l=v.outputs.length)return new r(g,"hex");for(v.outputs.length=i+1,l=0;i>l;l++)v.outputs[l]=new f({satoshis:h.fromBuffer(new s.Buffer(m,"hex")),script:a.empty()})}n&o.SIGHASH_ANYONECANPAY&&(v.inputs=[v.inputs[i]]);var _=(new c).write(v.toBuffer()).writeInt32LE(n).toBuffer(),w=d.sha256sha256(_);return w=new u(w).readReverse()};e.exports={sighash:y,sign:n,verify:i}}).call(this,t("buffer").Buffer)},{"../crypto/bn":6,"../crypto/ecdsa":7,"../crypto/hash":8,"../crypto/signature":11,"../encoding/bufferreader":14,"../encoding/bufferwriter":15,"../script":26,"../util/preconditions":45,"./input":30,"./output":36,"./transaction":39,buffer:48,lodash:297}],38:[function(t,e,r){(function(r){"use strict";function n(t){if(!(this instanceof n))return new n(t);if(t instanceof n)return t;if(i.isObject(t))return this._fromObject(t);throw new c.InvalidArgument("TransactionSignatures must be instantiated from an object")}var i=t("lodash"),s=t("../util/preconditions"),o=t("inherits"),a=t("../util/buffer"),f=t("../util/js"),u=t("../publickey"),c=t("../errors"),h=t("../crypto/signature");o(n,h),n.prototype._fromObject=function(t){return this._checkObjectArgs(t),this.publicKey=new u(t.publicKey),this.prevTxId=a.isBuffer(t.prevTxId)?t.prevTxId:new r(t.prevTxId,"hex"),this.outputIndex=t.outputIndex,this.inputIndex=t.inputIndex,this.signature=t.signature instanceof h?t.signature:a.isBuffer(t.signature)?h.fromBuffer(t.signature):h.fromString(t.signature),this.sigtype=t.sigtype,this},n.prototype._checkObjectArgs=function(t){s.checkArgument(u(t.publicKey),"publicKey"),s.checkArgument(!i.isUndefined(t.inputIndex),"inputIndex"),s.checkArgument(!i.isUndefined(t.outputIndex),"outputIndex"),s.checkState(i.isNumber(t.inputIndex),"inputIndex must be a number"),s.checkState(i.isNumber(t.outputIndex),"outputIndex must be a number"),s.checkArgument(t.signature,"signature"),s.checkArgument(t.prevTxId,"prevTxId"),s.checkState(t.signature instanceof h||a.isBuffer(t.signature)||f.isHexa(t.signature),"signature must be a buffer or hexa value"),s.checkState(a.isBuffer(t.prevTxId)||f.isHexa(t.prevTxId),"prevTxId must be a buffer or hexa value"),s.checkArgument(t.sigtype,"sigtype"),s.checkState(i.isNumber(t.sigtype),"sigtype must be a number")},n.prototype.toObject=n.prototype.toJSON=function(){return{publicKey:this.publicKey.toString(),prevTxId:this.prevTxId.toString("hex"),outputIndex:this.outputIndex,inputIndex:this.inputIndex,signature:this.signature.toString(),sigtype:this.sigtype}},n.fromObject=function(t){return s.checkArgument(t),new n(t)},e.exports=n}).call(this,t("buffer").Buffer)},{"../crypto/signature":11,"../errors":17, "../publickey":25,"../util/buffer":43,"../util/js":44,"../util/preconditions":45,buffer:48,inherits:296,lodash:297}],39:[function(t,e,r){(function(r){"use strict";function n(t){if(!(this instanceof n))return new n(t);if(this.inputs=[],this.outputs=[],this._inputAmount=void 0,this._outputAmount=void 0,t){if(t instanceof n)return n.shallowCopy(t);if(c.isHexa(t))this.fromString(t);else if(u.isBuffer(t))this.fromBuffer(t);else{if(!i.isObject(t))throw new f.InvalidArgument("Must provide an object or string to deserialize a transaction");this.fromObject(t)}}else this._newTransaction()}var i=t("lodash"),s=t("../util/preconditions"),o=t("buffer"),a=r.compare||t("buffer-compare"),f=t("../errors"),u=t("../util/buffer"),c=t("../util/js"),h=t("../encoding/bufferreader"),d=t("../encoding/bufferwriter"),p=t("../crypto/hash"),l=t("../crypto/signature"),b=t("./sighash"),g=t("../address"),m=t("./unspentoutput"),y=t("./input"),v=y.PublicKeyHash,_=y.PublicKey,w=y.MultiSigScriptHash,S=y.MultiSig,I=t("./output"),k=t("../script"),E=t("../privatekey"),A=t("../crypto/bn"),x=1,P=0,O=1e6;n.DUST_AMOUNT=546,n.FEE_SECURITY_MARGIN=15,n.MAX_MONEY=21e14,n.NLOCKTIME_BLOCKHEIGHT_LIMIT=5e8,n.NLOCKTIME_MAX_VALUE=4294967295,n.FEE_PER_KB=1e4,n.CHANGE_OUTPUT_MAX_SIZE=62,n.MAXIMUM_EXTRA_SIZE=26,n.shallowCopy=function(t){var e=new n(t.toBuffer());return e};var B={configurable:!1,enumerable:!0,get:function(){return new h(this._getHash()).readReverse().toString("hex")}};Object.defineProperty(n.prototype,"hash",B),Object.defineProperty(n.prototype,"id",B);var M={configurable:!1,enumerable:!0,get:function(){return this._getInputAmount()}};Object.defineProperty(n.prototype,"inputAmount",M),M.get=function(){return this._getOutputAmount()},Object.defineProperty(n.prototype,"outputAmount",M),n.prototype._getHash=function(){return p.sha256sha256(this.toBuffer())},n.prototype.serialize=function(t){return!0===t||t&&t.disableAll?this.uncheckedSerialize():this.checkedSerialize(t)},n.prototype.uncheckedSerialize=n.prototype.toString=function(){return this.toBuffer().toString("hex")},n.prototype.checkedSerialize=function(t){var e=this.getSerializationError(t);if(e)throw e.message+=" Use Transaction#uncheckedSerialize if you want to skip security checks. See http://bitcore.io/guide/transaction.html#Serialization for more info.",e;return this.uncheckedSerialize()},n.prototype.invalidSatoshis=function(){for(var t=!1,e=0;er?t.disableMoreOutputThanInput||(e=new f.Transaction.InvalidOutputAmountSum):e=this._hasFeeError(t,r),e||this._hasDustOutputs(t)||this._isMissingSignatures(t)},n.prototype._hasFeeError=function(t,e){if(!i.isUndefined(this._fee)&&this._fee!==e)return new f.Transaction.FeeError.Different("Unspent value is "+e+" but specified fee is "+this._fee);if(!t.disableLargeFees){var r=Math.floor(n.FEE_SECURITY_MARGIN*this._estimateFee());if(e>r)return this._missingChange()?new f.Transaction.ChangeAddressMissing("Fee is too large and no change address was provided"):new f.Transaction.FeeError.TooLarge("expected less than "+r+" but got "+e)}if(!t.disableSmallFees){var s=Math.ceil(this._estimateFee()/n.FEE_SECURITY_MARGIN);if(s>e)return new f.Transaction.FeeError.TooSmall("expected more than "+s+" but got "+e)}},n.prototype._missingChange=function(){return!this._changeScript},n.prototype._hasDustOutputs=function(t){if(!t.disableDustOutputs){var e,r;for(e in this.outputs)if(r=this.outputs[e],r.satoshis"},n.prototype.toBuffer=function(){var t=new d;return this.toBufferWriter(t).toBuffer()},n.prototype.toBufferWriter=function(t){return t.writeUInt32LE(this.version),t.writeVarintNum(this.inputs.length),i.each(this.inputs,function(e){e.toBufferWriter(t)}),t.writeVarintNum(this.outputs.length),i.each(this.outputs,function(e){e.toBufferWriter(t)}),t.writeUInt32LE(this.nLockTime),t},n.prototype.fromBuffer=function(t){var e=new h(t);return this.fromBufferReader(e)},n.prototype.fromBufferReader=function(t){s.checkArgument(!t.finished(),"No transaction data received");var e,r,n;for(this.version=t.readUInt32LE(),r=t.readVarintNum(),e=0;r>e;e++){var i=y.fromBufferReader(t);this.inputs.push(i)}for(n=t.readVarintNum(),e=0;n>e;e++)this.outputs.push(I.fromBufferReader(t));return this.nLockTime=t.readUInt32LE(),this},n.prototype.toObject=n.prototype.toJSON=function(){var t=[];this.inputs.forEach(function(e){t.push(e.toObject())});var e=[];this.outputs.forEach(function(t){e.push(t.toObject())});var r={hash:this.hash,version:this.version,inputs:t,outputs:e,nLockTime:this.nLockTime};return this._changeScript&&(r.changeScript=this._changeScript.toString()),i.isUndefined(this._changeIndex)||(r.changeIndex=this._changeIndex),i.isUndefined(this._fee)||(r.fee=this._fee),r},n.prototype.fromObject=function(t){s.checkArgument(i.isObject(t)||t instanceof n);var e,r=this;return e=t instanceof n?e.toObject():t,i.each(e.inputs,function(t){if(!t.output||!t.output.script)return void r.uncheckedAddInput(new y(t));var e,n=new k(t.output.script);if(n.isPublicKeyHashOut())e=new y.PublicKeyHash(t);else if(n.isScriptHashOut()&&t.publicKeys&&t.threshold)e=new y.MultiSigScriptHash(t,t.publicKeys,t.threshold,t.signatures);else{if(!n.isPublicKeyOut())throw new f.Transaction.Input.UnsupportedScript(t.output.script);e=new y.PublicKey(t)}r.addInput(e)}),i.each(e.outputs,function(t){r.addOutput(new I(t))}),e.changeIndex&&(this._changeIndex=e.changeIndex),e.changeScript&&(this._changeScript=new k(e.changeScript)),e.fee&&(this._fee=e.fee),this.nLockTime=e.nLockTime,this.version=e.version,this._checkConsistency(t),this},n.prototype._checkConsistency=function(t){i.isUndefined(this._changeIndex)||(s.checkState(this._changeScript),s.checkState(this.outputs[this._changeIndex]),s.checkState(this.outputs[this._changeIndex].script.toString()===this._changeScript.toString())),t&&t.hash&&s.checkState(t.hash===this.hash,"Hash in object does not match transaction hash")},n.prototype.lockUntilDate=function(t){if(s.checkArgument(t),i.isNumber(t)&&t=n.NLOCKTIME_BLOCKHEIGHT_LIMIT)throw new f.Transaction.BlockHeightTooHigh;if(0>t)throw new f.Transaction.NLockTimeOutOfRange;for(var e=0;e0?(this._changeIndex=this.outputs.length,this._addOutput(new I({script:this._changeScript,satoshis:r}))):this._changeIndex=void 0}},n.prototype.getFee=function(){return this.isCoinbase()?0:i.isUndefined(this._fee)?this._changeScript?this._estimateFee():this._getUnspentValue():this._fee},n.prototype._estimateFee=function(){var t=this._estimateSize(),e=this._getUnspentValue();return n._estimateFee(t,e,this._feePerKb)},n.prototype._getUnspentValue=function(){return this._getInputAmount()-this._getOutputAmount()},n.prototype._clearSignatures=function(){i.each(this.inputs,function(t){t.clearSignatures()})},n._estimateFee=function(t,e,r){var i=Math.ceil(t/1e3)*(r||n.FEE_PER_KB);return e>i&&(t+=n.CHANGE_OUTPUT_MAX_SIZE),Math.ceil(t/1e3)*(r||n.FEE_PER_KB)},n.prototype._estimateSize=function(){var t=n.MAXIMUM_EXTRA_SIZE;return i.each(this.inputs,function(e){t+=e._estimateSize()}),i.each(this.outputs,function(e){t+=e.script.toBuffer().length+9}),t},n.prototype._removeOutput=function(t){var e=this.outputs[t];this.outputs=i.without(this.outputs,e),this._outputAmount=void 0},n.prototype.removeOutput=function(t){this._removeOutput(t),this._updateChangeOutput()},n.prototype.sort=function(){return this.sortInputs(function(t){var e=Array.prototype.concat.apply([],t);return e.sort(function(t,e){return a(t.prevTxId,e.prevTxId)||t.outputIndex-e.outputIndex}),e}),this.sortOutputs(function(t){var e=Array.prototype.concat.apply([],t);return e.sort(function(t,e){return t.satoshis-e.satoshis||a(t.script.toBuffer(),e.script.toBuffer())}),e}),this},n.prototype.shuffleOutputs=function(){return this.sortOutputs(i.shuffle)},n.prototype.sortOutputs=function(t){var e=t(this.outputs);return this._newOutputOrder(e)},n.prototype.sortInputs=function(t){return this.inputs=t(this.inputs),this._clearSignatures(),this},n.prototype._newOutputOrder=function(t){var e=this.outputs.length!==t.length||0!==i.difference(this.outputs,t).length;if(e)throw new f.Transaction.InvalidSorting;if(!i.isUndefined(this._changeIndex)){var r=this.outputs[this._changeIndex];this._changeIndex=i.findIndex(t,r)}return this.outputs=t,this},n.prototype.removeInput=function(t,e){var r;if(r=!e&&i.isNumber(t)?t:i.findIndex(this.inputs,function(r){return r.prevTxId.toString("hex")===t&&r.outputIndex===e}),0>r||r>=this.inputs.length)throw new f.Transaction.InvalidIndex(r,this.inputs.length);var n=this.inputs[r];this.inputs=i.without(this.inputs,n),this._inputAmount=void 0,this._updateChangeOutput()},n.prototype.sign=function(t,e){s.checkState(this.hasAllUtxoInfo());var r=this;return i.isArray(t)?(i.each(t,function(t){r.sign(t,e)}),this):(i.each(this.getSignatures(t,e),function(t){r.applySignature(t)}),this)},n.prototype.getSignatures=function(t,e){t=new E(t),e=e||l.SIGHASH_ALL;var r=this,n=[],s=p.sha256ripemd160(t.publicKey.toBuffer());return i.each(this.inputs,function(o,a){i.each(o.getSignatures(r,t,a,e,s),function(t){n.push(t)})}),n},n.prototype.applySignature=function(t){return this.inputs[t.inputIndex].addSignature(this,t),this},n.prototype.isFullySigned=function(){return i.each(this.inputs,function(t){if(t.isFullySigned===y.prototype.isFullySigned)throw new f.Transaction.UnableToVerifySignature("Unrecognized script kind, or not enough information to execute script.This usually happens when creating a transaction from a serialized transaction")}),i.all(i.map(this.inputs,function(t){return t.isFullySigned()}))},n.prototype.isValidSignature=function(t){var e=this;if(this.inputs[t.inputIndex].isValidSignature===y.prototype.isValidSignature)throw new f.Transaction.UnableToVerifySignature("Unrecognized script kind, or not enough information to execute script.This usually happens when creating a transaction from a serialized transaction");return this.inputs[t.inputIndex].isValidSignature(e,t)},n.prototype.verifySignature=function(t,e,r,n){return b.verify(this,t,e,r,n)},n.prototype.verify=function(){if(0===this.inputs.length)return"transaction txins empty";if(0===this.outputs.length)return"transaction txouts empty";for(var t=new A(0),e=0;eO)return"transaction over the maximum block size";var s={};for(e=0;e100)return"coinbase transaction script size invalid"}else for(e=0;e64)throw new Error("Invalid TXID in object",t);var c=i.isUndefined(t.vout)?t.outputIndex:t.vout;if(!i.isNumber(c))throw new Error("Invalid outputIndex, received "+c);s.checkArgument(!i.isUndefined(t.scriptPubKey)||!i.isUndefined(t.script),"Must provide the scriptPubKey for that output!");var h=new a(t.scriptPubKey||t.script);s.checkArgument(!i.isUndefined(t.amount)||!i.isUndefined(t.satoshis),"Must provide an amount for the output");var d=i.isUndefined(t.amount)?t.satoshis:new u.fromBTC(t.amount).toSatoshis();s.checkArgument(i.isNumber(d),"Amount must be a number"),o.defineImmutable(this,{address:e,txId:r,outputIndex:c,script:h,satoshis:d})}var i=t("lodash"),s=t("../util/preconditions"),o=t("../util/js"),a=t("../script"),f=t("../address"),u=t("../unit");n.prototype.inspect=function(){return""},n.prototype.toString=function(){return this.txId+":"+this.outputIndex},n.fromObject=function(t){return new n(t)},n.prototype.toObject=n.prototype.toJSON=function(){return{address:this.address?this.address.toString():void 0,txid:this.txId,vout:this.outputIndex,scriptPubKey:this.script.toBuffer().toString("hex"),amount:u.fromSatoshis(this.satoshis).toBTC()}},e.exports=n},{"../address":1,"../script":26,"../unit":41,"../util/js":44,"../util/preconditions":45,lodash:297}],41:[function(t,e,r){"use strict";function n(t,e){if(!(this instanceof n))return new n(t,e);if(i.isNumber(e)){if(0>=e)throw new s.Unit.InvalidRate(e);t/=e,e=n.BTC}this._value=this._from(t,e);var r=this,o=function(t){Object.defineProperty(r,t,{get:function(){return r.to(t)},enumerable:!0})};Object.keys(a).forEach(o)}var i=t("lodash"),s=t("./errors"),o=t("./util/preconditions"),a={BTC:[1e8,8],mBTC:[1e5,5],uBTC:[100,2],bits:[100,2],satoshis:[1,0]};Object.keys(a).forEach(function(t){n[t]=t}),n.fromObject=function(t){return o.checkArgument(i.isObject(t),"Argument is expected to be an object"),new n(t.amount,t.code)},n.fromBTC=function(t){return new n(t,n.BTC)},n.fromMillis=n.fromMilis=function(t){return new n(t,n.mBTC)},n.fromMicros=n.fromBits=function(t){return new n(t,n.bits)},n.fromSatoshis=function(t){return new n(t,n.satoshis)},n.fromFiat=function(t,e){return new n(t,e)},n.prototype._from=function(t,e){if(!a[e])throw new s.Unit.UnknownCode(e);return parseInt((t*a[e][0]).toFixed())},n.prototype.to=function(t){if(i.isNumber(t)){if(0>=t)throw new s.Unit.InvalidRate(t);return parseFloat((this.BTC*t).toFixed(2))}if(!a[t])throw new s.Unit.UnknownCode(t);var e=this._value/a[t][0];return parseFloat(e.toFixed(a[t][1]))},n.prototype.toBTC=function(){return this.to(n.BTC)},n.prototype.toMillis=n.prototype.toMilis=function(){return this.to(n.mBTC)},n.prototype.toMicros=n.prototype.toBits=function(){return this.to(n.bits)},n.prototype.toSatoshis=function(){return this.to(n.satoshis)},n.prototype.atRate=function(t){return this.to(t)},n.prototype.toString=function(){return this.satoshis+" satoshis"},n.prototype.toObject=n.prototype.toJSON=function(){return{amount:this.BTC,code:n.BTC}},n.prototype.inspect=function(){return""},e.exports=n},{"./errors":17,"./util/preconditions":45,lodash:297}],42:[function(t,e,r){"use strict";var n=t("lodash"),i=t("url"),s=t("./address"),o=t("./unit"),a=function(t,e){if(!(this instanceof a))return new a(t,e);if(this.extras={},this.knownParams=e||[],this.address=this.network=this.amount=this.message=null,"string"==typeof t){var r=a.parse(t);r.amount&&(r.amount=this._parseAmount(r.amount)),this._fromObject(r)}else{if("object"!=typeof t)throw new TypeError("Unrecognized data format.");this._fromObject(t)}};a.fromString=function(t){if("string"!=typeof t)throw new TypeError("Expected a string");return new a(t)},a.fromObject=function(t){return new a(t)},a.isValid=function(t,e){try{new a(t,e)}catch(r){return!1}return!0},a.parse=function(t){var e=i.parse(t,!0);if("bitcoin:"!==e.protocol)throw new TypeError("Invalid bitcoin URI");var r=/[^:]*:\/?\/?([^?]*)/.exec(t);return e.query.address=r&&r[1]||void 0,e.query},a.Members=["address","amount","message","label","r"],a.prototype._fromObject=function(t){if(!s.isValid(t.address))throw new TypeError("Invalid bitcoin address");this.address=new s(t.address),this.network=this.address.network,this.amount=t.amount;for(var e in t)if("address"!==e&&"amount"!==e){if(/^req-/.exec(e)&&-1===this.knownParams.indexOf(e))throw Error("Unknown required argument "+e);var r=a.Members.indexOf(e)>-1?this:this.extras;r[e]=t[e]}},a.prototype._parseAmount=function(t){if(t=Number(t),isNaN(t))throw new TypeError("Invalid amount");return o.fromBTC(t).toSatoshis()},a.prototype.toObject=a.prototype.toJSON=function(){for(var t={},e=0;e"},e.exports=a},{"./address":1,"./unit":41,lodash:297,url:267}],43:[function(t,e,r){(function(r){"use strict";function n(t,e){if(t.length!==e.length)return!1;for(var r=t.length,n=0;r>n;n++)if(t[n]!==e[n])return!1;return!0}var i=t("buffer"),s=t("assert"),o=t("./js"),a=t("./preconditions");e.exports={fill:function(t,e){a.checkArgumentType(t,"Buffer","buffer"),a.checkArgumentType(e,"number","value");for(var r=t.length,n=0;r>n;n++)t[n]=e;return t},copy:function(t){var e=new r(t.length);return t.copy(e),e},isBuffer:function(t){return i.Buffer.isBuffer(t)||t instanceof Uint8Array},emptyBuffer:function(t){a.checkArgumentType(t,"number","bytes");for(var e=new i.Buffer(t),r=0;t>r;r++)e.write("\x00",r);return e},concat:i.Buffer.concat,equals:n,equal:n,integerAsSingleByteBuffer:function(t){return a.checkArgumentType(t,"number","integer"),new i.Buffer([255&t])},integerAsBuffer:function(t){a.checkArgumentType(t,"number","integer");var e=[];return e.push(t>>24&255),e.push(t>>16&255),e.push(t>>8&255),e.push(255&t),new r(e)},integerFromBuffer:function(t){return a.checkArgumentType(t,"Buffer","buffer"),t[0]<<24|t[1]<<16|t[2]<<8|t[3]},integerFromSingleByteBuffer:function(t){return a.checkArgumentType(t,"Buffer","buffer"),t[0]},bufferToHex:function(t){return a.checkArgumentType(t,"Buffer","buffer"),t.toString("hex")},reverse:function(t){for(var e=new i.Buffer(t.length),r=0;r=0}}},{lodash:297}],45:[function(t,e,r){"use strict";var n=t("../errors"),i=t("lodash");e.exports={checkState:function(t,e){if(!t)throw new n.InvalidState(e)},checkArgument:function(t,e,r,i){if(!t)throw new n.InvalidArgument(e,r,i)},checkArgumentType:function(e,r,s){if(s=s||"(unknown name)",i.isString(r)){if("Buffer"===r){var o=t("./buffer");if(!o.isBuffer(e))throw new n.InvalidArgumentType(e,r,s)}else if(typeof e!==r)throw new n.InvalidArgumentType(e,r,s)}else if(!(e instanceof r))throw new n.InvalidArgumentType(e,r.name,s)}}},{"../errors":17,"./buffer":43,lodash:297}],46:[function(t,e,r){function n(t,e){return p.isUndefined(e)?""+e:p.isNumber(e)&&!isFinite(e)?e.toString():p.isFunction(e)||p.isRegExp(e)?e.toString():e}function i(t,e){return p.isString(t)?t.length=0;s--)if(o[s]!=a[s])return!1;for(s=o.length-1;s>=0;s--)if(i=o[s],!f(t[i],e[i]))return!1;return!0}function h(t,e){return t&&e?"[object RegExp]"==Object.prototype.toString.call(e)?e.test(t):t instanceof e?!0:e.call({},t)===!0?!0:!1:!1}function d(t,e,r,n){var i;p.isString(r)&&(n=r,r=null);try{e()}catch(s){i=s}if(n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),t&&!i&&o(i,r,"Missing expected exception"+n),!t&&h(i,r)&&o(i,r,"Got unwanted exception"+n),t&&i&&r&&!h(i,r)||!t&&i)throw i}var p=t("util/"),l=Array.prototype.slice,b=Object.prototype.hasOwnProperty,g=e.exports=a;g.AssertionError=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=s(this),this.generatedMessage=!0);var e=t.stackStartFunction||o;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var n=r.stack,i=e.name,a=n.indexOf("\n"+i);if(a>=0){var f=n.indexOf("\n",a+1);n=n.substring(f+1)}this.stack=n}}},p.inherits(g.AssertionError,Error),g.fail=o,g.ok=a,g.equal=function(t,e,r){t!=e&&o(t,e,r,"==",g.equal)},g.notEqual=function(t,e,r){t==e&&o(t,e,r,"!=",g.notEqual)},g.deepEqual=function(t,e,r){f(t,e)||o(t,e,r,"deepEqual",g.deepEqual)},g.notDeepEqual=function(t,e,r){f(t,e)&&o(t,e,r,"notDeepEqual",g.notDeepEqual)},g.strictEqual=function(t,e,r){t!==e&&o(t,e,r,"===",g.strictEqual)},g.notStrictEqual=function(t,e,r){t===e&&o(t,e,r,"!==",g.notStrictEqual)},g["throws"]=function(t,e,r){d.apply(this,[!0].concat(l.call(arguments)))},g.doesNotThrow=function(t,e){d.apply(this,[!1].concat(l.call(arguments)))},g.ifError=function(t){if(t)throw t};var m=Object.keys||function(t){var e=[];for(var r in t)b.call(t,r)&&e.push(r);return e}},{"util/":269}],47:[function(t,e,r){},{}],48:[function(t,e,r){(function(e){"use strict";function n(){function t(){}try{var e=new Uint8Array(1);return e.foo=function(){return 42},e.constructor=t,42===e.foo()&&e.constructor===t&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(r){return!1}}function i(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(t){return this instanceof s?(s.TYPED_ARRAY_SUPPORT||(this.length=0,this.parent=void 0),"number"==typeof t?o(this,t):"string"==typeof t?a(this,t,arguments.length>1?arguments[1]:"utf8"):f(this,t)):arguments.length>1?new s(t,arguments[1]):new s(t)}function o(t,e){if(t=b(t,0>e?0:0|g(e)),!s.TYPED_ARRAY_SUPPORT)for(var r=0;e>r;r++)t[r]=0;return t}function a(t,e,r){("string"!=typeof r||""===r)&&(r="utf8");var n=0|y(e,r);return t=b(t,n),t.write(e,r),t}function f(t,e){if(s.isBuffer(e))return u(t,e);if(J(e))return c(t,e);if(null==e)throw new TypeError("must start with number, buffer, array or string");if("undefined"!=typeof ArrayBuffer){if(e.buffer instanceof ArrayBuffer)return h(t,e);if(e instanceof ArrayBuffer)return d(t,e)}return e.length?p(t,e):l(t,e)}function u(t,e){var r=0|g(e.length);return t=b(t,r),e.copy(t,0,0,r),t}function c(t,e){var r=0|g(e.length);t=b(t,r);for(var n=0;r>n;n+=1)t[n]=255&e[n];return t}function h(t,e){var r=0|g(e.length);t=b(t,r);for(var n=0;r>n;n+=1)t[n]=255&e[n];return t}function d(t,e){return s.TYPED_ARRAY_SUPPORT?(e.byteLength,t=s._augment(new Uint8Array(e))):t=h(t,new Uint8Array(e)),t}function p(t,e){var r=0|g(e.length);t=b(t,r);for(var n=0;r>n;n+=1)t[n]=255&e[n];return t}function l(t,e){var r,n=0;"Buffer"===e.type&&J(e.data)&&(r=e.data,n=0|g(r.length)),t=b(t,n);for(var i=0;n>i;i+=1)t[i]=255&r[i];return t}function b(t,e){s.TYPED_ARRAY_SUPPORT?(t=s._augment(new Uint8Array(e)),t.__proto__=s.prototype):(t.length=e,t._isBuffer=!0);var r=0!==e&&e<=s.poolSize>>>1;return r&&(t.parent=Z),t}function g(t){if(t>=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|t}function m(t,e){if(!(this instanceof m))return new m(t,e);var r=new s(t,e);return delete r.parent,r}function y(t,e){"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"binary":case"raw":case"raws":return r;case"utf8":case"utf-8":return H(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Y(t).length;default:if(n)return H(t).length;e=(""+e).toLowerCase(),n=!0}}function v(t,e,r){var n=!1;if(e=0|e,r=void 0===r||r===1/0?this.length:0|r,t||(t="utf8"),0>e&&(e=0),r>this.length&&(r=this.length),e>=r)return"";for(;;)switch(t){case"hex":return M(this,e,r);case"utf8":case"utf-8":return x(this,e,r);case"ascii":return O(this,e,r);case"binary":return B(this,e,r);case"base64":return A(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function _(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;var s=e.length;if(s%2!==0)throw new Error("Invalid hex string");n>s/2&&(n=s/2);for(var o=0;n>o;o++){var a=parseInt(e.substr(2*o,2),16);if(isNaN(a))throw new Error("Invalid hex string");t[r+o]=a}return o}function w(t,e,r,n){return G(H(e,t.length-r),t,r,n)}function S(t,e,r,n){return G(q(e),t,r,n)}function I(t,e,r,n){return S(t,e,r,n)}function k(t,e,r,n){return G(Y(e),t,r,n)}function E(t,e,r,n){return G(V(e,t.length-r),t,r,n)}function A(t,e,r){return 0===e&&r===t.length?W.fromByteArray(t):W.fromByteArray(t.slice(e,r))}function x(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;r>i;){var s=t[i],o=null,a=s>239?4:s>223?3:s>191?2:1;if(r>=i+a){var f,u,c,h;switch(a){case 1:128>s&&(o=s);break;case 2:f=t[i+1],128===(192&f)&&(h=(31&s)<<6|63&f,h>127&&(o=h));break;case 3:f=t[i+1],u=t[i+2],128===(192&f)&&128===(192&u)&&(h=(15&s)<<12|(63&f)<<6|63&u,h>2047&&(55296>h||h>57343)&&(o=h));break;case 4:f=t[i+1],u=t[i+2],c=t[i+3],128===(192&f)&&128===(192&u)&&128===(192&c)&&(h=(15&s)<<18|(63&f)<<12|(63&u)<<6|63&c,h>65535&&1114112>h&&(o=h))}}null===o?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296), o=56320|1023&o),n.push(o),i+=a}return P(n)}function P(t){var e=t.length;if(Q>=e)return String.fromCharCode.apply(String,t);for(var r="",n=0;e>n;)r+=String.fromCharCode.apply(String,t.slice(n,n+=Q));return r}function O(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;r>i;i++)n+=String.fromCharCode(127&t[i]);return n}function B(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;r>i;i++)n+=String.fromCharCode(t[i]);return n}function M(t,e,r){var n=t.length;(!e||0>e)&&(e=0),(!r||0>r||r>n)&&(r=n);for(var i="",s=e;r>s;s++)i+=K(t[s]);return i}function R(t,e,r){for(var n=t.slice(e,r),i="",s=0;st)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function C(t,e,r,n,i,o){if(!s.isBuffer(t))throw new TypeError("buffer must be a Buffer instance");if(e>i||o>e)throw new RangeError("value is out of bounds");if(r+n>t.length)throw new RangeError("index out of range")}function N(t,e,r,n){0>e&&(e=65535+e+1);for(var i=0,s=Math.min(t.length-r,2);s>i;i++)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function j(t,e,r,n){0>e&&(e=4294967295+e+1);for(var i=0,s=Math.min(t.length-r,4);s>i;i++)t[r+i]=e>>>8*(n?i:3-i)&255}function U(t,e,r,n,i,s){if(e>i||s>e)throw new RangeError("value is out of bounds");if(r+n>t.length)throw new RangeError("index out of range");if(0>r)throw new RangeError("index out of range")}function L(t,e,r,n,i){return i||U(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),X.write(t,e,r,n,23,4),r+4}function D(t,e,r,n,i){return i||U(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),X.write(t,e,r,n,52,8),r+8}function z(t){if(t=F(t).replace(tt,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function F(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function K(t){return 16>t?"0"+t.toString(16):t.toString(16)}function H(t,e){e=e||1/0;for(var r,n=t.length,i=null,s=[],o=0;n>o;o++){if(r=t.charCodeAt(o),r>55295&&57344>r){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(56320>r){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,128>r){if((e-=1)<0)break;s.push(r)}else if(2048>r){if((e-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(65536>r){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(1114112>r))throw new Error("Invalid code point");if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function q(t){for(var e=[],r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function Y(t){return W.toByteArray(z(t))}function G(t,e,r,n){for(var i=0;n>i&&!(i+r>=e.length||i>=t.length);i++)e[i+r]=t[i];return i}var W=t("base64-js"),X=t("ieee754"),J=t("isarray");r.Buffer=s,r.SlowBuffer=m,r.INSPECT_MAX_BYTES=50,s.poolSize=8192;var Z={};s.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:n(),s.TYPED_ARRAY_SUPPORT?(s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array):(s.prototype.length=void 0,s.prototype.parent=void 0),s.isBuffer=function(t){return!(null==t||!t._isBuffer)},s.compare=function(t,e){if(!s.isBuffer(t)||!s.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);o>i&&t[i]===e[i];)++i;return i!==o&&(r=t[i],n=e[i]),n>r?-1:r>n?1:0},s.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(t,e){if(!J(t))throw new TypeError("list argument must be an Array of Buffers.");if(0===t.length)return new s(0);var r;if(void 0===e)for(e=0,r=0;r0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},s.prototype.compare=function(t){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?0:s.compare(this,t)},s.prototype.indexOf=function(t,e){function r(t,e,r){for(var n=-1,i=0;r+i2147483647?e=2147483647:-2147483648>e&&(e=-2147483648),e>>=0,0===this.length)return-1;if(e>=this.length)return-1;if(0>e&&(e=Math.max(this.length+e,0)),"string"==typeof t)return 0===t.length?-1:String.prototype.indexOf.call(this,t,e);if(s.isBuffer(t))return r(this,t,e);if("number"==typeof t)return s.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,t,e):r(this,[t],e);throw new TypeError("val must be string, number or Buffer")},s.prototype.get=function(t){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(t)},s.prototype.set=function(t,e){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(t,e)},s.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else if(isFinite(e))e=0|e,isFinite(r)?(r=0|r,void 0===n&&(n="utf8")):(n=r,r=void 0);else{var i=n;n=e,e=0|r,r=i}var s=this.length-e;if((void 0===r||r>s)&&(r=s),t.length>0&&(0>r||0>e)||e>this.length)throw new RangeError("attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return _(this,t,e,r);case"utf8":case"utf-8":return w(this,t,e,r);case"ascii":return S(this,t,e,r);case"binary":return I(this,t,e,r);case"base64":return k(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Q=4096;s.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,0>t?(t+=r,0>t&&(t=0)):t>r&&(t=r),0>e?(e+=r,0>e&&(e=0)):e>r&&(e=r),t>e&&(e=t);var n;if(s.TYPED_ARRAY_SUPPORT)n=s._augment(this.subarray(t,e));else{var i=e-t;n=new s(i,void 0);for(var o=0;i>o;o++)n[o]=this[o+t]}return n.length&&(n.parent=this.parent||this),n},s.prototype.readUIntLE=function(t,e,r){t=0|t,e=0|e,r||T(t,e,this.length);for(var n=this[t],i=1,s=0;++s0&&(i*=256);)n+=this[t+--e]*i;return n},s.prototype.readUInt8=function(t,e){return e||T(t,1,this.length),this[t]},s.prototype.readUInt16LE=function(t,e){return e||T(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUInt16BE=function(t,e){return e||T(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUInt32LE=function(t,e){return e||T(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUInt32BE=function(t,e){return e||T(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readIntLE=function(t,e,r){t=0|t,e=0|e,r||T(t,e,this.length);for(var n=this[t],i=1,s=0;++s=i&&(n-=Math.pow(2,8*e)),n},s.prototype.readIntBE=function(t,e,r){t=0|t,e=0|e,r||T(t,e,this.length);for(var n=e,i=1,s=this[t+--n];n>0&&(i*=256);)s+=this[t+--n]*i;return i*=128,s>=i&&(s-=Math.pow(2,8*e)),s},s.prototype.readInt8=function(t,e){return e||T(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){e||T(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(t,e){e||T(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(t,e){return e||T(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return e||T(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readFloatLE=function(t,e){return e||T(t,4,this.length),X.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return e||T(t,4,this.length),X.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return e||T(t,8,this.length),X.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return e||T(t,8,this.length),X.read(this,t,!1,52,8)},s.prototype.writeUIntLE=function(t,e,r,n){t=+t,e=0|e,r=0|r,n||C(this,t,e,r,Math.pow(2,8*r),0);var i=1,s=0;for(this[e]=255&t;++s=0&&(s*=256);)this[e+i]=t/s&255;return e+r},s.prototype.writeUInt8=function(t,e,r){return t=+t,e=0|e,r||C(this,t,e,1,255,0),s.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},s.prototype.writeUInt16LE=function(t,e,r){return t=+t,e=0|e,r||C(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):N(this,t,e,!0),e+2},s.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=0|e,r||C(this,t,e,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):N(this,t,e,!1),e+2},s.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=0|e,r||C(this,t,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):j(this,t,e,!0),e+4},s.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=0|e,r||C(this,t,e,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):j(this,t,e,!1),e+4},s.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e=0|e,!n){var i=Math.pow(2,8*r-1);C(this,t,e,r,i-1,-i)}var s=0,o=1,a=0>t?1:0;for(this[e]=255&t;++s>0)-a&255;return e+r},s.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e=0|e,!n){var i=Math.pow(2,8*r-1);C(this,t,e,r,i-1,-i)}var s=r-1,o=1,a=0>t?1:0;for(this[e+s]=255&t;--s>=0&&(o*=256);)this[e+s]=(t/o>>0)-a&255;return e+r},s.prototype.writeInt8=function(t,e,r){return t=+t,e=0|e,r||C(this,t,e,1,127,-128),s.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),0>t&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,r){return t=+t,e=0|e,r||C(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):N(this,t,e,!0),e+2},s.prototype.writeInt16BE=function(t,e,r){return t=+t,e=0|e,r||C(this,t,e,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):N(this,t,e,!1),e+2},s.prototype.writeInt32LE=function(t,e,r){return t=+t,e=0|e,r||C(this,t,e,4,2147483647,-2147483648),s.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):j(this,t,e,!0),e+4},s.prototype.writeInt32BE=function(t,e,r){return t=+t,e=0|e,r||C(this,t,e,4,2147483647,-2147483648),0>t&&(t=4294967295+t+1),s.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):j(this,t,e,!1),e+4},s.prototype.writeFloatLE=function(t,e,r){return L(this,t,e,!0,r)},s.prototype.writeFloatBE=function(t,e,r){return L(this,t,e,!1,r)},s.prototype.writeDoubleLE=function(t,e,r){return D(this,t,e,!0,r)},s.prototype.writeDoubleBE=function(t,e,r){return D(this,t,e,!1,r)},s.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&r>n&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(0>e)throw new RangeError("targetStart out of bounds");if(0>r||r>=this.length)throw new RangeError("sourceStart out of bounds");if(0>n)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-er&&n>e)for(i=o-1;i>=0;i--)t[i+e]=this[i+r];else if(1e3>o||!s.TYPED_ARRAY_SUPPORT)for(i=0;o>i;i++)t[i+e]=this[i+r];else t._set(this.subarray(r,r+o),e);return o},s.prototype.fill=function(t,e,r){if(t||(t=0),e||(e=0),r||(r=this.length),e>r)throw new RangeError("end < start");if(r!==e&&0!==this.length){if(0>e||e>=this.length)throw new RangeError("start out of bounds");if(0>r||r>this.length)throw new RangeError("end out of bounds");var n;if("number"==typeof t)for(n=e;r>n;n++)this[n]=t;else{var i=H(t.toString()),s=i.length;for(n=e;r>n;n++)this[n]=i[n%s]}return this}},s.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(s.TYPED_ARRAY_SUPPORT)return new s(this).buffer;for(var t=new Uint8Array(this.length),e=0,r=t.length;r>e;e+=1)t[e]=this[e];return t.buffer}throw new TypeError("Buffer.toArrayBuffer not supported in this browser")};var $=s.prototype;s._augment=function(t){return t.constructor=s,t._isBuffer=!0,t._set=t.set,t.get=$.get,t.set=$.set,t.write=$.write,t.toString=$.toString,t.toLocaleString=$.toString,t.toJSON=$.toJSON,t.equals=$.equals,t.compare=$.compare,t.indexOf=$.indexOf,t.copy=$.copy,t.slice=$.slice,t.readUIntLE=$.readUIntLE,t.readUIntBE=$.readUIntBE,t.readUInt8=$.readUInt8,t.readUInt16LE=$.readUInt16LE,t.readUInt16BE=$.readUInt16BE,t.readUInt32LE=$.readUInt32LE,t.readUInt32BE=$.readUInt32BE,t.readIntLE=$.readIntLE,t.readIntBE=$.readIntBE,t.readInt8=$.readInt8,t.readInt16LE=$.readInt16LE,t.readInt16BE=$.readInt16BE,t.readInt32LE=$.readInt32LE,t.readInt32BE=$.readInt32BE,t.readFloatLE=$.readFloatLE,t.readFloatBE=$.readFloatBE,t.readDoubleLE=$.readDoubleLE,t.readDoubleBE=$.readDoubleBE,t.writeUInt8=$.writeUInt8,t.writeUIntLE=$.writeUIntLE,t.writeUIntBE=$.writeUIntBE,t.writeUInt16LE=$.writeUInt16LE,t.writeUInt16BE=$.writeUInt16BE,t.writeUInt32LE=$.writeUInt32LE,t.writeUInt32BE=$.writeUInt32BE,t.writeIntLE=$.writeIntLE,t.writeIntBE=$.writeIntBE,t.writeInt8=$.writeInt8,t.writeInt16LE=$.writeInt16LE,t.writeInt16BE=$.writeInt16BE,t.writeInt32LE=$.writeInt32LE,t.writeInt32BE=$.writeInt32BE,t.writeFloatLE=$.writeFloatLE,t.writeFloatBE=$.writeFloatBE,t.writeDoubleLE=$.writeDoubleLE,t.writeDoubleBE=$.writeDoubleBE,t.fill=$.fill,t.inspect=$.inspect,t.toArrayBuffer=$.toArrayBuffer,t};var tt=/[^+\/0-9A-Za-z-_]/g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"base64-js":49,ieee754:50,isarray:51}],49:[function(t,e,r){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(t){"use strict";function e(t){var e=t.charCodeAt(0);return e===o||e===h?62:e===a||e===d?63:f>e?-1:f+10>e?e-f+26+26:c+26>e?e-c:u+26>e?e-u+26:void 0}function r(t){function r(t){u[h++]=t}var n,i,o,a,f,u;if(t.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var c=t.length;f="="===t.charAt(c-2)?2:"="===t.charAt(c-1)?1:0,u=new s(3*t.length/4-f),o=f>0?t.length-4:t.length;var h=0;for(n=0,i=0;o>n;n+=4,i+=3)a=e(t.charAt(n))<<18|e(t.charAt(n+1))<<12|e(t.charAt(n+2))<<6|e(t.charAt(n+3)),r((16711680&a)>>16),r((65280&a)>>8),r(255&a);return 2===f?(a=e(t.charAt(n))<<2|e(t.charAt(n+1))>>4,r(255&a)):1===f&&(a=e(t.charAt(n))<<10|e(t.charAt(n+1))<<4|e(t.charAt(n+2))>>2,r(a>>8&255),r(255&a)),u}function i(t){function e(t){return n.charAt(t)}function r(t){return e(t>>18&63)+e(t>>12&63)+e(t>>6&63)+e(63&t)}var i,s,o,a=t.length%3,f="";for(i=0,o=t.length-a;o>i;i+=3)s=(t[i]<<16)+(t[i+1]<<8)+t[i+2],f+=r(s);switch(a){case 1:s=t[t.length-1],f+=e(s>>2),f+=e(s<<4&63),f+="==";break;case 2:s=(t[t.length-2]<<8)+t[t.length-1],f+=e(s>>10),f+=e(s>>4&63),f+=e(s<<2&63),f+="="}return f}var s="undefined"!=typeof Uint8Array?Uint8Array:Array,o="+".charCodeAt(0),a="/".charCodeAt(0),f="0".charCodeAt(0),u="a".charCodeAt(0),c="A".charCodeAt(0),h="-".charCodeAt(0),d="_".charCodeAt(0);t.toByteArray=r,t.fromByteArray=i}("undefined"==typeof r?this.base64js={}:r)},{}],50:[function(t,e,r){r.read=function(t,e,r,n,i){var s,o,a=8*i-n-1,f=(1<>1,c=-7,h=r?i-1:0,d=r?-1:1,p=t[e+h];for(h+=d,s=p&(1<<-c)-1,p>>=-c,c+=a;c>0;s=256*s+t[e+h],h+=d,c-=8);for(o=s&(1<<-c)-1,s>>=-c,c+=n;c>0;o=256*o+t[e+h],h+=d,c-=8);if(0===s)s=1-u;else{if(s===f)return o?NaN:(p?-1:1)*(1/0);o+=Math.pow(2,n),s-=u}return(p?-1:1)*o*Math.pow(2,s-n)},r.write=function(t,e,r,n,i,s){var o,a,f,u=8*s-i-1,c=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:s-1,l=n?1:-1,b=0>e||0===e&&0>1/e?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-o))<1&&(o--,f*=2),e+=o+h>=1?d/f:d*Math.pow(2,1-h),e*f>=2&&(o++,f/=2),o+h>=c?(a=0,o=c):o+h>=1?(a=(e*f-1)*Math.pow(2,i),o+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;t[r+p]=255&a,p+=l,a/=256,i-=8);for(o=o<0;t[r+p]=255&o,p+=l,o/=256,u-=8);t[r+p-l]|=128*b}},{}],51:[function(t,e,r){var n={}.toString;e.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},{}],52:[function(t,e,r){"use strict";r.randomBytes=r.rng=r.pseudoRandomBytes=r.prng=t("randombytes"),r.createHash=r.Hash=t("create-hash"),r.createHmac=r.Hmac=t("create-hmac");var n=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(Object.keys(t("browserify-sign/algos")));r.getHashes=function(){return n};var i=t("pbkdf2");r.pbkdf2=i.pbkdf2,r.pbkdf2Sync=i.pbkdf2Sync;var s=t("browserify-cipher");["Cipher","createCipher","Cipheriv","createCipheriv","Decipher","createDecipher","Decipheriv","createDecipheriv","getCiphers","listCiphers"].forEach(function(t){r[t]=s[t]});var o=t("diffie-hellman");["DiffieHellmanGroup","createDiffieHellmanGroup","getDiffieHellman","createDiffieHellman","DiffieHellman"].forEach(function(t){r[t]=o[t]});var a=t("browserify-sign");["createSign","Sign","createVerify","Verify"].forEach(function(t){r[t]=a[t]}),r.createECDH=t("create-ecdh");var f=t("public-encrypt");["publicEncrypt","privateEncrypt","publicDecrypt","privateDecrypt"].forEach(function(t){r[t]=f[t]}),["createCredentials"].forEach(function(t){r[t]=function(){throw new Error(["sorry, "+t+" is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join("\n"))}})},{"browserify-cipher":53,"browserify-sign":83,"browserify-sign/algos":82,"create-ecdh":150,"create-hash":176,"create-hmac":189,"diffie-hellman":190,pbkdf2:197,"public-encrypt":198,randombytes:243}],53:[function(t,e,r){function n(t,e){var r,n;if(t=t.toLowerCase(),d[t])r=d[t].key,n=d[t].iv;else{if(!h[t])throw new TypeError("invalid suite type");r=8*h[t].key,n=h[t].iv}var i=f(e,!1,r,n);return s(t,i.key,i.iv)}function i(t,e){var r,n;if(t=t.toLowerCase(),d[t])r=d[t].key,n=d[t].iv;else{if(!h[t])throw new TypeError("invalid suite type");r=8*h[t].key,n=h[t].iv}var i=f(e,!1,r,n);return o(t,i.key,i.iv)}function s(t,e,r){if(t=t.toLowerCase(),d[t])return u.createCipheriv(t,e,r);if(h[t])return new c({key:e,iv:r,mode:t});throw new TypeError("invalid suite type")}function o(t,e,r){if(t=t.toLowerCase(),d[t])return u.createDecipheriv(t,e,r);if(h[t])return new c({key:e,iv:r,mode:t,decrypt:!0});throw new TypeError("invalid suite type")}function a(){return Object.keys(h).concat(u.getCiphers())}var f=t("evp_bytestokey"),u=t("browserify-aes/browser"),c=t("browserify-des"),h=t("browserify-des/modes"),d=t("browserify-aes/modes");r.createCipher=r.Cipher=n,r.createCipheriv=r.Cipheriv=s,r.createDecipher=r.Decipher=i,r.createDecipheriv=r.Decipheriv=o,r.listCiphers=r.getCiphers=a},{"browserify-aes/browser":56,"browserify-aes/modes":60,"browserify-des":71,"browserify-des/modes":72,evp_bytestokey:81}],54:[function(t,e,r){(function(t){function e(t){var e,r;return e=t>a||0>t?(r=Math.abs(t)%a,0>t?a-r:r):t}function n(t){for(var e=0;et;e=++t)128>e?r.push(e<<1):r.push(e<<1^283);return r}(),i=0,f=0,e=u=0;256>u;e=++u)r=f^f<<1^f<<2^f<<3^f<<4,r=r>>>8^255&r^99,this.SBOX[i]=r,this.INV_SBOX[r]=i,s=t[i],o=t[s],a=t[o],n=257*t[r]^16843008*r,this.SUB_MIX[0][i]=n<<24|n>>>8,this.SUB_MIX[1][i]=n<<16|n>>>16,this.SUB_MIX[2][i]=n<<8|n>>>24,this.SUB_MIX[3][i]=n,n=16843009*a^65537*o^257*s^16843008*i,this.INV_SUB_MIX[0][r]=n<<24|n>>>8,this.INV_SUB_MIX[1][r]=n<<16|n>>>16,this.INV_SUB_MIX[2][r]=n<<8|n>>>24,this.INV_SUB_MIX[3][r]=n,0===i?i=f=1:(i=s^t[t[t[a^s]]],f^=t[t[f]]);return!0};var f=new i;o.blockSize=16,o.prototype.blockSize=o.blockSize,o.keySize=32,o.prototype.keySize=o.keySize,o.prototype._doReset=function(){var t,e,r,n,i,s;for(r=this._key,e=r.length,this._nRounds=e+6,i=4*(this._nRounds+1),this._keySchedule=[],n=0;i>n;n++)this._keySchedule[n]=e>n?r[n]:(s=this._keySchedule[n-1],n%e===0?(s=s<<8|s>>>24,s=f.SBOX[s>>>24]<<24|f.SBOX[s>>>16&255]<<16|f.SBOX[s>>>8&255]<<8|f.SBOX[255&s],s^=f.RCON[n/e|0]<<24):e>6&&n%e===4?s=f.SBOX[s>>>24]<<24|f.SBOX[s>>>16&255]<<16|f.SBOX[s>>>8&255]<<8|f.SBOX[255&s]:void 0,this._keySchedule[n-e]^s);for(this._invKeySchedule=[],t=0;i>t;t++)n=i-t,s=this._keySchedule[n-(t%4?0:4)],this._invKeySchedule[t]=4>t||4>=n?s:f.INV_SUB_MIX[0][f.SBOX[s>>>24]]^f.INV_SUB_MIX[1][f.SBOX[s>>>16&255]]^f.INV_SUB_MIX[2][f.SBOX[s>>>8&255]]^f.INV_SUB_MIX[3][f.SBOX[255&s]];return!0},o.prototype.encryptBlock=function(e){e=s(new t(e));var r=this._doCryptBlock(e,this._keySchedule,f.SUB_MIX,f.SBOX),n=new t(16);return n.writeUInt32BE(r[0],0),n.writeUInt32BE(r[1],4),n.writeUInt32BE(r[2],8),n.writeUInt32BE(r[3],12),n},o.prototype.decryptBlock=function(e){e=s(new t(e));var r=[e[3],e[1]];e[1]=r[0],e[3]=r[1];var n=this._doCryptBlock(e,this._invKeySchedule,f.INV_SUB_MIX,f.INV_SBOX),i=new t(16);return i.writeUInt32BE(n[0],0),i.writeUInt32BE(n[3],4),i.writeUInt32BE(n[2],8),i.writeUInt32BE(n[1],12),i},o.prototype.scrub=function(){n(this._keySchedule),n(this._invKeySchedule),n(this._key)},o.prototype._doCryptBlock=function(t,r,n,i){var s,o,a,f,u,c,h,d,p;o=t[0]^r[0],a=t[1]^r[1],f=t[2]^r[2],u=t[3]^r[3],s=4;for(var l=1;l>>24]^n[1][a>>>16&255]^n[2][f>>>8&255]^n[3][255&u]^r[s++],h=n[0][a>>>24]^n[1][f>>>16&255]^n[2][u>>>8&255]^n[3][255&o]^r[s++],d=n[0][f>>>24]^n[1][u>>>16&255]^n[2][o>>>8&255]^n[3][255&a]^r[s++],p=n[0][u>>>24]^n[1][o>>>16&255]^n[2][a>>>8&255]^n[3][255&f]^r[s++],o=c,a=h,f=d,u=p;return c=(i[o>>>24]<<24|i[a>>>16&255]<<16|i[f>>>8&255]<<8|i[255&u])^r[s++],h=(i[a>>>24]<<24|i[f>>>16&255]<<16|i[u>>>8&255]<<8|i[255&o])^r[s++],d=(i[f>>>24]<<24|i[u>>>16&255]<<16|i[o>>>8&255]<<8|i[255&a])^r[s++],p=(i[u>>>24]<<24|i[o>>>16&255]<<16|i[a>>>8&255]<<8|i[255&f])^r[s++],[e(c),e(h),e(d),e(p)]},r.AES=o}).call(this,t("buffer").Buffer)},{buffer:48}],55:[function(t,e,r){(function(r){function n(t,e,i,a){if(!(this instanceof n))return new n(t,e,i);o.call(this),this._finID=r.concat([i,new r([0,0,0,1])]),i=r.concat([i,new r([0,0,0,2])]),this._cipher=new s.AES(e),this._prev=new r(i.length),this._cache=new r(""),this._secCache=new r(""),this._decrypt=a,this._alen=0,this._len=0,i.copy(this._prev),this._mode=t;var u=new r(4);u.fill(0),this._ghash=new f(this._cipher.encryptBlock(u)),this._authTag=null,this._called=!1}function i(t,e){var r=0;t.length!==e.length&&r++;for(var n=Math.min(t.length,e.length),i=-1;++ie&&(e=new r(e),e.fill(0),this._ghash.update(e))}this._called=!0;var n=this._mode.encrypt(this,t);return this._decrypt?this._ghash.update(t):this._ghash.update(n),this._len+=t.length,n},n.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var t=u(this._ghash["final"](8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt){if(i(t,this._authTag))throw new Error("Unsupported state or unable to authenticate data")}else this._authTag=t;this._cipher.scrub()},n.prototype.getAuthTag=function(){if(!this._decrypt&&r.isBuffer(this._authTag))return this._authTag;throw new Error("Attempting to get auth tag in unsupported state")},n.prototype.setAuthTag=function(t){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=t},n.prototype.setAAD=function(t){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(t),this._alen+=t.length}}).call(this,t("buffer").Buffer)},{"./aes":54,"./ghash":59,buffer:48,"buffer-xor":68,"cipher-base":69,inherits:296}],56:[function(t,e,r){function n(){return Object.keys(o)}var i=t("./encrypter");r.createCipher=r.Cipher=i.createCipher,r.createCipheriv=r.Cipheriv=i.createCipheriv;var s=t("./decrypter");r.createDecipher=r.Decipher=s.createDecipher,r.createDecipheriv=r.Decipheriv=s.createDecipheriv;var o=t("./modes");r.listCiphers=r.getCiphers=n},{"./decrypter":57,"./encrypter":58,"./modes":60}],57:[function(t,e,r){(function(e){function n(t,r,s){return this instanceof n?(u.call(this),this._cache=new i,this._last=void 0,this._cipher=new f.AES(r),this._prev=new e(s.length),s.copy(this._prev),this._mode=t,void(this._autopadding=!0)):new n(t,r,s)}function i(){return this instanceof i?void(this.cache=new e("")):new i}function s(t){for(var e=t[15],r=-1;++r16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e}else if(this.cache.length>=16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e;return null},i.prototype.flush=function(){return this.cache.length?this.cache:void 0};var b={ECB:t("./modes/ecb"),CBC:t("./modes/cbc"),CFB:t("./modes/cfb"),CFB8:t("./modes/cfb8"),CFB1:t("./modes/cfb1"),OFB:t("./modes/ofb"),CTR:t("./modes/ctr"),GCM:t("./modes/ctr")};r.createDecipher=a,r.createDecipheriv=o}).call(this,t("buffer").Buffer)},{"./aes":54,"./authCipher":55,"./modes":60,"./modes/cbc":61,"./modes/cfb":62,"./modes/cfb1":63,"./modes/cfb8":64,"./modes/ctr":65,"./modes/ecb":66,"./modes/ofb":67,"./streamCipher":70,buffer:48,"cipher-base":69,evp_bytestokey:81,inherits:296}],58:[function(t,e,r){(function(e){function n(t,r,s){return this instanceof n?(f.call(this),this._cache=new i,this._cipher=new a.AES(r),this._prev=new e(s.length),s.copy(this._prev),this._mode=t,void(this._autopadding=!0)):new n(t,r,s)}function i(){return this instanceof i?void(this.cache=new e("")):new i}function s(t,r,i){var s=c[t.toLowerCase()];if(!s)throw new TypeError("invalid suite type");if("string"==typeof i&&(i=new e(i)),"string"==typeof r&&(r=new e(r)),r.length!==s.key/8)throw new TypeError("invalid key length "+r.length);if(i.length!==s.iv)throw new TypeError("invalid iv length "+i.length);return"stream"===s.type?new d(l[s.mode],r,i):"auth"===s.type?new p(l[s.mode],r,i):new n(l[s.mode],r,i)}function o(t,e){var r=c[t.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var n=h(e,!1,r.key,r.iv);return s(t,n.key,n.iv)}var a=t("./aes"),f=t("cipher-base"),u=t("inherits"),c=t("./modes"),h=t("evp_bytestokey"),d=t("./streamCipher"),p=t("./authCipher");u(n,f),n.prototype._update=function(t){this._cache.add(t);for(var r,n,i=[];r=this._cache.get();)n=this._mode.encrypt(this,r),i.push(n);return e.concat(i)},n.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return t=this._mode.encrypt(this,t),this._cipher.scrub(),t;if("10101010101010101010101010101010"!==t.toString("hex"))throw this._cipher.scrub(),new Error("data not multiple of block length")},n.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this},i.prototype.add=function(t){this.cache=e.concat([this.cache,t])},i.prototype.get=function(){if(this.cache.length>15){var t=this.cache.slice(0,16);return this.cache=this.cache.slice(16),t}return null},i.prototype.flush=function(){for(var t=16-this.cache.length,r=new e(t),n=-1;++nf||0>t?(r=Math.abs(t)%f,0>t?f-r:r):t}function o(t,e){return[t[0]^e[0],t[1]^e[1],t[2]^e[2],t[3]^e[3]]}var a=new t(16);a.fill(0),e.exports=r,r.prototype.ghash=function(t){for(var e=-1;++e0;t--)s[t]=s[t]>>>1|(1&s[t-1])<<31;s[0]=s[0]>>>1,r&&(s[0]=s[0]^225<<24)}this.state=i(a)},r.prototype.update=function(e){this.cache=t.concat([this.cache,e]);for(var r;this.cache.length>=16;)r=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(r)},r.prototype["final"]=function(e,r){return this.cache.length&&this.ghash(t.concat([this.cache,a],16)),this.ghash(i([0,e,0,r])),this.state};var f=Math.pow(2,32)}).call(this,t("buffer").Buffer)},{buffer:48}],60:[function(t,e,r){r["aes-128-ecb"]={cipher:"AES",key:128,iv:0,mode:"ECB",type:"block"},r["aes-192-ecb"]={cipher:"AES",key:192,iv:0,mode:"ECB",type:"block"},r["aes-256-ecb"]={cipher:"AES",key:256,iv:0,mode:"ECB",type:"block"},r["aes-128-cbc"]={cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},r["aes-192-cbc"]={cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},r["aes-256-cbc"]={cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},r.aes128=r["aes-128-cbc"],r.aes192=r["aes-192-cbc"],r.aes256=r["aes-256-cbc"],r["aes-128-cfb"]={cipher:"AES",key:128,iv:16,mode:"CFB",type:"stream"},r["aes-192-cfb"]={cipher:"AES",key:192,iv:16,mode:"CFB",type:"stream"},r["aes-256-cfb"]={cipher:"AES",key:256,iv:16,mode:"CFB",type:"stream"}, r["aes-128-cfb8"]={cipher:"AES",key:128,iv:16,mode:"CFB8",type:"stream"},r["aes-192-cfb8"]={cipher:"AES",key:192,iv:16,mode:"CFB8",type:"stream"},r["aes-256-cfb8"]={cipher:"AES",key:256,iv:16,mode:"CFB8",type:"stream"},r["aes-128-cfb1"]={cipher:"AES",key:128,iv:16,mode:"CFB1",type:"stream"},r["aes-192-cfb1"]={cipher:"AES",key:192,iv:16,mode:"CFB1",type:"stream"},r["aes-256-cfb1"]={cipher:"AES",key:256,iv:16,mode:"CFB1",type:"stream"},r["aes-128-ofb"]={cipher:"AES",key:128,iv:16,mode:"OFB",type:"stream"},r["aes-192-ofb"]={cipher:"AES",key:192,iv:16,mode:"OFB",type:"stream"},r["aes-256-ofb"]={cipher:"AES",key:256,iv:16,mode:"OFB",type:"stream"},r["aes-128-ctr"]={cipher:"AES",key:128,iv:16,mode:"CTR",type:"stream"},r["aes-192-ctr"]={cipher:"AES",key:192,iv:16,mode:"CTR",type:"stream"},r["aes-256-ctr"]={cipher:"AES",key:256,iv:16,mode:"CTR",type:"stream"},r["aes-128-gcm"]={cipher:"AES",key:128,iv:12,mode:"GCM",type:"auth"},r["aes-192-gcm"]={cipher:"AES",key:192,iv:12,mode:"GCM",type:"auth"},r["aes-256-gcm"]={cipher:"AES",key:256,iv:12,mode:"GCM",type:"auth"}},{}],61:[function(t,e,r){var n=t("buffer-xor");r.encrypt=function(t,e){var r=n(e,t._prev);return t._prev=t._cipher.encryptBlock(r),t._prev},r.decrypt=function(t,e){var r=t._prev;t._prev=e;var i=t._cipher.decryptBlock(e);return n(i,r)}},{"buffer-xor":68}],62:[function(t,e,r){(function(e){function n(t,r,n){var s=r.length,o=i(r,t._cache);return t._cache=t._cache.slice(s),t._prev=e.concat([t._prev,n?r:o]),o}var i=t("buffer-xor");r.encrypt=function(t,r,i){for(var s,o=new e("");r.length;){if(0===t._cache.length&&(t._cache=t._cipher.encryptBlock(t._prev),t._prev=new e("")),!(t._cache.length<=r.length)){o=e.concat([o,n(t,r,i)]);break}s=t._cache.length,o=e.concat([o,n(t,r.slice(0,s),i)]),r=r.slice(s)}return o}}).call(this,t("buffer").Buffer)},{buffer:48,"buffer-xor":68}],63:[function(t,e,r){(function(t){function e(t,e,r){for(var i,s,o,a=-1,f=8,u=0;++a>a%8,t._prev=n(t._prev,r?s:o);return u}function n(e,r){var n=e.length,i=-1,s=new t(e.length);for(e=t.concat([e,new t([r])]);++i>7;return s}r.encrypt=function(r,n,i){for(var s=n.length,o=new t(s),a=-1;++as;++s)i[s]=e[s]^r[s];return i}}).call(this,t("buffer").Buffer)},{buffer:48}],69:[function(t,e,r){(function(r){function n(t){i.call(this),this.hashMode="string"==typeof t,this.hashMode?this[t]=this._finalOrDigest:this["final"]=this._finalOrDigest,this._decoder=null,this._encoding=null}var i=t("stream").Transform,s=t("inherits"),o=t("string_decoder").StringDecoder;e.exports=n,s(n,i),n.prototype.update=function(t,e,n){"string"==typeof t&&(t=new r(t,e));var i=this._update(t);return this.hashMode?this:(n&&(i=this._toString(i,n)),i)},n.prototype.setAutoPadding=function(){},n.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},n.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},n.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},n.prototype._transform=function(t,e,r){var n;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(i){n=i}finally{r(n)}},n.prototype._flush=function(t){var e;try{this.push(this._final())}catch(r){e=r}finally{t(e)}},n.prototype._finalOrDigest=function(t){var e=this._final()||new r("");return t&&(e=this._toString(e,t,!0)),e},n.prototype._toString=function(t,e,r){if(this._decoder||(this._decoder=new o(e),this._encoding=e),this._encoding!==e)throw new Error("can't switch encodings");var n=this._decoder.write(t);return r&&(n+=this._decoder.end()),n}}).call(this,t("buffer").Buffer)},{buffer:48,inherits:296,stream:265,string_decoder:266}],70:[function(t,e,r){(function(r){function n(t,e,o,a){return this instanceof n?(s.call(this),this._cipher=new i.AES(e),this._prev=new r(o.length),this._cache=new r(""),this._secCache=new r(""),this._decrypt=a,o.copy(this._prev),void(this._mode=t)):new n(t,e,o)}var i=t("./aes"),s=t("cipher-base"),o=t("inherits");o(n,s),e.exports=n,n.prototype._update=function(t){return this._mode.encrypt(this,t,this._decrypt)},n.prototype._final=function(){this._cipher.scrub()}}).call(this,t("buffer").Buffer)},{"./aes":54,buffer:48,"cipher-base":69,inherits:296}],71:[function(t,e,r){(function(r){function n(t){i.call(this);var e,n=t.mode.toLowerCase(),s=a[n];e=t.decrypt?"decrypt":"encrypt";var o=t.key;("des-ede"===n||"des-ede-cbc"===n)&&(o=r.concat([o,o.slice(0,8)]));var f=t.iv;this._des=s.create({key:o,iv:f,type:e})}var i=t("cipher-base"),s=t("des.js"),o=t("inherits"),a={"des-ede3-cbc":s.CBC.instantiate(s.EDE),"des-ede3":s.EDE,"des-ede-cbc":s.CBC.instantiate(s.EDE),"des-ede":s.EDE,"des-cbc":s.CBC.instantiate(s.DES),"des-ecb":s.DES};a.des=a["des-cbc"],a.des3=a["des-ede3-cbc"],e.exports=n,o(n,i),n.prototype._update=function(t){return new r(this._des.update(t))},n.prototype._final=function(){return new r(this._des["final"]())}}).call(this,t("buffer").Buffer)},{buffer:48,"cipher-base":73,"des.js":74,inherits:296}],72:[function(t,e,r){r["des-ecb"]={key:8,iv:0},r["des-cbc"]=r.des={key:8,iv:8},r["des-ede3-cbc"]=r.des3={key:24,iv:8},r["des-ede3"]={key:24,iv:0},r["des-ede-cbc"]={key:16,iv:8},r["des-ede"]={key:16,iv:0}},{}],73:[function(t,e,r){arguments[4][69][0].apply(r,arguments)},{buffer:48,dup:69,inherits:296,stream:265,string_decoder:266}],74:[function(t,e,r){"use strict";r.utils=t("./des/utils"),r.Cipher=t("./des/cipher"),r.DES=t("./des/des"),r.CBC=t("./des/cbc"),r.EDE=t("./des/ede")},{"./des/cbc":75,"./des/cipher":76,"./des/des":77,"./des/ede":78,"./des/utils":79}],75:[function(t,e,r){"use strict";function n(t){s.equal(t.length,8,"Invalid IV length"),this.iv=new Array(8);for(var e=0;en;n++)this.buffer[this.bufferOff+n]=t[e+n];return this.bufferOff+=r,r},n.prototype._flushBuffer=function(t,e){return this._update(this.buffer,0,t,e),this.bufferOff=0,this.blockSize},n.prototype._updateEncrypt=function(t){var e=0,r=0,n=(this.bufferOff+t.length)/this.blockSize|0,i=new Array(n*this.blockSize);0!==this.bufferOff&&(e+=this._buffer(t,e),this.bufferOff===this.buffer.length&&(r+=this._flushBuffer(i,r)));for(var s=t.length-(t.length-e)%this.blockSize;s>e;e+=this.blockSize)this._update(t,e,i,r),r+=this.blockSize;for(;e0;n--)e+=this._buffer(t,e),r+=this._flushBuffer(i,r);return e+=this._buffer(t,e),i},n.prototype["final"]=function(t){var e;t&&(e=this.update(t));var r;return r="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),e?e.concat(r):r},n.prototype._pad=function(t,e){if(0===e)return!1;for(;e>>1];r=f.r28shl(r,o),n=f.r28shl(n,o),f.pc2(r,n,t.keys,i)}},i.prototype._update=function(t,e,r,n){var i=this._desState,s=f.readUInt32BE(t,e),o=f.readUInt32BE(t,e+4);f.ip(s,o,i.tmp,0),s=i.tmp[0],o=i.tmp[1],"encrypt"===this.type?this._encrypt(i,s,o,i.tmp,0):this._decrypt(i,s,o,i.tmp,0),s=i.tmp[0],o=i.tmp[1],f.writeUInt32BE(r,s,n),f.writeUInt32BE(r,o,n+4)},i.prototype._pad=function(t,e){for(var r=t.length-e,n=e;n>>0,s=p}f.rip(o,s,n,i)},i.prototype._decrypt=function(t,e,r,n,i){for(var s=r,o=e,a=t.keys.length-2;a>=0;a-=2){var u=t.keys[a],c=t.keys[a+1];f.expand(s,t.tmp,0),u^=t.tmp[0],c^=t.tmp[1];var h=f.substitute(u,c),d=f.permute(h),p=s;s=(o^d)>>>0,o=p}f.rip(s,o,n,i)}},{"../des":74,inherits:296,"minimalistic-assert":80}],78:[function(t,e,r){"use strict";function n(t,e){s.equal(e.length,24,"Invalid key length");var r=e.slice(0,8),n=e.slice(8,16),i=e.slice(16,24);"encrypt"===t?this.ciphers=[u.create({type:"encrypt",key:r}),u.create({type:"decrypt",key:n}),u.create({type:"encrypt",key:i})]:this.ciphers=[u.create({type:"decrypt",key:i}),u.create({type:"encrypt",key:n}),u.create({type:"decrypt",key:r})]}function i(t){f.call(this,t);var e=new n(this.type,this.options.key);this._edeState=e}var s=t("minimalistic-assert"),o=t("inherits"),a=t("../des"),f=a.Cipher,u=a.DES;o(i,f),e.exports=i,i.create=function(t){return new i(t)},i.prototype._update=function(t,e,r,n){var i=this._edeState;i.ciphers[0]._update(t,e,r,n),i.ciphers[1]._update(r,n,r,n),i.ciphers[2]._update(r,n,r,n)},i.prototype._pad=u.prototype._pad,i.prototype._unpad=u.prototype._unpad},{"../des":74,inherits:296,"minimalistic-assert":80}],79:[function(t,e,r){"use strict";r.readUInt32BE=function(t,e){var r=t[0+e]<<24|t[1+e]<<16|t[2+e]<<8|t[3+e];return r>>>0},r.writeUInt32BE=function(t,e,r){t[0+r]=e>>>24,t[1+r]=e>>>16&255,t[2+r]=e>>>8&255,t[3+r]=255&e},r.ip=function(t,e,r,n){for(var i=0,s=0,o=6;o>=0;o-=2){for(var a=0;24>=a;a+=8)i<<=1,i|=e>>>a+o&1;for(var a=0;24>=a;a+=8)i<<=1,i|=t>>>a+o&1}for(var o=6;o>=0;o-=2){for(var a=1;25>=a;a+=8)s<<=1,s|=e>>>a+o&1;for(var a=1;25>=a;a+=8)s<<=1,s|=t>>>a+o&1}r[n+0]=i>>>0,r[n+1]=s>>>0},r.rip=function(t,e,r,n){for(var i=0,s=0,o=0;4>o;o++)for(var a=24;a>=0;a-=8)i<<=1,i|=e>>>a+o&1,i<<=1,i|=t>>>a+o&1;for(var o=4;8>o;o++)for(var a=24;a>=0;a-=8)s<<=1,s|=e>>>a+o&1,s<<=1,s|=t>>>a+o&1;r[n+0]=i>>>0,r[n+1]=s>>>0},r.pc1=function(t,e,r,n){for(var i=0,s=0,o=7;o>=5;o--){for(var a=0;24>=a;a+=8)i<<=1,i|=e>>a+o&1;for(var a=0;24>=a;a+=8)i<<=1,i|=t>>a+o&1}for(var a=0;24>=a;a+=8)i<<=1,i|=e>>a+o&1;for(var o=1;3>=o;o++){for(var a=0;24>=a;a+=8)s<<=1,s|=e>>a+o&1;for(var a=0;24>=a;a+=8)s<<=1,s|=t>>a+o&1}for(var a=0;24>=a;a+=8)s<<=1,s|=t>>a+o&1;r[n+0]=i>>>0,r[n+1]=s>>>0},r.r28shl=function(t,e){return t<>>28-e};var n=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];r.pc2=function(t,e,r,i){for(var s=0,o=0,a=n.length>>>1,f=0;a>f;f++)s<<=1,s|=t>>>n[f]&1;for(var f=a;f>>n[f]&1;r[i+0]=s>>>0,r[i+1]=o>>>0},r.expand=function(t,e,r){var n=0,i=0;n=(1&t)<<5|t>>>27;for(var s=23;s>=15;s-=4)n<<=6,n|=t>>>s&63;for(var s=11;s>=3;s-=4)i|=t>>>s&63,i<<=6;i|=(31&t)<<1|t>>>31,e[r+0]=n>>>0,e[r+1]=i>>>0};var i=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];r.substitute=function(t,e){for(var r=0,n=0;4>n;n++){var s=t>>>18-6*n&63,o=i[64*n+s];r<<=4,r|=o}for(var n=0;4>n;n++){var s=e>>>18-6*n&63,o=i[256+64*n+s];r<<=4,r|=o}return r>>>0};var s=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];r.permute=function(t){for(var e=0,r=0;r>>s[r]&1;return e>>>0},r.padSplit=function(t,e,r){for(var n=t.toString(2);n.lengths;s+=r)i.push(n.slice(s,s+r));return i.join(" ")}},{}],80:[function(t,e,r){function n(t,e){if(!t)throw new Error(e||"Assertion failed")}e.exports=n,n.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)}},{}],81:[function(t,e,r){(function(r){function n(t,e,n,s){r.isBuffer(t)||(t=new r(t,"binary")),e&&!r.isBuffer(e)&&(e=new r(e,"binary")),n/=8,s=s||0;for(var o,a,f=0,u=0,c=new r(n),h=new r(s),d=0,p=[];;){if(d++>0&&p.push(o),p.push(t),e&&p.push(e),o=i(r.concat(p)),p=[],a=0,n>0)for(;;){if(0===n)break;if(a===o.length)break;c[f++]=o[a],n--,a++}if(s>0&&a!==o.length)for(;;){if(0===s)break;if(a===o.length)break;h[u++]=o[a],s--,a++}if(0===n&&0===s)break}for(a=0;as;s++){var o=t.charCodeAt(s)-48;n<<=4,n|=o>=49&&54>=o?o-49+10:o>=17&&22>=o?o-17+10:15&o}return n}function a(t,e,r,n){for(var i=0,s=Math.min(t.length,r),o=e;s>o;o++){var a=t.charCodeAt(o)-48;i*=n,i+=a>=49?a-49+10:a>=17?a-17+10:a}return i}function f(t){for(var e=new Array(t.bitLength()),r=0;r>>i}return e}function u(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],s=0|e.words[0],o=i*s,a=67108863&o,f=o/67108864|0;r.words[0]=a;for(var u=1;n>u;u++){for(var c=f>>>26,h=67108863&f,d=Math.min(u,e.length-1),p=Math.max(0,u-t.length+1);d>=p;p++){var l=u-p|0;i=0|t.words[l],s=0|e.words[p],o=i*s+h,c+=o/67108864|0,h=67108863&o}r.words[u]=0|h,f=0|c}return 0!==f?r.words[u]=0|f:r.length--,r.strip()}function c(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,s=0;s=u;u++){var c=s-u,h=0|t.words[c],d=0|e.words[u],p=h*d,l=67108863&p;o=o+(p/67108864|0)|0,l=l+a|0,a=67108863&l,o=o+(l>>>26)|0,i+=o>>>26,o&=67108863}r.words[s]=a,n=o,o=i}return 0!==n?r.words[s]=n:r.length--,r.strip()}function h(t,e,r){var n=new d;return n.mulp(t,e,r)}function d(t,e){this.x=t,this.y=e}function p(t,e){this.name=t,this.p=new s(e,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function l(){p.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){p.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function g(){p.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function m(){p.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function y(t){if("string"==typeof t){var e=s._prime(t);this.m=e.p,this.prime=e}else this.m=t,this.prime=null}function v(t){y.call(this,t),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}"object"==typeof e?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var _;try{_=t("buffer").Buffer}catch(w){}s.max=function(t,e){return t.cmp(e)>0?t:e},s.min=function(t,e){return t.cmp(e)<0?t:e},s.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&36>=e),t=t.toString().replace(/\s+/g,"");var i=0;"-"===t[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},s.prototype._initNumber=function(t,e,r){0>t&&(this.negative=1,t=-t),67108864>t?(this.words=[67108863&t],this.length=1):4503599627370496>t?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(9007199254740992>t),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},s.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[s]|=o<>>26-a&67108863,a+=24,a>=26&&(a-=26,s++);else if("le"===r)for(i=0,s=0;i>>26-a&67108863,a+=24,a>=26&&(a-=26,s++);return this.strip()},s.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)i=o(t,r,r+6),this.words[n]|=i<>>26-s&4194303,s+=24,s>=26&&(s-=26,n++);r+6!==e&&(i=o(t,e,r+6),this.words[n]|=i<>>26-s&4194303),this.strip()},s.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;67108863>=i;i*=e)n++;n--,i=i/e|0;for(var s=t.length-r,o=s%n,f=Math.min(s,s-o)+r,u=0,c=r;f>c;c+=n)u=a(t,c,c+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==o){var h=1;for(u=a(t,c,t.length,e),c=0;o>c;c++)h*=e;this.imuln(h),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}},s.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e1&&0===this.words[this.length-1];)this.length--;return this._normSign()},s.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?""};var S=["","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"],I=[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],k=[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];s.prototype.toString=function(t,e){t=t||10,e=0|e||1;var r;if(16===t||"hex"===t){r="";for(var i=0,s=0,o=0;o>>24-i&16777215,r=0!==s||o!==this.length-1?S[6-f.length]+f+r:f+r,i+=2,i>=26&&(i-=26,o--)}for(0!==s&&(r=s.toString(16)+r);r.length%e!==0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&36>=t){var u=I[t],c=k[t];r="";var h=this.clone();for(h.negative=0;!h.isZero();){var d=h.modn(c).toString(t);h=h.idivn(c),r=h.isZero()?d+r:S[u-d.length]+d+r}for(this.isZero()&&(r="0"+r);r.length%e!==0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var t,e=this.bitLength();return 26>=e?t=this.words[0]:52>=e?t=67108864*this.words[1]+this.words[0]:53===e?t=4503599627370496+67108864*this.words[1]+this.words[0]:n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(t,e){return n("undefined"!=typeof _),new _(this.toArray(t,e))},s.prototype.toArray=function(t,e){var r=this.byteLength(),i=e||Math.max(1,r);n(i>=r,"byte array longer than desired length"),n(i>0,"Requested array length <= 0"),this.strip();var s,o,a="le"===t,f=new Array(i),u=this.clone();if(a){for(o=0;!u.isZero();o++)s=u.andln(255),u.iushrn(8),f[o]=s;for(;i>o;o++)f[o]=0}else{for(o=0;i-r>o;o++)f[o]=0;for(o=0;!u.isZero();o++)s=u.andln(255),u.iushrn(8),f[i-o-1]=s}return f},Math.clz32?s.prototype._countBits=function(t){return 32-Math.clz32(t)}:s.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},s.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},s.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},s.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},s.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)},s.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},s.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)},s.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},s.prototype.inotn=function(t){n("number"==typeof t&&t>=0);for(var e=0|Math.ceil(t/26),r=t%26;this.length0&&e--;for(var i=0;e>i;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},s.prototype.notn=function(t){return this.clone().inotn(t)},s.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);for(var r=t/26|0,i=t%26;this.length<=r;)this.words[this.length++]=0;return e?this.words[r]=this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,s=0;s>>26;for(;0!==i&&s>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;st.length?this.clone().iadd(t):t.clone().iadd(this)},s.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=this.cmp(t);if(0===r)return this.negative=0,this.length=1,this.words[0]=0,this;var n,i;r>0?(n=this,i=t):(n=t,i=this);for(var s=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==s&&o>26,this.words[o]=67108863&e;if(0===s&&o>>13,p=0|o[1],l=8191&p,b=p>>>13,g=0|o[2],m=8191&g,y=g>>>13,v=0|o[3],_=8191&v,w=v>>>13,S=0|o[4],I=8191&S,k=S>>>13,E=0|o[5],A=8191&E,x=E>>>13,P=0|o[6],O=8191&P,B=P>>>13,M=0|o[7],R=8191&M,T=M>>>13,C=0|o[8],N=8191&C,j=C>>>13,U=0|o[9],L=8191&U,D=U>>>13,z=0|a[0],F=8191&z,K=z>>>13,H=0|a[1],q=8191&H,V=H>>>13,Y=0|a[2],G=8191&Y,W=Y>>>13,X=0|a[3],J=8191&X,Z=X>>>13,Q=0|a[4],$=8191&Q,tt=Q>>>13,et=0|a[5],rt=8191&et,nt=et>>>13,it=0|a[6],st=8191&it,ot=it>>>13,at=0|a[7],ft=8191&at,ut=at>>>13,ct=0|a[8],ht=8191&ct,dt=ct>>>13,pt=0|a[9],lt=8191&pt,bt=pt>>>13;r.negative=t.negative^e.negative,r.length=19,n=Math.imul(h,F),i=Math.imul(h,K),i+=Math.imul(d,F),s=Math.imul(d,K);var gt=u+n+((8191&i)<<13);u=s+(i>>>13)+(gt>>>26),gt&=67108863,n=Math.imul(l,F),i=Math.imul(l,K),i+=Math.imul(b,F),s=Math.imul(b,K),n+=Math.imul(h,q),i+=Math.imul(h,V),i+=Math.imul(d,q),s+=Math.imul(d,V);var mt=u+n+((8191&i)<<13);u=s+(i>>>13)+(mt>>>26),mt&=67108863,n=Math.imul(m,F),i=Math.imul(m,K),i+=Math.imul(y,F),s=Math.imul(y,K),n+=Math.imul(l,q),i+=Math.imul(l,V),i+=Math.imul(b,q),s+=Math.imul(b,V),n+=Math.imul(h,G),i+=Math.imul(h,W),i+=Math.imul(d,G),s+=Math.imul(d,W);var yt=u+n+((8191&i)<<13);u=s+(i>>>13)+(yt>>>26),yt&=67108863,n=Math.imul(_,F),i=Math.imul(_,K),i+=Math.imul(w,F),s=Math.imul(w,K),n+=Math.imul(m,q),i+=Math.imul(m,V),i+=Math.imul(y,q),s+=Math.imul(y,V),n+=Math.imul(l,G),i+=Math.imul(l,W),i+=Math.imul(b,G),s+=Math.imul(b,W),n+=Math.imul(h,J),i+=Math.imul(h,Z),i+=Math.imul(d,J),s+=Math.imul(d,Z);var vt=u+n+((8191&i)<<13);u=s+(i>>>13)+(vt>>>26),vt&=67108863,n=Math.imul(I,F),i=Math.imul(I,K),i+=Math.imul(k,F),s=Math.imul(k,K),n+=Math.imul(_,q),i+=Math.imul(_,V),i+=Math.imul(w,q),s+=Math.imul(w,V),n+=Math.imul(m,G),i+=Math.imul(m,W),i+=Math.imul(y,G),s+=Math.imul(y,W),n+=Math.imul(l,J),i+=Math.imul(l,Z),i+=Math.imul(b,J),s+=Math.imul(b,Z),n+=Math.imul(h,$),i+=Math.imul(h,tt),i+=Math.imul(d,$),s+=Math.imul(d,tt);var _t=u+n+((8191&i)<<13);u=s+(i>>>13)+(_t>>>26),_t&=67108863,n=Math.imul(A,F),i=Math.imul(A,K),i+=Math.imul(x,F),s=Math.imul(x,K),n+=Math.imul(I,q),i+=Math.imul(I,V),i+=Math.imul(k,q),s+=Math.imul(k,V),n+=Math.imul(_,G),i+=Math.imul(_,W),i+=Math.imul(w,G),s+=Math.imul(w,W),n+=Math.imul(m,J),i+=Math.imul(m,Z),i+=Math.imul(y,J),s+=Math.imul(y,Z),n+=Math.imul(l,$),i+=Math.imul(l,tt),i+=Math.imul(b,$),s+=Math.imul(b,tt),n+=Math.imul(h,rt),i+=Math.imul(h,nt),i+=Math.imul(d,rt),s+=Math.imul(d,nt);var wt=u+n+((8191&i)<<13);u=s+(i>>>13)+(wt>>>26),wt&=67108863,n=Math.imul(O,F),i=Math.imul(O,K),i+=Math.imul(B,F),s=Math.imul(B,K),n+=Math.imul(A,q),i+=Math.imul(A,V),i+=Math.imul(x,q),s+=Math.imul(x,V),n+=Math.imul(I,G),i+=Math.imul(I,W),i+=Math.imul(k,G),s+=Math.imul(k,W),n+=Math.imul(_,J),i+=Math.imul(_,Z),i+=Math.imul(w,J),s+=Math.imul(w,Z),n+=Math.imul(m,$),i+=Math.imul(m,tt),i+=Math.imul(y,$),s+=Math.imul(y,tt),n+=Math.imul(l,rt),i+=Math.imul(l,nt),i+=Math.imul(b,rt),s+=Math.imul(b,nt),n+=Math.imul(h,st),i+=Math.imul(h,ot),i+=Math.imul(d,st),s+=Math.imul(d,ot);var St=u+n+((8191&i)<<13);u=s+(i>>>13)+(St>>>26),St&=67108863,n=Math.imul(R,F),i=Math.imul(R,K),i+=Math.imul(T,F),s=Math.imul(T,K),n+=Math.imul(O,q),i+=Math.imul(O,V),i+=Math.imul(B,q),s+=Math.imul(B,V),n+=Math.imul(A,G),i+=Math.imul(A,W),i+=Math.imul(x,G),s+=Math.imul(x,W),n+=Math.imul(I,J),i+=Math.imul(I,Z),i+=Math.imul(k,J),s+=Math.imul(k,Z),n+=Math.imul(_,$),i+=Math.imul(_,tt),i+=Math.imul(w,$),s+=Math.imul(w,tt),n+=Math.imul(m,rt),i+=Math.imul(m,nt),i+=Math.imul(y,rt),s+=Math.imul(y,nt),n+=Math.imul(l,st),i+=Math.imul(l,ot),i+=Math.imul(b,st),s+=Math.imul(b,ot),n+=Math.imul(h,ft),i+=Math.imul(h,ut),i+=Math.imul(d,ft),s+=Math.imul(d,ut);var It=u+n+((8191&i)<<13);u=s+(i>>>13)+(It>>>26),It&=67108863,n=Math.imul(N,F),i=Math.imul(N,K),i+=Math.imul(j,F),s=Math.imul(j,K),n+=Math.imul(R,q),i+=Math.imul(R,V),i+=Math.imul(T,q),s+=Math.imul(T,V),n+=Math.imul(O,G),i+=Math.imul(O,W),i+=Math.imul(B,G),s+=Math.imul(B,W),n+=Math.imul(A,J),i+=Math.imul(A,Z),i+=Math.imul(x,J),s+=Math.imul(x,Z),n+=Math.imul(I,$),i+=Math.imul(I,tt),i+=Math.imul(k,$),s+=Math.imul(k,tt),n+=Math.imul(_,rt),i+=Math.imul(_,nt),i+=Math.imul(w,rt),s+=Math.imul(w,nt),n+=Math.imul(m,st),i+=Math.imul(m,ot),i+=Math.imul(y,st),s+=Math.imul(y,ot),n+=Math.imul(l,ft),i+=Math.imul(l,ut),i+=Math.imul(b,ft),s+=Math.imul(b,ut),n+=Math.imul(h,ht),i+=Math.imul(h,dt),i+=Math.imul(d,ht),s+=Math.imul(d,dt);var kt=u+n+((8191&i)<<13);u=s+(i>>>13)+(kt>>>26),kt&=67108863,n=Math.imul(L,F),i=Math.imul(L,K),i+=Math.imul(D,F),s=Math.imul(D,K),n+=Math.imul(N,q),i+=Math.imul(N,V),i+=Math.imul(j,q),s+=Math.imul(j,V),n+=Math.imul(R,G),i+=Math.imul(R,W),i+=Math.imul(T,G),s+=Math.imul(T,W),n+=Math.imul(O,J),i+=Math.imul(O,Z),i+=Math.imul(B,J),s+=Math.imul(B,Z),n+=Math.imul(A,$),i+=Math.imul(A,tt),i+=Math.imul(x,$),s+=Math.imul(x,tt),n+=Math.imul(I,rt),i+=Math.imul(I,nt),i+=Math.imul(k,rt),s+=Math.imul(k,nt),n+=Math.imul(_,st),i+=Math.imul(_,ot),i+=Math.imul(w,st),s+=Math.imul(w,ot),n+=Math.imul(m,ft),i+=Math.imul(m,ut),i+=Math.imul(y,ft),s+=Math.imul(y,ut),n+=Math.imul(l,ht),i+=Math.imul(l,dt),i+=Math.imul(b,ht),s+=Math.imul(b,dt),n+=Math.imul(h,lt),i+=Math.imul(h,bt),i+=Math.imul(d,lt),s+=Math.imul(d,bt);var Et=u+n+((8191&i)<<13);u=s+(i>>>13)+(Et>>>26),Et&=67108863,n=Math.imul(L,q),i=Math.imul(L,V),i+=Math.imul(D,q),s=Math.imul(D,V),n+=Math.imul(N,G),i+=Math.imul(N,W),i+=Math.imul(j,G),s+=Math.imul(j,W),n+=Math.imul(R,J),i+=Math.imul(R,Z),i+=Math.imul(T,J),s+=Math.imul(T,Z),n+=Math.imul(O,$),i+=Math.imul(O,tt),i+=Math.imul(B,$),s+=Math.imul(B,tt),n+=Math.imul(A,rt),i+=Math.imul(A,nt),i+=Math.imul(x,rt),s+=Math.imul(x,nt),n+=Math.imul(I,st),i+=Math.imul(I,ot),i+=Math.imul(k,st),s+=Math.imul(k,ot),n+=Math.imul(_,ft),i+=Math.imul(_,ut),i+=Math.imul(w,ft),s+=Math.imul(w,ut),n+=Math.imul(m,ht),i+=Math.imul(m,dt),i+=Math.imul(y,ht),s+=Math.imul(y,dt),n+=Math.imul(l,lt),i+=Math.imul(l,bt),i+=Math.imul(b,lt),s+=Math.imul(b,bt);var At=u+n+((8191&i)<<13);u=s+(i>>>13)+(At>>>26),At&=67108863,n=Math.imul(L,G),i=Math.imul(L,W),i+=Math.imul(D,G),s=Math.imul(D,W),n+=Math.imul(N,J),i+=Math.imul(N,Z),i+=Math.imul(j,J),s+=Math.imul(j,Z),n+=Math.imul(R,$),i+=Math.imul(R,tt),i+=Math.imul(T,$),s+=Math.imul(T,tt),n+=Math.imul(O,rt),i+=Math.imul(O,nt),i+=Math.imul(B,rt),s+=Math.imul(B,nt),n+=Math.imul(A,st),i+=Math.imul(A,ot),i+=Math.imul(x,st),s+=Math.imul(x,ot),n+=Math.imul(I,ft),i+=Math.imul(I,ut),i+=Math.imul(k,ft),s+=Math.imul(k,ut),n+=Math.imul(_,ht),i+=Math.imul(_,dt),i+=Math.imul(w,ht),s+=Math.imul(w,dt),n+=Math.imul(m,lt),i+=Math.imul(m,bt),i+=Math.imul(y,lt),s+=Math.imul(y,bt);var xt=u+n+((8191&i)<<13);u=s+(i>>>13)+(xt>>>26),xt&=67108863,n=Math.imul(L,J),i=Math.imul(L,Z),i+=Math.imul(D,J),s=Math.imul(D,Z),n+=Math.imul(N,$),i+=Math.imul(N,tt),i+=Math.imul(j,$),s+=Math.imul(j,tt),n+=Math.imul(R,rt),i+=Math.imul(R,nt),i+=Math.imul(T,rt),s+=Math.imul(T,nt),n+=Math.imul(O,st),i+=Math.imul(O,ot),i+=Math.imul(B,st),s+=Math.imul(B,ot),n+=Math.imul(A,ft),i+=Math.imul(A,ut),i+=Math.imul(x,ft),s+=Math.imul(x,ut),n+=Math.imul(I,ht),i+=Math.imul(I,dt),i+=Math.imul(k,ht),s+=Math.imul(k,dt),n+=Math.imul(_,lt),i+=Math.imul(_,bt),i+=Math.imul(w,lt),s+=Math.imul(w,bt);var Pt=u+n+((8191&i)<<13);u=s+(i>>>13)+(Pt>>>26),Pt&=67108863,n=Math.imul(L,$),i=Math.imul(L,tt),i+=Math.imul(D,$),s=Math.imul(D,tt),n+=Math.imul(N,rt),i+=Math.imul(N,nt),i+=Math.imul(j,rt),s+=Math.imul(j,nt),n+=Math.imul(R,st),i+=Math.imul(R,ot),i+=Math.imul(T,st),s+=Math.imul(T,ot),n+=Math.imul(O,ft),i+=Math.imul(O,ut),i+=Math.imul(B,ft),s+=Math.imul(B,ut),n+=Math.imul(A,ht),i+=Math.imul(A,dt),i+=Math.imul(x,ht),s+=Math.imul(x,dt),n+=Math.imul(I,lt),i+=Math.imul(I,bt),i+=Math.imul(k,lt),s+=Math.imul(k,bt);var Ot=u+n+((8191&i)<<13);u=s+(i>>>13)+(Ot>>>26),Ot&=67108863,n=Math.imul(L,rt),i=Math.imul(L,nt),i+=Math.imul(D,rt),s=Math.imul(D,nt),n+=Math.imul(N,st),i+=Math.imul(N,ot),i+=Math.imul(j,st),s+=Math.imul(j,ot),n+=Math.imul(R,ft),i+=Math.imul(R,ut),i+=Math.imul(T,ft),s+=Math.imul(T,ut),n+=Math.imul(O,ht),i+=Math.imul(O,dt),i+=Math.imul(B,ht),s+=Math.imul(B,dt),n+=Math.imul(A,lt),i+=Math.imul(A,bt),i+=Math.imul(x,lt),s+=Math.imul(x,bt);var Bt=u+n+((8191&i)<<13);u=s+(i>>>13)+(Bt>>>26),Bt&=67108863,n=Math.imul(L,st),i=Math.imul(L,ot),i+=Math.imul(D,st),s=Math.imul(D,ot),n+=Math.imul(N,ft),i+=Math.imul(N,ut),i+=Math.imul(j,ft),s+=Math.imul(j,ut),n+=Math.imul(R,ht),i+=Math.imul(R,dt),i+=Math.imul(T,ht),s+=Math.imul(T,dt),n+=Math.imul(O,lt),i+=Math.imul(O,bt),i+=Math.imul(B,lt),s+=Math.imul(B,bt);var Mt=u+n+((8191&i)<<13);u=s+(i>>>13)+(Mt>>>26),Mt&=67108863,n=Math.imul(L,ft),i=Math.imul(L,ut),i+=Math.imul(D,ft),s=Math.imul(D,ut),n+=Math.imul(N,ht),i+=Math.imul(N,dt),i+=Math.imul(j,ht),s+=Math.imul(j,dt),n+=Math.imul(R,lt),i+=Math.imul(R,bt),i+=Math.imul(T,lt),s+=Math.imul(T,bt);var Rt=u+n+((8191&i)<<13);u=s+(i>>>13)+(Rt>>>26),Rt&=67108863,n=Math.imul(L,ht),i=Math.imul(L,dt),i+=Math.imul(D,ht),s=Math.imul(D,dt),n+=Math.imul(N,lt),i+=Math.imul(N,bt),i+=Math.imul(j,lt),s+=Math.imul(j,bt);var Tt=u+n+((8191&i)<<13);u=s+(i>>>13)+(Tt>>>26),Tt&=67108863,n=Math.imul(L,lt),i=Math.imul(L,bt),i+=Math.imul(D,lt),s=Math.imul(D,bt);var Ct=u+n+((8191&i)<<13);return u=s+(i>>>13)+(Ct>>>26),Ct&=67108863,f[0]=gt,f[1]=mt,f[2]=yt,f[3]=vt,f[4]=_t,f[5]=wt,f[6]=St,f[7]=It,f[8]=kt,f[9]=Et,f[10]=At,f[11]=xt,f[12]=Pt,f[13]=Ot,f[14]=Bt,f[15]=Mt,f[16]=Rt,f[17]=Tt,f[18]=Ct,0!==u&&(f[19]=u,r.length++),r};Math.imul||(E=u),s.prototype.mulTo=function(t,e){var r,n=this.length+t.length;return r=10===this.length&&10===t.length?E(this,t,e):63>n?u(this,t,e):1024>n?c(this,t,e):h(this,t,e)},d.prototype.makeRBT=function(t){for(var e=new Array(t),r=s.prototype._countBits(t)-1,n=0;t>n;n++)e[n]=this.revBin(n,r,t);return e},d.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var n=0,i=0;e>i;i++)n|=(1&t)<>=1;return n},d.prototype.permute=function(t,e,r,n,i,s){for(var o=0;s>o;o++)n[o]=e[t[o]],i[o]=r[t[o]]},d.prototype.transform=function(t,e,r,n,i,s){this.permute(s,t,e,r,n,i);for(var o=1;i>o;o<<=1)for(var a=o<<1,f=Math.cos(2*Math.PI/a),u=Math.sin(2*Math.PI/a),c=0;i>c;c+=a)for(var h=f,d=u,p=0;o>p;p++){var l=r[c+p],b=n[c+p],g=r[c+p+o],m=n[c+p+o],y=h*g-d*m;m=h*m+d*g,g=y,r[c+p]=l+g,n[c+p]=b+m,r[c+p+o]=l-g,n[c+p+o]=b-m,p!==a&&(y=f*h-u*d,d=f*d+u*h,h=y)}},d.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<=r))for(var n=0;r/2>n;n++){var i=t[n];t[n]=t[r-n-1],t[r-n-1]=i,i=e[n],e[n]=-e[r-n-1],e[r-n-1]=-i}},d.prototype.normalize13b=function(t,e){for(var r=0,n=0;e/2>n;n++){var i=8192*Math.round(t[2*n+1]/e)+Math.round(t[2*n]/e)+r;t[n]=67108863&i,r=67108864>i?0:i/67108864|0}return t},d.prototype.convert13b=function(t,e,r,i){for(var s=0,o=0;e>o;o++)s+=0|t[o],r[2*o]=8191&s,s>>>=13,r[2*o+1]=8191&s,s>>>=13;for(o=2*e;i>o;++o)r[o]=0;n(0===s),n(0===(-8192&s))},d.prototype.stub=function(t){for(var e=new Array(t),r=0;t>r;r++)e[r]=0;return e},d.prototype.mulp=function(t,e,r){var n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),s=this.stub(n),o=new Array(n),a=new Array(n),f=new Array(n),u=new Array(n),c=new Array(n),h=new Array(n),d=r.words;d.length=n,this.convert13b(t.words,t.length,o,n),this.convert13b(e.words,e.length,u,n),this.transform(o,s,a,f,n,i),this.transform(u,s,c,h,n,i);for(var p=0;n>p;p++){var l=a[p]*c[p]-f[p]*h[p];f[p]=a[p]*h[p]+f[p]*c[p],a[p]=l}return this.conjugate(a,f,n),this.transform(a,f,d,s,n,i),this.conjugate(d,s,n),this.normalize13b(d,n),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},s.prototype.mul=function(t){var e=new s(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},s.prototype.mulf=function(t){var e=new s(null);return e.words=new Array(this.length+t.length),h(this,t,e)},s.prototype.imul=function(t){return this.clone().mulTo(t,this)},s.prototype.imuln=function(t){n("number"==typeof t);for(var e=0,r=0;r>=26,e+=i/67108864|0,e+=s>>>26,this.words[r]=67108863&s}return 0!==e&&(this.words[r]=e,this.length++),this},s.prototype.muln=function(t){return this.clone().imuln(t)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(t){var e=f(t);if(0===e.length)return new s(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,s=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;i>e;e++)this.words[e]=0;this.length+=i}return this.strip()},s.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},s.prototype.iushrn=function(t,e,r){n("number"==typeof t&&t>=0);var i;i=e?(e-e%26)/26:0;var s=t%26,o=Math.min((t-s)/26,this.length),a=67108863^67108863>>>s<u;u++)f.words[u]=this.words[u];f.length=o}if(0===o);else if(this.length>o)for(this.length-=o,u=0;u=0&&(0!==c||u>=i);u--){var h=0|this.words[u];this.words[u]=c<<26-s|h>>>s,c=h&a}return f&&0!==c&&(f.words[f.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},s.prototype.shln=function(t){return this.clone().ishln(t)},s.prototype.ushln=function(t){return this.clone().iushln(t)},s.prototype.shrn=function(t){return this.clone().ishrn(t)},s.prototype.ushrn=function(t){return this.clone().iushrn(t)},s.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<t?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},s.prototype.isubn=function(t){if(n("number"==typeof t),0>t)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+r]=67108863&a}for(;i>26,this.words[i+r]=67108863&a;if(0===f)return this.strip();for(n(-1===f),f=0,i=0;i>26,this.words[i]=67108863&a;return this.negative=1,this.strip()},s.prototype._wordDiv=function(t,e){var r=this.length-t.length,n=this.clone(),i=t,o=0|i.words[i.length-1],a=this._countBits(o);r=26-a,0!==r&&(i=i.ushln(r),n.iushln(r),o=0|i.words[i.length-1]);var f,u=n.length-i.length;if("mod"!==e){f=new s(null),f.length=u+1,f.words=new Array(f.length);for(var c=0;c=0;d--){var p=67108864*(0|n.words[i.length+d])+(0|n.words[i.length+d-1]);for(p=Math.min(p/o|0,67108863),n._ishlnsubmul(i,p,d);0!==n.negative;)p--,n.negative=0,n._ishlnsubmul(i,1,d),n.isZero()||(n.negative^=1);f&&(f.words[d]=p)}return f&&f.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:f||null,mod:n}},s.prototype.divmod=function(t,e,r){n(!t.isZero());var i,o,a;return 0!==this.negative&&0===t.negative?(a=this.neg().divmod(t,e),"mod"!==e&&(i=a.div.neg()),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(t)),{div:i,mod:o}):0===this.negative&&0!==t.negative?(a=this.divmod(t.neg(),e),"mod"!==e&&(i=a.div.neg()),{div:i,mod:a.mod}):0!==(this.negative&t.negative)?(a=this.neg().divmod(t.neg(),e),"div"!==e&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(t)),{div:a.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new s(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new s(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new s(this.modn(t.words[0]))}:this._wordDiv(t,e)},s.prototype.div=function(t){return this.divmod(t,"div",!1).div},s.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},s.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},s.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),s=r.cmp(n);return 0>s||1===i&&0===s?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},s.prototype.modn=function(t){n(67108863>=t);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},s.prototype.idivn=function(t){n(67108863>=t);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},s.prototype.divn=function(t){return this.clone().idivn(t)},s.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new s(1),o=new s(0),a=new s(0),f=new s(1),u=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++u;for(var c=r.clone(),h=e.clone();!e.isZero();){for(var d=0,p=1;0===(e.words[0]&p)&&26>d;++d,p<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(c),o.isub(h)),i.iushrn(1),o.iushrn(1);for(var l=0,b=1;0===(r.words[0]&b)&&26>l;++l,b<<=1);if(l>0)for(r.iushrn(l);l-- >0;)(a.isOdd()||f.isOdd())&&(a.iadd(c),f.isub(h)),a.iushrn(1),f.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(a),o.isub(f)):(r.isub(e),a.isub(i),f.isub(o))}return{a:a,b:f,gcd:r.iushln(u)}},s.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new s(1),o=new s(0),a=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var f=0,u=1;0===(e.words[0]&u)&&26>f;++f,u<<=1);if(f>0)for(e.iushrn(f);f-- >0;)i.isOdd()&&i.iadd(a),i.iushrn(1);for(var c=0,h=1;0===(r.words[0]&h)&&26>c;++c,h<<=1);if(c>0)for(r.iushrn(c);c-- >0;)o.isOdd()&&o.iadd(a),o.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(o)):(r.isub(e),o.isub(i))}var d;return d=0===e.cmpn(1)?i:o,d.cmpn(0)<0&&d.iadd(t),d},s.prototype.gcd=function(t){if(this.isZero())return t.clone();if(t.isZero())return this.clone();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(0>i){var s=e;e=r,r=s}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},s.prototype.invm=function(t){return this.egcd(t).a.umod(t)},s.prototype.isEven=function(){return 0===(1&this.words[0])},s.prototype.isOdd=function(){return 1===(1&this.words[0])},s.prototype.andln=function(t){return this.words[0]&t},s.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<s;s++)this.words[s]=0;return this.words[r]|=i,this.length=r+1,this}var o=i;for(s=r;0!==o&&s>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.cmpn=function(t){var e=0>t;if(0!==this.negative&&!e)return-1;if(0===this.negative&&e)return 1;this.strip();var r;if(this.length>1)r=1;else{e&&(t=-t),n(67108863>=t,"Number is too big");var i=0|this.words[0];r=i===t?0:t>i?-1:1}return 0!==this.negative&&(r=-r),r},s.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?-e:e},s.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){i>n?e=-1:n>i&&(e=1);break}}return e},s.prototype.gtn=function(t){return 1===this.cmpn(t)},s.prototype.gt=function(t){return 1===this.cmp(t)},s.prototype.gten=function(t){return this.cmpn(t)>=0},s.prototype.gte=function(t){return this.cmp(t)>=0},s.prototype.ltn=function(t){return-1===this.cmpn(t)},s.prototype.lt=function(t){return-1===this.cmp(t)},s.prototype.lten=function(t){return this.cmpn(t)<=0},s.prototype.lte=function(t){return this.cmp(t)<=0},s.prototype.eqn=function(t){return 0===this.cmpn(t)},s.prototype.eq=function(t){return 0===this.cmp(t)},s.red=function(t){return new y(t)},s.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(t){return this.red=t,this},s.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},s.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},s.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},s.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},s.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},s.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.ushl(this,t)},s.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},s.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var A={k256:null,p224:null,p192:null,p25519:null};p.prototype._tmp=function(){var t=new s(null);return t.words=new Array(Math.ceil(this.n/13)),t},p.prototype.ireduce=function(t){var e,r=t;do this.split(r,this.tmp),r=this.imulK(r),r=r.iadd(this.tmp),e=r.bitLength();while(e>this.n);var n=e0?r.isub(this.p):r.strip(),r},p.prototype.split=function(t,e){t.iushrn(this.n,0,e)},p.prototype.imulK=function(t){return t.imul(this.k)},i(l,p),l.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;n>i;i++)e.words[i]=t.words[i];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var s=t.words[9];for(e.words[e.length++]=s&r,i=10;i>>22,s=o}t.words[i-10]=s>>>22,t.length-=9},l.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},s._prime=function x(t){if(A[t])return A[t];var x;if("k256"===t)x=new l;else if("p224"===t)x=new b;else if("p192"===t)x=new g;else{if("p25519"!==t)throw new Error("Unknown prime "+t);x=new m}return A[t]=x,x},y.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},y.prototype._verify2=function(t,e){n(0===(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},y.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},y.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},y.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)},y.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},y.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)},y.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},y.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},y.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},y.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},y.prototype.isqr=function(t){return this.imul(t,t.clone())},y.prototype.sqr=function(t){return this.mul(t,t)},y.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2===1),3===e){var r=this.m.add(new s(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),o=0;!i.isZero()&&0===i.andln(1);)o++,i.iushrn(1);n(!i.isZero());var a=new s(1).toRed(this),f=a.redNeg(),u=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new s(2*c*c).toRed(this);0!==this.pow(c,u).cmp(f);)c.redIAdd(f);for(var h=this.pow(c,i),d=this.pow(t,i.addn(1).iushrn(1)),p=this.pow(t,i),l=o;0!==p.cmp(a);){for(var b=p,g=0;0!==b.cmp(a);g++)b=b.redSqr();n(l>g);var m=this.pow(h,new s(1).iushln(l-g-1));d=d.redMul(m),h=m.redSqr(),p=p.redMul(h),l=g}return d},y.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},y.prototype.pow=function(t,e){if(e.isZero())return new s(1);if(0===e.cmpn(1))return t.clone();var r=4,n=new Array(1<=0;i--){for(var c=e.words[i],h=u-1;h>=0;h--){var d=c>>h&1;o!==n[0]&&(o=this.sqr(o)),0!==d||0!==a?(a<<=1,a|=d,f++,(f===r||0===i&&0===h)&&(o=this.mul(o,n[a]),f=0,a=0)):f=0}u=26}return o},y.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},y.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},s.mont=function(t){return new v(t)},i(v,y),v.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},v.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},v.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),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},v.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new s(0)._forceRed(this);var r=t.mul(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)},v.prototype.invm=function(t){var e=this.imod(t._invmp(this.m).mul(this.r2));return e._forceRed(this)}}("undefined"==typeof e||e,this)},{buffer:47}],86:[function(t,e,r){(function(r){function n(t){var e=s(t),r=e.toRed(o.mont(t.modulus)).redPow(new o(t.publicExponent)).fromRed();return{blinder:r,unblinder:e.invm(t.modulus)}}function i(t,e){var i=n(e),s=e.modulus.byteLength(),a=(o.mont(e.modulus),new o(t).mul(i.blinder).umod(e.modulus)),f=a.toRed(o.mont(e.prime1)),u=a.toRed(o.mont(e.prime2)),c=e.coefficient,h=e.prime1,d=e.prime2,p=f.redPow(e.exponent1),l=u.redPow(e.exponent2);p=p.fromRed(),l=l.fromRed();var b=p.isub(l).imul(c).umod(h);return b.imul(d),l.iadd(b),new r(l.imul(i.unblinder).umod(e.modulus).toArray(!1,s))}function s(t){for(var e=t.modulus.byteLength(),r=new o(a(e));r.cmp(t.modulus)>=0||!r.umod(t.prime1)||!r.umod(t.prime2);)r=new o(a(e));return r}var o=t("bn.js"),a=t("randombytes");e.exports=i,i.getr=s}).call(this,t("buffer").Buffer)},{"bn.js":85,buffer:48,randombytes:243}],87:[function(t,e,r){"use strict";var n=r;n.version=t("../package.json").version,n.utils=t("./elliptic/utils"),n.rand=t("brorand"),n.hmacDRBG=t("./elliptic/hmac-drbg"),n.curve=t("./elliptic/curve"),n.curves=t("./elliptic/curves"),n.ec=t("./elliptic/ec"),n.eddsa=t("./elliptic/eddsa")},{"../package.json":110,"./elliptic/curve":90,"./elliptic/curves":93,"./elliptic/ec":94,"./elliptic/eddsa":97,"./elliptic/hmac-drbg":100,"./elliptic/utils":102,brorand:103}],88:[function(t,e,r){"use strict";function n(t,e){this.type=t,this.p=new s(e.p,16),this.red=e.prime?s.red(e.prime):s.mont(this.p),this.zero=new s(0).toRed(this.red),this.one=new s(1).toRed(this.red),this.two=new s(2).toRed(this.red),this.n=e.n&&new s(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)}function i(t,e){this.curve=t,this.type=e,this.precomputed=null}var s=t("bn.js"),o=t("../../elliptic"),a=o.utils,f=a.getNAF,u=a.getJSF,c=a.assert;e.exports=n,n.prototype.point=function(){throw new Error("Not implemented")},n.prototype.validate=function(){throw new Error("Not implemented")},n.prototype._fixedNafMul=function(t,e){c(t.precomputed);var r=t._getDoubles(),n=f(e,1),i=(1<=o;e--)a=(a<<1)+n[e];s.push(a)}for(var u=this.jpoint(null,null,null),h=this.jpoint(null,null,null),d=i;d>0;d--){for(var o=0;o=0;a--){for(var e=0;a>=0&&0===s[a];a--)e++; if(a>=0&&e++,o=o.dblp(e),0>a)break;var u=s[a];c(0!==u),o="affine"===t.type?u>0?o.mixedAdd(i[u-1>>1]):o.mixedAdd(i[-u-1>>1].neg()):u>0?o.add(i[u-1>>1]):o.add(i[-u-1>>1].neg())}return"affine"===t.type?o.toP():o},n.prototype._wnafMulAdd=function(t,e,r,n){for(var i=this._wnafT1,s=this._wnafT2,o=this._wnafT3,a=0,c=0;n>c;c++){var h=e[c],d=h._getNAFPoints(t);i[c]=d.wnd,s[c]=d.points}for(var c=n-1;c>=1;c-=2){var p=c-1,l=c;if(1===i[p]&&1===i[l]){var b=[e[p],null,null,e[l]];0===e[p].y.cmp(e[l].y)?(b[1]=e[p].add(e[l]),b[2]=e[p].toJ().mixedAdd(e[l].neg())):0===e[p].y.cmp(e[l].y.redNeg())?(b[1]=e[p].toJ().mixedAdd(e[l]),b[2]=e[p].add(e[l].neg())):(b[1]=e[p].toJ().mixedAdd(e[l]),b[2]=e[p].toJ().mixedAdd(e[l].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],m=u(r[p],r[l]);a=Math.max(m[0].length,a),o[p]=new Array(a),o[l]=new Array(a);for(var y=0;a>y;y++){var v=0|m[0][y],_=0|m[1][y];o[p][y]=g[3*(v+1)+(_+1)],o[l][y]=0,s[p]=b}}else o[p]=f(r[p],i[p]),o[l]=f(r[l],i[l]),a=Math.max(o[p].length,a),a=Math.max(o[l].length,a)}for(var w=this.jpoint(null,null,null),S=this._wnafT4,c=a;c>=0;c--){for(var I=0;c>=0;){for(var k=!0,y=0;n>y;y++)S[y]=0|o[y][c],0!==S[y]&&(k=!1);if(!k)break;I++,c--}if(c>=0&&I++,w=w.dblp(I),0>c)break;for(var y=0;n>y;y++){var h,E=S[y];0!==E&&(E>0?h=s[y][E-1>>1]:0>E&&(h=s[y][-E-1>>1].neg()),w="affine"===h.type?w.mixedAdd(h):w.add(h))}}for(var c=0;n>c;c++)s[c]=null;return w.toP()},n.BasePoint=i,i.prototype.eq=function(){throw new Error("Not implemented")},i.prototype.validate=function(){return this.curve.validate(this)},n.prototype.decodePoint=function(t,e){t=a.toArray(t,e);var r=this.p.byteLength();if(4===t[0]&&t.length-1===2*r)return this.point(t.slice(1,1+r),t.slice(1+r,1+2*r));if((2===t[0]||3===t[0])&&t.length-1===r)return this.pointFromX(t.slice(1,1+r),3===t[0]);throw new Error("Unknown point format")},i.prototype.encodeCompressed=function(t){return this.encode(t,!0)},i.prototype._encode=function(t){var e=this.curve.p.byteLength(),r=this.getX().toArray("be",e);return t?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",e))},i.prototype.encode=function(t,e){return a.encode(this._encode(e),t)},i.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},i.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return e?e.points.length>=Math.ceil((t.bitLength()+1)/e.step):!1},i.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;e>i;i+=t){for(var s=0;t>s;s++)n=n.dbl();r.push(n)}return{step:t,points:r}},i.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],r=(1<i;i++)e[i]=e[i-1].add(n);return{wnd:t,points:e}},i.prototype._getBeta=function(){return null},i.prototype.dblp=function(t){for(var e=this,r=0;t>r;r++)e=e.dbl();return e}},{"../../elliptic":87,"bn.js":85}],89:[function(t,e,r){"use strict";function n(t){this.twisted=1!==(0|t.a),this.mOneA=this.twisted&&-1===(0|t.a),this.extended=this.mOneA,u.call(this,"edwards",t),this.a=new a(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new a(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new a(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),c(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1===(0|t.c)}function i(t,e,r,n,i){u.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 a(e,16),this.y=new a(r,16),this.z=n?new a(n,16):this.curve.one,this.t=i&&new a(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()))))}var s=t("../curve"),o=t("../../elliptic"),a=t("bn.js"),f=t("inherits"),u=s.base,c=o.utils.assert;f(n,u),e.exports=n,n.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},n.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},n.prototype.jpoint=function(t,e,r,n){return this.point(t,e,r,n)},n.prototype.pointFromX=function(t,e){t=new a(t,16),t.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)),s=n.redMul(i.redInvm()),o=s.redSqrt();if(0!==o.redSqr().redSub(s).cmp(this.zero))throw new Error("invalid point");var f=o.fromRed().isOdd();return(e&&!f||!e&&f)&&(o=o.redNeg()),this.point(t,o)},n.prototype.pointFromY=function(t,e){t=new a(t,16),t.red||(t=t.toRed(this.red));var r=t.redSqr(),n=r.redSub(this.one),i=r.redMul(this.d).redAdd(this.one),s=n.redMul(i.redInvm());if(0===s.cmp(this.zero)){if(e)throw new Error("invalid point");return this.point(this.zero,t)}var o=s.redSqrt();if(0!==o.redSqr().redSub(s).cmp(this.zero))throw new Error("invalid point");return o.isOdd()!==e&&(o=o.redNeg()),this.point(o,t)},n.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)},f(i,u.BasePoint),n.prototype.pointFromJSON=function(t){return i.fromJSON(this,t)},n.prototype.point=function(t,e,r,n){return new i(this,t,e,r,n)},i.fromJSON=function(t,e){return new i(t,e[0],e[1],e[2])},i.prototype.inspect=function(){return this.isInfinity()?"":""},i.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&0===this.y.cmp(this.z)},i.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),s=n.redAdd(e),o=s.redSub(r),a=n.redSub(e),f=i.redMul(o),u=s.redMul(a),c=i.redMul(a),h=o.redMul(s);return this.curve.point(f,u,h,c)},i.prototype._projDbl=function(){var t,e,r,n=this.x.redAdd(this.y).redSqr(),i=this.x.redSqr(),s=this.y.redSqr();if(this.curve.twisted){var o=this.curve._mulA(i),a=o.redAdd(s);if(this.zOne)t=n.redSub(i).redSub(s).redMul(a.redSub(this.curve.two)),e=a.redMul(o.redSub(s)),r=a.redSqr().redSub(a).redSub(a);else{var f=this.z.redSqr(),u=a.redSub(f).redISub(f);t=n.redSub(i).redISub(s).redMul(u),e=a.redMul(o.redSub(s)),r=a.redMul(u)}}else{var o=i.redAdd(s),f=this.curve._mulC(this.c.redMul(this.z)).redSqr(),u=o.redSub(f).redSub(f);t=this.curve._mulC(n.redISub(o)).redMul(u),e=this.curve._mulC(o).redMul(i.redISub(s)),r=o.redMul(u)}return this.curve.point(t,e,r)},i.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},i.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)),s=r.redSub(e),o=i.redSub(n),a=i.redAdd(n),f=r.redAdd(e),u=s.redMul(o),c=a.redMul(f),h=s.redMul(f),d=o.redMul(a);return this.curve.point(u,c,d,h)},i.prototype._projAdd=function(t){var e,r,n=this.z.redMul(t.z),i=n.redSqr(),s=this.x.redMul(t.x),o=this.y.redMul(t.y),a=this.curve.d.redMul(s).redMul(o),f=i.redSub(a),u=i.redAdd(a),c=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(s).redISub(o),h=n.redMul(f).redMul(c);return this.curve.twisted?(e=n.redMul(u).redMul(o.redSub(this.curve._mulA(s))),r=f.redMul(u)):(e=n.redMul(u).redMul(o.redSub(s)),r=this.curve._mulC(f).redMul(u)),this.curve.point(h,e,r)},i.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},i.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},i.prototype.mulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2)},i.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},i.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},i.prototype.getX=function(){return this.normalize(),this.x.fromRed()},i.prototype.getY=function(){return this.normalize(),this.y.fromRed()},i.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},i.prototype.toP=i.prototype.normalize,i.prototype.mixedAdd=i.prototype.add},{"../../elliptic":87,"../curve":90,"bn.js":85,inherits:296}],90:[function(t,e,r){"use strict";var n=r;n.base=t("./base"),n["short"]=t("./short"),n.mont=t("./mont"),n.edwards=t("./edwards")},{"./base":88,"./edwards":89,"./mont":91,"./short":92}],91:[function(t,e,r){"use strict";function n(t){f.call(this,"mont",t),this.a=new o(t.a,16).toRed(this.red),this.b=new o(t.b,16).toRed(this.red),this.i4=new o(4).toRed(this.red).redInvm(),this.two=new o(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function i(t,e,r){f.BasePoint.call(this,t,"projective"),null===e&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new o(e,16),this.z=new o(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}var s=t("../curve"),o=t("bn.js"),a=t("inherits"),f=s.base,u=t("../../elliptic"),c=u.utils;a(n,f),e.exports=n,n.prototype.validate=function(t){var e=t.normalize().x,r=e.redSqr(),n=r.redMul(e).redAdd(r.redMul(this.a)).redAdd(e),i=n.redSqrt();return 0===i.redSqr().cmp(n)},a(i,f.BasePoint),n.prototype.decodePoint=function(t,e){return this.point(c.toArray(t,e),1)},n.prototype.point=function(t,e){return new i(this,t,e)},n.prototype.pointFromJSON=function(t){return i.fromJSON(this,t)},i.prototype.precompute=function(){},i.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},i.fromJSON=function(t,e){return new i(t,e[0],e[1]||t.one)},i.prototype.inspect=function(){return this.isInfinity()?"":""},i.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},i.prototype.dbl=function(){var t=this.x.redAdd(this.z),e=t.redSqr(),r=this.x.redSub(this.z),n=r.redSqr(),i=e.redSub(n),s=e.redMul(n),o=i.redMul(n.redAdd(this.curve.a24.redMul(i)));return this.curve.point(s,o)},i.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.diffAdd=function(t,e){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=t.x.redAdd(t.z),s=t.x.redSub(t.z),o=s.redMul(r),a=i.redMul(n),f=e.z.redMul(o.redAdd(a).redSqr()),u=e.x.redMul(o.redISub(a).redSqr());return this.curve.point(f,u)},i.prototype.mul=function(t){for(var e=t.clone(),r=this,n=this.curve.point(null,null),i=this,s=[];0!==e.cmpn(0);e.iushrn(1))s.push(e.andln(1));for(var o=s.length-1;o>=0;o--)0===s[o]?(r=r.diffAdd(n,i),n=n.dbl()):(n=r.diffAdd(n,i),r=r.dbl());return n},i.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},i.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},i.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},{"../../elliptic":87,"../curve":90,"bn.js":85,inherits:296}],92:[function(t,e,r){"use strict";function n(t){c.call(this,"short",t),this.a=new f(t.a,16).toRed(this.red),this.b=new f(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function i(t,e,r,n){c.BasePoint.call(this,t,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new f(e,16),this.y=new f(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function s(t,e,r,n){c.BasePoint.call(this,t,"jacobian"),null===e&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new f(0)):(this.x=new f(e,16),this.y=new f(r,16),this.z=new f(n,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.zOne=this.z===this.curve.one}var o=t("../curve"),a=t("../../elliptic"),f=t("bn.js"),u=t("inherits"),c=o.base,h=a.utils.assert;u(n,c),e.exports=n,n.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,r;if(t.beta)e=new f(t.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);e=n[0].cmp(n[1])<0?n[0]:n[1],e=e.toRed(this.red)}if(t.lambda)r=new f(t.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(e))?r=i[0]:(r=i[1],h(0===this.g.mul(r).x.cmp(this.g.x.redMul(e))))}var s;return s=t.basis?t.basis.map(function(t){return{a:new f(t.a,16),b:new f(t.b,16)}}):this._getEndoBasis(r),{beta:e,lambda:r,basis:s}}},n.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:f.mont(t),r=new f(2).toRed(e).redInvm(),n=r.redNeg(),i=new f(3).toRed(e).redNeg().redSqrt().redMul(r),s=n.redAdd(i).fromRed(),o=n.redSub(i).fromRed();return[s,o]},n.prototype._getEndoBasis=function(t){for(var e,r,n,i,s,o,a,u,c,h=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=t,p=this.n.clone(),l=new f(1),b=new f(0),g=new f(0),m=new f(1),y=0;0!==d.cmpn(0);){var v=p.div(d);u=p.sub(v.mul(d)),c=g.sub(v.mul(l));var _=m.sub(v.mul(b));if(!n&&u.cmp(h)<0)e=a.neg(),r=l,n=u.neg(),i=c;else if(n&&2===++y)break;a=u,p=d,d=u,g=l,l=c,m=b,b=_}s=u.neg(),o=c;var w=n.sqr().add(i.sqr()),S=s.sqr().add(o.sqr());return S.cmp(w)>=0&&(s=e,o=r),n.negative&&(n=n.neg(),i=i.neg()),s.negative&&(s=s.neg(),o=o.neg()),[{a:n,b:i},{a:s,b:o}]},n.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),s=r.b.neg().mul(t).divRound(this.n),o=i.mul(r.a),a=s.mul(n.a),f=i.mul(r.b),u=s.mul(n.b),c=t.sub(o).sub(a),h=f.add(u).neg();return{k1:c,k2:h}},n.prototype.pointFromX=function(t,e){t=new f(t,16),t.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)},n.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)},n.prototype._endoWnafMulAdd=function(t,e){for(var r=this._endoWnafT1,n=this._endoWnafT2,i=0;iu;u++)r[u]=null,n[u]=null;return f},u(i,c.BasePoint),n.prototype.point=function(t,e,r){return new i(this,t,e,r)},n.prototype.pointFromJSON=function(t,e){return i.fromJSON(this,t,e)},i.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var r=this.curve,n=function(t){return r.point(t.x.redMul(r.endo.beta),t.y)};t.beta=e,e.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(n)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(n)}}}return e}},i.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},i.fromJSON=function(t,e,r){function n(e){return t.point(e[0],e[1],r)}"string"==typeof e&&(e=JSON.parse(e));var i=t.point(e[0],e[1],r);if(!e[2])return i;var s=e[2];return i.precomputed={beta:null,doubles:s.doubles&&{step:s.doubles.step,points:[i].concat(s.doubles.points.map(n))},naf:s.naf&&{wnd:s.naf.wnd,points:[i].concat(s.naf.points.map(n))}},i},i.prototype.inspect=function(){return this.isInfinity()?"":""},i.prototype.isInfinity=function(){return this.inf},i.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)},i.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),s=i.redSqr().redISub(this.x.redAdd(this.x)),o=i.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,o)},i.prototype.getX=function(){return this.x.fromRed()},i.prototype.getY=function(){return this.y.fromRed()},i.prototype.mul=function(t){return t=new f(t,16),this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},i.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)},i.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))},i.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},i.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var t=this.curve.jpoint(this.x,this.y,this.curve.one);return t},u(s,c.BasePoint),n.prototype.jpoint=function(t,e,r){return new s(this,t,e,r)},s.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)},s.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},s.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),s=this.y.redMul(e.redMul(t.z)),o=t.y.redMul(r.redMul(this.z)),a=n.redSub(i),f=s.redSub(o);if(0===a.cmpn(0))return 0!==f.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),c=u.redMul(a),h=n.redMul(u),d=f.redSqr().redIAdd(c).redISub(h).redISub(h),p=f.redMul(h.redISub(d)).redISub(s.redMul(c)),l=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(d,p,l)},s.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,s=t.y.redMul(e).redMul(this.z),o=r.redSub(n),a=i.redSub(s);if(0===o.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var f=o.redSqr(),u=f.redMul(o),c=r.redMul(f),h=a.redSqr().redIAdd(u).redISub(c).redISub(c),d=a.redMul(c.redISub(h)).redISub(i.redMul(u)),p=this.z.redMul(o);return this.curve.jpoint(h,d,p)},s.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var e=this,r=0;t>r;r++)e=e.dbl();return e}for(var n=this.curve.a,i=this.curve.tinv,s=this.x,o=this.y,a=this.z,f=a.redSqr().redSqr(),u=o.redAdd(o),r=0;t>r;r++){var c=s.redSqr(),h=u.redSqr(),d=h.redSqr(),p=c.redAdd(c).redIAdd(c).redIAdd(n.redMul(f)),l=s.redMul(h),b=p.redSqr().redISub(l.redAdd(l)),g=l.redISub(b),m=p.redMul(g);m=m.redIAdd(m).redISub(d);var y=u.redMul(a);t>r+1&&(f=f.redMul(d)),s=b,a=y,u=m}return this.curve.jpoint(s,u.redMul(i),a)},s.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},s.prototype._zeroDbl=function(){var t,e,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),s=i.redSqr(),o=this.x.redAdd(i).redSqr().redISub(n).redISub(s);o=o.redIAdd(o);var a=n.redAdd(n).redIAdd(n),f=a.redSqr().redISub(o).redISub(o),u=s.redIAdd(s);u=u.redIAdd(u),u=u.redIAdd(u),t=f,e=a.redMul(o.redISub(f)).redISub(u),r=this.y.redAdd(this.y)}else{var c=this.x.redSqr(),h=this.y.redSqr(),d=h.redSqr(),p=this.x.redAdd(h).redSqr().redISub(c).redISub(d);p=p.redIAdd(p);var l=c.redAdd(c).redIAdd(c),b=l.redSqr(),g=d.redIAdd(d);g=g.redIAdd(g),g=g.redIAdd(g),t=b.redISub(p).redISub(p),e=l.redMul(p.redISub(t)).redISub(g),r=this.y.redMul(this.z),r=r.redIAdd(r)}return this.curve.jpoint(t,e,r)},s.prototype._threeDbl=function(){var t,e,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),s=i.redSqr(),o=this.x.redAdd(i).redSqr().redISub(n).redISub(s);o=o.redIAdd(o);var a=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),f=a.redSqr().redISub(o).redISub(o);t=f;var u=s.redIAdd(s);u=u.redIAdd(u),u=u.redIAdd(u),e=a.redMul(o.redISub(f)).redISub(u),r=this.y.redAdd(this.y)}else{var c=this.z.redSqr(),h=this.y.redSqr(),d=this.x.redMul(h),p=this.x.redSub(c).redMul(this.x.redAdd(c));p=p.redAdd(p).redIAdd(p);var l=d.redIAdd(d);l=l.redIAdd(l);var b=l.redAdd(l);t=p.redSqr().redISub(b),r=this.y.redAdd(this.z).redSqr().redISub(h).redISub(c);var g=h.redSqr();g=g.redIAdd(g),g=g.redIAdd(g),g=g.redIAdd(g),e=p.redMul(l.redISub(t)).redISub(g)}return this.curve.jpoint(t,e,r)},s.prototype._dbl=function(){var t=this.curve.a,e=this.x,r=this.y,n=this.z,i=n.redSqr().redSqr(),s=e.redSqr(),o=r.redSqr(),a=s.redAdd(s).redIAdd(s).redIAdd(t.redMul(i)),f=e.redAdd(e);f=f.redIAdd(f);var u=f.redMul(o),c=a.redSqr().redISub(u.redAdd(u)),h=u.redISub(c),d=o.redSqr();d=d.redIAdd(d),d=d.redIAdd(d),d=d.redIAdd(d);var p=a.redMul(h).redISub(d),l=r.redAdd(r).redMul(n);return this.curve.jpoint(c,p,l)},s.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr(),n=e.redSqr(),i=t.redAdd(t).redIAdd(t),s=i.redSqr(),o=this.x.redAdd(e).redSqr().redISub(t).redISub(n);o=o.redIAdd(o),o=o.redAdd(o).redIAdd(o),o=o.redISub(s);var a=o.redSqr(),f=n.redIAdd(n);f=f.redIAdd(f),f=f.redIAdd(f),f=f.redIAdd(f);var u=i.redIAdd(o).redSqr().redISub(s).redISub(a).redISub(f),c=e.redMul(u);c=c.redIAdd(c),c=c.redIAdd(c);var h=this.x.redMul(a).redISub(c);h=h.redIAdd(h),h=h.redIAdd(h);var d=this.y.redMul(u.redMul(f.redISub(u)).redISub(o.redMul(a)));d=d.redIAdd(d),d=d.redIAdd(d),d=d.redIAdd(d);var p=this.z.redAdd(o).redSqr().redISub(r).redISub(a);return this.curve.jpoint(h,d,p)},s.prototype.mul=function(t,e){return t=new f(t,e),this.curve._wnafMul(this,t)},s.prototype.eq=function(t){if("affine"===t.type)return this.eq(t.toJ());if(this===t)return!0;var e=this.z.redSqr(),r=t.z.redSqr();if(0!==this.x.redMul(r).redISub(t.x.redMul(e)).cmpn(0))return!1;var n=e.redMul(this.z),i=r.redMul(t.z);return 0===this.y.redMul(i).redISub(t.y.redMul(n)).cmpn(0)},s.prototype.inspect=function(){return this.isInfinity()?"":""},s.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../../elliptic":87,"../curve":90,"bn.js":85,inherits:296}],93:[function(t,e,r){"use strict";function n(t){"short"===t.type?this.curve=new a.curve["short"](t):"edwards"===t.type?this.curve=new a.curve.edwards(t):this.curve=new a.curve.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,f(this.g.validate(),"Invalid curve"),f(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function i(t,e){Object.defineProperty(s,t,{configurable:!0,enumerable:!0,get:function(){var r=new n(e);return Object.defineProperty(s,t,{configurable:!0,enumerable:!0,value:r}),r}})}var s=r,o=t("hash.js"),a=t("../elliptic"),f=a.utils.assert;s.PresetCurve=n,i("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),i("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),i("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),i("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),i("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),i("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"0",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),i("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var u;try{u=t("./precomputed/secp256k1")}catch(c){u=void 0}i("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",u]})},{"../elliptic":87,"./precomputed/secp256k1":101,"hash.js":104}],94:[function(t,e,r){"use strict";function n(t){return this instanceof n?("string"==typeof t&&(a(s.curves.hasOwnProperty(t),"Unknown curve "+t),t=s.curves[t]),t instanceof s.curves.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),void(this.hash=t.hash||t.curve.hash)):new n(t)}var i=t("bn.js"),s=t("../../elliptic"),o=s.utils,a=o.assert,f=t("./key"),u=t("./signature");e.exports=n,n.prototype.keyPair=function(t){return new f(this,t)},n.prototype.keyFromPrivate=function(t,e){return f.fromPrivate(this,t,e)},n.prototype.keyFromPublic=function(t,e){return f.fromPublic(this,t,e)},n.prototype.genKeyPair=function(t){t||(t={});for(var e=new s.hmacDRBG({hash:this.hash,pers:t.pers,entropy:t.entropy||s.rand(this.hash.hmacStrength),nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new i(2));;){var o=new i(e.generate(r));if(!(o.cmp(n)>0))return o.iaddn(1),this.keyFromPrivate(o)}},n.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},n.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 i(t,16));for(var o=this.n.byteLength(),a=e.getPrivate().toArray("be",o),f=t.toArray("be",o),c=new s.hmacDRBG({hash:this.hash,entropy:a,nonce:f,pers:n.pers,persEnc:n.persEnc}),h=this.n.sub(new i(1)),d=0;!0;d++){var p=n.k?n.k(d):new i(c.generate(this.n.byteLength()));if(p=this._truncateToN(p,!0),!(p.cmpn(1)<=0||p.cmp(h)>=0)){var l=this.g.mul(p);if(!l.isInfinity()){var b=l.getX(),g=b.umod(this.n);if(0!==g.cmpn(0)){var m=p.invm(this.n).mul(g.mul(e.getPrivate()).iadd(t));if(m=m.umod(this.n),0!==m.cmpn(0)){var y=(l.getY().isOdd()?1:0)|(0!==b.cmp(g)?2:0);return n.canonical&&m.cmp(this.nh)>0&&(m=this.n.sub(m),y^=1),new u({r:g,s:m,recoveryParam:y})}}}}}},n.prototype.verify=function(t,e,r,n){t=this._truncateToN(new i(t,16)),r=this.keyFromPublic(r,n),e=new u(e,"hex");var s=e.r,o=e.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a=o.invm(this.n),f=a.mul(t).umod(this.n),c=a.mul(s).umod(this.n),h=this.g.mulAdd(f,r.getPublic(),c);return h.isInfinity()?!1:0===h.getX().umod(this.n).cmp(s)},n.prototype.recoverPubKey=function(t,e,r,n){a((3&r)===r,"The recovery param is more than two bits"),e=new u(e,n);var s=this.n,o=new i(t),f=e.r,c=e.s,h=1&r,d=r>>1;if(f.cmp(this.curve.p.umod(this.curve.n))>=0&&d)throw new Error("Unable to find sencond key candinate");f=d?this.curve.pointFromX(f.add(this.curve.n),h):this.curve.pointFromX(f,h);var p=s.sub(o),l=e.r.invm(s);return f.mul(c).add(this.g.mul(p)).mul(l)},n.prototype.getKeyRecoveryParam=function(t,e,r,n){ if(e=new u(e,n),null!==e.recoveryParam)return e.recoveryParam;for(var i=0;4>i;i++){var s;try{s=this.recoverPubKey(t,e,i)}catch(t){continue}if(s.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},{"../../elliptic":87,"./key":95,"./signature":96,"bn.js":85}],95:[function(t,e,r){"use strict";function n(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var i=t("bn.js");e.exports=n,n.fromPublic=function(t,e,r){return e instanceof n?e:new n(t,{pub:e,pubEnc:r})},n.fromPrivate=function(t,e,r){return e instanceof n?e:new n(t,{priv:e,privEnc:r})},n.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},n.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},n.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},n.prototype._importPrivate=function(t,e){this.priv=new i(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},n.prototype._importPublic=function(t,e){return t.x||t.y?void(this.pub=this.ec.curve.point(t.x,t.y)):void(this.pub=this.ec.curve.decodePoint(t,e))},n.prototype.derive=function(t){return t.mul(this.priv).getX()},n.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},n.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},n.prototype.inspect=function(){return""}},{"bn.js":85}],96:[function(t,e,r){"use strict";function n(t,e){return t instanceof n?t:void(this._importDER(t,e)||(h(t.r&&t.s,"Signature without r or s"),this.r=new f(t.r,16),this.s=new f(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam))}function i(){this.place=0}function s(t,e){var r=t[e.place++];if(!(128&r))return r;for(var n=15&r,i=0,s=0,o=e.place;n>s;s++,o++)i<<=8,i|=t[o];return e.place=o,i}function o(t){for(var e=0,r=t.length-1;!t[e]&&!(128&t[e+1])&&r>e;)e++;return 0===e?t:t.slice(e)}function a(t,e){if(128>e)return void t.push(e);var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}var f=t("bn.js"),u=t("../../elliptic"),c=u.utils,h=c.assert;e.exports=n,n.prototype._importDER=function(t,e){t=c.toArray(t,e);var r=new i;if(48!==t[r.place++])return!1;var n=s(t,r);if(n+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var o=s(t,r),a=t.slice(r.place,o+r.place);if(r.place+=o,2!==t[r.place++])return!1;var u=s(t,r);if(t.length!==u+r.place)return!1;var h=t.slice(r.place,u+r.place);return 0===a[0]&&128&a[1]&&(a=a.slice(1)),0===h[0]&&128&h[1]&&(h=h.slice(1)),this.r=new f(a),this.s=new f(h),this.recoveryParam=null,!0},n.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=o(e),r=o(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];a(n,e.length),n=n.concat(e),n.push(2),a(n,r.length);var i=n.concat(r),s=[48];return a(s,i.length),s=s.concat(i),c.encode(s,t)}},{"../../elliptic":87,"bn.js":85}],97:[function(t,e,r){"use strict";function n(t){if(a("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof n))return new n(t);var t=s.curves[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=i.sha512}var i=t("hash.js"),s=t("../../elliptic"),o=s.utils,a=o.assert,f=o.parseBytes,u=t("./key"),c=t("./signature");e.exports=n,n.prototype.sign=function(t,e){t=f(t);var r=this.keyFromSecret(e),n=this.hashInt(r.messagePrefix(),t),i=this.g.mul(n),s=this.encodePoint(i),o=this.hashInt(s,r.pubBytes(),t).mul(r.priv()),a=n.add(o).umod(this.curve.n);return this.makeSignature({R:i,S:a,Rencoded:s})},n.prototype.verify=function(t,e,r){t=f(t),e=this.makeSignature(e);var n=this.keyFromPublic(r),i=this.hashInt(e.Rencoded(),n.pubBytes(),t),s=this.g.mul(e.S()),o=e.R().add(n.pub().mul(i));return o.eq(s)},n.prototype.hashInt=function(){for(var t=this.hash(),e=0;e=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,i)}var i=t("hash.js"),s=t("../elliptic"),o=s.utils,a=o.assert;e.exports=n,n.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},n.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=o.toArray(r,n),this._update(r));for(var i=[];i.length>8,o=255&i;s?r.push(s,o):r.push(o)}return r}function i(t){return 1===t.length?"0"+t:t}function s(t){for(var e="",r=0;r=0;){var s;if(i.isOdd()){var o=i.andln(n-1);s=o>(n>>1)-1?(n>>1)-o:o,i.isubn(s)}else s=0;r.push(s);for(var a=0!==i.cmpn(0)&&0===i.andln(n-1)?e+1:1,f=1;a>f;f++)r.push(0);i.iushrn(a)}return r}function a(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n=0,i=0;t.cmpn(-n)>0||e.cmpn(-i)>0;){var s=t.andln(3)+n&3,o=e.andln(3)+i&3;3===s&&(s=-1),3===o&&(o=-1);var a;if(0===(1&s))a=0;else{var f=t.andln(7)+n&7;a=3!==f&&5!==f||2!==o?s:-s}r[0].push(a);var u;if(0===(1&o))u=0;else{var f=e.andln(7)+i&7;u=3!==f&&5!==f||2!==s?o:-o}r[1].push(u),2*n===a+1&&(n=1-n),2*i===u+1&&(i=1-i),t.iushrn(1),e.iushrn(1)}return r}function f(t,e){var r=e.name,n="_"+r;t.prototype[r]=function(){return void 0!==this[n]?this[n]:this[n]=e.call(this)}}function u(t){return"string"==typeof t?h.toArray(t,"hex"):t}function c(t){return new d(t,"hex","le")}var h=r,d=t("bn.js");h.assert=function(t,e){if(!t)throw new Error(e||"Assertion failed")},h.toArray=n,h.zero2=i,h.toHex=s,h.encode=function(t,e){return"hex"===e?s(t):t},h.getNAF=o,h.getJSF=a,h.cachedProperty=f,h.parseBytes=u,h.intFromLE=c},{"bn.js":85}],103:[function(t,e,r){function n(t){this.rand=t}var i;if(e.exports=function(t){return i||(i=new n(null)),i.generate(t)},e.exports.Rand=n,n.prototype.generate=function(t){return this._rand(t)},"object"==typeof window)window.crypto&&window.crypto.getRandomValues?n.prototype._rand=function(t){var e=new Uint8Array(t);return window.crypto.getRandomValues(e),e}:window.msCrypto&&window.msCrypto.getRandomValues?n.prototype._rand=function(t){var e=new Uint8Array(t);return window.msCrypto.getRandomValues(e),e}:n.prototype._rand=function(){throw new Error("Not implemented yet")};else try{var s=t("crypto");n.prototype._rand=function(t){return s.randomBytes(t)}}catch(o){n.prototype._rand=function(t){for(var e=new Uint8Array(t),r=0;r=this._delta8){t=this.pending;var r=t.length%this._delta8;this.pending=t.slice(t.length-r,t.length),0===this.pending.length&&(this.pending=null),t=s.join32(t,0,t.length-r,this.endian);for(var n=0;ni;i++)n[i]=0;if(t<<=3,"big"===this.endian){for(var s=8;s>>24&255,n[i++]=t>>>16&255,n[i++]=t>>>8&255,n[i++]=255&t}else{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;for(var s=8;sthis.blockSize&&(t=(new this.Hash).update(t).digest()),o(t.length<=this.blockSize);for(var e=t.length;e=t?e^r^n:31>=t?e&r|~e&n:47>=t?(e|~r)^n:63>=t?e&n|r&~n:e^(r|~n)}function s(t){return 15>=t?0:31>=t?1518500249:47>=t?1859775393:63>=t?2400959708:2840853838}function o(t){return 15>=t?1352829926:31>=t?1548603684:47>=t?1836072691:63>=t?2053994217:0}var a=t("../hash"),f=a.utils,u=f.rotl32,c=f.sum32,h=f.sum32_3,d=f.sum32_4,p=a.common.BlockHash;f.inherits(n,p),r.ripemd160=n,n.blockSize=512,n.outSize=160,n.hmacStrength=192,n.padLength=64,n.prototype._update=function(t,e){for(var r=this.h[0],n=this.h[1],a=this.h[2],f=this.h[3],p=this.h[4],y=r,v=n,_=a,w=f,S=p,I=0;80>I;I++){var k=c(u(d(r,i(I,n,a,f),t[l[I]+e],s(I)),g[I]),p);r=p,p=f,f=u(a,10),a=n,n=k,k=c(u(d(y,i(79-I,v,_,w),t[b[I]+e],o(I)),m[I]),S),y=S,S=w,w=u(_,10),_=v,v=k}k=h(this.h[1],a,w),this.h[1]=h(this.h[2],f,S),this.h[2]=h(this.h[3],p,y),this.h[3]=h(this.h[4],r,v),this.h[4]=h(this.h[0],n,_),this.h[0]=k},n.prototype._digest=function(t){return"hex"===t?f.toHex32(this.h,"little"):f.split32(this.h,"little")};var l=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],b=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],g=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],m=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},{"../hash":104}],108:[function(t,e,r){function n(){return this instanceof n?(G.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=W,void(this.W=new Array(64))):new n}function i(){return this instanceof i?(n.call(this),void(this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])):new i}function s(){return this instanceof s?(G.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=X,void(this.W=new Array(160))):new s}function o(){return this instanceof o?(s.call(this),void(this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428])):new o}function a(){return this instanceof a?(G.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],void(this.W=new Array(80))):new a}function f(t,e,r){return t&e^~t&r}function u(t,e,r){return t&e^t&r^e&r}function c(t,e,r){return t^e^r}function h(t){return M(t,2)^M(t,13)^M(t,22)}function d(t){return M(t,6)^M(t,11)^M(t,25)}function p(t){return M(t,7)^M(t,18)^t>>>3}function l(t){return M(t,17)^M(t,19)^t>>>10}function b(t,e,r,n){return 0===t?f(e,r,n):1===t||3===t?c(e,r,n):2===t?u(e,r,n):void 0}function g(t,e,r,n,i,s){var o=t&r^~t&i;return 0>o&&(o+=4294967296),o}function m(t,e,r,n,i,s){var o=e&n^~e&s;return 0>o&&(o+=4294967296),o}function y(t,e,r,n,i,s){var o=t&r^t&i^r&i;return 0>o&&(o+=4294967296),o}function v(t,e,r,n,i,s){var o=e&n^e&s^n&s;return 0>o&&(o+=4294967296),o}function _(t,e){var r=j(t,e,28),n=j(e,t,2),i=j(e,t,7),s=r^n^i;return 0>s&&(s+=4294967296),s}function w(t,e){var r=U(t,e,28),n=U(e,t,2),i=U(e,t,7),s=r^n^i;return 0>s&&(s+=4294967296),s}function S(t,e){var r=j(t,e,14),n=j(t,e,18),i=j(e,t,9),s=r^n^i;return 0>s&&(s+=4294967296),s}function I(t,e){var r=U(t,e,14),n=U(t,e,18),i=U(e,t,9),s=r^n^i;return 0>s&&(s+=4294967296),s}function k(t,e){var r=j(t,e,1),n=j(t,e,8),i=L(t,e,7),s=r^n^i;return 0>s&&(s+=4294967296),s}function E(t,e){var r=U(t,e,1),n=U(t,e,8),i=D(t,e,7),s=r^n^i;return 0>s&&(s+=4294967296),s}function A(t,e){var r=j(t,e,19),n=j(e,t,29),i=L(t,e,6),s=r^n^i;return 0>s&&(s+=4294967296),s}function x(t,e){var r=U(t,e,19),n=U(e,t,29),i=D(t,e,6),s=r^n^i;return 0>s&&(s+=4294967296),s}var P=t("../hash"),O=P.utils,B=O.assert,M=O.rotr32,R=O.rotl32,T=O.sum32,C=O.sum32_4,N=O.sum32_5,j=O.rotr64_hi,U=O.rotr64_lo,L=O.shr64_hi,D=O.shr64_lo,z=O.sum64,F=O.sum64_hi,K=O.sum64_lo,H=O.sum64_4_hi,q=O.sum64_4_lo,V=O.sum64_5_hi,Y=O.sum64_5_lo,G=P.common.BlockHash,W=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],X=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],J=[1518500249,1859775393,2400959708,3395469782];O.inherits(n,G),r.sha256=n,n.blockSize=512,n.outSize=256,n.hmacStrength=192,n.padLength=64,n.prototype._update=function(t,e){for(var r=this.W,n=0;16>n;n++)r[n]=t[e+n];for(;nn;n++)r[n]=t[e+n];for(;nn;n++)r[n]=t[e+n];for(;n>8,o=255&i;s?r.push(s,o):r.push(o)}else for(var n=0;n>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24;return e>>>0}function o(t,e){for(var r="",n=0;n>>0}return s}function c(t,e){for(var r=new Array(4*t.length),n=0,i=0;n>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=255&s):(r[i+3]=s>>>24,r[i+2]=s>>>16&255,r[i+1]=s>>>8&255,r[i]=255&s)}return r}function h(t,e){return t>>>e|t<<32-e}function d(t,e){return t<>>32-e}function p(t,e){return t+e>>>0}function l(t,e,r){return t+e+r>>>0}function b(t,e,r,n){return t+e+r+n>>>0}function g(t,e,r,n,i){return t+e+r+n+i>>>0}function m(t,e){if(!t)throw new Error(e||"Assertion failed")}function y(t,e,r,n){var i=t[e],s=t[e+1],o=n+s>>>0,a=(n>o?1:0)+r+i;t[e]=a>>>0,t[e+1]=o}function v(t,e,r,n){var i=e+n>>>0,s=(e>i?1:0)+t+r;return s>>>0}function _(t,e,r,n){var i=e+n;return i>>>0}function w(t,e,r,n,i,s,o,a){var f=0,u=e;u=u+n>>>0,f+=e>u?1:0,u=u+s>>>0,f+=s>u?1:0,u=u+a>>>0,f+=a>u?1:0;var c=t+r+i+o+f;return c>>>0}function S(t,e,r,n,i,s,o,a){var f=e+n+s+a;return f>>>0}function I(t,e,r,n,i,s,o,a,f,u){var c=0,h=e;h=h+n>>>0,c+=e>h?1:0,h=h+s>>>0,c+=s>h?1:0,h=h+a>>>0,c+=a>h?1:0,h=h+u>>>0,c+=u>h?1:0;var d=t+r+i+o+f+c;return d>>>0}function k(t,e,r,n,i,s,o,a,f,u){var c=e+n+s+a+u;return c>>>0}function E(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}function A(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}function x(t,e,r){return t>>>r}function P(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}var O=r,B=t("inherits");O.toArray=n,O.toHex=i,O.htonl=s,O.toHex32=o,O.zero2=a,O.zero8=f,O.join32=u,O.split32=c,O.rotr32=h,O.rotl32=d,O.sum32=p,O.sum32_3=l,O.sum32_4=b,O.sum32_5=g,O.assert=m,O.inherits=B,r.sum64=y,r.sum64_hi=v,r.sum64_lo=_,r.sum64_4_hi=w,r.sum64_4_lo=S,r.sum64_5_hi=I,r.sum64_5_lo=k,r.rotr64_hi=E,r.rotr64_lo=A,r.shr64_hi=x,r.shr64_lo=P},{inherits:296}],110:[function(t,e,r){e.exports={name:"elliptic",version:"6.2.2",description:"EC cryptography",main:"lib/elliptic.js",files:["lib"],scripts:{test:"make lint && istanbul test _mocha --reporter=spec test/*-test.js",coveralls:"cat ./coverage/lcov.info | coveralls"},repository:{type:"git",url:"git+ssh://git@github.com/indutny/elliptic.git"},keywords:["EC","Elliptic","curve","Cryptography"],author:{name:"Fedor Indutny",email:"fedor@indutny.com"},license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{browserify:"^3.44.2",coveralls:"^2.11.3",istanbul:"^0.3.17",jscs:"^1.11.3",jshint:"^2.6.0",mocha:"^2.1.0","uglify-js":"^2.4.13"},dependencies:{"bn.js":"^4.0.0",brorand:"^1.0.1","hash.js":"^1.0.0",inherits:"^2.0.1"},gitHead:"628eb61186a7f1c81247cf991d808dc9ead83645",_id:"elliptic@6.2.2",_shasum:"806bfa651a5aa4996a1e79c92b573761ea7d7574",_from:"elliptic@>=6.0.0 <7.0.0",_npmVersion:"3.3.12",_nodeVersion:"5.4.1",_npmUser:{name:"indutny",email:"fedor@indutny.com"},dist:{shasum:"806bfa651a5aa4996a1e79c92b573761ea7d7574",tarball:"http://registry.npmjs.org/elliptic/-/elliptic-6.2.2.tgz"},maintainers:[{name:"indutny",email:"fedor@indutny.com"}],directories:{},_resolved:"https://registry.npmjs.org/elliptic/-/elliptic-6.2.2.tgz",readme:"ERROR: No README data found!"}},{}],111:[function(t,e,r){e.exports={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}},{}],112:[function(t,e,r){var n=t("asn1.js"),i=n.define("RSAPrivateKey",function(){this.seq().obj(this.key("version")["int"](),this.key("modulus")["int"](),this.key("publicExponent")["int"](),this.key("privateExponent")["int"](),this.key("prime1")["int"](),this.key("prime2")["int"](),this.key("exponent1")["int"](),this.key("exponent2")["int"](),this.key("coefficient")["int"]())});r.RSAPrivateKey=i;var s=n.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus")["int"](),this.key("publicExponent")["int"]())});r.RSAPublicKey=s;var o=n.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(a),this.key("subjectPublicKey").bitstr())});r.PublicKey=o;var a=n.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p")["int"](),this.key("q")["int"](),this.key("g")["int"]()).optional())}),f=n.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version")["int"](),this.key("algorithm").use(a),this.key("subjectPrivateKey").octstr())});r.PrivateKey=f;var u=n.define("EncryptedPrivateKeyInfo",function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters")["int"]())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())});r.EncryptedPrivateKey=u;var c=n.define("DSAPrivateKey",function(){this.seq().obj(this.key("version")["int"](),this.key("p")["int"](),this.key("q")["int"](),this.key("g")["int"](),this.key("pub_key")["int"](),this.key("priv_key")["int"]())});r.DSAPrivateKey=c,r.DSAparam=n.define("DSAparam",function(){this["int"]()});var h=n.define("ECPrivateKey",function(){this.seq().obj(this.key("version")["int"](),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(d),this.key("publicKey").optional().explicit(1).bitstr())});r.ECPrivateKey=h;var d=n.define("ECParameters",function(){this.choice({namedCurve:this.objid()})});r.signature=n.define("signature",function(){this.seq().obj(this.key("r")["int"](),this.key("s")["int"]())})},{"asn1.js":115}],113:[function(t,e,r){(function(r){var n=/Proc-Type: 4,ENCRYPTED\r?\nDEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)\r?\n\r?\n([0-9A-z\n\r\+\/\=]+)\r?\n/m,i=/^-----BEGIN (.*) KEY-----\r?\n/m,s=/^-----BEGIN (.*) KEY-----\r?\n([0-9A-z\n\r\+\/\=]+)\r?\n-----END \1 KEY-----$/m,o=t("evp_bytestokey"),a=t("browserify-aes");e.exports=function(t,e){var f,u=t.toString(),c=u.match(n);if(c){var h="aes"+c[1],d=new r(c[2],"hex"),p=new r(c[3].replace(/\r?\n/g,""),"base64"),l=o(e,d.slice(0,8),parseInt(c[1],10)).key,b=[],g=a.createDecipheriv(h,l,d);b.push(g.update(p)),b.push(g["final"]()),f=r.concat(b)}else{var m=u.match(s);f=new r(m[2].replace(/\r?\n/g,""),"base64")}var y=u.match(i)[1]+" KEY";return{tag:y,data:f}}}).call(this,t("buffer").Buffer)},{"browserify-aes":132,buffer:48,evp_bytestokey:147}],114:[function(t,e,r){(function(r){function n(t){var e;"object"!=typeof t||r.isBuffer(t)||(e=t.passphrase,t=t.key),"string"==typeof t&&(t=new r(t));var n,o,f=a(t,e),u=f.tag,c=f.data;switch(u){case"PUBLIC KEY":switch(o=s.PublicKey.decode(c,"der"),n=o.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return s.RSAPublicKey.decode(o.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return o.subjectPrivateKey=o.subjectPublicKey,{type:"ec",data:o};case"1.2.840.10040.4.1":return o.algorithm.params.pub_key=s.DSAparam.decode(o.subjectPublicKey.data,"der"),{type:"dsa",data:o.algorithm.params};default:throw new Error("unknown key id "+n)}throw new Error("unknown key type "+u);case"ENCRYPTED PRIVATE KEY":c=s.EncryptedPrivateKey.decode(c,"der"),c=i(c,e);case"PRIVATE KEY":switch(o=s.PrivateKey.decode(c,"der"),n=o.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return s.RSAPrivateKey.decode(o.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:o.algorithm.curve,privateKey:s.ECPrivateKey.decode(o.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return o.algorithm.params.priv_key=s.DSAparam.decode(o.subjectPrivateKey,"der"),{type:"dsa",params:o.algorithm.params};default:throw new Error("unknown key id "+n)}throw new Error("unknown key type "+u);case"RSA PUBLIC KEY":return s.RSAPublicKey.decode(c,"der");case"RSA PRIVATE KEY":return s.RSAPrivateKey.decode(c,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:s.DSAPrivateKey.decode(c,"der")};case"EC PRIVATE KEY":return c=s.ECPrivateKey.decode(c,"der"),{curve:c.parameters.value,privateKey:c.privateKey};default:throw new Error("unknown key type "+u)}}function i(t,e){var n=t.algorithm.decrypt.kde.kdeparams.salt,i=parseInt(t.algorithm.decrypt.kde.kdeparams.iters.toString(),10),s=o[t.algorithm.decrypt.cipher.algo.join(".")],a=t.algorithm.decrypt.cipher.iv,c=t.subjectPrivateKey,h=parseInt(s.split("-")[1],10)/8,d=u.pbkdf2Sync(e,n,i,h),p=f.createDecipheriv(s,d,a),l=[];return l.push(p.update(c)),l.push(p["final"]()),r.concat(l)}var s=t("./asn1"),o=t("./aesid.json"),a=t("./fixProc"),f=t("browserify-aes"),u=t("pbkdf2");e.exports=n,n.signature=s.signature}).call(this,t("buffer").Buffer)},{"./aesid.json":111,"./asn1":112,"./fixProc":113,"browserify-aes":132,buffer:48,pbkdf2:197}],115:[function(t,e,r){var n=r;n.bignum=t("bn.js"),n.define=t("./asn1/api").define,n.base=t("./asn1/base"),n.constants=t("./asn1/constants"),n.decoders=t("./asn1/decoders"),n.encoders=t("./asn1/encoders")},{"./asn1/api":116,"./asn1/base":118,"./asn1/constants":122,"./asn1/decoders":124,"./asn1/encoders":127,"bn.js":85}],116:[function(t,e,r){function n(t,e){this.name=t,this.body=e,this.decoders={},this.encoders={}}var i=t("../asn1"),s=t("inherits"),o=r;o.define=function(t,e){return new n(t,e)},n.prototype._createNamed=function(e){var r;try{r=t("vm").runInThisContext("(function "+this.name+"(entity) {\n this._initNamed(entity);\n})")}catch(n){r=function(t){this._initNamed(t)}}return s(r,e),r.prototype._initNamed=function(t){e.call(this,t)},new r(this)},n.prototype._getDecoder=function(t){return this.decoders.hasOwnProperty(t)||(this.decoders[t]=this._createNamed(i.decoders[t])),this.decoders[t]},n.prototype.decode=function(t,e,r){return this._getDecoder(e).decode(t,r)},n.prototype._getEncoder=function(t){return this.encoders.hasOwnProperty(t)||(this.encoders[t]=this._createNamed(i.encoders[t])),this.encoders[t]},n.prototype.encode=function(t,e,r){return this._getEncoder(e).encode(t,r)}},{"../asn1":115,inherits:296,vm:270}],117:[function(t,e,r){function n(t,e){return o.call(this,e),a.isBuffer(t)?(this.base=t,this.offset=0,void(this.length=t.length)):void this.error("Input not Buffer")}function i(t,e){if(Array.isArray(t))this.length=0,this.value=t.map(function(t){return t instanceof i||(t=new i(t,e)),this.length+=t.length,t},this);else if("number"==typeof t){if(!(t>=0&&255>=t))return e.error("non-byte EncoderBuffer value");this.value=t,this.length=1}else if("string"==typeof t)this.value=t,this.length=a.byteLength(t);else{if(!a.isBuffer(t))return e.error("Unsupported type: "+typeof t);this.value=t,this.length=t.length}}var s=t("inherits"),o=t("../base").Reporter,a=t("buffer").Buffer;s(n,o),r.DecoderBuffer=n,n.prototype.save=function(){return{offset:this.offset,reporter:o.prototype.save.call(this)}},n.prototype.restore=function(t){var e=new n(this.base);return e.offset=t.offset,e.length=this.offset,this.offset=t.offset,o.prototype.restore.call(this,t.reporter),e},n.prototype.isEmpty=function(){return this.offset===this.length},n.prototype.readUInt8=function(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},n.prototype.skip=function(t,e){if(!(this.offset+t<=this.length))return this.error(e||"DecoderBuffer overrun");var r=new n(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+t,this.offset+=t,r},n.prototype.raw=function(t){return this.base.slice(t?t.offset:this.offset,this.length)},r.EncoderBuffer=i,i.prototype.join=function(t,e){return t||(t=new a(this.length)),e||(e=0),0===this.length?t:(Array.isArray(this.value)?this.value.forEach(function(r){r.join(t,e),e+=r.length}):("number"==typeof this.value?t[e]=this.value:"string"==typeof this.value?t.write(this.value,e):a.isBuffer(this.value)&&this.value.copy(t,e),e+=this.length),t)}},{"../base":118,buffer:48,inherits:296}],118:[function(t,e,r){var n=r;n.Reporter=t("./reporter").Reporter,n.DecoderBuffer=t("./buffer").DecoderBuffer,n.EncoderBuffer=t("./buffer").EncoderBuffer,n.Node=t("./node")},{"./buffer":117,"./node":119,"./reporter":120}],119:[function(t,e,r){function n(t,e){var r={};this._baseState=r,r.enc=t,r.parent=e||null,r.children=null,r.tag=null,r.args=null,r.reverseArgs=null,r.choice=null,r.optional=!1,r.any=!1,r.obj=!1,r.use=null,r.useDecoder=null,r.key=null,r["default"]=null,r.explicit=null,r.implicit=null,r.parent||(r.children=[],this._wrap())}var i=t("../base").Reporter,s=t("../base").EncoderBuffer,o=t("minimalistic-assert"),a=["seq","seqof","set","setof","octstr","bitstr","objid","bool","gentime","utctime","null_","enum","int","ia5str","utf8str","bmpstr","numstr","printstr"],f=["key","obj","use","optional","explicit","implicit","def","choice","any"].concat(a),u=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];e.exports=n;var c=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit"];n.prototype.clone=function(){var t=this._baseState,e={};c.forEach(function(r){e[r]=t[r]});var r=new this.constructor(e.parent);return r._baseState=e,r},n.prototype._wrap=function(){var t=this._baseState;f.forEach(function(e){this[e]=function(){var r=new this.constructor(this);return t.children.push(r),r[e].apply(r,arguments)}},this)},n.prototype._init=function(t){var e=this._baseState;o(null===e.parent),t.call(this),e.children=e.children.filter(function(t){return t._baseState.parent===this},this),o.equal(e.children.length,1,"Root node can have only one child")},n.prototype._useArgs=function(t){var e=this._baseState,r=t.filter(function(t){return t instanceof this.constructor},this);t=t.filter(function(t){return!(t instanceof this.constructor)},this),0!==r.length&&(o(null===e.children),e.children=r,r.forEach(function(t){t._baseState.parent=this},this)),0!==t.length&&(o(null===e.args),e.args=t,e.reverseArgs=t.map(function(t){if("object"!=typeof t||t.constructor!==Object)return t;var e={};return Object.keys(t).forEach(function(r){r==(0|r)&&(r|=0);var n=t[r];e[n]=r}),e}))},u.forEach(function(t){n.prototype[t]=function(){var e=this._baseState;throw new Error(t+" not implemented for encoding: "+e.enc)}}),a.forEach(function(t){n.prototype[t]=function(){var e=this._baseState,r=Array.prototype.slice.call(arguments);return o(null===e.tag),e.tag=t,this._useArgs(r),this}}),n.prototype.use=function(t){var e=this._baseState;return o(null===e.use),e.use=t,this},n.prototype.optional=function(){var t=this._baseState;return t.optional=!0,this},n.prototype.def=function(t){var e=this._baseState;return o(null===e["default"]),e["default"]=t,e.optional=!0,this},n.prototype.explicit=function(t){var e=this._baseState;return o(null===e.explicit&&null===e.implicit),e.explicit=t,this},n.prototype.implicit=function(t){var e=this._baseState;return o(null===e.explicit&&null===e.implicit),e.implicit=t,this},n.prototype.obj=function(){var t=this._baseState,e=Array.prototype.slice.call(arguments);return t.obj=!0,0!==e.length&&this._useArgs(e),this},n.prototype.key=function(t){var e=this._baseState;return o(null===e.key),e.key=t,this},n.prototype.any=function(){var t=this._baseState;return t.any=!0,this},n.prototype.choice=function(t){var e=this._baseState;return o(null===e.choice), e.choice=t,this._useArgs(Object.keys(t).map(function(e){return t[e]})),this},n.prototype._decode=function(t){var e=this._baseState;if(null===e.parent)return t.wrapResult(e.children[0]._decode(t));var r,n=e["default"],i=!0;if(null!==e.key&&(r=t.enterKey(e.key)),e.optional){var s=null;if(null!==e.explicit?s=e.explicit:null!==e.implicit?s=e.implicit:null!==e.tag&&(s=e.tag),null!==s||e.any){if(i=this._peekTag(t,s,e.any),t.isError(i))return i}else{var o=t.save();try{null===e.choice?this._decodeGeneric(e.tag,t):this._decodeChoice(t),i=!0}catch(a){i=!1}t.restore(o)}}var f;if(e.obj&&i&&(f=t.enterObject()),i){if(null!==e.explicit){var u=this._decodeTag(t,e.explicit);if(t.isError(u))return u;t=u}if(null===e.use&&null===e.choice){if(e.any)var o=t.save();var c=this._decodeTag(t,null!==e.implicit?e.implicit:e.tag,e.any);if(t.isError(c))return c;e.any?n=t.raw(o):t=c}if(n=e.any?n:null===e.choice?this._decodeGeneric(e.tag,t):this._decodeChoice(t),t.isError(n))return n;if(!e.any&&null===e.choice&&null!==e.children){var h=e.children.some(function(e){e._decode(t)});if(h)return err}}return e.obj&&i&&(n=t.leaveObject(f)),null===e.key||null===n&&i!==!0||t.leaveKey(r,e.key,n),n},n.prototype._decodeGeneric=function(t,e){var r=this._baseState;return"seq"===t||"set"===t?null:"seqof"===t||"setof"===t?this._decodeList(e,t,r.args[0]):"octstr"===t||"bitstr"===t?this._decodeStr(e,t):"ia5str"===t||"utf8str"===t||"bmpstr"===t?this._decodeStr(e,t):"numstr"===t||"printstr"===t?this._decodeStr(e,t):"objid"===t&&r.args?this._decodeObjid(e,r.args[0],r.args[1]):"objid"===t?this._decodeObjid(e,null,null):"gentime"===t||"utctime"===t?this._decodeTime(e,t):"null_"===t?this._decodeNull(e):"bool"===t?this._decodeBool(e):"int"===t||"enum"===t?this._decodeInt(e,r.args&&r.args[0]):null!==r.use?this._getUse(r.use,e._reporterState.obj)._decode(e):e.error("unknown tag: "+t)},n.prototype._getUse=function(t,e){var r=this._baseState;return r.useDecoder=this._use(t,e),o(null===r.useDecoder._baseState.parent),r.useDecoder=r.useDecoder._baseState.children[0],r.implicit!==r.useDecoder._baseState.implicit&&(r.useDecoder=r.useDecoder.clone(),r.useDecoder._baseState.implicit=r.implicit),r.useDecoder},n.prototype._decodeChoice=function(t){var e=this._baseState,r=null,n=!1;return Object.keys(e.choice).some(function(i){var s=t.save(),o=e.choice[i];try{var a=o._decode(t);if(t.isError(a))return!1;r={type:i,value:a},n=!0}catch(f){return t.restore(s),!1}return!0},this),n?r:t.error("Choice not matched")},n.prototype._createEncoderBuffer=function(t){return new s(t,this.reporter)},n.prototype._encode=function(t,e,r){var n=this._baseState;if(null===n["default"]||n["default"]!==t){var i=this._encodeValue(t,e,r);if(void 0!==i&&!this._skipDefault(i,e,r))return i}},n.prototype._encodeValue=function(t,e,r){var n=this._baseState;if(null===n.parent)return n.children[0]._encode(t,e||new i);var s=null;if(this.reporter=e,n.optional&&void 0===t){if(null===n["default"])return;t=n["default"]}var o=null,a=!1;if(n.any)s=this._createEncoderBuffer(t);else if(n.choice)s=this._encodeChoice(t,e);else if(n.children)o=n.children.map(function(r){if("null_"===r._baseState.tag)return r._encode(null,e,t);if(null===r._baseState.key)return e.error("Child should have a key");var n=e.enterKey(r._baseState.key);if("object"!=typeof t)return e.error("Child expected, but input is not object");var i=r._encode(t[r._baseState.key],e,t);return e.leaveKey(n),i},this).filter(function(t){return t}),o=this._createEncoderBuffer(o);else if("seqof"===n.tag||"setof"===n.tag){if(!n.args||1!==n.args.length)return e.error("Too many args for : "+n.tag);if(!Array.isArray(t))return e.error("seqof/setof, but data is not Array");var f=this.clone();f._baseState.implicit=null,o=this._createEncoderBuffer(t.map(function(r){var n=this._baseState;return this._getUse(n.args[0],t)._encode(r,e)},f))}else null!==n.use?s=this._getUse(n.use,r)._encode(t,e):(o=this._encodePrimitive(n.tag,t),a=!0);var s;if(!n.any&&null===n.choice){var u=null!==n.implicit?n.implicit:n.tag,c=null===n.implicit?"universal":"context";null===u?null===n.use&&e.error("Tag could be ommited only for .use()"):null===n.use&&(s=this._encodeComposite(u,a,c,o))}return null!==n.explicit&&(s=this._encodeComposite(n.explicit,!1,"context",s)),s},n.prototype._encodeChoice=function(t,e){var r=this._baseState,n=r.choice[t.type];return n||o(!1,t.type+" not found in "+JSON.stringify(Object.keys(r.choice))),n._encode(t.value,e)},n.prototype._encodePrimitive=function(t,e){var r=this._baseState;if("octstr"===t||"bitstr"===t||"ia5str"===t)return this._encodeStr(e,t);if("utf8str"===t||"bmpstr"===t)return this._encodeStr(e,t);if("numstr"===t||"printstr"===t)return this._encodeStr(e,t);if("objid"===t&&r.args)return this._encodeObjid(e,r.reverseArgs[0],r.args[1]);if("objid"===t)return this._encodeObjid(e,null,null);if("gentime"===t||"utctime"===t)return this._encodeTime(e,t);if("null_"===t)return this._encodeNull();if("int"===t||"enum"===t)return this._encodeInt(e,r.args&&r.reverseArgs[0]);if("bool"===t)return this._encodeBool(e);throw new Error("Unsupported tag: "+t)},n.prototype._isNumstr=function(t){return/^[0-9 ]*$/.test(t)},n.prototype._isPrintstr=function(t){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(t)}},{"../base":118,"minimalistic-assert":129}],120:[function(t,e,r){function n(t){this._reporterState={obj:null,path:[],options:t||{},errors:[]}}function i(t,e){this.path=t,this.rethrow(e)}var s=t("inherits");r.Reporter=n,n.prototype.isError=function(t){return t instanceof i},n.prototype.save=function(){var t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}},n.prototype.restore=function(t){var e=this._reporterState;e.obj=t.obj,e.path=e.path.slice(0,t.pathLen)},n.prototype.enterKey=function(t){return this._reporterState.path.push(t)},n.prototype.leaveKey=function(t,e,r){var n=this._reporterState;n.path=n.path.slice(0,t-1),null!==n.obj&&(n.obj[e]=r)},n.prototype.enterObject=function(){var t=this._reporterState,e=t.obj;return t.obj={},e},n.prototype.leaveObject=function(t){var e=this._reporterState,r=e.obj;return e.obj=t,r},n.prototype.error=function(t){var e,r=this._reporterState,n=t instanceof i;if(e=n?t:new i(r.path.map(function(t){return"["+JSON.stringify(t)+"]"}).join(""),t.message||t,t.stack),!r.options.partial)throw e;return n||r.errors.push(e),e},n.prototype.wrapResult=function(t){var e=this._reporterState;return e.options.partial?{result:this.isError(t)?null:t,errors:e.errors}:t},s(i,Error),i.prototype.rethrow=function(t){return this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace(this,i),this}},{inherits:296}],121:[function(t,e,r){var n=t("../constants");r.tagClass={0:"universal",1:"application",2:"context",3:"private"},r.tagClassByName=n._reverse(r.tagClass),r.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},r.tagByName=n._reverse(r.tag)},{"../constants":122}],122:[function(t,e,r){var n=r;n._reverse=function(t){var e={};return Object.keys(t).forEach(function(r){(0|r)==r&&(r=0|r);var n=t[r];e[n]=r}),e},n.der=t("./der")},{"./der":121}],123:[function(t,e,r){function n(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new i,this.tree._init(t.body)}function i(t){u.Node.call(this,"der",t)}function s(t,e){var r=t.readUInt8(e);if(t.isError(r))return r;var n=h.tagClass[r>>6],i=0===(32&r);if(31===(31&r)){var s=r;for(r=0;128===(128&s);){if(s=t.readUInt8(e),t.isError(s))return s;r<<=7,r|=127&s}}else r&=31;var o=h.tag[r];return{cls:n,primitive:i,tag:r,tagStr:o}}function o(t,e,r){var n=t.readUInt8(r);if(t.isError(n))return n;if(!e&&128===n)return null;if(0===(128&n))return n;var i=127&n;if(i>=4)return t.error("length octect is too long");n=0;for(var s=0;i>s;s++){n<<=8;var o=t.readUInt8(r);if(t.isError(o))return o;n|=o}return n}var a=t("inherits"),f=t("../../asn1"),u=f.base,c=f.bignum,h=f.constants.der;e.exports=n,n.prototype.decode=function(t,e){return t instanceof u.DecoderBuffer||(t=new u.DecoderBuffer(t,e)),this.tree._decode(t,e)},a(i,u.Node),i.prototype._peekTag=function(t,e,r){if(t.isEmpty())return!1;var n=t.save(),i=s(t,'Failed to peek tag: "'+e+'"');return t.isError(i)?i:(t.restore(n),i.tag===e||i.tagStr===e||r)},i.prototype._decodeTag=function(t,e,r){var n=s(t,'Failed to decode tag of "'+e+'"');if(t.isError(n))return n;var i=o(t,n.primitive,'Failed to get length of "'+e+'"');if(t.isError(i))return i;if(!r&&n.tag!==e&&n.tagStr!==e&&n.tagStr+"of"!==e)return t.error('Failed to match tag: "'+e+'"');if(n.primitive||null!==i)return t.skip(i,'Failed to match body of: "'+e+'"');var a=t.save(),f=this._skipUntilEnd(t,'Failed to skip indefinite length body: "'+this.tag+'"');return t.isError(f)?f:(i=t.offset-a.offset,t.restore(a),t.skip(i,'Failed to match body of: "'+e+'"'))},i.prototype._skipUntilEnd=function(t,e){for(;;){var r=s(t,e);if(t.isError(r))return r;var n=o(t,r.primitive,e);if(t.isError(n))return n;var i;if(i=r.primitive||null!==n?t.skip(n):this._skipUntilEnd(t,e),t.isError(i))return i;if("end"===r.tagStr)break}},i.prototype._decodeList=function(t,e,r){for(var n=[];!t.isEmpty();){var i=this._peekTag(t,"end");if(t.isError(i))return i;var s=r.decode(t,"der");if(t.isError(s)&&i)break;n.push(s)}return n},i.prototype._decodeStr=function(t,e){if("octstr"===e)return t.raw();if("bitstr"===e){var r=t.readUInt8();return t.isError(r)?r:{unused:r,data:t.raw()}}if("ia5str"===e||"utf8str"===e)return t.raw().toString();if("numstr"===e){var n=t.raw().toString("ascii");return this._isNumstr(n)?n:t.error("Decoding of string type: numstr unsupported characters")}if("printstr"===e){var i=t.raw().toString("ascii");return this._isPrintstr(i)?i:t.error("Decoding of string type: printstr unsupported characters")}if("bmpstr"===e){var s=t.raw();if(s.length%2===1)return t.error("Decoding of string type: bmpstr length mismatch");for(var o="",a=0;an?2e3+n:1900+n}return Date.UTC(n,i-1,s,o,a,f,0)},i.prototype._decodeNull=function(t){return null},i.prototype._decodeBool=function(t){var e=t.readUInt8();return t.isError(e)?e:0!==e},i.prototype._decodeInt=function(t,e){var r=t.raw(),n=new c(r);return e&&(n=e[n.toString(10)]||n),n},i.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getDecoder("der").tree}},{"../../asn1":115,inherits:296}],124:[function(t,e,r){var n=r;n.der=t("./der"),n.pem=t("./pem")},{"./der":123,"./pem":125}],125:[function(t,e,r){function n(t){o.call(this,t),this.enc="pem"}var i=t("inherits"),s=t("buffer").Buffer,o=(t("../../asn1"),t("./der"));i(n,o),e.exports=n,n.prototype.decode=function(t,e){for(var r=t.toString().split(/[\r\n]+/g),n=e.label.toUpperCase(),i=/^-----(BEGIN|END) ([^-]+)-----$/,a=-1,f=-1,u=0;ut?"0"+t:t}function o(t,e,r,n){var i;if("seqof"===t?t="seq":"setof"===t&&(t="set"),h.tagByName.hasOwnProperty(t))i=h.tagByName[t];else{if("number"!=typeof t||(0|t)!==t)return n.error("Unknown tag: "+t);i=t}return i>=31?n.error("Multi-octet tag encoding unsupported"):(e||(i|=32),i|=h.tagClassByName[r||"universal"]<<6)}var a=t("inherits"),f=t("buffer").Buffer,u=t("../../asn1"),c=u.base,h=(u.bignum,u.constants.der);e.exports=n,n.prototype.encode=function(t,e){return this.tree._encode(t,e).join()},a(i,c.Node),i.prototype._encodeComposite=function(t,e,r,n){var i=o(t,e,r,this.reporter);if(n.length<128){var s=new f(2);return s[0]=i,s[1]=n.length,this._createEncoderBuffer([s,n])}for(var a=1,u=n.length;u>=256;u>>=8)a++;var s=new f(2+a);s[0]=i,s[1]=128|a;for(var u=1+a,c=n.length;c>0;u--,c>>=8)s[u]=255&c;return this._createEncoderBuffer([s,n])},i.prototype._encodeStr=function(t,e){if("octstr"===e)return this._createEncoderBuffer(t);if("bitstr"===e)return this._createEncoderBuffer([0|t.unused,t.data]);if("ia5str"===e||"utf8str"===e)return this._createEncoderBuffer(t);if("bmpstr"===e){for(var r=new f(2*t.length),n=0;n=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}for(var i=0,n=0;n=128;s>>=7)i++}for(var o=new f(i),a=o.length-1,n=t.length-1;n>=0;n--){var s=t[n];for(o[a--]=127&s;(s>>=7)>0;)o[a--]=128|127&s}return this._createEncoderBuffer(o)},i.prototype._encodeTime=function(t,e){var r,n=new Date(t);return"gentime"===e?r=[s(n.getFullYear()),s(n.getUTCMonth()+1),s(n.getUTCDate()),s(n.getUTCHours()),s(n.getUTCMinutes()),s(n.getUTCSeconds()),"Z"].join(""):"utctime"===e?r=[s(n.getFullYear()%100),s(n.getUTCMonth()+1),s(n.getUTCDate()),s(n.getUTCHours()),s(n.getUTCMinutes()),s(n.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+e+" time is not supported yet"),this._encodeStr(r,"octstr")},i.prototype._encodeNull=function(){return this._createEncoderBuffer("")},i.prototype._encodeInt=function(t,e){if("string"==typeof t){if(!e)return this.reporter.error("String int or enum given, but no values map");if(!e.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=e[t]}if("number"!=typeof t&&!f.isBuffer(t)){var r=t.toArray();!t.sign&&128&r[0]&&r.unshift(0),t=new f(r)}if(f.isBuffer(t)){var n=t.length;0===t.length&&n++;var i=new f(n);return t.copy(i),0===t.length&&(i[0]=0),this._createEncoderBuffer(i)}if(128>t)return this._createEncoderBuffer(t);if(256>t)return this._createEncoderBuffer([0,t]);for(var n=1,s=t;s>=256;s>>=8)n++;for(var i=new Array(n),s=i.length-1;s>=0;s--)i[s]=255&t,t>>=8;return 128&i[0]&&i.unshift(0),this._createEncoderBuffer(new f(i))},i.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)},i.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getEncoder("der").tree},i.prototype._skipDefault=function(t,e,r){var n,i=this._baseState;if(null===i["default"])return!1;var s=t.join();if(void 0===i.defaultBuffer&&(i.defaultBuffer=this._encodeValue(i["default"],e,r).join()),s.length!==i.defaultBuffer.length)return!1;for(n=0;n0&&r.ishrn(n),r}function u(t,e){t=f(t,e),t=t.mod(e);var n=new r(t.toArray());if(n.lengthd&&(b=1),f=Math.min(t.length,h.length),t.length!==h.length&&(b=1),p=-1;++p=e)throw new Error("invalid sig")}var a=t("./curves"),f=t("elliptic"),u=t("parse-asn1"),c=t("bn.js"),h=f.ec;e.exports=n}).call(this,t("buffer").Buffer)},{"./curves":84,"bn.js":85,buffer:48,elliptic:87,"parse-asn1":114}],150:[function(t,e,r){(function(r){function n(t){this.curveType=a[t],this.curveType||(this.curveType={name:t}),this.curve=new s.ec(this.curveType.name),this.keys=void 0}function i(t,e,n){Array.isArray(t)||(t=t.toArray());var i=new r(t);if(n&&i.length=6.0.0 <7.0.0",_npmVersion:"3.3.12",_nodeVersion:"5.4.1",_npmUser:{name:"indutny",email:"fedor@indutny.com"},dist:{shasum:"806bfa651a5aa4996a1e79c92b573761ea7d7574",tarball:"http://registry.npmjs.org/elliptic/-/elliptic-6.2.2.tgz"},maintainers:[{name:"indutny",email:"fedor@indutny.com"}],directories:{},_resolved:"https://registry.npmjs.org/elliptic/-/elliptic-6.2.2.tgz"}},{}],176:[function(t,e,r){(function(r){"use strict";function n(t){u.call(this,"digest"),this._hash=t,this.buffers=[]}function i(t){u.call(this,"digest"),this._hash=t}var s=t("inherits"),o=t("./md5"),a=t("ripemd160"),f=t("sha.js"),u=t("cipher-base");s(n,u),n.prototype._update=function(t){this.buffers.push(t)},n.prototype._final=function(){var t=r.concat(this.buffers),e=this._hash(t);return this.buffers=null,e},s(i,u),i.prototype._update=function(t){this._hash.update(t)},i.prototype._final=function(){return this._hash.digest()},e.exports=function(t){return t=t.toLowerCase(),"md5"===t?new n(o):"rmd160"===t||"ripemd160"===t?new n(a):new i(f(t))}}).call(this,t("buffer").Buffer)},{"./md5":178,buffer:48,"cipher-base":179,inherits:296,ripemd160:180,"sha.js":182}],177:[function(t,e,r){(function(t){"use strict";function e(e,r){if(e.length%s!==0){var n=e.length+(s-e.length%s);e=t.concat([e,o],n)}for(var i=[],a=r?e.readInt32BE:e.readInt32LE,f=0;f>5]|=128<>>9<<4)+14]=e;for(var r=1732584193,n=-271733879,i=-1732584194,c=271733878,h=0;h>16)+(e>>16)+(r>>16);return n<<16|65535&r}function c(t,e){return t<>>32-e}var h=t("./helpers");e.exports=function(t){return h.hash(t,n,16)}},{"./helpers":177}],179:[function(t,e,r){arguments[4][69][0].apply(r,arguments)},{buffer:48,dup:69,inherits:296,stream:265,string_decoder:266}],180:[function(t,e,r){(function(t){function r(t){for(var e=[],r=0,n=0;r>>5]|=t[r]<<24-n%32;return e}function n(t){for(var e=[],r=0;r<32*t.length;r+=8)e.push(t[r>>>5]>>>24-r%32&255);return e}function i(t,e,r){for(var n=0;16>n;n++){var i=r+n,h=e[i];e[i]=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8)}var y,v,_,w,S,I,k,E,A,x;I=y=t[0],k=v=t[1],E=_=t[2],A=w=t[3],x=S=t[4];var P;for(n=0;80>n;n+=1)P=y+e[r+d[n]]|0,P+=16>n?s(v,_,w)+g[0]:32>n?o(v,_,w)+g[1]:48>n?a(v,_,w)+g[2]:64>n?f(v,_,w)+g[3]:u(v,_,w)+g[4],P=0|P,P=c(P,l[n]),P=P+S|0,y=S,S=w,w=c(_,10),_=v,v=P,P=I+e[r+p[n]]|0,P+=16>n?u(k,E,A)+m[0]:32>n?f(k,E,A)+m[1]:48>n?a(k,E,A)+m[2]:64>n?o(k,E,A)+m[3]:s(k,E,A)+m[4],P=0|P,P=c(P,b[n]),P=P+x|0,I=x,x=A,A=c(E,10),E=k,k=P;P=t[1]+_+A|0,t[1]=t[2]+w+x|0,t[2]=t[3]+S+I|0,t[3]=t[4]+y+k|0,t[4]=t[0]+v+E|0,t[0]=P}function s(t,e,r){return t^e^r}function o(t,e,r){return t&e|~t&r}function a(t,e,r){return(t|~e)^r}function f(t,e,r){return t&r|e&~r}function u(t,e,r){return t^(e|~r)}function c(t,e){return t<>>32-e}function h(e){var s=[1732584193,4023233417,2562383102,271733878,3285377520];"string"==typeof e&&(e=new t(e,"utf8"));var o=r(e),a=8*e.length,f=8*e.length;o[a>>>5]|=128<<24-a%32,o[(a+64>>>9<<4)+14]=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8);for(var u=0;uu;u++){var c=s[u];s[u]=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8)}var h=n(s);return new t(h)}var d=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],p=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],l=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],b=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],g=[0,1518500249,1859775393,2400959708,2840853838],m=[1352829926,1548603684,1836072691,2053994217,0];e.exports=h}).call(this,t("buffer").Buffer)},{buffer:48}],181:[function(t,e,r){(function(t){function r(e,r){this._block=new t(e),this._finalSize=r,this._blockSize=e,this._len=0,this._s=0}r.prototype.update=function(e,r){"string"==typeof e&&(r=r||"utf8",e=new t(e,r));for(var n=this._len+=e.length,i=this._s||0,s=0,o=this._block;n>i;){for(var a=Math.min(e.length,s+this._blockSize-i%this._blockSize),f=a-s,u=0;f>u;u++)o[i%this._blockSize+u]=e[u+s];i+=f,s+=f,i%this._blockSize===0&&this._update(o)}return this._s=i,this},r.prototype.digest=function(t){var e=8*this._len;this._block[this._len%this._blockSize]=128,this._block.fill(0,this._len%this._blockSize+1),e%(8*this._blockSize)>=8*this._finalSize&&(this._update(this._block),this._block.fill(0)),this._block.writeInt32BE(e,this._blockSize-4);var r=this._update(this._block)||this._hash();return t?r.toString(t):r},r.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=r}).call(this,t("buffer").Buffer)},{buffer:48}],182:[function(t,e,r){var r=e.exports=function(t){t=t.toLowerCase();var e=r[t];if(!e)throw new Error(t+" is not supported (we accept pull requests)");return new e};r.sha=t("./sha"),r.sha1=t("./sha1"),r.sha224=t("./sha224"),r.sha256=t("./sha256"),r.sha384=t("./sha384"),r.sha512=t("./sha512")},{"./sha":183,"./sha1":184,"./sha224":185,"./sha256":186,"./sha384":187,"./sha512":188}],183:[function(t,e,r){(function(r){function n(){this.init(),this._w=a,o.call(this,64,56)}function i(t,e){return t<>>32-e}var s=t("inherits"),o=t("./hash"),a=new Array(80);s(n,o),n.prototype.init=function(){return this._a=1732584193,this._b=-271733879,this._c=-1732584194,this._d=271733878,this._e=-1009589776,this},n.prototype._update=function(t){function e(){return s[h-3]^s[h-8]^s[h-14]^s[h-16]}function r(t,e){s[h]=t;var r=i(o,5)+e+c+t+n;c=u,u=f,f=i(a,30),a=o,o=r,h++}var n,s=this._w,o=this._a,a=this._b,f=this._c,u=this._d,c=this._e,h=0;for(n=1518500249;16>h;)r(t.readInt32BE(4*h),a&f|~a&u);for(;20>h;)r(e(),a&f|~a&u);for(n=1859775393;40>h;)r(e(),a^f^u);for(n=-1894007588;60>h;)r(e(),a&f|a&u|f&u);for(n=-899497514;80>h;)r(e(),a^f^u);this._a=o+this._a|0,this._b=a+this._b|0,this._c=f+this._c|0,this._d=u+this._d|0,this._e=c+this._e|0},n.prototype._hash=function(){var t=new r(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},e.exports=n}).call(this,t("buffer").Buffer)},{"./hash":181,buffer:48,inherits:296}],184:[function(t,e,r){(function(r){function n(){this.init(),this._w=a,o.call(this,64,56)}function i(t,e){return t<>>32-e}var s=t("inherits"),o=t("./hash"),a=new Array(80);s(n,o),n.prototype.init=function(){return this._a=1732584193,this._b=-271733879,this._c=-1732584194,this._d=271733878,this._e=-1009589776,this},n.prototype._update=function(t){function e(){return i(s[h-3]^s[h-8]^s[h-14]^s[h-16],1)}function r(t,e){s[h]=t;var r=i(o,5)+e+c+t+n;c=u,u=f,f=i(a,30),a=o,o=r,h++}var n,s=this._w,o=this._a,a=this._b,f=this._c,u=this._d,c=this._e,h=0;for(n=1518500249;16>h;)r(t.readInt32BE(4*h),a&f|~a&u);for(;20>h;)r(e(),a&f|~a&u);for(n=1859775393;40>h;)r(e(),a^f^u);for(n=-1894007588;60>h;)r(e(),a&f|a&u|f&u);for(n=-899497514;80>h;)r(e(),a^f^u);this._a=o+this._a|0,this._b=a+this._b|0,this._c=f+this._c|0,this._d=u+this._d|0,this._e=c+this._e|0},n.prototype._hash=function(){var t=new r(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},e.exports=n}).call(this,t("buffer").Buffer)},{"./hash":181,buffer:48,inherits:296}],185:[function(t,e,r){(function(r){function n(){this.init(),this._w=a,o.call(this,64,56)}var i=t("inherits"),s=t("./sha256"),o=t("./hash"),a=new Array(64);i(n,s),n.prototype.init=function(){return this._a=-1056596264,this._b=914150663,this._c=812702999,this._d=-150054599,this._e=-4191439,this._f=1750603025,this._g=1694076839,this._h=-1090891868,this},n.prototype._hash=function(){var t=new r(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t},e.exports=n}).call(this,t("buffer").Buffer)},{"./hash":181,"./sha256":186,buffer:48,inherits:296}],186:[function(t,e,r){(function(r){function n(){this.init(),this._w=p,h.call(this,64,56)}function i(t,e,r){return r^t&(e^r)}function s(t,e,r){return t&e|r&(t|e)}function o(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function a(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function f(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}function u(t){return(t>>>17|t<<15)^(t>>>19|t<<13)^t>>>10}var c=t("inherits"),h=t("./hash"),d=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],p=new Array(64);c(n,h),n.prototype.init=function(){return this._a=1779033703,this._b=-1150833019,this._c=1013904242,this._d=-1521486534,this._e=1359893119,this._f=-1694144372,this._g=528734635,this._h=1541459225,this},n.prototype._update=function(t){function e(){return u(n[v-2])+n[v-7]+f(n[v-15])+n[v-16]}function r(t){n[v]=t;var e=y+a(b)+i(b,g,m)+d[v]+t,r=o(c)+s(c,h,p);y=m,m=g,g=b,b=l+e,l=p,p=h,h=c,c=e+r,v++}for(var n=this._w,c=0|this._a,h=0|this._b,p=0|this._c,l=0|this._d,b=0|this._e,g=0|this._f,m=0|this._g,y=0|this._h,v=0;16>v;)r(t.readInt32BE(4*v));for(;64>v;)r(e());this._a=c+this._a|0,this._b=h+this._b|0,this._c=p+this._c|0,this._d=l+this._d|0,this._e=b+this._e|0,this._f=g+this._f|0,this._g=m+this._g|0,this._h=y+this._h|0},n.prototype._hash=function(){var t=new r(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t},e.exports=n}).call(this,t("buffer").Buffer)},{"./hash":181,buffer:48,inherits:296}],187:[function(t,e,r){(function(r){function n(){this.init(),this._w=a,o.call(this,128,112)}var i=t("inherits"),s=t("./sha512"),o=t("./hash"),a=new Array(160);i(n,s),n.prototype.init=function(){return this._a=-876896931,this._b=1654270250,this._c=-1856437926,this._d=355462360,this._e=1731405415,this._f=-1900787065,this._g=-619958771,this._h=1203062813,this._al=-1056596264,this._bl=914150663,this._cl=812702999,this._dl=-150054599,this._el=-4191439,this._fl=1750603025,this._gl=1694076839,this._hl=-1090891868,this},n.prototype._hash=function(){function t(t,r,n){e.writeInt32BE(t,n),e.writeInt32BE(r,n+4)}var e=new r(48);return t(this._a,this._al,0),t(this._b,this._bl,8),t(this._c,this._cl,16),t(this._d,this._dl,24),t(this._e,this._el,32),t(this._f,this._fl,40),e},e.exports=n}).call(this,t("buffer").Buffer)},{"./hash":181,"./sha512":188,buffer:48,inherits:296}],188:[function(t,e,r){(function(r){function n(){this.init(),this._w=b,p.call(this,128,112)}function i(t,e,r){return r^t&(e^r)}function s(t,e,r){return t&e|r&(t|e)}function o(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function a(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function f(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function u(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function c(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function h(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}var d=t("inherits"),p=t("./hash"),l=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],b=new Array(160);d(n,p),n.prototype.init=function(){return this._a=1779033703,this._b=-1150833019,this._c=1013904242,this._d=-1521486534,this._e=1359893119,this._f=-1694144372,this._g=528734635,this._h=1541459225,this._al=-205731576,this._bl=-2067093701,this._cl=-23791573,this._dl=1595750129,this._el=-1377402159,this._fl=725511199,this._gl=-79577749,this._hl=327033209,this},n.prototype._update=function(t){function e(){var t=p[R-30],e=p[R-30+1],r=f(t,e),i=u(e,t);t=p[R-4],e=p[R-4+1];var s=c(t,e),o=h(e,t),a=p[R-14],l=p[R-14+1],b=p[R-32],g=p[R-32+1];d=i+l,n=r+a+(i>>>0>d>>>0?1:0),d+=o,n=n+s+(o>>>0>d>>>0?1:0),d+=g,n=n+b+(g>>>0>d>>>0?1:0)}function r(){p[R]=n,p[R+1]=d;var t=s(b,g,m),e=s(I,k,E),r=o(b,I),f=o(I,b),u=a(v,x),c=a(x,v),h=l[R],T=l[R+1],C=i(v,_,w),N=i(x,P,O),j=B+c,U=S+u+(B>>>0>j>>>0?1:0);j+=N,U=U+C+(N>>>0>j>>>0?1:0),j+=T,U=U+h+(T>>>0>j>>>0?1:0),j+=d,U=U+n+(d>>>0>j>>>0?1:0);var L=f+e,D=r+t+(f>>>0>L>>>0?1:0);S=w,B=O,w=_,O=P,_=v,P=x,x=A+j|0,v=y+U+(A>>>0>x>>>0?1:0)|0,y=m,A=E,m=g,E=k,g=b,k=I,I=j+L|0,b=U+D+(j>>>0>I>>>0?1:0)|0,M++,R+=2}for(var n,d,p=this._w,b=0|this._a,g=0|this._b,m=0|this._c,y=0|this._d,v=0|this._e,_=0|this._f,w=0|this._g,S=0|this._h,I=0|this._al,k=0|this._bl,E=0|this._cl,A=0|this._dl,x=0|this._el,P=0|this._fl,O=0|this._gl,B=0|this._hl,M=0,R=0;16>M;)n=t.readInt32BE(4*R),d=t.readInt32BE(4*R+4),r();for(;80>M;)e(),r();this._al=this._al+I|0,this._bl=this._bl+k|0,this._cl=this._cl+E|0,this._dl=this._dl+A|0,this._el=this._el+x|0,this._fl=this._fl+P|0,this._gl=this._gl+O|0,this._hl=this._hl+B|0,this._a=this._a+b+(this._al>>>0>>0?1:0)|0,this._b=this._b+g+(this._bl>>>0>>0?1:0)|0,this._c=this._c+m+(this._cl>>>0>>0?1:0)|0,this._d=this._d+y+(this._dl>>>0>>0?1:0)|0,this._e=this._e+v+(this._el>>>0>>0?1:0)|0,this._f=this._f+_+(this._fl>>>0

>>0?1:0)|0,this._g=this._g+w+(this._gl>>>0>>0?1:0)|0,this._h=this._h+S+(this._hl>>>0>>0?1:0)|0},n.prototype._hash=function(){function t(t,r,n){e.writeInt32BE(t,n),e.writeInt32BE(r,n+4)}var e=new r(64);return t(this._a,this._al,0),t(this._b,this._bl,8),t(this._c,this._cl,16),t(this._d,this._dl,24),t(this._e,this._el,32),t(this._f,this._fl,40),t(this._g,this._gl,48),t(this._h,this._hl,56),e},e.exports=n}).call(this,t("buffer").Buffer)},{"./hash":181,buffer:48,inherits:296}],189:[function(t,e,r){(function(r){"use strict";function n(t,e){o.call(this),t=t.toLowerCase(),"string"==typeof e&&(e=new r(e));var n="sha512"===t||"sha384"===t?128:64;this._alg=t,this._key=e,e.length>n?e=i(t).update(e).digest():e.lengthu;u++)s[u]=54^e[u],f[u]=92^e[u];this._hash=i(t).update(s)}var i=t("create-hash/browser"),s=t("inherits"),o=t("stream").Transform,a=new r(128);a.fill(0),s(n,o),n.prototype.update=function(t,e){return this._hash.update(t,e),this},n.prototype._transform=function(t,e,r){this._hash.update(t),r()},n.prototype._flush=function(t){this.push(this.digest()),t()},n.prototype.digest=function(t){var e=this._hash.digest();return i(this._alg).update(this._opad).update(e).digest(t)},e.exports=function(t,e){return new n(t,e)}}).call(this,t("buffer").Buffer)},{buffer:48,"create-hash/browser":176,inherits:296,stream:265}],190:[function(t,e,r){(function(e){function n(t){var r=new e(o[t].prime,"hex"),n=new e(o[t].gen,"hex");return new a(r,n)}function i(t,r,n,o){return e.isBuffer(r)||void 0===f[r]?i(t,"binary",r,n):(r=r||"binary",o=o||"binary",n=n||new e([2]),e.isBuffer(n)||(n=new e(n,o)),"number"==typeof t?new a(s(t,n),n,!0):(e.isBuffer(t)||(t=new e(t,r)),new a(t,n,!0)))}var s=t("./lib/generatePrime"),o=t("./lib/primes.json"),a=t("./lib/dh"),f={binary:!0,hex:!0,base64:!0};r.DiffieHellmanGroup=r.createDiffieHellmanGroup=r.getDiffieHellman=n,r.createDiffieHellman=r.DiffieHellman=i}).call(this,t("buffer").Buffer)},{"./lib/dh":191,"./lib/generatePrime":192,"./lib/primes.json":193,buffer:48}],191:[function(t,e,r){(function(r){function n(t,e){return e=e||"utf8",r.isBuffer(t)||(t=new r(t,e)),this._pub=new f(t),this}function i(t,e){return e=e||"utf8",r.isBuffer(t)||(t=new r(t,e)),this._priv=new f(t),this}function s(t,e){var r=e.toString("hex"),n=[r,t.toString(16)].join("_");if(n in y)return y[n];var i=0;if(t.isEven()||!g.simpleSieve||!g.fermatTest(t)||!c.test(t))return i+=1,i+="02"===r||"05"===r?8:4,y[n]=i,i;c.test(t.shrn(1))||(i+=2);var s;switch(r){case"02":t.mod(h).cmp(d)&&(i+=8);break;case"05":s=t.mod(p),s.cmp(l)&&s.cmp(b)&&(i+=8);break;default:i+=4}return y[n]=i,i}function o(t,e,r){this.setGenerator(e),this.__prime=new f(t),this._prime=f.mont(this.__prime),this._primeLen=t.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,r?(this.setPublicKey=n,this.setPrivateKey=i):this._primeCode=8}function a(t,e){var n=new r(t.toArray());return e?n.toString(e):n}var f=t("bn.js"),u=t("miller-rabin"),c=new u,h=new f(24),d=new f(11),p=new f(10),l=new f(3),b=new f(7),g=t("./generatePrime"),m=t("randombytes");e.exports=o;var y={};Object.defineProperty(o.prototype,"verifyError",{enumerable:!0,get:function(){return"number"!=typeof this._primeCode&&(this._primeCode=s(this.__prime,this.__gen)),this._primeCode}}),o.prototype.generateKeys=function(){return this._priv||(this._priv=new f(m(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},o.prototype.computeSecret=function(t){t=new f(t),t=t.toRed(this._prime);var e=t.redPow(this._priv).fromRed(),n=new r(e.toArray()),i=this.getPrime();if(n.lengthn;n+=2){for(var i=Math.ceil(Math.sqrt(n)),s=0;r>s&&e[s]<=i&&n%e[s]!==0;s++);r!==s&&e[s]<=i||(e[r++]=n)}return v=e,e}function i(t){for(var e=n(),r=0;rt)return new f(2===e||5===e?[140,123]:[140,39]);e=new f(e);for(var r,n;;){for(r=new f(a(Math.ceil(t/8)));r.bitLength()>t;)r.ishrn(1);if(r.isEven()&&r.iadd(d),r.testn(1)||r.iadd(p),e.cmp(p)){if(!e.cmp(l))for(;r.mod(b).cmp(g);)r.iadd(y)}else for(;r.mod(u).cmp(m);)r.iadd(y);if(n=r.shrn(1),i(n)&&i(r)&&s(n)&&s(r)&&h.test(n)&&h.test(r))return r}}var a=t("randombytes");e.exports=o,o.simpleSieve=i,o.fermatTest=s;var f=t("bn.js"),u=new f(24),c=t("miller-rabin"),h=new c,d=new f(1),p=new f(2),l=new f(5),b=(new f(16),new f(8),new f(10)),g=new f(3),m=(new f(7),new f(11)),y=new f(4),v=(new f(12),null)},{"bn.js":194,"miller-rabin":195,randombytes:243}],193:[function(t,e,r){e.exports={modp1:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}},{}],194:[function(t,e,r){arguments[4][85][0].apply(r,arguments)},{buffer:47,dup:85}],195:[function(t,e,r){function n(t){this.rand=t||new s.Rand}var i=t("bn.js"),s=t("brorand");e.exports=n,n.create=function(t){return new n(t)},n.prototype._rand=function(t){var e=t.bitLength(),r=this.rand.generate(Math.ceil(e/8));r[0]|=3;var n=7&e;return 0!==n&&(r[r.length-1]>>=7-n),new i(r)},n.prototype.test=function(t,e,r){var n=t.bitLength(),s=i.mont(t),o=new i(1).toRed(s);e||(e=Math.max(1,n/48|0));for(var a=t.subn(1),f=a.subn(1),u=0;!a.testn(u);u++);for(var c=t.shrn(u),h=a.toRed(s),d=!0;e>0;e--){var p=this._rand(f);r&&r(p);var l=p.toRed(s).redPow(c);if(0!==l.cmp(o)&&0!==l.cmp(h)){for(var b=1;u>b;b++){if(l=l.redSqr(),0===l.cmp(o))return!1;if(0===l.cmp(h))break}if(b===u)return!1}}return d},n.prototype.getDivisor=function(t,e){var r=t.bitLength(),n=i.mont(t),s=new i(1).toRed(n);e||(e=Math.max(1,r/48|0));for(var o=t.subn(1),a=o.subn(1),f=0;!o.testn(f);f++);for(var u=t.shrn(f),c=o.toRed(n);e>0;e--){var h=this._rand(a),d=t.gcd(h);if(0!==d.cmpn(1))return d;var p=h.toRed(n).redPow(u);if(0!==p.cmp(s)&&0!==p.cmp(c)){for(var l=1;f>l;l++){if(p=p.redSqr(),0===p.cmp(s))return p.fromRed().subn(1).gcd(t);if(0===p.cmp(c))break}if(l===f)return p=p.redSqr(),p.fromRed().subn(1).gcd(t)}}return!1}},{"bn.js":194,brorand:196}],196:[function(t,e,r){arguments[4][103][0].apply(r,arguments)},{dup:103}],197:[function(t,e,r){(function(e){function n(t,e,r,n,s,o){if("function"==typeof s&&(o=s,s=void 0),"function"!=typeof o)throw new Error("No callback provided to pbkdf2");var a=i(t,e,r,n,s);setTimeout(function(){o(void 0,a)})}function i(t,r,n,i,a){if("number"!=typeof n)throw new TypeError("Iterations not a number");if(0>n)throw new TypeError("Bad iterations");if("number"!=typeof i)throw new TypeError("Key length not a number");if(0>i||i>o)throw new TypeError("Bad key length");a=a||"sha1",e.isBuffer(t)||(t=new e(t,"binary")),e.isBuffer(r)||(r=new e(r,"binary"));var f,u=1,c=new e(i),h=new e(r.length+4);r.copy(h,0,0,r.length);for(var d,p,l=1;u>=l;l++){h.writeUInt32BE(l,r.length);var b=s(a,t).update(h).digest();f||(f=b.length,p=new e(f),u=Math.ceil(i/f),d=i-(u-1)*f),b.copy(p,0,0,f);for(var g=1;n>g;g++){b=s(a,t).update(b).digest();for(var m=0;f>m;m++)p[m]^=b[m]}var y=(l-1)*f,v=l===u?d:f;p.copy(c,y,0,v)}return c}var s=t("create-hmac"),o=Math.pow(2,30)-1;r.pbkdf2=n,r.pbkdf2Sync=i}).call(this,t("buffer").Buffer)},{buffer:48,"create-hmac":189}],198:[function(t,e,r){r.publicEncrypt=t("./publicEncrypt"),r.privateDecrypt=t("./privateDecrypt"),r.privateEncrypt=function(t,e){return r.publicEncrypt(t,e,!0)},r.publicDecrypt=function(t,e){return r.privateDecrypt(t,e,!0)}},{"./privateDecrypt":239,"./publicEncrypt":240}],199:[function(t,e,r){(function(r){function n(t){var e=new r(4);return e.writeUInt32BE(t,0),e}var i=t("create-hash");e.exports=function(t,e){for(var s,o=new r(""),a=0;o.length=e.length){s++;break}var o=e.slice(2,i-1);e.slice(i-1,i);if(("0002"!==n.toString("hex")&&!r||"0001"!==n.toString("hex")&&r)&&s++,o.length<8&&s++,s)throw new Error("decryption error");return e.slice(i)}function s(t,e){t=new r(t),e=new r(e);var n=0,i=t.length;t.length!==e.length&&(n++,i=Math.min(t.length,e.length));for(var s=-1;++sh||new u(e).cmp(f.modulus)>=0)throw new Error("decryption error");var p;p=s?d(new u(e),f):c(e,f);var l=new r(h-p.length);if(l.fill(0),p=r.concat([l,p],h),4===a)return n(f,p);if(1===a)return i(f,p,s);if(3===a)return p;throw new Error("unknown padding")}}).call(this,t("buffer").Buffer)},{"./mgf":199,"./withPublic":241,"./xor":242,"bn.js":200,"browserify-rsa":201,buffer:48,"create-hash":176,"parse-asn1":205}],240:[function(t,e,r){(function(r){function n(t,e){var n=t.modulus.byteLength(),i=e.length,s=f("sha1").update(new r("")).digest(),o=s.length,d=2*o;if(i>n-d-2)throw new Error("message too long");var p=new r(n-i-d-2);p.fill(0);var l=n-o-1,b=a(o),g=c(r.concat([s,p,new r([1]),e],l),u(b,l)),m=c(b,u(g,o));return new h(r.concat([new r([0]),m,g],n))}function i(t,e,n){var i=e.length,o=t.modulus.byteLength();if(i>o-11)throw new Error("message too long");var a;return n?(a=new r(o-i-3),a.fill(255)):a=s(o-i-3),new h(r.concat([new r([0,n?1:2]),a,new r([0]),e],o))}function s(t,e){for(var n,i=new r(t),s=0,o=a(2*t),f=0;t>s;)f===o.length&&(o=a(2*t),f=0),n=o[f++],n&&(i[s++]=n);return i}var o=t("parse-asn1"),a=t("randombytes"),f=t("create-hash"),u=t("./mgf"),c=t("./xor"),h=t("bn.js"),d=t("./withPublic"),p=t("browserify-rsa");e.exports=function(t,e,r){var s;s=t.padding?t.padding:r?1:4;var a,f=o(t);if(4===s)a=n(f,e);else if(1===s)a=i(f,e,r);else{if(3!==s)throw new Error("unknown padding");if(a=new h(e),a.cmp(f.modulus)>=0)throw new Error("data too long for modulus")}return r?p(a,f):d(a,f)}}).call(this,t("buffer").Buffer)},{"./mgf":199,"./withPublic":241,"./xor":242,"bn.js":200,"browserify-rsa":201,buffer:48,"create-hash":176,"parse-asn1":205,randombytes:243}],241:[function(t,e,r){(function(r){function n(t,e){return new r(t.toRed(i.mont(e.modulus)).redPow(new i(e.publicExponent)).fromRed().toArray())}var i=t("bn.js");e.exports=n}).call(this,t("buffer").Buffer)},{"bn.js":200,buffer:48}],242:[function(t,e,r){e.exports=function(t,e){for(var r=t.length,n=-1;++n65536)throw new Error("requested too many random bytes");var s=new r.Uint8Array(e);o.getRandomValues(s);var a=new n(s.buffer);return"function"==typeof i?t.nextTick(function(){i(null,a)}):a}var o=r.crypto||r.msCrypto;o&&o.getRandomValues?e.exports=s:e.exports=i}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer)},{_process:247,buffer:48}],244:[function(t,e,r){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(t){return"function"==typeof t}function s(t){return"number"==typeof t}function o(t){return"object"==typeof t&&null!==t}function a(t){return void 0===t}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(t){if(!s(t)||0>t||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},n.prototype.emit=function(t){var e,r,n,s,f,u;if(this._events||(this._events={}),"error"===t&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;throw TypeError('Uncaught, unspecified "error" event.')}if(r=this._events[t],a(r))return!1;if(i(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:for(n=arguments.length,s=new Array(n-1),f=1;n>f;f++)s[f-1]=arguments[f];r.apply(this,s)}else if(o(r)){for(n=arguments.length,s=new Array(n-1),f=1;n>f;f++)s[f-1]=arguments[f];for(u=r.slice(),n=u.length,f=0;n>f;f++)u[f].apply(this,s)}return!0},n.prototype.addListener=function(t,e){var r;if(!i(e))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,i(e.listener)?e.listener:e),this._events[t]?o(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,o(this._events[t])&&!this._events[t].warned){var r;r=a(this._maxListeners)?n.defaultMaxListeners:this._maxListeners,r&&r>0&&this._events[t].length>r&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())}return this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(t,e){function r(){this.removeListener(t,r),n||(n=!0,e.apply(this,arguments))}if(!i(e))throw TypeError("listener must be a function");var n=!1;return r.listener=e,this.on(t,r),this},n.prototype.removeListener=function(t,e){var r,n,s,a;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],s=r.length,n=-1,r===e||i(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(o(r)){for(a=s;a-- >0;)if(r[a]===e||r[a].listener&&r[a].listener===e){n=a;break}if(0>n)return this;1===r.length?(r.length=0,delete this._events[t]):r.splice(n,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},n.prototype.removeAllListeners=function(t){var e,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[t],i(r))this.removeListener(t,r);else for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},n.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.listenerCount=function(t,e){var r;return r=t._events&&t._events[e]?i(t._events[e])?1:t._events[e].length:0}},{}],245:[function(t,e,r){e.exports=function(t){return!(null==t||!(t._isBuffer||t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)))}},{}],246:[function(t,e,r){e.exports=Array.isArray||function(t){return"[object Array]"==Object.prototype.toString.call(t)}},{}],247:[function(t,e,r){function n(){c=!1,a.length?u=a.concat(u):h=-1,u.length&&i()}function i(){if(!c){var t=setTimeout(n);c=!0;for(var e=u.length;e;){for(a=u,u=[];++h1)for(var r=1;r1&&(n=r[0]+"@",t=r[1]),t=t.replace(R,".");var i=t.split("."),o=s(i,e).join(".");return n+o}function a(t){for(var e,r,n=[],i=0,s=t.length;s>i;)e=t.charCodeAt(i++),e>=55296&&56319>=e&&s>i?(r=t.charCodeAt(i++),56320==(64512&r)?n.push(((1023&e)<<10)+(1023&r)+65536):(n.push(e),i--)):n.push(e);return n}function f(t){return s(t,function(t){var e="";return t>65535&&(t-=65536,e+=j(t>>>10&1023|55296),t=56320|1023&t),e+=j(t)}).join("")}function u(t){return 10>t-48?t-22:26>t-65?t-65:26>t-97?t-97:S}function c(t,e){return t+22+75*(26>t)-((0!=e)<<5)}function h(t,e,r){var n=0;for(t=r?N(t/A):t>>1,t+=N(t/e);t>C*k>>1;n+=S)t=N(t/C);return N(n+(C+1)*t/(t+E))}function d(t){var e,r,n,s,o,a,c,d,p,l,b=[],g=t.length,m=0,y=P,v=x;for(r=t.lastIndexOf(O),0>r&&(r=0),n=0;r>n;++n)t.charCodeAt(n)>=128&&i("not-basic"),b.push(t.charCodeAt(n));for(s=r>0?r+1:0;g>s;){for(o=m,a=1,c=S;s>=g&&i("invalid-input"),d=u(t.charCodeAt(s++)),(d>=S||d>N((w-m)/a))&&i("overflow"),m+=d*a,p=v>=c?I:c>=v+k?k:c-v,!(p>d);c+=S)l=S-p,a>N(w/l)&&i("overflow"),a*=l;e=b.length+1,v=h(m-o,e,0==o),N(m/e)>w-y&&i("overflow"),y+=N(m/e),m%=e,b.splice(m++,0,y)}return f(b)}function p(t){var e,r,n,s,o,f,u,d,p,l,b,g,m,y,v,_=[];for(t=a(t),g=t.length,e=P,r=0,o=x,f=0;g>f;++f)b=t[f],128>b&&_.push(j(b));for(n=s=_.length,s&&_.push(O);g>n;){for(u=w,f=0;g>f;++f)b=t[f],b>=e&&u>b&&(u=b);for(m=n+1,u-e>N((w-r)/m)&&i("overflow"),r+=(u-e)*m,e=u,f=0;g>f;++f)if(b=t[f],e>b&&++r>w&&i("overflow"),b==e){for(d=r,p=S;l=o>=p?I:p>=o+k?k:p-o,!(l>d);p+=S)v=d-l,y=S-l,_.push(j(c(l+v%y,0))),d=N(v/y);_.push(j(c(d,0))),o=h(r,m,n==s),r=0,++n}++r,++e}return _.join("")}function l(t){return o(t,function(t){return B.test(t)?d(t.slice(4).toLowerCase()):t})}function b(t){return o(t,function(t){return M.test(t)?"xn--"+p(t):t})}var g="object"==typeof r&&r&&!r.nodeType&&r,m="object"==typeof e&&e&&!e.nodeType&&e,y="object"==typeof t&&t;(y.global===y||y.window===y||y.self===y)&&(n=y);var v,_,w=2147483647,S=36,I=1,k=26,E=38,A=700,x=72,P=128,O="-",B=/^xn--/,M=/[^\x20-\x7E]/,R=/[\x2E\u3002\uFF0E\uFF61]/g,T={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},C=S-I,N=Math.floor,j=String.fromCharCode;if(v={version:"1.3.2",ucs2:{decode:a,encode:f},decode:d,encode:p,toASCII:b,toUnicode:l},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",function(){return v});else if(g&&m)if(e.exports==g)m.exports=v;else for(_ in v)v.hasOwnProperty(_)&&(g[_]=v[_]);else n.punycode=v}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],249:[function(t,e,r){"use strict";function n(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.exports=function(t,e,r,s){e=e||"&",r=r||"=";var o={};if("string"!=typeof t||0===t.length)return o;var a=/\+/g;t=t.split(e);var f=1e3;s&&"number"==typeof s.maxKeys&&(f=s.maxKeys);var u=t.length;f>0&&u>f&&(u=f);for(var c=0;u>c;++c){var h,d,p,l,b=t[c].replace(a,"%20"),g=b.indexOf(r);g>=0?(h=b.substr(0,g),d=b.substr(g+1)):(h=b,d=""),p=decodeURIComponent(h),l=decodeURIComponent(d),n(o,p)?i(o[p])?o[p].push(l):o[p]=[o[p],l]:o[p]=l}return o};var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},{}],250:[function(t,e,r){"use strict";function n(t,e){if(t.map)return t.map(e);for(var r=[],n=0;n0)if(e.ended&&!i){var a=new Error("stream.push() after EOF");t.emit("error",a)}else if(e.endEmitted&&i){var a=new Error("stream.unshift() after end event");t.emit("error",a)}else!e.decoder||i||n||(r=e.decoder.write(r)),i||(e.reading=!1),e.flowing&&0===e.length&&!e.sync?(t.emit("data",r),t.read(0)):(e.length+=e.objectMode?1:r.length,i?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&h(t)),p(t,e);else i||(e.reading=!1);return o(e)}function o(t){return!t.ended&&(t.needReadable||t.length=N?t=N:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function f(t,e){return 0===e.length&&e.ended?0:e.objectMode?0===t?0:1:null===t||isNaN(t)?e.flowing&&e.buffer.length?e.buffer[0].length:e.length:0>=t?0:(t>e.highWaterMark&&(e.highWaterMark=a(t)),t>e.length?e.ended?e.length:(e.needReadable=!0,0):t)}function u(t,e){var r=null;return x.isBuffer(e)||"string"==typeof e||null===e||void 0===e||t.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r}function c(t,e){if(!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,h(t)}}function h(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(M("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?E(d,t):d(t))}function d(t){M("emit readable"),t.emit("readable"),v(t)}function p(t,e){e.readingMore||(e.readingMore=!0,E(l,t,e))}function l(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=i)r=s?n.join(""):1===n.length?n[0]:x.concat(n,i),n.length=0;else if(tu&&t>f;u++){var a=n[0],h=Math.min(t-f,a.length);s?r+=a.slice(0,h):a.copy(r,f,0,h),h0)throw new Error("endReadable called on non-empty stream");e.endEmitted||(e.ended=!0,E(S,e,t))}function S(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function I(t,e){for(var r=0,n=t.length;n>r;r++)e(t[r],r)}function k(t,e){for(var r=0,n=t.length;n>r;r++)if(t[r]===e)return r;return-1}e.exports=i;var E=t("process-nextick-args"),A=t("isarray"),x=t("buffer").Buffer;i.ReadableState=n;var P,O=(t("events"),function(t,e){return t.listeners(e).length});!function(){try{P=t("stream")}catch(e){}finally{P||(P=t("events").EventEmitter)}}();var x=t("buffer").Buffer,B=t("core-util-is");B.inherits=t("inherits");var M,R=t("util");M=R&&R.debuglog?R.debuglog("stream"):function(){};var T;B.inherits(i,P);var C,C;i.prototype.push=function(t,e){var r=this._readableState;return r.objectMode||"string"!=typeof t||(e=e||r.defaultEncoding,e!==r.encoding&&(t=new x(t,e),e="")),s(this,r,t,e,!1)},i.prototype.unshift=function(t){var e=this._readableState;return s(this,e,t,"",!0)},i.prototype.isPaused=function(){return this._readableState.flowing===!1},i.prototype.setEncoding=function(e){return T||(T=t("string_decoder/").StringDecoder),this._readableState.decoder=new T(e),this._readableState.encoding=e,this};var N=8388608;i.prototype.read=function(t){M("read",t);var e=this._readableState,r=t;if(("number"!=typeof t||t>0)&&(e.emittedReadable=!1),0===t&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return M("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?w(this):h(this),null;if(t=f(t,e),0===t&&e.ended)return 0===e.length&&w(this),null;var n=e.needReadable;M("need readable",n),(0===e.length||e.length-t0?_(t,e):null,null===i&&(e.needReadable=!0,t=0),e.length-=t,0!==e.length||e.ended||(e.needReadable=!0),r!==t&&e.ended&&0===e.length&&w(this),null!==i&&this.emit("data",i),i},i.prototype._read=function(t){this.emit("error",new Error("not implemented"))},i.prototype.pipe=function(t,e){function n(t){M("onunpipe"),t===h&&s()}function i(){M("onend"),t.end()}function s(){M("cleanup"),t.removeListener("close",f),t.removeListener("finish",u),t.removeListener("drain",g),t.removeListener("error",a),t.removeListener("unpipe",n),h.removeListener("end",i),h.removeListener("end",s),h.removeListener("data",o),m=!0,!d.awaitDrain||t._writableState&&!t._writableState.needDrain||g()}function o(e){M("ondata");var r=t.write(e);!1===r&&(1!==d.pipesCount||d.pipes[0]!==t||1!==h.listenerCount("data")||m||(M("false write response, pause",h._readableState.awaitDrain),h._readableState.awaitDrain++),h.pause())}function a(e){M("onerror",e),c(),t.removeListener("error",a),0===O(t,"error")&&t.emit("error",e)}function f(){t.removeListener("finish",u),c()}function u(){M("onfinish"),t.removeListener("close",f),c()}function c(){M("unpipe"),h.unpipe(t)}var h=this,d=this._readableState;switch(d.pipesCount){case 0:d.pipes=t;break;case 1:d.pipes=[d.pipes,t];break;default:d.pipes.push(t)}d.pipesCount+=1,M("pipe count=%d opts=%j",d.pipesCount,e);var p=(!e||e.end!==!1)&&t!==r.stdout&&t!==r.stderr,l=p?i:s;d.endEmitted?E(l):h.once("end",l),t.on("unpipe",n);var g=b(h);t.on("drain",g);var m=!1;return h.on("data",o),t._events&&t._events.error?A(t._events.error)?t._events.error.unshift(a):t._events.error=[a,t._events.error]:t.on("error",a),t.once("close",f),t.once("finish",u),t.emit("pipe",h),d.flowing||(M("pipe resume"),h.resume()),t},i.prototype.unpipe=function(t){var e=this._readableState;if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this),this);if(!t){var r=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var i=0;n>i;i++)r[i].emit("unpipe",this);return this}var i=k(e.pipes,t);return-1===i?this:(e.pipes.splice(i,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this),this)},i.prototype.on=function(t,e){var r=P.prototype.on.call(this,t,e);if("data"===t&&!1!==this._readableState.flowing&&this.resume(),"readable"===t&&this.readable){var n=this._readableState;n.readableListening||(n.readableListening=!0,n.emittedReadable=!1,n.needReadable=!0,n.reading?n.length&&h(this,n):E(g,this))}return r},i.prototype.addListener=i.prototype.on,i.prototype.resume=function(){var t=this._readableState;return t.flowing||(M("resume"),t.flowing=!0,m(this,t)),this},i.prototype.pause=function(){return M("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(M("pause"),this._readableState.flowing=!1,this.emit("pause")),this},i.prototype.wrap=function(t){var e=this._readableState,r=!1,n=this;t.on("end",function(){if(M("wrapped end"),e.decoder&&!e.ended){var t=e.decoder.end();t&&t.length&&n.push(t)}n.push(null)}),t.on("data",function(i){if(M("wrapped data"),e.decoder&&(i=e.decoder.write(i)),(!e.objectMode||null!==i&&void 0!==i)&&(e.objectMode||i&&i.length)){var s=n.push(i);s||(r=!0,t.pause())}});for(var i in t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));var s=["error","close","destroy","pause","resume"];return I(s,function(e){t.on(e,n.emit.bind(n,e))}),n._read=function(e){M("wrapped _read",e),r&&(r=!1,t.resume())},n},i._fromList=_}).call(this,t("_process"))},{"./_stream_duplex":253,_process:247,buffer:48,"core-util-is":258,events:244,inherits:296,isarray:246,"process-nextick-args":259,"string_decoder/":266,util:47}],256:[function(t,e,r){"use strict";function n(t){this.afterTransform=function(e,r){return i(t,e,r)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null}function i(t,e,r){var n=t._transformState;n.transforming=!1;var i=n.writecb;if(!i)return t.emit("error",new Error("no writecb in Transform class"));n.writechunk=null,n.writecb=null,null!==r&&void 0!==r&&t.push(r),i&&i(e);var s=t._readableState;s.reading=!1,(s.needReadable||s.length-1))throw new TypeError("Unknown encoding: "+t);this._writableState.defaultEncoding=t},o.prototype._write=function(t,e,r){r(new Error("not implemented"))},o.prototype._writev=null,o.prototype.end=function(t,e,r){var n=this._writableState;"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!==t&&void 0!==t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||w(this,n,r)}},{"./_stream_duplex":253,buffer:48,"core-util-is":258,events:244,inherits:296,"process-nextick-args":259,"util-deprecate":260}],258:[function(t,e,r){(function(t){function e(t){return Array.isArray?Array.isArray(t):"[object Array]"===g(t)}function n(t){return"boolean"==typeof t}function i(t){return null===t}function s(t){return null==t}function o(t){return"number"==typeof t}function a(t){return"string"==typeof t}function f(t){return"symbol"==typeof t}function u(t){return void 0===t}function c(t){return"[object RegExp]"===g(t)}function h(t){return"object"==typeof t&&null!==t}function d(t){return"[object Date]"===g(t)}function p(t){return"[object Error]"===g(t)||t instanceof Error}function l(t){return"function"==typeof t}function b(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||"undefined"==typeof t}function g(t){return Object.prototype.toString.call(t)}r.isArray=e,r.isBoolean=n,r.isNull=i,r.isNullOrUndefined=s,r.isNumber=o,r.isString=a,r.isSymbol=f,r.isUndefined=u,r.isRegExp=c,r.isObject=h,r.isDate=d,r.isError=p,r.isFunction=l,r.isPrimitive=b,r.isBuffer=t.isBuffer}).call(this,{isBuffer:t("../../../../insert-module-globals/node_modules/is-buffer/index.js")})},{"../../../../insert-module-globals/node_modules/is-buffer/index.js":245}],259:[function(t,e,r){(function(t){"use strict";function r(e){for(var r=new Array(arguments.length-1),n=0;n=this.charLength-this.charReceived?this.charLength-this.charReceived:t.length;if(t.copy(this.charBuffer,this.charReceived,0,r),this.charReceived+=r,this.charReceived=55296&&56319>=n)){if(this.charReceived=this.charLength=0,0===t.length)return e;break}this.charLength+=this.surrogateSize,e=""}this.detectIncompleteChar(t);var i=t.length;this.charLength&&(t.copy(this.charBuffer,0,t.length-this.charReceived,i),i-=this.charReceived),e+=t.toString(this.encoding,0,i);var i=e.length-1,n=e.charCodeAt(i);if(n>=55296&&56319>=n){var s=this.surrogateSize;return this.charLength+=s,this.charReceived+=s,this.charBuffer.copy(this.charBuffer,s,0,s),t.copy(this.charBuffer,0,0,s),e.substring(0,i)}return e},u.prototype.detectIncompleteChar=function(t){for(var e=t.length>=3?3:t.length;e>0;e--){var r=t[t.length-e];if(1==e&&r>>5==6){this.charLength=2;break}if(2>=e&&r>>4==14){this.charLength=3;break}if(3>=e&&r>>3==30){this.charLength=4;break}}this.charReceived=e},u.prototype.end=function(t){var e="";if(t&&t.length&&(e=this.write(t)),this.charReceived){var r=this.charReceived,n=this.charBuffer,i=this.encoding;e+=n.slice(0,r).toString(i)}return e}},{buffer:48}],267:[function(t,e,r){function n(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function i(t,e,r){if(t&&u(t)&&t instanceof n)return t;var i=new n;return i.parse(t,e,r),i}function s(t){return f(t)&&(t=i(t)),t instanceof n?t.format():n.prototype.format.call(t)}function o(t,e){return i(t,!1,!0).resolve(e)}function a(t,e){return t?i(t,!1,!0).resolveObject(e):e}function f(t){return"string"==typeof t}function u(t){return"object"==typeof t&&null!==t}function c(t){return null===t}function h(t){return null==t}var d=t("punycode");r.parse=i,r.resolve=o,r.resolveObject=a,r.format=s,r.Url=n;var p=/^([a-z0-9.+-]+:)/i,l=/:[0-9]*$/,b=["<",">",'"',"`"," ","\r","\n"," "],g=["{","}","|","\\","^","`"].concat(b),m=["'"].concat(g),y=["%","/","?",";","#"].concat(m),v=["/","?","#"],_=255,w=/^[a-z0-9A-Z_-]{0,63}$/,S=/^([a-z0-9A-Z_-]{0,63})(.*)$/,I={javascript:!0,"javascript:":!0},k={javascript:!0,"javascript:":!0},E={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},A=t("querystring");n.prototype.parse=function(t,e,r){if(!f(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var n=t;n=n.trim();var i=p.exec(n);if(i){i=i[0];var s=i.toLowerCase();this.protocol=s,n=n.substr(i.length)}if(r||i||n.match(/^\/\/[^@\/]+@[^@\/]+/)){var o="//"===n.substr(0,2);!o||i&&k[i]||(n=n.substr(2),this.slashes=!0)}if(!k[i]&&(o||i&&!E[i])){for(var a=-1,u=0;uc)&&(a=c)}var h,l;l=-1===a?n.lastIndexOf("@"):n.lastIndexOf("@",a),-1!==l&&(h=n.slice(0,l),n=n.slice(l+1),this.auth=decodeURIComponent(h)),a=-1;for(var u=0;uc)&&(a=c)}-1===a&&(a=n.length),this.host=n.slice(0,a),n=n.slice(a),this.parseHost(),this.hostname=this.hostname||"";var b="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!b)for(var g=this.hostname.split(/\./),u=0,x=g.length;x>u;u++){var P=g[u];if(P&&!P.match(w)){for(var O="",B=0,M=P.length;M>B;B++)O+=P.charCodeAt(B)>127?"x":P[B];if(!O.match(w)){var R=g.slice(0,u),T=g.slice(u+1),C=P.match(S);C&&(R.push(C[1]),T.unshift(C[2])),T.length&&(n="/"+T.join(".")+n),this.hostname=R.join(".");break}}}if(this.hostname.length>_?this.hostname="":this.hostname=this.hostname.toLowerCase(),!b){for(var N=this.hostname.split("."),j=[],u=0;uu;u++){var z=m[u],F=encodeURIComponent(z);F===z&&(F=escape(z)),n=n.split(z).join(F)}var K=n.indexOf("#");-1!==K&&(this.hash=n.substr(K),n=n.slice(0,K));var H=n.indexOf("?");if(-1!==H?(this.search=n.substr(H),this.query=n.substr(H+1),e&&(this.query=A.parse(this.query)),n=n.slice(0,H)):e&&(this.search="",this.query={}),n&&(this.pathname=n),E[s]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var L=this.pathname||"",U=this.search||"";this.path=L+U}return this.href=this.format(),this},n.prototype.format=function(){var t=this.auth||"";t&&(t=encodeURIComponent(t),t=t.replace(/%3A/i,":"),t+="@");var e=this.protocol||"",r=this.pathname||"",n=this.hash||"",i=!1,s="";this.host?i=t+this.host:this.hostname&&(i=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(i+=":"+this.port)),this.query&&u(this.query)&&Object.keys(this.query).length&&(s=A.stringify(this.query));var o=this.search||s&&"?"+s||"";return e&&":"!==e.substr(-1)&&(e+=":"),this.slashes||(!e||E[e])&&i!==!1?(i="//"+(i||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):i||(i=""),n&&"#"!==n.charAt(0)&&(n="#"+n),o&&"?"!==o.charAt(0)&&(o="?"+o),r=r.replace(/[?#]/g,function(t){return encodeURIComponent(t)}),o=o.replace("#","%23"),e+i+r+o+n},n.prototype.resolve=function(t){return this.resolveObject(i(t,!1,!0)).format()},n.prototype.resolveObject=function(t){if(f(t)){var e=new n;e.parse(t,!1,!0),t=e}var r=new n;if(Object.keys(this).forEach(function(t){r[t]=this[t]},this),r.hash=t.hash,""===t.href)return r.href=r.format(),r;if(t.slashes&&!t.protocol)return Object.keys(t).forEach(function(e){"protocol"!==e&&(r[e]=t[e])}),E[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r;if(t.protocol&&t.protocol!==r.protocol){if(!E[t.protocol])return Object.keys(t).forEach(function(e){r[e]=t[e]}),r.href=r.format(),r;if(r.protocol=t.protocol,t.host||k[t.protocol])r.pathname=t.pathname;else{for(var i=(t.pathname||"").split("/");i.length&&!(t.host=i.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==i[0]&&i.unshift(""),i.length<2&&i.unshift(""),r.pathname=i.join("/")}if(r.search=t.search,r.query=t.query,r.host=t.host||"",r.auth=t.auth,r.hostname=t.hostname||t.host,r.port=t.port,r.pathname||r.search){var s=r.pathname||"",o=r.search||"";r.path=s+o}return r.slashes=r.slashes||t.slashes,r.href=r.format(),r}var a=r.pathname&&"/"===r.pathname.charAt(0),u=t.host||t.pathname&&"/"===t.pathname.charAt(0),d=u||a||r.host&&t.pathname,p=d,l=r.pathname&&r.pathname.split("/")||[],i=t.pathname&&t.pathname.split("/")||[],b=r.protocol&&!E[r.protocol];if(b&&(r.hostname="",r.port=null,r.host&&(""===l[0]?l[0]=r.host:l.unshift(r.host)),r.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===i[0]?i[0]=t.host:i.unshift(t.host)),t.host=null),d=d&&(""===i[0]||""===l[0])),u)r.host=t.host||""===t.host?t.host:r.host,r.hostname=t.hostname||""===t.hostname?t.hostname:r.hostname,r.search=t.search,r.query=t.query,l=i;else if(i.length)l||(l=[]),l.pop(),l=l.concat(i),r.search=t.search,r.query=t.query;else if(!h(t.search)){if(b){r.hostname=r.host=l.shift();var g=r.host&&r.host.indexOf("@")>0?r.host.split("@"):!1;g&&(r.auth=g.shift(),r.host=r.hostname=g.shift())}return r.search=t.search,r.query=t.query,c(r.pathname)&&c(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!l.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var m=l.slice(-1)[0],y=(r.host||t.host)&&("."===m||".."===m)||""===m,v=0,_=l.length;_>=0;_--)m=l[_],"."==m?l.splice(_,1):".."===m?(l.splice(_,1),v++):v&&(l.splice(_,1),v--);if(!d&&!p)for(;v--;v)l.unshift("..");!d||""===l[0]||l[0]&&"/"===l[0].charAt(0)||l.unshift(""),y&&"/"!==l.join("/").substr(-1)&&l.push("");var w=""===l[0]||l[0]&&"/"===l[0].charAt(0);if(b){r.hostname=r.host=w?"":l.length?l.shift():"";var g=r.host&&r.host.indexOf("@")>0?r.host.split("@"):!1;g&&(r.auth=g.shift(),r.host=r.hostname=g.shift())}return d=d||r.host&&l.length,d&&!w&&l.unshift(""),l.length?r.pathname=l.join("/"):(r.pathname=null,r.path=null),c(r.pathname)&&c(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},n.prototype.parseHost=function(){var t=this.host,e=l.exec(t);e&&(e=e[0],":"!==e&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},{punycode:248,querystring:251}],268:[function(t,e,r){e.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},{}],269:[function(t,e,r){(function(e,n){function i(t,e){var n={seen:[],stylize:o};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),b(e)?n.showHidden=e:e&&r._extend(n,e),w(n.showHidden)&&(n.showHidden=!1),w(n.depth)&&(n.depth=2),w(n.colors)&&(n.colors=!1),w(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=s),f(n,t,n.depth)}function s(t,e){var r=i.styles[e];return r?"["+i.colors[r][0]+"m"+t+"["+i.colors[r][1]+"m":t}function o(t,e){return t}function a(t){var e={};return t.forEach(function(t,r){e[t]=!0}),e}function f(t,e,n){if(t.customInspect&&e&&A(e.inspect)&&e.inspect!==r.inspect&&(!e.constructor||e.constructor.prototype!==e)){var i=e.inspect(n,t);return v(i)||(i=f(t,i,n)),i}var s=u(t,e);if(s)return s;var o=Object.keys(e),b=a(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),E(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return c(e);if(0===o.length){if(A(e)){var g=e.name?": "+e.name:"";return t.stylize("[Function"+g+"]","special")}if(S(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(k(e))return t.stylize(Date.prototype.toString.call(e),"date");if(E(e))return c(e)}var m="",y=!1,_=["{","}"];if(l(e)&&(y=!0,_=["[","]"]),A(e)){var w=e.name?": "+e.name:"";m=" [Function"+w+"]"}if(S(e)&&(m=" "+RegExp.prototype.toString.call(e)),k(e)&&(m=" "+Date.prototype.toUTCString.call(e)),E(e)&&(m=" "+c(e)),0===o.length&&(!y||0==e.length))return _[0]+m+_[1];if(0>n)return S(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var I;return I=y?h(t,e,n,b,o):o.map(function(r){return d(t,e,n,b,r,y)}),t.seen.pop(),p(I,m,_)}function u(t,e){if(w(e))return t.stylize("undefined","undefined");if(v(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}return y(e)?t.stylize(""+e,"number"):b(e)?t.stylize(""+e,"boolean"):g(e)?t.stylize("null","null"):void 0}function c(t){return"["+Error.prototype.toString.call(t)+"]"}function h(t,e,r,n,i){for(var s=[],o=0,a=e.length;a>o;++o)M(e,String(o))?s.push(d(t,e,r,n,String(o),!0)):s.push("");return i.forEach(function(i){i.match(/^\d+$/)||s.push(d(t,e,r,n,i,!0))}),s}function d(t,e,r,n,i,s){var o,a,u;if(u=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]},u.get?a=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(a=t.stylize("[Setter]","special")),M(n,i)||(o="["+i+"]"),a||(t.seen.indexOf(u.value)<0?(a=g(r)?f(t,u.value,null):f(t,u.value,r-1),a.indexOf("\n")>-1&&(a=s?a.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+a.split("\n").map(function(t){return" "+t}).join("\n"))):a=t.stylize("[Circular]","special")),w(o)){if(s&&i.match(/^\d+$/))return a;o=JSON.stringify(""+i),o.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=t.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=t.stylize(o,"string"))}return o+": "+a}function p(t,e,r){var n=0,i=t.reduce(function(t,e){return n++,e.indexOf("\n")>=0&&n++,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}function l(t){return Array.isArray(t)}function b(t){return"boolean"==typeof t}function g(t){return null===t}function m(t){return null==t}function y(t){return"number"==typeof t}function v(t){return"string"==typeof t}function _(t){return"symbol"==typeof t}function w(t){return void 0===t}function S(t){return I(t)&&"[object RegExp]"===P(t)}function I(t){return"object"==typeof t&&null!==t}function k(t){return I(t)&&"[object Date]"===P(t)}function E(t){return I(t)&&("[object Error]"===P(t)||t instanceof Error)}function A(t){return"function"==typeof t}function x(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||"undefined"==typeof t}function P(t){return Object.prototype.toString.call(t)}function O(t){return 10>t?"0"+t.toString(10):t.toString(10)}function B(){var t=new Date,e=[O(t.getHours()),O(t.getMinutes()),O(t.getSeconds())].join(":");return[t.getDate(),N[t.getMonth()],e].join(" ")}function M(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var R=/%[sdj%]/g;r.format=function(t){if(!v(t)){for(var e=[],r=0;r=s)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return t}}),a=n[r];s>r;a=n[++r])o+=g(a)||!I(a)?" "+a:" "+i(a);return o},r.deprecate=function(t,i){function s(){if(!o){if(e.throwDeprecation)throw new Error(i);e.traceDeprecation?console.trace(i):console.error(i),o=!0}return t.apply(this,arguments)}if(w(n.process))return function(){return r.deprecate(t,i).apply(this,arguments)};if(e.noDeprecation===!0)return t;var o=!1;return s};var T,C={};r.debuglog=function(t){if(w(T)&&(T=e.env.NODE_DEBUG||""),t=t.toUpperCase(),!C[t])if(new RegExp("\\b"+t+"\\b","i").test(T)){var n=e.pid;C[t]=function(){var e=r.format.apply(r,arguments);console.error("%s %d: %s",t,n,e)}}else C[t]=function(){};return C[t]},r.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},r.isArray=l,r.isBoolean=b,r.isNull=g,r.isNullOrUndefined=m,r.isNumber=y,r.isString=v,r.isSymbol=_,r.isUndefined=w,r.isRegExp=S,r.isObject=I,r.isDate=k,r.isError=E,r.isFunction=A,r.isPrimitive=x,r.isBuffer=t("./support/isBuffer");var N=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];r.log=function(){console.log("%s - %s",B(),r.format.apply(r,arguments))},r.inherits=t("inherits"),r._extend=function(t,e){if(!e||!I(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":268,_process:247,inherits:296}],270:[function(require,module,exports){function Context(){}var indexOf=require("indexof"),Object_keys=function(t){if(Object.keys)return Object.keys(t);var e=[];for(var r in t)e.push(r);return e},forEach=function(t,e){if(t.forEach)return t.forEach(e);for(var r=0;rs;s++){var o=t.charCodeAt(s)-48;n<<=4,n|=o>=49&&54>=o?o-49+10:o>=17&&22>=o?o-17+10:15&o}return n}function o(t,e,r,n){for(var i=0,s=Math.min(t.length,r),o=e;s>o;o++){var a=t.charCodeAt(o)-48;i*=n,i+=a>=49?a-49+10:a>=17?a-17+10:a}return i}function a(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).ishln(this.n).isub(this.p),this.tmp=this._tmp()}function f(){a.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function u(){a.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function c(){a.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function h(){a.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function d(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else this.m=t,this.prime=null}function p(t){d.call(this,t),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).ishln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv.sign=!0,this.minv=this.minv.mod(this.r)}"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26,i.prototype._init=function(t,e,n){if("number"==typeof t)return 0>t&&(this.sign=!0,t=-t),void(67108864>t?(this.words=[67108863&t],this.length=1):4503599627370496>t?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(9007199254740992>t),this.words=[67108863&t,t/67108864&67108863,1],this.length=3));if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&36>=e),t=t.toString().replace(/\s+/g,"");var i=0;"-"===t[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.sign=!0),this.strip()},i.prototype._initArray=function(t,e,n){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3){var a=t[i]|t[i-1]<<8|t[i-2]<<16;this.words[o]|=a<>>26-s&67108863,s+=24,s>=26&&(s-=26,o++)}else if("le"===n)for(var i=0,o=0;i>>26-s&67108863,s+=24,s>=26&&(s-=26,o++)}return this.strip()},i.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6){var o=s(t,r,r+6);this.words[i]|=o<>>26-n&4194303,n+=24,n>=26&&(n-=26,i++)}if(r+6!==e){var o=s(t,e,r+6);this.words[i]|=o<>>26-n&4194303}this.strip()},i.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;67108863>=i;i*=e)n++;n--,i=i/e|0;for(var s=t.length-r,a=s%n,f=Math.min(s,s-a)+r,u=0,c=r;f>c;c+=n)u=o(t,c,c+n,e),this.imuln(i),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(0!==a){for(var h=1,u=o(t,c,t.length,e),c=0;a>c;c++)h*=e;this.imuln(h),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}},i.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.sign=!1),this},i.prototype.inspect=function(){return(this.red?""};var l=["","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"],b=[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],g=[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){if(t=t||10,16===t||"hex"===t){for(var n="",i=0,e=0|e||1,s=0,o=0;o>>24-i&16777215,n=0!==s||o!==this.length-1?l[6-f.length]+f+n:f+n,i+=2,i>=26&&(i-=26,o--)}for(0!==s&&(n=s.toString(16)+n);n.length%e!==0;)n="0"+n;return this.sign&&(n="-"+n),n}if(t===(0|t)&&t>=2&&36>=t){var u=b[t],c=g[t],n="",h=this.clone();for(h.sign=!1;0!==h.cmpn(0);){var d=h.modn(c).toString(t);h=h.idivn(c),n=0!==h.cmpn(0)?l[u-d.length]+d+n:d+n}return 0===this.cmpn(0)&&(n="0"+n),this.sign&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toArray=function(){this.strip();var t=new Array(this.byteLength());t[0]=0;for(var e=this.clone(),r=0;0!==e.cmpn(0);r++){var n=e.andln(255);e.ishrn(8),t[t.length-r-1]=n}return t},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=0,e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(0===this.cmpn(0))return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.iand=function(t){this.sign=this.sign&&t.sign;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.ixor=function(t){this.sign=this.sign||t.sign;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.setn=function(t,e){r("number"==typeof t&&t>=0); for(var n=t/26|0,i=t%26;this.length<=n;)this.words[this.length++]=0;return e?this.words[n]=this.words[n]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,s=0;s>>26}for(;0!==i&&s>>26}if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;st.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function(t){if(t.sign){t.sign=!1;var e=this.iadd(t);return t.sign=!0,e._normSign()}if(this.sign)return this.sign=!1,this.iadd(t),this.sign=!0,this._normSign();var r=this.cmp(t);if(0===r)return this.sign=!1,this.length=1,this.words[0]=0,this;var n,i;r>0?(n=this,i=t):(n=t,i=this);for(var s=0,o=0;o>26,this.words[o]=67108863&e}for(;0!==s&&o>26,this.words[o]=67108863&e}if(0===s&&o>>26,s=67108863&r,o=Math.min(n,t.length-1),a=Math.max(0,n-this.length+1);o>=a;a++){var f=n-a,u=0|this.words[f],c=0|t.words[a],h=u*c,d=67108863&h;i=i+(h/67108864|0)|0,d=d+s|0,s=67108863&d,i=i+(d>>>26)|0}e.words[n]=s,r=i}return 0!==r?e.words[n]=r:e.length--,e.strip()},i.prototype._bigMulTo=function(t,e){e.sign=t.sign!==this.sign,e.length=this.length+t.length;for(var r=0,n=0,i=0;i=f;f++){var u=i-f,c=0|this.words[u],h=0|t.words[f],d=c*h,p=67108863&d;s=s+(d/67108864|0)|0,p=p+o|0,o=67108863&p,s=s+(p>>>26)|0,n+=s>>>26,s&=67108863}e.words[i]=o,r=s,s=n}return 0!==r?e.words[i]=r:e.length--,e.strip()},i.prototype.mulTo=function(t,e){var r;return r=this.length+t.length<63?this._smallMulTo(t,e):this._bigMulTo(t,e)},i.prototype.mul=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},i.prototype.imul=function(t){if(0===this.cmpn(0)||0===t.cmpn(0))return this.words[0]=0,this.length=1,this;var e=this.length,r=t.length;this.sign=t.sign!==this.sign,this.length=this.length+t.length,this.words[this.length-1]=0;for(var n=this.length-2;n>=0;n--){for(var i=0,s=0,o=Math.min(n,r-1),a=Math.max(0,n-e+1);o>=a;a++){var f=n-a,u=this.words[f],c=t.words[a],h=u*c,d=67108863&h;i+=h/67108864|0,d+=s,s=67108863&d,i+=d>>>26}this.words[n]=s,this.words[n+1]+=i,i=0}for(var i=0,f=1;f>>26}return this.strip()},i.prototype.imuln=function(t){r("number"==typeof t);for(var e=0,n=0;n>=26,e+=i/67108864|0,e+=s>>>26,this.words[n]=67108863&s}return 0!==e&&(this.words[n]=e,this.length++),this},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.mul(this)},i.prototype.ishln=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=67108863>>>26-e<<26-e;if(0!==e){for(var s=0,o=0;o>>26-e}s&&(this.words[o]=s,this.length++)}if(0!==n){for(var o=this.length-1;o>=0;o--)this.words[o+n]=this.words[o];for(var o=0;n>o;o++)this.words[o]=0;this.length+=n}return this.strip()},i.prototype.ishrn=function(t,e,n){r("number"==typeof t&&t>=0);var i;i=e?(e-e%26)/26:0;var s=t%26,o=Math.min((t-s)/26,this.length),a=67108863^67108863>>>s<u;u++)f.words[u]=this.words[u];f.length=o}if(0===o);else if(this.length>o){this.length-=o;for(var u=0;u=0&&(0!==c||u>=i);u--){var h=this.words[u];this.words[u]=c<<26-s|h>>>s,c=h&a}return f&&0!==c&&(f.words[f.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip(),this},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<=0);var e=t%26,n=(t-e)/26;if(r(!this.sign,"imaskn works only with positive numbers"),0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<t?this.isubn(-t):this.sign?1===this.length&&this.words[0]=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},i.prototype.isubn=function(t){if(r("number"==typeof t),0>t)return this.iaddn(-t);if(this.sign)return this.sign=!1,this.iaddn(t),this.sign=!0,this;this.words[0]-=t;for(var e=0;e>26)-(u/67108864|0),this.words[i+n]=67108863&f}for(;i>26,this.words[i+n]=67108863&f}if(0===a)return this.strip();r(-1===a),a=0;for(var i=0;i>26,this.words[i]=67108863&f}return this.sign=!0,this.strip()},i.prototype._wordDiv=function(t,e){var r=this.length-t.length,n=this.clone(),s=t,o=s.words[s.length-1],a=this._countBits(o);r=26-a,0!==r&&(s=s.shln(r),n.ishln(r),o=s.words[s.length-1]);var f,u=n.length-s.length;if("mod"!==e){f=new i(null),f.length=u+1,f.words=new Array(f.length);for(var c=0;c=0;d--){var p=67108864*n.words[s.length+d]+n.words[s.length+d-1];for(p=Math.min(p/o|0,67108863),n._ishlnsubmul(s,p,d);n.sign;)p--,n.sign=!1,n._ishlnsubmul(s,1,d),0!==n.cmpn(0)&&(n.sign=!n.sign);f&&(f.words[d]=p)}return f&&f.strip(),n.strip(),"div"!==e&&0!==r&&n.ishrn(r),{div:f?f:null,mod:n}},i.prototype.divmod=function(t,e){if(r(0!==t.cmpn(0)),this.sign&&!t.sign){var n,s,o=this.neg().divmod(t,e);return"mod"!==e&&(n=o.div.neg()),"div"!==e&&(s=0===o.mod.cmpn(0)?o.mod:t.sub(o.mod)),{div:n,mod:s}}if(!this.sign&&t.sign){var n,o=this.divmod(t.neg(),e);return"mod"!==e&&(n=o.div.neg()),{div:n,mod:o.mod}}return this.sign&&t.sign?this.neg().divmod(t.neg(),e):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modn(t.words[0]))}:this._wordDiv(t,e)},i.prototype.div=function(t){return this.divmod(t,"div").div},i.prototype.mod=function(t){return this.divmod(t,"mod").mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(0===e.mod.cmpn(0))return e.div;var r=e.div.sign?e.mod.isub(t):e.mod,n=t.shrn(1),i=t.andln(1),s=r.cmp(n);return 0>s||1===i&&0===s?e.div:e.div.sign?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modn=function(t){r(67108863>=t);for(var e=(1<<26)%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+this.words[i])%t;return n},i.prototype.idivn=function(t){r(67108863>=t);for(var e=0,n=this.length-1;n>=0;n--){var i=this.words[n]+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){r(!t.sign),r(0!==t.cmpn(0));var e=this,n=t.clone();e=e.sign?e.mod(t):e.clone();for(var s=new i(1),o=new i(0),a=new i(0),f=new i(1),u=0;e.isEven()&&n.isEven();)e.ishrn(1),n.ishrn(1),++u;for(var c=n.clone(),h=e.clone();0!==e.cmpn(0);){for(;e.isEven();)e.ishrn(1),s.isEven()&&o.isEven()?(s.ishrn(1),o.ishrn(1)):(s.iadd(c).ishrn(1),o.isub(h).ishrn(1));for(;n.isEven();)n.ishrn(1),a.isEven()&&f.isEven()?(a.ishrn(1),f.ishrn(1)):(a.iadd(c).ishrn(1),f.isub(h).ishrn(1));e.cmp(n)>=0?(e.isub(n),s.isub(a),o.isub(f)):(n.isub(e),a.isub(s),f.isub(o))}return{a:a,b:f,gcd:n.ishln(u)}},i.prototype._invmp=function(t){r(!t.sign),r(0!==t.cmpn(0));var e=this,n=t.clone();e=e.sign?e.mod(t):e.clone();for(var s=new i(1),o=new i(0),a=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(;e.isEven();)e.ishrn(1),s.isEven()?s.ishrn(1):s.iadd(a).ishrn(1);for(;n.isEven();)n.ishrn(1),o.isEven()?o.ishrn(1):o.iadd(a).ishrn(1);e.cmp(n)>=0?(e.isub(n),s.isub(o)):(n.isub(e),o.isub(s))}return 0===e.cmpn(1)?s:o},i.prototype.gcd=function(t){if(0===this.cmpn(0))return t.clone();if(0===t.cmpn(0))return this.clone();var e=this.clone(),r=t.clone();e.sign=!1,r.sign=!1;for(var n=0;e.isEven()&&r.isEven();n++)e.ishrn(1),r.ishrn(1);for(;;){for(;e.isEven();)e.ishrn(1);for(;r.isEven();)r.ishrn(1);var i=e.cmp(r);if(0>i){var s=e;e=r,r=s}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.ishln(n)},i.prototype.invm=function(t){return this.egcd(t).a.mod(t)},i.prototype.isEven=function(){return 0===(1&this.words[0])},i.prototype.isOdd=function(){return 1===(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<s;s++)this.words[s]=0;return this.words[n]|=i,this.length=n+1,this}for(var o=i,s=n;0!==o&&s>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},i.prototype.cmpn=function(t){var e=0>t;if(e&&(t=-t),this.sign&&!e)return-1;if(!this.sign&&e)return 1;t&=67108863,this.strip();var r;if(this.length>1)r=1;else{var n=this.words[0];r=n===t?0:t>n?-1:1}return this.sign&&(r=-r),r},i.prototype.cmp=function(t){if(this.sign&&!t.sign)return-1;if(!this.sign&&t.sign)return 1;var e=this.ucmp(t);return this.sign?-e:e},i.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length=0;r--){var n=this.words[r],i=t.words[r];if(n!==i){i>n?e=-1:n>i&&(e=1);break}}return e},i.red=function(t){return new d(t)},i.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(!this.sign,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var m={k256:null,p224:null,p192:null,p25519:null};a.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},a.prototype.ireduce=function(t){var e,r=t;do this.split(r,this.tmp),r=this.imulK(r),r=r.iadd(this.tmp),e=r.bitLength();while(e>this.n);var n=e0?r.isub(this.p):r.strip(),r},a.prototype.split=function(t,e){t.ishrn(this.n,0,e)},a.prototype.imulK=function(t){return t.imul(this.k)},n(f,a),f.prototype.split=function(t,e){for(var r=4194303,n=Math.min(t.length,9),i=0;n>i;i++)e.words[i]=t.words[i];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var s=t.words[9];e.words[e.length++]=s&r;for(var i=10;i>>22,s=o}t.words[i-10]=s>>>22,t.length-=9},f.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e,r=0,n=0;n>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function y(t){if(m[t])return m[t];var y;if("k256"===t)y=new f;else if("p224"===t)y=new u;else if("p192"===t)y=new c;else{if("p25519"!==t)throw new Error("Unknown prime "+t);y=new h}return m[t]=y,y},d.prototype._verify1=function(t){r(!t.sign,"red works only with positives"),r(t.red,"red works only with red numbers")},d.prototype._verify2=function(t,e){r(!t.sign&&!e.sign,"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},d.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.mod(this.m)._forceRed(this)},d.prototype.neg=function(t){var e=t.clone();return e.sign=!e.sign,e.iadd(this.m)._forceRed(this)},d.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)},d.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},d.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)},d.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},d.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.shln(e))},d.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},d.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},d.prototype.isqr=function(t){return this.imul(t,t)},d.prototype.sqr=function(t){return this.mul(t,t)},d.prototype.sqrt=function(t){if(0===t.cmpn(0))return t.clone();var e=this.m.andln(3);if(r(e%2===1),3===e){var n=this.m.add(new i(1)).ishrn(2),s=this.pow(t,n);return s}for(var o=this.m.subn(1),a=0;0!==o.cmpn(0)&&0===o.andln(1);)a++,o.ishrn(1);r(0!==o.cmpn(0));var f=new i(1).toRed(this),u=f.redNeg(),c=this.m.subn(1).ishrn(1),h=this.m.bitLength();for(h=new i(2*h*h).toRed(this);0!==this.pow(h,c).cmp(u);)h.redIAdd(u);for(var d=this.pow(h,o),s=this.pow(t,o.addn(1).ishrn(1)),p=this.pow(t,o),l=a;0!==p.cmp(f);){for(var b=p,g=0;0!==b.cmp(f);g++)b=b.redSqr();r(l>g);var m=this.pow(d,new i(1).ishln(l-g-1));s=s.redMul(m),d=m.redSqr(),p=p.redMul(d),l=g}return s},d.prototype.invm=function(t){var e=t._invmp(this.m);return e.sign?(e.sign=!1,this.imod(e).redNeg()):this.imod(e)},d.prototype.pow=function(t,e){var r=[];if(0===e.cmpn(0))return new i(1);for(var n=e.clone();0!==n.cmpn(0);)r.push(n.andln(1)),n.ishrn(1);for(var s=t,o=0;o=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},p.prototype.mul=function(t,e){if(0===t.cmpn(0)||0===e.cmpn(0))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),s=r.isub(n).ishrn(this.shift),o=s;return s.cmp(this.m)>=0?o=s.isub(this.m):s.cmpn(0)<0&&(o=s.iadd(this.m)),o._forceRed(this)},p.prototype.invm=function(t){var e=this.imod(t._invmp(this.m).mul(this.r2));return e._forceRed(this)}}("undefined"==typeof e||e,this)},{}],273:[function(t,e,r){function n(t){if(0===t.length)return"";var e,r,n=[0];for(e=0;e>8,n[r]&=255;for(;s;)n.push(255&s),s>>=8}for(e=0;"1"===t[e]&&ee[n]?1:0,0==r);++n);return 0==r&&(e.length>t.length?r=-1:t.length>e.length&&(r=1)),r}},{}],275:[function(t,e,r){"use strict";var n=r;n.version=t("../package.json").version,n.utils=t("./elliptic/utils"),n.rand=t("brorand"),n.hmacDRBG=t("./elliptic/hmac-drbg"),n.curve=t("./elliptic/curve"),n.curves=t("./elliptic/curves"),n.ec=t("./elliptic/ec")},{"../package.json":295,"./elliptic/curve":278,"./elliptic/curves":281,"./elliptic/ec":282,"./elliptic/hmac-drbg":285,"./elliptic/utils":287,brorand:288}],276:[function(t,e,r){"use strict";function n(t,e){this.type=t,this.p=new s(e.p,16),this.red=e.prime?s.red(e.prime):s.mont(this.p),this.zero=new s(0).toRed(this.red),this.one=new s(1).toRed(this.red),this.two=new s(2).toRed(this.red),this.n=e.n&&new s(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)}function i(t,e){this.curve=t,this.type=e,this.precomputed=null}var s=t("bn.js"),o=t("../../elliptic"),a=o.utils.getNAF,f=o.utils.getJSF,u=o.utils.assert;e.exports=n,n.prototype.point=function(){throw new Error("Not implemented")},n.prototype.validate=function(){throw new Error("Not implemented")},n.prototype._fixedNafMul=function(t,e){var r=t._getDoubles(),n=a(e,1),i=(1<=o;e--)f=(f<<1)+n[e];s.push(f)}for(var u=this.jpoint(null,null,null),c=this.jpoint(null,null,null),h=i;h>0;h--){for(var o=0;o=0;f--){for(var e=0;f>=0&&0===s[f];f--)e++;if(f>=0&&e++,o=o.dblp(e),0>f)break;var c=s[f];u(0!==c),o="affine"===t.type?c>0?o.mixedAdd(i[c-1>>1]):o.mixedAdd(i[-c-1>>1].neg()):c>0?o.add(i[c-1>>1]):o.add(i[-c-1>>1].neg())}return"affine"===t.type?o.toP():o},n.prototype._wnafMulAdd=function(t,e,r,n){for(var i=this._wnafT1,s=this._wnafT2,o=this._wnafT3,u=0,c=0;n>c;c++){var h=e[c],d=h._getNAFPoints(t);i[c]=d.wnd,s[c]=d.points}for(var c=n-1;c>=1;c-=2){var p=c-1,l=c;if(1===i[p]&&1===i[l]){var b=[e[p],null,null,e[l]];0===e[p].y.cmp(e[l].y)?(b[1]=e[p].add(e[l]),b[2]=e[p].toJ().mixedAdd(e[l].neg())):0===e[p].y.cmp(e[l].y.redNeg())?(b[1]=e[p].toJ().mixedAdd(e[l]),b[2]=e[p].add(e[l].neg())):(b[1]=e[p].toJ().mixedAdd(e[l]),b[2]=e[p].toJ().mixedAdd(e[l].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],m=f(r[p],r[l]);u=Math.max(m[0].length,u),o[p]=new Array(u),o[l]=new Array(u);for(var y=0;u>y;y++){var v=0|m[0][y],_=0|m[1][y];o[p][y]=g[3*(v+1)+(_+1)],o[l][y]=0,s[p]=b}}else o[p]=a(r[p],i[p]),o[l]=a(r[l],i[l]),u=Math.max(o[p].length,u),u=Math.max(o[l].length,u)}for(var w=this.jpoint(null,null,null),S=this._wnafT4,c=u;c>=0;c--){for(var I=0;c>=0;){for(var k=!0,y=0;n>y;y++)S[y]=0|o[y][c],0!==S[y]&&(k=!1);if(!k)break;I++,c--}if(c>=0&&I++,w=w.dblp(I),0>c)break;for(var y=0;n>y;y++){var h,E=S[y];0!==E&&(E>0?h=s[y][E-1>>1]:0>E&&(h=s[y][-E-1>>1].neg()),w="affine"===h.type?w.mixedAdd(h):w.add(h))}}for(var c=0;n>c;c++)s[c]=null;return w.toP()},n.BasePoint=i,i.prototype.validate=function(){return this.curve.validate(this)},i.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},i.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;e>i;i+=t){for(var s=0;t>s;s++)n=n.dbl();r.push(n)}return{step:t,points:r}},i.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],r=(1<i;i++)e[i]=e[i-1].add(n);return{wnd:t,points:e}},i.prototype._getBeta=function(){return null},i.prototype.dblp=function(t){for(var e=this,r=0;t>r;r++)e=e.dbl();return e}},{"../../elliptic":275,"bn.js":272}],277:[function(t,e,r){"use strict";function n(t){this.twisted=1!==(0|t.a),this.mOneA=this.twisted&&-1===(0|t.a),this.extended=this.mOneA,u.call(this,"edwards",t),this.a=new a(t.a,16).mod(this.red.m).toRed(this.red),this.c=new a(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new a(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),c(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1===(0|t.c)}function i(t,e,r,n,i){u.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 a(e,16),this.y=new a(r,16),this.z=n?new a(n,16):this.curve.one,this.t=i&&new a(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()))))}var s=t("../curve"),o=t("../../elliptic"),a=t("bn.js"),f=t("inherits"),u=s.base,c=o.utils.assert;f(n,u),e.exports=n,n.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},n.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},n.prototype.jpoint=function(t,e,r,n){return this.point(t,e,r,n)},n.prototype.pointFromX=function(t,e){e=new a(e,16),e.red||(e=e.toRed(this.red));var r=e.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()).redSqrt(),f=o.fromRed().isOdd();return(t&&!f||!t&&f)&&(o=o.redNeg()),this.point(e,o,s.one)},n.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)},f(i,u.BasePoint),n.prototype.pointFromJSON=function(t){return i.fromJSON(this,t)},n.prototype.point=function(t,e,r,n){return new i(this,t,e,r,n)},i.fromJSON=function(t,e){return new i(t,e[0],e[1],e[2])},i.prototype.inspect=function(){return this.isInfinity()?"":""},i.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&0===this.y.cmp(this.z)},i.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),s=n.redAdd(e),o=s.redSub(r),a=n.redSub(e),f=i.redMul(o),u=s.redMul(a),c=i.redMul(a),h=o.redMul(s);return this.curve.point(f,u,h,c)},i.prototype._projDbl=function(){var t,e,r,n=this.x.redAdd(this.y).redSqr(),i=this.x.redSqr(),s=this.y.redSqr();if(this.curve.twisted){var o=this.curve._mulA(i),a=o.redAdd(s);if(this.zOne)t=n.redSub(i).redSub(s).redMul(a.redSub(this.curve.two)),e=a.redMul(o.redSub(s)),r=a.redSqr().redSub(a).redSub(a);else{var f=this.z.redSqr(),u=a.redSub(f).redISub(f);t=n.redSub(i).redISub(s).redMul(u),e=a.redMul(o.redSub(s)),r=a.redMul(u)}}else{var o=i.redAdd(s),f=this.curve._mulC(this.c.redMul(this.z)).redSqr(),u=o.redSub(f).redSub(f);t=this.curve._mulC(n.redISub(o)).redMul(u),e=this.curve._mulC(o).redMul(i.redISub(s)),r=o.redMul(u)}return this.curve.point(t,e,r)},i.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},i.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)),s=r.redSub(e),o=i.redSub(n),a=i.redAdd(n),f=r.redAdd(e),u=s.redMul(o),c=a.redMul(f),h=s.redMul(f),d=o.redMul(a);return this.curve.point(u,c,d,h)},i.prototype._projAdd=function(t){var e,r,n=this.z.redMul(t.z),i=n.redSqr(),s=this.x.redMul(t.x),o=this.y.redMul(t.y),a=this.curve.d.redMul(s).redMul(o),f=i.redSub(a),u=i.redAdd(a),c=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(s).redISub(o),h=n.redMul(f).redMul(c);return this.curve.twisted?(e=n.redMul(u).redMul(o.redSub(this.curve._mulA(s))),r=f.redMul(u)):(e=n.redMul(u).redMul(o.redSub(s)),r=this.curve._mulC(f).redMul(u)),this.curve.point(h,e,r)},i.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},i.prototype.mul=function(t){return this.precomputed&&this.precomputed.doubles?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},i.prototype.mulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2)},i.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},i.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},i.prototype.getX=function(){return this.normalize(),this.x.fromRed()},i.prototype.getY=function(){return this.normalize(),this.y.fromRed()},i.prototype.toP=i.prototype.normalize,i.prototype.mixedAdd=i.prototype.add},{"../../elliptic":275,"../curve":278,"bn.js":272,inherits:296}],278:[function(t,e,r){arguments[4][90][0].apply(r,arguments)},{"./base":276,"./edwards":277,"./mont":279,"./short":280,dup:90}],279:[function(t,e,r){"use strict";function n(t){f.call(this,"mont",t),this.a=new o(t.a,16).toRed(this.red),this.b=new o(t.b,16).toRed(this.red),this.i4=new o(4).toRed(this.red).redInvm(),this.two=new o(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function i(t,e,r){f.BasePoint.call(this,t,"projective"),null===e&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new o(e,16),this.z=new o(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}var s=t("../curve"),o=t("bn.js"),a=t("inherits"),f=s.base;a(n,f),e.exports=n,n.prototype.validate=function(t){var e=t.normalize().x,r=e.redSqr(),n=r.redMul(e).redAdd(r.redMul(this.a)).redAdd(e),i=n.redSqrt();return 0===i.redSqr().cmp(n)},a(i,f.BasePoint),n.prototype.point=function(t,e){return new i(this,t,e)},n.prototype.pointFromJSON=function(t){return i.fromJSON(this,t)},i.prototype.precompute=function(){},i.fromJSON=function(t,e){return new i(t,e[0],e[1]||t.one)},i.prototype.inspect=function(){return this.isInfinity()?"":""},i.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},i.prototype.dbl=function(){var t=this.x.redAdd(this.z),e=t.redSqr(),r=this.x.redSub(this.z),n=r.redSqr(),i=e.redSub(n),s=e.redMul(n),o=i.redMul(n.redAdd(this.curve.a24.redMul(i)));return this.curve.point(s,o)},i.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.diffAdd=function(t,e){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=t.x.redAdd(t.z),s=t.x.redSub(t.z),o=s.redMul(r),a=i.redMul(n),f=e.z.redMul(o.redAdd(a).redSqr()),u=e.x.redMul(o.redISub(a).redSqr());return this.curve.point(f,u)},i.prototype.mul=function(t){for(var e=t.clone(),r=this,n=this.curve.point(null,null),i=this,s=[];0!==e.cmpn(0);e.ishrn(1))s.push(e.andln(1));for(var o=s.length-1;o>=0;o--)0===s[o]?(r=r.diffAdd(n,i),n=n.dbl()):(n=r.diffAdd(n,i),r=r.dbl());return n},i.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},i.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},{"../curve":278,"bn.js":272,inherits:296}],280:[function(t,e,r){"use strict";function n(t){c.call(this,"short",t),this.a=new f(t.a,16).toRed(this.red),this.b=new f(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function i(t,e,r,n){c.BasePoint.call(this,t,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new f(e,16),this.y=new f(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function s(t,e,r,n){c.BasePoint.call(this,t,"jacobian"),null===e&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one, this.z=new f(0)):(this.x=new f(e,16),this.y=new f(r,16),this.z=new f(n,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.zOne=this.z===this.curve.one}var o=t("../curve"),a=t("../../elliptic"),f=t("bn.js"),u=t("inherits"),c=o.base,h=a.utils.assert;u(n,c),e.exports=n,n.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,r;if(t.beta)e=new f(t.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);e=n[0].cmp(n[1])<0?n[0]:n[1],e=e.toRed(this.red)}if(t.lambda)r=new f(t.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(e))?r=i[0]:(r=i[1],h(0===this.g.mul(r).x.cmp(this.g.x.redMul(e))))}var s;return s=t.basis?t.basis.map(function(t){return{a:new f(t.a,16),b:new f(t.b,16)}}):this._getEndoBasis(r),{beta:e,lambda:r,basis:s}}},n.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:f.mont(t),r=new f(2).toRed(e).redInvm(),n=r.redNeg(),i=new f(3).toRed(e).redNeg().redSqrt().redMul(r),s=n.redAdd(i).fromRed(),o=n.redSub(i).fromRed();return[s,o]},n.prototype._getEndoBasis=function(t){for(var e,r,n,i,s,o,a,u,c,h=this.n.shrn(Math.floor(this.n.bitLength()/2)),d=t,p=this.n.clone(),l=new f(1),b=new f(0),g=new f(0),m=new f(1),y=0;0!==d.cmpn(0);){var v=p.div(d);u=p.sub(v.mul(d)),c=g.sub(v.mul(l));var _=m.sub(v.mul(b));if(!n&&u.cmp(h)<0)e=a.neg(),r=l,n=u.neg(),i=c;else if(n&&2===++y)break;a=u,p=d,d=u,g=l,l=c,m=b,b=_}s=u.neg(),o=c;var w=n.sqr().add(i.sqr()),S=s.sqr().add(o.sqr());return S.cmp(w)>=0&&(s=e,o=r),n.sign&&(n=n.neg(),i=i.neg()),s.sign&&(s=s.neg(),o=o.neg()),[{a:n,b:i},{a:s,b:o}]},n.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),s=r.b.neg().mul(t).divRound(this.n),o=i.mul(r.a),a=s.mul(n.a),f=i.mul(r.b),u=s.mul(n.b),c=t.sub(o).sub(a),h=f.add(u).neg();return{k1:c,k2:h}},n.prototype.pointFromX=function(t,e){e=new f(e,16),e.red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt(),i=n.fromRed().isOdd();return(t&&!i||!t&&i)&&(n=n.redNeg()),this.point(e,n)},n.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)},n.prototype._endoWnafMulAdd=function(t,e){for(var r=this._endoWnafT1,n=this._endoWnafT2,i=0;iu;u++)r[u]=null,n[u]=null;return f},u(i,c.BasePoint),n.prototype.point=function(t,e,r){return new i(this,t,e,r)},n.prototype.pointFromJSON=function(t,e){return i.fromJSON(this,t,e)},i.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var r=this.curve,n=function(t){return r.point(t.x.redMul(r.endo.beta),t.y)};t.beta=e,e.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(n)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(n)}}}return e}},i.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},i.fromJSON=function(t,e,r){function n(e){return t.point(e[0],e[1],r)}"string"==typeof e&&(e=JSON.parse(e));var i=t.point(e[0],e[1],r);if(!e[2])return i;var s=e[2];return i.precomputed={beta:null,doubles:s.doubles&&{step:s.doubles.step,points:[i].concat(s.doubles.points.map(n))},naf:s.naf&&{wnd:s.naf.wnd,points:[i].concat(s.naf.points.map(n))}},i},i.prototype.inspect=function(){return this.isInfinity()?"":""},i.prototype.isInfinity=function(){return this.inf},i.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)},i.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),s=i.redSqr().redISub(this.x.redAdd(this.x)),o=i.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,o)},i.prototype.getX=function(){return this.x.fromRed()},i.prototype.getY=function(){return this.y.fromRed()},i.prototype.mul=function(t){return t=new f(t,16),this.precomputed&&this.precomputed.doubles?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},i.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)},i.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))},i.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},i.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var t=this.curve.jpoint(this.x,this.y,this.curve.one);return t},u(s,c.BasePoint),n.prototype.jpoint=function(t,e,r){return new s(this,t,e,r)},s.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)},s.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},s.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),s=this.y.redMul(e.redMul(t.z)),o=t.y.redMul(r.redMul(this.z)),a=n.redSub(i),f=s.redSub(o);if(0===a.cmpn(0))return 0!==f.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),c=u.redMul(a),h=n.redMul(u),d=f.redSqr().redIAdd(c).redISub(h).redISub(h),p=f.redMul(h.redISub(d)).redISub(s.redMul(c)),l=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(d,p,l)},s.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,s=t.y.redMul(e).redMul(this.z),o=r.redSub(n),a=i.redSub(s);if(0===o.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var f=o.redSqr(),u=f.redMul(o),c=r.redMul(f),h=a.redSqr().redIAdd(u).redISub(c).redISub(c),d=a.redMul(c.redISub(h)).redISub(i.redMul(u)),p=this.z.redMul(o);return this.curve.jpoint(h,d,p)},s.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var e=this,r=0;t>r;r++)e=e.dbl();return e}for(var n=this.curve.a,i=this.curve.tinv,s=this.x,o=this.y,a=this.z,f=a.redSqr().redSqr(),u=o.redAdd(o),r=0;t>r;r++){var c=s.redSqr(),h=u.redSqr(),d=h.redSqr(),p=c.redAdd(c).redIAdd(c).redIAdd(n.redMul(f)),l=s.redMul(h),b=p.redSqr().redISub(l.redAdd(l)),g=l.redISub(b),m=p.redMul(g);m=m.redIAdd(m).redISub(d);var y=u.redMul(a);t>r+1&&(f=f.redMul(d)),s=b,a=y,u=m}return this.curve.jpoint(s,u.redMul(i),a)},s.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},s.prototype._zeroDbl=function(){var t,e,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),s=i.redSqr(),o=this.x.redAdd(i).redSqr().redISub(n).redISub(s);o=o.redIAdd(o);var a=n.redAdd(n).redIAdd(n),f=a.redSqr().redISub(o).redISub(o),u=s.redIAdd(s);u=u.redIAdd(u),u=u.redIAdd(u),t=f,e=a.redMul(o.redISub(f)).redISub(u),r=this.y.redAdd(this.y)}else{var c=this.x.redSqr(),h=this.y.redSqr(),d=h.redSqr(),p=this.x.redAdd(h).redSqr().redISub(c).redISub(d);p=p.redIAdd(p);var l=c.redAdd(c).redIAdd(c),b=l.redSqr(),g=d.redIAdd(d);g=g.redIAdd(g),g=g.redIAdd(g),t=b.redISub(p).redISub(p),e=l.redMul(p.redISub(t)).redISub(g),r=this.y.redMul(this.z),r=r.redIAdd(r)}return this.curve.jpoint(t,e,r)},s.prototype._threeDbl=function(){var t,e,r;if(this.zOne){var n=this.x.redSqr(),i=this.y.redSqr(),s=i.redSqr(),o=this.x.redAdd(i).redSqr().redISub(n).redISub(s);o=o.redIAdd(o);var a=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),f=a.redSqr().redISub(o).redISub(o);t=f;var u=s.redIAdd(s);u=u.redIAdd(u),u=u.redIAdd(u),e=a.redMul(o.redISub(f)).redISub(u),r=this.y.redAdd(this.y)}else{var c=this.z.redSqr(),h=this.y.redSqr(),d=this.x.redMul(h),p=this.x.redSub(c).redMul(this.x.redAdd(c));p=p.redAdd(p).redIAdd(p);var l=d.redIAdd(d);l=l.redIAdd(l);var b=l.redAdd(l);t=p.redSqr().redISub(b),r=this.y.redAdd(this.z).redSqr().redISub(h).redISub(c);var g=h.redSqr();g=g.redIAdd(g),g=g.redIAdd(g),g=g.redIAdd(g),e=p.redMul(l.redISub(t)).redISub(g)}return this.curve.jpoint(t,e,r)},s.prototype._dbl=function(){var t=this.curve.a,e=this.x,r=this.y,n=this.z,i=n.redSqr().redSqr(),s=e.redSqr(),o=r.redSqr(),a=s.redAdd(s).redIAdd(s).redIAdd(t.redMul(i)),f=e.redAdd(e);f=f.redIAdd(f);var u=f.redMul(o),c=a.redSqr().redISub(u.redAdd(u)),h=u.redISub(c),d=o.redSqr();d=d.redIAdd(d),d=d.redIAdd(d),d=d.redIAdd(d);var p=a.redMul(h).redISub(d),l=r.redAdd(r).redMul(n);return this.curve.jpoint(c,p,l)},s.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr(),n=e.redSqr(),i=t.redAdd(t).redIAdd(t),s=i.redSqr(),o=this.x.redAdd(e).redSqr().redISub(t).redISub(n);o=o.redIAdd(o),o=o.redAdd(o).redIAdd(o),o=o.redISub(s);var a=o.redSqr(),f=n.redIAdd(n);f=f.redIAdd(f),f=f.redIAdd(f),f=f.redIAdd(f);var u=i.redIAdd(o).redSqr().redISub(s).redISub(a).redISub(f),c=e.redMul(u);c=c.redIAdd(c),c=c.redIAdd(c);var h=this.x.redMul(a).redISub(c);h=h.redIAdd(h),h=h.redIAdd(h);var d=this.y.redMul(u.redMul(f.redISub(u)).redISub(o.redMul(a)));d=d.redIAdd(d),d=d.redIAdd(d),d=d.redIAdd(d);var p=this.z.redAdd(o).redSqr().redISub(r).redISub(a);return this.curve.jpoint(h,d,p)},s.prototype.mul=function(t,e){return t=new f(t,e),this.curve._wnafMul(this,t)},s.prototype.eq=function(t){if("affine"===t.type)return this.eq(t.toJ());if(this===t)return!0;var e=this.z.redSqr(),r=t.z.redSqr();if(0!==this.x.redMul(r).redISub(t.x.redMul(e)).cmpn(0))return!1;var n=e.redMul(this.z),i=r.redMul(t.z);return 0===this.y.redMul(i).redISub(t.y.redMul(n)).cmpn(0)},s.prototype.inspect=function(){return this.isInfinity()?"":""},s.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../../elliptic":275,"../curve":278,"bn.js":272,inherits:296}],281:[function(t,e,r){"use strict";function n(t){"short"===t.type?this.curve=new a.curve["short"](t):"edwards"===t.type?this.curve=new a.curve.edwards(t):this.curve=new a.curve.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,f(this.g.validate(),"Invalid curve"),f(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function i(t,e){Object.defineProperty(s,t,{configurable:!0,enumerable:!0,get:function(){var r=new n(e);return Object.defineProperty(s,t,{configurable:!0,enumerable:!0,value:r}),r}})}var s=r,o=t("hash.js"),a=t("../elliptic"),f=a.utils.assert;s.PresetCurve=n,i("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),i("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),i("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),i("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"0",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),i("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var u;try{u=t("./precomputed/secp256k1")}catch(c){u=void 0}i("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",u]})},{"../elliptic":275,"./precomputed/secp256k1":286,"hash.js":289}],282:[function(t,e,r){"use strict";function n(t){return this instanceof n?("string"==typeof t&&(a(s.curves.hasOwnProperty(t),"Unknown curve "+t),t=s.curves[t]),t instanceof s.curves.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.shrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),void(this.hash=t.hash||t.curve.hash)):new n(t)}var i=t("bn.js"),s=t("../../elliptic"),o=s.utils,a=o.assert,f=t("./key"),u=t("./signature");e.exports=n,n.prototype.keyPair=function(t){return new f(this,t)},n.prototype.keyFromPrivate=function(t,e){return f.fromPrivate(this,t,e)},n.prototype.keyFromPublic=function(t,e){return f.fromPublic(this,t,e)},n.prototype.genKeyPair=function(t){t||(t={});for(var e=new s.hmacDRBG({hash:this.hash,pers:t.pers,entropy:t.entropy||s.rand(this.hash.hmacStrength),nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new i(2));;){var o=new i(e.generate(r));if(!(o.cmp(n)>0))return o.iaddn(1),this.keyFromPrivate(o)}},n.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return r>0&&(t=t.shrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},n.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 i(t,16));for(var o=this.n.byteLength(),a=e.getPrivate().toArray(),f=a.length;21>f;f++)a.unshift(0);for(var c=t.toArray(),f=c.length;o>f;f++)c.unshift(0);for(var h=new s.hmacDRBG({hash:this.hash,entropy:a,nonce:c}),d=this.n.sub(new i(1));;){var p=new i(h.generate(this.n.byteLength()));if(p=this._truncateToN(p,!0),!(p.cmpn(1)<=0||p.cmp(d)>=0)){var l=this.g.mul(p);if(!l.isInfinity()){var b=l.getX().mod(this.n);if(0!==b.cmpn(0)){var g=p.invm(this.n).mul(b.mul(e.getPrivate()).iadd(t)).mod(this.n);if(0!==g.cmpn(0))return n.canonical&&g.cmp(this.nh)>0&&(g=this.n.sub(g)),new u({r:b,s:g})}}}}},n.prototype.verify=function(t,e,r,n){t=this._truncateToN(new i(t,16)),r=this.keyFromPublic(r,n),e=new u(e,"hex");var s=e.r,o=e.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a=o.invm(this.n),f=a.mul(t).mod(this.n),c=a.mul(s).mod(this.n),h=this.g.mulAdd(f,r.getPublic(),c);return h.isInfinity()?!1:0===h.getX().mod(this.n).cmp(s)}},{"../../elliptic":275,"./key":283,"./signature":284,"bn.js":272}],283:[function(t,e,r){"use strict";function n(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var i=t("bn.js"),s=t("../../elliptic"),o=s.utils;e.exports=n,n.fromPublic=function(t,e,r){return e instanceof n?e:new n(t,{pub:e,pubEnc:r})},n.fromPrivate=function(t,e,r){return e instanceof n?e:new n(t,{priv:e,privEnc:r})},n.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},n.prototype.getPublic=function(t,e){if(this.pub||(this.pub=this.ec.g.mul(this.priv)),"string"==typeof t&&(e=t,t=null),!e)return this.pub;for(var r=this.ec.curve.p.byteLength(),n=this.pub.getX().toArray(),i=n.length;r>i;i++)n.unshift(0);var s;if("mont"!==this.ec.curve.type)if(t)s=[this.pub.getY().isEven()?2:3].concat(n);else{for(var a=this.pub.getY().toArray(),i=a.length;r>i;i++)a.unshift(0);var s=[4].concat(n,a)}else s=n;return o.encode(s,e)},n.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},n.prototype._importPrivate=function(t,e){this.priv=new i(t,e||16),this.priv=this.priv.mod(this.ec.curve.n)},n.prototype._importPublic=function(t,e){return t.x||t.y?void(this.pub=this.ec.curve.point(t.x,t.y)):(t=o.toArray(t,e),"mont"!==this.ec.curve.type?this._importPublicShort(t):this._importPublicMont(t))},n.prototype._importPublicShort=function(t){var e=this.ec.curve.p.byteLength();4===t[0]&&t.length-1===2*e?this.pub=this.ec.curve.point(t.slice(1,1+e),t.slice(1+e,1+2*e)):2!==t[0]&&3!==t[0]||t.length-1!==e||(this.pub=this.ec.curve.pointFromX(3===t[0],t.slice(1,1+e)))},n.prototype._importPublicMont=function(t){this.pub=this.ec.curve.point(t,1)},n.prototype.derive=function(t){return t.mul(this.priv).getX()},n.prototype.sign=function(t){return this.ec.sign(t,this)},n.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},n.prototype.inspect=function(){return""}},{"../../elliptic":275,"bn.js":272}],284:[function(t,e,r){"use strict";function n(t,e){return t instanceof n?t:void(this._importDER(t,e)||(a(t.r&&t.s,"Signature without r or s"),this.r=new i(t.r,16),this.s=new i(t.s,16)))}var i=t("bn.js"),s=t("../../elliptic"),o=s.utils,a=o.assert;e.exports=n,n.prototype._importDER=function(t,e){if(t=o.toArray(t,e),t.length<6||48!==t[0]||2!==t[2])return!1;var r=t[1];if(1+r>t.length)return!1;var n=t[3];if(n>=128)return!1;if(4+n+2>=t.length)return!1;if(2!==t[4+n])return!1;var s=t[5+n];return s>=128?!1:4+n+2+s>t.length?!1:(this.r=new i(t.slice(4,4+n)),this.s=new i(t.slice(4+n+2,4+n+2+s)),!0)},n.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r));var n=e.length+r.length+4,i=[48,n,2,e.length];return i=i.concat(e,[2,r.length],r),o.encode(i,t)}},{"../../elliptic":275,"bn.js":272}],285:[function(t,e,r){arguments[4][100][0].apply(r,arguments)},{"../elliptic":275,dup:100,"hash.js":289}],286:[function(t,e,r){arguments[4][101][0].apply(r,arguments)},{dup:101}],287:[function(t,e,r){"use strict";function n(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"!=typeof t){for(var n=0;n>8,o=255&i;s?r.push(s,o):r.push(o)}return r}function i(t){return 1===t.length?"0"+t:t}function s(t){for(var e="",r=0;r=0;){var s;if(i.isOdd()){var o=i.andln(n-1);s=o>(n>>1)-1?(n>>1)-o:o,i.isubn(s)}else s=0;r.push(s);for(var a=0!==i.cmpn(0)&&0===i.andln(n-1)?e+1:1,f=1;a>f;f++)r.push(0);i.ishrn(a)}return r}function a(t,e){var r=[[],[]];t=t.clone(),e=e.clone();for(var n=0,i=0;t.cmpn(-n)>0||e.cmpn(-i)>0;){var s=t.andln(3)+n&3,o=e.andln(3)+i&3;3===s&&(s=-1),3===o&&(o=-1);var a;if(0===(1&s))a=0;else{var f=t.andln(7)+n&7;a=3!==f&&5!==f||2!==o?s:-s}r[0].push(a);var u;if(0===(1&o))u=0;else{var f=e.andln(7)+i&7;u=3!==f&&5!==f||2!==s?o:-o}r[1].push(u),2*n===a+1&&(n=1-n),2*i===u+1&&(i=1-i),t.ishrn(1),e.ishrn(1)}return r}var f=r;f.assert=function(t,e){if(!t)throw new Error(e||"Assertion failed")},f.toArray=n,f.zero2=i,f.toHex=s,f.encode=function(t,e){return"hex"===e?s(t):t},f.getNAF=o,f.getJSF=a},{}],288:[function(t,e,r){arguments[4][103][0].apply(r,arguments)},{dup:103}],289:[function(t,e,r){arguments[4][104][0].apply(r,arguments)},{"./hash/common":290,"./hash/hmac":291,"./hash/ripemd":292,"./hash/sha":293,"./hash/utils":294,dup:104}],290:[function(t,e,r){arguments[4][105][0].apply(r,arguments)},{"../hash":289,dup:105}],291:[function(t,e,r){arguments[4][106][0].apply(r,arguments)},{"../hash":289,dup:106}],292:[function(t,e,r){arguments[4][107][0].apply(r,arguments)},{"../hash":289,dup:107}],293:[function(t,e,r){arguments[4][108][0].apply(r,arguments)},{"../hash":289,dup:108}],294:[function(t,e,r){arguments[4][109][0].apply(r,arguments)},{dup:109,inherits:296}],295:[function(t,e,r){e.exports={name:"elliptic",version:"3.0.3",description:"EC cryptography",main:"lib/elliptic.js",scripts:{test:"make lint && mocha --reporter=spec test/*-test.js"},repository:{type:"git",url:"git+ssh://git@github.com/indutny/elliptic.git"},keywords:["EC","Elliptic","curve","Cryptography"],author:{name:"Fedor Indutny",email:"fedor@indutny.com"},license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{browserify:"^3.44.2",jscs:"^1.11.3",jshint:"^2.6.0",mocha:"^2.1.0","uglify-js":"^2.4.13"},dependencies:{"bn.js":"^2.0.0",brorand:"^1.0.1","hash.js":"^1.0.0",inherits:"^2.0.1"},readme:"# Elliptic [![Build Status](https://secure.travis-ci.org/indutny/elliptic.png)](http://travis-ci.org/indutny/elliptic)\n\nFast elliptic-curve cryptography in a plain javascript implementation.\n\nNOTE: Please take a look at http://safecurves.cr.yp.to/ before choosing a curve\nfor your cryptography operations.\n\n## Incentive\n\nECC is much slower than regular RSA cryptography, the JS implementations are\neven more slower.\n\n## Benchmarks\n\n```bash\n$ node benchmarks/index.js\nBenchmarking: sign\nelliptic#sign x 262 ops/sec ±0.51% (177 runs sampled)\neccjs#sign x 55.91 ops/sec ±0.90% (144 runs sampled)\n------------------------\nFastest is elliptic#sign\n========================\nBenchmarking: verify\nelliptic#verify x 113 ops/sec ±0.50% (166 runs sampled)\neccjs#verify x 48.56 ops/sec ±0.36% (125 runs sampled)\n------------------------\nFastest is elliptic#verify\n========================\nBenchmarking: gen\nelliptic#gen x 294 ops/sec ±0.43% (176 runs sampled)\neccjs#gen x 62.25 ops/sec ±0.63% (129 runs sampled)\n------------------------\nFastest is elliptic#gen\n========================\nBenchmarking: ecdh\nelliptic#ecdh x 136 ops/sec ±0.85% (156 runs sampled)\n------------------------\nFastest is elliptic#ecdh\n========================\n```\n\n## API\n\n### ECDSA\n\n```javascript\nvar EC = require('elliptic').ec;\n\n// Create and initialize EC context\n// (better do it once and reuse it)\nvar ec = new EC('secp256k1');\n\n// Generate keys\nvar key = ec.genKeyPair();\n\n// Sign message (must be an array, or it'll be treated as a hex sequence)\nvar msg = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ];\nvar signature = key.sign(msg);\n\n// Export DER encoded signature in Array\nvar derSign = signature.toDER();\n\n// Verify signature\nconsole.log(key.verify(msg, derSign));\n```\n\n### ECDH\n\n```javascript\n// Generate keys\nvar key1 = ec.genKeyPair();\nvar key2 = ec.genKeyPair();\n\nvar shared1 = key1.derive(key2.getPublic());\nvar shared2 = key2.derive(key1.getPublic());\n\nconsole.log('Both shared secrets are BN instances');\nconsole.log(shared1.toString(16));\nconsole.log(shared2.toString(16));\n```\n\nNOTE: `.derive()` returns a [BN][1] instance.\n\n## Supported curves\n\nElliptic.js support following curve types:\n\n* Short Weierstrass\n* Montgomery\n* Edwards\n* Twisted Edwards\n\nFollowing curve 'presets' are embedded into the library:\n\n* `secp256k1`\n* `p192`\n* `p224`\n* `p256`\n* `curve25519`\n* `ed25519`\n\nNOTE: That `curve25519` could not be used for ECDSA, use `ed25519` instead.\n\n### Implementation details\n\nECDSA is using deterministic `k` value generation as per [RFC6979][0]. Most of\nthe curve operations are performed on non-affine coordinates (either projective\nor extended), various windowing techniques are used for different cases.\n\nAll operations are performed in reduction context using [bn.js][1], hashing is\nprovided by [hash.js][2]\n\n### Related projects\n\n* [eccrypto][3]: isomorphic implementation of ECDSA, ECDH and ECIES for both\n browserify and node (uses `elliptic` for browser and [secp256k1-node][4] for\n node)\n\n#### LICENSE\n\nThis software is licensed under the MIT License.\n\nCopyright Fedor Indutny, 2014.\n\nPermission is hereby granted, free of charge, to any person obtaining a\ncopy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to permit\npersons to whom the Software is furnished to do so, subject to the\nfollowing conditions:\n\nThe above copyright notice and this permission notice shall be included\nin all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\nOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\nNO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\nDAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\nOTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\nUSE OR OTHER DEALINGS IN THE SOFTWARE.\n\n[0]: http://tools.ietf.org/html/rfc6979\n[1]: https://github.com/indutny/bn.js\n[2]: https://github.com/indutny/hash.js\n[3]: https://github.com/bitchan/eccrypto\n[4]: https://github.com/wanderer/secp256k1-node\n",readmeFilename:"README.md",_id:"elliptic@3.0.3",_shasum:"865c9b420bfbe55006b9f969f97a0d2c44966595",_resolved:"https://registry.npmjs.org/elliptic/-/elliptic-3.0.3.tgz",_from:"https://registry.npmjs.org/elliptic/-/elliptic-3.0.3.tgz"}},{}],296:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},{}],297:[function(t,e,r){(function(t){(function(){function n(t,e){if(t!==e){var r=null===t,n=t===E,i=t===t,s=null===e,o=e===E,a=e===e;if(t>e&&!s||!i||r&&!o&&a||n&&a)return 1;if(e>t&&!r||!a||s&&!n&&i||o&&i)return-1}return 0}function i(t,e,r){for(var n=t.length,i=r?n:-1;r?i--:++i-1;);return r}function u(t,e){for(var r=t.length;r--&&e.indexOf(t.charAt(r))>-1;);return r}function c(t,e){return n(t.criteria,e.criteria)||t.index-e.index}function h(t,e,r){for(var i=-1,s=t.criteria,o=e.criteria,a=s.length,f=r.length;++i=f)return u;var c=r[i];return u*("asc"===c||c===!0?1:-1)}}return t.index-e.index}function d(t){return qt[t]}function p(t){return Vt[t]}function l(t,e,r){return e?t=Wt[t]:r&&(t=Xt[t]),"\\"+t}function b(t){return"\\"+Xt[t]}function g(t,e,r){for(var n=t.length,i=e+(r?0:-1);r?i--:++i=t&&t>=9&&13>=t||32==t||160==t||5760==t||6158==t||t>=8192&&(8202>=t||8232==t||8233==t||8239==t||8287==t||12288==t||65279==t)}function v(t,e){for(var r=-1,n=t.length,i=-1,s=[];++re,i=r?t.length:0,s=Vr(0,i,this.__views__),o=s.start,a=s.end,f=a-o,u=n?a:o-1,c=this.__iteratees__,h=c.length,d=0,p=Io(f,this.__takeCount__);if(!r||z>i||i==f&&p==f)return rr(n&&r?t.reverse():t,this.__actions__);var l=[];t:for(;f--&&p>d;){u+=e;for(var b=-1,g=t[u];++b=z?lr(e):null,u=e.length;f&&(o=Zt,a=!1,e=f);t:for(;++ir&&(r=-r>i?0:i+r),n=n===E||n>i?i:+n||0,0>n&&(n+=i),i=r>n?0:n>>>0,r>>>=0;i>r;)t[r++]=e;return t}function xe(t,e){var r=[];return jo(t,function(t,n,i){e(t,n,i)&&r.push(t)}),r}function Pe(t,e,r,n){var i;return r(t,function(t,r,s){return e(t,r,s)?(i=n?r:t,!1):void 0}),i}function Oe(t,e,r,n){n||(n=[]);for(var i=-1,s=t.length;++in;)t=t[e[n++]];return n&&n==i?t:E}}function Ne(t,e,r,n,i,s){return t===e?!0:null==t||null==e||!Ci(t)&&!m(e)?t!==t&&e!==e:je(t,e,Ne,r,n,i,s)}function je(t,e,r,n,i,s,o){var a=Oa(t),f=Oa(e),u=Y,c=Y;a||(u=ro.call(t),u==V?u=$:u!=$&&(a=Hi(t))),f||(c=ro.call(e),c==V?c=$:c!=$&&(f=Hi(e)));var h=u==$,d=c==$,p=u==c;if(p&&!a&&!h)return Lr(t,e,u);if(!i){var l=h&&to.call(t,"__wrapped__"),b=d&&to.call(e,"__wrapped__");if(l||b)return r(l?t.value():t,b?e.value():e,n,i,s,o)}if(!p)return!1;s||(s=[]),o||(o=[]);for(var g=s.length;g--;)if(s[g]==t)return o[g]==e;s.push(t),o.push(e);var m=(a?Ur:Dr)(t,e,r,n,i,s,o);return s.pop(),o.pop(),m}function Ue(t,e,r){var n=e.length,i=n,s=!r;if(null==t)return!i;for(t=hn(t);n--;){var o=e[n];if(s&&o[2]?o[1]!==t[o[0]]:!(o[0]in t))return!1}for(;++ne&&(e=-e>i?0:i+e),r=r===E||r>i?i:+r||0,0>r&&(r+=i),i=e>r?0:r-e>>>0,e>>>=0;for(var s=zs(i);++n=z,f=a?lr():null,u=[];f?(n=Zt,o=!1):(a=!1,f=e?[]:u);t:for(;++r=i){for(;i>n;){var s=n+i>>>1,o=t[s];(r?e>=o:e>o)&&null!==o?n=s+1:i=s}return i}return ir(t,e,xs,r)}function ir(t,e,r,n){e=r(e);for(var i=0,s=t?t.length:0,o=e!==e,a=null===e,f=e===E;s>i;){var u=yo((i+s)/2),c=r(t[u]),h=c!==E,d=c===c;if(o)var p=d||n;else p=a?d&&h&&(n||null!=c):f?d&&(n||h):null==c?!1:n?e>=c:e>c;p?i=u+1:s=u}return Io(s,Bo)}function sr(t,e,r){if("function"!=typeof t)return xs;if(e===E)return t;switch(r){case 1:return function(r){return t.call(e,r)};case 3:return function(r,n,i){return t.call(e,r,n,i)};case 4:return function(r,n,i,s){return t.call(e,r,n,i,s)};case 5:return function(r,n,i,s,o){return t.call(e,r,n,i,s,o)}}return function(){return t.apply(e,arguments)}}function or(t){var e=new so(t.byteLength),r=new lo(e);return r.set(new lo(t)),e}function ar(t,e,r){for(var n=r.length,i=-1,s=So(t.length-n,0),o=-1,a=e.length,f=zs(a+s);++o2?r[i-2]:E,o=i>2?r[2]:E,a=i>1?r[i-1]:E;for("function"==typeof s?(s=sr(s,a,5),i-=2):(s="function"==typeof a?a:E,i-=s?1:0),o&&Qr(r[0],r[1],o)&&(s=3>i?E:s,i=1);++n-1?r[o]:E}return Pe(r,n,t)}}function wr(t){return function(e,r,n){return e&&e.length?(r=zr(r,n,3),i(e,r,t)):-1}}function Sr(t){return function(e,r,n){return r=zr(r,n,3),Pe(e,r,t,!0)}}function Ir(t){return function(){for(var e,r=arguments.length,n=t?r:-1,i=0,s=zs(r);t?n--:++n=z)return e.plant(n).value();for(var i=0,o=r?s[i].apply(this,t):n;++iy){var k=a?te(a):E,A=So(u-y,0),O=l?I:E,B=l?E:I,M=l?w:E,C=l?E:w;e|=l?R:T,e&=~(l?T:R),b||(e&=~(x|P));var N=[t,e,r,M,O,C,B,k,f,A],j=Mr.apply(E,N);return tn(t)&&Ho(j,N),j.placeholder=S,j}}var U=d?r:this,L=p?U[t]:t;return a&&(w=fn(w,a)),h&&f=e||!_o(e))return"";var i=e-n;return r=null==r?" ":r+"",gs(r,go(i/r.length)).slice(0,i)}function Tr(t,e,r,n){function i(){for(var e=-1,a=arguments.length,f=-1,u=n.length,c=zs(u+a);++ff))return!1;for(;++a-1&&t%1==0&&e>t}function Qr(t,e,r){if(!Ci(r))return!1;var n=typeof e;if("number"==n?Jr(r)&&Zr(e,r.length):"string"==n&&e in r){var i=r[e];return t===t?t===i:i!==i}return!1}function $r(t,e){var r=typeof t;if("string"==r&&Et.test(t)||"number"==r)return!0;if(Oa(t))return!1;var n=!kt.test(t);return n||null!=e&&t in hn(e)}function tn(t){var r=Fr(t);if(!(r in Z.prototype))return!1;var n=e[r];if(t===n)return!0;var i=Fo(n);return!!i&&t===i[0]}function en(t){return"number"==typeof t&&t>-1&&t%1==0&&Ro>=t}function rn(t){return t===t&&!Ci(t)}function nn(t,e){var r=t[1],n=e[1],i=r|n,s=C>i,o=n==C&&r==B||n==C&&r==N&&t[7].length<=e[8]||n==(C|N)&&r==B;if(!s&&!o)return t;n&x&&(t[2]=e[2],i|=r&x?0:O);var a=e[3];if(a){var f=t[3];t[3]=f?ar(f,a,e[4]):te(a),t[4]=f?v(t[3],q):te(e[4])}return a=e[5],a&&(f=t[5],t[5]=f?fr(f,a,e[6]):te(a),t[6]=f?v(t[5],q):te(e[6])),a=e[7],a&&(t[7]=te(a)),n&C&&(t[8]=null==t[8]?e[8]:Io(t[8],e[8])),null==t[9]&&(t[9]=e[9]),t[0]=e[0],t[1]=i,t}function sn(t,e){return t===E?e:Ba(t,e,sn)}function on(t,e){t=hn(t);for(var r=-1,n=e.length,i={};++rn;)o[++s]=We(t,n,n+=e);return o}function bn(t){for(var e=-1,r=t?t.length:0,n=-1,i=[];++ee?0:e)):[]}function mn(t,e,r){var n=t?t.length:0;return n?((r?Qr(t,e,r):null==e)&&(e=1),e=n-(+e||0),We(t,0,0>e?0:e)):[]}function yn(t,e,r){return t&&t.length?er(t,zr(e,r,3),!0,!0):[]}function vn(t,e,r){return t&&t.length?er(t,zr(e,r,3),!0):[]}function _n(t,e,r,n){var i=t?t.length:0;return i?(r&&"number"!=typeof r&&Qr(t,e,r)&&(r=0,n=i),Ae(t,e,r,n)):[]}function wn(t){return t?t[0]:E}function Sn(t,e,r){var n=t?t.length:0;return r&&Qr(t,e,r)&&(e=!1),n?Oe(t,e):[]}function In(t){var e=t?t.length:0;return e?Oe(t,!0):[]}function kn(t,e,r){var n=t?t.length:0;if(!n)return-1;if("number"==typeof r)r=0>r?So(n+r,0):r;else if(r){var i=nr(t,e);return n>i&&(e===e?e===t[i]:t[i]!==t[i])?i:-1}return s(t,e,r||0)}function En(t){return mn(t,1)}function An(t){var e=t?t.length:0;return e?t[e-1]:E}function xn(t,e,r){var n=t?t.length:0;if(!n)return-1;var i=n;if("number"==typeof r)i=(0>r?So(n+r,0):Io(r||0,n-1))+1;else if(r){i=nr(t,e,!0)-1;var s=t[i];return(e===e?e===s:s!==s)?i:-1}if(e!==e)return g(t,i,!0);for(;i--;)if(t[i]===e)return i;return-1}function Pn(){var t=arguments,e=t[0];if(!e||!e.length)return e;for(var r=0,n=Kr(),i=t.length;++r-1;)po.call(e,s,1);return e}function On(t,e,r){var n=[];if(!t||!t.length)return n;var i=-1,s=[],o=t.length;for(e=zr(e,r,3);++ie?0:e)):[]}function Tn(t,e,r){var n=t?t.length:0;return n?((r?Qr(t,e,r):null==e)&&(e=1),e=n-(+e||0),We(t,0>e?0:e)):[]}function Cn(t,e,r){return t&&t.length?er(t,zr(e,r,3),!1,!0):[]}function Nn(t,e,r){return t&&t.length?er(t,zr(e,r,3)):[]}function jn(t,e,r,n){var i=t?t.length:0;if(!i)return[];null!=e&&"boolean"!=typeof e&&(n=r,r=Qr(t,e,n)?E:e,e=!1);var o=zr();return(null!=r||o!==_e)&&(r=o(r,n,3)),e&&Kr()==s?_(t,r):$e(t,r)}function Un(t){if(!t||!t.length)return[];var e=-1,r=0;t=ae(t,function(t){return Jr(t)?(r=So(t.length,r),!0):void 0});for(var n=zs(r);++er?So(i+r,0):r||0,"string"==typeof t||!Oa(t)&&Ki(t)?i>=r&&t.indexOf(e,r)>-1:!!i&&Kr(t,e,r)>-1}function ti(t,e,r){var n=Oa(t)?fe:Le;return e=zr(e,r,3),n(t,e)}function ei(t,e){return ti(t,Ts(e))}function ri(t,e,r){var n=Oa(t)?ae:xe;return e=zr(e,r,3),n(t,function(t,r,n){return!e(t,r,n)})}function ni(t,e,r){if(r?Qr(t,e,r):null==e){t=cn(t);var n=t.length;return n>0?t[Ye(0,n-1)]:E}var i=-1,s=Gi(t),n=s.length,o=n-1;for(e=Io(0>e?0:+e||0,n);++i0&&(r=e.apply(this,arguments)),1>=t&&(e=E),r}}function pi(t,e,r){function n(){p&&oo(p),u&&oo(u),b=0,u=p=l=E}function i(e,r){r&&oo(r),u=p=l=E,e&&(b=ba(),c=t.apply(d,f),p||u||(f=d=E))}function s(){var t=e-(ba()-h);0>=t||t>e?i(l,u):p=ho(s,t)}function o(){i(m,p)}function a(){if(f=arguments,h=ba(),d=this,l=m&&(p||!y),g===!1)var r=y&&!p;else{u||y||(b=h);var n=g-(h-b),i=0>=n||n>g;i?(u&&(u=oo(u)),b=h,c=t.apply(d,f)):u||(u=ho(o,n))}return i&&p?p=oo(p):p||e===g||(p=ho(s,e)),r&&(i=!0,c=t.apply(d,f)),!i||p||u||(f=d=E),c}var f,u,c,h,d,p,l,b=0,g=!1,m=!0;if("function"!=typeof t)throw new Xs(H);if(e=0>e?0:+e||0,r===!0){var y=!0;m=!1}else Ci(r)&&(y=!!r.leading,g="maxWait"in r&&So(+r.maxWait||0,e),m="trailing"in r?!!r.trailing:m);return a.cancel=n,a}function li(t,e){if("function"!=typeof t||e&&"function"!=typeof e)throw new Xs(H);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);var o=t.apply(this,n);return r.cache=s.set(i,o),o};return r.cache=new li.Cache,r}function bi(t){if("function"!=typeof t)throw new Xs(H);return function(){return!t.apply(this,arguments)}}function gi(t){return di(2,t)}function mi(t,e){if("function"!=typeof t)throw new Xs(H);return e=So(e===E?t.length-1:+e||0,0),function(){for(var r=arguments,n=-1,i=So(r.length-e,0),s=zs(i);++ne}function ki(t,e){return t>=e}function Ei(t){return m(t)&&Jr(t)&&to.call(t,"callee")&&!uo.call(t,"callee")}function Ai(t){return t===!0||t===!1||m(t)&&ro.call(t)==G}function xi(t){return m(t)&&ro.call(t)==W}function Pi(t){return!!t&&1===t.nodeType&&m(t)&&!zi(t)}function Oi(t){return null==t?!0:Jr(t)&&(Oa(t)||Ki(t)||Ei(t)||m(t)&&Ti(t.splice))?!t.length:!za(t).length}function Bi(t,e,r,n){r="function"==typeof r?sr(r,n,3):E;var i=r?r(t,e):E;return i===E?Ne(t,e,r):!!i}function Mi(t){return m(t)&&"string"==typeof t.message&&ro.call(t)==X}function Ri(t){return"number"==typeof t&&_o(t)}function Ti(t){return Ci(t)&&ro.call(t)==J}function Ci(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Ni(t,e,r,n){return r="function"==typeof r?sr(r,n,3):E,Ue(t,Hr(e),r)}function ji(t){return Di(t)&&t!=+t}function Ui(t){return null==t?!1:Ti(t)?io.test($s.call(t)):m(t)&&Ct.test(t)}function Li(t){return null===t}function Di(t){return"number"==typeof t||m(t)&&ro.call(t)==Q}function zi(t){var e;if(!m(t)||ro.call(t)!=$||Ei(t)||!to.call(t,"constructor")&&(e=t.constructor,"function"==typeof e&&!(e instanceof e)))return!1;var r;return Be(t,function(t,e){r=e}),r===E||to.call(t,r)}function Fi(t){return Ci(t)&&ro.call(t)==tt}function Ki(t){return"string"==typeof t||m(t)&&ro.call(t)==rt}function Hi(t){return m(t)&&en(t.length)&&!!Kt[ro.call(t)]}function qi(t){return t===E}function Vi(t,e){return e>t}function Yi(t,e){return e>=t}function Gi(t){var e=t?Ko(t):0;return en(e)?e?te(t):[]:ss(t)}function Wi(t){return ve(t,ts(t))}function Xi(t,e,r){var n=No(t);return r&&Qr(t,e,r)&&(e=E),e?me(n,e):n}function Ji(t){return Te(t,ts(t))}function Zi(t,e,r){var n=null==t?E:Ce(t,dn(e),e+"");return n===E?r:n}function Qi(t,e){if(null==t)return!1;var r=to.call(t,e);if(!r&&!$r(e)){if(e=dn(e),t=1==e.length?t:Ce(t,We(e,0,-1)),null==t)return!1;e=An(e),r=to.call(t,e)}return r||en(t.length)&&Zr(e,t.length)&&(Oa(t)||Ei(t))}function $i(t,e,r){r&&Qr(t,e,r)&&(e=E);for(var n=-1,i=za(t),s=i.length,o={};++n0;++n=Io(e,r)&&tr?0:+r||0,n),r-=e.length,r>=0&&t.indexOf(e,r)==r}function ds(t){return t=a(t),t&&_t.test(t)?t.replace(yt,p):t}function ps(t){return t=a(t),t&&Pt.test(t)?t.replace(xt,l):t||"(?:)"}function ls(t,e,r){t=a(t),e=+e;var n=t.length;if(n>=e||!_o(e))return t;var i=(e-n)/2,s=yo(i),o=go(i);return r=Rr("",o,r),r.slice(0,s)+t+r}function bs(t,e,r){return(r?Qr(t,e,r):null==e)?e=0:e&&(e=+e),t=vs(t),Eo(t,e||(Tt.test(t)?16:10))}function gs(t,e){var r="";if(t=a(t),e=+e,1>e||!t||!_o(e))return r;do e%2&&(r+=t),e=yo(e/2),t+=t;while(e);return r}function ms(t,e,r){return t=a(t),r=null==r?0:Io(0>r?0:+r||0,t.length),t.lastIndexOf(e,r)==r}function ys(t,r,n){var i=e.templateSettings;n&&Qr(t,r,n)&&(r=n=E),t=a(t),r=ge(me({},n||r),i,be);var s,o,f=ge(me({},r.imports),i.imports,be),u=za(f),c=tr(f,u),h=0,d=r.interpolate||Ut,p="__p += '",l=Gs((r.escape||Ut).source+"|"+d.source+"|"+(d===It?Mt:Ut).source+"|"+(r.evaluate||Ut).source+"|$","g"),g="//# sourceURL="+("sourceURL"in r?r.sourceURL:"lodash.templateSources["+ ++Ft+"]")+"\n";t.replace(l,function(e,r,n,i,a,f){return n||(n=i),p+=t.slice(h,f).replace(Lt,b),r&&(s=!0,p+="' +\n__e("+r+") +\n'"),a&&(o=!0,p+="';\n"+a+";\n__p += '"),n&&(p+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),h=f+e.length,e}),p+="';\n";var m=r.variable;m||(p="with (obj) {\n"+p+"\n}\n"),p=(o?p.replace(lt,""):p).replace(bt,"$1").replace(gt,"$1;"),p="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(s?", __e = _.escape":"")+(o?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+p+"return __p\n}";var y=Za(function(){return Hs(u,g+"return "+p).apply(E,c)});if(y.source=p,Mi(y))throw y;return y}function vs(t,e,r){var n=t;return(t=a(t))?(r?Qr(n,e,r):null==e)?t.slice(w(t),S(t)+1):(e+="",t.slice(f(t,e),u(t,e)+1)):t}function _s(t,e,r){var n=t;return t=a(t),t?(r?Qr(n,e,r):null==e)?t.slice(w(t)):t.slice(f(t,e+"")):t}function ws(t,e,r){var n=t;return t=a(t),t?(r?Qr(n,e,r):null==e)?t.slice(0,S(t)+1):t.slice(0,u(t,e+"")+1):t}function Ss(t,e,r){r&&Qr(t,e,r)&&(e=E);var n=j,i=U;if(null!=e)if(Ci(e)){var s="separator"in e?e.separator:s;n="length"in e?+e.length||0:n,i="omission"in e?a(e.omission):i}else n=+e||0;if(t=a(t),n>=t.length)return t;var o=n-i.length;if(1>o)return i;var f=t.slice(0,o);if(null==s)return f+i;if(Fi(s)){if(t.slice(o).search(s)){var u,c,h=t.slice(0,o);for(s.global||(s=Gs(s.source,(Rt.exec(s)||"")+"g")),s.lastIndex=0;u=s.exec(h);)c=u.index;f=f.slice(0,null==c?o:c)}}else if(t.indexOf(s,o)!=o){var d=f.lastIndexOf(s);d>-1&&(f=f.slice(0,d))}return f+i}function Is(t){return t=a(t),t&&vt.test(t)?t.replace(mt,I):t}function ks(t,e,r){return r&&Qr(t,e,r)&&(e=E),t=a(t),t.match(e||Dt)||[]}function Es(t,e,r){return r&&Qr(t,e,r)&&(e=E),m(t)?Ps(t):_e(t,e)}function As(t){return function(){return t}}function xs(t){return t}function Ps(t){return De(we(t,!0))}function Os(t,e){return ze(t,we(e,!0))}function Bs(t,e,r){if(null==r){var n=Ci(e),i=n?za(e):E,s=i&&i.length?Te(e,i):E;(s?s.length:n)||(s=!1,r=e,e=t,t=this)}s||(s=Te(e,za(e)));var o=!0,a=-1,f=Ti(t),u=s.length;r===!1?o=!1:Ci(r)&&"chain"in r&&(o=r.chain);for(;++at||!_o(t))return[];var n=-1,i=zs(Io(t,Oo));for(e=sr(e,r,1);++nn?i[n]=e(n):e(n);return i}function Us(t){var e=++eo;return a(t)+e}function Ls(t,e){return(+t||0)+(+e||0)}function Ds(t,e,r){return r&&Qr(t,e,r)&&(e=E),e=zr(e,r,3),1==e.length?pe(Oa(t)?t:cn(t),e):Qe(t,e)}t=t?ne.defaults(re.Object(),t,ne.pick(re,zt)):re;var zs=t.Array,Fs=t.Date,Ks=t.Error,Hs=t.Function,qs=t.Math,Vs=t.Number,Ys=t.Object,Gs=t.RegExp,Ws=t.String,Xs=t.TypeError,Js=zs.prototype,Zs=Ys.prototype,Qs=Ws.prototype,$s=Hs.prototype.toString,to=Zs.hasOwnProperty,eo=0,ro=Zs.toString,no=re._,io=Gs("^"+$s.call(to).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),so=t.ArrayBuffer,oo=t.clearTimeout,ao=t.parseFloat,fo=qs.pow,uo=Zs.propertyIsEnumerable,co=qr(t,"Set"),ho=t.setTimeout,po=Js.splice,lo=t.Uint8Array,bo=qr(t,"WeakMap"),go=qs.ceil,mo=qr(Ys,"create"),yo=qs.floor,vo=qr(zs,"isArray"),_o=t.isFinite,wo=qr(Ys,"keys"),So=qs.max,Io=qs.min,ko=qr(Fs,"now"),Eo=t.parseInt,Ao=qs.random,xo=Vs.NEGATIVE_INFINITY,Po=Vs.POSITIVE_INFINITY,Oo=4294967295,Bo=Oo-1,Mo=Oo>>>1,Ro=9007199254740991,To=bo&&new bo,Co={};e.support={};e.templateSettings={escape:wt,evaluate:St,interpolate:It,variable:"",imports:{_:e}};var No=function(){function t(){}return function(e){if(Ci(e)){t.prototype=e;var r=new t;t.prototype=E}return r||{}}}(),jo=hr(Me),Uo=hr(Re,!0),Lo=dr(),Do=dr(!0),zo=To?function(t,e){return To.set(t,e),t}:xs,Fo=To?function(t){return To.get(t)}:Rs,Ko=He("length"),Ho=function(){var t=0,e=0;return function(r,n){var i=ba(),s=D-(i-e);if(e=i,s>0){if(++t>=L)return r}else t=0;return zo(r,n)}}(),qo=mi(function(t,e){return m(t)&&Jr(t)?Ie(t,Oe(e,!1,!0)):[]}),Vo=wr(),Yo=wr(!0),Go=mi(function(t){for(var e=t.length,r=e,n=zs(h),i=Kr(),o=i==s,a=[];r--;){var f=t[r]=Jr(f=t[r])?f:[];n[r]=o&&f.length>=120?lr(r&&f):null}var u=t[0],c=-1,h=u?u.length:0,d=n[0];t:for(;++c2?t[e-2]:E,n=e>1?t[e-1]:E;return e>2&&"function"==typeof r?e-=2:(r=e>1&&"function"==typeof n?(--e,n):E,n=E),t.length=e,Ln(t,r,n)}),ea=mi(function(t){return t=Oe(t),this.thru(function(e){return $t(Oa(e)?e:[hn(e)],t)})}),ra=mi(function(t,e){return ye(t,Oe(e))}),na=ur(function(t,e,r){to.call(t,r)?++t[r]:t[r]=1}),ia=_r(jo),sa=_r(Uo,!0),oa=kr(ee,jo),aa=kr(ie,Uo),fa=ur(function(t,e,r){to.call(t,r)?t[r].push(e):t[r]=[e]}),ua=ur(function(t,e,r){t[r]=e}),ca=mi(function(t,e,r){var n=-1,i="function"==typeof e,s=$r(e),o=Jr(t)?zs(t.length):[];return jo(t,function(t){var a=i?e:s&&null!=t?t[e]:E;o[++n]=a?a.apply(t,r):Xr(t,e,r)}),o}),ha=ur(function(t,e,r){t[r?0:1].push(e)},function(){return[[],[]]}),da=Br(ce,jo),pa=Br(he,Uo),la=mi(function(t,e){if(null==t)return[];var r=e[2];return r&&Qr(e[0],e[1],r)&&(e.length=1),Ze(t,Oe(e),[])}),ba=ko||function(){return(new Fs).getTime()},ga=mi(function(t,e,r){var n=x;if(r.length){var i=v(r,ga.placeholder);n|=R}return jr(t,n,e,r,i)}),ma=mi(function(t,e){e=e.length?Oe(e):Ji(t);for(var r=-1,n=e.length;++r0||0>e)?new Z(r):(0>t?r=r.takeRight(-t):t&&(r=r.drop(t)),e!==E&&(e=+e||0,r=0>e?r.dropRight(-e):r.take(e-t)),r)},Z.prototype.takeRightWhile=function(t,e){return this.reverse().takeWhile(t,e).reverse()},Z.prototype.toArray=function(){return this.take(Po)},Me(Z.prototype,function(t,r){var n=/^(?:filter|map|reject)|While$/.test(r),i=/^(?:first|last)$/.test(r),s=e[i?"take"+("last"==r?"Right":""):r];s&&(e.prototype[r]=function(){var e=i?[1]:arguments,r=this.__chain__,o=this.__wrapped__,a=!!this.__actions__.length,f=o instanceof Z,u=e[0],c=f||Oa(o);c&&n&&"function"==typeof u&&1!=u.length&&(f=c=!1);var h=function(t){return i&&r?s(t,1)[0]:s.apply(E,ue([t],e))},d={func:Hn,args:[h],thisArg:E},p=f&&!a;if(i&&!r)return p?(o=o.clone(),o.__actions__.push(d),t.call(o)):s.call(E,this.value())[0];if(!i&&c){o=p?o:new Z(this);var l=t.apply(o,e);return l.__actions__.push(d),new y(l,r)}return this.thru(h)})}),ee(["join","pop","push","replace","shift","sort","splice","split","unshift"],function(t){var r=(/^(?:replace|split)$/.test(t)?Qs:Js)[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",i=/^(?:join|pop|replace|shift)$/.test(t);e.prototype[t]=function(){var t=arguments;return i&&!this.__chain__?r.apply(this.value(),t):this[n](function(e){return r.apply(e,t)})}}),Me(Z.prototype,function(t,r){var n=e[r];if(n){var i=n.name,s=Co[i]||(Co[i]=[]);s.push({name:r,func:n})}}),Co[Mr(E,P).name]=[{name:"wrapper",func:E}],Z.prototype.clone=et,Z.prototype.reverse=nt,Z.prototype.value=qt,e.prototype.chain=qn,e.prototype.commit=Vn,e.prototype.concat=ea,e.prototype.plant=Yn,e.prototype.reverse=Gn,e.prototype.toString=Wn,e.prototype.run=e.prototype.toJSON=e.prototype.valueOf=e.prototype.value=Xn,e.prototype.collect=e.prototype.map,e.prototype.head=e.prototype.first,e.prototype.select=e.prototype.filter,e.prototype.tail=e.prototype.rest,e}var E,A="3.10.1",x=1,P=2,O=4,B=8,M=16,R=32,T=64,C=128,N=256,j=30,U="...",L=150,D=16,z=200,F=1,K=2,H="Expected a function",q="__lodash_placeholder__",V="[object Arguments]",Y="[object Array]",G="[object Boolean]",W="[object Date]",X="[object Error]",J="[object Function]",Z="[object Map]",Q="[object Number]",$="[object Object]",tt="[object RegExp]",et="[object Set]",rt="[object String]",nt="[object WeakMap]",it="[object ArrayBuffer]",st="[object Float32Array]",ot="[object Float64Array]",at="[object Int8Array]",ft="[object Int16Array]",ut="[object Int32Array]",ct="[object Uint8Array]",ht="[object Uint8ClampedArray]",dt="[object Uint16Array]",pt="[object Uint32Array]",lt=/\b__p \+= '';/g,bt=/\b(__p \+=) '' \+/g,gt=/(__e\(.*?\)|\b__t\)) \+\n'';/g,mt=/&(?:amp|lt|gt|quot|#39|#96);/g,yt=/[&<>"'`]/g,vt=RegExp(mt.source),_t=RegExp(yt.source),wt=/<%-([\s\S]+?)%>/g,St=/<%([\s\S]+?)%>/g,It=/<%=([\s\S]+?)%>/g,kt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,Et=/^\w*$/,At=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g,xt=/^[:!,]|[\\^$.*+?()[\]{}|\/]|(^[0-9a-fA-Fnrtuvx])|([\n\r\u2028\u2029])/g,Pt=RegExp(xt.source),Ot=/[\u0300-\u036f\ufe20-\ufe23]/g,Bt=/\\(\\)?/g,Mt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Rt=/\w*$/,Tt=/^0[xX]/,Ct=/^\[object .+?Constructor\]$/,Nt=/^\d+$/,jt=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,Ut=/($^)/,Lt=/['\n\r\u2028\u2029\\]/g,Dt=function(){var t="[A-Z\\xc0-\\xd6\\xd8-\\xde]",e="[a-z\\xdf-\\xf6\\xf8-\\xff]+";return RegExp(t+"+(?="+t+e+")|"+t+"?"+e+"|"+t+"+|[0-9]+","g")}(),zt=["Array","ArrayBuffer","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Math","Number","Object","RegExp","Set","String","_","clearTimeout","isFinite","parseFloat","parseInt","setTimeout","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap"],Ft=-1,Kt={};Kt[st]=Kt[ot]=Kt[at]=Kt[ft]=Kt[ut]=Kt[ct]=Kt[ht]=Kt[dt]=Kt[pt]=!0,Kt[V]=Kt[Y]=Kt[it]=Kt[G]=Kt[W]=Kt[X]=Kt[J]=Kt[Z]=Kt[Q]=Kt[$]=Kt[tt]=Kt[et]=Kt[rt]=Kt[nt]=!1;var Ht={};Ht[V]=Ht[Y]=Ht[it]=Ht[G]=Ht[W]=Ht[st]=Ht[ot]=Ht[at]=Ht[ft]=Ht[ut]=Ht[Q]=Ht[$]=Ht[tt]=Ht[rt]=Ht[ct]=Ht[ht]=Ht[dt]=Ht[pt]=!0,Ht[X]=Ht[J]=Ht[Z]=Ht[et]=Ht[nt]=!1;var qt={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss"},Vt={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},Yt={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},Gt={"function":!0,object:!0},Wt={0:"x30",1:"x31",2:"x32",3:"x33",4:"x34",5:"x35",6:"x36",7:"x37",8:"x38",9:"x39",A:"x41",B:"x42",C:"x43",D:"x44",E:"x45",F:"x46",a:"x61",b:"x62",c:"x63",d:"x64",e:"x65",f:"x66",n:"x6e",r:"x72",t:"x74",u:"x75",v:"x76",x:"x78"},Xt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Jt=Gt[typeof r]&&r&&!r.nodeType&&r,Zt=Gt[typeof e]&&e&&!e.nodeType&&e,Qt=Jt&&Zt&&"object"==typeof t&&t&&t.Object&&t,$t=Gt[typeof self]&&self&&self.Object&&self,te=Gt[typeof window]&&window&&window.Object&&window,ee=Zt&&Zt.exports===Jt&&Jt,re=Qt||te!==(this&&this.window)&&te||$t||this,ne=k();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(re._=ne,define(function(){return ne})):Jt&&Zt?ee?(Zt.exports=ne)._=ne:Jt._=ne:re._=ne}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],298:[function(t,e,r){(function(r){var n=t("./word-array"),i=function(){function t(){}return{extend:function(e){t.prototype=this;var r=new t;return e&&r.mixIn(e),r.hasOwnProperty("init")||(r.init=function(){r.$super.init.apply(this,arguments)}),r.init.prototype=r,r.$super=this,r},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),s=i.extend({reset:function(){this._data=new n,this._nDataBytes=0},_append:function(t){r.isBuffer(t)&&(t=n.fromBuffer(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(t){var e=this._data,r=e.words,i=e.sigBytes,s=this.blockSize,o=4*s,a=i/o;a=t?Math.ceil(a):Math.max((0|a)-this._minBufferSize,0);var f=a*s,u=Math.min(4*f,i);if(f){for(var c=0;f>c;c+=s)this._doProcessBlock(r,c);var h=r.splice(0,f);e.sigBytes-=u}return new n(h,u)},clone:function(){var t=i.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),o=s.extend({cfg:i.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){s.reset.call(this),this._doReset()},update:function(t){return"string"==typeof t&&(t=n.fromBuffer(new r(t,"utf8"))),r.isBuffer(t)&&(t=n.fromBuffer(t)),this._append(t),this._process(),this},finalize:function(t){"string"==typeof t&&(t=n.fromBuffer(new r(t,"utf8"))),r.isBuffer(t)&&(t=n.fromBuffer(t)),t&&this._append(t);var e=this._doFinalize();return e.toBuffer()},blockSize:16,_createHelper:function(t){return function(e,r){return new t.init(r).finalize(e)}}});e.exports.Hasher=o}).call(this,t("buffer").Buffer)},{"./word-array":302,buffer:48}],299:[function(t,e,r){(function(r){function n(t){if(!(this instanceof n))return new n(t);var e=this._hasher=new i.init;"string"==typeof t&&(t=s.fromBuffer(new r(t,"utf8"))),r.isBuffer(t)&&(t=s.fromBuffer(t));var o=e.blockSize,a=4*o;t.sigBytes>a&&(t=e.finalize(t)),t.clamp();for(var f=this._oKey=t.clone(),u=this._iKey=t.clone(),c=f.words,h=u.words,d=0;o>d;d++)c[d]^=1549556828,h[d]^=909522486;f.sigBytes=u.sigBytes=a,this.reset()}var i=t("./sha512").sha512,s=t("./word-array");n.prototype.reset=function(){var t=this._hasher;t.reset(),t.update(this._iKey)},n.prototype.update=function(t){return"string"==typeof t&&(t=s.fromBuffer(new r(t,"utf8"))),r.isBuffer(t)&&(t=s.fromBuffer(t)),this._hasher.update(t),this},n.prototype.finalize=function(t){"string"==typeof t&&(t=s.fromBuffer(new r(t,"utf8"))),r.isBuffer(t)&&(t=s.fromBuffer(t));var e=this._hasher,n=e.finalize(t);e.reset();var i=e.finalize(this._oKey.clone().concat(n));return i},e.exports=n}).call(this,t("buffer").Buffer)},{"./sha512":301,"./word-array":302,buffer:48}],300:[function(t,e,r){e.exports=t("./sha512"),e.exports.hmac=t("./hmac")},{"./hmac":299,"./sha512":301}],301:[function(t,e,r){var n=t("./cryptojs").Hasher,i=t("./x64"),s=i.Word,o=i.WordArray,a=[s(1116352408,3609767458),s(1899447441,602891725),s(3049323471,3964484399),s(3921009573,2173295548),s(961987163,4081628472),s(1508970993,3053834265),s(2453635748,2937671579),s(2870763221,3664609560),s(3624381080,2734883394),s(310598401,1164996542),s(607225278,1323610764),s(1426881987,3590304994),s(1925078388,4068182383),s(2162078206,991336113),s(2614888103,633803317),s(3248222580,3479774868),s(3835390401,2666613458),s(4022224774,944711139),s(264347078,2341262773),s(604807628,2007800933),s(770255983,1495990901),s(1249150122,1856431235),s(1555081692,3175218132),s(1996064986,2198950837),s(2554220882,3999719339),s(2821834349,766784016),s(2952996808,2566594879),s(3210313671,3203337956),s(3336571891,1034457026),s(3584528711,2466948901),s(113926993,3758326383),s(338241895,168717936),s(666307205,1188179964),s(773529912,1546045734),s(1294757372,1522805485),s(1396182291,2643833823),s(1695183700,2343527390),s(1986661051,1014477480),s(2177026350,1206759142),s(2456956037,344077627),s(2730485921,1290863460),s(2820302411,3158454273),s(3259730800,3505952657),s(3345764771,106217008),s(3516065817,3606008344),s(3600352804,1432725776),s(4094571909,1467031594),s(275423344,851169720),s(430227734,3100823752),s(506948616,1363258195),s(659060556,3750685593),s(883997877,3785050280),s(958139571,3318307427),s(1322822218,3812723403),s(1537002063,2003034995),s(1747873779,3602036899),s(1955562222,1575990012),s(2024104815,1125592928),s(2227730452,2716904306),s(2361852424,442776044),s(2428436474,593698344),s(2756734187,3733110249),s(3204031479,2999351573),s(3329325298,3815920427),s(3391569614,3928383900),s(3515267271,566280711),s(3940187606,3454069534),s(4118630271,4000239992),s(116418474,1914138554),s(174292421,2731055270),s(289380356,3203993006),s(460393269,320620315),s(685471733,587496836),s(852142971,1086792851),s(1017036298,365543100),s(1126000580,2618297676),s(1288033470,3409855158),s(1501505948,4234509866),s(1607167915,987167468),s(1816402316,1246189591)],f=[];!function(){for(var t=0;80>t;t++)f[t]=s()}();var u=n.extend({_doReset:function(){this._hash=new o([s(1779033703,4089235720),s(3144134277,2227873595),s(1013904242,4271175723),s(2773480762,1595750129),s(1359893119,2917565137),s(2600822924,725511199),s(528734635,4215389547),s(1541459225,327033209)])},_doProcessBlock:function(t,e){for(var r=this._hash.words,n=r[0],i=r[1],s=r[2],o=r[3],u=r[4],c=r[5],h=r[6],d=r[7],p=n.high,l=n.low,b=i.high,g=i.low,m=s.high,y=s.low,v=o.high,_=o.low,w=u.high,S=u.low,I=c.high,k=c.low,E=h.high,A=h.low,x=d.high,P=d.low,O=p,B=l,M=b,R=g,T=m,C=y,N=v,j=_,U=w,L=S,D=I,z=k,F=E,K=A,H=x,q=P,V=0;80>V;V++){var Y=f[V];if(16>V)var G=Y.high=0|t[e+2*V],W=Y.low=0|t[e+2*V+1];else{var X=f[V-15],J=X.high,Z=X.low,Q=(J>>>1|Z<<31)^(J>>>8|Z<<24)^J>>>7,$=(Z>>>1|J<<31)^(Z>>>8|J<<24)^(Z>>>7|J<<25),tt=f[V-2],et=tt.high,rt=tt.low,nt=(et>>>19|rt<<13)^(et<<3|rt>>>29)^et>>>6,it=(rt>>>19|et<<13)^(rt<<3|et>>>29)^(rt>>>6|et<<26),st=f[V-7],ot=st.high,at=st.low,ft=f[V-16],ut=ft.high,ct=ft.low,W=$+at,G=Q+ot+($>>>0>W>>>0?1:0),W=W+it,G=G+nt+(it>>>0>W>>>0?1:0),W=W+ct,G=G+ut+(ct>>>0>W>>>0?1:0);Y.high=G,Y.low=W}var ht=U&D^~U&F,dt=L&z^~L&K,pt=O&M^O&T^M&T,lt=B&R^B&C^R&C,bt=(O>>>28|B<<4)^(O<<30|B>>>2)^(O<<25|B>>>7),gt=(B>>>28|O<<4)^(B<<30|O>>>2)^(B<<25|O>>>7),mt=(U>>>14|L<<18)^(U>>>18|L<<14)^(U<<23|L>>>9),yt=(L>>>14|U<<18)^(L>>>18|U<<14)^(L<<23|U>>>9),vt=a[V],_t=vt.high,wt=vt.low,St=q+yt,It=H+mt+(q>>>0>St>>>0?1:0),St=St+dt,It=It+ht+(dt>>>0>St>>>0?1:0),St=St+wt,It=It+_t+(wt>>>0>St>>>0?1:0),St=St+W,It=It+G+(W>>>0>St>>>0?1:0),kt=gt+lt,Et=bt+pt+(gt>>>0>kt>>>0?1:0);H=F,q=K,F=D,K=z,D=U,z=L,L=j+St|0,U=N+It+(j>>>0>L>>>0?1:0)|0,N=T,j=C,T=M,C=R,M=O,R=B,B=St+kt|0,O=It+Et+(St>>>0>B>>>0?1:0)|0}l=n.low=l+B,n.high=p+O+(B>>>0>l>>>0?1:0),g=i.low=g+R,i.high=b+M+(R>>>0>g>>>0?1:0),y=s.low=y+C,s.high=m+T+(C>>>0>y>>>0?1:0),_=o.low=_+j,o.high=v+N+(j>>>0>_>>>0?1:0),S=u.low=S+L,u.high=w+U+(L>>>0>S>>>0?1:0),k=c.low=k+z,c.high=I+D+(z>>>0>k>>>0?1:0),A=h.low=A+K,h.high=E+F+(K>>>0>A>>>0?1:0),P=d.low=P+q,d.high=x+H+(q>>>0>P>>>0?1:0)},_doFinalize:function(){var t=this._data,e=t.words,r=8*this._nDataBytes,n=8*t.sigBytes;e[n>>>5]|=128<<24-n%32,e[(n+128>>>10<<5)+30]=Math.floor(r/4294967296),e[(n+128>>>10<<5)+31]=r,t.sigBytes=4*e.length,this._process();var i=this._hash.toX32();return i},clone:function(){var t=n.clone.call(this);return t._hash=this._hash.clone(),t},blockSize:32});e.exports=n._createHelper(u),e.exports.sha512=u},{"./cryptojs":298,"./x64":303}],302:[function(t,e,r){(function(t,r){function n(t,e){this.words=t||[],void 0!=e?this.sigBytes=e:this.sigBytes=4*this.words.length}e.exports=n,n.prototype.concat=function(t){r.isBuffer(t)&&(t=n.fromBuffer(t));var e=this.words,i=t.words,s=this.sigBytes,o=t.sigBytes;if(this.clamp(),s%4)for(var a=0;o>a;a++){var f=i[a>>>2]>>>24-a%4*8&255;e[s+a>>>2]|=f<<24-(s+a)%4*8}else if(i.length>65535)for(var a=0;o>a;a+=4)e[s+a>>>2]=i[a>>>2];else e.push.apply(e,i);return this.sigBytes+=o,this},n.prototype.clamp=function(){var t=this.words,e=this.sigBytes;t[e>>>2]&=4294967295<<32-e%4*8,t.length=Math.ceil(e/4)},n.prototype.clone=function(){var t=new n(this.words.slice(0));return t},n.prototype.toBuffer=function(){for(var t=new r(4*this.words.length),e=0;eo;o+=4){var a=e.readUInt32BE(o);s.push(a)}for(var f=0,u=r-i,c=0;i>c;c+=1)f|=e.readUInt8(u+c)<<8*(3-c);return i>0&&s.push(f),new n(s,e.length)}for(var o=0;r>o;o+=4){var a=e.readUInt32BE(o,!0);s.push(a)}return new n(s,e.length)}}).call(this,t("_process"),t("buffer").Buffer)},{_process:247,buffer:48}],303:[function(t,e,r){function n(t,e){return this instanceof n?(this.high=t,void(this.low=e)):new n(t,e)}function i(t){this.words=t||[]}var s=t("./word-array");i.prototype.toX32=function(){for(var t=this.words,e=t.length,r=[],n=0;e>n;n++){var i=t[n];r.push(i.high),r.push(i.low)}return new s(r,this.sigBytes)},e.exports.Word=n,e.exports.WordArray=i},{"./word-array":302}],304:[function(t,e,r){e.exports={name:"bitcore-lib",version:"0.13.13",description:"A pure and powerful JavaScript Bitcoin library.",author:"BitPay ",main:"index.js",scripts:{lint:"gulp lint",test:"gulp test",coverage:"gulp coverage",build:"gulp"},contributors:[{name:"Daniel Cousens",email:"bitcoin@dcousens.com"},{name:"Esteban Ordano",email:"eordano@gmail.com"},{name:"Gordon Hall",email:"gordon@bitpay.com"},{name:"Jeff Garzik",email:"jgarzik@bitpay.com"},{name:"Kyle Drake",email:"kyle@kyledrake.net"},{name:"Manuel Araoz",email:"manuelaraoz@gmail.com"},{name:"Matias Alejo Garcia",email:"ematiu@gmail.com"},{name:"Ryan X. Charles",email:"ryanxcharles@gmail.com"},{name:"Stefan Thomas",email:"moon@justmoon.net"},{name:"Stephen Pair",email:"stephen@bitpay.com"},{name:"Wei Lu",email:"luwei.here@gmail.com"}],keywords:["bitcoin","transaction","address","p2p","ecies","cryptocurrency","blockchain","payment","bip21","bip32","bip37","bip69","bip70","multisig"],repository:{type:"git",url:"https://github.com/bitpay/bitcore-lib.git"},browser:{request:"browser-request"},dependencies:{"bn.js":"=2.0.4",bs58:"=2.0.0","buffer-compare":"=1.0.0",elliptic:"=3.0.3",inherits:"=2.0.1",lodash:"=3.10.1",sha512:"=0.0.1"},devDependencies:{"bitcore-build":"bitpay/bitcore-build",brfs:"^1.2.0",chai:"^1.10.0",gulp:"^3.8.10",sinon:"^1.13.0"},license:"MIT"}},{}],"bitcore-lib":[function(t,e,r){(function(r,n){"use strict";var i=e.exports;i.version="v"+t("./package.json").version,i.versionGuard=function(t){if(void 0!==t){var e="More than one instance of bitcore-lib found. Please make sure to require bitcore-lib and check that submodules do not also include their own bitcore-lib dependency.";throw new Error(e)}},i.versionGuard(r._bitcore),r._bitcore=i.version,i.crypto={},i.crypto.BN=t("./lib/crypto/bn"),i.crypto.ECDSA=t("./lib/crypto/ecdsa"),i.crypto.Hash=t("./lib/crypto/hash"),i.crypto.Random=t("./lib/crypto/random"),i.crypto.Point=t("./lib/crypto/point"),i.crypto.Signature=t("./lib/crypto/signature"),i.encoding={},i.encoding.Base58=t("./lib/encoding/base58"),i.encoding.Base58Check=t("./lib/encoding/base58check"),i.encoding.BufferReader=t("./lib/encoding/bufferreader"),i.encoding.BufferWriter=t("./lib/encoding/bufferwriter"),i.encoding.Varint=t("./lib/encoding/varint"),i.util={},i.util.buffer=t("./lib/util/buffer"),i.util.js=t("./lib/util/js"),i.util.preconditions=t("./lib/util/preconditions"),i.errors=t("./lib/errors"),i.Address=t("./lib/address"),i.Block=t("./lib/block"),i.MerkleBlock=t("./lib/block/merkleblock"),i.BlockHeader=t("./lib/block/blockheader"),i.HDPrivateKey=t("./lib/hdprivatekey.js"),i.HDPublicKey=t("./lib/hdpublickey.js"),i.Networks=t("./lib/networks"),i.Opcode=t("./lib/opcode"),i.PrivateKey=t("./lib/privatekey"),i.PublicKey=t("./lib/publickey"),i.Script=t("./lib/script"),i.Transaction=t("./lib/transaction"),i.URI=t("./lib/uri"),i.Unit=t("./lib/unit"),i.deps={},i.deps.bnjs=t("bn.js"),i.deps.bs58=t("bs58"),i.deps.Buffer=n,i.deps.elliptic=t("elliptic"),i.deps._=t("lodash"),i._HDKeyCache=t("./lib/hdkeycache"),i.Transaction.sighash=t("./lib/transaction/sighash")}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer)},{"./lib/address":1,"./lib/block":4,"./lib/block/blockheader":3,"./lib/block/merkleblock":5,"./lib/crypto/bn":6,"./lib/crypto/ecdsa":7,"./lib/crypto/hash":8,"./lib/crypto/point":9,"./lib/crypto/random":10,"./lib/crypto/signature":11,"./lib/encoding/base58":12,"./lib/encoding/base58check":13,"./lib/encoding/bufferreader":14,"./lib/encoding/bufferwriter":15,"./lib/encoding/varint":16,"./lib/errors":17,"./lib/hdkeycache":19,"./lib/hdprivatekey.js":20,"./lib/hdpublickey.js":21,"./lib/networks":22,"./lib/opcode":23,"./lib/privatekey":24,"./lib/publickey":25,"./lib/script":26,"./lib/transaction":29,"./lib/transaction/sighash":37,"./lib/unit":41,"./lib/uri":42,"./lib/util/buffer":43,"./lib/util/js":44,"./lib/util/preconditions":45,"./package.json":304,"bn.js":272,bs58:273,buffer:48,elliptic:275,lodash:297}]},{},[]);