made with requirebin
Created
June 3, 2014 02:46
-
-
Save BenMagyar/12930280fdb91cc1c631 to your computer and use it in GitHub Desktop.
requirebin sketch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var request = require('request'); | |
var searches = [ { url: 'http://musicbrainz.tranquilbase.org/ws/2/release-group?query=' + 'test', | |
type: 'album' }, | |
{ url: 'http://musicbrainz.tranquilbase.org/ws/2/artist?query=' + 'test', | |
type: 'artist' } | |
]; | |
searches.map(function(search){ | |
request(search.url + '&fmt=json&limit=5', function(error, response, body){ | |
if(!error && response.statusCode == 200) { | |
if (search.type === 'artist') { | |
return JSON.parse(body).artist; | |
} else if (search.type === 'album') { | |
return JSON.parse(body)['release-groups']; | |
} | |
} | |
}); | |
}).reduce(function(last, now){ | |
return last.concat(now); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require=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);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.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){var base64=require("base64-js");var ieee754=require("ieee754");exports.Buffer=Buffer;exports.SlowBuffer=Buffer;exports.INSPECT_MAX_BYTES=50;Buffer.poolSize=8192;Buffer._useTypedArrays=function(){try{var buf=new ArrayBuffer(0);var arr=new Uint8Array(buf);arr.foo=function(){return 42};return 42===arr.foo()&&typeof arr.subarray==="function"}catch(e){return false}}();function Buffer(subject,encoding,noZero){if(!(this instanceof Buffer))return new Buffer(subject,encoding,noZero);var type=typeof subject;if(encoding==="base64"&&type==="string"){subject=stringtrim(subject);while(subject.length%4!==0){subject=subject+"="}}var length;if(type==="number")length=coerce(subject);else if(type==="string")length=Buffer.byteLength(subject,encoding);else if(type==="object")length=coerce(subject.length);else throw new Error("First argument needs to be a number, array or string.");var buf;if(Buffer._useTypedArrays){buf=Buffer._augment(new Uint8Array(length))}else{buf=this;buf.length=length;buf._isBuffer=true}var i;if(Buffer._useTypedArrays&&typeof subject.byteLength==="number"){buf._set(subject)}else if(isArrayish(subject)){for(i=0;i<length;i++){if(Buffer.isBuffer(subject))buf[i]=subject.readUInt8(i);else buf[i]=subject[i]}}else if(type==="string"){buf.write(subject,0,encoding)}else if(type==="number"&&!Buffer._useTypedArrays&&!noZero){for(i=0;i<length;i++){buf[i]=0}}return buf}Buffer.isEncoding=function(encoding){switch(String(encoding).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return true;default:return false}};Buffer.isBuffer=function(b){return!!(b!==null&&b!==undefined&&b._isBuffer)};Buffer.byteLength=function(str,encoding){var ret;str=str+"";switch(encoding||"utf8"){case"hex":ret=str.length/2;break;case"utf8":case"utf-8":ret=utf8ToBytes(str).length;break;case"ascii":case"binary":case"raw":ret=str.length;break;case"base64":ret=base64ToBytes(str).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":ret=str.length*2;break;default:throw new Error("Unknown encoding")}return ret};Buffer.concat=function(list,totalLength){assert(isArray(list),"Usage: Buffer.concat(list, [totalLength])\n"+"list should be an Array.");if(list.length===0){return new Buffer(0)}else if(list.length===1){return list[0]}var i;if(typeof totalLength!=="number"){totalLength=0;for(i=0;i<list.length;i++){totalLength+=list[i].length}}var buf=new Buffer(totalLength);var pos=0;for(i=0;i<list.length;i++){var item=list[i];item.copy(buf,pos);pos+=item.length}return buf};function _hexWrite(buf,string,offset,length){offset=Number(offset)||0;var remaining=buf.length-offset;if(!length){length=remaining}else{length=Number(length);if(length>remaining){length=remaining}}var strLen=string.length;assert(strLen%2===0,"Invalid hex string");if(length>strLen/2){length=strLen/2}for(var i=0;i<length;i++){var byte=parseInt(string.substr(i*2,2),16);assert(!isNaN(byte),"Invalid hex string");buf[offset+i]=byte}Buffer._charsWritten=i*2;return i}function _utf8Write(buf,string,offset,length){var charsWritten=Buffer._charsWritten=blitBuffer(utf8ToBytes(string),buf,offset,length);return charsWritten}function _asciiWrite(buf,string,offset,length){var charsWritten=Buffer._charsWritten=blitBuffer(asciiToBytes(string),buf,offset,length);return charsWritten}function _binaryWrite(buf,string,offset,length){return _asciiWrite(buf,string,offset,length)}function _base64Write(buf,string,offset,length){var charsWritten=Buffer._charsWritten=blitBuffer(base64ToBytes(string),buf,offset,length);return charsWritten}function _utf16leWrite(buf,string,offset,length){var charsWritten=Buffer._charsWritten=blitBuffer(utf16leToBytes(string),buf,offset,length);return charsWritten}Buffer.prototype.write=function(string,offset,length,encoding){if(isFinite(offset)){if(!isFinite(length)){encoding=length;length=undefined}}else{var swap=encoding;encoding=offset;offset=length;length=swap}offset=Number(offset)||0;var remaining=this.length-offset;if(!length){length=remaining}else{length=Number(length);if(length>remaining){length=remaining}}encoding=String(encoding||"utf8").toLowerCase();var ret;switch(encoding){case"hex":ret=_hexWrite(this,string,offset,length);break;case"utf8":case"utf-8":ret=_utf8Write(this,string,offset,length);break;case"ascii":ret=_asciiWrite(this,string,offset,length);break;case"binary":ret=_binaryWrite(this,string,offset,length);break;case"base64":ret=_base64Write(this,string,offset,length);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":ret=_utf16leWrite(this,string,offset,length);break;default:throw new Error("Unknown encoding")}return ret};Buffer.prototype.toString=function(encoding,start,end){var self=this;encoding=String(encoding||"utf8").toLowerCase();start=Number(start)||0;end=end!==undefined?Number(end):end=self.length;if(end===start)return"";var ret;switch(encoding){case"hex":ret=_hexSlice(self,start,end);break;case"utf8":case"utf-8":ret=_utf8Slice(self,start,end);break;case"ascii":ret=_asciiSlice(self,start,end);break;case"binary":ret=_binarySlice(self,start,end);break;case"base64":ret=_base64Slice(self,start,end);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":ret=_utf16leSlice(self,start,end);break;default:throw new Error("Unknown encoding")}return ret};Buffer.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};Buffer.prototype.copy=function(target,target_start,start,end){var source=this;if(!start)start=0;if(!end&&end!==0)end=this.length;if(!target_start)target_start=0;if(end===start)return;if(target.length===0||source.length===0)return;assert(end>=start,"sourceEnd < sourceStart");assert(target_start>=0&&target_start<target.length,"targetStart out of bounds");assert(start>=0&&start<source.length,"sourceStart out of bounds");assert(end>=0&&end<=source.length,"sourceEnd out of bounds");if(end>this.length)end=this.length;if(target.length-target_start<end-start)end=target.length-target_start+start;var len=end-start;if(len<100||!Buffer._useTypedArrays){for(var i=0;i<len;i++)target[i+target_start]=this[i+start]}else{target._set(this.subarray(start,start+len),target_start)}};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){var res="";var tmp="";end=Math.min(buf.length,end);for(var i=start;i<end;i++){if(buf[i]<=127){res+=decodeUtf8Char(tmp)+String.fromCharCode(buf[i]);tmp=""}else{tmp+="%"+buf[i].toString(16)}}return res+decodeUtf8Char(tmp)}function _asciiSlice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;i<end;i++)ret+=String.fromCharCode(buf[i]);return ret}function _binarySlice(buf,start,end){return _asciiSlice(buf,start,end)}function _hexSlice(buf,start,end){var len=buf.length;if(!start||start<0)start=0;if(!end||end<0||end>len)end=len;var out="";for(var i=start;i<end;i++){out+=toHex(buf[i])}return out}function _utf16leSlice(buf,start,end){var bytes=buf.slice(start,end);var res="";for(var i=0;i<bytes.length;i+=2){res+=String.fromCharCode(bytes[i]+bytes[i+1]*256)}return res}Buffer.prototype.slice=function(start,end){var len=this.length;start=clamp(start,len,0);end=clamp(end,len,len);if(Buffer._useTypedArrays){return Buffer._augment(this.subarray(start,end))}else{var sliceLen=end-start;var newBuf=new Buffer(sliceLen,undefined,true);for(var i=0;i<sliceLen;i++){newBuf[i]=this[i+start]}return newBuf}};Buffer.prototype.get=function(offset){console.log(".get() is deprecated. Access using array indexes instead.");return this.readUInt8(offset)};Buffer.prototype.set=function(v,offset){console.log(".set() is deprecated. Access using array indexes instead.");return this.writeUInt8(v,offset)};Buffer.prototype.readUInt8=function(offset,noAssert){if(!noAssert){assert(offset!==undefined&&offset!==null,"missing offset");assert(offset<this.length,"Trying to read beyond buffer length")}if(offset>=this.length)return;return this[offset]};function _readUInt16(buf,offset,littleEndian,noAssert){if(!noAssert){assert(typeof littleEndian==="boolean","missing or invalid endian");assert(offset!==undefined&&offset!==null,"missing offset");assert(offset+1<buf.length,"Trying to read beyond buffer length")}var len=buf.length;if(offset>=len)return;var val;if(littleEndian){val=buf[offset];if(offset+1<len)val|=buf[offset+1]<<8}else{val=buf[offset]<<8;if(offset+1<len)val|=buf[offset+1]}return val}Buffer.prototype.readUInt16LE=function(offset,noAssert){return _readUInt16(this,offset,true,noAssert)};Buffer.prototype.readUInt16BE=function(offset,noAssert){return _readUInt16(this,offset,false,noAssert)};function _readUInt32(buf,offset,littleEndian,noAssert){if(!noAssert){assert(typeof littleEndian==="boolean","missing or invalid endian");assert(offset!==undefined&&offset!==null,"missing offset");assert(offset+3<buf.length,"Trying to read beyond buffer length")}var len=buf.length;if(offset>=len)return;var val;if(littleEndian){if(offset+2<len)val=buf[offset+2]<<16;if(offset+1<len)val|=buf[offset+1]<<8;val|=buf[offset];if(offset+3<len)val=val+(buf[offset+3]<<24>>>0)}else{if(offset+1<len)val=buf[offset+1]<<16;if(offset+2<len)val|=buf[offset+2]<<8;if(offset+3<len)val|=buf[offset+3];val=val+(buf[offset]<<24>>>0)}return val}Buffer.prototype.readUInt32LE=function(offset,noAssert){return _readUInt32(this,offset,true,noAssert)};Buffer.prototype.readUInt32BE=function(offset,noAssert){return _readUInt32(this,offset,false,noAssert)};Buffer.prototype.readInt8=function(offset,noAssert){if(!noAssert){assert(offset!==undefined&&offset!==null,"missing offset");assert(offset<this.length,"Trying to read beyond buffer length")}if(offset>=this.length)return;var neg=this[offset]&128;if(neg)return(255-this[offset]+1)*-1;else return this[offset]};function _readInt16(buf,offset,littleEndian,noAssert){if(!noAssert){assert(typeof littleEndian==="boolean","missing or invalid endian");assert(offset!==undefined&&offset!==null,"missing offset");assert(offset+1<buf.length,"Trying to read beyond buffer length")}var len=buf.length;if(offset>=len)return;var val=_readUInt16(buf,offset,littleEndian,true);var neg=val&32768;if(neg)return(65535-val+1)*-1;else return val}Buffer.prototype.readInt16LE=function(offset,noAssert){return _readInt16(this,offset,true,noAssert)};Buffer.prototype.readInt16BE=function(offset,noAssert){return _readInt16(this,offset,false,noAssert)};function _readInt32(buf,offset,littleEndian,noAssert){if(!noAssert){assert(typeof littleEndian==="boolean","missing or invalid endian");assert(offset!==undefined&&offset!==null,"missing offset");assert(offset+3<buf.length,"Trying to read beyond buffer length")}var len=buf.length;if(offset>=len)return;var val=_readUInt32(buf,offset,littleEndian,true);var neg=val&2147483648;if(neg)return(4294967295-val+1)*-1;else return val}Buffer.prototype.readInt32LE=function(offset,noAssert){return _readInt32(this,offset,true,noAssert)};Buffer.prototype.readInt32BE=function(offset,noAssert){return _readInt32(this,offset,false,noAssert)};function _readFloat(buf,offset,littleEndian,noAssert){if(!noAssert){assert(typeof littleEndian==="boolean","missing or invalid endian");assert(offset+3<buf.length,"Trying to read beyond buffer length")}return ieee754.read(buf,offset,littleEndian,23,4)}Buffer.prototype.readFloatLE=function(offset,noAssert){return _readFloat(this,offset,true,noAssert)};Buffer.prototype.readFloatBE=function(offset,noAssert){return _readFloat(this,offset,false,noAssert)};function _readDouble(buf,offset,littleEndian,noAssert){if(!noAssert){assert(typeof littleEndian==="boolean","missing or invalid endian");assert(offset+7<buf.length,"Trying to read beyond buffer length")}return ieee754.read(buf,offset,littleEndian,52,8)}Buffer.prototype.readDoubleLE=function(offset,noAssert){return _readDouble(this,offset,true,noAssert)};Buffer.prototype.readDoubleBE=function(offset,noAssert){return _readDouble(this,offset,false,noAssert)};Buffer.prototype.writeUInt8=function(value,offset,noAssert){if(!noAssert){assert(value!==undefined&&value!==null,"missing value");assert(offset!==undefined&&offset!==null,"missing offset");assert(offset<this.length,"trying to write beyond buffer length");verifuint(value,255)}if(offset>=this.length)return;this[offset]=value};function _writeUInt16(buf,value,offset,littleEndian,noAssert){if(!noAssert){assert(value!==undefined&&value!==null,"missing value");assert(typeof littleEndian==="boolean","missing or invalid endian");assert(offset!==undefined&&offset!==null,"missing offset");assert(offset+1<buf.length,"trying to write beyond buffer length");verifuint(value,65535)}var len=buf.length;if(offset>=len)return;for(var i=0,j=Math.min(len-offset,2);i<j;i++){buf[offset+i]=(value&255<<8*(littleEndian?i:1-i))>>>(littleEndian?i:1-i)*8}}Buffer.prototype.writeUInt16LE=function(value,offset,noAssert){_writeUInt16(this,value,offset,true,noAssert)};Buffer.prototype.writeUInt16BE=function(value,offset,noAssert){_writeUInt16(this,value,offset,false,noAssert)};function _writeUInt32(buf,value,offset,littleEndian,noAssert){if(!noAssert){assert(value!==undefined&&value!==null,"missing value");assert(typeof littleEndian==="boolean","missing or invalid endian");assert(offset!==undefined&&offset!==null,"missing offset");assert(offset+3<buf.length,"trying to write beyond buffer length");verifuint(value,4294967295)}var len=buf.length;if(offset>=len)return;for(var i=0,j=Math.min(len-offset,4);i<j;i++){buf[offset+i]=value>>>(littleEndian?i:3-i)*8&255}}Buffer.prototype.writeUInt32LE=function(value,offset,noAssert){_writeUInt32(this,value,offset,true,noAssert)};Buffer.prototype.writeUInt32BE=function(value,offset,noAssert){_writeUInt32(this,value,offset,false,noAssert)};Buffer.prototype.writeInt8=function(value,offset,noAssert){if(!noAssert){assert(value!==undefined&&value!==null,"missing value");assert(offset!==undefined&&offset!==null,"missing offset");assert(offset<this.length,"Trying to write beyond buffer length");verifsint(value,127,-128)}if(offset>=this.length)return;if(value>=0)this.writeUInt8(value,offset,noAssert);else this.writeUInt8(255+value+1,offset,noAssert)};function _writeInt16(buf,value,offset,littleEndian,noAssert){if(!noAssert){assert(value!==undefined&&value!==null,"missing value");assert(typeof littleEndian==="boolean","missing or invalid endian");assert(offset!==undefined&&offset!==null,"missing offset");assert(offset+1<buf.length,"Trying to write beyond buffer length");verifsint(value,32767,-32768)}var len=buf.length;if(offset>=len)return;if(value>=0)_writeUInt16(buf,value,offset,littleEndian,noAssert);else _writeUInt16(buf,65535+value+1,offset,littleEndian,noAssert)}Buffer.prototype.writeInt16LE=function(value,offset,noAssert){_writeInt16(this,value,offset,true,noAssert)};Buffer.prototype.writeInt16BE=function(value,offset,noAssert){_writeInt16(this,value,offset,false,noAssert)};function _writeInt32(buf,value,offset,littleEndian,noAssert){if(!noAssert){assert(value!==undefined&&value!==null,"missing value");assert(typeof littleEndian==="boolean","missing or invalid endian");assert(offset!==undefined&&offset!==null,"missing offset");assert(offset+3<buf.length,"Trying to write beyond buffer length");verifsint(value,2147483647,-2147483648)}var len=buf.length;if(offset>=len)return;if(value>=0)_writeUInt32(buf,value,offset,littleEndian,noAssert);else _writeUInt32(buf,4294967295+value+1,offset,littleEndian,noAssert)}Buffer.prototype.writeInt32LE=function(value,offset,noAssert){_writeInt32(this,value,offset,true,noAssert)};Buffer.prototype.writeInt32BE=function(value,offset,noAssert){_writeInt32(this,value,offset,false,noAssert)};function _writeFloat(buf,value,offset,littleEndian,noAssert){if(!noAssert){assert(value!==undefined&&value!==null,"missing value");assert(typeof littleEndian==="boolean","missing or invalid endian");assert(offset!==undefined&&offset!==null,"missing offset");assert(offset+3<buf.length,"Trying to write beyond buffer length");verifIEEE754(value,3.4028234663852886e38,-3.4028234663852886e38)}var len=buf.length;if(offset>=len)return;ieee754.write(buf,value,offset,littleEndian,23,4)}Buffer.prototype.writeFloatLE=function(value,offset,noAssert){_writeFloat(this,value,offset,true,noAssert)};Buffer.prototype.writeFloatBE=function(value,offset,noAssert){_writeFloat(this,value,offset,false,noAssert)};function _writeDouble(buf,value,offset,littleEndian,noAssert){if(!noAssert){assert(value!==undefined&&value!==null,"missing value");assert(typeof littleEndian==="boolean","missing or invalid endian");assert(offset!==undefined&&offset!==null,"missing offset");assert(offset+7<buf.length,"Trying to write beyond buffer length");verifIEEE754(value,1.7976931348623157e308,-1.7976931348623157e308)}var len=buf.length;if(offset>=len)return;ieee754.write(buf,value,offset,littleEndian,52,8)}Buffer.prototype.writeDoubleLE=function(value,offset,noAssert){_writeDouble(this,value,offset,true,noAssert)};Buffer.prototype.writeDoubleBE=function(value,offset,noAssert){_writeDouble(this,value,offset,false,noAssert)};Buffer.prototype.fill=function(value,start,end){if(!value)value=0;if(!start)start=0;if(!end)end=this.length;if(typeof value==="string"){value=value.charCodeAt(0)}assert(typeof value==="number"&&!isNaN(value),"value is not a number");assert(end>=start,"end < start");if(end===start)return;if(this.length===0)return;assert(start>=0&&start<this.length,"start out of bounds");assert(end>=0&&end<=this.length,"end out of bounds");for(var i=start;i<end;i++){this[i]=value}};Buffer.prototype.inspect=function(){var out=[];var len=this.length;for(var i=0;i<len;i++){out[i]=toHex(this[i]);if(i===exports.INSPECT_MAX_BYTES){out[i+1]="...";break}}return"<Buffer "+out.join(" ")+">"};Buffer.prototype.toArrayBuffer=function(){if(typeof Uint8Array!=="undefined"){if(Buffer._useTypedArrays){return new Buffer(this).buffer}else{var buf=new Uint8Array(this.length);for(var i=0,len=buf.length;i<len;i+=1)buf[i]=this[i];return buf.buffer}}else{throw new Error("Buffer.toArrayBuffer not supported in this browser")}};function stringtrim(str){if(str.trim)return str.trim();return str.replace(/^\s+|\s+$/g,"")}var BP=Buffer.prototype;Buffer._augment=function(arr){arr._isBuffer=true;arr._get=arr.get;arr._set=arr.set;arr.get=BP.get;arr.set=BP.set;arr.write=BP.write;arr.toString=BP.toString;arr.toLocaleString=BP.toString;arr.toJSON=BP.toJSON;arr.copy=BP.copy;arr.slice=BP.slice;arr.readUInt8=BP.readUInt8;arr.readUInt16LE=BP.readUInt16LE;arr.readUInt16BE=BP.readUInt16BE;arr.readUInt32LE=BP.readUInt32LE;arr.readUInt32BE=BP.readUInt32BE;arr.readInt8=BP.readInt8;arr.readInt16LE=BP.readInt16LE;arr.readInt16BE=BP.readInt16BE;arr.readInt32LE=BP.readInt32LE;arr.readInt32BE=BP.readInt32BE;arr.readFloatLE=BP.readFloatLE;arr.readFloatBE=BP.readFloatBE;arr.readDoubleLE=BP.readDoubleLE;arr.readDoubleBE=BP.readDoubleBE;arr.writeUInt8=BP.writeUInt8;arr.writeUInt16LE=BP.writeUInt16LE;arr.writeUInt16BE=BP.writeUInt16BE;arr.writeUInt32LE=BP.writeUInt32LE;arr.writeUInt32BE=BP.writeUInt32BE;arr.writeInt8=BP.writeInt8;arr.writeInt16LE=BP.writeInt16LE;arr.writeInt16BE=BP.writeInt16BE;arr.writeInt32LE=BP.writeInt32LE;arr.writeInt32BE=BP.writeInt32BE;arr.writeFloatLE=BP.writeFloatLE;arr.writeFloatBE=BP.writeFloatBE;arr.writeDoubleLE=BP.writeDoubleLE;arr.writeDoubleBE=BP.writeDoubleBE;arr.fill=BP.fill;arr.inspect=BP.inspect;arr.toArrayBuffer=BP.toArrayBuffer;return arr};function clamp(index,len,defaultValue){if(typeof index!=="number")return defaultValue;index=~~index;if(index>=len)return len;if(index>=0)return index;index+=len;if(index>=0)return index;return 0}function coerce(length){length=~~Math.ceil(+length);return length<0?0:length}function isArray(subject){return(Array.isArray||function(subject){return Object.prototype.toString.call(subject)==="[object Array]"})(subject)}function isArrayish(subject){return isArray(subject)||Buffer.isBuffer(subject)||subject&&typeof subject==="object"&&typeof subject.length==="number"}function toHex(n){if(n<16)return"0"+n.toString(16);return n.toString(16)}function utf8ToBytes(str){var byteArray=[];for(var i=0;i<str.length;i++){var b=str.charCodeAt(i);if(b<=127)byteArray.push(str.charCodeAt(i));else{var start=i;if(b>=55296&&b<=57343)i++;var h=encodeURIComponent(str.slice(start,i+1)).substr(1).split("%");for(var j=0;j<h.length;j++)byteArray.push(parseInt(h[j],16))}}return byteArray}function asciiToBytes(str){var byteArray=[];for(var i=0;i<str.length;i++){byteArray.push(str.charCodeAt(i)&255)}return byteArray}function utf16leToBytes(str){var c,hi,lo;var byteArray=[];for(var i=0;i<str.length;i++){c=str.charCodeAt(i);hi=c>>8;lo=c%256;byteArray.push(lo);byteArray.push(hi)}return byteArray}function base64ToBytes(str){return base64.toByteArray(str)}function blitBuffer(src,dst,offset,length){var pos;for(var i=0;i<length;i++){if(i+offset>=dst.length||i>=src.length)break;dst[i+offset]=src[i]}return i}function decodeUtf8Char(str){try{return decodeURIComponent(str)}catch(err){return String.fromCharCode(65533)}}function verifuint(value,max){assert(typeof value==="number","cannot write a non-number as a number");assert(value>=0,"specified a negative value for writing an unsigned value");assert(value<=max,"value is larger than maximum value for type");assert(Math.floor(value)===value,"value has a fractional component")}function verifsint(value,max,min){assert(typeof value==="number","cannot write a non-number as a number");assert(value<=max,"value larger than maximum allowed value");assert(value>=min,"value smaller than minimum allowed value");assert(Math.floor(value)===value,"value has a fractional component")}function verifIEEE754(value,max,min){assert(typeof value==="number","cannot write a non-number as a number");assert(value<=max,"value larger than maximum allowed value");assert(value>=min,"value smaller than minimum allowed value")}function assert(test,message){if(!test)throw new Error(message||"Failed assertion")}},{"base64-js":3,ieee754:4}],3:[function(require,module,exports){var lookup="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";(function(exports){"use strict";var Arr=typeof Uint8Array!=="undefined"?Uint8Array:Array;var ZERO="0".charCodeAt(0);var PLUS="+".charCodeAt(0);var SLASH="/".charCodeAt(0);var NUMBER="0".charCodeAt(0);var LOWER="a".charCodeAt(0);var UPPER="A".charCodeAt(0);function decode(elt){var code=elt.charCodeAt(0);if(code===PLUS)return 62;if(code===SLASH)return 63;if(code<NUMBER)return-1;if(code<NUMBER+10)return code-NUMBER+26+26;if(code<UPPER+26)return code-UPPER;if(code<LOWER+26)return code-LOWER+26}function b64ToByteArray(b64){var i,j,l,tmp,placeHolders,arr;if(b64.length%4>0){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<l;i+=4,j+=3){tmp=decode(b64.charAt(i))<<18|decode(b64.charAt(i+1))<<12|decode(b64.charAt(i+2))<<6|decode(b64.charAt(i+3));push((tmp&16711680)>>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<length;i+=3){temp=(uint8[i]<<16)+(uint8[i+1]<<8)+uint8[i+2];output+=tripletToBase64(temp)}switch(extraBytes){case 1:temp=uint8[uint8.length-1];output+=encode(temp>>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}module.exports.toByteArray=b64ToByteArray;module.exports.fromByteArray=uint8ToBase64})()},{}],4:[function(require,module,exports){exports.read=function(buffer,offset,isLE,mLen,nBytes){var e,m,eLen=nBytes*8-mLen-1,eMax=(1<<eLen)-1,eBias=eMax>>1,nBits=-7,i=isLE?nBytes-1:0,d=isLE?-1:1,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,eLen=nBytes*8-mLen-1,eMax=(1<<eLen)-1,eBias=eMax>>1,rt=mLen===23?Math.pow(2,-24)-Math.pow(2,-77):0,i=isLE?0:nBytes-1,d=isLE?1:-1,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<<mLen|m;eLen+=mLen;for(;eLen>0;buffer[offset+i]=e&255,i+=d,e/=256,eLen-=8);buffer[offset+i-d]|=s*128}},{}],5:[function(require,module,exports){var Buffer=require("buffer").Buffer;var intSize=4;var zeroBuffer=new Buffer(intSize);zeroBuffer.fill(0);var chrsz=8;function toArray(buf,bigEndian){if(buf.length%intSize!==0){var len=buf.length+(intSize-buf.length%intSize);buf=Buffer.concat([buf,zeroBuffer],len)}var arr=[];var fn=bigEndian?buf.readInt32BE:buf.readInt32LE;for(var i=0;i<buf.length;i+=intSize){arr.push(fn.call(buf,i))}return arr}function toBuffer(arr,size,bigEndian){var buf=new Buffer(size);var fn=bigEndian?buf.writeInt32BE:buf.writeInt32LE;for(var i=0;i<arr.length;i++){fn.call(buf,arr[i],i*4,true)}return buf}function hash(buf,fn,hashSize,bigEndian){if(!Buffer.isBuffer(buf))buf=new Buffer(buf);var arr=fn(toArray(buf,bigEndian),buf.length*chrsz);return toBuffer(arr,hashSize,bigEndian)}module.exports={hash:hash}},{buffer:2}],6:[function(require,module,exports){var Buffer=require("buffer").Buffer;var sha=require("./sha");var sha256=require("./sha256");var rng=require("./rng");var md5=require("./md5");var algorithms={sha1:sha,sha256:sha256,md5:md5};var blocksize=64;var zeroBuffer=new Buffer(blocksize);zeroBuffer.fill(0);function hmac(fn,key,data){if(!Buffer.isBuffer(key))key=new Buffer(key);if(!Buffer.isBuffer(data))data=new Buffer(data);if(key.length>blocksize){key=fn(key)}else if(key.length<blocksize){key=Buffer.concat([key,zeroBuffer],blocksize)}var ipad=new Buffer(blocksize),opad=new Buffer(blocksize);for(var i=0;i<blocksize;i++){ipad[i]=key[i]^54;opad[i]=key[i]^92}var hash=fn(Buffer.concat([ipad,data]));return fn(Buffer.concat([opad,hash]))}function hash(alg,key){alg=alg||"sha1";var fn=algorithms[alg];var bufs=[];var length=0;if(!fn)error("algorithm:",alg,"is not yet supported");return{update:function(data){if(!Buffer.isBuffer(data))data=new Buffer(data);bufs.push(data);length+=data.length;return this},digest:function(enc){var buf=Buffer.concat(bufs);var r=key?hmac(fn,key,buf):fn(buf);bufs=null;return enc?r.toString(enc):r}}}function error(){var m=[].slice.call(arguments).join(" ");throw new Error([m,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join("\n"))}exports.createHash=function(alg){return hash(alg)};exports.createHmac=function(alg,key){return hash(alg,key)};exports.randomBytes=function(size,callback){if(callback&&callback.call){try{callback.call(this,undefined,new Buffer(rng(size)))}catch(err){callback(err)}}else{return new Buffer(rng(size))}};function each(a,f){for(var i in a)f(a[i],i)}each(["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],function(name){exports[name]=function(){error("sorry,",name,"is not implemented yet")}})},{"./md5":7,"./rng":8,"./sha":9,"./sha256":10,buffer:2}],7:[function(require,module,exports){var helpers=require("./helpers");function md5_vm_test(){return hex_md5("abc")=="900150983cd24fb0d6963f7d28e17f72"}function core_md5(x,len){x[len>>5]|=128<<len%32;x[(len+64>>>9<<4)+14]=len;var a=1732584193;var b=-271733879;var c=-1732584194;var d=271733878;for(var i=0;i<x.length;i+=16){var olda=a;var oldb=b;var oldc=c;var oldd=d;a=md5_ff(a,b,c,d,x[i+0],7,-680876936);d=md5_ff(d,a,b,c,x[i+1],12,-389564586);c=md5_ff(c,d,a,b,x[i+2],17,606105819);b=md5_ff(b,c,d,a,x[i+3],22,-1044525330);a=md5_ff(a,b,c,d,x[i+4],7,-176418897);d=md5_ff(d,a,b,c,x[i+5],12,1200080426);c=md5_ff(c,d,a,b,x[i+6],17,-1473231341);b=md5_ff(b,c,d,a,x[i+7],22,-45705983);a=md5_ff(a,b,c,d,x[i+8],7,1770035416);d=md5_ff(d,a,b,c,x[i+9],12,-1958414417);c=md5_ff(c,d,a,b,x[i+10],17,-42063);b=md5_ff(b,c,d,a,x[i+11],22,-1990404162);a=md5_ff(a,b,c,d,x[i+12],7,1804603682);d=md5_ff(d,a,b,c,x[i+13],12,-40341101);c=md5_ff(c,d,a,b,x[i+14],17,-1502002290);b=md5_ff(b,c,d,a,x[i+15],22,1236535329);a=md5_gg(a,b,c,d,x[i+1],5,-165796510);d=md5_gg(d,a,b,c,x[i+6],9,-1069501632);c=md5_gg(c,d,a,b,x[i+11],14,643717713);b=md5_gg(b,c,d,a,x[i+0],20,-373897302);a=md5_gg(a,b,c,d,x[i+5],5,-701558691);d=md5_gg(d,a,b,c,x[i+10],9,38016083);c=md5_gg(c,d,a,b,x[i+15],14,-660478335);b=md5_gg(b,c,d,a,x[i+4],20,-405537848);a=md5_gg(a,b,c,d,x[i+9],5,568446438);d=md5_gg(d,a,b,c,x[i+14],9,-1019803690);c=md5_gg(c,d,a,b,x[i+3],14,-187363961);b=md5_gg(b,c,d,a,x[i+8],20,1163531501);a=md5_gg(a,b,c,d,x[i+13],5,-1444681467);d=md5_gg(d,a,b,c,x[i+2],9,-51403784);c=md5_gg(c,d,a,b,x[i+7],14,1735328473);b=md5_gg(b,c,d,a,x[i+12],20,-1926607734);a=md5_hh(a,b,c,d,x[i+5],4,-378558);d=md5_hh(d,a,b,c,x[i+8],11,-2022574463);c=md5_hh(c,d,a,b,x[i+11],16,1839030562);b=md5_hh(b,c,d,a,x[i+14],23,-35309556);a=md5_hh(a,b,c,d,x[i+1],4,-1530992060);d=md5_hh(d,a,b,c,x[i+4],11,1272893353);c=md5_hh(c,d,a,b,x[i+7],16,-155497632);b=md5_hh(b,c,d,a,x[i+10],23,-1094730640);a=md5_hh(a,b,c,d,x[i+13],4,681279174);d=md5_hh(d,a,b,c,x[i+0],11,-358537222);c=md5_hh(c,d,a,b,x[i+3],16,-722521979);b=md5_hh(b,c,d,a,x[i+6],23,76029189);a=md5_hh(a,b,c,d,x[i+9],4,-640364487);d=md5_hh(d,a,b,c,x[i+12],11,-421815835);c=md5_hh(c,d,a,b,x[i+15],16,530742520);b=md5_hh(b,c,d,a,x[i+2],23,-995338651);a=md5_ii(a,b,c,d,x[i+0],6,-198630844);d=md5_ii(d,a,b,c,x[i+7],10,1126891415);c=md5_ii(c,d,a,b,x[i+14],15,-1416354905);b=md5_ii(b,c,d,a,x[i+5],21,-57434055);a=md5_ii(a,b,c,d,x[i+12],6,1700485571);d=md5_ii(d,a,b,c,x[i+3],10,-1894986606);c=md5_ii(c,d,a,b,x[i+10],15,-1051523);b=md5_ii(b,c,d,a,x[i+1],21,-2054922799);a=md5_ii(a,b,c,d,x[i+8],6,1873313359);d=md5_ii(d,a,b,c,x[i+15],10,-30611744);c=md5_ii(c,d,a,b,x[i+6],15,-1560198380);b=md5_ii(b,c,d,a,x[i+13],21,1309151649);a=md5_ii(a,b,c,d,x[i+4],6,-145523070);d=md5_ii(d,a,b,c,x[i+11],10,-1120210379);c=md5_ii(c,d,a,b,x[i+2],15,718787259);b=md5_ii(b,c,d,a,x[i+9],21,-343485551);a=safe_add(a,olda);b=safe_add(b,oldb);c=safe_add(c,oldc);d=safe_add(d,oldd)}return Array(a,b,c,d)}function md5_cmn(q,a,b,x,s,t){return safe_add(bit_rol(safe_add(safe_add(a,q),safe_add(x,t)),s),b)}function md5_ff(a,b,c,d,x,s,t){return md5_cmn(b&c|~b&d,a,b,x,s,t)}function md5_gg(a,b,c,d,x,s,t){return md5_cmn(b&d|c&~d,a,b,x,s,t)}function md5_hh(a,b,c,d,x,s,t){return md5_cmn(b^c^d,a,b,x,s,t)}function md5_ii(a,b,c,d,x,s,t){return md5_cmn(c^(b|~d),a,b,x,s,t) | |
}function safe_add(x,y){var lsw=(x&65535)+(y&65535);var msw=(x>>16)+(y>>16)+(lsw>>16);return msw<<16|lsw&65535}function bit_rol(num,cnt){return num<<cnt|num>>>32-cnt}module.exports=function md5(buf){return helpers.hash(buf,core_md5,16)}},{"./helpers":5}],8:[function(require,module,exports){(function(){var _global=this;var mathRNG,whatwgRNG;mathRNG=function(size){var bytes=new Array(size);var r;for(var i=0,r;i<size;i++){if((i&3)==0)r=Math.random()*4294967296;bytes[i]=r>>>((i&3)<<3)&255}return bytes};if(_global.crypto&&crypto.getRandomValues){whatwgRNG=function(size){var bytes=new Uint8Array(size);crypto.getRandomValues(bytes);return bytes}}module.exports=whatwgRNG||mathRNG})()},{}],9:[function(require,module,exports){var helpers=require("./helpers");function core_sha1(x,len){x[len>>5]|=128<<24-len%32;x[(len+64>>9<<4)+15]=len;var w=Array(80);var a=1732584193;var b=-271733879;var c=-1732584194;var d=271733878;var e=-1009589776;for(var i=0;i<x.length;i+=16){var olda=a;var oldb=b;var oldc=c;var oldd=d;var olde=e;for(var j=0;j<80;j++){if(j<16)w[j]=x[i+j];else w[j]=rol(w[j-3]^w[j-8]^w[j-14]^w[j-16],1);var t=safe_add(safe_add(rol(a,5),sha1_ft(j,b,c,d)),safe_add(safe_add(e,w[j]),sha1_kt(j)));e=d;d=c;c=rol(b,30);b=a;a=t}a=safe_add(a,olda);b=safe_add(b,oldb);c=safe_add(c,oldc);d=safe_add(d,oldd);e=safe_add(e,olde)}return Array(a,b,c,d,e)}function sha1_ft(t,b,c,d){if(t<20)return b&c|~b&d;if(t<40)return b^c^d;if(t<60)return b&c|b&d|c&d;return b^c^d}function sha1_kt(t){return t<20?1518500249:t<40?1859775393:t<60?-1894007588:-899497514}function safe_add(x,y){var lsw=(x&65535)+(y&65535);var msw=(x>>16)+(y>>16)+(lsw>>16);return msw<<16|lsw&65535}function rol(num,cnt){return num<<cnt|num>>>32-cnt}module.exports=function sha1(buf){return helpers.hash(buf,core_sha1,20,true)}},{"./helpers":5}],10:[function(require,module,exports){var helpers=require("./helpers");var safe_add=function(x,y){var lsw=(x&65535)+(y&65535);var msw=(x>>16)+(y>>16)+(lsw>>16);return msw<<16|lsw&65535};var S=function(X,n){return X>>>n|X<<32-n};var R=function(X,n){return X>>>n};var Ch=function(x,y,z){return x&y^~x&z};var Maj=function(x,y,z){return x&y^x&z^y&z};var Sigma0256=function(x){return S(x,2)^S(x,13)^S(x,22)};var Sigma1256=function(x){return S(x,6)^S(x,11)^S(x,25)};var Gamma0256=function(x){return S(x,7)^S(x,18)^R(x,3)};var Gamma1256=function(x){return S(x,17)^S(x,19)^R(x,10)};var core_sha256=function(m,l){var K=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298);var HASH=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225);var W=new Array(64);var a,b,c,d,e,f,g,h,i,j;var T1,T2;m[l>>5]|=128<<24-l%32;m[(l+64>>9<<4)+15]=l;for(var i=0;i<m.length;i+=16){a=HASH[0];b=HASH[1];c=HASH[2];d=HASH[3];e=HASH[4];f=HASH[5];g=HASH[6];h=HASH[7];for(var j=0;j<64;j++){if(j<16){W[j]=m[j+i]}else{W[j]=safe_add(safe_add(safe_add(Gamma1256(W[j-2]),W[j-7]),Gamma0256(W[j-15])),W[j-16])}T1=safe_add(safe_add(safe_add(safe_add(h,Sigma1256(e)),Ch(e,f,g)),K[j]),W[j]);T2=safe_add(Sigma0256(a),Maj(a,b,c));h=g;g=f;f=e;e=safe_add(d,T1);d=c;c=b;b=a;a=safe_add(T1,T2)}HASH[0]=safe_add(a,HASH[0]);HASH[1]=safe_add(b,HASH[1]);HASH[2]=safe_add(c,HASH[2]);HASH[3]=safe_add(d,HASH[3]);HASH[4]=safe_add(e,HASH[4]);HASH[5]=safe_add(f,HASH[5]);HASH[6]=safe_add(g,HASH[6]);HASH[7]=safe_add(h,HASH[7])}return HASH};module.exports=function sha256(buf){return helpers.hash(buf,core_sha256,32,true)}},{"./helpers":5}],11:[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{throw TypeError('Uncaught, unspecified "error" event.')}return false}}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:len=arguments.length;args=new Array(len-1);for(i=1;i<len;i++)args[i-1]=arguments[i];handler.apply(this,args)}}else if(isObject(handler)){len=arguments.length;args=new Array(len-1);for(i=1;i<len;i++)args[i-1]=arguments[i];listeners=handler.slice();len=listeners.length;for(i=0;i<len;i++)listeners[i].apply(this,args)}return true};EventEmitter.prototype.addListener=function(type,listener){var m;if(!isFunction(listener))throw TypeError("listener must be a function");if(!this._events)this._events={};if(this._events.newListener)this.emit("newListener",type,isFunction(listener.listener)?listener.listener:listener);if(!this._events[type])this._events[type]=listener;else if(isObject(this._events[type]))this._events[type].push(listener);else this._events[type]=[this._events[type],listener];if(isObject(this._events[type])&&!this._events[type].warned){var m;if(!isUndefined(this._maxListeners)){m=this._maxListeners}else{m=EventEmitter.defaultMaxListeners}if(m&&m>0&&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);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{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.listenerCount=function(emitter,type){var ret;if(!emitter._events||!emitter._events[type])ret=0;else if(isFunction(emitter._events[type]))ret=1;else ret=emitter._events[type].length;return ret};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}},{}],12:[function(require,module,exports){var http=module.exports;var EventEmitter=require("events").EventEmitter;var Request=require("./lib/request");var url=require("url");http.request=function(params,cb){if(typeof params==="string"){params=url.parse(params)}if(!params)params={};if(!params.host&&!params.port){params.port=parseInt(window.location.port,10)}if(!params.host&¶ms.hostname){params.host=params.hostname}if(!params.scheme)params.scheme=window.location.protocol.split(":")[0];if(!params.host){params.host=window.location.hostname||window.location.host}if(/:/.test(params.host)){if(!params.port){params.port=params.host.split(":")[1]}params.host=params.host.split(":")[0]}if(!params.port)params.port=params.scheme=="https"?443:80;var req=new Request(new xhrHttp,params);if(cb)req.on("response",cb);return req};http.get=function(params,cb){params.method="GET";var req=http.request(params,cb);req.end();return req};http.Agent=function(){};http.Agent.defaultMaxSockets=4;var xhrHttp=function(){if(typeof window==="undefined"){throw new Error("no window object present")}else if(window.XMLHttpRequest){return window.XMLHttpRequest}else if(window.ActiveXObject){var axs=["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.3.0","Microsoft.XMLHTTP"];for(var i=0;i<axs.length;i++){try{var ax=new window.ActiveXObject(axs[i]);return function(){if(ax){var ax_=ax;ax=null;return ax_}else{return new window.ActiveXObject(axs[i])}}}catch(e){}}throw new Error("ajax not supported in this browser")}else{throw new Error("ajax not supported in this browser")}}();http.STATUS_CODES={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",300:"Multiple Choices",301:"Moved Permanently",302:"Moved Temporarily",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Time-out",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Large",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Time-out",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}},{"./lib/request":13,events:11,url:32}],13:[function(require,module,exports){var Stream=require("stream");var Response=require("./response");var Base64=require("Base64");var inherits=require("inherits");var Request=module.exports=function(xhr,params){var self=this;self.writable=true;self.xhr=xhr;self.body=[];self.uri=(params.scheme||"http")+"://"+params.host+(params.port?":"+params.port:"")+(params.path||"/");if(typeof params.withCredentials==="undefined"){params.withCredentials=true}try{xhr.withCredentials=params.withCredentials}catch(e){}xhr.open(params.method||"GET",self.uri,true);self._headers={};if(params.headers){var keys=objectKeys(params.headers);for(var i=0;i<keys.length;i++){var key=keys[i];if(!self.isSafeRequestHeader(key))continue;var value=params.headers[key];self.setHeader(key,value)}}if(params.auth){this.setHeader("Authorization","Basic "+Base64.btoa(params.auth))}var res=new Response;res.on("close",function(){self.emit("close")});res.on("ready",function(){self.emit("response",res)});xhr.onreadystatechange=function(){if(xhr.__aborted)return;res.handle(xhr)}};inherits(Request,Stream);Request.prototype.setHeader=function(key,value){this._headers[key.toLowerCase()]=value};Request.prototype.getHeader=function(key){return this._headers[key.toLowerCase()]};Request.prototype.removeHeader=function(key){delete this._headers[key.toLowerCase()]};Request.prototype.write=function(s){this.body.push(s)};Request.prototype.destroy=function(s){this.xhr.__aborted=true;this.xhr.abort();this.emit("close")};Request.prototype.end=function(s){if(s!==undefined)this.body.push(s);var keys=objectKeys(this._headers);for(var i=0;i<keys.length;i++){var key=keys[i];var value=this._headers[key];if(isArray(value)){for(var j=0;j<value.length;j++){this.xhr.setRequestHeader(key,value[j])}}else this.xhr.setRequestHeader(key,value)}if(this.body.length===0){this.xhr.send("")}else if(typeof this.body[0]==="string"){this.xhr.send(this.body.join(""))}else if(isArray(this.body[0])){var body=[];for(var i=0;i<this.body.length;i++){body.push.apply(body,this.body[i])}this.xhr.send(body)}else if(/Array/.test(Object.prototype.toString.call(this.body[0]))){var len=0;for(var i=0;i<this.body.length;i++){len+=this.body[i].length}var body=new this.body[0].constructor(len);var k=0;for(var i=0;i<this.body.length;i++){var b=this.body[i];for(var j=0;j<b.length;j++){body[k++]=b[j]}}this.xhr.send(body)}else{var body="";for(var i=0;i<this.body.length;i++){body+=this.body[i].toString()}this.xhr.send(body)}};Request.unsafeHeaders=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","content-transfer-encoding","date","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"];Request.prototype.isSafeRequestHeader=function(headerName){if(!headerName)return false;return indexOf(Request.unsafeHeaders,headerName.toLowerCase())===-1};var objectKeys=Object.keys||function(obj){var keys=[];for(var key in obj)keys.push(key);return keys};var isArray=Array.isArray||function(xs){return Object.prototype.toString.call(xs)==="[object Array]"};var indexOf=function(xs,x){if(xs.indexOf)return xs.indexOf(x);for(var i=0;i<xs.length;i++){if(xs[i]===x)return i}return-1}},{"./response":14,Base64:15,inherits:17,stream:25}],14:[function(require,module,exports){var Stream=require("stream");var util=require("util");var Response=module.exports=function(res){this.offset=0;this.readable=true};util.inherits(Response,Stream);var capable={streaming:true,status2:true};function parseHeaders(res){var lines=res.getAllResponseHeaders().split(/\r?\n/);var headers={};for(var i=0;i<lines.length;i++){var line=lines[i];if(line==="")continue;var m=line.match(/^([^:]+):\s*(.*)/);if(m){var key=m[1].toLowerCase(),value=m[2];if(headers[key]!==undefined){if(isArray(headers[key])){headers[key].push(value)}else{headers[key]=[headers[key],value]}}else{headers[key]=value}}else{headers[line]=true}}return headers}Response.prototype.getResponse=function(xhr){var respType=String(xhr.responseType).toLowerCase();if(respType==="blob")return xhr.responseBlob||xhr.response;if(respType==="arraybuffer")return xhr.response;return xhr.responseText};Response.prototype.getHeader=function(key){return this.headers[key.toLowerCase()]};Response.prototype.handle=function(res){if(res.readyState===2&&capable.status2){try{this.statusCode=res.status;this.headers=parseHeaders(res)}catch(err){capable.status2=false}if(capable.status2){this.emit("ready")}}else if(capable.streaming&&res.readyState===3){try{if(!this.statusCode){this.statusCode=res.status;this.headers=parseHeaders(res);this.emit("ready")}}catch(err){}try{this._emitData(res)}catch(err){capable.streaming=false}}else if(res.readyState===4){if(!this.statusCode){this.statusCode=res.status;this.emit("ready")}this._emitData(res);if(res.error){this.emit("error",this.getResponse(res))}else this.emit("end");this.emit("close")}};Response.prototype._emitData=function(res){var respBody=this.getResponse(res);if(respBody.toString().match(/ArrayBuffer/)){this.emit("data",new Uint8Array(respBody,this.offset));this.offset=respBody.byteLength;return}if(respBody.length>this.offset){this.emit("data",respBody.slice(this.offset));this.offset=respBody.length}};var isArray=Array.isArray||function(xs){return Object.prototype.toString.call(xs)==="[object Array]"}},{stream:25,util:34}],15:[function(require,module,exports){(function(){var object=typeof exports!="undefined"?exports:this;var chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function InvalidCharacterError(message){this.message=message}InvalidCharacterError.prototype=new Error;InvalidCharacterError.prototype.name="InvalidCharacterError";object.btoa||(object.btoa=function(input){for(var block,charCode,idx=0,map=chars,output="";input.charAt(idx|0)||(map="=",idx%1);output+=map.charAt(63&block>>8-idx%1*8)){charCode=input.charCodeAt(idx+=3/4);if(charCode>255){throw new InvalidCharacterError("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.")}block=block<<8|charCode}return output});object.atob||(object.atob=function(input){input=input.replace(/=+$/,"");if(input.length%4==1){throw new InvalidCharacterError("'atob' failed: The string to be decoded is not correctly encoded.")}for(var bc=0,bs,buffer,idx=0,output="";buffer=input.charAt(idx++);~buffer&&(bs=bc%4?bs*64+buffer:buffer,bc++%4)?output+=String.fromCharCode(255&bs>>(-2*bc&6)):0){buffer=chars.indexOf(buffer)}return output})})()},{}],16:[function(require,module,exports){var http=require("http");var https=module.exports;for(var key in http){if(http.hasOwnProperty(key))https[key]=http[key]}https.request=function(params,cb){if(!params)params={};params.scheme="https";return http.request.call(this,params,cb)}},{http:12}],17:[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}}},{}],18:[function(require,module,exports){var process=module.exports={};process.nextTick=function(){var canSetImmediate=typeof window!=="undefined"&&window.setImmediate;var canPost=typeof window!=="undefined"&&window.postMessage&&window.addEventListener;if(canSetImmediate){return function(f){return window.setImmediate(f)}}if(canPost){var queue=[];window.addEventListener("message",function(ev){var source=ev.source;if((source===window||source===null)&&ev.data==="process-tick"){ev.stopPropagation();if(queue.length>0){var fn=queue.shift();fn()}}},true);return function nextTick(fn){queue.push(fn);window.postMessage("process-tick","*")}}return function nextTick(fn){setTimeout(fn,0)}}();process.title="browser";process.browser=true;process.env={};process.argv=[];function noop(){}process.on=noop;process.once=noop;process.off=noop;process.emit=noop;process.binding=function(name){throw new Error("process.binding is not supported")};process.cwd=function(){return"/"};process.chdir=function(dir){throw new Error("process.chdir is not supported")}},{}],19:[function(require,module,exports){(function(process){function normalizeArray(parts,allowAboveRoot){var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up--;up){parts.unshift("..")}}return parts}var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;var splitPath=function(filename){return splitPathRe.exec(filename).slice(1)};exports.resolve=function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:process.cwd();if(typeof path!=="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){continue}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=path.charAt(0)==="/"}resolvedPath=normalizeArray(filter(resolvedPath.split("/"),function(p){return!!p}),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."};exports.normalize=function(path){var isAbsolute=exports.isAbsolute(path),trailingSlash=substr(path,-1)==="/";path=normalizeArray(filter(path.split("/"),function(p){return!!p}),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path};exports.isAbsolute=function(path){return path.charAt(0)==="/"};exports.join=function(){var paths=Array.prototype.slice.call(arguments,0);return exports.normalize(filter(paths,function(p,index){if(typeof p!=="string"){throw new TypeError("Arguments to path.join must be strings")}return p}).join("/"))};exports.relative=function(from,to){from=exports.resolve(from).substr(1);to=exports.resolve(to).substr(1);function trim(arr){var start=0;for(;start<arr.length;start++){if(arr[start]!=="")break}var end=arr.length-1;for(;end>=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i<length;i++){if(fromParts[i]!==toParts[i]){samePartsLength=i;break}}var outputParts=[];for(var i=samePartsLength;i<fromParts.length;i++){outputParts.push("..")}outputParts=outputParts.concat(toParts.slice(samePartsLength));return outputParts.join("/")};exports.sep="/";exports.delimiter=":";exports.dirname=function(path){var result=splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return"."}if(dir){dir=dir.substr(0,dir.length-1)}return root+dir};exports.basename=function(path,ext){var f=splitPath(path)[2];if(ext&&f.substr(-1*ext.length)===ext){f=f.substr(0,f.length-ext.length)}return f};exports.extname=function(path){return splitPath(path)[3]};function filter(xs,f){if(xs.filter)return xs.filter(f);var res=[];for(var i=0;i<xs.length;i++){if(f(xs[i],i,xs))res.push(xs[i])}return res}var substr="ab".substr(-1)==="b"?function(str,start,len){return str.substr(start,len)}:function(str,start,len){if(start<0)start=str.length+start;return str.substr(start,len)}}).call(this,require("/home/admin/browserify-cdn/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))},{"/home/admin/browserify-cdn/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":18}],20:[function(require,module,exports){(function(global){(function(root){var freeExports=typeof exports=="object"&&exports;var freeModule=typeof module=="object"&&module&&module.exports==freeExports&&module;var freeGlobal=typeof global=="object"&&global;if(freeGlobal.global===freeGlobal||freeGlobal.window===freeGlobal){root=freeGlobal}var punycode,maxInt=2147483647,base=36,tMin=1,tMax=26,skew=38,damp=700,initialBias=72,initialN=128,delimiter="-",regexPunycode=/^xn--/,regexNonASCII=/[^ -~]/,regexSeparators=/\x2E|\u3002|\uFF0E|\uFF61/g,errors={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},baseMinusTMin=base-tMin,floor=Math.floor,stringFromCharCode=String.fromCharCode,key;function error(type){throw RangeError(errors[type])}function map(array,fn){var length=array.length;while(length--){array[length]=fn(array[length])}return array}function mapDomain(string,fn){return map(string.split(regexSeparators),fn).join(".")}function ucs2decode(string){var output=[],counter=0,length=string.length,value,extra;while(counter<length){value=string.charCodeAt(counter++);if(value>=55296&&value<=56319&&counter<length){extra=string.charCodeAt(counter++);if((extra&64512)==56320){output.push(((value&1023)<<10)+(extra&1023)+65536)}else{output.push(value);counter--}}else{output.push(value)}}return output}function ucs2encode(array){return map(array,function(value){var output="";if(value>65535){value-=65536;output+=stringFromCharCode(value>>>10&1023|55296);value=56320|value&1023}output+=stringFromCharCode(value);return output}).join("")}function basicToDigit(codePoint){if(codePoint-48<10){return codePoint-22}if(codePoint-65<26){return codePoint-65}if(codePoint-97<26){return codePoint-97}return base}function digitToBasic(digit,flag){return digit+22+75*(digit<26)-((flag!=0)<<5)}function adapt(delta,numPoints,firstTime){var k=0;delta=firstTime?floor(delta/damp):delta>>1;delta+=floor(delta/numPoints);for(;delta>baseMinusTMin*tMax>>1;k+=base){delta=floor(delta/baseMinusTMin)}return floor(k+(baseMinusTMin+1)*delta/(delta+skew))}function decode(input){var output=[],inputLength=input.length,out,i=0,n=initialN,bias=initialBias,basic,j,index,oldi,w,k,digit,t,baseMinusT;basic=input.lastIndexOf(delimiter);if(basic<0){basic=0}for(j=0;j<basic;++j){if(input.charCodeAt(j)>=128){error("not-basic")}output.push(input.charCodeAt(j))}for(index=basic>0?basic+1:0;index<inputLength;){for(oldi=i,w=1,k=base;;k+=base){if(index>=inputLength){error("invalid-input")}digit=basicToDigit(input.charCodeAt(index++));if(digit>=base||digit>floor((maxInt-i)/w)){error("overflow")}i+=digit*w;t=k<=bias?tMin:k>=bias+tMax?tMax:k-bias;if(digit<t){break}baseMinusT=base-t;if(w>floor(maxInt/baseMinusT)){error("overflow")}w*=baseMinusT}out=output.length+1;bias=adapt(i-oldi,out,oldi==0);if(floor(i/out)>maxInt-n){error("overflow")}n+=floor(i/out);i%=out;output.splice(i++,0,n)}return ucs2encode(output)}function encode(input){var n,delta,handledCPCount,basicLength,bias,j,m,q,k,t,currentValue,output=[],inputLength,handledCPCountPlusOne,baseMinusT,qMinusT;input=ucs2decode(input);inputLength=input.length;n=initialN;delta=0;bias=initialBias;for(j=0;j<inputLength;++j){currentValue=input[j];if(currentValue<128){output.push(stringFromCharCode(currentValue))}}handledCPCount=basicLength=output.length;if(basicLength){output.push(delimiter)}while(handledCPCount<inputLength){for(m=maxInt,j=0;j<inputLength;++j){currentValue=input[j];if(currentValue>=n&¤tValue<m){m=currentValue}}handledCPCountPlusOne=handledCPCount+1;if(m-n>floor((maxInt-delta)/handledCPCountPlusOne)){error("overflow")}delta+=(m-n)*handledCPCountPlusOne;n=m;for(j=0;j<inputLength;++j){currentValue=input[j];if(currentValue<n&&++delta>maxInt){error("overflow")}if(currentValue==n){for(q=delta,k=base;;k+=base){t=k<=bias?tMin:k>=bias+tMax?tMax:k-bias;if(q<t){break}qMinusT=q-t;baseMinusT=base-t;output.push(stringFromCharCode(digitToBasic(t+qMinusT%baseMinusT,0)));q=floor(qMinusT/baseMinusT)}output.push(stringFromCharCode(digitToBasic(q,0)));bias=adapt(delta,handledCPCountPlusOne,handledCPCount==basicLength);delta=0;++handledCPCount}}++delta;++n}return output.join("")}function toUnicode(domain){return mapDomain(domain,function(string){return regexPunycode.test(string)?decode(string.slice(4).toLowerCase()):string})}function toASCII(domain){return mapDomain(domain,function(string){return regexNonASCII.test(string)?"xn--"+encode(string):string})}punycode={version:"1.2.4",ucs2:{decode:ucs2decode,encode:ucs2encode},decode:decode,encode:encode,toASCII:toASCII,toUnicode:toUnicode};if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){define("punycode",function(){return punycode})}else if(freeExports&&!freeExports.nodeType){if(freeModule){freeModule.exports=punycode}else{for(key in punycode){punycode.hasOwnProperty(key)&&(freeExports[key]=punycode[key])}}}else{root.punycode=punycode}})(this)}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],21:[function(require,module,exports){"use strict";function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}module.exports=function(qs,sep,eq,options){sep=sep||"&";eq=eq||"=";var obj={};if(typeof qs!=="string"||qs.length===0){return obj}var regexp=/\+/g;qs=qs.split(sep);var maxKeys=1e3;if(options&&typeof options.maxKeys==="number"){maxKeys=options.maxKeys}var len=qs.length;if(maxKeys>0&&len>maxKeys){len=maxKeys}for(var i=0;i<len;++i){var x=qs[i].replace(regexp,"%20"),idx=x.indexOf(eq),kstr,vstr,k,v;if(idx>=0){kstr=x.substr(0,idx);vstr=x.substr(idx+1)}else{kstr=x;vstr=""}k=decodeURIComponent(kstr);v=decodeURIComponent(vstr);if(!hasOwnProperty(obj,k)){obj[k]=v}else if(isArray(obj[k])){obj[k].push(v)}else{obj[k]=[obj[k],v]}}return obj};var isArray=Array.isArray||function(xs){return Object.prototype.toString.call(xs)==="[object Array]"}},{}],22:[function(require,module,exports){"use strict";var stringifyPrimitive=function(v){switch(typeof v){case"string":return v;case"boolean":return v?"true":"false";case"number":return isFinite(v)?v:"";default:return""}};module.exports=function(obj,sep,eq,name){sep=sep||"&";eq=eq||"=";if(obj===null){obj=undefined}if(typeof obj==="object"){return map(objectKeys(obj),function(k){var ks=encodeURIComponent(stringifyPrimitive(k))+eq;if(isArray(obj[k])){return obj[k].map(function(v){return ks+encodeURIComponent(stringifyPrimitive(v))}).join(sep)}else{return ks+encodeURIComponent(stringifyPrimitive(obj[k]))}}).join(sep)}if(!name)return"";return encodeURIComponent(stringifyPrimitive(name))+eq+encodeURIComponent(stringifyPrimitive(obj))};var isArray=Array.isArray||function(xs){return Object.prototype.toString.call(xs)==="[object Array]"};function map(xs,f){if(xs.map)return xs.map(f);var res=[];for(var i=0;i<xs.length;i++){res.push(f(xs[i],i))}return res}var objectKeys=Object.keys||function(obj){var res=[];for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))res.push(key)}return res}},{}],23:[function(require,module,exports){"use strict";exports.decode=exports.parse=require("./decode");exports.encode=exports.stringify=require("./encode")},{"./decode":21,"./encode":22}],24:[function(require,module,exports){module.exports=Duplex;var inherits=require("inherits");var setImmediate=require("process/browser.js").nextTick;var Readable=require("./readable.js");var Writable=require("./writable.js");inherits(Duplex,Readable);Duplex.prototype.write=Writable.prototype.write;Duplex.prototype.end=Writable.prototype.end;Duplex.prototype._write=Writable.prototype._write;function Duplex(options){if(!(this instanceof Duplex))return new Duplex(options);Readable.call(this,options);Writable.call(this,options);if(options&&options.readable===false)this.readable=false;if(options&&options.writable===false)this.writable=false;this.allowHalfOpen=true;if(options&&options.allowHalfOpen===false)this.allowHalfOpen=false;this.once("end",onend)}function onend(){if(this.allowHalfOpen||this._writableState.ended)return;var self=this;setImmediate(function(){self.end()})}},{"./readable.js":28,"./writable.js":30,inherits:17,"process/browser.js":26}],25:[function(require,module,exports){module.exports=Stream;var EE=require("events").EventEmitter;var inherits=require("inherits");inherits(Stream,EE);Stream.Readable=require("./readable.js");Stream.Writable=require("./writable.js");Stream.Duplex=require("./duplex.js");Stream.Transform=require("./transform.js");Stream.PassThrough=require("./passthrough.js");Stream.Stream=Stream;function Stream(){EE.call(this)}Stream.prototype.pipe=function(dest,options){var source=this; | |
function ondata(chunk){if(dest.writable){if(false===dest.write(chunk)&&source.pause){source.pause()}}}source.on("data",ondata);function ondrain(){if(source.readable&&source.resume){source.resume()}}dest.on("drain",ondrain);if(!dest._isStdio&&(!options||options.end!==false)){source.on("end",onend);source.on("close",onclose)}var didOnEnd=false;function onend(){if(didOnEnd)return;didOnEnd=true;dest.end()}function onclose(){if(didOnEnd)return;didOnEnd=true;if(typeof dest.destroy==="function")dest.destroy()}function onerror(er){cleanup();if(EE.listenerCount(this,"error")===0){throw er}}source.on("error",onerror);dest.on("error",onerror);function cleanup(){source.removeListener("data",ondata);dest.removeListener("drain",ondrain);source.removeListener("end",onend);source.removeListener("close",onclose);source.removeListener("error",onerror);dest.removeListener("error",onerror);source.removeListener("end",cleanup);source.removeListener("close",cleanup);dest.removeListener("close",cleanup)}source.on("end",cleanup);source.on("close",cleanup);dest.on("close",cleanup);dest.emit("pipe",source);return dest}},{"./duplex.js":24,"./passthrough.js":27,"./readable.js":28,"./transform.js":29,"./writable.js":30,events:11,inherits:17}],26:[function(require,module,exports){var process=module.exports={};process.nextTick=function(){var canSetImmediate=typeof window!=="undefined"&&window.setImmediate;var canPost=typeof window!=="undefined"&&window.postMessage&&window.addEventListener;if(canSetImmediate){return function(f){return window.setImmediate(f)}}if(canPost){var queue=[];window.addEventListener("message",function(ev){var source=ev.source;if((source===window||source===null)&&ev.data==="process-tick"){ev.stopPropagation();if(queue.length>0){var fn=queue.shift();fn()}}},true);return function nextTick(fn){queue.push(fn);window.postMessage("process-tick","*")}}return function nextTick(fn){setTimeout(fn,0)}}();process.title="browser";process.browser=true;process.env={};process.argv=[];process.binding=function(name){throw new Error("process.binding is not supported")};process.cwd=function(){return"/"};process.chdir=function(dir){throw new Error("process.chdir is not supported")}},{}],27:[function(require,module,exports){module.exports=PassThrough;var Transform=require("./transform.js");var inherits=require("inherits");inherits(PassThrough,Transform);function PassThrough(options){if(!(this instanceof PassThrough))return new PassThrough(options);Transform.call(this,options)}PassThrough.prototype._transform=function(chunk,encoding,cb){cb(null,chunk)}},{"./transform.js":29,inherits:17}],28:[function(require,module,exports){(function(process){module.exports=Readable;Readable.ReadableState=ReadableState;var EE=require("events").EventEmitter;var Stream=require("./index.js");var Buffer=require("buffer").Buffer;var setImmediate=require("process/browser.js").nextTick;var StringDecoder;var inherits=require("inherits");inherits(Readable,Stream);function ReadableState(options,stream){options=options||{};var hwm=options.highWaterMark;this.highWaterMark=hwm||hwm===0?hwm:16*1024;this.highWaterMark=~~this.highWaterMark;this.buffer=[];this.length=0;this.pipes=null;this.pipesCount=0;this.flowing=false;this.ended=false;this.endEmitted=false;this.reading=false;this.calledRead=false;this.sync=true;this.needReadable=false;this.emittedReadable=false;this.readableListening=false;this.objectMode=!!options.objectMode;this.defaultEncoding=options.defaultEncoding||"utf8";this.ranOut=false;this.awaitDrain=0;this.readingMore=false;this.decoder=null;this.encoding=null;if(options.encoding){if(!StringDecoder)StringDecoder=require("string_decoder").StringDecoder;this.decoder=new StringDecoder(options.encoding);this.encoding=options.encoding}}function Readable(options){if(!(this instanceof Readable))return new Readable(options);this._readableState=new ReadableState(options,this);this.readable=true;Stream.call(this)}Readable.prototype.push=function(chunk,encoding){var state=this._readableState;if(typeof chunk==="string"&&!state.objectMode){encoding=encoding||state.defaultEncoding;if(encoding!==state.encoding){chunk=new Buffer(chunk,encoding);encoding=""}}return readableAddChunk(this,state,chunk,encoding,false)};Readable.prototype.unshift=function(chunk){var state=this._readableState;return readableAddChunk(this,state,chunk,"",true)};function readableAddChunk(stream,state,chunk,encoding,addToFront){var er=chunkInvalid(state,chunk);if(er){stream.emit("error",er)}else if(chunk===null||chunk===undefined){state.reading=false;if(!state.ended)onEofChunk(stream,state)}else if(state.objectMode||chunk&&chunk.length>0){if(state.ended&&!addToFront){var e=new Error("stream.push() after EOF");stream.emit("error",e)}else if(state.endEmitted&&addToFront){var e=new Error("stream.unshift() after end event");stream.emit("error",e)}else{if(state.decoder&&!addToFront&&!encoding)chunk=state.decoder.write(chunk);state.length+=state.objectMode?1:chunk.length;if(addToFront){state.buffer.unshift(chunk)}else{state.reading=false;state.buffer.push(chunk)}if(state.needReadable)emitReadable(stream);maybeReadMore(stream,state)}}else if(!addToFront){state.reading=false}return needMoreData(state)}function needMoreData(state){return!state.ended&&(state.needReadable||state.length<state.highWaterMark||state.length===0)}Readable.prototype.setEncoding=function(enc){if(!StringDecoder)StringDecoder=require("string_decoder").StringDecoder;this._readableState.decoder=new StringDecoder(enc);this._readableState.encoding=enc};var MAX_HWM=8388608;function roundUpToNextPowerOf2(n){if(n>=MAX_HWM){n=MAX_HWM}else{n--;for(var p=1;p<32;p<<=1)n|=n>>p;n++}return n}function howMuchToRead(n,state){if(state.length===0&&state.ended)return 0;if(state.objectMode)return n===0?0:1;if(isNaN(n)||n===null){if(state.flowing&&state.buffer.length)return state.buffer[0].length;else return state.length}if(n<=0)return 0;if(n>state.highWaterMark)state.highWaterMark=roundUpToNextPowerOf2(n);if(n>state.length){if(!state.ended){state.needReadable=true;return 0}else return state.length}return n}Readable.prototype.read=function(n){var state=this._readableState;state.calledRead=true;var nOrig=n;if(typeof n!=="number"||n>0)state.emittedReadable=false;if(n===0&&state.needReadable&&(state.length>=state.highWaterMark||state.ended)){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;if(state.length-n<=state.highWaterMark)doRead=true;if(state.ended||state.reading)doRead=false;if(doRead){state.reading=true;state.sync=true;if(state.length===0)state.needReadable=true;this._read(state.highWaterMark);state.sync=false}if(doRead&&!state.reading)n=howMuchToRead(nOrig,state);var ret;if(n>0)ret=fromList(n,state);else ret=null;if(ret===null){state.needReadable=true;n=0}state.length-=n;if(state.length===0&&!state.ended)state.needReadable=true;if(state.ended&&!state.endEmitted&&state.length===0)endReadable(this);return ret};function chunkInvalid(state,chunk){var er=null;if(!Buffer.isBuffer(chunk)&&"string"!==typeof chunk&&chunk!==null&&chunk!==undefined&&!state.objectMode&&!er){er=new TypeError("Invalid non-string/buffer chunk")}return er}function onEofChunk(stream,state){if(state.decoder&&!state.ended){var chunk=state.decoder.end();if(chunk&&chunk.length){state.buffer.push(chunk);state.length+=state.objectMode?1:chunk.length}}state.ended=true;if(state.length>0)emitReadable(stream);else endReadable(stream)}function emitReadable(stream){var state=stream._readableState;state.needReadable=false;if(state.emittedReadable)return;state.emittedReadable=true;if(state.sync)setImmediate(function(){emitReadable_(stream)});else emitReadable_(stream)}function emitReadable_(stream){stream.emit("readable")}function maybeReadMore(stream,state){if(!state.readingMore){state.readingMore=true;setImmediate(function(){maybeReadMore_(stream,state)})}}function maybeReadMore_(stream,state){var len=state.length;while(!state.reading&&!state.flowing&&!state.ended&&state.length<state.highWaterMark){stream.read(0);if(len===state.length)break;else len=state.length}state.readingMore=false}Readable.prototype._read=function(n){this.emit("error",new Error("not implemented"))};Readable.prototype.pipe=function(dest,pipeOpts){var src=this;var state=this._readableState;switch(state.pipesCount){case 0:state.pipes=dest;break;case 1:state.pipes=[state.pipes,dest];break;default:state.pipes.push(dest);break}state.pipesCount+=1;var doEnd=(!pipeOpts||pipeOpts.end!==false)&&dest!==process.stdout&&dest!==process.stderr;var endFn=doEnd?onend:cleanup;if(state.endEmitted)setImmediate(endFn);else src.once("end",endFn);dest.on("unpipe",onunpipe);function onunpipe(readable){if(readable!==src)return;cleanup()}function onend(){dest.end()}var ondrain=pipeOnDrain(src);dest.on("drain",ondrain);function cleanup(){dest.removeListener("close",onclose);dest.removeListener("finish",onfinish);dest.removeListener("drain",ondrain);dest.removeListener("error",onerror);dest.removeListener("unpipe",onunpipe);src.removeListener("end",onend);src.removeListener("end",cleanup);if(!dest._writableState||dest._writableState.needDrain)ondrain()}var errListeners=EE.listenerCount(dest,"error");function onerror(er){unpipe();if(errListeners===0&&EE.listenerCount(dest,"error")===0)dest.emit("error",er)}dest.once("error",onerror);function onclose(){dest.removeListener("finish",onfinish);unpipe()}dest.once("close",onclose);function onfinish(){dest.removeListener("close",onclose);unpipe()}dest.once("finish",onfinish);function unpipe(){src.unpipe(dest)}dest.emit("pipe",src);if(!state.flowing){this.on("readable",pipeOnReadable);state.flowing=true;setImmediate(function(){flow(src)})}return dest};function pipeOnDrain(src){return function(){var dest=this;var state=src._readableState;state.awaitDrain--;if(state.awaitDrain===0)flow(src)}}function flow(src){var state=src._readableState;var chunk;state.awaitDrain=0;function write(dest,i,list){var written=dest.write(chunk);if(false===written){state.awaitDrain++}}while(state.pipesCount&&null!==(chunk=src.read())){if(state.pipesCount===1)write(state.pipes,0,null);else forEach(state.pipes,write);src.emit("data",chunk);if(state.awaitDrain>0)return}if(state.pipesCount===0){state.flowing=false;if(EE.listenerCount(src,"data")>0)emitDataEvents(src);return}state.ranOut=true}function pipeOnReadable(){if(this._readableState.ranOut){this._readableState.ranOut=false;flow(this)}}Readable.prototype.unpipe=function(dest){var state=this._readableState;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;this.removeListener("readable",pipeOnReadable);state.flowing=false;if(dest)dest.emit("unpipe",this);return this}if(!dest){var dests=state.pipes;var len=state.pipesCount;state.pipes=null;state.pipesCount=0;this.removeListener("readable",pipeOnReadable);state.flowing=false;for(var i=0;i<len;i++)dests[i].emit("unpipe",this);return this}var i=indexOf(state.pipes,dest);if(i===-1)return this;state.pipes.splice(i,1);state.pipesCount-=1;if(state.pipesCount===1)state.pipes=state.pipes[0];dest.emit("unpipe",this);return this};Readable.prototype.on=function(ev,fn){var res=Stream.prototype.on.call(this,ev,fn);if(ev==="data"&&!this._readableState.flowing)emitDataEvents(this);if(ev==="readable"&&this.readable){var state=this._readableState;if(!state.readableListening){state.readableListening=true;state.emittedReadable=false;state.needReadable=true;if(!state.reading){this.read(0)}else if(state.length){emitReadable(this,state)}}}return res};Readable.prototype.addListener=Readable.prototype.on;Readable.prototype.resume=function(){emitDataEvents(this);this.read(0);this.emit("resume")};Readable.prototype.pause=function(){emitDataEvents(this,true);this.emit("pause")};function emitDataEvents(stream,startPaused){var state=stream._readableState;if(state.flowing){throw new Error("Cannot switch to old mode now.")}var paused=startPaused||false;var readable=false;stream.readable=true;stream.pipe=Stream.prototype.pipe;stream.on=stream.addListener=Stream.prototype.on;stream.on("readable",function(){readable=true;var c;while(!paused&&null!==(c=stream.read()))stream.emit("data",c);if(c===null){readable=false;stream._readableState.needReadable=true}});stream.pause=function(){paused=true;this.emit("pause")};stream.resume=function(){paused=false;if(readable)setImmediate(function(){stream.emit("readable")});else this.read(0);this.emit("resume")};stream.emit("readable")}Readable.prototype.wrap=function(stream){var state=this._readableState;var paused=false;var self=this;stream.on("end",function(){if(state.decoder&&!state.ended){var chunk=state.decoder.end();if(chunk&&chunk.length)self.push(chunk)}self.push(null)});stream.on("data",function(chunk){if(state.decoder)chunk=state.decoder.write(chunk);if(!chunk||!state.objectMode&&!chunk.length)return;var ret=self.push(chunk);if(!ret){paused=true;stream.pause()}});for(var i in stream){if(typeof stream[i]==="function"&&typeof this[i]==="undefined"){this[i]=function(method){return function(){return stream[method].apply(stream,arguments)}}(i)}}var events=["error","close","destroy","pause","resume"];forEach(events,function(ev){stream.on(ev,function(x){return self.emit.apply(self,ev,x)})});self._read=function(n){if(paused){paused=false;stream.resume()}};return self};Readable._fromList=fromList;function fromList(n,state){var list=state.buffer;var length=state.length;var stringMode=!!state.decoder;var objectMode=!!state.objectMode;var ret;if(list.length===0)return null;if(length===0)ret=null;else if(objectMode)ret=list.shift();else if(!n||n>=length){if(stringMode)ret=list.join("");else ret=Buffer.concat(list,length);list.length=0}else{if(n<list[0].length){var buf=list[0];ret=buf.slice(0,n);list[0]=buf.slice(n)}else if(n===list[0].length){ret=list.shift()}else{if(stringMode)ret="";else ret=new Buffer(n);var c=0;for(var i=0,l=list.length;i<l&&c<n;i++){var buf=list[0];var cpy=Math.min(n-c,buf.length);if(stringMode)ret+=buf.slice(0,cpy);else buf.copy(ret,c,0,cpy);if(cpy<buf.length)list[0]=buf.slice(cpy);else list.shift();c+=cpy}}}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.calledRead){state.ended=true;setImmediate(function(){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<l;i++){f(xs[i],i)}}function indexOf(xs,x){for(var i=0,l=xs.length;i<l;i++){if(xs[i]===x)return i}return-1}}).call(this,require("/home/admin/browserify-cdn/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))},{"./index.js":25,"/home/admin/browserify-cdn/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":18,buffer:2,events:11,inherits:17,"process/browser.js":26,string_decoder:31}],29:[function(require,module,exports){module.exports=Transform;var Duplex=require("./duplex.js");var inherits=require("inherits");inherits(Transform,Duplex);function TransformState(options,stream){this.afterTransform=function(er,data){return afterTransform(stream,er,data)};this.needTransform=false;this.transforming=false;this.writecb=null;this.writechunk=null}function afterTransform(stream,er,data){var ts=stream._transformState;ts.transforming=false;var cb=ts.writecb;if(!cb)return stream.emit("error",new Error("no writecb in Transform class"));ts.writechunk=null;ts.writecb=null;if(data!==null&&data!==undefined)stream.push(data);if(cb)cb(er);var rs=stream._readableState;rs.reading=false;if(rs.needReadable||rs.length<rs.highWaterMark){stream._read(rs.highWaterMark)}}function Transform(options){if(!(this instanceof Transform))return new Transform(options);Duplex.call(this,options);var ts=this._transformState=new TransformState(options,this);var stream=this;this._readableState.needReadable=true;this._readableState.sync=false;this.once("finish",function(){if("function"===typeof this._flush)this._flush(function(er){done(stream,er)});else done(stream)})}Transform.prototype.push=function(chunk,encoding){this._transformState.needTransform=false;return Duplex.prototype.push.call(this,chunk,encoding)};Transform.prototype._transform=function(chunk,encoding,cb){throw new Error("not implemented")};Transform.prototype._write=function(chunk,encoding,cb){var ts=this._transformState;ts.writecb=cb;ts.writechunk=chunk;ts.writeencoding=encoding;if(!ts.transforming){var rs=this._readableState;if(ts.needTransform||rs.needReadable||rs.length<rs.highWaterMark)this._read(rs.highWaterMark)}};Transform.prototype._read=function(n){var ts=this._transformState;if(ts.writechunk&&ts.writecb&&!ts.transforming){ts.transforming=true;this._transform(ts.writechunk,ts.writeencoding,ts.afterTransform)}else{ts.needTransform=true}};function done(stream,er){if(er)return stream.emit("error",er);var ws=stream._writableState;var rs=stream._readableState;var ts=stream._transformState;if(ws.length)throw new Error("calling transform done when ws.length != 0");if(ts.transforming)throw new Error("calling transform done when still transforming");return stream.push(null)}},{"./duplex.js":24,inherits:17}],30:[function(require,module,exports){module.exports=Writable;Writable.WritableState=WritableState;var isUint8Array=typeof Uint8Array!=="undefined"?function(x){return x instanceof Uint8Array}:function(x){return x&&x.constructor&&x.constructor.name==="Uint8Array"};var isArrayBuffer=typeof ArrayBuffer!=="undefined"?function(x){return x instanceof ArrayBuffer}:function(x){return x&&x.constructor&&x.constructor.name==="ArrayBuffer"};var inherits=require("inherits");var Stream=require("./index.js");var setImmediate=require("process/browser.js").nextTick;var Buffer=require("buffer").Buffer;inherits(Writable,Stream);function WriteReq(chunk,encoding,cb){this.chunk=chunk;this.encoding=encoding;this.callback=cb}function WritableState(options,stream){options=options||{};var hwm=options.highWaterMark;this.highWaterMark=hwm||hwm===0?hwm:16*1024;this.objectMode=!!options.objectMode;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.sync=true;this.bufferProcessing=false;this.onwrite=function(er){onwrite(stream,er)};this.writecb=null;this.writelen=0;this.buffer=[]}function Writable(options){if(!(this instanceof Writable)&&!(this instanceof Stream.Duplex))return new Writable(options);this._writableState=new WritableState(options,this);this.writable=true;Stream.call(this)}Writable.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))};function writeAfterEnd(stream,state,cb){var er=new Error("write after end");stream.emit("error",er);setImmediate(function(){cb(er)})}function validChunk(stream,state,chunk,cb){var valid=true;if(!Buffer.isBuffer(chunk)&&"string"!==typeof chunk&&chunk!==null&&chunk!==undefined&&!state.objectMode){var er=new TypeError("Invalid non-string/buffer chunk");stream.emit("error",er);setImmediate(function(){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)&&isUint8Array(chunk))chunk=new Buffer(chunk);if(isArrayBuffer(chunk)&&typeof Uint8Array!=="undefined")chunk=new Buffer(new Uint8Array(chunk));if(Buffer.isBuffer(chunk))encoding="buffer";else if(!encoding)encoding=state.defaultEncoding;if(typeof cb!=="function")cb=function(){};if(state.ended)writeAfterEnd(this,state,cb);else if(validChunk(this,state,chunk,cb))ret=writeOrBuffer(this,state,chunk,encoding,cb);return ret};function decodeChunk(state,chunk,encoding){if(!state.objectMode&&state.decodeStrings!==false&&typeof chunk==="string"){chunk=new Buffer(chunk,encoding)}return chunk}function writeOrBuffer(stream,state,chunk,encoding,cb){chunk=decodeChunk(state,chunk,encoding);var len=state.objectMode?1:chunk.length;state.length+=len;var ret=state.length<state.highWaterMark;state.needDrain=!ret;if(state.writing)state.buffer.push(new WriteReq(chunk,encoding,cb));else doWrite(stream,state,len,chunk,encoding,cb);return ret}function doWrite(stream,state,len,chunk,encoding,cb){state.writelen=len;state.writecb=cb;state.writing=true;state.sync=true;stream._write(chunk,encoding,state.onwrite);state.sync=false}function onwriteError(stream,state,sync,er,cb){if(sync)setImmediate(function(){cb(er)});else cb(er);stream.emit("error",er)}function onwriteStateUpdate(state){state.writing=false;state.writecb=null;state.length-=state.writelen;state.writelen=0}function onwrite(stream,er){var state=stream._writableState;var sync=state.sync;var cb=state.writecb;onwriteStateUpdate(state);if(er)onwriteError(stream,state,sync,er,cb);else{var finished=needFinish(stream,state);if(!finished&&!state.bufferProcessing&&state.buffer.length)clearBuffer(stream,state);if(sync){setImmediate(function(){afterWrite(stream,state,finished,cb)})}else{afterWrite(stream,state,finished,cb)}}}function afterWrite(stream,state,finished,cb){if(!finished)onwriteDrain(stream,state);cb();if(finished)finishMaybe(stream,state)}function onwriteDrain(stream,state){if(state.length===0&&state.needDrain){state.needDrain=false;stream.emit("drain")}}function clearBuffer(stream,state){state.bufferProcessing=true;for(var c=0;c<state.buffer.length;c++){var entry=state.buffer[c];var chunk=entry.chunk;var encoding=entry.encoding;var cb=entry.callback;var len=state.objectMode?1:chunk.length;doWrite(stream,state,len,chunk,encoding,cb);if(state.writing){c++;break}}state.bufferProcessing=false;if(c<state.buffer.length)state.buffer=state.buffer.slice(c);else state.buffer.length=0}Writable.prototype._write=function(chunk,encoding,cb){cb(new Error("not implemented"))};Writable.prototype.end=function(chunk,encoding,cb){var state=this._writableState;if(typeof chunk==="function"){cb=chunk;chunk=null;encoding=null}else if(typeof encoding==="function"){cb=encoding;encoding=null}if(typeof chunk!=="undefined"&&chunk!==null)this.write(chunk,encoding);if(!state.ending&&!state.finished)endWritable(this,state,cb)};function needFinish(stream,state){return state.ending&&state.length===0&&!state.finished&&!state.writing}function finishMaybe(stream,state){var need=needFinish(stream,state);if(need){state.finished=true;stream.emit("finish")}return need}function endWritable(stream,state,cb){state.ending=true;finishMaybe(stream,state);if(cb){if(state.finished)setImmediate(cb);else stream.once("finish",cb)}state.ended=true}},{"./index.js":25,buffer:2,inherits:17,"process/browser.js":26}],31:[function(require,module,exports){var Buffer=require("buffer").Buffer;function assertEncoding(encoding){if(encoding&&!Buffer.isEncoding(encoding)){throw new Error("Unknown encoding: "+encoding)}}var StringDecoder=exports.StringDecoder=function(encoding){this.encoding=(encoding||"utf8").toLowerCase().replace(/[-_]/,"");assertEncoding(encoding);switch(this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2;this.detectIncompleteChar=utf16DetectIncompleteChar;break;case"base64":this.surrogateSize=3;this.detectIncompleteChar=base64DetectIncompleteChar;break;default:this.write=passThroughWrite;return}this.charBuffer=new Buffer(6);this.charReceived=0;this.charLength=0};StringDecoder.prototype.write=function(buffer){var charStr="";var offset=0;while(this.charLength){var i=buffer.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:buffer.length;buffer.copy(this.charBuffer,this.charReceived,offset,i);this.charReceived+=i-offset;offset=i;if(this.charReceived<this.charLength){return""}charStr=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var charCode=charStr.charCodeAt(charStr.length-1);if(charCode>=55296&&charCode<=56319){this.charLength+=this.surrogateSize;charStr="";continue}this.charReceived=this.charLength=0;if(i==buffer.length)return charStr;buffer=buffer.slice(i,buffer.length);break}var lenIncomplete=this.detectIncompleteChar(buffer);var end=buffer.length;if(this.charLength){buffer.copy(this.charBuffer,0,buffer.length-lenIncomplete,end);this.charReceived=lenIncomplete;end-=lenIncomplete}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);this.charBuffer.write(charStr.charAt(charStr.length-1),this.encoding);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}}return 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){var incomplete=this.charReceived=buffer.length%2;this.charLength=incomplete?2:0;return incomplete}function base64DetectIncompleteChar(buffer){var incomplete=this.charReceived=buffer.length%3;this.charLength=incomplete?3:0;return incomplete}},{buffer:2}],32:[function(require,module,exports){(function(){"use strict";var punycode=require("punycode");exports.parse=urlParse;exports.resolve=urlResolve;exports.resolveObject=urlResolveObject;exports.format=urlFormat;var protocolPattern=/^([a-z0-9.+-]+:)/i,portPattern=/:[0-9]*$/,delims=["<",">",'"',"`"," ","\r","\n"," "],unwise=["{","}","|","\\","^","~","`"].concat(delims),autoEscape=["'"].concat(delims),nonHostChars=["%","/","?",";","#"].concat(unwise).concat(autoEscape),nonAuthChars=["/","@","?","#"].concat(delims),hostnameMaxLen=255,hostnamePartPattern=/^[a-zA-Z0-9][a-z0-9A-Z_-]{0,62}$/,hostnamePartStart=/^([a-zA-Z0-9][a-z0-9A-Z_-]{0,62})(.*)$/,unsafeProtocol={javascript:true,"javascript:":true},hostlessProtocol={javascript:true,"javascript:":true},pathedProtocol={http:true,https:true,ftp:true,gopher:true,file:true,"http:":true,"ftp:":true,"gopher:":true,"file:":true},slashedProtocol={http:true,https:true,ftp:true,gopher:true,file:true,"http:":true,"https:":true,"ftp:":true,"gopher:":true,"file:":true},querystring=require("querystring");function urlParse(url,parseQueryString,slashesDenoteHost){if(url&&typeof url==="object"&&url.href)return url;if(typeof url!=="string"){throw new TypeError("Parameter 'url' must be a string, not "+typeof url)}var out={},rest=url;rest=rest.trim();var proto=protocolPattern.exec(rest);if(proto){proto=proto[0];var lowerProto=proto.toLowerCase();out.protocol=lowerProto;rest=rest.substr(proto.length)}if(slashesDenoteHost||proto||rest.match(/^\/\/[^@\/]+@[^@\/]+/)){var slashes=rest.substr(0,2)==="//";if(slashes&&!(proto&&hostlessProtocol[proto])){rest=rest.substr(2);out.slashes=true}}if(!hostlessProtocol[proto]&&(slashes||proto&&!slashedProtocol[proto])){var atSign=rest.indexOf("@");if(atSign!==-1){var auth=rest.slice(0,atSign);var hasAuth=true;for(var i=0,l=nonAuthChars.length;i<l;i++){if(auth.indexOf(nonAuthChars[i])!==-1){hasAuth=false;break}}if(hasAuth){out.auth=decodeURIComponent(auth);rest=rest.substr(atSign+1)}}var firstNonHost=-1;for(var i=0,l=nonHostChars.length;i<l;i++){var index=rest.indexOf(nonHostChars[i]);if(index!==-1&&(firstNonHost<0||index<firstNonHost))firstNonHost=index}if(firstNonHost!==-1){out.host=rest.substr(0,firstNonHost);rest=rest.substr(firstNonHost)}else{out.host=rest;rest=""}var p=parseHost(out.host);var keys=Object.keys(p);for(var i=0,l=keys.length;i<l;i++){var key=keys[i];out[key]=p[key]}out.hostname=out.hostname||"";var ipv6Hostname=out.hostname[0]==="["&&out.hostname[out.hostname.length-1]==="]";if(out.hostname.length>hostnameMaxLen){out.hostname=""}else if(!ipv6Hostname){var hostparts=out.hostname.split(/\./);for(var i=0,l=hostparts.length;i<l;i++){var part=hostparts[i];if(!part)continue;if(!part.match(hostnamePartPattern)){var newpart="";for(var j=0,k=part.length;j<k;j++){if(part.charCodeAt(j)>127){newpart+="x"}else{newpart+=part[j]}}if(!newpart.match(hostnamePartPattern)){var validParts=hostparts.slice(0,i);var notHost=hostparts.slice(i+1);var bit=part.match(hostnamePartStart);if(bit){validParts.push(bit[1]);notHost.unshift(bit[2])}if(notHost.length){rest="/"+notHost.join(".")+rest}out.hostname=validParts.join(".");break}}}}out.hostname=out.hostname.toLowerCase();if(!ipv6Hostname){var domainArray=out.hostname.split(".");var newOut=[];for(var i=0;i<domainArray.length;++i){var s=domainArray[i];newOut.push(s.match(/[^A-Za-z0-9_-]/)?"xn--"+punycode.encode(s):s)}out.hostname=newOut.join(".")}out.host=(out.hostname||"")+(out.port?":"+out.port:"");out.href+=out.host;if(ipv6Hostname){out.hostname=out.hostname.substr(1,out.hostname.length-2);if(rest[0]!=="/"){rest="/"+rest}}}if(!unsafeProtocol[lowerProto]){for(var i=0,l=autoEscape.length;i<l;i++){var ae=autoEscape[i];var esc=encodeURIComponent(ae);if(esc===ae){esc=escape(ae)}rest=rest.split(ae).join(esc)}}var hash=rest.indexOf("#");if(hash!==-1){out.hash=rest.substr(hash);rest=rest.slice(0,hash)}var qm=rest.indexOf("?");if(qm!==-1){out.search=rest.substr(qm);out.query=rest.substr(qm+1);if(parseQueryString){out.query=querystring.parse(out.query)}rest=rest.slice(0,qm)}else if(parseQueryString){out.search="";out.query={}}if(rest)out.pathname=rest;if(slashedProtocol[proto]&&out.hostname&&!out.pathname){out.pathname="/"}if(out.pathname||out.search){out.path=(out.pathname?out.pathname:"")+(out.search?out.search:"")}out.href=urlFormat(out);return out}function urlFormat(obj){if(typeof obj==="string")obj=urlParse(obj);var auth=obj.auth||"";if(auth){auth=encodeURIComponent(auth);auth=auth.replace(/%3A/i,":");auth+="@"}var protocol=obj.protocol||"",pathname=obj.pathname||"",hash=obj.hash||"",host=false,query="";if(obj.host!==undefined){host=auth+obj.host}else if(obj.hostname!==undefined){host=auth+(obj.hostname.indexOf(":")===-1?obj.hostname:"["+obj.hostname+"]");if(obj.port){host+=":"+obj.port}}if(obj.query&&typeof obj.query==="object"&&Object.keys(obj.query).length){query=querystring.stringify(obj.query)}var search=obj.search||query&&"?"+query||"";if(protocol&&protocol.substr(-1)!==":")protocol+=":";if(obj.slashes||(!protocol||slashedProtocol[protocol])&&host!==false){host="//"+(host||"");if(pathname&&pathname.charAt(0)!=="/")pathname="/"+pathname}else if(!host){host=""}if(hash&&hash.charAt(0)!=="#")hash="#"+hash;if(search&&search.charAt(0)!=="?")search="?"+search;return protocol+host+pathname+search+hash}function urlResolve(source,relative){return urlFormat(urlResolveObject(source,relative))}function urlResolveObject(source,relative){if(!source)return relative;source=urlParse(urlFormat(source),false,true);relative=urlParse(urlFormat(relative),false,true);source.hash=relative.hash;if(relative.href===""){source.href=urlFormat(source);return source}if(relative.slashes&&!relative.protocol){relative.protocol=source.protocol;if(slashedProtocol[relative.protocol]&&relative.hostname&&!relative.pathname){relative.path=relative.pathname="/"}relative.href=urlFormat(relative);return relative}if(relative.protocol&&relative.protocol!==source.protocol){if(!slashedProtocol[relative.protocol]){relative.href=urlFormat(relative);return relative}source.protocol=relative.protocol;if(!relative.host&&!hostlessProtocol[relative.protocol]){var relPath=(relative.pathname||"").split("/");while(relPath.length&&!(relative.host=relPath.shift()));if(!relative.host)relative.host=""; | |
if(!relative.hostname)relative.hostname="";if(relPath[0]!=="")relPath.unshift("");if(relPath.length<2)relPath.unshift("");relative.pathname=relPath.join("/")}source.pathname=relative.pathname;source.search=relative.search;source.query=relative.query;source.host=relative.host||"";source.auth=relative.auth;source.hostname=relative.hostname||relative.host;source.port=relative.port;if(source.pathname!==undefined||source.search!==undefined){source.path=(source.pathname?source.pathname:"")+(source.search?source.search:"")}source.slashes=source.slashes||relative.slashes;source.href=urlFormat(source);return source}var isSourceAbs=source.pathname&&source.pathname.charAt(0)==="/",isRelAbs=relative.host!==undefined||relative.pathname&&relative.pathname.charAt(0)==="/",mustEndAbs=isRelAbs||isSourceAbs||source.host&&relative.pathname,removeAllDots=mustEndAbs,srcPath=source.pathname&&source.pathname.split("/")||[],relPath=relative.pathname&&relative.pathname.split("/")||[],psychotic=source.protocol&&!slashedProtocol[source.protocol];if(psychotic){delete source.hostname;delete source.port;if(source.host){if(srcPath[0]==="")srcPath[0]=source.host;else srcPath.unshift(source.host)}delete source.host;if(relative.protocol){delete relative.hostname;delete relative.port;if(relative.host){if(relPath[0]==="")relPath[0]=relative.host;else relPath.unshift(relative.host)}delete relative.host}mustEndAbs=mustEndAbs&&(relPath[0]===""||srcPath[0]==="")}if(isRelAbs){source.host=relative.host||relative.host===""?relative.host:source.host;source.hostname=relative.hostname||relative.hostname===""?relative.hostname:source.hostname;source.search=relative.search;source.query=relative.query;srcPath=relPath}else if(relPath.length){if(!srcPath)srcPath=[];srcPath.pop();srcPath=srcPath.concat(relPath);source.search=relative.search;source.query=relative.query}else if("search"in relative){if(psychotic){source.hostname=source.host=srcPath.shift();var authInHost=source.host&&source.host.indexOf("@")>0?source.host.split("@"):false;if(authInHost){source.auth=authInHost.shift();source.host=source.hostname=authInHost.shift()}}source.search=relative.search;source.query=relative.query;if(source.pathname!==undefined||source.search!==undefined){source.path=(source.pathname?source.pathname:"")+(source.search?source.search:"")}source.href=urlFormat(source);return source}if(!srcPath.length){delete source.pathname;if(!source.search){source.path="/"+source.search}else{delete source.path}source.href=urlFormat(source);return source}var last=srcPath.slice(-1)[0];var hasTrailingSlash=(source.host||relative.host)&&(last==="."||last==="..")||last==="";var up=0;for(var i=srcPath.length;i>=0;i--){last=srcPath[i];if(last=="."){srcPath.splice(i,1)}else if(last===".."){srcPath.splice(i,1);up++}else if(up){srcPath.splice(i,1);up--}}if(!mustEndAbs&&!removeAllDots){for(;up--;up){srcPath.unshift("..")}}if(mustEndAbs&&srcPath[0]!==""&&(!srcPath[0]||srcPath[0].charAt(0)!=="/")){srcPath.unshift("")}if(hasTrailingSlash&&srcPath.join("/").substr(-1)!=="/"){srcPath.push("")}var isAbsolute=srcPath[0]===""||srcPath[0]&&srcPath[0].charAt(0)==="/";if(psychotic){source.hostname=source.host=isAbsolute?"":srcPath.length?srcPath.shift():"";var authInHost=source.host&&source.host.indexOf("@")>0?source.host.split("@"):false;if(authInHost){source.auth=authInHost.shift();source.host=source.hostname=authInHost.shift()}}mustEndAbs=mustEndAbs||source.host&&srcPath.length;if(mustEndAbs&&!isAbsolute){srcPath.unshift("")}source.pathname=srcPath.join("/");if(source.pathname!==undefined||source.search!==undefined){source.path=(source.pathname?source.pathname:"")+(source.search?source.search:"")}source.auth=relative.auth||source.auth;source.slashes=source.slashes||relative.slashes;source.href=urlFormat(source);return source}function parseHost(host){var out={};var port=portPattern.exec(host);if(port){port=port[0];if(port!==":"){out.port=port.substr(1)}host=host.substr(0,host.length-port.length)}if(host)out.hostname=host;return out}})()},{punycode:20,querystring:23}],33:[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"}},{}],34:[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<arguments.length;i++){objects.push(inspect(arguments[i]))}return objects.join(" ")}var i=1;var args=arguments;var len=args.length;var str=String(f).replace(formatRegExp,function(x){if(x==="%%")return"%";if(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<len;x=args[++i]){if(isNull(x)||!isObject(x)){str+=" "+x}else{str+=" "+inspect(x)}}return str};exports.deprecate=function(fn,msg){if(isUndefined(global.process)){return function(){return exports.deprecate(fn,msg).apply(this,arguments)}}if(process.noDeprecation===true){return fn}var warned=false;function deprecated(){if(!warned){if(process.throwDeprecation){throw new Error(msg)}else if(process.traceDeprecation){console.trace(msg)}else{console.error(msg)}warned=true}return fn.apply(this,arguments)}return deprecated};var debugs={};var debugEnviron;exports.debuglog=function(set){if(isUndefined(debugEnviron))debugEnviron=process.env.NODE_DEBUG||"";set=set.toUpperCase();if(!debugs[set]){if(new RegExp("\\b"+set+"\\b","i").test(debugEnviron)){var pid=process.pid;debugs[set]=function(){var msg=exports.format.apply(exports,arguments);console.error("%s %d: %s",set,pid,msg)}}else{debugs[set]=function(){}}}return debugs[set]};function inspect(obj,opts){var ctx={seen:[],stylize:stylizeNoColor};if(arguments.length>=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<l;++i){if(hasOwnProperty(value,String(i))){output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,String(i),true))}else{output.push("")}}keys.forEach(function(key){if(!key.match(/^\d+$/)){output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,key,true))}});return output}function formatProperty(ctx,value,recurseTimes,visibleKeys,key,array){var name,str,desc;desc=Object.getOwnPropertyDescriptor(value,key)||{value:value[key]};if(desc.get){if(desc.set){str=ctx.stylize("[Getter/Setter]","special")}else{str=ctx.stylize("[Getter]","special")}}else{if(desc.set){str=ctx.stylize("[Setter]","special")}}if(!hasOwnProperty(visibleKeys,key)){name="["+key+"]"}if(!str){if(ctx.seen.indexOf(desc.value)<0){if(isNull(recurseTimes)){str=formatValue(ctx,desc.value,null)}else{str=formatValue(ctx,desc.value,recurseTimes-1)}if(str.indexOf("\n")>-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("/home/admin/browserify-cdn/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./support/isBuffer":33,"/home/admin/browserify-cdn/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":18,inherits:17}],bQcVMY:[function(require,module,exports){(function(process){var cookies=require("./lib/cookies"),copy=require("./lib/copy"),Request=require("./request"),util=require("util");function initParams(uri,options,callback){var opts;if(typeof options==="function"&&!callback)callback=options;if(options&&typeof options==="object"){opts=util._extend({},options);opts.uri=uri}else if(typeof uri==="string"){opts={uri:uri}}else{opts=util._extend({},uri);uri=opts.uri}return{uri:uri,options:opts,callback:callback}}function request(uri,options,callback){var opts;if(typeof uri==="undefined")throw new Error("undefined is not a valid uri or options object.");if(typeof options==="function"&&!callback)callback=options;if(options&&typeof options==="object"){opts=util._extend({},options);opts.uri=uri}else if(typeof uri==="string"){opts={uri:uri}}else{opts=util._extend({},uri)}if(callback)opts.callback=callback;var r=new Request(opts);return r}module.exports=request;request.Request=Request;request.debug=process.env.NODE_DEBUG&&/request/.test(process.env.NODE_DEBUG);request.initParams=initParams;request.defaults=function(options,requester){var def=function(method){var d=function(uri,opts,callback){var params=initParams(uri,opts,callback);for(var i in options){if(params.options[i]===undefined)params.options[i]=options[i]}if(typeof requester==="function"){if(method===request){method=requester}else{params.options._requester=requester}}return method(params.options,params.callback)};return d};var de=def(request);de.get=def(request.get);de.patch=def(request.patch);de.post=def(request.post);de.put=def(request.put);de.head=def(request.head);de.del=def(request.del);de.cookie=def(request.cookie);de.jar=request.jar;return de};function requester(params){if(typeof params.options._requester==="function"){return params.options._requester}else{return request}}request.forever=function(agentOptions,optionsArg){var options={};if(optionsArg){for(var option in optionsArg){options[option]=optionsArg[option]}}if(agentOptions)options.agentOptions=agentOptions;options.forever=true;return request.defaults(options)};request.get=function(uri,options,callback){var params=initParams(uri,options,callback);params.options.method="GET";return requester(params)(params.uri||null,params.options,params.callback)};request.post=function(uri,options,callback){var params=initParams(uri,options,callback);params.options.method="POST";return requester(params)(params.uri||null,params.options,params.callback)};request.put=function(uri,options,callback){var params=initParams(uri,options,callback);params.options.method="PUT";return requester(params)(params.uri||null,params.options,params.callback)};request.patch=function(uri,options,callback){var params=initParams(uri,options,callback);params.options.method="PATCH";return requester(params)(params.uri||null,params.options,params.callback)};request.head=function(uri,options,callback){var params=initParams(uri,options,callback);params.options.method="HEAD";if(params.options.body||params.options.requestBodyStream||params.options.json&&typeof params.options.json!=="boolean"||params.options.multipart){throw new Error("HTTP HEAD requests MUST NOT include a request body.")}return requester(params)(params.uri||null,params.options,params.callback)};request.del=function(uri,options,callback){var params=initParams(uri,options,callback);params.options.method="DELETE";return requester(params)(params.uri||null,params.options,params.callback)};request.jar=function(){return cookies.jar()};request.cookie=function(str){return cookies.parse(str)}}).call(this,require("/home/admin/browserify-cdn/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))},{"./lib/cookies":37,"./lib/copy":38,"./request":47,"/home/admin/browserify-cdn/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":18,util:34}],request:[function(require,module,exports){module.exports=require("bQcVMY")},{}],37:[function(require,module,exports){var optional=require("./optional"),tough=optional("tough-cookie"),Cookie=tough&&tough.Cookie,CookieJar=tough&&tough.CookieJar;exports.parse=function(str){if(str&&str.uri)str=str.uri;if(typeof str!=="string")throw new Error("The cookie function only accepts STRING as param");if(!Cookie){return null}return Cookie.parse(str)};function RequestJar(){this._jar=new CookieJar}RequestJar.prototype.setCookie=function(cookieOrStr,uri,options){return this._jar.setCookieSync(cookieOrStr,uri,options||{})};RequestJar.prototype.getCookieString=function(uri){return this._jar.getCookieStringSync(uri)};exports.jar=function(){if(!CookieJar){return{setCookie:function(){},getCookieString:function(){}}}return new RequestJar}},{"./optional":41}],38:[function(require,module,exports){module.exports=function copy(obj){var o={};Object.keys(obj).forEach(function(i){o[i]=obj[i]});return o}},{}],39:[function(require,module,exports){(function(process){var util=require("util");module.exports=function debug(){if(/\brequest\b/.test(process.env.NODE_DEBUG))console.error("REQUEST %s",util.format.apply(util,arguments))}}).call(this,require("/home/admin/browserify-cdn/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))},{"/home/admin/browserify-cdn/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":18,util:34}],40:[function(require,module,exports){module.exports=function getSafe(self,uuid){if(typeof self==="object"||typeof self==="function")var safe={};if(Array.isArray(self))var safe=[];var recurse=[];Object.defineProperty(self,uuid,{});var attrs=Object.keys(self).filter(function(i){if(i===uuid)return false;if(typeof self[i]!=="object"&&typeof self[i]!=="function"||self[i]===null)return true;return!Object.getOwnPropertyDescriptor(self[i],uuid)});for(var i=0;i<attrs.length;i++){if(typeof self[attrs[i]]!=="object"&&typeof self[attrs[i]]!=="function"||self[attrs[i]]===null){safe[attrs[i]]=self[attrs[i]]}else{recurse.push(attrs[i]);Object.defineProperty(self[attrs[i]],uuid,{})}}for(var i=0;i<recurse.length;i++){safe[recurse[i]]=getSafe(self[recurse[i]],uuid)}return safe}},{}],41:[function(require,module,exports){module.exports=function(module){try{return require(module)}catch(e){}}},{}],42:[function(require,module,exports){module.exports=ForeverAgent;ForeverAgent.SSL=ForeverAgentSSL;var util=require("util"),Agent=require("http").Agent,net=require("net"),tls=require("tls"),AgentSSL=require("https").Agent;function ForeverAgent(options){var self=this;self.options=options||{};self.requests={};self.sockets={};self.freeSockets={};self.maxSockets=self.options.maxSockets||Agent.defaultMaxSockets;self.minSockets=self.options.minSockets||ForeverAgent.defaultMinSockets;self.on("free",function(socket,host,port){var name=host+":"+port;if(self.requests[name]&&self.requests[name].length){self.requests[name].shift().onSocket(socket)}else if(self.sockets[name].length<self.minSockets){if(!self.freeSockets[name])self.freeSockets[name]=[];self.freeSockets[name].push(socket);var onIdleError=function(){socket.destroy()};socket._onIdleError=onIdleError;socket.on("error",onIdleError)}else{socket.destroy()}})}util.inherits(ForeverAgent,Agent);ForeverAgent.defaultMinSockets=5;ForeverAgent.prototype.createConnection=net.createConnection;ForeverAgent.prototype.addRequestNoreuse=Agent.prototype.addRequest;ForeverAgent.prototype.addRequest=function(req,host,port){var name=host+":"+port;if(this.freeSockets[name]&&this.freeSockets[name].length>0&&!req.useChunkedEncodingByDefault){var idleSocket=this.freeSockets[name].pop();idleSocket.removeListener("error",idleSocket._onIdleError);delete idleSocket._onIdleError;req._reusedSocket=true;req.onSocket(idleSocket)}else{this.addRequestNoreuse(req,host,port)}};ForeverAgent.prototype.removeSocket=function(s,name,host,port){if(this.sockets[name]){var index=this.sockets[name].indexOf(s);if(index!==-1){this.sockets[name].splice(index,1)}}else if(this.sockets[name]&&this.sockets[name].length===0){delete this.sockets[name];delete this.requests[name]}if(this.freeSockets[name]){var index=this.freeSockets[name].indexOf(s);if(index!==-1){this.freeSockets[name].splice(index,1);if(this.freeSockets[name].length===0){delete this.freeSockets[name]}}}if(this.requests[name]&&this.requests[name].length){this.createSocket(name,host,port).emit("free")}};function ForeverAgentSSL(options){ForeverAgent.call(this,options)}util.inherits(ForeverAgentSSL,ForeverAgent);ForeverAgentSSL.prototype.createConnection=createConnectionSSL;ForeverAgentSSL.prototype.addRequestNoreuse=AgentSSL.prototype.addRequest;function createConnectionSSL(port,host,options){if(typeof port==="object"){options=port}else if(typeof host==="object"){options=host}else if(typeof options==="object"){options=options}else{options={}}if(typeof port==="number"){options.port=port}if(typeof host==="string"){options.host=host}return tls.connect(options)}},{http:12,https:16,net:1,tls:1,util:34}],43:[function(require,module,exports){module.exports=stringify;function getSerialize(fn,decycle){var seen=[],keys=[];decycle=decycle||function(key,value){return"[Circular "+getPath(value,seen,keys)+"]"};return function(key,value){var ret=value;if(typeof value==="object"&&value){if(seen.indexOf(value)!==-1)ret=decycle(key,value);else{seen.push(value);keys.push(key)}}if(fn)ret=fn(key,ret);return ret}}function getPath(value,seen,keys){var index=seen.indexOf(value);var path=[keys[index]];for(index--;index>=0;index--){if(seen[index][path[0]]===value){value=seen[index];path.unshift(keys[index])}}return"~"+path.join(".")}function stringify(obj,fn,spaces,decycle){return JSON.stringify(obj,getSerialize(fn,decycle),spaces)}stringify.getSerialize=getSerialize},{}],44:[function(require,module,exports){(function(process,__dirname){var path=require("path");var fs=require("fs");function Mime(){this.types=Object.create(null);this.extensions=Object.create(null)}Mime.prototype.define=function(map){for(var type in map){var exts=map[type];for(var i=0;i<exts.length;i++){if(process.env.DEBUG_MIME&&this.types[exts]){console.warn(this._loading.replace(/.*\//,""),'changes "'+exts[i]+'" extension type from '+this.types[exts]+" to "+type)}this.types[exts[i]]=type}if(!this.extensions[type]){this.extensions[type]=exts[0]}}};Mime.prototype.load=function(file){this._loading=file;var map={},content=fs.readFileSync(file,"ascii"),lines=content.split(/[\r\n]+/);lines.forEach(function(line){var fields=line.replace(/\s*#.*|^\s*|\s*$/g,"").split(/\s+/);map[fields.shift()]=fields});this.define(map);this._loading=null};Mime.prototype.lookup=function(path,fallback){var ext=path.replace(/.*[\.\/\\]/,"").toLowerCase();return this.types[ext]||fallback||this.default_type};Mime.prototype.extension=function(mimeType){var type=mimeType.match(/^\s*([^;\s]*)(?:;|\s|$)/)[1].toLowerCase();return this.extensions[type]};var mime=new Mime;mime.load(path.join(__dirname,"types/mime.types"));mime.load(path.join(__dirname,"types/node.types"));mime.default_type=mime.lookup("bin");mime.Mime=Mime;mime.charsets={lookup:function(mimeType,fallback){return/^text\//.test(mimeType)?"UTF-8":fallback}};module.exports=mime}).call(this,require("/home/admin/browserify-cdn/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),"/node_modules/mime")},{"/home/admin/browserify-cdn/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":18,fs:1,path:19}],45:[function(require,module,exports){(function(Buffer){(function(){var _global=this;var _rng;if(typeof require=="function"){try{var _rb=require("crypto").randomBytes;_rng=_rb&&function(){return _rb(16)}}catch(e){}}if(!_rng&&_global.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}}var BufferClass=typeof Buffer=="function"?Buffer:Array;var _byteToHex=[];var _hexToByte={};for(var i=0;i<256;i++){_byteToHex[i]=(i+256).toString(16).substr(1);_hexToByte[_byteToHex[i]]=i}function parse(s,buf,offset){var i=buf&&offset||0,ii=0;buf=buf||[];s.toLowerCase().replace(/[0-9a-f]{2}/g,function(oct){if(ii<16){buf[i+ii++]=_hexToByte[oct]}});while(ii<16){buf[i+ii++]=0}return buf}function unparse(buf,offset){var i=offset||0,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++]]}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!=null?options.clockseq:_clockseq;var msecs=options.msecs!=null?options.msecs:(new Date).getTime();var nsecs=options.nsecs!=null?options.nsecs:_lastNSecs+1;var dt=msecs-_lastMSecs+(nsecs-_lastNSecs)/1e4;if(dt<0&&options.clockseq==null){clockseq=clockseq+1&16383}if((dt<0||msecs>_lastMSecs)&&options.nsecs==null){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:unparse(b)}function v4(options,buf,offset){var i=buf&&offset||0;if(typeof options=="string"){buf=options=="binary"?new BufferClass(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||unparse(rnds)}var uuid=v4;uuid.v1=v1;uuid.v4=v4;uuid.parse=parse;uuid.unparse=unparse;uuid.BufferClass=BufferClass;if(typeof define==="function"&&define.amd){define(function(){return uuid})}else if(typeof module!="undefined"&&module.exports){module.exports=uuid}else{var _previousRoot=_global.uuid;uuid.noConflict=function(){_global.uuid=_previousRoot;return uuid};_global.uuid=uuid}}).call(this)}).call(this,require("buffer").Buffer)},{buffer:2,crypto:6}],46:[function(require,module,exports){var toString=Object.prototype.toString;var hasOwnProperty=Object.prototype.hasOwnProperty;var indexOf=typeof Array.prototype.indexOf==="function"?function(arr,el){return arr.indexOf(el)}:function(arr,el){for(var i=0;i<arr.length;i++){if(arr[i]===el)return i}return-1};var isArray=Array.isArray||function(arr){return toString.call(arr)=="[object Array]"};var objectKeys=Object.keys||function(obj){var ret=[];for(var key in obj){if(obj.hasOwnProperty(key)){ret.push(key)}}return ret};var forEach=typeof Array.prototype.forEach==="function"?function(arr,fn){return arr.forEach(fn)}:function(arr,fn){for(var i=0;i<arr.length;i++)fn(arr[i])};var reduce=function(arr,fn,initial){if(typeof arr.reduce==="function")return arr.reduce(fn,initial);var res=initial;for(var i=0;i<arr.length;i++)res=fn(res,arr[i]);return res};var isint=/^[0-9]+$/;function promote(parent,key){if(parent[key].length==0)return parent[key]={};var t={};for(var i in parent[key]){if(hasOwnProperty.call(parent[key],i)){t[i]=parent[key][i]}}parent[key]=t;return t}function parse(parts,parent,key,val){var part=parts.shift();if(Object.getOwnPropertyDescriptor(Object.prototype,key))return;if(!part){if(isArray(parent[key])){parent[key].push(val)}else if("object"==typeof parent[key]){parent[key]=val}else if("undefined"==typeof parent[key]){parent[key]=val}else{parent[key]=[parent[key],val]}}else{var obj=parent[key]=parent[key]||[];if("]"==part){if(isArray(obj)){if(""!=val)obj.push(val)}else if("object"==typeof obj){obj[objectKeys(obj).length]=val}else{obj=parent[key]=[parent[key],val]}}else if(~indexOf(part,"]")){part=part.substr(0,part.length-1);if(!isint.test(part)&&isArray(obj))obj=promote(parent,key);parse(parts,obj,part,val)}else{if(!isint.test(part)&&isArray(obj))obj=promote(parent,key);parse(parts,obj,part,val)}}}function merge(parent,key,val){if(~indexOf(key,"]")){var parts=key.split("["),len=parts.length,last=len-1;parse(parts,parent,"base",val)}else{if(!isint.test(key)&&isArray(parent.base)){var t={};for(var k in parent.base)t[k]=parent.base[k];parent.base=t}set(parent.base,key,val)}return parent}function compact(obj){if("object"!=typeof obj)return obj;if(isArray(obj)){var ret=[];for(var i in obj){if(hasOwnProperty.call(obj,i)){ret.push(obj[i])}}return ret}for(var key in obj){obj[key]=compact(obj[key])}return obj}function parseObject(obj){var ret={base:{}};forEach(objectKeys(obj),function(name){merge(ret,name,obj[name])});return compact(ret.base)}function parseString(str){var ret=reduce(String(str).split("&"),function(ret,pair){var eql=indexOf(pair,"="),brace=lastBraceInKey(pair),key=pair.substr(0,brace||eql),val=pair.substr(brace||eql,pair.length),val=val.substr(indexOf(val,"=")+1,val.length);if(""==key)key=pair,val="";if(""==key)return ret;return merge(ret,decode(key),decode(val))},{base:{}}).base;return compact(ret)}exports.parse=function(str){if(null==str||""==str)return{};return"object"==typeof str?parseObject(str):parseString(str)};var stringify=exports.stringify=function(obj,prefix){if(isArray(obj)){return stringifyArray(obj,prefix)}else if("[object Object]"==toString.call(obj)){return stringifyObject(obj,prefix)}else if("string"==typeof obj){return stringifyString(obj,prefix)}else{return prefix+"="+encodeURIComponent(String(obj))}};function stringifyString(str,prefix){if(!prefix)throw new TypeError("stringify expects an object");return prefix+"="+encodeURIComponent(str)}function stringifyArray(arr,prefix){var ret=[];if(!prefix)throw new TypeError("stringify expects an object");for(var i=0;i<arr.length;i++){ret.push(stringify(arr[i],prefix+"["+i+"]"))}return ret.join("&")}function stringifyObject(obj,prefix){var ret=[],keys=objectKeys(obj),key; | |
for(var i=0,len=keys.length;i<len;++i){key=keys[i];if(""==key)continue;if(null==obj[key]){ret.push(encodeURIComponent(key)+"=")}else{ret.push(stringify(obj[key],prefix?prefix+"["+encodeURIComponent(key)+"]":encodeURIComponent(key)))}}return ret.join("&")}function set(obj,key,val){var v=obj[key];if(Object.getOwnPropertyDescriptor(Object.prototype,key))return;if(undefined===v){obj[key]=val}else if(isArray(v)){v.push(val)}else{obj[key]=[v,val]}}function lastBraceInKey(str){var len=str.length,brace,c;for(var i=0;i<len;++i){c=str[i];if("]"==c)brace=false;if("["==c)brace=true;if("="==c&&!brace)return i}}function decode(str){try{return decodeURIComponent(str.replace(/\+/g," "))}catch(err){return str}}},{}],47:[function(require,module,exports){(function(process,Buffer){var optional=require("./lib/optional"),http=require("http"),https=optional("https"),tls=optional("tls"),url=require("url"),util=require("util"),stream=require("stream"),qs=require("qs"),querystring=require("querystring"),crypto=require("crypto"),oauth=optional("oauth-sign"),hawk=optional("hawk"),aws=optional("aws-sign2"),httpSignature=optional("http-signature"),uuid=require("node-uuid"),mime=require("mime"),tunnel=optional("tunnel-agent"),_safeStringify=require("json-stringify-safe"),ForeverAgent=require("forever-agent"),FormData=optional("form-data"),cookies=require("./lib/cookies"),globalCookieJar=cookies.jar(),copy=require("./lib/copy"),debug=require("./lib/debug"),getSafe=require("./lib/getSafe"),net=require("net");function safeStringify(obj){var ret;try{ret=JSON.stringify(obj)}catch(e){ret=_safeStringify(obj)}return ret}var globalPool={};var isUrl=/^https?:|^unix:/;if(https&&!https.Agent){https.Agent=function(options){http.Agent.call(this,options)};util.inherits(https.Agent,http.Agent);https.Agent.prototype._getConnection=function(host,port,cb){var s=tls.connect(port,host,this.options,function(){if(cb)cb()});return s}}function isReadStream(rs){return rs.readable&&rs.path&&rs.mode}function toBase64(str){return new Buffer(str||"","ascii").toString("base64")}function md5(str){return crypto.createHash("md5").update(str).digest("hex")}function Request(options){stream.Stream.call(this);this.readable=true;this.writable=true;if(typeof options==="string"){options={uri:options}}var reserved=Object.keys(Request.prototype);for(var i in options){if(reserved.indexOf(i)===-1){this[i]=options[i]}else{if(typeof options[i]==="function"){delete options[i]}}}if(options.method){this.explicitMethod=true}this.canTunnel=options.tunnel!==false&&tunnel;this.init(options)}util.inherits(Request,stream.Stream);Request.prototype.init=function(options){var self=this;if(!options)options={};if(!self.method)self.method=options.method||"GET";self.localAddress=options.localAddress;debug(options);if(!self.pool&&self.pool!==false)self.pool=globalPool;self.dests=self.dests||[];self.__isRequestRequest=true;if(!self._callback&&self.callback){self._callback=self.callback;self.callback=function(){if(self._callbackCalled)return;self._callbackCalled=true;self._callback.apply(self,arguments)};self.on("error",self.callback.bind());self.on("complete",self.callback.bind(self,null))}if(self.url&&!self.uri){self.uri=self.url;delete self.url}if(!self.uri){return self.emit("error",new Error("options.uri is a required argument"))}else{if(typeof self.uri=="string")self.uri=url.parse(self.uri)}if(self.strictSSL===false){self.rejectUnauthorized=false}if(self.proxy){if(typeof self.proxy=="string")self.proxy=url.parse(self.proxy);if(http.globalAgent&&self.uri.protocol==="https:"&&self.canTunnel){var tunnelFn=self.proxy.protocol==="http:"?tunnel.httpsOverHttp:tunnel.httpsOverHttps;var tunnelOptions={proxy:{host:self.proxy.hostname,port:+self.proxy.port,proxyAuth:self.proxy.auth,headers:{Host:self.uri.hostname+":"+(self.uri.port||self.uri.protocol==="https:"?443:80)}},rejectUnauthorized:self.rejectUnauthorized,ca:this.ca};self.agent=tunnelFn(tunnelOptions);self.tunnel=true}}if(!self.uri.pathname){self.uri.pathname="/"}if(!self.uri.host&&!self.protocol=="unix:"){var faultyUri=url.format(self.uri);var message='Invalid URI "'+faultyUri+'"';if(Object.keys(options).length===0){message+=". This can be caused by a crappy redirection."}self.emit("error",new Error(message));return}self._redirectsFollowed=self._redirectsFollowed||0;self.maxRedirects=self.maxRedirects!==undefined?self.maxRedirects:10;self.followRedirect=self.followRedirect!==undefined?self.followRedirect:true;self.followAllRedirects=self.followAllRedirects!==undefined?self.followAllRedirects:false;if(self.followRedirect||self.followAllRedirects)self.redirects=self.redirects||[];self.headers=self.headers?copy(self.headers):{};self.setHost=false;if(!self.hasHeader("host")){self.setHeader("host",self.uri.hostname);if(self.uri.port){if(!(self.uri.port===80&&self.uri.protocol==="http:")&&!(self.uri.port===443&&self.uri.protocol==="https:"))self.setHeader("host",self.getHeader("host")+(":"+self.uri.port))}self.setHost=true}self.jar(self._jar||options.jar);if(!self.uri.port){if(self.uri.protocol=="http:"){self.uri.port=80}else if(self.uri.protocol=="https:"){self.uri.port=443}}if(self.proxy&&!self.tunnel){self.port=self.proxy.port;self.host=self.proxy.hostname}else{self.port=self.uri.port;self.host=self.uri.hostname}self.clientErrorHandler=function(error){if(self._aborted)return;if(self.req&&self.req._reusedSocket&&error.code==="ECONNRESET"&&self.agent.addRequestNoreuse){self.agent={addRequest:self.agent.addRequestNoreuse.bind(self.agent)};self.start();self.req.end();return}if(self.timeout&&self.timeoutTimer){clearTimeout(self.timeoutTimer);self.timeoutTimer=null}self.emit("error",error)};self._parserErrorHandler=function(error){if(this.res){if(this.res.request){this.res.request.emit("error",error)}else{this.res.emit("error",error)}}else{this._httpMessage.emit("error",error)}};self._buildRequest=function(){var self=this;if(options.form){self.form(options.form)}if(options.qs)self.qs(options.qs);if(self.uri.path){self.path=self.uri.path}else{self.path=self.uri.pathname+(self.uri.search||"")}if(self.path.length===0)self.path="/";if(options.oauth){self.oauth(options.oauth)}if(options.aws){self.aws(options.aws)}if(options.hawk){self.hawk(options.hawk)}if(options.httpSignature){self.httpSignature(options.httpSignature)}if(options.auth){if(Object.prototype.hasOwnProperty.call(options.auth,"username"))options.auth.user=options.auth.username;if(Object.prototype.hasOwnProperty.call(options.auth,"password"))options.auth.pass=options.auth.password;self.auth(options.auth.user,options.auth.pass,options.auth.sendImmediately,options.auth.bearer)}if(self.uri.auth&&!self.hasHeader("authorization")){var authPieces=self.uri.auth.split(":").map(function(item){return querystring.unescape(item)});self.auth(authPieces[0],authPieces.slice(1).join(":"),true)}if(self.proxy&&self.proxy.auth&&!self.hasHeader("proxy-authorization")&&!self.tunnel){self.setHeader("proxy-authorization","Basic "+toBase64(self.proxy.auth.split(":").map(function(item){return querystring.unescape(item)}).join(":")))}if(self.proxy&&!self.tunnel)self.path=self.uri.protocol+"//"+self.uri.host+self.path;if(options.json){self.json(options.json)}else if(options.multipart){self.boundary=uuid();self.multipart(options.multipart)}if(self.body){var length=0;if(!Buffer.isBuffer(self.body)){if(Array.isArray(self.body)){for(var i=0;i<self.body.length;i++){length+=self.body[i].length}}else{self.body=new Buffer(self.body);length=self.body.length}}else{length=self.body.length}if(length){if(!self.hasHeader("content-length"))self.setHeader("content-length",length)}else{throw new Error("Argument error, options.body.")}}var protocol=self.proxy&&!self.tunnel?self.proxy.protocol:self.uri.protocol,defaultModules={"http:":http,"https:":https,"unix:":http},httpModules=self.httpModules||{};self.httpModule=httpModules[protocol]||defaultModules[protocol];if(!self.httpModule)return this.emit("error",new Error("Invalid protocol: "+protocol));if(options.ca)self.ca=options.ca;if(!self.agent){if(options.agentOptions)self.agentOptions=options.agentOptions;if(options.agentClass){self.agentClass=options.agentClass}else if(options.forever){self.agentClass=protocol==="http:"?ForeverAgent:ForeverAgent.SSL}else{self.agentClass=self.httpModule.Agent}}if(self.pool===false){self.agent=false}else{self.agent=self.agent||self.getAgent();if(self.maxSockets){self.agent.maxSockets=self.maxSockets}if(self.pool.maxSockets){self.agent.maxSockets=self.pool.maxSockets}}self.on("pipe",function(src){if(self.ntick&&self._started)throw new Error("You cannot pipe to this stream after the outbound request has started.");self.src=src;if(isReadStream(src)){if(!self.hasHeader("content-type"))self.setHeader("content-type",mime.lookup(src.path))}else{if(src.headers){for(var i in src.headers){if(!self.hasHeader(i)){self.setHeader(i,src.headers[i])}}}if(self._json&&!self.hasHeader("content-type"))self.setHeader("content-type","application/json");if(src.method&&!self.explicitMethod){self.method=src.method}}});process.nextTick(function(){if(self._aborted)return;if(self._form){self.setHeaders(self._form.getHeaders());try{var length=self._form.getLengthSync();self.setHeader("content-length",length)}catch(e){}self._form.pipe(self)}if(self.body){if(Array.isArray(self.body)){self.body.forEach(function(part){self.write(part)})}else{self.write(self.body)}self.end()}else if(self.requestBodyStream){console.warn("options.requestBodyStream is deprecated, please pass the request object to stream.pipe.");self.requestBodyStream.pipe(self)}else if(!self.src){if(self.method!=="GET"&&typeof self.method!=="undefined"){self.setHeader("content-length",0)}self.end()}self.ntick=true})};self._handleUnixSocketURI=function(self){self.unixsocket=true;var full_path=self.uri.href.replace(self.uri.protocol+"/","");var lookup=full_path.split("/");var error_connecting=true;var lookup_table={};do{lookup_table[lookup.join("/")]={}}while(lookup.pop());for(r in lookup_table){try_next(r)}function try_next(table_row){var client=net.connect(table_row);client.path=table_row;client.on("error",function(){lookup_table[this.path].error_connecting=true;this.end()});client.on("connect",function(){lookup_table[this.path].error_connecting=false;this.end()});table_row.client=client}wait_for_socket_response();response_counter=0;function wait_for_socket_response(){var detach;if("undefined"==typeof setImmediate)detach=process.nextTick;else detach=setImmediate;detach(function(){response_counter++;var trying=false;for(r in lookup_table){if("undefined"==typeof lookup_table[r].error_connecting)trying=true}if(trying&&response_counter<1e3)wait_for_socket_response();else set_socket_properties()})}function set_socket_properties(){var host;for(r in lookup_table){if(lookup_table[r].error_connecting===false){host=r}}if(!host){self.emit("error",new Error("Failed to connect to any socket in "+full_path))}var path=full_path.replace(host,"");self.socketPath=host;self.uri.pathname=path;self.uri.href=path;self.uri.path=path;self.host="";self.hostname="";delete self.host;delete self.hostname;self._buildRequest()}};if(/^unix:/.test(self.uri.protocol)){self._handleUnixSocketURI(self)}else{self._buildRequest()}};Request.prototype._updateProtocol=function(){var self=this;var protocol=self.uri.protocol;if(protocol==="https:"){if(self.proxy&&self.canTunnel){self.tunnel=true;var tunnelFn=self.proxy.protocol==="http:"?tunnel.httpsOverHttp:tunnel.httpsOverHttps;var tunnelOptions={proxy:{host:self.proxy.hostname,port:+self.proxy.port,proxyAuth:self.proxy.auth},rejectUnauthorized:self.rejectUnauthorized,ca:self.ca};self.agent=tunnelFn(tunnelOptions);return}self.httpModule=https;switch(self.agentClass){case ForeverAgent:self.agentClass=ForeverAgent.SSL;break;case http.Agent:self.agentClass=https.Agent;break;default:return}if(self.agent)self.agent=self.getAgent()}else{if(self.tunnel)self.tunnel=false;self.httpModule=http;switch(self.agentClass){case ForeverAgent.SSL:self.agentClass=ForeverAgent;break;case https.Agent:self.agentClass=http.Agent;break;default:return}if(self.agent){self.agent=null;self.agent=self.getAgent()}}};Request.prototype.getAgent=function(){var Agent=this.agentClass;var options={};if(this.agentOptions){for(var i in this.agentOptions){options[i]=this.agentOptions[i]}}if(this.ca)options.ca=this.ca;if(this.ciphers)options.ciphers=this.ciphers;if(this.secureProtocol)options.secureProtocol=this.secureProtocol;if(this.secureOptions)options.secureOptions=this.secureOptions;if(typeof this.rejectUnauthorized!=="undefined")options.rejectUnauthorized=this.rejectUnauthorized;if(this.cert&&this.key){options.key=this.key;options.cert=this.cert}var poolKey="";if(Agent!==this.httpModule.Agent){poolKey+=Agent.name}if(!this.httpModule.globalAgent){options.host=this.host;options.port=this.port;if(poolKey)poolKey+=":";poolKey+=this.host+":"+this.port}var proxy=this.proxy;if(typeof proxy==="string")proxy=url.parse(proxy);var isHttps=proxy&&proxy.protocol==="https:"||this.uri.protocol==="https:";if(isHttps){if(options.ca){if(poolKey)poolKey+=":";poolKey+=options.ca}if(typeof options.rejectUnauthorized!=="undefined"){if(poolKey)poolKey+=":";poolKey+=options.rejectUnauthorized}if(options.cert)poolKey+=options.cert.toString("ascii")+options.key.toString("ascii");if(options.ciphers){if(poolKey)poolKey+=":";poolKey+=options.ciphers}if(options.secureProtocol){if(poolKey)poolKey+=":";poolKey+=options.secureProtocol}}if(this.pool===globalPool&&!poolKey&&Object.keys(options).length===0&&this.httpModule.globalAgent){return this.httpModule.globalAgent}poolKey=this.uri.protocol+poolKey;if(this.pool[poolKey])return this.pool[poolKey];return this.pool[poolKey]=new Agent(options)};Request.prototype.start=function(){var self=this;if(self._aborted)return;self._started=true;self.method=self.method||"GET";self.href=self.uri.href;if(self.src&&self.src.stat&&self.src.stat.size&&!self.hasHeader("content-length")){self.setHeader("content-length",self.src.stat.size)}if(self._aws){self.aws(self._aws,true)}var reqOptions=copy(self);delete reqOptions.auth;debug("make request",self.uri.href);self.req=self.httpModule.request(reqOptions,self.onResponse.bind(self));if(self.timeout&&!self.timeoutTimer){self.timeoutTimer=setTimeout(function(){self.req.abort();var e=new Error("ETIMEDOUT");e.code="ETIMEDOUT";self.emit("error",e)},self.timeout);if(self.req.setTimeout){self.req.setTimeout(self.timeout,function(){if(self.req){self.req.abort();var e=new Error("ESOCKETTIMEDOUT");e.code="ESOCKETTIMEDOUT";self.emit("error",e)}})}}self.req.on("error",self.clientErrorHandler);self.req.on("drain",function(){self.emit("drain")});self.on("end",function(){if(self.req.connection)self.req.connection.removeListener("error",self._parserErrorHandler)});self.emit("request",self.req)};Request.prototype.onResponse=function(response){var self=this;debug("onResponse",self.uri.href,response.statusCode,response.headers);response.on("end",function(){debug("response end",self.uri.href,response.statusCode,response.headers)});if(response.connection.listeners("error").indexOf(self._parserErrorHandler)===-1){response.connection.once("error",self._parserErrorHandler)}if(self._aborted){debug("aborted",self.uri.href);response.resume();return}if(self._paused)response.pause();else response.resume();self.response=response;response.request=self;response.toJSON=toJSON;if(self.httpModule===https&&self.strictSSL&&!response.client.authorized){debug("strict ssl error",self.uri.href);var sslErr=response.client.authorizationError;self.emit("error",new Error("SSL Error: "+sslErr));return}if(self.setHost&&self.hasHeader("host"))delete self.headers[self.hasHeader("host")];if(self.timeout&&self.timeoutTimer){clearTimeout(self.timeoutTimer);self.timeoutTimer=null}var targetCookieJar=self._jar&&self._jar.setCookie?self._jar:globalCookieJar;var addCookie=function(cookie){try{targetCookieJar.setCookie(cookie,self.uri.href,{ignoreError:true})}catch(e){self.emit("error",e)}};if(hasHeader("set-cookie",response.headers)&&!self._disableCookies){var headerName=hasHeader("set-cookie",response.headers);if(Array.isArray(response.headers[headerName]))response.headers[headerName].forEach(addCookie);else addCookie(response.headers[headerName])}var redirectTo=null;if(response.statusCode>=300&&response.statusCode<400&&hasHeader("location",response.headers)){var location=response.headers[hasHeader("location",response.headers)];debug("redirect",location);if(self.followAllRedirects){redirectTo=location}else if(self.followRedirect){switch(self.method){case"PATCH":case"PUT":case"POST":case"DELETE":break;default:redirectTo=location;break}}}else if(response.statusCode==401&&self._hasAuth&&!self._sentAuth){var authHeader=response.headers[hasHeader("www-authenticate",response.headers)];var authVerb=authHeader&&authHeader.split(" ")[0].toLowerCase();debug("reauth",authVerb);switch(authVerb){case"basic":self.auth(self._user,self._pass,true);redirectTo=self.uri;break;case"bearer":self.auth(null,null,true,self._bearer);redirectTo=self.uri;break;case"digest":var challenge={};var re=/([a-z0-9_-]+)=(?:"([^"]+)"|([a-z0-9_-]+))/gi;for(;;){var match=re.exec(authHeader);if(!match)break;challenge[match[1]]=match[2]||match[3]}var ha1=md5(self._user+":"+challenge.realm+":"+self._pass);var ha2=md5(self.method+":"+self.uri.path);var qop=/(^|,)\s*auth\s*($|,)/.test(challenge.qop)&&"auth";var nc=qop&&"00000001";var cnonce=qop&&uuid().replace(/-/g,"");var digestResponse=qop?md5(ha1+":"+challenge.nonce+":"+nc+":"+cnonce+":"+qop+":"+ha2):md5(ha1+":"+challenge.nonce+":"+ha2);var authValues={username:self._user,realm:challenge.realm,nonce:challenge.nonce,uri:self.uri.path,qop:qop,response:digestResponse,nc:nc,cnonce:cnonce,algorithm:challenge.algorithm,opaque:challenge.opaque};authHeader=[];for(var k in authValues){if(!authValues[k]){}else if(k==="qop"||k==="nc"||k==="algorithm"){authHeader.push(k+"="+authValues[k])}else{authHeader.push(k+'="'+authValues[k]+'"')}}authHeader="Digest "+authHeader.join(", ");self.setHeader("authorization",authHeader);self._sentAuth=true;redirectTo=self.uri;break}}if(redirectTo){debug("redirect to",redirectTo);if(self._paused)response.resume();if(self._redirectsFollowed>=self.maxRedirects){self.emit("error",new Error("Exceeded maxRedirects. Probably stuck in a redirect loop "+self.uri.href));return}self._redirectsFollowed+=1;if(!isUrl.test(redirectTo)){redirectTo=url.resolve(self.uri.href,redirectTo)}var uriPrev=self.uri;self.uri=url.parse(redirectTo);if(self.uri.protocol!==uriPrev.protocol){self._updateProtocol()}self.redirects.push({statusCode:response.statusCode,redirectUri:redirectTo});if(self.followAllRedirects&&response.statusCode!=401&&response.statusCode!=307)self.method="GET";delete self.src;delete self.req;delete self.agent;delete self._started;if(response.statusCode!=401&&response.statusCode!=307){delete self.body;delete self._form;if(self.headers){if(self.hasHeader("host"))delete self.headers[self.hasHeader("host")];if(self.hasHeader("content-type"))delete self.headers[self.hasHeader("content-type")];if(self.hasHeader("content-length"))delete self.headers[self.hasHeader("content-length")]}}self.emit("redirect");self.init();return}else{self._redirectsFollowed=self._redirectsFollowed||0;response.on("close",function(){if(!self._ended)self.response.emit("end")});if(self.encoding){if(self.dests.length!==0){console.error("Ignoring encoding parameter as this stream is being piped to another stream which makes the encoding option invalid.")}else{response.setEncoding(self.encoding)}}self.emit("response",response);self.dests.forEach(function(dest){self.pipeDest(dest)});response.on("data",function(chunk){self._destdata=true;self.emit("data",chunk)});response.on("end",function(chunk){self._ended=true;self.emit("end",chunk)});response.on("close",function(){self.emit("close")});if(self.callback){var buffer=[];var bodyLen=0;self.on("data",function(chunk){buffer.push(chunk);bodyLen+=chunk.length});self.on("end",function(){debug("end event",self.uri.href);if(self._aborted){debug("aborted",self.uri.href);return}if(buffer.length&&Buffer.isBuffer(buffer[0])){debug("has body",self.uri.href,bodyLen);var body=new Buffer(bodyLen);var i=0;buffer.forEach(function(chunk){chunk.copy(body,i,0,chunk.length);i+=chunk.length});if(self.encoding===null){response.body=body}else{response.body=body.toString(self.encoding)}}else if(buffer.length){if(self.encoding==="utf8"&&buffer[0].length>0&&buffer[0][0]===""){buffer[0]=buffer[0].substring(1)}response.body=buffer.join("")}if(self._json){try{response.body=JSON.parse(response.body)}catch(e){}}debug("emitting complete",self.uri.href);if(response.body==undefined&&!self._json){response.body=""}self.emit("complete",response,response.body)})}else{self.on("end",function(){if(self._aborted){debug("aborted",self.uri.href);return}self.emit("complete",response)})}}debug("finish init function",self.uri.href)};Request.prototype.abort=function(){this._aborted=true;if(this.req){this.req.abort()}else if(this.response){this.response.abort()}this.emit("abort")};Request.prototype.pipeDest=function(dest){var response=this.response;if(dest.headers&&!dest.headersSent){if(hasHeader("content-type",response.headers)){var ctname=hasHeader("content-type",response.headers);if(dest.setHeader)dest.setHeader(ctname,response.headers[ctname]);else dest.headers[ctname]=response.headers[ctname]}if(hasHeader("content-length",response.headers)){var clname=hasHeader("content-length",response.headers);if(dest.setHeader)dest.setHeader(clname,response.headers[clname]);else dest.headers[clname]=response.headers[clname]}}if(dest.setHeader&&!dest.headersSent){for(var i in response.headers){dest.setHeader(i,response.headers[i])}dest.statusCode=response.statusCode}if(this.pipefilter)this.pipefilter(response,dest)};Request.prototype.setHeader=function(name,value,clobber){if(clobber===undefined)clobber=true;if(clobber||!this.hasHeader(name))this.headers[name]=value;else this.headers[this.hasHeader(name)]+=","+value;return this};Request.prototype.setHeaders=function(headers){for(var i in headers){this.setHeader(i,headers[i])}return this};Request.prototype.hasHeader=function(header,headers){var headers=Object.keys(headers||this.headers),lheaders=headers.map(function(h){return h.toLowerCase()});header=header.toLowerCase();for(var i=0;i<lheaders.length;i++){if(lheaders[i]===header)return headers[i]}return false};var hasHeader=Request.prototype.hasHeader;Request.prototype.qs=function(q,clobber){var base;if(!clobber&&this.uri.query)base=qs.parse(this.uri.query);else base={};for(var i in q){base[i]=q[i]}if(qs.stringify(base)===""){return this}this.uri=url.parse(this.uri.href.split("?")[0]+"?"+qs.stringify(base));this.url=this.uri;this.path=this.uri.path;return this};Request.prototype.form=function(form){if(form){this.setHeader("content-type","application/x-www-form-urlencoded; charset=utf-8");this.body=qs.stringify(form).toString("utf8");return this}this._form=new FormData;return this._form};Request.prototype.multipart=function(multipart){var self=this;self.body=[];if(!self.hasHeader("content-type")){self.setHeader("content-type","multipart/related; boundary="+self.boundary)}else{var headerName=self.hasHeader("content-type");self.setHeader(headerName,self.headers[headerName].split(";")[0]+"; boundary="+self.boundary)}if(!multipart.forEach)throw new Error("Argument error, options.multipart.");if(self.preambleCRLF){self.body.push(new Buffer("\r\n"))}multipart.forEach(function(part){var body=part.body;if(body==null)throw Error("Body attribute missing in multipart.");delete part.body;var preamble="--"+self.boundary+"\r\n";Object.keys(part).forEach(function(key){preamble+=key+": "+part[key]+"\r\n"});preamble+="\r\n";self.body.push(new Buffer(preamble));self.body.push(new Buffer(body));self.body.push(new Buffer("\r\n"))});self.body.push(new Buffer("--"+self.boundary+"--"));return self};Request.prototype.json=function(val){var self=this;if(!self.hasHeader("accept"))self.setHeader("accept","application/json");this._json=true;if(typeof val==="boolean"){if(typeof this.body==="object"){this.body=safeStringify(this.body);if(!self.hasHeader("content-type"))self.setHeader("content-type","application/json")}}else{this.body=safeStringify(val);if(!self.hasHeader("content-type"))self.setHeader("content-type","application/json")}return this};Request.prototype.getHeader=function(name,headers){var result,re,match;if(!headers)headers=this.headers;Object.keys(headers).forEach(function(key){if(key.length!==name.length)return;re=new RegExp(name,"i");match=key.match(re);if(match)result=headers[key]});return result};var getHeader=Request.prototype.getHeader;Request.prototype.auth=function(user,pass,sendImmediately,bearer){if(bearer!==undefined){this._bearer=bearer;this._hasAuth=true;if(sendImmediately||typeof sendImmediately=="undefined"){if(typeof bearer==="function"){bearer=bearer()}this.setHeader("authorization","Bearer "+bearer);this._sentAuth=true}return this}if(typeof user!=="string"||pass!==undefined&&typeof pass!=="string"){throw new Error("auth() received invalid user or password")}this._user=user;this._pass=pass;this._hasAuth=true;var header=typeof pass!=="undefined"?user+":"+pass:user;if(sendImmediately||typeof sendImmediately=="undefined"){this.setHeader("authorization","Basic "+toBase64(header));this._sentAuth=true}return this};Request.prototype.aws=function(opts,now){if(!now){this._aws=opts;return this}var date=new Date;this.setHeader("date",date.toUTCString());var auth={key:opts.key,secret:opts.secret,verb:this.method.toUpperCase(),date:date,contentType:this.getHeader("content-type")||"",md5:this.getHeader("content-md5")||"",amazonHeaders:aws.canonicalizeHeaders(this.headers)};if(opts.bucket&&this.path){auth.resource="/"+opts.bucket+this.path}else if(opts.bucket&&!this.path){auth.resource="/"+opts.bucket}else if(!opts.bucket&&this.path){auth.resource=this.path}else if(!opts.bucket&&!this.path){auth.resource="/"}auth.resource=aws.canonicalizeResource(auth.resource);this.setHeader("authorization",aws.authorization(auth));return this};Request.prototype.httpSignature=function(opts){var req=this;httpSignature.signRequest({getHeader:function(header){return getHeader(header,req.headers)},setHeader:function(header,value){req.setHeader(header,value)},method:this.method,path:this.path},opts);debug("httpSignature authorization",this.getHeader("authorization"));return this};Request.prototype.hawk=function(opts){this.setHeader("Authorization",hawk.client.header(this.uri,this.method,opts).field)};Request.prototype.oauth=function(_oauth){var form;if(this.hasHeader("content-type")&&this.getHeader("content-type").slice(0,"application/x-www-form-urlencoded".length)==="application/x-www-form-urlencoded"){form=qs.parse(this.body)}if(this.uri.query){form=qs.parse(this.uri.query)}if(!form)form={};var oa={};for(var i in form)oa[i]=form[i];for(var i in _oauth)oa["oauth_"+i]=_oauth[i];if(!oa.oauth_version)oa.oauth_version="1.0";if(!oa.oauth_timestamp)oa.oauth_timestamp=Math.floor(Date.now()/1e3).toString();if(!oa.oauth_nonce)oa.oauth_nonce=uuid().replace(/-/g,"");oa.oauth_signature_method="HMAC-SHA1";var consumer_secret=oa.oauth_consumer_secret;delete oa.oauth_consumer_secret;var token_secret=oa.oauth_token_secret;delete oa.oauth_token_secret;var timestamp=oa.oauth_timestamp;var baseurl=this.uri.protocol+"//"+this.uri.host+this.uri.pathname;var signature=oauth.hmacsign(this.method,baseurl,oa,consumer_secret,token_secret);for(var i in form){if(i.slice(0,"oauth_")in _oauth){}else{delete oa["oauth_"+i];if(i!=="x_auth_mode")delete oa[i]}}oa.oauth_timestamp=timestamp;var authHeader="OAuth "+Object.keys(oa).sort().map(function(i){return i+'="'+oauth.rfc3986(oa[i])+'"'}).join(",");authHeader+=',oauth_signature="'+oauth.rfc3986(signature)+'"';this.setHeader("Authorization",authHeader);return this};Request.prototype.jar=function(jar){var cookies;if(this._redirectsFollowed===0){this.originalCookieHeader=this.getHeader("cookie")}if(!jar){cookies=false;this._disableCookies=true}else{var targetCookieJar=jar&&jar.getCookieString?jar:globalCookieJar;var urihref=this.uri.href;if(targetCookieJar){cookies=targetCookieJar.getCookieString(urihref)}}if(cookies&&cookies.length){if(this.originalCookieHeader){this.setHeader("cookie",this.originalCookieHeader+"; "+cookies)}else{this.setHeader("cookie",cookies)}}this._jar=jar;return this};Request.prototype.pipe=function(dest,opts){if(this.response){if(this._destdata){throw new Error("You cannot pipe after data has been emitted from the response.")}else if(this._ended){throw new Error("You cannot pipe after the response has been ended.")}else{stream.Stream.prototype.pipe.call(this,dest,opts);this.pipeDest(dest);return dest}}else{this.dests.push(dest);stream.Stream.prototype.pipe.call(this,dest,opts);return dest}};Request.prototype.write=function(){if(!this._started)this.start();return this.req.write.apply(this.req,arguments)};Request.prototype.end=function(chunk){if(chunk)this.write(chunk);if(!this._started)this.start();this.req.end()};Request.prototype.pause=function(){if(!this.response)this._paused=true;else this.response.pause.apply(this.response,arguments)};Request.prototype.resume=function(){if(!this.response)this._paused=false;else this.response.resume.apply(this.response,arguments)};Request.prototype.destroy=function(){if(!this._ended)this.end();else if(this.response)this.response.destroy()};function toJSON(){return getSafe(this,"__"+((1+Math.random())*65536|0).toString(16))}Request.prototype.toJSON=toJSON;module.exports=Request}).call(this,require("/home/admin/browserify-cdn/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"),require("buffer").Buffer)},{"./lib/cookies":37,"./lib/copy":38,"./lib/debug":39,"./lib/getSafe":40,"./lib/optional":41,"/home/admin/browserify-cdn/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":18,buffer:2,crypto:6,"forever-agent":42,http:12,"json-stringify-safe":43,mime:44,net:1,"node-uuid":45,qs:46,querystring:23,stream:25,url:32,util:34}]},{},[]);var request=require("request");var searches=[{url:"http://musicbrainz.tranquilbase.org/ws/2/release-group?query="+"test",type:"album"},{url:"http://musicbrainz.tranquilbase.org/ws/2/artist?query="+"test",type:"artist"}];searches.map(function(search){request(search.url+"&fmt=json&limit=5",function(error,response,body){if(!error&&response.statusCode==200){if(search.type==="artist"){return JSON.parse(body).artist}else if(search.type==="album"){return JSON.parse(body)["release-groups"]}}})}).reduce(function(last,now){return last.concat(now)}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "requirebin-sketch", | |
"version": "1.0.0", | |
"dependencies": { | |
"request": "2.36.0" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style type='text/css'>html, body { margin: 0; padding: 0; border: 0; } | |
body, html { height: 100%; width: 100%; }</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment