(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o=0){var next_line=out.indexOf("\n",idx+1);out=out.substring(next_line+1)}this.stack=out}}};util.inherits(assert.AssertionError,Error);function replacer(key,value){if(util.isUndefined(value)){return""+value}if(util.isNumber(value)&&!isFinite(value)){return value.toString()}if(util.isFunction(value)||util.isRegExp(value)){return value.toString()}return value}function truncate(s,n){if(util.isString(s)){return s.length=0;i--){if(ka[i]!=kb[i])return false}for(i=ka.length-1;i>=0;i--){key=ka[i];if(!_deepEqual(a[key],b[key]))return false}return true}assert.notDeepEqual=function notDeepEqual(actual,expected,message){if(_deepEqual(actual,expected)){fail(actual,expected,message,"notDeepEqual",assert.notDeepEqual)}};assert.strictEqual=function strictEqual(actual,expected,message){if(actual!==expected){fail(actual,expected,message,"===",assert.strictEqual)}};assert.notStrictEqual=function notStrictEqual(actual,expected,message){if(actual===expected){fail(actual,expected,message,"!==",assert.notStrictEqual)}};function expectedException(actual,expected){if(!actual||!expected){return false}if(Object.prototype.toString.call(expected)=="[object RegExp]"){return expected.test(actual)}else if(actual instanceof expected){return true}else if(expected.call({},actual)===true){return true}return false}function _throws(shouldThrow,block,expected,message){var actual;if(util.isString(expected)){message=expected;expected=null}try{block()}catch(e){actual=e}message=(expected&&expected.name?" ("+expected.name+").":".")+(message?" "+message:".");if(shouldThrow&&!actual){fail(actual,expected,"Missing expected exception"+message)}if(!shouldThrow&&expectedException(actual,expected)){fail(actual,expected,"Got unwanted exception"+message)}if(shouldThrow&&actual&&expected&&!expectedException(actual,expected)||!shouldThrow&&actual){throw actual}}assert.throws=function(block,error,message){_throws.apply(this,[true].concat(pSlice.call(arguments)))};assert.doesNotThrow=function(block,message){_throws.apply(this,[false].concat(pSlice.call(arguments)))};assert.ifError=function(err){if(err){throw err}};var objectKeys=Object.keys||function(obj){var keys=[];for(var key in obj){if(hasOwn.call(obj,key))keys.push(key)}return keys}},{"util/":293}],3:[function(require,module,exports){(function(process,global){(function(){var async={};function noop(){}function identity(v){return v}function toBool(v){return!!v}function notId(v){return!v}var previous_async;var root=typeof self==="object"&&self.self===self&&self||typeof global==="object"&&global.global===global&&global||this;if(root!=null){previous_async=root.async}async.noConflict=function(){root.async=previous_async;return async};function only_once(fn){return function(){if(fn===null)throw new Error("Callback was already called.");fn.apply(this,arguments);fn=null}}function _once(fn){return function(){if(fn===null)return;fn.apply(this,arguments);fn=null}}var _toString=Object.prototype.toString;var _isArray=Array.isArray||function(obj){return _toString.call(obj)==="[object Array]"};var _isObject=function(obj){var type=typeof obj;return type==="function"||type==="object"&&!!obj};function _isArrayLike(arr){return _isArray(arr)||typeof arr.length==="number"&&arr.length>=0&&arr.length%1===0}function _arrayEach(arr,iterator){var index=-1,length=arr.length;while(++index3){eachfn(arr,limit,iteratee,done)}else{cb=iterator;iterator=limit;eachfn(arr,iteratee,done)}}}async.any=async.some=_createTester(async.eachOf,toBool,identity);async.someLimit=_createTester(async.eachOfLimit,toBool,identity);async.all=async.every=_createTester(async.eachOf,notId,notId);async.everyLimit=_createTester(async.eachOfLimit,notId,notId);function _findGetResult(v,x){return x}async.detect=_createTester(async.eachOf,identity,_findGetResult);async.detectSeries=_createTester(async.eachOfSeries,identity,_findGetResult);async.detectLimit=_createTester(async.eachOfLimit,identity,_findGetResult);async.sortBy=function(arr,iterator,callback){async.map(arr,function(x,callback){iterator(x,function(err,criteria){if(err){callback(err)}else{callback(null,{value:x,criteria:criteria})}})},function(err,results){if(err){return callback(err)}else{callback(null,_map(results.sort(comparator),function(x){return x.value}))}});function comparator(left,right){var a=left.criteria,b=right.criteria;return ab?1:0}};async.auto=function(tasks,concurrency,callback){if(typeof arguments[1]==="function"){callback=concurrency;concurrency=null}callback=_once(callback||noop);var keys=_keys(tasks);var remainingTasks=keys.length;if(!remainingTasks){return callback(null)}if(!concurrency){concurrency=remainingTasks}var results={};var runningTasks=0;var hasError=false;var listeners=[];function addListener(fn){listeners.unshift(fn)}function removeListener(fn){var idx=_indexOf(listeners,fn);if(idx>=0)listeners.splice(idx,1)}function taskComplete(){remainingTasks--;_arrayEach(listeners.slice(0),function(fn){fn()})}addListener(function(){if(!remainingTasks){callback(null,results)}});_arrayEach(keys,function(k){if(hasError)return;var task=_isArray(tasks[k])?tasks[k]:[tasks[k]];var taskCallback=_restParam(function(err,args){runningTasks--;if(args.length<=1){args=args[0]}if(err){var safeResults={};_forEachOf(results,function(val,rkey){safeResults[rkey]=val});safeResults[k]=args;hasError=true;callback(err,safeResults)}else{results[k]=args;async.setImmediate(taskComplete)}});var requires=task.slice(0,task.length-1);var len=requires.length;var dep;while(len--){if(!(dep=tasks[requires[len]])){throw new Error("Has nonexistent dependency in "+requires.join(", "))}if(_isArray(dep)&&_indexOf(dep,k)>=0){throw new Error("Has cyclic dependencies")}}function ready(){return runningTasks3){throw new Error("Invalid arguments - must be either (task), (task, callback), (times, task) or (times, task, callback)")}else if(length<=2&&typeof times==="function"){callback=task;task=times}if(typeof times!=="function"){parseTimes(opts,times)}opts.callback=callback;opts.task=task;function wrappedTask(wrappedCallback,wrappedResults){function retryAttempt(task,finalAttempt){return function(seriesCallback){task(function(err,result){seriesCallback(!err||finalAttempt,{err:err,result:result})},wrappedResults)}}function retryInterval(interval){return function(seriesCallback){setTimeout(function(){seriesCallback(null)},interval)}}while(opts.times){var finalAttempt=!(opts.times-=1);attempts.push(retryAttempt(opts.task,finalAttempt));if(!finalAttempt&&opts.interval>0){attempts.push(retryInterval(opts.interval))}}async.series(attempts,function(done,data){data=data[data.length-1];(wrappedCallback||opts.callback)(data.err,data.result)})}return opts.callback?wrappedTask():wrappedTask};async.waterfall=function(tasks,callback){callback=_once(callback||noop);if(!_isArray(tasks)){var err=new Error("First argument to waterfall must be an array of functions");return callback(err)}if(!tasks.length){return callback()}function wrapIterator(iterator){return _restParam(function(err,args){if(err){callback.apply(null,[err].concat(args))}else{var next=iterator.next();if(next){args.push(wrapIterator(next))}else{args.push(callback)}ensureAsync(iterator).apply(null,args)}})}wrapIterator(async.iterator(tasks))()};function _parallel(eachfn,tasks,callback){callback=callback||noop;var results=_isArrayLike(tasks)?[]:{};eachfn(tasks,function(task,key,callback){task(_restParam(function(err,args){if(args.length<=1){args=args[0]}results[key]=args;callback(err)}))},function(err){callback(err,results)})}async.parallel=function(tasks,callback){_parallel(async.eachOf,tasks,callback)};async.parallelLimit=function(tasks,limit,callback){_parallel(_eachOfLimit(limit),tasks,callback)};async.series=function(tasks,callback){_parallel(async.eachOfSeries,tasks,callback)};async.iterator=function(tasks){function makeCallback(index){function fn(){if(tasks.length){tasks[index].apply(null,arguments)}return fn.next()}fn.next=function(){return index>>1);if(compare(item,sequence[mid])>=0){beg=mid}else{end=mid-1}}return beg}function _insert(q,data,priority,callback){if(callback!=null&&typeof callback!=="function"){throw new Error("task callback must be a function")}q.started=true;if(!_isArray(data)){data=[data]}if(data.length===0){return async.setImmediate(function(){q.drain()})}_arrayEach(data,function(task){var item={data:task,priority:priority,callback:typeof callback==="function"?callback:noop};q.tasks.splice(_binarySearch(q.tasks,item,_compareTasks)+1,0,item);if(q.tasks.length===q.concurrency){q.saturated()}async.setImmediate(q.process)})}var q=async.queue(worker,concurrency);q.push=function(data,priority,callback){_insert(q,data,priority,callback)};delete q.unshift;return q};async.cargo=function(worker,payload){return _queue(worker,1,payload)};function _console_fn(name){return _restParam(function(fn,args){fn.apply(null,args.concat([_restParam(function(err,args){if(typeof console==="object"){if(err){if(console.error){console.error(err)}}else if(console[name]){_arrayEach(args,function(x){console[name](x)})}}})]))})}async.log=_console_fn("log");async.dir=_console_fn("dir");async.memoize=function(fn,hasher){var memo={};var queues={};var has=Object.prototype.hasOwnProperty;hasher=hasher||identity;var memoized=_restParam(function memoized(args){var callback=args.pop();var key=hasher.apply(null,args);if(has.call(memo,key)){async.setImmediate(function(){callback.apply(null,memo[key])})}else if(has.call(queues,key)){queues[key].push(callback)}else{queues[key]=[callback];fn.apply(null,args.concat([_restParam(function(args){memo[key]=args;var q=queues[key];delete queues[key];for(var i=0,l=q.length;i0){throw new Error("Invalid string. Length must be a multiple of 4")}var len=b64.length;placeHolders="="===b64.charAt(len-2)?2:"="===b64.charAt(len-1)?1:0;arr=new Arr(b64.length*3/4-placeHolders);l=placeHolders>0?b64.length-4:b64.length;var L=0;function push(v){arr[L++]=v}for(i=0,j=0;i>16);push((tmp&65280)>>8);push(tmp&255)}if(placeHolders===2){tmp=decode(b64.charAt(i))<<2|decode(b64.charAt(i+1))>>4;push(tmp&255)}else if(placeHolders===1){tmp=decode(b64.charAt(i))<<10|decode(b64.charAt(i+1))<<4|decode(b64.charAt(i+2))>>2;push(tmp>>8&255);push(tmp&255)}return arr}function uint8ToBase64(uint8){var i,extraBytes=uint8.length%3,output="",temp,length;function encode(num){return lookup.charAt(num)}function tripletToBase64(num){return encode(num>>18&63)+encode(num>>12&63)+encode(num>>6&63)+encode(num&63)}for(i=0,length=uint8.length-extraBytes;i>2);output+=encode(temp<<4&63);output+="==";break;case 2:temp=(uint8[uint8.length-2]<<8)+uint8[uint8.length-1];output+=encode(temp>>10);output+=encode(temp>>4&63);output+=encode(temp<<2&63);output+="=";break}return output}exports.toByteArray=b64ToByteArray;exports.fromByteArray=uint8ToBase64})(typeof exports==="undefined"?this.base64js={}:exports)},{}],5:[function(require,module,exports){(function(globalObj){"use strict";var cryptoObj,parseNumeric,isNumeric=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,mathceil=Math.ceil,mathfloor=Math.floor,notBool=" not a boolean or binary digit",roundingMode="rounding mode",tooManyDigits="number type has more than 15 significant digits",ALPHABET="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",BASE=1e14,LOG_BASE=14,MAX_SAFE_INTEGER=9007199254740991,POWS_TEN=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],SQRT_BASE=1e7,MAX=1e9;if(typeof crypto!="undefined")cryptoObj=crypto;function constructorFactory(configObj){var div,id=0,P=BigNumber.prototype,ONE=new BigNumber(1),DECIMAL_PLACES=20,ROUNDING_MODE=4,TO_EXP_NEG=-7,TO_EXP_POS=21,MIN_EXP=-1e7,MAX_EXP=1e7,ERRORS=true,isValidInt=intValidatorWithErrors,CRYPTO=false,MODULO_MODE=1,POW_PRECISION=100,FORMAT={decimalSeparator:".",groupSeparator:",",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:" ",fractionGroupSize:0};function BigNumber(n,b){var c,e,i,num,len,str,x=this;if(!(x instanceof BigNumber)){if(ERRORS)raise(26,"constructor call without new",n);return new BigNumber(n,b)}if(b==null||!isValidInt(b,2,64,id,"base")){if(n instanceof BigNumber){x.s=n.s;x.e=n.e;x.c=(n=n.c)?n.slice():n;id=0;return}if((num=typeof n=="number")&&n*0==0){x.s=1/n<0?(n=-n,-1):1;if(n===~~n){for(e=0,i=n;i>=10;i/=10,e++);x.e=e;x.c=[n];id=0;return}str=n+""}else{if(!isNumeric.test(str=n+""))return parseNumeric(x,str,num);x.s=str.charCodeAt(0)===45?(str=str.slice(1),-1):1}}else{b=b|0;str=n+"";if(b==10){x=new BigNumber(n instanceof BigNumber?n:str);return round(x,DECIMAL_PLACES+x.e+1,ROUNDING_MODE)}if((num=typeof n=="number")&&n*0!=0||!new RegExp("^-?"+(c="["+ALPHABET.slice(0,b)+"]+")+"(?:\\."+c+")?$",b<37?"i":"").test(str)){return parseNumeric(x,str,num,b)}if(num){x.s=1/n<0?(str=str.slice(1),-1):1;if(ERRORS&&str.replace(/^0\.0*|\./,"").length>15){raise(id,tooManyDigits,n)}num=false}else{x.s=str.charCodeAt(0)===45?(str=str.slice(1),-1):1}str=convertBase(str,10,b,x.s)}if((e=str.indexOf("."))>-1)str=str.replace(".","");if((i=str.search(/e/i))>0){if(e<0)e=i;e+=+str.slice(i+1);str=str.substring(0,i)}else if(e<0){e=str.length}for(i=0;str.charCodeAt(i)===48;i++);for(len=str.length;str.charCodeAt(--len)===48;);str=str.slice(i,len+1);if(str){len=str.length;if(num&&ERRORS&&len>15&&(n>MAX_SAFE_INTEGER||n!==mathfloor(n))){raise(id,tooManyDigits,x.s*n)}e=e-i-1;if(e>MAX_EXP){x.c=x.e=null}else if(ei)return(v=a[i++])!=null};if(has(p="DECIMAL_PLACES")&&isValidInt(v,0,MAX,2,p)){DECIMAL_PLACES=v|0}r[p]=DECIMAL_PLACES;if(has(p="ROUNDING_MODE")&&isValidInt(v,0,8,2,p)){ROUNDING_MODE=v|0}r[p]=ROUNDING_MODE;if(has(p="EXPONENTIAL_AT")){if(isArray(v)){if(isValidInt(v[0],-MAX,0,2,p)&&isValidInt(v[1],0,MAX,2,p)){TO_EXP_NEG=v[0]|0;TO_EXP_POS=v[1]|0}}else if(isValidInt(v,-MAX,MAX,2,p)){TO_EXP_NEG=-(TO_EXP_POS=(v<0?-v:v)|0)}}r[p]=[TO_EXP_NEG,TO_EXP_POS];if(has(p="RANGE")){if(isArray(v)){if(isValidInt(v[0],-MAX,-1,2,p)&&isValidInt(v[1],1,MAX,2,p)){MIN_EXP=v[0]|0;MAX_EXP=v[1]|0}}else if(isValidInt(v,-MAX,MAX,2,p)){if(v|0)MIN_EXP=-(MAX_EXP=(v<0?-v:v)|0);else if(ERRORS)raise(2,p+" cannot be zero",v)}}r[p]=[MIN_EXP,MAX_EXP];if(has(p="ERRORS")){if(v===!!v||v===1||v===0){id=0;isValidInt=(ERRORS=!!v)?intValidatorWithErrors:intValidatorNoErrors}else if(ERRORS){raise(2,p+notBool,v)}}r[p]=ERRORS;if(has(p="CRYPTO")){if(v===!!v||v===1||v===0){CRYPTO=!!(v&&cryptoObj);if(v&&!CRYPTO&&ERRORS)raise(2,"crypto unavailable",cryptoObj)}else if(ERRORS){raise(2,p+notBool,v)}}r[p]=CRYPTO;if(has(p="MODULO_MODE")&&isValidInt(v,0,9,2,p)){MODULO_MODE=v|0}r[p]=MODULO_MODE;if(has(p="POW_PRECISION")&&isValidInt(v,0,MAX,2,p)){POW_PRECISION=v|0}r[p]=POW_PRECISION;if(has(p="FORMAT")){if(typeof v=="object"){FORMAT=v}else if(ERRORS){raise(2,p+" not an object",v)}}r[p]=FORMAT;return r};BigNumber.max=function(){return maxOrMin(arguments,P.lt)};BigNumber.min=function(){return maxOrMin(arguments,P.gt)};BigNumber.random=function(){var pow2_53=9007199254740992;var random53bitInt=Math.random()*pow2_53&2097151?function(){return mathfloor(Math.random()*pow2_53)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(dp){var a,b,e,k,v,i=0,c=[],rand=new BigNumber(ONE);dp=dp==null||!isValidInt(dp,0,MAX,14)?DECIMAL_PLACES:dp|0;k=mathceil(dp/LOG_BASE);if(CRYPTO){if(cryptoObj&&cryptoObj.getRandomValues){a=cryptoObj.getRandomValues(new Uint32Array(k*=2));for(;i>>11);if(v>=9e15){b=cryptoObj.getRandomValues(new Uint32Array(2));a[i]=b[0];a[i+1]=b[1]}else{c.push(v%1e14);i+=2}}i=k/2}else if(cryptoObj&&cryptoObj.randomBytes){a=cryptoObj.randomBytes(k*=7);for(;i=9e15){cryptoObj.randomBytes(7).copy(a,i)}else{c.push(v%1e14);i+=7}}i=k/7}else if(ERRORS){raise(14,"crypto unavailable",cryptoObj)}}if(!i){for(;i=10;v/=10,i++);if(i=0){k=POW_PRECISION;POW_PRECISION=0;str=str.replace(".","");y=new BigNumber(baseIn);x=y.pow(str.length-i);POW_PRECISION=k;y.c=toBaseOut(toFixedPoint(coeffToString(x.c),x.e),10,baseOut);y.e=y.c.length}xc=toBaseOut(str,baseIn,baseOut);e=k=xc.length;for(;xc[--k]==0;xc.pop());if(!xc[0])return"0";if(i<0){--e}else{x.c=xc;x.e=e;x.s=sign;x=div(x,y,dp,rm,baseOut);xc=x.c;r=x.r;e=x.e}d=e+dp+1;i=xc[d];k=baseOut/2;r=r||d<0||xc[d+1]!=null;r=rm<4?(i!=null||r)&&(rm==0||rm==(x.s<0?3:2)):i>k||i==k&&(rm==4||r||rm==6&&xc[d-1]&1||rm==(x.s<0?8:7));if(d<1||!xc[0]){str=r?toFixedPoint("1",-dp):"0"}else{xc.length=d;if(r){for(--baseOut;++xc[--d]>baseOut;){xc[d]=0;if(!d){++e;xc.unshift(1)}}}for(k=xc.length;!xc[--k];);for(i=0,str="";i<=k;str+=ALPHABET.charAt(xc[i++]));str=toFixedPoint(str,e)}return str}div=function(){function multiply(x,k,base){var m,temp,xlo,xhi,carry=0,i=x.length,klo=k%SQRT_BASE,khi=k/SQRT_BASE|0;for(x=x.slice();i--;){xlo=x[i]%SQRT_BASE;xhi=x[i]/SQRT_BASE|0;m=khi*xlo+xhi*klo;temp=klo*xlo+m%SQRT_BASE*SQRT_BASE+carry;carry=(temp/base|0)+(m/SQRT_BASE|0)+khi*xhi;x[i]=temp%base}if(carry)x.unshift(carry);return x}function compare(a,b,aL,bL){var i,cmp;if(aL!=bL){cmp=aL>bL?1:-1}else{for(i=cmp=0;ib[i]?1:-1;break}}}return cmp}function subtract(a,b,aL,base){var i=0;for(;aL--;){a[aL]-=i;i=a[aL]1;a.shift());}return function(x,y,dp,rm,base){var cmp,e,i,more,n,prod,prodL,q,qc,rem,remL,rem0,xi,xL,yc0,yL,yz,s=x.s==y.s?1:-1,xc=x.c,yc=y.c;if(!xc||!xc[0]||!yc||!yc[0]){return new BigNumber(!x.s||!y.s||(xc?yc&&xc[0]==yc[0]:!yc)?NaN:xc&&xc[0]==0||!yc?s*0:s/0)}q=new BigNumber(s);qc=q.c=[];e=x.e-y.e;s=dp+e+1;if(!base){base=BASE;e=bitFloor(x.e/LOG_BASE)-bitFloor(y.e/LOG_BASE);s=s/LOG_BASE|0}for(i=0;yc[i]==(xc[i]||0);i++);if(yc[i]>(xc[i]||0))e--;if(s<0){qc.push(1);more=true}else{xL=xc.length;yL=yc.length;i=0;s+=2;n=mathfloor(base/(yc[0]+1));if(n>1){yc=multiply(yc,n,base);xc=multiply(xc,n,base);yL=yc.length;xL=xc.length}xi=yL;rem=xc.slice(0,yL);remL=rem.length;for(;remL=base/2)yc0++;do{n=0;cmp=compare(yc,rem,yL,remL);if(cmp<0){rem0=rem[0];if(yL!=remL)rem0=rem0*base+(rem[1]||0);n=mathfloor(rem0/yc0);if(n>1){if(n>=base)n=base-1;prod=multiply(yc,n,base);prodL=prod.length;remL=rem.length;while(compare(prod,rem,prodL,remL)==1){n--;subtract(prod,yL=10;s/=10,i++);round(q,dp+(q.e=i+e*LOG_BASE-1)+1,rm,more)}else{q.e=e;q.r=+more}return q}}();function format(n,i,rm,caller){var c0,e,ne,len,str;rm=rm!=null&&isValidInt(rm,0,8,caller,roundingMode)?rm|0:ROUNDING_MODE;if(!n.c)return n.toString();c0=n.c[0];ne=n.e;if(i==null){str=coeffToString(n.c);str=caller==19||caller==24&&ne<=TO_EXP_NEG?toExponential(str,ne):toFixedPoint(str,ne)}else{n=round(new BigNumber(n),i,rm);e=n.e;str=coeffToString(n.c);len=str.length;if(caller==19||caller==24&&(i<=e||e<=TO_EXP_NEG)){for(;lenlen){if(--i>0)for(str+=".";i--;str+="0");}else{i+=e-len;if(i>0){if(e+1==len)str+=".";for(;i--;str+="0");}}}}return n.s<0&&c0?"-"+str:str}function maxOrMin(args,method){var m,n,i=0;if(isArray(args[0]))args=args[0];m=new BigNumber(args[0]);for(;++imax||n!=truncate(n)){raise(caller,(name||"decimal places")+(nmax?" out of range":" not an integer"),n)}return true}function normalise(n,c,e){var i=1,j=c.length;for(;!c[--j];c.pop());for(j=c[0];j>=10;j/=10,i++);if((e=i+e*LOG_BASE-1)>MAX_EXP){n.c=n.e=null}else if(e=10;k/=10,d++);i=sd-d;if(i<0){i+=LOG_BASE;j=sd;n=xc[ni=0];rd=n/pows10[d-j-1]%10|0}else{ni=mathceil((i+1)/LOG_BASE);if(ni>=xc.length){if(r){for(;xc.length<=ni;xc.push(0));n=rd=0;d=1;i%=LOG_BASE;j=i-LOG_BASE+1}else{break out}}else{n=k=xc[ni];for(d=1;k>=10;k/=10,d++);i%=LOG_BASE;j=i-LOG_BASE+d;rd=j<0?0:n/pows10[d-j-1]%10|0}}r=r||sd<0||xc[ni+1]!=null||(j<0?n:n%pows10[d-j-1]);r=rm<4?(rd||r)&&(rm==0||rm==(x.s<0?3:2)):rd>5||rd==5&&(rm==4||r||rm==6&&(i>0?j>0?n/pows10[d-j]:0:xc[ni-1])%10&1||rm==(x.s<0?8:7));if(sd<1||!xc[0]){xc.length=0;if(r){sd-=x.e+1;xc[0]=pows10[(LOG_BASE-sd%LOG_BASE)%LOG_BASE];x.e=-sd||0}else{xc[0]=x.e=0}return x}if(i==0){xc.length=ni;k=1;ni--}else{xc.length=ni+1;k=pows10[LOG_BASE-i];xc[ni]=j>0?mathfloor(n/pows10[d-j]%pows10[j])*k:0}if(r){for(;;){if(ni==0){for(i=1,j=xc[0];j>=10;j/=10,i++);j=xc[0]+=k;for(k=1;j>=10;j/=10,k++);if(i!=k){x.e++;if(xc[0]==BASE)xc[0]=1}break}else{xc[ni]+=k;if(xc[ni]!=BASE)break;xc[ni--]=0;k=1}}}for(i=xc.length;xc[--i]===0;xc.pop());}if(x.e>MAX_EXP){x.c=x.e=null}else if(x.e0};P.greaterThanOrEqualTo=P.gte=function(y,b){id=7;return(b=compare(this,new BigNumber(y,b)))===1||b===0};P.isFinite=function(){return!!this.c};P.isInteger=P.isInt=function(){return!!this.c&&bitFloor(this.e/LOG_BASE)>this.c.length-2};P.isNaN=function(){return!this.s};P.isNegative=P.isNeg=function(){return this.s<0};P.isZero=function(){return!!this.c&&this.c[0]==0};P.lessThan=P.lt=function(y,b){id=8;return compare(this,new BigNumber(y,b))<0};P.lessThanOrEqualTo=P.lte=function(y,b){id=9;return(b=compare(this,new BigNumber(y,b)))===-1||b===0};P.minus=P.sub=function(y,b){var i,j,t,xLTy,x=this,a=x.s;id=10;y=new BigNumber(y,b);b=y.s;if(!a||!b)return new BigNumber(NaN);if(a!=b){y.s=-b;return x.plus(y)}var xe=x.e/LOG_BASE,ye=y.e/LOG_BASE,xc=x.c,yc=y.c;if(!xe||!ye){if(!xc||!yc)return xc?(y.s=-b,y):new BigNumber(yc?x:NaN);if(!xc[0]||!yc[0]){return yc[0]?(y.s=-b,y):new BigNumber(xc[0]?x:ROUNDING_MODE==3?-0:0)}}xe=bitFloor(xe);ye=bitFloor(ye);xc=xc.slice();if(a=xe-ye){if(xLTy=a<0){a=-a;t=xc}else{ye=xe;t=yc}t.reverse();for(b=a;b--;t.push(0));t.reverse()}else{j=(xLTy=(a=xc.length)<(b=yc.length))?a:b;for(a=b=0;b0)for(;b--;xc[i++]=0);b=BASE-1;for(;j>a;){if(xc[--j]0){ye=xe;t=yc}else{a=-a;t=xc}t.reverse();for(;a--;t.push(0));t.reverse()}a=xc.length;b=yc.length;if(a-b<0)t=yc,yc=xc,xc=t,b=a;for(a=0;b;){a=(xc[--b]=xc[b]+yc[b]+a)/BASE|0;xc[b]%=BASE}if(a){xc.unshift(a);++ye}return normalise(y,xc,ye)};P.precision=P.sd=function(z){var n,v,x=this,c=x.c;if(z!=null&&z!==!!z&&z!==1&&z!==0){if(ERRORS)raise(13,"argument"+notBool,z);if(z!=!!z)z=null}if(!c)return null;v=c.length-1;n=v*LOG_BASE+1;if(v=c[v]){for(;v%10==0;v/=10,n--);for(v=c[0];v>=10;v/=10,n++);}if(z&&x.e+1>n)n=x.e+1;return n};P.round=function(dp,rm){var n=new BigNumber(this);if(dp==null||isValidInt(dp,0,MAX,15)){round(n,~~dp+this.e+1,rm==null||!isValidInt(rm,0,8,15,roundingMode)?ROUNDING_MODE:rm|0)}return n};P.shift=function(k){var n=this;return isValidInt(k,-MAX_SAFE_INTEGER,MAX_SAFE_INTEGER,16,"argument")?n.times("1e"+truncate(k)):new BigNumber(n.c&&n.c[0]&&(k<-MAX_SAFE_INTEGER||k>MAX_SAFE_INTEGER)?n.s*(k<0?0:1/0):n)};P.squareRoot=P.sqrt=function(){var m,n,r,rep,t,x=this,c=x.c,s=x.s,e=x.e,dp=DECIMAL_PLACES+4,half=new BigNumber("0.5");if(s!==1||!c||!c[0]){return new BigNumber(!s||s<0&&(!c||c[0])?NaN:c?x:1/0)}s=Math.sqrt(+x);if(s==0||s==1/0){n=coeffToString(c);if((n.length+e)%2==0)n+="0";s=Math.sqrt(n);e=bitFloor((e+1)/2)-(e<0||e%2);if(s==1/0){n="1e"+e}else{n=s.toExponential();n=n.slice(0,n.indexOf("e")+1)+e}r=new BigNumber(n)}else{r=new BigNumber(s+"")}if(r.c[0]){e=r.e;s=e+dp;if(s<3)s=0;for(;;){t=r;r=half.times(t.plus(div(x,t,dp,1)));if(coeffToString(t.c).slice(0,s)===(n=coeffToString(r.c)).slice(0,s)){if(r.e=0;){c=0;ylo=yc[i]%sqrtBase;yhi=yc[i]/sqrtBase|0;for(k=xcL,j=i+k;j>i;){xlo=xc[--k]%sqrtBase;xhi=xc[k]/sqrtBase|0;m=yhi*xlo+xhi*ylo;xlo=ylo*xlo+m%sqrtBase*sqrtBase+zc[j]+c;c=(xlo/base|0)+(m/sqrtBase|0)+yhi*xhi;zc[j--]=xlo%base}zc[j]=c}if(c){++e}else{zc.shift()}return normalise(y,zc,e)};P.toDigits=function(sd,rm){var n=new BigNumber(this);sd=sd==null||!isValidInt(sd,1,MAX,18,"precision")?null:sd|0;rm=rm==null||!isValidInt(rm,0,8,18,roundingMode)?ROUNDING_MODE:rm|0;return sd?round(n,sd,rm):n};P.toExponential=function(dp,rm){return format(this,dp!=null&&isValidInt(dp,0,MAX,19)?~~dp+1:null,rm,19)};P.toFixed=function(dp,rm){return format(this,dp!=null&&isValidInt(dp,0,MAX,20)?~~dp+this.e+1:null,rm,20)};P.toFormat=function(dp,rm){var str=format(this,dp!=null&&isValidInt(dp,0,MAX,21)?~~dp+this.e+1:null,rm,21);if(this.c){var i,arr=str.split("."),g1=+FORMAT.groupSize,g2=+FORMAT.secondaryGroupSize,groupSeparator=FORMAT.groupSeparator,intPart=arr[0],fractionPart=arr[1],isNeg=this.s<0,intDigits=isNeg?intPart.slice(1):intPart,len=intDigits.length;if(g2)i=g1,g1=g2,g2=i,len-=i;if(g1>0&&len>0){i=len%g1||g1;intPart=intDigits.substr(0,i);for(;i0)intPart+=groupSeparator+intDigits.slice(i);if(isNeg)intPart="-"+intPart}str=fractionPart?intPart+FORMAT.decimalSeparator+((g2=+FORMAT.fractionGroupSize)?fractionPart.replace(new RegExp("\\d{"+g2+"}\\B","g"),"$&"+FORMAT.fractionGroupSeparator):fractionPart):intPart}return str};P.toFraction=function(md){var arr,d0,d2,e,exp,n,n0,q,s,k=ERRORS,x=this,xc=x.c,d=new BigNumber(ONE),n1=d0=new BigNumber(ONE),d1=n0=new BigNumber(ONE);if(md!=null){ERRORS=false;n=new BigNumber(md);ERRORS=k;if(!(k=n.isInt())||n.lt(ONE)){if(ERRORS){raise(22,"max denominator "+(k?"out of range":"not an integer"),md)}md=!k&&n.c&&round(n,n.e+1,1).gte(ONE)?n:null}}if(!xc)return x.toString();s=coeffToString(xc);e=d.e=s.length-x.e-1;d.c[0]=POWS_TEN[(exp=e%LOG_BASE)<0?LOG_BASE+exp:exp];md=!md||n.cmp(d)>0?e>0?d:n1:n;exp=MAX_EXP;MAX_EXP=1/0;n=new BigNumber(s);n0.c[0]=0;for(;;){q=div(n,d,0,1);d2=d0.plus(q.times(d1));if(d2.cmp(md)==1)break;d0=d1;d1=d2;n1=n0.plus(q.times(d2=n1));n0=d2;d=n.minus(q.times(d2=d));n=d2}d2=div(md.minus(d0),d1,0,1);n0=n0.plus(d2.times(n1));d0=d0.plus(d2.times(d1));n0.s=n1.s=x.s;e*=2;arr=div(n1,d1,e,ROUNDING_MODE).minus(x).abs().cmp(div(n0,d0,e,ROUNDING_MODE).minus(x).abs())<1?[n1.toString(),d1.toString()]:[n0.toString(),d0.toString()];MAX_EXP=exp;return arr};P.toNumber=function(){return+this};P.toPower=P.pow=function(n,m){var k,y,z,i=mathfloor(n<0?-n:+n),x=this;if(m!=null){id=23;m=new BigNumber(m)}if(!isValidInt(n,-MAX_SAFE_INTEGER,MAX_SAFE_INTEGER,23,"exponent")&&(!isFinite(n)||i>MAX_SAFE_INTEGER&&(n/=0)||parseFloat(n)!=n&&!(n=NaN))||n==0){k=Math.pow(+x,n);return new BigNumber(m?k%m:k)}if(m){if(n>1&&x.gt(ONE)&&x.isInt()&&m.gt(ONE)&&m.isInt()){x=x.mod(m)}else{z=m;m=null}}else if(POW_PRECISION){k=mathceil(POW_PRECISION/LOG_BASE+2)}y=new BigNumber(ONE);for(;;){if(i%2){y=y.times(x);if(!y.c)break;if(k){if(y.c.length>k)y.c.length=k}else if(m){y=y.mod(m)}}i=mathfloor(i/2);if(!i)break;x=x.times(x);if(k){if(x.c&&x.c.length>k)x.c.length=k}else if(m){x=x.mod(m)}}if(m)return y;if(n<0)y=ONE.div(y);return z?y.mod(z):k?round(y,POW_PRECISION,ROUNDING_MODE):y};P.toPrecision=function(sd,rm){return format(this,sd!=null&&isValidInt(sd,1,MAX,24,"precision")?sd|0:null,rm,24)};P.toString=function(b){var str,n=this,s=n.s,e=n.e;if(e===null){if(s){str="Infinity";if(s<0)str="-"+str}else{str="NaN"}}else{str=coeffToString(n.c);if(b==null||!isValidInt(b,2,64,25,"base")){str=e<=TO_EXP_NEG||e>=TO_EXP_POS?toExponential(str,e):toFixedPoint(str,e)}else{str=convertBase(toFixedPoint(str,e),b|0,10,s)}if(s<0&&n.c[0])str="-"+str}return str};P.truncated=P.trunc=function(){return round(new BigNumber(this),this.e+1,1)};P.valueOf=P.toJSON=function(){var str,n=this,e=n.e;if(e===null)return n.toString();str=coeffToString(n.c);str=e<=TO_EXP_NEG||e>=TO_EXP_POS?toExponential(str,e):toFixedPoint(str,e);return n.s<0?"-"+str:str};if(configObj!=null)BigNumber.config(configObj);return BigNumber}function bitFloor(n){var i=n|0;return n>0||n===i?i:i-1}function coeffToString(a){var s,z,i=1,j=a.length,r=a[0]+"";for(;il^a?1:-1;j=(k=xc.length)<(l=yc.length)?k:l;for(i=0;iyc[i]^a?1:-1;return k==l?0:k>l^a?1:-1}function intValidatorNoErrors(n,min,max){return(n=truncate(n))>=min&&n<=max}function isArray(obj){return Object.prototype.toString.call(obj)=="[object Array]"}function toBaseOut(str,baseIn,baseOut){var j,arr=[0],arrL,i=0,len=str.length;for(;ibaseOut-1){if(arr[j+1]==null)arr[j+1]=0;arr[j+1]+=arr[j]/baseOut|0;arr[j]%=baseOut}}}return arr.reverse()}function toExponential(str,e){return(str.length>1?str.charAt(0)+"."+str.slice(1):str)+(e<0?"e":"e+")+e}function toFixedPoint(str,e){var len,z;if(e<0){for(z="0.";++e;z+="0");str=z+str}else{len=str.length;if(++e>len){for(z="0",e-=len;--e;z+="0");str+=z}else if(e72)return false;if(buffer[0]!==48)return false;if(buffer[1]!==buffer.length-2)return false;if(buffer[2]!==2)return false;var lenR=buffer[3];if(lenR===0)return false;if(5+lenR>=buffer.length)return false;if(buffer[4+lenR]!==2)return false;var lenS=buffer[5+lenR];if(lenS===0)return false;if(6+lenR+lenS!==buffer.length)return false;if(buffer[4]&128)return false;if(lenR>1&&buffer[4]===0&&!(buffer[5]&128))return false;if(buffer[lenR+6]&128)return false;if(lenS>1&&buffer[lenR+6]===0&&!(buffer[lenR+7]&128))return false;return true}function decode(buffer){if(buffer.length<8)throw new Error("DER sequence length is too short");if(buffer.length>72)throw new Error("DER sequence length is too long");if(buffer[0]!==48)throw new Error("Expected DER sequence");if(buffer[1]!==buffer.length-2)throw new Error("DER sequence length is invalid");if(buffer[2]!==2)throw new Error("Expected DER integer");var lenR=buffer[3];if(lenR===0)throw new Error("R length is zero");if(5+lenR>=buffer.length)throw new Error("R length is too long");if(buffer[4+lenR]!==2)throw new Error("Expected DER integer (2)");var lenS=buffer[5+lenR];if(lenS===0)throw new Error("S length is zero");if(6+lenR+lenS!==buffer.length)throw new Error("S length is invalid");if(buffer[4]&128)throw new Error("R value is negative");if(lenR>1&&buffer[4]===0&&!(buffer[5]&128))throw new Error("R value excessively padded");if(buffer[lenR+6]&128)throw new Error("S value is negative");if(lenS>1&&buffer[lenR+6]===0&&!(buffer[lenR+7]&128))throw new Error("S value excessively padded");return{r:buffer.slice(4,4+lenR),s:buffer.slice(6+lenR)}}function encode(r,s){var lenR=r.length;var lenS=s.length;if(lenR===0)throw new Error("R length is zero");if(lenS===0)throw new Error("S length is zero");if(lenR>33)throw new Error("R length is too long");if(lenS>33)throw new Error("S length is too long");if(r[0]&128)throw new Error("R value is negative");if(s[0]&128)throw new Error("S value is negative");if(lenR>1&&r[0]===0&&!(r[1]&128))throw new Error("R value excessively padded");if(lenS>1&&s[0]===0&&!(s[1]&128))throw new Error("S value excessively padded");var signature=Buffer.allocUnsafe(6+lenR+lenS);signature[0]=48;signature[1]=signature.length-2;signature[2]=2;signature[3]=r.length;r.copy(signature,4);signature[4+lenR]=2;signature[5+lenR]=s.length;s.copy(signature,6+lenR);return signature}module.exports={check:check,decode:decode,encode:encode}},{"safe-buffer":234}],7:[function(require,module,exports){(function(module,exports){"use strict";function assert(val,msg){if(!val)throw new Error(msg||"Assertion failed")}function inherits(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype;ctor.prototype=new TempCtor;ctor.prototype.constructor=ctor}function BN(number,base,endian){if(BN.isBN(number)){return number}this.negative=0;this.words=null;this.length=0;this.red=null;if(number!==null){if(base==="le"||base==="be"){endian=base;base=10}this._init(number||0,base||10,endian||"be")}}if(typeof module==="object"){module.exports=BN}else{exports.BN=BN}BN.BN=BN;BN.wordSize=26;var Buffer;try{Buffer=require("buffer").Buffer}catch(e){}BN.isBN=function isBN(num){if(num instanceof BN){return true}return num!==null&&typeof num==="object"&&num.constructor.wordSize===BN.wordSize&&Array.isArray(num.words)};BN.max=function max(left,right){if(left.cmp(right)>0)return left;return right};BN.min=function min(left,right){if(left.cmp(right)<0)return left;return right};BN.prototype._init=function init(number,base,endian){if(typeof number==="number"){return this._initNumber(number,base,endian)}if(typeof number==="object"){return this._initArray(number,base,endian)}if(base==="hex"){base=16}assert(base===(base|0)&&base>=2&&base<=36);number=number.toString().replace(/\s+/g,"");var start=0;if(number[0]==="-"){start++}if(base===16){this._parseHex(number,start)}else{this._parseBase(number,base,start)}if(number[0]==="-"){this.negative=1}this.strip();if(endian!=="le")return;this._initArray(this.toArray(),base,endian)};BN.prototype._initNumber=function _initNumber(number,base,endian){if(number<0){this.negative=1;number=-number}if(number<67108864){this.words=[number&67108863];this.length=1}else if(number<4503599627370496){this.words=[number&67108863,number/67108864&67108863];this.length=2}else{assert(number<9007199254740992);this.words=[number&67108863,number/67108864&67108863,1];this.length=3}if(endian!=="le")return;this._initArray(this.toArray(),base,endian)};BN.prototype._initArray=function _initArray(number,base,endian){assert(typeof number.length==="number");if(number.length<=0){this.words=[0];this.length=1;return this}this.length=Math.ceil(number.length/3);this.words=new Array(this.length);for(var i=0;i=0;i-=3){w=number[i]|number[i-1]<<8|number[i-2]<<16;this.words[j]|=w<>>26-off&67108863;off+=24;if(off>=26){off-=26;j++}}}else if(endian==="le"){for(i=0,j=0;i>>26-off&67108863;off+=24;if(off>=26){off-=26;j++}}}return this.strip()};function parseHex(str,start,end){var r=0;var len=Math.min(str.length,end);for(var i=start;i=49&&c<=54){r|=c-49+10}else if(c>=17&&c<=22){r|=c-17+10}else{r|=c&15}}return r}BN.prototype._parseHex=function _parseHex(number,start){this.length=Math.ceil((number.length-start)/6);this.words=new Array(this.length);for(var i=0;i=start;i-=6){w=parseHex(number,i,i+6);this.words[j]|=w<>>26-off&4194303;off+=24;if(off>=26){off-=26;j++}}if(i+6!==start){w=parseHex(number,start,i+6);this.words[j]|=w<>>26-off&4194303}this.strip()};function parseBase(str,start,end,mul){var r=0;var len=Math.min(str.length,end);for(var i=start;i=49){r+=c-49+10}else if(c>=17){r+=c-17+10}else{r+=c}}return r}BN.prototype._parseBase=function _parseBase(number,base,start){this.words=[0];this.length=1;for(var limbLen=0,limbPow=1;limbPow<=67108863;limbPow*=base){limbLen++}limbLen--;limbPow=limbPow/base|0;var total=number.length-start;var mod=total%limbLen;var end=Math.min(total,total-mod)+start;var word=0;for(var i=start;i1&&this.words[this.length-1]===0){this.length--}return this._normSign()};BN.prototype._normSign=function _normSign(){if(this.length===1&&this.words[0]===0){this.negative=0}return this};BN.prototype.inspect=function inspect(){return(this.red?""};var zeros=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"];var groupSizes=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5];var groupBases=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];BN.prototype.toString=function toString(base,padding){base=base||10;padding=padding|0||1;var out;if(base===16||base==="hex"){out="";var off=0;var carry=0;for(var i=0;i>>24-off&16777215;if(carry!==0||i!==this.length-1){out=zeros[6-word.length]+word+out}else{out=word+out}off+=2;if(off>=26){off-=26;i--}}if(carry!==0){out=carry.toString(16)+out}while(out.length%padding!==0){out="0"+out}if(this.negative!==0){out="-"+out}return out}if(base===(base|0)&&base>=2&&base<=36){var groupSize=groupSizes[base];var groupBase=groupBases[base];out="";var c=this.clone();c.negative=0;while(!c.isZero()){var r=c.modn(groupBase).toString(base);c=c.idivn(groupBase);if(!c.isZero()){out=zeros[groupSize-r.length]+r+out}else{out=r+out}}if(this.isZero()){out="0"+out}while(out.length%padding!==0){out="0"+out}if(this.negative!==0){out="-"+out}return out}assert(false,"Base should be between 2 and 36")};BN.prototype.toNumber=function toNumber(){var ret=this.words[0];if(this.length===2){ret+=this.words[1]*67108864}else if(this.length===3&&this.words[2]===1){ret+=4503599627370496+this.words[1]*67108864}else if(this.length>2){assert(false,"Number can only safely store up to 53 bits")}return this.negative!==0?-ret:ret};BN.prototype.toJSON=function toJSON(){return this.toString(16)};BN.prototype.toBuffer=function toBuffer(endian,length){assert(typeof Buffer!=="undefined");return this.toArrayLike(Buffer,endian,length)};BN.prototype.toArray=function toArray(endian,length){return this.toArrayLike(Array,endian,length)};BN.prototype.toArrayLike=function toArrayLike(ArrayType,endian,length){var byteLength=this.byteLength();var reqLength=length||Math.max(1,byteLength);assert(byteLength<=reqLength,"byte array longer than desired length");assert(reqLength>0,"Requested array length <= 0");this.strip();var littleEndian=endian==="le";var res=new ArrayType(reqLength);var b,i;var q=this.clone();if(!littleEndian){for(i=0;i=4096){r+=13;t>>>=13}if(t>=64){r+=7;t>>>=7}if(t>=8){r+=4;t>>>=4}if(t>=2){r+=2;t>>>=2}return r+t}}BN.prototype._zeroBits=function _zeroBits(w){if(w===0)return 26;var t=w;var r=0;if((t&8191)===0){r+=13;t>>>=13}if((t&127)===0){r+=7;t>>>=7}if((t&15)===0){r+=4;t>>>=4}if((t&3)===0){r+=2;t>>>=2}if((t&1)===0){r++}return r};BN.prototype.bitLength=function bitLength(){ var w=this.words[this.length-1];var hi=this._countBits(w);return(this.length-1)*26+hi};function toBitArray(num){var w=new Array(num.bitLength());for(var bit=0;bit>>wbit}return w}BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;var r=0;for(var i=0;inum.length)return this.clone().ior(num);return num.clone().ior(this)};BN.prototype.uor=function uor(num){if(this.length>num.length)return this.clone().iuor(num);return num.clone().iuor(this)};BN.prototype.iuand=function iuand(num){var b;if(this.length>num.length){b=num}else{b=this}for(var i=0;inum.length)return this.clone().iand(num);return num.clone().iand(this)};BN.prototype.uand=function uand(num){if(this.length>num.length)return this.clone().iuand(num);return num.clone().iuand(this)};BN.prototype.iuxor=function iuxor(num){var a;var b;if(this.length>num.length){a=this;b=num}else{a=num;b=this}for(var i=0;inum.length)return this.clone().ixor(num);return num.clone().ixor(this)};BN.prototype.uxor=function uxor(num){if(this.length>num.length)return this.clone().iuxor(num);return num.clone().iuxor(this)};BN.prototype.inotn=function inotn(width){assert(typeof width==="number"&&width>=0);var bytesNeeded=Math.ceil(width/26)|0;var bitsLeft=width%26;this._expand(bytesNeeded);if(bitsLeft>0){bytesNeeded--}for(var i=0;i0){this.words[i]=~this.words[i]&67108863>>26-bitsLeft}return this.strip()};BN.prototype.notn=function notn(width){return this.clone().inotn(width)};BN.prototype.setn=function setn(bit,val){assert(typeof bit==="number"&&bit>=0);var off=bit/26|0;var wbit=bit%26;this._expand(off+1);if(val){this.words[off]=this.words[off]|1<num.length){a=this;b=num}else{a=num;b=this}var carry=0;for(var i=0;i>>26}for(;carry!==0&&i>>26}this.length=a.length;if(carry!==0){this.words[this.length]=carry;this.length++}else if(a!==this){for(;inum.length)return this.clone().iadd(num);return num.clone().iadd(this)};BN.prototype.isub=function isub(num){if(num.negative!==0){num.negative=0;var r=this.iadd(num);num.negative=1;return r._normSign()}else if(this.negative!==0){this.negative=0;this.iadd(num);this.negative=1;return this._normSign()}var cmp=this.cmp(num);if(cmp===0){this.negative=0;this.length=1;this.words[0]=0;return this}var a,b;if(cmp>0){a=this;b=num}else{a=num;b=this}var carry=0;for(var i=0;i>26;this.words[i]=r&67108863}for(;carry!==0&&i>26;this.words[i]=r&67108863}if(carry===0&&i>>26;var rword=carry&67108863;var maxJ=Math.min(k,num.length-1);for(var j=Math.max(0,k-self.length+1);j<=maxJ;j++){var i=k-j|0;a=self.words[i]|0;b=num.words[j]|0;r=a*b+rword;ncarry+=r/67108864|0;rword=r&67108863}out.words[k]=rword|0;carry=ncarry|0}if(carry!==0){out.words[k]=carry|0}else{out.length--}return out.strip()}var comb10MulTo=function comb10MulTo(self,num,out){var a=self.words;var b=num.words;var o=out.words;var c=0;var lo;var mid;var hi;var a0=a[0]|0;var al0=a0&8191;var ah0=a0>>>13;var a1=a[1]|0;var al1=a1&8191;var ah1=a1>>>13;var a2=a[2]|0;var al2=a2&8191;var ah2=a2>>>13;var a3=a[3]|0;var al3=a3&8191;var ah3=a3>>>13;var a4=a[4]|0;var al4=a4&8191;var ah4=a4>>>13;var a5=a[5]|0;var al5=a5&8191;var ah5=a5>>>13;var a6=a[6]|0;var al6=a6&8191;var ah6=a6>>>13;var a7=a[7]|0;var al7=a7&8191;var ah7=a7>>>13;var a8=a[8]|0;var al8=a8&8191;var ah8=a8>>>13;var a9=a[9]|0;var al9=a9&8191;var ah9=a9>>>13;var b0=b[0]|0;var bl0=b0&8191;var bh0=b0>>>13;var b1=b[1]|0;var bl1=b1&8191;var bh1=b1>>>13;var b2=b[2]|0;var bl2=b2&8191;var bh2=b2>>>13;var b3=b[3]|0;var bl3=b3&8191;var bh3=b3>>>13;var b4=b[4]|0;var bl4=b4&8191;var bh4=b4>>>13;var b5=b[5]|0;var bl5=b5&8191;var bh5=b5>>>13;var b6=b[6]|0;var bl6=b6&8191;var bh6=b6>>>13;var b7=b[7]|0;var bl7=b7&8191;var bh7=b7>>>13;var b8=b[8]|0;var bl8=b8&8191;var bh8=b8>>>13;var b9=b[9]|0;var bl9=b9&8191;var bh9=b9>>>13;out.negative=self.negative^num.negative;out.length=19;lo=Math.imul(al0,bl0);mid=Math.imul(al0,bh0);mid=mid+Math.imul(ah0,bl0)|0;hi=Math.imul(ah0,bh0);var w0=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w0>>>26)|0;w0&=67108863;lo=Math.imul(al1,bl0);mid=Math.imul(al1,bh0);mid=mid+Math.imul(ah1,bl0)|0;hi=Math.imul(ah1,bh0);lo=lo+Math.imul(al0,bl1)|0;mid=mid+Math.imul(al0,bh1)|0;mid=mid+Math.imul(ah0,bl1)|0;hi=hi+Math.imul(ah0,bh1)|0;var w1=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w1>>>26)|0;w1&=67108863;lo=Math.imul(al2,bl0);mid=Math.imul(al2,bh0);mid=mid+Math.imul(ah2,bl0)|0;hi=Math.imul(ah2,bh0);lo=lo+Math.imul(al1,bl1)|0;mid=mid+Math.imul(al1,bh1)|0;mid=mid+Math.imul(ah1,bl1)|0;hi=hi+Math.imul(ah1,bh1)|0;lo=lo+Math.imul(al0,bl2)|0;mid=mid+Math.imul(al0,bh2)|0;mid=mid+Math.imul(ah0,bl2)|0;hi=hi+Math.imul(ah0,bh2)|0;var w2=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w2>>>26)|0;w2&=67108863;lo=Math.imul(al3,bl0);mid=Math.imul(al3,bh0);mid=mid+Math.imul(ah3,bl0)|0;hi=Math.imul(ah3,bh0);lo=lo+Math.imul(al2,bl1)|0;mid=mid+Math.imul(al2,bh1)|0;mid=mid+Math.imul(ah2,bl1)|0;hi=hi+Math.imul(ah2,bh1)|0;lo=lo+Math.imul(al1,bl2)|0;mid=mid+Math.imul(al1,bh2)|0;mid=mid+Math.imul(ah1,bl2)|0;hi=hi+Math.imul(ah1,bh2)|0;lo=lo+Math.imul(al0,bl3)|0;mid=mid+Math.imul(al0,bh3)|0;mid=mid+Math.imul(ah0,bl3)|0;hi=hi+Math.imul(ah0,bh3)|0;var w3=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w3>>>26)|0;w3&=67108863;lo=Math.imul(al4,bl0);mid=Math.imul(al4,bh0);mid=mid+Math.imul(ah4,bl0)|0;hi=Math.imul(ah4,bh0);lo=lo+Math.imul(al3,bl1)|0;mid=mid+Math.imul(al3,bh1)|0;mid=mid+Math.imul(ah3,bl1)|0;hi=hi+Math.imul(ah3,bh1)|0;lo=lo+Math.imul(al2,bl2)|0;mid=mid+Math.imul(al2,bh2)|0;mid=mid+Math.imul(ah2,bl2)|0;hi=hi+Math.imul(ah2,bh2)|0;lo=lo+Math.imul(al1,bl3)|0;mid=mid+Math.imul(al1,bh3)|0;mid=mid+Math.imul(ah1,bl3)|0;hi=hi+Math.imul(ah1,bh3)|0;lo=lo+Math.imul(al0,bl4)|0;mid=mid+Math.imul(al0,bh4)|0;mid=mid+Math.imul(ah0,bl4)|0;hi=hi+Math.imul(ah0,bh4)|0;var w4=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w4>>>26)|0;w4&=67108863;lo=Math.imul(al5,bl0);mid=Math.imul(al5,bh0);mid=mid+Math.imul(ah5,bl0)|0;hi=Math.imul(ah5,bh0);lo=lo+Math.imul(al4,bl1)|0;mid=mid+Math.imul(al4,bh1)|0;mid=mid+Math.imul(ah4,bl1)|0;hi=hi+Math.imul(ah4,bh1)|0;lo=lo+Math.imul(al3,bl2)|0;mid=mid+Math.imul(al3,bh2)|0;mid=mid+Math.imul(ah3,bl2)|0;hi=hi+Math.imul(ah3,bh2)|0;lo=lo+Math.imul(al2,bl3)|0;mid=mid+Math.imul(al2,bh3)|0;mid=mid+Math.imul(ah2,bl3)|0;hi=hi+Math.imul(ah2,bh3)|0;lo=lo+Math.imul(al1,bl4)|0;mid=mid+Math.imul(al1,bh4)|0;mid=mid+Math.imul(ah1,bl4)|0;hi=hi+Math.imul(ah1,bh4)|0;lo=lo+Math.imul(al0,bl5)|0;mid=mid+Math.imul(al0,bh5)|0;mid=mid+Math.imul(ah0,bl5)|0;hi=hi+Math.imul(ah0,bh5)|0;var w5=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w5>>>26)|0;w5&=67108863;lo=Math.imul(al6,bl0);mid=Math.imul(al6,bh0);mid=mid+Math.imul(ah6,bl0)|0;hi=Math.imul(ah6,bh0);lo=lo+Math.imul(al5,bl1)|0;mid=mid+Math.imul(al5,bh1)|0;mid=mid+Math.imul(ah5,bl1)|0;hi=hi+Math.imul(ah5,bh1)|0;lo=lo+Math.imul(al4,bl2)|0;mid=mid+Math.imul(al4,bh2)|0;mid=mid+Math.imul(ah4,bl2)|0;hi=hi+Math.imul(ah4,bh2)|0;lo=lo+Math.imul(al3,bl3)|0;mid=mid+Math.imul(al3,bh3)|0;mid=mid+Math.imul(ah3,bl3)|0;hi=hi+Math.imul(ah3,bh3)|0;lo=lo+Math.imul(al2,bl4)|0;mid=mid+Math.imul(al2,bh4)|0;mid=mid+Math.imul(ah2,bl4)|0;hi=hi+Math.imul(ah2,bh4)|0;lo=lo+Math.imul(al1,bl5)|0;mid=mid+Math.imul(al1,bh5)|0;mid=mid+Math.imul(ah1,bl5)|0;hi=hi+Math.imul(ah1,bh5)|0;lo=lo+Math.imul(al0,bl6)|0;mid=mid+Math.imul(al0,bh6)|0;mid=mid+Math.imul(ah0,bl6)|0;hi=hi+Math.imul(ah0,bh6)|0;var w6=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w6>>>26)|0;w6&=67108863;lo=Math.imul(al7,bl0);mid=Math.imul(al7,bh0);mid=mid+Math.imul(ah7,bl0)|0;hi=Math.imul(ah7,bh0);lo=lo+Math.imul(al6,bl1)|0;mid=mid+Math.imul(al6,bh1)|0;mid=mid+Math.imul(ah6,bl1)|0;hi=hi+Math.imul(ah6,bh1)|0;lo=lo+Math.imul(al5,bl2)|0;mid=mid+Math.imul(al5,bh2)|0;mid=mid+Math.imul(ah5,bl2)|0;hi=hi+Math.imul(ah5,bh2)|0;lo=lo+Math.imul(al4,bl3)|0;mid=mid+Math.imul(al4,bh3)|0;mid=mid+Math.imul(ah4,bl3)|0;hi=hi+Math.imul(ah4,bh3)|0;lo=lo+Math.imul(al3,bl4)|0;mid=mid+Math.imul(al3,bh4)|0;mid=mid+Math.imul(ah3,bl4)|0;hi=hi+Math.imul(ah3,bh4)|0;lo=lo+Math.imul(al2,bl5)|0;mid=mid+Math.imul(al2,bh5)|0;mid=mid+Math.imul(ah2,bl5)|0;hi=hi+Math.imul(ah2,bh5)|0;lo=lo+Math.imul(al1,bl6)|0;mid=mid+Math.imul(al1,bh6)|0;mid=mid+Math.imul(ah1,bl6)|0;hi=hi+Math.imul(ah1,bh6)|0;lo=lo+Math.imul(al0,bl7)|0;mid=mid+Math.imul(al0,bh7)|0;mid=mid+Math.imul(ah0,bl7)|0;hi=hi+Math.imul(ah0,bh7)|0;var w7=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w7>>>26)|0;w7&=67108863;lo=Math.imul(al8,bl0);mid=Math.imul(al8,bh0);mid=mid+Math.imul(ah8,bl0)|0;hi=Math.imul(ah8,bh0);lo=lo+Math.imul(al7,bl1)|0;mid=mid+Math.imul(al7,bh1)|0;mid=mid+Math.imul(ah7,bl1)|0;hi=hi+Math.imul(ah7,bh1)|0;lo=lo+Math.imul(al6,bl2)|0;mid=mid+Math.imul(al6,bh2)|0;mid=mid+Math.imul(ah6,bl2)|0;hi=hi+Math.imul(ah6,bh2)|0;lo=lo+Math.imul(al5,bl3)|0;mid=mid+Math.imul(al5,bh3)|0;mid=mid+Math.imul(ah5,bl3)|0;hi=hi+Math.imul(ah5,bh3)|0;lo=lo+Math.imul(al4,bl4)|0;mid=mid+Math.imul(al4,bh4)|0;mid=mid+Math.imul(ah4,bl4)|0;hi=hi+Math.imul(ah4,bh4)|0;lo=lo+Math.imul(al3,bl5)|0;mid=mid+Math.imul(al3,bh5)|0;mid=mid+Math.imul(ah3,bl5)|0;hi=hi+Math.imul(ah3,bh5)|0;lo=lo+Math.imul(al2,bl6)|0;mid=mid+Math.imul(al2,bh6)|0;mid=mid+Math.imul(ah2,bl6)|0;hi=hi+Math.imul(ah2,bh6)|0;lo=lo+Math.imul(al1,bl7)|0;mid=mid+Math.imul(al1,bh7)|0;mid=mid+Math.imul(ah1,bl7)|0;hi=hi+Math.imul(ah1,bh7)|0;lo=lo+Math.imul(al0,bl8)|0;mid=mid+Math.imul(al0,bh8)|0;mid=mid+Math.imul(ah0,bl8)|0;hi=hi+Math.imul(ah0,bh8)|0;var w8=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w8>>>26)|0;w8&=67108863;lo=Math.imul(al9,bl0);mid=Math.imul(al9,bh0);mid=mid+Math.imul(ah9,bl0)|0;hi=Math.imul(ah9,bh0);lo=lo+Math.imul(al8,bl1)|0;mid=mid+Math.imul(al8,bh1)|0;mid=mid+Math.imul(ah8,bl1)|0;hi=hi+Math.imul(ah8,bh1)|0;lo=lo+Math.imul(al7,bl2)|0;mid=mid+Math.imul(al7,bh2)|0;mid=mid+Math.imul(ah7,bl2)|0;hi=hi+Math.imul(ah7,bh2)|0;lo=lo+Math.imul(al6,bl3)|0;mid=mid+Math.imul(al6,bh3)|0;mid=mid+Math.imul(ah6,bl3)|0;hi=hi+Math.imul(ah6,bh3)|0;lo=lo+Math.imul(al5,bl4)|0;mid=mid+Math.imul(al5,bh4)|0;mid=mid+Math.imul(ah5,bl4)|0;hi=hi+Math.imul(ah5,bh4)|0;lo=lo+Math.imul(al4,bl5)|0;mid=mid+Math.imul(al4,bh5)|0;mid=mid+Math.imul(ah4,bl5)|0;hi=hi+Math.imul(ah4,bh5)|0;lo=lo+Math.imul(al3,bl6)|0;mid=mid+Math.imul(al3,bh6)|0;mid=mid+Math.imul(ah3,bl6)|0;hi=hi+Math.imul(ah3,bh6)|0;lo=lo+Math.imul(al2,bl7)|0;mid=mid+Math.imul(al2,bh7)|0;mid=mid+Math.imul(ah2,bl7)|0;hi=hi+Math.imul(ah2,bh7)|0;lo=lo+Math.imul(al1,bl8)|0;mid=mid+Math.imul(al1,bh8)|0;mid=mid+Math.imul(ah1,bl8)|0;hi=hi+Math.imul(ah1,bh8)|0;lo=lo+Math.imul(al0,bl9)|0;mid=mid+Math.imul(al0,bh9)|0;mid=mid+Math.imul(ah0,bl9)|0;hi=hi+Math.imul(ah0,bh9)|0;var w9=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w9>>>26)|0;w9&=67108863;lo=Math.imul(al9,bl1);mid=Math.imul(al9,bh1);mid=mid+Math.imul(ah9,bl1)|0;hi=Math.imul(ah9,bh1);lo=lo+Math.imul(al8,bl2)|0;mid=mid+Math.imul(al8,bh2)|0;mid=mid+Math.imul(ah8,bl2)|0;hi=hi+Math.imul(ah8,bh2)|0;lo=lo+Math.imul(al7,bl3)|0;mid=mid+Math.imul(al7,bh3)|0;mid=mid+Math.imul(ah7,bl3)|0;hi=hi+Math.imul(ah7,bh3)|0;lo=lo+Math.imul(al6,bl4)|0;mid=mid+Math.imul(al6,bh4)|0;mid=mid+Math.imul(ah6,bl4)|0;hi=hi+Math.imul(ah6,bh4)|0;lo=lo+Math.imul(al5,bl5)|0;mid=mid+Math.imul(al5,bh5)|0;mid=mid+Math.imul(ah5,bl5)|0;hi=hi+Math.imul(ah5,bh5)|0;lo=lo+Math.imul(al4,bl6)|0;mid=mid+Math.imul(al4,bh6)|0;mid=mid+Math.imul(ah4,bl6)|0;hi=hi+Math.imul(ah4,bh6)|0;lo=lo+Math.imul(al3,bl7)|0;mid=mid+Math.imul(al3,bh7)|0;mid=mid+Math.imul(ah3,bl7)|0;hi=hi+Math.imul(ah3,bh7)|0;lo=lo+Math.imul(al2,bl8)|0;mid=mid+Math.imul(al2,bh8)|0;mid=mid+Math.imul(ah2,bl8)|0;hi=hi+Math.imul(ah2,bh8)|0;lo=lo+Math.imul(al1,bl9)|0;mid=mid+Math.imul(al1,bh9)|0;mid=mid+Math.imul(ah1,bl9)|0;hi=hi+Math.imul(ah1,bh9)|0;var w10=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w10>>>26)|0;w10&=67108863;lo=Math.imul(al9,bl2);mid=Math.imul(al9,bh2);mid=mid+Math.imul(ah9,bl2)|0;hi=Math.imul(ah9,bh2);lo=lo+Math.imul(al8,bl3)|0;mid=mid+Math.imul(al8,bh3)|0;mid=mid+Math.imul(ah8,bl3)|0;hi=hi+Math.imul(ah8,bh3)|0;lo=lo+Math.imul(al7,bl4)|0;mid=mid+Math.imul(al7,bh4)|0;mid=mid+Math.imul(ah7,bl4)|0;hi=hi+Math.imul(ah7,bh4)|0;lo=lo+Math.imul(al6,bl5)|0;mid=mid+Math.imul(al6,bh5)|0;mid=mid+Math.imul(ah6,bl5)|0;hi=hi+Math.imul(ah6,bh5)|0;lo=lo+Math.imul(al5,bl6)|0;mid=mid+Math.imul(al5,bh6)|0;mid=mid+Math.imul(ah5,bl6)|0;hi=hi+Math.imul(ah5,bh6)|0;lo=lo+Math.imul(al4,bl7)|0;mid=mid+Math.imul(al4,bh7)|0;mid=mid+Math.imul(ah4,bl7)|0;hi=hi+Math.imul(ah4,bh7)|0;lo=lo+Math.imul(al3,bl8)|0;mid=mid+Math.imul(al3,bh8)|0;mid=mid+Math.imul(ah3,bl8)|0;hi=hi+Math.imul(ah3,bh8)|0;lo=lo+Math.imul(al2,bl9)|0;mid=mid+Math.imul(al2,bh9)|0;mid=mid+Math.imul(ah2,bl9)|0;hi=hi+Math.imul(ah2,bh9)|0;var w11=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w11>>>26)|0;w11&=67108863;lo=Math.imul(al9,bl3);mid=Math.imul(al9,bh3);mid=mid+Math.imul(ah9,bl3)|0;hi=Math.imul(ah9,bh3);lo=lo+Math.imul(al8,bl4)|0;mid=mid+Math.imul(al8,bh4)|0;mid=mid+Math.imul(ah8,bl4)|0;hi=hi+Math.imul(ah8,bh4)|0;lo=lo+Math.imul(al7,bl5)|0;mid=mid+Math.imul(al7,bh5)|0;mid=mid+Math.imul(ah7,bl5)|0;hi=hi+Math.imul(ah7,bh5)|0;lo=lo+Math.imul(al6,bl6)|0;mid=mid+Math.imul(al6,bh6)|0;mid=mid+Math.imul(ah6,bl6)|0;hi=hi+Math.imul(ah6,bh6)|0;lo=lo+Math.imul(al5,bl7)|0;mid=mid+Math.imul(al5,bh7)|0;mid=mid+Math.imul(ah5,bl7)|0;hi=hi+Math.imul(ah5,bh7)|0;lo=lo+Math.imul(al4,bl8)|0;mid=mid+Math.imul(al4,bh8)|0;mid=mid+Math.imul(ah4,bl8)|0;hi=hi+Math.imul(ah4,bh8)|0;lo=lo+Math.imul(al3,bl9)|0;mid=mid+Math.imul(al3,bh9)|0;mid=mid+Math.imul(ah3,bl9)|0;hi=hi+Math.imul(ah3,bh9)|0;var w12=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w12>>>26)|0;w12&=67108863;lo=Math.imul(al9,bl4);mid=Math.imul(al9,bh4);mid=mid+Math.imul(ah9,bl4)|0;hi=Math.imul(ah9,bh4);lo=lo+Math.imul(al8,bl5)|0;mid=mid+Math.imul(al8,bh5)|0;mid=mid+Math.imul(ah8,bl5)|0;hi=hi+Math.imul(ah8,bh5)|0;lo=lo+Math.imul(al7,bl6)|0;mid=mid+Math.imul(al7,bh6)|0;mid=mid+Math.imul(ah7,bl6)|0;hi=hi+Math.imul(ah7,bh6)|0;lo=lo+Math.imul(al6,bl7)|0;mid=mid+Math.imul(al6,bh7)|0;mid=mid+Math.imul(ah6,bl7)|0;hi=hi+Math.imul(ah6,bh7)|0;lo=lo+Math.imul(al5,bl8)|0;mid=mid+Math.imul(al5,bh8)|0;mid=mid+Math.imul(ah5,bl8)|0;hi=hi+Math.imul(ah5,bh8)|0;lo=lo+Math.imul(al4,bl9)|0;mid=mid+Math.imul(al4,bh9)|0;mid=mid+Math.imul(ah4,bl9)|0;hi=hi+Math.imul(ah4,bh9)|0;var w13=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w13>>>26)|0;w13&=67108863;lo=Math.imul(al9,bl5);mid=Math.imul(al9,bh5);mid=mid+Math.imul(ah9,bl5)|0;hi=Math.imul(ah9,bh5);lo=lo+Math.imul(al8,bl6)|0;mid=mid+Math.imul(al8,bh6)|0;mid=mid+Math.imul(ah8,bl6)|0;hi=hi+Math.imul(ah8,bh6)|0;lo=lo+Math.imul(al7,bl7)|0;mid=mid+Math.imul(al7,bh7)|0;mid=mid+Math.imul(ah7,bl7)|0;hi=hi+Math.imul(ah7,bh7)|0;lo=lo+Math.imul(al6,bl8)|0;mid=mid+Math.imul(al6,bh8)|0;mid=mid+Math.imul(ah6,bl8)|0;hi=hi+Math.imul(ah6,bh8)|0;lo=lo+Math.imul(al5,bl9)|0;mid=mid+Math.imul(al5,bh9)|0;mid=mid+Math.imul(ah5,bl9)|0;hi=hi+Math.imul(ah5,bh9)|0;var w14=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w14>>>26)|0;w14&=67108863;lo=Math.imul(al9,bl6);mid=Math.imul(al9,bh6);mid=mid+Math.imul(ah9,bl6)|0;hi=Math.imul(ah9,bh6);lo=lo+Math.imul(al8,bl7)|0;mid=mid+Math.imul(al8,bh7)|0;mid=mid+Math.imul(ah8,bl7)|0;hi=hi+Math.imul(ah8,bh7)|0;lo=lo+Math.imul(al7,bl8)|0;mid=mid+Math.imul(al7,bh8)|0;mid=mid+Math.imul(ah7,bl8)|0;hi=hi+Math.imul(ah7,bh8)|0;lo=lo+Math.imul(al6,bl9)|0;mid=mid+Math.imul(al6,bh9)|0;mid=mid+Math.imul(ah6,bl9)|0;hi=hi+Math.imul(ah6,bh9)|0;var w15=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w15>>>26)|0;w15&=67108863;lo=Math.imul(al9,bl7);mid=Math.imul(al9,bh7);mid=mid+Math.imul(ah9,bl7)|0;hi=Math.imul(ah9,bh7);lo=lo+Math.imul(al8,bl8)|0;mid=mid+Math.imul(al8,bh8)|0;mid=mid+Math.imul(ah8,bl8)|0;hi=hi+Math.imul(ah8,bh8)|0;lo=lo+Math.imul(al7,bl9)|0;mid=mid+Math.imul(al7,bh9)|0;mid=mid+Math.imul(ah7,bl9)|0;hi=hi+Math.imul(ah7,bh9)|0;var w16=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w16>>>26)|0;w16&=67108863;lo=Math.imul(al9,bl8);mid=Math.imul(al9,bh8);mid=mid+Math.imul(ah9,bl8)|0;hi=Math.imul(ah9,bh8);lo=lo+Math.imul(al8,bl9)|0;mid=mid+Math.imul(al8,bh9)|0;mid=mid+Math.imul(ah8,bl9)|0;hi=hi+Math.imul(ah8,bh9)|0;var w17=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w17>>>26)|0;w17&=67108863;lo=Math.imul(al9,bl9);mid=Math.imul(al9,bh9);mid=mid+Math.imul(ah9,bl9)|0;hi=Math.imul(ah9,bh9);var w18=(c+lo|0)+((mid&8191)<<13)|0;c=(hi+(mid>>>13)|0)+(w18>>>26)|0;w18&=67108863;o[0]=w0;o[1]=w1;o[2]=w2;o[3]=w3;o[4]=w4;o[5]=w5;o[6]=w6;o[7]=w7;o[8]=w8;o[9]=w9;o[10]=w10;o[11]=w11;o[12]=w12;o[13]=w13;o[14]=w14;o[15]=w15;o[16]=w16;o[17]=w17;o[18]=w18;if(c!==0){o[19]=c;out.length++}return out};if(!Math.imul){comb10MulTo=smallMulTo}function bigMulTo(self,num,out){out.negative=num.negative^self.negative;out.length=self.length+num.length;var carry=0;var hncarry=0;for(var k=0;k>>26)|0;hncarry+=ncarry>>>26;ncarry&=67108863}out.words[k]=rword;carry=ncarry;ncarry=hncarry}if(carry!==0){out.words[k]=carry}else{out.length--}return out.strip()}function jumboMulTo(self,num,out){var fftm=new FFTM;return fftm.mulp(self,num,out)}BN.prototype.mulTo=function mulTo(num,out){var res;var len=this.length+num.length;if(this.length===10&&num.length===10){res=comb10MulTo(this,num,out)}else if(len<63){res=smallMulTo(this,num,out)}else if(len<1024){res=bigMulTo(this,num,out)}else{res=jumboMulTo(this,num,out)}return res};function FFTM(x,y){this.x=x;this.y=y}FFTM.prototype.makeRBT=function makeRBT(N){var t=new Array(N);var l=BN.prototype._countBits(N)-1;for(var i=0;i>=1}return rb};FFTM.prototype.permute=function permute(rbt,rws,iws,rtws,itws,N){for(var i=0;i>>1){i++}return 1<>>13;rws[2*i+1]=carry&8191;carry=carry>>>13}for(i=2*len;i>=26;carry+=w/67108864|0;carry+=lo>>>26;this.words[i]=lo&67108863}if(carry!==0){this.words[i]=carry;this.length++}return this};BN.prototype.muln=function muln(num){return this.clone().imuln(num)};BN.prototype.sqr=function sqr(){return this.mul(this)};BN.prototype.isqr=function isqr(){return this.imul(this.clone())};BN.prototype.pow=function pow(num){var w=toBitArray(num);if(w.length===0)return new BN(1);var res=this;for(var i=0;i=0);var r=bits%26;var s=(bits-r)/26;var carryMask=67108863>>>26-r<<26-r;var i;if(r!==0){var carry=0;for(i=0;i>>26-r}if(carry){this.words[i]=carry;this.length++}}if(s!==0){for(i=this.length-1;i>=0;i--){this.words[i+s]=this.words[i]}for(i=0;i=0);var h;if(hint){h=(hint-hint%26)/26}else{h=0}var r=bits%26;var s=Math.min((bits-r)/26,this.length);var mask=67108863^67108863>>>r<s){this.length-=s;for(i=0;i=0&&(carry!==0||i>=h);i--){var word=this.words[i]|0;this.words[i]=carry<<26-r|word>>>r;carry=word&mask}if(maskedWords&&carry!==0){maskedWords.words[maskedWords.length++]=carry}if(this.length===0){this.words[0]=0;this.length=1}return this.strip()};BN.prototype.ishrn=function ishrn(bits,hint,extended){assert(this.negative===0);return this.iushrn(bits,hint,extended)};BN.prototype.shln=function shln(bits){return this.clone().ishln(bits)};BN.prototype.ushln=function ushln(bits){return this.clone().iushln(bits)};BN.prototype.shrn=function shrn(bits){return this.clone().ishrn(bits)};BN.prototype.ushrn=function ushrn(bits){return this.clone().iushrn(bits)};BN.prototype.testn=function testn(bit){assert(typeof bit==="number"&&bit>=0);var r=bit%26;var s=(bit-r)/26;var q=1<=0);var r=bits%26;var s=(bits-r)/26;assert(this.negative===0,"imaskn works only with positive numbers");if(this.length<=s){return this}if(r!==0){s++}this.length=Math.min(s,this.length);if(r!==0){var mask=67108863^67108863>>>r<=67108864;i++){this.words[i]-=67108864;if(i===this.length-1){this.words[i+1]=1}else{this.words[i+1]++}}this.length=Math.max(this.length,i+1);return this};BN.prototype.isubn=function isubn(num){assert(typeof num==="number");assert(num<67108864);if(num<0)return this.iaddn(-num);if(this.negative!==0){this.negative=0;this.iaddn(num);this.negative=1;return this}this.words[0]-=num;if(this.length===1&&this.words[0]<0){this.words[0]=-this.words[0];this.negative=1}else{for(var i=0;i>26)-(right/67108864|0);this.words[i+shift]=w&67108863}for(;i>26;this.words[i+shift]=w&67108863}if(carry===0)return this.strip();assert(carry===-1);carry=0;for(i=0;i>26;this.words[i]=w&67108863}this.negative=1;return this.strip()};BN.prototype._wordDiv=function _wordDiv(num,mode){var shift=this.length-num.length;var a=this.clone();var b=num;var bhi=b.words[b.length-1]|0;var bhiBits=this._countBits(bhi);shift=26-bhiBits;if(shift!==0){b=b.ushln(shift);a.iushln(shift);bhi=b.words[b.length-1]|0}var m=a.length-b.length;var q;if(mode!=="mod"){q=new BN(null);q.length=m+1;q.words=new Array(q.length);for(var i=0;i=0;j--){var qj=(a.words[b.length+j]|0)*67108864+(a.words[b.length+j-1]|0);qj=Math.min(qj/bhi|0,67108863);a._ishlnsubmul(b,qj,j);while(a.negative!==0){qj--;a.negative=0;a._ishlnsubmul(b,1,j);if(!a.isZero()){a.negative^=1}}if(q){q.words[j]=qj}}if(q){q.strip()}a.strip();if(mode!=="div"&&shift!==0){a.iushrn(shift)}return{div:q||null,mod:a}};BN.prototype.divmod=function divmod(num,mode,positive){assert(!num.isZero());if(this.isZero()){return{div:new BN(0),mod:new BN(0)}}var div,mod,res;if(this.negative!==0&&num.negative===0){res=this.neg().divmod(num,mode);if(mode!=="mod"){div=res.div.neg()}if(mode!=="div"){mod=res.mod.neg();if(positive&&mod.negative!==0){mod.iadd(num)}}return{div:div,mod:mod}}if(this.negative===0&&num.negative!==0){res=this.divmod(num.neg(),mode);if(mode!=="mod"){div=res.div.neg()}return{div:div,mod:res.mod}}if((this.negative&num.negative)!==0){res=this.neg().divmod(num.neg(),mode);if(mode!=="div"){mod=res.mod.neg();if(positive&&mod.negative!==0){mod.isub(num)}}return{div:res.div,mod:mod}}if(num.length>this.length||this.cmp(num)<0){return{div:new BN(0),mod:this}}if(num.length===1){if(mode==="div"){return{div:this.divn(num.words[0]),mod:null}}if(mode==="mod"){return{div:null,mod:new BN(this.modn(num.words[0]))}}return{div:this.divn(num.words[0]),mod:new BN(this.modn(num.words[0]))}}return this._wordDiv(num,mode)};BN.prototype.div=function div(num){return this.divmod(num,"div",false).div};BN.prototype.mod=function mod(num){return this.divmod(num,"mod",false).mod};BN.prototype.umod=function umod(num){return this.divmod(num,"mod",true).mod};BN.prototype.divRound=function divRound(num){var dm=this.divmod(num);if(dm.mod.isZero())return dm.div;var mod=dm.div.negative!==0?dm.mod.isub(num):dm.mod;var half=num.ushrn(1);var r2=num.andln(1);var cmp=mod.cmp(half);if(cmp<0||r2===1&&cmp===0)return dm.div;return dm.div.negative!==0?dm.div.isubn(1):dm.div.iaddn(1)};BN.prototype.modn=function modn(num){assert(num<=67108863);var p=(1<<26)%num;var acc=0;for(var i=this.length-1;i>=0;i--){acc=(p*acc+(this.words[i]|0))%num}return acc};BN.prototype.idivn=function idivn(num){assert(num<=67108863);var carry=0;for(var i=this.length-1;i>=0;i--){var w=(this.words[i]|0)+carry*67108864;this.words[i]=w/num|0;carry=w%num}return this.strip()};BN.prototype.divn=function divn(num){return this.clone().idivn(num)};BN.prototype.egcd=function egcd(p){assert(p.negative===0);assert(!p.isZero());var x=this;var y=p.clone();if(x.negative!==0){x=x.umod(p)}else{x=x.clone()}var A=new BN(1);var B=new BN(0);var C=new BN(0);var D=new BN(1);var g=0;while(x.isEven()&&y.isEven()){x.iushrn(1);y.iushrn(1);++g}var yp=y.clone();var xp=x.clone();while(!x.isZero()){for(var i=0,im=1;(x.words[0]&im)===0&&i<26;++i,im<<=1);if(i>0){x.iushrn(i);while(i-- >0){ if(A.isOdd()||B.isOdd()){A.iadd(yp);B.isub(xp)}A.iushrn(1);B.iushrn(1)}}for(var j=0,jm=1;(y.words[0]&jm)===0&&j<26;++j,jm<<=1);if(j>0){y.iushrn(j);while(j-- >0){if(C.isOdd()||D.isOdd()){C.iadd(yp);D.isub(xp)}C.iushrn(1);D.iushrn(1)}}if(x.cmp(y)>=0){x.isub(y);A.isub(C);B.isub(D)}else{y.isub(x);C.isub(A);D.isub(B)}}return{a:C,b:D,gcd:y.iushln(g)}};BN.prototype._invmp=function _invmp(p){assert(p.negative===0);assert(!p.isZero());var a=this;var b=p.clone();if(a.negative!==0){a=a.umod(p)}else{a=a.clone()}var x1=new BN(1);var x2=new BN(0);var delta=b.clone();while(a.cmpn(1)>0&&b.cmpn(1)>0){for(var i=0,im=1;(a.words[0]&im)===0&&i<26;++i,im<<=1);if(i>0){a.iushrn(i);while(i-- >0){if(x1.isOdd()){x1.iadd(delta)}x1.iushrn(1)}}for(var j=0,jm=1;(b.words[0]&jm)===0&&j<26;++j,jm<<=1);if(j>0){b.iushrn(j);while(j-- >0){if(x2.isOdd()){x2.iadd(delta)}x2.iushrn(1)}}if(a.cmp(b)>=0){a.isub(b);x1.isub(x2)}else{b.isub(a);x2.isub(x1)}}var res;if(a.cmpn(1)===0){res=x1}else{res=x2}if(res.cmpn(0)<0){res.iadd(p)}return res};BN.prototype.gcd=function gcd(num){if(this.isZero())return num.abs();if(num.isZero())return this.abs();var a=this.clone();var b=num.clone();a.negative=0;b.negative=0;for(var shift=0;a.isEven()&&b.isEven();shift++){a.iushrn(1);b.iushrn(1)}do{while(a.isEven()){a.iushrn(1)}while(b.isEven()){b.iushrn(1)}var r=a.cmp(b);if(r<0){var t=a;a=b;b=t}else if(r===0||b.cmpn(1)===0){break}a.isub(b)}while(true);return b.iushln(shift)};BN.prototype.invm=function invm(num){return this.egcd(num).a.umod(num)};BN.prototype.isEven=function isEven(){return(this.words[0]&1)===0};BN.prototype.isOdd=function isOdd(){return(this.words[0]&1)===1};BN.prototype.andln=function andln(num){return this.words[0]&num};BN.prototype.bincn=function bincn(bit){assert(typeof bit==="number");var r=bit%26;var s=(bit-r)/26;var q=1<>>26;w&=67108863;this.words[i]=w}if(carry!==0){this.words[i]=carry;this.length++}return this};BN.prototype.isZero=function isZero(){return this.length===1&&this.words[0]===0};BN.prototype.cmpn=function cmpn(num){var negative=num<0;if(this.negative!==0&&!negative)return-1;if(this.negative===0&&negative)return 1;this.strip();var res;if(this.length>1){res=1}else{if(negative){num=-num}assert(num<=67108863,"Number is too big");var w=this.words[0]|0;res=w===num?0:wnum.length)return 1;if(this.length=0;i--){var a=this.words[i]|0;var b=num.words[i]|0;if(a===b)continue;if(ab){res=1}break}return res};BN.prototype.gtn=function gtn(num){return this.cmpn(num)===1};BN.prototype.gt=function gt(num){return this.cmp(num)===1};BN.prototype.gten=function gten(num){return this.cmpn(num)>=0};BN.prototype.gte=function gte(num){return this.cmp(num)>=0};BN.prototype.ltn=function ltn(num){return this.cmpn(num)===-1};BN.prototype.lt=function lt(num){return this.cmp(num)===-1};BN.prototype.lten=function lten(num){return this.cmpn(num)<=0};BN.prototype.lte=function lte(num){return this.cmp(num)<=0};BN.prototype.eqn=function eqn(num){return this.cmpn(num)===0};BN.prototype.eq=function eq(num){return this.cmp(num)===0};BN.red=function red(num){return new Red(num)};BN.prototype.toRed=function toRed(ctx){assert(!this.red,"Already a number in reduction context");assert(this.negative===0,"red works only with positives");return ctx.convertTo(this)._forceRed(ctx)};BN.prototype.fromRed=function fromRed(){assert(this.red,"fromRed works only with numbers in reduction context");return this.red.convertFrom(this)};BN.prototype._forceRed=function _forceRed(ctx){this.red=ctx;return this};BN.prototype.forceRed=function forceRed(ctx){assert(!this.red,"Already a number in reduction context");return this._forceRed(ctx)};BN.prototype.redAdd=function redAdd(num){assert(this.red,"redAdd works only with red numbers");return this.red.add(this,num)};BN.prototype.redIAdd=function redIAdd(num){assert(this.red,"redIAdd works only with red numbers");return this.red.iadd(this,num)};BN.prototype.redSub=function redSub(num){assert(this.red,"redSub works only with red numbers");return this.red.sub(this,num)};BN.prototype.redISub=function redISub(num){assert(this.red,"redISub works only with red numbers");return this.red.isub(this,num)};BN.prototype.redShl=function redShl(num){assert(this.red,"redShl works only with red numbers");return this.red.shl(this,num)};BN.prototype.redMul=function redMul(num){assert(this.red,"redMul works only with red numbers");this.red._verify2(this,num);return this.red.mul(this,num)};BN.prototype.redIMul=function redIMul(num){assert(this.red,"redMul works only with red numbers");this.red._verify2(this,num);return this.red.imul(this,num)};BN.prototype.redSqr=function redSqr(){assert(this.red,"redSqr works only with red numbers");this.red._verify1(this);return this.red.sqr(this)};BN.prototype.redISqr=function redISqr(){assert(this.red,"redISqr works only with red numbers");this.red._verify1(this);return this.red.isqr(this)};BN.prototype.redSqrt=function redSqrt(){assert(this.red,"redSqrt works only with red numbers");this.red._verify1(this);return this.red.sqrt(this)};BN.prototype.redInvm=function redInvm(){assert(this.red,"redInvm works only with red numbers");this.red._verify1(this);return this.red.invm(this)};BN.prototype.redNeg=function redNeg(){assert(this.red,"redNeg works only with red numbers");this.red._verify1(this);return this.red.neg(this)};BN.prototype.redPow=function redPow(num){assert(this.red&&!num.red,"redPow(normalNum)");this.red._verify1(this);return this.red.pow(this,num)};var primes={k256:null,p224:null,p192:null,p25519:null};function MPrime(name,p){this.name=name;this.p=new BN(p,16);this.n=this.p.bitLength();this.k=new BN(1).iushln(this.n).isub(this.p);this.tmp=this._tmp()}MPrime.prototype._tmp=function _tmp(){var tmp=new BN(null);tmp.words=new Array(Math.ceil(this.n/13));return tmp};MPrime.prototype.ireduce=function ireduce(num){var r=num;var rlen;do{this.split(r,this.tmp);r=this.imulK(r);r=r.iadd(this.tmp);rlen=r.bitLength()}while(rlen>this.n);var cmp=rlen0){r.isub(this.p)}else{r.strip()}return r};MPrime.prototype.split=function split(input,out){input.iushrn(this.n,0,out)};MPrime.prototype.imulK=function imulK(num){return num.imul(this.k)};function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}inherits(K256,MPrime);K256.prototype.split=function split(input,output){var mask=4194303;var outLen=Math.min(input.length,9);for(var i=0;i>>22;prev=next}prev>>>=22;input.words[i-10]=prev;if(prev===0&&input.length>10){input.length-=10}else{input.length-=9}};K256.prototype.imulK=function imulK(num){num.words[num.length]=0;num.words[num.length+1]=0;num.length+=2;var lo=0;for(var i=0;i>>=26;num.words[i]=lo;carry=hi}if(carry!==0){num.words[num.length++]=carry}return num};BN._prime=function prime(name){if(primes[name])return primes[name];var prime;if(name==="k256"){prime=new K256}else if(name==="p224"){prime=new P224}else if(name==="p192"){prime=new P192}else if(name==="p25519"){prime=new P25519}else{throw new Error("Unknown prime "+name)}primes[name]=prime;return prime};function Red(m){if(typeof m==="string"){var prime=BN._prime(m);this.m=prime.p;this.prime=prime}else{assert(m.gtn(1),"modulus must be greater than 1");this.m=m;this.prime=null}}Red.prototype._verify1=function _verify1(a){assert(a.negative===0,"red works only with positives");assert(a.red,"red works only with red numbers")};Red.prototype._verify2=function _verify2(a,b){assert((a.negative|b.negative)===0,"red works only with positives");assert(a.red&&a.red===b.red,"red works only with red numbers")};Red.prototype.imod=function imod(a){if(this.prime)return this.prime.ireduce(a)._forceRed(this);return a.umod(this.m)._forceRed(this)};Red.prototype.neg=function neg(a){if(a.isZero()){return a.clone()}return this.m.sub(a)._forceRed(this)};Red.prototype.add=function add(a,b){this._verify2(a,b);var res=a.add(b);if(res.cmp(this.m)>=0){res.isub(this.m)}return res._forceRed(this)};Red.prototype.iadd=function iadd(a,b){this._verify2(a,b);var res=a.iadd(b);if(res.cmp(this.m)>=0){res.isub(this.m)}return res};Red.prototype.sub=function sub(a,b){this._verify2(a,b);var res=a.sub(b);if(res.cmpn(0)<0){res.iadd(this.m)}return res._forceRed(this)};Red.prototype.isub=function isub(a,b){this._verify2(a,b);var res=a.isub(b);if(res.cmpn(0)<0){res.iadd(this.m)}return res};Red.prototype.shl=function shl(a,num){this._verify1(a);return this.imod(a.ushln(num))};Red.prototype.imul=function imul(a,b){this._verify2(a,b);return this.imod(a.imul(b))};Red.prototype.mul=function mul(a,b){this._verify2(a,b);return this.imod(a.mul(b))};Red.prototype.isqr=function isqr(a){return this.imul(a,a.clone())};Red.prototype.sqr=function sqr(a){return this.mul(a,a)};Red.prototype.sqrt=function sqrt(a){if(a.isZero())return a.clone();var mod3=this.m.andln(3);assert(mod3%2===1);if(mod3===3){var pow=this.m.add(new BN(1)).iushrn(2);return this.pow(a,pow)}var q=this.m.subn(1);var s=0;while(!q.isZero()&&q.andln(1)===0){s++;q.iushrn(1)}assert(!q.isZero());var one=new BN(1).toRed(this);var nOne=one.redNeg();var lpow=this.m.subn(1).iushrn(1);var z=this.m.bitLength();z=new BN(2*z*z).toRed(this);while(this.pow(z,lpow).cmp(nOne)!==0){z.redIAdd(nOne)}var c=this.pow(z,q);var r=this.pow(a,q.addn(1).iushrn(1));var t=this.pow(a,q);var m=s;while(t.cmp(one)!==0){var tmp=t;for(var i=0;tmp.cmp(one)!==0;i++){tmp=tmp.redSqr()}assert(i=0;i--){var word=num.words[i];for(var j=start-1;j>=0;j--){var bit=word>>j&1;if(res!==wnd[0]){res=this.sqr(res)}if(bit===0&¤t===0){currentLen=0;continue}current<<=1;current|=bit;currentLen++;if(currentLen!==windowSize&&(i!==0||j!==0))continue;res=this.mul(res,wnd[current]);currentLen=0;current=0}start=26}return res};Red.prototype.convertTo=function convertTo(num){var r=num.umod(this.m);return r===num?r.clone():r};Red.prototype.convertFrom=function convertFrom(num){var res=num.clone();res.red=null;return res};BN.mont=function mont(num){return new Mont(num)};function Mont(m){Red.call(this,m);this.shift=this.m.bitLength();if(this.shift%26!==0){this.shift+=26-this.shift%26}this.r=new BN(1).iushln(this.shift);this.r2=this.imod(this.r.sqr());this.rinv=this.r._invmp(this.m);this.minv=this.rinv.mul(this.r).isubn(1).div(this.m);this.minv=this.minv.umod(this.r);this.minv=this.r.sub(this.minv)}inherits(Mont,Red);Mont.prototype.convertTo=function convertTo(num){return this.imod(num.ushln(this.shift))};Mont.prototype.convertFrom=function convertFrom(num){var r=this.imod(num.mul(this.rinv));r.red=null;return r};Mont.prototype.imul=function imul(a,b){if(a.isZero()||b.isZero()){a.words[0]=0;a.length=1;return a}var t=a.imul(b);var c=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);var u=t.isub(c).iushrn(this.shift);var res=u;if(u.cmp(this.m)>=0){res=u.isub(this.m)}else if(u.cmpn(0)<0){res=u.iadd(this.m)}return res._forceRed(this)};Mont.prototype.mul=function mul(a,b){if(a.isZero()||b.isZero())return new BN(0)._forceRed(this);var t=a.mul(b);var c=t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);var u=t.isub(c).iushrn(this.shift);var res=u;if(u.cmp(this.m)>=0){res=u.isub(this.m)}else if(u.cmpn(0)<0){res=u.iadd(this.m)}return res._forceRed(this)};Mont.prototype.invm=function invm(a){var res=this.imod(a._invmp(this.m).mul(this.r2));return res._forceRed(this)}})(typeof module==="undefined"||module,this)},{buffer:10}],8:[function(require,module,exports){var r;module.exports=function rand(len){if(!r)r=new Rand(null);return r.generate(len)};function Rand(rand){this.rand=rand}module.exports.Rand=Rand;Rand.prototype.generate=function generate(len){return this._rand(len)};Rand.prototype._rand=function _rand(n){if(this.rand.getBytes)return this.rand.getBytes(n);var res=new Uint8Array(n);for(var i=0;i299)&&body.error){er=new Error("CouchDB error: "+(body.error.reason||body.error.error));for(var key in body)er[key]=body[key];return callback(er,resp,body)}return callback(er,resp,body)}};function noop(){}function getLogger(){var logger={},levels=["trace","debug","info","warn","error"],level,i;for(i=0;i>18&63;h2=bits>>12&63;h3=bits>>6&63;h4=bits&63;tmp_arr[ac++]=b64.charAt(h1)+b64.charAt(h2)+b64.charAt(h3)+b64.charAt(h4)}while(i=this.charLength-this.charReceived?this.charLength-this.charReceived:buffer.length;buffer.copy(this.charBuffer,this.charReceived,0,available);this.charReceived+=available;if(this.charReceived=55296&&charCode<=56319){this.charLength+=this.surrogateSize;charStr="";continue}this.charReceived=this.charLength=0;if(buffer.length===0){return charStr}break}this.detectIncompleteChar(buffer);var end=buffer.length;if(this.charLength){buffer.copy(this.charBuffer,0,buffer.length-this.charReceived,end);end-=this.charReceived}charStr+=buffer.toString(this.encoding,0,end);var end=charStr.length-1;var charCode=charStr.charCodeAt(end);if(charCode>=55296&&charCode<=56319){var size=this.surrogateSize;this.charLength+=size;this.charReceived+=size;this.charBuffer.copy(this.charBuffer,size,0,size);buffer.copy(this.charBuffer,0,0,size);return charStr.substring(0,end)}return charStr};StringDecoder.prototype.detectIncompleteChar=function(buffer){var i=buffer.length>=3?3:buffer.length;for(;i>0;i--){var c=buffer[buffer.length-i];if(i==1&&c>>5==6){this.charLength=2;break}if(i<=2&&c>>4==14){this.charLength=3;break}if(i<=3&&c>>3==30){this.charLength=4;break}}this.charReceived=i};StringDecoder.prototype.end=function(buffer){var res="";if(buffer&&buffer.length)res=this.write(buffer);if(this.charReceived){var cr=this.charReceived;var buf=this.charBuffer;var enc=this.encoding;res+=buf.slice(0,cr).toString(enc)}return res};function passThroughWrite(buffer){return buffer.toString(this.encoding)}function utf16DetectIncompleteChar(buffer){this.charReceived=buffer.length%2;this.charLength=this.charReceived?2:0}function base64DetectIncompleteChar(buffer){this.charReceived=buffer.length%3;this.charLength=this.charReceived?3:0}},{buffer:14}],14:[function(require,module,exports){(function(global){"use strict";var base64=require("base64-js");var ieee754=require("ieee754");var isArray=require("isarray");exports.Buffer=Buffer;exports.SlowBuffer=SlowBuffer;exports.INSPECT_MAX_BYTES=50;Buffer.poolSize=8192;var rootParent={};Buffer.TYPED_ARRAY_SUPPORT=global.TYPED_ARRAY_SUPPORT!==undefined?global.TYPED_ARRAY_SUPPORT:typedArraySupport();function typedArraySupport(){function Bar(){}try{var arr=new Uint8Array(1);arr.foo=function(){return 42};arr.constructor=Bar;return arr.foo()===42&&arr.constructor===Bar&&typeof arr.subarray==="function"&&arr.subarray(1,1).byteLength===0}catch(e){return false}}function kMaxLength(){return Buffer.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Buffer(arg){if(!(this instanceof Buffer)){if(arguments.length>1)return new Buffer(arg,arguments[1]);return new Buffer(arg)}if(!Buffer.TYPED_ARRAY_SUPPORT){this.length=0;this.parent=undefined}if(typeof arg==="number"){return fromNumber(this,arg)}if(typeof arg==="string"){return fromString(this,arg,arguments.length>1?arguments[1]:"utf8")}return fromObject(this,arg)}function fromNumber(that,length){that=allocate(that,length<0?0:checked(length)|0);if(!Buffer.TYPED_ARRAY_SUPPORT){for(var i=0;i>>1;if(fromPool)that.parent=rootParent;return that}function checked(length){if(length>=kMaxLength()){throw new RangeError("Attempt to allocate Buffer larger than maximum "+"size: 0x"+kMaxLength().toString(16)+" bytes")}return length|0}function SlowBuffer(subject,encoding){if(!(this instanceof SlowBuffer))return new SlowBuffer(subject,encoding);var buf=new Buffer(subject,encoding);delete buf.parent;return buf}Buffer.isBuffer=function isBuffer(b){return!!(b!=null&&b._isBuffer)};Buffer.compare=function compare(a,b){if(!Buffer.isBuffer(a)||!Buffer.isBuffer(b)){throw new TypeError("Arguments must be Buffers")}if(a===b)return 0;var x=a.length;var y=b.length;var i=0;var len=Math.min(x,y);while(i>>1;case"base64":return base64ToBytes(string).length;default:if(loweredCase)return utf8ToBytes(string).length;encoding=(""+encoding).toLowerCase();loweredCase=true}}}Buffer.byteLength=byteLength;function slowToString(encoding,start,end){var loweredCase=false;start=start|0;end=end===undefined||end===Infinity?this.length:end|0;if(!encoding)encoding="utf8";if(start<0)start=0;if(end>this.length)end=this.length;if(end<=start)return"";while(true){switch(encoding){case"hex":return hexSlice(this,start,end);case"utf8":case"utf-8":return utf8Slice(this,start,end);case"ascii":return asciiSlice(this,start,end);case"binary":return binarySlice(this,start,end);case"base64":return base64Slice(this,start,end);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,start,end);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(encoding+"").toLowerCase();loweredCase=true}}}Buffer.prototype.toString=function toString(){var length=this.length|0;if(length===0)return"";if(arguments.length===0)return utf8Slice(this,0,length);return slowToString.apply(this,arguments)};Buffer.prototype.equals=function equals(b){if(!Buffer.isBuffer(b))throw new TypeError("Argument must be a Buffer");if(this===b)return true;return Buffer.compare(this,b)===0};Buffer.prototype.inspect=function inspect(){var str="";var max=exports.INSPECT_MAX_BYTES;if(this.length>0){str=this.toString("hex",0,max).match(/.{2}/g).join(" ");if(this.length>max)str+=" ... "}return""};Buffer.prototype.compare=function compare(b){if(!Buffer.isBuffer(b))throw new TypeError("Argument must be a Buffer");if(this===b)return 0;return Buffer.compare(this,b)};Buffer.prototype.indexOf=function indexOf(val,byteOffset){if(byteOffset>2147483647)byteOffset=2147483647;else if(byteOffset<-2147483648)byteOffset=-2147483648;byteOffset>>=0;if(this.length===0)return-1;if(byteOffset>=this.length)return-1;if(byteOffset<0)byteOffset=Math.max(this.length+byteOffset,0);if(typeof val==="string"){if(val.length===0)return-1;return String.prototype.indexOf.call(this,val,byteOffset)}if(Buffer.isBuffer(val)){return arrayIndexOf(this,val,byteOffset)}if(typeof val==="number"){if(Buffer.TYPED_ARRAY_SUPPORT&&Uint8Array.prototype.indexOf==="function"){return Uint8Array.prototype.indexOf.call(this,val,byteOffset)}return arrayIndexOf(this,[val],byteOffset)}function arrayIndexOf(arr,val,byteOffset){var foundIndex=-1;for(var i=0;byteOffset+iremaining){length=remaining}}var strLen=string.length;if(strLen%2!==0)throw new Error("Invalid hex string");if(length>strLen/2){length=strLen/2}for(var i=0;iremaining)length=remaining;if(string.length>0&&(length<0||offset<0)||offset>this.length){throw new RangeError("attempt to write outside buffer bounds")}if(!encoding)encoding="utf8";var loweredCase=false;for(;;){switch(encoding){case"hex":return hexWrite(this,string,offset,length);case"utf8":case"utf-8":return utf8Write(this,string,offset,length);case"ascii":return asciiWrite(this,string,offset,length);case"binary":return binaryWrite(this,string,offset,length);case"base64":return base64Write(this,string,offset,length);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,string,offset,length);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(""+encoding).toLowerCase();loweredCase=true}}};Buffer.prototype.toJSON=function toJSON(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function base64Slice(buf,start,end){if(start===0&&end===buf.length){return base64.fromByteArray(buf)}else{return base64.fromByteArray(buf.slice(start,end))}}function utf8Slice(buf,start,end){end=Math.min(buf.length,end);var res=[];var i=start;while(i239?4:firstByte>223?3:firstByte>191?2:1;if(i+bytesPerSequence<=end){var secondByte,thirdByte,fourthByte,tempCodePoint;switch(bytesPerSequence){case 1:if(firstByte<128){codePoint=firstByte}break;case 2:secondByte=buf[i+1];if((secondByte&192)===128){tempCodePoint=(firstByte&31)<<6|secondByte&63;if(tempCodePoint>127){codePoint=tempCodePoint}}break;case 3:secondByte=buf[i+1];thirdByte=buf[i+2];if((secondByte&192)===128&&(thirdByte&192)===128){tempCodePoint=(firstByte&15)<<12|(secondByte&63)<<6|thirdByte&63;if(tempCodePoint>2047&&(tempCodePoint<55296||tempCodePoint>57343)){codePoint=tempCodePoint}}break;case 4:secondByte=buf[i+1];thirdByte=buf[i+2];fourthByte=buf[i+3];if((secondByte&192)===128&&(thirdByte&192)===128&&(fourthByte&192)===128){tempCodePoint=(firstByte&15)<<18|(secondByte&63)<<12|(thirdByte&63)<<6|fourthByte&63;if(tempCodePoint>65535&&tempCodePoint<1114112){codePoint=tempCodePoint}}}}if(codePoint===null){codePoint=65533;bytesPerSequence=1}else if(codePoint>65535){codePoint-=65536;res.push(codePoint>>>10&1023|55296);codePoint=56320|codePoint&1023}res.push(codePoint);i+=bytesPerSequence}return decodeCodePointsArray(res)}var MAX_ARGUMENTS_LENGTH=4096;function decodeCodePointsArray(codePoints){var len=codePoints.length;if(len<=MAX_ARGUMENTS_LENGTH){return String.fromCharCode.apply(String,codePoints)}var res="";var i=0;while(ilen)end=len;var out="";for(var i=start;ilen){start=len}if(end<0){end+=len;if(end<0)end=0}else if(end>len){end=len}if(endlength)throw new RangeError("Trying to access beyond buffer length")}Buffer.prototype.readUIntLE=function readUIntLE(offset,byteLength,noAssert){offset=offset|0;byteLength=byteLength|0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i0&&(mul*=256)){val+=this[offset+--byteLength]*mul}return val};Buffer.prototype.readUInt8=function readUInt8(offset,noAssert){if(!noAssert)checkOffset(offset,1,this.length);return this[offset]};Buffer.prototype.readUInt16LE=function readUInt16LE(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);return this[offset]|this[offset+1]<<8};Buffer.prototype.readUInt16BE=function readUInt16BE(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);return this[offset]<<8|this[offset+1]};Buffer.prototype.readUInt32LE=function readUInt32LE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return(this[offset]|this[offset+1]<<8|this[offset+2]<<16)+this[offset+3]*16777216};Buffer.prototype.readUInt32BE=function readUInt32BE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]*16777216+(this[offset+1]<<16|this[offset+2]<<8|this[offset+3])};Buffer.prototype.readIntLE=function readIntLE(offset,byteLength,noAssert){offset=offset|0;byteLength=byteLength|0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readIntBE=function readIntBE(offset,byteLength,noAssert){offset=offset|0;byteLength=byteLength|0;if(!noAssert)checkOffset(offset,byteLength,this.length);var i=byteLength;var mul=1;var val=this[offset+--i];while(i>0&&(mul*=256)){val+=this[offset+--i]*mul}mul*=128;if(val>=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readInt8=function readInt8(offset,noAssert){if(!noAssert)checkOffset(offset,1,this.length);if(!(this[offset]&128))return this[offset];return(255-this[offset]+1)*-1};Buffer.prototype.readInt16LE=function readInt16LE(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset]|this[offset+1]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt16BE=function readInt16BE(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset+1]|this[offset]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt32LE=function readInt32LE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]|this[offset+1]<<8|this[offset+2]<<16|this[offset+3]<<24};Buffer.prototype.readInt32BE=function readInt32BE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]<<24|this[offset+1]<<16|this[offset+2]<<8|this[offset+3]};Buffer.prototype.readFloatLE=function readFloatLE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,true,23,4)};Buffer.prototype.readFloatBE=function readFloatBE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,false,23,4)};Buffer.prototype.readDoubleLE=function readDoubleLE(offset,noAssert){if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,true,52,8)};Buffer.prototype.readDoubleBE=function readDoubleBE(offset,noAssert){if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,false,52,8)};function checkInt(buf,value,offset,ext,max,min){if(!Buffer.isBuffer(buf))throw new TypeError("buffer must be a Buffer instance");if(value>max||valuebuf.length)throw new RangeError("index out of range")}Buffer.prototype.writeUIntLE=function writeUIntLE(value,offset,byteLength,noAssert){value=+value;offset=offset|0;byteLength=byteLength|0;if(!noAssert)checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength),0);var mul=1;var i=0;this[offset]=value&255;while(++i=0&&(mul*=256)){this[offset+i]=value/mul&255}return offset+byteLength};Buffer.prototype.writeUInt8=function writeUInt8(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,1,255,0);if(!Buffer.TYPED_ARRAY_SUPPORT)value=Math.floor(value);this[offset]=value&255;return offset+1};function objectWriteUInt16(buf,value,offset,littleEndian){if(value<0)value=65535+value+1;for(var i=0,j=Math.min(buf.length-offset,2);i>>(littleEndian?i:1-i)*8}}Buffer.prototype.writeUInt16LE=function writeUInt16LE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,2,65535,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value&255;this[offset+1]=value>>>8}else{objectWriteUInt16(this,value,offset,true)}return offset+2};Buffer.prototype.writeUInt16BE=function writeUInt16BE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,2,65535,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>8;this[offset+1]=value&255}else{objectWriteUInt16(this,value,offset,false)}return offset+2};function objectWriteUInt32(buf,value,offset,littleEndian){if(value<0)value=4294967295+value+1;for(var i=0,j=Math.min(buf.length-offset,4);i>>(littleEndian?i:3-i)*8&255}}Buffer.prototype.writeUInt32LE=function writeUInt32LE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset+3]=value>>>24;this[offset+2]=value>>>16;this[offset+1]=value>>>8;this[offset]=value&255}else{objectWriteUInt32(this,value,offset,true)}return offset+4};Buffer.prototype.writeUInt32BE=function writeUInt32BE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value&255}else{objectWriteUInt32(this,value,offset,false)}return offset+4};Buffer.prototype.writeIntLE=function writeIntLE(value,offset,byteLength,noAssert){value=+value;offset=offset|0;if(!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=0;var mul=1;var sub=value<0?1:0;this[offset]=value&255;while(++i>0)-sub&255}return offset+byteLength};Buffer.prototype.writeIntBE=function writeIntBE(value,offset,byteLength,noAssert){value=+value;offset=offset|0;if(!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=byteLength-1;var mul=1;var sub=value<0?1:0;this[offset+i]=value&255;while(--i>=0&&(mul*=256)){this[offset+i]=(value/mul>>0)-sub&255}return offset+byteLength};Buffer.prototype.writeInt8=function writeInt8(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,1,127,-128);if(!Buffer.TYPED_ARRAY_SUPPORT)value=Math.floor(value);if(value<0)value=255+value+1;this[offset]=value&255;return offset+1};Buffer.prototype.writeInt16LE=function writeInt16LE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value&255;this[offset+1]=value>>>8}else{objectWriteUInt16(this,value,offset,true)}return offset+2};Buffer.prototype.writeInt16BE=function writeInt16BE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>8;this[offset+1]=value&255}else{objectWriteUInt16(this,value,offset,false)}return offset+2};Buffer.prototype.writeInt32LE=function writeInt32LE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value&255;this[offset+1]=value>>>8;this[offset+2]=value>>>16;this[offset+3]=value>>>24}else{objectWriteUInt32(this,value,offset,true)}return offset+4};Buffer.prototype.writeInt32BE=function writeInt32BE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(value<0)value=4294967295+value+1;if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value&255}else{objectWriteUInt32(this,value,offset,false)}return offset+4};function checkIEEE754(buf,value,offset,ext,max,min){if(value>max||valuebuf.length)throw new RangeError("index out of range");if(offset<0)throw new RangeError("index out of range")}function writeFloat(buf,value,offset,littleEndian,noAssert){if(!noAssert){checkIEEE754(buf,value,offset,4,3.4028234663852886e38,-3.4028234663852886e38)}ieee754.write(buf,value,offset,littleEndian,23,4);return offset+4}Buffer.prototype.writeFloatLE=function writeFloatLE(value,offset,noAssert){return writeFloat(this,value,offset,true,noAssert)};Buffer.prototype.writeFloatBE=function writeFloatBE(value,offset,noAssert){return writeFloat(this,value,offset,false,noAssert)};function writeDouble(buf,value,offset,littleEndian,noAssert){if(!noAssert){checkIEEE754(buf,value,offset,8,1.7976931348623157e308,-1.7976931348623157e308)}ieee754.write(buf,value,offset,littleEndian,52,8);return offset+8}Buffer.prototype.writeDoubleLE=function writeDoubleLE(value,offset,noAssert){return writeDouble(this,value,offset,true,noAssert)};Buffer.prototype.writeDoubleBE=function writeDoubleBE(value,offset,noAssert){return writeDouble(this,value,offset,false,noAssert)};Buffer.prototype.copy=function copy(target,targetStart,start,end){if(!start)start=0;if(!end&&end!==0)end=this.length;if(targetStart>=target.length)targetStart=target.length;if(!targetStart)targetStart=0;if(end>0&&end=this.length)throw new RangeError("sourceStart out of bounds");if(end<0)throw new RangeError("sourceEnd out of bounds");if(end>this.length)end=this.length;if(target.length-targetStart=0;i--){target[i+targetStart]=this[i+start]}}else if(len<1e3||!Buffer.TYPED_ARRAY_SUPPORT){for(i=0;i=this.length)throw new RangeError("start out of bounds");if(end<0||end>this.length)throw new RangeError("end out of bounds");var i;if(typeof value==="number"){for(i=start;i55295&&codePoint<57344){if(!leadSurrogate){if(codePoint>56319){if((units-=3)>-1)bytes.push(239,191,189);continue}else if(i+1===length){if((units-=3)>-1)bytes.push(239,191,189);continue}leadSurrogate=codePoint;continue}if(codePoint<56320){if((units-=3)>-1)bytes.push(239,191,189);leadSurrogate=codePoint;continue}codePoint=(leadSurrogate-55296<<10|codePoint-56320)+65536}else if(leadSurrogate){if((units-=3)>-1)bytes.push(239,191,189)}leadSurrogate=null;if(codePoint<128){if((units-=1)<0)break;bytes.push(codePoint)}else if(codePoint<2048){if((units-=2)<0)break;bytes.push(codePoint>>6|192,codePoint&63|128)}else if(codePoint<65536){if((units-=3)<0)break;bytes.push(codePoint>>12|224,codePoint>>6&63|128,codePoint&63|128)}else if(codePoint<1114112){if((units-=4)<0)break;bytes.push(codePoint>>18|240,codePoint>>12&63|128,codePoint>>6&63|128,codePoint&63|128)}else{throw new Error("Invalid code point")}}return bytes}function asciiToBytes(str){var byteArray=[];for(var i=0;i>8;lo=c%256;byteArray.push(lo);byteArray.push(hi)}return byteArray}function base64ToBytes(str){return base64.toByteArray(base64clean(str))}function blitBuffer(src,dst,offset,length){for(var i=0;i=dst.length||i>=src.length)break;dst[i+offset]=src[i]}return i}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"base64-js":4,ieee754:177,isarray:183}],15:[function(require,module,exports){var Buffer=require("safe-buffer").Buffer;var Transform=require("stream").Transform;var StringDecoder=require("string_decoder").StringDecoder;var inherits=require("inherits");function CipherBase(hashMode){Transform.call(this);this.hashMode=typeof hashMode==="string";if(this.hashMode){this[hashMode]=this._finalOrDigest}else{this.final=this._finalOrDigest}if(this._final){this.__final=this._final;this._final=null}this._decoder=null;this._encoding=null}inherits(CipherBase,Transform);CipherBase.prototype.update=function(data,inputEnc,outputEnc){if(typeof data==="string"){data=Buffer.from(data,inputEnc)}var outData=this._update(data);if(this.hashMode)return this;if(outputEnc){outData=this._toString(outData,outputEnc)}return outData};CipherBase.prototype.setAutoPadding=function(){};CipherBase.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")};CipherBase.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")};CipherBase.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")};CipherBase.prototype._transform=function(data,_,next){var err;try{if(this.hashMode){this._update(data)}else{this.push(this._update(data))}}catch(e){err=e}finally{next(err)}};CipherBase.prototype._flush=function(done){var err;try{this.push(this.__final())}catch(e){err=e}done(err)};CipherBase.prototype._finalOrDigest=function(outputEnc){var outData=this.__final()||Buffer.alloc(0);if(outputEnc){outData=this._toString(outData,outputEnc,true)}return outData};CipherBase.prototype._toString=function(value,enc,fin){if(!this._decoder){this._decoder=new StringDecoder(enc);this._encoding=enc}if(this._encoding!==enc)throw new Error("can't switch encodings");var out=this._decoder.write(value);if(fin){out+=this._decoder.end()}return out};module.exports=CipherBase},{inherits:180,"safe-buffer":234,stream:284,string_decoder:13}],16:[function(require,module,exports){(function(Buffer){var clone=function(){"use strict";function _instanceof(obj,type){return type!=null&&obj instanceof type}var nativeMap;try{nativeMap=Map}catch(_){nativeMap=function(){}}var nativeSet;try{nativeSet=Set}catch(_){nativeSet=function(){}}var nativePromise;try{nativePromise=Promise}catch(_){nativePromise=function(){}}function clone(parent,circular,depth,prototype,includeNonEnumerable){if(typeof circular==="object"){depth=circular.depth;prototype=circular.prototype;includeNonEnumerable=circular.includeNonEnumerable;circular=circular.circular}var allParents=[];var allChildren=[];var useBuffer=typeof Buffer!="undefined";if(typeof circular=="undefined")circular=true;if(typeof depth=="undefined")depth=Infinity;function _clone(parent,depth){if(parent===null)return null;if(depth===0)return parent;var child;var proto;if(typeof parent!="object"){return parent}if(_instanceof(parent,nativeMap)){child=new nativeMap}else if(_instanceof(parent,nativeSet)){child=new nativeSet}else if(_instanceof(parent,nativePromise)){child=new nativePromise(function(resolve,reject){parent.then(function(value){resolve(_clone(value,depth-1))},function(err){reject(_clone(err,depth-1))})})}else if(clone.__isArray(parent)){child=[]}else if(clone.__isRegExp(parent)){child=new RegExp(parent.source,__getRegExpFlags(parent));if(parent.lastIndex)child.lastIndex=parent.lastIndex}else if(clone.__isDate(parent)){child=new Date(parent.getTime())}else if(useBuffer&&Buffer.isBuffer(parent)){child=new Buffer(parent.length);parent.copy(child);return child}else if(_instanceof(parent,Error)){child=Object.create(parent)}else{if(typeof prototype=="undefined"){proto=Object.getPrototypeOf(parent);child=Object.create(proto)}else{child=Object.create(prototype);proto=prototype}}if(circular){var index=allParents.indexOf(parent);if(index!=-1){return allChildren[index]}allParents.push(parent);allChildren.push(child)}if(_instanceof(parent,nativeMap)){parent.forEach(function(value,key){var keyChild=_clone(key,depth-1);var valueChild=_clone(value,depth-1);child.set(keyChild,valueChild)})}if(_instanceof(parent,nativeSet)){parent.forEach(function(value){var entryChild=_clone(value,depth-1);child.add(entryChild)})}for(var i in parent){var attrs;if(proto){attrs=Object.getOwnPropertyDescriptor(proto,i)}if(attrs&&attrs.set==null){continue}child[i]=_clone(parent[i],depth-1)}if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(parent);for(var i=0;i>>2);for(var i=0,j=0;i>5]|=128<>>9<<4)+14]=len;var a=1732584193;var b=-271733879;var c=-1732584194;var d=271733878;for(var i=0;i>16)+(y>>16)+(lsw>>16);return msw<<16|lsw&65535}function bit_rol(num,cnt){return num<>>32-cnt}module.exports=function md5(buf){return makeHash(buf,core_md5)}},{"./make-hash":19}],21:[function(require,module,exports){"use strict";var elliptic=exports;elliptic.version=require("../package.json").version;elliptic.utils=require("./elliptic/utils");elliptic.rand=require("brorand");elliptic.curve=require("./elliptic/curve");elliptic.curves=require("./elliptic/curves");elliptic.ec=require("./elliptic/ec");elliptic.eddsa=require("./elliptic/eddsa")},{"../package.json":36,"./elliptic/curve":24,"./elliptic/curves":27,"./elliptic/ec":28,"./elliptic/eddsa":31,"./elliptic/utils":35,brorand:8}],22:[function(require,module,exports){"use strict";var BN=require("bn.js");var elliptic=require("../../elliptic");var utils=elliptic.utils;var getNAF=utils.getNAF;var getJSF=utils.getJSF;var assert=utils.assert;function BaseCurve(type,conf){this.type=type;this.p=new BN(conf.p,16);this.red=conf.prime?BN.red(conf.prime):BN.mont(this.p);this.zero=new BN(0).toRed(this.red);this.one=new BN(1).toRed(this.red);this.two=new BN(2).toRed(this.red);this.n=conf.n&&new BN(conf.n,16);this.g=conf.g&&this.pointFromJSON(conf.g,conf.gRed);this._wnafT1=new Array(4);this._wnafT2=new Array(4);this._wnafT3=new Array(4);this._wnafT4=new Array(4);var adjustCount=this.n&&this.p.div(this.n);if(!adjustCount||adjustCount.cmpn(100)>0){this.redN=null}else{this._maxwellTrick=true;this.redN=this.n.toRed(this.red)}}module.exports=BaseCurve;BaseCurve.prototype.point=function point(){throw new Error("Not implemented")};BaseCurve.prototype.validate=function validate(){throw new Error("Not implemented")};BaseCurve.prototype._fixedNafMul=function _fixedNafMul(p,k){assert(p.precomputed);var doubles=p._getDoubles();var naf=getNAF(k,1);var I=(1<=j;k--)nafW=(nafW<<1)+naf[k];repr.push(nafW)}var a=this.jpoint(null,null,null);var b=this.jpoint(null,null,null);for(var i=I;i>0;i--){for(var j=0;j=0;i--){for(var k=0;i>=0&&naf[i]===0;i--)k++;if(i>=0)k++;acc=acc.dblp(k);if(i<0)break;var z=naf[i];assert(z!==0);if(p.type==="affine"){if(z>0)acc=acc.mixedAdd(wnd[z-1>>1]);else acc=acc.mixedAdd(wnd[-z-1>>1].neg())}else{if(z>0)acc=acc.add(wnd[z-1>>1]);else acc=acc.add(wnd[-z-1>>1].neg())}}return p.type==="affine"?acc.toP():acc};BaseCurve.prototype._wnafMulAdd=function _wnafMulAdd(defW,points,coeffs,len,jacobianResult){var wndWidth=this._wnafT1;var wnd=this._wnafT2;var naf=this._wnafT3;var max=0;for(var i=0;i=1;i-=2){var a=i-1;var b=i;if(wndWidth[a]!==1||wndWidth[b]!==1){naf[a]=getNAF(coeffs[a],wndWidth[a]);naf[b]=getNAF(coeffs[b],wndWidth[b]);max=Math.max(naf[a].length,max);max=Math.max(naf[b].length,max);continue}var comb=[points[a],null,null,points[b]];if(points[a].y.cmp(points[b].y)===0){comb[1]=points[a].add(points[b]);comb[2]=points[a].toJ().mixedAdd(points[b].neg())}else if(points[a].y.cmp(points[b].y.redNeg())===0){comb[1]=points[a].toJ().mixedAdd(points[b]);comb[2]=points[a].add(points[b].neg())}else{comb[1]=points[a].toJ().mixedAdd(points[b]);comb[2]=points[a].toJ().mixedAdd(points[b].neg())}var index=[-3,-1,-5,-7,0,7,5,1,3];var jsf=getJSF(coeffs[a],coeffs[b]);max=Math.max(jsf[0].length,max);naf[a]=new Array(max);naf[b]=new Array(max);for(var j=0;j=0;i--){var k=0;while(i>=0){var zero=true;for(var j=0;j=0)k++;acc=acc.dblp(k);if(i<0)break;for(var j=0;j0)p=wnd[j][z-1>>1];else if(z<0)p=wnd[j][-z-1>>1].neg();if(p.type==="affine")acc=acc.mixedAdd(p);else acc=acc.add(p)}}for(var i=0;i=Math.ceil((k.bitLength()+1)/doubles.step)};BasePoint.prototype._getDoubles=function _getDoubles(step,power){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;var doubles=[this];var acc=this;for(var i=0;i";return""};Point.prototype.isInfinity=function isInfinity(){return this.x.cmpn(0)===0&&this.y.cmp(this.z)===0};Point.prototype._extDbl=function _extDbl(){var a=this.x.redSqr();var b=this.y.redSqr();var c=this.z.redSqr();c=c.redIAdd(c);var d=this.curve._mulA(a);var e=this.x.redAdd(this.y).redSqr().redISub(a).redISub(b);var g=d.redAdd(b);var f=g.redSub(c);var h=d.redSub(b);var nx=e.redMul(f);var ny=g.redMul(h);var nt=e.redMul(h);var nz=f.redMul(g);return this.curve.point(nx,ny,nz,nt)};Point.prototype._projDbl=function _projDbl(){var b=this.x.redAdd(this.y).redSqr();var c=this.x.redSqr();var d=this.y.redSqr();var nx;var ny;var nz;if(this.curve.twisted){var e=this.curve._mulA(c);var f=e.redAdd(d);if(this.zOne){nx=b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two));ny=f.redMul(e.redSub(d));nz=f.redSqr().redSub(f).redSub(f)}else{var h=this.z.redSqr();var j=f.redSub(h).redISub(h);nx=b.redSub(c).redISub(d).redMul(j);ny=f.redMul(e.redSub(d));nz=f.redMul(j)}}else{var e=c.redAdd(d);var h=this.curve._mulC(this.c.redMul(this.z)).redSqr();var j=e.redSub(h).redSub(h);nx=this.curve._mulC(b.redISub(e)).redMul(j);ny=this.curve._mulC(e).redMul(c.redISub(d));nz=e.redMul(j)}return this.curve.point(nx,ny,nz)};Point.prototype.dbl=function dbl(){if(this.isInfinity())return this;if(this.curve.extended)return this._extDbl();else return this._projDbl()};Point.prototype._extAdd=function _extAdd(p){var a=this.y.redSub(this.x).redMul(p.y.redSub(p.x));var b=this.y.redAdd(this.x).redMul(p.y.redAdd(p.x));var c=this.t.redMul(this.curve.dd).redMul(p.t);var d=this.z.redMul(p.z.redAdd(p.z));var e=b.redSub(a);var f=d.redSub(c);var g=d.redAdd(c);var h=b.redAdd(a);var nx=e.redMul(f);var ny=g.redMul(h);var nt=e.redMul(h);var nz=f.redMul(g);return this.curve.point(nx,ny,nz,nt)};Point.prototype._projAdd=function _projAdd(p){var a=this.z.redMul(p.z);var b=a.redSqr();var c=this.x.redMul(p.x);var d=this.y.redMul(p.y);var e=this.curve.d.redMul(c).redMul(d);var f=b.redSub(e);var g=b.redAdd(e);var tmp=this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d);var nx=a.redMul(f).redMul(tmp);var ny;var nz;if(this.curve.twisted){ny=a.redMul(g).redMul(d.redSub(this.curve._mulA(c)));nz=f.redMul(g)}else{ny=a.redMul(g).redMul(d.redSub(c));nz=this.curve._mulC(f).redMul(g)}return this.curve.point(nx,ny,nz)};Point.prototype.add=function add(p){if(this.isInfinity())return p;if(p.isInfinity())return this;if(this.curve.extended)return this._extAdd(p);else return this._projAdd(p)};Point.prototype.mul=function mul(k){if(this._hasDoubles(k))return this.curve._fixedNafMul(this,k);else return this.curve._wnafMul(this,k)};Point.prototype.mulAdd=function mulAdd(k1,p,k2){return this.curve._wnafMulAdd(1,[this,p],[k1,k2],2,false)};Point.prototype.jmulAdd=function jmulAdd(k1,p,k2){return this.curve._wnafMulAdd(1,[this,p],[k1,k2],2,true)};Point.prototype.normalize=function normalize(){if(this.zOne)return this;var zi=this.z.redInvm();this.x=this.x.redMul(zi);this.y=this.y.redMul(zi);if(this.t)this.t=this.t.redMul(zi);this.z=this.curve.one;this.zOne=true;return this};Point.prototype.neg=function neg(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())};Point.prototype.getX=function getX(){this.normalize();return this.x.fromRed()};Point.prototype.getY=function getY(){this.normalize();return this.y.fromRed()};Point.prototype.eq=function eq(other){return this===other||this.getX().cmp(other.getX())===0&&this.getY().cmp(other.getY())===0};Point.prototype.eqXToP=function eqXToP(x){var rx=x.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(rx)===0)return true;var xc=x.clone();var t=this.curve.redN.redMul(this.z);for(;;){xc.iadd(this.curve.n);if(xc.cmp(this.curve.p)>=0)return false;rx.redIAdd(t);if(this.x.cmp(rx)===0)return true}return false};Point.prototype.toP=Point.prototype.normalize;Point.prototype.mixedAdd=Point.prototype.add},{"../../elliptic":21,"../curve":24,"bn.js":7,inherits:180}],24:[function(require,module,exports){"use strict";var curve=exports;curve.base=require("./base");curve.short=require("./short");curve.mont=require("./mont");curve.edwards=require("./edwards")},{"./base":22,"./edwards":23,"./mont":25,"./short":26}],25:[function(require,module,exports){"use strict";var curve=require("../curve");var BN=require("bn.js");var inherits=require("inherits");var Base=curve.base;var elliptic=require("../../elliptic");var utils=elliptic.utils;function MontCurve(conf){Base.call(this,"mont",conf);this.a=new BN(conf.a,16).toRed(this.red);this.b=new BN(conf.b,16).toRed(this.red);this.i4=new BN(4).toRed(this.red).redInvm();this.two=new BN(2).toRed(this.red);this.a24=this.i4.redMul(this.a.redAdd(this.two))}inherits(MontCurve,Base);module.exports=MontCurve;MontCurve.prototype.validate=function validate(point){var x=point.normalize().x;var x2=x.redSqr();var rhs=x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x);var y=rhs.redSqrt();return y.redSqr().cmp(rhs)===0};function Point(curve,x,z){Base.BasePoint.call(this,curve,"projective");if(x===null&&z===null){this.x=this.curve.one;this.z=this.curve.zero}else{this.x=new BN(x,16);this.z=new BN(z,16);if(!this.x.red)this.x=this.x.toRed(this.curve.red);if(!this.z.red)this.z=this.z.toRed(this.curve.red)}}inherits(Point,Base.BasePoint);MontCurve.prototype.decodePoint=function decodePoint(bytes,enc){return this.point(utils.toArray(bytes,enc),1)};MontCurve.prototype.point=function point(x,z){return new Point(this,x,z)};MontCurve.prototype.pointFromJSON=function pointFromJSON(obj){return Point.fromJSON(this,obj)};Point.prototype.precompute=function precompute(){};Point.prototype._encode=function _encode(){return this.getX().toArray("be",this.curve.p.byteLength())};Point.fromJSON=function fromJSON(curve,obj){return new Point(curve,obj[0],obj[1]||curve.one)};Point.prototype.inspect=function inspect(){if(this.isInfinity())return"";return""};Point.prototype.isInfinity=function isInfinity(){return this.z.cmpn(0)===0};Point.prototype.dbl=function dbl(){var a=this.x.redAdd(this.z);var aa=a.redSqr();var b=this.x.redSub(this.z);var bb=b.redSqr();var c=aa.redSub(bb);var nx=aa.redMul(bb);var nz=c.redMul(bb.redAdd(this.curve.a24.redMul(c)));return this.curve.point(nx,nz)};Point.prototype.add=function add(){throw new Error("Not supported on Montgomery curve")};Point.prototype.diffAdd=function diffAdd(p,diff){var a=this.x.redAdd(this.z);var b=this.x.redSub(this.z);var c=p.x.redAdd(p.z);var d=p.x.redSub(p.z);var da=d.redMul(a);var cb=c.redMul(b);var nx=diff.z.redMul(da.redAdd(cb).redSqr());var nz=diff.x.redMul(da.redISub(cb).redSqr());return this.curve.point(nx,nz)};Point.prototype.mul=function mul(k){var t=k.clone();var a=this;var b=this.curve.point(null,null);var c=this;for(var bits=[];t.cmpn(0)!==0;t.iushrn(1))bits.push(t.andln(1));for(var i=bits.length-1;i>=0;i--){if(bits[i]===0){a=a.diffAdd(b,c);b=b.dbl()}else{b=a.diffAdd(b,c);a=a.dbl()}}return b};Point.prototype.mulAdd=function mulAdd(){throw new Error("Not supported on Montgomery curve")};Point.prototype.jumlAdd=function jumlAdd(){throw new Error("Not supported on Montgomery curve")};Point.prototype.eq=function eq(other){return this.getX().cmp(other.getX())===0};Point.prototype.normalize=function normalize(){this.x=this.x.redMul(this.z.redInvm());this.z=this.curve.one;return this};Point.prototype.getX=function getX(){this.normalize();return this.x.fromRed()}},{"../../elliptic":21,"../curve":24,"bn.js":7,inherits:180}],26:[function(require,module,exports){"use strict";var curve=require("../curve");var elliptic=require("../../elliptic");var BN=require("bn.js");var inherits=require("inherits");var Base=curve.base;var assert=elliptic.utils.assert;function ShortCurve(conf){Base.call(this,"short",conf);this.a=new BN(conf.a,16).toRed(this.red);this.b=new BN(conf.b,16).toRed(this.red);this.tinv=this.two.redInvm();this.zeroA=this.a.fromRed().cmpn(0)===0;this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0;this.endo=this._getEndomorphism(conf);this._endoWnafT1=new Array(4);this._endoWnafT2=new Array(4)}inherits(ShortCurve,Base);module.exports=ShortCurve;ShortCurve.prototype._getEndomorphism=function _getEndomorphism(conf){if(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)return;var beta;var lambda;if(conf.beta){beta=new BN(conf.beta,16).toRed(this.red)}else{var betas=this._getEndoRoots(this.p);beta=betas[0].cmp(betas[1])<0?betas[0]:betas[1];beta=beta.toRed(this.red)}if(conf.lambda){lambda=new BN(conf.lambda,16)}else{var lambdas=this._getEndoRoots(this.n);if(this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta))===0){lambda=lambdas[0]}else{lambda=lambdas[1];assert(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta))===0)}}var basis;if(conf.basis){basis=conf.basis.map(function(vec){return{a:new BN(vec.a,16),b:new BN(vec.b,16)}})}else{basis=this._getEndoBasis(lambda)}return{beta:beta,lambda:lambda,basis:basis}};ShortCurve.prototype._getEndoRoots=function _getEndoRoots(num){var red=num===this.p?this.red:BN.mont(num);var tinv=new BN(2).toRed(red).redInvm();var ntinv=tinv.redNeg();var s=new BN(3).toRed(red).redNeg().redSqrt().redMul(tinv);var l1=ntinv.redAdd(s).fromRed();var l2=ntinv.redSub(s).fromRed();return[l1,l2]};ShortCurve.prototype._getEndoBasis=function _getEndoBasis(lambda){var aprxSqrt=this.n.ushrn(Math.floor(this.n.bitLength()/2));var u=lambda;var v=this.n.clone();var x1=new BN(1);var y1=new BN(0);var x2=new BN(0);var y2=new BN(1);var a0;var b0;var a1;var b1;var a2;var b2;var prevR;var i=0;var r;var x;while(u.cmpn(0)!==0){var q=v.div(u);r=v.sub(q.mul(u));x=x2.sub(q.mul(x1));var y=y2.sub(q.mul(y1));if(!a1&&r.cmp(aprxSqrt)<0){a0=prevR.neg();b0=x1;a1=r.neg();b1=x}else if(a1&&++i===2){break}prevR=r;v=u;u=r;x2=x1;x1=x;y2=y1;y1=y}a2=r.neg();b2=x;var len1=a1.sqr().add(b1.sqr());var len2=a2.sqr().add(b2.sqr());if(len2.cmp(len1)>=0){a2=a0;b2=b0}if(a1.negative){a1=a1.neg();b1=b1.neg()}if(a2.negative){a2=a2.neg();b2=b2.neg()}return[{a:a1,b:b1},{a:a2,b:b2}]};ShortCurve.prototype._endoSplit=function _endoSplit(k){var basis=this.endo.basis;var v1=basis[0];var v2=basis[1];var c1=v2.b.mul(k).divRound(this.n);var c2=v1.b.neg().mul(k).divRound(this.n);var p1=c1.mul(v1.a);var p2=c2.mul(v2.a);var q1=c1.mul(v1.b);var q2=c2.mul(v2.b);var k1=k.sub(p1).sub(p2);var k2=q1.add(q2).neg();return{k1:k1,k2:k2}};ShortCurve.prototype.pointFromX=function pointFromX(x,odd){x=new BN(x,16);if(!x.red)x=x.toRed(this.red);var y2=x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b);var y=y2.redSqrt();if(y.redSqr().redSub(y2).cmp(this.zero)!==0)throw new Error("invalid point");var isOdd=y.fromRed().isOdd();if(odd&&!isOdd||!odd&&isOdd)y=y.redNeg();return this.point(x,y)};ShortCurve.prototype.validate=function validate(point){if(point.inf)return true;var x=point.x;var y=point.y;var ax=this.a.redMul(x);var rhs=x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b);return y.redSqr().redISub(rhs).cmpn(0)===0};ShortCurve.prototype._endoWnafMulAdd=function _endoWnafMulAdd(points,coeffs,jacobianResult){var npoints=this._endoWnafT1;var ncoeffs=this._endoWnafT2;for(var i=0;i";return""};Point.prototype.isInfinity=function isInfinity(){return this.inf};Point.prototype.add=function add(p){if(this.inf)return p;if(p.inf)return this;if(this.eq(p))return this.dbl();if(this.neg().eq(p))return this.curve.point(null,null);if(this.x.cmp(p.x)===0)return this.curve.point(null,null);var c=this.y.redSub(p.y);if(c.cmpn(0)!==0)c=c.redMul(this.x.redSub(p.x).redInvm());var nx=c.redSqr().redISub(this.x).redISub(p.x);var ny=c.redMul(this.x.redSub(nx)).redISub(this.y);return this.curve.point(nx,ny)};Point.prototype.dbl=function dbl(){if(this.inf)return this;var ys1=this.y.redAdd(this.y);if(ys1.cmpn(0)===0)return this.curve.point(null,null);var a=this.curve.a;var x2=this.x.redSqr();var dyinv=ys1.redInvm();var c=x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv);var nx=c.redSqr().redISub(this.x.redAdd(this.x));var ny=c.redMul(this.x.redSub(nx)).redISub(this.y);return this.curve.point(nx,ny)};Point.prototype.getX=function getX(){return this.x.fromRed()};Point.prototype.getY=function getY(){return this.y.fromRed()};Point.prototype.mul=function mul(k){k=new BN(k,16);if(this._hasDoubles(k))return this.curve._fixedNafMul(this,k);else if(this.curve.endo)return this.curve._endoWnafMulAdd([this],[k]);else return this.curve._wnafMul(this,k)};Point.prototype.mulAdd=function mulAdd(k1,p2,k2){var points=[this,p2];var coeffs=[k1,k2];if(this.curve.endo)return this.curve._endoWnafMulAdd(points,coeffs);else return this.curve._wnafMulAdd(1,points,coeffs,2)};Point.prototype.jmulAdd=function jmulAdd(k1,p2,k2){var points=[this,p2];var coeffs=[k1,k2];if(this.curve.endo)return this.curve._endoWnafMulAdd(points,coeffs,true);else return this.curve._wnafMulAdd(1,points,coeffs,2,true)};Point.prototype.eq=function eq(p){return this===p||this.inf===p.inf&&(this.inf||this.x.cmp(p.x)===0&&this.y.cmp(p.y)===0)};Point.prototype.neg=function neg(_precompute){if(this.inf)return this;var res=this.curve.point(this.x,this.y.redNeg());if(_precompute&&this.precomputed){var pre=this.precomputed;var negate=function(p){return p.neg()};res.precomputed={naf:pre.naf&&{wnd:pre.naf.wnd,points:pre.naf.points.map(negate)},doubles:pre.doubles&&{step:pre.doubles.step,points:pre.doubles.points.map(negate) }}}return res};Point.prototype.toJ=function toJ(){if(this.inf)return this.curve.jpoint(null,null,null);var res=this.curve.jpoint(this.x,this.y,this.curve.one);return res};function JPoint(curve,x,y,z){Base.BasePoint.call(this,curve,"jacobian");if(x===null&&y===null&&z===null){this.x=this.curve.one;this.y=this.curve.one;this.z=new BN(0)}else{this.x=new BN(x,16);this.y=new BN(y,16);this.z=new BN(z,16)}if(!this.x.red)this.x=this.x.toRed(this.curve.red);if(!this.y.red)this.y=this.y.toRed(this.curve.red);if(!this.z.red)this.z=this.z.toRed(this.curve.red);this.zOne=this.z===this.curve.one}inherits(JPoint,Base.BasePoint);ShortCurve.prototype.jpoint=function jpoint(x,y,z){return new JPoint(this,x,y,z)};JPoint.prototype.toP=function toP(){if(this.isInfinity())return this.curve.point(null,null);var zinv=this.z.redInvm();var zinv2=zinv.redSqr();var ax=this.x.redMul(zinv2);var ay=this.y.redMul(zinv2).redMul(zinv);return this.curve.point(ax,ay)};JPoint.prototype.neg=function neg(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};JPoint.prototype.add=function add(p){if(this.isInfinity())return p;if(p.isInfinity())return this;var pz2=p.z.redSqr();var z2=this.z.redSqr();var u1=this.x.redMul(pz2);var u2=p.x.redMul(z2);var s1=this.y.redMul(pz2.redMul(p.z));var s2=p.y.redMul(z2.redMul(this.z));var h=u1.redSub(u2);var r=s1.redSub(s2);if(h.cmpn(0)===0){if(r.cmpn(0)!==0)return this.curve.jpoint(null,null,null);else return this.dbl()}var h2=h.redSqr();var h3=h2.redMul(h);var v=u1.redMul(h2);var nx=r.redSqr().redIAdd(h3).redISub(v).redISub(v);var ny=r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));var nz=this.z.redMul(p.z).redMul(h);return this.curve.jpoint(nx,ny,nz)};JPoint.prototype.mixedAdd=function mixedAdd(p){if(this.isInfinity())return p.toJ();if(p.isInfinity())return this;var z2=this.z.redSqr();var u1=this.x;var u2=p.x.redMul(z2);var s1=this.y;var s2=p.y.redMul(z2).redMul(this.z);var h=u1.redSub(u2);var r=s1.redSub(s2);if(h.cmpn(0)===0){if(r.cmpn(0)!==0)return this.curve.jpoint(null,null,null);else return this.dbl()}var h2=h.redSqr();var h3=h2.redMul(h);var v=u1.redMul(h2);var nx=r.redSqr().redIAdd(h3).redISub(v).redISub(v);var ny=r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));var nz=this.z.redMul(h);return this.curve.jpoint(nx,ny,nz)};JPoint.prototype.dblp=function dblp(pow){if(pow===0)return this;if(this.isInfinity())return this;if(!pow)return this.dbl();if(this.curve.zeroA||this.curve.threeA){var r=this;for(var i=0;i=0)return false;rx.redIAdd(t);if(this.x.cmp(rx)===0)return true}return false};JPoint.prototype.inspect=function inspect(){if(this.isInfinity())return"";return""};JPoint.prototype.isInfinity=function isInfinity(){return this.z.cmpn(0)===0}},{"../../elliptic":21,"../curve":24,"bn.js":7,inherits:180}],27:[function(require,module,exports){"use strict";var curves=exports;var hash=require("hash.js");var elliptic=require("../elliptic");var assert=elliptic.utils.assert;function PresetCurve(options){if(options.type==="short")this.curve=new elliptic.curve.short(options);else if(options.type==="edwards")this.curve=new elliptic.curve.edwards(options);else this.curve=new elliptic.curve.mont(options);this.g=this.curve.g;this.n=this.curve.n;this.hash=options.hash;assert(this.g.validate(),"Invalid curve");assert(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}curves.PresetCurve=PresetCurve;function defineCurve(name,options){Object.defineProperty(curves,name,{configurable:true,enumerable:true,get:function(){var curve=new PresetCurve(options);Object.defineProperty(curves,name,{configurable:true,enumerable:true,value:curve});return curve}})}defineCurve("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:hash.sha256,gRed:false,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]});defineCurve("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:hash.sha256,gRed:false,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]});defineCurve("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:hash.sha256,gRed:false,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]});defineCurve("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff "+"fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff "+"fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f "+"5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 "+"f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:hash.sha384,gRed:false,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 "+"5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 "+"0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]});defineCurve("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff "+"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff "+"ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff "+"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff "+"ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b "+"99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd "+"3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff "+"ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 "+"f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:hash.sha512,gRed:false,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 "+"053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 "+"a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 "+"579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 "+"3fad0761 353c7086 a272c240 88be9476 9fd16650"]});defineCurve("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:hash.sha256,gRed:false,g:["9"]});defineCurve("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:hash.sha256,gRed:false,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var pre;try{pre=require("./precomputed/secp256k1")}catch(e){pre=undefined}defineCurve("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:hash.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:false,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",pre]})},{"../elliptic":21,"./precomputed/secp256k1":34,"hash.js":164}],28:[function(require,module,exports){"use strict";var BN=require("bn.js");var HmacDRBG=require("hmac-drbg");var elliptic=require("../../elliptic");var utils=elliptic.utils;var assert=utils.assert;var KeyPair=require("./key");var Signature=require("./signature");function EC(options){if(!(this instanceof EC))return new EC(options);if(typeof options==="string"){assert(elliptic.curves.hasOwnProperty(options),"Unknown curve "+options);options=elliptic.curves[options]}if(options instanceof elliptic.curves.PresetCurve)options={curve:options};this.curve=options.curve.curve;this.n=this.curve.n;this.nh=this.n.ushrn(1);this.g=this.curve.g;this.g=options.curve.g;this.g.precompute(options.curve.n.bitLength()+1);this.hash=options.hash||options.curve.hash}module.exports=EC;EC.prototype.keyPair=function keyPair(options){return new KeyPair(this,options)};EC.prototype.keyFromPrivate=function keyFromPrivate(priv,enc){return KeyPair.fromPrivate(this,priv,enc)};EC.prototype.keyFromPublic=function keyFromPublic(pub,enc){return KeyPair.fromPublic(this,pub,enc)};EC.prototype.genKeyPair=function genKeyPair(options){if(!options)options={};var drbg=new HmacDRBG({hash:this.hash,pers:options.pers,persEnc:options.persEnc||"utf8",entropy:options.entropy||elliptic.rand(this.hash.hmacStrength),entropyEnc:options.entropy&&options.entropyEnc||"utf8",nonce:this.n.toArray()});var bytes=this.n.byteLength();var ns2=this.n.sub(new BN(2));do{var priv=new BN(drbg.generate(bytes));if(priv.cmp(ns2)>0)continue;priv.iaddn(1);return this.keyFromPrivate(priv)}while(true)};EC.prototype._truncateToN=function truncateToN(msg,truncOnly){var delta=msg.byteLength()*8-this.n.bitLength();if(delta>0)msg=msg.ushrn(delta);if(!truncOnly&&msg.cmp(this.n)>=0)return msg.sub(this.n);else return msg};EC.prototype.sign=function sign(msg,key,enc,options){if(typeof enc==="object"){options=enc;enc=null}if(!options)options={};key=this.keyFromPrivate(key,enc);msg=this._truncateToN(new BN(msg,16));var bytes=this.n.byteLength();var bkey=key.getPrivate().toArray("be",bytes);var nonce=msg.toArray("be",bytes);var drbg=new HmacDRBG({hash:this.hash,entropy:bkey,nonce:nonce,pers:options.pers,persEnc:options.persEnc||"utf8"});var ns1=this.n.sub(new BN(1));for(var iter=0;true;iter++){var k=options.k?options.k(iter):new BN(drbg.generate(this.n.byteLength()));k=this._truncateToN(k,true);if(k.cmpn(1)<=0||k.cmp(ns1)>=0)continue;var kp=this.g.mul(k);if(kp.isInfinity())continue;var kpX=kp.getX();var r=kpX.umod(this.n);if(r.cmpn(0)===0)continue;var s=k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg));s=s.umod(this.n);if(s.cmpn(0)===0)continue;var recoveryParam=(kp.getY().isOdd()?1:0)|(kpX.cmp(r)!==0?2:0);if(options.canonical&&s.cmp(this.nh)>0){s=this.n.sub(s);recoveryParam^=1}return new Signature({r:r,s:s,recoveryParam:recoveryParam})}};EC.prototype.verify=function verify(msg,signature,key,enc){msg=this._truncateToN(new BN(msg,16));key=this.keyFromPublic(key,enc);signature=new Signature(signature,"hex");var r=signature.r;var s=signature.s;if(r.cmpn(1)<0||r.cmp(this.n)>=0)return false;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return false;var sinv=s.invm(this.n);var u1=sinv.mul(msg).umod(this.n);var u2=sinv.mul(r).umod(this.n);if(!this.curve._maxwellTrick){var p=this.g.mulAdd(u1,key.getPublic(),u2);if(p.isInfinity())return false;return p.getX().umod(this.n).cmp(r)===0}var p=this.g.jmulAdd(u1,key.getPublic(),u2);if(p.isInfinity())return false;return p.eqXToP(r)};EC.prototype.recoverPubKey=function(msg,signature,j,enc){assert((3&j)===j,"The recovery param is more than two bits");signature=new Signature(signature,enc);var n=this.n;var e=new BN(msg);var r=signature.r;var s=signature.s;var isYOdd=j&1;var isSecondKey=j>>1;if(r.cmp(this.curve.p.umod(this.curve.n))>=0&&isSecondKey)throw new Error("Unable to find sencond key candinate");if(isSecondKey)r=this.curve.pointFromX(r.add(this.curve.n),isYOdd);else r=this.curve.pointFromX(r,isYOdd);var rInv=signature.r.invm(n);var s1=n.sub(e).mul(rInv).umod(n);var s2=s.mul(rInv).umod(n);return this.g.mulAdd(s1,r,s2)};EC.prototype.getKeyRecoveryParam=function(e,signature,Q,enc){signature=new Signature(signature,enc);if(signature.recoveryParam!==null)return signature.recoveryParam;for(var i=0;i<4;i++){var Qprime;try{Qprime=this.recoverPubKey(e,signature,i)}catch(e){continue}if(Qprime.eq(Q))return i}throw new Error("Unable to find valid recovery factor")}},{"../../elliptic":21,"./key":29,"./signature":30,"bn.js":7,"hmac-drbg":176}],29:[function(require,module,exports){"use strict";var BN=require("bn.js");var elliptic=require("../../elliptic");var utils=elliptic.utils;var assert=utils.assert;function KeyPair(ec,options){this.ec=ec;this.priv=null;this.pub=null;if(options.priv)this._importPrivate(options.priv,options.privEnc);if(options.pub)this._importPublic(options.pub,options.pubEnc)}module.exports=KeyPair;KeyPair.fromPublic=function fromPublic(ec,pub,enc){if(pub instanceof KeyPair)return pub;return new KeyPair(ec,{pub:pub,pubEnc:enc})};KeyPair.fromPrivate=function fromPrivate(ec,priv,enc){if(priv instanceof KeyPair)return priv;return new KeyPair(ec,{priv:priv,privEnc:enc})};KeyPair.prototype.validate=function validate(){var pub=this.getPublic();if(pub.isInfinity())return{result:false,reason:"Invalid public key"};if(!pub.validate())return{result:false,reason:"Public key is not a point"};if(!pub.mul(this.ec.curve.n).isInfinity())return{result:false,reason:"Public key * N != O"};return{result:true,reason:null}};KeyPair.prototype.getPublic=function getPublic(compact,enc){if(typeof compact==="string"){enc=compact;compact=null}if(!this.pub)this.pub=this.ec.g.mul(this.priv);if(!enc)return this.pub;return this.pub.encode(enc,compact)};KeyPair.prototype.getPrivate=function getPrivate(enc){if(enc==="hex")return this.priv.toString(16,2);else return this.priv};KeyPair.prototype._importPrivate=function _importPrivate(key,enc){this.priv=new BN(key,enc||16);this.priv=this.priv.umod(this.ec.curve.n)};KeyPair.prototype._importPublic=function _importPublic(key,enc){if(key.x||key.y){if(this.ec.curve.type==="mont"){assert(key.x,"Need x coordinate")}else if(this.ec.curve.type==="short"||this.ec.curve.type==="edwards"){assert(key.x&&key.y,"Need both x and y coordinate")}this.pub=this.ec.curve.point(key.x,key.y);return}this.pub=this.ec.curve.decodePoint(key,enc)};KeyPair.prototype.derive=function derive(pub){return pub.mul(this.priv).getX()};KeyPair.prototype.sign=function sign(msg,enc,options){return this.ec.sign(msg,this,enc,options)};KeyPair.prototype.verify=function verify(msg,signature){return this.ec.verify(msg,signature,this)};KeyPair.prototype.inspect=function inspect(){return""}},{"../../elliptic":21,"bn.js":7}],30:[function(require,module,exports){"use strict";var BN=require("bn.js");var elliptic=require("../../elliptic");var utils=elliptic.utils;var assert=utils.assert;function Signature(options,enc){if(options instanceof Signature)return options;if(this._importDER(options,enc))return;assert(options.r&&options.s,"Signature without r or s");this.r=new BN(options.r,16);this.s=new BN(options.s,16);if(options.recoveryParam===undefined)this.recoveryParam=null;else this.recoveryParam=options.recoveryParam}module.exports=Signature;function Position(){this.place=0}function getLength(buf,p){var initial=buf[p.place++];if(!(initial&128)){return initial}var octetLen=initial&15;var val=0;for(var i=0,off=p.place;i>>3);arr.push(octets|128);while(--octets){arr.push(len>>>(octets<<3)&255)}arr.push(len)}Signature.prototype.toDER=function toDER(enc){var r=this.r.toArray();var s=this.s.toArray();if(r[0]&128)r=[0].concat(r);if(s[0]&128)s=[0].concat(s);r=rmPadding(r);s=rmPadding(s);while(!s[0]&&!(s[1]&128)){s=s.slice(1)}var arr=[2];constructLength(arr,r.length);arr=arr.concat(r);arr.push(2);constructLength(arr,s.length);var backHalf=arr.concat(s);var res=[48];constructLength(res,backHalf.length);res=res.concat(backHalf);return utils.encode(res,enc)}},{"../../elliptic":21,"bn.js":7}],31:[function(require,module,exports){"use strict";var hash=require("hash.js");var elliptic=require("../../elliptic");var utils=elliptic.utils;var assert=utils.assert;var parseBytes=utils.parseBytes;var KeyPair=require("./key");var Signature=require("./signature");function EDDSA(curve){assert(curve==="ed25519","only tested with ed25519 so far");if(!(this instanceof EDDSA))return new EDDSA(curve);var curve=elliptic.curves[curve].curve;this.curve=curve;this.g=curve.g;this.g.precompute(curve.n.bitLength()+1);this.pointClass=curve.point().constructor;this.encodingLength=Math.ceil(curve.n.bitLength()/8);this.hash=hash.sha512}module.exports=EDDSA;EDDSA.prototype.sign=function sign(message,secret){message=parseBytes(message);var key=this.keyFromSecret(secret);var r=this.hashInt(key.messagePrefix(),message);var R=this.g.mul(r);var Rencoded=this.encodePoint(R);var s_=this.hashInt(Rencoded,key.pubBytes(),message).mul(key.priv());var S=r.add(s_).umod(this.curve.n);return this.makeSignature({R:R,S:S,Rencoded:Rencoded})};EDDSA.prototype.verify=function verify(message,sig,pub){message=parseBytes(message);sig=this.makeSignature(sig);var key=this.keyFromPublic(pub);var h=this.hashInt(sig.Rencoded(),key.pubBytes(),message);var SG=this.g.mul(sig.S());var RplusAh=sig.R().add(key.pub().mul(h));return RplusAh.eq(SG)};EDDSA.prototype.hashInt=function hashInt(){var hash=this.hash();for(var i=0;i=0){var z;if(k.isOdd()){var mod=k.andln(ws-1);if(mod>(ws>>1)-1)z=(ws>>1)-mod;else z=mod;k.isubn(z)}else{z=0}naf.push(z);var shift=k.cmpn(0)!==0&&k.andln(ws-1)===0?w+1:1;for(var i=1;i0||k2.cmpn(-d2)>0){var m14=k1.andln(3)+d1&3;var m24=k2.andln(3)+d2&3;if(m14===3)m14=-1;if(m24===3)m24=-1;var u1;if((m14&1)===0){u1=0}else{var m8=k1.andln(7)+d1&7;if((m8===3||m8===5)&&m24===2)u1=-m14;else u1=m14}jsf[0].push(u1);var u2;if((m24&1)===0){u2=0}else{var m8=k2.andln(7)+d2&7;if((m8===3||m8===5)&&m14===2)u2=-m24;else u2=m24}jsf[1].push(u2);if(2*d1===u1+1)d1=1-d1;if(2*d2===u2+1)d2=1-d2;k1.iushrn(1);k2.iushrn(1)}return jsf}utils.getJSF=getJSF;function cachedProperty(obj,name,computer){var key="_"+name;obj.prototype[name]=function cachedProperty(){return this[key]!==undefined?this[key]:this[key]=computer.call(this)}}utils.cachedProperty=cachedProperty;function parseBytes(bytes){return typeof bytes==="string"?utils.toArray(bytes,"hex"):bytes}utils.parseBytes=parseBytes;function intFromLE(bytes){return new BN(bytes,"hex","le")}utils.intFromLE=intFromLE},{"bn.js":7,"minimalistic-assert":206,"minimalistic-crypto-utils":207}],36:[function(require,module,exports){module.exports={_args:[["elliptic@6.4.0","/home/jack/src/ethereumjs-connect"]],_from:"elliptic@6.4.0",_id:"elliptic@6.4.0",_inBundle:false,_integrity:"sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=",_location:"/elliptic",_phantomChildren:{},_requested:{type:"version",registry:true,raw:"elliptic@6.4.0",name:"elliptic",escapedName:"elliptic",rawSpec:"6.4.0",saveSpec:null,fetchSpec:"6.4.0"},_requiredBy:["/browserify-sign","/create-ecdh","/secp256k1"],_resolved:"https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz",_spec:"6.4.0",_where:"/home/jack/src/ethereumjs-connect",author:{name:"Fedor Indutny",email:"fedor@indutny.com"},bugs:{url:"https://github.com/indutny/elliptic/issues"},dependencies:{"bn.js":"^4.4.0",brorand:"^1.0.1","hash.js":"^1.0.0","hmac-drbg":"^1.0.0",inherits:"^2.0.1","minimalistic-assert":"^1.0.0","minimalistic-crypto-utils":"^1.0.0"},description:"EC cryptography",devDependencies:{brfs:"^1.4.3",coveralls:"^2.11.3",grunt:"^0.4.5","grunt-browserify":"^5.0.0","grunt-cli":"^1.2.0","grunt-contrib-connect":"^1.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^1.0.1","grunt-mocha-istanbul":"^3.0.1","grunt-saucelabs":"^8.6.2",istanbul:"^0.4.2",jscs:"^2.9.0",jshint:"^2.6.0",mocha:"^2.1.0"},files:["lib"],homepage:"https://github.com/indutny/elliptic",keywords:["EC","Elliptic","curve","Cryptography"],license:"MIT",main:"lib/elliptic.js",name:"elliptic",repository:{type:"git",url:"git+ssh://git@github.com/indutny/elliptic.git"},scripts:{jscs:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",jshint:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",lint:"npm run jscs && npm run jshint",test:"npm run lint && npm run unit",unit:"istanbul test _mocha --reporter=spec test/index.js",version:"grunt dist && git add dist/"},version:"6.4.0"}},{}],37:[function(require,module,exports){(function(process,global){(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?module.exports=factory():typeof define==="function"&&define.amd?define(factory):global.ES6Promise=factory()})(this,function(){"use strict";function objectOrFunction(x){var type=typeof x;return x!==null&&(type==="object"||type==="function")}function isFunction(x){return typeof x==="function"}var _isArray=void 0;if(Array.isArray){_isArray=Array.isArray}else{_isArray=function(x){return Object.prototype.toString.call(x)==="[object Array]"}}var isArray=_isArray;var len=0;var vertxNext=void 0;var customSchedulerFn=void 0;var asap=function asap(callback,arg){queue[len]=callback;queue[len+1]=arg;len+=2;if(len===2){if(customSchedulerFn){customSchedulerFn(flush)}else{scheduleFlush()}}};function setScheduler(scheduleFn){customSchedulerFn=scheduleFn}function setAsap(asapFn){asap=asapFn}var browserWindow=typeof window!=="undefined"?window:undefined;var browserGlobal=browserWindow||{};var BrowserMutationObserver=browserGlobal.MutationObserver||browserGlobal.WebKitMutationObserver;var isNode=typeof self==="undefined"&&typeof process!=="undefined"&&{}.toString.call(process)==="[object process]";var isWorker=typeof Uint8ClampedArray!=="undefined"&&typeof importScripts!=="undefined"&&typeof MessageChannel!=="undefined";function useNextTick(){return function(){return process.nextTick(flush)}}function useVertxTimer(){if(typeof vertxNext!=="undefined"){return function(){vertxNext(flush)}}return useSetTimeout()}function useMutationObserver(){var iterations=0;var observer=new BrowserMutationObserver(flush);var node=document.createTextNode("");observer.observe(node,{characterData:true});return function(){node.data=iterations=++iterations%2}}function useMessageChannel(){var channel=new MessageChannel;channel.port1.onmessage=flush;return function(){return channel.port2.postMessage(0)}}function useSetTimeout(){var globalSetTimeout=setTimeout;return function(){return globalSetTimeout(flush,1)}}var queue=new Array(1e3);function flush(){for(var i=0;isize){throw new Error("Elements exceed array size: "+size)}ret=[];type=type.slice(0,type.lastIndexOf("["));if(typeof arg==="string"){arg=JSON.parse(arg)}for(i in arg){ret.push(encodeSingle(type,arg[i]))}if(size==="dynamic"){var length=encodeSingle("uint256",arg.length);ret.unshift(length)}return Buffer.concat(ret)}else if(type==="bytes"){arg=new Buffer(arg);ret=Buffer.concat([encodeSingle("uint256",arg.length),arg]);if(arg.length%32!==0){ret=Buffer.concat([ret,utils.zeros(32-arg.length%32)])}return ret}else if(type.startsWith("bytes")){size=parseTypeN(type);if(size<1||size>32){throw new Error("Invalid bytes width: "+size)}return utils.setLengthRight(arg,32)}else if(type.startsWith("uint")){size=parseTypeN(type);if(size%8||size<8||size>256){throw new Error("Invalid uint width: "+size)}num=parseNumber(arg);if(num.bitLength()>size){throw new Error("Supplied uint exceeds width: "+size+" vs "+num.bitLength())}if(num<0){throw new Error("Supplied uint is negative")}return num.toArrayLike(Buffer,"be",32)}else if(type.startsWith("int")){size=parseTypeN(type);if(size%8||size<8||size>256){throw new Error("Invalid int width: "+size)}num=parseNumber(arg);if(num.bitLength()>size){throw new Error("Supplied int exceeds width: "+size+" vs "+num.bitLength())}return num.toTwos(256).toArrayLike(Buffer,"be",32)}else if(type.startsWith("ufixed")){size=parseTypeNxM(type);num=parseNumber(arg);if(num<0){throw new Error("Supplied ufixed is negative")}return encodeSingle("uint256",num.mul(new BN(2).pow(new BN(size[1]))))}else if(type.startsWith("fixed")){size=parseTypeNxM(type);return encodeSingle("int256",parseNumber(arg).mul(new BN(2).pow(new BN(size[1]))))}throw new Error("Unsupported or invalid type: "+type)}function decodeSingle(parsedType,data,offset){if(typeof parsedType==="string"){parsedType=parseType(parsedType)}var size,num,ret,i;if(parsedType.name==="address"){return decodeSingle(parsedType.rawType,data,offset).toArrayLike(Buffer,"be",20).toString("hex")}else if(parsedType.name==="bool"){return decodeSingle(parsedType.rawType,data,offset).toString()===new BN(1).toString()}else if(parsedType.name==="string"){var bytes=decodeSingle(parsedType.rawType,data,offset);return new Buffer(bytes,"utf8").toString()}else if(parsedType.isArray){ret=[];size=parsedType.size;if(parsedType.size==="dynamic"){offset=decodeSingle("uint256",data,offset).toNumber();size=decodeSingle("uint256",data,offset).toNumber();offset=offset+32}for(i=0;iparsedType.size){throw new Error("Decoded int exceeds width: "+parsedType.size+" vs "+num.bitLength())}return num}else if(parsedType.name.startsWith("int")){num=new BN(data.slice(offset,offset+32),16,"be").fromTwos(256);if(num.bitLength()>parsedType.size){throw new Error("Decoded uint exceeds width: "+parsedType.size+" vs "+num.bitLength())}return num}else if(parsedType.name.startsWith("ufixed")){size=new BN(2).pow(new BN(parsedType.size[1]));num=decodeSingle("uint256",data,offset);if(!num.mod(size).isZero()){throw new Error("Decimals not supported yet")}return num.div(size)}else if(parsedType.name.startsWith("fixed")){size=new BN(2).pow(new BN(parsedType.size[1]));num=decodeSingle("int256",data,offset);if(!num.mod(size).isZero()){throw new Error("Decimals not supported yet")}return num.div(size)}throw new Error("Unsupported or invalid type: "+parsedType.name)}function parseType(type){var size;var ret;if(isArray(type)){size=parseTypeArray(type);var subArray=type.slice(0,type.lastIndexOf("["));subArray=parseType(subArray);ret={isArray:true,name:type,size:size,memoryUsage:size==="dynamic"?32:subArray.memoryUsage*size,subArray:subArray};return ret}else{var rawType;switch(type){case"address":rawType="uint160";break;case"bool":rawType="uint8";break;case"string":rawType="bytes";break}ret={rawType:rawType,name:type,memoryUsage:32};if(type.startsWith("bytes")&&type!=="bytes"||type.startsWith("uint")||type.startsWith("int")){ret.size=parseTypeN(type)}else if(type.startsWith("ufixed")||type.startsWith("fixed")){ret.size=parseTypeNxM(type)}if(type.startsWith("bytes")&&type!=="bytes"&&(ret.size<1||ret.size>32)){throw new Error("Invalid bytes width: "+ret.size)}if((type.startsWith("uint")||type.startsWith("int"))&&(ret.size%8||ret.size<8||ret.size>256)){throw new Error("Invalid int/uint width: "+ret.size)}return ret}}function isDynamic(type){return type==="string"||type==="bytes"||parseTypeArray(type)==="dynamic"}function isArray(type){return type.lastIndexOf("]")===type.length-1}ABI.rawEncode=function(types,values){var output=[];var data=[];var headLength=32*types.length;for(var i in types){var type=elementaryName(types[i]);var value=values[i];var cur=encodeSingle(type,value);if(isDynamic(type)){output.push(encodeSingle("uint256",headLength));data.push(cur);headLength+=cur.length}else{output.push(cur)}}return Buffer.concat(output.concat(data))};ABI.rawDecode=function(types,data){var ret=[];data=new Buffer(data);var offset=0;for(var i in types){var type=elementaryName(types[i]);var parsed=parseType(type,data,offset);var decoded=decodeSingle(parsed,data,offset);offset+=parsed.memoryUsage;ret.push(decoded)}return ret};ABI.simpleEncode=function(method){var args=Array.prototype.slice.call(arguments).slice(1);var sig=parseSignature(method);if(args.length!==sig.args.length){throw new Error("Argument count mismatch")}return Buffer.concat([ABI.methodID(sig.method,sig.args),ABI.rawEncode(sig.args,args)])};ABI.simpleDecode=function(method,data){var sig=parseSignature(method);if(!sig.retargs){throw new Error("No return values in method")}return ABI.rawDecode(sig.retargs,data)};function stringify(type,value){if(type.startsWith("address")||type.startsWith("bytes")){return"0x"+value.toString("hex")}else{return value.toString()}}ABI.stringify=function(types,values){var ret=[];for(var i in types){var type=types[i];var value=values[i];if(/^[^\[]+\[.*\]$/.test(type)){value=value.map(function(item){return stringify(type,item)}).join(", ")}else{value=stringify(type,value)}ret.push(value)}return ret};ABI.solidityPack=function(types,values){if(types.length!==values.length){throw new Error("Number of types are not matching the values")}var size,num;var ret=[];for(var i=0;i32){throw new Error("Invalid bytes width: "+size)}ret.push(utils.setLengthRight(value,size))}else if(type.startsWith("uint")){size=parseTypeN(type);if(size%8||size<8||size>256){throw new Error("Invalid uint width: "+size)}num=parseNumber(value);if(num.bitLength()>size){throw new Error("Supplied uint exceeds width: "+size+" vs "+num.bitLength())}ret.push(num.toArrayLike(Buffer,"be",size/8))}else if(type.startsWith("int")){size=parseTypeN(type);if(size%8||size<8||size>256){throw new Error("Invalid int width: "+size)}num=parseNumber(value);if(num.bitLength()>size){throw new Error("Supplied int exceeds width: "+size+" vs "+num.bitLength())}ret.push(num.toTwos(size).toArrayLike(Buffer,"be",size/8))}else{throw new Error("Unsupported or invalid type: "+type)}}return Buffer.concat(ret)};ABI.soliditySHA3=function(types,values){return utils.sha3(ABI.solidityPack(types,values))};ABI.soliditySHA256=function(types,values){return utils.sha256(ABI.solidityPack(types,values))};ABI.solidityRIPEMD160=function(types,values){return utils.ripemd160(ABI.solidityPack(types,values),true)};function isNumeric(c){return c>="0"&&c<="9"}ABI.fromSerpent=function(sig){var ret=[];for(var i=0;i0&&first.toString()==="0"){a=a.slice(1);first=a[0]}return a};exports.toBuffer=function(v){if(!Buffer.isBuffer(v)){if(Array.isArray(v)){v=new Buffer(v)}else if(typeof v==="string"){if(exports.isHexPrefixed(v)){v=new Buffer(exports.padToEven(exports.stripHexPrefix(v)),"hex")}else{v=new Buffer(v)}}else if(typeof v==="number"){v=exports.intToBuffer(v)}else if(v===null||v===undefined){v=new Buffer([])}else if(v.toArray){v=new Buffer(v.toArray())}else{throw new Error("invalid type")}}return v};exports.intToHex=function(i){assert(i%1===0,"number is not a integer");assert(i>=0,"number must be positive");var hex=i.toString(16);if(hex.length%2){hex="0"+hex}return"0x"+hex};exports.intToBuffer=function(i){var hex=exports.intToHex(i);return new Buffer(hex.slice(2),"hex")};exports.bufferToInt=function(buf){return parseInt(exports.bufferToHex(buf),16)};exports.bufferToHex=function(buf){buf=exports.toBuffer(buf);if(buf.length===0){return 0}return"0x"+buf.toString("hex")};exports.fromSigned=function(num){return new BN(num).fromTwos(256)};exports.toUnsigned=function(num){return new Buffer(num.toTwos(256).toArray())};exports.sha3=function(a,bytes){a=exports.toBuffer(a);if(!bytes)bytes=256;var h=new SHA3(bytes);if(a){h.update(a)}return new Buffer(h.digest("hex"),"hex")};exports.sha256=function(a){a=exports.toBuffer(a);return createHash("sha256").update(a).digest()};exports.ripemd160=function(a,padded){a=exports.toBuffer(a);var hash=createHash("rmd160").update(a).digest();if(padded===true){return exports.setLength(hash,32)}else{return hash}};exports.rlphash=function(a){return exports.sha3(rlp.encode(a))};exports.isValidPrivate=function(privateKey){return secp256k1.privateKeyVerify(privateKey)};exports.isValidPublic=function(publicKey,sanitize){if(publicKey.length===64){return secp256k1.publicKeyVerify(Buffer.concat([new Buffer([4]),publicKey]))}if(!sanitize){return false}return secp256k1.publicKeyVerify(publicKey)};exports.pubToAddress=exports.publicToAddress=function(pubKey,sanitize){pubKey=exports.toBuffer(pubKey);if(sanitize&&pubKey.length!==64){pubKey=secp256k1.publicKeyConvert(pubKey,false).slice(1)}assert(pubKey.length===64);return exports.sha3(pubKey).slice(-20)};var privateToPublic=exports.privateToPublic=function(privateKey){privateKey=exports.toBuffer(privateKey);return secp256k1.publicKeyCreate(privateKey,false).slice(1)};exports.importPublic=function(publicKey){publicKey=exports.toBuffer(publicKey);if(publicKey.length!==64){publicKey=secp256k1.publicKeyConvert(publicKey,false).slice(1)}return publicKey};exports.ecsign=function(msgHash,privateKey){var sig=secp256k1.sign(msgHash,privateKey);var ret={};ret.r=sig.signature.slice(0,32);ret.s=sig.signature.slice(32,64);ret.v=sig.recovery+27;return ret};exports.ecrecover=function(msgHash,v,r,s){var signature=Buffer.concat([exports.setLength(r,32),exports.setLength(s,32)],64);var recovery=exports.bufferToInt(v)-27;if(recovery!==0&&recovery!==1){throw new Error("Invalid signature v value")}var senderPubKey=secp256k1.recover(msgHash,signature,recovery);return secp256k1.publicKeyConvert(senderPubKey,false).slice(1)};exports.toRpcSig=function(v,r,s){return exports.bufferToHex(Buffer.concat([r,s,exports.toBuffer(v-27)]))};exports.fromRpcSig=function(sig){sig=exports.toBuffer(sig);var v=sig[64];if(v<27){v+=27}return{v:v,r:sig.slice(0,32),s:sig.slice(32,64)}};exports.privateToAddress=function(privateKey){return exports.publicToAddress(privateToPublic(privateKey))};exports.isValidAddress=function(address){return/^0x[0-9a-fA-F]{40}$/i.test(address)};exports.toChecksumAddress=function(address){address=exports.stripHexPrefix(address).toLowerCase();var hash=exports.sha3(address).toString("hex");var ret="0x";for(var i=0;i=8){ret+=address[i].toUpperCase()}else{ret+=address[i]}}return ret};exports.isValidChecksumAddress=function(address){return exports.isValidAddress(address)&&exports.toChecksumAddress(address)===address};exports.generateAddress=function(from,nonce){from=exports.toBuffer(from);nonce=new BN(nonce);if(nonce.isZero()){nonce=null}else{nonce=new Buffer(nonce.toArray())}return exports.rlphash([from,nonce]).slice(-20)};exports.isPrecompiled=function(address){var a=exports.unpad(address);return a.length===1&&a[0]>0&&a[0]<5};exports.isHexPrefixed=function(str){return str.slice(0,2)==="0x"};exports.stripHexPrefix=function(str){if(typeof str!=="string"){return str}return exports.isHexPrefixed(str)?str.slice(2):str};exports.addHexPrefix=function(str){if(typeof str!=="string"){return str}return exports.isHexPrefixed(str)?str:"0x"+str};exports.padToEven=function(a){if(a.length%2)a="0"+a;return a};exports.baToJSON=function(ba){if(Buffer.isBuffer(ba)){return"0x"+ba.toString("hex")}else if(ba instanceof Array){var array=[];for(var i=0;i=v.length,"The field "+field.name+" must not have more "+field.length+" bytes")}else if(!(field.allowZero&&v.length===0)&&field.length){assert(field.length===v.length,"The field "+field.name+" must have byte length of "+field.length)}self.raw[i]=v}Object.defineProperty(self,field.name,{enumerable:true,configurable:true,get:getter,set:setter});if(field.default){self[field.name]=field.default}if(field.alias){Object.defineProperty(self,field.alias,{enumerable:false,configurable:true,set:setter,get:getter})}});if(data){if(typeof data==="string"){data=new Buffer(exports.stripHexPrefix(data),"hex")}if(Buffer.isBuffer(data)){data=rlp.decode(data)}if(Array.isArray(data)){if(data.length>self._fields.length){throw new Error("wrong number of fields in data")}data.forEach(function(d,i){self[self._fields[i]]=exports.toBuffer(d)})}else if(typeof data==="object"){for(var prop in data){if(self._fields.indexOf(prop)!==-1){self[prop]=data[prop]}}}else{throw new Error("invalid data")}}}}).call(this,require("buffer").Buffer)},{assert:2,"bn.js":7,buffer:14,"create-hash":18,keccakjs:191,rlp:233,secp256k1:235}],42:[function(require,module,exports){"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator["throw"](value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):new P(function(resolve){resolve(result.value)}).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};var __generator=this&&this.__generator||function(thisArg,body){var _={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},f,y,t,g;return g={next:verb(0),"throw":verb(1),"return":verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=y[op[0]&2?"return":op[0]?"throw":"next"])&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[0,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]parseInt(newBlock.number,16)};var isAlreadyInHistory=function(blockHistory,newBlock){return blockHistory.some(function(block){return block.hash===newBlock.hash})};var isNewHeadBlock=function(blockHistory,newBlock){return blockHistory.last().hash===newBlock.parentHash};var parentHashIsInHistory=function(blockHistory,newBlock){return blockHistory.some(function(block){return block.hash===newBlock.parentHash})}},{}],44:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var block_and_log_streamer_1=require("./block-and-log-streamer");exports.BlockAndLogStreamer=block_and_log_streamer_1.BlockAndLogStreamer},{"./block-and-log-streamer":42}],45:[function(require,module,exports){"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator["throw"](value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):new P(function(resolve){resolve(result.value)}).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};var __generator=this&&this.__generator||function(thisArg,body){var _={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},f,y,t,g;return g={next:verb(0),"throw":verb(1),"return":verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=y[op[0]&2?"return":op[0]?"throw":"next"])&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[0,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]newLogBlockNumber)throw new Error("received log for a block ("+newLogBlockNumber+") older than current head log's block ("+headBlockNumber+")");if(headBlockNumber!==newLogBlockNumber)return;var headLogIndex=parseInt(headLog.logIndex,16);var newLogIndex=parseInt(newLog.logIndex,16);if(headLogIndex>=newLogIndex)throw new Error("received log with same block number ("+newLogBlockNumber+") but index ("+newLogIndex+") is the same or older than previous index ("+headLogIndex+")")};exports.reconcileLogHistoryWithRemovedBlock=function(logHistory,removedBlock,onLogRemoved){return __awaiter(_this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,logHistory];case 1:logHistory=_a.sent();_a.label=2;case 2:if(!(!logHistory.isEmpty()&&logHistory.last().blockHash===removedBlock.hash))return[3,4];return[4,onLogRemoved(logHistory.last())];case 3:_a.sent();logHistory=logHistory.pop();return[3,2];case 4:if(logHistory.some(function(log){return log.blockHash===removedBlock.hash}))throw new Error("found logs for removed block not at head of log history");return[2,logHistory]}})})}},{}],46:[function(require,module,exports){(function(Buffer){"use strict";var _createClass=function(){function defineProperties(target,props){for(var i=0;i0){var raw=this.raw.slice();this.v=this._chainId;this.r=0;this.s=0;items=this.raw;this.raw=raw}else{items=this.raw.slice(0,6)}}return ethUtil.rlphash(items)}},{key:"getChainId",value:function getChainId(){return this._chainId}},{key:"getSenderAddress",value:function getSenderAddress(){if(this._from){return this._from}var pubkey=this.getSenderPublicKey();this._from=ethUtil.publicToAddress(pubkey);return this._from}},{key:"getSenderPublicKey",value:function getSenderPublicKey(){if(!this._senderPubKey||!this._senderPubKey.length){if(!this.verifySignature())throw new Error("Invalid Signature")}return this._senderPubKey}},{key:"verifySignature",value:function verifySignature(){var msgHash=this.hash(false);if(this._homestead&&new BN(this.s).cmp(N_DIV_2)===1){return false}try{var v=ethUtil.bufferToInt(this.v);if(this._chainId>0){v-=this._chainId*2+8}this._senderPubKey=ethUtil.ecrecover(msgHash,v,this.r,this.s)}catch(e){return false}return!!this._senderPubKey}},{key:"sign",value:function sign(privateKey){var msgHash=this.hash(false);var sig=ethUtil.ecsign(msgHash,privateKey);if(this._chainId>0){sig.v+=this._chainId*2+8}Object.assign(this,sig)}},{key:"getDataFee",value:function getDataFee(){var data=this.raw[5];var cost=new BN(0);for(var i=0;i0){errors.push(["gas limit is too low. Need at least "+this.getBaseFee()])}if(stringError===undefined||stringError===false){return errors.length===0}else{return errors.join(" ")}}}]);return Transaction}();module.exports=Transaction}).call(this,require("buffer").Buffer)},{buffer:14,"ethereum-common/params.json":38,"ethereumjs-util":47}],47:[function(require,module,exports){(function(Buffer){"use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj};var createKeccakHash=require("keccak");var secp256k1=require("secp256k1");var assert=require("assert");var rlp=require("rlp");var BN=require("bn.js");var createHash=require("create-hash");Object.assign(exports,require("ethjs-util"));exports.MAX_INTEGER=new BN("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16);exports.TWO_POW256=new BN("10000000000000000000000000000000000000000000000000000000000000000",16);exports.SHA3_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470";exports.SHA3_NULL=Buffer.from(exports.SHA3_NULL_S,"hex");exports.SHA3_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347";exports.SHA3_RLP_ARRAY=Buffer.from(exports.SHA3_RLP_ARRAY_S,"hex");exports.SHA3_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421";exports.SHA3_RLP=Buffer.from(exports.SHA3_RLP_S,"hex");exports.BN=BN;exports.rlp=rlp;exports.secp256k1=secp256k1;exports.zeros=function(bytes){return Buffer.allocUnsafe(bytes).fill(0)};exports.setLengthLeft=exports.setLength=function(msg,length,right){var buf=exports.zeros(length);msg=exports.toBuffer(msg);if(right){if(msg.length0&&first.toString()==="0"){a=a.slice(1);first=a[0]}return a};exports.toBuffer=function(v){if(!Buffer.isBuffer(v)){if(Array.isArray(v)){v=Buffer.from(v)}else if(typeof v==="string"){if(exports.isHexString(v)){v=Buffer.from(exports.padToEven(exports.stripHexPrefix(v)),"hex")}else{v=Buffer.from(v)}}else if(typeof v==="number"){v=exports.intToBuffer(v)}else if(v===null||v===undefined){v=Buffer.allocUnsafe(0)}else if(v.toArray){v=Buffer.from(v.toArray())}else{throw new Error("invalid type")}}return v};exports.bufferToInt=function(buf){return new BN(exports.toBuffer(buf)).toNumber()};exports.bufferToHex=function(buf){buf=exports.toBuffer(buf);return"0x"+buf.toString("hex")};exports.fromSigned=function(num){return new BN(num).fromTwos(256)};exports.toUnsigned=function(num){return Buffer.from(num.toTwos(256).toArray())};exports.sha3=function(a,bits){a=exports.toBuffer(a);if(!bits)bits=256;return createKeccakHash("keccak"+bits).update(a).digest()};exports.sha256=function(a){a=exports.toBuffer(a);return createHash("sha256").update(a).digest()};exports.ripemd160=function(a,padded){a=exports.toBuffer(a);var hash=createHash("rmd160").update(a).digest();if(padded===true){return exports.setLength(hash,32)}else{return hash}};exports.rlphash=function(a){return exports.sha3(rlp.encode(a))};exports.isValidPrivate=function(privateKey){return secp256k1.privateKeyVerify(privateKey)};exports.isValidPublic=function(publicKey,sanitize){if(publicKey.length===64){return secp256k1.publicKeyVerify(Buffer.concat([Buffer.from([4]),publicKey]))}if(!sanitize){return false}return secp256k1.publicKeyVerify(publicKey)};exports.pubToAddress=exports.publicToAddress=function(pubKey,sanitize){pubKey=exports.toBuffer(pubKey);if(sanitize&&pubKey.length!==64){pubKey=secp256k1.publicKeyConvert(pubKey,false).slice(1)}assert(pubKey.length===64);return exports.sha3(pubKey).slice(-20)};var privateToPublic=exports.privateToPublic=function(privateKey){privateKey=exports.toBuffer(privateKey);return secp256k1.publicKeyCreate(privateKey,false).slice(1)};exports.importPublic=function(publicKey){publicKey=exports.toBuffer(publicKey);if(publicKey.length!==64){publicKey=secp256k1.publicKeyConvert(publicKey,false).slice(1)}return publicKey};exports.ecsign=function(msgHash,privateKey){var sig=secp256k1.sign(msgHash,privateKey);var ret={};ret.r=sig.signature.slice(0,32);ret.s=sig.signature.slice(32,64);ret.v=sig.recovery+27;return ret};exports.hashPersonalMessage=function(message){var prefix=exports.toBuffer("Ethereum Signed Message:\n"+message.length.toString());return exports.sha3(Buffer.concat([prefix,message]))};exports.ecrecover=function(msgHash,v,r,s){var signature=Buffer.concat([exports.setLength(r,32),exports.setLength(s,32)],64);var recovery=v-27;if(recovery!==0&&recovery!==1){throw new Error("Invalid signature v value")}var senderPubKey=secp256k1.recover(msgHash,signature,recovery);return secp256k1.publicKeyConvert(senderPubKey,false).slice(1)};exports.toRpcSig=function(v,r,s){if(v!==27&&v!==28){throw new Error("Invalid recovery id")}return exports.bufferToHex(Buffer.concat([exports.setLengthLeft(r,32),exports.setLengthLeft(s,32),exports.toBuffer(v-27)]))};exports.fromRpcSig=function(sig){sig=exports.toBuffer(sig);if(sig.length!==65){throw new Error("Invalid signature length")}var v=sig[64];if(v<27){v+=27}return{v:v,r:sig.slice(0,32),s:sig.slice(32,64)}};exports.privateToAddress=function(privateKey){return exports.publicToAddress(privateToPublic(privateKey))};exports.isValidAddress=function(address){return/^0x[0-9a-fA-F]{40}$/i.test(address)};exports.toChecksumAddress=function(address){address=exports.stripHexPrefix(address).toLowerCase();var hash=exports.sha3(address).toString("hex");var ret="0x";for(var i=0;i=8){ret+=address[i].toUpperCase()}else{ret+=address[i]}}return ret};exports.isValidChecksumAddress=function(address){return exports.isValidAddress(address)&&exports.toChecksumAddress(address)===address};exports.generateAddress=function(from,nonce){from=exports.toBuffer(from);nonce=new BN(nonce);if(nonce.isZero()){nonce=null}else{nonce=Buffer.from(nonce.toArray())}return exports.rlphash([from,nonce]).slice(-20)};exports.isPrecompiled=function(address){var a=exports.unpad(address);return a.length===1&&a[0]>0&&a[0]<5};exports.addHexPrefix=function(str){if(typeof str!=="string"){return str}return exports.isHexPrefixed(str)?str:"0x"+str};exports.isValidSignature=function(v,r,s,homestead){var SECP256K1_N_DIV_2=new BN("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16);var SECP256K1_N=new BN("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);if(r.length!==32||s.length!==32){return false}if(v!==27&&v!==28){return false}r=new BN(r);s=new BN(s);if(r.isZero()||r.gt(SECP256K1_N)||s.isZero()||s.gt(SECP256K1_N)){return false}if(homestead===false&&new BN(s).cmp(SECP256K1_N_DIV_2)===1){return false}return true};exports.baToJSON=function(ba){if(Buffer.isBuffer(ba)){return"0x"+ba.toString("hex")}else if(ba instanceof Array){var array=[];for(var i=0;i=v.length,"The field "+field.name+" must not have more "+field.length+" bytes")}else if(!(field.allowZero&&v.length===0)&&field.length){assert(field.length===v.length,"The field "+field.name+" must have byte length of "+field.length)}self.raw[i]=v}Object.defineProperty(self,field.name,{enumerable:true,configurable:true,get:getter,set:setter});if(field.default){self[field.name]=field.default}if(field.alias){Object.defineProperty(self,field.alias,{enumerable:false,configurable:true,set:setter,get:getter})}});if(data){if(typeof data==="string"){data=Buffer.from(exports.stripHexPrefix(data),"hex")}if(Buffer.isBuffer(data)){data=rlp.decode(data)}if(Array.isArray(data)){if(data.length>self._fields.length){throw new Error("wrong number of fields in data")}data.forEach(function(d,i){self[self._fields[i]]=exports.toBuffer(d)})}else if((typeof data==="undefined"?"undefined":_typeof(data))==="object"){var keys=Object.keys(data);fields.forEach(function(field){if(keys.indexOf(field.name)!==-1)self[field.name]=data[field.name];if(keys.indexOf(field.alias)!==-1)self[field.alias]=data[field.alias]})}else{throw new Error("invalid data")}}}}).call(this,require("buffer").Buffer)},{assert:2,"bn.js":7,buffer:14,"create-hash":18,"ethjs-util":48,keccak:185,rlp:233,secp256k1:235}],48:[function(require,module,exports){(function(Buffer){"use strict";var isHexPrefixed=require("is-hex-prefixed");var stripHexPrefix=require("strip-hex-prefix");function padToEven(value){var a=value;if(typeof a!=="string"){throw new Error("[ethjs-util] while padding to even, value must be string, is currently "+typeof a+", while padToEven.")}if(a.length%2){a="0"+a}return a}function intToHex(i){var hex=i.toString(16);return"0x"+padToEven(hex)}function intToBuffer(i){var hex=intToHex(i);return new Buffer(hex.slice(2),"hex")}function getBinarySize(str){if(typeof str!=="string"){throw new Error("[ethjs-util] while getting binary size, method getBinarySize requires input 'str' to be type String, got '"+typeof str+"'.")}return Buffer.byteLength(str,"utf8")}function arrayContainsArray(superset,subset,some){if(Array.isArray(superset)!==true){throw new Error("[ethjs-util] method arrayContainsArray requires input 'superset' to be an array got type '"+typeof superset+"'")}if(Array.isArray(subset)!==true){throw new Error("[ethjs-util] method arrayContainsArray requires input 'subset' to be an array got type '"+typeof subset+"'")}return subset[Boolean(some)&&"some"||"every"](function(value){return superset.indexOf(value)>=0})}function toUtf8(hex){var bufferValue=new Buffer(padToEven(stripHexPrefix(hex).replace(/^0+|0+$/g,"")),"hex");return bufferValue.toString("utf8")}function toAscii(hex){var str="";var i=0,l=hex.length;if(hex.substring(0,2)==="0x"){i=2}for(;i=endBlock){if(!mine)return callback(null,endBlock);dispatch(miner.stop(null,function(){callback(null,endBlock)}))}else{setTimeout(waitForNextBlocks,constants.BLOCK_POLL_INTERVAL)}}))}if(!callback&&isFunction(mine)){callback=mine;mine=null}if(!mine)return waitForNextBlocks(null);dispatch(miner.start(null,waitForNextBlocks))}}},{"../constants":60,"../errors/rpc-error":69,"../utils/is-function":130,"../wrappers/eth":148,"../wrappers/miner":151}],58:[function(require,module,exports){"use strict";var isObject=require("./utils/is-object");var internalState=require("./internal-state");function clearTransactions(){return function(dispatch){var notifications=internalState.get("notifications");if(isObject(notifications)){Object.keys(notifications).map(function(hash){if(notifications[hash])clearTimeout(notifications[hash])})}dispatch({type:"REMOVE_ALL_TRANSACTIONS"});dispatch({type:"RESET_HIGHEST_NONCE"})}}module.exports=clearTransactions},{"./internal-state":71,"./utils/is-object":134}],59:[function(require,module,exports){"use strict";var async=require("async");var net_version=require("./wrappers/net").version;var setGasPrice=require("./wrappers/set-gas-price");var setCoinbase=require("./wrappers/set-coinbase");var Transporter=require("./transport/transporter");var ensureLatestBlock=require("./block-management/ensure-latest-block");var startBlockStream=require("./start-block-stream");var validateConfiguration=require("./validate/validate-configuration");var resetState=require("./reset-state");var isFunction=require("./utils/is-function");var logError=require("./utils/log-error");var internalState=require("./internal-state");var RPCError=require("./errors/rpc-error");function connect(configuration,initialConnectCallback){return function(dispatch,getState){dispatch(resetState());if(!isFunction(configuration.errorHandler))configuration.errorHandler=logError;internalState.set("outOfBandErrorHandler",configuration.errorHandler);dispatch({type:"SET_CONFIGURATION",configuration:validateConfiguration(configuration)});var storedConfiguration=getState().configuration;new Transporter(storedConfiguration,internalState.get("shimMessageHandler"),getState().debug.connect,function(err,transporter){if(err)return initialConnectCallback(err);internalState.set("transporter",transporter);dispatch(net_version(null,function(err,networkID){if(err)return initialConnectCallback(err);if(networkID==null)return initialConnectCallback(new RPCError("NO_RESPONSE"));if(configuration.networkID&&parseInt(networkID,10)!==parseInt(configuration.networkID,10)){return initialConnectCallback(networkID)}dispatch({type:"SET_NETWORK_ID",networkID:networkID});if(storedConfiguration.startBlockStreamOnConnect)dispatch(startBlockStream());async.parallel([function(next){dispatch(ensureLatestBlock(function(err){next(err)}))},function(next){dispatch(setCoinbase(next))},function(next){dispatch(setGasPrice(next))}],initialConnectCallback)}))})}}module.exports=connect},{"./block-management/ensure-latest-block":51,"./errors/rpc-error":69,"./internal-state":71,"./reset-state":97,"./start-block-stream":100,"./transport/transporter":126,"./utils/is-function":130,"./utils/log-error":136,"./validate/validate-configuration":142,"./wrappers/net":152,"./wrappers/set-coinbase":158,"./wrappers/set-gas-price":159,async:3}],60:[function(require,module,exports){"use strict";var BigNumber=require("bignumber.js");BigNumber.config({MODULO_MODE:BigNumber.EUCLID,ROUNDING_MODE:BigNumber.ROUND_HALF_DOWN});module.exports={ACCOUNT_TYPES:{U_PORT:"uPort",LEDGER:"ledger",PRIVATE_KEY:"privateKey",UNLOCKED_ETHEREUM_NODE:"unlockedEthereumNode",META_MASK:"metaMask"},REQUIRED_CONFIRMATIONS:0,TX_RETRY_MAX:5,TX_POLL_MAX:1e3,TX_POLL_INTERVAL:1e4,BLOCK_POLL_INTERVAL:3e4,DEFAULT_GAS:"0x2fd618",ETHER:new BigNumber(10,10).toPower(18)}},{"bignumber.js":5}],61:[function(require,module,exports){"use strict";var createStore=require("redux").createStore;var thunkSubscribeEnhancer=require("redux-thunk-subscribe");var ensureLatestBlock=require("./block-management/ensure-latest-block");var waitForNextBlocks=require("./block-management/wait-for-next-blocks");var packageAndSubmitRawTransaction=require("./raw-transactions/package-and-submit-raw-transaction");var packageAndSignRawTransaction=require("./raw-transactions/package-and-sign-raw-transaction");var packageRawTransaction=require("./raw-transactions/package-raw-transaction");var signRawTransaction=require("./raw-transactions/sign-raw-transaction");var signRawTransactionWithKey=require("./raw-transactions/sign-raw-transaction-with-key");var packageRequest=require("./encode-request/package-request");var validateAndDefaultBlockNumber=require("./validate/validate-and-default-block-number");var validateTransaction=require("./validate/validate-transaction");var registerTransactionRelay=require("./transaction-relay/register-transaction-relay");var unregisterTransactionRelay=require("./transaction-relay/unregister-transaction-relay");var excludeFromTransactionRelay=require("./transaction-relay/exclude-from-transaction-relay");var includeInTransactionRelay=require("./transaction-relay/include-in-transaction-relay");var callOrSendTransaction=require("./transact/call-or-send-transaction");var callContractFunction=require("./transact/call-contract-function");var transact=require("./transact/transact");var raw=require("./wrappers/raw");var eth=require("./wrappers/eth");var net_=require("./wrappers/net");var web3=require("./wrappers/web3");var personal=require("./wrappers/personal");var shh=require("./wrappers/shh");var miner=require("./wrappers/miner");var publish=require("./wrappers/publish");var bindDispatch=require("./wrappers/bind-dispatch");var isUnlocked=require("./wrappers/is-unlocked");var resendTransaction=require("./wrappers/resend-transaction");var resendRawTransaction=require("./wrappers/resend-raw-transaction");var isFunction=require("./utils/is-function");var sha3=require("./utils/sha3");var setDebugOptions=require("./debug/set-debug-options");var errors=require("./errors/codes");var clearTransactions=require("./clear-transactions");var resetState=require("./reset-state");var connect=require("./connect");var startBlockStream=require("./start-block-stream.js");var internalState=require("./internal-state");var constants=require("./constants");var createEthrpc=function(reducer){var store=createStore(reducer,thunkSubscribeEnhancer);var dispatch=store.dispatch;return{errors:errors,constants:constants,setDebugOptions:function(debugOptions){return dispatch(setDebugOptions(debugOptions))},connect:function(configuration,callback){return dispatch(connect(configuration,callback))},startBlockStream:function(startingBlockNumber){return dispatch(startBlockStream(startingBlockNumber))},clear:function(){return dispatch(clearTransactions())},resetState:function(){return dispatch(resetState())},getBlockStream:function(){return internalState.get("blockAndLogStreamer")},getTransport:function(){return internalState.get("transporter")},getConfiguration:function(){return store.getState().configuration},getCoinbase:function(){return store.getState().coinbase},getCurrentBlock:function(){return store.getState().currentBlock},getDebugOptions:function(){return store.getState().debug},getGasPrice:function(){return store.getState().gasPrice},getHighestNonce:function(){return store.getState().highestNonce},getNetworkID:function(){return store.getState().networkID},getNoRelay:function(){return store.getState().noRelay},getSubscriptions:function(){return store.getState().subscriptions},getTransactions:function(){return store.getState().transactions},registerTransactionRelay:function(relayer){return dispatch(registerTransactionRelay(relayer))},unregisterTransactionRelay:function(relayer){return dispatch(unregisterTransactionRelay(relayer))},excludeFromTransactionRelay:function(method){return dispatch(excludeFromTransactionRelay(method))},includeInTransactionRelay:function(method){return dispatch(includeInTransactionRelay(method))},raw:function(cmd,params,callback){return dispatch(raw(cmd,params,callback))},eth:bindDispatch(dispatch,eth),net:bindDispatch(dispatch,net_),web3:bindDispatch(dispatch,web3),shh:bindDispatch(dispatch,shh),miner:bindDispatch(dispatch,miner),personal:bindDispatch(dispatch,personal),sha3:sha3,clientVersion:function(callback){return dispatch(web3.clientVersion(null,callback))},listening:function(callback){return dispatch(net_.listening(null,callback))},peerCount:function(callback){return dispatch(net_.peerCount(null,callback))},version:function(callback){return dispatch(net_.version(null,callback))},netVersion:function(callback){return this.version(callback)},accounts:function(callback){return dispatch(eth.accounts(null,callback))},blockNumber:function(callback){return dispatch(eth.blockNumber(null,callback))},call:function(transaction,blockNumber,callback){if(isFunction(blockNumber)){callback=blockNumber;blockNumber=null}return dispatch(eth.call([transaction,validateAndDefaultBlockNumber(blockNumber)],callback))},coinbase:function(callback){return dispatch(eth.coinbase(null,callback))},estimateGas:function(transaction,blockNumber,callback){if(isFunction(blockNumber)){callback=blockNumber;blockNumber=null}return dispatch(eth.estimateGas([transaction,validateAndDefaultBlockNumber(blockNumber)],callback))},gasPrice:function(callback){return dispatch(eth.gasPrice(null,callback))},getBalance:function(address,blockNumber,callback){if(isFunction(blockNumber)){callback=blockNumber;blockNumber=null}return dispatch(eth.getBalance([address,validateAndDefaultBlockNumber(blockNumber)],callback))},balance:function(address,blockNumber,callback){return this.getBalance(address,blockNumber,callback)},getBlockByHash:function(hash,shouldReturnFullTransactions,callback){if(shouldReturnFullTransactions===undefined)shouldReturnFullTransactions=true;return dispatch(eth.getBlockByHash([hash,Boolean(shouldReturnFullTransactions)],callback))},getBlockByNumber:function(number,shouldReturnFullTransactions,callback){if(shouldReturnFullTransactions!==true)shouldReturnFullTransactions=false;return dispatch(eth.getBlockByNumber([validateAndDefaultBlockNumber(number),Boolean(shouldReturnFullTransactions)],callback))},getBlock:function(number,shouldReturnFullTransactions,callback){return this.getBlockByNumber(number,shouldReturnFullTransactions,callback)},getCode:function(address,blockNumber,callback){return dispatch(eth.getCode([address,validateAndDefaultBlockNumber(blockNumber)],callback))},getFilterChanges:function(filter,callback){return dispatch(eth.getFilterChanges([filter],callback))},getFilterLogs:function(filter,callback){return dispatch(eth.getFilterLogs(filter,callback))},getLogs:function(filter,callback){return dispatch(eth.getLogs(filter,callback))},getStorageAt:function(address,position,blockNumber,callback){return dispatch(eth.getStorageAt([address,position,validateAndDefaultBlockNumber(blockNumber)],callback))},getTransactionByHash:function(transactionHash,callback){return dispatch(eth.getTransactionByHash([transactionHash],callback))},getTransaction:function(transactionHash,callback){return this.getTransactionByHash(transactionHash,callback)},getTransactionCount:function(address,callback){return dispatch(eth.getTransactionCount([address,"latest"],callback))},getPendingTransactionCount:function(address,callback){return dispatch(eth.getTransactionCount([address,"pending"],callback))},getTransactionReceipt:function(transactionHash,callback){return dispatch(eth.getTransactionReceipt(transactionHash,callback))},getUncleByBlockHashAndIndex:function(blockHash,index,callback){return dispatch(eth.getUncleByBlockHashAndIndex([blockHash,index],callback))},getUncleByBlockNumberAndIndex:function(blockNumber,index,callback){return dispatch(eth.getUncleByBlockNumberAndIndex([validateAndDefaultBlockNumber(blockNumber),index],callback))},getUncle:function(blockNumber,index,callback){return this.getUncleByBlockNumberAndIndex(blockNumber,index,callback)},getUncleCountByBlockHash:function(blockHash,callback){return dispatch(eth.getUncleCountByBlockHash([blockHash],callback))},getUncleCountByBlockNumber:function(blockNumber,callback){return dispatch(eth.getUncleCountByBlockNumber([validateAndDefaultBlockNumber(blockNumber)],callback))},getUncleCount:function(blockNumber,callback){return this.getUncleCountByBlockNumber(blockNumber,callback)},hashrate:function(callback){return dispatch(eth.hashrate(null,callback))},mining:function(callback){return dispatch(eth.mining(null,callback))},newBlockFilter:function(callback){return dispatch(eth.newBlockFilter(null,callback))},newFilter:function(filterOptions,callback){filterOptions.fromBlock=validateAndDefaultBlockNumber(filterOptions.fromBlock);filterOptions.toBlock=validateAndDefaultBlockNumber(filterOptions.toBlock);return dispatch(eth.newFilter(filterOptions,callback))},newPendingTransactionFilter:function(callback){return dispatch(eth.newPendingTransactionFilter(null,callback))},protocolVersion:function(callback){return dispatch(eth.protocolVersion(null,callback))},sendRawTransaction:function(signedTransaction,callback){if(/^[0-9a-fA-F]*$/.test(signedTransaction)){signedTransaction="0x"+signedTransaction}if(!/^0x[0-9a-fA-F]*$/.test(signedTransaction)){throw new Error("signedTransaction must be RLP encoded hex byte array encoded into a string")}return dispatch(eth.sendRawTransaction([signedTransaction],callback))},sendTransaction:function(transaction,callback){validateTransaction(transaction);return dispatch(eth.sendTransaction([transaction],callback))},sign:function(address,data,callback){return dispatch(eth.sign([address,data],callback))},signTransaction:function(transaction,callback){validateTransaction(transaction);return dispatch(eth.signTransaction([transaction],callback))},subscribe:function(label,options,callback){if(options===undefined)options={};if(options===null)options={};if(typeof options!=="object")throw new Error("options must be an object");return dispatch(eth.subscribe([label,options],callback))},subscribeLogs:function(options,callback){return this.subscribe("logs",options,callback)},subscribeNewHeads:function(callback){return this.subscribe("newHeads",null,callback)},subscribeNewPendingTransactions:function(callback){return this.subscribe("newPendingTransactions",null,callback)},syncing:function(callback){return dispatch(eth.syncing(null,callback))},uninstallFilter:function(filter,callback){return dispatch(eth.uninstallFilter([filter],callback))},unsubscribe:function(label,callback){return dispatch(eth.unsubscribe([label],callback))},WsTransport:require("./transport/ws-transport"),signRawTransaction:signRawTransaction,signRawTransactionWithKey:signRawTransactionWithKey,packageRawTransaction:packageRawTransaction,packageRequest:packageRequest,packageAndSubmitRawTransaction:function(payload,address,privateKeyOrSigner,accountType,callback){return dispatch(packageAndSubmitRawTransaction(payload,address,privateKeyOrSigner,accountType,callback))},packageAndSignRawTransaction:function(payload,address,privateKeyOrSigner,accountType,callback){return dispatch(packageAndSignRawTransaction(payload,address,privateKeyOrSigner,accountType,callback))},publish:function(compiled,callback){return dispatch(publish(compiled,callback))},ensureLatestBlock:function(callback){return dispatch(ensureLatestBlock(callback))},isUnlocked:function(account,callback){return dispatch(isUnlocked(account,callback))},waitForNextBlocks:function(blocks,mine,callback){return dispatch(waitForNextBlocks(blocks,mine,callback))},resend:function(transaction,gasPrice,gasLimit,callback){return dispatch(resendTransaction(transaction,gasPrice,gasLimit,callback))},resendRawTransaction:function(transaction,privateKey,gasPrice,gasLimit,callback){return dispatch(resendRawTransaction(transaction,privateKey,gasPrice,gasLimit,callback))},callOrSendTransaction:function(payload,callback){return dispatch(callOrSendTransaction(payload,callback))},callContractFunction:function(payload,callback,wrapper,aux){return dispatch(callContractFunction(payload,callback,wrapper,aux))},transact:function(payload,privateKeyOrSigner,accountType,onSent,onSuccess,onFailed){return dispatch(transact(payload,privateKeyOrSigner,accountType,onSent,onSuccess,onFailed))}}};module.exports=createEthrpc},{"./block-management/ensure-latest-block":51,"./block-management/wait-for-next-blocks":57,"./clear-transactions":58,"./connect":59,"./constants":60,"./debug/set-debug-options":62,"./encode-request/package-request":66,"./errors/codes":68,"./internal-state":71,"./raw-transactions/package-and-sign-raw-transaction":76,"./raw-transactions/package-and-submit-raw-transaction":77,"./raw-transactions/package-raw-transaction":78,"./raw-transactions/sign-raw-transaction":82,"./raw-transactions/sign-raw-transaction-with-key":81,"./reset-state":97,"./start-block-stream.js":100,"./transact/call-contract-function":106,"./transact/call-or-send-transaction":107,"./transact/transact":111,"./transaction-relay/exclude-from-transaction-relay":117,"./transaction-relay/include-in-transaction-relay":118,"./transaction-relay/register-transaction-relay":119,"./transaction-relay/unregister-transaction-relay":120,"./transport/ws-transport":128,"./utils/is-function":130,"./utils/sha3":138,"./validate/validate-and-default-block-number":140,"./validate/validate-transaction":144,"./wrappers/bind-dispatch":147,"./wrappers/eth":148,"./wrappers/is-unlocked":149,"./wrappers/miner":151,"./wrappers/net":152,"./wrappers/personal":153,"./wrappers/publish":154,"./wrappers/raw":155,"./wrappers/resend-raw-transaction":156,"./wrappers/resend-transaction":157,"./wrappers/shh":160,"./wrappers/web3":161,redux:230,"redux-thunk-subscribe":224}],62:[function(require,module,exports){"use strict";module.exports=function(debugOptions){return function(dispatch){dispatch({type:"SET_DEBUG_OPTIONS",options:debugOptions})}}},{}],63:[function(require,module,exports){"use strict";var isObject=require("../utils/is-object");var RPCError=require("../errors/rpc-error");function parseEthereumResponse(response,callback){if(!isObject(response))return callback(new Error(JSON.stringify(response)));if(response.error!=null)return callback(new RPCError(response.error));callback(null,response.result)}module.exports=parseEthereumResponse},{"../errors/rpc-error":69,"../utils/is-object":134}],64:[function(require,module,exports){"use strict";var isFunction=require("../utils/is-function");var encodePrimitive=function(primitive){if(typeof primitive==="undefined")return primitive;if(primitive===null)return primitive;if(typeof primitive==="boolean")return primitive;if(typeof primitive==="string")return primitive;if(typeof primitive==="number")return encodeNumber(primitive);if(primitive instanceof Array)return encodeArray(primitive);if(typeof primitive==="object")return encodeObject(primitive);if(isFunction(primitive))throw new Error("Cannot encode a function to be sent to Ethereum.");throw new Error("Attempted to encode an unsupported type: "+typeof primitive)};var encodeNumber=function(number){if(typeof number!=="number")throw new Error("number must be a number.");return"0x"+number.toString(16)};var encodeArray=function(array){var i;if(!(array instanceof Array))throw new Error("array must be an array.");for(i=0;i-1)return null;if(rawTransactionResponse.message.indexOf("replacement transaction underpriced")>-1)return null;return new RPCError(rawTransactionResponse)}module.exports=handleRawTransactionError},{"../errors/rpc-error":69}],76:[function(require,module,exports){"use strict";var immutableDelete=require("immutable-delete");var packageRawTransaction=require("./package-raw-transaction");var setRawTransactionNonce=require("./set-raw-transaction-nonce");var setRawTransactionGasPrice=require("./set-raw-transaction-gas-price");var signRawTransaction=require("./sign-raw-transaction");var isObject=require("../utils/is-object");var RPCError=require("../errors/rpc-error");function packageAndSignRawTransaction(payload,address,privateKeyOrSigner,accountType,callback){return function(dispatch,getState){var state=getState();if(!isObject(payload))return callback(new RPCError("TRANSACTION_PAYLOAD_INVALID",{payload:payload}));if(address==null||privateKeyOrSigner==null)return callback(new RPCError("NOT_LOGGED_IN"));var packaged=packageRawTransaction(payload,address,state.networkID,state.currentBlock);if(state.debug.broadcast)console.log("[ethrpc] packaged:",JSON.stringify(packaged,null,2));dispatch(setRawTransactionGasPrice(packaged,function(err,packaged){if(err)return callback(err);dispatch(setRawTransactionNonce(packaged,address,function(err,packaged){if(err)return callback(err);signRawTransaction(immutableDelete(packaged,"returns"),privateKeyOrSigner,accountType,callback)}))}))}}module.exports=packageAndSignRawTransaction},{"../errors/rpc-error":69,"../utils/is-object":134,"./package-raw-transaction":78,"./set-raw-transaction-gas-price":79,"./set-raw-transaction-nonce":80,"./sign-raw-transaction":82,"immutable-delete":178}],77:[function(require,module,exports){"use strict";var speedomatic=require("speedomatic");var eth_sendRawTransaction=require("../wrappers/eth").sendRawTransaction;var packageAndSignRawTransaction=require("./package-and-sign-raw-transaction");var handleRawTransactionError=require("./handle-raw-transaction-error");var sha3=require("../utils/sha3");var RPCError=require("../errors/rpc-error");var ACCOUNT_TYPES=require("../constants").ACCOUNT_TYPES;function packageAndSubmitRawTransaction(payload,address,privateKeyOrSigner,accountType,callback){return function(dispatch,getState){dispatch(packageAndSignRawTransaction(payload,address,privateKeyOrSigner,accountType,function(err,signedRawTransaction){if(err)return callback(err);function handleRawTransactionResponse(err,rawTransactionResponse){if(getState().debug.broadcast)console.log("[ethrpc] sendRawTransaction response:",rawTransactionResponse);if(err){var handledError=handleRawTransactionError(err);if(handledError!=null)return callback(handledError);dispatch(packageAndSubmitRawTransaction(payload,address,privateKeyOrSigner,accountType,callback))}else if(rawTransactionResponse==null){callback(new RPCError("RAW_TRANSACTION_ERROR"))}else{callback(null,rawTransactionResponse)}}if(accountType===ACCOUNT_TYPES.U_PORT){dispatch({type:"ADD_TRANSACTION",transaction:{hash:speedomatic.formatInt256(signedRawTransaction),payload:payload,meta:{signer:privateKeyOrSigner,accountType:accountType},count:0,status:"sending"}});handleRawTransactionResponse(null,signedRawTransaction)}else{dispatch({type:"ADD_TRANSACTION",transaction:{hash:speedomatic.formatInt256(sha3(signedRawTransaction,"hex")),payload:payload,meta:{signer:privateKeyOrSigner,accountType:accountType},count:0,status:"sending"}});dispatch(eth_sendRawTransaction(signedRawTransaction,handleRawTransactionResponse))}}))}}module.exports=packageAndSubmitRawTransaction},{"../constants":60,"../errors/rpc-error":69,"../utils/sha3":138,"../wrappers/eth":148,"./handle-raw-transaction-error":75,"./package-and-sign-raw-transaction":76,speedomatic:271}],78:[function(require,module,exports){"use strict";var speedomatic=require("speedomatic");var packageRequest=require("../encode-request/package-request");var constants=require("../constants");function packageRawTransaction(payload,address,networkID,currentBlock){var packaged=packageRequest(payload);packaged.from=address;packaged.nonce=payload.nonce||0;packaged.value=payload.value||"0x0";if(payload.gasLimit){packaged.gasLimit=speedomatic.hex(payload.gasLimit)}else if(currentBlock&¤tBlock.gasLimit){packaged.gasLimit=speedomatic.hex(currentBlock.gasLimit)}else{packaged.gasLimit=constants.DEFAULT_GAS}if(networkID&&speedomatic.encodeNumberAsJSNumber(networkID)>0&&speedomatic.encodeNumberAsJSNumber(networkID)<109){packaged.chainId=speedomatic.encodeNumberAsJSNumber(networkID)}if(payload.gasPrice&&speedomatic.encodeNumberAsJSNumber(payload.gasPrice)>0){packaged.gasPrice=speedomatic.hex(payload.gasPrice)}return packaged}module.exports=packageRawTransaction},{"../constants":60,"../encode-request/package-request":66,speedomatic:271}],79:[function(require,module,exports){"use strict";var assign=require("lodash.assign");var eth_gasPrice=require("../wrappers/eth").gasPrice;var setRawTransactionGasPrice=function(packaged,callback){return function(dispatch){if(packaged.gasPrice!=null)return callback(null,packaged);dispatch(eth_gasPrice(null,function(err,gasPrice){if(err)return callback(err);callback(null,assign({},packaged,{gasPrice:gasPrice}))}))}};module.exports=setRawTransactionGasPrice},{"../wrappers/eth":148,"lodash.assign":192}],80:[function(require,module,exports){"use strict";var assign=require("lodash.assign");var eth_getTransactionCount=require("../wrappers/eth").getTransactionCount;var verifyRawTransactionNonce=require("./verify-raw-transaction-nonce");var RPCError=require("../errors/rpc-error");function setRawTransactionNonce(packaged,address,callback){return function(dispatch,getState){dispatch(eth_getTransactionCount([address,"pending"],function(err,transactionCount){if(getState().debug.tx)console.log("transaction count:",address,transactionCount,parseInt(transactionCount,16));if(err)return callback(err);if(transactionCount==null)return callback(new RPCError("NO_RESPONSE"));callback(null,assign({},packaged,{nonce:dispatch(verifyRawTransactionNonce(parseInt(transactionCount,16)))}))}))}}module.exports=setRawTransactionNonce},{"../errors/rpc-error":69,"../wrappers/eth":148,"./verify-raw-transaction-nonce":83,"lodash.assign":192}],81:[function(require,module,exports){(function(Buffer){"use strict";var speedomatic=require("speedomatic");var Transaction=require("ethereumjs-tx");var sha3=require("../utils/sha3");var RPCError=require("../errors/rpc-error");function signRawTransactionWithKey(packaged,privateKey){var rawTransaction=new Transaction(packaged);if(!Buffer.isBuffer(privateKey)){rawTransaction.sign(Buffer.from(privateKey))}else{rawTransaction.sign(privateKey)}if(!rawTransaction.validate())throw new RPCError("TRANSACTION_INVALID",{hash:sha3(rawTransaction.serialize())});return speedomatic.prefixHex(rawTransaction.serialize().toString("hex"))}module.exports=signRawTransactionWithKey}).call(this,require("buffer").Buffer)},{"../errors/rpc-error":69,"../utils/sha3":138,buffer:14,"ethereumjs-tx":46,speedomatic:271}],82:[function(require,module,exports){"use strict";var signRawTransactionWithKey=require("./sign-raw-transaction-with-key");var RPCError=require("../errors/rpc-error");var ACCOUNT_TYPES=require("../constants").ACCOUNT_TYPES;function signRawTransaction(packaged,privateKeyOrSigner,accountType,callback){switch(accountType){case ACCOUNT_TYPES.PRIVATE_KEY:try{return callback(null,signRawTransactionWithKey(packaged,privateKeyOrSigner))}catch(err){return callback(err)}case ACCOUNT_TYPES.LEDGER:return privateKeyOrSigner(packaged,callback);case ACCOUNT_TYPES.U_PORT:return privateKeyOrSigner(packaged).then(function(transactionHash){callback(null,transactionHash)}).catch(callback);default:callback(new RPCError("UNKNOWN_ACCOUNT_TYPE"))}}module.exports=signRawTransaction},{"../constants":60,"../errors/rpc-error":69,"./sign-raw-transaction-with-key":81}],83:[function(require,module,exports){"use strict";var speedomatic=require("speedomatic");function verifyRawTransactionNonce(nonce){return function(dispatch,getState){var highestNonce=getState().highestNonce;if(getState().debug.tx)console.log({nonce:nonce,highestNonce:highestNonce});if(nonce<=highestNonce){nonce=highestNonce+1;dispatch({type:"INCREMENT_HIGHEST_NONCE"})}else{dispatch({type:"SET_HIGHEST_NONCE",nonce:nonce})}return speedomatic.hex(nonce)}}module.exports=verifyRawTransactionNonce},{speedomatic:271}],84:[function(require,module,exports){"use strict";var initialState=require("./initial-state").coinbase;module.exports=function(coinbase,action){if(typeof coinbase==="undefined"){return initialState}switch(action.type){case"SET_COINBASE":return action.address;case"CLEAR_COINBASE":return initialState;default:return coinbase}}},{"./initial-state":92}],85:[function(require,module,exports){"use strict";var assign=require("lodash.assign");function composeReducers(customReducer,reducer){return function(state,action){return assign({},customReducer(state,action),{ethrpc:reducer(state.ethrpc,action)})}}module.exports=composeReducers},{"lodash.assign":192}],86:[function(require,module,exports){"use strict";var isFunction=require("../utils/is-function");var initialState=require("./initial-state").configuration;module.exports=function(configuration,action){var updatedConfiguration;if(typeof configuration==="undefined"){return initialState}switch(action.type){case"SET_CONFIGURATION":updatedConfiguration=Object.keys(configuration).reduce(function(p,key){if(action.configuration[key]!=null&&!isFunction(action.configuration[key])){p[key]=action.configuration[key]}else{p[key]=configuration[key]}return p},{});return updatedConfiguration;case"RESET_CONFIGURATION":return initialState;default:return configuration}}},{"../utils/is-function":130,"./initial-state":92}],87:[function(require,module,exports){"use strict";var clone=require("clone");var initialState=require("./initial-state").currentBlock;module.exports=function(currentBlock,action){if(typeof currentBlock==="undefined"){return initialState}switch(action.type){case"SET_CURRENT_BLOCK":return clone(action.data);case"CLEAR_CURRENT_BLOCK":return initialState;default:return currentBlock}}},{"./initial-state":92,clone:16}],88:[function(require,module,exports){"use strict";var assign=require("lodash.assign");var initialState=require("./initial-state").debug;module.exports=function(debug,action){if(typeof debug==="undefined"){return initialState}switch(action.type){case"SET_DEBUG_OPTIONS":return assign({},debug,action.options);case"RESET_DEBUG_OPTIONS":return initialState;default:return debug}}},{"./initial-state":92,"lodash.assign":192}],89:[function(require,module,exports){"use strict";var initialState=require("./initial-state").gasPrice;module.exports=function(gasPrice,action){if(typeof gasPrice==="undefined"){return initialState}switch(action.type){case"SET_GAS_PRICE":return action.gasPrice;case"RESET_GAS_PRICE":return initialState;default:return gasPrice}}},{"./initial-state":92}],90:[function(require,module,exports){"use strict";var initialState=require("./initial-state").highestNonce;module.exports=function(highestNonce,action){if(typeof highestNonce==="undefined"){return initialState}switch(action.type){case"SET_HIGHEST_NONCE":return action.nonce;case"INCREMENT_HIGHEST_NONCE":return highestNonce+1;case"DECREMENT_HIGHEST_NONCE":return highestNonce-1;case"RESET_HIGHEST_NONCE":return initialState;default:return highestNonce}}},{"./initial-state":92}],91:[function(require,module,exports){"use strict";var debugReducer=require("./debug");var configurationReducer=require("./configuration");var currentBlockReducer=require("./current-block");var highestNonceReducer=require("./highest-nonce");var gasPriceReducer=require("./gas-price");var noRelayReducer=require("./no-relay");var networkIDReducer=require("./network-id");var transactionsReducer=require("./transactions");var subscriptionsReducer=require("./subscriptions");var coinbaseReducer=require("./coinbase");function reducer(state,action){return{debug:debugReducer(state.debug,action),configuration:configurationReducer(state.configuration,action),currentBlock:currentBlockReducer(state.currentBlock,action),highestNonce:highestNonceReducer(state.highestNonce,action),gasPrice:gasPriceReducer(state.gasPrice,action),noRelay:noRelayReducer(state.noRelay,action),networkID:networkIDReducer(state.networkID,action),transactions:transactionsReducer(state.transactions,action),subscriptions:subscriptionsReducer(state.subscriptions,action),coinbase:coinbaseReducer(state.coinbase,action)}}module.exports=function(state,action){if(action.type==="RESET_STATE"){return reducer({},action)}return reducer(state||{},action)}},{"./coinbase":84,"./configuration":86,"./current-block":87,"./debug":88,"./gas-price":89,"./highest-nonce":90,"./network-id":93,"./no-relay":94,"./subscriptions":95,"./transactions":96}],92:[function(require,module,exports){"use strict";module.exports.debug={connect:false,tx:false,broadcast:false};module.exports.configuration={httpAddresses:[],wsAddresses:[],ipcAddresses:[],networkID:null,connectionTimeout:1e4,pollingIntervalMilliseconds:3e4,blockRetention:100,startBlockStreamOnConnect:true};module.exports.currentBlock=null;module.exports.highestNonce=-1;module.exports.gasPrice=2e10;module.exports.noRelay={};module.exports.networkID=null;module.exports.transactions={};module.exports.subscriptions={};module.exports.coinbase=null},{}],93:[function(require,module,exports){"use strict";var initialState=require("./initial-state").networkID;module.exports=function(networkID,action){if(typeof networkID==="undefined"){return initialState}switch(action.type){case"SET_NETWORK_ID":return action.networkID;case"CLEAR_NETWORK_ID":return initialState;default:return networkID}}},{"./initial-state":92}],94:[function(require,module,exports){"use strict";var assign=require("lodash.assign");var initialState=require("./initial-state").noRelay;module.exports=function(noRelay,action){var newNoRelay;if(typeof noRelay==="undefined"){return initialState}switch(action.type){case"EXCLUDE_METHOD_FROM_TRANSACTION_RELAY":newNoRelay={};newNoRelay[action.method]=true;return assign({},noRelay,newNoRelay);case"INCLUDE_METHOD_IN_TRANSACTION_RELAY":newNoRelay={};newNoRelay[action.method]=false;return assign({},noRelay,newNoRelay);case"CLEAR_NO_RELAY":return initialState;default:return noRelay}}},{"./initial-state":92,"lodash.assign":192}],95:[function(require,module,exports){"use strict";var assign=require("lodash.assign");var immutableDelete=require("immutable-delete");var initialState=require("./initial-state").subscriptions;module.exports=function(subscriptions,action){var newSubscription;if(typeof subscriptions==="undefined"){return initialState}switch(action.type){case"ADD_SUBSCRIPTION":newSubscription={};newSubscription[action.id]={reaction:action.reaction,unsubscribeToken:action.unsubscribeToken};return assign({},subscriptions,newSubscription);case"REMOVE_SUBSCRIPTION":return immutableDelete(subscriptions,action.id);case"REMOVE_ALL_SUBSCRIPTIONS":return initialState;default:return subscriptions}}},{"./initial-state":92,"immutable-delete":178,"lodash.assign":192}],96:[function(require,module,exports){"use strict";var assign=require("lodash.assign");var immutableDelete=require("immutable-delete");var isObject=require("../utils/is-object");var initialState=require("./initial-state").transactions;module.exports=function(transactions,action){if(typeof transactions==="undefined"){return initialState}var newTransaction;switch(action.type){case"ADD_TRANSACTION":newTransaction={};newTransaction[action.transaction.hash]=action.transaction;return assign({},transactions,newTransaction);case"UPDATE_TRANSACTION":if(transactions[action.hash]==null)return transactions;newTransaction={};newTransaction[action.hash]=assign({},transactions[action.hash],Object.keys(action.data).reduce(function(p,key){if(isObject(action.data[key])){p[key]=assign({},transactions[action.hash][key]||{},action.data[key])}else{p[key]=action.data[key]}return p},{}));return assign({},transactions,newTransaction);case"UPDATE_ON_CHAIN_TRANSACTION":if(transactions[action.hash]==null)return transactions;newTransaction={};newTransaction[action.hash]=assign({},transactions[action.hash],{tx:assign({},transactions[action.hash].tx||{},action.data||{})});return assign({},transactions,newTransaction);case"SET_TRANSACTION_CONFIRMATIONS":if(transactions[action.hash]==null)return transactions;if(transactions[action.hash].tx.blockNumber==null)return transactions;newTransaction={};newTransaction[action.hash]=assign({},transactions[action.hash],{confirmations:action.currentBlockNumber-transactions[action.hash].tx.blockNumber});return assign({},transactions,newTransaction);case"TRANSACTION_PENDING":if(transactions[action.hash]==null)return transactions;newTransaction={};newTransaction[action.hash]=assign({},transactions[action.hash],{status:"pending",confirmations:0});return assign({},transactions,newTransaction);case"TRANSACTION_FAILED":if(transactions[action.hash]==null)return transactions;newTransaction={};newTransaction[action.hash]=assign({},transactions[action.hash],{status:"failed"});return assign({},transactions,newTransaction);case"TRANSACTION_SEALED":if(transactions[action.hash]==null)return transactions;newTransaction={};newTransaction[action.hash]=assign({},transactions[action.hash],{status:"sealed"});return assign({},transactions,newTransaction);case"TRANSACTION_RESUBMITTED":if(transactions[action.hash]==null)return transactions;newTransaction={};newTransaction[action.hash]=assign({},transactions[action.hash],{status:"resubmitted"});return assign({},transactions,newTransaction);case"TRANSACTION_CONFIRMED":if(transactions[action.hash]==null)return transactions;newTransaction={};newTransaction[action.hash]=assign({},transactions[action.hash],{status:"confirmed"});return assign({},transactions,newTransaction);case"LOCK_TRANSACTION":if(transactions[action.hash]==null)return transactions;newTransaction={};newTransaction[action.hash]=assign({},transactions[action.hash],{isLocked:true});return assign({},transactions,newTransaction);case"UNLOCK_TRANSACTION":if(transactions[action.hash]==null)return transactions;newTransaction={};newTransaction[action.hash]=assign({},transactions[action.hash],{isLocked:false});return assign({},transactions,newTransaction);case"INCREMENT_TRANSACTION_COUNT":if(transactions[action.hash]==null)return transactions;newTransaction={};newTransaction[action.hash]=assign({},transactions[action.hash],{count:transactions[action.hash].count?transactions[action.hash].count+1:1});return assign({},transactions,newTransaction);case"INCREMENT_TRANSACTION_PAYLOAD_TRIES":if(transactions[action.hash]==null)return transactions;var payload=transactions[action.hash].payload||{};newTransaction={};newTransaction[action.hash]=assign({},transactions[action.hash],{payload:assign({},payload,{tries:payload.tries?payload.tries+1:1})});return assign({},transactions,newTransaction);case"REMOVE_TRANSACTION":return immutableDelete(transactions,action.hash);case"REMOVE_ALL_TRANSACTIONS":return initialState;default:return transactions}}},{"../utils/is-object":134,"./initial-state":92,"immutable-delete":178,"lodash.assign":192}],97:[function(require,module,exports){"use strict";var blockchainMessageHandler=require("./rpc/blockchain-message-handler");var removeAllStoreListeners=require("./subscriptions/store-observer").removeAllStoreListeners;var clearTransactions=require("./clear-transactions");var isObject=require("./utils/is-object");var internalState=require("./internal-state");function resetState(){return function(dispatch,getState){var messageHandlerObject,blockNotifier,notifications,debug=getState().debug;dispatch(clearTransactions());clearInterval(internalState.get("newBlockIntervalTimeoutId"));blockNotifier=internalState.get("blockNotifier");if(blockNotifier&&blockNotifier.destroy)blockNotifier.destroy();notifications=internalState.get("notifications");if(isObject(notifications)){Object.keys(notifications).map(function(hash){if(notifications[hash])clearTimeout(notifications[hash])})}removeAllStoreListeners();internalState.set("shimMessageHandlerObject.realMessageHandler",function(){return dispatch({type:"DEV_NULL"})});messageHandlerObject={realMessageHandler:blockchainMessageHandler};internalState.setState({transporter:null,blockNotifier:null,blockAndLogStreamer:null,outstandingRequests:{},subscriptions:{},newBlockIntervalTimeoutId:null,outOfBandErrorHandler:null,shimMessageHandlerObject:messageHandlerObject,shimMessageHandler:function(error,jso){dispatch(this.realMessageHandler(error,jso))}.bind(messageHandlerObject)});dispatch({type:"RESET_STATE"});dispatch({type:"SET_DEBUG_OPTIONS",options:debug})}}module.exports=resetState},{"./clear-transactions":58,"./internal-state":71,"./rpc/blockchain-message-handler":98,"./subscriptions/store-observer":105,"./utils/is-object":134}],98:[function(require,module,exports){"use strict";var parseEthereumResponse=require("../decode-response/parse-ethereum-response");var isObject=require("../utils/is-object");var RPCError=require("../errors/rpc-error");var internalState=require("../internal-state");function blockchainMessageHandler(error,jso){return function(dispatch,getState){var state=getState();var subscriptions=state.subscriptions;var outOfBandErrorHandler=internalState.get("outOfBandErrorHandler");if(state.debug.broadcast)console.log("[ethrpc] RPC response:",JSON.stringify(jso));if(error!==null){return outOfBandErrorHandler(error)}if(!isObject(jso)){return outOfBandErrorHandler(new RPCError("INVALID_TRANSPORT_MESSAGE",jso))}var subscriptionHandler=function(){if(jso.method!=="eth_subscription"){return outOfBandErrorHandler(new RPCError("UNSUPPORTED_RPC_REQUEST",jso))}if(typeof jso.params.subscription!=="string"){return outOfBandErrorHandler(new RPCError("NO_SUBSCRIPTION_ID",jso))}if(jso.params.result===null||jso.params.result===undefined){return outOfBandErrorHandler(new RPCError("NO_SUBSCRIPTION_RESULT",jso))}var subscription=subscriptions[jso.params.subscription];if(subscription!=null){dispatch({type:subscription.reaction,data:jso})}};var responseHandler=function(){if(typeof jso.id!=="number"){return errorHandler(new RPCError("INVALID_MESSAGE_ID",jso))}var outstandingRequest=internalState.get("outstandingRequests."+jso.id);internalState.unset("outstandingRequests."+jso.id);if(!isObject(outstandingRequest)){return outOfBandErrorHandler(new RPCError("JSON_RPC_REQUEST_NOT_FOUND",jso))}parseEthereumResponse(jso,outstandingRequest.callback)};var errorHandler=function(){if(jso.id!==null&&jso.id!==undefined){if(state.debug.broadcast)console.log("outstanding request:",internalState.get("outstandingRequests."+jso.id));return responseHandler(jso)}outOfBandErrorHandler(new RPCError(jso.error))};if(jso.method!==undefined){subscriptionHandler()}else if(jso.result!==undefined){responseHandler()}else if(jso.error!==undefined){errorHandler()}else{outOfBandErrorHandler(new RPCError("INVALID_JSON_RPC_MESSAGE",jso))}}}module.exports=blockchainMessageHandler},{"../decode-response/parse-ethereum-response":63,"../errors/rpc-error":69,"../internal-state":71,"../utils/is-object":134}],99:[function(require,module,exports){"use strict";var stripReturnsTypeAndInvocation=require("../encode-request/strip-returns-type-and-invocation");var isFunction=require("../utils/is-function");var internalState=require("../internal-state");function submitRequestToBlockchain(jso,callback){return function(dispatch,getState){var debug=getState().debug;if(!isFunction(callback)){if(debug.broadcast)console.log("callback not found for request",jso);throw new Error("callback must be a function")}if(typeof jso!=="object")return callback(new Error("jso must be an object"));if(typeof jso.id!=="number")return callback(new Error("jso.id must be a number"));var expectedReturnTypes=stripReturnsTypeAndInvocation(jso);internalState.set("outstandingRequests."+jso.id,{jso:jso,expectedReturnTypes:expectedReturnTypes,callback:callback});internalState.get("transporter").blockchainRpc(jso,debug.broadcast)}}module.exports=submitRequestToBlockchain},{"../encode-request/strip-returns-type-and-invocation":67,"../internal-state":71,"../utils/is-function":130}],100:[function(require,module,exports){"use strict";var createBlockAndLogStreamer=require("./block-management/create-block-and-log-streamer");var createTransportAdapter=require("./block-management/ethrpc-transport-adapter");var onNewBlock=require("./block-management/on-new-block");var internalState=require("./internal-state");module.exports=function(startingBlockNumber,callback){return function(dispatch,getState){var storedConfiguration=getState().configuration;createBlockAndLogStreamer({pollingIntervalMilliseconds:storedConfiguration.pollingIntervalMilliseconds,blockRetention:storedConfiguration.blockRetention,startingBlockNumber:startingBlockNumber},dispatch(createTransportAdapter(internalState.get("transporter"))),callback);internalState.get("blockAndLogStreamer").subscribeToOnBlockAdded(function(block){dispatch(onNewBlock(block))})}}},{"./block-management/create-block-and-log-streamer":50,"./block-management/ethrpc-transport-adapter":52,"./block-management/on-new-block":54,"./internal-state":71}],101:[function(require,module,exports){"use strict";var addSubscription=require("./add-subscription");function selectCurrentBlock(state){return state.currentBlock}function addNewHeadsSubscription(id,onStateChange){return function(dispatch){dispatch(addSubscription(id,"SET_CURRENT_BLOCK",selectCurrentBlock,onStateChange))}}module.exports=addNewHeadsSubscription},{"./add-subscription":102}],102:[function(require,module,exports){"use strict";var addStoreListener=require("./store-observer").addStoreListener;function addSubscription(id,reaction,select,onStateChange){return function(dispatch){dispatch({type:"ADD_SUBSCRIPTION",id:id,reaction:reaction,unsubscribeToken:dispatch(addStoreListener(select,onStateChange))})}}module.exports=addSubscription},{"./store-observer":105}],103:[function(require,module,exports){"use strict";var addSubscription=require("./add-subscription");function selectTransactions(state){return state.transactions}function addTransactionsSubscription(onStateChange){return function(dispatch){dispatch(addSubscription("transactions","transactions",selectTransactions,onStateChange))}}module.exports=addTransactionsSubscription},{"./add-subscription":102}],104:[function(require,module,exports){"use strict";var removeStoreListener=require("./store-observer").removeStoreListener;function removeSubscription(id){return function(dispatch,getState){var subscription=getState().subscriptions[id];if(subscription&&subscription.unsubscribeToken!=null){removeStoreListener(subscription.unsubscribeToken)}dispatch({type:"REMOVE_SUBSCRIPTION",id:id})}}module.exports=removeSubscription},{"./store-observer":105}],105:[function(require,module,exports){"use strict";var assign=require("lodash.assign");var immutableDelete=require("immutable-delete");var isFunction=require("../utils/is-function");var initialCount=1;var count=initialCount;var unsubscribeFunctions={};function addStoreListener(select,onStateChange){return function(dispatch,getState,subscribe){var prevState,currentState=select(getState());function handleStateChange(){var nextState=select(getState());if(nextState!==currentState){prevState=assign({},currentState);currentState=nextState;onStateChange(currentState,prevState)}}if(isFunction(subscribe)){unsubscribeFunctions[count]=subscribe(handleStateChange)}handleStateChange();return count++}}function removeStoreListener(id){if(isFunction(unsubscribeFunctions[id]))unsubscribeFunctions[id]();unsubscribeFunctions=immutableDelete(unsubscribeFunctions,id)}function removeAllStoreListeners(){Object.keys(unsubscribeFunctions).map(removeStoreListener);count=initialCount}module.exports.addStoreListener=addStoreListener;module.exports.removeStoreListener=removeStoreListener;module.exports.removeAllStoreListeners=removeAllStoreListeners},{"../utils/is-function":130,"immutable-delete":178,"lodash.assign":192}],106:[function(require,module,exports){"use strict";var assign=require("lodash.assign");var speedomatic=require("speedomatic");var callOrSendTransaction=require("../transact/call-or-send-transaction");function callContractFunction(payload,callback){return function(dispatch){dispatch(callOrSendTransaction(assign({},payload),function(err,result){if(err)return callback(err);callback(null,speedomatic.abiDecodeRpcResponse(payload.returns,result))}))}}module.exports=callContractFunction},{"../transact/call-or-send-transaction":107,"lodash.assign":192,speedomatic:271}],107:[function(require,module,exports){"use strict";var eth=require("../wrappers/eth");var packageRequest=require("../encode-request/package-request");var isObject=require("../utils/is-object");var RPCError=require("../errors/rpc-error");function callOrSendTransaction(payload,callback){return function(dispatch,getState){if(!isObject(payload))return callback(new RPCError("TRANSACTION_FAILED"));try{var packaged=packageRequest(payload)}catch(err){return callback(err)}if(getState().debug.broadcast)console.log("packaged:",packaged);if(payload.estimateGas){dispatch(eth.estimateGas(packaged,callback))}else if(payload.send){dispatch(eth.sendTransaction(packaged,callback))}else{dispatch(eth.call([packaged,"latest"],callback))}}}module.exports=callOrSendTransaction},{"../encode-request/package-request":66,"../errors/rpc-error":69,"../utils/is-object":134,"../wrappers/eth":148}],108:[function(require,module,exports){"use strict";var speedomatic=require("speedomatic");var BigNumber=require("bignumber.js");var eth=require("../wrappers/eth");var RPCError=require("../errors/rpc-error");var constants=require("../constants");function recheckSealedBlock(onChainTransaction,callback){return function(dispatch){dispatch(eth.getBlockByHash([onChainTransaction.blockHash,false],function(err,block){if(err)return callback(err);if(block==null){console.warn("No block found for block hash",onChainTransaction.blockHash);dispatch({type:"TRANSACTION_PENDING",hash:onChainTransaction.hash});return callback(null)}var updatedOnChainTransactionData={timestamp:parseInt(block.timestamp,16),callReturn:onChainTransaction.callReturn};dispatch({type:"UPDATE_ON_CHAIN_TRANSACTION",hash:onChainTransaction.hash,data:updatedOnChainTransactionData });callback(null,true)}))}}module.exports=recheckSealedBlock},{"../constants":60,"../errors/rpc-error":69,"../wrappers/eth":148,"bignumber.js":5,speedomatic:271}],109:[function(require,module,exports){"use strict";var updateTransaction=require("./update-transaction");function reprocessTransactions(){return function(dispatch,getState){var transactions=getState().transactions;Object.keys(transactions).forEach(function(transactionHash){dispatch(updateTransaction.default(transactionHash))})}}module.exports=reprocessTransactions},{"./update-transaction":114}],110:[function(require,module,exports){"use strict";var speedomatic=require("speedomatic");var immutableDelete=require("immutable-delete");var packageAndSubmitRawTransaction=require("../raw-transactions/package-and-submit-raw-transaction");var callOrSendTransaction=require("../transact/call-or-send-transaction");var verifyTxSubmitted=require("../transact/verify-tx-submitted");var RPCError=require("../errors/rpc-error");function transactAsync(payload,callReturn,privateKeyOrSigner,accountType,onSent,onSuccess,onFailed){return function(dispatch,getState){var sendTransactionOrRawTransaction;if(privateKeyOrSigner==null){sendTransactionOrRawTransaction=callOrSendTransaction}else{sendTransactionOrRawTransaction=function(payload,callback){return packageAndSubmitRawTransaction(payload,payload.from,privateKeyOrSigner,accountType,callback)}}payload.send=true;dispatch(sendTransactionOrRawTransaction(immutableDelete(payload,"returns"),function(err,transactionHash){if(getState().debug.tx)console.log("transactionHash:",transactionHash);if(err)return onFailed(err);if(transactionHash==null)return onFailed(new RPCError("NULL_TRANSACTION_HASH"));transactionHash=speedomatic.formatInt256(transactionHash);onSent({hash:transactionHash,callReturn:callReturn});dispatch(verifyTxSubmitted(payload,transactionHash,callReturn,privateKeyOrSigner,accountType,onSent,onSuccess,onFailed))}))}}module.exports=transactAsync},{"../errors/rpc-error":69,"../raw-transactions/package-and-submit-raw-transaction":77,"../transact/call-or-send-transaction":107,"../transact/verify-tx-submitted":115,"immutable-delete":178,speedomatic:271}],111:[function(require,module,exports){"use strict";var uuid=require("uuid");var transactAsync=require("./transact-async");var callContractFunction=require("./call-contract-function");var callOrSendTransaction=require("./call-or-send-transaction");var wrapOnFailedCallback=require("./wrap-on-failed-callback");var isFunction=require("../utils/is-function");var isObject=require("../utils/is-object");var RPCError=require("../errors/rpc-error");function transact(payload,privateKeyOrSigner,accountType,onSent,onSuccess,onFailed){return function(dispatch,getState){if(payload.uuid==null)payload.uuid=uuid.v4();var debug=getState().debug;if(debug.tx)console.log("ethrpc.transact payload:",payload);if(!isFunction(onSent)||!isFunction(onSuccess)||!isFunction(onFailed)){return console.error("onSent, onSuccess, and onFailed callbacks not found",payload,privateKeyOrSigner,accountType,onSent,onSuccess,onFailed)}var wrappedOnFailedCallback=wrapOnFailedCallback(payload,onFailed,dispatch);if(!isObject(payload)||payload.to==null){return onFailed(new RPCError("TRANSACTION_PAYLOAD_INVALID",{payload:payload}))}payload.send=false;if(payload.estimateGas){return dispatch(callOrSendTransaction(payload,function(err,result){if(err)return wrappedOnFailedCallback(err);if(result==null)return wrappedOnFailedCallback(new RPCError("NULL_CALL_RETURN"));return onSuccess(result)}))}if(payload.returns==="null"){return dispatch(transactAsync(payload,null,privateKeyOrSigner,accountType,onSent,onSuccess,wrappedOnFailedCallback))}dispatch(callContractFunction(payload,function(err,returnData){if(debug.tx)console.log("returnData:",returnData);if(err)return wrappedOnFailedCallback(err);if(returnData==null)return wrappedOnFailedCallback(new RPCError("NULL_CALL_RETURN"));dispatch(transactAsync(payload,returnData,privateKeyOrSigner,accountType,onSent,onSuccess,wrappedOnFailedCallback))}))}}module.exports=transact},{"../errors/rpc-error":69,"../utils/is-function":130,"../utils/is-object":134,"./call-contract-function":106,"./call-or-send-transaction":107,"./transact-async":110,"./wrap-on-failed-callback":116,uuid:294}],112:[function(require,module,exports){"use strict";var eth=require("../wrappers/eth");var updateSealedTransaction=require("../transact/update-sealed-transaction");var transact=require("../transact/transact");var RPCError=require("../errors/rpc-error");var constants=require("../constants");function updatePendingTransaction(transactionHash,callback){return function(dispatch,getState){dispatch(eth.getTransactionByHash(transactionHash,function(err,onChainTransaction){if(err)return callback(err);dispatch({type:"UPDATE_ON_CHAIN_TRANSACTION",hash:transactionHash,data:onChainTransaction});if(onChainTransaction===null){dispatch({type:"INCREMENT_TRANSACTION_PAYLOAD_TRIES",hash:transactionHash});if(getState().transactions[transactionHash].payload.tries>constants.TX_RETRY_MAX){callback(new RPCError("TRANSACTION_RETRY_MAX_EXCEEDED",{data:getState().transactions[transactionHash]}))}else{dispatch({type:"DECREMENT_HIGHEST_NONCE"});dispatch({type:"TRANSACTION_RESUBMITTED",hash:transactionHash});if(getState().debug.tx)console.log("resubmitting tx:",transactionHash);var transaction=getState().transactions[transactionHash];var meta=transaction.meta||{};dispatch(transact(transaction.payload,meta.signer,meta.accountType,transaction.onSent,transaction.onSuccess,transaction.onFailed))}}else if(parseInt(onChainTransaction.blockHash,16)===0){callback(null)}else{dispatch({type:"UPDATE_ON_CHAIN_TRANSACTION",hash:transactionHash,data:onChainTransaction});dispatch({type:"TRANSACTION_SEALED",hash:transactionHash});dispatch({type:"SET_TRANSACTION_CONFIRMATIONS",hash:transactionHash,currentBlockNumber:parseInt(getState().currentBlock.number,16)});dispatch(updateSealedTransaction(transactionHash,callback))}}))}}module.exports=updatePendingTransaction},{"../constants":60,"../errors/rpc-error":69,"../transact/transact":111,"../transact/update-sealed-transaction":113,"../wrappers/eth":148}],113:[function(require,module,exports){"use strict";var speedomatic=require("speedomatic");var BigNumber=require("bignumber.js");var recheckSealedBlock=require("./recheck-sealed-block");var eth=require("../wrappers/eth");var RPCError=require("../errors/rpc-error");var constants=require("../constants");function updateSealedTransaction(transactionHash,callback){return function(dispatch,getState){dispatch({type:"SET_TRANSACTION_CONFIRMATIONS",hash:transactionHash,currentBlockNumber:parseInt(getState().currentBlock.number,16)});var transaction=getState().transactions[transactionHash];if(transaction.confirmations=8){ret+=address[i].toUpperCase()}else{ret+=address[i]}}return ret}var validateAddress=function(address){if(address===null||address===undefined){throw new Error("address is required")}if(typeof address!=="string"){throw new Error("address must be a string but was "+typeof address)}if(address.slice(0,2)!=="0x"){address="0x"+address}if(address.length!==42){throw new Error("address must be 42 characters, 20 bytes (2 hex encoded code points each) plus the 0x prefix. Length: "+address.length)}if(!/^0x[0-9a-fA-F]{40}$/.test(address)){throw new Error("address can only contain 0-9 and a-F and must start with 0x. Provided: "+address)}if(/[a-f]+/.test(address)&&/[A-F]+/.test(address)&&checksumAddress(address)!==address){throw new Error("address checksum is invalid.")}return address};module.exports=validateAddress},{"../utils/sha3":138}],140:[function(require,module,exports){"use strict";var validateNumber=require("./validate-number");var validateAndDefaultBlockNumber=function(blockNumber){if(blockNumber===undefined)return"latest";if(blockNumber===null)return"latest";if(blockNumber==="latest")return blockNumber;if(blockNumber==="earliest")return blockNumber;if(blockNumber==="pending")return blockNumber;try{return validateNumber(blockNumber,"block")}catch(error){throw new Error("block must be a number, a 0x prefixed hex string, or 'latest' or 'earliest' or 'pending'")}};module.exports=validateAndDefaultBlockNumber},{"./validate-number":143}],141:[function(require,module,exports){"use strict";var RPCError=require("../errors/rpc-error");function validateBlock(block){if(block===null||block===undefined||block instanceof Error||block.error||!block.hash||!block.parentHash||!block.number)throw new RPCError("INVALID_BLOCK",{data:block})}module.exports=validateBlock},{"../errors/rpc-error":69}],142:[function(require,module,exports){"use strict";function validateConfiguration(configuration){if(!Array.isArray(configuration.httpAddresses)){configuration.errorHandler(new Error("configuration.httpAddresses must be an array."))}else if(configuration.httpAddresses.some(function(x){return typeof x!=="string"})){configuration.errorHandler(new Error("configuration.httpAddresses must contain only strings."))}else if(!Array.isArray(configuration.wsAddresses)){configuration.errorHandler(new Error("configuration.wsAddresses must be an array."))}else if(configuration.wsAddresses.some(function(x){return typeof x!=="string"})){configuration.errorHandler(new Error("configuration.wsAddresses must contain only strings."))}else if(!Array.isArray(configuration.ipcAddresses)){configuration.errorHandler(new Error("configuration.ipcAddresses must be an array."))}else if(configuration.ipcAddresses.some(function(x){return typeof x!=="string"})){configuration.errorHandler(new Error("configuration.ipcAddresses must contain only strings."))}return configuration}module.exports=validateConfiguration},{}],143:[function(require,module,exports){"use strict";var validateNumber=function(number,parameterName){if(!parameterName)parameterName="number";if(number===null)return number;if(number===undefined)return number;if(typeof number==="number")return"0x"+number.toString(16);if(typeof number==="string"&&/^0x[0-9a-zA-Z]+$/.test(number))return number;throw new Error(parameterName," must be a number, null, undefined or a 0x prefixed hex encoded string")};module.exports=validateNumber},{}],144:[function(require,module,exports){"use strict";var validateAddress=require("./validate-address");var validateNumber=require("./validate-number");var validateTransaction=function(transaction){if(!transaction)throw new Error("transaction is required");transaction.from=validateAddress(transaction.from);if(transaction.to!==undefined&&transaction.to!==null){transaction.to=validateAddress(transaction.to)}transaction.gas=validateNumber(transaction.gas,"gas");transaction.gasPrice=validateNumber(transaction.gasPrice,"gasPrice");transaction.value=validateNumber(transaction.value,"value");if(transaction.data!==undefined&&transaction.data!==null&&typeof transaction.data!=="string"){throw new Error("data must be a string")}if(!/^0x[0-9a-zA-Z]*$/.test(transaction.data)){throw new Error("data must be a hex encoded string with a leader '0x'")}transaction.nonce=validateNumber(transaction.nonce,"nonce")};module.exports=validateTransaction},{"./validate-address":139,"./validate-number":143}],145:[function(require,module,exports){module.exports="5.1.0"},{}],146:[function(require,module,exports){"use strict";function bindDispatchToMethod(dispatch,method){return function(params,callback){return dispatch(method(params,callback))}}module.exports=bindDispatchToMethod},{}],147:[function(require,module,exports){"use strict";var bindDispatchToMethod=require("./bind-dispatch-to-method");function bindDispatch(dispatch,namespace){return Object.keys(namespace).reduce(function(p,method){p[method]=bindDispatchToMethod(dispatch,namespace[method]);return p},{})}module.exports=bindDispatch},{"./bind-dispatch-to-method":146}],148:[function(require,module,exports){"use strict";var makeWrapper=require("./make-wrapper");module.exports={accounts:makeWrapper("eth_accounts"),blockNumber:makeWrapper("eth_blockNumber"),call:makeWrapper("eth_call"),coinbase:makeWrapper("eth_coinbase"),compileLLL:makeWrapper("eth_compileLLL"),compileSerpent:makeWrapper("eth_compileSerpent"),compileSolidity:makeWrapper("eth_compileSolidity"),estimateGas:makeWrapper("eth_estimateGas"),gasPrice:makeWrapper("eth_gasPrice"),getBalance:makeWrapper("eth_getBalance"),getBlockByHash:makeWrapper("eth_getBlockByHash"),getBlockByNumber:makeWrapper("eth_getBlockByNumber"),getBlockTransactionCountByHash:makeWrapper("eth_getBlockTransactionCountByHash"),getBlockTransactionCountByNumber:makeWrapper("eth_getBlockTransactionCountByNumber"),getCode:makeWrapper("eth_getCode"),getCompilers:makeWrapper("eth_getCompilers"),getFilterChanges:makeWrapper("eth_getFilterChanges"),getFilterLogs:makeWrapper("eth_getFilterLogs"),getLogs:makeWrapper("eth_getLogs"),getStorageAt:makeWrapper("eth_getStorageAt"),getTransactionByBlockHashAndIndex:makeWrapper("eth_getTransactionByBlockHashAndIndex"),getTransactionByBlockNumberAndIndex:makeWrapper("eth_getTransactionByBlockNumberAndIndex"),getTransactionByHash:makeWrapper("eth_getTransactionByHash"),getTransactionCount:makeWrapper("eth_getTransactionCount"),getTransactionReceipt:makeWrapper("eth_getTransactionReceipt"),getUncleByBlockHashAndIndex:makeWrapper("eth_getUncleByBlockHashAndIndex"),getUncleByBlockNumberAndIndex:makeWrapper("eth_getUncleByBlockNumberAndIndex"),getUncleCountByBlockHash:makeWrapper("eth_getUncleCountByBlockHash"),getUncleCountByBlockNumber:makeWrapper("eth_getUncleCountByBlockNumber"),getWork:makeWrapper("eth_getWork"),hashrate:makeWrapper("eth_hashrate"),mining:makeWrapper("eth_mining"),newBlockFilter:makeWrapper("eth_newBlockFilter"),newFilter:makeWrapper("eth_newFilter"),newPendingTransactionFilter:makeWrapper("eth_newPendingTransactionFilter"),protocolVersion:makeWrapper("eth_protocolVersion"),sendRawTransaction:makeWrapper("eth_sendRawTransaction"),sendTransaction:makeWrapper("eth_sendTransaction"),sign:makeWrapper("eth_sign"),signTransaction:makeWrapper("eth_signTransaction"),submitHashrate:makeWrapper("eth_submitHashrate"),submitWork:makeWrapper("eth_submitWork"),subscribe:makeWrapper("eth_subscribe"),syncing:makeWrapper("eth_syncing"),uninstallFilter:makeWrapper("eth_uninstallFilter"),unsubscribe:makeWrapper("eth_unsubscribe")}},{"./make-wrapper":150}],149:[function(require,module,exports){"use strict";var eth_sign=require("../wrappers/eth").sign;function isUnlocked(account,callback){return function(dispatch){dispatch(eth_sign([account,"0x00000000000000000000000000000000000000000000000000000000000f69b5"],function(err){if(err){console.warn("eth_sign failed during ethrpc.isUnlocked:",err);return callback(null,false)}callback(null,true)}))}}module.exports=isUnlocked},{"../wrappers/eth":148}],150:[function(require,module,exports){"use strict";var raw=require("./raw");var isFunction=require("../utils/is-function");function makeWrapper(command){return function(params,callback){return function(dispatch){if(callback===undefined&&isFunction(params)){return dispatch(raw(command,[],params))}return dispatch(raw(command,params,callback))}}}module.exports=makeWrapper},{"../utils/is-function":130,"./raw":155}],151:[function(require,module,exports){"use strict";var makeWrapper=require("./make-wrapper");module.exports={start:makeWrapper("miner_start"),stop:makeWrapper("miner_stop")}},{"./make-wrapper":150}],152:[function(require,module,exports){"use strict";var makeWrapper=require("./make-wrapper");module.exports={listening:makeWrapper("net_listening"),version:makeWrapper("net_version"),peerCount:makeWrapper("net_peerCount")}},{"./make-wrapper":150}],153:[function(require,module,exports){"use strict";var makeWrapper=require("./make-wrapper");module.exports={listAccounts:makeWrapper("personal_listAccounts"),unlockAccount:makeWrapper("personal_unlockAccount"),lockAccount:makeWrapper("personal_lockAccount")}},{"./make-wrapper":150}],154:[function(require,module,exports){"use strict";var eth=require("./eth");var constants=require("../constants");var RPCError=require("../errors/rpc-error");function publish(compiled,callback){return function(dispatch){dispatch(eth.coinbase(function(err,coinbase){if(err)return callback(err);if(coinbase==null)return callback(new RPCError("COINBASE_NOT_SET"));dispatch(eth.sendTransaction({from:coinbase,data:compiled,gas:constants.DEFAULT_GAS},callback))}))}}module.exports=publish},{"../constants":60,"../errors/rpc-error":69,"./eth":148}],155:[function(require,module,exports){"use strict";var submitRequestToBlockchain=require("../rpc/submit-request-to-blockchain");var makeRequestPayload=require("../encode-request/make-request-payload");function raw(command,params,callback){return function(dispatch){dispatch(submitRequestToBlockchain(makeRequestPayload(command,params,null),callback))}}module.exports=raw},{"../encode-request/make-request-payload":65,"../rpc/submit-request-to-blockchain":99}],156:[function(require,module,exports){"use strict";var speedomatic=require("speedomatic");var clone=require("clone");var eth=require("../wrappers/eth");var signRawTransactionWithKey=require("../raw-transactions/sign-raw-transaction-with-key");function resendRawTransaction(transaction,privateKey,gasPrice,gasLimit,callback){return function(dispatch){var newTransaction=clone(transaction);if(gasPrice)newTransaction.gasPrice=speedomatic.hex(gasPrice);if(gasLimit)newTransaction.gasLimit=speedomatic.hex(gasLimit);var signedTransaction=signRawTransactionWithKey(newTransaction,privateKey);return dispatch(eth.sendRawTransaction(signedTransaction,callback))}}module.exports=resendRawTransaction},{"../raw-transactions/sign-raw-transaction-with-key":81,"../wrappers/eth":148,clone:16,speedomatic:271}],157:[function(require,module,exports){"use strict";var speedomatic=require("speedomatic");var clone=require("clone");var eth=require("../wrappers/eth");function resendTransaction(transaction,gasPrice,gasLimit,callback){return function(dispatch){var newTransaction=clone(transaction);if(gasPrice)newTransaction.gasPrice=speedomatic.hex(gasPrice);if(gasLimit)newTransaction.gasLimit=speedomatic.hex(gasLimit);return dispatch(eth.sendTransaction(newTransaction,callback))}}module.exports=resendTransaction},{"../wrappers/eth":148,clone:16,speedomatic:271}],158:[function(require,module,exports){"use strict";var speedomatic=require("speedomatic");var eth_coinbase=require("./eth").coinbase;function setCoinbase(callback){return function(dispatch){dispatch(eth_coinbase(null,function(err,coinbase){if(err)return callback(err);if(coinbase!=null){dispatch({type:"SET_COINBASE",address:speedomatic.formatEthereumAddress(coinbase)})}callback(null)}))}}module.exports=setCoinbase},{"./eth":148,speedomatic:271}],159:[function(require,module,exports){"use strict";var eth_gasPrice=require("./eth").gasPrice;var isHex=require("../utils/is-hex");function setGasPrice(callback){return function(dispatch){dispatch(eth_gasPrice(null,function(err,gasPrice){if(err)return callback(err);if(gasPrice!=null&&isHex(gasPrice)){dispatch({type:"SET_GAS_PRICE",gasPrice:parseInt(gasPrice,16)})}callback(null)}))}}module.exports=setGasPrice},{"../utils/is-hex":131,"./eth":148}],160:[function(require,module,exports){"use strict";var makeWrapper=require("./make-wrapper");module.exports={post:makeWrapper("shh_post"),version:makeWrapper("shh_version"),newIdentity:makeWrapper("shh_newIdentity"),hasIdentity:makeWrapper("shh_hasIdentity"),newGroup:makeWrapper("shh_newGroup"),addToGroup:makeWrapper("shh_addToGroup"),newFilter:makeWrapper("shh_newFilter"),uninstallFilter:makeWrapper("shh_uninstallFilter"),getFilterChanges:makeWrapper("shh_getFilterChanges"),getMessages:makeWrapper("shh_getMessages")}},{"./make-wrapper":150}],161:[function(require,module,exports){"use strict";var makeWrapper=require("./make-wrapper");var sha3=require("../utils/sha3");module.exports={sha3:function(data,encoding,callback){return function(){return sha3(data,encoding,callback)}},clientVersion:makeWrapper("web3_clientVersion")}},{"../utils/sha3":138,"./make-wrapper":150}],162:[function(require,module,exports){function EventEmitter(){this._events=this._events||{};this._maxListeners=this._maxListeners||undefined}module.exports=EventEmitter;EventEmitter.EventEmitter=EventEmitter;EventEmitter.prototype._events=undefined;EventEmitter.prototype._maxListeners=undefined;EventEmitter.defaultMaxListeners=10;EventEmitter.prototype.setMaxListeners=function(n){if(!isNumber(n)||n<0||isNaN(n))throw TypeError("n must be a positive number");this._maxListeners=n;return this};EventEmitter.prototype.emit=function(type){var er,handler,len,args,i,listeners;if(!this._events)this._events={};if(type==="error"){if(!this._events.error||isObject(this._events.error)&&!this._events.error.length){er=arguments[1];if(er instanceof Error){throw er}else{var err=new Error('Uncaught, unspecified "error" event. ('+er+")");err.context=er;throw err}}}handler=this._events[type];if(isUndefined(handler))return false;if(isFunction(handler)){switch(arguments.length){case 1:handler.call(this);break;case 2:handler.call(this,arguments[1]);break;case 3:handler.call(this,arguments[1],arguments[2]);break;default:args=Array.prototype.slice.call(arguments,1);handler.apply(this,args)}}else if(isObject(handler)){args=Array.prototype.slice.call(arguments,1);listeners=handler.slice();len=listeners.length;for(i=0;i0&&this._events[type].length>m){this._events[type].warned=true;console.error("(node) warning: possible EventEmitter memory "+"leak detected. %d listeners added. "+"Use emitter.setMaxListeners() to increase limit.",this._events[type].length);if(typeof console.trace==="function"){console.trace()}}}return this};EventEmitter.prototype.on=EventEmitter.prototype.addListener;EventEmitter.prototype.once=function(type,listener){if(!isFunction(listener))throw TypeError("listener must be a function");var fired=false;function g(){this.removeListener(type,g);if(!fired){fired=true;listener.apply(this,arguments)}}g.listener=listener;this.on(type,g);return this};EventEmitter.prototype.removeListener=function(type,listener){var list,position,length,i;if(!isFunction(listener))throw TypeError("listener must be a function");if(!this._events||!this._events[type])return this;list=this._events[type];length=list.length;position=-1;if(list===listener||isFunction(list.listener)&&list.listener===listener){delete this._events[type];if(this._events.removeListener)this.emit("removeListener",type,listener)}else if(isObject(list)){for(i=length;i-- >0;){if(list[i]===listener||list[i].listener&&list[i].listener===listener){position=i;break}}if(position<0)return this;if(list.length===1){list.length=0;delete this._events[type]}else{list.splice(position,1)}if(this._events.removeListener)this.emit("removeListener",type,listener)}return this};EventEmitter.prototype.removeAllListeners=function(type){var key,listeners;if(!this._events)return this;if(!this._events.removeListener){if(arguments.length===0)this._events={};else if(this._events[type])delete this._events[type];return this}if(arguments.length===0){for(key in this._events){if(key==="removeListener")continue;this.removeAllListeners(key)}this.removeAllListeners("removeListener");this._events={};return this}listeners=this._events[type];if(isFunction(listeners)){this.removeListener(type,listeners)}else if(listeners){while(listeners.length)this.removeListener(type,listeners[listeners.length-1])}delete this._events[type];return this};EventEmitter.prototype.listeners=function(type){var ret;if(!this._events||!this._events[type])ret=[];else if(isFunction(this._events[type]))ret=[this._events[type]];else ret=this._events[type].slice();return ret};EventEmitter.prototype.listenerCount=function(type){if(this._events){var evlistener=this._events[type];if(isFunction(evlistener))return 1;else if(evlistener)return evlistener.length}return 0};EventEmitter.listenerCount=function(emitter,type){return emitter.listenerCount(type)};function isFunction(arg){return typeof arg==="function"}function isNumber(arg){return typeof arg==="number"}function isObject(arg){return typeof arg==="object"&&arg!==null}function isUndefined(arg){return arg===void 0}},{}],163:[function(require,module,exports){(function(Buffer){"use strict";var Transform=require("stream").Transform;var inherits=require("inherits");function HashBase(blockSize){Transform.call(this);this._block=new Buffer(blockSize);this._blockSize=blockSize;this._blockOffset=0;this._length=[0,0,0,0];this._finalized=false}inherits(HashBase,Transform);HashBase.prototype._transform=function(chunk,encoding,callback){var error=null;try{if(encoding!=="buffer")chunk=new Buffer(chunk,encoding);this.update(chunk)}catch(err){error=err}callback(error)};HashBase.prototype._flush=function(callback){var error=null;try{this.push(this._digest())}catch(err){error=err}callback(error)};HashBase.prototype.update=function(data,encoding){if(!Buffer.isBuffer(data)&&typeof data!=="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");if(!Buffer.isBuffer(data))data=new Buffer(data,encoding||"binary");var block=this._block;var offset=0;while(this._blockOffset+data.length-offset>=this._blockSize){for(var i=this._blockOffset;i0;++j){this._length[j]+=carry;carry=this._length[j]/4294967296|0;if(carry>0)this._length[j]-=4294967296*carry}return this};HashBase.prototype._update=function(data){throw new Error("_update is not implemented")};HashBase.prototype.digest=function(encoding){if(this._finalized)throw new Error("Digest already called");this._finalized=true;var digest=this._digest();if(encoding!==undefined)digest=digest.toString(encoding);return digest};HashBase.prototype._digest=function(){throw new Error("_digest is not implemented")};module.exports=HashBase}).call(this,require("buffer").Buffer)},{buffer:14,inherits:180,stream:284}],164:[function(require,module,exports){var hash=exports;hash.utils=require("./hash/utils");hash.common=require("./hash/common");hash.sha=require("./hash/sha");hash.ripemd=require("./hash/ripemd");hash.hmac=require("./hash/hmac");hash.sha1=hash.sha.sha1;hash.sha256=hash.sha.sha256;hash.sha224=hash.sha.sha224;hash.sha384=hash.sha.sha384;hash.sha512=hash.sha.sha512;hash.ripemd160=hash.ripemd.ripemd160},{"./hash/common":165,"./hash/hmac":166,"./hash/ripemd":167,"./hash/sha":168,"./hash/utils":175}],165:[function(require,module,exports){"use strict";var utils=require("./utils");var assert=require("minimalistic-assert");function BlockHash(){this.pending=null;this.pendingTotal=0;this.blockSize=this.constructor.blockSize;this.outSize=this.constructor.outSize;this.hmacStrength=this.constructor.hmacStrength;this.padLength=this.constructor.padLength/8;this.endian="big";this._delta8=this.blockSize/8;this._delta32=this.blockSize/32}exports.BlockHash=BlockHash;BlockHash.prototype.update=function update(msg,enc){msg=utils.toArray(msg,enc);if(!this.pending)this.pending=msg;else this.pending=this.pending.concat(msg);this.pendingTotal+=msg.length;if(this.pending.length>=this._delta8){msg=this.pending;var r=msg.length%this._delta8;this.pending=msg.slice(msg.length-r,msg.length);if(this.pending.length===0)this.pending=null;msg=utils.join32(msg,0,msg.length-r,this.endian);for(var i=0;i>>24&255;res[i++]=len>>>16&255;res[i++]=len>>>8&255;res[i++]=len&255}else{res[i++]=len&255;res[i++]=len>>>8&255;res[i++]=len>>>16&255;res[i++]=len>>>24&255;res[i++]=0;res[i++]=0;res[i++]=0;res[i++]=0;for(t=8;tthis.blockSize)key=(new this.Hash).update(key).digest();assert(key.length<=this.blockSize);for(var i=key.length;i>>3}exports.g0_256=g0_256;function g1_256(x){return rotr32(x,17)^rotr32(x,19)^x>>>10}exports.g1_256=g1_256},{"../utils":175}],175:[function(require,module,exports){"use strict";var assert=require("minimalistic-assert");var inherits=require("inherits");exports.inherits=inherits;function toArray(msg,enc){if(Array.isArray(msg))return msg.slice();if(!msg)return[];var res=[];if(typeof msg==="string"){if(!enc){for(var i=0;i>8;var lo=c&255;if(hi)res.push(hi,lo);else res.push(lo)}}else if(enc==="hex"){msg=msg.replace(/[^a-z0-9]+/gi,"");if(msg.length%2!==0)msg="0"+msg;for(i=0;i>>24|w>>>8&65280|w<<8&16711680|(w&255)<<24;return res>>>0}exports.htonl=htonl;function toHex32(msg,endian){var res="";for(var i=0;i>>0}return res}exports.join32=join32;function split32(msg,endian){var res=new Array(msg.length*4);for(var i=0,k=0;i>>24;res[k+1]=m>>>16&255;res[k+2]=m>>>8&255;res[k+3]=m&255}else{res[k+3]=m>>>24;res[k+2]=m>>>16&255;res[k+1]=m>>>8&255;res[k]=m&255}}return res}exports.split32=split32;function rotr32(w,b){return w>>>b|w<<32-b}exports.rotr32=rotr32;function rotl32(w,b){return w<>>32-b}exports.rotl32=rotl32;function sum32(a,b){return a+b>>>0}exports.sum32=sum32;function sum32_3(a,b,c){return a+b+c>>>0}exports.sum32_3=sum32_3;function sum32_4(a,b,c,d){return a+b+c+d>>>0}exports.sum32_4=sum32_4;function sum32_5(a,b,c,d,e){return a+b+c+d+e>>>0}exports.sum32_5=sum32_5;function sum64(buf,pos,ah,al){var bh=buf[pos];var bl=buf[pos+1];var lo=al+bl>>>0;var hi=(lo>>0;buf[pos+1]=lo}exports.sum64=sum64;function sum64_hi(ah,al,bh,bl){var lo=al+bl>>>0;var hi=(lo>>0}exports.sum64_hi=sum64_hi;function sum64_lo(ah,al,bh,bl){var lo=al+bl;return lo>>>0}exports.sum64_lo=sum64_lo;function sum64_4_hi(ah,al,bh,bl,ch,cl,dh,dl){var carry=0;var lo=al;lo=lo+bl>>>0;carry+=lo>>0;carry+=lo>>0;carry+=lo>>0}exports.sum64_4_hi=sum64_4_hi;function sum64_4_lo(ah,al,bh,bl,ch,cl,dh,dl){var lo=al+bl+cl+dl;return lo>>>0}exports.sum64_4_lo=sum64_4_lo;function sum64_5_hi(ah,al,bh,bl,ch,cl,dh,dl,eh,el){var carry=0;var lo=al;lo=lo+bl>>>0;carry+=lo>>0;carry+=lo>>0;carry+=lo>>0;carry+=lo>>0}exports.sum64_5_hi=sum64_5_hi;function sum64_5_lo(ah,al,bh,bl,ch,cl,dh,dl,eh,el){var lo=al+bl+cl+dl+el;return lo>>>0}exports.sum64_5_lo=sum64_5_lo;function rotr64_hi(ah,al,num){var r=al<<32-num|ah>>>num;return r>>>0}exports.rotr64_hi=rotr64_hi;function rotr64_lo(ah,al,num){var r=ah<<32-num|al>>>num;return r>>>0}exports.rotr64_lo=rotr64_lo;function shr64_hi(ah,al,num){return ah>>>num}exports.shr64_hi=shr64_hi;function shr64_lo(ah,al,num){var r=ah<<32-num|al>>>num;return r>>>0}exports.shr64_lo=shr64_lo},{inherits:180,"minimalistic-assert":206}],176:[function(require,module,exports){"use strict";var hash=require("hash.js");var utils=require("minimalistic-crypto-utils");var assert=require("minimalistic-assert");function HmacDRBG(options){if(!(this instanceof HmacDRBG))return new HmacDRBG(options);this.hash=options.hash;this.predResist=!!options.predResist;this.outLen=this.hash.outSize;this.minEntropy=options.minEntropy||this.hash.hmacStrength;this._reseed=null;this.reseedInterval=null;this.K=null;this.V=null;var entropy=utils.toArray(options.entropy,options.entropyEnc||"hex");var nonce=utils.toArray(options.nonce,options.nonceEnc||"hex");var pers=utils.toArray(options.pers,options.persEnc||"hex");assert(entropy.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits");this._init(entropy,nonce,pers)}module.exports=HmacDRBG;HmacDRBG.prototype._init=function init(entropy,nonce,pers){var seed=entropy.concat(nonce).concat(pers);this.K=new Array(this.outLen/8);this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits");this._update(entropy.concat(add||[]));this._reseed=1};HmacDRBG.prototype.generate=function generate(len,enc,add,addEnc){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");if(typeof enc!=="string"){addEnc=add;add=enc;enc=null}if(add){add=utils.toArray(add,addEnc||"hex");this._update(add)}var temp=[];while(temp.length>1;var nBits=-7;var i=isLE?nBytes-1:0;var d=isLE?-1:1;var s=buffer[offset+i];i+=d;e=s&(1<<-nBits)-1;s>>=-nBits;nBits+=eLen;for(;nBits>0;e=e*256+buffer[offset+i],i+=d,nBits-=8){}m=e&(1<<-nBits)-1;e>>=-nBits;nBits+=mLen;for(;nBits>0;m=m*256+buffer[offset+i],i+=d,nBits-=8){}if(e===0){e=1-eBias}else if(e===eMax){return m?NaN:(s?-1:1)*Infinity}else{m=m+Math.pow(2,mLen);e=e-eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)};exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c;var eLen=nBytes*8-mLen-1;var eMax=(1<>1;var rt=mLen===23?Math.pow(2,-24)-Math.pow(2,-77):0;var i=isLE?0:nBytes-1;var d=isLE?1:-1;var s=value<0||value===0&&1/value<0?1:0;value=Math.abs(value);if(isNaN(value)||value===Infinity){m=isNaN(value)?1:0;e=eMax}else{e=Math.floor(Math.log(value)/Math.LN2);if(value*(c=Math.pow(2,-e))<1){e--;c*=2}if(e+eBias>=1){value+=rt/c}else{value+=rt*Math.pow(2,1-eBias)}if(value*c>=2){e++;c/=2}if(e+eBias>=eMax){m=0;e=eMax}else if(e+eBias>=1){m=(value*c-1)*Math.pow(2,mLen);e=e+eBias}else{m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen);e=0}}for(;mLen>=8;buffer[offset+i]=m&255,i+=d,m/=256,mLen-=8){}e=e<0;buffer[offset+i]=e&255,i+=d,e/=256,eLen-=8){}buffer[offset+i-d]|=s*128}},{}],178:[function(require,module,exports){"use strict";module.exports=function(originalObject,excludeKey){return Object.keys(originalObject).reduce(function(objectWithoutExcludedKey,key){if(key!==excludeKey)objectWithoutExcludedKey[key]=originalObject[key];return objectWithoutExcludedKey},{})}},{}],179:[function(require,module,exports){(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?module.exports=factory():typeof define==="function"&&define.amd?define(factory):global.Immutable=factory()})(this,function(){"use strict";var SLICE$0=Array.prototype.slice;function createClass(ctor,superClass){if(superClass){ctor.prototype=Object.create(superClass.prototype)}ctor.prototype.constructor=ctor}function Iterable(value){return isIterable(value)?value:Seq(value)}createClass(KeyedIterable,Iterable);function KeyedIterable(value){return isKeyed(value)?value:KeyedSeq(value)}createClass(IndexedIterable,Iterable);function IndexedIterable(value){return isIndexed(value)?value:IndexedSeq(value)}createClass(SetIterable,Iterable);function SetIterable(value){return isIterable(value)&&!isAssociative(value)?value:SetSeq(value)}function isIterable(maybeIterable){return!!(maybeIterable&&maybeIterable[IS_ITERABLE_SENTINEL])}function isKeyed(maybeKeyed){return!!(maybeKeyed&&maybeKeyed[IS_KEYED_SENTINEL])}function isIndexed(maybeIndexed){return!!(maybeIndexed&&maybeIndexed[IS_INDEXED_SENTINEL])}function isAssociative(maybeAssociative){return isKeyed(maybeAssociative)||isIndexed(maybeAssociative)}function isOrdered(maybeOrdered){return!!(maybeOrdered&&maybeOrdered[IS_ORDERED_SENTINEL])}Iterable.isIterable=isIterable;Iterable.isKeyed=isKeyed;Iterable.isIndexed=isIndexed;Iterable.isAssociative=isAssociative;Iterable.isOrdered=isOrdered;Iterable.Keyed=KeyedIterable;Iterable.Indexed=IndexedIterable;Iterable.Set=SetIterable;var IS_ITERABLE_SENTINEL="@@__IMMUTABLE_ITERABLE__@@";var IS_KEYED_SENTINEL="@@__IMMUTABLE_KEYED__@@";var IS_INDEXED_SENTINEL="@@__IMMUTABLE_INDEXED__@@";var IS_ORDERED_SENTINEL="@@__IMMUTABLE_ORDERED__@@";var DELETE="delete";var SHIFT=5;var SIZE=1<>>0;if(""+uint32Index!==index||uint32Index===4294967295){return NaN}index=uint32Index}return index<0?ensureSize(iter)+index:index}function returnTrue(){return true}function wholeSlice(begin,end,size){return(begin===0||size!==undefined&&begin<=-size)&&(end===undefined||size!==undefined&&end>=size)}function resolveBegin(begin,size){return resolveIndex(begin,size,0)}function resolveEnd(end,size){return resolveIndex(end,size,size)}function resolveIndex(index,size,defaultIndex){return index===undefined?defaultIndex:index<0?Math.max(0,size+index):size===undefined?index:Math.min(size,index)}var ITERATE_KEYS=0;var ITERATE_VALUES=1;var ITERATE_ENTRIES=2;var REAL_ITERATOR_SYMBOL=typeof Symbol==="function"&&Symbol.iterator;var FAUX_ITERATOR_SYMBOL="@@iterator";var ITERATOR_SYMBOL=REAL_ITERATOR_SYMBOL||FAUX_ITERATOR_SYMBOL;function Iterator(next){this.next=next}Iterator.prototype.toString=function(){return"[Iterator]"};Iterator.KEYS=ITERATE_KEYS;Iterator.VALUES=ITERATE_VALUES;Iterator.ENTRIES=ITERATE_ENTRIES;Iterator.prototype.inspect=Iterator.prototype.toSource=function(){return this.toString()};Iterator.prototype[ITERATOR_SYMBOL]=function(){return this};function iteratorValue(type,k,v,iteratorResult){var value=type===0?k:type===1?v:[k,v];iteratorResult?iteratorResult.value=value:iteratorResult={value:value,done:false};return iteratorResult}function iteratorDone(){return{value:undefined,done:true}}function hasIterator(maybeIterable){return!!getIteratorFn(maybeIterable)}function isIterator(maybeIterator){return maybeIterator&&typeof maybeIterator.next==="function"}function getIterator(iterable){var iteratorFn=getIteratorFn(iterable);return iteratorFn&&iteratorFn.call(iterable)}function getIteratorFn(iterable){var iteratorFn=iterable&&(REAL_ITERATOR_SYMBOL&&iterable[REAL_ITERATOR_SYMBOL]||iterable[FAUX_ITERATOR_SYMBOL]);if(typeof iteratorFn==="function"){return iteratorFn}}function isArrayLike(value){return value&&typeof value.length==="number"}createClass(Seq,Iterable);function Seq(value){return value===null||value===undefined?emptySequence():isIterable(value)?value.toSeq():seqFromValue(value)}Seq.of=function(){return Seq(arguments)};Seq.prototype.toSeq=function(){return this};Seq.prototype.toString=function(){return this.__toString("Seq {","}")};Seq.prototype.cacheResult=function(){if(!this._cache&&this.__iterateUncached){this._cache=this.entrySeq().toArray();this.size=this._cache.length}return this};Seq.prototype.__iterate=function(fn,reverse){return seqIterate(this,fn,reverse,true)};Seq.prototype.__iterator=function(type,reverse){return seqIterator(this,type,reverse,true)};createClass(KeyedSeq,Seq);function KeyedSeq(value){return value===null||value===undefined?emptySequence().toKeyedSeq():isIterable(value)?isKeyed(value)?value.toSeq():value.fromEntrySeq():keyedSeqFromValue(value)}KeyedSeq.prototype.toKeyedSeq=function(){return this};createClass(IndexedSeq,Seq);function IndexedSeq(value){return value===null||value===undefined?emptySequence():!isIterable(value)?indexedSeqFromValue(value):isKeyed(value)?value.entrySeq():value.toIndexedSeq()}IndexedSeq.of=function(){return IndexedSeq(arguments)};IndexedSeq.prototype.toIndexedSeq=function(){return this};IndexedSeq.prototype.toString=function(){return this.__toString("Seq [","]")};IndexedSeq.prototype.__iterate=function(fn,reverse){return seqIterate(this,fn,reverse,false)};IndexedSeq.prototype.__iterator=function(type,reverse){return seqIterator(this,type,reverse,false)};createClass(SetSeq,Seq);function SetSeq(value){return(value===null||value===undefined?emptySequence():!isIterable(value)?indexedSeqFromValue(value):isKeyed(value)?value.entrySeq():value).toSetSeq()}SetSeq.of=function(){return SetSeq(arguments)};SetSeq.prototype.toSetSeq=function(){return this};Seq.isSeq=isSeq;Seq.Keyed=KeyedSeq;Seq.Set=SetSeq;Seq.Indexed=IndexedSeq;var IS_SEQ_SENTINEL="@@__IMMUTABLE_SEQ__@@";Seq.prototype[IS_SEQ_SENTINEL]=true;createClass(ArraySeq,IndexedSeq);function ArraySeq(array){this._array=array;this.size=array.length}ArraySeq.prototype.get=function(index,notSetValue){return this.has(index)?this._array[wrapIndex(this,index)]:notSetValue};ArraySeq.prototype.__iterate=function(fn,reverse){var array=this._array;var maxIndex=array.length-1;for(var ii=0;ii<=maxIndex;ii++){if(fn(array[reverse?maxIndex-ii:ii],ii,this)===false){return ii+1}}return ii};ArraySeq.prototype.__iterator=function(type,reverse){var array=this._array;var maxIndex=array.length-1;var ii=0;return new Iterator(function(){return ii>maxIndex?iteratorDone():iteratorValue(type,ii,array[reverse?maxIndex-ii++:ii++])})};createClass(ObjectSeq,KeyedSeq);function ObjectSeq(object){var keys=Object.keys(object);this._object=object;this._keys=keys;this.size=keys.length}ObjectSeq.prototype.get=function(key,notSetValue){if(notSetValue!==undefined&&!this.has(key)){return notSetValue}return this._object[key]};ObjectSeq.prototype.has=function(key){return this._object.hasOwnProperty(key)};ObjectSeq.prototype.__iterate=function(fn,reverse){var object=this._object;var keys=this._keys;var maxIndex=keys.length-1;for(var ii=0;ii<=maxIndex;ii++){var key=keys[reverse?maxIndex-ii:ii];if(fn(object[key],key,this)===false){return ii+1}}return ii};ObjectSeq.prototype.__iterator=function(type,reverse){var object=this._object;var keys=this._keys;var maxIndex=keys.length-1;var ii=0;return new Iterator(function(){var key=keys[reverse?maxIndex-ii:ii];return ii++>maxIndex?iteratorDone():iteratorValue(type,key,object[key])})};ObjectSeq.prototype[IS_ORDERED_SENTINEL]=true;createClass(IterableSeq,IndexedSeq);function IterableSeq(iterable){this._iterable=iterable;this.size=iterable.length||iterable.size}IterableSeq.prototype.__iterateUncached=function(fn,reverse){if(reverse){return this.cacheResult().__iterate(fn,reverse)}var iterable=this._iterable;var iterator=getIterator(iterable);var iterations=0;if(isIterator(iterator)){var step;while(!(step=iterator.next()).done){if(fn(step.value,iterations++,this)===false){break}}}return iterations};IterableSeq.prototype.__iteratorUncached=function(type,reverse){if(reverse){return this.cacheResult().__iterator(type,reverse)}var iterable=this._iterable;var iterator=getIterator(iterable);if(!isIterator(iterator)){return new Iterator(iteratorDone)}var iterations=0;return new Iterator(function(){var step=iterator.next();return step.done?step:iteratorValue(type,iterations++,step.value)})};createClass(IteratorSeq,IndexedSeq);function IteratorSeq(iterator){this._iterator=iterator;this._iteratorCache=[]}IteratorSeq.prototype.__iterateUncached=function(fn,reverse){if(reverse){return this.cacheResult().__iterate(fn,reverse)}var iterator=this._iterator;var cache=this._iteratorCache;var iterations=0;while(iterations=cache.length){var step=iterator.next();if(step.done){return step}cache[iterations]=step.value}return iteratorValue(type,iterations,cache[iterations++])})};function isSeq(maybeSeq){return!!(maybeSeq&&maybeSeq[IS_SEQ_SENTINEL])}var EMPTY_SEQ;function emptySequence(){return EMPTY_SEQ||(EMPTY_SEQ=new ArraySeq([]))}function keyedSeqFromValue(value){var seq=Array.isArray(value)?new ArraySeq(value).fromEntrySeq():isIterator(value)?new IteratorSeq(value).fromEntrySeq():hasIterator(value)?new IterableSeq(value).fromEntrySeq():typeof value==="object"?new ObjectSeq(value):undefined;if(!seq){throw new TypeError("Expected Array or iterable object of [k, v] entries, "+"or keyed object: "+value)}return seq}function indexedSeqFromValue(value){var seq=maybeIndexedSeqFromValue(value);if(!seq){throw new TypeError("Expected Array or iterable object of values: "+value)}return seq}function seqFromValue(value){var seq=maybeIndexedSeqFromValue(value)||typeof value==="object"&&new ObjectSeq(value);if(!seq){throw new TypeError("Expected Array or iterable object of values, or keyed object: "+value)}return seq}function maybeIndexedSeqFromValue(value){return isArrayLike(value)?new ArraySeq(value):isIterator(value)?new IteratorSeq(value):hasIterator(value)?new IterableSeq(value):undefined}function seqIterate(seq,fn,reverse,useKeys){var cache=seq._cache;if(cache){var maxIndex=cache.length-1;for(var ii=0;ii<=maxIndex;ii++){var entry=cache[reverse?maxIndex-ii:ii];if(fn(entry[1],useKeys?entry[0]:ii,seq)===false){return ii+1}}return ii}return seq.__iterateUncached(fn,reverse)}function seqIterator(seq,type,reverse,useKeys){var cache=seq._cache;if(cache){var maxIndex=cache.length-1;var ii=0;return new Iterator(function(){var entry=cache[reverse?maxIndex-ii:ii];return ii++>maxIndex?iteratorDone():iteratorValue(type,useKeys?entry[0]:ii-1,entry[1])})}return seq.__iteratorUncached(type,reverse)}function fromJS(json,converter){return converter?fromJSWith(converter,json,"",{"":json}):fromJSDefault(json)}function fromJSWith(converter,json,key,parentJSON){if(Array.isArray(json)){return converter.call(parentJSON,key,IndexedSeq(json).map(function(v,k){return fromJSWith(converter,v,k,json)}))}if(isPlainObj(json)){return converter.call(parentJSON,key,KeyedSeq(json).map(function(v,k){return fromJSWith(converter,v,k,json)}))}return json}function fromJSDefault(json){if(Array.isArray(json)){return IndexedSeq(json).map(fromJSDefault).toList()}if(isPlainObj(json)){return KeyedSeq(json).map(fromJSDefault).toMap()}return json}function isPlainObj(value){return value&&(value.constructor===Object||value.constructor===undefined)}function is(valueA,valueB){if(valueA===valueB||valueA!==valueA&&valueB!==valueB){return true}if(!valueA||!valueB){return false}if(typeof valueA.valueOf==="function"&&typeof valueB.valueOf==="function"){valueA=valueA.valueOf();valueB=valueB.valueOf();if(valueA===valueB||valueA!==valueA&&valueB!==valueB){return true}if(!valueA||!valueB){return false}}if(typeof valueA.equals==="function"&&typeof valueB.equals==="function"&&valueA.equals(valueB)){return true}return false}function deepEqual(a,b){if(a===b){return true}if(!isIterable(b)||a.size!==undefined&&b.size!==undefined&&a.size!==b.size||a.__hash!==undefined&&b.__hash!==undefined&&a.__hash!==b.__hash||isKeyed(a)!==isKeyed(b)||isIndexed(a)!==isIndexed(b)||isOrdered(a)!==isOrdered(b)){return false}if(a.size===0&&b.size===0){return true}var notAssociative=!isAssociative(a);if(isOrdered(a)){var entries=a.entries();return b.every(function(v,k){var entry=entries.next().value;return entry&&is(entry[1],v)&&(notAssociative||is(entry[0],k))})&&entries.next().done}var flipped=false;if(a.size===undefined){if(b.size===undefined){if(typeof a.cacheResult==="function"){a.cacheResult()}}else{flipped=true;var _=a;a=b;b=_}}var allEqual=true;var bSize=b.__iterate(function(v,k){if(notAssociative?!a.has(v):flipped?!is(v,a.get(k,NOT_SET)):!is(a.get(k,NOT_SET),v)){allEqual=false;return false}});return allEqual&&a.size===bSize}createClass(Repeat,IndexedSeq);function Repeat(value,times){if(!(this instanceof Repeat)){return new Repeat(value,times)}this._value=value;this.size=times===undefined?Infinity:Math.max(0,times);if(this.size===0){if(EMPTY_REPEAT){return EMPTY_REPEAT}EMPTY_REPEAT=this}}Repeat.prototype.toString=function(){if(this.size===0){return"Repeat []"}return"Repeat [ "+this._value+" "+this.size+" times ]"};Repeat.prototype.get=function(index,notSetValue){return this.has(index)?this._value:notSetValue};Repeat.prototype.includes=function(searchValue){return is(this._value,searchValue)};Repeat.prototype.slice=function(begin,end){var size=this.size;return wholeSlice(begin,end,size)?this:new Repeat(this._value,resolveEnd(end,size)-resolveBegin(begin,size))};Repeat.prototype.reverse=function(){return this};Repeat.prototype.indexOf=function(searchValue){if(is(this._value,searchValue)){return 0}return-1};Repeat.prototype.lastIndexOf=function(searchValue){if(is(this._value,searchValue)){return this.size}return-1};Repeat.prototype.__iterate=function(fn,reverse){for(var ii=0;ii=0&&possibleIndex=0&&indexmaxIndex?iteratorDone():iteratorValue(type,ii++,v)})};Range.prototype.equals=function(other){return other instanceof Range?this._start===other._start&&this._end===other._end&&this._step===other._step:deepEqual(this,other)};var EMPTY_RANGE;createClass(Collection,Iterable);function Collection(){throw TypeError("Abstract")}createClass(KeyedCollection,Collection);function KeyedCollection(){}createClass(IndexedCollection,Collection);function IndexedCollection(){}createClass(SetCollection,Collection);function SetCollection(){}Collection.Keyed=KeyedCollection;Collection.Indexed=IndexedCollection;Collection.Set=SetCollection;var imul=typeof Math.imul==="function"&&Math.imul(4294967295,2)===-2?Math.imul:function imul(a,b){a=a|0;b=b|0;var c=a&65535;var d=b&65535;return c*d+((a>>>16)*d+c*(b>>>16)<<16>>>0)|0};function smi(i32){return i32>>>1&1073741824|i32&3221225471}function hash(o){if(o===false||o===null||o===undefined){return 0}if(typeof o.valueOf==="function"){o=o.valueOf();if(o===false||o===null||o===undefined){return 0}}if(o===true){return 1}var type=typeof o;if(type==="number"){if(o!==o||o===Infinity){return 0}var h=o|0;if(h!==o){h^=o*4294967295}while(o>4294967295){o/=4294967295;h^=o}return smi(h)}if(type==="string"){return o.length>STRING_HASH_CACHE_MIN_STRLEN?cachedHashString(o):hashString(o)}if(typeof o.hashCode==="function"){return o.hashCode()}if(type==="object"){return hashJSObj(o)}if(typeof o.toString==="function"){return hashString(o.toString())}throw new Error("Value type "+type+" cannot be hashed.")}function cachedHashString(string){var hash=stringHashCache[string];if(hash===undefined){hash=hashString(string);if(STRING_HASH_CACHE_SIZE===STRING_HASH_CACHE_MAX_SIZE){STRING_HASH_CACHE_SIZE=0;stringHashCache={}}STRING_HASH_CACHE_SIZE++;stringHashCache[string]=hash}return hash}function hashString(string){ var hash=0;for(var ii=0;ii0){switch(node.nodeType){case 1:return node.uniqueID;case 9:return node.documentElement&&node.documentElement.uniqueID}}}var usingWeakMap=typeof WeakMap==="function";var weakMap;if(usingWeakMap){weakMap=new WeakMap}var objHashUID=0;var UID_HASH_KEY="__immutablehash__";if(typeof Symbol==="function"){UID_HASH_KEY=Symbol(UID_HASH_KEY)}var STRING_HASH_CACHE_MIN_STRLEN=16;var STRING_HASH_CACHE_MAX_SIZE=255;var STRING_HASH_CACHE_SIZE=0;var stringHashCache={};function assertNotInfinite(size){invariant(size!==Infinity,"Cannot perform this action with an infinite size.")}createClass(Map,KeyedCollection);function Map(value){return value===null||value===undefined?emptyMap():isMap(value)&&!isOrdered(value)?value:emptyMap().withMutations(function(map){var iter=KeyedIterable(value);assertNotInfinite(iter.size);iter.forEach(function(v,k){return map.set(k,v)})})}Map.of=function(){var keyValues=SLICE$0.call(arguments,0);return emptyMap().withMutations(function(map){for(var i=0;i=keyValues.length){throw new Error("Missing value for key: "+keyValues[i])}map.set(keyValues[i],keyValues[i+1])}})};Map.prototype.toString=function(){return this.__toString("Map {","}")};Map.prototype.get=function(k,notSetValue){return this._root?this._root.get(0,undefined,k,notSetValue):notSetValue};Map.prototype.set=function(k,v){return updateMap(this,k,v)};Map.prototype.setIn=function(keyPath,v){return this.updateIn(keyPath,NOT_SET,function(){return v})};Map.prototype.remove=function(k){return updateMap(this,k,NOT_SET)};Map.prototype.deleteIn=function(keyPath){return this.updateIn(keyPath,function(){return NOT_SET})};Map.prototype.update=function(k,notSetValue,updater){return arguments.length===1?k(this):this.updateIn([k],notSetValue,updater)};Map.prototype.updateIn=function(keyPath,notSetValue,updater){if(!updater){updater=notSetValue;notSetValue=undefined}var updatedValue=updateInDeepMap(this,forceIterator(keyPath),notSetValue,updater);return updatedValue===NOT_SET?undefined:updatedValue};Map.prototype.clear=function(){if(this.size===0){return this}if(this.__ownerID){this.size=0;this._root=null;this.__hash=undefined;this.__altered=true;return this}return emptyMap()};Map.prototype.merge=function(){return mergeIntoMapWith(this,undefined,arguments)};Map.prototype.mergeWith=function(merger){var iters=SLICE$0.call(arguments,1);return mergeIntoMapWith(this,merger,iters)};Map.prototype.mergeIn=function(keyPath){var iters=SLICE$0.call(arguments,1);return this.updateIn(keyPath,emptyMap(),function(m){return typeof m.merge==="function"?m.merge.apply(m,iters):iters[iters.length-1]})};Map.prototype.mergeDeep=function(){return mergeIntoMapWith(this,deepMerger,arguments)};Map.prototype.mergeDeepWith=function(merger){var iters=SLICE$0.call(arguments,1);return mergeIntoMapWith(this,deepMergerWith(merger),iters)};Map.prototype.mergeDeepIn=function(keyPath){var iters=SLICE$0.call(arguments,1);return this.updateIn(keyPath,emptyMap(),function(m){return typeof m.mergeDeep==="function"?m.mergeDeep.apply(m,iters):iters[iters.length-1]})};Map.prototype.sort=function(comparator){return OrderedMap(sortFactory(this,comparator))};Map.prototype.sortBy=function(mapper,comparator){return OrderedMap(sortFactory(this,comparator,mapper))};Map.prototype.withMutations=function(fn){var mutable=this.asMutable();fn(mutable);return mutable.wasAltered()?mutable.__ensureOwner(this.__ownerID):this};Map.prototype.asMutable=function(){return this.__ownerID?this:this.__ensureOwner(new OwnerID)};Map.prototype.asImmutable=function(){return this.__ensureOwner()};Map.prototype.wasAltered=function(){return this.__altered};Map.prototype.__iterator=function(type,reverse){return new MapIterator(this,type,reverse)};Map.prototype.__iterate=function(fn,reverse){var this$0=this;var iterations=0;this._root&&this._root.iterate(function(entry){iterations++;return fn(entry[1],entry[0],this$0)},reverse);return iterations};Map.prototype.__ensureOwner=function(ownerID){if(ownerID===this.__ownerID){return this}if(!ownerID){this.__ownerID=ownerID;this.__altered=false;return this}return makeMap(this.size,this._root,ownerID,this.__hash)};function isMap(maybeMap){return!!(maybeMap&&maybeMap[IS_MAP_SENTINEL])}Map.isMap=isMap;var IS_MAP_SENTINEL="@@__IMMUTABLE_MAP__@@";var MapPrototype=Map.prototype;MapPrototype[IS_MAP_SENTINEL]=true;MapPrototype[DELETE]=MapPrototype.remove;MapPrototype.removeIn=MapPrototype.deleteIn;function ArrayMapNode(ownerID,entries){this.ownerID=ownerID;this.entries=entries}ArrayMapNode.prototype.get=function(shift,keyHash,key,notSetValue){var entries=this.entries;for(var ii=0,len=entries.length;ii=MAX_ARRAY_MAP_SIZE){return createNodes(ownerID,entries,key,value)}var isEditable=ownerID&&ownerID===this.ownerID;var newEntries=isEditable?entries:arrCopy(entries);if(exists){if(removed){idx===len-1?newEntries.pop():newEntries[idx]=newEntries.pop()}else{newEntries[idx]=[key,value]}}else{newEntries.push([key,value])}if(isEditable){this.entries=newEntries;return this}return new ArrayMapNode(ownerID,newEntries)};function BitmapIndexedNode(ownerID,bitmap,nodes){this.ownerID=ownerID;this.bitmap=bitmap;this.nodes=nodes}BitmapIndexedNode.prototype.get=function(shift,keyHash,key,notSetValue){if(keyHash===undefined){keyHash=hash(key)}var bit=1<<((shift===0?keyHash:keyHash>>>shift)&MASK);var bitmap=this.bitmap;return(bitmap&bit)===0?notSetValue:this.nodes[popCount(bitmap&bit-1)].get(shift+SHIFT,keyHash,key,notSetValue)};BitmapIndexedNode.prototype.update=function(ownerID,shift,keyHash,key,value,didChangeSize,didAlter){if(keyHash===undefined){keyHash=hash(key)}var keyHashFrag=(shift===0?keyHash:keyHash>>>shift)&MASK;var bit=1<=MAX_BITMAP_INDEXED_SIZE){return expandNodes(ownerID,nodes,bitmap,keyHashFrag,newNode)}if(exists&&!newNode&&nodes.length===2&&isLeafNode(nodes[idx^1])){return nodes[idx^1]}if(exists&&newNode&&nodes.length===1&&isLeafNode(newNode)){return newNode}var isEditable=ownerID&&ownerID===this.ownerID;var newBitmap=exists?newNode?bitmap:bitmap^bit:bitmap|bit;var newNodes=exists?newNode?setIn(nodes,idx,newNode,isEditable):spliceOut(nodes,idx,isEditable):spliceIn(nodes,idx,newNode,isEditable);if(isEditable){this.bitmap=newBitmap;this.nodes=newNodes;return this}return new BitmapIndexedNode(ownerID,newBitmap,newNodes)};function HashArrayMapNode(ownerID,count,nodes){this.ownerID=ownerID;this.count=count;this.nodes=nodes}HashArrayMapNode.prototype.get=function(shift,keyHash,key,notSetValue){if(keyHash===undefined){keyHash=hash(key)}var idx=(shift===0?keyHash:keyHash>>>shift)&MASK;var node=this.nodes[idx];return node?node.get(shift+SHIFT,keyHash,key,notSetValue):notSetValue};HashArrayMapNode.prototype.update=function(ownerID,shift,keyHash,key,value,didChangeSize,didAlter){if(keyHash===undefined){keyHash=hash(key)}var idx=(shift===0?keyHash:keyHash>>>shift)&MASK;var removed=value===NOT_SET;var nodes=this.nodes;var node=nodes[idx];if(removed&&!node){return this}var newNode=updateNode(node,ownerID,shift+SHIFT,keyHash,key,value,didChangeSize,didAlter);if(newNode===node){return this}var newCount=this.count;if(!node){newCount++}else if(!newNode){newCount--;if(newCount>>shift)&MASK;var idx2=(shift===0?keyHash:keyHash>>>shift)&MASK;var newNode;var nodes=idx1===idx2?[mergeIntoNode(node,ownerID,shift+SHIFT,keyHash,entry)]:(newNode=new ValueNode(ownerID,keyHash,entry),idx1>>=1){expandedNodes[ii]=bitmap&1?nodes[count++]:undefined}expandedNodes[including]=node;return new HashArrayMapNode(ownerID,count+1,expandedNodes)}function mergeIntoMapWith(map,merger,iterables){var iters=[];for(var ii=0;ii>1&1431655765);x=(x&858993459)+(x>>2&858993459);x=x+(x>>4)&252645135;x=x+(x>>8);x=x+(x>>16);return x&127}function setIn(array,idx,val,canEdit){var newArray=canEdit?array:arrCopy(array);newArray[idx]=val;return newArray}function spliceIn(array,idx,val,canEdit){var newLen=array.length+1;if(canEdit&&idx+1===newLen){array[idx]=val;return array}var newArray=new Array(newLen);var after=0;for(var ii=0;ii0&&size=0&&index>>level&MASK;if(originIndex>=this.array.length){return new VNode([],ownerID)}var removingFirst=originIndex===0;var newChild;if(level>0){var oldChild=this.array[originIndex];newChild=oldChild&&oldChild.removeBefore(ownerID,level-SHIFT,index);if(newChild===oldChild&&removingFirst){return this}}if(removingFirst&&!newChild){return this}var editable=editableVNode(this,ownerID);if(!removingFirst){for(var ii=0;ii>>level&MASK;if(sizeIndex>=this.array.length){return this}var newChild;if(level>0){var oldChild=this.array[sizeIndex];newChild=oldChild&&oldChild.removeAfter(ownerID,level-SHIFT,index);if(newChild===oldChild&&sizeIndex===this.array.length-1){return this}}var editable=editableVNode(this,ownerID);editable.array.splice(sizeIndex+1);if(newChild){editable.array[sizeIndex]=newChild}return editable};var DONE={};function iterateList(list,reverse){var left=list._origin;var right=list._capacity;var tailPos=getTailOffset(right);var tail=list._tail;return iterateNodeOrLeaf(list._root,list._level,0);function iterateNodeOrLeaf(node,level,offset){return level===0?iterateLeaf(node,offset):iterateNode(node,level,offset)}function iterateLeaf(node,offset){var array=offset===tailPos?tail&&tail.array:node&&node.array;var from=offset>left?0:left-offset;var to=right-offset;if(to>SIZE){to=SIZE}return function(){if(from===to){return DONE}var idx=reverse?--to:from++;return array&&array[idx]}}function iterateNode(node,level,offset){var values;var array=node&&node.array;var from=offset>left?0:left-offset>>level;var to=(right-offset>>level)+1;if(to>SIZE){to=SIZE}return function(){do{if(values){var value=values();if(value!==DONE){return value}values=null}if(from===to){return DONE}var idx=reverse?--to:from++;values=iterateNodeOrLeaf(array&&array[idx],level-SHIFT,offset+(idx<=list.size||index<0){return list.withMutations(function(list){index<0?setListBounds(list,index).set(0,value):setListBounds(list,0,index+1).set(index,value)})}index+=list._origin;var newTail=list._tail;var newRoot=list._root;var didAlter=MakeRef(DID_ALTER);if(index>=getTailOffset(list._capacity)){newTail=updateVNode(newTail,list.__ownerID,0,index,value,didAlter)}else{newRoot=updateVNode(newRoot,list.__ownerID,list._level,index,value,didAlter)}if(!didAlter.value){return list}if(list.__ownerID){list._root=newRoot;list._tail=newTail;list.__hash=undefined;list.__altered=true;return list}return makeList(list._origin,list._capacity,list._level,newRoot,newTail)}function updateVNode(node,ownerID,level,index,value,didAlter){var idx=index>>>level&MASK;var nodeHas=node&&idx0){var lowerNode=node&&node.array[idx];var newLowerNode=updateVNode(lowerNode,ownerID,level-SHIFT,index,value,didAlter);if(newLowerNode===lowerNode){return node}newNode=editableVNode(node,ownerID);newNode.array[idx]=newLowerNode;return newNode}if(nodeHas&&node.array[idx]===value){return node}SetRef(didAlter);newNode=editableVNode(node,ownerID);if(value===undefined&&idx===newNode.array.length-1){newNode.array.pop()}else{newNode.array[idx]=value}return newNode}function editableVNode(node,ownerID){if(ownerID&&node&&ownerID===node.ownerID){return node}return new VNode(node?node.array.slice():[],ownerID)}function listNodeFor(list,rawIndex){if(rawIndex>=getTailOffset(list._capacity)){return list._tail}if(rawIndex<1<0){node=node.array[rawIndex>>>level&MASK];level-=SHIFT}return node}}function setListBounds(list,begin,end){if(begin!==undefined){begin=begin|0}if(end!==undefined){end=end|0}var owner=list.__ownerID||new OwnerID;var oldOrigin=list._origin;var oldCapacity=list._capacity;var newOrigin=oldOrigin+begin;var newCapacity=end===undefined?oldCapacity:end<0?oldCapacity+end:oldOrigin+end;if(newOrigin===oldOrigin&&newCapacity===oldCapacity){return list}if(newOrigin>=newCapacity){return list.clear()}var newLevel=list._level;var newRoot=list._root;var offsetShift=0;while(newOrigin+offsetShift<0){newRoot=new VNode(newRoot&&newRoot.array.length?[undefined,newRoot]:[],owner);newLevel+=SHIFT;offsetShift+=1<=1<oldTailOffset?new VNode([],owner):oldTail;if(oldTail&&newTailOffset>oldTailOffset&&newOriginSHIFT;level-=SHIFT){var idx=oldTailOffset>>>level&MASK;node=node.array[idx]=editableVNode(node.array[idx],owner)}node.array[oldTailOffset>>>SHIFT&MASK]=oldTail}if(newCapacity=newTailOffset){newOrigin-=newTailOffset;newCapacity-=newTailOffset;newLevel=SHIFT;newRoot=null;newTail=newTail&&newTail.removeBefore(owner,0,newOrigin)}else if(newOrigin>oldOrigin||newTailOffset>>newLevel&MASK;if(beginIndex!==newTailOffset>>>newLevel&MASK){break}if(beginIndex){offsetShift+=(1<oldOrigin){newRoot=newRoot.removeBefore(owner,newLevel,newOrigin-offsetShift)}if(newRoot&&newTailOffsetmaxSize){maxSize=iter.size}if(!isIterable(value)){iter=iter.map(function(v){return fromJS(v)})}iters.push(iter)}if(maxSize>list.size){list=list.setSize(maxSize)}return mergeIntoCollectionWith(list,merger,iters)}function getTailOffset(size){return size>>SHIFT<=SIZE&&list.size>=map.size*2){newList=list.filter(function(entry,idx){return entry!==undefined&&i!==idx});newMap=newList.toKeyedSeq().map(function(entry){return entry[0]}).flip().toMap();if(omap.__ownerID){newMap.__ownerID=newList.__ownerID=omap.__ownerID}}else{newMap=map.remove(k);newList=i===list.size-1?list.pop():list.set(i,undefined)}}else{if(has){if(v===list.get(i)[1]){return omap}newMap=map;newList=list.set(i,[k,v])}else{newMap=map.set(k,list.size);newList=list.set(list.size,[k,v])}}if(omap.__ownerID){omap.size=newMap.size;omap._map=newMap;omap._list=newList;omap.__hash=undefined;return omap}return makeOrderedMap(newMap,newList)}createClass(ToKeyedSequence,KeyedSeq);function ToKeyedSequence(indexed,useKeys){this._iter=indexed;this._useKeys=useKeys;this.size=indexed.size}ToKeyedSequence.prototype.get=function(key,notSetValue){return this._iter.get(key,notSetValue)};ToKeyedSequence.prototype.has=function(key){return this._iter.has(key)};ToKeyedSequence.prototype.valueSeq=function(){return this._iter.valueSeq()};ToKeyedSequence.prototype.reverse=function(){var this$0=this;var reversedSequence=reverseFactory(this,true);if(!this._useKeys){reversedSequence.valueSeq=function(){return this$0._iter.toSeq().reverse()}}return reversedSequence};ToKeyedSequence.prototype.map=function(mapper,context){var this$0=this;var mappedSequence=mapFactory(this,mapper,context);if(!this._useKeys){mappedSequence.valueSeq=function(){return this$0._iter.toSeq().map(mapper,context)}}return mappedSequence};ToKeyedSequence.prototype.__iterate=function(fn,reverse){var this$0=this;var ii;return this._iter.__iterate(this._useKeys?function(v,k){return fn(v,k,this$0)}:(ii=reverse?resolveSize(this):0,function(v){return fn(v,reverse?--ii:ii++,this$0)}),reverse)};ToKeyedSequence.prototype.__iterator=function(type,reverse){if(this._useKeys){return this._iter.__iterator(type,reverse)}var iterator=this._iter.__iterator(ITERATE_VALUES,reverse);var ii=reverse?resolveSize(this):0;return new Iterator(function(){var step=iterator.next();return step.done?step:iteratorValue(type,reverse?--ii:ii++,step.value,step)})};ToKeyedSequence.prototype[IS_ORDERED_SENTINEL]=true;createClass(ToIndexedSequence,IndexedSeq);function ToIndexedSequence(iter){this._iter=iter;this.size=iter.size}ToIndexedSequence.prototype.includes=function(value){return this._iter.includes(value)};ToIndexedSequence.prototype.__iterate=function(fn,reverse){var this$0=this;var iterations=0;return this._iter.__iterate(function(v){return fn(v,iterations++,this$0)},reverse)};ToIndexedSequence.prototype.__iterator=function(type,reverse){var iterator=this._iter.__iterator(ITERATE_VALUES,reverse);var iterations=0;return new Iterator(function(){var step=iterator.next();return step.done?step:iteratorValue(type,iterations++,step.value,step)})};createClass(ToSetSequence,SetSeq);function ToSetSequence(iter){this._iter=iter;this.size=iter.size}ToSetSequence.prototype.has=function(key){return this._iter.includes(key)};ToSetSequence.prototype.__iterate=function(fn,reverse){var this$0=this;return this._iter.__iterate(function(v){return fn(v,v,this$0)},reverse)};ToSetSequence.prototype.__iterator=function(type,reverse){var iterator=this._iter.__iterator(ITERATE_VALUES,reverse);return new Iterator(function(){var step=iterator.next();return step.done?step:iteratorValue(type,step.value,step.value,step)})};createClass(FromEntriesSequence,KeyedSeq);function FromEntriesSequence(entries){this._iter=entries;this.size=entries.size}FromEntriesSequence.prototype.entrySeq=function(){return this._iter.toSeq()};FromEntriesSequence.prototype.__iterate=function(fn,reverse){var this$0=this;return this._iter.__iterate(function(entry){if(entry){validateEntry(entry);var indexedIterable=isIterable(entry);return fn(indexedIterable?entry.get(1):entry[1],indexedIterable?entry.get(0):entry[0],this$0)}},reverse)};FromEntriesSequence.prototype.__iterator=function(type,reverse){var iterator=this._iter.__iterator(ITERATE_VALUES,reverse);return new Iterator(function(){while(true){var step=iterator.next();if(step.done){return step}var entry=step.value;if(entry){validateEntry(entry);var indexedIterable=isIterable(entry);return iteratorValue(type,indexedIterable?entry.get(0):entry[0],indexedIterable?entry.get(1):entry[1],step)}}})};ToIndexedSequence.prototype.cacheResult=ToKeyedSequence.prototype.cacheResult=ToSetSequence.prototype.cacheResult=FromEntriesSequence.prototype.cacheResult=cacheResultThrough;function flipFactory(iterable){var flipSequence=makeSequence(iterable);flipSequence._iter=iterable;flipSequence.size=iterable.size;flipSequence.flip=function(){return iterable};flipSequence.reverse=function(){var reversedSequence=iterable.reverse.apply(this);reversedSequence.flip=function(){return iterable.reverse()};return reversedSequence};flipSequence.has=function(key){return iterable.includes(key)};flipSequence.includes=function(key){return iterable.has(key)};flipSequence.cacheResult=cacheResultThrough;flipSequence.__iterateUncached=function(fn,reverse){var this$0=this;return iterable.__iterate(function(v,k){return fn(k,v,this$0)!==false},reverse)};flipSequence.__iteratorUncached=function(type,reverse){if(type===ITERATE_ENTRIES){var iterator=iterable.__iterator(type,reverse);return new Iterator(function(){var step=iterator.next();if(!step.done){var k=step.value[0];step.value[0]=step.value[1];step.value[1]=k}return step})}return iterable.__iterator(type===ITERATE_VALUES?ITERATE_KEYS:ITERATE_VALUES,reverse)};return flipSequence}function mapFactory(iterable,mapper,context){var mappedSequence=makeSequence(iterable);mappedSequence.size=iterable.size;mappedSequence.has=function(key){return iterable.has(key)};mappedSequence.get=function(key,notSetValue){var v=iterable.get(key,NOT_SET);return v===NOT_SET?notSetValue:mapper.call(context,v,key,iterable)};mappedSequence.__iterateUncached=function(fn,reverse){var this$0=this;return iterable.__iterate(function(v,k,c){return fn(mapper.call(context,v,k,c),k,this$0)!==false},reverse)};mappedSequence.__iteratorUncached=function(type,reverse){var iterator=iterable.__iterator(ITERATE_ENTRIES,reverse);return new Iterator(function(){var step=iterator.next();if(step.done){return step}var entry=step.value;var key=entry[0];return iteratorValue(type,key,mapper.call(context,entry[1],key,iterable),step)})};return mappedSequence}function reverseFactory(iterable,useKeys){var reversedSequence=makeSequence(iterable);reversedSequence._iter=iterable;reversedSequence.size=iterable.size;reversedSequence.reverse=function(){return iterable};if(iterable.flip){reversedSequence.flip=function(){var flipSequence=flipFactory(iterable);flipSequence.reverse=function(){return iterable.flip()};return flipSequence}}reversedSequence.get=function(key,notSetValue){return iterable.get(useKeys?key:-1-key,notSetValue)};reversedSequence.has=function(key){return iterable.has(useKeys?key:-1-key)};reversedSequence.includes=function(value){return iterable.includes(value)};reversedSequence.cacheResult=cacheResultThrough;reversedSequence.__iterate=function(fn,reverse){var this$0=this;return iterable.__iterate(function(v,k){return fn(v,k,this$0)},!reverse)};reversedSequence.__iterator=function(type,reverse){return iterable.__iterator(type,!reverse)};return reversedSequence}function filterFactory(iterable,predicate,context,useKeys){var filterSequence=makeSequence(iterable);if(useKeys){filterSequence.has=function(key){var v=iterable.get(key,NOT_SET);return v!==NOT_SET&&!!predicate.call(context,v,key,iterable)};filterSequence.get=function(key,notSetValue){var v=iterable.get(key,NOT_SET);return v!==NOT_SET&&predicate.call(context,v,key,iterable)?v:notSetValue}}filterSequence.__iterateUncached=function(fn,reverse){var this$0=this;var iterations=0;iterable.__iterate(function(v,k,c){if(predicate.call(context,v,k,c)){iterations++;return fn(v,useKeys?k:iterations-1,this$0)}},reverse);return iterations};filterSequence.__iteratorUncached=function(type,reverse){var iterator=iterable.__iterator(ITERATE_ENTRIES,reverse);var iterations=0;return new Iterator(function(){while(true){var step=iterator.next();if(step.done){return step}var entry=step.value;var key=entry[0];var value=entry[1];if(predicate.call(context,value,key,iterable)){return iteratorValue(type,useKeys?key:iterations++,value,step)}}})};return filterSequence}function countByFactory(iterable,grouper,context){var groups=Map().asMutable();iterable.__iterate(function(v,k){groups.update(grouper.call(context,v,k,iterable),0,function(a){return a+1})});return groups.asImmutable()}function groupByFactory(iterable,grouper,context){var isKeyedIter=isKeyed(iterable);var groups=(isOrdered(iterable)?OrderedMap():Map()).asMutable();iterable.__iterate(function(v,k){groups.update(grouper.call(context,v,k,iterable),function(a){return a=a||[],a.push(isKeyedIter?[k,v]:v),a})});var coerce=iterableClass(iterable);return groups.map(function(arr){return reify(iterable,coerce(arr))})}function sliceFactory(iterable,begin,end,useKeys){var originalSize=iterable.size;if(begin!==undefined){begin=begin|0}if(end!==undefined){if(end===Infinity){end=originalSize}else{end=end|0}}if(wholeSlice(begin,end,originalSize)){return iterable}var resolvedBegin=resolveBegin(begin,originalSize);var resolvedEnd=resolveEnd(end,originalSize);if(resolvedBegin!==resolvedBegin||resolvedEnd!==resolvedEnd){return sliceFactory(iterable.toSeq().cacheResult(),begin,end,useKeys)}var resolvedSize=resolvedEnd-resolvedBegin;var sliceSize;if(resolvedSize===resolvedSize){sliceSize=resolvedSize<0?0:resolvedSize}var sliceSeq=makeSequence(iterable);sliceSeq.size=sliceSize===0?sliceSize:iterable.size&&sliceSize||undefined;if(!useKeys&&isSeq(iterable)&&sliceSize>=0){sliceSeq.get=function(index,notSetValue){index=wrapIndex(this,index);return index>=0&&indexsliceSize){return iteratorDone()}var step=iterator.next();if(useKeys||type===ITERATE_VALUES){return step}else if(type===ITERATE_KEYS){return iteratorValue(type,iterations-1,undefined,step)}else{return iteratorValue(type,iterations-1,step.value[1],step)}})};return sliceSeq}function takeWhileFactory(iterable,predicate,context){var takeSequence=makeSequence(iterable);takeSequence.__iterateUncached=function(fn,reverse){var this$0=this;if(reverse){return this.cacheResult().__iterate(fn,reverse)}var iterations=0;iterable.__iterate(function(v,k,c){return predicate.call(context,v,k,c)&&++iterations&&fn(v,k,this$0)});return iterations};takeSequence.__iteratorUncached=function(type,reverse){var this$0=this;if(reverse){return this.cacheResult().__iterator(type,reverse)}var iterator=iterable.__iterator(ITERATE_ENTRIES,reverse);var iterating=true;return new Iterator(function(){if(!iterating){return iteratorDone()}var step=iterator.next();if(step.done){return step}var entry=step.value;var k=entry[0];var v=entry[1];if(!predicate.call(context,v,k,this$0)){iterating=false;return iteratorDone()}return type===ITERATE_ENTRIES?step:iteratorValue(type,k,v,step)})};return takeSequence}function skipWhileFactory(iterable,predicate,context,useKeys){var skipSequence=makeSequence(iterable);skipSequence.__iterateUncached=function(fn,reverse){var this$0=this;if(reverse){return this.cacheResult().__iterate(fn,reverse)}var isSkipping=true;var iterations=0;iterable.__iterate(function(v,k,c){if(!(isSkipping&&(isSkipping=predicate.call(context,v,k,c)))){iterations++;return fn(v,useKeys?k:iterations-1,this$0)}});return iterations};skipSequence.__iteratorUncached=function(type,reverse){var this$0=this;if(reverse){return this.cacheResult().__iterator(type,reverse)}var iterator=iterable.__iterator(ITERATE_ENTRIES,reverse);var skipping=true;var iterations=0;return new Iterator(function(){var step,k,v;do{step=iterator.next();if(step.done){if(useKeys||type===ITERATE_VALUES){return step}else if(type===ITERATE_KEYS){return iteratorValue(type,iterations++,undefined,step)}else{return iteratorValue(type,iterations++,step.value[1],step)}}var entry=step.value;k=entry[0];v=entry[1];skipping&&(skipping=predicate.call(context,v,k,this$0))}while(skipping);return type===ITERATE_ENTRIES?step:iteratorValue(type,k,v,step)})};return skipSequence}function concatFactory(iterable,values){var isKeyedIterable=isKeyed(iterable);var iters=[iterable].concat(values).map(function(v){if(!isIterable(v)){v=isKeyedIterable?keyedSeqFromValue(v):indexedSeqFromValue(Array.isArray(v)?v:[v])}else if(isKeyedIterable){v=KeyedIterable(v)}return v}).filter(function(v){return v.size!==0});if(iters.length===0){return iterable}if(iters.length===1){var singleton=iters[0];if(singleton===iterable||isKeyedIterable&&isKeyed(singleton)||isIndexed(iterable)&&isIndexed(singleton)){return singleton}}var concatSeq=new ArraySeq(iters);if(isKeyedIterable){concatSeq=concatSeq.toKeyedSeq()}else if(!isIndexed(iterable)){concatSeq=concatSeq.toSetSeq()}concatSeq=concatSeq.flatten(true);concatSeq.size=iters.reduce(function(sum,seq){if(sum!==undefined){var size=seq.size;if(size!==undefined){return sum+size}}},0);return concatSeq}function flattenFactory(iterable,depth,useKeys){var flatSequence=makeSequence(iterable);flatSequence.__iterateUncached=function(fn,reverse){var iterations=0;var stopped=false;function flatDeep(iter,currentDepth){var this$0=this;iter.__iterate(function(v,k){if((!depth||currentDepth0}function zipWithFactory(keyIter,zipper,iters){var zipSequence=makeSequence(keyIter);zipSequence.size=new ArraySeq(iters).map(function(i){return i.size}).min();zipSequence.__iterate=function(fn,reverse){var iterator=this.__iterator(ITERATE_VALUES,reverse);var step;var iterations=0;while(!(step=iterator.next()).done){if(fn(step.value,iterations++,this)===false){break}}return iterations};zipSequence.__iteratorUncached=function(type,reverse){var iterators=iters.map(function(i){return i=Iterable(i),getIterator(reverse?i.reverse():i)});var iterations=0;var isDone=false;return new Iterator(function(){var steps;if(!isDone){steps=iterators.map(function(i){return i.next()});isDone=steps.some(function(s){return s.done})}if(isDone){return iteratorDone()}return iteratorValue(type,iterations++,zipper.apply(null,steps.map(function(s){return s.value})))})};return zipSequence}function reify(iter,seq){return isSeq(iter)?seq:iter.constructor(seq)}function validateEntry(entry){if(entry!==Object(entry)){throw new TypeError("Expected [K, V] tuple: "+entry)}}function resolveSize(iter){assertNotInfinite(iter.size);return ensureSize(iter)}function iterableClass(iterable){return isKeyed(iterable)?KeyedIterable:isIndexed(iterable)?IndexedIterable:SetIterable}function makeSequence(iterable){return Object.create((isKeyed(iterable)?KeyedSeq:isIndexed(iterable)?IndexedSeq:SetSeq).prototype)}function cacheResultThrough(){if(this._iter.cacheResult){this._iter.cacheResult();this.size=this._iter.size;return this}else{return Seq.prototype.cacheResult.call(this)}}function defaultComparator(a,b){return a>b?1:a=0;ii--){head={value:arguments[ii],next:head}}if(this.__ownerID){this.size=newSize;this._head=head;this.__hash=undefined;this.__altered=true;return this}return makeStack(newSize,head)};Stack.prototype.pushAll=function(iter){iter=IndexedIterable(iter);if(iter.size===0){return this}assertNotInfinite(iter.size);var newSize=this.size;var head=this._head;iter.reverse().forEach(function(value){newSize++;head={value:value,next:head}});if(this.__ownerID){this.size=newSize;this._head=head;this.__hash=undefined;this.__altered=true;return this}return makeStack(newSize,head)};Stack.prototype.pop=function(){return this.slice(1)};Stack.prototype.unshift=function(){return this.push.apply(this,arguments)};Stack.prototype.unshiftAll=function(iter){return this.pushAll(iter)};Stack.prototype.shift=function(){return this.pop.apply(this,arguments)};Stack.prototype.clear=function(){if(this.size===0){return this}if(this.__ownerID){this.size=0;this._head=undefined;this.__hash=undefined;this.__altered=true;return this}return emptyStack()};Stack.prototype.slice=function(begin,end){if(wholeSlice(begin,end,this.size)){return this}var resolvedBegin=resolveBegin(begin,this.size);var resolvedEnd=resolveEnd(end,this.size);if(resolvedEnd!==this.size){return IndexedCollection.prototype.slice.call(this,begin,end)}var newSize=this.size-resolvedBegin;var head=this._head;while(resolvedBegin--){head=head.next}if(this.__ownerID){this.size=newSize;this._head=head;this.__hash=undefined;this.__altered=true;return this}return makeStack(newSize,head)};Stack.prototype.__ensureOwner=function(ownerID){if(ownerID===this.__ownerID){return this}if(!ownerID){this.__ownerID=ownerID;this.__altered=false;return this}return makeStack(this.size,this._head,ownerID,this.__hash)};Stack.prototype.__iterate=function(fn,reverse){if(reverse){return this.reverse().__iterate(fn)}var iterations=0;var node=this._head;while(node){if(fn(node.value,iterations++,this)===false){break}node=node.next}return iterations};Stack.prototype.__iterator=function(type,reverse){if(reverse){return this.reverse().__iterator(type)}var iterations=0;var node=this._head;return new Iterator(function(){if(node){var value=node.value;node=node.next;return iteratorValue(type,iterations++,value)}return iteratorDone()})};function isStack(maybeStack){return!!(maybeStack&&maybeStack[IS_STACK_SENTINEL])}Stack.isStack=isStack;var IS_STACK_SENTINEL="@@__IMMUTABLE_STACK__@@";var StackPrototype=Stack.prototype;StackPrototype[IS_STACK_SENTINEL]=true;StackPrototype.withMutations=MapPrototype.withMutations;StackPrototype.asMutable=MapPrototype.asMutable;StackPrototype.asImmutable=MapPrototype.asImmutable;StackPrototype.wasAltered=MapPrototype.wasAltered;function makeStack(size,head,ownerID,hash){var map=Object.create(StackPrototype);map.size=size;map._head=head;map.__ownerID=ownerID;map.__hash=hash;map.__altered=false;return map}var EMPTY_STACK;function emptyStack(){return EMPTY_STACK||(EMPTY_STACK=makeStack(0))}function mixin(ctor,methods){var keyCopier=function(key){ctor.prototype[key]=methods[key]};Object.keys(methods).forEach(keyCopier);Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(methods).forEach(keyCopier);return ctor}Iterable.Iterator=Iterator;mixin(Iterable,{toArray:function(){assertNotInfinite(this.size);var array=new Array(this.size||0);this.valueSeq().__iterate(function(v,i){array[i]=v});return array},toIndexedSeq:function(){return new ToIndexedSequence(this)},toJS:function(){return this.toSeq().map(function(value){return value&&typeof value.toJS==="function"?value.toJS():value}).__toJS()},toJSON:function(){return this.toSeq().map(function(value){return value&&typeof value.toJSON==="function"?value.toJSON():value}).__toJS()},toKeyedSeq:function(){return new ToKeyedSequence(this,true)},toMap:function(){return Map(this.toKeyedSeq()); },toObject:function(){assertNotInfinite(this.size);var object={};this.__iterate(function(v,k){object[k]=v});return object},toOrderedMap:function(){return OrderedMap(this.toKeyedSeq())},toOrderedSet:function(){return OrderedSet(isKeyed(this)?this.valueSeq():this)},toSet:function(){return Set(isKeyed(this)?this.valueSeq():this)},toSetSeq:function(){return new ToSetSequence(this)},toSeq:function(){return isIndexed(this)?this.toIndexedSeq():isKeyed(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return Stack(isKeyed(this)?this.valueSeq():this)},toList:function(){return List(isKeyed(this)?this.valueSeq():this)},toString:function(){return"[Iterable]"},__toString:function(head,tail){if(this.size===0){return head+tail}return head+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+tail},concat:function(){var values=SLICE$0.call(arguments,0);return reify(this,concatFactory(this,values))},includes:function(searchValue){return this.some(function(value){return is(value,searchValue)})},entries:function(){return this.__iterator(ITERATE_ENTRIES)},every:function(predicate,context){assertNotInfinite(this.size);var returnValue=true;this.__iterate(function(v,k,c){if(!predicate.call(context,v,k,c)){returnValue=false;return false}});return returnValue},filter:function(predicate,context){return reify(this,filterFactory(this,predicate,context,true))},find:function(predicate,context,notSetValue){var entry=this.findEntry(predicate,context);return entry?entry[1]:notSetValue},forEach:function(sideEffect,context){assertNotInfinite(this.size);return this.__iterate(context?sideEffect.bind(context):sideEffect)},join:function(separator){assertNotInfinite(this.size);separator=separator!==undefined?""+separator:",";var joined="";var isFirst=true;this.__iterate(function(v){isFirst?isFirst=false:joined+=separator;joined+=v!==null&&v!==undefined?v.toString():""});return joined},keys:function(){return this.__iterator(ITERATE_KEYS)},map:function(mapper,context){return reify(this,mapFactory(this,mapper,context))},reduce:function(reducer,initialReduction,context){assertNotInfinite(this.size);var reduction;var useFirst;if(arguments.length<2){useFirst=true}else{reduction=initialReduction}this.__iterate(function(v,k,c){if(useFirst){useFirst=false;reduction=v}else{reduction=reducer.call(context,reduction,v,k,c)}});return reduction},reduceRight:function(reducer,initialReduction,context){var reversed=this.toKeyedSeq().reverse();return reversed.reduce.apply(reversed,arguments)},reverse:function(){return reify(this,reverseFactory(this,true))},slice:function(begin,end){return reify(this,sliceFactory(this,begin,end,true))},some:function(predicate,context){return!this.every(not(predicate),context)},sort:function(comparator){return reify(this,sortFactory(this,comparator))},values:function(){return this.__iterator(ITERATE_VALUES)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return this.size!==undefined?this.size===0:!this.some(function(){return true})},count:function(predicate,context){return ensureSize(predicate?this.toSeq().filter(predicate,context):this)},countBy:function(grouper,context){return countByFactory(this,grouper,context)},equals:function(other){return deepEqual(this,other)},entrySeq:function(){var iterable=this;if(iterable._cache){return new ArraySeq(iterable._cache)}var entriesSequence=iterable.toSeq().map(entryMapper).toIndexedSeq();entriesSequence.fromEntrySeq=function(){return iterable.toSeq()};return entriesSequence},filterNot:function(predicate,context){return this.filter(not(predicate),context)},findEntry:function(predicate,context,notSetValue){var found=notSetValue;this.__iterate(function(v,k,c){if(predicate.call(context,v,k,c)){found=[k,v];return false}});return found},findKey:function(predicate,context){var entry=this.findEntry(predicate,context);return entry&&entry[0]},findLast:function(predicate,context,notSetValue){return this.toKeyedSeq().reverse().find(predicate,context,notSetValue)},findLastEntry:function(predicate,context,notSetValue){return this.toKeyedSeq().reverse().findEntry(predicate,context,notSetValue)},findLastKey:function(predicate,context){return this.toKeyedSeq().reverse().findKey(predicate,context)},first:function(){return this.find(returnTrue)},flatMap:function(mapper,context){return reify(this,flatMapFactory(this,mapper,context))},flatten:function(depth){return reify(this,flattenFactory(this,depth,true))},fromEntrySeq:function(){return new FromEntriesSequence(this)},get:function(searchKey,notSetValue){return this.find(function(_,key){return is(key,searchKey)},undefined,notSetValue)},getIn:function(searchKeyPath,notSetValue){var nested=this;var iter=forceIterator(searchKeyPath);var step;while(!(step=iter.next()).done){var key=step.value;nested=nested&&nested.get?nested.get(key,NOT_SET):NOT_SET;if(nested===NOT_SET){return notSetValue}}return nested},groupBy:function(grouper,context){return groupByFactory(this,grouper,context)},has:function(searchKey){return this.get(searchKey,NOT_SET)!==NOT_SET},hasIn:function(searchKeyPath){return this.getIn(searchKeyPath,NOT_SET)!==NOT_SET},isSubset:function(iter){iter=typeof iter.includes==="function"?iter:Iterable(iter);return this.every(function(value){return iter.includes(value)})},isSuperset:function(iter){iter=typeof iter.isSubset==="function"?iter:Iterable(iter);return iter.isSubset(this)},keyOf:function(searchValue){return this.findKey(function(value){return is(value,searchValue)})},keySeq:function(){return this.toSeq().map(keyMapper).toIndexedSeq()},last:function(){return this.toSeq().reverse().first()},lastKeyOf:function(searchValue){return this.toKeyedSeq().reverse().keyOf(searchValue)},max:function(comparator){return maxFactory(this,comparator)},maxBy:function(mapper,comparator){return maxFactory(this,comparator,mapper)},min:function(comparator){return maxFactory(this,comparator?neg(comparator):defaultNegComparator)},minBy:function(mapper,comparator){return maxFactory(this,comparator?neg(comparator):defaultNegComparator,mapper)},rest:function(){return this.slice(1)},skip:function(amount){return this.slice(Math.max(0,amount))},skipLast:function(amount){return reify(this,this.toSeq().reverse().skip(amount).reverse())},skipWhile:function(predicate,context){return reify(this,skipWhileFactory(this,predicate,context,true))},skipUntil:function(predicate,context){return this.skipWhile(not(predicate),context)},sortBy:function(mapper,comparator){return reify(this,sortFactory(this,comparator,mapper))},take:function(amount){return this.slice(0,Math.max(0,amount))},takeLast:function(amount){return reify(this,this.toSeq().reverse().take(amount).reverse())},takeWhile:function(predicate,context){return reify(this,takeWhileFactory(this,predicate,context))},takeUntil:function(predicate,context){return this.takeWhile(not(predicate),context)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=hashIterable(this))}});var IterablePrototype=Iterable.prototype;IterablePrototype[IS_ITERABLE_SENTINEL]=true;IterablePrototype[ITERATOR_SYMBOL]=IterablePrototype.values;IterablePrototype.__toJS=IterablePrototype.toArray;IterablePrototype.__toStringMapper=quoteString;IterablePrototype.inspect=IterablePrototype.toSource=function(){return this.toString()};IterablePrototype.chain=IterablePrototype.flatMap;IterablePrototype.contains=IterablePrototype.includes;mixin(KeyedIterable,{flip:function(){return reify(this,flipFactory(this))},mapEntries:function(mapper,context){var this$0=this;var iterations=0;return reify(this,this.toSeq().map(function(v,k){return mapper.call(context,[k,v],iterations++,this$0)}).fromEntrySeq())},mapKeys:function(mapper,context){var this$0=this;return reify(this,this.toSeq().flip().map(function(k,v){return mapper.call(context,k,v,this$0)}).flip())}});var KeyedIterablePrototype=KeyedIterable.prototype;KeyedIterablePrototype[IS_KEYED_SENTINEL]=true;KeyedIterablePrototype[ITERATOR_SYMBOL]=IterablePrototype.entries;KeyedIterablePrototype.__toJS=IterablePrototype.toObject;KeyedIterablePrototype.__toStringMapper=function(v,k){return JSON.stringify(k)+": "+quoteString(v)};mixin(IndexedIterable,{toKeyedSeq:function(){return new ToKeyedSequence(this,false)},filter:function(predicate,context){return reify(this,filterFactory(this,predicate,context,false))},findIndex:function(predicate,context){var entry=this.findEntry(predicate,context);return entry?entry[0]:-1},indexOf:function(searchValue){var key=this.keyOf(searchValue);return key===undefined?-1:key},lastIndexOf:function(searchValue){var key=this.lastKeyOf(searchValue);return key===undefined?-1:key},reverse:function(){return reify(this,reverseFactory(this,false))},slice:function(begin,end){return reify(this,sliceFactory(this,begin,end,false))},splice:function(index,removeNum){var numArgs=arguments.length;removeNum=Math.max(removeNum|0,0);if(numArgs===0||numArgs===2&&!removeNum){return this}index=resolveBegin(index,index<0?this.count():this.size);var spliced=this.slice(0,index);return reify(this,numArgs===1?spliced:spliced.concat(arrCopy(arguments,2),this.slice(index+removeNum)))},findLastIndex:function(predicate,context){var entry=this.findLastEntry(predicate,context);return entry?entry[0]:-1},first:function(){return this.get(0)},flatten:function(depth){return reify(this,flattenFactory(this,depth,false))},get:function(index,notSetValue){index=wrapIndex(this,index);return index<0||(this.size===Infinity||this.size!==undefined&&index>this.size)?notSetValue:this.find(function(_,key){return key===index},undefined,notSetValue)},has:function(index){index=wrapIndex(this,index);return index>=0&&(this.size!==undefined?this.size===Infinity||indexb?-1:0}function hashIterable(iterable){if(iterable.size===Infinity){return 0}var ordered=isOrdered(iterable);var keyed=isKeyed(iterable);var h=ordered?1:0;var size=iterable.__iterate(keyed?ordered?function(v,k){h=31*h+hashMerge(hash(v),hash(k))|0}:function(v,k){h=h+hashMerge(hash(v),hash(k))|0}:ordered?function(v){h=31*h+hash(v)|0}:function(v){h=h+hash(v)|0});return murmurHashOfSize(size,h)}function murmurHashOfSize(size,h){h=imul(h,3432918353);h=imul(h<<15|h>>>-15,461845907);h=imul(h<<13|h>>>-13,5);h=(h+3864292196|0)^size;h=imul(h^h>>>16,2246822507);h=imul(h^h>>>13,3266489909);h=smi(h^h>>>16);return h}function hashMerge(a,b){return a^b+2654435769+(a<<6)+(a>>2)|0}var Immutable={Iterable:Iterable,Seq:Seq,Collection:Collection,Map:Map,OrderedMap:OrderedMap,List:List,Stack:Stack,Set:Set,OrderedSet:OrderedSet,Record:Record,Range:Range,Repeat:Repeat,is:is,fromJS:fromJS};return Immutable})},{}],180:[function(require,module,exports){if(typeof Object.create==="function"){module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:false,writable:true,configurable:true}})}}else{module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype;ctor.prototype=new TempCtor;ctor.prototype.constructor=ctor}}},{}],181:[function(require,module,exports){module.exports=function(obj){return obj!=null&&(isBuffer(obj)||isSlowBuffer(obj)||!!obj._isBuffer)};function isBuffer(obj){return!!obj.constructor&&typeof obj.constructor.isBuffer==="function"&&obj.constructor.isBuffer(obj)}function isSlowBuffer(obj){return typeof obj.readFloatLE==="function"&&typeof obj.slice==="function"&&isBuffer(obj.slice(0,0))}},{}],182:[function(require,module,exports){module.exports=function isHexPrefixed(str){if(typeof str!=="string"){throw new Error("[is-hex-prefixed] value must be type 'string', is currently type "+typeof str+", while checking isHexPrefixed.")}return str.slice(0,2)==="0x"}},{}],183:[function(require,module,exports){var toString={}.toString;module.exports=Array.isArray||function(arr){return toString.call(arr)=="[object Array]"}},{}],184:[function(require,module,exports){(function(global){(function(root,undefined){"use strict";var NODE_JS=typeof module!="undefined";if(NODE_JS){root=global;if(root.JS_SHA3_TEST){root.navigator={userAgent:"Chrome"}}}var CHROME=(root.JS_SHA3_TEST||!NODE_JS)&&navigator.userAgent.indexOf("Chrome")!=-1;var HEX_CHARS="0123456789abcdef".split("");var KECCAK_PADDING=[1,256,65536,16777216];var PADDING=[6,1536,393216,100663296];var SHIFT=[0,8,16,24];var RC=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648];var blocks=[],s=[];var keccak_224=function(message){return keccak(message,224,KECCAK_PADDING)};var keccak_256=function(message){return keccak(message,256,KECCAK_PADDING)};var keccak_384=function(message){return keccak(message,384,KECCAK_PADDING)};var sha3_224=function(message){return keccak(message,224,PADDING)};var sha3_256=function(message){return keccak(message,256,PADDING)};var sha3_384=function(message){return keccak(message,384,PADDING)};var sha3_512=function(message){return keccak(message,512,PADDING)};var keccak=function(message,bits,padding){var notString=typeof message!="string";if(notString&&message.constructor==root.ArrayBuffer){message=new Uint8Array(message)}if(bits===undefined){bits=512;padding=KECCAK_PADDING}var block,code,end=false,index=0,start=0,length=message.length,n,i,h,l,c0,c1,c2,c3,c4,c5,c6,c7,c8,c9,b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16,b17,b18,b19,b20,b21,b22,b23,b24,b25,b26,b27,b28,b29,b30,b31,b32,b33,b34,b35,b36,b37,b38,b39,b40,b41,b42,b43,b44,b45,b46,b47,b48,b49;var blockCount=(1600-bits*2)/32;var byteCount=blockCount*4;for(i=0;i<50;++i){s[i]=0}block=0;do{blocks[0]=block;for(i=1;i>2]|=message[index]<>2]|=code<>2]|=(192|code>>6)<>2]|=(128|code&63)<=57344){blocks[i>>2]|=(224|code>>12)<>2]|=(128|code>>6&63)<>2]|=(128|code&63)<>2]|=(240|code>>18)<>2]|=(128|code>>12&63)<>2]|=(128|code>>6&63)<>2]|=(128|code&63)<>2]|=padding[i&3];++index}block=blocks[blockCount];if(index>length&&i>>31);l=c9^(c3<<1|c2>>>31);s[0]^=h;s[1]^=l;s[10]^=h;s[11]^=l;s[20]^=h;s[21]^=l;s[30]^=h;s[31]^=l;s[40]^=h;s[41]^=l;h=c0^(c4<<1|c5>>>31);l=c1^(c5<<1|c4>>>31);s[2]^=h;s[3]^=l;s[12]^=h;s[13]^=l;s[22]^=h;s[23]^=l;s[32]^=h;s[33]^=l;s[42]^=h;s[43]^=l;h=c2^(c6<<1|c7>>>31);l=c3^(c7<<1|c6>>>31);s[4]^=h;s[5]^=l;s[14]^=h;s[15]^=l;s[24]^=h;s[25]^=l;s[34]^=h;s[35]^=l;s[44]^=h;s[45]^=l;h=c4^(c8<<1|c9>>>31);l=c5^(c9<<1|c8>>>31);s[6]^=h;s[7]^=l;s[16]^=h;s[17]^=l;s[26]^=h;s[27]^=l;s[36]^=h;s[37]^=l;s[46]^=h;s[47]^=l;h=c6^(c0<<1|c1>>>31);l=c7^(c1<<1|c0>>>31);s[8]^=h;s[9]^=l;s[18]^=h;s[19]^=l;s[28]^=h;s[29]^=l;s[38]^=h;s[39]^=l;s[48]^=h;s[49]^=l;b0=s[0];b1=s[1];b32=s[11]<<4|s[10]>>>28;b33=s[10]<<4|s[11]>>>28;b14=s[20]<<3|s[21]>>>29;b15=s[21]<<3|s[20]>>>29;b46=s[31]<<9|s[30]>>>23;b47=s[30]<<9|s[31]>>>23;b28=s[40]<<18|s[41]>>>14;b29=s[41]<<18|s[40]>>>14;b20=s[2]<<1|s[3]>>>31;b21=s[3]<<1|s[2]>>>31;b2=s[13]<<12|s[12]>>>20;b3=s[12]<<12|s[13]>>>20;b34=s[22]<<10|s[23]>>>22;b35=s[23]<<10|s[22]>>>22;b16=s[33]<<13|s[32]>>>19;b17=s[32]<<13|s[33]>>>19;b48=s[42]<<2|s[43]>>>30;b49=s[43]<<2|s[42]>>>30;b40=s[5]<<30|s[4]>>>2;b41=s[4]<<30|s[5]>>>2;b22=s[14]<<6|s[15]>>>26;b23=s[15]<<6|s[14]>>>26;b4=s[25]<<11|s[24]>>>21;b5=s[24]<<11|s[25]>>>21;b36=s[34]<<15|s[35]>>>17;b37=s[35]<<15|s[34]>>>17;b18=s[45]<<29|s[44]>>>3;b19=s[44]<<29|s[45]>>>3;b10=s[6]<<28|s[7]>>>4;b11=s[7]<<28|s[6]>>>4;b42=s[17]<<23|s[16]>>>9;b43=s[16]<<23|s[17]>>>9;b24=s[26]<<25|s[27]>>>7;b25=s[27]<<25|s[26]>>>7;b6=s[36]<<21|s[37]>>>11;b7=s[37]<<21|s[36]>>>11;b38=s[47]<<24|s[46]>>>8;b39=s[46]<<24|s[47]>>>8;b30=s[8]<<27|s[9]>>>5;b31=s[9]<<27|s[8]>>>5;b12=s[18]<<20|s[19]>>>12;b13=s[19]<<20|s[18]>>>12;b44=s[29]<<7|s[28]>>>25;b45=s[28]<<7|s[29]>>>25;b26=s[38]<<8|s[39]>>>24;b27=s[39]<<8|s[38]>>>24;b8=s[48]<<14|s[49]>>>18;b9=s[49]<<14|s[48]>>>18;s[0]=b0^~b2&b4;s[1]=b1^~b3&b5;s[10]=b10^~b12&b14;s[11]=b11^~b13&b15;s[20]=b20^~b22&b24;s[21]=b21^~b23&b25;s[30]=b30^~b32&b34;s[31]=b31^~b33&b35;s[40]=b40^~b42&b44;s[41]=b41^~b43&b45;s[2]=b2^~b4&b6;s[3]=b3^~b5&b7;s[12]=b12^~b14&b16;s[13]=b13^~b15&b17;s[22]=b22^~b24&b26;s[23]=b23^~b25&b27;s[32]=b32^~b34&b36;s[33]=b33^~b35&b37;s[42]=b42^~b44&b46;s[43]=b43^~b45&b47;s[4]=b4^~b6&b8;s[5]=b5^~b7&b9;s[14]=b14^~b16&b18;s[15]=b15^~b17&b19;s[24]=b24^~b26&b28;s[25]=b25^~b27&b29;s[34]=b34^~b36&b38;s[35]=b35^~b37&b39;s[44]=b44^~b46&b48;s[45]=b45^~b47&b49;s[6]=b6^~b8&b0;s[7]=b7^~b9&b1;s[16]=b16^~b18&b10;s[17]=b17^~b19&b11;s[26]=b26^~b28&b20;s[27]=b27^~b29&b21;s[36]=b36^~b38&b30;s[37]=b37^~b39&b31;s[46]=b46^~b48&b40;s[47]=b47^~b49&b41;s[8]=b8^~b0&b2;s[9]=b9^~b1&b3;s[18]=b18^~b10&b12;s[19]=b19^~b11&b13;s[28]=b28^~b20&b22;s[29]=b29^~b21&b23;s[38]=b38^~b30&b32;s[39]=b39^~b31&b33;s[48]=b48^~b40&b42;s[49]=b49^~b41&b43;s[0]^=RC[n];s[1]^=RC[n+1]}}while(!end);var hex="";if(CHROME){b0=s[0];b1=s[1];b2=s[2];b3=s[3];b4=s[4];b5=s[5];b6=s[6];b7=s[7];b8=s[8];b9=s[9];b10=s[10];b11=s[11];b12=s[12];b13=s[13];b14=s[14];b15=s[15];hex+=HEX_CHARS[b0>>4&15]+HEX_CHARS[b0&15]+HEX_CHARS[b0>>12&15]+HEX_CHARS[b0>>8&15]+HEX_CHARS[b0>>20&15]+HEX_CHARS[b0>>16&15]+HEX_CHARS[b0>>28&15]+HEX_CHARS[b0>>24&15]+HEX_CHARS[b1>>4&15]+HEX_CHARS[b1&15]+HEX_CHARS[b1>>12&15]+HEX_CHARS[b1>>8&15]+HEX_CHARS[b1>>20&15]+HEX_CHARS[b1>>16&15]+HEX_CHARS[b1>>28&15]+HEX_CHARS[b1>>24&15]+HEX_CHARS[b2>>4&15]+HEX_CHARS[b2&15]+HEX_CHARS[b2>>12&15]+HEX_CHARS[b2>>8&15]+HEX_CHARS[b2>>20&15]+HEX_CHARS[b2>>16&15]+HEX_CHARS[b2>>28&15]+HEX_CHARS[b2>>24&15]+HEX_CHARS[b3>>4&15]+HEX_CHARS[b3&15]+HEX_CHARS[b3>>12&15]+HEX_CHARS[b3>>8&15]+HEX_CHARS[b3>>20&15]+HEX_CHARS[b3>>16&15]+HEX_CHARS[b3>>28&15]+HEX_CHARS[b3>>24&15]+HEX_CHARS[b4>>4&15]+HEX_CHARS[b4&15]+HEX_CHARS[b4>>12&15]+HEX_CHARS[b4>>8&15]+HEX_CHARS[b4>>20&15]+HEX_CHARS[b4>>16&15]+HEX_CHARS[b4>>28&15]+HEX_CHARS[b4>>24&15]+HEX_CHARS[b5>>4&15]+HEX_CHARS[b5&15]+HEX_CHARS[b5>>12&15]+HEX_CHARS[b5>>8&15]+HEX_CHARS[b5>>20&15]+HEX_CHARS[b5>>16&15]+HEX_CHARS[b5>>28&15]+HEX_CHARS[b5>>24&15]+HEX_CHARS[b6>>4&15]+HEX_CHARS[b6&15]+HEX_CHARS[b6>>12&15]+HEX_CHARS[b6>>8&15]+HEX_CHARS[b6>>20&15]+HEX_CHARS[b6>>16&15]+HEX_CHARS[b6>>28&15]+HEX_CHARS[b6>>24&15];if(bits>=256){hex+=HEX_CHARS[b7>>4&15]+HEX_CHARS[b7&15]+HEX_CHARS[b7>>12&15]+HEX_CHARS[b7>>8&15]+HEX_CHARS[b7>>20&15]+HEX_CHARS[b7>>16&15]+HEX_CHARS[b7>>28&15]+HEX_CHARS[b7>>24&15]}if(bits>=384){hex+=HEX_CHARS[b8>>4&15]+HEX_CHARS[b8&15]+HEX_CHARS[b8>>12&15]+HEX_CHARS[b8>>8&15]+HEX_CHARS[b8>>20&15]+HEX_CHARS[b8>>16&15]+HEX_CHARS[b8>>28&15]+HEX_CHARS[b8>>24&15]+HEX_CHARS[b9>>4&15]+HEX_CHARS[b9&15]+HEX_CHARS[b9>>12&15]+HEX_CHARS[b9>>8&15]+HEX_CHARS[b9>>20&15]+HEX_CHARS[b9>>16&15]+HEX_CHARS[b9>>28&15]+HEX_CHARS[b9>>24&15]+HEX_CHARS[b10>>4&15]+HEX_CHARS[b10&15]+HEX_CHARS[b10>>12&15]+HEX_CHARS[b10>>8&15]+HEX_CHARS[b10>>20&15]+HEX_CHARS[b10>>16&15]+HEX_CHARS[b10>>28&15]+HEX_CHARS[b10>>24&15]+HEX_CHARS[b11>>4&15]+HEX_CHARS[b11&15]+HEX_CHARS[b11>>12&15]+HEX_CHARS[b11>>8&15]+HEX_CHARS[b11>>20&15]+HEX_CHARS[b11>>16&15]+HEX_CHARS[b11>>28&15]+HEX_CHARS[b11>>24&15]}if(bits==512){hex+=HEX_CHARS[b12>>4&15]+HEX_CHARS[b12&15]+HEX_CHARS[b12>>12&15]+HEX_CHARS[b12>>8&15]+HEX_CHARS[b12>>20&15]+HEX_CHARS[b12>>16&15]+HEX_CHARS[b12>>28&15]+HEX_CHARS[b12>>24&15]+HEX_CHARS[b13>>4&15]+HEX_CHARS[b13&15]+HEX_CHARS[b13>>12&15]+HEX_CHARS[b13>>8&15]+HEX_CHARS[b13>>20&15]+HEX_CHARS[b13>>16&15]+HEX_CHARS[b13>>28&15]+HEX_CHARS[b13>>24&15]+HEX_CHARS[b14>>4&15]+HEX_CHARS[b14&15]+HEX_CHARS[b14>>12&15]+HEX_CHARS[b14>>8&15]+HEX_CHARS[b14>>20&15]+HEX_CHARS[b14>>16&15]+HEX_CHARS[b14>>28&15]+HEX_CHARS[b14>>24&15]+HEX_CHARS[b15>>4&15]+HEX_CHARS[b15&15]+HEX_CHARS[b15>>12&15]+HEX_CHARS[b15>>8&15]+HEX_CHARS[b15>>20&15]+HEX_CHARS[b15>>16&15]+HEX_CHARS[b15>>28&15]+HEX_CHARS[b15>>24&15]}}else{for(i=0,n=bits/32;i>4&15]+HEX_CHARS[h&15]+HEX_CHARS[h>>12&15]+HEX_CHARS[h>>8&15]+HEX_CHARS[h>>20&15]+HEX_CHARS[h>>16&15]+HEX_CHARS[h>>28&15]+HEX_CHARS[h>>24&15]}}return hex};if(!root.JS_SHA3_TEST&&NODE_JS){module.exports={sha3_512:sha3_512,sha3_384:sha3_384,sha3_256:sha3_256,sha3_224:sha3_224,keccak_512:keccak,keccak_384:keccak_384,keccak_256:keccak_256,keccak_224:keccak_224}}else if(root){root.sha3_512=sha3_512;root.sha3_384=sha3_384;root.sha3_256=sha3_256;root.sha3_224=sha3_224;root.keccak_512=keccak;root.keccak_384=keccak_384;root.keccak_256=keccak_256;root.keccak_224=keccak_224}})(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],185:[function(require,module,exports){"use strict";module.exports=require("./lib/api")(require("./lib/keccak"))},{"./lib/api":186,"./lib/keccak":190}],186:[function(require,module,exports){"use strict";var createKeccak=require("./keccak");var createShake=require("./shake");module.exports=function(KeccakState){var Keccak=createKeccak(KeccakState);var Shake=createShake(KeccakState);return function(algorithm,options){var hash=typeof algorithm==="string"?algorithm.toLowerCase():algorithm;switch(hash){case"keccak224":return new Keccak(1152,448,null,224,options);case"keccak256":return new Keccak(1088,512,null,256,options);case"keccak384":return new Keccak(832,768,null,384,options);case"keccak512":return new Keccak(576,1024,null,512,options);case"sha3-224":return new Keccak(1152,448,6,224,options);case"sha3-256":return new Keccak(1088,512,6,256,options);case"sha3-384":return new Keccak(832,768,6,384,options);case"sha3-512":return new Keccak(576,1024,6,512,options);case"shake128":return new Shake(1344,256,31,options);case"shake256":return new Shake(1088,512,31,options);default:throw new Error("Invald algorithm: "+algorithm)}}}},{"./keccak":187,"./shake":188}],187:[function(require,module,exports){(function(Buffer){"use strict";var Transform=require("stream").Transform;var inherits=require("inherits");module.exports=function(KeccakState){function Keccak(rate,capacity,delimitedSuffix,hashBitLength,options){Transform.call(this,options);this._rate=rate;this._capacity=capacity;this._delimitedSuffix=delimitedSuffix;this._hashBitLength=hashBitLength;this._options=options;this._state=new KeccakState;this._state.initialize(rate,capacity);this._finalized=false}inherits(Keccak,Transform);Keccak.prototype._transform=function(chunk,encoding,callback){var error=null;try{this.update(chunk,encoding)}catch(err){error=err}callback(error)};Keccak.prototype._flush=function(callback){var error=null;try{this.push(this.digest())}catch(err){error=err}callback(error)};Keccak.prototype.update=function(data,encoding){if(!Buffer.isBuffer(data)&&typeof data!=="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");if(!Buffer.isBuffer(data))data=new Buffer(data,encoding);this._state.absorb(data);return this};Keccak.prototype.digest=function(encoding){if(this._finalized)throw new Error("Digest already called");this._finalized=true;if(this._delimitedSuffix)this._state.absorbLastFewBits(this._delimitedSuffix);var digest=this._state.squeeze(this._hashBitLength/8);if(encoding!==undefined)digest=digest.toString(encoding);this._resetState();return digest};Keccak.prototype._resetState=function(){this._state.initialize(this._rate,this._capacity);return this};Keccak.prototype._clone=function(){var clone=new Keccak(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);this._state.copy(clone._state);clone._finalized=this._finalized;return clone};return Keccak}}).call(this,require("buffer").Buffer)},{buffer:14,inherits:180,stream:284}],188:[function(require,module,exports){(function(Buffer){"use strict";var Transform=require("stream").Transform;var inherits=require("inherits");module.exports=function(KeccakState){function Shake(rate,capacity,delimitedSuffix,options){Transform.call(this,options);this._rate=rate;this._capacity=capacity;this._delimitedSuffix=delimitedSuffix;this._options=options;this._state=new KeccakState;this._state.initialize(rate,capacity);this._finalized=false}inherits(Shake,Transform);Shake.prototype._transform=function(chunk,encoding,callback){var error=null;try{this.update(chunk,encoding)}catch(err){error=err}callback(error)};Shake.prototype._flush=function(){};Shake.prototype._read=function(size){this.push(this.squeeze(size))};Shake.prototype.update=function(data,encoding){if(!Buffer.isBuffer(data)&&typeof data!=="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");if(!Buffer.isBuffer(data))data=new Buffer(data,encoding);this._state.absorb(data);return this};Shake.prototype.squeeze=function(dataByteLength,encoding){if(!this._finalized){this._finalized=true;this._state.absorbLastFewBits(this._delimitedSuffix)}var data=this._state.squeeze(dataByteLength);if(encoding!==undefined)data=data.toString(encoding);return data};Shake.prototype._resetState=function(){this._state.initialize(this._rate,this._capacity);return this};Shake.prototype._clone=function(){var clone=new Shake(this._rate,this._capacity,this._delimitedSuffix,this._options);this._state.copy(clone._state);clone._finalized=this._finalized;return clone};return Shake}}).call(this,require("buffer").Buffer)},{buffer:14,inherits:180,stream:284}],189:[function(require,module,exports){"use strict";var P1600_ROUND_CONSTANTS=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648];exports.p1600=function(s){for(var round=0;round<24;++round){var lo0=s[0]^s[10]^s[20]^s[30]^s[40];var hi0=s[1]^s[11]^s[21]^s[31]^s[41];var lo1=s[2]^s[12]^s[22]^s[32]^s[42];var hi1=s[3]^s[13]^s[23]^s[33]^s[43];var lo2=s[4]^s[14]^s[24]^s[34]^s[44];var hi2=s[5]^s[15]^s[25]^s[35]^s[45];var lo3=s[6]^s[16]^s[26]^s[36]^s[46];var hi3=s[7]^s[17]^s[27]^s[37]^s[47];var lo4=s[8]^s[18]^s[28]^s[38]^s[48];var hi4=s[9]^s[19]^s[29]^s[39]^s[49];var lo=lo4^(lo1<<1|hi1>>>31);var hi=hi4^(hi1<<1|lo1>>>31);var t1slo0=s[0]^lo;var t1shi0=s[1]^hi;var t1slo5=s[10]^lo;var t1shi5=s[11]^hi;var t1slo10=s[20]^lo;var t1shi10=s[21]^hi;var t1slo15=s[30]^lo;var t1shi15=s[31]^hi;var t1slo20=s[40]^lo;var t1shi20=s[41]^hi;lo=lo0^(lo2<<1|hi2>>>31);hi=hi0^(hi2<<1|lo2>>>31);var t1slo1=s[2]^lo;var t1shi1=s[3]^hi;var t1slo6=s[12]^lo;var t1shi6=s[13]^hi;var t1slo11=s[22]^lo;var t1shi11=s[23]^hi;var t1slo16=s[32]^lo;var t1shi16=s[33]^hi;var t1slo21=s[42]^lo;var t1shi21=s[43]^hi;lo=lo1^(lo3<<1|hi3>>>31);hi=hi1^(hi3<<1|lo3>>>31);var t1slo2=s[4]^lo;var t1shi2=s[5]^hi;var t1slo7=s[14]^lo;var t1shi7=s[15]^hi;var t1slo12=s[24]^lo;var t1shi12=s[25]^hi;var t1slo17=s[34]^lo;var t1shi17=s[35]^hi;var t1slo22=s[44]^lo;var t1shi22=s[45]^hi;lo=lo2^(lo4<<1|hi4>>>31);hi=hi2^(hi4<<1|lo4>>>31);var t1slo3=s[6]^lo;var t1shi3=s[7]^hi;var t1slo8=s[16]^lo;var t1shi8=s[17]^hi;var t1slo13=s[26]^lo;var t1shi13=s[27]^hi;var t1slo18=s[36]^lo;var t1shi18=s[37]^hi;var t1slo23=s[46]^lo;var t1shi23=s[47]^hi;lo=lo3^(lo0<<1|hi0>>>31);hi=hi3^(hi0<<1|lo0>>>31);var t1slo4=s[8]^lo;var t1shi4=s[9]^hi;var t1slo9=s[18]^lo;var t1shi9=s[19]^hi;var t1slo14=s[28]^lo;var t1shi14=s[29]^hi;var t1slo19=s[38]^lo;var t1shi19=s[39]^hi;var t1slo24=s[48]^lo;var t1shi24=s[49]^hi;var t2slo0=t1slo0;var t2shi0=t1shi0;var t2slo16=t1shi5<<4|t1slo5>>>28;var t2shi16=t1slo5<<4|t1shi5>>>28;var t2slo7=t1slo10<<3|t1shi10>>>29;var t2shi7=t1shi10<<3|t1slo10>>>29;var t2slo23=t1shi15<<9|t1slo15>>>23;var t2shi23=t1slo15<<9|t1shi15>>>23;var t2slo14=t1slo20<<18|t1shi20>>>14;var t2shi14=t1shi20<<18|t1slo20>>>14;var t2slo10=t1slo1<<1|t1shi1>>>31;var t2shi10=t1shi1<<1|t1slo1>>>31;var t2slo1=t1shi6<<12|t1slo6>>>20;var t2shi1=t1slo6<<12|t1shi6>>>20;var t2slo17=t1slo11<<10|t1shi11>>>22;var t2shi17=t1shi11<<10|t1slo11>>>22;var t2slo8=t1shi16<<13|t1slo16>>>19;var t2shi8=t1slo16<<13|t1shi16>>>19;var t2slo24=t1slo21<<2|t1shi21>>>30;var t2shi24=t1shi21<<2|t1slo21>>>30;var t2slo20=t1shi2<<30|t1slo2>>>2;var t2shi20=t1slo2<<30|t1shi2>>>2;var t2slo11=t1slo7<<6|t1shi7>>>26;var t2shi11=t1shi7<<6|t1slo7>>>26;var t2slo2=t1shi12<<11|t1slo12>>>21;var t2shi2=t1slo12<<11|t1shi12>>>21;var t2slo18=t1slo17<<15|t1shi17>>>17;var t2shi18=t1shi17<<15|t1slo17>>>17;var t2slo9=t1shi22<<29|t1slo22>>>3;var t2shi9=t1slo22<<29|t1shi22>>>3;var t2slo5=t1slo3<<28|t1shi3>>>4;var t2shi5=t1shi3<<28|t1slo3>>>4;var t2slo21=t1shi8<<23|t1slo8>>>9;var t2shi21=t1slo8<<23|t1shi8>>>9;var t2slo12=t1slo13<<25|t1shi13>>>7;var t2shi12=t1shi13<<25|t1slo13>>>7;var t2slo3=t1slo18<<21|t1shi18>>>11;var t2shi3=t1shi18<<21|t1slo18>>>11;var t2slo19=t1shi23<<24|t1slo23>>>8;var t2shi19=t1slo23<<24|t1shi23>>>8;var t2slo15=t1slo4<<27|t1shi4>>>5;var t2shi15=t1shi4<<27|t1slo4>>>5;var t2slo6=t1slo9<<20|t1shi9>>>12;var t2shi6=t1shi9<<20|t1slo9>>>12;var t2slo22=t1shi14<<7|t1slo14>>>25;var t2shi22=t1slo14<<7|t1shi14>>>25;var t2slo13=t1slo19<<8|t1shi19>>>24;var t2shi13=t1shi19<<8|t1slo19>>>24;var t2slo4=t1slo24<<14|t1shi24>>>18; var t2shi4=t1shi24<<14|t1slo24>>>18;s[0]=t2slo0^~t2slo1&t2slo2;s[1]=t2shi0^~t2shi1&t2shi2;s[10]=t2slo5^~t2slo6&t2slo7;s[11]=t2shi5^~t2shi6&t2shi7;s[20]=t2slo10^~t2slo11&t2slo12;s[21]=t2shi10^~t2shi11&t2shi12;s[30]=t2slo15^~t2slo16&t2slo17;s[31]=t2shi15^~t2shi16&t2shi17;s[40]=t2slo20^~t2slo21&t2slo22;s[41]=t2shi20^~t2shi21&t2shi22;s[2]=t2slo1^~t2slo2&t2slo3;s[3]=t2shi1^~t2shi2&t2shi3;s[12]=t2slo6^~t2slo7&t2slo8;s[13]=t2shi6^~t2shi7&t2shi8;s[22]=t2slo11^~t2slo12&t2slo13;s[23]=t2shi11^~t2shi12&t2shi13;s[32]=t2slo16^~t2slo17&t2slo18;s[33]=t2shi16^~t2shi17&t2shi18;s[42]=t2slo21^~t2slo22&t2slo23;s[43]=t2shi21^~t2shi22&t2shi23;s[4]=t2slo2^~t2slo3&t2slo4;s[5]=t2shi2^~t2shi3&t2shi4;s[14]=t2slo7^~t2slo8&t2slo9;s[15]=t2shi7^~t2shi8&t2shi9;s[24]=t2slo12^~t2slo13&t2slo14;s[25]=t2shi12^~t2shi13&t2shi14;s[34]=t2slo17^~t2slo18&t2slo19;s[35]=t2shi17^~t2shi18&t2shi19;s[44]=t2slo22^~t2slo23&t2slo24;s[45]=t2shi22^~t2shi23&t2shi24;s[6]=t2slo3^~t2slo4&t2slo0;s[7]=t2shi3^~t2shi4&t2shi0;s[16]=t2slo8^~t2slo9&t2slo5;s[17]=t2shi8^~t2shi9&t2shi5;s[26]=t2slo13^~t2slo14&t2slo10;s[27]=t2shi13^~t2shi14&t2shi10;s[36]=t2slo18^~t2slo19&t2slo15;s[37]=t2shi18^~t2shi19&t2shi15;s[46]=t2slo23^~t2slo24&t2slo20;s[47]=t2shi23^~t2shi24&t2shi20;s[8]=t2slo4^~t2slo0&t2slo1;s[9]=t2shi4^~t2shi0&t2shi1;s[18]=t2slo9^~t2slo5&t2slo6;s[19]=t2shi9^~t2shi5&t2shi6;s[28]=t2slo14^~t2slo10&t2slo11;s[29]=t2shi14^~t2shi10&t2shi11;s[38]=t2slo19^~t2slo15&t2slo16;s[39]=t2shi19^~t2shi15&t2shi16;s[48]=t2slo24^~t2slo20&t2slo21;s[49]=t2shi24^~t2shi20&t2shi21;s[0]^=P1600_ROUND_CONSTANTS[round*2];s[1]^=P1600_ROUND_CONSTANTS[round*2+1]}}},{}],190:[function(require,module,exports){(function(Buffer){"use strict";var keccakState=require("./keccak-state-unroll");function Keccak(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.blockSize=null;this.count=0;this.squeezing=false}Keccak.prototype.initialize=function(rate,capacity){for(var i=0;i<50;++i)this.state[i]=0;this.blockSize=rate/8;this.count=0;this.squeezing=false};Keccak.prototype.absorb=function(data){for(var i=0;i>>8*(this.count%4)&255;this.count+=1;if(this.count===this.blockSize){keccakState.p1600(this.state);this.count=0}}return output};Keccak.prototype.copy=function(dest){for(var i=0;i<50;++i)dest.state[i]=this.state[i];dest.blockSize=this.blockSize;dest.count=this.count;dest.squeezing=this.squeezing};module.exports=Keccak}).call(this,require("buffer").Buffer)},{"./keccak-state-unroll":189,buffer:14}],191:[function(require,module,exports){module.exports=require("browserify-sha3").SHA3Hash},{"browserify-sha3":11}],192:[function(require,module,exports){var MAX_SAFE_INTEGER=9007199254740991;var argsTag="[object Arguments]",funcTag="[object Function]",genTag="[object GeneratorFunction]";var reIsUint=/^(?:0|[1-9]\d*)$/;function apply(func,thisArg,args){switch(args.length){case 0:return func.call(thisArg);case 1:return func.call(thisArg,args[0]);case 2:return func.call(thisArg,args[0],args[1]);case 3:return func.call(thisArg,args[0],args[1],args[2])}return func.apply(thisArg,args)}function baseTimes(n,iteratee){var index=-1,result=Array(n);while(++index1?sources[length-1]:undefined,guard=length>2?sources[2]:undefined;customizer=assigner.length>3&&typeof customizer=="function"?(length--,customizer):undefined;if(guard&&isIterateeCall(sources[0],sources[1],guard)){customizer=length<3?undefined:customizer;length=1}object=Object(object);while(++index-1&&value%1==0&&value-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function isObject(value){var type=typeof value;return!!value&&(type=="object"||type=="function")}function isObjectLike(value){return!!value&&typeof value=="object"}var assign=createAssigner(function(object,source){if(nonEnumShadows||isPrototype(source)||isArrayLike(source)){copyObject(source,keys(source),object);return}for(var key in source){if(hasOwnProperty.call(source,key)){assignValue(object,key,source[key])}}});function keys(object){return isArrayLike(object)?arrayLikeKeys(object):baseKeys(object)}module.exports=assign},{}],193:[function(require,module,exports){(function(global){var FUNC_ERROR_TEXT="Expected a function";var HASH_UNDEFINED="__lodash_hash_undefined__";var INFINITY=1/0;var funcTag="[object Function]",genTag="[object GeneratorFunction]",symbolTag="[object Symbol]";var reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/,reLeadingDot=/^\./,rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;var reRegExpChar=/[\\^$.*+?()[\]{}|]/g;var reEscapeChar=/\\(\\)?/g;var reIsHostCtor=/^\[object .+?Constructor\]$/;var freeGlobal=typeof global=="object"&&global&&global.Object===Object&&global;var freeSelf=typeof self=="object"&&self&&self.Object===Object&&self;var root=freeGlobal||freeSelf||Function("return this")();function getValue(object,key){return object==null?undefined:object[key]}function isHostObject(value){var result=false;if(value!=null&&typeof value.toString!="function"){try{result=!!(value+"")}catch(e){}}return result}var arrayProto=Array.prototype,funcProto=Function.prototype,objectProto=Object.prototype;var coreJsData=root["__core-js_shared__"];var maskSrcKey=function(){var uid=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return uid?"Symbol(src)_1."+uid:""}();var funcToString=funcProto.toString;var hasOwnProperty=objectProto.hasOwnProperty;var objectToString=objectProto.toString;var reIsNative=RegExp("^"+funcToString.call(hasOwnProperty).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Symbol=root.Symbol,splice=arrayProto.splice;var Map=getNative(root,"Map"),nativeCreate=getNative(Object,"create");var symbolProto=Symbol?Symbol.prototype:undefined,symbolToString=symbolProto?symbolProto.toString:undefined;function Hash(entries){var index=-1,length=entries?entries.length:0;this.clear();while(++index-1}function listCacheSet(key,value){var data=this.__data__,index=assocIndexOf(data,key);if(index<0){data.push([key,value])}else{data[index][1]=value}return this}ListCache.prototype.clear=listCacheClear;ListCache.prototype["delete"]=listCacheDelete;ListCache.prototype.get=listCacheGet;ListCache.prototype.has=listCacheHas;ListCache.prototype.set=listCacheSet;function MapCache(entries){var index=-1,length=entries?entries.length:0;this.clear();while(++index-1}function listCacheSet(key,value){var data=this.__data__,index=assocIndexOf(data,key);if(index<0){data.push([key,value])}else{data[index][1]=value}return this}ListCache.prototype.clear=listCacheClear;ListCache.prototype["delete"]=listCacheDelete;ListCache.prototype.get=listCacheGet;ListCache.prototype.has=listCacheHas;ListCache.prototype.set=listCacheSet;function MapCache(entries){var index=-1,length=entries?entries.length:0;this.clear();while(++index-1&&value%1==0&&value-1}function listCacheSet(key,value){var data=this.__data__,index=assocIndexOf(data,key);if(index<0){data.push([key,value])}else{data[index][1]=value}return this}ListCache.prototype.clear=listCacheClear;ListCache.prototype["delete"]=listCacheDelete;ListCache.prototype.get=listCacheGet;ListCache.prototype.has=listCacheHas;ListCache.prototype.set=listCacheSet;function MapCache(entries){var index=-1,length=entries?entries.length:0;this.clear();while(++indexlength?0:length+start}end=end>length?length:end;if(end<0){end+=length}length=start>end?0:end-start>>>0;start>>>=0;var result=Array(length);while(++index>8;var lo=c&255;if(hi)res.push(hi,lo);else res.push(lo)}}return res}utils.toArray=toArray;function zero2(word){if(word.length===1)return"0"+word;else return word}utils.zero2=zero2;function toHex(msg){var res="";for(var i=0;iMAX_BUFFER_LENGTH){emitError("Max buffer length exceeded: textNode");maxActual=Math.max(maxActual,textNode.length)}if(numberNode.length>MAX_BUFFER_LENGTH){emitError("Max buffer length exceeded: numberNode");maxActual=Math.max(maxActual,numberNode.length)}bufferCheckPosition=MAX_BUFFER_LENGTH-maxActual+position}eventBus(STREAM_DATA).on(handleData);eventBus(STREAM_END).on(handleStreamEnd);function emitError(errorString){if(textNode!==undefined){emitValueOpen(textNode);emitValueClose();textNode=undefined}latestError=Error(errorString+"\nLn: "+line+"\nCol: "+column+"\nChr: "+c);emitFail(errorReport(undefined,undefined,latestError))}function handleStreamEnd(){if(state==BEGIN){emitValueOpen({});emitValueClose();closed=true;return}if(state!==VALUE||depth!==0)emitError("Unexpected end");if(textNode!==undefined){emitValueOpen(textNode);emitValueClose();textNode=undefined}closed=true}function whitespace(c){return c=="\r"||c=="\n"||c==" "||c==" "}function handleData(chunk){if(latestError)return;if(closed){return emitError("Cannot write after close")}var i=0;c=chunk[0];while(c){p=c;c=chunk[i++];if(!c)break;position++;if(c=="\n"){line++;column=0}else column++;switch(state){case BEGIN:if(c==="{")state=OPEN_OBJECT;else if(c==="[")state=OPEN_ARRAY;else if(!whitespace(c))return emitError("Non-whitespace before {[.");continue;case OPEN_KEY:case OPEN_OBJECT:if(whitespace(c))continue;if(state===OPEN_KEY)stack.push(CLOSE_KEY);else{if(c==="}"){emitValueOpen({});emitValueClose();state=stack.pop()||VALUE;continue}else stack.push(CLOSE_OBJECT)}if(c==='"')state=STRING;else return emitError('Malformed object key should start with " ');continue;case CLOSE_KEY:case CLOSE_OBJECT:if(whitespace(c))continue;if(c===":"){if(state===CLOSE_OBJECT){stack.push(CLOSE_OBJECT);if(textNode!==undefined){emitValueOpen({});emitSaxKey(textNode);textNode=undefined}depth++}else{if(textNode!==undefined){emitSaxKey(textNode);textNode=undefined}}state=VALUE}else if(c==="}"){if(textNode!==undefined){emitValueOpen(textNode);emitValueClose();textNode=undefined}emitValueClose();depth--;state=stack.pop()||VALUE}else if(c===","){if(state===CLOSE_OBJECT)stack.push(CLOSE_OBJECT);if(textNode!==undefined){emitValueOpen(textNode);emitValueClose();textNode=undefined}state=OPEN_KEY}else return emitError("Bad object");continue;case OPEN_ARRAY:case VALUE:if(whitespace(c))continue;if(state===OPEN_ARRAY){emitValueOpen([]);depth++;state=VALUE;if(c==="]"){emitValueClose();depth--;state=stack.pop()||VALUE;continue}else{stack.push(CLOSE_ARRAY)}}if(c==='"')state=STRING;else if(c==="{")state=OPEN_OBJECT;else if(c==="[")state=OPEN_ARRAY;else if(c==="t")state=TRUE;else if(c==="f")state=FALSE;else if(c==="n")state=NULL;else if(c==="-"){numberNode+=c}else if(c==="0"){numberNode+=c;state=NUMBER_DIGIT}else if("123456789".indexOf(c)!==-1){numberNode+=c;state=NUMBER_DIGIT}else return emitError("Bad value");continue;case CLOSE_ARRAY:if(c===","){stack.push(CLOSE_ARRAY);if(textNode!==undefined){emitValueOpen(textNode);emitValueClose();textNode=undefined}state=VALUE}else if(c==="]"){if(textNode!==undefined){emitValueOpen(textNode);emitValueClose();textNode=undefined}emitValueClose();depth--;state=stack.pop()||VALUE}else if(whitespace(c))continue;else return emitError("Bad array");continue;case STRING:if(textNode===undefined){textNode=""}var starti=i-1;STRING_BIGLOOP:while(true){while(unicodeI>0){unicodeS+=c;c=chunk.charAt(i++);if(unicodeI===4){textNode+=String.fromCharCode(parseInt(unicodeS,16));unicodeI=0;starti=i-1}else{unicodeI++}if(!c)break STRING_BIGLOOP}if(c==='"'&&!slashed){state=stack.pop()||VALUE;textNode+=chunk.substring(starti,i-1);break}if(c==="\\"&&!slashed){slashed=true;textNode+=chunk.substring(starti,i-1);c=chunk.charAt(i++);if(!c)break}if(slashed){slashed=false;if(c==="n"){textNode+="\n"}else if(c==="r"){textNode+="\r"}else if(c==="t"){textNode+=" "}else if(c==="f"){textNode+="\f"}else if(c==="b"){textNode+="\b"}else if(c==="u"){unicodeI=1;unicodeS=""}else{textNode+=c}c=chunk.charAt(i++);starti=i-1;if(!c)break;else continue}stringTokenPattern.lastIndex=i;var reResult=stringTokenPattern.exec(chunk);if(!reResult){i=chunk.length+1;textNode+=chunk.substring(starti,i-1);break}i=reResult.index+1;c=chunk.charAt(reResult.index);if(!c){textNode+=chunk.substring(starti,i-1);break}}continue;case TRUE:if(!c)continue;if(c==="r")state=TRUE2;else return emitError("Invalid true started with t"+c);continue;case TRUE2:if(!c)continue;if(c==="u")state=TRUE3;else return emitError("Invalid true started with tr"+c);continue;case TRUE3:if(!c)continue;if(c==="e"){emitValueOpen(true);emitValueClose();state=stack.pop()||VALUE}else return emitError("Invalid true started with tru"+c);continue;case FALSE:if(!c)continue;if(c==="a")state=FALSE2;else return emitError("Invalid false started with f"+c);continue;case FALSE2:if(!c)continue;if(c==="l")state=FALSE3;else return emitError("Invalid false started with fa"+c);continue;case FALSE3:if(!c)continue;if(c==="s")state=FALSE4;else return emitError("Invalid false started with fal"+c);continue;case FALSE4:if(!c)continue;if(c==="e"){emitValueOpen(false);emitValueClose();state=stack.pop()||VALUE}else return emitError("Invalid false started with fals"+c);continue;case NULL:if(!c)continue;if(c==="u")state=NULL2;else return emitError("Invalid null started with n"+c);continue;case NULL2:if(!c)continue;if(c==="l")state=NULL3;else return emitError("Invalid null started with nu"+c);continue;case NULL3:if(!c)continue;if(c==="l"){emitValueOpen(null);emitValueClose();state=stack.pop()||VALUE}else return emitError("Invalid null started with nul"+c);continue;case NUMBER_DECIMAL_POINT:if(c==="."){numberNode+=c;state=NUMBER_DIGIT}else return emitError("Leading zero not followed by .");continue;case NUMBER_DIGIT:if("0123456789".indexOf(c)!==-1)numberNode+=c;else if(c==="."){if(numberNode.indexOf(".")!==-1)return emitError("Invalid number has two dots");numberNode+=c}else if(c==="e"||c==="E"){if(numberNode.indexOf("e")!==-1||numberNode.indexOf("E")!==-1)return emitError("Invalid number has two exponential");numberNode+=c}else if(c==="+"||c==="-"){if(!(p==="e"||p==="E"))return emitError("Invalid symbol in number");numberNode+=c}else{if(numberNode){emitValueOpen(parseFloat(numberNode));emitValueClose();numberNode=""}i--;state=stack.pop()||VALUE}continue;default:return emitError("Unknown state: "+state)}}if(position>=bufferCheckPosition)checkBufferLength()}}function ascentManager(oboeBus,handlers){"use strict";var listenerId={},ascent;function stateAfter(handler){return function(param){ascent=handler(ascent,param)}}for(var eventName in handlers){oboeBus(eventName).on(stateAfter(handlers[eventName]),listenerId)}oboeBus(NODE_SWAP).on(function(newNode){var oldHead=head(ascent),key=keyOf(oldHead),ancestors=tail(ascent),parentNode;if(ancestors){parentNode=nodeOf(head(ancestors));parentNode[key]=newNode}});oboeBus(NODE_DROP).on(function(){var oldHead=head(ascent),key=keyOf(oldHead),ancestors=tail(ascent),parentNode;if(ancestors){parentNode=nodeOf(head(ancestors));delete parentNode[key]}});oboeBus(ABORTING).on(function(){for(var eventName in handlers){oboeBus(eventName).un(listenerId)}})}function parseResponseHeaders(headerStr){var headers={};headerStr&&headerStr.split("\r\n").forEach(function(headerPair){var index=headerPair.indexOf(": ");headers[headerPair.substring(0,index)]=headerPair.substring(index+2)});return headers}function isCrossOrigin(pageLocation,ajaxHost){function defaultPort(protocol){return{"http:":80,"https:":443}[protocol]}function portOf(location){return location.port||defaultPort(location.protocol||pageLocation.protocol)}return!!(ajaxHost.protocol&&ajaxHost.protocol!=pageLocation.protocol||ajaxHost.host&&ajaxHost.host!=pageLocation.host||ajaxHost.host&&portOf(ajaxHost)!=portOf(pageLocation))}function parseUrlOrigin(url){var URL_HOST_PATTERN=/(\w+:)?(?:\/\/)([\w.-]+)?(?::(\d+))?\/?/,urlHostMatch=URL_HOST_PATTERN.exec(url)||[];return{protocol:urlHostMatch[1]||"",host:urlHostMatch[2]||"",port:urlHostMatch[3]||""}}function httpTransport(){return new XMLHttpRequest}function streamingHttp(oboeBus,xhr,method,url,data,headers,withCredentials){"use strict";var emitStreamData=oboeBus(STREAM_DATA).emit,emitFail=oboeBus(FAIL_EVENT).emit,numberOfCharsAlreadyGivenToCallback=0,stillToSendStartEvent=true;oboeBus(ABORTING).on(function(){xhr.onreadystatechange=null;xhr.abort()});function handleProgress(){var textSoFar=xhr.responseText,newText=textSoFar.substr(numberOfCharsAlreadyGivenToCallback);if(newText){emitStreamData(newText)}numberOfCharsAlreadyGivenToCallback=len(textSoFar)}if("onprogress"in xhr){xhr.onprogress=handleProgress}xhr.onreadystatechange=function(){function sendStartIfNotAlready(){try{stillToSendStartEvent&&oboeBus(HTTP_START).emit(xhr.status,parseResponseHeaders(xhr.getAllResponseHeaders()));stillToSendStartEvent=false}catch(e){}}switch(xhr.readyState){case 2:case 3:return sendStartIfNotAlready();case 4:sendStartIfNotAlready();var successful=String(xhr.status)[0]==2;if(successful){handleProgress();oboeBus(STREAM_END).emit()}else{emitFail(errorReport(xhr.status,xhr.responseText))}}};try{xhr.open(method,url,true);for(var headerName in headers){xhr.setRequestHeader(headerName,headers[headerName])}if(!isCrossOrigin(window.location,parseUrlOrigin(url))){xhr.setRequestHeader("X-Requested-With","XMLHttpRequest")}xhr.withCredentials=withCredentials;xhr.send(data)}catch(e){window.setTimeout(partialComplete(emitFail,errorReport(undefined,undefined,e)),0)}}var jsonPathSyntax=function(){var regexDescriptor=function regexDescriptor(regex){return regex.exec.bind(regex)},jsonPathClause=varArgs(function(componentRegexes){componentRegexes.unshift(/^/);return regexDescriptor(RegExp(componentRegexes.map(attr("source")).join("")))}),possiblyCapturing=/(\$?)/,namedNode=/([\w-_]+|\*)/,namePlaceholder=/()/,nodeInArrayNotation=/\["([^"]+)"\]/,numberedNodeInArrayNotation=/\[(\d+|\*)\]/,fieldList=/{([\w ]*?)}/,optionalFieldList=/(?:{([\w ]*?)})?/,jsonPathNamedNodeInObjectNotation=jsonPathClause(possiblyCapturing,namedNode,optionalFieldList),jsonPathNamedNodeInArrayNotation=jsonPathClause(possiblyCapturing,nodeInArrayNotation,optionalFieldList),jsonPathNumberedNodeInArrayNotation=jsonPathClause(possiblyCapturing,numberedNodeInArrayNotation,optionalFieldList),jsonPathPureDuckTyping=jsonPathClause(possiblyCapturing,namePlaceholder,fieldList),jsonPathDoubleDot=jsonPathClause(/\.\./),jsonPathDot=jsonPathClause(/\./),jsonPathBang=jsonPathClause(possiblyCapturing,/!/),emptyString=jsonPathClause(/$/);return function(fn){return fn(lazyUnion(jsonPathNamedNodeInObjectNotation,jsonPathNamedNodeInArrayNotation,jsonPathNumberedNodeInArrayNotation,jsonPathPureDuckTyping),jsonPathDoubleDot,jsonPathDot,jsonPathBang,emptyString)}}();function namedNode(key,node){return{key:key,node:node}}var keyOf=attr("key");var nodeOf=attr("node");var ROOT_PATH={};function incrementalContentBuilder(oboeBus){var emitNodeOpened=oboeBus(NODE_OPENED).emit,emitNodeClosed=oboeBus(NODE_CLOSED).emit,emitRootOpened=oboeBus(ROOT_PATH_FOUND).emit,emitRootClosed=oboeBus(ROOT_NODE_FOUND).emit;function arrayIndicesAreKeys(possiblyInconsistentAscent,newDeepestNode){var parentNode=nodeOf(head(possiblyInconsistentAscent));return isOfType(Array,parentNode)?keyFound(possiblyInconsistentAscent,len(parentNode),newDeepestNode):possiblyInconsistentAscent}function nodeOpened(ascent,newDeepestNode){if(!ascent){emitRootOpened(newDeepestNode);return keyFound(ascent,ROOT_PATH,newDeepestNode)}var arrayConsistentAscent=arrayIndicesAreKeys(ascent,newDeepestNode),ancestorBranches=tail(arrayConsistentAscent),previouslyUnmappedName=keyOf(head(arrayConsistentAscent));appendBuiltContent(ancestorBranches,previouslyUnmappedName,newDeepestNode);return cons(namedNode(previouslyUnmappedName,newDeepestNode),ancestorBranches)}function appendBuiltContent(ancestorBranches,key,node){nodeOf(head(ancestorBranches))[key]=node}function keyFound(ascent,newDeepestName,maybeNewDeepestNode){if(ascent){appendBuiltContent(ascent,newDeepestName,maybeNewDeepestNode)}var ascentWithNewPath=cons(namedNode(newDeepestName,maybeNewDeepestNode),ascent);emitNodeOpened(ascentWithNewPath);return ascentWithNewPath}function nodeClosed(ascent){emitNodeClosed(ascent);return tail(ascent)||emitRootClosed(nodeOf(head(ascent)))}var contentBuilderHandlers={};contentBuilderHandlers[SAX_VALUE_OPEN]=nodeOpened;contentBuilderHandlers[SAX_VALUE_CLOSE]=nodeClosed;contentBuilderHandlers[SAX_KEY]=keyFound;return contentBuilderHandlers}var jsonPathCompiler=jsonPathSyntax(function(pathNodeSyntax,doubleDotSyntax,dotSyntax,bangSyntax,emptySyntax){var CAPTURING_INDEX=1;var NAME_INDEX=2;var FIELD_LIST_INDEX=3;var headKey=compose2(keyOf,head),headNode=compose2(nodeOf,head);function nameClause(previousExpr,detection){var name=detection[NAME_INDEX],matchesName=!name||name=="*"?always:function(ascent){return headKey(ascent)==name};return lazyIntersection(matchesName,previousExpr)}function duckTypeClause(previousExpr,detection){var fieldListStr=detection[FIELD_LIST_INDEX];if(!fieldListStr)return previousExpr;var hasAllrequiredFields=partialComplete(hasAllProperties,arrayAsList(fieldListStr.split(/\W+/))),isMatch=compose2(hasAllrequiredFields,headNode);return lazyIntersection(isMatch,previousExpr)}function capture(previousExpr,detection){var capturing=!!detection[CAPTURING_INDEX];if(!capturing)return previousExpr;return lazyIntersection(previousExpr,head)}function skip1(previousExpr){if(previousExpr==always){return always}function notAtRoot(ascent){return headKey(ascent)!=ROOT_PATH}return lazyIntersection(notAtRoot,compose2(previousExpr,tail))}function skipMany(previousExpr){if(previousExpr==always){return always}var terminalCaseWhenArrivingAtRoot=rootExpr(),terminalCaseWhenPreviousExpressionIsSatisfied=previousExpr,recursiveCase=skip1(function(ascent){return cases(ascent)}),cases=lazyUnion(terminalCaseWhenArrivingAtRoot,terminalCaseWhenPreviousExpressionIsSatisfied,recursiveCase);return cases}function rootExpr(){return function(ascent){return headKey(ascent)==ROOT_PATH}}function statementExpr(lastClause){return function(ascent){var exprMatch=lastClause(ascent);return exprMatch===true?head(ascent):exprMatch}}function expressionsReader(exprs,parserGeneratedSoFar,detection){return foldR(function(parserGeneratedSoFar,expr){return expr(parserGeneratedSoFar,detection)},parserGeneratedSoFar,exprs)}function generateClauseReaderIfTokenFound(tokenDetector,clauseEvaluatorGenerators,jsonPath,parserGeneratedSoFar,onSuccess){var detected=tokenDetector(jsonPath);if(detected){var compiledParser=expressionsReader(clauseEvaluatorGenerators,parserGeneratedSoFar,detected),remainingUnparsedJsonPath=jsonPath.substr(len(detected[0]));return onSuccess(remainingUnparsedJsonPath,compiledParser)}}function clauseMatcher(tokenDetector,exprs){return partialComplete(generateClauseReaderIfTokenFound,tokenDetector,exprs)}var clauseForJsonPath=lazyUnion(clauseMatcher(pathNodeSyntax,list(capture,duckTypeClause,nameClause,skip1)),clauseMatcher(doubleDotSyntax,list(skipMany)),clauseMatcher(dotSyntax,list()),clauseMatcher(bangSyntax,list(capture,rootExpr)),clauseMatcher(emptySyntax,list(statementExpr)),function(jsonPath){throw Error('"'+jsonPath+'" could not be tokenised')});function returnFoundParser(_remainingJsonPath,compiledParser){return compiledParser}function compileJsonPathToFunction(uncompiledJsonPath,parserGeneratedSoFar){var onFind=uncompiledJsonPath?compileJsonPathToFunction:returnFoundParser;return clauseForJsonPath(uncompiledJsonPath,parserGeneratedSoFar,onFind)}return function(jsonPath){try{return compileJsonPathToFunction(jsonPath,always)}catch(e){throw Error('Could not compile "'+jsonPath+'" because '+e.message)}}});function singleEventPubSub(eventType,newListener,removeListener){var listenerTupleList,listenerList;function hasId(id){return function(tuple){return tuple.id==id}}return{on:function(listener,listenerId){var tuple={listener:listener,id:listenerId||listener};if(newListener){newListener.emit(eventType,listener,tuple.id)}listenerTupleList=cons(tuple,listenerTupleList);listenerList=cons(listener,listenerList);return this},emit:function(){applyEach(listenerList,arguments)},un:function(listenerId){var removed;listenerTupleList=without(listenerTupleList,hasId(listenerId),function(tuple){removed=tuple});if(removed){listenerList=without(listenerList,function(listener){return listener==removed.listener});if(removeListener){removeListener.emit(eventType,removed.listener,removed.id)}}},listeners:function(){return listenerList},hasListener:function(listenerId){var test=listenerId?hasId(listenerId):always;return defined(first(test,listenerTupleList))}}}function pubSub(){var singles={},newListener=newSingle("newListener"),removeListener=newSingle("removeListener");function newSingle(eventName){return singles[eventName]=singleEventPubSub(eventName,newListener,removeListener)}function pubSubInstance(eventName){return singles[eventName]||newSingle(eventName)}["emit","on","un"].forEach(function(methodName){pubSubInstance[methodName]=varArgs(function(eventName,parameters){apply(parameters,pubSubInstance(eventName)[methodName])})});return pubSubInstance}var _S=1,NODE_OPENED=_S++,NODE_CLOSED=_S++,NODE_SWAP=_S++,NODE_DROP=_S++,FAIL_EVENT="fail",ROOT_NODE_FOUND=_S++,ROOT_PATH_FOUND=_S++,HTTP_START="start",STREAM_DATA="data",STREAM_END="end",ABORTING=_S++,SAX_KEY=_S++,SAX_VALUE_OPEN=_S++,SAX_VALUE_CLOSE=_S++;function errorReport(statusCode,body,error){try{var jsonBody=JSON.parse(body)}catch(e){}return{statusCode:statusCode,body:body,jsonBody:jsonBody,thrown:error}}function patternAdapter(oboeBus,jsonPathCompiler){var predicateEventMap={node:oboeBus(NODE_CLOSED),path:oboeBus(NODE_OPENED)};function emitMatchingNode(emitMatch,node,ascent){var descent=reverseList(ascent);emitMatch(node,listAsArray(tail(map(keyOf,descent))),listAsArray(map(nodeOf,descent)))}function addUnderlyingListener(fullEventName,predicateEvent,compiledJsonPath){var emitMatch=oboeBus(fullEventName).emit;predicateEvent.on(function(ascent){var maybeMatchingMapping=compiledJsonPath(ascent);if(maybeMatchingMapping!==false){emitMatchingNode(emitMatch,nodeOf(maybeMatchingMapping),ascent)}},fullEventName);oboeBus("removeListener").on(function(removedEventName){if(removedEventName==fullEventName){if(!oboeBus(removedEventName).listeners()){predicateEvent.un(fullEventName)}}})}oboeBus("newListener").on(function(fullEventName){var match=/(node|path):(.*)/.exec(fullEventName);if(match){var predicateEvent=predicateEventMap[match[1]];if(!predicateEvent.hasListener(fullEventName)){addUnderlyingListener(fullEventName,predicateEvent,jsonPathCompiler(match[2]))}}})}function instanceApi(oboeBus,contentSource){var oboeApi,fullyQualifiedNamePattern=/^(node|path):./,rootNodeFinishedEvent=oboeBus(ROOT_NODE_FOUND),emitNodeDrop=oboeBus(NODE_DROP).emit,emitNodeSwap=oboeBus(NODE_SWAP).emit,addListener=varArgs(function(eventId,parameters){if(oboeApi[eventId]){apply(parameters,oboeApi[eventId])}else{var event=oboeBus(eventId),listener=parameters[0];if(fullyQualifiedNamePattern.test(eventId)){addForgettableCallback(event,listener)}else{event.on(listener)}}return oboeApi}),removeListener=function(eventId,p2,p3){if(eventId=="done"){rootNodeFinishedEvent.un(p2)}else if(eventId=="node"||eventId=="path"){oboeBus.un(eventId+":"+p2,p3)}else{var listener=p2;oboeBus(eventId).un(listener)}return oboeApi};function addProtectedCallback(eventName,callback){oboeBus(eventName).on(protectedCallback(callback),callback);return oboeApi}function addForgettableCallback(event,callback,listenerId){listenerId=listenerId||callback;var safeCallback=protectedCallback(callback);event.on(function(){var discard=false;oboeApi.forget=function(){discard=true};apply(arguments,safeCallback);delete oboeApi.forget;if(discard){event.un(listenerId)}},listenerId);return oboeApi}function protectedCallback(callback){return function(){try{return callback.apply(oboeApi,arguments)}catch(e){setTimeout(function(){throw e})}}}function fullyQualifiedPatternMatchEvent(type,pattern){return oboeBus(type+":"+pattern)}function wrapCallbackToSwapNodeIfSomethingReturned(callback){return function(){var returnValueFromCallback=callback.apply(this,arguments);if(defined(returnValueFromCallback)){if(returnValueFromCallback==oboe.drop){emitNodeDrop()}else{emitNodeSwap(returnValueFromCallback)}}}}function addSingleNodeOrPathListener(eventId,pattern,callback){var effectiveCallback;if(eventId=="node"){effectiveCallback=wrapCallbackToSwapNodeIfSomethingReturned(callback)}else{effectiveCallback=callback}addForgettableCallback(fullyQualifiedPatternMatchEvent(eventId,pattern),effectiveCallback,callback)}function addMultipleNodeOrPathListeners(eventId,listenerMap){for(var pattern in listenerMap){addSingleNodeOrPathListener(eventId,pattern,listenerMap[pattern])}}function addNodeOrPathListenerApi(eventId,jsonPathOrListenerMap,callback){if(isString(jsonPathOrListenerMap)){addSingleNodeOrPathListener(eventId,jsonPathOrListenerMap,callback)}else{addMultipleNodeOrPathListeners(eventId,jsonPathOrListenerMap)}return oboeApi}oboeBus(ROOT_PATH_FOUND).on(function(rootNode){oboeApi.root=functor(rootNode)});oboeBus(HTTP_START).on(function(_statusCode,headers){oboeApi.header=function(name){return name?headers[name]:headers}});return oboeApi={on:addListener,addListener:addListener,removeListener:removeListener,emit:oboeBus.emit,node:partialComplete(addNodeOrPathListenerApi,"node"),path:partialComplete(addNodeOrPathListenerApi,"path"),done:partialComplete(addForgettableCallback,rootNodeFinishedEvent),start:partialComplete(addProtectedCallback,HTTP_START),fail:oboeBus(FAIL_EVENT).on,abort:oboeBus(ABORTING).emit,header:noop,root:noop,source:contentSource}}function wire(httpMethodName,contentSource,body,headers,withCredentials){var oboeBus=pubSub();if(contentSource){streamingHttp(oboeBus,httpTransport(),httpMethodName,contentSource,body,headers,withCredentials)}clarinet(oboeBus);ascentManager(oboeBus,incrementalContentBuilder(oboeBus));patternAdapter(oboeBus,jsonPathCompiler);return instanceApi(oboeBus,contentSource)}function applyDefaults(passthrough,url,httpMethodName,body,headers,withCredentials,cached){headers=headers?JSON.parse(JSON.stringify(headers)):{};if(body){if(!isString(body)){body=JSON.stringify(body);headers["Content-Type"]=headers["Content-Type"]||"application/json"}}else{body=null}function modifiedUrl(baseUrl,cached){if(cached===false){if(baseUrl.indexOf("?")==-1){baseUrl+="?"}else{baseUrl+="&"}baseUrl+="_="+(new Date).getTime()}return baseUrl}return passthrough(httpMethodName||"GET",modifiedUrl(url,cached),body,headers,withCredentials||false)}function oboe(arg1){var nodeStreamMethodNames=list("resume","pause","pipe"),isStream=partialComplete(hasAllProperties,nodeStreamMethodNames);if(arg1){if(isStream(arg1)||isString(arg1)){return applyDefaults(wire,arg1)}else{return applyDefaults(wire,arg1.url,arg1.method,arg1.body,arg1.headers,arg1.withCredentials,arg1.cached)}}else{return wire()}}oboe.drop=function(){ return oboe.drop};if(typeof define==="function"&&define.amd){define("oboe",[],function(){return oboe})}else if(typeof exports==="object"){module.exports=oboe}else{window.oboe=oboe}})(function(){try{return window}catch(e){return self}}(),Object,Array,Error,JSON)},{}],209:[function(require,module,exports){(function(process){"use strict";if(!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0){module.exports=nextTick}else{module.exports=process.nextTick}function nextTick(fn,arg1,arg2,arg3){if(typeof fn!=="function"){throw new TypeError('"callback" argument must be a function')}var len=arguments.length;var args,i;switch(len){case 0:case 1:return process.nextTick(fn);case 2:return process.nextTick(function afterTickOne(){fn.call(null,arg1)});case 3:return process.nextTick(function afterTickTwo(){fn.call(null,arg1,arg2)});case 4:return process.nextTick(function afterTickThree(){fn.call(null,arg1,arg2,arg3)});default:args=new Array(len-1);i=0;while(i1){for(var i=1;i0){if(typeof chunk!=="string"&&!state.objectMode&&Object.getPrototypeOf(chunk)!==Buffer.prototype){chunk=_uint8ArrayToBuffer(chunk)}if(addToFront){if(state.endEmitted)stream.emit("error",new Error("stream.unshift() after end event"));else addChunk(stream,state,chunk,true)}else if(state.ended){stream.emit("error",new Error("stream.push() after EOF"))}else{state.reading=false;if(state.decoder&&!encoding){chunk=state.decoder.write(chunk);if(state.objectMode||chunk.length!==0)addChunk(stream,state,chunk,false);else maybeReadMore(stream,state)}else{addChunk(stream,state,chunk,false)}}}else if(!addToFront){state.reading=false}}return needMoreData(state)}function addChunk(stream,state,chunk,addToFront){if(state.flowing&&state.length===0&&!state.sync){stream.emit("data",chunk);stream.read(0)}else{state.length+=state.objectMode?1:chunk.length;if(addToFront)state.buffer.unshift(chunk);else state.buffer.push(chunk);if(state.needReadable)emitReadable(stream)}maybeReadMore(stream,state)}function chunkInvalid(state,chunk){var er;if(!_isUint8Array(chunk)&&typeof chunk!=="string"&&chunk!==undefined&&!state.objectMode){er=new TypeError("Invalid non-string/buffer chunk")}return er}function needMoreData(state){return!state.ended&&(state.needReadable||state.length=MAX_HWM){n=MAX_HWM}else{n--;n|=n>>>1;n|=n>>>2;n|=n>>>4;n|=n>>>8;n|=n>>>16;n++}return n}function howMuchToRead(n,state){if(n<=0||state.length===0&&state.ended)return 0;if(state.objectMode)return 1;if(n!==n){if(state.flowing&&state.length)return state.buffer.head.data.length;else return state.length}if(n>state.highWaterMark)state.highWaterMark=computeNewHighWaterMark(n);if(n<=state.length)return n;if(!state.ended){state.needReadable=true;return 0}return state.length}Readable.prototype.read=function(n){debug("read",n);n=parseInt(n,10);var state=this._readableState;var nOrig=n;if(n!==0)state.emittedReadable=false;if(n===0&&state.needReadable&&(state.length>=state.highWaterMark||state.ended)){debug("read: emitReadable",state.length,state.ended);if(state.length===0&&state.ended)endReadable(this);else emitReadable(this);return null}n=howMuchToRead(n,state);if(n===0&&state.ended){if(state.length===0)endReadable(this);return null}var doRead=state.needReadable;debug("need readable",doRead);if(state.length===0||state.length-n0)ret=fromList(n,state);else ret=null;if(ret===null){state.needReadable=true;n=0}else{state.length-=n}if(state.length===0){if(!state.ended)state.needReadable=true;if(nOrig!==n&&state.ended)endReadable(this)}if(ret!==null)this.emit("data",ret);return ret};function onEofChunk(stream,state){if(state.ended)return;if(state.decoder){var chunk=state.decoder.end();if(chunk&&chunk.length){state.buffer.push(chunk);state.length+=state.objectMode?1:chunk.length}}state.ended=true;emitReadable(stream)}function emitReadable(stream){var state=stream._readableState;state.needReadable=false;if(!state.emittedReadable){debug("emitReadable",state.flowing);state.emittedReadable=true;if(state.sync)processNextTick(emitReadable_,stream);else emitReadable_(stream)}}function emitReadable_(stream){debug("emit readable");stream.emit("readable");flow(stream)}function maybeReadMore(stream,state){if(!state.readingMore){state.readingMore=true;processNextTick(maybeReadMore_,stream,state)}}function maybeReadMore_(stream,state){var len=state.length;while(!state.reading&&!state.flowing&&!state.ended&&state.length1&&indexOf(state.pipes,dest)!==-1)&&!cleanedUp){debug("false write response, pause",src._readableState.awaitDrain);src._readableState.awaitDrain++;increasedAwaitDrain=true}src.pause()}}function onerror(er){debug("onerror",er);unpipe();dest.removeListener("error",onerror);if(EElistenerCount(dest,"error")===0)dest.emit("error",er)}prependListener(dest,"error",onerror);function onclose(){dest.removeListener("finish",onfinish);unpipe()}dest.once("close",onclose);function onfinish(){debug("onfinish");dest.removeListener("close",onclose);unpipe()}dest.once("finish",onfinish);function unpipe(){debug("unpipe");src.unpipe(dest)}dest.emit("pipe",src);if(!state.flowing){debug("pipe resume");src.resume()}return dest};function pipeOnDrain(src){return function(){var state=src._readableState;debug("pipeOnDrain",state.awaitDrain);if(state.awaitDrain)state.awaitDrain--;if(state.awaitDrain===0&&EElistenerCount(src,"data")){state.flowing=true;flow(src)}}}Readable.prototype.unpipe=function(dest){var state=this._readableState;var unpipeInfo={hasUnpiped:false};if(state.pipesCount===0)return this;if(state.pipesCount===1){if(dest&&dest!==state.pipes)return this;if(!dest)dest=state.pipes;state.pipes=null;state.pipesCount=0;state.flowing=false;if(dest)dest.emit("unpipe",this,unpipeInfo);return this}if(!dest){var dests=state.pipes;var len=state.pipesCount;state.pipes=null;state.pipesCount=0;state.flowing=false;for(var i=0;i=state.length){if(state.decoder)ret=state.buffer.join("");else if(state.buffer.length===1)ret=state.buffer.head.data;else ret=state.buffer.concat(state.length);state.buffer.clear()}else{ret=fromListPartial(n,state.buffer,state.decoder)}return ret}function fromListPartial(n,list,hasStrings){var ret;if(nstr.length?str.length:n;if(nb===str.length)ret+=str;else ret+=str.slice(0,n);n-=nb;if(n===0){if(nb===str.length){++c;if(p.next)list.head=p.next;else list.head=list.tail=null}else{list.head=p;p.data=str.slice(nb)}break}++c}list.length-=c;return ret}function copyFromBuffer(n,list){var ret=Buffer.allocUnsafe(n);var p=list.head;var c=1;p.data.copy(ret);n-=p.data.length;while(p=p.next){var buf=p.data;var nb=n>buf.length?buf.length:n;buf.copy(ret,ret.length-n,0,nb);n-=nb;if(n===0){if(nb===buf.length){++c;if(p.next)list.head=p.next;else list.head=list.tail=null}else{list.head=p;p.data=buf.slice(nb)}break}++c}list.length-=c;return ret}function endReadable(stream){var state=stream._readableState;if(state.length>0)throw new Error('"endReadable()" called on non-empty stream');if(!state.endEmitted){state.ended=true;processNextTick(endReadableNT,state,stream)}}function endReadableNT(state,stream){if(!state.endEmitted&&state.length===0){state.endEmitted=true;stream.readable=false;stream.emit("end")}}function forEach(xs,f){for(var i=0,l=xs.length;i-1?setImmediate:processNextTick;var Duplex;Writable.WritableState=WritableState;var util=require("core-util-is");util.inherits=require("inherits");var internalUtil={deprecate:require("util-deprecate")};var Stream=require("./internal/streams/stream");var Buffer=require("safe-buffer").Buffer;var OurUint8Array=global.Uint8Array||function(){};function _uint8ArrayToBuffer(chunk){return Buffer.from(chunk)}function _isUint8Array(obj){return Buffer.isBuffer(obj)||obj instanceof OurUint8Array}var destroyImpl=require("./internal/streams/destroy");util.inherits(Writable,Stream);function nop(){}function WritableState(options,stream){Duplex=Duplex||require("./_stream_duplex");options=options||{};this.objectMode=!!options.objectMode;if(stream instanceof Duplex)this.objectMode=this.objectMode||!!options.writableObjectMode;var hwm=options.highWaterMark;var defaultHwm=this.objectMode?16:16*1024;this.highWaterMark=hwm||hwm===0?hwm:defaultHwm;this.highWaterMark=Math.floor(this.highWaterMark);this.finalCalled=false;this.needDrain=false;this.ending=false;this.ended=false;this.finished=false;this.destroyed=false;var noDecode=options.decodeStrings===false;this.decodeStrings=!noDecode;this.defaultEncoding=options.defaultEncoding||"utf8";this.length=0;this.writing=false;this.corked=0;this.sync=true;this.bufferProcessing=false;this.onwrite=function(er){onwrite(stream,er)};this.writecb=null;this.writelen=0;this.bufferedRequest=null;this.lastBufferedRequest=null;this.pendingcb=0;this.prefinished=false;this.errorEmitted=false;this.bufferedRequestCount=0;this.corkedRequestsFree=new CorkedRequest(this)}WritableState.prototype.getBuffer=function getBuffer(){var current=this.bufferedRequest;var out=[];while(current){out.push(current);current=current.next}return out};(function(){try{Object.defineProperty(WritableState.prototype,"buffer",{get:internalUtil.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer "+"instead.","DEP0003")})}catch(_){}})();var realHasInstance;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function"){realHasInstance=Function.prototype[Symbol.hasInstance];Object.defineProperty(Writable,Symbol.hasInstance,{value:function(object){if(realHasInstance.call(this,object))return true;return object&&object._writableState instanceof WritableState}})}else{realHasInstance=function(object){return object instanceof this}}function Writable(options){Duplex=Duplex||require("./_stream_duplex");if(!realHasInstance.call(Writable,this)&&!(this instanceof Duplex)){return new Writable(options)}this._writableState=new WritableState(options,this);this.writable=true;if(options){if(typeof options.write==="function")this._write=options.write;if(typeof options.writev==="function")this._writev=options.writev;if(typeof options.destroy==="function")this._destroy=options.destroy;if(typeof options.final==="function")this._final=options.final}Stream.call(this)}Writable.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function writeAfterEnd(stream,cb){var er=new Error("write after end");stream.emit("error",er);processNextTick(cb,er)}function validChunk(stream,state,chunk,cb){var valid=true;var er=false;if(chunk===null){er=new TypeError("May not write null values to stream")}else if(typeof chunk!=="string"&&chunk!==undefined&&!state.objectMode){er=new TypeError("Invalid non-string/buffer chunk")}if(er){stream.emit("error",er);processNextTick(cb,er);valid=false}return valid}Writable.prototype.write=function(chunk,encoding,cb){var state=this._writableState;var ret=false;var isBuf=_isUint8Array(chunk)&&!state.objectMode;if(isBuf&&!Buffer.isBuffer(chunk)){chunk=_uint8ArrayToBuffer(chunk)}if(typeof encoding==="function"){cb=encoding;encoding=null}if(isBuf)encoding="buffer";else if(!encoding)encoding=state.defaultEncoding;if(typeof cb!=="function")cb=nop;if(state.ended)writeAfterEnd(this,cb);else if(isBuf||validChunk(this,state,chunk,cb)){state.pendingcb++;ret=writeOrBuffer(this,state,isBuf,chunk,encoding,cb)}return ret};Writable.prototype.cork=function(){var state=this._writableState;state.corked++};Writable.prototype.uncork=function(){var state=this._writableState;if(state.corked){state.corked--;if(!state.writing&&!state.corked&&!state.finished&&!state.bufferProcessing&&state.bufferedRequest)clearBuffer(this,state)}};Writable.prototype.setDefaultEncoding=function setDefaultEncoding(encoding){if(typeof encoding==="string")encoding=encoding.toLowerCase();if(!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((encoding+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+encoding);this._writableState.defaultEncoding=encoding;return this};function decodeChunk(state,chunk,encoding){if(!state.objectMode&&state.decodeStrings!==false&&typeof chunk==="string"){chunk=Buffer.from(chunk,encoding)}return chunk}function writeOrBuffer(stream,state,isBuf,chunk,encoding,cb){if(!isBuf){var newChunk=decodeChunk(state,chunk,encoding);if(chunk!==newChunk){isBuf=true;encoding="buffer";chunk=newChunk}}var len=state.objectMode?1:chunk.length;state.length+=len;var ret=state.length0)this.tail.next=entry;else this.head=entry;this.tail=entry;++this.length};BufferList.prototype.unshift=function unshift(v){var entry={data:v,next:this.head};if(this.length===0)this.tail=entry;this.head=entry;++this.length};BufferList.prototype.shift=function shift(){if(this.length===0)return;var ret=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;--this.length;return ret};BufferList.prototype.clear=function clear(){this.head=this.tail=null;this.length=0};BufferList.prototype.join=function join(s){if(this.length===0)return"";var p=this.head;var ret=""+p.data;while(p=p.next){ret+=s+p.data}return ret};BufferList.prototype.concat=function concat(n){if(this.length===0)return Buffer.alloc(0);if(this.length===1)return this.head.data;var ret=Buffer.allocUnsafe(n>>>0);var p=this.head;var i=0;while(p){copyBuffer(p.data,ret,i);i+=p.data.length;p=p.next}return ret};return BufferList}()},{"safe-buffer":234}],218:[function(require,module,exports){"use strict";var processNextTick=require("process-nextick-args");function destroy(err,cb){var _this=this;var readableDestroyed=this._readableState&&this._readableState.destroyed;var writableDestroyed=this._writableState&&this._writableState.destroyed;if(readableDestroyed||writableDestroyed){if(cb){cb(err)}else if(err&&(!this._writableState||!this._writableState.errorEmitted)){processNextTick(emitErrorNT,this,err)}return}if(this._readableState){this._readableState.destroyed=true}if(this._writableState){this._writableState.destroyed=true}this._destroy(err||null,function(err){if(!cb&&err){processNextTick(emitErrorNT,_this,err);if(_this._writableState){_this._writableState.errorEmitted=true}}else if(cb){cb(err)}})}function undestroy(){if(this._readableState){this._readableState.destroyed=false;this._readableState.reading=false;this._readableState.ended=false;this._readableState.endEmitted=false}if(this._writableState){this._writableState.destroyed=false;this._writableState.ended=false;this._writableState.ending=false;this._writableState.finished=false;this._writableState.errorEmitted=false}}function emitErrorNT(self,err){self.emit("error",err)}module.exports={destroy:destroy,undestroy:undestroy}},{"process-nextick-args":209}],219:[function(require,module,exports){module.exports=require("events").EventEmitter},{events:162}],220:[function(require,module,exports){module.exports=require("./readable").PassThrough},{"./readable":221}],221:[function(require,module,exports){exports=module.exports=require("./lib/_stream_readable.js");exports.Stream=exports;exports.Readable=exports;exports.Writable=require("./lib/_stream_writable.js");exports.Duplex=require("./lib/_stream_duplex.js");exports.Transform=require("./lib/_stream_transform.js");exports.PassThrough=require("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":212,"./lib/_stream_passthrough.js":213,"./lib/_stream_readable.js":214,"./lib/_stream_transform.js":215,"./lib/_stream_writable.js":216}],222:[function(require,module,exports){module.exports=require("./readable").Transform},{"./readable":221}],223:[function(require,module,exports){module.exports=require("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":216}],224:[function(require,module,exports){"use strict";var createThunkSubscribeEnhancer=function(extraArgument){return function(createStore){return function(reducer,initialState){var store=createStore(reducer,initialState);var dispatch=store.dispatch;store.dispatch=function(action){if(typeof action==="function"){return action(store.dispatch,store.getState,store.subscribe,extraArgument)}return dispatch(action)};return store}}};var thunkSubscribeEnhancer=createThunkSubscribeEnhancer();thunkSubscribeEnhancer.withExtraArgument=createThunkSubscribeEnhancer;module.exports=thunkSubscribeEnhancer},{}],225:[function(require,module,exports){"use strict";exports.__esModule=true;var _extends=Object.assign||function(target){for(var i=1;i0){return"Unexpected "+(unexpectedKeys.length>1?"keys":"key")+" "+('"'+unexpectedKeys.join('", "')+'" found in '+argumentName+". ")+"Expected to find one of the known reducer keys instead: "+('"'+reducerKeys.join('", "')+'". Unexpected keys will be ignored.')}}function assertReducerSanity(reducers){Object.keys(reducers).forEach(function(key){var reducer=reducers[key];var initialState=reducer(undefined,{type:_createStore.ActionTypes.INIT});if(typeof initialState==="undefined"){throw new Error('Reducer "'+key+'" returned undefined during initialization. '+"If the state passed to the reducer is undefined, you must "+"explicitly return the initial state. The initial state may "+"not be undefined.")}var type="@@redux/PROBE_UNKNOWN_ACTION_"+Math.random().toString(36).substring(7).split("").join(".");if(typeof reducer(undefined,{type:type})==="undefined"){throw new Error('Reducer "'+key+'" returned undefined when probed with a random type. '+("Don't try to handle "+_createStore.ActionTypes.INIT+' or other actions in "redux/*" ')+"namespace. They are considered private. Instead, you must return the "+"current state for any unknown actions, unless it is undefined, "+"in which case you must return the initial state, regardless of the "+"action type. The initial state may not be undefined.")}})}function combineReducers(reducers){var reducerKeys=Object.keys(reducers);var finalReducers={};for(var i=0;i56){this._block.fill(0,this._blockOffset,64);this._update();this._blockOffset=0}this._block.fill(0,this._blockOffset,56);this._block.writeUInt32LE(this._length[0],56);this._block.writeUInt32LE(this._length[1],60);this._update();var buffer=new Buffer(20);buffer.writeInt32LE(this._a,0);buffer.writeInt32LE(this._b,4);buffer.writeInt32LE(this._c,8);buffer.writeInt32LE(this._d,12);buffer.writeInt32LE(this._e,16);return buffer};function rotl(x,n){return x<>>32-n}function fn1(a,b,c,d,e,m,k,s){return rotl(a+(b^c^d)+m+k|0,s)+e|0}function fn2(a,b,c,d,e,m,k,s){return rotl(a+(b&c|~b&d)+m+k|0,s)+e|0}function fn3(a,b,c,d,e,m,k,s){return rotl(a+((b|~c)^d)+m+k|0,s)+e|0}function fn4(a,b,c,d,e,m,k,s){return rotl(a+(b&d|c&~d)+m+k|0,s)+e|0}function fn5(a,b,c,d,e,m,k,s){return rotl(a+(b^(c|~d))+m+k|0,s)+e|0}module.exports=RIPEMD160}).call(this,require("buffer").Buffer)},{buffer:14,"hash-base":163,inherits:180}],233:[function(require,module,exports){(function(Buffer){const assert=require("assert");exports.encode=function(input){if(input instanceof Array){var output=[];for(var i=0;iinput.length){throw new Error("invalid rlp: total length is larger than the data")}innerRemainder=input.slice(llength,totalLength);if(innerRemainder.length===0){throw new Error("invalid rlp, List has a invalid length")}while(innerRemainder.length){d=_decode(innerRemainder);decoded.push(d.data);innerRemainder=d.remainder}return{data:decoded,remainder:input.slice(totalLength)}}}function isHexPrefixed(str){return str.slice(0,2)==="0x"}function stripHexPrefix(str){if(typeof str!=="string"){return str}return isHexPrefixed(str)?str.slice(2):str}function intToHex(i){var hex=i.toString(16);if(hex.length%2){hex="0"+hex}return hex}function padToEven(a){if(a.length%2)a="0"+a;return a}function intToBuffer(i){var hex=intToHex(i);return new Buffer(hex,"hex")}function toBuffer(v){if(!Buffer.isBuffer(v)){if(typeof v==="string"){if(isHexPrefixed(v)){v=new Buffer(padToEven(stripHexPrefix(v)),"hex")}else{v=new Buffer(v)}}else if(typeof v==="number"){if(!v){v=new Buffer([])}else{v=intToBuffer(v)}}else if(v===null||v===undefined){v=new Buffer([])}else if(v.toArray){v=new Buffer(v.toArray())}else{throw new Error("invalid type")}}return v}}).call(this,require("buffer").Buffer)},{assert:2,buffer:14}],234:[function(require,module,exports){var buffer=require("buffer");var Buffer=buffer.Buffer;function copyProps(src,dst){for(var key in src){dst[key]=src[key]}}if(Buffer.from&&Buffer.alloc&&Buffer.allocUnsafe&&Buffer.allocUnsafeSlow){module.exports=buffer}else{copyProps(buffer,exports);exports.Buffer=SafeBuffer}function SafeBuffer(arg,encodingOrOffset,length){return Buffer(arg,encodingOrOffset,length)}copyProps(Buffer,SafeBuffer);SafeBuffer.from=function(arg,encodingOrOffset,length){if(typeof arg==="number"){throw new TypeError("Argument must not be a number")}return Buffer(arg,encodingOrOffset,length)};SafeBuffer.alloc=function(size,fill,encoding){if(typeof size!=="number"){throw new TypeError("Argument must be a number")}var buf=Buffer(size);if(fill!==undefined){if(typeof encoding==="string"){buf.fill(fill,encoding)}else{buf.fill(fill)}}else{buf.fill(0)}return buf};SafeBuffer.allocUnsafe=function(size){if(typeof size!=="number"){throw new TypeError("Argument must be a number")}return Buffer(size)};SafeBuffer.allocUnsafeSlow=function(size){if(typeof size!=="number"){throw new TypeError("Argument must be a number")}return buffer.SlowBuffer(size)}},{buffer:14}],235:[function(require,module,exports){"use strict";module.exports=require("./lib")(require("./lib/elliptic"))},{"./lib":239,"./lib/elliptic":238}],236:[function(require,module,exports){(function(Buffer){"use strict";var toString=Object.prototype.toString;exports.isArray=function(value,message){if(!Array.isArray(value))throw TypeError(message)};exports.isBoolean=function(value,message){if(toString.call(value)!=="[object Boolean]")throw TypeError(message)};exports.isBuffer=function(value,message){if(!Buffer.isBuffer(value))throw TypeError(message)};exports.isFunction=function(value,message){if(toString.call(value)!=="[object Function]")throw TypeError(message)};exports.isNumber=function(value,message){if(toString.call(value)!=="[object Number]")throw TypeError(message)};exports.isObject=function(value,message){if(toString.call(value)!=="[object Object]")throw TypeError(message)};exports.isBufferLength=function(buffer,length,message){if(buffer.length!==length)throw RangeError(message)};exports.isBufferLength2=function(buffer,length1,length2,message){if(buffer.length!==length1&&buffer.length!==length2)throw RangeError(message)};exports.isLengthGTZero=function(value,message){if(value.length===0)throw RangeError(message)};exports.isNumberInInterval=function(number,x,y,message){if(number<=x||number>=y)throw RangeError(message)}}).call(this,{isBuffer:require("../../is-buffer/index.js")})},{"../../is-buffer/index.js":181}],237:[function(require,module,exports){"use strict";var Buffer=require("safe-buffer").Buffer;var bip66=require("bip66");var EC_PRIVKEY_EXPORT_DER_COMPRESSED=Buffer.from([48,129,211,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,133,48,129,130,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,33,2,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,36,3,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);var EC_PRIVKEY_EXPORT_DER_UNCOMPRESSED=Buffer.from([48,130,1,19,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,165,48,129,162,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,65,4,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,72,58,218,119,38,163,196,101,93,164,251,252,14,17,8,168,253,23,180,72,166,133,84,25,156,71,208,143,251,16,212,184,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,68,3,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);exports.privateKeyExport=function(privateKey,publicKey,compressed){var result=Buffer.from(compressed?EC_PRIVKEY_EXPORT_DER_COMPRESSED:EC_PRIVKEY_EXPORT_DER_UNCOMPRESSED);privateKey.copy(result,compressed?8:9);publicKey.copy(result,compressed?181:214);return result};exports.privateKeyImport=function(privateKey){var length=privateKey.length;var index=0;if(length2)return;if(length1?privateKey[index+lenb-2]<<8:0);index+=lenb;if(length32||length1&&r[posR]===0&&!(r[posR+1]&128);--lenR,++posR);var s=Buffer.concat([Buffer.from([0]),sigObj.s]);for(var lenS=33,posS=0;lenS>1&&s[posS]===0&&!(s[posS+1]&128);--lenS,++posS);return bip66.encode(r.slice(posR),s.slice(posS))};exports.signatureImport=function(sig){var r=Buffer.alloc(32,0);var s=Buffer.alloc(32,0);try{var sigObj=bip66.decode(sig);if(sigObj.r.length===33&&sigObj.r[0]===0)sigObj.r=sigObj.r.slice(1);if(sigObj.r.length>32)throw new Error("R length is too long");if(sigObj.s.length===33&&sigObj.s[0]===0)sigObj.s=sigObj.s.slice(1);if(sigObj.s.length>32)throw new Error("S length is too long")}catch(err){return}sigObj.r.copy(r,32-sigObj.r.length);sigObj.s.copy(s,32-sigObj.s.length);return{r:r,s:s}};exports.signatureImportLax=function(sig){var r=Buffer.alloc(32,0);var s=Buffer.alloc(32,0);var length=sig.length;var index=0;if(sig[index++]!==48)return;var lenbyte=sig[index++];if(lenbyte&128){index+=lenbyte-128;if(index>length)return}if(sig[index++]!==2)return;var rlen=sig[index++];if(rlen&128){lenbyte=rlen-128;if(index+lenbyte>length)return;for(;lenbyte>0&&sig[index]===0;index+=1,lenbyte-=1);for(rlen=0;lenbyte>0;index+=1,lenbyte-=1)rlen=(rlen<<8)+sig[index]}if(rlen>length-index)return;var rindex=index;index+=rlen;if(sig[index++]!==2)return;var slen=sig[index++];if(slen&128){lenbyte=slen-128;if(index+lenbyte>length)return;for(;lenbyte>0&&sig[index]===0;index+=1,lenbyte-=1);for(slen=0;lenbyte>0;index+=1,lenbyte-=1)slen=(slen<<8)+sig[index]}if(slen>length-index)return;var sindex=index;index+=slen;for(;rlen>0&&sig[rindex]===0;rlen-=1,rindex+=1);if(rlen>32)return;var rvalue=sig.slice(rindex,rindex+rlen);rvalue.copy(r,32-rvalue.length);for(;slen>0&&sig[sindex]===0;slen-=1,sindex+=1);if(slen>32)return;var svalue=sig.slice(sindex,sindex+slen);svalue.copy(s,32-svalue.length);return{r:r,s:s}}},{bip66:6,"safe-buffer":234}],238:[function(require,module,exports){"use strict";var Buffer=require("safe-buffer").Buffer;var createHash=require("create-hash");var BN=require("bn.js");var EC=require("elliptic").ec;var messages=require("../messages.json");var ec=new EC("secp256k1");var ecparams=ec.curve;function loadCompressedPublicKey(first,xBuffer){var x=new BN(xBuffer);if(x.cmp(ecparams.p)>=0)return null;x=x.toRed(ecparams.red);var y=x.redSqr().redIMul(x).redIAdd(ecparams.b).redSqrt();if(first===3!==y.isOdd())y=y.redNeg();return ec.keyPair({pub:{x:x,y:y}})}function loadUncompressedPublicKey(first,xBuffer,yBuffer){var x=new BN(xBuffer);var y=new BN(yBuffer);if(x.cmp(ecparams.p)>=0||y.cmp(ecparams.p)>=0)return null;x=x.toRed(ecparams.red);y=y.toRed(ecparams.red);if((first===6||first===7)&&y.isOdd()!==(first===7))return null;var x3=x.redSqr().redIMul(x);if(!y.redSqr().redISub(x3.redIAdd(ecparams.b)).isZero())return null;return ec.keyPair({pub:{x:x,y:y}})}function loadPublicKey(publicKey){var first=publicKey[0];switch(first){case 2:case 3:if(publicKey.length!==33)return null;return loadCompressedPublicKey(first,publicKey.slice(1,33));case 4:case 6:case 7:if(publicKey.length!==65)return null;return loadUncompressedPublicKey(first,publicKey.slice(1,33),publicKey.slice(33,65));default:return null}}exports.privateKeyVerify=function(privateKey){var bn=new BN(privateKey);return bn.cmp(ecparams.n)<0&&!bn.isZero()};exports.privateKeyExport=function(privateKey,compressed){var d=new BN(privateKey);if(d.cmp(ecparams.n)>=0||d.isZero())throw new Error(messages.EC_PRIVATE_KEY_EXPORT_DER_FAIL);return Buffer.from(ec.keyFromPrivate(privateKey).getPublic(compressed,true))};exports.privateKeyTweakAdd=function(privateKey,tweak){var bn=new BN(tweak);if(bn.cmp(ecparams.n)>=0)throw new Error(messages.EC_PRIVATE_KEY_TWEAK_ADD_FAIL);bn.iadd(new BN(privateKey));if(bn.cmp(ecparams.n)>=0)bn.isub(ecparams.n);if(bn.isZero())throw new Error(messages.EC_PRIVATE_KEY_TWEAK_ADD_FAIL);return bn.toArrayLike(Buffer,"be",32)};exports.privateKeyTweakMul=function(privateKey,tweak){var bn=new BN(tweak);if(bn.cmp(ecparams.n)>=0||bn.isZero())throw new Error(messages.EC_PRIVATE_KEY_TWEAK_MUL_FAIL);bn.imul(new BN(privateKey));if(bn.cmp(ecparams.n))bn=bn.umod(ecparams.n);return bn.toArrayLike(Buffer,"be",32)};exports.publicKeyCreate=function(privateKey,compressed){var d=new BN(privateKey);if(d.cmp(ecparams.n)>=0||d.isZero())throw new Error(messages.EC_PUBLIC_KEY_CREATE_FAIL);return Buffer.from(ec.keyFromPrivate(privateKey).getPublic(compressed,true))};exports.publicKeyConvert=function(publicKey,compressed){var pair=loadPublicKey(publicKey);if(pair===null)throw new Error(messages.EC_PUBLIC_KEY_PARSE_FAIL);return Buffer.from(pair.getPublic(compressed,true))};exports.publicKeyVerify=function(publicKey){return loadPublicKey(publicKey)!==null};exports.publicKeyTweakAdd=function(publicKey,tweak,compressed){var pair=loadPublicKey(publicKey);if(pair===null)throw new Error(messages.EC_PUBLIC_KEY_PARSE_FAIL);tweak=new BN(tweak);if(tweak.cmp(ecparams.n)>=0)throw new Error(messages.EC_PUBLIC_KEY_TWEAK_ADD_FAIL);return Buffer.from(ecparams.g.mul(tweak).add(pair.pub).encode(true,compressed))};exports.publicKeyTweakMul=function(publicKey,tweak,compressed){var pair=loadPublicKey(publicKey);if(pair===null)throw new Error(messages.EC_PUBLIC_KEY_PARSE_FAIL);tweak=new BN(tweak);if(tweak.cmp(ecparams.n)>=0||tweak.isZero())throw new Error(messages.EC_PUBLIC_KEY_TWEAK_MUL_FAIL);return Buffer.from(pair.pub.mul(tweak).encode(true,compressed))};exports.publicKeyCombine=function(publicKeys,compressed){var pairs=new Array(publicKeys.length);for(var i=0;i=0||s.cmp(ecparams.n)>=0)throw new Error(messages.ECDSA_SIGNATURE_PARSE_FAIL);var result=Buffer.from(signature);if(s.cmp(ec.nh)===1)ecparams.n.sub(s).toArrayLike(Buffer,"be",32).copy(result,32);return result};exports.signatureExport=function(signature){var r=signature.slice(0,32);var s=signature.slice(32,64);if(new BN(r).cmp(ecparams.n)>=0||new BN(s).cmp(ecparams.n)>=0)throw new Error(messages.ECDSA_SIGNATURE_PARSE_FAIL);return{r:r,s:s}};exports.signatureImport=function(sigObj){var r=new BN(sigObj.r);if(r.cmp(ecparams.n)>=0)r=new BN(0);var s=new BN(sigObj.s);if(s.cmp(ecparams.n)>=0)s=new BN(0);return Buffer.concat([r.toArrayLike(Buffer,"be",32),s.toArrayLike(Buffer,"be",32)])};exports.sign=function(message,privateKey,noncefn,data){if(typeof noncefn==="function"){var getNonce=noncefn;noncefn=function(counter){var nonce=getNonce(message,privateKey,null,data,counter);if(!Buffer.isBuffer(nonce)||nonce.length!==32)throw new Error(messages.ECDSA_SIGN_FAIL);return new BN(nonce)}}var d=new BN(privateKey);if(d.cmp(ecparams.n)>=0||d.isZero())throw new Error(messages.ECDSA_SIGN_FAIL);var result=ec.sign(message,privateKey,{canonical:true,k:noncefn,pers:data});return{signature:Buffer.concat([result.r.toArrayLike(Buffer,"be",32),result.s.toArrayLike(Buffer,"be",32)]),recovery:result.recoveryParam}};exports.verify=function(message,signature,publicKey){var sigObj={r:signature.slice(0,32),s:signature.slice(32,64)};var sigr=new BN(sigObj.r);var sigs=new BN(sigObj.s);if(sigr.cmp(ecparams.n)>=0||sigs.cmp(ecparams.n)>=0)throw new Error(messages.ECDSA_SIGNATURE_PARSE_FAIL);if(sigs.cmp(ec.nh)===1||sigr.isZero()||sigs.isZero())return false;var pair=loadPublicKey(publicKey);if(pair===null)throw new Error(messages.EC_PUBLIC_KEY_PARSE_FAIL);return ec.verify(message,sigObj,{x:pair.pub.x,y:pair.pub.y})};exports.recover=function(message,signature,recovery,compressed){var sigObj={r:signature.slice(0,32),s:signature.slice(32,64)};var sigr=new BN(sigObj.r);var sigs=new BN(sigObj.s);if(sigr.cmp(ecparams.n)>=0||sigs.cmp(ecparams.n)>=0)throw new Error(messages.ECDSA_SIGNATURE_PARSE_FAIL);try{if(sigr.isZero()||sigs.isZero())throw new Error;var point=ec.recoverPubKey(message,sigObj,recovery);return Buffer.from(point.encode(true,compressed))}catch(err){throw new Error(messages.ECDSA_RECOVER_FAIL)}};exports.ecdh=function(publicKey,privateKey){var shared=exports.ecdhUnsafe(publicKey,privateKey,true);return createHash("sha256").update(shared).digest()};exports.ecdhUnsafe=function(publicKey,privateKey,compressed){var pair=loadPublicKey(publicKey);if(pair===null)throw new Error(messages.EC_PUBLIC_KEY_PARSE_FAIL);var scalar=new BN(privateKey);if(scalar.cmp(ecparams.n)>=0||scalar.isZero())throw new Error(messages.ECDH_FAIL);return Buffer.from(pair.pub.mul(scalar).encode(true,compressed))}},{"../messages.json":240,"bn.js":7,"create-hash":18,elliptic:21,"safe-buffer":234}],239:[function(require,module,exports){"use strict";var assert=require("./assert");var der=require("./der");var messages=require("./messages.json");function initCompressedValue(value,defaultValue){if(value===undefined)return defaultValue;assert.isBoolean(value,messages.COMPRESSED_TYPE_INVALID);return value}module.exports=function(secp256k1){return{privateKeyVerify:function(privateKey){assert.isBuffer(privateKey,messages.EC_PRIVATE_KEY_TYPE_INVALID);return privateKey.length===32&&secp256k1.privateKeyVerify(privateKey)},privateKeyExport:function(privateKey,compressed){assert.isBuffer(privateKey,messages.EC_PRIVATE_KEY_TYPE_INVALID);assert.isBufferLength(privateKey,32,messages.EC_PRIVATE_KEY_LENGTH_INVALID);compressed=initCompressedValue(compressed,true);var publicKey=secp256k1.privateKeyExport(privateKey,compressed);return der.privateKeyExport(privateKey,publicKey,compressed)},privateKeyImport:function(privateKey){assert.isBuffer(privateKey,messages.EC_PRIVATE_KEY_TYPE_INVALID);privateKey=der.privateKeyImport(privateKey);if(privateKey&&privateKey.length===32&&secp256k1.privateKeyVerify(privateKey))return privateKey;throw new Error(messages.EC_PRIVATE_KEY_IMPORT_DER_FAIL)},privateKeyTweakAdd:function(privateKey,tweak){assert.isBuffer(privateKey,messages.EC_PRIVATE_KEY_TYPE_INVALID);assert.isBufferLength(privateKey,32,messages.EC_PRIVATE_KEY_LENGTH_INVALID);assert.isBuffer(tweak,messages.TWEAK_TYPE_INVALID);assert.isBufferLength(tweak,32,messages.TWEAK_LENGTH_INVALID);return secp256k1.privateKeyTweakAdd(privateKey,tweak)},privateKeyTweakMul:function(privateKey,tweak){assert.isBuffer(privateKey,messages.EC_PRIVATE_KEY_TYPE_INVALID);assert.isBufferLength(privateKey,32,messages.EC_PRIVATE_KEY_LENGTH_INVALID);assert.isBuffer(tweak,messages.TWEAK_TYPE_INVALID);assert.isBufferLength(tweak,32,messages.TWEAK_LENGTH_INVALID);return secp256k1.privateKeyTweakMul(privateKey,tweak)},publicKeyCreate:function(privateKey,compressed){assert.isBuffer(privateKey,messages.EC_PRIVATE_KEY_TYPE_INVALID);assert.isBufferLength(privateKey,32,messages.EC_PRIVATE_KEY_LENGTH_INVALID);compressed=initCompressedValue(compressed,true);return secp256k1.publicKeyCreate(privateKey,compressed)},publicKeyConvert:function(publicKey,compressed){assert.isBuffer(publicKey,messages.EC_PUBLIC_KEY_TYPE_INVALID);assert.isBufferLength2(publicKey,33,65,messages.EC_PUBLIC_KEY_LENGTH_INVALID);compressed=initCompressedValue(compressed,true);return secp256k1.publicKeyConvert(publicKey,compressed)},publicKeyVerify:function(publicKey){assert.isBuffer(publicKey,messages.EC_PUBLIC_KEY_TYPE_INVALID);return secp256k1.publicKeyVerify(publicKey)},publicKeyTweakAdd:function(publicKey,tweak,compressed){assert.isBuffer(publicKey,messages.EC_PUBLIC_KEY_TYPE_INVALID);assert.isBufferLength2(publicKey,33,65,messages.EC_PUBLIC_KEY_LENGTH_INVALID);assert.isBuffer(tweak,messages.TWEAK_TYPE_INVALID);assert.isBufferLength(tweak,32,messages.TWEAK_LENGTH_INVALID);compressed=initCompressedValue(compressed,true);return secp256k1.publicKeyTweakAdd(publicKey,tweak,compressed)},publicKeyTweakMul:function(publicKey,tweak,compressed){assert.isBuffer(publicKey,messages.EC_PUBLIC_KEY_TYPE_INVALID);assert.isBufferLength2(publicKey,33,65,messages.EC_PUBLIC_KEY_LENGTH_INVALID);assert.isBuffer(tweak,messages.TWEAK_TYPE_INVALID);assert.isBufferLength(tweak,32,messages.TWEAK_LENGTH_INVALID);compressed=initCompressedValue(compressed,true);return secp256k1.publicKeyTweakMul(publicKey,tweak,compressed)},publicKeyCombine:function(publicKeys,compressed){assert.isArray(publicKeys,messages.EC_PUBLIC_KEYS_TYPE_INVALID);assert.isLengthGTZero(publicKeys,messages.EC_PUBLIC_KEYS_LENGTH_INVALID);for(var i=0;i=this._finalSize){this._update(this._block);this._block.fill(0)}var bits=this._len*8;if(bits<=4294967295){this._block.writeUInt32BE(bits,this._blockSize-4)}else{var lowBits=bits&4294967295;var highBits=(bits-lowBits)/4294967296;this._block.writeUInt32BE(highBits,this._blockSize-8);this._block.writeUInt32BE(lowBits,this._blockSize-4)}this._update(this._block);var hash=this._hash();return enc?hash.toString(enc):hash};Hash.prototype._update=function(){throw new Error("_update must be implemented by subclass")};module.exports=Hash},{"safe-buffer":234}],242:[function(require,module,exports){var exports=module.exports=function SHA(algorithm){algorithm=algorithm.toLowerCase();var Algorithm=exports[algorithm];if(!Algorithm)throw new Error(algorithm+" is not supported (we accept pull requests)");return new Algorithm};exports.sha=require("./sha");exports.sha1=require("./sha1");exports.sha224=require("./sha224");exports.sha256=require("./sha256");exports.sha384=require("./sha384");exports.sha512=require("./sha512")},{"./sha":243,"./sha1":244,"./sha224":245,"./sha256":246,"./sha384":247,"./sha512":248}],243:[function(require,module,exports){var inherits=require("inherits");var Hash=require("./hash");var Buffer=require("safe-buffer").Buffer;var K=[1518500249,1859775393,2400959708|0,3395469782|0];var W=new Array(80);function Sha(){this.init();this._w=W;Hash.call(this,64,56)}inherits(Sha,Hash);Sha.prototype.init=function(){this._a=1732584193;this._b=4023233417;this._c=2562383102;this._d=271733878;this._e=3285377520;return this};function rotl5(num){return num<<5|num>>>27}function rotl30(num){return num<<30|num>>>2}function ft(s,b,c,d){if(s===0)return b&c|~b&d;if(s===2)return b&c|b&d|c&d;return b^c^d}Sha.prototype._update=function(M){var W=this._w;var a=this._a|0;var b=this._b|0;var c=this._c|0;var d=this._d|0;var e=this._e|0;for(var i=0;i<16;++i)W[i]=M.readInt32BE(i*4);for(;i<80;++i)W[i]=W[i-3]^W[i-8]^W[i-14]^W[i-16];for(var j=0;j<80;++j){var s=~~(j/20);var t=rotl5(a)+ft(s,b,c,d)+e+W[j]+K[s]|0;e=d;d=c;c=rotl30(b);b=a;a=t}this._a=a+this._a|0;this._b=b+this._b|0;this._c=c+this._c|0;this._d=d+this._d|0;this._e=e+this._e|0};Sha.prototype._hash=function(){var H=Buffer.allocUnsafe(20);H.writeInt32BE(this._a|0,0);H.writeInt32BE(this._b|0,4);H.writeInt32BE(this._c|0,8);H.writeInt32BE(this._d|0,12);H.writeInt32BE(this._e|0,16);return H};module.exports=Sha},{"./hash":241,inherits:180,"safe-buffer":234}],244:[function(require,module,exports){var inherits=require("inherits");var Hash=require("./hash");var Buffer=require("safe-buffer").Buffer;var K=[1518500249,1859775393,2400959708|0,3395469782|0];var W=new Array(80);function Sha1(){this.init();this._w=W;Hash.call(this,64,56)}inherits(Sha1,Hash);Sha1.prototype.init=function(){this._a=1732584193;this._b=4023233417;this._c=2562383102;this._d=271733878;this._e=3285377520;return this};function rotl1(num){return num<<1|num>>>31}function rotl5(num){return num<<5|num>>>27}function rotl30(num){return num<<30|num>>>2}function ft(s,b,c,d){if(s===0)return b&c|~b&d;if(s===2)return b&c|b&d|c&d;return b^c^d}Sha1.prototype._update=function(M){var W=this._w;var a=this._a|0;var b=this._b|0;var c=this._c|0;var d=this._d|0;var e=this._e|0;for(var i=0;i<16;++i)W[i]=M.readInt32BE(i*4);for(;i<80;++i)W[i]=rotl1(W[i-3]^W[i-8]^W[i-14]^W[i-16]);for(var j=0;j<80;++j){var s=~~(j/20);var t=rotl5(a)+ft(s,b,c,d)+e+W[j]+K[s]|0;e=d;d=c;c=rotl30(b);b=a;a=t}this._a=a+this._a|0;this._b=b+this._b|0;this._c=c+this._c|0;this._d=d+this._d|0;this._e=e+this._e|0};Sha1.prototype._hash=function(){var H=Buffer.allocUnsafe(20);H.writeInt32BE(this._a|0,0);H.writeInt32BE(this._b|0,4);H.writeInt32BE(this._c|0,8);H.writeInt32BE(this._d|0,12);H.writeInt32BE(this._e|0,16);return H};module.exports=Sha1},{"./hash":241,inherits:180,"safe-buffer":234}],245:[function(require,module,exports){var inherits=require("inherits");var Sha256=require("./sha256"); var Hash=require("./hash");var Buffer=require("safe-buffer").Buffer;var W=new Array(64);function Sha224(){this.init();this._w=W;Hash.call(this,64,56)}inherits(Sha224,Sha256);Sha224.prototype.init=function(){this._a=3238371032;this._b=914150663;this._c=812702999;this._d=4144912697;this._e=4290775857;this._f=1750603025;this._g=1694076839;this._h=3204075428;return this};Sha224.prototype._hash=function(){var H=Buffer.allocUnsafe(28);H.writeInt32BE(this._a,0);H.writeInt32BE(this._b,4);H.writeInt32BE(this._c,8);H.writeInt32BE(this._d,12);H.writeInt32BE(this._e,16);H.writeInt32BE(this._f,20);H.writeInt32BE(this._g,24);return H};module.exports=Sha224},{"./hash":241,"./sha256":246,inherits:180,"safe-buffer":234}],246:[function(require,module,exports){var inherits=require("inherits");var Hash=require("./hash");var Buffer=require("safe-buffer").Buffer;var K=[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];var W=new Array(64);function Sha256(){this.init();this._w=W;Hash.call(this,64,56)}inherits(Sha256,Hash);Sha256.prototype.init=function(){this._a=1779033703;this._b=3144134277;this._c=1013904242;this._d=2773480762;this._e=1359893119;this._f=2600822924;this._g=528734635;this._h=1541459225;return this};function ch(x,y,z){return z^x&(y^z)}function maj(x,y,z){return x&y|z&(x|y)}function sigma0(x){return(x>>>2|x<<30)^(x>>>13|x<<19)^(x>>>22|x<<10)}function sigma1(x){return(x>>>6|x<<26)^(x>>>11|x<<21)^(x>>>25|x<<7)}function gamma0(x){return(x>>>7|x<<25)^(x>>>18|x<<14)^x>>>3}function gamma1(x){return(x>>>17|x<<15)^(x>>>19|x<<13)^x>>>10}Sha256.prototype._update=function(M){var W=this._w;var a=this._a|0;var b=this._b|0;var c=this._c|0;var d=this._d|0;var e=this._e|0;var f=this._f|0;var g=this._g|0;var h=this._h|0;for(var i=0;i<16;++i)W[i]=M.readInt32BE(i*4);for(;i<64;++i)W[i]=gamma1(W[i-2])+W[i-7]+gamma0(W[i-15])+W[i-16]|0;for(var j=0;j<64;++j){var T1=h+sigma1(e)+ch(e,f,g)+K[j]+W[j]|0;var T2=sigma0(a)+maj(a,b,c)|0;h=g;g=f;f=e;e=d+T1|0;d=c;c=b;b=a;a=T1+T2|0}this._a=a+this._a|0;this._b=b+this._b|0;this._c=c+this._c|0;this._d=d+this._d|0;this._e=e+this._e|0;this._f=f+this._f|0;this._g=g+this._g|0;this._h=h+this._h|0};Sha256.prototype._hash=function(){var H=Buffer.allocUnsafe(32);H.writeInt32BE(this._a,0);H.writeInt32BE(this._b,4);H.writeInt32BE(this._c,8);H.writeInt32BE(this._d,12);H.writeInt32BE(this._e,16);H.writeInt32BE(this._f,20);H.writeInt32BE(this._g,24);H.writeInt32BE(this._h,28);return H};module.exports=Sha256},{"./hash":241,inherits:180,"safe-buffer":234}],247:[function(require,module,exports){var inherits=require("inherits");var SHA512=require("./sha512");var Hash=require("./hash");var Buffer=require("safe-buffer").Buffer;var W=new Array(160);function Sha384(){this.init();this._w=W;Hash.call(this,128,112)}inherits(Sha384,SHA512);Sha384.prototype.init=function(){this._ah=3418070365;this._bh=1654270250;this._ch=2438529370;this._dh=355462360;this._eh=1731405415;this._fh=2394180231;this._gh=3675008525;this._hh=1203062813;this._al=3238371032;this._bl=914150663;this._cl=812702999;this._dl=4144912697;this._el=4290775857;this._fl=1750603025;this._gl=1694076839;this._hl=3204075428;return this};Sha384.prototype._hash=function(){var H=Buffer.allocUnsafe(48);function writeInt64BE(h,l,offset){H.writeInt32BE(h,offset);H.writeInt32BE(l,offset+4)}writeInt64BE(this._ah,this._al,0);writeInt64BE(this._bh,this._bl,8);writeInt64BE(this._ch,this._cl,16);writeInt64BE(this._dh,this._dl,24);writeInt64BE(this._eh,this._el,32);writeInt64BE(this._fh,this._fl,40);return H};module.exports=Sha384},{"./hash":241,"./sha512":248,inherits:180,"safe-buffer":234}],248:[function(require,module,exports){var inherits=require("inherits");var Hash=require("./hash");var Buffer=require("safe-buffer").Buffer;var K=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];var W=new Array(160);function Sha512(){this.init();this._w=W;Hash.call(this,128,112)}inherits(Sha512,Hash);Sha512.prototype.init=function(){this._ah=1779033703;this._bh=3144134277;this._ch=1013904242;this._dh=2773480762;this._eh=1359893119;this._fh=2600822924;this._gh=528734635;this._hh=1541459225;this._al=4089235720;this._bl=2227873595;this._cl=4271175723;this._dl=1595750129;this._el=2917565137;this._fl=725511199;this._gl=4215389547;this._hl=327033209;return this};function Ch(x,y,z){return z^x&(y^z)}function maj(x,y,z){return x&y|z&(x|y)}function sigma0(x,xl){return(x>>>28|xl<<4)^(xl>>>2|x<<30)^(xl>>>7|x<<25)}function sigma1(x,xl){return(x>>>14|xl<<18)^(x>>>18|xl<<14)^(xl>>>9|x<<23)}function Gamma0(x,xl){return(x>>>1|xl<<31)^(x>>>8|xl<<24)^x>>>7}function Gamma0l(x,xl){return(x>>>1|xl<<31)^(x>>>8|xl<<24)^(x>>>7|xl<<25)}function Gamma1(x,xl){return(x>>>19|xl<<13)^(xl>>>29|x<<3)^x>>>6}function Gamma1l(x,xl){return(x>>>19|xl<<13)^(xl>>>29|x<<3)^(x>>>6|xl<<26)}function getCarry(a,b){return a>>>0>>0?1:0}Sha512.prototype._update=function(M){var W=this._w;var ah=this._ah|0;var bh=this._bh|0;var ch=this._ch|0;var dh=this._dh|0;var eh=this._eh|0;var fh=this._fh|0;var gh=this._gh|0;var hh=this._hh|0;var al=this._al|0;var bl=this._bl|0;var cl=this._cl|0;var dl=this._dl|0;var el=this._el|0;var fl=this._fl|0;var gl=this._gl|0;var hl=this._hl|0;for(var i=0;i<32;i+=2){W[i]=M.readInt32BE(i*4);W[i+1]=M.readInt32BE(i*4+4)}for(;i<160;i+=2){var xh=W[i-15*2];var xl=W[i-15*2+1];var gamma0=Gamma0(xh,xl);var gamma0l=Gamma0l(xl,xh);xh=W[i-2*2];xl=W[i-2*2+1];var gamma1=Gamma1(xh,xl);var gamma1l=Gamma1l(xl,xh);var Wi7h=W[i-7*2];var Wi7l=W[i-7*2+1];var Wi16h=W[i-16*2];var Wi16l=W[i-16*2+1];var Wil=gamma0l+Wi7l|0;var Wih=gamma0+Wi7h+getCarry(Wil,gamma0l)|0;Wil=Wil+gamma1l|0;Wih=Wih+gamma1+getCarry(Wil,gamma1l)|0;Wil=Wil+Wi16l|0;Wih=Wih+Wi16h+getCarry(Wil,Wi16l)|0;W[i]=Wih;W[i+1]=Wil}for(var j=0;j<160;j+=2){Wih=W[j];Wil=W[j+1];var majh=maj(ah,bh,ch);var majl=maj(al,bl,cl);var sigma0h=sigma0(ah,al);var sigma0l=sigma0(al,ah);var sigma1h=sigma1(eh,el);var sigma1l=sigma1(el,eh);var Kih=K[j];var Kil=K[j+1];var chh=Ch(eh,fh,gh);var chl=Ch(el,fl,gl);var t1l=hl+sigma1l|0;var t1h=hh+sigma1h+getCarry(t1l,hl)|0;t1l=t1l+chl|0;t1h=t1h+chh+getCarry(t1l,chl)|0;t1l=t1l+Kil|0;t1h=t1h+Kih+getCarry(t1l,Kil)|0;t1l=t1l+Wil|0;t1h=t1h+Wih+getCarry(t1l,Wil)|0;var t2l=sigma0l+majl|0;var t2h=sigma0h+majh+getCarry(t2l,sigma0l)|0;hh=gh;hl=gl;gh=fh;gl=fl;fh=eh;fl=el;el=dl+t1l|0;eh=dh+t1h+getCarry(el,dl)|0;dh=ch;dl=cl;ch=bh;cl=bl;bh=ah;bl=al;al=t1l+t2l|0;ah=t1h+t2h+getCarry(al,t1l)|0}this._al=this._al+al|0;this._bl=this._bl+bl|0;this._cl=this._cl+cl|0;this._dl=this._dl+dl|0;this._el=this._el+el|0;this._fl=this._fl+fl|0;this._gl=this._gl+gl|0;this._hl=this._hl+hl|0;this._ah=this._ah+ah+getCarry(this._al,al)|0;this._bh=this._bh+bh+getCarry(this._bl,bl)|0;this._ch=this._ch+ch+getCarry(this._cl,cl)|0;this._dh=this._dh+dh+getCarry(this._dl,dl)|0;this._eh=this._eh+eh+getCarry(this._el,el)|0;this._fh=this._fh+fh+getCarry(this._fl,fl)|0;this._gh=this._gh+gh+getCarry(this._gl,gl)|0;this._hh=this._hh+hh+getCarry(this._hl,hl)|0};Sha512.prototype._hash=function(){var H=Buffer.allocUnsafe(64);function writeInt64BE(h,l,offset){H.writeInt32BE(h,offset);H.writeInt32BE(l,offset+4)}writeInt64BE(this._ah,this._al,0);writeInt64BE(this._bh,this._bl,8);writeInt64BE(this._ch,this._cl,16);writeInt64BE(this._dh,this._dl,24);writeInt64BE(this._eh,this._el,32);writeInt64BE(this._fh,this._fl,40);writeInt64BE(this._gh,this._gl,48);writeInt64BE(this._hh,this._hl,56);return H};module.exports=Sha512},{"./hash":241,inherits:180,"safe-buffer":234}],249:[function(require,module,exports){"use strict";var byteArrayToUtf8String=require("./byte-array-to-utf8-string");var removeTrailingZeros=require("./remove-trailing-zeros");function abiDecodeBytes(abiEncodedBytes,strip){var hex=abiEncodedBytes.toString();if(hex.slice(0,2)==="0x")hex=hex.slice(2);if(strip){hex=hex.slice(128);hex=removeTrailingZeros(hex)}return byteArrayToUtf8String(hex)}module.exports=abiDecodeBytes},{"./byte-array-to-utf8-string":260,"./remove-trailing-zeros":276}],250:[function(require,module,exports){(function(Buffer){"use strict";var rawDecode=require("ethereumjs-abi").rawDecode;var formatAbiRawDecodedDataArray=require("./format-abi-raw-decoded-data-array");var strip0xPrefix=require("./strip-0x-prefix");function abiDecodeData(inputs,abiEncodedData){var dataInputTypes=inputs.filter(function(input){return!input.indexed}).map(function(input){return input.type});var abiRawDecodedDataArray=rawDecode(dataInputTypes,Buffer.from(strip0xPrefix(abiEncodedData),"hex"));return formatAbiRawDecodedDataArray(dataInputTypes,abiRawDecodedDataArray)}module.exports=abiDecodeData}).call(this,require("buffer").Buffer)},{"./format-abi-raw-decoded-data-array":266,"./strip-0x-prefix":278,buffer:14,"ethereumjs-abi":39}],251:[function(require,module,exports){"use strict";var abiDecodeData=require("./abi-decode-data");var formatInt256=require("./format-int256");function abiDecodeRpcResponse(responseType,abiEncodedRpcResponse){var decodedRpcResponse=abiDecodeData([{type:responseType}],abiEncodedRpcResponse)[0];if(responseType==="bool"){if(decodedRpcResponse==="true")return true;return false}else if(responseType.slice(0,7)==="bytes32"){return formatInt256(decodedRpcResponse)}return decodedRpcResponse}module.exports=abiDecodeRpcResponse},{"./abi-decode-data":250,"./format-int256":269}],252:[function(require,module,exports){(function(Buffer){"use strict";var removeTrailingZeros=require("./remove-trailing-zeros");var strip0xPrefix=require("./strip-0x-prefix");function abiDecodeShortStringAsInt256(int256){return Buffer.from(strip0xPrefix(removeTrailingZeros(int256)),"hex").toString("utf8")}module.exports=abiDecodeShortStringAsInt256}).call(this,require("buffer").Buffer)},{"./remove-trailing-zeros":276,"./strip-0x-prefix":278,buffer:14}],253:[function(require,module,exports){"use strict";var rawEncode=require("ethereumjs-abi").rawEncode;var removeTrailingZeros=require("./remove-trailing-zeros");function abiEncodeBytes(bytesToEncode,isPadded){var abiEncodedBytes=rawEncode(["bytes"],[bytesToEncode]).toString("hex");if(isPadded)return abiEncodedBytes;return removeTrailingZeros(abiEncodedBytes).slice(128)}module.exports=abiEncodeBytes},{"./remove-trailing-zeros":276,"ethereumjs-abi":39}],254:[function(require,module,exports){"use strict";var ethereumjsAbi=require("ethereumjs-abi");function abiEncodeData(payload,format){var abiEncodedData=ethereumjsAbi.rawEncode(payload.signature||[],payload.params);if(format==="hex")return"0x"+abiEncodedData.toString("hex");return abiEncodedData}module.exports=abiEncodeData},{"ethereumjs-abi":39}],255:[function(require,module,exports){"use strict";var rawEncode=require("ethereumjs-abi").rawEncode;function abiEncodeInt256(value){return rawEncode(["int256"],[value]).toString("hex")}module.exports=abiEncodeInt256},{"ethereumjs-abi":39}],256:[function(require,module,exports){(function(Buffer){"use strict";var padRight=require("./pad-right");var prefixHex=require("./prefix-hex");function abiEncodeShortStringAsInt256(shortString){var encoded=shortString;if(encoded.length>32)encoded=encoded.slice(0,32);return prefixHex(padRight(Buffer.from(encoded,"utf8").toString("hex")))}module.exports=abiEncodeShortStringAsInt256}).call(this,require("buffer").Buffer)},{"./pad-right":274,"./prefix-hex":275,buffer:14}],257:[function(require,module,exports){(function(Buffer){"use strict";var ethereumjsAbi=require("ethereumjs-abi");var abiEncodeData=require("./abi-encode-data");var prefixHex=require("./prefix-hex");function abiEncodeTransactionPayload(payload){payload.signature=payload.signature||[];return prefixHex(Buffer.concat([ethereumjsAbi.methodID(payload.name,payload.signature),abiEncodeData(payload)]).toString("hex"))}module.exports=abiEncodeTransactionPayload}).call(this,require("buffer").Buffer)},{"./abi-encode-data":254,"./prefix-hex":275,buffer:14,"ethereumjs-abi":39}],258:[function(require,module,exports){"use strict";var BigNumber=require("bignumber.js");var isHex=require("./is-hex");var prefixHex=require("./prefix-hex");var wrap=require("./wrap");function bignum(n,encoding,isWrapped){var bn,len;if(n!==null&&n!==undefined&&n!=="0x"&&!n.error&&!n.message){switch(n.constructor){case BigNumber:bn=n;break;case Number:bn=new BigNumber(n,10);break;case String:try{bn=new BigNumber(n,10)}catch(exc){if(isHex(n)){bn=new BigNumber(n,16)}else{return n}}break;case Array:len=n.length;bn=new Array(len);for(var i=0;i40&&addr.slice(0,1)==="0"){addr=addr.slice(1)}while(addr.length<40){addr="0"+addr}return prefixHex(addr)}}module.exports=formatEthereumAddress},{"./prefix-hex":275,"./strip-0x-prefix":278}],269:[function(require,module,exports){(function(Buffer){"use strict";var padLeft=require("./pad-left");var prefixHex=require("./prefix-hex");var strip0xPrefix=require("./strip-0x-prefix");var unfork=require("./unfork");function formatInt256(s){if(s===undefined||s===null||s==="0x")return s;if(Array.isArray(s))return s.map(formatInt256);if(Buffer.isBuffer(s))s=s.toString("hex");if(s.constructor!==String)s=s.toString(16);if(s.slice(0,1)==="-")s=unfork(s);s=strip0xPrefix(s);if(s.length>64)s=s.slice(0,64);return prefixHex(padLeft(s))}module.exports=formatInt256}).call(this,{isBuffer:require("../../is-buffer/index.js")})},{"../../is-buffer/index.js":181,"./pad-left":273,"./prefix-hex":275,"./strip-0x-prefix":278,"./unfork":281}],270:[function(require,module,exports){(function(Buffer){"use strict";var BigNumber=require("bignumber.js");var abiEncodeBytes=require("./abi-encode-bytes");var bignum=require("./bignum");var prefixHex=require("./prefix-hex");var wrap=require("./wrap");function hex(n,isWrapped){var h;if(n!==undefined&&n!==null&&n.constructor){switch(n.constructor){case Buffer:h=hex(prefixHex(n.toString("hex")),isWrapped);break;case Object:h=abiEncodeBytes(JSON.stringify(n));break;case Array:h=bignum(n,"hex",isWrapped);break;case BigNumber:if(isWrapped){h=wrap(n.floor()).toString(16)}else{h=n.floor().toString(16)}break;case String:if(n==="-0x0"){h="0x0"}else if(n==="-0"){h="0"}else if(n.slice(0,3)==="-0x"||n.slice(0,2)==="-0x"){h=bignum(n,"hex",isWrapped)}else{if(isFinite(n)){h=bignum(n,"hex",isWrapped)}else{h=abiEncodeBytes(n)}}break;case Boolean:h=n?"0x1":"0x0";break;default:h=bignum(n,"hex",isWrapped)}}return prefixHex(h)}module.exports=hex}).call(this,require("buffer").Buffer)},{"./abi-encode-bytes":253,"./bignum":258,"./prefix-hex":275,"./wrap":283,"bignumber.js":5,buffer:14}],271:[function(require,module,exports){"use strict";var BigNumber=require("bignumber.js");BigNumber.config({MODULO_MODE:BigNumber.EUCLID,ROUNDING_MODE:BigNumber.ROUND_HALF_DOWN});module.exports={version:"2.1.2",constants:require("./constants"),unrollArray:require("./unroll-array"),byteArrayToUtf8String:require("./byte-array-to-utf8-string"),byteArrayToHexString:require("./byte-array-to-hex-string"),abiEncodeShortStringAsInt256:require("./abi-encode-short-string-as-int256"),abiDecodeShortStringAsInt256:require("./abi-decode-short-string-as-int256"),abiEncodeBytes:require("./abi-encode-bytes"),abiDecodeBytes:require("./abi-decode-bytes"),unfork:require("./unfork"),hex:require("./hex"),isHex:require("./is-hex"),formatInt256:require("./format-int256"),formatEthereumAddress:require("./format-ethereum-address"),strip0xPrefix:require("./strip-0x-prefix"),prefixHex:require("./prefix-hex"),bignum:require("./bignum"),fix:require("./fix"),unfix:require("./unfix"),unfixSigned:require("./unfix-signed"),encodeNumberAsBase10String:require("./encode-number-as-base10-string"),encodeNumberAsJSNumber:require("./encode-number-as-js-number"),padRight:require("./pad-right"),padLeft:require("./pad-left"),abiEncodeInt256:require("./abi-encode-int256"),abiEncodeData:require("./abi-encode-data"),abiEncodeTransactionPayload:require("./abi-encode-transaction-payload"),abiDecodeData:require("./abi-decode-data"),abiDecodeRpcResponse:require("./abi-decode-rpc-response"),formatAbiRawDecodedDataArray:require("./format-abi-raw-decoded-data-array"),formatAbiRawDecodedData:require("./format-abi-raw-decoded-data"),serialize:require("./serialize")}},{"./abi-decode-bytes":249,"./abi-decode-data":250,"./abi-decode-rpc-response":251,"./abi-decode-short-string-as-int256":252,"./abi-encode-bytes":253,"./abi-encode-data":254,"./abi-encode-int256":255,"./abi-encode-short-string-as-int256":256,"./abi-encode-transaction-payload":257,"./bignum":258,"./byte-array-to-hex-string":259,"./byte-array-to-utf8-string":260,"./constants":262,"./encode-number-as-base10-string":263,"./encode-number-as-js-number":264,"./fix":265,"./format-abi-raw-decoded-data":267,"./format-abi-raw-decoded-data-array":266,"./format-ethereum-address":268,"./format-int256":269,"./hex":270,"./is-hex":272,"./pad-left":273,"./pad-right":274,"./prefix-hex":275,"./serialize":277,"./strip-0x-prefix":278,"./unfix":280,"./unfix-signed":279,"./unfork":281,"./unroll-array":282,"bignumber.js":5}],272:[function(require,module,exports){"use strict";function isHex(str){if(str&&str.constructor===String){if(str.slice(0,1)==="-"&&str.length>1){return/^[0-9A-F]+$/i.test(str.slice(1))}return/^[0-9A-F]+$/i.test(str)}return false}module.exports=isHex},{}],273:[function(require,module,exports){"use strict";var chunk=require("./chunk");var prefixHex=require("./prefix-hex");var strip0xPrefix=require("./strip-0x-prefix");function padLeft(s,chunkLength,hasPrefix){chunkLength=chunkLength||64;s=strip0xPrefix(s);var multiple=chunkLength*(chunk(s.length,chunkLength)||1);while(s.length=2){var h=str;if(h==="-0x0"||h==="0x0"){return"0"}if(h.slice(0,2)==="0x"&&h.length>2){h=h.slice(2)}else if(h.slice(0,3)==="-0x"&&h.length>3){h="-"+h.slice(3)}if(isHex(h))return h}return str}module.exports=strip0xPrefix},{"./is-hex":272}],279:[function(require,module,exports){"use strict";var hex=require("./hex");var unfix=require("./unfix");function unfixSigned(n,encoding){return unfix(hex(n,true),encoding)}module.exports=unfixSigned},{"./hex":270,"./unfix":280}],280:[function(require,module,exports){"use strict";var BigNumber=require("bignumber.js");var bignum=require("./bignum");var prefixHex=require("./prefix-hex");var FXP_ONE=require("./constants").FXP_ONE;function unfix(n,encoding){var unfixed;if(n&&n!=="0x"&&!n.error&&!n.message){if(encoding)encoding=encoding.toLowerCase();if(Array.isArray(n)){var len=n.length;unfixed=new Array(len);for(var i=0;i=66){stride=stride||64;var elements=Math.ceil((string.length-2)/stride);var array=new Array(elements);var position=init||2;for(var i=0;i>5===6)return 2;else if(byte>>4===14)return 3;else if(byte>>3===30)return 4;return-1}function utf8CheckIncomplete(self,buf,i){var j=buf.length-1;if(j=0){if(nb>0)self.lastNeed=nb-1;return nb}if(--j=0){if(nb>0)self.lastNeed=nb-2;return nb}if(--j=0){if(nb>0){if(nb===2)nb=0;else self.lastNeed=nb-3}return nb}return 0}function utf8CheckExtraBytes(self,buf,p){if((buf[0]&192)!==128){self.lastNeed=0;return"�".repeat(p)}if(self.lastNeed>1&&buf.length>1){if((buf[1]&192)!==128){self.lastNeed=1;return"�".repeat(p+1)}if(self.lastNeed>2&&buf.length>2){if((buf[2]&192)!==128){self.lastNeed=2;return"�".repeat(p+2)}}}}function utf8FillLast(buf){var p=this.lastTotal-this.lastNeed;var r=utf8CheckExtraBytes(this,buf,p);if(r!==undefined)return r;if(this.lastNeed<=buf.length){buf.copy(this.lastChar,p,0,this.lastNeed);return this.lastChar.toString(this.encoding,0,this.lastTotal)}buf.copy(this.lastChar,p,0,buf.length);this.lastNeed-=buf.length}function utf8Text(buf,i){var total=utf8CheckIncomplete(this,buf,i);if(!this.lastNeed)return buf.toString("utf8",i);this.lastTotal=total;var end=buf.length-(total-this.lastNeed);buf.copy(this.lastChar,0,end);return buf.toString("utf8",i,end)}function utf8End(buf){var r=buf&&buf.length?this.write(buf):"";if(this.lastNeed)return r+"�".repeat(this.lastTotal-this.lastNeed);return r}function utf16Text(buf,i){if((buf.length-i)%2===0){var r=buf.toString("utf16le",i);if(r){var c=r.charCodeAt(r.length-1);if(c>=55296&&c<=56319){this.lastNeed=2;this.lastTotal=4;this.lastChar[0]=buf[buf.length-2];this.lastChar[1]=buf[buf.length-1];return r.slice(0,-1)}}return r}this.lastNeed=1;this.lastTotal=2;this.lastChar[0]=buf[buf.length-1];return buf.toString("utf16le",i,buf.length-1)}function utf16End(buf){var r=buf&&buf.length?this.write(buf):"";if(this.lastNeed){var end=this.lastTotal-this.lastNeed;return r+this.lastChar.toString("utf16le",0,end)}return r}function base64Text(buf,i){var n=(buf.length-i)%3;if(n===0)return buf.toString("base64",i);this.lastNeed=3-n;this.lastTotal=3;if(n===1){this.lastChar[0]=buf[buf.length-1]}else{this.lastChar[0]=buf[buf.length-2];this.lastChar[1]=buf[buf.length-1]}return buf.toString("base64",i,buf.length-n)}function base64End(buf){var r=buf&&buf.length?this.write(buf):"";if(this.lastNeed)return r+this.lastChar.toString("base64",0,3-this.lastNeed);return r}function simpleWrite(buf){return buf.toString(this.encoding)}function simpleEnd(buf){return buf&&buf.length?this.write(buf):""}},{"safe-buffer":234}],286:[function(require,module,exports){var isHexPrefixed=require("is-hex-prefixed");module.exports=function stripHexPrefix(str){if(typeof str!=="string"){return str}return isHexPrefixed(str)?str.slice(2):str}},{"is-hex-prefixed":182}],287:[function(require,module,exports){module.exports=require("./lib/index")},{"./lib/index":288}],288:[function(require,module,exports){(function(global){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _ponyfill=require("./ponyfill.js");var _ponyfill2=_interopRequireDefault(_ponyfill);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}var root;if(typeof self!=="undefined"){root=self}else if(typeof window!=="undefined"){root=window}else if(typeof global!=="undefined"){root=global}else if(typeof module!=="undefined"){root=module}else{root=Function("return this")()}var result=(0,_ponyfill2["default"])(root);exports["default"]=result}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./ponyfill.js":289}],289:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports["default"]=symbolObservablePonyfill;function symbolObservablePonyfill(root){var result;var _Symbol=root.Symbol;if(typeof _Symbol==="function"){if(_Symbol.observable){result=_Symbol.observable}else{result=_Symbol("observable");_Symbol.observable=result}}else{result="@@observable"}return result}},{}],290:[function(require,module,exports){(function(global){module.exports=deprecate;function deprecate(fn,msg){if(config("noDeprecation")){return fn}var warned=false;function deprecated(){if(!warned){if(config("throwDeprecation")){throw new Error(msg)}else if(config("traceDeprecation")){console.trace(msg)}else{console.warn(msg)}warned=true}return fn.apply(this,arguments)}return deprecated}function config(name){try{if(!global.localStorage)return false}catch(_){return false}var val=global.localStorage[name];if(null==val)return false;return String(val).toLowerCase()==="true"}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],291:[function(require,module,exports){arguments[4][180][0].apply(exports,arguments)},{dup:180}],292:[function(require,module,exports){module.exports=function isBuffer(arg){return arg&&typeof arg==="object"&&typeof arg.copy==="function"&&typeof arg.fill==="function"&&typeof arg.readUInt8==="function"}},{}],293:[function(require,module,exports){(function(process,global){var formatRegExp=/%[sdj%]/g;exports.format=function(f){if(!isString(f)){var objects=[];for(var i=0;i=len)return x;switch(x){case"%s":return String(args[i++]);case"%d":return Number(args[i++]);case"%j":try{return JSON.stringify(args[i++])}catch(_){return"[Circular]"}default:return x}});for(var x=args[i];i=3)ctx.depth=arguments[2];if(arguments.length>=4)ctx.colors=arguments[3];if(isBoolean(opts)){ctx.showHidden=opts}else if(opts){exports._extend(ctx,opts)}if(isUndefined(ctx.showHidden))ctx.showHidden=false;if(isUndefined(ctx.depth))ctx.depth=2;if(isUndefined(ctx.colors))ctx.colors=false;if(isUndefined(ctx.customInspect))ctx.customInspect=true;if(ctx.colors)ctx.stylize=stylizeWithColor;return formatValue(ctx,obj,ctx.depth)}exports.inspect=inspect;inspect.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]};inspect.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"};function stylizeWithColor(str,styleType){var style=inspect.styles[styleType];if(style){return"["+inspect.colors[style][0]+"m"+str+"["+inspect.colors[style][1]+"m"}else{return str}}function stylizeNoColor(str,styleType){return str}function arrayToHash(array){var hash={};array.forEach(function(val,idx){hash[val]=true});return hash}function formatValue(ctx,value,recurseTimes){if(ctx.customInspect&&value&&isFunction(value.inspect)&&value.inspect!==exports.inspect&&!(value.constructor&&value.constructor.prototype===value)){var ret=value.inspect(recurseTimes,ctx);if(!isString(ret)){ret=formatValue(ctx,ret,recurseTimes)}return ret}var primitive=formatPrimitive(ctx,value);if(primitive){return primitive}var keys=Object.keys(value);var visibleKeys=arrayToHash(keys);if(ctx.showHidden){keys=Object.getOwnPropertyNames(value)}if(isError(value)&&(keys.indexOf("message")>=0||keys.indexOf("description")>=0)){return formatError(value)}if(keys.length===0){if(isFunction(value)){var name=value.name?": "+value.name:"";return ctx.stylize("[Function"+name+"]","special")}if(isRegExp(value)){return ctx.stylize(RegExp.prototype.toString.call(value),"regexp")}if(isDate(value)){return ctx.stylize(Date.prototype.toString.call(value),"date")}if(isError(value)){return formatError(value)}}var base="",array=false,braces=["{","}"];if(isArray(value)){array=true;braces=["[","]"]}if(isFunction(value)){var n=value.name?": "+value.name:"";base=" [Function"+n+"]"}if(isRegExp(value)){base=" "+RegExp.prototype.toString.call(value)}if(isDate(value)){base=" "+Date.prototype.toUTCString.call(value)}if(isError(value)){base=" "+formatError(value)}if(keys.length===0&&(!array||value.length==0)){return braces[0]+base+braces[1]}if(recurseTimes<0){if(isRegExp(value)){return ctx.stylize(RegExp.prototype.toString.call(value),"regexp")}else{return ctx.stylize("[Object]","special")}}ctx.seen.push(value);var output;if(array){output=formatArray(ctx,value,recurseTimes,visibleKeys,keys)}else{output=keys.map(function(key){return formatProperty(ctx,value,recurseTimes,visibleKeys,key,array)})}ctx.seen.pop();return reduceToSingleString(output,base,braces)}function formatPrimitive(ctx,value){if(isUndefined(value))return ctx.stylize("undefined","undefined");if(isString(value)){var simple="'"+JSON.stringify(value).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return ctx.stylize(simple,"string")}if(isNumber(value))return ctx.stylize(""+value,"number");if(isBoolean(value))return ctx.stylize(""+value,"boolean");if(isNull(value))return ctx.stylize("null","null")}function formatError(value){return"["+Error.prototype.toString.call(value)+"]"}function formatArray(ctx,value,recurseTimes,visibleKeys,keys){var output=[];for(var i=0,l=value.length;i-1){if(array){str=str.split("\n").map(function(line){return" "+line}).join("\n").substr(2)}else{str="\n"+str.split("\n").map(function(line){return" "+line}).join("\n")}}}else{str=ctx.stylize("[Circular]","special")}}if(isUndefined(name)){if(array&&key.match(/^\d+$/)){return str}name=JSON.stringify(""+key);if(name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)){name=name.substr(1,name.length-2);name=ctx.stylize(name,"name")}else{name=name.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'");name=ctx.stylize(name,"string")}}return name+": "+str}function reduceToSingleString(output,base,braces){var numLinesEst=0;var length=output.reduce(function(prev,cur){numLinesEst++;if(cur.indexOf("\n")>=0)numLinesEst++;return prev+cur.replace(/\u001b\[\d\d?m/g,"").length+1},0);if(length>60){return braces[0]+(base===""?"":base+"\n ")+" "+output.join(",\n ")+" "+braces[1]}return braces[0]+base+" "+output.join(", ")+" "+braces[1]}function isArray(ar){return Array.isArray(ar)}exports.isArray=isArray;function isBoolean(arg){return typeof arg==="boolean"}exports.isBoolean=isBoolean;function isNull(arg){return arg===null}exports.isNull=isNull;function isNullOrUndefined(arg){return arg==null}exports.isNullOrUndefined=isNullOrUndefined;function isNumber(arg){return typeof arg==="number"}exports.isNumber=isNumber;function isString(arg){return typeof arg==="string"}exports.isString=isString;function isSymbol(arg){return typeof arg==="symbol"}exports.isSymbol=isSymbol;function isUndefined(arg){return arg===void 0}exports.isUndefined=isUndefined;function isRegExp(re){return isObject(re)&&objectToString(re)==="[object RegExp]"}exports.isRegExp=isRegExp;function isObject(arg){return typeof arg==="object"&&arg!==null}exports.isObject=isObject;function isDate(d){return isObject(d)&&objectToString(d)==="[object Date]"}exports.isDate=isDate;function isError(e){return isObject(e)&&(objectToString(e)==="[object Error]"||e instanceof Error)}exports.isError=isError;function isFunction(arg){return typeof arg==="function"}exports.isFunction=isFunction;function isPrimitive(arg){return arg===null||typeof arg==="boolean"||typeof arg==="number"||typeof arg==="string"||typeof arg==="symbol"||typeof arg==="undefined"}exports.isPrimitive=isPrimitive;exports.isBuffer=require("./support/isBuffer");function objectToString(o){return Object.prototype.toString.call(o)}function pad(n){return n<10?"0"+n.toString(10):n.toString(10)}var months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function timestamp(){var d=new Date;var time=[pad(d.getHours()),pad(d.getMinutes()),pad(d.getSeconds())].join(":");return[d.getDate(),months[d.getMonth()],time].join(" ")}exports.log=function(){console.log("%s - %s",timestamp(),exports.format.apply(exports,arguments))};exports.inherits=require("inherits");exports._extend=function(origin,add){if(!add||!isObject(add))return origin;var keys=Object.keys(add);var i=keys.length;while(i--){origin[keys[i]]=add[keys[i]]}return origin};function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}}).call(this,require("_process"),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./support/isBuffer":292,_process:210,inherits:291}],294:[function(require,module,exports){var v1=require("./v1");var v4=require("./v4");var uuid=v4;uuid.v1=v1;uuid.v4=v4;module.exports=uuid},{"./v1":297,"./v4":298}],295:[function(require,module,exports){var byteToHex=[];for(var i=0;i<256;++i){byteToHex[i]=(i+256).toString(16).substr(1)}function bytesToUuid(buf,offset){var i=offset||0;var bth=byteToHex;return bth[buf[i++]]+bth[buf[i++]]+bth[buf[i++]]+bth[buf[i++]]+"-"+bth[buf[i++]]+bth[buf[i++]]+"-"+bth[buf[i++]]+bth[buf[i++]]+"-"+bth[buf[i++]]+bth[buf[i++]]+"-"+bth[buf[i++]]+bth[buf[i++]]+bth[buf[i++]]+bth[buf[i++]]+bth[buf[i++]]+bth[buf[i++]]}module.exports=bytesToUuid},{}],296:[function(require,module,exports){(function(global){var rng;var crypto=global.crypto||global.msCrypto;if(crypto&&crypto.getRandomValues){var rnds8=new Uint8Array(16);rng=function whatwgRNG(){crypto.getRandomValues(rnds8);return rnds8}}if(!rng){var rnds=new Array(16);rng=function(){for(var i=0,r;i<16;i++){if((i&3)===0)r=Math.random()*4294967296;rnds[i]=r>>>((i&3)<<3)&255}return rnds}}module.exports=rng}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],297:[function(require,module,exports){var rng=require("./lib/rng");var bytesToUuid=require("./lib/bytesToUuid");var _seedBytes=rng();var _nodeId=[_seedBytes[0]|1,_seedBytes[1],_seedBytes[2],_seedBytes[3],_seedBytes[4],_seedBytes[5]];var _clockseq=(_seedBytes[6]<<8|_seedBytes[7])&16383;var _lastMSecs=0,_lastNSecs=0;function v1(options,buf,offset){var i=buf&&offset||0;var b=buf||[];options=options||{};var clockseq=options.clockseq!==undefined?options.clockseq:_clockseq;var msecs=options.msecs!==undefined?options.msecs:(new Date).getTime();var nsecs=options.nsecs!==undefined?options.nsecs:_lastNSecs+1;var dt=msecs-_lastMSecs+(nsecs-_lastNSecs)/1e4;if(dt<0&&options.clockseq===undefined){clockseq=clockseq+1&16383}if((dt<0||msecs>_lastMSecs)&&options.nsecs===undefined){nsecs=0}if(nsecs>=1e4){throw new Error("uuid.v1(): Can't create more than 10M uuids/sec")}_lastMSecs=msecs;_lastNSecs=nsecs;_clockseq=clockseq;msecs+=122192928e5;var tl=((msecs&268435455)*1e4+nsecs)%4294967296;b[i++]=tl>>>24&255;b[i++]=tl>>>16&255;b[i++]=tl>>>8&255;b[i++]=tl&255;var tmh=msecs/4294967296*1e4&268435455;b[i++]=tmh>>>8&255;b[i++]=tmh&255;b[i++]=tmh>>>24&15|16;b[i++]=tmh>>>16&255;b[i++]=clockseq>>>8|128;b[i++]=clockseq&255;var node=options.node||_nodeId;for(var n=0;n<6;++n){b[i+n]=node[n]}return buf?buf:bytesToUuid(b)}module.exports=v1},{"./lib/bytesToUuid":295,"./lib/rng":296}],298:[function(require,module,exports){var rng=require("./lib/rng");var bytesToUuid=require("./lib/bytesToUuid");function v4(options,buf,offset){var i=buf&&offset||0;if(typeof options=="string"){buf=options=="binary"?new Array(16):null;options=null}options=options||{};var rnds=options.random||(options.rng||rng)();rnds[6]=rnds[6]&15|64;rnds[8]=rnds[8]&63|128;if(buf){for(var ii=0;ii<16;++ii){buf[i+ii]=rnds[ii]}}return buf||bytesToUuid(rnds)}module.exports=v4},{"./lib/bytesToUuid":295,"./lib/rng":296}],299:[function(require,module,exports){"use strict";var async=require("async");var setNetworkID=require("./set-network-id");var setBlockNumber=require("./set-block-number");var setGasPrice=require("./set-gas-price");var setCoinbase=require("./set-coinbase");var setContracts=require("./set-contracts");var setFrom=require("./set-from");var setupEventsABI=require("./setup-events-abi");var setupFunctionsABI=require("./setup-functions-abi");var createEthrpcConfiguration=require("./create-ethrpc-configuration");function asyncConnect(rpc,configuration,callback){rpc.connect(createEthrpcConfiguration(configuration),function(){async.parallel({networkID:function(next){setNetworkID(rpc,next)},blockNumber:function(next){setBlockNumber(rpc,next)},gasPrice:function(next){setGasPrice(rpc,next)},coinbase:function(next){setCoinbase(rpc,next)}},function(err,vitals){var eventsABI,functionsABI;if(err)return callback(err);vitals.contracts=setContracts(vitals.networkID,configuration.contracts);vitals.abi={};eventsABI=setupEventsABI((configuration.abi||{}).events,vitals.contracts);functionsABI=setupFunctionsABI(setFrom((configuration.abi||{}).functions,vitals.coinbase),vitals.contracts);if(eventsABI)vitals.abi.events=eventsABI;if(functionsABI)vitals.abi.functions=functionsABI;callback(null,vitals)})})}module.exports=asyncConnect},{"./create-ethrpc-configuration":302,"./set-block-number":304,"./set-coinbase":305,"./set-contracts":306,"./set-from":307,"./set-gas-price":308,"./set-network-id":309,"./setup-events-abi":310,"./setup-functions-abi":311,async:3}],300:[function(require,module,exports){"use strict";var rpc=require("ethrpc");var asyncConnect=require("./async-connect");var createConfiguration=require("./create-configuration");function connect(options,callback){var configuration=createConfiguration(options||{});if(typeof callback!=="function")callback=function(){};asyncConnect(configuration.rpc||rpc,configuration,function(err,vitals){vitals.rpc=configuration.rpc||rpc;callback(err,vitals)})}module.exports=connect},{"./async-connect":299,"./create-configuration":301,ethrpc:70}],301:[function(require,module,exports){"use strict";var assign=require("lodash.assign");function createConfiguration(options){var configuration=assign({},options);configuration.contracts=configuration.contracts||{};if(!Array.isArray(configuration.httpAddresses))configuration.httpAddresses=[];if(!Array.isArray(configuration.wsAddresses))configuration.wsAddresses=[];if(!Array.isArray(configuration.ipcAddresses))configuration.ipcAddresses=[];if(typeof configuration.http==="string")configuration.httpAddresses.push(configuration.http);if(typeof configuration.ws==="string")configuration.wsAddresses.push(configuration.ws);if(typeof configuration.ipc==="string")configuration.ipcAddresses.push(configuration.ipc);return configuration}module.exports=createConfiguration},{"lodash.assign":192}],302:[function(require,module,exports){"use strict";function createEthrpcConfiguration(configuration){var ethrpcConfiguration={connectionTimeout:6e4,errorHandler:function(err){if(err)console.error(err)}};ethrpcConfiguration.httpAddresses=configuration.httpAddresses;ethrpcConfiguration.wsAddresses=configuration.wsAddresses;ethrpcConfiguration.ipcAddresses=configuration.ipcAddresses;ethrpcConfiguration.networkID=configuration.networkID;ethrpcConfiguration.startBlockStreamOnConnect=configuration.startBlockStreamOnConnect;return ethrpcConfiguration}module.exports=createEthrpcConfiguration},{}],303:[function(require,module,exports){"use strict";var setFrom=require("./set-from");var setupEventsABI=require("./setup-events-abi");var setupFunctionsABI=require("./setup-functions-abi");var connect=require("./connect");module.exports={version:"4.5.2",setFrom:setFrom,setupEventsABI:setupEventsABI,setupFunctionsABI:setupFunctionsABI,connect:connect}},{"./connect":300,"./set-from":307,"./setup-events-abi":310,"./setup-functions-abi":311}],304:[function(require,module,exports){"use strict";function setBlockNumber(rpc,callback){rpc.blockNumber(function(err,blockNumber){if(err)return callback(err);if(blockNumber==null)return callback(new Error("setBlockNumber failed"));callback(null,blockNumber)})}module.exports=setBlockNumber},{}],305:[function(require,module,exports){"use strict";function setCoinbase(rpc,callback){rpc.coinbase(function(err,coinbase){if(!coinbase||err||coinbase==="0x")return callback(null,null);callback(null,coinbase)})}module.exports=setCoinbase},{}],306:[function(require,module,exports){"use strict";function setContracts(networkID,allContracts){if(!allContracts.hasOwnProperty(networkID))return{};return allContracts[networkID]}module.exports=setContracts},{}],307:[function(require,module,exports){"use strict";function setFrom(functionsABI,fromAddress){var contract,method;if(!fromAddress||!functionsABI)return functionsABI;for(contract in functionsABI){if(functionsABI.hasOwnProperty(contract)){for(method in functionsABI[contract]){if(functionsABI[contract].hasOwnProperty(method)){functionsABI[contract][method].from=fromAddress}}}}return functionsABI}module.exports=setFrom},{}],308:[function(require,module,exports){"use strict";function setGasPrice(rpc,callback){rpc.eth.gasPrice(function(err,gasPrice){if(err)return callback(err);if(!gasPrice)return callback(new Error("setGasPrice failed"));callback(null,parseInt(gasPrice,16))})}module.exports=setGasPrice},{}],309:[function(require,module,exports){"use strict";function setNetworkID(rpc,callback){rpc.version(function(err,networkID){if(err)return callback(err);if(networkID==null)return callback(new Error("setNetworkID failed"));callback(null,networkID)})}module.exports=setNetworkID},{}],310:[function(require,module,exports){"use strict";function setupEventsABI(eventsABI,contracts){var contractName,eventName,contractEventsABI;if(!contracts||!eventsABI)return eventsABI;for(contractName in eventsABI){if(eventsABI.hasOwnProperty(contractName)){contractEventsABI=eventsABI[contractName];for(eventName in contractEventsABI){if(contractEventsABI.hasOwnProperty(eventName)){eventsABI[contractName][eventName].address=contracts[contractEventsABI[eventName].contract]}}}}return eventsABI}module.exports=setupEventsABI},{}],311:[function(require,module,exports){"use strict";function setupFunctionsABI(functionsABI,contracts){var contract,method;if(!contracts||!functionsABI)return functionsABI;for(contract in functionsABI){if(functionsABI.hasOwnProperty(contract)){for(method in functionsABI[contract]){if(functionsABI[contract].hasOwnProperty(method)){functionsABI[contract][method].to=contracts[contract]}}}}return functionsABI}module.exports=setupFunctionsABI},{}]},{},[1]);