syndicate-2017/dist/syndicate.min.js

19 lines
585 KiB
JavaScript
Raw Normal View History

2017-09-16 19:59:49 +00:00
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Syndicate=f()}})(function(){var define,module,exports;return 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<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){},{}],2:[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.TYPED_ARRAY_SUPPORT=global.TYPED_ARRAY_SUPPORT!==undefined?global.TYPED_ARRAY_SUPPORT:typedArraySupport();exports.kMaxLength=kMaxLength();function typedArraySupport(){try{var arr=new Uint8Array(1);arr.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}};return arr.foo()===42&&typeof arr.subarray==="function"&&arr.subarray(1,1).byteLength===0}catch(e){return false}}function kMaxLength(){return Buffer.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function createBuffer(that,length){if(kMaxLength()<length){throw new RangeError("Invalid typed array length")}if(Buffer.TYPED_ARRAY_SUPPORT){that=new Uint8Array(length);that.__proto__=Buffer.prototype}else{if(that===null){that=new Buffer(length)}that.length=length}return that}function Buffer(arg,encodingOrOffset,length){if(!Buffer.TYPED_ARRAY_SUPPORT&&!(this instanceof Buffer)){return new Buffer(arg,encodingOrOffset,length)}if(typeof arg==="number"){if(typeof encodingOrOffset==="string"){throw new Error("If encoding is specified then the first argument must be a string")}return allocUnsafe(this,arg)}return from(this,arg,encodingOrOffset,length)}Buffer.poolSize=8192;Buffer._augment=function(arr){arr.__proto__=Buffer.prototype;return arr};function from(that,value,encodingOrOffset,length){if(typeof value==="number"){throw new TypeError('"value" argument must not be a number')}if(typeof ArrayBuffer!=="undefined"&&value instanceof ArrayBuffer){return fromArrayBuffer(that,value,encodingOrOffset,length)}if(typeof value==="string"){return fromString(that,value,encodingOrOffset)}return fromObject(that,value)}Buffer.from=function(value,encodingOrOffset,length){return from(null,value,encodingOrOffset,length)};if(Buffer.TYPED_ARRAY_SUPPORT){Buffer.prototype.__proto__=Uint8Array.prototype;Buffer.__proto__=Uint8Array;if(typeof Symbol!=="undefined"&&Symbol.species&&Buffer[Symbol.species]===Buffer){Object.defineProperty(Buffer,Symbol.species,{value:null,configurable:true})}}function assertSize(size){if(typeof size!=="number"){throw new TypeError('"size" argument must be a number')}else if(size<0){throw new RangeError('"size" argument must not be negative')}}function alloc(that,size,fill,encoding){assertSize(size);if(size<=0){return createBuffer(that,size)}if(fill!==undefined){return typeof encoding==="string"?createBuffer(that,size).fill(fill,encoding):createBuffer(that,size).fill(fill)}return createBuffer(that,size)}Buffer.alloc=function(size,fill,encoding){return alloc(null,size,fill,encoding)};function allocUnsafe(that,size){assertSize(size);that=createBuffer(that,size<0?0:checked(size)|0);if(!Buffer.TYPED_ARRAY_SUPPORT){for(var i=0;i<size;++i){that[i]=0}}return that}Buffer.allocUnsafe=function(size){return allocUnsafe(null,size)};Buffer.allocUnsafeSlow=function(size){return allocUnsafe(null,size)};function fromString(that,string,encoding){if(typeof encoding!=="string"||encoding===""){encoding="utf8"}if(!Buffer.isEncoding(encoding)){throw new TypeError('"encoding" must be a valid string encoding')}var
;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<str.length;++i){byteArray.push(str.charCodeAt(i)&255)}return byteArray}function utf16leToBytes(str,units){var c,hi,lo;var byteArray=[];for(var i=0;i<str.length;++i){if((units-=2)<0)break;c=str.charCodeAt(i);hi=c>>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<length;++i){if(i+offset>=dst.length||i>=src.length)break;dst[i+offset]=src[i]}return i}function isnan(val){return val!==val}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"base64-js":3,ieee754:4,isarray:5}],3:[function(require,module,exports){"use strict";exports.byteLength=byteLength;exports.toByteArray=toByteArray;exports.fromByteArray=fromByteArray;var lookup=[];var revLookup=[];var Arr=typeof Uint8Array!=="undefined"?Uint8Array:Array;var code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var i=0,len=code.length;i<len;++i){lookup[i]=code[i];revLookup[code.charCodeAt(i)]=i}revLookup["-".charCodeAt(0)]=62;revLookup["_".charCodeAt(0)]=63;function placeHoldersCount(b64){var len=b64.length;if(len%4>0){throw new Error("Invalid string. Length must be a multiple of 4")}return b64[len-2]==="="?2:b64[len-1]==="="?1:0}function byteLength(b64){return b64.length*3/4-placeHoldersCount(b64)}function toByteArray(b64){var i,j,l,tmp,placeHolders,arr;var len=b64.length;placeHolders=placeHoldersCount(b64);arr=new Arr(len*3/4-placeHolders);l=placeHolders>0?len-4:len;var L=0;for(i=0,j=0;i<l;i+=4,j+=3){tmp=revLookup[b64.charCodeAt(i)]<<18|revLookup[b64.charCodeAt(i+1)]<<12|revLookup[b64.charCodeAt(i+2)]<<6|revLookup[b64.charCodeAt(i+3)];arr[L++]=tmp>>16&255;arr[L++]=tmp>>8&255;arr[L++]=tmp&255}if(placeHolders===2){tmp=revLookup[b64.charCodeAt(i)]<<2|revLookup[b64.charCodeAt(i+1)]>>4;arr[L++]=tmp&255}else if(placeHolders===1){tmp=revLookup[b64.charCodeAt(i)]<<10|revLookup[b64.charCodeAt(i+1)]<<4|revLookup[b64.charCodeAt(i+2)]>>2;arr[L++]=tmp>>8&255;arr[L++]=tmp&255}return arr}function tripletToBase64(num){return lookup[num>>18&63]+lookup[num>>12&63]+lookup[num>>6&63]+lookup[num&63]}function encodeChunk(uint8,start,end){var tmp;var output=[];for(var i=start;i<end;i+=3){tmp=(uint8[i]<<16)+(uint8[i+1]<<8)+uint8[i+2];output.push(tripletToBase64(tmp))}return output.join("")}function fromByteArray(uint8){var tmp;var len=uint8.length;var extraBytes=len%3;var output="";var parts=[];var maxChunkLength=16383;for(var i=0,len2=len-extraBytes;i<len2;i+=maxChunkLength){parts.push(encodeChunk(uint8,i,i+maxChunkLength>len2?len2:i+maxChunkLength))}if(extraBytes===1){tmp=uint8[len-1];output+=lookup[tmp>>2];output+=lookup[tmp<<4&63];output+="=="}else if(extraBytes===2){tmp=(uint8[len-2]<<8)+uint8[len-1];output+=lookup[tmp>>10];output+=lookup[tmp>>4&63];output+=lookup[tmp<<2&63];output+="="}parts.push(output);return parts.join("")}},{}],4:[function(require,module,exports){exports.read=function(buffer,offset,isLE,mLen,nBytes){var e,m;var eLen=nBytes*8-mLen-1;var eMax=(1<<eLen)-1;var eBias=eMax>>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
(function(Buffer){var aes=require("./aes");var Transform=require("cipher-base");var inherits=require("inherits");inherits(StreamCipher,Transform);module.exports=StreamCipher;function StreamCipher(mode,key,iv,decrypt){if(!(this instanceof StreamCipher)){return new StreamCipher(mode,key,iv)}Transform.call(this);this._cipher=new aes.AES(key);this._prev=new Buffer(iv.length);this._cache=new Buffer("");this._secCache=new Buffer("");this._decrypt=decrypt;iv.copy(this._prev);this._mode=mode}StreamCipher.prototype._update=function(chunk){return this._mode.encrypt(this,chunk,this._decrypt)};StreamCipher.prototype._final=function(){this._cipher.scrub()}}).call(this,require("buffer").Buffer)},{"./aes":8,buffer:2,"cipher-base":23,inherits:204}],25:[function(require,module,exports){(function(Buffer){var CipherBase=require("cipher-base");var des=require("des.js");var inherits=require("inherits");var modes={"des-ede3-cbc":des.CBC.instantiate(des.EDE),"des-ede3":des.EDE,"des-ede-cbc":des.CBC.instantiate(des.EDE),"des-ede":des.EDE,"des-cbc":des.CBC.instantiate(des.DES),"des-ecb":des.DES};modes.des=modes["des-cbc"];modes.des3=modes["des-ede3-cbc"];module.exports=DES;inherits(DES,CipherBase);function DES(opts){CipherBase.call(this);var modeName=opts.mode.toLowerCase();var mode=modes[modeName];var type;if(opts.decrypt){type="decrypt"}else{type="encrypt"}var key=opts.key;if(modeName==="des-ede"||modeName==="des-ede-cbc"){key=Buffer.concat([key,key.slice(0,8)])}var iv=opts.iv;this._des=mode.create({key:key,iv:iv,type:type})}DES.prototype._update=function(data){return new Buffer(this._des.update(data))};DES.prototype._final=function(){return new Buffer(this._des.final())}}).call(this,require("buffer").Buffer)},{buffer:2,"cipher-base":27,"des.js":28,inherits:204}],26:[function(require,module,exports){exports["des-ecb"]={key:8,iv:0};exports["des-cbc"]=exports.des={key:8,iv:8};exports["des-ede3-cbc"]=exports.des3={key:24,iv:8};exports["des-ede3"]={key:24,iv:0};exports["des-ede-cbc"]={key:16,iv:8};exports["des-ede"]={key:16,iv:0}},{}],27:[function(require,module,exports){arguments[4][23][0].apply(exports,arguments)},{buffer:2,dup:23,inherits:204,stream:223,string_decoder:224}],28:[function(require,module,exports){"use strict";exports.utils=require("./des/utils");exports.Cipher=require("./des/cipher");exports.DES=require("./des/des");exports.CBC=require("./des/cbc");exports.EDE=require("./des/ede")},{"./des/cbc":29,"./des/cipher":30,"./des/des":31,"./des/ede":32,"./des/utils":33}],29:[function(require,module,exports){"use strict";var assert=require("minimalistic-assert");var inherits=require("inherits");var proto={};function CBCState(iv){assert.equal(iv.length,8,"Invalid IV length");this.iv=new Array(8);for(var i=0;i<this.iv.length;i++)this.iv[i]=iv[i]}function instantiate(Base){function CBC(options){Base.call(this,options);this._cbcInit()}inherits(CBC,Base);var keys=Object.keys(proto);for(var i=0;i<keys.length;i++){var key=keys[i];CBC.prototype[key]=proto[key]}CBC.create=function create(options){return new CBC(options)};return CBC}exports.instantiate=instantiate;proto._cbcInit=function _cbcInit(){var state=new CBCState(this.options.iv);this._cbcState=state};proto._update=function _update(inp,inOff,out,outOff){var state=this._cbcState;var superProto=this.constructor.super_.prototype;var iv=state.iv;if(this.type==="encrypt"){for(var i=0;i<this.blockSize;i++)iv[i]^=inp[inOff+i];superProto._update.call(this,iv,0,out,outOff);for(var i=0;i<this.blockSize;i++)iv[i]=out[outOff+i]}else{superProto._update.call(this,inp,inOff,out,outOff);for(var i=0;i<this.blockSize;i++)out[outOff+i]^=iv[i];for(var i=0;i<this.blockSize;i++)iv[i]=inp[inOff+i]}}},{inherits:204,"minimalistic-assert":34}],30:[function(require,module,exports){"use strict";var assert=require("minimalistic-assert");function Cipher(options){this.options=options;this.type=this.options.type;this.blockSize=8;this._init();this.buffer=new Array(this.blockSize);this.bufferOff=0}module.exports=Cipher;Cipher.prototype._init=function _init(){};Cipher.prototype.update=function update(data){if(data.length===0
;if(carry!==0){this.words[this.length]=carry;this.length++}else if(a!==this){for(;i<a.length;i++){this.words[i]=a.words[i]}}return this};BN.prototype.add=function add(num){var res;if(num.negative!==0&&this.negative===0){num.negative=0;res=this.sub(num);num.negative^=1;return res}else if(num.negative===0&&this.negative!==0){this.negative=0;res=num.sub(this);this.negative=1;return res}if(this.length>num.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<b.length;i++){r=(a.words[i]|0)-(b.words[i]|0)+carry;carry=r>>26;this.words[i]=r&67108863}for(;carry!==0&&i<a.length;i++){r=(a.words[i]|0)+carry;carry=r>>26;this.words[i]=r&67108863}if(carry===0&&i<a.length&&a!==this){for(;i<a.length;i++){this.words[i]=a.words[i]}}this.length=Math.max(this.length,i);if(a!==this){this.negative=1}return this.strip()};BN.prototype.sub=function sub(num){return this.clone().isub(num)};function smallMulTo(self,num,out){out.negative=num.negative^self.negative;var len=self.length+num.length|0;out.length=len;len=len-1|0;var a=self.words[0]|0;var b=num.words[0]|0;var r=a*b;var lo=r&67108863;var carry=r/67108864|0;out.words[0]=lo;for(var k=1;k<len;k++){var ncarry=carry>>>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=
;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=rlen<this.n?-1:r.ucmp(this.p);if(cmp===0){r.words[0]=0;r.length=1}else if(cmp>0){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<outLen;i++){output.words[i]=input.words[i]}output.length=outLen;if(input.length<=9){input.words[0]=0;input.length=1;return}var prev=input.words[9];output.words[output.length++]=prev&mask;for(i=10;i<input.length;i++){var next=input.words[i]|0;input.words[i-10]=(next&mask)<<4|prev>>>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<num.length;i++){var w=num.words[i]|0;lo+=w*977;num.words[i]=lo&67108863;lo=w*64+(lo/67108864|0)}if(num.words[num.length-1]===0){num.length--;if(num.words[num.length-1]===0){num.length--}}return num};function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}inherits(P224,MPrime);function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}inherits(P192,MPrime);function P25519(){MPrime.call(this,"25519","7ffffff
;ShortCurve.prototype._endoWnafMulAdd=function _endoWnafMulAdd(points,coeffs,jacobianResult){var npoints=this._endoWnafT1;var ncoeffs=this._endoWnafT2;for(var i=0;i<points.length;i++){var split=this._endoSplit(coeffs[i]);var p=points[i];var beta=p._getBeta();if(split.k1.negative){split.k1.ineg();p=p.neg(true)}if(split.k2.negative){split.k2.ineg();beta=beta.neg(true)}npoints[i*2]=p;npoints[i*2+1]=beta;ncoeffs[i*2]=split.k1;ncoeffs[i*2+1]=split.k2}var res=this._wnafMulAdd(1,npoints,ncoeffs,i*2,jacobianResult);for(var j=0;j<i*2;j++){npoints[j]=null;ncoeffs[j]=null}return res};function Point(curve,x,y,isRed){Base.BasePoint.call(this,curve,"affine");if(x===null&&y===null){this.x=null;this.y=null;this.inf=true}else{this.x=new BN(x,16);this.y=new BN(y,16);if(isRed){this.x.forceRed(this.curve.red);this.y.forceRed(this.curve.red)}if(!this.x.red)this.x=this.x.toRed(this.curve.red);if(!this.y.red)this.y=this.y.toRed(this.curve.red);this.inf=false}}inherits(Point,Base.BasePoint);ShortCurve.prototype.point=function point(x,y,isRed){return new Point(this,x,y,isRed)};ShortCurve.prototype.pointFromJSON=function pointFromJSON(obj,red){return Point.fromJSON(this,obj,red)};Point.prototype._getBeta=function _getBeta(){if(!this.curve.endo)return;var pre=this.precomputed;if(pre&&pre.beta)return pre.beta;var beta=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(pre){var curve=this.curve;var endoMul=function(p){return curve.point(p.x.redMul(curve.endo.beta),p.y)};pre.beta=beta;beta.precomputed={beta:null,naf:pre.naf&&{wnd:pre.naf.wnd,points:pre.naf.points.map(endoMul)},doubles:pre.doubles&&{step:pre.doubles.step,points:pre.doubles.points.map(endoMul)}}}return beta};Point.prototype.toJSON=function toJSON(){if(!this.precomputed)return[this.x,this.y];return[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]};Point.fromJSON=function fromJSON(curve,obj,red){if(typeof obj==="string")obj=JSON.parse(obj);var res=curve.point(obj[0],obj[1],red);if(!obj[2])return res;function obj2point(obj){return curve.point(obj[0],obj[1],red)}var pre=obj[2];res.precomputed={beta:null,doubles:pre.doubles&&{step:pre.doubles.step,points:[res].concat(pre.doubles.points.map(obj2point))},naf:pre.naf&&{wnd:pre.naf.wnd,points:[res].concat(pre.naf.points.map(obj2point))}};return res};Point.prototype.inspect=function inspect(){if(this.isInfinity())return"<EC Point Infinity>";return"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"};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 thi
;if(typeof sig!=="object")sig=parseBytes(sig);if(Array.isArray(sig)){sig={R:sig.slice(0,eddsa.encodingLength),S:sig.slice(eddsa.encodingLength)}}assert(sig.R&&sig.S,"Signature without R or S");if(eddsa.isPoint(sig.R))this._R=sig.R;if(sig.S instanceof BN)this._S=sig.S;this._Rencoded=Array.isArray(sig.R)?sig.R:sig.Rencoded;this._Sencoded=Array.isArray(sig.S)?sig.S:sig.Sencoded}cachedProperty(Signature,"S",function S(){return this.eddsa.decodeInt(this.Sencoded())});cachedProperty(Signature,"R",function R(){return this.eddsa.decodePoint(this.Rencoded())});cachedProperty(Signature,"Rencoded",function Rencoded(){return this.eddsa.encodePoint(this.R())});cachedProperty(Signature,"Sencoded",function Sencoded(){return this.eddsa.encodeInt(this.S())});Signature.prototype.toBytes=function toBytes(){return this.Rencoded().concat(this.Sencoded())};Signature.prototype.toHex=function toHex(){return utils.encode(this.toBytes(),"hex").toUpperCase()};module.exports=Signature},{"../../elliptic":41,"bn.js":39}],54:[function(require,module,exports){module.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb
;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(var t=8;t<this.padLength;t++)res[i++]=0}return res}},{"../hash":57}],59:[function(require,module,exports){var hmac=exports;var hash=require("../hash");var utils=hash.utils;var assert=utils.assert;function Hmac(hash,key,enc){if(!(this instanceof Hmac))return new Hmac(hash,key,enc);this.Hash=hash;this.blockSize=hash.blockSize/8;this.outSize=hash.outSize/8;this.inner=null;this.outer=null;this._init(utils.toArray(key,enc))}module.exports=Hmac;Hmac.prototype._init=function init(key){if(key.length>this.blockSize)key=(new this.Hash).update(key).digest();assert(key.length<=this.blockSize);for(var i=key.length;i<this.blockSize;i++)key.push(0);for(var i=0;i<key.length;i++)key[i]^=54;this.inner=(new this.Hash).update(key);for(var i=0;i<key.length;i++)key[i]^=106;this.outer=(new this.Hash).update(key)};Hmac.prototype.update=function update(msg,enc){this.inner.update(msg,enc);return this};Hmac.prototype.digest=function digest(enc){this.outer.update(this.inner.digest());return this.outer.digest(enc)}},{"../hash":57}],60:[function(require,module,exports){var hash=require("../hash");var utils=hash.utils;var rotl32=utils.rotl32;var sum32=utils.sum32;var sum32_3=utils.sum32_3;var sum32_4=utils.sum32_4;var BlockHash=hash.common.BlockHash;function RIPEMD160(){if(!(this instanceof RIPEMD160))return new RIPEMD160;BlockHash.call(this);this.h=[1732584193,4023233417,2562383102,271733878,3285377520];this.endian="little"}utils.inherits(RIPEMD160,BlockHash);exports.ripemd160=RIPEMD160;RIPEMD160.blockSize=512;RIPEMD160.outSize=160;RIPEMD160.hmacStrength=192;RIPEMD160.padLength=64;RIPEMD160.prototype._update=function update(msg,start){var A=this.h[0];var B=this.h[1];var C=this.h[2];var D=this.h[3];var E=this.h[4];var Ah=A;var Bh=B;var Ch=C;var Dh=D;var Eh=E;for(var j=0;j<80;j++){var T=sum32(rotl32(sum32_4(A,f(j,B,C,D),msg[r[j]+start],K(j)),s[j]),E);A=E;E=D;D=rotl32(C,10);C=B;B=T;T=sum32(rotl32(sum32_4(Ah,f(79-j,Bh,Ch,Dh),msg[rh[j]+start],Kh(j)),sh[j]),Eh);Ah=Eh;Eh=Dh;Dh=rotl32(Ch,10);Ch=Bh;Bh=T}T=sum32_3(this.h[1],C,Dh);this.h[1]=sum32_3(this.h[2],D,Eh);this.h[2]=sum32_3(this.h[3],E,Ah);this.h[3]=sum32_3(this.h[4],A,Bh);this.h[4]=sum32_3(this.h[0],B,Ch);this.h[0]=T};RIPEMD160.prototype._digest=function digest(enc){if(enc==="hex")return utils.toHex32(this.h,"little");else return utils.split32(this.h,"little")};function f(j,x,y,z){if(j<=15)return x^y^z;else if(j<=31)return x&y|~x&z;else if(j<=47)return(x|~y)^z;else if(j<=63)return x&z|y&~z;else return x^(y|~z)}function K(j){if(j<=15)return 0;else if(j<=31)return 1518500249;else if(j<=47)return 1859775393;else if(j<=63)return 2400959708;else return 2840853838}function Kh(j){if(j<=15)return 1352829926;else if(j<=31)return 1548603684;else if(j<=47)return 1836072691;else if(j<=63)return 2053994217;else return 0}var r=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13];var rh=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11];var s=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6];var sh=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},{"../hash":57}],61:[function(require,module,exports){var hash=require("../hash");var utils=hash.utils;var assert=utils.assert;var rotr32=utils.rotr32;var rotl32=utils.rotl32;var sum32=utils.sum32;var sum32_4=utils.sum32_4;var sum32_5=utils.sum32_5;var rotr64_hi=utils.rotr64_hi;var rotr64_lo=utils.rotr64_lo;var shr64_hi=utils.shr64_hi;var shr64_lo=utils.shr64_lo;var sum64=utils.sum64;var
named=require("vm").runInThisContext("(function "+this.name+"(entity) {\n"+" this._initNamed(entity);\n"+"})")}catch(e){named=function(entity){this._initNamed(entity)}}inherits(named,base);named.prototype._initNamed=function initnamed(entity){base.call(this,entity)};return new named(this)};Entity.prototype._getDecoder=function _getDecoder(enc){enc=enc||"der";if(!this.decoders.hasOwnProperty(enc))this.decoders[enc]=this._createNamed(asn1.decoders[enc]);return this.decoders[enc]};Entity.prototype.decode=function decode(data,enc,options){return this._getDecoder(enc).decode(data,options)};Entity.prototype._getEncoder=function _getEncoder(enc){enc=enc||"der";if(!this.encoders.hasOwnProperty(enc))this.encoders[enc]=this._createNamed(asn1.encoders[enc]);return this.encoders[enc]};Entity.prototype.encode=function encode(data,enc,reporter){return this._getEncoder(enc).encode(data,reporter)}},{"../asn1":71,inherits:204,vm:225}],73:[function(require,module,exports){var inherits=require("inherits");var Reporter=require("../base").Reporter;var Buffer=require("buffer").Buffer;function DecoderBuffer(base,options){Reporter.call(this,options);if(!Buffer.isBuffer(base)){this.error("Input not Buffer");return}this.base=base;this.offset=0;this.length=base.length}inherits(DecoderBuffer,Reporter);exports.DecoderBuffer=DecoderBuffer;DecoderBuffer.prototype.save=function save(){return{offset:this.offset,reporter:Reporter.prototype.save.call(this)}};DecoderBuffer.prototype.restore=function restore(save){var res=new DecoderBuffer(this.base);res.offset=save.offset;res.length=this.offset;this.offset=save.offset;Reporter.prototype.restore.call(this,save.reporter);return res};DecoderBuffer.prototype.isEmpty=function isEmpty(){return this.offset===this.length};DecoderBuffer.prototype.readUInt8=function readUInt8(fail){if(this.offset+1<=this.length)return this.base.readUInt8(this.offset++,true);else return this.error(fail||"DecoderBuffer overrun")};DecoderBuffer.prototype.skip=function skip(bytes,fail){if(!(this.offset+bytes<=this.length))return this.error(fail||"DecoderBuffer overrun");var res=new DecoderBuffer(this.base);res._reporterState=this._reporterState;res.offset=this.offset;res.length=this.offset+bytes;this.offset+=bytes;return res};DecoderBuffer.prototype.raw=function raw(save){return this.base.slice(save?save.offset:this.offset,this.length)};function EncoderBuffer(value,reporter){if(Array.isArray(value)){this.length=0;this.value=value.map(function(item){if(!(item instanceof EncoderBuffer))item=new EncoderBuffer(item,reporter);this.length+=item.length;return item},this)}else if(typeof value==="number"){if(!(0<=value&&value<=255))return reporter.error("non-byte EncoderBuffer value");this.value=value;this.length=1}else if(typeof value==="string"){this.value=value;this.length=Buffer.byteLength(value)}else if(Buffer.isBuffer(value)){this.value=value;this.length=value.length}else{return reporter.error("Unsupported type: "+typeof value)}}exports.EncoderBuffer=EncoderBuffer;EncoderBuffer.prototype.join=function join(out,offset){if(!out)out=new Buffer(this.length);if(!offset)offset=0;if(this.length===0)return out;if(Array.isArray(this.value)){this.value.forEach(function(item){item.join(out,offset);offset+=item.length})}else{if(typeof this.value==="number")out[offset]=this.value;else if(typeof this.value==="string")out.write(this.value,offset);else if(Buffer.isBuffer(this.value))this.value.copy(out,offset);offset+=this.length}return out}},{"../base":74,buffer:2,inherits:204}],74:[function(require,module,exports){var base=exports;base.Reporter=require("./reporter").Reporter;base.DecoderBuffer=require("./buffer").DecoderBuffer;base.EncoderBuffer=require("./buffer").EncoderBuffer;base.Node=require("./node")},{"./buffer":73,"./node":75,"./reporter":76}],75:[function(require,module,exports){var Reporter=require("../base").Reporter;var EncoderBuffer=require("../base").EncoderBuffer;var DecoderBuffer=require("../base").DecoderBuffer;var assert=require("minimalistic-assert");var tags=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","e
;if(der.tagByName.hasOwnProperty(tag))res=der.tagByName[tag];else if(typeof tag==="number"&&(tag|0)===tag)res=tag;else return reporter.error("Unknown tag: "+tag);if(res>=31)return reporter.error("Multi-octet tag encoding unsupported");if(!primitive)res|=32;res|=der.tagClassByName[cls||"universal"]<<6;return res}},{"../../asn1":71,buffer:2,inherits:204}],83:[function(require,module,exports){var encoders=exports;encoders.der=require("./der");encoders.pem=require("./pem")},{"./der":82,"./pem":84}],84:[function(require,module,exports){var inherits=require("inherits");var DEREncoder=require("./der");function PEMEncoder(entity){DEREncoder.call(this,entity);this.enc="pem"}inherits(PEMEncoder,DEREncoder);module.exports=PEMEncoder;PEMEncoder.prototype.encode=function encode(data,options){var buf=DEREncoder.prototype.encode.call(this,data);var p=buf.toString("base64");var out=["-----BEGIN "+options.label+"-----"];for(var i=0;i<p.length;i+=64)out.push(p.slice(i,i+64));out.push("-----END "+options.label+"-----");return out.join("\n")}},{"./der":82,inherits:204}],85:[function(require,module,exports){arguments[4][34][0].apply(exports,arguments)},{dup:34}],86:[function(require,module,exports){arguments[4][8][0].apply(exports,arguments)},{buffer:2,dup:8}],87:[function(require,module,exports){arguments[4][9][0].apply(exports,arguments)},{"./aes":86,"./ghash":91,buffer:2,"buffer-xor":100,"cipher-base":101,dup:9,inherits:204}],88:[function(require,module,exports){arguments[4][10][0].apply(exports,arguments)},{"./decrypter":89,"./encrypter":90,"./modes":92,dup:10}],89:[function(require,module,exports){arguments[4][11][0].apply(exports,arguments)},{"./aes":86,"./authCipher":87,"./modes":92,"./modes/cbc":93,"./modes/cfb":94,"./modes/cfb1":95,"./modes/cfb8":96,"./modes/ctr":97,"./modes/ecb":98,"./modes/ofb":99,"./streamCipher":102,buffer:2,"cipher-base":101,dup:11,evp_bytestokey:103,inherits:204}],90:[function(require,module,exports){arguments[4][12][0].apply(exports,arguments)},{"./aes":86,"./authCipher":87,"./modes":92,"./modes/cbc":93,"./modes/cfb":94,"./modes/cfb1":95,"./modes/cfb8":96,"./modes/ctr":97,"./modes/ecb":98,"./modes/ofb":99,"./streamCipher":102,buffer:2,"cipher-base":101,dup:12,evp_bytestokey:103,inherits:204}],91:[function(require,module,exports){arguments[4][13][0].apply(exports,arguments)},{buffer:2,dup:13}],92:[function(require,module,exports){arguments[4][14][0].apply(exports,arguments)},{dup:14}],93:[function(require,module,exports){arguments[4][15][0].apply(exports,arguments)},{"buffer-xor":100,dup:15}],94:[function(require,module,exports){arguments[4][16][0].apply(exports,arguments)},{buffer:2,"buffer-xor":100,dup:16}],95:[function(require,module,exports){arguments[4][17][0].apply(exports,arguments)},{buffer:2,dup:17}],96:[function(require,module,exports){arguments[4][18][0].apply(exports,arguments)},{buffer:2,dup:18}],97:[function(require,module,exports){arguments[4][19][0].apply(exports,arguments)},{buffer:2,"buffer-xor":100,dup:19}],98:[function(require,module,exports){arguments[4][20][0].apply(exports,arguments)},{dup:20}],99:[function(require,module,exports){arguments[4][21][0].apply(exports,arguments)},{buffer:2,"buffer-xor":100,dup:21}],100:[function(require,module,exports){arguments[4][22][0].apply(exports,arguments)},{buffer:2,dup:22}],101:[function(require,module,exports){arguments[4][23][0].apply(exports,arguments)},{buffer:2,dup:23,inherits:204,stream:223,string_decoder:224}],102:[function(require,module,exports){arguments[4][24][0].apply(exports,arguments)},{"./aes":86,buffer:2,"cipher-base":101,dup:24,inherits:204}],103:[function(require,module,exports){arguments[4][35][0].apply(exports,arguments)},{buffer:2,"create-hash/md5":136,dup:35}],104:[function(require,module,exports){(function(Buffer){var createHmac=require("create-hmac");var crt=require("browserify-rsa");var curves=require("./curves");var elliptic=require("elliptic");var parseKeys=require("parse-asn1");var BN=require("bn.js");var EC=elliptic.ec;function sign(hash,key,hashType,signType){var priv=parseKeys(key);if(priv.curve){if(signType!=="ecdsa"
;writeInt64BE(this._fh,this._fl,40);return H};module.exports=Sha384}).call(this,require("buffer").Buffer)},{"./hash":139,"./sha512":146,buffer:2,inherits:204}],146:[function(require,module,exports){(function(Buffer){var inherits=require("inherits");var Hash=require("./hash");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<b>>>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 K
199:[function(require,module,exports){(function(Buffer){var parseKeys=require("parse-asn1");var randomBytes=require("randombytes");var createHash=require("create-hash");var mgf=require("./mgf");var xor=require("./xor");var bn=require("bn.js");var withPublic=require("./withPublic");var crt=require("browserify-rsa");var constants={RSA_PKCS1_OAEP_PADDING:4,RSA_PKCS1_PADDIN:1,RSA_NO_PADDING:3};module.exports=function publicEncrypt(public_key,msg,reverse){var padding;if(public_key.padding){padding=public_key.padding}else if(reverse){padding=1}else{padding=4}var key=parseKeys(public_key);var paddedMsg;if(padding===4){paddedMsg=oaep(key,msg)}else if(padding===1){paddedMsg=pkcs1(key,msg,reverse)}else if(padding===3){paddedMsg=new bn(msg);if(paddedMsg.cmp(key.modulus)>=0){throw new Error("data too long for modulus")}}else{throw new Error("unknown padding")}if(reverse){return crt(paddedMsg,key)}else{return withPublic(paddedMsg,key)}};function oaep(key,msg){var k=key.modulus.byteLength();var mLen=msg.length;var iHash=createHash("sha1").update(new Buffer("")).digest();var hLen=iHash.length;var hLen2=2*hLen;if(mLen>k-hLen2-2){throw new Error("message too long")}var ps=new Buffer(k-mLen-hLen2-2);ps.fill(0);var dblen=k-hLen-1;var seed=randomBytes(hLen);var maskedDb=xor(Buffer.concat([iHash,ps,new Buffer([1]),msg],dblen),mgf(seed,dblen));var maskedSeed=xor(seed,mgf(maskedDb,hLen));return new bn(Buffer.concat([new Buffer([0]),maskedSeed,maskedDb],k))}function pkcs1(key,msg,reverse){var mLen=msg.length;var k=key.modulus.byteLength();if(mLen>k-11){throw new Error("message too long")}var ps;if(reverse){ps=new Buffer(k-mLen-3);ps.fill(255)}else{ps=nonZero(k-mLen-3)}return new bn(Buffer.concat([new Buffer([0,reverse?1:2]),ps,new Buffer([0]),msg],k))}function nonZero(len,crypto){var out=new Buffer(len);var i=0;var cache=randomBytes(len*2);var cur=0;var num;while(i<len){if(cur===cache.length){cache=randomBytes(len*2);cur=0}num=cache[cur++];if(num){out[i++]=num}}return out}}).call(this,require("buffer").Buffer)},{"./mgf":158,"./withPublic":200,"./xor":201,"bn.js":159,"browserify-rsa":160,buffer:2,"create-hash":134,"parse-asn1":164,randombytes:202}],200:[function(require,module,exports){(function(Buffer){var bn=require("bn.js");function withPublic(paddedMsg,key){return new Buffer(paddedMsg.toRed(bn.mont(key.modulus)).redPow(new bn(key.publicExponent)).fromRed().toArray())}module.exports=withPublic}).call(this,require("buffer").Buffer)},{"bn.js":159,buffer:2}],201:[function(require,module,exports){module.exports=function xor(a,b){var len=a.length;var i=-1;while(++i<len){a[i]^=b[i]}return a}},{}],202:[function(require,module,exports){(function(process,global,Buffer){"use strict";function oldBrowser(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var crypto=global.crypto||global.msCrypto;if(crypto&&crypto.getRandomValues){module.exports=randomBytes}else{module.exports=oldBrowser}function randomBytes(size,cb){if(size>65536)throw new Error("requested too many random bytes");var rawBytes=new global.Uint8Array(size);if(size>0){crypto.getRandomValues(rawBytes)}var bytes=new Buffer(rawBytes.buffer);if(typeof cb==="function"){return process.nextTick(function(){cb(null,bytes)})}return bytes}}).call(this,require("_process"),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{},require("buffer").Buffer)},{_process:206,buffer:2}],203:[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(typ
;util.inherits(Writable,Stream);function nop(){}function WriteReq(chunk,encoding,cb){this.chunk=chunk;this.encoding=encoding;this.callback=cb;this.next=null}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=~~this.highWaterMark;this.needDrain=false;this.ending=false;this.ended=false;this.finished=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.")})}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}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(!Buffer.isBuffer(chunk)&&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;if(typeof encoding==="function"){cb=encoding;encoding=null}if(Buffer.isBuffer(chunk))encoding="buffer";else if(!encoding)encoding=state.defaultEncoding;if(typeof cb!=="function")cb=nop;if(state.ended)writeAfterEnd(this,cb);else if(validChunk(this,state,chunk,cb)){state.pendingcb++;ret=writeOrBuffer(this,state,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,enc
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){if(fn(cache[iterations],iterations++,this)===false){return iterations}}var step;while(!(step=iterator.next()).done){var val=step.value;cache[iterations]=val;if(fn(val,iterations++,this)===false){break}}return iterations};IteratorSeq.prototype.__iteratorUncached=function(type,reverse){if(reverse){return this.cacheResult().__iterator(type,reverse)}var iterator=this._iterator;var cache=this._iteratorCache;var iterations=0;return new Iterator(function(){if(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=
setListBounds(list,0,oldSize+values.length);for(var ii=0;ii<values.length;ii++){list.set(oldSize+ii,values[ii])}})};List.prototype.pop=function(){return setListBounds(this,0,-1)};List.prototype.unshift=function(){var values=arguments;return this.withMutations(function(list){setListBounds(list,-values.length);for(var ii=0;ii<values.length;ii++){list.set(ii,values[ii])}})};List.prototype.shift=function(){return setListBounds(this,1)};List.prototype.merge=function(){return mergeIntoListWith(this,undefined,arguments)};List.prototype.mergeWith=function(merger){var iters=SLICE$0.call(arguments,1);return mergeIntoListWith(this,merger,iters)};List.prototype.mergeDeep=function(){return mergeIntoListWith(this,deepMerger,arguments)};List.prototype.mergeDeepWith=function(merger){var iters=SLICE$0.call(arguments,1);return mergeIntoListWith(this,deepMergerWith(merger),iters)};List.prototype.setSize=function(size){return setListBounds(this,0,size)};List.prototype.slice=function(begin,end){var size=this.size;if(wholeSlice(begin,end,size)){return this}return setListBounds(this,resolveBegin(begin,size),resolveEnd(end,size))};List.prototype.__iterator=function(type,reverse){var index=0;var values=iterateList(this,reverse);return new Iterator(function(){var value=values();return value===DONE?iteratorDone():iteratorValue(type,index++,value)})};List.prototype.__iterate=function(fn,reverse){var index=0;var values=iterateList(this,reverse);var value;while((value=values())!==DONE){if(fn(value,index++,this)===false){break}}return index};List.prototype.__ensureOwner=function(ownerID){if(ownerID===this.__ownerID){return this}if(!ownerID){this.__ownerID=ownerID;return this}return makeList(this._origin,this._capacity,this._level,this._root,this._tail,ownerID,this.__hash)};function isList(maybeList){return!!(maybeList&&maybeList[IS_LIST_SENTINEL])}List.isList=isList;var IS_LIST_SENTINEL="@@__IMMUTABLE_LIST__@@";var ListPrototype=List.prototype;ListPrototype[IS_LIST_SENTINEL]=true;ListPrototype[DELETE]=ListPrototype.remove;ListPrototype.setIn=MapPrototype.setIn;ListPrototype.deleteIn=ListPrototype.removeIn=MapPrototype.removeIn;ListPrototype.update=MapPrototype.update;ListPrototype.updateIn=MapPrototype.updateIn;ListPrototype.mergeIn=MapPrototype.mergeIn;ListPrototype.mergeDeepIn=MapPrototype.mergeDeepIn;ListPrototype.withMutations=MapPrototype.withMutations;ListPrototype.asMutable=MapPrototype.asMutable;ListPrototype.asImmutable=MapPrototype.asImmutable;ListPrototype.wasAltered=MapPrototype.wasAltered;function VNode(array,ownerID){this.array=array;this.ownerID=ownerID}VNode.prototype.removeBefore=function(ownerID,level,index){if(index===level?1<<level:0||this.array.length===0){return this}var originIndex=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<originIndex;ii++){editable.array[ii]=undefined}}if(newChild){editable.array[originIndex]=newChild}return editable};VNode.prototype.removeAfter=function(ownerID,level,index){if(index===(level?1<<level:0)||this.array.length===0){return this}var sizeIndex=index-1>>>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(n
2018-03-27 09:25:20 +00:00
var RecordType=this.constructor;return RecordType._empty||(RecordType._empty=makeRecord(this,emptyMap()))};Record.prototype.set=function(k,v){if(!this.has(k)){throw new Error('Cannot set unknown key "'+k+'" on '+recordName(this))}if(this._map&&!this._map.has(k)){var defaultVal=this._defaultValues[k];if(v===defaultVal){return this}}var newMap=this._map&&this._map.set(k,v);if(this.__ownerID||newMap===this._map){return this}return makeRecord(this,newMap)};Record.prototype.remove=function(k){if(!this.has(k)){return this}var newMap=this._map&&this._map.remove(k);if(this.__ownerID||newMap===this._map){return this}return makeRecord(this,newMap)};Record.prototype.wasAltered=function(){return this._map.wasAltered()};Record.prototype.__iterator=function(type,reverse){var this$0=this;return KeyedIterable(this._defaultValues).map(function(_,k){return this$0.get(k)}).__iterator(type,reverse)};Record.prototype.__iterate=function(fn,reverse){var this$0=this;return KeyedIterable(this._defaultValues).map(function(_,k){return this$0.get(k)}).__iterate(fn,reverse)};Record.prototype.__ensureOwner=function(ownerID){if(ownerID===this.__ownerID){return this}var newMap=this._map&&this._map.__ensureOwner(ownerID);if(!ownerID){this.__ownerID=ownerID;this._map=newMap;return this}return makeRecord(this,newMap,ownerID)};var RecordPrototype=Record.prototype;RecordPrototype[DELETE]=RecordPrototype.remove;RecordPrototype.deleteIn=RecordPrototype.removeIn=MapPrototype.removeIn;RecordPrototype.merge=MapPrototype.merge;RecordPrototype.mergeWith=MapPrototype.mergeWith;RecordPrototype.mergeIn=MapPrototype.mergeIn;RecordPrototype.mergeDeep=MapPrototype.mergeDeep;RecordPrototype.mergeDeepWith=MapPrototype.mergeDeepWith;RecordPrototype.mergeDeepIn=MapPrototype.mergeDeepIn;RecordPrototype.setIn=MapPrototype.setIn;RecordPrototype.update=MapPrototype.update;RecordPrototype.updateIn=MapPrototype.updateIn;RecordPrototype.withMutations=MapPrototype.withMutations;RecordPrototype.asMutable=MapPrototype.asMutable;RecordPrototype.asImmutable=MapPrototype.asImmutable;function makeRecord(likeRecord,map,ownerID){var record=Object.create(Object.getPrototypeOf(likeRecord));record._map=map;record.__ownerID=ownerID;return record}function recordName(record){return record._name||record.constructor.name||"Record"}function setProps(prototype,names){try{names.forEach(setProp.bind(undefined,prototype))}catch(error){}}function setProp(prototype,name){Object.defineProperty(prototype,name,{get:function(){return this.get(name)},set:function(value){invariant(this.__ownerID,"Cannot set on an immutable record.");this.set(name,value)}})}createClass(Set,SetCollection);function Set(value){return value===null||value===undefined?emptySet():isSet(value)&&!isOrdered(value)?value:emptySet().withMutations(function(set){var iter=SetIterable(value);assertNotInfinite(iter.size);iter.forEach(function(v){return set.add(v)})})}Set.of=function(){return this(arguments)};Set.fromKeys=function(value){return this(KeyedIterable(value).keySeq())};Set.prototype.toString=function(){return this.__toString("Set {","}")};Set.prototype.has=function(value){return this._map.has(value)};Set.prototype.add=function(value){return updateSet(this,this._map.set(value,true))};Set.prototype.remove=function(value){return updateSet(this,this._map.remove(value))};Set.prototype.clear=function(){return updateSet(this,this._map.clear())};Set.prototype.union=function(){var iters=SLICE$0.call(arguments,0);iters=iters.filter(function(x){return x.size!==0});if(iters.length===0){return this}if(this.size===0&&!this.__ownerID&&iters.length===1){return this.constructor(iters[0])}return this.withMutations(function(set){for(var ii=0;ii<iters.length;ii++){SetIterable(iters[ii]).forEach(function(value){return set.add(value)})}})};Set.prototype.intersect=function(){var iters=SLICE$0.call(arguments,0);if(iters.length===0){return this}iters=iters.map(function(iter){return SetIterable(iter)});var originalSet=this;return this.withMutations(function(set){originalSet.forEach(function(value){if(!iters.every(function(iter){return iter.includes(value)}))
;Facet.prototype.addEndpoint=function(endpoint){var facet=this;var patch=facet.actor.dataflowGraph.withSubject([facet,endpoint],function(){return endpoint.subscriptionFn.call(facet.fields)});var r=facet.actor.mux.addStream(patch);endpoint.eid=r.pid;facet.endpoints=facet.endpoints.set(endpoint.eid,endpoint);Dataspace.stateChange(r.deltaAggregate);return facet};Facet.prototype.addInitBlock=function(thunk){this.initBlocks=this.initBlocks.push(thunk);return this};Facet.prototype.addDoneBlock=function(thunk){this.doneBlocks=this.doneBlocks.push(thunk);return this};Facet.prototype.completeBuild=function(){var facet=this;this.actor.addFacet(this);if(this.parent){this.parent.children=this.parent.children.add(this)}withCurrentFacet(facet,function(){facet.initBlocks.forEach(function(b){b.call(facet.fields)})});var initialEvent=_Dataspace.stateChange(new Patch.Patch(facet.actor.knowledge,Trie.emptyTrie));withCurrentFacet(facet,function(){facet.handleEvent(initialEvent,true)})};Facet.prototype.terminate=function(){var facet=this;if(facet.terminated)return;facet.terminated=true;var aggregate=Patch.emptyPatch;this.endpoints.forEach(function(endpoint,eid){var r=facet.actor.mux.removeStream(eid);aggregate=aggregate.andThen(r.deltaAggregate)});Dataspace.stateChange(aggregate);this.endpoints=Immutable.Map();if(this.parent){this.parent.children=this.parent.children.remove(this)}this.actor.removeFacet(this);this.children.forEach(function(child){child.terminate()});withCurrentFacet(facet,function(){facet.doneBlocks.forEach(function(b){b.call(facet.fields)})})};function Endpoint(subscriptionFn,handlerFn){this.subscriptionFn=subscriptionFn;this.handlerFn=handlerFn;this.eid="uninitialized_eid"}function referenceField(obj,prop){if(!(prop in obj)){Dataspace.activeBehavior().dataflowGraph.recordObservation(Immutable.List.of(obj,prop))}return obj[prop]}function declareField(obj,prop,init){if(prop in obj){obj[prop]=init}else{Dataspace.activeBehavior().dataflowGraph.defineObservableProperty(obj,prop,init,{objectId:Immutable.List.of(obj,prop)})}}function deleteField(obj,prop){Dataspace.activeBehavior().dataflowGraph.recordDamage(Immutable.List.of(obj,prop));return delete obj[prop]}module.exports.spawnActor=spawnActor;module.exports.Facet=Facet;module.exports.referenceField=referenceField;module.exports.declareField=declareField;module.exports.deleteField=deleteField},{"./dataflow.js":232,"./dataspace.js":233,"./mux.js":238,"./patch.js":239,"./trie.js":246,"./util.js":248,immutable:227}],230:[function(require,module,exports){"use strict";var Immutable=require("immutable");var Trie=require("./trie.js");var Patch=require("./patch.js");var Struct=require("./struct.js");var DemandMatcher=require("./demand-matcher.js").DemandMatcher;var Codec=require("./codec");var Dataspace_=require("./dataspace.js");var Dataspace=Dataspace_.Dataspace;var __=Dataspace_.__;var _$=Dataspace_._$;var DEFAULT_RECONNECT_DELAY=100;var MAX_RECONNECT_DELAY=3e4;var DEFAULT_IDLE_TIMEOUT=3e5;var DEFAULT_PING_INTERVAL=DEFAULT_IDLE_TIMEOUT-1e4;var toBroker=Struct.makeConstructor("toBroker",["url","assertion"]);var fromBroker=Struct.makeConstructor("fromBroker",["url","assertion"]);var brokerConnection=Struct.makeConstructor("brokerConnection",["url"]);var brokerConnected=Struct.makeConstructor("brokerConnected",["url"]);var forceBrokerDisconnect=Struct.makeConstructor("forceBrokerDisconnect",["url"]);function spawnBrokerClientDriver(){var URL=_$("url");Dataspace.spawn(new Dataspace(function(){Dataspace.spawn(new DemandMatcher([brokerConnection(URL)],[brokerConnection(URL)],function(c){Dataspace.spawn(new BrokerClientConnection(c.url))},{demandMetaLevel:1,supplyMetaLevel:0}))}))}function BrokerClientConnection(wsurl){this.wsurl=wsurl;this.sock=null;this.sendsAttempted=0;this.sendsTransmitted=0;this.receiveCount=0;this.connectionCount=0;this.reconnectDelay=DEFAULT_RECONNECT_DELAY;this.idleTimeout=DEFAULT_IDLE_TIMEOUT;this.pingInterval=DEFAULT_PING_INTERVAL;this.localAssertions=Trie.emptyTrie;this.connectionInterrupted=false;this.activityTimestamp=0;this.idleTimer=null;this.pingTimer=null
;var affectedPids=computeAffectedPids(oldRoutingTable,deltaAggregateNoEcho).add(actingPid).remove("meta");return{eventMap:Immutable.Map().withMutations(function(result){affectedPids.forEach(function(pid){var patchForPid;if(pid===actingPid){var part1=new Patch.Patch(echoCancelledTrie(Patch.biasedIntersection(newRoutingTable,delta.added)),echoCancelledTrie(Patch.biasedIntersection(oldRoutingTable,delta.removed)));var part2=new Patch.Patch(Patch.biasedIntersection(deltaAggregateNoEcho.added,newMux.interestsOf(pid)),Patch.biasedIntersection(deltaAggregateNoEcho.removed,oldMux.interestsOf(pid)));patchForPid=part1.unsafeUnion(part2)}else{patchForPid=deltaAggregateNoEcho.viewFrom(oldMux.interestsOf(pid))}if(patchForPid.isNonEmpty()){result.set(pid,patchForPid)}})}),metaEvents:actingPid==="meta"?Immutable.List():Immutable.List.of(delta.computeAggregate(actingPid,oldRoutingTable,true).drop())}}function computeAffectedPids(routingTable,delta){var cover=Trie._union(delta.added,delta.removed);routingTable=Trie.trieStep(routingTable,Patch.observe.meta.arity,Patch.observe.meta);return Trie.matchTrie(cover,routingTable,Immutable.Set(),function(v1,v2,acc){return acc.union(v2)})}Mux.prototype.routeMessage=function(body){if(Trie.matchValue(this.routingTable,body,null,function(a,b){return a||b})===null){return Trie.matchValue(this.routingTable,Patch.observe(body),Immutable.Set(),function(a,b){return a.union(b)})}else{return Immutable.Set()}};Mux.prototype.interestsOf=function(pid){return this.interestTable.get(pid,Trie.emptyTrie)};module.exports.Mux=Mux;module.exports.computeEvents=computeEvents;module.exports.computeAffectedPids=computeAffectedPids},{"./patch.js":239,"./trie.js":246,immutable:227}],239:[function(require,module,exports){"use strict";var Trie=require("./trie.js");var Struct=require("./struct.js");var Immutable=require("immutable");var __=Trie.__;var _$=Trie._$;function Patch(added,removed){this.added=added;this.removed=removed}var emptyPatch=new Patch(Trie.emptyTrie,Trie.emptyTrie);var removeEverythingPatch=new Patch(Trie.emptyTrie,Trie.compilePattern(true,__));var trueLabel=Trie.trieSuccess(true);var observe=Struct.makeConstructor("observe",["assertion"]);var atMeta=Struct.makeConstructor("at-meta",["assertion"]);var advertise=Struct.makeConstructor("advertise",["assertion"]);function prependAtMeta(p,level){while(level--){p=atMeta(p)}return p}function stripAtMeta(p,level){while(level--){if(atMeta.isClassOf(p)){p=p[0]}else{return null}}return p}function observeAtMeta(p,level){if(level===0){return Trie.compilePattern(true,observe(p))}else{return Trie._union(Trie.compilePattern(true,observe(prependAtMeta(p,level))),Trie.compilePattern(true,atMeta(Trie.embeddedTrie(observeAtMeta(p,level-1)))))}}function _check(p){if(p instanceof Patch){throw new Error("Cannot construct patch pattern using an embedded patch")}return p}function assert(p,metaLevel){return new Patch(Trie.compilePattern(true,prependAtMeta(_check(p),metaLevel||0)),Trie.emptyTrie)}function retract(p,metaLevel){return new Patch(Trie.emptyTrie,Trie.compilePattern(true,prependAtMeta(_check(p),metaLevel||0)))}function sub(p,metaLevel){return new Patch(observeAtMeta(_check(p),metaLevel||0),Trie.emptyTrie)}function unsub(p,metaLevel){return new Patch(Trie.emptyTrie,observeAtMeta(_check(p),metaLevel||0))}function pub(p,metaLevel){return assert(advertise(_check(p)),metaLevel)}function unpub(p,metaLevel){return retract(advertise(_check(p)),metaLevel)}Patch.prototype.equals=function(other){if(!(other instanceof Patch))return false;return Immutable.is(this.added,other.added)&&Immutable.is(this.removed,other.removed)};Patch.prototype.isEmpty=function(){return this.added===Trie.emptyTrie&&this.removed===Trie.emptyTrie};Patch.prototype.isNonEmpty=function(){return!this.isEmpty()};Patch.prototype.hasAdded=function(){return!Trie.is_emptyTrie(this.added)};Patch.prototype.hasRemoved=function(){return!Trie.is_emptyTrie(this.removed)};Patch.prototype.lift=function(){return new Patch(Trie.compilePattern(true,atMeta(Trie.embeddedTrie(this.added))),Trie.compilePattern(true,atMeta(Trie.emb
return new Struct.StructureType(key.slice(1),arity)}else if(key==="L"){return SOA}throw new Error("Unsupported JSON trie paren type: "+key)}function trieToJSON(t){if(is_emptyTrie(t)){return[]}if(t instanceof $Success){return[true]}var jParens=[];var jAtoms=[];t.edges.forEach(function(keymap,arity){keymap.forEach(function(k,key){var jk=trieToJSON(k);if(Struct.isStructureType(key)||key===SOA){jParens.push([arity,parenTypeToString(key),jk])}else{jAtoms.push([key,jk])}})});return[jParens,trieToJSON(t.wild),jAtoms]}function badJSON(j){die("Cannot deserialize JSON trie: "+JSON.stringify(j))}function trieFromJSON(j){return decode(j);function decode(j){if(!Array.isArray(j))badJSON(j);switch(j.length){case 0:return emptyTrie;case 1:return rsuccess(true);case 3:{var result=rcopybranch(expand(rwild(decode(j[1]))));j[0].forEach(function(entry){var arity=entry[0];if(typeof arity!=="number")badJSON(j);var key=stringToParenType(arity,entry[1]);rupdate_inplace(result,arity,key,decode(entry[2]))});j[2].forEach(function(entry){var key=entry[0];rupdate_inplace(result,0,key,decode(entry[1]))});return collapse(result)}default:badJSON(j)}}}module.exports.__=__;module.exports.SOA=SOA;module.exports.$Capture=$Capture;module.exports.$Special=$Special;module.exports._$=_$;module.exports.is_emptyTrie=is_emptyTrie;module.exports.emptyTrie=emptyTrie;module.exports.embeddedTrie=embeddedTrie;module.exports.embeddedTrieArray=embeddedTrieArray;module.exports.compilePattern=compilePattern;module.exports.matchPattern=matchPattern;module.exports._union=union;module.exports.union=unionN;module.exports.intersect=intersect;module.exports.subtract=subtract;module.exports.matchValue=matchValue;module.exports.matchTrie=matchTrie;module.exports.appendTrie=appendTrie;module.exports.trieStep=trieStep;module.exports.trieSuccess=rsuccess;module.exports.relabel=relabel;module.exports.projectionNames=projectionNames;module.exports.projectionArity=projectionArity;module.exports.projectionToPattern=projectionToPattern;module.exports.project=project;module.exports.projectMany=projectMany;module.exports.trieKeys=trieKeys;module.exports.captureToObject=captureToObject;module.exports.trieKeysToObjects=trieKeysToObjects;module.exports.projectObjects=projectObjects;module.exports.instantiateProjection=instantiateProjection;module.exports.prettyTrie=prettyTrie;module.exports.trieToJSON=trieToJSON;module.exports.trieFromJSON=trieFromJSON;module.exports._testing={rsuccess:rsuccess,rseq:rseq,rwild:rwild}},{"./special.js":243,"./struct.js":244,immutable:227}],247:[function(require,module,exports){"use strict";var Immutable=require("immutable");var Patch=require("./patch.js");var Trie=require("./trie.js");var DemandMatcher=require("./demand-matcher.js").DemandMatcher;var Struct=require("./struct.js");var RandomID=require("./randomid.js");var Dataspace_=require("./dataspace.js");var Dataspace=Dataspace_.Dataspace;var __=Dataspace_.__;var _$=Dataspace_._$;var globalEvent=Struct.makeConstructor("global-event",["selector","eventType","event"]);var windowEvent=Struct.makeConstructor("window-event",["eventType","event"]);var uiEvent=Struct.makeConstructor("ui-event",["fragmentId","selector","eventType","event"]);var uiFragment=Struct.makeConstructor("ui-fragment",["fragmentId","selector","html","orderBy"]);var uiFragmentVersion=Struct.makeConstructor("ui-fragment-version",["fragmentId","version"]);var uiAttribute=Struct.makeConstructor("ui-attribute",["selector","attribute","value"]);var uiProperty=Struct.makeConstructor("ui-property",["selector","property","value"]);var setAttribute=Struct.makeConstructor("set-ui-attribute",["selector","attribute","value"]);var removeAttribute=Struct.makeConstructor("remove-ui-attribute",["selector","attribute"]);var setProperty=Struct.makeConstructor("set-ui-property",["selector","property","value"]);var removeProperty=Struct.makeConstructor("remove-ui-property",["selector","property"]);var locationHash=Struct.makeConstructor("locationHash",["value"]);var setLocationHash=Struct.makeConstructor("setLocationHash",["value"]);var moduleInstance=RandomID.ra