You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

351 lines
376 KiB

require=
// modules are defined as an array
// [ module function, map of requireuires ]
//
// map of requireuires is short require name -> numeric require
//
// anything defined in a previous bundle is accessed via the
// orig method which is the requireuire for previous bundles
(function outer (modules, cache, entry) {
// Save the require from previous bundle to this closure if any
var previousRequire = typeof require == "function" && require;
function newRequire(name, jumped, inSkipCache){
var m, skipCache = inSkipCache;
if (typeof name === 'string') {
if (name.charAt(0) === '!' ) {
name = name.substr(1);
skipCache=true;
}
}
if(skipCache || !cache[name]) {
if(!modules[name]) {
// if we cannot find the the module within our internal map or
// cache jump to the current global require ie. the last bundle
// that was added to the page.
var currentRequire = typeof require == "function" && require;
if (!jumped && currentRequire) return currentRequire(name, true);
// If there are other bundles on this page the require from the
// previous one is saved to 'previousRequire'. Repeat this as
// many times as there are bundles until the module is found or
// we exhaust the require chain.
if (previousRequire) return previousRequire(name, true);
throw new Error('Cannot find module \'' + name + '\'');
}
m = {exports:{}};
var nextSkipCache = inSkipCache ? false : skipCache;
if (!skipCache) cache[name] = m;
skipCache = false;
modules[name][0].call(m.exports, function(x){
var id = modules[name][1][x];
return newRequire(id ? id : x, false, nextSkipCache);
},m,m.exports,outer,modules,cache,entry);
}
return m ? m.exports:cache[name].exports;
}
for(var i=0;i<entry.length;i++) newRequire(entry[i]);
// Override the current require with this new one
return newRequire;
})
({"tmvhGl":[function(require,module,exports){
(function(e){var i=function(e,i){Object.defineProperty(module.exports,e,{get:function(){return require(i)}})};i("Bignum","bignum"),Object.defineProperty(module.exports,"bignum",{get:function(){return console.log('bignum (with a lower-case "b") is deprecated. Use bitcore.Bignum (capital "B") instead.'),require("bignum")}}),i("Base58","./lib/Base58"),Object.defineProperty(module.exports,"base58",{get:function(){return console.log('base58 (with a lower-case "b") is deprecated. Use bitcore.Base58 (capital "B") instead.'),require("./lib/Base58")}}),i("bufferput","bufferput"),i("buffertools","buffertools"),i("Buffers.monkey","./patches/Buffers.monkey"),i("config","./config"),i("const","./const"),i("Curve","./lib/Curve"),i("Deserialize","./lib/Deserialize"),i("ECIES","./lib/ECIES"),i("log","./util/log"),i("networks","./networks"),i("SecureRandom","./lib/SecureRandom"),i("sjcl","./lib/sjcl"),i("util","./util/util"),i("EncodedData","./util/EncodedData"),i("VersionedData","./util/VersionedData"),i("BinaryParser","./util/BinaryParser"),i("Address","./lib/Address"),i("HierarchicalKey","./lib/HierarchicalKey"),Object.defineProperty(module.exports,"BIP32",{get:function(){return console.log("BIP32 is deprecated. Use bitcore.HierarchicalKey instead."),require("./lib/HierarchicalKey")}}),i("BIP39","./lib/BIP39"),i("BIP39WordlistEn","./lib/BIP39WordlistEn"),i("Point","./lib/Point"),i("Opcode","./lib/Opcode"),i("Script","./lib/Script"),i("Transaction","./lib/Transaction"),i("TransactionBuilder","./lib/TransactionBuilder"),i("Connection","./lib/Connection"),i("PayPro","./lib/PayPro"),i("Peer","./lib/Peer"),i("Block","./lib/Block"),i("ScriptInterpreter","./lib/ScriptInterpreter"),i("Bloom","./lib/Bloom"),i("Key","./lib/Key"),Object.defineProperty(module.exports,"KeyModule",{get:function(){return console.log("KeyModule is deprecated."),require("bindings")("KeyModule")}}),i("SINKey","./lib/SINKey"),i("SIN","./lib/SIN"),i("PrivateKey","./lib/PrivateKey"),i("RpcClient","./lib/RpcClient"),i("Wallet","./lib/Wallet"),i("WalletKey","./lib/WalletKey"),i("PeerManager","./lib/PeerManager"),i("Message","./lib/Message"),i("Electrum","./lib/Electrum"),i("Armory","./lib/Armory"),module.exports.Buffer=e}).call(this,require("buffer").Buffer);
},{"./lib/Base58":"6VqyzY","./lib/HierarchicalKey":"x1O6JW","bignum":58,"bindings":78,"buffer":85}],"bitcore":[function(require,module,exports){
module.exports=require('tmvhGl');
},{}],3:[function(require,module,exports){
function BigInteger(t,e,r){null!=t&&("number"==typeof t?this.fromNumber(t,e,r):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}function nbi(){return new BigInteger(null)}function am1(t,e,r,i,n,o){for(;--o>=0;){var s=e*this[t++]+r[i]+n;n=Math.floor(s/67108864),r[i++]=67108863&s}return n}function am2(t,e,r,i,n,o){for(var s=32767&e,u=e>>15;--o>=0;){var p=32767&this[t],h=this[t++]>>15,a=u*p+h*s;p=s*p+((32767&a)<<15)+r[i]+(1073741823&n),n=(p>>>30)+(a>>>15)+u*h+(n>>>30),r[i++]=1073741823&p}return n}function am3(t,e,r,i,n,o){for(var s=16383&e,u=e>>14;--o>=0;){var p=16383&this[t],h=this[t++]>>14,a=u*p+h*s;p=s*p+((16383&a)<<14)+r[i]+n,n=(p>>28)+(a>>14)+u*h,r[i++]=268435455&p}return n}function int2char(t){return BI_RM.charAt(t)}function intAt(t,e){var r=BI_RC[t.charCodeAt(e)];return null==r?-1:r}function bnpCopyTo(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s}function bnpFromInt(t){this.t=1,this.s=0>t?-1:0,t>0?this[0]=t:-1>t?this[0]=t+DV:this.t=0}function nbv(t){var e=nbi();return e.fromInt(t),e}function bnpFromString(t,e){var r;if(16==e)r=4;else if(8==e)r=3;else if(256==e)r=8;else if(2==e)r=1;else if(32==e)r=5;else{if(4!=e)return void this.fromRadix(t,e);r=2}this.t=0,this.s=0;for(var i=t.length,n=!1,o=0;--i>=0;){var s=8==r?255&t[i]:intAt(t,i);0>s?"-"==t.charAt(i)&&(n=!0):(n=!1,0==o?this[this.t++]=s:o+r>this.DB?(this[this.t-1]|=(s&(1<<this.DB-o)-1)<<o,this[this.t++]=s>>this.DB-o):this[this.t-1]|=s<<o,o+=r,o>=this.DB&&(o-=this.DB))}8==r&&0!=(128&t[0])&&(this.s=-1,o>0&&(this[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),n&&BigInteger.ZERO.subTo(this,this)}function bnpClamp(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t}function bnToString(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var r,i=(1<<e)-1,n=!1,o="",s=this.t,u=this.DB-s*this.DB%e;if(s-->0)for(u<this.DB&&(r=this[s]>>u)>0&&(n=!0,o=int2char(r));s>=0;)e>u?(r=(this[s]&(1<<u)-1)<<e-u,r|=this[--s]>>(u+=this.DB-e)):(r=this[s]>>(u-=e)&i,0>=u&&(u+=this.DB,--s)),r>0&&(n=!0),n&&(o+=int2char(r));return n?o:"0"}function bnNegate(){var t=nbi();return BigInteger.ZERO.subTo(this,t),t}function bnAbs(){return this.s<0?this.negate():this}function bnCompareTo(t){var e=this.s-t.s;if(0!=e)return e;var r=this.t;if(e=r-t.t,0!=e)return this.s<0?-e:e;for(;--r>=0;)if(0!=(e=this[r]-t[r]))return e;return 0}function nbits(t){var e,r=1;return 0!=(e=t>>>16)&&(t=e,r+=16),0!=(e=t>>8)&&(t=e,r+=8),0!=(e=t>>4)&&(t=e,r+=4),0!=(e=t>>2)&&(t=e,r+=2),0!=(e=t>>1)&&(t=e,r+=1),r}function bnBitLength(){return this.t<=0?0:this.DB*(this.t-1)+nbits(this[this.t-1]^this.s&this.DM)}function bnpDLShiftTo(t,e){var r;for(r=this.t-1;r>=0;--r)e[r+t]=this[r];for(r=t-1;r>=0;--r)e[r]=0;e.t=this.t+t,e.s=this.s}function bnpDRShiftTo(t,e){for(var r=t;r<this.t;++r)e[r-t]=this[r];e.t=Math.max(this.t-t,0),e.s=this.s}function bnpLShiftTo(t,e){var r,i=t%this.DB,n=this.DB-i,o=(1<<n)-1,s=Math.floor(t/this.DB),u=this.s<<i&this.DM;for(r=this.t-1;r>=0;--r)e[r+s+1]=this[r]>>n|u,u=(this[r]&o)<<i;for(r=s-1;r>=0;--r)e[r]=0;e[s]=u,e.t=this.t+s+1,e.s=this.s,e.clamp()}function bnpRShiftTo(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t)return void(e.t=0);var i=t%this.DB,n=this.DB-i,o=(1<<i)-1;e[0]=this[r]>>i;for(var s=r+1;s<this.t;++s)e[s-r-1]|=(this[s]&o)<<n,e[s-r]=this[s]>>i;i>0&&(e[this.t-r-1]|=(this.s&o)<<n),e.t=this.t-r,e.clamp()}function bnpSubTo(t,e){for(var r=0,i=0,n=Math.min(t.t,this.t);n>r;)i+=this[r]-t[r],e[r++]=i&this.DM,i>>=this.DB;if(t.t<this.t){for(i-=t.s;r<this.t;)i+=this[r],e[r++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;r<t.t;)i-=t[r],e[r++]=i&this.DM,i>>=this.DB;i-=t.s}e.s=0>i?-1:0,-1>i?e[r++]=this.DV+i:i>0&&(e[r++]=i),e.t=r,e.clamp()}function bnpMultiplyTo(t,e){var r=this.abs(),i=t.abs(),n=r.t;for(e.t=n+i.t;--n>=0;)e[n]=0;for(n=0;n<i.t;++n)e[n+r.t]=r.am(0,i[n],e,n,0,r.t);e.s=0,e.clamp(),this.s!=t.s&&BigInteger.ZERO.subTo(e,e)}function bnpSquareTo(t){for(var e=this.abs(),r=t.t=2*e.t;--r>=0;)t[r]=0;for(r=0;r<e.t-1;++r){var i=e.am(r,e[r],t,2*r,0,1);(t[r+e.t]+=e.am(r+1,2*e[r],t,2*r+1,i,e.t-r-1))>=e.DV&&(t[r+e.t]-=e.DV,t[r+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(r,e[r],t,2*r,0,1)),t.s=0,t.clamp()}function bnpDivRemTo(t,e,r){var i=t.abs();if(!(i.t<=0)){var n=this.abs();if(n.t<i.t)return null!=e&&e.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=nbi());var o=nbi(),s=this.s,u=t.s,p=this.DB-nbits(i[i.t-1]);p>0?(i.lShiftTo(p,o),n.lShiftTo(p,r)):(i.copyTo(o),n.copyTo(r));var h=o.t,a=o[h-1];if(0!=a){var F=a*(1<<this.F1)+(h>1?o[h-2]>>this.F2:0),g=this.FV/F,f=(1<<this.F1)/F,c=1<<this.F2,l=r.t,B=l-h,m=null==e?nbi():e;for(o.dlShiftTo(B,m),r.compareTo(m)>=0&&(r[r.t++]=1,r.subTo(m,r)),BigInteger.ONE.dlShiftTo(h,m),m.subTo(o,o);o.t<h;)o[o.t++]=0;for(;--B>=0;){var y=r[--l]==a?this.DM:Math.floor(r[l]*g+(r[l-1]+c)*f);if((r[l]+=o.am(0,y,r,B,0,h))<y)for(o.dlShiftTo(B,m),r.subTo(m,r);r[l]<--y;)r.subTo(m,r)}null!=e&&(r.drShiftTo(h,e),s!=u&&BigInteger.ZERO.subTo(e,e)),r.t=h,r.clamp(),p>0&&r.rShiftTo(p,r),0>s&&BigInteger.ZERO.subTo(r,r)}}}function bnMod(t){var e=nbi();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(BigInteger.ZERO)>0&&t.subTo(e,e),e}function Classic(t){this.m=t}function cConvert(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}function cRevert(t){return t}function cReduce(t){t.divRemTo(this.m,null,t)}function cMulTo(t,e,r){t.multiplyTo(e,r),this.reduce(r)}function cSqrTo(t,e){t.squareTo(e),this.reduce(e)}function bnpInvDigit(){if(this.t<1)return 0;var t=this[0];if(0==(1&t))return 0;var e=3&t;return e=e*(2-(15&t)*e)&15,e=e*(2-(255&t)*e)&255,e=e*(2-((65535&t)*e&65535))&65535,e=e*(2-t*e%this.DV)%this.DV,e>0?this.DV-e:-e}function Montgomery(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function montConvert(t){var e=nbi();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(BigInteger.ZERO)>0&&this.m.subTo(e,e),e}function montRevert(t){var e=nbi();return t.copyTo(e),this.reduce(e),e}function montReduce(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var r=32767&t[e],i=r*this.mpl+((r*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(r=e+this.m.t,t[r]+=this.m.am(0,i,t,e,0,this.m.t);t[r]>=t.DV;)t[r]-=t.DV,t[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)}function montSqrTo(t,e){t.squareTo(e),this.reduce(e)}function montMulTo(t,e,r){t.multiplyTo(e,r),this.reduce(r)}function bnpIsEven(){return 0==(this.t>0?1&this[0]:this.s)}function bnpExp(t,e){if(t>4294967295||1>t)return BigInteger.ONE;var r=nbi(),i=nbi(),n=e.convert(this),o=nbits(t)-1;for(n.copyTo(r);--o>=0;)if(e.sqrTo(r,i),(t&1<<o)>0)e.mulTo(i,n,r);else{var s=r;r=i,i=s}return e.revert(r)}function bnModPowInt(t,e){var r;return r=256>t||e.isEven()?new Classic(e):new Montgomery(e),this.exp(t,r)}function bnClone(){var t=nbi();return this.copyTo(t),t}function bnIntValue(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function bnByteValue(){return 0==this.t?this.s:this[0]<<24>>24}function bnShortValue(){return 0==this.t?this.s:this[0]<<16>>16}function bnpChunkSize(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}function bnSigNum(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1}function bnpToRadix(t){if(null==t&&(t=10),0==this.signum()||2>t||t>36)return"0";var e=this.chunkSize(t),r=Math.pow(t,e),i=nbv(r),n=nbi(),o=nbi(),s="";for(this.divRemTo(i,n,o);n.signum()>0;)s=(r+o.intValue()).toString(t).substr(1)+s,n.divRemTo(i,n,o);return o.intValue().toString(t)+s}function bnpFromRadix(t,e){this.fromInt(0),null==e&&(e=10);for(var r=this.chunkSize(e),i=Math.pow(e,r),n=!1,o=0,s=0,u=0;u<t.length;++u){var p=intAt(t,u);0>p?"-"==t.charAt(u)&&0==this.signum()&&(n=!0):(s=e*s+p,++o>=r&&(this.dMultiply(i),this.dAddOffset(s,0),o=0,s=0))}o>0&&(this.dMultiply(Math.pow(e,o)),this.dAddOffset(s,0)),n&&BigInteger.ZERO.subTo(this,this)}function bnpFromNumber(t,e,r){if("number"==typeof e)if(2>t)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(BigInteger.ONE.shiftLeft(t-1),op_or,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(BigInteger.ONE.shiftLeft(t-1),this);else{var i=new Array,n=7&t;i.length=(t>>3)+1,e.nextBytes(i),n>0?i[0]&=(1<<n)-1:i[0]=0,this.fromString(i,256)}}function bnToByteArray(){var t=this.t,e=new Array;e[0]=this.s;var r,i=this.DB-t*this.DB%8,n=0;if(t-->0)for(i<this.DB&&(r=this[t]>>i)!=(this.s&this.DM)>>i&&(e[n++]=r|this.s<<this.DB-i);t>=0;)8>i?(r=(this[t]&(1<<i)-1)<<8-i,r|=this[--t]>>(i+=this.DB-8)):(r=this[t]>>(i-=8)&255,0>=i&&(i+=this.DB,--t)),0!=(128&r)&&(r|=-256),0==n&&(128&this.s)!=(128&r)&&++n,(n>0||r!=this.s)&&(e[n++]=r);return e}function bnEquals(t){return 0==this.compareTo(t)}function bnMin(t){return this.compareTo(t)<0?this:t}function bnMax(t){return this.compareTo(t)>0?this:t}function bnpBitwiseTo(t,e,r){var i,n,o=Math.min(t.t,this.t);for(i=0;o>i;++i)r[i]=e(this[i],t[i]);if(t.t<this.t){for(n=t.s&this.DM,i=o;i<this.t;++i)r[i]=e(this[i],n);r.t=this.t}else{for(n=this.s&this.DM,i=o;i<t.t;++i)r[i]=e(n,t[i]);r.t=t.t}r.s=e(this.s,t.s),r.clamp()}function op_and(t,e){return t&e}function bnAnd(t){var e=nbi();return this.bitwiseTo(t,op_and,e),e}function op_or(t,e){return t|e}function bnOr(t){var e=nbi();return this.bitwiseTo(t,op_or,e),e}function op_xor(t,e){return t^e}function bnXor(t){var e=nbi();return this.bitwiseTo(t,op_xor,e),e}function op_andnot(t,e){return t&~e}function bnAndNot(t){var e=nbi();return this.bitwiseTo(t,op_andnot,e),e}function bnNot(){for(var t=nbi(),e=0;e<this.t;++e)t[e]=this.DM&~this[e];return t.t=this.t,t.s=~this.s,t}function bnShiftLeft(t){var e=nbi();return 0>t?this.rShiftTo(-t,e):this.lShiftTo(t,e),e}function bnShiftRight(t){var e=nbi();return 0>t?this.lShiftTo(-t,e):this.rShiftTo(t,e),e}function lbit(t){if(0==t)return-1;var e=0;return 0==(65535&t)&&(t>>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e}function bnGetLowestSetBit(){for(var t=0;t<this.t;++t)if(0!=this[t])return t*this.DB+lbit(this[t]);return this.s<0?this.t*this.DB:-1}function cbit(t){for(var e=0;0!=t;)t&=t-1,++e;return e}function bnBitCount(){for(var t=0,e=this.s&this.DM,r=0;r<this.t;++r)t+=cbit(this[r]^e);return t}function bnTestBit(t){var e=Math.floor(t/this.DB);return e>=this.t?0!=this.s:0!=(this[e]&1<<t%this.DB)}function bnpChangeBit(t,e){var r=BigInteger.ONE.shiftLeft(t);return this.bitwiseTo(r,e,r),r}function bnSetBit(t){return this.changeBit(t,op_or)}function bnClearBit(t){return this.changeBit(t,op_andnot)}function bnFlipBit(t){return this.changeBit(t,op_xor)}function bnpAddTo(t,e){for(var r=0,i=0,n=Math.min(t.t,this.t);n>r;)i+=this[r]+t[r],e[r++]=i&this.DM,i>>=this.DB;if(t.t<this.t){for(i+=t.s;r<this.t;)i+=this[r],e[r++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;r<t.t;)i+=t[r],e[r++]=i&this.DM,i>>=this.DB;i+=t.s}e.s=0>i?-1:0,i>0?e[r++]=i:-1>i&&(e[r++]=this.DV+i),e.t=r,e.clamp()}function bnAdd(t){var e=nbi();return this.addTo(t,e),e}function bnSubtract(t){var e=nbi();return this.subTo(t,e),e}function bnMultiply(t){var e=nbi();return this.multiplyTo(t,e),e}function bnSquare(){var t=nbi();return this.squareTo(t),t}function bnDivide(t){var e=nbi();return this.divRemTo(t,e,null),e}function bnRemainder(t){var e=nbi();return this.divRemTo(t,null,e),e}function bnDivideAndRemainder(t){var e=nbi(),r=nbi();return this.divRemTo(t,e,r),new Array(e,r)}function bnpDMultiply(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}function bnpDAddOffset(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}}function NullExp(){}function nNop(t){return t}function nMulTo(t,e,r){t.multiplyTo(e,r)}function nSqrTo(t,e){t.squareTo(e)}function bnPow(t){return this.exp(t,new NullExp)}function bnpMultiplyLowerTo(t,e,r){var i=Math.min(this.t+t.t,e);for(r.s=0,r.t=i;i>0;)r[--i]=0;var n;for(n=r.t-this.t;n>i;++i)r[i+this.t]=this.am(0,t[i],r,i,0,this.t);for(n=Math.min(t.t,e);n>i;++i)this.am(0,t[i],r,i,0,e-i);r.clamp()}function bnpMultiplyUpperTo(t,e,r){--e;var i=r.t=this.t+t.t-e;for(r.s=0;--i>=0;)r[i]=0;for(i=Math.max(e-this.t,0);i<t.t;++i)r[this.t+i-e]=this.am(e-i,t[i],r,0,0,this.t+i-e);r.clamp(),r.drShiftTo(1,r)}function Barrett(t){this.r2=nbi(),this.q3=nbi(),BigInteger.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}function barrettConvert(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=nbi();return t.copyTo(e),this.reduce(e),e}function barrettRevert(t){return t}function barrettReduce(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)}function barrettSqrTo(t,e){t.squareTo(e),this.reduce(e)}function barrettMulTo(t,e,r){t.multiplyTo(e,r),this.reduce(r)}function bnModPow(t,e){var r,i,n=t.bitLength(),o=nbv(1);if(0>=n)return o;r=18>n?1:48>n?3:144>n?4:768>n?5:6,i=8>n?new Classic(e):e.isEven()?new Barrett(e):new Montgomery(e);var s=new Array,u=3,p=r-1,h=(1<<r)-1;if(s[1]=i.convert(this),r>1){var a=nbi();for(i.sqrTo(s[1],a);h>=u;)s[u]=nbi(),i.mulTo(a,s[u-2],s[u]),u+=2}var F,g,f=t.t-1,c=!0,l=nbi();for(n=nbits(t[f])-1;f>=0;){for(n>=p?F=t[f]>>n-p&h:(F=(t[f]&(1<<n+1)-1)<<p-n,f>0&&(F|=t[f-1]>>this.DB+n-p)),u=r;0==(1&F);)F>>=1,--u;if((n-=u)<0&&(n+=this.DB,--f),c)s[F].copyTo(o),c=!1;else{for(;u>1;)i.sqrTo(o,l),i.sqrTo(l,o),u-=2;u>0?i.sqrTo(o,l):(g=o,o=l,l=g),i.mulTo(l,s[F],o)}for(;f>=0&&0==(t[f]&1<<n);)i.sqrTo(o,l),g=o,o=l,l=g,--n<0&&(n=this.DB-1,--f)}return i.revert(o)}function bnGCD(t){var e=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(e.compareTo(r)<0){var i=e;e=r,r=i}var n=e.getLowestSetBit(),o=r.getLowestSetBit();if(0>o)return e;for(o>n&&(o=n),o>0&&(e.rShiftTo(o,e),r.rShiftTo(o,r));e.signum()>0;)(n=e.getLowestSetBit())>0&&e.rShiftTo(n,e),(n=r.getLowestSetBit())>0&&r.rShiftTo(n,r),e.compareTo(r)>=0?(e.subTo(r,e),e.rShiftTo(1,e)):(r.subTo(e,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r}function bnpModInt(t){if(0>=t)return 0;var e=this.DV%t,r=this.s<0?t-1:0;if(this.t>0)if(0==e)r=this[0]%t;else for(var i=this.t-1;i>=0;--i)r=(e*r+this[i])%t;return r}function bnModInverse(t){var e=t.isEven();if(this.isEven()&&e||0==t.signum())return BigInteger.ZERO;for(var r=t.clone(),i=this.clone(),n=nbv(1),o=nbv(0),s=nbv(0),u=nbv(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),e?(n.isEven()&&o.isEven()||(n.addTo(this,n),o.subTo(t,o)),n.rShiftTo(1,n)):o.isEven()||o.subTo(t,o),o.rShiftTo(1,o);for(;i.isEven();)i.rShiftTo(1,i),e?(s.isEven()&&u.isEven()||(s.addTo(this,s),u.subTo(t,u)),s.rShiftTo(1,s)):u.isEven()||u.subTo(t,u),u.rShiftTo(1,u);r.compareTo(i)>=0?(r.subTo(i,r),e&&n.subTo(s,n),o.subTo(u,o)):(i.subTo(r,i),e&&s.subTo(n,s),u.subTo(o,u))}return 0!=i.compareTo(BigInteger.ONE)?BigInteger.ZERO:u.compareTo(t)>=0?u.subtract(t):u.signum()<0?(u.addTo(t,u),u.signum()<0?u.add(t):u):u}function bnIsProbablePrime(t){var e,r=this.abs();if(1==r.t&&r[0]<=lowprimes[lowprimes.length-1]){for(e=0;e<lowprimes.length;++e)if(r[0]==lowprimes[e])return!0;return!1}if(r.isEven())return!1;for(e=1;e<lowprimes.length;){for(var i=lowprimes[e],n=e+1;n<lowprimes.length&&lplim>i;)i*=lowprimes[n++];for(i=r.modInt(i);n>e;)if(i%lowprimes[e++]==0)return!1}return r.millerRabin(t)}function bnpMillerRabin(t){var e=this.subtract(BigInteger.ONE),r=e.getLowestSetBit();if(0>=r)return!1;var i=e.shiftRight(r);t=t+1>>1,t>lowprimes.length&&(t=lowprimes.length);for(var n=nbi(),o=0;t>o;++o){n.fromInt(lowprimes[Math.floor(Math.random()*lowprimes.length)]);var s=n.modPow(i,this);if(0!=s.compareTo(BigInteger.ONE)&&0!=s.compareTo(e)){for(var u=1;u++<r&&0!=s.compareTo(e);)if(s=s.modPowInt(2,this),0==s.compareTo(BigInteger.ONE))return!1;if(0!=s.compareTo(e))return!1}}return!0}function Arcfour(){this.i=0,this.j=0,this.S=new Array}function ARC4init(t){var e,r,i;for(e=0;256>e;++e)this.S[e]=e;for(r=0,e=0;256>e;++e)r=r+this.S[e]+t[e%t.length]&255,i=this.S[e],this.S[e]=this.S[r],this.S[r]=i;this.i=0,this.j=0}function ARC4next(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]}function prng_newstate(){return new Arcfour}function rng_seed_int(t){rng_pool[rng_pptr++]^=255&t,rng_pool[rng_pptr++]^=t>>8&255,rng_pool[rng_pptr++]^=t>>16&255,rng_pool[rng_pptr++]^=t>>24&255,rng_pptr>=rng_psize&&(rng_pptr-=rng_psize)}function rng_seed_time(){rng_seed_int((new Date).getTime())}function rng_get_byte(){if(null==rng_state){for(rng_seed_time(),rng_state=prng_newstate(),rng_state.init(rng_pool),rng_pptr=0;rng_pptr<rng_pool.length;++rng_pptr)rng_pool[rng_pptr]=0;rng_pptr=0}return rng_state.next()}function rng_get_bytes(t){var e;for(e=0;e<t.length;++e)t[e]=rng_get_byte()}function SecureRandom(){}function ECFieldElementFp(t,e){this.x=e,this.q=t}function feFpEquals(t){return t==this?!0:this.q.equals(t.q)&&this.x.equals(t.x)}function feFpToBigInteger(){return this.x}function feFpNegate(){return new ECFieldElementFp(this.q,this.x.negate().mod(this.q))}function feFpAdd(t){return new ECFieldElementFp(this.q,this.x.add(t.toBigInteger()).mod(this.q))}function feFpSubtract(t){return new ECFieldElementFp(this.q,this.x.subtract(t.toBigInteger()).mod(this.q))}function feFpMultiply(t){return new ECFieldElementFp(this.q,this.x.multiply(t.toBigInteger()).mod(this.q))}function feFpSquare(){return new ECFieldElementFp(this.q,this.x.square().mod(this.q))}function feFpDivide(t){return new ECFieldElementFp(this.q,this.x.multiply(t.toBigInteger().modInverse(this.q)).mod(this.q))}function ECPointFp(t,e,r,i){this.curve=t,this.x=e,this.y=r,this.z=null==i?BigInteger.ONE:i,this.zinv=null}function pointFpGetX(){return null==this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))}function pointFpGetY(){return null==this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))}function pointFpEquals(t){if(t==this)return!0;if(this.isInfinity())return t.isInfinity();if(t.isInfinity())return this.isInfinity();var e,r;return e=t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q),e.equals(BigInteger.ZERO)?(r=t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q),r.equals(BigInteger.ZERO)):!1}function pointFpIsInfinity(){return null==this.x&&null==this.y?!0:this.z.equals(BigInteger.ZERO)&&!this.y.toBigInteger().equals(BigInteger.ZERO)}function pointFpNegate(){return new ECPointFp(this.curve,this.x,this.y.negate(),this.z)}function pointFpAdd(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q),r=t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q);if(BigInteger.ZERO.equals(r))return BigInteger.ZERO.equals(e)?this.twice():this.curve.getInfinity();var i=new BigInteger("3"),n=this.x.toBigInteger(),o=this.y.toBigInteger(),s=(t.x.toBigInteger(),t.y.toBigInteger(),r.square()),u=s.multiply(r),p=n.multiply(s),h=e.square().multiply(this.z),a=h.subtract(p.shiftLeft(1)).multiply(t.z).subtract(u).multiply(r).mod(this.curve.q),F=p.multiply(i).multiply(e).subtract(o.multiply(u)).subtract(h.multiply(e)).multiply(t.z).add(e.multiply(u)).mod(this.curve.q),g=u.multiply(this.z).multiply(t.z).mod(this.curve.q);return new ECPointFp(this.curve,this.curve.fromBigInteger(a),this.curve.fromBigInteger(F),g)}function pointFpTwice(){if(this.isInfinity())return this;if(0==this.y.toBigInteger().signum())return this.curve.getInfinity();var t=new BigInteger("3"),e=this.x.toBigInteger(),r=this.y.toBigInteger(),i=r.multiply(this.z),n=i.multiply(r).mod(this.curve.q),o=this.curve.a.toBigInteger(),s=e.square().multiply(t);BigInteger.ZERO.equals(o)||(s=s.add(this.z.square().multiply(o))),s=s.mod(this.curve.q);var u=s.square().subtract(e.shiftLeft(3).multiply(n)).shiftLeft(1).multiply(i).mod(this.curve.q),p=s.multiply(t).multiply(e).subtract(n.shiftLeft(1)).shiftLeft(2).multiply(n).subtract(s.square().multiply(s)).mod(this.curve.q),h=i.square().multiply(i).shiftLeft(3).mod(this.curve.q);return new ECPointFp(this.curve,this.curve.fromBigInteger(u),this.curve.fromBigInteger(p),h)}function pointFpMultiply(t){if(this.isInfinity())return this;if(0==t.signum())return this.curve.getInfinity();var e,r=t,i=r.multiply(new BigInteger("3")),n=this.negate(),o=this;for(e=i.bitLength()-2;e>0;--e){o=o.twice();var s=i.testBit(e),u=r.testBit(e);s!=u&&(o=o.add(s?this:n))}return o}function pointFpMultiplyTwo(t,e,r){var i;i=t.bitLength()>r.bitLength()?t.bitLength()-1:r.bitLength()-1;for(var n=this.curve.getInfinity(),o=this.add(e);i>=0;)n=n.twice(),t.testBit(i)?n=n.add(r.testBit(i)?o:this):r.testBit(i)&&(n=n.add(e)),--i;return n}function ECCurveFp(t,e,r){this.q=t,this.a=this.fromBigInteger(e),this.b=this.fromBigInteger(r),this.infinity=new ECPointFp(this,null,null)}function curveFpGetQ(){return this.q}function curveFpGetA(){return this.a}function curveFpGetB(){return this.b}function curveFpEquals(t){return t==this?!0:this.q.equals(t.q)&&this.a.equals(t.a)&&this.b.equals(t.b)}function curveFpGetInfinity(){return this.infinity}function curveFpFromBigInteger(t){return new ECFieldElementFp(this.q,t)}function curveFpDecodePointHex(t){switch(parseInt(t.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:return null;case 4:case 6:case 7:var e=(t.length-2)/2,r=t.substr(2,e),i=t.substr(e+2,e);return new ECPointFp(this,this.fromBigInteger(new BigInteger(r,16)),this.fromBigInteger(new BigInteger(i,16)));default:return null}}function X9ECParameters(t,e,r,i){this.curve=t,this.g=e,this.n=r,this.h=i}function x9getCurve(){return this.curve}function x9getG(){return this.g}function x9getN(){return this.n}function x9getH(){return this.h}function fromHex(t){return new BigInteger(t,16)}function secp128r1(){var t=fromHex("FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF"),e=fromHex("FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFC"),r=fromHex("E87579C11079F43DD824993C2CEE5ED3"),i=fromHex("FFFFFFFE0000000075A30D1B9038A115"),n=BigInteger.ONE,o=new ECCurveFp(t,e,r),s=o.decodePointHex("04161FF7528B899B2D0C28607CA52C5B86CF5AC8395BAFEB13C02DA292DDED7A83");return new X9ECParameters(o,s,i,n)}function secp160k1(){var t=fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73"),e=BigInteger.ZERO,r=fromHex("7"),i=fromHex("0100000000000000000001B8FA16DFAB9ACA16B6B3"),n=BigInteger.ONE,o=new ECCurveFp(t,e,r),s=o.decodePointHex("043B4C382CE37AA192A4019E763036F4F5DD4D7EBB938CF935318FDCED6BC28286531733C3F03C4FEE");return new X9ECParameters(o,s,i,n)}function secp160r1(){var t=fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF"),e=fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC"),r=fromHex("1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45"),i=fromHex("0100000000000000000001F4C8F927AED3CA752257"),n=BigInteger.ONE,o=new ECCurveFp(t,e,r),s=o.decodePointHex("044A96B5688EF573284664698968C38BB913CBFC8223A628553168947D59DCC912042351377AC5FB32");return new X9ECParameters(o,s,i,n)}function secp192k1(){var t=fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37"),e=BigInteger.ZERO,r=fromHex("3"),i=fromHex("FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D"),n=BigInteger.ONE,o=new ECCurveFp(t,e,r),s=o.decodePointHex("04DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D");return new X9ECParameters(o,s,i,n)}function secp192r1(){var t=fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF"),e=fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC"),r=fromHex("64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1"),i=fromHex("FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831"),n=BigInteger.ONE,o=new ECCurveFp(t,e,r),s=o.decodePointHex("04188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF101207192B95FFC8DA78631011ED6B24CDD573F977A11E794811");return new X9ECParameters(o,s,i,n)}function secp224r1(){var t=fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001"),e=fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE"),r=fromHex("B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4"),i=fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D"),n=BigInteger.ONE,o=new ECCurveFp(t,e,r),s=o.decodePointHex("04B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34");return new X9ECParameters(o,s,i,n)}function secp256k1(){var t=fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F"),e=BigInteger.ZERO,r=fromHex("7"),i=fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141"),n=BigInteger.ONE,o=new ECCurveFp(t,e,r),s=o.decodePointHex("0479BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8");return new X9ECParameters(o,s,i,n)}function secp256r1(){var t=fromHex("FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF"),e=fromHex("FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC"),r=fromHex("5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B"),i=fromHex("FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551"),n=BigInteger.ONE,o=new ECCurveFp(t,e,r),s=o.decodePointHex("046B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C2964FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5");return new X9ECParameters(o,s,i,n)}function getSECCurveByName(t){return"secp128r1"==t?secp128r1():"secp160k1"==t?secp160k1():"secp160r1"==t?secp160r1():"secp192k1"==t?secp192k1():"secp192r1"==t?secp192r1():"secp224r1"==t?secp224r1():"secp256k1"==t?secp256k1():"secp256r1"==t?secp256r1():null}function integerToBytes(t,e){var r=t.toByteArrayUnsigned();if(e<r.length)r=r.slice(r.length-e);else for(;e>r.length;)r.unshift(0);return r}function dmp(t){return t instanceof BigInteger||(t=t.toBigInteger()),Crypto.util.bytesToHex(t.toByteArrayUnsigned())}if("undefined"==typeof window&&(window=this),Bitcoin={},"undefined"==typeof navigator){var navigator={};navigator.appName="NodeJS"}var base64map="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Crypto=window.Crypto={},util=Crypto.util={rotl:function(t,e){return t<<e|t>>>32-e},rotr:function(t,e){return t<<32-e|t>>>e},endian:function(t){if(t.constructor==Number)return 16711935&util.rotl(t,8)|4278255360&util.rotl(t,24);for(var e=0;e<t.length;e++)t[e]=util.endian(t[e]);return t},randomBytes:function(t){for(var e=[];t>0;t--)e.push(Math.floor(256*Math.random()));return e},bytesToWords:function(t){for(var e=[],r=0,i=0;r<t.length;r++,i+=8)e[i>>>5]|=t[r]<<24-i%32;return e},wordsToBytes:function(t){for(var e=[],r=0;r<32*t.length;r+=8)e.push(t[r>>>5]>>>24-r%32&255);return e},bytesToHex:function(t){for(var e=[],r=0;r<t.length;r++)e.push((t[r]>>>4).toString(16)),e.push((15&t[r]).toString(16));return e.join("")},hexToBytes:function(t){for(var e=[],r=0;r<t.length;r+=2)e.push(parseInt(t.substr(r,2),16));return e},bytesToBase64:function(t){if("function"==typeof btoa)return btoa(Binary.bytesToString(t));for(var e=[],r=0;r<t.length;r+=3)for(var i=t[r]<<16|t[r+1]<<8|t[r+2],n=0;4>n;n++)e.push(8*r+6*n<=8*t.length?base64map.charAt(i>>>6*(3-n)&63):"=");return e.join("")},base64ToBytes:function(t){if("function"==typeof atob)return Binary.stringToBytes(atob(t));t=t.replace(/[^A-Z0-9+\/]/gi,"");for(var e=[],r=0,i=0;r<t.length;i=++r%4)0!=i&&e.push((base64map.indexOf(t.charAt(r-1))&Math.pow(2,-2*i+8)-1)<<2*i|base64map.indexOf(t.charAt(r))>>>6-2*i);return e}};Crypto.mode={};var charenc=Crypto.charenc={},UTF8=charenc.UTF8={stringToBytes:function(t){return Binary.stringToBytes(unescape(encodeURIComponent(t)))},bytesToString:function(t){return decodeURIComponent(escape(Binary.bytesToString(t)))}},Binary=charenc.Binary={stringToBytes:function(t){for(var e=[],r=0;r<t.length;r++)e.push(t.charCodeAt(r));return e},bytesToString:function(t){for(var e=[],r=0;r<t.length;r++)e.push(String.fromCharCode(t[r]));return e.join("")}},CryptoJS=CryptoJS||function(t,e){var r={},i=r.lib={},n=function(){},o=i.Base={extend:function(t){n.prototype=this;var e=new n;return t&&e.mixIn(t),e.hasOwnProperty("init")||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},s=i.WordArray=o.extend({init:function(t,r){t=this.words=t||[],this.sigBytes=r!=e?r:4*t.length},toString:function(t){return(t||p).stringify(this)},concat:function(t){var e=this.words,r=t.words,i=this.sigBytes;if(t=t.sigBytes,this.clamp(),i%4)for(var n=0;t>n;n++)e[i+n>>>2]|=(r[n>>>2]>>>24-8*(n%4)&255)<<24-8*((i+n)%4);else if(65535<r.length)for(n=0;t>n;n+=4)e[i+n>>>2]=r[n>>>2];else e.push.apply(e,r);return this.sigBytes+=t,this},clamp:function(){var e=this.words,r=this.sigBytes;e[r>>>2]&=4294967295<<32-8*(r%4),e.length=t.ceil(r/4)},clone:function(){var t=o.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var r=[],i=0;e>i;i+=4)r.push(4294967296*t.random()|0);return new s.init(r,e)}}),u=r.enc={},p=u.Hex={stringify:function(t){var e=t.words;t=t.sigBytes;for(var r=[],i=0;t>i;i++){var n=e[i>>>2]>>>24-8*(i%4)&255;r.push((n>>>4).toString(16)),r.push((15&n).toString(16))}return r.join("")},parse:function(t){for(var e=t.length,r=[],i=0;e>i;i+=2)r[i>>>3]|=parseInt(t.substr(i,2),16)<<24-4*(i%8);return new s.init(r,e/2)}},h=u.Latin1={stringify:function(t){var e=t.words;t=t.sigBytes;for(var r=[],i=0;t>i;i++)r.push(String.fromCharCode(e[i>>>2]>>>24-8*(i%4)&255));return r.join("")},parse:function(t){for(var e=t.length,r=[],i=0;e>i;i++)r[i>>>2]|=(255&t.charCodeAt(i))<<24-8*(i%4);return new s.init(r,e)}},a=u.Utf8={stringify:function(t){try{return decodeURIComponent(escape(h.stringify(t)))}catch(e){throw Error("Malformed UTF-8 data")}},parse:function(t){return h.parse(unescape(encodeURIComponent(t)))}},F=i.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=a.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var r=this._data,i=r.words,n=r.sigBytes,o=this.blockSize,u=n/(4*o),u=e?t.ceil(u):t.max((0|u)-this._minBufferSize,0);if(e=u*o,n=t.min(4*e,n),e){for(var p=0;e>p;p+=o)this._doProcessBlock(i,p);p=i.splice(0,e),r.sigBytes-=n}return new s.init(p,n)},clone:function(){var t=o.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});i.Hasher=F.extend({cfg:o.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){F.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,r){return new t.init(r).finalize(e)}},_createHmacHelper:function(t){return function(e,r){return new g.HMAC.init(t,r).finalize(e)}}});var g=r.algo={};return r}(Math);!function(){var t=CryptoJS,e=t.lib,r=e.WordArray,i=e.Hasher,e=t.algo,n=r.create([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]),o=r.create([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]),s=r.create([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]),u=r.create([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]),p=r.create([0,1518500249,1859775393,2400959708,2840853838]),h=r.create([1352829926,1548603684,1836072691,2053994217,0]),e=e.RIPEMD160=i.extend({_doReset:function(){this._hash=r.create([1732584193,4023233417,2562383102,271733878,3285377520])
},_doProcessBlock:function(t,e){for(var r=0;16>r;r++){var i=e+r,a=t[i];t[i]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}var F,g,f,c,l,B,m,y,d,v,i=this._hash.words,a=p.words,b=h.words,I=n.words,E=o.words,C=s.words,T=u.words;B=F=i[0],m=g=i[1],y=f=i[2],d=c=i[3],v=l=i[4];for(var w,r=0;80>r;r+=1)w=F+t[e+I[r]]|0,w=16>r?w+((g^f^c)+a[0]):32>r?w+((g&f|~g&c)+a[1]):48>r?w+(((g|~f)^c)+a[2]):64>r?w+((g&c|f&~c)+a[3]):w+((g^(f|~c))+a[4]),w|=0,w=w<<C[r]|w>>>32-C[r],w=w+l|0,F=l,l=c,c=f<<10|f>>>22,f=g,g=w,w=B+t[e+E[r]]|0,w=16>r?w+((m^(y|~d))+b[0]):32>r?w+((m&d|y&~d)+b[1]):48>r?w+(((m|~y)^d)+b[2]):64>r?w+((m&y|~m&d)+b[3]):w+((m^y^d)+b[4]),w|=0,w=w<<T[r]|w>>>32-T[r],w=w+v|0,B=v,v=d,d=y<<10|y>>>22,y=m,m=w;w=i[1]+f+d|0,i[1]=i[2]+c+v|0,i[2]=i[3]+l+B|0,i[3]=i[4]+F+m|0,i[4]=i[0]+g+y|0,i[0]=w},_doFinalize:function(){var t=this._data,e=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;for(e[i>>>5]|=128<<24-i%32,e[(i+64>>>9<<4)+14]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),t.sigBytes=4*(e.length+1),this._process(),t=this._hash,e=t.words,r=0;5>r;r++)i=e[r],e[r]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8);return t},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}});t.RIPEMD160=i._createHelper(e),t.HmacRIPEMD160=i._createHmacHelper(e)}(Math),module.exports.crypto31=CryptoJS;var dbits,canary=0xdeadbeefcafe,j_lm=15715070==(16777215&canary);j_lm&&"Microsoft Internet Explorer"==navigator.appName?(BigInteger.prototype.am=am2,dbits=30):j_lm&&"Netscape"!=navigator.appName?(BigInteger.prototype.am=am1,dbits=26):(BigInteger.prototype.am=am3,dbits=28),BigInteger.prototype.DB=dbits,BigInteger.prototype.DM=(1<<dbits)-1,BigInteger.prototype.DV=1<<dbits;var BI_FP=52;BigInteger.prototype.FV=Math.pow(2,BI_FP),BigInteger.prototype.F1=BI_FP-dbits,BigInteger.prototype.F2=2*dbits-BI_FP;var BI_RM="0123456789abcdefghijklmnopqrstuvwxyz",BI_RC=new Array,rr,vv;for(rr="0".charCodeAt(0),vv=0;9>=vv;++vv)BI_RC[rr++]=vv;for(rr="a".charCodeAt(0),vv=10;36>vv;++vv)BI_RC[rr++]=vv;for(rr="A".charCodeAt(0),vv=10;36>vv;++vv)BI_RC[rr++]=vv;Classic.prototype.convert=cConvert,Classic.prototype.revert=cRevert,Classic.prototype.reduce=cReduce,Classic.prototype.mulTo=cMulTo,Classic.prototype.sqrTo=cSqrTo,Montgomery.prototype.convert=montConvert,Montgomery.prototype.revert=montRevert,Montgomery.prototype.reduce=montReduce,Montgomery.prototype.mulTo=montMulTo,Montgomery.prototype.sqrTo=montSqrTo,BigInteger.prototype.copyTo=bnpCopyTo,BigInteger.prototype.fromInt=bnpFromInt,BigInteger.prototype.fromString=bnpFromString,BigInteger.prototype.clamp=bnpClamp,BigInteger.prototype.dlShiftTo=bnpDLShiftTo,BigInteger.prototype.drShiftTo=bnpDRShiftTo,BigInteger.prototype.lShiftTo=bnpLShiftTo,BigInteger.prototype.rShiftTo=bnpRShiftTo,BigInteger.prototype.subTo=bnpSubTo,BigInteger.prototype.multiplyTo=bnpMultiplyTo,BigInteger.prototype.squareTo=bnpSquareTo,BigInteger.prototype.divRemTo=bnpDivRemTo,BigInteger.prototype.invDigit=bnpInvDigit,BigInteger.prototype.isEven=bnpIsEven,BigInteger.prototype.exp=bnpExp,BigInteger.prototype.toString=bnToString,BigInteger.prototype.negate=bnNegate,BigInteger.prototype.abs=bnAbs,BigInteger.prototype.compareTo=bnCompareTo,BigInteger.prototype.bitLength=bnBitLength,BigInteger.prototype.mod=bnMod,BigInteger.prototype.modPowInt=bnModPowInt,BigInteger.ZERO=nbv(0),BigInteger.ONE=nbv(1),NullExp.prototype.convert=nNop,NullExp.prototype.revert=nNop,NullExp.prototype.mulTo=nMulTo,NullExp.prototype.sqrTo=nSqrTo,Barrett.prototype.convert=barrettConvert,Barrett.prototype.revert=barrettRevert,Barrett.prototype.reduce=barrettReduce,Barrett.prototype.mulTo=barrettMulTo,Barrett.prototype.sqrTo=barrettSqrTo;var lowprimes=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],lplim=(1<<26)/lowprimes[lowprimes.length-1];BigInteger.prototype.chunkSize=bnpChunkSize,BigInteger.prototype.toRadix=bnpToRadix,BigInteger.prototype.fromRadix=bnpFromRadix,BigInteger.prototype.fromNumber=bnpFromNumber,BigInteger.prototype.bitwiseTo=bnpBitwiseTo,BigInteger.prototype.changeBit=bnpChangeBit,BigInteger.prototype.addTo=bnpAddTo,BigInteger.prototype.dMultiply=bnpDMultiply,BigInteger.prototype.dAddOffset=bnpDAddOffset,BigInteger.prototype.multiplyLowerTo=bnpMultiplyLowerTo,BigInteger.prototype.multiplyUpperTo=bnpMultiplyUpperTo,BigInteger.prototype.modInt=bnpModInt,BigInteger.prototype.millerRabin=bnpMillerRabin,BigInteger.prototype.clone=bnClone,BigInteger.prototype.intValue=bnIntValue,BigInteger.prototype.byteValue=bnByteValue,BigInteger.prototype.shortValue=bnShortValue,BigInteger.prototype.signum=bnSigNum,BigInteger.prototype.toByteArray=bnToByteArray,BigInteger.prototype.equals=bnEquals,BigInteger.prototype.min=bnMin,BigInteger.prototype.max=bnMax,BigInteger.prototype.and=bnAnd,BigInteger.prototype.or=bnOr,BigInteger.prototype.xor=bnXor,BigInteger.prototype.andNot=bnAndNot,BigInteger.prototype.not=bnNot,BigInteger.prototype.shiftLeft=bnShiftLeft,BigInteger.prototype.shiftRight=bnShiftRight,BigInteger.prototype.getLowestSetBit=bnGetLowestSetBit,BigInteger.prototype.bitCount=bnBitCount,BigInteger.prototype.testBit=bnTestBit,BigInteger.prototype.setBit=bnSetBit,BigInteger.prototype.clearBit=bnClearBit,BigInteger.prototype.flipBit=bnFlipBit,BigInteger.prototype.add=bnAdd,BigInteger.prototype.subtract=bnSubtract,BigInteger.prototype.multiply=bnMultiply,BigInteger.prototype.divide=bnDivide,BigInteger.prototype.remainder=bnRemainder,BigInteger.prototype.divideAndRemainder=bnDivideAndRemainder,BigInteger.prototype.modPow=bnModPow,BigInteger.prototype.modInverse=bnModInverse,BigInteger.prototype.pow=bnPow,BigInteger.prototype.gcd=bnGCD,BigInteger.prototype.isProbablePrime=bnIsProbablePrime,BigInteger.prototype.square=bnSquare,module.exports.BigInteger=BigInteger,Arcfour.prototype.init=ARC4init,Arcfour.prototype.next=ARC4next;var rng_psize=256;BigInteger.valueOf=nbv,BigInteger.prototype.toByteArrayUnsigned=function(){var t=this.abs().toByteArray();return t.length?(0==t[0]&&(t=t.slice(1)),t.map(function(t){return 0>t?t+256:t})):t},BigInteger.fromByteArrayUnsigned=function(t){return t.length?new BigInteger(128&t[0]?[0].concat(t):t):t.valueOf(0)},BigInteger.prototype.toByteArraySigned=function(){var t=this.abs().toByteArrayUnsigned(),e=this.compareTo(BigInteger.ZERO)<0;return e?128&t[0]?t.unshift(128):t[0]|=128:128&t[0]&&t.unshift(0),t},BigInteger.fromByteArraySigned=function(t){return 128&t[0]?(t[0]&=127,BigInteger.fromByteArrayUnsigned(t).negate()):BigInteger.fromByteArrayUnsigned(t)};var names=["log","debug","info","warn","error","assert","dir","dirxml","group","groupEnd","time","timeEnd","count","trace","profile","profileEnd"];"undefined"==typeof window.console&&(window.console={});for(var i=0;i<names.length;++i)"undefined"==typeof window.console[names[i]]&&(window.console[names[i]]=function(){});Bitcoin.Util={isArray:Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},makeFilledArray:function(t,e){for(var r=[],i=0;t>i;)r[i++]=e;return r},numToVarInt:function(t){if(253>t)return[t];if(65536>t)return[253,255&t,t>>>8];if(4294967296>t)return[254].concat(Crypto.util.wordsToBytes([t]).reverse());throw"quadword not implemented"},valueToBigInt:function(t){return t instanceof BigInteger?t:BigInteger.fromByteArrayUnsigned(t)},formatValue:function(t){for(var e=this.valueToBigInt(t).toString(),r=e.length>8?e.substr(0,e.length-8):"0",i=e.length>8?e.substr(e.length-8):e;i.length<8;)i="0"+i;for(i=i.replace(/0*$/,"");i.length<2;)i+="0";return r+"."+i},parseValue:function(t){for(var e=t.split("."),r=e[0],i=e[1]||"0";i.length<8;)i+="0";i=i.replace(/^0+/g,"");var n=BigInteger.valueOf(parseInt(r));return n=n.multiply(BigInteger.valueOf(1e8)),n=n.add(BigInteger.valueOf(parseInt(i)))},sha256ripe160:function(t){return Crypto.RIPEMD160(Crypto.SHA256(t,{asBytes:!0}),{asBytes:!0})}};for(var i in Crypto.util)Crypto.util.hasOwnProperty(i)&&(Bitcoin.Util[i]=Crypto.util[i]);var rng_state,rng_pool,rng_pptr;if(null==rng_pool){rng_pool=new Array,rng_pptr=0;var t;if("Netscape"==navigator.appName&&navigator.appVersion<"5"&&window.crypto){var z=window.crypto.random(32);for(t=0;t<z.length;++t)rng_pool[rng_pptr++]=255&z.charCodeAt(t)}for(;rng_psize>rng_pptr;)t=Math.floor(65536*Math.random()),rng_pool[rng_pptr++]=t>>>8,rng_pool[rng_pptr++]=255&t;rng_pptr=0,rng_seed_time()}SecureRandom.prototype.nextBytes=function(){throw new Error("Should not use old RNG")},ECFieldElementFp.prototype.equals=feFpEquals,ECFieldElementFp.prototype.toBigInteger=feFpToBigInteger,ECFieldElementFp.prototype.negate=feFpNegate,ECFieldElementFp.prototype.add=feFpAdd,ECFieldElementFp.prototype.subtract=feFpSubtract,ECFieldElementFp.prototype.multiply=feFpMultiply,ECFieldElementFp.prototype.square=feFpSquare,ECFieldElementFp.prototype.divide=feFpDivide,ECPointFp.prototype.getX=pointFpGetX,ECPointFp.prototype.getY=pointFpGetY,ECPointFp.prototype.equals=pointFpEquals,ECPointFp.prototype.isInfinity=pointFpIsInfinity,ECPointFp.prototype.negate=pointFpNegate,ECPointFp.prototype.add=pointFpAdd,ECPointFp.prototype.twice=pointFpTwice,ECPointFp.prototype.multiply=pointFpMultiply,ECPointFp.prototype.multiplyTwo=pointFpMultiplyTwo,ECCurveFp.prototype.getQ=curveFpGetQ,ECCurveFp.prototype.getA=curveFpGetA,ECCurveFp.prototype.getB=curveFpGetB,ECCurveFp.prototype.equals=curveFpEquals,ECCurveFp.prototype.getInfinity=curveFpGetInfinity,ECCurveFp.prototype.fromBigInteger=curveFpFromBigInteger,ECCurveFp.prototype.decodePointHex=curveFpDecodePointHex,module.exports.ECPointFp=ECPointFp,module.exports.ECFieldElementFp=ECFieldElementFp,X9ECParameters.prototype.getCurve=x9getCurve,X9ECParameters.prototype.getG=x9getG,X9ECParameters.prototype.getN=x9getN,X9ECParameters.prototype.getH=x9getH,module.exports.getSECCurveByName=getSECCurveByName,ECFieldElementFp.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)},ECPointFp.prototype.getEncoded=function(t){var e=this.getX().toBigInteger(),r=this.getY().toBigInteger(),i=integerToBytes(e,32);return t?i.unshift(r.isEven()?2:3):(i.unshift(4),i=i.concat(integerToBytes(r,32))),i},ECPointFp.decodeFrom=function(t,e){var r=e[0],i=e.length-1;if(4===r)var n=e.slice(1,1+i/2),o=e.slice(1+i/2,1+i),s=BigInteger.fromByteArrayUnsigned(n),u=BigInteger.fromByteArrayUnsigned(o);else{var n=e.slice(1),s=BigInteger.fromByteArrayUnsigned(n),p=t.getQ(),h=s.multiply(s).multiply(s).add(new BigInteger("7")).mod(p),a=p.add(new BigInteger("1")).divide(new BigInteger("4")),u=h.modPow(a,p);u.mod(new BigInteger("2")).toString()!=""+r%2&&(u=p.subtract(u))}return new ECPointFp(t,t.fromBigInteger(s),t.fromBigInteger(u))},ECPointFp.prototype.add2D=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;if(this.x.equals(t.x))return this.y.equals(t.y)?this.twice():this.curve.getInfinity();var e=t.x.subtract(this.x),r=t.y.subtract(this.y),i=r.divide(e),n=i.square().subtract(this.x).subtract(t.x),o=i.multiply(this.x.subtract(n)).subtract(this.y);return new ECPointFp(this.curve,n,o)},ECPointFp.prototype.twice2D=function(){if(this.isInfinity())return this;if(0==this.y.toBigInteger().signum())return this.curve.getInfinity();var t=this.curve.fromBigInteger(BigInteger.valueOf(2)),e=this.curve.fromBigInteger(BigInteger.valueOf(3)),r=this.x.square().multiply(e).add(this.curve.a).divide(this.y.multiply(t)),i=r.square().subtract(this.x.multiply(t)),n=r.multiply(this.x.subtract(i)).subtract(this.y);return new ECPointFp(this.curve,i,n)},ECPointFp.prototype.multiply2D=function(t){if(this.isInfinity())return this;if(0==t.signum())return this.curve.getInfinity();var e,r=t,i=r.multiply(new BigInteger("3")),n=this.negate(),o=this;for(e=i.bitLength()-2;e>0;--e){o=o.twice();var s=i.testBit(e),u=r.testBit(e);s!=u&&(o=o.add2D(s?this:n))}return o},ECPointFp.prototype.isOnCurve=function(){var t=this.getX().toBigInteger(),e=this.getY().toBigInteger(),r=this.curve.getA().toBigInteger(),i=this.curve.getB().toBigInteger(),n=this.curve.getQ(),o=e.multiply(e).mod(n),s=t.multiply(t).multiply(t).add(r.multiply(t)).add(i).mod(n);return o.equals(s)},ECPointFp.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"},ECPointFp.prototype.validate=function(){var t=this.curve.getQ();if(this.isInfinity())throw new Error("Point is at infinity.");var e=this.getX().toBigInteger(),r=this.getY().toBigInteger();if(e.compareTo(BigInteger.ONE)<0||e.compareTo(t.subtract(BigInteger.ONE))>0)throw new Error("x coordinate out of bounds");if(r.compareTo(BigInteger.ONE)<0||r.compareTo(t.subtract(BigInteger.ONE))>0)throw new Error("y coordinate out of bounds");if(!this.isOnCurve())throw new Error("Point is not on the curve.");if(this.multiply(t).isInfinity())throw new Error("Point is not a scalar multiple of G.");return!0},Bitcoin.ECDSA=function(){function t(t,e,r,i){for(var n=Math.max(e.bitLength(),i.bitLength()),o=t.add2D(r),s=t.curve.getInfinity(),u=n-1;u>=0;--u)s=s.twice2D(),s.z=BigInteger.ONE,e.testBit(u)?s=s.add2D(i.testBit(u)?o:t):i.testBit(u)&&(s=s.add2D(r));return s}var e=getSECCurveByName("secp256k1"),r=new SecureRandom,i=null,n={getBigRandom:function(t){return new BigInteger(t.bitLength(),r).mod(t.subtract(BigInteger.ONE)).add(BigInteger.ONE)},sign:function(t,r){var i=r,o=e.getN(),s=BigInteger.fromByteArrayUnsigned(t);do var u=n.getBigRandom(o),p=e.getG(),h=p.multiply(u),a=h.getX().toBigInteger().mod(o);while(a.compareTo(BigInteger.ZERO)<=0);var F=u.modInverse(o).multiply(s.add(i.multiply(a))).mod(o);return n.serializeSig(a,F)},verify:function(t,r,i){var o,s;if(Bitcoin.Util.isArray(r)){var u=n.parseSig(r);o=u.r,s=u.s}else{if("object"!=typeof r||!r.r||!r.s)throw"Invalid value for signature";o=r.r,s=r.s}var p;if(i instanceof ECPointFp)p=i;else{if(!Bitcoin.Util.isArray(i))throw"Invalid format for pubkey value, must be byte array or ECPointFp";p=ECPointFp.decodeFrom(e.getCurve(),i)}var h=BigInteger.fromByteArrayUnsigned(t);return n.verifyRaw(h,o,s,p)},verifyRaw:function(t,r,i,n){var o=e.getN(),s=e.getG();if(r.compareTo(BigInteger.ONE)<0||r.compareTo(o)>=0)return!1;if(i.compareTo(BigInteger.ONE)<0||i.compareTo(o)>=0)return!1;var u=i.modInverse(o),p=t.multiply(u).mod(o),h=r.multiply(u).mod(o),a=s.multiply(p).add(n.multiply(h)),F=a.getX().toBigInteger().mod(o);return F.equals(r)},serializeSig:function(t,e){var r=t.toByteArraySigned(),i=e.toByteArraySigned(),n=[];return n.push(2),n.push(r.length),n=n.concat(r),n.push(2),n.push(i.length),n=n.concat(i),n.unshift(n.length),n.unshift(48),n},parseSig:function(t){var e;if(48!=t[0])throw new Error("Signature not a valid DERSequence");if(e=2,2!=t[e])throw new Error("First element in signature must be a DERInteger");var r=t.slice(e+2,e+2+t[e+1]);if(e+=2+t[e+1],2!=t[e])throw new Error("Second element in signature must be a DERInteger");var i=t.slice(e+2,e+2+t[e+1]);e+=2+t[e+1];var n=BigInteger.fromByteArrayUnsigned(r),o=BigInteger.fromByteArrayUnsigned(i);return{r:n,s:o}},parseSigCompact:function(t){if(65!==t.length)throw"Signature has the wrong length";var r=t[0]-27;if(0>r||r>7)throw"Invalid signature type";var i=e.getN(),n=BigInteger.fromByteArrayUnsigned(t.slice(1,33)).mod(i),o=BigInteger.fromByteArrayUnsigned(t.slice(33,65)).mod(i);return{r:n,s:o,i:r}},recoverPubKey:function(r,o,s,u){u=3&u;var p=1&u,h=u>>1,a=e.getN(),F=e.getG(),g=e.getCurve(),f=g.getQ(),c=g.getA().toBigInteger(),l=g.getB().toBigInteger();i||(i=f.add(BigInteger.ONE).divide(BigInteger.valueOf(4)));var B=h?r.add(a):r,m=B.multiply(B).multiply(B).add(c.multiply(B)).add(l).mod(f),y=m.modPow(i,f),d=(y.isEven()?u%2:(u+1)%2,(y.isEven()?!p:p)?y:f.subtract(y)),v=new ECPointFp(g,g.fromBigInteger(B),g.fromBigInteger(d));v.validate();var b=BigInteger.fromByteArrayUnsigned(s),I=BigInteger.ZERO.subtract(b).mod(a),E=r.modInverse(a),C=t(v,o,F,I).multiply(E);if(C.validate(),!n.verifyRaw(b,r,o,C))throw"Pubkey recovery unsuccessful";var T=new Bitcoin.ECKey;return T.pub=C,T},calcPubkeyRecoveryParam:function(t,e,r,i){for(var n=0;4>n;n++)try{var o=Bitcoin.ECDSA.recoverPubKey(e,r,i,n);if(o.getBitcoinAddress().toString()==t)return n}catch(s){}throw"Unable to find valid recovery factor"}};return n}(),Bitcoin.ECKey=function(){var t=Bitcoin.ECDSA,e=getSECCurveByName("secp256k1"),r=(new SecureRandom,function(t){if(t)t instanceof BigInteger?this.priv=t:Bitcoin.Util.isArray(t)?this.priv=BigInteger.fromByteArrayUnsigned(t):"string"==typeof t&&(this.priv=BigInteger.fromByteArrayUnsigned(51==t.length&&"5"==t[0]?r.decodeString(t):Crypto.util.hexToBytes(t)));else{e.getN()}this.compressed=!!r.compressByDefault});return r.compressByDefault=!1,r.prototype.setCompressed=function(t){this.compressed=!!t},r.prototype.getPub=function(){return this.getPubPoint().getEncoded(this.compressed)},r.prototype.getPubPoint=function(){return this.pub||(this.pub=e.getG().multiply(this.priv)),this.pub},r.prototype.getPubKeyHash=function(){return this.pubKeyHash?this.pubKeyHash:this.pubKeyHash=Bitcoin.Util.sha256ripe160(this.getPub())},r.prototype.getBitcoinAddress=function(){var t=this.getPubKeyHash(),e=new Bitcoin.Address(t);return e},r.prototype.getExportedPrivateKey=function(){for(var t=this.priv.toByteArrayUnsigned();t.length<32;)t.unshift(0);t.unshift(128);var e=Crypto.SHA256(Crypto.SHA256(t,{asBytes:!0}),{asBytes:!0}),r=t.concat(e.slice(0,4));return Bitcoin.Base58.encode(r)},r.prototype.setPub=function(t){this.pub=ECPointFp.decodeFrom(e.getCurve(),t)},r.prototype.toString=function(t){return"base64"===t?Crypto.util.bytesToBase64(this.priv.toByteArrayUnsigned()):Crypto.util.bytesToHex(this.priv.toByteArrayUnsigned())},r.prototype.sign=function(e){return t.sign(e,this.priv)},r.prototype.verify=function(e,r){return t.verify(e,r,this.getPub())},r.decodeString=function(t){var e=Bitcoin.Base58.decode(t),r=e.slice(0,33),i=Crypto.SHA256(Crypto.SHA256(r,{asBytes:!0}),{asBytes:!0});if(i[0]!=e[33]||i[1]!=e[34]||i[2]!=e[35]||i[3]!=e[36])throw"Checksum validation failed!";var n=r.shift();if(128!=n)throw"Version "+n+" not supported!";return r},r}(),module.exports.ECKey=Bitcoin.ECKey;
},{}],"4itQ50":[function(require,module,exports){
module.exports={network:"livenet",logger:"normal"};
},{}],"./config":[function(require,module,exports){
module.exports=require('4itQ50');
},{}],"./const":[function(require,module,exports){
module.exports=require('f08cvL');
},{}],"f08cvL":[function(require,module,exports){
MSG={TX:1,BLOCK:2,FILTERED_BLOCK:3},MSG.to_str=function(t){switch(t){case MSG.TX:return"transaction";case MSG.BLOCK:return"block";case MSG.FILTERED_BLOCK:return"filtered block";default:return"unknown"}},exports.MSG=MSG;
},{}],"G+CcXD":[function(require,module,exports){
(function(e){"use strict";function r(e,t){if(t&&t.length&&20!=t.length)throw new Error("Hash must be 20 bytes");r.super(this,arguments)}var t=require("soop").imports(),i=t.coinUtil||require("../util"),n=t.parent||require("../util/VersionedData"),s=t.networks||require("../networks"),o=t.Script||require("./Script");r.parent=n,n.applyEncodingsTo(r),r.fromPubKey=function(e,t){if(t||(t="livenet"),33!==e.length&&65!==e.length)throw new Error("Invalid public key");var n=s[t].addressVersion,o=i.sha256ripe160(e);return new r(n,o)},r.fromKey=function(e,t){return r.fromPubKey(e.public,t)},r.fromPubKeys=function(e,t,i,n){i||(i="livenet");for(var s in t){var a=t[s];if(33!=a.length&&65!=a.length)throw new Error("Invalid public key")}var u=o.createMultisig(e,t,n);return r.fromScript(u,i)},r.fromScript=function(t,n){n||(n="livenet"),"string"==typeof t&&(t=new o(new e(t,"hex")));var a=s[n].P2SHVersion,u=t.getBuffer(),f=i.sha256ripe160(u);return new r(a,f)},r.fromScriptPubKey=function(t,n){"string"==typeof t&&(t=new o(new e(t,"hex"))),n||(n="livenet");var a,u=[],f=t.capture();if(f){var p=t.classify();switch(p){case o.TX_PUBKEY:f[0]=i.sha256ripe160(f[0]),a=s[n].addressVersion;break;case o.TX_PUBKEYHASH:a=s[n].addressVersion;break;case o.TX_MULTISIG:a=s[n].addressVersion;for(var l in f)f[l]=i.sha256ripe160(f[l]);break;case o.TX_SCRIPTHASH:a=s[n].P2SHVersion}for(var l in f)u.push(new r(a,f[l]))}return u},r.prototype.validate=function(){if(this.doAsBinary(function(){if(r.super(this,"validate",arguments),21!==this.data.length)throw new Error("invalid data length")}),"undefined"==typeof this.network())throw new Error("invalid network")},r.prototype.isValid=function(){var e=r.super(this,"isValid",arguments);return e},r.prototype.network=function(){var e,r=this.version(),t=s.livenet,i=s.testnet;return r===t.addressVersion||r===t.P2SHVersion?e=t:(r===i.addressVersion||r===i.P2SHVersion)&&(e=i),e},r.prototype.isScript=function(){return this.isValid()&&this.version()===this.network().P2SHVersion},r.prototype.getScriptPubKey=function(){var e,r=this.version(),t=s.livenet,i=s.testnet;if(r===t.addressVersion||r===i.addressVersion)e=o.createPubKeyHashOut(this.payload());else{if(r!==t.P2SHVersion&&r!==i.P2SHVersion)throw new Error("invalid address - unknown version");e=o.createP2SH(this.payload())}return e},module.exports=require("soop")(r)}).call(this,require("buffer").Buffer);
},{"../networks":"ULNIu2","../util":143,"../util/VersionedData":"QLzNQg","./Script":"hQ0t76","buffer":85,"soop":129}],"./lib/Address":[function(require,module,exports){
module.exports=require('G+CcXD');
},{}],"./lib/Armory":[function(require,module,exports){
module.exports=require('YL/05i');
},{}],"YL/05i":[function(require,module,exports){
(function(e){function r(r,n){this.chaincode=new e(r,"hex"),this.pubkey=new e(n,"hex")}function n(e){for(var r="0123456789abcdef",n="asdfghjkwertuion",t="",i=0;i<e.length;i++)t+=r.charAt(n.indexOf(e.charAt(i)));return t}var t=require("./Point"),i=require("./Key"),o=require("../util").sha256,c=require("../util").twoSha256;r.prototype.generatePubKey=function(){for(var e=this.pubkey,r=this.chaincode,n=c(e),i=0;32>i;i++)n[i]^=r[i];var o=t.fromUncompressedPubKey(e);o=t.multiply(o,n);var u=o.toUncompressedPubKey();return u},r.prototype.next=function(){var e=this.generatePubKey();return new r(this.chaincode,e)},r.fromMasterPublicKey=function(e){var n=e.substr(0,130),t=e.substr(130,e.length);return new r(t,n)},r.decodeSeed=function(t){for(var i=t.trim().split("\n"),o=[],c=0;c<i.length;c++){var u=i[c].replace(" ",""),a=new e(n(u),"hex"),h=a.slice(0,16);o.push(h)}var s=e.concat([o[0],o[1]]),f=4==o.length?e.concat([o[2],o[3]]):r.deriveChaincode(s);return{privKey:s,chainCode:f}},r.fromSeed=function(e){var n=r.decodeSeed(e),t=new i;return t.private=n.privKey,t.compressed=!1,t.regenerateSync(),new r(n.chainCode,t.public)},r.deriveChaincode=function(r){for(var n="Derive Chaincode from Root Key",t=c(r),i=[],u=[],a=0;a<t.length;a++)i.push(92^t[a]),u.push(54^t[a]);i=new e(i),u=new e(u);var h=new e(n,"utf8"),s=o(e.concat([u,h])),f=o(e.concat([i,s]));return f},module.exports=r}).call(this,require("buffer").Buffer);
},{"../util":143,"./Key":"ALJ4PS","./Point":"6tXgqr","buffer":85}],"./lib/Base58":[function(require,module,exports){
module.exports=require('6VqyzY');
},{}],"6VqyzY":[function(require,module,exports){
(function(e){function r(r){return new e(t.createHash("sha256").update(r).digest("binary"),"binary")}function n(e){return r(r(e))}for(var t=require("crypto"),o=require("bignum"),i=new e(1024),c=new e(0),f="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",u=f[0],a=new e(f,"ascii"),h={},d=0;d<f.length;d++)h[f[d]]=d;var l={encode:function(r){var n,t,c=o.fromBuffer(r);n=r.length<512?i:new e(r.length<<1);for(var f=n.length-1;c.gt(0);)t=c.mod(58),c=c.div(58),n[f]=a[t.toNumber()],f--;for(var u=0;0==r[u];)n[f]=a[0],u++,f--;return n.slice(f+1,n.length).toString("ascii")},decode:function(r){if(0==r.length)return c;for(var n=o(0),t=0;t<r.length;t++)n=n.mul(58),n=n.add(h[r[t]]);for(var t=0;t<r.length&&r[t]==u;)t++;if(t>0){var i=new e(t);return i.fill(0),t==r.length?i:(n=n.toBuffer(),e.concat([i,n],t+n.length))}return n.toBuffer()}},s={encode:function(r){var t=new e(r.length+4),o=n(r);return r.copy(t),o.copy(t,r.length),l.encode(t)},decode:function(e){var r=l.decode(e);if(r.length<4)throw new Error("invalid input: too short");var t=r.slice(0,-4),o=r.slice(-4),i=n(t),c=i.slice(0,4);if(o.toString("hex")!==c.toString("hex"))throw new Error("checksum mismatch");return t}};exports.setBuffer=function(e){i=e},exports.base58=l,exports.base58Check=s,exports.encode=l.encode,exports.decode=l.decode}).call(this,require("buffer").Buffer);
},{"bignum":58,"buffer":85,"crypto":89}],"./lib/Block":[function(require,module,exports){
module.exports=require('pJEQEB');
},{}],"pJEQEB":[function(require,module,exports){
(function(t){function e(t){"object"!=typeof t&&(t={}),this.hash=t.hash||null,this.prev_hash=t.prev_hash||i.NULL_HASH,this.merkle_root=t.merkle_root||i.NULL_HASH,this.timestamp=t.timestamp||0,this.bits=t.bits||0,this.nonce=t.nonce||0,this.version=t.version||0,this.height=t.height||0,this.size=t.size||0,this.active=t.active||!1,this.chainWork=t.chainWork||i.EMPTY_BUFFER,this.txs=t.txs||[]}var r=require("soop").imports(),i=r.util||require("../util"),o=(r.Debug1||function(){},r.Script||require("./Script")),s=r.Bignum||require("bignum"),h=(r.Binary||require("binary"),r.Step||require("step"),r.buffertools||require("buffertools")),n=r.Transaction||require("./Transaction"),a=n.In,c=n.Out,u=n.COINBASE_OP,l=r.VerificationError||require("../util/error").VerificationError,f={maxTimeOffset:7200,largestHash:s(2).pow(256)};e.prototype.getHeader=function(){var e=new t(80),r=0;return e.writeUInt32LE(this.version,r),r+=4,this.prev_hash.copy(e,r),r+=32,this.merkle_root.copy(e,r),r+=32,e.writeUInt32LE(this.timestamp,r),r+=4,e.writeUInt32LE(this.bits,r),r+=4,e.writeUInt32LE(this.nonce,r),r+=4,e},e.prototype.parse=function(t,e){if(this.version=t.word32le(),this.prev_hash=t.buffer(32),this.merkle_root=t.buffer(32),this.timestamp=t.word32le(),this.bits=t.word32le(),this.nonce=t.word32le(),this.txs=[],this.size=0,!e)for(var r=t.varInt(),i=0;r>i;i++){var o=new n;o.parse(t),this.txs.push(o)}},e.prototype.calcHash=function(){var t=this.getHeader();return i.twoSha256(t)},e.prototype.checkHash=function(){return this.hash&&this.hash.length?0==h.compare(this.calcHash(),this.hash):!1},e.prototype.getHash=function(){return this.hash&&this.hash.length||(this.hash=this.calcHash()),this.hash},e.prototype.checkProofOfWork=function(){var t=i.decodeDiffBits(this.bits),e=h.reverse(this.hash);if(h.compare(e,t)>0)throw new l("Difficulty target not met");return!0},e.prototype.getWork=function(){var t=i.decodeDiffBits(this.bits,!0);return f.largestHash.div(t.add(1))},e.prototype.checkTimestamp=function(){var t=(new Date).getTime()/1e3;if(this.timestamp>t+f.maxTimeOffset)throw new l("Timestamp too far into the future");return!0},e.prototype.checkTransactions=function(t){if(!Array.isArray(t)||t.length<=0)throw new l("No transactions");if(!t[0].isCoinBase())throw new l("First tx must be coinbase");for(var e=1;e<t.length;e++)if(t[e].isCoinBase())throw new l("Tx index "+e+" must not be coinbase");return!0},e.prototype.getMerkleTree=function(e){if(0==e.length)return[i.NULL_HASH.slice(0)];for(var r=e.map(function(t){return t instanceof n?t.getHash():t}),o=0,s=e.length;s>1;s=Math.floor((s+1)/2)){for(var h=0;s>h;h+=2){var a=Math.min(h+1,s-1),c=r[o+h],u=r[o+a];r.push(i.twoSha256(t.concat([c,u])))}o+=s}return r},e.prototype.calcMerkleRoot=function(t){var e=this.getMerkleTree(t);return e[e.length-1]},e.prototype.checkMerkleRoot=function(e){if(!this.merkle_root||!this.merkle_root.length)throw new l("No merkle root");if(0!==h.compare(this.calcMerkleRoot(e),new t(this.merkle_root)))throw new l("Merkle root incorrect");return!0},e.prototype.checkBlock=function(t){if(!this.checkHash())throw new l("Block hash invalid");if(this.checkProofOfWork(),this.checkTimestamp(),t&&(this.checkTransactions(t),!this.checkMerkleRoot(t)))throw new l("Merkle hash invalid");return!0},e.getBlockValue=function(t){var e=s(50).mul(i.COIN);return e=e.div(s(2).pow(Math.floor(t/21e4)))},e.prototype.getBlockValue=function(){return e.getBlockValue(this.height)},e.prototype.toString=function(){return"<Block "+i.formatHashAlt(this.hash)+" height="+this.height+">"},e.prototype.createCoinbaseTx=function(t){var e=new n;return e.ins.push(new a({s:i.EMPTY_BUFFER,q:4294967295,o:u})),e.outs.push(new c({v:i.bigIntToValue(this.getBlockValue()),s:o.createPubKeyOut(t).getBuffer()})),e},e.prototype.solve=function(t,e){var r=this.getHeader(),o=i.decodeDiffBits(this.bits);t.solve(r,o,e)},e.prototype.getStandardizedObject=function(t){var e={hash:i.formatHashFull(this.getHash()),version:this.version,prev_block:i.formatHashFull(this.prev_hash),mrkl_root:i.formatHashFull(this.merkle_root),time:this.timestamp,bits:this.bits,nonce:this.nonce,height:this.height};if(t){var r=this.getMerkleTree(t).map(function(t){return i.formatHashFull(t)});e.mrkl_root=r[r.length-1],e.n_tx=t.length;var o=80;o+=i.getVarIntSize(t.length),t=t.map(function(t){return t=t.getStandardizedObject(),o+=t.size,t}),e.size=o,e.tx=t,e.mrkl_tree=r}else e.size=this.size;return e},module.exports=require("soop")(e)}).call(this,require("buffer").Buffer);
},{"../util":143,"../util/error":142,"./Script":"hQ0t76","./Transaction":"LJhYtm","bignum":58,"binary":74,"buffer":85,"buffertools":"fugeBw","soop":129,"step":130}],"./lib/Bloom":[function(require,module,exports){
module.exports=require('KifRG4');
},{}],"KifRG4":[function(require,module,exports){
function Bloom(){this.data="",this.hashFuncs=0}function ROTL32(t,n){return t<<n|t>>32-n}function getBlockU32(t,n){var o=4*t,s=n[o+0]<<0|n[o+1]<<8|n[o+2]<<16|n[o+3]<<24;return s}function toInt(t){return~~t}function min(t,n){return n>t?t:n}var MAX_BLOOM_FILTER_SIZE=36e3,MAX_HASH_FUNCS=50,LN2SQUARED=.48045301391820144,LN2=.6931471805599453,bit_mask=[1,2,4,8,16,32,64,128];Bloom.prototype.hash=function(t,n){for(var o=t*(4294967295/(this.hashFuncs-1)),s=3432918353,a=461845907,h=n.length/4,i=-h;i;i++){var r=getBlockU32(i);r*=s,r=ROTLF32(r,15),r*=a,o^=r,o=ROTFL(o,13),o=5*o+3864292196}var e=n.slice(4*h),r=0;switch(3&n.length){case 3:r^=e[2]<<16;case 2:r^=e[1]<<8;case 1:r^=e[0],r*=s,r=ROTL32(r,15),r*=a,o^=r}return o^=n.length,o^=o>>16,o*=2246822507,o^=o>>13,o*=3266489909,o^=o>>16,o%(8*this.data.length)},Bloom.prototype.insert=function(t){for(var n=0;n<this.hashFuncs;n++){var o=this.hash(n,t);this.data[o>>3]|=bit_mask[7&o]}},Bloom.prototype.contains=function(t){for(var n=0;n<this.hashFuncs;n++){var o=this.hash(n,t);if(!(this.data[o>>3]&bit_mask[7&o]))return!1}return!0},Bloom.prototype.sizeOk=function(){return this.data.length<=MAX_BLOOM_FILTER_SIZE&&this.hashFuncs<=MAX_HASH_FUNCS},Bloom.prototype.init=function(t,n){var o=min(toInt(-1/LN2SQUARED*t*Math.log(n)),8*MAX_BLOOM_FILTER_SIZE)/8;this.data[o]=0,this.hashFuncs=min(toInt(8*this.data.length/t*LN2),MAX_HASH_FUNCS)},module.exports=require("soop")(Bloom);
},{"soop":129}],"./lib/Connection":[function(require,module,exports){
module.exports=require('DB/p3X');
},{}],"DB/p3X":[function(require,module,exports){
(function(e){function t(e,s,n){if(t.super(this,arguments),this.config=n||h,this.network=c[this.config.network]||c.livenet,this.socket=e,this.peer=s,this.config.proxy){var i=r.Socks5Client||require("socks5-client");this.socket=new i(this.config.proxy.host,this.config.proxy.port)}this.active=!1,this.recvVer=0,this.sendVer=0,this.bestHeight=0,this.inbound=!!this.socket.server,this.getaddr=!1,this.buffers=new a,(new Date).getTime()>1329696e6&&(this.recvVer=209,this.sendVer=209),this.setupHandlers()}var r=require("soop").imports(),s=r.log||require("../util/log"),n=1e7,i=7e4,o=r.Put||require("bufferput"),a=r.Buffers||require("buffers");require("../patches/Buffers.monkey").patch(a);var h=r.config||require("../config"),c=r.networks||require("../networks"),f=r.Block||require("./Block"),d=r.Transaction||require("./Transaction"),u=r.util||require("../util"),p=r.Parser||require("../util/BinaryParser"),g=r.buffertools||require("buffertools"),l=r.doubleSha256||u.twoSha256,v=r.SecureRandom||require("./SecureRandom"),b=v.getPseudoRandomBuffer(8),k=6e4;t.parent=r.parent||require("events").EventEmitter,t.prototype.open=function(e){return"function"==typeof e&&this.once("connect",e),this.socket.connect(this.peer.port,this.peer.host),this},t.prototype.setupHandlers=function(){this.socket.addListener("connect",this.handleConnect.bind(this)),this.socket.addListener("error",this.handleError.bind(this)),this.socket.addListener("end",this.handleDisconnect.bind(this)),this.socket.addListener("data",function(e){var t=35;s.debug("["+this.peer+"] Recieved "+e.length+" bytes of data:"),s.debug("... "+g.toHex(e.slice(0,t>e.length?e.length:t))+(e.length>t?"...":""))}.bind(this)),this.socket.addListener("data",this.handleData.bind(this))},t.prototype.handleConnect=function(){this.inbound||this.sendVersion(),this.emit("connect",{conn:this,socket:this.socket,peer:this.peer})},t.prototype.handleError=function(e){110==e.errno||"ETIMEDOUT"==e.errno?s.info("connection timed out for "+this.peer):111==e.errno||"ECONNREFUSED"==e.errno?s.info("connection refused for "+this.peer):s.warn("connection with "+this.peer+" "+e.toString()),this.emit("error",{conn:this,socket:this.socket,peer:this.peer,err:e})},t.prototype.handleDisconnect=function(){this.emit("disconnect",{conn:this,socket:this.socket,peer:this.peer})},t.prototype.handleMessage=function(t){if(t){try{switch(t.command){case"version":if(0===g.compare(b,t.nonce))return void this.socket.end();this.inbound&&this.sendVersion(),t.version>=209&&this.sendMessage("verack",new e([])),this.sendVer=Math.min(t.version,i),t.version<209?this.recvVer=Math.min(t.version,i):this.once("verack",function(){this.recvVer=t.version}.bind(this)),this.bestHeight=t.start_height;break;case"verack":this.recvVer=Math.min(t.version,i),this.active=!0;break;case"ping":"object"==typeof t.nonce&&this.sendPong(t.nonce)}}catch(r){return void s.err('Error while handling "'+t.command+'" message from '+this.peer+":\n"+(r.stack?r.stack:r.toString()))}this.emit(t.command,{conn:this,socket:this.socket,peer:this.peer,message:t})}},t.prototype.sendPong=function(e){this.sendMessage("pong",e)},t.prototype.sendVersion=function(){var t="/BitcoinX:0.1/",r=new o;r.word32le(i),r.word64le(1),r.word64le(Math.round((new Date).getTime()/1e3)),r.pad(26),r.pad(26),r.put(b),r.varint(t.length),r.put(new e(t,"ascii")),r.word32le(0),this.sendMessage("version",r.buffer())},t.prototype.sendGetBlocks=function(t,r,s){r=r||u.NULL_HASH;var n=new o;n.word32le(this.sendVer),n.varint(t.length);for(var i=0;i<t.length;i++){if(32!=t[i].length)throw new Error("Invalid hash length");n.put(t[i])}var a=new e(r,"binary");if(32!=a.length)throw new Error("Invalid hash length");n.put(a);var h="getblocks";s&&(h="getheaders"),this.sendMessage(h,n.buffer())},t.prototype.sendGetHeaders=function(e,t){this.sendGetBlocks(e,t,!0)},t.prototype.sendGetData=function(e){var t=new o;t.varint(e.length);for(var r=0;r<e.length;r++)t.word32le(e[r].type),t.put(e[r].hash);this.sendMessage("getdata",t.buffer())},t.prototype.sendGetAddr=function(){var e=new o;this.sendMessage("getaddr",e.buffer())},t.prototype.sendInv=function(e){Array.isArray(e)||(e=[e]);var t=new o;t.varint(e.length),e.forEach(function(e){t.word32le(e instanceof f?2:1),t.put(e.getHash())}),this.sendMessage("inv",t.buffer())},t.prototype.sendHeaders=function(e){var t=new o;t.varint(e.length),e.forEach(function(e){t.put(e),t.word8(0)}),this.sendMessage("headers",t.buffer())},t.prototype.sendTx=function(e){this.sendMessage("tx",e.serialize())},t.prototype.sendBlock=function(e,t){var r=new o;r.put(e.getHeader()),r.varint(t.length),t.forEach(function(e){r.put(e.serialize())}),this.sendMessage("block",r.buffer())},t.prototype.sendMessage=function(t,r){try{var n=this.network.magic,i=new e(t,"ascii");if(i.length>12)throw"Command name too long";var a;a=this.sendVer>=209?l(r).slice(0,4):new e([]);var h=new o;h.put(n),h.put(i),h.pad(12-i.length),h.word32le(r.length),h.put(a),h.put(r);var c=h.buffer();s.debug("["+this.peer+"] Sending message "+t+" ("+r.length+" bytes)"),this.socket.write(c)}catch(f){s.err("Error while sending message to peer "+this.peer+": "+(f.stack?f.stack:f.toString()))}},t.prototype.handleData=function(e){return this.buffers.push(e),this.buffers.length>n?(s.err("Peer "+this.peer+" exceeded maxreceivebuffer, disconnecting."+(err.stack?err.stack:err.toString())),void this.socket.destroy()):void this.processData()},t.prototype.processData=function(){if(!(this.buffers.length<20)){for(var e=this.network.magic,t=0;;){if(this.buffers.get(t)===e[0]&&this.buffers.get(t+1)===e[1]&&this.buffers.get(t+2)===e[2]&&this.buffers.get(t+3)===e[3]){0!==t&&(s.debug("["+this.peer+"] Received "+t+" bytes of inter-message garbage: "),s.debug("... "+this.buffers.slice(0,t)),this.buffers.skip(t));break}if(t>this.buffers.length-4)return void this.buffers.skip(t);t++}var r=this.buffers.get(16)+(this.buffers.get(17)<<8)+(this.buffers.get(18)<<16)+(this.buffers.get(19)<<24),n=this.recvVer>=209?24:20,i=n+r;if(!(this.buffers.length<i)){var o=this.buffers.slice(4,16).toString("ascii").replace(/\0+$/,""),a=this.buffers.slice(n,i),h=this.recvVer>=209?this.buffers.slice(20,24):null;if(s.debug("["+this.peer+"] Received message "+o+" ("+r+" bytes)"),null!==h){var c=l(a).slice(0,4);if(0!==g.compare(c,h))return void s.err("["+this.peer+"] Checksum failed",{cmd:o,expected:c.toString("hex"),actual:h.toString("hex")})}var f;try{f=this.parseMessage(o,a)}catch(d){s.err("Error while parsing message "+o+" from "+this.peer+":\n"+(d.stack?d.stack:d.toString()))}f&&this.handleMessage(f),this.buffers.skip(i),this.processData()}}},t.prototype.parseMessage=function(e,t){var r,n=new p(t),i={command:e};switch(e){case"version":i.version=n.word32le(),i.services=n.word64le(),i.timestamp=n.word64le(),i.addr_me=n.buffer(26),i.addr_you=n.buffer(26),i.nonce=n.buffer(8),i.subversion=n.varStr(),i.start_height=n.word32le();break;case"inv":case"getdata":for(i.count=n.varInt(),i.invs=[],r=0;r<i.count;r++)i.invs.push({type:n.word32le(),hash:n.buffer(32)});break;case"headers":for(i.count=n.varInt(),i.headers=[],r=0;r<i.count;r++){var o=new f;o.parse(n),i.headers.push(o)}break;case"block":var a=new f;a.parse(n),i.block=a,i.version=a.version,i.prev_hash=a.prev_hash,i.merkle_root=a.merkle_root,i.timestamp=a.timestamp,i.bits=a.bits,i.nonce=a.nonce,i.txs=a.txs,i.size=t.length;break;case"tx":var h=new d;return h.parse(n),{command:e,version:h.version,lock_time:h.lock_time,ins:h.ins,outs:h.outs,tx:h};case"getblocks":case"getheaders":i.version=n.word32le();var c=n.varInt();for(i.starts=[],r=0;c>r;r++)i.starts.push(n.buffer(32));i.stop=n.buffer(32);break;case"addr":var u=n.varInt();for(u>1e3&&(u=1e3),i.addrs=[],r=0;u>r;r++)i.addrs.push({time:n.word32le(),services:n.word64le(),ip:n.buffer(16),port:n.word16be()});break;case"alert":i.payload=n.varStr(),i.signature=n.varStr();break;case"ping":this.recvVer>k&&(i.nonce=n.buffer(8));break;case"getaddr":case"verack":case"reject":break;default:return s.err("Connection.parseMessage(): Command not implemented",{cmd:e}),null}return i},module.exports=require("soop")(t)}).call(this,require("buffer").Buffer);
},{"../config":"4itQ50","../networks":"ULNIu2","../patches/Buffers.monkey":"kytKTK","../util":143,"../util/BinaryParser":"b3ZSD7","../util/log":"AdF7pF","./Block":"pJEQEB","./SecureRandom":"p4SiC2","./Transaction":"LJhYtm","buffer":85,"bufferput":"aXRuS6","buffers":"OBo3aV","buffertools":"fugeBw","events":94,"socks5-client":122,"soop":129}],"./lib/Curve":[function(require,module,exports){
module.exports=require('Ynul1S');
},{}],"Ynul1S":[function(require,module,exports){
(function(F){"use strict";var e,r=require("soop"),u=r.bignum||require("bignum"),i=r.Point||require("./Point"),n=u.fromBuffer(new F("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141","hex"),{size:32}),B=function(){};B.getG=function(){return e=e||new i(u.fromBuffer(new F("79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798","hex"),{size:32}),u.fromBuffer(new F("483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8","hex"),{size:32}))},B.getN=function(){return n},module.exports=require("soop")(B)}).call(this,require("buffer").Buffer);
},{"./Point":"6tXgqr","bignum":58,"buffer":85,"soop":129}],"ez/meX":[function(require,module,exports){
exports.intFromCompact=function(r){var t=(r>>>24&255)>>>0,n=(16777215&r)<<8*(t-3)>>>0;return n};
},{}],"./lib/Deserialize":[function(require,module,exports){
module.exports=require('ez/meX');
},{}],"./lib/Electrum":[function(require,module,exports){
module.exports=require('hdzBvq');
},{}],"hdzBvq":[function(require,module,exports){
(function(e){function r(r){this.mpk=new e(r,"hex")}var t=require("./Key"),u=require("./Point"),n=require("../util").twoSha256,i=(require("buffertools"),require("bignum"));r.prototype.getSequence=function(r,t){var u=r?1:0,o=e.concat([new e(t+":"+u+":","utf8"),this.mpk]);return i.fromBuffer(n(o))},r.prototype.generatePubKey=function(r,n){var o=i.fromBuffer(this.mpk.slice(0,32),{size:32}),f=i.fromBuffer(this.mpk.slice(32,64),{size:32}),c=new u(o,f),p=this.getSequence(n,r),s=new t;s.private=p.toBuffer(),s.regenerateSync(),s.compressed=!1;var a=u.fromUncompressedPubKey(s.public);pt=u.add(c,a);var m=pt.x.toBuffer({size:32}),b=pt.y.toBuffer({size:32}),h=new e([4]),l=new t;return l.compressed=!1,l.public=e.concat([h,m,b]),l.public},r.prototype.generateChangePubKey=function(e){return this.generatePubKey(e,!0)},module.exports=r}).call(this,require("buffer").Buffer);
},{"../util":143,"./Key":"ALJ4PS","./Point":"6tXgqr","bignum":58,"buffer":85,"buffertools":"fugeBw"}],"./lib/HierarchicalKey":[function(require,module,exports){
module.exports=require('x1O6JW');
},{}],"x1O6JW":[function(require,module,exports){
(function(e){function i(e,i){if(e.length<i)throw new Error("not enough data");for(var t=0,n=0;i>n;n++)t*=256,t+=e[n];return t}function t(e){return i(e,1)}function n(e){return i(e,4)}var r=require("soop").imports(),s=r.base58||require("./Base58").base58,h=r.coinUtil||require("../util"),a=r.Key||require("./Key"),c=r.Point||require("./Point"),o=r.SecureRandom||require("./SecureRandom"),d=r.bignum||require("bignum"),l=require("../networks"),u=new d("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141",16),y=(new d("79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798",16),function(i){if("undefined"==typeof i||"mainnet"==i||"livenet"==i?(i="livenet",this.version=l.livenet.hkeyPrivateVersion):"testnet"==i&&(this.version=l.testnet.hkeyPrivateVersion),"livenet"==i||"testnet"==i)return this.depth=0,this.parentFingerprint=new e([0,0,0,0]),this.childIndex=new e([0,0,0,0]),this.chainCode=o.getRandomBuffer(32),this.eckey=a.generateSync(),this.hasPrivateKey=!0,this.pubKeyHash=h.sha256ripe160(this.eckey.public),this.buildExtendedPublicKey(),void this.buildExtendedPrivateKey();if("string"==typeof i){var t=s.decode(i);if(82!=t.length)throw new Error("Not enough data, expected 82 and received "+t.length);var n=t.slice(78,82);i=t.slice(0,78);var r=h.sha256(h.sha256(i));if(r[0]!=n[0]||r[1]!=n[1]||r[2]!=n[2]||r[3]!=n[3])throw new Error("Invalid checksum")}void 0!==i&&null!==i&&this.initFromBytes(i)});y.seed=function(i,t){if(t||(t="livenet"),e.isBuffer(i)||(i=new e(i,"hex")),i.length<16)return!1;if(i.length>64)return!1;var n=h.sha512hmac(i,new e("Bitcoin seed")),r=new y(null);return r.depth=0,r.parentFingerprint=new e([0,0,0,0]),r.childIndex=new e([0,0,0,0]),r.chainCode=n.slice(32,64),r.version=l[t].hkeyPrivateVersion,r.eckey=new a,r.eckey.private=n.slice(0,32),r.eckey.regenerateSync(),r.hasPrivateKey=!0,r.pubKeyHash=h.sha256ripe160(r.eckey.public),r.buildExtendedPublicKey(),r.buildExtendedPrivateKey(),r},y.prototype.initFromBytes=function(e){if(78!=e.length)throw new Error("not enough data");this.version=n(e.slice(0,4)),this.depth=t(e.slice(4,5)),this.parentFingerprint=e.slice(5,9),this.childIndex=n(e.slice(9,13)),this.chainCode=e.slice(13,45);var i=e.slice(45,78),r=this.version==l.livenet.hkeyPrivateVersion||this.version==l.testnet.hkeyPrivateVersion,s=this.version==l.livenet.hkeyPublicVersion||this.version==l.testnet.hkeyPublicVersion;if(r&&0==i[0])this.eckey=new a,this.eckey.private=i.slice(1,33),this.eckey.compressed=!0,this.eckey.regenerateSync(),this.pubKeyHash=h.sha256ripe160(this.eckey.public),this.hasPrivateKey=!0;else{if(!s||2!=i[0]&&3!=i[0])throw new Error("Invalid key");this.eckey=new a,this.eckey.public=i,this.pubKeyHash=h.sha256ripe160(this.eckey.public),this.hasPrivateKey=!1}this.buildExtendedPublicKey(),this.buildExtendedPrivateKey()},y.prototype.buildExtendedPublicKey=function(){this.extendedPublicKey=new e([]);var i=null;switch(this.version){case l.livenet.hkeyPublicVersion:case l.livenet.hkeyPrivateVersion:i=l.livenet.hkeyPublicVersion;break;case l.testnet.hkeyPublicVersion:case l.testnet.hkeyPrivateVersion:i=l.testnet.hkeyPublicVersion;break;default:throw new Error("Unknown version")}this.extendedPublicKey=e.concat([new e([i>>24]),new e([i>>16&255]),new e([i>>8&255]),new e([255&i]),new e([this.depth]),this.parentFingerprint,new e([this.childIndex>>>24]),new e([this.childIndex>>>16&255]),new e([this.childIndex>>>8&255]),new e([255&this.childIndex]),this.chainCode,this.eckey.public])},y.prototype.extendedPublicKeyString=function(i){if(void 0===i||"base58"===i){var t=h.sha256(h.sha256(this.extendedPublicKey)),n=t.slice(0,4),r=e.concat([this.extendedPublicKey,n]);return s.encode(r)}if("hex"===i)return this.extendedPublicKey.toString("hex");throw new Error("bad format")},y.prototype.buildExtendedPrivateKey=function(){if(this.hasPrivateKey){this.extendedPrivateKey=new e([]);var i=this.version;this.extendedPrivateKey=e.concat([new e([i>>24]),new e([i>>16&255]),new e([i>>8&255]),new e([255&i]),new e([this.depth]),this.parentFingerprint,new e([this.childIndex>>>24]),new e([this.childIndex>>>16&255]),new e([this.childIndex>>>8&255]),new e([255&this.childIndex]),this.chainCode,new e([0]),this.eckey.private])}},y.prototype.extendedPrivateKeyString=function(i){if(void 0===i||"base58"===i){var t=h.sha256(h.sha256(this.extendedPrivateKey)),n=t.slice(0,4),r=e.concat([this.extendedPrivateKey,n]);return s.encode(r)}if("hex"===i)return this.extendedPrivateKey.toString("hex");throw new Error("bad format")},y.prototype.derive=function(e){var i=e.split("/");if("m"==e||"M"==e||"m'"==e||"M'"==e)return this;var t=this;for(var n in i){var r=i[n];if(0!=n){var s=r.length>1&&"'"==r[r.length-1],h=2147483647&parseInt(s?r.slice(0,r.length-1):r);s&&(h+=2147483648),t=t.deriveChild(h)}else if("m"!=r)throw new Error("invalid path")}return t},y.prototype.deriveChild=function(i){var t=[];t.push(i>>24&255),t.push(i>>16&255),t.push(i>>8&255),t.push(255&i),t=new e(t);var n=0!=(2147483648&i),r=this.version==l.livenet.hkeyPrivateVersion||this.version==l.testnet.hkeyPrivateVersion;if(n&&(!this.hasPrivateKey||!r))throw new Error("Cannot do private key derivation without private key");var s=null;if(this.hasPrivateKey){var o=null;o=e.concat(n?[new e([0]),this.eckey.private,t]:[this.eckey.public,t]);var v=h.sha512hmac(o,this.chainCode),p=d.fromBuffer(v.slice(0,32),{size:32}),w=v.slice(32,64),b=d.fromBuffer(this.eckey.private,{size:32}),f=p.add(b).mod(u);s=new y(null),s.chainCode=w,s.eckey=new a,s.eckey.private=f.toBuffer({size:32}),s.eckey.regenerateSync(),s.hasPrivateKey=!0}else{var o=e.concat([this.eckey.public,t]),v=h.sha512hmac(o,this.chainCode),p=v.slice(0,32),w=v.slice(32,64),P=new a;P.private=p,P.regenerateSync(),P.compressed=!1;var k=c.fromUncompressedPubKey(P.public),F=new a;F.public=this.eckey.public,F.compressed=!1;var K=c.fromUncompressedPubKey(F.public),x=c.add(k,K).toUncompressedPubKey();s=new y(null),s.chainCode=new e(w);var m=new a;m.public=x,m.compressed=!0,s.eckey=m,s.hasPrivateKey=!1}return s.childIndex=i,s.parentFingerprint=this.pubKeyHash.slice(0,4),s.version=this.version,s.depth=this.depth+1,s.eckey.compressed=!0,s.pubKeyHash=h.sha256ripe160(s.eckey.public),s.buildExtendedPublicKey(),s.buildExtendedPrivateKey(),s},module.exports=require("soop")(y)}).call(this,require("buffer").Buffer);
},{"../networks":"ULNIu2","../util":143,"./Base58":"6VqyzY","./Key":"ALJ4PS","./Point":"6tXgqr","./SecureRandom":"p4SiC2","bignum":58,"buffer":85,"soop":129}],"CBDCgz":[function(require,module,exports){
(function(e){"use strict";var i=require("soop").imports(),n=i.coinUtil||require("../util"),r=i.Key||require("./Key"),t=function(){};t.sign=function(e,i){var n=t.magicHash(e),r=i.signSync(n);return r},t.verifyWithPubKey=function(e,i,n){var u=t.magicHash(i),c=new r;return 65==e.length&&(c.compressed=!1),c.public=e,c.verifySignatureSync(u,n)},t.magicBytes=new e("Bitcoin Signed Message:\n"),t.magicHash=function(i){var r=t.magicBytes,u=n.varIntBuf(r.length),c=new e(i),a=n.varIntBuf(c.length),s=e.concat([u,r,a,c]),o=n.twoSha256(s);return o},module.exports=require("soop")(t)}).call(this,require("buffer").Buffer);
},{"../util":143,"./Key":"ALJ4PS","buffer":85,"soop":129}],"./lib/Message":[function(require,module,exports){
module.exports=require('CBDCgz');
},{}],"./lib/Opcode":[function(require,module,exports){
module.exports=require('Zm7/h9');
},{}],"Zm7/h9":[function(require,module,exports){
function Opcode(O){this.code=O}var imports=require("soop").imports();Opcode.prototype.toString=function(){return Opcode.reverseMap[this.code]},Opcode.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_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},Opcode.reverseMap=[];for(var k in Opcode.map)Opcode.map.hasOwnProperty(k)&&(Opcode.reverseMap[Opcode.map[k]]=k.substr(3));Opcode.asList=function(){var O=[];for(var P in Opcode.map)Opcode.map.hasOwnProperty(P)&&O.push(P);return O},module.exports=require("soop")(Opcode);
},{"soop":129}],"./lib/Peer":[function(require,module,exports){
module.exports=require('oolY81');
},{}],"oolY81":[function(require,module,exports){
(function(t){function e(r,o,i){if("string"==typeof r){if(r.indexOf(":")&&!o){var n=r.split(":");r=n[0],o=n[1]}this.host=r,this.port=+o||8333}else if(r instanceof e)this.host=r.host,this.port=r.port;else{if(!t.isBuffer(r))throw new Error("Could not instantiate peer, invalid parameter type: "+typeof r);if(0!=s.compare(e.IPV6_IPV4_PADDING,r.slice(0,12)))throw new Error("IPV6 not supported yet! Cannot instantiate host.");this.host=Array.prototype.slice.apply(r.slice(12)).join("."),this.port=+o||8333}this.services=i?i:null,this.lastSeen=0}var r=require("soop").imports(),o=r.Net||require("net"),i=r.Binary||require("binary"),s=r.buffertools||require("buffertools");e.IPV6_IPV4_PADDING=new t([0,0,0,0,0,0,0,0,0,0,255,255]),e.prototype.createConnection=function(){return this.connection=o.createConnection(this.port,this.host),this.connection},e.prototype.getHostAsBuffer=function(){return new t(this.host.split("."))},e.prototype.toString=function(){return this.host+":"+this.port},e.prototype.toBuffer=function(){var t=i.put();return t.word32le(this.lastSeen),t.word64le(this.services),t.put(this.getHostAsBuffer()),t.word16be(this.port),t.buffer()},module.exports=require("soop")(e)}).call(this,require("buffer").Buffer);
},{"binary":74,"buffer":85,"buffertools":"fugeBw","net":81,"soop":129}],"nsqKeP":[function(require,module,exports){
function PeerManager(e){this.config=e||{};for(var n in bitcoreDefaults)bitcoreDefaults.hasOwnProperty(n)&&void 0===this.config[n]&&(this.config[n]=bitcoreDefaults[n]);this.active=!1,this.timer=null,this.peers=[],this.pool=[],this.connections=[],this.isConnected=!1,this.peerDiscovery=!1,this.interval=5e3,this.minConnections=8,this.minKnownPeers=10,this.seeds={resolved:[],failed:[]}}var imports=require("soop").imports(),log=imports.log||require("../util/log"),bitcoreDefaults=imports.config||require("../config"),Connection=imports.Connection||require("./Connection"),Peer=imports.Peer||require("./Peer");GetAdjustedTime=imports.GetAdjustedTime||function(){return Math.floor((new Date).getTime()/1e3)},PeerManager.parent=imports.parent||require("events").EventEmitter,PeerManager.Connection=Connection,PeerManager.prototype.start=function(){this.active=!0,this.timer||(this.timer=setInterval(this.checkStatus.bind(this),this.interval))},PeerManager.prototype.stop=function(){this.active=!1,this.timer&&(clearInterval(this.timer),this.timer=null);for(var e=0;e<this.connections.length;e++)this.connections[e].socket.end()},PeerManager.prototype.addPeer=function(e,n){if(e instanceof Peer)this.peers.push(e);else{if("string"!=typeof e)throw log.err("Node.addPeer(): Invalid value provided for peer",{val:e}),"Node.addPeer(): Invalid value provided for peer.";this.addPeer(new Peer(e,n))}},PeerManager.prototype.removePeer=function(e){var n=this.peers.indexOf(e),t=!!~n;return t&&this.peers.splice(n,1),t},PeerManager.prototype.checkStatus=function(){if(this.peers.length){var e={};this.peers.forEach(function(n){e[n.toString()]=n}),this.connections.forEach(function(n){var t=n.peer.toString();"undefined"!==e[t]&&delete e[t]});var n=0;this.peers.forEach(function(e){e.connection&&!e.connection._connecting&&n++}),log.debug(n+" of "+this.peers.length+" peers connected"),Object.keys(e).forEach(function(n){this.connectTo(e[n])}.bind(this))}},PeerManager.prototype.connectTo=function(e){log.info("connecting to "+e);try{return this.addConnection(e.createConnection(),e)}catch(n){return log.err("creating connection",n),null}},PeerManager.prototype.addConnection=function(e,n){var t=new Connection(e,n,this.config);return this.connections.push(t),this.emit("connection",t),t.addListener("version",this.handleVersion.bind(this)),t.addListener("verack",this.handleReady.bind(this)),t.addListener("addr",this.handleAddr.bind(this)),t.addListener("getaddr",this.handleGetAddr.bind(this)),t.addListener("error",this.handleError.bind(this)),t.addListener("disconnect",this.handleDisconnect.bind(this)),t},PeerManager.prototype.handleVersion=function(e){e.peer.version=e.message.version,e.peer.start_height=e.message.start_height,!e.conn.inbound,this.peerDiscovery&&(e.message.version>=31402||this.peers.length<1e3)&&(e.conn.sendGetAddr(),e.conn.getaddr=!0)},PeerManager.prototype.handleReady=function(e){log.info("connected to "+e.conn.peer.host+":"+e.conn.peer.port),this.emit("connect",{pm:this,conn:e.conn,socket:e.socket,peer:e.peer}),0==this.isConnected&&(this.emit("netConnected",e),this.isConnected=!0)},PeerManager.prototype.handleAddr=function(e){if(this.peerDiscovery){var n=GetAdjustedTime();e.message.addrs.forEach(function(e){try{(e.time<=1e8||e.time>n+600)&&(e.time=n-432e3);var t=new Peer(e.ip,e.port,e.services);t.lastSeen=e.time,this.peers.push(t)}catch(r){log.warn("Invalid addr received: "+r.message)}}.bind(this)),e.message.addrs.length<1e3&&(e.conn.getaddr=!1)}},PeerManager.prototype.handleGetAddr=function(){},PeerManager.prototype.handleError=function(e){log.err("unkown error with peer "+e.peer+" (disconnecting): "+e.err),this.handleDisconnect.apply(this,[].slice.call(arguments))},PeerManager.prototype.handleDisconnect=function(e){log.info("disconnected from peer "+e.peer);var n=this.connections.indexOf(e.conn);-1!=n&&this.connections.splice(n,1),this.removePeer(e.peer),this.pool.length&&(log.info("replacing peer using the pool of "+this.pool.length+" seeds"),this.addPeer(this.pool.pop())),this.connections.length||(this.emit("netDisconnected"),this.isConnected=!1)},PeerManager.prototype.getActiveConnection=function(){var e=this.connections.filter(function(e){return e.active});if(e.length){var n=Math.floor(Math.random()*e.length),t=e[n];return t.socket.writable?t:(e.splice(n,1),this.getActiveConnection())}return null},PeerManager.prototype.getActiveConnections=function(){return this.connections.slice(0)},PeerManager.prototype.discover=function(e,n){var t=this,r=imports.async||require("async"),i=imports.dns||require("dns"),o=imports.networks||require("../networks"),s=o[t.config.network].dnsSeeds;t.limit=e.limit||12;var c=s.map(function(e){return function(n){return~t.seeds.resolved.indexOf(e)?n(null,t.seeds.results[e]):~t.seeds.failed.indexOf(e)?n(null,[]):(log.info("resolving dns seed "+e),void i.resolve(e,function(r,i){return r?(log.err("failed to resolve dns seed "+e,r),t.seeds.failed.push(e),n(null,[])):(log.info("found "+i.length+" peers from "+e),t.seeds.resolved.push(e),i=i.map(function(e){return new Peer(e,o[t.config.network].defaultClientPort)}),i.forEach(function(e){t.peers.length<t.limit?t.addPeer(e):t.pool.push(e)}),t.emit("peers",i),n(null,i))}))}});return r.parallel(c,function(e,t){var r=[];t.forEach(function(e){r=r.concat(e)}),"function"==typeof n&&n(null,r)}),t},module.exports=require("soop")(PeerManager);
},{"../config":"4itQ50","../networks":"ULNIu2","../util/log":"AdF7pF","./Connection":"DB/p3X","./Peer":"oolY81","async":73,"dns":81,"events":94,"soop":129}],"./lib/PeerManager":[function(require,module,exports){
module.exports=require('nsqKeP');
},{}],"izTl9z":[function(require,module,exports){
(function(t){function e(t,i,r){e.super(this,arguments),void 0!==r&&this.compressed(r)}var i=require("soop").imports(),r=i.parent||require("../util/VersionedData"),n=i.networks||require("../networks");e.parent=r,r.applyEncodingsTo(e),e.prototype.validate=function(){if(this.doAsBinary(function(){if(e.super(this,"validate",arguments),this.data.length<32||this.data.length>33&&!this.compressed()||34==this.data.length&&1!=this.data[33]||this.data.length>34)throw new Error("invalid data length")}),"undefined"==typeof this.network())throw new Error("invalid network")},e.prototype.payload=function(t){if(t)return this.doAsBinary(function(){t.copy(this.data,1)}),t;var e=this.as("binary");return 34==e.length?e.slice(1,33):33==e.length?e.slice(1):void 0},e.prototype.compressed=function(e){if(void 0===e){var i=34,r=this.as("binary");if(r.length==i&&1==r[i-1])return!0;if(r.length==i-1)return!1;throw new Error("invalid private key")}this.doAsBinary(function(){var i=34;if(e){var r=new t(i);this.data.copy(r),this.data=r,this.data[i-1]=1}else this.data=this.data.slice(0,i-1)})},e.prototype.network=function(){var t,e=this.version(),i=n.livenet,r=n.testnet;return e===i.privKeyVersion?t=i:e===r.privKeyVersion&&(t=r),t},module.exports=require("soop")(e)}).call(this,require("buffer").Buffer);
},{"../networks":"ULNIu2","../util/VersionedData":"QLzNQg","buffer":85,"soop":129}],"./lib/PrivateKey":[function(require,module,exports){
module.exports=require('izTl9z');
},{}],"./lib/RpcClient":[function(require,module,exports){
module.exports=require('7siE1N');
},{}],"7siE1N":[function(require,module,exports){
(function(t){function e(t){t=t||{},this.host=t.host||"127.0.0.1",this.port=t.port||8332,this.user=t.user||"user",this.pass=t.pass||"pass",this.protocol="http"==t.protocol?n:i,this.batchedCalls=null,this.disableAgent=t.disableAgent||!1}function r(t,e,r){function s(t,e){return function(){var s=arguments.length-1;if(this.batchedCalls)var s=arguments.length;for(var o=0;s>o;o++)e[o]&&(arguments[o]=e[o](arguments[o]));this.batchedCalls?this.batchedCalls.push({jsonrpc:"2.0",method:t,params:c(arguments)}):r.call(this,{method:t,params:c(arguments,0,arguments.length-1)},arguments[arguments.length-1])}}var o={str:function(t){return t.toString()},"int":function(t){return parseFloat(t)},"float":function(t){return parseFloat(t)},bool:function(t){return t===!0||"1"==t||"true"==t||"true"==t.toString().toLowerCase()}};for(var n in e)if(e.hasOwnProperty(n)){for(var i=e[n].split(" "),a=0;a<i.length;a++)i[a]=o[i[a]]?o[i[a]]:o.string;var l=n.toLowerCase();t.prototype[n]=s(l,i),t.prototype[l]=t.prototype[n]}}function s(e,r){var e,s=this;e=JSON.stringify(e);var o=t(s.user+":"+s.pass).toString("base64"),n={host:s.host,path:"/",method:"POST",port:s.port,agent:s.disableAgent?!1:void 0};if(s.httpOptions)for(var i in s.httpOptions)n[i]=s.httpOptions[i];var l=null,c=this.protocol.request(n,function(t){var e="";t.on("data",function(t){e+=t}),t.on("end",function(){if(401==t.statusCode)return void r(new Error("bitcoin JSON-RPC connection rejected: 401 unauthorized"));if(403==t.statusCode)return void r(new Error("bitcoin JSON-RPC connection rejected: 403 forbidden"));if(l)return void r(l);try{var s=JSON.parse(e)}catch(o){return a.err(o.stack),a.err(e),a.err("HTTP Status code:"+t.statusCode),void r(o)}r(s.error,s)})});c.on("error",function(t){var e=new Error("Could not connect to bitcoin via RPC: "+t.message);a.err(e),r(e)}),c.setHeader("Content-Length",e.length),c.setHeader("Content-Type","application/json"),c.setHeader("Authorization","Basic "+o),c.write(e),c.end()}var o=require("soop").imports(),n=o.http||require("http"),i=o.https||require("https"),a=o.log||require("../util/log");e.prototype.batch=function(t,e){this.batchedCalls=[],t(),s.call(this,this.batchedCalls,e),this.batchedCalls=null};var l={addMultiSigAddress:"",addNode:"",backupWallet:"",createMultiSig:"",createRawTransaction:"",decodeRawTransaction:"",dumpPrivKey:"",encryptWallet:"",getAccount:"",getAccountAddress:"str",getAddedNodeInfo:"",getAddressesByAccount:"",getBalance:"str int",getBestBlockHash:"",getBlock:"",getBlockCount:"",getBlockHash:"int",getBlockNumber:"",getBlockTemplate:"",getConnectionCount:"",getDifficulty:"",getGenerate:"",getHashesPerSec:"",getInfo:"",getMemoryPool:"",getMiningInfo:"",getNewAddress:"",getPeerInfo:"",getRawMemPool:"",getRawTransaction:"str int",getReceivedByAccount:"str int",getReceivedByAddress:"str int",getTransaction:"",getTxOut:"str int bool",getTxOutSetInfo:"",getWork:"",help:"",importAddress:"str str bool",importPrivKey:"str str bool",keyPoolRefill:"",listAccounts:"int",listAddressGroupings:"",listReceivedByAccount:"int bool",listReceivedByAddress:"int bool",listSinceBlock:"str int",listTransactions:"str int int",listUnspent:"int int",listLockUnspent:"bool",lockUnspent:"",move:"str str float int str",sendFrom:"str str float int str str",sendMany:"str str int str",sendRawTransaction:"",sendToAddress:"str float str str",setAccount:"",setGenerate:"bool int",setTxFee:"float",signMessage:"",signRawTransaction:"",stop:"",submitBlock:"",validateAddress:"",verifyMessage:"",walletLock:"",walletPassPhrase:"string int",walletPassphraseChange:""},c=function(t,e,r){return Array.prototype.slice.call(t,e,r)};r(e,l,s),module.exports=require("soop")(e)}).call(this,require("buffer").Buffer);
},{"../util/log":"AdF7pF","buffer":85,"http":95,"https":99,"soop":129}],"./lib/SIN":[function(require,module,exports){
module.exports=require('tBM27q');
},{}],"tBM27q":[function(require,module,exports){
(function(t){function i(n,r){return"number"!=typeof n?void i.super(this,arguments):(this.data=new t(2+r.length),this.__proto__=this.encodings.binary,this.prefix(15),this.type(n),void this.payload(r))}var n=require("soop").imports(),r=n.parent||require("../util/VersionedData");i.parent=r,r.applyEncodingsTo(i),i.SIN_PERSIST_MAINNET=1,i.SIN_PERSIST_TESTNET=17,i.SIN_EPHEM=2,i.prototype.prefix=function(t){return t||0===t?(this.doAsBinary(function(){this.data.writeUInt8(t,0)}),t):this.as("binary").readUInt8(0)},i.prototype.type=function(t){return t||0===t?(this.doAsBinary(function(){this.data.writeUInt8(t,1)}),t):this.as("binary").readUInt8(1)},i.prototype.payload=function(t){return t?(this.doAsBinary(function(){t.copy(this.data,2)}),t):this.as("binary").slice(1)},i.prototype.validate=function(){this.doAsBinary(function(){if(i.super(this,"validate",arguments),22!=this.data.length)throw new Error("invalid data length")})},module.exports=require("soop")(i)}).call(this,require("buffer").Buffer);
},{"../util/VersionedData":"QLzNQg","buffer":85,"soop":129}],"EyghZQ":[function(require,module,exports){
function SINKey(e){"object"!=typeof e&&(e={}),this.created=e.created,this.privKey=e.privKey}var coinUtil=require("../util"),timeUtil=require("../util/time"),Key=require("./Key"),SIN=require("./SIN");SINKey.prototype.generate=function(){this.privKey=Key.generateSync(),this.created=timeUtil.curtime()},SINKey.prototype.pubkeyHash=function(){return coinUtil.sha256ripe160(this.privKey.public)},SINKey.prototype.storeObj=function(){var e=this.privKey.public.toString("hex"),t=this.pubkeyHash(),i=new SIN(SIN.SIN_EPHEM,t),r={created:this.created,priv:this.privKey.private.toString("hex"),pub:e,sin:i.toString()};return r},module.exports=require("soop")(SINKey);
},{"../util":143,"../util/time":146,"./Key":"ALJ4PS","./SIN":"tBM27q","soop":129}],"./lib/SINKey":[function(require,module,exports){
module.exports=require('EyghZQ');
},{}],"hQ0t76":[function(require,module,exports){
(function(t){function e(t){this.buffer=t?t:c.EMPTY_BUFFER,this.chunks=[],this.parse()}function r(t){return t==o.map.OP_0||t>=o.map.OP_1&&t<=o.map.OP_16}function n(t){return t<o.map.OP_PUSHDATA1?1:255>=t?2:65535>=t?3:5}function s(e){var r=void 0;return e<o.map.OP_PUSHDATA1?(r=new t(1),r.writeUInt8(e,0)):255>=e?(r=new t(2),r.writeUInt8(o.map.OP_PUSHDATA1,0),r.writeUInt8(e,1)):65535>=e?(r=new t(3),r.writeUInt8(o.map.OP_PUSHDATA2,0),r.writeUInt16LE(e,1)):(r=new t(5),r.writeUInt8(o.map.OP_PUSHDATA4,0),r.writeUInt32LE(e,1)),r}var u=require("soop").imports(),h=(u.config||require("../config"),u.log||require("../util/log")),o=u.Opcode||require("./Opcode"),f=u.buffertools||require("buffertools"),c=u.util||require("../util/util"),p=u.Parser||require("../util/BinaryParser"),a=u.Put||require("bufferput"),l=0,g=1,k=2,w=3,P=4,y=["unknown","pubkey","pubkeyhash","multisig","scripthash"];e.TX_UNKNOWN=l,e.TX_PUBKEY=g,e.TX_PUBKEYHASH=k,e.TX_MULTISIG=w,e.TX_SCRIPTHASH=P,e.prototype.parse=function(){this.chunks=[];for(var t=new p(this.buffer);!t.eof();){var e,r,n=t.word8();n>0&&n<o.map.OP_PUSHDATA1?this.chunks.push(t.buffer(n)):n===o.map.OP_PUSHDATA1?(e=t.word8(),r=t.buffer(e),this.chunks.push(r)):n===o.map.OP_PUSHDATA2?(e=t.word16le(),r=t.buffer(e),this.chunks.push(r)):n===o.map.OP_PUSHDATA4?(e=t.word32le(),r=t.buffer(e),this.chunks.push(r)):this.chunks.push(n)}},e.prototype.isPushOnly=function(){for(var e=0;e<this.chunks.length;e++){var r=this.chunks[e];if(!t.isBuffer(r)&&r>o.map.OP_16)return!1}return!0},e.prototype.isP2SH=function(){return 3==this.chunks.length&&this.chunks[0]==o.map.OP_HASH160&&t.isBuffer(this.chunks[1])&&20==this.chunks[1].length&&this.chunks[2]==o.map.OP_EQUAL},e.prototype.isPubkey=function(){return 2==this.chunks.length&&t.isBuffer(this.chunks[0])&&this.chunks[1]==o.map.OP_CHECKSIG},e.prototype.isPubkeyHash=function(){return 5==this.chunks.length&&this.chunks[0]==o.map.OP_DUP&&this.chunks[1]==o.map.OP_HASH160&&t.isBuffer(this.chunks[2])&&20==this.chunks[2].length&&this.chunks[3]==o.map.OP_EQUALVERIFY&&this.chunks[4]==o.map.OP_CHECKSIG},e.prototype.isMultiSig=function(){return this.chunks.length>3&&r(this.chunks[0])&&this.chunks.slice(1,this.chunks.length-2).every(function(e){return t.isBuffer(e)})&&r(this.chunks[this.chunks.length-2])&&this.chunks[this.chunks.length-1]==o.map.OP_CHECKMULTISIG},e.prototype.isP2shScriptSig=function(){if(!r(this.chunks[0])||0!==this.chunks[0])return!1;var t=new e(this.chunks[this.chunks.length-1]),n=t.classify();return n!==l},e.prototype.isMultiSigScriptSig=function(){return r(this.chunks[0])&&0===this.chunks[0]?!this.isP2shScriptSig():!1},e.prototype.countSignatures=function(){var t=0,e=this.chunks.length;return t=this.isMultiSigScriptSig()?e-1:this.isP2shScriptSig()?e-2:0===f.compare(this.getBuffer(),c.EMPTY_BUFFER)?0:1},e.prototype.countMissingSignatures=function(){if(this.isMultiSig())return h.debug("Can not count missing signatures on normal Multisig script"),null;var t=0,n=this.chunks.length;if(r(this.chunks[0])&&0===this.chunks[0]){var i=new e(this.chunks[n-1]);if(r(i.chunks[0])){var s=i.chunks[0]-80;t=s-(n-2)}else h.debug("Unrecognized script type")}else 0===f.compare(this.getBuffer(),c.EMPTY_BUFFER)&&(t=1);return t},e.prototype.finishedMultiSig=function(){var t=this.countMissingSignatures();return null===t?null:0===t},e.prototype.getMultiSigInfo=function(){if(!this.isMultiSig())throw new Error("Script.getMultiSigInfo(): Not a multiSig script.");for(var t=this.chunks[0]-80,e=this.chunks[this.chunks.length-2]-80,r=[],n=1;n<this.chunks.length-2;n++)r.push(this.chunks[n]);if(r.length!=e)throw new Error("Script.getMultiSigInfo(): Amount of PKs does not match what the script specifies.");return{nsigs:t,npubkeys:e,pubkeys:r}},e.prototype.prependOp0=function(){var t=[0];for(i in this.chunks)this.chunks.hasOwnProperty(i)&&t.push(this.chunks[i]);return this.chunks=t,this.updateBuffer(),this},e.prototype.classify=function(){return this.isPubkeyHash()?k:this.isP2SH()?P:this.isMultiSig()?w:this.isPubkey()?g:l},e.prototype.capture=function(){var t=this.classify(),e=[];switch(t){case g:e.push(this.chunks[0]);break;case k:e.push(this.chunks[2]);break;case w:for(var r=1;r<this.chunks.length-2;r++)e.push(this.chunks[r]);break;case P:e.push(this.chunks[1]);break;case l:}return e},e.prototype.captureOne=function(){var t=this.capture();return t[0]},e.prototype.getOutType=function(){var t=this.classify();switch(t){case g:return"Pubkey";case k:return"Address";default:return"Strange"}},e.prototype.getRawOutType=function(){return y[this.classify()]},e.prototype.simpleOutHash=function(){switch(this.getOutType()){case"Address":return this.chunks[2];case"Pubkey":return c.sha256ripe160(this.chunks[0]);default:return h.debug("Encountered non-standard scriptPubKey"),h.debug("Strange script was: "+this.toString()),null}},e.prototype.getInType=function(){return 1==this.chunks.length?"Pubkey":2==this.chunks.length&&t.isBuffer(this.chunks[0])&&t.isBuffer(this.chunks[1])?"Address":"Strange"},e.prototype.simpleInPubKey=function(){switch(this.getInType()){case"Address":return this.chunks[1];case"Pubkey":return null;default:return h.debug("Encountered non-standard scriptSig"),h.debug("Strange script was: "+this.toString()),null}},e.prototype.getBuffer=function(){return this.buffer},e.prototype.serialize=e.prototype.getBuffer,e.prototype.getStringContent=function(e,r){null===e&&(e=!0),"undefined"==typeof r&&(r=15);for(var n="",i=0,s=this.chunks.length;s>i;i++){var u=this.chunks[i];if(i>0&&(n+=" "),n+=t.isBuffer(u)?"0x"+c.formatBuffer(u,e?null:0):o.reverseMap[u],r&&i>r){n+=" ...";break}}return n},e.prototype.toString=function(t,e){var r="<Script ";return r+=this.getStringContent(t,e),r+=">"},e.prototype.writeOp=function(e){var r=t(this.buffer.length+1);this.buffer.copy(r),r.writeUInt8(e,this.buffer.length),this.buffer=r,this.chunks.push(e)},e.prototype.writeN=function(t){if(0>t||t>16)throw new Error("writeN: out of range value "+t);this.writeOp(0==t?o.map.OP_0:o.map.OP_1+t-1)},e.prototype.writeBytes=function(e){this.buffer.length+n(e.length)+e.length;this.buffer=t.concat([this.buffer,s(e.length),e]),this.chunks.push(e)},e.prototype.updateBuffer=function(){this.buffer=e.chunksToBuffer(this.chunks)},e.prototype.findAndDelete=function(e){var r=!1;if(t.isBuffer(e))for(var n=0,i=this.chunks.length;i>n;n++)t.isBuffer(this.chunks[n])&&0===f.compare(this.chunks[n],e)&&(this.chunks.splice(n,1),n--,r=!0);else{if("number"!=typeof e)throw new Error("Invalid chunk datatype.");for(var n=0,i=this.chunks.length;i>n;n++)this.chunks[n]===e&&(this.chunks.splice(n,1),n--,r=!0)}r&&this.updateBuffer()},e.createPubKeyOut=function(t){var r=new e;return r.writeBytes(t),r.writeOp(o.map.OP_CHECKSIG),r},e.createPubKeyHashOut=function(t){var r=new e;return r.writeOp(o.map.OP_DUP),r.writeOp(o.map.OP_HASH160),r.writeBytes(t),r.writeOp(o.map.OP_EQUALVERIFY),r.writeOp(o.map.OP_CHECKSIG),r},e._sortKeys=function(t){return t.sort(function(t,e){for(var r=t.length>t.length?t.length:e.length,n=0;r>=n;n++){if(void 0===t[n])return-1;if(void 0===e[n])return 1;if(t[n]<e[n])return-1;if(t[n]>e[n])return 1}return 0})},e.createMultisig=function(t,r,n){n=n||{};var i=n.noSorting?r:this._sortKeys(r),s=new e;return s.writeN(t),i.forEach(function(t){s.writeBytes(t)}),s.writeN(i.length),s.writeOp(o.map.OP_CHECKMULTISIG),s},e.createP2SH=function(t){var r=new e;return r.writeOp(o.map.OP_HASH160),r.writeBytes(t),r.writeOp(o.map.OP_EQUAL),r},e.fromTestData=function(r){r=r.map(function(e){return"string"==typeof e?new t(e,"hex"):e});var n=new e;return n.chunks=r,n.updateBuffer(),n},e.fromChunks=function(t){var r=new e;return r.chunks=t,r.updateBuffer(),r},e.fromHumanReadable=function(t){return new e(e.stringToBuffer(t))},e.prototype.toHumanReadable=function(){for(var e="",r=0,n=this.chunks.length;n>r;r++){var i=this.chunks[r];if(r>0&&(e+=" "),t.isBuffer(i))0===i.length?e+="0":(e+="0x"+c.formatBuffer(s(i.length),0)+" ",e+="0x"+c.formatBuffer(i,0));else{var u=o.reverseMap[i];"undefined"==typeof u&&(u="0x"+i.toString(16)),e+=u}}return e},e.stringToBuffer=function(r){for(var n=new a,i=r.split(" "),s=0;s<i.length;s++){var u=i[s];if(""!==u)if(u.length>2&&"0x"===u.substring(0,2))n.put(new t(u.substring(2,u.length),"hex"));else{var h=o.map["OP_"+u]||o.map[u];if("undefined"!=typeof h)n.word8(h);else{var f=parseInt(u);if(isNaN(f)){if("'"!==u[0]||"'"!==u[u.length-1])throw new Error('Could not parse word "'+u+'" from script "'+r+'"');u=u.substring(1,u.length-1),n.put(e.chunksToBuffer([new t(u)]))}else{var p=c.intToBufferSM(f);n.put(e.chunksToBuffer([p]))}}}}return n.buffer()},e.chunksToBuffer=function(e){for(var r=new a,n=0,i=e.length;i>n;n++){var s=e[n];if(t.isBuffer(s))s.length<o.map.OP_PUSHDATA1?r.word8(s.length):s.length<=255?(r.word8(o.map.OP_PUSHDATA1),r.word8(s.length)):s.length<=65535?(r.word8(o.map.OP_PUSHDATA2),r.word16le(s.length)):(r.word8(o.map.OP_PUSHDATA4),r.word32le(s.length)),r.put(s);else{if("number"!=typeof s)throw new Error("Script.chunksToBuffer(): Invalid chunk datatype");r.word8(s)}}return r.buffer()},module.exports=require("soop")(e)}).call(this,require("buffer").Buffer);
},{"../config":"4itQ50","../util/BinaryParser":"b3ZSD7","../util/log":"AdF7pF","../util/util":"ACyo5H","./Opcode":"Zm7/h9","buffer":85,"bufferput":"aXRuS6","buffertools":"fugeBw","soop":129}],"./lib/Script":[function(require,module,exports){
module.exports=require('hQ0t76');
},{}],"Q/ZWXW":[function(require,module,exports){
(function(a,t){function e(a){this.opts=a||{},this.stack=[],this.disableUnsafeOpcodes=!0}var s=require("soop").imports(),r=(s.config||require("../config"),s.log||require("../util/log"),s.util||require("../util"),s.Opcode||require("./Opcode")),i=s.buffertools||require("buffertools"),c=s.bignum||require("bignum"),o=s.Util||require("../util"),n=require("./Script"),p=require("./Key"),h=1,P=3,O=80,k=o.intToBufferSM,u=o.bufferSMToInt;e.prototype.eval=function(a,e,s,p,h){function P(h){function T(){if(j&&z>0){var a=X[Z],i=Y[J];_(a,i,x,e,s,p,function(a,t){!a&&t?(Z++,z--):(J++,q--,z>q&&(j=!1)),T.call(this)}.bind(this))}else{if(this.stack.push(new t([j?1:0])),S===r.map.OP_CHECKMULTISIGVERIFY){if(!j)throw new Error("OP_CHECKMULTISIGVERIFY negative");this.stackPop()}P.call(this,h)}}try{if(O>=a.chunks.length)return f.length?void h(new Error("Execution stack ended non-empty")):void h(null);var g=!~f.indexOf(!1),S=a.chunks[O++];if(S.length>520)throw new Error("Max push value size exceeded (>520)");if(S>r.map.OP_16&&++v>201)throw new Error("Opcode limit exceeded (>200)");if(this.disableUnsafeOpcodes&&"number"==typeof S&&(S===r.map.OP_CAT||S===r.map.OP_SUBSTR||S===r.map.OP_LEFT||S===r.map.OP_RIGHT||S===r.map.OP_INVERT||S===r.map.OP_AND||S===r.map.OP_OR||S===r.map.OP_XOR||S===r.map.OP_2MUL||S===r.map.OP_2DIV||S===r.map.OP_MUL||S===r.map.OP_DIV||S===r.map.OP_MOD||S===r.map.OP_LSHIFT||S===r.map.OP_RSHIFT))throw new Error("Encountered a disabled opcode");if(g&&t.isBuffer(S))this.stack.push(S);else if(g||r.map.OP_IF<=S&&S<=r.map.OP_ENDIF)switch(S){case r.map.OP_0:this.stack.push(new t([]));break;case r.map.OP_1NEGATE:case r.map.OP_1:case r.map.OP_2:case r.map.OP_3:case r.map.OP_4:case r.map.OP_5:case r.map.OP_6:case r.map.OP_7:case r.map.OP_8:case r.map.OP_9:case r.map.OP_10:case r.map.OP_11:case r.map.OP_12:case r.map.OP_13:case r.map.OP_14:case r.map.OP_15:case r.map.OP_16:var b=S-r.map.OP_1+1,d=k(b);this.stack.push(d);break;case r.map.OP_NOP:case r.map.OP_NOP1:case r.map.OP_NOP2:case r.map.OP_NOP3:case r.map.OP_NOP4:case r.map.OP_NOP5:case r.map.OP_NOP6:case r.map.OP_NOP7:case r.map.OP_NOP8:case r.map.OP_NOP9:case r.map.OP_NOP10:break;case r.map.OP_IF:case r.map.OP_NOTIF:var I=!1;g&&(I=m(this.stackPop()),S===r.map.OP_NOTIF&&(I=!I)),f.push(I);break;case r.map.OP_ELSE:if(f.length<1)throw new Error("Unmatched OP_ELSE");f[f.length-1]=!f[f.length-1];break;case r.map.OP_ENDIF:if(f.length<1)throw new Error("Unmatched OP_ENDIF");f.pop();break;case r.map.OP_VERIFY:var I=m(this.stackTop());if(!I)throw new Error("OP_VERIFY negative");this.stackPop();break;case r.map.OP_RETURN:throw new Error("OP_RETURN");case r.map.OP_TOALTSTACK:E.push(this.stackPop());break;case r.map.OP_FROMALTSTACK:if(E.length<1)throw new Error("OP_FROMALTSTACK with alt stack empty");this.stack.push(E.pop());break;case r.map.OP_2DROP:this.stackPop(),this.stackPop();break;case r.map.OP_2DUP:var R=this.stackTop(2),N=this.stackTop(1);this.stack.push(R),this.stack.push(N);break;case r.map.OP_3DUP:var R=this.stackTop(3),N=this.stackTop(2),A=this.stackTop(1);this.stack.push(R),this.stack.push(N),this.stack.push(A);break;case r.map.OP_2OVER:var R=this.stackTop(4),N=this.stackTop(3);this.stack.push(R),this.stack.push(N);break;case r.map.OP_2ROT:var R=this.stackTop(6),N=this.stackTop(5);this.stack.splice(this.stack.length-6,2),this.stack.push(R),this.stack.push(N);break;case r.map.OP_2SWAP:this.stackSwap(4,2),this.stackSwap(3,1);break;case r.map.OP_IFDUP:var I=this.stackTop();m(I)&&this.stack.push(I);break;case r.map.OP_DEPTH:var I=c(this.stack.length);this.stack.push(k(I));break;case r.map.OP_DROP:this.stackPop();break;case r.map.OP_DUP:this.stack.push(this.stackTop());break;case r.map.OP_NIP:if(this.stack.length<2)throw new Error("OP_NIP insufficient stack size");this.stack.splice(this.stack.length-2,1);break;case r.map.OP_OVER:this.stack.push(this.stackTop(2));break;case r.map.OP_PICK:case r.map.OP_ROLL:var U=l(this.stackPop());if(0>U||U>=this.stack.length)throw new Error("OP_PICK/OP_ROLL insufficient stack size");var I=this.stackTop(U+1);S===r.map.OP_ROLL&&this.stack.splice(this.stack.length-U-1,1),this.stack.push(I);break;case r.map.OP_ROT:this.stackSwap(3,2),this.stackSwap(2,1);break;case r.map.OP_SWAP:this.stackSwap(2,1);break;case r.map.OP_TUCK:if(this.stack.length<2)throw new Error("OP_TUCK insufficient stack size");this.stack.splice(this.stack.length-2,0,this.stackTop());break;case r.map.OP_CAT:var R=this.stackTop(2),N=this.stackTop(1);this.stackPop(),this.stackPop(),this.stack.push(t.concat([R,N]));break;case r.map.OP_SUBSTR:var L=this.stackTop(3),y=l(this.stackTop(2)),H=l(this.stackTop(1));if(0>y||0>H)throw new Error("OP_SUBSTR start < 0 or len < 0");if(y+H>=L.length)throw new Error("OP_SUBSTR range out of bounds");this.stackPop(),this.stackPop(),this.stack[this.stack.length-1]=L.slice(y,y+H);break;case r.map.OP_LEFT:case r.map.OP_RIGHT:var L=this.stackTop(2),F=l(this.stackTop(1));if(0>F)throw new Error("OP_LEFT/OP_RIGHT size < 0");F>L.length&&(F=L.length),this.stackPop(),this.stack[this.stack.length-1]=S===r.map.OP_LEFT?L.slice(0,F):L.slice(L.length-F);break;case r.map.OP_SIZE:var I=c(this.stackTop().length);this.stack.push(k(I));break;case r.map.OP_INVERT:for(var L=this.stackTop(),C=0,D=L.length;D>C;C++)L[C]=~L[C];break;case r.map.OP_AND:case r.map.OP_OR:case r.map.OP_XOR:var R=this.stackTop(2),N=this.stackTop(1);this.stackPop(),this.stackPop();var M=new t(Math.max(R.length,N.length));if(S===r.map.OP_AND)for(var C=0,D=M.length;D>C;C++)M[C]=R[C]&N[C];else if(S===r.map.OP_OR)for(var C=0,D=M.length;D>C;C++)M[C]=R[C]|N[C];else if(S===r.map.OP_XOR)for(var C=0,D=M.length;D>C;C++)M[C]=R[C]^N[C];this.stack.push(M);break;case r.map.OP_EQUAL:case r.map.OP_EQUALVERIFY:var R=this.stackTop(2),N=this.stackTop(1),I=0===i.compare(R,N);if(this.stackPop(),this.stackPop(),this.stack.push(new t([I?1:0])),S===r.map.OP_EQUALVERIFY){if(!I)throw new Error("OP_EQUALVERIFY negative");this.stackPop()}break;case r.map.OP_1ADD:case r.map.OP_1SUB:case r.map.OP_2MUL:case r.map.OP_2DIV:case r.map.OP_NEGATE:case r.map.OP_ABS:case r.map.OP_NOT:case r.map.OP_0NOTEQUAL:var V=u(this.stackTop());switch(S){case r.map.OP_1ADD:V=V.add(c(1));break;case r.map.OP_1SUB:V=V.sub(c(1));break;case r.map.OP_2MUL:V=V.mul(c(2));break;case r.map.OP_2DIV:V=V.div(c(2));break;case r.map.OP_NEGATE:V=V.neg();break;case r.map.OP_ABS:V=V.abs();break;case r.map.OP_NOT:V=c(0==V.cmp(0)?1:0);break;case r.map.OP_0NOTEQUAL:V=c(0==V.cmp(0)?0:1)}this.stack[this.stack.length-1]=k(V);break;case r.map.OP_ADD:case r.map.OP_SUB:case r.map.OP_MUL:case r.map.OP_DIV:case r.map.OP_MOD:case r.map.OP_LSHIFT:case r.map.OP_RSHIFT:case r.map.OP_BOOLAND:case r.map.OP_BOOLOR:case r.map.OP_NUMEQUAL:case r.map.OP_NUMEQUALVERIFY:case r.map.OP_NUMNOTEQUAL:case r.map.OP_LESSTHAN:case r.map.OP_GREATERTHAN:case r.map.OP_LESSTHANOREQUAL:case r.map.OP_GREATERTHANOREQUAL:case r.map.OP_MIN:case r.map.OP_MAX:var V,R=u(this.stackTop(2)),N=u(this.stackTop(1));switch(S){case r.map.OP_ADD:V=R.add(N);break;case r.map.OP_SUB:V=R.sub(N);break;case r.map.OP_MUL:V=R.mul(N);break;case r.map.OP_DIV:V=R.div(N);break;case r.map.OP_MOD:V=R.mod(N);break;case r.map.OP_LSHIFT:if(N.cmp(0)<0||N.cmp(2048)>0)throw new Error("OP_LSHIFT parameter out of bounds");V=R.shiftLeft(N);break;case r.map.OP_RSHIFT:if(N.cmp(0)<0||N.cmp(2048)>0)throw new Error("OP_RSHIFT parameter out of bounds");V=R.shiftRight(N);break;case r.map.OP_BOOLAND:V=c(0!=R.cmp(0)&&0!=N.cmp(0)?1:0);break;case r.map.OP_BOOLOR:V=c(0!=R.cmp(0)||0!=N.cmp(0)?1:0);break;case r.map.OP_NUMEQUAL:case r.map.OP_NUMEQUALVERIFY:V=c(0==R.cmp(N)?1:0);break;case r.map.OP_NUMNOTEQUAL:V=c(0!=R.cmp(N)?1:0);break;case r.map.OP_LESSTHAN:V=c(R.lt(N)?1:0);break;case r.map.OP_GREATERTHAN:V=c(R.gt(N)?1:0);break;case r.map.OP_LESSTHANOREQUAL:V=c(R.gt(N)?0:1);break;case r.map.OP_GREATERTHANOREQUAL:V=c(R.lt(N)?0:1);break;case r.map.OP_MIN:V=R.lt(N)?R:N;break;case r.map.OP_MAX:V=R.gt(N)?R:N}if(this.stackPop(),this.stackPop(),this.stack.push(k(V)),S===r.map.OP_NUMEQUALVERIFY){if(!m(this.stackTop()))throw new Error("OP_NUMEQUALVERIFY negative");this.stackPop()}break;case r.map.OP_WITHIN:var R=u(this.stackTop(3)),N=u(this.stackTop(2)),A=u(this.stackTop(1));this.stackPop(),this.stackPop(),this.stackPop();var I=R.cmp(N)>=0&&R.cmp(A)<0;this.stack.push(k(I?1:0));break;case r.map.OP_RIPEMD160:case r.map.OP_SHA1:case r.map.OP_SHA256:case r.map.OP_HASH160:case r.map.OP_HASH256:var B,I=this.stackPop();S===r.map.OP_RIPEMD160?B=o.ripe160(I):S===r.map.OP_SHA1?B=o.sha1(I):S===r.map.OP_SHA256?B=o.sha256(I):S===r.map.OP_HASH160?B=o.sha256ripe160(I):S===r.map.OP_HASH256&&(B=o.twoSha256(I)),this.stack.push(B);break;case r.map.OP_CODESEPARATOR:w=O;break;case r.map.OP_CHECKSIG:case r.map.OP_CHECKSIGVERIFY:var G=this.stackTop(2),K=this.stackTop(1),Q=a.chunks.slice(w),x=n.fromChunks(Q);return x.findAndDelete(G),this.isCanonicalSignature(new t(G)),void _(G,K,x,e,s,p,function(a,e){var s;if(s=a?!1:e,this.stackPop(),this.stackPop(),this.stack.push(new t([s?1:0])),S===r.map.OP_CHECKSIGVERIFY){if(!s)throw new Error("OP_CHECKSIGVERIFY negative");this.stackPop()}P.call(this,h)}.bind(this));case r.map.OP_CHECKMULTISIG:case r.map.OP_CHECKMULTISIGVERIFY:var q=l(this.stackPop());if(0>q||q>20)throw new Error("OP_CHECKMULTISIG keysCount out of bounds");if(v+=q,v>201)throw new Error("Opcode limit exceeded (>200)");for(var Y=[],C=0,D=q;D>C;C++){var K=this.stackPop();Y.push(K)}var z=l(this.stackPop());if(0>z||z>q)throw new Error("OP_CHECKMULTISIG sigsCount out of bounds");for(var X=[],C=0,D=z;D>C;C++)X.push(this.stackPop());this.stackPop();var Q=a.chunks.slice(w),x=n.fromChunks(Q),W=this;X.forEach(function(a){W.isCanonicalSignature(new t(a)),x.findAndDelete(a)});var j=!0,Z=0,J=0;return void T.call(this);default:throw new Error("Unknown opcode encountered")}if(this.stack.length+E.length>1e3)throw new Error("Maximum stack size exceeded");P.call(this,h)}catch($){h($)}}if("function"!=typeof h)throw new Error("ScriptInterpreter.eval() requires a callback");var O=0,f=[],E=[],w=0,v=0;return a.buffer.length>1e4?(h(new Error("Oversized script (> 10k bytes)")),this):void P.call(this,h)},e.prototype.evalTwo=function(a,t,e,s,r,i){var c=this;c.eval(a,e,s,r,function(a){return a?void i(a):void c.eval(t,e,s,r,i)})},e.prototype.stackTop=function(a){if(a=+a||1,1>a&&(a=1),a>this.stack.length)throw new Error("ScriptInterpreter.stackTop(): Stack underrun");return this.stack[this.stack.length-a]},e.prototype.stackBack=function(){return this.stack[this.stack.length-1]},e.prototype.stackPop=function(){if(this.stack.length<1)throw new Error("ScriptInterpreter.stackTop(): Stack underrun");return this.stack.pop()},e.prototype.stackSwap=function(a,t){if(this.stack.length<a||this.stack.length<t)throw new Error("ScriptInterpreter.stackTop(): Stack underrun");var e=this.stack,s=e.length,r=e[s-a];e[s-a]=e[s-t],e[s-t]=r},e.prototype.getPrimitiveStack=function(){return this.stack.map(function(a){if(a.length>2)return i.toHex(a.slice(0));var t=u(a);return t.cmp(-128)>=0&&t.cmp(127)<=0?t.toNumber():i.toHex(a.slice(0))})};var m=e.castBool=function(a){for(var t=0,e=a.length;e>t;t++)if(0!=a[t])return t==e-1&&128==a[t]?!1:!0;return!1},l=e.castInt=function(a){return u(a).toNumber()};e.prototype.getResult=function(){if(0===this.stack.length)throw new Error("Empty stack after script evaluation");return m(this.stack[this.stack.length-1])},e.verify=function(a,t,s,r,i,c){if("function"!=typeof c)throw new Error("ScriptInterpreter.verify() requires a callback");var o=new e;return o.evalTwo(a,t,s,r,i,function(a){if(a)return void c(a);var t=o.getResult();c(null,t)}),o},e.prototype.verifyStep4=function(a,t){return 0==t.stack.length?void a(null,!1):void a(null,m(t.stackBack()))},e.prototype.verifyStep3=function(a,t,e,s,r,i,c){if(0===this.stack.length)return void i(null,!1);if(0==m(this.stackBack()))return void i(null,!1);if(!this.opts.verifyP2SH||!t.isP2SH())return void i(null,!0);if(!a.isPushOnly())return void i(null,!1);if(0===c.length)throw new Error("siCopy should have length != 0");var o=new n(c.stackPop()),p=this;c.eval(o,e,s,r,function(a){return a?i(a):void p.verifyStep4(i,c)})},e.prototype.verifyStep2=function(a,t,s,r,i,c,o){var o;this.opts.verifyP2SH&&(o=new e(this.opts),this.stack.forEach(function(a){o.stack.push(a)}));var n=this;this.eval(t,s,r,i,function(e){return e?c(e):void n.verifyStep3(a,t,s,r,i,c,o)})},e.prototype.verifyFull=function(a,t,e,s,r,i){var c=this;this.eval(a,e,s,r,function(o){return o?i(o):void c.verifyStep2(a,t,e,s,r,i)})},e.verifyFull=function(a,t,s,r,i,c,o){var n=new e(c);n.verifyFull(a,t,s,r,i,o)};var _=e.checkSig=function(a,e,s,r,i,c,o){if(!a.length)return void o(null,!1);if(0===c)c=a[a.length-1];else if(c!=a[a.length-1])return void o(null,!1);a=a.slice(0,a.length-1);var n=r.hashForSignature(s,i,c),h=new p;0===e.length&&(e=new t("00","hex")),h.public=e,h.verifySignature(n,a,o)};e.prototype.isCanonicalSignature=function(a){if(!t.isBuffer(a))throw new Error("arg should be a Buffer");if(this.opts.dontVerifyStrictEnc)return!0;var e=a.length;if(9>e)throw new Error("Non-canonical signature: too short");if(e>73)throw new Error("Non-canonical signature: too long");var s=a[e-1]&~O;if(h>s||s>P)throw new Error("Non-canonical signature: unknown hashtype byte");if(48!==a[0])throw new Error("Non-canonical signature: wrong type");if(a[1]!==e-3)throw new Error("Non-canonical signature: wrong length marker");var r=a[3];if(5+r>=e)throw new Error("Non-canonical signature: S length misplaced");var i=a[5+r];if(r+i+7!==e)throw new Error("Non-canonical signature: R+S length mismatch");var c=4,o=new t(r);if(a.copy(o,0,c,c+r),2!==a[c-2])throw new Error("Non-canonical signature: R value type mismatch");if(0==r)throw new Error("Non-canonical signature: R length is zero");if(128&o[0])throw new Error("Non-canonical signature: R value negative");if(r>1&&0==o[0]&&!(128&o[1]))throw new Error("Non-canonical signature: R value excessively padded");var n=6+r,p=new t(i);if(a.copy(p,0,n,n+i),2!=a[n-2])throw new Error("Non-canonical signature: S value type mismatch");if(0==i)throw new Error("Non-canonical signature: S length is zero");if(128&p[0])throw new Error("Non-canonical signature: S value negative");if(i>1&&0==p[0]&&!(128&p[1]))throw new Error("Non-canonical signature: S value excessively padded");if(this.opts.verifyEvenS&&1&p[i-1])throw new Error("Non-canonical signature: S value odd");return!0},module.exports=require("soop")(e)}).call(this,require("/Users/ryanxcharles/dev/bitcore/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),require("buffer").Buffer);
},{"../config":"4itQ50","../util":143,"../util/log":"AdF7pF","./Key":"ALJ4PS","./Opcode":"Zm7/h9","./Script":"hQ0t76","/Users/ryanxcharles/dev/bitcore/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":101,"bignum":58,"buffer":85,"buffertools":"fugeBw","soop":129}],"./lib/ScriptInterpreter":[function(require,module,exports){
module.exports=require('Q/ZWXW');
},{}],"./lib/Sign":[function(require,module,exports){
module.exports=require('V3JdDp');
},{}],"V3JdDp":[function(require,module,exports){
(function(r){function e(e,n,t){var i=t[n],s=new r(i.priv,"hex"),o=new KeyModule.Key;o.private=s;var a=o.signSync(e);return a}function n(n,t,i,s,o,a){var u=t.ins[n],h=u.getScript(),w=u.getOutpointHash();if(!(w in i))throw new Error("signTxIn missing input hash");var c=i[w],d=u.getOutpointIndex();if(c.outs.length>=d)throw new Error("signTxIn missing input index");var f=c.outs[d],p=f.getScript(),g=p.classify();if(g==TX_UNKNOWN)throw new Error("unknown TX type");var v=p.capture(),k=void 0,y=void 0,l=void 0,S=void 0;if(g==TX_SCRIPTHASH){var T=new Address(s.P2SHVersion,v[0]),E=T.toString();if(!(E in a))throw new Error("unknown script hash address");if(k=new r(a[E],"hex"),y=new Script(k),l=y.classify(),l==TX_UNKNOWN)throw new Error("unknown subscript TX type");S=y.capture()}var B=t.hashForSignature(p,X,0);switch(g){case TX_PUBKEY:if(h.chunks.length>0)return;var b=util.sha256ripe160(v[0]),T=new Address(s.addressVersion,b),E=T.toString();if(!(E in o))throw new Error("unknown pubkey");var H=e(B,E,o);h.writeBytes(H);break;case TX_PUBKEYHASH:if(h.chunks.length>0)return;var T=new Address(s.addressVersion,v[0]),E=T.toString();if(!(E in o))throw new Error("unknown pubkey hash address");var H=e(B,E,o);h.writeBytes(H),h.writeBytes(key.public);break;case TX_SCRIPTHASH:if(h.chunks.length>0)return;var T=new Address(s.addressVersion,S[0]),E=T.toString();if(!(E in o))throw new Error("unknown script(pubkey hash) address");var H=e(B,E,o);h.writeBytes(H),h.writeBytes(key.public);break;case TX_MULTISIG:for(;h.chunks.length<v.length;)h.writeBytes(util.EMPTY_BUFFER);for(var X=0;X<v.length;X++)if(!(h.chunks[X].length>0)){var b=util.sha256ripe160(h.chunks[X]),T=new Address(s.addressVersion,b),E=T.toString();if(E in o){var H=e(B,E,o);h.chunks[X]=H}}}txtype==TX_SCRIPTHASH&&h.writeBytes(k)}exports.Transaction=function(r,e,t,i,s){for(var o=0;o<r.ins.length;o++)n(o,r,e,t,i,s)}}).call(this,require("buffer").Buffer);
},{"buffer":85}],"./lib/Transaction":[function(require,module,exports){
module.exports=require('LJhYtm');
},{}],"LJhYtm":[function(require,module,exports){
(function(t){function e(e){if("object"!=typeof e&&(e={}),e.o)this.o=e.o;else if(e.oTxHash&&"undefined"!=typeof e.oIndex&&e.oIndex>=0){var i=new t(e.oTxHash,"hex");i=c.reverse(i);var s=new t(4);s.writeUInt32LE(e.oIndex,0),this.o=t.concat([i,s])}this.s=t.isBuffer(e.s)?e.s:t.isBuffer(e.script)?e.script:u.EMPTY_BUFFER,this.q=e.q?e.q:e.sequence}function i(t){"object"!=typeof t&&(t={}),this.v=t.v?t.v:t.value,this.s=t.s?t.s:t.script}function s(t){"object"!=typeof t&&(t={}),this.hash=t.hash||null,this.version=t.version,this.lock_time=t.lock_time,this.ins=Array.isArray(t.ins)?t.ins.map(function(t){var i=new e;return i.s=t.s,i.q=t.q,i.o=t.o,i}):[],this.outs=Array.isArray(t.outs)?t.outs.map(function(t){var e=new i;return e.v=t.v,e.s=t.s,e}):[],t.buffer&&(this._buffer=t.buffer)}{var r=require("soop").imports(),n=(r.config||require("../config"),r.log||require("../util/log"),r.Address||require("./Address")),o=r.Script||require("./Script"),h=r.ScriptInterpreter||require("./ScriptInterpreter"),u=r.util||require("../util"),a=r.bignum||require("bignum"),f=r.Put||require("bufferput"),p=r.Parser||require("../util/BinaryParser"),c=(r.Step||require("step"),r.buffertools||require("buffertools")),l=(r.error||require("../util/error"),r.networks||require("../networks"),r.WalletKey||require("./WalletKey"),r.PrivateKey||require("./PrivateKey"),t.concat([u.NULL_HASH,new t("FFFFFFFF","hex")]));parseInt(1e-4*u.COIN)}s.COINBASE_OP=l,e.MAX_SEQUENCE=4294967295,e.prototype.getScript=function(){return new o(this.s)},e.prototype.isCoinBase=function(){return this.o?0===c.compare(new t(this.o),l):!1},e.prototype.serialize=function(){var e=u.varIntBuf(this.s.length),i=new t(4);i.writeUInt32LE(this.q,0);var s=t.concat([this.o,e,this.s,i]);return s},e.prototype.getOutpointHash=function(){return"undefined"!=typeof this.o.outHashCache?this.o.outHashCache:this.o.outHashCache=this.o.slice(0,32)},e.prototype.getOutpointIndex=function(){return this.o[32]+(this.o[33]<<8)+(this.o[34]<<16)+(this.o[35]<<24)},e.prototype.setOutpointIndex=function(t){this.o[32]=255&t,this.o[33]=t>>8&255,this.o[34]=t>>16&255,this.o[35]=t>>24&255},i.prototype.getValue=function(){return new p(this.v).word64lu()},i.prototype.getScript=function(){return new o(this.s)},i.prototype.serialize=function(){var e=u.varIntBuf(this.s.length);return t.concat([this.v,e,this.s])},s.In=e,s.Out=i,s.prototype.isCoinBase=function(){return 1==this.ins.length&&this.ins[0].isCoinBase()},s.prototype.isStandard=function(){var t;for(t=0;t<this.ins.length;t++)if("Strange"==this.ins[t].getScript().getInType())return!1;for(t=0;t<this.outs.length;t++)if("Strange"==this.outs[t].getScript().getOutType())return!1;return!0},s.prototype.serialize=function(){var e=[],i=new t(4);i.writeUInt32LE(this.version,0),e.push(i),e.push(u.varIntBuf(this.ins.length)),this.ins.forEach(function(t){e.push(t.serialize())}),e.push(u.varIntBuf(this.outs.length)),this.outs.forEach(function(t){e.push(t.serialize())});var i=new t(4);return i.writeUInt32LE(this.lock_time,0),e.push(i),this._buffer=t.concat(e),this._buffer},s.prototype.getBuffer=function(){return this._buffer?this._buffer:this.serialize()},s.prototype.calcHash=function(){return this.hash=u.twoSha256(this.getBuffer()),this.hash},s.prototype.checkHash=function(){return this.hash&&this.hash.length?0===c.compare(this.calcHash(),this.hash):!1},s.prototype.getHash=function(){return this.hash&&this.hash.length||(this.hash=this.calcHash()),this.hash},s.prototype.calcNormalizedHash=function(){return this.normalizedHash=this.hashForSignature(new o,0,g),this.normalizedHash},s.prototype.getNormalizedHash=function(){return this.normalizedHash&&this.normalizedHash.length||(this.normalizedHash=this.calcNormalizedHash()),this.normalizedHash},s.prototype.inputs=function(){for(var t=[],e=0;e<this.ins.length;e++){var i=this.ins[e],s=i.getOutpointHash(),r=i.getOutpointIndex();t.push([s,r])}return t},s.prototype.verifyInput=function(t,e,i,s){var r=this.ins[t].getScript();return h.verifyFull(r,e,this,t,0,i,s)},s.prototype.getAffectedKeys=function(t){if(!this.affects||!this.affects.length){this.affects=[];for(var e=0,i=this.outs.length;i>e;e++){var s=this.outs[e],r=s.getScript(),n=r.simpleOutPubKeyHash();n&&this.affects.push(n)}for(var o=t.txIndex,e=0,i=this.ins.length;i>e;e++){var h=this.ins[e];if(!h.isCoinBase()){var u=h.getOutpointHash(),a=h.getOutpointIndex(),f=u.toString("base64"),p=o[f];if(!p)throw new Error("Input not found!");var s=p[a],r=s.getScript(),n=r.simpleOutPubKeyHash();n&&this.affects.push(n)}}}var c={};return this.affects.forEach(function(t){c[t.toString("base64")]=t}),c};var v=171,g=1,y=2,I=3,S=128;s.SIGHASH_ALL=g,s.SIGHASH_NONE=y,s.SIGHASH_SINGLE=I,s.SIGHASH_ANYONECANPAY=S;var b=function(t,e,i,s){this.txTo=t,this.scriptCode=e,this.nIn=i,this.anyoneCanPay=!!(s&S);var r=31&s;this.hashSingle=r===I,this.hashNone=r===y,this.bytes=new f};b.prototype.serializeOutput=function(t){if(this.hashSingle&&t!=this.nIn)this.bytes.put(u.INT64_MAX),this.bytes.varint(0);else{var e=this.txTo.outs[t];this.bytes.put(e.v),this.bytes.varint(e.s.length),this.bytes.put(e.s)}},b.prototype.serializeScriptCode=function(){this.scriptCode.findAndDelete(v),this.bytes.varint(this.scriptCode.buffer.length),this.bytes.put(this.scriptCode.buffer)},b.prototype.serializeInput=function(t){this.anyoneCanPay&&(t=this.nIn),this.bytes.put(this.txTo.ins[t].o),t!==this.nIn?this.bytes.varint(0):this.serializeScriptCode(),this.bytes.word32le(t!==this.nIn&&(this.hashSingle||this.hashNone)?0:this.txTo.ins[t].q)},b.prototype.serialize=function(){this.bytes.word32le(this.txTo.version);var t=this.anyoneCanPay?1:this.txTo.ins.length;this.bytes.varint(t);for(var e=0;t>e;e++)this.serializeInput(e);var i=this.hashNone?0:this.hashSingle?this.nIn+1:this.txTo.outs.length;this.bytes.varint(i);for(var s=0;i>s;s++)this.serializeOutput(s);this.bytes.word32le(this.txTo.lock_time)},b.prototype.buffer=function(){return this.serialize(),this.bytes.buffer()},s.Serializer=b;var d=function(){var e=new t(32);e.writeUInt8(1,0);for(var i=1;32>i;i++)e.writeUInt8(0,i);return e};s.prototype.hashForSignature=function(e,i,s){if(+i!==i||0>i||i>=this.ins.length)return d();var r=31&s;if(r===I&&i>=this.outs.length)return d();var n=new b(this,e,i,s),o=n.buffer(),h=(new f).word32le(s).buffer();return o=t.concat([o,h]),u.twoSha256(o)},s.prototype.getStandardizedObject=function(){var e={hash:u.formatHashFull(this.getHash()),version:this.version,lock_time:this.lock_time},i=8;i+=u.getVarIntSize(this.ins.length);var s=this.ins.map(function(e){var s={prev_out:{hash:c.reverse(new t(e.getOutpointHash())).toString("hex"),n:e.getOutpointIndex()},sequence:e.q};return e.isCoinBase()?s.coinbase=e.s.toString("hex"):s.scriptSig=new o(e.s).getStringContent(!1,0),i+=36+u.getVarIntSize(e.s.length)+e.s.length+4,s});i+=u.getVarIntSize(this.outs.length);var r=this.outs.map(function(t){return i+=u.getVarIntSize(t.s.length)+t.s.length+8,{value:u.formatValue(t.v),scriptPubKey:new o(t.s).getStringContent(!1,0)}});return e.size=i,e["in"]=s,e.out=r,e},s.prototype.toObject=function(){return this},s.prototype.fromObj=function(s){var r={};r.version=s.version||1,r.lock_time=s.lock_time||0,r.ins=[],r.outs=[],s.inputs.forEach(function(i){var s=new e;s.s=u.EMPTY_BUFFER,s.q=4294967295;var n=new t(i.txid,"hex");n=c.reverse(n);var o=parseInt(i.vout),h=new t(4);h.writeUInt32LE(o,0),s.o=t.concat([n,h]),r.ins.push(s)});var h=Object.keys(s.outputs);h.forEach(function(t){var e=new n(t),h=o.createPubKeyHashOut(e.payload()),f=a(s.outputs[t]),p=u.bigIntToValue(f),c=new i;c.v=p,c.s=h.getBuffer(),r.outs.push(c)}),this.lock_time=r.lock_time,this.version=r.version,this.ins=r.ins,this.outs=r.outs},s.prototype.parse=function(s){t.isBuffer(s)&&(this._buffer=s,s=new p(s));{var r;s.pos}this.version=s.word32le();var n=s.varInt();for(this.ins=[],j=0;n>j;j++){var o=new e;o.o=s.buffer(36),r=s.varInt(),o.s=s.buffer(r),o.q=s.word32le(),this.ins.push(o)}var h=s.varInt();for(this.outs=[],j=0;h>j;j++){var u=new i;u.v=s.buffer(8),r=s.varInt(),u.s=s.buffer(r),this.outs.push(u)}this.lock_time=s.word32le(),this.calcHash()},s.prototype.calcSize=function(){var t=8;return t+=u.getVarIntSize(this.ins.length),this.ins.forEach(function(e){t+=36+u.getVarIntSize(e.s.length)+e.s.length+4}),t+=u.getVarIntSize(this.outs.length),this.outs.forEach(function(e){t+=u.getVarIntSize(e.s.length)+e.s.length+8}),this.size=t,t},s.prototype.getSize=function(){return this.size||(this.size=this.calcSize()),this.size},s.prototype.countInputSignatures=function(t){var e=new o(this.ins[t].s);return e.countSignatures()},s.prototype.countInputMissingSignatures=function(t){var e=new o(this.ins[t].s);return e.countMissingSignatures()},s.prototype.isInputComplete=function(t){var e=this.countInputMissingSignatures(t);return null===e?null:0===e},s.prototype.isComplete=function(){for(var t=!0,e=this.ins.length,i=0;e>i;i++)if(!this.isInputComplete(i)){t=!1;break}return t},module.exports=require("soop")(s)}).call(this,require("buffer").Buffer);
},{"../config":"4itQ50","../networks":"ULNIu2","../util":143,"../util/BinaryParser":"b3ZSD7","../util/error":142,"../util/log":"AdF7pF","./Address":"G+CcXD","./PrivateKey":"izTl9z","./Script":"hQ0t76","./ScriptInterpreter":"Q/ZWXW","./WalletKey":"wWje7g","bignum":58,"buffer":85,"bufferput":"aXRuS6","buffertools":"fugeBw","soop":129,"step":130}],"./lib/TransactionBuilder":[function(require,module,exports){
module.exports=require('D1Ge6m');
},{}],"D1Ge6m":[function(require,module,exports){
(function(t){"use strict";function e(t){return t=t||{},this.lockTime=t.lockTime||0,this.spendUnconfirmed=t.spendUnconfirmed||!1,(t.fee||t.feeSat)&&(this.givenFeeSat=t.fee?t.fee*s.COIN:t.feeSat),this.remainderOut=t.remainderOut,this.signhash=t.signhash||d.SIGHASH_ALL,this.tx={},this.inputsSigned=0,this.signaturesAdded=0,this}var r=require("soop").imports(),i=r.Address||require("./Address"),n=r.Script||require("./Script"),s=r.util||require("../util"),u=r.bignum||require("bignum"),a=r.buffertools||require("buffertools"),o=r.networks||require("../networks"),h=r.WalletKey||require("./WalletKey"),p=r.PrivateKey||require("./PrivateKey"),c=r.Key||require("./Key"),f=r.log||require("../util/log"),d=r.Transaction||require("./Transaction"),g=parseInt(1e-4*s.COIN);e.FEE_PER_1000B_SAT=g,e._scriptForPubkeys=function(e){for(var r=e.pubkeys.length,i=[],s=0;r>s;s++)i.push(new t(e.pubkeys[s],"hex"));return n.createMultisig(e.nreq,i)},e._scriptForOut=function(t){var e;if(t.address)e=new i(t.address).getScriptPubKey();else{if(!(t.pubkeys||t.nreq||t.nreq>1))throw new Error("unknown out type");e=this._scriptForPubkeys(t)}return e},e.infoForP2sh=function(t,e){var r=this._scriptForOut(t),n=s.sha256ripe160(r.getBuffer()),u="testnet"===e?o.testnet.P2SHVersion:o.livenet.P2SHVersion,a=new i(u,n),h=a.as("base58");return{script:r,scriptBufHex:r.getBuffer().toString("hex"),hash:n,address:h}},e.prototype.setUnspent=function(t){return this.utxos=t,this},e.prototype._setInputMap=function(){for(var e=[],r=this.selectedUtxos.length,i=0;r>i;i++){var s=this.selectedUtxos[i],u=new t(s.scriptPubKey,"hex"),a=new n(u),o=a.classify();if(o===n.TX_UNKNOWN)throw new Error("unkown output type at:"+i+" Type:"+a.getRawOutType());e.push({address:s.address,scriptPubKey:a,scriptType:o,i:i})}return this.inputMap=e,this},e.prototype.getSelectedUnspent=function(){return this.selectedUtxos},e.prototype._selectUnspent=function(t){if(!this.utxos||!this.utxos.length)throw new Error("unspent not set");var e=[6,1];this.spendUnconfirmed&&e.push(0);var r=[],i=u(0),n=!1,a=null,o=this.utxos.length;do{for(var h=e.shift(),p=0;o>p;p++){var c=this.utxos[p],f=c.confirmations||0;if(!(h>f||a&&f>=a)){var d=c.amountSat||s.parseValue(c.amount);if(i=i.add(d),r.push(c),i.cmp(t)>=0){n=!0;break}}}a=h}while(!n&&e.length);if(!n)throw new Error("not enough unspent tx outputs to fulfill totalNeededAmount [SAT]:"+t);return this.selectedUtxos=r,this._setInputMap(),this},e.prototype._setInputs=function(e){var r=this.selectedUtxos,i=r.length,n=u(0);e.ins=[];for(var o=0;i>o;o++){n=n.add(s.parseValue(r[o].amount));var h={};h.s=s.EMPTY_BUFFER,h.q=4294967295;var p=new t(r[o].txid,"hex"),c=a.reverse(p),f=parseInt(r[o].vout),d=new t(4);d.writeUInt32LE(f,0),h.o=t.concat([c,d]),e.ins.push(h)}return this.valueInSat=n,this},e.prototype._setFee=function(t){if("undefined"==typeof this.valueOutSat)throw new Error("valueOutSat undefined");var e=this.valueOutSat.add(t);if(this.valueInSat.cmp(e)<0){var r=this.valueInSat.toString(),i=e.toString();throw new Error("transaction input amount is less than outputs: "+r+" < "+i+" [SAT]")}return this.feeSat=t,this},e.prototype._setRemainder=function(t,r){if("undefined"==typeof this.valueInSat||"undefined"==typeof this.valueOutSat)throw new Error("valueInSat / valueOutSat undefined");var i=this.valueInSat.sub(this.valueOutSat).sub(this.feeSat),n=t.outs.length;if(this.remainderSat=u(0),n>r&&t.outs.pop(),i.cmp(0)>0){var a=this.remainderOut||this.selectedUtxos[0],o=s.bigIntToValue(i),h=e._scriptForOut(a),p={v:o,s:h.getBuffer()};t.outs.push(p),this.remainderSat=i}return this},e.prototype._setFeeAndRemainder=function(t){var e,r=500,i=t.outs.length;do{e=parseInt(r/1e3)+1;var n=this.givenFeeSat?this.givenFeeSat:e*g,s=this.valueOutSat.add(n);this._selectUnspent(s)._setInputs(t)._setFee(n)._setRemainder(t,i),r=new d(t).getSize()}while(r>1e3*(e+1));return this},e.prototype.setOutputs=function(t){var r=u(0),i={};i.version=1,i.lock_time=this.lockTime||0,i.ins=[],i.outs=[];for(var n=t.length,a=0;n>a;a++){var o=t[a].amountSat||s.parseValue(t[a].amount),h=s.bigIntToValue(o),p=e._scriptForOut(t[a]),c={v:h,s:p.getBuffer()};i.outs.push(c);var f=t[a].amountSat||s.parseValue(t[a].amount);r=r.add(f)}return this.valueOutSat=r,this._setFeeAndRemainder(i),this.tx=new d(i),this},e._mapKeys=function(t){for(var e,r={},i=t.length,n=0;i>n;n++){var s=t[n];if("string"==typeof s){var u=new p(s);e=new h({network:u.network()}),e.fromObj({priv:s})}else{if(!(s instanceof h))throw new Error("argument must be an array of strings (WIF format) or WalletKey objects");e=s}r[e.storeObj().addr]=e}return r},e._signHashAndVerify=function(t,e){var r,i=10;do r=t.privKey.signSync(e);while(t.privKey.verifySignatureSync(e,r)===!1&&i--);if(0>i)throw new Error("could not sign input: verification failed");return r},e.prototype._checkTx=function(){if(!this.tx||!this.tx.ins.length||!this.tx.outs.length)throw new Error("tx is not defined")},e.prototype._multiFindKey=function(t,e){var r;return[o.livenet,o.testnet].forEach(function(n){[n.addressVersion,n.P2SHVersion].forEach(function(n){var s=new i(n,e);!r&&t[s]&&(r=t[s])})}),r},e.prototype._findWalletKey=function(t,e){var r;if(e.address)r=t[e.address];else if(e.pubKeyHash)r=this._multiFindKey(t,e.pubKeyHash);else{if(!e.pubKeyBuf)throw new Error("no infomation at input to find keys");var i=s.sha256ripe160(e.pubKeyBuf);r=this._multiFindKey(t,i)}return r},e.prototype._signPubKey=function(r,i,s){if(this.tx.ins[i.i].s.length>0)return{};var u=this._findWalletKey(r,i);if(u){var a=e._signHashAndVerify(u,s),o=new t(1);o[0]=this.signhash;var h=t.concat([a,o]),p=new n;return p.chunks.push(h),p.updateBuffer(),{inputFullySigned:!0,signaturesAdded:1,script:p.getBuffer()}}},e.prototype._signPubKeyHash=function(r,i,s){if(this.tx.ins[i.i].s.length>0)return{};var u=this._findWalletKey(r,i);if(u){var a=e._signHashAndVerify(u,s),o=new t(1);o[0]=this.signhash;var h=t.concat([a,o]),p=new n;return p.chunks.push(h),p.chunks.push(u.privKey.public),p.updateBuffer(),{inputFullySigned:!0,signaturesAdded:1,script:p.getBuffer()}}},e.prototype._chunkSignedWithKey=function(e,r,i){var n,s=new c;s.public=i;for(var u=1;u<=e.countSignatures();u++){var a=e.chunks[u],o=new t(a.slice(0,a.length-1));s.verifySignatureSync(r,o)&&(n=a)}return n},e.prototype._getSignatureOrder=function(e,r,i,n){for(var s=n.length,u=0;s>u;u++){var a=new c;if(a.public=new t(n[u],"hex"),a.verifySignatureSync(i,r))break}return u},e.prototype._getNewSignatureOrder=function(e,r,i,n){for(var s,u=1;u<=r.countSignatures();u++){var a=r.chunks[u],o=new t(a.slice(0,a.length-1));if(s=this._getSignatureOrder(e,o,i,n),s>=e)break}return e===s?-1:u-1},e.prototype._chunkIsEmpty=function(t){return 0===t||0===a.compare(t,s.EMPTY_BUFFER)},e.prototype._initMultiSig=function(t){var e=!1;return 0!==t.chunks[0]&&(t.prependOp0(),e=!0),e},e.prototype._updateMultiSig=function(r,i,n,s,u){var a=this._initMultiSig(n);if(this._chunkSignedWithKey(n,s,i.privKey.public))return null;var o=e._signHashAndVerify(i,s),h=new t(1);h[0]=this.signhash;var p=t.concat([o,h]),c=this._getNewSignatureOrder(r,n,s,u);return n.chunks.splice(c+1,0,p),n.updateBuffer(),a=!0,a?n:null},e.prototype._signMultiSig=function(t,e,r){for(var i=e.scriptPubKey.capture(),s=e.scriptPubKey.chunks[0]-80,u=i.length,a=this.tx.ins[e.i].s,o=new n(a),h=0,p=0;u>p&&o.countSignatures()<s;p++){var c=this._findWalletKey(t,{pubKeyBuf:i[p]});if(c){var f=this._updateMultiSig(p,c,o,r,i);f&&(o=f,h++)}}var d={inputFullySigned:o.countSignatures()===s,signaturesAdded:h,script:o.getBuffer()};return d};var l={};e.prototype._scriptIsAppended=function(t,e){var r=t.chunks.length;return void 0===t.chunks[r-1]?!1:"number"==typeof t.chunks[r-1]?!1:0!==a.compare(t.chunks[r-1],e)?!1:!0},e.prototype._addScript=function(t,e){var r=new n(t);return this._scriptIsAppended(r,e)||(r.chunks.push(e),r.updateBuffer()),r.getBuffer()},e.prototype._getInputForP2sh=function(t,e){var r,i=t.classify();switch(i){case n.TX_PUBKEYHASH:r=t.captureOne();break;case n.TX_PUBKEY:var u=t.captureOne();r=s.sha256ripe160(u)}return{i:e,pubKeyHash:r,scriptPubKey:t,scriptType:i,isP2sh:!0}},e.prototype._p2shInput=function(e){if(!this.hashToScriptMap)throw new Error("hashToScriptMap not set");var r=this.hashToScriptMap[e.address];if(r){var i=new t(r,"hex"),s=new n(i),u=s.classify();if(!l[u]||u===n.TX_SCRIPTHASH)throw new Error("dont know how to sign p2sh script type:"+s.getRawOutType());return{input:this._getInputForP2sh(s,e.i),txSigHash:this.tx.hashForSignature(s,e.i,this.signhash),scriptType:s.classify(),scriptBuf:i}}},e.prototype._signScriptHash=function(t,e){var r=this._p2shInput(e),i=l[r.scriptType].call(this,t,r.input,r.txSigHash);return i&&i.script&&i.signaturesAdded&&(i.script=this._addScript(i.script,r.scriptBuf)),i},l[n.TX_PUBKEYHASH]=e.prototype._signPubKeyHash,l[n.TX_PUBKEY]=e.prototype._signPubKey,l[n.TX_MULTISIG]=e.prototype._signMultiSig,l[n.TX_SCRIPTHASH]=e.prototype._signScriptHash,e.prototype.sign=function(t){this._checkTx();for(var r=this.tx,i=r.ins,n=i.length,s=e._mapKeys(t),u=0;n>u;u++){var a=this.inputMap[u],o=this.tx.hashForSignature(a.scriptPubKey,u,this.signhash),h=l[a.scriptType].call(this,s,a,o);h&&h.script&&(r.ins[u].s=h.script,h.inputFullySigned&&this.inputsSigned++,h.signaturesAdded&&(this.signaturesAdded+=h.signaturesAdded))}return this},e.prototype.setHashToScriptMap=function(t){return this.hashToScriptMap=t,this},e.prototype.isFullySigned=function(){return this.inputsSigned===this.tx.ins.length},e.prototype.build=function(){return this._checkTx(),this.tx},e.prototype.toObj=function(){var t={valueInSat:this.valueInSat.toString(),valueOutSat:this.valueOutSat.toString(),feeSat:this.feeSat.toString(),remainderSat:this.remainderSat.toString(),hashToScriptMap:this.hashToScriptMap,selectedUtxos:this.selectedUtxos,inputsSigned:this.inputsSigned,signaturesAdded:this.signaturesAdded,signhash:this.signhash,spendUnconfirmed:this.spendUnconfirmed};return this.tx&&(t.tx=this.tx.serialize().toString("hex")),t},e.fromObj=function(r){var i=new e;if(i.valueInSat=r.valueInSat.toString(),i.valueOutSat=r.valueOutSat.toString(),i.feeSat=r.feeSat.toString(),i.remainderSat=r.remainderSat.toString(),i.hashToScriptMap=r.hashToScriptMap,i.selectedUtxos=r.selectedUtxos,i.inputsSigned=r.inputsSigned,i.signaturesAdded=r.signaturesAdded,i.signhash=r.signhash,i.spendUnconfirmed=r.spendUnconfirmed,i._setInputMap(),r.tx){var n=new d;n.parse(new t(r.tx,"hex")),i.tx=n}return i},e.prototype._checkMergeability=function(t){var e=this;if(["valueInSat","valueOutSat","feeSat","remainderSat","signhash","spendUnconfirmed"].forEach(function(r){if(e[r].toString()!==t[r].toString())throw new Error("mismatch at TransactionBuilder match: "+r+": "+e[r]+" vs. "+t[r])}),e.hashToScriptMap){var r=0;if(t.hashToScriptMap||(r=1),Object.keys(e.hashToScriptMap).forEach(function(i){t.hashToScriptMap[i]||(r=1),e.hashToScriptMap[i]!==t.hashToScriptMap[i]&&(r=1)}),r)throw new Error("mismatch at TransactionBuilder hashToScriptMap")}var r=0,i=0;if(e.selectedUtxos.forEach(function(e){if(!r){var n=t.selectedUtxos[i++];n||(r=1),["address","hash","scriptPubKey","vout","amount"].forEach(function(t){e[t]!==n[t]&&(r=t)})}}),r)throw new Error("mismatch at TransactionBuilder selectedUtxos #"+i-1+" Key:"+r);if(r=0,i=0,e.inputMap.forEach(function(e){if(!r){var n=t.inputMap[i++];n||(r=1),["address","scriptType","scriptPubKey","i"].forEach(function(t){e[t].toString()!==n[t].toString()&&(r=t)})}}),r)throw new Error("mismatch at TransactionBuilder inputMap #"+i-1+" Key:"+r)},e.prototype._mergeInputSigP2sh=function(t,e,r){for(var i=this._p2shInput(t),s=new n(i.scriptBuf),u=s.capture(),a={},o=u.length,h=0;o>h;h++)this._chunkSignedWithKey(e,i.txSigHash,u[h])&&(a[u[h].toString("hex")]=1);for(var p=[],h=0;o>h;h++){var c=this._chunkSignedWithKey(r,i.txSigHash,u[h]),f=u[h].toString("hex");c&&!a[f]&&p.push({prio:h,chunk:c,pubHex:f})}for(var h in p){var d=p[h],g=this._getNewSignatureOrder(d.prio,e,i.txSigHash,u);e.chunks.splice(g+1,0,d.chunk),this.signaturesAdded++}return e.updateBuffer(),e.getBuffer()},e.prototype._mergeInputSig=function(t,e,r){if(0===a.compare(e,r))return e;var i=new n(e),s=new n(r),u=i.chunks.length,o=s.chunks.length;if(u&&o&&(2>u&&o>2||2>o&&u>2))throw new Error("TX sig types mismatch in merge");if(!u&&!o||u&&!o||!u&&o)return r;var h=this.inputMap[t],p=h.scriptPubKey.classify();if(p===n.TX_PUBKEYHASH||p===n.TX_PUBKEY)return f.debug("Merging two signed inputs type:"+h.scriptPubKey.getRawOutType()+". Signatures differs. Using the first version."),e;if(p!==n.TX_SCRIPTHASH)throw new Error("Script type:"+h.scriptPubKey.getRawOutType()+"not supported at #merge");return this._mergeInputSigP2sh(h,i,s)},e.prototype._mergeTx=function(t){var e=this.tx,r=t,i=e.ins.length;if(i!==r.ins.length)throw new Error("TX in length mismatch in merge");this.inputsSigned=0;for(var n=0;i>n;n++){var s=e.ins[n],u=r.ins[n];if(s.q!==u.q)throw new Error("TX sequence ins mismatch in merge. Input:",n);if(0!==a.compare(s.o,u.o))throw new Error("TX .o in mismatch in merge. Input:",n);s.s=this._mergeInputSig(n,s.s,u.s),e.isInputComplete(n)&&this.inputsSigned++}},e.prototype.merge=function(t){if(this._checkMergeability(t),this.tx||t.tx){if(this.tx.getNormalizedHash().toString("hex")!==t.tx.getNormalizedHash().toString("hex"))throw new Error("mismatch at TransactionBuilder NTXID");this._mergeTx(t.tx)}},module.exports=require("soop")(e)}).call(this,require("buffer").Buffer);
},{"../networks":"ULNIu2","../util":143,"../util/log":"AdF7pF","./Address":"G+CcXD","./Key":"ALJ4PS","./PrivateKey":"izTl9z","./Script":"hQ0t76","./Transaction":"LJhYtm","./WalletKey":"wWje7g","bignum":58,"buffer":85,"buffertools":"fugeBw","soop":129}],"yUY4WV":[function(require,module,exports){
(function(t){function e(t){"object"!=typeof t&&(t={}),this.datastore=JSON.parse(t.datastore?JSON.stringify(t.datastore):JSON.stringify(p)),this.network=void 0,this.dirty=t.dirty||!0}var r=require("soop").imports(),i=function(e){return new t(e,"hex")},n=require("fs"),s=require("../util/EncFile"),o=require("./Address"),a=require("../networks"),d=r.util||require("../util"),h="aes-256-cbc",p={client:"libcoin",client_version:"0.0.1",network:"testnet",version:1,best_hash:null,best_height:-1,keys:[],sin:{},scripts:{}};e.prototype.readSync=function(t,e){this.datastore=s.readJFileSync(h,e,t),this.dirty=!1},e.prototype.writeSync=function(t,e){var r=t+".tmp";s.writeJFileSync(h,e,r,this.datastore),n.renameSync(r,t),this.dirty=!1},e.prototype.setNetwork=function(t){switch(t||(t=this.datastore.network),t){case"mainnet":case"livenet":this.network=a.livenet;break;case"testnet":this.network=a.testnet;break;default:throw new Error("Unsupported network")}this.datastore.network=this.network.name,this.dirty=!0},e.prototype.addKey=function(t){this.datastore.keys.push(t),this.dirty=!0},e.prototype.addSIN=function(t){this.datastore.sin[t.sin]=t,this.dirty=!0},e.prototype.findKeyHash=function(t){for(var e=t.toString(),r=0;r<this.datastore.keys.length;r++){var i=this.datastore.keys[r],n=i.addr,s=new o(n);if(s.payload().toString()==e)return i}return void 0},e.prototype.expandKey=function(t){var e=new o(t);try{e.validate();var r=e.payload(),n=this.findKeyHash(r);t=n.pub}catch(s){}var a=/^[a-fA-F0-9]+$/;if(!t.match(a))throw new Error("Unknown key type");return i(t)},e.prototype.expandKeys=function(t){var e=[],r=this;return t.forEach(function(t){var i=r.expandKey(t);e.push(i)}),e},e.prototype.addScript=function(t){var e=t.getBuffer(),r=d.sha256ripe160(e),i=new o(this.network.P2SHVersion,r),n=i.as("base58");return this.datastore.scripts[n]=e.toString("hex"),this.dirty=!0,n},module.exports=require("soop")(e)}).call(this,require("buffer").Buffer);
},{"../networks":"ULNIu2","../util":143,"../util/EncFile":137,"./Address":"G+CcXD","buffer":85,"fs":81,"soop":129}],"./lib/Wallet":[function(require,module,exports){
module.exports=require('yUY4WV');
},{}],"./lib/WalletKey":[function(require,module,exports){
module.exports=require('wWje7g');
},{}],"wWje7g":[function(require,module,exports){
(function(e){function r(e){if(e||(e={}),!e.network)throw new Error("network parameter is required");this.network=e.network,this.created=e.created,this.privKey=e.privKey}var i=(require("soop").imports(),require("../util")),t=require("../util/time"),s=require("./Key"),p=require("./PrivateKey"),o=require("./Address");r.prototype.generate=function(){this.privKey=s.generateSync(),this.created=t.curtime()},r.prototype.storeObj=function(){var e=this.privKey.public.toString("hex"),r=i.sha256ripe160(this.privKey.public),t=new o(this.network.addressVersion,r),s=new p(this.network.privKeyVersion,this.privKey.private,this.privKey.compressed),n={created:this.created,priv:s.toString(),pub:e,addr:t.toString()};return n},r.prototype.fromObj=function(r){if(this.created=r.created,this.privKey=new s,64==r.priv.length)this.privKey.private=new e(r.priv,"hex"),this.privKey.compressed="undefined"==typeof r.compressed?!0:r.compressed;else{var i=new p(r.priv);i.validate(),this.privKey.private=new e(i.payload()),this.privKey.compressed=i.compressed()}this.privKey.regenerateSync()},module.exports=require("soop")(r)}).call(this,require("buffer").Buffer);
},{"../util":143,"../util/time":146,"./Address":"G+CcXD","./Key":"ALJ4PS","./PrivateKey":"izTl9z","buffer":85,"soop":129}],58:[function(require,module,exports){
(function(e){function n(e,i){var s,o,l,c,g,p,d=this;if(!(d instanceof n))return new n(e,i);if(e instanceof n){if(O=0,i===s)return d.s=e.s,d.e=e.e,void(d.c=(e=e.c)?e.slice():e);e+=""}if(""===e&&(e=0),"string"!=typeof e&&(e=(l="number"==typeof e||"[object Number]"==Object.prototype.toString.call(e))&&0===e&&0>1/e?"-0":e+""),p=e,i===s&&E.test(e))d.s="-"==e.charAt(0)?(e=e.slice(1),-1):1;else{if(10==i)return u(e,h,a);if(e=S.call(e).replace(/^\+(?!-)/,""),d.s="-"==e.charAt(0)?(e=e.replace(/^-(?!-)/,""),-1):1,null!=i?i!=(0|i)&&w||(f=!(i>=2&&65>i))?(t(i,2),g=E.test(e)):(c="["+N.slice(0,i=0|i)+"]+",e=e.replace(/\.$/,"").replace(/^\./,"0."),(g=new RegExp("^"+c+"(?:\\."+c+")?$",37>i?"i":"").test(e))?(l&&(e.replace(/^0\.0*|\./,"").length>15&&t(p,0),l=!l),e=r(e,10,i,d.s)):"Infinity"!=e&&"NaN"!=e&&(t(p,1,i),e="NaN")):g=E.test(e),!g)return d.c=d.e=null,"Infinity"!=e&&("NaN"!=e&&t(p,3),d.s=null),void(O=0)}for((s=e.indexOf("."))>-1&&(e=e.replace(".","")),(o=e.search(/e/i))>0?(0>s&&(s=o),s+=+e.slice(o+1),e=e.substring(0,o)):0>s&&(s=e.length),o=0;"0"==e.charAt(o);o++);if(i=e.length,l&&i>15&&e.slice(o).length>15&&t(p,0),O=0,(s-=o+1)>v)d.c=d.e=null;else if(o==i||m>s)d.c=[d.e=0];else{for(;"0"==e.charAt(--i););for(d.e=s,d.c=[],s=0;i>=o;d.c[s++]=+e.charAt(o++));}}function t(e,n,t,r,i,s){if(w){var o,u=["new BigNumber","cmp","div","eq","gt","gte","lt","lte","minus","mod","plus","times","toFr"][O?0>O?-O:O:0>1/O?1:0]+"()",l=f?" out of range":" not a"+(i?" non-zero":"n")+" integer";throw l=([u+" number type has more than 15 significant digits",u+" not a base "+t+" number",u+" base"+l,u+" not a number"][n]||t+"() "+n+(s?" not a boolean or binary digit":l+(r?" or not ["+(f?" negative, positive":" integer, integer")+" ]":"")))+": "+e,f=O=0,o=new Error(l),o.name="BigNumber Error",o}}function r(e,t,r,s){function o(e,n){var i,s,o=0,u=e.length,f=[0];for(n=n||r;u>o;o++){for(s=f.length,i=0;s>i;f[i]*=n,i++);for(f[0]+=N.indexOf(e.charAt(o)),i=0;i<f.length;i++)f[i]>t-1&&(null==f[i+1]&&(f[i+1]=0),f[i+1]+=f[i]/t^0,f[i]%=t)}return f.reverse()}function u(e){for(var n=0,t=e.length,r="";t>n;r+=N.charAt(e[n++]));return r}var f,l,c,h,a,g;if(37>r&&(e=e.toLowerCase()),(f=e.indexOf("."))>-1)if(f=e.length-f-1,l=o(new n(r).pow(f).toF(),10),h=e.split("."),c=o(h[1]),h=o(h[0]),g=i(c,l,c.length-l.length,s,t,1&h[h.length-1]),a=g.c,f=g.e){for(;++f;a.unshift(0));e=u(h)+"."+u(a)}else a[0]?h[f=h.length-1]<t-1?(++h[f],e=u(h)):e=new n(u(h),t).plus(A).toS(t):e=u(h);else e=u(o(e));return e}function i(e,t,r,i,s,u){var f,l,c,a,g,p=t.slice(),w=f=t.length,d=e.length,b=e.slice(0,f),N=b.length,O=new n(A),E=O.c=[],S=0,R=h+(O.e=r)+1;for(O.s=i,i=0>R?0:R;N++<f;b.push(0));p.unshift(0);do{for(c=0;s>c;c++){if(f!=(N=b.length))a=f>N?1:-1;else for(g=-1,a=0;++g<f;)if(t[g]!=b[g]){a=t[g]>b[g]?1:-1;break}if(!(0>a))break;for(l=N==f?t:p;N;){if(b[--N]<l[N]){for(g=N;g&&!b[--g];b[g]=s-1);--b[g],b[N]+=s}b[N]-=l[N]}for(;!b[0];b.shift());}E[S++]=a?c:++c,b[0]&&a?b[N]=e[w]||0:b=[e[w]]}while((w++<d||null!=b[0])&&i--);return E[0]||1==S||(--O.e,E.shift()),S>R&&o(O,h,s,u,null!=b[0]),O.e>v?O.c=O.e=null:O.e<m&&(O.c=[O.e=0]),O}function s(e,t,r){var i=t-(e=new n(e)).e,s=e.c;if(!s)return e.toS();for(s.length>++t&&o(e,i,10),i=0==s[0]?i+1:r?t:e.e+i+1;s.length<i;s.push(0));return i=e.e,1==r||2==r&&(--t<i||g>=i)?(e.s<0&&s[0]?"-":"")+(s.length>1?(s.splice(1,0,"."),s.join("")):s[0])+(0>i?"e":"e+")+i:e.toS()}function o(e,n,t,r,i){var s=e.c,o=e.s<0,u=t/2,f=e.e+n+1,l=s[f],c=i||0>f||null!=s[f+1];if(i=4>a?(null!=l||c)&&(0==a||2==a&&!o||3==a&&o):l>u||l==u&&(4==a||c||6==a&&(1&s[f-1]||!n&&r)||7==a&&!o||8==a&&o),1>f||!s[0])return s.length=0,s.push(0),i?(s[0]=1,e.e=-n):e.e=0,e;if(s.length=f--,i)for(--t;++s[f]>t;)s[f]=0,f--||(++e.e,s.unshift(1));for(f=s.length;!s[--f];s.pop());return e}function u(e,t,r){var i=a;return a=r,e=new n(e),e.c&&o(e,t,10),a=i,e}var f,l=1e9,c=1e6,h=20,a=4,g=-7,p=21,m=-l,v=l,w=!0,d=parseInt,b=n.prototype,N="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",O=0,E=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,S=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},A=n(1);n.ROUND_UP=0,n.ROUND_DOWN=1,n.ROUND_CEIL=2,n.ROUND_FLOOR=3,n.ROUND_HALF_UP=4,n.ROUND_HALF_DOWN=5,n.ROUND_HALF_EVEN=6,n.ROUND_HALF_CEIL=7,n.ROUND_HALF_FLOOR=8,n.fromBuffer=function(e,t){t||(t={});var r={1:"big","-1":"little"}[t.endian]||t.endian||"big",i="auto"===t.size?Math.ceil(e.length):t.size||1;if(e.length%i!==0)throw new RangeError("Buffer length ("+e.length+") must be a multiple of size ("+i+")");for(var s=[],o=0;o<e.length;o+=i){for(var u=[],f=0;i>f;f++)u.push(e[o+("big"===r?f:i-f-1)]);s.push(u.map(function(e){return(16>e?"0":"")+e.toString(16)}).join(""))}return n(s.join(""),16)},n.config=function(){var e,n,r=0,i={},s=arguments,o=s[0],u="config",c=function(e,n,t){return!((f=n>e||e>t)||d(e)!=e&&0!==e)},b=o&&"object"==typeof o?function(){return o.hasOwnProperty(n)?null!=(e=o[n]):void 0}:function(){return s.length>r?null!=(e=s[r++]):void 0};return b(n="DECIMAL_PLACES")&&(c(e,0,l)?h=0|e:t(e,n,u)),i[n]=h,b(n="ROUNDING_MODE")&&(c(e,0,8)?a=0|e:t(e,n,u)),i[n]=a,b(n="EXPONENTIAL_AT")&&(c(e,-l,l)?g=-(p=~~(0>e?-e:+e)):!f&&e&&c(e[0],-l,0)&&c(e[1],0,l)?(g=~~e[0],p=~~e[1]):t(e,n,u,1)),i[n]=[g,p],b(n="RANGE")&&(c(e,-l,l)&&~~e?m=-(v=~~(0>e?-e:+e)):!f&&e&&c(e[0],-l,-1)&&c(e[1],1,l)?(m=~~e[0],v=~~e[1]):t(e,n,u,1,1)),i[n]=[m,v],b(n="ERRORS")&&(e===!!e||1===e||0===e?(f=O=0,d=(w=!!e)?parseInt:parseFloat):t(e,n,u,0,0,1)),i[n]=w,i},b.abs=b.absoluteValue=function(){var e=new n(this);return e.s<0&&(e.s=1),e},b.bitLength=function(){return this.toString(2).length},b.ceil=function(){return u(this,0,2)},b.comparedTo=b.cmp=function(e,t){var r,i=this,s=i.c,o=(O=-O,e=new n(e,t)).c,u=i.s,f=e.s,l=i.e,c=e.e;if(!u||!f)return null;if(r=s&&!s[0],t=o&&!o[0],r||t)return r?t?0:-f:u;if(u!=f)return u;if(r=0>u,t=l==c,!s||!o)return t?0:!s^r?1:-1;if(!t)return l>c^r?1:-1;for(u=-1,f=(l=s.length)<(c=o.length)?l:c;++u<f;)if(s[u]!=o[u])return s[u]>o[u]^r?1:-1;return l==c?0:l>c^r?1:-1},b.dividedBy=b.div=function(e,t){var r=this.c,s=this.e,o=this.s,u=(O=2,e=new n(e,t)).c,f=e.e,l=e.s,c=o==l?1:-1;return(s||r&&r[0])&&(f||u&&u[0])?i(r,u,s-f,c,10):new n(o&&l&&(r?!u||r[0]!=u[0]:u)?r&&0==r[0]||!u?0*c:c/0:0/0)},b.equals=b.eq=function(e,n){return O=3,0===this.cmp(e,n)},b.floor=function(){return u(this,0,3)},b.greaterThan=b.gt=function(e,n){return O=4,this.cmp(e,n)>0},b.greaterThanOrEqualTo=b.gte=function(e,n){return O=5,1==(n=this.cmp(e,n))||0===n},b.isFinite=b.isF=function(){return!!this.c},b.isNaN=function(){return!this.s},b.isNegative=b.isNeg=function(){return this.s<0},b.isZero=b.isZ=function(){return!!this.c&&0==this.c[0]},b.lessThan=b.lt=function(e,n){return O=6,this.cmp(e,n)<0},b.lessThanOrEqualTo=b.lte=b.le=function(e,n){return O=7,-1==(n=this.cmp(e,n))||0===n},b.minus=b.sub=function(e,t){var r,i,s,o,u=this,f=u.s;if(t=(O=8,e=new n(e,t)).s,!f||!t)return new n(0/0);if(f!=t)return e.s=-t,u.plus(e);var l=u.c,c=u.e,h=e.c,g=e.e;if(!c||!g){if(!l||!h)return l?(e.s=-t,e):new n(h?u:0/0);if(!l[0]||!h[0])return h[0]?(e.s=-t,e):new n(l[0]?u:3==a?-0:0)}if(l=l.slice(),f=c-g){for(r=(o=0>f)?(f=-f,l):(g=c,h),r.reverse(),t=f;t--;r.push(0));r.reverse()}else for(s=((o=l.length<h.length)?l:h).length,f=t=0;s>t;t++)if(l[t]!=h[t]){o=l[t]<h[t];break}if(o&&(r=l,l=h,h=r,e.s=-e.s),(t=-((s=l.length)-h.length))>0)for(;t--;l[s++]=0);for(t=h.length;t>f;){if(l[--t]<h[t]){for(i=t;i&&!l[--i];l[i]=9);--l[i],l[t]+=10}l[t]-=h[t]}for(;0==l[--s];l.pop());for(;0==l[0];l.shift(),--g);return(m>g||!l[0])&&(l[0]||(e.s=3==a?-1:1),l=[g=0]),e.c=l,e.e=g,e},b.modulo=b.mod=function(e,t){var r=this,i=r.c,s=(O=9,e=new n(e,t)).c,o=r.s,u=e.s;return t=!o||!u||s&&!s[0],t||i&&!i[0]?new n(t?0/0:r):(r.s=e.s=1,t=1==e.cmp(r),r.s=o,e.s=u,t?new n(r):(o=h,u=a,h=0,a=1,r=r.div(e),h=o,a=u,this.minus(r.times(e))))},b.negated=b.neg=function(){var e=new n(this);return e.s=-e.s||null,e},b.plus=b.add=function(e,t){var r,i=this,s=i.s;if(t=(O=10,e=new n(e,t)).s,!s||!t)return new n(0/0);if(s!=t)return e.s=-t,i.minus(e);var o=i.e,u=i.c,f=e.e,l=e.c;if(!o||!f){if(!u||!l)return new n(s/0);if(!u[0]||!l[0])return l[0]?e:new n(u[0]?i:0*s)}if(u=u.slice(),s=o-f){for(r=s>0?(f=o,l):(s=-s,u),r.reverse();s--;r.push(0));r.reverse()}for(u.length-l.length<0&&(r=l,l=u,u=r),s=l.length,t=0;s;t=(u[--s]=u[s]+l[s]+t)/10^0,u[s]%=10);for(t&&(u.unshift(t),++f>v&&(u=f=null)),s=u.length;0==u[--s];u.pop());return e.c=u,e.e=f,e},b.toPower=b.pow=function(e){var r=0*e==0?0|e:e,i=new n(this),s=new n(A);if(((f=-c>e||e>c)&&(r=1*e/0)||d(e)!=e&&0!==e&&!(r=0/0))&&!t(e,"exponent","pow")||!r)return new n(Math.pow(i.toS(),r));for(r=0>r?-r:r;1&r&&(s=s.times(i)),r>>=1,r;)i=i.times(i);return 0>e?A.div(s):s},b.powm=function(e,n){return this.pow(e).mod(n)},b.round=function(e,n){return e=null==e||((f=0>e||e>l)||d(e)!=e)&&!t(e,"decimal places","round")?0:0|e,n=null==n||((f=0>n||n>8)||d(n)!=n&&0!==n)&&!t(n,"mode","round")?a:0|n,u(this,e,n)},b.squareRoot=b.sqrt=function(){var e,t,r,i,s=this,u=s.c,f=s.s,l=s.e,c=h,g=a,p=new n("0.5");if(1!==f||!u||!u[0])return new n(!f||0>f&&(!u||u[0])?0/0:u?s:1/0);for(f=Math.sqrt(s.toS()),a=1,0==f||f==1/0?(e=u.join(""),e.length+l&1||(e+="0"),t=new n(Math.sqrt(e)+""),t.c||(t.c=[1]),t.e=((l+1)/2|0)-(0>l||1&l)):t=new n(e=f.toString()),r=t.e,f=r+(h+=4),3>f&&(f=0),l=f;;)if(i=t,t=p.times(i.plus(s.div(i))),i.c.slice(0,f).join("")===t.c.slice(0,f).join("")){if(u=t.c,f-=e&&t.e<r,9!=u[f]||9!=u[f-1]||9!=u[f-2]||!(9==u[f-3]||e&&4==u[f-3])){if(!(u[l]||u[l-1]||u[l-2]||u[l-3]&&5!=u[l-3]||(u.length>l-2&&(u.length=l-2),t.times(t).eq(s)))){for(;u.length<l-3;)u.push(0);u[l-3]++}return a=g,o(t,h=c,10),t}if(e&&9==u[f-3]&&(i=t.round(c,0),i.times(i).eq(s)))return a=g,h=c,i;h+=4,f+=4,e=""}},b.times=b.mul=function(e,t){var r,i=this,s=i.c,o=(O=11,e=new n(e,t)).c,u=i.e,f=e.e,l=i.s;if(e.s=l==(t=e.s)?1:-1,!((u||s&&s[0])&&(f||o&&o[0])))return new n(!l||!t||s&&!s[0]&&!o||o&&!o[0]&&!s?0/0:s&&o?0*e.s:e.s/0);for(e.e=u+f,(l=s.length)<(t=o.length)&&(r=s,s=o,o=r,f=l,l=t,t=f),f=l+t,r=[];f--;r.push(0));for(u=t-1;u>-1;u--){for(t=0,f=l+u;f>u;t=r[f]+o[u]*s[f-u-1]+t,r[f--]=t%10|0,t=t/10|0);t&&(r[f]=(r[f]+t)%10)}for(t&&++e.e,!r[0]&&r.shift(),f=r.length;!r[--f];r.pop());return e.c=e.e>v?e.e=null:e.e<m?[e.e=0]:r,e},b.toBuffer=function(n){if("string"==typeof n){if("mpint"!==n)return"Unsupported Buffer representation";var t=this.abs(),r=t.toBuffer({size:1,endian:"big"}),i=1===r.length&&0===r[0]?0:r.length;128&r[0]&&i++;var s=new e(4+i);i>0&&r.copy(s,4+(128&r[0]?1:0)),128&r[0]&&(s[4]=0),s[0]=i&255<<24,s[1]=i&255<<16,s[2]=65280&i,s[3]=255&i;var o=this.lt(0);if(o)for(var u=4;u<s.length;u++)s[u]=255-s[u];return s[4]=127&s[4]|(o?128:0),o&&s[s.length-1]++,s}n||(n={});var f={1:"big","-1":"little"}[n.endian]||n.endian||"big",l=this.toString(16);if("-"===l.charAt(0))throw new Error("converting negative numbers to Buffers not supported yet");for(var c="auto"===n.size?Math.ceil(l.length/2):n.size||1,i=Math.ceil(l.length/(2*c))*c,r=new e(i);l.length<2*i;)l="0"+l;var h=l.split(new RegExp("(.{"+2*c+"})")).filter(function(e){return e.length>0});return h.forEach(function(e,n){for(var t=0;c>t;t++){var i=n*c+("big"===f?t:c-t-1);r[i]=parseInt(e.slice(2*t,2*t+2),16)}}),r},b.toExponential=b.toE=function(e){return s(this,(null==e||((f=0>e||e>l)||d(e)!=e&&0!==e)&&!t(e,"decimal places","toE"))&&this.c?this.c.length-1:0|e,1)},b.toFixed=b.toF=function(e){var n,r,i,o=this;return null==e||((f=0>e||e>l)||d(e)!=e&&0!==e)&&!t(e,"decimal places","toF")||(i=o.e+(0|e)),n=g,e=p,g=-(p=1/0),i==r?r=o.toS():(r=s(o,i),o.s<0&&o.c&&(o.c[0]?r.indexOf("-")<0&&(r="-"+r):r=r.replace(/^-/,""))),g=n,p=e,r},b.toFraction=b.toFr=function(e){var r,i,s,o,u,l,c,g=o=new n(A),p=s=new n("0"),m=this,d=m.c,b=v,N=h,E=a,S=new n(A);if(!d)return m.toS();for(c=S.e=d.length-m.e-1,(null==e||(!(O=12,l=new n(e)).s||(f=l.cmp(g)<0||!l.c)||w&&l.e<l.c.length-1)&&!t(e,"max denominator","toFr")||(e=l).cmp(S)>0)&&(e=c>0?S:g),v=1/0,l=new n(d.join("")),h=0,a=1;r=l.div(S),u=o.plus(r.times(p)),1!=u.cmp(e);)o=p,p=u,g=s.plus(r.times(u=g)),s=u,S=l.minus(r.times(u=S)),l=u;return u=e.minus(o).div(p),s=s.plus(u.times(g)),o=o.plus(u.times(p)),s.s=g.s=m.s,h=2*c,a=E,i=g.div(p).minus(m).abs().cmp(s.div(o).minus(m).abs())<1?[g.toS(),p.toS()]:[s.toS(),o.toS()],v=b,h=N,i},b.toPrecision=b.toP=function(e){return null==e||((f=1>e||e>l)||d(e)!=e)&&!t(e,"precision","toP")?this.toS():s(this,0|--e,2)},b.toString=b.toS=function(e){var n,i,o,u=this,l=u.e;if(null===l)i=u.s?"Infinity":"NaN";else{if(e===n&&(g>=l||l>=p))return s(u,u.c.length-1,1);if(i=u.c.join(""),0>l){for(;++l;i="0"+i);i="0."+i}else if(o=i.length,l>0)if(++l>o)for(l-=o;l--;i+="0");else o>l&&(i=i.slice(0,l)+"."+i.slice(l));else if(n=i.charAt(0),o>1)i=n+"."+i.slice(1);else if("0"==n)return n;if(null!=e)if((f=!(e>=2&&65>e))||e!=(0|e)&&w)t(e,"base","toS");else if(i=r(i,0|e,10,u.s),"0"==i)return i}return u.s<0?"-"+i:i},b.toNumber=function(){return parseInt(this.toString(),10)},b.valueOf=function(){return this.toS()},n.config({EXPONENTIAL_AT:9999999,DECIMAL_PLACES:0,ROUNDING_MODE:1}),module.exports=n}).call(this,require("buffer").Buffer);
},{"buffer":85}],"0Qraa1":[function(require,module,exports){
(function(e){"use strict";var t=(require("soop").imports(),require("../sjcl")),r=require("../common/ECIES");r.symmetricEncrypt=function(r,o,c){var i=t.codec.hex.toBits(r.toString("hex")),s=t.codec.hex.toBits(o.toString("hex")),n=t.codec.hex.toBits(c.toString("hex"));t.beware["CBC mode is dangerous because it doesn't protect message integrity."]();var a={iv:s,ks:256,ts:128,iter:1e3,mode:"cbc"},d=t.encrypt(i,n,a),u=t.codec.hex.fromBits(t.codec.base64.toBits(JSON.parse(d).ct)),h=new e(u,"hex"),m=e.concat([o,h]);return m},r.symmetricDecrypt=function(r,o){var c=t.codec.hex.toBits(r.toString("hex")),i=o.slice(0,16),s=o.slice(16,o.length),n=t.codec.base64.fromBits(t.codec.hex.toBits(i.toString("hex"))),a=t.codec.base64.fromBits(t.codec.hex.toBits(s.toString("hex")));t.beware["CBC mode is dangerous because it doesn't protect message integrity."]();var d={iv:n,v:1,iter:1e3,ks:256,ts:128,mode:"cbc",adata:"",cipher:"aes",ct:a},u=JSON.stringify(d),h=t.decrypt(c,u),m=new e(h);return m},module.exports=require("soop")(r)}).call(this,require("buffer").Buffer);
},{"../common/ECIES":67,"../sjcl":"oLMOpG","buffer":85,"soop":129}],"./lib/ECIES":[function(require,module,exports){
module.exports=require('0Qraa1');
},{}],"./lib/Key":[function(require,module,exports){
module.exports=require('ALJ4PS');
},{}],"ALJ4PS":[function(require,module,exports){
(function(e){var r=require("../../browser/vendor-bundle.js").ECKey,t=require("../SecureRandom"),n=require("../Curve"),o=require("bignum"),s=function(){this._pub=null,this._compressed=!0},i=s.bufferToArray=function(e){for(var r=[],t=e.length,n=0;t>n;n++)r.push(e.readUInt8(n));return r};Object.defineProperty(s.prototype,"public",{set:function(r){if(!e.isBuffer(r))throw new Error("Arg should be a buffer");var t=r[0];this._compressed=4!==t,this._pub=r},get:function(){return this._pub}}),Object.defineProperty(s.prototype,"compressed",{set:function(t){var n=this._compressed;if(this._compressed=!!t,n!=this._compressed){{this._pub}if(this._pub){var o=new r;o.setPub(i(this.public)),o.setCompressed(this._compressed),this._pub=new e(o.getPub())}!this._compressed}},get:function(){return this._compressed}}),s.generateSync=function(){for(var i;;)if(i=t.getRandomBuffer(32),o.fromBuffer(i,{size:32}).cmp(n.getN())<0)break;var u=i.toString("hex"),f=new r(u);f.setCompressed(!0);f.getPub();return ret=new s,ret.private=i,ret._compressed=!0,ret.public=new e(f.getPub()),ret},s.prototype.regenerateSync=function(){if(!this.private)throw new Error("Key does not have a private key set");var t=new r(this.private.toString("hex"));return t.setCompressed(this._compressed),this._pub=new e(t.getPub()),this},s.prototype.signSync=function(r){var n=require("../../browser/vendor-bundle.js").getSECCurveByName,o=require("../../browser/vendor-bundle.js").BigInteger,s=new t,u=n("secp256k1"),s={};s.nextBytes=function(e){var r=(t.getRandomBuffer(e.length),i(t.getRandomBuffer(e.length)));for(var n in r)e[n]=r[n]};var f=function(e){return new o(e.bitLength(),s).mod(e.subtract(o.ONE)).add(o.ONE)},a=function(e,r){var t=r,n=u.getN(),s=o.fromByteArrayUnsigned(e);do var i=f(n),a=u.getG(),p=a.multiply(i),c=p.getX().toBigInteger().mod(n),d=i.modInverse(n).multiply(s.add(t.multiply(c))).mod(n);while(c.compareTo(o.ZERO)<=0||d.compareTo(o.ZERO)<=0);return h(c,d)},h=function(e,r){var t=e.toByteArraySigned(),n=r.toByteArraySigned(),o=[];return o.push(2),o.push(t.length),o=o.concat(t),o.push(2),o.push(n.length),o=o.concat(n),o.unshift(o.length),o.unshift(48),o};if(!this.private)throw new Error("Key does not have a private key set");if(!e.isBuffer(r)||32!==r.length)throw new Error("Arg should be a 32 bytes hash buffer");var p=this.private.toString("hex"),c=new o(p,16),d=a(i(r),c);return new e(d)},s.prototype.verifySignature=function(e,r,t){try{var n=this.verifySignatureSync(e,r);t(null,n)}catch(o){t(o)}},s.prototype.verifySignatureSync=function(t,n){var o=this;if(!e.isBuffer(t)||32!==t.length)throw new Error("Arg 1 should be a 32 bytes hash buffer");if(!e.isBuffer(n))throw new Error("Arg 2 should be a buffer");if(!o.public)throw new Error("Key does not have a public key set");var s=new r;s.setPub(i(o.public)),s.setCompressed(o._compressed);var u=i(n),f=s.verify(i(t),u);return f},module.exports=s}).call(this,require("buffer").Buffer);
},{"../../browser/vendor-bundle.js":3,"../Curve":"Ynul1S","../SecureRandom":"p4SiC2","bignum":58,"buffer":85}],"./lib/Point":[function(require,module,exports){
module.exports=require('6tXgqr');
},{}],"6tXgqr":[function(require,module,exports){
(function(e){"use strict";var r=require("soop").imports(),t=(r.Key||require("./Key"),r.bignum||require("bignum")),n=require("assert"),i=require("../../browser/vendor-bundle.js").ECPointFp,o=require("../../browser/vendor-bundle.js").ECFieldElementFp,u=require("../../browser/vendor-bundle.js").getSECCurveByName,g=require("../../browser/vendor-bundle.js").BigInteger,s=function(e,r){this.x=e,this.y=r};s.add=function(r,f){var w=u("secp256k1"),B=r.x.toBuffer({size:32}).toString("hex"),y=new g(B,16),l=r.y.toBuffer({size:32}).toString("hex"),v=new g(l,16),d=new o(w.getCurve().getQ(),y),h=new o(w.getCurve().getQ(),v),a=new i(w.getCurve(),d,h),m=f.x.toBuffer({size:32}).toString("hex"),c=new g(m,16),x=f.y.toBuffer({size:32}).toString("hex"),p=new g(x,16),z=new o(w.getCurve().getQ(),c),b=new o(w.getCurve().getQ(),p),C=new i(w.getCurve(),z,b),q=a.add(C),S=new s,Q=new e(q.getX().toBigInteger().toByteArrayUnsigned());S.x=t.fromBuffer(Q,{size:Q.length}),n(Q.length<=32);var U=new e(q.getY().toBigInteger().toByteArrayUnsigned());return n(U.length<=32),S.y=t.fromBuffer(U,{size:U.length}),S},s.multiply=function(r,f){var f=new g(f.toString("hex"),16),w=u("secp256k1"),B=r.x.toBuffer({size:32}).toString("hex"),y=new g(B,16),l=r.y.toBuffer({size:32}).toString("hex"),v=new g(l,16),d=new o(w.getCurve().getQ(),y),h=new o(w.getCurve().getQ(),v),a=new i(w.getCurve(),d,h),m=a.multiply(f),c=new s,x=new e(m.getX().toBigInteger().toByteArrayUnsigned());c.x=t.fromBuffer(x,{size:x.length}),n(x.length<=32);var p=new e(m.getY().toBigInteger().toByteArrayUnsigned());return n(p.length<=32),c.y=t.fromBuffer(p,{size:p.length}),c},s.fromUncompressedPubKey=function(r){var n=new s;return n.x=t.fromBuffer(new e(r).slice(1,33),{size:32}),n.y=t.fromBuffer(new e(r).slice(33,65),{size:32}),n},s.prototype.toUncompressedPubKey=function(){var r=this.x.toBuffer({size:32}),t=this.y.toBuffer({size:32}),n=new e([4]),i=e.concat([n,r,t]);return i},module.exports=require("soop")(s)}).call(this,require("buffer").Buffer);
},{"../../browser/vendor-bundle.js":3,"./Key":"ALJ4PS","assert":82,"bignum":58,"buffer":85,"soop":129}],"p4SiC2":[function(require,module,exports){
(function(o){var r=(require("soop"),require("../common/SecureRandom"));r.getRandomBuffer=function(r){if(!window.crypto&&!window.msCrypto)throw new Error("window.crypto not available");if(window.crypto&&window.crypto.getRandomValues)var e=window.crypto;else{if(!window.msCrypto||!window.msCrypto.getRandomValues)throw new Error("window.crypto.getRandomValues not available");var e=window.msCrypto}var n=new Uint8Array(r);e.getRandomValues(n);var w=new o(n);return w},module.exports=require("soop")(r)}).call(this,require("buffer").Buffer);
},{"../common/SecureRandom":68,"buffer":85,"soop":129}],"./lib/SecureRandom":[function(require,module,exports){
module.exports=require('p4SiC2');
},{}],67:[function(require,module,exports){
(function(e){"use strict";var r=require("soop").imports(),t=r.coinUtil||require("../../util"),i=r.Point||require("../Point"),n=r.SecureRandom||require("../SecureRandom"),c=r.Key||require("../Key"),o=function(){};o.encryptObj=function(e,r,t,i){var c=new o;c.KB=e,c.message=r,t=c.getRandomSeed(t);var s=(c.R,c.S=c.getSfromPubkey()),u=o.kdf(s),p=c.kE=u.slice(0,32),a=c.kM=u.slice(32,64);i=i||n.getRandomBuffer(16);{var f=c.c=o.symmetricEncrypt(p,i,r);c.d=o.mac(a,f)}return c},o.encrypt=function(r,t,i,n){var s=o.encryptObj(r,t,i,n),u=new c;u.compressed=!1,u.public=s.R.toUncompressedPubKey(),u.compressed=!0;var p=u.public,a=e.concat([p,s.c,s.d]);return a},o.decryptObj=function(e){var r=e.kB,t=e.R,n=e.c,c=e.d,s=i.multiply(t,r),u=s.x.toBuffer({size:32}),p=o.kdf(u),a=e.kE=p.slice(0,32),f=e.kM=p.slice(32,64),y=o.mac(f,n);if(c.toString("hex")!==y.toString("hex"))throw new Error("MAC check incorrect. Data is invalid.");var m=o.symmetricDecrypt(a,n);return m},o.decrypt=function(e,r){if(r.length<97)throw new Error("invalid length of encrypted data");var t=new o;t.kB=e;var n=r.slice(0,33),s=new c;return s.public=n,s.compressed=!1,t.R=i.fromUncompressedPubKey(s.public),t.c=r.slice(33,r.length-64),t.d=r.slice(r.length-64,r.length),o.decryptObj(t)},o.kdf=function(e){var r=t.sha512(e);return r},o.mac=function(e,r){var i=t.sha512hmac(e,r);return i},o.prototype.getRandomSeed=function(e){return e?(this.key=new c,this.key.private=e,this.key.regenerateSync()):this.key=c.generateSync(),this.r=this.key.private,this.key.compressed=!1,this.R=i.fromUncompressedPubKey(this.key.public),this.r},o.prototype.getSfromPubkey=function(){var e=new c;e.public=this.KB,e.compressed=!1;var r=i.fromUncompressedPubKey(e.public);return this.P=i.multiply(r,this.r),this.S=this.P.x.toBuffer({size:32}),this.S},o.prototype.getSfromPrivkey=function(){var e=this.R,r=this.kB,t=i.multiply(e,r),n=t.x.toBuffer({size:32});return n},module.exports=require("soop")(o)}).call(this,require("buffer").Buffer);
},{"../../util":143,"../Key":"ALJ4PS","../Point":"6tXgqr","../SecureRandom":"p4SiC2","buffer":85,"soop":129}],68:[function(require,module,exports){
(function(e){var o=(require("soop"),function(){});o.getRandomBuffer=function(){},o.getPseudoRandomBuffer=function(o){for(var f=4294967296,u=new e(o),n=0;o>=n;n++){var t=Math.floor(n/4),a=n-4*t;0==a?(r=Math.random()*f,u[n]=255&r):u[n]=255&(r>>>=8)}return u},module.exports=require("soop")(o)}).call(this,require("buffer").Buffer);
},{"buffer":85,"soop":129}],"oLMOpG":[function(require,module,exports){
"use strict";function l(t){throw t}function aa(t,e,s){4!==e.length&&l(new sjcl.exception.invalid("invalid aes block size"));var i=t.a[s],n=e[0]^i[0],c=e[s?3:1]^i[1],r=e[2]^i[2];e=e[s?1:3]^i[3];var o,a,h,u,d=i.length/4-2,p=4,f=[0,0,0,0];o=t.m[s],t=o[0];var m=o[1],j=o[2],g=o[3],y=o[4];for(u=0;d>u;u++)o=t[n>>>24]^m[c>>16&255]^j[r>>8&255]^g[255&e]^i[p],a=t[c>>>24]^m[r>>16&255]^j[e>>8&255]^g[255&n]^i[p+1],h=t[r>>>24]^m[e>>16&255]^j[n>>8&255]^g[255&c]^i[p+2],e=t[e>>>24]^m[n>>16&255]^j[c>>8&255]^g[255&r]^i[p+3],p+=4,n=o,c=a,r=h;for(u=0;4>u;u++)f[s?3&-u:u]=y[n>>>24]<<24^y[c>>16&255]<<16^y[r>>8&255]<<8^y[255&e]^i[p++],o=n,n=c,c=r,r=e,e=o;return f}function ca(t,e){var s,i=sjcl.random.A[t],n=[];for(s in i)i.hasOwnProperty(s)&&n.push(i[s]);for(s=0;s<n.length;s++)n[s](e)}function U(t){window&&window.performance&&"function"==typeof window.performance.now?sjcl.random.addEntropy(window.performance.now(),t,"loadtime"):sjcl.random.addEntropy((new Date).valueOf(),t,"loadtime")}function ba(t){t.a=S(t).concat(S(t)),t.B=new sjcl.cipher.aes(t.a)}function S(t){for(var e=0;4>e&&(t.i[e]=t.i[e]+1|0,!t.i[e]);e++);return t.B.encrypt(t.i)}function T(t,e){return function(){e.apply(t,arguments)}}var s=void 0,v=!1,sjcl={cipher:{},hash:{},keyexchange:{},mode:{},misc:{},codec:{},exception:{corrupt:function(t){this.toString=function(){return"CORRUPT: "+this.message},this.message=t},invalid:function(t){this.toString=function(){return"INVALID: "+this.message},this.message=t},bug:function(t){this.toString=function(){return"BUG: "+this.message},this.message=t},notReady:function(t){this.toString=function(){return"NOT READY: "+this.message},this.message=t}}};"undefined"!=typeof module&&module.exports&&(module.exports=sjcl),sjcl.cipher.aes=function(t){this.m[0][0][0]||this.q();var e,s,i,n,c=this.m[0][4],r=this.m[1];e=t.length;var o=1;for(4!==e&&6!==e&&8!==e&&l(new sjcl.exception.invalid("invalid aes key size")),this.a=[i=t.slice(0),n=[]],t=e;4*e+28>t;t++)s=i[t-1],(0===t%e||8===e&&4===t%e)&&(s=c[s>>>24]<<24^c[s>>16&255]<<16^c[s>>8&255]<<8^c[255&s],0===t%e&&(s=s<<8^s>>>24^o<<24,o=o<<1^283*(o>>7))),i[t]=i[t-e]^s;for(e=0;t;e++,t--)s=i[3&e?t:t-4],n[e]=4>=t||4>e?s:r[0][c[s>>>24]]^r[1][c[s>>16&255]]^r[2][c[s>>8&255]]^r[3][c[255&s]]},sjcl.cipher.aes.prototype={encrypt:function(t){return aa(this,t,0)},decrypt:function(t){return aa(this,t,1)},m:[[[],[],[],[],[]],[[],[],[],[],[]]],q:function(){var t,e,s,i,n,c,r,o=this.m[0],a=this.m[1],l=o[4],h=a[4],u=[],d=[];for(t=0;256>t;t++)d[(u[t]=t<<1^283*(t>>7))^t]=t;for(e=s=0;!l[e];e^=i||1,s=d[s]||1)for(c=s^s<<1^s<<2^s<<3^s<<4,c=c>>8^255&c^99,l[e]=c,h[c]=e,n=u[t=u[i=u[e]]],r=16843009*n^65537*t^257*i^16843008*e,n=257*u[c]^16843008*c,t=0;4>t;t++)o[t][e]=n=n<<24^n>>>8,a[t][c]=r=r<<24^r>>>8;for(t=0;5>t;t++)o[t]=o[t].slice(0),a[t]=a[t].slice(0)}},sjcl.bitArray={bitSlice:function(t,e,i){return t=sjcl.bitArray.O(t.slice(e/32),32-(31&e)).slice(1),i===s?t:sjcl.bitArray.clamp(t,i-e)},extract:function(t,e,s){var i=Math.floor(-e-s&31);return(-32&(e+s-1^e)?t[e/32|0]<<32-i^t[e/32+1|0]>>>i:t[e/32|0]>>>i)&(1<<s)-1},concat:function(t,e){if(0===t.length||0===e.length)return t.concat(e);var s=t[t.length-1],i=sjcl.bitArray.getPartial(s);return 32===i?t.concat(e):sjcl.bitArray.O(e,i,0|s,t.slice(0,t.length-1))},bitLength:function(t){var e=t.length;return 0===e?0:32*(e-1)+sjcl.bitArray.getPartial(t[e-1])},clamp:function(t,e){if(32*t.length<e)return t;t=t.slice(0,Math.ceil(e/32));var s=t.length;return e&=31,s>0&&e&&(t[s-1]=sjcl.bitArray.partial(e,t[s-1]&2147483648>>e-1,1)),t},partial:function(t,e,s){return 32===t?e:(s?0|e:e<<32-t)+1099511627776*t},getPartial:function(t){return Math.round(t/1099511627776)||32},equal:function(t,e){if(sjcl.bitArray.bitLength(t)!==sjcl.bitArray.bitLength(e))return v;var s,i=0;for(s=0;s<t.length;s++)i|=t[s]^e[s];return 0===i},O:function(t,e,i,n){var c;for(c=0,n===s&&(n=[]);e>=32;e-=32)n.push(i),i=0;if(0===e)return n.concat(t);for(c=0;c<t.length;c++)n.push(i|t[c]>>>e),i=t[c]<<32-e;return c=t.length?t[t.length-1]:0,t=sjcl.bitArray.getPartial(c),n.push(sjcl.bitArray.partial(e+t&31,e+t>32?i:n.pop(),1)),n},t:function(t,e){return[t[0]^e[0],t[1]^e[1],t[2]^e[2],t[3]^e[3]]}},sjcl.codec.utf8String={fromBits:function(t){var e,s,i="",n=sjcl.bitArray.bitLength(t);for(e=0;n/8>e;e++)0===(3&e)&&(s=t[e/4]),i+=String.fromCharCode(s>>>24),s<<=8;return decodeURIComponent(escape(i))},toBits:function(t){t=unescape(encodeURIComponent(t));var e,s=[],i=0;for(e=0;e<t.length;e++)i=i<<8|t.charCodeAt(e),3===(3&e)&&(s.push(i),i=0);return 3&e&&s.push(sjcl.bitArray.partial(8*(3&e),i)),s}},sjcl.codec.hex={fromBits:function(t){var e,s="";for(e=0;e<t.length;e++)s+=((0|t[e])+0xf00000000000).toString(16).substr(4);return s.substr(0,sjcl.bitArray.bitLength(t)/4)},toBits:function(t){var e,s,i=[];for(t=t.replace(/\s|0x/g,""),s=t.length,t+="00000000",e=0;e<t.length;e+=8)i.push(0^parseInt(t.substr(e,8),16));return sjcl.bitArray.clamp(i,4*s)}},sjcl.codec.base64={I:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",fromBits:function(t,e,s){var i="",n=0,c=sjcl.codec.base64.I,r=0,o=sjcl.bitArray.bitLength(t);for(s&&(c=c.substr(0,62)+"-_"),s=0;6*i.length<o;)i+=c.charAt((r^t[s]>>>n)>>>26),6>n?(r=t[s]<<6-n,n+=26,s++):(r<<=6,n-=6);for(;3&i.length&&!e;)i+="=";return i},toBits:function(t,e){t=t.replace(/\s|=/g,"");var s,i,n=[],c=0,r=sjcl.codec.base64.I,o=0;for(e&&(r=r.substr(0,62)+"-_"),s=0;s<t.length;s++)i=r.indexOf(t.charAt(s)),0>i&&l(new sjcl.exception.invalid("this isn't base64!")),c>26?(c-=26,n.push(o^i>>>c),o=i<<32-c):(c+=6,o^=i<<32-c);return 56&c&&n.push(sjcl.bitArray.partial(56&c,o,1)),n}},sjcl.codec.base64url={fromBits:function(t){return sjcl.codec.base64.fromBits(t,1,1)},toBits:function(t){return sjcl.codec.base64.toBits(t,1)}},sjcl.hash.sha256=function(t){this.a[0]||this.q(),t?(this.e=t.e.slice(0),this.d=t.d.slice(0),this.c=t.c):this.reset()},sjcl.hash.sha256.hash=function(t){return(new sjcl.hash.sha256).update(t).finalize()},sjcl.hash.sha256.prototype={blockSize:512,reset:function(){return this.e=this.j.slice(0),this.d=[],this.c=0,this},update:function(t){"string"==typeof t&&(t=sjcl.codec.utf8String.toBits(t));var e,s=this.d=sjcl.bitArray.concat(this.d,t);for(e=this.c,t=this.c=e+sjcl.bitArray.bitLength(t),e=512+e&-512;t>=e;e+=512)this.p(s.splice(0,16));return this},finalize:function(){var t,e=this.d,s=this.e,e=sjcl.bitArray.concat(e,[sjcl.bitArray.partial(1,1)]);for(t=e.length+2;15&t;t++)e.push(0);for(e.push(Math.floor(this.c/4294967296)),e.push(0|this.c);e.length;)this.p(e.splice(0,16));return this.reset(),s},j:[],a:[],q:function(){function t(t){return 4294967296*(t-Math.floor(t))|0}var e,s=0,i=2;t:for(;64>s;i++){for(e=2;i>=e*e;e++)if(0===i%e)continue t;8>s&&(this.j[s]=t(Math.pow(i,.5))),this.a[s]=t(Math.pow(i,1/3)),s++}},p:function(t){var e,s,i=t.slice(0),n=this.e,c=this.a,r=n[0],o=n[1],a=n[2],l=n[3],h=n[4],u=n[5],d=n[6],p=n[7];for(t=0;64>t;t++)16>t?e=i[t]:(e=i[t+1&15],s=i[t+14&15],e=i[15&t]=(e>>>7^e>>>18^e>>>3^e<<25^e<<14)+(s>>>17^s>>>19^s>>>10^s<<15^s<<13)+i[15&t]+i[t+9&15]|0),e=e+p+(h>>>6^h>>>11^h>>>25^h<<26^h<<21^h<<7)+(d^h&(u^d))+c[t],p=d,d=u,u=h,h=l+e|0,l=a,a=o,o=r,r=e+(o&a^l&(o^a))+(o>>>2^o>>>13^o>>>22^o<<30^o<<19^o<<10)|0;n[0]=n[0]+r|0,n[1]=n[1]+o|0,n[2]=n[2]+a|0,n[3]=n[3]+l|0,n[4]=n[4]+h|0,n[5]=n[5]+u|0,n[6]=n[6]+d|0,n[7]=n[7]+p|0}},sjcl.hash.sha512=function(t){this.a[0]||this.q(),t?(this.e=t.e.slice(0),this.d=t.d.slice(0),this.c=t.c):this.reset()},sjcl.hash.sha512.hash=function(t){return(new sjcl.hash.sha512).update(t).finalize()},sjcl.hash.sha512.prototype={blockSize:1024,reset:function(){return this.e=this.j.slice(0),this.d=[],this.c=0,this},update:function(t){"string"==typeof t&&(t=sjcl.codec.utf8String.toBits(t));var e,s=this.d=sjcl.bitArray.concat(this.d,t);for(e=this.c,t=this.c=e+sjcl.bitArray.bitLength(t),e=1024+e&-1024;t>=e;e+=1024)this.p(s.splice(0,32));return this},finalize:function(){var t,e=this.d,s=this.e,e=sjcl.bitArray.concat(e,[sjcl.bitArray.partial(1,1)]);for(t=e.length+4;31&t;t++)e.push(0);for(e.push(0),e.push(0),e.push(Math.floor(this.c/4294967296)),e.push(0|this.c);e.length;)this.p(e.splice(0,32));return this.reset(),s},j:[],Y:[12372232,13281083,9762859,1914609,15106769,4090911,4308331,8266105],a:[],$:[2666018,15689165,5061423,9034684,4764984,380953,1658779,7176472,197186,7368638,14987916,16757986,8096111,1480369,13046325,6891156,15813330,5187043,9229749,11312229,2818677,10937475,4324308,1135541,6741931,11809296,16458047,15666916,11046850,698149,229999,945776,13774844,2541862,12856045,9810911,11494366,7844520,15576806,8533307,15795044,4337665,16291729,5553712,15684120,6662416,7413802,12308920,13816008,4303699,9366425,10176680,13195875,4295371,6546291,11712675,15708924,1519456,15772530,6568428,6495784,8568297,13007125,7492395,2515356,12632583,14740254,7262584,1535930,13146278,16321966,1853211,294276,13051027,13221564,1051980,4080310,6651434,14088940,4675607],q:function(){function t(t){return 4294967296*(t-Math.floor(t))|0}function e(t){return 1099511627776*(t-Math.floor(t))&255}var s,i=0,n=2;t:for(;80>i;n++){for(s=2;n>=s*s;s++)if(0===n%s)continue t;8>i&&(this.j[2*i]=t(Math.pow(n,.5)),this.j[2*i+1]=e(Math.pow(n,.5))<<24|this.Y[i]),this.a[2*i]=t(Math.pow(n,1/3)),this.a[2*i+1]=e(Math.pow(n,1/3))<<24|this.$[i],i++}},p:function(t){var e,s,i=t.slice(0),n=this.e,c=this.a,r=n[0],o=n[1],a=n[2],l=n[3],h=n[4],u=n[5],d=n[6],p=n[7],f=n[8],m=n[9],j=n[10],g=n[11],y=n[12],v=n[13],b=n[14],w=n[15],k=r,A=o,x=a,B=l,C=h,L=u,S=d,E=p,M=f,P=m,z=j,R=g,O=y,U=v,T=b,V=w;for(t=0;80>t;t++){if(16>t)e=i[2*t],s=i[2*t+1];else{s=i[2*(t-15)];var I=i[2*(t-15)+1];e=(I<<31|s>>>1)^(I<<24|s>>>8)^s>>>7;var q=(s<<31|I>>>1)^(s<<24|I>>>8)^(s<<25|I>>>7);s=i[2*(t-2)];var D=i[2*(t-2)+1],I=(D<<13|s>>>19)^(s<<3|D>>>29)^s>>>6,D=(s<<13|D>>>19)^(D<<3|s>>>29)^(s<<26|D>>>6),G=i[2*(t-7)],$=i[2*(t-16)],K=i[2*(t-16)+1];s=q+i[2*(t-7)+1],e=e+G+(q>>>0>s>>>0?1:0),s+=D,e+=I+(D>>>0>s>>>0?1:0),s+=K,e+=$+(K>>>0>s>>>0?1:0)}i[2*t]=e|=0,i[2*t+1]=s|=0;var G=M&z^~M&O,N=P&R^~P&U,D=k&x^k&C^x&C,W=A&B^A&L^B&L,$=(A<<4|k>>>28)^(k<<30|A>>>2)^(k<<25|A>>>7),K=(k<<4|A>>>28)^(A<<30|k>>>2)^(A<<25|k>>>7),Y=c[2*t],F=c[2*t+1],I=V+((M<<18|P>>>14)^(M<<14|P>>>18)^(P<<23|M>>>9)),q=T+((P<<18|M>>>14)^(P<<14|M>>>18)^(M<<23|P>>>9))+(V>>>0>I>>>0?1:0),I=I+N,q=q+(G+(N>>>0>I>>>0?1:0)),I=I+F,q=q+(Y+(F>>>0>I>>>0?1:0)),I=I+s,q=q+(e+(s>>>0>I>>>0?1:0));s=K+W,e=$+D+(K>>>0>s>>>0?1:0),T=O,V=U,O=z,U=R,z=M,R=P,P=E+I|0,M=S+q+(E>>>0>P>>>0?1:0)|0,S=C,E=L,C=x,L=B,x=k,B=A,A=I+s|0,k=q+e+(I>>>0>A>>>0?1:0)|0}o=n[1]=o+A|0,n[0]=r+k+(A>>>0>o>>>0?1:0)|0,l=n[3]=l+B|0,n[2]=a+x+(B>>>0>l>>>0?1:0)|0,u=n[5]=u+L|0,n[4]=h+C+(L>>>0>u>>>0?1:0)|0,p=n[7]=p+E|0,n[6]=d+S+(E>>>0>p>>>0?1:0)|0,m=n[9]=m+P|0,n[8]=f+M+(P>>>0>m>>>0?1:0)|0,g=n[11]=g+R|0,n[10]=j+z+(R>>>0>g>>>0?1:0)|0,v=n[13]=v+U|0,n[12]=y+O+(U>>>0>v>>>0?1:0)|0,w=n[15]=w+V|0,n[14]=b+T+(V>>>0>w>>>0?1:0)|0}},sjcl.mode.ccm={name:"ccm",encrypt:function(t,e,s,i,n){var c,r=e.slice(0),o=sjcl.bitArray,a=o.bitLength(s)/8,h=o.bitLength(r)/8;for(n=n||64,i=i||[],7>a&&l(new sjcl.exception.invalid("ccm: iv must be at least 7 bytes")),c=2;4>c&&h>>>8*c;c++);return 15-a>c&&(c=15-a),s=o.clamp(s,8*(15-c)),e=sjcl.mode.ccm.K(t,e,s,i,n,c),r=sjcl.mode.ccm.L(t,r,s,e,n,c),o.concat(r.data,r.tag)},decrypt:function(t,e,s,i,n){n=n||64,i=i||[];var c=sjcl.bitArray,r=c.bitLength(s)/8,o=c.bitLength(e),a=c.clamp(e,o-n),h=c.bitSlice(e,o-n),o=(o-n)/8;for(7>r&&l(new sjcl.exception.invalid("ccm: iv must be at least 7 bytes")),e=2;4>e&&o>>>8*e;e++);return 15-r>e&&(e=15-r),s=c.clamp(s,8*(15-e)),a=sjcl.mode.ccm.L(t,a,s,h,n,e),t=sjcl.mode.ccm.K(t,a.data,s,i,n,e),c.equal(a.tag,t)||l(new sjcl.exception.corrupt("ccm: tag doesn't match")),a.data},K:function(t,e,s,i,n,c){var r=[],o=sjcl.bitArray,a=o.t;if(n/=8,(n%2||4>n||n>16)&&l(new sjcl.exception.invalid("ccm: invalid tag length")),(4294967295<i.length||4294967295<e.length)&&l(new sjcl.exception.bug("ccm: can't deal with 4GiB or more data")),c=[o.partial(8,(i.length?64:0)|n-2<<2|c-1)],c=o.concat(c,s),c[3]|=o.bitLength(e)/8,c=t.encrypt(c),i.length)for(s=o.bitLength(i)/8,65279>=s?r=[o.partial(16,s)]:4294967295>=s&&(r=o.concat([o.partial(16,65534)],[s])),r=o.concat(r,i),i=0;i<r.length;i+=4)c=t.encrypt(a(c,r.slice(i,i+4).concat([0,0,0])));for(i=0;i<e.length;i+=4)c=t.encrypt(a(c,e.slice(i,i+4).concat([0,0,0])));return o.clamp(c,8*n)},L:function(t,e,s,i,n,c){var r,o=sjcl.bitArray;r=o.t;var a=e.length,l=o.bitLength(e);if(s=o.concat([o.partial(8,c-1)],s).concat([0,0,0]).slice(0,4),i=o.bitSlice(r(i,t.encrypt(s)),0,n),!a)return{tag:i,data:[]};for(r=0;a>r;r+=4)s[3]++,n=t.encrypt(s),e[r]^=n[0],e[r+1]^=n[1],e[r+2]^=n[2],e[r+3]^=n[3];return{tag:i,data:o.clamp(e,l)}}},sjcl.beware===s&&(sjcl.beware={}),sjcl.beware["CBC mode is dangerous because it doesn't protect message integrity."]=function(){sjcl.mode.cbc={name:"cbc",encrypt:function(t,e,s,i){i&&i.length&&l(new sjcl.exception.invalid("cbc can't authenticate data")),128!==sjcl.bitArray.bitLength(s)&&l(new sjcl.exception.invalid("cbc iv must be 128 bits"));var n=sjcl.bitArray,c=n.t,r=n.bitLength(e),o=0,a=[];for(7&r&&l(new sjcl.exception.invalid("pkcs#5 padding only works for multiples of a byte")),i=0;r>=o+128;i+=4,o+=128)s=t.encrypt(c(s,e.slice(i,i+4))),a.splice(i,0,s[0],s[1],s[2],s[3]);return r=16843009*(16-(r>>3&15)),s=t.encrypt(c(s,n.concat(e,[r,r,r,r]).slice(i,i+4))),a.splice(i,0,s[0],s[1],s[2],s[3]),a},decrypt:function(t,e,s,i){i&&i.length&&l(new sjcl.exception.invalid("cbc can't authenticate data")),128!==sjcl.bitArray.bitLength(s)&&l(new sjcl.exception.invalid("cbc iv must be 128 bits")),(127&sjcl.bitArray.bitLength(e)||!e.length)&&l(new sjcl.exception.corrupt("cbc ciphertext must be a positive multiple of the block size"));var n,c=sjcl.bitArray,r=c.t,o=[];for(i=0;i<e.length;i+=4)n=e.slice(i,i+4),s=r(s,t.decrypt(n)),o.splice(i,0,s[0],s[1],s[2],s[3]),s=n;return n=255&o[i-1],(0===n||n>16)&&l(new sjcl.exception.corrupt("pkcs#5 padding corrupt")),s=16843009*n,c.equal(c.bitSlice([s,s,s,s],0,8*n),c.bitSlice(o,32*o.length-8*n,32*o.length))||l(new sjcl.exception.corrupt("pkcs#5 padding corrupt")),c.bitSlice(o,0,32*o.length-8*n)}}},sjcl.misc.hmac=function(t,e){this.M=e=e||sjcl.hash.sha256;var s,i=[[],[]],n=e.prototype.blockSize/32;for(this.o=[new e,new e],t.length>n&&(t=e.hash(t)),s=0;n>s;s++)i[0][s]=909522486^t[s],i[1][s]=1549556828^t[s];this.o[0].update(i[0]),this.o[1].update(i[1]),this.G=new e(this.o[0])},sjcl.misc.hmac.prototype.encrypt=sjcl.misc.hmac.prototype.mac=function(t){return this.P&&l(new sjcl.exception.invalid("encrypt on already updated hmac called!")),this.update(t),this.digest(t)},sjcl.misc.hmac.prototype.reset=function(){this.G=new this.M(this.o[0]),this.P=v},sjcl.misc.hmac.prototype.update=function(t){this.P=!0,this.G.update(t)},sjcl.misc.hmac.prototype.digest=function(){var t=this.G.finalize(),t=new this.M(this.o[1]).update(t).finalize();return this.reset(),t},sjcl.misc.pbkdf2=function(t,e,s,i,n){s=s||1e3,(0>i||0>s)&&l(sjcl.exception.invalid("invalid params to pbkdf2")),"string"==typeof t&&(t=sjcl.codec.utf8String.toBits(t)),"string"==typeof e&&(e=sjcl.codec.utf8String.toBits(e)),n=n||sjcl.misc.hmac,t=new n(t);var c,r,o,a,h=[],u=sjcl.bitArray;for(a=1;32*h.length<(i||1);a++){for(n=c=t.encrypt(u.concat(e,[a])),r=1;s>r;r++)for(c=t.encrypt(c),o=0;o<c.length;o++)n[o]^=c[o];h=h.concat(n)}return i&&(h=u.clamp(h,i)),h},sjcl.prng=function(t){this.f=[new sjcl.hash.sha256],this.k=[0],this.F=0,this.s={},this.D=0,this.J={},this.N=this.g=this.l=this.V=0,this.a=[0,0,0,0,0,0,0,0],this.i=[0,0,0,0],this.B=s,this.C=t,this.r=v,this.A={progress:{},seeded:{}},this.n=this.U=0,this.u=1,this.w=2,this.R=65536,this.H=[0,48,64,96,128,192,256,384,512,768,1024],this.S=3e4,this.Q=80},sjcl.prng.prototype={randomWords:function(t,e){var s,i=[];s=this.isReady(e);var n;if(s===this.n&&l(new sjcl.exception.notReady("generator isn't seeded")),s&this.w){s=!(s&this.u),n=[];var c,r=0;for(this.N=n[0]=(new Date).valueOf()+this.S,c=0;16>c;c++)n.push(4294967296*Math.random()|0);for(c=0;c<this.f.length&&(n=n.concat(this.f[c].finalize()),r+=this.k[c],this.k[c]=0,!(!s&&this.F&1<<c));c++);for(this.F>=1<<this.f.length&&(this.f.push(new sjcl.hash.sha256),this.k.push(0)),this.g-=r,r>this.l&&(this.l=r),this.F++,this.a=sjcl.hash.sha256.hash(this.a.concat(n)),this.B=new sjcl.cipher.aes(this.a),s=0;4>s&&(this.i[s]=this.i[s]+1|0,!this.i[s]);s++);}for(s=0;t>s;s+=4)0===(s+1)%this.R&&ba(this),n=S(this),i.push(n[0],n[1],n[2],n[3]);return ba(this),i.slice(0,t)},setDefaultParanoia:function(t,e){0===t&&"Setting paranoia=0 will ruin your security; use it only for testing"!==e&&l("Setting paranoia=0 will ruin your security; use it only for testing"),this.C=t},addEntropy:function(t,e,i){i=i||"user";var n,c,r=(new Date).valueOf(),o=this.s[i],a=this.isReady(),h=0;switch(n=this.J[i],n===s&&(n=this.J[i]=this.V++),o===s&&(o=this.s[i]=0),this.s[i]=(this.s[i]+1)%this.f.length,typeof t){case"number":e===s&&(e=1),this.f[o].update([n,this.D++,1,e,r,1,0|t]);break;case"object":if(i=Object.prototype.toString.call(t),"[object Uint32Array]"===i){for(c=[],i=0;i<t.length;i++)c.push(t[i]);t=c}else for("[object Array]"!==i&&(h=1),i=0;i<t.length&&!h;i++)"number"!=typeof t[i]&&(h=1);if(!h){if(e===s)for(i=e=0;i<t.length;i++)for(c=t[i];c>0;)e++,c>>>=1;this.f[o].update([n,this.D++,2,e,r,t.length].concat(t))}break;case"string":e===s&&(e=t.length),this.f[o].update([n,this.D++,3,e,r,t.length]),this.f[o].update(t);break;default:h=1}h&&l(new sjcl.exception.bug("random: addEntropy only supports number, array of numbers or string")),this.k[o]+=e,this.g+=e,a===this.n&&(this.isReady()!==this.n&&ca("seeded",Math.max(this.l,this.g)),ca("progress",this.getProgress()))},isReady:function(t){return t=this.H[t!==s?t:this.C],this.l&&this.l>=t?this.k[0]>this.Q&&(new Date).valueOf()>this.N?this.w|this.u:this.u:this.g>=t?this.w|this.n:this.n},getProgress:function(t){return t=this.H[t?t:this.C],this.l>=t?1:this.g>t?1:this.g/t},startCollectors:function(){this.r||(this.b={loadTimeCollector:T(this,this.aa),mouseCollector:T(this,this.ba),keyboardCollector:T(this,this.Z),accelerometerCollector:T(this,this.T)},window.addEventListener?(window.addEventListener("load",this.b.loadTimeCollector,v),window.addEventListener("mousemove",this.b.mouseCollector,v),window.addEventListener("keypress",this.b.keyboardCollector,v),window.addEventListener("devicemotion",this.b.accelerometerCollector,v)):document.attachEvent?(document.attachEvent("onload",this.b.loadTimeCollector),document.attachEvent("onmousemove",this.b.mouseCollector),document.attachEvent("keypress",this.b.keyboardCollector)):l(new sjcl.exception.bug("can't attach event")),this.r=!0)},stopCollectors:function(){this.r&&(window.removeEventListener?(window.removeEventListener("load",this.b.loadTimeCollector,v),window.removeEventListener("mousemove",this.b.mouseCollector,v),window.removeEventListener("keypress",this.b.keyboardCollector,v),window.removeEventListener("devicemotion",this.b.accelerometerCollector,v)):document.detachEvent&&(document.detachEvent("onload",this.b.loadTimeCollector),document.detachEvent("onmousemove",this.b.mouseCollector),document.detachEvent("keypress",this.b.keyboardCollector)),this.r=v)},addEventListener:function(t,e){this.A[t][this.U++]=e},removeEventListener:function(t,e){var s,i,n=this.A[t],c=[];for(i in n)n.hasOwnProperty(i)&&n[i]===e&&c.push(i);for(s=0;s<c.length;s++)i=c[s],delete n[i]},Z:function(){U(1)},ba:function(t){sjcl.random.addEntropy([t.x||t.clientX||t.offsetX||0,t.y||t.clientY||t.offsetY||0],2,"mouse"),U(0)},aa:function(){U(2)},T:function(t){if(t=t.accelerationIncludingGravity.x||t.accelerationIncludingGravity.y||t.accelerationIncludingGravity.z,window.orientation){var e=window.orientation;"number"==typeof e&&sjcl.random.addEntropy(e,1,"accelerometer")}t&&sjcl.random.addEntropy(t,2,"accelerometer"),U(0)}},sjcl.random=new sjcl.prng(6);t:try{var V,da,$,ea;if(ea="undefined"!=typeof module){var ja;if(ja=module.exports){var ka;try{ka=require("crypto")}catch(na){ka=null}ja=(da=ka)&&da.randomBytes}ea=ja}if(ea)V=da.randomBytes(128),V=new Uint32Array(new Uint8Array(V).buffer),sjcl.random.addEntropy(V,1024,"crypto['randomBytes']");else if(window&&Uint32Array){if($=new Uint32Array(32),window.crypto&&window.crypto.getRandomValues)window.crypto.getRandomValues($);else{if(!window.msCrypto||!window.msCrypto.getRandomValues)break t;window.msCrypto.getRandomValues($)}sjcl.random.addEntropy($,1024,"crypto['getRandomValues']")}}catch(oa){"undefined"!=typeof window&&window.console&&(console.log("There was an error collecting entropy from the browser:"),console.log(oa))}sjcl.json={defaults:{v:1,iter:1e3,ks:128,ts:64,mode:"ccm",adata:"",cipher:"aes"},X:function(t,e,s,i){s=s||{},i=i||{};var n,c=sjcl.json,r=c.h({iv:sjcl.random.randomWords(4,0)},c.defaults);return c.h(r,s),s=r.adata,"string"==typeof r.salt&&(r.salt=sjcl.codec.base64.toBits(r.salt)),"string"==typeof r.iv&&(r.iv=sjcl.codec.base64.toBits(r.iv)),(!sjcl.mode[r.mode]||!sjcl.cipher[r.cipher]||"string"==typeof t&&100>=r.iter||64!==r.ts&&96!==r.ts&&128!==r.ts||128!==r.ks&&192!==r.ks&&256!==r.ks||2>r.iv.length||4<r.iv.length)&&l(new sjcl.exception.invalid("json encrypt: invalid parameters")),"string"==typeof t?(n=sjcl.misc.cachedPbkdf2(t,r),t=n.key.slice(0,r.ks/32),r.salt=n.salt):sjcl.ecc&&t instanceof sjcl.ecc.elGamal.publicKey&&(n=t.kem(),r.kemtag=n.tag,t=n.key.slice(0,r.ks/32)),"string"==typeof e&&(e=sjcl.codec.utf8String.toBits(e)),"string"==typeof s&&(s=sjcl.codec.utf8String.toBits(s)),n=new sjcl.cipher[r.cipher](t),c.h(i,r),i.key=t,r.ct=sjcl.mode[r.mode].encrypt(n,e,r.iv,s,r.ts),r},encrypt:function(){var t=sjcl.json,e=t.X.apply(t,arguments);return t.encode(e)},W:function(t,e,s,i){s=s||{},i=i||{};var n=sjcl.json;e=n.h(n.h(n.h({},n.defaults),e),s,!0);var c;return s=e.adata,"string"==typeof e.salt&&(e.salt=sjcl.codec.base64.toBits(e.salt)),"string"==typeof e.iv&&(e.iv=sjcl.codec.base64.toBits(e.iv)),(!sjcl.mode[e.mode]||!sjcl.cipher[e.cipher]||"string"==typeof t&&100>=e.iter||64!==e.ts&&96!==e.ts&&128!==e.ts||128!==e.ks&&192!==e.ks&&256!==e.ks||!e.iv||2>e.iv.length||4<e.iv.length)&&l(new sjcl.exception.invalid("json decrypt: invalid parameters")),"string"==typeof t?(c=sjcl.misc.cachedPbkdf2(t,e),t=c.key.slice(0,e.ks/32),e.salt=c.salt):sjcl.ecc&&t instanceof sjcl.ecc.elGamal.secretKey&&(t=t.unkem(sjcl.codec.base64.toBits(e.kemtag)).slice(0,e.ks/32)),"string"==typeof s&&(s=sjcl.codec.utf8String.toBits(s)),c=new sjcl.cipher[e.cipher](t),s=sjcl.mode[e.mode].decrypt(c,e.ct,e.iv,s,e.ts),n.h(i,e),i.key=t,sjcl.codec.utf8String.fromBits(s)},decrypt:function(t,e,s,i){var n=sjcl.json;return n.W(t,n.decode(e),s,i)},encode:function(t){var e,s="{",i="";for(e in t)if(t.hasOwnProperty(e))switch(e.match(/^[a-z0-9]+$/i)||l(new sjcl.exception.invalid("json encode: invalid property name")),s+=i+'"'+e+'":',i=",",typeof t[e]){case"number":case"boolean":s+=t[e];break;case"string":s+='"'+escape(t[e])+'"';break;case"object":s+='"'+sjcl.codec.base64.fromBits(t[e],0)+'"';break;default:l(new sjcl.exception.bug("json encode: unsupported type"))}return s+"}"},decode:function(t){t=t.replace(/\s/g,""),t.match(/^\{.*\}$/)||l(new sjcl.exception.invalid("json decode: this isn't json!")),t=t.replace(/^\{|\}$/g,"").split(/,/);var e,s,i={};for(e=0;e<t.length;e++)(s=t[e].match(/^(?:(["']?)([a-z][a-z0-9]*)\1):(?:(\d+)|"([a-z0-9+\/%*_.@=\-]*)")$/i))||l(new sjcl.exception.invalid("json decode: this isn't json!")),i[s[2]]=s[3]?parseInt(s[3],10):s[2].match(/^(ct|salt|iv)$/)?sjcl.codec.base64.toBits(s[4]):unescape(s[4]);return i},h:function(t,e,i){if(t===s&&(t={}),e===s)return t;for(var n in e)e.hasOwnProperty(n)&&(i&&t[n]!==s&&t[n]!==e[n]&&l(new sjcl.exception.invalid("required parameter overridden")),t[n]=e[n]);return t},ea:function(t,e){var s,i={};for(s in t)t.hasOwnProperty(s)&&t[s]!==e[s]&&(i[s]=t[s]);return i},da:function(t,e){var i,n={};for(i=0;i<e.length;i++)t[e[i]]!==s&&(n[e[i]]=t[e[i]]);return n}},sjcl.encrypt=sjcl.json.encrypt,sjcl.decrypt=sjcl.json.decrypt,sjcl.misc.ca={},sjcl.misc.cachedPbkdf2=function(t,e){var i,n=sjcl.misc.ca;return e=e||{},i=e.iter||1e3,n=n[t]=n[t]||{},i=n[i]=n[i]||{firstSalt:e.salt&&e.salt.length?e.salt.slice(0):sjcl.random.randomWords(2,0)},n=e.salt===s?i.firstSalt:e.salt,i[n]=i[n]||sjcl.misc.pbkdf2(t,n,e.iter),{key:i[n].slice(0),salt:n.slice(0)}};
},{"crypto":89}],"./lib/sjcl":[function(require,module,exports){
module.exports=require('oLMOpG');
},{}],"ULNIu2":[function(require,module,exports){
(function(e){var s=(require("bufferput"),require("buffertools")),t=function(s){return new e(s,"hex")};exports.livenet={name:"livenet",magic:t("f9beb4d9"),addressVersion:0,privKeyVersion:128,P2SHVersion:5,hkeyPublicVersion:76067358,hkeyPrivateVersion:76066276,genesisBlock:{hash:t("6FE28C0AB6F1B372C1A6A246AE63F74F931E8365E15A089C68D6190000000000"),merkle_root:t("3BA3EDFD7A7B12B27AC72C3E67768F617FC81BC3888A51323A9FB8AA4B1E5E4A"),height:0,nonce:2083236893,version:1,prev_hash:s.fill(new e(32),0),timestamp:1231006505,bits:486604799},dnsSeeds:["seed.bitcoin.sipa.be","dnsseed.bluematt.me","dnsseed.bitcoin.dashjr.org","seed.bitcoinstats.com","seed.bitnodes.io","bitseed.xf2.org"],defaultClientPort:8333},exports.testnet={name:"testnet",magic:t("0b110907"),addressVersion:111,privKeyVersion:239,P2SHVersion:196,hkeyPublicVersion:70617039,hkeyPrivateVersion:70615956,genesisBlock:{hash:t("43497FD7F826957108F4A30FD9CEC3AEBA79972084E90EAD01EA330900000000"),merkle_root:t("3BA3EDFD7A7B12B27AC72C3E67768F617FC81BC3888A51323A9FB8AA4B1E5E4A"),height:0,nonce:414098458,version:1,prev_hash:s.fill(new e(32),0),timestamp:1296688602,bits:486604799},dnsSeeds:["testnet-seed.bitcoin.petertodd.org","testnet-seed.bluematt.me"],defaultClientPort:18333}}).call(this,require("buffer").Buffer);
},{"buffer":85,"bufferput":"aXRuS6","buffertools":"fugeBw"}],"./networks":[function(require,module,exports){
module.exports=require('ULNIu2');
},{}],73:[function(require,module,exports){
(function(n){!function(){function t(n){var t=!1;return function(){if(t)throw new Error("Callback was already called.");t=!0,n.apply(e,arguments)}}var e,r,u={};e=this,null!=e&&(r=e.async),u.noConflict=function(){return e.async=r,u};var i=function(n,t){if(n.forEach)return n.forEach(t);for(var e=0;e<n.length;e+=1)t(n[e],e,n)},c=function(n,t){if(n.map)return n.map(t);var e=[];return i(n,function(n,r,u){e.push(t(n,r,u))}),e},o=function(n,t,e){return n.reduce?n.reduce(t,e):(i(n,function(n,r,u){e=t(e,n,r,u)}),e)},a=function(n){if(Object.keys)return Object.keys(n);var t=[];for(var e in n)n.hasOwnProperty(e)&&t.push(e);return t};"undefined"!=typeof n&&n.nextTick?(u.nextTick=n.nextTick,u.setImmediate="undefined"!=typeof setImmediate?function(n){setImmediate(n)}:u.nextTick):"function"==typeof setImmediate?(u.nextTick=function(n){setImmediate(n)},u.setImmediate=u.nextTick):(u.nextTick=function(n){setTimeout(n,0)},u.setImmediate=u.nextTick),u.each=function(n,e,r){if(r=r||function(){},!n.length)return r();var u=0;i(n,function(i){e(i,t(function(t){t?(r(t),r=function(){}):(u+=1,u>=n.length&&r(null))}))})},u.forEach=u.each,u.eachSeries=function(n,t,e){if(e=e||function(){},!n.length)return e();var r=0,u=function(){t(n[r],function(t){t?(e(t),e=function(){}):(r+=1,r>=n.length?e(null):u())})};u()},u.forEachSeries=u.eachSeries,u.eachLimit=function(n,t,e,r){var u=l(t);u.apply(null,[n,e,r])},u.forEachLimit=u.eachLimit;var l=function(n){return function(t,e,r){if(r=r||function(){},!t.length||0>=n)return r();var u=0,i=0,c=0;!function o(){if(u>=t.length)return r();for(;n>c&&i<t.length;)i+=1,c+=1,e(t[i-1],function(n){n?(r(n),r=function(){}):(u+=1,c-=1,u>=t.length?r():o())})}()}},f=function(n){return function(){var t=Array.prototype.slice.call(arguments);return n.apply(null,[u.each].concat(t))}},s=function(n,t){return function(){var e=Array.prototype.slice.call(arguments);return t.apply(null,[l(n)].concat(e))}},p=function(n){return function(){var t=Array.prototype.slice.call(arguments);return n.apply(null,[u.eachSeries].concat(t))}},m=function(n,t,e,r){var u=[];t=c(t,function(n,t){return{index:t,value:n}}),n(t,function(n,t){e(n.value,function(e,r){u[n.index]=r,t(e)})},function(n){r(n,u)})};u.map=f(m),u.mapSeries=p(m),u.mapLimit=function(n,t,e,r){return y(t)(n,e,r)};var y=function(n){return s(n,m)};u.reduce=function(n,t,e,r){u.eachSeries(n,function(n,r){e(t,n,function(n,e){t=e,r(n)})},function(n){r(n,t)})},u.inject=u.reduce,u.foldl=u.reduce,u.reduceRight=function(n,t,e,r){var i=c(n,function(n){return n}).reverse();u.reduce(i,t,e,r)},u.foldr=u.reduceRight;var v=function(n,t,e,r){var u=[];t=c(t,function(n,t){return{index:t,value:n}}),n(t,function(n,t){e(n.value,function(e){e&&u.push(n),t()})},function(){r(c(u.sort(function(n,t){return n.index-t.index}),function(n){return n.value}))})};u.filter=f(v),u.filterSeries=p(v),u.select=u.filter,u.selectSeries=u.filterSeries;var h=function(n,t,e,r){var u=[];t=c(t,function(n,t){return{index:t,value:n}}),n(t,function(n,t){e(n.value,function(e){e||u.push(n),t()})},function(){r(c(u.sort(function(n,t){return n.index-t.index}),function(n){return n.value}))})};u.reject=f(h),u.rejectSeries=p(h);var d=function(n,t,e,r){n(t,function(n,t){e(n,function(e){e?(r(n),r=function(){}):t()})},function(){r()})};u.detect=f(d),u.detectSeries=p(d),u.some=function(n,t,e){u.each(n,function(n,r){t(n,function(n){n&&(e(!0),e=function(){}),r()})},function(){e(!1)})},u.any=u.some,u.every=function(n,t,e){u.each(n,function(n,r){t(n,function(n){n||(e(!1),e=function(){}),r()})},function(){e(!0)})},u.all=u.every,u.sortBy=function(n,t,e){u.map(n,function(n,e){t(n,function(t,r){t?e(t):e(null,{value:n,criteria:r})})},function(n,t){if(n)return e(n);var r=function(n,t){var e=n.criteria,r=t.criteria;return r>e?-1:e>r?1:0};e(null,c(t.sort(r),function(n){return n.value}))})},u.auto=function(n,t){t=t||function(){};var e=a(n);if(!e.length)return t(null);var r={},c=[],l=function(n){c.unshift(n)},f=function(n){for(var t=0;t<c.length;t+=1)if(c[t]===n)return void c.splice(t,1)},s=function(){i(c.slice(0),function(n){n()})};l(function(){a(r).length===e.length&&(t(null,r),t=function(){})}),i(e,function(e){var c=n[e]instanceof Function?[n[e]]:n[e],p=function(n){var c=Array.prototype.slice.call(arguments,1);if(c.length<=1&&(c=c[0]),n){var o={};i(a(r),function(n){o[n]=r[n]}),o[e]=c,t(n,o),t=function(){}}else r[e]=c,u.setImmediate(s)},m=c.slice(0,Math.abs(c.length-1))||[],y=function(){return o(m,function(n,t){return n&&r.hasOwnProperty(t)},!0)&&!r.hasOwnProperty(e)};if(y())c[c.length-1](p,r);else{var v=function(){y()&&(f(v),c[c.length-1](p,r))};l(v)}})},u.waterfall=function(n,t){if(t=t||function(){},n.constructor!==Array){var e=new Error("First argument to waterfall must be an array of functions");return t(e)}if(!n.length)return t();var r=function(n){return function(e){if(e)t.apply(null,arguments),t=function(){};else{var i=Array.prototype.slice.call(arguments,1),c=n.next();i.push(c?r(c):t),u.setImmediate(function(){n.apply(null,i)})}}};r(u.iterator(n))()};var g=function(n,t,e){if(e=e||function(){},t.constructor===Array)n.map(t,function(n,t){n&&n(function(n){var e=Array.prototype.slice.call(arguments,1);e.length<=1&&(e=e[0]),t.call(null,n,e)})},e);else{var r={};n.each(a(t),function(n,e){t[n](function(t){var u=Array.prototype.slice.call(arguments,1);u.length<=1&&(u=u[0]),r[n]=u,e(t)})},function(n){e(n,r)})}};u.parallel=function(n,t){g({map:u.map,each:u.each},n,t)},u.parallelLimit=function(n,t,e){g({map:y(t),each:l(t)},n,e)},u.series=function(n,t){if(t=t||function(){},n.constructor===Array)u.mapSeries(n,function(n,t){n&&n(function(n){var e=Array.prototype.slice.call(arguments,1);e.length<=1&&(e=e[0]),t.call(null,n,e)})},t);else{var e={};u.eachSeries(a(n),function(t,r){n[t](function(n){var u=Array.prototype.slice.call(arguments,1);u.length<=1&&(u=u[0]),e[t]=u,r(n)})},function(n){t(n,e)})}},u.iterator=function(n){var t=function(e){var r=function(){return n.length&&n[e].apply(null,arguments),r.next()};return r.next=function(){return e<n.length-1?t(e+1):null},r};return t(0)},u.apply=function(n){var t=Array.prototype.slice.call(arguments,1);return function(){return n.apply(null,t.concat(Array.prototype.slice.call(arguments)))}};var k=function(n,t,e,r){var u=[];n(t,function(n,t){e(n,function(n,e){u=u.concat(e||[]),t(n)})},function(n){r(n,u)})};u.concat=f(k),u.concatSeries=p(k),u.whilst=function(n,t,e){n()?t(function(r){return r?e(r):void u.whilst(n,t,e)}):e()},u.doWhilst=function(n,t,e){n(function(r){return r?e(r):void(t()?u.doWhilst(n,t,e):e())})},u.until=function(n,t,e){n()?e():t(function(r){return r?e(r):void u.until(n,t,e)})},u.doUntil=function(n,t,e){n(function(r){return r?e(r):void(t()?e():u.doUntil(n,t,e))})},u.queue=function(n,e){function r(n,t,r,c){t.constructor!==Array&&(t=[t]),i(t,function(t){var i={data:t,callback:"function"==typeof c?c:null};r?n.tasks.unshift(i):n.tasks.push(i),n.saturated&&n.tasks.length===e&&n.saturated(),u.setImmediate(n.process)})}void 0===e&&(e=1);var c=0,o={tasks:[],concurrency:e,saturated:null,empty:null,drain:null,push:function(n,t){r(o,n,!1,t)},unshift:function(n,t){r(o,n,!0,t)},process:function(){if(c<o.concurrency&&o.tasks.length){var e=o.tasks.shift();o.empty&&0===o.tasks.length&&o.empty(),c+=1;var r=function(){c-=1,e.callback&&e.callback.apply(e,arguments),o.drain&&o.tasks.length+c===0&&o.drain(),o.process()},u=t(r);n(e.data,u)}},length:function(){return o.tasks.length},running:function(){return c}};return o},u.cargo=function(n,t){var e=!1,r=[],o={tasks:r,payload:t,saturated:null,empty:null,drain:null,push:function(n,e){n.constructor!==Array&&(n=[n]),i(n,function(n){r.push({data:n,callback:"function"==typeof e?e:null}),o.saturated&&r.length===t&&o.saturated()}),u.setImmediate(o.process)},process:function a(){if(!e){if(0===r.length)return void(o.drain&&o.drain());var u="number"==typeof t?r.splice(0,t):r.splice(0),l=c(u,function(n){return n.data});o.empty&&o.empty(),e=!0,n(l,function(){e=!1;var n=arguments;i(u,function(t){t.callback&&t.callback.apply(null,n)}),a()})}},length:function(){return r.length},running:function(){return e}};return o};var A=function(n){return function(t){var e=Array.prototype.slice.call(arguments,1);t.apply(null,e.concat([function(t){var e=Array.prototype.slice.call(arguments,1);"undefined"!=typeof console&&(t?console.error&&console.error(t):console[n]&&i(e,function(t){console[n](t)}))}]))}};u.log=A("log"),u.dir=A("dir"),u.memoize=function(n,t){var e={},r={};t=t||function(n){return n};var u=function(){var u=Array.prototype.slice.call(arguments),i=u.pop(),c=t.apply(null,u);c in e?i.apply(null,e[c]):c in r?r[c].push(i):(r[c]=[i],n.apply(null,u.concat([function(){e[c]=arguments;var n=r[c];delete r[c];for(var t=0,u=n.length;u>t;t++)n[t].apply(null,arguments)}])))};return u.memo=e,u.unmemoized=n,u},u.unmemoize=function(n){return function(){return(n.unmemoized||n).apply(null,arguments)}},u.times=function(n,t,e){for(var r=[],i=0;n>i;i++)r.push(i);return u.map(r,t,e)},u.timesSeries=function(n,t,e){for(var r=[],i=0;n>i;i++)r.push(i);return u.mapSeries(r,t,e)},u.compose=function(){var n=Array.prototype.reverse.call(arguments);return function(){var t=this,e=Array.prototype.slice.call(arguments),r=e.pop();u.reduce(n,e,function(n,e,r){e.apply(t,n.concat([function(){var n=arguments[0],t=Array.prototype.slice.call(arguments,1);r(n,t)}]))},function(n,e){r.apply(t,[n].concat(e))})}};var x=function(n,t){var e=function(){var e=this,r=Array.prototype.slice.call(arguments),u=r.pop();return n(t,function(n,t){n.apply(e,r.concat([t]))},u)};if(arguments.length>2){var r=Array.prototype.slice.call(arguments,2);return e.apply(this,r)}return e};u.applyEach=f(x),u.applyEachSeries=p(x),u.forever=function(n,t){function e(r){if(r){if(t)return t(r);throw r}n(e)}e()},"undefined"!=typeof define&&define.amd?define([],function(){return u}):"undefined"!=typeof module&&module.exports?module.exports=u:e.async=u}()}).call(this,require("/Users/ryanxcharles/dev/bitcore/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"));
},{"/Users/ryanxcharles/dev/bitcore/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":101}],74:[function(require,module,exports){
(function(t){function n(t){for(var n=0,e=0;e<t.length;e++)n+=Math.pow(256,e)*t[e];return n}function e(t){for(var n=0,e=0;e<t.length;e++)n+=Math.pow(256,t.length-e-1)*t[e];return n}function r(t){var n=e(t);return 128==(128&t[0])&&(n-=Math.pow(256,t.length)),n}function o(t){var e=n(t);return 128==(128&t[t.length-1])&&(e-=Math.pow(256,t.length)),e}function i(t){var i={};return[1,2,4,8].forEach(function(u){var s=8*u;i["word"+s+"le"]=i["word"+s+"lu"]=t(u,n),i["word"+s+"ls"]=t(u,o),i["word"+s+"be"]=i["word"+s+"bu"]=t(u,e),i["word"+s+"bs"]=t(u,r)}),i.word8=i.word8u=i.word8be,i.word8s=i.word8bs,i}var u=require("chainsaw"),s=require("events").EventEmitter,f=require("buffers"),c=require("./lib/vars.js"),l=require("stream").Stream;exports=module.exports=function(n,e){if(t.isBuffer(n))return exports.parse(n);var r=exports.stream();return n&&n.pipe?n.pipe(r):n&&(n.on(e||"data",function(t){r.write(t)}),n.on("end",function(){r.end()})),r},exports.stream=function(n){function e(t,n,e){a={bytes:t,skip:e,cb:function(t){a=null,n(t)}},r()}function r(){if(!a)return void(b&&(w=!0));if("function"==typeof a)a();else{var t=p+a.bytes;if(g.length>=t){var n;null==p?(n=g.splice(0,t),a.skip||(n=n.slice())):(a.skip||(n=g.slice(p,t)),p=t),a.skip?a.cb():a.cb(n)}}}function o(n){function o(){w||n.next()}var u=i(function(t,n){return function(r){e(t,function(t){v.set(r,n(t)),o()})}});return u.tap=function(t){n.nest(t,v.store)},u.into=function(t,e){v.get(t)||v.set(t,{});var r=v;v=c(r.get(t)),n.nest(function(){e.apply(this,arguments),this.tap(function(){v=r})},v.store)},u.flush=function(){v.store={},o()},u.loop=function(t){var e=!1;n.nest(!1,function r(){this.vars=v.store,t.call(this,function(){e=!0,o()},v.store),this.tap(function(){e?n.next():r.call(this)}.bind(this))},v.store)},u.buffer=function(t,n){"string"==typeof n&&(n=v.get(n)),e(n,function(n){v.set(t,n),o()})},u.skip=function(t){"string"==typeof t&&(t=v.get(t)),e(t,function(){o()})},u.scan=function(n,e){if("string"==typeof e)e=new t(e);else if(!t.isBuffer(e))throw new Error("search must be a Buffer or a string");var i=0;a=function(){var t=g.indexOf(e,p+i),u=t-p-i;-1!==t?(a=null,null!=p?(v.set(n,g.slice(p,p+i+u)),p+=i+u+e.length):(v.set(n,g.slice(0,i+u)),g.splice(0,i+u+e.length)),o(),r()):u=Math.max(g.length-e.length-p-i,0),i+=u},r()},u.peek=function(t){p=0,n.nest(function(){t.call(this,v.store),this.tap(function(){p=null})})},u}if(n)return exports.apply(null,arguments);var a=null,p=null,h=u.light(o);h.writable=!0;var g=f();h.write=function(t){g.push(t),r()};var v=c(),w=!1,b=!1;return h.end=function(){b=!0},h.pipe=l.prototype.pipe,Object.getOwnPropertyNames(s.prototype).forEach(function(t){h[t]=s.prototype[t]}),h},exports.parse=function(n){var e=i(function(t,i){return function(u){if(r+t<=n.length){var s=n.slice(r,r+t);r+=t,o.set(u,i(s))}else o.set(u,null);return e}}),r=0,o=c();return e.vars=o.store,e.tap=function(t){return t.call(e,o.store),e},e.into=function(t,n){o.get(t)||o.set(t,{});var r=o;return o=c(r.get(t)),n.call(e,o.store),o=r,e},e.loop=function(t){for(var n=!1,r=function(){n=!0};n===!1;)t.call(e,r,o.store);return e},e.buffer=function(t,i){"string"==typeof i&&(i=o.get(i));var u=n.slice(r,Math.min(n.length,r+i));return r+=i,o.set(t,u),e},e.skip=function(t){return"string"==typeof t&&(t=o.get(t)),r+=t,e},e.scan=function(i,u){if("string"==typeof u)u=new t(u);else if(!t.isBuffer(u))throw new Error("search must be a Buffer or a string");o.set(i,null);for(var s=0;s+r<=n.length-u.length+1;s++){for(var f=0;f<u.length&&n[r+s+f]===u[f];f++);if(f===u.length)break}return o.set(i,n.slice(r,r+s)),r+=s+u.length,e},e.peek=function(t){var n=r;return t.call(e,o.store),r=n,e},e.flush=function(){return o.store={},e},e.eof=function(){return r>=n.length},e}}).call(this,require("buffer").Buffer);
},{"./lib/vars.js":75,"buffer":85,"buffers":"OBo3aV","chainsaw":76,"events":94,"stream":108}],75:[function(require,module,exports){
module.exports=function(t){function n(t,n){var e=r.store,o=t.split(".");o.slice(0,-1).forEach(function(t){void 0===e[t]&&(e[t]={}),e=e[t]});var u=o[o.length-1];return 1==arguments.length?e[u]:e[u]=n}var r={get:function(t){return n(t)},set:function(t,r){return n(t,r)},store:t||{}};return r};
},{}],76:[function(require,module,exports){
(function(n){function t(n){var e=t.saw(n,{}),r=n.call(e.handlers,e);return void 0!==r&&(e.handlers=r),e.record(),e.chain()}function e(n){n.step=0,n.pop=function(){return n.actions[n.step++]},n.trap=function(t,e){var r=Array.isArray(t)?t:[t];n.actions.push({path:r,step:n.step,cb:e,trap:!0})},n.down=function(t){var e=(Array.isArray(t)?t:[t]).join("/"),r=n.actions.slice(n.step).map(function(t){return t.trap&&t.step<=n.step?!1:t.path.join("/")==e}).indexOf(!0);r>=0?n.step+=r:n.step=n.actions.length;var a=n.actions[n.step-1];a&&a.trap?(n.step=a.step,a.cb()):n.next()},n.jump=function(t){n.step=t,n.next()}}var r=require("traverse"),a=require("events").EventEmitter;module.exports=t,t.light=function(n){var e=t.saw(n,{}),r=n.call(e.handlers,e);return void 0!==r&&(e.handlers=r),e.chain()},t.saw=function(s,o){var i=new a;return i.handlers=o,i.actions=[],i.chain=function(){var t=r(i.handlers).map(function(n){if(this.isRoot)return n;var e=this.path;"function"==typeof n&&this.update(function(){return i.actions.push({path:e,args:[].slice.call(arguments)}),t})});return n.nextTick(function(){i.emit("begin"),i.next()}),t},i.pop=function(){return i.actions.shift()},i.next=function(){var n=i.pop();if(n){if(!n.trap){var t=i.handlers;n.path.forEach(function(n){t=t[n]}),t.apply(i.handlers,n.args)}}else i.emit("end")},i.nest=function(n){var e=[].slice.call(arguments,1),r=!0;if("boolean"==typeof n){var r=n;n=e.shift()}var a=t.saw(s,{}),o=s.call(a.handlers,a);void 0!==o&&(a.handlers=o),"undefined"!=typeof i.step&&a.record(),n.apply(a.chain(),e),r!==!1&&a.on("end",i.next)},i.record=function(){e(i)},["trap","down","jump"].forEach(function(n){i[n]=function(){throw new Error("To use the trap, down and jump features, please call record() first to start recording actions.")}}),i}}).call(this,require("/Users/ryanxcharles/dev/bitcore/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"));
},{"/Users/ryanxcharles/dev/bitcore/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":101,"events":94,"traverse":77}],77:[function(require,module,exports){
function Traverse(e){return this instanceof Traverse?void(this.value=e):new Traverse(e)}function walk(e,t,r){var n=[],o=[],a=!0;return function i(e){var c=r?copy(e):e,s={},f={node:c,node_:e,path:[].concat(n),parent:o.slice(-1)[0],key:n.slice(-1)[0],isRoot:0===n.length,level:n.length,circular:null,update:function(e){f.isRoot||(f.parent.node[f.key]=e),f.node=e},"delete":function(){delete f.parent.node[f.key]},remove:function(){Array.isArray(f.parent.node)?f.parent.node.splice(f.key,1):delete f.parent.node[f.key]},before:function(e){s.before=e},after:function(e){s.after=e},pre:function(e){s.pre=e},post:function(e){s.post=e},stop:function(){a=!1}};if(!a)return f;if("object"==typeof c&&null!==c){f.isLeaf=0==Object.keys(c).length;for(var u=0;u<o.length;u++)if(o[u].node_===e){f.circular=o[u];break}}else f.isLeaf=!0;f.notLeaf=!f.isLeaf,f.notRoot=!f.isRoot;var l=t.call(f,f.node);if(void 0!==l&&f.update&&f.update(l),s.before&&s.before.call(f,f.node),"object"==typeof f.node&&null!==f.node&&!f.circular){o.push(f);var p=Object.keys(f.node);p.forEach(function(e,t){n.push(e),s.pre&&s.pre.call(f,f.node[e],e);var o=i(f.node[e]);r&&Object.hasOwnProperty.call(f.node,e)&&(f.node[e]=o.node),o.isLast=t==p.length-1,o.isFirst=0==t,s.post&&s.post.call(f,o),n.pop()}),o.pop()}return s.after&&s.after.call(f,f.node),f}(e).node}function copy(e){if("object"==typeof e&&null!==e){var t;return t=Array.isArray(e)?[]:e instanceof Date?new Date(e):e instanceof Boolean?new Boolean(e):e instanceof Number?new Number(e):e instanceof String?new String(e):Object.create(Object.getPrototypeOf(e)),Object.keys(e).forEach(function(r){t[r]=e[r]}),t}return e}module.exports=Traverse,Traverse.prototype.get=function(e){for(var t=this.value,r=0;r<e.length;r++){var n=e[r];if(!Object.hasOwnProperty.call(t,n)){t=void 0;break}t=t[n]}return t},Traverse.prototype.set=function(e,t){for(var r=this.value,n=0;n<e.length-1;n++){var o=e[n];Object.hasOwnProperty.call(r,o)||(r[o]={}),r=r[o]}return r[e[n]]=t,t},Traverse.prototype.map=function(e){return walk(this.value,e,!0)},Traverse.prototype.forEach=function(e){return this.value=walk(this.value,e,!1),this.value},Traverse.prototype.reduce=function(e,t){var r=1===arguments.length,n=r?this.value:t;return this.forEach(function(t){this.isRoot&&r||(n=e.call(this,n,t))}),n},Traverse.prototype.deepEqual=function(e){if(1!==arguments.length)throw new Error("deepEqual requires exactly one object to compare against");var t=!0,r=e;return this.forEach(function(n){var o=function(){return void(t=!1)}.bind(this);if(!this.isRoot){if("object"!=typeof r)return o();r=r[this.key]}var a=r;this.post(function(){r=a});var i=function(e){return Object.prototype.toString.call(e)};if(this.circular)Traverse(e).get(this.circular.path)!==a&&o();else if(typeof a!=typeof n)o();else if(null===a||null===n||void 0===a||void 0===n)a!==n&&o();else if(a.__proto__!==n.__proto__)o();else if(a===n);else if("function"==typeof a)a instanceof RegExp?a.toString()!=n.toString()&&o():a!==n&&o();else if("object"==typeof a)if("[object Arguments]"===i(n)||"[object Arguments]"===i(a))i(a)!==i(n)&&o();else if(a instanceof Date||n instanceof Date)a instanceof Date&&n instanceof Date&&a.getTime()===n.getTime()||o();else{var c=Object.keys(a),s=Object.keys(n);if(c.length!==s.length)return o();for(var f=0;f<c.length;f++){var u=c[f];Object.hasOwnProperty.call(n,u)||o()}}}),t},Traverse.prototype.paths=function(){var e=[];return this.forEach(function(){e.push(this.path)}),e},Traverse.prototype.nodes=function(){var e=[];return this.forEach(function(){e.push(this.node)}),e},Traverse.prototype.clone=function(){var e=[],t=[];return function r(n){for(var o=0;o<e.length;o++)if(e[o]===n)return t[o];if("object"==typeof n&&null!==n){var a=copy(n);return e.push(n),t.push(a),Object.keys(n).forEach(function(e){a[e]=r(n[e])}),e.pop(),t.pop(),a}return n}(this.value)},Object.keys(Traverse.prototype).forEach(function(e){Traverse[e]=function(t){var r=[].slice.call(arguments,1),n=Traverse(t);return n[e].apply(n,r)}});
},{}],78:[function(require,module,exports){
(function(e,r){function o(e){"string"==typeof e?e={bindings:e}:e||(e={}),e.__proto__=d,e.module_root||(e.module_root=exports.getRoot(exports.getFileName())),".node"!=i.extname(e.bindings)&&(e.bindings+=".node");for(var r,o,n,s=[],a=0,l=e.try.length;l>a;a++){r=t.apply(null,e.try[a].map(function(r){return e[r]||r})),s.push(r);try{return o=e.path?require.resolve(r):require(r),e.path||(o.path=r),o}catch(u){if(!/not find/i.test(u.message))throw u}}throw n=new Error("Could not locate the bindings file. Tried:\n"+s.map(function(r){return e.arrow+r}).join("\n")),n.tries=s,n}var n=require("fs"),i=require("path"),t=i.join,s=i.dirname,a=n.existsSync||i.existsSync,d={arrow:e.env.NODE_BINDINGS_ARROW||" → ",compiled:e.env.NODE_BINDINGS_COMPILED_DIR||"compiled",platform:e.platform,arch:e.arch,version:e.versions.node,bindings:"bindings.node","try":[["module_root","build","bindings"],["module_root","build","Debug","bindings"],["module_root","build","Release","bindings"],["module_root","out","Debug","bindings"],["module_root","Debug","bindings"],["module_root","out","Release","bindings"],["module_root","Release","bindings"],["module_root","build","default","bindings"],["module_root","compiled","version","platform","arch","bindings"]]};module.exports=exports=o,exports.getFileName=function(){var e,o=Error.prepareStackTrace,n=Error.stackTraceLimit,i={};return Error.stackTraceLimit=10,Error.prepareStackTrace=function(o,n){for(var i=0,t=n.length;t>i;i++)if(e=n[i].getFileName(),e!==r)return},Error.captureStackTrace(i),i.stack,Error.prepareStackTrace=o,Error.stackTraceLimit=n,e},exports.getRoot=function(r){for(var o,n=s(r);;){if("."===n&&(n=e.cwd()),a(t(n,"package.json"))||a(t(n,"node_modules")))return n;if(o===n)throw new Error('Could not find module root given file: "'+r+'". Do you have a `package.json` file? ');o=n,n=t(n,"..")}}}).call(this,require("/Users/ryanxcharles/dev/bitcore/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),"/node_modules/bindings/bindings.js");
},{"/Users/ryanxcharles/dev/bitcore/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":101,"fs":81,"path":102}],"buffertools":[function(require,module,exports){
module.exports=require('fugeBw');
},{}],"fugeBw":[function(require,module,exports){
(function(t){"use strict";function r(){this.writable=!0,this.buffer=null}var e=require("events"),n=require("util"),i={};module.exports.Buffer=t;var o=function(r){return r instanceof t||r instanceof Uint8Array},f=function(t){return function(){var r=this;if(o(r));else{if(!o(arguments[0]))throw new Error("Argument should be a buffer object.");r=arguments[0],Array.prototype.shift.apply(arguments)}return t.apply(r,arguments)}},u=function(t){return function(){var r=this;if(o(r));else{if(!o(arguments[0]))throw Error("Argument should be a buffer object.");r=arguments[0],Array.prototype.shift.apply(arguments)}var e=arguments[0];if("string"==typeof e||e instanceof String||o(e))return t.apply(r,arguments);throw new Error("Second argument must be a string or a buffer.")}};i.clear=f(function(){for(var t=0;t<this.length;t++)this[t]=0;return this}),i.fill=f(function(t){for(var r="undefined"==typeof t.length?1:t.length,e=0;e<this.length;e+=r)for(var n=0;r>n;n++)this[e+n]="undefined"==typeof t.length?t:"string"==typeof t[n]?t[n].charCodeAt(0):t[n];return this}),i.indexOf=f(function(t,r){if(r=r||0,0===t.length)return-1;for(var e=r;e<this.length-t.length+1;e+=1){for(var n=!0,i=0;i<t.length;i++){var o=this[e+i],f=t[i];if("string"==typeof f&&(f=f.charCodeAt(0)),o!==f){n=!1;break}}if(n)return e}return-1}),i.equals=u(function(t){return 0===i.compare(this,t)}),i.compare=u(function(t){var r=this,e=r.length,n=t.length;if(e!==n)return e>n?1:-1;for(var i=0;e>i;i++){var o=r[i],f=t[i];if("string"==typeof f&&(f=f.charCodeAt(0)),o!==f)return o>f?1:-1}return 0}),i.concat=function(){for(var r=0,e=0;e<arguments.length;e++){if(void 0===arguments[e].length)throw Error("all arguments must be strings or Buffers");r+=arguments[e].length}for(var n=new t(r),i=0,e=0;e<arguments.length;e++)for(var o=0;o<arguments[e].length;o++)n[i++]="string"==typeof arguments[e][o]?arguments[e][o].charCodeAt(0):arguments[e][o];return n},i.reverse=f(function(){for(var r=new t(this.length),e=0;e<this.length;e++)r[e]=this[this.length-e-1];return r}),i.toHex=f(function(){for(var t="",r=0;r<this.length;r++){var e=this[r].toString(16);1==e.length&&(e="0"+e),e.length>2&&(e=e.substring(1,3)),t+=e}return t}),i.fromHex=f(function(){var r=this.length;if(r%2!==0)throw new Error("Invalid hex string length");for(var e=new t(r/2),n=0;n<e.length;n++){var i=String.fromCharCode(this[2*n]),o=String.fromCharCode(this[2*n+1]);e[n]=parseInt(i+o,16)}return e}),exports.extend=function(){var r;r=arguments.length>0?Array.prototype.slice.call(arguments):"function"==typeof Uint8Array?[t.prototype,Uint8Array.prototype]:[t.prototype];for(var e=0,n=r.length;n>e;e+=1){var o=r[e];for(var f in i)o[f]=i[f];o!==exports&&(o.concat=function(){var t=[this].concat(Array.prototype.slice.call(arguments));return i.concat.apply(i,t)})}},exports.extend(exports),n.inherits(r,e.EventEmitter),r.prototype._append=function(r,e){if(!this.writable)throw new Error("Stream is not writable.");if(t.isBuffer(r));else{if("string"!=typeof r)throw new Error("Argument should be either a buffer or a string.");r=new t(r,e||"utf8")}this.buffer?this.buffer=i.concat(this.buffer,r):(this.buffer=new t(r.length),r.copy(this.buffer))},r.prototype.write=function(t,r){return this._append(t,r),!0},r.prototype.end=function(t,r){t&&this._append(t,r),this.emit("close"),this.writable=!1},r.prototype.getBuffer=function(){return this.buffer?this.buffer:new t(0)},r.prototype.toString=function(){return this.getBuffer().toString()},exports.WritableBufferStream=r}).call(this,require("buffer").Buffer);
},{"buffer":85,"events":94,"util":117}],81:[function(require,module,exports){
},{}],82:[function(require,module,exports){
function replacer(t,e){return util.isUndefined(e)?""+e:!util.isNumber(e)||!isNaN(e)&&isFinite(e)?util.isFunction(e)||util.isRegExp(e)?e.toString():e:e.toString()}function truncate(t,e){return util.isString(t)?t.length<e?t:t.slice(0,e):t}function getMessage(t){return truncate(JSON.stringify(t.actual,replacer),128)+" "+t.operator+" "+truncate(JSON.stringify(t.expected,replacer),128)}function fail(t,e,r,i,s){throw new assert.AssertionError({message:r,actual:t,expected:e,operator:i,stackStartFunction:s})}function ok(t,e){t||fail(t,!0,e,"==",assert.ok)}function _deepEqual(t,e){if(t===e)return!0;if(util.isBuffer(t)&&util.isBuffer(e)){if(t.length!=e.length)return!1;for(var r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}return util.isDate(t)&&util.isDate(e)?t.getTime()===e.getTime():util.isRegExp(t)&&util.isRegExp(e)?t.source===e.source&&t.global===e.global&&t.multiline===e.multiline&&t.lastIndex===e.lastIndex&&t.ignoreCase===e.ignoreCase:util.isObject(t)||util.isObject(e)?objEquiv(t,e):t==e}function isArguments(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function objEquiv(t,e){if(util.isNullOrUndefined(t)||util.isNullOrUndefined(e))return!1;if(t.prototype!==e.prototype)return!1;if(isArguments(t))return isArguments(e)?(t=pSlice.call(t),e=pSlice.call(e),_deepEqual(t,e)):!1;try{var r,i,s=objectKeys(t),n=objectKeys(e)}catch(a){return!1}if(s.length!=n.length)return!1;for(s.sort(),n.sort(),i=s.length-1;i>=0;i--)if(s[i]!=n[i])return!1;for(i=s.length-1;i>=0;i--)if(r=s[i],!_deepEqual(t[r],e[r]))return!1;return!0}function expectedException(t,e){return t&&e?"[object RegExp]"==Object.prototype.toString.call(e)?e.test(t):t instanceof e?!0:e.call({},t)===!0?!0:!1:!1}function _throws(t,e,r,i){var s;util.isString(r)&&(i=r,r=null);try{e()}catch(n){s=n}if(i=(r&&r.name?" ("+r.name+").":".")+(i?" "+i:"."),t&&!s&&fail(s,r,"Missing expected exception"+i),!t&&expectedException(s,r)&&fail(s,r,"Got unwanted exception"+i),t&&s&&r&&!expectedException(s,r)||!t&&s)throw s}var util=require("util/"),pSlice=Array.prototype.slice,hasOwn=Object.prototype.hasOwnProperty,assert=module.exports=ok;assert.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=getMessage(this),this.generatedMessage=!0);var e=t.stackStartFunction||fail;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var i=r.stack,s=e.name,n=i.indexOf("\n"+s);if(n>=0){var a=i.indexOf("\n",n+1);i=i.substring(a+1)}this.stack=i}}},util.inherits(assert.AssertionError,Error),assert.fail=fail,assert.ok=ok,assert.equal=function(t,e,r){t!=e&&fail(t,e,r,"==",assert.equal)},assert.notEqual=function(t,e,r){t==e&&fail(t,e,r,"!=",assert.notEqual)},assert.deepEqual=function(t,e,r){_deepEqual(t,e)||fail(t,e,r,"deepEqual",assert.deepEqual)},assert.notDeepEqual=function(t,e,r){_deepEqual(t,e)&&fail(t,e,r,"notDeepEqual",assert.notDeepEqual)},assert.strictEqual=function(t,e,r){t!==e&&fail(t,e,r,"===",assert.strictEqual)},assert.notStrictEqual=function(t,e,r){t===e&&fail(t,e,r,"!==",assert.notStrictEqual)},assert.throws=function(){_throws.apply(this,[!0].concat(pSlice.call(arguments)))},assert.doesNotThrow=function(){_throws.apply(this,[!1].concat(pSlice.call(arguments)))},assert.ifError=function(t){if(t)throw t};var objectKeys=Object.keys||function(t){var e=[];for(var r in t)hasOwn.call(t,r)&&e.push(r);return e};
},{"util/":84}],83:[function(require,module,exports){
module.exports=function(o){return o&&"object"==typeof o&&"function"==typeof o.copy&&"function"==typeof o.fill&&"function"==typeof o.readUInt8};
},{}],84:[function(require,module,exports){
(function(e,t){function r(e,t){var r={seen:[],stylize:o};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),g(t)?r.showHidden=t:t&&exports._extend(r,t),b(r.showHidden)&&(r.showHidden=!1),b(r.depth)&&(r.depth=2),b(r.colors)&&(r.colors=!1),b(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=n),s(r,e,r.depth)}function n(e,t){var n=r.styles[t];return n?"["+r.colors[n][0]+"m"+e+"["+r.colors[n][1]+"m":e}function o(e){return e}function i(e){var t={};return e.forEach(function(e){t[e]=!0}),t}function s(e,t,r){if(e.customInspect&&t&&S(t.inspect)&&t.inspect!==exports.inspect&&(!t.constructor||t.constructor.prototype!==t)){var n=t.inspect(r,e);return x(n)||(n=s(e,n,r)),n}var o=u(e,t);if(o)return o;var g=Object.keys(t),y=i(g);if(e.showHidden&&(g=Object.getOwnPropertyNames(t)),O(t)&&(g.indexOf("message")>=0||g.indexOf("description")>=0))return c(t);if(0===g.length){if(S(t)){var d=t.name?": "+t.name:"";return e.stylize("[Function"+d+"]","special")}if(v(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(j(t))return e.stylize(Date.prototype.toString.call(t),"date");if(O(t))return c(t)}var m="",h=!1,b=["{","}"];if(f(t)&&(h=!0,b=["[","]"]),S(t)){var w=t.name?": "+t.name:"";m=" [Function"+w+"]"}if(v(t)&&(m=" "+RegExp.prototype.toString.call(t)),j(t)&&(m=" "+Date.prototype.toUTCString.call(t)),O(t)&&(m=" "+c(t)),0===g.length&&(!h||0==t.length))return b[0]+m+b[1];if(0>r)return v(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var z;return z=h?l(e,t,r,y,g):g.map(function(n){return a(e,t,r,y,n,h)}),e.seen.pop(),p(z,m,b)}function u(e,t){if(b(t))return e.stylize("undefined","undefined");if(x(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}return m(t)?e.stylize(""+t,"number"):g(t)?e.stylize(""+t,"boolean"):y(t)?e.stylize("null","null"):void 0}function c(e){return"["+Error.prototype.toString.call(e)+"]"}function l(e,t,r,n,o){for(var i=[],s=0,u=t.length;u>s;++s)i.push(_(t,String(s))?a(e,t,r,n,String(s),!0):"");return o.forEach(function(o){o.match(/^\d+$/)||i.push(a(e,t,r,n,o,!0))}),i}function a(e,t,r,n,o,i){var u,c,l;if(l=Object.getOwnPropertyDescriptor(t,o)||{value:t[o]},l.get?c=l.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):l.set&&(c=e.stylize("[Setter]","special")),_(n,o)||(u="["+o+"]"),c||(e.seen.indexOf(l.value)<0?(c=y(r)?s(e,l.value,null):s(e,l.value,r-1),c.indexOf("\n")>-1&&(c=i?c.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+c.split("\n").map(function(e){return" "+e}).join("\n"))):c=e.stylize("[Circular]","special")),b(u)){if(i&&o.match(/^\d+$/))return c;u=JSON.stringify(""+o),u.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(u=u.substr(1,u.length-2),u=e.stylize(u,"name")):(u=u.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),u=e.stylize(u,"string"))}return u+": "+c}function p(e,t,r){var n=0,o=e.reduce(function(e,t){return n++,t.indexOf("\n")>=0&&n++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return o>60?r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1]:r[0]+t+" "+e.join(", ")+" "+r[1]}function f(e){return Array.isArray(e)}function g(e){return"boolean"==typeof e}function y(e){return null===e}function d(e){return null==e}function m(e){return"number"==typeof e}function x(e){return"string"==typeof e}function h(e){return"symbol"==typeof e}function b(e){return void 0===e}function v(e){return w(e)&&"[object RegExp]"===E(e)}function w(e){return"object"==typeof e&&null!==e}function j(e){return w(e)&&"[object Date]"===E(e)}function O(e){return w(e)&&("[object Error]"===E(e)||e instanceof Error)}function S(e){return"function"==typeof e}function z(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function E(e){return Object.prototype.toString.call(e)}function D(e){return 10>e?"0"+e.toString(10):e.toString(10)}function N(){var e=new Date,t=[D(e.getHours()),D(e.getMinutes()),D(e.getSeconds())].join(":");return[e.getDate(),U[e.getMonth()],t].join(" ")}function _(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var A=/%[sdj%]/g;exports.format=function(e){if(!x(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(r(arguments[n]));return t.join(" ")}for(var n=1,o=arguments,i=o.length,s=String(e).replace(A,function(e){if("%%"===e)return"%";if(n>=i)return e;switch(e){case"%s":return String(o[n++]);case"%d":return Number(o[n++]);case"%j":try{return JSON.stringify(o[n++])}catch(t){return"[Circular]"}default:return e}}),u=o[n];i>n;u=o[++n])s+=y(u)||!w(u)?" "+u:" "+r(u);return s},exports.deprecate=function(r,n){function o(){if(!i){if(e.throwDeprecation)throw new Error(n);e.traceDeprecation?console.trace(n):console.error(n),i=!0}return r.apply(this,arguments)}if(b(t.process))return function(){return exports.deprecate(r,n).apply(this,arguments)};if(e.noDeprecation===!0)return r;var i=!1;return o};var J,R={};exports.debuglog=function(t){if(b(J)&&(J=e.env.NODE_DEBUG||""),t=t.toUpperCase(),!R[t])if(new RegExp("\\b"+t+"\\b","i").test(J)){var r=e.pid;R[t]=function(){var e=exports.format.apply(exports,arguments);console.error("%s %d: %s",t,r,e)}}else R[t]=function(){};return R[t]},exports.inspect=r,r.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},r.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},exports.isArray=f,exports.isBoolean=g,exports.isNull=y,exports.isNullOrUndefined=d,exports.isNumber=m,exports.isString=x,exports.isSymbol=h,exports.isUndefined=b,exports.isRegExp=v,exports.isObject=w,exports.isDate=j,exports.isError=O,exports.isFunction=S,exports.isPrimitive=z,exports.isBuffer=require("./support/isBuffer");var U=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];exports.log=function(){console.log("%s - %s",N(),exports.format.apply(exports,arguments))},exports.inherits=require("inherits"),exports._extend=function(e,t){if(!t||!w(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}}).call(this,require("/Users/ryanxcharles/dev/bitcore/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});
},{"./support/isBuffer":83,"/Users/ryanxcharles/dev/bitcore/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":101,"inherits":100}],85:[function(require,module,exports){
function Buffer(e,t,r){if(!(this instanceof Buffer))return new Buffer(e,t,r);var n=typeof e;if("base64"===t&&"string"===n)for(e=stringtrim(e);e.length%4!==0;)e+="=";var i;if("number"===n)i=coerce(e);else if("string"===n)i=Buffer.byteLength(e,t);else{if("object"!==n)throw new Error("First argument needs to be a number, array or string.");i=coerce(e.length)}var s;Buffer._useTypedArrays?s=Buffer._augment(new Uint8Array(i)):(s=this,s.length=i,s._isBuffer=!0);var a;if(Buffer._useTypedArrays&&"number"==typeof e.byteLength)s._set(e);else if(isArrayish(e))for(a=0;i>a;a++)s[a]=Buffer.isBuffer(e)?e.readUInt8(a):e[a];else if("string"===n)s.write(e,0,t);else if("number"===n&&!Buffer._useTypedArrays&&!r)for(a=0;i>a;a++)s[a]=0;return s}function _hexWrite(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;var s=t.length;assert(s%2===0,"Invalid hex string"),n>s/2&&(n=s/2);for(var a=0;n>a;a++){var o=parseInt(t.substr(2*a,2),16);assert(!isNaN(o),"Invalid hex string"),e[r+a]=o}return Buffer._charsWritten=2*a,a}function _utf8Write(e,t,r,n){var i=Buffer._charsWritten=blitBuffer(utf8ToBytes(t),e,r,n);return i}function _asciiWrite(e,t,r,n){var i=Buffer._charsWritten=blitBuffer(asciiToBytes(t),e,r,n);return i}function _binaryWrite(e,t,r,n){return _asciiWrite(e,t,r,n)}function _base64Write(e,t,r,n){var i=Buffer._charsWritten=blitBuffer(base64ToBytes(t),e,r,n);return i}function _utf16leWrite(e,t,r,n){var i=Buffer._charsWritten=blitBuffer(utf16leToBytes(t),e,r,n);return i}function _base64Slice(e,t,r){return base64.fromByteArray(0===t&&r===e.length?e:e.slice(t,r))}function _utf8Slice(e,t,r){var n="",i="";r=Math.min(e.length,r);for(var s=t;r>s;s++)e[s]<=127?(n+=decodeUtf8Char(i)+String.fromCharCode(e[s]),i=""):i+="%"+e[s].toString(16);return n+decodeUtf8Char(i)}function _asciiSlice(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;r>i;i++)n+=String.fromCharCode(e[i]);return n}function _binarySlice(e,t,r){return _asciiSlice(e,t,r)}function _hexSlice(e,t,r){var n=e.length;(!t||0>t)&&(t=0),(!r||0>r||r>n)&&(r=n);for(var i="",s=t;r>s;s++)i+=toHex(e[s]);return i}function _utf16leSlice(e,t,r){for(var n=e.slice(t,r),i="",s=0;s<n.length;s+=2)i+=String.fromCharCode(n[s]+256*n[s+1]);return i}function _readUInt16(e,t,r,n){n||(assert("boolean"==typeof r,"missing or invalid endian"),assert(void 0!==t&&null!==t,"missing offset"),assert(t+1<e.length,"Trying to read beyond buffer length"));var i=e.length;if(!(t>=i)){var s;return r?(s=e[t],i>t+1&&(s|=e[t+1]<<8)):(s=e[t]<<8,i>t+1&&(s|=e[t+1])),s}}function _readUInt32(e,t,r,n){n||(assert("boolean"==typeof r,"missing or invalid endian"),assert(void 0!==t&&null!==t,"missing offset"),assert(t+3<e.length,"Trying to read beyond buffer length"));var i=e.length;if(!(t>=i)){var s;return r?(i>t+2&&(s=e[t+2]<<16),i>t+1&&(s|=e[t+1]<<8),s|=e[t],i>t+3&&(s+=e[t+3]<<24>>>0)):(i>t+1&&(s=e[t+1]<<16),i>t+2&&(s|=e[t+2]<<8),i>t+3&&(s|=e[t+3]),s+=e[t]<<24>>>0),s}}function _readInt16(e,t,r,n){n||(assert("boolean"==typeof r,"missing or invalid endian"),assert(void 0!==t&&null!==t,"missing offset"),assert(t+1<e.length,"Trying to read beyond buffer length"));var i=e.length;if(!(t>=i)){var s=_readUInt16(e,t,r,!0),a=32768&s;return a?-1*(65535-s+1):s}}function _readInt32(e,t,r,n){n||(assert("boolean"==typeof r,"missing or invalid endian"),assert(void 0!==t&&null!==t,"missing offset"),assert(t+3<e.length,"Trying to read beyond buffer length"));var i=e.length;if(!(t>=i)){var s=_readUInt32(e,t,r,!0),a=2147483648&s;return a?-1*(4294967295-s+1):s}}function _readFloat(e,t,r,n){return n||(assert("boolean"==typeof r,"missing or invalid endian"),assert(t+3<e.length,"Trying to read beyond buffer length")),ieee754.read(e,t,r,23,4)}function _readDouble(e,t,r,n){return n||(assert("boolean"==typeof r,"missing or invalid endian"),assert(t+7<e.length,"Trying to read beyond buffer length")),ieee754.read(e,t,r,52,8)}function _writeUInt16(e,t,r,n,i){i||(assert(void 0!==t&&null!==t,"missing value"),assert("boolean"==typeof n,"missing or invalid endian"),assert(void 0!==r&&null!==r,"missing offset"),assert(r+1<e.length,"trying to write beyond buffer length"),verifuint(t,65535));var s=e.length;if(!(r>=s))for(var a=0,o=Math.min(s-r,2);o>a;a++)e[r+a]=(t&255<<8*(n?a:1-a))>>>8*(n?a:1-a)}function _writeUInt32(e,t,r,n,i){i||(assert(void 0!==t&&null!==t,"missing value"),assert("boolean"==typeof n,"missing or invalid endian"),assert(void 0!==r&&null!==r,"missing offset"),assert(r+3<e.length,"trying to write beyond buffer length"),verifuint(t,4294967295));var s=e.length;if(!(r>=s))for(var a=0,o=Math.min(s-r,4);o>a;a++)e[r+a]=t>>>8*(n?a:3-a)&255}function _writeInt16(e,t,r,n,i){i||(assert(void 0!==t&&null!==t,"missing value"),assert("boolean"==typeof n,"missing or invalid endian"),assert(void 0!==r&&null!==r,"missing offset"),assert(r+1<e.length,"Trying to write beyond buffer length"),verifsint(t,32767,-32768));var s=e.length;r>=s||(t>=0?_writeUInt16(e,t,r,n,i):_writeUInt16(e,65535+t+1,r,n,i))}function _writeInt32(e,t,r,n,i){i||(assert(void 0!==t&&null!==t,"missing value"),assert("boolean"==typeof n,"missing or invalid endian"),assert(void 0!==r&&null!==r,"missing offset"),assert(r+3<e.length,"Trying to write beyond buffer length"),verifsint(t,2147483647,-2147483648));var s=e.length;r>=s||(t>=0?_writeUInt32(e,t,r,n,i):_writeUInt32(e,4294967295+t+1,r,n,i))}function _writeFloat(e,t,r,n,i){i||(assert(void 0!==t&&null!==t,"missing value"),assert("boolean"==typeof n,"missing or invalid endian"),assert(void 0!==r&&null!==r,"missing offset"),assert(r+3<e.length,"Trying to write beyond buffer length"),verifIEEE754(t,3.4028234663852886e38,-3.4028234663852886e38));var s=e.length;r>=s||ieee754.write(e,t,r,n,23,4)}function _writeDouble(e,t,r,n,i){i||(assert(void 0!==t&&null!==t,"missing value"),assert("boolean"==typeof n,"missing or invalid endian"),assert(void 0!==r&&null!==r,"missing offset"),assert(r+7<e.length,"Trying to write beyond buffer length"),verifIEEE754(t,1.7976931348623157e308,-1.7976931348623157e308));var s=e.length;r>=s||ieee754.write(e,t,r,n,52,8)}function stringtrim(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function clamp(e,t,r){return"number"!=typeof e?r:(e=~~e,e>=t?t:e>=0?e:(e+=t,e>=0?e:0))}function coerce(e){return e=~~Math.ceil(+e),0>e?0:e}function isArray(e){return(Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)})(e)}function isArrayish(e){return isArray(e)||Buffer.isBuffer(e)||e&&"object"==typeof e&&"number"==typeof e.length}function toHex(e){return 16>e?"0"+e.toString(16):e.toString(16)}function utf8ToBytes(e){for(var t=[],r=0;r<e.length;r++){var n=e.charCodeAt(r);if(127>=n)t.push(e.charCodeAt(r));else{var i=r;n>=55296&&57343>=n&&r++;for(var s=encodeURIComponent(e.slice(i,r+1)).substr(1).split("%"),a=0;a<s.length;a++)t.push(parseInt(s[a],16))}}return t}function asciiToBytes(e){for(var t=[],r=0;r<e.length;r++)t.push(255&e.charCodeAt(r));return t}function utf16leToBytes(e){for(var t,r,n,i=[],s=0;s<e.length;s++)t=e.charCodeAt(s),r=t>>8,n=t%256,i.push(n),i.push(r);return i}function base64ToBytes(e){return base64.toByteArray(e)}function blitBuffer(e,t,r,n){for(var i=0;n>i&&!(i+r>=t.length||i>=e.length);i++)t[i+r]=e[i];return i}function decodeUtf8Char(e){try{return decodeURIComponent(e)}catch(t){return String.fromCharCode(65533)}}function verifuint(e,t){assert("number"==typeof e,"cannot write a non-number as a number"),assert(e>=0,"specified a negative value for writing an unsigned value"),assert(t>=e,"value is larger than maximum value for type"),assert(Math.floor(e)===e,"value has a fractional component")}function verifsint(e,t,r){assert("number"==typeof e,"cannot write a non-number as a number"),assert(t>=e,"value larger than maximum allowed value"),assert(e>=r,"value smaller than minimum allowed value"),assert(Math.floor(e)===e,"value has a fractional component")}function verifIEEE754(e,t,r){assert("number"==typeof e,"cannot write a non-number as a number"),assert(t>=e,"value larger than maximum allowed value"),assert(e>=r,"value smaller than minimum allowed value")}function assert(e,t){if(!e)throw new Error(t||"Failed assertion")}var base64=require("base64-js"),ieee754=require("ieee754");exports.Buffer=Buffer,exports.SlowBuffer=Buffer,exports.INSPECT_MAX_BYTES=50,Buffer.poolSize=8192,Buffer._useTypedArrays=function(){try{var e=new ArrayBuffer(0),t=new Uint8Array(e);return t.foo=function(){return 42},42===t.foo()&&"function"==typeof t.subarray}catch(r){return!1}}(),Buffer.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Buffer.isBuffer=function(e){return!(null===e||void 0===e||!e._isBuffer)},Buffer.byteLength=function(e,t){var r;switch(e+="",t||"utf8"){case"hex":r=e.length/2;break;case"utf8":case"utf-8":r=utf8ToBytes(e).length;break;case"ascii":case"binary":case"raw":r=e.length;break;case"base64":r=base64ToBytes(e).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":r=2*e.length;break;default:throw new Error("Unknown encoding")}return r},Buffer.concat=function(e,t){if(assert(isArray(e),"Usage: Buffer.concat(list, [totalLength])\nlist should be an Array."),0===e.length)return new Buffer(0);if(1===e.length)return e[0];var r;if("number"!=typeof t)for(t=0,r=0;r<e.length;r++)t+=e[r].length;var n=new Buffer(t),i=0;for(r=0;r<e.length;r++){var s=e[r];s.copy(n,i),i+=s.length}return n},Buffer.prototype.write=function(e,t,r,n){if(isFinite(t))isFinite(r)||(n=r,r=void 0);else{var i=n;n=t,t=r,r=i}t=Number(t)||0;var s=this.length-t;r?(r=Number(r),r>s&&(r=s)):r=s,n=String(n||"utf8").toLowerCase();var a;switch(n){case"hex":a=_hexWrite(this,e,t,r);break;case"utf8":case"utf-8":a=_utf8Write(this,e,t,r);break;case"ascii":a=_asciiWrite(this,e,t,r);break;case"binary":a=_binaryWrite(this,e,t,r);break;case"base64":a=_base64Write(this,e,t,r);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":a=_utf16leWrite(this,e,t,r);break;default:throw new Error("Unknown encoding")}return a},Buffer.prototype.toString=function(e,t,r){var n=this;if(e=String(e||"utf8").toLowerCase(),t=Number(t)||0,r=void 0!==r?Number(r):r=n.length,r===t)return"";var i;switch(e){case"hex":i=_hexSlice(n,t,r);break;case"utf8":case"utf-8":i=_utf8Slice(n,t,r);break;case"ascii":i=_asciiSlice(n,t,r);break;case"binary":i=_binarySlice(n,t,r);break;case"base64":i=_base64Slice(n,t,r);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":i=_utf16leSlice(n,t,r);break;default:throw new Error("Unknown encoding")}return i},Buffer.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},Buffer.prototype.copy=function(e,t,r,n){var i=this;if(r||(r=0),n||0===n||(n=this.length),t||(t=0),n!==r&&0!==e.length&&0!==i.length){assert(n>=r,"sourceEnd < sourceStart"),assert(t>=0&&t<e.length,"targetStart out of bounds"),assert(r>=0&&r<i.length,"sourceStart out of bounds"),assert(n>=0&&n<=i.length,"sourceEnd out of bounds"),n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var s=n-r;if(100>s||!Buffer._useTypedArrays)for(var a=0;s>a;a++)e[a+t]=this[a+r];else e._set(this.subarray(r,r+s),t)}},Buffer.prototype.slice=function(e,t){var r=this.length;if(e=clamp(e,r,0),t=clamp(t,r,r),Buffer._useTypedArrays)return Buffer._augment(this.subarray(e,t));for(var n=t-e,i=new Buffer(n,void 0,!0),s=0;n>s;s++)i[s]=this[s+e];return i},Buffer.prototype.get=function(e){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(e)},Buffer.prototype.set=function(e,t){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(e,t)},Buffer.prototype.readUInt8=function(e,t){return t||(assert(void 0!==e&&null!==e,"missing offset"),assert(e<this.length,"Trying to read beyond buffer length")),e>=this.length?void 0:this[e]},Buffer.prototype.readUInt16LE=function(e,t){return _readUInt16(this,e,!0,t)},Buffer.prototype.readUInt16BE=function(e,t){return _readUInt16(this,e,!1,t)},Buffer.prototype.readUInt32LE=function(e,t){return _readUInt32(this,e,!0,t)},Buffer.prototype.readUInt32BE=function(e,t){return _readUInt32(this,e,!1,t)},Buffer.prototype.readInt8=function(e,t){if(t||(assert(void 0!==e&&null!==e,"missing offset"),assert(e<this.length,"Trying to read beyond buffer length")),!(e>=this.length)){var r=128&this[e];return r?-1*(255-this[e]+1):this[e]}},Buffer.prototype.readInt16LE=function(e,t){return _readInt16(this,e,!0,t)},Buffer.prototype.readInt16BE=function(e,t){return _readInt16(this,e,!1,t)},Buffer.prototype.readInt32LE=function(e,t){return _readInt32(this,e,!0,t)},Buffer.prototype.readInt32BE=function(e,t){return _readInt32(this,e,!1,t)},Buffer.prototype.readFloatLE=function(e,t){return _readFloat(this,e,!0,t)},Buffer.prototype.readFloatBE=function(e,t){return _readFloat(this,e,!1,t)},Buffer.prototype.readDoubleLE=function(e,t){return _readDouble(this,e,!0,t)},Buffer.prototype.readDoubleBE=function(e,t){return _readDouble(this,e,!1,t)},Buffer.prototype.writeUInt8=function(e,t,r){r||(assert(void 0!==e&&null!==e,"missing value"),assert(void 0!==t&&null!==t,"missing offset"),assert(t<this.length,"trying to write beyond buffer length"),verifuint(e,255)),t>=this.length||(this[t]=e)},Buffer.prototype.writeUInt16LE=function(e,t,r){_writeUInt16(this,e,t,!0,r)},Buffer.prototype.writeUInt16BE=function(e,t,r){_writeUInt16(this,e,t,!1,r)},Buffer.prototype.writeUInt32LE=function(e,t,r){_writeUInt32(this,e,t,!0,r)},Buffer.prototype.writeUInt32BE=function(e,t,r){_writeUInt32(this,e,t,!1,r)},Buffer.prototype.writeInt8=function(e,t,r){r||(assert(void 0!==e&&null!==e,"missing value"),assert(void 0!==t&&null!==t,"missing offset"),assert(t<this.length,"Trying to write beyond buffer length"),verifsint(e,127,-128)),t>=this.length||(e>=0?this.writeUInt8(e,t,r):this.writeUInt8(255+e+1,t,r))},Buffer.prototype.writeInt16LE=function(e,t,r){_writeInt16(this,e,t,!0,r)},Buffer.prototype.writeInt16BE=function(e,t,r){_writeInt16(this,e,t,!1,r)},Buffer.prototype.writeInt32LE=function(e,t,r){_writeInt32(this,e,t,!0,r)},Buffer.prototype.writeInt32BE=function(e,t,r){_writeInt32(this,e,t,!1,r)},Buffer.prototype.writeFloatLE=function(e,t,r){_writeFloat(this,e,t,!0,r)},Buffer.prototype.writeFloatBE=function(e,t,r){_writeFloat(this,e,t,!1,r)},Buffer.prototype.writeDoubleLE=function(e,t,r){_writeDouble(this,e,t,!0,r)},Buffer.prototype.writeDoubleBE=function(e,t,r){_writeDouble(this,e,t,!1,r)},Buffer.prototype.fill=function(e,t,r){if(e||(e=0),t||(t=0),r||(r=this.length),"string"==typeof e&&(e=e.charCodeAt(0)),assert("number"==typeof e&&!isNaN(e),"value is not a number"),assert(r>=t,"end < start"),r!==t&&0!==this.length){assert(t>=0&&t<this.length,"start out of bounds"),assert(r>=0&&r<=this.length,"end out of bounds");for(var n=t;r>n;n++)this[n]=e}},Buffer.prototype.inspect=function(){for(var e=[],t=this.length,r=0;t>r;r++)if(e[r]=toHex(this[r]),r===exports.INSPECT_MAX_BYTES){e[r+1]="...";break}return"<Buffer "+e.join(" ")+">"},Buffer.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(Buffer._useTypedArrays)return new Buffer(this).buffer;for(var e=new Uint8Array(this.length),t=0,r=e.length;r>t;t+=1)e[t]=this[t];return e.buffer}throw new Error("Buffer.toArrayBuffer not supported in this browser")};var BP=Buffer.prototype;Buffer._augment=function(e){return e._isBuffer=!0,e._get=e.get,e._set=e.set,e.get=BP.get,e.set=BP.set,e.write=BP.write,e.toString=BP.toString,e.toLocaleString=BP.toString,e.toJSON=BP.toJSON,e.copy=BP.copy,e.slice=BP.slice,e.readUInt8=BP.readUInt8,e.readUInt16LE=BP.readUInt16LE,e.readUInt16BE=BP.readUInt16BE,e.readUInt32LE=BP.readUInt32LE,e.readUInt32BE=BP.readUInt32BE,e.readInt8=BP.readInt8,e.readInt16LE=BP.readInt16LE,e.readInt16BE=BP.readInt16BE,e.readInt32LE=BP.readInt32LE,e.readInt32BE=BP.readInt32BE,e.readFloatLE=BP.readFloatLE,e.readFloatBE=BP.readFloatBE,e.readDoubleLE=BP.readDoubleLE,e.readDoubleBE=BP.readDoubleBE,e.writeUInt8=BP.writeUInt8,e.writeUInt16LE=BP.writeUInt16LE,e.writeUInt16BE=BP.writeUInt16BE,e.writeUInt32LE=BP.writeUInt32LE,e.writeUInt32BE=BP.writeUInt32BE,e.writeInt8=BP.writeInt8,e.writeInt16LE=BP.writeInt16LE,e.writeInt16BE=BP.writeInt16BE,e.writeInt32LE=BP.writeInt32LE,e.writeInt32BE=BP.writeInt32BE,e.writeFloatLE=BP.writeFloatLE,e.writeFloatBE=BP.writeFloatBE,e.writeDoubleLE=BP.writeDoubleLE,e.writeDoubleBE=BP.writeDoubleBE,e.fill=BP.fill,e.inspect=BP.inspect,e.toArrayBuffer=BP.toArrayBuffer,e};
},{"base64-js":86,"ieee754":87}],86:[function(require,module,exports){
var lookup="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(t){"use strict";function r(t){var r=t.charCodeAt(0);return r===h?62:r===c?63:o>r?-1:o+10>r?r-o+26+26:i+26>r?r-i:A+26>r?r-A+26:void 0}function e(t){function e(t){i[f++]=t}var n,h,c,o,A,i;if(t.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var u=t.length;A="="===t.charAt(u-2)?2:"="===t.charAt(u-1)?1:0,i=new a(3*t.length/4-A),c=A>0?t.length-4:t.length;var f=0;for(n=0,h=0;c>n;n+=4,h+=3)o=r(t.charAt(n))<<18|r(t.charAt(n+1))<<12|r(t.charAt(n+2))<<6|r(t.charAt(n+3)),e((16711680&o)>>16),e((65280&o)>>8),e(255&o);return 2===A?(o=r(t.charAt(n))<<2|r(t.charAt(n+1))>>4,e(255&o)):1===A&&(o=r(t.charAt(n))<<10|r(t.charAt(n+1))<<4|r(t.charAt(n+2))>>2,e(o>>8&255),e(255&o)),i}function n(t){function r(t){return lookup.charAt(t)}function e(t){return r(t>>18&63)+r(t>>12&63)+r(t>>6&63)+r(63&t)}var n,a,h,c=t.length%3,o="";for(n=0,h=t.length-c;h>n;n+=3)a=(t[n]<<16)+(t[n+1]<<8)+t[n+2],o+=e(a);switch(c){case 1:a=t[t.length-1],o+=r(a>>2),o+=r(a<<4&63),o+="==";break;case 2:a=(t[t.length-2]<<8)+t[t.length-1],o+=r(a>>10),o+=r(a>>4&63),o+=r(a<<2&63),o+="="}return o}var a="undefined"!=typeof Uint8Array?Uint8Array:Array,h="+".charCodeAt(0),c="/".charCodeAt(0),o="0".charCodeAt(0),A="a".charCodeAt(0),i="A".charCodeAt(0);t.toByteArray=e,t.fromByteArray=n}("undefined"==typeof exports?this.base64js={}:exports);
},{}],87:[function(require,module,exports){
exports.read=function(o,t,a,r,h){var M,p,w=8*h-r-1,f=(1<<w)-1,e=f>>1,i=-7,n=a?h-1:0,s=a?-1:1,N=o[t+n];for(n+=s,M=N&(1<<-i)-1,N>>=-i,i+=w;i>0;M=256*M+o[t+n],n+=s,i-=8);for(p=M&(1<<-i)-1,M>>=-i,i+=r;i>0;p=256*p+o[t+n],n+=s,i-=8);if(0===M)M=1-e;else{if(M===f)return p?0/0:1/0*(N?-1:1);p+=Math.pow(2,r),M-=e}return(N?-1:1)*p*Math.pow(2,M-r)},exports.write=function(o,t,a,r,h,M){var p,w,f,e=8*M-h-1,i=(1<<e)-1,n=i>>1,s=23===h?Math.pow(2,-24)-Math.pow(2,-77):0,N=r?0:M-1,u=r?1:-1,l=0>t||0===t&&0>1/t?1:0;for(t=Math.abs(t),isNaN(t)||1/0===t?(w=isNaN(t)?1:0,p=i):(p=Math.floor(Math.log(t)/Math.LN2),t*(f=Math.pow(2,-p))<1&&(p--,f*=2),t+=p+n>=1?s/f:s*Math.pow(2,1-n),t*f>=2&&(p++,f/=2),p+n>=i?(w=0,p=i):p+n>=1?(w=(t*f-1)*Math.pow(2,h),p+=n):(w=t*Math.pow(2,n-1)*Math.pow(2,h),p=0));h>=8;o[a+N]=255&w,N+=u,w/=256,h-=8);for(p=p<<h|w,e+=h;e>0;o[a+N]=255&p,N+=u,p/=256,e-=8);o[a+N-u]|=128*l};
},{}],88:[function(require,module,exports){
function toArray(r,e){if(r.length%intSize!==0){var f=r.length+(intSize-r.length%intSize);r=Buffer.concat([r,zeroBuffer],f)}for(var t=[],n=e?r.readInt32BE:r.readInt32LE,u=0;u<r.length;u+=intSize)t.push(n.call(r,u));return t}function toBuffer(r,e,f){for(var t=new Buffer(e),n=f?t.writeInt32BE:t.writeInt32LE,u=0;u<r.length;u++)n.call(t,r[u],4*u,!0);return t}function hash(r,e,f,t){Buffer.isBuffer(r)||(r=new Buffer(r));var n=e(toArray(r,t),r.length*chrsz);return toBuffer(n,f,t)}var Buffer=require("buffer").Buffer,intSize=4,zeroBuffer=new Buffer(intSize);zeroBuffer.fill(0);var chrsz=8;module.exports={hash:hash};
},{"buffer":85}],89:[function(require,module,exports){
function hmac(e,r,f){Buffer.isBuffer(r)||(r=new Buffer(r)),Buffer.isBuffer(f)||(f=new Buffer(f)),r.length>blocksize?r=e(r):r.length<blocksize&&(r=Buffer.concat([r,zeroBuffer],blocksize));for(var t=new Buffer(blocksize),n=new Buffer(blocksize),i=0;blocksize>i;i++)t[i]=54^r[i],n[i]=92^r[i];var c=e(Buffer.concat([t,f]));return e(Buffer.concat([n,c]))}function hash(e,r){e=e||"sha1";var f=algorithms[e],t=[],n=0;return f||error("algorithm:",e,"is not yet supported"),{update:function(e){return Buffer.isBuffer(e)||(e=new Buffer(e)),t.push(e),n+=e.length,this},digest:function(e){var n=Buffer.concat(t),i=r?hmac(f,r,n):f(n);return t=null,e?i.toString(e):i}}}function error(){var e=[].slice.call(arguments).join(" ");throw new Error([e,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join("\n"))}function each(e,r){for(var f in e)r(e[f],f)}var Buffer=require("buffer").Buffer,sha=require("./sha"),sha256=require("./sha256"),rng=require("./rng"),md5=require("./md5"),algorithms={sha1:sha,sha256:sha256,md5:md5},blocksize=64,zeroBuffer=new Buffer(blocksize);zeroBuffer.fill(0),exports.createHash=function(e){return hash(e)},exports.createHmac=function(e,r){return hash(e,r)},exports.randomBytes=function(e,r){if(!r||!r.call)return new Buffer(rng(e));try{r.call(this,void 0,new Buffer(rng(e)))}catch(f){r(f)}},each(["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],function(e){exports[e]=function(){error("sorry,",e,"is not implemented yet")}});
},{"./md5":90,"./rng":91,"./sha":92,"./sha256":93,"buffer":85}],90:[function(require,module,exports){
function md5_vm_test(){return"900150983cd24fb0d6963f7d28e17f72"==hex_md5("abc")}function core_md5(d,_){d[_>>5]|=128<<_%32,d[(_+64>>>9<<4)+14]=_;for(var m=1732584193,f=-271733879,i=-1732584194,h=271733878,r=0;r<d.length;r+=16){var n=m,e=f,g=i,t=h;m=md5_ff(m,f,i,h,d[r+0],7,-680876936),h=md5_ff(h,m,f,i,d[r+1],12,-389564586),i=md5_ff(i,h,m,f,d[r+2],17,606105819),f=md5_ff(f,i,h,m,d[r+3],22,-1044525330),m=md5_ff(m,f,i,h,d[r+4],7,-176418897),h=md5_ff(h,m,f,i,d[r+5],12,1200080426),i=md5_ff(i,h,m,f,d[r+6],17,-1473231341),f=md5_ff(f,i,h,m,d[r+7],22,-45705983),m=md5_ff(m,f,i,h,d[r+8],7,1770035416),h=md5_ff(h,m,f,i,d[r+9],12,-1958414417),i=md5_ff(i,h,m,f,d[r+10],17,-42063),f=md5_ff(f,i,h,m,d[r+11],22,-1990404162),m=md5_ff(m,f,i,h,d[r+12],7,1804603682),h=md5_ff(h,m,f,i,d[r+13],12,-40341101),i=md5_ff(i,h,m,f,d[r+14],17,-1502002290),f=md5_ff(f,i,h,m,d[r+15],22,1236535329),m=md5_gg(m,f,i,h,d[r+1],5,-165796510),h=md5_gg(h,m,f,i,d[r+6],9,-1069501632),i=md5_gg(i,h,m,f,d[r+11],14,643717713),f=md5_gg(f,i,h,m,d[r+0],20,-373897302),m=md5_gg(m,f,i,h,d[r+5],5,-701558691),h=md5_gg(h,m,f,i,d[r+10],9,38016083),i=md5_gg(i,h,m,f,d[r+15],14,-660478335),f=md5_gg(f,i,h,m,d[r+4],20,-405537848),m=md5_gg(m,f,i,h,d[r+9],5,568446438),h=md5_gg(h,m,f,i,d[r+14],9,-1019803690),i=md5_gg(i,h,m,f,d[r+3],14,-187363961),f=md5_gg(f,i,h,m,d[r+8],20,1163531501),m=md5_gg(m,f,i,h,d[r+13],5,-1444681467),h=md5_gg(h,m,f,i,d[r+2],9,-51403784),i=md5_gg(i,h,m,f,d[r+7],14,1735328473),f=md5_gg(f,i,h,m,d[r+12],20,-1926607734),m=md5_hh(m,f,i,h,d[r+5],4,-378558),h=md5_hh(h,m,f,i,d[r+8],11,-2022574463),i=md5_hh(i,h,m,f,d[r+11],16,1839030562),f=md5_hh(f,i,h,m,d[r+14],23,-35309556),m=md5_hh(m,f,i,h,d[r+1],4,-1530992060),h=md5_hh(h,m,f,i,d[r+4],11,1272893353),i=md5_hh(i,h,m,f,d[r+7],16,-155497632),f=md5_hh(f,i,h,m,d[r+10],23,-1094730640),m=md5_hh(m,f,i,h,d[r+13],4,681279174),h=md5_hh(h,m,f,i,d[r+0],11,-358537222),i=md5_hh(i,h,m,f,d[r+3],16,-722521979),f=md5_hh(f,i,h,m,d[r+6],23,76029189),m=md5_hh(m,f,i,h,d[r+9],4,-640364487),h=md5_hh(h,m,f,i,d[r+12],11,-421815835),i=md5_hh(i,h,m,f,d[r+15],16,530742520),f=md5_hh(f,i,h,m,d[r+2],23,-995338651),m=md5_ii(m,f,i,h,d[r+0],6,-198630844),h=md5_ii(h,m,f,i,d[r+7],10,1126891415),i=md5_ii(i,h,m,f,d[r+14],15,-1416354905),f=md5_ii(f,i,h,m,d[r+5],21,-57434055),m=md5_ii(m,f,i,h,d[r+12],6,1700485571),h=md5_ii(h,m,f,i,d[r+3],10,-1894986606),i=md5_ii(i,h,m,f,d[r+10],15,-1051523),f=md5_ii(f,i,h,m,d[r+1],21,-2054922799),m=md5_ii(m,f,i,h,d[r+8],6,1873313359),h=md5_ii(h,m,f,i,d[r+15],10,-30611744),i=md5_ii(i,h,m,f,d[r+6],15,-1560198380),f=md5_ii(f,i,h,m,d[r+13],21,1309151649),m=md5_ii(m,f,i,h,d[r+4],6,-145523070),h=md5_ii(h,m,f,i,d[r+11],10,-1120210379),i=md5_ii(i,h,m,f,d[r+2],15,718787259),f=md5_ii(f,i,h,m,d[r+9],21,-343485551),m=safe_add(m,n),f=safe_add(f,e),i=safe_add(i,g),h=safe_add(h,t)}return Array(m,f,i,h)}function md5_cmn(d,_,m,f,i,h){return safe_add(bit_rol(safe_add(safe_add(_,d),safe_add(f,h)),i),m)}function md5_ff(d,_,m,f,i,h,r){return md5_cmn(_&m|~_&f,d,_,i,h,r)}function md5_gg(d,_,m,f,i,h,r){return md5_cmn(_&f|m&~f,d,_,i,h,r)}function md5_hh(d,_,m,f,i,h,r){return md5_cmn(_^m^f,d,_,i,h,r)}function md5_ii(d,_,m,f,i,h,r){return md5_cmn(m^(_|~f),d,_,i,h,r)}function safe_add(d,_){var m=(65535&d)+(65535&_),f=(d>>16)+(_>>16)+(m>>16);return f<<16|65535&m}function bit_rol(d,_){return d<<_|d>>>32-_}var helpers=require("./helpers");module.exports=function(d){return helpers.hash(d,core_md5,16)};
},{"./helpers":88}],91:[function(require,module,exports){
!function(){var r,n,t=this;r=function(r){for(var n,n,t=new Array(r),o=0;r>o;o++)0==(3&o)&&(n=4294967296*Math.random()),t[o]=n>>>((3&o)<<3)&255;return t},t.crypto&&crypto.getRandomValues&&(n=function(r){var n=new Uint8Array(r);return crypto.getRandomValues(n),n}),module.exports=n||r}();
},{}],92:[function(require,module,exports){
function core_sha1(r,a){r[a>>5]|=128<<24-a%32,r[(a+64>>9<<4)+15]=a;for(var e=Array(80),d=1732584193,s=-271733879,f=-1732584194,n=271733878,t=-1009589776,o=0;o<r.length;o+=16){for(var _=d,u=s,h=f,l=n,c=t,i=0;80>i;i++){e[i]=16>i?r[o+i]:rol(e[i-3]^e[i-8]^e[i-14]^e[i-16],1);var v=safe_add(safe_add(rol(d,5),sha1_ft(i,s,f,n)),safe_add(safe_add(t,e[i]),sha1_kt(i)));t=n,n=f,f=rol(s,30),s=d,d=v}d=safe_add(d,_),s=safe_add(s,u),f=safe_add(f,h),n=safe_add(n,l),t=safe_add(t,c)}return Array(d,s,f,n,t)}function sha1_ft(r,a,e,d){return 20>r?a&e|~a&d:40>r?a^e^d:60>r?a&e|a&d|e&d:a^e^d}function sha1_kt(r){return 20>r?1518500249:40>r?1859775393:60>r?-1894007588:-899497514}function safe_add(r,a){var e=(65535&r)+(65535&a),d=(r>>16)+(a>>16)+(e>>16);return d<<16|65535&e}function rol(r,a){return r<<a|r>>>32-a}var helpers=require("./helpers");module.exports=function(r){return helpers.hash(r,core_sha1,20,!0)};
},{"./helpers":88}],93:[function(require,module,exports){
var helpers=require("./helpers"),safe_add=function(a,e){var r=(65535&a)+(65535&e),d=(a>>16)+(e>>16)+(r>>16);return d<<16|65535&r},S=function(a,e){return a>>>e|a<<32-e},R=function(a,e){return a>>>e},Ch=function(a,e,r){return a&e^~a&r},Maj=function(a,e,r){return a&e^a&r^e&r},Sigma0256=function(a){return S(a,2)^S(a,13)^S(a,22)},Sigma1256=function(a){return S(a,6)^S(a,11)^S(a,25)},Gamma0256=function(a){return S(a,7)^S(a,18)^R(a,3)},Gamma1256=function(a){return S(a,17)^S(a,19)^R(a,10)},core_sha256=function(a,e){var r,d,n,f,s,t,u,_,o,i,S,c,m=new Array(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),h=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),g=new Array(64);a[e>>5]|=128<<24-e%32,a[(e+64>>9<<4)+15]=e;for(var o=0;o<a.length;o+=16){r=h[0],d=h[1],n=h[2],f=h[3],s=h[4],t=h[5],u=h[6],_=h[7];for(var i=0;64>i;i++)g[i]=16>i?a[i+o]:safe_add(safe_add(safe_add(Gamma1256(g[i-2]),g[i-7]),Gamma0256(g[i-15])),g[i-16]),S=safe_add(safe_add(safe_add(safe_add(_,Sigma1256(s)),Ch(s,t,u)),m[i]),g[i]),c=safe_add(Sigma0256(r),Maj(r,d,n)),_=u,u=t,t=s,s=safe_add(f,S),f=n,n=d,d=r,r=safe_add(S,c);h[0]=safe_add(r,h[0]),h[1]=safe_add(d,h[1]),h[2]=safe_add(n,h[2]),h[3]=safe_add(f,h[3]),h[4]=safe_add(s,h[4]),h[5]=safe_add(t,h[5]),h[6]=safe_add(u,h[6]),h[7]=safe_add(_,h[7])}return h};module.exports=function(a){return helpers.hash(a,core_sha256,32,!0)};
},{"./helpers":88}],94:[function(require,module,exports){
function EventEmitter(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function isFunction(e){return"function"==typeof e}function isNumber(e){return"number"==typeof e}function isObject(e){return"object"==typeof e&&null!==e}function isUndefined(e){return void 0===e}module.exports=EventEmitter,EventEmitter.EventEmitter=EventEmitter,EventEmitter.prototype._events=void 0,EventEmitter.prototype._maxListeners=void 0,EventEmitter.defaultMaxListeners=10,EventEmitter.prototype.setMaxListeners=function(e){if(!isNumber(e)||0>e||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},EventEmitter.prototype.emit=function(e){var t,n,s,i,r,o;if(this._events||(this._events={}),"error"===e&&(!this._events.error||isObject(this._events.error)&&!this._events.error.length))throw t=arguments[1],t instanceof Error?t:TypeError('Uncaught, unspecified "error" event.');if(n=this._events[e],isUndefined(n))return!1;if(isFunction(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:for(s=arguments.length,i=new Array(s-1),r=1;s>r;r++)i[r-1]=arguments[r];n.apply(this,i)}else if(isObject(n)){for(s=arguments.length,i=new Array(s-1),r=1;s>r;r++)i[r-1]=arguments[r];for(o=n.slice(),s=o.length,r=0;s>r;r++)o[r].apply(this,i)}return!0},EventEmitter.prototype.addListener=function(e,t){var n;if(!isFunction(t))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,isFunction(t.listener)?t.listener:t),this._events[e]?isObject(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,isObject(this._events[e])&&!this._events[e].warned){var n;n=isUndefined(this._maxListeners)?EventEmitter.defaultMaxListeners:this._maxListeners,n&&n>0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())}return this},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.once=function(e,t){function n(){this.removeListener(e,n),s||(s=!0,t.apply(this,arguments))}if(!isFunction(t))throw TypeError("listener must be a function");var s=!1;return n.listener=t,this.on(e,n),this},EventEmitter.prototype.removeListener=function(e,t){var n,s,i,r;if(!isFunction(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],i=n.length,s=-1,n===t||isFunction(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(isObject(n)){for(r=i;r-->0;)if(n[r]===t||n[r].listener&&n[r].listener===t){s=r;break}if(0>s)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(s,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},EventEmitter.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],isFunction(n))this.removeListener(e,n);else for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},EventEmitter.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?isFunction(this._events[e])?[this._events[e]]:this._events[e].slice():[]},EventEmitter.listenerCount=function(e,t){var n;return n=e._events&&e._events[t]?isFunction(e._events[t])?1:e._events[t].length:0};
},{}],95:[function(require,module,exports){
var http=module.exports,EventEmitter=require("events").EventEmitter,Request=require("./lib/request"),url=require("url");http.request=function(e,t){"string"==typeof e&&(e=url.parse(e)),e||(e={}),e.host||e.port||(e.port=parseInt(window.location.port,10)),!e.host&&e.hostname&&(e.host=e.hostname),e.scheme||(e.scheme=window.location.protocol.split(":")[0]),e.host||(e.host=window.location.hostname||window.location.host),/:/.test(e.host)&&(e.port||(e.port=e.host.split(":")[1]),e.host=e.host.split(":")[0]),e.port||(e.port="https"==e.scheme?443:80);var o=new Request(new xhrHttp,e);return t&&o.on("response",t),o},http.get=function(e,t){e.method="GET";var o=http.request(e,t);return o.end(),o},http.Agent=function(){},http.Agent.defaultMaxSockets=4;var xhrHttp=function(){if("undefined"==typeof window)throw new Error("no window object present");if(window.XMLHttpRequest)return window.XMLHttpRequest;if(window.ActiveXObject){for(var e=["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.3.0","Microsoft.XMLHTTP"],t=0;t<e.length;t++)try{var o=new window.ActiveXObject(e[t]);return function(){if(o){var r=o;return o=null,r}return new window.ActiveXObject(e[t])}}catch(r){}throw new Error("ajax not supported in this browser")}throw new Error("ajax not supported in this browser")}();http.STATUS_CODES={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",300:"Multiple Choices",301:"Moved Permanently",302:"Moved Temporarily",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Time-out",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Large",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Time-out",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"};
},{"./lib/request":96,"events":94,"url":115}],96:[function(require,module,exports){
var Stream=require("stream"),Response=require("./response"),Base64=require("Base64"),inherits=require("inherits"),Request=module.exports=function(e,t){var r=this;r.writable=!0,r.xhr=e,r.body=[],r.uri=(t.scheme||"http")+"://"+t.host+(t.port?":"+t.port:"")+(t.path||"/"),"undefined"==typeof t.withCredentials&&(t.withCredentials=!0);try{e.withCredentials=t.withCredentials}catch(s){}if(e.open(t.method||"GET",r.uri,!0),r._headers={},t.headers)for(var o=objectKeys(t.headers),i=0;i<o.length;i++){var n=o[i];if(r.isSafeRequestHeader(n)){var a=t.headers[n];r.setHeader(n,a)}}t.auth&&this.setHeader("Authorization","Basic "+Base64.btoa(t.auth));var h=new Response;h.on("close",function(){r.emit("close")}),h.on("ready",function(){r.emit("response",h)}),e.onreadystatechange=function(){e.__aborted||h.handle(e)}};inherits(Request,Stream),Request.prototype.setHeader=function(e,t){this._headers[e.toLowerCase()]=t},Request.prototype.getHeader=function(e){return this._headers[e.toLowerCase()]},Request.prototype.removeHeader=function(e){delete this._headers[e.toLowerCase()]},Request.prototype.write=function(e){this.body.push(e)},Request.prototype.destroy=function(){this.xhr.__aborted=!0,this.xhr.abort(),this.emit("close")},Request.prototype.end=function(e){void 0!==e&&this.body.push(e);for(var t=objectKeys(this._headers),r=0;r<t.length;r++){var s=t[r],o=this._headers[s];if(isArray(o))for(var i=0;i<o.length;i++)this.xhr.setRequestHeader(s,o[i]);else this.xhr.setRequestHeader(s,o)}if(0===this.body.length)this.xhr.send("");else if("string"==typeof this.body[0])this.xhr.send(this.body.join(""));else if(isArray(this.body[0])){for(var n=[],r=0;r<this.body.length;r++)n.push.apply(n,this.body[r]);this.xhr.send(n)}else if(/Array/.test(Object.prototype.toString.call(this.body[0]))){for(var a=0,r=0;r<this.body.length;r++)a+=this.body[r].length;for(var n=new this.body[0].constructor(a),h=0,r=0;r<this.body.length;r++)for(var d=this.body[r],i=0;i<d.length;i++)n[h++]=d[i];this.xhr.send(n)}else{for(var n="",r=0;r<this.body.length;r++)n+=this.body[r].toString();this.xhr.send(n)}},Request.unsafeHeaders=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","content-transfer-encoding","date","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"],Request.prototype.isSafeRequestHeader=function(e){return e?-1===indexOf(Request.unsafeHeaders,e.toLowerCase()):!1};var objectKeys=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t},isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},indexOf=function(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0;r<e.length;r++)if(e[r]===t)return r;return-1};
},{"./response":97,"Base64":98,"inherits":100,"stream":108}],97:[function(require,module,exports){
function parseHeaders(e){for(var t=e.getAllResponseHeaders().split(/\r?\n/),s={},r=0;r<t.length;r++){var a=t[r];if(""!==a){var i=a.match(/^([^:]+):\s*(.*)/);if(i){var o=i[1].toLowerCase(),n=i[2];void 0!==s[o]?isArray(s[o])?s[o].push(n):s[o]=[s[o],n]:s[o]=n}else s[a]=!0}}return s}var Stream=require("stream"),util=require("util"),Response=module.exports=function(){this.offset=0,this.readable=!0};util.inherits(Response,Stream);var capable={streaming:!0,status2:!0};Response.prototype.getResponse=function(e){var t=String(e.responseType).toLowerCase();return"blob"===t?e.responseBlob||e.response:"arraybuffer"===t?e.response:e.responseText},Response.prototype.getHeader=function(e){return this.headers[e.toLowerCase()]},Response.prototype.handle=function(e){if(2===e.readyState&&capable.status2){try{this.statusCode=e.status,this.headers=parseHeaders(e)}catch(t){capable.status2=!1}capable.status2&&this.emit("ready")}else if(capable.streaming&&3===e.readyState){try{this.statusCode||(this.statusCode=e.status,this.headers=parseHeaders(e),this.emit("ready"))}catch(t){}try{this._emitData(e)}catch(t){capable.streaming=!1}}else 4===e.readyState&&(this.statusCode||(this.statusCode=e.status,this.emit("ready")),this._emitData(e),e.error?this.emit("error",this.getResponse(e)):this.emit("end"),this.emit("close"))},Response.prototype._emitData=function(e){var t=this.getResponse(e);return t.toString().match(/ArrayBuffer/)?(this.emit("data",new Uint8Array(t,this.offset)),void(this.offset=t.byteLength)):void(t.length>this.offset&&(this.emit("data",t.slice(this.offset)),this.offset=t.length))};var isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};
},{"stream":108,"util":117}],98:[function(require,module,exports){
!function(){function t(t){this.message=t}var e="undefined"!=typeof exports?exports:this,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";t.prototype=new Error,t.prototype.name="InvalidCharacterError",e.btoa||(e.btoa=function(e){for(var o,n,a=0,i=r,c="";e.charAt(0|a)||(i="=",a%1);c+=i.charAt(63&o>>8-a%1*8)){if(n=e.charCodeAt(a+=.75),n>255)throw new t("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");o=o<<8|n}return c}),e.atob||(e.atob=function(e){if(e=e.replace(/=+$/,""),e.length%4==1)throw new t("'atob' failed: The string to be decoded is not correctly encoded.");for(var o,n,a=0,i=0,c="";n=e.charAt(i++);~n&&(o=a%4?64*o+n:n,a++%4)?c+=String.fromCharCode(255&o>>(-2*a&6)):0)n=r.indexOf(n);return c})}();
},{}],99:[function(require,module,exports){
var http=require("http"),https=module.exports;for(var key in http)http.hasOwnProperty(key)&&(https[key]=http[key]);https.request=function(t,e){return t||(t={}),t.scheme="https",http.request.call(this,t,e)};
},{"http":95}],100:[function(require,module,exports){
module.exports="function"==typeof Object.create?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){t.super_=e;var o=function(){};o.prototype=e.prototype,t.prototype=new o,t.prototype.constructor=t};
},{}],101:[function(require,module,exports){
function noop(){}var process=module.exports={};process.nextTick=function(){var o="undefined"!=typeof window&&window.setImmediate,e="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(o)return function(o){return window.setImmediate(o)};if(e){var n=[];return window.addEventListener("message",function(o){var e=o.source;if((e===window||null===e)&&"process-tick"===o.data&&(o.stopPropagation(),n.length>0)){var s=n.shift();s()}},!0),function(o){n.push(o),window.postMessage("process-tick","*")}}return function(o){setTimeout(o,0)}}(),process.title="browser",process.browser=!0,process.env={},process.argv=[],process.on=noop,process.once=noop,process.off=noop,process.emit=noop,process.binding=function(){throw new Error("process.binding is not supported")},process.cwd=function(){return"/"},process.chdir=function(){throw new Error("process.chdir is not supported")};
},{}],102:[function(require,module,exports){
(function(r){function t(r,t){for(var e=0,n=r.length-1;n>=0;n--){var s=r[n];"."===s?r.splice(n,1):".."===s?(r.splice(n,1),e++):e&&(r.splice(n,1),e--)}if(t)for(;e--;e)r.unshift("..");return r}function e(r,t){if(r.filter)return r.filter(t);for(var e=[],n=0;n<r.length;n++)t(r[n],n,r)&&e.push(r[n]);return e}var n=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,s=function(r){return n.exec(r).slice(1)};exports.resolve=function(){for(var n="",s=!1,o=arguments.length-1;o>=-1&&!s;o--){var i=o>=0?arguments[o]:r.cwd();if("string"!=typeof i)throw new TypeError("Arguments to path.resolve must be strings");i&&(n=i+"/"+n,s="/"===i.charAt(0))}return n=t(e(n.split("/"),function(r){return!!r}),!s).join("/"),(s?"/":"")+n||"."},exports.normalize=function(r){var n=exports.isAbsolute(r),s="/"===o(r,-1);return r=t(e(r.split("/"),function(r){return!!r}),!n).join("/"),r||n||(r="."),r&&s&&(r+="/"),(n?"/":"")+r},exports.isAbsolute=function(r){return"/"===r.charAt(0)},exports.join=function(){var r=Array.prototype.slice.call(arguments,0);return exports.normalize(e(r,function(r){if("string"!=typeof r)throw new TypeError("Arguments to path.join must be strings");return r}).join("/"))},exports.relative=function(r,t){function e(r){for(var t=0;t<r.length&&""===r[t];t++);for(var e=r.length-1;e>=0&&""===r[e];e--);return t>e?[]:r.slice(t,e-t+1)}r=exports.resolve(r).substr(1),t=exports.resolve(t).substr(1);for(var n=e(r.split("/")),s=e(t.split("/")),o=Math.min(n.length,s.length),i=o,u=0;o>u;u++)if(n[u]!==s[u]){i=u;break}for(var l=[],u=i;u<n.length;u++)l.push("..");return l=l.concat(s.slice(i)),l.join("/")},exports.sep="/",exports.delimiter=":",exports.dirname=function(r){var t=s(r),e=t[0],n=t[1];return e||n?(n&&(n=n.substr(0,n.length-1)),e+n):"."},exports.basename=function(r,t){var e=s(r)[2];return t&&e.substr(-1*t.length)===t&&(e=e.substr(0,e.length-t.length)),e},exports.extname=function(r){return s(r)[3]};var o="b"==="ab".substr(-1)?function(r,t,e){return r.substr(t,e)}:function(r,t,e){return 0>t&&(t=r.length+t),r.substr(t,e)}}).call(this,require("/Users/ryanxcharles/dev/bitcore/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"));
},{"/Users/ryanxcharles/dev/bitcore/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":101}],103:[function(require,module,exports){
(function(e){!function(o){function n(e){throw RangeError(M[e])}function t(e,o){for(var n=e.length;n--;)e[n]=o(e[n]);return e}function r(e,o){return t(e.split(L),o).join(".")}function f(e){for(var o,n,t=[],r=0,f=e.length;f>r;)o=e.charCodeAt(r++),o>=55296&&56319>=o&&f>r?(n=e.charCodeAt(r++),56320==(64512&n)?t.push(((1023&o)<<10)+(1023&n)+65536):(t.push(o),r--)):t.push(o);return t}function i(e){return t(e,function(e){var o="";return e>65535&&(e-=65536,o+=T(e>>>10&1023|55296),e=56320|1023&e),o+=T(e)}).join("")}function u(e){return 10>e-48?e-22:26>e-65?e-65:26>e-97?e-97:C}function c(e,o){return e+22+75*(26>e)-((0!=o)<<5)}function d(e,o,n){var t=0;for(e=n?R(e/A):e>>1,e+=R(e/o);e>P*j>>1;t+=C)e=R(e/P);return R(t+(P+1)*e/(e+m))}function l(e){var o,t,r,f,c,l,s,p,a,h,v=[],w=e.length,g=0,y=F,m=I;for(t=e.lastIndexOf(E),0>t&&(t=0),r=0;t>r;++r)e.charCodeAt(r)>=128&&n("not-basic"),v.push(e.charCodeAt(r));for(f=t>0?t+1:0;w>f;){for(c=g,l=1,s=C;f>=w&&n("invalid-input"),p=u(e.charCodeAt(f++)),(p>=C||p>R((x-g)/l))&&n("overflow"),g+=p*l,a=m>=s?b:s>=m+j?j:s-m,!(a>p);s+=C)h=C-a,l>R(x/h)&&n("overflow"),l*=h;o=v.length+1,m=d(g-c,o,0==c),R(g/o)>x-y&&n("overflow"),y+=R(g/o),g%=o,v.splice(g++,0,y)}return i(v)}function s(e){var o,t,r,i,u,l,s,p,a,h,v,w,g,y,m,A=[];for(e=f(e),w=e.length,o=F,t=0,u=I,l=0;w>l;++l)v=e[l],128>v&&A.push(T(v));for(r=i=A.length,i&&A.push(E);w>r;){for(s=x,l=0;w>l;++l)v=e[l],v>=o&&s>v&&(s=v);for(g=r+1,s-o>R((x-t)/g)&&n("overflow"),t+=(s-o)*g,o=s,l=0;w>l;++l)if(v=e[l],o>v&&++t>x&&n("overflow"),v==o){for(p=t,a=C;h=u>=a?b:a>=u+j?j:a-u,!(h>p);a+=C)m=p-h,y=C-h,A.push(T(c(h+m%y,0))),p=R(m/y);A.push(T(c(p,0))),u=d(t,g,r==i),t=0,++r}++t,++o}return A.join("")}function p(e){return r(e,function(e){return O.test(e)?l(e.slice(4).toLowerCase()):e})}function a(e){return r(e,function(e){return S.test(e)?"xn--"+s(e):e})}var h="object"==typeof exports&&exports,v="object"==typeof module&&module&&module.exports==h&&module,w="object"==typeof e&&e;(w.global===w||w.window===w)&&(o=w);var g,y,x=2147483647,C=36,b=1,j=26,m=38,A=700,I=72,F=128,E="-",O=/^xn--/,S=/[^ -~]/,L=/\x2E|\u3002|\uFF0E|\uFF61/g,M={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},P=C-b,R=Math.floor,T=String.fromCharCode;if(g={version:"1.2.4",ucs2:{decode:f,encode:i},decode:l,encode:s,toASCII:a,toUnicode:p},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",function(){return g});else if(h&&!h.nodeType)if(v)v.exports=g;else for(y in g)g.hasOwnProperty(y)&&(h[y]=g[y]);else o.punycode=g}(this)}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});
},{}],104:[function(require,module,exports){
"use strict";function hasOwnProperty(r,e){return Object.prototype.hasOwnProperty.call(r,e)}module.exports=function(r,e,t,n){e=e||"&",t=t||"=";var o={};if("string"!=typeof r||0===r.length)return o;var a=/\+/g;r=r.split(e);var s=1e3;n&&"number"==typeof n.maxKeys&&(s=n.maxKeys);var p=r.length;s>0&&p>s&&(p=s);for(var y=0;p>y;++y){var u,c,i,l,f=r[y].replace(a,"%20"),v=f.indexOf(t);v>=0?(u=f.substr(0,v),c=f.substr(v+1)):(u=f,c=""),i=decodeURIComponent(u),l=decodeURIComponent(c),hasOwnProperty(o,i)?isArray(o[i])?o[i].push(l):o[i]=[o[i],l]:o[i]=l}return o};var isArray=Array.isArray||function(r){return"[object Array]"===Object.prototype.toString.call(r)};
},{}],105:[function(require,module,exports){
"use strict";function map(r,e){if(r.map)return r.map(e);for(var t=[],n=0;n<r.length;n++)t.push(e(r[n],n));return t}var stringifyPrimitive=function(r){switch(typeof r){case"string":return r;case"boolean":return r?"true":"false";case"number":return isFinite(r)?r:"";default:return""}};module.exports=function(r,e,t,n){return e=e||"&",t=t||"=",null===r&&(r=void 0),"object"==typeof r?map(objectKeys(r),function(n){var i=encodeURIComponent(stringifyPrimitive(n))+t;return isArray(r[n])?r[n].map(function(r){return i+encodeURIComponent(stringifyPrimitive(r))}).join(e):i+encodeURIComponent(stringifyPrimitive(r[n]))}).join(e):n?encodeURIComponent(stringifyPrimitive(n))+t+encodeURIComponent(stringifyPrimitive(r)):""};var isArray=Array.isArray||function(r){return"[object Array]"===Object.prototype.toString.call(r)},objectKeys=Object.keys||function(r){var e=[];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.push(t);return e};
},{}],106:[function(require,module,exports){
"use strict";exports.decode=exports.parse=require("./decode"),exports.encode=exports.stringify=require("./encode");
},{"./decode":104,"./encode":105}],107:[function(require,module,exports){
function Duplex(e){return this instanceof Duplex?(Readable.call(this,e),Writable.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),void this.once("end",onend)):new Duplex(e)}function onend(){if(!this.allowHalfOpen&&!this._writableState.ended){var e=this;setImmediate(function(){e.end()})}}module.exports=Duplex;var inherits=require("inherits"),setImmediate=require("process/browser.js").nextTick,Readable=require("./readable.js"),Writable=require("./writable.js");inherits(Duplex,Readable),Duplex.prototype.write=Writable.prototype.write,Duplex.prototype.end=Writable.prototype.end,Duplex.prototype._write=Writable.prototype._write;
},{"./readable.js":111,"./writable.js":113,"inherits":100,"process/browser.js":109}],108:[function(require,module,exports){
function Stream(){EE.call(this)}module.exports=Stream;var EE=require("events").EventEmitter,inherits=require("inherits");inherits(Stream,EE),Stream.Readable=require("./readable.js"),Stream.Writable=require("./writable.js"),Stream.Duplex=require("./duplex.js"),Stream.Transform=require("./transform.js"),Stream.PassThrough=require("./passthrough.js"),Stream.Stream=Stream,Stream.prototype.pipe=function(e,r){function t(r){e.writable&&!1===e.write(r)&&m.pause&&m.pause()}function n(){m.readable&&m.resume&&m.resume()}function o(){u||(u=!0,e.end())}function i(){u||(u=!0,"function"==typeof e.destroy&&e.destroy())}function s(e){if(a(),0===EE.listenerCount(this,"error"))throw e}function a(){m.removeListener("data",t),e.removeListener("drain",n),m.removeListener("end",o),m.removeListener("close",i),m.removeListener("error",s),e.removeListener("error",s),m.removeListener("end",a),m.removeListener("close",a),e.removeListener("close",a)}var m=this;m.on("data",t),e.on("drain",n),e._isStdio||r&&r.end===!1||(m.on("end",o),m.on("close",i));var u=!1;return m.on("error",s),e.on("error",s),m.on("end",a),m.on("close",a),e.on("close",a),e.emit("pipe",m),e};
},{"./duplex.js":107,"./passthrough.js":110,"./readable.js":111,"./transform.js":112,"./writable.js":113,"events":94,"inherits":100}],109:[function(require,module,exports){
var process=module.exports={};process.nextTick=function(){var e="undefined"!=typeof window&&window.setImmediate,n="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(e)return function(e){return window.setImmediate(e)};if(n){var o=[];return window.addEventListener("message",function(e){var n=e.source;if((n===window||null===n)&&"process-tick"===e.data&&(e.stopPropagation(),o.length>0)){var r=o.shift();r()}},!0),function(e){o.push(e),window.postMessage("process-tick","*")}}return function(e){setTimeout(e,0)}}(),process.title="browser",process.browser=!0,process.env={},process.argv=[],process.binding=function(){throw new Error("process.binding is not supported")},process.cwd=function(){return"/"},process.chdir=function(){throw new Error("process.chdir is not supported")};
},{}],110:[function(require,module,exports){
function PassThrough(r){return this instanceof PassThrough?void Transform.call(this,r):new PassThrough(r)}module.exports=PassThrough;var Transform=require("./transform.js"),inherits=require("inherits");inherits(PassThrough,Transform),PassThrough.prototype._transform=function(r,s,o){o(null,r)};
},{"./transform.js":112,"inherits":100}],111:[function(require,module,exports){
(function(e){function t(e){e=e||{};var t=e.highWaterMark;this.highWaterMark=t||0===t?t:16384,this.highWaterMark=~~this.highWaterMark,this.buffer=[],this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=!1,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.calledRead=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.objectMode=!!e.objectMode,this.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(_||(_=require("string_decoder").StringDecoder),this.decoder=new _(e.encoding),this.encoding=e.encoding)}function n(e){return this instanceof n?(this._readableState=new t(e,this),this.readable=!0,void S.call(this)):new n(e)}function r(e,t,n,r,a){var o=d(t,n);if(o)e.emit("error",o);else if(null===n||void 0===n)t.reading=!1,t.ended||s(e,t);else if(t.objectMode||n&&n.length>0)if(t.ended&&!a){var u=new Error("stream.push() after EOF");e.emit("error",u)}else if(t.endEmitted&&a){var u=new Error("stream.unshift() after end event");e.emit("error",u)}else!t.decoder||a||r||(n=t.decoder.write(n)),t.length+=t.objectMode?1:n.length,a?t.buffer.unshift(n):(t.reading=!1,t.buffer.push(n)),t.needReadable&&l(e),h(e,t);else a||(t.reading=!1);return i(t)}function i(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}function a(e){if(e>=L)e=L;else{e--;for(var t=1;32>t;t<<=1)e|=e>>t;e++}return e}function o(e,t){return 0===t.length&&t.ended?0:t.objectMode?0===e?0:1:isNaN(e)||null===e?t.flowing&&t.buffer.length?t.buffer[0].length:t.length:0>=e?0:(e>t.highWaterMark&&(t.highWaterMark=a(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function d(e,t){var n=null;return R.isBuffer(t)||"string"==typeof t||null===t||void 0===t||e.objectMode||n||(n=new TypeError("Invalid non-string/buffer chunk")),n}function s(e,t){if(t.decoder&&!t.ended){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.length>0?l(e):v(e)}function l(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,t.sync?E(function(){u(e)}):u(e))}function u(e){e.emit("readable")}function h(e,t){t.readingMore||(t.readingMore=!0,E(function(){f(e,t)}))}function f(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}function p(e){return function(){var t=e._readableState;t.awaitDrain--,0===t.awaitDrain&&c(e)}}function c(e){function t(e){var t=e.write(n);!1===t&&r.awaitDrain++}var n,r=e._readableState;for(r.awaitDrain=0;r.pipesCount&&null!==(n=e.read());)if(1===r.pipesCount?t(r.pipes,0,null):w(r.pipes,t),e.emit("data",n),r.awaitDrain>0)return;return 0===r.pipesCount?(r.flowing=!1,void(M.listenerCount(e,"data")>0&&b(e))):void(r.ranOut=!0)}function g(){this._readableState.ranOut&&(this._readableState.ranOut=!1,c(this))}function b(e,t){var n=e._readableState;if(n.flowing)throw new Error("Cannot switch to old mode now.");var r=t||!1,i=!1;e.readable=!0,e.pipe=S.prototype.pipe,e.on=e.addListener=S.prototype.on,e.on("readable",function(){i=!0;for(var t;!r&&null!==(t=e.read());)e.emit("data",t);null===t&&(i=!1,e._readableState.needReadable=!0)}),e.pause=function(){r=!0,this.emit("pause")},e.resume=function(){r=!1,i?E(function(){e.emit("readable")}):this.read(0),this.emit("resume")},e.emit("readable")}function m(e,t){var n,r=t.buffer,i=t.length,a=!!t.decoder,o=!!t.objectMode;if(0===r.length)return null;if(0===i)n=null;else if(o)n=r.shift();else if(!e||e>=i)n=a?r.join(""):R.concat(r,i),r.length=0;else if(e<r[0].length){var d=r[0];n=d.slice(0,e),r[0]=d.slice(e)}else if(e===r[0].length)n=r.shift();else{n=a?"":new R(e);for(var s=0,l=0,u=r.length;u>l&&e>s;l++){var d=r[0],h=Math.min(e-s,d.length);a?n+=d.slice(0,h):d.copy(n,s,0,h),h<d.length?r[0]=d.slice(h):r.shift(),s+=h}}return n}function v(e){var t=e._readableState;if(t.length>0)throw new Error("endReadable called on non-empty stream");!t.endEmitted&&t.calledRead&&(t.ended=!0,E(function(){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}))}function w(e,t){for(var n=0,r=e.length;r>n;n++)t(e[n],n)}function y(e,t){for(var n=0,r=e.length;r>n;n++)if(e[n]===t)return n;return-1}module.exports=n,n.ReadableState=t;var _,M=require("events").EventEmitter,S=require("./index.js"),R=require("buffer").Buffer,E=require("process/browser.js").nextTick,C=require("inherits");C(n,S),n.prototype.push=function(e,t){var n=this._readableState;return"string"!=typeof e||n.objectMode||(t=t||n.defaultEncoding,t!==n.encoding&&(e=new R(e,t),t="")),r(this,n,e,t,!1)},n.prototype.unshift=function(e){var t=this._readableState;return r(this,t,e,"",!0)},n.prototype.setEncoding=function(e){_||(_=require("string_decoder").StringDecoder),this._readableState.decoder=new _(e),this._readableState.encoding=e};var L=8388608;n.prototype.read=function(e){var t=this._readableState;t.calledRead=!0;var n=e;if(("number"!=typeof e||e>0)&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return l(this),null;if(e=o(e,t),0===e&&t.ended)return 0===t.length&&v(this),null;var r=t.needReadable;t.length-e<=t.highWaterMark&&(r=!0),(t.ended||t.reading)&&(r=!1),r&&(t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1),r&&!t.reading&&(e=o(n,t));var i;return i=e>0?m(e,t):null,null===i&&(t.needReadable=!0,e=0),t.length-=e,0!==t.length||t.ended||(t.needReadable=!0),t.ended&&!t.endEmitted&&0===t.length&&v(this),i},n.prototype._read=function(){this.emit("error",new Error("not implemented"))},n.prototype.pipe=function(t,n){function r(e){e===u&&a()}function i(){t.end()}function a(){t.removeListener("close",d),t.removeListener("finish",s),t.removeListener("drain",m),t.removeListener("error",o),t.removeListener("unpipe",r),u.removeListener("end",i),u.removeListener("end",a),(!t._writableState||t._writableState.needDrain)&&m()}function o(e){l(),0===v&&0===M.listenerCount(t,"error")&&t.emit("error",e)}function d(){t.removeListener("finish",s),l()}function s(){t.removeListener("close",d),l()}function l(){u.unpipe(t)}var u=this,h=this._readableState;switch(h.pipesCount){case 0:h.pipes=t;break;case 1:h.pipes=[h.pipes,t];break;default:h.pipes.push(t)}h.pipesCount+=1;var f=(!n||n.end!==!1)&&t!==e.stdout&&t!==e.stderr,b=f?i:a;h.endEmitted?E(b):u.once("end",b),t.on("unpipe",r);var m=p(u);t.on("drain",m);var v=M.listenerCount(t,"error");return t.once("error",o),t.once("close",d),t.once("finish",s),t.emit("pipe",u),h.flowing||(this.on("readable",g),h.flowing=!0,E(function(){c(u)})),t},n.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,this.removeListener("readable",g),t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,this.removeListener("readable",g),t.flowing=!1;for(var i=0;r>i;i++)n[i].emit("unpipe",this);return this}var i=y(t.pipes,e);return-1===i?this:(t.pipes.splice(i,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this),this)},n.prototype.on=function(e,t){var n=S.prototype.on.call(this,e,t);if("data"!==e||this._readableState.flowing||b(this),"readable"===e&&this.readable){var r=this._readableState;r.readableListening||(r.readableListening=!0,r.emittedReadable=!1,r.needReadable=!0,r.reading?r.length&&l(this,r):this.read(0))}return n},n.prototype.addListener=n.prototype.on,n.prototype.resume=function(){b(this),this.read(0),this.emit("resume")},n.prototype.pause=function(){b(this,!0),this.emit("pause")},n.prototype.wrap=function(e){var t=this._readableState,n=!1,r=this;e.on("end",function(){if(t.decoder&&!t.ended){var e=t.decoder.end();e&&e.length&&r.push(e)}r.push(null)}),e.on("data",function(i){if(t.decoder&&(i=t.decoder.write(i)),i&&(t.objectMode||i.length)){var a=r.push(i);a||(n=!0,e.pause())}});for(var i in e)"function"==typeof e[i]&&"undefined"==typeof this[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));var a=["error","close","destroy","pause","resume"];return w(a,function(t){e.on(t,function(e){return r.emit.apply(r,t,e)})}),r._read=function(){n&&(n=!1,e.resume())},r},n._fromList=m}).call(this,require("/Users/ryanxcharles/dev/bitcore/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"));
},{"./index.js":108,"/Users/ryanxcharles/dev/bitcore/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":101,"buffer":85,"events":94,"inherits":100,"process/browser.js":109,"string_decoder":114}],112:[function(require,module,exports){
function TransformState(r,t){this.afterTransform=function(r,n){return afterTransform(t,r,n)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null}function afterTransform(r,t,n){var e=r._transformState;e.transforming=!1;var a=e.writecb;if(!a)return r.emit("error",new Error("no writecb in Transform class"));e.writechunk=null,e.writecb=null,null!==n&&void 0!==n&&r.push(n),a&&a(t);var i=r._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&r._read(i.highWaterMark)}function Transform(r){if(!(this instanceof Transform))return new Transform(r);Duplex.call(this,r);var t=(this._transformState=new TransformState(r,this),this);this._readableState.needReadable=!0,this._readableState.sync=!1,this.once("finish",function(){"function"==typeof this._flush?this._flush(function(r){done(t,r)}):done(t)})}function done(r,t){if(t)return r.emit("error",t);var n=r._writableState,e=(r._readableState,r._transformState);if(n.length)throw new Error("calling transform done when ws.length != 0");if(e.transforming)throw new Error("calling transform done when still transforming");return r.push(null)}module.exports=Transform;var Duplex=require("./duplex.js"),inherits=require("inherits");inherits(Transform,Duplex),Transform.prototype.push=function(r,t){return this._transformState.needTransform=!1,Duplex.prototype.push.call(this,r,t)},Transform.prototype._transform=function(){throw new Error("not implemented")},Transform.prototype._write=function(r,t,n){var e=this._transformState;if(e.writecb=n,e.writechunk=r,e.writeencoding=t,!e.transforming){var a=this._readableState;(e.needTransform||a.needReadable||a.length<a.highWaterMark)&&this._read(a.highWaterMark)}},Transform.prototype._read=function(){var r=this._transformState;r.writechunk&&r.writecb&&!r.transforming?(r.transforming=!0,this._transform(r.writechunk,r.writeencoding,r.afterTransform)):r.needTransform=!0};
},{"./duplex.js":107,"inherits":100}],113:[function(require,module,exports){
function WriteReq(e,t,r){this.chunk=e,this.encoding=t,this.callback=r}function WritableState(e,t){e=e||{};var r=e.highWaterMark;this.highWaterMark=r||0===r?r:16384,this.objectMode=!!e.objectMode,this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var i=e.decodeStrings===!1;this.decodeStrings=!i,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){onwrite(t,e)},this.writecb=null,this.writelen=0,this.buffer=[]}function Writable(e){return this instanceof Writable||this instanceof Stream.Duplex?(this._writableState=new WritableState(e,this),this.writable=!0,void Stream.call(this)):new Writable(e)}function writeAfterEnd(e,t,r){var i=new Error("write after end");e.emit("error",i),setImmediate(function(){r(i)})}function validChunk(e,t,r,i){var n=!0;if(!Buffer.isBuffer(r)&&"string"!=typeof r&&null!==r&&void 0!==r&&!t.objectMode){var f=new TypeError("Invalid non-string/buffer chunk");e.emit("error",f),setImmediate(function(){i(f)}),n=!1}return n}function decodeChunk(e,t,r){return e.objectMode||e.decodeStrings===!1||"string"!=typeof t||(t=new Buffer(t,r)),t}function writeOrBuffer(e,t,r,i,n){r=decodeChunk(t,r,i);var f=t.objectMode?1:r.length;t.length+=f;var o=t.length<t.highWaterMark;return t.needDrain=!o,t.writing?t.buffer.push(new WriteReq(r,i,n)):doWrite(e,t,f,r,i,n),o}function doWrite(e,t,r,i,n,f){t.writelen=r,t.writecb=f,t.writing=!0,t.sync=!0,e._write(i,n,t.onwrite),t.sync=!1}function onwriteError(e,t,r,i,n){r?setImmediate(function(){n(i)}):n(i),e.emit("error",i)}function onwriteStateUpdate(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function onwrite(e,t){var r=e._writableState,i=r.sync,n=r.writecb;if(onwriteStateUpdate(r),t)onwriteError(e,r,i,t,n);else{var f=needFinish(e,r);f||r.bufferProcessing||!r.buffer.length||clearBuffer(e,r),i?setImmediate(function(){afterWrite(e,r,f,n)}):afterWrite(e,r,f,n)}}function afterWrite(e,t,r,i){r||onwriteDrain(e,t),i(),r&&finishMaybe(e,t)}function onwriteDrain(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function clearBuffer(e,t){t.bufferProcessing=!0;for(var r=0;r<t.buffer.length;r++){var i=t.buffer[r],n=i.chunk,f=i.encoding,o=i.callback,a=t.objectMode?1:n.length;if(doWrite(e,t,a,n,f,o),t.writing){r++;break}}t.bufferProcessing=!1,r<t.buffer.length?t.buffer=t.buffer.slice(r):t.buffer.length=0}function needFinish(e,t){return t.ending&&0===t.length&&!t.finished&&!t.writing}function finishMaybe(e,t){var r=needFinish(e,t);return r&&(t.finished=!0,e.emit("finish")),r}function endWritable(e,t,r){t.ending=!0,finishMaybe(e,t),r&&(t.finished?setImmediate(r):e.once("finish",r)),t.ended=!0}module.exports=Writable,Writable.WritableState=WritableState;var isUint8Array="undefined"!=typeof Uint8Array?function(e){return e instanceof Uint8Array}:function(e){return e&&e.constructor&&"Uint8Array"===e.constructor.name},isArrayBuffer="undefined"!=typeof ArrayBuffer?function(e){return e instanceof ArrayBuffer}:function(e){return e&&e.constructor&&"ArrayBuffer"===e.constructor.name},inherits=require("inherits"),Stream=require("./index.js"),setImmediate=require("process/browser.js").nextTick,Buffer=require("buffer").Buffer;inherits(Writable,Stream),Writable.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))},Writable.prototype.write=function(e,t,r){var i=this._writableState,n=!1;return"function"==typeof t&&(r=t,t=null),!Buffer.isBuffer(e)&&isUint8Array(e)&&(e=new Buffer(e)),isArrayBuffer(e)&&"undefined"!=typeof Uint8Array&&(e=new Buffer(new Uint8Array(e))),Buffer.isBuffer(e)?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof r&&(r=function(){}),i.ended?writeAfterEnd(this,i,r):validChunk(this,i,e,r)&&(n=writeOrBuffer(this,i,e,t,r)),n},Writable.prototype._write=function(e,t,r){r(new Error("not implemented"))},Writable.prototype.end=function(e,t,r){var i=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),"undefined"!=typeof e&&null!==e&&this.write(e,t),i.ending||i.finished||endWritable(this,i,r)};
},{"./index.js":108,"buffer":85,"inherits":100,"process/browser.js":109}],114:[function(require,module,exports){
function assertEncoding(e){if(e&&!Buffer.isEncoding(e))throw new Error("Unknown encoding: "+e)}function passThroughWrite(e){return e.toString(this.encoding)}function utf16DetectIncompleteChar(e){var t=this.charReceived=e.length%2;return this.charLength=t?2:0,t}function base64DetectIncompleteChar(e){var t=this.charReceived=e.length%3;return this.charLength=t?3:0,t}var Buffer=require("buffer").Buffer,StringDecoder=exports.StringDecoder=function(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),assertEncoding(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=utf16DetectIncompleteChar;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=base64DetectIncompleteChar;break;default:return void(this.write=passThroughWrite)}this.charBuffer=new Buffer(6),this.charReceived=0,this.charLength=0};StringDecoder.prototype.write=function(e){for(var t="",r=0;this.charLength;){var h=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,r,h),this.charReceived+=h-r,r=h,this.charReceived<this.charLength)return"";t=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var i=t.charCodeAt(t.length-1);if(!(i>=55296&&56319>=i)){if(this.charReceived=this.charLength=0,h==e.length)return t;e=e.slice(h,e.length);break}this.charLength+=this.surrogateSize,t=""}var c=this.detectIncompleteChar(e),n=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-c,n),this.charReceived=c,n-=c),t+=e.toString(this.encoding,0,n);var n=t.length-1,i=t.charCodeAt(n);if(i>=55296&&56319>=i){var a=this.surrogateSize;return this.charLength+=a,this.charReceived+=a,this.charBuffer.copy(this.charBuffer,a,0,a),this.charBuffer.write(t.charAt(t.length-1),this.encoding),t.substring(0,n)}return t},StringDecoder.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var r=e[e.length-t];if(1==t&&r>>5==6){this.charLength=2;break}if(2>=t&&r>>4==14){this.charLength=3;break}if(3>=t&&r>>3==30){this.charLength=4;break}}return t},StringDecoder.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var r=this.charReceived,h=this.charBuffer,i=this.encoding;t+=h.slice(0,r).toString(i)}return t};
},{"buffer":85}],115:[function(require,module,exports){
!function(){"use strict";function t(t,h,a){if(t&&"object"==typeof t&&t.href)return t;if("string"!=typeof t)throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var n={},p=t;p=p.trim();var i=r.exec(p);if(i){i=i[0];var q=i.toLowerCase();n.protocol=q,p=p.substr(i.length)}if(a||i||p.match(/^\/\/[^@\/]+@[^@\/]+/)){var j="//"===p.substr(0,2);!j||i&&g[i]||(p=p.substr(2),n.slashes=!0)}if(!g[i]&&(j||i&&!y[i])){var x=p.indexOf("@");if(-1!==x){for(var A=p.slice(0,x),O=!0,z=0,C=m.length;C>z;z++)if(-1!==A.indexOf(m[z])){O=!1;break}O&&(n.auth=decodeURIComponent(A),p=p.substr(x+1))}for(var Z=-1,z=0,C=f.length;C>z;z++){var k=p.indexOf(f[z]);-1!==k&&(0>Z||Z>k)&&(Z=k)}-1!==Z?(n.host=p.substr(0,Z),p=p.substr(Z)):(n.host=p,p="");for(var w=s(n.host),I=Object.keys(w),z=0,C=I.length;C>z;z++){var R=I[z];n[R]=w[R]}n.hostname=n.hostname||"";var U="["===n.hostname[0]&&"]"===n.hostname[n.hostname.length-1];if(n.hostname.length>l)n.hostname="";else if(!U)for(var $=n.hostname.split(/\./),z=0,C=$.length;C>z;z++){var _=$[z];if(_&&!_.match(u)){for(var L="",E=0,P=_.length;P>E;E++)L+=_.charCodeAt(E)>127?"x":_[E];if(!L.match(u)){var T=$.slice(0,z),B=$.slice(z+1),D=_.match(v);D&&(T.push(D[1]),B.unshift(D[2])),B.length&&(p="/"+B.join(".")+p),n.hostname=T.join(".");break}}}if(n.hostname=n.hostname.toLowerCase(),!U){for(var F=n.hostname.split("."),G=[],z=0;z<F.length;++z){var H=F[z];G.push(H.match(/[^A-Za-z0-9_-]/)?"xn--"+o.encode(H):H)}n.hostname=G.join(".")}n.host=(n.hostname||"")+(n.port?":"+n.port:""),n.href+=n.host,U&&(n.hostname=n.hostname.substr(1,n.hostname.length-2),"/"!==p[0]&&(p="/"+p))}if(!d[q])for(var z=0,C=c.length;C>z;z++){var J=c[z],K=encodeURIComponent(J);K===J&&(K=escape(J)),p=p.split(J).join(K)}var M=p.indexOf("#");-1!==M&&(n.hash=p.substr(M),p=p.slice(0,M));var N=p.indexOf("?");return-1!==N?(n.search=p.substr(N),n.query=p.substr(N+1),h&&(n.query=b.parse(n.query)),p=p.slice(0,N)):h&&(n.search="",n.query={}),p&&(n.pathname=p),y[i]&&n.hostname&&!n.pathname&&(n.pathname="/"),(n.pathname||n.search)&&(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=e(n),n}function e(e){"string"==typeof e&&(e=t(e));var h=e.auth||"";h&&(h=encodeURIComponent(h),h=h.replace(/%3A/i,":"),h+="@");var a=e.protocol||"",s=e.pathname||"",o=e.hash||"",r=!1,n="";void 0!==e.host?r=h+e.host:void 0!==e.hostname&&(r=h+(-1===e.hostname.indexOf(":")?e.hostname:"["+e.hostname+"]"),e.port&&(r+=":"+e.port)),e.query&&"object"==typeof e.query&&Object.keys(e.query).length&&(n=b.stringify(e.query));var p=e.search||n&&"?"+n||"";return a&&":"!==a.substr(-1)&&(a+=":"),e.slashes||(!a||y[a])&&r!==!1?(r="//"+(r||""),s&&"/"!==s.charAt(0)&&(s="/"+s)):r||(r=""),o&&"#"!==o.charAt(0)&&(o="#"+o),p&&"?"!==p.charAt(0)&&(p="?"+p),a+r+s+p+o}function h(t,h){return e(a(t,h))}function a(h,a){if(!h)return a;if(h=t(e(h),!1,!0),a=t(e(a),!1,!0),h.hash=a.hash,""===a.href)return h.href=e(h),h;if(a.slashes&&!a.protocol)return a.protocol=h.protocol,y[a.protocol]&&a.hostname&&!a.pathname&&(a.path=a.pathname="/"),a.href=e(a),a;if(a.protocol&&a.protocol!==h.protocol){if(!y[a.protocol])return a.href=e(a),a;if(h.protocol=a.protocol,!a.host&&!g[a.protocol]){for(var s=(a.pathname||"").split("/");s.length&&!(a.host=s.shift()););a.host||(a.host=""),a.hostname||(a.hostname=""),""!==s[0]&&s.unshift(""),s.length<2&&s.unshift(""),a.pathname=s.join("/")}return h.pathname=a.pathname,h.search=a.search,h.query=a.query,h.host=a.host||"",h.auth=a.auth,h.hostname=a.hostname||a.host,h.port=a.port,(void 0!==h.pathname||void 0!==h.search)&&(h.path=(h.pathname?h.pathname:"")+(h.search?h.search:"")),h.slashes=h.slashes||a.slashes,h.href=e(h),h}var o=h.pathname&&"/"===h.pathname.charAt(0),r=void 0!==a.host||a.pathname&&"/"===a.pathname.charAt(0),n=r||o||h.host&&a.pathname,p=n,i=h.pathname&&h.pathname.split("/")||[],s=a.pathname&&a.pathname.split("/")||[],c=h.protocol&&!y[h.protocol];if(c&&(delete h.hostname,delete h.port,h.host&&(""===i[0]?i[0]=h.host:i.unshift(h.host)),delete h.host,a.protocol&&(delete a.hostname,delete a.port,a.host&&(""===s[0]?s[0]=a.host:s.unshift(a.host)),delete a.host),n=n&&(""===s[0]||""===i[0])),r)h.host=a.host||""===a.host?a.host:h.host,h.hostname=a.hostname||""===a.hostname?a.hostname:h.hostname,h.search=a.search,h.query=a.query,i=s;else if(s.length)i||(i=[]),i.pop(),i=i.concat(s),h.search=a.search,h.query=a.query;else if("search"in a){if(c){h.hostname=h.host=i.shift();var f=h.host&&h.host.indexOf("@")>0?h.host.split("@"):!1;f&&(h.auth=f.shift(),h.host=h.hostname=f.shift())}return h.search=a.search,h.query=a.query,(void 0!==h.pathname||void 0!==h.search)&&(h.path=(h.pathname?h.pathname:"")+(h.search?h.search:"")),h.href=e(h),h}if(!i.length)return delete h.pathname,h.search?delete h.path:h.path="/"+h.search,h.href=e(h),h;for(var m=i.slice(-1)[0],l=(h.host||a.host)&&("."===m||".."===m)||""===m,u=0,v=i.length;v>=0;v--)m=i[v],"."==m?i.splice(v,1):".."===m?(i.splice(v,1),u++):u&&(i.splice(v,1),u--);if(!n&&!p)for(;u--;u)i.unshift("..");!n||""===i[0]||i[0]&&"/"===i[0].charAt(0)||i.unshift(""),l&&"/"!==i.join("/").substr(-1)&&i.push("");var d=""===i[0]||i[0]&&"/"===i[0].charAt(0);if(c){h.hostname=h.host=d?"":i.length?i.shift():"";var f=h.host&&h.host.indexOf("@")>0?h.host.split("@"):!1;f&&(h.auth=f.shift(),h.host=h.hostname=f.shift())}return n=n||h.host&&i.length,n&&!d&&i.unshift(""),h.pathname=i.join("/"),(void 0!==h.pathname||void 0!==h.search)&&(h.path=(h.pathname?h.pathname:"")+(h.search?h.search:"")),h.auth=a.auth||h.auth,h.slashes=h.slashes||a.slashes,h.href=e(h),h}function s(t){var e={},h=n.exec(t);return h&&(h=h[0],":"!==h&&(e.port=h.substr(1)),t=t.substr(0,t.length-h.length)),t&&(e.hostname=t),e}var o=require("punycode");exports.parse=t,exports.resolve=h,exports.resolveObject=a,exports.format=e;var r=/^([a-z0-9.+-]+:)/i,n=/:[0-9]*$/,p=["<",">",'"',"`"," ","\r","\n"," "],i=["{","}","|","\\","^","~","`"].concat(p),c=["'"].concat(p),f=["%","/","?",";","#"].concat(i).concat(c),m=["/","@","?","#"].concat(p),l=255,u=/^[a-zA-Z0-9][a-z0-9A-Z_-]{0,62}$/,v=/^([a-zA-Z0-9][a-z0-9A-Z_-]{0,62})(.*)$/,d={javascript:!0,"javascript:":!0},g={javascript:!0,"javascript:":!0},y={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},b=require("querystring")}();
},{"punycode":103,"querystring":106}],116:[function(require,module,exports){
module.exports=require(83)
},{}],117:[function(require,module,exports){
module.exports=require(84)
},{"./support/isBuffer":116,"/Users/ryanxcharles/dev/bitcore/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":101,"inherits":100}],"bufferput":[function(require,module,exports){
module.exports=require('aXRuS6');
},{}],"aXRuS6":[function(require,module,exports){
(function(t){function e(){this.words=[],this.len=0}module.exports=e,e.prototype.put=function(t){return this.words.push({buffer:t}),this.len+=t.length,this},e.prototype.word8=function(t){return this.words.push({bytes:1,value:t}),this.len+=1,this},e.prototype.floatle=function(t){return this.words.push({bytes:"float",endian:"little",value:t}),this.len+=4,this},e.prototype.varint=function(t){253>t?this.word8(t):65536>=t?(this.word8(253),this.word16le(t)):1>=t?(this.word8(254),this.word32le(t)):(this.word8(255),this.word64le(t))},[8,16,24,32,64].forEach(function(t){e.prototype["word"+t+"be"]=function(e){return this.words.push({endian:"big",bytes:t/8,value:e}),this.len+=t/8,this},e.prototype["word"+t+"le"]=function(e){return this.words.push({endian:"little",bytes:t/8,value:e}),this.len+=t/8,this}}),e.prototype.pad=function(t){return this.words.push({endian:"big",bytes:t,value:0}),this.len+=t,this},e.prototype.length=function(){return this.len},e.prototype.buffer=function(){var e=new t(this.len),o=0;return this.words.forEach(function(t){if(t.buffer)t.buffer.copy(e,o,0),o+=t.buffer.length;else if("float"==t.bytes){var r=Math.abs(t.value),i=1*(t.value>=0),n=Math.ceil(Math.log(r)/Math.LN2),s=r/(1<<n);e[o++]=i<<7&~~(n/2),e[o++]=(1&n)<<7&~~(s/65536),e[o++]=0,e[o++]=0,o+=4}else for(var h="big"===t.endian,u=h?[8*(t.bytes-1),-8]:[0,8],l=u[0];h?l>=0:l<8*t.bytes;l+=u[1])e[o++]=l>=32?255&Math.floor(t.value/Math.pow(2,l)):t.value>>l&255}),e},e.prototype.write=function(t){t.write(this.buffer())}}).call(this,require("buffer").Buffer);
},{"buffer":85}],"buffers":[function(require,module,exports){
module.exports=require('OBo3aV');
},{}],"OBo3aV":[function(require,module,exports){
(function(t){function e(t){return this instanceof e?(this.buffers=t||[],void(this.length=this.buffers.reduce(function(t,e){return t+e.length},0))):new e(t)}module.exports=e,e.prototype.push=function(){for(var e=0;e<arguments.length;e++)if(!t.isBuffer(arguments[e]))throw new TypeError("Tried to push a non-buffer");for(var e=0;e<arguments.length;e++){var r=arguments[e];this.buffers.push(r),this.length+=r.length}return this.length},e.prototype.unshift=function(){for(var e=0;e<arguments.length;e++)if(!t.isBuffer(arguments[e]))throw new TypeError("Tried to unshift a non-buffer");for(var e=0;e<arguments.length;e++){var r=arguments[e];this.buffers.unshift(r),this.length+=r.length}return this.length},e.prototype.copy=function(t,e,r,n){return this.slice(r,n).copy(t,e,0,n-r)},e.prototype.splice=function(r,n){var s=this.buffers,i=r>=0?r:this.length-r,h=[].slice.call(arguments,2);void 0===n?n=this.length-i:n>this.length-i&&(n=this.length-i);for(var r=0;r<h.length;r++)this.length+=h[r].length;for(var f=new e,o=0,l=0;l<s.length&&o+s[l].length<i;l++)o+=s[l].length;if(i-o>0){var u=i-o;if(u+n<s[l].length){f.push(s[l].slice(u,u+n));for(var g=s[l],p=new t(u),r=0;u>r;r++)p[r]=g[r];for(var a=new t(g.length-u-n),r=u+n;r<g.length;r++)a[r-n-u]=g[r];if(h.length>0){var c=h.slice();c.unshift(p),c.push(a),s.splice.apply(s,[l,1].concat(c)),l+=c.length,h=[]}else s.splice(l,1,p,a),l+=2}else f.push(s[l].slice(u)),s[l]=s[l].slice(0,u),l++}for(h.length>0&&(s.splice.apply(s,[l,0].concat(h)),l+=h.length);f.length<n;){var v=s[l],b=v.length,y=Math.min(b,n-f.length);y===b?(f.push(v),s.splice(l,1)):(f.push(v.slice(0,y)),s[l]=s[l].slice(y))}return this.length-=f.length,f},e.prototype.slice=function(e,r){var n=this.buffers;void 0===r&&(r=this.length),void 0===e&&(e=0),r>this.length&&(r=this.length);for(var s=0,i=0;i<n.length&&s+n[i].length<=e;i++)s+=n[i].length;for(var h=new t(r-e),f=0,o=i;r-e>f&&o<n.length;o++){var l=n[o].length,u=0===f?e-s:0,g=f+l>=r-e?Math.min(u+(r-e)-f,l):l;n[o].copy(h,f,u,g),f+=g-u}return h},e.prototype.pos=function(t){if(0>t||t>=this.length)throw new Error("oob");for(var e=t,r=0,n=null;;){if(n=this.buffers[r],e<n.length)return{buf:r,offset:e};e-=n.length,r++}},e.prototype.get=function(t){var e=this.pos(t);return this.buffers[e.buf].get(e.offset)},e.prototype.set=function(t,e){var r=this.pos(t);return this.buffers[r.buf].set(r.offset,e)},e.prototype.indexOf=function(e,r){if("string"==typeof e)e=new t(e);else if(!(e instanceof t))throw new Error("Invalid type for a search string");if(!e.length)return 0;if(!this.length)return-1;var n,s=0,i=0,h=0,f=0;if(r){var o=this.pos(r);s=o.buf,i=o.offset,f=r}for(;;){for(;i>=this.buffers[s].length;)if(i=0,s++,s>=this.buffers.length)return-1;var l=this.buffers[s][i];if(l==e[h]){if(0==h&&(n={i:s,j:i,pos:f}),h++,h==e.length)return n.pos}else 0!=h&&(s=n.i,i=n.j,f=n.pos,h=0);i++,f++}},e.prototype.toBuffer=function(){return this.slice()},e.prototype.toString=function(t,e,r){return this.slice(e,r).toString(t)}}).call(this,require("buffer").Buffer);
},{"buffer":85}],122:[function(require,module,exports){
(function(e){"use strict";function t(e,t){var o=this;u.call(o),o.socket=new i.Socket,o.socksHost=e,o.socksPort=t,o.socket.on("error",function(e){o.emit("error",e)}),o.on("error",function(){o.socket.destroyed||o.socket.destroy()})}function o(e,t){var o,n,r=e.split(".");for(o=0;o<r.length;o++)n=parseInt(r[o],10),t.push(n)}function n(e,t){var o,n,r,s,c,i,u;if(i=new d.Address(e).canonicalForm(),!i)return!1;for(u=i.split(":"),o=0;o<u.length;o++)s=u[o].substr(0,2),c=u[o].substr(2,2),n=parseInt(s,16),r=parseInt(c,16),t.push(n),t.push(r);return!0}function r(e,t){var o,n;for(t.push(e.length),o=0;o<e.length;o++)n=e.charCodeAt(o),t.push(n)}function s(e,t){p(t,t.length,e)}function c(e){switch(e){case 1:return"General SOCKS server failure";case 2:return"Connection not allowed by ruleset";case 3:return"Network unreachable";case 4:return"Host unreachable";case 5:return"Connection refused";case 6:return"TTL expired";case 7:return"Command not supported";case 8:return"Address type not supported";default:return"Unknown status code "+e}}var i=require("net"),u=require("events").EventEmitter,a=require("util").inherits,p=require("network-byte-order").htons,d=require("ipv6").v6;module.exports=exports=t,exports.createConnection=function(e){var o,n,r;return n=e.socksHost||"localhost",r=e.socksPort||1080,o=new t(n,r),o.connect(e.port,e.host)},a(t,u),t.prototype.setTimeout=function(e,t){return this.socket.setTimeout(e,t)},t.prototype.setNoDelay=function(){return this.socket.setNoDelay()},t.prototype.setKeepAlive=function(e,t){return this.socket.setKeepAlive(e,t)},t.prototype.address=function(){return this.socket.address()},t.prototype.pause=function(){return this.socket.pause()},t.prototype.resume=function(){return this.socket.resume()},t.prototype.end=function(e,t){return this.socket.end(e,t)},t.prototype.destroy=function(e){return this.socket.destroy(e)},t.prototype.destroySoon=function(){var e=this.socket.destroySoon();return this.writable=!1,e},t.prototype.setEncoding=function(e){return this.socket.setEncoding(e)},t.prototype.write=function(e,t,o){return this.socket.write(e,t,o)},t.prototype.connect=function(e,t){var o=this;return o.socket.connect(o.socksPort,o.socksHost,function(){o.establishSocksConnection(t,e)}),o},t.prototype.handleSocksConnectToHost=function(){var e=this;e.socket.on("close",function(t){e.emit("close",t)}),e.socket.on("end",function(){e.emit("end")}),e.socket.on("data",function(t){e.emit("data",t)}),e.socket._httpMessage=e._httpMessage,e.socket.parser=e.parser,e.socket.ondata=e.ondata,e.writable=!0,e.readable=!0,e.emit("connect")},t.prototype.establishSocksConnection=function(e,t){var o=this;o.authenticateWithSocks(function(){o.connectSocksToHost(e,t,function(){o.handleSocksConnectToHost()})})},t.prototype.authenticateWithSocks=function(t){var o,n=this;n.socket.ondata=function(e,o,r){var s;return r-o!==2?s=new Error("SOCKS authentication failed. Unexpected number of bytes received."):5!==e[o]?s=new Error("SOCKS authentication failed. Unexpected SOCKS version number: "+e[o]+"."):0!==e[o+1]&&(s=new Error("SOCKS authentication failed. Unexpected SOCKS authentication method: "+e[o+1]+".")),s?void n.emit("error",s):void(t&&t())},o=new e(3),o[0]=5,o[1]=1,o[2]=0,n.socket.write(o)},t.prototype.connectSocksToHost=function(t,u,a){var p,d,h=this;switch(this.socket.ondata=function(e,t){var o,n,r,s;if(5!==e[t]?s=new Error("SOCKS connection failed. Unexpected SOCKS version number: "+e[t]+"."):0!==e[t+1]?s=new Error("SOCKS connection failed. "+c(e[t+1])+"."):0!==e[t+2]&&(s=new Error("SOCKS connection failed. The reserved byte must be 0x00.")),s)return void h.emit("error",s);switch(n="",r=0,e[t+3]){case 1:n=e[t+4]+"."+e[t+5]+"."+e[t+6]+"."+e[t+7],r=4;break;case 3:for(r=e[t+4]+1,o=t+5;t+r>o;o++)n+=String.fromCharCode(e[o]);break;case 4:r=16;break;default:return void h.emit("error",new Error("SOCKS connection failed. Unknown addres type: "+e[t+3]+"."))}a&&a()},p=[],p.push(5),p.push(1),p.push(0),i.isIP(t)){case 0:p.push(3),r(t,p);break;case 4:p.push(1),o(t,p);break;case 6:if(p.push(4),n(t,p)===!1)return void h.emit("error",new Error("IPv6 host parsing failed. Invalid address."))}s(u,p),d=new e(p),this.socket.write(d)}}).call(this,require("buffer").Buffer);
},{"buffer":85,"events":94,"ipv6":123,"net":81,"network-byte-order":127,"util":117}],123:[function(require,module,exports){
exports=module.exports=require("./ipv6.js");
},{"./ipv6.js":124}],124:[function(require,module,exports){
function map(s,r){var e,t=[];for(e=0;e<s.length;e++)t.push(r(s[e],e));return t}function repeatString(s,r){var e,t="";for(e=0;r>e;e++)t+=s;return t}function addCommas(s){for(var r=/(\d+)(\d{3})/;r.test(s);)s=s.replace(r,"$1,$2");return s}function spanLeadingZeroesSimple(s){return s.replace(/^(0+)/,'<span class="zero">$1</span>')}function spanLeadingZeroes4(s){return s=s.replace(/^(0{1,})([1-9]+)$/,'<span class="parse-error">$1</span>$2'),s=s.replace(/^(0{1,})(0)$/,'<span class="parse-error">$1</span>$2')}function simpleRegularExpression(s){var r,e=[];for(r=0;r<s.length;r++){var t=s[r];e.push(t.length<4?sprintf("0{0,%d}%s",4-t.length,t):t)}return e.join(":")}function zeroPad(s,r){return String(repeatString(0,r)+s).slice(-1*r)}function isInSubnet(s){return this.subnetMask<s.subnetMask?!1:this.mask(s.subnetMask)===s.mask()?!0:!1}if("undefined"!=typeof exports)var sprintf=require("sprintf").sprintf,BigInteger=require("./lib/node/bigint").BigInteger;var v4=this.v4={},v6=this.v6={};v4.GROUPS=4,v6.GROUPS=8,v4.BITS=32,v6.BITS=128,v6.SCOPES={0:"Reserved",1:"Interface local",2:"Link local",4:"Admin local",5:"Site local",8:"Organization local",15:"Global",16:"Reserved"},v4.RE_ADDRESS=/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/g,v4.RE_SUBNET_STRING=/\/\d{1,2}$/,v6.RE_BAD_CHARACTERS=/([^0-9a-f:\/%])/gi,v6.RE_BAD_ADDRESS=/([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi,v6.RE_SUBNET_STRING=/\/\d{1,3}(?=%|$)/,v6.RE_ZONE_STRING=/%.*$/,v6.RE_URL=new RegExp(/([0-9a-f:]+)/),v6.RE_URL_WITH_PORT=new RegExp(/\[([0-9a-f:]+)\]:([0-9]{1,5})/),v4.Address=function(s){this.valid=!1,this.address=s,this.groups=v4.GROUPS,this.v4=!0,this.subnet="/32",this.subnetMask=32;var r=v4.RE_SUBNET_STRING.exec(s);if(r){if(this.parsedSubnet=r[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet="/"+this.subnetMask,this.subnetMask<0||this.subnetMask>v4.BITS)return this.valid=!1,void(this.error="Invalid subnet mask.");s=s.replace(v4.RE_SUBNET_STRING,"")}this.addressMinusSuffix=s,this.parsedAddress=this.parse(s)},v4.Address.prototype.parse=function(s){var r=s.split(".");return s.match(v4.RE_ADDRESS)?this.valid=!0:this.error="Invalid IPv4 address.",r},v4.Address.prototype.isValid=function(){return this.valid},v4.Address.prototype.correctForm=function(){return this.parsedAddress.map(function(s){return parseInt(s,10)}).join(".")},v4.Address.prototype.isCorrect=function(){return this.addressMinusSuffix===this.correctForm()&&(32===this.subnetMask||this.parsedSubnet===String(this.subnet.replace("/")))},v4.Address.fromHex=function(s){var r,e=zeroPad(s.replace(/:/g,""),8),t=[];for(r=0;8>r;r+=2){var i=e.slice(r,r+2);t.push(parseInt(i,16))}return new v4.Address(t.join("."))},v4.Address.fromInteger=function(s){return v4.Address.fromHex(s.toString(16))},v4.Address.prototype.toHex=function(){return this.parsedAddress.map(function(s){return sprintf("%02x",parseInt(s,10))}).join(":")},v4.Address.prototype.toArray=function(){return this.parsedAddress.map(function(s){return parseInt(s,10)})},v4.Address.prototype.toV6Group=function(){var s,r=[];for(s=0;s<v4.GROUPS;s+=2){var e=sprintf("%02x%02x",parseInt(this.parsedAddress[s],10),parseInt(this.parsedAddress[s+1],10));r.push(sprintf("%x",parseInt(e,16)))}return r.join(":")},v4.Address.prototype.bigInteger=function(){return this.valid?new BigInteger(map(this.parsedAddress,function(s){return sprintf("%02x",parseInt(s,10))}).join(""),16):void 0},v4.Address.prototype.startAddress=function(){var s=new BigInteger(this.mask()+repeatString(0,v4.BITS-this.subnetMask),2);return v4.Address.fromBigInteger(s)},v4.Address.prototype.endAddress=function(){var s=new BigInteger(this.mask()+repeatString(1,v4.BITS-this.subnetMask),2);return v4.Address.fromBigInteger(s)},v4.Address.fromBigInteger=function(s){return v4.Address.fromInteger(parseInt(s.toString(),10))},v4.Address.prototype.mask=function(s){return void 0===s&&(s=this.subnetMask),this.getBitsBase2(0,s)},v4.Address.prototype.getBitsBase2=function(s,r){return this.binaryZeroPad().slice(s,r)},v4.Address.prototype.isInSubnet=isInSubnet,v4.Address.prototype.binaryZeroPad=function(){return zeroPad(this.bigInteger().toString(2),v4.BITS)},v6.Address=function(s,r){this.groups=void 0===r?v6.GROUPS:r,this.v4=!1,this.subnet="/128",this.subnetMask=128,this.zone="",this.address=s;var e=v6.RE_SUBNET_STRING.exec(s);if(e){if(this.parsedSubnet=e[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet="/"+this.subnetMask,isNaN(this.subnetMask)||this.subnetMask<0||this.subnetMask>v6.BITS)return this.valid=!1,void(this.error="Invalid subnet mask.");s=s.replace(v6.RE_SUBNET_STRING,"")}else if(/\//.test(s))return this.valid=!1,void(this.error="Invalid subnet mask.");var t=v6.RE_ZONE_STRING.exec(s);t&&(this.zone=t[0],s=s.replace(v6.RE_ZONE_STRING,"")),this.addressMinusSuffix=s,this.parsedAddress=this.parse(this.addressMinusSuffix)},v6.Address.fromBigInteger=function(s){var r,e=zeroPad(s.toString(16),32),t=[];for(r=0;8>r;r++)t.push(e.slice(4*r,4*(r+1)));return new v6.Address(t.join(":"))},v6.Address.fromURL=function(s){var r,e,t;if(-1!==s.indexOf("[")&&-1!==s.indexOf("]")){if(t=v6.RE_URL_WITH_PORT.exec(s),null===t)return{error:"failed to parse address with port",address:null,port:null};r=t[1],e=t[2]}else if(-1!==s.indexOf("/")){if(s=s.replace(/^[a-z0-9]+:\/\//,""),t=v6.RE_URL.exec(s),null===t)return{error:"failed to parse address from URL",address:null,port:null};r=t[1]}else r=s;return e?(e=parseInt(e,10),(0>e||e>65536)&&(e=null)):e=null,{address:new v6.Address(r),port:e}},v6.Address.compact=function(s,r){var e,t=[],i=[];for(e=0;e<s.length;e++)e<r[0]?t.push(s[e]):e>r[1]&&i.push(s[e]);return t.concat(["compact"]).concat(i)},v6.Address.prototype.isValid=function(){return this.valid},v6.Address.prototype.isCorrect=function(){return this.addressMinusSuffix===this.correctForm()&&(128===this.subnetMask||this.parsedSubnet===String(this.subnet.replace("/")))},v6.Address.prototype.isLinkLocal=function(){return"1111111010000000000000000000000000000000000000000000000000000000"===this.getBitsBase2(0,64)?!0:!1},v6.Address.prototype.isCanonical=function(){return this.addressMinusSuffix===this.canonicalForm()},v6.Address.prototype.isMulticast=function(){return"Multicast"===this.getType()},v6.Address.prototype.is4=function(){return this.v4},v6.Address.prototype.isTeredo=function(){return this.isInSubnet(new v6.Address("2001::/32"))?!0:!1},v6.Address.prototype.is6to4=function(){return this.isInSubnet(new v6.Address("2002::/16"))?!0:!1},v6.Address.prototype.isLoopback=function(){return"Loopback"===this.getType()},v6.Address.prototype.microsoftTranscription=function(){return sprintf("%s.ipv6-literal.net",this.correctForm().replace(/:/g,"-"))},v6.Address.prototype.href=function(s){return s=void 0===s?"":sprintf(":%s",s),sprintf("http://[%s]%s/",this.correctForm(),s)},v6.Address.prototype.mask=function(s){return void 0===s&&(s=this.subnetMask),this.getBitsBase2(0,s)},v6.Address.prototype.link=function(s){s||(s={}),void 0===s.className&&(s.className=""),void 0===s.prefix&&(s.prefix="/#address="),void 0===s.v4&&(s.v4=!1);var r=this.correctForm;return s.v4&&(r=this.v4inv6),s.className?sprintf('<a href="%1$s%2$s" class="%3$s">%2$s</a>',s.prefix,r.call(this),s.className):sprintf('<a href="%1$s%2$s">%2$s</a>',s.prefix,r.call(this))},v6.Address.prototype.possibleAddresses=function(s){return void 0===s&&(s=0),addCommas(new BigInteger("2",10).pow(v6.BITS-this.subnetMask-(v6.BITS-s)).toString(10))},v6.Address.prototype.isInSubnet=isInSubnet,v6.Address.fromAddress4=function(s){return new v6.Address("::ffff:"+s)},v6.Address.prototype.startAddress=function(){var s=new BigInteger(this.mask()+repeatString(0,v6.BITS-this.subnetMask),2);return v6.Address.fromBigInteger(s)},v6.Address.prototype.endAddress=function(){var s=new BigInteger(this.mask()+repeatString(1,v6.BITS-this.subnetMask),2);return v6.Address.fromBigInteger(s)},v6.Address.prototype.getScope=function(){var s=v6.SCOPES[this.getBits(12,16)];return"Global unicast"===this.getType()&&"Link local"!==s&&(s="Global"),s},v6.Address.prototype.getType=function(){var s,r={"ff01::1/128":"Multicast (All nodes on this interface)","ff01::2/128":"Multicast (All routers on this interface)","ff02::1/128":"Multicast (All nodes on this link)","ff02::2/128":"Multicast (All routers on this link)","ff05::2/128":"Multicast (All routers in this site)","ff02::5/128":"Multicast (OSPFv3 AllSPF routers)","ff02::6/128":"Multicast (OSPFv3 AllDR routers)","ff02::9/128":"Multicast (RIP routers)","ff02::a/128":"Multicast (EIGRP routers)","ff02::d/128":"Multicast (PIM routers)","ff02::16/128":"Multicast (MLDv2 reports)","ff01::fb/128":"Multicast (mDNSv6)","ff02::fb/128":"Multicast (mDNSv6)","ff05::fb/128":"Multicast (mDNSv6)","ff02::1:2/128":"Multicast (All DHCP servers and relay agents on this link)","ff05::1:2/128":"Multicast (All DHCP servers and relay agents in this site)","ff02::1:3/128":"Multicast (All DHCP servers on this link)","ff05::1:3/128":"Multicast (All DHCP servers in this site)","::/128":"Unspecified","::1/128":"Loopback","ff00::/8":"Multicast","fe80::/10":"Link-local unicast"},e="Global unicast";for(s in r)if(r.hasOwnProperty(s)&&this.isInSubnet(new v6.Address(s))){e=r[s];break}return e},v6.Address.prototype.getBits=function(s,r){return new BigInteger(this.getBitsBase2(s,r),2)},v6.Address.prototype.getBitsBase2=function(s,r){return this.binaryZeroPad().slice(s,r)},v6.Address.prototype.getBitsBase16=function(s,r){var e=r-s;if(e%4===0)return zeroPad(this.getBits(s,r).toString(16),e/4)},v6.Address.prototype.getBitsPastSubnet=function(){return this.getBitsBase2(this.subnetMask,v6.BITS)},v6.Address.spanAll=function(s,r){void 0===r&&(r=0);var e=s.split("");return map(e,function(s,e){return sprintf('<span class="digit value-%s position-%d">%s</span>',s,e+r,v6.Address.spanAllZeroes(s))}).join("")},v6.Address.spanAllZeroes=function(s){return s.replace(/(0+)/g,'<span class="zero">$1</span>')},v6.Address.spanLeadingZeroes=function(s){var r=s.split(":");return r=map(r,function(s){return spanLeadingZeroesSimple(s)}),r.join(":")},v6.Address.simpleGroup=function(s,r){var e=s.split(":");return r||(r=0),e=map(e,function(s,e){return/group-v4/.test(s)?s:sprintf('<span class="hover-group group-%d">%s</span>',e+r,spanLeadingZeroesSimple(s))}),e.join(":")},v6.Address.group=function(s){var r,e=new v6.Address(s),t=e.address.match(v4.RE_ADDRESS);if(t){var i=t[0].split(".");e.address=e.address.replace(v4.RE_ADDRESS,sprintf('<span class="hover-group group-v4 group-6">%s</span>.<span class="hover-group group-v4 group-7">%s</span>',i.slice(0,2).join("."),i.slice(2,4).join(".")))}if(0===e.elidedGroups)return v6.Address.simpleGroup(e.address);var n=[],o=e.address.split("::");n.push(o[0].length?v6.Address.simpleGroup(o[0]):"");var a=["hover-group"];for(r=e.elisionBegin;r<e.elisionBegin+e.elidedGroups;r++)a.push(sprintf("group-%d",r));return n.push(sprintf('<span class="%s"></span>',a.join(" "))),n.push(o[1].length?v6.Address.simpleGroup(o[1],e.elisionEnd):""),n.join(":")},v6.Address.prototype.reverseForm=function(){var s=Math.floor(this.subnetMask/4),r=this.canonicalForm().replace(/:/g,"").split("").slice(0,s).reverse().join(".");return s>0?sprintf("%s.ip6.arpa.",r):"ip6.arpa."},v6.Address.prototype.correctForm=function(){if(this.parsedAddress){var s,r=[],e=0,t=[];for(s=0;s<this.parsedAddress.length;s++){var i=parseInt(this.parsedAddress[s],16);0===i&&e++,0!==i&&e>0&&(e>1&&t.push([s-e,s-1]),e=0)}e>1&&t.push([this.parsedAddress.length-e,this.parsedAddress.length-1]);var n=map(t,function(s){return s[1]-s[0]+1});if(t.length>0){var o=Math.max.apply(Math,n),a=n.indexOf(o);r=v6.Address.compact(this.parsedAddress,t[a])}else r=this.parsedAddress;for(s=0;s<r.length;s++)"compact"!==r[s]&&(r[s]=parseInt(r[s],16).toString(16));var d=r.join(":");return d=d.replace(/^compact$/,"::"),d=d.replace(/^compact|compact$/,":"),d=d.replace(/compact/,"")}},v6.Address.prototype.binaryZeroPad=function(){return zeroPad(this.bigInteger().toString(2),v6.BITS)},v6.Address.prototype.parse4in6=function(s){var r=s.split(":"),e=r.slice(-1)[0],t=e.match(v4.RE_ADDRESS);if(t){for(var i=new v4.Address(t[0]),n=0;n<i.groups;n++)if(/^0[0-9]+/.test(i.parsedAddress[n]))return this.valid=!1,this.error="IPv4 addresses can not have leading zeroes.",void(this.parseError=s.replace(v4.RE_ADDRESS,map(i.parsedAddress,spanLeadingZeroes4).join(".")));this.v4=!0,r[r.length-1]=i.toV6Group(),s=r.join(":")}return s},v6.Address.prototype.parse=function(s){if(s=this.parse4in6(s),!this.error){var r=s.match(v6.RE_BAD_CHARACTERS);if(r)return this.valid=!1,this.error=sprintf("Bad character%s detected in address: %s",r.length>1?"s":"",r.join("")),void(this.parseError=s.replace(v6.RE_BAD_CHARACTERS,'<span class="parse-error">$1</span>'));var e=s.match(v6.RE_BAD_ADDRESS);if(e)return this.valid=!1,this.error=sprintf("Address failed regex: %s",e.join("")),void(this.parseError=s.replace(v6.RE_BAD_ADDRESS,'<span class="parse-error">$1</span>'));var t=[],i=s.split("::");if(2===i.length){var n=i[0].split(":"),o=i[1].split(":");1===n.length&&""===n[0]&&(n=[]),1===o.length&&""===o[0]&&(o=[]);var a=this.groups-(n.length+o.length);if(!a)return this.valid=!1,void(this.error="Error parsing groups");this.elidedGroups=a,this.elisionBegin=n.length,this.elisionEnd=n.length+this.elidedGroups,n.forEach(function(s){t.push(s)});for(var d=0;a>d;d++)t.push(0);o.forEach(function(s){t.push(s)})}else{if(1!==i.length)return this.valid=!1,void(this.error="Too many :: groups found");t=s.split(":"),this.elidedGroups=0}return t=map(t,function(s){return sprintf("%x",parseInt(s,16))}),t.length!==this.groups?(this.valid=!1,void(this.error="Incorrect number of groups found")):(t.forEach(function(s,r){return t.length>4&&!this.v4?(this.valid=!1,void(this.error=sprintf("Group %d is too long",r+1))):void 0}),this.valid=!0,t)}},v6.Address.prototype.regularExpressionString=function(s){void 0===s&&(s=!1);var r,e=[],t=new v6.Address(this.correctForm());if(0===t.elidedGroups)e=simpleRegularExpression(t.parsedAddress);else if(8===t.elidedGroups)for(e.push("::|"),r=0;r<t.elidedGroups;r++){var i="|";r===t.elidedGroups-1&&(i=""),e.push(sprintf("(0{1,4}:){%d}:%s",t.elidedGroups,i))}else{var n=t.address.split("::");n[0].length&&(e=e.concat(simpleRegularExpression(n[0].split(":"))),e.push(":")),e.push(sprintf("((0{1,4}:){%d}|:)",t.elidedGroups)),n[1].length&&(e=e.concat(simpleRegularExpression(n[1].split(":"))))}return s||(e=[].concat("\\b",e,"\\b")),e.join("")},v6.Address.prototype.regularExpression=function(){return new RegExp(this.regularExpressionString(),"i")},v6.Address.prototype.canonicalForm=function(){return this.valid?map(this.parsedAddress,function(s){return sprintf("%04x",parseInt(s,16))}).join(":"):void 0},v6.Address.prototype.decimal=function(){return this.valid?map(this.parsedAddress,function(s){return sprintf("%05d",parseInt(s,16))}).join(":"):void 0},v6.Address.prototype.bigInteger=function(){return this.valid?new BigInteger(map(this.parsedAddress,function(s){return sprintf("%04x",parseInt(s,16))}).join(""),16):void 0},v6.Address.prototype.v4inv6=function(){var s=this.binaryZeroPad().split(""),r=v4.Address.fromHex(new BigInteger(s.slice(96,128).join(""),2).toString(16)),e=new v6.Address(this.parsedAddress.slice(0,6).join(":"),6),t=e.correctForm(),i="";return/:$/.test(t)||(i=":"),e.correctForm()+i+r.address},v6.Address.prototype.teredo=function(){var s=this.getBitsBase16(0,32),r=this.getBits(80,96).xor(new BigInteger("ffff",16)).toString(),e=v4.Address.fromHex(this.getBitsBase16(32,64)),t=v4.Address.fromHex(this.getBits(96,128).xor(new BigInteger("ffffffff",16)).toString(16)),i=this.getBits(64,80),n=this.getBitsBase2(64,80),o=i.testBit(15),a=i.testBit(14),d=i.testBit(8),p=i.testBit(9),u=new BigInteger(n.slice(2,6)+n.slice(8,16),2).toString(10);return{prefix:sprintf("%s:%s",s.slice(0,4),s.slice(4,8)),server4:e.address,client4:t.address,flags:n,coneNat:o,microsoft:{reserved:a,universalLocal:p,groupIndividual:d,nonce:u},udpPort:r}},v6.Address.prototype.six2four=function(){var s=this.getBitsBase16(0,16),r=v4.Address.fromHex(this.getBitsBase16(16,48));return{prefix:sprintf("%s",s.slice(0,4)),gateway:r.address}};
},{"./lib/node/bigint":125,"sprintf":126}],125:[function(require,module,exports){
function nbi(){return new BigInteger(null)}function am4(t,r,i,n,o,e){for(var s=this.array,a=i.array,h=8191&r,p=r>>13;--e>=0;){var u=8191&s[t],f=s[t++]>>13,b=p*u+f*h;u=h*u+((8191&b)<<13)+a[n]+o,o=(u>>26)+(b>>13)+p*f,a[n++]=67108863&u}return o}function int2char(t){return BI_RM.charAt(t)}function intAt(t,r){var i=BI_RC[t.charCodeAt(r)];return null==i?-1:i}function bnpCopyTo(t){for(var r=this.array,i=t.array,n=this.t-1;n>=0;--n)i[n]=r[n];t.t=this.t,t.s=this.s}function bnpFromInt(t){var r=this.array;this.t=1,this.s=0>t?-1:0,t>0?r[0]=t:-1>t?r[0]=t+DV:this.t=0}function nbv(t){var r=nbi();return r.fromInt(t),r}function bnpFromString(t,r){var i,n=this.array;if(16==r)i=4;else if(8==r)i=3;else if(256==r)i=8;else if(2==r)i=1;else if(32==r)i=5;else{if(4!=r)return void this.fromRadix(t,r);i=2}this.t=0,this.s=0;for(var o=t.length,e=!1,s=0;--o>=0;){var a=8==i?255&t[o]:intAt(t,o);0>a?"-"==t.charAt(o)&&(e=!0):(e=!1,0==s?n[this.t++]=a:s+i>BI_DB?(n[this.t-1]|=(a&(1<<BI_DB-s)-1)<<s,n[this.t++]=a>>BI_DB-s):n[this.t-1]|=a<<s,s+=i,s>=BI_DB&&(s-=BI_DB))}8==i&&0!=(128&t[0])&&(this.s=-1,s>0&&(n[this.t-1]|=(1<<BI_DB-s)-1<<s)),this.clamp(),e&&BigInteger.ZERO.subTo(this,this)}function bnpClamp(){for(var t=this.array,r=this.s&BI_DM;this.t>0&&t[this.t-1]==r;)--this.t}function bnToString(t){var r=this.array;if(this.s<0)return"-"+this.negate().toString(t);var i;if(16==t)i=4;else if(8==t)i=3;else if(2==t)i=1;else if(32==t)i=5;else{if(4!=t)return this.toRadix(t);i=2}var n,o=(1<<i)-1,e=!1,s="",a=this.t,h=BI_DB-a*BI_DB%i;if(a-->0)for(BI_DB>h&&(n=r[a]>>h)>0&&(e=!0,s=int2char(n));a>=0;)i>h?(n=(r[a]&(1<<h)-1)<<i-h,n|=r[--a]>>(h+=BI_DB-i)):(n=r[a]>>(h-=i)&o,0>=h&&(h+=BI_DB,--a)),n>0&&(e=!0),e&&(s+=int2char(n));return e?s:"0"}function bnNegate(){var t=nbi();return BigInteger.ZERO.subTo(this,t),t}function bnAbs(){return this.s<0?this.negate():this}function bnCompareTo(t){var r=this.array,i=t.array,n=this.s-t.s;if(0!=n)return n;var o=this.t;if(n=o-t.t,0!=n)return n;for(;--o>=0;)if(0!=(n=r[o]-i[o]))return n;return 0}function nbits(t){var r,i=1;return 0!=(r=t>>>16)&&(t=r,i+=16),0!=(r=t>>8)&&(t=r,i+=8),0!=(r=t>>4)&&(t=r,i+=4),0!=(r=t>>2)&&(t=r,i+=2),0!=(r=t>>1)&&(t=r,i+=1),i}function bnBitLength(){var t=this.array;return this.t<=0?0:BI_DB*(this.t-1)+nbits(t[this.t-1]^this.s&BI_DM)}function bnpDLShiftTo(t,r){var i,n=this.array,o=r.array;for(i=this.t-1;i>=0;--i)o[i+t]=n[i];for(i=t-1;i>=0;--i)o[i]=0;r.t=this.t+t,r.s=this.s}function bnpDRShiftTo(t,r){for(var i=this.array,n=r.array,o=t;o<this.t;++o)n[o-t]=i[o];r.t=Math.max(this.t-t,0),r.s=this.s}function bnpLShiftTo(t,r){var i,n=this.array,o=r.array,e=t%BI_DB,s=BI_DB-e,a=(1<<s)-1,h=Math.floor(t/BI_DB),p=this.s<<e&BI_DM;for(i=this.t-1;i>=0;--i)o[i+h+1]=n[i]>>s|p,p=(n[i]&a)<<e;for(i=h-1;i>=0;--i)o[i]=0;o[h]=p,r.t=this.t+h+1,r.s=this.s,r.clamp()}function bnpRShiftTo(t,r){var i=this.array,n=r.array;r.s=this.s;var o=Math.floor(t/BI_DB);if(o>=this.t)return void(r.t=0);var e=t%BI_DB,s=BI_DB-e,a=(1<<e)-1;n[0]=i[o]>>e;for(var h=o+1;h<this.t;++h)n[h-o-1]|=(i[h]&a)<<s,n[h-o]=i[h]>>e;e>0&&(n[this.t-o-1]|=(this.s&a)<<s),r.t=this.t-o,r.clamp()}function bnpSubTo(t,r){for(var i=this.array,n=r.array,o=t.array,e=0,s=0,a=Math.min(t.t,this.t);a>e;)s+=i[e]-o[e],n[e++]=s&BI_DM,s>>=BI_DB;if(t.t<this.t){for(s-=t.s;e<this.t;)s+=i[e],n[e++]=s&BI_DM,s>>=BI_DB;s+=this.s}else{for(s+=this.s;e<t.t;)s-=o[e],n[e++]=s&BI_DM,s>>=BI_DB;s-=t.s}r.s=0>s?-1:0,-1>s?n[e++]=BI_DV+s:s>0&&(n[e++]=s),r.t=e,r.clamp()}function bnpMultiplyTo(t,r){var i=(this.array,r.array),n=this.abs(),o=t.abs(),e=o.array,s=n.t;for(r.t=s+o.t;--s>=0;)i[s]=0;for(s=0;s<o.t;++s)i[s+n.t]=n.am(0,e[s],r,s,0,n.t);r.s=0,r.clamp(),this.s!=t.s&&BigInteger.ZERO.subTo(r,r)}function bnpSquareTo(t){for(var r=this.abs(),i=r.array,n=t.array,o=t.t=2*r.t;--o>=0;)n[o]=0;for(o=0;o<r.t-1;++o){var e=r.am(o,i[o],t,2*o,0,1);(n[o+r.t]+=r.am(o+1,2*i[o],t,2*o+1,e,r.t-o-1))>=BI_DV&&(n[o+r.t]-=BI_DV,n[o+r.t+1]=1)}t.t>0&&(n[t.t-1]+=r.am(o,i[o],t,2*o,0,1)),t.s=0,t.clamp()}function bnpDivRemTo(t,r,i){var n=t.abs();if(!(n.t<=0)){var o=this.abs();if(o.t<n.t)return null!=r&&r.fromInt(0),void(null!=i&&this.copyTo(i));null==i&&(i=nbi());var e=nbi(),s=this.s,a=t.s,h=n.array,p=BI_DB-nbits(h[n.t-1]);p>0?(n.lShiftTo(p,e),o.lShiftTo(p,i)):(n.copyTo(e),o.copyTo(i));var u=e.t,f=e.array,b=f[u-1];if(0!=b){var B=b*(1<<BI_F1)+(u>1?f[u-2]>>BI_F2:0),g=BI_FV/B,l=(1<<BI_F1)/B,m=1<<BI_F2,c=i.t,v=c-u,I=null==r?nbi():r;e.dlShiftTo(v,I);var y=i.array;for(i.compareTo(I)>=0&&(y[i.t++]=1,i.subTo(I,i)),BigInteger.ONE.dlShiftTo(u,I),I.subTo(e,e);e.t<u;)f[e.t++]=0;for(;--v>=0;){var T=y[--c]==b?BI_DM:Math.floor(y[c]*g+(y[c-1]+m)*l);if((y[c]+=e.am(0,T,i,v,0,u))<T)for(e.dlShiftTo(v,I),i.subTo(I,i);y[c]<--T;)i.subTo(I,i)}null!=r&&(i.drShiftTo(u,r),s!=a&&BigInteger.ZERO.subTo(r,r)),i.t=u,i.clamp(),p>0&&i.rShiftTo(p,i),0>s&&BigInteger.ZERO.subTo(i,i)}}}function bnMod(t){var r=nbi();return this.abs().divRemTo(t,null,r),this.s<0&&r.compareTo(BigInteger.ZERO)>0&&t.subTo(r,r),r}function Classic(t){this.m=t}function cConvert(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}function cRevert(t){return t}function cReduce(t){t.divRemTo(this.m,null,t)}function cMulTo(t,r,i){t.multiplyTo(r,i),this.reduce(i)}function cSqrTo(t,r){t.squareTo(r),this.reduce(r)}function bnpInvDigit(){var t=this.array;if(this.t<1)return 0;var r=t[0];if(0==(1&r))return 0;var i=3&r;return i=i*(2-(15&r)*i)&15,i=i*(2-(255&r)*i)&255,i=i*(2-((65535&r)*i&65535))&65535,i=i*(2-r*i%BI_DV)%BI_DV,i>0?BI_DV-i:-i}function Montgomery(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<BI_DB-15)-1,this.mt2=2*t.t}function montConvert(t){var r=nbi();return t.abs().dlShiftTo(this.m.t,r),r.divRemTo(this.m,null,r),t.s<0&&r.compareTo(BigInteger.ZERO)>0&&this.m.subTo(r,r),r}function montRevert(t){var r=nbi();return t.copyTo(r),this.reduce(r),r}function montReduce(t){for(var r=t.array;t.t<=this.mt2;)r[t.t++]=0;for(var i=0;i<this.m.t;++i){var n=32767&r[i],o=n*this.mpl+((n*this.mph+(r[i]>>15)*this.mpl&this.um)<<15)&BI_DM;for(n=i+this.m.t,r[n]+=this.m.am(0,o,t,i,0,this.m.t);r[n]>=BI_DV;)r[n]-=BI_DV,r[++n]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)}function montSqrTo(t,r){t.squareTo(r),this.reduce(r)}function montMulTo(t,r,i){t.multiplyTo(r,i),this.reduce(i)}function bnpIsEven(){var t=this.array;return 0==(this.t>0?1&t[0]:this.s)}function bnpExp(t,r){if(t>4294967295||1>t)return BigInteger.ONE;var i=nbi(),n=nbi(),o=r.convert(this),e=nbits(t)-1;for(o.copyTo(i);--e>=0;)if(r.sqrTo(i,n),(t&1<<e)>0)r.mulTo(n,o,i);else{var s=i;i=n,n=s}return r.revert(i)}function bnModPowInt(t,r){var i;return i=256>t||r.isEven()?new Classic(r):new Montgomery(r),this.exp(t,i)}function bnClone(){var t=nbi();return this.copyTo(t),t}function bnIntValue(){var t=this.array;if(this.s<0){if(1==this.t)return t[0]-BI_DV;if(0==this.t)return-1}else{if(1==this.t)return t[0];if(0==this.t)return 0}return(t[1]&(1<<32-BI_DB)-1)<<BI_DB|t[0]}function bnByteValue(){var t=this.array;return 0==this.t?this.s:t[0]<<24>>24}function bnShortValue(){var t=this.array;return 0==this.t?this.s:t[0]<<16>>16}function bnpChunkSize(t){return Math.floor(Math.LN2*BI_DB/Math.log(t))}function bnSigNum(){var t=this.array;return this.s<0?-1:this.t<=0||1==this.t&&t[0]<=0?0:1}function bnpToRadix(t){if(null==t&&(t=10),0==this.signum()||2>t||t>36)return"0";var r=this.chunkSize(t),i=Math.pow(t,r),n=nbv(i),o=nbi(),e=nbi(),s="";for(this.divRemTo(n,o,e);o.signum()>0;)s=(i+e.intValue()).toString(t).substr(1)+s,o.divRemTo(n,o,e);return e.intValue().toString(t)+s}function bnpFromRadix(t,r){this.fromInt(0),null==r&&(r=10);for(var i=this.chunkSize(r),n=Math.pow(r,i),o=!1,e=0,s=0,a=0;a<t.length;++a){var h=intAt(t,a);0>h?"-"==t.charAt(a)&&0==this.signum()&&(o=!0):(s=r*s+h,++e>=i&&(this.dMultiply(n),this.dAddOffset(s,0),e=0,s=0))}e>0&&(this.dMultiply(Math.pow(r,e)),this.dAddOffset(s,0)),o&&BigInteger.ZERO.subTo(this,this)}function bnpFromNumber(t,r,i){if("number"==typeof r)if(2>t)this.fromInt(1);else for(this.fromNumber(t,i),this.testBit(t-1)||this.bitwiseTo(BigInteger.ONE.shiftLeft(t-1),op_or,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(r);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(BigInteger.ONE.shiftLeft(t-1),this);else{var n=new Array,o=7&t;n.length=(t>>3)+1,r.nextBytes(n),o>0?n[0]&=(1<<o)-1:n[0]=0,this.fromString(n,256)}}function bnToByteArray(){var t=this.array,r=this.t,i=new Array;i[0]=this.s;var n,o=BI_DB-r*BI_DB%8,e=0;if(r-->0)for(BI_DB>o&&(n=t[r]>>o)!=(this.s&BI_DM)>>o&&(i[e++]=n|this.s<<BI_DB-o);r>=0;)8>o?(n=(t[r]&(1<<o)-1)<<8-o,n|=t[--r]>>(o+=BI_DB-8)):(n=t[r]>>(o-=8)&255,0>=o&&(o+=BI_DB,--r)),0!=(128&n)&&(n|=-256),0==e&&(128&this.s)!=(128&n)&&++e,(e>0||n!=this.s)&&(i[e++]=n);return i}function bnEquals(t){return 0==this.compareTo(t)}function bnMin(t){return this.compareTo(t)<0?this:t}function bnMax(t){return this.compareTo(t)>0?this:t}function bnpBitwiseTo(t,r,i){var n,o,e=this.array,s=t.array,a=i.array,h=Math.min(t.t,this.t);for(n=0;h>n;++n)a[n]=r(e[n],s[n]);if(t.t<this.t){for(o=t.s&BI_DM,n=h;n<this.t;++n)a[n]=r(e[n],o);i.t=this.t}else{for(o=this.s&BI_DM,n=h;n<t.t;++n)a[n]=r(o,s[n]);i.t=t.t}i.s=r(this.s,t.s),i.clamp()}function op_and(t,r){return t&r}function bnAnd(t){var r=nbi();return this.bitwiseTo(t,op_and,r),r}function op_or(t,r){return t|r}function bnOr(t){var r=nbi();return this.bitwiseTo(t,op_or,r),r}function op_xor(t,r){return t^r}function bnXor(t){var r=nbi();return this.bitwiseTo(t,op_xor,r),r}function op_andnot(t,r){return t&~r}function bnAndNot(t){var r=nbi();return this.bitwiseTo(t,op_andnot,r),r}function bnNot(){for(var t=this.array,r=nbi(),i=r.array,n=0;n<this.t;++n)i[n]=BI_DM&~t[n];return r.t=this.t,r.s=~this.s,r}function bnShiftLeft(t){var r=nbi();return 0>t?this.rShiftTo(-t,r):this.lShiftTo(t,r),r}function bnShiftRight(t){var r=nbi();return 0>t?this.lShiftTo(-t,r):this.rShiftTo(t,r),r}function lbit(t){if(0==t)return-1;var r=0;return 0==(65535&t)&&(t>>=16,r+=16),0==(255&t)&&(t>>=8,r+=8),0==(15&t)&&(t>>=4,r+=4),0==(3&t)&&(t>>=2,r+=2),0==(1&t)&&++r,r}function bnGetLowestSetBit(){for(var t=this.array,r=0;r<this.t;++r)if(0!=t[r])return r*BI_DB+lbit(t[r]);return this.s<0?this.t*BI_DB:-1}function cbit(t){for(var r=0;0!=t;)t&=t-1,++r;return r}function bnBitCount(){for(var t=this.array,r=0,i=this.s&BI_DM,n=0;n<this.t;++n)r+=cbit(t[n]^i);return r}function bnTestBit(t){var r=this.array,i=Math.floor(t/BI_DB);return i>=this.t?0!=this.s:0!=(r[i]&1<<t%BI_DB)}function bnpChangeBit(t,r){var i=BigInteger.ONE.shiftLeft(t);return this.bitwiseTo(i,r,i),i}function bnSetBit(t){return this.changeBit(t,op_or)}function bnClearBit(t){return this.changeBit(t,op_andnot)}function bnFlipBit(t){return this.changeBit(t,op_xor)}function bnpAddTo(t,r){for(var i=this.array,n=t.array,o=r.array,e=0,s=0,a=Math.min(t.t,this.t);a>e;)s+=i[e]+n[e],o[e++]=s&BI_DM,s>>=BI_DB;if(t.t<this.t){for(s+=t.s;e<this.t;)s+=i[e],o[e++]=s&BI_DM,s>>=BI_DB;s+=this.s}else{for(s+=this.s;e<t.t;)s+=n[e],o[e++]=s&BI_DM,s>>=BI_DB;s+=t.s}r.s=0>s?-1:0,s>0?o[e++]=s:-1>s&&(o[e++]=BI_DV+s),r.t=e,r.clamp()}function bnAdd(t){var r=nbi();return this.addTo(t,r),r}function bnSubtract(t){var r=nbi();return this.subTo(t,r),r}function bnMultiply(t){var r=nbi();return this.multiplyTo(t,r),r}function bnDivide(t){var r=nbi();return this.divRemTo(t,r,null),r}function bnRemainder(t){var r=nbi();return this.divRemTo(t,null,r),r}function bnDivideAndRemainder(t){var r=nbi(),i=nbi();return this.divRemTo(t,r,i),new Array(r,i)}function bnpDMultiply(t){var r=this.array;r[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}function bnpDAddOffset(t,r){for(var i=this.array;this.t<=r;)i[this.t++]=0;for(i[r]+=t;i[r]>=BI_DV;)i[r]-=BI_DV,++r>=this.t&&(i[this.t++]=0),++i[r]}function NullExp(){}function nNop(t){return t}function nMulTo(t,r,i){t.multiplyTo(r,i)}function nSqrTo(t,r){t.squareTo(r)}function bnPow(t){return this.exp(t,new NullExp)}function bnpMultiplyLowerTo(t,r,i){var n=i.array,o=t.array,e=Math.min(this.t+t.t,r);for(i.s=0,i.t=e;e>0;)n[--e]=0;var s;for(s=i.t-this.t;s>e;++e)n[e+this.t]=this.am(0,o[e],i,e,0,this.t);for(s=Math.min(t.t,r);s>e;++e)this.am(0,o[e],i,e,0,r-e);i.clamp()}function bnpMultiplyUpperTo(t,r,i){var n=i.array,o=t.array;--r;var e=i.t=this.t+t.t-r;for(i.s=0;--e>=0;)n[e]=0;for(e=Math.max(r-this.t,0);e<t.t;++e)n[this.t+e-r]=this.am(r-e,o[e],i,0,0,this.t+e-r);i.clamp(),i.drShiftTo(1,i)}function Barrett(t){this.r2=nbi(),this.q3=nbi(),BigInteger.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}function barrettConvert(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var r=nbi();return t.copyTo(r),this.reduce(r),r}function barrettRevert(t){return t}function barrettReduce(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)}function barrettSqrTo(t,r){t.squareTo(r),this.reduce(r)}function barrettMulTo(t,r,i){t.multiplyTo(r,i),this.reduce(i)}function bnModPow(t,r){var i,n,o=t.array,e=t.bitLength(),s=nbv(1);if(0>=e)return s;i=18>e?1:48>e?3:144>e?4:768>e?5:6,n=8>e?new Classic(r):r.isEven()?new Barrett(r):new Montgomery(r);var a=new Array,h=3,p=i-1,u=(1<<i)-1;if(a[1]=n.convert(this),i>1){var f=nbi();for(n.sqrTo(a[1],f);u>=h;)a[h]=nbi(),n.mulTo(f,a[h-2],a[h]),h+=2}var b,B,g=t.t-1,l=!0,m=nbi();for(e=nbits(o[g])-1;g>=0;){for(e>=p?b=o[g]>>e-p&u:(b=(o[g]&(1<<e+1)-1)<<p-e,g>0&&(b|=o[g-1]>>BI_DB+e-p)),h=i;0==(1&b);)b>>=1,--h;if((e-=h)<0&&(e+=BI_DB,--g),l)a[b].copyTo(s),l=!1;else{for(;h>1;)n.sqrTo(s,m),n.sqrTo(m,s),h-=2;h>0?n.sqrTo(s,m):(B=s,s=m,m=B),n.mulTo(m,a[b],s)}for(;g>=0&&0==(o[g]&1<<e);)n.sqrTo(s,m),B=s,s=m,m=B,--e<0&&(e=BI_DB-1,--g)}return n.revert(s)}function bnGCD(t){var r=this.s<0?this.negate():this.clone(),i=t.s<0?t.negate():t.clone();if(r.compareTo(i)<0){var n=r;r=i,i=n}var o=r.getLowestSetBit(),e=i.getLowestSetBit();if(0>e)return r;for(e>o&&(e=o),e>0&&(r.rShiftTo(e,r),i.rShiftTo(e,i));r.signum()>0;)(o=r.getLowestSetBit())>0&&r.rShiftTo(o,r),(o=i.getLowestSetBit())>0&&i.rShiftTo(o,i),r.compareTo(i)>=0?(r.subTo(i,r),r.rShiftTo(1,r)):(i.subTo(r,i),i.rShiftTo(1,i));return e>0&&i.lShiftTo(e,i),i}function bnpModInt(t){var r=this.array;if(0>=t)return 0;var i=BI_DV%t,n=this.s<0?t-1:0;if(this.t>0)if(0==i)n=r[0]%t;else for(var o=this.t-1;o>=0;--o)n=(i*n+r[o])%t;return n}function bnModInverse(t){var r=t.isEven();if(this.isEven()&&r||0==t.signum())return BigInteger.ZERO;for(var i=t.clone(),n=this.clone(),o=nbv(1),e=nbv(0),s=nbv(0),a=nbv(1);0!=i.signum();){for(;i.isEven();)i.rShiftTo(1,i),r?(o.isEven()&&e.isEven()||(o.addTo(this,o),e.subTo(t,e)),o.rShiftTo(1,o)):e.isEven()||e.subTo(t,e),e.rShiftTo(1,e);for(;n.isEven();)n.rShiftTo(1,n),r?(s.isEven()&&a.isEven()||(s.addTo(this,s),a.subTo(t,a)),s.rShiftTo(1,s)):a.isEven()||a.subTo(t,a),a.rShiftTo(1,a);i.compareTo(n)>=0?(i.subTo(n,i),r&&o.subTo(s,o),e.subTo(a,e)):(n.subTo(i,n),r&&s.subTo(o,s),a.subTo(e,a))}return 0!=n.compareTo(BigInteger.ONE)?BigInteger.ZERO:a.compareTo(t)>=0?a.subtract(t):a.signum()<0?(a.addTo(t,a),a.signum()<0?a.add(t):a):a}function bnIsProbablePrime(t){var r,i=this.abs(),n=i.array;if(1==i.t&&n[0]<=lowprimes[lowprimes.length-1]){for(r=0;r<lowprimes.length;++r)if(n[0]==lowprimes[r])return!0;return!1}if(i.isEven())return!1;for(r=1;r<lowprimes.length;){for(var o=lowprimes[r],e=r+1;e<lowprimes.length&&lplim>o;)o*=lowprimes[e++];for(o=i.modInt(o);e>r;)if(o%lowprimes[r++]==0)return!1}return i.millerRabin(t)}function bnpMillerRabin(t){var r=this.subtract(BigInteger.ONE),i=r.getLowestSetBit();if(0>=i)return!1;var n=r.shiftRight(i);t=t+1>>1,t>lowprimes.length&&(t=lowprimes.length);for(var o=nbi(),e=0;t>e;++e){o.fromInt(lowprimes[e]);var s=o.modPow(n,this);if(0!=s.compareTo(BigInteger.ONE)&&0!=s.compareTo(r)){for(var a=1;a++<i&&0!=s.compareTo(r);)if(s=s.modPowInt(2,this),0==s.compareTo(BigInteger.ONE))return!1;if(0!=s.compareTo(r))return!1}}return!0}var dbits=26,BI_DB=dbits,BI_DM=(1<<dbits)-1,BI_DV=1<<dbits,BI_FP=52,BI_FV=Math.pow(2,BI_FP),BI_F1=BI_FP-dbits,BI_F2=2*dbits-BI_FP;BigInteger=module.exports.BigInteger=function(t,r,i){this.array=new Array,null!=t&&("number"==typeof t?this.fromNumber(t,r,i):null==r&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,r))};var BI_RM="0123456789abcdefghijklmnopqrstuvwxyz",BI_RC=new Array,rr,vv;for(rr="0".charCodeAt(0),vv=0;9>=vv;++vv)BI_RC[rr++]=vv;for(rr="a".charCodeAt(0),vv=10;36>vv;++vv)BI_RC[rr++]=vv;for(rr="A".charCodeAt(0),vv=10;36>vv;++vv)BI_RC[rr++]=vv;Classic.prototype.convert=cConvert,Classic.prototype.revert=cRevert,Classic.prototype.reduce=cReduce,Classic.prototype.mulTo=cMulTo,Classic.prototype.sqrTo=cSqrTo,Montgomery.prototype.convert=montConvert,Montgomery.prototype.revert=montRevert,Montgomery.prototype.reduce=montReduce,Montgomery.prototype.mulTo=montMulTo,Montgomery.prototype.sqrTo=montSqrTo,BigInteger.prototype.copyTo=bnpCopyTo,BigInteger.prototype.fromInt=bnpFromInt,BigInteger.prototype.fromString=bnpFromString,BigInteger.prototype.clamp=bnpClamp,BigInteger.prototype.dlShiftTo=bnpDLShiftTo,BigInteger.prototype.drShiftTo=bnpDRShiftTo,BigInteger.prototype.lShiftTo=bnpLShiftTo,BigInteger.prototype.rShiftTo=bnpRShiftTo,BigInteger.prototype.subTo=bnpSubTo,BigInteger.prototype.multiplyTo=bnpMultiplyTo,BigInteger.prototype.squareTo=bnpSquareTo,BigInteger.prototype.divRemTo=bnpDivRemTo,BigInteger.prototype.invDigit=bnpInvDigit,BigInteger.prototype.isEven=bnpIsEven,BigInteger.prototype.exp=bnpExp,BigInteger.prototype.toString=bnToString,BigInteger.prototype.negate=bnNegate,BigInteger.prototype.abs=bnAbs,BigInteger.prototype.compareTo=bnCompareTo,BigInteger.prototype.bitLength=bnBitLength,BigInteger.prototype.mod=bnMod,BigInteger.prototype.modPowInt=bnModPowInt,BigInteger.ZERO=nbv(0),BigInteger.ONE=nbv(1),NullExp.prototype.convert=nNop,NullExp.prototype.revert=nNop,NullExp.prototype.mulTo=nMulTo,NullExp.prototype.sqrTo=nSqrTo,Barrett.prototype.convert=barrettConvert,Barrett.prototype.revert=barrettRevert,Barrett.prototype.reduce=barrettReduce,Barrett.prototype.mulTo=barrettMulTo,Barrett.prototype.sqrTo=barrettSqrTo;var lowprimes=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],lplim=(1<<26)/lowprimes[lowprimes.length-1];BigInteger.prototype.chunkSize=bnpChunkSize,BigInteger.prototype.toRadix=bnpToRadix,BigInteger.prototype.fromRadix=bnpFromRadix,BigInteger.prototype.fromNumber=bnpFromNumber,BigInteger.prototype.bitwiseTo=bnpBitwiseTo,BigInteger.prototype.changeBit=bnpChangeBit,BigInteger.prototype.addTo=bnpAddTo,BigInteger.prototype.dMultiply=bnpDMultiply,BigInteger.prototype.dAddOffset=bnpDAddOffset,BigInteger.prototype.multiplyLowerTo=bnpMultiplyLowerTo,BigInteger.prototype.multiplyUpperTo=bnpMultiplyUpperTo,BigInteger.prototype.modInt=bnpModInt,BigInteger.prototype.millerRabin=bnpMillerRabin,BigInteger.prototype.clone=bnClone,BigInteger.prototype.intValue=bnIntValue,BigInteger.prototype.byteValue=bnByteValue,BigInteger.prototype.shortValue=bnShortValue,BigInteger.prototype.signum=bnSigNum,BigInteger.prototype.toByteArray=bnToByteArray,BigInteger.prototype.equals=bnEquals,BigInteger.prototype.min=bnMin,BigInteger.prototype.max=bnMax,BigInteger.prototype.and=bnAnd,BigInteger.prototype.or=bnOr,BigInteger.prototype.xor=bnXor,BigInteger.prototype.andNot=bnAndNot,BigInteger.prototype.not=bnNot,BigInteger.prototype.shiftLeft=bnShiftLeft,BigInteger.prototype.shiftRight=bnShiftRight,BigInteger.prototype.getLowestSetBit=bnGetLowestSetBit,BigInteger.prototype.bitCount=bnBitCount,BigInteger.prototype.testBit=bnTestBit,BigInteger.prototype.setBit=bnSetBit,BigInteger.prototype.clearBit=bnClearBit,BigInteger.prototype.flipBit=bnFlipBit,BigInteger.prototype.add=bnAdd,BigInteger.prototype.subtract=bnSubtract,BigInteger.prototype.multiply=bnMultiply,BigInteger.prototype.divide=bnDivide,BigInteger.prototype.remainder=bnRemainder,BigInteger.prototype.divideAndRemainder=bnDivideAndRemainder,BigInteger.prototype.modPow=bnModPow,BigInteger.prototype.modInverse=bnModInverse,BigInteger.prototype.pow=bnPow,BigInteger.prototype.gcd=bnGCD,BigInteger.prototype.isProbablePrime=bnIsProbablePrime,BigInteger.prototype.am=am4;
},{}],126:[function(require,module,exports){
var util=require("util"),sprintf=function(){function r(r){return Object.prototype.toString.call(r).slice(8,-1).toLowerCase()}function e(r,e){for(var t=[];e>0;t[--e]=r);return t.join("")}var t=function(){return t.cache.hasOwnProperty(arguments[0])||(t.cache[arguments[0]]=t.parse(arguments[0])),t.format.call(null,t.cache[arguments[0]],arguments)};return t.object_stringify=function(r,e,n,i){var s="";if(null!=r)switch(typeof r){case"function":return"[Function"+(r.name?": "+r.name:"")+"]";case"object":if(r instanceof Error)return"["+r.toString()+"]";if(e>=n)return"[Object]";if(i&&(i=i.slice(0),i.push(r)),null!=r.length){s+="[";var a=[];for(var o in r)a.push(i&&i.indexOf(r[o])>=0?"[Circular]":t.object_stringify(r[o],e+1,n,i));s+=a.join(", ")+"]"}else{if("getMonth"in r)return"Date("+r+")";s+="{";var a=[];for(var f in r)r.hasOwnProperty(f)&&a.push(i&&i.indexOf(r[f])>=0?f+": [Circular]":f+": "+t.object_stringify(r[f],e+1,n,i));s+=a.join(", ")+"}"}return s;case"string":return'"'+r+'"'}return""+r},t.format=function(n,i){var s,a,o,f,u,c,p,l=1,h=n.length,g="",b=[];for(a=0;h>a;a++)if(g=r(n[a]),"string"===g)b.push(n[a]);else if("array"===g){if(f=n[a],f[2])for(s=i[l],o=0;o<f[2].length;o++){if(!s.hasOwnProperty(f[2][o]))throw new Error(sprintf('[sprintf] property "%s" does not exist',f[2][o]));s=s[f[2][o]]}else s=f[1]?i[f[1]]:i[l++];if(/[^sO]/.test(f[8])&&"number"!=r(s))throw new Error(sprintf('[sprintf] expecting number but found %s "'+s+'"',r(s)));switch(f[8]){case"b":s=s.toString(2);break;case"c":s=String.fromCharCode(s);break;case"d":s=parseInt(s,10);break;case"e":s=f[7]?s.toExponential(f[7]):s.toExponential();break;case"f":s=f[7]?parseFloat(s).toFixed(f[7]):parseFloat(s);break;case"O":s=t.object_stringify(s,0,parseInt(f[7])||5);break;case"o":s=s.toString(8);break;case"s":s=(s=String(s))&&f[7]?s.substring(0,f[7]):s;break;case"u":s=Math.abs(s);break;case"x":s=s.toString(16);break;case"X":s=s.toString(16).toUpperCase()}s=/[def]/.test(f[8])&&f[3]&&s>=0?"+"+s:s,c=f[4]?"0"==f[4]?"0":f[4].charAt(1):" ",p=f[6]-String(s).length,u=f[6]?e(c,p):"",b.push(f[5]?s+u:u+s)}return b.join("")},t.cache={},t.parse=function(r){for(var e=r,t=[],n=[],i=0;e;){if(null!==(t=/^[^\x25]+/.exec(e)))n.push(t[0]);else if(null!==(t=/^\x25{2}/.exec(e)))n.push("%");else{if(null===(t=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosOuxX])/.exec(e)))throw new Error("[sprintf] "+e);if(t[2]){i|=1;var s=[],a=t[2],o=[];if(null===(o=/^([a-z_][a-z_\d]*)/i.exec(a)))throw new Error("[sprintf] "+a);for(s.push(o[1]);""!==(a=a.substring(o[0].length));)if(null!==(o=/^\.([a-z_][a-z_\d]*)/i.exec(a)))s.push(o[1]);else{if(null===(o=/^\[(\d+)\]/.exec(a)))throw new Error("[sprintf] "+a);s.push(o[1])}t[2]=s}else i|=2;if(3===i)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n.push(t)}e=e.substring(t[0].length)}return n},t}(),vsprintf=function(r,e){var t=e.slice();return t.unshift(r),sprintf.apply(null,t)};module.exports=sprintf,sprintf.sprintf=sprintf,sprintf.vsprintf=vsprintf;
},{"util":117}],127:[function(require,module,exports){
"use strict";exports.htons=function(t,o,r){t[o]=255&r>>8,t[o+1]=255&r},exports.ntohs=function(t,o){return(255&t[o])<<8|255&t[o+1]},exports.ntohsStr=function(t,o){return(255&t.charCodeAt(o))<<8|255&t.charCodeAt(o+1)},exports.htonl=function(t,o,r){t[o]=255&r>>24,t[o+1]=255&r>>16,t[o+2]=255&r>>8,t[o+3]=255&r},exports.ntohl=function(t,o){return(255&t[o])<<24|(255&t[o+1])<<16|(255&t[o+2])<<8|255&t[o+3]},exports.ntohlStr=function(t,o){return(255&t.charCodeAt(o))<<24|(255&t.charCodeAt(o+1))<<16|(255&t.charCodeAt(o+2))<<8|255&t.charCodeAt(o+3)};
},{}],128:[function(require,module,exports){
module.exports=function(){var r=Error.prepareStackTrace;Error.prepareStackTrace=function(r,e){return e};var e=new Error;Error.captureStackTrace(e,arguments.callee);var a=e.stack;return Error.prepareStackTrace=r,a};
},{}],129:[function(require,module,exports){
(function(e,r){var t=require("path"),o=require("callsite"),i=module.paths,s=module.filename;module.exports=function(e){return e.inherit=function(e){arguments.length>1&&e.inherit(Array.prototype.slice.call(arguments,1)),this.super_=e,this.prototype.__proto__=e.prototype,this.__proto__=e},e.super=function(e,r,t){return this.super_?"string"==typeof r?this.super_.prototype[r].apply(e,t):this.super_.apply(e,r):void 0},e.default=function(){return this._default||(this._default=new this),this._default},e.parent&&e.inherit(e.parent),e};var n=function(e,n){if("./"==e.slice(0,2)||"../"==e.slice(0,3)){var u=o()[1].getFileName();e=t.resolve(t.dirname(u),e)}module.paths=module.parent.paths,module.filename=module.parent.filename,e=require.resolve(e),module.paths=i,module.filename=s;var a=require.cache[e];a&&delete require.cache[e],r._imports=n;var l=require(e);return delete require.cache[e],a&&(require.cache[e]=a),l},u=function(e,t){r._imports=t;var o;try{o=require("!"+e)}catch(i){throw console.log("SOOP:"+i.message+"\nNote that SOOP requires a custom browserify configuration. please check soop's readme"),i}return o};module.exports.load=e.versions?n:u,module.exports.imports=function(){var e=r._imports||{};return r._imports={},e}}).call(this,require("/Users/ryanxcharles/dev/bitcore/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});
},{"/Users/ryanxcharles/dev/bitcore/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":101,"callsite":128,"path":102}],130:[function(require,module,exports){
(function(n){function e(){function e(){if(0!==a.length){var n=a.shift();t=r=0,o=[];try{u=!0;var l=n.apply(e,arguments)}catch(s){e(s)}void 0!==l&&e(void 0,l),u=!1}else if(arguments[0])throw arguments[0]}var r,t,o,u,a=Array.prototype.slice.call(arguments);e.parallel=function(){function a(){0===r&&e.apply(null,o)}var l=1+t++;return r++,n.nextTick(a),function(){r--,arguments[0]&&(o[0]=arguments[0]),o[l]=arguments[1],u||a()}},e.group=function(){function r(){0===a&&t(s,l)}var t=e.parallel(),o=0,a=0,l=[],s=void 0;return n.nextTick(r),function(){var n=o++;return a++,function(){a--,arguments[0]&&(s=arguments[0]),l[n]=arguments[1],u||r()}}},e()}e.fn=function(){var n=Array.prototype.slice.call(arguments);return function(){var r=Array.prototype.slice.call(arguments),t=[function(){this.apply(null,r)}].concat(n);"function"==typeof r[r.length-1]&&t.push(r.pop()),e.apply(null,t)}},"undefined"!=typeof module&&"exports"in module&&(module.exports=e)}).call(this,require("/Users/ryanxcharles/dev/bitcore/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"));
},{"/Users/ryanxcharles/dev/bitcore/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":101}],"./patches/Buffers.monkey":[function(require,module,exports){
module.exports=require('kytKTK');
},{}],"kytKTK":[function(require,module,exports){
(function(f){exports.patch=function(t){t.prototype.skip=function(t){if(0!=t){if(t==this.length)return this.buffers=[],void(this.length=0);var s=this.pos(t);this.buffers=this.buffers.slice(s.buf),this.buffers[0]=new f(this.buffers[0].slice(s.offset)),this.length-=t}}}}).call(this,require("buffer").Buffer);
},{"buffer":85}],"./patches/Number.monkey":[function(require,module,exports){
module.exports=require('AwmEwz');
},{}],"AwmEwz":[function(require,module,exports){
exports.patch=function(t){t.prototype.round=function(t){if(!t)return Math.round(this);var r=Math.pow(10,t);return Math.round(this*r)/r}};
},{}],"./util/BinaryParser":[function(require,module,exports){
module.exports=require('b3ZSD7');
},{}],"b3ZSD7":[function(require,module,exports){
(function(t){function r(t){this.subject=t,this.pos=0}function o(t){for(var r=0,o=0;o<t.length;o++)r+=Math.pow(256,o)*t[o];return r}function e(t){for(var r=0,o=0;o<t.length;o++)r+=Math.pow(256,t.length-o-1)*t[o];return r}function s(t){var r=e(t);return 128==(128&t[0])&&(r-=Math.pow(256,t.length)),r}function n(t){var r=o(t);return 128==(128&t[t.length-1])&&(r-=Math.pow(256,t.length)),r}function i(t,r){return function(){var o=this.buffer(t);return r(o)}}require("soop").imports();r.prototype.buffer=function(t){var r=this.subject.slice(this.pos,this.pos+t);return this.pos+=t,r},r.prototype.search=function(r){var o;if("string"==typeof r||t.isBuffer(r))return o=this.subject.slice(this.pos).indexOf(r),-1!==o&&(this.pos+=o+r.length),o;if("number"==typeof r){r=255&r;for(var e=this.pos,s=this.subject.length;s>e;e++)if(this.subject[e]==r)return o=e-this.pos,this.pos=e+1,o;return-1}},r.prototype.scan=function(t){var r=this.pos,o=this.search(t);if(-1!==o)return this.subject.slice(r,r+o);throw new Error("No match")},r.prototype.eof=function(){return this.pos>=this.subject.length},[1,2,4,8].forEach(function(t){var p=8*t;r.prototype["word"+p+"le"]=r.prototype["word"+p+"lu"]=i(t,o),r.prototype["word"+p+"ls"]=i(t,n),r.prototype["word"+p+"be"]=r.prototype["word"+p+"bu"]=i(t,e),r.prototype["word"+p+"bs"]=i(t,s),r.prototype.word8=r.prototype.word8u=r.prototype.word8be,r.prototype.word8s=r.prototype.word8bs}),r.prototype.varInt=function(){var t=this.word8();switch(t){case 253:return this.word16le();case 254:return this.word32le();case 255:return this.word64le();default:return t}},r.prototype.varStr=function(){var t=this.varInt();return this.buffer(t)},module.exports=require("soop")(r)}).call(this,require("buffer").Buffer);
},{"buffer":85,"soop":129}],137:[function(require,module,exports){
var fs=require("fs"),crypto=require("crypto");exports.readFileSync=function(r,e,i){var t=fs.readFileSync(i,"binary");if(t.length<32)throw new Error("Crypted file "+i+" truncated");var a=t.slice(0,-32),n=t.slice(-32),c=crypto.createHmac("sha256",e);c.update(a);var y=c.digest("binary");if(y.toString()!=n.toString())throw new Error("Crypted file "+i+" failed HMAC checksum verification");var o=crypto.createDecipher(r,e),p=o.update(a,"binary","binary");return p+=o.final("binary")},exports.readJFileSync=function(r,e,i){var t=this.readFileSync(r,e,i);return JSON.parse(t)},exports.writeFileSync=function(r,e,i,t){var a=crypto.createCipher(r,e),n=a.update(t,"binary","binary");n+=a.final("binary");var c=crypto.createHmac("sha256",e);c.update(n);var y=c.digest("binary");return fs.writeFileSync(i,n+y,"binary"),!0},exports.writeJFileSync=function(r,e,i,t){var a=JSON.stringify(t);return this.writeFileSync(r,e,i,a)};
},{"crypto":89,"fs":81}],"./util/EncodedData":[function(require,module,exports){
module.exports=require('eLfUFE');
},{}],"eLfUFE":[function(require,module,exports){
(function(t){function n(t,n){this.data=t,this.__proto__=n||"string"!=typeof t?this.encodings[n||"binary"]:this.encodings.base58}var i=require("soop").imports(),r=i.base58||require("../lib/Base58").base58Check;n.prototype.encoding=function(t){return t&&t!=this._encoding&&(this.data=this.as(t),this.__proto__=this.encodings[t]),this._encoding},n.prototype.withEncoding=function(t){return new n(this.as(t),t)},n.prototype.as=function(t){if(!e[t])throw new Error("invalid encoding");return this.converters[t].call(this)},n.prototype._validate=function(){this.withEncoding("binary")},n.prototype.isValid=function(){try{return this.validate(),!0}catch(t){return!1}},n.prototype.validate=function(){this._validate()},n.prototype.isValid=function(){try{return this.validate(),!0}catch(t){return!1}},n.prototype.toString=function(){return this.as("base58")},n.prototype.doAsBinary=function(t){var n=this.encoding();this.encoding("binary"),t.apply(this),this.encoding(n)};var e={binary:{converters:{binary:function(){var n=new t(this.data.length);return this.data.copy(n),n},base58:function(){return r.encode(this.data)},hex:function(){return this.data.toString("hex")}},_validate:function(){}},base58:{converters:{binary:function(){return r.decode(this.data)},hex:function(){return this.withEncoding("binary").as("hex")}}},hex:{converters:{binary:function(){return new t(this.data,"hex")},base58:function(){return this.withEncoding("binary").as("base58")}}}},o=function(){return this.data};for(var a in e)e.hasOwnProperty(a)&&(e[a].converters[a]||(e[a].converters[a]=o),e[a]._encoding=a);n.applyEncodingsTo=function(t){var n={};for(var i in e){var r=e[i],o={};for(var a in r)o[a]=r[a];o.__proto__=t.prototype,n[i]=o}t.prototype.encodings=n},n.applyEncodingsTo(n),module.exports=require("soop")(n)}).call(this,require("buffer").Buffer);
},{"../lib/Base58":"6VqyzY","buffer":85,"soop":129}],"QLzNQg":[function(require,module,exports){
(function(t){function i(e,r){return"number"!=typeof e?void i.super(this,arguments):(this.data=new t(r.length+1),this.__proto__=this.encodings.binary,this.version(e),void this.payload(r))}var e=require("soop").imports(),r=(e.base58||require("../lib/Base58").base58Check,e.parent||require("./EncodedData"));i.parent=r,r.applyEncodingsTo(i),i.prototype.version=function(t){return t||0===t?(this.doAsBinary(function(){this.data.writeUInt8(t,0)}),t):this.as("binary").readUInt8(0)},i.prototype.payload=function(t){return t?(this.doAsBinary(function(){t.copy(this.data,1)}),t):this.as("binary").slice(1)},module.exports=require("soop")(i)}).call(this,require("buffer").Buffer);
},{"../lib/Base58":"6VqyzY","./EncodedData":"eLfUFE","buffer":85,"soop":129}],"./util/VersionedData":[function(require,module,exports){
module.exports=require('QLzNQg');
},{}],142:[function(require,module,exports){
function MissingSourceError(r,o){Error.call(this),this.message=r,this.missingTxHash=o,this.name="MissingSourceError"}function VerificationError(r,o){Error.call(this),this.message=r,this.missingTxHash=o,this.name="VerificationError"}MissingSourceError.prototype.__proto__=Error.prototype,exports.MissingSourceError=MissingSourceError,VerificationError.prototype.__proto__=Error.prototype,exports.VerificationError=VerificationError;
},{}],143:[function(require,module,exports){
module.exports=require("./util");
},{"./util":"ACyo5H"}],"./util/log":[function(require,module,exports){
module.exports=require('AdF7pF');
},{}],"AdF7pF":[function(require,module,exports){
"use strict";var noop=function(){},cl=function(){console.log(arguments)},loggers={none:{info:noop,warn:noop,err:noop,debug:noop},normal:{info:cl,warn:cl,err:cl,debug:noop},debug:{info:cl,warn:cl,err:cl,debug:cl}},config=require("../config");module.exports=config.log?config.log:loggers[config.logger||"normal"];
},{"../config":"4itQ50"}],146:[function(require,module,exports){
exports.curtime=function(){return Math.round(Date.now()/1e3)};
},{}],"./util/util":[function(require,module,exports){
module.exports=require('ACyo5H');
},{}],"ACyo5H":[function(require,module,exports){
(function(e,r){function t(e){for(e=e.substr(0,8);e.length<8;)e+="0";return e}function n(e){return s(e[1]).mul("100000000").add(t(e[2]))}function o(e){return s(t(e[1]))}function f(e){return s(e[1]).mul("100000000")}var u,i=require("crypto"),s=require("bignum"),a=require("binary"),c=require("bufferput"),l=require("buffertools"),h=require("../lib/sjcl"),p=!e.versions;p&&(u=require("../browser/vendor-bundle.js"));{var v=exports.sha256=function(e){return new r(i.createHash("sha256").update(e).digest("binary"),"binary")},d=(exports.sha512=function(e){if(p){var t=e.toString("hex"),n=h.codec.hex.toBits(t),o=h.hash.sha512.hash(n),f=h.codec.hex.fromBits(o),u=new r(f,"hex");return u}return new r(i.createHash("sha512").update(e).digest("binary"),"binary")},exports.sha512hmac=function(e,t){if(p){var n=h.codec.hex.toBits(t.toString("hex")),o=h.codec.hex.toBits(e.toString("hex")),f=new h.misc.hmac(n,h.hash.sha512),u=f.encrypt(o),s=h.codec.hex.fromBits(u),a=new r(s,"hex");return a}var f=i.createHmac("sha512",t),c=f.update(e).digest();return c},exports.ripe160=function(e){if(!r.isBuffer(e))throw new Error("arg should be a buffer");if(p){for(var t=new u.crypto31.lib.WordArray.init(Crypto.util.bytesToWords(e),e.length),n=u.crypto31.RIPEMD160(t),o=n.words,f=[],s=0;s<32*o.length;s+=8)f.push(o[s>>>5]>>>24-s%32&255);return new r(f,"hex")}return new r(i.createHash("rmd160").update(e).digest("binary"),"binary")}),g=(exports.sha1=function(e){return new r(i.createHash("sha1").update(e).digest("binary"),"binary")},exports.twoSha256=function(e){return v(v(e))},exports.sha256ripe160=function(e){return d(v(e))},exports.formatHash=function(e){var t=new r(10);return e.copy(t,0,22,32),l.reverse(t).toString("hex")},exports.formatHashFull=function(e){var t=new r(e.length);e.copy(t);var n=l.toHex(l.reverse(t));return n}),w=(exports.formatHashAlt=function(e){var r=g(e);return r=r.replace(/^0*/,""),r.substr(0,10)},exports.formatBuffer=function(e,t){null===t&&(t=10),(t>e.length||0===t)&&(t=e.length);var n=new r(t);e.copy(n,0,0,t);var o=l.toHex(n);return n.length<e.length&&(o+="..."),o},exports.valueToBigInt=function(e){return r.isBuffer(e)?s.fromBuffer(e,{endian:"little",size:8}):e});exports.bigIntToValue=function(e){return r.isBuffer(e)?e:e.toBuffer({endian:"little",size:8})}}exports.bytesNeededToStore=bytesNeededToStore=function(e){return 0===e?0:Math.ceil((e.toString(2).replace("-","").length+1)/8)},exports.negativeBuffer=negativeBuffer=function(e){for(var t=new r(e.length),n=0;n<e.length;n++)t[n]=~e[n],t[n]<0&&(t[n]+=256);for(var n=e.length-1;n>=0&&(t[n]+=1,t[n]>=256&&(t[n]-=256),0===t[n]);n--);return t},exports.intToBuffer2C=function(e){var r=bytesNeededToStore(e),t=new c,n=e.toString(16),o="-"===n[0];n=n.replace("-","");for(var f=0;r>f;f++){var u=n.substring(n.length-2*(f+1),n.length-2*f);1===u.lenght&&(u="0"+u);var i=parseInt(u,16);t.word8(i)}var s=t.buffer();return o&&(s=l.reverse(s),s=negativeBuffer(s),s=l.reverse(s)),s};var x=function(e){var t;return 128&e[0]?(t=new r(e.length+1),e.copy(t,1),t[0]=0):t=e,t};exports.intToBufferSM=function(e){"number"==typeof e&&(e=s(e));var t,n,o=e.cmp(0);return o>0?(t=e.toBuffer(),n=x(t),n=l.reverse(n)):0==o?n=new r([]):(t=e.neg().toBuffer(),n=x(t),n[0]|=128,n=l.reverse(n)),n},exports.bufferSMToInt=function(e){if(!e.length)return s(0);if(e.length>4)throw new Error("Bigint cast overflow (> 4 bytes)");var t=new r(e.length);e.copy(t),t=l.reverse(t);var n=128&t[0];return n?(t[0]&=127,s.fromBuffer(t).neg()):s.fromBuffer(t)};var b=(exports.formatValue=function(e){for(var r=w(e).toString(),t=r.length>8?r.substr(0,r.length-8):"0",n=r.length>8?r.substr(r.length-8):r;n.length<8;)n="0"+n;for(n=n.replace(/0*$/,"");n.length<2;)n+="0";return t+"."+n},/^\s*(\d+)\.(\d+)/),y=/^\s*\.(\d+)/,B=/^\s*(\d+)/;exports.parseValue=function(e){"string"!=typeof e&&(e=e.toString());var r=e.match(b);return r?n(r):(r=e.match(y))?o(r):(r=e.match(B),r?f(r):void 0)};{var m=(exports.createSynchrotron=function(e){var r={};return function(t){var n=Array.prototype.slice.call(arguments),o=function(){n[0]=function(){r[t]&&(r[t].length?r[t].shift()():delete r[t])},e.apply(null,n)};r[t]?r[t].push(o):(r[t]=[],o())}},exports.decodeDiffBits=function(e,t){e=+e;for(var n=s(16777215&e),o=8*((e>>>24)-3);o-->0;)n=n.mul(2);if(t)return n;var f=n.toBuffer(),u=new r(32);return l.fill(u,0),f.copy(u,32-f.length),u}),I=(exports.encodeDiffBits=function(e){if(r.isBuffer(e))e=s.fromBuffer(e);else if("function"!=typeof e.toBuffer)throw new Error("Incorrect variable type for difficulty");var t=e.toBuffer("mpint"),n=t.length-4,o=n<<24;return n>=1&&(o|=t[4]<<16),n>=2&&(o|=t[5]<<8),n>=3&&(o|=t[6]),o},exports.calcDifficulty=function(e){r.isBuffer(e)||(e=m(e));var t=s.fromBuffer(e,{order:"forward"}),n=s.fromBuffer(E,{order:"forward"});return n.div(t).toNumber()},exports.reverseBytes32=function(e){if(e.length%4)throw new Error("Util.reverseBytes32(): Data length must be multiple of 4");for(var r=new c,t=a.parse(e);!t.eof();){var n=t.word32le("word").vars.word;r.word32be(n)}return r.buffer()},exports.getVarIntSize=function(e){return 253>e?1:65536>e?3:4294967296>e?5:9},exports.varIntBuf=function(e){var t=void 0;return 253>e?(t=new r(1),t.writeUInt8(e,0)):65536>e?(t=new r(3),t.writeUInt8(253,0),t.writeUInt16LE(e,1)):4294967296>e?(t=new r(5),t.writeUInt8(254,0),t.writeUInt32LE(e,1)):(t=new r(9),t.writeUInt8(255,0),t.writeInt32LE(-1&e,1),t.writeUInt32LE(Math.floor(e/4294967296),5)),t});exports.varStrBuf=function(e){return r.concat([I(e.length),e])}}exports.NULL_HASH=l.fill(new r(32),0),exports.EMPTY_BUFFER=new r(0),exports.ZERO_VALUE=l.fill(new r(8),0);var S=new r("ffffffffffffffff","hex");exports.INT64_MAX=S,exports.COIN=1e8,exports.BIT=100;var E=exports.MAX_TARGET=new r("00000000FFFF0000000000000000000000000000000000000000000000000000","hex")}).call(this,require("/Users/ryanxcharles/dev/bitcore/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),require("buffer").Buffer);
},{"../browser/vendor-bundle.js":3,"../lib/sjcl":"oLMOpG","/Users/ryanxcharles/dev/bitcore/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":101,"bignum":58,"binary":74,"buffer":85,"bufferput":"aXRuS6","buffertools":"fugeBw","crypto":89}]},{},[])