UNPKG

minimal-slp-wallet

Version:
1 lines 1.4 MB
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).SlpWallet=t()}}((function(){for(var define,module,exports,createModuleFactory=function(t){var e;return function(r){return e||t(e={exports:{},parent:r},e.exports),e.exports}},_$defaults_172=createModuleFactory((function(t,e){(function(e){(function(){"use strict";var r={"Content-Type":"application/x-www-form-urlencoded"};function i(t,e){!_$utils_185.isUndefined(t)&&_$utils_185.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var n,o={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||void 0!==e&&"[object process]"===Object.prototype.toString.call(e))&&(n=_$xhr_158({})),n),transformRequest:[function(t,e){return _$normalizeHeaderName_181(e,"Accept"),_$normalizeHeaderName_181(e,"Content-Type"),_$utils_185.isFormData(t)||_$utils_185.isArrayBuffer(t)||_$utils_185.isBuffer(t)||_$utils_185.isStream(t)||_$utils_185.isFile(t)||_$utils_185.isBlob(t)?t:_$utils_185.isArrayBufferView(t)?t.buffer:_$utils_185.isURLSearchParams(t)?(i(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):_$utils_185.isObject(t)||e&&"application/json"===e["Content-Type"]?(i(e,"application/json"),function(t,e,r){if(_$utils_185.isString(t))try{return(0,JSON.parse)(t),_$utils_185.trim(t)}catch(i){if("SyntaxError"!==i.name)throw i}return(0,JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){var e=this.transitional||o.transitional,r=e&&e.silentJSONParsing,i=e&&e.forcedJSONParsing,n=!r&&"json"===this.responseType;if(n||i&&_$utils_185.isString(t)&&t.length)try{return JSON.parse(t)}catch(a){if(n){if("SyntaxError"===a.name)throw _$enhanceError_168(a,this,"E_JSON_PARSE");throw a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};_$utils_185.forEach(["delete","get","head"],(function(t){o.headers[t]={}})),_$utils_185.forEach(["post","put","patch"],(function(t){o.headers[t]=_$utils_185.merge(r)})),t.exports=o}).call(this)}).call(this,_$browser_401)})),_$xhr_158=createModuleFactory((function(t,e){"use strict";var r=_$defaults_172({});t.exports=function(t){return new Promise((function(e,i){var n,o=t.data,a=t.headers,s=t.responseType;function u(){t.cancelToken&&t.cancelToken.unsubscribe(n),t.signal&&t.signal.removeEventListener("abort",n)}_$utils_185.isFormData(o)&&delete a["Content-Type"];var h=new XMLHttpRequest;if(t.auth){var f=t.auth.username||"",c=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";a.Authorization="Basic "+btoa(f+":"+c)}var l=_$buildFullPath_165(t.baseURL,t.url);function d(){if(h){var r="getAllResponseHeaders"in h?_$parseHeaders_182(h.getAllResponseHeaders()):null,n={data:s&&"text"!==s&&"json"!==s?h.response:h.responseText,status:h.status,statusText:h.statusText,headers:r,config:t,request:h};_$settle_170((function(t){e(t),u()}),(function(t){i(t),u()}),n),h=null}}if(h.open(t.method.toUpperCase(),_$buildURL_175(l,t.params,t.paramsSerializer),!0),h.timeout=t.timeout,"onloadend"in h?h.onloadend=d:h.onreadystatechange=function(){h&&4===h.readyState&&(0!==h.status||h.responseURL&&0===h.responseURL.indexOf("file:"))&&setTimeout(d)},h.onabort=function(){h&&(i(_$createError_166("Request aborted",t,"ECONNABORTED",h)),h=null)},h.onerror=function(){i(_$createError_166("Network Error",t,null,h)),h=null},h.ontimeout=function(){var e=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",n=t.transitional||r.transitional;t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),i(_$createError_166(e,t,n.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",h)),h=null},_$utils_185.isStandardBrowserEnv()){var p=(t.withCredentials||_$isURLSameOrigin_180(l))&&t.xsrfCookieName?_$cookies_177.read(t.xsrfCookieName):void 0;p&&(a[t.xsrfHeaderName]=p)}"setRequestHeader"in h&&_$utils_185.forEach(a,(function(t,e){void 0===o&&"content-type"===e.toLowerCase()?delete a[e]:h.setRequestHeader(e,t)})),_$utils_185.isUndefined(t.withCredentials)||(h.withCredentials=!!t.withCredentials),s&&"json"!==s&&(h.responseType=t.responseType),"function"==typeof t.onDownloadProgress&&h.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&h.upload&&h.upload.addEventListener("progress",t.onUploadProgress),(t.cancelToken||t.signal)&&(n=function(t){h&&(i(!t||t&&t.type?new _$Cancel_160("canceled"):t),h.abort(),h=null)},t.cancelToken&&t.cancelToken.subscribe(n),t.signal&&(t.signal.aborted?n():t.signal.addEventListener("abort",n))),o||(o=null),h.send(o)}))}})),_$cryptoBrowserify_266=createModuleFactory((function(t,e){"use strict";e.randomBytes=e.rng=e.pseudoRandomBytes=e.prng=_$browser_415,e.createHash=e.Hash=_$browser_262,e.createHmac=e.Hmac=_$browser_264;var r=Object.keys(_$algos_238),i=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(r);e.getHashes=function(){return i},e.pbkdf2=_$browser_394.pbkdf2,e.pbkdf2Sync=_$browser_394.pbkdf2Sync,e.Cipher=_$browser_234.Cipher,e.createCipher=_$browser_234.createCipher,e.Cipheriv=_$browser_234.Cipheriv,e.createCipheriv=_$browser_234.createCipheriv,e.Decipher=_$browser_234.Decipher,e.createDecipher=_$browser_234.createDecipher,e.Decipheriv=_$browser_234.Decipheriv,e.createDecipheriv=_$browser_234.createDecipheriv,e.getCiphers=_$browser_234.getCiphers,e.listCiphers=_$browser_234.listCiphers,e.DiffieHellmanGroup=_$browser_308.DiffieHellmanGroup,e.createDiffieHellmanGroup=_$browser_308.createDiffieHellmanGroup,e.getDiffieHellman=_$browser_308.getDiffieHellman,e.createDiffieHellman=_$browser_308.createDiffieHellman,e.DiffieHellman=_$browser_308.DiffieHellman,e.createSign=_$browser_241.createSign,e.Sign=_$browser_241.Sign,e.createVerify=_$browser_241.createVerify,e.Verify=_$browser_241.Verify,e.createECDH=_$browser_260,e.publicEncrypt=_$browser_402.publicEncrypt,e.privateEncrypt=_$browser_402.privateEncrypt,e.publicDecrypt=_$browser_402.publicDecrypt,e.privateDecrypt=_$browser_402.privateDecrypt,e.randomFill=_$browser_416.randomFill,e.randomFillSync=_$browser_416.randomFillSync,e.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join("\n"))},e.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}})),_$asn1_105=createModuleFactory((function(t,e){var r=e;r.bignum=_$bn_119,r.define=_$api_106({}).define,r.base=_$base_108({}),r.constants=_$constants_112({}),r.decoders=_$decoders_114({}),r.encoders=_$encoders_117({})})),_$encoders_117=createModuleFactory((function(t,e){var r=e;r.der=_$der_116({}),r.pem=_$pem_118({})})),_$pem_118=createModuleFactory((function(t,e){var r=_$der_116({});function i(t){r.call(this,t),this.enc="pem"}_$inherits_browser_375(i,r),t.exports=i,i.prototype.encode=function(t,e){for(var i=r.prototype.encode.call(this,t).toString("base64"),n=["-----BEGIN "+e.label+"-----"],o=0;o<i.length;o+=64)n.push(i.slice(o,o+64));return n.push("-----END "+e.label+"-----"),n.join("\n")}})),_$der_116=createModuleFactory((function(t,e){var r=_$buffer_251({}).Buffer,i=_$asn1_105({}),n=i.base,o=i.constants.der;function a(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new s,this.tree._init(t.body)}function s(t){n.Node.call(this,"der",t)}function u(t){return t<10?"0"+t:t}t.exports=a,a.prototype.encode=function(t,e){return this.tree._encode(t,e).join()},_$inherits_browser_375(s,n.Node),s.prototype._encodeComposite=function(t,e,i,n){var a,s=function(t,e,r,i){var n;if("seqof"===t?t="seq":"setof"===t&&(t="set"),o.tagByName.hasOwnProperty(t))n=o.tagByName[t];else{if("number"!=typeof t||(0|t)!==t)return i.error("Unknown tag: "+t);n=t}return n>=31?i.error("Multi-octet tag encoding unsupported"):(e||(n|=32),n|o.tagClassByName[r||"universal"]<<6)}(t,e,i,this.reporter);if(n.length<128)return(a=new r(2))[0]=s,a[1]=n.length,this._createEncoderBuffer([a,n]);for(var u=1,h=n.length;h>=256;h>>=8)u++;(a=new r(2+u))[0]=s,a[1]=128|u,h=1+u;for(var f=n.length;f>0;h--,f>>=8)a[h]=255&f;return this._createEncoderBuffer([a,n])},s.prototype._encodeStr=function(t,e){if("bitstr"===e)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===e){for(var i=new r(2*t.length),n=0;n<t.length;n++)i.writeUInt16BE(t.charCodeAt(n),2*n);return this._createEncoderBuffer(i)}return"numstr"===e?this._isNumstr(t)?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===e?this._isPrintstr(t)?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(e)||"objDesc"===e?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: "+e+" unsupported")},s.prototype._encodeObjid=function(t,e,i){if("string"==typeof t){if(!e)return this.reporter.error("string objid given, but no values map found");if(!e.hasOwnProperty(t))return this.reporter.error("objid not found in values map");t=e[t].split(/[\s\.]+/g);for(var n=0;n<t.length;n++)t[n]|=0}else if(Array.isArray(t))for(t=t.slice(),n=0;n<t.length;n++)t[n]|=0;if(!Array.isArray(t))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(t));if(!i){if(t[1]>=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}var o=0;for(n=0;n<t.length;n++){var a=t[n];for(o++;a>=128;a>>=7)o++}var s=new r(o),u=s.length-1;for(n=t.length-1;n>=0;n--)for(a=t[n],s[u--]=127&a;(a>>=7)>0;)s[u--]=128|127&a;return this._createEncoderBuffer(s)},s.prototype._encodeTime=function(t,e){var r,i=new Date(t);return"gentime"===e?r=[u(i.getFullYear()),u(i.getUTCMonth()+1),u(i.getUTCDate()),u(i.getUTCHours()),u(i.getUTCMinutes()),u(i.getUTCSeconds()),"Z"].join(""):"utctime"===e?r=[u(i.getFullYear()%100),u(i.getUTCMonth()+1),u(i.getUTCDate()),u(i.getUTCHours()),u(i.getUTCMinutes()),u(i.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+e+" time is not supported yet"),this._encodeStr(r,"octstr")},s.prototype._encodeNull=function(){return this._createEncoderBuffer("")},s.prototype._encodeInt=function(t,e){if("string"==typeof t){if(!e)return this.reporter.error("String int or enum given, but no values map");if(!e.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=e[t]}if("number"!=typeof t&&!r.isBuffer(t)){var i=t.toArray();!t.sign&&128&i[0]&&i.unshift(0),t=new r(i)}if(r.isBuffer(t)){var n=t.length;0===t.length&&n++;var o=new r(n);return t.copy(o),0===t.length&&(o[0]=0),this._createEncoderBuffer(o)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);n=1;for(var a=t;a>=256;a>>=8)n++;for(a=(o=new Array(n)).length-1;a>=0;a--)o[a]=255&t,t>>=8;return 128&o[0]&&o.unshift(0),this._createEncoderBuffer(new r(o))},s.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)},s.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getEncoder("der").tree},s.prototype._skipDefault=function(t,e,r){var i,n=this._baseState;if(null===n.default)return!1;var o=t.join();if(void 0===n.defaultBuffer&&(n.defaultBuffer=this._encodeValue(n.default,e,r).join()),o.length!==n.defaultBuffer.length)return!1;for(i=0;i<o.length;i++)if(o[i]!==n.defaultBuffer[i])return!1;return!0}})),_$decoders_114=createModuleFactory((function(t,e){var r=e;r.der=_$der_113({}),r.pem=_$pem_115({})})),_$pem_115=createModuleFactory((function(t,e){var r=_$buffer_251({}).Buffer,i=_$der_113({});function n(t){i.call(this,t),this.enc="pem"}_$inherits_browser_375(n,i),t.exports=n,n.prototype.decode=function(t,e){for(var n=t.toString().split(/[\r\n]+/g),o=e.label.toUpperCase(),a=/^-----(BEGIN|END) ([^-]+)-----$/,s=-1,u=-1,h=0;h<n.length;h++){var f=n[h].match(a);if(null!==f&&f[2]===o){if(-1!==s){if("END"!==f[1])break;u=h;break}if("BEGIN"!==f[1])break;s=h}}if(-1===s||-1===u)throw new Error("PEM section not found for: "+o);var c=n.slice(s+1,u).join("");c.replace(/[^a-z0-9\+\/=]+/gi,"");var l=new r(c,"base64");return i.prototype.decode.call(this,l,e)}})),_$der_113=createModuleFactory((function(t,e){var r=_$asn1_105({}),i=r.base,n=r.bignum,o=r.constants.der;function a(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new s,this.tree._init(t.body)}function s(t){i.Node.call(this,"der",t)}function u(t,e){var r=t.readUInt8(e);if(t.isError(r))return r;var i=o.tagClass[r>>6],n=0==(32&r);if(31==(31&r)){var a=r;for(r=0;128==(128&a);){if(a=t.readUInt8(e),t.isError(a))return a;r<<=7,r|=127&a}}else r&=31;return{cls:i,primitive:n,tag:r,tagStr:o.tag[r]}}function h(t,e,r){var i=t.readUInt8(r);if(t.isError(i))return i;if(!e&&128===i)return null;if(0==(128&i))return i;var n=127&i;if(n>4)return t.error("length octect is too long");i=0;for(var o=0;o<n;o++){i<<=8;var a=t.readUInt8(r);if(t.isError(a))return a;i|=a}return i}t.exports=a,a.prototype.decode=function(t,e){return t instanceof i.DecoderBuffer||(t=new i.DecoderBuffer(t,e)),this.tree._decode(t,e)},_$inherits_browser_375(s,i.Node),s.prototype._peekTag=function(t,e,r){if(t.isEmpty())return!1;var i=t.save(),n=u(t,'Failed to peek tag: "'+e+'"');return t.isError(n)?n:(t.restore(i),n.tag===e||n.tagStr===e||n.tagStr+"of"===e||r)},s.prototype._decodeTag=function(t,e,r){var i=u(t,'Failed to decode tag of "'+e+'"');if(t.isError(i))return i;var n=h(t,i.primitive,'Failed to get length of "'+e+'"');if(t.isError(n))return n;if(!r&&i.tag!==e&&i.tagStr!==e&&i.tagStr+"of"!==e)return t.error('Failed to match tag: "'+e+'"');if(i.primitive||null!==n)return t.skip(n,'Failed to match body of: "'+e+'"');var o=t.save(),a=this._skipUntilEnd(t,'Failed to skip indefinite length body: "'+this.tag+'"');return t.isError(a)?a:(n=t.offset-o.offset,t.restore(o),t.skip(n,'Failed to match body of: "'+e+'"'))},s.prototype._skipUntilEnd=function(t,e){for(;;){var r=u(t,e);if(t.isError(r))return r;var i,n=h(t,r.primitive,e);if(t.isError(n))return n;if(i=r.primitive||null!==n?t.skip(n):this._skipUntilEnd(t,e),t.isError(i))return i;if("end"===r.tagStr)break}},s.prototype._decodeList=function(t,e,r,i){for(var n=[];!t.isEmpty();){var o=this._peekTag(t,"end");if(t.isError(o))return o;var a=r.decode(t,"der",i);if(t.isError(a)&&o)break;n.push(a)}return n},s.prototype._decodeStr=function(t,e){if("bitstr"===e){var r=t.readUInt8();return t.isError(r)?r:{unused:r,data:t.raw()}}if("bmpstr"===e){var i=t.raw();if(i.length%2==1)return t.error("Decoding of string type: bmpstr length mismatch");for(var n="",o=0;o<i.length/2;o++)n+=String.fromCharCode(i.readUInt16BE(2*o));return n}if("numstr"===e){var a=t.raw().toString("ascii");return this._isNumstr(a)?a:t.error("Decoding of string type: numstr unsupported characters")}if("octstr"===e)return t.raw();if("objDesc"===e)return t.raw();if("printstr"===e){var s=t.raw().toString("ascii");return this._isPrintstr(s)?s:t.error("Decoding of string type: printstr unsupported characters")}return/str$/.test(e)?t.raw().toString():t.error("Decoding of string type: "+e+" unsupported")},s.prototype._decodeObjid=function(t,e,r){for(var i,n=[],o=0;!t.isEmpty();){var a=t.readUInt8();o<<=7,o|=127&a,0==(128&a)&&(n.push(o),o=0)}128&a&&n.push(o);var s=n[0]/40|0,u=n[0]%40;if(i=r?n:[s,u].concat(n.slice(1)),e){var h=e[i.join(" ")];void 0===h&&(h=e[i.join(".")]),void 0!==h&&(i=h)}return i},s.prototype._decodeTime=function(t,e){var r=t.raw().toString();if("gentime"===e)var i=0|r.slice(0,4),n=0|r.slice(4,6),o=0|r.slice(6,8),a=0|r.slice(8,10),s=0|r.slice(10,12),u=0|r.slice(12,14);else{if("utctime"!==e)return t.error("Decoding "+e+" time is not supported yet");i=0|r.slice(0,2),n=0|r.slice(2,4),o=0|r.slice(4,6),a=0|r.slice(6,8),s=0|r.slice(8,10),u=0|r.slice(10,12),i=i<70?2e3+i:1900+i}return Date.UTC(i,n-1,o,a,s,u,0)},s.prototype._decodeNull=function(t){return null},s.prototype._decodeBool=function(t){var e=t.readUInt8();return t.isError(e)?e:0!==e},s.prototype._decodeInt=function(t,e){var r=t.raw(),i=new n(r);return e&&(i=e[i.toString(10)]||i),i},s.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getDecoder("der").tree}})),_$constants_112=createModuleFactory((function(t,e){var r=e;r._reverse=function(t){var e={};return Object.keys(t).forEach((function(r){(0|r)==r&&(r|=0);var i=t[r];e[i]=r})),e},r.der=_$der_111({})})),_$der_111=createModuleFactory((function(t,e){var r=_$constants_112({});e.tagClass={0:"universal",1:"application",2:"context",3:"private"},e.tagClassByName=r._reverse(e.tagClass),e.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},e.tagByName=r._reverse(e.tag)})),_$base_108=createModuleFactory((function(t,e){var r=e;r.Reporter=_$reporter_110.Reporter,r.DecoderBuffer=_$buffer_107({}).DecoderBuffer,r.EncoderBuffer=_$buffer_107({}).EncoderBuffer,r.Node=_$Node_109({})})),_$Node_109=createModuleFactory((function(t,e){var r=_$base_108({}).Reporter,i=_$base_108({}).EncoderBuffer,n=_$base_108({}).DecoderBuffer,o=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],a=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(o);function s(t,e){var r={};this._baseState=r,r.enc=t,r.parent=e||null,r.children=null,r.tag=null,r.args=null,r.reverseArgs=null,r.choice=null,r.optional=!1,r.any=!1,r.obj=!1,r.use=null,r.useDecoder=null,r.key=null,r.default=null,r.explicit=null,r.implicit=null,r.contains=null,r.parent||(r.children=[],this._wrap())}t.exports=s;var u=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];s.prototype.clone=function(){var t=this._baseState,e={};u.forEach((function(r){e[r]=t[r]}));var r=new this.constructor(e.parent);return r._baseState=e,r},s.prototype._wrap=function(){var t=this._baseState;a.forEach((function(e){this[e]=function(){var r=new this.constructor(this);return t.children.push(r),r[e].apply(r,arguments)}}),this)},s.prototype._init=function(t){var e=this._baseState;t.call(this),e.children=e.children.filter((function(t){return t._baseState.parent===this}),this)},s.prototype._useArgs=function(t){var e=this._baseState,r=t.filter((function(t){return t instanceof this.constructor}),this);t=t.filter((function(t){return!(t instanceof this.constructor)}),this),0!==r.length&&(e.children=r,r.forEach((function(t){t._baseState.parent=this}),this)),0!==t.length&&(e.args=t,e.reverseArgs=t.map((function(t){if("object"!=typeof t||t.constructor!==Object)return t;var e={};return Object.keys(t).forEach((function(r){r==(0|r)&&(r|=0);var i=t[r];e[i]=r})),e})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(t){s.prototype[t]=function(){var e=this._baseState;throw new Error(t+" not implemented for encoding: "+e.enc)}})),o.forEach((function(t){s.prototype[t]=function(){var e=this._baseState,r=Array.prototype.slice.call(arguments);return e.tag=t,this._useArgs(r),this}})),s.prototype.use=function(t){return this._baseState.use=t,this},s.prototype.optional=function(){return this._baseState.optional=!0,this},s.prototype.def=function(t){var e=this._baseState;return e.default=t,e.optional=!0,this},s.prototype.explicit=function(t){return this._baseState.explicit=t,this},s.prototype.implicit=function(t){return this._baseState.implicit=t,this},s.prototype.obj=function(){var t=this._baseState,e=Array.prototype.slice.call(arguments);return t.obj=!0,0!==e.length&&this._useArgs(e),this},s.prototype.key=function(t){return this._baseState.key=t,this},s.prototype.any=function(){return this._baseState.any=!0,this},s.prototype.choice=function(t){return this._baseState.choice=t,this._useArgs(Object.keys(t).map((function(e){return t[e]}))),this},s.prototype.contains=function(t){return this._baseState.contains=t,this},s.prototype._decode=function(t,e){var r=this._baseState;if(null===r.parent)return t.wrapResult(r.children[0]._decode(t,e));var i,o=r.default,a=!0,s=null;if(null!==r.key&&(s=t.enterKey(r.key)),r.optional){var u=null;if(null!==r.explicit?u=r.explicit:null!==r.implicit?u=r.implicit:null!==r.tag&&(u=r.tag),null!==u||r.any){if(a=this._peekTag(t,u,r.any),t.isError(a))return a}else{var h=t.save();try{null===r.choice?this._decodeGeneric(r.tag,t,e):this._decodeChoice(t,e),a=!0}catch(p){a=!1}t.restore(h)}}if(r.obj&&a&&(i=t.enterObject()),a){if(null!==r.explicit){var f=this._decodeTag(t,r.explicit);if(t.isError(f))return f;t=f}var c=t.offset;if(null===r.use&&null===r.choice){r.any&&(h=t.save());var l=this._decodeTag(t,null!==r.implicit?r.implicit:r.tag,r.any);if(t.isError(l))return l;r.any?o=t.raw(h):t=l}if(e&&e.track&&null!==r.tag&&e.track(t.path(),c,t.length,"tagged"),e&&e.track&&null!==r.tag&&e.track(t.path(),t.offset,t.length,"content"),o=r.any?o:null===r.choice?this._decodeGeneric(r.tag,t,e):this._decodeChoice(t,e),t.isError(o))return o;if(r.any||null!==r.choice||null===r.children||r.children.forEach((function(r){r._decode(t,e)})),r.contains&&("octstr"===r.tag||"bitstr"===r.tag)){var d=new n(o);o=this._getUse(r.contains,t._reporterState.obj)._decode(d,e)}}return r.obj&&a&&(o=t.leaveObject(i)),null===r.key||null===o&&!0!==a?null!==s&&t.exitKey(s):t.leaveKey(s,r.key,o),o},s.prototype._decodeGeneric=function(t,e,r){var i=this._baseState;return"seq"===t||"set"===t?null:"seqof"===t||"setof"===t?this._decodeList(e,t,i.args[0],r):/str$/.test(t)?this._decodeStr(e,t,r):"objid"===t&&i.args?this._decodeObjid(e,i.args[0],i.args[1],r):"objid"===t?this._decodeObjid(e,null,null,r):"gentime"===t||"utctime"===t?this._decodeTime(e,t,r):"null_"===t?this._decodeNull(e,r):"bool"===t?this._decodeBool(e,r):"objDesc"===t?this._decodeStr(e,t,r):"int"===t||"enum"===t?this._decodeInt(e,i.args&&i.args[0],r):null!==i.use?this._getUse(i.use,e._reporterState.obj)._decode(e,r):e.error("unknown tag: "+t)},s.prototype._getUse=function(t,e){var r=this._baseState;return r.useDecoder=this._use(t,e),r.useDecoder=r.useDecoder._baseState.children[0],r.implicit!==r.useDecoder._baseState.implicit&&(r.useDecoder=r.useDecoder.clone(),r.useDecoder._baseState.implicit=r.implicit),r.useDecoder},s.prototype._decodeChoice=function(t,e){var r=this._baseState,i=null,n=!1;return Object.keys(r.choice).some((function(o){var a=t.save(),s=r.choice[o];try{var u=s._decode(t,e);if(t.isError(u))return!1;i={type:o,value:u},n=!0}catch(h){return t.restore(a),!1}return!0}),this),n?i:t.error("Choice not matched")},s.prototype._createEncoderBuffer=function(t){return new i(t,this.reporter)},s.prototype._encode=function(t,e,r){var i=this._baseState;if(null===i.default||i.default!==t){var n=this._encodeValue(t,e,r);if(void 0!==n&&!this._skipDefault(n,e,r))return n}},s.prototype._encodeValue=function(t,e,i){var n=this._baseState;if(null===n.parent)return n.children[0]._encode(t,e||new r);var o=null;if(this.reporter=e,n.optional&&void 0===t){if(null===n.default)return;t=n.default}var a=null,s=!1;if(n.any)o=this._createEncoderBuffer(t);else if(n.choice)o=this._encodeChoice(t,e);else if(n.contains)a=this._getUse(n.contains,i)._encode(t,e),s=!0;else if(n.children)a=n.children.map((function(r){if("null_"===r._baseState.tag)return r._encode(null,e,t);if(null===r._baseState.key)return e.error("Child should have a key");var i=e.enterKey(r._baseState.key);if("object"!=typeof t)return e.error("Child expected, but input is not object");var n=r._encode(t[r._baseState.key],e,t);return e.leaveKey(i),n}),this).filter((function(t){return t})),a=this._createEncoderBuffer(a);else if("seqof"===n.tag||"setof"===n.tag){if(!n.args||1!==n.args.length)return e.error("Too many args for : "+n.tag);if(!Array.isArray(t))return e.error("seqof/setof, but data is not Array");var u=this.clone();u._baseState.implicit=null,a=this._createEncoderBuffer(t.map((function(r){var i=this._baseState;return this._getUse(i.args[0],t)._encode(r,e)}),u))}else null!==n.use?o=this._getUse(n.use,i)._encode(t,e):(a=this._encodePrimitive(n.tag,t),s=!0);if(!n.any&&null===n.choice){var h=null!==n.implicit?n.implicit:n.tag,f=null===n.implicit?"universal":"context";null===h?null===n.use&&e.error("Tag could be omitted only for .use()"):null===n.use&&(o=this._encodeComposite(h,s,f,a))}return null!==n.explicit&&(o=this._encodeComposite(n.explicit,!1,"context",o)),o},s.prototype._encodeChoice=function(t,e){return this._baseState.choice[t.type]._encode(t.value,e)},s.prototype._encodePrimitive=function(t,e){var r=this._baseState;if(/str$/.test(t))return this._encodeStr(e,t);if("objid"===t&&r.args)return this._encodeObjid(e,r.reverseArgs[0],r.args[1]);if("objid"===t)return this._encodeObjid(e,null,null);if("gentime"===t||"utctime"===t)return this._encodeTime(e,t);if("null_"===t)return this._encodeNull();if("int"===t||"enum"===t)return this._encodeInt(e,r.args&&r.reverseArgs[0]);if("bool"===t)return this._encodeBool(e);if("objDesc"===t)return this._encodeStr(e,t);throw new Error("Unsupported tag: "+t)},s.prototype._isNumstr=function(t){return/^[0-9 ]*$/.test(t)},s.prototype._isPrintstr=function(t){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(t)}})),_$buffer_107=createModuleFactory((function(t,e){var r=_$base_108({}).Reporter,i=_$buffer_251({}).Buffer;function n(t,e){r.call(this,e),i.isBuffer(t)?(this.base=t,this.offset=0,this.length=t.length):this.error("Input not Buffer")}function o(t,e){if(Array.isArray(t))this.length=0,this.value=t.map((function(t){return t instanceof o||(t=new o(t,e)),this.length+=t.length,t}),this);else if("number"==typeof t){if(!(0<=t&&t<=255))return e.error("non-byte EncoderBuffer value");this.value=t,this.length=1}else if("string"==typeof t)this.value=t,this.length=i.byteLength(t);else{if(!i.isBuffer(t))return e.error("Unsupported type: "+typeof t);this.value=t,this.length=t.length}}_$inherits_browser_375(n,r),e.DecoderBuffer=n,n.prototype.save=function(){return{offset:this.offset,reporter:r.prototype.save.call(this)}},n.prototype.restore=function(t){var e=new n(this.base);return e.offset=t.offset,e.length=this.offset,this.offset=t.offset,r.prototype.restore.call(this,t.reporter),e},n.prototype.isEmpty=function(){return this.offset===this.length},n.prototype.readUInt8=function(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},n.prototype.skip=function(t,e){if(!(this.offset+t<=this.length))return this.error(e||"DecoderBuffer overrun");var r=new n(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+t,this.offset+=t,r},n.prototype.raw=function(t){return this.base.slice(t?t.offset:this.offset,this.length)},e.EncoderBuffer=o,o.prototype.join=function(t,e){return t||(t=new i(this.length)),e||(e=0),0===this.length||(Array.isArray(this.value)?this.value.forEach((function(r){r.join(t,e),e+=r.length})):("number"==typeof this.value?t[e]=this.value:"string"==typeof this.value?t.write(this.value,e):i.isBuffer(this.value)&&this.value.copy(t,e),e+=this.length)),t}})),_$api_106=createModuleFactory((function(t,e){var r=_$asn1_105({});function i(t,e){this.name=t,this.body=e,this.decoders={},this.encoders={}}e.define=function(t,e){return new i(t,e)},i.prototype._createNamed=function(t){var e;try{e=_$vmBrowserify_484({}).runInThisContext("(function "+this.name+"(entity) {\n this._initNamed(entity);\n})")}catch(r){e=function(t){this._initNamed(t)}}return _$inherits_browser_375(e,t),e.prototype._initNamed=function(e){t.call(this,e)},new e(this)},i.prototype._getDecoder=function(t){return t=t||"der",this.decoders.hasOwnProperty(t)||(this.decoders[t]=this._createNamed(r.decoders[t])),this.decoders[t]},i.prototype.decode=function(t,e,r){return this._getDecoder(e).decode(t,r)},i.prototype._getEncoder=function(t){return t=t||"der",this.encoders.hasOwnProperty(t)||(this.encoders[t]=this._createNamed(r.encoders[t])),this.encoders[t]},i.prototype.encode=function(t,e,r){return this._getEncoder(e).encode(t,r)}})),_$vmBrowserify_484=createModuleFactory((function(module,exports){var indexOf=function(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0;r<t.length;r++)if(t[r]===e)return r;return-1},Object_keys=function(t){if(Object.keys)return Object.keys(t);var e=[];for(var r in t)e.push(r);return e},forEach=function(t,e){if(t.forEach)return t.forEach(e);for(var r=0;r<t.length;r++)e(t[r],r,t)},defineProp=function(){try{return Object.defineProperty({},"_",{}),function(t,e,r){Object.defineProperty(t,e,{writable:!0,enumerable:!1,configurable:!0,value:r})}}catch(t){return function(t,e,r){t[e]=r}}}(),globals=["Array","Boolean","Date","Error","EvalError","Function","Infinity","JSON","Math","NaN","Number","Object","RangeError","ReferenceError","RegExp","String","SyntaxError","TypeError","URIError","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","eval","isFinite","isNaN","parseFloat","parseInt","undefined","unescape"];function Context(){}Context.prototype={};var Script=exports.Script=function(t){if(!(this instanceof Script))return new Script(t);this.code=t};Script.prototype.runInContext=function(t){if(!(t instanceof Context))throw new TypeError("needs a 'context' argument.");var e=document.createElement("iframe");e.style||(e.style={}),e.style.display="none",document.body.appendChild(e);var r=e.contentWindow,i=r.eval,n=r.execScript;!i&&n&&(n.call(r,"null"),i=r.eval),forEach(Object_keys(t),(function(e){r[e]=t[e]})),forEach(globals,(function(e){t[e]&&(r[e]=t[e])}));var o=Object_keys(r),a=i.call(r,this.code);return forEach(Object_keys(r),(function(e){(e in t||-1===indexOf(o,e))&&(t[e]=r[e])})),forEach(globals,(function(e){e in t||defineProp(t,e,r[e])})),document.body.removeChild(e),a},Script.prototype.runInThisContext=function(){return eval(this.code)},Script.prototype.runInNewContext=function(t){var e=Script.createContext(t),r=this.runInContext(e);return t&&forEach(Object_keys(e),(function(r){t[r]=e[r]})),r},forEach(Object_keys(Script.prototype),(function(t){exports[t]=Script[t]=function(e){var r=Script(e);return r[t].apply(r,[].slice.call(arguments,1))}})),exports.isContext=function(t){return t instanceof Context},exports.createScript=function(t){return exports.Script(t)},exports.createContext=Script.createContext=function(t){var e=new Context;return"object"==typeof t&&forEach(Object_keys(t),(function(r){e[r]=t[r]})),e}})),_$Readable_419=createModuleFactory((function(t,e){(function(e,r){(function(){"use strict";var i;t.exports=d,d.ReadableState=l,_$events_349.EventEmitter;var n=function(t,e){return t.listeners(e).length},o=_$safeBuffer_431.Buffer,a=(void 0!==r?r:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){},s=Object.create(_$util_259);s.inherits=_$inherits_browser_375;var u,h=_$empty_216({}),f=void 0;f=h&&h.debuglog?h.debuglog("stream"):function(){},s.inherits(d,_$streamBrowser_424);var c=["error","close","destroy","pause","resume"];function l(t,e){t=t||{};var r=e instanceof(i=i||_$Duplex_417({}));this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var n=t.highWaterMark,o=t.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new _$BufferList_422,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(u||(u=_$string_decoder_425({}).StringDecoder),this.decoder=new u(t.encoding),this.encoding=t.encoding)}function d(t){if(i=i||_$Duplex_417({}),!(this instanceof d))return new d(t);this._readableState=new l(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),_$streamBrowser_424.call(this)}function p(t,e,r,i,n){var s,u=t._readableState;return null===e?(u.reading=!1,function(t,e){if(!e.ended){if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,g(t)}}(t,u)):(n||(s=function(t,e){var r,i;return i=e,o.isBuffer(i)||i instanceof a||"string"==typeof e||void 0===e||t.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r}(u,e)),s?t.emit("error",s):u.objectMode||e&&e.length>0?("string"==typeof e||u.objectMode||Object.getPrototypeOf(e)===o.prototype||(e=function(t){return o.from(t)}(e)),i?u.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):_(t,u,e,!0):u.ended?t.emit("error",new Error("stream.push() after EOF")):(u.reading=!1,u.decoder&&!r?(e=u.decoder.write(e),u.objectMode||0!==e.length?_(t,u,e,!1):b(t,u)):_(t,u,e,!1))):i||(u.reading=!1)),function(t){return!t.ended&&(t.needReadable||t.length<t.highWaterMark||0===t.length)}(u)}function _(t,e,r,i){e.flowing&&0===e.length&&!e.sync?(t.emit("data",r),t.read(0)):(e.length+=e.objectMode?1:r.length,i?e.buffer.unshift(r):e.buffer.push(r),e.needReadable&&g(t)),b(t,e)}Object.defineProperty(d.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),d.prototype.destroy=_$destroy_423.destroy,d.prototype._undestroy=_$destroy_423.undestroy,d.prototype._destroy=function(t,e){this.push(null),e(t)},d.prototype.push=function(t,e){var r,i=this._readableState;return i.objectMode?r=!0:"string"==typeof t&&((e=e||i.defaultEncoding)!==i.encoding&&(t=o.from(t,e),e=""),r=!0),p(this,t,e,!1,r)},d.prototype.unshift=function(t){return p(this,t,null,!0,!1)},d.prototype.isPaused=function(){return!1===this._readableState.flowing},d.prototype.setEncoding=function(t){return u||(u=_$string_decoder_425({}).StringDecoder),this._readableState.decoder=new u(t),this._readableState.encoding=t,this};function m(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=8388608?t=8388608:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function g(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(f("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?_$processNextickArgs_400.nextTick(y,t):y(t))}function y(t){f("emit readable"),t.emit("readable"),$(t)}function b(t,e){e.readingMore||(e.readingMore=!0,_$processNextickArgs_400.nextTick(v,t,e))}function v(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length<e.highWaterMark&&(f("maybeReadMore read 0"),t.read(0),r!==e.length);)r=e.length;e.readingMore=!1}function w(t){f("readable nexttick read 0"),t.read(0)}function M(t,e){e.reading||(f("resume read 0"),t.read(0)),e.resumeScheduled=!1,e.awaitDrain=0,t.emit("resume"),$(t),e.flowing&&!e.reading&&t.read(0)}function $(t){var e=t._readableState;for(f("flow",e.flowing);e.flowing&&null!==t.read(););}function E(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):r=function(t,e,r){var i;return t<e.head.data.length?(i=e.head.data.slice(0,t),e.head.data=e.head.data.slice(t)):i=t===e.head.data.length?e.shift():r?function(t,e){var r=e.head,i=1,n=r.data;for(t-=n.length;r=r.next;){var o=r.data,a=t>o.length?o.length:t;if(a===o.length?n+=o:n+=o.slice(0,t),0==(t-=a)){a===o.length?(++i,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=o.slice(a));break}++i}return e.length-=i,n}(t,e):function(t,e){var r=o.allocUnsafe(t),i=e.head,n=1;for(i.data.copy(r),t-=i.data.length;i=i.next;){var a=i.data,s=t>a.length?a.length:t;if(a.copy(r,r.length-t,0,s),0==(t-=s)){s===a.length?(++n,i.next?e.head=i.next:e.head=e.tail=null):(e.head=i,i.data=a.slice(s));break}++n}return e.length-=n,r}(t,e),i}(t,e.buffer,e.decoder),r);var r}function S(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,_$processNextickArgs_400.nextTick(A,e,t))}function A(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function B(t,e){for(var r=0,i=t.length;r<i;r++)if(t[r]===e)return r;return-1}d.prototype.read=function(t){f("read",t),t=parseInt(t,10);var e=this._readableState,r=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return f("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?S(this):g(this),null;if(0===(t=m(t,e))&&e.ended)return 0===e.length&&S(this),null;var i,n=e.needReadable;return f("need readable",n),(0===e.length||e.length-t<e.highWaterMark)&&f("length less than watermark",n=!0),e.ended||e.reading?f("reading or ended",n=!1):n&&(f("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=m(r,e))),null===(i=t>0?E(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&S(this)),null!==i&&this.emit("data",i),i},d.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},d.prototype.pipe=function(t,r){var i=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=t;break;case 1:o.pipes=[o.pipes,t];break;default:o.pipes.push(t)}o.pipesCount+=1,f("pipe count=%d opts=%j",o.pipesCount,r);var a=r&&!1===r.end||t===e.stdout||t===e.stderr?m:s;function s(){f("onend"),t.end()}o.endEmitted?_$processNextickArgs_400.nextTick(a):i.once("end",a),t.on("unpipe",(function e(r,n){f("onunpipe"),r===i&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,f("cleanup"),t.removeListener("close",p),t.removeListener("finish",_),t.removeListener("drain",u),t.removeListener("error",d),t.removeListener("unpipe",e),i.removeListener("end",s),i.removeListener("end",m),i.removeListener("data",l),h=!0,!o.awaitDrain||t._writableState&&!t._writableState.needDrain||u())}));var u=function(t){return function(){var e=t._readableState;f("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&n(t,"data")&&(e.flowing=!0,$(t))}}(i);t.on("drain",u);var h=!1,c=!1;function l(e){f("ondata"),c=!1,!1!==t.write(e)||c||((1===o.pipesCount&&o.pipes===t||o.pipesCount>1&&-1!==B(o.pipes,t))&&!h&&(f("false write response, pause",o.awaitDrain),o.awaitDrain++,c=!0),i.pause())}function d(e){f("onerror",e),m(),t.removeListener("error",d),0===n(t,"error")&&t.emit("error",e)}function p(){t.removeListener("finish",_),m()}function _(){f("onfinish"),t.removeListener("close",p),m()}function m(){f("unpipe"),i.unpipe(t)}return i.on("data",l),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener("error",r);t._events&&t._events.error?_$isarray_377(t._events.error)?t._events.error.unshift(r):t._events.error=[r,t._events.error]:t.on("error",r)}(t,0,d),t.once("close",p),t.once("finish",_),t.emit("pipe",i),o.flowing||(f("pipe resume"),i.resume()),t},d.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o<n;o++)i[o].emit("unpipe",this,{hasUnpiped:!1});return this}var a=B(e.pipes,t);return-1===a||(e.pipes.splice(a,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,r)),this},d.prototype.on=function(t,e){var r=_$streamBrowser_424.prototype.on.call(this,t,e);if("data"===t)!1!==this._readableState.flowing&&this.resume();else if("readable"===t){var i=this._readableState;i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.emittedReadable=!1,i.reading?i.length&&g(this):_$processNextickArgs_400.nextTick(w,this))}return r},d.prototype.addListener=d.prototype.on,d.prototype.resume=function(){var t=this._readableState;return t.flowing||(f("resume"),t.flowing=!0,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,_$processNextickArgs_400.nextTick(M,t,e))}(this,t)),this},d.prototype.pause=function(){return f("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(f("pause"),this._readableState.flowing=!1,this.emit("pause")),this},d.prototype.wrap=function(t){var e=this,r=this._readableState,i=!1;for(var n in t.on("end",(function(){if(f("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(n){f("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n||(r.objectMode||n&&n.length)&&(e.push(n)||(i=!0,t.pause()))})),t)void 0===this[n]&&"function"==typeof t[n]&&(this[n]=function(e){return function(){return t[e].apply(t,arguments)}}(n));for(var o=0;o<c.length;o++)t.on(c[o],this.emit.bind(this,c[o]));return this._read=function(e){f("wrapped _read",e),i&&(i=!1,t.resume())},this},Object.defineProperty(d.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),d._fromList=E}).call(this)}).call(this,_$browser_401,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})})),_$string_decoder_425=createModuleFactory((function(t,e){"use strict";var r=_$safeBuffer_431.Buffer,i=r.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function n(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(r.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=s,this.end=u,e=4;break;case"utf8":this.fillLast=a,e=4;break;case"base64":this.text=h,this.end=f,e=3;break;default:return this.write=c,void(this.end=l)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(e)}function o(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function a(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"\ufffd";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"\ufffd";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"\ufffd"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function s(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function u(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function h(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function f(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function c(t){return t.toString(this.encoding)}function l(t){return t&&t.length?this.write(t):""}e.StringDecoder=n,n.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""},n.prototype.end=function(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\ufffd":e},n.prototype.text=function(t,e){var r=function(t,e,r){var i=e.length-1;if(i<r)return 0;var n=o(e[i]);return n>=0?(n>0&&(t.lastNeed=n-1),n):--i<r||-2===n?0:(n=o(e[i]))>=0?(n>0&&(t.lastNeed=n-2),n):--i<r||-2===n?0:(n=o(e[i]))>=0?(n>0&&(2===n?n=0:t.lastNeed=n-3),n):0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)},n.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}})),_$Duplex_417=createModuleFactory((function(t,e){"use strict";var r=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=h;var i=Object.create(_$util_259);i.inherits=_$inherits_browser_375;var n=_$Readable_419({}),o=_$Writable_421({});i.inherits(h,n);for(var a=r(o.prototype),s=0;s<a.length;s++){var u=a[s];h.prototype[u]||(h.prototype[u]=o.prototype[u])}function h(t){if(!(this instanceof h))return new h(t);n.call(this,t),o.call(this,t),t&&!1===t.readable&&(this.readable=!1),t&&!1===t.writable&&(this.writable=!1),this.allowHalfOpen=!0,t&&!1===t.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",f)}function f(){this.allowHalfOpen||this._writableState.ended||_$processNextickArgs_400.nextTick(c,this)}function c(t){t.end()}Object.defineProperty(h.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(h.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}),h.prototype._destroy=function(t,e){this.push(null),this.end(),_$processNextickArgs_400.nextTick(e,t)}})),_$Writable_421=createModuleFactory((function(t,e){(function(e,r,i){(function(){"use strict";function n(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var i=t.entry;for(t.entry=null;i;){var n=i.callback;e.pendingcb--,n(void 0),i=i.next}e.corkedRequestsFree.next=t}(e,t)}}t.exports=p;var o,a=!e.browser&&["v0.10","v0.9."].indexOf(e.version.slice(0,5))>-1?i:_$processNextickArgs_400.nextTick;p.WritableState=d;var s=Object.create(_$util_259);s.inherits=_$inherits_browser_375;var u,h={deprecate:_$browser_482},f=_$safeBuffer_431.Buffer,c=(void 0!==r?r:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};function l(){}function d(t,e){o=o||_$Duplex_417({}),t=t||{};var r=e instanceof o;this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var i=t.highWaterMark,s=t.writableHighWaterMark,u=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(s||0===s)?s:u,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var h=!1===t.decodeStrings;this.decodeStrings=!h,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,i=r.sync,n=r.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,i,n){--e.pendingcb,r?(_$processNextickArgs_400.nextTick(n,i),_$processNextickArgs_400.nextTick(v,t,e),t._writableState.errorEmitted=!0,t.emit("error",i)):(n(i),t._writableState.errorEmitted=!0,t.emit("error",i),v(t,e))}(t,r,i,e,n);else{var o=y(r);o||r.corked||r.bufferProcessing||!r.bufferedRequest||g(t,r),i?a(m,t,r,o,n):m(t,r,o,n)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new n(this)}function p(t){if(o=o||_$Duplex_417({}),!(u.call(p,this)||this instanceof o))return new p(t);this._writableState=new d(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),_$streamBrowser_424.call(this)}function _(t,e,r,i,n,o,a){e.writelen=i,e.writecb=a,e.writing=!0,e.sync=!0,r?t._writev(n,e.onwrite):t._write(n,o,e.onwrite),e.sync=!1}function m(t,e,r,i){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("d