!function(a){if("object"==typeofexports&&"undefined"!=typeofmodule)module.exports=a();elseif("function"==typeofdefine&&define.amd)define([],a);else{varb;b="undefined"!=typeofwindow?window:"undefined"!=typeofglobal?global:"undefined"!=typeofself?self:this,b.Wallet=a()}}(function(){vara;returnfunctionb(a,c,d){functione(g,h){if(!c[g]){if(!a[g]){vari="function"==typeofrequire&&require;if(!h&&i)returni(g,!0);if(f)returnf(g,!0);varj=newError("Cannot find module '"+g+"'");throwj.code="MODULE_NOT_FOUND",j}vark=c[g]={exports:{}};a[g][0].call(k.exports,function(b){varc=a[g][1][b];returne(c?c:b)},k,k.exports,b,a,c,d)}returnc[g].exports}for(varf="function"==typeofrequire&&require,g=0;g<d.length;g++)e(d[g]);returne}({1:[function(a,b,c){(function(c){"use strict";vard=a("rlp"),e=a("scrypt-js"),f=(a("./lib/contract.js"),a("./lib/providers.js")),g=a("./lib/secret-storage.js"),h=a("./lib/randomish.js"),i=a("./lib/signing-key.js"),j=a("./lib/wallet.js"),k=a("./lib/utils.js"),l=k.BN,m={};k.defineProperty(j,"utils",m),k.defineProperty(m,"BN",l),k.defineProperty(m,"Buffer",c),k.defineProperty(m,"sha3",k.sha3),k.defineProperty(m,"sha256",k.sha256),k.defineProperty(m,"getContractAddress",function(a){returni.getAddress("0x"+k.sha3(d.encode([k.hexOrBuffer(i.getAddress(a.from)),k.hexOrBuffer(k.hexlify(a.nonce,"nonce"))])).slice(12).toString("hex"))}),b.exports=j,k.defineProperty(j,"etherSymbol","𝝣"),k.defineProperty(j,"isCrowdsaleWallet",g.isCrowdsaleWallet),k.defineProperty(j,"isValidWallet",g.isValidWallet),k.defineProperty(j,"decryptCrowdsale",function(a,b){returnnewj(g.decryptCrowdsale(a,b))}),k.defineProperty(j,"decrypt",function(a,b,c){if("function"!=typeofc)thrownewError("invalid callback");g.decrypt(a,b,function(a,b,d){returnb?c(a,newj(b),d):c(a,b,d)})}),k.defineProperty(j.prototype,"encrypt",function(a,b,c){if("function"!=typeofb||c||(c=b,b={}),"function"!=typeofc)thrownewError("invalid callback");g.encrypt(this.privateKey,a,b,c)}),k.defineProperty(j,"summonBrainWallet",function(a,b,d){if("function"!=typeofd)thrownewError("invalid callback");e(b,a,1<<18,8,1,32,function(a,b,e){returne?d(a,newj(newc(e)),1):d(a,null,b)})}),k.defineProperty(j,"providers",f),k.defineProperty(j,"randomish",newh),b.exports=j}).call(this,a("buffer").Buffer)},{"./lib/contract.js":4,"./lib/providers.js":5,"./lib/randomish.js":6,"./lib/secret-storage.js":7,"./lib/signing-key.js":8,"./lib/utils.js":9,"./lib/wallet.js":10,buffer:40,rlp:84,"scrypt-js":85}],2:[function(a,b,c){(function(c,d){"use strict";functione(a){if(a<=0||a>1024||parseInt(a)!=a)thrownewError("invalid length");varb=newd(a);returng.getRandomValues(b),b}varf=a("./utils.js"),g=c.crypto||c.msCrypto;g&&g.getRandomValues?console.log("Found strong random number source"):(console.log("WARNING: Missing strong random number source; using weak randomBytes"),g={getRandomValues:function(a){for(varb=0;b<buffer.length;b++)buffer[b]=parseInt(256*Math.random());returnbuffer},_weakCrypto:!0}),g._weakCrypto===!0&&f.defineProperty(e,"_weakCrypto",!0),b.exports=e}).call(this,"undefined"!=typeofglobal?global:"undefined"!=typeofself?self:"undefined"!=typeofwindow?window:{},a("buffer").Buffer)},{"./utils.js":9,buffer:40}],3:[function(a,b,c){"use strict";try{b.exports.XMLHttpRequest=XMLHttpRequest}catch(d){console.log("Warning: XMLHttpRequest is not defined"),b.exports.XMLHttpRequest=null}},{}],4:[function(a,b,c){(function(c){"use strict";functiond(a,b,c){vard=JSON.stringify(c);Object.defineProperty(a,b,{enumerable:!0,get:function(){returnJSON.parse(d)}})}functione(a,b){if(!Array.isArray(a))thrownewError("invalid params");for(varc=[],d=0;d<a.length;d++){if("string"!=typeofa[d][b])thrownewError("invalid abi");c.push(a[d][b])}returnc}functionf(a){if(!a.eq){if("number"!=typeofa)thrownewError("invalid number");a=newo.BN(a)}returna}functiong(a,b){return{encode:function(d){returnd=f(d),d=d.toTwos(8*a).and(p[a]),b&&(d=d.fromTwos(8*a).toTwos(256)),d.toArrayLike(c,"be",32)},decode:function(c,d){vare=32-a,f=newo.BN(c.slice(d+e,d+32));returnf=b?f.fromTwo
if(!(thisinstanceofC))throwError("AES must be instanitated with `new`");this.key=h(a),this._prepare()};C.prototype._prepare=function(){vara=m[this.key.length];if(null==a)thrownewError("invalid key size (must be 16, 24 or 32 bytes)");this._Ke=[],this._Kd=[];for(varb=0;b<=a;b++)this._Ke.push([0,0,0,0]),this._Kd.push([0,0,0,0]);for(varc,d=4*(a+1),e=this.key.length/4,g=f(this.key),b=0;b<e;b++)c=b>>2,this._Ke[c][b%4]=g[b],this._Kd[a-c][b%4]=g[b];for(varh,i=0,j=e;j<d;){if(h=g[e-1],g[0]^=o[h>>16&255]<<24^o[h>>8&255]<<16^o[255&h]<<8^o[h>>24&255]^n[i]<<24,i+=1,8!=e)for(varb=1;b<e;b++)g[b]^=g[b-1];else{for(varb=1;b<e/2;b++)g[b]^=g[b-1];h=g[e/2-1],g[e/2]^=o[255&h]^o[h>>8&255]<<8^o[h>>16&255]<<16^o[h>>24&255]<<24;for(varb=e/2+1;b<e;b++)g[b]^=g[b-1]}for(vark,l,b=0;b<e&&j<d;)k=j>>2,l=j%4,this._Ke[k][l]=g[b],this._Kd[a-k][l]=g[b++],j++}for(vark=1;k<a;k++)for(varl=0;l<4;l++)h=this._Kd[k][l],this._Kd[k][l]=y[h>>24&255]^z[h>>16&255]^A[h>>8&255]^B[255&h]},C.prototype.encrypt=function(a){if(16!=a.length)thrownewError("invalid plaintext size (must be 16 bytes)");for(varb=this._Ke.length-1,c=[0,0,0,0],d=f(a),e=0;e<4;e++)d[e]^=this._Ke[0][e];for(varg=1;g<b;g++){for(vare=0;e<4;e++)c[e]=q[d[e]>>24&255]^r[d[(e+1)%4]>>16&255]^s[d[(e+2)%4]>>8&255]^t[255&d[(e+3)%4]]^this._Ke[g][e];d=c.slice(0)}for(vari,j=h(16),e=0;e<4;e++)i=this._Ke[b][e],j[4*e]=255&(o[d[e]>>24&255]^i>>24),j[4*e+1]=255&(o[d[(e+1)%4]>>16&255]^i>>16),j[4*e+2]=255&(o[d[(e+2)%4]>>8&255]^i>>8),j[4*e+3]=255&(o[255&d[(e+3)%4]]^i);returnj},C.prototype.decrypt=function(a){if(16!=a.length)thrownewError("invalid ciphertext size (must be 16 bytes)");for(varb=this._Kd.length-1,c=[0,0,0,0],d=f(a),e=0;e<4;e++)d[e]^=this._Kd[0][e];for(varg=1;g<b;g++){for(vare=0;e<4;e++)c[e]=u[d[e]>>24&255]^v[d[(e+3)%4]>>16&255]^w[d[(e+2)%4]>>8&255]^x[255&d[(e+1)%4]]^this._Kd[g][e];d=c.slice(0)}for(vari,j=h(16),e=0;e<4;e++)i=this._Kd[b][e],j[4*e]=255&(p[d[e]>>24&255]^i>>24),j[4*e+1]=255&(p[d[(e+3)%4]>>16&255]^i>>16),j[4*e+2]=255&(p[d[(e+2)%4]>>8&255]^i>>8),j[4*e+3]=255&(p[255&d[(e+1)%4]]^i);returnj};varD=function(a){if(!(thisinstanceofD))throwError("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=newC(a)};D.prototype.encrypt=function(a){returnthis._aes.encrypt(a)},D.prototype.decrypt=function(a,b){returnthis._aes.decrypt(a)};varE=function(a,b){if(!(thisinstanceofE))throwError("AES must be instanitated with `new`");if(this.description="Cipher Block Chaining",this.name="cbc",b){if(16!=b.length)thrownewError("invalid initialation vector size (must be 16 bytes)")}elseb=h([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);this._lastCipherblock=h(b),this._aes=newC(a)};E.prototype.encrypt=function(a){if(16!=a.length)thrownewError("invalid plaintext size (must be 16 bytes)");for(varb=h(a),c=0;c<16;c++)b[c]^=this._lastCipherblock[c];returnthis._lastCipherblock=this._aes.encrypt(b),this._lastCipherblock},E.prototype.decrypt=function(a){if(16!=a.length)thrownewError("invalid ciphertext size (must be 16 bytes)");for(varb=this._aes.decrypt(a),c=0;c<16;c++)b[c]^=this._lastCipherblock[c];returni(a,this._lastCipherblock),b};varF=function(a,b,c){if(!(thisinstanceofF))throwError("AES must be instanitated with `new`");if(this.description="Cipher Feedback",this.name="cfb",b){if(16!=b.length)thrownewError("invalid initialation vector size (must be 16 size)")}elseb=h([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);c||(c=1),this.segmentSize=c,this._shiftRegister=h(b),this._aes=newC(a)};F.prototype.encrypt=function(a){if(a.length%this.segmentSize!=0)thrownewError("invalid plaintext size (must be segmentSize bytes)");for(varb,c=h(a),d=0;d<c.length;d+=this.segmentSize){b=this._aes.encrypt(this._shiftRegister);for(vare=0;e<this.segmentSize;e++)c[d+e]^=b[e];i(this._shiftRegister,this._shiftRegister,0,this.segmentSize),i(c,this._shiftRegister,16-this.segmentSize,d,d+this.segmentSize)}returnc},F.prototype.decrypt=function(a){if(a.length%this.segmentSize!=0)thrownewError("invalid ciphertext size (must be segmentSize bytes)");for(varb,c=h(a),d=0;d<c.le
}functionj(a){return"[object Arguments]"==Object.prototype.toString.call(a)}functionk(a,b){if(n.isNullOrUndefined(a)||n.isNullOrUndefined(b))return!1;if(a.prototype!==b.prototype)return!1;if(n.isPrimitive(a)||n.isPrimitive(b))returna===b;varc=j(a),d=j(b);if(c&&!d||!c&&d)return!1;if(c)returna=o.call(a),b=o.call(b),i(a,b);vare,f,g=r(a),h=r(b);if(g.length!=h.length)return!1;for(g.sort(),h.sort(),f=g.length-1;f>=0;f--)if(g[f]!=h[f])return!1;for(f=g.length-1;f>=0;f--)if(e=g[f],!i(a[e],b[e]))return!1;return!0}functionl(a,b){return!(!a||!b)&&("[object RegExp]"==Object.prototype.toString.call(b)?b.test(a):ainstanceofb||b.call({},a)===!0)}functionm(a,b,c,d){vare;n.isString(c)&&(d=c,c=null);try{b()}catch(f){e=f}if(d=(c&&c.name?" ("+c.name+").":".")+(d?" "+d:"."),a&&!e&&g(e,c,"Missing expected exception"+d),!a&&l(e,c)&&g(e,c,"Got unwanted exception"+d),a&&e&&c&&!l(e,c)||!a&&e)throwe}varn=a("util/"),o=Array.prototype.slice,p=Object.prototype.hasOwnProperty,q=b.exports=h;q.AssertionError=function(a){this.name="AssertionError",this.actual=a.actual,this.expected=a.expected,this.operator=a.operator,a.message?(this.message=a.message,this.generatedMessage=!1):(this.message=f(this),this.generatedMessage=!0);varb=a.stackStartFunction||g;if(Error.captureStackTrace)Error.captureStackTrace(this,b);else{varc=newError;if(c.stack){vard=c.stack,e=b.name,h=d.indexOf("\n"+e);if(h>=0){vari=d.indexOf("\n",h+1);d=d.substring(i+1)}this.stack=d}}},n.inherits(q.AssertionError,Error),q.fail=g,q.ok=h,q.equal=function(a,b,c){a!=b&&g(a,b,c,"==",q.equal)},q.notEqual=function(a,b,c){a==b&&g(a,b,c,"!=",q.notEqual)},q.deepEqual=function(a,b,c){i(a,b)||g(a,b,c,"deepEqual",q.deepEqual)},q.notDeepEqual=function(a,b,c){i(a,b)&&g(a,b,c,"notDeepEqual",q.notDeepEqual)},q.strictEqual=function(a,b,c){a!==b&&g(a,b,c,"===",q.strictEqual)},q.notStrictEqual=function(a,b,c){a===b&&g(a,b,c,"!==",q.notStrictEqual)},q["throws"]=function(a,b,c){m.apply(this,[!0].concat(o.call(arguments)))},q.doesNotThrow=function(a,b){m.apply(this,[!1].concat(o.call(arguments)))},q.ifError=function(a){if(a)throwa};varr=Object.keys||function(a){varb=[];for(varcina)p.call(a,c)&&b.push(c);returnb}},{"util/":66}],39:[function(a,b,c){},{}],40:[function(a,b,c){(function(b){"use strict";functiond(){try{vara=newUint8Array(1);returna.__proto__={__proto__:Uint8Array.prototype,foo:function(){return42}},42===a.foo()&&"function"==typeofa.subarray&&0===a.subarray(1,1).byteLength}catch(b){return!1}}functione(){returng.TYPED_ARRAY_SUPPORT?2147483647:1073741823}functionf(a,b){if(e()<b)thrownewRangeError("Invalid typed array length");returng.TYPED_ARRAY_SUPPORT?(a=newUint8Array(b),a.__proto__=g.prototype):(null===a&&(a=newg(b)),a.length=b),a}functiong(a,b,c){if(!(g.TYPED_ARRAY_SUPPORT||thisinstanceofg))returnnewg(a,b,c);if("number"==typeofa){if("string"==typeofb)thrownewError("If encoding is specified then the first argument must be a string");returnk(this,a)}returnh(this,a,b,c)}functionh(a,b,c,d){if("number"==typeofb)thrownewTypeError('"value" argument must not be a number');return"undefined"!=typeofArrayBuffer&&binstanceofArrayBuffer?n(a,b,c,d):"string"==typeofb?l(a,b,c):o(a,b)}functioni(a){if("number"!=typeofa)thrownewTypeError('"size" argument must be a number')}functionj(a,b,c,d){returni(b),b<=0?f(a,b):void0!==c?"string"==typeofd?f(a,b).fill(c,d):f(a,b).fill(c):f(a,b)}functionk(a,b){if(i(b),a=f(a,b<0?0:0|p(b)),!g.TYPED_ARRAY_SUPPORT)for(varc=0;c<b;++c)a[c]=0;returna}functionl(a,b,c){if("string"==typeofc&&""!==c||(c="utf8"),!g.isEncoding(c))thrownewTypeError('"encoding" must be a valid string encoding');vard=0|r(b,c);returna=f(a,d),a.write(b,c),a}functionm(a,b){varc=0|p(b.length);a=f(a,c);for(vard=0;d<c;d+=1)a[d]=255&b[d];returna}functionn(a,b,c,d){if(b.byteLength,c<0||b.byteLength<c)thrownewRangeError("'offset' is out of bounds");if(b.byteLength<c+(d||0))thrownewRangeError("'length' is out of bounds");returnb=void0===c&&void0===d?newUint8Array(b):void0===d?newUint8Array(b,c):newUint8Array(b,c,d),g.TYPED_ARRAY_SUPPORT?(a
a|=a>>>2,a|=a>>>4,a|=a>>>8,a|=a>>>16,a++),a}functionj(a,b){return0===b.length&&b.ended?0:b.objectMode?0===a?0:1:null===a||isNaN(a)?b.flowing&&b.buffer.length?b.buffer[0].length:b.length:a<=0?0:(a>b.highWaterMark&&(b.highWaterMark=i(a)),a>b.length?b.ended?b.length:(b.needReadable=!0,0):a)}functionk(a,b){varc=null;returnF.isBuffer(b)||"string"==typeofb||null===b||void0===b||a.objectMode||(c=newTypeError("Invalid non-string/buffer chunk")),c}functionl(a,b){if(!b.ended){if(b.decoder){varc=b.decoder.end();c&&c.length&&(b.buffer.push(c),b.length+=b.objectMode?1:c.length)}b.ended=!0,m(a)}}functionm(a){varb=a._readableState;b.needReadable=!1,b.emittedReadable||(J("emitReadable",b.flowing),b.emittedReadable=!0,b.sync?A(n,a):n(a))}functionn(a){J("emit readable"),a.emit("readable"),u(a)}functiono(a,b){b.readingMore||(b.readingMore=!0,A(p,a,b))}functionp(a,b){for(varc=b.length;!b.reading&&!b.flowing&&!b.ended&&b.length<b.highWaterMark&&(J("maybeReadMore read 0"),a.read(0),c!==b.length);)c=b.length;b.readingMore=!1}functionq(a){returnfunction(){varb=a._readableState;J("pipeOnDrain",b.awaitDrain),b.awaitDrain&&b.awaitDrain--,0===b.awaitDrain&&E(a,"data")&&(b.flowing=!0,u(a))}}functionr(a){J("readable nexttick read 0"),a.read(0)}functions(a,b){b.resumeScheduled||(b.resumeScheduled=!0,A(t,a,b))}functiont(a,b){b.reading||(J("resume read 0"),a.read(0)),b.resumeScheduled=!1,a.emit("resume"),u(a),b.flowing&&!b.reading&&a.read(0)}functionu(a){varb=a._readableState;if(J("flow",b.flowing),b.flowing)dovarc=a.read();while(null!==c&&b.flowing)}functionv(a,b){varc,d=b.buffer,e=b.length,f=!!b.decoder,g=!!b.objectMode;if(0===d.length)returnnull;if(0===e)c=null;elseif(g)c=d.shift();elseif(!a||a>=e)c=f?d.join(""):1===d.length?d[0]:F.concat(d,e),d.length=0;elseif(a<d[0].length){varh=d[0];c=h.slice(0,a),d[0]=h.slice(a)}elseif(a===d[0].length)c=d.shift();else{c=f?"":G.allocUnsafe(a);for(vari=0,j=0,k=d.length;j<k&&i<a;j++){varl=d[0],m=Math.min(a-i,l.length);f?c+=l.slice(0,m):l.copy(c,i,0,m),m<l.length?d[0]=l.slice(m):d.shift(),i+=m}}returnc}functionw(a){varb=a._readableState;if(b.length>0)thrownewError('"endReadable()" called on non-empty stream');b.endEmitted||(b.ended=!0,A(x,b,a))}functionx(a,b){a.endEmitted||0!==a.length||(a.endEmitted=!0,b.readable=!1,b.emit("end"))}functiony(a,b){for(varc=0,d=a.length;c<d;c++)b(a[c],c)}functionz(a,b){for(varc=0,d=a.length;c<d;c++)if(a[c]===b)returnc;return-1}b.exports=f;varA=a("process-nextick-args"),B=a("isarray");f.ReadableState=e;varC,D=a("events").EventEmitter,E=function(a,b){returna.listeners(b).length};!function(){try{C=a("stream")}catch(b){}finally{C||(C=a("events").EventEmitter)}}();varF=a("buffer").Buffer,G=a("buffer-shims"),H=a("core-util-is");H.inherits=a("inherits");varI=a("util"),J=void0;J=I&&I.debuglog?I.debuglog("stream"):function(){};varK;H.inherits(f,C);varL,L,M="function"==typeofD.prototype.prependListener;f.prototype.push=function(a,b){varc=this._readableState;returnc.objectMode||"string"!=typeofa||(b=b||c.defaultEncoding,b!==c.encoding&&(a=G.from(a,b),b="")),g(this,c,a,b,!1)},f.prototype.unshift=function(a){varb=this._readableState;returng(this,b,a,"",!0)},f.prototype.isPaused=function(){returnthis._readableState.flowing===!1},f.prototype.setEncoding=function(b){returnK||(K=a("string_decoder/").StringDecoder),this._readableState.decoder=newK(b),this._readableState.encoding=b,this};varN=8388608;f.prototype.read=function(a){J("read",a);varb=this._readableState,c=a;if(("number"!=typeofa||a>0)&&(b.emittedReadable=!1),0===a&&b.needReadable&&(b.length>=b.highWaterMark||b.ended))returnJ("read: emitReadable",b.length,b.ended),0===b.length&&b.ended?w(this):m(this),null;if(a=j(a,b),0===a&&b.ended)return0===b.length&&w(this),null;vard=b.needReadable;J("need readable",d),(0===b.length||b.length-a<b.highWaterMark)&&(d=!0,J("length less than watermark",d)),(b.ended||b.reading)&&(d=!1,J("reading or ended",d)),d&&(J("do read"),b.reading=!0,b.sync=!0,0===b.length&&(b.needReadable=!0),this._read(b.highWaterMark),b.sync=!1),d&&!b.reading&&(a=j(c,