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:298}],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;n1;n=Math.floor((n+1)/2)){for(var i=0;i"},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:298}],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)},h.prototype.validProofOfWork=function(){var t=new i(this.id,"hex"),e=this.getTargetDifficulty();return!(t.cmp(e)>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:298}],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}),n.indexOf(e)!==-1},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;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;s>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),y=p.mul(s).add(c.mul(b)).mul(g),v=o.fromPoint(y,this.sig.compressed);return v},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"},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:298}],8:[function(t,e,r){(function(r){"use strict";var n=t("crypto"),i=t("../util/buffer"),s=t("../util/preconditions"),o=e.exports;o.sha1=function(t){return s.checkArgument(i.isBuffer(t)),n.createHash("sha1").update(t).digest()},o.sha1.blocksize=512,o.sha256=function(t){return s.checkArgument(i.isBuffer(t)),n.createHash("sha256").update(t).digest()},o.sha256.blocksize=512,o.sha256sha256=function(t){return s.checkArgument(i.isBuffer(t)),o.sha256(o.sha256(t))},o.ripemd160=function(t){return s.checkArgument(i.isBuffer(t)),n.createHash("ripemd160").update(t).digest()},o.sha256ripemd160=function(t){return s.checkArgument(i.isBuffer(t)),o.ripemd160(o.sha256(t))},o.sha512=function(t){return s.checkArgument(i.isBuffer(t)),n.createHash("sha512").update(t).digest()},o.sha512.blocksize=1024,o.hmac=function(t,e,n){s.checkArgument(i.isBuffer(e)),s.checkArgument(i.isBuffer(n)),s.checkArgument(t.blocksize);var o=t.blocksize/8;if(n.length>o)n=t(n);else if(n>>=8)}return i},e.exports=i}).call(this,t("_process"),t("buffer").Buffer)},{_process:246,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;i<0&&(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=a73)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]&&(0!==r&&(!(128&i[0])&&!(r>1&&0===i[0]&&!(128&i[1]))))},f.prototype.hasLowS=function(){return!this.s.lt(new n(1))&&!this.s.gt(new n("7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0","hex"))},f.prototype.hasDefinedHashtype=function(){if(!a.isNaturalNumber(this.nhashtype))return!1;var t=this.nhashtype&~f.SIGHASH_ANYONECANPAY;return!(tf.SIGHASH_SINGLE)},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:298}],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:274,buffer:48,lodash:298}],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:298}],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(n<=9007199254740991)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;e=0&&t=n.Hardened||e,tI*S)throw new v.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,m.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 y.InvalidB58Checksum(i)}else t.checksum=c.checksum(i);var o,a=d.get(m.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:m.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(m.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(m.integerFromBuffer(this._buffers.version),"xprivkey").name,depth:m.integerFromSingleByteBuffer(this._buffers.depth),fingerPrint:m.integerFromBuffer(this.fingerPrint),parentFingerPrint:m.integerFromBuffer(this._buffers.parentFingerPrint),childIndex:m.integerFromBuffer(this._buffers.childIndex),chainCode:m.bufferToHex(this._buffers.chainCode),privateKey:this.privateKey.toBuffer().toString("hex"),checksum:m.integerFromBuffer(this._buffers.checksum),xprivkey:this.xprivkey}},n.fromBuffer=function(t){return new n(t.toString())},n.prototype.toBuffer=function(){return m.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:298}],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 y.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 y.UnrecognizedArgument(t)}throw new y.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,y=b.HDPublicKey,v=t("assert"),m=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 y.InvalidIndexCantDeriveHardened;if(t<0)throw new y.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 y.InvalidIndexCantDeriveHardened;if(!n.isValidPath(t))throw new y.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 y.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 y.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 y.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),m.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 m.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];v(_.isBuffer(n),e+" argument is not a buffer, it's "+typeof n),v(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,v(n.PublicKeyEnd===n.DataSize),v(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:298}],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&&t<=16,"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:298}],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)},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:298}],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)||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:298}],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])||(this.errstr="SCRIPT_ERR_EVAL_FALSE_IN_P2SH_STACK",!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)},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))&&!!this.tx.inputs[this.nin].isFinal())},c.prototype.step=function(){var t,e,r,h,d,p,l,b,g,y,v,m,_,w,S,I,k,E=0!==(this.flags&c.SCRIPT_VERIFY_MINIMALDATA),A=this.vfExec.indexOf(!1)===-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&&0<=P&&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 M=this.stack[this.stack.length-1];this.stack.push(e),this.stack.push(r),this.stack.push(M);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(),d<0||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 B=this.stack[this.stack.length-1];this.stack[this.stack.length-3]=l,this.stack[this.stack.length-2]=B,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),y=o.fromScriptNumBuffer(this.stack[this.stack.length-1],E),b=new o(0),P){case s.OP_ADD:b=g.add(y);break;case s.OP_SUB:b=g.sub(y);break;case s.OP_BOOLAND:b=new o((0!==g.cmp(o.Zero)&&0!==y.cmp(o.Zero))+0);break;case s.OP_BOOLOR:b=new o((0!==g.cmp(o.Zero)||0!==y.cmp(o.Zero))+0);break;case s.OP_NUMEQUAL:b=new o((0===g.cmp(y))+0);break;case s.OP_NUMEQUALVERIFY:b=new o((0===g.cmp(y))+0);break;case s.OP_NUMNOTEQUAL:b=new o((0!==g.cmp(y))+0);break;case s.OP_LESSTHAN:b=new o((g.cmp(y)<0)+0);break;case s.OP_GREATERTHAN:b=new o((g.cmp(y)>0)+0);break;case s.OP_LESSTHANOREQUAL:b=new o((g.cmp(y)<=0)+0);break;case s.OP_GREATERTHANOREQUAL:b=new o((g.cmp(y)>=0)+0);break;case s.OP_MIN:b=g.cmp(y)<0?g:y;break;case s.OP_MAX:b=g.cmp(y)>0?g:y}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),y=o.fromScriptNumBuffer(this.stack[this.stack.length-2],E);var T=o.fromScriptNumBuffer(this.stack[this.stack.length-1],E);I=y.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;v=this.stack[this.stack.length-2],m=this.stack[this.stack.length-1],_=(new i).set({chunks:this.script.chunks.slice(this.pbegincodehash)});var N=(new i).add(v);if(_.findAndDelete(N),!this.checkSignatureEncoding(v)||!this.checkPubkeyEncoding(m))return!1;try{w=f.fromTxFormat(v),S=u.fromBuffer(m,!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.length20)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.lengthL)return this.errstr="SCRIPT_ERR_SIG_COUNT",!1;var F=++U;if(U+=z,this.stack.length0;){if(v=this.stack[this.stack.length-F],m=this.stack[this.stack.length-D],!this.checkSignatureEncoding(v)||!this.checkPubkeyEncoding(m))return!1;var H;try{w=f.fromTxFormat(v),S=u.fromBuffer(m,!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:298}],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"),y=function v(t){return this instanceof v?(this.chunks=[],b.isBuffer(t)?v.fromBuffer(t):t instanceof n?v.fromAddress(t):t instanceof v?v.fromBuffer(t.toBuffer()):"string"==typeof t?v.fromString(t):void("undefined"!=typeof t&&this.set(t))):new v(t)};y.prototype.set=function(t){return this.chunks=t.chunks||this.chunks,this},y.fromBuffer=function(t){var e=new y;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},y.prototype.toASM=function(){for(var t="",e=0;e"},y.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)},y.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},y.prototype.getPublicKey=function(){return h.checkState(this.isPublicKeyOut(),"Can't retreive PublicKey from a non-PK output"),this.chunks[0].buf},y.prototype.getPublicKeyHash=function(){return h.checkState(this.isPublicKeyHashOut(),"Can't retrieve PublicKeyHash from a non-PKH output"),this.chunks[2].buf},y.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},y.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},y.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},y.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=y.fromBuffer(e)}catch(n){if(n instanceof p.Script.InvalidBuffer)return!1;throw n}var i=r.classify();return i!==y.types.UNKNOWN},y.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},y.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)})},y.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<=y.OP_RETURN_STANDARD_SIZE&&this.chunks[1].length===this.chunks.len)},y.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")},y.prototype.isPushOnly=function(){return d.every(this.chunks,function(t){return t.opcodenum<=a.OP_16})},y.types={},y.types.UNKNOWN="Unknown",y.types.PUBKEY_OUT="Pay to public key",y.types.PUBKEY_IN="Spend from public key",y.types.PUBKEYHASH_OUT="Pay to public key hash",y.types.PUBKEYHASH_IN="Spend from public key hash",y.types.SCRIPTHASH_OUT="Pay to script hash",y.types.SCRIPTHASH_IN="Spend from script hash",y.types.MULTISIG_OUT="Pay to multisig",y.types.MULTISIG_IN="Spend from multisig",y.types.DATA_OUT="Data push",y.OP_RETURN_STANDARD_SIZE=80,y.prototype.classify=function(){if(this._isInput)return this.classifyInput();if(this._isOutput)return this.classifyOutput();var t=this.classifyOutput();return t!=y.types.UNKNOWN?t:this.classifyInput()},y.outputIdentifiers={},y.outputIdentifiers.PUBKEY_OUT=y.prototype.isPublicKeyOut,y.outputIdentifiers.PUBKEYHASH_OUT=y.prototype.isPublicKeyHashOut,y.outputIdentifiers.MULTISIG_OUT=y.prototype.isMultisigOut,y.outputIdentifiers.SCRIPTHASH_OUT=y.prototype.isScriptHashOut,y.outputIdentifiers.DATA_OUT=y.prototype.isDataOut,y.prototype.classifyOutput=function(){for(var t in y.outputIdentifiers)if(y.outputIdentifiers[t].bind(this)())return y.types[t];return y.types.UNKNOWN},y.inputIdentifiers={},y.inputIdentifiers.PUBKEY_IN=y.prototype.isPublicKeyIn,y.inputIdentifiers.PUBKEYHASH_IN=y.prototype.isPublicKeyHashIn,y.inputIdentifiers.MULTISIG_IN=y.prototype.isMultisigIn,y.inputIdentifiers.SCRIPTHASH_IN=y.prototype.isScriptHashIn,y.prototype.classifyInput=function(){for(var t in y.inputIdentifiers)if(y.inputIdentifiers[t].bind(this)())return y.types[t];return y.types.UNKNOWN},y.prototype.isStandard=function(){return this.classify()!==y.types.UNKNOWN},y.prototype.prepend=function(t){return this._addByType(t,!0),this},y.prototype.equals=function(t){if(h.checkState(t instanceof y,"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)},y.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))},y.prototype.getSignatureOperationsCount=function(t){t=!!d.isUndefined(t)||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=y}).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:298}],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=l-2,g=l,y=l-1;n.MAXINT=l,n.DEFAULT_SEQNUMBER=g,n.DEFAULT_LOCKTIME_SEQNUMBER=y,n.DEFAULT_RBF_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)?g: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:298}],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){if(t)return new p(t)})},n.prototype._serializeSignatures=function(){return i.map(this.signatures,function(t){if(t)return t.toObject()})},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)}),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:297,lodash:298}],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){if(t)return new p(t)})},n.prototype._serializeSignatures=function(){return i.map(this.signatures,function(t){if(t)return t.toObject()})},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:297,lodash:298}],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:297}],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:297}],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"},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:298}],37:[function(t,e,r){(function(r){"use strict";function n(t,e,r,n,i){var s=v(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=v(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",y="ffffffffffffffff",v=function(e,n,i,p){var l,b=t("./transaction"),v=t("./input"),m=b.shallowCopy(e);for(p=new a(p),p.removeCodeseparators(),l=0;l=m.outputs.length)return new r(g,"hex");for(m.outputs.length=i+1,l=0;lr)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(e"},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;e=n.NLOCKTIME_BLOCKHEIGHT_LIMIT)throw new f.Transaction.BlockHeightTooHigh;if(t<0)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}),r<0||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===v.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===v.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;e=v.MAXINT-1&&(e.sequenceNumber=v.DEFAULT_RBF_SEQNUMBER)}return this},e.exports=n}).call(this,t("buffer").Buffer)},{"../address":1,"../crypto/bn":6,"../crypto/hash":8,"../crypto/signature":11,"../encoding/bufferreader":14,"../encoding/bufferwriter":15,"../errors":17,"../privatekey":24,"../script":26,"../util/buffer":43,"../util/js":44,"../util/preconditions":45,"./input":30,"./output":36,"./sighash":37,"./unspentoutput":40,buffer:48,"buffer-compare":275,lodash:298}],40:[function(t,e,r){"use strict";function n(t){if(!(this instanceof n))return new n(t);s.checkArgument(i.isObject(t),"Must provide an object from where to extract data");var e=t.address?new f(t.address):void 0,r=t.txid?t.txid:t.txId;if(!r||!o.isHexaString(r)||r.length>64)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:298}],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(e<=0)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(t<=0)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:298}],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)&&this.knownParams.indexOf(e)===-1)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:298,url:268}],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;n>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:298}],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:298}],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||e.call({},t)===!0)}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 y=Object.keys||function(t){var e=[];for(var r in t)b.call(t,r)&&e.push(r);return e}},{"util/":270}],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,e<0?0:0|g(e)),!s.TYPED_ARRAY_SUPPORT)for(var r=0;r>>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 y(t,e){if(!(this instanceof y))return new y(t,e);var r=new s(t,e);return delete r.parent,r}function v(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 m(t,e,r){var n=!1;if(e=0|e,r=void 0===r||r===1/0?this.length:0|r,t||(t="utf8"),e<0&&(e=0),r>this.length&&(r=this.length),r<=e)return"";for(;;)switch(t){case"hex":return B(this,e,r);case"utf8":case"utf-8":return x(this,e,r);case"ascii":return O(this,e,r);case"binary":return M(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;o239?4:s>223?3:s>191?2:1;if(i+a<=r){var f,u,c,h;switch(a){case 1:s<128&&(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&&(h<55296||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&&h<1114112&&(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(e<=Q)return String.fromCharCode.apply(String,t);for(var r="",n=0;nn)&&(r=n);for(var i="",s=e;sr)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||et.length)throw new RangeError("index out of range")}function N(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,s=Math.min(t.length-r,2);i>>8*(n?i:1-i)}function j(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,s=Math.min(t.length-r,4);i>>8*(n?i:3-i)&255}function U(t,e,r,n,i,s){if(e>i||et.length)throw new RangeError("index out of range");if(r<0)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 t<16?"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;o55295&&r<57344){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(r<56320){(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,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))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;i=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=y,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);i0&&(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:e<-2147483648&&(e=-2147483648),e>>=0,0===this.length)return-1;if(e>=this.length)return-1;if(e<0&&(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&&(r<0||e<0)||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,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),e0&&(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]?(255-this[t]+1)*-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=t<0?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=t<0?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)),t<0&&(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),t<0&&(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&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;i--)t[i+e]=this[i+r];else if(o<1e3||!s.TYPED_ARRAY_SUPPORT)for(i=0;i=this.length)throw new RangeError("start out of bounds");if(r<0||r>this.length)throw new RangeError("end out of bounds");var n;if("number"==typeof t)for(n=e;n0)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;n>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;i>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=e<0||0===e&&1/e<0?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||t<0?(r=Math.abs(t)%a,t<0?a-r:r):t}function n(t){for(var e=0;e>>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;n>>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;t>>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;++i16)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(){if(this.cache.length)return this.cache};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:297}],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||t<0?(r=Math.abs(t)%f,t<0?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;++a0;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:297,"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:297,"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;a<=24;a+=8)i<<=1,i|=e>>>a+o&1;for(var a=0;a<=24;a+=8)i<<=1,i|=t>>>a+o&1}for(var o=6;o>=0;o-=2){for(var a=1;a<=25;a+=8)s<<=1,s|=e>>>a+o&1;for(var a=1;a<=25;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;o<4;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;o<8;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;a<=24;a+=8)i<<=1,i|=e>>a+o&1;for(var a=0;a<=24;a+=8)i<<=1,i|=t>>a+o&1}for(var a=0;a<=24;a+=8)i<<=1,i|=e>>a+o&1;for(var o=1;o<=3;o++){for(var a=0;a<=24;a+=8)s<<=1,s|=e>>a+o&1;for(var a=0;a<=24;a+=8)s<<=1,s|=t>>a+o&1}for(var a=0;a<=24;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;f>>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;n<4;n++){var s=t>>>18-6*n&63,o=i[64*n+s];r<<=4,r|=o}for(var n=0;n<4;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.length0&&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;a=49&&o<=54?o-49+10:o>=17&&o<=22?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;o=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;u>>26,h=67108863&f,d=Math.min(u,e.length-1),p=Math.max(0,u-t.length+1);p<=d;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>>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 y(){p.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function v(t){if("string"==typeof t){var e=s._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function m(t){v.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.isBN=function(t){return t instanceof s||null!==t&&"object"==typeof t&&t.constructor.wordSize===s.wordSize&&Array.isArray(t.words)},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&&e<=36),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){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),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;i<=67108863;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;c1&&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&&t<=36){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=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&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 _),this.toArrayLike(_,t,e)},s.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},s.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),s=r||Math.max(1,i);n(i<=s,"byte array longer than desired length"),n(s>0,"Requested array length <= 0"),this.strip();var o,a,f="le"===e,u=new t(s),c=this.clone();if(f){for(a=0;!c.isZero();a++)o=c.andln(255),c.iushrn(8),u[a]=o;for(;a=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);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(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);var r=t/26|0,i=t%26;return this._expand(r+1),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],y=8191&g,v=g>>>13,m=0|o[3],_=8191&m,w=m>>>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,M=P>>>13,B=0|o[7],R=8191&B,T=B>>>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=i+Math.imul(d,F)|0,s=Math.imul(d,K);var gt=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(l,F),i=Math.imul(l,K),i=i+Math.imul(b,F)|0,s=Math.imul(b,K),n=n+Math.imul(h,q)|0,i=i+Math.imul(h,V)|0,i=i+Math.imul(d,q)|0,s=s+Math.imul(d,V)|0;var yt=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,F),i=Math.imul(y,K),i=i+Math.imul(v,F)|0,s=Math.imul(v,K),n=n+Math.imul(l,q)|0,i=i+Math.imul(l,V)|0,i=i+Math.imul(b,q)|0,s=s+Math.imul(b,V)|0,n=n+Math.imul(h,G)|0,i=i+Math.imul(h,W)|0,i=i+Math.imul(d,G)|0,s=s+Math.imul(d,W)|0;var vt=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(_,F),i=Math.imul(_,K),i=i+Math.imul(w,F)|0,s=Math.imul(w,K),n=n+Math.imul(y,q)|0,i=i+Math.imul(y,V)|0,i=i+Math.imul(v,q)|0,s=s+Math.imul(v,V)|0,n=n+Math.imul(l,G)|0,i=i+Math.imul(l,W)|0,i=i+Math.imul(b,G)|0,s=s+Math.imul(b,W)|0,n=n+Math.imul(h,J)|0,i=i+Math.imul(h,Z)|0,i=i+Math.imul(d,J)|0,s=s+Math.imul(d,Z)|0;var mt=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(I,F),i=Math.imul(I,K),i=i+Math.imul(k,F)|0,s=Math.imul(k,K),n=n+Math.imul(_,q)|0,i=i+Math.imul(_,V)|0,i=i+Math.imul(w,q)|0,s=s+Math.imul(w,V)|0,n=n+Math.imul(y,G)|0,i=i+Math.imul(y,W)|0,i=i+Math.imul(v,G)|0,s=s+Math.imul(v,W)|0,n=n+Math.imul(l,J)|0,i=i+Math.imul(l,Z)|0,i=i+Math.imul(b,J)|0,s=s+Math.imul(b,Z)|0,n=n+Math.imul(h,$)|0,i=i+Math.imul(h,tt)|0,i=i+Math.imul(d,$)|0,s=s+Math.imul(d,tt)|0;var _t=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(A,F),i=Math.imul(A,K),i=i+Math.imul(x,F)|0,s=Math.imul(x,K),n=n+Math.imul(I,q)|0,i=i+Math.imul(I,V)|0,i=i+Math.imul(k,q)|0,s=s+Math.imul(k,V)|0,n=n+Math.imul(_,G)|0,i=i+Math.imul(_,W)|0,i=i+Math.imul(w,G)|0,s=s+Math.imul(w,W)|0,n=n+Math.imul(y,J)|0,i=i+Math.imul(y,Z)|0,i=i+Math.imul(v,J)|0,s=s+Math.imul(v,Z)|0,n=n+Math.imul(l,$)|0,i=i+Math.imul(l,tt)|0,i=i+Math.imul(b,$)|0,s=s+Math.imul(b,tt)|0,n=n+Math.imul(h,rt)|0,i=i+Math.imul(h,nt)|0,i=i+Math.imul(d,rt)|0,s=s+Math.imul(d,nt)|0;var wt=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(O,F),i=Math.imul(O,K),i=i+Math.imul(M,F)|0,s=Math.imul(M,K),n=n+Math.imul(A,q)|0,i=i+Math.imul(A,V)|0,i=i+Math.imul(x,q)|0,s=s+Math.imul(x,V)|0,n=n+Math.imul(I,G)|0,i=i+Math.imul(I,W)|0,i=i+Math.imul(k,G)|0,s=s+Math.imul(k,W)|0,n=n+Math.imul(_,J)|0,i=i+Math.imul(_,Z)|0,i=i+Math.imul(w,J)|0,s=s+Math.imul(w,Z)|0,n=n+Math.imul(y,$)|0,i=i+Math.imul(y,tt)|0,i=i+Math.imul(v,$)|0,s=s+Math.imul(v,tt)|0,n=n+Math.imul(l,rt)|0,i=i+Math.imul(l,nt)|0,i=i+Math.imul(b,rt)|0,s=s+Math.imul(b,nt)|0,n=n+Math.imul(h,st)|0,i=i+Math.imul(h,ot)|0,i=i+Math.imul(d,st)|0,s=s+Math.imul(d,ot)|0;var St=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(R,F),i=Math.imul(R,K),i=i+Math.imul(T,F)|0,s=Math.imul(T,K),n=n+Math.imul(O,q)|0,i=i+Math.imul(O,V)|0,i=i+Math.imul(M,q)|0,s=s+Math.imul(M,V)|0,n=n+Math.imul(A,G)|0,i=i+Math.imul(A,W)|0,i=i+Math.imul(x,G)|0,s=s+Math.imul(x,W)|0,n=n+Math.imul(I,J)|0,i=i+Math.imul(I,Z)|0,i=i+Math.imul(k,J)|0,s=s+Math.imul(k,Z)|0,n=n+Math.imul(_,$)|0,i=i+Math.imul(_,tt)|0,i=i+Math.imul(w,$)|0,s=s+Math.imul(w,tt)|0,n=n+Math.imul(y,rt)|0,i=i+Math.imul(y,nt)|0,i=i+Math.imul(v,rt)|0,s=s+Math.imul(v,nt)|0,n=n+Math.imul(l,st)|0,i=i+Math.imul(l,ot)|0,i=i+Math.imul(b,st)|0,s=s+Math.imul(b,ot)|0,n=n+Math.imul(h,ft)|0,i=i+Math.imul(h,ut)|0,i=i+Math.imul(d,ft)|0,s=s+Math.imul(d,ut)|0;var It=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(N,F),i=Math.imul(N,K),i=i+Math.imul(j,F)|0,s=Math.imul(j,K),n=n+Math.imul(R,q)|0,i=i+Math.imul(R,V)|0,i=i+Math.imul(T,q)|0,s=s+Math.imul(T,V)|0,n=n+Math.imul(O,G)|0,i=i+Math.imul(O,W)|0,i=i+Math.imul(M,G)|0,s=s+Math.imul(M,W)|0,n=n+Math.imul(A,J)|0,i=i+Math.imul(A,Z)|0,i=i+Math.imul(x,J)|0,s=s+Math.imul(x,Z)|0,n=n+Math.imul(I,$)|0,i=i+Math.imul(I,tt)|0,i=i+Math.imul(k,$)|0,s=s+Math.imul(k,tt)|0,n=n+Math.imul(_,rt)|0,i=i+Math.imul(_,nt)|0,i=i+Math.imul(w,rt)|0,s=s+Math.imul(w,nt)|0,n=n+Math.imul(y,st)|0,i=i+Math.imul(y,ot)|0,i=i+Math.imul(v,st)|0,s=s+Math.imul(v,ot)|0,n=n+Math.imul(l,ft)|0,i=i+Math.imul(l,ut)|0,i=i+Math.imul(b,ft)|0,s=s+Math.imul(b,ut)|0,n=n+Math.imul(h,ht)|0,i=i+Math.imul(h,dt)|0,i=i+Math.imul(d,ht)|0,s=s+Math.imul(d,dt)|0;var kt=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(L,F),i=Math.imul(L,K),i=i+Math.imul(D,F)|0,s=Math.imul(D,K),n=n+Math.imul(N,q)|0,i=i+Math.imul(N,V)|0,i=i+Math.imul(j,q)|0,s=s+Math.imul(j,V)|0,n=n+Math.imul(R,G)|0,i=i+Math.imul(R,W)|0,i=i+Math.imul(T,G)|0,s=s+Math.imul(T,W)|0,n=n+Math.imul(O,J)|0,i=i+Math.imul(O,Z)|0,i=i+Math.imul(M,J)|0,s=s+Math.imul(M,Z)|0,n=n+Math.imul(A,$)|0,i=i+Math.imul(A,tt)|0,i=i+Math.imul(x,$)|0,s=s+Math.imul(x,tt)|0,n=n+Math.imul(I,rt)|0,i=i+Math.imul(I,nt)|0,i=i+Math.imul(k,rt)|0,s=s+Math.imul(k,nt)|0,n=n+Math.imul(_,st)|0,i=i+Math.imul(_,ot)|0,i=i+Math.imul(w,st)|0,s=s+Math.imul(w,ot)|0,n=n+Math.imul(y,ft)|0,i=i+Math.imul(y,ut)|0,i=i+Math.imul(v,ft)|0,s=s+Math.imul(v,ut)|0,n=n+Math.imul(l,ht)|0,i=i+Math.imul(l,dt)|0,i=i+Math.imul(b,ht)|0,s=s+Math.imul(b,dt)|0,n=n+Math.imul(h,lt)|0,i=i+Math.imul(h,bt)|0,i=i+Math.imul(d,lt)|0,s=s+Math.imul(d,bt)|0;var Et=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(L,q),i=Math.imul(L,V),i=i+Math.imul(D,q)|0,s=Math.imul(D,V),n=n+Math.imul(N,G)|0,i=i+Math.imul(N,W)|0,i=i+Math.imul(j,G)|0,s=s+Math.imul(j,W)|0,n=n+Math.imul(R,J)|0,i=i+Math.imul(R,Z)|0,i=i+Math.imul(T,J)|0,s=s+Math.imul(T,Z)|0,n=n+Math.imul(O,$)|0,i=i+Math.imul(O,tt)|0,i=i+Math.imul(M,$)|0,s=s+Math.imul(M,tt)|0,n=n+Math.imul(A,rt)|0,i=i+Math.imul(A,nt)|0,i=i+Math.imul(x,rt)|0,s=s+Math.imul(x,nt)|0,n=n+Math.imul(I,st)|0,i=i+Math.imul(I,ot)|0,i=i+Math.imul(k,st)|0,s=s+Math.imul(k,ot)|0,n=n+Math.imul(_,ft)|0,i=i+Math.imul(_,ut)|0,i=i+Math.imul(w,ft)|0,s=s+Math.imul(w,ut)|0,n=n+Math.imul(y,ht)|0,i=i+Math.imul(y,dt)|0,i=i+Math.imul(v,ht)|0,s=s+Math.imul(v,dt)|0,n=n+Math.imul(l,lt)|0,i=i+Math.imul(l,bt)|0,i=i+Math.imul(b,lt)|0,s=s+Math.imul(b,bt)|0;var At=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(L,G),i=Math.imul(L,W),i=i+Math.imul(D,G)|0,s=Math.imul(D,W),n=n+Math.imul(N,J)|0,i=i+Math.imul(N,Z)|0,i=i+Math.imul(j,J)|0,s=s+Math.imul(j,Z)|0,n=n+Math.imul(R,$)|0,i=i+Math.imul(R,tt)|0,i=i+Math.imul(T,$)|0,s=s+Math.imul(T,tt)|0,n=n+Math.imul(O,rt)|0,i=i+Math.imul(O,nt)|0,i=i+Math.imul(M,rt)|0,s=s+Math.imul(M,nt)|0,n=n+Math.imul(A,st)|0,i=i+Math.imul(A,ot)|0,i=i+Math.imul(x,st)|0,s=s+Math.imul(x,ot)|0,n=n+Math.imul(I,ft)|0,i=i+Math.imul(I,ut)|0,i=i+Math.imul(k,ft)|0,s=s+Math.imul(k,ut)|0,n=n+Math.imul(_,ht)|0,i=i+Math.imul(_,dt)|0,i=i+Math.imul(w,ht)|0,s=s+Math.imul(w,dt)|0,n=n+Math.imul(y,lt)|0,i=i+Math.imul(y,bt)|0,i=i+Math.imul(v,lt)|0,s=s+Math.imul(v,bt)|0;var xt=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(L,J),i=Math.imul(L,Z),i=i+Math.imul(D,J)|0,s=Math.imul(D,Z),n=n+Math.imul(N,$)|0,i=i+Math.imul(N,tt)|0,i=i+Math.imul(j,$)|0,s=s+Math.imul(j,tt)|0,n=n+Math.imul(R,rt)|0,i=i+Math.imul(R,nt)|0,i=i+Math.imul(T,rt)|0,s=s+Math.imul(T,nt)|0,n=n+Math.imul(O,st)|0,i=i+Math.imul(O,ot)|0,i=i+Math.imul(M,st)|0,s=s+Math.imul(M,ot)|0,n=n+Math.imul(A,ft)|0,i=i+Math.imul(A,ut)|0,i=i+Math.imul(x,ft)|0,s=s+Math.imul(x,ut)|0,n=n+Math.imul(I,ht)|0,i=i+Math.imul(I,dt)|0,i=i+Math.imul(k,ht)|0,s=s+Math.imul(k,dt)|0,n=n+Math.imul(_,lt)|0,i=i+Math.imul(_,bt)|0,i=i+Math.imul(w,lt)|0,s=s+Math.imul(w,bt)|0;var Pt=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(L,$),i=Math.imul(L,tt),i=i+Math.imul(D,$)|0,s=Math.imul(D,tt),n=n+Math.imul(N,rt)|0,i=i+Math.imul(N,nt)|0,i=i+Math.imul(j,rt)|0,s=s+Math.imul(j,nt)|0,n=n+Math.imul(R,st)|0,i=i+Math.imul(R,ot)|0,i=i+Math.imul(T,st)|0,s=s+Math.imul(T,ot)|0,n=n+Math.imul(O,ft)|0,i=i+Math.imul(O,ut)|0,i=i+Math.imul(M,ft)|0,s=s+Math.imul(M,ut)|0,n=n+Math.imul(A,ht)|0,i=i+Math.imul(A,dt)|0,i=i+Math.imul(x,ht)|0,s=s+Math.imul(x,dt)|0,n=n+Math.imul(I,lt)|0,i=i+Math.imul(I,bt)|0,i=i+Math.imul(k,lt)|0,s=s+Math.imul(k,bt)|0;var Ot=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(L,rt),i=Math.imul(L,nt),i=i+Math.imul(D,rt)|0,s=Math.imul(D,nt),n=n+Math.imul(N,st)|0,i=i+Math.imul(N,ot)|0,i=i+Math.imul(j,st)|0,s=s+Math.imul(j,ot)|0,n=n+Math.imul(R,ft)|0,i=i+Math.imul(R,ut)|0,i=i+Math.imul(T,ft)|0,s=s+Math.imul(T,ut)|0,n=n+Math.imul(O,ht)|0,i=i+Math.imul(O,dt)|0,i=i+Math.imul(M,ht)|0,s=s+Math.imul(M,dt)|0,n=n+Math.imul(A,lt)|0,i=i+Math.imul(A,bt)|0,i=i+Math.imul(x,lt)|0,s=s+Math.imul(x,bt)|0;var Mt=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(L,st),i=Math.imul(L,ot),i=i+Math.imul(D,st)|0,s=Math.imul(D,ot),n=n+Math.imul(N,ft)|0,i=i+Math.imul(N,ut)|0,i=i+Math.imul(j,ft)|0,s=s+Math.imul(j,ut)|0,n=n+Math.imul(R,ht)|0,i=i+Math.imul(R,dt)|0,i=i+Math.imul(T,ht)|0,s=s+Math.imul(T,dt)|0,n=n+Math.imul(O,lt)|0,i=i+Math.imul(O,bt)|0,i=i+Math.imul(M,lt)|0,s=s+Math.imul(M,bt)|0;var Bt=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,n=Math.imul(L,ft),i=Math.imul(L,ut),i=i+Math.imul(D,ft)|0,s=Math.imul(D,ut),n=n+Math.imul(N,ht)|0,i=i+Math.imul(N,dt)|0,i=i+Math.imul(j,ht)|0,s=s+Math.imul(j,dt)|0,n=n+Math.imul(R,lt)|0,i=i+Math.imul(R,bt)|0,i=i+Math.imul(T,lt)|0,s=s+Math.imul(T,bt)|0;var Rt=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(L,ht),i=Math.imul(L,dt),i=i+Math.imul(D,ht)|0,s=Math.imul(D,dt),n=n+Math.imul(N,lt)|0,i=i+Math.imul(N,bt)|0,i=i+Math.imul(j,lt)|0,s=s+Math.imul(j,bt)|0;var Tt=(u+n|0)+((8191&i)<<13)|0;u=(s+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(L,lt),i=Math.imul(L,bt),i=i+Math.imul(D,lt)|0,s=Math.imul(D,bt);var Ct=(u+n|0)+((8191&i)<<13)|0;return u=(s+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,f[0]=gt,f[1]=yt,f[2]=vt,f[3]=mt,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]=Mt,f[15]=Bt,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):n<63?u(this,t,e):n<1024?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;n>=1;return n},d.prototype.permute=function(t,e,r,n,i,s){for(var o=0;o>>=1)i++;return 1<>>=13,r[2*o+1]=8191&s,s>>>=13;for(o=2*e;o>=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;e=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<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<=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),n(t<67108864),t<0)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)-(f/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this.strip();for(n(a===-1),a=0,i=0;i>26,this.words[i]=67108863&o;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){if(n(!t.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};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 s<0||1===i&&0===s?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},s.prototype.modn=function(t){n(t<=67108863);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(t<=67108863);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)&&d<26;++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)&&l<26;++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)&&f<26;++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)&&c<26;++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.abs();if(t.isZero())return this.abs();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(i<0){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<>>26,a&=67108863,this.words[o]=a}return 0!==s&&(this.words[o]=s,this.length++),this},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.cmpn=function(t){var e=t<0;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(t<=67108863,"Number is too big");var i=0|this.words[0];r=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(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 this.cmpn(t)===-1},s.prototype.lt=function(t){return this.cmp(t)===-1},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 v(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.shl(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;i>>22,s=o}s>>>=22,t.words[i-10]=s,0===s&&t.length>10?t.length-=10: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 y}return A[t]=x,x},v.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},v.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")},v.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},v.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},v.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)},v.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},v.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)},v.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},v.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},v.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},v.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},v.prototype.isqr=function(t){return this.imul(t,t.clone())},v.prototype.sqr=function(t){return this.mul(t,t)},v.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(g=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},v.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},v.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},s.mont=function(t){return new m(t)},i(m,v),m.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},m.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},m.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)},m.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)},m.prototype.invm=function(t){var e=this.imod(t._invmp(this.m).mul(this.r2));return e._forceRed(this)}}("undefined"==typeof e||e,this)},{}],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);var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function 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),a<0)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,i){for(var s=this._wnafT1,o=this._wnafT2,a=this._wnafT3,c=0,h=0;h=1;h-=2){var l=h-1,b=h;if(1===s[l]&&1===s[b]){var g=[e[l],null,null,e[b]];0===e[l].y.cmp(e[b].y)?(g[1]=e[l].add(e[b]),g[2]=e[l].toJ().mixedAdd(e[b].neg())):0===e[l].y.cmp(e[b].y.redNeg())?(g[1]=e[l].toJ().mixedAdd(e[b]),g[2]=e[l].add(e[b].neg())):(g[1]=e[l].toJ().mixedAdd(e[b]),g[2]=e[l].toJ().mixedAdd(e[b].neg()));var y=[-3,-1,-5,-7,0,7,5,1,3],v=u(r[l],r[b]);c=Math.max(v[0].length,c),a[l]=new Array(c),a[b]=new Array(c);for(var m=0;m=0;h--){for(var k=0;h>=0;){for(var E=!0,m=0;m=0&&k++,S=S.dblp(k),h<0)break;for(var m=0;m0?d=o[m][A-1>>1]:A<0&&(d=o[m][-A-1>>1].neg()),S="affine"===d.type?S.mixedAdd(d):S.add(d))}}for(var h=0;h=Math.ceil((t.bitLength()+1)/e.step)},i.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i":""},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,!1)},i.prototype.jmulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!0)},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.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var r=t.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(n),0===this.x.cmp(e))return!0}return!1},i.prototype.toP=i.prototype.normalize,i.prototype.mixedAdd=i.prototype.add},{"../../elliptic":87,"../curve":90,"bn.js":85,inherits:297}],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.jumlAdd=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:297}],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),y=new f(1),v=0;0!==d.cmpn(0);){var m=p.div(d);u=p.sub(m.mul(d)),c=g.sub(m.mul(l));var _=y.sub(m.mul(b));if(!n&&u.cmp(h)<0)e=a.neg(),r=l,n=u.neg(),i=c;else if(n&&2===++v)break;a=u,p=d,d=u,g=l,l=c,y=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,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,s=0;s":""},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.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},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;r=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}return!1},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:297}],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 y=p.invm(this.n).mul(g.mul(e.getPrivate()).iadd(t));if(y=y.umod(this.n),0!==y.cmpn(0)){var v=(l.getY().isOdd()?1:0)|(0!==b.cmp(g)?2:0);return n.canonical&&y.cmp(this.nh)>0&&(y=this.n.sub(y),v^=1),new u({r:g,s:y,recoveryParam:v})}}}}}},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);if(!this.curve._maxwellTrick){var h=this.g.mulAdd(f,r.getPublic(),c);return!h.isInfinity()&&0===h.getX().umod(this.n).cmp(s)}var h=this.g.jmulAdd(f,r.getPublic(),c);return!h.isInfinity()&&h.eqXToP(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 this.g.mulAdd(p,f,c).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;i<4;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;s>>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;f0||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,r){var n="_"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.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;n>>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>>3}function l(t){return B(t,17)^B(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 o<0&&(o+=4294967296),o}function y(t,e,r,n,i,s){var o=e&n^~e&s;return o<0&&(o+=4294967296),o}function v(t,e,r,n,i,s){var o=t&r^t&i^r&i;return o<0&&(o+=4294967296),o}function m(t,e,r,n,i,s){var o=e&n^e&s^n&s;return o<0&&(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 s<0&&(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 s<0&&(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 s<0&&(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 s<0&&(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 s<0&&(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 s<0&&(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 s<0&&(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 s<0&&(s+=4294967296),s}var P=t("../hash"),O=P.utils,M=O.assert,B=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;n<16;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 y(t,e){if(!t)throw new Error(e||"Assertion failed")}function v(t,e,r,n){var i=t[e],s=t[e+1],o=n+s>>>0,a=(o>>0,t[e+1]=o}function m(t,e,r,n){var i=e+n>>>0,s=(i>>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+=u>>0,f+=u>>0,f+=u>>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+=h>>0,c+=h>>0,c+=h>>0,c+=h>>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,M=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=y,O.inherits=M,r.sum64=v,r.sum64_hi=m,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:297}],110:[function(t,e,r){e.exports={name:"elliptic",version:"6.3.1",description:"EC cryptography",main:"lib/elliptic.js",files:["lib"],scripts:{jscs:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",jshint:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",lint:"npm run jscs && npm run jshint",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository:{type:"git",url:"git+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:{brfs:"^1.4.3",coveralls:"^2.11.3",grunt:"^0.4.5","grunt-browserify":"^5.0.0","grunt-contrib-connect":"^1.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^1.0.1","grunt-mocha-istanbul":"^3.0.1","grunt-saucelabs":"^8.6.2",istanbul:"^0.4.2",jscs:"^2.9.0",jshint:"^2.6.0",mocha:"^2.1.0"},dependencies:{"bn.js":"^4.4.0",brorand:"^1.0.1","hash.js":"^1.0.0",inherits:"^2.0.1"},gitHead:"c53f5cf3d832c0073eb4a4ed423a464cbce68f3e",_id:"elliptic@6.3.1",_shasum:"17781f2109ab0ec686b146bdcff5d2e8c6aeceda",_from:"elliptic@>=6.0.0 <7.0.0",_npmVersion:"3.8.6",_nodeVersion:"6.0.0",_npmUser:{name:"indutny",email:"fedor@indutny.com"},dist:{shasum:"17781f2109ab0ec686b146bdcff5d2e8c6aeceda",tarball:"https://registry.npmjs.org/elliptic/-/elliptic-6.3.1.tgz"},maintainers:[{name:"indutny",email:"fedor@indutny.com"}],_npmOperationalInternal:{host:"packages-16-east.internal.npmjs.com",tmp:"tmp/elliptic-6.3.1.tgz_1465921413402_0.5202967382501811"},directories:{},_resolved:"https://registry.npmjs.org/elliptic/-/elliptic-6.3.1.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 y=u.match(s);f=new r(y[2].replace(/\r?\n/g,""),"base64")}var v=u.match(i)[1]+" KEY";return{tag:v,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 t=t||"der",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 t=t||"der",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:297,vm:271}],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(!(0<=t&&t<=255))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:297}],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.contains=null,r.parent||(r.children=[],this._wrap())}var i=t("../base").Reporter,s=t("../base").EncoderBuffer,o=t("../base").DecoderBuffer,a=t("minimalistic-assert"),f=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],u=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(f),c=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];e.exports=n;var h=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];n.prototype.clone=function(){var t=this._baseState,e={};h.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;u.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;a(null===e.parent),t.call(this),e.children=e.children.filter(function(t){return t._baseState.parent===this},this),a.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&&(a(null===e.children),e.children=r,r.forEach(function(t){t._baseState.parent=this},this)),0!==t.length&&(a(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}))},c.forEach(function(t){n.prototype[t]=function(){var e=this._baseState;throw new Error(t+" not implemented for encoding: "+e.enc)}}),f.forEach(function(t){n.prototype[t]=function(){var e=this._baseState,r=Array.prototype.slice.call(arguments);return a(null===e.tag),e.tag=t,this._useArgs(r),this}}),n.prototype.use=function(t){var e=this._baseState;return a(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 a(null===e["default"]), e["default"]=t,e.optional=!0,this},n.prototype.explicit=function(t){var e=this._baseState;return a(null===e.explicit&&null===e.implicit),e.explicit=t,this},n.prototype.implicit=function(t){var e=this._baseState;return a(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 a(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 a(null===e.choice),e.choice=t,this._useArgs(Object.keys(t).map(function(e){return t[e]})),this},n.prototype.contains=function(t){var e=this._baseState;return a(null===e.use),e.contains=t,this},n.prototype._decode=function(t,e){var r=this._baseState;if(null===r.parent)return t.wrapResult(r.children[0]._decode(t,e));var n=r["default"],i=!0,s=null;if(null!==r.key&&(s=t.enterKey(r.key)),r.optional){var a=null;if(null!==r.explicit?a=r.explicit:null!==r.implicit?a=r.implicit:null!==r.tag&&(a=r.tag),null!==a||r.any){if(i=this._peekTag(t,a,r.any),t.isError(i))return i}else{var f=t.save();try{null===r.choice?this._decodeGeneric(r.tag,t,e):this._decodeChoice(t,e),i=!0}catch(u){i=!1}t.restore(f)}}var c;if(r.obj&&i&&(c=t.enterObject()),i){if(null!==r.explicit){var h=this._decodeTag(t,r.explicit);if(t.isError(h))return h;t=h}var d=t.offset;if(null===r.use&&null===r.choice){if(r.any)var f=t.save();var p=this._decodeTag(t,null!==r.implicit?r.implicit:r.tag,r.any);if(t.isError(p))return p;r.any?n=t.raw(f):t=p}if(e&&e.track&&null!==r.tag&&e.track(t.path(),d,t.length,"tagged"),e&&e.track&&null!==r.tag&&e.track(t.path(),t.offset,t.length,"content"),n=r.any?n:null===r.choice?this._decodeGeneric(r.tag,t,e):this._decodeChoice(t,e),t.isError(n))return n;if(r.any||null!==r.choice||null===r.children||r.children.forEach(function(r){r._decode(t,e)}),r.contains&&("octstr"===r.tag||"bitstr"===r.tag)){var l=new o(n);n=this._getUse(r.contains,t._reporterState.obj)._decode(l,e)}}return r.obj&&i&&(n=t.leaveObject(c)),null===r.key||null===n&&i!==!0?null!==s&&t.exitKey(s):t.leaveKey(s,r.key,n),n},n.prototype._decodeGeneric=function(t,e,r){var n=this._baseState;return"seq"===t||"set"===t?null:"seqof"===t||"setof"===t?this._decodeList(e,t,n.args[0],r):/str$/.test(t)?this._decodeStr(e,t,r):"objid"===t&&n.args?this._decodeObjid(e,n.args[0],n.args[1],r):"objid"===t?this._decodeObjid(e,null,null,r):"gentime"===t||"utctime"===t?this._decodeTime(e,t,r):"null_"===t?this._decodeNull(e,r):"bool"===t?this._decodeBool(e,r):"int"===t||"enum"===t?this._decodeInt(e,n.args&&n.args[0],r):null!==n.use?this._getUse(n.use,e._reporterState.obj)._decode(e,r):e.error("unknown tag: "+t)},n.prototype._getUse=function(t,e){var r=this._baseState;return r.useDecoder=this._use(t,e),a(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,e){var r=this._baseState,n=null,i=!1;return Object.keys(r.choice).some(function(s){var o=t.save(),a=r.choice[s];try{var f=a._decode(t,e);if(t.isError(f))return!1;n={type:s,value:f},i=!0}catch(u){return t.restore(o),!1}return!0},this),i?n: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.contains)o=this._getUse(n.contains,r)._encode(t,e),a=!0;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||a(!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(/str$/.test(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.exitKey=function(t){var e=this._reporterState;e.path=e.path.slice(0,t-1)},n.prototype.leaveKey=function(t,e,r){var n=this._reporterState;this.exitKey(t),null!==n.obj&&(n.obj[e]=r)},n.prototype.path=function(){return this._reporterState.path.join("/")},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){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,i),!this.stack)try{throw new Error(this.message)}catch(e){this.stack=e.stack}return this}},{inherits:297}],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;s=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.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("bitstr"===e)return this._createEncoderBuffer([0|t.unused,t.data]);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(t<128)return this._createEncoderBuffer(t);if(t<256)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.length=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>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:297,stream:266,string_decoder:267}],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;n<16;n++){var i=r+n,h=e[i];e[i]=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8)}var v,m,_,w,S,I,k,E,A,x;I=v=t[0],k=m=t[1],E=_=t[2],A=w=t[3],x=S=t[4];var P;for(n=0;n<80;n+=1)P=v+e[r+d[n]]|0,P+=n<16?s(m,_,w)+g[0]:n<32?o(m,_,w)+g[1]:n<48?a(m,_,w)+g[2]:n<64?f(m,_,w)+g[3]:u(m,_,w)+g[4],P=0|P,P=c(P,l[n]),P=P+S|0,v=S,S=w,w=c(_,10),_=m,m=P,P=I+e[r+p[n]]|0,P+=n<16?u(k,E,A)+y[0]:n<32?f(k,E,A)+y[1]:n<48?a(k,E,A)+y[2]:n<64?o(k,E,A)+y[3]:s(k,E,A)+y[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]+v+k|0,t[4]=t[0]+m+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;u>>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],y=[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;i=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=c,f.call(this,64,56)}function i(t){return t<<5|t>>>27}function s(t){return t<<30|t>>>2}function o(t,e,r,n){return 0===t?e&r|~e&n:2===t?e&r|e&n|r&n:e^r^n}var a=t("inherits"),f=t("./hash"),u=[1518500249,1859775393,-1894007588,-899497514],c=new Array(80);a(n,f),n.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},n.prototype._update=function(t){for(var e=this._w,r=0|this._a,n=0|this._b,a=0|this._c,f=0|this._d,c=0|this._e,h=0;h<16;++h)e[h]=t.readInt32BE(4*h);for(;h<80;++h)e[h]=e[h-3]^e[h-8]^e[h-14]^e[h-16];for(var d=0;d<80;++d){var p=~~(d/20),l=i(r)+o(p,n,a,f)+c+e[d]+u[p]|0;c=f,f=a,a=s(n),n=r,r=l}this._a=r+this._a|0,this._b=n+this._b|0,this._c=a+this._c|0,this._d=f+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:297}],184:[function(t,e,r){(function(r){function n(){this.init(),this._w=h,u.call(this,64,56)}function i(t){return t<<1|t>>>31}function s(t){return t<<5|t>>>27}function o(t){return t<<30|t>>>2}function a(t,e,r,n){return 0===t?e&r|~e&n:2===t?e&r|e&n|r&n:e^r^n}var f=t("inherits"),u=t("./hash"),c=[1518500249,1859775393,-1894007588,-899497514],h=new Array(80);f(n,u),n.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},n.prototype._update=function(t){for(var e=this._w,r=0|this._a,n=0|this._b,f=0|this._c,u=0|this._d,h=0|this._e,d=0;d<16;++d)e[d]=t.readInt32BE(4*d);for(;d<80;++d)e[d]=i(e[d-3]^e[d-8]^e[d-14]^e[d-16]);for(var p=0;p<80;++p){var l=~~(p/20),b=s(r)+a(l,n,f,u)+h+e[p]+c[l]|0;h=u,u=f,f=o(n),n=r,r=b}this._a=r+this._a|0,this._b=n+this._b|0,this._c=f+this._c|0,this._d=u+this._d|0,this._e=h+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:297}],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=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,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:297}],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=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},n.prototype._update=function(t){for(var e=this._w,r=0|this._a,n=0|this._b,c=0|this._c,h=0|this._d,p=0|this._e,l=0|this._f,b=0|this._g,g=0|this._h,y=0;y<16;++y)e[y]=t.readInt32BE(4*y);for(;y<64;++y)e[y]=u(e[y-2])+e[y-7]+f(e[y-15])+e[y-16]|0;for(var v=0;v<64;++v){var m=g+a(p)+i(p,l,b)+d[v]+e[v]|0,_=o(r)+s(r,n,c)|0;g=b,b=l,l=p,p=h+m|0,h=c,c=n,n=r,r=m+_|0}this._a=r+this._a|0,this._b=n+this._b|0,this._c=c+this._c|0,this._d=h+this._d|0,this._e=p+this._e|0,this._f=l+this._f|0,this._g=b+this._g|0,this._h=g+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:297}],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._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,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._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e},e.exports=n}).call(this,t("buffer").Buffer)},{"./hash":181,"./sha512":188,buffer:48,inherits:297}],188:[function(t,e,r){(function(r){function n(){this.init(),this._w=g,l.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)}function d(t,e){return t>>>0>>0?1:0}var p=t("inherits"),l=t("./hash"),b=[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],g=new Array(160);p(n,l),n.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},n.prototype._update=function(t){for(var e=this._w,r=0|this._ah,n=0|this._bh,p=0|this._ch,l=0|this._dh,g=0|this._eh,y=0|this._fh,v=0|this._gh,m=0|this._hh,_=0|this._al,w=0|this._bl,S=0|this._cl,I=0|this._dl,k=0|this._el,E=0|this._fl,A=0|this._gl,x=0|this._hl,P=0;P<32;P+=2)e[P]=t.readInt32BE(4*P),e[P+1]=t.readInt32BE(4*P+4);for(;P<160;P+=2){var O=e[P-30],M=e[P-30+1],B=f(O,M),R=u(M,O);O=e[P-4],M=e[P-4+1];var T=c(O,M),C=h(M,O),N=e[P-14],j=e[P-14+1],U=e[P-32],L=e[P-32+1],D=R+j|0,z=B+N+d(D,R)|0;D=D+C|0,z=z+T+d(D,C)|0,D=D+L|0,z=z+U+d(D,L)|0,e[P]=z,e[P+1]=D}for(var F=0;F<160;F+=2){z=e[F],D=e[F+1];var K=s(r,n,p),H=s(_,w,S),q=o(r,_),V=o(_,r),Y=a(g,k),G=a(k,g),W=b[F],X=b[F+1],J=i(g,y,v),Z=i(k,E,A),Q=x+G|0,$=m+Y+d(Q,x)|0;Q=Q+Z|0,$=$+J+d(Q,Z)|0,Q=Q+X|0,$=$+W+d(Q,X)|0,Q=Q+D|0,$=$+z+d(Q,D)|0;var tt=V+H|0,et=q+K+d(tt,V)|0;m=v,x=A,v=y,A=E,y=g,E=k,k=I+Q|0,g=l+$+d(k,I)|0,l=p,I=S,p=n,S=w,n=r,w=_,_=Q+tt|0,r=$+et+d(_,Q)|0}this._al=this._al+_|0,this._bl=this._bl+w|0,this._cl=this._cl+S|0,this._dl=this._dl+I|0,this._el=this._el+k|0,this._fl=this._fl+E|0,this._gl=this._gl+A|0,this._hl=this._hl+x|0,this._ah=this._ah+r+d(this._al,_)|0,this._bh=this._bh+n+d(this._bl,w)|0,this._ch=this._ch+p+d(this._cl,S)|0,this._dh=this._dh+l+d(this._dl,I)|0,this._eh=this._eh+g+d(this._el,k)|0,this._fh=this._fh+y+d(this._fl,E)|0,this._gh=this._gh+v+d(this._gl,A)|0,this._hh=this._hh+m+d(this._hl,x)|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._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e},e.exports=n}).call(this,t("buffer").Buffer)},{"./hash":181,buffer:48,inherits:297}],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.lengtht;)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(v)}else for(;r.mod(u).cmp(y);)r.iadd(v);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),y=(new f(7),new f(11)),v=new f(4),m=(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)},{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;b0;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;lo)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;l<=u;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;g=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)),y=c(b,u(g,o));return new h(r.concat([new r([0]),y,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;s=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);e>0&&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:246,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)||t<0||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;f0&&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(n<0)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){function n(){d&&c&&(d=!1,c.length?h=c.concat(h):p=-1,h.length&&i())}function i(){if(!d){var t=a.call(null,n);d=!0;for(var e=h.length;e;){for(c=h,h=[];++p1)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;i=55296&&e<=56319&&i65535&&(t-=65536,e+=j(t>>>10&1023|55296),t=56320|1023&t),e+=j(t)}).join("")}function u(t){return t-48<10?t-22:t-65<26?t-65:t-97<26?t-97:S}function c(t,e){return t+22+75*(t<26)-((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,y=0,v=P,m=x;for(r=t.lastIndexOf(O),r<0&&(r=0),n=0;n=128&&i("not-basic"),b.push(t.charCodeAt(n));for(s=r>0?r+1:0;s=g&&i("invalid-input"),d=u(t.charCodeAt(s++)),(d>=S||d>N((w-y)/a))&&i("overflow"),y+=d*a,p=c<=m?I:c>=m+k?k:c-m,!(dN(w/l)&&i("overflow"),a*=l;e=b.length+1,m=h(y-o,e,0==o),N(y/e)>w-v&&i("overflow"),v+=N(y/e),y%=e,b.splice(y++,0,v)}return f(b)}function p(t){var e,r,n,s,o,f,u,d,p,l,b,g,y,v,m,_=[];for(t=a(t),g=t.length,e=P,r=0,o=x,f=0;f=e&&bN((w-r)/y)&&i("overflow"),r+=(u-e)*y,e=u,f=0;fw&&i("overflow"),b==e){for(d=r,p=S;l=p<=o?I:p>=o+k?k:p-o,!(d= 0x80 (not a basic code point)","invalid-input":"Invalid input"},C=S-I,N=Math.floor,j=String.fromCharCode;if(m={version:"1.4.1",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 m});else if(g&&y)if(e.exports==g)y.exports=m;else for(_ in m)m.hasOwnProperty(_)&&(g[_]=m[_]);else n.punycode=m}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],248:[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;c=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)}},{}],249:[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 o=new Error("stream.push() after EOF");t.emit("error",o)}else if(e.endEmitted&&i){var f=new Error("stream.unshift() after end event");t.emit("error",f)}else{var u;!e.decoder||i||n||(r=e.decoder.write(r),u=!e.objectMode&&0===r.length),i||(e.reading=!1),u||(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&&d(t))),l(t,e)}else i||(e.reading=!1);return a(e)}function a(t){return!t.ended&&(t.needReadable||t.length=D?t=D:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}function u(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:t<=0?0:(t>e.highWaterMark&&(e.highWaterMark=f(t)),t>e.length?e.ended?e.length:(e.needReadable=!0,0):t)}function c(t,e){var r=null;return B.isBuffer(e)||"string"==typeof e||null===e||void 0===e||t.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r}function h(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,d(t)}}function d(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(N("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?A(p,t):p(t))}function p(t){N("emit readable"),t.emit("readable"),_(t)}function l(t,e){e.readingMore||(e.readingMore=!0,A(b,t,e))}function b(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]:B.concat(n,i),n.length=0;else if(t0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,A(I,e,t))}function I(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function k(t,e){for(var r=0,n=t.length;r0)&&(e.emittedReadable=!1),0===t&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return N("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?S(this):d(this),null;if(t=u(t,e),0===t&&e.ended)return 0===e.length&&S(this),null;var n=e.needReadable;N("need readable",n),(0===e.length||e.length-t0?w(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&&S(this),null!==i&&this.emit("data",i),i},s.prototype._read=function(t){this.emit("error",new Error("not implemented"))},s.prototype.pipe=function(t,e){function i(t){N("onunpipe"),t===d&&o()}function s(){N("onend"),t.end()}function o(){N("cleanup"),t.removeListener("close",u),t.removeListener("finish",c),t.removeListener("drain",y),t.removeListener("error",f),t.removeListener("unpipe",i),d.removeListener("end",s),d.removeListener("end",o),d.removeListener("data",a),v=!0,!p.awaitDrain||t._writableState&&!t._writableState.needDrain||y()}function a(e){N("ondata");var r=t.write(e);!1===r&&((1===p.pipesCount&&p.pipes===t||p.pipesCount>1&&E(p.pipes,t)!==-1)&&!v&&(N("false write response, pause",d._readableState.awaitDrain),d._readableState.awaitDrain++),d.pause())}function f(e){N("onerror",e),h(),t.removeListener("error",f),0===M(t,"error")&&t.emit("error",e)}function u(){t.removeListener("finish",c),h()}function c(){N("onfinish"),t.removeListener("close",u),h()}function h(){N("unpipe"),d.unpipe(t)}var d=this,p=this._readableState;switch(p.pipesCount){case 0:p.pipes=t;break;case 1:p.pipes=[p.pipes,t];break;default:p.pipes.push(t)}p.pipesCount+=1,N("pipe count=%d opts=%j",p.pipesCount,e);var l=(!e||e.end!==!1)&&t!==r.stdout&&t!==r.stderr,b=l?s:o;p.endEmitted?A(b):d.once("end",b),t.on("unpipe",i);var y=g(d);t.on("drain",y);var v=!1;return d.on("data",a),n(t,"error",f),t.once("close",u),t.once("finish",c),t.emit("pipe",d),p.flowing||(N("pipe resume"),d.resume()),t},s.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;i-1?setImmediate:I;o.WritableState=s;var E=t("core-util-is");E.inherits=t("inherits");var A,x={deprecate:t("util-deprecate")};!function(){try{A=t("stream")}catch(e){}finally{A||(A=t("events").EventEmitter)}}();var P=t("buffer").Buffer,O=t("buffer-shims");E.inherits(o,A);var M;s.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(s.prototype,"buffer",{get:x.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")})}catch(t){}}();var M;o.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},o.prototype.write=function(t,e,r){var i=this._writableState,s=!1;return"function"==typeof e&&(r=e,e=null),P.isBuffer(t)?e="buffer":e||(e=i.defaultEncoding),"function"!=typeof r&&(r=n),i.ended?a(this,r):f(this,i,t,r)&&(i.pendingcb++,s=c(this,i,t,e,r)),s},o.prototype.cork=function(){var t=this._writableState;t.corked++},o.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.finished||t.bufferProcessing||!t.bufferedRequest||y(this,t))},o.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},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)}}).call(this,t("_process"))},{"./_stream_duplex":252,_process:246,buffer:48,"buffer-shims":257,"core-util-is":258,events:244,inherits:297,"process-nextick-args":260,"util-deprecate":261}],257:[function(t,e,r){(function(e){"use strict";var n=t("buffer"),i=n.Buffer,s=n.SlowBuffer,o=n.kMaxLength||2147483647;r.alloc=function(t,e,r){if("function"==typeof i.alloc)return i.alloc(t,e,r);if("number"==typeof r)throw new TypeError("encoding must not be number");if("number"!=typeof t)throw new TypeError("size must be a number");if(t>o)throw new RangeError("size is too large");var n=r,s=e;void 0===s&&(n=void 0,s=0);var a=new i(t);if("string"==typeof s)for(var f=new i(s,n),u=f.length,c=-1;++co)throw new RangeError("size is too large");return new i(t)},r.from=function(t,r,n){if("function"==typeof i.from&&(!e.Uint8Array||Uint8Array.from!==i.from))return i.from(t,r,n);if("number"==typeof t)throw new TypeError('"value" argument must not be a number');if("string"==typeof t)return new i(t,r);if("undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer){var s=r;if(1===arguments.length)return new i(t);"undefined"==typeof s&&(s=0);var o=n;if("undefined"==typeof o&&(o=t.byteLength-s),s>=t.byteLength)throw new RangeError("'offset' is out of bounds");if(o>t.byteLength-s)throw new RangeError("'length' is out of bounds");return new i(t.slice(s,s+o))}if(i.isBuffer(t)){var a=new i(t.length);return t.copy(a,0,0,t.length),a}if(t){if(Array.isArray(t)||"undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return new i(t);if("Buffer"===t.type&&Array.isArray(t.data))return new i(t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")},r.allocUnsafeSlow=function(t){if("function"==typeof i.allocUnsafeSlow)return i.allocUnsafeSlow(t);if("number"!=typeof t)throw new TypeError("size must be a number");if(t>=o)throw new RangeError("size is too large");return new s(t)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{buffer:48}],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){arguments[4][51][0].apply(r,arguments)},{dup:51}],260:[function(t,e,r){(function(t){"use strict";function r(e,r,n,i){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var s,o,a=arguments.length;switch(a){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick(function(){e.call(null,r)});case 3:return t.nextTick(function(){e.call(null,r,n)});case 4:return t.nextTick(function(){e.call(null,r,n,i)});default:for(s=new Array(a-1),o=0;o=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&&n<=56319)){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&&n<=56319){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(e<=2&&r>>4==14){this.charLength=3;break}if(e<=3&&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}],268:[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","\t"],g=["{","}","|","\\","^","`"].concat(b),y=["'"].concat(g),v=["%","/","?",";","#"].concat(y),m=["/","?","#"],_=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;u127?"x":P[M];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;u0)&&r.host.split("@");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 y=l.slice(-1)[0],v=(r.host||t.host)&&("."===y||".."===y)||""===y,m=0,_=l.length;_>=0;_--)y=l[_],"."==y?l.splice(_,1):".."===y?(l.splice(_,1),m++):m&&(l.splice(_,1),m--);if(!d&&!p)for(;m--;m)l.unshift("..");!d||""===l[0]||l[0]&&"/"===l[0].charAt(0)||l.unshift(""),v&&"/"!==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("@");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:247,querystring:250}],269:[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}},{}],270:[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 m(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 y="",v=!1,_=["{","}"];if(l(e)&&(v=!0,_=["[","]"]),A(e)){var w=e.name?": "+e.name:"";y=" [Function"+w+"]"}if(S(e)&&(y=" "+RegExp.prototype.toString.call(e)),k(e)&&(y=" "+Date.prototype.toUTCString.call(e)),E(e)&&(y=" "+c(e)),0===o.length&&(!v||0==e.length))return _[0]+y+_[1];if(n<0)return S(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var I;return I=v?h(t,e,n,b,o):o.map(function(r){return d(t,e,n,b,r,v)}),t.seen.pop(),p(I,y,_)}function u(t,e){if(w(e))return t.stylize("undefined","undefined");if(m(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}return v(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;o-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 y(t){return null==t}function v(t){return"number"==typeof t}function m(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 t<10?"0"+t.toString(10):t.toString(10)}function M(){var t=new Date,e=[O(t.getHours()),O(t.getMinutes()),O(t.getSeconds())].join(":");return[t.getDate(),N[t.getMonth()],e].join(" ")}function B(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var R=/%[sdj%]/g;r.format=function(t){if(!m(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];r=49&&o<=54?o-49+10:o>=17&&o<=22?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;o=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 t<0&&(this.sign=!0,t=-t),void(t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),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&&e<=36),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;i<=67108863;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;c1&&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&&t<=36){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);a<=o;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>>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);a<=o;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;o=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<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<=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),t<0)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(a===-1),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 s<0||1===i&&0===s?e.div:e.div.sign?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modn=function(t){r(t<=67108863);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(t<=67108863);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(i<0){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<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},i.prototype.cmpn=function(t){var e=t<0;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:nt.length)return 1;if(this.length=0;r--){var n=this.words[r],i=t.words[r];if(n!==i){ni&&(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 y={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;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 v(t){if(y[t])return y[t];var v;if("k256"===t)v=new f;else if("p224"===t)v=new u;else if("p192"===t)v=new c;else{if("p25519"!==t)throw new Error("Unknown prime "+t);v=new h}return y[t]=v,v},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(g=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)},{}],274:[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}},{}],276:[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":296,"./elliptic/curve":279,"./elliptic/curves":282,"./elliptic/ec":283,"./elliptic/hmac-drbg":286,"./elliptic/utils":288,brorand:289}],277:[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),f<0)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;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],y=f(r[p],r[l]);u=Math.max(y[0].length,u),o[p]=new Array(u),o[l]=new Array(u);for(var v=0;v=0;c--){for(var I=0;c>=0;){for(var k=!0,v=0;v=0&&I++,w=w.dblp(I),c<0)break;for(var v=0;v0?h=s[v][E-1>>1]:E<0&&(h=s[v][-E-1>>1].neg()),w="affine"===h.type?w.mixedAdd(h):w.add(h))}}for(var c=0;c":""},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":276,"../curve":279,"bn.js":273,inherits:297}],279:[function(t,e,r){arguments[4][90][0].apply(r,arguments)},{"./base":277,"./edwards":278,"./mont":280,"./short":281,dup:90}],280:[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":279,"bn.js":273,inherits:297}],281:[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),y=new f(1),v=0;0!==d.cmpn(0);){var m=p.div(d);u=p.sub(m.mul(d)),c=g.sub(m.mul(l));var _=y.sub(m.mul(b));if(!n&&u.cmp(h)<0)e=a.neg(),r=l,n=u.neg(),i=c;else if(n&&2===++v)break;a=u,p=d,d=u,g=l,l=c,y=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;i":""},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;r":""},s.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../../elliptic":276,"../curve":279,"bn.js":273,inherits:297}],282:[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":276,"./precomputed/secp256k1":287,"hash.js":290}],283:[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;f<21;f++)a.unshift(0);for(var c=t.toArray(),f=c.length;f=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()&&0===h.getX().mod(this.n).cmp(s)}},{"../../elliptic":276,"./key":284,"./signature":285,"bn.js":273}],284:[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;i"}},{"../../elliptic":276,"bn.js":273}],285:[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)&&(!(4+n+2+s>t.length)&&(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":276,"bn.js":273}],286:[function(t,e,r){arguments[4][100][0].apply(r,arguments)},{"../elliptic":276,dup:100,"hash.js":290}],287:[function(t,e,r){arguments[4][101][0].apply(r,arguments)},{dup:101}],288:[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;f0||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},{}],289:[function(t,e,r){arguments[4][103][0].apply(r,arguments)},{dup:103}],290:[function(t,e,r){arguments[4][104][0].apply(r,arguments)},{"./hash/common":291,"./hash/hmac":292,"./hash/ripemd":293,"./hash/sha":294,"./hash/utils":295,dup:104}],291:[function(t,e,r){arguments[4][105][0].apply(r,arguments)},{"../hash":290,dup:105}],292:[function(t,e,r){arguments[4][106][0].apply(r,arguments)},{"../hash":290,dup:106}],293:[function(t,e,r){arguments[4][107][0].apply(r,arguments)},{"../hash":290,dup:107}],294:[function(t,e,r){arguments[4][108][0].apply(r,arguments)},{"../hash":290,dup:108}],295:[function(t,e,r){arguments[4][109][0].apply(r,arguments)},{dup:109,inherits:297}],296:[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"}},{}],297:[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}},{}],298:[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(t-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=9&&t<=13||32==t||160==t||5760==t||6158==t||t>=8192&&(t<=8202||8232==t||8233==t||8239==t||8287==t||12288==t||65279==t)}function m(t,e){for(var r=-1,n=t.length,i=-1,s=[];++r=z?lr(e):null,u=e.length;f&&(o=Zt,a=!1,e=f);t:for(;++ii?0:i+r),n=n===E||n>i?i:+n||0,n<0&&(n+=i),i=r>n?0:n>>>0,r>>>=0;ri?0:i+e),r=r===E||r>i?i:+r||0,r<0&&(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>>1,o=t[s];(r?o<=e: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=i<3?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;++i=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&&t-1&&t%1==0&&t<=Ro}function rn(t){return t===t&&!Ci(t)}function nn(t,e){var r=t[1],n=e[1],i=r|n,s=i-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);++i-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(e<0?0:+e||0,n);++i0&&(r=e.apply(this,arguments)),t<=1&&(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);t<=0||t>e?i(l,u):p=ho(s,t)}function o(){i(y,p)}function a(){if(f=arguments,h=ba(),d=this,l=y&&(p||!v),g===!1)var r=v&&!p;else{u||v||(b=h);var n=g-(h-b),i=n<=0||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,y=!0;if("function"!=typeof t)throw new Xs(H);if(e=e<0?0:+e||0,r===!0){var v=!0;y=!1}else Ci(r)&&(v=!!r.leading,g="maxWait"in r&&So(+r.maxWait||0,e),y="trailing"in r?!!r.trailing:y);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 yi(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 y(t)&&Jr(t)&&to.call(t,"callee")&&!uo.call(t,"callee")}function Ai(t){return t===!0||t===!1||y(t)&&ro.call(t)==G}function xi(t){return y(t)&&ro.call(t)==W}function Pi(t){return!!t&&1===t.nodeType&&y(t)&&!zi(t)}function Oi(t){return null==t||(Jr(t)&&(Oa(t)||Ki(t)||Ei(t)||y(t)&&Ti(t.splice))?!t.length:!za(t).length)}function Mi(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 Bi(t){return y(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&&(Ti(t)?io.test($s.call(t)):y(t)&&Ct.test(t))}function Li(t){return null===t}function Di(t){return"number"==typeof t||y(t)&&ro.call(t)==Q}function zi(t){var e;if(!y(t)||ro.call(t)!=$||Ei(t)||!to.call(t,"constructor")&&(e=t.constructor,"function"==typeof e&&!(e instanceof e)))return!1;var r;return Me(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||y(t)&&ro.call(t)==rt}function Hi(t){return y(t)&&en(t.length)&&!!Kt[ro.call(t)]}function qi(t){return t===E}function Vi(t,e){return t0;++n=Io(e,r)&&t=0&&t.indexOf(e,r)==r}function ds(t){return t=a(t),t&&_t.test(t)?t.replace(vt,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=vo(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=ms(t),Eo(t,e||(Tt.test(t)?16:10))}function gs(t,e){var r="";if(t=a(t),e=+e,e<1||!t||!_o(e))return r;do e%2&&(r+=t),e=vo(e/2),t+=t;while(e);return r}function ys(t,e,r){return t=a(t),r=null==r?0:Io(r<0?0:+r||0,t.length),t.lastIndexOf(e,r)==r}function vs(t,r,n){var i=e.templateSettings;n&&Qr(t,r,n)&&(r=n=E),t=a(t),r=ge(ye({},n||r),i,be);var s,o,f=ge(ye({},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?Bt: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 y=r.variable;y||(p="with (obj) {\n"+p+"\n}\n"),p=(o?p.replace(lt,""):p).replace(bt,"$1").replace(gt,"$1;"),p="function("+(y||"obj")+") {\n"+(y?"":"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 v=Za(function(){return Hs(u,g+"return "+p).apply(E,c)});if(v.source=p,Bi(v))throw v;return v}function ms(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(o<1)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&&mt.test(t)?t.replace(yt,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),y(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 Ms(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(;++a>>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(Be),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=yi(function(t,e){return y(t)&&Jr(t)?Ie(t,Oe(e,!1,!0)):[]}),Vo=wr(),Yo=wr(!0),Go=yi(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=yi(function(t){return t=Oe(t),this.thru(function(e){return $t(Oa(e)?e:[hn(e)],t)})}),ra=yi(function(t,e){return ve(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=yi(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=Mr(ce,jo),pa=Mr(he,Uo),la=yi(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=yi(function(t,e,r){var n=x;if(r.length){var i=m(r,ga.placeholder);n|=R}return jr(t,n,e,r,i)}),ya=yi(function(t,e){e=e.length?Oe(e):Ji(t);for(var r=-1,n=e.length;++r0||e<0)?new Z(r):(t<0?r=r.takeRight(-t):t&&(r=r.drop(t)),e!==E&&(e=+e||0,r=e<0?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)},Be(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 v(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)})}}),Be(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[Br(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,M=8,B=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,yt=/&(?:amp|lt|gt|quot|#39|#96);/g,vt=/[&<>"'`]/g,mt=RegExp(yt.source),_t=RegExp(vt.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,Mt=/\\(\\)?/g,Bt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/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:{})},{}],299:[function(t,e,r){e.exports={name:"bitcore-lib",version:"0.13.18",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"},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":299,"bn.js":273,bs58:274,buffer:48,elliptic:276,lodash:298}]},{},[]);