mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-05-04 15:02:13 +00:00
2093 lines
2.1 MiB
2093 lines
2.1 MiB
parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"kql1":[function(require,module,exports) {
|
||
|
||
var e=module.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e);
|
||
},{}],"nW2g":[function(require,module,exports) {
|
||
var r={}.hasOwnProperty;module.exports=function(e,n){return r.call(e,n)};
|
||
},{}],"e5T+":[function(require,module,exports) {
|
||
module.exports=function(r){try{return!!r()}catch(t){return!0}};
|
||
},{}],"ZJLI":[function(require,module,exports) {
|
||
module.exports=!require("./_fails")(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a});
|
||
},{"./_fails":"e5T+"}],"4KVo":[function(require,module,exports) {
|
||
var e=module.exports={version:"2.6.12"};"number"==typeof __e&&(__e=e);
|
||
},{}],"6SP6":[function(require,module,exports) {
|
||
module.exports=function(o){return"object"==typeof o?null!==o:"function"==typeof o};
|
||
},{}],"DBsB":[function(require,module,exports) {
|
||
var r=require("./_is-object");module.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e};
|
||
},{"./_is-object":"6SP6"}],"dDni":[function(require,module,exports) {
|
||
var e=require("./_is-object"),r=require("./_global").document,t=e(r)&&e(r.createElement);module.exports=function(e){return t?r.createElement(e):{}};
|
||
},{"./_is-object":"6SP6","./_global":"kql1"}],"UUWM":[function(require,module,exports) {
|
||
module.exports=!require("./_descriptors")&&!require("./_fails")(function(){return 7!=Object.defineProperty(require("./_dom-create")("div"),"a",{get:function(){return 7}}).a});
|
||
},{"./_descriptors":"ZJLI","./_fails":"e5T+","./_dom-create":"dDni"}],"PUNq":[function(require,module,exports) {
|
||
var t=require("./_is-object");module.exports=function(r,e){if(!t(r))return r;var o,n;if(e&&"function"==typeof(o=r.toString)&&!t(n=o.call(r)))return n;if("function"==typeof(o=r.valueOf)&&!t(n=o.call(r)))return n;if(!e&&"function"==typeof(o=r.toString)&&!t(n=o.call(r)))return n;throw TypeError("Can't convert object to primitive value")};
|
||
},{"./_is-object":"6SP6"}],"/+wv":[function(require,module,exports) {
|
||
var e=require("./_an-object"),r=require("./_ie8-dom-define"),t=require("./_to-primitive"),i=Object.defineProperty;exports.f=require("./_descriptors")?Object.defineProperty:function(o,n,u){if(e(o),n=t(n,!0),e(u),r)try{return i(o,n,u)}catch(c){}if("get"in u||"set"in u)throw TypeError("Accessors not supported!");return"value"in u&&(o[n]=u.value),o};
|
||
},{"./_an-object":"DBsB","./_ie8-dom-define":"UUWM","./_to-primitive":"PUNq","./_descriptors":"ZJLI"}],"B9+e":[function(require,module,exports) {
|
||
module.exports=function(e,r){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:r}};
|
||
},{}],"i5RL":[function(require,module,exports) {
|
||
var r=require("./_object-dp"),e=require("./_property-desc");module.exports=require("./_descriptors")?function(t,u,o){return r.f(t,u,e(1,o))}:function(r,e,t){return r[e]=t,r};
|
||
},{"./_object-dp":"/+wv","./_property-desc":"B9+e","./_descriptors":"ZJLI"}],"f0sk":[function(require,module,exports) {
|
||
var o=0,t=Math.random();module.exports=function(n){return"Symbol(".concat(void 0===n?"":n,")_",(++o+t).toString(36))};
|
||
},{}],"Nw1e":[function(require,module,exports) {
|
||
module.exports=!1;
|
||
},{}],"8sTG":[function(require,module,exports) {
|
||
|
||
var r=require("./_core"),e=require("./_global"),o="__core-js_shared__",i=e[o]||(e[o]={});(module.exports=function(r,e){return i[r]||(i[r]=void 0!==e?e:{})})("versions",[]).push({version:r.version,mode:require("./_library")?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"});
|
||
},{"./_core":"4KVo","./_global":"kql1","./_library":"Nw1e"}],"xZwm":[function(require,module,exports) {
|
||
module.exports=require("./_shared")("native-function-to-string",Function.toString);
|
||
},{"./_shared":"8sTG"}],"2l2h":[function(require,module,exports) {
|
||
|
||
var e=require("./_global"),r=require("./_hide"),t=require("./_has"),i=require("./_uid")("src"),n=require("./_function-to-string"),o="toString",u=(""+n).split(o);require("./_core").inspectSource=function(e){return n.call(e)},(module.exports=function(n,o,c,l){var s="function"==typeof c;s&&(t(c,"name")||r(c,"name",o)),n[o]!==c&&(s&&(t(c,i)||r(c,i,n[o]?""+n[o]:u.join(String(o)))),n===e?n[o]=c:l?n[o]?n[o]=c:r(n,o,c):(delete n[o],r(n,o,c)))})(Function.prototype,o,function(){return"function"==typeof this&&this[i]||n.call(this)});
|
||
},{"./_global":"kql1","./_hide":"i5RL","./_has":"nW2g","./_uid":"f0sk","./_function-to-string":"xZwm","./_core":"4KVo"}],"L6p4":[function(require,module,exports) {
|
||
module.exports=function(o){if("function"!=typeof o)throw TypeError(o+" is not a function!");return o};
|
||
},{}],"N9ch":[function(require,module,exports) {
|
||
var r=require("./_a-function");module.exports=function(n,t,u){if(r(n),void 0===t)return n;switch(u){case 1:return function(r){return n.call(t,r)};case 2:return function(r,u){return n.call(t,r,u)};case 3:return function(r,u,e){return n.call(t,r,u,e)}}return function(){return n.apply(t,arguments)}};
|
||
},{"./_a-function":"L6p4"}],"NjVL":[function(require,module,exports) {
|
||
|
||
var e=require("./_global"),r=require("./_core"),o=require("./_hide"),i=require("./_redefine"),u=require("./_ctx"),n="prototype",t=function(c,f,l){var q,_,a,d,p=c&t.F,v=c&t.G,F=c&t.S,x=c&t.P,y=c&t.B,B=v?e:F?e[f]||(e[f]={}):(e[f]||{})[n],G=v?r:r[f]||(r[f]={}),P=G[n]||(G[n]={});for(q in v&&(l=f),l)a=((_=!p&&B&&void 0!==B[q])?B:l)[q],d=y&&_?u(a,e):x&&"function"==typeof a?u(Function.call,a):a,B&&i(B,q,a,c&t.U),G[q]!=a&&o(G,q,d),x&&P[q]!=a&&(P[q]=a)};e.core=r,t.F=1,t.G=2,t.S=4,t.P=8,t.B=16,t.W=32,t.U=64,t.R=128,module.exports=t;
|
||
},{"./_global":"kql1","./_core":"4KVo","./_hide":"i5RL","./_redefine":"2l2h","./_ctx":"N9ch"}],"3RGd":[function(require,module,exports) {
|
||
var e=require("./_uid")("meta"),r=require("./_is-object"),t=require("./_has"),n=require("./_object-dp").f,i=0,u=Object.isExtensible||function(){return!0},f=!require("./_fails")(function(){return u(Object.preventExtensions({}))}),o=function(r){n(r,e,{value:{i:"O"+ ++i,w:{}}})},s=function(n,i){if(!r(n))return"symbol"==typeof n?n:("string"==typeof n?"S":"P")+n;if(!t(n,e)){if(!u(n))return"F";if(!i)return"E";o(n)}return n[e].i},c=function(r,n){if(!t(r,e)){if(!u(r))return!0;if(!n)return!1;o(r)}return r[e].w},E=function(r){return f&&a.NEED&&u(r)&&!t(r,e)&&o(r),r},a=module.exports={KEY:e,NEED:!1,fastKey:s,getWeak:c,onFreeze:E};
|
||
},{"./_uid":"f0sk","./_is-object":"6SP6","./_has":"nW2g","./_object-dp":"/+wv","./_fails":"e5T+"}],"3Mgd":[function(require,module,exports) {
|
||
var e=require("./_shared")("wks"),r=require("./_uid"),o=require("./_global").Symbol,u="function"==typeof o,i=module.exports=function(i){return e[i]||(e[i]=u&&o[i]||(u?o:r)("Symbol."+i))};i.store=e;
|
||
},{"./_shared":"8sTG","./_uid":"f0sk","./_global":"kql1"}],"iqAm":[function(require,module,exports) {
|
||
var e=require("./_object-dp").f,r=require("./_has"),o=require("./_wks")("toStringTag");module.exports=function(t,u,i){t&&!r(t=i?t:t.prototype,o)&&e(t,o,{configurable:!0,value:u})};
|
||
},{"./_object-dp":"/+wv","./_has":"nW2g","./_wks":"3Mgd"}],"0d9R":[function(require,module,exports) {
|
||
exports.f=require("./_wks");
|
||
},{"./_wks":"3Mgd"}],"hijg":[function(require,module,exports) {
|
||
|
||
var r=require("./_global"),e=require("./_core"),o=require("./_library"),i=require("./_wks-ext"),l=require("./_object-dp").f;module.exports=function(u){var a=e.Symbol||(e.Symbol=o?{}:r.Symbol||{});"_"==u.charAt(0)||u in a||l(a,u,{value:i.f(u)})};
|
||
},{"./_global":"kql1","./_core":"4KVo","./_library":"Nw1e","./_wks-ext":"0d9R","./_object-dp":"/+wv"}],"viv7":[function(require,module,exports) {
|
||
var r={}.toString;module.exports=function(t){return r.call(t).slice(8,-1)};
|
||
},{}],"kZKK":[function(require,module,exports) {
|
||
var e=require("./_cof");module.exports=Object("z").propertyIsEnumerable(0)?Object:function(r){return"String"==e(r)?r.split(""):Object(r)};
|
||
},{"./_cof":"viv7"}],"Zcur":[function(require,module,exports) {
|
||
module.exports=function(o){if(null==o)throw TypeError("Can't call method on "+o);return o};
|
||
},{}],"mwRI":[function(require,module,exports) {
|
||
var e=require("./_iobject"),r=require("./_defined");module.exports=function(i){return e(r(i))};
|
||
},{"./_iobject":"kZKK","./_defined":"Zcur"}],"cHfm":[function(require,module,exports) {
|
||
var o=Math.ceil,r=Math.floor;module.exports=function(t){return isNaN(t=+t)?0:(t>0?r:o)(t)};
|
||
},{}],"HdKs":[function(require,module,exports) {
|
||
var e=require("./_to-integer"),r=Math.min;module.exports=function(t){return t>0?r(e(t),9007199254740991):0};
|
||
},{"./_to-integer":"cHfm"}],"AXg2":[function(require,module,exports) {
|
||
var e=require("./_to-integer"),r=Math.max,t=Math.min;module.exports=function(n,a){return(n=e(n))<0?r(n+a,0):t(n,a)};
|
||
},{"./_to-integer":"cHfm"}],"/dIP":[function(require,module,exports) {
|
||
var e=require("./_to-iobject"),r=require("./_to-length"),t=require("./_to-absolute-index");module.exports=function(n){return function(i,o,u){var f,l=e(i),a=r(l.length),c=t(u,a);if(n&&o!=o){for(;a>c;)if((f=l[c++])!=f)return!0}else for(;a>c;c++)if((n||c in l)&&l[c]===o)return n||c||0;return!n&&-1}};
|
||
},{"./_to-iobject":"mwRI","./_to-length":"HdKs","./_to-absolute-index":"AXg2"}],"xSc0":[function(require,module,exports) {
|
||
var e=require("./_shared")("keys"),r=require("./_uid");module.exports=function(u){return e[u]||(e[u]=r(u))};
|
||
},{"./_shared":"8sTG","./_uid":"f0sk"}],"UrZ8":[function(require,module,exports) {
|
||
var r=require("./_has"),e=require("./_to-iobject"),u=require("./_array-includes")(!1),i=require("./_shared-key")("IE_PROTO");module.exports=function(o,a){var n,s=e(o),t=0,h=[];for(n in s)n!=i&&r(s,n)&&h.push(n);for(;a.length>t;)r(s,n=a[t++])&&(~u(h,n)||h.push(n));return h};
|
||
},{"./_has":"nW2g","./_to-iobject":"mwRI","./_array-includes":"/dIP","./_shared-key":"xSc0"}],"t611":[function(require,module,exports) {
|
||
module.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",");
|
||
},{}],"kfVX":[function(require,module,exports) {
|
||
var e=require("./_object-keys-internal"),r=require("./_enum-bug-keys");module.exports=Object.keys||function(u){return e(u,r)};
|
||
},{"./_object-keys-internal":"UrZ8","./_enum-bug-keys":"t611"}],"JErC":[function(require,module,exports) {
|
||
exports.f=Object.getOwnPropertySymbols;
|
||
},{}],"Blc0":[function(require,module,exports) {
|
||
exports.f={}.propertyIsEnumerable;
|
||
},{}],"wCtS":[function(require,module,exports) {
|
||
var e=require("./_object-keys"),r=require("./_object-gops"),o=require("./_object-pie");module.exports=function(t){var u=e(t),i=r.f;if(i)for(var c,f=i(t),a=o.f,l=0;f.length>l;)a.call(t,c=f[l++])&&u.push(c);return u};
|
||
},{"./_object-keys":"kfVX","./_object-gops":"JErC","./_object-pie":"Blc0"}],"Osm+":[function(require,module,exports) {
|
||
var r=require("./_cof");module.exports=Array.isArray||function(e){return"Array"==r(e)};
|
||
},{"./_cof":"viv7"}],"4JfJ":[function(require,module,exports) {
|
||
var e=require("./_defined");module.exports=function(r){return Object(e(r))};
|
||
},{"./_defined":"Zcur"}],"Vixs":[function(require,module,exports) {
|
||
var e=require("./_object-dp"),r=require("./_an-object"),t=require("./_object-keys");module.exports=require("./_descriptors")?Object.defineProperties:function(o,i){r(o);for(var u,c=t(i),n=c.length,s=0;n>s;)e.f(o,u=c[s++],i[u]);return o};
|
||
},{"./_object-dp":"/+wv","./_an-object":"DBsB","./_object-keys":"kfVX","./_descriptors":"ZJLI"}],"DBa9":[function(require,module,exports) {
|
||
var e=require("./_global").document;module.exports=e&&e.documentElement;
|
||
},{"./_global":"kql1"}],"d4Ek":[function(require,module,exports) {
|
||
var e=require("./_an-object"),r=require("./_object-dps"),t=require("./_enum-bug-keys"),n=require("./_shared-key")("IE_PROTO"),o=function(){},i="prototype",u=function(){var e,r=require("./_dom-create")("iframe"),n=t.length;for(r.style.display="none",require("./_html").appendChild(r),r.src="javascript:",(e=r.contentWindow.document).open(),e.write("<script>document.F=Object<\/script>"),e.close(),u=e.F;n--;)delete u[i][t[n]];return u()};module.exports=Object.create||function(t,c){var a;return null!==t?(o[i]=e(t),a=new o,o[i]=null,a[n]=t):a=u(),void 0===c?a:r(a,c)};
|
||
},{"./_an-object":"DBsB","./_object-dps":"Vixs","./_enum-bug-keys":"t611","./_shared-key":"xSc0","./_dom-create":"dDni","./_html":"DBa9"}],"yyy+":[function(require,module,exports) {
|
||
var e=require("./_object-keys-internal"),r=require("./_enum-bug-keys").concat("length","prototype");exports.f=Object.getOwnPropertyNames||function(t){return e(t,r)};
|
||
},{"./_object-keys-internal":"UrZ8","./_enum-bug-keys":"t611"}],"JaVi":[function(require,module,exports) {
|
||
var e=require("./_to-iobject"),t=require("./_object-gopn").f,o={}.toString,r="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],n=function(e){try{return t(e)}catch(o){return r.slice()}};module.exports.f=function(c){return r&&"[object Window]"==o.call(c)?n(c):t(e(c))};
|
||
},{"./_to-iobject":"mwRI","./_object-gopn":"yyy+"}],"SFON":[function(require,module,exports) {
|
||
var e=require("./_object-pie"),r=require("./_property-desc"),i=require("./_to-iobject"),t=require("./_to-primitive"),o=require("./_has"),c=require("./_ie8-dom-define"),u=Object.getOwnPropertyDescriptor;exports.f=require("./_descriptors")?u:function(p,q){if(p=i(p),q=t(q,!0),c)try{return u(p,q)}catch(_){}if(o(p,q))return r(!e.f.call(p,q),p[q])};
|
||
},{"./_object-pie":"Blc0","./_property-desc":"B9+e","./_to-iobject":"mwRI","./_to-primitive":"PUNq","./_has":"nW2g","./_ie8-dom-define":"UUWM","./_descriptors":"ZJLI"}],"s5uV":[function(require,module,exports) {
|
||
|
||
"use strict";var e=require("./_global"),r=require("./_has"),t=require("./_descriptors"),i=require("./_export"),n=require("./_redefine"),o=require("./_meta").KEY,u=require("./_fails"),s=require("./_shared"),f=require("./_set-to-string-tag"),c=require("./_uid"),a=require("./_wks"),l=require("./_wks-ext"),p=require("./_wks-define"),b=require("./_enum-keys"),y=require("./_is-array"),h=require("./_an-object"),_=require("./_is-object"),q=require("./_to-object"),g=require("./_to-iobject"),m=require("./_to-primitive"),v=require("./_property-desc"),d=require("./_object-create"),S=require("./_object-gopn-ext"),j=require("./_object-gopd"),O=require("./_object-gops"),w=require("./_object-dp"),k=require("./_object-keys"),P=j.f,F=w.f,E=S.f,N=e.Symbol,J=e.JSON,x=J&&J.stringify,I="prototype",T=a("_hidden"),C=a("toPrimitive"),M={}.propertyIsEnumerable,D=s("symbol-registry"),G=s("symbols"),K=s("op-symbols"),Q=Object[I],W="function"==typeof N&&!!O.f,Y=e.QObject,z=!Y||!Y[I]||!Y[I].findChild,A=t&&u(function(){return 7!=d(F({},"a",{get:function(){return F(this,"a",{value:7}).a}})).a})?function(e,r,t){var i=P(Q,r);i&&delete Q[r],F(e,r,t),i&&e!==Q&&F(Q,r,i)}:F,B=function(e){var r=G[e]=d(N[I]);return r._k=e,r},H=W&&"symbol"==typeof N.iterator?function(e){return"symbol"==typeof e}:function(e){return e instanceof N},L=function(e,t,i){return e===Q&&L(K,t,i),h(e),t=m(t,!0),h(i),r(G,t)?(i.enumerable?(r(e,T)&&e[T][t]&&(e[T][t]=!1),i=d(i,{enumerable:v(0,!1)})):(r(e,T)||F(e,T,v(1,{})),e[T][t]=!0),A(e,t,i)):F(e,t,i)},R=function(e,r){h(e);for(var t,i=b(r=g(r)),n=0,o=i.length;o>n;)L(e,t=i[n++],r[t]);return e},U=function(e,r){return void 0===r?d(e):R(d(e),r)},V=function(e){var t=M.call(this,e=m(e,!0));return!(this===Q&&r(G,e)&&!r(K,e))&&(!(t||!r(this,e)||!r(G,e)||r(this,T)&&this[T][e])||t)},X=function(e,t){if(e=g(e),t=m(t,!0),e!==Q||!r(G,t)||r(K,t)){var i=P(e,t);return!i||!r(G,t)||r(e,T)&&e[T][t]||(i.enumerable=!0),i}},Z=function(e){for(var t,i=E(g(e)),n=[],u=0;i.length>u;)r(G,t=i[u++])||t==T||t==o||n.push(t);return n},$=function(e){for(var t,i=e===Q,n=E(i?K:g(e)),o=[],u=0;n.length>u;)!r(G,t=n[u++])||i&&!r(Q,t)||o.push(G[t]);return o};W||(n((N=function(){if(this instanceof N)throw TypeError("Symbol is not a constructor!");var e=c(arguments.length>0?arguments[0]:void 0),i=function(t){this===Q&&i.call(K,t),r(this,T)&&r(this[T],e)&&(this[T][e]=!1),A(this,e,v(1,t))};return t&&z&&A(Q,e,{configurable:!0,set:i}),B(e)})[I],"toString",function(){return this._k}),j.f=X,w.f=L,require("./_object-gopn").f=S.f=Z,require("./_object-pie").f=V,O.f=$,t&&!require("./_library")&&n(Q,"propertyIsEnumerable",V,!0),l.f=function(e){return B(a(e))}),i(i.G+i.W+i.F*!W,{Symbol:N});for(var ee="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),re=0;ee.length>re;)a(ee[re++]);for(var te=k(a.store),ie=0;te.length>ie;)p(te[ie++]);i(i.S+i.F*!W,"Symbol",{for:function(e){return r(D,e+="")?D[e]:D[e]=N(e)},keyFor:function(e){if(!H(e))throw TypeError(e+" is not a symbol!");for(var r in D)if(D[r]===e)return r},useSetter:function(){z=!0},useSimple:function(){z=!1}}),i(i.S+i.F*!W,"Object",{create:U,defineProperty:L,defineProperties:R,getOwnPropertyDescriptor:X,getOwnPropertyNames:Z,getOwnPropertySymbols:$});var ne=u(function(){O.f(1)});i(i.S+i.F*ne,"Object",{getOwnPropertySymbols:function(e){return O.f(q(e))}}),J&&i(i.S+i.F*(!W||u(function(){var e=N();return"[null]"!=x([e])||"{}"!=x({a:e})||"{}"!=x(Object(e))})),"JSON",{stringify:function(e){for(var r,t,i=[e],n=1;arguments.length>n;)i.push(arguments[n++]);if(t=r=i[1],(_(r)||void 0!==e)&&!H(e))return y(r)||(r=function(e,r){if("function"==typeof t&&(r=t.call(this,e,r)),!H(r))return r}),i[1]=r,x.apply(J,i)}}),N[I][C]||require("./_hide")(N[I],C,N[I].valueOf),f(N,"Symbol"),f(Math,"Math",!0),f(e.JSON,"JSON",!0);
|
||
},{"./_global":"kql1","./_has":"nW2g","./_descriptors":"ZJLI","./_export":"NjVL","./_redefine":"2l2h","./_meta":"3RGd","./_fails":"e5T+","./_shared":"8sTG","./_set-to-string-tag":"iqAm","./_uid":"f0sk","./_wks":"3Mgd","./_wks-ext":"0d9R","./_wks-define":"hijg","./_enum-keys":"wCtS","./_is-array":"Osm+","./_an-object":"DBsB","./_is-object":"6SP6","./_to-object":"4JfJ","./_to-iobject":"mwRI","./_to-primitive":"PUNq","./_property-desc":"B9+e","./_object-create":"d4Ek","./_object-gopn-ext":"JaVi","./_object-gopd":"SFON","./_object-gops":"JErC","./_object-dp":"/+wv","./_object-keys":"kfVX","./_object-gopn":"yyy+","./_object-pie":"Blc0","./_library":"Nw1e","./_hide":"i5RL"}],"ELq7":[function(require,module,exports) {
|
||
var e=require("./_export");e(e.S,"Object",{create:require("./_object-create")});
|
||
},{"./_export":"NjVL","./_object-create":"d4Ek"}],"SeKy":[function(require,module,exports) {
|
||
var e=require("./_export");e(e.S+e.F*!require("./_descriptors"),"Object",{defineProperty:require("./_object-dp").f});
|
||
},{"./_export":"NjVL","./_descriptors":"ZJLI","./_object-dp":"/+wv"}],"FFVz":[function(require,module,exports) {
|
||
var e=require("./_export");e(e.S+e.F*!require("./_descriptors"),"Object",{defineProperties:require("./_object-dps")});
|
||
},{"./_export":"NjVL","./_descriptors":"ZJLI","./_object-dps":"Vixs"}],"GmOm":[function(require,module,exports) {
|
||
var e=require("./_export"),r=require("./_core"),t=require("./_fails");module.exports=function(c,i){var o=(r.Object||{})[c]||Object[c],u={};u[c]=i(o),e(e.S+e.F*t(function(){o(1)}),"Object",u)};
|
||
},{"./_export":"NjVL","./_core":"4KVo","./_fails":"e5T+"}],"3eOb":[function(require,module,exports) {
|
||
var r=require("./_to-iobject"),e=require("./_object-gopd").f;require("./_object-sap")("getOwnPropertyDescriptor",function(){return function(t,o){return e(r(t),o)}});
|
||
},{"./_to-iobject":"mwRI","./_object-gopd":"SFON","./_object-sap":"GmOm"}],"kbAb":[function(require,module,exports) {
|
||
var t=require("./_has"),e=require("./_to-object"),o=require("./_shared-key")("IE_PROTO"),r=Object.prototype;module.exports=Object.getPrototypeOf||function(c){return c=e(c),t(c,o)?c[o]:"function"==typeof c.constructor&&c instanceof c.constructor?c.constructor.prototype:c instanceof Object?r:null};
|
||
},{"./_has":"nW2g","./_to-object":"4JfJ","./_shared-key":"xSc0"}],"x4A6":[function(require,module,exports) {
|
||
var e=require("./_to-object"),r=require("./_object-gpo");require("./_object-sap")("getPrototypeOf",function(){return function(t){return r(e(t))}});
|
||
},{"./_to-object":"4JfJ","./_object-gpo":"kbAb","./_object-sap":"GmOm"}],"oiqN":[function(require,module,exports) {
|
||
var e=require("./_to-object"),r=require("./_object-keys");require("./_object-sap")("keys",function(){return function(t){return r(e(t))}});
|
||
},{"./_to-object":"4JfJ","./_object-keys":"kfVX","./_object-sap":"GmOm"}],"N+x5":[function(require,module,exports) {
|
||
require("./_object-sap")("getOwnPropertyNames",function(){return require("./_object-gopn-ext").f});
|
||
},{"./_object-sap":"GmOm","./_object-gopn-ext":"JaVi"}],"3QMv":[function(require,module,exports) {
|
||
var e=require("./_is-object"),r=require("./_meta").onFreeze;require("./_object-sap")("freeze",function(n){return function(t){return n&&e(t)?n(r(t)):t}});
|
||
},{"./_is-object":"6SP6","./_meta":"3RGd","./_object-sap":"GmOm"}],"y8Nt":[function(require,module,exports) {
|
||
var e=require("./_is-object"),r=require("./_meta").onFreeze;require("./_object-sap")("seal",function(n){return function(t){return n&&e(t)?n(r(t)):t}});
|
||
},{"./_is-object":"6SP6","./_meta":"3RGd","./_object-sap":"GmOm"}],"vJzf":[function(require,module,exports) {
|
||
var e=require("./_is-object"),r=require("./_meta").onFreeze;require("./_object-sap")("preventExtensions",function(n){return function(t){return n&&e(t)?n(r(t)):t}});
|
||
},{"./_is-object":"6SP6","./_meta":"3RGd","./_object-sap":"GmOm"}],"3UcE":[function(require,module,exports) {
|
||
var r=require("./_is-object");require("./_object-sap")("isFrozen",function(e){return function(n){return!r(n)||!!e&&e(n)}});
|
||
},{"./_is-object":"6SP6","./_object-sap":"GmOm"}],"1VI7":[function(require,module,exports) {
|
||
var e=require("./_is-object");require("./_object-sap")("isSealed",function(r){return function(i){return!e(i)||!!r&&r(i)}});
|
||
},{"./_is-object":"6SP6","./_object-sap":"GmOm"}],"CvEg":[function(require,module,exports) {
|
||
var e=require("./_is-object");require("./_object-sap")("isExtensible",function(r){return function(i){return!!e(i)&&(!r||r(i))}});
|
||
},{"./_is-object":"6SP6","./_object-sap":"GmOm"}],"bBG/":[function(require,module,exports) {
|
||
"use strict";var e=require("./_descriptors"),r=require("./_object-keys"),t=require("./_object-gops"),o=require("./_object-pie"),i=require("./_to-object"),c=require("./_iobject"),n=Object.assign;module.exports=!n||require("./_fails")(function(){var e={},r={},t=Symbol(),o="abcdefghijklmnopqrst";return e[t]=7,o.split("").forEach(function(e){r[e]=e}),7!=n({},e)[t]||Object.keys(n({},r)).join("")!=o})?function(n,u){for(var s=i(n),a=arguments.length,f=1,b=t.f,j=o.f;a>f;)for(var l,q=c(arguments[f++]),_=b?r(q).concat(b(q)):r(q),p=_.length,g=0;p>g;)l=_[g++],e&&!j.call(q,l)||(s[l]=q[l]);return s}:n;
|
||
},{"./_descriptors":"ZJLI","./_object-keys":"kfVX","./_object-gops":"JErC","./_object-pie":"Blc0","./_to-object":"4JfJ","./_iobject":"kZKK","./_fails":"e5T+"}],"fRec":[function(require,module,exports) {
|
||
var e=require("./_export");e(e.S+e.F,"Object",{assign:require("./_object-assign")});
|
||
},{"./_export":"NjVL","./_object-assign":"bBG/"}],"YyyQ":[function(require,module,exports) {
|
||
module.exports=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t};
|
||
},{}],"GEUt":[function(require,module,exports) {
|
||
var e=require("./_export");e(e.S,"Object",{is:require("./_same-value")});
|
||
},{"./_export":"NjVL","./_same-value":"YyyQ"}],"Epal":[function(require,module,exports) {
|
||
var t=require("./_is-object"),e=require("./_an-object"),r=function(r,o){if(e(r),!t(o)&&null!==o)throw TypeError(o+": can't set as prototype!")};module.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,e,o){try{(o=require("./_ctx")(Function.call,require("./_object-gopd").f(Object.prototype,"__proto__").set,2))(t,[]),e=!(t instanceof Array)}catch(c){e=!0}return function(t,c){return r(t,c),e?t.__proto__=c:o(t,c),t}}({},!1):void 0),check:r};
|
||
},{"./_is-object":"6SP6","./_an-object":"DBsB","./_ctx":"N9ch","./_object-gopd":"SFON"}],"CQxr":[function(require,module,exports) {
|
||
var e=require("./_export");e(e.S,"Object",{setPrototypeOf:require("./_set-proto").set});
|
||
},{"./_export":"NjVL","./_set-proto":"Epal"}],"jP8S":[function(require,module,exports) {
|
||
var e=require("./_cof"),t=require("./_wks")("toStringTag"),n="Arguments"==e(function(){return arguments}()),r=function(e,t){try{return e[t]}catch(n){}};module.exports=function(u){var o,c,i;return void 0===u?"Undefined":null===u?"Null":"string"==typeof(c=r(o=Object(u),t))?c:n?e(o):"Object"==(i=e(o))&&"function"==typeof o.callee?"Arguments":i};
|
||
},{"./_cof":"viv7","./_wks":"3Mgd"}],"tS/z":[function(require,module,exports) {
|
||
"use strict";var e=require("./_classof"),r={};r[require("./_wks")("toStringTag")]="z",r+""!="[object z]"&&require("./_redefine")(Object.prototype,"toString",function(){return"[object "+e(this)+"]"},!0);
|
||
},{"./_classof":"jP8S","./_wks":"3Mgd","./_redefine":"2l2h"}],"TTev":[function(require,module,exports) {
|
||
module.exports=function(e,r,l){var a=void 0===l;switch(r.length){case 0:return a?e():e.call(l);case 1:return a?e(r[0]):e.call(l,r[0]);case 2:return a?e(r[0],r[1]):e.call(l,r[0],r[1]);case 3:return a?e(r[0],r[1],r[2]):e.call(l,r[0],r[1],r[2]);case 4:return a?e(r[0],r[1],r[2],r[3]):e.call(l,r[0],r[1],r[2],r[3])}return e.apply(l,r)};
|
||
},{}],"nZQ+":[function(require,module,exports) {
|
||
"use strict";var n=require("./_a-function"),t=require("./_is-object"),r=require("./_invoke"),e=[].slice,i={},o=function(n,t,r){if(!(t in i)){for(var e=[],o=0;o<t;o++)e[o]="a["+o+"]";i[t]=Function("F,a","return new F("+e.join(",")+")")}return i[t](n,r)};module.exports=Function.bind||function(i){var u=n(this),c=e.call(arguments,1),a=function(){var n=c.concat(e.call(arguments));return this instanceof a?o(u,n.length,n):r(u,n,i)};return t(u.prototype)&&(a.prototype=u.prototype),a};
|
||
},{"./_a-function":"L6p4","./_is-object":"6SP6","./_invoke":"TTev"}],"eBLX":[function(require,module,exports) {
|
||
var r=require("./_export");r(r.P,"Function",{bind:require("./_bind")});
|
||
},{"./_export":"NjVL","./_bind":"nZQ+"}],"WtEG":[function(require,module,exports) {
|
||
var r=require("./_object-dp").f,t=Function.prototype,e=/^\s*function ([^ (]*)/,n="name";n in t||require("./_descriptors")&&r(t,n,{configurable:!0,get:function(){try{return(""+this).match(e)[1]}catch(r){return""}}});
|
||
},{"./_object-dp":"/+wv","./_descriptors":"ZJLI"}],"YlR3":[function(require,module,exports) {
|
||
"use strict";var t=require("./_is-object"),e=require("./_object-gpo"),r=require("./_wks")("hasInstance"),i=Function.prototype;r in i||require("./_object-dp").f(i,r,{value:function(r){if("function"!=typeof this||!t(r))return!1;if(!t(this.prototype))return r instanceof this;for(;r=e(r);)if(this.prototype===r)return!0;return!1}});
|
||
},{"./_is-object":"6SP6","./_object-gpo":"kbAb","./_wks":"3Mgd","./_object-dp":"/+wv"}],"p585":[function(require,module,exports) {
|
||
module.exports="\t\n\v\f\r \u2028\u2029\ufeff";
|
||
},{}],"EWct":[function(require,module,exports) {
|
||
var r=require("./_export"),e=require("./_defined"),i=require("./_fails"),n=require("./_string-ws"),t="["+n+"]",u="
",o=RegExp("^"+t+t+"*"),p=RegExp(t+t+"*$"),a=function(e,t,o){var p={},a=i(function(){return!!n[e]()||u[e]()!=u}),f=p[e]=a?t(c):n[e];o&&(p[o]=f),r(r.P+r.F*a,"String",p)},c=a.trim=function(r,i){return r=String(e(r)),1&i&&(r=r.replace(o,"")),2&i&&(r=r.replace(p,"")),r};module.exports=a;
|
||
},{"./_export":"NjVL","./_defined":"Zcur","./_fails":"e5T+","./_string-ws":"p585"}],"m09p":[function(require,module,exports) {
|
||
var r=require("./_global").parseInt,e=require("./_string-trim").trim,t=require("./_string-ws"),i=/^[-+]?0[xX]/;module.exports=8!==r(t+"08")||22!==r(t+"0x16")?function(t,n){var s=e(String(t),3);return r(s,n>>>0||(i.test(s)?16:10))}:r;
|
||
},{"./_global":"kql1","./_string-trim":"EWct","./_string-ws":"p585"}],"OCDI":[function(require,module,exports) {
|
||
var r=require("./_export"),e=require("./_parse-int");r(r.G+r.F*(parseInt!=e),{parseInt:e});
|
||
},{"./_export":"NjVL","./_parse-int":"m09p"}],"EZpC":[function(require,module,exports) {
|
||
var r=require("./_global").parseFloat,e=require("./_string-trim").trim;module.exports=1/r(require("./_string-ws")+"-0")!=-1/0?function(t){var i=e(String(t),3),a=r(i);return 0===a&&"-"==i.charAt(0)?-0:a}:r;
|
||
},{"./_global":"kql1","./_string-trim":"EWct","./_string-ws":"p585"}],"i7Me":[function(require,module,exports) {
|
||
var r=require("./_export"),e=require("./_parse-float");r(r.G+r.F*(parseFloat!=e),{parseFloat:e});
|
||
},{"./_export":"NjVL","./_parse-float":"EZpC"}],"oEgy":[function(require,module,exports) {
|
||
var t=require("./_is-object"),o=require("./_set-proto").set;module.exports=function(r,e,p){var u,n=e.constructor;return n!==p&&"function"==typeof n&&(u=n.prototype)!==p.prototype&&t(u)&&o&&o(r,u),r};
|
||
},{"./_is-object":"6SP6","./_set-proto":"Epal"}],"uYep":[function(require,module,exports) {
|
||
|
||
"use strict";var e=require("./_global"),r=require("./_has"),t=require("./_cof"),i=require("./_inherit-if-required"),a=require("./_to-primitive"),n=require("./_fails"),o=require("./_object-gopn").f,u=require("./_object-gopd").f,s=require("./_object-dp").f,c=require("./_string-trim").trim,f="Number",_=e[f],I=_,N=_.prototype,p=t(require("./_object-create")(N))==f,l="trim"in String.prototype,q=function(e){var r=a(e,!1);if("string"==typeof r&&r.length>2){var t,i,n,o=(r=l?r.trim():c(r,3)).charCodeAt(0);if(43===o||45===o){if(88===(t=r.charCodeAt(2))||120===t)return NaN}else if(48===o){switch(r.charCodeAt(1)){case 66:case 98:i=2,n=49;break;case 79:case 111:i=8,n=55;break;default:return+r}for(var u,s=r.slice(2),f=0,_=s.length;f<_;f++)if((u=s.charCodeAt(f))<48||u>n)return NaN;return parseInt(s,i)}}return+r};if(!_(" 0o1")||!_("0b1")||_("+0x1")){_=function(e){var r=arguments.length<1?0:e,a=this;return a instanceof _&&(p?n(function(){N.valueOf.call(a)}):t(a)!=f)?i(new I(q(r)),a,_):q(r)};for(var g,h=require("./_descriptors")?o(I):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),E=0;h.length>E;E++)r(I,g=h[E])&&!r(_,g)&&s(_,g,u(I,g));_.prototype=N,N.constructor=_,require("./_redefine")(e,f,_)}
|
||
},{"./_global":"kql1","./_has":"nW2g","./_cof":"viv7","./_inherit-if-required":"oEgy","./_to-primitive":"PUNq","./_fails":"e5T+","./_object-gopn":"yyy+","./_object-gopd":"SFON","./_object-dp":"/+wv","./_string-trim":"EWct","./_object-create":"d4Ek","./_descriptors":"ZJLI","./_redefine":"2l2h"}],"zg/K":[function(require,module,exports) {
|
||
var r=require("./_cof");module.exports=function(e,o){if("number"!=typeof e&&"Number"!=r(e))throw TypeError(o);return+e};
|
||
},{"./_cof":"viv7"}],"ezM6":[function(require,module,exports) {
|
||
"use strict";var r=require("./_to-integer"),e=require("./_defined");module.exports=function(t){var i=String(e(this)),n="",o=r(t);if(o<0||o==1/0)throw RangeError("Count can't be negative");for(;o>0;(o>>>=1)&&(i+=i))1&o&&(n+=i);return n};
|
||
},{"./_to-integer":"cHfm","./_defined":"Zcur"}],"dVzo":[function(require,module,exports) {
|
||
"use strict";var r=require("./_export"),e=require("./_to-integer"),i=require("./_a-number-value"),t=require("./_string-repeat"),n=1..toFixed,o=Math.floor,u=[0,0,0,0,0,0],f="Number.toFixed: incorrect invocation!",a="0",c=function(r,e){for(var i=-1,t=e;++i<6;)t+=r*u[i],u[i]=t%1e7,t=o(t/1e7)},l=function(r){for(var e=6,i=0;--e>=0;)i+=u[e],u[e]=o(i/r),i=i%r*1e7},v=function(){for(var r=6,e="";--r>=0;)if(""!==e||0===r||0!==u[r]){var i=String(u[r]);e=""===e?i:e+t.call(a,7-i.length)+i}return e},x=function(r,e,i){return 0===e?i:e%2==1?x(r,e-1,i*r):x(r*r,e/2,i)},d=function(r){for(var e=0,i=r;i>=4096;)e+=12,i/=4096;for(;i>=2;)e+=1,i/=2;return e};r(r.P+r.F*(!!n&&("0.000"!==8e-5.toFixed(3)||"1"!==.9.toFixed(0)||"1.25"!==1.255.toFixed(2)||"1000000000000000128"!==(0xde0b6b3a7640080).toFixed(0))||!require("./_fails")(function(){n.call({})})),"Number",{toFixed:function(r){var n,o,u,s,F=i(this,f),g=e(r),b="",h=a;if(g<0||g>20)throw RangeError(f);if(F!=F)return"NaN";if(F<=-1e21||F>=1e21)return String(F);if(F<0&&(b="-",F=-F),F>1e-21)if(o=(n=d(F*x(2,69,1))-69)<0?F*x(2,-n,1):F/x(2,n,1),o*=4503599627370496,(n=52-n)>0){for(c(0,o),u=g;u>=7;)c(1e7,0),u-=7;for(c(x(10,u,1),0),u=n-1;u>=23;)l(1<<23),u-=23;l(1<<u),c(1,1),l(2),h=v()}else c(0,o),c(1<<-n,0),h=v()+t.call(a,g);return h=g>0?b+((s=h.length)<=g?"0."+t.call(a,g-s)+h:h.slice(0,s-g)+"."+h.slice(s-g)):b+h}});
|
||
},{"./_export":"NjVL","./_to-integer":"cHfm","./_a-number-value":"zg/K","./_string-repeat":"ezM6","./_fails":"e5T+"}],"2Kwy":[function(require,module,exports) {
|
||
"use strict";var r=require("./_export"),i=require("./_fails"),e=require("./_a-number-value"),n=1..toPrecision;r(r.P+r.F*(i(function(){return"1"!==n.call(1,void 0)})||!i(function(){n.call({})})),"Number",{toPrecision:function(r){var i=e(this,"Number#toPrecision: incorrect invocation!");return void 0===r?n.call(i):n.call(i,r)}});
|
||
},{"./_export":"NjVL","./_fails":"e5T+","./_a-number-value":"zg/K"}],"9Dec":[function(require,module,exports) {
|
||
var r=require("./_export");r(r.S,"Number",{EPSILON:Math.pow(2,-52)});
|
||
},{"./_export":"NjVL"}],"oWwC":[function(require,module,exports) {
|
||
var e=require("./_export"),r=require("./_global").isFinite;e(e.S,"Number",{isFinite:function(e){return"number"==typeof e&&r(e)}});
|
||
},{"./_export":"NjVL","./_global":"kql1"}],"yEh5":[function(require,module,exports) {
|
||
var e=require("./_is-object"),r=Math.floor;module.exports=function(i){return!e(i)&&isFinite(i)&&r(i)===i};
|
||
},{"./_is-object":"6SP6"}],"N7Jd":[function(require,module,exports) {
|
||
var e=require("./_export");e(e.S,"Number",{isInteger:require("./_is-integer")});
|
||
},{"./_export":"NjVL","./_is-integer":"yEh5"}],"RsrB":[function(require,module,exports) {
|
||
var r=require("./_export");r(r.S,"Number",{isNaN:function(r){return r!=r}});
|
||
},{"./_export":"NjVL"}],"fbTZ":[function(require,module,exports) {
|
||
var e=require("./_export"),r=require("./_is-integer"),i=Math.abs;e(e.S,"Number",{isSafeInteger:function(e){return r(e)&&i(e)<=9007199254740991}});
|
||
},{"./_export":"NjVL","./_is-integer":"yEh5"}],"JxHc":[function(require,module,exports) {
|
||
var r=require("./_export");r(r.S,"Number",{MAX_SAFE_INTEGER:9007199254740991});
|
||
},{"./_export":"NjVL"}],"X6hw":[function(require,module,exports) {
|
||
var r=require("./_export");r(r.S,"Number",{MIN_SAFE_INTEGER:-9007199254740991});
|
||
},{"./_export":"NjVL"}],"IKam":[function(require,module,exports) {
|
||
var r=require("./_export"),e=require("./_parse-float");r(r.S+r.F*(Number.parseFloat!=e),"Number",{parseFloat:e});
|
||
},{"./_export":"NjVL","./_parse-float":"EZpC"}],"0QjI":[function(require,module,exports) {
|
||
var r=require("./_export"),e=require("./_parse-int");r(r.S+r.F*(Number.parseInt!=e),"Number",{parseInt:e});
|
||
},{"./_export":"NjVL","./_parse-int":"m09p"}],"u7lu":[function(require,module,exports) {
|
||
module.exports=Math.log1p||function(e){return(e=+e)>-1e-8&&e<1e-8?e-e*e/2:Math.log(1+e)};
|
||
},{}],"FaF2":[function(require,module,exports) {
|
||
var a=require("./_export"),r=require("./_math-log1p"),t=Math.sqrt,h=Math.acosh;a(a.S+a.F*!(h&&710==Math.floor(h(Number.MAX_VALUE))&&h(1/0)==1/0),"Math",{acosh:function(a){return(a=+a)<1?NaN:a>94906265.62425156?Math.log(a)+Math.LN2:r(a-1+t(a-1)*t(a+1))}});
|
||
},{"./_export":"NjVL","./_math-log1p":"u7lu"}],"oL1m":[function(require,module,exports) {
|
||
var t=require("./_export"),a=Math.asinh;function i(t){return isFinite(t=+t)&&0!=t?t<0?-i(-t):Math.log(t+Math.sqrt(t*t+1)):t}t(t.S+t.F*!(a&&1/a(0)>0),"Math",{asinh:i});
|
||
},{"./_export":"NjVL"}],"PhwT":[function(require,module,exports) {
|
||
var a=require("./_export"),t=Math.atanh;a(a.S+a.F*!(t&&1/t(-0)<0),"Math",{atanh:function(a){return 0==(a=+a)?a:Math.log((1+a)/(1-a))/2}});
|
||
},{"./_export":"NjVL"}],"KTfa":[function(require,module,exports) {
|
||
module.exports=Math.sign||function(n){return 0==(n=+n)||n!=n?n:n<0?-1:1};
|
||
},{}],"fi1h":[function(require,module,exports) {
|
||
var r=require("./_export"),t=require("./_math-sign");r(r.S,"Math",{cbrt:function(r){return t(r=+r)*Math.pow(Math.abs(r),1/3)}});
|
||
},{"./_export":"NjVL","./_math-sign":"KTfa"}],"fJAy":[function(require,module,exports) {
|
||
var r=require("./_export");r(r.S,"Math",{clz32:function(r){return(r>>>=0)?31-Math.floor(Math.log(r+.5)*Math.LOG2E):32}});
|
||
},{"./_export":"NjVL"}],"kseY":[function(require,module,exports) {
|
||
var r=require("./_export"),e=Math.exp;r(r.S,"Math",{cosh:function(r){return(e(r=+r)+e(-r))/2}});
|
||
},{"./_export":"NjVL"}],"FOcF":[function(require,module,exports) {
|
||
var e=Math.expm1;module.exports=!e||e(10)>22025.465794806718||e(10)<22025.465794806718||-2e-17!=e(-2e-17)?function(e){return 0==(e=+e)?e:e>-1e-6&&e<1e-6?e+e*e/2:Math.exp(e)-1}:e;
|
||
},{}],"hyI8":[function(require,module,exports) {
|
||
var e=require("./_export"),r=require("./_math-expm1");e(e.S+e.F*(r!=Math.expm1),"Math",{expm1:r});
|
||
},{"./_export":"NjVL","./_math-expm1":"FOcF"}],"uZ/F":[function(require,module,exports) {
|
||
var r=require("./_math-sign"),t=Math.pow,n=t(2,-52),a=t(2,-23),u=t(2,127)*(2-a),e=t(2,-126),o=function(r){return r+1/n-1/n};module.exports=Math.fround||function(t){var h,i,f=Math.abs(t),s=r(t);return f<e?s*o(f/e/a)*e*a:(i=(h=(1+a/n)*f)-(h-f))>u||i!=i?s*(1/0):s*i};
|
||
},{"./_math-sign":"KTfa"}],"N7ZU":[function(require,module,exports) {
|
||
var r=require("./_export");r(r.S,"Math",{fround:require("./_math-fround")});
|
||
},{"./_export":"NjVL","./_math-fround":"uZ/F"}],"HGHV":[function(require,module,exports) {
|
||
var r=require("./_export"),t=Math.abs;r(r.S,"Math",{hypot:function(r,a){for(var e,h,n=0,o=0,u=arguments.length,M=0;o<u;)M<(e=t(arguments[o++]))?(n=n*(h=M/e)*h+1,M=e):n+=e>0?(h=e/M)*h:e;return M===1/0?1/0:M*Math.sqrt(n)}});
|
||
},{"./_export":"NjVL"}],"Pasv":[function(require,module,exports) {
|
||
var r=require("./_export"),e=Math.imul;r(r.S+r.F*require("./_fails")(function(){return-5!=e(4294967295,5)||2!=e.length}),"Math",{imul:function(r,e){var t=+r,u=+e,i=65535&t,n=65535&u;return 0|i*n+((65535&t>>>16)*n+i*(65535&u>>>16)<<16>>>0)}});
|
||
},{"./_export":"NjVL","./_fails":"e5T+"}],"zlsv":[function(require,module,exports) {
|
||
var r=require("./_export");r(r.S,"Math",{log10:function(r){return Math.log(r)*Math.LOG10E}});
|
||
},{"./_export":"NjVL"}],"RR3i":[function(require,module,exports) {
|
||
var r=require("./_export");r(r.S,"Math",{log1p:require("./_math-log1p")});
|
||
},{"./_export":"NjVL","./_math-log1p":"u7lu"}],"b6PB":[function(require,module,exports) {
|
||
var r=require("./_export");r(r.S,"Math",{log2:function(r){return Math.log(r)/Math.LN2}});
|
||
},{"./_export":"NjVL"}],"BHWJ":[function(require,module,exports) {
|
||
var r=require("./_export");r(r.S,"Math",{sign:require("./_math-sign")});
|
||
},{"./_export":"NjVL","./_math-sign":"KTfa"}],"7f0F":[function(require,module,exports) {
|
||
var e=require("./_export"),r=require("./_math-expm1"),t=Math.exp;e(e.S+e.F*require("./_fails")(function(){return-2e-17!=!Math.sinh(-2e-17)}),"Math",{sinh:function(e){return Math.abs(e=+e)<1?(r(e)-r(-e))/2:(t(e-1)-t(-e-1))*(Math.E/2)}});
|
||
},{"./_export":"NjVL","./_math-expm1":"FOcF","./_fails":"e5T+"}],"GaA9":[function(require,module,exports) {
|
||
var r=require("./_export"),e=require("./_math-expm1"),t=Math.exp;r(r.S,"Math",{tanh:function(r){var a=e(r=+r),h=e(-r);return a==1/0?1:h==1/0?-1:(a-h)/(t(r)+t(-r))}});
|
||
},{"./_export":"NjVL","./_math-expm1":"FOcF"}],"qy71":[function(require,module,exports) {
|
||
var r=require("./_export");r(r.S,"Math",{trunc:function(r){return(r>0?Math.floor:Math.ceil)(r)}});
|
||
},{"./_export":"NjVL"}],"i8rB":[function(require,module,exports) {
|
||
var r=require("./_export"),o=require("./_to-absolute-index"),e=String.fromCharCode,n=String.fromCodePoint;r(r.S+r.F*(!!n&&1!=n.length),"String",{fromCodePoint:function(r){for(var n,t=[],i=arguments.length,a=0;i>a;){if(n=+arguments[a++],o(n,1114111)!==n)throw RangeError(n+" is not a valid code point");t.push(n<65536?e(n):e(55296+((n-=65536)>>10),n%1024+56320))}return t.join("")}});
|
||
},{"./_export":"NjVL","./_to-absolute-index":"AXg2"}],"7+Dt":[function(require,module,exports) {
|
||
var r=require("./_export"),e=require("./_to-iobject"),t=require("./_to-length");r(r.S,"String",{raw:function(r){for(var n=e(r.raw),i=t(n.length),o=arguments.length,u=[],g=0;i>g;)u.push(String(n[g++])),g<o&&u.push(String(arguments[g]));return u.join("")}});
|
||
},{"./_export":"NjVL","./_to-iobject":"mwRI","./_to-length":"HdKs"}],"64Z1":[function(require,module,exports) {
|
||
"use strict";require("./_string-trim")("trim",function(r){return function(){return r(this,3)}});
|
||
},{"./_string-trim":"EWct"}],"Bi/T":[function(require,module,exports) {
|
||
var e=require("./_to-integer"),r=require("./_defined");module.exports=function(t){return function(n,i){var o,u,c=String(r(n)),d=e(i),a=c.length;return d<0||d>=a?t?"":void 0:(o=c.charCodeAt(d))<55296||o>56319||d+1===a||(u=c.charCodeAt(d+1))<56320||u>57343?t?c.charAt(d):o:t?c.slice(d,d+2):u-56320+(o-55296<<10)+65536}};
|
||
},{"./_to-integer":"cHfm","./_defined":"Zcur"}],"oANp":[function(require,module,exports) {
|
||
module.exports={};
|
||
},{}],"O1PE":[function(require,module,exports) {
|
||
"use strict";var e=require("./_object-create"),r=require("./_property-desc"),t=require("./_set-to-string-tag"),i={};require("./_hide")(i,require("./_wks")("iterator"),function(){return this}),module.exports=function(o,u,s){o.prototype=e(i,{next:r(1,s)}),t(o,u+" Iterator")};
|
||
},{"./_object-create":"d4Ek","./_property-desc":"B9+e","./_set-to-string-tag":"iqAm","./_hide":"i5RL","./_wks":"3Mgd"}],"kgNZ":[function(require,module,exports) {
|
||
"use strict";var e=require("./_library"),r=require("./_export"),t=require("./_redefine"),i=require("./_hide"),n=require("./_iterators"),u=require("./_iter-create"),o=require("./_set-to-string-tag"),s=require("./_object-gpo"),a=require("./_wks")("iterator"),c=!([].keys&&"next"in[].keys()),f="@@iterator",l="keys",q="values",y=function(){return this};module.exports=function(_,p,h,k,v,w,d){u(h,p,k);var x,b,g,j=function(e){if(!c&&e in I)return I[e];switch(e){case l:case q:return function(){return new h(this,e)}}return function(){return new h(this,e)}},m=p+" Iterator",A=v==q,F=!1,I=_.prototype,O=I[a]||I[f]||v&&I[v],P=O||j(v),z=v?A?j("entries"):P:void 0,B="Array"==p&&I.entries||O;if(B&&(g=s(B.call(new _)))!==Object.prototype&&g.next&&(o(g,m,!0),e||"function"==typeof g[a]||i(g,a,y)),A&&O&&O.name!==q&&(F=!0,P=function(){return O.call(this)}),e&&!d||!c&&!F&&I[a]||i(I,a,P),n[p]=P,n[m]=y,v)if(x={values:A?P:j(q),keys:w?P:j(l),entries:z},d)for(b in x)b in I||t(I,b,x[b]);else r(r.P+r.F*(c||F),p,x);return x};
|
||
},{"./_library":"Nw1e","./_export":"NjVL","./_redefine":"2l2h","./_hide":"i5RL","./_iterators":"oANp","./_iter-create":"O1PE","./_set-to-string-tag":"iqAm","./_object-gpo":"kbAb","./_wks":"3Mgd"}],"Wu89":[function(require,module,exports) {
|
||
"use strict";var i=require("./_string-at")(!0);require("./_iter-define")(String,"String",function(i){this._t=String(i),this._i=0},function(){var t,e=this._t,n=this._i;return n>=e.length?{value:void 0,done:!0}:(t=i(e,n),this._i+=t.length,{value:t,done:!1})});
|
||
},{"./_string-at":"Bi/T","./_iter-define":"kgNZ"}],"P7ku":[function(require,module,exports) {
|
||
"use strict";var r=require("./_export"),t=require("./_string-at")(!1);r(r.P,"String",{codePointAt:function(r){return t(this,r)}});
|
||
},{"./_export":"NjVL","./_string-at":"Bi/T"}],"g8m6":[function(require,module,exports) {
|
||
var e=require("./_is-object"),r=require("./_cof"),i=require("./_wks")("match");module.exports=function(o){var u;return e(o)&&(void 0!==(u=o[i])?!!u:"RegExp"==r(o))};
|
||
},{"./_is-object":"6SP6","./_cof":"viv7","./_wks":"3Mgd"}],"xR/t":[function(require,module,exports) {
|
||
var e=require("./_is-regexp"),r=require("./_defined");module.exports=function(i,t,n){if(e(t))throw TypeError("String#"+n+" doesn't accept regex!");return String(r(i))};
|
||
},{"./_is-regexp":"g8m6","./_defined":"Zcur"}],"ed2d":[function(require,module,exports) {
|
||
var r=require("./_wks")("match");module.exports=function(t){var c=/./;try{"/./"[t](c)}catch(e){try{return c[r]=!1,!"/./"[t](c)}catch(a){}}return!0};
|
||
},{"./_wks":"3Mgd"}],"MUpt":[function(require,module,exports) {
|
||
"use strict";var e=require("./_export"),t=require("./_to-length"),i=require("./_string-context"),r="endsWith",n=""[r];e(e.P+e.F*require("./_fails-is-regexp")(r),"String",{endsWith:function(e){var s=i(this,e,r),g=arguments.length>1?arguments[1]:void 0,h=t(s.length),l=void 0===g?h:Math.min(t(g),h),u=String(e);return n?n.call(s,u,l):s.slice(l-u.length,l)===u}});
|
||
},{"./_export":"NjVL","./_to-length":"HdKs","./_string-context":"xR/t","./_fails-is-regexp":"ed2d"}],"IvzQ":[function(require,module,exports) {
|
||
"use strict";var e=require("./_export"),i=require("./_string-context"),r="includes";e(e.P+e.F*require("./_fails-is-regexp")(r),"String",{includes:function(e){return!!~i(this,e,r).indexOf(e,arguments.length>1?arguments[1]:void 0)}});
|
||
},{"./_export":"NjVL","./_string-context":"xR/t","./_fails-is-regexp":"ed2d"}],"s8Pp":[function(require,module,exports) {
|
||
var r=require("./_export");r(r.P,"String",{repeat:require("./_string-repeat")});
|
||
},{"./_export":"NjVL","./_string-repeat":"ezM6"}],"hSvU":[function(require,module,exports) {
|
||
"use strict";var t=require("./_export"),r=require("./_to-length"),e=require("./_string-context"),i="startsWith",n=""[i];t(t.P+t.F*require("./_fails-is-regexp")(i),"String",{startsWith:function(t){var s=e(this,t,i),g=r(Math.min(arguments.length>1?arguments[1]:void 0,s.length)),h=String(t);return n?n.call(s,h,g):s.slice(g,g+h.length)===h}});
|
||
},{"./_export":"NjVL","./_to-length":"HdKs","./_string-context":"xR/t","./_fails-is-regexp":"ed2d"}],"7SUa":[function(require,module,exports) {
|
||
var r=require("./_export"),e=require("./_fails"),t=require("./_defined"),n=/"/g,i=function(r,e,i,u){var o=String(t(r)),a="<"+e;return""!==i&&(a+=" "+i+'="'+String(u).replace(n,""")+'"'),a+">"+o+"</"+e+">"};module.exports=function(t,n){var u={};u[t]=n(i),r(r.P+r.F*e(function(){var r=""[t]('"');return r!==r.toLowerCase()||r.split('"').length>3}),"String",u)};
|
||
},{"./_export":"NjVL","./_fails":"e5T+","./_defined":"Zcur"}],"Qidu":[function(require,module,exports) {
|
||
"use strict";require("./_string-html")("anchor",function(n){return function(r){return n(this,"a","name",r)}});
|
||
},{"./_string-html":"7SUa"}],"8zi4":[function(require,module,exports) {
|
||
"use strict";require("./_string-html")("big",function(t){return function(){return t(this,"big","","")}});
|
||
},{"./_string-html":"7SUa"}],"t+Da":[function(require,module,exports) {
|
||
"use strict";require("./_string-html")("blink",function(n){return function(){return n(this,"blink","","")}});
|
||
},{"./_string-html":"7SUa"}],"3VlC":[function(require,module,exports) {
|
||
"use strict";require("./_string-html")("bold",function(t){return function(){return t(this,"b","","")}});
|
||
},{"./_string-html":"7SUa"}],"BahM":[function(require,module,exports) {
|
||
"use strict";require("./_string-html")("fixed",function(t){return function(){return t(this,"tt","","")}});
|
||
},{"./_string-html":"7SUa"}],"f6mn":[function(require,module,exports) {
|
||
"use strict";require("./_string-html")("fontcolor",function(t){return function(r){return t(this,"font","color",r)}});
|
||
},{"./_string-html":"7SUa"}],"Du0n":[function(require,module,exports) {
|
||
"use strict";require("./_string-html")("fontsize",function(t){return function(n){return t(this,"font","size",n)}});
|
||
},{"./_string-html":"7SUa"}],"EmZX":[function(require,module,exports) {
|
||
"use strict";require("./_string-html")("italics",function(t){return function(){return t(this,"i","","")}});
|
||
},{"./_string-html":"7SUa"}],"mlNr":[function(require,module,exports) {
|
||
"use strict";require("./_string-html")("link",function(r){return function(t){return r(this,"a","href",t)}});
|
||
},{"./_string-html":"7SUa"}],"QeD6":[function(require,module,exports) {
|
||
"use strict";require("./_string-html")("small",function(t){return function(){return t(this,"small","","")}});
|
||
},{"./_string-html":"7SUa"}],"+ny4":[function(require,module,exports) {
|
||
"use strict";require("./_string-html")("strike",function(t){return function(){return t(this,"strike","","")}});
|
||
},{"./_string-html":"7SUa"}],"Pvqx":[function(require,module,exports) {
|
||
"use strict";require("./_string-html")("sub",function(t){return function(){return t(this,"sub","","")}});
|
||
},{"./_string-html":"7SUa"}],"mRpz":[function(require,module,exports) {
|
||
"use strict";require("./_string-html")("sup",function(t){return function(){return t(this,"sup","","")}});
|
||
},{"./_string-html":"7SUa"}],"qW2d":[function(require,module,exports) {
|
||
var e=require("./_export");e(e.S,"Date",{now:function(){return(new Date).getTime()}});
|
||
},{"./_export":"NjVL"}],"DLwC":[function(require,module,exports) {
|
||
"use strict";var t=require("./_export"),e=require("./_to-object"),r=require("./_to-primitive");t(t.P+t.F*require("./_fails")(function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})}),"Date",{toJSON:function(t){var i=e(this),n=r(i);return"number"!=typeof n||isFinite(n)?i.toISOString():null}});
|
||
},{"./_export":"NjVL","./_to-object":"4JfJ","./_to-primitive":"PUNq","./_fails":"e5T+"}],"L3vj":[function(require,module,exports) {
|
||
"use strict";var t=require("./_fails"),e=Date.prototype.getTime,i=Date.prototype.toISOString,n=function(t){return t>9?t:"0"+t};module.exports=t(function(){return"0385-07-25T07:06:39.999Z"!=i.call(new Date(-5e13-1))})||!t(function(){i.call(new Date(NaN))})?function(){if(!isFinite(e.call(this)))throw RangeError("Invalid time value");var t=this,i=t.getUTCFullYear(),r=t.getUTCMilliseconds(),a=i<0?"-":i>9999?"+":"";return a+("00000"+Math.abs(i)).slice(a?-6:-4)+"-"+n(t.getUTCMonth()+1)+"-"+n(t.getUTCDate())+"T"+n(t.getUTCHours())+":"+n(t.getUTCMinutes())+":"+n(t.getUTCSeconds())+"."+(r>99?r:"0"+n(r))+"Z"}:i;
|
||
},{"./_fails":"e5T+"}],"Q9dY":[function(require,module,exports) {
|
||
var t=require("./_export"),r=require("./_date-to-iso-string");t(t.P+t.F*(Date.prototype.toISOString!==r),"Date",{toISOString:r});
|
||
},{"./_export":"NjVL","./_date-to-iso-string":"L3vj"}],"A8WX":[function(require,module,exports) {
|
||
var e=Date.prototype,t="Invalid Date",a="toString",r=e[a],i=e.getTime;new Date(NaN)+""!=t&&require("./_redefine")(e,a,function(){var e=i.call(this);return e==e?r.call(this):t});
|
||
},{"./_redefine":"2l2h"}],"p7vl":[function(require,module,exports) {
|
||
"use strict";var r=require("./_an-object"),e=require("./_to-primitive"),t="number";module.exports=function(i){if("string"!==i&&i!==t&&"default"!==i)throw TypeError("Incorrect hint");return e(r(this),i!=t)};
|
||
},{"./_an-object":"DBsB","./_to-primitive":"PUNq"}],"jJtq":[function(require,module,exports) {
|
||
var e=require("./_wks")("toPrimitive"),i=Date.prototype;e in i||require("./_hide")(i,e,require("./_date-to-primitive"));
|
||
},{"./_wks":"3Mgd","./_hide":"i5RL","./_date-to-primitive":"p7vl"}],"OdQU":[function(require,module,exports) {
|
||
var r=require("./_export");r(r.S,"Array",{isArray:require("./_is-array")});
|
||
},{"./_export":"NjVL","./_is-array":"Osm+"}],"pqj2":[function(require,module,exports) {
|
||
var r=require("./_an-object");module.exports=function(t,e,o,a){try{return a?e(r(o)[0],o[1]):e(o)}catch(n){var c=t.return;throw void 0!==c&&r(c.call(t)),n}};
|
||
},{"./_an-object":"DBsB"}],"DsPZ":[function(require,module,exports) {
|
||
var r=require("./_iterators"),e=require("./_wks")("iterator"),t=Array.prototype;module.exports=function(o){return void 0!==o&&(r.Array===o||t[e]===o)};
|
||
},{"./_iterators":"oANp","./_wks":"3Mgd"}],"WfCN":[function(require,module,exports) {
|
||
"use strict";var e=require("./_object-dp"),r=require("./_property-desc");module.exports=function(t,i,o){i in t?e.f(t,i,r(0,o)):t[i]=o};
|
||
},{"./_object-dp":"/+wv","./_property-desc":"B9+e"}],"kX9y":[function(require,module,exports) {
|
||
var r=require("./_classof"),e=require("./_wks")("iterator"),t=require("./_iterators");module.exports=require("./_core").getIteratorMethod=function(o){if(null!=o)return o[e]||o["@@iterator"]||t[r(o)]};
|
||
},{"./_classof":"jP8S","./_wks":"3Mgd","./_iterators":"oANp","./_core":"4KVo"}],"7Pd7":[function(require,module,exports) {
|
||
var r=require("./_wks")("iterator"),t=!1;try{var n=[7][r]();n.return=function(){t=!0},Array.from(n,function(){throw 2})}catch(e){}module.exports=function(n,u){if(!u&&!t)return!1;var o=!1;try{var c=[7],a=c[r]();a.next=function(){return{done:o=!0}},c[r]=function(){return a},n(c)}catch(e){}return o};
|
||
},{"./_wks":"3Mgd"}],"hO+0":[function(require,module,exports) {
|
||
"use strict";var e=require("./_ctx"),r=require("./_export"),t=require("./_to-object"),i=require("./_iter-call"),o=require("./_is-array-iter"),u=require("./_to-length"),n=require("./_create-property"),a=require("./core.get-iterator-method");r(r.S+r.F*!require("./_iter-detect")(function(e){Array.from(e)}),"Array",{from:function(r){var l,c,f,q,_=t(r),h="function"==typeof this?this:Array,v=arguments.length,y=v>1?arguments[1]:void 0,d=void 0!==y,s=0,g=a(_);if(d&&(y=e(y,v>2?arguments[2]:void 0,2)),null==g||h==Array&&o(g))for(c=new h(l=u(_.length));l>s;s++)n(c,s,d?y(_[s],s):_[s]);else for(q=g.call(_),c=new h;!(f=q.next()).done;s++)n(c,s,d?i(q,y,[f.value,s],!0):f.value);return c.length=s,c}});
|
||
},{"./_ctx":"N9ch","./_export":"NjVL","./_to-object":"4JfJ","./_iter-call":"pqj2","./_is-array-iter":"DsPZ","./_to-length":"HdKs","./_create-property":"WfCN","./core.get-iterator-method":"kX9y","./_iter-detect":"7Pd7"}],"ARIR":[function(require,module,exports) {
|
||
"use strict";var r=require("./_export"),e=require("./_create-property");r(r.S+r.F*require("./_fails")(function(){function r(){}return!(Array.of.call(r)instanceof r)}),"Array",{of:function(){for(var r=0,t=arguments.length,n=new("function"==typeof this?this:Array)(t);t>r;)e(n,r,arguments[r++]);return n.length=t,n}});
|
||
},{"./_export":"NjVL","./_create-property":"WfCN","./_fails":"e5T+"}],"+FL6":[function(require,module,exports) {
|
||
"use strict";var l=require("./_fails");module.exports=function(n,u){return!!n&&l(function(){u?n.call(null,function(){},1):n.call(null)})};
|
||
},{"./_fails":"e5T+"}],"6e5f":[function(require,module,exports) {
|
||
"use strict";var r=require("./_export"),e=require("./_to-iobject"),i=[].join;r(r.P+r.F*(require("./_iobject")!=Object||!require("./_strict-method")(i)),"Array",{join:function(r){return i.call(e(this),void 0===r?",":r)}});
|
||
},{"./_export":"NjVL","./_to-iobject":"mwRI","./_iobject":"kZKK","./_strict-method":"+FL6"}],"TSa/":[function(require,module,exports) {
|
||
"use strict";var r=require("./_export"),e=require("./_html"),i=require("./_cof"),t=require("./_to-absolute-index"),u=require("./_to-length"),a=[].slice;r(r.P+r.F*require("./_fails")(function(){e&&a.call(e)}),"Array",{slice:function(r,e){var l=u(this.length),n=i(this);if(e=void 0===e?l:e,"Array"==n)return a.call(this,r,e);for(var s=t(r,l),c=t(e,l),h=u(c-s),o=new Array(h),f=0;f<h;f++)o[f]="String"==n?this.charAt(s+f):this[s+f];return o}});
|
||
},{"./_export":"NjVL","./_html":"DBa9","./_cof":"viv7","./_to-absolute-index":"AXg2","./_to-length":"HdKs","./_fails":"e5T+"}],"xw8W":[function(require,module,exports) {
|
||
"use strict";var r=require("./_export"),t=require("./_a-function"),i=require("./_to-object"),e=require("./_fails"),o=[].sort,u=[1,2,3];r(r.P+r.F*(e(function(){u.sort(void 0)})||!e(function(){u.sort(null)})||!require("./_strict-method")(o)),"Array",{sort:function(r){return void 0===r?o.call(i(this)):o.call(i(this),t(r))}});
|
||
},{"./_export":"NjVL","./_a-function":"L6p4","./_to-object":"4JfJ","./_fails":"e5T+","./_strict-method":"+FL6"}],"UWRR":[function(require,module,exports) {
|
||
var r=require("./_is-object"),e=require("./_is-array"),o=require("./_wks")("species");module.exports=function(i){var t;return e(i)&&("function"!=typeof(t=i.constructor)||t!==Array&&!e(t.prototype)||(t=void 0),r(t)&&null===(t=t[o])&&(t=void 0)),void 0===t?Array:t};
|
||
},{"./_is-object":"6SP6","./_is-array":"Osm+","./_wks":"3Mgd"}],"yi52":[function(require,module,exports) {
|
||
var r=require("./_array-species-constructor");module.exports=function(e,n){return new(r(e))(n)};
|
||
},{"./_array-species-constructor":"UWRR"}],"H/1n":[function(require,module,exports) {
|
||
var e=require("./_ctx"),r=require("./_iobject"),t=require("./_to-object"),i=require("./_to-length"),u=require("./_array-species-create");module.exports=function(n,c){var s=1==n,a=2==n,o=3==n,f=4==n,l=6==n,q=5==n||l,_=c||u;return function(u,c,h){for(var v,p,b=t(u),d=r(b),g=e(c,h,3),j=i(d.length),x=0,m=s?_(u,j):a?_(u,0):void 0;j>x;x++)if((q||x in d)&&(p=g(v=d[x],x,b),n))if(s)m[x]=p;else if(p)switch(n){case 3:return!0;case 5:return v;case 6:return x;case 2:m.push(v)}else if(f)return!1;return l?-1:o||f?f:m}};
|
||
},{"./_ctx":"N9ch","./_iobject":"kZKK","./_to-object":"4JfJ","./_to-length":"HdKs","./_array-species-create":"yi52"}],"bomu":[function(require,module,exports) {
|
||
"use strict";var r=require("./_export"),e=require("./_array-methods")(0),t=require("./_strict-method")([].forEach,!0);r(r.P+r.F*!t,"Array",{forEach:function(r){return e(this,r,arguments[1])}});
|
||
},{"./_export":"NjVL","./_array-methods":"H/1n","./_strict-method":"+FL6"}],"4+P4":[function(require,module,exports) {
|
||
"use strict";var r=require("./_export"),e=require("./_array-methods")(1);r(r.P+r.F*!require("./_strict-method")([].map,!0),"Array",{map:function(r){return e(this,r,arguments[1])}});
|
||
},{"./_export":"NjVL","./_array-methods":"H/1n","./_strict-method":"+FL6"}],"kLvk":[function(require,module,exports) {
|
||
"use strict";var r=require("./_export"),e=require("./_array-methods")(2);r(r.P+r.F*!require("./_strict-method")([].filter,!0),"Array",{filter:function(r){return e(this,r,arguments[1])}});
|
||
},{"./_export":"NjVL","./_array-methods":"H/1n","./_strict-method":"+FL6"}],"jLap":[function(require,module,exports) {
|
||
"use strict";var r=require("./_export"),e=require("./_array-methods")(3);r(r.P+r.F*!require("./_strict-method")([].some,!0),"Array",{some:function(r){return e(this,r,arguments[1])}});
|
||
},{"./_export":"NjVL","./_array-methods":"H/1n","./_strict-method":"+FL6"}],"KLYK":[function(require,module,exports) {
|
||
"use strict";var r=require("./_export"),e=require("./_array-methods")(4);r(r.P+r.F*!require("./_strict-method")([].every,!0),"Array",{every:function(r){return e(this,r,arguments[1])}});
|
||
},{"./_export":"NjVL","./_array-methods":"H/1n","./_strict-method":"+FL6"}],"vp63":[function(require,module,exports) {
|
||
var r=require("./_a-function"),e=require("./_to-object"),i=require("./_iobject"),o=require("./_to-length");module.exports=function(t,n,u,a,f){r(n);var c=e(t),l=i(c),h=o(c.length),q=f?h-1:0,_=f?-1:1;if(u<2)for(;;){if(q in l){a=l[q],q+=_;break}if(q+=_,f?q<0:h<=q)throw TypeError("Reduce of empty array with no initial value")}for(;f?q>=0:h>q;q+=_)q in l&&(a=n(a,l[q],q,c));return a};
|
||
},{"./_a-function":"L6p4","./_to-object":"4JfJ","./_iobject":"kZKK","./_to-length":"HdKs"}],"d/Z7":[function(require,module,exports) {
|
||
"use strict";var r=require("./_export"),e=require("./_array-reduce");r(r.P+r.F*!require("./_strict-method")([].reduce,!0),"Array",{reduce:function(r){return e(this,r,arguments.length,arguments[1],!1)}});
|
||
},{"./_export":"NjVL","./_array-reduce":"vp63","./_strict-method":"+FL6"}],"Wzw6":[function(require,module,exports) {
|
||
"use strict";var r=require("./_export"),e=require("./_array-reduce");r(r.P+r.F*!require("./_strict-method")([].reduceRight,!0),"Array",{reduceRight:function(r){return e(this,r,arguments.length,arguments[1],!0)}});
|
||
},{"./_export":"NjVL","./_array-reduce":"vp63","./_strict-method":"+FL6"}],"jGln":[function(require,module,exports) {
|
||
"use strict";var r=require("./_export"),e=require("./_array-includes")(!1),i=[].indexOf,t=!!i&&1/[1].indexOf(1,-0)<0;r(r.P+r.F*(t||!require("./_strict-method")(i)),"Array",{indexOf:function(r){return t?i.apply(this,arguments)||0:e(this,r,arguments[1])}});
|
||
},{"./_export":"NjVL","./_array-includes":"/dIP","./_strict-method":"+FL6"}],"5iGR":[function(require,module,exports) {
|
||
"use strict";var e=require("./_export"),r=require("./_to-iobject"),t=require("./_to-integer"),i=require("./_to-length"),n=[].lastIndexOf,u=!!n&&1/[1].lastIndexOf(1,-0)<0;e(e.P+e.F*(u||!require("./_strict-method")(n)),"Array",{lastIndexOf:function(e){if(u)return n.apply(this,arguments)||0;var a=r(this),o=i(a.length),s=o-1;for(arguments.length>1&&(s=Math.min(s,t(arguments[1]))),s<0&&(s=o+s);s>=0;s--)if(s in a&&a[s]===e)return s||0;return-1}});
|
||
},{"./_export":"NjVL","./_to-iobject":"mwRI","./_to-integer":"cHfm","./_to-length":"HdKs","./_strict-method":"+FL6"}],"okFf":[function(require,module,exports) {
|
||
"use strict";var e=require("./_to-object"),t=require("./_to-absolute-index"),i=require("./_to-length");module.exports=[].copyWithin||function(r,o){var n=e(this),u=i(n.length),h=t(r,u),l=t(o,u),d=arguments.length>2?arguments[2]:void 0,s=Math.min((void 0===d?u:t(d,u))-l,u-h),a=1;for(l<h&&h<l+s&&(a=-1,l+=s-1,h+=s-1);s-- >0;)l in n?n[h]=n[l]:delete n[h],h+=a,l+=a;return n};
|
||
},{"./_to-object":"4JfJ","./_to-absolute-index":"AXg2","./_to-length":"HdKs"}],"PxQA":[function(require,module,exports) {
|
||
var e=require("./_wks")("unscopables"),r=Array.prototype;null==r[e]&&require("./_hide")(r,e,{}),module.exports=function(o){r[e][o]=!0};
|
||
},{"./_wks":"3Mgd","./_hide":"i5RL"}],"8vJR":[function(require,module,exports) {
|
||
var r=require("./_export");r(r.P,"Array",{copyWithin:require("./_array-copy-within")}),require("./_add-to-unscopables")("copyWithin");
|
||
},{"./_export":"NjVL","./_array-copy-within":"okFf","./_add-to-unscopables":"PxQA"}],"UYMr":[function(require,module,exports) {
|
||
"use strict";var e=require("./_to-object"),t=require("./_to-absolute-index"),r=require("./_to-length");module.exports=function(o){for(var i=e(this),u=r(i.length),n=arguments.length,d=t(n>1?arguments[1]:void 0,u),l=n>2?arguments[2]:void 0,s=void 0===l?u:t(l,u);s>d;)i[d++]=o;return i};
|
||
},{"./_to-object":"4JfJ","./_to-absolute-index":"AXg2","./_to-length":"HdKs"}],"3fHC":[function(require,module,exports) {
|
||
var r=require("./_export");r(r.P,"Array",{fill:require("./_array-fill")}),require("./_add-to-unscopables")("fill");
|
||
},{"./_export":"NjVL","./_array-fill":"UYMr","./_add-to-unscopables":"PxQA"}],"+HBF":[function(require,module,exports) {
|
||
"use strict";var r=require("./_export"),e=require("./_array-methods")(5),i="find",n=!0;i in[]&&Array(1)[i](function(){n=!1}),r(r.P+r.F*n,"Array",{find:function(r){return e(this,r,arguments.length>1?arguments[1]:void 0)}}),require("./_add-to-unscopables")(i);
|
||
},{"./_export":"NjVL","./_array-methods":"H/1n","./_add-to-unscopables":"PxQA"}],"3xRc":[function(require,module,exports) {
|
||
"use strict";var r=require("./_export"),e=require("./_array-methods")(6),n="findIndex",i=!0;n in[]&&Array(1)[n](function(){i=!1}),r(r.P+r.F*i,"Array",{findIndex:function(r){return e(this,r,arguments.length>1?arguments[1]:void 0)}}),require("./_add-to-unscopables")(n);
|
||
},{"./_export":"NjVL","./_array-methods":"H/1n","./_add-to-unscopables":"PxQA"}],"Bn5Q":[function(require,module,exports) {
|
||
|
||
"use strict";var e=require("./_global"),r=require("./_object-dp"),i=require("./_descriptors"),t=require("./_wks")("species");module.exports=function(u){var s=e[u];i&&s&&!s[t]&&r.f(s,t,{configurable:!0,get:function(){return this}})};
|
||
},{"./_global":"kql1","./_object-dp":"/+wv","./_descriptors":"ZJLI","./_wks":"3Mgd"}],"Smp7":[function(require,module,exports) {
|
||
require("./_set-species")("Array");
|
||
},{"./_set-species":"Bn5Q"}],"t4Zd":[function(require,module,exports) {
|
||
module.exports=function(e,n){return{value:n,done:!!e}};
|
||
},{}],"2xsA":[function(require,module,exports) {
|
||
"use strict";var e=require("./_add-to-unscopables"),r=require("./_iter-step"),t=require("./_iterators"),i=require("./_to-iobject");module.exports=require("./_iter-define")(Array,"Array",function(e,r){this._t=i(e),this._i=0,this._k=r},function(){var e=this._t,t=this._k,i=this._i++;return!e||i>=e.length?(this._t=void 0,r(1)):r(0,"keys"==t?i:"values"==t?e[i]:[i,e[i]])},"values"),t.Arguments=t.Array,e("keys"),e("values"),e("entries");
|
||
},{"./_add-to-unscopables":"PxQA","./_iter-step":"t4Zd","./_iterators":"oANp","./_to-iobject":"mwRI","./_iter-define":"kgNZ"}],"aRjg":[function(require,module,exports) {
|
||
"use strict";var e=require("./_an-object");module.exports=function(){var i=e(this),r="";return i.global&&(r+="g"),i.ignoreCase&&(r+="i"),i.multiline&&(r+="m"),i.unicode&&(r+="u"),i.sticky&&(r+="y"),r};
|
||
},{"./_an-object":"DBsB"}],"hBwo":[function(require,module,exports) {
|
||
|
||
var e=require("./_global"),r=require("./_inherit-if-required"),i=require("./_object-dp").f,t=require("./_object-gopn").f,n=require("./_is-regexp"),o=require("./_flags"),u=e.RegExp,c=u,s=u.prototype,f=/a/g,a=/a/g,g=new u(f)!==f;if(require("./_descriptors")&&(!g||require("./_fails")(function(){return a[require("./_wks")("match")]=!1,u(f)!=f||u(a)==a||"/a/i"!=u(f,"i")}))){u=function(e,i){var t=this instanceof u,f=n(e),a=void 0===i;return!t&&f&&e.constructor===u&&a?e:r(g?new c(f&&!a?e.source:e,i):c((f=e instanceof u)?e.source:e,f&&a?o.call(e):i),t?this:s,u)};for(var p=function(e){e in u||i(u,e,{configurable:!0,get:function(){return c[e]},set:function(r){c[e]=r}})},q=t(c),_=0;q.length>_;)p(q[_++]);s.constructor=u,u.prototype=s,require("./_redefine")(e,"RegExp",u)}require("./_set-species")("RegExp");
|
||
},{"./_global":"kql1","./_inherit-if-required":"oEgy","./_object-dp":"/+wv","./_object-gopn":"yyy+","./_is-regexp":"g8m6","./_flags":"aRjg","./_descriptors":"ZJLI","./_fails":"e5T+","./_wks":"3Mgd","./_redefine":"2l2h","./_set-species":"Bn5Q"}],"a7p6":[function(require,module,exports) {
|
||
"use strict";var e=require("./_flags"),l=RegExp.prototype.exec,t=String.prototype.replace,r=l,a="lastIndex",n=function(){var e=/a/,t=/b*/g;return l.call(e,"a"),l.call(t,"a"),0!==e[a]||0!==t[a]}(),o=void 0!==/()??/.exec("")[1],c=n||o;c&&(r=function(r){var c,i,g,u,p=this;return o&&(i=new RegExp("^"+p.source+"$(?!\\s)",e.call(p))),n&&(c=p[a]),g=l.call(p,r),n&&g&&(p[a]=p.global?g.index+g[0].length:c),o&&g&&g.length>1&&t.call(g[0],i,function(){for(u=1;u<arguments.length-2;u++)void 0===arguments[u]&&(g[u]=void 0)}),g}),module.exports=r;
|
||
},{"./_flags":"aRjg"}],"ej7E":[function(require,module,exports) {
|
||
"use strict";var e=require("./_regexp-exec");require("./_export")({target:"RegExp",proto:!0,forced:e!==/./.exec},{exec:e});
|
||
},{"./_regexp-exec":"a7p6","./_export":"NjVL"}],"57SA":[function(require,module,exports) {
|
||
require("./_descriptors")&&"g"!=/./g.flags&&require("./_object-dp").f(RegExp.prototype,"flags",{configurable:!0,get:require("./_flags")});
|
||
},{"./_descriptors":"ZJLI","./_object-dp":"/+wv","./_flags":"aRjg"}],"yEH7":[function(require,module,exports) {
|
||
|
||
"use strict";require("./es6.regexp.flags");var e=require("./_an-object"),r=require("./_flags"),i=require("./_descriptors"),n="toString",t=/./[n],a=function(e){require("./_redefine")(RegExp.prototype,n,e,!0)};require("./_fails")(function(){return"/a/b"!=t.call({source:"a",flags:"b"})})?a(function(){var n=e(this);return"/".concat(n.source,"/","flags"in n?n.flags:!i&&n instanceof RegExp?r.call(n):void 0)}):t.name!=n&&a(function(){return t.call(this)});
|
||
},{"./es6.regexp.flags":"57SA","./_an-object":"DBsB","./_flags":"aRjg","./_descriptors":"ZJLI","./_redefine":"2l2h","./_fails":"e5T+"}],"aXI/":[function(require,module,exports) {
|
||
"use strict";var r=require("./_string-at")(!0);module.exports=function(t,e,n){return e+(n?r(t,e).length:1)};
|
||
},{"./_string-at":"Bi/T"}],"1G0T":[function(require,module,exports) {
|
||
"use strict";var e=require("./_classof"),r=RegExp.prototype.exec;module.exports=function(t,o){var c=t.exec;if("function"==typeof c){var n=c.call(t,o);if("object"!=typeof n)throw new TypeError("RegExp exec method returned something other than an Object or null");return n}if("RegExp"!==e(t))throw new TypeError("RegExp#exec called on incompatible receiver");return r.call(t,o)};
|
||
},{"./_classof":"jP8S"}],"w7ZK":[function(require,module,exports) {
|
||
"use strict";require("./es6.regexp.exec");var e=require("./_redefine"),r=require("./_hide"),n=require("./_fails"),t=require("./_defined"),u=require("./_wks"),i=require("./_regexp-exec"),c=u("species"),o=!n(function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}),a=function(){var e=/(?:)/,r=e.exec;e.exec=function(){return r.apply(this,arguments)};var n="ab".split(e);return 2===n.length&&"a"===n[0]&&"b"===n[1]}();module.exports=function(l,f,p){var s=u(l),v=!n(function(){var e={};return e[s]=function(){return 7},7!=""[l](e)}),x=v?!n(function(){var e=!1,r=/a/;return r.exec=function(){return e=!0,null},"split"===l&&(r.constructor={},r.constructor[c]=function(){return r}),r[s](""),!e}):void 0;if(!v||!x||"replace"===l&&!o||"split"===l&&!a){var d=/./[s],q=p(t,s,""[l],function(e,r,n,t,u){return r.exec===i?v&&!u?{done:!0,value:d.call(r,n,t)}:{done:!0,value:e.call(n,r,t)}:{done:!1}}),g=q[0],_=q[1];e(String.prototype,l,g),r(RegExp.prototype,s,2==f?function(e,r){return _.call(e,this,r)}:function(e){return _.call(e,this)})}};
|
||
},{"./es6.regexp.exec":"ej7E","./_redefine":"2l2h","./_hide":"i5RL","./_fails":"e5T+","./_defined":"Zcur","./_wks":"3Mgd","./_regexp-exec":"a7p6"}],"yikX":[function(require,module,exports) {
|
||
"use strict";var r=require("./_an-object"),e=require("./_to-length"),n=require("./_advance-string-index"),t=require("./_regexp-exec-abstract");require("./_fix-re-wks")("match",1,function(i,a,u,l){return[function(r){var e=i(this),n=null==r?void 0:r[a];return void 0!==n?n.call(r,e):new RegExp(r)[a](String(e))},function(i){var a=l(u,i,this);if(a.done)return a.value;var c=r(i),o=String(this);if(!c.global)return t(c,o);var s=c.unicode;c.lastIndex=0;for(var v,d=[],g=0;null!==(v=t(c,o));){var x=String(v[0]);d[g]=x,""===x&&(c.lastIndex=n(o,e(c.lastIndex),s)),g++}return 0===g?null:d}]});
|
||
},{"./_an-object":"DBsB","./_to-length":"HdKs","./_advance-string-index":"aXI/","./_regexp-exec-abstract":"1G0T","./_fix-re-wks":"w7ZK"}],"eUHu":[function(require,module,exports) {
|
||
var global = arguments[3];
|
||
var r=arguments[3],e=require("./_an-object"),t=require("./_to-object"),n=require("./_to-length"),i=require("./_to-integer"),a=require("./_advance-string-index"),u=require("./_regexp-exec-abstract"),c=Math.max,l=Math.min,o=Math.floor,v=/\$([$&`']|\d\d?|<[^>]*>)/g,s=/\$([$&`']|\d\d?)/g,g=function(r){return void 0===r?r:String(r)};require("./_fix-re-wks")("replace",2,function(r,d,f,h){return[function(e,t){var n=r(this),i=null==e?void 0:e[d];return void 0!==i?i.call(e,n,t):f.call(String(n),e,t)},function(r,t){var o=h(f,r,this,t);if(o.done)return o.value;var v=e(r),s=String(this),d="function"==typeof t;d||(t=String(t));var x=v.global;if(x){var b=v.unicode;v.lastIndex=0}for(var q=[];;){var S=u(v,s);if(null===S)break;if(q.push(S),!x)break;""===String(S[0])&&(v.lastIndex=a(s,n(v.lastIndex),b))}for(var _="",$=0,k=0;k<q.length;k++){S=q[k];for(var m=String(S[0]),A=c(l(i(S.index),s.length),0),I=[],M=1;M<S.length;M++)I.push(g(S[M]));var j=S.groups;if(d){var w=[m].concat(I,A,s);void 0!==j&&w.push(j);var y=String(t.apply(void 0,w))}else y=p(m,s,A,I,j,t);A>=$&&(_+=s.slice($,A)+y,$=A+m.length)}return _+s.slice($)}];function p(r,e,n,i,a,u){var c=n+r.length,l=i.length,g=s;return void 0!==a&&(a=t(a),g=v),f.call(u,g,function(t,u){var v;switch(u.charAt(0)){case"$":return"$";case"&":return r;case"`":return e.slice(0,n);case"'":return e.slice(c);case"<":v=a[u.slice(1,-1)];break;default:var s=+u;if(0===s)return t;if(s>l){var g=o(s/10);return 0===g?t:g<=l?void 0===i[g-1]?u.charAt(1):i[g-1]+u.charAt(1):t}v=i[s-1]}return void 0===v?"":v})}});
|
||
},{"./_an-object":"DBsB","./_to-object":"4JfJ","./_to-length":"HdKs","./_to-integer":"cHfm","./_advance-string-index":"aXI/","./_regexp-exec-abstract":"1G0T","./_fix-re-wks":"w7ZK"}],"iHvG":[function(require,module,exports) {
|
||
"use strict";var e=require("./_an-object"),r=require("./_same-value"),n=require("./_regexp-exec-abstract");require("./_fix-re-wks")("search",1,function(t,i,a,u){return[function(e){var r=t(this),n=null==e?void 0:e[i];return void 0!==n?n.call(e,r):new RegExp(e)[i](String(r))},function(t){var i=u(a,t,this);if(i.done)return i.value;var s=e(t),l=String(this),c=s.lastIndex;r(c,0)||(s.lastIndex=0);var v=n(s,l);return r(s.lastIndex,c)||(s.lastIndex=c),null===v?-1:v.index}]});
|
||
},{"./_an-object":"DBsB","./_same-value":"YyyQ","./_regexp-exec-abstract":"1G0T","./_fix-re-wks":"w7ZK"}],"pC8t":[function(require,module,exports) {
|
||
var r=require("./_an-object"),e=require("./_a-function"),u=require("./_wks")("species");module.exports=function(n,o){var i,t=r(n).constructor;return void 0===t||null==(i=r(t)[u])?o:e(i)};
|
||
},{"./_an-object":"DBsB","./_a-function":"L6p4","./_wks":"3Mgd"}],"V8KN":[function(require,module,exports) {
|
||
"use strict";var e=require("./_is-regexp"),r=require("./_an-object"),i=require("./_species-constructor"),n=require("./_advance-string-index"),t=require("./_to-length"),u=require("./_regexp-exec-abstract"),l=require("./_regexp-exec"),s=require("./_fails"),c=Math.min,a=[].push,o="split",g="length",h="lastIndex",d=4294967295,f=!s(function(){RegExp(d,"y")});require("./_fix-re-wks")("split",2,function(s,v,p,x){var q;return q="c"=="abbc"[o](/(b)*/)[1]||4!="test"[o](/(?:)/,-1)[g]||2!="ab"[o](/(?:ab)*/)[g]||4!="."[o](/(.?)(.?)/)[g]||"."[o](/()()/)[g]>1||""[o](/.?/)[g]?function(r,i){var n=String(this);if(void 0===r&&0===i)return[];if(!e(r))return p.call(n,r,i);for(var t,u,s,c=[],o=(r.ignoreCase?"i":"")+(r.multiline?"m":"")+(r.unicode?"u":"")+(r.sticky?"y":""),f=0,v=void 0===i?d:i>>>0,x=new RegExp(r.source,o+"g");(t=l.call(x,n))&&!((u=x[h])>f&&(c.push(n.slice(f,t.index)),t[g]>1&&t.index<n[g]&&a.apply(c,t.slice(1)),s=t[0][g],f=u,c[g]>=v));)x[h]===t.index&&x[h]++;return f===n[g]?!s&&x.test("")||c.push(""):c.push(n.slice(f)),c[g]>v?c.slice(0,v):c}:"0"[o](void 0,0)[g]?function(e,r){return void 0===e&&0===r?[]:p.call(this,e,r)}:p,[function(e,r){var i=s(this),n=null==e?void 0:e[v];return void 0!==n?n.call(e,i,r):q.call(String(i),e,r)},function(e,l){var s=x(q,e,this,l,q!==p);if(s.done)return s.value;var a=r(e),o=String(this),g=i(a,RegExp),h=a.unicode,v=(a.ignoreCase?"i":"")+(a.multiline?"m":"")+(a.unicode?"u":"")+(f?"y":"g"),_=new g(f?a:"^(?:"+a.source+")",v),b=void 0===l?d:l>>>0;if(0===b)return[];if(0===o.length)return null===u(_,o)?[o]:[];for(var m=0,y=0,w=[];y<o.length;){_.lastIndex=f?y:0;var E,I=u(_,f?o:o.slice(y));if(null===I||(E=c(t(_.lastIndex+(f?0:y)),o.length))===m)y=n(o,y,h);else{if(w.push(o.slice(m,y)),w.length===b)return w;for(var R=1;R<=I.length-1;R++)if(w.push(I[R]),w.length===b)return w;y=m=E}}return w.push(o.slice(m)),w}]});
|
||
},{"./_is-regexp":"g8m6","./_an-object":"DBsB","./_species-constructor":"pC8t","./_advance-string-index":"aXI/","./_to-length":"HdKs","./_regexp-exec-abstract":"1G0T","./_regexp-exec":"a7p6","./_fails":"e5T+","./_fix-re-wks":"w7ZK"}],"XE1H":[function(require,module,exports) {
|
||
module.exports=function(o,n,r,i){if(!(o instanceof n)||void 0!==i&&i in o)throw TypeError(r+": incorrect invocation!");return o};
|
||
},{}],"Pqba":[function(require,module,exports) {
|
||
var e=require("./_ctx"),r=require("./_iter-call"),t=require("./_is-array-iter"),i=require("./_an-object"),o=require("./_to-length"),n=require("./core.get-iterator-method"),u={},a={},f=module.exports=function(f,l,c,q,_){var h,s,d,g,p=_?function(){return f}:n(f),v=e(c,q,l?2:1),x=0;if("function"!=typeof p)throw TypeError(f+" is not iterable!");if(t(p)){for(h=o(f.length);h>x;x++)if((g=l?v(i(s=f[x])[0],s[1]):v(f[x]))===u||g===a)return g}else for(d=p.call(f);!(s=d.next()).done;)if((g=r(d,v,s.value,l))===u||g===a)return g};f.BREAK=u,f.RETURN=a;
|
||
},{"./_ctx":"N9ch","./_iter-call":"pqj2","./_is-array-iter":"DsPZ","./_an-object":"DBsB","./_to-length":"HdKs","./core.get-iterator-method":"kX9y"}],"sbFn":[function(require,module,exports) {
|
||
|
||
|
||
var e,t,n,i=require("./_ctx"),o=require("./_invoke"),r=require("./_html"),s=require("./_dom-create"),a=require("./_global"),c=a.process,u=a.setImmediate,p=a.clearImmediate,f=a.MessageChannel,l=a.Dispatch,d=0,m={},h="onreadystatechange",g=function(){var e=+this;if(m.hasOwnProperty(e)){var t=m[e];delete m[e],t()}},v=function(e){g.call(e.data)};u&&p||(u=function(t){for(var n=[],i=1;arguments.length>i;)n.push(arguments[i++]);return m[++d]=function(){o("function"==typeof t?t:Function(t),n)},e(d),d},p=function(e){delete m[e]},"process"==require("./_cof")(c)?e=function(e){c.nextTick(i(g,e,1))}:l&&l.now?e=function(e){l.now(i(g,e,1))}:f?(n=(t=new f).port2,t.port1.onmessage=v,e=i(n.postMessage,n,1)):a.addEventListener&&"function"==typeof postMessage&&!a.importScripts?(e=function(e){a.postMessage(e+"","*")},a.addEventListener("message",v,!1)):e=h in s("script")?function(e){r.appendChild(s("script"))[h]=function(){r.removeChild(this),g.call(e)}}:function(e){setTimeout(i(g,e,1),0)}),module.exports={set:u,clear:p};
|
||
},{"./_ctx":"N9ch","./_invoke":"TTev","./_html":"DBa9","./_dom-create":"dDni","./_global":"kql1","./_cof":"viv7"}],"i1H+":[function(require,module,exports) {
|
||
|
||
|
||
var e=require("./_global"),t=require("./_task").set,r=e.MutationObserver||e.WebKitMutationObserver,n=e.process,o=e.Promise,a="process"==require("./_cof")(n);module.exports=function(){var i,c,s,v=function(){var e,t;for(a&&(e=n.domain)&&e.exit();i;){t=i.fn,i=i.next;try{t()}catch(r){throw i?s():c=void 0,r}}c=void 0,e&&e.enter()};if(a)s=function(){n.nextTick(v)};else if(!r||e.navigator&&e.navigator.standalone)if(o&&o.resolve){var u=o.resolve(void 0);s=function(){u.then(v)}}else s=function(){t.call(e,v)};else{var f=!0,l=document.createTextNode("");new r(v).observe(l,{characterData:!0}),s=function(){l.data=f=!f}}return function(e){var t={fn:e,next:void 0};c&&(c.next=t),i||(i=t,s()),c=t}};
|
||
},{"./_global":"kql1","./_task":"sbFn","./_cof":"viv7"}],"Mdjk":[function(require,module,exports) {
|
||
"use strict";var r=require("./_a-function");function e(e){var o,t;this.promise=new e(function(r,e){if(void 0!==o||void 0!==t)throw TypeError("Bad Promise constructor");o=r,t=e}),this.resolve=r(o),this.reject=r(t)}module.exports.f=function(r){return new e(r)};
|
||
},{"./_a-function":"L6p4"}],"5eKV":[function(require,module,exports) {
|
||
module.exports=function(e){try{return{e:!1,v:e()}}catch(r){return{e:!0,v:r}}};
|
||
},{}],"SW/O":[function(require,module,exports) {
|
||
|
||
var e=require("./_global"),r=e.navigator;module.exports=r&&r.userAgent||"";
|
||
},{"./_global":"kql1"}],"bQCN":[function(require,module,exports) {
|
||
var r=require("./_an-object"),e=require("./_is-object"),i=require("./_new-promise-capability");module.exports=function(o,t){if(r(o),e(t)&&t.constructor===o)return t;var u=i.f(o);return(0,u.resolve)(t),u.promise};
|
||
},{"./_an-object":"DBsB","./_is-object":"6SP6","./_new-promise-capability":"Mdjk"}],"5XX7":[function(require,module,exports) {
|
||
var r=require("./_redefine");module.exports=function(e,n,i){for(var o in n)r(e,o,n[o],i);return e};
|
||
},{"./_redefine":"2l2h"}],"ar2B":[function(require,module,exports) {
|
||
|
||
|
||
"use strict";var e,r,t,i,n=require("./_library"),o=require("./_global"),c=require("./_ctx"),s=require("./_classof"),u=require("./_export"),a=require("./_is-object"),_=require("./_a-function"),h=require("./_an-instance"),f=require("./_for-of"),l=require("./_species-constructor"),v=require("./_task").set,d=require("./_microtask")(),p=require("./_new-promise-capability"),m=require("./_perform"),q=require("./_user-agent"),y=require("./_promise-resolve"),j="Promise",w=o.TypeError,g=o.process,x=g&&g.versions,b=x&&x.v8||"",k=o[j],P="process"==s(g),F=function(){},S=r=p.f,E=!!function(){try{var e=k.resolve(1),r=(e.constructor={})[require("./_wks")("species")]=function(e){e(F,F)};return(P||"function"==typeof PromiseRejectionEvent)&&e.then(F)instanceof r&&0!==b.indexOf("6.6")&&-1===q.indexOf("Chrome/66")}catch(t){}}(),O=function(e){var r;return!(!a(e)||"function"!=typeof(r=e.then))&&r},R=function(e,r){if(!e._n){e._n=!0;var t=e._c;d(function(){for(var i=e._v,n=1==e._s,o=0,c=function(r){var t,o,c,s=n?r.ok:r.fail,u=r.resolve,a=r.reject,_=r.domain;try{s?(n||(2==e._h&&H(e),e._h=1),!0===s?t=i:(_&&_.enter(),t=s(i),_&&(_.exit(),c=!0)),t===r.promise?a(w("Promise-chain cycle")):(o=O(t))?o.call(t,u,a):u(t)):a(i)}catch(h){_&&!c&&_.exit(),a(h)}};t.length>o;)c(t[o++]);e._c=[],e._n=!1,r&&!e._h&&C(e)})}},C=function(e){v.call(o,function(){var r,t,i,n=e._v,c=G(e);if(c&&(r=m(function(){P?g.emit("unhandledRejection",n,e):(t=o.onunhandledrejection)?t({promise:e,reason:n}):(i=o.console)&&i.error&&i.error("Unhandled promise rejection",n)}),e._h=P||G(e)?2:1),e._a=void 0,c&&r.e)throw r.v})},G=function(e){return 1!==e._h&&0===(e._a||e._c).length},H=function(e){v.call(o,function(){var r;P?g.emit("rejectionHandled",e):(r=o.onrejectionhandled)&&r({promise:e,reason:e._v})})},T=function(e){var r=this;r._d||(r._d=!0,(r=r._w||r)._v=e,r._s=2,r._a||(r._a=r._c.slice()),R(r,!0))},U=function(e){var r,t=this;if(!t._d){t._d=!0,t=t._w||t;try{if(t===e)throw w("Promise can't be resolved itself");(r=O(e))?d(function(){var i={_w:t,_d:!1};try{r.call(e,c(U,i,1),c(T,i,1))}catch(n){T.call(i,n)}}):(t._v=e,t._s=1,R(t,!1))}catch(i){T.call({_w:t,_d:!1},i)}}};E||(k=function(r){h(this,k,j,"_h"),_(r),e.call(this);try{r(c(U,this,1),c(T,this,1))}catch(t){T.call(this,t)}},(e=function(e){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=require("./_redefine-all")(k.prototype,{then:function(e,r){var t=S(l(this,k));return t.ok="function"!=typeof e||e,t.fail="function"==typeof r&&r,t.domain=P?g.domain:void 0,this._c.push(t),this._a&&this._a.push(t),this._s&&R(this,!1),t.promise},catch:function(e){return this.then(void 0,e)}}),t=function(){var r=new e;this.promise=r,this.resolve=c(U,r,1),this.reject=c(T,r,1)},p.f=S=function(e){return e===k||e===i?new t(e):r(e)}),u(u.G+u.W+u.F*!E,{Promise:k}),require("./_set-to-string-tag")(k,j),require("./_set-species")(j),i=require("./_core")[j],u(u.S+u.F*!E,j,{reject:function(e){var r=S(this);return(0,r.reject)(e),r.promise}}),u(u.S+u.F*(n||!E),j,{resolve:function(e){return y(n&&this===i?k:this,e)}}),u(u.S+u.F*!(E&&require("./_iter-detect")(function(e){k.all(e).catch(F)})),j,{all:function(e){var r=this,t=S(r),i=t.resolve,n=t.reject,o=m(function(){var t=[],o=0,c=1;f(e,!1,function(e){var s=o++,u=!1;t.push(void 0),c++,r.resolve(e).then(function(e){u||(u=!0,t[s]=e,--c||i(t))},n)}),--c||i(t)});return o.e&&n(o.v),t.promise},race:function(e){var r=this,t=S(r),i=t.reject,n=m(function(){f(e,!1,function(e){r.resolve(e).then(t.resolve,i)})});return n.e&&i(n.v),t.promise}});
|
||
},{"./_library":"Nw1e","./_global":"kql1","./_ctx":"N9ch","./_classof":"jP8S","./_export":"NjVL","./_is-object":"6SP6","./_a-function":"L6p4","./_an-instance":"XE1H","./_for-of":"Pqba","./_species-constructor":"pC8t","./_task":"sbFn","./_microtask":"i1H+","./_new-promise-capability":"Mdjk","./_perform":"5eKV","./_user-agent":"SW/O","./_promise-resolve":"bQCN","./_wks":"3Mgd","./_redefine-all":"5XX7","./_set-to-string-tag":"iqAm","./_set-species":"Bn5Q","./_core":"4KVo","./_iter-detect":"7Pd7"}],"dVG8":[function(require,module,exports) {
|
||
var r=require("./_is-object");module.exports=function(e,i){if(!r(e)||e._t!==i)throw TypeError("Incompatible receiver, "+i+" required!");return e};
|
||
},{"./_is-object":"6SP6"}],"1l/Q":[function(require,module,exports) {
|
||
"use strict";var e=require("./_object-dp").f,r=require("./_object-create"),t=require("./_redefine-all"),i=require("./_ctx"),n=require("./_an-instance"),_=require("./_for-of"),o=require("./_iter-define"),u=require("./_iter-step"),f=require("./_set-species"),s=require("./_descriptors"),l=require("./_meta").fastKey,c=require("./_validate-collection"),v=s?"_s":"size",a=function(e,r){var t,i=l(r);if("F"!==i)return e._i[i];for(t=e._f;t;t=t.n)if(t.k==r)return t};module.exports={getConstructor:function(o,u,f,l){var h=o(function(e,t){n(e,h,u,"_i"),e._t=u,e._i=r(null),e._f=void 0,e._l=void 0,e[v]=0,null!=t&&_(t,f,e[l],e)});return t(h.prototype,{clear:function(){for(var e=c(this,u),r=e._i,t=e._f;t;t=t.n)t.r=!0,t.p&&(t.p=t.p.n=void 0),delete r[t.i];e._f=e._l=void 0,e[v]=0},delete:function(e){var r=c(this,u),t=a(r,e);if(t){var i=t.n,n=t.p;delete r._i[t.i],t.r=!0,n&&(n.n=i),i&&(i.p=n),r._f==t&&(r._f=i),r._l==t&&(r._l=n),r[v]--}return!!t},forEach:function(e){c(this,u);for(var r,t=i(e,arguments.length>1?arguments[1]:void 0,3);r=r?r.n:this._f;)for(t(r.v,r.k,this);r&&r.r;)r=r.p},has:function(e){return!!a(c(this,u),e)}}),s&&e(h.prototype,"size",{get:function(){return c(this,u)[v]}}),h},def:function(e,r,t){var i,n,_=a(e,r);return _?_.v=t:(e._l=_={i:n=l(r,!0),k:r,v:t,p:i=e._l,n:void 0,r:!1},e._f||(e._f=_),i&&(i.n=_),e[v]++,"F"!==n&&(e._i[n]=_)),e},getEntry:a,setStrong:function(e,r,t){o(e,r,function(e,t){this._t=c(e,r),this._k=t,this._l=void 0},function(){for(var e=this._k,r=this._l;r&&r.r;)r=r.p;return this._t&&(this._l=r=r?r.n:this._t._f)?u(0,"keys"==e?r.k:"values"==e?r.v:[r.k,r.v]):(this._t=void 0,u(1))},t?"entries":"values",!t,!0),f(r)}};
|
||
},{"./_object-dp":"/+wv","./_object-create":"d4Ek","./_redefine-all":"5XX7","./_ctx":"N9ch","./_an-instance":"XE1H","./_for-of":"Pqba","./_iter-define":"kgNZ","./_iter-step":"t4Zd","./_set-species":"Bn5Q","./_descriptors":"ZJLI","./_meta":"3RGd","./_validate-collection":"dVG8"}],"K3M2":[function(require,module,exports) {
|
||
|
||
"use strict";var e=require("./_global"),r=require("./_export"),t=require("./_redefine"),n=require("./_redefine-all"),i=require("./_meta"),u=require("./_for-of"),o=require("./_an-instance"),c=require("./_is-object"),a=require("./_fails"),s=require("./_iter-detect"),l=require("./_set-to-string-tag"),f=require("./_inherit-if-required");module.exports=function(d,h,q,_,p,g){var v=e[d],w=v,y=p?"set":"add",x=w&&w.prototype,E={},b=function(e){var r=x[e];t(x,e,"delete"==e?function(e){return!(g&&!c(e))&&r.call(this,0===e?0:e)}:"has"==e?function(e){return!(g&&!c(e))&&r.call(this,0===e?0:e)}:"get"==e?function(e){return g&&!c(e)?void 0:r.call(this,0===e?0:e)}:"add"==e?function(e){return r.call(this,0===e?0:e),this}:function(e,t){return r.call(this,0===e?0:e,t),this})};if("function"==typeof w&&(g||x.forEach&&!a(function(){(new w).entries().next()}))){var m=new w,j=m[y](g?{}:-0,1)!=m,C=a(function(){m.has(1)}),D=s(function(e){new w(e)}),F=!g&&a(function(){for(var e=new w,r=5;r--;)e[y](r,r);return!e.has(-0)});D||((w=h(function(e,r){o(e,w,d);var t=f(new v,e,w);return null!=r&&u(r,p,t[y],t),t})).prototype=x,x.constructor=w),(C||F)&&(b("delete"),b("has"),p&&b("get")),(F||j)&&b(y),g&&x.clear&&delete x.clear}else w=_.getConstructor(h,d,p,y),n(w.prototype,q),i.NEED=!0;return l(w,d),E[d]=w,r(r.G+r.W+r.F*(w!=v),E),g||_.setStrong(w,d,p),w};
|
||
},{"./_global":"kql1","./_export":"NjVL","./_redefine":"2l2h","./_redefine-all":"5XX7","./_meta":"3RGd","./_for-of":"Pqba","./_an-instance":"XE1H","./_is-object":"6SP6","./_fails":"e5T+","./_iter-detect":"7Pd7","./_set-to-string-tag":"iqAm","./_inherit-if-required":"oEgy"}],"0v0j":[function(require,module,exports) {
|
||
"use strict";var t=require("./_collection-strong"),e=require("./_validate-collection"),r="Map";module.exports=require("./_collection")(r,function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},{get:function(n){var i=t.getEntry(e(this,r),n);return i&&i.v},set:function(n,i){return t.def(e(this,r),0===n?0:n,i)}},t,!0);
|
||
},{"./_collection-strong":"1l/Q","./_validate-collection":"dVG8","./_collection":"K3M2"}],"ig+w":[function(require,module,exports) {
|
||
"use strict";var e=require("./_collection-strong"),t=require("./_validate-collection"),r="Set";module.exports=require("./_collection")(r,function(e){return function(){return e(this,arguments.length>0?arguments[0]:void 0)}},{add:function(i){return e.def(t(this,r),i=0===i?0:i,i)}},e);
|
||
},{"./_collection-strong":"1l/Q","./_validate-collection":"dVG8","./_collection":"K3M2"}],"4BPw":[function(require,module,exports) {
|
||
"use strict";var e=require("./_redefine-all"),t=require("./_meta").getWeak,r=require("./_an-object"),i=require("./_is-object"),n=require("./_an-instance"),u=require("./_for-of"),o=require("./_array-methods"),s=require("./_has"),a=require("./_validate-collection"),c=o(5),f=o(6),_=0,h=function(e){return e._l||(e._l=new l)},l=function(){this.a=[]},d=function(e,t){return c(e.a,function(e){return e[0]===t})};l.prototype={get:function(e){var t=d(this,e);if(t)return t[1]},has:function(e){return!!d(this,e)},set:function(e,t){var r=d(this,e);r?r[1]=t:this.a.push([e,t])},delete:function(e){var t=f(this.a,function(t){return t[0]===e});return~t&&this.a.splice(t,1),!!~t}},module.exports={getConstructor:function(r,o,c,f){var l=r(function(e,t){n(e,l,o,"_i"),e._t=o,e._i=_++,e._l=void 0,null!=t&&u(t,c,e[f],e)});return e(l.prototype,{delete:function(e){if(!i(e))return!1;var r=t(e);return!0===r?h(a(this,o)).delete(e):r&&s(r,this._i)&&delete r[this._i]},has:function(e){if(!i(e))return!1;var r=t(e);return!0===r?h(a(this,o)).has(e):r&&s(r,this._i)}}),l},def:function(e,i,n){var u=t(r(i),!0);return!0===u?h(e).set(i,n):u[e._i]=n,e},ufstore:h};
|
||
},{"./_redefine-all":"5XX7","./_meta":"3RGd","./_an-object":"DBsB","./_is-object":"6SP6","./_an-instance":"XE1H","./_for-of":"Pqba","./_array-methods":"H/1n","./_has":"nW2g","./_validate-collection":"dVG8"}],"yBwO":[function(require,module,exports) {
|
||
|
||
"use strict";var e,t=require("./_global"),r=require("./_array-methods")(0),i=require("./_redefine"),n=require("./_meta"),o=require("./_object-assign"),u=require("./_collection-weak"),c=require("./_is-object"),s=require("./_validate-collection"),a=require("./_validate-collection"),l=!t.ActiveXObject&&"ActiveXObject"in t,f="WeakMap",_=n.getWeak,h=Object.isExtensible,q=u.ufstore,v=function(e){return function(){return e(this,arguments.length>0?arguments[0]:void 0)}},d={get:function(e){if(c(e)){var t=_(e);return!0===t?q(s(this,f)).get(e):t?t[this._i]:void 0}},set:function(e,t){return u.def(s(this,f),e,t)}},g=module.exports=require("./_collection")(f,v,d,u,!0,!0);a&&l&&(o((e=u.getConstructor(v,f)).prototype,d),n.NEED=!0,r(["delete","has","get","set"],function(t){var r=g.prototype,n=r[t];i(r,t,function(r,i){if(c(r)&&!h(r)){this._f||(this._f=new e);var o=this._f[t](r,i);return"set"==t?this:o}return n.call(this,r,i)})}));
|
||
},{"./_global":"kql1","./_array-methods":"H/1n","./_redefine":"2l2h","./_meta":"3RGd","./_object-assign":"bBG/","./_collection-weak":"4BPw","./_is-object":"6SP6","./_validate-collection":"dVG8","./_collection":"K3M2"}],"YtBU":[function(require,module,exports) {
|
||
"use strict";var e=require("./_collection-weak"),t=require("./_validate-collection"),i="WeakSet";require("./_collection")(i,function(e){return function(){return e(this,arguments.length>0?arguments[0]:void 0)}},{add:function(r){return e.def(t(this,i),r,!0)}},e,!1,!0);
|
||
},{"./_collection-weak":"4BPw","./_validate-collection":"dVG8","./_collection":"K3M2"}],"F7Ll":[function(require,module,exports) {
|
||
|
||
for(var r,a=require("./_global"),t=require("./_hide"),e=require("./_uid"),y=e("typed_array"),i=e("view"),A=!(!a.ArrayBuffer||!a.DataView),o=A,p=0,l=9,n="Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array".split(",");p<l;)(r=a[n[p++]])?(t(r.prototype,y,!0),t(r.prototype,i,!0)):o=!1;module.exports={ABV:A,CONSTR:o,TYPED:y,VIEW:i};
|
||
},{"./_global":"kql1","./_hide":"i5RL","./_uid":"f0sk"}],"JyiF":[function(require,module,exports) {
|
||
var r=require("./_to-integer"),e=require("./_to-length");module.exports=function(t){if(void 0===t)return 0;var n=r(t),o=e(n);if(n!==o)throw RangeError("Wrong length!");return o};
|
||
},{"./_to-integer":"cHfm","./_to-length":"HdKs"}],"D/gX":[function(require,module,exports) {
|
||
|
||
"use strict";var t=require("./_global"),n=require("./_descriptors"),r=require("./_library"),e=require("./_typed"),i=require("./_hide"),o=require("./_redefine-all"),u=require("./_fails"),f=require("./_an-instance"),s=require("./_to-integer"),c=require("./_to-length"),a=require("./_to-index"),h=require("./_object-gopn").f,l=require("./_object-dp").f,g=require("./_array-fill"),_=require("./_set-to-string-tag"),q="ArrayBuffer",v="DataView",w="prototype",I="Wrong length!",b="Wrong index!",y=t[q],p=t[v],d=t.Math,U=t.RangeError,N=t.Infinity,x=y,A=d.abs,F=d.pow,W=d.floor,V=d.log,j=d.LN2,B="buffer",E="byteLength",L="byteOffset",m=n?"_b":B,D=n?"_l":E,M=n?"_o":L;function O(t,n,r){var e,i,o,u=new Array(r),f=8*r-n-1,s=(1<<f)-1,c=s>>1,a=23===n?F(2,-24)-F(2,-77):0,h=0,l=t<0||0===t&&1/t<0?1:0;for((t=A(t))!=t||t===N?(i=t!=t?1:0,e=s):(e=W(V(t)/j),t*(o=F(2,-e))<1&&(e--,o*=2),(t+=e+c>=1?a/o:a*F(2,1-c))*o>=2&&(e++,o/=2),e+c>=s?(i=0,e=s):e+c>=1?(i=(t*o-1)*F(2,n),e+=c):(i=t*F(2,c-1)*F(2,n),e=0));n>=8;u[h++]=255&i,i/=256,n-=8);for(e=e<<n|i,f+=n;f>0;u[h++]=255&e,e/=256,f-=8);return u[--h]|=128*l,u}function R(t,n,r){var e,i=8*r-n-1,o=(1<<i)-1,u=o>>1,f=i-7,s=r-1,c=t[s--],a=127&c;for(c>>=7;f>0;a=256*a+t[s],s--,f-=8);for(e=a&(1<<-f)-1,a>>=-f,f+=n;f>0;e=256*e+t[s],s--,f-=8);if(0===a)a=1-u;else{if(a===o)return e?NaN:c?-N:N;e+=F(2,n),a-=u}return(c?-1:1)*e*F(2,a-n)}function k(t){return t[3]<<24|t[2]<<16|t[1]<<8|t[0]}function z(t){return[255&t]}function C(t){return[255&t,t>>8&255]}function G(t){return[255&t,t>>8&255,t>>16&255,t>>24&255]}function H(t){return O(t,52,8)}function J(t){return O(t,23,4)}function K(t,n,r){l(t[w],n,{get:function(){return this[r]}})}function P(t,n,r,e){var i=a(+r);if(i+n>t[D])throw U(b);var o=t[m]._b,u=i+t[M],f=o.slice(u,u+n);return e?f:f.reverse()}function Q(t,n,r,e,i,o){var u=a(+r);if(u+n>t[D])throw U(b);for(var f=t[m]._b,s=u+t[M],c=e(+i),h=0;h<n;h++)f[s+h]=c[o?h:n-h-1]}if(e.ABV){if(!u(function(){y(1)})||!u(function(){new y(-1)})||u(function(){return new y,new y(1.5),new y(NaN),y.name!=q})){for(var S,T=(y=function(t){return f(this,y),new x(a(t))})[w]=x[w],X=h(x),Y=0;X.length>Y;)(S=X[Y++])in y||i(y,S,x[S]);r||(T.constructor=y)}var Z=new p(new y(2)),$=p[w].setInt8;Z.setInt8(0,2147483648),Z.setInt8(1,2147483649),!Z.getInt8(0)&&Z.getInt8(1)||o(p[w],{setInt8:function(t,n){$.call(this,t,n<<24>>24)},setUint8:function(t,n){$.call(this,t,n<<24>>24)}},!0)}else y=function(t){f(this,y,q);var n=a(t);this._b=g.call(new Array(n),0),this[D]=n},p=function(t,n,r){f(this,p,v),f(t,y,v);var e=t[D],i=s(n);if(i<0||i>e)throw U("Wrong offset!");if(i+(r=void 0===r?e-i:c(r))>e)throw U(I);this[m]=t,this[M]=i,this[D]=r},n&&(K(y,E,"_l"),K(p,B,"_b"),K(p,E,"_l"),K(p,L,"_o")),o(p[w],{getInt8:function(t){return P(this,1,t)[0]<<24>>24},getUint8:function(t){return P(this,1,t)[0]},getInt16:function(t){var n=P(this,2,t,arguments[1]);return(n[1]<<8|n[0])<<16>>16},getUint16:function(t){var n=P(this,2,t,arguments[1]);return n[1]<<8|n[0]},getInt32:function(t){return k(P(this,4,t,arguments[1]))},getUint32:function(t){return k(P(this,4,t,arguments[1]))>>>0},getFloat32:function(t){return R(P(this,4,t,arguments[1]),23,4)},getFloat64:function(t){return R(P(this,8,t,arguments[1]),52,8)},setInt8:function(t,n){Q(this,1,t,z,n)},setUint8:function(t,n){Q(this,1,t,z,n)},setInt16:function(t,n){Q(this,2,t,C,n,arguments[2])},setUint16:function(t,n){Q(this,2,t,C,n,arguments[2])},setInt32:function(t,n){Q(this,4,t,G,n,arguments[2])},setUint32:function(t,n){Q(this,4,t,G,n,arguments[2])},setFloat32:function(t,n){Q(this,4,t,J,n,arguments[2])},setFloat64:function(t,n){Q(this,8,t,H,n,arguments[2])}});_(y,q),_(p,v),i(p[w],e.VIEW,!0),exports[q]=y,exports[v]=p;
|
||
},{"./_global":"kql1","./_descriptors":"ZJLI","./_library":"Nw1e","./_typed":"F7Ll","./_hide":"i5RL","./_redefine-all":"5XX7","./_fails":"e5T+","./_an-instance":"XE1H","./_to-integer":"cHfm","./_to-length":"HdKs","./_to-index":"JyiF","./_object-gopn":"yyy+","./_object-dp":"/+wv","./_array-fill":"UYMr","./_set-to-string-tag":"iqAm"}],"tZr0":[function(require,module,exports) {
|
||
"use strict";var e=require("./_export"),r=require("./_typed"),i=require("./_typed-buffer"),t=require("./_an-object"),u=require("./_to-absolute-index"),n=require("./_to-length"),s=require("./_is-object"),o=require("./_global").ArrayBuffer,f=require("./_species-constructor"),c=i.ArrayBuffer,a=i.DataView,q=r.ABV&&o.isView,_=c.prototype.slice,l=r.VIEW,y="ArrayBuffer";e(e.G+e.W+e.F*(o!==c),{ArrayBuffer:c}),e(e.S+e.F*!r.CONSTR,y,{isView:function(e){return q&&q(e)||s(e)&&l in e}}),e(e.P+e.U+e.F*require("./_fails")(function(){return!new c(2).slice(1,void 0).byteLength}),y,{slice:function(e,r){if(void 0!==_&&void 0===r)return _.call(t(this),e);for(var i=t(this).byteLength,s=u(e,i),o=u(void 0===r?i:r,i),q=new(f(this,c))(n(o-s)),l=new a(this),y=new a(q),b=0;s<o;)y.setUint8(b++,l.getUint8(s++));return q}}),require("./_set-species")(y);
|
||
},{"./_export":"NjVL","./_typed":"F7Ll","./_typed-buffer":"D/gX","./_an-object":"DBsB","./_to-absolute-index":"AXg2","./_to-length":"HdKs","./_is-object":"6SP6","./_global":"kql1","./_species-constructor":"pC8t","./_fails":"e5T+","./_set-species":"Bn5Q"}],"6s1M":[function(require,module,exports) {
|
||
var e=require("./_export");e(e.G+e.W+e.F*!require("./_typed").ABV,{DataView:require("./_typed-buffer").DataView});
|
||
},{"./_export":"NjVL","./_typed":"F7Ll","./_typed-buffer":"D/gX"}],"kRz2":[function(require,module,exports) {
|
||
var global = arguments[3];
|
||
var e=arguments[3];if(require("./_descriptors")){var r=require("./_library"),t=(e=require("./_global"),require("./_fails")),n=require("./_export"),i=require("./_typed"),o=require("./_typed-buffer"),u=require("./_ctx"),c=require("./_an-instance"),f=require("./_property-desc"),a=require("./_hide"),l=require("./_redefine-all"),s=require("./_to-integer"),h=require("./_to-length"),d=require("./_to-index"),g=require("./_to-absolute-index"),_=require("./_to-primitive"),v=require("./_has"),p=require("./_classof"),y=require("./_is-object"),q=require("./_to-object"),w=require("./_is-array-iter"),b=require("./_object-create"),S=require("./_object-gpo"),E=require("./_object-gopn").f,m=require("./core.get-iterator-method"),x=require("./_uid"),L=require("./_wks"),P=require("./_array-methods"),j=require("./_array-includes"),T=require("./_species-constructor"),F=require("./es6.array.iterator"),O=require("./_iterators"),A=require("./_iter-detect"),R=require("./_set-species"),B=require("./_array-fill"),I=require("./_array-copy-within"),M=require("./_object-dp"),W=require("./_object-gopd"),N=M.f,Y=W.f,k=e.RangeError,D=e.TypeError,V=e.Uint8Array,C="ArrayBuffer",U="Shared"+C,G="BYTES_PER_ELEMENT",z="prototype",H=Array[z],J=o.ArrayBuffer,K=o.DataView,Q=P(0),X=P(2),Z=P(3),$=P(4),ee=P(5),re=P(6),te=j(!0),ne=j(!1),ie=F.values,oe=F.keys,ue=F.entries,ce=H.lastIndexOf,fe=H.reduce,ae=H.reduceRight,le=H.join,se=H.sort,he=H.slice,de=H.toString,ge=H.toLocaleString,_e=L("iterator"),ve=L("toStringTag"),pe=x("typed_constructor"),ye=x("def_constructor"),qe=i.CONSTR,we=i.TYPED,be=i.VIEW,Se="Wrong length!",Ee=P(1,function(e,r){return je(T(e,e[ye]),r)}),me=t(function(){return 1===new V(new Uint16Array([1]).buffer)[0]}),xe=!!V&&!!V[z].set&&t(function(){new V(1).set({})}),Le=function(e,r){var t=s(e);if(t<0||t%r)throw k("Wrong offset!");return t},Pe=function(e){if(y(e)&&we in e)return e;throw D(e+" is not a typed array!")},je=function(e,r){if(!(y(e)&&pe in e))throw D("It is not a typed array constructor!");return new e(r)},Te=function(e,r){return Fe(T(e,e[ye]),r)},Fe=function(e,r){for(var t=0,n=r.length,i=je(e,n);n>t;)i[t]=r[t++];return i},Oe=function(e,r,t){N(e,r,{get:function(){return this._d[t]}})},Ae=function(e){var r,t,n,i,o,c,f=q(e),a=arguments.length,l=a>1?arguments[1]:void 0,s=void 0!==l,d=m(f);if(null!=d&&!w(d)){for(c=d.call(f),n=[],r=0;!(o=c.next()).done;r++)n.push(o.value);f=n}for(s&&a>2&&(l=u(l,arguments[2],2)),r=0,t=h(f.length),i=je(this,t);t>r;r++)i[r]=s?l(f[r],r):f[r];return i},Re=function(){for(var e=0,r=arguments.length,t=je(this,r);r>e;)t[e]=arguments[e++];return t},Be=!!V&&t(function(){ge.call(new V(1))}),Ie=function(){return ge.apply(Be?he.call(Pe(this)):Pe(this),arguments)},Me={copyWithin:function(e,r){return I.call(Pe(this),e,r,arguments.length>2?arguments[2]:void 0)},every:function(e){return $(Pe(this),e,arguments.length>1?arguments[1]:void 0)},fill:function(e){return B.apply(Pe(this),arguments)},filter:function(e){return Te(this,X(Pe(this),e,arguments.length>1?arguments[1]:void 0))},find:function(e){return ee(Pe(this),e,arguments.length>1?arguments[1]:void 0)},findIndex:function(e){return re(Pe(this),e,arguments.length>1?arguments[1]:void 0)},forEach:function(e){Q(Pe(this),e,arguments.length>1?arguments[1]:void 0)},indexOf:function(e){return ne(Pe(this),e,arguments.length>1?arguments[1]:void 0)},includes:function(e){return te(Pe(this),e,arguments.length>1?arguments[1]:void 0)},join:function(e){return le.apply(Pe(this),arguments)},lastIndexOf:function(e){return ce.apply(Pe(this),arguments)},map:function(e){return Ee(Pe(this),e,arguments.length>1?arguments[1]:void 0)},reduce:function(e){return fe.apply(Pe(this),arguments)},reduceRight:function(e){return ae.apply(Pe(this),arguments)},reverse:function(){for(var e,r=Pe(this).length,t=Math.floor(r/2),n=0;n<t;)e=this[n],this[n++]=this[--r],this[r]=e;return this},some:function(e){return Z(Pe(this),e,arguments.length>1?arguments[1]:void 0)},sort:function(e){return se.call(Pe(this),e)},subarray:function(e,r){var t=Pe(this),n=t.length,i=g(e,n);return new(T(t,t[ye]))(t.buffer,t.byteOffset+i*t.BYTES_PER_ELEMENT,h((void 0===r?n:g(r,n))-i))}},We=function(e,r){return Te(this,he.call(Pe(this),e,r))},Ne=function(e){Pe(this);var r=Le(arguments[1],1),t=this.length,n=q(e),i=h(n.length),o=0;if(i+r>t)throw k(Se);for(;o<i;)this[r+o]=n[o++]},Ye={entries:function(){return ue.call(Pe(this))},keys:function(){return oe.call(Pe(this))},values:function(){return ie.call(Pe(this))}},ke=function(e,r){return y(e)&&e[we]&&"symbol"!=typeof r&&r in e&&String(+r)==String(r)},De=function(e,r){return ke(e,r=_(r,!0))?f(2,e[r]):Y(e,r)},Ve=function(e,r,t){return!(ke(e,r=_(r,!0))&&y(t)&&v(t,"value"))||v(t,"get")||v(t,"set")||t.configurable||v(t,"writable")&&!t.writable||v(t,"enumerable")&&!t.enumerable?N(e,r,t):(e[r]=t.value,e)};qe||(W.f=De,M.f=Ve),n(n.S+n.F*!qe,"Object",{getOwnPropertyDescriptor:De,defineProperty:Ve}),t(function(){de.call({})})&&(de=ge=function(){return le.call(this)});var Ce=l({},Me);l(Ce,Ye),a(Ce,_e,Ye.values),l(Ce,{slice:We,set:Ne,constructor:function(){},toString:de,toLocaleString:Ie}),Oe(Ce,"buffer","b"),Oe(Ce,"byteOffset","o"),Oe(Ce,"byteLength","l"),Oe(Ce,"length","e"),N(Ce,ve,{get:function(){return this[we]}}),module.exports=function(o,u,f,l){var s=o+((l=!!l)?"Clamped":"")+"Array",g="get"+o,_="set"+o,v=e[s],q=v||{},w=v&&S(v),m=!v||!i.ABV,x={},L=v&&v[z],P=function(e,r){N(e,r,{get:function(){return function(e,r){var t=e._d;return t.v[g](r*u+t.o,me)}(this,r)},set:function(e){return function(e,r,t){var n=e._d;l&&(t=(t=Math.round(t))<0?0:t>255?255:255&t),n.v[_](r*u+n.o,t,me)}(this,r,e)},enumerable:!0})};m?(v=f(function(e,r,t,n){c(e,v,s,"_d");var i,o,f,l,g=0,_=0;if(y(r)){if(!(r instanceof J||(l=p(r))==C||l==U))return we in r?Fe(v,r):Ae.call(v,r);i=r,_=Le(t,u);var q=r.byteLength;if(void 0===n){if(q%u)throw k(Se);if((o=q-_)<0)throw k(Se)}else if((o=h(n)*u)+_>q)throw k(Se);f=o/u}else f=d(r),i=new J(o=f*u);for(a(e,"_d",{b:i,o:_,l:o,e:f,v:new K(i)});g<f;)P(e,g++)}),L=v[z]=b(Ce),a(L,"constructor",v)):t(function(){v(1)})&&t(function(){new v(-1)})&&A(function(e){new v,new v(null),new v(1.5),new v(e)},!0)||(v=f(function(e,r,t,n){var i;return c(e,v,s),y(r)?r instanceof J||(i=p(r))==C||i==U?void 0!==n?new q(r,Le(t,u),n):void 0!==t?new q(r,Le(t,u)):new q(r):we in r?Fe(v,r):Ae.call(v,r):new q(d(r))}),Q(w!==Function.prototype?E(q).concat(E(w)):E(q),function(e){e in v||a(v,e,q[e])}),v[z]=L,r||(L.constructor=v));var j=L[_e],T=!!j&&("values"==j.name||null==j.name),F=Ye.values;a(v,pe,!0),a(L,we,s),a(L,be,!0),a(L,ye,v),(l?new v(1)[ve]==s:ve in L)||N(L,ve,{get:function(){return s}}),x[s]=v,n(n.G+n.W+n.F*(v!=q),x),n(n.S,s,{BYTES_PER_ELEMENT:u}),n(n.S+n.F*t(function(){q.of.call(v,1)}),s,{from:Ae,of:Re}),G in L||a(L,G,u),n(n.P,s,Me),R(s),n(n.P+n.F*xe,s,{set:Ne}),n(n.P+n.F*!T,s,Ye),r||L.toString==de||(L.toString=de),n(n.P+n.F*t(function(){new v(1).slice()}),s,{slice:We}),n(n.P+n.F*(t(function(){return[1,2].toLocaleString()!=new v([1,2]).toLocaleString()})||!t(function(){L.toLocaleString.call([1,2])})),s,{toLocaleString:Ie}),O[s]=T?j:F,r||T||a(L,_e,F)}}else module.exports=function(){};
|
||
},{"./_descriptors":"ZJLI","./_library":"Nw1e","./_global":"kql1","./_fails":"e5T+","./_export":"NjVL","./_typed":"F7Ll","./_typed-buffer":"D/gX","./_ctx":"N9ch","./_an-instance":"XE1H","./_property-desc":"B9+e","./_hide":"i5RL","./_redefine-all":"5XX7","./_to-integer":"cHfm","./_to-length":"HdKs","./_to-index":"JyiF","./_to-absolute-index":"AXg2","./_to-primitive":"PUNq","./_has":"nW2g","./_classof":"jP8S","./_is-object":"6SP6","./_to-object":"4JfJ","./_is-array-iter":"DsPZ","./_object-create":"d4Ek","./_object-gpo":"kbAb","./_object-gopn":"yyy+","./core.get-iterator-method":"kX9y","./_uid":"f0sk","./_wks":"3Mgd","./_array-methods":"H/1n","./_array-includes":"/dIP","./_species-constructor":"pC8t","./es6.array.iterator":"2xsA","./_iterators":"oANp","./_iter-detect":"7Pd7","./_set-species":"Bn5Q","./_array-fill":"UYMr","./_array-copy-within":"okFf","./_object-dp":"/+wv","./_object-gopd":"SFON"}],"W7MG":[function(require,module,exports) {
|
||
require("./_typed-array")("Int8",1,function(r){return function(n,t,e){return r(this,n,t,e)}});
|
||
},{"./_typed-array":"kRz2"}],"n9td":[function(require,module,exports) {
|
||
require("./_typed-array")("Uint8",1,function(r){return function(n,t,e){return r(this,n,t,e)}});
|
||
},{"./_typed-array":"kRz2"}],"m71d":[function(require,module,exports) {
|
||
require("./_typed-array")("Uint8",1,function(r){return function(n,t,e){return r(this,n,t,e)}},!0);
|
||
},{"./_typed-array":"kRz2"}],"YGkr":[function(require,module,exports) {
|
||
require("./_typed-array")("Int16",2,function(r){return function(n,t,e){return r(this,n,t,e)}});
|
||
},{"./_typed-array":"kRz2"}],"OaOh":[function(require,module,exports) {
|
||
require("./_typed-array")("Uint16",2,function(r){return function(n,t,e){return r(this,n,t,e)}});
|
||
},{"./_typed-array":"kRz2"}],"sUYQ":[function(require,module,exports) {
|
||
require("./_typed-array")("Int32",4,function(r){return function(n,t,e){return r(this,n,t,e)}});
|
||
},{"./_typed-array":"kRz2"}],"XuMj":[function(require,module,exports) {
|
||
require("./_typed-array")("Uint32",4,function(r){return function(n,t,e){return r(this,n,t,e)}});
|
||
},{"./_typed-array":"kRz2"}],"V93U":[function(require,module,exports) {
|
||
require("./_typed-array")("Float32",4,function(r){return function(t,n,e){return r(this,t,n,e)}});
|
||
},{"./_typed-array":"kRz2"}],"KMMD":[function(require,module,exports) {
|
||
require("./_typed-array")("Float64",8,function(r){return function(t,n,e){return r(this,t,n,e)}});
|
||
},{"./_typed-array":"kRz2"}],"XlB+":[function(require,module,exports) {
|
||
var e=require("./_export"),r=require("./_a-function"),n=require("./_an-object"),i=(require("./_global").Reflect||{}).apply,u=Function.apply;e(e.S+e.F*!require("./_fails")(function(){i(function(){})}),"Reflect",{apply:function(e,a,l){var t=r(e),c=n(l);return i?i(t,a,c):u.call(t,a,c)}});
|
||
},{"./_export":"NjVL","./_a-function":"L6p4","./_an-object":"DBsB","./_global":"kql1","./_fails":"e5T+"}],"JeCu":[function(require,module,exports) {
|
||
var e=require("./_export"),r=require("./_object-create"),n=require("./_a-function"),t=require("./_an-object"),u=require("./_is-object"),c=require("./_fails"),i=require("./_bind"),o=(require("./_global").Reflect||{}).construct,a=c(function(){function e(){}return!(o(function(){},[],e)instanceof e)}),l=!c(function(){o(function(){})});e(e.S+e.F*(a||l),"Reflect",{construct:function(e,c){n(e),t(c);var f=arguments.length<3?e:n(arguments[2]);if(l&&!a)return o(e,c,f);if(e==f){switch(c.length){case 0:return new e;case 1:return new e(c[0]);case 2:return new e(c[0],c[1]);case 3:return new e(c[0],c[1],c[2]);case 4:return new e(c[0],c[1],c[2],c[3])}var p=[null];return p.push.apply(p,c),new(i.apply(e,p))}var s=f.prototype,q=r(u(s)?s:Object.prototype),_=Function.apply.call(e,q,c);return u(_)?_:q}});
|
||
},{"./_export":"NjVL","./_object-create":"d4Ek","./_a-function":"L6p4","./_an-object":"DBsB","./_is-object":"6SP6","./_fails":"e5T+","./_bind":"nZQ+","./_global":"kql1"}],"VZPr":[function(require,module,exports) {
|
||
var e=require("./_object-dp"),r=require("./_export"),t=require("./_an-object"),i=require("./_to-primitive");r(r.S+r.F*require("./_fails")(function(){Reflect.defineProperty(e.f({},1,{value:1}),1,{value:2})}),"Reflect",{defineProperty:function(r,u,f){t(r),u=i(u,!0),t(f);try{return e.f(r,u,f),!0}catch(n){return!1}}});
|
||
},{"./_object-dp":"/+wv","./_export":"NjVL","./_an-object":"DBsB","./_to-primitive":"PUNq","./_fails":"e5T+"}],"kfrU":[function(require,module,exports) {
|
||
var e=require("./_export"),r=require("./_object-gopd").f,t=require("./_an-object");e(e.S,"Reflect",{deleteProperty:function(e,o){var u=r(t(e),o);return!(u&&!u.configurable)&&delete e[o]}});
|
||
},{"./_export":"NjVL","./_object-gopd":"SFON","./_an-object":"DBsB"}],"pLCm":[function(require,module,exports) {
|
||
"use strict";var e=require("./_export"),t=require("./_an-object"),i=function(e){this._t=t(e),this._i=0;var i,r=this._k=[];for(i in e)r.push(i)};require("./_iter-create")(i,"Object",function(){var e,t=this._k;do{if(this._i>=t.length)return{value:void 0,done:!0}}while(!((e=t[this._i++])in this._t));return{value:e,done:!1}}),e(e.S,"Reflect",{enumerate:function(e){return new i(e)}});
|
||
},{"./_export":"NjVL","./_an-object":"DBsB","./_iter-create":"O1PE"}],"iEI9":[function(require,module,exports) {
|
||
var e=require("./_object-gopd"),r=require("./_object-gpo"),t=require("./_has"),i=require("./_export"),o=require("./_is-object"),u=require("./_an-object");function a(i,c){var v,g,l=arguments.length<3?i:arguments[2];return u(i)===l?i[c]:(v=e.f(i,c))?t(v,"value")?v.value:void 0!==v.get?v.get.call(l):void 0:o(g=r(i))?a(g,c,l):void 0}i(i.S,"Reflect",{get:a});
|
||
},{"./_object-gopd":"SFON","./_object-gpo":"kbAb","./_has":"nW2g","./_export":"NjVL","./_is-object":"6SP6","./_an-object":"DBsB"}],"eHzb":[function(require,module,exports) {
|
||
var e=require("./_object-gopd"),r=require("./_export"),t=require("./_an-object");r(r.S,"Reflect",{getOwnPropertyDescriptor:function(r,o){return e.f(t(r),o)}});
|
||
},{"./_object-gopd":"SFON","./_export":"NjVL","./_an-object":"DBsB"}],"wht9":[function(require,module,exports) {
|
||
var e=require("./_export"),r=require("./_object-gpo"),t=require("./_an-object");e(e.S,"Reflect",{getPrototypeOf:function(e){return r(t(e))}});
|
||
},{"./_export":"NjVL","./_object-gpo":"kbAb","./_an-object":"DBsB"}],"sj65":[function(require,module,exports) {
|
||
var e=require("./_export");e(e.S,"Reflect",{has:function(e,r){return r in e}});
|
||
},{"./_export":"NjVL"}],"Nj86":[function(require,module,exports) {
|
||
var e=require("./_export"),r=require("./_an-object"),t=Object.isExtensible;e(e.S,"Reflect",{isExtensible:function(e){return r(e),!t||t(e)}});
|
||
},{"./_export":"NjVL","./_an-object":"DBsB"}],"4+jx":[function(require,module,exports) {
|
||
var e=require("./_object-gopn"),r=require("./_object-gops"),o=require("./_an-object"),t=require("./_global").Reflect;module.exports=t&&t.ownKeys||function(t){var c=e.f(o(t)),n=r.f;return n?c.concat(n(t)):c};
|
||
},{"./_object-gopn":"yyy+","./_object-gops":"JErC","./_an-object":"DBsB","./_global":"kql1"}],"/wy/":[function(require,module,exports) {
|
||
var e=require("./_export");e(e.S,"Reflect",{ownKeys:require("./_own-keys")});
|
||
},{"./_export":"NjVL","./_own-keys":"4+jx"}],"y3HT":[function(require,module,exports) {
|
||
var e=require("./_export"),r=require("./_an-object"),t=Object.preventExtensions;e(e.S,"Reflect",{preventExtensions:function(e){r(e);try{return t&&t(e),!0}catch(n){return!1}}});
|
||
},{"./_export":"NjVL","./_an-object":"DBsB"}],"0ndf":[function(require,module,exports) {
|
||
var e=require("./_object-dp"),r=require("./_object-gopd"),t=require("./_object-gpo"),i=require("./_has"),u=require("./_export"),f=require("./_property-desc"),o=require("./_an-object"),a=require("./_is-object");function c(u,l,n){var q,s,_=arguments.length<4?u:arguments[3],b=r.f(o(u),l);if(!b){if(a(s=t(u)))return c(s,l,n,_);b=f(0)}if(i(b,"value")){if(!1===b.writable||!a(_))return!1;if(q=r.f(_,l)){if(q.get||q.set||!1===q.writable)return!1;q.value=n,e.f(_,l,q)}else e.f(_,l,f(0,n));return!0}return void 0!==b.set&&(b.set.call(_,n),!0)}u(u.S,"Reflect",{set:c});
|
||
},{"./_object-dp":"/+wv","./_object-gopd":"SFON","./_object-gpo":"kbAb","./_has":"nW2g","./_export":"NjVL","./_property-desc":"B9+e","./_an-object":"DBsB","./_is-object":"6SP6"}],"olbq":[function(require,module,exports) {
|
||
var e=require("./_export"),r=require("./_set-proto");r&&e(e.S,"Reflect",{setPrototypeOf:function(e,t){r.check(e,t);try{return r.set(e,t),!0}catch(c){return!1}}});
|
||
},{"./_export":"NjVL","./_set-proto":"Epal"}],"EHCj":[function(require,module,exports) {
|
||
"use strict";var r=require("./_export"),e=require("./_array-includes")(!0);r(r.P,"Array",{includes:function(r){return e(this,r,arguments.length>1?arguments[1]:void 0)}}),require("./_add-to-unscopables")("includes");
|
||
},{"./_export":"NjVL","./_array-includes":"/dIP","./_add-to-unscopables":"PxQA"}],"V4v3":[function(require,module,exports) {
|
||
"use strict";var r=require("./_is-array"),e=require("./_is-object"),i=require("./_to-length"),t=require("./_ctx"),o=require("./_wks")("isConcatSpreadable");function u(s,a,n,c,f,l,q,_){for(var d,h,p=f,v=0,b=!!q&&t(q,_,3);v<c;){if(v in n){if(d=b?b(n[v],v,a):n[v],h=!1,e(d)&&(h=void 0!==(h=d[o])?!!h:r(d)),h&&l>0)p=u(s,a,d,i(d.length),p,l-1)-1;else{if(p>=9007199254740991)throw TypeError();s[p]=d}p++}v++}return p}module.exports=u;
|
||
},{"./_is-array":"Osm+","./_is-object":"6SP6","./_to-length":"HdKs","./_ctx":"N9ch","./_wks":"3Mgd"}],"moLY":[function(require,module,exports) {
|
||
"use strict";var r=require("./_export"),e=require("./_flatten-into-array"),t=require("./_to-object"),a=require("./_to-length"),i=require("./_a-function"),u=require("./_array-species-create");r(r.P,"Array",{flatMap:function(r){var n,o,c=t(this);return i(r),n=a(c.length),o=u(c,0),e(o,c,c,n,0,1,r,arguments[1]),o}}),require("./_add-to-unscopables")("flatMap");
|
||
},{"./_export":"NjVL","./_flatten-into-array":"V4v3","./_to-object":"4JfJ","./_to-length":"HdKs","./_a-function":"L6p4","./_array-species-create":"yi52","./_add-to-unscopables":"PxQA"}],"3b3L":[function(require,module,exports) {
|
||
"use strict";var e=require("./_export"),r=require("./_flatten-into-array"),t=require("./_to-object"),i=require("./_to-length"),a=require("./_to-integer"),n=require("./_array-species-create");e(e.P,"Array",{flatten:function(){var e=arguments[0],u=t(this),o=i(u.length),q=n(u,0);return r(q,u,u,o,0,void 0===e?1:a(e)),q}}),require("./_add-to-unscopables")("flatten");
|
||
},{"./_export":"NjVL","./_flatten-into-array":"V4v3","./_to-object":"4JfJ","./_to-length":"HdKs","./_to-integer":"cHfm","./_array-species-create":"yi52","./_add-to-unscopables":"PxQA"}],"uHWZ":[function(require,module,exports) {
|
||
"use strict";var r=require("./_export"),t=require("./_string-at")(!0),e=require("./_fails"),i=e(function(){return"𠮷"!=="𠮷".at(0)});r(r.P+r.F*i,"String",{at:function(r){return t(this,r)}});
|
||
},{"./_export":"NjVL","./_string-at":"Bi/T","./_fails":"e5T+"}],"GT+w":[function(require,module,exports) {
|
||
var e=require("./_to-length"),r=require("./_string-repeat"),t=require("./_defined");module.exports=function(i,n,l,g){var u=String(t(i)),a=u.length,h=void 0===l?" ":String(l),o=e(n);if(o<=a||""==h)return u;var c=o-a,d=r.call(h,Math.ceil(c/h.length));return d.length>c&&(d=d.slice(0,c)),g?d+u:u+d};
|
||
},{"./_to-length":"HdKs","./_string-repeat":"ezM6","./_defined":"Zcur"}],"fWC9":[function(require,module,exports) {
|
||
"use strict";var r=require("./_export"),e=require("./_string-pad"),t=require("./_user-agent"),i=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(t);r(r.P+r.F*i,"String",{padStart:function(r){return e(this,r,arguments.length>1?arguments[1]:void 0,!0)}});
|
||
},{"./_export":"NjVL","./_string-pad":"GT+w","./_user-agent":"SW/O"}],"XG7E":[function(require,module,exports) {
|
||
"use strict";var r=require("./_export"),e=require("./_string-pad"),i=require("./_user-agent"),t=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(i);r(r.P+r.F*t,"String",{padEnd:function(r){return e(this,r,arguments.length>1?arguments[1]:void 0,!1)}});
|
||
},{"./_export":"NjVL","./_string-pad":"GT+w","./_user-agent":"SW/O"}],"yPLu":[function(require,module,exports) {
|
||
"use strict";require("./_string-trim")("trimLeft",function(t){return function(){return t(this,1)}},"trimStart");
|
||
},{"./_string-trim":"EWct"}],"n2or":[function(require,module,exports) {
|
||
"use strict";require("./_string-trim")("trimRight",function(t){return function(){return t(this,2)}},"trimEnd");
|
||
},{"./_string-trim":"EWct"}],"U9WL":[function(require,module,exports) {
|
||
"use strict";var e=require("./_export"),r=require("./_defined"),t=require("./_to-length"),i=require("./_is-regexp"),n=require("./_flags"),s=RegExp.prototype,g=function(e,r){this._r=e,this._s=r};require("./_iter-create")(g,"RegExp String",function(){var e=this._r.exec(this._s);return{value:e,done:null===e}}),e(e.P,"String",{matchAll:function(e){if(r(this),!i(e))throw TypeError(e+" is not a regexp!");var u=String(this),a="flags"in s?String(e.flags):n.call(e),l=new RegExp(e.source,~a.indexOf("g")?a:"g"+a);return l.lastIndex=t(e.lastIndex),new g(l,u)}});
|
||
},{"./_export":"NjVL","./_defined":"Zcur","./_to-length":"HdKs","./_is-regexp":"g8m6","./_flags":"aRjg","./_iter-create":"O1PE"}],"4Ibo":[function(require,module,exports) {
|
||
require("./_wks-define")("asyncIterator");
|
||
},{"./_wks-define":"hijg"}],"CwRI":[function(require,module,exports) {
|
||
require("./_wks-define")("observable");
|
||
},{"./_wks-define":"hijg"}],"MZQr":[function(require,module,exports) {
|
||
var e=require("./_export"),r=require("./_own-keys"),t=require("./_to-iobject"),o=require("./_object-gopd"),i=require("./_create-property");e(e.S,"Object",{getOwnPropertyDescriptors:function(e){for(var u,c,n=t(e),p=o.f,q=r(n),_={},a=0;q.length>a;)void 0!==(c=p(n,u=q[a++]))&&i(_,u,c);return _}});
|
||
},{"./_export":"NjVL","./_own-keys":"4+jx","./_to-iobject":"mwRI","./_object-gopd":"SFON","./_create-property":"WfCN"}],"2bMm":[function(require,module,exports) {
|
||
var e=require("./_descriptors"),r=require("./_object-keys"),t=require("./_to-iobject"),o=require("./_object-pie").f;module.exports=function(u){return function(i){for(var c,n=t(i),s=r(n),f=s.length,l=0,p=[];f>l;)c=s[l++],e&&!o.call(n,c)||p.push(u?[c,n[c]]:n[c]);return p}};
|
||
},{"./_descriptors":"ZJLI","./_object-keys":"kfVX","./_to-iobject":"mwRI","./_object-pie":"Blc0"}],"cZE6":[function(require,module,exports) {
|
||
var r=require("./_export"),e=require("./_object-to-array")(!1);r(r.S,"Object",{values:function(r){return e(r)}});
|
||
},{"./_export":"NjVL","./_object-to-array":"2bMm"}],"beat":[function(require,module,exports) {
|
||
var r=require("./_export"),e=require("./_object-to-array")(!0);r(r.S,"Object",{entries:function(r){return e(r)}});
|
||
},{"./_export":"NjVL","./_object-to-array":"2bMm"}],"HOr2":[function(require,module,exports) {
|
||
"use strict";module.exports=require("./_library")||!require("./_fails")(function(){var e=Math.random();__defineSetter__.call(null,e,function(){}),delete require("./_global")[e]});
|
||
},{"./_library":"Nw1e","./_fails":"e5T+","./_global":"kql1"}],"mNK1":[function(require,module,exports) {
|
||
"use strict";var e=require("./_export"),r=require("./_to-object"),t=require("./_a-function"),i=require("./_object-dp");require("./_descriptors")&&e(e.P+require("./_object-forced-pam"),"Object",{__defineGetter__:function(e,u){i.f(r(this),e,{get:t(u),enumerable:!0,configurable:!0})}});
|
||
},{"./_export":"NjVL","./_to-object":"4JfJ","./_a-function":"L6p4","./_object-dp":"/+wv","./_descriptors":"ZJLI","./_object-forced-pam":"HOr2"}],"DPSG":[function(require,module,exports) {
|
||
"use strict";var e=require("./_export"),r=require("./_to-object"),t=require("./_a-function"),i=require("./_object-dp");require("./_descriptors")&&e(e.P+require("./_object-forced-pam"),"Object",{__defineSetter__:function(e,u){i.f(r(this),e,{set:t(u),enumerable:!0,configurable:!0})}});
|
||
},{"./_export":"NjVL","./_to-object":"4JfJ","./_a-function":"L6p4","./_object-dp":"/+wv","./_descriptors":"ZJLI","./_object-forced-pam":"HOr2"}],"Y0di":[function(require,module,exports) {
|
||
"use strict";var e=require("./_export"),r=require("./_to-object"),t=require("./_to-primitive"),i=require("./_object-gpo"),o=require("./_object-gopd").f;require("./_descriptors")&&e(e.P+require("./_object-forced-pam"),"Object",{__lookupGetter__:function(e){var u,_=r(this),c=t(e,!0);do{if(u=o(_,c))return u.get}while(_=i(_))}});
|
||
},{"./_export":"NjVL","./_to-object":"4JfJ","./_to-primitive":"PUNq","./_object-gpo":"kbAb","./_object-gopd":"SFON","./_descriptors":"ZJLI","./_object-forced-pam":"HOr2"}],"/biA":[function(require,module,exports) {
|
||
"use strict";var e=require("./_export"),r=require("./_to-object"),t=require("./_to-primitive"),i=require("./_object-gpo"),o=require("./_object-gopd").f;require("./_descriptors")&&e(e.P+require("./_object-forced-pam"),"Object",{__lookupSetter__:function(e){var u,_=r(this),c=t(e,!0);do{if(u=o(_,c))return u.set}while(_=i(_))}});
|
||
},{"./_export":"NjVL","./_to-object":"4JfJ","./_to-primitive":"PUNq","./_object-gpo":"kbAb","./_object-gopd":"SFON","./_descriptors":"ZJLI","./_object-forced-pam":"HOr2"}],"Jmch":[function(require,module,exports) {
|
||
var r=require("./_for-of");module.exports=function(e,o){var u=[];return r(e,!1,u.push,u,o),u};
|
||
},{"./_for-of":"Pqba"}],"lQHC":[function(require,module,exports) {
|
||
var r=require("./_classof"),e=require("./_array-from-iterable");module.exports=function(t){return function(){if(r(this)!=t)throw TypeError(t+"#toJSON isn't generic");return e(this)}};
|
||
},{"./_classof":"jP8S","./_array-from-iterable":"Jmch"}],"VZya":[function(require,module,exports) {
|
||
var e=require("./_export");e(e.P+e.R,"Map",{toJSON:require("./_collection-to-json")("Map")});
|
||
},{"./_export":"NjVL","./_collection-to-json":"lQHC"}],"omDO":[function(require,module,exports) {
|
||
var e=require("./_export");e(e.P+e.R,"Set",{toJSON:require("./_collection-to-json")("Set")});
|
||
},{"./_export":"NjVL","./_collection-to-json":"lQHC"}],"p4tr":[function(require,module,exports) {
|
||
"use strict";var r=require("./_export");module.exports=function(e){r(r.S,e,{of:function(){for(var r=arguments.length,e=new Array(r);r--;)e[r]=arguments[r];return new this(e)}})};
|
||
},{"./_export":"NjVL"}],"PjD2":[function(require,module,exports) {
|
||
require("./_set-collection-of")("Map");
|
||
},{"./_set-collection-of":"p4tr"}],"Z2Pq":[function(require,module,exports) {
|
||
require("./_set-collection-of")("Set");
|
||
},{"./_set-collection-of":"p4tr"}],"ByVw":[function(require,module,exports) {
|
||
require("./_set-collection-of")("WeakMap");
|
||
},{"./_set-collection-of":"p4tr"}],"2CYP":[function(require,module,exports) {
|
||
require("./_set-collection-of")("WeakSet");
|
||
},{"./_set-collection-of":"p4tr"}],"cZmF":[function(require,module,exports) {
|
||
"use strict";var r=require("./_export"),e=require("./_a-function"),u=require("./_ctx"),i=require("./_for-of");module.exports=function(t){r(r.S,t,{from:function(r){var t,n,o,s,f=arguments[1];return e(this),(t=void 0!==f)&&e(f),null==r?new this:(n=[],t?(o=0,s=u(f,arguments[2],2),i(r,!1,function(r){n.push(s(r,o++))})):i(r,!1,n.push,n),new this(n))}})};
|
||
},{"./_export":"NjVL","./_a-function":"L6p4","./_ctx":"N9ch","./_for-of":"Pqba"}],"Swiz":[function(require,module,exports) {
|
||
require("./_set-collection-from")("Map");
|
||
},{"./_set-collection-from":"cZmF"}],"yWUZ":[function(require,module,exports) {
|
||
require("./_set-collection-from")("Set");
|
||
},{"./_set-collection-from":"cZmF"}],"X04t":[function(require,module,exports) {
|
||
require("./_set-collection-from")("WeakMap");
|
||
},{"./_set-collection-from":"cZmF"}],"8Tbe":[function(require,module,exports) {
|
||
require("./_set-collection-from")("WeakSet");
|
||
},{"./_set-collection-from":"cZmF"}],"SAyU":[function(require,module,exports) {
|
||
var r=require("./_export");r(r.G,{global:require("./_global")});
|
||
},{"./_export":"NjVL","./_global":"kql1"}],"ixkq":[function(require,module,exports) {
|
||
var e=require("./_export");e(e.S,"System",{global:require("./_global")});
|
||
},{"./_export":"NjVL","./_global":"kql1"}],"p9Qi":[function(require,module,exports) {
|
||
var r=require("./_export"),e=require("./_cof");r(r.S,"Error",{isError:function(r){return"Error"===e(r)}});
|
||
},{"./_export":"NjVL","./_cof":"viv7"}],"DPl4":[function(require,module,exports) {
|
||
var a=require("./_export");a(a.S,"Math",{clamp:function(a,r,t){return Math.min(t,Math.max(r,a))}});
|
||
},{"./_export":"NjVL"}],"qvLd":[function(require,module,exports) {
|
||
var r=require("./_export");r(r.S,"Math",{DEG_PER_RAD:Math.PI/180});
|
||
},{"./_export":"NjVL"}],"vOCQ":[function(require,module,exports) {
|
||
var e=require("./_export"),r=180/Math.PI;e(e.S,"Math",{degrees:function(e){return e*r}});
|
||
},{"./_export":"NjVL"}],"DBZ8":[function(require,module,exports) {
|
||
module.exports=Math.scale||function(e,t,n,a,l){return 0===arguments.length||e!=e||t!=t||n!=n||a!=a||l!=l?NaN:e===1/0||e===-1/0?e:(e-t)*(l-a)/(n-t)+a};
|
||
},{}],"bbog":[function(require,module,exports) {
|
||
var r=require("./_export"),e=require("./_math-scale"),a=require("./_math-fround");r(r.S,"Math",{fscale:function(r,t,u,i,n){return a(e(r,t,u,i,n))}});
|
||
},{"./_export":"NjVL","./_math-scale":"DBZ8","./_math-fround":"uZ/F"}],"u35Z":[function(require,module,exports) {
|
||
var r=require("./_export");r(r.S,"Math",{iaddh:function(r,a,e,t){var i=r>>>0,n=e>>>0;return(a>>>0)+(t>>>0)+((i&n|(i|n)&~(i+n>>>0))>>>31)|0}});
|
||
},{"./_export":"NjVL"}],"8AMA":[function(require,module,exports) {
|
||
var r=require("./_export");r(r.S,"Math",{isubh:function(r,e,t,u){var a=r>>>0,i=t>>>0;return(e>>>0)-(u>>>0)-((~a&i|~(a^i)&a-i>>>0)>>>31)|0}});
|
||
},{"./_export":"NjVL"}],"PjOg":[function(require,module,exports) {
|
||
var r=require("./_export");r(r.S,"Math",{imulh:function(r,e){var t=+r,u=+e,a=65535&t,i=65535&u,n=t>>16,h=u>>16,o=(n*i>>>0)+(a*i>>>16);return n*h+(o>>16)+((a*h>>>0)+(65535&o)>>16)}});
|
||
},{"./_export":"NjVL"}],"MDih":[function(require,module,exports) {
|
||
var r=require("./_export");r(r.S,"Math",{RAD_PER_DEG:180/Math.PI});
|
||
},{"./_export":"NjVL"}],"kkYP":[function(require,module,exports) {
|
||
var r=require("./_export"),a=Math.PI/180;r(r.S,"Math",{radians:function(r){return r*a}});
|
||
},{"./_export":"NjVL"}],"h4TH":[function(require,module,exports) {
|
||
var e=require("./_export");e(e.S,"Math",{scale:require("./_math-scale")});
|
||
},{"./_export":"NjVL","./_math-scale":"DBZ8"}],"Lf/G":[function(require,module,exports) {
|
||
var r=require("./_export");r(r.S,"Math",{umulh:function(r,u){var e=+r,t=+u,a=65535&e,n=65535&t,h=e>>>16,i=t>>>16,o=(h*n>>>0)+(a*n>>>16);return h*i+(o>>>16)+((a*i>>>0)+(65535&o)>>>16)}});
|
||
},{"./_export":"NjVL"}],"dibz":[function(require,module,exports) {
|
||
var r=require("./_export");r(r.S,"Math",{signbit:function(r){return(r=+r)!=r?r:0==r?1/r==1/0:r>0}});
|
||
},{"./_export":"NjVL"}],"5Per":[function(require,module,exports) {
|
||
|
||
"use strict";var r=require("./_export"),e=require("./_core"),t=require("./_global"),n=require("./_species-constructor"),i=require("./_promise-resolve");r(r.P+r.R,"Promise",{finally:function(r){var o=n(this,e.Promise||t.Promise),u="function"==typeof r;return this.then(u?function(e){return i(o,r()).then(function(){return e})}:r,u?function(e){return i(o,r()).then(function(){throw e})}:r)}});
|
||
},{"./_export":"NjVL","./_core":"4KVo","./_global":"kql1","./_species-constructor":"pC8t","./_promise-resolve":"bQCN"}],"vZUa":[function(require,module,exports) {
|
||
"use strict";var r=require("./_export"),e=require("./_new-promise-capability"),i=require("./_perform");r(r.S,"Promise",{try:function(r){var t=e.f(this),o=i(r);return(o.e?t.reject:t.resolve)(o.v),t.promise}});
|
||
},{"./_export":"NjVL","./_new-promise-capability":"Mdjk","./_perform":"5eKV"}],"pxMt":[function(require,module,exports) {
|
||
var e=require("./es6.map"),r=require("./_export"),t=require("./_shared")("metadata"),n=t.store||(t.store=new(require("./es6.weak-map"))),i=function(r,t,i){var o=n.get(r);if(!o){if(!i)return;n.set(r,o=new e)}var u=o.get(t);if(!u){if(!i)return;o.set(t,u=new e)}return u},o=function(e,r,t){var n=i(r,t,!1);return void 0!==n&&n.has(e)},u=function(e,r,t){var n=i(r,t,!1);return void 0===n?void 0:n.get(e)},a=function(e,r,t,n){i(t,n,!0).set(e,r)},s=function(e,r){var t=i(e,r,!1),n=[];return t&&t.forEach(function(e,r){n.push(r)}),n},f=function(e){return void 0===e||"symbol"==typeof e?e:String(e)},c=function(e){r(r.S,"Reflect",e)};module.exports={store:n,map:i,has:o,get:u,set:a,keys:s,key:f,exp:c};
|
||
},{"./es6.map":"0v0j","./_export":"NjVL","./_shared":"8sTG","./es6.weak-map":"yBwO"}],"BSfr":[function(require,module,exports) {
|
||
var e=require("./_metadata"),a=require("./_an-object"),t=e.key,r=e.set;e.exp({defineMetadata:function(e,i,n,d){r(e,i,a(n),t(d))}});
|
||
},{"./_metadata":"pxMt","./_an-object":"DBsB"}],"JW9N":[function(require,module,exports) {
|
||
var e=require("./_metadata"),t=require("./_an-object"),r=e.key,a=e.map,i=e.store;e.exp({deleteMetadata:function(e,d){var n=arguments.length<3?void 0:r(arguments[2]),u=a(t(d),n,!1);if(void 0===u||!u.delete(e))return!1;if(u.size)return!0;var l=i.get(d);return l.delete(n),!!l.size||i.delete(d)}});
|
||
},{"./_metadata":"pxMt","./_an-object":"DBsB"}],"x5Yv":[function(require,module,exports) {
|
||
var e=require("./_metadata"),r=require("./_an-object"),t=require("./_object-gpo"),a=e.has,n=e.get,u=e.key,i=function(e,r,u){if(a(e,r,u))return n(e,r,u);var o=t(r);return null!==o?i(e,o,u):void 0};e.exp({getMetadata:function(e,t){return i(e,r(t),arguments.length<3?void 0:u(arguments[2]))}});
|
||
},{"./_metadata":"pxMt","./_an-object":"DBsB","./_object-gpo":"kbAb"}],"zaK7":[function(require,module,exports) {
|
||
var e=require("./es6.set"),r=require("./_array-from-iterable"),t=require("./_metadata"),a=require("./_an-object"),n=require("./_object-gpo"),u=t.keys,i=t.key,o=function(t,a){var i=u(t,a),c=n(t);if(null===c)return i;var l=o(c,a);return l.length?i.length?r(new e(i.concat(l))):l:i};t.exp({getMetadataKeys:function(e){return o(a(e),arguments.length<2?void 0:i(arguments[1]))}});
|
||
},{"./es6.set":"ig+w","./_array-from-iterable":"Jmch","./_metadata":"pxMt","./_an-object":"DBsB","./_object-gpo":"kbAb"}],"Dz2Z":[function(require,module,exports) {
|
||
var e=require("./_metadata"),t=require("./_an-object"),a=e.get,r=e.key;e.exp({getOwnMetadata:function(e,n){return a(e,t(n),arguments.length<3?void 0:r(arguments[2]))}});
|
||
},{"./_metadata":"pxMt","./_an-object":"DBsB"}],"/sJY":[function(require,module,exports) {
|
||
var e=require("./_metadata"),t=require("./_an-object"),a=e.keys,r=e.key;e.exp({getOwnMetadataKeys:function(e){return a(t(e),arguments.length<2?void 0:r(arguments[1]))}});
|
||
},{"./_metadata":"pxMt","./_an-object":"DBsB"}],"69T0":[function(require,module,exports) {
|
||
var e=require("./_metadata"),r=require("./_an-object"),t=require("./_object-gpo"),a=e.has,n=e.key,u=function(e,r,n){if(a(e,r,n))return!0;var i=t(r);return null!==i&&u(e,i,n)};e.exp({hasMetadata:function(e,t){return u(e,r(t),arguments.length<3?void 0:n(arguments[2]))}});
|
||
},{"./_metadata":"pxMt","./_an-object":"DBsB","./_object-gpo":"kbAb"}],"UCXJ":[function(require,module,exports) {
|
||
var e=require("./_metadata"),a=require("./_an-object"),t=e.has,r=e.key;e.exp({hasOwnMetadata:function(e,n){return t(e,a(n),arguments.length<3?void 0:r(arguments[2]))}});
|
||
},{"./_metadata":"pxMt","./_an-object":"DBsB"}],"iEkw":[function(require,module,exports) {
|
||
var e=require("./_metadata"),t=require("./_an-object"),a=require("./_a-function"),r=e.key,n=e.set;e.exp({metadata:function(e,i){return function(u,o){n(e,i,(void 0!==o?t:a)(u),r(o))}}});
|
||
},{"./_metadata":"pxMt","./_an-object":"DBsB","./_a-function":"L6p4"}],"OO50":[function(require,module,exports) {
|
||
|
||
var r=require("./_export"),e=require("./_microtask")(),i=require("./_global").process,o="process"==require("./_cof")(i);r(r.G,{asap:function(r){var a=o&&i.domain;e(a?a.bind(r):r)}});
|
||
},{"./_export":"NjVL","./_microtask":"i1H+","./_global":"kql1","./_cof":"viv7"}],"3eRG":[function(require,module,exports) {
|
||
|
||
"use strict";var r=require("./_export"),t=require("./_global"),n=require("./_core"),e=require("./_microtask")(),i=require("./_wks")("observable"),o=require("./_a-function"),u=require("./_an-object"),c=require("./_an-instance"),f=require("./_redefine-all"),s=require("./_hide"),a=require("./_for-of"),v=a.RETURN,h=function(r){return null==r?void 0:o(r)},l=function(r){var t=r._c;t&&(r._c=void 0,t())},_=function(r){return void 0===r._o},b=function(r){_(r)||(r._o=void 0,l(r))},y=function(r,t){u(r),this._c=void 0,this._o=r,r=new p(this);try{var n=t(r),e=n;null!=n&&("function"==typeof n.unsubscribe?n=function(){e.unsubscribe()}:o(n),this._c=n)}catch(i){return void r.error(i)}_(this)&&l(this)};y.prototype=f({},{unsubscribe:function(){b(this)}});var p=function(r){this._s=r};p.prototype=f({},{next:function(r){var t=this._s;if(!_(t)){var n=t._o;try{var e=h(n.next);if(e)return e.call(n,r)}catch(i){try{b(t)}finally{throw i}}}},error:function(r){var t=this._s;if(_(t))throw r;var n=t._o;t._o=void 0;try{var e=h(n.error);if(!e)throw r;r=e.call(n,r)}catch(i){try{l(t)}finally{throw i}}return l(t),r},complete:function(r){var t=this._s;if(!_(t)){var n=t._o;t._o=void 0;try{var e=h(n.complete);r=e?e.call(n,r):void 0}catch(i){try{l(t)}finally{throw i}}return l(t),r}}});var w=function(r){c(this,w,"Observable","_f")._f=o(r)};f(w.prototype,{subscribe:function(r){return new y(r,this._f)},forEach:function(r){var e=this;return new(n.Promise||t.Promise)(function(t,n){o(r);var i=e.subscribe({next:function(t){try{return r(t)}catch(e){n(e),i.unsubscribe()}},error:n,complete:t})})}}),f(w,{from:function(r){var t="function"==typeof this?this:w,n=h(u(r)[i]);if(n){var o=u(n.call(r));return o.constructor===t?o:new t(function(r){return o.subscribe(r)})}return new t(function(t){var n=!1;return e(function(){if(!n){try{if(a(r,!1,function(r){if(t.next(r),n)return v})===v)return}catch(e){if(n)throw e;return void t.error(e)}t.complete()}}),function(){n=!0}})},of:function(){for(var r=0,t=arguments.length,n=new Array(t);r<t;)n[r]=arguments[r++];return new("function"==typeof this?this:w)(function(r){var t=!1;return e(function(){if(!t){for(var e=0;e<n.length;++e)if(r.next(n[e]),t)return;r.complete()}}),function(){t=!0}})}}),s(w.prototype,i,function(){return this}),r(r.G,{Observable:w}),require("./_set-species")("Observable");
|
||
},{"./_export":"NjVL","./_global":"kql1","./_core":"4KVo","./_microtask":"i1H+","./_wks":"3Mgd","./_a-function":"L6p4","./_an-object":"DBsB","./_an-instance":"XE1H","./_redefine-all":"5XX7","./_hide":"i5RL","./_for-of":"Pqba","./_set-species":"Bn5Q"}],"47+F":[function(require,module,exports) {
|
||
|
||
var e=require("./_global"),t=require("./_export"),n=require("./_user-agent"),r=[].slice,u=/MSIE .\./.test(n),i=function(e){return function(t,n){var u=arguments.length>2,i=!!u&&r.call(arguments,2);return e(u?function(){("function"==typeof t?t:Function(t)).apply(this,i)}:t,n)}};t(t.G+t.B+t.F*u,{setTimeout:i(e.setTimeout),setInterval:i(e.setInterval)});
|
||
},{"./_global":"kql1","./_export":"NjVL","./_user-agent":"SW/O"}],"hg3C":[function(require,module,exports) {
|
||
var e=require("./_export"),r=require("./_task");e(e.G+e.B,{setImmediate:r.set,clearImmediate:r.clear});
|
||
},{"./_export":"NjVL","./_task":"sbFn"}],"hFdU":[function(require,module,exports) {
|
||
|
||
for(var e=require("./es6.array.iterator"),t=require("./_object-keys"),i=require("./_redefine"),r=require("./_global"),s=require("./_hide"),L=require("./_iterators"),a=require("./_wks"),o=a("iterator"),l=a("toStringTag"),S=L.Array,n={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},u=t(n),T=0;T<u.length;T++){var c,g=u[T],M=n[g],y=r[g],f=y&&y.prototype;if(f&&(f[o]||s(f,o,S),f[l]||s(f,l,g),L[g]=S,M))for(c in e)f[c]||i(f,c,e[c],!0)}
|
||
},{"./es6.array.iterator":"2xsA","./_object-keys":"kfVX","./_redefine":"2l2h","./_global":"kql1","./_hide":"i5RL","./_iterators":"oANp","./_wks":"3Mgd"}],"mRa+":[function(require,module,exports) {
|
||
require("./modules/es6.symbol"),require("./modules/es6.object.create"),require("./modules/es6.object.define-property"),require("./modules/es6.object.define-properties"),require("./modules/es6.object.get-own-property-descriptor"),require("./modules/es6.object.get-prototype-of"),require("./modules/es6.object.keys"),require("./modules/es6.object.get-own-property-names"),require("./modules/es6.object.freeze"),require("./modules/es6.object.seal"),require("./modules/es6.object.prevent-extensions"),require("./modules/es6.object.is-frozen"),require("./modules/es6.object.is-sealed"),require("./modules/es6.object.is-extensible"),require("./modules/es6.object.assign"),require("./modules/es6.object.is"),require("./modules/es6.object.set-prototype-of"),require("./modules/es6.object.to-string"),require("./modules/es6.function.bind"),require("./modules/es6.function.name"),require("./modules/es6.function.has-instance"),require("./modules/es6.parse-int"),require("./modules/es6.parse-float"),require("./modules/es6.number.constructor"),require("./modules/es6.number.to-fixed"),require("./modules/es6.number.to-precision"),require("./modules/es6.number.epsilon"),require("./modules/es6.number.is-finite"),require("./modules/es6.number.is-integer"),require("./modules/es6.number.is-nan"),require("./modules/es6.number.is-safe-integer"),require("./modules/es6.number.max-safe-integer"),require("./modules/es6.number.min-safe-integer"),require("./modules/es6.number.parse-float"),require("./modules/es6.number.parse-int"),require("./modules/es6.math.acosh"),require("./modules/es6.math.asinh"),require("./modules/es6.math.atanh"),require("./modules/es6.math.cbrt"),require("./modules/es6.math.clz32"),require("./modules/es6.math.cosh"),require("./modules/es6.math.expm1"),require("./modules/es6.math.fround"),require("./modules/es6.math.hypot"),require("./modules/es6.math.imul"),require("./modules/es6.math.log10"),require("./modules/es6.math.log1p"),require("./modules/es6.math.log2"),require("./modules/es6.math.sign"),require("./modules/es6.math.sinh"),require("./modules/es6.math.tanh"),require("./modules/es6.math.trunc"),require("./modules/es6.string.from-code-point"),require("./modules/es6.string.raw"),require("./modules/es6.string.trim"),require("./modules/es6.string.iterator"),require("./modules/es6.string.code-point-at"),require("./modules/es6.string.ends-with"),require("./modules/es6.string.includes"),require("./modules/es6.string.repeat"),require("./modules/es6.string.starts-with"),require("./modules/es6.string.anchor"),require("./modules/es6.string.big"),require("./modules/es6.string.blink"),require("./modules/es6.string.bold"),require("./modules/es6.string.fixed"),require("./modules/es6.string.fontcolor"),require("./modules/es6.string.fontsize"),require("./modules/es6.string.italics"),require("./modules/es6.string.link"),require("./modules/es6.string.small"),require("./modules/es6.string.strike"),require("./modules/es6.string.sub"),require("./modules/es6.string.sup"),require("./modules/es6.date.now"),require("./modules/es6.date.to-json"),require("./modules/es6.date.to-iso-string"),require("./modules/es6.date.to-string"),require("./modules/es6.date.to-primitive"),require("./modules/es6.array.is-array"),require("./modules/es6.array.from"),require("./modules/es6.array.of"),require("./modules/es6.array.join"),require("./modules/es6.array.slice"),require("./modules/es6.array.sort"),require("./modules/es6.array.for-each"),require("./modules/es6.array.map"),require("./modules/es6.array.filter"),require("./modules/es6.array.some"),require("./modules/es6.array.every"),require("./modules/es6.array.reduce"),require("./modules/es6.array.reduce-right"),require("./modules/es6.array.index-of"),require("./modules/es6.array.last-index-of"),require("./modules/es6.array.copy-within"),require("./modules/es6.array.fill"),require("./modules/es6.array.find"),require("./modules/es6.array.find-index"),require("./modules/es6.array.species"),require("./modules/es6.array.iterator"),require("./modules/es6.regexp.constructor"),require("./modules/es6.regexp.exec"),require("./modules/es6.regexp.to-string"),require("./modules/es6.regexp.flags"),require("./modules/es6.regexp.match"),require("./modules/es6.regexp.replace"),require("./modules/es6.regexp.search"),require("./modules/es6.regexp.split"),require("./modules/es6.promise"),require("./modules/es6.map"),require("./modules/es6.set"),require("./modules/es6.weak-map"),require("./modules/es6.weak-set"),require("./modules/es6.typed.array-buffer"),require("./modules/es6.typed.data-view"),require("./modules/es6.typed.int8-array"),require("./modules/es6.typed.uint8-array"),require("./modules/es6.typed.uint8-clamped-array"),require("./modules/es6.typed.int16-array"),require("./modules/es6.typed.uint16-array"),require("./modules/es6.typed.int32-array"),require("./modules/es6.typed.uint32-array"),require("./modules/es6.typed.float32-array"),require("./modules/es6.typed.float64-array"),require("./modules/es6.reflect.apply"),require("./modules/es6.reflect.construct"),require("./modules/es6.reflect.define-property"),require("./modules/es6.reflect.delete-property"),require("./modules/es6.reflect.enumerate"),require("./modules/es6.reflect.get"),require("./modules/es6.reflect.get-own-property-descriptor"),require("./modules/es6.reflect.get-prototype-of"),require("./modules/es6.reflect.has"),require("./modules/es6.reflect.is-extensible"),require("./modules/es6.reflect.own-keys"),require("./modules/es6.reflect.prevent-extensions"),require("./modules/es6.reflect.set"),require("./modules/es6.reflect.set-prototype-of"),require("./modules/es7.array.includes"),require("./modules/es7.array.flat-map"),require("./modules/es7.array.flatten"),require("./modules/es7.string.at"),require("./modules/es7.string.pad-start"),require("./modules/es7.string.pad-end"),require("./modules/es7.string.trim-left"),require("./modules/es7.string.trim-right"),require("./modules/es7.string.match-all"),require("./modules/es7.symbol.async-iterator"),require("./modules/es7.symbol.observable"),require("./modules/es7.object.get-own-property-descriptors"),require("./modules/es7.object.values"),require("./modules/es7.object.entries"),require("./modules/es7.object.define-getter"),require("./modules/es7.object.define-setter"),require("./modules/es7.object.lookup-getter"),require("./modules/es7.object.lookup-setter"),require("./modules/es7.map.to-json"),require("./modules/es7.set.to-json"),require("./modules/es7.map.of"),require("./modules/es7.set.of"),require("./modules/es7.weak-map.of"),require("./modules/es7.weak-set.of"),require("./modules/es7.map.from"),require("./modules/es7.set.from"),require("./modules/es7.weak-map.from"),require("./modules/es7.weak-set.from"),require("./modules/es7.global"),require("./modules/es7.system.global"),require("./modules/es7.error.is-error"),require("./modules/es7.math.clamp"),require("./modules/es7.math.deg-per-rad"),require("./modules/es7.math.degrees"),require("./modules/es7.math.fscale"),require("./modules/es7.math.iaddh"),require("./modules/es7.math.isubh"),require("./modules/es7.math.imulh"),require("./modules/es7.math.rad-per-deg"),require("./modules/es7.math.radians"),require("./modules/es7.math.scale"),require("./modules/es7.math.umulh"),require("./modules/es7.math.signbit"),require("./modules/es7.promise.finally"),require("./modules/es7.promise.try"),require("./modules/es7.reflect.define-metadata"),require("./modules/es7.reflect.delete-metadata"),require("./modules/es7.reflect.get-metadata"),require("./modules/es7.reflect.get-metadata-keys"),require("./modules/es7.reflect.get-own-metadata"),require("./modules/es7.reflect.get-own-metadata-keys"),require("./modules/es7.reflect.has-metadata"),require("./modules/es7.reflect.has-own-metadata"),require("./modules/es7.reflect.metadata"),require("./modules/es7.asap"),require("./modules/es7.observable"),require("./modules/web.timers"),require("./modules/web.immediate"),require("./modules/web.dom.iterable"),module.exports=require("./modules/_core");
|
||
},{"./modules/es6.symbol":"s5uV","./modules/es6.object.create":"ELq7","./modules/es6.object.define-property":"SeKy","./modules/es6.object.define-properties":"FFVz","./modules/es6.object.get-own-property-descriptor":"3eOb","./modules/es6.object.get-prototype-of":"x4A6","./modules/es6.object.keys":"oiqN","./modules/es6.object.get-own-property-names":"N+x5","./modules/es6.object.freeze":"3QMv","./modules/es6.object.seal":"y8Nt","./modules/es6.object.prevent-extensions":"vJzf","./modules/es6.object.is-frozen":"3UcE","./modules/es6.object.is-sealed":"1VI7","./modules/es6.object.is-extensible":"CvEg","./modules/es6.object.assign":"fRec","./modules/es6.object.is":"GEUt","./modules/es6.object.set-prototype-of":"CQxr","./modules/es6.object.to-string":"tS/z","./modules/es6.function.bind":"eBLX","./modules/es6.function.name":"WtEG","./modules/es6.function.has-instance":"YlR3","./modules/es6.parse-int":"OCDI","./modules/es6.parse-float":"i7Me","./modules/es6.number.constructor":"uYep","./modules/es6.number.to-fixed":"dVzo","./modules/es6.number.to-precision":"2Kwy","./modules/es6.number.epsilon":"9Dec","./modules/es6.number.is-finite":"oWwC","./modules/es6.number.is-integer":"N7Jd","./modules/es6.number.is-nan":"RsrB","./modules/es6.number.is-safe-integer":"fbTZ","./modules/es6.number.max-safe-integer":"JxHc","./modules/es6.number.min-safe-integer":"X6hw","./modules/es6.number.parse-float":"IKam","./modules/es6.number.parse-int":"0QjI","./modules/es6.math.acosh":"FaF2","./modules/es6.math.asinh":"oL1m","./modules/es6.math.atanh":"PhwT","./modules/es6.math.cbrt":"fi1h","./modules/es6.math.clz32":"fJAy","./modules/es6.math.cosh":"kseY","./modules/es6.math.expm1":"hyI8","./modules/es6.math.fround":"N7ZU","./modules/es6.math.hypot":"HGHV","./modules/es6.math.imul":"Pasv","./modules/es6.math.log10":"zlsv","./modules/es6.math.log1p":"RR3i","./modules/es6.math.log2":"b6PB","./modules/es6.math.sign":"BHWJ","./modules/es6.math.sinh":"7f0F","./modules/es6.math.tanh":"GaA9","./modules/es6.math.trunc":"qy71","./modules/es6.string.from-code-point":"i8rB","./modules/es6.string.raw":"7+Dt","./modules/es6.string.trim":"64Z1","./modules/es6.string.iterator":"Wu89","./modules/es6.string.code-point-at":"P7ku","./modules/es6.string.ends-with":"MUpt","./modules/es6.string.includes":"IvzQ","./modules/es6.string.repeat":"s8Pp","./modules/es6.string.starts-with":"hSvU","./modules/es6.string.anchor":"Qidu","./modules/es6.string.big":"8zi4","./modules/es6.string.blink":"t+Da","./modules/es6.string.bold":"3VlC","./modules/es6.string.fixed":"BahM","./modules/es6.string.fontcolor":"f6mn","./modules/es6.string.fontsize":"Du0n","./modules/es6.string.italics":"EmZX","./modules/es6.string.link":"mlNr","./modules/es6.string.small":"QeD6","./modules/es6.string.strike":"+ny4","./modules/es6.string.sub":"Pvqx","./modules/es6.string.sup":"mRpz","./modules/es6.date.now":"qW2d","./modules/es6.date.to-json":"DLwC","./modules/es6.date.to-iso-string":"Q9dY","./modules/es6.date.to-string":"A8WX","./modules/es6.date.to-primitive":"jJtq","./modules/es6.array.is-array":"OdQU","./modules/es6.array.from":"hO+0","./modules/es6.array.of":"ARIR","./modules/es6.array.join":"6e5f","./modules/es6.array.slice":"TSa/","./modules/es6.array.sort":"xw8W","./modules/es6.array.for-each":"bomu","./modules/es6.array.map":"4+P4","./modules/es6.array.filter":"kLvk","./modules/es6.array.some":"jLap","./modules/es6.array.every":"KLYK","./modules/es6.array.reduce":"d/Z7","./modules/es6.array.reduce-right":"Wzw6","./modules/es6.array.index-of":"jGln","./modules/es6.array.last-index-of":"5iGR","./modules/es6.array.copy-within":"8vJR","./modules/es6.array.fill":"3fHC","./modules/es6.array.find":"+HBF","./modules/es6.array.find-index":"3xRc","./modules/es6.array.species":"Smp7","./modules/es6.array.iterator":"2xsA","./modules/es6.regexp.constructor":"hBwo","./modules/es6.regexp.exec":"ej7E","./modules/es6.regexp.to-string":"yEH7","./modules/es6.regexp.flags":"57SA","./modules/es6.regexp.match":"yikX","./modules/es6.regexp.replace":"eUHu","./modules/es6.regexp.search":"iHvG","./modules/es6.regexp.split":"V8KN","./modules/es6.promise":"ar2B","./modules/es6.map":"0v0j","./modules/es6.set":"ig+w","./modules/es6.weak-map":"yBwO","./modules/es6.weak-set":"YtBU","./modules/es6.typed.array-buffer":"tZr0","./modules/es6.typed.data-view":"6s1M","./modules/es6.typed.int8-array":"W7MG","./modules/es6.typed.uint8-array":"n9td","./modules/es6.typed.uint8-clamped-array":"m71d","./modules/es6.typed.int16-array":"YGkr","./modules/es6.typed.uint16-array":"OaOh","./modules/es6.typed.int32-array":"sUYQ","./modules/es6.typed.uint32-array":"XuMj","./modules/es6.typed.float32-array":"V93U","./modules/es6.typed.float64-array":"KMMD","./modules/es6.reflect.apply":"XlB+","./modules/es6.reflect.construct":"JeCu","./modules/es6.reflect.define-property":"VZPr","./modules/es6.reflect.delete-property":"kfrU","./modules/es6.reflect.enumerate":"pLCm","./modules/es6.reflect.get":"iEI9","./modules/es6.reflect.get-own-property-descriptor":"eHzb","./modules/es6.reflect.get-prototype-of":"wht9","./modules/es6.reflect.has":"sj65","./modules/es6.reflect.is-extensible":"Nj86","./modules/es6.reflect.own-keys":"/wy/","./modules/es6.reflect.prevent-extensions":"y3HT","./modules/es6.reflect.set":"0ndf","./modules/es6.reflect.set-prototype-of":"olbq","./modules/es7.array.includes":"EHCj","./modules/es7.array.flat-map":"moLY","./modules/es7.array.flatten":"3b3L","./modules/es7.string.at":"uHWZ","./modules/es7.string.pad-start":"fWC9","./modules/es7.string.pad-end":"XG7E","./modules/es7.string.trim-left":"yPLu","./modules/es7.string.trim-right":"n2or","./modules/es7.string.match-all":"U9WL","./modules/es7.symbol.async-iterator":"4Ibo","./modules/es7.symbol.observable":"CwRI","./modules/es7.object.get-own-property-descriptors":"MZQr","./modules/es7.object.values":"cZE6","./modules/es7.object.entries":"beat","./modules/es7.object.define-getter":"mNK1","./modules/es7.object.define-setter":"DPSG","./modules/es7.object.lookup-getter":"Y0di","./modules/es7.object.lookup-setter":"/biA","./modules/es7.map.to-json":"VZya","./modules/es7.set.to-json":"omDO","./modules/es7.map.of":"PjD2","./modules/es7.set.of":"Z2Pq","./modules/es7.weak-map.of":"ByVw","./modules/es7.weak-set.of":"2CYP","./modules/es7.map.from":"Swiz","./modules/es7.set.from":"yWUZ","./modules/es7.weak-map.from":"X04t","./modules/es7.weak-set.from":"8Tbe","./modules/es7.global":"SAyU","./modules/es7.system.global":"ixkq","./modules/es7.error.is-error":"p9Qi","./modules/es7.math.clamp":"DPl4","./modules/es7.math.deg-per-rad":"qvLd","./modules/es7.math.degrees":"vOCQ","./modules/es7.math.fscale":"bbog","./modules/es7.math.iaddh":"u35Z","./modules/es7.math.isubh":"8AMA","./modules/es7.math.imulh":"PjOg","./modules/es7.math.rad-per-deg":"MDih","./modules/es7.math.radians":"kkYP","./modules/es7.math.scale":"h4TH","./modules/es7.math.umulh":"Lf/G","./modules/es7.math.signbit":"dibz","./modules/es7.promise.finally":"5Per","./modules/es7.promise.try":"vZUa","./modules/es7.reflect.define-metadata":"BSfr","./modules/es7.reflect.delete-metadata":"JW9N","./modules/es7.reflect.get-metadata":"x5Yv","./modules/es7.reflect.get-metadata-keys":"zaK7","./modules/es7.reflect.get-own-metadata":"Dz2Z","./modules/es7.reflect.get-own-metadata-keys":"/sJY","./modules/es7.reflect.has-metadata":"69T0","./modules/es7.reflect.has-own-metadata":"UCXJ","./modules/es7.reflect.metadata":"iEkw","./modules/es7.asap":"OO50","./modules/es7.observable":"3eRG","./modules/web.timers":"47+F","./modules/web.immediate":"hg3C","./modules/web.dom.iterable":"hFdU","./modules/_core":"4KVo"}],"j0pQ":[function(require,module,exports) {
|
||
var global = arguments[3];
|
||
var t=arguments[3];!function(t){"use strict";var r,e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag",u="object"==typeof module,h=t.regeneratorRuntime;if(h)u&&(module.exports=h);else{(h=t.regeneratorRuntime=u?module.exports:{}).wrap=w;var s="suspendedStart",f="suspendedYield",l="executing",p="completed",y={},v={};v[i]=function(){return this};var d=Object.getPrototypeOf,g=d&&d(d(P([])));g&&g!==e&&n.call(g,i)&&(v=g);var m=E.prototype=x.prototype=Object.create(v);b.prototype=m.constructor=E,E.constructor=b,E[c]=b.displayName="GeneratorFunction",h.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===b||"GeneratorFunction"===(r.displayName||r.name))},h.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,E):(t.__proto__=E,c in t||(t[c]="GeneratorFunction")),t.prototype=Object.create(m),t},h.awrap=function(t){return{__await:t}},j(_.prototype),_.prototype[a]=function(){return this},h.AsyncIterator=_,h.async=function(t,r,e,n){var o=new _(w(t,r,e,n));return h.isGeneratorFunction(r)?o:o.next().then(function(t){return t.done?t.value:o.next()})},j(m),m[c]="Generator",m[i]=function(){return this},m.toString=function(){return"[object Generator]"},h.keys=function(t){var r=[];for(var e in t)r.push(e);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},h.values=P,N.prototype={constructor:N,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(G),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=r)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function o(n,o){return c.type="throw",c.arg=t,e.next=n,o&&(e.method="next",e.arg=r),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),h=n.call(a,"finallyLoc");if(u&&h){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!h)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),y},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),G(e),y}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;G(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:P(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),y}}}function w(t,r,e,n){var o=r&&r.prototype instanceof x?r:x,i=Object.create(o.prototype),a=new N(n||[]);return i._invoke=function(t,r,e){var n=s;return function(o,i){if(n===l)throw new Error("Generator is already running");if(n===p){if("throw"===o)throw i;return S()}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var c=O(a,e);if(c){if(c===y)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if(n===s)throw n=p,e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n=l;var u=L(t,r,e);if("normal"===u.type){if(n=e.done?p:f,u.arg===y)continue;return{value:u.arg,done:e.done}}"throw"===u.type&&(n=p,e.method="throw",e.arg=u.arg)}}}(t,e,a),i}function L(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(n){return{type:"throw",arg:n}}}function x(){}function b(){}function E(){}function j(t){["next","throw","return"].forEach(function(r){t[r]=function(t){return this._invoke(r,t)}})}function _(r){function e(t,o,i,a){var c=L(r[t],r,o);if("throw"!==c.type){var u=c.arg,h=u.value;return h&&"object"==typeof h&&n.call(h,"__await")?Promise.resolve(h.__await).then(function(t){e("next",t,i,a)},function(t){e("throw",t,i,a)}):Promise.resolve(h).then(function(t){u.value=t,i(u)},a)}a(c.arg)}var o;"object"==typeof t.process&&t.process.domain&&(e=t.process.domain.bind(e)),this._invoke=function(t,r){function n(){return new Promise(function(n,o){e(t,r,n,o)})}return o=o?o.then(n,n):n()}}function O(t,e){var n=t.iterator[e.method];if(n===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=r,O(t,e),"throw"===e.method))return y;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var o=L(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,y;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,y):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,y)}function k(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function G(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function P(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function e(){for(;++o<t.length;)if(n.call(t,o))return e.value=t[o],e.done=!1,e;return e.value=r,e.done=!0,e};return a.next=a}}return{next:S}}function S(){return{value:r,done:!0}}}("object"==typeof t?t:"object"==typeof window?window:"object"==typeof self?self:this);
|
||
},{}],"b8Gs":[function(require,module,exports) {
|
||
module.exports=function(n,r){var t=r===Object(r)?function(n){return r[n]}:r;return function(r){return String(r).replace(n,t)}};
|
||
},{}],"7M1N":[function(require,module,exports) {
|
||
var e=require("./_export"),r=require("./_replacer")(/[\\^$*+?.()|[\]{}]/g,"\\$&");e(e.S,"RegExp",{escape:function(e){return r(e)}});
|
||
},{"./_export":"NjVL","./_replacer":"b8Gs"}],"65p1":[function(require,module,exports) {
|
||
require("../../modules/core.regexp.escape"),module.exports=require("../../modules/_core").RegExp.escape;
|
||
},{"../../modules/core.regexp.escape":"7M1N","../../modules/_core":"4KVo"}],"JIy0":[function(require,module,exports) {
|
||
var global = arguments[3];
|
||
|
||
var e=arguments[3];if(require("core-js/shim"),require("regenerator-runtime/runtime"),require("core-js/fn/regexp/escape"),e._babelPolyfill)throw new Error("only one instance of babel-polyfill is allowed");e._babelPolyfill=!0;var r="defineProperty";function i(e,i,n){e[i]||Object[r](e,i,{writable:!0,configurable:!0,value:n})}i(String.prototype,"padLeft","".padStart),i(String.prototype,"padRight","".padEnd),"pop,reverse,shift,keys,values,entries,indexOf,every,some,forEach,map,filter,find,findIndex,includes,join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill".split(",").forEach(function(e){[][e]&&i(Array,e,Function.call.bind([][e]))});
|
||
},{"core-js/shim":"mRa+","regenerator-runtime/runtime":"j0pQ","core-js/fn/regexp/escape":"65p1"}],"sBqc":[function(require,module,exports) {
|
||
var s=1e3,e=60*s,r=60*e,a=24*r,n=7*a,c=365.25*a;function t(t){if(!((t=String(t)).length>100)){var u=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(u){var i=parseFloat(u[1]);switch((u[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return i*c;case"weeks":case"week":case"w":return i*n;case"days":case"day":case"d":return i*a;case"hours":case"hour":case"hrs":case"hr":case"h":return i*r;case"minutes":case"minute":case"mins":case"min":case"m":return i*e;case"seconds":case"second":case"secs":case"sec":case"s":return i*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return i;default:return}}}}function u(n){var c=Math.abs(n);return c>=a?Math.round(n/a)+"d":c>=r?Math.round(n/r)+"h":c>=e?Math.round(n/e)+"m":c>=s?Math.round(n/s)+"s":n+"ms"}function i(n){var c=Math.abs(n);return c>=a?o(n,c,a,"day"):c>=r?o(n,c,r,"hour"):c>=e?o(n,c,e,"minute"):c>=s?o(n,c,s,"second"):n+" ms"}function o(s,e,r,a){var n=e>=1.5*r;return Math.round(s/r)+" "+a+(n?"s":"")}module.exports=function(s,e){e=e||{};var r=typeof s;if("string"===r&&s.length>0)return t(s);if("number"===r&&isFinite(s))return e.long?i(s):u(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))};
|
||
},{}],"zSpg":[function(require,module,exports) {
|
||
function e(e){return o(e)||t(e)||n(e)||r()}function r(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function n(e,r){if(e){if("string"==typeof e)return a(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,r):void 0}}function t(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function o(e){if(Array.isArray(e))return a(e)}function a(e,r){(null==r||r>e.length)&&(r=e.length);for(var n=0,t=new Array(r);n<r;n++)t[n]=e[n];return t}function i(r){function n(e){var r,o=null;function a(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];if(a.enabled){var i=a,s=Number(new Date),u=s-(r||s);i.diff=u,i.prev=r,i.curr=s,r=s,t[0]=n.coerce(t[0]),"string"!=typeof t[0]&&t.unshift("%O");var l=0;t[0]=t[0].replace(/%([a-zA-Z%])/g,function(e,r){if("%%"===e)return"%";l++;var o=n.formatters[r];if("function"==typeof o){var a=t[l];e=o.call(i,a),t.splice(l,1),l--}return e}),n.formatArgs.call(i,t),(i.log||n.log).apply(i,t)}}return a.namespace=e,a.useColors=n.useColors(),a.color=n.selectColor(e),a.extend=t,a.destroy=n.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:function(){return null===o?n.enabled(e):o},set:function(e){o=e}}),"function"==typeof n.init&&n.init(a),a}function t(e,r){var t=n(this.namespace+(void 0===r?":":r)+e);return t.log=this.log,t}function o(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return n.debug=n,n.default=n,n.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},n.disable=function(){var r=[].concat(e(n.names.map(o)),e(n.skips.map(o).map(function(e){return"-"+e}))).join(",");return n.enable(""),r},n.enable=function(e){var r;n.save(e),n.names=[],n.skips=[];var t=("string"==typeof e?e:"").split(/[\s,]+/),o=t.length;for(r=0;r<o;r++)t[r]&&("-"===(e=t[r].replace(/\*/g,".*?"))[0]?n.skips.push(new RegExp("^"+e.substr(1)+"$")):n.names.push(new RegExp("^"+e+"$")))},n.enabled=function(e){if("*"===e[e.length-1])return!0;var r,t;for(r=0,t=n.skips.length;r<t;r++)if(n.skips[r].test(e))return!1;for(r=0,t=n.names.length;r<t;r++)if(n.names[r].test(e))return!0;return!1},n.humanize=require("ms"),n.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(r).forEach(function(e){n[e]=r[e]}),n.names=[],n.skips=[],n.formatters={},n.selectColor=function(e){for(var r=0,t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return n.colors[Math.abs(r)%n.colors.length]},n.enable(n.load()),n}module.exports=i;
|
||
},{"ms":"sBqc"}],"g5I+":[function(require,module,exports) {
|
||
|
||
var t,e,n=module.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function i(e){if(t===setTimeout)return setTimeout(e,0);if((t===r||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}function u(t){if(e===clearTimeout)return clearTimeout(t);if((e===o||!e)&&clearTimeout)return e=clearTimeout,clearTimeout(t);try{return e(t)}catch(n){try{return e.call(null,t)}catch(n){return e.call(this,t)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:r}catch(n){t=r}try{e="function"==typeof clearTimeout?clearTimeout:o}catch(n){e=o}}();var c,s=[],l=!1,a=-1;function f(){l&&c&&(l=!1,c.length?s=c.concat(s):a=-1,s.length&&h())}function h(){if(!l){var t=i(f);l=!0;for(var e=s.length;e;){for(c=s,s=[];++a<e;)c&&c[a].run();a=-1,e=s.length}c=null,l=!1,u(t)}}function m(t,e){this.fun=t,this.array=e}function p(){}n.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];s.push(new m(t,e)),1!==s.length||l||i(h)},m.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.env={},n.argv=[],n.version="",n.versions={},n.on=p,n.addListener=p,n.once=p,n.off=p,n.removeListener=p,n.removeAllListeners=p,n.emit=p,n.prependListener=p,n.prependOnceListener=p,n.listeners=function(t){return[]},n.binding=function(t){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(t){throw new Error("process.chdir is not supported")},n.umask=function(){return 0};
|
||
},{}],"F8gk":[function(require,module,exports) {
|
||
var process = require("process");
|
||
var e=require("process");function o(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function C(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+module.exports.humanize(this.diff),this.useColors){var o="color: "+this.color;e.splice(1,0,o,"color: inherit");var C=0,t=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(C++,"%c"===e&&(t=C))}),e.splice(t,0,o)}}function t(e){try{e?exports.storage.setItem("debug",e):exports.storage.removeItem("debug")}catch(o){}}function r(){var o;try{o=exports.storage.getItem("debug")}catch(C){}return!o&&void 0!==e&&"env"in e&&(o=void 0),o}function n(){try{return localStorage}catch(e){}}exports.formatArgs=C,exports.save=t,exports.load=r,exports.useColors=o,exports.storage=n(),exports.destroy=function(){var e=!1;return function(){e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}}(),exports.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],exports.log=console.debug||console.log||function(){},module.exports=require("./common")(exports);var{formatters:s}=module.exports;s.j=function(e){try{return JSON.stringify(e)}catch(o){return"[UnexpectedJSONParseError]: "+o.message}};
|
||
},{"./common":"zSpg","process":"g5I+"}],"wIHY":[function(require,module,exports) {
|
||
"use strict";var e,t="object"==typeof Reflect?Reflect:null,n=t&&"function"==typeof t.apply?t.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};function r(e){console&&console.warn&&console.warn(e)}e=t&&"function"==typeof t.ownKeys?t.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}module.exports=o,module.exports.once=m,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function u(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function f(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function c(e,t,n,i){var o,s,c;if(u(n),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),c=s[t]),void 0===c)c=s[t]=n,++e._eventsCount;else if("function"==typeof c?c=s[t]=i?[n,c]:[c,n]:i?c.unshift(n):c.push(n),(o=f(e))>0&&c.length>o&&!c.warned){c.warned=!0;var v=new Error("Possible EventEmitter memory leak detected. "+c.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");v.name="MaxListenersExceededWarning",v.emitter=e,v.type=t,v.count=c.length,r(v)}return e}function v(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function l(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=v.bind(r);return i.listener=n,r.wrapFn=i,i}function p(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?d(i):h(i,i.length)}function a(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function h(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function y(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function d(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function m(e,t){return new Promise(function(n,r){function i(n){e.removeListener(t,o),r(n)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),n([].slice.call(arguments))}g(e,t,o,{once:!0}),"error"!==t&&L(e,i,{once:!0})})}function L(e,t,n){"function"==typeof e.on&&g(e,"error",t,n)}function g(e,t,n,r){if("function"==typeof e.on)r.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,function i(o){r.once&&e.removeEventListener(t,i),n(o)})}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");s=e}}),o.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},o.prototype.getMaxListeners=function(){return f(this)},o.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,o=this._events;if(void 0!==o)i=i&&void 0===o.error;else if(!i)return!1;if(i){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var u=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw u.context=s,u}var f=o[e];if(void 0===f)return!1;if("function"==typeof f)n(f,this,t);else{var c=f.length,v=h(f,c);for(r=0;r<c;++r)n(v[r],this,t)}return!0},o.prototype.addListener=function(e,t){return c(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return c(this,e,t,!0)},o.prototype.once=function(e,t){return u(t),this.on(e,l(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return u(t),this.prependListener(e,l(this,e,t)),this},o.prototype.removeListener=function(e,t){var n,r,i,o,s;if(u(t),void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,o=n.length-1;o>=0;o--)if(n[o]===t||n[o].listener===t){s=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():y(n,i),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,s||t)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var i,o=Object.keys(n);for(r=0;r<o.length;++r)"removeListener"!==(i=o[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},o.prototype.listeners=function(e){return p(this,e,!0)},o.prototype.rawListeners=function(e){return p(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):a.call(e,t)},o.prototype.listenerCount=a,o.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]};
|
||
},{}],"hLMW":[function(require,module,exports) {
|
||
"use strict";function e(e,t){for(const r in t)Object.defineProperty(e,r,{value:t[r],enumerable:!0,configurable:!0});return e}function t(t,r,o){if(!t||"string"==typeof t)throw new TypeError("Please pass an Error to err-code");o||(o={}),"object"==typeof r&&(o=r,r=""),r&&(o.code=r);try{return e(t,o)}catch(n){o.message=t.message,o.stack=t.stack;const r=function(){};return r.prototype=Object.create(Object.getPrototypeOf(t)),e(new r,o)}}module.exports=t;
|
||
},{}],"zMOB":[function(require,module,exports) {
|
||
"use strict";function r(r){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),t=0;t<e.length;t++)e[t]=255;for(var n=0;n<r.length;n++){var o=r.charAt(n),a=o.charCodeAt(0);if(255!==e[a])throw new TypeError(o+" is ambiguous");e[a]=n}var f=r.length,i=r.charAt(0),h=Math.log(f)/Math.log(256),y=Math.log(256)/Math.log(f);function c(r){if("string"!=typeof r)throw new TypeError("Expected String");if(0===r.length)return new Uint8Array;var t=0;if(" "!==r[t]){for(var n=0,o=0;r[t]===i;)n++,t++;for(var a=(r.length-t)*h+1>>>0,y=new Uint8Array(a);r[t];){var c=e[r.charCodeAt(t)];if(255===c)return;for(var w=0,A=a-1;(0!==c||w<o)&&-1!==A;A--,w++)c+=f*y[A]>>>0,y[A]=c%256>>>0,c=c/256>>>0;if(0!==c)throw new Error("Non-zero carry");o=w,t++}if(" "!==r[t]){for(var g=a-o;g!==a&&0===y[g];)g++;for(var u=new Uint8Array(n+(a-g)),v=n;g!==a;)u[v++]=y[g++];return u}}}return{encode:function(e){if(e instanceof Uint8Array||(ArrayBuffer.isView(e)?e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):Array.isArray(e)&&(e=Uint8Array.from(e))),!(e instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===e.length)return"";for(var t=0,n=0,o=0,a=e.length;o!==a&&0===e[o];)o++,t++;for(var h=(a-o)*y+1>>>0,c=new Uint8Array(h);o!==a;){for(var w=e[o],A=0,g=h-1;(0!==w||A<n)&&-1!==g;g--,A++)w+=256*c[g]>>>0,c[g]=w%f>>>0,w=w/f>>>0;if(0!==w)throw new Error("Non-zero carry");n=A,o++}for(var u=h-n;u!==h&&0===c[u];)u++;for(var v=i.repeat(t);u<h;++u)v+=r.charAt(c[u]);return v},decodeUnsafe:c,decode:function(r){var e=c(r);if(e)return e;throw new Error("Non-base"+f+" character")}}}module.exports=r;
|
||
},{}],"4dv8":[function(require,module,exports) {
|
||
"use strict";function n(n,e){var r;if("undefined"==typeof Symbol||null==n[Symbol.iterator]){if(Array.isArray(n)||(r=t(n))||e&&n&&"number"==typeof n.length){r&&(n=r);var o=0,a=function(){};return{s:a,n:function(){return o>=n.length?{done:!0}:{done:!1,value:n[o++]}},e:function(n){throw n},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var u,i=!0,c=!1;return{s:function(){r=n[Symbol.iterator]()},n:function(){var n=r.next();return i=n.done,n},e:function(n){c=!0,u=n},f:function(){try{i||null==r.return||r.return()}finally{if(c)throw u}}}}function t(n,t){if(n){if("string"==typeof n)return e(n,t);var r=Object.prototype.toString.call(n).slice(8,-1);return"Object"===r&&n.constructor&&(r=n.constructor.name),"Map"===r||"Set"===r?Array.from(n):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?e(n,t):void 0}}function e(n,t){(null==t||t>n.length)&&(t=n.length);for(var e=0,r=new Array(t);e<t;e++)r[e]=n[e];return r}var r=new TextDecoder,o=function(n){return r.decode(n)},a=new TextEncoder,u=function(n){return a.encode(n)};function i(t,e){var r,o=new Uint8Array(e),a=0,u=n(t);try{for(u.s();!(r=u.n()).done;){var i=r.value;o.set(i,a),a+=i.length}}catch(c){u.e(c)}finally{u.f()}return o}module.exports={decodeText:o,encodeText:u,concat:i};
|
||
},{}],"frnQ":[function(require,module,exports) {
|
||
"use strict";function e(e,n){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=t(e))||n&&e&&"number"==typeof e.length){r&&(e=r);var o=0,i=function(){};return{s:i,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,c=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return c=e.done,e},e:function(e){u=!0,a=e},f:function(){try{c||null==r.return||r.return()}finally{if(u)throw a}}}}function t(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var a=require("./util"),c=a.encodeText,u=function(){function t(e,n,o,i){r(this,t),this.name=e,this.code=n,this.codeBuf=c(this.code),this.alphabet=i,this.codec=o(i)}return i(t,[{key:"encode",value:function(e){return this.codec.encode(e)}},{key:"decode",value:function(t){var n,r=e(t);try{for(r.s();!(n=r.n()).done;){var o=n.value;if(this.alphabet&&this.alphabet.indexOf(o)<0)throw new Error("invalid character '".concat(o,"' in '").concat(t,"'"))}}catch(i){r.e(i)}finally{r.f()}return this.codec.decode(t)}}]),t}();module.exports=u;
|
||
},{"./util":"4dv8"}],"hH6x":[function(require,module,exports) {
|
||
"use strict";var r=function(r,n,t){for(var e={},o=0;o<n.length;++o)e[n[o]]=o;for(var f=r.length;"="===r[f-1];)--f;for(var a=new Uint8Array(f*t/8|0),u=0,c=0,i=0,d=0;d<f;++d){var h=e[r[d]];if(void 0===h)throw new SyntaxError("Invalid character "+r[d]);c=c<<t|h,(u+=t)>=8&&(u-=8,a[i++]=255&c>>u)}if(u>=t||255&c<<8-u)throw new SyntaxError("Unexpected end of data");return a},n=function(r,n,t){for(var e="="===n[n.length-1],o=(1<<t)-1,f="",a=0,u=0,c=0;c<r.length;++c)for(u=u<<8|r[c],a+=8;a>t;)f+=n[o&u>>(a-=t)];if(a&&(f+=n[o&u<<t-a]),e)for(;f.length*t&7;)f+="=";return f},t=function(t){return function(e){return{encode:function(r){return n(r,e,t)},decode:function(n){return r(n,e,t)}}}};module.exports={rfc4648:t};
|
||
},{}],"zb+m":[function(require,module,exports) {
|
||
"use strict";var e=require("@multiformats/base-x"),a=require("./base.js"),r=require("./rfc4648"),s=r.rfc4648,b=require("./util"),u=b.decodeText,p=b.encodeText,d=function(){return{encode:u,decode:p}},t=[["identity","\0",d,""],["base2","0",s(1),"01"],["base8","7",s(3),"01234567"],["base10","9",e,"0123456789"],["base16","f",s(4),"0123456789abcdef"],["base16upper","F",s(4),"0123456789ABCDEF"],["base32hex","v",s(5),"0123456789abcdefghijklmnopqrstuv"],["base32hexupper","V",s(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV"],["base32hexpad","t",s(5),"0123456789abcdefghijklmnopqrstuv="],["base32hexpadupper","T",s(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV="],["base32","b",s(5),"abcdefghijklmnopqrstuvwxyz234567"],["base32upper","B",s(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"],["base32pad","c",s(5),"abcdefghijklmnopqrstuvwxyz234567="],["base32padupper","C",s(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567="],["base32z","h",s(5),"ybndrfg8ejkmcpqxot1uwisza345h769"],["base36","k",e,"0123456789abcdefghijklmnopqrstuvwxyz"],["base36upper","K",e,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"],["base58btc","z",e,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],["base58flickr","Z",e,"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"],["base64","m",s(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],["base64pad","M",s(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],["base64url","u",s(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"],["base64urlpad","U",s(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="]],c=t.reduce(function(e,r){return e[r[0]]=new a(r[0],r[1],r[2],r[3]),e},{}),n=t.reduce(function(e,a){return e[a[1]]=c[a[0]],e},{});module.exports={names:c,codes:n};
|
||
},{"@multiformats/base-x":"zMOB","./base.js":"frnQ","./rfc4648":"hH6x","./util":"4dv8"}],"GEzr":[function(require,module,exports) {
|
||
"use strict";var e=require("./constants"),r=require("./util"),t=r.encodeText,n=r.decodeText,o=r.concat;function c(e,r){if(!r)throw new Error("requires an encoded Uint8Array");var t=u(e),n=t.name,c=t.codeBuf;return d(n,r),o([c,r],c.length+r.length)}function s(e,r){var n=u(e),c=t(n.encode(r));return o([n.codeBuf,c],n.codeBuf.length+c.length)}function a(e){e instanceof Uint8Array&&(e=n(e));var r=e[0];return["f","F","v","V","t","T","b","B","c","C","h","k","K"].includes(r)&&(e=e.toLowerCase()),u(e[0]).decode(e.substring(1))}function i(e){if(e instanceof Uint8Array&&(e=n(e)),"[object String]"!==Object.prototype.toString.call(e))return!1;try{return u(e[0]).name}catch(r){return!1}}function d(e,r){u(e).decode(n(r))}function u(r){if(Object.prototype.hasOwnProperty.call(e.names,r))return e.names[r];if(Object.prototype.hasOwnProperty.call(e.codes,r))return e.codes[r];throw new Error("Unsupported encoding: ".concat(r))}function f(e){return e instanceof Uint8Array&&(e=n(e)),u(e[0])}exports=module.exports=c,exports.encode=s,exports.decode=a,exports.isEncoded=i,exports.encoding=u,exports.encodingFromData=f;var p=Object.freeze(e.names),l=Object.freeze(e.codes);exports.names=p,exports.codes=l;
|
||
},{"./constants":"zb+m","./util":"4dv8"}],"Q/oY":[function(require,module,exports) {
|
||
module.exports=a;var r=128,o=127,t=~o,e=Math.pow(2,31);function a(o,f,n){f=f||[];for(var u=n=n||0;o>=e;)f[n++]=255&o|r,o/=128;for(;o&t;)f[n++]=255&o|r,o>>>=7;return f[n]=0|o,a.bytes=n-u+1,f}
|
||
},{}],"J29v":[function(require,module,exports) {
|
||
module.exports=r;var e=128,o=127;function r(t,n){var a,d=0,h=0,i=n=n||0,l=t.length;do{if(i>=l)throw r.bytes=0,new RangeError("Could not decode varint");a=t[i++],d+=h<28?(a&o)<<h:(a&o)*Math.pow(2,h),h+=7}while(a>=e);return r.bytes=i-n,d}
|
||
},{}],"Bq+a":[function(require,module,exports) {
|
||
var o=Math.pow(2,7),t=Math.pow(2,14),a=Math.pow(2,21),p=Math.pow(2,28),h=Math.pow(2,35),w=Math.pow(2,42),M=Math.pow(2,49),r=Math.pow(2,56),e=Math.pow(2,63);module.exports=function(n){return n<o?1:n<t?2:n<a?3:n<p?4:n<h?5:n<w?6:n<M?7:n<r?8:n<e?9:10};
|
||
},{}],"u9n/":[function(require,module,exports) {
|
||
module.exports={encode:require("./encode.js"),decode:require("./decode.js"),encodingLength:require("./length.js")};
|
||
},{"./encode.js":"Q/oY","./decode.js":"J29v","./length.js":"Bq+a"}],"AwpH":[function(require,module,exports) {
|
||
"use strict";var e=Object.freeze({identity:0,sha1:17,"sha2-256":18,"sha2-512":19,"sha3-512":20,"sha3-384":21,"sha3-256":22,"sha3-224":23,"shake-128":24,"shake-256":25,"keccak-224":26,"keccak-256":27,"keccak-384":28,"keccak-512":29,blake3:30,"murmur3-128":34,"murmur3-32":35,"dbl-sha2-256":86,md4:212,md5:213,bmt:214,"sha2-256-trunc254-padded":4114,"ripemd-128":4178,"ripemd-160":4179,"ripemd-256":4180,"ripemd-320":4181,x11:4352,kangarootwelve:7425,"sm3-256":21325,"blake2b-8":45569,"blake2b-16":45570,"blake2b-24":45571,"blake2b-32":45572,"blake2b-40":45573,"blake2b-48":45574,"blake2b-56":45575,"blake2b-64":45576,"blake2b-72":45577,"blake2b-80":45578,"blake2b-88":45579,"blake2b-96":45580,"blake2b-104":45581,"blake2b-112":45582,"blake2b-120":45583,"blake2b-128":45584,"blake2b-136":45585,"blake2b-144":45586,"blake2b-152":45587,"blake2b-160":45588,"blake2b-168":45589,"blake2b-176":45590,"blake2b-184":45591,"blake2b-192":45592,"blake2b-200":45593,"blake2b-208":45594,"blake2b-216":45595,"blake2b-224":45596,"blake2b-232":45597,"blake2b-240":45598,"blake2b-248":45599,"blake2b-256":45600,"blake2b-264":45601,"blake2b-272":45602,"blake2b-280":45603,"blake2b-288":45604,"blake2b-296":45605,"blake2b-304":45606,"blake2b-312":45607,"blake2b-320":45608,"blake2b-328":45609,"blake2b-336":45610,"blake2b-344":45611,"blake2b-352":45612,"blake2b-360":45613,"blake2b-368":45614,"blake2b-376":45615,"blake2b-384":45616,"blake2b-392":45617,"blake2b-400":45618,"blake2b-408":45619,"blake2b-416":45620,"blake2b-424":45621,"blake2b-432":45622,"blake2b-440":45623,"blake2b-448":45624,"blake2b-456":45625,"blake2b-464":45626,"blake2b-472":45627,"blake2b-480":45628,"blake2b-488":45629,"blake2b-496":45630,"blake2b-504":45631,"blake2b-512":45632,"blake2s-8":45633,"blake2s-16":45634,"blake2s-24":45635,"blake2s-32":45636,"blake2s-40":45637,"blake2s-48":45638,"blake2s-56":45639,"blake2s-64":45640,"blake2s-72":45641,"blake2s-80":45642,"blake2s-88":45643,"blake2s-96":45644,"blake2s-104":45645,"blake2s-112":45646,"blake2s-120":45647,"blake2s-128":45648,"blake2s-136":45649,"blake2s-144":45650,"blake2s-152":45651,"blake2s-160":45652,"blake2s-168":45653,"blake2s-176":45654,"blake2s-184":45655,"blake2s-192":45656,"blake2s-200":45657,"blake2s-208":45658,"blake2s-216":45659,"blake2s-224":45660,"blake2s-232":45661,"blake2s-240":45662,"blake2s-248":45663,"blake2s-256":45664,"skein256-8":45825,"skein256-16":45826,"skein256-24":45827,"skein256-32":45828,"skein256-40":45829,"skein256-48":45830,"skein256-56":45831,"skein256-64":45832,"skein256-72":45833,"skein256-80":45834,"skein256-88":45835,"skein256-96":45836,"skein256-104":45837,"skein256-112":45838,"skein256-120":45839,"skein256-128":45840,"skein256-136":45841,"skein256-144":45842,"skein256-152":45843,"skein256-160":45844,"skein256-168":45845,"skein256-176":45846,"skein256-184":45847,"skein256-192":45848,"skein256-200":45849,"skein256-208":45850,"skein256-216":45851,"skein256-224":45852,"skein256-232":45853,"skein256-240":45854,"skein256-248":45855,"skein256-256":45856,"skein512-8":45857,"skein512-16":45858,"skein512-24":45859,"skein512-32":45860,"skein512-40":45861,"skein512-48":45862,"skein512-56":45863,"skein512-64":45864,"skein512-72":45865,"skein512-80":45866,"skein512-88":45867,"skein512-96":45868,"skein512-104":45869,"skein512-112":45870,"skein512-120":45871,"skein512-128":45872,"skein512-136":45873,"skein512-144":45874,"skein512-152":45875,"skein512-160":45876,"skein512-168":45877,"skein512-176":45878,"skein512-184":45879,"skein512-192":45880,"skein512-200":45881,"skein512-208":45882,"skein512-216":45883,"skein512-224":45884,"skein512-232":45885,"skein512-240":45886,"skein512-248":45887,"skein512-256":45888,"skein512-264":45889,"skein512-272":45890,"skein512-280":45891,"skein512-288":45892,"skein512-296":45893,"skein512-304":45894,"skein512-312":45895,"skein512-320":45896,"skein512-328":45897,"skein512-336":45898,"skein512-344":45899,"skein512-352":45900,"skein512-360":45901,"skein512-368":45902,"skein512-376":45903,"skein512-384":45904,"skein512-392":45905,"skein512-400":45906,"skein512-408":45907,"skein512-416":45908,"skein512-424":45909,"skein512-432":45910,"skein512-440":45911,"skein512-448":45912,"skein512-456":45913,"skein512-464":45914,"skein512-472":45915,"skein512-480":45916,"skein512-488":45917,"skein512-496":45918,"skein512-504":45919,"skein512-512":45920,"skein1024-8":45921,"skein1024-16":45922,"skein1024-24":45923,"skein1024-32":45924,"skein1024-40":45925,"skein1024-48":45926,"skein1024-56":45927,"skein1024-64":45928,"skein1024-72":45929,"skein1024-80":45930,"skein1024-88":45931,"skein1024-96":45932,"skein1024-104":45933,"skein1024-112":45934,"skein1024-120":45935,"skein1024-128":45936,"skein1024-136":45937,"skein1024-144":45938,"skein1024-152":45939,"skein1024-160":45940,"skein1024-168":45941,"skein1024-176":45942,"skein1024-184":45943,"skein1024-192":45944,"skein1024-200":45945,"skein1024-208":45946,"skein1024-216":45947,"skein1024-224":45948,"skein1024-232":45949,"skein1024-240":45950,"skein1024-248":45951,"skein1024-256":45952,"skein1024-264":45953,"skein1024-272":45954,"skein1024-280":45955,"skein1024-288":45956,"skein1024-296":45957,"skein1024-304":45958,"skein1024-312":45959,"skein1024-320":45960,"skein1024-328":45961,"skein1024-336":45962,"skein1024-344":45963,"skein1024-352":45964,"skein1024-360":45965,"skein1024-368":45966,"skein1024-376":45967,"skein1024-384":45968,"skein1024-392":45969,"skein1024-400":45970,"skein1024-408":45971,"skein1024-416":45972,"skein1024-424":45973,"skein1024-432":45974,"skein1024-440":45975,"skein1024-448":45976,"skein1024-456":45977,"skein1024-464":45978,"skein1024-472":45979,"skein1024-480":45980,"skein1024-488":45981,"skein1024-496":45982,"skein1024-504":45983,"skein1024-512":45984,"skein1024-520":45985,"skein1024-528":45986,"skein1024-536":45987,"skein1024-544":45988,"skein1024-552":45989,"skein1024-560":45990,"skein1024-568":45991,"skein1024-576":45992,"skein1024-584":45993,"skein1024-592":45994,"skein1024-600":45995,"skein1024-608":45996,"skein1024-616":45997,"skein1024-624":45998,"skein1024-632":45999,"skein1024-640":46e3,"skein1024-648":46001,"skein1024-656":46002,"skein1024-664":46003,"skein1024-672":46004,"skein1024-680":46005,"skein1024-688":46006,"skein1024-696":46007,"skein1024-704":46008,"skein1024-712":46009,"skein1024-720":46010,"skein1024-728":46011,"skein1024-736":46012,"skein1024-744":46013,"skein1024-752":46014,"skein1024-760":46015,"skein1024-768":46016,"skein1024-776":46017,"skein1024-784":46018,"skein1024-792":46019,"skein1024-800":46020,"skein1024-808":46021,"skein1024-816":46022,"skein1024-824":46023,"skein1024-832":46024,"skein1024-840":46025,"skein1024-848":46026,"skein1024-856":46027,"skein1024-864":46028,"skein1024-872":46029,"skein1024-880":46030,"skein1024-888":46031,"skein1024-896":46032,"skein1024-904":46033,"skein1024-912":46034,"skein1024-920":46035,"skein1024-928":46036,"skein1024-936":46037,"skein1024-944":46038,"skein1024-952":46039,"skein1024-960":46040,"skein1024-968":46041,"skein1024-976":46042,"skein1024-984":46043,"skein1024-992":46044,"skein1024-1000":46045,"skein1024-1008":46046,"skein1024-1016":46047,"skein1024-1024":46048,"poseidon-bls12_381-a2-fc1":46081,"poseidon-bls12_381-a2-fc1-sc":46082});module.exports={names:e};
|
||
},{}],"aFN1":[function(require,module,exports) {
|
||
"use strict";const{encoding:e}=require("multibase"),t=new TextDecoder("utf8");function n(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t}function r(r,o="utf8"){return"utf8"===o||"utf-8"===o?t.decode(r):"ascii"===o?n(r):e(o).encode(r)}module.exports=r;
|
||
},{"multibase":"GEzr"}],"YqS+":[function(require,module,exports) {
|
||
"use strict";const{encoding:e}=require("multibase"),t=new TextEncoder;function n(e){const t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}function r(r,o="utf8"){return"utf8"===o||"utf-8"===o?t.encode(r):"ascii"===o?n(r):e(o).decode(r)}module.exports=r;
|
||
},{"multibase":"GEzr"}],"qYui":[function(require,module,exports) {
|
||
"use strict";function t(t,e){e||(e=t.reduce((t,e)=>t+e.length,0));const n=new Uint8Array(e);let r=0;for(const o of t)n.set(o,r),r+=o.length;return n}module.exports=t;
|
||
},{}],"ubn9":[function(require,module,exports) {
|
||
"use strict";var r=require("multibase"),e=require("varint"),n=require("./constants"),t=n.names,o=require("uint8arrays/to-string"),i=require("uint8arrays/from-string"),a=require("uint8arrays/concat"),c={};for(var s in t){var u=s;c[t[u]]=u}function d(r){if(!(r instanceof Uint8Array))throw new Error("must be passed a Uint8Array");return o(r,"base16")}function h(r){return i(r,"base16")}function f(e){if(!(e instanceof Uint8Array))throw new Error("must be passed a Uint8Array");return o(r.encode("base58btc",e)).slice(1)}function l(e){var n=e instanceof Uint8Array?o(e):e;return r.decode("z"+n)}function w(r){if(!(r instanceof Uint8Array))throw new Error("multihash must be a Uint8Array");if(r.length<2)throw new Error("multihash too short. must be > 2 bytes.");var n=e.decode(r);if(!y(n))throw new Error("multihash unknown function code: 0x".concat(n.toString(16)));r=r.slice(e.decode.bytes);var t=e.decode(r);if(t<0)throw new Error("multihash invalid length: ".concat(t));if((r=r.slice(e.decode.bytes)).length!==t)throw new Error("multihash length inconsistent: 0x".concat(o(r,"base16")));return{code:n,name:c[n],length:t,digest:r}}function g(r,n,t){if(!r||void 0===n)throw new Error("multihash encode requires at least two args: digest, code");var o=m(n);if(!(r instanceof Uint8Array))throw new Error("digest should be a Uint8Array");if(null==t&&(t=r.length),t&&r.length!==t)throw new Error("digest length should be equal to specified length.");var i=e.encode(o),c=e.encode(t);return a([i,c,r],i.length+c.length+r.length)}function m(r){var e=r;if("string"==typeof r){if(void 0===t[r])throw new Error("Unrecognized hash function named: ".concat(r));e=t[r]}if("number"!=typeof e)throw new Error("Hash function code should be a number. Got: ".concat(e));if(void 0===c[e]&&!b(e))throw new Error("Unrecognized function code: ".concat(e));return e}function b(r){return r>0&&r<16}function y(r){return!!b(r)||!!c[r]}function v(r){w(r)}function E(r){return v(r),r.subarray(0,2)}Object.freeze(c),module.exports={names:t,codes:c,toHexString:d,fromHexString:h,toB58String:f,fromB58String:l,decode:w,encode:g,coerceCode:m,isAppCode:b,validate:v,prefix:E,isValidCode:y};
|
||
},{"multibase":"GEzr","varint":"u9n/","./constants":"AwpH","uint8arrays/to-string":"aFN1","uint8arrays/from-string":"YqS+","uint8arrays/concat":"qYui"}],"hChW":[function(require,module,exports) {
|
||
module.exports={encode:require("./encode.js"),decode:require("./decode.js"),encodingLength:require("./length.js")};
|
||
},{"./encode.js":"Q/oY","./decode.js":"J29v","./length.js":"Bq+a"}],"WJs3":[function(require,module,exports) {
|
||
"use strict";const r=require("varint"),n=require("uint8arrays/to-string"),t=require("uint8arrays/from-string");function e(r){return parseInt(n(r,"base16"),16)}function i(r){let n=r.toString(16);return n.length%2==1&&(n="0"+n),t(n,"base16")}function o(n){return Uint8Array.from(r.encode(e(n)))}function u(n){return Uint8Array.from(r.encode(n))}module.exports={numberToUint8Array:i,uint8ArrayToNumber:e,varintUint8ArrayEncode:o,varintEncode:u};
|
||
},{"varint":"hChW","uint8arrays/to-string":"aFN1","uint8arrays/from-string":"YqS+"}],"oX+Q":[function(require,module,exports) {
|
||
"use strict";const e=Object.freeze({identity:0,cidv1:1,cidv2:2,cidv3:3,ip4:4,tcp:6,sha1:17,"sha2-256":18,"sha2-512":19,"sha3-512":20,"sha3-384":21,"sha3-256":22,"sha3-224":23,"shake-128":24,"shake-256":25,"keccak-224":26,"keccak-256":27,"keccak-384":28,"keccak-512":29,blake3:30,dccp:33,"murmur3-128":34,"murmur3-32":35,ip6:41,ip6zone:42,path:47,multicodec:48,multihash:49,multiaddr:50,multibase:51,dns:53,dns4:54,dns6:55,dnsaddr:56,protobuf:80,cbor:81,raw:85,"dbl-sha2-256":86,rlp:96,bencode:99,"dag-pb":112,"dag-cbor":113,"libp2p-key":114,"git-raw":120,"torrent-info":123,"torrent-file":124,"leofcoin-block":129,"leofcoin-tx":130,"leofcoin-pr":131,sctp:132,"dag-jose":133,"dag-cose":134,"eth-block":144,"eth-block-list":145,"eth-tx-trie":146,"eth-tx":147,"eth-tx-receipt-trie":148,"eth-tx-receipt":149,"eth-state-trie":150,"eth-account-snapshot":151,"eth-storage-trie":152,"bitcoin-block":176,"bitcoin-tx":177,"bitcoin-witness-commitment":178,"zcash-block":192,"zcash-tx":193,docid:206,"stellar-block":208,"stellar-tx":209,md4:212,md5:213,bmt:214,"decred-block":224,"decred-tx":225,"ipld-ns":226,"ipfs-ns":227,"swarm-ns":228,"ipns-ns":229,zeronet:230,"secp256k1-pub":231,"bls12_381-g1-pub":234,"bls12_381-g2-pub":235,"x25519-pub":236,"ed25519-pub":237,"bls12_381-g1g2-pub":238,"dash-block":240,"dash-tx":241,"swarm-manifest":250,"swarm-feed":251,udp:273,"p2p-webrtc-star":275,"p2p-webrtc-direct":276,"p2p-stardust":277,"p2p-circuit":290,"dag-json":297,udt:301,utp:302,unix:400,thread:406,p2p:421,ipfs:421,https:443,onion:444,onion3:445,garlic64:446,garlic32:447,tls:448,quic:460,ws:477,wss:478,"p2p-websocket-star":479,http:480,json:512,messagepack:513,"libp2p-peer-record":769,"sha2-256-trunc254-padded":4114,"ripemd-128":4178,"ripemd-160":4179,"ripemd-256":4180,"ripemd-320":4181,x11:4352,"p256-pub":4608,"p384-pub":4609,"p521-pub":4610,"ed448-pub":4611,"x448-pub":4612,"ed25519-priv":4864,kangarootwelve:7425,"sm3-256":21325,"blake2b-8":45569,"blake2b-16":45570,"blake2b-24":45571,"blake2b-32":45572,"blake2b-40":45573,"blake2b-48":45574,"blake2b-56":45575,"blake2b-64":45576,"blake2b-72":45577,"blake2b-80":45578,"blake2b-88":45579,"blake2b-96":45580,"blake2b-104":45581,"blake2b-112":45582,"blake2b-120":45583,"blake2b-128":45584,"blake2b-136":45585,"blake2b-144":45586,"blake2b-152":45587,"blake2b-160":45588,"blake2b-168":45589,"blake2b-176":45590,"blake2b-184":45591,"blake2b-192":45592,"blake2b-200":45593,"blake2b-208":45594,"blake2b-216":45595,"blake2b-224":45596,"blake2b-232":45597,"blake2b-240":45598,"blake2b-248":45599,"blake2b-256":45600,"blake2b-264":45601,"blake2b-272":45602,"blake2b-280":45603,"blake2b-288":45604,"blake2b-296":45605,"blake2b-304":45606,"blake2b-312":45607,"blake2b-320":45608,"blake2b-328":45609,"blake2b-336":45610,"blake2b-344":45611,"blake2b-352":45612,"blake2b-360":45613,"blake2b-368":45614,"blake2b-376":45615,"blake2b-384":45616,"blake2b-392":45617,"blake2b-400":45618,"blake2b-408":45619,"blake2b-416":45620,"blake2b-424":45621,"blake2b-432":45622,"blake2b-440":45623,"blake2b-448":45624,"blake2b-456":45625,"blake2b-464":45626,"blake2b-472":45627,"blake2b-480":45628,"blake2b-488":45629,"blake2b-496":45630,"blake2b-504":45631,"blake2b-512":45632,"blake2s-8":45633,"blake2s-16":45634,"blake2s-24":45635,"blake2s-32":45636,"blake2s-40":45637,"blake2s-48":45638,"blake2s-56":45639,"blake2s-64":45640,"blake2s-72":45641,"blake2s-80":45642,"blake2s-88":45643,"blake2s-96":45644,"blake2s-104":45645,"blake2s-112":45646,"blake2s-120":45647,"blake2s-128":45648,"blake2s-136":45649,"blake2s-144":45650,"blake2s-152":45651,"blake2s-160":45652,"blake2s-168":45653,"blake2s-176":45654,"blake2s-184":45655,"blake2s-192":45656,"blake2s-200":45657,"blake2s-208":45658,"blake2s-216":45659,"blake2s-224":45660,"blake2s-232":45661,"blake2s-240":45662,"blake2s-248":45663,"blake2s-256":45664,"skein256-8":45825,"skein256-16":45826,"skein256-24":45827,"skein256-32":45828,"skein256-40":45829,"skein256-48":45830,"skein256-56":45831,"skein256-64":45832,"skein256-72":45833,"skein256-80":45834,"skein256-88":45835,"skein256-96":45836,"skein256-104":45837,"skein256-112":45838,"skein256-120":45839,"skein256-128":45840,"skein256-136":45841,"skein256-144":45842,"skein256-152":45843,"skein256-160":45844,"skein256-168":45845,"skein256-176":45846,"skein256-184":45847,"skein256-192":45848,"skein256-200":45849,"skein256-208":45850,"skein256-216":45851,"skein256-224":45852,"skein256-232":45853,"skein256-240":45854,"skein256-248":45855,"skein256-256":45856,"skein512-8":45857,"skein512-16":45858,"skein512-24":45859,"skein512-32":45860,"skein512-40":45861,"skein512-48":45862,"skein512-56":45863,"skein512-64":45864,"skein512-72":45865,"skein512-80":45866,"skein512-88":45867,"skein512-96":45868,"skein512-104":45869,"skein512-112":45870,"skein512-120":45871,"skein512-128":45872,"skein512-136":45873,"skein512-144":45874,"skein512-152":45875,"skein512-160":45876,"skein512-168":45877,"skein512-176":45878,"skein512-184":45879,"skein512-192":45880,"skein512-200":45881,"skein512-208":45882,"skein512-216":45883,"skein512-224":45884,"skein512-232":45885,"skein512-240":45886,"skein512-248":45887,"skein512-256":45888,"skein512-264":45889,"skein512-272":45890,"skein512-280":45891,"skein512-288":45892,"skein512-296":45893,"skein512-304":45894,"skein512-312":45895,"skein512-320":45896,"skein512-328":45897,"skein512-336":45898,"skein512-344":45899,"skein512-352":45900,"skein512-360":45901,"skein512-368":45902,"skein512-376":45903,"skein512-384":45904,"skein512-392":45905,"skein512-400":45906,"skein512-408":45907,"skein512-416":45908,"skein512-424":45909,"skein512-432":45910,"skein512-440":45911,"skein512-448":45912,"skein512-456":45913,"skein512-464":45914,"skein512-472":45915,"skein512-480":45916,"skein512-488":45917,"skein512-496":45918,"skein512-504":45919,"skein512-512":45920,"skein1024-8":45921,"skein1024-16":45922,"skein1024-24":45923,"skein1024-32":45924,"skein1024-40":45925,"skein1024-48":45926,"skein1024-56":45927,"skein1024-64":45928,"skein1024-72":45929,"skein1024-80":45930,"skein1024-88":45931,"skein1024-96":45932,"skein1024-104":45933,"skein1024-112":45934,"skein1024-120":45935,"skein1024-128":45936,"skein1024-136":45937,"skein1024-144":45938,"skein1024-152":45939,"skein1024-160":45940,"skein1024-168":45941,"skein1024-176":45942,"skein1024-184":45943,"skein1024-192":45944,"skein1024-200":45945,"skein1024-208":45946,"skein1024-216":45947,"skein1024-224":45948,"skein1024-232":45949,"skein1024-240":45950,"skein1024-248":45951,"skein1024-256":45952,"skein1024-264":45953,"skein1024-272":45954,"skein1024-280":45955,"skein1024-288":45956,"skein1024-296":45957,"skein1024-304":45958,"skein1024-312":45959,"skein1024-320":45960,"skein1024-328":45961,"skein1024-336":45962,"skein1024-344":45963,"skein1024-352":45964,"skein1024-360":45965,"skein1024-368":45966,"skein1024-376":45967,"skein1024-384":45968,"skein1024-392":45969,"skein1024-400":45970,"skein1024-408":45971,"skein1024-416":45972,"skein1024-424":45973,"skein1024-432":45974,"skein1024-440":45975,"skein1024-448":45976,"skein1024-456":45977,"skein1024-464":45978,"skein1024-472":45979,"skein1024-480":45980,"skein1024-488":45981,"skein1024-496":45982,"skein1024-504":45983,"skein1024-512":45984,"skein1024-520":45985,"skein1024-528":45986,"skein1024-536":45987,"skein1024-544":45988,"skein1024-552":45989,"skein1024-560":45990,"skein1024-568":45991,"skein1024-576":45992,"skein1024-584":45993,"skein1024-592":45994,"skein1024-600":45995,"skein1024-608":45996,"skein1024-616":45997,"skein1024-624":45998,"skein1024-632":45999,"skein1024-640":46e3,"skein1024-648":46001,"skein1024-656":46002,"skein1024-664":46003,"skein1024-672":46004,"skein1024-680":46005,"skein1024-688":46006,"skein1024-696":46007,"skein1024-704":46008,"skein1024-712":46009,"skein1024-720":46010,"skein1024-728":46011,"skein1024-736":46012,"skein1024-744":46013,"skein1024-752":46014,"skein1024-760":46015,"skein1024-768":46016,"skein1024-776":46017,"skein1024-784":46018,"skein1024-792":46019,"skein1024-800":46020,"skein1024-808":46021,"skein1024-816":46022,"skein1024-824":46023,"skein1024-832":46024,"skein1024-840":46025,"skein1024-848":46026,"skein1024-856":46027,"skein1024-864":46028,"skein1024-872":46029,"skein1024-880":46030,"skein1024-888":46031,"skein1024-896":46032,"skein1024-904":46033,"skein1024-912":46034,"skein1024-920":46035,"skein1024-928":46036,"skein1024-936":46037,"skein1024-944":46038,"skein1024-952":46039,"skein1024-960":46040,"skein1024-968":46041,"skein1024-976":46042,"skein1024-984":46043,"skein1024-992":46044,"skein1024-1000":46045,"skein1024-1008":46046,"skein1024-1016":46047,"skein1024-1024":46048,"poseidon-bls12_381-a2-fc1":46081,"poseidon-bls12_381-a2-fc1-sc":46082,"zeroxcert-imprint-256":52753,"fil-commitment-unsealed":61697,"fil-commitment-sealed":61698,"holochain-adr-v0":8417572,"holochain-adr-v1":8483108,"holochain-key-v0":9728292,"holochain-key-v1":9793828,"holochain-sig-v0":10645796,"holochain-sig-v1":10711332,"skynet-ns":11639056});module.exports={baseTable:e};
|
||
},{}],"gXCg":[function(require,module,exports) {
|
||
"use strict";const{baseTable:e}=require("./generated-table"),t=require("./util").varintEncode,o={},r={},c={};for(const a in e){const n=a,s=e[n];o[n]=t(s),r[n.toUpperCase().replace(/-/g,"_")]=s,c[s]||(c[s]=n)}Object.freeze(o),Object.freeze(r),Object.freeze(c);const n=Object.freeze(e);module.exports={nameToVarint:o,constantToCode:r,nameToCode:n,codeToName:c};
|
||
},{"./generated-table":"oX+Q","./util":"WJs3"}],"Bz9c":[function(require,module,exports) {
|
||
"use strict";const e=require("varint"),n=require("uint8arrays/concat"),r=require("./util"),{nameToVarint:t,constantToCode:o,nameToCode:i,codeToName:u}=require("./maps");function c(e,o){let i;if(e instanceof Uint8Array)i=r.varintUint8ArrayEncode(e);else{if(!t[e])throw new Error("multicodec not recognized");i=t[e]}return n([i,o],i.length+o.length)}function d(n){return e.decode(n),n.slice(e.decode.bytes)}function a(n){const r=e.decode(n),t=u[r];if(void 0===t)throw new Error(`Code "${r}" not found`);return t}function f(e){return u[e]}function m(e){const n=i[e];if(void 0===n)throw new Error(`Codec "${e}" not found`);return n}function g(n){return e.decode(n)}function s(e){const n=t[e];if(void 0===n)throw new Error(`Codec "${e}" not found`);return n}function C(e){return r.varintEncode(e)}function l(e){return a(e)}function w(e){return f(e)}function N(e){return m(e)}function T(e){return g(e)}function h(e){return s(e)}function v(e){return Array.from(C(e))}module.exports={addPrefix:c,rmPrefix:d,getNameFromData:a,getNameFromCode:f,getCodeFromName:m,getCodeFromData:g,getVarintFromName:s,getVarintFromCode:C,getCodec:l,getName:w,getNumber:N,getCode:T,getCodeVarint:h,getVarint:v,...o,nameToVarint:t,nameToCode:i,codeToName:u};
|
||
},{"varint":"hChW","uint8arrays/concat":"qYui","./util":"WJs3","./maps":"gXCg"}],"gN4c":[function(require,module,exports) {
|
||
"use strict";const e=require("multihashes"),t={checkCIDComponents:function(t){if(null==t)return"null values are not valid CIDs";if(0!==t.version&&1!==t.version)return"Invalid version, must be a number equal to 1 or 0";if("string"!=typeof t.codec)return"codec must be string";if(0===t.version){if("dag-pb"!==t.codec)return"codec must be 'dag-pb' for CIDv0";if("base58btc"!==t.multibaseName)return"multibaseName must be 'base58btc' for CIDv0"}if(!(t.multihash instanceof Uint8Array))return"multihash must be a Uint8Array";try{e.validate(t.multihash)}catch(r){let e=r.message;return e||(e="Multihash validation failed"),e}}};module.exports=t;
|
||
},{"multihashes":"ubn9"}],"mZxc":[function(require,module,exports) {
|
||
"use strict";function t(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0}module.exports=t;
|
||
},{}],"xTSP":[function(require,module,exports) {
|
||
"use strict";const t=require("multihashes"),e=require("multibase"),i=require("multicodec"),s=require("./cid-util"),r=require("uint8arrays/concat"),o=require("uint8arrays/to-string"),h=require("uint8arrays/equals"),n=i.nameToCode,a=Object.keys(n).reduce((t,e)=>(t[n[e]]=e,t),{}),c=Symbol.for("@ipld/js-cid/CID");class u{constructor(s,r,o,h){if(this.version,this.codec,this.multihash,Object.defineProperty(this,c,{value:!0}),u.isCID(s)){const t=s;return this.version=t.version,this.codec=t.codec,this.multihash=t.multihash,void(this.multibaseName=t.multibaseName||(0===t.version?"base58btc":"base32"))}if("string"==typeof s){const r=e.isEncoded(s);if(r){const t=e.decode(s);this.version=parseInt(t[0].toString(),16),this.codec=i.getCodec(t.slice(1)),this.multihash=i.rmPrefix(t.slice(1)),this.multibaseName=r}else this.version=0,this.codec="dag-pb",this.multihash=t.fromB58String(s),this.multibaseName="base58btc";return u.validateCID(this),void Object.defineProperty(this,"string",{value:s})}if(s instanceof Uint8Array){const t=parseInt(s[0].toString(),16);if(1===t){const e=s;this.version=t,this.codec=i.getCodec(e.slice(1)),this.multihash=i.rmPrefix(e.slice(1)),this.multibaseName="base32"}else this.version=0,this.codec="dag-pb",this.multihash=s,this.multibaseName="base58btc";u.validateCID(this)}else this.version=s,"number"==typeof r&&(r=a[r]),this.codec=r,this.multihash=o,this.multibaseName=h||(0===s?"base58btc":"base32"),u.validateCID(this)}get bytes(){let t=this._bytes;if(!t){if(0===this.version)t=this.multihash;else{if(1!==this.version)throw new Error("unsupported version");{const e=i.getCodeVarint(this.codec);t=r([[1],e,this.multihash],1+e.byteLength+this.multihash.byteLength)}}Object.defineProperty(this,"_bytes",{value:t})}return t}get prefix(){const e=i.getCodeVarint(this.codec),s=t.prefix(this.multihash);return r([[this.version],e,s],1+e.byteLength+s.byteLength)}get code(){return n[this.codec]}toV0(){if("dag-pb"!==this.codec)throw new Error("Cannot convert a non dag-pb CID to CIDv0");const{name:e,length:i}=t.decode(this.multihash);if("sha2-256"!==e)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");if(32!==i)throw new Error("Cannot convert non 32 byte multihash CID to CIDv0");return new u(0,this.codec,this.multihash)}toV1(){return new u(1,this.codec,this.multihash)}toBaseEncodedString(i=this.multibaseName){if(this.string&&0!==this.string.length&&i===this.multibaseName)return this.string;let s;if(0===this.version){if("base58btc"!==i)throw new Error("not supported with CIDv0, to support different bases, please migrate the instance do CIDv1, you can do that through cid.toV1()");s=t.toB58String(this.multihash)}else{if(1!==this.version)throw new Error("unsupported version");s=o(e.encode(i,this.bytes))}return i===this.multibaseName&&Object.defineProperty(this,"string",{value:s}),s}[Symbol.for("nodejs.util.inspect.custom")](){return"CID("+this.toString()+")"}toString(t){return this.toBaseEncodedString(t)}toJSON(){return{codec:this.codec,version:this.version,hash:this.multihash}}equals(t){return this.codec===t.codec&&this.version===t.version&&h(this.multihash,t.multihash)}static validateCID(t){const e=s.checkCIDComponents(t);if(e)throw new Error(e)}static isCID(t){return t instanceof u||Boolean(t&&t[c])}}u.codecs=n,module.exports=u;
|
||
},{"multihashes":"ubn9","multibase":"GEzr","multicodec":"Bz9c","./cid-util":"gN4c","uint8arrays/concat":"qYui","uint8arrays/to-string":"aFN1","uint8arrays/equals":"mZxc"}],"AnsR":[function(require,module,exports) {
|
||
"use strict";function n(n,e){for(var r=new Array(arguments.length-1),t=0,l=2,o=!0;l<arguments.length;)r[t++]=arguments[l++];return new Promise(function(l,u){r[t]=function(n){if(o)if(o=!1,n)u(n);else{for(var e=new Array(arguments.length-1),r=0;r<e.length;)e[r++]=arguments[r];l.apply(null,e)}};try{n.apply(e||null,r)}catch(a){o&&(o=!1,u(a))}})}module.exports=n;
|
||
},{}],"08vA":[function(require,module,exports) {
|
||
"use strict";var r=exports;r.length=function(r){var e=r.length;if(!e)return 0;for(var a=0;--e%4>1&&"="===r.charAt(e);)++a;return Math.ceil(3*r.length)/4-a};for(var e=new Array(64),a=new Array(123),t=0;t<64;)a[e[t]=t<26?t+65:t<52?t+71:t<62?t-4:t-59|43]=t++;r.encode=function(r,a,t){for(var n,i=null,o=[],c=0,s=0;a<t;){var h=r[a++];switch(s){case 0:o[c++]=e[h>>2],n=(3&h)<<4,s=1;break;case 1:o[c++]=e[n|h>>4],n=(15&h)<<2,s=2;break;case 2:o[c++]=e[n|h>>6],o[c++]=e[63&h],s=0}c>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,o)),c=0)}return s&&(o[c++]=e[n],o[c++]=61,1===s&&(o[c++]=61)),i?(c&&i.push(String.fromCharCode.apply(String,o.slice(0,c))),i.join("")):String.fromCharCode.apply(String,o.slice(0,c))};var n="invalid encoding";r.decode=function(r,e,t){for(var i,o=t,c=0,s=0;s<r.length;){var h=r.charCodeAt(s++);if(61===h&&c>1)break;if(void 0===(h=a[h]))throw Error(n);switch(c){case 0:i=h,c=1;break;case 1:e[t++]=i<<2|(48&h)>>4,i=h,c=2;break;case 2:e[t++]=(15&i)<<4|(60&h)>>2,i=h,c=3;break;case 3:e[t++]=(3&i)<<6|h,c=0}}if(1===c)throw Error(n);return t-o},r.test=function(r){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(r)};
|
||
},{}],"rQUj":[function(require,module,exports) {
|
||
"use strict";function t(){this._listeners={}}module.exports=t,t.prototype.on=function(t,s,e){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:s,ctx:e||this}),this},t.prototype.off=function(t,s){if(void 0===t)this._listeners={};else if(void 0===s)this._listeners[t]=[];else for(var e=this._listeners[t],i=0;i<e.length;)e[i].fn===s?e.splice(i,1):++i;return this},t.prototype.emit=function(t){var s=this._listeners[t];if(s){for(var e=[],i=1;i<arguments.length;)e.push(arguments[i++]);for(i=0;i<s.length;)s[i].fn.apply(s[i++].ctx,e)}return this};
|
||
},{}],"lW0B":[function(require,module,exports) {
|
||
"use strict";function n(n){return"undefined"!=typeof Float32Array?function(){var e=new Float32Array([-0]),t=new Uint8Array(e.buffer),r=128===t[3];function o(n,r,o){e[0]=n,r[o]=t[0],r[o+1]=t[1],r[o+2]=t[2],r[o+3]=t[3]}function u(n,r,o){e[0]=n,r[o]=t[3],r[o+1]=t[2],r[o+2]=t[1],r[o+3]=t[0]}function i(n,r){return t[0]=n[r],t[1]=n[r+1],t[2]=n[r+2],t[3]=n[r+3],e[0]}function a(n,r){return t[3]=n[r],t[2]=n[r+1],t[1]=n[r+2],t[0]=n[r+3],e[0]}n.writeFloatLE=r?o:u,n.writeFloatBE=r?u:o,n.readFloatLE=r?i:a,n.readFloatBE=r?a:i}():function(){function u(n,e,t,r){var o=e<0?1:0;if(o&&(e=-e),0===e)n(1/e>0?0:2147483648,t,r);else if(isNaN(e))n(2143289344,t,r);else if(e>3.4028234663852886e38)n((o<<31|2139095040)>>>0,t,r);else if(e<1.1754943508222875e-38)n((o<<31|Math.round(e/1.401298464324817e-45))>>>0,t,r);else{var u=Math.floor(Math.log(e)/Math.LN2);n((o<<31|u+127<<23|8388607&Math.round(e*Math.pow(2,-u)*8388608))>>>0,t,r)}}function i(n,e,t){var r=n(e,t),o=2*(r>>31)+1,u=r>>>23&255,i=8388607&r;return 255===u?i?NaN:o*(1/0):0===u?1.401298464324817e-45*o*i:o*Math.pow(2,u-150)*(i+8388608)}n.writeFloatLE=u.bind(null,e),n.writeFloatBE=u.bind(null,t),n.readFloatLE=i.bind(null,r),n.readFloatBE=i.bind(null,o)}(),"undefined"!=typeof Float64Array?function(){var e=new Float64Array([-0]),t=new Uint8Array(e.buffer),r=128===t[7];function o(n,r,o){e[0]=n,r[o]=t[0],r[o+1]=t[1],r[o+2]=t[2],r[o+3]=t[3],r[o+4]=t[4],r[o+5]=t[5],r[o+6]=t[6],r[o+7]=t[7]}function u(n,r,o){e[0]=n,r[o]=t[7],r[o+1]=t[6],r[o+2]=t[5],r[o+3]=t[4],r[o+4]=t[3],r[o+5]=t[2],r[o+6]=t[1],r[o+7]=t[0]}function i(n,r){return t[0]=n[r],t[1]=n[r+1],t[2]=n[r+2],t[3]=n[r+3],t[4]=n[r+4],t[5]=n[r+5],t[6]=n[r+6],t[7]=n[r+7],e[0]}function a(n,r){return t[7]=n[r],t[6]=n[r+1],t[5]=n[r+2],t[4]=n[r+3],t[3]=n[r+4],t[2]=n[r+5],t[1]=n[r+6],t[0]=n[r+7],e[0]}n.writeDoubleLE=r?o:u,n.writeDoubleBE=r?u:o,n.readDoubleLE=r?i:a,n.readDoubleBE=r?a:i}():function(){function u(n,e,t,r,o,u){var i=r<0?1:0;if(i&&(r=-r),0===r)n(0,o,u+e),n(1/r>0?0:2147483648,o,u+t);else if(isNaN(r))n(0,o,u+e),n(2146959360,o,u+t);else if(r>1.7976931348623157e308)n(0,o,u+e),n((i<<31|2146435072)>>>0,o,u+t);else{var a;if(r<2.2250738585072014e-308)n((a=r/5e-324)>>>0,o,u+e),n((i<<31|a/4294967296)>>>0,o,u+t);else{var l=Math.floor(Math.log(r)/Math.LN2);1024===l&&(l=1023),n(4503599627370496*(a=r*Math.pow(2,-l))>>>0,o,u+e),n((i<<31|l+1023<<20|1048576*a&1048575)>>>0,o,u+t)}}}function i(n,e,t,r,o){var u=n(r,o+e),i=n(r,o+t),a=2*(i>>31)+1,l=i>>>20&2047,f=4294967296*(1048575&i)+u;return 2047===l?f?NaN:a*(1/0):0===l?5e-324*a*f:a*Math.pow(2,l-1075)*(f+4503599627370496)}n.writeDoubleLE=u.bind(null,e,0,4),n.writeDoubleBE=u.bind(null,t,4,0),n.readDoubleLE=i.bind(null,r,0,4),n.readDoubleBE=i.bind(null,o,4,0)}(),n}function e(n,e,t){e[t]=255&n,e[t+1]=n>>>8&255,e[t+2]=n>>>16&255,e[t+3]=n>>>24}function t(n,e,t){e[t]=n>>>24,e[t+1]=n>>>16&255,e[t+2]=n>>>8&255,e[t+3]=255&n}function r(n,e){return(n[e]|n[e+1]<<8|n[e+2]<<16|n[e+3]<<24)>>>0}function o(n,e){return(n[e]<<24|n[e+1]<<16|n[e+2]<<8|n[e+3])>>>0}module.exports=n(n);
|
||
},{}],"eAoq":[function(require,module,exports) {
|
||
"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}module.exports=inquire;
|
||
},{}],"UiC1":[function(require,module,exports) {
|
||
"use strict";var r=exports;r.length=function(r){for(var t=0,n=0,e=0;e<r.length;++e)(n=r.charCodeAt(e))<128?t+=1:n<2048?t+=2:55296==(64512&n)&&56320==(64512&r.charCodeAt(e+1))?(++e,t+=4):t+=3;return t},r.read=function(r,t,n){if(n-t<1)return"";for(var e,o=null,a=[],i=0;t<n;)(e=r[t++])<128?a[i++]=e:e>191&&e<224?a[i++]=(31&e)<<6|63&r[t++]:e>239&&e<365?(e=((7&e)<<18|(63&r[t++])<<12|(63&r[t++])<<6|63&r[t++])-65536,a[i++]=55296+(e>>10),a[i++]=56320+(1023&e)):a[i++]=(15&e)<<12|(63&r[t++])<<6|63&r[t++],i>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,a)),i=0);return o?(i&&o.push(String.fromCharCode.apply(String,a.slice(0,i))),o.join("")):String.fromCharCode.apply(String,a.slice(0,i))},r.write=function(r,t,n){for(var e,o,a=n,i=0;i<r.length;++i)(e=r.charCodeAt(i))<128?t[n++]=e:e<2048?(t[n++]=e>>6|192,t[n++]=63&e|128):55296==(64512&e)&&56320==(64512&(o=r.charCodeAt(i+1)))?(e=65536+((1023&e)<<10)+(1023&o),++i,t[n++]=e>>18|240,t[n++]=e>>12&63|128,t[n++]=e>>6&63|128,t[n++]=63&e|128):(t[n++]=e>>12|224,t[n++]=e>>6&63|128,t[n++]=63&e|128);return n-a};
|
||
},{}],"qHDJ":[function(require,module,exports) {
|
||
"use strict";function r(r,n,t){var u=t||8192,e=u>>>1,l=null,c=u;return function(t){if(t<1||t>e)return r(t);c+t>u&&(l=r(u),c=0);var i=n.call(l,c,c+=t);return 7&c&&(c=1+(7|c)),i}}module.exports=r;
|
||
},{}],"AiDq":[function(require,module,exports) {
|
||
"use strict";module.exports=i;var t=require("../util/minimal");function i(t,i){this.lo=t>>>0,this.hi=i>>>0}var o=i.zero=new i(0,0);o.toNumber=function(){return 0},o.zzEncode=o.zzDecode=function(){return this},o.length=function(){return 1};var r=i.zeroHash="\0\0\0\0\0\0\0\0";i.fromNumber=function(t){if(0===t)return o;var r=t<0;r&&(t=-t);var h=t>>>0,n=(t-h)/4294967296>>>0;return r&&(n=~n>>>0,h=~h>>>0,++h>4294967295&&(h=0,++n>4294967295&&(n=0))),new i(h,n)},i.from=function(r){if("number"==typeof r)return i.fromNumber(r);if(t.isString(r)){if(!t.Long)return i.fromNumber(parseInt(r,10));r=t.Long.fromString(r)}return r.low||r.high?new i(r.low>>>0,r.high>>>0):o},i.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var i=1+~this.lo>>>0,o=~this.hi>>>0;return i||(o=o+1>>>0),-(i+4294967296*o)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(i){return t.Long?new t.Long(0|this.lo,0|this.hi,Boolean(i)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(i)}};var h=String.prototype.charCodeAt;i.fromHash=function(t){return t===r?o:new i((h.call(t,0)|h.call(t,1)<<8|h.call(t,2)<<16|h.call(t,3)<<24)>>>0,(h.call(t,4)|h.call(t,5)<<8|h.call(t,6)<<16|h.call(t,7)<<24)>>>0)},i.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},i.prototype.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this},i.prototype.zzDecode=function(){var t=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this},i.prototype.length=function(){var t=this.lo,i=(this.lo>>>28|this.hi<<4)>>>0,o=this.hi>>>24;return 0===o?0===i?t<16384?t<128?1:2:t<2097152?3:4:i<16384?i<128?5:6:i<2097152?7:8:o<128?9:10};
|
||
},{"../util/minimal":"Cu2u"}],"FRly":[function(require,module,exports) {
|
||
"use strict";exports.byteLength=u,exports.toByteArray=i,exports.fromByteArray=d;for(var r=[],t=[],e="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,a=n.length;o<a;++o)r[o]=n[o],t[n.charCodeAt(o)]=o;function h(r){var t=r.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=r.indexOf("=");return-1===e&&(e=t),[e,e===t?0:4-e%4]}function u(r){var t=h(r),e=t[0],n=t[1];return 3*(e+n)/4-n}function c(r,t,e){return 3*(t+e)/4-e}function i(r){var n,o,a=h(r),u=a[0],i=a[1],f=new e(c(r,u,i)),A=0,d=i>0?u-4:u;for(o=0;o<d;o+=4)n=t[r.charCodeAt(o)]<<18|t[r.charCodeAt(o+1)]<<12|t[r.charCodeAt(o+2)]<<6|t[r.charCodeAt(o+3)],f[A++]=n>>16&255,f[A++]=n>>8&255,f[A++]=255&n;return 2===i&&(n=t[r.charCodeAt(o)]<<2|t[r.charCodeAt(o+1)]>>4,f[A++]=255&n),1===i&&(n=t[r.charCodeAt(o)]<<10|t[r.charCodeAt(o+1)]<<4|t[r.charCodeAt(o+2)]>>2,f[A++]=n>>8&255,f[A++]=255&n),f}function f(t){return r[t>>18&63]+r[t>>12&63]+r[t>>6&63]+r[63&t]}function A(r,t,e){for(var n,o=[],a=t;a<e;a+=3)n=(r[a]<<16&16711680)+(r[a+1]<<8&65280)+(255&r[a+2]),o.push(f(n));return o.join("")}function d(t){for(var e,n=t.length,o=n%3,a=[],h=0,u=n-o;h<u;h+=16383)a.push(A(t,h,h+16383>u?u:h+16383));return 1===o?(e=t[n-1],a.push(r[e>>2]+r[e<<4&63]+"==")):2===o&&(e=(t[n-2]<<8)+t[n-1],a.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),a.join("")}t["-".charCodeAt(0)]=62,t["_".charCodeAt(0)]=63;
|
||
},{}],"Quj6":[function(require,module,exports) {
|
||
exports.read=function(a,o,t,r,h){var M,p,w=8*h-r-1,f=(1<<w)-1,e=f>>1,i=-7,N=t?h-1:0,n=t?-1:1,s=a[o+N];for(N+=n,M=s&(1<<-i)-1,s>>=-i,i+=w;i>0;M=256*M+a[o+N],N+=n,i-=8);for(p=M&(1<<-i)-1,M>>=-i,i+=r;i>0;p=256*p+a[o+N],N+=n,i-=8);if(0===M)M=1-e;else{if(M===f)return p?NaN:1/0*(s?-1:1);p+=Math.pow(2,r),M-=e}return(s?-1:1)*p*Math.pow(2,M-r)},exports.write=function(a,o,t,r,h,M){var p,w,f,e=8*M-h-1,i=(1<<e)-1,N=i>>1,n=23===h?Math.pow(2,-24)-Math.pow(2,-77):0,s=r?0:M-1,u=r?1:-1,l=o<0||0===o&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(w=isNaN(o)?1:0,p=i):(p=Math.floor(Math.log(o)/Math.LN2),o*(f=Math.pow(2,-p))<1&&(p--,f*=2),(o+=p+N>=1?n/f:n*Math.pow(2,1-N))*f>=2&&(p++,f/=2),p+N>=i?(w=0,p=i):p+N>=1?(w=(o*f-1)*Math.pow(2,h),p+=N):(w=o*Math.pow(2,N-1)*Math.pow(2,h),p=0));h>=8;a[t+s]=255&w,s+=u,w/=256,h-=8);for(p=p<<h|w,e+=h;e>0;a[t+s]=255&p,s+=u,p/=256,e-=8);a[t+s-u]|=128*l};
|
||
},{}],"8qua":[function(require,module,exports) {
|
||
var r={}.toString;module.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)};
|
||
},{}],"z1tx":[function(require,module,exports) {
|
||
|
||
var global = arguments[3];
|
||
var t=arguments[3],r=require("base64-js"),e=require("ieee754"),n=require("isarray");function i(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(r){return!1}}function o(){return f.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function u(t,r){if(o()<r)throw new RangeError("Invalid typed array length");return f.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r)).__proto__=f.prototype:(null===t&&(t=new f(r)),t.length=r),t}function f(t,r,e){if(!(f.TYPED_ARRAY_SUPPORT||this instanceof f))return new f(t,r,e);if("number"==typeof t){if("string"==typeof r)throw new Error("If encoding is specified then the first argument must be a string");return c(this,t)}return s(this,t,r,e)}function s(t,r,e,n){if("number"==typeof r)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&r instanceof ArrayBuffer?g(t,r,e,n):"string"==typeof r?l(t,r,e):y(t,r)}function h(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function a(t,r,e,n){return h(r),r<=0?u(t,r):void 0!==e?"string"==typeof n?u(t,r).fill(e,n):u(t,r).fill(e):u(t,r)}function c(t,r){if(h(r),t=u(t,r<0?0:0|w(r)),!f.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}function l(t,r,e){if("string"==typeof e&&""!==e||(e="utf8"),!f.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=0|v(r,e),i=(t=u(t,n)).write(r,e);return i!==n&&(t=t.slice(0,i)),t}function p(t,r){var e=r.length<0?0:0|w(r.length);t=u(t,e);for(var n=0;n<e;n+=1)t[n]=255&r[n];return t}function g(t,r,e,n){if(r.byteLength,e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");return r=void 0===e&&void 0===n?new Uint8Array(r):void 0===n?new Uint8Array(r,e):new Uint8Array(r,e,n),f.TYPED_ARRAY_SUPPORT?(t=r).__proto__=f.prototype:t=p(t,r),t}function y(t,r){if(f.isBuffer(r)){var e=0|w(r.length);return 0===(t=u(t,e)).length?t:(r.copy(t,0,0,e),t)}if(r){if("undefined"!=typeof ArrayBuffer&&r.buffer instanceof ArrayBuffer||"length"in r)return"number"!=typeof r.length||W(r.length)?u(t,0):p(t,r);if("Buffer"===r.type&&n(r.data))return p(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function w(t){if(t>=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|t}function d(t){return+t!=t&&(t=0),f.alloc(+t)}function v(t,r){if(f.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var e=t.length;if(0===e)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return $(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*e;case"hex":return e>>>1;case"base64":return K(t).length;default:if(n)return $(t).length;r=(""+r).toLowerCase(),n=!0}}function E(t,r,e){var n=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===e||e>this.length)&&(e=this.length),e<=0)return"";if((e>>>=0)<=(r>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return x(this,r,e);case"utf8":case"utf-8":return Y(this,r,e);case"ascii":return L(this,r,e);case"latin1":case"binary":return D(this,r,e);case"base64":return S(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function b(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}function R(t,r,e,n,i){if(0===t.length)return-1;if("string"==typeof e?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(i)return-1;e=t.length-1}else if(e<0){if(!i)return-1;e=0}if("string"==typeof r&&(r=f.from(r,n)),f.isBuffer(r))return 0===r.length?-1:_(t,r,e,n,i);if("number"==typeof r)return r&=255,f.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):_(t,[r],e,n,i);throw new TypeError("val must be string, number or Buffer")}function _(t,r,e,n,i){var o,u=1,f=t.length,s=r.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||r.length<2)return-1;u=2,f/=2,s/=2,e/=2}function h(t,r){return 1===u?t[r]:t.readUInt16BE(r*u)}if(i){var a=-1;for(o=e;o<f;o++)if(h(t,o)===h(r,-1===a?0:o-a)){if(-1===a&&(a=o),o-a+1===s)return a*u}else-1!==a&&(o-=o-a),a=-1}else for(e+s>f&&(e=f-s),o=e;o>=0;o--){for(var c=!0,l=0;l<s;l++)if(h(t,o+l)!==h(r,l)){c=!1;break}if(c)return o}return-1}function A(t,r,e,n){e=Number(e)||0;var i=t.length-e;n?(n=Number(n))>i&&(n=i):n=i;var o=r.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var u=0;u<n;++u){var f=parseInt(r.substr(2*u,2),16);if(isNaN(f))return u;t[e+u]=f}return u}function m(t,r,e,n){return Q($(r,t.length-e),t,e,n)}function P(t,r,e,n){return Q(G(r),t,e,n)}function T(t,r,e,n){return P(t,r,e,n)}function B(t,r,e,n){return Q(K(r),t,e,n)}function U(t,r,e,n){return Q(H(r,t.length-e),t,e,n)}function S(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function Y(t,r,e){e=Math.min(t.length,e);for(var n=[],i=r;i<e;){var o,u,f,s,h=t[i],a=null,c=h>239?4:h>223?3:h>191?2:1;if(i+c<=e)switch(c){case 1:h<128&&(a=h);break;case 2:128==(192&(o=t[i+1]))&&(s=(31&h)<<6|63&o)>127&&(a=s);break;case 3:o=t[i+1],u=t[i+2],128==(192&o)&&128==(192&u)&&(s=(15&h)<<12|(63&o)<<6|63&u)>2047&&(s<55296||s>57343)&&(a=s);break;case 4:o=t[i+1],u=t[i+2],f=t[i+3],128==(192&o)&&128==(192&u)&&128==(192&f)&&(s=(15&h)<<18|(63&o)<<12|(63&u)<<6|63&f)>65535&&s<1114112&&(a=s)}null===a?(a=65533,c=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),i+=c}return O(n)}exports.Buffer=f,exports.SlowBuffer=d,exports.INSPECT_MAX_BYTES=50,f.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:i(),exports.kMaxLength=o(),f.poolSize=8192,f._augment=function(t){return t.__proto__=f.prototype,t},f.from=function(t,r,e){return s(null,t,r,e)},f.TYPED_ARRAY_SUPPORT&&(f.prototype.__proto__=Uint8Array.prototype,f.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&f[Symbol.species]===f&&Object.defineProperty(f,Symbol.species,{value:null,configurable:!0})),f.alloc=function(t,r,e){return a(null,t,r,e)},f.allocUnsafe=function(t){return c(null,t)},f.allocUnsafeSlow=function(t){return c(null,t)},f.isBuffer=function(t){return!(null==t||!t._isBuffer)},f.compare=function(t,r){if(!f.isBuffer(t)||!f.isBuffer(r))throw new TypeError("Arguments must be Buffers");if(t===r)return 0;for(var e=t.length,n=r.length,i=0,o=Math.min(e,n);i<o;++i)if(t[i]!==r[i]){e=t[i],n=r[i];break}return e<n?-1:n<e?1:0},f.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},f.concat=function(t,r){if(!n(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return f.alloc(0);var e;if(void 0===r)for(r=0,e=0;e<t.length;++e)r+=t[e].length;var i=f.allocUnsafe(r),o=0;for(e=0;e<t.length;++e){var u=t[e];if(!f.isBuffer(u))throw new TypeError('"list" argument must be an Array of Buffers');u.copy(i,o),o+=u.length}return i},f.byteLength=v,f.prototype._isBuffer=!0,f.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<t;r+=2)b(this,r,r+1);return this},f.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<t;r+=4)b(this,r,r+3),b(this,r+1,r+2);return this},f.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<t;r+=8)b(this,r,r+7),b(this,r+1,r+6),b(this,r+2,r+5),b(this,r+3,r+4);return this},f.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?Y(this,0,t):E.apply(this,arguments)},f.prototype.equals=function(t){if(!f.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===f.compare(this,t)},f.prototype.inspect=function(){var t="",r=exports.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),"<Buffer "+t+">"},f.prototype.compare=function(t,r,e,n,i){if(!f.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===e&&(e=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),r<0||e>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&r>=e)return 0;if(n>=i)return-1;if(r>=e)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),u=(e>>>=0)-(r>>>=0),s=Math.min(o,u),h=this.slice(n,i),a=t.slice(r,e),c=0;c<s;++c)if(h[c]!==a[c]){o=h[c],u=a[c];break}return o<u?-1:u<o?1:0},f.prototype.includes=function(t,r,e){return-1!==this.indexOf(t,r,e)},f.prototype.indexOf=function(t,r,e){return R(this,t,r,e,!0)},f.prototype.lastIndexOf=function(t,r,e){return R(this,t,r,e,!1)},f.prototype.write=function(t,r,e,n){if(void 0===r)n="utf8",e=this.length,r=0;else if(void 0===e&&"string"==typeof r)n=r,e=this.length,r=0;else{if(!isFinite(r))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");r|=0,isFinite(e)?(e|=0,void 0===n&&(n="utf8")):(n=e,e=void 0)}var i=this.length-r;if((void 0===e||e>i)&&(e=i),t.length>0&&(e<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return A(this,t,r,e);case"utf8":case"utf-8":return m(this,t,r,e);case"ascii":return P(this,t,r,e);case"latin1":case"binary":return T(this,t,r,e);case"base64":return B(this,t,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,t,r,e);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var I=4096;function O(t){var r=t.length;if(r<=I)return String.fromCharCode.apply(String,t);for(var e="",n=0;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=I));return e}function L(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(127&t[i]);return n}function D(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(t[i]);return n}function x(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var i="",o=r;o<e;++o)i+=Z(t[o]);return i}function C(t,r,e){for(var n=t.slice(r,e),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function M(t,r,e){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}function k(t,r,e,n,i,o){if(!f.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||r<o)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}function N(t,r,e,n){r<0&&(r=65535+r+1);for(var i=0,o=Math.min(t.length-e,2);i<o;++i)t[e+i]=(r&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function z(t,r,e,n){r<0&&(r=4294967295+r+1);for(var i=0,o=Math.min(t.length-e,4);i<o;++i)t[e+i]=r>>>8*(n?i:3-i)&255}function F(t,r,e,n,i,o){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function j(t,r,n,i,o){return o||F(t,r,n,4,3.4028234663852886e38,-3.4028234663852886e38),e.write(t,r,n,i,23,4),n+4}function q(t,r,n,i,o){return o||F(t,r,n,8,1.7976931348623157e308,-1.7976931348623157e308),e.write(t,r,n,i,52,8),n+8}f.prototype.slice=function(t,r){var e,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(r=void 0===r?n:~~r)<0?(r+=n)<0&&(r=0):r>n&&(r=n),r<t&&(r=t),f.TYPED_ARRAY_SUPPORT)(e=this.subarray(t,r)).__proto__=f.prototype;else{var i=r-t;e=new f(i,void 0);for(var o=0;o<i;++o)e[o]=this[o+t]}return e},f.prototype.readUIntLE=function(t,r,e){t|=0,r|=0,e||M(t,r,this.length);for(var n=this[t],i=1,o=0;++o<r&&(i*=256);)n+=this[t+o]*i;return n},f.prototype.readUIntBE=function(t,r,e){t|=0,r|=0,e||M(t,r,this.length);for(var n=this[t+--r],i=1;r>0&&(i*=256);)n+=this[t+--r]*i;return n},f.prototype.readUInt8=function(t,r){return r||M(t,1,this.length),this[t]},f.prototype.readUInt16LE=function(t,r){return r||M(t,2,this.length),this[t]|this[t+1]<<8},f.prototype.readUInt16BE=function(t,r){return r||M(t,2,this.length),this[t]<<8|this[t+1]},f.prototype.readUInt32LE=function(t,r){return r||M(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},f.prototype.readUInt32BE=function(t,r){return r||M(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},f.prototype.readIntLE=function(t,r,e){t|=0,r|=0,e||M(t,r,this.length);for(var n=this[t],i=1,o=0;++o<r&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*r)),n},f.prototype.readIntBE=function(t,r,e){t|=0,r|=0,e||M(t,r,this.length);for(var n=r,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*r)),o},f.prototype.readInt8=function(t,r){return r||M(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},f.prototype.readInt16LE=function(t,r){r||M(t,2,this.length);var e=this[t]|this[t+1]<<8;return 32768&e?4294901760|e:e},f.prototype.readInt16BE=function(t,r){r||M(t,2,this.length);var e=this[t+1]|this[t]<<8;return 32768&e?4294901760|e:e},f.prototype.readInt32LE=function(t,r){return r||M(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},f.prototype.readInt32BE=function(t,r){return r||M(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},f.prototype.readFloatLE=function(t,r){return r||M(t,4,this.length),e.read(this,t,!0,23,4)},f.prototype.readFloatBE=function(t,r){return r||M(t,4,this.length),e.read(this,t,!1,23,4)},f.prototype.readDoubleLE=function(t,r){return r||M(t,8,this.length),e.read(this,t,!0,52,8)},f.prototype.readDoubleBE=function(t,r){return r||M(t,8,this.length),e.read(this,t,!1,52,8)},f.prototype.writeUIntLE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||k(this,t,r,e,Math.pow(2,8*e)-1,0);var i=1,o=0;for(this[r]=255&t;++o<e&&(i*=256);)this[r+o]=t/i&255;return r+e},f.prototype.writeUIntBE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||k(this,t,r,e,Math.pow(2,8*e)-1,0);var i=e-1,o=1;for(this[r+i]=255&t;--i>=0&&(o*=256);)this[r+i]=t/o&255;return r+e},f.prototype.writeUInt8=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,1,255,0),f.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},f.prototype.writeUInt16LE=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):N(this,t,r,!0),r+2},f.prototype.writeUInt16BE=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):N(this,t,r,!1),r+2},f.prototype.writeUInt32LE=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):z(this,t,r,!0),r+4},f.prototype.writeUInt32BE=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):z(this,t,r,!1),r+4},f.prototype.writeIntLE=function(t,r,e,n){if(t=+t,r|=0,!n){var i=Math.pow(2,8*e-1);k(this,t,r,e,i-1,-i)}var o=0,u=1,f=0;for(this[r]=255&t;++o<e&&(u*=256);)t<0&&0===f&&0!==this[r+o-1]&&(f=1),this[r+o]=(t/u>>0)-f&255;return r+e},f.prototype.writeIntBE=function(t,r,e,n){if(t=+t,r|=0,!n){var i=Math.pow(2,8*e-1);k(this,t,r,e,i-1,-i)}var o=e-1,u=1,f=0;for(this[r+o]=255&t;--o>=0&&(u*=256);)t<0&&0===f&&0!==this[r+o+1]&&(f=1),this[r+o]=(t/u>>0)-f&255;return r+e},f.prototype.writeInt8=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,1,127,-128),f.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},f.prototype.writeInt16LE=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):N(this,t,r,!0),r+2},f.prototype.writeInt16BE=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):N(this,t,r,!1),r+2},f.prototype.writeInt32LE=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,4,2147483647,-2147483648),f.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):z(this,t,r,!0),r+4},f.prototype.writeInt32BE=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),f.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):z(this,t,r,!1),r+4},f.prototype.writeFloatLE=function(t,r,e){return j(this,t,r,!0,e)},f.prototype.writeFloatBE=function(t,r,e){return j(this,t,r,!1,e)},f.prototype.writeDoubleLE=function(t,r,e){return q(this,t,r,!0,e)},f.prototype.writeDoubleBE=function(t,r,e){return q(this,t,r,!1,e)},f.prototype.copy=function(t,r,e,n){if(e||(e=0),n||0===n||(n=this.length),r>=t.length&&(r=t.length),r||(r=0),n>0&&n<e&&(n=e),n===e)return 0;if(0===t.length||0===this.length)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(e<0||e>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-r<n-e&&(n=t.length-r+e);var i,o=n-e;if(this===t&&e<r&&r<n)for(i=o-1;i>=0;--i)t[i+r]=this[i+e];else if(o<1e3||!f.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+r]=this[i+e];else Uint8Array.prototype.set.call(t,this.subarray(e,e+o),r);return o},f.prototype.fill=function(t,r,e,n){if("string"==typeof t){if("string"==typeof r?(n=r,r=0,e=this.length):"string"==typeof e&&(n=e,e=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!f.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(r<0||this.length<r||this.length<e)throw new RangeError("Out of range index");if(e<=r)return this;var o;if(r>>>=0,e=void 0===e?this.length:e>>>0,t||(t=0),"number"==typeof t)for(o=r;o<e;++o)this[o]=t;else{var u=f.isBuffer(t)?t:$(new f(t,n).toString()),s=u.length;for(o=0;o<e-r;++o)this[o+r]=u[o%s]}return this};var V=/[^+\/0-9A-Za-z-_]/g;function X(t){if((t=J(t).replace(V,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}function J(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Z(t){return t<16?"0"+t.toString(16):t.toString(16)}function $(t,r){var e;r=r||1/0;for(var n=t.length,i=null,o=[],u=0;u<n;++u){if((e=t.charCodeAt(u))>55295&&e<57344){if(!i){if(e>56319){(r-=3)>-1&&o.push(239,191,189);continue}if(u+1===n){(r-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(r-=3)>-1&&o.push(239,191,189),i=e;continue}e=65536+(i-55296<<10|e-56320)}else i&&(r-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((r-=1)<0)break;o.push(e)}else if(e<2048){if((r-=2)<0)break;o.push(e>>6|192,63&e|128)}else if(e<65536){if((r-=3)<0)break;o.push(e>>12|224,e>>6&63|128,63&e|128)}else{if(!(e<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}}return o}function G(t){for(var r=[],e=0;e<t.length;++e)r.push(255&t.charCodeAt(e));return r}function H(t,r){for(var e,n,i,o=[],u=0;u<t.length&&!((r-=2)<0);++u)n=(e=t.charCodeAt(u))>>8,i=e%256,o.push(i),o.push(n);return o}function K(t){return r.toByteArray(X(t))}function Q(t,r,e,n){for(var i=0;i<n&&!(i+e>=r.length||i>=t.length);++i)r[i+e]=t[i];return i}function W(t){return t!=t}
|
||
},{"base64-js":"FRly","ieee754":"Quj6","isarray":"8qua","buffer":"z1tx"}],"Cu2u":[function(require,module,exports) {
|
||
var global = arguments[3];
|
||
var Buffer = require("buffer").Buffer;
|
||
var e=arguments[3],r=require("buffer").Buffer,t=exports;function n(e,r,t){for(var n=Object.keys(r),o=0;o<n.length;++o)void 0!==e[n[o]]&&t||(e[n[o]]=r[n[o]]);return e}function o(e){function r(e,t){if(!(this instanceof r))return new r(e,t);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,r):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),t&&n(this,t)}return(r.prototype=Object.create(Error.prototype)).constructor=r,Object.defineProperty(r.prototype,"name",{get:function(){return e}}),r.prototype.toString=function(){return this.name+": "+this.message},r}t.asPromise=require("@protobufjs/aspromise"),t.base64=require("@protobufjs/base64"),t.EventEmitter=require("@protobufjs/eventemitter"),t.float=require("@protobufjs/float"),t.inquire=require("@protobufjs/inquire"),t.utf8=require("@protobufjs/utf8"),t.pool=require("@protobufjs/pool"),t.LongBits=require("./longbits"),t.isNode=Boolean(void 0!==e&&e&&e.process&&e.process.versions&&e.process.versions.node),t.global=t.isNode&&e||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||this,t.emptyArray=Object.freeze?Object.freeze([]):[],t.emptyObject=Object.freeze?Object.freeze({}):{},t.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},t.isString=function(e){return"string"==typeof e||e instanceof String},t.isObject=function(e){return e&&"object"==typeof e},t.isset=t.isSet=function(e,r){var t=e[r];return!(null==t||!e.hasOwnProperty(r))&&("object"!=typeof t||(Array.isArray(t)?t.length:Object.keys(t).length)>0)},t.Buffer=function(){try{var e=t.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(r){return null}}(),t._Buffer_from=null,t._Buffer_allocUnsafe=null,t.newBuffer=function(e){return"number"==typeof e?t.Buffer?t._Buffer_allocUnsafe(e):new t.Array(e):t.Buffer?t._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},t.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,t.Long=t.global.dcodeIO&&t.global.dcodeIO.Long||t.global.Long||t.inquire("long"),t.key2Re=/^true|false|0|1$/,t.key32Re=/^-?(?:0|[1-9][0-9]*)$/,t.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,t.longToHash=function(e){return e?t.LongBits.from(e).toHash():t.LongBits.zeroHash},t.longFromHash=function(e,r){var n=t.LongBits.fromHash(e);return t.Long?t.Long.fromBits(n.lo,n.hi,r):n.toNumber(Boolean(r))},t.merge=n,t.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},t.newError=o,t.ProtocolError=o("ProtocolError"),t.oneOfGetter=function(e){for(var r={},t=0;t<e.length;++t)r[e[t]]=1;return function(){for(var e=Object.keys(this),t=e.length-1;t>-1;--t)if(1===r[e[t]]&&void 0!==this[e[t]]&&null!==this[e[t]])return e[t]}},t.oneOfSetter=function(e){return function(r){for(var t=0;t<e.length;++t)e[t]!==r&&delete this[e[t]]}},t.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},t._configure=function(){var e=t.Buffer;e?(t._Buffer_from=e.from!==Uint8Array.from&&e.from||function(r,t){return new e(r,t)},t._Buffer_allocUnsafe=e.allocUnsafe||function(r){return new e(r)}):t._Buffer_from=t._Buffer_allocUnsafe=null};
|
||
},{"@protobufjs/aspromise":"AnsR","@protobufjs/base64":"08vA","@protobufjs/eventemitter":"rQUj","@protobufjs/float":"lW0B","@protobufjs/inquire":"eAoq","@protobufjs/utf8":"UiC1","@protobufjs/pool":"qHDJ","./longbits":"AiDq","buffer":"z1tx"}],"72ct":[function(require,module,exports) {
|
||
"use strict";module.exports=u;var t,i=require("./util/minimal"),n=i.LongBits,e=i.base64,o=i.utf8;function r(t,i,n){this.fn=t,this.len=i,this.next=void 0,this.val=n}function s(){}function h(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function u(){this.len=0,this.head=new r(s,0,0),this.tail=this.head,this.states=null}var l=function(){return i.Buffer?function(){return(u.create=function(){return new t})()}:function(){return new u}};function p(t,i,n){i[n]=255&t}function a(t,i,n){for(;t>127;)i[n++]=127&t|128,t>>>=7;i[n]=t}function f(t,i){this.len=t,this.next=void 0,this.val=i}function c(t,i,n){for(;t.hi;)i[n++]=127&t.lo|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)i[n++]=127&t.lo|128,t.lo=t.lo>>>7;i[n++]=t.lo}function y(t,i,n){i[n]=255&t,i[n+1]=t>>>8&255,i[n+2]=t>>>16&255,i[n+3]=t>>>24}u.create=l(),u.alloc=function(t){return new i.Array(t)},i.Array!==Array&&(u.alloc=i.pool(u.alloc,i.Array.prototype.subarray)),u.prototype._push=function(t,i,n){return this.tail=this.tail.next=new r(t,i,n),this.len+=i,this},f.prototype=Object.create(r.prototype),f.prototype.fn=a,u.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new f((t>>>=0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this},u.prototype.int32=function(t){return t<0?this._push(c,10,n.fromNumber(t)):this.uint32(t)},u.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)},u.prototype.uint64=function(t){var i=n.from(t);return this._push(c,i.length(),i)},u.prototype.int64=u.prototype.uint64,u.prototype.sint64=function(t){var i=n.from(t).zzEncode();return this._push(c,i.length(),i)},u.prototype.bool=function(t){return this._push(p,1,t?1:0)},u.prototype.fixed32=function(t){return this._push(y,4,t>>>0)},u.prototype.sfixed32=u.prototype.fixed32,u.prototype.fixed64=function(t){var i=n.from(t);return this._push(y,4,i.lo)._push(y,4,i.hi)},u.prototype.sfixed64=u.prototype.fixed64,u.prototype.float=function(t){return this._push(i.float.writeFloatLE,4,t)},u.prototype.double=function(t){return this._push(i.float.writeDoubleLE,8,t)};var d=i.Array.prototype.set?function(t,i,n){i.set(t,n)}:function(t,i,n){for(var e=0;e<t.length;++e)i[n+e]=t[e]};u.prototype.bytes=function(t){var n=t.length>>>0;if(!n)return this._push(p,1,0);if(i.isString(t)){var o=u.alloc(n=e.length(t));e.decode(t,o,0),t=o}return this.uint32(n)._push(d,n,t)},u.prototype.string=function(t){var i=o.length(t);return i?this.uint32(i)._push(o.write,i,t):this._push(p,1,0)},u.prototype.fork=function(){return this.states=new h(this),this.head=this.tail=new r(s,0,0),this.len=0,this},u.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new r(s,0,0),this.len=0),this},u.prototype.ldelim=function(){var t=this.head,i=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=t.next,this.tail=i,this.len+=n),this},u.prototype.finish=function(){for(var t=this.head.next,i=this.constructor.alloc(this.len),n=0;t;)t.fn(t.val,i,n),n+=t.len,t=t.next;return i},u._configure=function(i){t=i,u.create=l(),t._configure()};
|
||
},{"./util/minimal":"Cu2u"}],"l7NZ":[function(require,module,exports) {
|
||
"use strict";module.exports=r;var t=require("./writer");(r.prototype=Object.create(t.prototype)).constructor=r;var e=require("./util/minimal");function r(){t.call(this)}function i(t,r,i){t.length<40?e.utf8.write(t,r,i):r.utf8Write?r.utf8Write(t,i):r.write(t,i)}r._configure=function(){r.alloc=e._Buffer_allocUnsafe,r.writeBytesBuffer=e.Buffer&&e.Buffer.prototype instanceof Uint8Array&&"set"===e.Buffer.prototype.set.name?function(t,e,r){e.set(t,r)}:function(t,e,r){if(t.copy)t.copy(e,r,0,t.length);else for(var i=0;i<t.length;)e[r++]=t[i++]}},r.prototype.bytes=function(t){e.isString(t)&&(t=e._Buffer_from(t,"base64"));var i=t.length>>>0;return this.uint32(i),i&&this._push(r.writeBytesBuffer,i,t),this},r.prototype.string=function(t){var r=e.Buffer.byteLength(t);return this.uint32(r),r&&this._push(i,r,t),this},r._configure();
|
||
},{"./writer":"72ct","./util/minimal":"Cu2u"}],"+nPE":[function(require,module,exports) {
|
||
"use strict";module.exports=h;var t,i=require("./util/minimal"),s=i.LongBits,r=i.utf8;function o(t,i){return RangeError("index out of range: "+t.pos+" + "+(i||1)+" > "+t.len)}function h(t){this.buf=t,this.pos=0,this.len=t.length}var n="undefined"!=typeof Uint8Array?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new h(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new h(t);throw Error("illegal buffer")},e=function(){return i.Buffer?function(s){return(h.create=function(s){return i.Buffer.isBuffer(s)?new t(s):n(s)})(s)}:n};function u(){var t=new s(0,0),i=0;if(!(this.len-this.pos>4)){for(;i<3;++i){if(this.pos>=this.len)throw o(this);if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*i)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(127&this.buf[this.pos++])<<7*i)>>>0,t}for(;i<4;++i)if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*i)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(127&this.buf[this.pos])<<28)>>>0,t.hi=(t.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return t;if(i=0,this.len-this.pos>4){for(;i<5;++i)if(t.hi=(t.hi|(127&this.buf[this.pos])<<7*i+3)>>>0,this.buf[this.pos++]<128)return t}else for(;i<5;++i){if(this.pos>=this.len)throw o(this);if(t.hi=(t.hi|(127&this.buf[this.pos])<<7*i+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}function f(t,i){return(t[i-4]|t[i-3]<<8|t[i-2]<<16|t[i-1]<<24)>>>0}function p(){if(this.pos+8>this.len)throw o(this,8);return new s(f(this.buf,this.pos+=4),f(this.buf,this.pos+=4))}h.create=e(),h.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,h.prototype.uint32=function(){var t=4294967295;return function(){if(t=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return t;if(t=(t|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return t;if(t=(t|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return t;if(t=(t|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return t;if(t=(t|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return t;if((this.pos+=5)>this.len)throw this.pos=this.len,o(this,10);return t}}(),h.prototype.int32=function(){return 0|this.uint32()},h.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(1&t)|0},h.prototype.bool=function(){return 0!==this.uint32()},h.prototype.fixed32=function(){if(this.pos+4>this.len)throw o(this,4);return f(this.buf,this.pos+=4)},h.prototype.sfixed32=function(){if(this.pos+4>this.len)throw o(this,4);return 0|f(this.buf,this.pos+=4)},h.prototype.float=function(){if(this.pos+4>this.len)throw o(this,4);var t=i.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t},h.prototype.double=function(){if(this.pos+8>this.len)throw o(this,4);var t=i.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t},h.prototype.bytes=function(){var t=this.uint32(),i=this.pos,s=this.pos+t;if(s>this.len)throw o(this,t);return this.pos+=t,Array.isArray(this.buf)?this.buf.slice(i,s):i===s?new this.buf.constructor(0):this._slice.call(this.buf,i,s)},h.prototype.string=function(){var t=this.bytes();return r.read(t,0,t.length)},h.prototype.skip=function(t){if("number"==typeof t){if(this.pos+t>this.len)throw o(this,t);this.pos+=t}else do{if(this.pos>=this.len)throw o(this)}while(128&this.buf[this.pos++]);return this},h.prototype.skipType=function(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(t=7&this.uint32());)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this},h._configure=function(s){t=s,h.create=e(),t._configure();var r=i.Long?"toLong":"toNumber";i.merge(h.prototype,{int64:function(){return u.call(this)[r](!1)},uint64:function(){return u.call(this)[r](!0)},sint64:function(){return u.call(this).zzDecode()[r](!1)},fixed64:function(){return p.call(this)[r](!0)},sfixed64:function(){return p.call(this)[r](!1)}})};
|
||
},{"./util/minimal":"Cu2u"}],"rMb4":[function(require,module,exports) {
|
||
"use strict";module.exports=e;var t=require("./reader");(e.prototype=Object.create(t.prototype)).constructor=e;var i=require("./util/minimal");function e(i){t.call(this,i)}e._configure=function(){i.Buffer&&(e.prototype._slice=i.Buffer.prototype.slice)},e.prototype.string=function(){var t=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+t,this.len))},e._configure();
|
||
},{"./reader":"+nPE","./util/minimal":"Cu2u"}],"jAjv":[function(require,module,exports) {
|
||
"use strict";module.exports=t;var e=require("../util/minimal");function t(t,r,i){if("function"!=typeof t)throw TypeError("rpcImpl must be a function");e.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=Boolean(r),this.responseDelimited=Boolean(i)}(t.prototype=Object.create(e.EventEmitter.prototype)).constructor=t,t.prototype.rpcCall=function t(r,i,n,o,l){if(!o)throw TypeError("request must be specified");var u=this;if(!l)return e.asPromise(t,u,r,i,n,o);if(u.rpcImpl)try{return u.rpcImpl(r,i[u.requestDelimited?"encodeDelimited":"encode"](o).finish(),function(e,t){if(e)return u.emit("error",e,r),l(e);if(null!==t){if(!(t instanceof n))try{t=n[u.responseDelimited?"decodeDelimited":"decode"](t)}catch(e){return u.emit("error",e,r),l(e)}return u.emit("data",t,r),l(null,t)}u.end(!0)})}catch(c){return u.emit("error",c,r),void setTimeout(function(){l(c)},0)}else setTimeout(function(){l(Error("already ended"))},0)},t.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this};
|
||
},{"../util/minimal":"Cu2u"}],"NDD/":[function(require,module,exports) {
|
||
"use strict";var e=exports;e.Service=require("./rpc/service");
|
||
},{"./rpc/service":"jAjv"}],"2V3j":[function(require,module,exports) {
|
||
"use strict";module.exports={};
|
||
},{}],"po16":[function(require,module,exports) {
|
||
"use strict";var r=exports;function e(){r.util._configure(),r.Writer._configure(r.BufferWriter),r.Reader._configure(r.BufferReader)}r.build="minimal",r.Writer=require("./writer"),r.BufferWriter=require("./writer_buffer"),r.Reader=require("./reader"),r.BufferReader=require("./reader_buffer"),r.util=require("./util/minimal"),r.rpc=require("./rpc"),r.roots=require("./roots"),r.configure=e,e();
|
||
},{"./writer":"72ct","./writer_buffer":"l7NZ","./reader":"+nPE","./reader_buffer":"rMb4","./util/minimal":"Cu2u","./rpc":"NDD/","./roots":"2V3j"}],"78bh":[function(require,module,exports) {
|
||
"use strict";module.exports=require("./src/index-minimal");
|
||
},{"./src/index-minimal":"po16"}],"uznU":[function(require,module,exports) {
|
||
"use strict";var e=require("protobufjs/minimal"),t=e.Reader,a=e.Writer,r=e.util,n=e.roots.default||(e.roots.default={});n.KeyType=function(){var e={},t=Object.create(e);return t[e[0]="RSA"]=0,t[e[1]="Ed25519"]=1,t[e[2]="Secp256k1"]=2,t}(),n.PublicKey=function(){function o(e){if(e)for(var t=Object.keys(e),a=0;a<t.length;++a)null!=e[t[a]]&&(this[t[a]]=e[t[a]])}return o.prototype.Type=0,o.prototype.Data=r.newBuffer([]),o.encode=function(e,t){return t||(t=a.create()),t.uint32(8).int32(e.Type),t.uint32(18).bytes(e.Data),t},o.decode=function(e,a){e instanceof t||(e=t.create(e));for(var o=void 0===a?e.len:e.pos+a,i=new n.PublicKey;e.pos<o;){var s=e.uint32();switch(s>>>3){case 1:i.Type=e.int32();break;case 2:i.Data=e.bytes();break;default:e.skipType(7&s)}}if(!i.hasOwnProperty("Type"))throw r.ProtocolError("missing required 'Type'",{instance:i});if(!i.hasOwnProperty("Data"))throw r.ProtocolError("missing required 'Data'",{instance:i});return i},o.fromObject=function(e){if(e instanceof n.PublicKey)return e;var t=new n.PublicKey;switch(e.Type){case"RSA":case 0:t.Type=0;break;case"Ed25519":case 1:t.Type=1;break;case"Secp256k1":case 2:t.Type=2}return null!=e.Data&&("string"==typeof e.Data?r.base64.decode(e.Data,t.Data=r.newBuffer(r.base64.length(e.Data)),0):e.Data.length&&(t.Data=e.Data)),t},o.toObject=function(e,t){t||(t={});var a={};return t.defaults&&(a.Type=t.enums===String?"RSA":0,t.bytes===String?a.Data="":(a.Data=[],t.bytes!==Array&&(a.Data=r.newBuffer(a.Data)))),null!=e.Type&&e.hasOwnProperty("Type")&&(a.Type=t.enums===String?n.KeyType[e.Type]:e.Type),null!=e.Data&&e.hasOwnProperty("Data")&&(a.Data=t.bytes===String?r.base64.encode(e.Data,0,e.Data.length):t.bytes===Array?Array.prototype.slice.call(e.Data):e.Data),a},o.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},o}(),n.PrivateKey=function(){function o(e){if(e)for(var t=Object.keys(e),a=0;a<t.length;++a)null!=e[t[a]]&&(this[t[a]]=e[t[a]])}return o.prototype.Type=0,o.prototype.Data=r.newBuffer([]),o.encode=function(e,t){return t||(t=a.create()),t.uint32(8).int32(e.Type),t.uint32(18).bytes(e.Data),t},o.decode=function(e,a){e instanceof t||(e=t.create(e));for(var o=void 0===a?e.len:e.pos+a,i=new n.PrivateKey;e.pos<o;){var s=e.uint32();switch(s>>>3){case 1:i.Type=e.int32();break;case 2:i.Data=e.bytes();break;default:e.skipType(7&s)}}if(!i.hasOwnProperty("Type"))throw r.ProtocolError("missing required 'Type'",{instance:i});if(!i.hasOwnProperty("Data"))throw r.ProtocolError("missing required 'Data'",{instance:i});return i},o.fromObject=function(e){if(e instanceof n.PrivateKey)return e;var t=new n.PrivateKey;switch(e.Type){case"RSA":case 0:t.Type=0;break;case"Ed25519":case 1:t.Type=1;break;case"Secp256k1":case 2:t.Type=2}return null!=e.Data&&("string"==typeof e.Data?r.base64.decode(e.Data,t.Data=r.newBuffer(r.base64.length(e.Data)),0):e.Data.length&&(t.Data=e.Data)),t},o.toObject=function(e,t){t||(t={});var a={};return t.defaults&&(a.Type=t.enums===String?"RSA":0,t.bytes===String?a.Data="":(a.Data=[],t.bytes!==Array&&(a.Data=r.newBuffer(a.Data)))),null!=e.Type&&e.hasOwnProperty("Type")&&(a.Type=t.enums===String?n.KeyType[e.Type]:e.Type),null!=e.Data&&e.hasOwnProperty("Data")&&(a.Data=t.bytes===String?r.base64.encode(e.Data,0,e.Data.length):t.bytes===Array?Array.prototype.slice.call(e.Data):e.Data),a},o.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},o}(),module.exports=n;
|
||
},{"protobufjs/minimal":"78bh"}],"sQ2N":[function(require,module,exports) {
|
||
module.exports={options:{usePureJavaScript:!1}};
|
||
},{}],"sC8V":[function(require,module,exports) {
|
||
|
||
},{}],"mhJr":[function(require,module,exports) {
|
||
var Buffer = require("buffer").Buffer;
|
||
var r=require("buffer").Buffer,e={};module.exports=e;var t={};function n(r,e){var t=0,n=e.length,o=e.charAt(0),a=[0];for(t=0;t<r.length();++t){for(var f=0,h=r.at(t);f<a.length;++f)h+=a[f]<<8,a[f]=h%n,h=h/n|0;for(;h>0;)a.push(h%n),h=h/n|0}var i="";for(t=0;0===r.at(t)&&t<r.length()-1;++t)i+=o;for(t=a.length-1;t>=0;--t)i+=e[a[t]];return i}e.encode=function(r,e,t){if("string"!=typeof e)throw new TypeError('"alphabet" must be a string.');if(void 0!==t&&"number"!=typeof t)throw new TypeError('"maxline" must be a number.');var o="";if(r instanceof Uint8Array){var a=0,f=e.length,h=e.charAt(0),i=[0];for(a=0;a<r.length;++a){for(var g=0,u=r[a];g<i.length;++g)u+=i[g]<<8,i[g]=u%f,u=u/f|0;for(;u>0;)i.push(u%f),u=u/f|0}for(a=0;0===r[a]&&a<r.length-1;++a)o+=h;for(a=i.length-1;a>=0;--a)o+=e[i[a]]}else o=n(r,e);if(t){var l=new RegExp(".{1,"+t+"}","g");o=o.match(l).join("\r\n")}return o},e.decode=function(e,n){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof n)throw new TypeError('"alphabet" must be a string.');var o=t[n];if(!o){o=t[n]=[];for(var a=0;a<n.length;++a)o[n.charCodeAt(a)]=a}e=e.replace(/\s/g,"");var f=n.length,h=n.charAt(0),i=[0];for(a=0;a<e.length;a++){var g=o[e.charCodeAt(a)];if(void 0===g)return;for(var u=0,l=g;u<i.length;++u)l+=i[u]*f,i[u]=255&l,l>>=8;for(;l>0;)i.push(255&l),l>>=8}for(var s=0;e[s]===h&&s<e.length-1;++s)i.push(0);return void 0!==r?r.from(i.reverse()):new Uint8Array(i.reverse())};
|
||
},{"buffer":"sC8V"}],"2MJg":[function(require,module,exports) {
|
||
var process = require("process");
|
||
var global = arguments[3];
|
||
var Buffer = require("buffer").Buffer;
|
||
var t=require("process"),e=arguments[3],r=require("buffer").Buffer;function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=require("./forge"),a=require("./baseN"),o=module.exports=i.util=i.util||{};function s(t){if(8!==t&&16!==t&&24!==t&&32!==t)throw new Error("Only 8, 16, 24, or 32 bits supported: "+t)}function u(t){if(this.data="",this.read=0,"string"==typeof t)this.data=t;else if(o.isArrayBuffer(t)||o.isArrayBufferView(t))if(void 0!==r&&t instanceof r)this.data=t.toString("binary");else{var e=new Uint8Array(t);try{this.data=String.fromCharCode.apply(null,e)}catch(a){for(var i=0;i<e.length;++i)this.putByte(e[i])}}else(t instanceof u||"object"===n(t)&&"string"==typeof t.data&&"number"==typeof t.read)&&(this.data=t.data,this.read=t.read);this._constructedStringLength=0}!function(){if(void 0!==t&&t.nextTick,"function"==typeof setImmediate)return o.setImmediate=function(){return setImmediate.apply(void 0,arguments)},void(o.nextTick=function(t){return setImmediate(t)});if(o.setImmediate=function(t){setTimeout(t,0)},"undefined"!=typeof window&&"function"==typeof window.postMessage){var e="forge.setImmediate",r=[];o.setImmediate=function(t){r.push(t),1===r.length&&window.postMessage(e,"*")},window.addEventListener("message",function(t){if(t.source===window&&t.data===e){t.stopPropagation();var n=r.slice();r.length=0,n.forEach(function(t){t()})}},!0)}if("undefined"!=typeof MutationObserver){var n=Date.now(),i=!0,a=document.createElement("div");r=[];new MutationObserver(function(){var t=r.slice();r.length=0,t.forEach(function(t){t()})}).observe(a,{attributes:!0});var s=o.setImmediate;o.setImmediate=function(t){Date.now()-n>15?(n=Date.now(),s(t)):(r.push(t),1===r.length&&a.setAttribute("a",i=!i))}}o.nextTick=o.setImmediate}(),o.isNodejs=void 0!==t&&t.versions&&t.versions.node,o.globalScope=o.isNodejs?e:"undefined"==typeof self?window:self,o.isArray=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},o.isArrayBuffer=function(t){return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer},o.isArrayBufferView=function(t){return t&&o.isArrayBuffer(t.buffer)&&void 0!==t.byteLength},o.ByteBuffer=u,o.ByteStringBuffer=u;var f=4096;function h(t,e){e=e||{},this.read=e.readOffset||0,this.growSize=e.growSize||1024;var r=o.isArrayBuffer(t),n=o.isArrayBufferView(t);if(r||n)return this.data=r?new DataView(t):new DataView(t.buffer,t.byteOffset,t.byteLength),void(this.write="writeOffset"in e?e.writeOffset:this.data.byteLength);this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!=t&&this.putBytes(t),"writeOffset"in e&&(this.write=e.writeOffset)}o.ByteStringBuffer.prototype._optimizeConstructedString=function(t){this._constructedStringLength+=t,this._constructedStringLength>f&&(this.data.substr(0,1),this._constructedStringLength=0)},o.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},o.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},o.ByteStringBuffer.prototype.putByte=function(t){return this.putBytes(String.fromCharCode(t))},o.ByteStringBuffer.prototype.fillWithByte=function(t,e){t=String.fromCharCode(t);for(var r=this.data;e>0;)1&e&&(r+=t),(e>>>=1)>0&&(t+=t);return this.data=r,this._optimizeConstructedString(e),this},o.ByteStringBuffer.prototype.putBytes=function(t){return this.data+=t,this._optimizeConstructedString(t.length),this},o.ByteStringBuffer.prototype.putString=function(t){return this.putBytes(o.encodeUtf8(t))},o.ByteStringBuffer.prototype.putInt16=function(t){return this.putBytes(String.fromCharCode(t>>8&255)+String.fromCharCode(255&t))},o.ByteStringBuffer.prototype.putInt24=function(t){return this.putBytes(String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(255&t))},o.ByteStringBuffer.prototype.putInt32=function(t){return this.putBytes(String.fromCharCode(t>>24&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(255&t))},o.ByteStringBuffer.prototype.putInt16Le=function(t){return this.putBytes(String.fromCharCode(255&t)+String.fromCharCode(t>>8&255))},o.ByteStringBuffer.prototype.putInt24Le=function(t){return this.putBytes(String.fromCharCode(255&t)+String.fromCharCode(t>>8&255)+String.fromCharCode(t>>16&255))},o.ByteStringBuffer.prototype.putInt32Le=function(t){return this.putBytes(String.fromCharCode(255&t)+String.fromCharCode(t>>8&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>24&255))},o.ByteStringBuffer.prototype.putInt=function(t,e){s(e);var r="";do{e-=8,r+=String.fromCharCode(t>>e&255)}while(e>0);return this.putBytes(r)},o.ByteStringBuffer.prototype.putSignedInt=function(t,e){return t<0&&(t+=2<<e-1),this.putInt(t,e)},o.ByteStringBuffer.prototype.putBuffer=function(t){return this.putBytes(t.getBytes())},o.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},o.ByteStringBuffer.prototype.getInt16=function(){var t=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,t},o.ByteStringBuffer.prototype.getInt24=function(){var t=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,t},o.ByteStringBuffer.prototype.getInt32=function(){var t=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,t},o.ByteStringBuffer.prototype.getInt16Le=function(){var t=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,t},o.ByteStringBuffer.prototype.getInt24Le=function(){var t=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,t},o.ByteStringBuffer.prototype.getInt32Le=function(){var t=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,t},o.ByteStringBuffer.prototype.getInt=function(t){s(t);var e=0;do{e=(e<<8)+this.data.charCodeAt(this.read++),t-=8}while(t>0);return e},o.ByteStringBuffer.prototype.getSignedInt=function(t){var e=this.getInt(t),r=2<<t-2;return e>=r&&(e-=r<<1),e},o.ByteStringBuffer.prototype.getBytes=function(t){var e;return t?(t=Math.min(this.length(),t),e=this.data.slice(this.read,this.read+t),this.read+=t):0===t?e="":(e=0===this.read?this.data:this.data.slice(this.read),this.clear()),e},o.ByteStringBuffer.prototype.bytes=function(t){return void 0===t?this.data.slice(this.read):this.data.slice(this.read,this.read+t)},o.ByteStringBuffer.prototype.at=function(t){return this.data.charCodeAt(this.read+t)},o.ByteStringBuffer.prototype.setAt=function(t,e){return this.data=this.data.substr(0,this.read+t)+String.fromCharCode(e)+this.data.substr(this.read+t+1),this},o.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},o.ByteStringBuffer.prototype.copy=function(){var t=o.createBuffer(this.data);return t.read=this.read,t},o.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},o.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},o.ByteStringBuffer.prototype.truncate=function(t){var e=Math.max(0,this.length()-t);return this.data=this.data.substr(this.read,e),this.read=0,this},o.ByteStringBuffer.prototype.toHex=function(){for(var t="",e=this.read;e<this.data.length;++e){var r=this.data.charCodeAt(e);r<16&&(t+="0"),t+=r.toString(16)}return t},o.ByteStringBuffer.prototype.toString=function(){return o.decodeUtf8(this.bytes())},o.DataBuffer=h,o.DataBuffer.prototype.length=function(){return this.write-this.read},o.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},o.DataBuffer.prototype.accommodate=function(t,e){if(this.length()>=t)return this;e=Math.max(e||this.growSize,t);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+e);return n.set(r),this.data=new DataView(n.buffer),this},o.DataBuffer.prototype.putByte=function(t){return this.accommodate(1),this.data.setUint8(this.write++,t),this},o.DataBuffer.prototype.fillWithByte=function(t,e){this.accommodate(e);for(var r=0;r<e;++r)this.data.setUint8(t);return this},o.DataBuffer.prototype.putBytes=function(t,e){if(o.isArrayBufferView(t)){var r=(i=new Uint8Array(t.buffer,t.byteOffset,t.byteLength)).byteLength-i.byteOffset;return this.accommodate(r),new Uint8Array(this.data.buffer,this.write).set(i),this.write+=r,this}if(o.isArrayBuffer(t)){var i=new Uint8Array(t);return this.accommodate(i.byteLength),new Uint8Array(this.data.buffer).set(i,this.write),this.write+=i.byteLength,this}if(t instanceof o.DataBuffer||"object"===n(t)&&"number"==typeof t.read&&"number"==typeof t.write&&o.isArrayBufferView(t.data)){i=new Uint8Array(t.data.byteLength,t.read,t.length());return this.accommodate(i.byteLength),new Uint8Array(t.data.byteLength,this.write).set(i),this.write+=i.byteLength,this}if(t instanceof o.ByteStringBuffer&&(t=t.data,e="binary"),e=e||"binary","string"==typeof t){var a;if("hex"===e)return this.accommodate(Math.ceil(t.length/2)),a=new Uint8Array(this.data.buffer,this.write),this.write+=o.binary.hex.decode(t,a,this.write),this;if("base64"===e)return this.accommodate(3*Math.ceil(t.length/4)),a=new Uint8Array(this.data.buffer,this.write),this.write+=o.binary.base64.decode(t,a,this.write),this;if("utf8"===e&&(t=o.encodeUtf8(t),e="binary"),"binary"===e||"raw"===e)return this.accommodate(t.length),a=new Uint8Array(this.data.buffer,this.write),this.write+=o.binary.raw.decode(a),this;if("utf16"===e)return this.accommodate(2*t.length),a=new Uint16Array(this.data.buffer,this.write),this.write+=o.text.utf16.encode(a),this;throw new Error("Invalid encoding: "+e)}throw Error("Invalid parameter: "+t)},o.DataBuffer.prototype.putBuffer=function(t){return this.putBytes(t),t.clear(),this},o.DataBuffer.prototype.putString=function(t){return this.putBytes(t,"utf16")},o.DataBuffer.prototype.putInt16=function(t){return this.accommodate(2),this.data.setInt16(this.write,t),this.write+=2,this},o.DataBuffer.prototype.putInt24=function(t){return this.accommodate(3),this.data.setInt16(this.write,t>>8&65535),this.data.setInt8(this.write,t>>16&255),this.write+=3,this},o.DataBuffer.prototype.putInt32=function(t){return this.accommodate(4),this.data.setInt32(this.write,t),this.write+=4,this},o.DataBuffer.prototype.putInt16Le=function(t){return this.accommodate(2),this.data.setInt16(this.write,t,!0),this.write+=2,this},o.DataBuffer.prototype.putInt24Le=function(t){return this.accommodate(3),this.data.setInt8(this.write,t>>16&255),this.data.setInt16(this.write,t>>8&65535,!0),this.write+=3,this},o.DataBuffer.prototype.putInt32Le=function(t){return this.accommodate(4),this.data.setInt32(this.write,t,!0),this.write+=4,this},o.DataBuffer.prototype.putInt=function(t,e){s(e),this.accommodate(e/8);do{e-=8,this.data.setInt8(this.write++,t>>e&255)}while(e>0);return this},o.DataBuffer.prototype.putSignedInt=function(t,e){return s(e),this.accommodate(e/8),t<0&&(t+=2<<e-1),this.putInt(t,e)},o.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},o.DataBuffer.prototype.getInt16=function(){var t=this.data.getInt16(this.read);return this.read+=2,t},o.DataBuffer.prototype.getInt24=function(){var t=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,t},o.DataBuffer.prototype.getInt32=function(){var t=this.data.getInt32(this.read);return this.read+=4,t},o.DataBuffer.prototype.getInt16Le=function(){var t=this.data.getInt16(this.read,!0);return this.read+=2,t},o.DataBuffer.prototype.getInt24Le=function(){var t=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,t},o.DataBuffer.prototype.getInt32Le=function(){var t=this.data.getInt32(this.read,!0);return this.read+=4,t},o.DataBuffer.prototype.getInt=function(t){s(t);var e=0;do{e=(e<<8)+this.data.getInt8(this.read++),t-=8}while(t>0);return e},o.DataBuffer.prototype.getSignedInt=function(t){var e=this.getInt(t),r=2<<t-2;return e>=r&&(e-=r<<1),e},o.DataBuffer.prototype.getBytes=function(t){var e;return t?(t=Math.min(this.length(),t),e=this.data.slice(this.read,this.read+t),this.read+=t):0===t?e="":(e=0===this.read?this.data:this.data.slice(this.read),this.clear()),e},o.DataBuffer.prototype.bytes=function(t){return void 0===t?this.data.slice(this.read):this.data.slice(this.read,this.read+t)},o.DataBuffer.prototype.at=function(t){return this.data.getUint8(this.read+t)},o.DataBuffer.prototype.setAt=function(t,e){return this.data.setUint8(t,e),this},o.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},o.DataBuffer.prototype.copy=function(){return new o.DataBuffer(this)},o.DataBuffer.prototype.compact=function(){if(this.read>0){var t=new Uint8Array(this.data.buffer,this.read),e=new Uint8Array(t.byteLength);e.set(t),this.data=new DataView(e),this.write-=this.read,this.read=0}return this},o.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},o.DataBuffer.prototype.truncate=function(t){return this.write=Math.max(0,this.length()-t),this.read=Math.min(this.read,this.write),this},o.DataBuffer.prototype.toHex=function(){for(var t="",e=this.read;e<this.data.byteLength;++e){var r=this.data.getUint8(e);r<16&&(t+="0"),t+=r.toString(16)}return t},o.DataBuffer.prototype.toString=function(t){var e=new Uint8Array(this.data,this.read,this.length());if("binary"===(t=t||"utf8")||"raw"===t)return o.binary.raw.encode(e);if("hex"===t)return o.binary.hex.encode(e);if("base64"===t)return o.binary.base64.encode(e);if("utf8"===t)return o.text.utf8.decode(e);if("utf16"===t)return o.text.utf16.decode(e);throw new Error("Invalid encoding: "+t)},o.createBuffer=function(t,e){return e=e||"raw",void 0!==t&&"utf8"===e&&(t=o.encodeUtf8(t)),new o.ByteBuffer(t)},o.fillString=function(t,e){for(var r="";e>0;)1&e&&(r+=t),(e>>>=1)>0&&(t+=t);return r},o.xorBytes=function(t,e,r){for(var n="",i="",a="",o=0,s=0;r>0;--r,++o)i=t.charCodeAt(o)^e.charCodeAt(o),s>=10&&(n+=a,a="",s=0),a+=String.fromCharCode(i),++s;return n+=a},o.hexToBytes=function(t){var e="",r=0;for(!0&t.length&&(r=1,e+=String.fromCharCode(parseInt(t[0],16)));r<t.length;r+=2)e+=String.fromCharCode(parseInt(t.substr(r,2),16));return e},o.bytesToHex=function(t){return o.createBuffer(t).toHex()},o.int32ToBytes=function(t){return String.fromCharCode(t>>24&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(255&t)};var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],p="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";o.encode64=function(t,e){for(var r,n,i,a="",o="",s=0;s<t.length;)r=t.charCodeAt(s++),n=t.charCodeAt(s++),i=t.charCodeAt(s++),a+=d.charAt(r>>2),a+=d.charAt((3&r)<<4|n>>4),isNaN(n)?a+="==":(a+=d.charAt((15&n)<<2|i>>6),a+=isNaN(i)?"=":d.charAt(63&i)),e&&a.length>e&&(o+=a.substr(0,e)+"\r\n",a=a.substr(e));return o+=a},o.decode64=function(t){t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var e,r,n,i,a="",o=0;o<t.length;)e=c[t.charCodeAt(o++)-43],r=c[t.charCodeAt(o++)-43],n=c[t.charCodeAt(o++)-43],i=c[t.charCodeAt(o++)-43],a+=String.fromCharCode(e<<2|r>>4),64!==n&&(a+=String.fromCharCode((15&r)<<4|n>>2),64!==i&&(a+=String.fromCharCode((3&n)<<6|i)));return a},o.encodeUtf8=function(t){return unescape(encodeURIComponent(t))},o.decodeUtf8=function(t){return decodeURIComponent(escape(t))},o.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:a.encode,decode:a.decode}},o.binary.raw.encode=function(t){return String.fromCharCode.apply(null,t)},o.binary.raw.decode=function(t,e,r){var n=e;n||(n=new Uint8Array(t.length));for(var i=r=r||0,a=0;a<t.length;++a)n[i++]=t.charCodeAt(a);return e?i-r:n},o.binary.hex.encode=o.bytesToHex,o.binary.hex.decode=function(t,e,r){var n=e;n||(n=new Uint8Array(Math.ceil(t.length/2)));var i=0,a=r=r||0;for(1&t.length&&(i=1,n[a++]=parseInt(t[0],16));i<t.length;i+=2)n[a++]=parseInt(t.substr(i,2),16);return e?a-r:n},o.binary.base64.encode=function(t,e){for(var r,n,i,a="",o="",s=0;s<t.byteLength;)r=t[s++],n=t[s++],i=t[s++],a+=d.charAt(r>>2),a+=d.charAt((3&r)<<4|n>>4),isNaN(n)?a+="==":(a+=d.charAt((15&n)<<2|i>>6),a+=isNaN(i)?"=":d.charAt(63&i)),e&&a.length>e&&(o+=a.substr(0,e)+"\r\n",a=a.substr(e));return o+=a},o.binary.base64.decode=function(t,e,r){var n,i,a,o,s=e;s||(s=new Uint8Array(3*Math.ceil(t.length/4))),t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var u=0,f=r=r||0;u<t.length;)n=c[t.charCodeAt(u++)-43],i=c[t.charCodeAt(u++)-43],a=c[t.charCodeAt(u++)-43],o=c[t.charCodeAt(u++)-43],s[f++]=n<<2|i>>4,64!==a&&(s[f++]=(15&i)<<4|a>>2,64!==o&&(s[f++]=(3&a)<<6|o));return e?f-r:s.subarray(0,f)},o.binary.base58.encode=function(t,e){return o.binary.baseN.encode(t,p,e)},o.binary.base58.decode=function(t,e){return o.binary.baseN.decode(t,p,e)},o.text={utf8:{},utf16:{}},o.text.utf8.encode=function(t,e,r){t=o.encodeUtf8(t);var n=e;n||(n=new Uint8Array(t.length));for(var i=r=r||0,a=0;a<t.length;++a)n[i++]=t.charCodeAt(a);return e?i-r:n},o.text.utf8.decode=function(t){return o.decodeUtf8(String.fromCharCode.apply(null,t))},o.text.utf16.encode=function(t,e,r){var n=e;n||(n=new Uint8Array(2*t.length));for(var i=new Uint16Array(n.buffer),a=r=r||0,o=r,s=0;s<t.length;++s)i[o++]=t.charCodeAt(s),a+=2;return e?a-r:n},o.text.utf16.decode=function(t){return String.fromCharCode.apply(null,new Uint16Array(t.buffer))},o.deflate=function(t,e,r){if(e=o.decode64(t.deflate(o.encode64(e)).rval),r){var n=2;32&e.charCodeAt(1)&&(n=6),e=e.substring(n,e.length-4)}return e},o.inflate=function(t,e,r){var n=t.inflate(o.encode64(e)).rval;return null===n?null:o.decode64(n)};var y=function(t,e,r){if(!t)throw new Error("WebStorage not available.");var n;if(null===r?n=t.removeItem(e):(r=o.encode64(JSON.stringify(r)),n=t.setItem(e,r)),void 0!==n&&!0!==n.rval){var i=new Error(n.error.message);throw i.id=n.error.id,i.name=n.error.name,i}},g=function(t,e){if(!t)throw new Error("WebStorage not available.");var r=t.getItem(e);if(t.init)if(null===r.rval){if(r.error){var n=new Error(r.error.message);throw n.id=r.error.id,n.name=r.error.name,n}r=null}else r=r.rval;return null!==r&&(r=JSON.parse(o.decode64(r))),r},l=function(t,e,r,n){var i=g(t,e);null===i&&(i={}),i[r]=n,y(t,e,i)},B=function(t,e,r){var n=g(t,e);return null!==n&&(n=r in n?n[r]:null),n},m=function(t,e,r){var n=g(t,e);if(null!==n&&r in n){delete n[r];var i=!0;for(var a in n){i=!1;break}i&&(n=null),y(t,e,n)}},v=function(t,e){y(t,e,null)},b=function(t,e,r){var n,i=null;void 0===r&&(r=["web","flash"]);var a=!1,o=null;for(var s in r){n=r[s];try{if("flash"===n||"both"===n){if(null===e[0])throw new Error("Flash local storage not available.");i=t.apply(this,e),a="flash"===n}"web"!==n&&"both"!==n||(e[0]=localStorage,i=t.apply(this,e),a=!0)}catch(u){o=u}if(a)break}if(!a)throw o;return i};o.setItem=function(t,e,r,n,i){b(l,arguments,i)},o.getItem=function(t,e,r,n){return b(B,arguments,n)},o.removeItem=function(t,e,r,n){b(m,arguments,n)},o.clearItems=function(t,e,r){b(v,arguments,r)},o.parseUrl=function(t){var e=/^(https?):\/\/([^:&^\/]*):?(\d*)(.*)$/g;e.lastIndex=0;var r=e.exec(t),n=null===r?null:{full:t,scheme:r[1],host:r[2],port:r[3],path:r[4]};return n&&(n.fullHost=n.host,n.port?80!==n.port&&"http"===n.scheme?n.fullHost+=":"+n.port:443!==n.port&&"https"===n.scheme&&(n.fullHost+=":"+n.port):"http"===n.scheme?n.port=80:"https"===n.scheme&&(n.port=443),n.full=n.scheme+"://"+n.fullHost),n};var w=null;o.getQueryVariables=function(t){var e,r=function(t){for(var e={},r=t.split("&"),n=0;n<r.length;n++){var i,a,o=r[n].indexOf("=");o>0?(i=r[n].substring(0,o),a=r[n].substring(o+1)):(i=r[n],a=null),i in e||(e[i]=[]),i in Object.prototype||null===a||e[i].push(unescape(a))}return e};return void 0===t?(null===w&&(w="undefined"!=typeof window&&window.location&&window.location.search?r(window.location.search.substring(1)):{}),e=w):e=r(t),e},o.parseFragment=function(t){var e=t,r="",n=t.indexOf("?");n>0&&(e=t.substring(0,n),r=t.substring(n+1));var i=e.split("/");return i.length>0&&""===i[0]&&i.shift(),{pathString:e,queryString:r,path:i,query:""===r?{}:o.getQueryVariables(r)}},o.makeRequest=function(t){var e=o.parseFragment(t),r={path:e.pathString,query:e.queryString,getPath:function(t){return void 0===t?e.path:e.path[t]},getQuery:function(t,r){var n;return void 0===t?n=e.query:(n=e.query[t])&&void 0!==r&&(n=n[r]),n},getQueryLast:function(t,e){var n=r.getQuery(t);return n?n[n.length-1]:e}};return r},o.makeLink=function(t,e,r){t=jQuery.isArray(t)?t.join("/"):t;var n=jQuery.param(e||{});return r=r||"",t+(n.length>0?"?"+n:"")+(r.length>0?"#"+r:"")},o.isEmpty=function(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0},o.format=function(t){for(var e,r,n=/%./g,i=0,a=[],o=0;e=n.exec(t);){(r=t.substring(o,n.lastIndex-2)).length>0&&a.push(r),o=n.lastIndex;var s=e[0][1];switch(s){case"s":case"o":i<arguments.length?a.push(arguments[1+i++]):a.push("<?>");break;case"%":a.push("%");break;default:a.push("<%"+s+"?>")}}return a.push(t.substring(o)),a.join("")},o.formatNumber=function(t,e,r,n){var i=t,a=isNaN(e=Math.abs(e))?2:e,o=void 0===r?",":r,s=void 0===n?".":n,u=i<0?"-":"",f=parseInt(i=Math.abs(+i||0).toFixed(a),10)+"",h=f.length>3?f.length%3:0;return u+(h?f.substr(0,h)+s:"")+f.substr(h).replace(/(\d{3})(?=\d)/g,"$1"+s)+(a?o+Math.abs(i-f).toFixed(a).slice(2):"")},o.formatSize=function(t){return t=t>=1073741824?o.formatNumber(t/1073741824,2,".","")+" GiB":t>=1048576?o.formatNumber(t/1048576,2,".","")+" MiB":t>=1024?o.formatNumber(t/1024,0)+" KiB":o.formatNumber(t,0)+" bytes"},o.bytesFromIP=function(t){return-1!==t.indexOf(".")?o.bytesFromIPv4(t):-1!==t.indexOf(":")?o.bytesFromIPv6(t):null},o.bytesFromIPv4=function(t){if(4!==(t=t.split(".")).length)return null;for(var e=o.createBuffer(),r=0;r<t.length;++r){var n=parseInt(t[r],10);if(isNaN(n))return null;e.putByte(n)}return e.getBytes()},o.bytesFromIPv6=function(t){for(var e=0,r=2*(8-(t=t.split(":").filter(function(t){return 0===t.length&&++e,!0})).length+e),n=o.createBuffer(),i=0;i<8;++i)if(t[i]&&0!==t[i].length){var a=o.hexToBytes(t[i]);a.length<2&&n.putByte(0),n.putBytes(a)}else n.fillWithByte(0,r),r=0;return n.getBytes()},o.bytesToIP=function(t){return 4===t.length?o.bytesToIPv4(t):16===t.length?o.bytesToIPv6(t):null},o.bytesToIPv4=function(t){if(4!==t.length)return null;for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r));return e.join(".")},o.bytesToIPv6=function(t){if(16!==t.length)return null;for(var e=[],r=[],n=0,i=0;i<t.length;i+=2){for(var a=o.bytesToHex(t[i]+t[i+1]);"0"===a[0]&&"0"!==a;)a=a.substr(1);if("0"===a){var s=r[r.length-1],u=e.length;s&&u===s.end+1?(s.end=u,s.end-s.start>r[n].end-r[n].start&&(n=r.length-1)):r.push({start:u,end:u})}e.push(a)}if(r.length>0){var f=r[n];f.end-f.start>0&&(e.splice(f.start,f.end-f.start+1,""),0===f.start&&e.unshift(""),7===f.end&&e.push(""))}return e.join(":")},o.estimateCores=function(t,e){if("function"==typeof t&&(e=t,t={}),t=t||{},"cores"in o&&!t.update)return e(null,o.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return o.cores=navigator.hardwareConcurrency,e(null,o.cores);if("undefined"==typeof Worker)return o.cores=1,e(null,o.cores);if("undefined"==typeof Blob)return o.cores=2,e(null,o.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(t){for(var e=Date.now(),r=e+4;Date.now()<r;);self.postMessage({st:e,et:r})})}.toString(),")()"],{type:"application/javascript"}));!function t(n,i,a){if(0===i){var s=Math.floor(n.reduce(function(t,e){return t+e},0)/n.length);return o.cores=Math.max(1,s),URL.revokeObjectURL(r),e(null,o.cores)}!function(t,e){for(var n=[],i=[],a=0;a<t;++a){var o=new Worker(r);o.addEventListener("message",function(r){if(i.push(r.data),i.length===t){for(var a=0;a<t;++a)n[a].terminate();e(null,i)}}),n.push(o)}for(var a=0;a<t;++a)n[a].postMessage(a)}(a,function(e,r){n.push(function(t,e){for(var r=[],n=0;n<t;++n)for(var i=e[n],a=r[n]=[],o=0;o<t;++o)if(n!==o){var s=e[o];(i.st>s.st&&i.st<s.et||s.st>i.st&&s.st<i.et)&&a.push(o)}return r.reduce(function(t,e){return Math.max(t,e.length)},0)}(a,r)),t(n,i-1,a)})}([],5,16)};
|
||
},{"./forge":"sQ2N","./baseN":"mhJr","process":"sC8V","buffer":"sC8V"}],"F6JL":[function(require,module,exports) {
|
||
var i=require("./forge");i.pki=i.pki||{};var t=module.exports=i.pki.oids=i.oids=i.oids||{};function e(i,e){t[i]=e,t[e]=i}function s(i,e){t[i]=e}e("1.2.840.113549.1.1.1","rsaEncryption"),e("1.2.840.113549.1.1.4","md5WithRSAEncryption"),e("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),e("1.2.840.113549.1.1.7","RSAES-OAEP"),e("1.2.840.113549.1.1.8","mgf1"),e("1.2.840.113549.1.1.9","pSpecified"),e("1.2.840.113549.1.1.10","RSASSA-PSS"),e("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),e("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),e("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),e("1.3.101.112","EdDSA25519"),e("1.2.840.10040.4.3","dsa-with-sha1"),e("1.3.14.3.2.7","desCBC"),e("1.3.14.3.2.26","sha1"),e("2.16.840.1.101.3.4.2.1","sha256"),e("2.16.840.1.101.3.4.2.2","sha384"),e("2.16.840.1.101.3.4.2.3","sha512"),e("1.2.840.113549.2.5","md5"),e("1.2.840.113549.1.7.1","data"),e("1.2.840.113549.1.7.2","signedData"),e("1.2.840.113549.1.7.3","envelopedData"),e("1.2.840.113549.1.7.4","signedAndEnvelopedData"),e("1.2.840.113549.1.7.5","digestedData"),e("1.2.840.113549.1.7.6","encryptedData"),e("1.2.840.113549.1.9.1","emailAddress"),e("1.2.840.113549.1.9.2","unstructuredName"),e("1.2.840.113549.1.9.3","contentType"),e("1.2.840.113549.1.9.4","messageDigest"),e("1.2.840.113549.1.9.5","signingTime"),e("1.2.840.113549.1.9.6","counterSignature"),e("1.2.840.113549.1.9.7","challengePassword"),e("1.2.840.113549.1.9.8","unstructuredAddress"),e("1.2.840.113549.1.9.14","extensionRequest"),e("1.2.840.113549.1.9.20","friendlyName"),e("1.2.840.113549.1.9.21","localKeyId"),e("1.2.840.113549.1.9.22.1","x509Certificate"),e("1.2.840.113549.1.12.10.1.1","keyBag"),e("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),e("1.2.840.113549.1.12.10.1.3","certBag"),e("1.2.840.113549.1.12.10.1.4","crlBag"),e("1.2.840.113549.1.12.10.1.5","secretBag"),e("1.2.840.113549.1.12.10.1.6","safeContentsBag"),e("1.2.840.113549.1.5.13","pkcs5PBES2"),e("1.2.840.113549.1.5.12","pkcs5PBKDF2"),e("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),e("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),e("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),e("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),e("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),e("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),e("1.2.840.113549.2.7","hmacWithSHA1"),e("1.2.840.113549.2.8","hmacWithSHA224"),e("1.2.840.113549.2.9","hmacWithSHA256"),e("1.2.840.113549.2.10","hmacWithSHA384"),e("1.2.840.113549.2.11","hmacWithSHA512"),e("1.2.840.113549.3.7","des-EDE3-CBC"),e("2.16.840.1.101.3.4.1.2","aes128-CBC"),e("2.16.840.1.101.3.4.1.22","aes192-CBC"),e("2.16.840.1.101.3.4.1.42","aes256-CBC"),e("2.5.4.3","commonName"),e("2.5.4.5","serialName"),e("2.5.4.6","countryName"),e("2.5.4.7","localityName"),e("2.5.4.8","stateOrProvinceName"),e("2.5.4.9","streetAddress"),e("2.5.4.10","organizationName"),e("2.5.4.11","organizationalUnitName"),e("2.5.4.13","description"),e("2.5.4.15","businessCategory"),e("2.5.4.17","postalCode"),e("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),e("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),e("2.16.840.1.113730.1.1","nsCertType"),e("2.16.840.1.113730.1.13","nsComment"),s("2.5.29.1","authorityKeyIdentifier"),s("2.5.29.2","keyAttributes"),s("2.5.29.3","certificatePolicies"),s("2.5.29.4","keyUsageRestriction"),s("2.5.29.5","policyMapping"),s("2.5.29.6","subtreesConstraint"),s("2.5.29.7","subjectAltName"),s("2.5.29.8","issuerAltName"),s("2.5.29.9","subjectDirectoryAttributes"),s("2.5.29.10","basicConstraints"),s("2.5.29.11","nameConstraints"),s("2.5.29.12","policyConstraints"),s("2.5.29.13","basicConstraints"),e("2.5.29.14","subjectKeyIdentifier"),e("2.5.29.15","keyUsage"),s("2.5.29.16","privateKeyUsagePeriod"),e("2.5.29.17","subjectAltName"),e("2.5.29.18","issuerAltName"),e("2.5.29.19","basicConstraints"),s("2.5.29.20","cRLNumber"),s("2.5.29.21","cRLReason"),s("2.5.29.22","expirationDate"),s("2.5.29.23","instructionCode"),s("2.5.29.24","invalidityDate"),s("2.5.29.25","cRLDistributionPoints"),s("2.5.29.26","issuingDistributionPoint"),s("2.5.29.27","deltaCRLIndicator"),s("2.5.29.28","issuingDistributionPoint"),s("2.5.29.29","certificateIssuer"),s("2.5.29.30","nameConstraints"),e("2.5.29.31","cRLDistributionPoints"),e("2.5.29.32","certificatePolicies"),s("2.5.29.33","policyMappings"),s("2.5.29.34","policyConstraints"),e("2.5.29.35","authorityKeyIdentifier"),s("2.5.29.36","policyConstraints"),e("2.5.29.37","extKeyUsage"),s("2.5.29.46","freshestCRL"),s("2.5.29.54","inhibitAnyPolicy"),e("1.3.6.1.4.1.11129.2.4.2","timestampList"),e("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),e("1.3.6.1.5.5.7.3.1","serverAuth"),e("1.3.6.1.5.5.7.3.2","clientAuth"),e("1.3.6.1.5.5.7.3.3","codeSigning"),e("1.3.6.1.5.5.7.3.4","emailProtection"),e("1.3.6.1.5.5.7.3.8","timeStamping");
|
||
},{"./forge":"sQ2N"}],"RZRC":[function(require,module,exports) {
|
||
function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}var t=require("./forge");require("./util"),require("./oids");var r=module.exports=t.asn1=t.asn1||{};function n(e,t,r){if(r>t){var n=new Error("Too few bytes to parse DER.");throw n.available=e.length(),n.remaining=t,n.requested=r,n}}r.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},r.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},r.create=function(e,n,a,s,i){if(t.util.isArray(s)){for(var u=[],o=0;o<s.length;++o)void 0!==s[o]&&u.push(s[o]);s=u}var l={tagClass:e,type:n,constructed:a,composed:a||t.util.isArray(s),value:s};return i&&"bitStringContents"in i&&(l.bitStringContents=i.bitStringContents,l.original=r.copy(l)),l},r.copy=function(e,n){var a;if(t.util.isArray(e)){a=[];for(var s=0;s<e.length;++s)a.push(r.copy(e[s],n));return a}return"string"==typeof e?e:(a={tagClass:e.tagClass,type:e.type,constructed:e.constructed,composed:e.composed,value:r.copy(e.value,n)},n&&!n.excludeBitStringContents&&(a.bitStringContents=e.bitStringContents),a)},r.equals=function(n,a,s){if(t.util.isArray(n)){if(!t.util.isArray(a))return!1;if(n.length!==a.length)return!1;for(var i=0;i<n.length;++i)if(!r.equals(n[i],a[i]))return!1;return!0}if(e(n)!==e(a))return!1;if("string"==typeof n)return n===a;var u=n.tagClass===a.tagClass&&n.type===a.type&&n.constructed===a.constructed&&n.composed===a.composed&&r.equals(n.value,a.value);return s&&s.includeBitStringContents&&(u=u&&n.bitStringContents===a.bitStringContents),u},r.getBerValueLength=function(e){var t=e.getByte();if(128!==t)return 128&t?e.getInt((127&t)<<3):t};var a=function(e,t){var r=e.getByte();if(128!==r){var a;if(128&r){var s=127&r;n(e,--t,s),a=e.getInt(s<<3)}else a=r;if(a<0)throw new Error("Negative length: "+a);return a}};function s(e,t,i,u){var o;n(e,t,2);var l=e.getByte();t--;var p=192&l,c=31&l;o=e.length();var g,T,f=a(e,t);if(t-=o-e.length(),void 0!==f&&f>t){if(u.strict){var v=new Error("Too few bytes to read ASN.1 value.");throw v.available=e.length(),v.remaining=t,v.requested=f,v}f=t}var y=32==(32&l);if(y)if(g=[],void 0===f)for(;;){if(n(e,t,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),t-=2;break}o=e.length(),g.push(s(e,t,i+1,u)),t-=o-e.length()}else for(;f>0;)o=e.length(),g.push(s(e,f,i+1,u)),t-=o-e.length(),f-=o-e.length();if(void 0===g&&p===r.Class.UNIVERSAL&&c===r.Type.BITSTRING&&(T=e.bytes(f)),void 0===g&&u.decodeBitStrings&&p===r.Class.UNIVERSAL&&c===r.Type.BITSTRING&&f>1){var d=e.read,h=t,I=0;if(c===r.Type.BITSTRING&&(n(e,t,1),I=e.getByte(),t--),0===I)try{o=e.length();var C=s(e,t,i+1,{verbose:u.verbose,strict:!0,decodeBitStrings:!0}),b=o-e.length();t-=b,c==r.Type.BITSTRING&&b++;var S=C.tagClass;b!==f||S!==r.Class.UNIVERSAL&&S!==r.Class.CONTEXT_SPECIFIC||(g=[C])}catch(B){}void 0===g&&(e.read=d,t=h)}if(void 0===g){if(void 0===f){if(u.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");f=t}if(c===r.Type.BMPSTRING)for(g="";f>0;f-=2)n(e,t,2),g+=String.fromCharCode(e.getInt16()),t-=2;else g=e.getBytes(f)}var E=void 0===T?null:{bitStringContents:T};return r.create(p,c,y,g,E)}r.fromDer=function(e,r){return void 0===r&&(r={strict:!0,decodeBitStrings:!0}),"boolean"==typeof r&&(r={strict:r,decodeBitStrings:!0}),"strict"in r||(r.strict=!0),"decodeBitStrings"in r||(r.decodeBitStrings=!0),"string"==typeof e&&(e=t.util.createBuffer(e)),s(e,e.length(),0,r)},r.toDer=function(e){var n=t.util.createBuffer(),a=e.tagClass|e.type,s=t.util.createBuffer(),i=!1;if("bitStringContents"in e&&(i=!0,e.original&&(i=r.equals(e,e.original))),i)s.putBytes(e.bitStringContents);else if(e.composed){e.constructed?a|=32:s.putByte(0);for(var u=0;u<e.value.length;++u)void 0!==e.value[u]&&s.putBuffer(r.toDer(e.value[u]))}else if(e.type===r.Type.BMPSTRING)for(u=0;u<e.value.length;++u)s.putInt16(e.value.charCodeAt(u));else e.type===r.Type.INTEGER&&e.value.length>1&&(0===e.value.charCodeAt(0)&&0==(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128==(128&e.value.charCodeAt(1)))?s.putBytes(e.value.substr(1)):s.putBytes(e.value);if(n.putByte(a),s.length()<=127)n.putByte(127&s.length());else{var o=s.length(),l="";do{l+=String.fromCharCode(255&o),o>>>=8}while(o>0);n.putByte(128|l.length);for(u=l.length-1;u>=0;--u)n.putByte(l.charCodeAt(u))}return n.putBuffer(s),n},r.oidToDer=function(e){var r,n,a,s,i=e.split("."),u=t.util.createBuffer();u.putByte(40*parseInt(i[0],10)+parseInt(i[1],10));for(var o=2;o<i.length;++o){r=!0,n=[],a=parseInt(i[o],10);do{s=127&a,a>>>=7,r||(s|=128),n.push(s),r=!1}while(a>0);for(var l=n.length-1;l>=0;--l)u.putByte(n[l])}return u},r.derToOid=function(e){var r;"string"==typeof e&&(e=t.util.createBuffer(e));var n=e.getByte();r=Math.floor(n/40)+"."+n%40;for(var a=0;e.length()>0;)a<<=7,128&(n=e.getByte())?a+=127&n:(r+="."+(a+n),a=0);return r},r.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(e.substr(2,2),10)-1,a=parseInt(e.substr(4,2),10),s=parseInt(e.substr(6,2),10),i=parseInt(e.substr(8,2),10),u=0;if(e.length>11){var o=e.charAt(10),l=10;"+"!==o&&"-"!==o&&(u=parseInt(e.substr(10,2),10),l+=2)}if(t.setUTCFullYear(r,n,a),t.setUTCHours(s,i,u,0),l&&("+"===(o=e.charAt(l))||"-"===o)){var p=60*parseInt(e.substr(l+1,2),10)+parseInt(e.substr(l+4,2),10);p*=6e4,"+"===o?t.setTime(+t-p):t.setTime(+t+p)}return t},r.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),n=parseInt(e.substr(4,2),10)-1,a=parseInt(e.substr(6,2),10),s=parseInt(e.substr(8,2),10),i=parseInt(e.substr(10,2),10),u=parseInt(e.substr(12,2),10),o=0,l=0,p=!1;"Z"===e.charAt(e.length-1)&&(p=!0);var c=e.length-5,g=e.charAt(c);"+"!==g&&"-"!==g||(l=60*parseInt(e.substr(c+1,2),10)+parseInt(e.substr(c+4,2),10),l*=6e4,"+"===g&&(l*=-1),p=!0);return"."===e.charAt(14)&&(o=1e3*parseFloat(e.substr(14),10)),p?(t.setUTCFullYear(r,n,a),t.setUTCHours(s,i,u,o),t.setTime(+t+l)):(t.setFullYear(r,n,a),t.setHours(s,i,u,o)),t},r.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(t+="0"),t+=r[n];return t+="Z"},r.dateToGeneralizedTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push(""+e.getUTCFullYear()),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(t+="0"),t+=r[n];return t+="Z"},r.integerToDer=function(e){var r=t.util.createBuffer();if(e>=-128&&e<128)return r.putSignedInt(e,8);if(e>=-32768&&e<32768)return r.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return r.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return r.putSignedInt(e,32);var n=new Error("Integer too large; max is 32-bits.");throw n.integer=e,n},r.derToInteger=function(e){"string"==typeof e&&(e=t.util.createBuffer(e));var r=8*e.length();if(r>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(r)},r.validate=function(e,n,a,s){var i=!1;if(e.tagClass!==n.tagClass&&void 0!==n.tagClass||e.type!==n.type&&void 0!==n.type)s&&(e.tagClass!==n.tagClass&&s.push("["+n.name+'] Expected tag class "'+n.tagClass+'", got "'+e.tagClass+'"'),e.type!==n.type&&s.push("["+n.name+'] Expected type "'+n.type+'", got "'+e.type+'"'));else if(e.constructed===n.constructed||void 0===n.constructed){if(i=!0,n.value&&t.util.isArray(n.value))for(var u=0,o=0;i&&o<n.value.length;++o)i=n.value[o].optional||!1,e.value[u]&&((i=r.validate(e.value[u],n.value[o],a,s))?++u:n.value[o].optional&&(i=!0)),!i&&s&&s.push("["+n.name+'] Tag class "'+n.tagClass+'", type "'+n.type+'" expected value length "'+n.value.length+'", got "'+e.value.length+'"');if(i&&a)if(n.capture&&(a[n.capture]=e.value),n.captureAsn1&&(a[n.captureAsn1]=e),n.captureBitStringContents&&"bitStringContents"in e&&(a[n.captureBitStringContents]=e.bitStringContents),n.captureBitStringValue&&"bitStringContents"in e)if(e.bitStringContents.length<2)a[n.captureBitStringValue]="";else{if(0!==e.bitStringContents.charCodeAt(0))throw new Error("captureBitStringValue only supported for zero unused bits");a[n.captureBitStringValue]=e.bitStringContents.slice(1)}}else s&&s.push("["+n.name+'] Expected constructed "'+n.constructed+'", got "'+e.constructed+'"');return i};var i=/[^\\u0000-\\u00ff]/;r.prettyPrint=function(e,n,a){var s="";a=a||2,(n=n||0)>0&&(s+="\n");for(var u="",o=0;o<n*a;++o)u+=" ";switch(s+=u+"Tag: ",e.tagClass){case r.Class.UNIVERSAL:s+="Universal:";break;case r.Class.APPLICATION:s+="Application:";break;case r.Class.CONTEXT_SPECIFIC:s+="Context-Specific:";break;case r.Class.PRIVATE:s+="Private:"}if(e.tagClass===r.Class.UNIVERSAL)switch(s+=e.type,e.type){case r.Type.NONE:s+=" (None)";break;case r.Type.BOOLEAN:s+=" (Boolean)";break;case r.Type.INTEGER:s+=" (Integer)";break;case r.Type.BITSTRING:s+=" (Bit string)";break;case r.Type.OCTETSTRING:s+=" (Octet string)";break;case r.Type.NULL:s+=" (Null)";break;case r.Type.OID:s+=" (Object Identifier)";break;case r.Type.ODESC:s+=" (Object Descriptor)";break;case r.Type.EXTERNAL:s+=" (External or Instance of)";break;case r.Type.REAL:s+=" (Real)";break;case r.Type.ENUMERATED:s+=" (Enumerated)";break;case r.Type.EMBEDDED:s+=" (Embedded PDV)";break;case r.Type.UTF8:s+=" (UTF8)";break;case r.Type.ROID:s+=" (Relative Object Identifier)";break;case r.Type.SEQUENCE:s+=" (Sequence)";break;case r.Type.SET:s+=" (Set)";break;case r.Type.PRINTABLESTRING:s+=" (Printable String)";break;case r.Type.IA5String:s+=" (IA5String (ASCII))";break;case r.Type.UTCTIME:s+=" (UTC time)";break;case r.Type.GENERALIZEDTIME:s+=" (Generalized time)";break;case r.Type.BMPSTRING:s+=" (BMP String)"}else s+=e.type;if(s+="\n",s+=u+"Constructed: "+e.constructed+"\n",e.composed){var l=0,p="";for(o=0;o<e.value.length;++o)void 0!==e.value[o]&&(l+=1,p+=r.prettyPrint(e.value[o],n+1,a),o+1<e.value.length&&(p+=","));s+=u+"Sub values: "+l+p}else{if(s+=u+"Value: ",e.type===r.Type.OID){var c=r.derToOid(e.value);s+=c,t.pki&&t.pki.oids&&c in t.pki.oids&&(s+=" ("+t.pki.oids[c]+") ")}if(e.type===r.Type.INTEGER)try{s+=r.derToInteger(e.value)}catch(T){s+="0x"+t.util.bytesToHex(e.value)}else if(e.type===r.Type.BITSTRING){if(e.value.length>1?s+="0x"+t.util.bytesToHex(e.value.slice(1)):s+="(none)",e.value.length>0){var g=e.value.charCodeAt(0);1==g?s+=" (1 unused bit shown)":g>1&&(s+=" ("+g+" unused bits shown)")}}else e.type===r.Type.OCTETSTRING?(i.test(e.value)||(s+="("+e.value+") "),s+="0x"+t.util.bytesToHex(e.value)):e.type===r.Type.UTF8?s+=t.util.decodeUtf8(e.value):e.type===r.Type.PRINTABLESTRING||e.type===r.Type.IA5String?s+=e.value:i.test(e.value)?s+="0x"+t.util.bytesToHex(e.value):0===e.value.length?s+="[null]":s+=e.value}return s};
|
||
},{"./forge":"sQ2N","./util":"2MJg","./oids":"F6JL"}],"/hw0":[function(require,module,exports) {
|
||
var t=require("./forge");require("./util"),module.exports=t.cipher=t.cipher||{},t.cipher.algorithms=t.cipher.algorithms||{},t.cipher.createCipher=function(i,e){var r=i;if("string"==typeof r&&(r=t.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+i);return new t.cipher.BlockCipher({algorithm:r,key:e,decrypt:!1})},t.cipher.createDecipher=function(i,e){var r=i;if("string"==typeof r&&(r=t.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+i);return new t.cipher.BlockCipher({algorithm:r,key:e,decrypt:!0})},t.cipher.registerAlgorithm=function(i,e){i=i.toUpperCase(),t.cipher.algorithms[i]=e},t.cipher.getAlgorithm=function(i){return(i=i.toUpperCase())in t.cipher.algorithms?t.cipher.algorithms[i]:null};var i=t.cipher.BlockCipher=function(t){this.algorithm=t.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=t.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=t.decrypt,this.algorithm.initialize(t)};i.prototype.start=function(i){i=i||{};var e={};for(var r in i)e[r]=i[r];e.decrypt=this._decrypt,this._finish=!1,this._input=t.util.createBuffer(),this.output=i.output||t.util.createBuffer(),this.mode.start(e)},i.prototype.update=function(t){for(t&&this._input.putBuffer(t);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},i.prototype.finish=function(t){!t||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(i){return t(this.blockSize,i,!1)},this.mode.unpad=function(i){return t(this.blockSize,i,!0)});var i={};return i.decrypt=this._decrypt,i.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,i))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,i))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,i)))};
|
||
},{"./forge":"sQ2N","./util":"2MJg"}],"3Q1z":[function(require,module,exports) {
|
||
var t=require("./forge");require("./util"),t.cipher=t.cipher||{};var i=module.exports=t.cipher.modes=t.cipher.modes||{};function s(i,s){if("string"==typeof i&&(i=t.util.createBuffer(i)),t.util.isArray(i)&&i.length>4){var e=i;i=t.util.createBuffer();for(var h=0;h<e.length;++h)i.putByte(e[h])}if(i.length()<s)throw new Error("Invalid IV length; got "+i.length()+" bytes and expected "+s+" bytes.");if(!t.util.isArray(i)){var r=[],o=s/4;for(h=0;h<o;++h)r.push(i.getInt32());i=r}return i}function e(t){t[t.length-1]=t[t.length-1]+1&4294967295}function h(t){return[t/4294967296|0,4294967295&t]}i.ecb=function(t){t=t||{},this.name="ECB",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},i.ecb.prototype.start=function(t){},i.ecb.prototype.encrypt=function(t,i,s){if(t.length()<this.blockSize&&!(s&&t.length()>0))return!0;for(var e=0;e<this._ints;++e)this._inBlock[e]=t.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(e=0;e<this._ints;++e)i.putInt32(this._outBlock[e])},i.ecb.prototype.decrypt=function(t,i,s){if(t.length()<this.blockSize&&!(s&&t.length()>0))return!0;for(var e=0;e<this._ints;++e)this._inBlock[e]=t.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(e=0;e<this._ints;++e)i.putInt32(this._outBlock[e])},i.ecb.prototype.pad=function(t,i){var s=t.length()===this.blockSize?this.blockSize:this.blockSize-t.length();return t.fillWithByte(s,s),!0},i.ecb.prototype.unpad=function(t,i){if(i.overflow>0)return!1;var s=t.length(),e=t.at(s-1);return!(e>this.blockSize<<2)&&(t.truncate(e),!0)},i.cbc=function(t){t=t||{},this.name="CBC",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},i.cbc.prototype.start=function(t){if(null===t.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=s(t.iv,this.blockSize),this._prev=this._iv.slice(0)}},i.cbc.prototype.encrypt=function(t,i,s){if(t.length()<this.blockSize&&!(s&&t.length()>0))return!0;for(var e=0;e<this._ints;++e)this._inBlock[e]=this._prev[e]^t.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(e=0;e<this._ints;++e)i.putInt32(this._outBlock[e]);this._prev=this._outBlock},i.cbc.prototype.decrypt=function(t,i,s){if(t.length()<this.blockSize&&!(s&&t.length()>0))return!0;for(var e=0;e<this._ints;++e)this._inBlock[e]=t.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(e=0;e<this._ints;++e)i.putInt32(this._prev[e]^this._outBlock[e]);this._prev=this._inBlock.slice(0)},i.cbc.prototype.pad=function(t,i){var s=t.length()===this.blockSize?this.blockSize:this.blockSize-t.length();return t.fillWithByte(s,s),!0},i.cbc.prototype.unpad=function(t,i){if(i.overflow>0)return!1;var s=t.length(),e=t.at(s-1);return!(e>this.blockSize<<2)&&(t.truncate(e),!0)},i.cfb=function(i){i=i||{},this.name="CFB",this.cipher=i.cipher,this.blockSize=i.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=t.util.createBuffer(),this._partialBytes=0},i.cfb.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=s(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.cfb.prototype.encrypt=function(t,i,s){var e=t.length();if(0===e)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&e>=this.blockSize)for(var h=0;h<this._ints;++h)this._inBlock[h]=t.getInt32()^this._outBlock[h],i.putInt32(this._inBlock[h]);else{var r=(this.blockSize-e)%this.blockSize;r>0&&(r=this.blockSize-r),this._partialOutput.clear();for(h=0;h<this._ints;++h)this._partialBlock[h]=t.getInt32()^this._outBlock[h],this._partialOutput.putInt32(this._partialBlock[h]);if(r>0)t.read-=this.blockSize;else for(h=0;h<this._ints;++h)this._inBlock[h]=this._partialBlock[h];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),r>0&&!s)return i.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=r,!0;i.putBytes(this._partialOutput.getBytes(e-this._partialBytes)),this._partialBytes=0}},i.cfb.prototype.decrypt=function(t,i,s){var e=t.length();if(0===e)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&e>=this.blockSize)for(var h=0;h<this._ints;++h)this._inBlock[h]=t.getInt32(),i.putInt32(this._inBlock[h]^this._outBlock[h]);else{var r=(this.blockSize-e)%this.blockSize;r>0&&(r=this.blockSize-r),this._partialOutput.clear();for(h=0;h<this._ints;++h)this._partialBlock[h]=t.getInt32(),this._partialOutput.putInt32(this._partialBlock[h]^this._outBlock[h]);if(r>0)t.read-=this.blockSize;else for(h=0;h<this._ints;++h)this._inBlock[h]=this._partialBlock[h];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),r>0&&!s)return i.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=r,!0;i.putBytes(this._partialOutput.getBytes(e-this._partialBytes)),this._partialBytes=0}},i.ofb=function(i){i=i||{},this.name="OFB",this.cipher=i.cipher,this.blockSize=i.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=t.util.createBuffer(),this._partialBytes=0},i.ofb.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=s(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ofb.prototype.encrypt=function(t,i,s){var e=t.length();if(0===t.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&e>=this.blockSize)for(var h=0;h<this._ints;++h)i.putInt32(t.getInt32()^this._outBlock[h]),this._inBlock[h]=this._outBlock[h];else{var r=(this.blockSize-e)%this.blockSize;r>0&&(r=this.blockSize-r),this._partialOutput.clear();for(h=0;h<this._ints;++h)this._partialOutput.putInt32(t.getInt32()^this._outBlock[h]);if(r>0)t.read-=this.blockSize;else for(h=0;h<this._ints;++h)this._inBlock[h]=this._outBlock[h];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),r>0&&!s)return i.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=r,!0;i.putBytes(this._partialOutput.getBytes(e-this._partialBytes)),this._partialBytes=0}},i.ofb.prototype.decrypt=i.ofb.prototype.encrypt,i.ctr=function(i){i=i||{},this.name="CTR",this.cipher=i.cipher,this.blockSize=i.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=t.util.createBuffer(),this._partialBytes=0},i.ctr.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=s(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ctr.prototype.encrypt=function(t,i,s){var h=t.length();if(0===h)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&h>=this.blockSize)for(var r=0;r<this._ints;++r)i.putInt32(t.getInt32()^this._outBlock[r]);else{var o=(this.blockSize-h)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(r=0;r<this._ints;++r)this._partialOutput.putInt32(t.getInt32()^this._outBlock[r]);if(o>0&&(t.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!s)return i.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;i.putBytes(this._partialOutput.getBytes(h-this._partialBytes)),this._partialBytes=0}e(this._inBlock)},i.ctr.prototype.decrypt=i.ctr.prototype.encrypt,i.gcm=function(i){i=i||{},this.name="GCM",this.cipher=i.cipher,this.blockSize=i.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=t.util.createBuffer(),this._partialBytes=0,this._R=3774873600},i.gcm.prototype.start=function(i){if(!("iv"in i))throw new Error("Invalid IV parameter.");var s,r=t.util.createBuffer(i.iv);if(this._cipherLength=0,s="additionalData"in i?t.util.createBuffer(i.additionalData):t.util.createBuffer(),this._tagLength="tagLength"in i?i.tagLength:128,this._tag=null,i.decrypt&&(this._tag=t.util.createBuffer(i.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var o=r.length();if(12===o)this._j0=[r.getInt32(),r.getInt32(),r.getInt32(),1];else{for(this._j0=[0,0,0,0];r.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(h(8*o)))}this._inBlock=this._j0.slice(0),e(this._inBlock),this._partialBytes=0,s=t.util.createBuffer(s),this._aDataLength=h(8*s.length());var a=s.length()%this.blockSize;for(a&&s.fillWithByte(0,this.blockSize-a),this._s=[0,0,0,0];s.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[s.getInt32(),s.getInt32(),s.getInt32(),s.getInt32()])},i.gcm.prototype.encrypt=function(t,i,s){var h=t.length();if(0===h)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&h>=this.blockSize){for(var r=0;r<this._ints;++r)i.putInt32(this._outBlock[r]^=t.getInt32());this._cipherLength+=this.blockSize}else{var o=(this.blockSize-h)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(r=0;r<this._ints;++r)this._partialOutput.putInt32(t.getInt32()^this._outBlock[r]);if(o<=0||s){if(s){var a=h%this.blockSize;this._cipherLength+=a,this._partialOutput.truncate(this.blockSize-a)}else this._cipherLength+=this.blockSize;for(r=0;r<this._ints;++r)this._outBlock[r]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!s)return t.read-=this.blockSize,i.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;i.putBytes(this._partialOutput.getBytes(h-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),e(this._inBlock)},i.gcm.prototype.decrypt=function(t,i,s){var h=t.length();if(h<this.blockSize&&!(s&&h>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),e(this._inBlock),this._hashBlock[0]=t.getInt32(),this._hashBlock[1]=t.getInt32(),this._hashBlock[2]=t.getInt32(),this._hashBlock[3]=t.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var r=0;r<this._ints;++r)i.putInt32(this._outBlock[r]^this._hashBlock[r]);h<this.blockSize?this._cipherLength+=h%this.blockSize:this._cipherLength+=this.blockSize},i.gcm.prototype.afterFinish=function(i,s){var e=!0;s.decrypt&&s.overflow&&i.truncate(this.blockSize-s.overflow),this.tag=t.util.createBuffer();var r=this._aDataLength.concat(h(8*this._cipherLength));this._s=this.ghash(this._hashSubkey,this._s,r);var o=[];this.cipher.encrypt(this._j0,o);for(var a=0;a<this._ints;++a)this.tag.putInt32(this._s[a]^o[a]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),s.decrypt&&this.tag.bytes()!==this._tag&&(e=!1),e},i.gcm.prototype.multiply=function(t,i){for(var s=[0,0,0,0],e=i.slice(0),h=0;h<128;++h){t[h/32|0]&1<<31-h%32&&(s[0]^=e[0],s[1]^=e[1],s[2]^=e[2],s[3]^=e[3]),this.pow(e,e)}return s},i.gcm.prototype.pow=function(t,i){for(var s=1&t[3],e=3;e>0;--e)i[e]=t[e]>>>1|(1&t[e-1])<<31;i[0]=t[0]>>>1,s&&(i[0]^=this._R)},i.gcm.prototype.tableMultiply=function(t){for(var i=[0,0,0,0],s=0;s<32;++s){var e=t[s/8|0]>>>4*(7-s%8)&15,h=this._m[s][e];i[0]^=h[0],i[1]^=h[1],i[2]^=h[2],i[3]^=h[3]}return i},i.gcm.prototype.ghash=function(t,i,s){return i[0]^=s[0],i[1]^=s[1],i[2]^=s[2],i[3]^=s[3],this.tableMultiply(i)},i.gcm.prototype.generateHashTable=function(t,i){for(var s=8/i,e=4*s,h=16*s,r=new Array(h),o=0;o<h;++o){var a=[0,0,0,0],n=(e-1-o%e)*i;a[o/e|0]=1<<i-1<<n,r[o]=this.generateSubHashTable(this.multiply(a,t),i)}return r},i.gcm.prototype.generateSubHashTable=function(t,i){var s=1<<i,e=s>>>1,h=new Array(s);h[e]=t.slice(0);for(var r=e>>>1;r>0;)this.pow(h[2*r],h[r]=[]),r>>=1;for(r=2;r<e;){for(var o=1;o<r;++o){var a=h[r],n=h[o];h[r+o]=[a[0]^n[0],a[1]^n[1],a[2]^n[2],a[3]^n[3]]}r*=2}for(h[0]=[0,0,0,0],r=e+1;r<s;++r){var l=h[r^e];h[r]=[t[0]^l[0],t[1]^l[1],t[2]^l[2],t[3]^l[3]]}return h};
|
||
},{"./forge":"sQ2N","./util":"2MJg"}],"bEBs":[function(require,module,exports) {
|
||
var e=require("./forge");function r(r,t){e.cipher.registerAlgorithm(r,function(){return new e.aes.Algorithm(r,t)})}require("./cipher"),require("./cipherModes"),require("./util"),module.exports=e.aes=e.aes||{},e.aes.startEncrypting=function(e,r,t,n){var i=s({key:e,output:t,decrypt:!1,mode:n});return i.start(r),i},e.aes.createEncryptionCipher=function(e,r){return s({key:e,output:null,decrypt:!1,mode:r})},e.aes.startDecrypting=function(e,r,t,n){var i=s({key:e,output:t,decrypt:!0,mode:n});return i.start(r),i},e.aes.createDecryptionCipher=function(e,r){return s({key:e,output:null,decrypt:!0,mode:r})},e.aes.Algorithm=function(e,r){c||f();var t=this;t.name=e,t.mode=new r({blockSize:16,cipher:{encrypt:function(e,r){return l(t._w,e,r,!1)},decrypt:function(e,r){return l(t._w,e,r,!0)}}}),t._init=!1},e.aes.Algorithm.prototype.initialize=function(r){if(!this._init){var t,n=r.key;if("string"!=typeof n||16!==n.length&&24!==n.length&&32!==n.length){if(e.util.isArray(n)&&(16===n.length||24===n.length||32===n.length)){t=n,n=e.util.createBuffer();for(var i=0;i<t.length;++i)n.putByte(t[i])}}else n=e.util.createBuffer(n);if(!e.util.isArray(n)){t=n,n=[];var o=t.length();if(16===o||24===o||32===o){o>>>=2;for(i=0;i<o;++i)n.push(t.getInt32())}}if(!e.util.isArray(n)||4!==n.length&&6!==n.length&&8!==n.length)throw new Error("Invalid key parameter.");var a=this.mode.name,c=-1!==["CFB","OFB","CTR","GCM"].indexOf(a);this._w=p(n,r.decrypt&&!c),this._init=!0}},e.aes._expandKey=function(e,r){return c||f(),p(e,r)},e.aes._updateBlock=l,r("AES-ECB",e.cipher.modes.ecb),r("AES-CBC",e.cipher.modes.cbc),r("AES-CFB",e.cipher.modes.cfb),r("AES-OFB",e.cipher.modes.ofb),r("AES-CTR",e.cipher.modes.ctr),r("AES-GCM",e.cipher.modes.gcm);var t,n,i,o,a,c=!1,u=4;function f(){c=!0,i=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),r=0;r<128;++r)e[r]=r<<1,e[r+128]=r+128<<1^283;t=new Array(256),n=new Array(256),o=new Array(4),a=new Array(4);for(r=0;r<4;++r)o[r]=new Array(256),a[r]=new Array(256);var u,f,p,l,s,h,y,d=0,g=0;for(r=0;r<256;++r){l=(l=g^g<<1^g<<2^g<<3^g<<4)>>8^255&l^99,t[d]=l,n[l]=d,h=(s=e[l])<<24^l<<16^l<<8^l^s,y=((u=e[d])^(f=e[u])^(p=e[f]))<<24^(d^p)<<16^(d^f^p)<<8^d^u^p;for(var m=0;m<4;++m)o[m][d]=h,a[m][l]=y,h=h<<24|h>>>8,y=y<<24|y>>>8;0===d?d=g=1:(d=u^e[e[e[u^p]]],g^=e[e[g]])}}function p(e,r){for(var n,o=e.slice(0),c=1,f=o.length,p=u*(f+6+1),l=f;l<p;++l)n=o[l-1],l%f==0?(n=t[n>>>16&255]<<24^t[n>>>8&255]<<16^t[255&n]<<8^t[n>>>24]^i[c]<<24,c++):f>6&&l%f==4&&(n=t[n>>>24]<<24^t[n>>>16&255]<<16^t[n>>>8&255]<<8^t[255&n]),o[l]=o[l-f]^n;if(r){for(var s,h=a[0],y=a[1],d=a[2],g=a[3],m=o.slice(0),v=(l=0,(p=o.length)-u);l<p;l+=u,v-=u)if(0===l||l===p-u)m[l]=o[v],m[l+1]=o[v+3],m[l+2]=o[v+2],m[l+3]=o[v+1];else for(var A=0;A<u;++A)s=o[v+A],m[l+(3&-A)]=h[t[s>>>24]]^y[t[s>>>16&255]]^d[t[s>>>8&255]]^g[t[255&s]];o=m}return o}function l(e,r,i,c){var u,f,p,l,s,h,y,d,g,m,v,A,C=e.length/4-1;c?(u=a[0],f=a[1],p=a[2],l=a[3],s=n):(u=o[0],f=o[1],p=o[2],l=o[3],s=t),h=r[0]^e[0],y=r[c?3:1]^e[1],d=r[2]^e[2],g=r[c?1:3]^e[3];for(var w=3,B=1;B<C;++B)m=u[h>>>24]^f[y>>>16&255]^p[d>>>8&255]^l[255&g]^e[++w],v=u[y>>>24]^f[d>>>16&255]^p[g>>>8&255]^l[255&h]^e[++w],A=u[d>>>24]^f[g>>>16&255]^p[h>>>8&255]^l[255&y]^e[++w],g=u[g>>>24]^f[h>>>16&255]^p[y>>>8&255]^l[255&d]^e[++w],h=m,y=v,d=A;i[0]=s[h>>>24]<<24^s[y>>>16&255]<<16^s[d>>>8&255]<<8^s[255&g]^e[++w],i[c?3:1]=s[y>>>24]<<24^s[d>>>16&255]<<16^s[g>>>8&255]<<8^s[255&h]^e[++w],i[2]=s[d>>>24]<<24^s[g>>>16&255]<<16^s[h>>>8&255]<<8^s[255&y]^e[++w],i[c?1:3]=s[g>>>24]<<24^s[h>>>16&255]<<16^s[y>>>8&255]<<8^s[255&d]^e[++w]}function s(r){var t,n="AES-"+((r=r||{}).mode||"CBC").toUpperCase(),i=(t=r.decrypt?e.cipher.createDecipher(n,r.key):e.cipher.createCipher(n,r.key)).start;return t.start=function(r,n){var o=null;n instanceof e.util.ByteBuffer&&(o=n,n={}),(n=n||{}).output=o,n.iv=r,i.call(t,n)},t}
|
||
},{"./forge":"sQ2N","./cipher":"/hw0","./cipherModes":"3Q1z","./util":"2MJg"}],"ZV7X":[function(require,module,exports) {
|
||
var e=require("./forge");function r(r,t){e.cipher.registerAlgorithm(r,function(){return new e.des.Algorithm(r,t)})}require("./cipher"),require("./cipherModes"),require("./util"),module.exports=e.des=e.des||{},e.des.startEncrypting=function(e,r,t,i){var n=h({key:e,output:t,decrypt:!1,mode:i||(null===r?"ECB":"CBC")});return n.start(r),n},e.des.createEncryptionCipher=function(e,r){return h({key:e,output:null,decrypt:!1,mode:r})},e.des.startDecrypting=function(e,r,t,i){var n=h({key:e,output:t,decrypt:!0,mode:i||(null===r?"ECB":"CBC")});return n.start(r),n},e.des.createDecryptionCipher=function(e,r){return h({key:e,output:null,decrypt:!0,mode:r})},e.des.Algorithm=function(e,r){var t=this;t.name=e,t.mode=new r({blockSize:8,cipher:{encrypt:function(e,r){return d(t._keys,e,r,!1)},decrypt:function(e,r){return d(t._keys,e,r,!0)}}}),t._init=!1},e.des.Algorithm.prototype.initialize=function(r){if(!this._init){var t=e.util.createBuffer(r.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=a(t),this._init=!0}},r("DES-ECB",e.cipher.modes.ecb),r("DES-CBC",e.cipher.modes.cbc),r("DES-CFB",e.cipher.modes.cfb),r("DES-OFB",e.cipher.modes.ofb),r("DES-CTR",e.cipher.modes.ctr),r("3DES-ECB",e.cipher.modes.ecb),r("3DES-CBC",e.cipher.modes.cbc),r("3DES-CFB",e.cipher.modes.cfb),r("3DES-OFB",e.cipher.modes.ofb),r("3DES-CTR",e.cipher.modes.ctr);var t=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],i=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],n=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],c=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],o=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],u=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],p=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],s=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function a(e){for(var r,t=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],i=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],n=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],c=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],o=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],u=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],p=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],s=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],a=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],d=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],h=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],f=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],l=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],y=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],m=e.length()>8?3:1,C=[],E=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],v=0,B=0;B<m;B++){var D=e.getInt32(),g=e.getInt32();D^=(r=252645135&(D>>>4^g))<<4,D^=r=65535&((g^=r)>>>-16^D),D^=(r=858993459&(D>>>2^(g^=r<<-16)))<<2,D^=r=65535&((g^=r)>>>-16^D),D^=(r=1431655765&(D>>>1^(g^=r<<-16)))<<1,D^=r=16711935&((g^=r)>>>8^D),r=(D^=(r=1431655765&(D>>>1^(g^=r<<8)))<<1)<<8|(g^=r)>>>20&240,D=g<<24|g<<8&16711680|g>>>8&65280|g>>>24&240,g=r;for(var S=0;S<E.length;++S){E[S]?(D=D<<2|D>>>26,g=g<<2|g>>>26):(D=D<<1|D>>>27,g=g<<1|g>>>27);var k=t[(D&=-15)>>>28]|i[D>>>24&15]|n[D>>>20&15]|c[D>>>16&15]|o[D>>>12&15]|u[D>>>8&15]|p[D>>>4&15],b=s[(g&=-15)>>>28]|a[g>>>24&15]|d[g>>>20&15]|h[g>>>16&15]|f[g>>>12&15]|l[g>>>8&15]|y[g>>>4&15];r=65535&(b>>>16^k),C[v++]=k^r,C[v++]=b^r<<16}}return C}function d(e,r,a,d){var h,f,l=32===e.length?3:9;h=3===l?d?[30,-2,-2]:[0,32,2]:d?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var y=r[0],m=r[1];y^=(f=252645135&(y>>>4^m))<<4,y^=(f=65535&(y>>>16^(m^=f)))<<16,y^=f=858993459&((m^=f)>>>2^y),y^=f=16711935&((m^=f<<2)>>>8^y),y=(y^=(f=1431655765&(y>>>1^(m^=f<<8)))<<1)<<1|y>>>31,m=(m^=f)<<1|m>>>31;for(var C=0;C<l;C+=3){for(var E=h[C+1],v=h[C+2],B=h[C];B!=E;B+=v){var D=m^e[B],g=(m>>>4|m<<28)^e[B+1];f=y,y=m,m=f^(i[D>>>24&63]|c[D>>>16&63]|u[D>>>8&63]|s[63&D]|t[g>>>24&63]|n[g>>>16&63]|o[g>>>8&63]|p[63&g])}f=y,y=m,m=f}m=m>>>1|m<<31,m^=f=1431655765&((y=y>>>1|y<<31)>>>1^m),m^=(f=16711935&(m>>>8^(y^=f<<1)))<<8,m^=(f=858993459&(m>>>2^(y^=f)))<<2,m^=f=65535&((y^=f)>>>16^m),m^=f=252645135&((y^=f<<16)>>>4^m),y^=f<<4,a[0]=y,a[1]=m}function h(r){var t,i="DES-"+((r=r||{}).mode||"CBC").toUpperCase(),n=(t=r.decrypt?e.cipher.createDecipher(i,r.key):e.cipher.createCipher(i,r.key)).start;return t.start=function(r,i){var c=null;i instanceof e.util.ByteBuffer&&(c=i,i={}),(i=i||{}).output=c,i.iv=r,n.call(t,i)},t}
|
||
},{"./forge":"sQ2N","./cipher":"/hw0","./cipherModes":"3Q1z","./util":"2MJg"}],"2EAk":[function(require,module,exports) {
|
||
var m=require("./forge");module.exports=m.md=m.md||{},m.md.algorithms=m.md.algorithms||{};
|
||
},{"./forge":"sQ2N"}],"U3ou":[function(require,module,exports) {
|
||
var t=require("./forge");require("./md"),require("./util");var e=module.exports=t.hmac=t.hmac||{};e.create=function(){var e=null,r=null,u=null,a=null,i={start:function(i,l){if(null!==i)if("string"==typeof i){if(!((i=i.toLowerCase())in t.md.algorithms))throw new Error('Unknown hash algorithm "'+i+'"');r=t.md.algorithms[i].create()}else r=i;if(null===l)l=e;else{if("string"==typeof l)l=t.util.createBuffer(l);else if(t.util.isArray(l)){var n=l;l=t.util.createBuffer();for(var f=0;f<n.length;++f)l.putByte(n[f])}var o=l.length();o>r.blockLength&&(r.start(),r.update(l.bytes()),l=r.digest()),u=t.util.createBuffer(),a=t.util.createBuffer(),o=l.length();for(f=0;f<o;++f){n=l.at(f);u.putByte(54^n),a.putByte(92^n)}if(o<r.blockLength)for(n=r.blockLength-o,f=0;f<n;++f)u.putByte(54),a.putByte(92);e=l,u=u.bytes(),a=a.bytes()}r.start(),r.update(u)},update:function(t){r.update(t)},getMac:function(){var t=r.digest().bytes();return r.start(),r.update(a),r.update(t),r.digest()}};return i.digest=i.getMac,i};
|
||
},{"./forge":"sQ2N","./md":"2EAk","./util":"2MJg"}],"3jih":[function(require,module,exports) {
|
||
var Buffer = require("buffer").Buffer;
|
||
var t=require("buffer").Buffer;function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var e=require("./forge");require("./hmac"),require("./md"),require("./util");var n,i=e.pkcs5=e.pkcs5||{};e.util.isNodejs&&!e.options.usePureJavaScript&&(n=require("crypto")),module.exports=e.pbkdf2=i.pbkdf2=function(i,u,o,l,f,s){if("function"==typeof f&&(s=f,f=null),e.util.isNodejs&&!e.options.usePureJavaScript&&n.pbkdf2&&(null===f||"object"!==r(f))&&(n.pbkdf2Sync.length>4||!f||"sha1"===f))return"string"!=typeof f&&(f="sha1"),i=t.from(i,"binary"),u=t.from(u,"binary"),s?4===n.pbkdf2Sync.length?n.pbkdf2(i,u,o,l,function(t,r){if(t)return s(t);s(null,r.toString("binary"))}):n.pbkdf2(i,u,o,l,f,function(t,r){if(t)return s(t);s(null,r.toString("binary"))}):4===n.pbkdf2Sync.length?n.pbkdf2Sync(i,u,o,l).toString("binary"):n.pbkdf2Sync(i,u,o,l,f).toString("binary");if(null==f&&(f="sha1"),"string"==typeof f){if(!(f in e.md.algorithms))throw new Error("Unknown hash algorithm: "+f);f=e.md[f].create()}var a=f.digestLength;if(l>4294967295*a){var y=new Error("Derived key is too long.");if(s)return s(y);throw y}var p=Math.ceil(l/a),c=l-(p-1)*a,d=e.hmac.create();d.start(f,i);var b,g,m,h="";if(!s){for(var S=1;S<=p;++S){d.start(null,null),d.update(u),d.update(e.util.int32ToBytes(S)),b=m=d.digest().getBytes();for(var k=2;k<=o;++k)d.start(null,null),d.update(m),g=d.digest().getBytes(),b=e.util.xorBytes(b,g,a),m=g;h+=S<p?b:b.substr(0,c)}return h}S=1;function v(){if(S>p)return s(null,h);d.start(null,null),d.update(u),d.update(e.util.int32ToBytes(S)),b=m=d.digest().getBytes(),k=2,B()}function B(){if(k<=o)return d.start(null,null),d.update(m),g=d.digest().getBytes(),b=e.util.xorBytes(b,g,a),m=g,++k,e.util.setImmediate(B);h+=S<p?b:b.substr(0,c),++S,v()}v()};
|
||
},{"./forge":"sQ2N","./hmac":"U3ou","./md":"2EAk","./util":"2MJg","crypto":"sC8V","buffer":"sC8V"}],"aepW":[function(require,module,exports) {
|
||
var e=require("./forge");require("./util");var r=module.exports=e.pem=e.pem||{};function n(e){for(var r=e.name+": ",n=[],a=function(e,r){return" "+r},t=0;t<e.values.length;++t)n.push(e.values[t].replace(/^(\S+\r\n)/,a));r+=n.join(",")+"\r\n";var o=0,s=-1;for(t=0;t<r.length;++t,++o)if(o>65&&-1!==s){var l=r[s];","===l?(++s,r=r.substr(0,s)+"\r\n "+r.substr(s)):r=r.substr(0,s)+"\r\n"+l+r.substr(s+1),o=t-s-1,s=-1,++t}else" "!==r[t]&&"\t"!==r[t]&&","!==r[t]||(s=t);return r}function a(e){return e.replace(/^\s+/,"")}r.encode=function(r,a){a=a||{};var t,o="-----BEGIN "+r.type+"-----\r\n";if(r.procType&&(o+=n(t={name:"Proc-Type",values:[String(r.procType.version),r.procType.type]})),r.contentDomain&&(o+=n(t={name:"Content-Domain",values:[r.contentDomain]})),r.dekInfo&&(t={name:"DEK-Info",values:[r.dekInfo.algorithm]},r.dekInfo.parameters&&t.values.push(r.dekInfo.parameters),o+=n(t)),r.headers)for(var s=0;s<r.headers.length;++s)o+=n(r.headers[s]);return r.procType&&(o+="\r\n"),o+=e.util.encode64(r.body,a.maxline||64)+"\r\n",o+="-----END "+r.type+"-----\r\n"},r.decode=function(r){for(var n,t=[],o=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,s=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,l=/\r?\n/;n=o.exec(r);){var i={type:n[1],procType:null,contentDomain:null,dekInfo:null,headers:[],body:e.util.decode64(n[3])};if(t.push(i),n[2]){for(var f=n[2].split(l),u=0;n&&u<f.length;){for(var p=f[u].replace(/\s+$/,""),d=u+1;d<f.length;++d){var m=f[d];if(!/\s/.test(m[0]))break;p+=m,u=d}if(n=p.match(s)){for(var h={name:n[1],values:[]},c=n[2].split(","),v=0;v<c.length;++v)h.values.push(a(c[v]));if(i.procType)if(i.contentDomain||"Content-Domain"!==h.name)if(i.dekInfo||"DEK-Info"!==h.name)i.headers.push(h);else{if(0===h.values.length)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');i.dekInfo={algorithm:c[0],parameters:c[1]||null}}else i.contentDomain=c[0]||"";else{if("Proc-Type"!==h.name)throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==h.values.length)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');i.procType={version:c[0],type:c[1]}}}++u}if("ENCRYPTED"===i.procType&&!i.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(0===t.length)throw new Error("Invalid PEM formatted message.");return t};
|
||
},{"./forge":"sQ2N","./util":"2MJg"}],"v5kO":[function(require,module,exports) {
|
||
var e=require("./forge");require("./md"),require("./util");var t=module.exports=e.sha256=e.sha256||{};e.md.sha256=e.md.algorithms.sha256=t,t.create=function(){n||g();var t=null,r=e.util.createBuffer(),s=new Array(64),l={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){l.messageLength=0,l.fullMessageLength=l.messageLength64=[];for(var h=l.messageLengthSize/4,n=0;n<h;++n)l.fullMessageLength.push(0);return r=e.util.createBuffer(),t={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},l}};return l.start(),l.update=function(h,n){"utf8"===n&&(h=e.util.encodeUtf8(h));var g=h.length;l.messageLength+=g,g=[g/4294967296>>>0,g>>>0];for(var a=l.fullMessageLength.length-1;a>=0;--a)l.fullMessageLength[a]+=g[1],g[1]=g[0]+(l.fullMessageLength[a]/4294967296>>>0),l.fullMessageLength[a]=l.fullMessageLength[a]>>>0,g[0]=g[1]/4294967296>>>0;return r.putBytes(h),u(t,s,r),(r.read>2048||0===r.length())&&r.compact(),l},l.digest=function(){var n=e.util.createBuffer();n.putBytes(r.bytes());var g,a=l.fullMessageLength[l.fullMessageLength.length-1]+l.messageLengthSize&l.blockLength-1;n.putBytes(h.substr(0,l.blockLength-a));for(var f=8*l.fullMessageLength[0],i=0;i<l.fullMessageLength.length-1;++i)f+=(g=8*l.fullMessageLength[i+1])/4294967296>>>0,n.putInt32(f>>>0),f=g>>>0;n.putInt32(f);var o={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4,h5:t.h5,h6:t.h6,h7:t.h7};u(o,s,n);var L=e.util.createBuffer();return L.putInt32(o.h0),L.putInt32(o.h1),L.putInt32(o.h2),L.putInt32(o.h3),L.putInt32(o.h4),L.putInt32(o.h5),L.putInt32(o.h6),L.putInt32(o.h7),L},l};var h=null,n=!1,r=null;function g(){h=String.fromCharCode(128),h+=e.util.fillString(String.fromCharCode(0),64),r=[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],n=!0}function u(e,t,h){for(var n,g,u,s,l,a,f,i,o,L,c,p,m,v=h.length();v>=64;){for(l=0;l<16;++l)t[l]=h.getInt32();for(;l<64;++l)n=((n=t[l-2])>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,g=((g=t[l-15])>>>7|g<<25)^(g>>>18|g<<14)^g>>>3,t[l]=n+t[l-7]+g+t[l-16]|0;for(a=e.h0,f=e.h1,i=e.h2,o=e.h3,L=e.h4,c=e.h5,p=e.h6,m=e.h7,l=0;l<64;++l)u=(a>>>2|a<<30)^(a>>>13|a<<19)^(a>>>22|a<<10),s=a&f|i&(a^f),n=m+((L>>>6|L<<26)^(L>>>11|L<<21)^(L>>>25|L<<7))+(p^L&(c^p))+r[l]+t[l],m=p,p=c,c=L,L=o+n>>>0,o=i,i=f,f=a,a=n+(g=u+s)>>>0;e.h0=e.h0+a|0,e.h1=e.h1+f|0,e.h2=e.h2+i|0,e.h3=e.h3+o|0,e.h4=e.h4+L|0,e.h5=e.h5+c|0,e.h6=e.h6+p|0,e.h7=e.h7+m|0,v-=64}}
|
||
},{"./forge":"sQ2N","./md":"2EAk","./util":"2MJg"}],"q1OX":[function(require,module,exports) {
|
||
var process = require("process");
|
||
var e=require("process"),t=require("./forge");require("./util");var r=null;!t.util.isNodejs||t.options.usePureJavaScript||e.versions["node-webkit"]||(r=require("crypto"));var n=module.exports=t.prng=t.prng||{};n.create=function(e){for(var n={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},o=e.md,s=new Array(32),l=0;l<32;++l)s[l]=o.create();function a(){if(n.pools[0].messageLength>=32)return i();var e=32-n.pools[0].messageLength<<5;n.collect(n.seedFileSync(e)),i()}function i(){n.reseeds=4294967295===n.reseeds?0:n.reseeds+1;var e=n.plugin.md.create();e.update(n.keyBytes);for(var t=1,r=0;r<32;++r)n.reseeds%t==0&&(e.update(n.pools[r].digest().getBytes()),n.pools[r].start()),t<<=1;n.keyBytes=e.digest().getBytes(),e.start(),e.update(n.keyBytes);var o=e.digest().getBytes();n.key=n.plugin.formatKey(n.keyBytes),n.seed=n.plugin.formatSeed(o),n.generated=0}function u(e){var r=null,n=t.util.globalScope,o=n.crypto||n.msCrypto;o&&o.getRandomValues&&(r=function(e){return o.getRandomValues(e)});var s=t.util.createBuffer();if(r)for(;s.length()<e;){var l=Math.max(1,Math.min(e-s.length(),65536)/4),a=new Uint32Array(Math.floor(l));try{r(a);for(var i=0;i<a.length;++i)s.putInt32(a[i])}catch(c){if(!("undefined"!=typeof QuotaExceededError&&c instanceof QuotaExceededError))throw c}}if(s.length()<e)for(var u,g,f,d=Math.floor(65536*Math.random());s.length()<e;){g=16807*(65535&d),g+=(32767&(u=16807*(d>>16)))<<16,d=4294967295&(g=(2147483647&(g+=u>>15))+(g>>31));for(i=0;i<3;++i)f=d>>>(i<<3),f^=Math.floor(256*Math.random()),s.putByte(String.fromCharCode(255&f))}return s.getBytes(e)}return n.pools=s,n.pool=0,n.generate=function(e,r){if(!r)return n.generateSync(e);var o=n.plugin.cipher,s=n.plugin.increment,l=n.plugin.formatKey,a=n.plugin.formatSeed,u=t.util.createBuffer();n.key=null,function g(f){if(f)return r(f);if(u.length()>=e)return r(null,u.getBytes(e));n.generated>1048575&&(n.key=null);if(null===n.key)return t.util.nextTick(function(){!function(e){if(n.pools[0].messageLength>=32)return i(),e();var t=32-n.pools[0].messageLength<<5;n.seedFile(t,function(t,r){if(t)return e(t);n.collect(r),i(),e()})}(g)});var d=o(n.key,n.seed);n.generated+=d.length;u.putBytes(d);n.key=l(o(n.key,s(n.seed)));n.seed=a(o(n.key,n.seed));t.util.setImmediate(g)}()},n.generateSync=function(e){var r=n.plugin.cipher,o=n.plugin.increment,s=n.plugin.formatKey,l=n.plugin.formatSeed;n.key=null;for(var i=t.util.createBuffer();i.length()<e;){n.generated>1048575&&(n.key=null),null===n.key&&a();var u=r(n.key,n.seed);n.generated+=u.length,i.putBytes(u),n.key=s(r(n.key,o(n.seed))),n.seed=l(r(n.key,n.seed))}return i.getBytes(e)},r?(n.seedFile=function(e,t){r.randomBytes(e,function(e,r){if(e)return t(e);t(null,r.toString())})},n.seedFileSync=function(e){return r.randomBytes(e).toString()}):(n.seedFile=function(e,t){try{t(null,u(e))}catch(r){t(r)}},n.seedFileSync=u),n.collect=function(e){for(var t=e.length,r=0;r<t;++r)n.pools[n.pool].update(e.substr(r,1)),n.pool=31===n.pool?0:n.pool+1},n.collectInt=function(e,t){for(var r="",o=0;o<t;o+=8)r+=String.fromCharCode(e>>o&255);n.collect(r)},n.registerWorker=function(e){if(e===self)n.seedFile=function(e,t){self.addEventListener("message",function e(r){var n=r.data;n.forge&&n.forge.prng&&(self.removeEventListener("message",e),t(n.forge.prng.err,n.forge.prng.bytes))}),self.postMessage({forge:{prng:{needed:e}}})};else{e.addEventListener("message",function(t){var r=t.data;r.forge&&r.forge.prng&&n.seedFile(r.forge.prng.needed,function(t,r){e.postMessage({forge:{prng:{err:t,bytes:r}}})})})}},n};
|
||
},{"./forge":"sQ2N","./util":"2MJg","crypto":"sC8V","process":"sC8V"}],"b05L":[function(require,module,exports) {
|
||
var e=require("./forge");require("./aes"),require("./sha256"),require("./prng"),require("./util"),e.random&&e.random.getBytes?module.exports=e.random:function(t){var n={},r=new Array(4),o=e.util.createBuffer();function a(){var t=e.prng.create(n);return t.getBytes=function(e,n){return t.generate(e,n)},t.getBytesSync=function(e){return t.generate(e)},t}n.formatKey=function(t){var n=e.util.createBuffer(t);return(t=new Array(4))[0]=n.getInt32(),t[1]=n.getInt32(),t[2]=n.getInt32(),t[3]=n.getInt32(),e.aes._expandKey(t,!1)},n.formatSeed=function(t){var n=e.util.createBuffer(t);return(t=new Array(4))[0]=n.getInt32(),t[1]=n.getInt32(),t[2]=n.getInt32(),t[3]=n.getInt32(),t},n.cipher=function(t,n){return e.aes._updateBlock(t,n,r,!1),o.putInt32(r[0]),o.putInt32(r[1]),o.putInt32(r[2]),o.putInt32(r[3]),o.getBytes()},n.increment=function(e){return++e[3],e},n.md=e.md.sha256;var u=a(),i=null,c=e.util.globalScope,f=c.crypto||c.msCrypto;if(f&&f.getRandomValues&&(i=function(e){return f.getRandomValues(e)}),e.options.usePureJavaScript||!e.util.isNodejs&&!i){if("undefined"==typeof window||window.document,u.collectInt(+new Date,32),"undefined"!=typeof navigator){var l="";for(var d in navigator)try{"string"==typeof navigator[d]&&(l+=navigator[d])}catch(g){}u.collect(l),l=null}t&&(t().mousemove(function(e){u.collectInt(e.clientX,16),u.collectInt(e.clientY,16)}),t().keypress(function(e){u.collectInt(e.charCode,8)}))}if(e.random)for(var d in u)e.random[d]=u[d];else e.random=u;e.random.createInstance=a,module.exports=e.random}("undefined"!=typeof jQuery?jQuery:null);
|
||
},{"./forge":"sQ2N","./aes":"bEBs","./sha256":"v5kO","./prng":"q1OX","./util":"2MJg"}],"lkDF":[function(require,module,exports) {
|
||
var t=require("./forge");require("./util");var r=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],e=[1,2,3,5],n=function(t,r){return t<<r&65535|(65535&t)>>16-r},u=function(t,r){return(65535&t)>>r|t<<16-r&65535};module.exports=t.rc2=t.rc2||{},t.rc2.expandKey=function(e,n){"string"==typeof e&&(e=t.util.createBuffer(e)),n=n||128;var u,f=e,i=e.length(),c=n,a=Math.ceil(c/8),o=255>>(7&c);for(u=i;u<128;u++)f.putByte(r[f.at(u-1)+f.at(u-i)&255]);for(f.setAt(128-a,r[f.at(128-a)&o]),u=127-a;u>=0;u--)f.setAt(u,r[f.at(u+1)^f.at(u+a)]);return f};var f=function(r,f,i){var c,a,o,l,p=!1,g=null,h=null,s=null,v=[];for(r=t.rc2.expandKey(r,f),o=0;o<64;o++)v.push(r.getInt16Le());i?(c=function(t){for(o=0;o<4;o++)t[o]+=v[l]+(t[(o+3)%4]&t[(o+2)%4])+(~t[(o+3)%4]&t[(o+1)%4]),t[o]=n(t[o],e[o]),l++},a=function(t){for(o=0;o<4;o++)t[o]+=v[63&t[(o+3)%4]]}):(c=function(t){for(o=3;o>=0;o--)t[o]=u(t[o],e[o]),t[o]-=v[l]+(t[(o+3)%4]&t[(o+2)%4])+(~t[(o+3)%4]&t[(o+1)%4]),l--},a=function(t){for(o=3;o>=0;o--)t[o]-=v[63&t[(o+3)%4]]});var y=function(t){var r=[];for(o=0;o<4;o++){var e=g.getInt16Le();null!==s&&(i?e^=s.getInt16Le():s.putInt16Le(e)),r.push(65535&e)}l=i?0:63;for(var n=0;n<t.length;n++)for(var u=0;u<t[n][0];u++)t[n][1](r);for(o=0;o<4;o++)null!==s&&(i?s.putInt16Le(r[o]):r[o]^=s.getInt16Le()),h.putInt16Le(r[o])},B=null;return B={start:function(r,e){r&&"string"==typeof r&&(r=t.util.createBuffer(r)),p=!1,g=t.util.createBuffer(),h=e||new t.util.createBuffer,s=r,B.output=h},update:function(t){for(p||g.putBuffer(t);g.length()>=8;)y([[5,c],[1,a],[6,c],[1,a],[5,c]])},finish:function(t){var r=!0;if(i)if(t)r=t(8,g,!i);else{var e=8===g.length()?8:8-g.length();g.fillWithByte(e,e)}if(r&&(p=!0,B.update()),!i&&(r=0===g.length()))if(t)r=t(8,h,!i);else{var n=h.length(),u=h.at(n-1);u>n?r=!1:h.truncate(u)}return r}}};t.rc2.startEncrypting=function(r,e,n){var u=t.rc2.createEncryptionCipher(r,128);return u.start(e,n),u},t.rc2.createEncryptionCipher=function(t,r){return f(t,r,!0)},t.rc2.startDecrypting=function(r,e,n){var u=t.rc2.createDecryptionCipher(r,128);return u.start(e,n),u},t.rc2.createDecryptionCipher=function(t,r){return f(t,r,!1)};
|
||
},{"./forge":"sQ2N","./util":"2MJg"}],"vnLg":[function(require,module,exports) {
|
||
var t,i=require("./forge");module.exports=i.jsbn=i.jsbn||{};var o=0xdeadbeefcafe,r=15715070==(16777215&o);function s(t,i,o){this.data=[],null!=t&&("number"==typeof t?this.fromNumber(t,i,o):null==i&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,i))}function a(){return new s(null)}function h(t,i,o,r,s,a){for(;--a>=0;){var h=i*this.data[t++]+o.data[r]+s;s=Math.floor(h/67108864),o.data[r++]=67108863&h}return s}function e(t,i,o,r,s,a){for(var h=32767&i,e=i>>15;--a>=0;){var n=32767&this.data[t],u=this.data[t++]>>15,f=e*n+u*h;s=((n=h*n+((32767&f)<<15)+o.data[r]+(1073741823&s))>>>30)+(f>>>15)+e*u+(s>>>30),o.data[r++]=1073741823&n}return s}function n(t,i,o,r,s,a){for(var h=16383&i,e=i>>14;--a>=0;){var n=16383&this.data[t],u=this.data[t++]>>14,f=e*n+u*h;s=((n=h*n+((16383&f)<<14)+o.data[r]+s)>>28)+(f>>14)+e*u,o.data[r++]=268435455&n}return s}i.jsbn.BigInteger=s,"undefined"==typeof navigator?(s.prototype.am=n,t=28):r&&"Microsoft Internet Explorer"==navigator.appName?(s.prototype.am=e,t=30):r&&"Netscape"!=navigator.appName?(s.prototype.am=h,t=26):(s.prototype.am=n,t=28),s.prototype.DB=t,s.prototype.DM=(1<<t)-1,s.prototype.DV=1<<t;var u=52;s.prototype.FV=Math.pow(2,u),s.prototype.F1=u-t,s.prototype.F2=2*t-u;var f,p,d="0123456789abcdefghijklmnopqrstuvwxyz",c=new Array;for(f="0".charCodeAt(0),p=0;p<=9;++p)c[f++]=p;for(f="a".charCodeAt(0),p=10;p<36;++p)c[f++]=p;for(f="A".charCodeAt(0),p=10;p<36;++p)c[f++]=p;function m(t){return d.charAt(t)}function l(t,i){var o=c[t.charCodeAt(i)];return null==o?-1:o}function T(t){for(var i=this.t-1;i>=0;--i)t.data[i]=this.data[i];t.t=this.t,t.s=this.s}function v(t){this.t=1,this.s=t<0?-1:0,t>0?this.data[0]=t:t<-1?this.data[0]=t+this.DV:this.t=0}function y(t){var i=a();return i.fromInt(t),i}function D(t,i){var o;if(16==i)o=4;else if(8==i)o=3;else if(256==i)o=8;else if(2==i)o=1;else if(32==i)o=5;else{if(4!=i)return void this.fromRadix(t,i);o=2}this.t=0,this.s=0;for(var r=t.length,a=!1,h=0;--r>=0;){var e=8==o?255&t[r]:l(t,r);e<0?"-"==t.charAt(r)&&(a=!0):(a=!1,0==h?this.data[this.t++]=e:h+o>this.DB?(this.data[this.t-1]|=(e&(1<<this.DB-h)-1)<<h,this.data[this.t++]=e>>this.DB-h):this.data[this.t-1]|=e<<h,(h+=o)>=this.DB&&(h-=this.DB))}8==o&&0!=(128&t[0])&&(this.s=-1,h>0&&(this.data[this.t-1]|=(1<<this.DB-h)-1<<h)),this.clamp(),a&&s.ZERO.subTo(this,this)}function b(){for(var t=this.s&this.DM;this.t>0&&this.data[this.t-1]==t;)--this.t}function B(t){if(this.s<0)return"-"+this.negate().toString(t);var i;if(16==t)i=4;else if(8==t)i=3;else if(2==t)i=1;else if(32==t)i=5;else{if(4!=t)return this.toRadix(t);i=2}var o,r=(1<<i)-1,s=!1,a="",h=this.t,e=this.DB-h*this.DB%i;if(h-- >0)for(e<this.DB&&(o=this.data[h]>>e)>0&&(s=!0,a=m(o));h>=0;)e<i?(o=(this.data[h]&(1<<e)-1)<<i-e,o|=this.data[--h]>>(e+=this.DB-i)):(o=this.data[h]>>(e-=i)&r,e<=0&&(e+=this.DB,--h)),o>0&&(s=!0),s&&(a+=m(o));return s?a:"0"}function g(){var t=a();return s.ZERO.subTo(this,t),t}function S(){return this.s<0?this.negate():this}function M(t){var i=this.s-t.s;if(0!=i)return i;var o=this.t;if(0!=(i=o-t.t))return this.s<0?-i:i;for(;--o>=0;)if(0!=(i=this.data[o]-t.data[o]))return i;return 0}function w(t){var i,o=1;return 0!=(i=t>>>16)&&(t=i,o+=16),0!=(i=t>>8)&&(t=i,o+=8),0!=(i=t>>4)&&(t=i,o+=4),0!=(i=t>>2)&&(t=i,o+=2),0!=(i=t>>1)&&(t=i,o+=1),o}function E(){return this.t<=0?0:this.DB*(this.t-1)+w(this.data[this.t-1]^this.s&this.DM)}function O(t,i){var o;for(o=this.t-1;o>=0;--o)i.data[o+t]=this.data[o];for(o=t-1;o>=0;--o)i.data[o]=0;i.t=this.t+t,i.s=this.s}function R(t,i){for(var o=t;o<this.t;++o)i.data[o-t]=this.data[o];i.t=Math.max(this.t-t,0),i.s=this.s}function V(t,i){var o,r=t%this.DB,s=this.DB-r,a=(1<<s)-1,h=Math.floor(t/this.DB),e=this.s<<r&this.DM;for(o=this.t-1;o>=0;--o)i.data[o+h+1]=this.data[o]>>s|e,e=(this.data[o]&a)<<r;for(o=h-1;o>=0;--o)i.data[o]=0;i.data[h]=e,i.t=this.t+h+1,i.s=this.s,i.clamp()}function q(t,i){i.s=this.s;var o=Math.floor(t/this.DB);if(o>=this.t)i.t=0;else{var r=t%this.DB,s=this.DB-r,a=(1<<r)-1;i.data[0]=this.data[o]>>r;for(var h=o+1;h<this.t;++h)i.data[h-o-1]|=(this.data[h]&a)<<s,i.data[h-o]=this.data[h]>>r;r>0&&(i.data[this.t-o-1]|=(this.s&a)<<s),i.t=this.t-o,i.clamp()}}function A(t,i){for(var o=0,r=0,s=Math.min(t.t,this.t);o<s;)r+=this.data[o]-t.data[o],i.data[o++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r-=t.s;o<this.t;)r+=this.data[o],i.data[o++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;o<t.t;)r-=t.data[o],i.data[o++]=r&this.DM,r>>=this.DB;r-=t.s}i.s=r<0?-1:0,r<-1?i.data[o++]=this.DV+r:r>0&&(i.data[o++]=r),i.t=o,i.clamp()}function N(t,i){var o=this.abs(),r=t.abs(),a=o.t;for(i.t=a+r.t;--a>=0;)i.data[a]=0;for(a=0;a<r.t;++a)i.data[a+o.t]=o.am(0,r.data[a],i,a,0,o.t);i.s=0,i.clamp(),this.s!=t.s&&s.ZERO.subTo(i,i)}function x(t){for(var i=this.abs(),o=t.t=2*i.t;--o>=0;)t.data[o]=0;for(o=0;o<i.t-1;++o){var r=i.am(o,i.data[o],t,2*o,0,1);(t.data[o+i.t]+=i.am(o+1,2*i.data[o],t,2*o+1,r,i.t-o-1))>=i.DV&&(t.data[o+i.t]-=i.DV,t.data[o+i.t+1]=1)}t.t>0&&(t.data[t.t-1]+=i.am(o,i.data[o],t,2*o,0,1)),t.s=0,t.clamp()}function L(t,i,o){var r=t.abs();if(!(r.t<=0)){var h=this.abs();if(h.t<r.t)return null!=i&&i.fromInt(0),void(null!=o&&this.copyTo(o));null==o&&(o=a());var e=a(),n=this.s,u=t.s,f=this.DB-w(r.data[r.t-1]);f>0?(r.lShiftTo(f,e),h.lShiftTo(f,o)):(r.copyTo(e),h.copyTo(o));var p=e.t,d=e.data[p-1];if(0!=d){var c=d*(1<<this.F1)+(p>1?e.data[p-2]>>this.F2:0),m=this.FV/c,l=(1<<this.F1)/c,T=1<<this.F2,v=o.t,y=v-p,D=null==i?a():i;for(e.dlShiftTo(y,D),o.compareTo(D)>=0&&(o.data[o.t++]=1,o.subTo(D,o)),s.ONE.dlShiftTo(p,D),D.subTo(e,e);e.t<p;)e.data[e.t++]=0;for(;--y>=0;){var b=o.data[--v]==d?this.DM:Math.floor(o.data[v]*m+(o.data[v-1]+T)*l);if((o.data[v]+=e.am(0,b,o,y,0,p))<b)for(e.dlShiftTo(y,D),o.subTo(D,o);o.data[v]<--b;)o.subTo(D,o)}null!=i&&(o.drShiftTo(p,i),n!=u&&s.ZERO.subTo(i,i)),o.t=p,o.clamp(),f>0&&o.rShiftTo(f,o),n<0&&s.ZERO.subTo(o,o)}}}function I(t){var i=a();return this.abs().divRemTo(t,null,i),this.s<0&&i.compareTo(s.ZERO)>0&&t.subTo(i,i),i}function Z(t){this.m=t}function F(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}function P(t){return t}function C(t){t.divRemTo(this.m,null,t)}function j(t,i,o){t.multiplyTo(i,o),this.reduce(o)}function k(t,i){t.squareTo(i),this.reduce(i)}function z(){if(this.t<1)return 0;var t=this.data[0];if(0==(1&t))return 0;var i=3&t;return(i=(i=(i=(i=i*(2-(15&t)*i)&15)*(2-(255&t)*i)&255)*(2-((65535&t)*i&65535))&65535)*(2-t*i%this.DV)%this.DV)>0?this.DV-i:-i}function U(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function G(t){var i=a();return t.abs().dlShiftTo(this.m.t,i),i.divRemTo(this.m,null,i),t.s<0&&i.compareTo(s.ZERO)>0&&this.m.subTo(i,i),i}function H(t){var i=a();return t.copyTo(i),this.reduce(i),i}function J(t){for(;t.t<=this.mt2;)t.data[t.t++]=0;for(var i=0;i<this.m.t;++i){var o=32767&t.data[i],r=o*this.mpl+((o*this.mph+(t.data[i]>>15)*this.mpl&this.um)<<15)&t.DM;for(o=i+this.m.t,t.data[o]+=this.m.am(0,r,t,i,0,this.m.t);t.data[o]>=t.DV;)t.data[o]-=t.DV,t.data[++o]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)}function K(t,i){t.squareTo(i),this.reduce(i)}function Q(t,i,o){t.multiplyTo(i,o),this.reduce(o)}function W(){return 0==(this.t>0?1&this.data[0]:this.s)}function X(t,i){if(t>4294967295||t<1)return s.ONE;var o=a(),r=a(),h=i.convert(this),e=w(t)-1;for(h.copyTo(o);--e>=0;)if(i.sqrTo(o,r),(t&1<<e)>0)i.mulTo(r,h,o);else{var n=o;o=r,r=n}return i.revert(o)}function Y(t,i){var o;return o=t<256||i.isEven()?new Z(i):new U(i),this.exp(t,o)}function $(){var t=a();return this.copyTo(t),t}function _(){if(this.s<0){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]}function tt(){return 0==this.t?this.s:this.data[0]<<24>>24}function it(){return 0==this.t?this.s:this.data[0]<<16>>16}function ot(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}function rt(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1}function st(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var i=this.chunkSize(t),o=Math.pow(t,i),r=y(o),s=a(),h=a(),e="";for(this.divRemTo(r,s,h);s.signum()>0;)e=(o+h.intValue()).toString(t).substr(1)+e,s.divRemTo(r,s,h);return h.intValue().toString(t)+e}function at(t,i){this.fromInt(0),null==i&&(i=10);for(var o=this.chunkSize(i),r=Math.pow(i,o),a=!1,h=0,e=0,n=0;n<t.length;++n){var u=l(t,n);u<0?"-"==t.charAt(n)&&0==this.signum()&&(a=!0):(e=i*e+u,++h>=o&&(this.dMultiply(r),this.dAddOffset(e,0),h=0,e=0))}h>0&&(this.dMultiply(Math.pow(i,h)),this.dAddOffset(e,0)),a&&s.ZERO.subTo(this,this)}function ht(t,i,o){if("number"==typeof i)if(t<2)this.fromInt(1);else for(this.fromNumber(t,o),this.testBit(t-1)||this.bitwiseTo(s.ONE.shiftLeft(t-1),mt,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(i);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(s.ONE.shiftLeft(t-1),this);else{var r=new Array,a=7&t;r.length=1+(t>>3),i.nextBytes(r),a>0?r[0]&=(1<<a)-1:r[0]=0,this.fromString(r,256)}}function et(){var t=this.t,i=new Array;i[0]=this.s;var o,r=this.DB-t*this.DB%8,s=0;if(t-- >0)for(r<this.DB&&(o=this.data[t]>>r)!=(this.s&this.DM)>>r&&(i[s++]=o|this.s<<this.DB-r);t>=0;)r<8?(o=(this.data[t]&(1<<r)-1)<<8-r,o|=this.data[--t]>>(r+=this.DB-8)):(o=this.data[t]>>(r-=8)&255,r<=0&&(r+=this.DB,--t)),0!=(128&o)&&(o|=-256),0==s&&(128&this.s)!=(128&o)&&++s,(s>0||o!=this.s)&&(i[s++]=o);return i}function nt(t){return 0==this.compareTo(t)}function ut(t){return this.compareTo(t)<0?this:t}function ft(t){return this.compareTo(t)>0?this:t}function pt(t,i,o){var r,s,a=Math.min(t.t,this.t);for(r=0;r<a;++r)o.data[r]=i(this.data[r],t.data[r]);if(t.t<this.t){for(s=t.s&this.DM,r=a;r<this.t;++r)o.data[r]=i(this.data[r],s);o.t=this.t}else{for(s=this.s&this.DM,r=a;r<t.t;++r)o.data[r]=i(s,t.data[r]);o.t=t.t}o.s=i(this.s,t.s),o.clamp()}function dt(t,i){return t&i}function ct(t){var i=a();return this.bitwiseTo(t,dt,i),i}function mt(t,i){return t|i}function lt(t){var i=a();return this.bitwiseTo(t,mt,i),i}function Tt(t,i){return t^i}function vt(t){var i=a();return this.bitwiseTo(t,Tt,i),i}function yt(t,i){return t&~i}function Dt(t){var i=a();return this.bitwiseTo(t,yt,i),i}function bt(){for(var t=a(),i=0;i<this.t;++i)t.data[i]=this.DM&~this.data[i];return t.t=this.t,t.s=~this.s,t}function Bt(t){var i=a();return t<0?this.rShiftTo(-t,i):this.lShiftTo(t,i),i}function gt(t){var i=a();return t<0?this.lShiftTo(-t,i):this.rShiftTo(t,i),i}function St(t){if(0==t)return-1;var i=0;return 0==(65535&t)&&(t>>=16,i+=16),0==(255&t)&&(t>>=8,i+=8),0==(15&t)&&(t>>=4,i+=4),0==(3&t)&&(t>>=2,i+=2),0==(1&t)&&++i,i}function Mt(){for(var t=0;t<this.t;++t)if(0!=this.data[t])return t*this.DB+St(this.data[t]);return this.s<0?this.t*this.DB:-1}function wt(t){for(var i=0;0!=t;)t&=t-1,++i;return i}function Et(){for(var t=0,i=this.s&this.DM,o=0;o<this.t;++o)t+=wt(this.data[o]^i);return t}function Ot(t){var i=Math.floor(t/this.DB);return i>=this.t?0!=this.s:0!=(this.data[i]&1<<t%this.DB)}function Rt(t,i){var o=s.ONE.shiftLeft(t);return this.bitwiseTo(o,i,o),o}function Vt(t){return this.changeBit(t,mt)}function qt(t){return this.changeBit(t,yt)}function At(t){return this.changeBit(t,Tt)}function Nt(t,i){for(var o=0,r=0,s=Math.min(t.t,this.t);o<s;)r+=this.data[o]+t.data[o],i.data[o++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r+=t.s;o<this.t;)r+=this.data[o],i.data[o++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;o<t.t;)r+=t.data[o],i.data[o++]=r&this.DM,r>>=this.DB;r+=t.s}i.s=r<0?-1:0,r>0?i.data[o++]=r:r<-1&&(i.data[o++]=this.DV+r),i.t=o,i.clamp()}function xt(t){var i=a();return this.addTo(t,i),i}function Lt(t){var i=a();return this.subTo(t,i),i}function It(t){var i=a();return this.multiplyTo(t,i),i}function Zt(t){var i=a();return this.divRemTo(t,i,null),i}function Ft(t){var i=a();return this.divRemTo(t,null,i),i}function Pt(t){var i=a(),o=a();return this.divRemTo(t,i,o),new Array(i,o)}function Ct(t){this.data[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}function jt(t,i){if(0!=t){for(;this.t<=i;)this.data[this.t++]=0;for(this.data[i]+=t;this.data[i]>=this.DV;)this.data[i]-=this.DV,++i>=this.t&&(this.data[this.t++]=0),++this.data[i]}}function kt(){}function zt(t){return t}function Ut(t,i,o){t.multiplyTo(i,o)}function Gt(t,i){t.squareTo(i)}function Ht(t){return this.exp(t,new kt)}function Jt(t,i,o){var r,s=Math.min(this.t+t.t,i);for(o.s=0,o.t=s;s>0;)o.data[--s]=0;for(r=o.t-this.t;s<r;++s)o.data[s+this.t]=this.am(0,t.data[s],o,s,0,this.t);for(r=Math.min(t.t,i);s<r;++s)this.am(0,t.data[s],o,s,0,i-s);o.clamp()}function Kt(t,i,o){--i;var r=o.t=this.t+t.t-i;for(o.s=0;--r>=0;)o.data[r]=0;for(r=Math.max(i-this.t,0);r<t.t;++r)o.data[this.t+r-i]=this.am(i-r,t.data[r],o,0,0,this.t+r-i);o.clamp(),o.drShiftTo(1,o)}function Qt(t){this.r2=a(),this.q3=a(),s.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}function Wt(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var i=a();return t.copyTo(i),this.reduce(i),i}function Xt(t){return t}function Yt(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)}function $t(t,i){t.squareTo(i),this.reduce(i)}function _t(t,i,o){t.multiplyTo(i,o),this.reduce(o)}function ti(t,i){var o,r,s=t.bitLength(),h=y(1);if(s<=0)return h;o=s<18?1:s<48?3:s<144?4:s<768?5:6,r=s<8?new Z(i):i.isEven()?new Qt(i):new U(i);var e=new Array,n=3,u=o-1,f=(1<<o)-1;if(e[1]=r.convert(this),o>1){var p=a();for(r.sqrTo(e[1],p);n<=f;)e[n]=a(),r.mulTo(p,e[n-2],e[n]),n+=2}var d,c,m=t.t-1,l=!0,T=a();for(s=w(t.data[m])-1;m>=0;){for(s>=u?d=t.data[m]>>s-u&f:(d=(t.data[m]&(1<<s+1)-1)<<u-s,m>0&&(d|=t.data[m-1]>>this.DB+s-u)),n=o;0==(1&d);)d>>=1,--n;if((s-=n)<0&&(s+=this.DB,--m),l)e[d].copyTo(h),l=!1;else{for(;n>1;)r.sqrTo(h,T),r.sqrTo(T,h),n-=2;n>0?r.sqrTo(h,T):(c=h,h=T,T=c),r.mulTo(T,e[d],h)}for(;m>=0&&0==(t.data[m]&1<<s);)r.sqrTo(h,T),c=h,h=T,T=c,--s<0&&(s=this.DB-1,--m)}return r.revert(h)}function ii(t){var i=this.s<0?this.negate():this.clone(),o=t.s<0?t.negate():t.clone();if(i.compareTo(o)<0){var r=i;i=o,o=r}var s=i.getLowestSetBit(),a=o.getLowestSetBit();if(a<0)return i;for(s<a&&(a=s),a>0&&(i.rShiftTo(a,i),o.rShiftTo(a,o));i.signum()>0;)(s=i.getLowestSetBit())>0&&i.rShiftTo(s,i),(s=o.getLowestSetBit())>0&&o.rShiftTo(s,o),i.compareTo(o)>=0?(i.subTo(o,i),i.rShiftTo(1,i)):(o.subTo(i,o),o.rShiftTo(1,o));return a>0&&o.lShiftTo(a,o),o}function oi(t){if(t<=0)return 0;var i=this.DV%t,o=this.s<0?t-1:0;if(this.t>0)if(0==i)o=this.data[0]%t;else for(var r=this.t-1;r>=0;--r)o=(i*o+this.data[r])%t;return o}function ri(t){var i=t.isEven();if(this.isEven()&&i||0==t.signum())return s.ZERO;for(var o=t.clone(),r=this.clone(),a=y(1),h=y(0),e=y(0),n=y(1);0!=o.signum();){for(;o.isEven();)o.rShiftTo(1,o),i?(a.isEven()&&h.isEven()||(a.addTo(this,a),h.subTo(t,h)),a.rShiftTo(1,a)):h.isEven()||h.subTo(t,h),h.rShiftTo(1,h);for(;r.isEven();)r.rShiftTo(1,r),i?(e.isEven()&&n.isEven()||(e.addTo(this,e),n.subTo(t,n)),e.rShiftTo(1,e)):n.isEven()||n.subTo(t,n),n.rShiftTo(1,n);o.compareTo(r)>=0?(o.subTo(r,o),i&&a.subTo(e,a),h.subTo(n,h)):(r.subTo(o,r),i&&e.subTo(a,e),n.subTo(h,n))}return 0!=r.compareTo(s.ONE)?s.ZERO:n.compareTo(t)>=0?n.subtract(t):n.signum()<0?(n.addTo(t,n),n.signum()<0?n.add(t):n):n}Z.prototype.convert=F,Z.prototype.revert=P,Z.prototype.reduce=C,Z.prototype.mulTo=j,Z.prototype.sqrTo=k,U.prototype.convert=G,U.prototype.revert=H,U.prototype.reduce=J,U.prototype.mulTo=Q,U.prototype.sqrTo=K,s.prototype.copyTo=T,s.prototype.fromInt=v,s.prototype.fromString=D,s.prototype.clamp=b,s.prototype.dlShiftTo=O,s.prototype.drShiftTo=R,s.prototype.lShiftTo=V,s.prototype.rShiftTo=q,s.prototype.subTo=A,s.prototype.multiplyTo=N,s.prototype.squareTo=x,s.prototype.divRemTo=L,s.prototype.invDigit=z,s.prototype.isEven=W,s.prototype.exp=X,s.prototype.toString=B,s.prototype.negate=g,s.prototype.abs=S,s.prototype.compareTo=M,s.prototype.bitLength=E,s.prototype.mod=I,s.prototype.modPowInt=Y,s.ZERO=y(0),s.ONE=y(1),kt.prototype.convert=zt,kt.prototype.revert=zt,kt.prototype.mulTo=Ut,kt.prototype.sqrTo=Gt,Qt.prototype.convert=Wt,Qt.prototype.revert=Xt,Qt.prototype.reduce=Yt,Qt.prototype.mulTo=_t,Qt.prototype.sqrTo=$t;var si=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],ai=(1<<26)/si[si.length-1];function hi(t){var i,o=this.abs();if(1==o.t&&o.data[0]<=si[si.length-1]){for(i=0;i<si.length;++i)if(o.data[0]==si[i])return!0;return!1}if(o.isEven())return!1;for(i=1;i<si.length;){for(var r=si[i],s=i+1;s<si.length&&r<ai;)r*=si[s++];for(r=o.modInt(r);i<s;)if(r%si[i++]==0)return!1}return o.millerRabin(t)}function ei(t){var i=this.subtract(s.ONE),o=i.getLowestSetBit();if(o<=0)return!1;for(var r,a=i.shiftRight(o),h=ni(),e=0;e<t;++e){do{r=new s(this.bitLength(),h)}while(r.compareTo(s.ONE)<=0||r.compareTo(i)>=0);var n=r.modPow(a,this);if(0!=n.compareTo(s.ONE)&&0!=n.compareTo(i)){for(var u=1;u++<o&&0!=n.compareTo(i);)if(0==(n=n.modPowInt(2,this)).compareTo(s.ONE))return!1;if(0!=n.compareTo(i))return!1}}return!0}function ni(){return{nextBytes:function(t){for(var i=0;i<t.length;++i)t[i]=Math.floor(256*Math.random())}}}s.prototype.chunkSize=ot,s.prototype.toRadix=st,s.prototype.fromRadix=at,s.prototype.fromNumber=ht,s.prototype.bitwiseTo=pt,s.prototype.changeBit=Rt,s.prototype.addTo=Nt,s.prototype.dMultiply=Ct,s.prototype.dAddOffset=jt,s.prototype.multiplyLowerTo=Jt,s.prototype.multiplyUpperTo=Kt,s.prototype.modInt=oi,s.prototype.millerRabin=ei,s.prototype.clone=$,s.prototype.intValue=_,s.prototype.byteValue=tt,s.prototype.shortValue=it,s.prototype.signum=rt,s.prototype.toByteArray=et,s.prototype.equals=nt,s.prototype.min=ut,s.prototype.max=ft,s.prototype.and=ct,s.prototype.or=lt,s.prototype.xor=vt,s.prototype.andNot=Dt,s.prototype.not=bt,s.prototype.shiftLeft=Bt,s.prototype.shiftRight=gt,s.prototype.getLowestSetBit=Mt,s.prototype.bitCount=Et,s.prototype.testBit=Ot,s.prototype.setBit=Vt,s.prototype.clearBit=qt,s.prototype.flipBit=At,s.prototype.add=xt,s.prototype.subtract=Lt,s.prototype.multiply=It,s.prototype.divide=Zt,s.prototype.remainder=Ft,s.prototype.divideAndRemainder=Pt,s.prototype.modPow=ti,s.prototype.modInverse=ri,s.prototype.pow=Ht,s.prototype.gcd=ii,s.prototype.isProbablePrime=hi;
|
||
},{"./forge":"sQ2N"}],"xo4s":[function(require,module,exports) {
|
||
var e=require("./forge");require("./md"),require("./util");var t=module.exports=e.sha1=e.sha1||{};e.md.sha1=e.md.algorithms.sha1=t,t.create=function(){r||n();var t=null,s=e.util.createBuffer(),u=new Array(80),a={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){a.messageLength=0,a.fullMessageLength=a.messageLength64=[];for(var h=a.messageLengthSize/4,r=0;r<h;++r)a.fullMessageLength.push(0);return s=e.util.createBuffer(),t={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},a}};return a.start(),a.update=function(h,r){"utf8"===r&&(h=e.util.encodeUtf8(h));var n=h.length;a.messageLength+=n,n=[n/4294967296>>>0,n>>>0];for(var l=a.fullMessageLength.length-1;l>=0;--l)a.fullMessageLength[l]+=n[1],n[1]=n[0]+(a.fullMessageLength[l]/4294967296>>>0),a.fullMessageLength[l]=a.fullMessageLength[l]>>>0,n[0]=n[1]/4294967296>>>0;return s.putBytes(h),g(t,u,s),(s.read>2048||0===s.length())&&s.compact(),a},a.digest=function(){var r=e.util.createBuffer();r.putBytes(s.bytes());var n,l=a.fullMessageLength[a.fullMessageLength.length-1]+a.messageLengthSize&a.blockLength-1;r.putBytes(h.substr(0,a.blockLength-l));for(var f=8*a.fullMessageLength[0],o=0;o<a.fullMessageLength.length-1;++o)f+=(n=8*a.fullMessageLength[o+1])/4294967296>>>0,r.putInt32(f>>>0),f=n>>>0;r.putInt32(f);var i={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4};g(i,u,r);var L=e.util.createBuffer();return L.putInt32(i.h0),L.putInt32(i.h1),L.putInt32(i.h2),L.putInt32(i.h3),L.putInt32(i.h4),L},a};var h=null,r=!1;function n(){h=String.fromCharCode(128),h+=e.util.fillString(String.fromCharCode(0),64),r=!0}function g(e,t,h){for(var r,n,g,s,u,a,l,f=h.length();f>=64;){for(n=e.h0,g=e.h1,s=e.h2,u=e.h3,a=e.h4,l=0;l<16;++l)r=h.getInt32(),t[l]=r,r=(n<<5|n>>>27)+(u^g&(s^u))+a+1518500249+r,a=u,u=s,s=(g<<30|g>>>2)>>>0,g=n,n=r;for(;l<20;++l)r=(r=t[l-3]^t[l-8]^t[l-14]^t[l-16])<<1|r>>>31,t[l]=r,r=(n<<5|n>>>27)+(u^g&(s^u))+a+1518500249+r,a=u,u=s,s=(g<<30|g>>>2)>>>0,g=n,n=r;for(;l<32;++l)r=(r=t[l-3]^t[l-8]^t[l-14]^t[l-16])<<1|r>>>31,t[l]=r,r=(n<<5|n>>>27)+(g^s^u)+a+1859775393+r,a=u,u=s,s=(g<<30|g>>>2)>>>0,g=n,n=r;for(;l<40;++l)r=(r=t[l-6]^t[l-16]^t[l-28]^t[l-32])<<2|r>>>30,t[l]=r,r=(n<<5|n>>>27)+(g^s^u)+a+1859775393+r,a=u,u=s,s=(g<<30|g>>>2)>>>0,g=n,n=r;for(;l<60;++l)r=(r=t[l-6]^t[l-16]^t[l-28]^t[l-32])<<2|r>>>30,t[l]=r,r=(n<<5|n>>>27)+(g&s|u&(g^s))+a+2400959708+r,a=u,u=s,s=(g<<30|g>>>2)>>>0,g=n,n=r;for(;l<80;++l)r=(r=t[l-6]^t[l-16]^t[l-28]^t[l-32])<<2|r>>>30,t[l]=r,r=(n<<5|n>>>27)+(g^s^u)+a+3395469782+r,a=u,u=s,s=(g<<30|g>>>2)>>>0,g=n,n=r;e.h0=e.h0+n|0,e.h1=e.h1+g|0,e.h2=e.h2+s|0,e.h3=e.h3+u|0,e.h4=e.h4+a|0,f-=64}}
|
||
},{"./forge":"sQ2N","./md":"2EAk","./util":"2MJg"}],"W5po":[function(require,module,exports) {
|
||
var e=require("./forge");require("./util"),require("./random"),require("./sha1");var t=module.exports=e.pkcs1=e.pkcs1||{};function r(t,r,g){g||(g=e.md.sha1.create());for(var n="",i=Math.ceil(r/g.digestLength),s=0;s<i;++s){var h=String.fromCharCode(s>>24&255,s>>16&255,s>>8&255,255&s);g.start(),g.update(t+h),n+=g.digest().getBytes()}return n.substring(0,r)}t.encode_rsa_oaep=function(t,g,n){var i,s,h,d;"string"==typeof n?(i=n,s=arguments[3]||void 0,h=arguments[4]||void 0):n&&(i=n.label||void 0,s=n.seed||void 0,h=n.md||void 0,n.mgf1&&n.mgf1.md&&(d=n.mgf1.md)),h?h.start():h=e.md.sha1.create(),d||(d=h);var a=Math.ceil(t.n.bitLength()/8),o=a-2*h.digestLength-2;if(g.length>o)throw(c=new Error("RSAES-OAEP input message length is too long.")).length=g.length,c.maxLength=o,c;i||(i=""),h.update(i,"raw");for(var l=h.digest(),u="",v=o-g.length,f=0;f<v;f++)u+="\0";var m=l.getBytes()+u+""+g;if(s){if(s.length!==h.digestLength){var c;throw(c=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.")).seedLength=s.length,c.digestLength=h.digestLength,c}}else s=e.random.getBytes(h.digestLength);var L=r(s,a-h.digestLength-1,d),A=e.util.xorBytes(m,L,m.length),E=r(A,h.digestLength,d);return"\0"+e.util.xorBytes(s,E,s.length)+A},t.decode_rsa_oaep=function(t,g,n){var i,s,h;"string"==typeof n?(i=n,s=arguments[3]||void 0):n&&(i=n.label||void 0,s=n.md||void 0,n.mgf1&&n.mgf1.md&&(h=n.mgf1.md));var d=Math.ceil(t.n.bitLength()/8);if(g.length!==d)throw(L=new Error("RSAES-OAEP encoded message length is invalid.")).length=g.length,L.expectedLength=d,L;if(void 0===s?s=e.md.sha1.create():s.start(),h||(h=s),d<2*s.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");i||(i=""),s.update(i,"raw");for(var a=s.digest().getBytes(),o=g.charAt(0),l=g.substring(1,s.digestLength+1),u=g.substring(1+s.digestLength),v=r(u,s.digestLength,h),f=r(e.util.xorBytes(l,v,l.length),d-s.digestLength-1,h),m=e.util.xorBytes(u,f,u.length),c=m.substring(0,s.digestLength),L="\0"!==o,A=0;A<s.digestLength;++A)L|=a.charAt(A)!==c.charAt(A);for(var E=1,p=s.digestLength,w=s.digestLength;w<m.length;w++){var y=m.charCodeAt(w);L|=y&(E?65534:0),p+=E&=1&y^1}if(L||1!==m.charCodeAt(p))throw new Error("Invalid RSAES-OAEP padding.");return m.substring(p+1)};
|
||
},{"./forge":"sQ2N","./util":"2MJg","./random":"b05L","./sha1":"xo4s"}],"iJl2":[function(require,module,exports) {
|
||
var e=require("./forge");require("./util"),require("./jsbn"),require("./random"),function(){if(e.prime)module.exports=e.prime;else{var r=module.exports=e.prime=e.prime||{},n=e.jsbn.BigInteger,t=[6,4,2,4,2,4,6,2],i=new n(null);i.fromInt(30);var o=function(e,r){return e|r};r.generateProbablePrime=function(r,t,i){"function"==typeof t&&(i=t,t={});var o=(t=t||{}).algorithm||"PRIMEINC";"string"==typeof o&&(o={name:o}),o.options=o.options||{};var u=t.prng||e.random,s={nextBytes:function(e){for(var r=u.getBytesSync(e.length),n=0;n<e.length;++n)e[n]=r.charCodeAt(n)}};if("PRIMEINC"===o.name)return function(r,t,i,o){if("workers"in i)return function(r,t,i,o){if("undefined"==typeof Worker)return a(r,t,i,o);var u=f(r,t),s=i.workers,m=i.workLoad||100,l=30*m/8,d=i.workerScript||"forge/prime.worker.js";if(-1===s)return e.util.estimateCores(function(e,r){e&&(r=2),s=r-1,g()});function g(){s=Math.max(1,s);for(var e=[],i=0;i<s;++i)e[i]=new Worker(d);for(var i=0;i<s;++i)e[i].addEventListener("message",g);var a=!1;function g(i){if(!a){0;var s=i.data;if(s.found){for(var d=0;d<e.length;++d)e[d].terminate();return a=!0,o(null,new n(s.prime,16))}u.bitLength()>r&&(u=f(r,t));var g=u.toString(16);i.target.postMessage({hex:g,workLoad:m}),u.dAddOffset(l,0)}}}g()}(r,t,i,o);return a(r,t,i,o)}(r,s,o.options,i);throw new Error("Invalid prime generation algorithm: "+o.name)}}function a(r,n,i,o){var a=f(r,n),u=function(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}(a.bitLength());"millerRabinTests"in i&&(u=i.millerRabinTests);var s=10;"maxBlockTime"in i&&(s=i.maxBlockTime),function r(n,i,o,a,u,s,m){var l=+new Date;do{if(n.bitLength()>i&&(n=f(i,o)),n.isProbablePrime(u))return m(null,n);n.dAddOffset(t[a++%8],0)}while(s<0||+new Date-l<s);e.util.setImmediate(function(){r(n,i,o,a,u,s,m)})}(a,r,n,0,u,s,o)}function f(e,r){var t=new n(e,r),a=e-1;return t.testBit(a)||t.bitwiseTo(n.ONE.shiftLeft(a),o,t),t.dAddOffset(31-t.mod(i).byteValue(),0),t}}();
|
||
},{"./forge":"sQ2N","./util":"2MJg","./jsbn":"vnLg","./random":"b05L"}],"a11z":[function(require,module,exports) {
|
||
function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}var t=require("./forge");if(require("./asn1"),require("./jsbn"),require("./oids"),require("./pkcs1"),require("./prime"),require("./random"),require("./util"),void 0===r)var r=t.jsbn.BigInteger;var n=t.util.isNodejs?require("crypto"):null,a=t.asn1,o=t.util;t.pki=t.pki||{},module.exports=t.pki.rsa=t.rsa=t.rsa||{};var i=t.pki,s=[6,4,2,4,2,4,6,2],u={name:"PrivateKeyInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},p={name:"RSAPrivateKey",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},l={name:"RSAPublicKey",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},c=t.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:a.Class.UNIVERSAL,type:a.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},y=function(e){var t;if(!(e.algorithm in i.oids)){var r=new Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r}t=i.oids[e.algorithm];var n=a.oidToDer(t).getBytes(),o=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[]),s=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[]);s.value.push(a.create(a.Class.UNIVERSAL,a.Type.OID,!1,n)),s.value.push(a.create(a.Class.UNIVERSAL,a.Type.NULL,!1,""));var u=a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,e.digest().getBytes());return o.value.push(s),o.value.push(u),a.toDer(o).getBytes()},f=function(e,n,a){if(a)return e.modPow(n.e,n.n);if(!n.p||!n.q)return e.modPow(n.d,n.n);var o;n.dP||(n.dP=n.d.mod(n.p.subtract(r.ONE))),n.dQ||(n.dQ=n.d.mod(n.q.subtract(r.ONE))),n.qInv||(n.qInv=n.q.modInverse(n.p));do{o=new r(t.util.bytesToHex(t.random.getBytes(n.n.bitLength()/8)),16)}while(o.compareTo(n.n)>=0||!o.gcd(n.n).equals(r.ONE));for(var i=(e=e.multiply(o.modPow(n.e,n.n)).mod(n.n)).mod(n.p).modPow(n.dP,n.p),s=e.mod(n.q).modPow(n.dQ,n.q);i.compareTo(s)<0;)i=i.add(n.p);var u=i.subtract(s).multiply(n.qInv).mod(n.p).multiply(n.q).add(s);return u=u.multiply(o.modInverse(n.n)).mod(n.n)};function E(e,r,n){var a=t.util.createBuffer(),o=Math.ceil(r.n.bitLength()/8);if(e.length>o-11){var i=new Error("Message is too long for PKCS#1 v1.5 padding.");throw i.length=e.length,i.max=o-11,i}a.putByte(0),a.putByte(n);var s,u=o-3-e.length;if(0===n||1===n){s=0===n?0:255;for(var p=0;p<u;++p)a.putByte(s)}else for(;u>0;){var l=0,c=t.random.getBytes(u);for(p=0;p<u;++p)0===(s=c.charCodeAt(p))?++l:a.putByte(s);u=l}return a.putByte(0),a.putBytes(e),a}function d(e,r,n,a){var o=Math.ceil(r.n.bitLength()/8),i=t.util.createBuffer(e),s=i.getByte(),u=i.getByte();if(0!==s||n&&0!==u&&1!==u||!n&&2!=u||n&&0===u&&void 0===a)throw new Error("Encryption block is invalid.");var p=0;if(0===u){p=o-3-a;for(var l=0;l<p;++l)if(0!==i.getByte())throw new Error("Encryption block is invalid.")}else if(1===u)for(p=0;i.length()>1;){if(255!==i.getByte()){--i.read;break}++p}else if(2===u)for(p=0;i.length()>1;){if(0===i.getByte()){--i.read;break}++p}if(0!==i.getByte()||p!==o-3-i.length())throw new Error("Encryption block is invalid.");return i.getBytes()}function v(e,n,a){"function"==typeof n&&(a=n,n={});var o={algorithm:{name:(n=n||{}).algorithm||"PRIMEINC",options:{workers:n.workers||2,workLoad:n.workLoad||100,workerScript:n.workerScript}}};function s(){u(e.pBits,function(t,r){return t?a(t):(e.p=r,null!==e.q?p(t,e.q):void u(e.qBits,p))})}function u(e,r){t.prime.generateProbablePrime(e,o,r)}function p(t,n){if(t)return a(t);if(e.q=n,e.p.compareTo(e.q)<0){var o=e.p;e.p=e.q,e.q=o}if(0!==e.p.subtract(r.ONE).gcd(e.e).compareTo(r.ONE))return e.p=null,void s();if(0!==e.q.subtract(r.ONE).gcd(e.e).compareTo(r.ONE))return e.q=null,void u(e.qBits,p);if(e.p1=e.p.subtract(r.ONE),e.q1=e.q.subtract(r.ONE),e.phi=e.p1.multiply(e.q1),0!==e.phi.gcd(e.e).compareTo(r.ONE))return e.p=e.q=null,void s();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void u(e.qBits,p);var l=e.e.modInverse(e.phi);e.keys={privateKey:i.rsa.setPrivateKey(e.n,e.e,l,e.p,e.q,l.mod(e.p1),l.mod(e.q1),e.q.modInverse(e.p)),publicKey:i.rsa.setPublicKey(e.n,e.e)},a(null,e.keys)}"prng"in n&&(o.prng=n.prng),s()}function S(e){var r=e.toString(16);r[0]>="8"&&(r="00"+r);var n=t.util.hexToBytes(r);return n.length>1&&(0===n.charCodeAt(0)&&0==(128&n.charCodeAt(1))||255===n.charCodeAt(0)&&128==(128&n.charCodeAt(1)))?n.substr(1):n}function m(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function g(e){return t.util.isNodejs&&"function"==typeof n[e]}function b(t){return void 0!==o.globalScope&&"object"===e(o.globalScope.crypto)&&"object"===e(o.globalScope.crypto.subtle)&&"function"==typeof o.globalScope.crypto.subtle[t]}function K(t){return void 0!==o.globalScope&&"object"===e(o.globalScope.msCrypto)&&"object"===e(o.globalScope.msCrypto.subtle)&&"function"==typeof o.globalScope.msCrypto.subtle[t]}function N(e){for(var r=t.util.hexToBytes(e.toString(16)),n=new Uint8Array(r.length),a=0;a<r.length;++a)n[a]=r.charCodeAt(a);return n}function R(e){if("RSA"!==e.kty)throw new Error('Unsupported key algorithm "'+e.kty+'"; algorithm must be "RSA".');return i.setRsaPrivateKey(I(e.n),I(e.e),I(e.d),I(e.p),I(e.q),I(e.dp),I(e.dq),I(e.qi))}function C(e){if("RSA"!==e.kty)throw new Error('Key algorithm must be "RSA".');return i.setRsaPublicKey(I(e.n),I(e.e))}function I(e){return new r(t.util.bytesToHex(t.util.decode64(e)),16)}i.rsa.encrypt=function(e,n,a){var o,i=a,s=Math.ceil(n.n.bitLength()/8);!1!==a&&!0!==a?(i=2===a,o=E(e,n,a)):(o=t.util.createBuffer()).putBytes(e);for(var u=new r(o.toHex(),16),p=f(u,n,i).toString(16),l=t.util.createBuffer(),c=s-Math.ceil(p.length/2);c>0;)l.putByte(0),--c;return l.putBytes(t.util.hexToBytes(p)),l.getBytes()},i.rsa.decrypt=function(e,n,a,o){var i=Math.ceil(n.n.bitLength()/8);if(e.length!==i){var s=new Error("Encrypted message length is invalid.");throw s.length=e.length,s.expected=i,s}var u=new r(t.util.createBuffer(e).toHex(),16);if(u.compareTo(n.n)>=0)throw new Error("Encrypted message is invalid.");for(var p=f(u,n,a).toString(16),l=t.util.createBuffer(),c=i-Math.ceil(p.length/2);c>0;)l.putByte(0),--c;return l.putBytes(t.util.hexToBytes(p)),!1!==o?d(l.getBytes(),n,a):l.getBytes()},i.rsa.createKeyPairGenerationState=function(e,n,a){"string"==typeof e&&(e=parseInt(e,10)),e=e||2048;var o,i=(a=a||{}).prng||t.random,s={nextBytes:function(e){for(var t=i.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}},u=a.algorithm||"PRIMEINC";if("PRIMEINC"!==u)throw new Error("Invalid key generation algorithm: "+u);return(o={algorithm:u,state:0,bits:e,rng:s,eInt:n||65537,e:new r(null),p:null,q:null,qBits:e>>1,pBits:e-(e>>1),pqState:0,num:null,keys:null}).e.fromInt(o.eInt),o},i.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var n=new r(null);n.fromInt(30);for(var a,o=0,u=function(e,t){return e|t},p=+new Date,l=0;null===e.keys&&(t<=0||l<t);){if(0===e.state){var c=null===e.p?e.pBits:e.qBits,y=c-1;0===e.pqState?(e.num=new r(c,e.rng),e.num.testBit(y)||e.num.bitwiseTo(r.ONE.shiftLeft(y),u,e.num),e.num.dAddOffset(31-e.num.mod(n).byteValue(),0),o=0,++e.pqState):1===e.pqState?e.num.bitLength()>c?e.pqState=0:e.num.isProbablePrime(m(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(s[o++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(r.ONE).gcd(e.e).compareTo(r.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(r.ONE),e.q1=e.q.subtract(r.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(r.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var f=e.e.modInverse(e.phi);e.keys={privateKey:i.rsa.setPrivateKey(e.n,e.e,f,e.p,e.q,f.mod(e.p1),f.mod(e.q1),e.q.modInverse(e.p)),publicKey:i.rsa.setPublicKey(e.n,e.e)}}l+=(a=+new Date)-p,p=a}return null!==e.keys},i.rsa.generateKeyPair=function(r,s,u,p){if(1===arguments.length?"object"===e(r)?(u=r,r=void 0):"function"==typeof r&&(p=r,r=void 0):2===arguments.length?"number"==typeof r?"function"==typeof s?(p=s,s=void 0):"number"!=typeof s&&(u=s,s=void 0):(u=r,p=s,r=void 0,s=void 0):3===arguments.length&&("number"==typeof s?"function"==typeof u&&(p=u,u=void 0):(p=u,u=s,s=void 0)),u=u||{},void 0===r&&(r=u.bits||2048),void 0===s&&(s=u.e||65537),!t.options.usePureJavaScript&&!u.prng&&r>=256&&r<=16384&&(65537===s||3===s))if(p){if(g("generateKeyPair"))return n.generateKeyPair("rsa",{modulusLength:r,publicExponent:s,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(e,t,r){if(e)return p(e);p(null,{privateKey:i.privateKeyFromPem(r),publicKey:i.publicKeyFromPem(t)})});if(b("generateKey")&&b("exportKey"))return o.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:r,publicExponent:N(s),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(e){return o.globalScope.crypto.subtle.exportKey("pkcs8",e.privateKey)}).then(void 0,function(e){p(e)}).then(function(e){if(e){var r=i.privateKeyFromAsn1(a.fromDer(t.util.createBuffer(e)));p(null,{privateKey:r,publicKey:i.setRsaPublicKey(r.n,r.e)})}});if(K("generateKey")&&K("exportKey")){var l=o.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:r,publicExponent:N(s),hash:{name:"SHA-256"}},!0,["sign","verify"]);return l.oncomplete=function(e){var r=e.target.result,n=o.globalScope.msCrypto.subtle.exportKey("pkcs8",r.privateKey);n.oncomplete=function(e){var r=e.target.result,n=i.privateKeyFromAsn1(a.fromDer(t.util.createBuffer(r)));p(null,{privateKey:n,publicKey:i.setRsaPublicKey(n.n,n.e)})},n.onerror=function(e){p(e)}},void(l.onerror=function(e){p(e)})}}else if(g("generateKeyPairSync")){var c=n.generateKeyPairSync("rsa",{modulusLength:r,publicExponent:s,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:i.privateKeyFromPem(c.privateKey),publicKey:i.publicKeyFromPem(c.publicKey)}}var y=i.rsa.createKeyPairGenerationState(r,s,u);if(!p)return i.rsa.stepKeyPairGenerationState(y,0),y.keys;v(y,u,p)},i.setRsaPublicKey=i.rsa.setPublicKey=function(e,r){var n={n:e,e:r,encrypt:function(e,r,a){if("string"==typeof r?r=r.toUpperCase():void 0===r&&(r="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===r)r={encode:function(e,t,r){return E(e,t,2).getBytes()}};else if("RSA-OAEP"===r||"RSAES-OAEP"===r)r={encode:function(e,r){return t.pkcs1.encode_rsa_oaep(r,e,a)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(r))r={encode:function(e){return e}};else if("string"==typeof r)throw new Error('Unsupported encryption scheme: "'+r+'".');var o=r.encode(e,n,!0);return i.rsa.encrypt(o,n,!0)},verify:function(e,t,r){"string"==typeof r?r=r.toUpperCase():void 0===r&&(r="RSASSA-PKCS1-V1_5"),"RSASSA-PKCS1-V1_5"===r?r={verify:function(e,t){return t=d(t,n,!0),e===a.fromDer(t).value[1].value}}:"NONE"!==r&&"NULL"!==r&&null!==r||(r={verify:function(e,t){return e===(t=d(t,n,!0))}});var o=i.rsa.decrypt(t,n,!0,!1);return r.verify(e,o,n.n.bitLength())}};return n},i.setRsaPrivateKey=i.rsa.setPrivateKey=function(e,r,n,a,o,s,u,p){var l={n:e,e:r,d:n,p:a,q:o,dP:s,dQ:u,qInv:p,decrypt:function(e,r,n){"string"==typeof r?r=r.toUpperCase():void 0===r&&(r="RSAES-PKCS1-V1_5");var a=i.rsa.decrypt(e,l,!1,!1);if("RSAES-PKCS1-V1_5"===r)r={decode:d};else if("RSA-OAEP"===r||"RSAES-OAEP"===r)r={decode:function(e,r){return t.pkcs1.decode_rsa_oaep(r,e,n)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(r))throw new Error('Unsupported encryption scheme: "'+r+'".');r={decode:function(e){return e}}}return r.decode(a,l,!1)},sign:function(e,t){var r=!1;"string"==typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:y},r=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},r=1);var n=t.encode(e,l.n.bitLength());return i.rsa.encrypt(n,l,r)}};return l},i.wrapRsaPrivateKey=function(e){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,a.integerToDer(0).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(i.oids.rsaEncryption).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.NULL,!1,"")]),a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,a.toDer(e).getBytes())])},i.privateKeyFromAsn1=function(e){var n,o,s,l,c,y,f,E,d={},v=[];if(a.validate(e,u,d,v)&&(e=a.fromDer(t.util.createBuffer(d.privateKey))),d={},v=[],!a.validate(e,p,d,v)){var S=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw S.errors=v,S}return n=t.util.createBuffer(d.privateKeyModulus).toHex(),o=t.util.createBuffer(d.privateKeyPublicExponent).toHex(),s=t.util.createBuffer(d.privateKeyPrivateExponent).toHex(),l=t.util.createBuffer(d.privateKeyPrime1).toHex(),c=t.util.createBuffer(d.privateKeyPrime2).toHex(),y=t.util.createBuffer(d.privateKeyExponent1).toHex(),f=t.util.createBuffer(d.privateKeyExponent2).toHex(),E=t.util.createBuffer(d.privateKeyCoefficient).toHex(),i.setRsaPrivateKey(new r(n,16),new r(o,16),new r(s,16),new r(l,16),new r(c,16),new r(y,16),new r(f,16),new r(E,16))},i.privateKeyToAsn1=i.privateKeyToRSAPrivateKey=function(e){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,a.integerToDer(0).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,S(e.n)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,S(e.e)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,S(e.d)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,S(e.p)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,S(e.q)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,S(e.dP)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,S(e.dQ)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,S(e.qInv))])},i.publicKeyFromAsn1=function(e){var n={},o=[];if(a.validate(e,c,n,o)){var s,u=a.derToOid(n.publicKeyOid);if(u!==i.oids.rsaEncryption)throw(s=new Error("Cannot read public key. Unknown OID.")).oid=u,s;e=n.rsaPublicKey}if(o=[],!a.validate(e,l,n,o))throw(s=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=o,s;var p=t.util.createBuffer(n.publicKeyModulus).toHex(),y=t.util.createBuffer(n.publicKeyExponent).toHex();return i.setRsaPublicKey(new r(p,16),new r(y,16))},i.publicKeyToAsn1=i.publicKeyToSubjectPublicKeyInfo=function(e){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(i.oids.rsaEncryption).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.NULL,!1,"")]),a.create(a.Class.UNIVERSAL,a.Type.BITSTRING,!1,[i.publicKeyToRSAPublicKey(e)])])},i.publicKeyToRSAPublicKey=function(e){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,S(e.n)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,S(e.e))])};
|
||
},{"./forge":"sQ2N","./asn1":"RZRC","./jsbn":"vnLg","./oids":"F6JL","./pkcs1":"W5po","./prime":"iJl2","./random":"b05L","./util":"2MJg","crypto":"sC8V"}],"hIlf":[function(require,module,exports) {
|
||
var e=require("./forge");if(require("./aes"),require("./asn1"),require("./des"),require("./md"),require("./oids"),require("./pbkdf2"),require("./pem"),require("./random"),require("./rc2"),require("./rsa"),require("./util"),void 0===t)var t=e.jsbn.BigInteger;var r=e.asn1,a=e.pki=e.pki||{};module.exports=a.pbe=e.pbe=e.pbe||{};var s=a.oids,n={name:"EncryptedPrivateKeyInfo",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:r.Class.UNIVERSAL,type:r.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},i={name:"PBES2Algorithms",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:r.Class.UNIVERSAL,type:r.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:r.Class.UNIVERSAL,type:r.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:r.Class.UNIVERSAL,type:r.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:r.Class.UNIVERSAL,type:r.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},o={name:"pkcs-12PbeParams",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:r.Class.UNIVERSAL,type:r.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:r.Class.UNIVERSAL,type:r.Type.INTEGER,constructed:!1,capture:"iterations"}]};function p(e,t){return e.start().update(t).digest().getBytes()}function c(e){var t;if(e){if(!(t=a.oids[r.derToOid(e)])){var s=new Error("Unsupported PRF OID.");throw s.oid=e,s.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],s}}else t="hmacWithSHA1";return y(t)}function y(t){var r=e.md;switch(t){case"hmacWithSHA224":r=e.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":t=t.substr(8).toLowerCase();break;default:var a=new Error("Unsupported PRF algorithm.");throw a.algorithm=t,a.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],a}if(!(r&&t in r))throw new Error("Unknown hash algorithm: "+t);return r[t].create()}function E(t,s,n,i){var o=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,t),r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,s.getBytes())]);return"hmacWithSHA1"!==i&&o.value.push(r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,e.util.hexToBytes(n.toString(16))),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(a.oids[i]).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.NULL,!1,"")])),o}a.encryptPrivateKeyInfo=function(t,n,i){(i=i||{}).saltSize=i.saltSize||8,i.count=i.count||2048,i.algorithm=i.algorithm||"aes128",i.prfAlgorithm=i.prfAlgorithm||"sha1";var o,p,c,C=e.random.getBytesSync(i.saltSize),d=i.count,l=r.integerToDer(d);if(0===i.algorithm.indexOf("aes")||"des"===i.algorithm){var u,h,S;switch(i.algorithm){case"aes128":o=16,u=16,h=s["aes128-CBC"],S=e.aes.createEncryptionCipher;break;case"aes192":o=24,u=16,h=s["aes192-CBC"],S=e.aes.createEncryptionCipher;break;case"aes256":o=32,u=16,h=s["aes256-CBC"],S=e.aes.createEncryptionCipher;break;case"des":o=8,u=8,h=s.desCBC,S=e.des.createEncryptionCipher;break;default:throw(T=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=i.algorithm,T}var m="hmacWith"+i.prfAlgorithm.toUpperCase(),f=y(m),B=e.pkcs5.pbkdf2(n,C,d,o,f),g=e.random.getBytesSync(u);(v=S(B)).start(g),v.update(r.toDer(t)),v.finish(),c=v.output.getBytes();var A=E(C,l,o,m);p=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(s.pkcs5PBES2).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(s.pkcs5PBKDF2).getBytes()),A]),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(h).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,g)])])])}else{var T;if("3des"!==i.algorithm)throw(T=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=i.algorithm,T;o=24;var v,I=new e.util.ByteBuffer(C);B=a.pbe.generatePkcs12Key(n,I,1,d,o),g=a.pbe.generatePkcs12Key(n,I,2,d,o);(v=e.des.createEncryptionCipher(B)).start(g),v.update(r.toDer(t)),v.finish(),c=v.output.getBytes(),p=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(s["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,C),r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,l.getBytes())])])}return r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[p,r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,c)])},a.decryptPrivateKeyInfo=function(t,s){var i=null,o={},p=[];if(!r.validate(t,n,o,p)){var c=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw c.errors=p,c}var y=r.derToOid(o.encryptionOid),E=a.pbe.getCipher(y,o.encryptionParams,s),C=e.util.createBuffer(o.encryptedData);return E.update(C),E.finish()&&(i=r.fromDer(E.output)),i},a.encryptedPrivateKeyToPem=function(t,a){var s={type:"ENCRYPTED PRIVATE KEY",body:r.toDer(t).getBytes()};return e.pem.encode(s,{maxline:a})},a.encryptedPrivateKeyFromPem=function(t){var a=e.pem.decode(t)[0];if("ENCRYPTED PRIVATE KEY"!==a.type){var s=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw s.headerType=a.type,s}if(a.procType&&"ENCRYPTED"===a.procType.type)throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return r.fromDer(a.body)},a.encryptRsaPrivateKey=function(t,s,n){if(!(n=n||{}).legacy){var i=a.wrapRsaPrivateKey(a.privateKeyToAsn1(t));return i=a.encryptPrivateKeyInfo(i,s,n),a.encryptedPrivateKeyToPem(i)}var o,p,c,y;switch(n.algorithm){case"aes128":o="AES-128-CBC",c=16,p=e.random.getBytesSync(16),y=e.aes.createEncryptionCipher;break;case"aes192":o="AES-192-CBC",c=24,p=e.random.getBytesSync(16),y=e.aes.createEncryptionCipher;break;case"aes256":o="AES-256-CBC",c=32,p=e.random.getBytesSync(16),y=e.aes.createEncryptionCipher;break;case"3des":o="DES-EDE3-CBC",c=24,p=e.random.getBytesSync(8),y=e.des.createEncryptionCipher;break;case"des":o="DES-CBC",c=8,p=e.random.getBytesSync(8),y=e.des.createEncryptionCipher;break;default:var E=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+n.algorithm+'".');throw E.algorithm=n.algorithm,E}var C=y(e.pbe.opensslDeriveBytes(s,p.substr(0,8),c));C.start(p),C.update(r.toDer(a.privateKeyToAsn1(t))),C.finish();var d={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:o,parameters:e.util.bytesToHex(p).toUpperCase()},body:C.output.getBytes()};return e.pem.encode(d)},a.decryptRsaPrivateKey=function(t,s){var n=null,i=e.pem.decode(t)[0];if("ENCRYPTED PRIVATE KEY"!==i.type&&"PRIVATE KEY"!==i.type&&"RSA PRIVATE KEY"!==i.type)throw(c=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".')).headerType=c,c;if(i.procType&&"ENCRYPTED"===i.procType.type){var o,p;switch(i.dekInfo.algorithm){case"DES-CBC":o=8,p=e.des.createDecryptionCipher;break;case"DES-EDE3-CBC":o=24,p=e.des.createDecryptionCipher;break;case"AES-128-CBC":o=16,p=e.aes.createDecryptionCipher;break;case"AES-192-CBC":o=24,p=e.aes.createDecryptionCipher;break;case"AES-256-CBC":o=32,p=e.aes.createDecryptionCipher;break;case"RC2-40-CBC":o=5,p=function(t){return e.rc2.createDecryptionCipher(t,40)};break;case"RC2-64-CBC":o=8,p=function(t){return e.rc2.createDecryptionCipher(t,64)};break;case"RC2-128-CBC":o=16,p=function(t){return e.rc2.createDecryptionCipher(t,128)};break;default:var c;throw(c=new Error('Could not decrypt private key; unsupported encryption algorithm "'+i.dekInfo.algorithm+'".')).algorithm=i.dekInfo.algorithm,c}var y=e.util.hexToBytes(i.dekInfo.parameters),E=p(e.pbe.opensslDeriveBytes(s,y.substr(0,8),o));if(E.start(y),E.update(e.util.createBuffer(i.body)),!E.finish())return n;n=E.output.getBytes()}else n=i.body;return null!==(n="ENCRYPTED PRIVATE KEY"===i.type?a.decryptPrivateKeyInfo(r.fromDer(n),s):r.fromDer(n))&&(n=a.privateKeyFromAsn1(n)),n},a.pbe.generatePkcs12Key=function(t,r,a,s,n,i){var o,p;if(null==i){if(!("sha1"in e.md))throw new Error('"sha1" hash algorithm unavailable.');i=e.md.sha1.create()}var c=i.digestLength,y=i.blockLength,E=new e.util.ByteBuffer,C=new e.util.ByteBuffer;if(null!=t){for(p=0;p<t.length;p++)C.putInt16(t.charCodeAt(p));C.putInt16(0)}var d=C.length(),l=r.length(),u=new e.util.ByteBuffer;u.fillWithByte(a,y);var h=y*Math.ceil(l/y),S=new e.util.ByteBuffer;for(p=0;p<h;p++)S.putByte(r.at(p%l));var m=y*Math.ceil(d/y),f=new e.util.ByteBuffer;for(p=0;p<m;p++)f.putByte(C.at(p%d));var B=S;B.putBuffer(f);for(var g=Math.ceil(n/c),A=1;A<=g;A++){var T=new e.util.ByteBuffer;T.putBytes(u.bytes()),T.putBytes(B.bytes());for(var v=0;v<s;v++)i.start(),i.update(T.getBytes()),T=i.digest();var I=new e.util.ByteBuffer;for(p=0;p<y;p++)I.putByte(T.at(p%c));var R=Math.ceil(l/y)+Math.ceil(d/y),N=new e.util.ByteBuffer;for(o=0;o<R;o++){var P=new e.util.ByteBuffer(B.getBytes(y)),b=511;for(p=I.length()-1;p>=0;p--)b>>=8,b+=I.at(p)+P.at(p),P.setAt(p,255&b);N.putBuffer(P)}B=N,E.putBuffer(T)}return E.truncate(E.length()-n),E},a.pbe.getCipher=function(e,t,r){switch(e){case a.oids.pkcs5PBES2:return a.pbe.getCipherForPBES2(e,t,r);case a.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case a.oids["pbewithSHAAnd40BitRC2-CBC"]:return a.pbe.getCipherForPKCS12PBE(e,t,r);default:var s=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw s.oid=e,s.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],s}},a.pbe.getCipherForPBES2=function(t,s,n){var o,p={},y=[];if(!r.validate(s,i,p,y))throw(o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=y,o;if((t=r.derToOid(p.kdfOid))!==a.oids.pkcs5PBKDF2)throw(o=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.")).oid=t,o.supportedOids=["pkcs5PBKDF2"],o;if((t=r.derToOid(p.encOid))!==a.oids["aes128-CBC"]&&t!==a.oids["aes192-CBC"]&&t!==a.oids["aes256-CBC"]&&t!==a.oids["des-EDE3-CBC"]&&t!==a.oids.desCBC)throw(o=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.")).oid=t,o.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],o;var E,C,d=p.kdfSalt,l=e.util.createBuffer(p.kdfIterationCount);switch(l=l.getInt(l.length()<<3),a.oids[t]){case"aes128-CBC":E=16,C=e.aes.createDecryptionCipher;break;case"aes192-CBC":E=24,C=e.aes.createDecryptionCipher;break;case"aes256-CBC":E=32,C=e.aes.createDecryptionCipher;break;case"des-EDE3-CBC":E=24,C=e.des.createDecryptionCipher;break;case"desCBC":E=8,C=e.des.createDecryptionCipher}var u=c(p.prfOid),h=e.pkcs5.pbkdf2(n,d,l,E,u),S=p.encIv,m=C(h);return m.start(S),m},a.pbe.getCipherForPKCS12PBE=function(t,s,n){var i={},p=[];if(!r.validate(s,o,i,p))throw(u=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=p,u;var y,E,C,d=e.util.createBuffer(i.salt),l=e.util.createBuffer(i.iterations);switch(l=l.getInt(l.length()<<3),t){case a.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:y=24,E=8,C=e.des.startDecrypting;break;case a.oids["pbewithSHAAnd40BitRC2-CBC"]:y=5,E=8,C=function(t,r){var a=e.rc2.createDecryptionCipher(t,40);return a.start(r,null),a};break;default:var u;throw(u=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.")).oid=t,u}var h=c(i.prfOid),S=a.pbe.generatePkcs12Key(n,d,1,l,y,h);return h.start(),C(S,a.pbe.generatePkcs12Key(n,d,2,l,E,h))},a.pbe.opensslDeriveBytes=function(t,r,a,s){if(null==s){if(!("md5"in e.md))throw new Error('"md5" hash algorithm unavailable.');s=e.md.md5.create()}null===r&&(r="");for(var n=[p(s,t+r)],i=16,o=1;i<a;++o,i+=16)n.push(p(s,n[o-1]+t+r));return n.join("").substr(0,a)};
|
||
},{"./forge":"sQ2N","./aes":"bEBs","./asn1":"RZRC","./des":"ZV7X","./md":"2EAk","./oids":"F6JL","./pbkdf2":"3jih","./pem":"aepW","./random":"b05L","./rc2":"lkDF","./rsa":"a11z","./util":"2MJg"}],"AJ6b":[function(require,module,exports) {
|
||
"use strict";exports.get=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:self,t=e.crypto||e.msCrypto;if(!t||!t.subtle)throw Object.assign(new Error("Missing Web Crypto API. The most likely cause of this error is that this page is being accessed from an insecure context (i.e. not HTTPS). For more information and possible resolutions see https://github.com/libp2p/js-libp2p-crypto/blob/master/README.md#web-crypto-api"),{code:"ERR_MISSING_WEB_CRYPTO"});return t};
|
||
},{}],"8rxr":[function(require,module,exports) {
|
||
"use strict";function e(e,t,r,n,i,a,u){try{var s=e[a](u),o=s.value}catch(c){return void r(c)}s.done?t(o):Promise.resolve(o).then(n,i)}function t(t){return function(){var r=this,n=arguments;return new Promise(function(i,a){var u=t.apply(r,n);function s(t){e(u,i,a,s,o,"next",t)}function o(t){e(u,i,a,s,o,"throw",t)}s(void 0)})}}var r=require("uint8arrays/concat"),n=require("uint8arrays/from-string"),i=require("../webcrypto");function a(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=e.algorithm,u=void 0===a?"AES-GCM":a,s=e.nonceLength,o=void 0===s?12:s,c=e.keyLength,v=void 0===c?16:c,p=e.digest,l=void 0===p?"SHA-256":p,y=e.saltLength,d=void 0===y?16:y,m=e.iterations,h=void 0===m?32767:m,f=i.get();function g(){return(g=t(regeneratorRuntime.mark(function e(t,i){var a,s,c,p,y,m,g;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=f.getRandomValues(new Uint8Array(d)),s=f.getRandomValues(new Uint8Array(o)),c={name:u,iv:s},p={name:"PBKDF2",salt:a,iterations:h,hash:{name:l}},e.next=6,f.subtle.importKey("raw",n(i),{name:"PBKDF2"},!1,["deriveKey","deriveBits"]);case 6:return y=e.sent,e.next=9,f.subtle.deriveKey(p,y,{name:u,length:v},!0,["encrypt"]);case 9:return m=e.sent,e.next=12,f.subtle.encrypt(c,m,t);case 12:return g=e.sent,e.abrupt("return",r([a,c.iv,new Uint8Array(g)]));case 14:case"end":return e.stop()}},e)}))).apply(this,arguments)}function w(){return(w=t(regeneratorRuntime.mark(function e(t,r){var i,a,s,c,p,y,m,g;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.slice(0,d),a=t.slice(d,d+o),s=t.slice(d+o),c={name:u,iv:a},p={name:"PBKDF2",salt:i,iterations:h,hash:{name:l}},e.next=7,f.subtle.importKey("raw",n(r),{name:"PBKDF2"},!1,["deriveKey","deriveBits"]);case 7:return y=e.sent,e.next=10,f.subtle.deriveKey(p,y,{name:u,length:v},!0,["decrypt"]);case 10:return m=e.sent,e.next=13,f.subtle.decrypt(c,m,s);case 13:return g=e.sent,e.abrupt("return",new Uint8Array(g));case 15:case"end":return e.stop()}},e)}))).apply(this,arguments)}return v*=8,{encrypt:function(e,t){return g.apply(this,arguments)},decrypt:function(e,t){return w.apply(this,arguments)}}}module.exports={create:a};
|
||
},{"uint8arrays/concat":"qYui","uint8arrays/from-string":"YqS+","../webcrypto":"AJ6b"}],"vQxJ":[function(require,module,exports) {
|
||
"use strict";function e(e,r,t,n,u,i,o){try{var a=e[i](o),c=a.value}catch(s){return void t(s)}a.done?r(c):Promise.resolve(c).then(n,u)}function r(r){return function(){var t=this,n=arguments;return new Promise(function(u,i){var o=r.apply(t,n);function a(r){e(o,u,i,a,c,"next",r)}function c(r){e(o,u,i,a,c,"throw",r)}a(void 0)})}}var t=require("multibase"),n=require("../ciphers/aes-gcm");module.exports={import:function(){var e=r(regeneratorRuntime.mark(function e(r,u){var i,o,a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.names.base64,o=i.decode(r),a=n.create(),e.next=5,a.decrypt(o,u);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}},e)}));return function(r,t){return e.apply(this,arguments)}}()};
|
||
},{"multibase":"GEzr","../ciphers/aes-gcm":"8rxr"}],"K7IR":[function(require,module,exports) {
|
||
"use strict";function e(e,t,r,n,u,a,s){try{var i=e[a](s),o=i.value}catch(c){return void r(c)}i.done?t(o):Promise.resolve(o).then(n,u)}function t(t){return function(){var r=this,n=arguments;return new Promise(function(u,a){var s=t.apply(r,n);function i(t){e(s,u,a,i,o,"next",t)}function o(t){e(s,u,a,i,o,"throw",t)}i(void 0)})}}var r=require("multihashes"),n=self.crypto||self.msCrypto,u=function(){var e=t(regeneratorRuntime.mark(function e(t,r){var u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("undefined"!=typeof self&&n){e.next=2;break}throw new Error("Please use a browser with webcrypto support and ensure the code has been delivered securely via HTTPS/TLS and run within a Secure Context");case 2:e.t0=r,e.next="sha1"===e.t0?5:"sha2-256"===e.t0?10:"sha2-512"===e.t0?15:"dbl-sha2-256"===e.t0?20:28;break;case 5:return e.t1=Uint8Array,e.next=8,n.subtle.digest({name:"SHA-1"},t);case 8:return e.t2=e.sent,e.abrupt("return",new e.t1(e.t2));case 10:return e.t3=Uint8Array,e.next=13,n.subtle.digest({name:"SHA-256"},t);case 13:return e.t4=e.sent,e.abrupt("return",new e.t3(e.t4));case 15:return e.t5=Uint8Array,e.next=18,n.subtle.digest({name:"SHA-512"},t);case 18:return e.t6=e.sent,e.abrupt("return",new e.t5(e.t6));case 20:return e.next=22,n.subtle.digest({name:"SHA-256"},t);case 22:return u=e.sent,e.t7=Uint8Array,e.next=26,n.subtle.digest({name:"SHA-256"},u);case 26:return e.t8=e.sent,e.abrupt("return",new e.t7(e.t8));case 28:throw new Error("".concat(r," is not a supported algorithm"));case 29:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}();module.exports={factory:function(e){return function(){var r=t(regeneratorRuntime.mark(function t(r){return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",u(r,e));case 1:case"end":return t.stop()}},t)}));return function(e){return r.apply(this,arguments)}}()},digest:u,multihashing:function(){var e=t(regeneratorRuntime.mark(function e(t,n,a){var s;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u(t,n);case 2:return s=e.sent,e.abrupt("return",r.encode(s,n,a));case 4:case"end":return e.stop()}},e)}));return function(t,r,n){return e.apply(this,arguments)}}()};
|
||
},{"multihashes":"ubn9"}],"KQsE":[function(require,module,exports) {
|
||
var e=require("./forge");require("./md"),require("./util");var t=module.exports=e.sha512=e.sha512||{};e.md.sha512=e.md.algorithms.sha512=t;var a=e.sha384=e.sha512.sha384=e.sha512.sha384||{};a.create=function(){return t.create("SHA-384")},e.md.sha384=e.md.algorithms.sha384=a,e.sha512.sha256=e.sha512.sha256||{create:function(){return t.create("SHA-512/256")}},e.md["sha512/256"]=e.md.algorithms["sha512/256"]=e.sha512.sha256,e.sha512.sha224=e.sha512.sha224||{create:function(){return t.create("SHA-512/224")}},e.md["sha512/224"]=e.md.algorithms["sha512/224"]=e.sha512.sha224,t.create=function(t){if(s||l(),void 0===t&&(t="SHA-512"),!(t in h))throw new Error("Invalid SHA-512 algorithm: "+t);for(var a=h[t],n=null,u=e.util.createBuffer(),f=new Array(80),o=0;o<80;++o)f[o]=new Array(2);var i=64;switch(t){case"SHA-384":i=48;break;case"SHA-512/256":i=32;break;case"SHA-512/224":i=28}var c={algorithm:t.replace("-","").toLowerCase(),blockLength:128,digestLength:i,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){c.messageLength=0,c.fullMessageLength=c.messageLength128=[];for(var t=c.messageLengthSize/4,r=0;r<t;++r)c.fullMessageLength.push(0);u=e.util.createBuffer(),n=new Array(a.length);for(r=0;r<a.length;++r)n[r]=a[r].slice(0);return c}};return c.start(),c.update=function(t,a){"utf8"===a&&(t=e.util.encodeUtf8(t));var r=t.length;c.messageLength+=r,r=[r/4294967296>>>0,r>>>0];for(var s=c.fullMessageLength.length-1;s>=0;--s)c.fullMessageLength[s]+=r[1],r[1]=r[0]+(c.fullMessageLength[s]/4294967296>>>0),c.fullMessageLength[s]=c.fullMessageLength[s]>>>0,r[0]=r[1]/4294967296>>>0;return u.putBytes(t),g(n,f,u),(u.read>2048||0===u.length())&&u.compact(),c},c.digest=function(){var a=e.util.createBuffer();a.putBytes(u.bytes());var s,h=c.fullMessageLength[c.fullMessageLength.length-1]+c.messageLengthSize&c.blockLength-1;a.putBytes(r.substr(0,c.blockLength-h));for(var l=8*c.fullMessageLength[0],o=0;o<c.fullMessageLength.length-1;++o)l+=(s=8*c.fullMessageLength[o+1])/4294967296>>>0,a.putInt32(l>>>0),l=s>>>0;a.putInt32(l);var i=new Array(n.length);for(o=0;o<n.length;++o)i[o]=n[o].slice(0);g(i,f,a);var m,L=e.util.createBuffer();m="SHA-512"===t?i.length:"SHA-384"===t?i.length-2:i.length-4;for(o=0;o<m;++o)L.putInt32(i[o][0]),o===m-1&&"SHA-512/224"===t||L.putInt32(i[o][1]);return L},c};var r=null,s=!1,n=null,h=null;function l(){r=String.fromCharCode(128),r+=e.util.fillString(String.fromCharCode(0),128),n=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],(h={})["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],h["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],h["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],h["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],s=!0}function g(e,t,a){for(var r,s,h,l,g,u,f,o,i,c,m,L,S,d,A,v,H,M,p,w,y,b,B,I,k,C,q,z,x,E,U,j,D,F=a.length();F>=128;){for(q=0;q<16;++q)t[q][0]=a.getInt32()>>>0,t[q][1]=a.getInt32()>>>0;for(;q<80;++q)r=(((z=(E=t[q-2])[0])>>>19|(x=E[1])<<13)^(x>>>29|z<<3)^z>>>6)>>>0,s=((z<<13|x>>>19)^(x<<3|z>>>29)^(z<<26|x>>>6))>>>0,h=(((z=(j=t[q-15])[0])>>>1|(x=j[1])<<31)^(z>>>8|x<<24)^z>>>7)>>>0,l=((z<<31|x>>>1)^(z<<24|x>>>8)^(z<<25|x>>>7))>>>0,U=t[q-7],D=t[q-16],x=s+U[1]+l+D[1],t[q][0]=r+U[0]+h+D[0]+(x/4294967296>>>0)>>>0,t[q][1]=x>>>0;for(m=e[0][0],L=e[0][1],S=e[1][0],d=e[1][1],A=e[2][0],v=e[2][1],H=e[3][0],M=e[3][1],p=e[4][0],w=e[4][1],y=e[5][0],b=e[5][1],B=e[6][0],I=e[6][1],k=e[7][0],C=e[7][1],q=0;q<80;++q)f=((p>>>14|w<<18)^(p>>>18|w<<14)^(w>>>9|p<<23))>>>0,o=(B^p&(y^B))>>>0,g=((m>>>28|L<<4)^(L>>>2|m<<30)^(L>>>7|m<<25))>>>0,u=((m<<4|L>>>28)^(L<<30|m>>>2)^(L<<25|m>>>7))>>>0,i=(m&S|A&(m^S))>>>0,c=(L&d|v&(L^d))>>>0,x=C+(((p<<18|w>>>14)^(p<<14|w>>>18)^(w<<23|p>>>9))>>>0)+((I^w&(b^I))>>>0)+n[q][1]+t[q][1],r=k+f+o+n[q][0]+t[q][0]+(x/4294967296>>>0)>>>0,s=x>>>0,h=g+i+((x=u+c)/4294967296>>>0)>>>0,l=x>>>0,k=B,C=I,B=y,I=b,y=p,b=w,p=H+r+((x=M+s)/4294967296>>>0)>>>0,w=x>>>0,H=A,M=v,A=S,v=d,S=m,d=L,m=r+h+((x=s+l)/4294967296>>>0)>>>0,L=x>>>0;x=e[0][1]+L,e[0][0]=e[0][0]+m+(x/4294967296>>>0)>>>0,e[0][1]=x>>>0,x=e[1][1]+d,e[1][0]=e[1][0]+S+(x/4294967296>>>0)>>>0,e[1][1]=x>>>0,x=e[2][1]+v,e[2][0]=e[2][0]+A+(x/4294967296>>>0)>>>0,e[2][1]=x>>>0,x=e[3][1]+M,e[3][0]=e[3][0]+H+(x/4294967296>>>0)>>>0,e[3][1]=x>>>0,x=e[4][1]+w,e[4][0]=e[4][0]+p+(x/4294967296>>>0)>>>0,e[4][1]=x>>>0,x=e[5][1]+b,e[5][0]=e[5][0]+y+(x/4294967296>>>0)>>>0,e[5][1]=x>>>0,x=e[6][1]+I,e[6][0]=e[6][0]+B+(x/4294967296>>>0)>>>0,e[6][1]=x>>>0,x=e[7][1]+C,e[7][0]=e[7][0]+k+(x/4294967296>>>0)>>>0,e[7][1]=x>>>0,F-=128}}
|
||
},{"./forge":"sQ2N","./md":"2EAk","./util":"2MJg"}],"YxFe":[function(require,module,exports) {
|
||
var e=require("./forge");require("./asn1");var t=e.asn1;exports.privateKeyValidator={name:"PrivateKeyInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},exports.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{tagClass:t.Class.UNIVERSAL,type:t.Type.BITSTRING,constructed:!1,composed:!0,captureBitStringValue:"ed25519PublicKey"}]};
|
||
},{"./forge":"sQ2N","./asn1":"RZRC"}],"qHh2":[function(require,module,exports) {
|
||
var Buffer = require("buffer").Buffer;
|
||
var r=require("buffer").Buffer,n=require("./forge");require("./jsbn"),require("./random"),require("./sha512"),require("./util");var o=require("./asn1-validator"),t=o.publicKeyValidator,e=o.privateKeyValidator;if(void 0===a)var a=n.jsbn.BigInteger;var i=n.util.ByteBuffer,f=void 0===r?Uint8Array:r;n.pki=n.pki||{},module.exports=n.pki.ed25519=n.ed25519=n.ed25519||{};var s=n.ed25519;function u(n){var o=n.message;if(o instanceof Uint8Array||o instanceof f)return o;var t=n.encoding;if(void 0===o){if(!n.md)throw new TypeError('"options.message" or "options.md" not specified.');o=n.md.digest().getBytes(),t="binary"}if("string"==typeof o&&!t)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if("string"==typeof o){if(void 0!==r)return r.from(o,t);o=new i(o,t)}else if(!(o instanceof i))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');for(var e=new f(o.length()),a=0;a<e.length;++a)e[a]=o.at(a);return e}s.constants={},s.constants.PUBLIC_KEY_BYTE_LENGTH=32,s.constants.PRIVATE_KEY_BYTE_LENGTH=64,s.constants.SEED_BYTE_LENGTH=32,s.constants.SIGN_BYTE_LENGTH=64,s.constants.HASH_BYTE_LENGTH=64,s.generateKeyPair=function(r){var o=(r=r||{}).seed;if(void 0===o)o=n.random.getBytesSync(s.constants.SEED_BYTE_LENGTH);else if("string"==typeof o){if(o.length!==s.constants.SEED_BYTE_LENGTH)throw new TypeError('"seed" must be '+s.constants.SEED_BYTE_LENGTH+" bytes in length.")}else if(!(o instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, Uint8Array, or a binary string.');o=u({message:o,encoding:"binary"});for(var t=new f(s.constants.PUBLIC_KEY_BYTE_LENGTH),e=new f(s.constants.PRIVATE_KEY_BYTE_LENGTH),a=0;a<32;++a)e[a]=o[a];return d(t,e),{publicKey:t,privateKey:e}},s.privateKeyFromAsn1=function(r){var o={},t=[];if(!n.asn1.validate(r,e,o,t)){var a=new Error("Invalid Key.");throw a.errors=t,a}var i=n.asn1.derToOid(o.privateKeyOid),f=n.oids.EdDSA25519;if(i!==f)throw new Error('Invalid OID "'+i+'"; OID must be "'+f+'".');var s=o.privateKey;return{privateKeyBytes:u({message:n.asn1.fromDer(s).value,encoding:"binary"})}},s.publicKeyFromAsn1=function(r){var o={},e=[];if(!n.asn1.validate(r,t,o,e)){var a=new Error("Invalid Key.");throw a.errors=e,a}var i=n.asn1.derToOid(o.publicKeyOid),f=n.oids.EdDSA25519;if(i!==f)throw new Error('Invalid OID "'+i+'"; OID must be "'+f+'".');var E=o.ed25519PublicKey;if(E.length!==s.constants.PUBLIC_KEY_BYTE_LENGTH)throw new Error("Key length is invalid.");return u({message:E,encoding:"binary"})},s.publicKeyFromPrivateKey=function(r){var n=u({message:(r=r||{}).privateKey,encoding:"binary"});if(n.length!==s.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+s.constants.PRIVATE_KEY_BYTE_LENGTH);for(var o=new f(s.constants.PUBLIC_KEY_BYTE_LENGTH),t=0;t<o.length;++t)o[t]=n[32+t];return o},s.sign=function(r){var n=u(r=r||{}),o=u({message:r.privateKey,encoding:"binary"});if(o.length===s.constants.SEED_BYTE_LENGTH)o=s.generateKeyPair({seed:o}).privateKey;else if(o.length!==s.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+s.constants.SEED_BYTE_LENGTH+" or "+s.constants.PRIVATE_KEY_BYTE_LENGTH);var t=new f(s.constants.SIGN_BYTE_LENGTH+n.length);B(t,n,n.length,o);for(var e=new f(s.constants.SIGN_BYTE_LENGTH),a=0;a<e.length;++a)e[a]=t[a];return e},s.verify=function(r){var n=u(r=r||{});if(void 0===r.signature)throw new TypeError('"options.signature" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a binary string.');var o=u({message:r.signature,encoding:"binary"});if(o.length!==s.constants.SIGN_BYTE_LENGTH)throw new TypeError('"options.signature" must have a byte length of '+s.constants.SIGN_BYTE_LENGTH);var t=u({message:r.publicKey,encoding:"binary"});if(t.length!==s.constants.PUBLIC_KEY_BYTE_LENGTH)throw new TypeError('"options.publicKey" must have a byte length of '+s.constants.PUBLIC_KEY_BYTE_LENGTH);var e,a=new f(s.constants.SIGN_BYTE_LENGTH+n.length),i=new f(s.constants.SIGN_BYTE_LENGTH+n.length);for(e=0;e<s.constants.SIGN_BYTE_LENGTH;++e)a[e]=o[e];for(e=0;e<n.length;++e)a[e+s.constants.SIGN_BYTE_LENGTH]=n[e];return w(i,a,a.length,t)>=0};var E=C(),c=C([1]),v=C([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),l=C([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),h=C([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),y=C([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),T=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),g=C([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function _(o,t){var e=n.md.sha512.create(),a=new i(o);e.update(a.getBytes(t),"binary");var u=e.digest().getBytes();if(void 0!==r)return r.from(u,"binary");for(var E=new f(s.constants.HASH_BYTE_LENGTH),c=0;c<64;++c)E[c]=u.charCodeAt(c);return E}function d(r,n){var o,t=[C(),C(),C(),C()],e=_(n,32);for(e[0]&=248,e[31]&=127,e[31]|=64,D(t,e),N(r,t),o=0;o<32;++o)n[o+32]=r[o];return 0}function B(r,n,o,t){var e,a,i=new Float64Array(64),f=[C(),C(),C(),C()],s=_(t,32);s[0]&=248,s[31]&=127,s[31]|=64;var u=o+64;for(e=0;e<o;++e)r[64+e]=n[e];for(e=0;e<32;++e)r[32+e]=s[32+e];var E=_(r.subarray(32),o+32);for(Y(E),D(f,E),N(r,f),e=32;e<64;++e)r[e]=t[e];var c=_(r,o+64);for(Y(c),e=32;e<64;++e)i[e]=0;for(e=0;e<32;++e)i[e]=E[e];for(e=0;e<32;++e)for(a=0;a<32;a++)i[e+a]+=c[e]*s[a];return p(r.subarray(32),i),u}function w(r,n,o,t){var e,a=new f(32),i=[C(),C(),C(),C()],s=[C(),C(),C(),C()];if(-1,o<64)return-1;if(L(s,t))return-1;for(e=0;e<o;++e)r[e]=n[e];for(e=0;e<32;++e)r[e+32]=t[e];var u=_(r,o);if(Y(u),P(i,s,u),D(s,n.subarray(32)),b(i,s),N(a,i),o-=64,I(n,0,a,0)){for(e=0;e<o;++e)r[e]=0;return-1}for(e=0;e<o;++e)r[e]=n[e+64];return o}function p(r,n){var o,t,e,a;for(t=63;t>=32;--t){for(o=0,e=t-32,a=t-12;e<a;++e)n[e]+=o-16*n[t]*T[e-(t-32)],o=n[e]+128>>8,n[e]-=256*o;n[e]+=o,n[t]=0}for(o=0,e=0;e<32;++e)n[e]+=o-(n[31]>>4)*T[e],o=n[e]>>8,n[e]&=255;for(e=0;e<32;++e)n[e]-=o*T[e];for(t=0;t<32;++t)n[t+1]+=n[t]>>8,r[t]=255&n[t]}function Y(r){for(var n=new Float64Array(64),o=0;o<64;++o)n[o]=r[o],r[o]=0;p(r,n)}function b(r,n){var o=C(),t=C(),e=C(),a=C(),i=C(),f=C(),s=C(),u=C(),E=C();R(o,r[1],r[0]),R(E,n[1],n[0]),k(o,o,E),F(t,r[0],r[1]),F(E,n[0],n[1]),k(t,t,E),k(e,r[3],n[3]),k(e,e,l),k(a,r[2],n[2]),F(a,a,a),R(i,t,o),R(f,a,e),F(s,a,e),F(u,t,o),k(r[0],i,f),k(r[1],u,s),k(r[2],s,f),k(r[3],i,u)}function G(r,n,o){for(var t=0;t<4;++t)q(r[t],n[t],o)}function N(r,n){var o=C(),t=C(),e=C();O(e,n[2]),k(o,n[0],e),k(t,n[1],e),K(r,t),r[31]^=S(o)<<7}function K(r,n){var o,t,e,a=C(),i=C();for(o=0;o<16;++o)i[o]=n[o];for(V(i),V(i),V(i),t=0;t<2;++t){for(a[0]=i[0]-65517,o=1;o<15;++o)a[o]=i[o]-65535-(a[o-1]>>16&1),a[o-1]&=65535;a[15]=i[15]-32767-(a[14]>>16&1),e=a[15]>>16&1,a[14]&=65535,q(i,a,1-e)}for(o=0;o<16;o++)r[2*o]=255&i[o],r[2*o+1]=i[o]>>8}function L(r,n){var o=C(),t=C(),e=C(),a=C(),i=C(),f=C(),s=C();return U(r[2],c),m(r[1],n),j(e,r[1]),k(a,e,v),R(e,e,r[2]),F(a,r[2],a),j(i,a),j(f,i),k(s,f,i),k(o,s,e),k(o,o,a),H(o,o),k(o,o,e),k(o,o,a),k(o,o,a),k(r[0],o,a),j(t,r[0]),k(t,t,a),M(t,e)&&k(r[0],r[0],g),j(t,r[0]),k(t,t,a),M(t,e)?-1:(S(r[0])===n[31]>>7&&R(r[0],E,r[0]),k(r[3],r[0],r[1]),0)}function m(r,n){var o;for(o=0;o<16;++o)r[o]=n[2*o]+(n[2*o+1]<<8);r[15]&=32767}function H(r,n){var o,t=C();for(o=0;o<16;++o)t[o]=n[o];for(o=250;o>=0;--o)j(t,t),1!==o&&k(t,t,n);for(o=0;o<16;++o)r[o]=t[o]}function M(r,n){var o=new f(32),t=new f(32);return K(o,r),K(t,n),I(o,0,t,0)}function I(r,n,o,t){return A(r,n,o,t,32)}function A(r,n,o,t,e){var a,i=0;for(a=0;a<e;++a)i|=r[n+a]^o[t+a];return(1&i-1>>>8)-1}function S(r){var n=new f(32);return K(n,r),1&n[0]}function P(r,n,o){var t,e;for(U(r[0],E),U(r[1],c),U(r[2],c),U(r[3],E),e=255;e>=0;--e)G(r,n,t=o[e/8|0]>>(7&e)&1),b(n,r),b(r,r),G(r,n,t)}function D(r,n){var o=[C(),C(),C(),C()];U(o[0],h),U(o[1],y),U(o[2],c),k(o[3],h,y),P(r,o,n)}function U(r,n){var o;for(o=0;o<16;o++)r[o]=0|n[o]}function O(r,n){var o,t=C();for(o=0;o<16;++o)t[o]=n[o];for(o=253;o>=0;--o)j(t,t),2!==o&&4!==o&&k(t,t,n);for(o=0;o<16;++o)r[o]=t[o]}function V(r){var n,o,t=1;for(n=0;n<16;++n)o=r[n]+t+65535,t=Math.floor(o/65536),r[n]=o-65536*t;r[0]+=t-1+37*(t-1)}function q(r,n,o){for(var t,e=~(o-1),a=0;a<16;++a)t=e&(r[a]^n[a]),r[a]^=t,n[a]^=t}function C(r){var n,o=new Float64Array(16);if(r)for(n=0;n<r.length;++n)o[n]=r[n];return o}function F(r,n,o){for(var t=0;t<16;++t)r[t]=n[t]+o[t]}function R(r,n,o){for(var t=0;t<16;++t)r[t]=n[t]-o[t]}function j(r,n){k(r,n,n)}function k(r,n,o){var t,e,a=0,i=0,f=0,s=0,u=0,E=0,c=0,v=0,l=0,h=0,y=0,T=0,g=0,_=0,d=0,B=0,w=0,p=0,Y=0,b=0,G=0,N=0,K=0,L=0,m=0,H=0,M=0,I=0,A=0,S=0,P=0,D=o[0],U=o[1],O=o[2],V=o[3],q=o[4],C=o[5],F=o[6],R=o[7],j=o[8],k=o[9],x=o[10],z=o[11],J=o[12],Q=o[13],W=o[14],X=o[15];a+=(t=n[0])*D,i+=t*U,f+=t*O,s+=t*V,u+=t*q,E+=t*C,c+=t*F,v+=t*R,l+=t*j,h+=t*k,y+=t*x,T+=t*z,g+=t*J,_+=t*Q,d+=t*W,B+=t*X,i+=(t=n[1])*D,f+=t*U,s+=t*O,u+=t*V,E+=t*q,c+=t*C,v+=t*F,l+=t*R,h+=t*j,y+=t*k,T+=t*x,g+=t*z,_+=t*J,d+=t*Q,B+=t*W,w+=t*X,f+=(t=n[2])*D,s+=t*U,u+=t*O,E+=t*V,c+=t*q,v+=t*C,l+=t*F,h+=t*R,y+=t*j,T+=t*k,g+=t*x,_+=t*z,d+=t*J,B+=t*Q,w+=t*W,p+=t*X,s+=(t=n[3])*D,u+=t*U,E+=t*O,c+=t*V,v+=t*q,l+=t*C,h+=t*F,y+=t*R,T+=t*j,g+=t*k,_+=t*x,d+=t*z,B+=t*J,w+=t*Q,p+=t*W,Y+=t*X,u+=(t=n[4])*D,E+=t*U,c+=t*O,v+=t*V,l+=t*q,h+=t*C,y+=t*F,T+=t*R,g+=t*j,_+=t*k,d+=t*x,B+=t*z,w+=t*J,p+=t*Q,Y+=t*W,b+=t*X,E+=(t=n[5])*D,c+=t*U,v+=t*O,l+=t*V,h+=t*q,y+=t*C,T+=t*F,g+=t*R,_+=t*j,d+=t*k,B+=t*x,w+=t*z,p+=t*J,Y+=t*Q,b+=t*W,G+=t*X,c+=(t=n[6])*D,v+=t*U,l+=t*O,h+=t*V,y+=t*q,T+=t*C,g+=t*F,_+=t*R,d+=t*j,B+=t*k,w+=t*x,p+=t*z,Y+=t*J,b+=t*Q,G+=t*W,N+=t*X,v+=(t=n[7])*D,l+=t*U,h+=t*O,y+=t*V,T+=t*q,g+=t*C,_+=t*F,d+=t*R,B+=t*j,w+=t*k,p+=t*x,Y+=t*z,b+=t*J,G+=t*Q,N+=t*W,K+=t*X,l+=(t=n[8])*D,h+=t*U,y+=t*O,T+=t*V,g+=t*q,_+=t*C,d+=t*F,B+=t*R,w+=t*j,p+=t*k,Y+=t*x,b+=t*z,G+=t*J,N+=t*Q,K+=t*W,L+=t*X,h+=(t=n[9])*D,y+=t*U,T+=t*O,g+=t*V,_+=t*q,d+=t*C,B+=t*F,w+=t*R,p+=t*j,Y+=t*k,b+=t*x,G+=t*z,N+=t*J,K+=t*Q,L+=t*W,m+=t*X,y+=(t=n[10])*D,T+=t*U,g+=t*O,_+=t*V,d+=t*q,B+=t*C,w+=t*F,p+=t*R,Y+=t*j,b+=t*k,G+=t*x,N+=t*z,K+=t*J,L+=t*Q,m+=t*W,H+=t*X,T+=(t=n[11])*D,g+=t*U,_+=t*O,d+=t*V,B+=t*q,w+=t*C,p+=t*F,Y+=t*R,b+=t*j,G+=t*k,N+=t*x,K+=t*z,L+=t*J,m+=t*Q,H+=t*W,M+=t*X,g+=(t=n[12])*D,_+=t*U,d+=t*O,B+=t*V,w+=t*q,p+=t*C,Y+=t*F,b+=t*R,G+=t*j,N+=t*k,K+=t*x,L+=t*z,m+=t*J,H+=t*Q,M+=t*W,I+=t*X,_+=(t=n[13])*D,d+=t*U,B+=t*O,w+=t*V,p+=t*q,Y+=t*C,b+=t*F,G+=t*R,N+=t*j,K+=t*k,L+=t*x,m+=t*z,H+=t*J,M+=t*Q,I+=t*W,A+=t*X,d+=(t=n[14])*D,B+=t*U,w+=t*O,p+=t*V,Y+=t*q,b+=t*C,G+=t*F,N+=t*R,K+=t*j,L+=t*k,m+=t*x,H+=t*z,M+=t*J,I+=t*Q,A+=t*W,S+=t*X,B+=(t=n[15])*D,i+=38*(p+=t*O),f+=38*(Y+=t*V),s+=38*(b+=t*q),u+=38*(G+=t*C),E+=38*(N+=t*F),c+=38*(K+=t*R),v+=38*(L+=t*j),l+=38*(m+=t*k),h+=38*(H+=t*x),y+=38*(M+=t*z),T+=38*(I+=t*J),g+=38*(A+=t*Q),_+=38*(S+=t*W),d+=38*(P+=t*X),a=(t=(a+=38*(w+=t*U))+(e=1)+65535)-65536*(e=Math.floor(t/65536)),i=(t=i+e+65535)-65536*(e=Math.floor(t/65536)),f=(t=f+e+65535)-65536*(e=Math.floor(t/65536)),s=(t=s+e+65535)-65536*(e=Math.floor(t/65536)),u=(t=u+e+65535)-65536*(e=Math.floor(t/65536)),E=(t=E+e+65535)-65536*(e=Math.floor(t/65536)),c=(t=c+e+65535)-65536*(e=Math.floor(t/65536)),v=(t=v+e+65535)-65536*(e=Math.floor(t/65536)),l=(t=l+e+65535)-65536*(e=Math.floor(t/65536)),h=(t=h+e+65535)-65536*(e=Math.floor(t/65536)),y=(t=y+e+65535)-65536*(e=Math.floor(t/65536)),T=(t=T+e+65535)-65536*(e=Math.floor(t/65536)),g=(t=g+e+65535)-65536*(e=Math.floor(t/65536)),_=(t=_+e+65535)-65536*(e=Math.floor(t/65536)),d=(t=d+e+65535)-65536*(e=Math.floor(t/65536)),B=(t=B+e+65535)-65536*(e=Math.floor(t/65536)),a=(t=(a+=e-1+37*(e-1))+(e=1)+65535)-65536*(e=Math.floor(t/65536)),i=(t=i+e+65535)-65536*(e=Math.floor(t/65536)),f=(t=f+e+65535)-65536*(e=Math.floor(t/65536)),s=(t=s+e+65535)-65536*(e=Math.floor(t/65536)),u=(t=u+e+65535)-65536*(e=Math.floor(t/65536)),E=(t=E+e+65535)-65536*(e=Math.floor(t/65536)),c=(t=c+e+65535)-65536*(e=Math.floor(t/65536)),v=(t=v+e+65535)-65536*(e=Math.floor(t/65536)),l=(t=l+e+65535)-65536*(e=Math.floor(t/65536)),h=(t=h+e+65535)-65536*(e=Math.floor(t/65536)),y=(t=y+e+65535)-65536*(e=Math.floor(t/65536)),T=(t=T+e+65535)-65536*(e=Math.floor(t/65536)),g=(t=g+e+65535)-65536*(e=Math.floor(t/65536)),_=(t=_+e+65535)-65536*(e=Math.floor(t/65536)),d=(t=d+e+65535)-65536*(e=Math.floor(t/65536)),B=(t=B+e+65535)-65536*(e=Math.floor(t/65536)),a+=e-1+37*(e-1),r[0]=a,r[1]=i,r[2]=f,r[3]=s,r[4]=u,r[5]=E,r[6]=c,r[7]=v,r[8]=l,r[9]=h,r[10]=y,r[11]=T,r[12]=g,r[13]=_,r[14]=d,r[15]=B}
|
||
},{"./forge":"sQ2N","./jsbn":"vnLg","./random":"b05L","./sha512":"KQsE","./util":"2MJg","./asn1-validator":"YxFe","buffer":"sC8V"}],"aksM":[function(require,module,exports) {
|
||
"use strict";var r=65536;function a(a){var e=new Uint8Array(a),t=0;if(a>0)if(a>r)for(;t<a;)t+r>a?(crypto.getRandomValues(e.subarray(t,t+(a-t))),t+=a-t):(crypto.getRandomValues(e.subarray(t,t+r)),t+=r);else crypto.getRandomValues(e);return e}module.exports=a;
|
||
},{}],"qZiD":[function(require,module,exports) {
|
||
"use strict";var r=require("iso-random-stream/src/random"),e=require("err-code");module.exports=function(t){if(isNaN(t)||t<=0)throw e(new Error("random bytes length must be a Number bigger than 0"),"ERR_INVALID_LENGTH");return r(t)};
|
||
},{"iso-random-stream/src/random":"aksM","err-code":"hLMW"}],"Cj+T":[function(require,module,exports) {
|
||
"use strict";require("node-forge/lib/util"),require("node-forge/lib/jsbn");var r=require("node-forge/lib/forge"),e=require("uint8arrays/from-string"),n=require("uint8arrays/to-string"),t=require("uint8arrays/concat");exports.bigIntegerToUintBase64url=function(r,e){var i=Uint8Array.from(r.abs().toByteArray());if(i=0===i[0]?i.slice(1):i,null!=e){if(i.length>e)throw new Error("byte array longer than desired length");i=t([new Uint8Array(e-i.length),i])}return n(i,"base64url")},exports.base64urlToBigInteger=function(e){var t=exports.base64urlToBuffer(e);return new r.jsbn.BigInteger(n(t,"base16"),16)},exports.base64urlToBuffer=function(r,n){var i=e(r,"base64urlpad");if(null!=n){if(i.length>n)throw new Error("byte array longer than desired length");i=t([new Uint8Array(n-i.length),i])}return i};
|
||
},{"node-forge/lib/util":"2MJg","node-forge/lib/jsbn":"vnLg","node-forge/lib/forge":"sQ2N","uint8arrays/from-string":"YqS+","uint8arrays/to-string":"aFN1","uint8arrays/concat":"qYui"}],"wRJU":[function(require,module,exports) {
|
||
"use strict";require("node-forge/lib/asn1"),require("node-forge/lib/rsa");var e=require("node-forge/lib/forge"),r=require("./../util"),i=r.bigIntegerToUintBase64url,n=r.base64urlToBigInteger,t=require("uint8arrays/from-string"),o=require("uint8arrays/to-string");exports.pkcs1ToJwk=function(r){var n=e.asn1.fromDer(o(r,"ascii")),t=e.pki.privateKeyFromAsn1(n);return{kty:"RSA",n:i(t.n),e:i(t.e),d:i(t.d),p:i(t.p),q:i(t.q),dp:i(t.dP),dq:i(t.dQ),qi:i(t.qInv),alg:"RS256",kid:"2011-04-29"}},exports.jwkToPkcs1=function(r){var i=e.pki.privateKeyToAsn1({n:n(r.n),e:n(r.e),d:n(r.d),p:n(r.p),q:n(r.q),dP:n(r.dp),dQ:n(r.dq),qInv:n(r.qi)});return t(e.asn1.toDer(i).getBytes(),"ascii")},exports.pkixToJwk=function(r){var n=e.asn1.fromDer(o(r,"ascii")),t=e.pki.publicKeyFromAsn1(n);return{kty:"RSA",n:i(t.n),e:i(t.e),alg:"RS256",kid:"2011-04-29"}},exports.jwkToPkix=function(r){var i=e.pki.publicKeyToAsn1({n:n(r.n),e:n(r.e)});return t(e.asn1.toDer(i).getBytes(),"ascii")};
|
||
},{"node-forge/lib/asn1":"RZRC","node-forge/lib/rsa":"a11z","node-forge/lib/forge":"sQ2N","./../util":"Cj+T","uint8arrays/from-string":"YqS+","uint8arrays/to-string":"aFN1"}],"uQ1D":[function(require,module,exports) {
|
||
"use strict";function r(r){return o(r)||n(r)||t(r)||e()}function e(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function t(r,e){if(r){if("string"==typeof r)return i(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?i(r,e):void 0}}function n(r){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(r))return Array.from(r)}function o(r){if(Array.isArray(r))return i(r)}function i(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}require("node-forge/lib/rsa");var a=require("node-forge/lib/forge"),u=require("../util"),c=u.base64urlToBigInteger;function f(r,e){return e.map(function(e){return c(r[e])})}function l(e){var t;return(t=a.pki).setRsaPrivateKey.apply(t,r(f(e,["n","e","d","p","q","dp","dq","qi"])))}function p(e){var t;return(t=a.pki).setRsaPublicKey.apply(t,r(f(e,["n","e"])))}module.exports={jwk2pub:p,jwk2priv:l};
|
||
},{"node-forge/lib/rsa":"a11z","node-forge/lib/forge":"sQ2N","../util":"Cj+T"}],"xqoX":[function(require,module,exports) {
|
||
"use strict";function e(e,r,t,n,u,a,i){try{var s=e[a](i),o=s.value}catch(c){return void t(c)}s.done?r(o):Promise.resolve(o).then(n,u)}function r(r){return function(){var t=this,n=arguments;return new Promise(function(u,a){var i=r.apply(t,n);function s(r){e(i,u,a,s,o,"next",r)}function o(r){e(i,u,a,s,o,"throw",r)}s(void 0)})}}var t=require("../webcrypto"),n=require("../random-bytes"),u=require("uint8arrays/to-string"),a=require("uint8arrays/from-string");function i(e){return Promise.all([t.get().subtle.exportKey("jwk",e.privateKey),t.get().subtle.exportKey("jwk",e.publicKey)])}function s(e){return t.get().subtle.importKey("jwk",{kty:e.kty,n:e.n,e:e.e},{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"])}exports.utils=require("./rsa-utils"),exports.generateKey=function(){var e=r(regeneratorRuntime.mark(function e(r){var n,u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.get().subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:r,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]);case 2:return n=e.sent,e.next=5,i(n);case 5:return u=e.sent,e.abrupt("return",{privateKey:u[0],publicKey:u[1]});case 7:case"end":return e.stop()}},e)}));return function(r){return e.apply(this,arguments)}}(),exports.unmarshalPrivateKey=function(){var e=r(regeneratorRuntime.mark(function e(r){var n,u,a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.get().subtle.importKey("jwk",r,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]);case 2:return n=e.sent,e.t0=n,e.next=6,s(r);case 6:return e.t1=e.sent,u=[e.t0,e.t1],e.next=10,i({privateKey:u[0],publicKey:u[1]});case 10:return a=e.sent,e.abrupt("return",{privateKey:a[0],publicKey:a[1]});case 12:case"end":return e.stop()}},e)}));return function(r){return e.apply(this,arguments)}}(),exports.getRandomValues=n,exports.hashAndSign=function(){var e=r(regeneratorRuntime.mark(function e(r,n){var u,a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.get().subtle.importKey("jwk",r,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]);case 2:return u=e.sent,e.next=5,t.get().subtle.sign({name:"RSASSA-PKCS1-v1_5"},u,Uint8Array.from(n));case 5:return a=e.sent,e.abrupt("return",new Uint8Array(a,a.byteOffset,a.byteLength));case 7:case"end":return e.stop()}},e)}));return function(r,t){return e.apply(this,arguments)}}(),exports.hashAndVerify=function(){var e=r(regeneratorRuntime.mark(function e(r,n,u){var a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.get().subtle.importKey("jwk",r,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]);case 2:return a=e.sent,e.abrupt("return",t.get().subtle.verify({name:"RSASSA-PKCS1-v1_5"},a,n,u));case 4:case"end":return e.stop()}},e)}));return function(r,t,n){return e.apply(this,arguments)}}();var o=require("./jwk2pem"),c=o.jwk2pub,p=o.jwk2priv;function y(e,r,t,n){var i=r?c(e):p(e),s=n(u(Uint8Array.from(t),"ascii"),i);return a(s,"ascii")}exports.encrypt=function(e,r){return y(e,!0,r,function(e,r){return r.encrypt(e)})},exports.decrypt=function(e,r){return y(e,!1,r,function(e,r){return r.decrypt(e)})};
|
||
},{"../webcrypto":"AJ6b","../random-bytes":"qZiD","uint8arrays/to-string":"aFN1","uint8arrays/from-string":"YqS+","./rsa-utils":"wRJU","./jwk2pem":"uQ1D"}],"PaZH":[function(require,module,exports) {
|
||
"use strict";function e(e,r,n,t,u,o,a){try{var i=e[o](a),c=i.value}catch(s){return void n(s)}i.done?r(c):Promise.resolve(c).then(t,u)}function r(r){return function(){var n=this,t=arguments;return new Promise(function(u,o){var a=r.apply(n,t);function i(r){e(a,u,o,i,c,"next",r)}function c(r){e(a,u,o,i,c,"throw",r)}i(void 0)})}}var n=require("multibase"),t=require("../ciphers/aes-gcm");module.exports={export:function(){var e=r(regeneratorRuntime.mark(function e(r,u){var o,a,i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return o=t.create(),e.next=3,o.encrypt(r,u);case 3:return a=e.sent,i=n.names.base64,e.abrupt("return",i.encode(a));case 6:case"end":return e.stop()}},e)}));return function(r,n){return e.apply(this,arguments)}}()};
|
||
},{"multibase":"GEzr","../ciphers/aes-gcm":"8rxr"}],"1kBn":[function(require,module,exports) {
|
||
"use strict";function e(e,r,t,n,u,i,a){try{var s=e[i](a),o=s.value}catch(c){return void t(c)}s.done?r(o):Promise.resolve(o).then(n,u)}function r(r){return function(){var t=this,n=arguments;return new Promise(function(u,i){var a=r.apply(t,n);function s(r){e(a,u,i,s,o,"next",r)}function o(r){e(a,u,i,s,o,"throw",r)}s(void 0)})}}function t(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function n(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,r,t){return r&&n(e.prototype,r),t&&n(e,t),e}var i=require("multihashing-async/src/sha"),a=require("err-code"),s=require("uint8arrays/equals"),o=require("uint8arrays/to-string");require("node-forge/lib/sha512"),require("node-forge/lib/ed25519");var c=require("node-forge/lib/forge"),p=require("./rsa"),f=require("./keys"),h=require("./exporter"),y=function(){function e(r){t(this,e),this._key=r}return u(e,[{key:"verify",value:function(){var e=r(regeneratorRuntime.mark(function e(r,t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",p.hashAndVerify(this._key,t,r));case 1:case"end":return e.stop()}},e,this)}));return function(r,t){return e.apply(this,arguments)}}()},{key:"marshal",value:function(){return p.utils.jwkToPkix(this._key)}},{key:"bytes",get:function(){return f.PublicKey.encode({Type:f.KeyType.RSA,Data:this.marshal()}).finish()}},{key:"encrypt",value:function(e){return p.encrypt(this._key,e)}},{key:"equals",value:function(e){return s(this.bytes,e.bytes)}},{key:"hash",value:function(){var e=r(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",i.multihashing(this.bytes,"sha2-256"));case 1:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}]),e}(),l=function(){function e(r,n){t(this,e),this._key=r,this._publicKey=n}return u(e,[{key:"genSecret",value:function(){return p.getRandomValues(16)}},{key:"sign",value:function(){var e=r(regeneratorRuntime.mark(function e(r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",p.hashAndSign(this._key,r));case 1:case"end":return e.stop()}},e,this)}));return function(r){return e.apply(this,arguments)}}()},{key:"public",get:function(){if(!this._publicKey)throw a(new Error("public key not provided"),"ERR_PUBKEY_NOT_PROVIDED");return new y(this._publicKey)}},{key:"decrypt",value:function(e){return p.decrypt(this._key,e)}},{key:"marshal",value:function(){return p.utils.jwkToPkcs1(this._key)}},{key:"bytes",get:function(){return f.PrivateKey.encode({Type:f.KeyType.RSA,Data:this.marshal()}).finish()}},{key:"equals",value:function(e){return s(this.bytes,e.bytes)}},{key:"hash",value:function(){var e=r(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",i.multihashing(this.bytes,"sha2-256"));case 1:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"id",value:function(){var e=r(regeneratorRuntime.mark(function e(){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.public.hash();case 2:return r=e.sent,e.abrupt("return",o(r,"base58btc"));case 4:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"export",value:function(){var e=r(regeneratorRuntime.mark(function e(r){var t,n,u,i,s,o=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("pkcs-8"!==(t=o.length>1&&void 0!==o[1]?o[1]:"pkcs-8")){e.next=9;break}return n=new c.util.ByteBuffer(this.marshal()),u=c.asn1.fromDer(n),i=c.pki.privateKeyFromAsn1(u),s={algorithm:"aes256",count:1e4,saltSize:16,prfAlgorithm:"sha512"},e.abrupt("return",c.pki.encryptRsaPrivateKey(i,r,s));case 9:if("libp2p-key"!==t){e.next=13;break}return e.abrupt("return",h.export(this.bytes,r));case 13:throw a(new Error("export format '".concat(t,"' is not supported")),"ERR_INVALID_EXPORT_FORMAT");case 14:case"end":return e.stop()}},e,this)}));return function(r){return e.apply(this,arguments)}}()}]),e}();function v(e){return k.apply(this,arguments)}function k(){return(k=r(regeneratorRuntime.mark(function e(r){var t,n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=p.utils.pkcs1ToJwk(r),e.next=3,p.unmarshalPrivateKey(t);case 3:return n=e.sent,e.abrupt("return",new l(n.privateKey,n.publicKey));case 5:case"end":return e.stop()}},e)}))).apply(this,arguments)}function m(e){var r=p.utils.pkixToJwk(e);return new y(r)}function b(e){return g.apply(this,arguments)}function g(){return(g=r(regeneratorRuntime.mark(function e(r){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,p.unmarshalPrivateKey(r);case 2:return t=e.sent,e.abrupt("return",new l(t.privateKey,t.publicKey));case 4:case"end":return e.stop()}},e)}))).apply(this,arguments)}function w(e){return R.apply(this,arguments)}function R(){return(R=r(regeneratorRuntime.mark(function e(r){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,p.generateKey(r);case 2:return t=e.sent,e.abrupt("return",new l(t.privateKey,t.publicKey));case 4:case"end":return e.stop()}},e)}))).apply(this,arguments)}module.exports={RsaPublicKey:y,RsaPrivateKey:l,unmarshalRsaPublicKey:m,unmarshalRsaPrivateKey:v,generateKeyPair:w,fromJwk:b};
|
||
},{"multihashing-async/src/sha":"K7IR","err-code":"hLMW","uint8arrays/equals":"mZxc","uint8arrays/to-string":"aFN1","node-forge/lib/sha512":"KQsE","node-forge/lib/ed25519":"qHh2","node-forge/lib/forge":"sQ2N","./rsa":"xqoX","./keys":"uznU","./exporter":"PaZH"}],"IGpW":[function(require,module,exports) {
|
||
"use strict";function e(e,r,n,t,u,i,a){try{var o=e[i](a),s=o.value}catch(c){return void n(c)}o.done?r(s):Promise.resolve(s).then(t,u)}function r(r){return function(){var n=this,t=arguments;return new Promise(function(u,i){var a=r.apply(n,t);function o(r){e(a,u,i,o,s,"next",r)}function s(r){e(a,u,i,o,s,"throw",r)}o(void 0)})}}require("node-forge/lib/ed25519");var n=require("node-forge/lib/forge");exports.publicKeyLength=n.pki.ed25519.constants.PUBLIC_KEY_BYTE_LENGTH,exports.privateKeyLength=n.pki.ed25519.constants.PRIVATE_KEY_BYTE_LENGTH,exports.generateKey=r(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.pki.ed25519.generateKeyPair());case 1:case"end":return e.stop()}},e)})),exports.generateKeyFromSeed=function(){var e=r(regeneratorRuntime.mark(function e(r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.pki.ed25519.generateKeyPair({seed:r}));case 1:case"end":return e.stop()}},e)}));return function(r){return e.apply(this,arguments)}}(),exports.hashAndSign=function(){var e=r(regeneratorRuntime.mark(function e(r,t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.pki.ed25519.sign({message:t,privateKey:r}));case 1:case"end":return e.stop()}},e)}));return function(r,n){return e.apply(this,arguments)}}(),exports.hashAndVerify=function(){var e=r(regeneratorRuntime.mark(function e(r,t,u){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.pki.ed25519.verify({signature:t,message:u,publicKey:r}));case 1:case"end":return e.stop()}},e)}));return function(r,n,t){return e.apply(this,arguments)}}();
|
||
},{"node-forge/lib/ed25519":"qHh2","node-forge/lib/forge":"sQ2N"}],"d53H":[function(require,module,exports) {
|
||
"use strict";function e(e,r,t,n,u,i,a){try{var s=e[i](a),o=s.value}catch(c){return void t(c)}s.done?r(o):Promise.resolve(o).then(n,u)}function r(r){return function(){var t=this,n=arguments;return new Promise(function(u,i){var a=r.apply(t,n);function s(r){e(a,u,i,s,o,"next",r)}function o(r){e(a,u,i,s,o,"throw",r)}s(void 0)})}}function t(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function n(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,r,t){return r&&n(e.prototype,r),t&&n(e,t),e}var i=require("multihashing-async/src/sha"),a=require("err-code"),s=require("uint8arrays/equals"),o=require("multihashes"),c=require("./ed25519"),h=require("./keys"),p=require("./exporter"),y=function(){function e(r){t(this,e),this._key=k(r,c.publicKeyLength)}return u(e,[{key:"verify",value:function(){var e=r(regeneratorRuntime.mark(function e(r,t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",c.hashAndVerify(this._key,t,r));case 1:case"end":return e.stop()}},e,this)}));return function(r,t){return e.apply(this,arguments)}}()},{key:"marshal",value:function(){return this._key}},{key:"bytes",get:function(){return h.PublicKey.encode({Type:h.KeyType.Ed25519,Data:this.marshal()}).finish()}},{key:"equals",value:function(e){return s(this.bytes,e.bytes)}},{key:"hash",value:function(){var e=r(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",i.multihashing(this.bytes,"sha2-256"));case 1:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}]),e}(),f=function(){function e(r,n){t(this,e),this._key=k(r,c.privateKeyLength),this._publicKey=k(n,c.publicKeyLength)}return u(e,[{key:"sign",value:function(){var e=r(regeneratorRuntime.mark(function e(r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",c.hashAndSign(this._key,r));case 1:case"end":return e.stop()}},e,this)}));return function(r){return e.apply(this,arguments)}}()},{key:"public",get:function(){return new y(this._publicKey)}},{key:"marshal",value:function(){return this._key}},{key:"bytes",get:function(){return h.PrivateKey.encode({Type:h.KeyType.Ed25519,Data:this.marshal()}).finish()}},{key:"equals",value:function(e){return s(this.bytes,e.bytes)}},{key:"hash",value:function(){var e=r(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",i.multihashing(this.bytes,"sha2-256"));case 1:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"id",value:function(){var e=r(regeneratorRuntime.mark(function e(){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=o.encode(this.public.bytes,"identity"),e.next=3,o.toB58String(r);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"export",value:function(){var e=r(regeneratorRuntime.mark(function e(r){var t,n=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("libp2p-key"!==(t=n.length>1&&void 0!==n[1]?n[1]:"libp2p-key")){e.next=5;break}return e.abrupt("return",p.export(this.bytes,r));case 5:throw a(new Error("export format '".concat(t,"' is not supported")),"ERR_INVALID_EXPORT_FORMAT");case 6:case"end":return e.stop()}},e,this)}));return function(r){return e.apply(this,arguments)}}()}]),e}();function l(e){if(e.length>c.privateKeyLength){var r=(e=k(e,c.privateKeyLength+c.publicKeyLength)).slice(0,c.privateKeyLength),t=e.slice(c.privateKeyLength,e.length);return new f(r,t)}var n=(e=k(e,c.privateKeyLength)).slice(0,c.privateKeyLength),u=e.slice(c.publicKeyLength);return new f(n,u)}function v(e){return e=k(e,c.publicKeyLength),new y(e)}function g(){return m.apply(this,arguments)}function m(){return(m=r(regeneratorRuntime.mark(function e(){var r,t,n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,c.generateKey();case 2:return r=e.sent,t=r.privateKey,n=r.publicKey,e.abrupt("return",new f(t,n));case 6:case"end":return e.stop()}},e)}))).apply(this,arguments)}function b(e){return d.apply(this,arguments)}function d(){return(d=r(regeneratorRuntime.mark(function e(r){var t,n,u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,c.generateKeyFromSeed(r);case 2:return t=e.sent,n=t.privateKey,u=t.publicKey,e.abrupt("return",new f(n,u));case 6:case"end":return e.stop()}},e)}))).apply(this,arguments)}function k(e,r){if((e=Uint8Array.from(e||[])).length!==r)throw a(new Error("Key must be a Uint8Array of length ".concat(r,", got ").concat(e.length)),"ERR_INVALID_KEY_TYPE");return e}module.exports={Ed25519PublicKey:y,Ed25519PrivateKey:f,unmarshalEd25519PrivateKey:l,unmarshalEd25519PublicKey:v,generateKeyPair:g,generateKeyPairFromSeed:b};
|
||
},{"multihashing-async/src/sha":"K7IR","err-code":"hLMW","uint8arrays/equals":"mZxc","multihashes":"ubn9","./ed25519":"IGpW","./keys":"uznU","./exporter":"PaZH"}],"7E7N":[function(require,module,exports) {
|
||
function e(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=r(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0,a=function(){};return{s:a,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,c=!0,u=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return c=e.done,e},e:function(e){u=!0,i=e},f:function(){try{c||null==n.return||n.return()}finally{if(u)throw i}}}}function r(e,r){if(e){if("string"==typeof e)return t(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(e,r):void 0}}function t(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}var n={IMPOSSIBLE_CASE:"Impossible case. Please create issue.",TWEAK_ADD:"The tweak was out of range or the resulted private key is invalid",TWEAK_MUL:"The tweak was out of range or equal to zero",CONTEXT_RANDOMIZE_UNKNOW:"Unknow error on context randomization",SECKEY_INVALID:"Private Key is invalid",PUBKEY_PARSE:"Public Key could not be parsed",PUBKEY_SERIALIZE:"Public Key serialization error",PUBKEY_COMBINE:"The sum of the public keys is not valid",SIG_PARSE:"Signature could not be parsed",SIGN:"The nonce generation function failed, or the private key was invalid",RECOVER:"Public key could not be recover",ECDH:"Scalar was invalid (zero or overflow)"};function o(e,r){if(!e)throw new Error(r)}function a(e,r,t){if(o(r instanceof Uint8Array,"Expected ".concat(e," to be an Uint8Array")),void 0!==t)if(Array.isArray(t)){var n=t.join(", "),a="Expected ".concat(e," to be an Uint8Array with length [").concat(n,"]");o(t.includes(r.length),a)}else{var i="Expected ".concat(e," to be an Uint8Array with length ").concat(t);o(r.length===t,i)}}function i(e){o("Boolean"===u(e),"Expected compressed to be a Boolean")}function c(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(e){return new Uint8Array(e)},r=arguments.length>1?arguments[1]:void 0;return"function"==typeof e&&(e=e(r)),a("output",e,r),e}function u(e){return Object.prototype.toString.call(e).slice(8,-1)}module.exports=function(r){return{contextRandomize:function(e){switch(o(null===e||e instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),null!==e&&a("seed",e,32),r.contextRandomize(e)){case 1:throw new Error(n.CONTEXT_RANDOMIZE_UNKNOW)}},privateKeyVerify:function(e){return a("private key",e,32),0===r.privateKeyVerify(e)},privateKeyNegate:function(e){switch(a("private key",e,32),r.privateKeyNegate(e)){case 0:return e;case 1:throw new Error(n.IMPOSSIBLE_CASE)}},privateKeyTweakAdd:function(e,t){switch(a("private key",e,32),a("tweak",t,32),r.privateKeyTweakAdd(e,t)){case 0:return e;case 1:throw new Error(n.TWEAK_ADD)}},privateKeyTweakMul:function(e,t){switch(a("private key",e,32),a("tweak",t,32),r.privateKeyTweakMul(e,t)){case 0:return e;case 1:throw new Error(n.TWEAK_MUL)}},publicKeyVerify:function(e){return a("public key",e,[33,65]),0===r.publicKeyVerify(e)},publicKeyCreate:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=arguments.length>2?arguments[2]:void 0;switch(a("private key",e,32),i(t),o=c(o,t?33:65),r.publicKeyCreate(o,e)){case 0:return o;case 1:throw new Error(n.SECKEY_INVALID);case 2:throw new Error(n.PUBKEY_SERIALIZE)}},publicKeyConvert:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=arguments.length>2?arguments[2]:void 0;switch(a("public key",e,[33,65]),i(t),o=c(o,t?33:65),r.publicKeyConvert(o,e)){case 0:return o;case 1:throw new Error(n.PUBKEY_PARSE);case 2:throw new Error(n.PUBKEY_SERIALIZE)}},publicKeyNegate:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=arguments.length>2?arguments[2]:void 0;switch(a("public key",e,[33,65]),i(t),o=c(o,t?33:65),r.publicKeyNegate(o,e)){case 0:return o;case 1:throw new Error(n.PUBKEY_PARSE);case 2:throw new Error(n.IMPOSSIBLE_CASE);case 3:throw new Error(n.PUBKEY_SERIALIZE)}},publicKeyCombine:function(t){var u=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],s=arguments.length>2?arguments[2]:void 0;o(Array.isArray(t),"Expected public keys to be an Array"),o(t.length>0,"Expected public keys array will have more than zero items");var l,E=e(t);try{for(E.s();!(l=E.n()).done;){a("public key",l.value,[33,65])}}catch(w){E.e(w)}finally{E.f()}switch(i(u),s=c(s,u?33:65),r.publicKeyCombine(s,t)){case 0:return s;case 1:throw new Error(n.PUBKEY_PARSE);case 2:throw new Error(n.PUBKEY_COMBINE);case 3:throw new Error(n.PUBKEY_SERIALIZE)}},publicKeyTweakAdd:function(e,t){var o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],u=arguments.length>3?arguments[3]:void 0;switch(a("public key",e,[33,65]),a("tweak",t,32),i(o),u=c(u,o?33:65),r.publicKeyTweakAdd(u,e,t)){case 0:return u;case 1:throw new Error(n.PUBKEY_PARSE);case 2:throw new Error(n.TWEAK_ADD)}},publicKeyTweakMul:function(e,t){var o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],u=arguments.length>3?arguments[3]:void 0;switch(a("public key",e,[33,65]),a("tweak",t,32),i(o),u=c(u,o?33:65),r.publicKeyTweakMul(u,e,t)){case 0:return u;case 1:throw new Error(n.PUBKEY_PARSE);case 2:throw new Error(n.TWEAK_MUL)}},signatureNormalize:function(e){switch(a("signature",e,64),r.signatureNormalize(e)){case 0:return e;case 1:throw new Error(n.SIG_PARSE)}},signatureExport:function(e,t){a("signature",e,64);var o={output:t=c(t,72),outputlen:72};switch(r.signatureExport(o,e)){case 0:return t.slice(0,o.outputlen);case 1:throw new Error(n.SIG_PARSE);case 2:throw new Error(n.IMPOSSIBLE_CASE)}},signatureImport:function(e,t){switch(a("signature",e),t=c(t,64),r.signatureImport(t,e)){case 0:return t;case 1:throw new Error(n.SIG_PARSE);case 2:throw new Error(n.IMPOSSIBLE_CASE)}},ecdsaSign:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=arguments.length>3?arguments[3]:void 0;a("message",e,32),a("private key",t,32),o("Object"===u(i),"Expected options to be an Object"),void 0!==i.data&&a("options.data",i.data),void 0!==i.noncefn&&o("Function"===u(i.noncefn),"Expected options.noncefn to be a Function");var l={signature:s=c(s,64),recid:null};switch(r.ecdsaSign(l,e,t,i.data,i.noncefn)){case 0:return l;case 1:throw new Error(n.SIGN);case 2:throw new Error(n.IMPOSSIBLE_CASE)}},ecdsaVerify:function(e,t,o){switch(a("signature",e,64),a("message",t,32),a("public key",o,[33,65]),r.ecdsaVerify(e,t,o)){case 0:return!0;case 3:return!1;case 1:throw new Error(n.SIG_PARSE);case 2:throw new Error(n.PUBKEY_PARSE)}},ecdsaRecover:function(e,t,s){var l=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],E=arguments.length>4?arguments[4]:void 0;switch(a("signature",e,64),o("Number"===u(t)&&t>=0&&t<=3,"Expected recovery id to be a Number within interval [0, 3]"),a("message",s,32),i(l),E=c(E,l?33:65),r.ecdsaRecover(E,e,t,s)){case 0:return E;case 1:throw new Error(n.SIG_PARSE);case 2:throw new Error(n.RECOVER);case 3:throw new Error(n.IMPOSSIBLE_CASE)}},ecdh:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=arguments.length>3?arguments[3]:void 0;switch(a("public key",e,[33,65]),a("private key",t,32),o("Object"===u(i),"Expected options to be an Object"),void 0!==i.data&&a("options.data",i.data),void 0!==i.hashfn?(o("Function"===u(i.hashfn),"Expected options.hashfn to be a Function"),void 0!==i.xbuf&&a("options.xbuf",i.xbuf,32),void 0!==i.ybuf&&a("options.ybuf",i.ybuf,32),a("output",s)):s=c(s,32),r.ecdh(s,e,t,i.data,i.hashfn,i.xbuf,i.ybuf)){case 0:return s;case 1:throw new Error(n.PUBKEY_PARSE);case 2:throw new Error(n.ECDH)}}}};
|
||
},{}],"acWy":[function(require,module,exports) {
|
||
module.exports={_from:"elliptic@^6.5.2",_id:"elliptic@6.5.4",_inBundle:!1,_integrity:"sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==",_location:"/elliptic",_phantomChildren:{},_requested:{type:"range",registry:!0,raw:"elliptic@^6.5.2",name:"elliptic",escapedName:"elliptic",rawSpec:"^6.5.2",saveSpec:null,fetchSpec:"^6.5.2"},_requiredBy:["/secp256k1"],_resolved:"https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz",_shasum:"da37cebd31e79a1367e941b592ed1fbebd58abbb",_spec:"elliptic@^6.5.2",_where:"/Users/vsantos/work/pl/gh/libp2p/js-libp2p/node_modules/secp256k1",author:{name:"Fedor Indutny",email:"fedor@indutny.com"},bugs:{url:"https://github.com/indutny/elliptic/issues"},bundleDependencies:!1,dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},deprecated:!1,description:"EC cryptography",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},files:["lib"],homepage:"https://github.com/indutny/elliptic",keywords:["EC","Elliptic","curve","Cryptography"],license:"MIT",main:"lib/elliptic.js",name:"elliptic",repository:{type:"git",url:"git+ssh://git@github.com/indutny/elliptic.git"},scripts:{lint:"eslint lib test","lint:fix":"npm run lint -- --fix",test:"npm run lint && npm run unit",unit:"istanbul test _mocha --reporter=spec test/index.js",version:"grunt dist && git add dist/"},version:"6.5.4"};
|
||
},{}],"RJrg":[function(require,module,exports) {
|
||
var Buffer = require("buffer").Buffer;
|
||
var t=require("buffer").Buffer;!function(t,i){"use strict";function r(t,i){if(!t)throw new Error(i||"Assertion failed")}function n(t,i){t.super_=i;var r=function(){};r.prototype=i.prototype,t.prototype=new r,t.prototype.constructor=t}function h(t,i,r){if(h.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==i&&"be"!==i||(r=i,i=10),this._init(t||0,i||10,r||"be"))}var e;"object"==typeof t?t.exports=h:i.BN=h,h.BN=h,h.wordSize=26;try{e="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:require("buffer").Buffer}catch(A){}function o(t,i){var r=t.charCodeAt(i);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function s(t,i,r){var n=o(t,r);return r-1>=i&&(n|=o(t,r-1)<<4),n}function u(t,i,r,n){for(var h=0,e=Math.min(t.length,r),o=i;o<e;o++){var s=t.charCodeAt(o)-48;h*=n,h+=s>=49?s-49+10:s>=17?s-17+10:s}return h}h.isBN=function(t){return t instanceof h||null!==t&&"object"==typeof t&&t.constructor.wordSize===h.wordSize&&Array.isArray(t.words)},h.max=function(t,i){return t.cmp(i)>0?t:i},h.min=function(t,i){return t.cmp(i)<0?t:i},h.prototype._init=function(t,i,n){if("number"==typeof t)return this._initNumber(t,i,n);if("object"==typeof t)return this._initArray(t,i,n);"hex"===i&&(i=16),r(i===(0|i)&&i>=2&&i<=36);var h=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(h++,this.negative=1),h<t.length&&(16===i?this._parseHex(t,h,n):(this._parseBase(t,i,h),"le"===n&&this._initArray(this.toArray(),i,n)))},h.prototype._initNumber=function(t,i,n){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),i,n)},h.prototype._initArray=function(t,i,n){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var h=0;h<this.length;h++)this.words[h]=0;var e,o,s=0;if("be"===n)for(h=t.length-1,e=0;h>=0;h-=3)o=t[h]|t[h-1]<<8|t[h-2]<<16,this.words[e]|=o<<s&67108863,this.words[e+1]=o>>>26-s&67108863,(s+=24)>=26&&(s-=26,e++);else if("le"===n)for(h=0,e=0;h<t.length;h+=3)o=t[h]|t[h+1]<<8|t[h+2]<<16,this.words[e]|=o<<s&67108863,this.words[e+1]=o>>>26-s&67108863,(s+=24)>=26&&(s-=26,e++);return this.strip()},h.prototype._parseHex=function(t,i,r){this.length=Math.ceil((t.length-i)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var h,e=0,o=0;if("be"===r)for(n=t.length-1;n>=i;n-=2)h=s(t,i,n)<<e,this.words[o]|=67108863&h,e>=18?(e-=18,o+=1,this.words[o]|=h>>>26):e+=8;else for(n=(t.length-i)%2==0?i+1:i;n<t.length;n+=2)h=s(t,i,n)<<e,this.words[o]|=67108863&h,e>=18?(e-=18,o+=1,this.words[o]|=h>>>26):e+=8;this.strip()},h.prototype._parseBase=function(t,i,r){this.words=[0],this.length=1;for(var n=0,h=1;h<=67108863;h*=i)n++;n--,h=h/i|0;for(var e=t.length-r,o=e%n,s=Math.min(e,e-o)+r,a=0,l=r;l<s;l+=n)a=u(t,l,l+n,i),this.imuln(h),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a);if(0!==o){var m=1;for(a=u(t,l,t.length,i),l=0;l<o;l++)m*=i;this.imuln(m),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a)}this.strip()},h.prototype.copy=function(t){t.words=new Array(this.length);for(var i=0;i<this.length;i++)t.words[i]=this.words[i];t.length=this.length,t.negative=this.negative,t.red=this.red},h.prototype.clone=function(){var t=new h(null);return this.copy(t),t},h.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},h.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},h.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},h.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var a=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],m=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function f(t,i,r){r.negative=i.negative^t.negative;var n=t.length+i.length|0;r.length=n,n=n-1|0;var h=0|t.words[0],e=0|i.words[0],o=h*e,s=67108863&o,u=o/67108864|0;r.words[0]=s;for(var a=1;a<n;a++){for(var l=u>>>26,m=67108863&u,f=Math.min(a,i.length-1),d=Math.max(0,a-t.length+1);d<=f;d++){var p=a-d|0;l+=(o=(h=0|t.words[p])*(e=0|i.words[d])+m)/67108864|0,m=67108863&o}r.words[a]=0|m,u=0|l}return 0!==u?r.words[a]=0|u:r.length--,r.strip()}h.prototype.toString=function(t,i){var n;if(i=0|i||1,16===(t=t||10)||"hex"===t){n="";for(var h=0,e=0,o=0;o<this.length;o++){var s=this.words[o],u=(16777215&(s<<h|e)).toString(16);n=0!==(e=s>>>24-h&16777215)||o!==this.length-1?a[6-u.length]+u+n:u+n,(h+=2)>=26&&(h-=26,o--)}for(0!==e&&(n=e.toString(16)+n);n.length%i!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var f=l[t],d=m[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var M=p.modn(d).toString(t);n=(p=p.idivn(d)).isZero()?M+n:a[f-M.length]+M+n}for(this.isZero()&&(n="0"+n);n.length%i!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},h.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},h.prototype.toJSON=function(){return this.toString(16)},h.prototype.toBuffer=function(t,i){return r(void 0!==e),this.toArrayLike(e,t,i)},h.prototype.toArray=function(t,i){return this.toArrayLike(Array,t,i)},h.prototype.toArrayLike=function(t,i,n){var h=this.byteLength(),e=n||Math.max(1,h);r(h<=e,"byte array longer than desired length"),r(e>0,"Requested array length <= 0"),this.strip();var o,s,u="le"===i,a=new t(e),l=this.clone();if(u){for(s=0;!l.isZero();s++)o=l.andln(255),l.iushrn(8),a[s]=o;for(;s<e;s++)a[s]=0}else{for(s=0;s<e-h;s++)a[s]=0;for(s=0;!l.isZero();s++)o=l.andln(255),l.iushrn(8),a[e-s-1]=o}return a},Math.clz32?h.prototype._countBits=function(t){return 32-Math.clz32(t)}:h.prototype._countBits=function(t){var i=t,r=0;return i>=4096&&(r+=13,i>>>=13),i>=64&&(r+=7,i>>>=7),i>=8&&(r+=4,i>>>=4),i>=2&&(r+=2,i>>>=2),r+i},h.prototype._zeroBits=function(t){if(0===t)return 26;var i=t,r=0;return 0==(8191&i)&&(r+=13,i>>>=13),0==(127&i)&&(r+=7,i>>>=7),0==(15&i)&&(r+=4,i>>>=4),0==(3&i)&&(r+=2,i>>>=2),0==(1&i)&&r++,r},h.prototype.bitLength=function(){var t=this.words[this.length-1],i=this._countBits(t);return 26*(this.length-1)+i},h.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,i=0;i<this.length;i++){var r=this._zeroBits(this.words[i]);if(t+=r,26!==r)break}return t},h.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},h.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},h.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},h.prototype.isNeg=function(){return 0!==this.negative},h.prototype.neg=function(){return this.clone().ineg()},h.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},h.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var i=0;i<t.length;i++)this.words[i]=this.words[i]|t.words[i];return this.strip()},h.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},h.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},h.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},h.prototype.iuand=function(t){var i;i=this.length>t.length?t:this;for(var r=0;r<i.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=i.length,this.strip()},h.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},h.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},h.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},h.prototype.iuxor=function(t){var i,r;this.length>t.length?(i=this,r=t):(i=t,r=this);for(var n=0;n<r.length;n++)this.words[n]=i.words[n]^r.words[n];if(this!==i)for(;n<i.length;n++)this.words[n]=i.words[n];return this.length=i.length,this.strip()},h.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},h.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},h.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},h.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var i=0|Math.ceil(t/26),n=t%26;this._expand(i),n>0&&i--;for(var h=0;h<i;h++)this.words[h]=67108863&~this.words[h];return n>0&&(this.words[h]=~this.words[h]&67108863>>26-n),this.strip()},h.prototype.notn=function(t){return this.clone().inotn(t)},h.prototype.setn=function(t,i){r("number"==typeof t&&t>=0);var n=t/26|0,h=t%26;return this._expand(n+1),this.words[n]=i?this.words[n]|1<<h:this.words[n]&~(1<<h),this.strip()},h.prototype.iadd=function(t){var i,r,n;if(0!==this.negative&&0===t.negative)return this.negative=0,i=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,i=this.isub(t),t.negative=1,i._normSign();this.length>t.length?(r=this,n=t):(r=t,n=this);for(var h=0,e=0;e<n.length;e++)i=(0|r.words[e])+(0|n.words[e])+h,this.words[e]=67108863&i,h=i>>>26;for(;0!==h&&e<r.length;e++)i=(0|r.words[e])+h,this.words[e]=67108863&i,h=i>>>26;if(this.length=r.length,0!==h)this.words[this.length]=h,this.length++;else if(r!==this)for(;e<r.length;e++)this.words[e]=r.words[e];return this},h.prototype.add=function(t){var i;return 0!==t.negative&&0===this.negative?(t.negative=0,i=this.sub(t),t.negative^=1,i):0===t.negative&&0!==this.negative?(this.negative=0,i=t.sub(this),this.negative=1,i):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},h.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var i=this.iadd(t);return t.negative=1,i._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,h=this.cmp(t);if(0===h)return this.negative=0,this.length=1,this.words[0]=0,this;h>0?(r=this,n=t):(r=t,n=this);for(var e=0,o=0;o<n.length;o++)e=(i=(0|r.words[o])-(0|n.words[o])+e)>>26,this.words[o]=67108863&i;for(;0!==e&&o<r.length;o++)e=(i=(0|r.words[o])+e)>>26,this.words[o]=67108863&i;if(0===e&&o<r.length&&r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this.length=Math.max(this.length,o),r!==this&&(this.negative=1),this.strip()},h.prototype.sub=function(t){return this.clone().isub(t)};var d=function(t,i,r){var n,h,e,o=t.words,s=i.words,u=r.words,a=0,l=0|o[0],m=8191&l,f=l>>>13,d=0|o[1],p=8191&d,M=d>>>13,v=0|o[2],g=8191&v,c=v>>>13,w=0|o[3],y=8191&w,b=w>>>13,_=0|o[4],k=8191&_,A=_>>>13,x=0|o[5],S=8191&x,q=x>>>13,B=0|o[6],Z=8191&B,R=B>>>13,N=0|o[7],L=8191&N,I=N>>>13,z=0|o[8],T=8191&z,E=z>>>13,O=0|o[9],j=8191&O,K=O>>>13,P=0|s[0],F=8191&P,C=P>>>13,D=0|s[1],H=8191&D,J=D>>>13,U=0|s[2],G=8191&U,Q=U>>>13,V=0|s[3],W=8191&V,X=V>>>13,Y=0|s[4],$=8191&Y,tt=Y>>>13,it=0|s[5],rt=8191&it,nt=it>>>13,ht=0|s[6],et=8191&ht,ot=ht>>>13,st=0|s[7],ut=8191&st,at=st>>>13,lt=0|s[8],mt=8191<,ft=lt>>>13,dt=0|s[9],pt=8191&dt,Mt=dt>>>13;r.negative=t.negative^i.negative,r.length=19;var vt=(a+(n=Math.imul(m,F))|0)+((8191&(h=(h=Math.imul(m,C))+Math.imul(f,F)|0))<<13)|0;a=((e=Math.imul(f,C))+(h>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(p,F),h=(h=Math.imul(p,C))+Math.imul(M,F)|0,e=Math.imul(M,C);var gt=(a+(n=n+Math.imul(m,H)|0)|0)+((8191&(h=(h=h+Math.imul(m,J)|0)+Math.imul(f,H)|0))<<13)|0;a=((e=e+Math.imul(f,J)|0)+(h>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(g,F),h=(h=Math.imul(g,C))+Math.imul(c,F)|0,e=Math.imul(c,C),n=n+Math.imul(p,H)|0,h=(h=h+Math.imul(p,J)|0)+Math.imul(M,H)|0,e=e+Math.imul(M,J)|0;var ct=(a+(n=n+Math.imul(m,G)|0)|0)+((8191&(h=(h=h+Math.imul(m,Q)|0)+Math.imul(f,G)|0))<<13)|0;a=((e=e+Math.imul(f,Q)|0)+(h>>>13)|0)+(ct>>>26)|0,ct&=67108863,n=Math.imul(y,F),h=(h=Math.imul(y,C))+Math.imul(b,F)|0,e=Math.imul(b,C),n=n+Math.imul(g,H)|0,h=(h=h+Math.imul(g,J)|0)+Math.imul(c,H)|0,e=e+Math.imul(c,J)|0,n=n+Math.imul(p,G)|0,h=(h=h+Math.imul(p,Q)|0)+Math.imul(M,G)|0,e=e+Math.imul(M,Q)|0;var wt=(a+(n=n+Math.imul(m,W)|0)|0)+((8191&(h=(h=h+Math.imul(m,X)|0)+Math.imul(f,W)|0))<<13)|0;a=((e=e+Math.imul(f,X)|0)+(h>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(k,F),h=(h=Math.imul(k,C))+Math.imul(A,F)|0,e=Math.imul(A,C),n=n+Math.imul(y,H)|0,h=(h=h+Math.imul(y,J)|0)+Math.imul(b,H)|0,e=e+Math.imul(b,J)|0,n=n+Math.imul(g,G)|0,h=(h=h+Math.imul(g,Q)|0)+Math.imul(c,G)|0,e=e+Math.imul(c,Q)|0,n=n+Math.imul(p,W)|0,h=(h=h+Math.imul(p,X)|0)+Math.imul(M,W)|0,e=e+Math.imul(M,X)|0;var yt=(a+(n=n+Math.imul(m,$)|0)|0)+((8191&(h=(h=h+Math.imul(m,tt)|0)+Math.imul(f,$)|0))<<13)|0;a=((e=e+Math.imul(f,tt)|0)+(h>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(S,F),h=(h=Math.imul(S,C))+Math.imul(q,F)|0,e=Math.imul(q,C),n=n+Math.imul(k,H)|0,h=(h=h+Math.imul(k,J)|0)+Math.imul(A,H)|0,e=e+Math.imul(A,J)|0,n=n+Math.imul(y,G)|0,h=(h=h+Math.imul(y,Q)|0)+Math.imul(b,G)|0,e=e+Math.imul(b,Q)|0,n=n+Math.imul(g,W)|0,h=(h=h+Math.imul(g,X)|0)+Math.imul(c,W)|0,e=e+Math.imul(c,X)|0,n=n+Math.imul(p,$)|0,h=(h=h+Math.imul(p,tt)|0)+Math.imul(M,$)|0,e=e+Math.imul(M,tt)|0;var bt=(a+(n=n+Math.imul(m,rt)|0)|0)+((8191&(h=(h=h+Math.imul(m,nt)|0)+Math.imul(f,rt)|0))<<13)|0;a=((e=e+Math.imul(f,nt)|0)+(h>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(Z,F),h=(h=Math.imul(Z,C))+Math.imul(R,F)|0,e=Math.imul(R,C),n=n+Math.imul(S,H)|0,h=(h=h+Math.imul(S,J)|0)+Math.imul(q,H)|0,e=e+Math.imul(q,J)|0,n=n+Math.imul(k,G)|0,h=(h=h+Math.imul(k,Q)|0)+Math.imul(A,G)|0,e=e+Math.imul(A,Q)|0,n=n+Math.imul(y,W)|0,h=(h=h+Math.imul(y,X)|0)+Math.imul(b,W)|0,e=e+Math.imul(b,X)|0,n=n+Math.imul(g,$)|0,h=(h=h+Math.imul(g,tt)|0)+Math.imul(c,$)|0,e=e+Math.imul(c,tt)|0,n=n+Math.imul(p,rt)|0,h=(h=h+Math.imul(p,nt)|0)+Math.imul(M,rt)|0,e=e+Math.imul(M,nt)|0;var _t=(a+(n=n+Math.imul(m,et)|0)|0)+((8191&(h=(h=h+Math.imul(m,ot)|0)+Math.imul(f,et)|0))<<13)|0;a=((e=e+Math.imul(f,ot)|0)+(h>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(L,F),h=(h=Math.imul(L,C))+Math.imul(I,F)|0,e=Math.imul(I,C),n=n+Math.imul(Z,H)|0,h=(h=h+Math.imul(Z,J)|0)+Math.imul(R,H)|0,e=e+Math.imul(R,J)|0,n=n+Math.imul(S,G)|0,h=(h=h+Math.imul(S,Q)|0)+Math.imul(q,G)|0,e=e+Math.imul(q,Q)|0,n=n+Math.imul(k,W)|0,h=(h=h+Math.imul(k,X)|0)+Math.imul(A,W)|0,e=e+Math.imul(A,X)|0,n=n+Math.imul(y,$)|0,h=(h=h+Math.imul(y,tt)|0)+Math.imul(b,$)|0,e=e+Math.imul(b,tt)|0,n=n+Math.imul(g,rt)|0,h=(h=h+Math.imul(g,nt)|0)+Math.imul(c,rt)|0,e=e+Math.imul(c,nt)|0,n=n+Math.imul(p,et)|0,h=(h=h+Math.imul(p,ot)|0)+Math.imul(M,et)|0,e=e+Math.imul(M,ot)|0;var kt=(a+(n=n+Math.imul(m,ut)|0)|0)+((8191&(h=(h=h+Math.imul(m,at)|0)+Math.imul(f,ut)|0))<<13)|0;a=((e=e+Math.imul(f,at)|0)+(h>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(T,F),h=(h=Math.imul(T,C))+Math.imul(E,F)|0,e=Math.imul(E,C),n=n+Math.imul(L,H)|0,h=(h=h+Math.imul(L,J)|0)+Math.imul(I,H)|0,e=e+Math.imul(I,J)|0,n=n+Math.imul(Z,G)|0,h=(h=h+Math.imul(Z,Q)|0)+Math.imul(R,G)|0,e=e+Math.imul(R,Q)|0,n=n+Math.imul(S,W)|0,h=(h=h+Math.imul(S,X)|0)+Math.imul(q,W)|0,e=e+Math.imul(q,X)|0,n=n+Math.imul(k,$)|0,h=(h=h+Math.imul(k,tt)|0)+Math.imul(A,$)|0,e=e+Math.imul(A,tt)|0,n=n+Math.imul(y,rt)|0,h=(h=h+Math.imul(y,nt)|0)+Math.imul(b,rt)|0,e=e+Math.imul(b,nt)|0,n=n+Math.imul(g,et)|0,h=(h=h+Math.imul(g,ot)|0)+Math.imul(c,et)|0,e=e+Math.imul(c,ot)|0,n=n+Math.imul(p,ut)|0,h=(h=h+Math.imul(p,at)|0)+Math.imul(M,ut)|0,e=e+Math.imul(M,at)|0;var At=(a+(n=n+Math.imul(m,mt)|0)|0)+((8191&(h=(h=h+Math.imul(m,ft)|0)+Math.imul(f,mt)|0))<<13)|0;a=((e=e+Math.imul(f,ft)|0)+(h>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(j,F),h=(h=Math.imul(j,C))+Math.imul(K,F)|0,e=Math.imul(K,C),n=n+Math.imul(T,H)|0,h=(h=h+Math.imul(T,J)|0)+Math.imul(E,H)|0,e=e+Math.imul(E,J)|0,n=n+Math.imul(L,G)|0,h=(h=h+Math.imul(L,Q)|0)+Math.imul(I,G)|0,e=e+Math.imul(I,Q)|0,n=n+Math.imul(Z,W)|0,h=(h=h+Math.imul(Z,X)|0)+Math.imul(R,W)|0,e=e+Math.imul(R,X)|0,n=n+Math.imul(S,$)|0,h=(h=h+Math.imul(S,tt)|0)+Math.imul(q,$)|0,e=e+Math.imul(q,tt)|0,n=n+Math.imul(k,rt)|0,h=(h=h+Math.imul(k,nt)|0)+Math.imul(A,rt)|0,e=e+Math.imul(A,nt)|0,n=n+Math.imul(y,et)|0,h=(h=h+Math.imul(y,ot)|0)+Math.imul(b,et)|0,e=e+Math.imul(b,ot)|0,n=n+Math.imul(g,ut)|0,h=(h=h+Math.imul(g,at)|0)+Math.imul(c,ut)|0,e=e+Math.imul(c,at)|0,n=n+Math.imul(p,mt)|0,h=(h=h+Math.imul(p,ft)|0)+Math.imul(M,mt)|0,e=e+Math.imul(M,ft)|0;var xt=(a+(n=n+Math.imul(m,pt)|0)|0)+((8191&(h=(h=h+Math.imul(m,Mt)|0)+Math.imul(f,pt)|0))<<13)|0;a=((e=e+Math.imul(f,Mt)|0)+(h>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(j,H),h=(h=Math.imul(j,J))+Math.imul(K,H)|0,e=Math.imul(K,J),n=n+Math.imul(T,G)|0,h=(h=h+Math.imul(T,Q)|0)+Math.imul(E,G)|0,e=e+Math.imul(E,Q)|0,n=n+Math.imul(L,W)|0,h=(h=h+Math.imul(L,X)|0)+Math.imul(I,W)|0,e=e+Math.imul(I,X)|0,n=n+Math.imul(Z,$)|0,h=(h=h+Math.imul(Z,tt)|0)+Math.imul(R,$)|0,e=e+Math.imul(R,tt)|0,n=n+Math.imul(S,rt)|0,h=(h=h+Math.imul(S,nt)|0)+Math.imul(q,rt)|0,e=e+Math.imul(q,nt)|0,n=n+Math.imul(k,et)|0,h=(h=h+Math.imul(k,ot)|0)+Math.imul(A,et)|0,e=e+Math.imul(A,ot)|0,n=n+Math.imul(y,ut)|0,h=(h=h+Math.imul(y,at)|0)+Math.imul(b,ut)|0,e=e+Math.imul(b,at)|0,n=n+Math.imul(g,mt)|0,h=(h=h+Math.imul(g,ft)|0)+Math.imul(c,mt)|0,e=e+Math.imul(c,ft)|0;var St=(a+(n=n+Math.imul(p,pt)|0)|0)+((8191&(h=(h=h+Math.imul(p,Mt)|0)+Math.imul(M,pt)|0))<<13)|0;a=((e=e+Math.imul(M,Mt)|0)+(h>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(j,G),h=(h=Math.imul(j,Q))+Math.imul(K,G)|0,e=Math.imul(K,Q),n=n+Math.imul(T,W)|0,h=(h=h+Math.imul(T,X)|0)+Math.imul(E,W)|0,e=e+Math.imul(E,X)|0,n=n+Math.imul(L,$)|0,h=(h=h+Math.imul(L,tt)|0)+Math.imul(I,$)|0,e=e+Math.imul(I,tt)|0,n=n+Math.imul(Z,rt)|0,h=(h=h+Math.imul(Z,nt)|0)+Math.imul(R,rt)|0,e=e+Math.imul(R,nt)|0,n=n+Math.imul(S,et)|0,h=(h=h+Math.imul(S,ot)|0)+Math.imul(q,et)|0,e=e+Math.imul(q,ot)|0,n=n+Math.imul(k,ut)|0,h=(h=h+Math.imul(k,at)|0)+Math.imul(A,ut)|0,e=e+Math.imul(A,at)|0,n=n+Math.imul(y,mt)|0,h=(h=h+Math.imul(y,ft)|0)+Math.imul(b,mt)|0,e=e+Math.imul(b,ft)|0;var qt=(a+(n=n+Math.imul(g,pt)|0)|0)+((8191&(h=(h=h+Math.imul(g,Mt)|0)+Math.imul(c,pt)|0))<<13)|0;a=((e=e+Math.imul(c,Mt)|0)+(h>>>13)|0)+(qt>>>26)|0,qt&=67108863,n=Math.imul(j,W),h=(h=Math.imul(j,X))+Math.imul(K,W)|0,e=Math.imul(K,X),n=n+Math.imul(T,$)|0,h=(h=h+Math.imul(T,tt)|0)+Math.imul(E,$)|0,e=e+Math.imul(E,tt)|0,n=n+Math.imul(L,rt)|0,h=(h=h+Math.imul(L,nt)|0)+Math.imul(I,rt)|0,e=e+Math.imul(I,nt)|0,n=n+Math.imul(Z,et)|0,h=(h=h+Math.imul(Z,ot)|0)+Math.imul(R,et)|0,e=e+Math.imul(R,ot)|0,n=n+Math.imul(S,ut)|0,h=(h=h+Math.imul(S,at)|0)+Math.imul(q,ut)|0,e=e+Math.imul(q,at)|0,n=n+Math.imul(k,mt)|0,h=(h=h+Math.imul(k,ft)|0)+Math.imul(A,mt)|0,e=e+Math.imul(A,ft)|0;var Bt=(a+(n=n+Math.imul(y,pt)|0)|0)+((8191&(h=(h=h+Math.imul(y,Mt)|0)+Math.imul(b,pt)|0))<<13)|0;a=((e=e+Math.imul(b,Mt)|0)+(h>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,n=Math.imul(j,$),h=(h=Math.imul(j,tt))+Math.imul(K,$)|0,e=Math.imul(K,tt),n=n+Math.imul(T,rt)|0,h=(h=h+Math.imul(T,nt)|0)+Math.imul(E,rt)|0,e=e+Math.imul(E,nt)|0,n=n+Math.imul(L,et)|0,h=(h=h+Math.imul(L,ot)|0)+Math.imul(I,et)|0,e=e+Math.imul(I,ot)|0,n=n+Math.imul(Z,ut)|0,h=(h=h+Math.imul(Z,at)|0)+Math.imul(R,ut)|0,e=e+Math.imul(R,at)|0,n=n+Math.imul(S,mt)|0,h=(h=h+Math.imul(S,ft)|0)+Math.imul(q,mt)|0,e=e+Math.imul(q,ft)|0;var Zt=(a+(n=n+Math.imul(k,pt)|0)|0)+((8191&(h=(h=h+Math.imul(k,Mt)|0)+Math.imul(A,pt)|0))<<13)|0;a=((e=e+Math.imul(A,Mt)|0)+(h>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,n=Math.imul(j,rt),h=(h=Math.imul(j,nt))+Math.imul(K,rt)|0,e=Math.imul(K,nt),n=n+Math.imul(T,et)|0,h=(h=h+Math.imul(T,ot)|0)+Math.imul(E,et)|0,e=e+Math.imul(E,ot)|0,n=n+Math.imul(L,ut)|0,h=(h=h+Math.imul(L,at)|0)+Math.imul(I,ut)|0,e=e+Math.imul(I,at)|0,n=n+Math.imul(Z,mt)|0,h=(h=h+Math.imul(Z,ft)|0)+Math.imul(R,mt)|0,e=e+Math.imul(R,ft)|0;var Rt=(a+(n=n+Math.imul(S,pt)|0)|0)+((8191&(h=(h=h+Math.imul(S,Mt)|0)+Math.imul(q,pt)|0))<<13)|0;a=((e=e+Math.imul(q,Mt)|0)+(h>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(j,et),h=(h=Math.imul(j,ot))+Math.imul(K,et)|0,e=Math.imul(K,ot),n=n+Math.imul(T,ut)|0,h=(h=h+Math.imul(T,at)|0)+Math.imul(E,ut)|0,e=e+Math.imul(E,at)|0,n=n+Math.imul(L,mt)|0,h=(h=h+Math.imul(L,ft)|0)+Math.imul(I,mt)|0,e=e+Math.imul(I,ft)|0;var Nt=(a+(n=n+Math.imul(Z,pt)|0)|0)+((8191&(h=(h=h+Math.imul(Z,Mt)|0)+Math.imul(R,pt)|0))<<13)|0;a=((e=e+Math.imul(R,Mt)|0)+(h>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(j,ut),h=(h=Math.imul(j,at))+Math.imul(K,ut)|0,e=Math.imul(K,at),n=n+Math.imul(T,mt)|0,h=(h=h+Math.imul(T,ft)|0)+Math.imul(E,mt)|0,e=e+Math.imul(E,ft)|0;var Lt=(a+(n=n+Math.imul(L,pt)|0)|0)+((8191&(h=(h=h+Math.imul(L,Mt)|0)+Math.imul(I,pt)|0))<<13)|0;a=((e=e+Math.imul(I,Mt)|0)+(h>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,n=Math.imul(j,mt),h=(h=Math.imul(j,ft))+Math.imul(K,mt)|0,e=Math.imul(K,ft);var It=(a+(n=n+Math.imul(T,pt)|0)|0)+((8191&(h=(h=h+Math.imul(T,Mt)|0)+Math.imul(E,pt)|0))<<13)|0;a=((e=e+Math.imul(E,Mt)|0)+(h>>>13)|0)+(It>>>26)|0,It&=67108863;var zt=(a+(n=Math.imul(j,pt))|0)+((8191&(h=(h=Math.imul(j,Mt))+Math.imul(K,pt)|0))<<13)|0;return a=((e=Math.imul(K,Mt))+(h>>>13)|0)+(zt>>>26)|0,zt&=67108863,u[0]=vt,u[1]=gt,u[2]=ct,u[3]=wt,u[4]=yt,u[5]=bt,u[6]=_t,u[7]=kt,u[8]=At,u[9]=xt,u[10]=St,u[11]=qt,u[12]=Bt,u[13]=Zt,u[14]=Rt,u[15]=Nt,u[16]=Lt,u[17]=It,u[18]=zt,0!==a&&(u[19]=a,r.length++),r};function p(t,i,r){return(new M).mulp(t,i,r)}function M(t,i){this.x=t,this.y=i}Math.imul||(d=f),h.prototype.mulTo=function(t,i){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,i):r<63?f(this,t,i):r<1024?function(t,i,r){r.negative=i.negative^t.negative,r.length=t.length+i.length;for(var n=0,h=0,e=0;e<r.length-1;e++){var o=h;h=0;for(var s=67108863&n,u=Math.min(e,i.length-1),a=Math.max(0,e-t.length+1);a<=u;a++){var l=e-a,m=(0|t.words[l])*(0|i.words[a]),f=67108863&m;s=67108863&(f=f+s|0),h+=(o=(o=o+(m/67108864|0)|0)+(f>>>26)|0)>>>26,o&=67108863}r.words[e]=s,n=o,o=h}return 0!==n?r.words[e]=n:r.length--,r.strip()}(this,t,i):p(this,t,i)},M.prototype.makeRBT=function(t){for(var i=new Array(t),r=h.prototype._countBits(t)-1,n=0;n<t;n++)i[n]=this.revBin(n,r,t);return i},M.prototype.revBin=function(t,i,r){if(0===t||t===r-1)return t;for(var n=0,h=0;h<i;h++)n|=(1&t)<<i-h-1,t>>=1;return n},M.prototype.permute=function(t,i,r,n,h,e){for(var o=0;o<e;o++)n[o]=i[t[o]],h[o]=r[t[o]]},M.prototype.transform=function(t,i,r,n,h,e){this.permute(e,t,i,r,n,h);for(var o=1;o<h;o<<=1)for(var s=o<<1,u=Math.cos(2*Math.PI/s),a=Math.sin(2*Math.PI/s),l=0;l<h;l+=s)for(var m=u,f=a,d=0;d<o;d++){var p=r[l+d],M=n[l+d],v=r[l+d+o],g=n[l+d+o],c=m*v-f*g;g=m*g+f*v,v=c,r[l+d]=p+v,n[l+d]=M+g,r[l+d+o]=p-v,n[l+d+o]=M-g,d!==s&&(c=u*m-a*f,f=u*f+a*m,m=c)}},M.prototype.guessLen13b=function(t,i){var r=1|Math.max(i,t),n=1&r,h=0;for(r=r/2|0;r;r>>>=1)h++;return 1<<h+1+n},M.prototype.conjugate=function(t,i,r){if(!(r<=1))for(var n=0;n<r/2;n++){var h=t[n];t[n]=t[r-n-1],t[r-n-1]=h,h=i[n],i[n]=-i[r-n-1],i[r-n-1]=-h}},M.prototype.normalize13b=function(t,i){for(var r=0,n=0;n<i/2;n++){var h=8192*Math.round(t[2*n+1]/i)+Math.round(t[2*n]/i)+r;t[n]=67108863&h,r=h<67108864?0:h/67108864|0}return t},M.prototype.convert13b=function(t,i,n,h){for(var e=0,o=0;o<i;o++)e+=0|t[o],n[2*o]=8191&e,e>>>=13,n[2*o+1]=8191&e,e>>>=13;for(o=2*i;o<h;++o)n[o]=0;r(0===e),r(0==(-8192&e))},M.prototype.stub=function(t){for(var i=new Array(t),r=0;r<t;r++)i[r]=0;return i},M.prototype.mulp=function(t,i,r){var n=2*this.guessLen13b(t.length,i.length),h=this.makeRBT(n),e=this.stub(n),o=new Array(n),s=new Array(n),u=new Array(n),a=new Array(n),l=new Array(n),m=new Array(n),f=r.words;f.length=n,this.convert13b(t.words,t.length,o,n),this.convert13b(i.words,i.length,a,n),this.transform(o,e,s,u,n,h),this.transform(a,e,l,m,n,h);for(var d=0;d<n;d++){var p=s[d]*l[d]-u[d]*m[d];u[d]=s[d]*m[d]+u[d]*l[d],s[d]=p}return this.conjugate(s,u,n),this.transform(s,u,f,e,n,h),this.conjugate(f,e,n),this.normalize13b(f,n),r.negative=t.negative^i.negative,r.length=t.length+i.length,r.strip()},h.prototype.mul=function(t){var i=new h(null);return i.words=new Array(this.length+t.length),this.mulTo(t,i)},h.prototype.mulf=function(t){var i=new h(null);return i.words=new Array(this.length+t.length),p(this,t,i)},h.prototype.imul=function(t){return this.clone().mulTo(t,this)},h.prototype.imuln=function(t){r("number"==typeof t),r(t<67108864);for(var i=0,n=0;n<this.length;n++){var h=(0|this.words[n])*t,e=(67108863&h)+(67108863&i);i>>=26,i+=h/67108864|0,i+=e>>>26,this.words[n]=67108863&e}return 0!==i&&(this.words[n]=i,this.length++),this},h.prototype.muln=function(t){return this.clone().imuln(t)},h.prototype.sqr=function(){return this.mul(this)},h.prototype.isqr=function(){return this.imul(this.clone())},h.prototype.pow=function(t){var i=function(t){for(var i=new Array(t.bitLength()),r=0;r<i.length;r++){var n=r/26|0,h=r%26;i[r]=(t.words[n]&1<<h)>>>h}return i}(t);if(0===i.length)return new h(1);for(var r=this,n=0;n<i.length&&0===i[n];n++,r=r.sqr());if(++n<i.length)for(var e=r.sqr();n<i.length;n++,e=e.sqr())0!==i[n]&&(r=r.mul(e));return r},h.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var i,n=t%26,h=(t-n)/26,e=67108863>>>26-n<<26-n;if(0!==n){var o=0;for(i=0;i<this.length;i++){var s=this.words[i]&e,u=(0|this.words[i])-s<<n;this.words[i]=u|o,o=s>>>26-n}o&&(this.words[i]=o,this.length++)}if(0!==h){for(i=this.length-1;i>=0;i--)this.words[i+h]=this.words[i];for(i=0;i<h;i++)this.words[i]=0;this.length+=h}return this.strip()},h.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},h.prototype.iushrn=function(t,i,n){var h;r("number"==typeof t&&t>=0),h=i?(i-i%26)/26:0;var e=t%26,o=Math.min((t-e)/26,this.length),s=67108863^67108863>>>e<<e,u=n;if(h-=o,h=Math.max(0,h),u){for(var a=0;a<o;a++)u.words[a]=this.words[a];u.length=o}if(0===o);else if(this.length>o)for(this.length-=o,a=0;a<this.length;a++)this.words[a]=this.words[a+o];else this.words[0]=0,this.length=1;var l=0;for(a=this.length-1;a>=0&&(0!==l||a>=h);a--){var m=0|this.words[a];this.words[a]=l<<26-e|m>>>e,l=m&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},h.prototype.ishrn=function(t,i,n){return r(0===this.negative),this.iushrn(t,i,n)},h.prototype.shln=function(t){return this.clone().ishln(t)},h.prototype.ushln=function(t){return this.clone().iushln(t)},h.prototype.shrn=function(t){return this.clone().ishrn(t)},h.prototype.ushrn=function(t){return this.clone().iushrn(t)},h.prototype.testn=function(t){r("number"==typeof t&&t>=0);var i=t%26,n=(t-i)/26,h=1<<i;return!(this.length<=n)&&!!(this.words[n]&h)},h.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var i=t%26,n=(t-i)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==i&&n++,this.length=Math.min(n,this.length),0!==i){var h=67108863^67108863>>>i<<i;this.words[this.length-1]&=h}return this.strip()},h.prototype.maskn=function(t){return this.clone().imaskn(t)},h.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},h.prototype._iaddn=function(t){this.words[0]+=t;for(var i=0;i<this.length&&this.words[i]>=67108864;i++)this.words[i]-=67108864,i===this.length-1?this.words[i+1]=1:this.words[i+1]++;return this.length=Math.max(this.length,i+1),this},h.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var i=0;i<this.length&&this.words[i]<0;i++)this.words[i]+=67108864,this.words[i+1]-=1;return this.strip()},h.prototype.addn=function(t){return this.clone().iaddn(t)},h.prototype.subn=function(t){return this.clone().isubn(t)},h.prototype.iabs=function(){return this.negative=0,this},h.prototype.abs=function(){return this.clone().iabs()},h.prototype._ishlnsubmul=function(t,i,n){var h,e,o=t.length+n;this._expand(o);var s=0;for(h=0;h<t.length;h++){e=(0|this.words[h+n])+s;var u=(0|t.words[h])*i;s=((e-=67108863&u)>>26)-(u/67108864|0),this.words[h+n]=67108863&e}for(;h<this.length-n;h++)s=(e=(0|this.words[h+n])+s)>>26,this.words[h+n]=67108863&e;if(0===s)return this.strip();for(r(-1===s),s=0,h=0;h<this.length;h++)s=(e=-(0|this.words[h])+s)>>26,this.words[h]=67108863&e;return this.negative=1,this.strip()},h.prototype._wordDiv=function(t,i){var r=(this.length,t.length),n=this.clone(),e=t,o=0|e.words[e.length-1];0!==(r=26-this._countBits(o))&&(e=e.ushln(r),n.iushln(r),o=0|e.words[e.length-1]);var s,u=n.length-e.length;if("mod"!==i){(s=new h(null)).length=u+1,s.words=new Array(s.length);for(var a=0;a<s.length;a++)s.words[a]=0}var l=n.clone()._ishlnsubmul(e,1,u);0===l.negative&&(n=l,s&&(s.words[u]=1));for(var m=u-1;m>=0;m--){var f=67108864*(0|n.words[e.length+m])+(0|n.words[e.length+m-1]);for(f=Math.min(f/o|0,67108863),n._ishlnsubmul(e,f,m);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(e,1,m),n.isZero()||(n.negative^=1);s&&(s.words[m]=f)}return s&&s.strip(),n.strip(),"div"!==i&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},h.prototype.divmod=function(t,i,n){return r(!t.isZero()),this.isZero()?{div:new h(0),mod:new h(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,i),"mod"!==i&&(e=s.div.neg()),"div"!==i&&(o=s.mod.neg(),n&&0!==o.negative&&o.iadd(t)),{div:e,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),i),"mod"!==i&&(e=s.div.neg()),{div:e,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),i),"div"!==i&&(o=s.mod.neg(),n&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new h(0),mod:this}:1===t.length?"div"===i?{div:this.divn(t.words[0]),mod:null}:"mod"===i?{div:null,mod:new h(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new h(this.modn(t.words[0]))}:this._wordDiv(t,i);var e,o,s},h.prototype.div=function(t){return this.divmod(t,"div",!1).div},h.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},h.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},h.prototype.divRound=function(t){var i=this.divmod(t);if(i.mod.isZero())return i.div;var r=0!==i.div.negative?i.mod.isub(t):i.mod,n=t.ushrn(1),h=t.andln(1),e=r.cmp(n);return e<0||1===h&&0===e?i.div:0!==i.div.negative?i.div.isubn(1):i.div.iaddn(1)},h.prototype.modn=function(t){r(t<=67108863);for(var i=(1<<26)%t,n=0,h=this.length-1;h>=0;h--)n=(i*n+(0|this.words[h]))%t;return n},h.prototype.idivn=function(t){r(t<=67108863);for(var i=0,n=this.length-1;n>=0;n--){var h=(0|this.words[n])+67108864*i;this.words[n]=h/t|0,i=h%t}return this.strip()},h.prototype.divn=function(t){return this.clone().idivn(t)},h.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var i=this,n=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var e=new h(1),o=new h(0),s=new h(0),u=new h(1),a=0;i.isEven()&&n.isEven();)i.iushrn(1),n.iushrn(1),++a;for(var l=n.clone(),m=i.clone();!i.isZero();){for(var f=0,d=1;0==(i.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(i.iushrn(f);f-- >0;)(e.isOdd()||o.isOdd())&&(e.iadd(l),o.isub(m)),e.iushrn(1),o.iushrn(1);for(var p=0,M=1;0==(n.words[0]&M)&&p<26;++p,M<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(m)),s.iushrn(1),u.iushrn(1);i.cmp(n)>=0?(i.isub(n),e.isub(s),o.isub(u)):(n.isub(i),s.isub(e),u.isub(o))}return{a:s,b:u,gcd:n.iushln(a)}},h.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var i=this,n=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var e,o=new h(1),s=new h(0),u=n.clone();i.cmpn(1)>0&&n.cmpn(1)>0;){for(var a=0,l=1;0==(i.words[0]&l)&&a<26;++a,l<<=1);if(a>0)for(i.iushrn(a);a-- >0;)o.isOdd()&&o.iadd(u),o.iushrn(1);for(var m=0,f=1;0==(n.words[0]&f)&&m<26;++m,f<<=1);if(m>0)for(n.iushrn(m);m-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);i.cmp(n)>=0?(i.isub(n),o.isub(s)):(n.isub(i),s.isub(o))}return(e=0===i.cmpn(1)?o:s).cmpn(0)<0&&e.iadd(t),e},h.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var i=this.clone(),r=t.clone();i.negative=0,r.negative=0;for(var n=0;i.isEven()&&r.isEven();n++)i.iushrn(1),r.iushrn(1);for(;;){for(;i.isEven();)i.iushrn(1);for(;r.isEven();)r.iushrn(1);var h=i.cmp(r);if(h<0){var e=i;i=r,r=e}else if(0===h||0===r.cmpn(1))break;i.isub(r)}return r.iushln(n)},h.prototype.invm=function(t){return this.egcd(t).a.umod(t)},h.prototype.isEven=function(){return 0==(1&this.words[0])},h.prototype.isOdd=function(){return 1==(1&this.words[0])},h.prototype.andln=function(t){return this.words[0]&t},h.prototype.bincn=function(t){r("number"==typeof t);var i=t%26,n=(t-i)/26,h=1<<i;if(this.length<=n)return this._expand(n+1),this.words[n]|=h,this;for(var e=h,o=n;0!==e&&o<this.length;o++){var s=0|this.words[o];e=(s+=e)>>>26,s&=67108863,this.words[o]=s}return 0!==e&&(this.words[o]=e,this.length++),this},h.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},h.prototype.cmpn=function(t){var i,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)i=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var h=0|this.words[0];i=h===t?0:h<t?-1:1}return 0!==this.negative?0|-i:i},h.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var i=this.ucmp(t);return 0!==this.negative?0|-i:i},h.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var i=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],h=0|t.words[r];if(n!==h){n<h?i=-1:n>h&&(i=1);break}}return i},h.prototype.gtn=function(t){return 1===this.cmpn(t)},h.prototype.gt=function(t){return 1===this.cmp(t)},h.prototype.gten=function(t){return this.cmpn(t)>=0},h.prototype.gte=function(t){return this.cmp(t)>=0},h.prototype.ltn=function(t){return-1===this.cmpn(t)},h.prototype.lt=function(t){return-1===this.cmp(t)},h.prototype.lten=function(t){return this.cmpn(t)<=0},h.prototype.lte=function(t){return this.cmp(t)<=0},h.prototype.eqn=function(t){return 0===this.cmpn(t)},h.prototype.eq=function(t){return 0===this.cmp(t)},h.red=function(t){return new _(t)},h.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},h.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},h.prototype._forceRed=function(t){return this.red=t,this},h.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},h.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},h.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},h.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},h.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},h.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},h.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},h.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},h.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},h.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},h.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},h.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},h.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},h.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function g(t,i){this.name=t,this.p=new h(i,16),this.n=this.p.bitLength(),this.k=new h(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function c(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function y(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function b(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(t){if("string"==typeof t){var i=h._prime(t);this.m=i.p,this.prime=i}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function k(t){_.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new h(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}g.prototype._tmp=function(){var t=new h(null);return t.words=new Array(Math.ceil(this.n/13)),t},g.prototype.ireduce=function(t){var i,r=t;do{this.split(r,this.tmp),i=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(i>this.n);var n=i<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},g.prototype.split=function(t,i){t.iushrn(this.n,0,i)},g.prototype.imulK=function(t){return t.imul(this.k)},n(c,g),c.prototype.split=function(t,i){for(var r=Math.min(t.length,9),n=0;n<r;n++)i.words[n]=t.words[n];if(i.length=r,t.length<=9)return t.words[0]=0,void(t.length=1);var h=t.words[9];for(i.words[i.length++]=4194303&h,n=10;n<t.length;n++){var e=0|t.words[n];t.words[n-10]=(4194303&e)<<4|h>>>22,h=e}h>>>=22,t.words[n-10]=h,0===h&&t.length>10?t.length-=10:t.length-=9},c.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var i=0,r=0;r<t.length;r++){var n=0|t.words[r];i+=977*n,t.words[r]=67108863&i,i=64*n+(i/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},n(w,g),n(y,g),n(b,g),b.prototype.imulK=function(t){for(var i=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+i,h=67108863&n;n>>>=26,t.words[r]=h,i=n}return 0!==i&&(t.words[t.length++]=i),t},h._prime=function(t){if(v[t])return v[t];var i;if("k256"===t)i=new c;else if("p224"===t)i=new w;else if("p192"===t)i=new y;else{if("p25519"!==t)throw new Error("Unknown prime "+t);i=new b}return v[t]=i,i},_.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},_.prototype._verify2=function(t,i){r(0==(t.negative|i.negative),"red works only with positives"),r(t.red&&t.red===i.red,"red works only with red numbers")},_.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},_.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},_.prototype.add=function(t,i){this._verify2(t,i);var r=t.add(i);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},_.prototype.iadd=function(t,i){this._verify2(t,i);var r=t.iadd(i);return r.cmp(this.m)>=0&&r.isub(this.m),r},_.prototype.sub=function(t,i){this._verify2(t,i);var r=t.sub(i);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},_.prototype.isub=function(t,i){this._verify2(t,i);var r=t.isub(i);return r.cmpn(0)<0&&r.iadd(this.m),r},_.prototype.shl=function(t,i){return this._verify1(t),this.imod(t.ushln(i))},_.prototype.imul=function(t,i){return this._verify2(t,i),this.imod(t.imul(i))},_.prototype.mul=function(t,i){return this._verify2(t,i),this.imod(t.mul(i))},_.prototype.isqr=function(t){return this.imul(t,t.clone())},_.prototype.sqr=function(t){return this.mul(t,t)},_.prototype.sqrt=function(t){if(t.isZero())return t.clone();var i=this.m.andln(3);if(r(i%2==1),3===i){var n=this.m.add(new h(1)).iushrn(2);return this.pow(t,n)}for(var e=this.m.subn(1),o=0;!e.isZero()&&0===e.andln(1);)o++,e.iushrn(1);r(!e.isZero());var s=new h(1).toRed(this),u=s.redNeg(),a=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new h(2*l*l).toRed(this);0!==this.pow(l,a).cmp(u);)l.redIAdd(u);for(var m=this.pow(l,e),f=this.pow(t,e.addn(1).iushrn(1)),d=this.pow(t,e),p=o;0!==d.cmp(s);){for(var M=d,v=0;0!==M.cmp(s);v++)M=M.redSqr();r(v<p);var g=this.pow(m,new h(1).iushln(p-v-1));f=f.redMul(g),m=g.redSqr(),d=d.redMul(m),p=v}return f},_.prototype.invm=function(t){var i=t._invmp(this.m);return 0!==i.negative?(i.negative=0,this.imod(i).redNeg()):this.imod(i)},_.prototype.pow=function(t,i){if(i.isZero())return new h(1).toRed(this);if(0===i.cmpn(1))return t.clone();var r=new Array(16);r[0]=new h(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var e=r[0],o=0,s=0,u=i.bitLength()%26;for(0===u&&(u=26),n=i.length-1;n>=0;n--){for(var a=i.words[n],l=u-1;l>=0;l--){var m=a>>l&1;e!==r[0]&&(e=this.sqr(e)),0!==m||0!==o?(o<<=1,o|=m,(4===++s||0===n&&0===l)&&(e=this.mul(e,r[o]),s=0,o=0)):s=0}u=26}return e},_.prototype.convertTo=function(t){var i=t.umod(this.m);return i===t?i.clone():i},_.prototype.convertFrom=function(t){var i=t.clone();return i.red=null,i},h.mont=function(t){return new k(t)},n(k,_),k.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},k.prototype.convertFrom=function(t){var i=this.imod(t.mul(this.rinv));return i.red=null,i},k.prototype.imul=function(t,i){if(t.isZero()||i.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(i),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),h=r.isub(n).iushrn(this.shift),e=h;return h.cmp(this.m)>=0?e=h.isub(this.m):h.cmpn(0)<0&&(e=h.iadd(this.m)),e._forceRed(this)},k.prototype.mul=function(t,i){if(t.isZero()||i.isZero())return new h(0)._forceRed(this);var r=t.mul(i),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),e=r.isub(n).iushrn(this.shift),o=e;return e.cmp(this.m)>=0?o=e.isub(this.m):e.cmpn(0)<0&&(o=e.iadd(this.m)),o._forceRed(this)},k.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}("undefined"==typeof module||module,this);
|
||
},{"buffer":"sC8V"}],"KsX4":[function(require,module,exports) {
|
||
function r(r,o){if(!r)throw new Error(o||"Assertion failed")}module.exports=r,r.equal=function(r,o,e){if(r!=o)throw new Error(e||"Assertion failed: "+r+" != "+o)};
|
||
},{}],"wQrH":[function(require,module,exports) {
|
||
"use strict";var r=exports;function e(r,e){if(Array.isArray(r))return r.slice();if(!r)return[];var t=[];if("string"!=typeof r){for(var n=0;n<r.length;n++)t[n]=0|r[n];return t}if("hex"===e){(r=r.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(r="0"+r);for(n=0;n<r.length;n+=2)t.push(parseInt(r[n]+r[n+1],16))}else for(n=0;n<r.length;n++){var o=r.charCodeAt(n),u=o>>8,i=255&o;u?t.push(u,i):t.push(i)}return t}function t(r){return 1===r.length?"0"+r:r}function n(r){for(var e="",n=0;n<r.length;n++)e+=t(r[n].toString(16));return e}r.toArray=e,r.zero2=t,r.toHex=n,r.encode=function(r,e){return"hex"===e?n(r):r};
|
||
},{}],"Tt+5":[function(require,module,exports) {
|
||
"use strict";var r=exports,n=require("bn.js"),t=require("minimalistic-assert"),e=require("minimalistic-crypto-utils");function i(r,n,t){var e=new Array(Math.max(r.bitLength(),t)+1);e.fill(0);for(var i=1<<n+1,o=r.clone(),a=0;a<e.length;a++){var s,u=o.andln(i-1);o.isOdd()?(s=u>(i>>1)-1?(i>>1)-u:u,o.isubn(s)):s=0,e[a]=s,o.iushrn(1)}return e}function o(r,n){var t=[[],[]];r=r.clone(),n=n.clone();for(var e,i=0,o=0;r.cmpn(-i)>0||n.cmpn(-o)>0;){var a,s,u=r.andln(3)+i&3,c=n.andln(3)+o&3;3===u&&(u=-1),3===c&&(c=-1),a=0==(1&u)?0:3!==(e=r.andln(7)+i&7)&&5!==e||2!==c?u:-u,t[0].push(a),s=0==(1&c)?0:3!==(e=n.andln(7)+o&7)&&5!==e||2!==u?c:-c,t[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),r.iushrn(1),n.iushrn(1)}return t}function a(r,n,t){var e="_"+n;r.prototype[n]=function(){return void 0!==this[e]?this[e]:this[e]=t.call(this)}}function s(n){return"string"==typeof n?r.toArray(n,"hex"):n}function u(r){return new n(r,"hex","le")}r.assert=t,r.toArray=e.toArray,r.zero2=e.zero2,r.toHex=e.toHex,r.encode=e.encode,r.getNAF=i,r.getJSF=o,r.cachedProperty=a,r.parseBytes=s,r.intFromLE=u;
|
||
},{"bn.js":"RJrg","minimalistic-assert":"KsX4","minimalistic-crypto-utils":"wQrH"}],"2KRs":[function(require,module,exports) {
|
||
var t;function e(t){this.rand=t}if(module.exports=function(r){return t||(t=new e(null)),t.generate(r)},module.exports.Rand=e,e.prototype.generate=function(t){return this._rand(t)},e.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),r=0;r<e.length;r++)e[r]=this.rand.getByte();return e},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?e.prototype._rand=function(t){var e=new Uint8Array(t);return self.crypto.getRandomValues(e),e}:self.msCrypto&&self.msCrypto.getRandomValues?e.prototype._rand=function(t){var e=new Uint8Array(t);return self.msCrypto.getRandomValues(e),e}:"object"==typeof window&&(e.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var r=require("crypto");if("function"!=typeof r.randomBytes)throw new Error("Not supported");e.prototype._rand=function(t){return r.randomBytes(t)}}catch(n){}
|
||
},{"crypto":"sC8V"}],"lL+D":[function(require,module,exports) {
|
||
"use strict";var t=require("bn.js"),e=require("../utils"),n=e.getNAF,r=e.getJSF,i=e.assert;function o(e,n){this.type=e,this.p=new t(n.p,16),this.red=n.prime?t.red(n.prime):t.mont(this.p),this.zero=new t(0).toRed(this.red),this.one=new t(1).toRed(this.red),this.two=new t(2).toRed(this.red),this.n=n.n&&new t(n.n,16),this.g=n.g&&this.pointFromJSON(n.g,n.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function s(t,e){this.curve=t,this.type=e,this.precomputed=null}module.exports=o,o.prototype.point=function(){throw new Error("Not implemented")},o.prototype.validate=function(){throw new Error("Not implemented")},o.prototype._fixedNafMul=function(t,e){i(t.precomputed);var r=t._getDoubles(),o=n(e,1,this._bitLength),s=(1<<r.step+1)-(r.step%2==0?2:1);s/=3;var p,h,d=[];for(p=0;p<o.length;p+=r.step){h=0;for(var u=p+r.step-1;u>=p;u--)h=(h<<1)+o[u];d.push(h)}for(var a=this.jpoint(null,null,null),l=this.jpoint(null,null,null),f=s;f>0;f--){for(p=0;p<d.length;p++)(h=d[p])===f?l=l.mixedAdd(r.points[p]):h===-f&&(l=l.mixedAdd(r.points[p].neg()));a=a.add(l)}return a.toP()},o.prototype._wnafMul=function(t,e){var r=4,o=t._getNAFPoints(r);r=o.wnd;for(var s=o.points,p=n(e,r,this._bitLength),h=this.jpoint(null,null,null),d=p.length-1;d>=0;d--){for(var u=0;d>=0&&0===p[d];d--)u++;if(d>=0&&u++,h=h.dblp(u),d<0)break;var a=p[d];i(0!==a),h="affine"===t.type?a>0?h.mixedAdd(s[a-1>>1]):h.mixedAdd(s[-a-1>>1].neg()):a>0?h.add(s[a-1>>1]):h.add(s[-a-1>>1].neg())}return"affine"===t.type?h.toP():h},o.prototype._wnafMulAdd=function(t,e,i,o,s){var p,h,d,u=this._wnafT1,a=this._wnafT2,l=this._wnafT3,f=0;for(p=0;p<o;p++){var c=(d=e[p])._getNAFPoints(t);u[p]=c.wnd,a[p]=c.points}for(p=o-1;p>=1;p-=2){var g=p-1,m=p;if(1===u[g]&&1===u[m]){var y=[e[g],null,null,e[m]];0===e[g].y.cmp(e[m].y)?(y[1]=e[g].add(e[m]),y[2]=e[g].toJ().mixedAdd(e[m].neg())):0===e[g].y.cmp(e[m].y.redNeg())?(y[1]=e[g].toJ().mixedAdd(e[m]),y[2]=e[g].add(e[m].neg())):(y[1]=e[g].toJ().mixedAdd(e[m]),y[2]=e[g].toJ().mixedAdd(e[m].neg()));var v=[-3,-1,-5,-7,0,7,5,1,3],w=r(i[g],i[m]);for(f=Math.max(w[0].length,f),l[g]=new Array(f),l[m]=new Array(f),h=0;h<f;h++){var b=0|w[0][h],_=0|w[1][h];l[g][h]=v[3*(b+1)+(_+1)],l[m][h]=0,a[g]=y}}else l[g]=n(i[g],u[g],this._bitLength),l[m]=n(i[m],u[m],this._bitLength),f=Math.max(l[g].length,f),f=Math.max(l[m].length,f)}var A=this.jpoint(null,null,null),x=this._wnafT4;for(p=f;p>=0;p--){for(var N=0;p>=0;){var L=!0;for(h=0;h<o;h++)x[h]=0|l[h][p],0!==x[h]&&(L=!1);if(!L)break;N++,p--}if(p>=0&&N++,A=A.dblp(N),p<0)break;for(h=0;h<o;h++){var P=x[h];0!==P&&(P>0?d=a[h][P-1>>1]:P<0&&(d=a[h][-P-1>>1].neg()),A="affine"===d.type?A.mixedAdd(d):A.add(d))}}for(p=0;p<o;p++)a[p]=null;return s?A:A.toP()},o.BasePoint=s,s.prototype.eq=function(){throw new Error("Not implemented")},s.prototype.validate=function(){return this.curve.validate(this)},o.prototype.decodePoint=function(t,n){t=e.toArray(t,n);var r=this.p.byteLength();if((4===t[0]||6===t[0]||7===t[0])&&t.length-1==2*r)return 6===t[0]?i(t[t.length-1]%2==0):7===t[0]&&i(t[t.length-1]%2==1),this.point(t.slice(1,1+r),t.slice(1+r,1+2*r));if((2===t[0]||3===t[0])&&t.length-1===r)return this.pointFromX(t.slice(1,1+r),3===t[0]);throw new Error("Unknown point format")},s.prototype.encodeCompressed=function(t){return this.encode(t,!0)},s.prototype._encode=function(t){var e=this.curve.p.byteLength(),n=this.getX().toArray("be",e);return t?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",e))},s.prototype.encode=function(t,n){return e.encode(this._encode(n),t)},s.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},s.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return!!e&&e.points.length>=Math.ceil((t.bitLength()+1)/e.step)},s.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i<e;i+=t){for(var o=0;o<t;o++)r=r.dbl();n.push(r)}return{step:t,points:n}},s.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],n=(1<<t)-1,r=1===n?null:this.dbl(),i=1;i<n;i++)e[i]=e[i-1].add(r);return{wnd:t,points:e}},s.prototype._getBeta=function(){return null},s.prototype.dblp=function(t){for(var e=this,n=0;n<t;n++)e=e.dbl();return e};
|
||
},{"bn.js":"RJrg","../utils":"Tt+5"}],"4GKf":[function(require,module,exports) {
|
||
"function"==typeof Object.create?module.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:module.exports=function(t,e){if(e){t.super_=e;var o=function(){};o.prototype=e.prototype,t.prototype=new o,t.prototype.constructor=t}};
|
||
},{}],"L/Tq":[function(require,module,exports) {
|
||
"use strict";var r=require("../utils"),e=require("bn.js"),t=require("inherits"),d=require("./base"),i=r.assert;function n(r){d.call(this,"short",r),this.a=new e(r.a,16).toRed(this.red),this.b=new e(r.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(r),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function u(r,t,i,n){d.BasePoint.call(this,r,"affine"),null===t&&null===i?(this.x=null,this.y=null,this.inf=!0):(this.x=new e(t,16),this.y=new e(i,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function s(r,t,i,n){d.BasePoint.call(this,r,"jacobian"),null===t&&null===i&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new e(0)):(this.x=new e(t,16),this.y=new e(i,16),this.z=new e(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}t(n,d),module.exports=n,n.prototype._getEndomorphism=function(r){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,d;if(r.beta)t=new e(r.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(r.lambda)d=new e(r.lambda,16);else{var u=this._getEndoRoots(this.n);0===this.g.mul(u[0]).x.cmp(this.g.x.redMul(t))?d=u[0]:(d=u[1],i(0===this.g.mul(d).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:d,basis:r.basis?r.basis.map(function(r){return{a:new e(r.a,16),b:new e(r.b,16)}}):this._getEndoBasis(d)}}},n.prototype._getEndoRoots=function(r){var t=r===this.p?this.red:e.mont(r),d=new e(2).toRed(t).redInvm(),i=d.redNeg(),n=new e(3).toRed(t).redNeg().redSqrt().redMul(d);return[i.redAdd(n).fromRed(),i.redSub(n).fromRed()]},n.prototype._getEndoBasis=function(r){for(var t,d,i,n,u,s,o,h,p,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),a=r,f=this.n.clone(),c=new e(1),S=new e(0),b=new e(0),v=new e(1),I=0;0!==a.cmpn(0);){var y=f.div(a);h=f.sub(y.mul(a)),p=b.sub(y.mul(c));var A=v.sub(y.mul(S));if(!i&&h.cmp(l)<0)t=o.neg(),d=c,i=h.neg(),n=p;else if(i&&2==++I)break;o=h,f=a,a=h,b=c,c=p,v=S,S=A}u=h.neg(),s=p;var m=i.sqr().add(n.sqr());return u.sqr().add(s.sqr()).cmp(m)>=0&&(u=t,s=d),i.negative&&(i=i.neg(),n=n.neg()),u.negative&&(u=u.neg(),s=s.neg()),[{a:i,b:n},{a:u,b:s}]},n.prototype._endoSplit=function(r){var e=this.endo.basis,t=e[0],d=e[1],i=d.b.mul(r).divRound(this.n),n=t.b.neg().mul(r).divRound(this.n),u=i.mul(t.a),s=n.mul(d.a),o=i.mul(t.b),h=n.mul(d.b);return{k1:r.sub(u).sub(s),k2:o.add(h).neg()}},n.prototype.pointFromX=function(r,t){(r=new e(r,16)).red||(r=r.toRed(this.red));var d=r.redSqr().redMul(r).redIAdd(r.redMul(this.a)).redIAdd(this.b),i=d.redSqrt();if(0!==i.redSqr().redSub(d).cmp(this.zero))throw new Error("invalid point");var n=i.fromRed().isOdd();return(t&&!n||!t&&n)&&(i=i.redNeg()),this.point(r,i)},n.prototype.validate=function(r){if(r.inf)return!0;var e=r.x,t=r.y,d=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(d).redIAdd(this.b);return 0===t.redSqr().redISub(i).cmpn(0)},n.prototype._endoWnafMulAdd=function(r,e,t){for(var d=this._endoWnafT1,i=this._endoWnafT2,n=0;n<r.length;n++){var u=this._endoSplit(e[n]),s=r[n],o=s._getBeta();u.k1.negative&&(u.k1.ineg(),s=s.neg(!0)),u.k2.negative&&(u.k2.ineg(),o=o.neg(!0)),d[2*n]=s,d[2*n+1]=o,i[2*n]=u.k1,i[2*n+1]=u.k2}for(var h=this._wnafMulAdd(1,d,i,2*n,t),p=0;p<2*n;p++)d[p]=null,i[p]=null;return h},t(u,d.BasePoint),n.prototype.point=function(r,e,t){return new u(this,r,e,t)},n.prototype.pointFromJSON=function(r,e){return u.fromJSON(this,r,e)},u.prototype._getBeta=function(){if(this.curve.endo){var r=this.precomputed;if(r&&r.beta)return r.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(r){var t=this.curve,d=function(r){return t.point(r.x.redMul(t.endo.beta),r.y)};r.beta=e,e.precomputed={beta:null,naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(d)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(d)}}}return e}},u.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},u.fromJSON=function(r,e,t){"string"==typeof e&&(e=JSON.parse(e));var d=r.point(e[0],e[1],t);if(!e[2])return d;function i(e){return r.point(e[0],e[1],t)}var n=e[2];return d.precomputed={beta:null,doubles:n.doubles&&{step:n.doubles.step,points:[d].concat(n.doubles.points.map(i))},naf:n.naf&&{wnd:n.naf.wnd,points:[d].concat(n.naf.points.map(i))}},d},u.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},u.prototype.isInfinity=function(){return this.inf},u.prototype.add=function(r){if(this.inf)return r;if(r.inf)return this;if(this.eq(r))return this.dbl();if(this.neg().eq(r))return this.curve.point(null,null);if(0===this.x.cmp(r.x))return this.curve.point(null,null);var e=this.y.redSub(r.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(r.x).redInvm()));var t=e.redSqr().redISub(this.x).redISub(r.x),d=e.redMul(this.x.redSub(t)).redISub(this.y);return this.curve.point(t,d)},u.prototype.dbl=function(){if(this.inf)return this;var r=this.y.redAdd(this.y);if(0===r.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,t=this.x.redSqr(),d=r.redInvm(),i=t.redAdd(t).redIAdd(t).redIAdd(e).redMul(d),n=i.redSqr().redISub(this.x.redAdd(this.x)),u=i.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,u)},u.prototype.getX=function(){return this.x.fromRed()},u.prototype.getY=function(){return this.y.fromRed()},u.prototype.mul=function(r){return r=new e(r,16),this.isInfinity()?this:this._hasDoubles(r)?this.curve._fixedNafMul(this,r):this.curve.endo?this.curve._endoWnafMulAdd([this],[r]):this.curve._wnafMul(this,r)},u.prototype.mulAdd=function(r,e,t){var d=[this,e],i=[r,t];return this.curve.endo?this.curve._endoWnafMulAdd(d,i):this.curve._wnafMulAdd(1,d,i,2)},u.prototype.jmulAdd=function(r,e,t){var d=[this,e],i=[r,t];return this.curve.endo?this.curve._endoWnafMulAdd(d,i,!0):this.curve._wnafMulAdd(1,d,i,2,!0)},u.prototype.eq=function(r){return this===r||this.inf===r.inf&&(this.inf||0===this.x.cmp(r.x)&&0===this.y.cmp(r.y))},u.prototype.neg=function(r){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(r&&this.precomputed){var t=this.precomputed,d=function(r){return r.neg()};e.precomputed={naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(d)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(d)}}}return e},u.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},t(s,d.BasePoint),n.prototype.jpoint=function(r,e,t){return new s(this,r,e,t)},s.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var r=this.z.redInvm(),e=r.redSqr(),t=this.x.redMul(e),d=this.y.redMul(e).redMul(r);return this.curve.point(t,d)},s.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},s.prototype.add=function(r){if(this.isInfinity())return r;if(r.isInfinity())return this;var e=r.z.redSqr(),t=this.z.redSqr(),d=this.x.redMul(e),i=r.x.redMul(t),n=this.y.redMul(e.redMul(r.z)),u=r.y.redMul(t.redMul(this.z)),s=d.redSub(i),o=n.redSub(u);if(0===s.cmpn(0))return 0!==o.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h=s.redSqr(),p=h.redMul(s),l=d.redMul(h),a=o.redSqr().redIAdd(p).redISub(l).redISub(l),f=o.redMul(l.redISub(a)).redISub(n.redMul(p)),c=this.z.redMul(r.z).redMul(s);return this.curve.jpoint(a,f,c)},s.prototype.mixedAdd=function(r){if(this.isInfinity())return r.toJ();if(r.isInfinity())return this;var e=this.z.redSqr(),t=this.x,d=r.x.redMul(e),i=this.y,n=r.y.redMul(e).redMul(this.z),u=t.redSub(d),s=i.redSub(n);if(0===u.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var o=u.redSqr(),h=o.redMul(u),p=t.redMul(o),l=s.redSqr().redIAdd(h).redISub(p).redISub(p),a=s.redMul(p.redISub(l)).redISub(i.redMul(h)),f=this.z.redMul(u);return this.curve.jpoint(l,a,f)},s.prototype.dblp=function(r){if(0===r)return this;if(this.isInfinity())return this;if(!r)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var t=this;for(e=0;e<r;e++)t=t.dbl();return t}var d=this.curve.a,i=this.curve.tinv,n=this.x,u=this.y,s=this.z,o=s.redSqr().redSqr(),h=u.redAdd(u);for(e=0;e<r;e++){var p=n.redSqr(),l=h.redSqr(),a=l.redSqr(),f=p.redAdd(p).redIAdd(p).redIAdd(d.redMul(o)),c=n.redMul(l),S=f.redSqr().redISub(c.redAdd(c)),b=c.redISub(S),v=f.redMul(b);v=v.redIAdd(v).redISub(a);var I=h.redMul(s);e+1<r&&(o=o.redMul(a)),n=S,s=I,h=v}return this.curve.jpoint(n,h.redMul(i),s)},s.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},s.prototype._zeroDbl=function(){var r,e,t;if(this.zOne){var d=this.x.redSqr(),i=this.y.redSqr(),n=i.redSqr(),u=this.x.redAdd(i).redSqr().redISub(d).redISub(n);u=u.redIAdd(u);var s=d.redAdd(d).redIAdd(d),o=s.redSqr().redISub(u).redISub(u),h=n.redIAdd(n);h=(h=h.redIAdd(h)).redIAdd(h),r=o,e=s.redMul(u.redISub(o)).redISub(h),t=this.y.redAdd(this.y)}else{var p=this.x.redSqr(),l=this.y.redSqr(),a=l.redSqr(),f=this.x.redAdd(l).redSqr().redISub(p).redISub(a);f=f.redIAdd(f);var c=p.redAdd(p).redIAdd(p),S=c.redSqr(),b=a.redIAdd(a);b=(b=b.redIAdd(b)).redIAdd(b),r=S.redISub(f).redISub(f),e=c.redMul(f.redISub(r)).redISub(b),t=(t=this.y.redMul(this.z)).redIAdd(t)}return this.curve.jpoint(r,e,t)},s.prototype._threeDbl=function(){var r,e,t;if(this.zOne){var d=this.x.redSqr(),i=this.y.redSqr(),n=i.redSqr(),u=this.x.redAdd(i).redSqr().redISub(d).redISub(n);u=u.redIAdd(u);var s=d.redAdd(d).redIAdd(d).redIAdd(this.curve.a),o=s.redSqr().redISub(u).redISub(u);r=o;var h=n.redIAdd(n);h=(h=h.redIAdd(h)).redIAdd(h),e=s.redMul(u.redISub(o)).redISub(h),t=this.y.redAdd(this.y)}else{var p=this.z.redSqr(),l=this.y.redSqr(),a=this.x.redMul(l),f=this.x.redSub(p).redMul(this.x.redAdd(p));f=f.redAdd(f).redIAdd(f);var c=a.redIAdd(a),S=(c=c.redIAdd(c)).redAdd(c);r=f.redSqr().redISub(S),t=this.y.redAdd(this.z).redSqr().redISub(l).redISub(p);var b=l.redSqr();b=(b=(b=b.redIAdd(b)).redIAdd(b)).redIAdd(b),e=f.redMul(c.redISub(r)).redISub(b)}return this.curve.jpoint(r,e,t)},s.prototype._dbl=function(){var r=this.curve.a,e=this.x,t=this.y,d=this.z,i=d.redSqr().redSqr(),n=e.redSqr(),u=t.redSqr(),s=n.redAdd(n).redIAdd(n).redIAdd(r.redMul(i)),o=e.redAdd(e),h=(o=o.redIAdd(o)).redMul(u),p=s.redSqr().redISub(h.redAdd(h)),l=h.redISub(p),a=u.redSqr();a=(a=(a=a.redIAdd(a)).redIAdd(a)).redIAdd(a);var f=s.redMul(l).redISub(a),c=t.redAdd(t).redMul(d);return this.curve.jpoint(p,f,c)},s.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var r=this.x.redSqr(),e=this.y.redSqr(),t=this.z.redSqr(),d=e.redSqr(),i=r.redAdd(r).redIAdd(r),n=i.redSqr(),u=this.x.redAdd(e).redSqr().redISub(r).redISub(d),s=(u=(u=(u=u.redIAdd(u)).redAdd(u).redIAdd(u)).redISub(n)).redSqr(),o=d.redIAdd(d);o=(o=(o=o.redIAdd(o)).redIAdd(o)).redIAdd(o);var h=i.redIAdd(u).redSqr().redISub(n).redISub(s).redISub(o),p=e.redMul(h);p=(p=p.redIAdd(p)).redIAdd(p);var l=this.x.redMul(s).redISub(p);l=(l=l.redIAdd(l)).redIAdd(l);var a=this.y.redMul(h.redMul(o.redISub(h)).redISub(u.redMul(s)));a=(a=(a=a.redIAdd(a)).redIAdd(a)).redIAdd(a);var f=this.z.redAdd(u).redSqr().redISub(t).redISub(s);return this.curve.jpoint(l,a,f)},s.prototype.mul=function(r,t){return r=new e(r,t),this.curve._wnafMul(this,r)},s.prototype.eq=function(r){if("affine"===r.type)return this.eq(r.toJ());if(this===r)return!0;var e=this.z.redSqr(),t=r.z.redSqr();if(0!==this.x.redMul(t).redISub(r.x.redMul(e)).cmpn(0))return!1;var d=e.redMul(this.z),i=t.redMul(r.z);return 0===this.y.redMul(i).redISub(r.y.redMul(d)).cmpn(0)},s.prototype.eqXToP=function(r){var e=this.z.redSqr(),t=r.toRed(this.curve.red).redMul(e);if(0===this.x.cmp(t))return!0;for(var d=r.clone(),i=this.curve.redN.redMul(e);;){if(d.iadd(this.curve.n),d.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(i),0===this.x.cmp(t))return!0}},s.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},s.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};
|
||
},{"../utils":"Tt+5","bn.js":"RJrg","inherits":"4GKf","./base":"lL+D"}],"9jvr":[function(require,module,exports) {
|
||
"use strict";var t=require("bn.js"),r=require("inherits"),e=require("./base"),i=require("../utils");function o(r){e.call(this,"mont",r),this.a=new t(r.a,16).toRed(this.red),this.b=new t(r.b,16).toRed(this.red),this.i4=new t(4).toRed(this.red).redInvm(),this.two=new t(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function n(r,i,o){e.BasePoint.call(this,r,"projective"),null===i&&null===o?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new t(i,16),this.z=new t(o,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}r(o,e),module.exports=o,o.prototype.validate=function(t){var r=t.normalize().x,e=r.redSqr(),i=e.redMul(r).redAdd(e.redMul(this.a)).redAdd(r);return 0===i.redSqrt().redSqr().cmp(i)},r(n,e.BasePoint),o.prototype.decodePoint=function(t,r){return this.point(i.toArray(t,r),1)},o.prototype.point=function(t,r){return new n(this,t,r)},o.prototype.pointFromJSON=function(t){return n.fromJSON(this,t)},n.prototype.precompute=function(){},n.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},n.fromJSON=function(t,r){return new n(t,r[0],r[1]||t.one)},n.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},n.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},n.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),r=this.x.redSub(this.z).redSqr(),e=t.redSub(r),i=t.redMul(r),o=e.redMul(r.redAdd(this.curve.a24.redMul(e)));return this.curve.point(i,o)},n.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},n.prototype.diffAdd=function(t,r){var e=this.x.redAdd(this.z),i=this.x.redSub(this.z),o=t.x.redAdd(t.z),n=t.x.redSub(t.z).redMul(e),d=o.redMul(i),u=r.z.redMul(n.redAdd(d).redSqr()),s=r.x.redMul(n.redISub(d).redSqr());return this.curve.point(u,s)},n.prototype.mul=function(t){for(var r=t.clone(),e=this,i=this.curve.point(null,null),o=[];0!==r.cmpn(0);r.iushrn(1))o.push(r.andln(1));for(var n=o.length-1;n>=0;n--)0===o[n]?(e=e.diffAdd(i,this),i=i.dbl()):(i=e.diffAdd(i,this),e=e.dbl());return i},n.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},n.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},n.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},n.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},n.prototype.getX=function(){return this.normalize(),this.x.fromRed()};
|
||
},{"bn.js":"RJrg","inherits":"4GKf","./base":"lL+D","../utils":"Tt+5"}],"dT4g":[function(require,module,exports) {
|
||
"use strict";var t=require("../utils"),e=require("bn.js"),r=require("inherits"),i=require("./base"),d=t.assert;function s(t){this.twisted=1!=(0|t.a),this.mOneA=this.twisted&&-1==(0|t.a),this.extended=this.mOneA,i.call(this,"edwards",t),this.a=new e(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new e(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new e(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),d(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|t.c)}function u(t,r,d,s,u){i.BasePoint.call(this,t,"projective"),null===r&&null===d&&null===s?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new e(r,16),this.y=new e(d,16),this.z=s?new e(s,16):this.curve.one,this.t=u&&new e(u,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}r(s,i),module.exports=s,s.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},s.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},s.prototype.jpoint=function(t,e,r,i){return this.point(t,e,r,i)},s.prototype.pointFromX=function(t,r){(t=new e(t,16)).red||(t=t.toRed(this.red));var i=t.redSqr(),d=this.c2.redSub(this.a.redMul(i)),s=this.one.redSub(this.c2.redMul(this.d).redMul(i)),u=d.redMul(s.redInvm()),h=u.redSqrt();if(0!==h.redSqr().redSub(u).cmp(this.zero))throw new Error("invalid point");var n=h.fromRed().isOdd();return(r&&!n||!r&&n)&&(h=h.redNeg()),this.point(t,h)},s.prototype.pointFromY=function(t,r){(t=new e(t,16)).red||(t=t.toRed(this.red));var i=t.redSqr(),d=i.redSub(this.c2),s=i.redMul(this.d).redMul(this.c2).redSub(this.a),u=d.redMul(s.redInvm());if(0===u.cmp(this.zero)){if(r)throw new Error("invalid point");return this.point(this.zero,t)}var h=u.redSqrt();if(0!==h.redSqr().redSub(u).cmp(this.zero))throw new Error("invalid point");return h.fromRed().isOdd()!==r&&(h=h.redNeg()),this.point(h,t)},s.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),r=t.y.redSqr(),i=e.redMul(this.a).redAdd(r),d=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(r)));return 0===i.cmp(d)},r(u,i.BasePoint),s.prototype.pointFromJSON=function(t){return u.fromJSON(this,t)},s.prototype.point=function(t,e,r,i){return new u(this,t,e,r,i)},u.fromJSON=function(t,e){return new u(t,e[0],e[1],e[2])},u.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},u.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},u.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var i=this.curve._mulA(t),d=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),s=i.redAdd(e),u=s.redSub(r),h=i.redSub(e),n=d.redMul(u),o=s.redMul(h),c=d.redMul(h),l=u.redMul(s);return this.curve.point(n,o,l,c)},u.prototype._projDbl=function(){var t,e,r,i,d,s,u=this.x.redAdd(this.y).redSqr(),h=this.x.redSqr(),n=this.y.redSqr();if(this.curve.twisted){var o=(i=this.curve._mulA(h)).redAdd(n);this.zOne?(t=u.redSub(h).redSub(n).redMul(o.redSub(this.curve.two)),e=o.redMul(i.redSub(n)),r=o.redSqr().redSub(o).redSub(o)):(d=this.z.redSqr(),s=o.redSub(d).redISub(d),t=u.redSub(h).redISub(n).redMul(s),e=o.redMul(i.redSub(n)),r=o.redMul(s))}else i=h.redAdd(n),d=this.curve._mulC(this.z).redSqr(),s=i.redSub(d).redSub(d),t=this.curve._mulC(u.redISub(i)).redMul(s),e=this.curve._mulC(i).redMul(h.redISub(n)),r=i.redMul(s);return this.curve.point(t,e,r)},u.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},u.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),r=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),i=this.t.redMul(this.curve.dd).redMul(t.t),d=this.z.redMul(t.z.redAdd(t.z)),s=r.redSub(e),u=d.redSub(i),h=d.redAdd(i),n=r.redAdd(e),o=s.redMul(u),c=h.redMul(n),l=s.redMul(n),p=u.redMul(h);return this.curve.point(o,c,p,l)},u.prototype._projAdd=function(t){var e,r,i=this.z.redMul(t.z),d=i.redSqr(),s=this.x.redMul(t.x),u=this.y.redMul(t.y),h=this.curve.d.redMul(s).redMul(u),n=d.redSub(h),o=d.redAdd(h),c=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(s).redISub(u),l=i.redMul(n).redMul(c);return this.curve.twisted?(e=i.redMul(o).redMul(u.redSub(this.curve._mulA(s))),r=n.redMul(o)):(e=i.redMul(o).redMul(u.redSub(s)),r=this.curve._mulC(n).redMul(o)),this.curve.point(l,e,r)},u.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},u.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},u.prototype.mulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!1)},u.prototype.jmulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!0)},u.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},u.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()},u.prototype.getY=function(){return this.normalize(),this.y.fromRed()},u.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},u.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var r=t.clone(),i=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(i),0===this.x.cmp(e))return!0}},u.prototype.toP=u.prototype.normalize,u.prototype.mixedAdd=u.prototype.add;
|
||
},{"../utils":"Tt+5","bn.js":"RJrg","inherits":"4GKf","./base":"lL+D"}],"CHLP":[function(require,module,exports) {
|
||
"use strict";var r=exports;r.base=require("./base"),r.short=require("./short"),r.mont=require("./mont"),r.edwards=require("./edwards");
|
||
},{"./base":"lL+D","./short":"L/Tq","./mont":"9jvr","./edwards":"dT4g"}],"EcoY":[function(require,module,exports) {
|
||
"use strict";var r=require("minimalistic-assert"),t=require("inherits");function n(r,t){return 55296==(64512&r.charCodeAt(t))&&(!(t<0||t+1>=r.length)&&56320==(64512&r.charCodeAt(t+1)))}function e(r,t){if(Array.isArray(r))return r.slice();if(!r)return[];var e=[];if("string"==typeof r)if(t){if("hex"===t)for((r=r.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(r="0"+r),u=0;u<r.length;u+=2)e.push(parseInt(r[u]+r[u+1],16))}else for(var o=0,u=0;u<r.length;u++){var i=r.charCodeAt(u);i<128?e[o++]=i:i<2048?(e[o++]=i>>6|192,e[o++]=63&i|128):n(r,u)?(i=65536+((1023&i)<<10)+(1023&r.charCodeAt(++u)),e[o++]=i>>18|240,e[o++]=i>>12&63|128,e[o++]=i>>6&63|128,e[o++]=63&i|128):(e[o++]=i>>12|224,e[o++]=i>>6&63|128,e[o++]=63&i|128)}else for(u=0;u<r.length;u++)e[u]=0|r[u];return e}function o(r){for(var t="",n=0;n<r.length;n++)t+=s(r[n].toString(16));return t}function u(r){return(r>>>24|r>>>8&65280|r<<8&16711680|(255&r)<<24)>>>0}function i(r,t){for(var n="",e=0;e<r.length;e++){var o=r[e];"little"===t&&(o=u(o)),n+=f(o.toString(16))}return n}function s(r){return 1===r.length?"0"+r:r}function f(r){return 7===r.length?"0"+r:6===r.length?"00"+r:5===r.length?"000"+r:4===r.length?"0000"+r:3===r.length?"00000"+r:2===r.length?"000000"+r:1===r.length?"0000000"+r:r}function c(t,n,e,o){var u=e-n;r(u%4==0);for(var i=new Array(u/4),s=0,f=n;s<i.length;s++,f+=4){var c;c="big"===o?t[f]<<24|t[f+1]<<16|t[f+2]<<8|t[f+3]:t[f+3]<<24|t[f+2]<<16|t[f+1]<<8|t[f],i[s]=c>>>0}return i}function h(r,t){for(var n=new Array(4*r.length),e=0,o=0;e<r.length;e++,o+=4){var u=r[e];"big"===t?(n[o]=u>>>24,n[o+1]=u>>>16&255,n[o+2]=u>>>8&255,n[o+3]=255&u):(n[o+3]=u>>>24,n[o+2]=u>>>16&255,n[o+1]=u>>>8&255,n[o]=255&u)}return n}function l(r,t){return r>>>t|r<<32-t}function p(r,t){return r<<t|r>>>32-t}function a(r,t){return r+t>>>0}function x(r,t,n){return r+t+n>>>0}function g(r,t,n,e){return r+t+n+e>>>0}function _(r,t,n,e,o){return r+t+n+e+o>>>0}function v(r,t,n,e){var o=r[t],u=e+r[t+1]>>>0,i=(u<e?1:0)+n+o;r[t]=i>>>0,r[t+1]=u}function m(r,t,n,e){return(t+e>>>0<t?1:0)+r+n>>>0}function A(r,t,n,e){return t+e>>>0}function y(r,t,n,e,o,u,i,s){var f=0,c=t;return f+=(c=c+e>>>0)<t?1:0,f+=(c=c+u>>>0)<u?1:0,r+n+o+i+(f+=(c=c+s>>>0)<s?1:0)>>>0}function d(r,t,n,e,o,u,i,s){return t+e+u+s>>>0}function C(r,t,n,e,o,u,i,s,f,c){var h=0,l=t;return h+=(l=l+e>>>0)<t?1:0,h+=(l=l+u>>>0)<u?1:0,h+=(l=l+s>>>0)<s?1:0,r+n+o+i+f+(h+=(l=l+c>>>0)<c?1:0)>>>0}function z(r,t,n,e,o,u,i,s,f,c){return t+e+u+s+c>>>0}function b(r,t,n){return(t<<32-n|r>>>n)>>>0}function q(r,t,n){return(r<<32-n|t>>>n)>>>0}function w(r,t,n){return r>>>n}function H(r,t,n){return(r<<32-n|t>>>n)>>>0}exports.inherits=t,exports.toArray=e,exports.toHex=o,exports.htonl=u,exports.toHex32=i,exports.zero2=s,exports.zero8=f,exports.join32=c,exports.split32=h,exports.rotr32=l,exports.rotl32=p,exports.sum32=a,exports.sum32_3=x,exports.sum32_4=g,exports.sum32_5=_,exports.sum64=v,exports.sum64_hi=m,exports.sum64_lo=A,exports.sum64_4_hi=y,exports.sum64_4_lo=d,exports.sum64_5_hi=C,exports.sum64_5_lo=z,exports.rotr64_hi=b,exports.rotr64_lo=q,exports.shr64_hi=w,exports.shr64_lo=H;
|
||
},{"minimalistic-assert":"KsX4","inherits":"4GKf"}],"I2N/":[function(require,module,exports) {
|
||
"use strict";var t=require("./utils"),i=require("minimalistic-assert");function n(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}exports.BlockHash=n,n.prototype.update=function(i,n){if(i=t.toArray(i,n),this.pending?this.pending=this.pending.concat(i):this.pending=i,this.pendingTotal+=i.length,this.pending.length>=this._delta8){var e=(i=this.pending).length%this._delta8;this.pending=i.slice(i.length-e,i.length),0===this.pending.length&&(this.pending=null),i=t.join32(i,0,i.length-e,this.endian);for(var h=0;h<i.length;h+=this._delta32)this._update(i,h,h+this._delta32)}return this},n.prototype.digest=function(t){return this.update(this._pad()),i(null===this.pending),this._digest(t)},n.prototype._pad=function(){var t=this.pendingTotal,i=this._delta8,n=i-(t+this.padLength)%i,e=new Array(n+this.padLength);e[0]=128;for(var h=1;h<n;h++)e[h]=0;if(t<<=3,"big"===this.endian){for(var s=8;s<this.padLength;s++)e[h++]=0;e[h++]=0,e[h++]=0,e[h++]=0,e[h++]=0,e[h++]=t>>>24&255,e[h++]=t>>>16&255,e[h++]=t>>>8&255,e[h++]=255&t}else for(e[h++]=255&t,e[h++]=t>>>8&255,e[h++]=t>>>16&255,e[h++]=t>>>24&255,e[h++]=0,e[h++]=0,e[h++]=0,e[h++]=0,s=8;s<this.padLength;s++)e[h++]=0;return e};
|
||
},{"./utils":"EcoY","minimalistic-assert":"KsX4"}],"h+GD":[function(require,module,exports) {
|
||
"use strict";var r=require("../utils"),t=r.rotr32;function n(r,t,n,s){return 0===r?e(t,n,s):1===r||3===r?o(t,n,s):2===r?u(t,n,s):void 0}function e(r,t,n){return r&t^~r&n}function u(r,t,n){return r&t^r&n^t&n}function o(r,t,n){return r^t^n}function s(r){return t(r,2)^t(r,13)^t(r,22)}function i(r){return t(r,6)^t(r,11)^t(r,25)}function c(r){return t(r,7)^t(r,18)^r>>>3}function f(r){return t(r,17)^t(r,19)^r>>>10}exports.ft_1=n,exports.ch32=e,exports.maj32=u,exports.p32=o,exports.s0_256=s,exports.s1_256=i,exports.g0_256=c,exports.g1_256=f;
|
||
},{"../utils":"EcoY"}],"07O1":[function(require,module,exports) {
|
||
"use strict";var t=require("../utils"),h=require("../common"),i=require("./common"),s=t.rotl32,e=t.sum32,r=t.sum32_5,o=i.ft_1,n=h.BlockHash,u=[1518500249,1859775393,2400959708,3395469782];function a(){if(!(this instanceof a))return new a;n.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}t.inherits(a,n),module.exports=a,a.blockSize=512,a.outSize=160,a.hmacStrength=80,a.padLength=64,a.prototype._update=function(t,h){for(var i=this.W,n=0;n<16;n++)i[n]=t[h+n];for(;n<i.length;n++)i[n]=s(i[n-3]^i[n-8]^i[n-14]^i[n-16],1);var a=this.h[0],c=this.h[1],l=this.h[2],f=this.h[3],m=this.h[4];for(n=0;n<i.length;n++){var p=~~(n/20),g=r(s(a,5),o(p,c,l,f),m,i[n],u[p]);m=f,f=l,l=s(c,30),c=a,a=g}this.h[0]=e(this.h[0],a),this.h[1]=e(this.h[1],c),this.h[2]=e(this.h[2],l),this.h[3]=e(this.h[3],f),this.h[4]=e(this.h[4],m)},a.prototype._digest=function(h){return"hex"===h?t.toHex32(this.h,"big"):t.split32(this.h,"big")};
|
||
},{"../utils":"EcoY","../common":"I2N/","./common":"h+GD"}],"Jvfw":[function(require,module,exports) {
|
||
"use strict";var h=require("../utils"),t=require("../common"),i=require("./common"),s=require("minimalistic-assert"),e=h.sum32,r=h.sum32_4,n=h.sum32_5,o=i.ch32,u=i.maj32,a=i.s0_256,c=i.s1_256,l=i.g0_256,m=i.g1_256,g=t.BlockHash,f=[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];function p(){if(!(this instanceof p))return new p;g.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=f,this.W=new Array(64)}h.inherits(p,g),module.exports=p,p.blockSize=512,p.outSize=256,p.hmacStrength=192,p.padLength=64,p.prototype._update=function(h,t){for(var i=this.W,g=0;g<16;g++)i[g]=h[t+g];for(;g<i.length;g++)i[g]=r(m(i[g-2]),i[g-7],l(i[g-15]),i[g-16]);var f=this.h[0],p=this.h[1],_=this.h[2],k=this.h[3],d=this.h[4],q=this.h[5],v=this.h[6],b=this.h[7];for(s(this.k.length===i.length),g=0;g<i.length;g++){var x=n(b,c(d),o(d,q,v),this.k[g],i[g]),y=e(a(f),u(f,p,_));b=v,v=q,q=d,d=e(k,x),k=_,_=p,p=f,f=e(x,y)}this.h[0]=e(this.h[0],f),this.h[1]=e(this.h[1],p),this.h[2]=e(this.h[2],_),this.h[3]=e(this.h[3],k),this.h[4]=e(this.h[4],d),this.h[5]=e(this.h[5],q),this.h[6]=e(this.h[6],v),this.h[7]=e(this.h[7],b)},p.prototype._digest=function(t){return"hex"===t?h.toHex32(this.h,"big"):h.split32(this.h,"big")};
|
||
},{"../utils":"EcoY","../common":"I2N/","./common":"h+GD","minimalistic-assert":"KsX4"}],"tpCG":[function(require,module,exports) {
|
||
"use strict";var t=require("../utils"),i=require("./256");function e(){if(!(this instanceof e))return new e;i.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}t.inherits(e,i),module.exports=e,e.blockSize=512,e.outSize=224,e.hmacStrength=192,e.padLength=64,e.prototype._digest=function(i){return"hex"===i?t.toHex32(this.h.slice(0,7),"big"):t.split32(this.h.slice(0,7),"big")};
|
||
},{"../utils":"EcoY","./256":"Jvfw"}],"Cpel":[function(require,module,exports) {
|
||
"use strict";var t=require("../utils"),h=require("../common"),i=require("minimalistic-assert"),r=t.rotr64_hi,n=t.rotr64_lo,s=t.shr64_hi,e=t.shr64_lo,u=t.sum64,o=t.sum64_hi,a=t.sum64_lo,c=t.sum64_4_hi,f=t.sum64_4_lo,l=t.sum64_5_hi,v=t.sum64_5_lo,_=h.BlockHash,p=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function m(){if(!(this instanceof m))return new m;_.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=p,this.W=new Array(160)}function g(t,h,i,r,n){var s=t&i^~t&n;return s<0&&(s+=4294967296),s}function k(t,h,i,r,n,s){var e=h&r^~h&s;return e<0&&(e+=4294967296),e}function d(t,h,i,r,n){var s=t&i^t&n^i&n;return s<0&&(s+=4294967296),s}function y(t,h,i,r,n,s){var e=h&r^h&s^r&s;return e<0&&(e+=4294967296),e}function b(t,h){var i=r(t,h,28)^r(h,t,2)^r(h,t,7);return i<0&&(i+=4294967296),i}function q(t,h){var i=n(t,h,28)^n(h,t,2)^n(h,t,7);return i<0&&(i+=4294967296),i}function x(t,h){var i=r(t,h,14)^r(t,h,18)^r(h,t,9);return i<0&&(i+=4294967296),i}function B(t,h){var i=n(t,h,14)^n(t,h,18)^n(h,t,9);return i<0&&(i+=4294967296),i}function S(t,h){var i=r(t,h,1)^r(t,h,8)^s(t,h,7);return i<0&&(i+=4294967296),i}function W(t,h){var i=n(t,h,1)^n(t,h,8)^e(t,h,7);return i<0&&(i+=4294967296),i}function w(t,h){var i=r(t,h,19)^r(h,t,29)^s(t,h,6);return i<0&&(i+=4294967296),i}function z(t,h){var i=n(t,h,19)^n(h,t,29)^e(t,h,6);return i<0&&(i+=4294967296),i}t.inherits(m,_),module.exports=m,m.blockSize=1024,m.outSize=512,m.hmacStrength=192,m.padLength=128,m.prototype._prepareBlock=function(t,h){for(var i=this.W,r=0;r<32;r++)i[r]=t[h+r];for(;r<i.length;r+=2){var n=w(i[r-4],i[r-3]),s=z(i[r-4],i[r-3]),e=i[r-14],u=i[r-13],o=S(i[r-30],i[r-29]),a=W(i[r-30],i[r-29]),l=i[r-32],v=i[r-31];i[r]=c(n,s,e,u,o,a,l,v),i[r+1]=f(n,s,e,u,o,a,l,v)}},m.prototype._update=function(t,h){this._prepareBlock(t,h);var r=this.W,n=this.h[0],s=this.h[1],e=this.h[2],c=this.h[3],f=this.h[4],_=this.h[5],p=this.h[6],m=this.h[7],S=this.h[8],W=this.h[9],w=this.h[10],z=this.h[11],H=this.h[12],A=this.h[13],L=this.h[14],j=this.h[15];i(this.k.length===r.length);for(var C=0;C<r.length;C+=2){var D=L,E=j,F=x(S,W),G=B(S,W),I=g(S,W,w,z,H,A),J=k(S,W,w,z,H,A),K=this.k[C],M=this.k[C+1],N=r[C],O=r[C+1],P=l(D,E,F,G,I,J,K,M,N,O),Q=v(D,E,F,G,I,J,K,M,N,O);D=b(n,s),E=q(n,s),F=d(n,s,e,c,f,_),G=y(n,s,e,c,f,_);var R=o(D,E,F,G),T=a(D,E,F,G);L=H,j=A,H=w,A=z,w=S,z=W,S=o(p,m,P,Q),W=a(m,m,P,Q),p=f,m=_,f=e,_=c,e=n,c=s,n=o(P,Q,R,T),s=a(P,Q,R,T)}u(this.h,0,n,s),u(this.h,2,e,c),u(this.h,4,f,_),u(this.h,6,p,m),u(this.h,8,S,W),u(this.h,10,w,z),u(this.h,12,H,A),u(this.h,14,L,j)},m.prototype._digest=function(h){return"hex"===h?t.toHex32(this.h,"big"):t.split32(this.h,"big")};
|
||
},{"../utils":"EcoY","../common":"I2N/","minimalistic-assert":"KsX4"}],"oAfu":[function(require,module,exports) {
|
||
"use strict";var t=require("../utils"),i=require("./512");function e(){if(!(this instanceof e))return new e;i.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}t.inherits(e,i),module.exports=e,e.blockSize=1024,e.outSize=384,e.hmacStrength=192,e.padLength=128,e.prototype._digest=function(i){return"hex"===i?t.toHex32(this.h.slice(0,12),"big"):t.split32(this.h.slice(0,12),"big")};
|
||
},{"../utils":"EcoY","./512":"Cpel"}],"cz3W":[function(require,module,exports) {
|
||
"use strict";exports.sha1=require("./sha/1"),exports.sha224=require("./sha/224"),exports.sha256=require("./sha/256"),exports.sha384=require("./sha/384"),exports.sha512=require("./sha/512");
|
||
},{"./sha/1":"07O1","./sha/224":"tpCG","./sha/256":"Jvfw","./sha/384":"oAfu","./sha/512":"Cpel"}],"lOb7":[function(require,module,exports) {
|
||
"use strict";var t=require("./utils"),h=require("./common"),i=t.rotl32,s=t.sum32,e=t.sum32_3,r=t.sum32_4,n=h.BlockHash;function o(){if(!(this instanceof o))return new o;n.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function u(t,h,i,s){return t<=15?h^i^s:t<=31?h&i|~h&s:t<=47?(h|~i)^s:t<=63?h&s|i&~s:h^(i|~s)}function c(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function l(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}t.inherits(o,n),exports.ripemd160=o,o.blockSize=512,o.outSize=160,o.hmacStrength=192,o.padLength=64,o.prototype._update=function(t,h){for(var n=this.h[0],o=this.h[1],d=this.h[2],v=this.h[3],_=this.h[4],g=n,x=o,S=d,k=v,q=_,y=0;y<80;y++){var z=s(i(r(n,u(y,o,d,v),t[a[y]+h],c(y)),p[y]),_);n=_,_=v,v=i(d,10),d=o,o=z,z=s(i(r(g,u(79-y,x,S,k),t[f[y]+h],l(y)),m[y]),q),g=q,q=k,k=i(S,10),S=x,x=z}z=e(this.h[1],d,k),this.h[1]=e(this.h[2],v,q),this.h[2]=e(this.h[3],_,g),this.h[3]=e(this.h[4],n,x),this.h[4]=e(this.h[0],o,S),this.h[0]=z},o.prototype._digest=function(h){return"hex"===h?t.toHex32(this.h,"little"):t.split32(this.h,"little")};var a=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],f=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],p=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],m=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11];
|
||
},{"./utils":"EcoY","./common":"I2N/"}],"Xd0v":[function(require,module,exports) {
|
||
"use strict";var t=require("./utils"),i=require("minimalistic-assert");function e(i,s,n){if(!(this instanceof e))return new e(i,s,n);this.Hash=i,this.blockSize=i.blockSize/8,this.outSize=i.outSize/8,this.inner=null,this.outer=null,this._init(t.toArray(s,n))}module.exports=e,e.prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),i(t.length<=this.blockSize);for(var e=t.length;e<this.blockSize;e++)t.push(0);for(e=0;e<t.length;e++)t[e]^=54;for(this.inner=(new this.Hash).update(t),e=0;e<t.length;e++)t[e]^=106;this.outer=(new this.Hash).update(t)},e.prototype.update=function(t,i){return this.inner.update(t,i),this},e.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)};
|
||
},{"./utils":"EcoY","minimalistic-assert":"KsX4"}],"jBfq":[function(require,module,exports) {
|
||
var h=exports;h.utils=require("./hash/utils"),h.common=require("./hash/common"),h.sha=require("./hash/sha"),h.ripemd=require("./hash/ripemd"),h.hmac=require("./hash/hmac"),h.sha1=h.sha.sha1,h.sha256=h.sha.sha256,h.sha224=h.sha.sha224,h.sha384=h.sha.sha384,h.sha512=h.sha.sha512,h.ripemd160=h.ripemd.ripemd160;
|
||
},{"./hash/utils":"EcoY","./hash/common":"I2N/","./hash/sha":"cz3W","./hash/ripemd":"lOb7","./hash/hmac":"Xd0v"}],"eVX/":[function(require,module,exports) {
|
||
module.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}};
|
||
},{}],"8/P1":[function(require,module,exports) {
|
||
"use strict";var f,e=exports,a=require("hash.js"),b=require("./curve"),c=require("./utils"),d=c.assert;function r(f){"short"===f.type?this.curve=new b.short(f):"edwards"===f.type?this.curve=new b.edwards(f):this.curve=new b.mont(f),this.g=this.curve.g,this.n=this.curve.n,this.hash=f.hash,d(this.g.validate(),"Invalid curve"),d(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function s(f,a){Object.defineProperty(e,f,{configurable:!0,enumerable:!0,get:function(){var b=new r(a);return Object.defineProperty(e,f,{configurable:!0,enumerable:!0,value:b}),b}})}e.PresetCurve=r,s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:a.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:a.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:a.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:a.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:a.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:a.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:a.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{f=require("./precomputed/secp256k1")}catch(t){f=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:a.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",f]});
|
||
},{"hash.js":"jBfq","./curve":"CHLP","./utils":"Tt+5","./precomputed/secp256k1":"eVX/"}],"euwo":[function(require,module,exports) {
|
||
"use strict";var t=require("hash.js"),e=require("minimalistic-crypto-utils"),i=require("minimalistic-assert");function s(t){if(!(this instanceof s))return new s(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var h=e.toArray(t.entropy,t.entropyEnc||"hex"),r=e.toArray(t.nonce,t.nonceEnc||"hex"),n=e.toArray(t.pers,t.persEnc||"hex");i(h.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(h,r,n)}module.exports=s,s.prototype._init=function(t,e,i){var s=t.concat(e).concat(i);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var h=0;h<this.V.length;h++)this.K[h]=0,this.V[h]=1;this._update(s),this._reseed=1,this.reseedInterval=281474976710656},s.prototype._hmac=function(){return new t.hmac(this.hash,this.K)},s.prototype._update=function(t){var e=this._hmac().update(this.V).update([0]);t&&(e=e.update(t)),this.K=e.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},s.prototype.reseed=function(t,s,h,r){"string"!=typeof s&&(r=h,h=s,s=null),t=e.toArray(t,s),h=e.toArray(h,r),i(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(h||[])),this._reseed=1},s.prototype.generate=function(t,i,s,h){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof i&&(h=s,s=i,i=null),s&&(s=e.toArray(s,h||"hex"),this._update(s));for(var r=[];r.length<t;)this.V=this._hmac().update(this.V).digest(),r=r.concat(this.V);var n=r.slice(0,t);return this._update(s),this._reseed++,e.encode(n,i)};
|
||
},{"hash.js":"jBfq","minimalistic-crypto-utils":"wQrH","minimalistic-assert":"KsX4"}],"lveK":[function(require,module,exports) {
|
||
"use strict";var t=require("bn.js"),i=require("../utils"),e=i.assert;function r(t,i){this.ec=t,this.priv=null,this.pub=null,i.priv&&this._importPrivate(i.priv,i.privEnc),i.pub&&this._importPublic(i.pub,i.pubEnc)}module.exports=r,r.fromPublic=function(t,i,e){return i instanceof r?i:new r(t,{pub:i,pubEnc:e})},r.fromPrivate=function(t,i,e){return i instanceof r?i:new r(t,{priv:i,privEnc:e})},r.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},r.prototype.getPublic=function(t,i){return"string"==typeof t&&(i=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),i?this.pub.encode(i,t):this.pub},r.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},r.prototype._importPrivate=function(i,e){this.priv=new t(i,e||16),this.priv=this.priv.umod(this.ec.curve.n)},r.prototype._importPublic=function(t,i){if(t.x||t.y)return"mont"===this.ec.curve.type?e(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||e(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,i)},r.prototype.derive=function(t){return t.validate()||e(t.validate(),"public point not validated"),t.mul(this.priv).getX()},r.prototype.sign=function(t,i,e){return this.ec.sign(t,this,i,e)},r.prototype.verify=function(t,i){return this.ec.verify(t,i,this)},r.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};
|
||
},{"bn.js":"RJrg","../utils":"Tt+5"}],"5Yy1":[function(require,module,exports) {
|
||
"use strict";var r=require("bn.js"),e=require("../utils"),t=e.assert;function n(e,a){if(e instanceof n)return e;this._importDER(e,a)||(t(e.r&&e.s,"Signature without r or s"),this.r=new r(e.r,16),this.s=new r(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function a(){this.place=0}function i(r,e){var t=r[e.place++];if(!(128&t))return t;var n=15&t;if(0===n||n>4)return!1;for(var a=0,i=0,c=e.place;i<n;i++,c++)a<<=8,a|=r[c],a>>>=0;return!(a<=127)&&(e.place=c,a)}function c(r){for(var e=0,t=r.length-1;!r[e]&&!(128&r[e+1])&&e<t;)e++;return 0===e?r:r.slice(e)}function o(r,e){if(e<128)r.push(e);else{var t=1+(Math.log(e)/Math.LN2>>>3);for(r.push(128|t);--t;)r.push(e>>>(t<<3)&255);r.push(e)}}module.exports=n,n.prototype._importDER=function(t,n){t=e.toArray(t,n);var c=new a;if(48!==t[c.place++])return!1;var o=i(t,c);if(!1===o)return!1;if(o+c.place!==t.length)return!1;if(2!==t[c.place++])return!1;var u=i(t,c);if(!1===u)return!1;var s=t.slice(c.place,u+c.place);if(c.place+=u,2!==t[c.place++])return!1;var l=i(t,c);if(!1===l)return!1;if(t.length!==l+c.place)return!1;var f=t.slice(c.place,l+c.place);if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}if(0===f[0]){if(!(128&f[1]))return!1;f=f.slice(1)}return this.r=new r(s),this.s=new r(f),this.recoveryParam=null,!0},n.prototype.toDER=function(r){var t=this.r.toArray(),n=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&n[0]&&(n=[0].concat(n)),t=c(t),n=c(n);!(n[0]||128&n[1]);)n=n.slice(1);var a=[2];o(a,t.length),(a=a.concat(t)).push(2),o(a,n.length);var i=a.concat(n),u=[48];return o(u,i.length),u=u.concat(i),e.encode(u,r)};
|
||
},{"bn.js":"RJrg","../utils":"Tt+5"}],"68VQ":[function(require,module,exports) {
|
||
"use strict";var e=require("bn.js"),r=require("hmac-drbg"),t=require("../utils"),n=require("../curves"),i=require("brorand"),s=t.assert,o=require("./key"),u=require("./signature");function h(e){if(!(this instanceof h))return new h(e);"string"==typeof e&&(s(Object.prototype.hasOwnProperty.call(n,e),"Unknown curve "+e),e=n[e]),e instanceof n.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}module.exports=h,h.prototype.keyPair=function(e){return new o(this,e)},h.prototype.keyFromPrivate=function(e,r){return o.fromPrivate(this,e,r)},h.prototype.keyFromPublic=function(e,r){return o.fromPublic(this,e,r)},h.prototype.genKeyPair=function(t){t||(t={});for(var n=new r({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||i(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),s=this.n.byteLength(),o=this.n.sub(new e(2));;){var u=new e(n.generate(s));if(!(u.cmp(o)>0))return u.iaddn(1),this.keyFromPrivate(u)}},h.prototype._truncateToN=function(e,r){var t=8*e.byteLength()-this.n.bitLength();return t>0&&(e=e.ushrn(t)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},h.prototype.sign=function(t,n,i,s){"object"==typeof i&&(s=i,i=null),s||(s={}),n=this.keyFromPrivate(n,i),t=this._truncateToN(new e(t,16));for(var o=this.n.byteLength(),h=n.getPrivate().toArray("be",o),c=t.toArray("be",o),a=new r({hash:this.hash,entropy:h,nonce:c,pers:s.pers,persEnc:s.persEnc||"utf8"}),p=this.n.sub(new e(1)),m=0;;m++){var v=s.k?s.k(m):new e(a.generate(this.n.byteLength()));if(!((v=this._truncateToN(v,!0)).cmpn(1)<=0||v.cmp(p)>=0)){var y=this.g.mul(v);if(!y.isInfinity()){var f=y.getX(),g=f.umod(this.n);if(0!==g.cmpn(0)){var d=v.invm(this.n).mul(g.mul(n.getPrivate()).iadd(t));if(0!==(d=d.umod(this.n)).cmpn(0)){var l=(y.getY().isOdd()?1:0)|(0!==f.cmp(g)?2:0);return s.canonical&&d.cmp(this.nh)>0&&(d=this.n.sub(d),l^=1),new u({r:g,s:d,recoveryParam:l})}}}}}},h.prototype.verify=function(r,t,n,i){r=this._truncateToN(new e(r,16)),n=this.keyFromPublic(n,i);var s=(t=new u(t,"hex")).r,o=t.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var h,c=o.invm(this.n),a=c.mul(r).umod(this.n),p=c.mul(s).umod(this.n);return this.curve._maxwellTrick?!(h=this.g.jmulAdd(a,n.getPublic(),p)).isInfinity()&&h.eqXToP(s):!(h=this.g.mulAdd(a,n.getPublic(),p)).isInfinity()&&0===h.getX().umod(this.n).cmp(s)},h.prototype.recoverPubKey=function(r,t,n,i){s((3&n)===n,"The recovery param is more than two bits"),t=new u(t,i);var o=this.n,h=new e(r),c=t.r,a=t.s,p=1&n,m=n>>1;if(c.cmp(this.curve.p.umod(this.curve.n))>=0&&m)throw new Error("Unable to find sencond key candinate");c=m?this.curve.pointFromX(c.add(this.curve.n),p):this.curve.pointFromX(c,p);var v=t.r.invm(o),y=o.sub(h).mul(v).umod(o),f=a.mul(v).umod(o);return this.g.mulAdd(y,c,f)},h.prototype.getKeyRecoveryParam=function(e,r,t,n){if(null!==(r=new u(r,n)).recoveryParam)return r.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(e,r,i)}catch(e){continue}if(s.eq(t))return i}throw new Error("Unable to find valid recovery factor")};
|
||
},{"bn.js":"RJrg","hmac-drbg":"euwo","../utils":"Tt+5","../curves":"8/P1","brorand":"2KRs","./key":"lveK","./signature":"5Yy1"}],"Kp7E":[function(require,module,exports) {
|
||
"use strict";var t=require("../utils"),e=t.assert,s=t.parseBytes,i=t.cachedProperty;function n(t,e){this.eddsa=t,this._secret=s(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=s(e.pub)}n.fromPublic=function(t,e){return e instanceof n?e:new n(t,{pub:e})},n.fromSecret=function(t,e){return e instanceof n?e:new n(t,{secret:e})},n.prototype.secret=function(){return this._secret},i(n,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),i(n,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),i(n,"privBytes",function(){var t=this.eddsa,e=this.hash(),s=t.encodingLength-1,i=e.slice(0,t.encodingLength);return i[0]&=248,i[s]&=127,i[s]|=64,i}),i(n,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),i(n,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),i(n,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),n.prototype.sign=function(t){return e(this._secret,"KeyPair can only verify"),this.eddsa.sign(t,this)},n.prototype.verify=function(t,e){return this.eddsa.verify(t,e,this)},n.prototype.getSecret=function(s){return e(this._secret,"KeyPair is public only"),t.encode(this.secret(),s)},n.prototype.getPublic=function(e){return t.encode(this.pubBytes(),e)},module.exports=n;
|
||
},{"../utils":"Tt+5"}],"1Eqs":[function(require,module,exports) {
|
||
"use strict";var e=require("bn.js"),t=require("../utils"),n=t.assert,o=t.cachedProperty,d=t.parseBytes;function i(t,o){this.eddsa=t,"object"!=typeof o&&(o=d(o)),Array.isArray(o)&&(o={R:o.slice(0,t.encodingLength),S:o.slice(t.encodingLength)}),n(o.R&&o.S,"Signature without R or S"),t.isPoint(o.R)&&(this._R=o.R),o.S instanceof e&&(this._S=o.S),this._Rencoded=Array.isArray(o.R)?o.R:o.Rencoded,this._Sencoded=Array.isArray(o.S)?o.S:o.Sencoded}o(i,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),o(i,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),o(i,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),o(i,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),i.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},i.prototype.toHex=function(){return t.encode(this.toBytes(),"hex").toUpperCase()},module.exports=i;
|
||
},{"bn.js":"RJrg","../utils":"Tt+5"}],"09fg":[function(require,module,exports) {
|
||
"use strict";var t=require("hash.js"),e=require("../curves"),n=require("../utils"),r=n.assert,i=n.parseBytes,o=require("./key"),s=require("./signature");function u(n){if(r("ed25519"===n,"only tested with ed25519 so far"),!(this instanceof u))return new u(n);n=e[n].curve,this.curve=n,this.g=n.g,this.g.precompute(n.n.bitLength()+1),this.pointClass=n.point().constructor,this.encodingLength=Math.ceil(n.n.bitLength()/8),this.hash=t.sha512}module.exports=u,u.prototype.sign=function(t,e){t=i(t);var n=this.keyFromSecret(e),r=this.hashInt(n.messagePrefix(),t),o=this.g.mul(r),s=this.encodePoint(o),u=this.hashInt(s,n.pubBytes(),t).mul(n.priv()),h=r.add(u).umod(this.curve.n);return this.makeSignature({R:o,S:h,Rencoded:s})},u.prototype.verify=function(t,e,n){t=i(t),e=this.makeSignature(e);var r=this.keyFromPublic(n),o=this.hashInt(e.Rencoded(),r.pubBytes(),t),s=this.g.mul(e.S());return e.R().add(r.pub().mul(o)).eq(s)},u.prototype.hashInt=function(){for(var t=this.hash(),e=0;e<arguments.length;e++)t.update(arguments[e]);return n.intFromLE(t.digest()).umod(this.curve.n)},u.prototype.keyFromPublic=function(t){return o.fromPublic(this,t)},u.prototype.keyFromSecret=function(t){return o.fromSecret(this,t)},u.prototype.makeSignature=function(t){return t instanceof s?t:new s(this,t)},u.prototype.encodePoint=function(t){var e=t.getY().toArray("le",this.encodingLength);return e[this.encodingLength-1]|=t.getX().isOdd()?128:0,e},u.prototype.decodePoint=function(t){var e=(t=n.parseBytes(t)).length-1,r=t.slice(0,e).concat(-129&t[e]),i=0!=(128&t[e]),o=n.intFromLE(r);return this.curve.pointFromY(o,i)},u.prototype.encodeInt=function(t){return t.toArray("le",this.encodingLength)},u.prototype.decodeInt=function(t){return n.intFromLE(t)},u.prototype.isPoint=function(t){return t instanceof this.pointClass};
|
||
},{"hash.js":"jBfq","../curves":"8/P1","../utils":"Tt+5","./key":"Kp7E","./signature":"1Eqs"}],"o483":[function(require,module,exports) {
|
||
"use strict";var e=exports;e.version=require("../package.json").version,e.utils=require("./elliptic/utils"),e.rand=require("brorand"),e.curve=require("./elliptic/curve"),e.curves=require("./elliptic/curves"),e.ec=require("./elliptic/ec"),e.eddsa=require("./elliptic/eddsa");
|
||
},{"../package.json":"acWy","./elliptic/utils":"Tt+5","brorand":"2KRs","./elliptic/curve":"CHLP","./elliptic/curves":"8/P1","./elliptic/ec":"68VQ","./elliptic/eddsa":"09fg"}],"CXnS":[function(require,module,exports) {
|
||
var r=require("elliptic").ec,e=new r("secp256k1"),n=e.curve,t=n.n.constructor;function u(r,u){var i=new t(u);if(i.cmp(n.p)>=0)return null;var a=(i=i.toRed(n.red)).redSqr().redIMul(i).redIAdd(n.b).redSqrt();return 3===r!==a.isOdd()&&(a=a.redNeg()),e.keyPair({pub:{x:i,y:a}})}function i(r,u,i){var a=new t(u),c=new t(i);if(a.cmp(n.p)>=0||c.cmp(n.p)>=0)return null;if(a=a.toRed(n.red),c=c.toRed(n.red),(6===r||7===r)&&c.isOdd()!==(7===r))return null;var l=a.redSqr().redIMul(a);return c.redSqr().redISub(l.redIAdd(n.b)).isZero()?e.keyPair({pub:{x:a,y:c}}):null}function a(r){var e=r[0];switch(e){case 2:case 3:return 33!==r.length?null:u(e,r.subarray(1,33));case 4:case 6:case 7:return 65!==r.length?null:i(e,r.subarray(1,33),r.subarray(33,65));default:return null}}function c(r,e){for(var n=e.encode(null,33===r.length),t=0;t<r.length;++t)r[t]=n[t]}module.exports={contextRandomize:function(){return 0},privateKeyVerify:function(r){var e=new t(r);return e.cmp(n.n)<0&&!e.isZero()?0:1},privateKeyNegate:function(r){var e=new t(r),u=n.n.sub(e).umod(n.n).toArrayLike(Uint8Array,"be",32);return r.set(u),0},privateKeyTweakAdd:function(r,e){var u=new t(e);if(u.cmp(n.n)>=0)return 1;if(u.iadd(new t(r)),u.cmp(n.n)>=0&&u.isub(n.n),u.isZero())return 1;var i=u.toArrayLike(Uint8Array,"be",32);return r.set(i),0},privateKeyTweakMul:function(r,e){var u=new t(e);if(u.cmp(n.n)>=0||u.isZero())return 1;u.imul(new t(r)),u.cmp(n.n)>=0&&(u=u.umod(n.n));var i=u.toArrayLike(Uint8Array,"be",32);return r.set(i),0},publicKeyVerify:function(r){return null===a(r)?1:0},publicKeyCreate:function(r,u){var i=new t(u);return i.cmp(n.n)>=0||i.isZero()?1:(c(r,e.keyFromPrivate(u).getPublic()),0)},publicKeyConvert:function(r,e){var n=a(e);return null===n?1:(c(r,n.getPublic()),0)},publicKeyNegate:function(r,e){var n=a(e);if(null===n)return 1;var t=n.getPublic();return t.y=t.y.redNeg(),c(r,t),0},publicKeyCombine:function(r,e){for(var n=new Array(e.length),t=0;t<e.length;++t)if(n[t]=a(e[t]),null===n[t])return 1;for(var u=n[0].getPublic(),i=1;i<n.length;++i)u=u.add(n[i].pub);return u.isInfinity()?2:(c(r,u),0)},publicKeyTweakAdd:function(r,e,u){var i=a(e);if(null===i)return 1;if((u=new t(u)).cmp(n.n)>=0)return 2;var l=i.getPublic().add(n.g.mul(u));return l.isInfinity()?2:(c(r,l),0)},publicKeyTweakMul:function(r,e,u){var i=a(e);return null===i?1:(u=new t(u)).cmp(n.n)>=0||u.isZero()?2:(c(r,i.getPublic().mul(u)),0)},signatureNormalize:function(r){var u=new t(r.subarray(0,32)),i=new t(r.subarray(32,64));return u.cmp(n.n)>=0||i.cmp(n.n)>=0?1:(1===i.cmp(e.nh)&&r.set(n.n.sub(i).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport:function(r,e){var u=e.subarray(0,32),i=e.subarray(32,64);if(new t(u).cmp(n.n)>=0)return 1;if(new t(i).cmp(n.n)>=0)return 1;var a=r.output,c=a.subarray(4,37);c[0]=0,c.set(u,1);for(var l=33,o=0;l>1&&0===c[o]&&!(128&c[o+1]);--l,++o);if(128&(c=c.subarray(o))[0])return 1;if(l>1&&0===c[0]&&!(128&c[1]))return 1;var s=a.subarray(39,72);s[0]=0,s.set(i,1);for(var f=33,y=0;f>1&&0===s[y]&&!(128&s[y+1]);--f,++y);return 128&(s=s.subarray(y))[0]?1:f>1&&0===s[0]&&!(128&s[1])?1:(r.outputlen=6+l+f,a[0]=48,a[1]=r.outputlen-2,a[2]=2,a[3]=c.length,a.set(c,4),a[4+l]=2,a[5+l]=s.length,a.set(s,6+l),0)},signatureImport:function(r,e){if(e.length<8)return 1;if(e.length>72)return 1;if(48!==e[0])return 1;if(e[1]!==e.length-2)return 1;if(2!==e[2])return 1;var u=e[3];if(0===u)return 1;if(5+u>=e.length)return 1;if(2!==e[4+u])return 1;var i=e[5+u];if(0===i)return 1;if(6+u+i!==e.length)return 1;if(128&e[4])return 1;if(u>1&&0===e[4]&&!(128&e[5]))return 1;if(128&e[u+6])return 1;if(i>1&&0===e[u+6]&&!(128&e[u+7]))return 1;var a=e.subarray(4,4+u);if(33===a.length&&0===a[0]&&(a=a.subarray(1)),a.length>32)return 1;var c=e.subarray(6+u);if(33===c.length&&0===c[0]&&(c=c.slice(1)),c.length>32)throw new Error("S length is too long");var l=new t(a);l.cmp(n.n)>=0&&(l=new t(0));var o=new t(e.subarray(6+u));return o.cmp(n.n)>=0&&(o=new t(0)),r.set(l.toArrayLike(Uint8Array,"be",32),0),r.set(o.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign:function(r,u,i,a,c){if(c){var l=c;c=function(r){var e=l(u,i,null,a,r);if(!(e instanceof Uint8Array&&32===e.length))throw new Error("This is the way");return new t(e)}}var o,s=new t(i);if(s.cmp(n.n)>=0||s.isZero())return 1;try{o=e.sign(u,i,{canonical:!0,k:c,pers:a})}catch(f){return 1}return r.signature.set(o.r.toArrayLike(Uint8Array,"be",32),0),r.signature.set(o.s.toArrayLike(Uint8Array,"be",32),32),r.recid=o.recoveryParam,0},ecdsaVerify:function(r,u,i){var c={r:r.subarray(0,32),s:r.subarray(32,64)},l=new t(c.r),o=new t(c.s);if(l.cmp(n.n)>=0||o.cmp(n.n)>=0)return 1;if(1===o.cmp(e.nh)||l.isZero()||o.isZero())return 3;var s=a(i);if(null===s)return 2;var f=s.getPublic();return e.verify(u,c,f)?0:3},ecdsaRecover:function(r,u,i,a){var l,o={r:u.slice(0,32),s:u.slice(32,64)},s=new t(o.r),f=new t(o.s);if(s.cmp(n.n)>=0||f.cmp(n.n)>=0)return 1;if(s.isZero()||f.isZero())return 2;try{l=e.recoverPubKey(a,o,i)}catch(y){return 2}return c(r,l),0},ecdh:function(r,u,i,c,l,o,s){var f=a(u);if(null===f)return 1;var y=new t(i);if(y.cmp(n.n)>=0||y.isZero())return 2;var v=f.getPublic().mul(y);if(void 0===l)for(var b=v.encode(null,!0),p=e.hash().update(b).digest(),d=0;d<32;++d)r[d]=p[d];else{o||(o=new Uint8Array(32));for(var g=v.getX().toArray("be",32),w=0;w<32;++w)o[w]=g[w];s||(s=new Uint8Array(32));for(var m=v.getY().toArray("be",32),h=0;h<32;++h)s[h]=m[h];var A=l(o,s,c);if(!(A instanceof Uint8Array&&A.length===r.length))return 2;r.set(A)}return 0}};
|
||
},{"elliptic":"o483"}],"IapB":[function(require,module,exports) {
|
||
module.exports=require("./lib")(require("./lib/elliptic"));
|
||
},{"./lib":"7E7N","./lib/elliptic":"CXnS"}],"z6l9":[function(require,module,exports) {
|
||
"use strict";function e(e,r,n,t,i,u,a){try{var c=e[u](a),o=c.value}catch(s){return void n(s)}c.done?r(o):Promise.resolve(o).then(t,i)}function r(r){return function(){var n=this,t=arguments;return new Promise(function(i,u){var a=r.apply(n,t);function c(r){e(a,i,u,c,o,"next",r)}function o(r){e(a,i,u,c,o,"throw",r)}c(void 0)})}}var n=require("secp256k1"),t=require("multihashing-async/src/sha"),i="sha2-256";module.exports=function(e){function u(){return(u=r(regeneratorRuntime.mark(function e(r,u){var a,c;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.digest(u,i);case 2:return a=e.sent,c=n.ecdsaSign(a,r),e.abrupt("return",n.signatureExport(c.signature));case 5:case"end":return e.stop()}},e)}))).apply(this,arguments)}function a(){return(a=r(regeneratorRuntime.mark(function e(r,u,a){var c;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.digest(a,i);case 2:return c=e.sent,u=n.signatureImport(u),e.abrupt("return",n.ecdsaVerify(u,c,r));case 5:case"end":return e.stop()}},e)}))).apply(this,arguments)}function c(e){if(!n.privateKeyVerify(e))throw new Error("Invalid private key")}return{generateKey:function(){var r;do{r=e(32)}while(!n.privateKeyVerify(r));return r},privateKeyLength:32,hashAndSign:function(e,r){return u.apply(this,arguments)},hashAndVerify:function(e,r,n){return a.apply(this,arguments)},compressPublicKey:function(e){if(!n.publicKeyVerify(e))throw new Error("Invalid public key");return n.publicKeyConvert(e,!0)},decompressPublicKey:function(e){return n.publicKeyConvert(e,!1)},validatePrivateKey:c,validatePublicKey:function(e){if(!n.publicKeyVerify(e))throw new Error("Invalid public key")},computePublicKey:function(e){return c(e),n.publicKeyCreate(e)}}};
|
||
},{"secp256k1":"IapB","multihashing-async/src/sha":"K7IR"}],"1uat":[function(require,module,exports) {
|
||
"use strict";function e(e,t,r,n,i,u,a){try{var s=e[u](a),c=s.value}catch(o){return void r(o)}s.done?t(c):Promise.resolve(c).then(n,i)}function t(t){return function(){var r=this,n=arguments;return new Promise(function(i,u){var a=t.apply(r,n);function s(t){e(a,i,u,s,c,"next",t)}function c(t){e(a,i,u,s,c,"throw",t)}s(void 0)})}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function i(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}var u=require("multihashing-async/src/sha"),a=require("err-code"),s=require("uint8arrays/equals"),c=require("uint8arrays/to-string"),o=require("./exporter");module.exports=function(e,n,y){y=y||require("./secp256k1")(n);var h=function(){function t(e){r(this,t),y.validatePublicKey(e),this._key=e}return i(t,[{key:"verify",value:function(e,t){return y.hashAndVerify(this._key,t,e)}},{key:"marshal",value:function(){return y.compressPublicKey(this._key)}},{key:"bytes",get:function(){return e.PublicKey.encode({Type:e.KeyType.Secp256k1,Data:this.marshal()}).finish()}},{key:"equals",value:function(e){return s(this.bytes,e.bytes)}},{key:"hash",value:function(){return u.multihashing(this.bytes,"sha2-256")}}]),t}(),l=function(){function n(e,t){r(this,n),this._key=e,this._publicKey=t||y.computePublicKey(e),y.validatePrivateKey(this._key),y.validatePublicKey(this._publicKey)}return i(n,[{key:"sign",value:function(e){return y.hashAndSign(this._key,e)}},{key:"public",get:function(){return new h(this._publicKey)}},{key:"marshal",value:function(){return this._key}},{key:"bytes",get:function(){return e.PrivateKey.encode({Type:e.KeyType.Secp256k1,Data:this.marshal()}).finish()}},{key:"equals",value:function(e){return s(this.bytes,e.bytes)}},{key:"hash",value:function(){return u.multihashing(this.bytes,"sha2-256")}},{key:"id",value:function(){var e=t(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.public.hash();case 2:return t=e.sent,e.abrupt("return",c(t,"base58btc"));case 4:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"export",value:function(){var e=t(regeneratorRuntime.mark(function e(t){var r,n=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("libp2p-key"!==(r=n.length>1&&void 0!==n[1]?n[1]:"libp2p-key")){e.next=5;break}return e.abrupt("return",o.export(this.bytes,t));case 5:throw a(new Error("export format '".concat(r,"' is not supported")),"ERR_INVALID_EXPORT_FORMAT");case 6:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),n}();function p(){return(p=t(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,y.generateKey();case 2:return t=e.sent,e.abrupt("return",new l(t));case 4:case"end":return e.stop()}},e)}))).apply(this,arguments)}return{Secp256k1PublicKey:h,Secp256k1PrivateKey:l,unmarshalSecp256k1PrivateKey:function(e){return new l(e)},unmarshalSecp256k1PublicKey:function(e){return new h(e)},generateKeyPair:function(){return p.apply(this,arguments)}}};
|
||
},{"multihashing-async/src/sha":"K7IR","err-code":"hLMW","uint8arrays/equals":"mZxc","uint8arrays/to-string":"aFN1","./exporter":"PaZH","./secp256k1":"z6l9"}],"TD1Y":[function(require,module,exports) {
|
||
"use strict";module.exports={SHA1:20,SHA256:32,SHA512:64};
|
||
},{}],"ncbB":[function(require,module,exports) {
|
||
"use strict";function e(e,r,t,n,u,a,i){try{var o=e[a](i),c=o.value}catch(s){return void t(s)}o.done?r(c):Promise.resolve(c).then(n,u)}function r(r){return function(){var t=this,n=arguments;return new Promise(function(u,a){var i=r.apply(t,n);function o(r){e(i,u,a,o,c,"next",r)}function c(r){e(i,u,a,o,c,"throw",r)}o(void 0)})}}var t=require("../webcrypto"),n=require("./lengths"),u={SHA1:"SHA-1",SHA256:"SHA-256",SHA512:"SHA-512"},a=function(){var e=r(regeneratorRuntime.mark(function e(r,n){var u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.get().subtle.sign({name:"HMAC"},r,n);case 2:return u=e.sent,e.abrupt("return",new Uint8Array(u,u.byteOffset,u.byteLength));case 4:case"end":return e.stop()}},e)}));return function(r,t){return e.apply(this,arguments)}}();exports.create=function(){var e=r(regeneratorRuntime.mark(function e(i,o){var c,s;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return c=u[i],e.next=3,t.get().subtle.importKey("raw",o,{name:"HMAC",hash:{name:c}},!1,["sign"]);case 3:return s=e.sent,e.abrupt("return",{digest:function(){var e=r(regeneratorRuntime.mark(function e(r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",a(s,r));case 1:case"end":return e.stop()}},e)}));return function(r){return e.apply(this,arguments)}}(),length:n[i]});case 5:case"end":return e.stop()}},e)}));return function(r,t){return e.apply(this,arguments)}}();
|
||
},{"../webcrypto":"AJ6b","./lengths":"TD1Y"}],"zVrb":[function(require,module,exports) {
|
||
"use strict";function e(e,r,n,t,i,c,s){try{var a=e[c](s),u=a.value}catch(o){return void n(o)}a.done?r(u):Promise.resolve(u).then(t,i)}function r(r){return function(){var n=this,t=arguments;return new Promise(function(i,c){var s=r.apply(n,t);function a(r){e(s,i,c,a,u,"next",r)}function u(r){e(s,i,c,a,u,"throw",r)}a(void 0)})}}var n=require("err-code"),t=require("uint8arrays/concat"),i=require("uint8arrays/from-string"),c=require("../hmac"),s={"AES-128":{ivSize:16,keySize:16},"AES-256":{ivSize:16,keySize:32},Blowfish:{ivSize:8,cipherKeySize:32}};module.exports=function(){var e=r(regeneratorRuntime.mark(function e(r,a,u){var o,f,h,p,v,y,k,S,l,x,m,w,d,E,g,z,b;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(o=s[r]){e.next=4;break}throw f=Object.keys(s).join(" / "),n(new Error("unknown cipher type '".concat(r,"'. Must be ").concat(f)),"ERR_INVALID_CIPHER_TYPE");case 4:if(a){e.next=6;break}throw n(new Error("missing hash type"),"ERR_MISSING_HASH_TYPE");case 6:return h=o.keySize,p=o.ivSize,20,v=i("key expansion"),y=2*(p+h+20),e.next=13,c.create(a,u);case 13:return k=e.sent,e.next=16,k.digest(v);case 16:S=e.sent,l=[],x=0;case 19:if(!(x<y)){e.next=32;break}return e.next=22,k.digest(t([S,v]));case 22:return m=e.sent,w=m.length,x+w>y&&(w=y-x),l.push(m),x+=w,e.next=29,k.digest(S);case 29:S=e.sent,e.next=19;break;case 32:return d=y/2,E=t(l),g=E.slice(0,d),z=E.slice(d,y),b=function(e){return{iv:e.slice(0,p),cipherKey:e.slice(p,p+h),macKey:e.slice(p+h)}},e.abrupt("return",{k1:b(g),k2:b(z)});case 38:case"end":return e.stop()}},e)}));return function(r,n,t){return e.apply(this,arguments)}}();
|
||
},{"err-code":"hLMW","uint8arrays/concat":"qYui","uint8arrays/from-string":"YqS+","../hmac":"ncbB"}],"h3nb":[function(require,module,exports) {
|
||
"use strict";var r=require("err-code");module.exports=function(e,n){if(!e.includes(n)){var o=e.join(" / ");throw r(new Error("Unknown curve: ".concat(n,". Must be ").concat(o)),"ERR_INVALID_CURVE")}};
|
||
},{"err-code":"hLMW"}],"GCp3":[function(require,module,exports) {
|
||
"use strict";function e(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}function r(r){for(var n=1;n<arguments.length;n++){var u=null!=arguments[n]?arguments[n]:{};n%2?e(Object(u),!0).forEach(function(e){t(r,e,u[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(u)):e(Object(u)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(u,e))})}return r}function t(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function n(e,r,t,n,u,a,i){try{var c=e[a](i),o=c.value}catch(s){return void t(s)}c.done?r(o):Promise.resolve(o).then(n,u)}function u(e){return function(){var r=this,t=arguments;return new Promise(function(u,a){var i=e.apply(r,t);function c(e){n(i,u,a,c,o,"next",e)}function o(e){n(i,u,a,c,o,"throw",e)}c(void 0)})}}var a=require("err-code"),i=require("../webcrypto"),c=require("../util"),o=c.base64urlToBuffer,s=require("./validate-curve-type"),f=require("uint8arrays/to-string"),p=require("uint8arrays/concat"),y=require("uint8arrays/equals"),b={"P-256":256,"P-384":384,"P-521":521};exports.generateEphmeralKeyPair=function(){var e=u(regeneratorRuntime.mark(function e(r){var t,n,a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return s(Object.keys(b),r),e.next=3,i.get().subtle.generateKey({name:"ECDH",namedCurve:r},!0,["deriveBits"]);case 3:return t=e.sent,n=function(){var e=u(regeneratorRuntime.mark(function e(n,u){var a,c,o;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!u){e.next=6;break}return e.next=3,i.get().subtle.importKey("jwk",g(r,u),{name:"ECDH",namedCurve:r},!1,["deriveBits"]);case 3:a=e.sent,e.next=7;break;case 6:a=t.privateKey;case 7:return e.next=9,i.get().subtle.importKey("jwk",m(r,n),{name:"ECDH",namedCurve:r},!1,[]);case 9:return e.t0=e.sent,e.t1=a,c=[e.t0,e.t1],e.next=14,i.get().subtle.deriveBits({name:"ECDH",namedCurve:r,public:c[0]},c[1],b[r]);case 14:return o=e.sent,e.abrupt("return",new Uint8Array(o,o.byteOffset,o.byteLength));case 16:case"end":return e.stop()}},e)}));return function(r,t){return e.apply(this,arguments)}}(),e.next=7,i.get().subtle.exportKey("jwk",t.publicKey);case 7:return a=e.sent,e.abrupt("return",{key:v(a),genSharedKey:n});case 9:case"end":return e.stop()}},e)}));return function(r){return e.apply(this,arguments)}}();var l={"P-256":32,"P-384":48,"P-521":66};function v(e){var r=l[e.crv];return p([Uint8Array.from([4]),o(e.x,r),o(e.y,r)],1+2*r)}function m(e,r){var t=l[e];if(y(!r.slice(0,1),Uint8Array.from([4])))throw a(new Error("Cannot unmarshal public key - invalid key format"),"ERR_INVALID_KEY_FORMAT");return{kty:"EC",crv:e,x:f(r.slice(1,t+1),"base64url"),y:f(r.slice(1+t),"base64url"),ext:!0}}var g=function(e,t){return r(r({},m(e,t.public)),{},{d:f(t.private,"base64url")})};
|
||
},{"err-code":"hLMW","../webcrypto":"AJ6b","../util":"Cj+T","./validate-curve-type":"h3nb","uint8arrays/to-string":"aFN1","uint8arrays/concat":"qYui","uint8arrays/equals":"mZxc"}],"WXIe":[function(require,module,exports) {
|
||
"use strict";function r(r,e,n,t,u,o,i){try{var a=r[o](i),c=a.value}catch(s){return void n(s)}a.done?e(c):Promise.resolve(c).then(t,u)}function e(e){return function(){var n=this,t=arguments;return new Promise(function(u,o){var i=e.apply(n,t);function a(e){r(i,u,o,a,c,"next",e)}function c(e){r(i,u,o,a,c,"throw",e)}a(void 0)})}}var n=require("./ecdh");module.exports=function(){var r=e(regeneratorRuntime.mark(function r(e){return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",n.generateEphmeralKeyPair(e));case 1:case"end":return r.stop()}},r)}));return function(e){return r.apply(this,arguments)}}();
|
||
},{"./ecdh":"GCp3"}],"h7X6":[function(require,module,exports) {
|
||
"use strict";function e(e,r,t,n,a,u,s){try{var i=e[u](s),o=i.value}catch(c){return void t(c)}i.done?r(o):Promise.resolve(o).then(n,a)}function r(r){return function(){var t=this,n=arguments;return new Promise(function(a,u){var s=r.apply(t,n);function i(r){e(s,a,u,i,o,"next",r)}function o(r){e(s,a,u,i,o,"throw",r)}i(void 0)})}}var t=require("./keys");require("node-forge/lib/asn1"),require("node-forge/lib/pbe");var n=require("node-forge/lib/forge"),a=require("err-code"),u=require("uint8arrays/from-string"),s=require("./importer"),i={rsa:require("./rsa-class"),ed25519:require("./ed25519-class"),secp256k1:require("./secp256k1-class")(t,require("../random-bytes"))},o={message:"secp256k1 support requires libp2p-crypto-secp256k1 package",code:"ERR_MISSING_PACKAGE"};function c(e){var r=i[e.toLowerCase()];if(!r){var t=Object.keys(i).join(" / ");throw a(new Error("invalid or unsupported key type ".concat(e,". Must be ").concat(t)),"ERR_UNSUPPORTED_KEY_TYPE")}return r}var p=function(){var e=r(regeneratorRuntime.mark(function e(r,t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",c(r).generateKeyPair(t));case 1:case"end":return e.stop()}},e)}));return function(r,t){return e.apply(this,arguments)}}(),y=function(){var e=r(regeneratorRuntime.mark(function e(r,t,n){var u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(u=c(r),"ed25519"===r.toLowerCase()){e.next=3;break}throw a(new Error("Seed key derivation is unimplemented for RSA or secp256k1"),"ERR_UNSUPPORTED_KEY_DERIVATION_TYPE");case 3:return e.abrupt("return",u.generateKeyPairFromSeed(t,n));case 4:case"end":return e.stop()}},e)}));return function(r,t,n){return e.apply(this,arguments)}}(),l=function(e){var r=t.PublicKey.decode(e),n=r.Data;switch(r.Type){case t.KeyType.RSA:return i.rsa.unmarshalRsaPublicKey(n);case t.KeyType.Ed25519:return i.ed25519.unmarshalEd25519PublicKey(n);case t.KeyType.Secp256k1:if(i.secp256k1)return i.secp256k1.unmarshalSecp256k1PublicKey(n);throw a(new Error(o.message),o.code);default:c(r.Type)}},f=function(e,r){return c(r=(r||"rsa").toLowerCase()),e.bytes},d=function(){var e=r(regeneratorRuntime.mark(function e(r){var n,u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=t.PrivateKey.decode(r),u=n.Data,e.t0=n.Type,e.next=e.t0===t.KeyType.RSA?5:e.t0===t.KeyType.Ed25519?6:e.t0===t.KeyType.Secp256k1?7:12;break;case 5:return e.abrupt("return",i.rsa.unmarshalRsaPrivateKey(u));case 6:return e.abrupt("return",i.ed25519.unmarshalEd25519PrivateKey(u));case 7:if(!i.secp256k1){e.next=11;break}return e.abrupt("return",i.secp256k1.unmarshalSecp256k1PrivateKey(u));case 11:throw a(new Error(o.message),o.code);case 12:c(n.Type);case 13:case"end":return e.stop()}},e)}));return function(r){return e.apply(this,arguments)}}(),m=function(e,r){return c(r=(r||"rsa").toLowerCase()),e.bytes},v=function(){var e=r(regeneratorRuntime.mark(function e(r,t){var o,c,p;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,s.import(r,t);case 3:return o=e.sent,e.abrupt("return",d(o));case 7:e.prev=7,e.t0=e.catch(0);case 9:if(null!==(c=n.pki.decryptRsaPrivateKey(r,t))){e.next=12;break}throw a(new Error("Cannot read the key, most likely the password is wrong or not a RSA key"),"ERR_CANNOT_DECRYPT_PEM");case 12:return p=n.asn1.toDer(n.pki.privateKeyToAsn1(c)),p=u(p.getBytes(),"ascii"),e.abrupt("return",i.rsa.unmarshalRsaPrivateKey(p));case 15:case"end":return e.stop()}},e,null,[[0,7]])}));return function(r,t){return e.apply(this,arguments)}}();module.exports={supportedKeys:i,keysPBM:t,keyStretcher:require("./key-stretcher"),generateEphemeralKeyPair:require("./ephemeral-keys"),generateKeyPair:p,generateKeyPairFromSeed:y,unmarshalPublicKey:l,marshalPublicKey:f,unmarshalPrivateKey:d,marshalPrivateKey:m,import:v};
|
||
},{"./keys":"uznU","node-forge/lib/asn1":"RZRC","node-forge/lib/pbe":"hIlf","node-forge/lib/forge":"sQ2N","err-code":"hLMW","uint8arrays/from-string":"YqS+","./importer":"vQxJ","./rsa-class":"1kBn","./ed25519-class":"d53H","./secp256k1-class":"1uat","../random-bytes":"qZiD","./key-stretcher":"zVrb","./ephemeral-keys":"WXIe"}],"/PSU":[function(require,module,exports) {
|
||
"use strict";function t(t,{className:e,symbolName:o}){const r=Symbol.for(o),s={[e]:class extends t{constructor(...t){super(...t),Object.defineProperty(this,r,{value:!0})}get[Symbol.toStringTag](){return e}}}[e];return s[`is${e}`]=(t=>!(!t||!t[r])),s}function e(t,{className:e,symbolName:o,withoutNew:r}){const s=Symbol.for(o),n={[e]:function(...e){if(r&&!(this instanceof n))return new n(...e);const o=t.call(this,...e)||this;return o&&!o[s]&&Object.defineProperty(o,s,{value:!0}),o}}[e];return n.prototype=Object.create(t.prototype),n.prototype.constructor=n,Object.defineProperty(n.prototype,Symbol.toStringTag,{get:()=>e}),n[`is${e}`]=(t=>!(!t||!t[s])),n}module.exports=t,module.exports.proto=e;
|
||
},{}],"t6tl":[function(require,module,exports) {
|
||
"use strict";var e=require("protobufjs/minimal"),r=e.Reader,t=e.Writer,i=e.util,y=e.roots.default||(e.roots.default={});y.PeerIdProto=function(){function n(e){if(e)for(var r=Object.keys(e),t=0;t<r.length;++t)null!=e[r[t]]&&(this[r[t]]=e[r[t]])}return n.prototype.id=i.newBuffer([]),n.prototype.pubKey=i.newBuffer([]),n.prototype.privKey=i.newBuffer([]),n.encode=function(e,r){return r||(r=t.create()),r.uint32(10).bytes(e.id),null!=e.pubKey&&Object.hasOwnProperty.call(e,"pubKey")&&r.uint32(18).bytes(e.pubKey),null!=e.privKey&&Object.hasOwnProperty.call(e,"privKey")&&r.uint32(26).bytes(e.privKey),r},n.decode=function(e,t){e instanceof r||(e=r.create(e));for(var n=void 0===t?e.len:e.pos+t,p=new y.PeerIdProto;e.pos<n;){var o=e.uint32();switch(o>>>3){case 1:p.id=e.bytes();break;case 2:p.pubKey=e.bytes();break;case 3:p.privKey=e.bytes();break;default:e.skipType(7&o)}}if(!p.hasOwnProperty("id"))throw i.ProtocolError("missing required 'id'",{instance:p});return p},n.fromObject=function(e){if(e instanceof y.PeerIdProto)return e;var r=new y.PeerIdProto;return null!=e.id&&("string"==typeof e.id?i.base64.decode(e.id,r.id=i.newBuffer(i.base64.length(e.id)),0):e.id.length&&(r.id=e.id)),null!=e.pubKey&&("string"==typeof e.pubKey?i.base64.decode(e.pubKey,r.pubKey=i.newBuffer(i.base64.length(e.pubKey)),0):e.pubKey.length&&(r.pubKey=e.pubKey)),null!=e.privKey&&("string"==typeof e.privKey?i.base64.decode(e.privKey,r.privKey=i.newBuffer(i.base64.length(e.privKey)),0):e.privKey.length&&(r.privKey=e.privKey)),r},n.toObject=function(e,r){r||(r={});var t={};return r.defaults&&(r.bytes===String?t.id="":(t.id=[],r.bytes!==Array&&(t.id=i.newBuffer(t.id))),r.bytes===String?t.pubKey="":(t.pubKey=[],r.bytes!==Array&&(t.pubKey=i.newBuffer(t.pubKey))),r.bytes===String?t.privKey="":(t.privKey=[],r.bytes!==Array&&(t.privKey=i.newBuffer(t.privKey)))),null!=e.id&&e.hasOwnProperty("id")&&(t.id=r.bytes===String?i.base64.encode(e.id,0,e.id.length):r.bytes===Array?Array.prototype.slice.call(e.id):e.id),null!=e.pubKey&&e.hasOwnProperty("pubKey")&&(t.pubKey=r.bytes===String?i.base64.encode(e.pubKey,0,e.pubKey.length):r.bytes===Array?Array.prototype.slice.call(e.pubKey):e.pubKey),null!=e.privKey&&e.hasOwnProperty("privKey")&&(t.privKey=r.bytes===String?i.base64.encode(e.privKey,0,e.privKey.length):r.bytes===Array?Array.prototype.slice.call(e.privKey):e.privKey),t},n.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},n}(),module.exports=y;
|
||
},{"protobufjs/minimal":"78bh"}],"jAbp":[function(require,module,exports) {
|
||
"use strict";function e(r){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(r)}function r(e,r,t,n,i,a,u){try{var s=e[a](u),o=s.value}catch(c){return void t(c)}s.done?r(o):Promise.resolve(o).then(n,i)}function t(e){return function(){var t=this,n=arguments;return new Promise(function(i,a){var u=e.apply(t,n);function s(e){r(u,i,a,s,o,"next",e)}function o(e){r(u,i,a,s,o,"throw",e)}s(void 0)})}}function n(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function i(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function a(e,r,t){return r&&i(e.prototype,r),t&&i(e,t),e}var u=require("multihashes"),s=require("cids"),o=require("libp2p-crypto/src/keys"),c=require("class-is"),p=require("./proto"),y=p.PeerIdProto,f=require("uint8arrays/equals"),l=require("uint8arrays/from-string"),b=require("uint8arrays/to-string"),h=function(){function e(r,t,i){if(n(this,e),!(r instanceof Uint8Array))throw new Error("invalid id provided");if(t&&i&&!f(t.public.bytes,i.bytes))throw new Error("inconsistent arguments");this._id=r,this._idB58String=u.toB58String(this.id),this._privKey=t,this._pubKey=i}return a(e,[{key:"id",get:function(){return this._id},set:function(e){throw new Error("Id is immutable")}},{key:"privKey",get:function(){return this._privKey},set:function(e){this._privKey=e}},{key:"pubKey",get:function(){if(this._pubKey)return this._pubKey;if(this._privKey)return this._privKey.public;try{var e=u.decode(this.id);"identity"===e.name&&(this._pubKey=o.unmarshalPublicKey(e.digest))}catch(r){}return this._pubKey},set:function(e){this._pubKey=e}},{key:"marshalPubKey",value:function(){if(this.pubKey)return o.marshalPublicKey(this.pubKey)}},{key:"marshalPrivKey",value:function(){if(this.privKey)return o.marshalPrivateKey(this.privKey)}},{key:"marshal",value:function(e){return y.encode({id:this.toBytes(),pubKey:this.marshalPubKey(),privKey:e?null:this.marshalPrivKey()}).finish()}},{key:"toPrint",value:function(){var e=this.toB58String();e.startsWith("Qm")&&(e=e.slice(2));var r=6;return e.length<r&&(r=e.length),"<peer.ID "+e.substr(0,r)+">"}},{key:"toJSON",value:function(){return{id:this.toB58String(),privKey:k(this.marshalPrivKey()),pubKey:k(this.marshalPubKey())}}},{key:"toHexString",value:function(){return u.toHexString(this.id)}},{key:"toBytes",value:function(){return this.id}},{key:"toB58String",value:function(){return this._idB58String}},{key:"toString",value:function(){if(!this._idCIDString){var e=new s(1,"libp2p-key",this.id,"base32");Object.defineProperty(this,"_idCIDString",{value:e.toBaseEncodedString("base32"),enumerable:!1})}return this._idCIDString}},{key:"equals",value:function(e){if(e instanceof Uint8Array)return f(this.id,e);if(e.id)return f(this.id,e.id);throw new Error("not valid Id")}},{key:"isEqual",value:function(e){return this.equals(e)}},{key:"isValid",value:function(){return Boolean(this.privKey&&this.privKey.public&&this.privKey.public.bytes&&this.pubKey.bytes instanceof Uint8Array&&f(this.privKey.public.bytes,this.pubKey.bytes))}},{key:"hasInlinePublicKey",value:function(){try{if("identity"===u.decode(this.id).name)return!0}catch(e){}return!1}}]),e}(),d=c(h,{className:"PeerId",symbolName:"@libp2p/js-peer-id/PeerId"});exports=module.exports=d;var v=function(e){return e.bytes.length<=42?u.encode(e.bytes,"identity"):e.hash()},m=function(){var e=t(regeneratorRuntime.mark(function e(r,t){var n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,v(t);case 2:return n=e.sent,e.abrupt("return",new d(n,r,t));case 4:case"end":return e.stop()}},e)}));return function(r,t){return e.apply(this,arguments)}}();exports.create=function(){var e=t(regeneratorRuntime.mark(function e(r){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return(r=r||{}).bits=r.bits||2048,r.keyType=r.keyType||"RSA",e.next=5,o.generateKeyPair(r.keyType,r.bits);case 5:return t=e.sent,e.abrupt("return",m(t,t.public));case 7:case"end":return e.stop()}},e)}));return function(r){return e.apply(this,arguments)}}(),exports.createFromHexString=function(e){return new d(u.fromHexString(e))},exports.createFromBytes=function(e){return new d(e)},exports.createFromB58String=function(e){return exports.createFromCID(e)};var x=function(e){return"libp2p-key"===e.codec||"dag-pb"===e.codec};function k(e){if(e)return b(e,"base64pad")}exports.createFromCID=function(e){if(e=s.isCID(e)?e:new s(e),!x(e))throw new Error("Supplied PeerID CID has invalid multicodec: "+e.codec);return new d(e.multihash)},exports.createFromPubKey=function(){var e=t(regeneratorRuntime.mark(function e(r){var t,n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("string"==typeof(t=r)&&(t=l(r,"base64pad")),t instanceof Uint8Array){e.next=4;break}throw new Error("Supplied key is neither a base64 string nor a Uint8Array");case 4:return e.next=6,o.unmarshalPublicKey(t);case 6:return n=e.sent,e.abrupt("return",m(null,n));case 8:case"end":return e.stop()}},e)}));return function(r){return e.apply(this,arguments)}}(),exports.createFromPrivKey=function(){var e=t(regeneratorRuntime.mark(function e(r){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("string"==typeof r&&(r=l(r,"base64pad")),r instanceof Uint8Array){e.next=3;break}throw new Error("Supplied key is neither a base64 string nor a Uint8Array");case 3:return e.next=5,o.unmarshalPrivateKey(r);case 5:return t=e.sent,e.abrupt("return",m(t,t.public));case 7:case"end":return e.stop()}},e)}));return function(r){return e.apply(this,arguments)}}(),exports.createFromJSON=function(){var e=t(regeneratorRuntime.mark(function e(r){var t,n,i,a,s,c,p;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=u.fromB58String(r.id),n=r.privKey&&l(r.privKey,"base64pad"),i=r.pubKey&&l(r.pubKey,"base64pad"),e.t0=i,!e.t0){e.next=8;break}return e.next=7,o.unmarshalPublicKey(i);case 7:e.t0=e.sent;case 8:if(a=e.t0,n){e.next=11;break}return e.abrupt("return",new d(t,null,a));case 11:return e.next=13,o.unmarshalPrivateKey(n);case 13:return s=e.sent,e.next=16,v(s.public);case 16:if(c=e.sent,!a){e.next=21;break}return e.next=20,v(a);case 20:p=e.sent;case 21:if(!a||f(c,p)){e.next=23;break}throw new Error("Public and private key do not match");case 23:if(!t||f(c,t)){e.next=25;break}throw new Error("Id and private key do not match");case 25:return e.abrupt("return",new d(t,s,a));case 26:case"end":return e.stop()}},e)}));return function(r){return e.apply(this,arguments)}}(),exports.createFromProtobuf=function(){var e=t(regeneratorRuntime.mark(function e(r){var t,n,i,a,u,s;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("string"==typeof r&&(r=l(r,"base16")),t=y.decode(r),n=t.id,i=t.privKey,a=t.pubKey,!i){e.next=8;break}return e.next=5,o.unmarshalPrivateKey(i);case 5:e.t0=e.sent,e.next=9;break;case 8:e.t0=!1;case 9:if(i=e.t0,!a){e.next=16;break}return e.next=13,o.unmarshalPublicKey(a);case 13:e.t1=e.sent,e.next=17;break;case 16:e.t1=!1;case 17:if(a=e.t1,!i){e.next=22;break}return e.next=21,v(i.public);case 21:s=e.sent;case 22:if(!a){e.next=26;break}return e.next=25,v(a);case 25:u=e.sent;case 26:if(!i){e.next=31;break}if(!a){e.next=30;break}if(f(s,u)){e.next=30;break}throw new Error("Public and private key do not match");case 30:return e.abrupt("return",new d(s,i,i.public));case 31:if(!a){e.next=33;break}return e.abrupt("return",new d(u,null,a));case 33:if(!n){e.next=35;break}return e.abrupt("return",new d(n));case 35:throw new Error("Protobuf did not contain any usable key material");case 36:case"end":return e.stop()}},e)}));return function(r){return e.apply(this,arguments)}}(),exports.isPeerId=function(r){return Boolean("object"===e(r)&&r._id&&r._idB58String)};
|
||
},{"multihashes":"ubn9","cids":"xTSP","libp2p-crypto/src/keys":"h7X6","class-is":"/PSU","./proto":"t6tl","uint8arrays/equals":"mZxc","uint8arrays/from-string":"YqS+","uint8arrays/to-string":"aFN1"}],"rpx5":[function(require,module,exports) {
|
||
"use strict";var c="[a-fA-F\\d:]",n=function(n){return n&&n.includeBoundaries?"(?:(?<=\\s|^)(?=".concat(c,")|(?<=").concat(c,")(?=\\s|$))"):""},t="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",a="[a-fA-F\\d]{1,4}",o="\n(?:\n(?:".concat(a,":){7}(?:").concat(a,"|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:").concat(a,":){6}(?:").concat(t,"|:").concat(a,"|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4\n(?:").concat(a,":){5}(?::").concat(t,"|(?::").concat(a,"){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4\n(?:").concat(a,":){4}(?:(?::").concat(a,"){0,1}:").concat(t,"|(?::").concat(a,"){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4\n(?:").concat(a,":){3}(?:(?::").concat(a,"){0,2}:").concat(t,"|(?::").concat(a,"){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4\n(?:").concat(a,":){2}(?:(?::").concat(a,"){0,3}:").concat(t,"|(?::").concat(a,"){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:").concat(a,":){1}(?:(?::").concat(a,"){0,4}:").concat(t,"|(?::").concat(a,"){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::").concat(a,"){0,5}:").concat(t,"|(?::").concat(a,"){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1\n").replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),e=new RegExp("(?:^".concat(t,"$)|(?:^").concat(o,"$)")),d=new RegExp("^".concat(t,"$")),r=new RegExp("^".concat(o,"$")),u=function(c){return c&&c.exact?e:new RegExp("(?:".concat(n(c)).concat(t).concat(n(c),")|(?:").concat(n(c)).concat(o).concat(n(c),")"),"g")};u.v4=function(c){return c&&c.exact?d:new RegExp("".concat(n(c)).concat(t).concat(n(c)),"g")},u.v6=function(c){return c&&c.exact?r:new RegExp("".concat(n(c)).concat(o).concat(n(c)),"g")},module.exports=u;
|
||
},{}],"B2Sm":[function(require,module,exports) {
|
||
"use strict";var t=require("ip-regex"),e=function(e){return t({exact:!0}).test(e)};e.v4=function(e){return t.v4({exact:!0}).test(e)},e.v6=function(e){return t.v6({exact:!0}).test(e)},e.version=function(t){return e(t)?e.v4(t)?4:6:void 0},module.exports=e;
|
||
},{"ip-regex":"rpx5"}],"S9ff":[function(require,module,exports) {
|
||
"use strict";const e=require("is-ip"),t=require("uint8arrays/to-string"),n=e,i=e.v4,r=e.v6,s=function(e,n,l){let o;if(l=~~l,i(e))o=n||new Uint8Array(l+4),e.split(/\./g).map(function(e){o[l++]=255&parseInt(e,10)});else if(r(e)){const r=e.split(":",8);let p;for(p=0;p<r.length;p++){var f;i(r[p])&&(f=s(r[p]),r[p]=t(f.slice(0,2),"base16")),f&&++p<8&&r.splice(p,0,t(f.slice(2,4),"base16"))}if(""===r[0])for(;r.length<8;)r.unshift("0");else if(""===r[r.length-1])for(;r.length<8;)r.push("0");else if(r.length<8){for(p=0;p<r.length&&""!==r[p];p++);const e=[p,"1"];for(p=9-r.length;p>0;p--)e.push("0");r.splice.apply(r,e)}for(o=n||new Uint8Array(l+16),p=0;p<r.length;p++){const e=parseInt(r[p],16);o[l++]=e>>8&255,o[l++]=255&e}}if(!o)throw Error("Invalid ip address: "+e);return o},l=function(e,t,n){t=~~t,n=n||e.length-t;const i=[];let r;const s=new DataView(e.buffer);if(4===n){for(let r=0;r<n;r++)i.push(e[t+r]);r=i.join(".")}else if(16===n){for(let e=0;e<n;e+=2)i.push(s.getUint16(t+e).toString(16));r=(r=(r=i.join(":")).replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3")).replace(/:{3,4}/,"::")}return r};module.exports={isIP:n,isV4:i,isV6:r,toBytes:s,toString:l};
|
||
},{"is-ip":"B2Sm","uint8arrays/to-string":"aFN1"}],"f6b+":[function(require,module,exports) {
|
||
"use strict";function e(o){if("number"==typeof o){if(e.codes[o])return e.codes[o];throw new Error("no protocol with code: "+o)}if("string"==typeof o){if(e.names[o])return e.names[o];throw new Error("no protocol with name: "+o)}throw new Error("invalid protocol id type: "+o)}const o=-1;function t(e,o,t,r,n){return{code:e,size:o,name:t,resolvable:Boolean(r),path:Boolean(n)}}e.lengthPrefixedVarSize=o,e.V=o,e.table=[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,o,"ip6zone"],[53,o,"dns","resolvable"],[54,o,"dns4","resolvable"],[55,o,"dns6","resolvable"],[56,o,"dnsaddr","resolvable"],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,o,"unix",!1,"path"],[421,o,"ipfs"],[421,o,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,o,"garlic64"],[460,0,"quic"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,o,"memory"]],e.names={},e.codes={},e.table.map(o=>{const r=t.apply(null,o);return e.codes[r.code]=r,e.names[r.name]=r,null}),e.object=t,module.exports=e;
|
||
},{}],"qYQO":[function(require,module,exports) {
|
||
module.exports=n;var r=128,e=127,o=~e,t=Math.pow(2,31);function n(e,E,u){if(Number.MAX_SAFE_INTEGER&&e>Number.MAX_SAFE_INTEGER)throw n.bytes=0,new RangeError("Could not encode varint");E=E||[];for(var a=u=u||0;e>=t;)E[u++]=255&e|r,e/=128;for(;e&o;)E[u++]=255&e|r,e>>>=7;return E[u]=0|e,n.bytes=u-a+1,E}
|
||
},{}],"ZJdu":[function(require,module,exports) {
|
||
module.exports=r;var e=128,o=127;function r(t,n){var a,d=0,h=0,i=n=n||0,l=t.length;do{if(i>=l||h>49)throw r.bytes=0,new RangeError("Could not decode varint");a=t[i++],d+=h<28?(a&o)<<h:(a&o)*Math.pow(2,h),h+=7}while(a>=e);return r.bytes=i-n,d}
|
||
},{}],"pAlk":[function(require,module,exports) {
|
||
module.exports={encode:require("./encode.js"),decode:require("./decode.js"),encodingLength:require("./length.js")};
|
||
},{"./encode.js":"qYQO","./decode.js":"ZJdu","./length.js":"Bq+a"}],"hSLl":[function(require,module,exports) {
|
||
"use strict";const e=require("./ip"),n=require("./protocols-table"),r=require("cids"),t=require("multibase"),o=require("varint"),s=require("uint8arrays/to-string"),i=require("uint8arrays/from-string"),a=require("uint8arrays/concat");function c(e,n){return n instanceof Uint8Array?c.toString(e,n):c.toBytes(e,n)}function u(n){if(!e.isIP(n))throw new Error("invalid ip address");return e.toBytes(n)}function d(n){const r=e.toString(n);if(!r||!e.isIP(r))throw new Error("invalid ip address");return r}function l(e){const n=new ArrayBuffer(2);return new DataView(n).setUint16(0,e),new Uint8Array(n)}function f(e){return new DataView(e.buffer).getUint16(0)}function h(e){const n=i(e),r=Uint8Array.from(o.encode(n.length));return a([r,n],r.length+n.length)}function g(e){const n=o.decode(e);if((e=e.slice(o.decode.bytes)).length!==n)throw new Error("inconsistent lengths");return s(e)}function w(e){const n=new r(e).multihash,t=Uint8Array.from(o.encode(n.length));return a([t,n],t.length+n.length)}function b(e){const n=o.decode(e),r=e.slice(o.decode.bytes);if(r.length!==n)throw new Error("inconsistent lengths");return s(r,"base58btc")}function p(e){const n=e.split(":");if(2!==n.length)throw new Error("failed to parse onion addr: "+n+" does not contain a port number");if(16!==n[0].length)throw new Error("failed to parse onion addr: "+n[0]+" not a Tor onion address.");const r=t.decode("b"+n[0]),o=parseInt(n[1],10);if(o<1||o>65536)throw new Error("Port number is not in range(1, 65536)");const s=l(o);return a([r,s],r.length+s.length)}function y(e){const n=e.split(":");if(2!==n.length)throw new Error("failed to parse onion addr: "+n+" does not contain a port number");if(56!==n[0].length)throw new Error("failed to parse onion addr: "+n[0]+" not a Tor onion3 address.");const r=t.decode("b"+n[0]),o=parseInt(n[1],10);if(o<1||o>65536)throw new Error("Port number is not in range(1, 65536)");const s=l(o);return a([r,s],r.length+s.length)}function m(e){const n=e.slice(0,e.length-2),r=e.slice(e.length-2);return s(n,"base32")+":"+f(r)}module.exports=c,c.toString=function(e,r){switch(n(e).code){case 4:case 41:return d(r);case 6:case 273:case 33:case 132:return f(r).toString();case 53:case 54:case 55:case 56:case 400:case 777:return g(r);case 421:return b(r);case 444:case 445:return m(r);default:return s(r,"base16")}},c.toBytes=function(e,r){switch(n(e).code){case 4:case 41:return u(r);case 6:case 273:case 33:case 132:return l(parseInt(r,10));case 53:case 54:case 55:case 56:case 400:case 777:return h(r);case 421:return w(r);case 444:return p(r);case 445:return y(r);default:return i(r,"base16")}};
|
||
},{"./ip":"S9ff","./protocols-table":"f6b+","cids":"xTSP","multibase":"GEzr","varint":"pAlk","uint8arrays/to-string":"aFN1","uint8arrays/from-string":"YqS+","uint8arrays/concat":"qYui"}],"MyWz":[function(require,module,exports) {
|
||
"use strict";const r=require("./convert"),t=require("./protocols-table"),e=require("varint"),n=require("uint8arrays/concat"),o=require("uint8arrays/to-string");function i(r){const e=[],n=r.split("/").slice(1);if(1===n.length&&""===n[0])return[];for(let o=0;o<n.length;o++){const i=n[o],s=t(i);if(0!==s.size){if(++o>=n.length)throw b("invalid address: "+r);if(s.path){e.push([i,m(n.slice(o).join("/"))]);break}e.push([i,n[o]])}else e.push([i])}return e}function s(r){const t=[];return r.map(r=>{const e=v(r);return t.push(e.name),r.length>1&&t.push(r[1]),null}),m(t.join("/"))}function u(t){return t.map(t=>{Array.isArray(t)||(t=[t]);const e=v(t);return t.length>1?[e.code,r.toBytes(e.code,t[1])]:[e.code]})}function c(t){return t.map(t=>{const e=v(t);return t[1]?[e.code,r.toString(e.code,t[1])]:[e.code]})}function l(r){return g(n(r.map(r=>{const t=v(r);let o=Uint8Array.from(e.encode(t.code));return r.length>1&&(o=n([o,r[1]])),o})))}function a(r,t){if(r.size>0)return r.size/8;if(0===r.size)return 0;return e.decode(t)+e.decode.bytes}function f(r){const n=[];let i=0;for(;i<r.length;){const s=e.decode(r,i),u=e.decode.bytes,c=a(t(s),r.slice(i+u));if(0===c){n.push([s]),i+=u;continue}const l=r.slice(i+u,i+u+c);if((i+=c+u)>r.length)throw b("Invalid address Uint8Array: "+o(r,"base16"));n.push([s,l])}return n}function d(r){return s(c(f(r)))}function p(r){return l(u(i(r=m(r))))}function h(r){return p(r)}function g(r){const t=y(r);if(t)throw t;return Uint8Array.from(r)}function y(r){try{f(r)}catch(t){return t}}function T(r){return void 0===y(r)}function m(r){return"/"+r.trim().split("/").filter(r=>r).join("/")}function b(r){return new Error("Error parsing address: "+r)}function v(r){return t(r[0])}module.exports={stringToStringTuples:i,stringTuplesToString:s,tuplesToStringTuples:c,stringTuplesToTuples:u,bytesToTuples:f,tuplesToBytes:l,bytesToString:d,stringToBytes:p,fromString:h,fromBytes:g,validateBytes:y,isValidBytes:T,cleanPath:m,ParseError:b,protoFromTuple:v,sizeForAddr:a};
|
||
},{"./convert":"hSLl","./protocols-table":"f6b+","varint":"pAlk","uint8arrays/concat":"qYui","uint8arrays/to-string":"aFN1"}],"fVn4":[function(require,module,exports) {
|
||
"use strict";const t=require("./codec"),r=require("./protocols-table"),e=require("varint"),s=require("cids"),o=require("err-code"),i=Symbol.for("nodejs.util.inspect.custom"),n=require("uint8arrays/to-string"),a=require("uint8arrays/equals"),l=new Map,u=Symbol.for("@multiformats/js-multiaddr/multiaddr");class d{constructor(r){if(null==r&&(r=""),Object.defineProperty(this,u,{value:!0}),r instanceof Uint8Array)this.bytes=t.fromBytes(r);else if("string"==typeof r){if(r.length>0&&"/"!==r.charAt(0))throw new Error(`multiaddr "${r}" must start with a "/"`);this.bytes=t.fromString(r)}else{if(!d.isMultiaddr(r))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=t.fromBytes(r.bytes)}}toString(){return t.bytesToString(this.bytes)}toJSON(){return this.toString()}toOptions(){const t={},r=this.toString().split("/");return t.family="ip4"===r[1]?4:6,t.host=r[2],t.transport=r[3],t.port=parseInt(r[4]),t}protos(){return this.protoCodes().map(t=>Object.assign({},r(t)))}protoCodes(){const s=[],o=this.bytes;let i=0;for(;i<o.length;){const n=e.decode(o,i),a=e.decode.bytes,l=r(n);i+=t.sizeForAddr(l,o.slice(i+a))+a,s.push(n)}return s}protoNames(){return this.protos().map(t=>t.name)}tuples(){return t.bytesToTuples(this.bytes)}stringTuples(){const r=t.bytesToTuples(this.bytes);return t.tuplesToStringTuples(r)}encapsulate(t){return t=new d(t),new d(this.toString()+t.toString())}decapsulate(t){const r=t.toString(),e=this.toString(),s=e.lastIndexOf(r);if(s<0)throw new Error("Address "+this+" does not contain subaddress: "+t);return new d(e.slice(0,s))}decapsulateCode(r){const e=this.tuples();for(let s=e.length-1;s>=0;s--)if(e[s][0]===r)return new d(t.tuplesToBytes(e.slice(0,s)));return this}getPeerId(){try{const e=this.stringTuples().filter(t=>t[0]===r.names.ipfs.code).pop();return e&&e[1]?n(new s(e[1]).multihash,"base58btc"):null}catch(t){return null}}getPath(){let t=null;try{(t=this.stringTuples().filter(t=>{return!!r(t[0]).path})[0][1])||(t=null)}catch(e){t=null}return t}equals(t){return a(this.bytes,t.bytes)}async resolve(){const t=this.protos().find(t=>t.resolvable);if(!t)return[this];const r=l.get(t.name);if(!r)throw o(new Error(`no available resolver for ${t.name}`),"ERR_NO_AVAILABLE_RESOLVER");return(await r(this)).map(t=>new d(t))}nodeAddress(){const t=this.protoCodes(),r=this.protoNames(),e=this.toString().split("/").slice(1);if(e.length<4)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6}/{address}/{tcp, udp}/{port}".');if(4!==t[0]&&41!==t[0]&&54!==t[0]&&55!==t[0])throw new Error(`no protocol with name: "'${r[0]}'". Must have a valid family name: "{ip4, ip6, dns4, dns6}".`);if("tcp"!==e[2]&&"udp"!==e[2])throw new Error(`no protocol with name: "'${r[1]}'". Must have a valid transport protocol: "{tcp, udp}".`);return{family:41===t[0]||55===t[0]?6:4,address:e[1],port:parseInt(e[3])}}isThinWaistAddress(t){const r=(t||this).protos();return 2===r.length&&((4===r[0].code||41===r[0].code)&&(6===r[1].code||273===r[1].code))}static fromNodeAddress(t,r){if(!t)throw new Error("requires node address object");if(!r)throw new Error("requires transport protocol");let e;switch(t.family){case 4:e="ip4";break;case 6:e="ip6";break;default:throw Error(`Invalid addr family. Got '${t.family}' instead of 4 or 6`)}return new d("/"+[e,t.address,r,t.port].join("/"))}static isName(t){return!!d.isMultiaddr(t)&&t.protos().some(t=>t.resolvable)}static isMultiaddr(t){return t instanceof d||Boolean(t&&t[u])}[i](){return"<Multiaddr "+n(this.bytes,"base16")+" - "+t.bytesToString(this.bytes)+">"}inspect(){return"<Multiaddr "+n(this.bytes,"base16")+" - "+t.bytesToString(this.bytes)+">"}}function p(t){return new d(t)}d.protocols=r,d.resolvers=l,module.exports={Multiaddr:d,multiaddr:p,protocols:r,resolvers:l};
|
||
},{"./codec":"MyWz","./protocols-table":"f6b+","varint":"pAlk","cids":"xTSP","err-code":"hLMW","uint8arrays/to-string":"aFN1","uint8arrays/equals":"mZxc"}],"+d+C":[function(require,module,exports) {
|
||
"use strict";const t=async function*(t,o){for await(const s of t)await o(s)&&(yield s)};module.exports=t;
|
||
},{}],"xPRW":[function(require,module,exports) {
|
||
"use strict";const o=async function*(o,t){for await(const s of o)yield t(s)};module.exports=o;
|
||
},{}],"zuxj":[function(require,module,exports) {
|
||
"use strict";const t=async function*(t,o){let e=0;if(!(o<1))for await(const i of t)if(yield i,++e===o)return};module.exports=t;
|
||
},{}],"z2GU":[function(require,module,exports) {
|
||
"use strict";function e(e){return new n(e)}function r(e){return function(){return new t(e.apply(this,arguments))}}function t(e){var r,t;function o(r,t){try{var i=e[r](t),a=i.value,c=a instanceof n;Promise.resolve(c?a.wrapped:a).then(function(e){c?o("return"===r?"return":"next",e):u(i.done?"return":"normal",e)},function(e){o("throw",e)})}catch(s){u("throw",s)}}function u(e,n){switch(e){case"return":r.resolve({value:n,done:!0});break;case"throw":r.reject(n);break;default:r.resolve({value:n,done:!1})}(r=r.next)?o(r.key,r.arg):t=null}this._invoke=function(e,n){return new Promise(function(u,i){var a={key:e,arg:n,resolve:u,reject:i,next:null};t?t=t.next=a:(r=t=a,o(e,n))})},"function"!=typeof e.return&&(this.return=void 0)}function n(e){this.wrapped=e}function o(e){var r;if("undefined"!=typeof Symbol){if(Symbol.asyncIterator&&null!=(r=e[Symbol.asyncIterator]))return r.call(e);if(Symbol.iterator&&null!=(r=e[Symbol.iterator]))return r.call(e)}throw new TypeError("Object is not async iterable")}"function"==typeof Symbol&&Symbol.asyncIterator&&(t.prototype[Symbol.asyncIterator]=function(){return this}),t.prototype.next=function(e){return this._invoke("next",e)},t.prototype.throw=function(e){return this._invoke("throw",e)},t.prototype.return=function(e){return this._invoke("return",e)};var u=require("err-code"),i=require("it-filter"),a=require("it-map"),c=require("it-take");function s(e,r){return a(e,function(e){return r.addressBook.add(e.id,e.multiaddrs),e})}function f(e){var r=new Set;return i(e,function(e){return!r.has(e.id.toString())&&(r.add(e.id.toString()),!0)})}function l(e){return p.apply(this,arguments)}function p(){return(p=r(regeneratorRuntime.mark(function r(t){var n,i,a,c,s,f,l,p,d,y=arguments;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:n=y.length>1&&void 0!==y[1]?y[1]:1,i=0,a=!0,c=!1,r.prev=4,f=o(t);case 6:return r.next=8,e(f.next());case 8:return l=r.sent,a=l.done,r.next=12,e(l.value);case 12:if(p=r.sent,a){r.next=21;break}return d=p,i++,r.next=18,d;case 18:a=!0,r.next=6;break;case 21:r.next=27;break;case 23:r.prev=23,r.t0=r.catch(4),c=!0,s=r.t0;case 27:if(r.prev=27,r.prev=28,a||null==f.return){r.next=32;break}return r.next=32,e(f.return());case 32:if(r.prev=32,!c){r.next=35;break}throw s;case 35:return r.finish(32);case 36:return r.finish(27);case 37:if(!(i<n)){r.next=39;break}throw u(new Error("not found"),"NOT_FOUND");case 39:case"end":return r.stop()}},r,null,[[4,23,27,37],[28,,32,36]])}))).apply(this,arguments)}function d(e,r){return r?c(e,r):e}module.exports={storeAddresses:s,uniquePeers:f,requirePeers:l,maybeLimitSource:d};
|
||
},{"err-code":"hLMW","it-filter":"+d+C","it-map":"xPRW","it-take":"zuxj"}],"qP9e":[function(require,module,exports) {
|
||
module.exports=class{constructor(t){if(!(t>0)||0!=(t-1&t))throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(t),this.mask=t-1,this.top=0,this.btm=0,this.next=null}push(t){return void 0===this.buffer[this.top]&&(this.buffer[this.top]=t,this.top=this.top+1&this.mask,!0)}shift(){const t=this.buffer[this.btm];if(void 0!==t)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,t}isEmpty(){return void 0===this.buffer[this.btm]}};
|
||
},{}],"xK7N":[function(require,module,exports) {
|
||
const t=require("./fixed-size");module.exports=class{constructor(i){this.hwm=i||16,this.head=new t(this.hwm),this.tail=this.head}push(i){if(!this.head.push(i)){const h=this.head;this.head=h.next=new t(2*this.head.buffer.length),this.head.push(i)}}shift(){const t=this.tail.shift();if(void 0===t&&this.tail.next){const t=this.tail.next;return this.tail.next=null,this.tail=t,this.tail.shift()}return t}isEmpty(){return this.head.isEmpty()}};
|
||
},{"./fixed-size":"qP9e"}],"Qva5":[function(require,module,exports) {
|
||
const r=require("fast-fifo");module.exports=(e=>{let n;"function"==typeof(e=e||{})?(n=e,e={}):n=e.onEnd;let o,t,u,s=new r;const l=r=>t?t(r):(s.push(r),o),d=r=>u?o:l({done:!1,value:r}),i=e=>u?o:(u=!0,e?(e=>(s=new r,t?t({error:e}):(s.push({error:e}),o)))(e):l({done:!0}));if(o={[Symbol.asyncIterator](){return this},next:()=>{if(!s.isEmpty()){if(e.writev){let r;const e=[];for(;!s.isEmpty();){if((r=s.shift()).error)throw r.error;e.push(r.value)}return{done:r.done,value:e}}const r=s.shift();if(r.error)throw r.error;return r}return u?{done:!0}:new Promise((r,n)=>{t=(u=>(t=null,u.error?n(u.error):e.writev&&!u.done?r({done:u.done,value:[u.value]}):r(u),o))})},return:()=>(s=new r,i(),{done:!0}),throw:r=>(i(r),{done:!0}),push:d,end:i},!n)return o;const h=o;return o={[Symbol.asyncIterator](){return this},next:()=>h.next(),throw:r=>(h.throw(r),n&&(n(r),n=null),{done:!0}),return:()=>(h.return(),n&&(n(),n=null),{done:!0}),push:d,end:r=>(h.end(r),n&&(n(r),n=null),o)}});
|
||
},{"fast-fifo":"xK7N"}],"iPFH":[function(require,module,exports) {
|
||
"use strict";const t=require("it-pushable"),s=async function*(...s){const e=t();setTimeout(async()=>{try{await Promise.all(s.map(async t=>{for await(const s of t)e.push(s)})),e.end()}catch(t){e.end(t)}},0),yield*e};module.exports=s;
|
||
},{"it-pushable":"Qva5"}],"p27M":[function(require,module,exports) {
|
||
const e=(...e)=>{let t;for(;e.length;)t=e.shift()(t);return t},t=e=>e&&("function"==typeof e[Symbol.asyncIterator]||"function"==typeof e[Symbol.iterator]||"function"==typeof e.next),o=e=>e&&"function"==typeof e.sink&&t(e.source),n=e=>t=>(e.sink(t),e.source),r=(...r)=>{if(o(r[0])){const e=r[0];r[0]=(()=>e.source)}else if(t(r[0])){const e=r[0];r[0]=(()=>e)}if(r.length>1&&o(r[r.length-1])&&(r[r.length-1]=r[r.length-1].sink),r.length>2)for(let e=1;e<r.length-1;e++)o(r[e])&&(r[e]=n(r[e]));return e(...r)};module.exports=r,module.exports.pipe=r,module.exports.rawPipe=e,module.exports.isIterable=t,module.exports.isDuplex=o;
|
||
},{}],"tdUc":[function(require,module,exports) {
|
||
"use strict";const t=async t=>{for await(const o of t)return o};module.exports=t;
|
||
},{}],"0gYD":[function(require,module,exports) {
|
||
"use strict";const o=async o=>{for await(const s of o);};module.exports=o;
|
||
},{}],"ysRr":[function(require,module,exports) {
|
||
"use strict";const e=new Map,t=()=>`${Date.now()}:${Math.floor(1e6*Math.random())}`;async function o(t,o,a){for(;e.get(a);){try{await t()}catch(n){setTimeout(()=>{throw n},1);break}if(!e.get(a))break;await new Promise(t=>{const n=setTimeout(t,o);e.set(a,n)})}}function a(a,n,r){r=r||n;const s=t(),c=setTimeout(()=>{o(a,n,s)},r);return e.set(s,c),s}function n(t){const o=e.get(t);o&&(clearTimeout(o),e.delete(t))}module.exports={setDelayedInterval:a,clearDelayedInterval:n};
|
||
},{}],"oCI/":[function(require,module,exports) {
|
||
"use strict";function e(e){return o(e)||n(e)||t(e)||r()}function r(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function t(e,r){if(e){if("string"==typeof e)return i(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?i(e,r):void 0}}function n(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function o(e){if(Array.isArray(e))return i(e)}function i(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function u(e,r,t,n,o,i,u){try{var a=e[i](u),s=a.value}catch(c){return void t(c)}a.done?r(s):Promise.resolve(s).then(n,o)}function a(e){return function(){var r=this,t=arguments;return new Promise(function(n,o){var i=e.apply(r,t);function a(e){u(i,n,o,a,s,"next",e)}function s(e){u(i,n,o,a,s,"throw",e)}a(void 0)})}}function s(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function c(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function f(e,r,t){return r&&c(e.prototype,r),t&&c(e,t),e}function l(e){return function(){return new p(e.apply(this,arguments))}}function p(e){var r,t;function n(r,t){try{var i=e[r](t),u=i.value,a=u instanceof y;Promise.resolve(a?u.wrapped:u).then(function(e){a?n("return"===r?"return":"next",e):o(i.done?"return":"normal",e)},function(e){n("throw",e)})}catch(s){o("throw",s)}}function o(e,o){switch(e){case"return":r.resolve({value:o,done:!0});break;case"throw":r.reject(o);break;default:r.resolve({value:o,done:!1})}(r=r.next)?n(r.key,r.arg):t=null}this._invoke=function(e,o){return new Promise(function(i,u){var a={key:e,arg:o,resolve:i,reject:u,next:null};t?t=t.next=a:(r=t=a,n(e,o))})},"function"!=typeof e.return&&(this.return=void 0)}function h(e){return new y(e)}function y(e){this.wrapped=e}function d(e){var r;if("undefined"!=typeof Symbol){if(Symbol.asyncIterator&&null!=(r=e[Symbol.asyncIterator]))return r.call(e);if(Symbol.iterator&&null!=(r=e[Symbol.iterator]))return r.call(e)}throw new TypeError("Object is not async iterable")}function v(e,r){var t={},n=!1;function o(t,o){return n=!0,o=new Promise(function(r){r(e[t](o))}),{done:!1,value:r(o)}}return"function"==typeof Symbol&&Symbol.iterator&&(t[Symbol.iterator]=function(){return this}),t.next=function(e){return n?(n=!1,e):o("next",e)},"function"==typeof e.throw&&(t.throw=function(e){if(n)throw n=!1,e;return o("throw",e)}),"function"==typeof e.return&&(t.return=function(e){return n?(n=!1,e):o("return",e)}),t}"function"==typeof Symbol&&Symbol.asyncIterator&&(p.prototype[Symbol.asyncIterator]=function(){return this}),p.prototype.next=function(e){return this._invoke("next",e)},p.prototype.throw=function(e){return this._invoke("throw",e)},p.prototype.return=function(e){return this._invoke("return",e)};var m=require("debug"),b=Object.assign(m("libp2p:peer-routing"),{error:m("libp2p:peer-routing:err")}),w=require("err-code"),g=require("./content-routing/utils"),_=g.storeAddresses,k=g.uniquePeers,S=g.requirePeers,x=require("it-merge"),I=require("it-pipe"),P=I.pipe,O=require("it-first"),A=require("it-drain"),R=require("it-filter"),q=require("set-delayed-interval"),E=q.setDelayedInterval,T=q.clearDelayedInterval,j=function(){function r(e){s(this,r),this._peerId=e.peerId,this._peerStore=e.peerStore,this._routers=e._modules.peerRouting||[],e._dht&&e._config.dht.enabled&&this._routers.push(e._dht),this._refreshManagerOptions=e._options.peerRouting.refreshManager,this._findClosestPeersTask=this._findClosestPeersTask.bind(this)}return f(r,[{key:"start",value:function(){this._routers.length&&!this._timeoutId&&this._refreshManagerOptions.enabled&&(this._timeoutId=E(this._findClosestPeersTask,this._refreshManagerOptions.interval,this._refreshManagerOptions.bootDelay))}},{key:"_findClosestPeersTask",value:function(){var e=a(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,A(this.getClosestPeers(this._peerId.id));case 3:e.next=8;break;case 5:e.prev=5,e.t0=e.catch(0),b.error(e.t0);case 8:case"end":return e.stop()}},e,this,[[0,5]])}));return function(){return e.apply(this,arguments)}}()},{key:"stop",value:function(){T(this._timeoutId)}},{key:"findPeer",value:function(){var r=a(regeneratorRuntime.mark(function r(t,n){var o,i=this;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(this._routers.length){r.next=2;break}throw w(new Error("No peer routers available"),"NO_ROUTERS_AVAILABLE");case 2:return r.next=4,P(x.apply(void 0,e(this._routers.map(function(e){return[e.findPeer(t,n)]}))),function(e){return R(e,Boolean)},function(e){return _(e,i._peerStore)},function(e){return O(e)});case 4:if(!(o=r.sent)){r.next=7;break}return r.abrupt("return",o);case 7:throw w(new Error("not found"),"NOT_FOUND");case 8:case"end":return r.stop()}},r,this)}));return function(e,t){return r.apply(this,arguments)}}()},{key:"getClosestPeers",value:function(r){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{timeout:3e4};return l(regeneratorRuntime.mark(function o(){return regeneratorRuntime.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(t._routers.length){o.next=2;break}throw w(new Error("No peer routers available"),"NO_ROUTERS_AVAILABLE");case 2:return o.delegateYield(v(d(P(x.apply(void 0,e(t._routers.map(function(e){return e.getClosestPeers(r,n)}))),function(e){return _(e,t._peerStore)},function(e){return k(e)},function(e){return S(e)})),h),"t0",3);case 3:case"end":return o.stop()}},o)}))()}}]),r}();module.exports=j;
|
||
},{"debug":"F8gk","err-code":"hLMW","./content-routing/utils":"z2GU","it-merge":"iPFH","it-pipe":"p27M","it-first":"tdUc","it-drain":"0gYD","it-filter":"+d+C","set-delayed-interval":"ysRr"}],"YLhd":[function(require,module,exports) {
|
||
"use strict";exports.messages={NOT_STARTED_YET:"The libp2p node is not started yet",DHT_DISABLED:"DHT is not available",CONN_ENCRYPTION_REQUIRED:"At least one connection encryption module is required"},exports.codes={DHT_DISABLED:"ERR_DHT_DISABLED",PUBSUB_NOT_STARTED:"ERR_PUBSUB_NOT_STARTED",DHT_NOT_STARTED:"ERR_DHT_NOT_STARTED",CONN_ENCRYPTION_REQUIRED:"ERR_CONN_ENCRYPTION_REQUIRED",ERR_CONNECTION_ENDED:"ERR_CONNECTION_ENDED",ERR_CONNECTION_FAILED:"ERR_CONNECTION_FAILED",ERR_NODE_NOT_STARTED:"ERR_NODE_NOT_STARTED",ERR_ALREADY_ABORTED:"ERR_ALREADY_ABORTED",ERR_NO_VALID_ADDRESSES:"ERR_NO_VALID_ADDRESSES",ERR_RELAYED_DIAL:"ERR_RELAYED_DIAL",ERR_DIALED_SELF:"ERR_DIALED_SELF",ERR_DISCOVERED_SELF:"ERR_DISCOVERED_SELF",ERR_DUPLICATE_TRANSPORT:"ERR_DUPLICATE_TRANSPORT",ERR_ENCRYPTION_FAILED:"ERR_ENCRYPTION_FAILED",ERR_HOP_REQUEST_FAILED:"ERR_HOP_REQUEST_FAILED",ERR_INVALID_KEY:"ERR_INVALID_KEY",ERR_INVALID_MESSAGE:"ERR_INVALID_MESSAGE",ERR_INVALID_PARAMETERS:"ERR_INVALID_PARAMETERS",ERR_INVALID_PEER:"ERR_INVALID_PEER",ERR_MUXER_UNAVAILABLE:"ERR_MUXER_UNAVAILABLE",ERR_TIMEOUT:"ERR_TIMEOUT",ERR_TRANSPORT_UNAVAILABLE:"ERR_TRANSPORT_UNAVAILABLE",ERR_TRANSPORT_DIAL_FAILED:"ERR_TRANSPORT_DIAL_FAILED",ERR_UNSUPPORTED_PROTOCOL:"ERR_UNSUPPORTED_PROTOCOL",ERR_INVALID_MULTIADDR:"ERR_INVALID_MULTIADDR",ERR_SIGNATURE_NOT_VALID:"ERR_SIGNATURE_NOT_VALID"};
|
||
},{}],"/pDA":[function(require,module,exports) {
|
||
"use strict";function t(t,r,e,n,o,i,u){try{var a=t[i](u),c=a.value}catch(s){return void e(s)}a.done?r(c):Promise.resolve(c).then(n,o)}function r(r){return function(){var e=this,n=arguments;return new Promise(function(o,i){var u=r.apply(e,n);function a(r){t(u,o,i,a,c,"next",r)}function c(r){t(u,o,i,a,c,"throw",r)}a(void 0)})}}function e(t){return u(t)||i(t)||o(t)||n()}function n(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function o(t,r){if(t){if("string"==typeof t)return a(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?a(t,r):void 0}}function i(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}function u(t){if(Array.isArray(t))return a(t)}function a(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}function c(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function s(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function f(t,r,e){return r&&s(t.prototype,r),e&&s(t,e),t}function l(t){return function(){return new h(t.apply(this,arguments))}}function h(t){var r,e;function n(r,e){try{var i=t[r](e),u=i.value,a=u instanceof y;Promise.resolve(a?u.wrapped:u).then(function(t){a?n("return"===r?"return":"next",t):o(i.done?"return":"normal",t)},function(t){n("throw",t)})}catch(c){o("throw",c)}}function o(t,o){switch(t){case"return":r.resolve({value:o,done:!0});break;case"throw":r.reject(o);break;default:r.resolve({value:o,done:!1})}(r=r.next)?n(r.key,r.arg):e=null}this._invoke=function(t,o){return new Promise(function(i,u){var a={key:t,arg:o,resolve:i,reject:u,next:null};e?e=e.next=a:(r=e=a,n(t,o))})},"function"!=typeof t.return&&(this.return=void 0)}function p(t){return new y(t)}function y(t){this.wrapped=t}function d(t){var r;if("undefined"!=typeof Symbol){if(Symbol.asyncIterator&&null!=(r=t[Symbol.asyncIterator]))return r.call(t);if(Symbol.iterator&&null!=(r=t[Symbol.iterator]))return r.call(t)}throw new TypeError("Object is not async iterable")}function v(t,r){var e={},n=!1;function o(e,o){return n=!0,o=new Promise(function(r){r(t[e](o))}),{done:!1,value:r(o)}}return"function"==typeof Symbol&&Symbol.iterator&&(e[Symbol.iterator]=function(){return this}),e.next=function(t){return n?(n=!1,t):o("next",t)},"function"==typeof t.throw&&(e.throw=function(t){if(n)throw n=!1,t;return o("throw",t)}),"function"==typeof t.return&&(e.return=function(t){return n?(n=!1,t):o("return",t)}),e}"function"==typeof Symbol&&Symbol.asyncIterator&&(h.prototype[Symbol.asyncIterator]=function(){return this}),h.prototype.next=function(t){return this._invoke("next",t)},h.prototype.throw=function(t){return this._invoke("throw",t)},h.prototype.return=function(t){return this._invoke("return",t)};var m=require("err-code"),b=require("../errors"),w=b.messages,S=b.codes,T=require("./utils"),g=T.storeAddresses,_=T.uniquePeers,E=T.requirePeers,k=T.maybeLimitSource,A=require("it-merge"),x=require("it-pipe"),R=x.pipe,O=function(){function t(r){c(this,t),this.libp2p=r,this.routers=r._modules.contentRouting||[],this.dht=r._dht,this.dht&&r._config.dht.enabled&&this.routers.push(this.dht)}return f(t,[{key:"findProviders",value:function(t){var r=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return l(regeneratorRuntime.mark(function o(){return regeneratorRuntime.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(r.routers.length){o.next=2;break}throw m(new Error("No content this.routers available"),"NO_ROUTERS_AVAILABLE");case 2:return o.delegateYield(v(d(R(A.apply(void 0,e(r.routers.map(function(r){return r.findProviders(t,n)}))),function(t){return g(t,r.libp2p.peerStore)},function(t){return _(t)},function(t){return k(t,n.maxNumProviders)},function(t){return E(t)})),p),"t0",3);case 3:case"end":return o.stop()}},o)}))()}},{key:"provide",value:function(){var t=r(regeneratorRuntime.mark(function t(r){return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(this.routers.length){t.next=2;break}throw m(new Error("No content routers available"),"NO_ROUTERS_AVAILABLE");case 2:return t.next=4,Promise.all(this.routers.map(function(t){return t.provide(r)}));case 4:case"end":return t.stop()}},t,this)}));return function(r){return t.apply(this,arguments)}}()},{key:"put",value:function(t,r,e){if(!this.libp2p.isStarted()||!this.dht.isStarted)throw m(new Error(w.NOT_STARTED_YET),S.DHT_NOT_STARTED);return this.dht.put(t,r,e)}},{key:"get",value:function(t,r){if(!this.libp2p.isStarted()||!this.dht.isStarted)throw m(new Error(w.NOT_STARTED_YET),S.DHT_NOT_STARTED);return this.dht.get(t,r)}},{key:"getMany",value:function(){var t=r(regeneratorRuntime.mark(function t(r,e,n){return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(this.libp2p.isStarted()&&this.dht.isStarted){t.next=2;break}throw m(new Error(w.NOT_STARTED_YET),S.DHT_NOT_STARTED);case 2:return t.abrupt("return",this.dht.getMany(r,e,n));case 3:case"end":return t.stop()}},t,this)}));return function(r,e,n){return t.apply(this,arguments)}}()}]),t}();module.exports=O;
|
||
},{"err-code":"hLMW","../errors":"YLhd","./utils":"z2GU","it-merge":"iPFH","it-pipe":"p27M"}],"VGr2":[function(require,module,exports) {
|
||
"use strict";var r=require("peer-id"),e=require("multiaddr"),t=e.Multiaddr,i=require("err-code"),d=require("./errors"),o=d.codes;function a(e){var d;if("string"==typeof e&&(e=new t(e)),t.isMultiaddr(e)){d=e;var a=e.getPeerId();if(!a)throw i(new Error("".concat(e," does not have a valid peer type")),o.ERR_INVALID_MULTIADDR);try{e=r.createFromB58String(a)}catch(n){throw i(new Error("".concat(e," is not a valid peer type")),o.ERR_INVALID_MULTIADDR)}}return{id:e,multiaddrs:d?[d]:void 0}}module.exports=a;
|
||
},{"peer-id":"jAbp","multiaddr":"fVn4","err-code":"hLMW","./errors":"YLhd"}],"rL/M":[function(require,module,exports) {
|
||
"use strict";module.exports=function(t){if("[object Object]"!==Object.prototype.toString.call(t))return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype};
|
||
},{}],"/OBv":[function(require,module,exports) {
|
||
"use strict";function r(r,t){var e;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(e=n(r))||t&&r&&"number"==typeof r.length){e&&(r=e);var o=0,i=function(){};return{s:i,n:function(){return o>=r.length?{done:!0}:{done:!1,value:r[o++]}},e:function(r){throw r},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,c=!1;return{s:function(){e=r[Symbol.iterator]()},n:function(){var r=e.next();return u=r.done,r},e:function(r){c=!0,a=r},f:function(){try{u||null==e.return||e.return()}finally{if(c)throw a}}}}function n(r,n){if(r){if("string"==typeof r)return t(r,n);var e=Object.prototype.toString.call(r).slice(8,-1);return"Object"===e&&r.constructor&&(e=r.constructor.name),"Map"===e||"Set"===e?Array.from(r):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?t(r,n):void 0}}function t(r,n){(null==n||n>r.length)&&(n=r.length);for(var t=0,e=new Array(n);t<n;t++)e[t]=r[t];return e}var e=require("is-plain-obj"),o=Object.prototype.hasOwnProperty,i=Object.propertyIsEnumerable,a=function(r,n,t){return Object.defineProperty(r,n,{value:t,writable:!0,enumerable:!0,configurable:!0})},u=this,c={concatArrays:!1,ignoreUndefined:!1},f=function(n){var t=[];for(var e in n)o.call(n,e)&&t.push(e);if(Object.getOwnPropertySymbols){var a,u=r(Object.getOwnPropertySymbols(n));try{for(u.s();!(a=u.n()).done;){var c=a.value;i.call(n,c)&&t.push(c)}}catch(f){u.e(f)}finally{u.f()}}return t};function l(r){return Array.isArray(r)?y(r):e(r)?s(r):r}function y(r){var n=r.slice(0,0);return f(r).forEach(function(t){a(n,t,l(r[t]))}),n}function s(r){var n=null===Object.getPrototypeOf(r)?Object.create(null):{};return f(r).forEach(function(t){a(n,t,l(r[t]))}),n}var b=function(r,n,t,e){return t.forEach(function(t){void 0===n[t]&&e.ignoreUndefined||(t in r&&r[t]!==Object.getPrototypeOf(r)?a(r,t,p(r[t],n[t],e)):a(r,t,l(n[t])))}),r},v=function(r,n,t){var e=r.slice(0,0),i=0;return[r,n].forEach(function(n){for(var u=[],c=0;c<n.length;c++)o.call(n,c)&&(u.push(String(c)),a(e,i++,n===r?n[c]:l(n[c])));e=b(e,n,f(n).filter(function(r){return!u.includes(r)}),t)}),e};function p(r,n,t){return t.concatArrays&&Array.isArray(r)&&Array.isArray(n)?v(r,n,t):e(n)&&e(r)?b(r,n,f(n),t):l(n)}module.exports=function(){for(var r=p(l(c),this!==u&&this||{},c),n={_:{}},t=arguments.length,o=new Array(t),i=0;i<t;i++)o[i]=arguments[i];for(var a=0,f=o;a<f.length;a++){var y=f[a];if(void 0!==y){if(!e(y))throw new TypeError("`"+y+"` is not an Option Object");n=p(n,{_:y},r)}}return n._};
|
||
},{"is-plain-obj":"rL/M"}],"W5lK":[function(require,module,exports) {
|
||
"use strict";module.exports=r;var e=require("ms"),t=r.prototype,i=new Date%1e9;function s(){return(1e9*Math.random()>>>0)+i++}function r(e){e=e||{},this.id=e.id||s(),this.max=e.max||1/0,this.items=e.items||[],this._lookup={},this.size=this.items.length,this.lastModified=new Date(e.lastModified||new Date);for(var t,i,r=this.items.length;r--;)t=this.items[r],i=new Date(t.expires)-new Date,this._lookup[t.key]=t,i>0?this.expire(t.key,i):i<=0&&this.delete(t.key)}t.has=function(e){return e in this._lookup},t.get=function(e){if(!this.has(e))return null;var t=this._lookup[e];return t.refresh&&this.expire(e,t.refresh),this.items.splice(this.items.indexOf(t),1),this.items.push(t),t.value},t.meta=function(e){if(!this.has(e))return null;var t=this._lookup[e];return"meta"in t?t.meta:null},t.set=function(e,t,i){var s=this._lookup[e],r=this._lookup[e]={key:e,value:t};return this.lastModified=new Date,s?(clearTimeout(s.timeout),this.items.splice(this.items.indexOf(s),1,r)):(this.size>=this.max&&this.delete(this.items[0].key),this.items.push(r),this.size++),i&&("ttl"in i&&this.expire(e,i.ttl),"meta"in i&&(r.meta=i.meta),i.refresh&&(r.refresh=i.ttl)),this},t.delete=function(e){var t=this._lookup[e];return!!t&&(this.lastModified=new Date,this.items.splice(this.items.indexOf(t),1),clearTimeout(t.timeout),delete this._lookup[e],this.size--,this)},t.expire=function(t,i){var s=i||0,r=this._lookup[t];if(!r)return this;if("string"==typeof s&&(s=e(i)),"number"!=typeof s)throw new TypeError("Expiration time must be a string or number.");return clearTimeout(r.timeout),r.timeout=setTimeout(this.delete.bind(this,r.key),s),r.expires=Number(new Date)+s,this},t.clear=function(){for(var e=this.items.length;e--;)this.delete(this.items[e].key);return this},t.toJSON=function(){for(var e,t=new Array(this.items.length),i=t.length;i--;)e=this.items[i],t[i]={key:e.key,meta:e.meta,value:e.value,expires:e.expires,refresh:e.refresh};return{id:this.id,max:isFinite(this.max)?this.max:void 0,lastModified:this.lastModified,items:t}};
|
||
},{"ms":"sBqc"}],"PHzn":[function(require,module,exports) {
|
||
|
||
"use strict";var e=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==t)return t;throw new Error("unable to locate global object")},t=e();module.exports=exports=t.fetch,t.fetch&&(exports.default=t.fetch.bind(t)),exports.Headers=t.Headers,exports.Request=t.Request,exports.Response=t.Response;
|
||
},{}],"earR":[function(require,module,exports) {
|
||
"use strict";globalThis.fetch&&globalThis.Headers&&globalThis.Request&&globalThis.Response?module.exports={default:globalThis.fetch,Headers:globalThis.Headers,Request:globalThis.Request,Response:globalThis.Response}:module.exports={default:require("node-fetch").default,Headers:require("node-fetch").Headers,Request:require("node-fetch").Request,Response:require("node-fetch").Response};
|
||
},{"node-fetch":"PHzn"}],"0CXM":[function(require,module,exports) {
|
||
"use strict";const{default:e,Headers:t}=require("native-fetch");function r({serverResolver:e,hostname:t,recordType:r}){return`${e}?name=${t}&type=${r}`}function n(r){return e(r,{headers:new t({accept:"application/dns-json"})})}function o(e,t){return`${t}_${e}`}module.exports.buildResource=r,module.exports.fetch=n,module.exports.getCacheKey=o;
|
||
},{"native-fetch":"earR"}],"GUuF":[function(require,module,exports) {
|
||
"use strict";const e=require("debug"),r=e("dns-over-http-resolver");r.error=e("dns-over-http-resolver:error");const t=require("receptacle"),{buildResource:s,fetch:o,getCacheKey:c}=require("./utils");class n{constructor({maxCache:e=100}={}){this._cache=new t({max:e}),this._servers=["https://cloudflare-dns.com/dns-query","https://dns.google/resolve"]}getServers(){return this._servers}_getShuffledServers(){const e=[].concat(this._servers);for(let r=e.length-1;r>0;r--){const t=Math.floor(Math.random()*r),s=e[r];e[r]=e[t],e[t]=s}return e}setServers(e){this._servers=e}resolve(e,r="A"){switch(r){case"A":return this.resolve4(e);case"AAAA":return this.resolve6(e);case"TXT":return this.resolveTxt(e);default:throw new Error(`${r} is not supported`)}}async resolve4(e){const t=this._cache.get(c(e,"A"));if(t)return t;for(const a of this._getShuffledServers())try{const t=await o(s({serverResolver:a,hostname:e,recordType:"A"})),h=await t.json(),l=h.Answer.map(e=>e.data),i=Math.min(h.Answer.map(e=>e.TTL));return this._cache.set(c(e,"A"),l,{ttl:i}),l}catch(n){r.error(`${a} could not resolve ${e} record A`)}throw new Error(`Could not resolve ${e} record A`)}async resolve6(e){const t=this._cache.get(c(e,"AAAA"));if(t)return t;for(const a of this._getShuffledServers())try{const t=await o(s({serverResolver:a,hostname:e,recordType:"AAAA"})),h=await t.json(),l=h.Answer.map(e=>e.data),i=Math.min(h.Answer.map(e=>e.TTL));return this._cache.set(c(e,"AAAA"),l,{ttl:i}),l}catch(n){r.error(`${a} could not resolve ${e} record AAAA`)}throw new Error(`Could not resolve ${e} record AAAA`)}async resolveTxt(e){const t=this._cache.get(c(e,"TXT"));if(t)return t;for(const a of this._getShuffledServers())try{const t=await o(s({serverResolver:a,hostname:e,recordType:"TXT"})),h=await t.json(),l=h.Answer.map(e=>[e.data.replace(/['"]+/g,"")]),i=Math.min(h.Answer.map(e=>e.TTL));return this._cache.set(c(e,"TXT"),l,{ttl:i}),l}catch(n){r.error(`${a} could not resolve ${e} record TXT`)}throw new Error(`Could not resolve ${e} record TXT`)}}n.Resolver=n,module.exports=n;
|
||
},{"debug":"F8gk","receptacle":"W5lK","./utils":"0CXM"}],"6vLU":[function(require,module,exports) {
|
||
"use strict";const e=require("dns-over-http-resolver");module.exports=e;
|
||
},{"dns-over-http-resolver":"GUuF"}],"rEhL":[function(require,module,exports) {
|
||
"use strict";const e=require("../protocols-table"),{code:r}=e("dnsaddr");async function s(e){const s=new(require("./dns")),t=e.getPeerId(),[,d]=e.stringTuples().find(([e])=>e===r)||[];let n=(await s.resolveTxt(`_dnsaddr.${d}`)).flat().map(e=>e.split("=")[1]);return t&&(n=n.filter(e=>e.includes(t))),n}module.exports={dnsaddrResolver:s};
|
||
},{"../protocols-table":"f6b+","./dns":"6vLU"}],"yxTM":[function(require,module,exports) {
|
||
"use strict";module.exports={DIAL_TIMEOUT:3e4,MAX_PARALLEL_DIALS:100,MAX_PER_PEER_DIALS:4,METRICS:{computeThrottleMaxQueueSize:1e3,computeThrottleTimeout:2e3,movingAverageIntervals:[6e4,3e5,9e5],maxOldPeersRetention:50}};
|
||
},{}],"J38Q":[function(require,module,exports) {
|
||
module.exports={name:"libp2p",version:"0.30.12",description:"JavaScript implementation of libp2p, a modular peer to peer network stack",leadMaintainer:"Jacob Heun <jacobheun@gmail.com>",main:"src/index.js",types:"dist/src/index.d.ts",typesVersions:{"*":{"src/*":["dist/src/*","dist/src/*/index"]}},files:["dist","src"],scripts:{lint:"aegir lint",build:"aegir build","build:proto":"npm run build:proto:circuit && npm run build:proto:identify && npm run build:proto:plaintext && npm run build:proto:address-book && npm run build:proto:proto-book && npm run build:proto:peer-record && npm run build:proto:envelope","build:proto:circuit":"pbjs -t static-module -w commonjs --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/circuit/protocol/index.js ./src/circuit/protocol/index.proto","build:proto:identify":"pbjs -t static-module -w commonjs --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/identify/message.js ./src/identify/message.proto","build:proto:plaintext":"pbjs -t static-module -w commonjs --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/insecure/proto.js ./src/insecure/proto.proto","build:proto:address-book":"pbjs -t static-module -w commonjs --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/peer-store/persistent/pb/address-book.js ./src/peer-store/persistent/pb/address-book.proto","build:proto:proto-book":"pbjs -t static-module -w commonjs --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/peer-store/persistent/pb/proto-book.js ./src/peer-store/persistent/pb/proto-book.proto","build:proto:peer-record":"pbjs -t static-module -w commonjs --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/record/peer-record/peer-record.js ./src/record/peer-record/peer-record.proto","build:proto:envelope":"pbjs -t static-module -w commonjs --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/record/envelope/envelope.js ./src/record/envelope/envelope.proto","build:proto-types":"npm run build:proto-types:circuit && npm run build:proto-types:identify && npm run build:proto-types:plaintext && npm run build:proto-types:address-book && npm run build:proto-types:proto-book && npm run build:proto-types:peer-record && npm run build:proto-types:envelope","build:proto-types:circuit":"pbts -o src/circuit/protocol/index.d.ts src/circuit/protocol/index.js","build:proto-types:identify":"pbts -o src/identify/message.d.ts src/identify/message.js","build:proto-types:plaintext":"pbts -o src/insecure/proto.d.ts src/insecure/proto.js","build:proto-types:address-book":"pbts -o src/peer-store/persistent/pb/address-book.d.ts src/peer-store/persistent/pb/address-book.js","build:proto-types:proto-book":"pbts -o src/peer-store/persistent/pb/proto-book.d.ts src/peer-store/persistent/pb/proto-book.js","build:proto-types:peer-record":"pbts -o src/record/peer-record/peer-record.d.ts src/record/peer-record/peer-record.js","build:proto-types:envelope":"pbts -o src/record/envelope/envelope.d.ts src/record/envelope/envelope.js",test:"aegir test","test:ts":"aegir build --no-bundle && npm run test --prefix test/ts-use","test:node":'aegir test -t node -f "./test/**/*.{node,spec}.js"',"test:browser":"aegir test -t browser","test:examples":"cd examples && npm run test:all",prepare:"aegir build --no-bundle",release:"aegir release -t node -t browser","release-minor":"aegir release --type minor -t node -t browser","release-major":"aegir release --type major -t node -t browser",coverage:"nyc --reporter=text --reporter=lcov npm run test:node"},repository:{type:"git",url:"https://github.com/libp2p/js-libp2p.git"},keywords:["libp2p","network","p2p","peer","peer-to-peer","IPFS"],bugs:{url:"https://github.com/libp2p/js-libp2p/issues"},homepage:"https://libp2p.io",license:"MIT",engines:{node:">=14.0.0"},browser:{"@motrix/nat-api":!1},eslintConfig:{extends:"ipfs",ignorePatterns:["!.aegir.js","test/ts-use"]},dependencies:{"@motrix/nat-api":"^0.3.1","abort-controller":"^3.0.0","aggregate-error":"^3.1.0","any-signal":"^2.1.1","bignumber.js":"^9.0.1",cids:"^1.1.5","class-is":"^1.1.0",debug:"^4.3.1","err-code":"^3.0.0","es6-promisify":"^6.1.1",events:"^3.3.0",hashlru:"^2.3.0","interface-datastore":"^3.0.3","ipfs-utils":"^6.0.0","it-all":"^1.0.4","it-buffer":"^0.1.2","it-drain":"^1.0.3","it-filter":"^1.0.1","it-first":"^1.0.4","it-handshake":"^2.0.0","it-length-prefixed":"^5.0.2","it-map":"^1.0.4","it-merge":"1.0.0","it-pipe":"^1.1.0","it-take":"1.0.0","libp2p-crypto":"^0.19.0","libp2p-interfaces":"^0.10.0","libp2p-utils":"^0.3.1",mafmt:"^9.0.0","merge-options":"^3.0.4","moving-average":"^1.0.0",multiaddr:"^9.0.1",multicodec:"^3.0.1","multihashing-async":"^2.1.2","multistream-select":"^2.0.0","mutable-proxy":"^1.0.0","node-forge":"^0.10.0","p-any":"^3.0.0","p-fifo":"^1.0.0","p-retry":"^4.4.0","p-settle":"^4.1.1","peer-id":"^0.14.2","private-ip":"^2.1.0",protobufjs:"^6.10.2",retimer:"^3.0.0","sanitize-filename":"^1.6.3","set-delayed-interval":"^1.0.0","streaming-iterables":"^5.0.2","timeout-abort-controller":"^1.1.1",varint:"^6.0.0",xsalsa20:"^1.1.0"},devDependencies:{"@nodeutils/defaults-deep":"^1.1.0","@types/es6-promisify":"^6.0.0","@types/node-forge":"^0.9.7","@types/varint":"^6.0.0","abortable-iterator":"^3.0.0",aegir:"^33.0.0",buffer:"^6.0.3","chai-bytes":"^0.1.2","chai-string":"^1.5.0",delay:"^5.0.0","interop-libp2p":"^0.3.0","into-stream":"^6.0.0","ipfs-http-client":"^49.0.4","it-concat":"^1.0.0","it-pair":"^1.0.0","it-pushable":"^1.4.0",libp2p:".","libp2p-bootstrap":"^0.12.3","libp2p-delegated-content-routing":"^0.10.0","libp2p-delegated-peer-routing":"^0.9.0","libp2p-floodsub":"^0.25.0","libp2p-gossipsub":"^0.8.0","libp2p-kad-dht":"^0.21.0","libp2p-mdns":"^0.16.0","libp2p-mplex":"^0.10.1","libp2p-noise":"^2.0.0","libp2p-tcp":"^0.15.1","libp2p-webrtc-star":"^0.22.0","libp2p-websockets":"^0.15.0",multihashes:"^4.0.2",nock:"^13.0.3","p-defer":"^3.0.0","p-times":"^3.0.0","p-wait-for":"^3.2.0",rimraf:"^3.0.2",sinon:"^10.0.0",uint8arrays:"^2.1.3",util:"^0.12.3"},contributors:["David Dias <daviddias.p@gmail.com>","Jacob Heun <jacobheun@gmail.com>","Vasco Santos <vasco.santos@moxy.studio>","Alan Shaw <alan@tableflip.io>","Alex Potsides <alex@achingbrain.net>","Cayman <caymannava@gmail.com>","Pedro Teixeira <i@pgte.me>","Friedel Ziegelmayer <dignifiedquire@gmail.com>","Maciej Krüger <mkg20001@gmail.com>","Hugo Dias <mail@hugodias.me>","Volker Mische <volker.mische@gmail.com>","dirkmc <dirkmdev@gmail.com>","Richard Littauer <richard.littauer@gmail.com>","a1300 <matthias-knopp@gmx.net>","Elven <mon.samuel@qq.com>","Andrew Nesbitt <andrewnez@gmail.com>","ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ <victorbjelkholm@gmail.com>","Giovanni T. Parra <fiatjaf@gmail.com>","Ryan Bell <ryan@piing.net>","Thomas Eizinger <thomas@eizinger.io>","Samlior <samlior@foxmail.com>","Didrik Nordström <didrik@betamos.se>","Julien Bouquillon <contact@revolunet.com>","Kevin Kwok <antimatter15@gmail.com>","Kevin Lacker <lacker@gmail.com>","Miguel Mota <miguelmota2@gmail.com>","Nuno Nogueira <nunofmn@gmail.com>","Philipp Muens <raute1337@gmx.de>","RasmusErik Voel Jensen <github@solsort.com>","Smite Chow <xiaopengyou@live.com>","Soeren <nikorpoulsen@gmail.com>","Sönke Hahn <soenkehahn@gmail.com>","TJKoury <TJKoury@gmail.com>","Tiago Alves <alvesjtiago@gmail.com>","Daijiro Wachi <daijiro.wachi@gmail.com>","Cindy Wu <ciindy.wu@gmail.com>","Chris Bratlien <chrisbratlien@gmail.com>","Yusef Napora <yusef@napora.org>","Zane Starr <zcstarr@gmail.com>","Bernd Strehl <bernd.strehl@gmail.com>","ebinks <elizabethjbinks@gmail.com>","Ethan Lam <elmemphis2000@gmail.com>","isan_rivkin <isanrivkin@gmail.com>","robertkiel <robert.kiel@validitylabs.org>","Aleksei <vozhdb@gmail.com>","Fei Liu <liu.feiwood@gmail.com>","Felipe Martins <felipebrasil93@gmail.com>","Florian-Merle <florian.david.merle@gmail.com>","Francis Gulotta <wizard@roborooter.com>","Dmitriy Ryajov <dryajov@gmail.com>","Henrique Dias <hacdias@gmail.com>","Irakli Gozalishvili <rfobic@gmail.com>","Diogo Silva <fsdiogo@gmail.com>","Joel Gustafson <joelg@mit.edu>"]};
|
||
},{}],"erSH":[function(require,module,exports) {
|
||
"use strict";var e=require("../../package.json").version;module.exports.PROTOCOL_VERSION="ipfs/0.1.0",module.exports.AGENT_VERSION="js-libp2p/".concat(e),module.exports.MULTICODEC_IDENTIFY="/ipfs/id/1.0.0",module.exports.MULTICODEC_IDENTIFY_PUSH="/ipfs/id/push/1.0.0";
|
||
},{"../../package.json":"J38Q"}],"qD4Y":[function(require,module,exports) {
|
||
"use strict";var E=6e4;module.exports={ADVERTISE_BOOT_DELAY:15*E,ADVERTISE_TTL:30*E,CIRCUIT_PROTO_CODE:290,HOP_METADATA_KEY:"hop_relay",HOP_METADATA_VALUE:"true",RELAY_RENDEZVOUS_NS:"/libp2p/relay"};
|
||
},{}],"OdTo":[function(require,module,exports) {
|
||
(function(){var t,i,s,r,n,o,e,a;a=function(t){return[(t&255<<24)>>>24,(t&255<<16)>>>16,(65280&t)>>>8,255&t].join(".")},e=function(t){var s,r,n,o,e,a;for(s=[],n=o=0;o<=3&&0!==t.length;n=++o){if(n>0){if("."!==t[0])throw new Error("Invalid IP");t=t.substring(1)}e=(a=i(t))[0],r=a[1],t=t.substring(r),s.push(e)}if(0!==t.length)throw new Error("Invalid IP");switch(s.length){case 1:if(s[0]>4294967295)throw new Error("Invalid IP");return s[0]>>>0;case 2:if(s[0]>255||s[1]>16777215)throw new Error("Invalid IP");return(s[0]<<24|s[1])>>>0;case 3:if(s[0]>255||s[1]>255||s[2]>65535)throw new Error("Invalid IP");return(s[0]<<24|s[1]<<16|s[2])>>>0;case 4:if(s[0]>255||s[1]>255||s[2]>255||s[3]>255)throw new Error("Invalid IP");return(s[0]<<24|s[1]<<16|s[2]<<8|s[3])>>>0;default:throw new Error("Invalid IP")}},r=(s=function(t){return t.charCodeAt(0)})("0"),o=s("a"),n=s("A"),i=function(t){var i,e,a,h,f;for(h=0,i=10,e="9",a=0,t.length>1&&"0"===t[a]&&("x"===t[a+1]||"X"===t[a+1]?(a+=2,i=16):"0"<=t[a+1]&&t[a+1]<="9"&&(a++,i=8,e="7")),f=a;a<t.length;){if("0"<=t[a]&&t[a]<=e)h=h*i+(s(t[a])-r)>>>0;else{if(16!==i)break;if("a"<=t[a]&&t[a]<="f")h=h*i+(10+s(t[a])-o)>>>0;else{if(!("A"<=t[a]&&t[a]<="F"))break;h=h*i+(10+s(t[a])-n)>>>0}}if(h>4294967295)throw new Error("too large");a++}if(a===f)throw new Error("empty octet");return[h,a]},t=function(){function t(t,i){var s,r,n;if("string"!=typeof t)throw new Error("Missing `net' parameter");if(i||(n=t.split("/",2),t=n[0],i=n[1]),i||(i=32),"string"==typeof i&&i.indexOf(".")>-1){try{this.maskLong=e(i)}catch(o){throw o,new Error("Invalid mask: "+i)}for(s=r=32;r>=0;s=--r)if(this.maskLong===4294967295<<32-s>>>0){this.bitmask=s;break}}else{if(!i&&0!==i)throw new Error("Invalid mask: empty");this.bitmask=parseInt(i,10),this.maskLong=0,this.bitmask>0&&(this.maskLong=4294967295<<32-this.bitmask>>>0)}try{this.netLong=(e(t)&this.maskLong)>>>0}catch(o){throw o,new Error("Invalid net address: "+t)}if(!(this.bitmask<=32))throw new Error("Invalid mask for ip4: "+i);this.size=Math.pow(2,32-this.bitmask),this.base=a(this.netLong),this.mask=a(this.maskLong),this.hostmask=a(~this.maskLong),this.first=this.bitmask<=30?a(this.netLong+1):this.base,this.last=this.bitmask<=30?a(this.netLong+this.size-2):a(this.netLong+this.size-1),this.broadcast=this.bitmask<=30?a(this.netLong+this.size-1):void 0}return t.prototype.contains=function(i){return"string"==typeof i&&(i.indexOf("/")>0||4!==i.split(".").length)&&(i=new t(i)),i instanceof t?this.contains(i.base)&&this.contains(i.broadcast||i.last):(e(i)&this.maskLong)>>>0==(this.netLong&this.maskLong)>>>0},t.prototype.next=function(i){return null==i&&(i=1),new t(a(this.netLong+this.size*i),this.mask)},t.prototype.forEach=function(t){var i,s,r;for(r=e(this.first),s=e(this.last),i=0;r<=s;)t(a(r),r,i),i++,r++},t.prototype.toString=function(){return this.base+"/"+this.bitmask},t}(),exports.ip2long=e,exports.long2ip=a,exports.Netmask=t}).call(this);
|
||
},{}],"XAJr":[function(require,module,exports) {
|
||
const f=require("netmask").Netmask,t=require("ip-regex"),a=["0.0.0.0/8","10.0.0.0/8","100.64.0.0/10","127.0.0.0/8","169.254.0.0/16","172.16.0.0/12","192.0.0.0/24","192.0.0.0/29","192.0.0.8/32","192.0.0.9/32","192.0.0.10/32","192.0.0.170/32","192.0.0.171/32","192.0.2.0/24","192.31.196.0/24","192.52.193.0/24","192.88.99.0/24","192.168.0.0/16","192.175.48.0/24","198.18.0.0/15","198.51.100.0/24","203.0.113.0/24","240.0.0.0/4","255.255.255.255/32"];function A(t){const A=[...a].map(t=>new f(t));for(let f of A)if(f.contains(t))return!0;return!1}function F(f){return/^::$/.test(f)||/^::1$/.test(f)||/^::f{4}:([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(f)||/^::f{4}:0.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(f)||/^64:ff9b::([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(f)||/^100::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(f)||/^2001::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(f)||/^2001:2[0-9a-fA-F]:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(f)||/^2001:db8:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(f)||/^2002:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(f)||/^f[c-d]([0-9a-fA-F]{2,2}):/i.test(f)||/^fe[8-9a-bA-B][0-9a-fA-F]:/i.test(f)||/^ff([0-9a-fA-F]{2,2}):/i.test(f)}module.exports=(f=>t.v6().test(f)?F(f):!(!t().test(f)&&!f.startsWith("0"))&&A(f));
|
||
},{"netmask":"OdTo","ip-regex":"rpx5"}],"FImH":[function(require,module,exports) {
|
||
"use strict";module.exports=require("./lib");
|
||
},{"./lib":"XAJr"}],"pppC":[function(require,module,exports) {
|
||
"use strict";const e=require("private-ip");function r(r){const{address:s}=r.nodeAddress();return e(s)}module.exports=r;
|
||
},{"private-ip":"FImH"}],"MtMt":[function(require,module,exports) {
|
||
"use strict";const i=require("./multiaddr/is-private");function r(r,t){const e=i(r.multiaddr),s=i(t.multiaddr);return e&&!s?1:!e&&s?-1:r.isCertified&&!t.isCertified?-1:!r.isCertified&&t.isCertified?1:0}function t(i){return[...i].sort(r)}module.exports.publicAddressesFirst=t;
|
||
},{"./multiaddr/is-private":"pppC"}],"a4qW":[function(require,module,exports) {
|
||
"use strict";function e(e,r,t,n,u,i,o){try{var a=e[i](o),c=a.value}catch(s){return void t(s)}a.done?r(c):Promise.resolve(c).then(n,u)}function r(r){return function(){var t=this,n=arguments;return new Promise(function(u,i){var o=r.apply(t,n);function a(r){e(o,u,i,a,c,"next",r)}function c(r){e(o,u,i,a,c,"throw",r)}a(void 0)})}}var t=function(){var e=r(regeneratorRuntime.mark(function e(r){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,r;case 3:return t=e.sent,e.abrupt("return",{isFulfilled:!0,isRejected:!1,value:t});case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",{isFulfilled:!1,isRejected:!0,reason:e.t0});case 10:case"end":return e.stop()}},e,null,[[0,7]])}));return function(r){return e.apply(this,arguments)}}();module.exports=t,module.exports.default=t;
|
||
},{}],"HggW":[function(require,module,exports) {
|
||
"use strict";var e=function(e){for(var r=arguments.length,o=new Array(r>1?r-1:0),t=1;t<r;t++)o[t-1]=arguments[t];return new Promise(function(r){r(e.apply(void 0,o))})};module.exports=e,module.exports.default=e;
|
||
},{}],"iygc":[function(require,module,exports) {
|
||
"use strict";var e=require("p-try"),n=function(n){if(!Number.isInteger(n)&&n!==1/0||!(n>0))return Promise.reject(new TypeError("Expected `concurrency` to be a number from 1 and up"));var r=[],t=0,o=function(){t--,r.length>0&&r.shift()()},u=function(n,r){t++;for(var u=arguments.length,c=new Array(u>2?u-2:0),i=2;i<u;i++)c[i-2]=arguments[i];var a=e.apply(void 0,[n].concat(c));r(a),a.then(o,o)},c=function(e){for(var o=arguments.length,c=new Array(o>1?o-1:0),i=1;i<o;i++)c[i-1]=arguments[i];return new Promise(function(o){return function(e,o){for(var c=arguments.length,i=new Array(c>2?c-2:0),a=2;a<c;a++)i[a-2]=arguments[a];t<n?u.apply(void 0,[e,o].concat(i)):r.push(u.bind.apply(u,[null,e,o].concat(i)))}.apply(void 0,[e,o].concat(c))})};return Object.defineProperties(c,{activeCount:{get:function(){return t}},pendingCount:{get:function(){return r.length}},clearQueue:{value:function(){r.length=0}}}),c};module.exports=n,module.exports.default=n;
|
||
},{"p-try":"HggW"}],"oUeo":[function(require,module,exports) {
|
||
"use strict";function r(r,n,e,t,o,u,i){try{var c=r[u](i),a=c.value}catch(f){return void e(f)}c.done?n(a):Promise.resolve(a).then(t,o)}function n(n){return function(){var e=this,t=arguments;return new Promise(function(o,u){var i=n.apply(e,t);function c(n){r(i,o,u,c,a,"next",n)}function a(n){r(i,o,u,c,a,"throw",n)}c(void 0)})}}var e=require("p-reflect"),t=require("p-limit");module.exports=function(){var r=n(regeneratorRuntime.mark(function r(n){var o,u,i,c=arguments;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return o=c.length>1&&void 0!==c[1]?c[1]:{},u=o.concurrency,i=t(void 0===u?1/0:u),r.abrupt("return",Promise.all(n.map(function(r){return r&&"function"==typeof r.then?e(r):e("function"==typeof r?i(function(){return r()}):Promise.resolve(r))})));case 4:case"end":return r.stop()}},r)}));return function(n){return r.apply(this,arguments)}}();
|
||
},{"p-reflect":"a4qW","p-limit":"iygc"}],"wkZT":[function(require,module,exports) {
|
||
"use strict";var e=require("protobufjs/minimal"),a=e.Reader,t=e.Writer,y=e.util,l=e.roots.default||(e.roots.default={});l.Envelope=function(){function r(e){if(e)for(var a=Object.keys(e),t=0;t<a.length;++t)null!=e[a[t]]&&(this[a[t]]=e[a[t]])}return r.prototype.publicKey=y.newBuffer([]),r.prototype.payloadType=y.newBuffer([]),r.prototype.payload=y.newBuffer([]),r.prototype.signature=y.newBuffer([]),r.encode=function(e,a){return a||(a=t.create()),null!=e.publicKey&&Object.hasOwnProperty.call(e,"publicKey")&&a.uint32(10).bytes(e.publicKey),null!=e.payloadType&&Object.hasOwnProperty.call(e,"payloadType")&&a.uint32(18).bytes(e.payloadType),null!=e.payload&&Object.hasOwnProperty.call(e,"payload")&&a.uint32(26).bytes(e.payload),null!=e.signature&&Object.hasOwnProperty.call(e,"signature")&&a.uint32(42).bytes(e.signature),a},r.decode=function(e,t){e instanceof a||(e=a.create(e));for(var y=void 0===t?e.len:e.pos+t,r=new l.Envelope;e.pos<y;){var p=e.uint32();switch(p>>>3){case 1:r.publicKey=e.bytes();break;case 2:r.payloadType=e.bytes();break;case 3:r.payload=e.bytes();break;case 5:r.signature=e.bytes();break;default:e.skipType(7&p)}}return r},r.fromObject=function(e){if(e instanceof l.Envelope)return e;var a=new l.Envelope;return null!=e.publicKey&&("string"==typeof e.publicKey?y.base64.decode(e.publicKey,a.publicKey=y.newBuffer(y.base64.length(e.publicKey)),0):e.publicKey.length&&(a.publicKey=e.publicKey)),null!=e.payloadType&&("string"==typeof e.payloadType?y.base64.decode(e.payloadType,a.payloadType=y.newBuffer(y.base64.length(e.payloadType)),0):e.payloadType.length&&(a.payloadType=e.payloadType)),null!=e.payload&&("string"==typeof e.payload?y.base64.decode(e.payload,a.payload=y.newBuffer(y.base64.length(e.payload)),0):e.payload.length&&(a.payload=e.payload)),null!=e.signature&&("string"==typeof e.signature?y.base64.decode(e.signature,a.signature=y.newBuffer(y.base64.length(e.signature)),0):e.signature.length&&(a.signature=e.signature)),a},r.toObject=function(e,a){a||(a={});var t={};return a.defaults&&(a.bytes===String?t.publicKey="":(t.publicKey=[],a.bytes!==Array&&(t.publicKey=y.newBuffer(t.publicKey))),a.bytes===String?t.payloadType="":(t.payloadType=[],a.bytes!==Array&&(t.payloadType=y.newBuffer(t.payloadType))),a.bytes===String?t.payload="":(t.payload=[],a.bytes!==Array&&(t.payload=y.newBuffer(t.payload))),a.bytes===String?t.signature="":(t.signature=[],a.bytes!==Array&&(t.signature=y.newBuffer(t.signature)))),null!=e.publicKey&&e.hasOwnProperty("publicKey")&&(t.publicKey=a.bytes===String?y.base64.encode(e.publicKey,0,e.publicKey.length):a.bytes===Array?Array.prototype.slice.call(e.publicKey):e.publicKey),null!=e.payloadType&&e.hasOwnProperty("payloadType")&&(t.payloadType=a.bytes===String?y.base64.encode(e.payloadType,0,e.payloadType.length):a.bytes===Array?Array.prototype.slice.call(e.payloadType):e.payloadType),null!=e.payload&&e.hasOwnProperty("payload")&&(t.payload=a.bytes===String?y.base64.encode(e.payload,0,e.payload.length):a.bytes===Array?Array.prototype.slice.call(e.payload):e.payload),null!=e.signature&&e.hasOwnProperty("signature")&&(t.signature=a.bytes===String?y.base64.encode(e.signature,0,e.signature.length):a.bytes===Array?Array.prototype.slice.call(e.signature):e.signature),t},r.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},r}(),module.exports=l;
|
||
},{"protobufjs/minimal":"78bh"}],"59KL":[function(require,module,exports) {
|
||
"use strict";function e(e,r,n,t,a,i,u){try{var o=e[i](u),s=o.value}catch(p){return void n(p)}o.done?r(s):Promise.resolve(s).then(t,a)}function r(r){return function(){var n=this,t=arguments;return new Promise(function(a,i){var u=r.apply(n,t);function o(r){e(u,a,i,o,s,"next",r)}function s(r){e(u,a,i,o,s,"throw",r)}o(void 0)})}}function n(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function t(e,r){for(var n=0;n<r.length;n++){var t=r[n];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(e,t.key,t)}}function a(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}var i=require("err-code"),u=require("uint8arrays/concat"),o=require("uint8arrays/from-string"),s=require("libp2p-crypto/src/keys"),p=require("peer-id"),c=require("varint"),y=require("uint8arrays/equals"),l=require("../../errors"),d=l.codes,h=require("./envelope"),f=h.Envelope,v=function(){function e(r){var t=r.peerId,a=r.payloadType,i=r.payload,u=r.signature;n(this,e),this.peerId=t,this.payloadType=a,this.payload=i,this.signature=u,this._marshal=void 0}return a(e,[{key:"marshal",value:function(){if(this._marshal)return this._marshal;var e=s.marshalPublicKey(this.peerId.pubKey);return this._marshal=f.encode({publicKey:e,payloadType:this.payloadType,payload:this.payload,signature:this.signature}).finish(),this._marshal}},{key:"equals",value:function(e){return y(this.peerId.pubKey.bytes,e.peerId.pubKey.bytes)&&y(this.payloadType,e.payloadType)&&y(this.payload,e.payload)&&y(this.signature,e.signature)}},{key:"validate",value:function(e){var r=m(e,this.payloadType,this.payload);return this.peerId.pubKey.verify(r,this.signature)}}]),e}(),m=function(e,r,n){var t=o(e),a=c.encode(t.byteLength),i=c.encode(r.length),s=c.encode(n.length);return u([new Uint8Array(a),t,new Uint8Array(i),r,new Uint8Array(s),n])};v.createFromProtobuf=function(){var e=r(regeneratorRuntime.mark(function e(r){var n,t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=f.decode(r),e.next=3,p.createFromPubKey(n.publicKey);case 3:return t=e.sent,e.abrupt("return",new v({peerId:t,payloadType:n.payloadType,payload:n.payload,signature:n.signature}));case 5:case"end":return e.stop()}},e)}));return function(r){return e.apply(this,arguments)}}(),v.seal=function(){var e=r(regeneratorRuntime.mark(function e(r,n){var t,a,i,u,o;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.domain,a=r.codec,i=r.marshal(),u=m(t,a,i),e.next=6,n.privKey.sign(u);case 6:return o=e.sent,e.abrupt("return",new v({peerId:n,payloadType:a,payload:i,signature:o}));case 8:case"end":return e.stop()}},e)}));return function(r,n){return e.apply(this,arguments)}}(),v.openAndCertify=function(){var e=r(regeneratorRuntime.mark(function e(r,n){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,v.createFromProtobuf(r);case 2:return t=e.sent,e.next=5,t.validate(n);case 5:if(e.sent){e.next=8;break}throw i(new Error("envelope signature is not valid for the given domain"),d.ERR_SIGNATURE_NOT_VALID);case 8:return e.abrupt("return",t);case 9:case"end":return e.stop()}},e)}));return function(r,n){return e.apply(this,arguments)}}(),module.exports=v;
|
||
},{"err-code":"hLMW","uint8arrays/concat":"qYui","uint8arrays/from-string":"YqS+","libp2p-crypto/src/keys":"h7X6","peer-id":"jAbp","varint":"pAlk","uint8arrays/equals":"mZxc","../../errors":"YLhd","./envelope":"wkZT"}],"Bhxt":[function(require,module,exports) {
|
||
"use strict";function e(e,t){return e.length===t.length&&t.sort()&&e.sort().every((e,r)=>t[r].equals(e))}module.exports=e;
|
||
},{}],"eEIm":[function(require,module,exports) {
|
||
"use strict";function e(r){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(r)}var r=require("protobufjs/minimal"),t=r.Reader,s=r.Writer,d=r.util,n=r.roots.default||(r.roots.default={});n.PeerRecord=function(){function o(e){if(this.addresses=[],e)for(var r=Object.keys(e),t=0;t<r.length;++t)null!=e[r[t]]&&(this[r[t]]=e[r[t]])}return o.prototype.peerId=d.newBuffer([]),o.prototype.seq=d.Long?d.Long.fromBits(0,0,!0):0,o.prototype.addresses=d.emptyArray,o.encode=function(e,r){if(r||(r=s.create()),null!=e.peerId&&Object.hasOwnProperty.call(e,"peerId")&&r.uint32(10).bytes(e.peerId),null!=e.seq&&Object.hasOwnProperty.call(e,"seq")&&r.uint32(16).uint64(e.seq),null!=e.addresses&&e.addresses.length)for(var t=0;t<e.addresses.length;++t)n.PeerRecord.AddressInfo.encode(e.addresses[t],r.uint32(26).fork()).ldelim();return r},o.decode=function(e,r){e instanceof t||(e=t.create(e));for(var s=void 0===r?e.len:e.pos+r,d=new n.PeerRecord;e.pos<s;){var o=e.uint32();switch(o>>>3){case 1:d.peerId=e.bytes();break;case 2:d.seq=e.uint64();break;case 3:d.addresses&&d.addresses.length||(d.addresses=[]),d.addresses.push(n.PeerRecord.AddressInfo.decode(e,e.uint32()));break;default:e.skipType(7&o)}}return d},o.fromObject=function(r){if(r instanceof n.PeerRecord)return r;var t=new n.PeerRecord;if(null!=r.peerId&&("string"==typeof r.peerId?d.base64.decode(r.peerId,t.peerId=d.newBuffer(d.base64.length(r.peerId)),0):r.peerId.length&&(t.peerId=r.peerId)),null!=r.seq&&(d.Long?(t.seq=d.Long.fromValue(r.seq)).unsigned=!0:"string"==typeof r.seq?t.seq=parseInt(r.seq,10):"number"==typeof r.seq?t.seq=r.seq:"object"===e(r.seq)&&(t.seq=new d.LongBits(r.seq.low>>>0,r.seq.high>>>0).toNumber(!0))),r.addresses){if(!Array.isArray(r.addresses))throw TypeError(".PeerRecord.addresses: array expected");t.addresses=[];for(var s=0;s<r.addresses.length;++s){if("object"!==e(r.addresses[s]))throw TypeError(".PeerRecord.addresses: object expected");t.addresses[s]=n.PeerRecord.AddressInfo.fromObject(r.addresses[s])}}return t},o.toObject=function(e,r){r||(r={});var t={};if((r.arrays||r.defaults)&&(t.addresses=[]),r.defaults)if(r.bytes===String?t.peerId="":(t.peerId=[],r.bytes!==Array&&(t.peerId=d.newBuffer(t.peerId))),d.Long){var s=new d.Long(0,0,!0);t.seq=r.longs===String?s.toString():r.longs===Number?s.toNumber():s}else t.seq=r.longs===String?"0":0;if(null!=e.peerId&&e.hasOwnProperty("peerId")&&(t.peerId=r.bytes===String?d.base64.encode(e.peerId,0,e.peerId.length):r.bytes===Array?Array.prototype.slice.call(e.peerId):e.peerId),null!=e.seq&&e.hasOwnProperty("seq")&&("number"==typeof e.seq?t.seq=r.longs===String?String(e.seq):e.seq:t.seq=r.longs===String?d.Long.prototype.toString.call(e.seq):r.longs===Number?new d.LongBits(e.seq.low>>>0,e.seq.high>>>0).toNumber(!0):e.seq),e.addresses&&e.addresses.length){t.addresses=[];for(var o=0;o<e.addresses.length;++o)t.addresses[o]=n.PeerRecord.AddressInfo.toObject(e.addresses[o],r)}return t},o.prototype.toJSON=function(){return this.constructor.toObject(this,r.util.toJSONOptions)},o.AddressInfo=function(){function e(e){if(e)for(var r=Object.keys(e),t=0;t<r.length;++t)null!=e[r[t]]&&(this[r[t]]=e[r[t]])}return e.prototype.multiaddr=d.newBuffer([]),e.encode=function(e,r){return r||(r=s.create()),null!=e.multiaddr&&Object.hasOwnProperty.call(e,"multiaddr")&&r.uint32(10).bytes(e.multiaddr),r},e.decode=function(e,r){e instanceof t||(e=t.create(e));for(var s=void 0===r?e.len:e.pos+r,d=new n.PeerRecord.AddressInfo;e.pos<s;){var o=e.uint32();switch(o>>>3){case 1:d.multiaddr=e.bytes();break;default:e.skipType(7&o)}}return d},e.fromObject=function(e){if(e instanceof n.PeerRecord.AddressInfo)return e;var r=new n.PeerRecord.AddressInfo;return null!=e.multiaddr&&("string"==typeof e.multiaddr?d.base64.decode(e.multiaddr,r.multiaddr=d.newBuffer(d.base64.length(e.multiaddr)),0):e.multiaddr.length&&(r.multiaddr=e.multiaddr)),r},e.toObject=function(e,r){r||(r={});var t={};return r.defaults&&(r.bytes===String?t.multiaddr="":(t.multiaddr=[],r.bytes!==Array&&(t.multiaddr=d.newBuffer(t.multiaddr)))),null!=e.multiaddr&&e.hasOwnProperty("multiaddr")&&(t.multiaddr=r.bytes===String?d.base64.encode(e.multiaddr,0,e.multiaddr.length):r.bytes===Array?Array.prototype.slice.call(e.multiaddr):e.multiaddr),t},e.prototype.toJSON=function(){return this.constructor.toObject(this,r.util.toJSONOptions)},e}(),o}(),module.exports=n;
|
||
},{"protobufjs/minimal":"78bh"}],"LtJY":[function(require,module,exports) {
|
||
"use strict";var E=require("multicodec"),e=E.getName(E.LIBP2P_PEER_RECORD)||"libp2p-peer-record",r=Uint8Array.from([3,1]);module.exports={ENVELOPE_DOMAIN_PEER_RECORD:e,ENVELOPE_PAYLOAD_TYPE_PEER_RECORD:r};
|
||
},{"multicodec":"Bz9c"}],"ry3y":[function(require,module,exports) {
|
||
"use strict";function e(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function r(e,r){for(var t=0;t<r.length;t++){var s=r[t];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}function t(e,t,s){return t&&r(e.prototype,t),s&&r(e,s),e}var s=require("multiaddr"),i=s.Multiaddr,a=require("peer-id"),u=require("libp2p-utils/src/array-equals"),n=require("./peer-record"),d=n.PeerRecord,o=require("./consts"),l=o.ENVELOPE_DOMAIN_PEER_RECORD,m=o.ENVELOPE_PAYLOAD_TYPE_PEER_RECORD,c=function(){function r(t){var s=t.peerId,i=t.multiaddrs,a=void 0===i?[]:i,u=t.seqNumber,n=void 0===u?Date.now():u;e(this,r),this.domain=l,this.codec=m,this.peerId=s,this.multiaddrs=a,this.seqNumber=n,this._marshal=void 0}return t(r,[{key:"marshal",value:function(){return this._marshal?this._marshal:(this._marshal=d.encode({peerId:this.peerId.toBytes(),seq:this.seqNumber,addresses:this.multiaddrs.map(function(e){return{multiaddr:e.bytes}})}).finish(),this._marshal)}},{key:"equals",value:function(e){return e instanceof r&&(!!this.peerId.equals(e.peerId)&&(this.seqNumber===e.seqNumber&&!!u(this.multiaddrs,e.multiaddrs)))}}]),r}();c.createFromProtobuf=function(e){var r=d.decode(e),t=a.createFromBytes(r.peerId),s=(r.addresses||[]).map(function(e){return new i(e.multiaddr)}),u=Number(r.seq);return new c({peerId:t,multiaddrs:s,seqNumber:u})},c.DOMAIN=l,module.exports=c;
|
||
},{"multiaddr":"fVn4","peer-id":"jAbp","libp2p-utils/src/array-equals":"Bhxt","./peer-record":"eEIm","./consts":"LtJY"}],"926m":[function(require,module,exports) {
|
||
"use strict";function e(e,r,n,t,o,u,i){try{var a=e[u](i),c=a.value}catch(s){return void n(s)}a.done?r(c):Promise.resolve(c).then(t,o)}function r(r){return function(){var n=this,t=arguments;return new Promise(function(o,u){var i=r.apply(n,t);function a(r){e(i,o,u,a,c,"next",r)}function c(r){e(i,o,u,a,c,"throw",r)}a(void 0)})}}var n=require("./envelope"),t=require("./peer-record");function o(e){return u.apply(this,arguments)}function u(){return(u=r(regeneratorRuntime.mark(function e(r){var o,u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return o=new t({peerId:r.peerId,multiaddrs:r.multiaddrs}),e.next=3,n.seal(o,r.peerId);case 3:u=e.sent,r.peerStore.addressBook.consumePeerRecord(u);case 5:case"end":return e.stop()}},e)}))).apply(this,arguments)}module.exports.updateSelfPeerRecord=o;
|
||
},{"./envelope":"59KL","./peer-record":"ry3y"}],"O6+p":[function(require,module,exports) {
|
||
"use strict";function e(e){return n(e)||t(e)||l(e)||r()}function r(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function t(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function n(e){if(Array.isArray(e))return c(e)}function a(e,r){return s(e)||o(e,r)||l(e,r)||i()}function i(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function o(e,r){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var t=[],n=!0,a=!1,i=void 0;try{for(var o,s=e[Symbol.iterator]();!(n=(o=s.next()).done)&&(t.push(o.value),!r||t.length!==r);n=!0);}catch(u){a=!0,i=u}finally{try{n||null==s.return||s.return()}finally{if(a)throw i}}return t}}function s(e){if(Array.isArray(e))return e}function u(e,r){var t;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(t=l(e))||r&&e&&"number"==typeof e.length){t&&(e=t);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,s=!1;return{s:function(){t=e[Symbol.iterator]()},n:function(){var e=t.next();return o=e.done,e},e:function(e){s=!0,i=e},f:function(){try{o||null==t.return||t.return()}finally{if(s)throw i}}}}function l(e,r){if(e){if("string"==typeof e)return c(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?c(e,r):void 0}}function c(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function f(e,r,t,n,a,i,o){try{var s=e[i](o),u=s.value}catch(l){return void t(l)}s.done?r(u):Promise.resolve(u).then(n,a)}function p(e){return function(){var r=this,t=arguments;return new Promise(function(n,a){var i=e.apply(r,t);function o(e){f(i,n,a,o,s,"next",e)}function s(e){f(i,n,a,o,s,"throw",e)}o(void 0)})}}function h(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}function v(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?h(Object(t),!0).forEach(function(r){d(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):h(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function d(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function y(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function b(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function m(e,r,t){return r&&b(e.prototype,r),t&&b(e,t),e}var g=require("debug"),w=Object.assign(g("libp2p:transports"),{error:g("libp2p:transports:err")}),A=require("p-settle"),_=require("./errors"),O=_.codes,k=require("err-code"),R=require("./record/utils"),x=R.updateSelfPeerRecord,S=function(){function r(e){var t=e.libp2p,n=e.upgrader,a=e.faultTolerance,i=void 0===a?E.FATAL_ALL:a;y(this,r),this.libp2p=t,this.upgrader=n,this._transports=new Map,this._listeners=new Map,this._listenerOptions=new Map,this.faultTolerance=i}return m(r,[{key:"add",value:function(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(w("adding %s",e),!e)throw k(new Error("Transport must have a valid key, was given '".concat(e,"'")),O.ERR_INVALID_KEY);if(this._transports.has(e))throw k(new Error("There is already a transport with this key"),O.ERR_DUPLICATE_TRANSPORT);var n=new r(v(v({},t),{},{libp2p:this.libp2p,upgrader:this.upgrader}));this._transports.set(e,n),this._listenerOptions.set(e,t.listenerOptions||{}),this._listeners.has(e)||this._listeners.set(e,[])}},{key:"close",value:function(){var e=p(regeneratorRuntime.mark(function e(){var r,t,n,i,o,s,l,c,f,p;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:r=[],t=u(this._listeners);try{for(t.s();!(n=t.n()).done;)for(i=a(n.value,2),o=i[0],s=i[1],w("closing listeners for %s",o);s.length;)(l=s.pop()).removeAllListeners("listening"),l.removeAllListeners("close"),r.push(l.close())}catch(h){t.e(h)}finally{t.f()}return e.next=5,Promise.all(r);case 5:w("all listeners closed"),c=u(this._listeners.keys());try{for(c.s();!(f=c.n()).done;)p=f.value,this._listeners.set(p,[])}catch(h){c.e(h)}finally{c.f()}case 8:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"dial",value:function(){var e=p(regeneratorRuntime.mark(function e(r,t){var n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.transportForMultiaddr(r)){e.next=3;break}throw k(new Error("No transport available for address ".concat(String(r))),O.ERR_TRANSPORT_UNAVAILABLE);case 3:return e.prev=3,e.next=6,n.dial(r,t);case 6:return e.abrupt("return",e.sent);case 9:throw e.prev=9,e.t0=e.catch(3),e.t0.code||(e.t0.code=O.ERR_TRANSPORT_DIAL_FAILED),e.t0;case 13:case"end":return e.stop()}},e,this,[[3,9]])}));return function(r,t){return e.apply(this,arguments)}}()},{key:"getAddrs",value:function(){var r,t=[],n=u(this._listeners.values());try{for(n.s();!(r=n.n()).done;){var a,i=u(r.value);try{for(i.s();!(a=i.n()).done;){var o=a.value;t=[].concat(e(t),e(o.getAddrs()))}}catch(s){i.e(s)}finally{i.f()}}}catch(s){n.e(s)}finally{n.f()}return t}},{key:"getTransports",value:function(){return this._transports.values()}},{key:"transportForMultiaddr",value:function(e){var r,t=u(this._transports.values());try{for(t.s();!(r=t.n()).done;){var n=r.value;if(n.filter([e]).length)return n}}catch(a){t.e(a)}finally{t.f()}return null}},{key:"listen",value:function(){var e=p(regeneratorRuntime.mark(function e(r){var t,n,i,o,s,l,c,f,p,h,v,d,y,b,m=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r&&0!==r.length){e.next=3;break}return w("no addresses were provided for listening, this node is dial only"),e.abrupt("return");case 3:t=[],n=u(this._transports.entries()),e.prev=5,n.s();case 7:if((i=n.n()).done){e.next=24;break}o=a(i.value,2),s=o[0],l=o[1],c=l.filter(r),f=[],p=u(c);try{for(p.s();!(h=p.n()).done;)v=h.value,w("creating listener for %s on %s",s,v),d=l.createListener(this._listenerOptions.get(s)),this._listeners.get(s).push(d),d.on("listening",function(){return x(m.libp2p)}),d.on("close",function(){return x(m.libp2p)}),f.push(d.listen(v))}catch(g){p.e(g)}finally{p.f()}if(0!==f.length){e.next=16;break}return t.push(s),e.abrupt("continue",22);case 16:return e.next=18,A(f);case 18:if(y=e.sent,y.find(function(e){return!0===e.isFulfilled})||this.faultTolerance===E.NO_FATAL){e.next=22;break}throw k(new Error("Transport (".concat(s,") could not listen on any available address")),O.ERR_NO_VALID_ADDRESSES);case 22:e.next=7;break;case 24:e.next=29;break;case 26:e.prev=26,e.t0=e.catch(5),n.e(e.t0);case 29:return e.prev=29,n.f(),e.finish(29);case 32:if(t.length!==this._transports.size){e.next=37;break}if(b="no valid addresses were provided for transports [".concat(t,"]"),this.faultTolerance!==E.FATAL_ALL){e.next=36;break}throw k(new Error(b),O.ERR_NO_VALID_ADDRESSES);case 36:w("libp2p in dial mode only: ".concat(b));case 37:case"end":return e.stop()}},e,this,[[5,26,29,32]])}));return function(r){return e.apply(this,arguments)}}()},{key:"remove",value:function(){var e=p(regeneratorRuntime.mark(function e(r){var t,n,a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(w("removing %s",r),!this._listeners.has(r)){e.next=21;break}t=u(this._listeners.get(r)),e.prev=3,t.s();case 5:if((n=t.n()).done){e.next=13;break}return(a=n.value).removeAllListeners("listening"),a.removeAllListeners("close"),e.next=11,a.close();case 11:e.next=5;break;case 13:e.next=18;break;case 15:e.prev=15,e.t0=e.catch(3),t.e(e.t0);case 18:return e.prev=18,t.f(),e.finish(18);case 21:this._transports.delete(r),this._listeners.delete(r);case 23:case"end":return e.stop()}},e,this,[[3,15,18,21]])}));return function(r){return e.apply(this,arguments)}}()},{key:"removeAll",value:function(){var e=p(regeneratorRuntime.mark(function e(){var r,t,n,a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:r=[],t=u(this._transports.keys());try{for(t.s();!(n=t.n()).done;)a=n.value,r.push(this.remove(a))}catch(i){t.e(i)}finally{t.f()}return e.next=5,Promise.all(r);case 5:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}]),r}(),E={FATAL_ALL:0,NO_FATAL:1};S.FaultTolerance=E,module.exports=S;
|
||
},{"debug":"F8gk","p-settle":"oUeo","./errors":"YLhd","err-code":"hLMW","./record/utils":"926m"}],"9pyy":[function(require,module,exports) {
|
||
"use strict";var e=require("merge-options"),r=require("multiaddr/src/resolvers"),n=r.dnsaddrResolver,t=require("./constants"),a=require("./identify/consts"),s=a.AGENT_VERSION,o=require("./circuit/constants"),l=require("libp2p-utils/src/address-sort"),i=l.publicAddressesFirst,d=require("./transport-manager"),u=d.FaultTolerance,c={addresses:{listen:[],announce:[],noAnnounce:[],announceFilter:function(e){return e}},connectionManager:{minConnections:25},transportManager:{faultTolerance:u.FATAL_ALL},dialer:{maxParallelDials:t.MAX_PARALLEL_DIALS,maxDialsPerPeer:t.MAX_PER_PEER_DIALS,dialTimeout:t.DIAL_TIMEOUT,resolvers:{dnsaddr:n},addressSorter:i},host:{agentVersion:s},metrics:{enabled:!1},peerStore:{persistence:!1,threshold:5},peerRouting:{refreshManager:{enabled:!0,interval:6e5,bootDelay:1e4}},config:{dht:{enabled:!1,kBucketSize:20,randomWalk:{enabled:!1,queriesPerPeriod:1,interval:3e5,timeout:1e4}},nat:{enabled:!0,ttl:7200,keepAlive:!0,gateway:null,externalIp:null,pmp:{enabled:!1}},peerDiscovery:{autoDial:!0},pubsub:{enabled:!0},relay:{enabled:!0,advertise:{bootDelay:o.ADVERTISE_BOOT_DELAY,enabled:!1,ttl:o.ADVERTISE_TTL},hop:{enabled:!1,active:!1},autoRelay:{enabled:!1,maxListeners:2}},transport:{}}};module.exports.validate=function(r){var n=e(c,r);if(n.modules.transport.length<1)throw new Error("'options.modules.transport' must contain at least 1 transport");return n};
|
||
},{"merge-options":"/OBv","multiaddr/src/resolvers":"rEhL","./constants":"yxTM","./identify/consts":"erSH","./circuit/constants":"qD4Y","libp2p-utils/src/address-sort":"MtMt","./transport-manager":"O6+p"}],"etnB":[function(require,module,exports) {
|
||
"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function r(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&u(e,t)}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e){var t=a();return function(){var n,r=s(e);if(t){var o=s(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return c(this,n)}}function c(t,n){return!n||"object"!==e(n)&&"function"!=typeof n?f(t):n}function f(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function a(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var l=require("events"),p=require("multiaddr"),d=p.Multiaddr,y=require("peer-id"),b=function(e){o(u,l);var n=i(u);function u(e){var r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=o.listen,c=void 0===i?[]:i,f=o.announce,a=void 0===f?[]:f;return t(this,u),(r=n.call(this)).peerId=e,r.listen=new Set(c.map(function(e){return e.toString()})),r.announce=new Set(a.map(function(e){return e.toString()})),r.observed=new Set,r}return r(u,[{key:"getListenAddrs",value:function(){return Array.from(this.listen).map(function(e){return new d(e)})}},{key:"getAnnounceAddrs",value:function(){return Array.from(this.announce).map(function(e){return new d(e)})}},{key:"getObservedAddrs",value:function(){return Array.from(this.observed).map(function(e){return new d(e)})}},{key:"addObservedAddr",value:function(e){var t=new d(e),n=t.getPeerId();n&&(y.createFromB58String(n).equals(this.peerId)&&(t=t.decapsulate(new d("/p2p/".concat(this.peerId)))));var r=t.toString();this.observed.has(r)||(this.observed.add(r),this.emit("change:addresses"))}}]),u}();module.exports=b;
|
||
},{"events":"wIHY","multiaddr":"fVn4","peer-id":"jAbp"}],"mLJb":[function(require,module,exports) {
|
||
"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function n(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}function r(e,t){return(r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(e){var t=a();return function(){var i,n=d(e);if(t){var o=d(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return c(this,i)}}function c(t,i){return!i||"object"!==e(i)&&"function"!=typeof i?s(t):i}function s(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function a(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var l=require("events"),f=require("debug")("latency-monitor:VisibilityChangeEmitter"),y=function(e){o(r,l);var i=u(r);function r(){var e;return t(this,r),e=i.call(this),"undefined"==typeof document?(f('This is not a browser, no "document" found. Stopping.'),c(e)):(e._initializeVisibilityVarNames(),e._addVisibilityChangeListener(),e)}return n(r,[{key:"_initializeVisibilityVarNames",value:function(){var e,t;void 0!==document.hidden?(e="hidden",t="visibilitychange"):void 0!==document.mozHidden?(e="mozHidden",t="mozvisibilitychange"):void 0!==document.msHidden?(e="msHidden",t="msvisibilitychange"):void 0!==document.webkitHidden&&(e="webkitHidden",t="webkitvisibilitychange"),this._hidden=e,this._visibilityChange=t}},{key:"_addVisibilityChangeListener",value:function(){void 0===document.addEventListener||void 0===document[this._hidden]?f("Checking page visibility requires a browser that supports the Page Visibility API."):document.addEventListener(this._visibilityChange,this._handleVisibilityChange.bind(this),!1)}},{key:"isVisible",value:function(){if(void 0!==this._hidden&&void 0!==document[this._hidden])return!document[this._hidden]}},{key:"_handleVisibilityChange",value:function(){var e=!document[this._hidden];f(e?"Page Visible":"Page Hidden"),this.emit("visibilityChange",e)}}]),r}();module.exports=y;
|
||
},{"events":"wIHY","debug":"F8gk"}],"8Js9":[function(require,module,exports) {
|
||
"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t,e){for(var n=0;n<e.length;n++){var a=e[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}function a(t,e,a){return e&&n(t.prototype,e),a&&n(t,a),t}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&r(t,e)}function r(t,e){return(r=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function c(t){var e=l();return function(){var n,a=u(t);if(e){var i=u(this).constructor;n=Reflect.construct(a,arguments,i)}else n=a.apply(this,arguments);return o(this,n)}}function o(e,n){return!n||"object"!==t(n)&&"function"!=typeof n?s(e):n}function s(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function l(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var y=require("events"),f=require("./visibility-change-emitter"),m=require("debug")("latency-monitor:LatencyMonitor"),h=function(t){i(r,y);var n=c(r);function r(){var t,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=a.latencyCheckIntervalMs,c=a.dataEmitIntervalMs,o=a.asyncTestFn,l=a.latencyRandomPercentage;e(this,r);var u=s(t=n.call(this));return u.latencyCheckIntervalMs=i||500,u.latencyRandomPercentage=l||10,u._latecyCheckMultiply=u.latencyRandomPercentage/100*2*u.latencyCheckIntervalMs,u._latecyCheckSubtract=u._latecyCheckMultiply/2,u.dataEmitIntervalMs=null===c||0===c?void 0:c||5e3,m("latencyCheckIntervalMs: %s dataEmitIntervalMs: %s",u.latencyCheckIntervalMs,u.dataEmitIntervalMs),u.dataEmitIntervalMs?m("Expecting ~%s events per summary",u.latencyCheckIntervalMs/u.dataEmitIntervalMs):m("Not emitting summaries"),u.asyncTestFn=o,globalThis.process&&globalThis.process.hrtime?(m("Using process.hrtime for timing"),u.now=globalThis.process.hrtime,u.getDeltaMS=function(t){var e=u.now(t);return 1e3*e[0]+e[1]/1e6}):"undefined"!=typeof window&&window.performance&&window.performance.now?(m("Using performance.now for timing"),u.now=window.performance.now.bind(window.performance),u.getDeltaMS=function(t){return Math.round(u.now()-t)}):(m("Using Date.now for timing"),u.now=Date.now,u.getDeltaMS=function(t){return u.now()-t}),u._latencyData=u._initLatencyData(),v()&&(u._visibilityChangeEmitter=new f,u._visibilityChangeEmitter.on("visibilityChange",function(t){t?u._startTimers():(u._emitSummary(),u._stopTimers())})),u._visibilityChangeEmitter&&!u._visibilityChangeEmitter.isVisible()||u._startTimers(),t}return a(r,[{key:"_startTimers",value:function(){var t=this;this._checkLatencyID||(this._checkLatency(),this.dataEmitIntervalMs&&(this._emitIntervalID=setInterval(function(){return t._emitSummary()},this.dataEmitIntervalMs),"function"==typeof this._emitIntervalID.unref&&this._emitIntervalID.unref()))}},{key:"_stopTimers",value:function(){this._checkLatencyID&&(clearTimeout(this._checkLatencyID),this._checkLatencyID=void 0),this._emitIntervalID&&(clearInterval(this._emitIntervalID),this._emitIntervalID=void 0)}},{key:"_emitSummary",value:function(){var t=this.getSummary();t.events>0&&this.emit("data",t)}},{key:"getSummary",value:function(){var t={events:this._latencyData.events,minMs:this._latencyData.minMs,maxMs:this._latencyData.maxMs,avgMs:this._latencyData.events?this._latencyData.totalMs/this._latencyData.events:Number.POSITIVE_INFINITY,lengthMs:this.getDeltaMS(this._latencyData.startTime)};return this._latencyData=this._initLatencyData(),m("Summary: %O",t),t}},{key:"_checkLatency",value:function(){var t=this,e=this,n=Math.random()*e._latecyCheckMultiply-e._latecyCheckSubtract,a={deltaOffset:Math.ceil(e.latencyCheckIntervalMs+n),startTime:e.now()},i=function(){if(t._checkLatencyID){var n=e.getDeltaMS(a.startTime)-a.deltaOffset;e._checkLatency(),e._latencyData.events++,e._latencyData.minMs=Math.min(e._latencyData.minMs,n),e._latencyData.maxMs=Math.max(e._latencyData.maxMs,n),e._latencyData.totalMs+=n,m("MS: %s Data: %O",n,e._latencyData)}};m("localData: %O",a),this._checkLatencyID=setTimeout(function(){e.asyncTestFn?(a.deltaOffset=0,a.startTime=e.now(),e.asyncTestFn(i)):(a.deltaOffset-=1,i())},a.deltaOffset),"function"==typeof this._checkLatencyID.unref&&this._checkLatencyID.unref()}},{key:"_initLatencyData",value:function(){return{startTime:this.now(),minMs:Number.POSITIVE_INFINITY,maxMs:Number.NEGATIVE_INFINITY,events:0,totalMs:0}}}]),r}();function v(){return"undefined"!=typeof window}module.exports=h;
|
||
},{"events":"wIHY","./visibility-change-emitter":"mLJb","debug":"F8gk"}],"5cSk":[function(require,module,exports) {
|
||
"use strict";module.exports=function(){return Date.now()};
|
||
},{}],"yhqo":[function(require,module,exports) {
|
||
"use strict";const e=require("./time");class t{constructor(t,s,r){const i=this;this._started=e(),this._rescheduled=0,this._scheduled=s,this._args=r,this._triggered=!1,this._timerWrapper=(()=>{i._rescheduled>0?(i._scheduled=i._rescheduled-(e()-i._started),i._schedule(i._scheduled)):(i._triggered=!0,t.apply(null,i._args))}),this._timer=setTimeout(this._timerWrapper,s)}reschedule(t){t||(t=this._scheduled);const s=e();s+t-(this._started+this._scheduled)<0?(clearTimeout(this._timer),this._schedule(t)):this._triggered?this._schedule(t):(this._started=s,this._rescheduled=t)}_schedule(t){this._triggered=!1,this._started=e(),this._rescheduled=0,this._scheduled=t,this._timer=setTimeout(this._timerWrapper,t)}clear(){clearTimeout(this._timer)}}function s(){if("function"!=typeof arguments[0])throw new Error("callback needed");if("number"!=typeof arguments[1])throw new Error("timeout needed");let e;if(arguments.length>0){e=new Array(arguments.length-2);for(var s=0;s<e.length;s++)e[s]=arguments[s+2]}return new t(arguments[0],arguments[1],e)}module.exports=s;
|
||
},{"./time":"5cSk"}],"aFuP":[function(require,module,exports) {
|
||
"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e){return o(e)||r(e)||a(e)||n()}function n(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function r(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function o(e){if(Array.isArray(e))return s(e)}function i(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=a(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,c=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return s=e.done,e},e:function(e){c=!0,i=e},f:function(){try{s||null==n.return||n.return()}finally{if(c)throw i}}}}function a(e,t){if(e){if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function c(e,t,n,r,o,i,a){try{var s=e[i](a),c=s.value}catch(u){return void n(u)}s.done?t(c):Promise.resolve(c).then(r,o)}function u(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){c(i,r,o,a,s,"next",e)}function s(e){c(i,r,o,a,s,"throw",e)}a(void 0)})}}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function p(e,t,n){return t&&f(e.prototype,t),n&&f(e,n),e}function h(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&v(e,t)}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function m(e){var t=_();return function(){var n,r=b(e);if(t){var o=b(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return y(this,n)}}function y(t,n){return!n||"object"!==e(n)&&"function"!=typeof n?d(t):n}function d(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var g=require("debug"),k=Object.assign(g("libp2p:connection-manager"),{error:g("libp2p:connection-manager:err")}),x=require("err-code"),w=require("merge-options"),S=require("./latency-monitor"),M=require("retimer"),I=require("events"),D=require("peer-id"),A=require("../errors"),P=A.codes.ERR_INVALID_PARAMETERS,R={maxConnections:1/0,minConnections:0,maxData:1/0,maxSentData:1/0,maxReceivedData:1/0,maxEventLoopDelay:1/0,pollInterval:2e3,autoDialInterval:1e4,movingAverageInterval:6e4,defaultPeerValue:1},O=function(e){h(r,I);var n=m(r);function r(e){var t,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(l(this,r),(t=n.call(this))._libp2p=e,t._peerId=e.peerId.toB58String(),t._options=w.call({ignoreUndefined:!0},R,o),t._options.maxConnections<t._options.minConnections)throw x(new Error("Connection Manager maxConnections must be greater than minConnections"),P);return k("options: %j",t._options),t._peerValues=new Map,t.connections=new Map,t._started=!1,t._timer=null,t._autoDialTimeout=null,t._checkMetrics=t._checkMetrics.bind(d(t)),t._autoDial=t._autoDial.bind(d(t)),t}return p(r,[{key:"size",get:function(){return Array.from(this.connections.values()).reduce(function(e,t){return e+t.length},0)}},{key:"start",value:function(){this._libp2p.metrics&&(this._timer=this._timer||M(this._checkMetrics,this._options.pollInterval)),this._latencyMonitor=new S({latencyCheckIntervalMs:this._options.pollInterval,dataEmitIntervalMs:this._options.pollInterval}),this._onLatencyMeasure=this._onLatencyMeasure.bind(this),this._latencyMonitor.on("data",this._onLatencyMeasure),this._started=!0,k("started"),this._options.autoDial&&this._autoDial()}},{key:"stop",value:function(){var e=u(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this._autoDialTimeout&&this._autoDialTimeout.clear(),this._timer&&this._timer.clear(),this._latencyMonitor&&this._latencyMonitor.removeListener("data",this._onLatencyMeasure),this._started=!1,e.next=6,this._close();case 6:k("stopped");case 7:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"_close",value:function(){var e=u(regeneratorRuntime.mark(function e(){var t,n,r,o,a,s,c;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=[],n=i(this.connections.values());try{for(n.s();!(r=n.n()).done;){o=r.value,a=i(o);try{for(a.s();!(s=a.n()).done;)c=s.value,t.push(c.close())}catch(u){a.e(u)}finally{a.f()}}}catch(u){n.e(u)}finally{n.f()}return e.next=5,Promise.all(t);case 5:this.connections.clear();case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"setPeerValue",value:function(e,t){if(t<0||t>1)throw new Error("value should be a number between 0 and 1");this._peerValues.set(e.toB58String(),t)}},{key:"_checkMetrics",value:function(){if(this._libp2p.metrics){var e=this._libp2p.metrics.global.movingAverages,t=e.dataReceived[this._options.movingAverageInterval].movingAverage();this._checkMaxLimit("maxReceivedData",t);var n=e.dataSent[this._options.movingAverageInterval].movingAverage();this._checkMaxLimit("maxSentData",n);var r=t+n;this._checkMaxLimit("maxData",r),k("metrics update",r),this._timer=M(this._checkMetrics,this._options.pollInterval)}}},{key:"onConnect",value:function(e){var t=e.remotePeer,n=t.toB58String(),r=this.connections.get(n);this.emit("peer:connect",e),r?r.push(e):this.connections.set(n,[e]),this._libp2p.peerStore.keyBook.set(t,t.pubKey),this._peerValues.has(n)||this._peerValues.set(n,this._options.defaultPeerValue),this._checkMaxLimit("maxConnections",this.size)}},{key:"onDisconnect",value:function(e){var t=e.remotePeer.toB58String(),n=this.connections.get(t);n&&n.length>1?(n=n.filter(function(t){return t.id!==e.id}),this.connections.set(t,n)):n&&(this.connections.delete(t),this._peerValues.delete(e.remotePeer.toB58String()),this.emit("peer:disconnect",e))}},{key:"get",value:function(e){var t=this.getAll(e);return t.length?t[0]:null}},{key:"getAll",value:function(e){if(!D.isPeerId(e))throw x(new Error("peerId must be an instance of peer-id"),P);var t=e.toB58String(),n=this.connections.get(t);return n?n.filter(function(e){return"open"===e.stat.status}):[]}},{key:"_onLatencyMeasure",value:function(e){this._checkMaxLimit("maxEventLoopDelay",e.avgMs)}},{key:"_checkMaxLimit",value:function(e,t){var n=this._options[e];k("checking limit of %s. current value: %d of %d",e,t,n),t>n&&(k("%s: limit exceeded: %s, %d",this._peerId,e,t),this._maybeDisconnectOne())}},{key:"_autoDial",value:function(){var e=u(regeneratorRuntime.mark(function e(){var t,n,r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this._options.minConnections,!(this.size>=t)){e.next=4;break}return this._autoDialTimeout=M(this._autoDial,this._options.autoDialInterval),e.abrupt("return");case 4:n=Array.from(this._libp2p.peerStore.peers.values()).sort(function(e,t){return!t.protocols||!t.protocols.length||e.protocols&&e.protocols.length?t.id.pubKey&&!e.id.pubKey?1:-1:1}),r=0;case 6:if(!(r<n.length&&this.size<t)){e.next=22;break}if(this.get(n[r].id)){e.next=19;break}return k("connecting to a peerStore stored peer %s",n[r].id.toB58String()),e.prev=9,e.next=12,this._libp2p.dialer.connectToPeer(n[r].id);case 12:if(this._started){e.next=14;break}return e.abrupt("return");case 14:e.next=19;break;case 16:e.prev=16,e.t0=e.catch(9),k.error("could not connect to peerStore stored peer",e.t0);case 19:r++,e.next=6;break;case 22:this._autoDialTimeout=M(this._autoDial,this._options.autoDialInterval);case 23:case"end":return e.stop()}},e,this,[[9,16]])}));return function(){return e.apply(this,arguments)}}()},{key:"_maybeDisconnectOne",value:function(){if(this._options.minConnections<this.connections.size){var e=Array.from(new Map(t(this._peerValues.entries()).sort(function(e,t){return e[1]-t[1]})));k("%s: sorted peer values: %j",this._peerId,e);var n=e[0];if(n){var r=n[0];k("%s: lowest value peer is %s",this._peerId,r),k("%s: closing a connection to %j",this._peerId,r);var o,a=i(this.connections.values());try{for(a.s();!(o=a.n()).done;){var s=o.value;if(s[0].remotePeer.toB58String()===r){s[0].close();break}}}catch(c){a.e(c)}finally{a.f()}}}}}]),r}();module.exports=O;
|
||
},{"debug":"F8gk","err-code":"hLMW","merge-options":"/OBv","./latency-monitor":"8Js9","retimer":"yhqo","events":"wIHY","peer-id":"jAbp","../errors":"YLhd"}],"uET0":[function(require,module,exports) {
|
||
"use strict";const{Multiaddr:t}=require("multiaddr"),r=C("dns4"),p=C("dns6"),e=C("dnsaddr"),n=N(C("dns"),e,r,p),c=N(C("ip4"),C("ip6")),i=N(y(c,C("tcp")),y(n,C("tcp"))),u=y(c,C("udp")),s=y(u,C("utp")),a=y(u,C("quic")),o=N(y(i,C("ws")),y(n,C("ws"))),l=N(y(i,C("wss")),y(n,C("wss"))),h=N(y(i,C("http")),y(c,C("http")),y(n,C("http"))),d=N(y(i,C("https")),y(c,C("https")),y(n,C("https"))),f=N(y(o,C("p2p-webrtc-star"),C("p2p")),y(l,C("p2p-webrtc-star"),C("p2p")),y(o,C("p2p-webrtc-star")),y(l,C("p2p-webrtc-star"))),b=N(y(o,C("p2p-websocket-star"),C("p2p")),y(l,C("p2p-websocket-star"),C("p2p")),y(o,C("p2p-websocket-star")),y(l,C("p2p-websocket-star"))),w=N(y(h,C("p2p-webrtc-direct"),C("p2p")),y(d,C("p2p-webrtc-direct"),C("p2p")),y(h,C("p2p-webrtc-direct")),y(d,C("p2p-webrtc-direct"))),S=N(o,l,h,d,f,w,i,s,a,n),g=N(y(S,C("p2p-stardust"),C("p2p")),y(S,C("p2p-stardust"))),m=N(y(S,C("p2p")),f,w,C("p2p")),M=N(y(m,C("p2p-circuit"),m),y(m,C("p2p-circuit")),y(C("p2p-circuit"),m),y(S,C("p2p-circuit")),y(C("p2p-circuit"),S),C("p2p-circuit")),P=()=>N(y(M,P),M),D=P(),T=N(y(D,m,D),y(m,D),y(D,m),D,m);function k(r){return function(p){if(!t.isMultiaddr(p))try{p=new t(p)}catch(n){return!1}const e=r(p.protoNames());return null!==e&&(!0===e||!1===e?e:0===e.length)}}function y(...t){function r(r){if(r.length<t.length)return null;let p=r;return t.some(t=>(p="function"==typeof t?t().partialMatch(r):t.partialMatch(r),Array.isArray(p)&&(r=p),null===p)),p}return{toString:function(){return"{ "+t.join(" ")+" }"},input:t,matches:k(r),partialMatch:r}}function N(...t){function r(r){let p=null;return t.some(t=>{const e="function"==typeof t?t().partialMatch(r):t.partialMatch(r);return!!e&&(p=e,!0)}),p}return{toString:function(){return"{ "+t.join(" ")+" }"},input:t,matches:k(r),partialMatch:r}}function C(r){const p=r;return{toString:function(){return p},matches:function(r){if("string"==typeof r)try{r=new t(r)}catch(n){return!1}const e=r.protoNames();return 1===e.length&&e[0]===p},partialMatch:function(t){return 0===t.length?null:t[0]===p?t.slice(1):null}}}module.exports={DNS:n,DNS4:r,DNS6:p,DNSADDR:e,IP:c,TCP:i,UDP:u,QUIC:a,UTP:s,HTTP:h,HTTPS:d,WebSockets:o,WebSocketsSecure:l,WebSocketStar:b,WebRTCStar:f,WebRTCDirect:w,Reliable:S,Stardust:g,Circuit:D,P2P:T,IPFS:T};
|
||
},{"multiaddr":"fVn4"}],"W5A0":[function(require,module,exports) {
|
||
"use strict";function e(r){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(r)}var r=require("protobufjs/minimal"),t=r.Reader,c=r.Writer,a=r.util,s=r.roots.default||(r.roots.default={});s.CircuitRelay=function(){function o(e){if(e)for(var r=Object.keys(e),t=0;t<r.length;++t)null!=e[r[t]]&&(this[r[t]]=e[r[t]])}var d,n;return o.prototype.type=1,o.prototype.srcPeer=null,o.prototype.dstPeer=null,o.prototype.code=100,o.encode=function(e,r){return r||(r=c.create()),null!=e.type&&Object.hasOwnProperty.call(e,"type")&&r.uint32(8).int32(e.type),null!=e.srcPeer&&Object.hasOwnProperty.call(e,"srcPeer")&&s.CircuitRelay.Peer.encode(e.srcPeer,r.uint32(18).fork()).ldelim(),null!=e.dstPeer&&Object.hasOwnProperty.call(e,"dstPeer")&&s.CircuitRelay.Peer.encode(e.dstPeer,r.uint32(26).fork()).ldelim(),null!=e.code&&Object.hasOwnProperty.call(e,"code")&&r.uint32(32).int32(e.code),r},o.decode=function(e,r){e instanceof t||(e=t.create(e));for(var c=void 0===r?e.len:e.pos+r,a=new s.CircuitRelay;e.pos<c;){var o=e.uint32();switch(o>>>3){case 1:a.type=e.int32();break;case 2:a.srcPeer=s.CircuitRelay.Peer.decode(e,e.uint32());break;case 3:a.dstPeer=s.CircuitRelay.Peer.decode(e,e.uint32());break;case 4:a.code=e.int32();break;default:e.skipType(7&o)}}return a},o.fromObject=function(r){if(r instanceof s.CircuitRelay)return r;var t=new s.CircuitRelay;switch(r.type){case"HOP":case 1:t.type=1;break;case"STOP":case 2:t.type=2;break;case"STATUS":case 3:t.type=3;break;case"CAN_HOP":case 4:t.type=4}if(null!=r.srcPeer){if("object"!==e(r.srcPeer))throw TypeError(".CircuitRelay.srcPeer: object expected");t.srcPeer=s.CircuitRelay.Peer.fromObject(r.srcPeer)}if(null!=r.dstPeer){if("object"!==e(r.dstPeer))throw TypeError(".CircuitRelay.dstPeer: object expected");t.dstPeer=s.CircuitRelay.Peer.fromObject(r.dstPeer)}switch(r.code){case"SUCCESS":case 100:t.code=100;break;case"HOP_SRC_ADDR_TOO_LONG":case 220:t.code=220;break;case"HOP_DST_ADDR_TOO_LONG":case 221:t.code=221;break;case"HOP_SRC_MULTIADDR_INVALID":case 250:t.code=250;break;case"HOP_DST_MULTIADDR_INVALID":case 251:t.code=251;break;case"HOP_NO_CONN_TO_DST":case 260:t.code=260;break;case"HOP_CANT_DIAL_DST":case 261:t.code=261;break;case"HOP_CANT_OPEN_DST_STREAM":case 262:t.code=262;break;case"HOP_CANT_SPEAK_RELAY":case 270:t.code=270;break;case"HOP_CANT_RELAY_TO_SELF":case 280:t.code=280;break;case"STOP_SRC_ADDR_TOO_LONG":case 320:t.code=320;break;case"STOP_DST_ADDR_TOO_LONG":case 321:t.code=321;break;case"STOP_SRC_MULTIADDR_INVALID":case 350:t.code=350;break;case"STOP_DST_MULTIADDR_INVALID":case 351:t.code=351;break;case"STOP_RELAY_REFUSED":case 390:t.code=390;break;case"MALFORMED_MESSAGE":case 400:t.code=400}return t},o.toObject=function(e,r){r||(r={});var t={};return r.defaults&&(t.type=r.enums===String?"HOP":1,t.srcPeer=null,t.dstPeer=null,t.code=r.enums===String?"SUCCESS":100),null!=e.type&&e.hasOwnProperty("type")&&(t.type=r.enums===String?s.CircuitRelay.Type[e.type]:e.type),null!=e.srcPeer&&e.hasOwnProperty("srcPeer")&&(t.srcPeer=s.CircuitRelay.Peer.toObject(e.srcPeer,r)),null!=e.dstPeer&&e.hasOwnProperty("dstPeer")&&(t.dstPeer=s.CircuitRelay.Peer.toObject(e.dstPeer,r)),null!=e.code&&e.hasOwnProperty("code")&&(t.code=r.enums===String?s.CircuitRelay.Status[e.code]:e.code),t},o.prototype.toJSON=function(){return this.constructor.toObject(this,r.util.toJSONOptions)},o.Status=(d={},(n=Object.create(d))[d[100]="SUCCESS"]=100,n[d[220]="HOP_SRC_ADDR_TOO_LONG"]=220,n[d[221]="HOP_DST_ADDR_TOO_LONG"]=221,n[d[250]="HOP_SRC_MULTIADDR_INVALID"]=250,n[d[251]="HOP_DST_MULTIADDR_INVALID"]=251,n[d[260]="HOP_NO_CONN_TO_DST"]=260,n[d[261]="HOP_CANT_DIAL_DST"]=261,n[d[262]="HOP_CANT_OPEN_DST_STREAM"]=262,n[d[270]="HOP_CANT_SPEAK_RELAY"]=270,n[d[280]="HOP_CANT_RELAY_TO_SELF"]=280,n[d[320]="STOP_SRC_ADDR_TOO_LONG"]=320,n[d[321]="STOP_DST_ADDR_TOO_LONG"]=321,n[d[350]="STOP_SRC_MULTIADDR_INVALID"]=350,n[d[351]="STOP_DST_MULTIADDR_INVALID"]=351,n[d[390]="STOP_RELAY_REFUSED"]=390,n[d[400]="MALFORMED_MESSAGE"]=400,n),o.Type=function(){var e={},r=Object.create(e);return r[e[1]="HOP"]=1,r[e[2]="STOP"]=2,r[e[3]="STATUS"]=3,r[e[4]="CAN_HOP"]=4,r}(),o.Peer=function(){function e(e){if(this.addrs=[],e)for(var r=Object.keys(e),t=0;t<r.length;++t)null!=e[r[t]]&&(this[r[t]]=e[r[t]])}return e.prototype.id=a.newBuffer([]),e.prototype.addrs=a.emptyArray,e.encode=function(e,r){if(r||(r=c.create()),r.uint32(10).bytes(e.id),null!=e.addrs&&e.addrs.length)for(var t=0;t<e.addrs.length;++t)r.uint32(18).bytes(e.addrs[t]);return r},e.decode=function(e,r){e instanceof t||(e=t.create(e));for(var c=void 0===r?e.len:e.pos+r,o=new s.CircuitRelay.Peer;e.pos<c;){var d=e.uint32();switch(d>>>3){case 1:o.id=e.bytes();break;case 2:o.addrs&&o.addrs.length||(o.addrs=[]),o.addrs.push(e.bytes());break;default:e.skipType(7&d)}}if(!o.hasOwnProperty("id"))throw a.ProtocolError("missing required 'id'",{instance:o});return o},e.fromObject=function(e){if(e instanceof s.CircuitRelay.Peer)return e;var r=new s.CircuitRelay.Peer;if(null!=e.id&&("string"==typeof e.id?a.base64.decode(e.id,r.id=a.newBuffer(a.base64.length(e.id)),0):e.id.length&&(r.id=e.id)),e.addrs){if(!Array.isArray(e.addrs))throw TypeError(".CircuitRelay.Peer.addrs: array expected");r.addrs=[];for(var t=0;t<e.addrs.length;++t)"string"==typeof e.addrs[t]?a.base64.decode(e.addrs[t],r.addrs[t]=a.newBuffer(a.base64.length(e.addrs[t])),0):e.addrs[t].length&&(r.addrs[t]=e.addrs[t])}return r},e.toObject=function(e,r){r||(r={});var t={};if((r.arrays||r.defaults)&&(t.addrs=[]),r.defaults&&(r.bytes===String?t.id="":(t.id=[],r.bytes!==Array&&(t.id=a.newBuffer(t.id)))),null!=e.id&&e.hasOwnProperty("id")&&(t.id=r.bytes===String?a.base64.encode(e.id,0,e.id.length):r.bytes===Array?Array.prototype.slice.call(e.id):e.id),e.addrs&&e.addrs.length){t.addrs=[];for(var c=0;c<e.addrs.length;++c)t.addrs[c]=r.bytes===String?a.base64.encode(e.addrs[c],0,e.addrs[c].length):r.bytes===Array?Array.prototype.slice.call(e.addrs[c]):e.addrs[c]}return t},e.prototype.toJSON=function(){return this.constructor.toObject(this,r.util.toJSONOptions)},e}(),o}(),module.exports=s;
|
||
},{"protobufjs/minimal":"78bh"}],"b5QV":[function(require,module,exports) {
|
||
module.exports=function(t){if(t){if("function"==typeof t[Symbol.iterator])return t[Symbol.iterator]();if("function"==typeof t[Symbol.asyncIterator])return t[Symbol.asyncIterator]();if("function"==typeof t.next)return t}throw new Error("argument is not an iterator or iterable")};
|
||
},{}],"uy6m":[function(require,module,exports) {
|
||
module.exports=class extends Error{constructor(e,o){super(e||"The operation was aborted"),this.type="aborted",this.code=o||"ABORT_ERR"}};
|
||
},{}],"iTY4":[function(require,module,exports) {
|
||
const o=require("get-iterator"),r=require("./AbortError"),t=(o,r,t)=>e(o,Array.isArray(r)?r:[{signal:r,options:t}]),e=(t,e)=>{return t=o(t),e=e.map(({signal:o,options:r})=>({signal:o,options:r||{}})),async function*(){let o;const n=()=>{o&&o()};for(const{signal:r}of e)r.addEventListener("abort",n);for(;;){let i;try{for(const{signal:o,options:t}of e)if(o.aborted){const{abortMessage:o,abortCode:e}=t;throw new r(o,e)}const a=new Promise((t,n)=>{o=(()=>{const{options:o}=e.find(({signal:o})=>o.aborted),{abortMessage:t,abortCode:s}=o;n(new r(t,s))})});i=await Promise.race([a,t.next()]),o=null}catch(s){for(const{signal:t}of e)t.removeEventListener("abort",n);const o=e.find(({signal:o})=>o.aborted),r="aborted"===s.type&&o;if(r&&o.options.onAbort&&await o.options.onAbort(t),"function"==typeof t.return&&await t.return(),r&&o.options.returnOnAbort)return;throw s}if(i.done)break;yield i.value}for(const{signal:r}of e)r.removeEventListener("abort",n)}()},n=(o,r,t)=>s(o,Array.isArray(r)?r:[{signal:r,options:t}]),s=(o,r)=>t=>o(e(t,r)),i=(o,r,t)=>a(o,Array.isArray(r)?r:[{signal:r,options:t}]),a=(o,r)=>({sink:s(o.sink,r),source:e(o.source,r)});module.exports=t,module.exports.AbortError=r,module.exports.source=t,module.exports.sink=n,module.exports.transform=n,module.exports.duplex=i;
|
||
},{"get-iterator":"b5QV","./AbortError":"uy6m"}],"vOrb":[function(require,module,exports) {
|
||
"use strict";const{source:e}=require("abortable-iterator"),r=require("debug"),o=r("libp2p:stream:converter");function t({stream:r,remoteAddr:t,localAddr:n},i={}){const{sink:s,source:a}=r,c={async sink(r){i.signal&&(r=e(r,i.signal));try{await s(r)}catch(t){"aborted"!==t.type&&o(t)}l()},source:i.signal?e(a,i.signal):a,conn:r,localAddr:n,remoteAddr:t,timeline:{open:Date.now(),close:void 0},close:()=>(s(new Uint8Array(0)),l())};function l(){return c.timeline.close||(c.timeline.close=Date.now()),Promise.resolve()}return c}module.exports=t;
|
||
},{"abortable-iterator":"iTY4","debug":"F8gk"}],"grQ/":[function(require,module,exports) {
|
||
"use strict";module.exports={relay:"/libp2p/circuit/relay/0.1.0"};
|
||
},{}],"ZqIL":[function(require,module,exports) {
|
||
"use strict";function t(t,n){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=e(t))||n&&t&&"number"==typeof t.length){r&&(t=r);var o=0,i=function(){};return{s:i,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var u,a=!0,c=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){c=!0,u=t},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw u}}}}function e(t,e){if(t){if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function r(t,e,n,r,o,i,u){try{var a=t[i](u),c=a.value}catch(l){return void n(l)}a.done?e(c):Promise.resolve(c).then(r,o)}function o(t){return function(){var e=this,n=arguments;return new Promise(function(o,i){var u=t.apply(e,n);function a(t){r(u,o,i,a,c,"next",t)}function c(t){r(u,o,i,a,c,"throw",t)}a(void 0)})}}var i=require("events"),u=i.EventEmitter,a=require("multiaddr"),c=a.Multiaddr;module.exports=function(e){var n=new Map;function r(){return(r=o(regeneratorRuntime.mark(function t(r){var o,u,a;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return o=String(r).split("/p2p-circuit").find(function(t){return""!==t}),t.next=3,e.dial(new c(o));case 3:u=t.sent,a=u.remoteAddr.encapsulate("/p2p-circuit"),n.set(u.remotePeer.toB58String(),a),i.emit("listening");case 7:case"end":return t.stop()}},t)}))).apply(this,arguments)}var i=Object.assign(new u,{close:function(){return Promise.resolve()},listen:function(t){return r.apply(this,arguments)},getAddrs:function(){var e,r=[],o=t(n.values());try{for(o.s();!(e=o.n()).done;){var i=e.value;r.push(i)}}catch(u){o.e(u)}finally{o.f()}return r}});return e.connectionManager.on("peer:disconnect",function(t){n.delete(t.remotePeer.toB58String())&&i.emit("close")}),i};
|
||
},{"events":"wIHY","multiaddr":"fVn4"}],"h/Rt":[function(require,module,exports) {
|
||
"use strict";var r=require("multiaddr"),t=r.Multiaddr,e=require("../protocol"),d=e.CircuitRelay;function a(r,t){r.write({type:d.Type.STATUS,code:t})}function s(r,e){try{r.dstPeer&&r.dstPeer.addrs&&r.dstPeer.addrs.forEach(function(r){return new t(r)})}catch(s){throw a(e,r.type===d.Type.HOP?d.Status.HOP_DST_MULTIADDR_INVALID:d.Status.STOP_DST_MULTIADDR_INVALID),s}try{r.srcPeer&&r.srcPeer.addrs&&r.srcPeer.addrs.forEach(function(r){return new t(r)})}catch(s){throw a(e,r.type===d.Type.HOP?d.Status.HOP_SRC_MULTIADDR_INVALID:d.Status.STOP_SRC_MULTIADDR_INVALID),s}}module.exports={validateAddrs:s};
|
||
},{"multiaddr":"fVn4","../protocol":"W5A0"}],"s5uv":[function(require,module,exports) {
|
||
|
||
"use strict";const{Buffer:t}=require("buffer"),e=Symbol.for("BufferList");function n(t){if(!(this instanceof n))return new n(t);n._init.call(this,t)}n._init=function(t){Object.defineProperty(this,e,{value:!0}),this._bufs=[],this.length=0,t&&this.append(t)},n.prototype._new=function(t){return new n(t)},n.prototype._offset=function(t){if(0===t)return[0,0];let e=0;for(let n=0;n<this._bufs.length;n++){const s=e+this._bufs[n].length;if(t<s||n===this._bufs.length-1)return[n,t-e];e=s}},n.prototype._reverseOffset=function(t){const e=t[0];let n=t[1];for(let s=0;s<e;s++)n+=this._bufs[s].length;return n},n.prototype.get=function(t){if(t>this.length||t<0)return;const e=this._offset(t);return this._bufs[e[0]][e[1]]},n.prototype.slice=function(t,e){return"number"==typeof t&&t<0&&(t+=this.length),"number"==typeof e&&e<0&&(e+=this.length),this.copy(null,0,t,e)},n.prototype.copy=function(e,n,s,r){if(("number"!=typeof s||s<0)&&(s=0),("number"!=typeof r||r>this.length)&&(r=this.length),s>=this.length)return e||t.alloc(0);if(r<=0)return e||t.alloc(0);const i=!!e,f=this._offset(s),h=r-s;let u=h,o=i&&n||0,l=f[1];if(0===s&&r===this.length){if(!i)return 1===this._bufs.length?this._bufs[0]:t.concat(this._bufs,this.length);for(let t=0;t<this._bufs.length;t++)this._bufs[t].copy(e,o),o+=this._bufs[t].length;return e}if(u<=this._bufs[f[0]].length-l)return i?this._bufs[f[0]].copy(e,n,l,l+u):this._bufs[f[0]].slice(l,l+u);i||(e=t.allocUnsafe(h));for(let t=f[0];t<this._bufs.length;t++){const n=this._bufs[t].length-l;if(!(u>n)){this._bufs[t].copy(e,o,l,l+u),o+=n;break}this._bufs[t].copy(e,o,l),o+=n,u-=n,l&&(l=0)}return e.length>o?e.slice(0,o):e},n.prototype.shallowSlice=function(t,e){if(t=t||0,e="number"!=typeof e?this.length:e,t<0&&(t+=this.length),e<0&&(e+=this.length),t===e)return this._new();const n=this._offset(t),s=this._offset(e),r=this._bufs.slice(n[0],s[0]+1);return 0===s[1]?r.pop():r[r.length-1]=r[r.length-1].slice(0,s[1]),0!==n[1]&&(r[0]=r[0].slice(n[1])),this._new(r)},n.prototype.toString=function(t,e,n){return this.slice(e,n).toString(t)},n.prototype.consume=function(t){if(t=Math.trunc(t),Number.isNaN(t)||t<=0)return this;for(;this._bufs.length;){if(!(t>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(t),this.length-=t;break}t-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},n.prototype.duplicate=function(){const t=this._new();for(let e=0;e<this._bufs.length;e++)t.append(this._bufs[e]);return t},n.prototype.append=function(e){if(null==e)return this;if(e.buffer)this._appendBuffer(t.from(e.buffer,e.byteOffset,e.byteLength));else if(Array.isArray(e))for(let t=0;t<e.length;t++)this.append(e[t]);else if(this._isBufferList(e))for(let t=0;t<e._bufs.length;t++)this.append(e._bufs[t]);else"number"==typeof e&&(e=e.toString()),this._appendBuffer(t.from(e));return this},n.prototype._appendBuffer=function(t){this._bufs.push(t),this.length+=t.length},n.prototype.indexOf=function(e,n,s){if(void 0===s&&"string"==typeof n&&(s=n,n=void 0),"function"==typeof e||Array.isArray(e))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if("number"==typeof e?e=t.from([e]):"string"==typeof e?e=t.from(e,s):this._isBufferList(e)?e=e.slice():Array.isArray(e.buffer)?e=t.from(e.buffer,e.byteOffset,e.byteLength):t.isBuffer(e)||(e=t.from(e)),n=Number(n||0),isNaN(n)&&(n=0),n<0&&(n=this.length+n),n<0&&(n=0),0===e.length)return n>this.length?this.length:n;const r=this._offset(n);let i=r[0],f=r[1];for(;i<this._bufs.length;i++){const t=this._bufs[i];for(;f<t.length;){if(t.length-f>=e.length){const n=t.indexOf(e,f);if(-1!==n)return this._reverseOffset([i,n]);f=t.length-e.length+1}else{const t=this._reverseOffset([i,f]);if(this._match(t,e))return t;f++}}f=0}return-1},n.prototype._match=function(t,e){if(this.length-t<e.length)return!1;for(let n=0;n<e.length;n++)if(this.get(t+n)!==e[n])return!1;return!0},function(){const t={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(const e in t)!function(e){n.prototype[e]=null===t[e]?function(t,n){return this.slice(t,t+n)[e](0,n)}:function(n=0){return this.slice(n,n+t[e])[e](0)}}(e)}(),n.prototype._isBufferList=function(t){return t instanceof n||n.isBufferList(t)},n.isBufferList=function(t){return null!=t&&t[e]},module.exports=n;
|
||
},{"buffer":"z1tx"}],"JN/e":[function(require,module,exports) {
|
||
|
||
"use strict";const e=require("varint"),{Buffer:r}=require("buffer"),t=(o,s,u)=>{const n=e.encode(o,s,u);return t.bytes=e.encode.bytes,s||r.from(n)};module.exports=t;
|
||
},{"varint":"pAlk","buffer":"z1tx"}],"FipB":[function(require,module,exports) {
|
||
|
||
"use strict";const{Buffer:e}=require("buffer"),n=require("bl/BufferList"),t=require("./varint-encode"),o=8,r=10240;function l(l){l=l||{};const s=Math.max(l.poolSize||r,l.minPoolSize||o),c=l.lengthEncoder||t;return async function*(t){let r=e.alloc(s),l=0;for await(const i of t){c(i.length,r,l);const t=r.slice(l,l+c.bytes);l+=c.bytes,r.length-l<o&&(r=e.alloc(s),l=0),yield(new n).append(t).append(i)}}}l.single=((e,o)=>{const r=(o=o||{}).lengthEncoder||t;return new n([r(e.length),e.slice()])}),module.exports=l,module.exports.MIN_POOL_SIZE=o,module.exports.DEFAULT_POOL_SIZE=r;
|
||
},{"buffer":"z1tx","bl/BufferList":"s5uv","./varint-encode":"JN/e"}],"yGSp":[function(require,module,exports) {
|
||
|
||
"use strict";const e=require("varint"),{Buffer:r}=require("buffer"),t=e=>new Proxy({},{get:(r,t)=>"l"===t[0]?e[t]:e.get(parseInt(t))}),s=u=>{const o=e.decode(r.isBuffer(u)?u:t(u));return s.bytes=e.decode.bytes,o};module.exports=s;
|
||
},{"varint":"pAlk","buffer":"z1tx"}],"xhLT":[function(require,module,exports) {
|
||
|
||
"use strict";const{Buffer:e}=require("buffer"),t=require("bl/BufferList"),n=require("./varint-decode"),a=8,o=4194304,r=e.alloc(0),d={LENGTH:"readLength",DATA:"readData"},h={[d.LENGTH]:(e,n,a,o)=>{let h;n=n.append(e);try{h=o.lengthDecoder(n)}catch(c){if(n.length>o.maxLengthLength)throw Object.assign(c,{message:"message length too long",code:"ERR_MSG_LENGTH_TOO_LONG"});if(c instanceof RangeError)return{mode:d.LENGTH,buffer:n,chunk:void 0,state:void 0,data:void 0};throw c}if(h>o.maxDataLength)throw Object.assign(new Error("message data too long"),{code:"ERR_MSG_DATA_TOO_LONG"});return e=n.shallowSlice(o.lengthDecoder.bytes),n=new t,o.onLength&&o.onLength(h),h<=0?(o.onData&&o.onData(r),{mode:d.LENGTH,chunk:e,buffer:n,data:r}):{mode:d.DATA,chunk:e,buffer:n,state:{dataLength:h},data:void 0}},[d.DATA]:(e,n,a,o)=>{if(n=n.append(e),!a)throw new Error("state is required");if(n.length<a.dataLength)return{mode:d.DATA,buffer:n,state:a,chunk:void 0,data:void 0};const{dataLength:r}=a,h=n.shallowSlice(0,r),c=n.length>r?n.shallowSlice(r):void 0;return n=new t,o.onData&&o.onData(h),{mode:d.LENGTH,chunk:c,buffer:n,state:void 0,data:h}}};function c(e){const r={lengthDecoder:(e=e||{}).lengthDecoder||n,maxLengthLength:e.maxLengthLength||a,maxDataLength:e.maxDataLength||o,onLength:e.onLength,onData:e.onData};return async function*(e){let n,a=new t,o=d.LENGTH;for await(const t of e){let e=t;for(;e;){const t=h[o](e,a,n,r);o=t.mode,e=t.chunk,a=t.buffer,n=t.state,t.data&&(yield t.data)}}if(a.length)throw Object.assign(new Error("unexpected end of input"),{code:"ERR_UNEXPECTED_EOF"})}}c.fromReader=((e,t)=>{let n=1;const a={[Symbol.asyncIterator](){return this},next:async()=>{try{return await e.next(n)}catch(t){if("ERR_UNDER_READ"===t.code)return{done:!0,value:null};throw t}finally{n=1}}};return c({...t||{},onLength:e=>{n=e}})(a)}),module.exports=c,module.exports.MAX_LENGTH_LENGTH=a,module.exports.MAX_DATA_LENGTH=o;
|
||
},{"buffer":"z1tx","bl/BufferList":"s5uv","./varint-decode":"yGSp"}],"mO86":[function(require,module,exports) {
|
||
|
||
"use strict";const{Buffer:e}=require("buffer"),r=(r,t,s)=>((t=t||e.allocUnsafe(4)).writeInt32BE(r,s),t);r.bytes=4,module.exports=r;
|
||
},{"buffer":"z1tx"}],"zbl+":[function(require,module,exports) {
|
||
"use strict";const t=t=>{if(t.length<4)throw RangeError("Could not decode int32BE");return t.readInt32BE(0)};t.bytes=4,module.exports=t;
|
||
},{}],"5Mnk":[function(require,module,exports) {
|
||
"use strict";exports.encode=require("./encode"),exports.decode=require("./decode"),exports.varintEncode=require("./varint-encode"),exports.varintDecode=require("./varint-decode"),exports.int32BEEncode=require("./int32BE-encode"),exports.int32BEDecode=require("./int32BE-decode");
|
||
},{"./encode":"FipB","./decode":"xhLT","./varint-encode":"JN/e","./varint-decode":"yGSp","./int32BE-encode":"mO86","./int32BE-decode":"zbl+"}],"nMSu":[function(require,module,exports) {
|
||
const e=require("bl/BufferList");module.exports=(n=>{const t=async function*(){let t=yield,o=new e;for await(const r of n)if(t)for(o.append(r);o.length>=t;){const n=o.shallowSlice(0,t);if(o.consume(t),!(t=yield n)){o.length&&(t=yield o,o=new e);break}}else t=yield o.append(r),o=new e;if(t)throw Object.assign(new Error(`stream ended before ${t} bytes became available`),{code:"ERR_UNDER_READ",buffer:o})}();return t.next(),t});
|
||
},{"bl/BufferList":"s5uv"}],"LOw6":[function(require,module,exports) {
|
||
"use strict";var e=function(){var e={};return e.promise=new Promise(function(r,o){e.resolve=r,e.reject=o}),e};module.exports=e;
|
||
},{}],"rfs3":[function(require,module,exports) {
|
||
"use strict";const e=require("it-reader"),r=require("it-pushable"),t=require("p-defer");module.exports=(s=>{const i=r(),a=e(s.source),c=t();let n;const o=s.sink(async function*(){yield*i;const e=await c.promise;yield*e}());return o.catch(e=>{n=e}),{reader:a,writer:i,stream:{sink:e=>n?Promise.reject(n):(c.resolve(e),o),source:a},rest:()=>i.end(),write:i.push,read:async()=>(await a.next()).value}});
|
||
},{"it-reader":"nMSu","it-pushable":"Qva5","p-defer":"LOw6"}],"EX5g":[function(require,module,exports) {
|
||
"use strict";function e(e,r,t,n,i,a,s){try{var o=e[a](s),u=o.value}catch(c){return void t(c)}o.done?r(u):Promise.resolve(u).then(n,i)}function r(r){return function(){var t=this,n=arguments;return new Promise(function(i,a){var s=r.apply(t,n);function o(r){e(s,i,a,o,u,"next",r)}function u(r){e(s,i,a,o,u,"throw",r)}o(void 0)})}}function t(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function n(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function i(e,r,t){return r&&n(e.prototype,r),t&&n(e,t),e}var a=require("debug"),s=Object.assign(a("libp2p:circuit:stream-handler"),{error:a("libp2p:circuit:stream-handler:err")}),o=require("it-length-prefixed"),u=require("it-handshake"),c=require("../protocol"),h=c.CircuitRelay,l=function(){function e(r){var n=r.stream,i=r.maxLength,a=void 0===i?4096:i;t(this,e),this.stream=n,this.shake=u(this.stream),this.decoder=o.decode.fromReader(this.shake.reader,{maxDataLength:a})}return i(e,[{key:"read",value:function(){var e=r(regeneratorRuntime.mark(function e(){var r,t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.decoder.next();case 2:if(!(r=e.sent).value){e.next=7;break}return t=h.decode(r.value.slice()),s("read message type",t.type),e.abrupt("return",t);case 7:s("read received no value, closing stream"),this.close();case 9:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"write",value:function(e){s("write message type %s",e.type),this.shake.write(o.encode.single(h.encode(e).finish()))}},{key:"rest",value:function(){return this.shake.rest(),this.shake.stream}},{key:"end",value:function(e){this.write(e),this.close()}},{key:"close",value:function(){s("closing the stream"),this.rest().sink([])}}]),e}();module.exports=l;
|
||
},{"debug":"F8gk","it-length-prefixed":"5Mnk","it-handshake":"rfs3","../protocol":"W5A0"}],"WMpQ":[function(require,module,exports) {
|
||
"use strict";function e(e,r,t,n,o,s,u){try{var i=e[s](u),a=i.value}catch(c){return void t(c)}i.done?r(a):Promise.resolve(a).then(n,o)}function r(r){return function(){var t=this,n=arguments;return new Promise(function(o,s){var u=r.apply(t,n);function i(r){e(u,o,s,i,a,"next",r)}function a(r){e(u,o,s,i,a,"throw",r)}i(void 0)})}}var t=require("debug"),n=Object.assign(t("libp2p:circuit:stop"),{error:t("libp2p:circuit:stop:err")}),o=require("../protocol"),s=o.CircuitRelay,u=require("../multicodec"),i=require("./stream-handler"),a=require("./utils"),c=a.validateAddrs;module.exports.handleStop=function(e){var r=e.connection,t=e.request,o=e.streamHandler;try{c(t,o)}catch(u){return n.error("invalid stop request via peer %s",r.remotePeer.toB58String(),u)}return n("stop request is valid"),o.write({type:s.Type.STATUS,code:s.Status.SUCCESS}),o.rest()},module.exports.stop=function(){var e=r(regeneratorRuntime.mark(function e(r){var t,o,a,c,p,d;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.connection,o=r.request,e.next=3,t.newStream([u.relay]);case 3:return a=e.sent,c=a.stream,n("starting stop request to %s",t.remotePeer.toB58String()),(p=new i({stream:c})).write(o),e.next=10,p.read();case 10:if(d=e.sent){e.next=13;break}return e.abrupt("return",p.close());case 13:if(d.code!==s.Status.SUCCESS){e.next=16;break}return n("stop request to %s was successful",t.remotePeer.toB58String()),e.abrupt("return",p.rest());case 16:n("stop request failed with code %d",d.code),p.close();case 18:case"end":return e.stop()}},e)}));return function(r){return e.apply(this,arguments)}}();
|
||
},{"debug":"F8gk","../protocol":"W5A0","../multicodec":"grQ/","./stream-handler":"EX5g","./utils":"h/Rt"}],"56vt":[function(require,module,exports) {
|
||
"use strict";function e(e,r,t,n,a,u,o){try{var s=e[u](o),c=s.value}catch(i){return void t(i)}s.done?r(c):Promise.resolve(c).then(n,a)}function r(r){return function(){var t=this,n=arguments;return new Promise(function(a,u){var o=r.apply(t,n);function s(r){e(o,a,u,s,c,"next",r)}function c(r){e(o,a,u,s,c,"throw",r)}s(void 0)})}}var t=require("debug"),n=Object.assign(t("libp2p:circuit:hop"),{error:t("libp2p:circuit:hop:err")}),a=require("err-code"),u=require("peer-id"),o=require("./utils"),s=o.validateAddrs,c=require("./stream-handler"),i=require("../protocol"),p=i.CircuitRelay,d=require("it-pipe"),S=d.pipe,l=require("../../errors"),h=l.codes,f=require("./stop"),b=f.stop,m=require("./../multicodec");function v(e){return w.apply(this,arguments)}function w(){return(w=r(regeneratorRuntime.mark(function e(r){var t,a,o,c,i,d,l,h,f;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=r.connection,a=r.request,o=r.streamHandler,(c=r.circuit)._options.hop.enabled){e.next=4;break}return n("HOP request received but we are not acting as a relay"),e.abrupt("return",o.end({type:p.Type.STATUS,code:p.Status.HOP_CANT_SPEAK_RELAY}));case 4:e.prev=4,s(a,o),e.next=11;break;case 8:return e.prev=8,e.t0=e.catch(4),e.abrupt("return",n.error("invalid hop request via peer %s",t.remotePeer.toB58String(),e.t0));case 11:if(a.dstPeer){e.next=14;break}return n("HOP request received but we do not receive a dstPeer"),e.abrupt("return");case 14:if(i=new u(a.dstPeer.id),(d=c._connectionManager.get(i))||c._options.hop.active){e.next=19;break}return n("HOP request received but we are not connected to the destination peer"),e.abrupt("return",o.end({type:p.Type.STATUS,code:p.Status.HOP_NO_CONN_TO_DST}));case 19:if(d){e.next=21;break}return e.abrupt("return");case 21:return l={type:p.Type.STOP,dstPeer:a.dstPeer,srcPeer:a.srcPeer},e.prev=22,e.next=25,b({connection:d,request:l});case 25:h=e.sent,e.next=31;break;case 28:return e.prev=28,e.t1=e.catch(22),e.abrupt("return",n.error(e.t1));case 31:return n("hop request from %s is valid",t.remotePeer.toB58String()),o.write({type:p.Type.STATUS,code:p.Status.SUCCESS}),f=o.rest(),e.abrupt("return",S(f,h,f));case 35:case"end":return e.stop()}},e,null,[[4,8],[22,28]])}))).apply(this,arguments)}function P(e){return y.apply(this,arguments)}function y(){return(y=r(regeneratorRuntime.mark(function e(r){var t,u,o,s,i,d;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.connection,u=r.request,e.next=3,t.newStream([m.relay]);case 3:return o=e.sent,s=o.stream,(i=new c({stream:s})).write(u),e.next=9,i.read();case 9:if(d=e.sent){e.next=12;break}throw a(new Error("HOP request had no response"),h.ERR_HOP_REQUEST_FAILED);case 12:if(d.code!==p.Status.SUCCESS){e.next=15;break}return n("hop request was successful"),e.abrupt("return",i.rest());case 15:throw n("hop request failed with code %d, closing stream",d.code),i.close(),a(new Error("HOP request failed with code ".concat(d.code)),h.ERR_HOP_REQUEST_FAILED);case 18:case"end":return e.stop()}},e)}))).apply(this,arguments)}function q(e){return T.apply(this,arguments)}function T(){return(T=r(regeneratorRuntime.mark(function e(r){var t,n,a,u,o;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.connection,e.next=3,t.newStream([m.relay]);case 3:return n=e.sent,a=n.stream,(u=new c({stream:a})).write({type:p.Type.CAN_HOP}),e.next=9,u.read();case 9:return o=e.sent,e.next=12,u.close();case 12:if(o&&o.code===p.Status.SUCCESS){e.next=14;break}return e.abrupt("return",!1);case 14:return e.abrupt("return",!0);case 15:case"end":return e.stop()}},e)}))).apply(this,arguments)}function _(e){var r=e.connection,t=e.streamHandler,a=e.circuit._options.hop.enabled;n("can hop (%s) request from %s",a,r.remotePeer.toB58String()),t.end({type:p.Type.STATUS,code:a?p.Status.SUCCESS:p.Status.HOP_CANT_SPEAK_RELAY})}module.exports={handleHop:v,hop:P,canHop:q,handleCanHop:_};
|
||
},{"debug":"F8gk","err-code":"hLMW","peer-id":"jAbp","./utils":"h/Rt","./stream-handler":"EX5g","../protocol":"W5A0","it-pipe":"p27M","../../errors":"YLhd","./stop":"WMpQ","./../multicodec":"grQ/"}],"0n6B":[function(require,module,exports) {
|
||
"use strict";function e(e,r,t,n,i,a,o){try{var c=e[a](o),u=c.value}catch(s){return void t(s)}c.done?r(u):Promise.resolve(u).then(n,i)}function r(r){return function(){var t=this,n=arguments;return new Promise(function(i,a){var o=r.apply(t,n);function c(r){e(o,i,a,c,u,"next",r)}function u(r){e(o,i,a,c,u,"throw",r)}c(void 0)})}}function t(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function n(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function i(e,r,t){return r&&n(e.prototype,r),t&&n(e,t),e}var a=require("debug"),o=Object.assign(a("libp2p:circuit"),{error:a("libp2p:circuit:err")}),c=require("err-code"),u=require("mafmt"),s=require("multiaddr"),d=s.Multiaddr,p=require("peer-id"),l=require("./protocol"),f=l.CircuitRelay,h=require("../errors"),m=h.codes,b=require("libp2p-utils/src/stream-to-ma-conn"),y=require("./multicodec"),g=y.relay,v=require("./listener"),P=require("./circuit/hop"),q=P.handleCanHop,w=P.handleHop,_=P.hop,k=require("./circuit/stop"),x=k.handleStop,A=require("./circuit/stream-handler"),C=Symbol.for("@libp2p/js-libp2p-circuit/circuit"),H=function(){function e(r){var n=r.libp2p,i=r.upgrader;t(this,e),this._dialer=n.dialer,this._registrar=n.registrar,this._connectionManager=n.connectionManager,this._upgrader=i,this._options=n._config.relay,this._libp2p=n,this.peerId=n.peerId,this._registrar.handle(g,this._onProtocol.bind(this))}return i(e,[{key:"_onProtocol",value:function(){var e=r(regeneratorRuntime.mark(function e(r){var t,n,i,a,c,u,s,p,l,h,m;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.connection,n=r.stream,i=new A({stream:n}),e.next=4,i.read();case 4:if(a=e.sent){e.next=7;break}return e.abrupt("return");case 7:c=this,e.t0=a.type,e.next=e.t0===f.Type.CAN_HOP?11:e.t0===f.Type.HOP?15:e.t0===f.Type.STOP?20:25;break;case 11:return o("received CAN_HOP request from %s",t.remotePeer.toB58String()),e.next=14,q({circuit:c,connection:t,streamHandler:i});case 14:return e.abrupt("break",26);case 15:return o("received HOP request from %s",t.remotePeer.toB58String()),e.next=18,w({connection:t,request:a,streamHandler:i,circuit:c});case 18:return u=e.sent,e.abrupt("break",26);case 20:return o("received STOP request from %s",t.remotePeer.toB58String()),e.next=23,x({connection:t,request:a,streamHandler:i});case 23:return u=e.sent,e.abrupt("break",26);case 25:o("Request of type %s not supported",a.type);case 26:if(!u){e.next=37;break}return s=new d(a.dstPeer.addrs[0]),p=new d(a.srcPeer.addrs[0]),l=b({stream:u,remoteAddr:s,localAddr:p}),h=a.type===f.Type.HOP?"relay":"inbound",o("new %s connection %s",h,l.remoteAddr),e.next=34,this._upgrader.upgradeInbound(l);case 34:m=e.sent,o("%s connection %s upgraded",h,l.remoteAddr),this.handler&&this.handler(m);case 37:case"end":return e.stop()}},e,this)}));return function(r){return e.apply(this,arguments)}}()},{key:"dial",value:function(){var e=r(regeneratorRuntime.mark(function e(r,t){var n,i,a,u,s,l,h,y,g,v,P,q,w;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=r.toString().split("/p2p-circuit"),i=new d(n[0]),a=new d(n[n.length-1]),u=i.getPeerId(),s=a.getPeerId(),u&&s){e.next=9;break}throw l="Circuit relay dial failed as addresses did not have peer id",o.error(l),c(new Error(l),m.ERR_RELAYED_DIAL);case 9:if(h=p.createFromCID(u),y=p.createFromCID(s),g=!1,v=this._connectionManager.get(h)){e.next=18;break}return e.next=16,this._dialer.connectToPeer(i,t);case 16:v=e.sent,g=!0;case 18:return e.prev=18,e.next=21,_({connection:v,request:{type:f.Type.HOP,srcPeer:{id:this.peerId.toBytes(),addrs:this._libp2p.multiaddrs.map(function(e){return e.bytes})},dstPeer:{id:y.toBytes(),addrs:[new d(a).bytes]}}});case 21:return P=e.sent,q=i.encapsulate("/p2p-circuit/p2p/".concat(this.peerId.toB58String())),w=b({stream:P,remoteAddr:r,localAddr:q}),o("new outbound connection %s",w.remoteAddr),e.abrupt("return",this._upgrader.upgradeOutbound(w));case 28:if(e.prev=28,e.t0=e.catch(18),o.error("Circuit relay dial failed",e.t0),e.t1=g,!e.t1){e.next=35;break}return e.next=35,v.close();case 35:throw e.t0;case 36:case"end":return e.stop()}},e,this,[[18,28]])}));return function(r,t){return e.apply(this,arguments)}}()},{key:"createListener",value:function(e,r){return"function"==typeof e&&(r=e,e={}),this.handler=r,v(this._libp2p)}},{key:"filter",value:function(e){return(e=Array.isArray(e)?e:[e]).filter(function(e){return u.Circuit.matches(e)})}},{key:Symbol.toStringTag,get:function(){return"Circuit"}}],[{key:"isTransport",value:function(e){return Boolean(e&&e[C])}}]),e}();module.exports=H;
|
||
},{"debug":"F8gk","err-code":"hLMW","mafmt":"uET0","multiaddr":"fVn4","peer-id":"jAbp","./protocol":"W5A0","../errors":"YLhd","libp2p-utils/src/stream-to-ma-conn":"vOrb","./multicodec":"grQ/","./listener":"ZqIL","./circuit/hop":"56vt","./circuit/stop":"WMpQ","./circuit/stream-handler":"EX5g"}],"ktMt":[function(require,module,exports) {
|
||
var process = require("process");
|
||
var global = arguments[3];
|
||
var define;
|
||
var t,r=require("process"),e=arguments[3];!function(){"use strict";var n="input is invalid type",i="object"==typeof window,o=i?window:{};o.JS_SHA3_NO_WINDOW&&(i=!1);var a=!i&&"object"==typeof self;!o.JS_SHA3_NO_NODE_JS&&"object"==typeof r&&r.versions&&r.versions.node?o=e:a&&(o=self);var s=!o.JS_SHA3_NO_COMMON_JS&&"object"==typeof module&&module.exports,u="function"==typeof t&&t.amd,f=!o.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,h="0123456789abcdef".split(""),c=[4,1024,262144,67108864],p=[0,8,16,24],d=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],l=[224,256,384,512],y=[128,256],b=["hex","buffer","arrayBuffer","array","digest"],A={128:168,256:136};!o.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!f||!o.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});for(var v=function(t,r,e){return function(n){return new J(t,r,t).update(n)[e]()}},w=function(t,r,e){return function(n,i){return new J(t,r,i).update(n)[e]()}},B=function(t,r,e){return function(r,n,i,o){return C["cshake"+t].update(r,n,i,o)[e]()}},g=function(t,r,e){return function(r,n,i,o){return C["kmac"+t].update(r,n,i,o)[e]()}},_=function(t,r,e,n){for(var i=0;i<b.length;++i){var o=b[i];t[o]=r(e,n,o)}return t},k=function(t,r){var e=v(t,r,"hex");return e.create=function(){return new J(t,r,t)},e.update=function(t){return e.create().update(t)},_(e,v,t,r)},S=[{name:"keccak",padding:[1,256,65536,16777216],bits:l,createMethod:k},{name:"sha3",padding:[6,1536,393216,100663296],bits:l,createMethod:k},{name:"shake",padding:[31,7936,2031616,520093696],bits:y,createMethod:function(t,r){var e=w(t,r,"hex");return e.create=function(e){return new J(t,r,e)},e.update=function(t,r){return e.create(r).update(t)},_(e,w,t,r)}},{name:"cshake",padding:c,bits:y,createMethod:function(t,r){var e=A[t],n=B(t,0,"hex");return n.create=function(n,i,o){return i||o?new J(t,r,n).bytepad([i,o],e):C["shake"+t].create(n)},n.update=function(t,r,e,i){return n.create(r,e,i).update(t)},_(n,B,t,r)}},{name:"kmac",padding:c,bits:y,createMethod:function(t,r){var e=A[t],n=g(t,0,"hex");return n.create=function(n,i,o){return new M(t,r,i).bytepad(["KMAC",o],e).bytepad([n],e)},n.update=function(t,r,e,i){return n.create(t,e,i).update(r)},_(n,g,t,r)}}],C={},m=[],x=0;x<S.length;++x)for(var E=S[x],O=E.bits,z=0;z<O.length;++z){var N=E.name+"_"+O[z];if(m.push(N),C[N]=E.createMethod(O[z],E.padding),"sha3"!==E.name){var j=E.name+O[z];m.push(j),C[j]=C[N]}}function J(t,r,e){this.blocks=[],this.s=[],this.padding=r,this.outputBits=e,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(t<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=e>>5,this.extraBytes=(31&e)>>3;for(var n=0;n<50;++n)this.s[n]=0}function M(t,r,e){J.call(this,t,r,e)}J.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var r,e=typeof t;if("string"!==e){if("object"!==e)throw new Error(n);if(null===t)throw new Error(n);if(f&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||f&&ArrayBuffer.isView(t)))throw new Error(n);r=!0}for(var i,o,a=this.blocks,s=this.byteCount,u=t.length,h=this.blockCount,c=0,d=this.s;c<u;){if(this.reset)for(this.reset=!1,a[0]=this.block,i=1;i<h+1;++i)a[i]=0;if(r)for(i=this.start;c<u&&i<s;++c)a[i>>2]|=t[c]<<p[3&i++];else for(i=this.start;c<u&&i<s;++c)(o=t.charCodeAt(c))<128?a[i>>2]|=o<<p[3&i++]:o<2048?(a[i>>2]|=(192|o>>6)<<p[3&i++],a[i>>2]|=(128|63&o)<<p[3&i++]):o<55296||o>=57344?(a[i>>2]|=(224|o>>12)<<p[3&i++],a[i>>2]|=(128|o>>6&63)<<p[3&i++],a[i>>2]|=(128|63&o)<<p[3&i++]):(o=65536+((1023&o)<<10|1023&t.charCodeAt(++c)),a[i>>2]|=(240|o>>18)<<p[3&i++],a[i>>2]|=(128|o>>12&63)<<p[3&i++],a[i>>2]|=(128|o>>6&63)<<p[3&i++],a[i>>2]|=(128|63&o)<<p[3&i++]);if(this.lastByteIndex=i,i>=s){for(this.start=i-s,this.block=a[h],i=0;i<h;++i)d[i]^=a[i];H(d),this.reset=!0}else this.start=i}return this},J.prototype.encode=function(t,r){var e=255&t,n=1,i=[e];for(e=255&(t>>=8);e>0;)i.unshift(e),e=255&(t>>=8),++n;return r?i.push(n):i.unshift(n),this.update(i),i.length},J.prototype.encodeString=function(t){var r,e=typeof t;if("string"!==e){if("object"!==e)throw new Error(n);if(null===t)throw new Error(n);if(f&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||f&&ArrayBuffer.isView(t)))throw new Error(n);r=!0}var i=0,o=t.length;if(r)i=o;else for(var a=0;a<t.length;++a){var s=t.charCodeAt(a);s<128?i+=1:s<2048?i+=2:s<55296||s>=57344?i+=3:(s=65536+((1023&s)<<10|1023&t.charCodeAt(++a)),i+=4)}return i+=this.encode(8*i),this.update(t),i},J.prototype.bytepad=function(t,r){for(var e=this.encode(r),n=0;n<t.length;++n)e+=this.encodeString(t[n]);var i=r-e%r,o=[];return o.length=i,this.update(o),this},J.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,r=this.lastByteIndex,e=this.blockCount,n=this.s;if(t[r>>2]|=this.padding[3&r],this.lastByteIndex===this.byteCount)for(t[0]=t[e],r=1;r<e+1;++r)t[r]=0;for(t[e-1]|=2147483648,r=0;r<e;++r)n[r]^=t[r];H(n)}},J.prototype.toString=J.prototype.hex=function(){this.finalize();for(var t,r=this.blockCount,e=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,a=0,s="";a<n;){for(o=0;o<r&&a<n;++o,++a)t=e[o],s+=h[t>>4&15]+h[15&t]+h[t>>12&15]+h[t>>8&15]+h[t>>20&15]+h[t>>16&15]+h[t>>28&15]+h[t>>24&15];a%r==0&&(H(e),o=0)}return i&&(t=e[o],s+=h[t>>4&15]+h[15&t],i>1&&(s+=h[t>>12&15]+h[t>>8&15]),i>2&&(s+=h[t>>20&15]+h[t>>16&15])),s},J.prototype.arrayBuffer=function(){this.finalize();var t,r=this.blockCount,e=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;t=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(s);for(var u=new Uint32Array(t);a<n;){for(o=0;o<r&&a<n;++o,++a)u[a]=e[o];a%r==0&&H(e)}return i&&(u[o]=e[o],t=t.slice(0,s)),t},J.prototype.buffer=J.prototype.arrayBuffer,J.prototype.digest=J.prototype.array=function(){this.finalize();for(var t,r,e=this.blockCount,n=this.s,i=this.outputBlocks,o=this.extraBytes,a=0,s=0,u=[];s<i;){for(a=0;a<e&&s<i;++a,++s)t=s<<2,r=n[a],u[t]=255&r,u[t+1]=r>>8&255,u[t+2]=r>>16&255,u[t+3]=r>>24&255;s%e==0&&H(n)}return o&&(t=s<<2,r=n[a],u[t]=255&r,o>1&&(u[t+1]=r>>8&255),o>2&&(u[t+2]=r>>16&255)),u},M.prototype=new J,M.prototype.finalize=function(){return this.encode(this.outputBits,!0),J.prototype.finalize.call(this)};var H=function(t){var r,e,n,i,o,a,s,u,f,h,c,p,l,y,b,A,v,w,B,g,_,k,S,C,m,x,E,O,z,N,j,J,M,H,I,R,U,V,F,D,W,Y,q,K,G,L,P,Q,T,X,Z,$,tt,rt,et,nt,it,ot,at,st,ut,ft,ht;for(n=0;n<48;n+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],a=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],u=t[4]^t[14]^t[24]^t[34]^t[44],f=t[5]^t[15]^t[25]^t[35]^t[45],h=t[6]^t[16]^t[26]^t[36]^t[46],c=t[7]^t[17]^t[27]^t[37]^t[47],r=(p=t[8]^t[18]^t[28]^t[38]^t[48])^(a<<1|s>>>31),e=(l=t[9]^t[19]^t[29]^t[39]^t[49])^(s<<1|a>>>31),t[0]^=r,t[1]^=e,t[10]^=r,t[11]^=e,t[20]^=r,t[21]^=e,t[30]^=r,t[31]^=e,t[40]^=r,t[41]^=e,r=i^(u<<1|f>>>31),e=o^(f<<1|u>>>31),t[2]^=r,t[3]^=e,t[12]^=r,t[13]^=e,t[22]^=r,t[23]^=e,t[32]^=r,t[33]^=e,t[42]^=r,t[43]^=e,r=a^(h<<1|c>>>31),e=s^(c<<1|h>>>31),t[4]^=r,t[5]^=e,t[14]^=r,t[15]^=e,t[24]^=r,t[25]^=e,t[34]^=r,t[35]^=e,t[44]^=r,t[45]^=e,r=u^(p<<1|l>>>31),e=f^(l<<1|p>>>31),t[6]^=r,t[7]^=e,t[16]^=r,t[17]^=e,t[26]^=r,t[27]^=e,t[36]^=r,t[37]^=e,t[46]^=r,t[47]^=e,r=h^(i<<1|o>>>31),e=c^(o<<1|i>>>31),t[8]^=r,t[9]^=e,t[18]^=r,t[19]^=e,t[28]^=r,t[29]^=e,t[38]^=r,t[39]^=e,t[48]^=r,t[49]^=e,y=t[0],b=t[1],L=t[11]<<4|t[10]>>>28,P=t[10]<<4|t[11]>>>28,O=t[20]<<3|t[21]>>>29,z=t[21]<<3|t[20]>>>29,st=t[31]<<9|t[30]>>>23,ut=t[30]<<9|t[31]>>>23,Y=t[40]<<18|t[41]>>>14,q=t[41]<<18|t[40]>>>14,H=t[2]<<1|t[3]>>>31,I=t[3]<<1|t[2]>>>31,A=t[13]<<12|t[12]>>>20,v=t[12]<<12|t[13]>>>20,Q=t[22]<<10|t[23]>>>22,T=t[23]<<10|t[22]>>>22,N=t[33]<<13|t[32]>>>19,j=t[32]<<13|t[33]>>>19,ft=t[42]<<2|t[43]>>>30,ht=t[43]<<2|t[42]>>>30,rt=t[5]<<30|t[4]>>>2,et=t[4]<<30|t[5]>>>2,R=t[14]<<6|t[15]>>>26,U=t[15]<<6|t[14]>>>26,w=t[25]<<11|t[24]>>>21,B=t[24]<<11|t[25]>>>21,X=t[34]<<15|t[35]>>>17,Z=t[35]<<15|t[34]>>>17,J=t[45]<<29|t[44]>>>3,M=t[44]<<29|t[45]>>>3,C=t[6]<<28|t[7]>>>4,m=t[7]<<28|t[6]>>>4,nt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,V=t[26]<<25|t[27]>>>7,F=t[27]<<25|t[26]>>>7,g=t[36]<<21|t[37]>>>11,_=t[37]<<21|t[36]>>>11,$=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,K=t[8]<<27|t[9]>>>5,G=t[9]<<27|t[8]>>>5,x=t[18]<<20|t[19]>>>12,E=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,at=t[28]<<7|t[29]>>>25,D=t[38]<<8|t[39]>>>24,W=t[39]<<8|t[38]>>>24,k=t[48]<<14|t[49]>>>18,S=t[49]<<14|t[48]>>>18,t[0]=y^~A&w,t[1]=b^~v&B,t[10]=C^~x&O,t[11]=m^~E&z,t[20]=H^~R&V,t[21]=I^~U&F,t[30]=K^~L&Q,t[31]=G^~P&T,t[40]=rt^~nt&ot,t[41]=et^~it&at,t[2]=A^~w&g,t[3]=v^~B&_,t[12]=x^~O&N,t[13]=E^~z&j,t[22]=R^~V&D,t[23]=U^~F&W,t[32]=L^~Q&X,t[33]=P^~T&Z,t[42]=nt^~ot&st,t[43]=it^~at&ut,t[4]=w^~g&k,t[5]=B^~_&S,t[14]=O^~N&J,t[15]=z^~j&M,t[24]=V^~D&Y,t[25]=F^~W&q,t[34]=Q^~X&$,t[35]=T^~Z&tt,t[44]=ot^~st&ft,t[45]=at^~ut&ht,t[6]=g^~k&y,t[7]=_^~S&b,t[16]=N^~J&C,t[17]=j^~M&m,t[26]=D^~Y&H,t[27]=W^~q&I,t[36]=X^~$&K,t[37]=Z^~tt&G,t[46]=st^~ft&rt,t[47]=ut^~ht&et,t[8]=k^~y&A,t[9]=S^~b&v,t[18]=J^~C&x,t[19]=M^~m&E,t[28]=Y^~H&R,t[29]=q^~I&U,t[38]=$^~K&L,t[39]=tt^~G&P,t[48]=ft^~rt&nt,t[49]=ht^~et&it,t[0]^=d[n],t[1]^=d[n+1]};if(s)module.exports=C;else{for(x=0;x<m.length;++x)o[m[x]]=C[m[x]];u&&t(function(){return C})}}();
|
||
},{"process":"g5I+"}],"NQhh":[function(require,module,exports) {
|
||
var define;
|
||
var e;!function(n,t){"use strict";var r={version:"3.0.0",x86:{},x64:{},inputValidation:!0};function i(e){if(!Array.isArray(e)&&!ArrayBuffer.isView(e))return!1;for(var n=0;n<e.length;n++)if(!Number.isInteger(e[n])||e[n]<0||e[n]>255)return!1;return!0}function s(e,n){return(65535&e)*n+(((e>>>16)*n&65535)<<16)}function c(e,n){return e<<n|e>>>32-n}function a(e){return e=s(e^=e>>>16,2246822507),e=s(e^=e>>>13,3266489909),e^=e>>>16}function u(e,n){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],n=[n[0]>>>16,65535&n[0],n[1]>>>16,65535&n[1]];var t=[0,0,0,0];return t[3]+=e[3]+n[3],t[2]+=t[3]>>>16,t[3]&=65535,t[2]+=e[2]+n[2],t[1]+=t[2]>>>16,t[2]&=65535,t[1]+=e[1]+n[1],t[0]+=t[1]>>>16,t[1]&=65535,t[0]+=e[0]+n[0],t[0]&=65535,[t[0]<<16|t[1],t[2]<<16|t[3]]}function o(e,n){e=[e[0]>>>16,65535&e[0],e[1]>>>16,65535&e[1]],n=[n[0]>>>16,65535&n[0],n[1]>>>16,65535&n[1]];var t=[0,0,0,0];return t[3]+=e[3]*n[3],t[2]+=t[3]>>>16,t[3]&=65535,t[2]+=e[2]*n[3],t[1]+=t[2]>>>16,t[2]&=65535,t[2]+=e[3]*n[2],t[1]+=t[2]>>>16,t[2]&=65535,t[1]+=e[1]*n[3],t[0]+=t[1]>>>16,t[1]&=65535,t[1]+=e[2]*n[2],t[0]+=t[1]>>>16,t[1]&=65535,t[1]+=e[3]*n[1],t[0]+=t[1]>>>16,t[1]&=65535,t[0]+=e[0]*n[3]+e[1]*n[2]+e[2]*n[1]+e[3]*n[0],t[0]&=65535,[t[0]<<16|t[1],t[2]<<16|t[3]]}function f(e,n){return 32===(n%=64)?[e[1],e[0]]:n<32?[e[0]<<n|e[1]>>>32-n,e[1]<<n|e[0]>>>32-n]:(n-=32,[e[1]<<n|e[0]>>>32-n,e[0]<<n|e[1]>>>32-n])}function h(e,n){return 0===(n%=64)?e:n<32?[e[0]<<n|e[1]>>>32-n,e[1]<<n]:[e[1]<<n-32,0]}function l(e,n){return[e[0]^n[0],e[1]^n[1]]}function g(e){return e=l(e,[0,e[0]>>>1]),e=l(e=o(e,[4283543511,3981806797]),[0,e[0]>>>1]),e=l(e=o(e,[3301882366,444984403]),[0,e[0]>>>1])}r.x86.hash32=function(e,n){if(!r.inputValidation||i(e)){n=n||0;for(var t=e.length%4,u=e.length-t,o=n,f=0,h=3432918353,l=461845907,g=0;g<u;g+=4)f=s(f=e[g]|e[g+1]<<8|e[g+2]<<16|e[g+3]<<24,h),f=s(f=c(f,15),l),o=s(o=c(o^=f,13),5)+3864292196;switch(f=0,t){case 3:f^=e[g+2]<<16;case 2:f^=e[g+1]<<8;case 1:f=s(f^=e[g],h),o^=f=s(f=c(f,15),l)}return(o=a(o^=e.length))>>>0}},r.x86.hash128=function(e,n){if(!r.inputValidation||i(e)){n=n||0;for(var t=e.length%16,u=e.length-t,o=n,f=n,h=n,l=n,g=0,m=0,d=0,p=0,v=597399067,x=2869860233,S=951274213,H=2716044179,y=0;y<u;y+=16)g=e[y]|e[y+1]<<8|e[y+2]<<16|e[y+3]<<24,m=e[y+4]|e[y+5]<<8|e[y+6]<<16|e[y+7]<<24,d=e[y+8]|e[y+9]<<8|e[y+10]<<16|e[y+11]<<24,p=e[y+12]|e[y+13]<<8|e[y+14]<<16|e[y+15]<<24,g=c(g=s(g,v),15),o=c(o^=g=s(g,x),19),o=s(o+=f,5)+1444728091,m=c(m=s(m,x),16),f=c(f^=m=s(m,S),17),f=s(f+=h,5)+197830471,d=c(d=s(d,S),17),h=c(h^=d=s(d,H),15),h=s(h+=l,5)+2530024501,p=c(p=s(p,H),18),l=c(l^=p=s(p,v),13),l=s(l+=o,5)+850148119;switch(g=0,m=0,d=0,p=0,t){case 15:p^=e[y+14]<<16;case 14:p^=e[y+13]<<8;case 13:p=s(p^=e[y+12],H),l^=p=s(p=c(p,18),v);case 12:d^=e[y+11]<<24;case 11:d^=e[y+10]<<16;case 10:d^=e[y+9]<<8;case 9:d=s(d^=e[y+8],S),h^=d=s(d=c(d,17),H);case 8:m^=e[y+7]<<24;case 7:m^=e[y+6]<<16;case 6:m^=e[y+5]<<8;case 5:m=s(m^=e[y+4],x),f^=m=s(m=c(m,16),S);case 4:g^=e[y+3]<<24;case 3:g^=e[y+2]<<16;case 2:g^=e[y+1]<<8;case 1:g=s(g^=e[y],v),o^=g=s(g=c(g,15),x)}return o^=e.length,o+=f^=e.length,o+=h^=e.length,f+=o+=l^=e.length,h+=o,l+=o,o=a(o),o+=f=a(f),o+=h=a(h),f+=o+=l=a(l),h+=o,l+=o,("00000000"+(o>>>0).toString(16)).slice(-8)+("00000000"+(f>>>0).toString(16)).slice(-8)+("00000000"+(h>>>0).toString(16)).slice(-8)+("00000000"+(l>>>0).toString(16)).slice(-8)}},r.x64.hash128=function(e,n){if(!r.inputValidation||i(e)){n=n||0;for(var t=e.length%16,s=e.length-t,c=[0,n],a=[0,n],m=[0,0],d=[0,0],p=[2277735313,289559509],v=[1291169091,658871167],x=0;x<s;x+=16)m=[e[x+4]|e[x+5]<<8|e[x+6]<<16|e[x+7]<<24,e[x]|e[x+1]<<8|e[x+2]<<16|e[x+3]<<24],d=[e[x+12]|e[x+13]<<8|e[x+14]<<16|e[x+15]<<24,e[x+8]|e[x+9]<<8|e[x+10]<<16|e[x+11]<<24],m=f(m=o(m,p),31),c=u(c=f(c=l(c,m=o(m,v)),27),a),c=u(o(c,[0,5]),[0,1390208809]),d=f(d=o(d,v),33),a=u(a=f(a=l(a,d=o(d,p)),31),c),a=u(o(a,[0,5]),[0,944331445]);switch(m=[0,0],d=[0,0],t){case 15:d=l(d,h([0,e[x+14]],48));case 14:d=l(d,h([0,e[x+13]],40));case 13:d=l(d,h([0,e[x+12]],32));case 12:d=l(d,h([0,e[x+11]],24));case 11:d=l(d,h([0,e[x+10]],16));case 10:d=l(d,h([0,e[x+9]],8));case 9:d=o(d=l(d,[0,e[x+8]]),v),a=l(a,d=o(d=f(d,33),p));case 8:m=l(m,h([0,e[x+7]],56));case 7:m=l(m,h([0,e[x+6]],48));case 6:m=l(m,h([0,e[x+5]],40));case 5:m=l(m,h([0,e[x+4]],32));case 4:m=l(m,h([0,e[x+3]],24));case 3:m=l(m,h([0,e[x+2]],16));case 2:m=l(m,h([0,e[x+1]],8));case 1:m=o(m=l(m,[0,e[x]]),p),c=l(c,m=o(m=f(m,31),v))}return c=u(c=l(c,[0,e.length]),a=l(a,[0,e.length])),a=u(a,c),c=u(c=g(c),a=g(a)),a=u(a,c),("00000000"+(c[0]>>>0).toString(16)).slice(-8)+("00000000"+(c[1]>>>0).toString(16)).slice(-8)+("00000000"+(a[0]>>>0).toString(16)).slice(-8)+("00000000"+(a[1]>>>0).toString(16)).slice(-8)}},"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=r),exports.murmurHash3=r):"function"==typeof e&&e.amd?e([],function(){return r}):(r._murmurHash3=n.murmurHash3,r.noConflict=function(){return n.murmurHash3=r._murmurHash3,r._murmurHash3=void 0,r.noConflict=void 0,r},n.murmurHash3=r)}(this);
|
||
},{}],"4POg":[function(require,module,exports) {
|
||
module.exports=require("./lib/murmurHash3js");
|
||
},{"./lib/murmurHash3js":"NQhh"}],"01kP":[function(require,module,exports) {
|
||
"use strict";var r=function(r){for(var t=new Uint8Array(4),e=0;e<4;e++)t[e]=255&r,r>>=8;return t};module.exports={fromNumberTo32BitBuf:r};
|
||
},{}],"7Qo4":[function(require,module,exports) {
|
||
var Buffer = require("buffer").Buffer;
|
||
var e=require("buffer").Buffer,n="Input must be an string, Buffer or Uint8Array";function r(r){var t;if(r instanceof Uint8Array)t=r;else if(r instanceof e)t=new Uint8Array(r);else{if("string"!=typeof r)throw new Error(n);t=new Uint8Array(e.from(r,"utf8"))}return t}function t(e){return Array.prototype.map.call(e,function(e){return(e<16?"0":"")+e.toString(16)}).join("")}function o(e){return(4294967296+e).toString(16).substring(1)}function i(e,n,r){for(var t="\n"+e+" = ",i=0;i<n.length;i+=2){if(32===r)t+=o(n[i]).toUpperCase(),t+=" ",t+=o(n[i+1]).toUpperCase();else{if(64!==r)throw new Error("Invalid size "+r);t+=o(n[i+1]).toUpperCase(),t+=o(n[i]).toUpperCase()}i%6==4?t+="\n"+new Array(e.length+4).join(" "):i<n.length-2&&(t+=" ")}console.log(t)}function a(e,n,r){for(var t=(new Date).getTime(),o=new Uint8Array(n),i=0;i<n;i++)o[i]=i%256;var a=(new Date).getTime();for(console.log("Generated random input in "+(a-t)+"ms"),t=a,i=0;i<r;i++){var s=e(o),f=(new Date).getTime(),u=f-t;t=f,console.log("Hashed in "+u+"ms: "+s.substring(0,20)+"..."),console.log(Math.round(n/(1<<20)/(u/1e3)*100)/100+" MB PER SECOND")}}module.exports={normalizeInput:r,toHex:t,debugPrint:i,testSpeed:a};
|
||
},{"buffer":"z1tx"}],"HsAS":[function(require,module,exports) {
|
||
var r=require("./util");function n(r,n,t){var e=r[n]+r[t],a=r[n+1]+r[t+1];e>=4294967296&&a++,r[n]=e,r[n+1]=a}function t(r,n,t,e){var a=r[n]+t;t<0&&(a+=4294967296);var o=r[n+1]+e;a>=4294967296&&o++,r[n]=a,r[n+1]=o}function e(r,n){return r[n]^r[n+1]<<8^r[n+2]<<16^r[n+3]<<24}function a(r,e,a,o,i,u){var f=c[i],h=c[i+1],b=c[u],v=c[u+1];n(l,r,e),t(l,r,f,h);var w=l[o]^l[r],y=l[o+1]^l[r+1];l[o]=y,l[o+1]=w,n(l,a,o),w=l[e]^l[a],y=l[e+1]^l[a+1],l[e]=w>>>24^y<<8,l[e+1]=y>>>24^w<<8,n(l,r,e),t(l,r,b,v),w=l[o]^l[r],y=l[o+1]^l[r+1],l[o]=w>>>16^y<<16,l[o+1]=y>>>16^w<<16,n(l,a,o),w=l[e]^l[a],y=l[e+1]^l[a+1],l[e]=y>>>31^w<<1,l[e+1]=w>>>31^y<<1}var o=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),i=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3],u=new Uint8Array(i.map(function(r){return 2*r})),l=new Uint32Array(32),c=new Uint32Array(32);function f(r,n){var t=0;for(t=0;t<16;t++)l[t]=r.h[t],l[t+16]=o[t];for(l[24]=l[24]^r.t,l[25]=l[25]^r.t/4294967296,n&&(l[28]=~l[28],l[29]=~l[29]),t=0;t<32;t++)c[t]=e(r.b,4*t);for(t=0;t<12;t++)a(0,8,16,24,u[16*t+0],u[16*t+1]),a(2,10,18,26,u[16*t+2],u[16*t+3]),a(4,12,20,28,u[16*t+4],u[16*t+5]),a(6,14,22,30,u[16*t+6],u[16*t+7]),a(0,10,20,30,u[16*t+8],u[16*t+9]),a(2,12,22,24,u[16*t+10],u[16*t+11]),a(4,14,16,26,u[16*t+12],u[16*t+13]),a(6,8,18,28,u[16*t+14],u[16*t+15]);for(t=0;t<16;t++)r.h[t]=r.h[t]^l[t]^l[t+16]}function h(r,n){if(0===r||r>64)throw new Error("Illegal output length, expected 0 < length <= 64");if(n&&n.length>64)throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");for(var t={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:r},e=0;e<16;e++)t.h[e]=o[e];var a=n?n.length:0;return t.h[0]^=16842752^a<<8^r,n&&(b(t,n),t.c=128),t}function b(r,n){for(var t=0;t<n.length;t++)128===r.c&&(r.t+=r.c,f(r,!1),r.c=0),r.b[r.c++]=n[t]}function v(r){for(r.t+=r.c;r.c<128;)r.b[r.c++]=0;f(r,!0);for(var n=new Uint8Array(r.outlen),t=0;t<r.outlen;t++)n[t]=r.h[t>>2]>>8*(3&t);return n}function w(n,t,e){e=e||64,n=r.normalizeInput(n);var a=h(e,t);return b(a,n),v(a)}function y(n,t,e){var a=w(n,t,e);return r.toHex(a)}module.exports={blake2b:w,blake2bHex:y,blake2bInit:h,blake2bUpdate:b,blake2bFinal:v};
|
||
},{"./util":"7Qo4"}],"zQIz":[function(require,module,exports) {
|
||
var r=require("./util");function n(r,n){return r[n]^r[n+1]<<8^r[n+2]<<16^r[n+3]<<24}function t(r,n,t,o,u,a){i[r]=i[r]+i[n]+u,i[o]=e(i[o]^i[r],16),i[t]=i[t]+i[o],i[n]=e(i[n]^i[t],12),i[r]=i[r]+i[n]+a,i[o]=e(i[o]^i[r],8),i[t]=i[t]+i[o],i[n]=e(i[n]^i[t],7)}function e(r,n){return r>>>n^r<<32-n}var o=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),u=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),i=new Uint32Array(16),a=new Uint32Array(16);function c(r,e){var c=0;for(c=0;c<8;c++)i[c]=r.h[c],i[c+8]=o[c];for(i[12]^=r.t,i[13]^=r.t/4294967296,e&&(i[14]=~i[14]),c=0;c<16;c++)a[c]=n(r.b,4*c);for(c=0;c<10;c++)t(0,4,8,12,a[u[16*c+0]],a[u[16*c+1]]),t(1,5,9,13,a[u[16*c+2]],a[u[16*c+3]]),t(2,6,10,14,a[u[16*c+4]],a[u[16*c+5]]),t(3,7,11,15,a[u[16*c+6]],a[u[16*c+7]]),t(0,5,10,15,a[u[16*c+8]],a[u[16*c+9]]),t(1,6,11,12,a[u[16*c+10]],a[u[16*c+11]]),t(2,7,8,13,a[u[16*c+12]],a[u[16*c+13]]),t(3,4,9,14,a[u[16*c+14]],a[u[16*c+15]]);for(c=0;c<8;c++)r.h[c]^=i[c]^i[c+8]}function f(r,n){if(!(r>0&&r<=32))throw new Error("Incorrect output length, should be in [1, 32]");var t=n?n.length:0;if(n&&!(t>0&&t<=32))throw new Error("Incorrect key length, should be in [1, 32]");var e={h:new Uint32Array(o),b:new Uint32Array(64),c:0,t:0,outlen:r};return e.h[0]^=16842752^t<<8^r,t>0&&(l(e,n),e.c=64),e}function l(r,n){for(var t=0;t<n.length;t++)64===r.c&&(r.t+=r.c,c(r,!1),r.c=0),r.b[r.c++]=n[t]}function h(r){for(r.t+=r.c;r.c<64;)r.b[r.c++]=0;c(r,!0);for(var n=new Uint8Array(r.outlen),t=0;t<r.outlen;t++)n[t]=r.h[t>>2]>>8*(3&t)&255;return n}function b(n,t,e){e=e||32,n=r.normalizeInput(n);var o=f(e,t);return l(o,n),h(o)}function w(n,t,e){var o=b(n,t,e);return r.toHex(o)}module.exports={blake2s:b,blake2sHex:w,blake2sInit:f,blake2sUpdate:l,blake2sFinal:h};
|
||
},{"./util":"7Qo4"}],"N3Mm":[function(require,module,exports) {
|
||
var e=require("./blake2b"),b=require("./blake2s");module.exports={blake2b:e.blake2b,blake2bHex:e.blake2bHex,blake2bInit:e.blake2bInit,blake2bUpdate:e.blake2bUpdate,blake2bFinal:e.blake2bFinal,blake2s:b.blake2s,blake2sHex:b.blake2sHex,blake2sInit:b.blake2sInit,blake2sUpdate:b.blake2sUpdate,blake2sFinal:b.blake2sFinal};
|
||
},{"./blake2b":"HsAS","./blake2s":"zQIz"}],"5ObN":[function(require,module,exports) {
|
||
"use strict";function e(e,t,n,r,i,a,u){try{var o=e[a](u),s=o.value}catch(c){return void n(c)}o.done?t(s):Promise.resolve(s).then(r,i)}function t(t){return function(){var n=this,r=arguments;return new Promise(function(i,a){var u=t.apply(n,r);function o(t){e(u,i,a,o,s,"next",t)}function s(t){e(u,i,a,o,s,"throw",t)}o(void 0)})}}var n=require("blakejs"),r=45569,i=45633,a={init:n.blake2bInit,update:n.blake2bUpdate,digest:n.blake2bFinal},u={init:n.blake2sInit,update:n.blake2sUpdate,digest:n.blake2sFinal},o=function(e,n){return function(){var r=t(regeneratorRuntime.mark(function t(r){var i;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return i=n.init(e,null),n.update(i,r),t.abrupt("return",n.digest(i));case 3:case"end":return t.stop()}},t)}));return function(e){return r.apply(this,arguments)}}()};module.exports=function(e){for(var t=0;t<64;t++)e[r+t]=o(t+1,a);for(var n=0;n<32;n++)e[i+n]=o(n+1,u)};
|
||
},{"blakejs":"N3Mm"}],"chT2":[function(require,module,exports) {
|
||
"use strict";function r(r,e,a,t,u,n,s){try{var c=r[n](s),h=c.value}catch(i){return void a(i)}c.done?e(h):Promise.resolve(h).then(t,u)}function e(e){return function(){var a=this,t=arguments;return new Promise(function(u,n){var s=e.apply(a,t);function c(e){r(s,u,n,c,h,"next",e)}function h(e){r(s,u,n,c,h,"throw",e)}c(void 0)})}}var a=require("js-sha3"),t=require("murmurhash3js-revisited"),u=require("./sha"),n=u.factory,s=require("./utils"),c=s.fromNumberTo32BitBuf,h=require("uint8arrays/from-string"),i=function(r){return function(){var u=e(regeneratorRuntime.mark(function e(u){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=r,e.next="sha3-224"===e.t0?3:"sha3-256"===e.t0?4:"sha3-384"===e.t0?5:"sha3-512"===e.t0?6:"shake-128"===e.t0?7:"shake-256"===e.t0?8:"keccak-224"===e.t0?9:"keccak-256"===e.t0?10:"keccak-384"===e.t0?11:"keccak-512"===e.t0?12:"murmur3-128"===e.t0?13:"murmur3-32"===e.t0?14:15;break;case 3:return e.abrupt("return",new Uint8Array(a.sha3_224.arrayBuffer(u)));case 4:return e.abrupt("return",new Uint8Array(a.sha3_256.arrayBuffer(u)));case 5:return e.abrupt("return",new Uint8Array(a.sha3_384.arrayBuffer(u)));case 6:return e.abrupt("return",new Uint8Array(a.sha3_512.arrayBuffer(u)));case 7:return e.abrupt("return",new Uint8Array(a.shake128.create(128).update(u).arrayBuffer()));case 8:return e.abrupt("return",new Uint8Array(a.shake256.create(256).update(u).arrayBuffer()));case 9:return e.abrupt("return",new Uint8Array(a.keccak224.arrayBuffer(u)));case 10:return e.abrupt("return",new Uint8Array(a.keccak256.arrayBuffer(u)));case 11:return e.abrupt("return",new Uint8Array(a.keccak384.arrayBuffer(u)));case 12:return e.abrupt("return",new Uint8Array(a.keccak512.arrayBuffer(u)));case 13:return e.abrupt("return",h(t.x64.hash128(u),"base16"));case 14:return e.abrupt("return",c(t.x86.hash32(u)));case 15:throw new TypeError("".concat(r," is not a supported algorithm"));case 16:case"end":return e.stop()}},e)}));return function(r){return u.apply(this,arguments)}}()},k=function(r){return r};module.exports={identity:k,sha1:n("sha1"),sha2256:n("sha2-256"),sha2512:n("sha2-512"),dblSha2256:n("dbl-sha2-256"),sha3224:i("sha3-224"),sha3256:i("sha3-256"),sha3384:i("sha3-384"),sha3512:i("sha3-512"),shake128:i("shake-128"),shake256:i("shake-256"),keccak224:i("keccak-224"),keccak256:i("keccak-256"),keccak384:i("keccak-384"),keccak512:i("keccak-512"),murmur3128:i("murmur3-128"),murmur332:i("murmur3-32"),addBlake:require("./blake")};
|
||
},{"js-sha3":"ktMt","murmurhash3js-revisited":"4POg","./sha":"K7IR","./utils":"01kP","uint8arrays/from-string":"YqS+","./blake":"5ObN"}],"7scj":[function(require,module,exports) {
|
||
"use strict";function e(e,r,t,n,a,u,c){try{var i=e[u](c),s=i.value}catch(o){return void t(o)}i.done?r(s):Promise.resolve(s).then(n,a)}function r(r){return function(){var t=this,n=arguments;return new Promise(function(a,u){var c=r.apply(t,n);function i(r){e(c,a,u,i,s,"next",r)}function s(r){e(c,a,u,i,s,"throw",r)}i(void 0)})}}var t=require("err-code"),n=require("multihashes"),a=require("./crypto"),u=require("uint8arrays/equals");function c(e,r,t){return i.apply(this,arguments)}function i(){return(i=r(regeneratorRuntime.mark(function e(r,t,a){var u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,c.digest(r,t,a);case 2:return u=e.sent,e.abrupt("return",n.encode(u,t,a));case 4:case"end":return e.stop()}},e)}))).apply(this,arguments)}c.multihash=n,c.digest=function(){var e=r(regeneratorRuntime.mark(function e(r,t,n){var a,u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=c.createHash(t),e.next=3,a(r);case 3:return u=e.sent,e.abrupt("return",n?u.slice(0,n):u);case 5:case"end":return e.stop()}},e)}));return function(r,t,n){return e.apply(this,arguments)}}(),c.createHash=function(e){if(!e)throw t(new Error("hash algorithm must be specified"),"ERR_HASH_ALGORITHM_NOT_SPECIFIED");var r=n.coerceCode(e);if(!c.functions[r])throw t(new Error("multihash function '".concat(e,"' not yet supported")),"ERR_HASH_ALGORITHM_NOT_SUPPORTED");return c.functions[r]},c.functions={0:a.identity,17:a.sha1,18:a.sha2256,19:a.sha2512,20:a.sha3512,21:a.sha3384,22:a.sha3256,23:a.sha3224,24:a.shake128,25:a.shake256,26:a.keccak224,27:a.keccak256,28:a.keccak384,29:a.keccak512,34:a.murmur3128,35:a.murmur332,86:a.dblSha2256},a.addBlake(c.functions),c.validate=function(){var e=r(regeneratorRuntime.mark(function e(r,t){var a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,c(r,n.decode(t).name);case 2:return a=e.sent,e.abrupt("return",u(t,a));case 4:case"end":return e.stop()}},e)}));return function(r,t){return e.apply(this,arguments)}}(),module.exports=c;
|
||
},{"err-code":"hLMW","multihashes":"ubn9","./crypto":"chT2","uint8arrays/equals":"mZxc"}],"pZru":[function(require,module,exports) {
|
||
"use strict";module.exports=TextEncoder;
|
||
},{}],"Xw2d":[function(require,module,exports) {
|
||
"use strict";function e(e,r,n,t,u,i,o){try{var a=e[i](o),c=a.value}catch(s){return void n(s)}a.done?r(c):Promise.resolve(c).then(t,u)}function r(r){return function(){var n=this,t=arguments;return new Promise(function(u,i){var o=r.apply(n,t);function a(r){e(o,u,i,a,c,"next",r)}function c(r){e(o,u,i,a,c,"throw",r)}a(void 0)})}}var n=require("cids"),t=require("multihashing-async"),u=require("ipfs-utils/src/text-encoder");module.exports.namespaceToCid=function(){var e=r(regeneratorRuntime.mark(function e(r){var i,o;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i=(new u).encode(r),e.next=3,t(i,"sha2-256");case 3:return o=e.sent,e.abrupt("return",new n(o));case 5:case"end":return e.stop()}},e)}));return function(r){return e.apply(this,arguments)}}();
|
||
},{"cids":"xTSP","multihashing-async":"7scj","ipfs-utils/src/text-encoder":"pZru"}],"WMau":[function(require,module,exports) {
|
||
"use strict";function e(e,a){return n(e)||r(e,a)||i(e,a)||t()}function t(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function r(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,a=!1,i=void 0;try{for(var s,o=e[Symbol.iterator]();!(n=(s=o.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(u){a=!0,i=u}finally{try{n||null==o.return||o.return()}finally{if(a)throw i}}return r}}function n(e){if(Array.isArray(e))return e}function a(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=i(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){u=!0,s=e},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw s}}}}function i(e,t){if(e){if("string"==typeof e)return s(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?s(e,t):void 0}}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function o(e,t,r,n,a,i,s){try{var o=e[i](s),u=o.value}catch(c){return void r(c)}o.done?t(u):Promise.resolve(u).then(n,a)}function u(e){return function(){var t=this,r=arguments;return new Promise(function(n,a){var i=e.apply(t,r);function s(e){o(i,n,a,s,u,"next",e)}function u(e){o(i,n,a,s,u,"throw",e)}s(void 0)})}}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function h(e,t,r){return t&&l(e.prototype,t),r&&l(e,r),e}function p(e){var t;if("undefined"!=typeof Symbol){if(Symbol.asyncIterator&&null!=(t=e[Symbol.asyncIterator]))return t.call(e);if(Symbol.iterator&&null!=(t=e[Symbol.iterator]))return t.call(e)}throw new TypeError("Object is not async iterable")}var f=require("debug"),d=Object.assign(f("libp2p:auto-relay"),{error:f("libp2p:auto-relay:err")}),b=require("uint8arrays/from-string"),y=require("uint8arrays/to-string"),v=require("multiaddr"),m=v.Multiaddr,_=require("peer-id"),x=require("./multicodec"),g=x.relay,k=require("./circuit/hop"),R=k.canHop,S=require("./utils"),w=S.namespaceToCid,A=require("./constants"),P=A.CIRCUIT_PROTO_CODE,L=A.HOP_METADATA_KEY,O=A.HOP_METADATA_VALUE,I=A.RELAY_RENDEZVOUS_NS,M=function(){function t(e){var r=e.libp2p,n=e.maxListeners,a=void 0===n?1:n;c(this,t),this._libp2p=r,this._peerId=r.peerId,this._peerStore=r.peerStore,this._connectionManager=r.connectionManager,this._transportManager=r.transportManager,this._addressSorter=r.dialer.addressSorter,this.maxListeners=a,this._listenRelays=new Set,this._onProtocolChange=this._onProtocolChange.bind(this),this._onPeerDisconnected=this._onPeerDisconnected.bind(this),this._peerStore.on("change:protocols",this._onProtocolChange),this._connectionManager.on("peer:disconnect",this._onPeerDisconnected)}return h(t,[{key:"_onProtocolChange",value:function(){var e=u(regeneratorRuntime.mark(function e(t){var r,n,a,i,s;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.peerId,n=t.protocols,a=r.toB58String(),(i=n.find(function(e){return e===g}))||!this._listenRelays.has(a)){e.next=8;break}return this._removeListenRelay(a),e.abrupt("return");case 8:if(i&&!this._listenRelays.has(a)){e.next=10;break}return e.abrupt("return");case 10:if(e.prev=10,s=this._connectionManager.get(r)){e.next=14;break}return e.abrupt("return");case 14:if(!s.remoteAddr.protoCodes().includes(P)){e.next=17;break}return d("relayed connection to ".concat(a," will not be used to hop on")),e.abrupt("return");case 17:return e.next=19,R({connection:s});case 19:if(!e.sent){e.next=24;break}return this._peerStore.metadataBook.set(r,L,b(O)),e.next=24,this._addListenRelay(s,a);case 24:e.next=29;break;case 26:e.prev=26,e.t0=e.catch(10),d.error(e.t0);case 29:case"end":return e.stop()}},e,this,[[10,26]])}));return function(t){return e.apply(this,arguments)}}()},{key:"_onPeerDisconnected",value:function(e){var t=e.remotePeer.toB58String();this._listenRelays.has(t)&&this._removeListenRelay(t)}},{key:"_addListenRelay",value:function(){var e=u(regeneratorRuntime.mark(function e(t,r){var n,a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(this._listenRelays.size>=this.maxListeners)){e.next=2;break}return e.abrupt("return");case 2:if((n=this._peerStore.addressBook.getMultiaddrsForPeer(t.remotePeer,this._addressSorter))&&n.length){e.next=5;break}return e.abrupt("return");case 5:return a="".concat(n[0].toString(),"/p2p-circuit"),this._listenRelays.add(r),e.prev=7,e.next=10,this._transportManager.listen([new m(a)]);case 10:e.next=16;break;case 12:e.prev=12,e.t0=e.catch(7),d.error(e.t0),this._listenRelays.delete(r);case 16:case"end":return e.stop()}},e,this,[[7,12]])}));return function(t,r){return e.apply(this,arguments)}}()},{key:"_removeListenRelay",value:function(e){this._listenRelays.delete(e)&&this._listenOnAvailableHopRelays([e])}},{key:"_listenOnAvailableHopRelays",value:function(){var t=u(regeneratorRuntime.mark(function t(){var r,n,i,s,o,u,c,l,h,f,b,v,m,x,g,k,R,S,A,P,M,C,E,T,q=arguments;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(r=q.length>0&&void 0!==q[0]?q[0]:[],!(this._listenRelays.size>=this.maxListeners)){t.next=3;break}return t.abrupt("return");case 3:n=[],i=a(this._peerStore.metadataBook.data.entries()),t.prev=5,i.s();case 7:if((s=i.n()).done){t.next=25;break}if(o=e(s.value,2),u=o[0],c=o[1],!this._listenRelays.has(u)&&!r.includes(u)){t.next=11;break}return t.abrupt("continue",23);case 11:if((l=c.get(L))&&y(l)===O){t.next=14;break}return t.abrupt("continue",23);case 14:if(h=_.createFromCID(u),f=this._connectionManager.get(h)){t.next=19;break}return n.push(h),t.abrupt("continue",23);case 19:return t.next=21,this._addListenRelay(f,u);case 21:if(!(this._listenRelays.size>=this.maxListeners)){t.next=23;break}return t.abrupt("return");case 23:t.next=7;break;case 25:t.next=30;break;case 27:t.prev=27,t.t0=t.catch(5),i.e(t.t0);case 30:return t.prev=30,i.f(),t.finish(30);case 33:b=0,v=n;case 34:if(!(b<v.length)){t.next=46;break}return m=v[b],t.next=38,this._libp2p.dial(m);case 38:return x=t.sent,t.next=41,this._addListenRelay(x,m.toB58String());case 41:if(!(this._listenRelays.size>=this.maxListeners)){t.next=43;break}return t.abrupt("return");case 43:b++,t.next=34;break;case 46:return t.prev=46,t.next=49,w(I);case 49:g=t.sent,k=!0,R=!1,t.prev=52,A=p(this._libp2p.contentRouting.findProviders(g));case 54:return t.next=56,A.next();case 56:return P=t.sent,k=P.done,t.next=60,P.value;case 60:if(M=t.sent,k){t.next=77;break}if((C=M).multiaddrs.length){t.next=65;break}return t.abrupt("continue",74);case 65:return E=C.id,this._peerStore.addressBook.add(E,C.multiaddrs),t.next=69,this._libp2p.dial(E);case 69:return T=t.sent,t.next=72,this._addListenRelay(T,E.toB58String());case 72:if(!(this._listenRelays.size>=this.maxListeners)){t.next=74;break}return t.abrupt("return");case 74:k=!0,t.next=54;break;case 77:t.next=83;break;case 79:t.prev=79,t.t1=t.catch(52),R=!0,S=t.t1;case 83:if(t.prev=83,t.prev=84,k||null==A.return){t.next=88;break}return t.next=88,A.return();case 88:if(t.prev=88,!R){t.next=91;break}throw S;case 91:return t.finish(88);case 92:return t.finish(83);case 93:t.next=98;break;case 95:t.prev=95,t.t2=t.catch(46),d.error(t.t2);case 98:case"end":return t.stop()}},t,this,[[5,27,30,33],[46,95],[52,79,83,93],[84,,88,92]])}));return function(){return t.apply(this,arguments)}}()}]),t}();module.exports=M;
|
||
},{"debug":"F8gk","uint8arrays/from-string":"YqS+","uint8arrays/to-string":"aFN1","multiaddr":"fVn4","peer-id":"jAbp","./multicodec":"grQ/","./circuit/hop":"56vt","./utils":"Xw2d","./constants":"qD4Y"}],"VKLj":[function(require,module,exports) {
|
||
"use strict";function e(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(u){return void r(u)}s.done?t(c):Promise.resolve(c).then(n,i)}function t(t){return function(){var r=this,n=arguments;return new Promise(function(i,o){var a=t.apply(r,n);function s(t){e(a,i,o,s,c,"next",t)}function c(t){e(a,i,o,s,c,"throw",t)}s(void 0)})}}function r(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function n(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach(function(t){i(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function s(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),e}var c=require("debug"),u=Object.assign(c("libp2p:relay"),{error:c("libp2p:relay:err")}),l=require("set-delayed-interval"),p=l.setDelayedInterval,v=l.clearDelayedInterval,f=require("./auto-relay"),b=require("./utils"),h=b.namespaceToCid,y=require("./constants"),d=y.RELAY_RENDEZVOUS_NS,O=function(){function e(t){o(this,e),this._libp2p=t,this._options=n({},t._config.relay),this._autoRelay=this._options.autoRelay.enabled&&new f(n({libp2p:t},this._options.autoRelay)),this._advertiseService=this._advertiseService.bind(this)}return s(e,[{key:"start",value:function(){this._options.hop.enabled&&this._options.advertise.enabled&&(this._timeout=p(this._advertiseService,this._options.advertise.ttl,this._options.advertise.bootDelay))}},{key:"stop",value:function(){v(this._timeout)}},{key:"_advertiseService",value:function(){var e=t(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,h(d);case 3:return t=e.sent,e.next=6,this._libp2p.contentRouting.provide(t);case 6:e.next=11;break;case 8:e.prev=8,e.t0=e.catch(0),"NO_ROUTERS_AVAILABLE"===e.t0.code?(u.error("a content router, such as a DHT, must be provided in order to advertise the relay service",e.t0),this.stop()):u.error(e.t0);case 11:case"end":return e.stop()}},e,this,[[0,8]])}));return function(){return e.apply(this,arguments)}}()}]),e}();module.exports=O;
|
||
},{"debug":"F8gk","set-delayed-interval":"ysRr","./auto-relay":"WMau","./utils":"Xw2d","./constants":"qD4Y"}],"z+RH":[function(require,module,exports) {
|
||
"use strict";var e="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0,o=e.AbortController,t=e.AbortSignal;module.exports=o,module.exports.AbortSignal=t,module.exports.default=o;
|
||
},{}],"uL0Q":[function(require,module,exports) {
|
||
"use strict";var e=require("./time");function t(t,r,s){var i=this;this._started=e(),this._rescheduled=0,this._scheduled=r,this._args=s,this._timer=setTimeout(function r(){i._rescheduled>0?(i._scheduled=i._rescheduled-(e()-i._started),i._timer=setTimeout(r,i._scheduled),i._rescheduled=0):t.apply(null,i._args)},r)}function r(){if("function"!=typeof arguments[0])throw new Error("callback needed");if("number"!=typeof arguments[1])throw new Error("timeout needed");var e;if(arguments.length>0){e=new Array(arguments.length-2);for(var r=0;r<e.length;r++)e[r]=arguments[r+2]}return new t(arguments[0],arguments[1],e)}t.prototype.reschedule=function(t){var r=e();return!(r+t-(this._started+this._scheduled)<0)&&(this._started=r,this._rescheduled=t,!0)},t.prototype.clear=function(){clearTimeout(this._timer)},module.exports=r;
|
||
},{"./time":"5cSk"}],"K4iO":[function(require,module,exports) {
|
||
"use strict";const{AbortController:t}="undefined"!=typeof self?self:"undefined"!=typeof window?window:require("abort-controller"),e=require("retimer");class r extends t{constructor(t){super(),this._ms=t,this._timer=e(()=>this.abort(),t),Object.setPrototypeOf(this,r.prototype)}abort(){return this._timer.clear(),super.abort()}clear(){this._timer.clear()}reset(){this._timer.clear(),this._timer=e(()=>this.abort(),this._ms)}}module.exports=r,module.exports.TimeoutController=r;
|
||
},{"abort-controller":"z+RH","retimer":"uL0Q"}],"n9nK":[function(require,module,exports) {
|
||
"use strict";let o;o=globalThis.AbortController&&globalThis.AbortSignal?globalThis:require("abort-controller"),module.exports={AbortController:o.AbortController,AbortSignal:o.AbortSignal};
|
||
},{"abort-controller":"z+RH"}],"FfQr":[function(require,module,exports) {
|
||
const{AbortController:e}=require("native-abort-controller");function o(o){const t=new e;function r(){t.abort();for(const e of o)e&&e.removeEventListener&&e.removeEventListener("abort",r)}for(const e of o)if(e&&e.addEventListener){if(e.aborted){r();break}e.addEventListener("abort",r)}return t.signal}module.exports=o,module.exports.anySignal=o;
|
||
},{"native-abort-controller":"n9nK"}],"BU9m":[function(require,module,exports) {
|
||
const s=require("fast-fifo"),e=require("p-defer");module.exports=class{constructor(){this._buffer=new s,this._waitingConsumers=new s}push(s){const{promise:t,resolve:r}=e();return this._buffer.push({chunk:s,resolve:r}),this._consume(),t}_consume(){for(;!this._waitingConsumers.isEmpty()&&!this._buffer.isEmpty();){const s=this._waitingConsumers.shift(),e=this._buffer.shift();s.resolve(e.chunk),e.resolve()}}shift(){const{promise:s,resolve:t}=e();return this._waitingConsumers.push({resolve:t}),this._consume(),s}isEmpty(){return this._buffer.isEmpty()}};
|
||
},{"fast-fifo":"xK7N","p-defer":"LOw6"}],"/vlC":[function(require,module,exports) {
|
||
"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}module.exports=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2?arguments[2]:void 0;if(o={indent:" ",includeEmptyLines:!1,...o},"string"!=typeof e)throw new TypeError("Expected `input` to be a `string`, got `".concat(t(e),"`"));if("number"!=typeof n)throw new TypeError("Expected `count` to be a `number`, got `".concat(t(n),"`"));if("string"!=typeof o.indent)throw new TypeError("Expected `options.indent` to be a `string`, got `".concat(t(o.indent),"`"));if(0===n)return e;var r=o.includeEmptyLines?/^/gm:/^(?!\s*$)/gm;return e.replace(r,o.indent.repeat(n))};
|
||
},{}],"4Ofr":[function(require,module,exports) {
|
||
"use strict";var e=require("os"),r=/\s+at.*(?:\(|\s)(.*)\)?/,t=/^(?:(?:(?:node|(?:internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)\.js:\d+:\d+)|native)/,n=void 0===e.homedir?"":e.homedir();module.exports=function(e,a){return a=Object.assign({pretty:!1},a),e.replace(/\\/g,"/").split("\n").filter(function(e){var n=e.match(r);if(null===n||!n[1])return!0;var a=n[1];return!a.includes(".app/Contents/Resources/electron.asar")&&!a.includes(".app/Contents/Resources/default_app.asar")&&!t.test(a)}).filter(function(e){return""!==e.trim()}).map(function(e){return a.pretty?e.replace(r,function(e,r){return e.replace(r,r.replace(n,"~"))}):e}).join("\n")};
|
||
},{"os":"sC8V"}],"YkcT":[function(require,module,exports) {
|
||
"use strict";function t(t,r){var e;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(e=n(t))||r&&t&&"number"==typeof t.length){e&&(t=e);var o=0,u=function(){};return{s:u,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:u}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,c=!0,a=!1;return{s:function(){e=t[Symbol.iterator]()},n:function(){var t=e.next();return c=t.done,t},e:function(t){a=!0,i=t},f:function(){try{c||null==e.return||e.return()}finally{if(a)throw i}}}}function r(t){return u(t)||o(t)||n(t)||e()}function e(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function n(t,r){if(t){if("string"==typeof t)return i(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?i(t,r):void 0}}function o(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}function u(t){if(Array.isArray(t))return i(t)}function i(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}function c(t){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function f(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function l(t,r,e){return r&&f(t.prototype,r),e&&f(t,e),t}function s(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),r&&g(t,r)}function p(t){var r=h();return function(){var e,n=w(t);if(r){var o=w(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return y(this,e)}}function y(t,r){return!r||"object"!==c(r)&&"function"!=typeof r?b(t):r}function b(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function m(t){var r="function"==typeof Map?new Map:void 0;return(m=function(t){if(null===t||!d(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,e)}function e(){return v(t,arguments,w(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),g(e,t)})(t)}function v(t,r,e){return(v=h()?Reflect.construct:function(t,r,e){var n=[null];n.push.apply(n,r);var o=new(Function.bind.apply(t,n));return e&&g(o,e.prototype),o}).apply(null,arguments)}function h(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}function d(t){return-1!==Function.toString.call(t).indexOf("[native code]")}function g(t,r){return(g=Object.setPrototypeOf||function(t,r){return t.__proto__=r,t})(t,r)}function w(t){return(w=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var S=require("indent-string"),j=require("clean-stack"),O=function(t){return t.replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g,"")},x=function(e){s(o,m(Error));var n=p(o);function o(t){var e;if(a(this,o),!Array.isArray(t))throw new TypeError("Expected input to be an Array, got ".concat(c(t)));var u=(t=r(t).map(function(t){return t instanceof Error?t:null!==t&&"object"===c(t)?Object.assign(new Error(t.message),t):new Error(t)})).map(function(t){return"string"==typeof t.stack?O(j(t.stack)):String(t)}).join("\n");return u="\n"+S(u,4),(e=n.call(this,u)).name="AggregateError",Object.defineProperty(b(e),"_errors",{value:t}),e}return l(o,[{key:Symbol.iterator,value:regeneratorRuntime.mark(function r(){var e,n,o;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:e=t(this._errors),r.prev=1,e.s();case 3:if((n=e.n()).done){r.next=9;break}return o=n.value,r.next=7,o;case 7:r.next=3;break;case 9:r.next=14;break;case 11:r.prev=11,r.t0=r.catch(1),e.e(r.t0);case 14:return r.prev=14,e.f(),r.finish(14);case 17:case"end":return r.stop()}},r,this,[[1,11,14,17]])})}]),o}();module.exports=x;
|
||
},{"indent-string":"/vlC","clean-stack":"4Ofr"}],"a1D0":[function(require,module,exports) {
|
||
"use strict";function t(t,n){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=e(t))||n&&t&&"number"==typeof t.length){r&&(t=r);var o=0,i=function(){};return{s:i,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var c,u=!0,a=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,c=t},f:function(){try{u||null==r.return||r.return()}finally{if(a)throw c}}}}function e(t,e){if(t){if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function c(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),t}function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&d(t,e)}function a(t){var e=y();return function(){var n,r=b(t);if(e){var o=b(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return f(this,n)}}function f(t,e){return!e||"object"!==r(e)&&"function"!=typeof e?l(t):e}function l(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function s(t){var e="function"==typeof Map?new Map:void 0;return(s=function(t){if(null===t||!h(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return p(t,arguments,b(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),d(n,t)})(t)}function p(t,e,n){return(p=y()?Reflect.construct:function(t,e,n){var r=[null];r.push.apply(r,e);var o=new(Function.bind.apply(t,r));return n&&d(o,n.prototype),o}).apply(null,arguments)}function y(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}function h(t){return-1!==Function.toString.call(t).indexOf("[native code]")}function d(t,e){return(d=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function b(t){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var v=function(t){u(n,s(Error));var e=a(n);function n(t){var r;return o(this,n),(r=e.call(this,t||"Promise was canceled")).name="CancelError",r}return c(n,[{key:"isCanceled",get:function(){return!0}}]),n}(),m=function(){function e(t){var n=this;o(this,e),this._cancelHandlers=[],this._isPending=!0,this._isCanceled=!1,this._rejectOnCancel=!0,this._promise=new Promise(function(e,r){n._reject=r;var o=function(t){if(!n._isPending)throw new Error("The `onCancel` handler was attached after the promise settled.");n._cancelHandlers.push(t)};return Object.defineProperties(o,{shouldReject:{get:function(){return n._rejectOnCancel},set:function(t){n._rejectOnCancel=t}}}),t(function(t){n._isCanceled&&o.shouldReject||(n._isPending=!1,e(t))},function(t){n._isPending=!1,r(t)},o)})}return c(e,[{key:"then",value:function(t,e){return this._promise.then(t,e)}},{key:"catch",value:function(t){return this._promise.catch(t)}},{key:"finally",value:function(t){return this._promise.finally(t)}},{key:"cancel",value:function(e){if(this._isPending&&!this._isCanceled){if(this._isCanceled=!0,this._cancelHandlers.length>0)try{var n,r=t(this._cancelHandlers);try{for(r.s();!(n=r.n()).done;){(0,n.value)()}}catch(o){r.e(o)}finally{r.f()}}catch(i){return void this._reject(i)}this._rejectOnCancel&&this._reject(new v(e))}}},{key:"isCanceled",get:function(){return this._isCanceled}}],[{key:"fn",value:function(t){return function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return new e(function(e,n,o){r.push(o),t.apply(void 0,r).then(e,n)})}}}]),e}();Object.setPrototypeOf(m.prototype,Promise.prototype),module.exports=m,module.exports.CancelError=v;
|
||
},{}],"8sY1":[function(require,module,exports) {
|
||
"use strict";function t(t,n,e,r,o,u,c){try{var i=t[u](c),a=i.value}catch(f){return void e(f)}i.done?n(a):Promise.resolve(a).then(r,o)}function n(n){return function(){var e=this,r=arguments;return new Promise(function(o,u){var c=n.apply(e,r);function i(n){t(c,o,u,i,a,"next",n)}function a(n){t(c,o,u,i,a,"throw",n)}i(void 0)})}}function e(t,n){var e;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(e=r(t))||n&&t&&"number"==typeof t.length){e&&(t=e);var o=0,u=function(){};return{s:u,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:u}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var c,i=!0,a=!1;return{s:function(){e=t[Symbol.iterator]()},n:function(){var t=e.next();return i=t.done,t},e:function(t){a=!0,c=t},f:function(){try{i||null==e.return||e.return()}finally{if(a)throw c}}}}function r(t,n){if(t){if("string"==typeof t)return o(t,n);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?o(t,n):void 0}}function o(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=new Array(n);e<n;e++)r[e]=t[e];return r}function u(t){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function c(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function i(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&b(t,n)}function a(t){var n=y();return function(){var e,r=h(t);if(n){var o=h(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return f(this,e)}}function f(t,n){return!n||"object"!==u(n)&&"function"!=typeof n?l(t):n}function l(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function s(t){var n="function"==typeof Map?new Map:void 0;return(s=function(t){if(null===t||!v(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(t))return n.get(t);n.set(t,e)}function e(){return p(t,arguments,h(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),b(e,t)})(t)}function p(t,n,e){return(p=y()?Reflect.construct:function(t,n,e){var r=[null];r.push.apply(r,n);var o=new(Function.bind.apply(t,r));return e&&b(o,e.prototype),o}).apply(null,arguments)}function y(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}function v(t){return-1!==Function.toString.call(t).indexOf("[native code]")}function b(t,n){return(b=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var d=require("aggregate-error"),m=require("p-cancelable"),w=function(t){i(e,s(Error));var n=a(e);function e(){return c(this,e),n.apply(this,arguments)}return e}(),g=function(t,r){return new m(function(o,c,i){var a=r.count,f=r.filter,l=void 0===f?function(){return!0}:f;if(Number.isFinite(a)){var s=[],p=[],y=0,v=!1,b=new Set,h=function(){var n,r=e(t);try{for(r.s();!(n=r.n()).done;){var o=n.value;b.has(o)||"function"!=typeof o.cancel||o.cancel()}}catch(u){r.e(u)}finally{r.f()}};i(h);var m,g=e(t);try{var x=function(){var t=m.value;y++,n(regeneratorRuntime.mark(function n(){var e;return regeneratorRuntime.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,t;case 3:if(e=n.sent,!v){n.next=6;break}return n.abrupt("return");case 6:if(l(e)){n.next=8;break}throw new w("Value does not satisfy filter");case 8:s.push(e),n.next=14;break;case 11:n.prev=11,n.t0=n.catch(0),p.push(n.t0);case 14:return n.prev=14,b.add(t),!v&&(s.length===a&&(o(s),v=!0),y-p.length<a&&(c(new d(p)),v=!0),v)&&h(),n.finish(14);case 18:case"end":return n.stop()}},n,null,[[0,11,14,18]])}))()};for(g.s();!(m=g.n()).done;)x()}catch(S){g.e(S)}finally{g.f()}a>y&&(c(new RangeError("Expected input to contain at least ".concat(r.count," items, but contains ").concat(y," items"))),h())}else c(new TypeError("Expected a finite number, got ".concat(u(r.count))))})};module.exports=g,module.exports.AggregateError=d,module.exports.FilterError=w;
|
||
},{"aggregate-error":"YkcT","p-cancelable":"a1D0"}],"nyj0":[function(require,module,exports) {
|
||
"use strict";function r(r,n){return u(r)||o(r,n)||t(r,n)||e()}function e(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function t(r,e){if(r){if("string"==typeof r)return n(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?n(r,e):void 0}}function n(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function o(r,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(r)){var t=[],n=!0,o=!1,u=void 0;try{for(var i,c=r[Symbol.iterator]();!(n=(i=c.next()).done)&&(t.push(i.value),!e||t.length!==e);n=!0);}catch(a){o=!0,u=a}finally{try{n||null==c.return||c.return()}finally{if(o)throw u}}return t}}function u(r){if(Array.isArray(r))return r}function i(r,e,t,n,o,u,i){try{var c=r[u](i),a=c.value}catch(f){return void t(f)}c.done?e(a):Promise.resolve(a).then(n,o)}function c(r){return function(){var e=this,t=arguments;return new Promise(function(n,o){var u=r.apply(e,t);function c(r){i(u,n,o,c,a,"next",r)}function a(r){i(u,n,o,c,a,"throw",r)}c(void 0)})}}function a(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})),t.push.apply(t,n)}return t}function f(r){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?a(Object(t),!0).forEach(function(e){l(r,e,t[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(t,e))})}return r}function l(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}var s=require("p-some"),p=require("p-cancelable");module.exports=function(e,t){var n=s(e,f(f({},t),{},{count:1}));return p.fn(function(){var e=c(regeneratorRuntime.mark(function e(t){var o,u,i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t(function(){n.cancel()}),e.next=3,n;case 3:return o=e.sent,u=r(o,1),i=u[0],e.abrupt("return",i);case 7:case"end":return e.stop()}},e)}));return function(r){return e.apply(this,arguments)}}())()},module.exports.AggregateError=s.AggregateError;
|
||
},{"p-some":"8sY1","p-cancelable":"a1D0"}],"4Rgx":[function(require,module,exports) {
|
||
"use strict";function e(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,t)}return n}function r(r){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?e(Object(i),!0).forEach(function(e){n(r,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(i)):e(Object(i)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(i,e))})}return r}function n(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function t(e,r,n,t,i,a,o){try{var u=e[a](o),c=u.value}catch(s){return void n(s)}u.done?r(c):Promise.resolve(c).then(t,i)}function i(e){return function(){var r=this,n=arguments;return new Promise(function(i,a){var o=e.apply(r,n);function u(e){t(o,i,a,u,c,"next",e)}function c(e){t(o,i,a,u,c,"throw",e)}u(void 0)})}}function a(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function o(e,r){for(var n=0;n<r.length;n++){var t=r[n];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(e,t.key,t)}}function u(e,r,n){return r&&o(e.prototype,r),n&&o(e,n),e}var c=require("err-code"),s=require("abort-controller").default,l=require("any-signal"),f=l.anySignal,p=require("p-fifo"),h=require("p-any"),d=function(){function e(r){var n=r.addrs,t=r.dialAction,i=r.dialer;a(this,e),this.addrs=n,this.dialer=i,this.dialAction=t}return u(e,[{key:"run",value:function(){var e=i(regeneratorRuntime.mark(function e(){var n,t,a,o,u,l=this,d=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=d.length>0&&void 0!==d[0]?d[0]:{},!((t=this.dialer.getTokens(this.addrs.length)).length<1)){e.next=4;break}throw c(new Error("No dial tokens available"),"ERR_NO_DIAL_TOKENS");case 4:return a=new p,t.forEach(function(e){return a.push(e)}),o=this.addrs.map(function(){return new s}),u=0,e.prev=8,e.next=11,h(this.addrs.map(function(){var e=i(regeneratorRuntime.mark(function e(i,c){var s,p,h;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a.shift();case 2:return s=e.sent,e.prev=3,h=o[c].signal,e.next=7,l.dialAction(i,r(r({},n),{},{signal:n.signal?f([h,n.signal]):h}));case 7:p=e.sent,o.splice(c,1);case 9:return e.prev=9,u++,l.addrs.length-u>=t.length?a.push(s):l.dialer.releaseToken(t.splice(t.indexOf(s),1)[0]),e.finish(9);case 13:return e.abrupt("return",p);case 14:case"end":return e.stop()}},e,null,[[3,,9,13]])}));return function(r,n){return e.apply(this,arguments)}}()));case 11:return e.abrupt("return",e.sent);case 12:return e.prev=12,o.map(function(e){return e.abort()}),t.forEach(function(e){return l.dialer.releaseToken(e)}),e.finish(12);case 16:case"end":return e.stop()}},e,this,[[8,,12,16]])}));return function(){return e.apply(this,arguments)}}()}]),e}();module.exports=d;
|
||
},{"err-code":"hLMW","abort-controller":"z+RH","any-signal":"FfQr","p-fifo":"BU9m","p-any":"nyj0"}],"YP0b":[function(require,module,exports) {
|
||
"use strict";function e(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}function r(r){for(var n=1;n<arguments.length;n++){var a=null!=arguments[n]?arguments[n]:{};n%2?e(Object(a),!0).forEach(function(e){t(r,e,a[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(a)):e(Object(a)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(a,e))})}return r}function t(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function n(e,r,t,n,a,i,o){try{var s=e[i](o),u=s.value}catch(c){return void t(c)}s.done?r(u):Promise.resolve(u).then(n,a)}function a(e){return function(){var r=this,t=arguments;return new Promise(function(a,i){var o=e.apply(r,t);function s(e){n(o,a,i,s,u,"next",e)}function u(e){n(o,a,i,s,u,"throw",e)}s(void 0)})}}function i(e,r){var t;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(t=f(e))||r&&e&&"number"==typeof e.length){t&&(e=t);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,s=!1;return{s:function(){t=e[Symbol.iterator]()},n:function(){var e=t.next();return o=e.done,e},e:function(e){s=!0,i=e},f:function(){try{o||null==t.return||t.return()}finally{if(s)throw i}}}}function o(e,r){return c(e)||u(e,r)||f(e,r)||s()}function s(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(e,r){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var t=[],n=!0,a=!1,i=void 0;try{for(var o,s=e[Symbol.iterator]();!(n=(o=s.next()).done)&&(t.push(o.value),!r||t.length!==r);n=!0);}catch(u){a=!0,i=u}finally{try{n||null==s.return||s.return()}finally{if(a)throw i}}return t}}function c(e){if(Array.isArray(e))return e}function l(e){return h(e)||p(e)||f(e)||d()}function d(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function f(e,r){if(e){if("string"==typeof e)return v(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?v(e,r):void 0}}function p(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function h(e){if(Array.isArray(e))return v(e)}function v(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function y(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function b(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function m(e,r,t){return r&&b(e.prototype,r),t&&b(e,t),e}var g=require("debug"),w=Object.assign(g("libp2p:dialer"),{error:g("libp2p:dialer:err")}),k=require("err-code"),O=require("multiaddr"),S=O.Multiaddr,P=require("timeout-abort-controller"),D=require("any-signal"),_=D.anySignal,A=require("./dial-request"),x=require("libp2p-utils/src/address-sort"),R=x.publicAddressesFirst,j=require("../get-peer"),E=require("../errors"),q=E.codes,T=require("../constants"),I=T.DIAL_TIMEOUT,M=T.MAX_PARALLEL_DIALS,L=T.MAX_PER_PEER_DIALS,B=function(){function e(r){var t=r.transportManager,n=r.peerStore,a=r.addressSorter,i=void 0===a?R:a,s=r.maxParallelDials,u=void 0===s?M:s,c=r.dialTimeout,d=void 0===c?I:c,f=r.maxDialsPerPeer,p=void 0===f?L:f,h=r.resolvers,v=void 0===h?{}:h;y(this,e),this.transportManager=t,this.peerStore=n,this.addressSorter=i,this.maxParallelDials=u,this.timeout=d,this.maxDialsPerPeer=p,this.tokens=l(new Array(u)).map(function(e,r){return r}),this._pendingDials=new Map;for(var b=0,m=Object.entries(v);b<m.length;b++){var g=o(m[b],2),w=g[0],k=g[1];S.resolvers.set(w,k)}}return m(e,[{key:"destroy",value:function(){var e,r=i(this._pendingDials.values());try{for(r.s();!(e=r.n()).done;){var t=e.value;try{t.controller.abort()}catch(n){w.error(n)}}}catch(n){r.e(n)}finally{r.f()}this._pendingDials.clear()}},{key:"connectToPeer",value:function(){var e=a(regeneratorRuntime.mark(function e(r){var t,n,a,i,o=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=o.length>1&&void 0!==o[1]?o[1]:{},e.next=3,this._createDialTarget(r);case 3:if((n=e.sent).addrs.length){e.next=6;break}throw k(new Error("The dial request has no addresses"),q.ERR_NO_VALID_ADDRESSES);case 6:return a=this._pendingDials.get(n.id)||this._createPendingDial(n,t),e.prev=7,e.next=10,a.promise;case 10:return i=e.sent,w("dial succeeded to %s",n.id),e.abrupt("return",i);case 15:throw e.prev=15,e.t0=e.catch(7),a.controller.signal.aborted&&(e.t0.code=q.ERR_TIMEOUT),w.error(e.t0),e.t0;case 20:return e.prev=20,a.destroy(),e.finish(20);case 23:case"end":return e.stop()}},e,this,[[7,15,20,23]])}));return function(r){return e.apply(this,arguments)}}()},{key:"_createDialTarget",value:function(){var e=a(regeneratorRuntime.mark(function e(r){var t,n,a,o,s,u,c,l;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=j(r),n=t.id,(a=t.multiaddrs)&&this.peerStore.addressBook.add(n,a),o=this.peerStore.addressBook.getMultiaddrsForPeer(n,this.addressSorter)||[],S.isMultiaddr(r)&&(o=o.filter(function(e){return!r.equals(e)})).unshift(r),s=[],u=i(o),e.prev=6,u.s();case 8:if((c=u.n()).done){e.next=16;break}return l=c.value,e.next=12,this._resolve(l);case 12:e.sent.forEach(function(e){return s.push(e)});case 14:e.next=8;break;case 16:e.next=21;break;case 18:e.prev=18,e.t0=e.catch(6),u.e(e.t0);case 21:return e.prev=21,u.f(),e.finish(21);case 24:return e.abrupt("return",{id:n.toB58String(),addrs:s});case 25:case"end":return e.stop()}},e,this,[[6,18,21,24]])}));return function(r){return e.apply(this,arguments)}}()},{key:"_createPendingDial",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=new A({addrs:e.addrs,dialAction:function(e,r){if(r.signal.aborted)throw k(new Error("already aborted"),q.ERR_ALREADY_ABORTED);return t.transportManager.dial(e,r)},dialer:this}),i=new P(this.timeout),o=[i.signal];n.signal&&o.push(n.signal);var s=_(o),u={dialRequest:a,controller:i,promise:a.run(r(r({},n),{},{signal:s})),destroy:function(){i.clear(),t._pendingDials.delete(e.id)}};return this._pendingDials.set(e.id,u),u}},{key:"getTokens",value:function(e){var r=Math.min(e,this.maxDialsPerPeer,this.tokens.length),t=this.tokens.splice(0,r);return w("%d tokens request, returning %d, %d remaining",e,r,this.tokens.length),t}},{key:"releaseToken",value:function(e){this.tokens.indexOf(e)>-1||(w("token %d released",e),this.tokens.push(e))}},{key:"_resolve",value:function(){var e=a(regeneratorRuntime.mark(function e(r){var t,n,a,i=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r.protoNames().includes("dnsaddr")){e.next=3;break}return e.abrupt("return",[r]);case 3:return e.next=5,this._resolveRecord(r);case 5:return t=e.sent,e.next=8,Promise.all(t.map(function(e){return i._resolve(e)}));case 8:return n=e.sent,a=n.flat(),e.abrupt("return",a.reduce(function(e,r){return e.find(function(e){return e.equals(r)})||e.push(r),e},[]));case 11:case"end":return e.stop()}},e,this)}));return function(r){return e.apply(this,arguments)}}()},{key:"_resolveRecord",value:function(){var e=a(regeneratorRuntime.mark(function e(r){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,r=new S(r.toString()),e.next=4,r.resolve();case 4:return t=e.sent,e.abrupt("return",t);case 8:return e.prev=8,e.t0=e.catch(0),w.error("multiaddr ".concat(r," could not be resolved")),e.abrupt("return",[]);case 12:case"end":return e.stop()}},e,null,[[0,8]])}));return function(r){return e.apply(this,arguments)}}()}]),e}();module.exports=B;
|
||
},{"debug":"F8gk","err-code":"hLMW","multiaddr":"fVn4","timeout-abort-controller":"K4iO","any-signal":"FfQr","./dial-request":"4Rgx","libp2p-utils/src/address-sort":"MtMt","../get-peer":"VGr2","../errors":"YLhd","../constants":"yxTM"}],"uwin":[function(require,module,exports) {
|
||
"use strict";function r(r){return r>=55296&&r<=56319}function t(r){return r>=56320&&r<=57343}module.exports=function(e,n,u){if("string"!=typeof n)throw new Error("Input must be string");for(var i,o,c=n.length,f=0,s=0;s<c;s+=1){if(i=n.charCodeAt(s),o=n[s],r(i)&&t(n.charCodeAt(s+1))&&(o+=n[s+=1]),(f+=e(o))===u)return n.slice(0,s+1);if(f>u)return n.slice(0,s-o.length+1)}return n};
|
||
},{}],"tgHa":[function(require,module,exports) {
|
||
"use strict";function n(n){return n>=55296&&n<=56319}function r(n){return n>=56320&&n<=57343}module.exports=function(t){if("string"!=typeof t)throw new Error("Input must be string");for(var u=t.length,e=0,o=null,l=null,i=0;i<u;i++)r(o=t.charCodeAt(i))?null!=l&&n(l)?e+=1:e+=3:o<=127?e+=1:o>=128&&o<=2047?e+=2:o>=2048&&o<=65535&&(e+=3),l=o;return e};
|
||
},{}],"6Kx5":[function(require,module,exports) {
|
||
"use strict";var e=require("./lib/truncate"),r=require("utf8-byte-length/browser");module.exports=e.bind(null,r);
|
||
},{"./lib/truncate":"uwin","utf8-byte-length/browser":"tgHa"}],"1cON":[function(require,module,exports) {
|
||
"use strict";var e=require("truncate-utf8-bytes"),r=/[\/\?<>\\:\*\|"]/g,t=/[\x00-\x1f\x80-\x9f]/g,n=/^\.+$/,u=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i,c=/[\. ]+$/;function a(a,p){if("string"!=typeof a)throw new Error("Input must be string");var l=a.replace(r,p).replace(t,p).replace(n,p).replace(u,p).replace(c,p);return e(l,255)}module.exports=function(e,r){var t=r&&r.replacement||"",n=a(e,t);return""===t?n:a(n,"")};
|
||
},{"truncate-utf8-bytes":"6Kx5"}],"FTyi":[function(require,module,exports) {
|
||
"use strict";require("node-forge/lib/aes");var e=require("node-forge/lib/forge"),r=require("uint8arrays/to-string"),i=require("uint8arrays/from-string");module.exports={createCipheriv:function(t,a,u){var c=e.cipher.createCipher("AES-CTR",r(a,"ascii"));return c.start({iv:r(u,"ascii")}),{update:function(t){return c.update(e.util.createBuffer(r(t,"ascii"))),i(c.output.getBytes(),"ascii")}}},createDecipheriv:function(t,a,u){var c=e.cipher.createDecipher("AES-CTR",r(a,"ascii"));return c.start({iv:r(u,"ascii")}),{update:function(t){return c.update(e.util.createBuffer(r(t,"ascii"))),i(c.output.getBytes(),"ascii")}}}};
|
||
},{"node-forge/lib/aes":"bEBs","node-forge/lib/forge":"sQ2N","uint8arrays/to-string":"aFN1","uint8arrays/from-string":"YqS+"}],"Zyc6":[function(require,module,exports) {
|
||
"use strict";function r(r,n){return a(r)||o(r,n)||e(r,n)||t()}function t(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function e(r,t){if(r){if("string"==typeof r)return n(r,t);var e=Object.prototype.toString.call(r).slice(8,-1);return"Object"===e&&r.constructor&&(e=r.constructor.name),"Map"===e||"Set"===e?Array.from(r):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?n(r,t):void 0}}function n(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=r[e];return n}function o(r,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(r)){var e=[],n=!0,o=!1,a=void 0;try{for(var i,c=r[Symbol.iterator]();!(n=(i=c.next()).done)&&(e.push(i.value),!t||e.length!==t);n=!0);}catch(u){o=!0,a=u}finally{try{n||null==c.return||c.return()}finally{if(o)throw a}}return e}}function a(r){if(Array.isArray(r))return r}var i=require("err-code"),c={16:"aes-128-ctr",32:"aes-256-ctr"};module.exports=function(t){var e=c[t.length];if(!e){var n=Object.entries(c).map(function(t){var e=r(t,2),n=e[0],o=e[1];return"".concat(n," (").concat(o,")")}).join(" / ");throw i(new Error("Invalid key length ".concat(t.length," bytes. Must be ").concat(n)),"ERR_INVALID_KEY_LENGTH")}return e};
|
||
},{"err-code":"hLMW"}],"BeUG":[function(require,module,exports) {
|
||
"use strict";function r(r,e,t,n,u,i,a){try{var c=r[i](a),o=c.value}catch(p){return void t(p)}c.done?e(o):Promise.resolve(o).then(n,u)}function e(e){return function(){var t=this,n=arguments;return new Promise(function(u,i){var a=e.apply(t,n);function c(e){r(a,u,i,c,o,"next",e)}function o(e){r(a,u,i,c,o,"throw",e)}c(void 0)})}}var t=require("./ciphers"),n=require("./cipher-mode");exports.create=function(){var r=e(regeneratorRuntime.mark(function r(u,i){var a,c,o,p;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return a=n(u),c=t.createCipheriv(a,u,i),o=t.createDecipheriv(a,u,i),p={encrypt:function(){var r=e(regeneratorRuntime.mark(function r(e){return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",c.update(e));case 1:case"end":return r.stop()}},r)}));return function(e){return r.apply(this,arguments)}}(),decrypt:function(){var r=e(regeneratorRuntime.mark(function r(e){return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",o.update(e));case 1:case"end":return r.stop()}},r)}));return function(e){return r.apply(this,arguments)}}()},r.abrupt("return",p);case 5:case"end":return r.stop()}},r)}));return function(e,t){return r.apply(this,arguments)}}();
|
||
},{"./ciphers":"FTyi","./cipher-mode":"Zyc6"}],"1Qfu":[function(require,module,exports) {
|
||
"use strict";var r=require("node-forge/lib/pbkdf2"),e=require("node-forge/lib/util"),o=require("err-code"),n={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};function s(s,a,t,i,u){var c=n[u];if(!c){var h=Object.keys(n).join(" / ");throw o(new Error("Hash '".concat(u,"' is unknown or not supported. Must be ").concat(h)),"ERR_UNSUPPORTED_HASH_TYPE")}var d=r(s,a,t,i,c);return e.encode64(d)}module.exports=s;
|
||
},{"node-forge/lib/pbkdf2":"3jih","node-forge/lib/util":"2MJg","err-code":"hLMW"}],"Gcnt":[function(require,module,exports) {
|
||
"use strict";var e=require("./hmac"),r=require("./aes"),s=require("./keys");exports.aes=r,exports.hmac=e,exports.keys=s,exports.randomBytes=require("./random-bytes"),exports.pbkdf2=require("./pbkdf2");
|
||
},{"./hmac":"ncbB","./aes":"BeUG","./keys":"h7X6","./random-bytes":"qZiD","./pbkdf2":"1Qfu"}],"6Lkw":[function(require,module,exports) {
|
||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.urlAlphabet=void 0;let e="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW";exports.urlAlphabet=e;
|
||
},{}],"amA4":[function(require,module,exports) {
|
||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"urlAlphabet",{enumerable:!0,get:function(){return e.urlAlphabet}}),exports.random=exports.customRandom=exports.customAlphabet=exports.nanoid=void 0;var e=require("./url-alphabet/index.js");if("undefined"!=typeof navigator&&"ReactNative"===navigator.product&&"undefined"==typeof crypto)throw new Error("React Native does not have a built-in secure random generator. If you don’t need unpredictable IDs use `nanoid/non-secure`. For secure IDs, import `react-native-get-random-values` before Nano ID.");if("undefined"!=typeof msCrypto&&"undefined"==typeof crypto)throw new Error("Import file with `if (!window.crypto) window.crypto = window.msCrypto` before importing Nano ID to fix IE 11 support");if("undefined"==typeof crypto)throw new Error("Your browser does not have secure random generator. If you don’t need unpredictable IDs, you can use nanoid/non-secure.");var r=function(e){return crypto.getRandomValues(new Uint8Array(e))};exports.random=r;var o=function(e,r,o){var t=(2<<Math.log(e.length-1)/Math.LN2)-1,n=-~(1.6*t*r/e.length);return function(){for(var a="";;)for(var i=o(n),u=n;u--;)if((a+=e[i[u]&t]||"").length===r)return a}};exports.customRandom=o;var t=function(e,t){return o(e,t,r)};exports.customAlphabet=t;var n=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:21,r="",o=crypto.getRandomValues(new Uint8Array(e));e--;){var t=63&o[e];r+=t<36?t.toString(36):t<62?(t-26).toString(36).toUpperCase():t<63?"_":"-"}return r};exports.nanoid=n;
|
||
},{"./url-alphabet/index.js":"6Lkw"}],"Jmrd":[function(require,module,exports) {
|
||
"use strict";const{nanoid:e}=require("nanoid"),n=(n=(e=>e))=>n(e());module.exports=n;
|
||
},{"nanoid":"amA4"}],"9Qpx":[function(require,module,exports) {
|
||
"use strict";const t=require("ipfs-utils/src/temp-dir"),e=new TextEncoder,o=new TextDecoder("utf8"),n=(t,e)=>(async function*(){for await(const o of t){await e(o)&&(yield o)}})(),r=(t,e)=>(async function*(){let o=[];for await(const e of t)o.push(e);o=await e(o);for(const t of o)yield t})(),i=(t,e)=>(async function*(){if(e<=0)return;let o=0;for await(const n of t)if(yield n,++o>=e)return})(),c=(t,e)=>(async function*(){for await(const o of t)yield e(o)})(),a=(t,e)=>{const o=new RegExp("^"+e);return t.replace(o,"")};module.exports={map:c,take:i,sortAll:r,filter:n,utf8Encoder:e,utf8Decoder:o,tmpdir:t,replaceStartWith:a};
|
||
},{"ipfs-utils/src/temp-dir":"Jmrd"}],"H2gD":[function(require,module,exports) {
|
||
"use strict";const{nanoid:t}=require("nanoid"),{utf8Encoder:e,utf8Decoder:n}=require("./utils"),r=Symbol.for("@ipfs/interface-datastore/key"),i="/",s=e.encode(i),o=s[0];class h{constructor(t,n){if("string"==typeof t)this._buf=e.encode(t);else{if(!(t instanceof Uint8Array))throw new Error("Invalid key, should be String of Uint8Array");this._buf=t}if(null==n&&(n=!0),n&&this.clean(),0===this._buf.byteLength||this._buf[0]!==o)throw new Error("Invalid key")}toString(t="utf8"){return"utf8"===t||"utf-8"===t?n.decode(this._buf):new TextDecoder(t).decode(this._buf)}uint8Array(){return this._buf}get[r](){return!0}get[Symbol.toStringTag](){return`Key(${this.toString()})`}static withNamespaces(t){return new h(t.join(i))}static random(){return new h(t().replace(/-/g,""))}clean(){if(this._buf&&0!==this._buf.byteLength||(this._buf=s),this._buf[0]!==o){const t=new Uint8Array(this._buf.byteLength+1);t.fill(o,0,1),t.set(this._buf,1),this._buf=t}for(;this._buf.byteLength>1&&this._buf[this._buf.byteLength-1]===o;)this._buf=this._buf.subarray(0,-1)}less(t){const e=this.list(),n=t.list();for(let r=0;r<e.length;r++){if(n.length<r+1)return!1;const t=e[r],i=n[r];if(t<i)return!0;if(t>i)return!1}return e.length<n.length}reverse(){return h.withNamespaces(this.list().slice().reverse())}namespaces(){return this.list()}baseNamespace(){const t=this.namespaces();return t[t.length-1]}list(){return this.toString().split(i).slice(1)}type(){return u(this.baseNamespace())}name(){return a(this.baseNamespace())}instance(t){return new h(this.toString()+":"+t)}path(){let t=this.parent().toString();return t.endsWith(i)||(t+=i),t+=this.type(),new h(t)}parent(){const t=this.list();return 1===t.length?new h(i):new h(t.slice(0,-1).join(i))}child(t){return this.toString()===i?t:t.toString()===i?this:new h(this.toString()+t.toString(),!1)}isAncestorOf(t){return t.toString()!==this.toString()&&t.toString().startsWith(this.toString())}isDecendantOf(t){return t.toString()!==this.toString()&&this.toString().startsWith(t.toString())}isTopLevel(){return 1===this.list().length}concat(...t){return h.withNamespaces([...this.namespaces(),...c(t.map(t=>t.namespaces()))])}static isKey(t){return t instanceof h||Boolean(t&&t[r])}}function u(t){const e=t.split(":");return e.length<2?"":e.slice(0,-1).join(":")}function a(t){const e=t.split(":");return e[e.length-1]}function c(t){return[].concat(...t)}module.exports=h;
|
||
},{"nanoid":"amA4","./utils":"9Qpx"}],"Mi47":[function(require,module,exports) {
|
||
"use strict";const{filter:e,sortAll:t,take:r,map:i}=require("./utils"),s=require("it-drain");class n{open(){return Promise.reject(new Error(".open is not implemented"))}close(){return Promise.reject(new Error(".close is not implemented"))}put(e,t,r){return Promise.reject(new Error(".put is not implemented"))}get(e,t){return Promise.reject(new Error(".get is not implemented"))}has(e,t){return Promise.reject(new Error(".has is not implemented"))}delete(e,t){return Promise.reject(new Error(".delete is not implemented"))}async*putMany(e,t={}){for await(const{key:r,value:i}of e)await this.put(r,i,t),yield{key:r,value:i}}async*getMany(e,t={}){for await(const r of e)yield this.get(r,t)}async*deleteMany(e,t={}){for await(const r of e)await this.delete(r,t),yield r}batch(){let e=[],t=[];return{put(t,r){e.push({key:t,value:r})},delete(e){t.push(e)},commit:async r=>{await s(this.putMany(e,r)),e=[],await s(this.deleteMany(t,r)),t=[]}}}async*_all(e,t){throw new Error("._all is not implemented")}query(s,n){let l=this._all(s,n);if(null!=s.prefix&&(l=e(l,e=>e.key.toString().startsWith(s.prefix))),Array.isArray(s.filters)&&(l=s.filters.reduce((t,r)=>e(t,r),l)),Array.isArray(s.orders)&&(l=s.orders.reduce((e,r)=>t(e,r),l)),null!=s.offset){let t=0;l=e(l,()=>t++>=s.offset)}return null!=s.limit&&(l=r(l,s.limit)),!0===s.keysOnly?i(l,e=>({key:e.key})):l}}module.exports=n;
|
||
},{"./utils":"9Qpx","it-drain":"0gYD"}],"GkzB":[function(require,module,exports) {
|
||
"use strict";const r=require("err-code");function e(e){return e=e||new Error("Cannot open database"),r(e,"ERR_DB_OPEN_FAILED")}function n(e){return e=e||new Error("Delete failed"),r(e,"ERR_DB_DELETE_FAILED")}function o(e){return e=e||new Error("Write failed"),r(e,"ERR_DB_WRITE_FAILED")}function t(e){return e=e||new Error("Not Found"),r(e,"ERR_NOT_FOUND")}function E(e){return e=e||new Error("Aborted"),r(e,"ERR_ABORTED")}module.exports={dbOpenFailedError:e,dbDeleteFailedError:n,dbWriteFailedError:o,notFoundError:t,abortedError:E};
|
||
},{"err-code":"hLMW"}],"GuSg":[function(require,module,exports) {
|
||
"use strict";const t=require("./key"),e=require("./adapter"),r=require("./errors");class s extends e{constructor(){super(),this.data={}}open(){return Promise.resolve()}close(){return Promise.resolve()}async put(t,e){this.data[t.toString()]=e}async get(t){if(!(await this.has(t)))throw r.notFoundError();return this.data[t.toString()]}async has(t){return void 0!==this.data[t.toString()]}async delete(t){delete this.data[t.toString()]}async*_all(){yield*Object.entries(this.data).map(([e,r])=>({key:new t(e),value:r}))}}module.exports=s;
|
||
},{"./key":"H2gD","./adapter":"Mi47","./errors":"GkzB"}],"q9af":[function(require,module,exports) {
|
||
"use strict";const r=require("./key"),e=require("./memory"),t=require("./utils"),s=require("./errors"),u=require("./adapter");module.exports={Key:r,MemoryDatastore:e,utils:t,Errors:s,Adapter:u};
|
||
},{"./key":"H2gD","./memory":"GuSg","./utils":"9Qpx","./errors":"GkzB","./adapter":"Mi47"}],"DHZ3":[function(require,module,exports) {
|
||
var e=require("./forge");require("./asn1"),require("./util");var t=e.asn1,a=module.exports=e.pkcs7asn1=e.pkcs7asn1||{};e.pkcs7=e.pkcs7||{},e.pkcs7.asn1=a;var s={name:"ContentInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};a.contentInfoValidator=s;var n={name:"EncryptedContentInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:t.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};a.envelopedDataValidator={name:"EnvelopedData",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(n)},a.encryptedDataValidator={name:"EncryptedData",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"}].concat(n)};var r={name:"SignerInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:t.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:t.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};a.signedDataValidator={name:"SignedData",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},s,{name:"SignedData.Certificates",tagClass:t.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:t.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:t.Class.UNIVERSAL,type:t.Type.SET,capture:"signerInfos",optional:!0,value:[r]}]},a.recipientInfoValidator={name:"RecipientInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:t.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter"}]},{name:"RecipientInfo.encryptedKey",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]};
|
||
},{"./forge":"sQ2N","./asn1":"RZRC","./util":"2MJg"}],"Ba0z":[function(require,module,exports) {
|
||
var e=require("./forge");require("./util"),e.mgf=e.mgf||{};var t=module.exports=e.mgf.mgf1=e.mgf1=e.mgf1||{};t.create=function(t){return{generate:function(r,u){for(var f=new e.util.ByteBuffer,g=Math.ceil(u/t.digestLength),n=0;n<g;n++){var a=new e.util.ByteBuffer;a.putInt32(n),t.start(),t.update(r+a.getBytes()),f.putBuffer(t.digest())}return f.truncate(f.length()-u),f.getBytes()}}};
|
||
},{"./forge":"sQ2N","./util":"2MJg"}],"uIaZ":[function(require,module,exports) {
|
||
var e=require("./forge");require("./mgf1"),module.exports=e.mgf=e.mgf||{},e.mgf.mgf1=e.mgf1;
|
||
},{"./forge":"sQ2N","./mgf1":"Ba0z"}],"JMzF":[function(require,module,exports) {
|
||
var t=require("./forge");require("./random"),require("./util");var e=module.exports=t.pss=t.pss||{};e.create=function(e){3===arguments.length&&(e={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var r,o=e.md,n=e.mgf,s=o.digestLength,a=e.salt||null;if("string"==typeof a&&(a=t.util.createBuffer(a)),"saltLength"in e)r=e.saltLength;else{if(null===a)throw new Error("Salt length not specified or specific salt not given.");r=a.length()}if(null!==a&&a.length()!==r)throw new Error("Given salt length does not match length of given salt.");var i=e.prng||t.random,f={encode:function(e,f){var g,u,h=f-1,l=Math.ceil(h/8),d=e.digest().getBytes();if(l<s+r+2)throw new Error("Message is too long to encrypt.");u=null===a?i.getBytesSync(r):a.bytes();var c=new t.util.ByteBuffer;c.fillWithByte(0,8),c.putBytes(d),c.putBytes(u),o.start(),o.update(c.getBytes());var y=o.digest().getBytes(),B=new t.util.ByteBuffer;B.fillWithByte(0,l-r-s-2),B.putByte(1),B.putBytes(u);var C=B.getBytes(),p=l-s-1,v=n.generate(y,p),w="";for(g=0;g<p;g++)w+=String.fromCharCode(C.charCodeAt(g)^v.charCodeAt(g));var m=65280>>8*l-h&255;return(w=String.fromCharCode(w.charCodeAt(0)&~m)+w.substr(1))+y+String.fromCharCode(188)},verify:function(e,a,i){var f,g=i-1,u=Math.ceil(g/8);if(a=a.substr(-u),u<s+r+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(188!==a.charCodeAt(u-1))throw new Error("Encoded message does not end in 0xBC.");var h=u-s-1,l=a.substr(0,h),d=a.substr(h,s),c=65280>>8*u-g&255;if(0!=(l.charCodeAt(0)&c))throw new Error("Bits beyond keysize not zero as expected.");var y=n.generate(d,h),B="";for(f=0;f<h;f++)B+=String.fromCharCode(l.charCodeAt(f)^y.charCodeAt(f));B=String.fromCharCode(B.charCodeAt(0)&~c)+B.substr(1);var C=u-s-r-2;for(f=0;f<C;f++)if(0!==B.charCodeAt(f))throw new Error("Leftmost octets not zero as expected");if(1!==B.charCodeAt(C))throw new Error("Inconsistent PSS signature, 0x01 marker not found");var p=B.substr(-r),v=new t.util.ByteBuffer;return v.fillWithByte(0,8),v.putBytes(e),v.putBytes(p),o.start(),o.update(v.getBytes()),d===o.digest().getBytes()}};return f};
|
||
},{"./forge":"sQ2N","./random":"b05L","./util":"2MJg"}],"pgVB":[function(require,module,exports) {
|
||
function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}var t=require("./forge");require("./aes"),require("./asn1"),require("./des"),require("./md"),require("./mgf"),require("./oids"),require("./pem"),require("./pss"),require("./rsa"),require("./util");var r=t.asn1,a=module.exports=t.pki=t.pki||{},i=a.oids,s={};s.CN=i.commonName,s.commonName="CN",s.C=i.countryName,s.countryName="C",s.L=i.localityName,s.localityName="L",s.ST=i.stateOrProvinceName,s.stateOrProvinceName="ST",s.O=i.organizationName,s.organizationName="O",s.OU=i.organizationalUnitName,s.organizationalUnitName="OU",s.E=i.emailAddress,s.emailAddress="E";var n=t.pki.rsa.publicKeyValidator,o={name:"Certificate",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:r.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:r.Class.UNIVERSAL,type:r.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:r.Class.UNIVERSAL,type:r.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:r.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:r.Class.UNIVERSAL,type:r.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:r.Class.UNIVERSAL,type:r.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:r.Class.UNIVERSAL,type:r.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:r.Class.UNIVERSAL,type:r.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},n,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:r.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:r.Class.UNIVERSAL,type:r.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:r.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:r.Class.UNIVERSAL,type:r.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:r.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:r.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:r.Class.UNIVERSAL,type:r.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},u={name:"rsapss",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:r.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:r.Class.UNIVERSAL,type:r.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:r.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:r.Class.UNIVERSAL,type:r.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:r.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:r.Class.UNIVERSAL,type:r.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:r.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:r.Class.UNIVERSAL,type:r.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},c={name:"CertificationRequestInfo",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:r.Class.UNIVERSAL,type:r.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},n,{name:"CertificationRequestInfo.attributes",tagClass:r.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:r.Class.UNIVERSAL,type:r.Type.SET,constructed:!0}]}]}]},l={name:"CertificationRequest",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[c,{name:"CertificationRequest.signatureAlgorithm",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:r.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:r.Class.UNIVERSAL,type:r.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};function d(e,t){"string"==typeof t&&(t={shortName:t});for(var r,a=null,i=0;null===a&&i<e.attributes.length;++i)r=e.attributes[i],t.type&&t.type===r.type?a=r:t.name&&t.name===r.name?a=r:t.shortName&&t.shortName===r.shortName&&(a=r);return a}a.RDNAttributesAsArray=function(e,t){for(var a,n,o,u=[],c=0;c<e.value.length;++c){a=e.value[c];for(var l=0;l<a.value.length;++l)o={},n=a.value[l],o.type=r.derToOid(n.value[0].value),o.value=n.value[1].value,o.valueTagClass=n.value[1].type,o.type in i&&(o.name=i[o.type],o.name in s&&(o.shortName=s[o.name])),t&&(t.update(o.type),t.update(o.value)),u.push(o)}return u},a.CRIAttributesAsArray=function(e){for(var t=[],n=0;n<e.length;++n)for(var o=e[n],u=r.derToOid(o.value[0].value),c=o.value[1].value,l=0;l<c.length;++l){var d={};if(d.type=u,d.value=c[l].value,d.valueTagClass=c[l].type,d.type in i&&(d.name=i[d.type],d.name in s&&(d.shortName=s[d.name])),d.type===i.extensionRequest){d.extensions=[];for(var f=0;f<d.value.length;++f)d.extensions.push(a.certificateExtensionFromAsn1(d.value[f]))}t.push(d)}return t};var f=function(e,t,a){var s={};if(e!==i["RSASSA-PSS"])return s;a&&(s={hash:{algorithmOid:i.sha1},mgf:{algorithmOid:i.mgf1,hash:{algorithmOid:i.sha1}},saltLength:20});var n={},o=[];if(!r.validate(t,u,n,o)){var c=new Error("Cannot read RSASSA-PSS parameter block.");throw c.errors=o,c}return void 0!==n.hashOid&&(s.hash=s.hash||{},s.hash.algorithmOid=r.derToOid(n.hashOid)),void 0!==n.maskGenOid&&(s.mgf=s.mgf||{},s.mgf.algorithmOid=r.derToOid(n.maskGenOid),s.mgf.hash=s.mgf.hash||{},s.mgf.hash.algorithmOid=r.derToOid(n.maskGenHashOid)),void 0!==n.saltLength&&(s.saltLength=n.saltLength.charCodeAt(0)),s};function C(e){for(var a,i,s=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[]),n=e.attributes,o=0;o<n.length;++o){var u=(a=n[o]).value,c=r.Type.PRINTABLESTRING;"valueTagClass"in a&&(c=a.valueTagClass)===r.Type.UTF8&&(u=t.util.encodeUtf8(u)),i=r.create(r.Class.UNIVERSAL,r.Type.SET,!0,[r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(a.type).getBytes()),r.create(r.Class.UNIVERSAL,c,!1,u)])]),s.value.push(i)}return s}function m(e){for(var a={},i=0;i<e.length;++i){var s=e[i];if(s.shortName&&(s.valueTagClass===r.Type.UTF8||s.valueTagClass===r.Type.PRINTABLESTRING||s.valueTagClass===r.Type.IA5STRING)){var n=s.value;s.valueTagClass===r.Type.UTF8&&(n=t.util.encodeUtf8(s.value)),s.shortName in a?t.util.isArray(a[s.shortName])?a[s.shortName].push(n):a[s.shortName]=[a[s.shortName],n]:a[s.shortName]=n}}return a}function p(e){for(var t,n=0;n<e.length;++n){if(void 0===(t=e[n]).name&&(t.type&&t.type in a.oids?t.name=a.oids[t.type]:t.shortName&&t.shortName in s&&(t.name=a.oids[s[t.shortName]])),void 0===t.type){if(!(t.name&&t.name in a.oids))throw(u=new Error("Attribute type not specified.")).attribute=t,u;t.type=a.oids[t.name]}if(void 0===t.shortName&&t.name&&t.name in s&&(t.shortName=s[t.name]),t.type===i.extensionRequest&&(t.valueConstructed=!0,t.valueTagClass=r.Type.SEQUENCE,!t.value&&t.extensions)){t.value=[];for(var o=0;o<t.extensions.length;++o)t.value.push(a.certificateExtensionToAsn1(h(t.extensions[o])))}var u;if(void 0===t.value)throw(u=new Error("Attribute value not specified.")).attribute=t,u}}function h(e,s){if(s=s||{},void 0===e.name&&e.id&&e.id in a.oids&&(e.name=a.oids[e.id]),void 0===e.id){if(!(e.name&&e.name in a.oids))throw(T=new Error("Extension ID not specified.")).extension=e,T;e.id=a.oids[e.name]}if(void 0!==e.value)return e;if("keyUsage"===e.name){var n=0,o=0,u=0;e.digitalSignature&&(o|=128,n=7),e.nonRepudiation&&(o|=64,n=6),e.keyEncipherment&&(o|=32,n=5),e.dataEncipherment&&(o|=16,n=4),e.keyAgreement&&(o|=8,n=3),e.keyCertSign&&(o|=4,n=2),e.cRLSign&&(o|=2,n=1),e.encipherOnly&&(o|=1,n=0),e.decipherOnly&&(u|=128,n=7);var c=String.fromCharCode(n);0!==u?c+=String.fromCharCode(o)+String.fromCharCode(u):0!==o&&(c+=String.fromCharCode(o)),e.value=r.create(r.Class.UNIVERSAL,r.Type.BITSTRING,!1,c)}else if("basicConstraints"===e.name)e.value=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[]),e.cA&&e.value.value.push(r.create(r.Class.UNIVERSAL,r.Type.BOOLEAN,!1,String.fromCharCode(255))),"pathLenConstraint"in e&&e.value.value.push(r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,r.integerToDer(e.pathLenConstraint).getBytes()));else if("extKeyUsage"===e.name){e.value=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[]);var l=e.value.value;for(var d in e)!0===e[d]&&(d in i?l.push(r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(i[d]).getBytes())):-1!==d.indexOf(".")&&l.push(r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(d).getBytes())))}else if("nsCertType"===e.name){n=0,o=0;e.client&&(o|=128,n=7),e.server&&(o|=64,n=6),e.email&&(o|=32,n=5),e.objsign&&(o|=16,n=4),e.reserved&&(o|=8,n=3),e.sslCA&&(o|=4,n=2),e.emailCA&&(o|=2,n=1),e.objCA&&(o|=1,n=0);c=String.fromCharCode(n);0!==o&&(c+=String.fromCharCode(o)),e.value=r.create(r.Class.UNIVERSAL,r.Type.BITSTRING,!1,c)}else if("subjectAltName"===e.name||"issuerAltName"===e.name){e.value=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[]);for(var f=0;f<e.altNames.length;++f){c=(E=e.altNames[f]).value;if(7===E.type&&E.ip){if(null===(c=t.util.bytesFromIP(E.ip)))throw(T=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=e,T}else 8===E.type&&(c=E.oid?r.oidToDer(r.oidToDer(E.oid)):r.oidToDer(c));e.value.value.push(r.create(r.Class.CONTEXT_SPECIFIC,E.type,!1,c))}}else if("nsComment"===e.name&&s.cert){if(!/^[\x00-\x7F]*$/.test(e.comment)||e.comment.length<1||e.comment.length>128)throw new Error('Invalid "nsComment" content.');e.value=r.create(r.Class.UNIVERSAL,r.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&s.cert){var m=s.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=m.toHex(),e.value=r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,m.getBytes())}else if("authorityKeyIdentifier"===e.name&&s.cert){e.value=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[]);l=e.value.value;if(e.keyIdentifier){var p=!0===e.keyIdentifier?s.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;l.push(r.create(r.Class.CONTEXT_SPECIFIC,0,!1,p))}if(e.authorityCertIssuer){var h=[r.create(r.Class.CONTEXT_SPECIFIC,4,!0,[C(!0===e.authorityCertIssuer?s.cert.issuer:e.authorityCertIssuer)])];l.push(r.create(r.Class.CONTEXT_SPECIFIC,1,!0,h))}if(e.serialNumber){var g=t.util.hexToBytes(!0===e.serialNumber?s.cert.serialNumber:e.serialNumber);l.push(r.create(r.Class.CONTEXT_SPECIFIC,2,!1,g))}}else if("cRLDistributionPoints"===e.name){e.value=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[]);l=e.value.value;var E,y=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[]),v=r.create(r.Class.CONTEXT_SPECIFIC,0,!0,[]);for(f=0;f<e.altNames.length;++f){c=(E=e.altNames[f]).value;if(7===E.type&&E.ip){if(null===(c=t.util.bytesFromIP(E.ip)))throw(T=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=e,T}else 8===E.type&&(c=E.oid?r.oidToDer(r.oidToDer(E.oid)):r.oidToDer(c));v.value.push(r.create(r.Class.CONTEXT_SPECIFIC,E.type,!1,c))}y.value.push(r.create(r.Class.CONTEXT_SPECIFIC,0,!0,[v])),l.push(y)}var T;if(void 0===e.value)throw(T=new Error("Extension value not specified.")).extension=e,T;return e}function g(e,t){switch(e){case i["RSASSA-PSS"]:var a=[];return void 0!==t.hash.algorithmOid&&a.push(r.create(r.Class.CONTEXT_SPECIFIC,0,!0,[r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(t.hash.algorithmOid).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.NULL,!1,"")])])),void 0!==t.mgf.algorithmOid&&a.push(r.create(r.Class.CONTEXT_SPECIFIC,1,!0,[r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(t.mgf.algorithmOid).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(t.mgf.hash.algorithmOid).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.NULL,!1,"")])])])),void 0!==t.saltLength&&a.push(r.create(r.Class.CONTEXT_SPECIFIC,2,!0,[r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,r.integerToDer(t.saltLength).getBytes())])),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,a);default:return r.create(r.Class.UNIVERSAL,r.Type.NULL,!1,"")}}function E(e){var a=r.create(r.Class.CONTEXT_SPECIFIC,0,!0,[]);if(0===e.attributes.length)return a;for(var i=e.attributes,s=0;s<i.length;++s){var n=i[s],o=n.value,u=r.Type.UTF8;"valueTagClass"in n&&(u=n.valueTagClass),u===r.Type.UTF8&&(o=t.util.encodeUtf8(o));var c=!1;"valueConstructed"in n&&(c=n.valueConstructed);var l=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(n.type).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SET,!0,[r.create(r.Class.UNIVERSAL,u,c,o)])]);a.value.push(l)}return a}a.certificateFromPem=function(e,i,s){var n=t.pem.decode(e)[0];if("CERTIFICATE"!==n.type&&"X509 CERTIFICATE"!==n.type&&"TRUSTED CERTIFICATE"!==n.type){var o=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw o.headerType=n.type,o}if(n.procType&&"ENCRYPTED"===n.procType.type)throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var u=r.fromDer(n.body,s);return a.certificateFromAsn1(u,i)},a.certificateToPem=function(e,i){var s={type:"CERTIFICATE",body:r.toDer(a.certificateToAsn1(e)).getBytes()};return t.pem.encode(s,{maxline:i})},a.publicKeyFromPem=function(e){var i=t.pem.decode(e)[0];if("PUBLIC KEY"!==i.type&&"RSA PUBLIC KEY"!==i.type){var s=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw s.headerType=i.type,s}if(i.procType&&"ENCRYPTED"===i.procType.type)throw new Error("Could not convert public key from PEM; PEM is encrypted.");var n=r.fromDer(i.body);return a.publicKeyFromAsn1(n)},a.publicKeyToPem=function(e,i){var s={type:"PUBLIC KEY",body:r.toDer(a.publicKeyToAsn1(e)).getBytes()};return t.pem.encode(s,{maxline:i})},a.publicKeyToRSAPublicKeyPem=function(e,i){var s={type:"RSA PUBLIC KEY",body:r.toDer(a.publicKeyToRSAPublicKey(e)).getBytes()};return t.pem.encode(s,{maxline:i})},a.getPublicKeyFingerprint=function(e,i){var s,n=(i=i||{}).md||t.md.sha1.create();switch(i.type||"RSAPublicKey"){case"RSAPublicKey":s=r.toDer(a.publicKeyToRSAPublicKey(e)).getBytes();break;case"SubjectPublicKeyInfo":s=r.toDer(a.publicKeyToAsn1(e)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+i.type+'".')}n.start(),n.update(s);var o=n.digest();if("hex"===i.encoding){var u=o.toHex();return i.delimiter?u.match(/.{2}/g).join(i.delimiter):u}if("binary"===i.encoding)return o.getBytes();if(i.encoding)throw new Error('Unknown encoding "'+i.encoding+'".');return o},a.certificationRequestFromPem=function(e,i,s){var n=t.pem.decode(e)[0];if("CERTIFICATE REQUEST"!==n.type){var o=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw o.headerType=n.type,o}if(n.procType&&"ENCRYPTED"===n.procType.type)throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var u=r.fromDer(n.body,s);return a.certificationRequestFromAsn1(u,i)},a.certificationRequestToPem=function(e,i){var s={type:"CERTIFICATE REQUEST",body:r.toDer(a.certificationRequestToAsn1(e)).getBytes()};return t.pem.encode(s,{maxline:i})},a.createCertificate=function(){var e={version:2,serialNumber:"00",signatureOid:null,signature:null,siginfo:{}};return e.siginfo.algorithmOid=null,e.validity={},e.validity.notBefore=new Date,e.validity.notAfter=new Date,e.issuer={},e.issuer.getField=function(t){return d(e.issuer,t)},e.issuer.addField=function(t){p([t]),e.issuer.attributes.push(t)},e.issuer.attributes=[],e.issuer.hash=null,e.subject={},e.subject.getField=function(t){return d(e.subject,t)},e.subject.addField=function(t){p([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.extensions=[],e.publicKey=null,e.md=null,e.setSubject=function(t,r){p(t),e.subject.attributes=t,delete e.subject.uniqueId,r&&(e.subject.uniqueId=r),e.subject.hash=null},e.setIssuer=function(t,r){p(t),e.issuer.attributes=t,delete e.issuer.uniqueId,r&&(e.issuer.uniqueId=r),e.issuer.hash=null},e.setExtensions=function(t){for(var r=0;r<t.length;++r)h(t[r],{cert:e});e.extensions=t},e.getExtension=function(t){"string"==typeof t&&(t={name:t});for(var r,a=null,i=0;null===a&&i<e.extensions.length;++i)r=e.extensions[i],t.id&&r.id===t.id?a=r:t.name&&r.name===t.name&&(a=r);return a},e.sign=function(s,n){e.md=n||t.md.sha1.create();var o=i[e.md.algorithm+"WithRSAEncryption"];if(!o){var u=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw u.algorithm=e.md.algorithm,u}e.signatureOid=e.siginfo.algorithmOid=o,e.tbsCertificate=a.getTBSCertificate(e);var c=r.toDer(e.tbsCertificate);e.md.update(c.getBytes()),e.signature=s.sign(e.md)},e.verify=function(s){var n=!1;if(!e.issued(s)){var o=s.issuer,u=e.subject;throw(p=new Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.")).expectedIssuer=o.attributes,p.actualIssuer=u.attributes,p}var c=s.md;if(null===c){if(s.signatureOid in i)switch(i[s.signatureOid]){case"sha1WithRSAEncryption":c=t.md.sha1.create();break;case"md5WithRSAEncryption":c=t.md.md5.create();break;case"sha256WithRSAEncryption":c=t.md.sha256.create();break;case"sha384WithRSAEncryption":c=t.md.sha384.create();break;case"sha512WithRSAEncryption":c=t.md.sha512.create();break;case"RSASSA-PSS":c=t.md.sha256.create()}if(null===c)throw(p=new Error("Could not compute certificate digest. Unknown signature OID.")).signatureOid=s.signatureOid,p;var l=s.tbsCertificate||a.getTBSCertificate(s),d=r.toDer(l);c.update(d.getBytes())}if(null!==c){var f;switch(s.signatureOid){case i.sha1WithRSAEncryption:f=void 0;break;case i["RSASSA-PSS"]:var C,m,p;if(void 0===(C=i[s.signatureParameters.mgf.hash.algorithmOid])||void 0===t.md[C])throw(p=new Error("Unsupported MGF hash function.")).oid=s.signatureParameters.mgf.hash.algorithmOid,p.name=C,p;if(void 0===(m=i[s.signatureParameters.mgf.algorithmOid])||void 0===t.mgf[m])throw(p=new Error("Unsupported MGF function.")).oid=s.signatureParameters.mgf.algorithmOid,p.name=m,p;if(m=t.mgf[m].create(t.md[C].create()),void 0===(C=i[s.signatureParameters.hash.algorithmOid])||void 0===t.md[C])throw{message:"Unsupported RSASSA-PSS hash function.",oid:s.signatureParameters.hash.algorithmOid,name:C};f=t.pss.create(t.md[C].create(),m,s.signatureParameters.saltLength)}n=e.publicKey.verify(c.digest().getBytes(),s.signature,f)}return n},e.isIssuer=function(t){var r=!1,a=e.issuer,i=t.subject;if(a.hash&&i.hash)r=a.hash===i.hash;else if(a.attributes.length===i.attributes.length){var s,n;r=!0;for(var o=0;r&&o<a.attributes.length;++o)s=a.attributes[o],n=i.attributes[o],s.type===n.type&&s.value===n.value||(r=!1)}return r},e.issued=function(t){return t.isIssuer(e)},e.generateSubjectKeyIdentifier=function(){return a.getPublicKeyFingerprint(e.publicKey,{type:"RSAPublicKey"})},e.verifySubjectKeyIdentifier=function(){for(var r=i.subjectKeyIdentifier,a=0;a<e.extensions.length;++a){var s=e.extensions[a];if(s.id===r){var n=e.generateSubjectKeyIdentifier().getBytes();return t.util.hexToBytes(s.subjectKeyIdentifier)===n}}return!1},e},a.certificateFromAsn1=function(e,s){var n={},u=[];if(!r.validate(e,o,n,u))throw(m=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.")).errors=u,m;if(r.derToOid(n.publicKeyOid)!==a.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var c=a.createCertificate();c.version=n.certVersion?n.certVersion.charCodeAt(0):0;var l=t.util.createBuffer(n.certSerialNumber);c.serialNumber=l.toHex(),c.signatureOid=t.asn1.derToOid(n.certSignatureOid),c.signatureParameters=f(c.signatureOid,n.certSignatureParams,!0),c.siginfo.algorithmOid=t.asn1.derToOid(n.certinfoSignatureOid),c.siginfo.parameters=f(c.siginfo.algorithmOid,n.certinfoSignatureParams,!1),c.signature=n.certSignature;var C=[];if(void 0!==n.certValidity1UTCTime&&C.push(r.utcTimeToDate(n.certValidity1UTCTime)),void 0!==n.certValidity2GeneralizedTime&&C.push(r.generalizedTimeToDate(n.certValidity2GeneralizedTime)),void 0!==n.certValidity3UTCTime&&C.push(r.utcTimeToDate(n.certValidity3UTCTime)),void 0!==n.certValidity4GeneralizedTime&&C.push(r.generalizedTimeToDate(n.certValidity4GeneralizedTime)),C.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(C.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(c.validity.notBefore=C[0],c.validity.notAfter=C[1],c.tbsCertificate=n.tbsCertificate,s){var m;if(c.md=null,c.signatureOid in i)switch(i[c.signatureOid]){case"sha1WithRSAEncryption":c.md=t.md.sha1.create();break;case"md5WithRSAEncryption":c.md=t.md.md5.create();break;case"sha256WithRSAEncryption":c.md=t.md.sha256.create();break;case"sha384WithRSAEncryption":c.md=t.md.sha384.create();break;case"sha512WithRSAEncryption":c.md=t.md.sha512.create();break;case"RSASSA-PSS":c.md=t.md.sha256.create()}if(null===c.md)throw(m=new Error("Could not compute certificate digest. Unknown signature OID.")).signatureOid=c.signatureOid,m;var h=r.toDer(c.tbsCertificate);c.md.update(h.getBytes())}var g=t.md.sha1.create();c.issuer.getField=function(e){return d(c.issuer,e)},c.issuer.addField=function(e){p([e]),c.issuer.attributes.push(e)},c.issuer.attributes=a.RDNAttributesAsArray(n.certIssuer,g),n.certIssuerUniqueId&&(c.issuer.uniqueId=n.certIssuerUniqueId),c.issuer.hash=g.digest().toHex();var E=t.md.sha1.create();return c.subject.getField=function(e){return d(c.subject,e)},c.subject.addField=function(e){p([e]),c.subject.attributes.push(e)},c.subject.attributes=a.RDNAttributesAsArray(n.certSubject,E),n.certSubjectUniqueId&&(c.subject.uniqueId=n.certSubjectUniqueId),c.subject.hash=E.digest().toHex(),n.certExtensions?c.extensions=a.certificateExtensionsFromAsn1(n.certExtensions):c.extensions=[],c.publicKey=a.publicKeyFromAsn1(n.subjectPublicKeyInfo),c},a.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r<e.value.length;++r)for(var i=e.value[r],s=0;s<i.value.length;++s)t.push(a.certificateExtensionFromAsn1(i.value[s]));return t},a.certificateExtensionFromAsn1=function(e){var a={};if(a.id=r.derToOid(e.value[0].value),a.critical=!1,e.value[1].type===r.Type.BOOLEAN?(a.critical=0!==e.value[1].value.charCodeAt(0),a.value=e.value[2].value):a.value=e.value[1].value,a.id in i)if(a.name=i[a.id],"keyUsage"===a.name){var s=0,n=0;(u=r.fromDer(a.value)).value.length>1&&(s=u.value.charCodeAt(1),n=u.value.length>2?u.value.charCodeAt(2):0),a.digitalSignature=128==(128&s),a.nonRepudiation=64==(64&s),a.keyEncipherment=32==(32&s),a.dataEncipherment=16==(16&s),a.keyAgreement=8==(8&s),a.keyCertSign=4==(4&s),a.cRLSign=2==(2&s),a.encipherOnly=1==(1&s),a.decipherOnly=128==(128&n)}else if("basicConstraints"===a.name){(u=r.fromDer(a.value)).value.length>0&&u.value[0].type===r.Type.BOOLEAN?a.cA=0!==u.value[0].value.charCodeAt(0):a.cA=!1;var o=null;u.value.length>0&&u.value[0].type===r.Type.INTEGER?o=u.value[0].value:u.value.length>1&&(o=u.value[1].value),null!==o&&(a.pathLenConstraint=r.derToInteger(o))}else if("extKeyUsage"===a.name)for(var u=r.fromDer(a.value),c=0;c<u.value.length;++c){var l=r.derToOid(u.value[c].value);l in i?a[i[l]]=!0:a[l]=!0}else if("nsCertType"===a.name){s=0;(u=r.fromDer(a.value)).value.length>1&&(s=u.value.charCodeAt(1)),a.client=128==(128&s),a.server=64==(64&s),a.email=32==(32&s),a.objsign=16==(16&s),a.reserved=8==(8&s),a.sslCA=4==(4&s),a.emailCA=2==(2&s),a.objCA=1==(1&s)}else if("subjectAltName"===a.name||"issuerAltName"===a.name){var d;a.altNames=[];u=r.fromDer(a.value);for(var f=0;f<u.value.length;++f){var C={type:(d=u.value[f]).type,value:d.value};switch(a.altNames.push(C),d.type){case 1:case 2:case 6:break;case 7:C.ip=t.util.bytesToIP(d.value);break;case 8:C.oid=r.derToOid(d.value)}}}else if("subjectKeyIdentifier"===a.name){u=r.fromDer(a.value);a.subjectKeyIdentifier=t.util.bytesToHex(u.value)}return a},a.certificationRequestFromAsn1=function(e,s){var n={},o=[];if(!r.validate(e,l,n,o))throw(c=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.")).errors=o,c;if(r.derToOid(n.publicKeyOid)!==a.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var u=a.createCertificationRequest();if(u.version=n.csrVersion?n.csrVersion.charCodeAt(0):0,u.signatureOid=t.asn1.derToOid(n.csrSignatureOid),u.signatureParameters=f(u.signatureOid,n.csrSignatureParams,!0),u.siginfo.algorithmOid=t.asn1.derToOid(n.csrSignatureOid),u.siginfo.parameters=f(u.siginfo.algorithmOid,n.csrSignatureParams,!1),u.signature=n.csrSignature,u.certificationRequestInfo=n.certificationRequestInfo,s){var c;if(u.md=null,u.signatureOid in i)switch(i[u.signatureOid]){case"sha1WithRSAEncryption":u.md=t.md.sha1.create();break;case"md5WithRSAEncryption":u.md=t.md.md5.create();break;case"sha256WithRSAEncryption":u.md=t.md.sha256.create();break;case"sha384WithRSAEncryption":u.md=t.md.sha384.create();break;case"sha512WithRSAEncryption":u.md=t.md.sha512.create();break;case"RSASSA-PSS":u.md=t.md.sha256.create()}if(null===u.md)throw(c=new Error("Could not compute certification request digest. Unknown signature OID.")).signatureOid=u.signatureOid,c;var C=r.toDer(u.certificationRequestInfo);u.md.update(C.getBytes())}var m=t.md.sha1.create();return u.subject.getField=function(e){return d(u.subject,e)},u.subject.addField=function(e){p([e]),u.subject.attributes.push(e)},u.subject.attributes=a.RDNAttributesAsArray(n.certificationRequestInfoSubject,m),u.subject.hash=m.digest().toHex(),u.publicKey=a.publicKeyFromAsn1(n.subjectPublicKeyInfo),u.getAttribute=function(e){return d(u,e)},u.addAttribute=function(e){p([e]),u.attributes.push(e)},u.attributes=a.CRIAttributesAsArray(n.certificationRequestInfoAttributes||[]),u},a.createCertificationRequest=function(){var e={version:0,signatureOid:null,signature:null,siginfo:{}};return e.siginfo.algorithmOid=null,e.subject={},e.subject.getField=function(t){return d(e.subject,t)},e.subject.addField=function(t){p([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.publicKey=null,e.attributes=[],e.getAttribute=function(t){return d(e,t)},e.addAttribute=function(t){p([t]),e.attributes.push(t)},e.md=null,e.setSubject=function(t){p(t),e.subject.attributes=t,e.subject.hash=null},e.setAttributes=function(t){p(t),e.attributes=t},e.sign=function(s,n){e.md=n||t.md.sha1.create();var o=i[e.md.algorithm+"WithRSAEncryption"];if(!o){var u=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw u.algorithm=e.md.algorithm,u}e.signatureOid=e.siginfo.algorithmOid=o,e.certificationRequestInfo=a.getCertificationRequestInfo(e);var c=r.toDer(e.certificationRequestInfo);e.md.update(c.getBytes()),e.signature=s.sign(e.md)},e.verify=function(){var s=!1,n=e.md;if(null===n){if(e.signatureOid in i)switch(i[e.signatureOid]){case"sha1WithRSAEncryption":n=t.md.sha1.create();break;case"md5WithRSAEncryption":n=t.md.md5.create();break;case"sha256WithRSAEncryption":n=t.md.sha256.create();break;case"sha384WithRSAEncryption":n=t.md.sha384.create();break;case"sha512WithRSAEncryption":n=t.md.sha512.create();break;case"RSASSA-PSS":n=t.md.sha256.create()}if(null===n)throw(f=new Error("Could not compute certification request digest. Unknown signature OID.")).signatureOid=e.signatureOid,f;var o=e.certificationRequestInfo||a.getCertificationRequestInfo(e),u=r.toDer(o);n.update(u.getBytes())}if(null!==n){var c;switch(e.signatureOid){case i.sha1WithRSAEncryption:break;case i["RSASSA-PSS"]:var l,d,f;if(void 0===(l=i[e.signatureParameters.mgf.hash.algorithmOid])||void 0===t.md[l])throw(f=new Error("Unsupported MGF hash function.")).oid=e.signatureParameters.mgf.hash.algorithmOid,f.name=l,f;if(void 0===(d=i[e.signatureParameters.mgf.algorithmOid])||void 0===t.mgf[d])throw(f=new Error("Unsupported MGF function.")).oid=e.signatureParameters.mgf.algorithmOid,f.name=d,f;if(d=t.mgf[d].create(t.md[l].create()),void 0===(l=i[e.signatureParameters.hash.algorithmOid])||void 0===t.md[l])throw(f=new Error("Unsupported RSASSA-PSS hash function.")).oid=e.signatureParameters.hash.algorithmOid,f.name=l,f;c=t.pss.create(t.md[l].create(),d,e.signatureParameters.saltLength)}s=e.publicKey.verify(n.digest().getBytes(),e.signature,c)}return s},e};var y=new Date("1950-01-01T00:00:00Z"),v=new Date("2050-01-01T00:00:00Z");function T(e){return e>=y&&e<v?r.create(r.Class.UNIVERSAL,r.Type.UTCTIME,!1,r.dateToUtcTime(e)):r.create(r.Class.UNIVERSAL,r.Type.GENERALIZEDTIME,!1,r.dateToGeneralizedTime(e))}a.getTBSCertificate=function(e){var i=T(e.validity.notBefore),s=T(e.validity.notAfter),n=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.CONTEXT_SPECIFIC,0,!0,[r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,r.integerToDer(e.version).getBytes())]),r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,t.util.hexToBytes(e.serialNumber)),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(e.siginfo.algorithmOid).getBytes()),g(e.siginfo.algorithmOid,e.siginfo.parameters)]),C(e.issuer),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[i,s]),C(e.subject),a.publicKeyToAsn1(e.publicKey)]);return e.issuer.uniqueId&&n.value.push(r.create(r.Class.CONTEXT_SPECIFIC,1,!0,[r.create(r.Class.UNIVERSAL,r.Type.BITSTRING,!1,String.fromCharCode(0)+e.issuer.uniqueId)])),e.subject.uniqueId&&n.value.push(r.create(r.Class.CONTEXT_SPECIFIC,2,!0,[r.create(r.Class.UNIVERSAL,r.Type.BITSTRING,!1,String.fromCharCode(0)+e.subject.uniqueId)])),e.extensions.length>0&&n.value.push(a.certificateExtensionsToAsn1(e.extensions)),n},a.getCertificationRequestInfo=function(e){return r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,r.integerToDer(e.version).getBytes()),C(e.subject),a.publicKeyToAsn1(e.publicKey),E(e)])},a.distinguishedNameToAsn1=function(e){return C(e)},a.certificateToAsn1=function(e){var t=e.tbsCertificate||a.getTBSCertificate(e);return r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[t,r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(e.signatureOid).getBytes()),g(e.signatureOid,e.signatureParameters)]),r.create(r.Class.UNIVERSAL,r.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},a.certificateExtensionsToAsn1=function(e){var t=r.create(r.Class.CONTEXT_SPECIFIC,3,!0,[]),i=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[]);t.value.push(i);for(var s=0;s<e.length;++s)i.value.push(a.certificateExtensionToAsn1(e[s]));return t},a.certificateExtensionToAsn1=function(e){var t=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[]);t.value.push(r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(e.id).getBytes())),e.critical&&t.value.push(r.create(r.Class.UNIVERSAL,r.Type.BOOLEAN,!1,String.fromCharCode(255)));var a=e.value;return"string"!=typeof e.value&&(a=r.toDer(a).getBytes()),t.value.push(r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,a)),t},a.certificationRequestToAsn1=function(e){var t=e.certificationRequestInfo||a.getCertificationRequestInfo(e);return r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[t,r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(e.signatureOid).getBytes()),g(e.signatureOid,e.signatureParameters)]),r.create(r.Class.UNIVERSAL,r.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},a.createCaStore=function(e){var i={certs:{}};function s(e){return n(e),i.certs[e.hash]||null}function n(e){if(!e.hash){var r=t.md.sha1.create();e.attributes=a.RDNAttributesAsArray(C(e),r),e.hash=r.digest().toHex()}}if(i.getIssuer=function(e){return s(e.issuer)},i.addCertificate=function(e){if("string"==typeof e&&(e=t.pki.certificateFromPem(e)),n(e.subject),!i.hasCertificate(e))if(e.subject.hash in i.certs){var r=i.certs[e.subject.hash];t.util.isArray(r)||(r=[r]),r.push(e),i.certs[e.subject.hash]=r}else i.certs[e.subject.hash]=e},i.hasCertificate=function(e){"string"==typeof e&&(e=t.pki.certificateFromPem(e));var i=s(e.subject);if(!i)return!1;t.util.isArray(i)||(i=[i]);for(var n=r.toDer(a.certificateToAsn1(e)).getBytes(),o=0;o<i.length;++o){if(n===r.toDer(a.certificateToAsn1(i[o])).getBytes())return!0}return!1},i.listAllCertificates=function(){var e=[];for(var r in i.certs)if(i.certs.hasOwnProperty(r)){var a=i.certs[r];if(t.util.isArray(a))for(var s=0;s<a.length;++s)e.push(a[s]);else e.push(a)}return e},i.removeCertificate=function(e){var o;if("string"==typeof e&&(e=t.pki.certificateFromPem(e)),n(e.subject),!i.hasCertificate(e))return null;var u=s(e.subject);if(!t.util.isArray(u))return o=i.certs[e.subject.hash],delete i.certs[e.subject.hash],o;for(var c=r.toDer(a.certificateToAsn1(e)).getBytes(),l=0;l<u.length;++l){c===r.toDer(a.certificateToAsn1(u[l])).getBytes()&&(o=u[l],u.splice(l,1))}return 0===u.length&&delete i.certs[e.subject.hash],o},e)for(var o=0;o<e.length;++o){var u=e[o];i.addCertificate(u)}return i},a.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"},a.verifyCertificateChain=function(r,i,s){"function"==typeof s&&(s={verify:s}),s=s||{};var n=(i=i.slice(0)).slice(0),o=s.validityCheckDate;void 0===o&&(o=new Date);var u=!0,c=null,l=0;do{var d=i.shift(),f=null,C=!1;if(o&&(o<d.validity.notBefore||o>d.validity.notAfter)&&(c={message:"Certificate is not valid yet or has expired.",error:a.certificateError.certificate_expired,notBefore:d.validity.notBefore,notAfter:d.validity.notAfter,now:o}),null===c){if(null===(f=i[0]||r.getIssuer(d))&&d.isIssuer(d)&&(C=!0,f=d),f){var m=f;t.util.isArray(m)||(m=[m]);for(var p=!1;!p&&m.length>0;){f=m.shift();try{p=f.verify(d)}catch(I){}}p||(c={message:"Certificate signature is invalid.",error:a.certificateError.bad_certificate})}null!==c||f&&!C||r.hasCertificate(d)||(c={message:"Certificate is not trusted.",error:a.certificateError.unknown_ca})}if(null===c&&f&&!d.isIssuer(f)&&(c={message:"Certificate issuer is invalid.",error:a.certificateError.bad_certificate}),null===c)for(var h={keyUsage:!0,basicConstraints:!0},g=0;null===c&&g<d.extensions.length;++g){var E=d.extensions[g];!E.critical||E.name in h||(c={message:"Certificate has an unsupported critical extension.",error:a.certificateError.unsupported_certificate})}if(null===c&&(!u||0===i.length&&(!f||C))){var y=d.getExtension("basicConstraints"),v=d.getExtension("keyUsage");if(null!==v&&(v.keyCertSign&&null!==y||(c={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:a.certificateError.bad_certificate})),null!==c||null===y||y.cA||(c={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:a.certificateError.bad_certificate}),null===c&&null!==v&&"pathLenConstraint"in y)l-1>y.pathLenConstraint&&(c={message:"Certificate basicConstraints pathLenConstraint violated.",error:a.certificateError.bad_certificate})}var T=null===c||c.error,S=s.verify?s.verify(T,l,n):T;if(!0!==S)throw!0===T&&(c={message:"The application rejected the certificate.",error:a.certificateError.bad_certificate}),(S||0===S)&&("object"!==e(S)||t.util.isArray(S)?"string"==typeof S&&(c.error=S):(S.message&&(c.message=S.message),S.error&&(c.error=S.error))),c;c=null,u=!1,++l}while(i.length>0);return!0};
|
||
},{"./forge":"sQ2N","./aes":"bEBs","./asn1":"RZRC","./des":"ZV7X","./md":"2EAk","./mgf":"uIaZ","./oids":"F6JL","./pem":"aepW","./pss":"JMzF","./rsa":"a11z","./util":"2MJg"}],"gwVa":[function(require,module,exports) {
|
||
function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}var t=require("./forge");require("./aes"),require("./asn1"),require("./des"),require("./oids"),require("./pem"),require("./pkcs7asn1"),require("./random"),require("./util"),require("./x509");var r=t.asn1,n=module.exports=t.pkcs7=t.pkcs7||{};function i(e){var i={},a=[];if(!r.validate(e,n.asn1.recipientInfoValidator,i,a)){var s=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw s.errors=a,s}return{version:i.version.charCodeAt(0),issuer:t.pki.RDNAttributesAsArray(i.issuer),serialNumber:t.util.createBuffer(i.serial).toHex(),encryptedContent:{algorithm:r.derToOid(i.encAlgorithm),parameter:i.encParameter.value,content:i.encKey}}}function a(e){return r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,r.integerToDer(e.version).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[t.pki.distinguishedNameToAsn1({attributes:e.issuer}),r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,t.util.hexToBytes(e.serialNumber))]),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(e.encryptedContent.algorithm).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.NULL,!1,"")]),r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,e.encryptedContent.content)])}function s(e){for(var t=[],r=0;r<e.length;++r)t.push(i(e[r]));return t}function o(e){for(var t=[],r=0;r<e.length;++r)t.push(a(e[r]));return t}function c(e){var i={},a=[];if(!r.validate(e,n.asn1.signerInfoValidator,i,a)){var s=new Error("Cannot read PKCS#7 SignerInfo. ASN.1 object is not an PKCS#7 SignerInfo.");throw s.errors=a,s}var o={version:i.version.charCodeAt(0),issuer:t.pki.RDNAttributesAsArray(i.issuer),serialNumber:t.util.createBuffer(i.serial).toHex(),digestAlgorithm:r.derToOid(i.digestAlgorithm),signatureAlgorithm:r.derToOid(i.signatureAlgorithm),signature:i.signature,authenticatedAttributes:[],unauthenticatedAttributes:[]};i.authenticatedAttributes,i.unauthenticatedAttributes;return o}function p(e){var n=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,r.integerToDer(e.version).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[t.pki.distinguishedNameToAsn1({attributes:e.issuer}),r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,t.util.hexToBytes(e.serialNumber))]),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(e.digestAlgorithm).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.NULL,!1,"")])]);if(e.authenticatedAttributesAsn1&&n.value.push(e.authenticatedAttributesAsn1),n.value.push(r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(e.signatureAlgorithm).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.NULL,!1,"")])),n.value.push(r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,e.signature)),e.unauthenticatedAttributes.length>0){for(var i=r.create(r.Class.CONTEXT_SPECIFIC,1,!0,[]),a=0;a<e.unauthenticatedAttributes.length;++a){var s=e.unauthenticatedAttributes[a];i.values.push(l(s))}n.value.push(i)}return n}function d(e){for(var t=[],r=0;r<e.length;++r)t.push(c(e[r]));return t}function u(e){for(var t=[],r=0;r<e.length;++r)t.push(p(e[r]));return t}function l(e){var n;if(e.type===t.pki.oids.contentType)n=r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(e.value).getBytes());else if(e.type===t.pki.oids.messageDigest)n=r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,e.value.bytes());else if(e.type===t.pki.oids.signingTime){var i=new Date("1950-01-01T00:00:00Z"),a=new Date("2050-01-01T00:00:00Z"),s=e.value;if("string"==typeof s){var o=Date.parse(s);s=isNaN(o)?13===s.length?r.utcTimeToDate(s):r.generalizedTimeToDate(s):new Date(o)}n=s>=i&&s<a?r.create(r.Class.UNIVERSAL,r.Type.UTCTIME,!1,r.dateToUtcTime(s)):r.create(r.Class.UNIVERSAL,r.Type.GENERALIZEDTIME,!1,r.dateToGeneralizedTime(s))}return r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(e.type).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SET,!0,[n])])}function y(e){return[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(t.pki.oids.data).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(e.algorithm).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,e.parameter.getBytes())]),r.create(r.Class.CONTEXT_SPECIFIC,0,!0,[r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,e.content.getBytes())])]}function C(e,n,i){var a={};if(!r.validate(n,i,a,[])){var s=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw s.errors=s,s}if(r.derToOid(a.contentType)!==t.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(a.encryptedContent){var o="";if(t.util.isArray(a.encryptedContent))for(var c=0;c<a.encryptedContent.length;++c){if(a.encryptedContent[c].type!==r.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");o+=a.encryptedContent[c].value}else o=a.encryptedContent;e.encryptedContent={algorithm:r.derToOid(a.encAlgorithm),parameter:t.util.createBuffer(a.encParameter.value),content:t.util.createBuffer(o)}}if(a.content){o="";if(t.util.isArray(a.content))for(c=0;c<a.content.length;++c){if(a.content[c].type!==r.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");o+=a.content[c].value}else o=a.content;e.content=t.util.createBuffer(o)}return e.version=a.version.charCodeAt(0),e.rawCapture=a,a}function f(e){if(void 0===e.encryptedContent.key)throw new Error("Symmetric key not available.");if(void 0===e.content){var r;switch(e.encryptedContent.algorithm){case t.pki.oids["aes128-CBC"]:case t.pki.oids["aes192-CBC"]:case t.pki.oids["aes256-CBC"]:r=t.aes.createDecryptionCipher(e.encryptedContent.key);break;case t.pki.oids.desCBC:case t.pki.oids["des-EDE3-CBC"]:r=t.des.createDecryptionCipher(e.encryptedContent.key);break;default:throw new Error("Unsupported symmetric cipher, OID "+e.encryptedContent.algorithm)}if(r.start(e.encryptedContent.parameter),r.update(e.encryptedContent.content),!r.finish())throw new Error("Symmetric decryption failed.");e.content=r.output}}n.messageFromPem=function(e){var i=t.pem.decode(e)[0];if("PKCS7"!==i.type){var a=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw a.headerType=i.type,a}if(i.procType&&"ENCRYPTED"===i.procType.type)throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var s=r.fromDer(i.body);return n.messageFromAsn1(s)},n.messageToPem=function(e,n){var i={type:"PKCS7",body:r.toDer(e.toAsn1()).getBytes()};return t.pem.encode(i,{maxline:n})},n.messageFromAsn1=function(e){var i={},a=[];if(!r.validate(e,n.asn1.contentInfoValidator,i,a)){var s=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw s.errors=a,s}var o,c=r.derToOid(i.contentType);switch(c){case t.pki.oids.envelopedData:o=n.createEnvelopedData();break;case t.pki.oids.encryptedData:o=n.createEncryptedData();break;case t.pki.oids.signedData:o=n.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+c+" is not (yet) supported.")}return o.fromAsn1(i.content.value[0]),o},n.createSignedData=function(){var i=null;return i={type:t.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(e){if(C(i,e,n.asn1.signedDataValidator),i.certificates=[],i.crls=[],i.digestAlgorithmIdentifiers=[],i.contentInfo=null,i.signerInfos=[],i.rawCapture.certificates)for(var r=i.rawCapture.certificates.value,a=0;a<r.length;++a)i.certificates.push(t.pki.certificateFromAsn1(r[a]))},toAsn1:function(){i.contentInfo||i.sign();for(var e=[],n=0;n<i.certificates.length;++n)e.push(t.pki.certificateToAsn1(i.certificates[n]));var a=[],s=r.create(r.Class.CONTEXT_SPECIFIC,0,!0,[r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,r.integerToDer(i.version).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SET,!0,i.digestAlgorithmIdentifiers),i.contentInfo])]);return e.length>0&&s.value[0].value.push(r.create(r.Class.CONTEXT_SPECIFIC,0,!0,e)),a.length>0&&s.value[0].value.push(r.create(r.Class.CONTEXT_SPECIFIC,1,!0,a)),s.value[0].value.push(r.create(r.Class.UNIVERSAL,r.Type.SET,!0,i.signerInfos)),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(i.type).getBytes()),s])},addSigner:function(e){var r=e.issuer,n=e.serialNumber;if(e.certificate){var a=e.certificate;"string"==typeof a&&(a=t.pki.certificateFromPem(a)),r=a.issuer.attributes,n=a.serialNumber}var s=e.key;if(!s)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"==typeof s&&(s=t.pki.privateKeyFromPem(s));var o=e.digestAlgorithm||t.pki.oids.sha1;switch(o){case t.pki.oids.sha1:case t.pki.oids.sha256:case t.pki.oids.sha384:case t.pki.oids.sha512:case t.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+o)}var c=e.authenticatedAttributes||[];if(c.length>0){for(var p=!1,d=!1,u=0;u<c.length;++u){var l=c[u];if(p||l.type!==t.pki.oids.contentType){if(d||l.type!==t.pki.oids.messageDigest);else if(d=!0,p)break}else if(p=!0,d)break}if(!p||!d)throw new Error("Invalid signer.authenticatedAttributes. If signer.authenticatedAttributes is specified, then it must contain at least two attributes, PKCS #9 content-type and PKCS #9 message-digest.")}i.signers.push({key:s,version:1,issuer:r,serialNumber:n,digestAlgorithm:o,signatureAlgorithm:t.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:c,unauthenticatedAttributes:[]})},sign:function(n){var a;(n=n||{},"object"!==e(i.content)||null===i.contentInfo)&&(i.contentInfo=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(t.pki.oids.data).getBytes())]),"content"in i&&(i.content instanceof t.util.ByteBuffer?a=i.content.bytes():"string"==typeof i.content&&(a=t.util.encodeUtf8(i.content)),n.detached?i.detachedContent=r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,a):i.contentInfo.value.push(r.create(r.Class.CONTEXT_SPECIFIC,0,!0,[r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,a)]))));0!==i.signers.length&&function(e){var n;n=i.detachedContent?i.detachedContent:(n=i.contentInfo.value[1]).value[0];if(!n)throw new Error("Could not sign PKCS#7 message; there is no content to sign.");var a=r.derToOid(i.contentInfo.value[0].value),s=r.toDer(n);for(var o in s.getByte(),r.getBerValueLength(s),s=s.getBytes(),e)e[o].start().update(s);for(var c=new Date,p=0;p<i.signers.length;++p){var d=i.signers[p];if(0===d.authenticatedAttributes.length){if(a!==t.pki.oids.data)throw new Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{d.authenticatedAttributesAsn1=r.create(r.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var y=r.create(r.Class.UNIVERSAL,r.Type.SET,!0,[]),C=0;C<d.authenticatedAttributes.length;++C){var f=d.authenticatedAttributes[C];f.type===t.pki.oids.messageDigest?f.value=e[d.digestAlgorithm].digest():f.type===t.pki.oids.signingTime&&(f.value||(f.value=c)),y.value.push(l(f)),d.authenticatedAttributesAsn1.value.push(l(f))}s=r.toDer(y).getBytes(),d.md.start().update(s)}d.signature=d.key.sign(d.md,"RSASSA-PKCS1-V1_5")}i.signerInfos=u(i.signers)}(function(){for(var e={},n=0;n<i.signers.length;++n){var a=i.signers[n],s=a.digestAlgorithm;s in e||(e[s]=t.md[t.pki.oids[s]].create()),0===a.authenticatedAttributes.length?a.md=e[s]:a.md=t.md[t.pki.oids[s]].create()}for(var s in i.digestAlgorithmIdentifiers=[],e)i.digestAlgorithmIdentifiers.push(r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(s).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.NULL,!1,"")]));return e}())},verify:function(){throw new Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(e){"string"==typeof e&&(e=t.pki.certificateFromPem(e)),i.certificates.push(e)},addCertificateRevokationList:function(e){throw new Error("PKCS#7 CRL support not yet implemented.")}}},n.createEncryptedData=function(){var e=null;return e={type:t.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:t.pki.oids["aes256-CBC"]},fromAsn1:function(t){C(e,t,n.asn1.encryptedDataValidator)},decrypt:function(t){void 0!==t&&(e.encryptedContent.key=t),f(e)}}},n.createEnvelopedData=function(){var e=null;return e={type:t.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:t.pki.oids["aes256-CBC"]},fromAsn1:function(t){var r=C(e,t,n.asn1.envelopedDataValidator);e.recipients=s(r.recipientInfos.value)},toAsn1:function(){return r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(e.type).getBytes()),r.create(r.Class.CONTEXT_SPECIFIC,0,!0,[r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,r.integerToDer(e.version).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SET,!0,o(e.recipients)),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,y(e.encryptedContent))])])])},findRecipient:function(t){for(var r=t.issuer.attributes,n=0;n<e.recipients.length;++n){var i=e.recipients[n],a=i.issuer;if(i.serialNumber===t.serialNumber&&a.length===r.length){for(var s=!0,o=0;o<r.length;++o)if(a[o].type!==r[o].type||a[o].value!==r[o].value){s=!1;break}if(s)return i}}return null},decrypt:function(r,n){if(void 0===e.encryptedContent.key&&void 0!==r&&void 0!==n)switch(r.encryptedContent.algorithm){case t.pki.oids.rsaEncryption:case t.pki.oids.desCBC:var i=n.decrypt(r.encryptedContent.content);e.encryptedContent.key=t.util.createBuffer(i);break;default:throw new Error("Unsupported asymmetric cipher, OID "+r.encryptedContent.algorithm)}f(e)},addRecipient:function(r){e.recipients.push({version:0,issuer:r.issuer.attributes,serialNumber:r.serialNumber,encryptedContent:{algorithm:t.pki.oids.rsaEncryption,key:r.publicKey}})},encrypt:function(r,n){if(void 0===e.encryptedContent.content){var i,a,s;switch(n=n||e.encryptedContent.algorithm,r=r||e.encryptedContent.key,n){case t.pki.oids["aes128-CBC"]:i=16,a=16,s=t.aes.createEncryptionCipher;break;case t.pki.oids["aes192-CBC"]:i=24,a=16,s=t.aes.createEncryptionCipher;break;case t.pki.oids["aes256-CBC"]:i=32,a=16,s=t.aes.createEncryptionCipher;break;case t.pki.oids["des-EDE3-CBC"]:i=24,a=8,s=t.des.createEncryptionCipher;break;default:throw new Error("Unsupported symmetric cipher, OID "+n)}if(void 0===r)r=t.util.createBuffer(t.random.getBytes(i));else if(r.length()!=i)throw new Error("Symmetric key has wrong length; got "+r.length()+" bytes, expected "+i+".");e.encryptedContent.algorithm=n,e.encryptedContent.key=r,e.encryptedContent.parameter=t.util.createBuffer(t.random.getBytes(a));var o=s(r);if(o.start(e.encryptedContent.parameter.copy()),o.update(e.content),!o.finish())throw new Error("Symmetric encryption failed.");e.encryptedContent.content=o.output}for(var c=0;c<e.recipients.length;++c){var p=e.recipients[c];if(void 0===p.encryptedContent.content)switch(p.encryptedContent.algorithm){case t.pki.oids.rsaEncryption:p.encryptedContent.content=p.encryptedContent.key.encrypt(e.encryptedContent.key.data);break;default:throw new Error("Unsupported asymmetric cipher, OID "+p.encryptedContent.algorithm)}}}}};
|
||
},{"./forge":"sQ2N","./aes":"bEBs","./asn1":"RZRC","./des":"ZV7X","./oids":"F6JL","./pem":"aepW","./pkcs7asn1":"DHZ3","./random":"b05L","./util":"2MJg","./x509":"pgVB"}],"OAX4":[function(require,module,exports) {
|
||
"use strict";function e(e,n,t,r,i,a,o){try{var u=e[a](o),s=u.value}catch(c){return void t(c)}u.done?n(s):Promise.resolve(s).then(r,i)}function n(n){return function(){var t=this,r=arguments;return new Promise(function(i,a){var o=n.apply(t,r);function u(n){e(o,i,a,u,s,"next",n)}function s(n){e(o,i,a,u,s,"throw",n)}u(void 0)})}}require("node-forge/lib/x509");var t=require("node-forge/lib/forge"),r=t.pki,i=function(e,n){var t=r.setRsaPublicKey(n.n,n.e),i=r.createCertificate();i.publicKey=t,i.serialNumber="01",i.validity.notBefore=new Date,i.validity.notAfter=new Date,i.validity.notAfter.setFullYear(i.validity.notBefore.getFullYear()+10);var a=[{name:"organizationName",value:"ipfs"},{shortName:"OU",value:"keystore"},{name:"commonName",value:e.id}];return i.setSubject(a),i.setIssuer(a),i.setExtensions([{name:"basicConstraints",cA:!0},{name:"keyUsage",keyCertSign:!0,digitalSignature:!0,nonRepudiation:!0,keyEncipherment:!0,dataEncipherment:!0},{name:"extKeyUsage",serverAuth:!0,clientAuth:!0,codeSigning:!0,emailProtection:!0,timeStamping:!0},{name:"nsCertType",client:!0,server:!0,email:!0,objsign:!0,sslCA:!0,emailCA:!0,objCA:!0}]),i.sign(n),i};function a(e,n){return o.apply(this,arguments)}function o(){return(o=n(regeneratorRuntime.mark(function e(n,t){var r,i,a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.map(t),e.next=3,Promise.all(r);case 3:return i=e.sent,a=i.findIndex(function(e){return e}),e.abrupt("return",n[a]);case 6:case"end":return e.stop()}},e)}))).apply(this,arguments)}module.exports={certificateForKey:i,findAsync:a};
|
||
},{"node-forge/lib/x509":"pgVB","node-forge/lib/forge":"sQ2N"}],"/DxU":[function(require,module,exports) {
|
||
"use strict";function e(e,r,t,n,i,a,u){try{var s=e[a](u),c=s.value}catch(o){return void t(o)}s.done?r(c):Promise.resolve(c).then(n,i)}function r(r){return function(){var t=this,n=arguments;return new Promise(function(i,a){var u=r.apply(t,n);function s(r){e(u,i,a,s,c,"next",r)}function c(r){e(u,i,a,s,c,"throw",r)}s(void 0)})}}function t(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function n(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function i(e,r,t){return r&&n(e.prototype,r),t&&n(e,t),e}require("node-forge/lib/pkcs7"),require("node-forge/lib/pbe");var a=require("node-forge/lib/forge"),u=require("./util"),s=u.certificateForKey,c=u.findAsync,o=require("err-code"),f=require("uint8arrays/from-string"),p=require("uint8arrays/to-string"),y=new WeakMap,h=function(){function e(r,n){if(t(this,e),!r)throw o(new Error("keychain is required"),"ERR_KEYCHAIN_REQUIRED");this.keychain=r,y.set(this,{dek:n})}return i(e,[{key:"encrypt",value:function(){var e=r(regeneratorRuntime.mark(function e(r,t){var n,i,u,c,p,h,d;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t instanceof Uint8Array){e.next=2;break}throw o(new Error("Plain data must be a Uint8Array"),"ERR_INVALID_PARAMS");case 2:return e.next=4,this.keychain.findKeyByName(r);case 4:return n=e.sent,e.next=7,this.keychain._getPrivateKey(r);case 7:return i=e.sent,u=y.get(this).dek,c=a.pki.decryptRsaPrivateKey(i,u),e.next=12,s(n,c);case 12:return p=e.sent,(h=a.pkcs7.createEnvelopedData()).addRecipient(p),h.content=a.util.createBuffer(t),h.encrypt(),d=a.asn1.toDer(h.toAsn1()).getBytes(),e.abrupt("return",f(d,"ascii"));case 19:case"end":return e.stop()}},e,this)}));return function(r,t){return e.apply(this,arguments)}}()},{key:"decrypt",value:function(){var e=r(regeneratorRuntime.mark(function e(t){var n,i,u,s,h,d,k,l,v,m,R=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t instanceof Uint8Array){e.next=2;break}throw o(new Error("CMS data is required"),"ERR_INVALID_PARAMS");case 2:e.prev=2,i=a.util.createBuffer(p(t,"ascii")),u=a.asn1.fromDer(i),n=a.pkcs7.messageFromAsn1(u),e.next=11;break;case 8:throw e.prev=8,e.t0=e.catch(2),o(new Error("Invalid CMS: "+e.t0.message),"ERR_INVALID_CMS");case 11:return s=n.recipients.filter(function(e){return e.issuer.find(function(e){return"O"===e.shortName&&"ipfs"===e.value})}).filter(function(e){return e.issuer.find(function(e){return"CN"===e.shortName})}).map(function(e){return{recipient:e,keyId:e.issuer.find(function(e){return"CN"===e.shortName}).value}}),e.next=14,c(s,function(){var e=r(regeneratorRuntime.mark(function e(r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,R.keychain.findKeyById(r.keyId);case 3:if(!e.sent){e.next=6;break}return e.abrupt("return",!0);case 6:e.next=11;break;case 8:return e.prev=8,e.t0=e.catch(0),e.abrupt("return",!1);case 11:return e.abrupt("return",!1);case 12:case"end":return e.stop()}},e,null,[[0,8]])}));return function(r){return e.apply(this,arguments)}}());case 14:if(h=e.sent){e.next=18;break}throw d=s.map(function(e){return e.keyId}),o(new Error("Decryption needs one of the key(s): "+d.join(", ")),"ERR_MISSING_KEYS",{missingKeys:d});case 18:return e.next=20,this.keychain.findKeyById(h.keyId);case 20:if(k=e.sent){e.next=23;break}throw o(new Error("No key available to decrypto"),"ERR_NO_KEY");case 23:return e.next=25,this.keychain._getPrivateKey(k.name);case 25:return l=e.sent,v=y.get(this).dek,m=a.pki.decryptRsaPrivateKey(l,v),n.decrypt(h.recipient,m),e.abrupt("return",f(n.content.getBytes(),"ascii"));case 30:case"end":return e.stop()}},e,this,[[2,8]])}));return function(r){return e.apply(this,arguments)}}()}]),e}();module.exports=h;
|
||
},{"node-forge/lib/pkcs7":"gwVa","node-forge/lib/pbe":"hIlf","node-forge/lib/forge":"sQ2N","./util":"OAX4","err-code":"hLMW","uint8arrays/from-string":"YqS+","uint8arrays/to-string":"aFN1"}],"taGw":[function(require,module,exports) {
|
||
"use strict";function e(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function r(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function t(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}function n(e,r,t,n,a,u,s){try{var i=e[u](s),o=i.value}catch(c){return void t(c)}i.done?r(o):Promise.resolve(o).then(n,a)}function a(e){return function(){var r=this,t=arguments;return new Promise(function(a,u){var s=e.apply(r,t);function i(e){n(s,a,u,i,o,"next",e)}function o(e){n(s,a,u,i,o,"throw",e)}i(void 0)})}}function u(e){var r;if("undefined"!=typeof Symbol){if(Symbol.asyncIterator&&null!=(r=e[Symbol.asyncIterator]))return r.call(e);if(Symbol.iterator&&null!=(r=e[Symbol.iterator]))return r.call(e)}throw new TypeError("Object is not async iterable")}var s=require("sanitize-filename"),i=require("merge-options"),o=require("libp2p-crypto"),c=require("interface-datastore"),p=c.Key,f=require("./cms"),h=require("err-code"),y=require("uint8arrays/to-string"),l=require("uint8arrays/from-string");require("node-forge/lib/sha512");var m="/pkcs8/",v="/info/",b=new WeakMap,E={minKeyLength:14,minSaltLength:16,minIterationCount:1e3},k={dek:{keyLength:64,iterationCount:1e4,salt:"you should override this value with a crypto secure random number",hash:"sha2-512"}};function d(e){return!!e&&("string"==typeof e&&e===s(e.trim()))}function x(e){return R.apply(this,arguments)}function R(){return(R=a(regeneratorRuntime.mark(function e(r){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return 200,1e3,t=800*Math.random()+200,e.next=5,new Promise(function(e){return setTimeout(e,t)});case 5:throw r;case 6:case"end":return e.stop()}},e)}))).apply(this,arguments)}function w(e){return new p(m+e)}function g(e){return new p(v+e)}var _=function(){function r(t,n){if(e(this,r),!t)throw new Error("store is required");if(this.store=t,this.opts=i(k,n),this.opts.pass&&this.opts.pass.length<20)throw new Error("pass must be least 20 characters");if(this.opts.dek.keyLength<E.minKeyLength)throw new Error("dek.keyLength must be least ".concat(E.minKeyLength," bytes"));if(this.opts.dek.salt.length<E.minSaltLength)throw new Error("dek.saltLength must be least ".concat(E.minSaltLength," bytes"));if(this.opts.dek.iterationCount<E.minIterationCount)throw new Error("dek.iterationCount must be least ".concat(E.minIterationCount));var a=this.opts.pass?o.pbkdf2(this.opts.pass,this.opts.dek.salt,this.opts.dek.iterationCount,this.opts.dek.keyLength,this.opts.dek.hash):"";b.set(this,{dek:a})}return t(r,[{key:"cms",get:function(){return new f(this,b.get(this).dek)}},{key:"createKey",value:function(){var e=a(regeneratorRuntime.mark(function e(r,t){var n,a,u,s,i,c,p,f,y,m=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=m.length>2&&void 0!==m[2]?m[2]:2048,a=this,d(r)&&"self"!==r){e.next=4;break}return e.abrupt("return",x(h(new Error("Invalid key name '".concat(r,"'")),"ERR_INVALID_KEY_NAME")));case 4:if("string"==typeof t){e.next=6;break}return e.abrupt("return",x(h(new Error("Invalid key type '".concat(t,"'")),"ERR_INVALID_KEY_TYPE")));case 6:return u=w(r),e.next=9,a.store.has(u);case 9:if(!e.sent){e.next=12;break}return e.abrupt("return",x(h(new Error("Key '".concat(r,"' already exists")),"ERR_KEY_ALREADY_EXISTS")));case 12:e.t0=t.toLowerCase(),e.next="rsa"===e.t0?15:18;break;case 15:if(Number.isSafeInteger(n)&&!(n<2048)){e.next=17;break}return e.abrupt("return",x(h(new Error("Invalid RSA key size ".concat(n)),"ERR_INVALID_KEY_SIZE")));case 17:case 18:return e.abrupt("break",19);case 19:return e.prev=19,e.next=22,o.keys.generateKeyPair(t,n);case 22:return i=e.sent,e.next=25,i.id();case 25:return c=e.sent,p=b.get(this).dek,e.next=29,i.export(p);case 29:return f=e.sent,s={name:r,id:c},(y=a.store.batch()).put(u,l(f)),y.put(g(r),l(JSON.stringify(s))),e.next=36,y.commit();case 36:e.next=41;break;case 38:return e.prev=38,e.t1=e.catch(19),e.abrupt("return",x(e.t1));case 41:return e.abrupt("return",s);case 42:case"end":return e.stop()}},e,this,[[19,38]])}));return function(r,t){return e.apply(this,arguments)}}()},{key:"listKeys",value:function(){var e=a(regeneratorRuntime.mark(function e(){var r,t,n,a,s,i,o,c,p,f;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:r=this,t={prefix:v},n=[],a=!0,s=!1,e.prev=5,o=u(r.store.query(t));case 7:return e.next=9,o.next();case 9:return c=e.sent,a=c.done,e.next=13,c.value;case 13:if(p=e.sent,a){e.next=20;break}f=p,n.push(JSON.parse(y(f.value)));case 17:a=!0,e.next=7;break;case 20:e.next=26;break;case 22:e.prev=22,e.t0=e.catch(5),s=!0,i=e.t0;case 26:if(e.prev=26,e.prev=27,a||null==o.return){e.next=31;break}return e.next=31,o.return();case 31:if(e.prev=31,!s){e.next=34;break}throw i;case 34:return e.finish(31);case 35:return e.finish(26);case 36:return e.abrupt("return",n);case 37:case"end":return e.stop()}},e,this,[[5,22,26,36],[27,,31,35]])}));return function(){return e.apply(this,arguments)}}()},{key:"findKeyById",value:function(){var e=a(regeneratorRuntime.mark(function e(r){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.listKeys();case 3:return t=e.sent,e.abrupt("return",t.find(function(e){return e.id===r}));case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",x(e.t0));case 10:case"end":return e.stop()}},e,this,[[0,7]])}));return function(r){return e.apply(this,arguments)}}()},{key:"findKeyByName",value:function(){var e=a(regeneratorRuntime.mark(function e(r){var t,n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(d(r)){e.next=2;break}return e.abrupt("return",x(h(new Error("Invalid key name '".concat(r,"'")),"ERR_INVALID_KEY_NAME")));case 2:return t=g(r),e.prev=3,e.next=6,this.store.get(t);case 6:return n=e.sent,e.abrupt("return",JSON.parse(y(n)));case 10:return e.prev=10,e.t0=e.catch(3),e.abrupt("return",x(h(new Error("Key '".concat(r,"' does not exist. ").concat(e.t0.message)),"ERR_KEY_NOT_FOUND")));case 13:case"end":return e.stop()}},e,this,[[3,10]])}));return function(r){return e.apply(this,arguments)}}()},{key:"removeKey",value:function(){var e=a(regeneratorRuntime.mark(function e(r){var t,n,a,u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this,d(r)&&"self"!==r){e.next=3;break}return e.abrupt("return",x(h(new Error("Invalid key name '".concat(r,"'")),"ERR_INVALID_KEY_NAME")));case 3:return n=w(r),e.next=6,t.findKeyByName(r);case 6:return a=e.sent,(u=t.store.batch()).delete(n),u.delete(g(r)),e.next=12,u.commit();case 12:return e.abrupt("return",a);case 13:case"end":return e.stop()}},e,this)}));return function(r){return e.apply(this,arguments)}}()},{key:"renameKey",value:function(){var e=a(regeneratorRuntime.mark(function e(r,t){var n,a,u,s,i,o,c,p,f;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this,d(r)&&"self"!==r){e.next=3;break}return e.abrupt("return",x(h(new Error("Invalid old key name '".concat(r,"'")),"ERR_OLD_KEY_NAME_INVALID")));case 3:if(d(t)&&"self"!==t){e.next=5;break}return e.abrupt("return",x(h(new Error("Invalid new key name '".concat(t,"'")),"ERR_NEW_KEY_NAME_INVALID")));case 5:return a=w(r),u=w(t),s=g(r),i=g(t),e.next=11,n.store.has(u);case 11:if(!e.sent){e.next=14;break}return e.abrupt("return",x(h(new Error("Key '".concat(t,"' already exists")),"ERR_KEY_ALREADY_EXISTS")));case 14:return e.prev=14,e.next=17,n.store.get(a);case 17:return o=e.sent,e.next=20,n.store.get(s);case 20:return c=e.sent,(p=JSON.parse(y(c))).name=t,(f=n.store.batch()).put(u,o),f.put(i,l(JSON.stringify(p))),f.delete(a),f.delete(s),e.next=30,f.commit();case 30:return e.abrupt("return",p);case 33:return e.prev=33,e.t0=e.catch(14),e.abrupt("return",x(e.t0));case 36:case"end":return e.stop()}},e,this,[[14,33]])}));return function(r,t){return e.apply(this,arguments)}}()},{key:"exportKey",value:function(){var e=a(regeneratorRuntime.mark(function e(r,t){var n,a,u,s,i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(d(r)){e.next=2;break}return e.abrupt("return",x(h(new Error("Invalid key name '".concat(r,"'")),"ERR_INVALID_KEY_NAME")));case 2:if(t){e.next=4;break}return e.abrupt("return",x(h(new Error("Password is required"),"ERR_PASSWORD_REQUIRED")));case 4:return n=w(r),e.prev=5,e.next=8,this.store.get(n);case 8:return a=e.sent,u=y(a),s=b.get(this).dek,e.next=13,o.keys.import(u,s);case 13:return i=e.sent,e.abrupt("return",i.export(t));case 17:return e.prev=17,e.t0=e.catch(5),e.abrupt("return",x(e.t0));case 20:case"end":return e.stop()}},e,this,[[5,17]])}));return function(r,t){return e.apply(this,arguments)}}()},{key:"importKey",value:function(){var e=a(regeneratorRuntime.mark(function e(r,t,n){var a,u,s,i,c,p,f;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a=this,d(r)&&"self"!==r){e.next=3;break}return e.abrupt("return",x(h(new Error("Invalid key name '".concat(r,"'")),"ERR_INVALID_KEY_NAME")));case 3:if(t){e.next=5;break}return e.abrupt("return",x(h(new Error("PEM encoded key is required"),"ERR_PEM_REQUIRED")));case 5:return u=w(r),e.next=8,a.store.has(u);case 8:if(!e.sent){e.next=11;break}return e.abrupt("return",x(h(new Error("Key '".concat(r,"' already exists")),"ERR_KEY_ALREADY_EXISTS")));case 11:return e.prev=11,e.next=14,o.keys.import(t,n);case 14:s=e.sent,e.next=20;break;case 17:return e.prev=17,e.t0=e.catch(11),e.abrupt("return",x(h(new Error("Cannot read the key, most likely the password is wrong"),"ERR_CANNOT_READ_KEY")));case 20:return e.prev=20,e.next=23,s.id();case 23:return i=e.sent,c=b.get(this).dek,e.next=27,s.export(c);case 27:t=e.sent,e.next=33;break;case 30:return e.prev=30,e.t1=e.catch(20),e.abrupt("return",x(e.t1));case 33:return p={name:r,id:i},(f=a.store.batch()).put(u,l(t)),f.put(g(r),l(JSON.stringify(p))),e.next=39,f.commit();case 39:return e.abrupt("return",p);case 40:case"end":return e.stop()}},e,this,[[11,17],[20,30]])}));return function(r,t,n){return e.apply(this,arguments)}}()},{key:"importPeer",value:function(){var e=a(regeneratorRuntime.mark(function e(r,t){var n,a,u,s,i,o,c,p;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this,d(r)){e.next=3;break}return e.abrupt("return",x(h(new Error("Invalid key name '".concat(r,"'")),"ERR_INVALID_KEY_NAME")));case 3:if(t&&t.privKey){e.next=5;break}return e.abrupt("return",x(h(new Error("Peer.privKey is required"),"ERR_MISSING_PRIVATE_KEY")));case 5:return a=t.privKey,u=w(r),e.next=9,n.store.has(u);case 9:if(!e.sent){e.next=12;break}return e.abrupt("return",x(h(new Error("Key '".concat(r,"' already exists")),"ERR_KEY_ALREADY_EXISTS")));case 12:return e.prev=12,e.next=15,a.id();case 15:return s=e.sent,i=b.get(this).dek,e.next=19,a.export(i);case 19:return o=e.sent,c={name:r,id:s},(p=n.store.batch()).put(u,l(o)),p.put(g(r),l(JSON.stringify(c))),e.next=26,p.commit();case 26:return e.abrupt("return",c);case 29:return e.prev=29,e.t0=e.catch(12),e.abrupt("return",x(e.t0));case 32:case"end":return e.stop()}},e,this,[[12,29]])}));return function(r,t){return e.apply(this,arguments)}}()},{key:"_getPrivateKey",value:function(){var e=a(regeneratorRuntime.mark(function e(r){var t,n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(d(r)){e.next=2;break}return e.abrupt("return",x(h(new Error("Invalid key name '".concat(r,"'")),"ERR_INVALID_KEY_NAME")));case 2:return e.prev=2,t=w(r),e.next=6,this.store.get(t);case 6:return n=e.sent,e.abrupt("return",y(n));case 10:return e.prev=10,e.t0=e.catch(2),e.abrupt("return",x(h(new Error("Key '".concat(r,"' does not exist. ").concat(e.t0.message)),"ERR_KEY_NOT_FOUND")));case 13:case"end":return e.stop()}},e,this,[[2,10]])}));return function(r){return e.apply(this,arguments)}}()}],[{key:"generateOptions",value:function(){var e=Object.assign({},k),r=3*Math.ceil(E.minSaltLength/3);return e.dek.salt=y(o.randomBytes(r),"base64"),e}},{key:"options",get:function(){return k}}]),r}();module.exports=_;
|
||
},{"sanitize-filename":"1cON","merge-options":"/OBv","libp2p-crypto":"Gcnt","interface-datastore":"q9af","./cms":"/DxU","err-code":"hLMW","uint8arrays/to-string":"aFN1","uint8arrays/from-string":"YqS+","node-forge/lib/sha512":"KQsE"}],"ieYp":[function(require,module,exports) {
|
||
var process = require("process");
|
||
var e=require("process");function r(e,r){return a(e)||t(e,r)||x(e,r)||n()}function n(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function t(e,r){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],t=!0,a=!1,u=void 0;try{for(var c,o=e[Symbol.iterator]();!(t=(c=o.next()).done)&&(n.push(c.value),!r||n.length!==r);t=!0);}catch(i){a=!0,u=i}finally{try{t||null==o.return||o.return()}finally{if(a)throw u}}return n}}function a(e){if(Array.isArray(e))return e}function u(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function c(e,r,n,t,a,u,c){try{var o=e[u](c),i=o.value}catch(s){return void n(s)}o.done?r(i):Promise.resolve(i).then(t,a)}function o(e){return function(){var r=this,n=arguments;return new Promise(function(t,a){var u=e.apply(r,n);function o(e){c(u,t,a,o,i,"next",e)}function i(e){c(u,t,a,o,i,"throw",e)}o(void 0)})}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.batch=I,exports.buffer=_,exports.collect=z,exports.concat=q,exports.consume=U,exports.filter=D,exports.flatMap=Q,exports.flatTransform=W,exports.flatten=G,exports.fromStream=ne,exports.getIterator=j,exports.map=N,exports.merge=te,exports.parallelFlatMap=se,exports.parallelMap=ie,exports.parallelMerge=fe,exports.pipeline=ue,exports.reduce=xe,exports.take=me,exports.tap=we,exports.time=je,exports.transform=Pe,exports.writeToStream=Oe;var i=regeneratorRuntime.mark(S),s=regeneratorRuntime.mark(M),f=regeneratorRuntime.mark(L),p=regeneratorRuntime.mark(ke),l=regeneratorRuntime.mark(Ie);function v(e,r){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=x(e))||r&&e&&"number"==typeof e.length){n&&(e=n);var t=0,a=function(){};return{s:a,n:function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var u,c=!0,o=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return c=e.done,e},e:function(e){o=!0,u=e},f:function(){try{c||null==n.return||n.return()}finally{if(o)throw u}}}}function x(e,r){if(e){if("string"==typeof e)return h(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?h(e,r):void 0}}function h(e,r){(null==r||r>e.length)&&(r=e.length);for(var n=0,t=new Array(r);n<r;n++)t[n]=e[n];return t}function b(e,r){var n={},t=!1;function a(n,a){return t=!0,a=new Promise(function(r){r(e[n](a))}),{done:!1,value:r(a)}}return"function"==typeof Symbol&&Symbol.iterator&&(n[Symbol.iterator]=function(){return this}),n.next=function(e){return t?(t=!1,e):a("next",e)},"function"==typeof e.throw&&(n.throw=function(e){if(t)throw t=!1,e;return a("throw",e)}),"function"==typeof e.return&&(n.return=function(e){return t?(t=!1,e):a("return",e)}),n}function k(e){return new d(e)}function m(e){return function(){return new y(e.apply(this,arguments))}}function y(e){var r,n;function t(r,n){try{var u=e[r](n),c=u.value,o=c instanceof d;Promise.resolve(o?c.wrapped:c).then(function(e){o?t("return"===r?"return":"next",e):a(u.done?"return":"normal",e)},function(e){t("throw",e)})}catch(i){a("throw",i)}}function a(e,a){switch(e){case"return":r.resolve({value:a,done:!0});break;case"throw":r.reject(a);break;default:r.resolve({value:a,done:!1})}(r=r.next)?t(r.key,r.arg):n=null}this._invoke=function(e,a){return new Promise(function(u,c){var o={key:e,arg:a,resolve:u,reject:c,next:null};n?n=n.next=o:(r=n=o,t(e,a))})},"function"!=typeof e.return&&(this.return=void 0)}function d(e){this.wrapped=e}function w(e){var r;if("undefined"!=typeof Symbol){if(Symbol.asyncIterator&&null!=(r=e[Symbol.asyncIterator]))return r.call(e);if(Symbol.iterator&&null!=(r=e[Symbol.iterator]))return r.call(e)}throw new TypeError("Object is not async iterable")}function g(e,r){return R.apply(this,arguments)}function R(){return(R=m(regeneratorRuntime.mark(function e(r,n){var t,a,u,c,o,i,s,f;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=[],a=!0,u=!1,e.prev=3,o=w(n);case 5:return e.next=7,k(o.next());case 7:return i=e.sent,a=i.done,e.next=11,k(i.value);case 11:if(s=e.sent,a){e.next=22;break}if(f=s,t.push(f),t.length!==r){e.next=19;break}return e.next=18,t;case 18:t=[];case 19:a=!0,e.next=5;break;case 22:e.next=28;break;case 24:e.prev=24,e.t0=e.catch(3),u=!0,c=e.t0;case 28:if(e.prev=28,e.prev=29,a||null==o.return){e.next=33;break}return e.next=33,k(o.return());case 33:if(e.prev=33,!u){e.next=36;break}throw c;case 36:return e.finish(33);case 37:return e.finish(28);case 38:if(!(t.length>0)){e.next=41;break}return e.next=41,t;case 41:case"end":return e.stop()}},e,null,[[3,24,28,38],[29,,33,37]])}))).apply(this,arguments)}function S(e,r){var n,t,a,u;return regeneratorRuntime.wrap(function(c){for(;;)switch(c.prev=c.next){case 0:n=[],t=v(r),c.prev=2,t.s();case 4:if((a=t.n()).done){c.next=13;break}if(u=a.value,n.push(u),n.length!==e){c.next=11;break}return c.next=10,n;case 10:n=[];case 11:c.next=4;break;case 13:c.next=18;break;case 15:c.prev=15,c.t0=c.catch(2),t.e(c.t0);case 18:return c.prev=18,t.f(),c.finish(18);case 21:if(!(n.length>0)){c.next=24;break}return c.next=24,n;case 24:case"end":return c.stop()}},i,null,[[2,15,18,21]])}function I(e,r){return void 0===r?function(r){return I(e,r)}:r[Symbol.asyncIterator]?g(e,r):S(e,r)}function j(e){if("function"==typeof e.next)return e;if("function"==typeof e[Symbol.iterator])return e[Symbol.iterator]();if("function"==typeof e[Symbol.asyncIterator])return e[Symbol.asyncIterator]();throw new TypeError('"values" does not to conform to any of the iterator or iterable protocols')}function A(){var e,r;return{promise:new Promise(function(n,t){r=n,e=t}),reject:e,resolve:r}}function P(e,r){var n=j(r),t=[],a=[],c=!1,i=!1;function s(){for(;a.length>0&&t.length>0;){var e=a.shift(),r=t.shift(),n=r.error,u=r.value;n?e.reject(n):e.resolve({done:!1,value:u})}for(;a.length>0&&i;){(0,a.shift().resolve)({done:!0,value:void 0})}}function f(){return p.apply(this,arguments)}function p(){return(p=o(regeneratorRuntime.mark(function r(){var a,u,o;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(!i){r.next=2;break}return r.abrupt("return");case 2:if(!c){r.next=4;break}return r.abrupt("return");case 4:if(!(t.length>=e)){r.next=6;break}return r.abrupt("return");case 6:return c=!0,r.prev=7,r.next=10,n.next();case 10:a=r.sent,u=a.done,o=a.value,u?i=!0:t.push({value:o}),r.next=20;break;case 16:r.prev=16,r.t0=r.catch(7),i=!0,t.push({error:r.t0});case 20:s(),c=!1,f();case 23:case"end":return r.stop()}},r,null,[[7,16]])}))).apply(this,arguments)}function l(){return(l=o(regeneratorRuntime.mark(function e(){var r,n,u,c;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(t.length>0)){e.next=6;break}if(r=t.shift(),n=r.error,u=r.value,!n){e.next=4;break}throw n;case 4:return f(),e.abrupt("return",{done:!1,value:u});case 6:if(!i){e.next=8;break}return e.abrupt("return",{done:!0,value:void 0});case 8:return c=A(),a.push(c),f(),e.abrupt("return",c.promise);case 12:case"end":return e.stop()}},e)}))).apply(this,arguments)}var v=u({next:function(){return l.apply(this,arguments)}},Symbol.asyncIterator,function(){return v});return v}function M(e,r){var n,t,a,u,c,o,i,f;return regeneratorRuntime.wrap(function(s){for(;;)switch(s.prev=s.next){case 0:n=[],s.prev=1,a=v(r),s.prev=3,a.s();case 5:if((u=a.n()).done){s.next=14;break}if(c=u.value,n.push(c),!(n.length<=e)){s.next=10;break}return s.abrupt("continue",12);case 10:return s.next=12,n.shift();case 12:s.next=5;break;case 14:s.next=19;break;case 16:s.prev=16,s.t0=s.catch(3),a.e(s.t0);case 19:return s.prev=19,a.f(),s.finish(19);case 22:s.next=27;break;case 24:s.prev=24,s.t1=s.catch(1),t=s.t1;case 27:o=0,i=n;case 28:if(!(o<i.length)){s.next=35;break}return f=i[o],s.next=32,f;case 32:o++,s.next=28;break;case 35:if(!t){s.next=37;break}throw t;case 37:case"end":return s.stop()}},s,null,[[1,24],[3,16,19,22]])}function _(e,r){return void 0===r?function(r){return _(e,r)}:0===e?r:r[Symbol.asyncIterator]?P(e,r):M(e,r)}function O(e){return T.apply(this,arguments)}function T(){return(T=o(regeneratorRuntime.mark(function e(r){var n,t,a,u,c,o,i,s;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=[],t=!0,a=!1,e.prev=3,c=w(r);case 5:return e.next=7,c.next();case 7:return o=e.sent,t=o.done,e.next=11,o.value;case 11:if(i=e.sent,t){e.next=18;break}s=i,n.push(s);case 15:t=!0,e.next=5;break;case 18:e.next=24;break;case 20:e.prev=20,e.t0=e.catch(3),a=!0,u=e.t0;case 24:if(e.prev=24,e.prev=25,t||null==c.return){e.next=29;break}return e.next=29,c.return();case 29:if(e.prev=29,!a){e.next=32;break}throw u;case 32:return e.finish(29);case 33:return e.finish(24);case 34:return e.abrupt("return",n);case 35:case"end":return e.stop()}},e,null,[[3,20,24,34],[25,,29,33]])}))).apply(this,arguments)}function z(e){return e[Symbol.asyncIterator]?O(e):Array.from(e)}function E(e){return Y.apply(this,arguments)}function Y(){return(Y=m(regeneratorRuntime.mark(function e(r){var n,t,a,u,c,o,i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=!0,t=!1,e.prev=2,u=w(r);case 4:return e.next=6,k(u.next());case 6:return c=e.sent,n=c.done,e.next=10,k(c.value);case 10:if(o=e.sent,n){e.next=17;break}return i=o,e.delegateYield(b(w(i),k),"t0",14);case 14:n=!0,e.next=4;break;case 17:e.next=23;break;case 19:e.prev=19,e.t1=e.catch(2),t=!0,a=e.t1;case 23:if(e.prev=23,e.prev=24,n||null==u.return){e.next=28;break}return e.next=28,k(u.return());case 28:if(e.prev=28,!t){e.next=31;break}throw a;case 31:return e.finish(28);case 32:return e.finish(23);case 33:case"end":return e.stop()}},e,null,[[2,19,23,33],[24,,28,32]])}))).apply(this,arguments)}function L(e){var r,n,t;return regeneratorRuntime.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:r=v(e),a.prev=1,r.s();case 3:if((n=r.n()).done){a.next=8;break}return t=n.value,a.delegateYield(t,"t0",6);case 6:a.next=3;break;case 8:a.next=13;break;case 10:a.prev=10,a.t1=a.catch(1),r.e(a.t1);case 13:return a.prev=13,r.f(),a.finish(13);case 16:case"end":return a.stop()}},f,null,[[1,10,13,16]])}function q(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return r.find(function(e){return void 0!==e[Symbol.asyncIterator]})?E(r):L(r)}function C(e){return F.apply(this,arguments)}function F(){return(F=o(regeneratorRuntime.mark(function e(r){var n,t,a,u,c,o;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=!0,t=!1,e.prev=2,u=w(r);case 4:return e.next=6,u.next();case 6:return c=e.sent,n=c.done,e.next=10,c.value;case 10:if(o=e.sent,n){e.next=16;break}o;case 13:n=!0,e.next=4;break;case 16:e.next=22;break;case 18:e.prev=18,e.t0=e.catch(2),t=!0,a=e.t0;case 22:if(e.prev=22,e.prev=23,n||null==u.return){e.next=27;break}return e.next=27,u.return();case 27:if(e.prev=27,!t){e.next=30;break}throw a;case 30:return e.finish(27);case 31:return e.finish(22);case 32:case"end":return e.stop()}},e,null,[[2,18,22,32],[23,,27,31]])}))).apply(this,arguments)}function U(e){if(e[Symbol.asyncIterator])return C(e);var r,n=v(e);try{for(n.s();!(r=n.n()).done;)r.value}catch(t){n.e(t)}finally{n.f()}}function $(e,r){return B.apply(this,arguments)}function B(){return(B=m(regeneratorRuntime.mark(function e(r,n){var t,a,u,c,o,i,s;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=!0,a=!1,e.prev=2,c=w(n);case 4:return e.next=6,k(c.next());case 6:return o=e.sent,t=o.done,e.next=10,k(o.value);case 10:if(i=e.sent,t){e.next=21;break}return s=i,e.next=15,k(r(s));case 15:if(!e.sent){e.next=18;break}return e.next=18,s;case 18:t=!0,e.next=4;break;case 21:e.next=27;break;case 23:e.prev=23,e.t0=e.catch(2),a=!0,u=e.t0;case 27:if(e.prev=27,e.prev=28,t||null==c.return){e.next=32;break}return e.next=32,k(c.return());case 32:if(e.prev=32,!a){e.next=35;break}throw u;case 35:return e.finish(32);case 36:return e.finish(27);case 37:case"end":return e.stop()}},e,null,[[2,23,27,37],[28,,32,36]])}))).apply(this,arguments)}function D(e,r){return void 0===r?function(r){return $(e,r)}:$(e,r)}function G(e){return H.apply(this,arguments)}function H(){return(H=m(regeneratorRuntime.mark(function e(r){var n,t,a,u,c,o,i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=!0,t=!1,e.prev=2,u=w(r);case 4:return e.next=6,k(u.next());case 6:return c=e.sent,n=c.done,e.next=10,k(c.value);case 10:if(o=e.sent,n){e.next=22;break}if(!(i=o)||"string"==typeof i||!i[Symbol.iterator]&&!i[Symbol.asyncIterator]){e.next=17;break}return e.delegateYield(b(w(G(i)),k),"t0",15);case 15:e.next=19;break;case 17:return e.next=19,i;case 19:n=!0,e.next=4;break;case 22:e.next=28;break;case 24:e.prev=24,e.t1=e.catch(2),t=!0,a=e.t1;case 28:if(e.prev=28,e.prev=29,n||null==u.return){e.next=33;break}return e.next=33,k(u.return());case 33:if(e.prev=33,!t){e.next=36;break}throw a;case 36:return e.finish(33);case 37:return e.finish(28);case 38:case"end":return e.stop()}},e,null,[[2,24,28,38],[29,,33,37]])}))).apply(this,arguments)}function J(e,r){return K.apply(this,arguments)}function K(){return(K=m(regeneratorRuntime.mark(function e(r,n){var t,a,u,c,o,i,s;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=!0,a=!1,e.prev=2,c=w(n);case 4:return e.next=6,k(c.next());case 6:return o=e.sent,t=o.done,e.next=10,k(o.value);case 10:if(i=e.sent,t){e.next=18;break}return s=i,e.next=15,r(s);case 15:t=!0,e.next=4;break;case 18:e.next=24;break;case 20:e.prev=20,e.t0=e.catch(2),a=!0,u=e.t0;case 24:if(e.prev=24,e.prev=25,t||null==c.return){e.next=29;break}return e.next=29,k(c.return());case 29:if(e.prev=29,!a){e.next=32;break}throw u;case 32:return e.finish(29);case 33:return e.finish(24);case 34:case"end":return e.stop()}},e,null,[[2,20,24,34],[25,,29,33]])}))).apply(this,arguments)}function N(e,r){return void 0===r?function(r){return J(e,r)}:J(e,r)}function Q(e,r){return void 0===r?function(r){return Q(e,r)}:D(function(e){return null!=e},G(N(e,r)))}function V(e,r,n){var t=j(n),a=[],c=[],i=!1,s=!1,f=0,p=null;function l(){for(;c.length>0&&a.length>0;){(0,c.shift().resolve)({done:!1,value:a.shift()})}for(;c.length>0&&0===f&&i;){var e=c.shift(),r=e.resolve,n=e.reject;p?(n(p),p=null):r({done:!0,value:void 0})}}function v(){return x.apply(this,arguments)}function x(){return(x=o(regeneratorRuntime.mark(function r(){var n,u,c;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(!i){r.next=3;break}return l(),r.abrupt("return");case 3:if(!s){r.next=5;break}return r.abrupt("return");case 5:if(!(f+a.length>=e)){r.next=7;break}return r.abrupt("return");case 7:return s=!0,f++,r.prev=9,r.next=12,t.next();case 12:n=r.sent,u=n.done,c=n.value,u?(i=!0,f--,l()):h(c),r.next=24;break;case 18:r.prev=18,r.t0=r.catch(9),i=!0,f--,p=r.t0,l();case 24:s=!1,v();case 26:case"end":return r.stop()}},r,null,[[9,18]])}))).apply(this,arguments)}function h(e){return b.apply(this,arguments)}function b(){return(b=o(regeneratorRuntime.mark(function e(n){var t,u,c,o,s,x,h,b;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,r(n);case 3:if(!(t=e.sent)||!t[Symbol.asyncIterator]){e.next=40;break}u=!0,c=!1,e.prev=7,s=w(t);case 9:return e.next=11,s.next();case 11:return x=e.sent,u=x.done,e.next=15,x.value;case 15:if(h=e.sent,u){e.next=22;break}b=h,a.push(b);case 19:u=!0,e.next=9;break;case 22:e.next=28;break;case 24:e.prev=24,e.t0=e.catch(7),c=!0,o=e.t0;case 28:if(e.prev=28,e.prev=29,u||null==s.return){e.next=33;break}return e.next=33,s.return();case 33:if(e.prev=33,!c){e.next=36;break}throw o;case 36:return e.finish(33);case 37:return e.finish(28);case 38:e.next=41;break;case 40:a.push(t);case 41:e.next=47;break;case 43:e.prev=43,e.t1=e.catch(0),i=!0,p=e.t1;case 47:f--,l(),v();case 50:case"end":return e.stop()}},e,null,[[0,43],[7,24,28,38],[29,,33,37]])}))).apply(this,arguments)}function k(){return(k=o(regeneratorRuntime.mark(function e(){var r,n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==a.length){e.next=5;break}return r=A(),c.push(r),v(),e.abrupt("return",r.promise);case 5:return n=a.shift(),v(),e.abrupt("return",{done:!1,value:n});case 8:case"end":return e.stop()}},e)}))).apply(this,arguments)}var m=u({next:function(){return k.apply(this,arguments)}},Symbol.asyncIterator,function(){return m});return m}function W(e,r,n){return void 0===r?function(r,n){return n?W(e,r,n):W(e,r)}:void 0===n?function(n){return W(e,r,n)}:D(function(e){return null!=e},G(V(e,r,n)))}function X(e){return Z.apply(this,arguments)}function Z(){return(Z=o(regeneratorRuntime.mark(function e(r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(e){r.once("readable",function(){e()})}));case 1:case"end":return e.stop()}},e)}))).apply(this,arguments)}function ee(e){return re.apply(this,arguments)}function re(){return(re=m(regeneratorRuntime.mark(function e(r){var n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(n=r.read())){e.next=6;break}return e.next=5,n;case 5:return e.abrupt("continue",0);case 6:if(!r._readableState.ended){e.next=8;break}return e.abrupt("break",12);case 8:return e.next=10,k(X(r));case 10:e.next=0;break;case 12:case"end":return e.stop()}},e)}))).apply(this,arguments)}function ne(e){return"function"==typeof e[Symbol.asyncIterator]?e:ee(e)}function te(){return ae.apply(this,arguments)}function ae(){return(ae=m(regeneratorRuntime.mark(function e(){var r,n,t,a,u,c,o,i,s=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:for(r=s.length,n=new Array(r),t=0;t<r;t++)n[t]=s[t];a=new Set(n.map(j));case 2:if(!(a.size>0)){e.next=29;break}u=v(a),e.prev=4,u.s();case 6:if((c=u.n()).done){e.next=19;break}return o=c.value,e.next=10,k(o.next());case 10:if(!(i=e.sent).done){e.next=15;break}a.delete(o),e.next=17;break;case 15:return e.next=17,i.value;case 17:e.next=6;break;case 19:e.next=24;break;case 21:e.prev=21,e.t0=e.catch(4),u.e(e.t0);case 24:return e.prev=24,u.f(),e.finish(24);case 27:e.next=2;break;case 29:case"end":return e.stop()}},e,null,[[4,21,24,27]])}))).apply(this,arguments)}function ue(e){for(var r=e(),n=arguments.length,t=new Array(n>1?n-1:0),a=1;a<n;a++)t[a-1]=arguments[a];for(var u=0,c=t;u<c.length;u++){r=(0,c[u])(r)}return r}function ce(e,r,n){return oe.apply(this,arguments)}function oe(){return(oe=m(regeneratorRuntime.mark(function e(r,n,t){var a,u,c,o,i,s,f,p;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:a=null,u=function(e){return{value:n(e)}},c=function(){var e=m(regeneratorRuntime.mark(function e(r){var n,t,u,c,o,i,s;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=!0,t=!1,e.prev=2,c=w(r);case 4:return e.next=6,k(c.next());case 6:return o=e.sent,n=o.done,e.next=10,k(o.value);case 10:if(i=e.sent,n){e.next=20;break}if(s=i,!a){e.next=15;break}return e.abrupt("return");case 15:return e.next=17,s;case 17:n=!0,e.next=4;break;case 20:e.next=26;break;case 22:e.prev=22,e.t0=e.catch(2),t=!0,u=e.t0;case 26:if(e.prev=26,e.prev=27,n||null==c.return){e.next=31;break}return e.next=31,k(c.return());case 31:if(e.prev=31,!t){e.next=34;break}throw u;case 34:return e.finish(31);case 35:return e.finish(26);case 36:case"end":return e.stop()}},e,null,[[2,22,26,36],[27,,31,35]])}));return function(r){return e.apply(this,arguments)}}(),o=ue(function(){return t},_(1),c,N(u),_(r-1)),i=j(o);case 5:return e.next=8,k(i.next());case 8:if(s=e.sent,f=s.value,!s.done){e.next=13;break}return e.abrupt("break",27);case 13:return e.prev=13,e.next=16,k(f.value);case 16:if(p=e.sent,a){e.next=20;break}return e.next=20,p;case 20:e.next=25;break;case 22:e.prev=22,e.t0=e.catch(13),a=e.t0;case 25:e.next=5;break;case 27:if(!a){e.next=29;break}throw a;case 29:case"end":return e.stop()}},e,null,[[13,22]])}))).apply(this,arguments)}function ie(e,r,n){return void 0===r?function(r,n){return ie(e,r,n)}:void 0===n?function(n){return ie(e,r,n)}:1===e?N(r,n):ce(e,r,n)}function se(e,r,n){return void 0===r?function(r,n){return n?se(e,r,n):se(e,r)}:void 0===n?function(n){return se(e,r,n)}:D(function(e){return null!=e},G(ie(e,r,n)))}function fe(){return pe.apply(this,arguments)}function pe(){return(pe=m(regeneratorRuntime.mark(function e(){var n,t,a,u,c,i,s,f,p,l,x,h,b,m,y,d,w,g,R,S,I,A=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:for(n=A.length,t=new Array(n),a=0;a<n;a++)t[a]=A[a];u=t.map(j),c=new Set,i=new Map,s=null,f=null,p=null,l=function(e){s=e,f&&f(e)},x=function(e){p&&p(e)},h=function(){return new Promise(function(e,r){if(s&&r(s),i.size>0)return e();p=e,f=r})},b=function(e){var r=Promise.resolve(e.next()).then(function(){var n=o(regeneratorRuntime.mark(function n(t){var a,u;return regeneratorRuntime.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:a=t.done,u=t.value,a||i.set(e,u),c.delete(r);case 3:case"end":return n.stop()}},n)}));return function(e){return n.apply(this,arguments)}}());c.add(r),r.then(x,l)},m=v(u);try{for(m.s();!(y=m.n()).done;)d=y.value,b(d)}catch(P){m.e(P)}finally{m.f()}case 13:if(0!==c.size||0!==i.size){e.next=16;break}return e.abrupt("return");case 16:return e.next=18,k(h());case 18:w=v(i),e.prev=19,w.s();case 21:if((g=w.n()).done){e.next=29;break}return R=r(g.value,2),S=R[0],I=R[1],i.delete(S),e.next=26,I;case 26:b(S);case 27:e.next=21;break;case 29:e.next=34;break;case 31:e.prev=31,e.t0=e.catch(19),w.e(e.t0);case 34:return e.prev=34,w.f(),e.finish(34);case 37:e.next=13;break;case 39:case"end":return e.stop()}},e,null,[[19,31,34,37]])}))).apply(this,arguments)}function le(e,r,n){return ve.apply(this,arguments)}function ve(){return(ve=o(regeneratorRuntime.mark(function e(r,n,t){var a,u,c,o,i,s,f,p;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:a=n,u=!0,c=!1,e.prev=3,i=w(t);case 5:return e.next=7,i.next();case 7:return s=e.sent,u=s.done,e.next=11,s.value;case 11:if(f=e.sent,u){e.next=20;break}return p=f,e.next=16,r(a,p);case 16:a=e.sent;case 17:u=!0,e.next=5;break;case 20:e.next=26;break;case 22:e.prev=22,e.t0=e.catch(3),c=!0,o=e.t0;case 26:if(e.prev=26,e.prev=27,u||null==i.return){e.next=31;break}return e.next=31,i.return();case 31:if(e.prev=31,!c){e.next=34;break}throw o;case 34:return e.finish(31);case 35:return e.finish(26);case 36:return e.abrupt("return",a);case 37:case"end":return e.stop()}},e,null,[[3,22,26,36],[27,,31,35]])}))).apply(this,arguments)}function xe(e,r,n){return void 0===r?function(r,n){return n?le(e,r,n):xe(e,r)}:void 0===n?function(n){return xe(e,r,n)}:le(e,r,n)}function he(e,r){return be.apply(this,arguments)}function be(){return(be=m(regeneratorRuntime.mark(function e(r,n){var t,a,u,c,o,i,s,f;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=0,a=!0,u=!1,e.prev=3,o=w(n);case 5:return e.next=7,k(o.next());case 7:return i=e.sent,a=i.done,e.next=11,k(i.value);case 11:if(s=e.sent,a){e.next=22;break}return f=s,e.next=16,f;case 16:if(!(++t>=r)){e.next=19;break}return e.abrupt("break",22);case 19:a=!0,e.next=5;break;case 22:e.next=28;break;case 24:e.prev=24,e.t0=e.catch(3),u=!0,c=e.t0;case 28:if(e.prev=28,e.prev=29,a||null==o.return){e.next=33;break}return e.next=33,k(o.return());case 33:if(e.prev=33,!u){e.next=36;break}throw c;case 36:return e.finish(33);case 37:return e.finish(28);case 38:case"end":return e.stop()}},e,null,[[3,24,28,38],[29,,33,37]])}))).apply(this,arguments)}function ke(e,r){var n,t,a,u;return regeneratorRuntime.wrap(function(c){for(;;)switch(c.prev=c.next){case 0:n=0,t=v(r),c.prev=2,t.s();case 4:if((a=t.n()).done){c.next=13;break}return u=a.value,c.next=8,u;case 8:if(!(++n>=e)){c.next=11;break}return c.abrupt("break",13);case 11:c.next=4;break;case 13:c.next=18;break;case 15:c.prev=15,c.t0=c.catch(2),t.e(c.t0);case 18:return c.prev=18,t.f(),c.finish(18);case 21:case"end":return c.stop()}},p,null,[[2,15,18,21]])}function me(e,r){return void 0===r?function(r){return me(e,r)}:r[Symbol.asyncIterator]?he(e,r):ke(e,r)}function ye(e,r){return de.apply(this,arguments)}function de(){return(de=m(regeneratorRuntime.mark(function e(r,n){var t,a,u,c,o,i,s;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=!0,a=!1,e.prev=2,c=w(n);case 4:return e.next=6,k(c.next());case 6:return o=e.sent,t=o.done,e.next=10,k(o.value);case 10:if(i=e.sent,t){e.next=20;break}return s=i,e.next=15,k(r(s));case 15:return e.next=17,s;case 17:t=!0,e.next=4;break;case 20:e.next=26;break;case 22:e.prev=22,e.t0=e.catch(2),a=!0,u=e.t0;case 26:if(e.prev=26,e.prev=27,t||null==c.return){e.next=31;break}return e.next=31,k(c.return());case 31:if(e.prev=31,!a){e.next=34;break}throw u;case 34:return e.finish(31);case 35:return e.finish(26);case 36:case"end":return e.stop()}},e,null,[[2,22,26,36],[27,,31,35]])}))).apply(this,arguments)}function we(e,r){return void 0===r?function(r){return ye(e,r)}:ye(e,r)}function ge(e,r){var n=e[0]+r[0],t=e[1]+r[1];if(t>=1e9){var a=t%1e9;n+=(t-a)/1e9,t=a}return[n,t]}function Re(e,r){return Se.apply(this,arguments)}function Se(){return(Se=m(regeneratorRuntime.mark(function r(n,t){var a,u,c,o,i,s,f;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:a=t[Symbol.asyncIterator](),u=[0,0];case 2:return c=e.hrtime(),r.next=6,k(a.next());case 6:if(o=r.sent,i=o.value,s=o.done,f=e.hrtime(c),u=ge(u,f),n.progress&&n.progress(f,u),!s){r.next=15;break}return n.total&&n.total(u),r.abrupt("return",i);case 15:return r.next=17,i;case 17:r.next=2;break;case 19:case"end":return r.stop()}},r)}))).apply(this,arguments)}function Ie(r,n){var t,a,u,c,o,i,s;return regeneratorRuntime.wrap(function(f){for(;;)switch(f.prev=f.next){case 0:t=n[Symbol.iterator](),a=[0,0];case 2:if(u=e.hrtime(),c=t.next(),o=c.value,i=c.done,s=e.hrtime(u),a=ge(a,s),r.progress&&r.progress(s,a),!i){f.next=11;break}return r.total&&r.total(a),f.abrupt("return",o);case 11:return f.next=13,o;case 13:f.next=2;break;case 15:case"end":return f.stop()}},l)}function je(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return void 0===r?function(r){return je(e,r)}:void 0!==r[Symbol.asyncIterator]?Re(e,r):Ie(e,r)}function Ae(e,r,n){var t=j(n),a=[],c=[],i=!1,s=!1,f=0,p=null;function l(){for(;c.length>0&&a.length>0;){(0,c.shift().resolve)({done:!1,value:a.shift()})}for(;c.length>0&&0===f&&i;){var e=c.shift(),r=e.resolve,n=e.reject;p?(n(p),p=null):r({done:!0,value:void 0})}}function v(){return x.apply(this,arguments)}function x(){return(x=o(regeneratorRuntime.mark(function r(){var n,u,c;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(!i){r.next=3;break}return l(),r.abrupt("return");case 3:if(!s){r.next=5;break}return r.abrupt("return");case 5:if(!(f+a.length>=e)){r.next=7;break}return r.abrupt("return");case 7:return s=!0,f++,r.prev=9,r.next=12,t.next();case 12:n=r.sent,u=n.done,c=n.value,u?(i=!0,f--,l()):h(c),r.next=24;break;case 18:r.prev=18,r.t0=r.catch(9),i=!0,f--,p=r.t0,l();case 24:s=!1,v();case 26:case"end":return r.stop()}},r,null,[[9,18]])}))).apply(this,arguments)}function h(e){return b.apply(this,arguments)}function b(){return(b=o(regeneratorRuntime.mark(function e(n){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,r(n);case 3:t=e.sent,a.push(t),e.next=11;break;case 7:e.prev=7,e.t0=e.catch(0),i=!0,p=e.t0;case 11:f--,l(),v();case 14:case"end":return e.stop()}},e,null,[[0,7]])}))).apply(this,arguments)}function k(){return(k=o(regeneratorRuntime.mark(function e(){var r,n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==a.length){e.next=5;break}return r=A(),c.push(r),v(),e.abrupt("return",r.promise);case 5:return n=a.shift(),v(),e.abrupt("return",{done:!1,value:n});case 8:case"end":return e.stop()}},e)}))).apply(this,arguments)}var m=u({next:function(){return k.apply(this,arguments)}},Symbol.asyncIterator,function(){return m});return m}function Pe(e,r,n){return void 0===r?function(r,n){return n?Pe(e,r,n):Pe(e,r)}:void 0===n?function(n){return Pe(e,r,n)}:Ae(e,r,n)}function Me(e,r){return _e.apply(this,arguments)}function _e(){return(_e=o(regeneratorRuntime.mark(function e(r,n){var t,a,u,c,o,i,s,f,p,l,v,x,h,b;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=null,a=null,u=null,c=function(e){t=e,a&&a(e)},o=function(){u&&u()},i=function(){r.removeListener("error",c),r.removeListener("drain",o)},r.once("error",c),s=function(){return new Promise(function(e,n){if(t)return n(t);r.once("drain",o),u=e,a=n})},f=!0,p=!1,e.prev=10,v=w(n);case 12:return e.next=14,v.next();case 14:return x=e.sent,f=x.done,e.next=18,x.value;case 18:if(h=e.sent,f){e.next=29;break}if(b=h,!1!==r.write(b)){e.next=24;break}return e.next=24,s();case 24:if(!t){e.next=26;break}return e.abrupt("break",29);case 26:f=!0,e.next=12;break;case 29:e.next=35;break;case 31:e.prev=31,e.t0=e.catch(10),p=!0,l=e.t0;case 35:if(e.prev=35,e.prev=36,f||null==v.return){e.next=40;break}return e.next=40,v.return();case 40:if(e.prev=40,!p){e.next=43;break}throw l;case 43:return e.finish(40);case 44:return e.finish(35);case 45:if(i(),!t){e.next=48;break}throw t;case 48:case"end":return e.stop()}},e,null,[[10,31,35,45],[36,,40,44]])}))).apply(this,arguments)}function Oe(e,r){return void 0===r?function(r){return Me(e,r)}:Me(e,r)}"function"==typeof Symbol&&Symbol.asyncIterator&&(y.prototype[Symbol.asyncIterator]=function(){return this}),y.prototype.next=function(e){return this._invoke("next",e)},y.prototype.throw=function(e){return this._invoke("throw",e)},y.prototype.return=function(e){return this._invoke("return",e)};
|
||
},{"process":"g5I+"}],"cwQ8":[function(require,module,exports) {
|
||
module.exports=function(e){if(!e)throw Error("hashlru must have a max value, of type number, greater than 0");var t=0,n=Object.create(null),r=Object.create(null);function o(o,u){n[o]=u,++t>=e&&(t=0,r=n,n=Object.create(null))}return{has:function(e){return void 0!==n[e]||void 0!==r[e]},remove:function(e){void 0!==n[e]&&(n[e]=void 0),void 0!==r[e]&&(r[e]=void 0)},get:function(e){var t=n[e];return void 0!==t?t:void 0!==(t=r[e])?(o(e,t),t):void 0},set:function(e,t){void 0!==n[e]?n[e]=t:o(e,t)},clear:function(){n=Object.create(null),r=Object.create(null)}}};
|
||
},{}],"5m0C":[function(require,module,exports) {
|
||
"use strict";var e=require("hashlru");module.exports=function(r){var t=e(r);return t.delete=t.remove,t};
|
||
},{"hashlru":"cwQ8"}],"YZoO":[function(require,module,exports) {
|
||
var define;
|
||
var e;!function(r){"use strict";var n,t=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,i=Math.ceil,o=Math.floor,s="[BigNumber Error] ",f=s+"Number primitive has more than 15 significant digits: ",u=1e14,l=14,c=9007199254740991,a=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],h=1e7,g=1e9;function p(e){var r=0|e;return e>0||e===r?r:r-1}function w(e){for(var r,n,t=1,i=e.length,o=e[0]+"";t<i;){for(r=e[t++]+"",n=l-r.length;n--;r="0"+r);o+=r}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function m(e,r){var n,t,i=e.c,o=r.c,s=e.s,f=r.s,u=e.e,l=r.e;if(!s||!f)return null;if(n=i&&!i[0],t=o&&!o[0],n||t)return n?t?0:-f:s;if(s!=f)return s;if(n=s<0,t=u==l,!i||!o)return t?0:!i^n?1:-1;if(!t)return u>l^n?1:-1;for(f=(u=i.length)<(l=o.length)?u:l,s=0;s<f;s++)if(i[s]!=o[s])return i[s]>o[s]^n?1:-1;return u==l?0:u>l^n?1:-1}function d(e,r,n,t){if(e<r||e>n||e!==o(e))throw Error(s+(t||"Argument")+("number"==typeof e?e<r||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function v(e){var r=e.c.length-1;return p(e.e/l)==r&&e.c[r]%2!=0}function N(e,r){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(r<0?"e":"e+")+r}function O(e,r,n){var t,i;if(r<0){for(i=n+".";++r;i+=n);e=i+e}else if(++r>(t=e.length)){for(i=n,r-=t;--r;i+=n);e+=i}else r<t&&(e=e.slice(0,r)+"."+e.slice(r));return e}(n=function e(r){var n,y,b,E,A,S,R,_,B,D=j.prototype={constructor:j,toString:null,valueOf:null},P=new j(1),x=20,L=4,U=-7,I=21,T=-1e7,C=1e7,M=!1,G=1,k=0,F={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},q="0123456789abcdefghijklmnopqrstuvwxyz";function j(e,r){var n,i,s,u,a,h,g,p,w=this;if(!(w instanceof j))return new j(e,r);if(null==r){if(e&&!0===e._isBigNumber)return w.s=e.s,void(!e.c||e.e>C?w.c=w.e=null:e.e<T?w.c=[w.e=0]:(w.e=e.e,w.c=e.c.slice()));if((h="number"==typeof e)&&0*e==0){if(w.s=1/e<0?(e=-e,-1):1,e===~~e){for(u=0,a=e;a>=10;a/=10,u++);return void(u>C?w.c=w.e=null:(w.e=u,w.c=[e]))}p=String(e)}else{if(!t.test(p=String(e)))return b(w,p,h);w.s=45==p.charCodeAt(0)?(p=p.slice(1),-1):1}(u=p.indexOf("."))>-1&&(p=p.replace(".","")),(a=p.search(/e/i))>0?(u<0&&(u=a),u+=+p.slice(a+1),p=p.substring(0,a)):u<0&&(u=p.length)}else{if(d(r,2,q.length,"Base"),10==r)return V(w=new j(e),x+w.e+1,L);if(p=String(e),h="number"==typeof e){if(0*e!=0)return b(w,p,h,r);if(w.s=1/e<0?(p=p.slice(1),-1):1,j.DEBUG&&p.replace(/^0\.0*|\./,"").length>15)throw Error(f+e)}else w.s=45===p.charCodeAt(0)?(p=p.slice(1),-1):1;for(n=q.slice(0,r),u=a=0,g=p.length;a<g;a++)if(n.indexOf(i=p.charAt(a))<0){if("."==i){if(a>u){u=g;continue}}else if(!s&&(p==p.toUpperCase()&&(p=p.toLowerCase())||p==p.toLowerCase()&&(p=p.toUpperCase()))){s=!0,a=-1,u=0;continue}return b(w,String(e),h,r)}h=!1,(u=(p=y(p,r,10,w.s)).indexOf("."))>-1?p=p.replace(".",""):u=p.length}for(a=0;48===p.charCodeAt(a);a++);for(g=p.length;48===p.charCodeAt(--g););if(p=p.slice(a,++g)){if(g-=a,h&&j.DEBUG&&g>15&&(e>c||e!==o(e)))throw Error(f+w.s*e);if((u=u-a-1)>C)w.c=w.e=null;else if(u<T)w.c=[w.e=0];else{if(w.e=u,w.c=[],a=(u+1)%l,u<0&&(a+=l),a<g){for(a&&w.c.push(+p.slice(0,a)),g-=l;a<g;)w.c.push(+p.slice(a,a+=l));a=l-(p=p.slice(a)).length}else a-=g;for(;a--;p+="0");w.c.push(+p)}}else w.c=[w.e=0]}function $(e,r,n,t){var i,o,s,f,u;if(null==n?n=L:d(n,0,8),!e.c)return e.toString();if(i=e.c[0],s=e.e,null==r)u=w(e.c),u=1==t||2==t&&(s<=U||s>=I)?N(u,s):O(u,s,"0");else if(o=(e=V(new j(e),r,n)).e,f=(u=w(e.c)).length,1==t||2==t&&(r<=o||o<=U)){for(;f<r;u+="0",f++);u=N(u,o)}else if(r-=s,u=O(u,o,"0"),o+1>f){if(--r>0)for(u+=".";r--;u+="0");}else if((r+=o-f)>0)for(o+1==f&&(u+=".");r--;u+="0");return e.s<0&&i?"-"+u:u}function z(e,r){for(var n,t=1,i=new j(e[0]);t<e.length;t++){if(!(n=new j(e[t])).s){i=n;break}r.call(i,n)&&(i=n)}return i}function H(e,r,n){for(var t=1,i=r.length;!r[--i];r.pop());for(i=r[0];i>=10;i/=10,t++);return(n=t+n*l-1)>C?e.c=e.e=null:n<T?e.c=[e.e=0]:(e.e=n,e.c=r),e}function V(e,r,n,t){var s,f,c,h,g,p,w,m=e.c,d=a;if(m){e:{for(s=1,h=m[0];h>=10;h/=10,s++);if((f=r-s)<0)f+=l,c=r,w=(g=m[p=0])/d[s-c-1]%10|0;else if((p=i((f+1)/l))>=m.length){if(!t)break e;for(;m.length<=p;m.push(0));g=w=0,s=1,c=(f%=l)-l+1}else{for(g=h=m[p],s=1;h>=10;h/=10,s++);w=(c=(f%=l)-l+s)<0?0:g/d[s-c-1]%10|0}if(t=t||r<0||null!=m[p+1]||(c<0?g:g%d[s-c-1]),t=n<4?(w||t)&&(0==n||n==(e.s<0?3:2)):w>5||5==w&&(4==n||t||6==n&&(f>0?c>0?g/d[s-c]:0:m[p-1])%10&1||n==(e.s<0?8:7)),r<1||!m[0])return m.length=0,t?(r-=e.e+1,m[0]=d[(l-r%l)%l],e.e=-r||0):m[0]=e.e=0,e;if(0==f?(m.length=p,h=1,p--):(m.length=p+1,h=d[l-f],m[p]=c>0?o(g/d[s-c]%d[c])*h:0),t)for(;;){if(0==p){for(f=1,c=m[0];c>=10;c/=10,f++);for(c=m[0]+=h,h=1;c>=10;c/=10,h++);f!=h&&(e.e++,m[0]==u&&(m[0]=1));break}if(m[p]+=h,m[p]!=u)break;m[p--]=0,h=1}for(f=m.length;0===m[--f];m.pop());}e.e>C?e.c=e.e=null:e.e<T&&(e.c=[e.e=0])}return e}function W(e){var r,n=e.e;return null===n?e.toString():(r=w(e.c),r=n<=U||n>=I?N(r,n):O(r,n,"0"),e.s<0?"-"+r:r)}return j.clone=e,j.ROUND_UP=0,j.ROUND_DOWN=1,j.ROUND_CEIL=2,j.ROUND_FLOOR=3,j.ROUND_HALF_UP=4,j.ROUND_HALF_DOWN=5,j.ROUND_HALF_EVEN=6,j.ROUND_HALF_CEIL=7,j.ROUND_HALF_FLOOR=8,j.EUCLID=9,j.config=j.set=function(e){var r,n;if(null!=e){if("object"!=typeof e)throw Error(s+"Object expected: "+e);if(e.hasOwnProperty(r="DECIMAL_PLACES")&&(d(n=e[r],0,g,r),x=n),e.hasOwnProperty(r="ROUNDING_MODE")&&(d(n=e[r],0,8,r),L=n),e.hasOwnProperty(r="EXPONENTIAL_AT")&&((n=e[r])&&n.pop?(d(n[0],-g,0,r),d(n[1],0,g,r),U=n[0],I=n[1]):(d(n,-g,g,r),U=-(I=n<0?-n:n))),e.hasOwnProperty(r="RANGE"))if((n=e[r])&&n.pop)d(n[0],-g,-1,r),d(n[1],1,g,r),T=n[0],C=n[1];else{if(d(n,-g,g,r),!n)throw Error(s+r+" cannot be zero: "+n);T=-(C=n<0?-n:n)}if(e.hasOwnProperty(r="CRYPTO")){if((n=e[r])!==!!n)throw Error(s+r+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw M=!n,Error(s+"crypto unavailable");M=n}else M=n}if(e.hasOwnProperty(r="MODULO_MODE")&&(d(n=e[r],0,9,r),G=n),e.hasOwnProperty(r="POW_PRECISION")&&(d(n=e[r],0,g,r),k=n),e.hasOwnProperty(r="FORMAT")){if("object"!=typeof(n=e[r]))throw Error(s+r+" not an object: "+n);F=n}if(e.hasOwnProperty(r="ALPHABET")){if("string"!=typeof(n=e[r])||/^.?$|[+\-.\s]|(.).*\1/.test(n))throw Error(s+r+" invalid: "+n);q=n}}return{DECIMAL_PLACES:x,ROUNDING_MODE:L,EXPONENTIAL_AT:[U,I],RANGE:[T,C],CRYPTO:M,MODULO_MODE:G,POW_PRECISION:k,FORMAT:F,ALPHABET:q}},j.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!j.DEBUG)return!0;var r,n,t=e.c,i=e.e,f=e.s;e:if("[object Array]"=={}.toString.call(t)){if((1===f||-1===f)&&i>=-g&&i<=g&&i===o(i)){if(0===t[0]){if(0===i&&1===t.length)return!0;break e}if((r=(i+1)%l)<1&&(r+=l),String(t[0]).length==r){for(r=0;r<t.length;r++)if((n=t[r])<0||n>=u||n!==o(n))break e;if(0!==n)return!0}}}else if(null===t&&null===i&&(null===f||1===f||-1===f))return!0;throw Error(s+"Invalid BigNumber: "+e)},j.maximum=j.max=function(){return z(arguments,D.lt)},j.minimum=j.min=function(){return z(arguments,D.gt)},j.random=(E=9007199254740992*Math.random()&2097151?function(){return o(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var r,n,t,f,u,c=0,h=[],p=new j(P);if(null==e?e=x:d(e,0,g),f=i(e/l),M)if(crypto.getRandomValues){for(r=crypto.getRandomValues(new Uint32Array(f*=2));c<f;)(u=131072*r[c]+(r[c+1]>>>11))>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),r[c]=n[0],r[c+1]=n[1]):(h.push(u%1e14),c+=2);c=f/2}else{if(!crypto.randomBytes)throw M=!1,Error(s+"crypto unavailable");for(r=crypto.randomBytes(f*=7);c<f;)(u=281474976710656*(31&r[c])+1099511627776*r[c+1]+4294967296*r[c+2]+16777216*r[c+3]+(r[c+4]<<16)+(r[c+5]<<8)+r[c+6])>=9e15?crypto.randomBytes(7).copy(r,c):(h.push(u%1e14),c+=7);c=f/7}if(!M)for(;c<f;)(u=E())<9e15&&(h[c++]=u%1e14);for(f=h[--c],e%=l,f&&e&&(u=a[l-e],h[c]=o(f/u)*u);0===h[c];h.pop(),c--);if(c<0)h=[t=0];else{for(t=-1;0===h[0];h.splice(0,1),t-=l);for(c=1,u=h[0];u>=10;u/=10,c++);c<l&&(t-=l-c)}return p.e=t,p.c=h,p}),j.sum=function(){for(var e=1,r=arguments,n=new j(r[0]);e<r.length;)n=n.plus(r[e++]);return n},y=function(){function e(e,r,n,t){for(var i,o,s=[0],f=0,u=e.length;f<u;){for(o=s.length;o--;s[o]*=r);for(s[0]+=t.indexOf(e.charAt(f++)),i=0;i<s.length;i++)s[i]>n-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/n|0,s[i]%=n)}return s.reverse()}return function(r,t,i,o,s){var f,u,l,c,a,h,g,p,m=r.indexOf("."),d=x,v=L;for(m>=0&&(c=k,k=0,r=r.replace(".",""),h=(p=new j(t)).pow(r.length-m),k=c,p.c=e(O(w(h.c),h.e,"0"),10,i,"0123456789"),p.e=p.c.length),l=c=(g=e(r,t,i,s?(f=q,"0123456789"):(f="0123456789",q))).length;0==g[--c];g.pop());if(!g[0])return f.charAt(0);if(m<0?--l:(h.c=g,h.e=l,h.s=o,g=(h=n(h,p,d,v,i)).c,a=h.r,l=h.e),m=g[u=l+d+1],c=i/2,a=a||u<0||null!=g[u+1],a=v<4?(null!=m||a)&&(0==v||v==(h.s<0?3:2)):m>c||m==c&&(4==v||a||6==v&&1&g[u-1]||v==(h.s<0?8:7)),u<1||!g[0])r=a?O(f.charAt(1),-d,f.charAt(0)):f.charAt(0);else{if(g.length=u,a)for(--i;++g[--u]>i;)g[u]=0,u||(++l,g=[1].concat(g));for(c=g.length;!g[--c];);for(m=0,r="";m<=c;r+=f.charAt(g[m++]));r=O(r,l,f.charAt(0))}return r}}(),n=function(){function e(e,r,n){var t,i,o,s,f=0,u=e.length,l=r%h,c=r/h|0;for(e=e.slice();u--;)f=((i=l*(o=e[u]%h)+(t=c*o+(s=e[u]/h|0)*l)%h*h+f)/n|0)+(t/h|0)+c*s,e[u]=i%n;return f&&(e=[f].concat(e)),e}function r(e,r,n,t){var i,o;if(n!=t)o=n>t?1:-1;else for(i=o=0;i<n;i++)if(e[i]!=r[i]){o=e[i]>r[i]?1:-1;break}return o}function n(e,r,n,t){for(var i=0;n--;)e[n]-=i,i=e[n]<r[n]?1:0,e[n]=i*t+e[n]-r[n];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(t,i,s,f,c){var a,h,g,w,m,d,v,N,O,y,b,E,A,S,R,_,B,D=t.s==i.s?1:-1,P=t.c,x=i.c;if(!(P&&P[0]&&x&&x[0]))return new j(t.s&&i.s&&(P?!x||P[0]!=x[0]:x)?P&&0==P[0]||!x?0*D:D/0:NaN);for(O=(N=new j(D)).c=[],D=s+(h=t.e-i.e)+1,c||(c=u,h=p(t.e/l)-p(i.e/l),D=D/l|0),g=0;x[g]==(P[g]||0);g++);if(x[g]>(P[g]||0)&&h--,D<0)O.push(1),w=!0;else{for(S=P.length,_=x.length,g=0,D+=2,(m=o(c/(x[0]+1)))>1&&(x=e(x,m,c),P=e(P,m,c),_=x.length,S=P.length),A=_,b=(y=P.slice(0,_)).length;b<_;y[b++]=0);B=x.slice(),B=[0].concat(B),R=x[0],x[1]>=c/2&&R++;do{if(m=0,(a=r(x,y,_,b))<0){if(E=y[0],_!=b&&(E=E*c+(y[1]||0)),(m=o(E/R))>1)for(m>=c&&(m=c-1),v=(d=e(x,m,c)).length,b=y.length;1==r(d,y,v,b);)m--,n(d,_<v?B:x,v,c),v=d.length,a=1;else 0==m&&(a=m=1),v=(d=x.slice()).length;if(v<b&&(d=[0].concat(d)),n(y,d,b,c),b=y.length,-1==a)for(;r(x,y,_,b)<1;)m++,n(y,_<b?B:x,b,c),b=y.length}else 0===a&&(m++,y=[0]);O[g++]=m,y[0]?y[b++]=P[A]||0:(y=[P[A]],b=1)}while((A++<S||null!=y[0])&&D--);w=null!=y[0],O[0]||O.splice(0,1)}if(c==u){for(g=1,D=O[0];D>=10;D/=10,g++);V(N,s+(N.e=g+h*l-1)+1,f,w)}else N.e=h,N.r=+w;return N}}(),A=/^(-?)0([xbo])(?=\w[\w.]*$)/i,S=/^([^.]+)\.$/,R=/^\.([^.]+)$/,_=/^-?(Infinity|NaN)$/,B=/^\s*\+(?=[\w.])|^\s+|\s+$/g,b=function(e,r,n,t){var i,o=n?r:r.replace(B,"");if(_.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!n&&(o=o.replace(A,function(e,r,n){return i="x"==(n=n.toLowerCase())?16:"b"==n?2:8,t&&t!=i?e:r}),t&&(i=t,o=o.replace(S,"$1").replace(R,"0.$1")),r!=o))return new j(o,i);if(j.DEBUG)throw Error(s+"Not a"+(t?" base "+t:"")+" number: "+r);e.s=null}e.c=e.e=null},D.absoluteValue=D.abs=function(){var e=new j(this);return e.s<0&&(e.s=1),e},D.comparedTo=function(e,r){return m(this,new j(e,r))},D.decimalPlaces=D.dp=function(e,r){var n,t,i,o=this;if(null!=e)return d(e,0,g),null==r?r=L:d(r,0,8),V(new j(o),e+o.e+1,r);if(!(n=o.c))return null;if(t=((i=n.length-1)-p(this.e/l))*l,i=n[i])for(;i%10==0;i/=10,t--);return t<0&&(t=0),t},D.dividedBy=D.div=function(e,r){return n(this,new j(e,r),x,L)},D.dividedToIntegerBy=D.idiv=function(e,r){return n(this,new j(e,r),0,1)},D.exponentiatedBy=D.pow=function(e,r){var n,t,f,u,c,a,h,g,p=this;if((e=new j(e)).c&&!e.isInteger())throw Error(s+"Exponent not an integer: "+W(e));if(null!=r&&(r=new j(r)),c=e.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!e.c||!e.c[0])return g=new j(Math.pow(+W(p),c?2-v(e):+W(e))),r?g.mod(r):g;if(a=e.s<0,r){if(r.c?!r.c[0]:!r.s)return new j(NaN);(t=!a&&p.isInteger()&&r.isInteger())&&(p=p.mod(r))}else{if(e.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||c&&p.c[1]>=24e7:p.c[0]<8e13||c&&p.c[0]<=9999975e7)))return u=p.s<0&&v(e)?-0:0,p.e>-1&&(u=1/u),new j(a?1/u:u);k&&(u=i(k/l+2))}for(c?(n=new j(.5),a&&(e.s=1),h=v(e)):h=(f=Math.abs(+W(e)))%2,g=new j(P);;){if(h){if(!(g=g.times(p)).c)break;u?g.c.length>u&&(g.c.length=u):t&&(g=g.mod(r))}if(f){if(0===(f=o(f/2)))break;h=f%2}else if(V(e=e.times(n),e.e+1,1),e.e>14)h=v(e);else{if(0==(f=+W(e)))break;h=f%2}p=p.times(p),u?p.c&&p.c.length>u&&(p.c.length=u):t&&(p=p.mod(r))}return t?g:(a&&(g=P.div(g)),r?g.mod(r):u?V(g,k,L,void 0):g)},D.integerValue=function(e){var r=new j(this);return null==e?e=L:d(e,0,8),V(r,r.e+1,e)},D.isEqualTo=D.eq=function(e,r){return 0===m(this,new j(e,r))},D.isFinite=function(){return!!this.c},D.isGreaterThan=D.gt=function(e,r){return m(this,new j(e,r))>0},D.isGreaterThanOrEqualTo=D.gte=function(e,r){return 1===(r=m(this,new j(e,r)))||0===r},D.isInteger=function(){return!!this.c&&p(this.e/l)>this.c.length-2},D.isLessThan=D.lt=function(e,r){return m(this,new j(e,r))<0},D.isLessThanOrEqualTo=D.lte=function(e,r){return-1===(r=m(this,new j(e,r)))||0===r},D.isNaN=function(){return!this.s},D.isNegative=function(){return this.s<0},D.isPositive=function(){return this.s>0},D.isZero=function(){return!!this.c&&0==this.c[0]},D.minus=function(e,r){var n,t,i,o,s=this,f=s.s;if(r=(e=new j(e,r)).s,!f||!r)return new j(NaN);if(f!=r)return e.s=-r,s.plus(e);var c=s.e/l,a=e.e/l,h=s.c,g=e.c;if(!c||!a){if(!h||!g)return h?(e.s=-r,e):new j(g?s:NaN);if(!h[0]||!g[0])return g[0]?(e.s=-r,e):new j(h[0]?s:3==L?-0:0)}if(c=p(c),a=p(a),h=h.slice(),f=c-a){for((o=f<0)?(f=-f,i=h):(a=c,i=g),i.reverse(),r=f;r--;i.push(0));i.reverse()}else for(t=(o=(f=h.length)<(r=g.length))?f:r,f=r=0;r<t;r++)if(h[r]!=g[r]){o=h[r]<g[r];break}if(o&&(i=h,h=g,g=i,e.s=-e.s),(r=(t=g.length)-(n=h.length))>0)for(;r--;h[n++]=0);for(r=u-1;t>f;){if(h[--t]<g[t]){for(n=t;n&&!h[--n];h[n]=r);--h[n],h[t]+=u}h[t]-=g[t]}for(;0==h[0];h.splice(0,1),--a);return h[0]?H(e,h,a):(e.s=3==L?-1:1,e.c=[e.e=0],e)},D.modulo=D.mod=function(e,r){var t,i,o=this;return e=new j(e,r),!o.c||!e.s||e.c&&!e.c[0]?new j(NaN):!e.c||o.c&&!o.c[0]?new j(o):(9==G?(i=e.s,e.s=1,t=n(o,e,0,3),e.s=i,t.s*=i):t=n(o,e,0,G),(e=o.minus(t.times(e))).c[0]||1!=G||(e.s=o.s),e)},D.multipliedBy=D.times=function(e,r){var n,t,i,o,s,f,c,a,g,w,m,d,v,N,O,y=this,b=y.c,E=(e=new j(e,r)).c;if(!(b&&E&&b[0]&&E[0]))return!y.s||!e.s||b&&!b[0]&&!E||E&&!E[0]&&!b?e.c=e.e=e.s=null:(e.s*=y.s,b&&E?(e.c=[0],e.e=0):e.c=e.e=null),e;for(t=p(y.e/l)+p(e.e/l),e.s*=y.s,(c=b.length)<(w=E.length)&&(v=b,b=E,E=v,i=c,c=w,w=i),i=c+w,v=[];i--;v.push(0));for(N=u,O=h,i=w;--i>=0;){for(n=0,m=E[i]%O,d=E[i]/O|0,o=i+(s=c);o>i;)n=((a=m*(a=b[--s]%O)+(f=d*a+(g=b[s]/O|0)*m)%O*O+v[o]+n)/N|0)+(f/O|0)+d*g,v[o--]=a%N;v[o]=n}return n?++t:v.splice(0,1),H(e,v,t)},D.negated=function(){var e=new j(this);return e.s=-e.s||null,e},D.plus=function(e,r){var n,t=this,i=t.s;if(r=(e=new j(e,r)).s,!i||!r)return new j(NaN);if(i!=r)return e.s=-r,t.minus(e);var o=t.e/l,s=e.e/l,f=t.c,c=e.c;if(!o||!s){if(!f||!c)return new j(i/0);if(!f[0]||!c[0])return c[0]?e:new j(f[0]?t:0*i)}if(o=p(o),s=p(s),f=f.slice(),i=o-s){for(i>0?(s=o,n=c):(i=-i,n=f),n.reverse();i--;n.push(0));n.reverse()}for((i=f.length)-(r=c.length)<0&&(n=c,c=f,f=n,r=i),i=0;r;)i=(f[--r]=f[r]+c[r]+i)/u|0,f[r]=u===f[r]?0:f[r]%u;return i&&(f=[i].concat(f),++s),H(e,f,s)},D.precision=D.sd=function(e,r){var n,t,i,o=this;if(null!=e&&e!==!!e)return d(e,1,g),null==r?r=L:d(r,0,8),V(new j(o),e,r);if(!(n=o.c))return null;if(t=(i=n.length-1)*l+1,i=n[i]){for(;i%10==0;i/=10,t--);for(i=n[0];i>=10;i/=10,t++);}return e&&o.e+1>t&&(t=o.e+1),t},D.shiftedBy=function(e){return d(e,-c,c),this.times("1e"+e)},D.squareRoot=D.sqrt=function(){var e,r,t,i,o,s=this,f=s.c,u=s.s,l=s.e,c=x+4,a=new j("0.5");if(1!==u||!f||!f[0])return new j(!u||u<0&&(!f||f[0])?NaN:f?s:1/0);if(0==(u=Math.sqrt(+W(s)))||u==1/0?(((r=w(f)).length+l)%2==0&&(r+="0"),u=Math.sqrt(+r),l=p((l+1)/2)-(l<0||l%2),t=new j(r=u==1/0?"5e"+l:(r=u.toExponential()).slice(0,r.indexOf("e")+1)+l)):t=new j(u+""),t.c[0])for((u=(l=t.e)+c)<3&&(u=0);;)if(o=t,t=a.times(o.plus(n(s,o,c,1))),w(o.c).slice(0,u)===(r=w(t.c)).slice(0,u)){if(t.e<l&&--u,"9999"!=(r=r.slice(u-3,u+1))&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(V(t,t.e+x+2,1),e=!t.times(t).eq(s));break}if(!i&&(V(o,o.e+x+2,0),o.times(o).eq(s))){t=o;break}c+=4,u+=4,i=1}return V(t,t.e+x+1,L,e)},D.toExponential=function(e,r){return null!=e&&(d(e,0,g),e++),$(this,e,r,1)},D.toFixed=function(e,r){return null!=e&&(d(e,0,g),e=e+this.e+1),$(this,e,r)},D.toFormat=function(e,r,n){var t,i=this;if(null==n)null!=e&&r&&"object"==typeof r?(n=r,r=null):e&&"object"==typeof e?(n=e,e=r=null):n=F;else if("object"!=typeof n)throw Error(s+"Argument not an object: "+n);if(t=i.toFixed(e,r),i.c){var o,f=t.split("."),u=+n.groupSize,l=+n.secondaryGroupSize,c=n.groupSeparator||"",a=f[0],h=f[1],g=i.s<0,p=g?a.slice(1):a,w=p.length;if(l&&(o=u,u=l,l=o,w-=o),u>0&&w>0){for(o=w%u||u,a=p.substr(0,o);o<w;o+=u)a+=c+p.substr(o,u);l>0&&(a+=c+p.slice(o)),g&&(a="-"+a)}t=h?a+(n.decimalSeparator||"")+((l=+n.fractionGroupSize)?h.replace(new RegExp("\\d{"+l+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):h):a}return(n.prefix||"")+t+(n.suffix||"")},D.toFraction=function(e){var r,t,i,o,f,u,c,h,g,p,m,d,v=this,N=v.c;if(null!=e&&(!(c=new j(e)).isInteger()&&(c.c||1!==c.s)||c.lt(P)))throw Error(s+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+W(c));if(!N)return new j(v);for(r=new j(P),g=t=new j(P),i=h=new j(P),d=w(N),f=r.e=d.length-v.e-1,r.c[0]=a[(u=f%l)<0?l+u:u],e=!e||c.comparedTo(r)>0?f>0?r:g:c,u=C,C=1/0,c=new j(d),h.c[0]=0;p=n(c,r,0,1),1!=(o=t.plus(p.times(i))).comparedTo(e);)t=i,i=o,g=h.plus(p.times(o=g)),h=o,r=c.minus(p.times(o=r)),c=o;return o=n(e.minus(t),i,0,1),h=h.plus(o.times(g)),t=t.plus(o.times(i)),h.s=g.s=v.s,m=n(g,i,f*=2,L).minus(v).abs().comparedTo(n(h,t,f,L).minus(v).abs())<1?[g,i]:[h,t],C=u,m},D.toNumber=function(){return+W(this)},D.toPrecision=function(e,r){return null!=e&&d(e,1,g),$(this,e,r,2)},D.toString=function(e){var r,n=this,t=n.s,i=n.e;return null===i?t?(r="Infinity",t<0&&(r="-"+r)):r="NaN":(null==e?r=i<=U||i>=I?N(w(n.c),i):O(w(n.c),i,"0"):10===e?r=O(w((n=V(new j(n),x+i+1,L)).c),n.e,"0"):(d(e,2,q.length,"Base"),r=y(O(w(n.c),i,"0"),10,e,t,!0)),t<0&&n.c[0]&&(r="-"+r)),r},D.valueOf=D.toJSON=function(){return W(this)},D._isBigNumber=!0,null!=r&&j.set(r),j}()).default=n.BigNumber=n,"function"==typeof e&&e.amd?e(function(){return n}):"undefined"!=typeof module&&module.exports?module.exports=n:(r||(r="undefined"!=typeof self&&self?self:window),r.BigNumber=n)}(this);
|
||
},{}],"3sOY":[function(require,module,exports) {
|
||
"use strict";const t=Math.exp;exports=module.exports=function(r){if("number"!=typeof r)throw new Error("must provide a timespan to the moving average constructor");if(r<=0)throw new Error("must provide a timespan > 0 to the moving average constructor");let e,n,o=0,i=0,u=0,s={};return s.push=function(s,a){if(n){const c=1-t(-(s-n)/r),f=a-e;e=c*a+(1-c)*e,o=(1-c)*(o+f*(c*f)),i=Math.sqrt(o),u=e+c*f}else e=a;n=s},s.movingAverage=function(){return e},s.variance=function(){return o},s.deviation=function(){return i},s.forecast=function(){return u},s};
|
||
},{}],"hYuh":[function(require,module,exports) {
|
||
"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=n(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var o=0,u=function(){};return{s:u,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:u}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function n(t,e){if(t){if("string"==typeof t)return r(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}}function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function i(t,e,n){return e&&u(t.prototype,e),n&&u(t,n),t}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&s(t,e)}function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function c(t){var e=h();return function(){var n,r=v(t);if(e){var o=v(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return f(this,n)}}function f(e,n){return!n||"object"!==t(n)&&"function"!=typeof n?l(e):n}function l(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function h(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}function v(t){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var y=require("events"),p=require("bignumber.js"),m=require("moving-average"),_=require("retimer"),g=function(t){a(r,y);var n=c(r);function r(t,e){var u;o(this,r),(u=n.call(this))._options=e,u._queue=[],u._stats={},u._frequencyLastTime=Date.now(),u._frequencyAccumulators={},u._movingAverages={},u._update=u._update.bind(l(u));for(var i=u._options.movingAverageIntervals,a=0;a<t.length;a++){var s=t[a];u._stats[s]=p(0),u._movingAverages[s]={};for(var c=0;c<i.length;c++){var f=i[c];(u._movingAverages[s][f]=m(f)).push(u._frequencyLastTime,0)}}return u}return i(r,[{key:"start",value:function(){this._queue.length&&this._resetComputeTimeout()}},{key:"stop",value:function(){this._timeout&&(this._timeout.clear(),this._timeout=null)}},{key:"snapshot",get:function(){return Object.assign({},this._stats)}},{key:"movingAverages",get:function(){return Object.assign({},this._movingAverages)}},{key:"toJSON",value:function(){for(var t=this.snapshot,e=this.movingAverages,n={dataReceived:t.dataReceived.toString(),dataSent:t.dataSent.toString(),movingAverages:{}},r=0,o=Object.keys(e);r<o.length;r++){var u=o[r];n.movingAverages[u]={};for(var i=0,a=Object.keys(e[u]);i<a.length;i++){var s=a[i];n.movingAverages[u][s]=e[u][s].movingAverage()}}return n}},{key:"push",value:function(t,e){this._queue.push([t,e,Date.now()]),this._resetComputeTimeout()}},{key:"_resetComputeTimeout",value:function(){this._timeout=_(this._update,this._nextTimeout())}},{key:"_nextTimeout",value:function(){var t=this._queue.length/this._options.computeThrottleMaxQueueSize;return Math.max(this._options.computeThrottleTimeout*(1-t),0)}},{key:"_update",value:function(){if(this._timeout=null,this._queue.length){var t,n,r=e(this._queue);try{for(r.s();!(n=r.n()).done;)t=n.value,this._applyOp(t)}catch(o){r.e(o)}finally{r.f()}this._queue=[],this._updateFrequency(t[2]),this.emit("update",this._stats)}}},{key:"_updateFrequency",value:function(t){var e=this,n=t-this._frequencyLastTime;Object.keys(this._stats).forEach(function(r){e._updateFrequencyFor(r,n,t)}),this._frequencyLastTime=t}},{key:"_updateFrequencyFor",value:function(t,e,n){var r=this._frequencyAccumulators[t]||0;this._frequencyAccumulators[t]=0;var o=r/(e||1)*1e3,u=this._movingAverages[t];u||(u=this._movingAverages[t]={});for(var i=this._options.movingAverageIntervals,a=0;a<i.length;a++){var s=i[a],c=u[s];c||(c=u[s]=m(s)),c.push(n,o)}}},{key:"_applyOp",value:function(t){var e,n=t[0],r=t[1];if("number"!=typeof r)throw new Error("invalid increment number: ".concat(r));e=Object.prototype.hasOwnProperty.call(this._stats,n)?this._stats[n]:this._stats[n]=p(0),this._stats[n]=e.plus(r),this._frequencyAccumulators[n]||(this._frequencyAccumulators[n]=0),this._frequencyAccumulators[n]+=r}}]),r}();module.exports=g;
|
||
},{"events":"wIHY","bignumber.js":"YZoO","moving-average":"3sOY","retimer":"yhqo"}],"FzUP":[function(require,module,exports) {
|
||
"use strict";function t(t){return n(t)||r(t)||i(t)||e()}function e(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function r(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}function n(t){if(Array.isArray(t))return a(t)}function o(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=i(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,u=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return s=t.done,t},e:function(t){u=!0,a=t},f:function(){try{s||null==r.return||r.return()}finally{if(u)throw a}}}}function i(t,e){if(t){if("string"==typeof t)return a(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(t,e):void 0}}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function c(t,e,r){return e&&u(t.prototype,e),r&&u(t,r),t}var l=require("merge-options"),f=require("it-pipe"),h=f.pipe,p=require("streaming-iterables"),y=p.tap,g=require("./old-peers"),d=require("../constants"),v=d.METRICS,_=require("./stats"),S=["dataReceived","dataSent"],m={in:"dataReceived",out:"dataSent"},b=function(){function e(t){var r=this;s(this,e),this._options=l(v,t),this._globalStats=new _(S,this._options),this._peerStats=new Map,this._protocolStats=new Map,this._oldPeers=g(this._options.maxOldPeersRetention),this._running=!1,this._onMessage=this._onMessage.bind(this),this._connectionManager=t.connectionManager,this._connectionManager.on("peer:disconnect",function(t){r.onPeerDisconnected(t.remotePeer)})}return c(e,[{key:"start",value:function(){this._running=!0}},{key:"stop",value:function(){this._running=!1,this._globalStats.stop();var t,e=o(this._peerStats.values());try{for(e.s();!(t=e.n()).done;){t.value.stop()}}catch(i){e.e(i)}finally{e.f()}var r,n=o(this._protocolStats.values());try{for(n.s();!(r=n.n()).done;){r.value.stop()}}catch(i){n.e(i)}finally{n.f()}}},{key:"global",get:function(){return this._globalStats}},{key:"peers",get:function(){return Array.from(this._peerStats.keys())}},{key:"forPeer",value:function(t){var e=t.toB58String();return this._peerStats.get(e)||this._oldPeers.get(e)}},{key:"protocols",get:function(){return Array.from(this._protocolStats.keys())}},{key:"forProtocol",value:function(t){return this._protocolStats.get(t)}},{key:"onPeerDisconnected",value:function(t){var e=t.toB58String(),r=this._peerStats.get(e);r&&(r.stop(),this._peerStats.delete(e),this._oldPeers.set(e,r))}},{key:"_onMessage",value:function(t){var e=t.remotePeer,r=t.protocol,n=t.direction,o=t.dataLength;if(this._running){var i=m[n],a=this.forPeer(e);if(a||(a=new _(S,this._options),this._peerStats.set(e.toB58String(),a)),a.push(i,o),this._globalStats.push(i,o),r){var s=this.forProtocol(r);s||(s=new _(S,this._options),this._protocolStats.set(r,s)),s.push(i,o)}}}},{key:"updatePlaceholder",value:function(t,r){if(this._running){var n=this.forPeer(t),o=r.toB58String(),i=this.forPeer(r),a=n;i&&(a=e.mergeStats(i,a),this._oldPeers.delete(o)),this._peerStats.delete(t.toB58String()),this._peerStats.set(o,a),a.start()}}},{key:"trackStream",value:function(t){var e=t.stream,r=t.remotePeer,n=t.protocol,o=this,i=e.source;e.source=y(function(t){return o._onMessage({remotePeer:r,protocol:n,direction:"in",dataLength:t.length})})(i);var a=e.sink;return e.sink=function(t){return h(t,y(function(t){return o._onMessage({remotePeer:r,protocol:n,direction:"out",dataLength:t.length})}),a)},e}}],[{key:"mergeStats",value:function(e,r){return e.stop(),r.stop(),e._queue=[].concat(t(e._queue),t(r._queue)),e}}]),e}();module.exports=b;
|
||
},{"merge-options":"/OBv","it-pipe":"p27M","streaming-iterables":"ieYp","./old-peers":"5m0C","../constants":"yxTM","./stats":"hYuh"}],"Q+6s":[function(require,module,exports) {
|
||
"use strict";const e=require("bl/BufferList"),r=require("it-length-prefixed"),t=require("it-pipe"),n=require("err-code"),i=require("uint8arrays/from-string"),s=require("it-first"),o=i("\n");exports.encode=(t=>r.encode.single(new e([t,o]))),exports.write=((e,r)=>e.push(exports.encode(r))),exports.writeAll=((r,t)=>{r.push(t.reduce((e,r)=>e.append(exports.encode(r)),new e))}),exports.read=(async e=>{let i=1;const u={[Symbol.asyncIterator](){return this},next:()=>e.next(i)},c=await t(u,r.decode({onLength:e=>{i=e}}),s);if(c.get(c.length-1)!==o[0])throw n(new Error("missing newline"),"ERR_INVALID_MULTISTREAM_SELECT_MESSAGE");return c.shallowSlice(0,-1)});
|
||
},{"bl/BufferList":"s5uv","it-length-prefixed":"5Mnk","it-pipe":"p27M","err-code":"hLMW","uint8arrays/from-string":"YqS+","it-first":"tdUc"}],"vz1r":[function(require,module,exports) {
|
||
"use strict";const e=require("debug")("mss:select"),r=require("err-code"),t=require("./multistream"),s=require("it-handshake");module.exports=(async(i,o,a)=>{o=Array.isArray(o)?[...o]:[o];const{reader:c,writer:l,rest:n,stream:d}=s(i),w=o.shift();a?(e('select: write ["%s", "%s"]',a,w),t.writeAll(l,[a,w])):(e('select: write "%s"',w),t.write(l,w));let u=(await t.read(c)).toString();if(e('select: read "%s"',u),u===a&&(u=(await t.read(c)).toString(),e('select: read "%s"',u)),u===w)return n(),{stream:d,protocol:w};for(const r of o){e('select: write "%s"',r),t.write(l,r);const s=(await t.read(c)).toString();if(e('select: read "%s" for "%s"',s,r),s===r)return n(),{stream:d,protocol:r}}throw n(),r(new Error("protocol selection failed"),"ERR_UNSUPPORTED_PROTOCOL")});
|
||
},{"debug":"F8gk","err-code":"hLMW","./multistream":"Q+6s","it-handshake":"rfs3"}],"zfa4":[function(require,module,exports) {
|
||
"use strict";exports.PROTOCOL_ID="/multistream/1.0.0";
|
||
},{}],"22hg":[function(require,module,exports) {
|
||
"use strict";const r=require("debug")("mss:handle"),e=require("bl/BufferList"),s=require("./multistream"),t=require("it-handshake"),{PROTOCOL_ID:i}=require("./constants");module.exports=(async(o,n)=>{n=Array.isArray(n)?n:[n];const{writer:a,reader:d,rest:u,stream:w}=t(o);for(;;){const t=(await s.read(d)).toString();if(r('read "%s"',t),t!==i){if(n.includes(t))return s.write(a,t),r('respond with "%s" for "%s"',t,t),u(),{stream:w,protocol:t};"ls"!==t?(s.write(a,"na"),r('respond with "na" for "%s"',t)):(s.write(a,new e(n.map(r=>s.encode(r)))),r('respond with "%s" for %s',n,t))}else r('respond with "%s" for "%s"',i,t),s.write(a,i)}});
|
||
},{"debug":"F8gk","bl/BufferList":"s5uv","./multistream":"Q+6s","it-handshake":"rfs3","./constants":"zfa4"}],"Ybwn":[function(require,module,exports) {
|
||
"use strict";const e=require("it-reader"),r=require("debug")("it-multistream-select:ls"),t=require("./multistream"),i=require("it-handshake"),s=require("it-length-prefixed"),a=require("it-pipe");module.exports=(async o=>{const{reader:u,writer:l,rest:c,stream:n}=i(o);r('write "ls"'),t.write(l,"ls"),c();const d=await t.read(u),m=e([d]),w=[];return await a(m,s.decode(),async e=>{for await(const r of e)w.push(r.shallowSlice(0,-1).toString())}),{stream:n,protocols:w}});
|
||
},{"it-reader":"nMSu","debug":"F8gk","./multistream":"Q+6s","it-handshake":"rfs3","it-length-prefixed":"5Mnk","it-pipe":"p27M"}],"AMc0":[function(require,module,exports) {
|
||
"use strict";const s=require("./select"),t=require("./handle"),e=require("./ls"),{PROTOCOL_ID:r}=require("./constants");exports.PROTOCOL_ID=r;class a{constructor(s){this._stream=s,this._shaken=!1}async _handshake(){if(this._shaken)return;const{stream:t}=await s(this._stream,r);this._stream=t,this._shaken=!0}}class n extends a{select(t){return s(this._stream,t,this._shaken?null:r)}async ls(){await this._handshake();const{stream:s,protocols:t}=await e(this._stream);return this._stream=s,t}}exports.Dialer=n;class i extends a{handle(s){return t(this._stream,s)}}exports.Listener=i;
|
||
},{"./select":"vz1r","./handle":"22hg","./ls":"Ybwn","./constants":"zfa4"}],"JpMl":[function(require,module,exports) {
|
||
"use strict";const o={OPEN:"open",CLOSING:"closing",CLOSED:"closed"};module.exports=o;
|
||
},{}],"07bM":[function(require,module,exports) {
|
||
"use strict";const t=require("peer-id"),{Multiaddr:e}=require("multiaddr"),r=require("err-code"),{OPEN:o,CLOSING:i,CLOSED:n}=require("./status"),s=Symbol.for("@libp2p/interface-connection/connection");class a{constructor({localAddr:t,remoteAddr:e,localPeer:r,remotePeer:i,newStream:n,close:s,getStreams:a,stat:d}){c(t,r,i,n,s,a,d),this.id=parseInt(String(1e9*Math.random())).toString(36)+Date.now(),this.localAddr=t,this.remoteAddr=e,this.localPeer=r,this.remotePeer=i,this._stat={...d,status:o},this._newStream=n,this._close=s,this._getStreams=a,this.registry=new Map,this.tags=[]}get[Symbol.toStringTag](){return"Connection"}get[s](){return!0}static isConnection(t){return Boolean(t&&t[s])}get stat(){return this._stat}get streams(){return this._getStreams()}async newStream(t){if(this.stat.status===i)throw r(new Error("the connection is being closed"),"ERR_CONNECTION_BEING_CLOSED");if(this.stat.status===n)throw r(new Error("the connection is closed"),"ERR_CONNECTION_CLOSED");Array.isArray(t)||(t=[t]);const{stream:e,protocol:o}=await this._newStream(t);return this.addStream(e,{protocol:o}),{stream:e,protocol:o}}addStream(t,{protocol:e,metadata:r={}}){this.registry.set(t.id,{protocol:e,...r})}removeStream(t){this.registry.delete(t)}async close(){if(this.stat.status!==n){if(this._closing)return this._closing;this.stat.status=i,this._closing=await this._close(),this._stat.timeline.close=Date.now(),this.stat.status=n}}}function c(o,i,n,s,a,c,d){if(o&&!e.isMultiaddr(o))throw r(new Error("localAddr must be an instance of multiaddr"),"ERR_INVALID_PARAMETERS");if(!t.isPeerId(i))throw r(new Error("localPeer must be an instance of peer-id"),"ERR_INVALID_PARAMETERS");if(!t.isPeerId(n))throw r(new Error("remotePeer must be an instance of peer-id"),"ERR_INVALID_PARAMETERS");if("function"!=typeof s)throw r(new Error("new stream must be a function"),"ERR_INVALID_PARAMETERS");if("function"!=typeof a)throw r(new Error("close must be a function"),"ERR_INVALID_PARAMETERS");if("function"!=typeof c)throw r(new Error("getStreams must be a function"),"ERR_INVALID_PARAMETERS");if(!d)throw r(new Error("connection metadata object must be provided"),"ERR_INVALID_PARAMETERS");if("inbound"!==d.direction&&"outbound"!==d.direction)throw r(new Error('direction must be "inbound" or "outbound"'),"ERR_INVALID_PARAMETERS");if(!d.timeline)throw r(new Error("connection timeline object must be provided in the stat object"),"ERR_INVALID_PARAMETERS");if(!d.timeline.open)throw r(new Error("connection open timestamp must be provided"),"ERR_INVALID_PARAMETERS");if(!d.timeline.upgraded)throw r(new Error("connection upgraded timestamp must be provided"),"ERR_INVALID_PARAMETERS")}module.exports=a;
|
||
},{"peer-id":"jAbp","multiaddr":"fVn4","err-code":"hLMW","./status":"JpMl"}],"4xg+":[function(require,module,exports) {
|
||
"use strict";exports.Connection=require("./connection");
|
||
},{"./connection":"07bM"}],"Tp79":[function(require,module,exports) {
|
||
"use strict";function r(r){if(Array.isArray(r)){for(var n=0,t=Array(r.length);n<r.length;n++)t[n]=r[n];return t}return Array.from(r)}module.exports=function(n){var t=void 0,e=void 0;function o(r){if(!(r instanceof Object))throw new Error('Target "'+r+'" is not an object');e=r}function a(r){Object.keys(r).forEach(function(n){var t=r[n];if("function"!=typeof t)throw new Error('Trap "'+n+": "+t+'" is not a function');if(!Reflect[n])throw new Error('Trap "'+n+": "+t+'" is not a valid trap')}),t=r}o(function(){}),n&&o(n),a(Reflect);var i=new Proxy({},{get:function(n,o){return function(){for(var n=arguments.length,a=Array(n),i=0;i<n;i++)a[i]=arguments[i];return t[o].apply(null,[e].concat(r(a.slice(1))))}}});return{setTarget:o,setHandler:a,getTarget:function(){return e},getHandler:function(){return t},proxy:new Proxy(e,i)}};
|
||
},{}],"uyx+":[function(require,module,exports) {
|
||
"use strict";function e(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function t(t){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?e(Object(o),!0).forEach(function(e){r(t,e,o[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):e(Object(o)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))})}return t}function r(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n(e,t,r,n,o,c,a){try{var u=e[c](a),i=u.value}catch(s){return void r(s)}u.done?t(i):Promise.resolve(i).then(n,o)}function o(e){return function(){var t=this,r=arguments;return new Promise(function(o,c){var a=e.apply(t,r);function u(e){n(a,o,c,u,i,"next",e)}function i(e){n(a,o,c,u,i,"throw",e)}u(void 0)})}}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),e}var i=require("debug"),s=Object.assign(i("libp2p:upgrader"),{error:i("libp2p:upgrader:err")}),p=require("err-code"),l=require("multistream-select"),m=require("libp2p-interfaces/src/connection"),d=m.Connection,f=require("peer-id"),h=require("it-pipe"),v=h.pipe,b=require("mutable-proxy"),g=require("./errors"),x=g.codes,y=function(){function e(t){var r=t.localPeer,n=t.metrics,o=t.cryptos,a=void 0===o?new Map:o,u=t.muxers,i=void 0===u?new Map:u,s=t.onConnectionEnd,p=void 0===s?function(){}:s,l=t.onConnection,m=void 0===l?function(){}:l;c(this,e),this.localPeer=r,this.metrics=n,this.cryptos=a,this.muxers=i,this.protector=null,this.protocols=new Map,this.onConnection=m,this.onConnectionEnd=p}return u(e,[{key:"upgradeInbound",value:function(){var e=o(regeneratorRuntime.mark(function e(t){var r,n,o,c,a,u,i,p,l,m,d,f;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.metrics&&(p=b(),u=p.setTarget,i=p.proxy,l=(1e9*Math.random()).toString(36)+Date.now(),u({toB58String:function(){return l}}),t=this.metrics.trackStream({stream:t,remotePeer:i})),s("Starting the inbound connection upgrade"),m=t,!this.protector){e.next=7;break}return e.next=6,this.protector.protect(t);case 6:m=e.sent;case 7:return e.prev=7,e.next=10,this._encryptInbound(this.localPeer,m,this.cryptos);case 10:if(d=e.sent,r=d.conn,n=d.remotePeer,a=d.protocol,!this.muxers.size){e.next=22;break}return e.next=17,this._multiplexInbound(r,this.muxers);case 17:f=e.sent,o=f.stream,c=f.Muxer,e.next=23;break;case 22:o=r;case 23:e.next=31;break;case 25:return e.prev=25,e.t0=e.catch(7),s.error("Failed to upgrade inbound connection",e.t0),e.next=30,t.close(e.t0);case 30:throw e.t0;case 31:return this.metrics&&(this.metrics.updatePlaceholder(i,n),u(n)),s("Successfully upgraded inbound connection"),e.abrupt("return",this._createConnection({cryptoProtocol:a,direction:"inbound",maConn:t,upgradedConn:o,Muxer:c,remotePeer:n}));case 34:case"end":return e.stop()}},e,this,[[7,25]])}));return function(t){return e.apply(this,arguments)}}()},{key:"upgradeOutbound",value:function(){var e=o(regeneratorRuntime.mark(function e(t){var r,n,o,c,a,u,i,p,l,m,d,h,v;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=f.createFromB58String(t.remoteAddr.getPeerId()),this.metrics&&(l=b(),i=l.setTarget,p=l.proxy,m=(1e9*Math.random()).toString(36)+Date.now(),i({toB58String:function(){return m}}),t=this.metrics.trackStream({stream:t,remotePeer:p})),s("Starting the outbound connection upgrade"),d=t,!this.protector){e.next=8;break}return e.next=7,this.protector.protect(t);case 7:d=e.sent;case 8:return e.prev=8,e.next=11,this._encryptOutbound(this.localPeer,d,r,this.cryptos);case 11:if(h=e.sent,n=h.conn,o=h.remotePeer,a=h.protocol,!this.muxers.size){e.next=23;break}return e.next=18,this._multiplexOutbound(n,this.muxers);case 18:v=e.sent,c=v.stream,u=v.Muxer,e.next=24;break;case 23:c=n;case 24:e.next=32;break;case 26:return e.prev=26,e.t0=e.catch(8),s.error("Failed to upgrade outbound connection",e.t0),e.next=31,t.close(e.t0);case 31:throw e.t0;case 32:return this.metrics&&(this.metrics.updatePlaceholder(p,o),i(o)),s("Successfully upgraded outbound connection"),e.abrupt("return",this._createConnection({cryptoProtocol:a,direction:"outbound",maConn:t,upgradedConn:c,Muxer:u,remotePeer:o}));case 35:case"end":return e.stop()}},e,this,[[8,26]])}));return function(t){return e.apply(this,arguments)}}()},{key:"_createConnection",value:function(e){var r,n,c,a=this,u=e.cryptoProtocol,i=e.direction,m=e.maConn,f=e.upgradedConn,h=e.Muxer,b=e.remotePeer;h&&(r=new h({onStream:function(){var e=o(regeneratorRuntime.mark(function e(r){var n,o,u,p;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(c){e.next=2;break}return e.abrupt("return");case 2:return n=new l.Listener(r),e.prev=3,e.next=6,n.handle(Array.from(a.protocols.keys()));case 6:o=e.sent,u=o.stream,p=o.protocol,s("%s: incoming stream opened on %s",i,p),a.metrics&&a.metrics.trackStream({stream:u,remotePeer:b,protocol:p}),c.addStream(r,{protocol:p}),a._onStream({connection:c,stream:t(t({},r),u),protocol:p}),e.next=18;break;case 15:e.prev=15,e.t0=e.catch(3),s.error(e.t0);case 18:case"end":return e.stop()}},e,null,[[3,15]])}));return function(t){return e.apply(this,arguments)}}(),onStreamEnd:function(e){c.removeStream(e.id)}}),n=function(){var e=o(regeneratorRuntime.mark(function e(n){var o,c,u,m,d;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return s("%s: starting new stream on %s",i,n),o=r.newStream(),c=new l.Dialer(o),e.prev=3,e.next=6,c.select(n);case 6:return u=e.sent,m=u.stream,d=u.protocol,a.metrics&&a.metrics.trackStream({stream:m,remotePeer:b,protocol:d}),e.abrupt("return",{stream:t(t({},o),m),protocol:d});case 13:throw e.prev=13,e.t0=e.catch(3),s.error("could not create new stream",e.t0),p(e.t0,x.ERR_UNSUPPORTED_PROTOCOL);case 17:case"end":return e.stop()}},e,null,[[3,13]])}));return function(t){return e.apply(this,arguments)}}(),v(f,r,f).catch(s.error));var g=m.timeline;m.timeline=new Proxy(g,{set:function(){return c&&"close"===(arguments.length<=1?void 0:arguments[1])&&(arguments.length<=2?void 0:arguments[2])&&!g.close&&o(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,"open"!==c.stat.status){e.next=4;break}return e.next=4,c.close();case 4:e.next=9;break;case 6:e.prev=6,e.t0=e.catch(0),s.error(e.t0);case 9:return e.prev=9,a.onConnectionEnd(c),e.finish(9);case 12:case"end":return e.stop()}},e,null,[[0,6,9,12]])}))(),Reflect.set.apply(Reflect,arguments)}}),m.timeline.upgraded=Date.now();var y=function(){throw p(new Error("connection is not multiplexed"),"ERR_CONNECTION_NOT_MULTIPLEXED")};return c=new d({localAddr:m.localAddr,remoteAddr:m.remoteAddr,localPeer:this.localPeer,remotePeer:b,stat:{direction:i,timeline:m.timeline,multiplexer:h&&h.multicodec,encryption:u},newStream:n||y,getStreams:function(){return r?r.streams:y()},close:function(){var e=o(regeneratorRuntime.mark(function e(t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,m.close(t);case 2:r&&r.streams.map(function(e){return e.abort()});case 3:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()}),this.onConnection(c),c}},{key:"_onStream",value:function(e){var t=e.connection,r=e.stream,n=e.protocol;this.protocols.get(n)({connection:t,stream:r,protocol:n})}},{key:"_encryptInbound",value:function(){var e=o(regeneratorRuntime.mark(function e(r,n,o){var c,a,u,i,m,d;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return c=new l.Listener(n),a=Array.from(o.keys()),s("handling inbound crypto protocol selection",a),e.prev=3,e.next=6,c.handle(a);case 6:if(u=e.sent,i=u.stream,m=u.protocol,d=o.get(m),s("encrypting inbound connection..."),d){e.next=13;break}throw new Error("no crypto module found for ".concat(m));case 13:return e.t0=t,e.t1=t,e.t2={},e.next=18,d.secureInbound(r,i);case 18:return e.t3=e.sent,e.t4=(0,e.t1)(e.t2,e.t3),e.t5={},e.t6={protocol:m},e.abrupt("return",(0,e.t0)(e.t4,e.t5,e.t6));case 25:throw e.prev=25,e.t7=e.catch(3),p(e.t7,x.ERR_ENCRYPTION_FAILED);case 28:case"end":return e.stop()}},e,null,[[3,25]])}));return function(t,r,n){return e.apply(this,arguments)}}()},{key:"_encryptOutbound",value:function(){var e=o(regeneratorRuntime.mark(function e(r,n,o,c){var a,u,i,m,d,f;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=new l.Dialer(n),u=Array.from(c.keys()),s("selecting outbound crypto protocol",u),e.prev=3,e.next=6,a.select(u);case 6:if(i=e.sent,m=i.stream,d=i.protocol,f=c.get(d),s("encrypting outbound connection to %j",o),f){e.next=13;break}throw new Error("no crypto module found for ".concat(d));case 13:return e.t0=t,e.t1=t,e.t2={},e.next=18,f.secureOutbound(r,m,o);case 18:return e.t3=e.sent,e.t4=(0,e.t1)(e.t2,e.t3),e.t5={},e.t6={protocol:d},e.abrupt("return",(0,e.t0)(e.t4,e.t5,e.t6));case 25:throw e.prev=25,e.t7=e.catch(3),p(e.t7,x.ERR_ENCRYPTION_FAILED);case 28:case"end":return e.stop()}},e,null,[[3,25]])}));return function(t,r,n,o){return e.apply(this,arguments)}}()},{key:"_multiplexOutbound",value:function(){var e=o(regeneratorRuntime.mark(function e(t,r){var n,o,c,a,u,i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=new l.Dialer(t),o=Array.from(r.keys()),s("outbound selecting muxer %s",o),e.prev=3,e.next=6,n.select(o);case 6:return c=e.sent,a=c.stream,u=c.protocol,s("%s selected as muxer protocol",u),i=r.get(u),e.abrupt("return",{stream:a,Muxer:i});case 14:throw e.prev=14,e.t0=e.catch(3),p(e.t0,x.ERR_MUXER_UNAVAILABLE);case 17:case"end":return e.stop()}},e,null,[[3,14]])}));return function(t,r){return e.apply(this,arguments)}}()},{key:"_multiplexInbound",value:function(){var e=o(regeneratorRuntime.mark(function e(t,r){var n,o,c,a,u,i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=new l.Listener(t),o=Array.from(r.keys()),s("inbound handling muxers %s",o),e.prev=3,e.next=6,n.handle(o);case 6:return c=e.sent,a=c.stream,u=c.protocol,i=r.get(u),e.abrupt("return",{stream:a,Muxer:i});case 13:throw e.prev=13,e.t0=e.catch(3),p(e.t0,x.ERR_MUXER_UNAVAILABLE);case 16:case"end":return e.stop()}},e,null,[[3,13]])}));return function(t,r){return e.apply(this,arguments)}}()}]),e}();module.exports=y;
|
||
},{"debug":"F8gk","err-code":"hLMW","multistream-select":"AMc0","libp2p-interfaces/src/connection":"4xg+","peer-id":"jAbp","it-pipe":"p27M","mutable-proxy":"Tp79","./errors":"YLhd"}],"VOR7":[function(require,module,exports) {
|
||
"use strict";function e(e){return i(e)||n(e)||r(e)||t()}function t(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function r(e,t){if(e){if("string"==typeof e)return o(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(e,t):void 0}}function n(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function i(e){if(Array.isArray(e))return o(e)}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function c(e,t,r){return t&&s(e.prototype,t),r&&s(e,r),e}var f=require("err-code"),l=require("peer-id"),d=require("../errors"),m=d.codes.ERR_INVALID_PARAMETERS,v=function(e){return e},p=function(){function t(e){var r=e.peerStore,n=e.eventName,i=e.eventProperty,o=e.eventTransformer,a=void 0===o?v:o;u(this,t),this._ps=r,this.eventName=n,this.eventProperty=i,this.eventTransformer=a,this.data=new Map}return c(t,[{key:"set",value:function(e,t){throw f(new Error("set must be implemented by the subclass"),"ERR_NOT_IMPLEMENTED")}},{key:"_setData",value:function(e,t){var r=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).emit,n=void 0===r||r,i=e.toB58String();this.data.set(i,t),n&&this._emit(e,t)}},{key:"_emit",value:function(e,t){this._ps.emit(this.eventName,a({peerId:e},this.eventProperty,this.eventTransformer(t)))}},{key:"get",value:function(t){if(!l.isPeerId(t))throw f(new Error("peerId must be an instance of peer-id"),m);var r=this.data.get(t.toB58String());return r?e(r):void 0}},{key:"delete",value:function(e){if(!l.isPeerId(e))throw f(new Error("peerId must be an instance of peer-id"),m);return!!this.data.delete(e.toB58String())&&(this._emit(e,[]),!0)}}]),t}();module.exports=p;
|
||
},{"err-code":"hLMW","peer-id":"jAbp","../errors":"YLhd"}],"zdI+":[function(require,module,exports) {
|
||
"use strict";function e(r){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(r)}function r(e){return i(e)||o(e)||n(e)||t()}function t(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function n(e,r){if(e){if("string"==typeof e)return a(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?a(e,r):void 0}}function o(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function i(e){if(Array.isArray(e))return a(e)}function a(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function s(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function d(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,r,t){return r&&d(e.prototype,r),t&&d(e,t),e}function c(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),r&&f(e,r)}function f(e,r){return(f=Object.setPrototypeOf||function(e,r){return e.__proto__=r,e})(e,r)}function l(e){var r=h();return function(){var t,n=y(e);if(r){var o=y(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return p(this,t)}}function p(r,t){return!t||"object"!==e(t)&&"function"!=typeof t?m(r):t}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function h(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function y(e){return(y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var v=require("debug"),b=Object.assign(v("libp2p:peer-store:address-book"),{error:v("libp2p:peer-store:address-book:err")}),g=require("err-code"),w=require("multiaddr"),S=w.Multiaddr,I=require("peer-id"),P=require("./book"),_=require("../record/peer-record"),E=require("../errors"),q=E.codes.ERR_INVALID_PARAMETERS,O=require("../record/envelope"),R=function(e){c(n,P);var t=l(n);function n(e){var r;return s(this,n),(r=t.call(this,{peerStore:e,eventName:"change:multiaddrs",eventProperty:"multiaddrs",eventTransformer:function(e){return e.addresses?e.addresses.map(function(e){return e.multiaddr}):[]}})).data=new Map,r}return u(n,[{key:"consumePeerRecord",value:function(e){var r;try{r=_.createFromProtobuf(e.payload)}catch(a){return b.error("invalid peer record received"),!1}if(!r.peerId.equals(e.peerId))return b("signing key does not match PeerId in the PeerRecord"),!1;if(!r.multiaddrs||!r.multiaddrs.length)return!1;var t=r.peerId,n=t.toB58String(),o=(this.data.get(n)||{record:void 0}).record;if(o&&o.seqNumber>=r.seqNumber)return!1;var i=this._toAddresses(r.multiaddrs,!0);return this._setData(t,{addresses:i,record:{raw:e.marshal(),seqNumber:r.seqNumber}}),b("stored provided peer record for ".concat(n)),!0}},{key:"getRawEnvelope",value:function(e){var r=this.data.get(e.toB58String());if(r&&r.record&&r.record.raw)return r.record.raw}},{key:"getPeerRecord",value:function(e){var r=this.getRawEnvelope(e);if(r)return O.createFromProtobuf(r)}},{key:"set",value:function(e,r){if(!I.isPeerId(e))throw b.error("peerId must be an instance of peer-id to store data"),g(new Error("peerId must be an instance of peer-id"),q);var t=this._toAddresses(r);if(!t.length)return this;var n=e.toB58String(),o=this.data.get(n);if(o&&o.addresses&&o.addresses.length===t.length&&o.addresses.filter(function(e){return t.some(function(r){return e.multiaddr.equals(r.multiaddr)})}).length===o.addresses.length)return b("the addresses provided to store are equal to the already stored for ".concat(n)),this;return this._setData(e,{addresses:t,record:o&&o.record}),b("stored provided multiaddrs for ".concat(n)),o||this._ps.emit("peer",e),this}},{key:"add",value:function(e,r){if(!I.isPeerId(e))throw b.error("peerId must be an instance of peer-id to store data"),g(new Error("peerId must be an instance of peer-id"),q);var t=this._toAddresses(r),n=e.toB58String(),o=this.data.get(n);return o&&o.addresses&&(o.addresses.forEach(function(e){t.find(function(r){return r.multiaddr.equals(e.multiaddr)})||t.push(e)}),o.addresses.length===t.length)?(b("the addresses provided to store are already stored for ".concat(n)),this):(this._setData(e,{addresses:t,record:o&&o.record}),b("added provided multiaddrs for ".concat(n)),o&&o.addresses||this._ps.emit("peer",e),this)}},{key:"get",value:function(e){if(!I.isPeerId(e))throw g(new Error("peerId must be an instance of peer-id"),q);var t=this.data.get(e.toB58String());return t&&t.addresses?r(t.addresses):void 0}},{key:"_toAddresses",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)throw b.error("multiaddrs must be provided to store data"),g(new Error("multiaddrs must be provided"),q);var t=[];return e.forEach(function(e){if(!S.isMultiaddr(e))throw b.error("multiaddr ".concat(e," must be an instance of multiaddr")),g(new Error("multiaddr ".concat(e," must be an instance of multiaddr")),q);t.push({multiaddr:e,isCertified:r})}),t}},{key:"getMultiaddrsForPeer",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(e){return e};if(!I.isPeerId(e))throw g(new Error("peerId must be an instance of peer-id"),q);var t=this.data.get(e.toB58String());if(t&&t.addresses)return r(t.addresses||[]).map(function(r){var t=r.multiaddr,n=t.getPeerId();return n&&n===e.toB58String()?t:t.encapsulate("/p2p/".concat(e.toB58String()))})}}]),n}();module.exports=R;
|
||
},{"debug":"F8gk","err-code":"hLMW","multiaddr":"fVn4","peer-id":"jAbp","./book":"VOR7","../record/peer-record":"ry3y","../errors":"YLhd","../record/envelope":"59KL"}],"WpCf":[function(require,module,exports) {
|
||
"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function n(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&u(e,t)}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(e){var t=a();return function(){var r,n=p(e);if(t){var o=p(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}function c(t,r){return!r||"object"!==e(r)&&"function"!=typeof r?f(t):r}function f(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function a(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function p(e){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var s=require("debug"),l=Object.assign(s("libp2p:peer-store:key-book"),{error:s("libp2p:peer-store:key-book:err")}),y=require("err-code"),b=require("peer-id"),d=require("./book"),h=require("../errors"),v=h.codes.ERR_INVALID_PARAMETERS,m=function(e){o(u,d);var r=i(u);function u(e){var n;return t(this,u),(n=r.call(this,{peerStore:e,eventName:"change:pubkey",eventProperty:"pubkey",eventTransformer:function(e){return e.pubKey}})).data=new Map,n}return n(u,[{key:"set",value:function(e,t){if(!b.isPeerId(e))throw l.error("peerId must be an instance of peer-id to store data"),y(new Error("peerId must be an instance of peer-id"),v);var r=e.toB58String();return!this.data.get(r)&&t&&(e.pubKey=t,this._setData(e,e),l("stored provided public key for ".concat(r))),this}},{key:"get",value:function(e){if(!b.isPeerId(e))throw y(new Error("peerId must be an instance of peer-id"),v);var t=this.data.get(e.toB58String());return t?t.pubKey:void 0}}]),u}();module.exports=m;
|
||
},{"debug":"F8gk","err-code":"hLMW","peer-id":"jAbp","./book":"VOR7","../errors":"YLhd"}],"6H8U":[function(require,module,exports) {
|
||
"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function n(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){var t=s();return function(){var r,n=f(e);if(t){var o=f(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return u(this,r)}}function u(t,r){return!r||"object"!==e(r)&&"function"!=typeof r?c(t):r}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function s(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var l=require("debug"),p=Object.assign(l("libp2p:peer-store:proto-book"),{error:l("libp2p:peer-store:proto-book:err")}),d=require("err-code"),y=require("uint8arrays/equals"),b=require("peer-id"),h=require("./book"),v=require("../errors"),m=v.codes.ERR_INVALID_PARAMETERS,g=function(e){o(i,h);var r=a(i);function i(e){var n;return t(this,i),(n=r.call(this,{peerStore:e,eventName:"change:metadata",eventProperty:"metadata"})).data=new Map,n}return n(i,[{key:"set",value:function(e,t,r){if(!b.isPeerId(e))throw p.error("peerId must be an instance of peer-id to store data"),d(new Error("peerId must be an instance of peer-id"),m);if("string"!=typeof t||!(r instanceof Uint8Array))throw p.error("valid key and value must be provided to store data"),d(new Error("valid key and value must be provided"),m);return this._setValue(e,t,r),this}},{key:"_setValue",value:function(e,t,r){var n=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).emit,o=void 0===n||n,i=e.toB58String(),a=this.data.get(i)||new Map,u=a.get(t);u&&y(r,u)?p("the metadata provided to store is equal to the already stored for ".concat(i," on ").concat(t)):(a.set(t,r),this.data.set(i,a),o&&this._emit(e,t))}},{key:"get",value:function(e){if(!b.isPeerId(e))throw d(new Error("peerId must be an instance of peer-id"),m);return this.data.get(e.toB58String())}},{key:"getValue",value:function(e,t){if(!b.isPeerId(e))throw d(new Error("peerId must be an instance of peer-id"),m);var r=this.data.get(e.toB58String());return r&&r.get(t)}},{key:"delete",value:function(e){if(!b.isPeerId(e))throw d(new Error("peerId must be an instance of peer-id"),m);return!!this.data.delete(e.toB58String())&&(this._emit(e),!0)}},{key:"deleteValue",value:function(e,t){if(!b.isPeerId(e))throw d(new Error("peerId must be an instance of peer-id"),m);var r=this.data.get(e.toB58String());return!(!r||!r.delete(t))&&(this._emit(e,t),!0)}}]),i}();module.exports=g;
|
||
},{"debug":"F8gk","err-code":"hLMW","uint8arrays/equals":"mZxc","peer-id":"jAbp","./book":"VOR7","../errors":"YLhd"}],"oqO6":[function(require,module,exports) {
|
||
"use strict";function e(r){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(r)}function r(e){return i(e)||n(e)||o(e)||t()}function t(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function o(e,r){if(e){if("string"==typeof e)return a(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?a(e,r):void 0}}function n(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function i(e){if(Array.isArray(e))return a(e)}function a(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,o=new Array(r);t<r;t++)o[t]=e[t];return o}function c(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function u(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function s(e,r,t){return r&&u(e.prototype,r),t&&u(e,t),e}function f(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),r&&p(e,r)}function p(e,r){return(p=Object.setPrototypeOf||function(e,r){return e.__proto__=r,e})(e,r)}function d(e){var r=b();return function(){var t,o=h(e);if(r){var n=h(this).constructor;t=Reflect.construct(o,arguments,n)}else t=o.apply(this,arguments);return l(this,t)}}function l(r,t){return!t||"object"!==e(t)&&"function"!=typeof t?y(r):t}function y(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function b(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var v=require("debug"),m=Object.assign(v("libp2p:peer-store:proto-book"),{error:v("libp2p:peer-store:proto-book:err")}),w=require("err-code"),S=require("peer-id"),g=require("./book"),O=require("../errors"),I=O.codes.ERR_INVALID_PARAMETERS,E=function(e){f(o,g);var t=d(o);function o(e){var r;return c(this,o),(r=t.call(this,{peerStore:e,eventName:"change:protocols",eventProperty:"protocols",eventTransformer:function(e){return Array.from(e)}})).data=new Map,r}return s(o,[{key:"set",value:function(e,t){if(!S.isPeerId(e))throw m.error("peerId must be an instance of peer-id to store data"),w(new Error("peerId must be an instance of peer-id"),I);if(!t)throw m.error("protocols must be provided to store data"),w(new Error("protocols must be provided"),I);var o,n,i=e.toB58String(),a=this.data.get(i),c=new Set(t);return a&&(n=c,(o=a).size===n.size&&r(o).every(function(e){return n.has(e)}))?(m("the protocols provided to store are equal to the already stored for ".concat(i)),this):(this._setData(e,c),m("stored provided protocols for ".concat(i)),this)}},{key:"add",value:function(e,t){if(!S.isPeerId(e))throw m.error("peerId must be an instance of peer-id to store data"),w(new Error("peerId must be an instance of peer-id"),I);if(!t)throw m.error("protocols must be provided to store data"),w(new Error("protocols must be provided"),I);var o=e.toB58String(),n=this.data.get(o)||new Set,i=new Set([].concat(r(n),r(t)));return n.size===i.size?(m("the protocols provided to store are already stored for ".concat(o)),this):(this._setData(e,i),m("added provided protocols for ".concat(o)),this)}},{key:"remove",value:function(e,t){if(!S.isPeerId(e))throw m.error("peerId must be an instance of peer-id to store data"),w(new Error("peerId must be an instance of peer-id"),I);if(!t)throw m.error("protocols must be provided to store data"),w(new Error("protocols must be provided"),I);var o=e.toB58String(),n=this.data.get(o);if(n){var i=new Set(r(n).filter(function(e){return!t.includes(e)}));if(n.size===i.size)return this;this._setData(e,i),m("removed provided protocols for ".concat(o))}return this}}]),o}();module.exports=E;
|
||
},{"debug":"F8gk","err-code":"hLMW","peer-id":"jAbp","./book":"VOR7","../errors":"YLhd"}],"XS43":[function(require,module,exports) {
|
||
"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e){return i(e)||n(e)||o(e)||r()}function r(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function o(e,t){if(e){if("string"==typeof e)return a(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(e,t):void 0}}function n(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function i(e){if(Array.isArray(e))return a(e)}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function s(e,t,r){return t&&c(e.prototype,t),r&&c(e,r),e}function f(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&l(e,t)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(e){var t=b();return function(){var r,o=h(e);if(t){var n=h(this).constructor;r=Reflect.construct(o,arguments,n)}else r=o.apply(this,arguments);return p(this,r)}}function p(t,r){return!r||"object"!==e(r)&&"function"!=typeof r?d(t):r}function d(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function b(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var k=require("err-code"),m=require("events"),v=require("peer-id"),B=require("./address-book"),g=require("./key-book"),w=require("./metadata-book"),S=require("./proto-book"),O=require("../errors"),_=O.codes.ERR_INVALID_PARAMETERS,I=function(e){f(o,m);var r=y(o);function o(e){var t,n=e.peerId;return u(this,o),(t=r.call(this))._peerId=n,t.addressBook=new B(d(t)),t.keyBook=new g(d(t)),t.metadataBook=new w(d(t)),t.protoBook=new S(d(t)),t}return s(o,[{key:"start",value:function(){}},{key:"stop",value:function(){}},{key:"peers",get:function(){var e=this,r=new Set([].concat(t(this.addressBook.data.keys()),t(this.keyBook.data.keys()),t(this.protoBook.data.keys()),t(this.metadataBook.data.keys())));this._peerId&&r.delete(this._peerId.toB58String());var o=new Map;return r.forEach(function(t){o.set(t,e.get(v.createFromCID(t)))}),o}},{key:"delete",value:function(e){var t=this.addressBook.delete(e),r=this.keyBook.delete(e),o=this.protoBook.delete(e),n=this.metadataBook.delete(e);return t||r||o||n}},{key:"get",value:function(e){if(!v.isPeerId(e))throw k(new Error("peerId must be an instance of peer-id"),_);var t=this.keyBook.data.get(e.toB58String()),r=this.addressBook.get(e),o=this.metadataBook.get(e),n=this.protoBook.get(e);if(t||r||o||n)return{id:t||e,addresses:r||[],protocols:n||[],metadata:o}}}]),o}();module.exports=I;
|
||
},{"err-code":"hLMW","events":"wIHY","peer-id":"jAbp","./address-book":"zdI+","./key-book":"WpCf","./metadata-book":"6H8U","./proto-book":"oqO6","../errors":"YLhd"}],"FkEY":[function(require,module,exports) {
|
||
"use strict";function e(e,s,r){var u=new e(s,r);return u._subscribeAdapter=u.subscribe,u._unsubscribeAdapter=u.unsubscribe,u.subscribe=function(e,s){s&&u.on(e,s),u._subscribeAdapter(e)},u.unsubscribe=function(e,s){s?u.removeListener(e,s):u.removeAllListeners(e),0===u.listenerCount(e)&&u._unsubscribeAdapter(e)},u}module.exports=e;
|
||
},{}],"Om0G":[function(require,module,exports) {
|
||
"use strict";module.exports.NAMESPACE_COMMON="/peers/",module.exports.NAMESPACE_ADDRESS="/peers/addrs/",module.exports.NAMESPACE_KEYS="/peers/keys/",module.exports.NAMESPACE_METADATA="/peers/metadata/",module.exports.NAMESPACE_PROTOCOL="/peers/protos/";
|
||
},{}],"LWDm":[function(require,module,exports) {
|
||
"use strict";function e(r){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(r)}var r=require("protobufjs/minimal"),t=r.Reader,d=r.Writer,s=r.util,i=r.roots.default||(r.roots.default={});i.Addresses=function(){function o(e){if(this.addrs=[],e)for(var r=Object.keys(e),t=0;t<r.length;++t)null!=e[r[t]]&&(this[r[t]]=e[r[t]])}return o.prototype.addrs=s.emptyArray,o.prototype.certifiedRecord=null,o.encode=function(e,r){if(r||(r=d.create()),null!=e.addrs&&e.addrs.length)for(var t=0;t<e.addrs.length;++t)i.Addresses.Address.encode(e.addrs[t],r.uint32(10).fork()).ldelim();return null!=e.certifiedRecord&&Object.hasOwnProperty.call(e,"certifiedRecord")&&i.Addresses.CertifiedRecord.encode(e.certifiedRecord,r.uint32(18).fork()).ldelim(),r},o.decode=function(e,r){e instanceof t||(e=t.create(e));for(var d=void 0===r?e.len:e.pos+r,s=new i.Addresses;e.pos<d;){var o=e.uint32();switch(o>>>3){case 1:s.addrs&&s.addrs.length||(s.addrs=[]),s.addrs.push(i.Addresses.Address.decode(e,e.uint32()));break;case 2:s.certifiedRecord=i.Addresses.CertifiedRecord.decode(e,e.uint32());break;default:e.skipType(7&o)}}return s},o.fromObject=function(r){if(r instanceof i.Addresses)return r;var t=new i.Addresses;if(r.addrs){if(!Array.isArray(r.addrs))throw TypeError(".Addresses.addrs: array expected");t.addrs=[];for(var d=0;d<r.addrs.length;++d){if("object"!==e(r.addrs[d]))throw TypeError(".Addresses.addrs: object expected");t.addrs[d]=i.Addresses.Address.fromObject(r.addrs[d])}}if(null!=r.certifiedRecord){if("object"!==e(r.certifiedRecord))throw TypeError(".Addresses.certifiedRecord: object expected");t.certifiedRecord=i.Addresses.CertifiedRecord.fromObject(r.certifiedRecord)}return t},o.toObject=function(e,r){r||(r={});var t={};if((r.arrays||r.defaults)&&(t.addrs=[]),r.defaults&&(t.certifiedRecord=null),e.addrs&&e.addrs.length){t.addrs=[];for(var d=0;d<e.addrs.length;++d)t.addrs[d]=i.Addresses.Address.toObject(e.addrs[d],r)}return null!=e.certifiedRecord&&e.hasOwnProperty("certifiedRecord")&&(t.certifiedRecord=i.Addresses.CertifiedRecord.toObject(e.certifiedRecord,r)),t},o.prototype.toJSON=function(){return this.constructor.toObject(this,r.util.toJSONOptions)},o.Address=function(){function e(e){if(e)for(var r=Object.keys(e),t=0;t<r.length;++t)null!=e[r[t]]&&(this[r[t]]=e[r[t]])}return e.prototype.multiaddr=s.newBuffer([]),e.prototype.isCertified=!1,e.encode=function(e,r){return r||(r=d.create()),null!=e.multiaddr&&Object.hasOwnProperty.call(e,"multiaddr")&&r.uint32(10).bytes(e.multiaddr),null!=e.isCertified&&Object.hasOwnProperty.call(e,"isCertified")&&r.uint32(16).bool(e.isCertified),r},e.decode=function(e,r){e instanceof t||(e=t.create(e));for(var d=void 0===r?e.len:e.pos+r,s=new i.Addresses.Address;e.pos<d;){var o=e.uint32();switch(o>>>3){case 1:s.multiaddr=e.bytes();break;case 2:s.isCertified=e.bool();break;default:e.skipType(7&o)}}return s},e.fromObject=function(e){if(e instanceof i.Addresses.Address)return e;var r=new i.Addresses.Address;return null!=e.multiaddr&&("string"==typeof e.multiaddr?s.base64.decode(e.multiaddr,r.multiaddr=s.newBuffer(s.base64.length(e.multiaddr)),0):e.multiaddr.length&&(r.multiaddr=e.multiaddr)),null!=e.isCertified&&(r.isCertified=Boolean(e.isCertified)),r},e.toObject=function(e,r){r||(r={});var t={};return r.defaults&&(r.bytes===String?t.multiaddr="":(t.multiaddr=[],r.bytes!==Array&&(t.multiaddr=s.newBuffer(t.multiaddr))),t.isCertified=!1),null!=e.multiaddr&&e.hasOwnProperty("multiaddr")&&(t.multiaddr=r.bytes===String?s.base64.encode(e.multiaddr,0,e.multiaddr.length):r.bytes===Array?Array.prototype.slice.call(e.multiaddr):e.multiaddr),null!=e.isCertified&&e.hasOwnProperty("isCertified")&&(t.isCertified=e.isCertified),t},e.prototype.toJSON=function(){return this.constructor.toObject(this,r.util.toJSONOptions)},e}(),o.CertifiedRecord=function(){function o(e){if(e)for(var r=Object.keys(e),t=0;t<r.length;++t)null!=e[r[t]]&&(this[r[t]]=e[r[t]])}return o.prototype.seq=s.Long?s.Long.fromBits(0,0,!0):0,o.prototype.raw=s.newBuffer([]),o.encode=function(e,r){return r||(r=d.create()),null!=e.seq&&Object.hasOwnProperty.call(e,"seq")&&r.uint32(8).uint64(e.seq),null!=e.raw&&Object.hasOwnProperty.call(e,"raw")&&r.uint32(18).bytes(e.raw),r},o.decode=function(e,r){e instanceof t||(e=t.create(e));for(var d=void 0===r?e.len:e.pos+r,s=new i.Addresses.CertifiedRecord;e.pos<d;){var o=e.uint32();switch(o>>>3){case 1:s.seq=e.uint64();break;case 2:s.raw=e.bytes();break;default:e.skipType(7&o)}}return s},o.fromObject=function(r){if(r instanceof i.Addresses.CertifiedRecord)return r;var t=new i.Addresses.CertifiedRecord;return null!=r.seq&&(s.Long?(t.seq=s.Long.fromValue(r.seq)).unsigned=!0:"string"==typeof r.seq?t.seq=parseInt(r.seq,10):"number"==typeof r.seq?t.seq=r.seq:"object"===e(r.seq)&&(t.seq=new s.LongBits(r.seq.low>>>0,r.seq.high>>>0).toNumber(!0))),null!=r.raw&&("string"==typeof r.raw?s.base64.decode(r.raw,t.raw=s.newBuffer(s.base64.length(r.raw)),0):r.raw.length&&(t.raw=r.raw)),t},o.toObject=function(e,r){r||(r={});var t={};if(r.defaults){if(s.Long){var d=new s.Long(0,0,!0);t.seq=r.longs===String?d.toString():r.longs===Number?d.toNumber():d}else t.seq=r.longs===String?"0":0;r.bytes===String?t.raw="":(t.raw=[],r.bytes!==Array&&(t.raw=s.newBuffer(t.raw)))}return null!=e.seq&&e.hasOwnProperty("seq")&&("number"==typeof e.seq?t.seq=r.longs===String?String(e.seq):e.seq:t.seq=r.longs===String?s.Long.prototype.toString.call(e.seq):r.longs===Number?new s.LongBits(e.seq.low>>>0,e.seq.high>>>0).toNumber(!0):e.seq),null!=e.raw&&e.hasOwnProperty("raw")&&(t.raw=r.bytes===String?s.base64.encode(e.raw,0,e.raw.length):r.bytes===Array?Array.prototype.slice.call(e.raw):e.raw),t},o.prototype.toJSON=function(){return this.constructor.toObject(this,r.util.toJSONOptions)},o}(),o}(),module.exports=i;
|
||
},{"protobufjs/minimal":"78bh"}],"QS5H":[function(require,module,exports) {
|
||
"use strict";var o=require("protobufjs/minimal"),t=o.Reader,r=o.Writer,s=o.util,e=o.roots.default||(o.roots.default={});e.Protocols=function(){function c(o){if(this.protocols=[],o)for(var t=Object.keys(o),r=0;r<t.length;++r)null!=o[t[r]]&&(this[t[r]]=o[t[r]])}return c.prototype.protocols=s.emptyArray,c.encode=function(o,t){if(t||(t=r.create()),null!=o.protocols&&o.protocols.length)for(var s=0;s<o.protocols.length;++s)t.uint32(10).string(o.protocols[s]);return t},c.decode=function(o,r){o instanceof t||(o=t.create(o));for(var s=void 0===r?o.len:o.pos+r,c=new e.Protocols;o.pos<s;){var l=o.uint32();switch(l>>>3){case 1:c.protocols&&c.protocols.length||(c.protocols=[]),c.protocols.push(o.string());break;default:o.skipType(7&l)}}return c},c.fromObject=function(o){if(o instanceof e.Protocols)return o;var t=new e.Protocols;if(o.protocols){if(!Array.isArray(o.protocols))throw TypeError(".Protocols.protocols: array expected");t.protocols=[];for(var r=0;r<o.protocols.length;++r)t.protocols[r]=String(o.protocols[r])}return t},c.toObject=function(o,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.protocols=[]),o.protocols&&o.protocols.length){r.protocols=[];for(var s=0;s<o.protocols.length;++s)r.protocols[s]=o.protocols[s]}return r},c.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},c}(),module.exports=e;
|
||
},{"protobufjs/minimal":"78bh"}],"o25R":[function(require,module,exports) {
|
||
"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t,r,n,a,o,i){try{var c=e[o](i),s=c.value}catch(u){return void r(u)}c.done?t(s):Promise.resolve(s).then(n,a)}function r(e){return function(){var r=this,n=arguments;return new Promise(function(a,o){var i=e.apply(r,n);function c(e){t(i,a,o,c,s,"next",e)}function s(e){t(i,a,o,c,s,"throw",e)}c(void 0)})}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),e}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&c(e,t)}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function s(e){var t=f();return function(){var r,n=h(e);if(t){var a=h(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return u(this,r)}}function u(t,r){return!r||"object"!==e(r)&&"function"!=typeof r?d(t):r}function d(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(e){var t;if("undefined"!=typeof Symbol){if(Symbol.asyncIterator&&null!=(t=e[Symbol.asyncIterator]))return t.call(e);if(Symbol.iterator&&null!=(t=e[Symbol.iterator]))return t.call(e)}throw new TypeError("Object is not async iterable")}var l=require("debug"),y=Object.assign(l("libp2p:persistent-peer-store"),{error:l("libp2p:persistent-peer-store:err")}),m=require("interface-datastore"),b=m.Key,v=require("multiaddr"),_=v.Multiaddr,k=require("peer-id"),g=require(".."),P=require("./consts"),S=P.NAMESPACE_ADDRESS,w=P.NAMESPACE_COMMON,x=P.NAMESPACE_KEYS,B=P.NAMESPACE_METADATA,D=P.NAMESPACE_PROTOCOL,E=require("./pb/address-book"),R=E.Addresses,A=require("./pb/proto-book"),M=A.Protocols,O=function(e){i(a,g);var t=s(a);function a(e){var r,o=e.peerId,i=e.datastore,c=e.threshold,s=void 0===c?5:c;return n(this,a),(r=t.call(this,{peerId:o}))._datastore=i,r._dirtyPeers=new Set,r._dirtyMetadata=new Map,r.threshold=s,r._addDirtyPeer=r._addDirtyPeer.bind(d(r)),r}return o(a,[{key:"start",value:function(){var e=r(regeneratorRuntime.mark(function e(){var t,r,n,a,o,i,c;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:y("PeerStore is starting"),this.on("change:protocols",this._addDirtyPeer),this.on("change:multiaddrs",this._addDirtyPeer),this.on("change:pubkey",this._addDirtyPeerKey),this.on("change:metadata",this._addDirtyPeerMetadata),t=!0,r=!1,e.prev=7,a=p(this._datastore.query({prefix:w}));case 9:return e.next=11,a.next();case 11:return o=e.sent,t=o.done,e.next=15,o.value;case 15:if(i=e.sent,t){e.next=23;break}return c=i,e.next=20,this._processDatastoreEntry(c);case 20:t=!0,e.next=9;break;case 23:e.next=29;break;case 25:e.prev=25,e.t0=e.catch(7),r=!0,n=e.t0;case 29:if(e.prev=29,e.prev=30,t||null==a.return){e.next=34;break}return e.next=34,a.return();case 34:if(e.prev=34,!r){e.next=37;break}throw n;case 37:return e.finish(34);case 38:return e.finish(29);case 39:y("PeerStore started");case 40:case"end":return e.stop()}},e,this,[[7,25,29,39],[30,,34,38]])}));return function(){return e.apply(this,arguments)}}()},{key:"stop",value:function(){var e=r(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return y("PeerStore is stopping"),this.removeAllListeners(),e.next=4,this._commitData();case 4:y("PeerStore stopped");case 5:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"_addDirtyPeer",value:function(e){var t=e.peerId.toB58String();y("add dirty peer",t),this._dirtyPeers.add(t),this._dirtyPeers.size>=this.threshold&&this._commitData().catch(function(e){y.error("error committing data",e)})}},{key:"_addDirtyPeerKey",value:function(e){var t=e.peerId;if(!t.hasInlinePublicKey()){var r=t.toB58String();y("add dirty peer key",r),this._dirtyPeers.add(r),this._dirtyPeers.size>=this.threshold&&this._commitData().catch(function(e){y.error("error committing data",e)})}}},{key:"_addDirtyPeerMetadata",value:function(e){var t=e.peerId,r=e.metadata,n=t.toB58String();y("add dirty metadata peer",n),this._dirtyPeers.add(n);var a=this._dirtyMetadata.get(n)||new Set;a.add(r),this._dirtyMetadata.set(n,a),this._dirtyPeers.size>=this.threshold&&this._commitData().catch(function(e){y.error("error committing data",e)})}},{key:"_commitData",value:function(){var e=r(regeneratorRuntime.mark(function e(){var t,r,n,a,o,i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if((t=Array.from(this._dirtyPeers)).length){e.next=3;break}return e.abrupt("return");case 3:for(this._dirtyPeers.clear(),y("create batch commit"),r=this._datastore.batch(),n=0,a=t;n<a.length;n++)o=a[n],i=this.keyBook.data.get(o)||k.createFromCID(o),this._batchAddressBook(i,r),!i.hasInlinePublicKey()&&this._batchKeyBook(i,r),this._batchMetadataBook(i,r),this._batchProtoBook(i,r);return e.next=9,r.commit();case 9:y("batch committed");case 10:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"_batchAddressBook",value:function(e,t){var r=e.toString(),n=new b("".concat(S).concat(r)),a=this.addressBook.data.get(e.toB58String());try{if(!a)return void t.delete(n);var o=R.encode({addrs:a.addresses.map(function(e){return{multiaddr:e.multiaddr.bytes,isCertified:e.isCertified}}),certifiedRecord:a.record?{seq:a.record.seqNumber,raw:a.record.raw}:void 0}).finish();t.put(n,o)}catch(i){y.error(i)}}},{key:"_batchKeyBook",value:function(e,t){var r=e.toString(),n=new b("".concat(x).concat(r));try{if(!e.pubKey)return void t.delete(n);var a=e.marshalPubKey();t.put(n,a)}catch(o){y.error(o)}}},{key:"_batchMetadataBook",value:function(e,t){var r=this,n=e.toString(),a=this._dirtyMetadata.get(e.toB58String())||[];try{a.forEach(function(a){var o=new b("".concat(B).concat(n,"/").concat(a)),i=r.metadataBook.getValue(e,a);i?t.put(o,i):t.delete(o)})}catch(o){y.error(o)}}},{key:"_batchProtoBook",value:function(e,t){var r=e.toString(),n=new b("".concat(D).concat(r)),a=this.protoBook.get(e);try{if(!a)return void t.delete(n);var o=M.encode({protocols:a}).finish();t.put(n,o)}catch(i){y.error(i)}}},{key:"_processDatastoreEntry",value:function(){var e=r(regeneratorRuntime.mark(function e(t){var r,n,a,o,i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:r=t.key,n=t.value,e.prev=1,a=r.toString().split("/"),o=k.createFromCID(a[3]),e.t0=a[2],e.next="addrs"===e.t0?7:"keys"===e.t0?10:"metadata"===e.t0?15:"protos"===e.t0?17:20;break;case 7:return i=R.decode(n),this.addressBook._setData(o,{addresses:i.addrs.map(function(e){return{multiaddr:new _(e.multiaddr),isCertified:Boolean(e.isCertified)}}),record:i.certifiedRecord?{raw:i.certifiedRecord.raw,seqNumber:i.certifiedRecord.seq}:void 0},{emit:!1}),e.abrupt("break",21);case 10:return e.next=12,k.createFromPubKey(n);case 12:return i=e.sent,this.keyBook._setData(i,i,{emit:!1}),e.abrupt("break",21);case 15:return this.metadataBook._setValue(o,a[4],n,{emit:!1}),e.abrupt("break",21);case 17:return i=M.decode(n),this.protoBook._setData(o,new Set(i.protocols),{emit:!1}),e.abrupt("break",21);case 20:y("invalid data persisted for: ",r.toString());case 21:e.next=26;break;case 23:e.prev=23,e.t1=e.catch(1),y.error(e.t1);case 26:case"end":return e.stop()}},e,this,[[1,23]])}));return function(t){return e.apply(this,arguments)}}()}]),a}();module.exports=O;
|
||
},{"debug":"F8gk","interface-datastore":"q9af","multiaddr":"fVn4","peer-id":"jAbp","..":"XS43","./consts":"Om0G","./pb/address-book":"LWDm","./pb/proto-book":"QS5H"}],"7Jl7":[function(require,module,exports) {
|
||
"use strict";const t=()=>{},o=Symbol.for("@libp2p/js-interfaces/topology");class n{constructor({min:o=0,max:n=1/0,handlers:s={}}){this.min=o,this.max=n,this._onConnect=s.onConnect||t,this._onDisconnect=s.onDisconnect||t,this.peers=new Set}get[Symbol.toStringTag](){return"Topology"}get[o](){return!0}static isTopology(t){return Boolean(t&&t[o])}set registrar(t){this._registrar=t}disconnect(t){this._onDisconnect(t)}}module.exports=n;
|
||
},{}],"HNv/":[function(require,module,exports) {
|
||
"use strict";function e(e,o){return r(e)||n(e,o)||i(e,o)||t()}function t(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function n(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(c){o=!0,i=c}finally{try{r||null==u.return||u.return()}finally{if(o)throw i}}return n}}function r(e){if(Array.isArray(e))return e}function o(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=i(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,c=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return u=e.done,e},e:function(e){c=!0,a=e},f:function(){try{u||null==n.return||n.return()}finally{if(c)throw a}}}}function i(e,t){if(e){if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function l(e,t,n){return t&&c(e.prototype,t),n&&c(e,n),e}var s=require("debug"),f=Object.assign(s("libp2p:registrar"),{error:s("libp2p:registrar:err")}),y=require("err-code"),h=require("./errors"),p=h.codes.ERR_INVALID_PARAMETERS,g=require("libp2p-interfaces/src/topology"),d=function(){function t(e){var n=e.peerStore,r=e.connectionManager;u(this,t),this.peerStore=n,this.connectionManager=r,this.topologies=new Map,this._handle=void 0,this._onDisconnect=this._onDisconnect.bind(this),this.connectionManager.on("peer:disconnect",this._onDisconnect)}return l(t,[{key:"handle",get:function(){return this._handle},set:function(e){this._handle=e}},{key:"getConnection",value:function(e){return this.connectionManager.get(e)}},{key:"register",value:function(e){if(!g.isTopology(e))throw f.error("topology must be an instance of interfaces/topology"),y(new Error("topology must be an instance of interfaces/topology"),p);var t=(1e9*Math.random()).toString(36)+Date.now();return this.topologies.set(t,e),e.registrar=this,t}},{key:"unregister",value:function(e){return this.topologies.delete(e)}},{key:"_onDisconnect",value:function(t){var n,r=o(this.topologies);try{for(r.s();!(n=r.n()).done;){e(n.value,2)[1].disconnect(t.remotePeer)}}catch(i){r.e(i)}finally{r.f()}}}]),t}();module.exports=d;
|
||
},{"debug":"F8gk","err-code":"hLMW","./errors":"YLhd","libp2p-interfaces/src/topology":"7Jl7"}],"6Zoi":[function(require,module,exports) {
|
||
|
||
"use strict";const{Buffer:e}=require("buffer"),f=require("bl/BufferList");module.exports=async function*(i){for await(const o of i)e.isBuffer(o)?yield o:f.isBufferList(o)?yield o.slice():yield e.from(o)},module.exports.toBuffer=module.exports,module.exports.toList=async function*(i){for await(const o of i)e.isBuffer(o)?yield(new f).append(o):f.isBufferList(o)?yield o:yield(new f).append(e.from(o))};
|
||
},{"buffer":"z1tx","bl/BufferList":"s5uv"}],"zVAq":[function(require,module,exports) {
|
||
"use strict";module.exports={PROTOCOL:"/ipfs/ping/1.0.0",PING_LENGTH:32};
|
||
},{}],"8wvY":[function(require,module,exports) {
|
||
"use strict";function r(r,n){return i(r)||o(r,n)||t(r,n)||e()}function e(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function t(r,e){if(r){if("string"==typeof r)return n(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?n(r,e):void 0}}function n(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function o(r,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(r)){var t=[],n=!0,o=!1,i=void 0;try{for(var u,a=r[Symbol.iterator]();!(n=(u=a.next()).done)&&(t.push(u.value),!e||t.length!==e);n=!0);}catch(c){o=!0,i=c}finally{try{n||null==a.return||a.return()}finally{if(o)throw i}}return t}}function i(r){if(Array.isArray(r))return r}function u(r,e,t,n,o,i,u){try{var a=r[i](u),c=a.value}catch(s){return void t(s)}a.done?e(c):Promise.resolve(c).then(n,o)}function a(r){return function(){var e=this,t=arguments;return new Promise(function(n,o){var i=r.apply(e,t);function a(r){u(i,n,o,a,c,"next",r)}function c(r){u(i,n,o,a,c,"throw",r)}a(void 0)})}}var c=require("debug"),s=Object.assign(c("libp2p:ping"),{error:c("libp2p:ping:err")}),l=require("err-code"),f=require("libp2p-crypto"),p=require("it-pipe"),y=p.pipe,m=require("it-buffer"),d=m.toBuffer,v=require("streaming-iterables"),b=v.collect,h=v.take,g=require("uint8arrays/equals"),w=require("./constants"),x=w.PROTOCOL,q=w.PING_LENGTH;function S(r,e){return O.apply(this,arguments)}function O(){return(O=a(regeneratorRuntime.mark(function e(t,n){var o,i,u,a,c,p,m,v,w;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return s("dialing %s to %s",x,n.toB58String?n.toB58String():n),e.next=3,t.dial(n);case 3:return o=e.sent,e.next=6,o.newStream(x);case 6:return i=e.sent,u=i.stream,a=Date.now(),c=f.randomBytes(q),e.next=12,y([c],u,function(r){return h(1,r)},d,b);case 12:if(p=e.sent,m=r(p,1),v=m[0],w=Date.now(),g(c,v)){e.next=18;break}throw l(new Error("Received wrong ping ack"),"ERR_WRONG_PING_ACK");case 18:return e.abrupt("return",w-a);case 19:case"end":return e.stop()}},e)}))).apply(this,arguments)}function A(r){r.handle(x,function(r){var e=r.stream;return y(e,e)})}function R(r){r.unhandle(x)}exports=module.exports=S,exports.mount=A,exports.unmount=R;
|
||
},{"debug":"F8gk","err-code":"hLMW","libp2p-crypto":"Gcnt","it-pipe":"p27M","it-buffer":"6Zoi","streaming-iterables":"ieYp","uint8arrays/equals":"mZxc","./constants":"zVAq"}],"19Za":[function(require,module,exports) {
|
||
"use strict";var e=require("protobufjs/minimal"),r=e.Reader,o=e.Writer,t=e.util,s=e.roots.default||(e.roots.default={});s.Identify=function(){function n(e){if(this.listenAddrs=[],this.protocols=[],e)for(var r=Object.keys(e),o=0;o<r.length;++o)null!=e[r[o]]&&(this[r[o]]=e[r[o]])}return n.prototype.protocolVersion="",n.prototype.agentVersion="",n.prototype.publicKey=t.newBuffer([]),n.prototype.listenAddrs=t.emptyArray,n.prototype.observedAddr=t.newBuffer([]),n.prototype.protocols=t.emptyArray,n.prototype.signedPeerRecord=t.newBuffer([]),n.encode=function(e,r){if(r||(r=o.create()),null!=e.publicKey&&Object.hasOwnProperty.call(e,"publicKey")&&r.uint32(10).bytes(e.publicKey),null!=e.listenAddrs&&e.listenAddrs.length)for(var t=0;t<e.listenAddrs.length;++t)r.uint32(18).bytes(e.listenAddrs[t]);if(null!=e.protocols&&e.protocols.length)for(t=0;t<e.protocols.length;++t)r.uint32(26).string(e.protocols[t]);return null!=e.observedAddr&&Object.hasOwnProperty.call(e,"observedAddr")&&r.uint32(34).bytes(e.observedAddr),null!=e.protocolVersion&&Object.hasOwnProperty.call(e,"protocolVersion")&&r.uint32(42).string(e.protocolVersion),null!=e.agentVersion&&Object.hasOwnProperty.call(e,"agentVersion")&&r.uint32(50).string(e.agentVersion),null!=e.signedPeerRecord&&Object.hasOwnProperty.call(e,"signedPeerRecord")&&r.uint32(66).bytes(e.signedPeerRecord),r},n.decode=function(e,o){e instanceof r||(e=r.create(e));for(var t=void 0===o?e.len:e.pos+o,n=new s.Identify;e.pos<t;){var d=e.uint32();switch(d>>>3){case 5:n.protocolVersion=e.string();break;case 6:n.agentVersion=e.string();break;case 1:n.publicKey=e.bytes();break;case 2:n.listenAddrs&&n.listenAddrs.length||(n.listenAddrs=[]),n.listenAddrs.push(e.bytes());break;case 4:n.observedAddr=e.bytes();break;case 3:n.protocols&&n.protocols.length||(n.protocols=[]),n.protocols.push(e.string());break;case 8:n.signedPeerRecord=e.bytes();break;default:e.skipType(7&d)}}return n},n.fromObject=function(e){if(e instanceof s.Identify)return e;var r=new s.Identify;if(null!=e.protocolVersion&&(r.protocolVersion=String(e.protocolVersion)),null!=e.agentVersion&&(r.agentVersion=String(e.agentVersion)),null!=e.publicKey&&("string"==typeof e.publicKey?t.base64.decode(e.publicKey,r.publicKey=t.newBuffer(t.base64.length(e.publicKey)),0):e.publicKey.length&&(r.publicKey=e.publicKey)),e.listenAddrs){if(!Array.isArray(e.listenAddrs))throw TypeError(".Identify.listenAddrs: array expected");r.listenAddrs=[];for(var o=0;o<e.listenAddrs.length;++o)"string"==typeof e.listenAddrs[o]?t.base64.decode(e.listenAddrs[o],r.listenAddrs[o]=t.newBuffer(t.base64.length(e.listenAddrs[o])),0):e.listenAddrs[o].length&&(r.listenAddrs[o]=e.listenAddrs[o])}if(null!=e.observedAddr&&("string"==typeof e.observedAddr?t.base64.decode(e.observedAddr,r.observedAddr=t.newBuffer(t.base64.length(e.observedAddr)),0):e.observedAddr.length&&(r.observedAddr=e.observedAddr)),e.protocols){if(!Array.isArray(e.protocols))throw TypeError(".Identify.protocols: array expected");r.protocols=[];for(o=0;o<e.protocols.length;++o)r.protocols[o]=String(e.protocols[o])}return null!=e.signedPeerRecord&&("string"==typeof e.signedPeerRecord?t.base64.decode(e.signedPeerRecord,r.signedPeerRecord=t.newBuffer(t.base64.length(e.signedPeerRecord)),0):e.signedPeerRecord.length&&(r.signedPeerRecord=e.signedPeerRecord)),r},n.toObject=function(e,r){r||(r={});var o={};if((r.arrays||r.defaults)&&(o.listenAddrs=[],o.protocols=[]),r.defaults&&(r.bytes===String?o.publicKey="":(o.publicKey=[],r.bytes!==Array&&(o.publicKey=t.newBuffer(o.publicKey))),r.bytes===String?o.observedAddr="":(o.observedAddr=[],r.bytes!==Array&&(o.observedAddr=t.newBuffer(o.observedAddr))),o.protocolVersion="",o.agentVersion="",r.bytes===String?o.signedPeerRecord="":(o.signedPeerRecord=[],r.bytes!==Array&&(o.signedPeerRecord=t.newBuffer(o.signedPeerRecord)))),null!=e.publicKey&&e.hasOwnProperty("publicKey")&&(o.publicKey=r.bytes===String?t.base64.encode(e.publicKey,0,e.publicKey.length):r.bytes===Array?Array.prototype.slice.call(e.publicKey):e.publicKey),e.listenAddrs&&e.listenAddrs.length){o.listenAddrs=[];for(var s=0;s<e.listenAddrs.length;++s)o.listenAddrs[s]=r.bytes===String?t.base64.encode(e.listenAddrs[s],0,e.listenAddrs[s].length):r.bytes===Array?Array.prototype.slice.call(e.listenAddrs[s]):e.listenAddrs[s]}if(e.protocols&&e.protocols.length){o.protocols=[];for(s=0;s<e.protocols.length;++s)o.protocols[s]=e.protocols[s]}return null!=e.observedAddr&&e.hasOwnProperty("observedAddr")&&(o.observedAddr=r.bytes===String?t.base64.encode(e.observedAddr,0,e.observedAddr.length):r.bytes===Array?Array.prototype.slice.call(e.observedAddr):e.observedAddr),null!=e.protocolVersion&&e.hasOwnProperty("protocolVersion")&&(o.protocolVersion=e.protocolVersion),null!=e.agentVersion&&e.hasOwnProperty("agentVersion")&&(o.agentVersion=e.agentVersion),null!=e.signedPeerRecord&&e.hasOwnProperty("signedPeerRecord")&&(o.signedPeerRecord=r.bytes===String?t.base64.encode(e.signedPeerRecord,0,e.signedPeerRecord.length):r.bytes===Array?Array.prototype.slice.call(e.signedPeerRecord):e.signedPeerRecord),o},n.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},n}(),module.exports=s;
|
||
},{"protobufjs/minimal":"78bh"}],"q+oA":[function(require,module,exports) {
|
||
"use strict";function e(e,o){return n(e)||t(e,o)||i(e,o)||r()}function r(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function t(e,r){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var t=[],n=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(n=(a=s.next()).done)&&(t.push(a.value),!r||t.length!==r);n=!0);}catch(c){o=!0,i=c}finally{try{n||null==s.return||s.return()}finally{if(o)throw i}}return t}}function n(e){if(Array.isArray(e))return e}function o(e,r){var t;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(t=i(e))||r&&e&&"number"==typeof e.length){t&&(e=t);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,c=!1;return{s:function(){t=e[Symbol.iterator]()},n:function(){var e=t.next();return s=e.done,e},e:function(e){c=!0,a=e},f:function(){try{s||null==t.return||t.return()}finally{if(c)throw a}}}}function i(e,r){if(e){if("string"==typeof e)return a(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?a(e,r):void 0}}function a(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function s(e,r,t,n,o,i,a){try{var s=e[i](a),c=s.value}catch(u){return void t(u)}s.done?r(c):Promise.resolve(c).then(n,o)}function c(e){return function(){var r=this,t=arguments;return new Promise(function(n,o){var i=e.apply(r,t);function a(e){s(i,n,o,a,c,"next",e)}function c(e){s(i,n,o,a,c,"throw",e)}a(void 0)})}}function u(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}function d(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?u(Object(t),!0).forEach(function(r){p(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):u(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function p(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function l(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function f(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function h(e,r,t){return r&&f(e.prototype,r),t&&f(e,t),e}var v=require("debug"),y=Object.assign(v("libp2p:identify"),{error:v("libp2p:identify:err")}),b=require("err-code"),m=require("it-length-prefixed"),g=require("it-pipe"),S=g.pipe,w=require("streaming-iterables"),k=w.collect,I=w.take,O=w.consume,x=require("uint8arrays/from-string"),P=require("peer-id"),A=require("multiaddr"),R=A.Multiaddr,E=require("it-buffer"),_=E.toBuffer,j=require("./message"),M=require("../record/envelope"),B=require("../record/peer-record"),D=require("./consts"),q=D.MULTICODEC_IDENTIFY,N=D.MULTICODEC_IDENTIFY_PUSH,T=D.PROTOCOL_VERSION,V=require("../errors"),C=V.codes,U=function(){function r(e){var t=this,n=e.libp2p;l(this,r),this._libp2p=n,this.peerStore=n.peerStore,this.addressManager=n.addressManager,this.connectionManager=n.connectionManager,this.peerId=n.peerId,this.handleMessage=this.handleMessage.bind(this),this._host=d({protocolVersion:T},n._options.host),this.peerStore.metadataBook.set(this.peerId,"AgentVersion",x(this._host.agentVersion)),this.peerStore.metadataBook.set(this.peerId,"ProtocolVersion",x(this._host.protocolVersion)),this.connectionManager.on("peer:connect",function(e){t.identify(e).catch(y.error)}),this.peerStore.on("change:multiaddrs",function(e){e.peerId.toString()===t.peerId.toString()&&t.pushToPeerStore()}),this.peerStore.on("change:protocols",function(e){e.peerId.toString()===t.peerId.toString()&&t.pushToPeerStore()})}return h(r,[{key:"push",value:function(){var e=c(regeneratorRuntime.mark(function e(r){var t,n,o,i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.peerStore.addressBook.getRawEnvelope(this.peerId);case 2:return t=e.sent,n=this._libp2p.multiaddrs.map(function(e){return e.bytes}),o=this.peerStore.protoBook.get(this.peerId)||[],i=r.map(function(){var e=c(regeneratorRuntime.mark(function e(r){var i,a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,r.newStream(N);case 3:return i=e.sent,a=i.stream,e.next=7,S([j.Identify.encode({listenAddrs:n,signedPeerRecord:t,protocols:o}).finish()],m.encode(),a,O);case 7:e.next=12;break;case 9:e.prev=9,e.t0=e.catch(0),y.error("could not push identify update to peer",e.t0);case 12:case"end":return e.stop()}},e,null,[[0,9]])}));return function(r){return e.apply(this,arguments)}}()),e.abrupt("return",Promise.all(i));case 7:case"end":return e.stop()}},e,this)}));return function(r){return e.apply(this,arguments)}}()},{key:"pushToPeerStore",value:function(){if(this._libp2p.isStarted()){var e,r,t=[],n=o(this.peerStore.peers.values());try{for(n.s();!(r=n.n()).done;){var i=r.value;i.protocols.includes(N)&&(e=this.connectionManager.get(i.id))&&t.push(e)}}catch(a){n.e(a)}finally{n.f()}this.push(t)}}},{key:"identify",value:function(){var t=c(regeneratorRuntime.mark(function t(n){var o,i,a,s,c,u,d,p,l,f,h,v,g,w,O;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.newStream(q);case 2:return o=t.sent,i=o.stream,t.next=6,S([],i,m.decode(),I(1),_,k);case 6:if(a=t.sent,s=e(a,1),c=s[0]){t.next=11;break}throw b(new Error("No data could be retrieved"),C.ERR_CONNECTION_ENDED);case 11:t.prev=11,u=j.Identify.decode(c),t.next=18;break;case 15:throw t.prev=15,t.t0=t.catch(11),b(t.t0,C.ERR_INVALID_MESSAGE);case 18:return p=(d=u).publicKey,l=d.listenAddrs,f=d.protocols,h=d.observedAddr,v=d.signedPeerRecord,t.next=21,P.createFromPubKey(p);case 21:if(g=t.sent,n.remotePeer.toB58String()===g.toB58String()){t.next=24;break}throw b(new Error("identified peer does not match the expected peer"),C.ERR_INVALID_PEER);case 24:return w=r.getCleanMultiaddr(h),t.prev=25,t.next=28,M.openAndCertify(v,B.DOMAIN);case 28:if(O=t.sent,!this.peerStore.addressBook.consumePeerRecord(O)){t.next=32;break}return this.peerStore.protoBook.set(g,f),t.abrupt("return");case 32:t.next=37;break;case 34:t.prev=34,t.t1=t.catch(25),y("received invalid envelope, discard it and fallback to listenAddrs is available",t.t1);case 37:try{this.peerStore.addressBook.set(g,l.map(function(e){return new R(e)}))}catch(A){y.error("received invalid addrs",A)}this.peerStore.protoBook.set(g,f),this.peerStore.metadataBook.set(g,"AgentVersion",x(u.agentVersion)),y("received observed address of %s",w);case 41:case"end":return t.stop()}},t,this,[[11,15],[25,34]])}));return function(e){return t.apply(this,arguments)}}()},{key:"handleMessage",value:function(e){var r=e.connection,t=e.stream,n=e.protocol;switch(n){case q:return this._handleIdentify({connection:r,stream:t});case N:return this._handlePush({connection:r,stream:t});default:y.error("cannot handle unknown protocol %s",n)}}},{key:"_handleIdentify",value:function(){var e=c(regeneratorRuntime.mark(function e(r){var t,n,o,i,a,s;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.connection,n=r.stream,o=new Uint8Array(0),this.peerId.pubKey&&(o=this.peerId.pubKey.bytes),e.next=5,this.peerStore.addressBook.getRawEnvelope(this.peerId);case 5:return i=e.sent,a=this.peerStore.protoBook.get(this.peerId)||[],s=j.Identify.encode({protocolVersion:this._host.protocolVersion,agentVersion:this._host.agentVersion,publicKey:o,listenAddrs:this._libp2p.multiaddrs.map(function(e){return e.bytes}),signedPeerRecord:i,observedAddr:t.remoteAddr.bytes,protocols:a}).finish(),e.prev=8,e.next=11,S([s],m.encode(),n,O);case 11:e.next=16;break;case 13:e.prev=13,e.t0=e.catch(8),y.error("could not respond to identify request",e.t0);case 16:case"end":return e.stop()}},e,this,[[8,13]])}));return function(r){return e.apply(this,arguments)}}()},{key:"_handlePush",value:function(){var r=c(regeneratorRuntime.mark(function r(t){var n,o,i,a,s,c,u,d;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return n=t.connection,o=t.stream,r.prev=1,r.next=4,S([],o,m.decode(),I(1),_,k);case 4:a=r.sent,s=e(a,1),c=s[0],i=j.Identify.decode(c),r.next=13;break;case 10:return r.prev=10,r.t0=r.catch(1),r.abrupt("return",y.error("received invalid message",r.t0));case 13:return u=n.remotePeer,r.prev=14,r.next=17,M.openAndCertify(i.signedPeerRecord,B.DOMAIN);case 17:if(d=r.sent,!this.peerStore.addressBook.consumePeerRecord(d)){r.next=21;break}return this.peerStore.protoBook.set(u,i.protocols),r.abrupt("return");case 21:r.next=26;break;case 23:r.prev=23,r.t1=r.catch(14),y("received invalid envelope, discard it and fallback to listenAddrs is available",r.t1);case 26:try{this.peerStore.addressBook.set(u,i.listenAddrs.map(function(e){return new R(e)}))}catch(p){y.error("received invalid addrs",p)}this.peerStore.protoBook.set(u,i.protocols);case 28:case"end":return r.stop()}},r,this,[[1,10],[14,23]])}));return function(e){return r.apply(this,arguments)}}()}],[{key:"getCleanMultiaddr",value:function(e){if(e&&e.length>0)try{return new R(e)}catch(r){return null}return null}}]),r}(),F={IDENTIFY:q,IDENTIFY_PUSH:N};U.multicodecs=F,U.Messsage=j,module.exports=U;
|
||
},{"debug":"F8gk","err-code":"hLMW","it-length-prefixed":"5Mnk","it-pipe":"p27M","streaming-iterables":"ieYp","uint8arrays/from-string":"YqS+","peer-id":"jAbp","multiaddr":"fVn4","it-buffer":"6Zoi","./message":"19Za","../record/envelope":"59KL","../record/peer-record":"ry3y","./consts":"erSH","../errors":"YLhd"}],"IDaG":[function(require,module,exports) {
|
||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.promisify=e;var r="__ES6-PROMISIFY--CUSTOM-ARGUMENTS__";function e(n){if("function"!=typeof n)throw new TypeError("Argument to promisify must be a function");var o=n[r],t=e.Promise||Promise;if("function"!=typeof t)throw new Error("No Promise implementation found; do you need a polyfill?");return function(){for(var r=this,e=arguments.length,i=new Array(e),f=0;f<e;f++)i[f]=arguments[f];return new t(function(e,t){i.push(function(r){if(r)return t(r);for(var n=arguments.length,i=new Array(n>1?n-1:0),f=1;f<n;f++)i[f-1]=arguments[f];if(1===i.length||!o)return e(i[0]);var u={};i.forEach(function(r,e){var n=o[e];n&&(u[n]=r)}),e(u)}),n.apply(r,i)})}}e.argumentNames=r,e.Promise=void 0;
|
||
},{}],"R/n7":[function(require,module,exports) {
|
||
var process = require("process");
|
||
var e=require("process");function o(){return"undefined"!=typeof window&&"object"==typeof window.process&&"renderer"===window.process.type||(!(void 0===e||"object"!=typeof e.versions||!e.versions.electron)||"object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent.indexOf("Electron")>=0)}module.exports=o;
|
||
},{"process":"g5I+"}],"vr58":[function(require,module,exports) {
|
||
var process = require("process");
|
||
var e=require("process");const o=require("is-electron"),r="object"==typeof window&&"object"==typeof document&&9===document.nodeType,i=o(),n=r&&!i,t=i&&!r,s=i&&r,c="function"==typeof require&&void 0!==e&&void 0!==e.release&&"node"===e.release.name&&!i,d="function"==typeof importScripts&&"undefined"!=typeof self&&"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,f=void 0!==e&&void 0!==e.env&&!0;module.exports={isTest:f,isElectron:i,isElectronMain:t,isElectronRenderer:s,isNode:c,isBrowser:n,isWebWorker:d,isEnvWithDom:r};
|
||
},{"is-electron":"R/n7","process":"g5I+"}],"K05F":[function(require,module,exports) {
|
||
function t(t,e){"boolean"==typeof e&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(t)),this._timeouts=t,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}module.exports=t,t.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts},t.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null},t.prototype.retry=function(t){if(this._timeout&&clearTimeout(this._timeout),!t)return!1;var e=(new Date).getTime();if(t&&e-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(t);var i=this._timeouts.shift();if(void 0===i){if(!this._cachedTimeouts)return!1;this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),i=this._timeouts.shift()}var o=this,r=setTimeout(function(){o._attempts++,o._operationTimeoutCb&&(o._timeout=setTimeout(function(){o._operationTimeoutCb(o._attempts)},o._operationTimeout),o._options.unref&&o._timeout.unref()),o._fn(o._attempts)},i);return this._options.unref&&r.unref(),!0},t.prototype.attempt=function(t,e){this._fn=t,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var i=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){i._operationTimeoutCb()},i._operationTimeout)),this._operationStart=(new Date).getTime(),this._fn(this._attempts)},t.prototype.try=function(t){console.log("Using RetryOperation.try() is deprecated"),this.attempt(t)},t.prototype.start=function(t){console.log("Using RetryOperation.start() is deprecated"),this.attempt(t)},t.prototype.start=t.prototype.try,t.prototype.errors=function(){return this._errors},t.prototype.attempts=function(){return this._attempts},t.prototype.mainError=function(){if(0===this._errors.length)return null;for(var t={},e=null,i=0,o=0;o<this._errors.length;o++){var r=this._errors[o],s=r.message,n=(t[s]||0)+1;t[s]=n,n>=i&&(e=r,i=n)}return e};
|
||
},{}],"hZ1K":[function(require,module,exports) {
|
||
var r=require("./retry_operation");exports.operation=function(t){var e=exports.timeouts(t);return new r(e,{forever:t&&t.forever,unref:t&&t.unref,maxRetryTime:t&&t.maxRetryTime})},exports.timeouts=function(r){if(r instanceof Array)return[].concat(r);var t={retries:10,factor:2,minTimeout:1e3,maxTimeout:1/0,randomize:!1};for(var e in r)t[e]=r[e];if(t.minTimeout>t.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var o=[],n=0;n<t.retries;n++)o.push(this.createTimeout(n,t));return r&&r.forever&&!o.length&&o.push(this.createTimeout(n,t)),o.sort(function(r,t){return r-t}),o},exports.createTimeout=function(r,t){var e=t.randomize?Math.random()+1:1,o=Math.round(e*t.minTimeout*Math.pow(t.factor,r));return o=Math.min(o,t.maxTimeout)},exports.wrap=function(r,t,e){if(t instanceof Array&&(e=t,t=null),!e)for(var o in e=[],r)"function"==typeof r[o]&&e.push(o);for(var n=0;n<e.length;n++){var i=e[n],a=r[i];r[i]=function(e){var o=exports.operation(t),n=Array.prototype.slice.call(arguments,1),i=n.pop();n.push(function(r){o.retry(r)||(r&&(arguments[0]=o.mainError()),i.apply(this,arguments))}),o.attempt(function(){e.apply(r,n)})}.bind(r,a),r[i].options=t}};
|
||
},{"./retry_operation":"K05F"}],"KGg6":[function(require,module,exports) {
|
||
module.exports=require("./lib/retry");
|
||
},{"./lib/retry":"hZ1K"}],"BsVX":[function(require,module,exports) {
|
||
"use strict";function t(t,r,e,n,o,u,c){try{var i=t[u](c),a=i.value}catch(f){return void e(f)}i.done?r(a):Promise.resolve(a).then(n,o)}function r(r){return function(){var e=this,n=arguments;return new Promise(function(o,u){var c=r.apply(e,n);function i(r){t(c,o,u,i,a,"next",r)}function a(r){t(c,o,u,i,a,"throw",r)}i(void 0)})}}function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function n(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function o(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),r&&l(t,r)}function u(t){var r=s();return function(){var e,n=y(t);if(r){var o=y(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return c(this,e)}}function c(t,r){return!r||"object"!==e(r)&&"function"!=typeof r?i(t):r}function i(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function a(t){var r="function"==typeof Map?new Map:void 0;return(a=function(t){if(null===t||!p(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,e)}function e(){return f(t,arguments,y(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),l(e,t)})(t)}function f(t,r,e){return(f=s()?Reflect.construct:function(t,r,e){var n=[null];n.push.apply(n,r);var o=new(Function.bind.apply(t,n));return e&&l(o,e.prototype),o}).apply(null,arguments)}function s(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}function p(t){return-1!==Function.toString.call(t).indexOf("[native code]")}function l(t,r){return(l=Object.setPrototypeOf||function(t,r){return t.__proto__=r,t})(t,r)}function y(t){return(y=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var b=require("retry"),h=["Failed to fetch","NetworkError when attempting to fetch resource","The Internet connection appears to be offline","Network request failed"],m=function(t){o(e,a(Error));var r=u(e);function e(t){var o;(n(this,e),o=r.call(this),t instanceof Error)?(o.originalError=t,t=t.message):(o.originalError=new Error(t),o.originalError.stack=o.stack);return o.name="AbortError",o.message=t,o}return e}(),v=function(t,r,e){var n=e.retries-(r-1);return t.attemptNumber=r,t.retriesLeft=n,t},w=function(t){return h.includes(t)},d=function(t,e){return new Promise(function(n,o){e={onFailedAttempt:function(){},retries:10,...e};var u=b.operation(e);u.attempt(function(){var c=r(regeneratorRuntime.mark(function r(c){return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.t0=n,r.next=4,t(c);case 4:r.t1=r.sent,(0,r.t0)(r.t1),r.next=34;break;case 8:if(r.prev=8,r.t2=r.catch(0),r.t2 instanceof Error){r.next=13;break}return o(new TypeError('Non-error was thrown: "'.concat(r.t2,'". You should only throw errors.'))),r.abrupt("return");case 13:if(!(r.t2 instanceof m)){r.next=18;break}u.stop(),o(r.t2.originalError),r.next=34;break;case 18:if(!(r.t2 instanceof TypeError)||w(r.t2.message)){r.next=23;break}u.stop(),o(r.t2),r.next=34;break;case 23:return v(r.t2,c,e),r.prev=24,r.next=27,e.onFailedAttempt(r.t2);case 27:r.next=33;break;case 29:return r.prev=29,r.t3=r.catch(24),o(r.t3),r.abrupt("return");case 33:u.retry(r.t2)||o(u.mainError());case 34:case"end":return r.stop()}},r,null,[[0,8],[24,29]])}));return function(t){return c.apply(this,arguments)}}())})};module.exports=d,module.exports.default=d,module.exports.AbortError=m;
|
||
},{"retry":"KGg6"}],"j9hw":[function(require,module,exports) {
|
||
"use strict";function t(t){return/^127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(t)||/^::1$/.test(t)}module.exports=t;
|
||
},{}],"QMyw":[function(require,module,exports) {
|
||
"use strict";const s=require("is-loopback-addr");function e(e){const{address:r}=e.nodeAddress();return s(r)}module.exports=e;
|
||
},{"is-loopback-addr":"j9hw"}],"c4xF":[function(require,module,exports) {
|
||
"use strict";function e(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=r(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var a=0,o=function(){};return{s:o,n:function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return u=e.done,e},e:function(e){s=!0,i=e},f:function(){try{u||null==n.return||n.return()}finally{if(s)throw i}}}}function r(e,r){if(e){if("string"==typeof e)return t(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(e,r):void 0}}function t(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function n(e,r,t,n,a,o,i){try{var u=e[o](i),s=u.value}catch(c){return void t(c)}u.done?r(s):Promise.resolve(s).then(n,a)}function a(e){return function(){var r=this,t=arguments;return new Promise(function(a,o){var i=e.apply(r,t);function u(e){n(i,a,o,u,s,"next",e)}function s(e){n(i,a,o,u,s,"throw",e)}u(void 0)})}}function o(e,r){if(null==e)return{};var t,n,a=i(e,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)t=o[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}function i(e,r){if(null==e)return{};var t,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)t=o[n],r.indexOf(t)>=0||(a[t]=e[t]);return a}function u(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function s(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function c(e,r,t){return r&&s(e.prototype,r),t&&s(e,t),e}var l=require("@motrix/nat-api"),p=require("debug"),f=require("es6-promisify"),d=f.promisify,h=require("multiaddr"),v=h.Multiaddr,b=Object.assign(p("libp2p:nat"),{error:p("libp2p:nat:err")}),y=require("ipfs-utils/src/env"),m=y.isBrowser,g=require("p-retry"),x=require("private-ip"),w=require("../package.json"),_=require("err-code"),k=require("./errors"),A=k.codes.ERR_INVALID_PARAMETERS,I=require("libp2p-utils/src/multiaddr/is-loopback"),M=7200;function O(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1024,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:65535;return Math.floor(Math.random()*(r-e+1)+e)}var P=function(){function r(e){var t=e.peerId,n=e.addressManager,a=e.transportManager,i=o(e,["peerId","addressManager","transportManager"]);if(u(this,r),this._peerId=t,this._addressManager=n,this._transportManager=a,this._enabled=i.enabled,this._externalIp=i.externalIp,this._options={description:i.description||"".concat(w.name,"@").concat(w.version," ").concat(this._peerId),ttl:i.ttl||M,autoUpdate:i.keepAlive||!0,gateway:i.gateway,enablePMP:Boolean(i.pmp&&i.pmp.enabled)},this._options.ttl<M)throw _(new Error("NatManager ttl should be at least ".concat(M," seconds")),A)}return c(r,[{key:"start",value:function(){!m&&this._enabled&&this._start().catch(function(e){b.error(e)})}},{key:"_start",value:function(){var r=a(regeneratorRuntime.mark(function r(){var t,n,a,o,i,u,s,c,l,p,f,d;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:t=this._transportManager.getAddrs(),n=e(t),r.prev=2,n.s();case 4:if((a=n.n()).done){r.next=29;break}if(o=a.value,i=o.toOptions(),u=i.family,s=i.host,c=i.port,l=i.transport,o.isThinWaistAddress()&&"tcp"===l){r.next=9;break}return r.abrupt("continue",27);case 9:if(!I(o)){r.next=11;break}return r.abrupt("continue",27);case 11:if(4===u){r.next=13;break}return r.abrupt("continue",27);case 13:if(p=this._getClient(),r.t0=this._externalIp,r.t0){r.next=19;break}return r.next=18,p.externalIp();case 18:r.t0=r.sent;case 19:if(f=r.t0,!x(f)){r.next=22;break}throw new Error("".concat(f," is private - please set config.nat.externalIp to an externally routable IP or ensure you are not behind a double NAT"));case 22:return d=O(),b("opening uPnP connection from ".concat(f,":").concat(d," to ").concat(s,":").concat(c)),r.next=26,p.map({publicPort:d,privatePort:c,protocol:l.toUpperCase()});case 26:this._addressManager.addObservedAddr(v.fromNodeAddress({family:4,address:f,port:d},l));case 27:r.next=4;break;case 29:r.next=34;break;case 31:r.prev=31,r.t1=r.catch(2),n.e(r.t1);case 34:return r.prev=34,n.f(),r.finish(34);case 37:case"end":return r.stop()}},r,this,[[2,31,34,37]])}));return function(){return r.apply(this,arguments)}}()},{key:"_getClient",value:function(){if(this._client)return this._client;var e=new l(this._options),r=d(e.map.bind(e)),t=d(e.destroy.bind(e)),n=d(e.externalIp.bind(e));return this._client={map:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return g(function(){return r.apply(void 0,t)},{onFailedAttempt:b.error,unref:!0})},destroy:function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return g(function(){return t.apply(void 0,r)},{onFailedAttempt:b.error,unref:!0})},externalIp:function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];return g(function(){return n.apply(void 0,r)},{onFailedAttempt:b.error,unref:!0})}},this._client}},{key:"stop",value:function(){var e=a(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!m&&this._client){e.next=2;break}return e.abrupt("return");case 2:return e.prev=2,e.next=5,this._client.destroy();case 5:this._client=null,e.next=11;break;case 8:e.prev=8,e.t0=e.catch(2),b.error(e.t0);case 11:case"end":return e.stop()}},e,this,[[2,8]])}));return function(){return e.apply(this,arguments)}}()}]),r}();module.exports=P;
|
||
},{"@motrix/nat-api":"sC8V","debug":"F8gk","es6-promisify":"IDaG","multiaddr":"fVn4","ipfs-utils/src/env":"vr58","p-retry":"BsVX","private-ip":"FImH","../package.json":"J38Q","err-code":"hLMW","./errors":"YLhd","libp2p-utils/src/multiaddr/is-loopback":"QMyw"}],"6NlG":[function(require,module,exports) {
|
||
"use strict";function e(r){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(r)}function r(e,r){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=t(e))||r&&e&&"number"==typeof e.length){n&&(e=n);var o=0,i=function(){};return{s:i,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,c=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return s=e.done,e},e:function(e){c=!0,a=e},f:function(){try{s||null==n.return||n.return()}finally{if(c)throw a}}}}function t(e,r){if(e){if("string"==typeof e)return n(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?n(e,r):void 0}}function n(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function o(e,r,t,n,o,i,a){try{var s=e[i](a),c=s.value}catch(u){return void t(u)}s.done?r(c):Promise.resolve(c).then(n,o)}function i(e){return function(){var r=this,t=arguments;return new Promise(function(n,i){var a=e.apply(r,t);function s(e){o(a,n,i,s,c,"next",e)}function c(e){o(a,n,i,s,c,"throw",e)}s(void 0)})}}function a(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}function s(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?a(Object(t),!0).forEach(function(r){c(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function c(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function u(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function p(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function f(e,r,t){return r&&p(e.prototype,r),t&&p(e,t),e}function l(e,r,t){return(l="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,r,t){var n=d(e,r);if(n){var o=Object.getOwnPropertyDescriptor(n,r);return o.get?o.get.call(t):o.value}})(e,r,t||e)}function d(e,r){for(;!Object.prototype.hasOwnProperty.call(e,r)&&null!==(e=_(e)););return e}function h(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),r&&g(e,r)}function g(e,r){return(g=Object.setPrototypeOf||function(e,r){return e.__proto__=r,e})(e,r)}function y(e){var r=b();return function(){var t,n=_(e);if(r){var o=_(this).constructor;t=Reflect.construct(n,arguments,o)}else t=n.apply(this,arguments);return v(this,t)}}function v(r,t){return!t||"object"!==e(t)&&"function"!=typeof t?m(r):t}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function b(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function _(e){return(_=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var w=require("debug"),k=Object.assign(w("libp2p"),{error:w("libp2p:err")}),S=require("events"),x=require("err-code"),R=require("peer-id"),O=require("multiaddr"),M=O.Multiaddr,P=require("./peer-routing"),E=require("./content-routing"),D=require("./get-peer"),I=require("./config"),q=I.validate,j=require("./errors"),A=j.codes,T=j.messages,C=require("./address-manager"),B=require("./connection-manager"),N=require("./circuit/transport"),L=require("./circuit"),F=require("./dialer"),U=require("./keychain"),K=require("./metrics"),Q=require("./transport-manager"),Y=require("./upgrader"),z=require("./peer-store"),V=require("./pubsub-adapter"),$=require("./peer-store/persistent"),G=require("./registrar"),H=require("./ping"),J=require("./identify"),W=J.multicodecs,X=require("./nat-manager"),Z=require("./record/utils"),ee=Z.updateSelfPeerRecord,re=function(e){h(n,S);var t=y(n);function n(e){var r;if(u(this,n),(r=t.call(this))._options=q(e),r.peerId=r._options.peerId,r.datastore=r._options.datastore,r.peerStore=r.datastore&&r._options.peerStore.persistence?new $(s({peerId:r.peerId,datastore:r.datastore},r._options.peerStore)):new z({peerId:r.peerId}),r.addresses=r._options.addresses,r.addressManager=new C(r.peerId,r._options.addresses),r.addressManager.on("change:addresses",function(){ee(m(r)).catch(function(e){k.error("Error updating self peer record",e)})}),r._modules=r._options.modules,r._config=r._options.config,r._transport=[],r._discovery=new Map,r.connectionManager=new B(m(r),s({autoDial:r._config.peerDiscovery.autoDial},r._options.connectionManager)),r._options.metrics.enabled&&(r.metrics=new K(s(s({},r._options.metrics),{},{connectionManager:r.connectionManager}))),r._options.keychain&&r._options.keychain.datastore){k("creating keychain");var o=U.generateOptions();r.keychain=new U(r._options.keychain.datastore,s(s({},o),r._options.keychain)),k("keychain constructed")}if(r.upgrader=new Y({localPeer:r.peerId,metrics:r.metrics,onConnection:function(e){return r.connectionManager.onConnect(e)},onConnectionEnd:function(e){return r.connectionManager.onDisconnect(e)}}),r.transportManager=new Q({libp2p:m(r),upgrader:r.upgrader,faultTolerance:r._options.transportManager.faultTolerance}),r.natManager=new X(s({peerId:r.peerId,addressManager:r.addressManager,transportManager:r.transportManager},r._options.config.nat)),r.registrar=new G({peerStore:r.peerStore,connectionManager:r.connectionManager}),r.handle=r.handle.bind(m(r)),r.registrar.handle=r.handle,!r._modules.connEncryption||!r._modules.connEncryption.length)throw x(new Error(T.CONN_ENCRYPTION_REQUIRED),A.CONN_ENCRYPTION_REQUIRED);(r._modules.connEncryption.forEach(function(e){r.upgrader.cryptos.set(e.protocol,e)}),r.dialer=new F(s({transportManager:r.transportManager,peerStore:r.peerStore},r._options.dialer)),r._modules.transport.forEach(function(e){var t=e.prototype[Symbol.toStringTag],n=r._config.transport[t];r.transportManager.add(t,e,n)}),r._config.relay.enabled&&(r.transportManager.add(N.prototype[Symbol.toStringTag],N),r.relay=new L(m(r))),r._modules.streamMuxer)&&(r._modules.streamMuxer.forEach(function(e){r.upgrader.muxers.set(e.multicodec,e)}),r.identifyService=new J({libp2p:m(r)}),r.handle(Object.values(W),r.identifyService.handleMessage));if(r._modules.connProtector)r.upgrader.protector=r._modules.connProtector;else if(void 0!==globalThis.process&&globalThis.process.env&&globalThis.process.env.LIBP2P_FORCE_PNET)throw new Error("Private network is enforced, but no protector was provided");if(r._modules.dht){var i=r._modules.dht;r._dht=new i(s({libp2p:m(r),dialer:r.dialer,peerId:r.peerId,peerStore:r.peerStore,registrar:r.registrar,datastore:r.datastore},r._config.dht))}if(r._modules.pubsub){var a=r._modules.pubsub;r.pubsub=V(a,m(r),r._config.pubsub)}return r.peerRouting=new P(m(r)),r.contentRouting=new E(m(r)),H.mount(m(r)),r._onDiscoveryPeer=r._onDiscoveryPeer.bind(m(r)),r}return f(n,[{key:"emit",value:function(e){for(var r=arguments.length,t=new Array(r>1?r-1:0),o=1;o<r;o++)t[o-1]=arguments[o];var i;return"error"!==e||this._events.error?(i=l(_(n.prototype),"emit",this)).call.apply(i,[this,e].concat(t)):(k.error(t),!1)}},{key:"start",value:function(){var e=i(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return k("libp2p is starting"),e.prev=1,e.next=4,this._onStarting();case 4:return e.next=6,this._onDidStart();case 6:k("libp2p has started"),e.next=16;break;case 9:return e.prev=9,e.t0=e.catch(1),this.emit("error",e.t0),k.error("An error occurred starting libp2p",e.t0),e.next=15,this.stop();case 15:throw e.t0;case 16:case"end":return e.stop()}},e,this,[[1,9]])}));return function(){return e.apply(this,arguments)}}()},{key:"stop",value:function(){var e=i(regeneratorRuntime.mark(function e(){var t,n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:k("libp2p is stopping"),e.prev=1,this._isStarted=!1,this.relay&&this.relay.stop(),this.peerRouting.stop(),t=r(this._discovery.values());try{for(t.s();!(n=t.n()).done;)n.value.removeListener("peer",this._onDiscoveryPeer)}catch(o){t.e(o)}finally{t.f()}return e.next=9,Promise.all(Array.from(this._discovery.values(),function(e){return e.stop()}));case 9:return this._discovery=new Map,e.next=12,this.peerStore.stop();case 12:return e.next=14,this.connectionManager.stop();case 14:return e.next=16,Promise.all([this.pubsub&&this.pubsub.stop(),this._dht&&this._dht.stop(),this.metrics&&this.metrics.stop()]);case 16:return e.next=18,this.natManager.stop();case 18:return e.next=20,this.transportManager.close();case 20:H.unmount(this),this.dialer.destroy(),e.next=27;break;case 24:e.prev=24,e.t0=e.catch(1),e.t0&&(k.error(e.t0),this.emit("error",e.t0));case 27:k("libp2p has stopped");case 28:case"end":return e.stop()}},e,this,[[1,24]])}));return function(){return e.apply(this,arguments)}}()},{key:"loadKeychain",value:function(){var e=i(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.keychain){e.next=2;break}return e.abrupt("return");case 2:return e.prev=2,e.next=5,this.keychain.findKeyByName("self");case 5:e.next=11;break;case 7:return e.prev=7,e.t0=e.catch(2),e.next=11,this.keychain.importPeer("self",this.peerId);case 11:case"end":return e.stop()}},e,this,[[2,7]])}));return function(){return e.apply(this,arguments)}}()},{key:"isStarted",value:function(){return this._isStarted}},{key:"connections",get:function(){return this.connectionManager.connections}},{key:"dial",value:function(e,r){return this._dial(e,r)}},{key:"dialProtocol",value:function(){var e=i(regeneratorRuntime.mark(function e(r,t,n){var o;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._dial(r,n);case 2:if(o=e.sent,!t||!t.length){e.next=5;break}return e.abrupt("return",o.newStream(t));case 5:return e.abrupt("return",o);case 6:case"end":return e.stop()}},e,this)}));return function(r,t,n){return e.apply(this,arguments)}}()},{key:"_dial",value:function(){var e=i(regeneratorRuntime.mark(function e(r,t){var n,o,i,a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=D(r),o=n.id,i=n.multiaddrs,!o.equals(this.peerId)){e.next=3;break}throw x(new Error("Cannot dial self"),A.ERR_DIALED_SELF);case 3:if(a=this.connectionManager.get(o)){e.next=10;break}return e.next=7,this.dialer.connectToPeer(r,t);case 7:a=e.sent,e.next=11;break;case 10:i&&this.peerStore.addressBook.add(o,i);case 11:return e.abrupt("return",a);case 12:case"end":return e.stop()}},e,this)}));return function(r,t){return e.apply(this,arguments)}}()},{key:"multiaddrs",get:function(){var e=this.addressManager.getAnnounceAddrs().map(function(e){return e.toString()});e.length||(e=this.transportManager.getAddrs().map(function(e){return e.toString()})),e=e.concat(this.addressManager.getObservedAddrs().map(function(e){return e.toString()}));var r=this._options.addresses.announceFilter,t=new Set(e);return r(Array.from(t).map(function(e){return new M(e)}))}},{key:"hangUp",value:function(){var e=i(regeneratorRuntime.mark(function e(r){var t,n,o;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=D(r),n=t.id,o=this.connectionManager.connections.get(n.toB58String())){e.next=4;break}return e.abrupt("return");case 4:return e.next=6,Promise.all(o.map(function(e){return e.close()}));case 6:case"end":return e.stop()}},e,this)}));return function(r){return e.apply(this,arguments)}}()},{key:"ping",value:function(e){var r=D(e),t=r.id,n=r.multiaddrs;return H(this,n?n[0]:t)}},{key:"handle",value:function(e,r){var t=this;(e=Array.isArray(e)?e:[e]).forEach(function(e){t.upgrader.protocols.set(e,r)}),this.peerStore.protoBook.add(this.peerId,e)}},{key:"unhandle",value:function(e){var r=this;(e=Array.isArray(e)?e:[e]).forEach(function(e){r.upgrader.protocols.delete(e)}),this.peerStore.protoBook.remove(this.peerId,e)}},{key:"_onStarting",value:function(){var e=i(regeneratorRuntime.mark(function e(){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=this.addressManager.getListenAddrs(),e.next=3,this.transportManager.listen(r);case 3:return this.natManager.start(),e.next=6,this.peerStore.start();case 6:this._config.pubsub.enabled&&this.pubsub&&this.pubsub.start(),this._config.dht.enabled&&(this._dht&&this._dht.start(),this._dht.on("peer",this._onDiscoveryPeer)),this.metrics&&this.metrics.start();case 9:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"_onDidStart",value:function(){var e=i(regeneratorRuntime.mark(function e(){var t,n,o,i=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this._isStarted=!0,this.peerStore.on("peer",function(e){i.emit("peer:discovery",e),i._maybeConnect(e)}),t=r(this.peerStore.peers.values());try{for(t.s();!(n=t.n()).done;)o=n.value,this.emit("peer:discovery",o.id)}catch(a){t.e(a)}finally{t.f()}return this.connectionManager.start(),e.next=7,this._setupPeerDiscovery();case 7:this.relay&&this.relay.start(),this.peerRouting.start();case 9:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"_onDiscoveryPeer",value:function(e){e.id.toB58String()!==this.peerId.toB58String()?(e.multiaddrs&&this.peerStore.addressBook.add(e.id,e.multiaddrs),e.protocols&&this.peerStore.protoBook.set(e.id,e.protocols)):k.error(new Error(A.ERR_DISCOVERED_SELF))}},{key:"_maybeConnect",value:function(){var e=i(regeneratorRuntime.mark(function e(r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!0!==this._config.peerDiscovery.autoDial||this.connectionManager.get(r)){e.next=12;break}if(!((this._options.connectionManager.minConnections||0)>this.connectionManager.size)){e.next=12;break}return k("connecting to discovered peer %s",r.toB58String()),e.prev=4,e.next=7,this.dialer.connectToPeer(r);case 7:e.next=12;break;case 9:e.prev=9,e.t0=e.catch(4),k.error("could not connect to discovered peer",e.t0);case 12:case"end":return e.stop()}},e,this,[[4,9]])}));return function(r){return e.apply(this,arguments)}}()},{key:"_setupPeerDiscovery",value:function(){var e=i(regeneratorRuntime.mark(function e(){var t,n,o,i,a,c,u,p=this;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=function(e){var r,t={enabled:!0};(e.tag&&p._config.peerDiscovery&&p._config.peerDiscovery[e.tag]&&(t=s(s({},t),p._config.peerDiscovery[e.tag])),t.enabled&&!p._discovery.has(e.tag))&&((r="function"==typeof e?new e(Object.assign({},t,{peerId:p.peerId,libp2p:p})):e).on("peer",p._onDiscoveryPeer),p._discovery.set(e.tag,r))},n=r(this._modules.peerDiscovery||[]);try{for(n.s();!(o=n.n()).done;)i=o.value,t(i)}catch(f){n.e(f)}finally{n.f()}a=r(this.transportManager.getTransports());try{for(a.s();!(c=a.n()).done;)(u=c.value).discovery&&t(u.discovery)}catch(f){a.e(f)}finally{a.f()}return e.next=7,Promise.all(Array.from(this._discovery.values(),function(e){return e.start()}));case 7:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}],[{key:"create",value:function(){var e=i(regeneratorRuntime.mark(function e(r){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!r.peerId){e.next=2;break}return e.abrupt("return",new n(r));case 2:return e.next=4,R.create();case 4:return t=e.sent,r.peerId=t,e.abrupt("return",new n(r));case 7:case"end":return e.stop()}},e)}));return function(r){return e.apply(this,arguments)}}()}]),n}();module.exports=re;
|
||
},{"debug":"F8gk","events":"wIHY","err-code":"hLMW","peer-id":"jAbp","multiaddr":"fVn4","./peer-routing":"oCI/","./content-routing":"/pDA","./get-peer":"VGr2","./config":"9pyy","./errors":"YLhd","./address-manager":"etnB","./connection-manager":"aFuP","./circuit/transport":"0n6B","./circuit":"VKLj","./dialer":"YP0b","./keychain":"taGw","./metrics":"FzUP","./transport-manager":"O6+p","./upgrader":"uyx+","./peer-store":"XS43","./pubsub-adapter":"FkEY","./peer-store/persistent":"o25R","./registrar":"HNv/","./ping":"8wvY","./identify":"q+oA","./nat-manager":"c4xF","./record/utils":"926m"}],"MTTc":[function(require,module,exports) {
|
||
function e(e){return o(e)||t(e)||n(e)||r()}function r(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function n(e,r){if(e){if("string"==typeof e)return a(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,r):void 0}}function t(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function o(e){if(Array.isArray(e))return a(e)}function a(e,r){(null==r||r>e.length)&&(r=e.length);for(var n=0,t=new Array(r);n<r;n++)t[n]=e[n];return t}function i(r){function n(e){var r,o=null;function a(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];if(a.enabled){var i=a,s=Number(new Date),u=s-(r||s);i.diff=u,i.prev=r,i.curr=s,r=s,t[0]=n.coerce(t[0]),"string"!=typeof t[0]&&t.unshift("%O");var l=0;t[0]=t[0].replace(/%([a-zA-Z%])/g,function(e,r){if("%%"===e)return"%";l++;var o=n.formatters[r];if("function"==typeof o){var a=t[l];e=o.call(i,a),t.splice(l,1),l--}return e}),n.formatArgs.call(i,t),(i.log||n.log).apply(i,t)}}return a.namespace=e,a.useColors=n.useColors(),a.color=n.selectColor(e),a.extend=t,a.destroy=n.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:function(){return null===o?n.enabled(e):o},set:function(e){o=e}}),"function"==typeof n.init&&n.init(a),a}function t(e,r){var t=n(this.namespace+(void 0===r?":":r)+e);return t.log=this.log,t}function o(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return n.debug=n,n.default=n,n.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},n.disable=function(){var r=[].concat(e(n.names.map(o)),e(n.skips.map(o).map(function(e){return"-"+e}))).join(",");return n.enable(""),r},n.enable=function(e){var r;n.save(e),n.names=[],n.skips=[];var t=("string"==typeof e?e:"").split(/[\s,]+/),o=t.length;for(r=0;r<o;r++)t[r]&&("-"===(e=t[r].replace(/\*/g,".*?"))[0]?n.skips.push(new RegExp("^"+e.substr(1)+"$")):n.names.push(new RegExp("^"+e+"$")))},n.enabled=function(e){if("*"===e[e.length-1])return!0;var r,t;for(r=0,t=n.skips.length;r<t;r++)if(n.skips[r].test(e))return!1;for(r=0,t=n.names.length;r<t;r++)if(n.names[r].test(e))return!0;return!1},n.humanize=require("ms"),n.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(r).forEach(function(e){n[e]=r[e]}),n.names=[],n.skips=[],n.formatters={},n.selectColor=function(e){for(var r=0,t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return n.colors[Math.abs(r)%n.colors.length]},n.enable(n.load()),n}module.exports=i;
|
||
},{"ms":"sBqc"}],"j+D9":[function(require,module,exports) {
|
||
var process = require("process");
|
||
var e=require("process");function o(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function C(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+module.exports.humanize(this.diff),this.useColors){var o="color: "+this.color;e.splice(1,0,o,"color: inherit");var C=0,t=0;e[0].replace(/%[a-zA-Z%]/g,function(e){"%%"!==e&&(C++,"%c"===e&&(t=C))}),e.splice(t,0,o)}}function t(e){try{e?exports.storage.setItem("debug",e):exports.storage.removeItem("debug")}catch(o){}}function r(){var o;try{o=exports.storage.getItem("debug")}catch(C){}return!o&&void 0!==e&&"env"in e&&(o=void 0),o}function n(){try{return localStorage}catch(e){}}exports.formatArgs=C,exports.save=t,exports.load=r,exports.useColors=o,exports.storage=n(),exports.destroy=function(){var e=!1;return function(){e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}}(),exports.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],exports.log=console.debug||console.log||function(){},module.exports=require("./common")(exports);var{formatters:s}=module.exports;s.j=function(e){try{return JSON.stringify(e)}catch(o){return"[UnexpectedJSONParseError]: "+o.message}};
|
||
},{"./common":"MTTc","process":"g5I+"}],"bJJC":[function(require,module,exports) {
|
||
module.exports=function(){if("undefined"==typeof globalThis)return null;var e={RTCPeerConnection:globalThis.RTCPeerConnection||globalThis.mozRTCPeerConnection||globalThis.webkitRTCPeerConnection,RTCSessionDescription:globalThis.RTCSessionDescription||globalThis.mozRTCSessionDescription||globalThis.webkitRTCSessionDescription,RTCIceCandidate:globalThis.RTCIceCandidate||globalThis.mozRTCIceCandidate||globalThis.webkitRTCIceCandidate};return e.RTCPeerConnection?e:null};
|
||
},{}],"gI/y":[function(require,module,exports) {
|
||
|
||
var r=require("buffer"),e=r.Buffer;function o(r,e){for(var o in r)e[o]=r[o]}function n(r,o,n){return e(r,o,n)}e.from&&e.alloc&&e.allocUnsafe&&e.allocUnsafeSlow?module.exports=r:(o(r,exports),exports.Buffer=n),n.prototype=Object.create(e.prototype),o(e,n),n.from=function(r,o,n){if("number"==typeof r)throw new TypeError("Argument must not be a number");return e(r,o,n)},n.alloc=function(r,o,n){if("number"!=typeof r)throw new TypeError("Argument must be a number");var t=e(r);return void 0!==o?"string"==typeof n?t.fill(o,n):t.fill(o):t.fill(0),t},n.allocUnsafe=function(r){if("number"!=typeof r)throw new TypeError("Argument must be a number");return e(r)},n.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)};
|
||
},{"buffer":"z1tx"}],"pXr2":[function(require,module,exports) {
|
||
|
||
var global = arguments[3];
|
||
var process = require("process");
|
||
var e=arguments[3],r=require("process"),o=65536,n=4294967295;function t(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}var s=require("safe-buffer").Buffer,u=e.crypto||e.msCrypto;function a(e,t){if(e>n)throw new RangeError("requested too many random bytes");var a=s.allocUnsafe(e);if(e>0)if(e>o)for(var f=0;f<e;f+=o)u.getRandomValues(a.slice(f,f+o));else u.getRandomValues(a);return"function"==typeof t?r.nextTick(function(){t(null,a)}):a}u&&u.getRandomValues?module.exports=a:module.exports=t;
|
||
},{"safe-buffer":"gI/y","process":"g5I+"}],"ieRP":[function(require,module,exports) {
|
||
module.exports=require("events").EventEmitter;
|
||
},{"events":"wIHY"}],"pIuq":[function(require,module,exports) {
|
||
|
||
"use strict";function t(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,a)}return n}function e(e){for(var a=1;a<arguments.length;a++){var i=null!=arguments[a]?arguments[a]:{};a%2?t(Object(i),!0).forEach(function(t){n(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):t(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function n(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n<e.length;n++){var a=e[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}function r(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),t}var h=require("buffer"),l=h.Buffer,s=require("util"),u=s.inspect,o=u&&u.custom||"inspect";function c(t,e,n){l.prototype.copy.call(t,e,n)}module.exports=function(){function t(){a(this,t),this.head=null,this.tail=null,this.length=0}return r(t,[{key:"push",value:function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,n=""+e.data;e=e.next;)n+=t+e.data;return n}},{key:"concat",value:function(t){if(0===this.length)return l.alloc(0);for(var e=l.allocUnsafe(t>>>0),n=this.head,a=0;n;)c(n.data,e,a),a+=n.data.length,n=n.next;return e}},{key:"consume",value:function(t,e){var n;return t<this.head.data.length?(n=this.head.data.slice(0,t),this.head.data=this.head.data.slice(t)):n=t===this.head.data.length?this.shift():e?this._getString(t):this._getBuffer(t),n}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(t){var e=this.head,n=1,a=e.data;for(t-=a.length;e=e.next;){var i=e.data,r=t>i.length?i.length:t;if(r===i.length?a+=i:a+=i.slice(0,t),0===(t-=r)){r===i.length?(++n,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=i.slice(r));break}++n}return this.length-=n,a}},{key:"_getBuffer",value:function(t){var e=l.allocUnsafe(t),n=this.head,a=1;for(n.data.copy(e),t-=n.data.length;n=n.next;){var i=n.data,r=t>i.length?i.length:t;if(i.copy(e,e.length-t,0,r),0===(t-=r)){r===i.length?(++a,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=i.slice(r));break}++a}return this.length-=a,e}},{key:o,value:function(t,n){return u(this,e({},n,{depth:0,customInspect:!1}))}}]),t}();
|
||
},{"buffer":"z1tx","util":"sC8V"}],"je3v":[function(require,module,exports) {
|
||
var process = require("process");
|
||
var t=require("process");function e(e,r){var d=this,l=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return l||o?(r?r(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,t.nextTick(s,this,e)):t.nextTick(s,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!r&&e?d._writableState?d._writableState.errorEmitted?t.nextTick(i,d):(d._writableState.errorEmitted=!0,t.nextTick(a,d,e)):t.nextTick(a,d,e):r?(t.nextTick(i,d),r(e)):t.nextTick(i,d)}),this)}function a(t,e){s(t,e),i(t)}function i(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function r(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function s(t,e){t.emit("error",e)}function d(t,e){var a=t._readableState,i=t._writableState;a&&a.autoDestroy||i&&i.autoDestroy?t.destroy(e):t.emit("error",e)}module.exports={destroy:e,undestroy:r,errorOrDestroy:d};
|
||
},{"process":"g5I+"}],"0niz":[function(require,module,exports) {
|
||
"use strict";function t(n){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(n)}function n(t,n){t.prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n}var e={};function o(t,o,r){r||(r=Error);var c=function(t){function e(n,e,r){return t.call(this,function(t,n,e){return"string"==typeof o?o:o(t,n,e)}(n,e,r))||this}return n(e,t),e}(r);c.prototype.name=r.name,c.prototype.code=t,e[t]=c}function r(t,n){if(Array.isArray(t)){var e=t.length;return t=t.map(function(t){return String(t)}),e>2?"one of ".concat(n," ").concat(t.slice(0,e-1).join(", "),", or ")+t[e-1]:2===e?"one of ".concat(n," ").concat(t[0]," or ").concat(t[1]):"of ".concat(n," ").concat(t[0])}return"of ".concat(n," ").concat(String(t))}function c(t,n,e){return t.substr(!e||e<0?0:+e,n.length)===n}function a(t,n,e){return(void 0===e||e>t.length)&&(e=t.length),t.substring(e-n.length,e)===n}function u(t,n,e){return"number"!=typeof e&&(e=0),!(e+n.length>t.length)&&-1!==t.indexOf(n,e)}o("ERR_INVALID_OPT_VALUE",function(t,n){return'The value "'+n+'" is invalid for option "'+t+'"'},TypeError),o("ERR_INVALID_ARG_TYPE",function(n,e,o){var i,E;if("string"==typeof e&&c(e,"not ")?(i="must not be",e=e.replace(/^not /,"")):i="must be",a(n," argument"))E="The ".concat(n," ").concat(i," ").concat(r(e,"type"));else{var f=u(n,".")?"property":"argument";E='The "'.concat(n,'" ').concat(f," ").concat(i," ").concat(r(e,"type"))}return E+=". Received type ".concat(t(o))},TypeError),o("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),o("ERR_METHOD_NOT_IMPLEMENTED",function(t){return"The "+t+" method is not implemented"}),o("ERR_STREAM_PREMATURE_CLOSE","Premature close"),o("ERR_STREAM_DESTROYED",function(t){return"Cannot call "+t+" after a stream was destroyed"}),o("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),o("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),o("ERR_STREAM_WRITE_AFTER_END","write after end"),o("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),o("ERR_UNKNOWN_ENCODING",function(t){return"Unknown encoding: "+t},TypeError),o("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),module.exports.codes=e;
|
||
},{}],"8XjR":[function(require,module,exports) {
|
||
"use strict";var r=require("../../../errors").codes.ERR_INVALID_OPT_VALUE;function e(r,e,t){return null!=r.highWaterMark?r.highWaterMark:e?r[t]:null}function t(t,i,o,a){var n=e(i,a,o);if(null!=n){if(!isFinite(n)||Math.floor(n)!==n||n<0)throw new r(a?o:"highWaterMark",n);return Math.floor(n)}return t.objectMode?16:16384}module.exports={getHighWaterMark:t};
|
||
},{"../../../errors":"0niz"}],"hQaz":[function(require,module,exports) {
|
||
var global = arguments[3];
|
||
var r=arguments[3];function t(r,t){if(e("noDeprecation"))return r;var n=!1;return function(){if(!n){if(e("throwDeprecation"))throw new Error(t);e("traceDeprecation")?console.trace(t):console.warn(t),n=!0}return r.apply(this,arguments)}}function e(t){try{if(!r.localStorage)return!1}catch(n){return!1}var e=r.localStorage[t];return null!=e&&"true"===String(e).toLowerCase()}module.exports=t;
|
||
},{}],"+jP1":[function(require,module,exports) {
|
||
|
||
var global = arguments[3];
|
||
var process = require("process");
|
||
var e,t=arguments[3],n=require("process");function r(e,t,n){this.chunk=e,this.encoding=t,this.callback=n,this.next=null}function i(e){var t=this;this.next=null,this.entry=null,this.finish=function(){G(t,e)}}module.exports=x,x.WritableState=m;var o={deprecate:require("util-deprecate")},s=require("./internal/streams/stream"),u=require("buffer").Buffer,f=t.Uint8Array||function(){};function a(e){return u.from(e)}function c(e){return u.isBuffer(e)||e instanceof f}var l,d=require("./internal/streams/destroy"),h=require("./internal/streams/state"),b=h.getHighWaterMark,p=require("../errors").codes,y=p.ERR_INVALID_ARG_TYPE,w=p.ERR_METHOD_NOT_IMPLEMENTED,g=p.ERR_MULTIPLE_CALLBACK,_=p.ERR_STREAM_CANNOT_PIPE,R=p.ERR_STREAM_DESTROYED,k=p.ERR_STREAM_NULL_VALUES,E=p.ERR_STREAM_WRITE_AFTER_END,S=p.ERR_UNKNOWN_ENCODING,q=d.errorOrDestroy;function v(){}function m(t,n,r){e=e||require("./_stream_duplex"),t=t||{},"boolean"!=typeof r&&(r=n instanceof e),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=b(this,t,"writableHighWaterMark",r),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=!1===t.decodeStrings;this.decodeStrings=!o,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){O(n,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new i(this)}function x(t){var n=this instanceof(e=e||require("./_stream_duplex"));if(!n&&!l.call(x,this))return new x(t);this._writableState=new m(t,this,n),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)),s.call(this)}function M(e,t){var r=new E;q(e,r),n.nextTick(t,r)}function B(e,t,r,i){var o;return null===r?o=new k:"string"==typeof r||t.objectMode||(o=new y("chunk",["string","Buffer"],r)),!o||(q(e,o),n.nextTick(i,o),!1)}function T(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=u.from(t,n)),t}function D(e,t,n,r,i,o){if(!n){var s=T(t,r,i);r!==s&&(n=!0,i="buffer",r=s)}var u=t.objectMode?1:r.length;t.length+=u;var f=t.length<t.highWaterMark;if(f||(t.needDrain=!0),t.writing||t.corked){var a=t.lastBufferedRequest;t.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:o,next:null},a?a.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else P(e,t,!1,u,r,i,o);return f}function P(e,t,n,r,i,o,s){t.writelen=r,t.writecb=s,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new R("write")):n?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function j(e,t,r,i,o){--t.pendingcb,r?(n.nextTick(o,i),n.nextTick(U,e,t),e._writableState.errorEmitted=!0,q(e,i)):(o(i),e._writableState.errorEmitted=!0,q(e,i),U(e,t))}function C(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function O(e,t){var r=e._writableState,i=r.sync,o=r.writecb;if("function"!=typeof o)throw new g;if(C(r),t)j(e,r,i,t,o);else{var s=I(r)||e.destroyed;s||r.corked||r.bufferProcessing||!r.bufferedRequest||N(e,r),i?n.nextTick(A,e,r,s,o):A(e,r,s,o)}}function A(e,t,n,r){n||L(e,t),t.pendingcb--,r(),U(e,t)}function L(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function N(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,o=new Array(r),s=t.corkedRequestsFree;s.entry=n;for(var u=0,f=!0;n;)o[u]=n,n.isBuf||(f=!1),n=n.next,u+=1;o.allBuffers=f,P(e,t,!0,t.length,o,"",s.finish),t.pendingcb++,t.lastBufferedRequest=null,s.next?(t.corkedRequestsFree=s.next,s.next=null):t.corkedRequestsFree=new i(t),t.bufferedRequestCount=0}else{for(;n;){var a=n.chunk,c=n.encoding,l=n.callback;if(P(e,t,!1,t.objectMode?1:a.length,a,c,l),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function I(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function W(e,t){e._final(function(n){t.pendingcb--,n&&q(e,n),t.prefinished=!0,e.emit("prefinish"),U(e,t)})}function F(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,n.nextTick(W,e,t)))}function U(e,t){var n=I(t);if(n&&(F(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var r=e._readableState;(!r||r.autoDestroy&&r.endEmitted)&&e.destroy()}return n}function H(e,t,r){t.ending=!0,U(e,t),r&&(t.finished?n.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}function G(e,t,n){var r=e.entry;for(e.entry=null;r;){var i=r.callback;t.pendingcb--,i(n),r=r.next}t.corkedRequestsFree.next=e}require("inherits")(x,s),m.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(m.prototype,"buffer",{get:o.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(l=Function.prototype[Symbol.hasInstance],Object.defineProperty(x,Symbol.hasInstance,{value:function(e){return!!l.call(this,e)||this===x&&(e&&e._writableState instanceof m)}})):l=function(e){return e instanceof this},x.prototype.pipe=function(){q(this,new _)},x.prototype.write=function(e,t,n){var r=this._writableState,i=!1,o=!r.objectMode&&c(e);return o&&!u.isBuffer(e)&&(e=a(e)),"function"==typeof t&&(n=t,t=null),o?t="buffer":t||(t=r.defaultEncoding),"function"!=typeof n&&(n=v),r.ending?M(this,n):(o||B(this,r,e,n))&&(r.pendingcb++,i=D(this,r,o,e,t,n)),i},x.prototype.cork=function(){this._writableState.corked++},x.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||N(this,e))},x.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new S(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(x.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(x.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),x.prototype._write=function(e,t,n){n(new w("_write()"))},x.prototype._writev=null,x.prototype.end=function(e,t,n){var r=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||H(this,r,n),this},Object.defineProperty(x.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(x.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),x.prototype.destroy=d.destroy,x.prototype._undestroy=d.undestroy,x.prototype._destroy=function(e,t){t(e)};
|
||
},{"util-deprecate":"hQaz","./internal/streams/stream":"ieRP","buffer":"z1tx","./internal/streams/destroy":"je3v","./internal/streams/state":"8XjR","../errors":"0niz","inherits":"4GKf","./_stream_duplex":"Egdy","process":"g5I+"}],"Egdy":[function(require,module,exports) {
|
||
var process = require("process");
|
||
var e=require("process"),t=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};module.exports=l;var r=require("./_stream_readable"),a=require("./_stream_writable");require("inherits")(l,r);for(var i=t(a.prototype),n=0;n<i.length;n++){var o=i[n];l.prototype[o]||(l.prototype[o]=a.prototype[o])}function l(e){if(!(this instanceof l))return new l(e);r.call(this,e),a.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",s)))}function s(){this._writableState.ended||e.nextTick(b,this)}function b(e){e.end()}Object.defineProperty(l.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(l.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(l.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(l.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}});
|
||
},{"./_stream_readable":"+zMK","./_stream_writable":"+jP1","inherits":"4GKf","process":"g5I+"}],"ikue":[function(require,module,exports) {
|
||
|
||
"use strict";var t=require("safe-buffer").Buffer,e=t.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 s(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}}function i(i){var a=s(i);if("string"!=typeof a&&(t.isEncoding===e||!e(i)))throw new Error("Unknown encoding: "+i);return a||i}function a(e){var s;switch(this.encoding=i(e),this.encoding){case"utf16le":this.text=c,this.end=f,s=4;break;case"utf8":this.fillLast=l,s=4;break;case"base64":this.text=d,this.end=g,s=3;break;default:return this.write=N,void(this.end=v)}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(s)}function r(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function n(t,e,s){var i=e.length-1;if(i<s)return 0;var a=r(e[i]);return a>=0?(a>0&&(t.lastNeed=a-1),a):--i<s||-2===a?0:(a=r(e[i]))>=0?(a>0&&(t.lastNeed=a-2),a):--i<s||-2===a?0:(a=r(e[i]))>=0?(a>0&&(2===a?a=0:t.lastNeed=a-3),a):0}function h(t,e,s){if(128!=(192&e[0]))return t.lastNeed=0,"<22>";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"<22>";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"<22>"}}function l(t){var e=this.lastTotal-this.lastNeed,s=h(this,t,e);return void 0!==s?s: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 u(t,e){var s=n(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=s;var i=t.length-(s-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)}function o(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"<22>":e}function c(t,e){if((t.length-e)%2==0){var s=t.toString("utf16le",e);if(s){var i=s.charCodeAt(s.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],s.slice(0,-1)}return s}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function f(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var s=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,s)}return e}function d(t,e){var s=(t.length-e)%3;return 0===s?t.toString("base64",e):(this.lastNeed=3-s,this.lastTotal=3,1===s?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-s))}function g(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function N(t){return t.toString(this.encoding)}function v(t){return t&&t.length?this.write(t):""}exports.StringDecoder=a,a.prototype.write=function(t){if(0===t.length)return"";var e,s;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";s=this.lastNeed,this.lastNeed=0}else s=0;return s<t.length?e?e+this.text(t,s):this.text(t,s):e||""},a.prototype.end=o,a.prototype.text=u,a.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};
|
||
},{"safe-buffer":"gI/y"}],"MiJa":[function(require,module,exports) {
|
||
"use strict";var e=require("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function r(e){var r=!1;return function(){if(!r){r=!0;for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];e.apply(this,n)}}}function t(){}function n(e){return e.setHeader&&"function"==typeof e.abort}function o(i,a,l){if("function"==typeof a)return o(i,null,a);a||(a={}),l=r(l||t);var s=a.readable||!1!==a.readable&&i.readable,c=a.writable||!1!==a.writable&&i.writable,u=function(){i.writable||d()},f=i._writableState&&i._writableState.finished,d=function(){c=!1,f=!0,s||l.call(i)},b=i._readableState&&i._readableState.endEmitted,v=function(){s=!1,b=!0,c||l.call(i)},m=function(e){l.call(i,e)},w=function(){var r;return s&&!b?(i._readableState&&i._readableState.ended||(r=new e),l.call(i,r)):c&&!f?(i._writableState&&i._writableState.ended||(r=new e),l.call(i,r)):void 0},_=function(){i.req.on("finish",d)};return n(i)?(i.on("complete",d),i.on("abort",w),i.req?_():i.on("request",_)):c&&!i._writableState&&(i.on("end",u),i.on("close",u)),i.on("end",v),i.on("finish",d),!1!==a.error&&i.on("error",m),i.on("close",w),function(){i.removeListener("complete",d),i.removeListener("abort",w),i.removeListener("request",_),i.req&&i.req.removeListener("finish",d),i.removeListener("end",u),i.removeListener("close",u),i.removeListener("finish",d),i.removeListener("end",v),i.removeListener("error",m),i.removeListener("close",w)}}module.exports=o;
|
||
},{"../../../errors":"0niz"}],"R7Op":[function(require,module,exports) {
|
||
var process = require("process");
|
||
var e,n=require("process");function r(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}var t=require("./end-of-stream"),l=Symbol("lastResolve"),u=Symbol("lastReject"),i=Symbol("error"),o=Symbol("ended"),a=Symbol("lastPromise"),s=Symbol("handlePromise"),c=Symbol("stream");function f(e,n){return{value:e,done:n}}function v(e){var n=e[l];if(null!==n){var r=e[c].read();null!==r&&(e[a]=null,e[l]=null,e[u]=null,n(f(r,!1)))}}function d(e){n.nextTick(v,e)}function b(e,n){return function(r,t){e.then(function(){n[o]?r(f(void 0,!0)):n[s](r,t)},t)}}var m=Object.getPrototypeOf(function(){}),h=Object.setPrototypeOf((r(e={get stream(){return this[c]},next:function(){var e=this,r=this[i];if(null!==r)return Promise.reject(r);if(this[o])return Promise.resolve(f(void 0,!0));if(this[c].destroyed)return new Promise(function(r,t){n.nextTick(function(){e[i]?t(e[i]):r(f(void 0,!0))})});var t,l=this[a];if(l)t=new Promise(b(l,this));else{var u=this[c].read();if(null!==u)return Promise.resolve(f(u,!1));t=new Promise(this[s])}return this[a]=t,t}},Symbol.asyncIterator,function(){return this}),r(e,"return",function(){var e=this;return new Promise(function(n,r){e[c].destroy(null,function(e){e?r(e):n(f(void 0,!0))})})}),e),m),y=function(e){var n,v=Object.create(h,(r(n={},c,{value:e,writable:!0}),r(n,l,{value:null,writable:!0}),r(n,u,{value:null,writable:!0}),r(n,i,{value:null,writable:!0}),r(n,o,{value:e._readableState.endEmitted,writable:!0}),r(n,s,{value:function(e,n){var r=v[c].read();r?(v[a]=null,v[l]=null,v[u]=null,e(f(r,!1))):(v[l]=e,v[u]=n)},writable:!0}),n));return v[a]=null,t(e,function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var n=v[u];return null!==n&&(v[a]=null,v[l]=null,v[u]=null,n(e)),void(v[i]=e)}var r=v[l];null!==r&&(v[a]=null,v[l]=null,v[u]=null,r(f(void 0,!0))),v[o]=!0}),e.on("readable",d.bind(null,v)),v};module.exports=y;
|
||
},{"./end-of-stream":"MiJa","process":"g5I+"}],"BlR4":[function(require,module,exports) {
|
||
module.exports=function(){throw new Error("Readable.from is not available in the browser")};
|
||
},{}],"+zMK":[function(require,module,exports) {
|
||
|
||
var global = arguments[3];
|
||
var process = require("process");
|
||
var e,t=arguments[3],n=require("process");module.exports=j,j.ReadableState=L;var r=require("events").EventEmitter,i=function(e,t){return e.listeners(t).length},a=require("./internal/streams/stream"),d=require("buffer").Buffer,o=t.Uint8Array||function(){};function s(e){return d.from(e)}function l(e){return d.isBuffer(e)||e instanceof o}var u,h=require("util");u=h&&h.debuglog?h.debuglog("stream"):function(){};var p,f,c,b=require("./internal/streams/buffer_list"),g=require("./internal/streams/destroy"),m=require("./internal/streams/state"),y=m.getHighWaterMark,_=require("../errors").codes,v=_.ERR_INVALID_ARG_TYPE,w=_.ERR_STREAM_PUSH_AFTER_EOF,S=_.ERR_METHOD_NOT_IMPLEMENTED,R=_.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;require("inherits")(j,a);var M=g.errorOrDestroy,E=["error","close","destroy","pause","resume"];function k(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}function L(t,n,r){e=e||require("./_stream_duplex"),t=t||{},"boolean"!=typeof r&&(r=n instanceof e),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=y(this,t,"readableHighWaterMark",r),this.buffer=new b,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.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(p||(p=require("string_decoder/").StringDecoder),this.decoder=new p(t.encoding),this.encoding=t.encoding)}function j(t){if(e=e||require("./_stream_duplex"),!(this instanceof j))return new j(t);var n=this instanceof e;this._readableState=new L(t,this,n),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),a.call(this)}function D(e,t,n,r,i){u("readableAddChunk",t);var a,o=e._readableState;if(null===t)o.reading=!1,A(e,o);else if(i||(a=T(o,t)),a)M(e,a);else if(o.objectMode||t&&t.length>0)if("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===d.prototype||(t=s(t)),r)o.endEmitted?M(e,new R):C(e,o,t,!0);else if(o.ended)M(e,new w);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?C(e,o,t,!1):U(e,o)):C(e,o,t,!1)}else r||(o.reading=!1,U(e,o));return!o.ended&&(o.length<o.highWaterMark||0===o.length)}function C(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",n)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&O(e)),U(e,t)}function T(e,t){var n;return l(t)||"string"==typeof t||void 0===t||e.objectMode||(n=new v("chunk",["string","Buffer","Uint8Array"],t)),n}Object.defineProperty(j.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),j.prototype.destroy=g.destroy,j.prototype._undestroy=g.undestroy,j.prototype._destroy=function(e,t){t(e)},j.prototype.push=function(e,t){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof e&&((t=t||r.defaultEncoding)!==r.encoding&&(e=d.from(e,t),t=""),n=!0),D(this,e,t,!1,n)},j.prototype.unshift=function(e){return D(this,e,null,!0,!1)},j.prototype.isPaused=function(){return!1===this._readableState.flowing},j.prototype.setEncoding=function(e){p||(p=require("string_decoder/").StringDecoder);var t=new p(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,r="";null!==n;)r+=t.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==r&&this._readableState.buffer.push(r),this._readableState.length=r.length,this};var q=1073741824;function W(e){return e>=q?e=q:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function x(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=W(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function A(e,t){if(u("onEofChunk"),!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.sync?O(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,P(e)))}}function O(e){var t=e._readableState;u("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(u("emitReadable",t.flowing),t.emittedReadable=!0,n.nextTick(P,e))}function P(e){var t=e._readableState;u("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,G(e)}function U(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(N,e,t))}function N(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var n=t.length;if(u("maybeReadMore read 0"),e.read(0),n===t.length)break}t.readingMore=!1}function H(e){return function(){var t=e._readableState;u("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&i(e,"data")&&(t.flowing=!0,G(e))}}function I(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function F(e){u("readable nexttick read 0"),e.read(0)}function B(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(V,e,t))}function V(e,t){u("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),G(e),t.flowing&&!t.reading&&e.read(0)}function G(e){var t=e._readableState;for(u("flow",t.flowing);t.flowing&&null!==e.read(););}function Y(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n);var n}function z(e){var t=e._readableState;u("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(J,t,e))}function J(e,t){if(u("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var n=t._writableState;(!n||n.autoDestroy&&n.finished)&&t.destroy()}}function K(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}j.prototype.read=function(e){u("read",e),e=parseInt(e,10);var t=this._readableState,n=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return u("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?z(this):O(this),null;if(0===(e=x(e,t))&&t.ended)return 0===t.length&&z(this),null;var r,i=t.needReadable;return u("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&u("length less than watermark",i=!0),t.ended||t.reading?u("reading or ended",i=!1):i&&(u("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=x(n,t))),null===(r=e>0?Y(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&z(this)),null!==r&&this.emit("data",r),r},j.prototype._read=function(e){M(this,new S("_read()"))},j.prototype.pipe=function(e,t){var r=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=e;break;case 1:a.pipes=[a.pipes,e];break;default:a.pipes.push(e)}a.pipesCount+=1,u("pipe count=%d opts=%j",a.pipesCount,t);var d=(!t||!1!==t.end)&&e!==n.stdout&&e!==n.stderr?s:g;function o(t,n){u("onunpipe"),t===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,u("cleanup"),e.removeListener("close",c),e.removeListener("finish",b),e.removeListener("drain",l),e.removeListener("error",f),e.removeListener("unpipe",o),r.removeListener("end",s),r.removeListener("end",g),r.removeListener("data",p),h=!0,!a.awaitDrain||e._writableState&&!e._writableState.needDrain||l())}function s(){u("onend"),e.end()}a.endEmitted?n.nextTick(d):r.once("end",d),e.on("unpipe",o);var l=H(r);e.on("drain",l);var h=!1;function p(t){u("ondata");var n=e.write(t);u("dest.write",n),!1===n&&((1===a.pipesCount&&a.pipes===e||a.pipesCount>1&&-1!==K(a.pipes,e))&&!h&&(u("false write response, pause",a.awaitDrain),a.awaitDrain++),r.pause())}function f(t){u("onerror",t),g(),e.removeListener("error",f),0===i(e,"error")&&M(e,t)}function c(){e.removeListener("finish",b),g()}function b(){u("onfinish"),e.removeListener("close",c),g()}function g(){u("unpipe"),r.unpipe(e)}return r.on("data",p),k(e,"error",f),e.once("close",c),e.once("finish",b),e.emit("pipe",r),a.flowing||(u("pipe resume"),r.resume()),e},j.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var a=0;a<i;a++)r[a].emit("unpipe",this,{hasUnpiped:!1});return this}var d=K(t.pipes,e);return-1===d?this:(t.pipes.splice(d,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,n),this)},j.prototype.on=function(e,t){var r=a.prototype.on.call(this,e,t),i=this._readableState;return"data"===e?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,u("on readable",i.length,i.reading),i.length?O(this):i.reading||n.nextTick(F,this))),r},j.prototype.addListener=j.prototype.on,j.prototype.removeListener=function(e,t){var r=a.prototype.removeListener.call(this,e,t);return"readable"===e&&n.nextTick(I,this),r},j.prototype.removeAllListeners=function(e){var t=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||n.nextTick(I,this),t},j.prototype.resume=function(){var e=this._readableState;return e.flowing||(u("resume"),e.flowing=!e.readableListening,B(this,e)),e.paused=!1,this},j.prototype.pause=function(){return u("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(u("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},j.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var i in e.on("end",function(){if(u("wrapped end"),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(i){(u("wrapped data"),n.decoder&&(i=n.decoder.write(i)),n.objectMode&&null==i)||(n.objectMode||i&&i.length)&&(t.push(i)||(r=!0,e.pause()))}),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var a=0;a<E.length;a++)e.on(E[a],this.emit.bind(this,E[a]));return this._read=function(t){u("wrapped _read",t),r&&(r=!1,e.resume())},this},"function"==typeof Symbol&&(j.prototype[Symbol.asyncIterator]=function(){return void 0===f&&(f=require("./internal/streams/async_iterator")),f(this)}),Object.defineProperty(j.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(j.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(j.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),j._fromList=Y,Object.defineProperty(j.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(j.from=function(e,t){return void 0===c&&(c=require("./internal/streams/from")),c(j,e,t)});
|
||
},{"events":"wIHY","./internal/streams/stream":"ieRP","buffer":"z1tx","util":"sC8V","./internal/streams/buffer_list":"pIuq","./internal/streams/destroy":"je3v","./internal/streams/state":"8XjR","../errors":"0niz","inherits":"4GKf","./_stream_duplex":"Egdy","string_decoder/":"ikue","./internal/streams/async_iterator":"R7Op","./internal/streams/from":"BlR4","process":"g5I+"}],"vPgz":[function(require,module,exports) {
|
||
"use strict";module.exports=o;var t=require("../errors").codes,r=t.ERR_METHOD_NOT_IMPLEMENTED,e=t.ERR_MULTIPLE_CALLBACK,n=t.ERR_TRANSFORM_ALREADY_TRANSFORMING,i=t.ERR_TRANSFORM_WITH_LENGTH_0,a=require("./_stream_duplex");function s(t,r){var n=this._transformState;n.transforming=!1;var i=n.writecb;if(null===i)return this.emit("error",new e);n.writechunk=null,n.writecb=null,null!=r&&this.push(r),i(t);var a=this._readableState;a.reading=!1,(a.needReadable||a.length<a.highWaterMark)&&this._read(a.highWaterMark)}function o(t){if(!(this instanceof o))return new o(t);a.call(this,t),this._transformState={afterTransform:s.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",h)}function h(){var t=this;"function"!=typeof this._flush||this._readableState.destroyed?f(this,null,null):this._flush(function(r,e){f(t,r,e)})}function f(t,r,e){if(r)return t.emit("error",r);if(null!=e&&t.push(e),t._writableState.length)throw new i;if(t._transformState.transforming)throw new n;return t.push(null)}require("inherits")(o,a),o.prototype.push=function(t,r){return this._transformState.needTransform=!1,a.prototype.push.call(this,t,r)},o.prototype._transform=function(t,e,n){n(new r("_transform()"))},o.prototype._write=function(t,r,e){var n=this._transformState;if(n.writecb=e,n.writechunk=t,n.writeencoding=r,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},o.prototype._read=function(t){var r=this._transformState;null===r.writechunk||r.transforming?r.needTransform=!0:(r.transforming=!0,this._transform(r.writechunk,r.writeencoding,r.afterTransform))},o.prototype._destroy=function(t,r){a.prototype._destroy.call(this,t,function(t){r(t)})};
|
||
},{"../errors":"0niz","./_stream_duplex":"Egdy","inherits":"4GKf"}],"yuku":[function(require,module,exports) {
|
||
"use strict";module.exports=t;var r=require("./_stream_transform");function t(e){if(!(this instanceof t))return new t(e);r.call(this,e)}require("inherits")(t,r),t.prototype._transform=function(r,t,e){e(null,r)};
|
||
},{"./_stream_transform":"vPgz","inherits":"4GKf"}],"2+ks":[function(require,module,exports) {
|
||
"use strict";var r;function n(r){var n=!1;return function(){n||(n=!0,r.apply(void 0,arguments))}}var t=require("../../../errors").codes,e=t.ERR_MISSING_ARGS,o=t.ERR_STREAM_DESTROYED;function i(r){if(r)throw r}function u(r){return r.setHeader&&"function"==typeof r.abort}function f(t,e,i,f){f=n(f);var a=!1;t.on("close",function(){a=!0}),void 0===r&&(r=require("./end-of-stream")),r(t,{readable:e,writable:i},function(r){if(r)return f(r);a=!0,f()});var c=!1;return function(r){if(!a&&!c)return c=!0,u(t)?t.abort():"function"==typeof t.destroy?t.destroy():void f(r||new o("pipe"))}}function a(r){r()}function c(r,n){return r.pipe(n)}function p(r){return r.length?"function"!=typeof r[r.length-1]?i:r.pop():i}function s(){for(var r=arguments.length,n=new Array(r),t=0;t<r;t++)n[t]=arguments[t];var o,i=p(n);if(Array.isArray(n[0])&&(n=n[0]),n.length<2)throw new e("streams");var u=n.map(function(r,t){var e=t<n.length-1;return f(r,e,t>0,function(r){o||(o=r),r&&u.forEach(a),e||(u.forEach(a),i(o))})});return n.reduce(c)}module.exports=s;
|
||
},{"../../../errors":"0niz","./end-of-stream":"MiJa"}],"oo/5":[function(require,module,exports) {
|
||
exports=module.exports=require("./lib/_stream_readable.js"),exports.Stream=exports,exports.Readable=exports,exports.Writable=require("./lib/_stream_writable.js"),exports.Duplex=require("./lib/_stream_duplex.js"),exports.Transform=require("./lib/_stream_transform.js"),exports.PassThrough=require("./lib/_stream_passthrough.js"),exports.finished=require("./lib/internal/streams/end-of-stream.js"),exports.pipeline=require("./lib/internal/streams/pipeline.js");
|
||
},{"./lib/_stream_readable.js":"+zMK","./lib/_stream_writable.js":"+jP1","./lib/_stream_duplex.js":"Egdy","./lib/_stream_transform.js":"vPgz","./lib/_stream_passthrough.js":"yuku","./lib/internal/streams/end-of-stream.js":"MiJa","./lib/internal/streams/pipeline.js":"2+ks"}],"IVZi":[function(require,module,exports) {
|
||
var global = arguments[3];
|
||
var e=arguments[3];let o;module.exports="function"==typeof queueMicrotask?queueMicrotask.bind("undefined"!=typeof window?window:e):e=>(o||(o=Promise.resolve())).then(e).catch(e=>setTimeout(()=>{throw e},0));
|
||
},{}],"1zRU":[function(require,module,exports) {
|
||
"use strict";function e(e,t){for(const r in t)Object.defineProperty(e,r,{value:t[r],enumerable:!0,configurable:!0});return e}function t(t,r,o){if(!t||"string"==typeof t)throw new TypeError("Please pass an Error to err-code");o||(o={}),"object"==typeof r&&(o=r,r=void 0),null!=r&&(o.code=r);try{return e(t,o)}catch(n){o.message=t.message,o.stack=t.stack;const r=function(){};return r.prototype=Object.create(Object.getPrototypeOf(t)),e(new r,o)}}module.exports=t;
|
||
},{}],"wnr6":[function(require,module,exports) {
|
||
var e=require("debug")("simple-peer"),t=require("get-browser-rtc"),i=require("randombytes"),s=require("readable-stream"),n=require("queue-microtask"),a=require("err-code"),r=65536,h=5e3,o=5e3;function c(e){return e.replace(/a=ice-options:trickle\s\n/g,"")}function d(e){console.warn(e)}class l extends s.Duplex{constructor(e){if(super(e=Object.assign({allowHalfOpen:!1},e)),this._id=i(4).toString("hex").slice(0,7),this._debug("new peer %o",e),this.channelName=e.initiator?e.channelName||i(20).toString("hex"):null,this.initiator=e.initiator||!1,this.channelConfig=e.channelConfig||l.channelConfig,this.negotiated=this.channelConfig.negotiated,this.config=Object.assign({},l.config,e.config),this.offerOptions=e.offerOptions||{},this.answerOptions=e.answerOptions||{},this.sdpTransform=e.sdpTransform||(e=>e),this.streams=e.streams||(e.stream?[e.stream]:[]),this.trickle=void 0===e.trickle||e.trickle,this.allowHalfTrickle=void 0!==e.allowHalfTrickle&&e.allowHalfTrickle,this.iceCompleteTimeout=e.iceCompleteTimeout||h,this._connected=!1,this.remoteAddress=void 0,this.remoteFamily=void 0,this.remotePort=void 0,this.localAddress=void 0,this.localFamily=void 0,this.localPort=void 0,this._wrtc=e.wrtc&&"object"==typeof e.wrtc?e.wrtc:t(),!this._wrtc)throw"undefined"==typeof window?a(new Error("No WebRTC support: Specify `opts.wrtc` option in this environment"),"ERR_WEBRTC_SUPPORT"):a(new Error("No WebRTC support: Not a supported browser"),"ERR_WEBRTC_SUPPORT");this._pcReady=!1,this._channelReady=!1,this._iceComplete=!1,this._iceCompleteTimer=null,this._channel=null,this._pendingCandidates=[],this._isNegotiating=!this.negotiated&&!this.initiator,this._batchedNegotiation=!1,this._queuedNegotiation=!1,this._sendersAwaitingStable=[],this._senderMap=new Map,this._firstStable=!0,this._closingInterval=null,this._remoteTracks=[],this._remoteStreams=[],this._chunk=null,this._cb=null,this._interval=null;try{this._pc=new this._wrtc.RTCPeerConnection(this.config)}catch(s){return void n(()=>this.destroy(a(s,"ERR_PC_CONSTRUCTOR")))}this._isReactNativeWebrtc="number"==typeof this._pc._peerConnectionId,this._pc.oniceconnectionstatechange=(()=>{this._onIceStateChange()}),this._pc.onicegatheringstatechange=(()=>{this._onIceStateChange()}),this._pc.onconnectionstatechange=(()=>{this._onConnectionStateChange()}),this._pc.onsignalingstatechange=(()=>{this._onSignalingStateChange()}),this._pc.onicecandidate=(e=>{this._onIceCandidate(e)}),this.initiator||this.negotiated?this._setupData({channel:this._pc.createDataChannel(this.channelName,this.channelConfig)}):this._pc.ondatachannel=(e=>{this._setupData(e)}),this.streams&&this.streams.forEach(e=>{this.addStream(e)}),this._pc.ontrack=(e=>{this._onTrack(e)}),this.initiator&&this._needsNegotiation(),this._onFinishBound=(()=>{this._onFinish()}),this.once("finish",this._onFinishBound)}get bufferSize(){return this._channel&&this._channel.bufferedAmount||0}get connected(){return this._connected&&"open"===this._channel.readyState}address(){return{port:this.localPort,family:this.localFamily,address:this.localAddress}}signal(e){if(this.destroyed)throw a(new Error("cannot signal after peer is destroyed"),"ERR_SIGNALING");if("string"==typeof e)try{e=JSON.parse(e)}catch(t){e={}}this._debug("signal()"),e.renegotiate&&this.initiator&&(this._debug("got request to renegotiate"),this._needsNegotiation()),e.transceiverRequest&&this.initiator&&(this._debug("got request for transceiver"),this.addTransceiver(e.transceiverRequest.kind,e.transceiverRequest.init)),e.candidate&&(this._pc.remoteDescription&&this._pc.remoteDescription.type?this._addIceCandidate(e.candidate):this._pendingCandidates.push(e.candidate)),e.sdp&&this._pc.setRemoteDescription(new this._wrtc.RTCSessionDescription(e)).then(()=>{this.destroyed||(this._pendingCandidates.forEach(e=>{this._addIceCandidate(e)}),this._pendingCandidates=[],"offer"===this._pc.remoteDescription.type&&this._createAnswer())}).catch(e=>{this.destroy(a(e,"ERR_SET_REMOTE_DESCRIPTION"))}),e.sdp||e.candidate||e.renegotiate||e.transceiverRequest||this.destroy(a(new Error("signal() called with invalid signal data"),"ERR_SIGNALING"))}_addIceCandidate(e){var t=new this._wrtc.RTCIceCandidate(e);this._pc.addIceCandidate(t).catch(e=>{!t.address||t.address.endsWith(".local")?d("Ignoring unsupported ICE candidate."):this.destroy(a(e,"ERR_ADD_ICE_CANDIDATE"))})}send(e){this._channel.send(e)}addTransceiver(e,t){if(this._debug("addTransceiver()"),this.initiator)try{this._pc.addTransceiver(e,t),this._needsNegotiation()}catch(i){this.destroy(a(i,"ERR_ADD_TRANSCEIVER"))}else this.emit("signal",{transceiverRequest:{kind:e,init:t}})}addStream(e){this._debug("addStream()"),e.getTracks().forEach(t=>{this.addTrack(t,e)})}addTrack(e,t){this._debug("addTrack()");var i=this._senderMap.get(e)||new Map,s=i.get(t);if(s)throw s.removed?a(new Error("Track has been removed. You should enable/disable tracks that you want to re-add."),"ERR_SENDER_REMOVED"):a(new Error("Track has already been added to that stream."),"ERR_SENDER_ALREADY_ADDED");s=this._pc.addTrack(e,t),i.set(t,s),this._senderMap.set(e,i),this._needsNegotiation()}replaceTrack(e,t,i){this._debug("replaceTrack()");var s=this._senderMap.get(e),n=s?s.get(i):null;if(!n)throw a(new Error("Cannot replace track that was never added."),"ERR_TRACK_NOT_ADDED");t&&this._senderMap.set(t,s),null!=n.replaceTrack?n.replaceTrack(t):this.destroy(a(new Error("replaceTrack is not supported in this browser"),"ERR_UNSUPPORTED_REPLACETRACK"))}removeTrack(e,t){this._debug("removeSender()");var i=this._senderMap.get(e),s=i?i.get(t):null;if(!s)throw a(new Error("Cannot remove track that was never added."),"ERR_TRACK_NOT_ADDED");try{s.removed=!0,this._pc.removeTrack(s)}catch(n){"NS_ERROR_UNEXPECTED"===n.name?this._sendersAwaitingStable.push(s):this.destroy(a(n,"ERR_REMOVE_TRACK"))}this._needsNegotiation()}removeStream(e){this._debug("removeSenders()"),e.getTracks().forEach(t=>{this.removeTrack(t,e)})}_needsNegotiation(){this._debug("_needsNegotiation"),this._batchedNegotiation||(this._batchedNegotiation=!0,n(()=>{this._batchedNegotiation=!1,this._debug("starting batched negotiation"),this.negotiate()}))}negotiate(){this.initiator?this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("start negotiation"),setTimeout(()=>{this._createOffer()},0)):this._isNegotiating?(this._queuedNegotiation=!0,this._debug("already negotiating, queueing")):(this._debug("requesting negotiation from initiator"),this.emit("signal",{renegotiate:!0})),this._isNegotiating=!0}_destroy(e,t){if(this._debug("destroy (error: %s)",e&&(e.message||e)),this.readable=this.writable=!1,this._readableState.ended||this.push(null),this._writableState.finished||this.end(),this._connected=!1,this._pcReady=!1,this._channelReady=!1,this._remoteTracks=null,this._remoteStreams=null,this._senderMap=null,clearInterval(this._closingInterval),this._closingInterval=null,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._onFinishBound&&this.removeListener("finish",this._onFinishBound),this._onFinishBound=null,this._channel){try{this._channel.close()}catch(e){}this._channel.onmessage=null,this._channel.onopen=null,this._channel.onclose=null,this._channel.onerror=null}if(this._pc){try{this._pc.close()}catch(e){}this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ontrack=null,this._pc.ondatachannel=null}this._pc=null,this._channel=null,t(e)}_setupData(e){if(!e.channel)return this.destroy(a(new Error("Data channel event is missing `channel` property"),"ERR_DATA_CHANNEL"));this._channel=e.channel,this._channel.binaryType="arraybuffer","number"==typeof this._channel.bufferedAmountLowThreshold&&(this._channel.bufferedAmountLowThreshold=r),this.channelName=this._channel.label,this._channel.onmessage=(e=>{this._onChannelMessage(e)}),this._channel.onbufferedamountlow=(()=>{this._onChannelBufferedAmountLow()}),this._channel.onopen=(()=>{this._onChannelOpen()}),this._channel.onclose=(()=>{this._onChannelClose()}),this._channel.onerror=(e=>{this.destroy(a(e,"ERR_DATA_CHANNEL"))});var t=!1;this._closingInterval=setInterval(()=>{this._channel&&"closing"===this._channel.readyState?(t&&this._onChannelClose(),t=!0):t=!1},o)}_read(){}_write(e,t,i){if(this.destroyed)return i(a(new Error("cannot write after peer is destroyed"),"ERR_DATA_CHANNEL"));if(this._connected){try{this.send(e)}catch(s){return this.destroy(a(s,"ERR_DATA_CHANNEL"))}this._channel.bufferedAmount>r?(this._debug("start backpressure: bufferedAmount %d",this._channel.bufferedAmount),this._cb=i):i(null)}else this._debug("write before connect"),this._chunk=e,this._cb=i}_onFinish(){if(this.destroyed)return;const e=()=>{setTimeout(()=>this.destroy(),1e3)};this._connected?e():this.once("connect",e)}_startIceCompleteTimeout(){this.destroyed||this._iceCompleteTimer||(this._debug("started iceComplete timeout"),this._iceCompleteTimer=setTimeout(()=>{this._iceComplete||(this._iceComplete=!0,this._debug("iceComplete timeout completed"),this.emit("iceTimeout"),this.emit("_iceComplete"))},this.iceCompleteTimeout))}_createOffer(){this.destroyed||this._pc.createOffer(this.offerOptions).then(e=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(e.sdp=c(e.sdp)),e.sdp=this.sdpTransform(e.sdp);const t=()=>{if(!this.destroyed){var t=this._pc.localDescription||e;this._debug("signal"),this.emit("signal",{type:t.type,sdp:t.sdp})}};this._pc.setLocalDescription(e).then(()=>{this._debug("createOffer success"),this.destroyed||(this.trickle||this._iceComplete?t():this.once("_iceComplete",t))}).catch(e=>{this.destroy(a(e,"ERR_SET_LOCAL_DESCRIPTION"))})}).catch(e=>{this.destroy(a(e,"ERR_CREATE_OFFER"))})}_requestMissingTransceivers(){this._pc.getTransceivers&&this._pc.getTransceivers().forEach(e=>{e.mid||!e.sender.track||e.requested||(e.requested=!0,this.addTransceiver(e.sender.track.kind))})}_createAnswer(){this.destroyed||this._pc.createAnswer(this.answerOptions).then(e=>{if(this.destroyed)return;this.trickle||this.allowHalfTrickle||(e.sdp=c(e.sdp)),e.sdp=this.sdpTransform(e.sdp);const t=()=>{if(!this.destroyed){var t=this._pc.localDescription||e;this._debug("signal"),this.emit("signal",{type:t.type,sdp:t.sdp}),this.initiator||this._requestMissingTransceivers()}};this._pc.setLocalDescription(e).then(()=>{this.destroyed||(this.trickle||this._iceComplete?t():this.once("_iceComplete",t))}).catch(e=>{this.destroy(a(e,"ERR_SET_LOCAL_DESCRIPTION"))})}).catch(e=>{this.destroy(a(e,"ERR_CREATE_ANSWER"))})}_onConnectionStateChange(){this.destroyed||"failed"===this._pc.connectionState&&this.destroy(a(new Error("Connection failed."),"ERR_CONNECTION_FAILURE"))}_onIceStateChange(){if(!this.destroyed){var e=this._pc.iceConnectionState,t=this._pc.iceGatheringState;this._debug("iceStateChange (connection: %s) (gathering: %s)",e,t),this.emit("iceStateChange",e,t),"connected"!==e&&"completed"!==e||(this._pcReady=!0,this._maybeReady()),"failed"===e&&this.destroy(a(new Error("Ice connection failed."),"ERR_ICE_CONNECTION_FAILURE")),"closed"===e&&this.destroy(a(new Error("Ice connection closed."),"ERR_ICE_CONNECTION_CLOSED"))}}getStats(e){const t=e=>("[object Array]"===Object.prototype.toString.call(e.values)&&e.values.forEach(t=>{Object.assign(e,t)}),e);0===this._pc.getStats.length||this._isReactNativeWebrtc?this._pc.getStats().then(i=>{var s=[];i.forEach(e=>{s.push(t(e))}),e(null,s)},t=>e(t)):this._pc.getStats.length>0?this._pc.getStats(i=>{if(!this.destroyed){var s=[];i.result().forEach(e=>{var i={};e.names().forEach(t=>{i[t]=e.stat(t)}),i.id=e.id,i.type=e.type,i.timestamp=e.timestamp,s.push(t(i))}),e(null,s)}},t=>e(t)):e(null,[])}_maybeReady(){if(this._debug("maybeReady pc %s channel %s",this._pcReady,this._channelReady),this._connected||this._connecting||!this._pcReady||!this._channelReady)return;this._connecting=!0;const e=()=>{this.destroyed||this.getStats((t,i)=>{if(this.destroyed)return;t&&(i=[]);var s={},n={},r={},h=!1;i.forEach(e=>{"remotecandidate"!==e.type&&"remote-candidate"!==e.type||(s[e.id]=e),"localcandidate"!==e.type&&"local-candidate"!==e.type||(n[e.id]=e),"candidatepair"!==e.type&&"candidate-pair"!==e.type||(r[e.id]=e)});const o=e=>{h=!0;var t=n[e.localCandidateId];t&&(t.ip||t.address)?(this.localAddress=t.ip||t.address,this.localPort=Number(t.port)):t&&t.ipAddress?(this.localAddress=t.ipAddress,this.localPort=Number(t.portNumber)):"string"==typeof e.googLocalAddress&&(t=e.googLocalAddress.split(":"),this.localAddress=t[0],this.localPort=Number(t[1])),this.localAddress&&(this.localFamily=this.localAddress.includes(":")?"IPv6":"IPv4");var i=s[e.remoteCandidateId];i&&(i.ip||i.address)?(this.remoteAddress=i.ip||i.address,this.remotePort=Number(i.port)):i&&i.ipAddress?(this.remoteAddress=i.ipAddress,this.remotePort=Number(i.portNumber)):"string"==typeof e.googRemoteAddress&&(i=e.googRemoteAddress.split(":"),this.remoteAddress=i[0],this.remotePort=Number(i[1])),this.remoteAddress&&(this.remoteFamily=this.remoteAddress.includes(":")?"IPv6":"IPv4"),this._debug("connect local: %s:%s remote: %s:%s",this.localAddress,this.localPort,this.remoteAddress,this.remotePort)};if(i.forEach(e=>{"transport"===e.type&&e.selectedCandidatePairId&&o(r[e.selectedCandidatePairId]),("googCandidatePair"===e.type&&"true"===e.googActiveConnection||("candidatepair"===e.type||"candidate-pair"===e.type)&&e.selected)&&o(e)}),h||Object.keys(r).length&&!Object.keys(n).length){if(this._connecting=!1,this._connected=!0,this._chunk){try{this.send(this._chunk)}catch(t){return this.destroy(a(t,"ERR_DATA_CHANNEL"))}this._chunk=null,this._debug('sent chunk from "write before connect"');var c=this._cb;this._cb=null,c(null)}"number"!=typeof this._channel.bufferedAmountLowThreshold&&(this._interval=setInterval(()=>this._onInterval(),150),this._interval.unref&&this._interval.unref()),this._debug("connect"),this.emit("connect")}else setTimeout(e,100)})};e()}_onInterval(){!this._cb||!this._channel||this._channel.bufferedAmount>r||this._onChannelBufferedAmountLow()}_onSignalingStateChange(){this.destroyed||("stable"!==this._pc.signalingState||this._firstStable||(this._isNegotiating=!1,this._debug("flushing sender queue",this._sendersAwaitingStable),this._sendersAwaitingStable.forEach(e=>{this._pc.removeTrack(e),this._queuedNegotiation=!0}),this._sendersAwaitingStable=[],this._queuedNegotiation&&(this._debug("flushing negotiation queue"),this._queuedNegotiation=!1,this._needsNegotiation()),this._debug("negotiate"),this.emit("negotiate")),this._firstStable=!1,this._debug("signalingStateChange %s",this._pc.signalingState),this.emit("signalingStateChange",this._pc.signalingState))}_onIceCandidate(e){this.destroyed||(e.candidate&&this.trickle?this.emit("signal",{candidate:{candidate:e.candidate.candidate,sdpMLineIndex:e.candidate.sdpMLineIndex,sdpMid:e.candidate.sdpMid}}):e.candidate||this._iceComplete||(this._iceComplete=!0,this.emit("_iceComplete")),e.candidate&&this._startIceCompleteTimeout())}_onChannelMessage(e){if(!this.destroyed){var t=e.data;t instanceof ArrayBuffer&&(t=new Uint8Array(t)),this.push(t)}}_onChannelBufferedAmountLow(){if(!this.destroyed&&this._cb){this._debug("ending backpressure: bufferedAmount %d",this._channel.bufferedAmount);var e=this._cb;this._cb=null,e(null)}}_onChannelOpen(){this._connected||this.destroyed||(this._debug("on channel open"),this._channelReady=!0,this._maybeReady())}_onChannelClose(){this.destroyed||(this._debug("on channel close"),this.destroy())}_onTrack(e){this.destroyed||e.streams.forEach(t=>{this._debug("on track"),this.emit("track",e.track,t),this._remoteTracks.push({track:e.track,stream:t}),this._remoteStreams.some(e=>e.id===t.id)||(this._remoteStreams.push(t),n(()=>{this.emit("stream",t)}))})}_debug(){var t=[].slice.call(arguments);t[0]="["+this._id+"] "+t[0],e.apply(null,t)}}l.WEBRTC_SUPPORT=!!t(),l.config={iceServers:[{urls:["stun:stun.l.google.com:19302","stun:global.stun.twilio.com:3478"]}],sdpSemantics:"unified-plan"},l.channelConfig={},module.exports=l;
|
||
},{"debug":"j+D9","get-browser-rtc":"bJJC","randombytes":"pXr2","readable-stream":"oo/5","queue-microtask":"IVZi","err-code":"1zRU"}],"U5wz":[function(require,module,exports) {
|
||
"use strict";var t=require("ip-regex"),e=function(e){return t({exact:!0}).test(e)};e.v4=function(e){return t.v4({exact:!0}).test(e)},e.v6=function(e){return t.v6({exact:!0}).test(e)},e.version=function(t){return e(t)?e.v4(t)?4:6:void 0},module.exports=e;
|
||
},{"ip-regex":"rpx5"}],"4BDO":[function(require,module,exports) {
|
||
"use strict";function e(e,n){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=t(e))||n&&e&&"number"==typeof e.length){r&&(e=r);var o=0,i=function(){};return{s:i,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,c=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return c=e.done,e},e:function(e){u=!0,a=e},f:function(){try{c||null==r.return||r.return()}finally{if(u)throw a}}}}function t(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var a=require("./util"),c=a.encodeText,u=function(){function t(e,n,o,i){r(this,t),this.name=e,this.code=n,this.codeBuf=c(this.code),this.alphabet=i,this.codec=o(i)}return i(t,[{key:"encode",value:function(e){return this.codec.encode(e)}},{key:"decode",value:function(t){var n,r=e(t);try{for(r.s();!(n=r.n()).done;){var o=n.value;if(this.alphabet&&this.alphabet.indexOf(o)<0)throw new Error("invalid character '".concat(o,"' in '").concat(t,"'"))}}catch(i){r.e(i)}finally{r.f()}return this.codec.decode(t)}}]),t}();module.exports=u;
|
||
},{"./util":"4dv8"}],"ksbc":[function(require,module,exports) {
|
||
"use strict";var e=require("@multiformats/base-x"),a=require("./base.js"),r=require("./rfc4648"),s=r.rfc4648,b=require("./util"),u=b.decodeText,p=b.encodeText,d=function(){return{encode:u,decode:p}},t=[["identity","\0",d,""],["base2","0",s(1),"01"],["base8","7",s(3),"01234567"],["base10","9",e,"0123456789"],["base16","f",s(4),"0123456789abcdef"],["base16upper","F",s(4),"0123456789ABCDEF"],["base32hex","v",s(5),"0123456789abcdefghijklmnopqrstuv"],["base32hexupper","V",s(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV"],["base32hexpad","t",s(5),"0123456789abcdefghijklmnopqrstuv="],["base32hexpadupper","T",s(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV="],["base32","b",s(5),"abcdefghijklmnopqrstuvwxyz234567"],["base32upper","B",s(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"],["base32pad","c",s(5),"abcdefghijklmnopqrstuvwxyz234567="],["base32padupper","C",s(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567="],["base32z","h",s(5),"ybndrfg8ejkmcpqxot1uwisza345h769"],["base36","k",e,"0123456789abcdefghijklmnopqrstuvwxyz"],["base36upper","K",e,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"],["base58btc","z",e,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],["base58flickr","Z",e,"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"],["base64","m",s(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],["base64pad","M",s(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],["base64url","u",s(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"],["base64urlpad","U",s(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="]],c=t.reduce(function(e,r){return e[r[0]]=new a(r[0],r[1],r[2],r[3]),e},{}),n=t.reduce(function(e,a){return e[a[1]]=c[a[0]],e},{});module.exports={names:c,codes:n};
|
||
},{"@multiformats/base-x":"zMOB","./base.js":"4BDO","./rfc4648":"hH6x","./util":"4dv8"}],"AD4F":[function(require,module,exports) {
|
||
"use strict";var e=require("./constants"),r=require("./util"),t=r.encodeText,n=r.decodeText,o=r.concat;function c(e,r){if(!r)throw new Error("requires an encoded Uint8Array");var t=u(e),n=t.name,c=t.codeBuf;return d(n,r),o([c,r],c.length+r.length)}function s(e,r){var n=u(e),c=t(n.encode(r));return o([n.codeBuf,c],n.codeBuf.length+c.length)}function a(e){e instanceof Uint8Array&&(e=n(e));var r=e[0];return["f","F","v","V","t","T","b","B","c","C","h","k","K"].includes(r)&&(e=e.toLowerCase()),u(e[0]).decode(e.substring(1))}function i(e){if(e instanceof Uint8Array&&(e=n(e)),"[object String]"!==Object.prototype.toString.call(e))return!1;try{return u(e[0]).name}catch(r){return!1}}function d(e,r){u(e).decode(n(r))}function u(r){if(Object.prototype.hasOwnProperty.call(e.names,r))return e.names[r];if(Object.prototype.hasOwnProperty.call(e.codes,r))return e.codes[r];throw new Error("Unsupported encoding: ".concat(r))}function f(e){return e instanceof Uint8Array&&(e=n(e)),u(e[0])}exports=module.exports=c,exports.encode=s,exports.decode=a,exports.isEncoded=i,exports.encoding=u,exports.encodingFromData=f;var p=Object.freeze(e.names),l=Object.freeze(e.codes);exports.names=p,exports.codes=l;
|
||
},{"./constants":"ksbc","./util":"4dv8"}],"4DOX":[function(require,module,exports) {
|
||
"use strict";const{encoding:e}=require("multibase"),t=new TextDecoder("utf8");function n(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t}function r(r,o="utf8"){return"utf8"===o||"utf-8"===o?t.decode(r):"ascii"===o?n(r):e(o).encode(r)}module.exports=r;
|
||
},{"multibase":"AD4F"}],"rrbz":[function(require,module,exports) {
|
||
"use strict";const e=require("is-ip"),t=require("uint8arrays/to-string"),n=e,i=e.v4,r=e.v6,s=function(e,n,l){let o;if(l=~~l,i(e))o=n||new Uint8Array(l+4),e.split(/\./g).map(function(e){o[l++]=255&parseInt(e,10)});else if(r(e)){const r=e.split(":",8);let p;for(p=0;p<r.length;p++){var f;i(r[p])&&(f=s(r[p]),r[p]=t(f.slice(0,2),"base16")),f&&++p<8&&r.splice(p,0,t(f.slice(2,4),"base16"))}if(""===r[0])for(;r.length<8;)r.unshift("0");else if(""===r[r.length-1])for(;r.length<8;)r.push("0");else if(r.length<8){for(p=0;p<r.length&&""!==r[p];p++);const e=[p,"1"];for(p=9-r.length;p>0;p--)e.push("0");r.splice.apply(r,e)}for(o=n||new Uint8Array(l+16),p=0;p<r.length;p++){const e=parseInt(r[p],16);o[l++]=e>>8&255,o[l++]=255&e}}if(!o)throw Error("Invalid ip address: "+e);return o},l=function(e,t,n){t=~~t,n=n||e.length-t;const i=[];let r;const s=new DataView(e.buffer);if(4===n){for(let r=0;r<n;r++)i.push(e[t+r]);r=i.join(".")}else if(16===n){for(let e=0;e<n;e+=2)i.push(s.getUint16(t+e).toString(16));r=(r=(r=i.join(":")).replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3")).replace(/:{3,4}/,"::")}return r};module.exports={isIP:n,isV4:i,isV6:r,toBytes:s,toString:l};
|
||
},{"is-ip":"U5wz","uint8arrays/to-string":"4DOX"}],"qVmj":[function(require,module,exports) {
|
||
module.exports={encode:require("./encode.js"),decode:require("./decode.js"),encodingLength:require("./length.js")};
|
||
},{"./encode.js":"Q/oY","./decode.js":"J29v","./length.js":"Bq+a"}],"PrhT":[function(require,module,exports) {
|
||
"use strict";const{encoding:e}=require("multibase"),t=new TextEncoder;function n(e){const t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}function r(r,o="utf8"){return"utf8"===o||"utf-8"===o?t.encode(r):"ascii"===o?n(r):e(o).decode(r)}module.exports=r;
|
||
},{"multibase":"AD4F"}],"24WO":[function(require,module,exports) {
|
||
"use strict";var r=require("multibase"),e=require("varint"),n=require("./constants"),t=n.names,o=require("uint8arrays/to-string"),i=require("uint8arrays/from-string"),a=require("uint8arrays/concat"),c={};for(var s in t){var u=s;c[t[u]]=u}function d(r){if(!(r instanceof Uint8Array))throw new Error("must be passed a Uint8Array");return o(r,"base16")}function h(r){return i(r,"base16")}function f(e){if(!(e instanceof Uint8Array))throw new Error("must be passed a Uint8Array");return o(r.encode("base58btc",e)).slice(1)}function l(e){var n=e instanceof Uint8Array?o(e):e;return r.decode("z"+n)}function w(r){if(!(r instanceof Uint8Array))throw new Error("multihash must be a Uint8Array");if(r.length<2)throw new Error("multihash too short. must be > 2 bytes.");var n=e.decode(r);if(!y(n))throw new Error("multihash unknown function code: 0x".concat(n.toString(16)));r=r.slice(e.decode.bytes);var t=e.decode(r);if(t<0)throw new Error("multihash invalid length: ".concat(t));if((r=r.slice(e.decode.bytes)).length!==t)throw new Error("multihash length inconsistent: 0x".concat(o(r,"base16")));return{code:n,name:c[n],length:t,digest:r}}function g(r,n,t){if(!r||void 0===n)throw new Error("multihash encode requires at least two args: digest, code");var o=m(n);if(!(r instanceof Uint8Array))throw new Error("digest should be a Uint8Array");if(null==t&&(t=r.length),t&&r.length!==t)throw new Error("digest length should be equal to specified length.");var i=e.encode(o),c=e.encode(t);return a([i,c,r],i.length+c.length+r.length)}function m(r){var e=r;if("string"==typeof r){if(void 0===t[r])throw new Error("Unrecognized hash function named: ".concat(r));e=t[r]}if("number"!=typeof e)throw new Error("Hash function code should be a number. Got: ".concat(e));if(void 0===c[e]&&!b(e))throw new Error("Unrecognized function code: ".concat(e));return e}function b(r){return r>0&&r<16}function y(r){return!!b(r)||!!c[r]}function v(r){w(r)}function E(r){return v(r),r.subarray(0,2)}Object.freeze(c),module.exports={names:t,codes:c,toHexString:d,fromHexString:h,toB58String:f,fromB58String:l,decode:w,encode:g,coerceCode:m,isAppCode:b,validate:v,prefix:E,isValidCode:y};
|
||
},{"multibase":"AD4F","varint":"qVmj","./constants":"AwpH","uint8arrays/to-string":"4DOX","uint8arrays/from-string":"PrhT","uint8arrays/concat":"qYui"}],"muwA":[function(require,module,exports) {
|
||
module.exports={encode:require("./encode.js"),decode:require("./decode.js"),encodingLength:require("./length.js")};
|
||
},{"./encode.js":"Q/oY","./decode.js":"J29v","./length.js":"Bq+a"}],"BQqo":[function(require,module,exports) {
|
||
"use strict";const r=require("varint"),n=require("uint8arrays/to-string"),t=require("uint8arrays/from-string");function e(r){return parseInt(n(r,"base16"),16)}function i(r){let n=r.toString(16);return n.length%2==1&&(n="0"+n),t(n,"base16")}function o(n){return Uint8Array.from(r.encode(e(n)))}function u(n){return Uint8Array.from(r.encode(n))}module.exports={numberToUint8Array:i,uint8ArrayToNumber:e,varintUint8ArrayEncode:o,varintEncode:u};
|
||
},{"varint":"muwA","uint8arrays/to-string":"4DOX","uint8arrays/from-string":"PrhT"}],"v44N":[function(require,module,exports) {
|
||
"use strict";const{baseTable:e}=require("./generated-table"),t=require("./util").varintEncode,o={},r={},c={};for(const a in e){const n=a,s=e[n];o[n]=t(s),r[n.toUpperCase().replace(/-/g,"_")]=s,c[s]||(c[s]=n)}Object.freeze(o),Object.freeze(r),Object.freeze(c);const n=Object.freeze(e);module.exports={nameToVarint:o,constantToCode:r,nameToCode:n,codeToName:c};
|
||
},{"./generated-table":"oX+Q","./util":"BQqo"}],"W4jW":[function(require,module,exports) {
|
||
"use strict";const e=require("varint"),n=require("uint8arrays/concat"),r=require("./util"),{nameToVarint:t,constantToCode:o,nameToCode:i,codeToName:u}=require("./maps");function c(e,o){let i;if(e instanceof Uint8Array)i=r.varintUint8ArrayEncode(e);else{if(!t[e])throw new Error("multicodec not recognized");i=t[e]}return n([i,o],i.length+o.length)}function d(n){return e.decode(n),n.slice(e.decode.bytes)}function a(n){const r=e.decode(n),t=u[r];if(void 0===t)throw new Error(`Code "${r}" not found`);return t}function f(e){return u[e]}function m(e){const n=i[e];if(void 0===n)throw new Error(`Codec "${e}" not found`);return n}function g(n){return e.decode(n)}function s(e){const n=t[e];if(void 0===n)throw new Error(`Codec "${e}" not found`);return n}function C(e){return r.varintEncode(e)}function l(e){return a(e)}function w(e){return f(e)}function N(e){return m(e)}function T(e){return g(e)}function h(e){return s(e)}function v(e){return Array.from(C(e))}module.exports={addPrefix:c,rmPrefix:d,getNameFromData:a,getNameFromCode:f,getCodeFromName:m,getCodeFromData:g,getVarintFromName:s,getVarintFromCode:C,getCodec:l,getName:w,getNumber:N,getCode:T,getCodeVarint:h,getVarint:v,...o,nameToVarint:t,nameToCode:i,codeToName:u};
|
||
},{"varint":"muwA","uint8arrays/concat":"qYui","./util":"BQqo","./maps":"v44N"}],"4r3t":[function(require,module,exports) {
|
||
"use strict";const e=require("multihashes"),t={checkCIDComponents:function(t){if(null==t)return"null values are not valid CIDs";if(0!==t.version&&1!==t.version)return"Invalid version, must be a number equal to 1 or 0";if("string"!=typeof t.codec)return"codec must be string";if(0===t.version){if("dag-pb"!==t.codec)return"codec must be 'dag-pb' for CIDv0";if("base58btc"!==t.multibaseName)return"multibaseName must be 'base58btc' for CIDv0"}if(!(t.multihash instanceof Uint8Array))return"multihash must be a Uint8Array";try{e.validate(t.multihash)}catch(r){let e=r.message;return e||(e="Multihash validation failed"),e}}};module.exports=t;
|
||
},{"multihashes":"24WO"}],"sjA7":[function(require,module,exports) {
|
||
"use strict";const t=require("multihashes"),e=require("multibase"),i=require("multicodec"),s=require("./cid-util"),r=require("uint8arrays/concat"),o=require("uint8arrays/to-string"),h=require("uint8arrays/equals"),n=i.nameToCode,a=Object.keys(n).reduce((t,e)=>(t[n[e]]=e,t),{}),c=Symbol.for("@ipld/js-cid/CID");class u{constructor(s,r,o,h){if(this.version,this.codec,this.multihash,Object.defineProperty(this,c,{value:!0}),u.isCID(s)){const t=s;return this.version=t.version,this.codec=t.codec,this.multihash=t.multihash,void(this.multibaseName=t.multibaseName||(0===t.version?"base58btc":"base32"))}if("string"==typeof s){const r=e.isEncoded(s);if(r){const t=e.decode(s);this.version=parseInt(t[0].toString(),16),this.codec=i.getCodec(t.slice(1)),this.multihash=i.rmPrefix(t.slice(1)),this.multibaseName=r}else this.version=0,this.codec="dag-pb",this.multihash=t.fromB58String(s),this.multibaseName="base58btc";return u.validateCID(this),void Object.defineProperty(this,"string",{value:s})}if(s instanceof Uint8Array){const t=parseInt(s[0].toString(),16);if(1===t){const e=s;this.version=t,this.codec=i.getCodec(e.slice(1)),this.multihash=i.rmPrefix(e.slice(1)),this.multibaseName="base32"}else this.version=0,this.codec="dag-pb",this.multihash=s,this.multibaseName="base58btc";u.validateCID(this)}else this.version=s,"number"==typeof r&&(r=a[r]),this.codec=r,this.multihash=o,this.multibaseName=h||(0===s?"base58btc":"base32"),u.validateCID(this)}get bytes(){let t=this._bytes;if(!t){if(0===this.version)t=this.multihash;else{if(1!==this.version)throw new Error("unsupported version");{const e=i.getCodeVarint(this.codec);t=r([[1],e,this.multihash],1+e.byteLength+this.multihash.byteLength)}}Object.defineProperty(this,"_bytes",{value:t})}return t}get prefix(){const e=i.getCodeVarint(this.codec),s=t.prefix(this.multihash);return r([[this.version],e,s],1+e.byteLength+s.byteLength)}get code(){return n[this.codec]}toV0(){if("dag-pb"!==this.codec)throw new Error("Cannot convert a non dag-pb CID to CIDv0");const{name:e,length:i}=t.decode(this.multihash);if("sha2-256"!==e)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");if(32!==i)throw new Error("Cannot convert non 32 byte multihash CID to CIDv0");return new u(0,this.codec,this.multihash)}toV1(){return new u(1,this.codec,this.multihash)}toBaseEncodedString(i=this.multibaseName){if(this.string&&0!==this.string.length&&i===this.multibaseName)return this.string;let s;if(0===this.version){if("base58btc"!==i)throw new Error("not supported with CIDv0, to support different bases, please migrate the instance do CIDv1, you can do that through cid.toV1()");s=t.toB58String(this.multihash)}else{if(1!==this.version)throw new Error("unsupported version");s=o(e.encode(i,this.bytes))}return i===this.multibaseName&&Object.defineProperty(this,"string",{value:s}),s}[Symbol.for("nodejs.util.inspect.custom")](){return"CID("+this.toString()+")"}toString(t){return this.toBaseEncodedString(t)}toJSON(){return{codec:this.codec,version:this.version,hash:this.multihash}}equals(t){return this.codec===t.codec&&this.version===t.version&&h(this.multihash,t.multihash)}static validateCID(t){const e=s.checkCIDComponents(t);if(e)throw new Error(e)}static isCID(t){return t instanceof u||Boolean(t&&t[c])}}u.codecs=n,module.exports=u;
|
||
},{"multihashes":"24WO","multibase":"AD4F","multicodec":"W4jW","./cid-util":"4r3t","uint8arrays/concat":"qYui","uint8arrays/to-string":"4DOX","uint8arrays/equals":"mZxc"}],"tzA5":[function(require,module,exports) {
|
||
module.exports={encode:require("./encode.js"),decode:require("./decode.js"),encodingLength:require("./length.js")};
|
||
},{"./encode.js":"qYQO","./decode.js":"ZJdu","./length.js":"Bq+a"}],"kd5P":[function(require,module,exports) {
|
||
"use strict";const e=require("./ip"),n=require("./protocols-table"),r=require("cids"),t=require("multibase"),o=require("varint"),s=require("uint8arrays/to-string"),i=require("uint8arrays/from-string"),a=require("uint8arrays/concat");function c(e,n){return n instanceof Uint8Array?c.toString(e,n):c.toBytes(e,n)}function u(n){if(!e.isIP(n))throw new Error("invalid ip address");return e.toBytes(n)}function d(n){const r=e.toString(n);if(!r||!e.isIP(r))throw new Error("invalid ip address");return r}function l(e){const n=new ArrayBuffer(2);return new DataView(n).setUint16(0,e),new Uint8Array(n)}function f(e){return new DataView(e.buffer).getUint16(0)}function h(e){const n=i(e),r=Uint8Array.from(o.encode(n.length));return a([r,n],r.length+n.length)}function g(e){const n=o.decode(e);if((e=e.slice(o.decode.bytes)).length!==n)throw new Error("inconsistent lengths");return s(e)}function w(e){const n=new r(e).multihash,t=Uint8Array.from(o.encode(n.length));return a([t,n],t.length+n.length)}function b(e){const n=o.decode(e),r=e.slice(o.decode.bytes);if(r.length!==n)throw new Error("inconsistent lengths");return s(r,"base58btc")}function p(e){const n=e.split(":");if(2!==n.length)throw new Error("failed to parse onion addr: "+n+" does not contain a port number");if(16!==n[0].length)throw new Error("failed to parse onion addr: "+n[0]+" not a Tor onion address.");const r=t.decode("b"+n[0]),o=parseInt(n[1],10);if(o<1||o>65536)throw new Error("Port number is not in range(1, 65536)");const s=l(o);return a([r,s],r.length+s.length)}function y(e){const n=e.split(":");if(2!==n.length)throw new Error("failed to parse onion addr: "+n+" does not contain a port number");if(56!==n[0].length)throw new Error("failed to parse onion addr: "+n[0]+" not a Tor onion3 address.");const r=t.decode("b"+n[0]),o=parseInt(n[1],10);if(o<1||o>65536)throw new Error("Port number is not in range(1, 65536)");const s=l(o);return a([r,s],r.length+s.length)}function m(e){const n=e.slice(0,e.length-2),r=e.slice(e.length-2);return s(n,"base32")+":"+f(r)}module.exports=c,c.toString=function(e,r){switch(n(e).code){case 4:case 41:return d(r);case 6:case 273:case 33:case 132:return f(r).toString();case 53:case 54:case 55:case 56:case 400:case 777:return g(r);case 421:return b(r);case 444:case 445:return m(r);default:return s(r,"base16")}},c.toBytes=function(e,r){switch(n(e).code){case 4:case 41:return u(r);case 6:case 273:case 33:case 132:return l(parseInt(r,10));case 53:case 54:case 55:case 56:case 400:case 777:return h(r);case 421:return w(r);case 444:return p(r);case 445:return y(r);default:return i(r,"base16")}};
|
||
},{"./ip":"rrbz","./protocols-table":"f6b+","cids":"sjA7","multibase":"AD4F","varint":"tzA5","uint8arrays/to-string":"4DOX","uint8arrays/from-string":"PrhT","uint8arrays/concat":"qYui"}],"eff2":[function(require,module,exports) {
|
||
"use strict";const r=require("./convert"),t=require("./protocols-table"),e=require("varint"),n=require("uint8arrays/concat"),o=require("uint8arrays/to-string");function i(r){const e=[],n=r.split("/").slice(1);if(1===n.length&&""===n[0])return[];for(let o=0;o<n.length;o++){const i=n[o],s=t(i);if(0!==s.size){if(++o>=n.length)throw b("invalid address: "+r);if(s.path){e.push([i,m(n.slice(o).join("/"))]);break}e.push([i,n[o]])}else e.push([i])}return e}function s(r){const t=[];return r.map(r=>{const e=v(r);return t.push(e.name),r.length>1&&t.push(r[1]),null}),m(t.join("/"))}function u(t){return t.map(t=>{Array.isArray(t)||(t=[t]);const e=v(t);return t.length>1?[e.code,r.toBytes(e.code,t[1])]:[e.code]})}function c(t){return t.map(t=>{const e=v(t);return t[1]?[e.code,r.toString(e.code,t[1])]:[e.code]})}function l(r){return g(n(r.map(r=>{const t=v(r);let o=Uint8Array.from(e.encode(t.code));return r.length>1&&(o=n([o,r[1]])),o})))}function a(r,t){if(r.size>0)return r.size/8;if(0===r.size)return 0;return e.decode(t)+e.decode.bytes}function f(r){const n=[];let i=0;for(;i<r.length;){const s=e.decode(r,i),u=e.decode.bytes,c=a(t(s),r.slice(i+u));if(0===c){n.push([s]),i+=u;continue}const l=r.slice(i+u,i+u+c);if((i+=c+u)>r.length)throw b("Invalid address Uint8Array: "+o(r,"base16"));n.push([s,l])}return n}function d(r){return s(c(f(r)))}function p(r){return l(u(i(r=m(r))))}function h(r){return p(r)}function g(r){const t=y(r);if(t)throw t;return Uint8Array.from(r)}function y(r){try{f(r)}catch(t){return t}}function T(r){return void 0===y(r)}function m(r){return"/"+r.trim().split("/").filter(r=>r).join("/")}function b(r){return new Error("Error parsing address: "+r)}function v(r){return t(r[0])}module.exports={stringToStringTuples:i,stringTuplesToString:s,tuplesToStringTuples:c,stringTuplesToTuples:u,bytesToTuples:f,tuplesToBytes:l,bytesToString:d,stringToBytes:p,fromString:h,fromBytes:g,validateBytes:y,isValidBytes:T,cleanPath:m,ParseError:b,protoFromTuple:v,sizeForAddr:a};
|
||
},{"./convert":"kd5P","./protocols-table":"f6b+","varint":"tzA5","uint8arrays/concat":"qYui","uint8arrays/to-string":"4DOX"}],"fkAK":[function(require,module,exports) {
|
||
"use strict";const t=require("./codec"),r=require("./protocols-table"),e=require("varint"),s=require("cids"),o=require("err-code"),i=Symbol.for("nodejs.util.inspect.custom"),n=require("uint8arrays/to-string"),a=require("uint8arrays/equals"),l=new Map,u=Symbol.for("@multiformats/js-multiaddr/multiaddr");class d{constructor(r){if(null==r&&(r=""),Object.defineProperty(this,u,{value:!0}),r instanceof Uint8Array)this.bytes=t.fromBytes(r);else if("string"==typeof r){if(r.length>0&&"/"!==r.charAt(0))throw new Error(`multiaddr "${r}" must start with a "/"`);this.bytes=t.fromString(r)}else{if(!d.isMultiaddr(r))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=t.fromBytes(r.bytes)}}toString(){return t.bytesToString(this.bytes)}toJSON(){return this.toString()}toOptions(){const t={},r=this.toString().split("/");return t.family="ip4"===r[1]?4:6,t.host=r[2],t.transport=r[3],t.port=parseInt(r[4]),t}protos(){return this.protoCodes().map(t=>Object.assign({},r(t)))}protoCodes(){const s=[],o=this.bytes;let i=0;for(;i<o.length;){const n=e.decode(o,i),a=e.decode.bytes,l=r(n);i+=t.sizeForAddr(l,o.slice(i+a))+a,s.push(n)}return s}protoNames(){return this.protos().map(t=>t.name)}tuples(){return t.bytesToTuples(this.bytes)}stringTuples(){const r=t.bytesToTuples(this.bytes);return t.tuplesToStringTuples(r)}encapsulate(t){return t=new d(t),new d(this.toString()+t.toString())}decapsulate(t){const r=t.toString(),e=this.toString(),s=e.lastIndexOf(r);if(s<0)throw new Error("Address "+this+" does not contain subaddress: "+t);return new d(e.slice(0,s))}decapsulateCode(r){const e=this.tuples();for(let s=e.length-1;s>=0;s--)if(e[s][0]===r)return new d(t.tuplesToBytes(e.slice(0,s)));return this}getPeerId(){try{const e=this.stringTuples().filter(t=>t[0]===r.names.ipfs.code).pop();return e&&e[1]?n(new s(e[1]).multihash,"base58btc"):null}catch(t){return null}}getPath(){let t=null;try{(t=this.stringTuples().filter(t=>{return!!r(t[0]).path})[0][1])||(t=null)}catch(e){t=null}return t}equals(t){return a(this.bytes,t.bytes)}async resolve(){const t=this.protos().find(t=>t.resolvable);if(!t)return[this];const r=l.get(t.name);if(!r)throw o(new Error(`no available resolver for ${t.name}`),"ERR_NO_AVAILABLE_RESOLVER");return(await r(this)).map(t=>new d(t))}nodeAddress(){const t=this.protoCodes(),r=this.protoNames(),e=this.toString().split("/").slice(1);if(e.length<4)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6}/{address}/{tcp, udp}/{port}".');if(4!==t[0]&&41!==t[0]&&54!==t[0]&&55!==t[0])throw new Error(`no protocol with name: "'${r[0]}'". Must have a valid family name: "{ip4, ip6, dns4, dns6}".`);if("tcp"!==e[2]&&"udp"!==e[2])throw new Error(`no protocol with name: "'${r[1]}'". Must have a valid transport protocol: "{tcp, udp}".`);return{family:41===t[0]||55===t[0]?6:4,address:e[1],port:parseInt(e[3])}}isThinWaistAddress(t){const r=(t||this).protos();return 2===r.length&&((4===r[0].code||41===r[0].code)&&(6===r[1].code||273===r[1].code))}static fromNodeAddress(t,r){if(!t)throw new Error("requires node address object");if(!r)throw new Error("requires transport protocol");let e;switch(t.family){case 4:e="ip4";break;case 6:e="ip6";break;default:throw Error(`Invalid addr family. Got '${t.family}' instead of 4 or 6`)}return new d("/"+[e,t.address,r,t.port].join("/"))}static isName(t){return!!d.isMultiaddr(t)&&t.protos().some(t=>t.resolvable)}static isMultiaddr(t){return t instanceof d||Boolean(t&&t[u])}[i](){return"<Multiaddr "+n(this.bytes,"base16")+" - "+t.bytesToString(this.bytes)+">"}inspect(){return"<Multiaddr "+n(this.bytes,"base16")+" - "+t.bytesToString(this.bytes)+">"}}function p(t){return new d(t)}d.protocols=r,d.resolvers=l,module.exports={Multiaddr:d,multiaddr:p,protocols:r,resolvers:l};
|
||
},{"./codec":"eff2","./protocols-table":"f6b+","varint":"tzA5","cids":"sjA7","err-code":"hLMW","uint8arrays/to-string":"4DOX","uint8arrays/equals":"mZxc"}],"ZmIw":[function(require,module,exports) {
|
||
"use strict";const{Multiaddr:t}=require("multiaddr"),r=C("dns4"),p=C("dns6"),e=C("dnsaddr"),n=N(C("dns"),e,r,p),c=N(C("ip4"),C("ip6")),i=N(y(c,C("tcp")),y(n,C("tcp"))),u=y(c,C("udp")),s=y(u,C("utp")),a=y(u,C("quic")),o=N(y(i,C("ws")),y(n,C("ws"))),l=N(y(i,C("wss")),y(n,C("wss"))),h=N(y(i,C("http")),y(c,C("http")),y(n,C("http"))),d=N(y(i,C("https")),y(c,C("https")),y(n,C("https"))),f=N(y(o,C("p2p-webrtc-star"),C("p2p")),y(l,C("p2p-webrtc-star"),C("p2p")),y(o,C("p2p-webrtc-star")),y(l,C("p2p-webrtc-star"))),b=N(y(o,C("p2p-websocket-star"),C("p2p")),y(l,C("p2p-websocket-star"),C("p2p")),y(o,C("p2p-websocket-star")),y(l,C("p2p-websocket-star"))),w=N(y(h,C("p2p-webrtc-direct"),C("p2p")),y(d,C("p2p-webrtc-direct"),C("p2p")),y(h,C("p2p-webrtc-direct")),y(d,C("p2p-webrtc-direct"))),S=N(o,l,h,d,f,w,i,s,a,n),g=N(y(S,C("p2p-stardust"),C("p2p")),y(S,C("p2p-stardust"))),m=N(y(S,C("p2p")),f,w,C("p2p")),M=N(y(m,C("p2p-circuit"),m),y(m,C("p2p-circuit")),y(C("p2p-circuit"),m),y(S,C("p2p-circuit")),y(C("p2p-circuit"),S),C("p2p-circuit")),P=()=>N(y(M,P),M),D=P(),T=N(y(D,m,D),y(m,D),y(D,m),D,m);function k(r){return function(p){if(!t.isMultiaddr(p))try{p=new t(p)}catch(n){return!1}const e=r(p.protoNames());return null!==e&&(!0===e||!1===e?e:0===e.length)}}function y(...t){function r(r){if(r.length<t.length)return null;let p=r;return t.some(t=>(p="function"==typeof t?t().partialMatch(r):t.partialMatch(r),Array.isArray(p)&&(r=p),null===p)),p}return{toString:function(){return"{ "+t.join(" ")+" }"},input:t,matches:k(r),partialMatch:r}}function N(...t){function r(r){let p=null;return t.some(t=>{const e="function"==typeof t?t().partialMatch(r):t.partialMatch(r);return!!e&&(p=e,!0)}),p}return{toString:function(){return"{ "+t.join(" ")+" }"},input:t,matches:k(r),partialMatch:r}}function C(r){const p=r;return{toString:function(){return p},matches:function(r){if("string"==typeof r)try{r=new t(r)}catch(n){return!1}const e=r.protoNames();return 1===e.length&&e[0]===p},partialMatch:function(t){return 0===t.length?null:t[0]===p?t.slice(1):null}}}module.exports={DNS:n,DNS4:r,DNS6:p,DNSADDR:e,IP:c,TCP:i,UDP:u,QUIC:a,UTP:s,HTTP:h,HTTPS:d,WebSockets:o,WebSocketsSecure:l,WebSocketStar:b,WebRTCStar:f,WebRTCDirect:w,Reliable:S,Stardust:g,Circuit:D,P2P:T,IPFS:T};
|
||
},{"multiaddr":"fkAK"}],"J3Xk":[function(require,module,exports) {
|
||
var global = arguments[3];
|
||
var e,d=arguments[3];e="undefined"!=typeof window?window:void 0!==d?d:"undefined"!=typeof self?self:{},module.exports=e;
|
||
},{}],"TfiX":[function(require,module,exports) {
|
||
module.exports=t;var o=Object.prototype.toString;function t(t){if(!t)return!1;var n=o.call(t);return"[object Function]"===n||"function"==typeof t&&"[object RegExp]"!==n||"undefined"!=typeof window&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)}
|
||
},{}],"spMt":[function(require,module,exports) {
|
||
var r=function(r){return r.replace(/^\s+|\s+$/g,"")},e=function(r){return"[object Array]"===Object.prototype.toString.call(r)};module.exports=function(t){if(!t)return{};for(var n={},o=r(t).split("\n"),i=0;i<o.length;i++){var c=o[i],u=c.indexOf(":"),l=r(c.slice(0,u)).toLowerCase(),s=r(c.slice(u+1));void 0===n[l]?n[l]=s:e(n[l])?n[l].push(s):n[l]=[n[l],s]}return n};
|
||
},{}],"YxsI":[function(require,module,exports) {
|
||
module.exports=o;var r=Object.prototype.hasOwnProperty;function o(){for(var o={},t=0;t<arguments.length;t++){var e=arguments[t];for(var a in e)r.call(e,a)&&(o[a]=e[a])}return o}
|
||
},{}],"sjC2":[function(require,module,exports) {
|
||
"use strict";var e=require("global/window"),t=require("is-function"),r=require("parse-headers"),n=require("xtend");function o(e,t){for(var r=0;r<e.length;r++)t(e[r])}function s(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}function u(e,r,o){var s=e;return t(r)?(o=r,"string"==typeof e&&(s={uri:e})):s=n(r,{uri:e}),s.callback=o,s}function a(e,t,r){return i(t=u(e,t,r))}function i(e){if(void 0===e.callback)throw new Error("callback argument missing");var t=!1,n=function(r,n,o){t||(t=!0,e.callback(r,n,o))};function o(){var e=void 0;if(e=l.response?l.response:l.responseText||d(l),R)try{e=JSON.parse(e)}catch(t){}return e}function u(e){return clearTimeout(f),e instanceof Error||(e=new Error(""+(e||"Unknown XMLHttpRequest Error"))),e.statusCode=0,n(e,X)}function i(){if(!c){var t;clearTimeout(f),t=e.useXDR&&void 0===l.status?200:1223===l.status?204:l.status;var s=X,u=null;return 0!==t?(s={body:o(),statusCode:t,method:m,headers:{},url:h,rawRequest:l},l.getAllResponseHeaders&&(s.headers=r(l.getAllResponseHeaders()))):u=new Error("Internal XMLHttpRequest Error"),n(u,s,s.body)}}var p,c,l=e.xhr||null;l||(l=e.cors||e.useXDR?new a.XDomainRequest:new a.XMLHttpRequest);var f,h=l.url=e.uri||e.url,m=l.method=e.method||"GET",y=e.body||e.data,w=l.headers=e.headers||{},q=!!e.sync,R=!1,X={body:void 0,headers:{},statusCode:0,method:m,url:h,rawRequest:l};if("json"in e&&!1!==e.json&&(R=!0,w.accept||w.Accept||(w.Accept="application/json"),"GET"!==m&&"HEAD"!==m&&(w["content-type"]||w["Content-Type"]||(w["Content-Type"]="application/json"),y=JSON.stringify(!0===e.json?y:e.json))),l.onreadystatechange=function(){4===l.readyState&&setTimeout(i,0)},l.onload=i,l.onerror=u,l.onprogress=function(){},l.onabort=function(){c=!0},l.ontimeout=u,l.open(m,h,!q,e.username,e.password),q||(l.withCredentials=!!e.withCredentials),!q&&e.timeout>0&&(f=setTimeout(function(){if(!c){c=!0,l.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",u(e)}},e.timeout)),l.setRequestHeader)for(p in w)w.hasOwnProperty(p)&&l.setRequestHeader(p,w[p]);else if(e.headers&&!s(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(l.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(l),l.send(y||null),l}function d(e){try{if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML}catch(r){}return null}function p(){}module.exports=a,module.exports.default=a,a.XMLHttpRequest=e.XMLHttpRequest||p,a.XDomainRequest="withCredentials"in new a.XMLHttpRequest?a.XMLHttpRequest:e.XDomainRequest,o(["get","put","post","patch","head","delete"],function(e){a["delete"===e?"del":e]=function(t,r,n){return(r=u(t,r,n)).method=e.toUpperCase(),i(r)}});
|
||
},{"global/window":"J3Xk","is-function":"TfiX","parse-headers":"spMt","xtend":"YxsI"}],"LrYp":[function(require,module,exports) {
|
||
const o=require("get-iterator"),r=require("./AbortError"),t=(o,r,t)=>e(o,Array.isArray(r)?r:[{signal:r,options:t}]),e=(t,e)=>{return t=o(t),e=e.map(({signal:o,options:r})=>({signal:o,options:r||{}})),async function*(){let o;const n=()=>{o&&o()};for(const{signal:r}of e)r.addEventListener("abort",n);for(;;){let i;try{for(const{signal:o,options:t}of e)if(o.aborted){const{abortMessage:o,abortCode:e}=t;throw new r(o,e)}const a=new Promise((t,n)=>{o=(()=>{const{options:o}=e.find(({signal:o})=>o.aborted),{abortMessage:t,abortCode:s}=o;n(new r(t,s))})});i=await Promise.race([a,t.next()]),o=null}catch(s){for(const{signal:t}of e)t.removeEventListener("abort",n);const o=e.find(({signal:o})=>o.aborted),r="aborted"===s.type&&o;if(r&&o.options.onAbort&&await o.options.onAbort(t),"function"==typeof t.return&&await t.return(),r&&o.options.returnOnAbort)return;throw s}if(i.done)break;yield i.value}for(const{signal:r}of e)r.removeEventListener("abort",n)}()},n=(o,r,t)=>s(o,Array.isArray(r)?r:[{signal:r,options:t}]),s=(o,r)=>t=>o(e(t,r)),i=(o,r,t)=>a(o,Array.isArray(r)?r:[{signal:r,options:t}]),a=(o,r)=>({sink:s(o.sink,r),source:e(o.source,r)});module.exports=t,module.exports.AbortError=r,module.exports.source=t,module.exports.sink=n,module.exports.transform=n,module.exports.duplex=i;
|
||
},{"get-iterator":"b5QV","./AbortError":"uy6m"}],"tkwk":[function(require,module,exports) {
|
||
"use strict";exports.CODE_P2P=421,exports.CODE_CIRCUIT=290,module.exports.CLOSE_TIMEOUT=2e3;
|
||
},{}],"eW7r":[function(require,module,exports) {
|
||
module.exports=(e=>{if(e[Symbol.asyncIterator])return e;if(e.getReader)return async function*(){const r=e.getReader();try{for(;;){const{done:e,value:n}=await r.read();if(e)return;yield n}}finally{r.releaseLock()}}();throw new Error("unknown stream")});
|
||
},{}],"Y37b":[function(require,module,exports) {
|
||
const e=require("get-iterator");module.exports=(r=>async t=>{t=e(t);const n=e=>{"function"==typeof e.return&&e.return()};let o=null,i=null;const l=e=>{o=e,i&&i(e),n(t)};let s=null,c=!1;const a=()=>{c=!0,s&&s()};let u=null,f=!1;const w=()=>{f=!0,u&&u()};let d=null;const m=()=>{d&&d()},y=()=>new Promise((e,t)=>{s=d=e,i=t,r.once("drain",m)});r.once("error",l),r.once("close",a),r.once("finish",w);try{for await(const e of t){if(!r.writable||r.destroyed||o)break;!1===r.write(e)&&await y()}}catch(h){o||r.destroy(),o=h}try{if(r.writable&&r.end(),await(()=>(n(t),new Promise((e,r)=>{if(c||f||o)return e();u=s=e,i=r})))(),o)throw o}finally{r.removeListener("error",l),r.removeListener("close",a),r.removeListener("finish",w),r.removeListener("drain",m)}});
|
||
},{"get-iterator":"b5QV"}],"iy7o":[function(require,module,exports) {
|
||
const e=require("./sink"),r=require("./source");module.exports=(s=>({sink:e(s),source:r(s)}));
|
||
},{"./sink":"Y37b","./source":"eW7r"}],"QCwn":[function(require,module,exports) {
|
||
const c=require("./duplex");module.exports=(e=>(async function*(n){const o=c(e);o.sink(n).catch(c=>{}),yield*o.source}));
|
||
},{"./duplex":"iy7o"}],"/BKi":[function(require,module,exports) {
|
||
module.exports=require("./source"),module.exports.source=require("./source"),module.exports.sink=require("./sink"),module.exports.transform=require("./transform"),module.exports.duplex=require("./duplex");
|
||
},{"./source":"eW7r","./sink":"Y37b","./transform":"QCwn","./duplex":"iy7o"}],"0jeg":[function(require,module,exports) {
|
||
module.exports={encode:require("./encode.js"),decode:require("./decode.js"),encodingLength:require("./length.js")};
|
||
},{"./encode.js":"Q/oY","./decode.js":"J29v","./length.js":"Bq+a"}],"i1rk":[function(require,module,exports) {
|
||
"use strict";var r=require("multibase"),e=require("varint"),n=require("./constants"),t=n.names,o=require("uint8arrays/to-string"),i=require("uint8arrays/from-string"),a=require("uint8arrays/concat"),c={};for(var s in t){var u=s;c[t[u]]=u}function d(r){if(!(r instanceof Uint8Array))throw new Error("must be passed a Uint8Array");return o(r,"base16")}function h(r){return i(r,"base16")}function f(e){if(!(e instanceof Uint8Array))throw new Error("must be passed a Uint8Array");return o(r.encode("base58btc",e)).slice(1)}function l(e){var n=e instanceof Uint8Array?o(e):e;return r.decode("z"+n)}function w(r){if(!(r instanceof Uint8Array))throw new Error("multihash must be a Uint8Array");if(r.length<2)throw new Error("multihash too short. must be > 2 bytes.");var n=e.decode(r);if(!y(n))throw new Error("multihash unknown function code: 0x".concat(n.toString(16)));r=r.slice(e.decode.bytes);var t=e.decode(r);if(t<0)throw new Error("multihash invalid length: ".concat(t));if((r=r.slice(e.decode.bytes)).length!==t)throw new Error("multihash length inconsistent: 0x".concat(o(r,"base16")));return{code:n,name:c[n],length:t,digest:r}}function g(r,n,t){if(!r||void 0===n)throw new Error("multihash encode requires at least two args: digest, code");var o=m(n);if(!(r instanceof Uint8Array))throw new Error("digest should be a Uint8Array");if(null==t&&(t=r.length),t&&r.length!==t)throw new Error("digest length should be equal to specified length.");var i=e.encode(o),c=e.encode(t);return a([i,c,r],i.length+c.length+r.length)}function m(r){var e=r;if("string"==typeof r){if(void 0===t[r])throw new Error("Unrecognized hash function named: ".concat(r));e=t[r]}if("number"!=typeof e)throw new Error("Hash function code should be a number. Got: ".concat(e));if(void 0===c[e]&&!b(e))throw new Error("Unrecognized function code: ".concat(e));return e}function b(r){return r>0&&r<16}function y(r){return!!b(r)||!!c[r]}function v(r){w(r)}function E(r){return v(r),r.subarray(0,2)}Object.freeze(c),module.exports={names:t,codes:c,toHexString:d,fromHexString:h,toB58String:f,fromB58String:l,decode:w,encode:g,coerceCode:m,isAppCode:b,validate:v,prefix:E,isValidCode:y};
|
||
},{"multibase":"AD4F","varint":"0jeg","./constants":"AwpH","uint8arrays/to-string":"4DOX","uint8arrays/from-string":"PrhT","uint8arrays/concat":"qYui"}],"I99G":[function(require,module,exports) {
|
||
module.exports={encode:require("./encode.js"),decode:require("./decode.js"),encodingLength:require("./length.js")};
|
||
},{"./encode.js":"Q/oY","./decode.js":"J29v","./length.js":"Bq+a"}],"JXSe":[function(require,module,exports) {
|
||
"use strict";const r=require("varint"),n=require("uint8arrays/to-string"),t=require("uint8arrays/from-string");function e(r){return parseInt(n(r,"base16"),16)}function i(r){let n=r.toString(16);return n.length%2==1&&(n="0"+n),t(n,"base16")}function o(n){return Uint8Array.from(r.encode(e(n)))}function u(n){return Uint8Array.from(r.encode(n))}module.exports={numberToUint8Array:i,uint8ArrayToNumber:e,varintUint8ArrayEncode:o,varintEncode:u};
|
||
},{"varint":"I99G","uint8arrays/to-string":"4DOX","uint8arrays/from-string":"PrhT"}],"cotA":[function(require,module,exports) {
|
||
"use strict";const{baseTable:e}=require("./generated-table"),t=require("./util").varintEncode,o={},r={},c={};for(const a in e){const n=a,s=e[n];o[n]=t(s),r[n.toUpperCase().replace(/-/g,"_")]=s,c[s]||(c[s]=n)}Object.freeze(o),Object.freeze(r),Object.freeze(c);const n=Object.freeze(e);module.exports={nameToVarint:o,constantToCode:r,nameToCode:n,codeToName:c};
|
||
},{"./generated-table":"oX+Q","./util":"JXSe"}],"YXGS":[function(require,module,exports) {
|
||
"use strict";const e=require("varint"),n=require("uint8arrays/concat"),r=require("./util"),{nameToVarint:t,constantToCode:o,nameToCode:i,codeToName:u}=require("./maps");function c(e,o){let i;if(e instanceof Uint8Array)i=r.varintUint8ArrayEncode(e);else{if(!t[e])throw new Error("multicodec not recognized");i=t[e]}return n([i,o],i.length+o.length)}function d(n){return e.decode(n),n.slice(e.decode.bytes)}function a(n){const r=e.decode(n),t=u[r];if(void 0===t)throw new Error(`Code "${r}" not found`);return t}function f(e){return u[e]}function m(e){const n=i[e];if(void 0===n)throw new Error(`Codec "${e}" not found`);return n}function g(n){return e.decode(n)}function s(e){const n=t[e];if(void 0===n)throw new Error(`Codec "${e}" not found`);return n}function C(e){return r.varintEncode(e)}function l(e){return a(e)}function w(e){return f(e)}function N(e){return m(e)}function T(e){return g(e)}function h(e){return s(e)}function v(e){return Array.from(C(e))}module.exports={addPrefix:c,rmPrefix:d,getNameFromData:a,getNameFromCode:f,getCodeFromName:m,getCodeFromData:g,getVarintFromName:s,getVarintFromCode:C,getCodec:l,getName:w,getNumber:N,getCode:T,getCodeVarint:h,getVarint:v,...o,nameToVarint:t,nameToCode:i,codeToName:u};
|
||
},{"varint":"I99G","uint8arrays/concat":"qYui","./util":"JXSe","./maps":"cotA"}],"CXpO":[function(require,module,exports) {
|
||
"use strict";const e=require("multihashes"),t={checkCIDComponents:function(t){if(null==t)return"null values are not valid CIDs";if(0!==t.version&&1!==t.version)return"Invalid version, must be a number equal to 1 or 0";if("string"!=typeof t.codec)return"codec must be string";if(0===t.version){if("dag-pb"!==t.codec)return"codec must be 'dag-pb' for CIDv0";if("base58btc"!==t.multibaseName)return"multibaseName must be 'base58btc' for CIDv0"}if(!(t.multihash instanceof Uint8Array))return"multihash must be a Uint8Array";try{e.validate(t.multihash)}catch(r){let e=r.message;return e||(e="Multihash validation failed"),e}}};module.exports=t;
|
||
},{"multihashes":"i1rk"}],"W4Nf":[function(require,module,exports) {
|
||
"use strict";const t=require("multihashes"),e=require("multibase"),i=require("multicodec"),s=require("./cid-util"),r=require("uint8arrays/concat"),o=require("uint8arrays/to-string"),h=require("uint8arrays/equals"),n=i.nameToCode,a=Object.keys(n).reduce((t,e)=>(t[n[e]]=e,t),{}),c=Symbol.for("@ipld/js-cid/CID");class u{constructor(s,r,o,h){if(this.version,this.codec,this.multihash,Object.defineProperty(this,c,{value:!0}),u.isCID(s)){const t=s;return this.version=t.version,this.codec=t.codec,this.multihash=t.multihash,void(this.multibaseName=t.multibaseName||(0===t.version?"base58btc":"base32"))}if("string"==typeof s){const r=e.isEncoded(s);if(r){const t=e.decode(s);this.version=parseInt(t[0].toString(),16),this.codec=i.getCodec(t.slice(1)),this.multihash=i.rmPrefix(t.slice(1)),this.multibaseName=r}else this.version=0,this.codec="dag-pb",this.multihash=t.fromB58String(s),this.multibaseName="base58btc";return u.validateCID(this),void Object.defineProperty(this,"string",{value:s})}if(s instanceof Uint8Array){const t=parseInt(s[0].toString(),16);if(1===t){const e=s;this.version=t,this.codec=i.getCodec(e.slice(1)),this.multihash=i.rmPrefix(e.slice(1)),this.multibaseName="base32"}else this.version=0,this.codec="dag-pb",this.multihash=s,this.multibaseName="base58btc";u.validateCID(this)}else this.version=s,"number"==typeof r&&(r=a[r]),this.codec=r,this.multihash=o,this.multibaseName=h||(0===s?"base58btc":"base32"),u.validateCID(this)}get bytes(){let t=this._bytes;if(!t){if(0===this.version)t=this.multihash;else{if(1!==this.version)throw new Error("unsupported version");{const e=i.getCodeVarint(this.codec);t=r([[1],e,this.multihash],1+e.byteLength+this.multihash.byteLength)}}Object.defineProperty(this,"_bytes",{value:t})}return t}get prefix(){const e=i.getCodeVarint(this.codec),s=t.prefix(this.multihash);return r([[this.version],e,s],1+e.byteLength+s.byteLength)}get code(){return n[this.codec]}toV0(){if("dag-pb"!==this.codec)throw new Error("Cannot convert a non dag-pb CID to CIDv0");const{name:e,length:i}=t.decode(this.multihash);if("sha2-256"!==e)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");if(32!==i)throw new Error("Cannot convert non 32 byte multihash CID to CIDv0");return new u(0,this.codec,this.multihash)}toV1(){return new u(1,this.codec,this.multihash)}toBaseEncodedString(i=this.multibaseName){if(this.string&&0!==this.string.length&&i===this.multibaseName)return this.string;let s;if(0===this.version){if("base58btc"!==i)throw new Error("not supported with CIDv0, to support different bases, please migrate the instance do CIDv1, you can do that through cid.toV1()");s=t.toB58String(this.multihash)}else{if(1!==this.version)throw new Error("unsupported version");s=o(e.encode(i,this.bytes))}return i===this.multibaseName&&Object.defineProperty(this,"string",{value:s}),s}[Symbol.for("nodejs.util.inspect.custom")](){return"CID("+this.toString()+")"}toString(t){return this.toBaseEncodedString(t)}toJSON(){return{codec:this.codec,version:this.version,hash:this.multihash}}equals(t){return this.codec===t.codec&&this.version===t.version&&h(this.multihash,t.multihash)}static validateCID(t){const e=s.checkCIDComponents(t);if(e)throw new Error(e)}static isCID(t){return t instanceof u||Boolean(t&&t[c])}}u.codecs=n,module.exports=u;
|
||
},{"multihashes":"i1rk","multibase":"AD4F","multicodec":"YXGS","./cid-util":"CXpO","uint8arrays/concat":"qYui","uint8arrays/to-string":"4DOX","uint8arrays/equals":"mZxc"}],"y5A6":[function(require,module,exports) {
|
||
module.exports={encode:require("./encode.js"),decode:require("./decode.js"),encodingLength:require("./length.js")};
|
||
},{"./encode.js":"qYQO","./decode.js":"ZJdu","./length.js":"Bq+a"}],"78DD":[function(require,module,exports) {
|
||
"use strict";const e=require("./ip"),n=require("./protocols-table"),r=require("cids"),t=require("multibase"),o=require("varint"),s=require("uint8arrays/to-string"),i=require("uint8arrays/from-string"),a=require("uint8arrays/concat");function c(e,n){return n instanceof Uint8Array?c.toString(e,n):c.toBytes(e,n)}function u(n){if(!e.isIP(n))throw new Error("invalid ip address");return e.toBytes(n)}function d(n){const r=e.toString(n);if(!r||!e.isIP(r))throw new Error("invalid ip address");return r}function l(e){const n=new ArrayBuffer(2);return new DataView(n).setUint16(0,e),new Uint8Array(n)}function f(e){return new DataView(e.buffer).getUint16(0)}function h(e){const n=i(e),r=Uint8Array.from(o.encode(n.length));return a([r,n],r.length+n.length)}function g(e){const n=o.decode(e);if((e=e.slice(o.decode.bytes)).length!==n)throw new Error("inconsistent lengths");return s(e)}function w(e){const n=new r(e).multihash,t=Uint8Array.from(o.encode(n.length));return a([t,n],t.length+n.length)}function b(e){const n=o.decode(e),r=e.slice(o.decode.bytes);if(r.length!==n)throw new Error("inconsistent lengths");return s(r,"base58btc")}function p(e){const n=e.split(":");if(2!==n.length)throw new Error("failed to parse onion addr: "+n+" does not contain a port number");if(16!==n[0].length)throw new Error("failed to parse onion addr: "+n[0]+" not a Tor onion address.");const r=t.decode("b"+n[0]),o=parseInt(n[1],10);if(o<1||o>65536)throw new Error("Port number is not in range(1, 65536)");const s=l(o);return a([r,s],r.length+s.length)}function y(e){const n=e.split(":");if(2!==n.length)throw new Error("failed to parse onion addr: "+n+" does not contain a port number");if(56!==n[0].length)throw new Error("failed to parse onion addr: "+n[0]+" not a Tor onion3 address.");const r=t.decode("b"+n[0]),o=parseInt(n[1],10);if(o<1||o>65536)throw new Error("Port number is not in range(1, 65536)");const s=l(o);return a([r,s],r.length+s.length)}function m(e){const n=e.slice(0,e.length-2),r=e.slice(e.length-2);return s(n,"base32")+":"+f(r)}module.exports=c,c.toString=function(e,r){switch(n(e).code){case 4:case 41:return d(r);case 6:case 273:case 33:case 132:return f(r).toString();case 53:case 54:case 55:case 56:case 400:case 777:return g(r);case 421:return b(r);case 444:case 445:return m(r);default:return s(r,"base16")}},c.toBytes=function(e,r){switch(n(e).code){case 4:case 41:return u(r);case 6:case 273:case 33:case 132:return l(parseInt(r,10));case 53:case 54:case 55:case 56:case 400:case 777:return h(r);case 421:return w(r);case 444:return p(r);case 445:return y(r);default:return i(r,"base16")}};
|
||
},{"./ip":"rrbz","./protocols-table":"f6b+","cids":"W4Nf","multibase":"AD4F","varint":"y5A6","uint8arrays/to-string":"4DOX","uint8arrays/from-string":"PrhT","uint8arrays/concat":"qYui"}],"Tef6":[function(require,module,exports) {
|
||
"use strict";const r=require("./convert"),t=require("./protocols-table"),e=require("varint"),n=require("uint8arrays/concat"),o=require("uint8arrays/to-string");function i(r){const e=[],n=r.split("/").slice(1);if(1===n.length&&""===n[0])return[];for(let o=0;o<n.length;o++){const i=n[o],s=t(i);if(0!==s.size){if(++o>=n.length)throw b("invalid address: "+r);if(s.path){e.push([i,m(n.slice(o).join("/"))]);break}e.push([i,n[o]])}else e.push([i])}return e}function s(r){const t=[];return r.map(r=>{const e=v(r);return t.push(e.name),r.length>1&&t.push(r[1]),null}),m(t.join("/"))}function u(t){return t.map(t=>{Array.isArray(t)||(t=[t]);const e=v(t);return t.length>1?[e.code,r.toBytes(e.code,t[1])]:[e.code]})}function c(t){return t.map(t=>{const e=v(t);return t[1]?[e.code,r.toString(e.code,t[1])]:[e.code]})}function l(r){return g(n(r.map(r=>{const t=v(r);let o=Uint8Array.from(e.encode(t.code));return r.length>1&&(o=n([o,r[1]])),o})))}function a(r,t){if(r.size>0)return r.size/8;if(0===r.size)return 0;return e.decode(t)+e.decode.bytes}function f(r){const n=[];let i=0;for(;i<r.length;){const s=e.decode(r,i),u=e.decode.bytes,c=a(t(s),r.slice(i+u));if(0===c){n.push([s]),i+=u;continue}const l=r.slice(i+u,i+u+c);if((i+=c+u)>r.length)throw b("Invalid address Uint8Array: "+o(r,"base16"));n.push([s,l])}return n}function d(r){return s(c(f(r)))}function p(r){return l(u(i(r=m(r))))}function h(r){return p(r)}function g(r){const t=y(r);if(t)throw t;return Uint8Array.from(r)}function y(r){try{f(r)}catch(t){return t}}function T(r){return void 0===y(r)}function m(r){return"/"+r.trim().split("/").filter(r=>r).join("/")}function b(r){return new Error("Error parsing address: "+r)}function v(r){return t(r[0])}module.exports={stringToStringTuples:i,stringTuplesToString:s,tuplesToStringTuples:c,stringTuplesToTuples:u,bytesToTuples:f,tuplesToBytes:l,bytesToString:d,stringToBytes:p,fromString:h,fromBytes:g,validateBytes:y,isValidBytes:T,cleanPath:m,ParseError:b,protoFromTuple:v,sizeForAddr:a};
|
||
},{"./convert":"78DD","./protocols-table":"f6b+","varint":"y5A6","uint8arrays/concat":"qYui","uint8arrays/to-string":"4DOX"}],"vIoc":[function(require,module,exports) {
|
||
"use strict";const t=require("./codec"),r=require("./protocols-table"),e=require("varint"),s=require("cids"),o=require("err-code"),i=Symbol.for("nodejs.util.inspect.custom"),n=require("uint8arrays/to-string"),a=require("uint8arrays/equals"),l=new Map,u=Symbol.for("@multiformats/js-multiaddr/multiaddr");class d{constructor(r){if(null==r&&(r=""),Object.defineProperty(this,u,{value:!0}),r instanceof Uint8Array)this.bytes=t.fromBytes(r);else if("string"==typeof r){if(r.length>0&&"/"!==r.charAt(0))throw new Error(`multiaddr "${r}" must start with a "/"`);this.bytes=t.fromString(r)}else{if(!d.isMultiaddr(r))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=t.fromBytes(r.bytes)}}toString(){return t.bytesToString(this.bytes)}toJSON(){return this.toString()}toOptions(){const t={},r=this.toString().split("/");return t.family="ip4"===r[1]?4:6,t.host=r[2],t.transport=r[3],t.port=parseInt(r[4]),t}protos(){return this.protoCodes().map(t=>Object.assign({},r(t)))}protoCodes(){const s=[],o=this.bytes;let i=0;for(;i<o.length;){const n=e.decode(o,i),a=e.decode.bytes,l=r(n);i+=t.sizeForAddr(l,o.slice(i+a))+a,s.push(n)}return s}protoNames(){return this.protos().map(t=>t.name)}tuples(){return t.bytesToTuples(this.bytes)}stringTuples(){const r=t.bytesToTuples(this.bytes);return t.tuplesToStringTuples(r)}encapsulate(t){return t=new d(t),new d(this.toString()+t.toString())}decapsulate(t){const r=t.toString(),e=this.toString(),s=e.lastIndexOf(r);if(s<0)throw new Error("Address "+this+" does not contain subaddress: "+t);return new d(e.slice(0,s))}decapsulateCode(r){const e=this.tuples();for(let s=e.length-1;s>=0;s--)if(e[s][0]===r)return new d(t.tuplesToBytes(e.slice(0,s)));return this}getPeerId(){try{const e=this.stringTuples().filter(t=>t[0]===r.names.ipfs.code).pop();return e&&e[1]?n(new s(e[1]).multihash,"base58btc"):null}catch(t){return null}}getPath(){let t=null;try{(t=this.stringTuples().filter(t=>{return!!r(t[0]).path})[0][1])||(t=null)}catch(e){t=null}return t}equals(t){return a(this.bytes,t.bytes)}async resolve(){const t=this.protos().find(t=>t.resolvable);if(!t)return[this];const r=l.get(t.name);if(!r)throw o(new Error(`no available resolver for ${t.name}`),"ERR_NO_AVAILABLE_RESOLVER");return(await r(this)).map(t=>new d(t))}nodeAddress(){const t=this.protoCodes(),r=this.protoNames(),e=this.toString().split("/").slice(1);if(e.length<4)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6}/{address}/{tcp, udp}/{port}".');if(4!==t[0]&&41!==t[0]&&54!==t[0]&&55!==t[0])throw new Error(`no protocol with name: "'${r[0]}'". Must have a valid family name: "{ip4, ip6, dns4, dns6}".`);if("tcp"!==e[2]&&"udp"!==e[2])throw new Error(`no protocol with name: "'${r[1]}'". Must have a valid transport protocol: "{tcp, udp}".`);return{family:41===t[0]||55===t[0]?6:4,address:e[1],port:parseInt(e[3])}}isThinWaistAddress(t){const r=(t||this).protos();return 2===r.length&&((4===r[0].code||41===r[0].code)&&(6===r[1].code||273===r[1].code))}static fromNodeAddress(t,r){if(!t)throw new Error("requires node address object");if(!r)throw new Error("requires transport protocol");let e;switch(t.family){case 4:e="ip4";break;case 6:e="ip6";break;default:throw Error(`Invalid addr family. Got '${t.family}' instead of 4 or 6`)}return new d("/"+[e,t.address,r,t.port].join("/"))}static isName(t){return!!d.isMultiaddr(t)&&t.protos().some(t=>t.resolvable)}static isMultiaddr(t){return t instanceof d||Boolean(t&&t[u])}[i](){return"<Multiaddr "+n(this.bytes,"base16")+" - "+t.bytesToString(this.bytes)+">"}inspect(){return"<Multiaddr "+n(this.bytes,"base16")+" - "+t.bytesToString(this.bytes)+">"}}function p(t){return new d(t)}d.protocols=r,d.resolvers=l,module.exports={Multiaddr:d,multiaddr:p,protocols:r,resolvers:l};
|
||
},{"./codec":"Tef6","./protocols-table":"f6b+","varint":"y5A6","cids":"W4Nf","err-code":"hLMW","uint8arrays/to-string":"4DOX","uint8arrays/equals":"mZxc"}],"Kd36":[function(require,module,exports) {
|
||
"use strict";function s(s){return!(this.subnetMask<s.subnetMask)&&this.mask(s.subnetMask)===s.mask()}function t(s){return function(){return this.addressMinusSuffix===this.correctForm()&&(this.subnetMask===s&&!this.parsedSubnet||this.parsedSubnet===String(this.subnetMask))}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.isCorrect=exports.isInSubnet=void 0,exports.isInSubnet=s,exports.isCorrect=t;
|
||
},{}],"HeOn":[function(require,module,exports) {
|
||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.RE_SUBNET_STRING=exports.RE_ADDRESS=exports.GROUPS=exports.BITS=void 0,exports.BITS=32,exports.GROUPS=4,exports.RE_ADDRESS=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/g,exports.RE_SUBNET_STRING=/\/\d{1,2}$/;
|
||
},{}],"2LjA":[function(require,module,exports) {
|
||
"use strict";var r=this&&this.__extends||function(){var r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,t){r.__proto__=t}||function(r,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=t[e])})(t,e)};return function(t,e){function o(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}}();Object.defineProperty(exports,"__esModule",{value:!0}),exports.AddressError=void 0;var t=function(t){function e(r,e){var o=t.call(this,r)||this;return o.name="AddressError",null!==e&&(o.parseMessage=e),o}return r(e,t),e}(Error);exports.AddressError=t;
|
||
},{}],"JDKr":[function(require,module,exports) {
|
||
(function(){var t;function i(t,i,o){null!=t&&("number"==typeof t?this.fromNumber(t,i,o):null==i&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,i))}function o(){return new i(null)}var r="undefined"!=typeof navigator;r&&"Microsoft Internet Explorer"==navigator.appName?(i.prototype.am=function(t,i,o,r,s,e){for(var h=32767&i,n=i>>15;--e>=0;){var f=32767&this[t],u=this[t++]>>15,p=n*f+u*h;s=((f=h*f+((32767&p)<<15)+o[r]+(1073741823&s))>>>30)+(p>>>15)+n*u+(s>>>30),o[r++]=1073741823&f}return s},t=30):r&&"Netscape"!=navigator.appName?(i.prototype.am=function(t,i,o,r,s,e){for(;--e>=0;){var h=i*this[t++]+o[r]+s;s=Math.floor(h/67108864),o[r++]=67108863&h}return s},t=26):(i.prototype.am=function(t,i,o,r,s,e){for(var h=16383&i,n=i>>14;--e>=0;){var f=16383&this[t],u=this[t++]>>14,p=n*f+u*h;s=((f=h*f+((16383&p)<<14)+o[r]+s)>>28)+(p>>14)+n*u,o[r++]=268435455&f}return s},t=28),i.prototype.DB=t,i.prototype.DM=(1<<t)-1,i.prototype.DV=1<<t;i.prototype.FV=Math.pow(2,52),i.prototype.F1=52-t,i.prototype.F2=2*t-52;var s,e,h="0123456789abcdefghijklmnopqrstuvwxyz",n=new Array;for(s="0".charCodeAt(0),e=0;e<=9;++e)n[s++]=e;for(s="a".charCodeAt(0),e=10;e<36;++e)n[s++]=e;for(s="A".charCodeAt(0),e=10;e<36;++e)n[s++]=e;function f(t){return h.charAt(t)}function u(t,i){var o=n[t.charCodeAt(i)];return null==o?-1:o}function p(t){var i=o();return i.fromInt(t),i}function a(t){var i,o=1;return 0!=(i=t>>>16)&&(t=i,o+=16),0!=(i=t>>8)&&(t=i,o+=8),0!=(i=t>>4)&&(t=i,o+=4),0!=(i=t>>2)&&(t=i,o+=2),0!=(i=t>>1)&&(t=i,o+=1),o}function c(t){this.m=t}function m(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function l(t,i){return t&i}function v(t,i){return t|i}function T(t,i){return t^i}function y(t,i){return t&~i}function d(t){if(0==t)return-1;var i=0;return 0==(65535&t)&&(t>>=16,i+=16),0==(255&t)&&(t>>=8,i+=8),0==(15&t)&&(t>>=4,i+=4),0==(3&t)&&(t>>=2,i+=2),0==(1&t)&&++i,i}function D(t){for(var i=0;0!=t;)t&=t-1,++i;return i}function g(){}function b(t){return t}function S(t){this.r2=o(),this.q3=o(),i.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}c.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},c.prototype.revert=function(t){return t},c.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},c.prototype.mulTo=function(t,i,o){t.multiplyTo(i,o),this.reduce(o)},c.prototype.sqrTo=function(t,i){t.squareTo(i),this.reduce(i)},m.prototype.convert=function(t){var r=o();return t.abs().dlShiftTo(this.m.t,r),r.divRemTo(this.m,null,r),t.s<0&&r.compareTo(i.ZERO)>0&&this.m.subTo(r,r),r},m.prototype.revert=function(t){var i=o();return t.copyTo(i),this.reduce(i),i},m.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var i=0;i<this.m.t;++i){var o=32767&t[i],r=o*this.mpl+((o*this.mph+(t[i]>>15)*this.mpl&this.um)<<15)&t.DM;for(t[o=i+this.m.t]+=this.m.am(0,r,t,i,0,this.m.t);t[o]>=t.DV;)t[o]-=t.DV,t[++o]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},m.prototype.mulTo=function(t,i,o){t.multiplyTo(i,o),this.reduce(o)},m.prototype.sqrTo=function(t,i){t.squareTo(i),this.reduce(i)},i.prototype.copyTo=function(t){for(var i=this.t-1;i>=0;--i)t[i]=this[i];t.t=this.t,t.s=this.s},i.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0},i.prototype.fromString=function(t,o){var r;if(16==o)r=4;else if(8==o)r=3;else if(256==o)r=8;else if(2==o)r=1;else if(32==o)r=5;else{if(4!=o)return void this.fromRadix(t,o);r=2}this.t=0,this.s=0;for(var s=t.length,e=!1,h=0;--s>=0;){var n=8==r?255&t[s]:u(t,s);n<0?"-"==t.charAt(s)&&(e=!0):(e=!1,0==h?this[this.t++]=n:h+r>this.DB?(this[this.t-1]|=(n&(1<<this.DB-h)-1)<<h,this[this.t++]=n>>this.DB-h):this[this.t-1]|=n<<h,(h+=r)>=this.DB&&(h-=this.DB))}8==r&&0!=(128&t[0])&&(this.s=-1,h>0&&(this[this.t-1]|=(1<<this.DB-h)-1<<h)),this.clamp(),e&&i.ZERO.subTo(this,this)},i.prototype.clamp=function(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t},i.prototype.dlShiftTo=function(t,i){var o;for(o=this.t-1;o>=0;--o)i[o+t]=this[o];for(o=t-1;o>=0;--o)i[o]=0;i.t=this.t+t,i.s=this.s},i.prototype.drShiftTo=function(t,i){for(var o=t;o<this.t;++o)i[o-t]=this[o];i.t=Math.max(this.t-t,0),i.s=this.s},i.prototype.lShiftTo=function(t,i){var o,r=t%this.DB,s=this.DB-r,e=(1<<s)-1,h=Math.floor(t/this.DB),n=this.s<<r&this.DM;for(o=this.t-1;o>=0;--o)i[o+h+1]=this[o]>>s|n,n=(this[o]&e)<<r;for(o=h-1;o>=0;--o)i[o]=0;i[h]=n,i.t=this.t+h+1,i.s=this.s,i.clamp()},i.prototype.rShiftTo=function(t,i){i.s=this.s;var o=Math.floor(t/this.DB);if(o>=this.t)i.t=0;else{var r=t%this.DB,s=this.DB-r,e=(1<<r)-1;i[0]=this[o]>>r;for(var h=o+1;h<this.t;++h)i[h-o-1]|=(this[h]&e)<<s,i[h-o]=this[h]>>r;r>0&&(i[this.t-o-1]|=(this.s&e)<<s),i.t=this.t-o,i.clamp()}},i.prototype.subTo=function(t,i){for(var o=0,r=0,s=Math.min(t.t,this.t);o<s;)r+=this[o]-t[o],i[o++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r-=t.s;o<this.t;)r+=this[o],i[o++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;o<t.t;)r-=t[o],i[o++]=r&this.DM,r>>=this.DB;r-=t.s}i.s=r<0?-1:0,r<-1?i[o++]=this.DV+r:r>0&&(i[o++]=r),i.t=o,i.clamp()},i.prototype.multiplyTo=function(t,o){var r=this.abs(),s=t.abs(),e=r.t;for(o.t=e+s.t;--e>=0;)o[e]=0;for(e=0;e<s.t;++e)o[e+r.t]=r.am(0,s[e],o,e,0,r.t);o.s=0,o.clamp(),this.s!=t.s&&i.ZERO.subTo(o,o)},i.prototype.squareTo=function(t){for(var i=this.abs(),o=t.t=2*i.t;--o>=0;)t[o]=0;for(o=0;o<i.t-1;++o){var r=i.am(o,i[o],t,2*o,0,1);(t[o+i.t]+=i.am(o+1,2*i[o],t,2*o+1,r,i.t-o-1))>=i.DV&&(t[o+i.t]-=i.DV,t[o+i.t+1]=1)}t.t>0&&(t[t.t-1]+=i.am(o,i[o],t,2*o,0,1)),t.s=0,t.clamp()},i.prototype.divRemTo=function(t,r,s){var e=t.abs();if(!(e.t<=0)){var h=this.abs();if(h.t<e.t)return null!=r&&r.fromInt(0),void(null!=s&&this.copyTo(s));null==s&&(s=o());var n=o(),f=this.s,u=t.s,p=this.DB-a(e[e.t-1]);p>0?(e.lShiftTo(p,n),h.lShiftTo(p,s)):(e.copyTo(n),h.copyTo(s));var c=n.t,m=n[c-1];if(0!=m){var l=m*(1<<this.F1)+(c>1?n[c-2]>>this.F2:0),v=this.FV/l,T=(1<<this.F1)/l,y=1<<this.F2,d=s.t,D=d-c,g=null==r?o():r;for(n.dlShiftTo(D,g),s.compareTo(g)>=0&&(s[s.t++]=1,s.subTo(g,s)),i.ONE.dlShiftTo(c,g),g.subTo(n,n);n.t<c;)n[n.t++]=0;for(;--D>=0;){var b=s[--d]==m?this.DM:Math.floor(s[d]*v+(s[d-1]+y)*T);if((s[d]+=n.am(0,b,s,D,0,c))<b)for(n.dlShiftTo(D,g),s.subTo(g,s);s[d]<--b;)s.subTo(g,s)}null!=r&&(s.drShiftTo(c,r),f!=u&&i.ZERO.subTo(r,r)),s.t=c,s.clamp(),p>0&&s.rShiftTo(p,s),f<0&&i.ZERO.subTo(s,s)}}},i.prototype.invDigit=function(){if(this.t<1)return 0;var t=this[0];if(0==(1&t))return 0;var i=3&t;return(i=(i=(i=(i=i*(2-(15&t)*i)&15)*(2-(255&t)*i)&255)*(2-((65535&t)*i&65535))&65535)*(2-t*i%this.DV)%this.DV)>0?this.DV-i:-i},i.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},i.prototype.exp=function(t,r){if(t>4294967295||t<1)return i.ONE;var s=o(),e=o(),h=r.convert(this),n=a(t)-1;for(h.copyTo(s);--n>=0;)if(r.sqrTo(s,e),(t&1<<n)>0)r.mulTo(e,h,s);else{var f=s;s=e,e=f}return r.revert(s)},i.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var i;if(16==t)i=4;else if(8==t)i=3;else if(2==t)i=1;else if(32==t)i=5;else{if(4!=t)return this.toRadix(t);i=2}var o,r=(1<<i)-1,s=!1,e="",h=this.t,n=this.DB-h*this.DB%i;if(h-- >0)for(n<this.DB&&(o=this[h]>>n)>0&&(s=!0,e=f(o));h>=0;)n<i?(o=(this[h]&(1<<n)-1)<<i-n,o|=this[--h]>>(n+=this.DB-i)):(o=this[h]>>(n-=i)&r,n<=0&&(n+=this.DB,--h)),o>0&&(s=!0),s&&(e+=f(o));return s?e:"0"},i.prototype.negate=function(){var t=o();return i.ZERO.subTo(this,t),t},i.prototype.abs=function(){return this.s<0?this.negate():this},i.prototype.compareTo=function(t){var i=this.s-t.s;if(0!=i)return i;var o=this.t;if(0!=(i=o-t.t))return this.s<0?-i:i;for(;--o>=0;)if(0!=(i=this[o]-t[o]))return i;return 0},i.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+a(this[this.t-1]^this.s&this.DM)},i.prototype.mod=function(t){var r=o();return this.abs().divRemTo(t,null,r),this.s<0&&r.compareTo(i.ZERO)>0&&t.subTo(r,r),r},i.prototype.modPowInt=function(t,i){var o;return o=t<256||i.isEven()?new c(i):new m(i),this.exp(t,o)},i.ZERO=p(0),i.ONE=p(1),g.prototype.convert=b,g.prototype.revert=b,g.prototype.mulTo=function(t,i,o){t.multiplyTo(i,o)},g.prototype.sqrTo=function(t,i){t.squareTo(i)},S.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var i=o();return t.copyTo(i),this.reduce(i),i},S.prototype.revert=function(t){return t},S.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},S.prototype.mulTo=function(t,i,o){t.multiplyTo(i,o),this.reduce(o)},S.prototype.sqrTo=function(t,i){t.squareTo(i),this.reduce(i)};var B,w,M,E=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],R=(1<<26)/E[E.length-1];function O(){var t;t=(new Date).getTime(),w[M++]^=255&t,w[M++]^=t>>8&255,w[M++]^=t>>16&255,w[M++]^=t>>24&255,M>=I&&(M-=I)}if(i.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},i.prototype.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var i=this.chunkSize(t),r=Math.pow(t,i),s=p(r),e=o(),h=o(),n="";for(this.divRemTo(s,e,h);e.signum()>0;)n=(r+h.intValue()).toString(t).substr(1)+n,e.divRemTo(s,e,h);return h.intValue().toString(t)+n},i.prototype.fromRadix=function(t,o){this.fromInt(0),null==o&&(o=10);for(var r=this.chunkSize(o),s=Math.pow(o,r),e=!1,h=0,n=0,f=0;f<t.length;++f){var p=u(t,f);p<0?"-"==t.charAt(f)&&0==this.signum()&&(e=!0):(n=o*n+p,++h>=r&&(this.dMultiply(s),this.dAddOffset(n,0),h=0,n=0))}h>0&&(this.dMultiply(Math.pow(o,h)),this.dAddOffset(n,0)),e&&i.ZERO.subTo(this,this)},i.prototype.fromNumber=function(t,o,r){if("number"==typeof o)if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(i.ONE.shiftLeft(t-1),v,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(o);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(i.ONE.shiftLeft(t-1),this);else{var s=new Array,e=7&t;s.length=1+(t>>3),o.nextBytes(s),e>0?s[0]&=(1<<e)-1:s[0]=0,this.fromString(s,256)}},i.prototype.bitwiseTo=function(t,i,o){var r,s,e=Math.min(t.t,this.t);for(r=0;r<e;++r)o[r]=i(this[r],t[r]);if(t.t<this.t){for(s=t.s&this.DM,r=e;r<this.t;++r)o[r]=i(this[r],s);o.t=this.t}else{for(s=this.s&this.DM,r=e;r<t.t;++r)o[r]=i(s,t[r]);o.t=t.t}o.s=i(this.s,t.s),o.clamp()},i.prototype.changeBit=function(t,o){var r=i.ONE.shiftLeft(t);return this.bitwiseTo(r,o,r),r},i.prototype.addTo=function(t,i){for(var o=0,r=0,s=Math.min(t.t,this.t);o<s;)r+=this[o]+t[o],i[o++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r+=t.s;o<this.t;)r+=this[o],i[o++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;o<t.t;)r+=t[o],i[o++]=r&this.DM,r>>=this.DB;r+=t.s}i.s=r<0?-1:0,r>0?i[o++]=r:r<-1&&(i[o++]=this.DV+r),i.t=o,i.clamp()},i.prototype.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},i.prototype.dAddOffset=function(t,i){if(0!=t){for(;this.t<=i;)this[this.t++]=0;for(this[i]+=t;this[i]>=this.DV;)this[i]-=this.DV,++i>=this.t&&(this[this.t++]=0),++this[i]}},i.prototype.multiplyLowerTo=function(t,i,o){var r,s=Math.min(this.t+t.t,i);for(o.s=0,o.t=s;s>0;)o[--s]=0;for(r=o.t-this.t;s<r;++s)o[s+this.t]=this.am(0,t[s],o,s,0,this.t);for(r=Math.min(t.t,i);s<r;++s)this.am(0,t[s],o,s,0,i-s);o.clamp()},i.prototype.multiplyUpperTo=function(t,i,o){--i;var r=o.t=this.t+t.t-i;for(o.s=0;--r>=0;)o[r]=0;for(r=Math.max(i-this.t,0);r<t.t;++r)o[this.t+r-i]=this.am(i-r,t[r],o,0,0,this.t+r-i);o.clamp(),o.drShiftTo(1,o)},i.prototype.modInt=function(t){if(t<=0)return 0;var i=this.DV%t,o=this.s<0?t-1:0;if(this.t>0)if(0==i)o=this[0]%t;else for(var r=this.t-1;r>=0;--r)o=(i*o+this[r])%t;return o},i.prototype.millerRabin=function(t){var r=this.subtract(i.ONE),s=r.getLowestSetBit();if(s<=0)return!1;var e=r.shiftRight(s);(t=t+1>>1)>E.length&&(t=E.length);for(var h=o(),n=0;n<t;++n){h.fromInt(E[Math.floor(Math.random()*E.length)]);var f=h.modPow(e,this);if(0!=f.compareTo(i.ONE)&&0!=f.compareTo(r)){for(var u=1;u++<s&&0!=f.compareTo(r);)if(0==(f=f.modPowInt(2,this)).compareTo(i.ONE))return!1;if(0!=f.compareTo(r))return!1}}return!0},i.prototype.clone=function(){var t=o();return this.copyTo(t),t},i.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},i.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},i.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},i.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},i.prototype.toByteArray=function(){var t=this.t,i=new Array;i[0]=this.s;var o,r=this.DB-t*this.DB%8,s=0;if(t-- >0)for(r<this.DB&&(o=this[t]>>r)!=(this.s&this.DM)>>r&&(i[s++]=o|this.s<<this.DB-r);t>=0;)r<8?(o=(this[t]&(1<<r)-1)<<8-r,o|=this[--t]>>(r+=this.DB-8)):(o=this[t]>>(r-=8)&255,r<=0&&(r+=this.DB,--t)),0!=(128&o)&&(o|=-256),0==s&&(128&this.s)!=(128&o)&&++s,(s>0||o!=this.s)&&(i[s++]=o);return i},i.prototype.equals=function(t){return 0==this.compareTo(t)},i.prototype.min=function(t){return this.compareTo(t)<0?this:t},i.prototype.max=function(t){return this.compareTo(t)>0?this:t},i.prototype.and=function(t){var i=o();return this.bitwiseTo(t,l,i),i},i.prototype.or=function(t){var i=o();return this.bitwiseTo(t,v,i),i},i.prototype.xor=function(t){var i=o();return this.bitwiseTo(t,T,i),i},i.prototype.andNot=function(t){var i=o();return this.bitwiseTo(t,y,i),i},i.prototype.not=function(){for(var t=o(),i=0;i<this.t;++i)t[i]=this.DM&~this[i];return t.t=this.t,t.s=~this.s,t},i.prototype.shiftLeft=function(t){var i=o();return t<0?this.rShiftTo(-t,i):this.lShiftTo(t,i),i},i.prototype.shiftRight=function(t){var i=o();return t<0?this.lShiftTo(-t,i):this.rShiftTo(t,i),i},i.prototype.getLowestSetBit=function(){for(var t=0;t<this.t;++t)if(0!=this[t])return t*this.DB+d(this[t]);return this.s<0?this.t*this.DB:-1},i.prototype.bitCount=function(){for(var t=0,i=this.s&this.DM,o=0;o<this.t;++o)t+=D(this[o]^i);return t},i.prototype.testBit=function(t){var i=Math.floor(t/this.DB);return i>=this.t?0!=this.s:0!=(this[i]&1<<t%this.DB)},i.prototype.setBit=function(t){return this.changeBit(t,v)},i.prototype.clearBit=function(t){return this.changeBit(t,y)},i.prototype.flipBit=function(t){return this.changeBit(t,T)},i.prototype.add=function(t){var i=o();return this.addTo(t,i),i},i.prototype.subtract=function(t){var i=o();return this.subTo(t,i),i},i.prototype.multiply=function(t){var i=o();return this.multiplyTo(t,i),i},i.prototype.divide=function(t){var i=o();return this.divRemTo(t,i,null),i},i.prototype.remainder=function(t){var i=o();return this.divRemTo(t,null,i),i},i.prototype.divideAndRemainder=function(t){var i=o(),r=o();return this.divRemTo(t,i,r),new Array(i,r)},i.prototype.modPow=function(t,i){var r,s,e=t.bitLength(),h=p(1);if(e<=0)return h;r=e<18?1:e<48?3:e<144?4:e<768?5:6,s=e<8?new c(i):i.isEven()?new S(i):new m(i);var n=new Array,f=3,u=r-1,l=(1<<r)-1;if(n[1]=s.convert(this),r>1){var v=o();for(s.sqrTo(n[1],v);f<=l;)n[f]=o(),s.mulTo(v,n[f-2],n[f]),f+=2}var T,y,d=t.t-1,D=!0,g=o();for(e=a(t[d])-1;d>=0;){for(e>=u?T=t[d]>>e-u&l:(T=(t[d]&(1<<e+1)-1)<<u-e,d>0&&(T|=t[d-1]>>this.DB+e-u)),f=r;0==(1&T);)T>>=1,--f;if((e-=f)<0&&(e+=this.DB,--d),D)n[T].copyTo(h),D=!1;else{for(;f>1;)s.sqrTo(h,g),s.sqrTo(g,h),f-=2;f>0?s.sqrTo(h,g):(y=h,h=g,g=y),s.mulTo(g,n[T],h)}for(;d>=0&&0==(t[d]&1<<e);)s.sqrTo(h,g),y=h,h=g,g=y,--e<0&&(e=this.DB-1,--d)}return s.revert(h)},i.prototype.modInverse=function(t){var o=t.isEven();if(this.isEven()&&o||0==t.signum())return i.ZERO;for(var r=t.clone(),s=this.clone(),e=p(1),h=p(0),n=p(0),f=p(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),o?(e.isEven()&&h.isEven()||(e.addTo(this,e),h.subTo(t,h)),e.rShiftTo(1,e)):h.isEven()||h.subTo(t,h),h.rShiftTo(1,h);for(;s.isEven();)s.rShiftTo(1,s),o?(n.isEven()&&f.isEven()||(n.addTo(this,n),f.subTo(t,f)),n.rShiftTo(1,n)):f.isEven()||f.subTo(t,f),f.rShiftTo(1,f);r.compareTo(s)>=0?(r.subTo(s,r),o&&e.subTo(n,e),h.subTo(f,h)):(s.subTo(r,s),o&&n.subTo(e,n),f.subTo(h,f))}return 0!=s.compareTo(i.ONE)?i.ZERO:f.compareTo(t)>=0?f.subtract(t):f.signum()<0?(f.addTo(t,f),f.signum()<0?f.add(t):f):f},i.prototype.pow=function(t){return this.exp(t,new g)},i.prototype.gcd=function(t){var i=this.s<0?this.negate():this.clone(),o=t.s<0?t.negate():t.clone();if(i.compareTo(o)<0){var r=i;i=o,o=r}var s=i.getLowestSetBit(),e=o.getLowestSetBit();if(e<0)return i;for(s<e&&(e=s),e>0&&(i.rShiftTo(e,i),o.rShiftTo(e,o));i.signum()>0;)(s=i.getLowestSetBit())>0&&i.rShiftTo(s,i),(s=o.getLowestSetBit())>0&&o.rShiftTo(s,o),i.compareTo(o)>=0?(i.subTo(o,i),i.rShiftTo(1,i)):(o.subTo(i,o),o.rShiftTo(1,o));return e>0&&o.lShiftTo(e,o),o},i.prototype.isProbablePrime=function(t){var i,o=this.abs();if(1==o.t&&o[0]<=E[E.length-1]){for(i=0;i<E.length;++i)if(o[0]==E[i])return!0;return!1}if(o.isEven())return!1;for(i=1;i<E.length;){for(var r=E[i],s=i+1;s<E.length&&r<R;)r*=E[s++];for(r=o.modInt(r);i<s;)if(r%E[i++]==0)return!1}return o.millerRabin(t)},i.prototype.square=function(){var t=o();return this.squareTo(t),t},i.prototype.Barrett=S,null==w){var A;if(w=new Array,M=0,"undefined"!=typeof window&&window.crypto)if(window.crypto.getRandomValues){var V=new Uint8Array(32);for(window.crypto.getRandomValues(V),A=0;A<32;++A)w[M++]=V[A]}else if("Netscape"==navigator.appName&&navigator.appVersion<"5"){var q=window.crypto.random(32);for(A=0;A<q.length;++A)w[M++]=255&q.charCodeAt(A)}for(;M<I;)A=Math.floor(65536*Math.random()),w[M++]=A>>>8,w[M++]=255&A;M=0,O()}function N(){if(null==B){for(O(),(B=new L).init(w),M=0;M<w.length;++M)w[M]=0;M=0}return B.next()}function x(){}function L(){this.i=0,this.j=0,this.S=new Array}x.prototype.nextBytes=function(t){var i;for(i=0;i<t.length;++i)t[i]=N()},L.prototype.init=function(t){var i,o,r;for(i=0;i<256;++i)this.S[i]=i;for(o=0,i=0;i<256;++i)o=o+this.S[i]+t[i%t.length]&255,r=this.S[i],this.S[i]=this.S[o],this.S[o]=r;this.i=0,this.j=0},L.prototype.next=function(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]};var I=256;"undefined"!=typeof exports?exports=module.exports={default:i,BigInteger:i,SecureRandom:x}:this.jsbn={BigInteger:i,SecureRandom:x}}).call(this);
|
||
},{}],"ehYi":[function(require,module,exports) {
|
||
var define;
|
||
var e;!function(){"use strict";var r={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function t(e){return function(e,n){var i,s,a,o,p,c,l,u,f,d=1,g=e.length,y="";for(s=0;s<g;s++)if("string"==typeof e[s])y+=e[s];else if("object"==typeof e[s]){if((o=e[s]).keys)for(i=n[d],a=0;a<o.keys.length;a++){if(null==i)throw new Error(t('[sprintf] Cannot access property "%s" of undefined value "%s"',o.keys[a],o.keys[a-1]));i=i[o.keys[a]]}else i=o.param_no?n[o.param_no]:n[d++];if(r.not_type.test(o.type)&&r.not_primitive.test(o.type)&&i instanceof Function&&(i=i()),r.numeric_arg.test(o.type)&&"number"!=typeof i&&isNaN(i))throw new TypeError(t("[sprintf] expecting number but found %T",i));switch(r.number.test(o.type)&&(u=i>=0),o.type){case"b":i=parseInt(i,10).toString(2);break;case"c":i=String.fromCharCode(parseInt(i,10));break;case"d":case"i":i=parseInt(i,10);break;case"j":i=JSON.stringify(i,null,o.width?parseInt(o.width):0);break;case"e":i=o.precision?parseFloat(i).toExponential(o.precision):parseFloat(i).toExponential();break;case"f":i=o.precision?parseFloat(i).toFixed(o.precision):parseFloat(i);break;case"g":i=o.precision?String(Number(i.toPrecision(o.precision))):parseFloat(i);break;case"o":i=(parseInt(i,10)>>>0).toString(8);break;case"s":i=String(i),i=o.precision?i.substring(0,o.precision):i;break;case"t":i=String(!!i),i=o.precision?i.substring(0,o.precision):i;break;case"T":i=Object.prototype.toString.call(i).slice(8,-1).toLowerCase(),i=o.precision?i.substring(0,o.precision):i;break;case"u":i=parseInt(i,10)>>>0;break;case"v":i=i.valueOf(),i=o.precision?i.substring(0,o.precision):i;break;case"x":i=(parseInt(i,10)>>>0).toString(16);break;case"X":i=(parseInt(i,10)>>>0).toString(16).toUpperCase()}r.json.test(o.type)?y+=i:(!r.number.test(o.type)||u&&!o.sign?f="":(f=u?"+":"-",i=i.toString().replace(r.sign,"")),c=o.pad_char?"0"===o.pad_char?"0":o.pad_char.charAt(1):" ",l=o.width-(f+i).length,p=o.width&&l>0?c.repeat(l):"",y+=o.align?f+i+p:"0"===c?f+p+i:p+f+i)}return y}(function(e){if(i[e])return i[e];var t,n=e,s=[],a=0;for(;n;){if(null!==(t=r.text.exec(n)))s.push(t[0]);else if(null!==(t=r.modulo.exec(n)))s.push("%");else{if(null===(t=r.placeholder.exec(n)))throw new SyntaxError("[sprintf] unexpected placeholder");if(t[2]){a|=1;var o=[],p=t[2],c=[];if(null===(c=r.key.exec(p)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(o.push(c[1]);""!==(p=p.substring(c[0].length));)if(null!==(c=r.key_access.exec(p)))o.push(c[1]);else{if(null===(c=r.index_access.exec(p)))throw new SyntaxError("[sprintf] failed to parse named argument key");o.push(c[1])}t[2]=o}else a|=2;if(3===a)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");s.push({placeholder:t[0],param_no:t[1],keys:t[2],sign:t[3],pad_char:t[4],align:t[5],width:t[6],precision:t[7],type:t[8]})}n=n.substring(t[0].length)}return i[e]=s}(e),arguments)}function n(e,r){return t.apply(null,[e].concat(r||[]))}var i=Object.create(null);"undefined"!=typeof exports&&(exports.sprintf=t,exports.vsprintf=n),"undefined"!=typeof window&&(window.sprintf=t,window.vsprintf=n,"function"==typeof e&&e.amd&&e(function(){return{sprintf:t,vsprintf:n}}))}();
|
||
},{}],"OohE":[function(require,module,exports) {
|
||
"use strict";var t=this&&this.__createBinding||(Object.create?function(t,r,e,s){void 0===s&&(s=e),Object.defineProperty(t,s,{enumerable:!0,get:function(){return r[e]}})}:function(t,r,e,s){void 0===s&&(s=e),t[s]=r[e]}),r=this&&this.__setModuleDefault||(Object.create?function(t,r){Object.defineProperty(t,"default",{enumerable:!0,value:r})}:function(t,r){t.default=r}),e=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var s={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&t(s,e,n);return r(s,e),s};Object.defineProperty(exports,"__esModule",{value:!0}),exports.Address4=void 0;var s=e(require("./common")),n=e(require("./v4/constants")),i=require("./address-error"),o=require("jsbn"),u=require("sprintf-js"),a=function(){function t(t){this.groups=n.GROUPS,this.parsedAddress=[],this.parsedSubnet="",this.subnet="/32",this.subnetMask=32,this.v4=!0,this.isCorrect=s.isCorrect(n.BITS),this.isInSubnet=s.isInSubnet,this.address=t;var r=n.RE_SUBNET_STRING.exec(t);if(r){if(this.parsedSubnet=r[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet="/"+this.subnetMask,this.subnetMask<0||this.subnetMask>n.BITS)throw new i.AddressError("Invalid subnet mask.");t=t.replace(n.RE_SUBNET_STRING,"")}this.addressMinusSuffix=t,this.parsedAddress=this.parse(t)}return t.isValid=function(r){try{return new t(r),!0}catch(e){return!1}},t.prototype.parse=function(t){var r=t.split(".");if(!t.match(n.RE_ADDRESS))throw new i.AddressError("Invalid IPv4 address.");return r},t.prototype.correctForm=function(){return this.parsedAddress.map(function(t){return parseInt(t,10)}).join(".")},t.fromHex=function(r){var e,s=r.replace(/:/g,"").padStart(8,"0"),n=[];for(e=0;e<8;e+=2){var i=s.slice(e,e+2);n.push(parseInt(i,16))}return new t(n.join("."))},t.fromInteger=function(r){return t.fromHex(r.toString(16))},t.prototype.toHex=function(){return this.parsedAddress.map(function(t){return u.sprintf("%02x",parseInt(t,10))}).join(":")},t.prototype.toArray=function(){return this.parsedAddress.map(function(t){return parseInt(t,10)})},t.prototype.toGroup6=function(){var t,r=[];for(t=0;t<n.GROUPS;t+=2){var e=u.sprintf("%02x%02x",parseInt(this.parsedAddress[t],10),parseInt(this.parsedAddress[t+1],10));r.push(u.sprintf("%x",parseInt(e,16)))}return r.join(":")},t.prototype.bigInteger=function(){return new o.BigInteger(this.parsedAddress.map(function(t){return u.sprintf("%02x",parseInt(t,10))}).join(""),16)},t.prototype._startAddress=function(){return new o.BigInteger(this.mask()+"0".repeat(n.BITS-this.subnetMask),2)},t.prototype.startAddress=function(){return t.fromBigInteger(this._startAddress())},t.prototype.startAddressExclusive=function(){var r=new o.BigInteger("1");return t.fromBigInteger(this._startAddress().add(r))},t.prototype._endAddress=function(){return new o.BigInteger(this.mask()+"1".repeat(n.BITS-this.subnetMask),2)},t.prototype.endAddress=function(){return t.fromBigInteger(this._endAddress())},t.prototype.endAddressExclusive=function(){var r=new o.BigInteger("1");return t.fromBigInteger(this._endAddress().subtract(r))},t.fromBigInteger=function(r){return t.fromInteger(parseInt(r.toString(),10))},t.prototype.mask=function(t){return void 0===t&&(t=this.subnetMask),this.getBitsBase2(0,t)},t.prototype.getBitsBase2=function(t,r){return this.binaryZeroPad().slice(t,r)},t.prototype.isMulticast=function(){return this.isInSubnet(new t("224.0.0.0/4"))},t.prototype.binaryZeroPad=function(){return this.bigInteger().toString(2).padStart(n.BITS,"0")},t.prototype.groupForV6=function(){var t=this.parsedAddress;return this.address.replace(n.RE_ADDRESS,u.sprintf('<span class="hover-group group-v4 group-6">%s</span>.<span class="hover-group group-v4 group-7">%s</span>',t.slice(0,2).join("."),t.slice(2,4).join(".")))},t}();exports.Address4=a;
|
||
},{"./common":"Kd36","./v4/constants":"HeOn","./address-error":"2LjA","jsbn":"JDKr","sprintf-js":"ehYi"}],"Sizg":[function(require,module,exports) {
|
||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.RE_URL_WITH_PORT=exports.RE_URL=exports.RE_ZONE_STRING=exports.RE_SUBNET_STRING=exports.RE_BAD_ADDRESS=exports.RE_BAD_CHARACTERS=exports.TYPES=exports.SCOPES=exports.GROUPS=exports.BITS=void 0,exports.BITS=128,exports.GROUPS=8,exports.SCOPES={0:"Reserved",1:"Interface local",2:"Link local",4:"Admin local",5:"Site local",8:"Organization local",14:"Global",15:"Reserved"},exports.TYPES={"ff01::1/128":"Multicast (All nodes on this interface)","ff01::2/128":"Multicast (All routers on this interface)","ff02::1/128":"Multicast (All nodes on this link)","ff02::2/128":"Multicast (All routers on this link)","ff05::2/128":"Multicast (All routers in this site)","ff02::5/128":"Multicast (OSPFv3 AllSPF routers)","ff02::6/128":"Multicast (OSPFv3 AllDR routers)","ff02::9/128":"Multicast (RIP routers)","ff02::a/128":"Multicast (EIGRP routers)","ff02::d/128":"Multicast (PIM routers)","ff02::16/128":"Multicast (MLDv2 reports)","ff01::fb/128":"Multicast (mDNSv6)","ff02::fb/128":"Multicast (mDNSv6)","ff05::fb/128":"Multicast (mDNSv6)","ff02::1:2/128":"Multicast (All DHCP servers and relay agents on this link)","ff05::1:2/128":"Multicast (All DHCP servers and relay agents in this site)","ff02::1:3/128":"Multicast (All DHCP servers on this link)","ff05::1:3/128":"Multicast (All DHCP servers in this site)","::/128":"Unspecified","::1/128":"Loopback","ff00::/8":"Multicast","fe80::/10":"Link-local unicast"},exports.RE_BAD_CHARACTERS=/([^0-9a-f:/%])/gi,exports.RE_BAD_ADDRESS=/([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi,exports.RE_SUBNET_STRING=/\/\d{1,3}(?=%|$)/,exports.RE_ZONE_STRING=/%.*$/,exports.RE_URL=new RegExp(/^\[{0,1}([0-9a-f:]+)\]{0,1}/),exports.RE_URL_WITH_PORT=new RegExp(/\[([0-9a-f:]+)\]:([0-9]{1,5})/);
|
||
},{}],"c6ot":[function(require,module,exports) {
|
||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.simpleGroup=exports.spanLeadingZeroes=exports.spanAll=exports.spanAllZeroes=void 0;var s=require("sprintf-js");function e(s){return s.replace(/(0+)/g,'<span class="zero">$1</span>')}function r(r,n){return void 0===n&&(n=0),r.split("").map(function(r,p){return s.sprintf('<span class="digit value-%s position-%d">%s</span>',r,p+n,e(r))}).join("")}function n(s){return s.replace(/^(0+)/,'<span class="zero">$1</span>')}function p(s){return s.split(":").map(function(s){return n(s)}).join(":")}function t(e,r){return void 0===r&&(r=0),e.split(":").map(function(e,p){return/group-v4/.test(e)?e:s.sprintf('<span class="hover-group group-%d">%s</span>',p+r,n(e))})}exports.spanAllZeroes=e,exports.spanAll=r,exports.spanLeadingZeroes=p,exports.simpleGroup=t;
|
||
},{"sprintf-js":"ehYi"}],"ont9":[function(require,module,exports) {
|
||
"use strict";var r=this&&this.__createBinding||(Object.create?function(r,e,t,s){void 0===s&&(s=t),Object.defineProperty(r,s,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,s){void 0===s&&(s=t),r[s]=e[t]}),e=this&&this.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),t=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var s={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&r(s,t,n);return e(s,t),s};Object.defineProperty(exports,"__esModule",{value:!0}),exports.possibleElisions=exports.simpleRegularExpression=exports.ADDRESS_BOUNDARY=exports.padGroup=exports.groupPossibilities=void 0;var s=t(require("./constants")),n=require("sprintf-js");function i(r){return n.sprintf("(%s)",r.join("|"))}function o(r){return r.length<4?n.sprintf("0{0,%d}%s",4-r.length,r):r}function u(r){var e=[];r.forEach(function(r,t){0===parseInt(r,16)&&e.push(t)});var t=e.map(function(e){return r.map(function(r,t){if(t===e){var n=0===t||t===s.GROUPS-1?":":"";return i([o(r),n])}return o(r)}).join(":")});return t.push(r.map(o).join(":")),i(t)}function p(r,e,t){var s=e?"":":",o=t?"":":",u=[];e||t||u.push("::"),e&&t&&u.push(""),(t&&!e||!t&&e)&&u.push(":"),u.push(n.sprintf("%s(:0{1,4}){1,%d}",s,r-1)),u.push(n.sprintf("(0{1,4}:){1,%d}%s",r-1,o)),u.push(n.sprintf("(0{1,4}:){%d}0{1,4}",r-1));for(var p=1;p<r-1;p++)for(var a=1;a<r-p;a++)u.push(n.sprintf("(0{1,4}:){%d}:(0{1,4}:){%d}0{1,4}",a,r-a-p-1));return i(u)}exports.groupPossibilities=i,exports.padGroup=o,exports.ADDRESS_BOUNDARY="[^A-Fa-f0-9:]",exports.simpleRegularExpression=u,exports.possibleElisions=p;
|
||
},{"./constants":"Sizg","sprintf-js":"ehYi"}],"tpn3":[function(require,module,exports) {
|
||
"use strict";var e=this&&this.__createBinding||(Object.create?function(e,r,t,s){void 0===s&&(s=t),Object.defineProperty(e,s,{enumerable:!0,get:function(){return r[t]}})}:function(e,r,t,s){void 0===s&&(s=t),e[s]=r[t]}),r=this&&this.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:!0,value:r})}:function(e,r){e.default=r}),t=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var s={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&e(s,t,n);return r(s,t),s},s=this&&this.__spreadArrays||function(){for(var e=0,r=0,t=arguments.length;r<t;r++)e+=arguments[r].length;var s=Array(e),n=0;for(r=0;r<t;r++)for(var i=arguments[r],o=0,a=i.length;o<a;o++,n++)s[n]=i[o];return s};Object.defineProperty(exports,"__esModule",{value:!0}),exports.Address6=void 0;var n=t(require("./common")),i=t(require("./v4/constants")),o=t(require("./v6/constants")),a=t(require("./v6/helpers")),p=require("./ipv4"),u=require("./v6/regular-expressions"),d=require("./address-error"),l=require("jsbn"),f=require("sprintf-js");function c(e){if(!e)throw new Error("Assertion failed.")}function h(e){for(var r=/(\d+)(\d{3})/;r.test(e);)e=e.replace(r,"$1,$2");return e}function g(e){return e=(e=e.replace(/^(0{1,})([1-9]+)$/,'<span class="parse-error">$1</span>$2')).replace(/^(0{1,})(0)$/,'<span class="parse-error">$1</span>$2')}function v(e,r){var t,s=[],n=[];for(t=0;t<e.length;t++)t<r[0]?s.push(e[t]):t>r[1]&&n.push(e[t]);return s.concat(["compact"]).concat(n)}function B(e){return f.sprintf("%04x",parseInt(e,16))}function y(e){return 255&e}var m=function(){function e(e,r){this.addressMinusSuffix="",this.parsedSubnet="",this.subnet="/128",this.subnetMask=128,this.v4=!1,this.zone="",this.isInSubnet=n.isInSubnet,this.isCorrect=n.isCorrect(o.BITS),this.groups=void 0===r?o.GROUPS:r,this.address=e;var t=o.RE_SUBNET_STRING.exec(e);if(t){if(this.parsedSubnet=t[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet="/"+this.subnetMask,Number.isNaN(this.subnetMask)||this.subnetMask<0||this.subnetMask>o.BITS)throw new d.AddressError("Invalid subnet mask.");e=e.replace(o.RE_SUBNET_STRING,"")}else if(/\//.test(e))throw new d.AddressError("Invalid subnet mask.");var s=o.RE_ZONE_STRING.exec(e);s&&(this.zone=s[0],e=e.replace(o.RE_ZONE_STRING,"")),this.addressMinusSuffix=e,this.parsedAddress=this.parse(this.addressMinusSuffix)}return e.isValid=function(r){try{return new e(r),!0}catch(t){return!1}},e.fromBigInteger=function(r){var t,s=r.toString(16).padStart(32,"0"),n=[];for(t=0;t<o.GROUPS;t++)n.push(s.slice(4*t,4*(t+1)));return new e(n.join(":"))},e.fromURL=function(r){var t,s,n=null;if(-1!==r.indexOf("[")&&-1!==r.indexOf("]:")){if(null===(s=o.RE_URL_WITH_PORT.exec(r)))return{error:"failed to parse address with port",address:null,port:null};t=s[1],n=s[2]}else if(-1!==r.indexOf("/")){if(r=r.replace(/^[a-z0-9]+:\/\//,""),null===(s=o.RE_URL.exec(r)))return{error:"failed to parse address from URL",address:null,port:null};t=s[1]}else t=r;return n?((n=parseInt(n,10))<0||n>65536)&&(n=null):n=null,{address:new e(t),port:n}},e.fromAddress4=function(r){var t=new p.Address4(r),s=o.BITS-(i.BITS-t.subnetMask);return new e("::ffff:"+t.correctForm()+"/"+s)},e.fromArpa=function(r){var t=r.replace(/(\.ip6\.arpa)?\.$/,"");if(63!==t.length)throw new d.AddressError("Invalid 'ip6.arpa' form.");for(var s=t.split(".").reverse(),n=7;n>0;n--){var i=4*n;s.splice(i,0,":")}return new e(t=s.join(""))},e.prototype.microsoftTranscription=function(){return f.sprintf("%s.ipv6-literal.net",this.correctForm().replace(/:/g,"-"))},e.prototype.mask=function(e){return void 0===e&&(e=this.subnetMask),this.getBitsBase2(0,e)},e.prototype.possibleSubnets=function(e){void 0===e&&(e=128);var r=o.BITS-this.subnetMask-Math.abs(e-o.BITS);return r<0?"0":h(new l.BigInteger("2",10).pow(r).toString(10))},e.prototype._startAddress=function(){return new l.BigInteger(this.mask()+"0".repeat(o.BITS-this.subnetMask),2)},e.prototype.startAddress=function(){return e.fromBigInteger(this._startAddress())},e.prototype.startAddressExclusive=function(){var r=new l.BigInteger("1");return e.fromBigInteger(this._startAddress().add(r))},e.prototype._endAddress=function(){return new l.BigInteger(this.mask()+"1".repeat(o.BITS-this.subnetMask),2)},e.prototype.endAddress=function(){return e.fromBigInteger(this._endAddress())},e.prototype.endAddressExclusive=function(){var r=new l.BigInteger("1");return e.fromBigInteger(this._endAddress().subtract(r))},e.prototype.getScope=function(){var e=o.SCOPES[this.getBits(12,16).intValue()];return"Global unicast"===this.getType()&&"Link local"!==e&&(e="Global"),e||"Unknown"},e.prototype.getType=function(){for(var r=0,t=Object.keys(o.TYPES);r<t.length;r++){var s=t[r];if(this.isInSubnet(new e(s)))return o.TYPES[s]}return"Global unicast"},e.prototype.getBits=function(e,r){return new l.BigInteger(this.getBitsBase2(e,r),2)},e.prototype.getBitsBase2=function(e,r){return this.binaryZeroPad().slice(e,r)},e.prototype.getBitsBase16=function(e,r){var t=r-e;if(t%4!=0)throw new Error("Length of bits to retrieve must be divisible by four");return this.getBits(e,r).toString(16).padStart(t/4,"0")},e.prototype.getBitsPastSubnet=function(){return this.getBitsBase2(this.subnetMask,o.BITS)},e.prototype.reverseForm=function(e){e||(e={});var r=Math.floor(this.subnetMask/4),t=this.canonicalForm().replace(/:/g,"").split("").slice(0,r).reverse().join(".");return r>0?e.omitSuffix?t:f.sprintf("%s.ip6.arpa.",t):e.omitSuffix?"":"ip6.arpa."},e.prototype.correctForm=function(){var e,r=[],t=0,s=[];for(e=0;e<this.parsedAddress.length;e++){var n=parseInt(this.parsedAddress[e],16);0===n&&t++,0!==n&&t>0&&(t>1&&s.push([e-t,e-1]),t=0)}t>1&&s.push([this.parsedAddress.length-t,this.parsedAddress.length-1]);var i=s.map(function(e){return e[1]-e[0]+1});if(s.length>0){var o=i.indexOf(Math.max.apply(Math,i));r=v(this.parsedAddress,s[o])}else r=this.parsedAddress;for(e=0;e<r.length;e++)"compact"!==r[e]&&(r[e]=parseInt(r[e],16).toString(16));var a=r.join(":");return a=(a=(a=a.replace(/^compact$/,"::")).replace(/^compact|compact$/,":")).replace(/compact/,"")},e.prototype.binaryZeroPad=function(){return this.bigInteger().toString(2).padStart(o.BITS,"0")},e.prototype.parse4in6=function(e){var r=e.split(":"),t=r.slice(-1)[0].match(i.RE_ADDRESS);if(t){this.parsedAddress4=t[0],this.address4=new p.Address4(this.parsedAddress4);for(var s=0;s<this.address4.groups;s++)if(/^0[0-9]+/.test(this.address4.parsedAddress[s]))throw new d.AddressError("IPv4 addresses can't have leading zeroes.",e.replace(i.RE_ADDRESS,this.address4.parsedAddress.map(g).join(".")));this.v4=!0,r[r.length-1]=this.address4.toGroup6(),e=r.join(":")}return e},e.prototype.parse=function(e){var r=(e=this.parse4in6(e)).match(o.RE_BAD_CHARACTERS);if(r)throw new d.AddressError(f.sprintf("Bad character%s detected in address: %s",r.length>1?"s":"",r.join("")),e.replace(o.RE_BAD_CHARACTERS,'<span class="parse-error">$1</span>'));var t=e.match(o.RE_BAD_ADDRESS);if(t)throw new d.AddressError(f.sprintf("Address failed regex: %s",t.join("")),e.replace(o.RE_BAD_ADDRESS,'<span class="parse-error">$1</span>'));var s=[],n=e.split("::");if(2===n.length){var i=n[0].split(":"),a=n[1].split(":");1===i.length&&""===i[0]&&(i=[]),1===a.length&&""===a[0]&&(a=[]);var p=this.groups-(i.length+a.length);if(!p)throw new d.AddressError("Error parsing groups");this.elidedGroups=p,this.elisionBegin=i.length,this.elisionEnd=i.length+this.elidedGroups,s=s.concat(i);for(var u=0;u<p;u++)s.push("0");s=s.concat(a)}else{if(1!==n.length)throw new d.AddressError("Too many :: groups found");s=e.split(":"),this.elidedGroups=0}if((s=s.map(function(e){return f.sprintf("%x",parseInt(e,16))})).length!==this.groups)throw new d.AddressError("Incorrect number of groups found");return s},e.prototype.canonicalForm=function(){return this.parsedAddress.map(B).join(":")},e.prototype.decimal=function(){return this.parsedAddress.map(function(e){return f.sprintf("%05d",parseInt(e,16))}).join(":")},e.prototype.bigInteger=function(){return new l.BigInteger(this.parsedAddress.map(B).join(""),16)},e.prototype.to4=function(){var e=this.binaryZeroPad().split("");return p.Address4.fromHex(new l.BigInteger(e.slice(96,128).join(""),2).toString(16))},e.prototype.to4in6=function(){var r=this.to4(),t=new e(this.parsedAddress.slice(0,6).join(":"),6).correctForm(),s="";return/:$/.test(t)||(s=":"),t+s+r.address},e.prototype.inspectTeredo=function(){var e=this.getBitsBase16(0,32),r=this.getBits(80,96).xor(new l.BigInteger("ffff",16)).toString(),t=p.Address4.fromHex(this.getBitsBase16(32,64)),s=p.Address4.fromHex(this.getBits(96,128).xor(new l.BigInteger("ffffffff",16)).toString(16)),n=this.getBits(64,80),i=this.getBitsBase2(64,80),o=n.testBit(15),a=n.testBit(14),u=n.testBit(8),d=n.testBit(9),c=new l.BigInteger(i.slice(2,6)+i.slice(8,16),2).toString(10);return{prefix:f.sprintf("%s:%s",e.slice(0,4),e.slice(4,8)),server4:t.address,client4:s.address,flags:i,coneNat:o,microsoft:{reserved:a,universalLocal:d,groupIndividual:u,nonce:c},udpPort:r}},e.prototype.inspect6to4=function(){var e=this.getBitsBase16(0,16),r=p.Address4.fromHex(this.getBitsBase16(16,48));return{prefix:f.sprintf("%s",e.slice(0,4)),gateway:r.address}},e.prototype.to6to4=function(){return this.is4()?new e(["2002",this.getBitsBase16(96,112),this.getBitsBase16(112,128),"","/16"].join(":")):null},e.prototype.toByteArray=function(){var e=this.bigInteger().toByteArray();return 17===e.length&&0===e[0]?e.slice(1):e},e.prototype.toUnsignedByteArray=function(){return this.toByteArray().map(y)},e.fromByteArray=function(e){return this.fromUnsignedByteArray(e.map(y))},e.fromUnsignedByteArray=function(r){for(var t=new l.BigInteger("256",10),s=new l.BigInteger("0",10),n=new l.BigInteger("1",10),i=r.length-1;i>=0;i--)s=s.add(n.multiply(new l.BigInteger(r[i].toString(10),10))),n=n.multiply(t);return e.fromBigInteger(s)},e.prototype.isCanonical=function(){return this.addressMinusSuffix===this.canonicalForm()},e.prototype.isLinkLocal=function(){return"1111111010000000000000000000000000000000000000000000000000000000"===this.getBitsBase2(0,64)},e.prototype.isMulticast=function(){return"Multicast"===this.getType()},e.prototype.is4=function(){return this.v4},e.prototype.isTeredo=function(){return this.isInSubnet(new e("2001::/32"))},e.prototype.is6to4=function(){return this.isInSubnet(new e("2002::/16"))},e.prototype.isLoopback=function(){return"Loopback"===this.getType()},e.prototype.href=function(e){return e=void 0===e?"":f.sprintf(":%s",e),f.sprintf("http://[%s]%s/",this.correctForm(),e)},e.prototype.link=function(e){e||(e={}),void 0===e.className&&(e.className=""),void 0===e.prefix&&(e.prefix="/#address="),void 0===e.v4&&(e.v4=!1);var r=this.correctForm;return e.v4&&(r=this.to4in6),e.className?f.sprintf('<a href="%1$s%2$s" class="%3$s">%2$s</a>',e.prefix,r.call(this),e.className):f.sprintf('<a href="%1$s%2$s">%2$s</a>',e.prefix,r.call(this))},e.prototype.group=function(){if(0===this.elidedGroups)return a.simpleGroup(this.address).join(":");c("number"==typeof this.elidedGroups),c("number"==typeof this.elisionBegin);var e=[],r=this.address.split("::"),t=r[0],s=r[1];t.length?e.push.apply(e,a.simpleGroup(t)):e.push("");for(var n=["hover-group"],i=this.elisionBegin;i<this.elisionBegin+this.elidedGroups;i++)n.push(f.sprintf("group-%d",i));return e.push(f.sprintf('<span class="%s"></span>',n.join(" "))),s.length?e.push.apply(e,a.simpleGroup(s,this.elisionEnd)):e.push(""),this.is4()&&(c(this.address4 instanceof p.Address4),e.pop(),e.push(this.address4.groupForV6())),e.join(":")},e.prototype.regularExpressionString=function(r){void 0===r&&(r=!1);var t=[],n=new e(this.correctForm());if(0===n.elidedGroups)t.push(u.simpleRegularExpression(n.parsedAddress));else if(n.elidedGroups===o.GROUPS)t.push(u.possibleElisions(o.GROUPS));else{var i=n.address.split("::");i[0].length&&t.push(u.simpleRegularExpression(i[0].split(":"))),c("number"==typeof n.elidedGroups),t.push(u.possibleElisions(n.elidedGroups,0!==i[0].length,0!==i[1].length)),i[1].length&&t.push(u.simpleRegularExpression(i[1].split(":"))),t=[t.join(":")]}return r||(t=s(["(?=^|",u.ADDRESS_BOUNDARY,"|[^\\w\\:])("],t,[")(?=[^\\w\\:]|",u.ADDRESS_BOUNDARY,"|$)"])),t.join("")},e.prototype.regularExpression=function(e){return void 0===e&&(e=!1),new RegExp(this.regularExpressionString(e),"i")},e}();exports.Address6=m;
|
||
},{"./common":"Kd36","./v4/constants":"HeOn","./v6/constants":"Sizg","./v6/helpers":"c6ot","./ipv4":"OohE","./v6/regular-expressions":"ont9","./address-error":"2LjA","jsbn":"JDKr","sprintf-js":"ehYi"}],"q1Rd":[function(require,module,exports) {
|
||
"use strict";var e=this&&this.__createBinding||(Object.create?function(e,r,t,i){void 0===i&&(i=t),Object.defineProperty(e,i,{enumerable:!0,get:function(){return r[t]}})}:function(e,r,t,i){void 0===i&&(i=t),e[i]=r[t]}),r=this&&this.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:!0,value:r})}:function(e,r){e.default=r}),t=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var i={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&e(i,t,n);return r(i,t),i};Object.defineProperty(exports,"__esModule",{value:!0}),exports.v6=exports.Address6=exports.Address4=void 0;var i=require("./lib/ipv4");Object.defineProperty(exports,"Address4",{enumerable:!0,get:function(){return i.Address4}});var n=require("./lib/ipv6");Object.defineProperty(exports,"Address6",{enumerable:!0,get:function(){return n.Address6}});var s=t(require("./lib/v6/helpers"));exports.v6={helpers:s};
|
||
},{"./lib/ipv4":"OohE","./lib/ipv6":"tpn3","./lib/v6/helpers":"c6ot"}],"8hCh":[function(require,module,exports) {
|
||
"use strict";const r=require("debug"),e=Object.assign(r("libp2p:ip-port-to-multiaddr"),{error:r("libp2p:ip-port-to-multiaddr:err")}),{Multiaddr:t}=require("multiaddr"),i=require("err-code"),{Address4:R,Address6:o}=require("ip-address"),d={ERR_INVALID_IP_PARAMETER:"ERR_INVALID_IP_PARAMETER",ERR_INVALID_PORT_PARAMETER:"ERR_INVALID_PORT_PARAMETER",ERR_INVALID_IP:"ERR_INVALID_IP"};function p(r,p){if("string"!=typeof r)throw i(new Error(`invalid ip provided: ${r}`),d.ERR_INVALID_IP_PARAMETER);if("string"==typeof p&&(p=parseInt(p)),isNaN(p))throw i(new Error(`invalid port provided: ${p}`),d.ERR_INVALID_PORT_PARAMETER);try{return new R(r),new t(`/ip4/${r}/tcp/${p}`)}catch{}try{const R=new o(r);return R.is4()?new t(`/ip4/${R.to4().correctForm()}/tcp/${p}`):new t(`/ip6/${r}/tcp/${p}`)}catch(E){const t=`invalid ip:port for creating a multiaddr: ${r}:${p}`;throw e.error(t),i(new Error(t),d.ERR_INVALID_IP)}}module.exports=p,module.exports.Errors=d;
|
||
},{"debug":"j+D9","multiaddr":"vIoc","err-code":"hLMW","ip-address":"q1Rd"}],"tCJS":[function(require,module,exports) {
|
||
"use strict";function e(e,t,r,n,o,i,u){try{var a=e[i](u),c=a.value}catch(s){return void r(s)}a.done?t(c):Promise.resolve(c).then(n,o)}function t(t){return function(){var r=this,n=arguments;return new Promise(function(o,i){var u=t.apply(r,n);function a(t){e(u,o,i,a,c,"next",t)}function c(t){e(u,o,i,a,c,"throw",t)}a(void 0)})}}function r(e){return new i(e)}function n(e){return function(){return new o(e.apply(this,arguments))}}function o(e){var t,r;function n(t,r){try{var u=e[t](r),a=u.value,c=a instanceof i;Promise.resolve(c?a.wrapped:a).then(function(e){c?n("return"===t?"return":"next",e):o(u.done?"return":"normal",e)},function(e){n("throw",e)})}catch(s){o("throw",s)}}function o(e,o){switch(e){case"return":t.resolve({value:o,done:!0});break;case"throw":t.reject(o);break;default:t.resolve({value:o,done:!1})}(t=t.next)?n(t.key,t.arg):r=null}this._invoke=function(e,o){return new Promise(function(i,u){var a={key:e,arg:o,resolve:i,reject:u,next:null};r?r=r.next=a:(t=r=a,n(e,o))})},"function"!=typeof e.return&&(this.return=void 0)}function i(e){this.wrapped=e}function u(e){var t;if("undefined"!=typeof Symbol){if(Symbol.asyncIterator&&null!=(t=e[Symbol.asyncIterator]))return t.call(e);if(Symbol.iterator&&null!=(t=e[Symbol.iterator]))return t.call(e)}throw new TypeError("Object is not async iterable")}"function"==typeof Symbol&&Symbol.asyncIterator&&(o.prototype[Symbol.asyncIterator]=function(){return this}),o.prototype.next=function(e){return this._invoke("next",e)},o.prototype.throw=function(e){return this._invoke("throw",e)},o.prototype.return=function(e){return this._invoke("return",e)};var a=require("abortable-iterator"),c=require("stream-to-it"),s=require("./constants"),l=s.CLOSE_TIMEOUT,f=require("libp2p-utils/src/ip-port-to-multiaddr"),p=require("debug"),d=p("libp2p:webrtcdirect:socket");d.error=p("libp2p:webrtcdirect:socket:error"),module.exports=function(e){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=c.duplex(e),s=i.sink,p=i.source,v={sink:function(){var e=t(regeneratorRuntime.mark(function e(t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return o.signal&&(t=a(t,o.signal)),e.prev=1,e.next=4,s(n(regeneratorRuntime.mark(function e(){var n,o,i,a,c,s,l;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=!0,o=!1,e.prev=2,a=u(t);case 4:return e.next=6,r(a.next());case 6:return c=e.sent,n=c.done,e.next=10,r(c.value);case 10:if(s=e.sent,n){e.next=18;break}return l=s,e.next=15,l instanceof Uint8Array?l:l.slice();case 15:n=!0,e.next=4;break;case 18:e.next=24;break;case 20:e.prev=20,e.t0=e.catch(2),o=!0,i=e.t0;case 24:if(e.prev=24,e.prev=25,n||null==a.return){e.next=29;break}return e.next=29,r(a.return());case 29:if(e.prev=29,!o){e.next=32;break}throw i;case 32:return e.finish(29);case 33:return e.finish(24);case 34:case"end":return e.stop()}},e,null,[[2,20,24,34],[25,,29,33]])}))());case 4:e.next=9;break;case 6:e.prev=6,e.t0=e.catch(1),"aborted"!==e.t0.type&&d.error(e.t0);case 9:case"end":return e.stop()}},e,null,[[1,6]])}));return function(t){return e.apply(this,arguments)}}(),source:o.signal?a(p,o.signal):p,conn:e,localAddr:e.localAddress&&e.localPort?f(e.localAddress,e.localPort):void 0,remoteAddr:o.remoteAddr,timeline:{open:Date.now()},close:function(){if(!e.destroyed)return new Promise(function(t,r){var n=Date.now(),o=setTimeout(function(){if(v.remoteAddr){var t=v.remoteAddr.toOptions(),r=t.host,o=t.port;d("timeout closing socket to %s:%s after %dms, destroying it manually",r,o,Date.now()-n)}e.destroyed||e.destroy()},l);e.once("close",function(){t()}),e.end(function(e){if(clearTimeout(o),v.timeline.close=Date.now(),e)return r(e)})})}};return e.once("close",function(){v.timeline.close||(v.timeline.close=Date.now())}),v};
|
||
},{"abortable-iterator":"LrYp","stream-to-it":"/BKi","./constants":"tkwk","libp2p-utils/src/ip-port-to-multiaddr":"8hCh","debug":"j+D9"}],"1M4T":[function(require,module,exports) {
|
||
"use strict";function e(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,t)}return n}function r(r){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?e(Object(o),!0).forEach(function(e){n(r,e,o[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):e(Object(o)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))})}return r}function n(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function t(e,r,n,t,o,i,c){try{var u=e[i](c),s=u.value}catch(a){return void n(a)}u.done?r(s):Promise.resolve(s).then(t,o)}function o(e){return function(){var r=this,n=arguments;return new Promise(function(o,i){var c=e.apply(r,n);function u(e){t(c,o,i,u,s,"next",e)}function s(e){t(c,o,i,u,s,"throw",e)}u(void 0)})}}var i=require("http"),c=require("events"),u=require("debug"),s=u("libp2p:webrtcdirect:listener");s.error=u("libp2p:webrtcdirect:listener:error");var a=require("detect-node"),l=require("wrtc"),p=require("libp2p-webrtc-peer"),f=require("multibase"),d=require("uint8arrays/to-string"),b=require("libp2p-utils/src/ip-port-to-multiaddr"),m=require("./socket-to-conn");function g(e,r){e.__connections.push(r);r.conn.once("close",function(){e.__connections=e.__connections.filter(function(e){return e!==r})})}module.exports=function(e){var n,t=e.handler,u=e.upgrader,v=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},w=new c,O=i.createServer();return w.__connections=[],O.on("request",function(){var e=o(regeneratorRuntime.mark(function e(n,o){var i,c,O,h,y,P,j;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return o.setHeader("Content-Type","text/plain"),o.setHeader("Access-Control-Allow-Origin","*"),i=n.url,c=i.split("?signal=")[1],O=f.decode(c),h=JSON.parse(d(O)),v=r({trickle:!1,wrtc:a?l:void 0},v),y=new p(v),P=m(y,{remoteAddr:b(n.connection.remoteAddress,n.connection.remotePort)}),s("new inbound connection %s",P.remoteAddr),y.on("error",function(e){s.error("incoming connectioned errored with ".concat(e))}),y.once("close",function(){y.removeAllListeners("error")}),y.on("signal",function(e){var r=JSON.stringify(e),n=f.encode("base58btc",(new TextEncoder).encode(r));o.end(d(n))}),y.signal(h),e.prev=14,e.next=17,u.upgradeInbound(P);case 17:j=e.sent,e.next=24;break;case 20:return e.prev=20,e.t0=e.catch(14),s.error("inbound connection failed to upgrade",e.t0),e.abrupt("return",P.close());case 24:s("inbound connection %s upgraded",P.remoteAddr),g(w,P),y.on("connect",function(){w.emit("connection",j),t(j),y.removeAllListeners("connect"),y.removeAllListeners("signal")});case 27:case"end":return e.stop()}},e,null,[[14,20]])}));return function(r,n){return e.apply(this,arguments)}}()),O.on("error",function(e){return w.emit("error",e)}),O.on("close",function(){return w.emit("close")}),w.listen=function(e){n=e;var r=e.toOptions();return new Promise(function(e,n){O.on("listening",function(t){if(t)return n(t);w.emit("listening"),s("Listening on %s %s",r.port,r.host),e()}),O.listen(r)})},w.close=o(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(O.listening){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,Promise.all(w.__connections.map(function(e){return e.close()}));case 4:return e.abrupt("return",new Promise(function(e,r){O.close(function(n){return n?r(n):e()})}));case 5:case"end":return e.stop()}},e)})),w.getAddrs=function(){return[n]},w};
|
||
},{"http":"sC8V","events":"wIHY","debug":"j+D9","detect-node":"Nw1e","wrtc":"sC8V","libp2p-webrtc-peer":"wnr6","multibase":"AD4F","uint8arrays/to-string":"4DOX","libp2p-utils/src/ip-port-to-multiaddr":"8hCh","./socket-to-conn":"tCJS"}],"w0hI":[function(require,module,exports) {
|
||
"use strict";function e(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}function r(r){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?e(Object(o),!0).forEach(function(e){t(r,e,o[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):e(Object(o)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))})}return r}function t(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function n(e,r,t,n,o,i,c){try{var u=e[i](c),a=u.value}catch(s){return void t(s)}u.done?r(a):Promise.resolve(a).then(n,o)}function o(e){return function(){var r=this,t=arguments;return new Promise(function(o,i){var c=e.apply(r,t);function u(e){n(c,o,i,u,a,"next",e)}function a(e){n(c,o,i,u,a,"throw",e)}u(void 0)})}}function i(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function c(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,r,t){return r&&c(e.prototype,r),t&&c(e,t),e}var a=require("debug"),s=require("debug"),l=s("libp2p:webrtcdirect");l.error=s("libp2p:webrtcdirect:error");var p=require("err-code"),f=require("wrtc"),d=require("libp2p-webrtc-peer"),b=require("detect-node"),v=require("mafmt"),g=require("multibase"),m=require("request"),h=require("class-is"),w=require("abortable-iterator"),y=w.AbortError,O=require("uint8arrays/to-string"),P=require("./constants"),q=P.CODE_CIRCUIT,E=P.CODE_P2P,j=require("./socket-to-conn"),R=require("./listener");function _(){}var C=function(){function e(r){var t=r.upgrader;i(this,e),a(t,"An upgrader must be provided. See https://github.com/libp2p/interface-transport#upgrader."),this._upgrader=t}return u(e,[{key:"dial",value:function(){var e=o(regeneratorRuntime.mark(function e(r){var t,n,o,i,c=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=c.length>1&&void 0!==c[1]?c[1]:{},e.next=3,this._connect(r,t);case 3:return n=e.sent,o=j(n,{remoteAddr:r,signal:t.signal}),l("new outbound connection %s",o.remoteAddr),e.next=8,this._upgrader.upgradeOutbound(o);case 8:return i=e.sent,l("outbound connection %s upgraded",o.remoteAddr),e.abrupt("return",i);case 11:case"end":return e.stop()}},e,this)}));return function(r){return e.apply(this,arguments)}}()},{key:"_connect",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.signal&&t.signal.aborted)throw new y;return t=r({initiator:!0,trickle:!1,wrtc:b?f:void 0},t),new Promise(function(r,n){var o,i=Date.now(),c=e.toOptions();l("Dialing %s:%s",c.host,c.port);var u=new d(t),a=function(e){if(!o){var r="connection error ".concat(c.host,":").concat(c.port,": ").concat(e.message);l.error(r),e.message=r,v(e)}},s=function(){l("connnection timeout %s:%s",c.host,c.port);var e=p(new Error("connection timeout after ".concat(Date.now()-i,"ms")),"ERR_CONNECT_TIMEOUT");u.emit("error",e)},f=function(){o=!0,l("connection opened %s:%s",c.host,c.port),v(null)},b=function(){l.error("connection aborted %s:%s",c.host,c.port),u.destroy(),v(new y)},v=function(e){u.removeListener("error",a),u.removeListener("timeout",s),u.removeListener("connect",f),u.removeAllListeners("signal"),t.signal&&t.signal.removeEventListener("abort",b),e?n(e):r(u)};u.once("error",a),u.once("timeout",s),u.once("connect",f),u.on("close",function(){return u.destroy()}),t.signal&&t.signal.addEventListener("abort",b),u.on("signal",function(e){var r=JSON.stringify(e),t="http://"+c.host+":"+c.port+("/?signal="+O(g.encode("base58btc",(new TextEncoder).encode(r))));m.get(t,function(e,r){if(e)return n(e);var t=g.decode(r.body),o=O(t),i=JSON.parse(o);u.signal(i)})})})}},{key:"createListener",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;if(!b)throw p(new Error("Can't listen if run from the Browser"),"ERR_NO_SUPPORT_FROM_BROWSER");return"function"==typeof e&&(r=e,e={}),R({handler:r=r||_,upgrader:this._upgrader},e)}},{key:"filter",value:function(e){return(e=Array.isArray(e)?e:[e]).filter(function(e){return!e.protoCodes().includes(q)&&v.WebRTCDirect.matches(e.decapsulateCode(E))})}}]),e}();module.exports=h(C,{className:"WebRTCDirect",symbolName:"@libp2p/js-libp2p-webrtc-direct/webrtcdirect"});
|
||
},{"debug":"j+D9","err-code":"hLMW","wrtc":"sC8V","libp2p-webrtc-peer":"wnr6","detect-node":"Nw1e","mafmt":"ZmIw","multibase":"AD4F","request":"sjC2","class-is":"/PSU","abortable-iterator":"LrYp","uint8arrays/to-string":"4DOX","./constants":"tkwk","./socket-to-conn":"tCJS","./listener":"1M4T"}],"qJw2":[function(require,module,exports) {
|
||
const t=require("./fixed-size");module.exports=class{constructor(i){this.hwm=i||16,this.head=new t(this.hwm),this.tail=this.head}push(i){if(!this.head.push(i)){const h=this.head;this.head=h.next=new t(2*this.head.buffer.length),this.head.push(i)}}shift(){const t=this.tail.shift();if(void 0===t&&this.tail.next){const t=this.tail.next;return this.tail.next=null,this.tail=t,this.tail.shift()}return t}isEmpty(){return this.head.isEmpty()}};
|
||
},{"./fixed-size":"qP9e"}],"kBtQ":[function(require,module,exports) {
|
||
const r=require("fast-fifo");module.exports=(e=>{let n;"function"==typeof(e=e||{})?(n=e,e={}):n=e.onEnd;let o,t,u,s=new r;const l=r=>t?t(r):(s.push(r),o),d=r=>u?o:l({done:!1,value:r}),i=e=>u?o:(u=!0,e?(e=>(s=new r,t?t({error:e}):(s.push({error:e}),o)))(e):l({done:!0}));if(o={[Symbol.asyncIterator](){return this},next:()=>{if(!s.isEmpty()){if(e.writev){let r;const e=[];for(;!s.isEmpty();){if((r=s.shift()).error)throw r.error;e.push(r.value)}return{done:r.done,value:e}}const r=s.shift();if(r.error)throw r.error;return r}return u?{done:!0}:new Promise((r,n)=>{t=(u=>(t=null,u.error?n(u.error):e.writev&&!u.done?r({done:u.done,value:[u.value]}):r(u),o))})},return:()=>(s=new r,i(),{done:!0}),throw:r=>(i(r),{done:!0}),push:d,end:i},!n)return o;const h=o;return o={[Symbol.asyncIterator](){return this},next:()=>h.next(),throw:r=>(h.throw(r),n&&(n(r),n=null),{done:!0}),return:()=>(h.return(),n&&(n(),n=null),{done:!0}),push:d,end:r=>(h.end(r),n&&(n(r),n=null),o)}});
|
||
},{"fast-fifo":"qJw2"}],"l5dt":[function(require,module,exports) {
|
||
module.exports={encode:require("./encode.js"),decode:require("./decode.js"),encodingLength:require("./length.js")};
|
||
},{"./encode.js":"qYQO","./decode.js":"ZJdu","./length.js":"Bq+a"}],"4Dle":[function(require,module,exports) {
|
||
"use strict";const t=require("varint"),e=require("bl/BufferList"),o=10240;class s{constructor(){this._pool=new Uint8Array(o),this._poolOffset=0}write(e){const s=this._pool;let r=this._poolOffset;t.encode(e.id<<3|e.type,s,r),r+=t.encode.bytes,t.encode(e.data?e.data.length:0,s,r),r+=t.encode.bytes;const i=s.subarray(this._poolOffset,r);return o-r<100?(this._pool=new Uint8Array(o),this._poolOffset=0):this._poolOffset=r,e.data?[i,e.data]:i}}const r=new s;module.exports=(t=>(async function*(){for await(const o of t)Array.isArray(o)?yield new e(o.map(t=>r.write(t))):yield new e(r.write(o))})());
|
||
},{"varint":"l5dt","bl/BufferList":"s5uv"}],"kYZA":[function(require,module,exports) {
|
||
"use strict";const e=require("varint"),t=require("bl/BufferList");module.exports=(e=>(async function*(){const t=new r;for await(const r of e){const e=t.write(r);e.length&&(yield e)}})());class r{constructor(){this._buffer=new t,this._bufferProxy=new Proxy({},{get:(e,t)=>"l"===t[0]?this._buffer[t]:this._buffer.get(parseInt(t))}),this._headerInfo=null}write(e){if(!e||!e.length)return[];this._buffer.append(e);const t=[];for(;;){if(!this._headerInfo)try{this._headerInfo=this._decodeHeader(this._bufferProxy)}catch(r){break}const{id:e,type:s,length:f,offset:n}=this._headerInfo;if(this._buffer.length-n<f)break;t.push({id:e,type:s,data:this._buffer.shallowSlice(n,n+f)}),this._buffer.consume(n+f),this._headerInfo=null}return t}_decodeHeader(t){const r=e.decode(t);let s=e.decode.bytes;const f=e.decode(t,s);return{id:r>>3,type:7&r,offset:s+=e.decode.bytes,length:f}}}
|
||
},{"varint":"l5dt","bl/BufferList":"s5uv"}],"dfwu":[function(require,module,exports) {
|
||
"use strict";exports.encode=require("./encode"),exports.decode=require("./decode");
|
||
},{"./encode":"4Dle","./decode":"kYZA"}],"AFo5":[function(require,module,exports) {
|
||
"use strict";const o=1<<20;module.exports=(o=>{o=o||1<<20;const r=r=>{if(r.data&&r.data.length>o)throw Object.assign(new Error("message size too large!"),{code:"ERR_MSG_TOO_BIG"})};return o=>(async function*(){for await(const t of o)Array.isArray(t)?t.forEach(r):r(t),yield t})()}),module.exports.MAX_MSG_SIZE=1<<20;
|
||
},{}],"N7i7":[function(require,module,exports) {
|
||
"use strict";const E=Object.freeze({NEW_STREAM:0,MESSAGE_RECEIVER:1,MESSAGE_INITIATOR:2,CLOSE_RECEIVER:3,CLOSE_INITIATOR:4,RESET_RECEIVER:5,RESET_INITIATOR:6});exports.MessageTypes=E,exports.InitiatorMessageTypes=Object.freeze({NEW_STREAM:E.NEW_STREAM,MESSAGE:E.MESSAGE_INITIATOR,CLOSE:E.CLOSE_INITIATOR,RESET:E.RESET_INITIATOR}),exports.ReceiverMessageTypes=Object.freeze({MESSAGE:E.MESSAGE_RECEIVER,CLOSE:E.CLOSE_RECEIVER,RESET:E.RESET_RECEIVER}),exports.MessageTypeNames=Object.freeze(Object.entries(E).reduce((E,e)=>(E[e[1]]=e[0],E),{}));
|
||
},{}],"ZwqK":[function(require,module,exports) {
|
||
"use strict";const e=require("abortable-iterator"),r=require("abort-controller"),t=require("debug")("libp2p:mplex:stream"),s=require("it-pushable"),i=require("bl/BufferList"),o=require("err-code"),{MAX_MSG_SIZE:a}=require("./restrict-size"),{InitiatorMessageTypes:n,ReceiverMessageTypes:l}=require("./message-types"),c="ERR_MPLEX_STREAM_RESET",d="ERR_MPLEX_STREAM_ABORT";module.exports=(({id:u,name:E,send:m,onEnd:b=(()=>{}),type:p="initiator",maxMsgSize:S=a})=>{const g=new r,M=new r,y="initiator"===p?n:l,R="initiator"===p?`i${u}`:`r${u}`;E=String(null==E?u:E);let w,_=!1,f=!1;const q=e=>{f||(f=!0,t("%s stream %s sink end",p,E,e),e&&!w&&(w=e),_&&(T.timeline.close=Date.now(),b(w)))},T={close:()=>T.source.end(),abort:e=>{t("%s stream %s abort",p,E,e),T.source.end(e),g.abort(),q(e)},reset:()=>{const e=o(new Error("stream reset"),c);M.abort(),T.source.end(e),q(e)},sink:async r=>{r=e(r,[{signal:g.signal,options:{abortMessage:"stream aborted",abortCode:d}},{signal:M.signal,options:{abortMessage:"stream reset",abortCode:c}}]),"initiator"===p&&m({id:u,type:y.NEW_STREAM,data:E});try{for await(let e of r)for(;e.length;){if(e.length<=S){m({id:u,type:y.MESSAGE,data:e});break}e=i.isBufferList(e)?e:new i(e),m({id:u,type:y.MESSAGE,data:e.shallowSlice(0,S)}),e.consume(S)}}catch(s){return s.code===c?t("%s stream %s reset",p,E):(t("%s stream %s error",p,E,s),m({id:u,type:y.RESET})),T.source.end(s),q(s)}m({id:u,type:y.CLOSE}),q()},source:s(e=>{_||(_=!0,t("%s stream %s source end",p,E,e),e&&!w&&(w=e),f&&(T.timeline.close=Date.now(),b(w)))}),timeline:{open:Date.now(),close:null},id:R};return T});
|
||
},{"abortable-iterator":"LrYp","abort-controller":"z+RH","debug":"j+D9","it-pushable":"kBtQ","bl/BufferList":"s5uv","err-code":"1zRU","./restrict-size":"AFo5","./message-types":"N7i7"}],"t7od":[function(require,module,exports) {
|
||
"use strict";const e=require("it-pipe"),s=require("it-pushable"),t=require("debug")("libp2p:mplex"),r=require("abortable-iterator"),i=require("./coder"),n=require("./restrict-size"),{MessageTypes:a,MessageTypeNames:o}=require("./message-types"),c=require("./stream");class m{constructor(e){e="function"==typeof(e=e||{})?{onStream:e}:e,this._streamId=0,this._streams={initiators:new Map,receivers:new Map},this._options=e,this.sink=this._createSink(),this.source=this._createSource(),this.onStream=e.onStream,this.onStreamEnd=e.onStreamEnd}get streams(){const e=[];return this._streams.initiators.forEach(s=>{e.push(s)}),this._streams.receivers.forEach(s=>{e.push(s)}),e}newStream(e){const s=this._streamId++;e=null==e?s.toString():String(e);const t=this._streams.initiators;return this._newStream({id:s,name:e,type:"initiator",registry:t})}_newReceiverStream({id:e,name:s}){const t=this._streams.receivers;return this._newStream({id:e,name:s,type:"receiver",registry:t})}_newStream({id:e,name:s,type:r,registry:i}){if(i.has(e))throw new Error(`${r} stream ${e} already exists!`);t("new %s stream %s %s",r,e,s);const n=c({id:e,name:s,send:i=>(t.enabled&&t("%s stream %s %s send",r,e,s,{...i,type:o[i.type],data:i.data&&i.data.slice()}),this.source.push(i)),type:r,onEnd:()=>{t("%s stream %s %s ended",r,e,s),i.delete(e),this.onStreamEnd&&this.onStreamEnd(n)},maxMsgSize:this._options.maxMsgSize});return i.set(e,n),n}_createSink(){return async s=>{this._options.signal&&(s=r(s,this._options.signal));try{await e(s,i.decode,n(this._options.maxMsgSize),async e=>{for await(const s of e)for(const e of s)this._handleIncoming(e)})}catch(a){return t("error in sink",a),this.source.end(a)}this.source.end()}}_createSource(){const e=s({onEnd:e=>{const{initiators:s,receivers:t}=this._streams;for(const r of s.values())r.abort(e);for(const r of t.values())r.abort(e)},writev:!0});return Object.assign(i.encode(e),{push:e.push,end:e.end,return:e.return})}_handleIncoming({id:e,type:s,data:r}){if(t.enabled&&t("incoming message",{id:e,type:o[s],data:r.slice()}),s===a.NEW_STREAM&&this.onStream){const s=this._newReceiverStream({id:e,name:r.toString()});return this.onStream(s)}const i=(1&s?this._streams.initiators:this._streams.receivers).get(e);if(!i)return t("missing stream %s",e);switch(s){case a.MESSAGE_INITIATOR:case a.MESSAGE_RECEIVER:i.source.push(r);break;case a.CLOSE_INITIATOR:case a.CLOSE_RECEIVER:i.close();break;case a.RESET_INITIATOR:case a.RESET_RECEIVER:i.reset();break;default:t("unknown message type %s",s)}}}m.multicodec="/mplex/6.7.0",module.exports=m;
|
||
},{"it-pipe":"p27M","it-pushable":"kBtQ","debug":"j+D9","abortable-iterator":"LrYp","./coder":"dfwu","./restrict-size":"AFo5","./message-types":"N7i7","./stream":"ZwqK"}],"Z6gr":[function(require,module,exports) {
|
||
"use strict";module.exports=require("./mplex");
|
||
},{"./mplex":"t7od"}],"TXc9":[function(require,module,exports) {
|
||
"use strict";function r(e,t){if(!e){var a=new Error(t||"Assertion failed");throw Error.captureStackTrace&&Error.captureStackTrace(a,r),a}}module.exports=r;
|
||
},{}],"7RpA":[function(require,module,exports) {
|
||
"use strict";exports.custom="inspect";
|
||
},{}],"EE4A":[function(require,module,exports) {
|
||
var Buffer = require("buffer").Buffer;
|
||
var t=require("buffer").Buffer;function i(t){var r="function"==typeof Map?new Map:void 0;return(i=function(t){if(null===t||!n(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,i)}function i(){return e(t,arguments,m(this).constructor)}return i.prototype=Object.create(t.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),h(i,t)})(t)}function e(t,i,n){return(e=f()?Reflect.construct:function(t,i,e){var n=[null];n.push.apply(n,i);var r=new(Function.bind.apply(t,n));return e&&h(r,e.prototype),r}).apply(null,arguments)}function n(t){return-1!==Function.toString.call(t).indexOf("[native code]")}function r(t,i,e){return(r="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,i,e){var n=u(t,i);if(n){var r=Object.getOwnPropertyDescriptor(n,i);return r.get?r.get.call(e):r.value}})(t,i,e||t)}function u(t,i){for(;!Object.prototype.hasOwnProperty.call(t,i)&&null!==(t=m(t)););return t}function s(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(i&&i.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),i&&h(t,i)}function h(t,i){return(h=Object.setPrototypeOf||function(t,i){return t.__proto__=i,t})(t,i)}function o(t){var i=f();return function(){var e,n=m(t);if(i){var r=m(this).constructor;e=Reflect.construct(n,arguments,r)}else e=n.apply(this,arguments);return a(this,e)}}function a(t,i){return!i||"object"!==v(i)&&"function"!=typeof i?l(t):i}function l(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function f(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}function m(t){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function v(t){return(v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function d(t,i){var e;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(e=y(t))||i&&t&&"number"==typeof t.length){e&&(t=e);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var u,s=!0,h=!1;return{s:function(){e=t[Symbol.iterator]()},n:function(){var t=e.next();return s=t.done,t},e:function(t){h=!0,u=t},f:function(){try{s||null==e.return||e.return()}finally{if(h)throw u}}}}function c(t,i){return M(t)||k(t,i)||y(t,i)||g()}function g(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function y(t,i){if(t){if("string"==typeof t)return w(t,i);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?w(t,i):void 0}}function w(t,i){(null==i||i>t.length)&&(i=t.length);for(var e=0,n=new Array(i);e<i;e++)n[e]=t[e];return n}function k(t,i){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var e=[],n=!0,r=!1,u=void 0;try{for(var s,h=t[Symbol.iterator]();!(n=(s=h.next()).done)&&(e.push(s.value),!i||e.length!==i);n=!0);}catch(o){r=!0,u=o}finally{try{n||null==h.return||h.return()}finally{if(r)throw u}}return e}}function M(t){if(Array.isArray(t))return t}function b(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")}function p(t,i){for(var e=0;e<i.length;e++){var n=i[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function q(t,i,e){return i&&p(t.prototype,i),e&&p(t,e),t}var _=require("../internal/custom"),N=_.custom,B=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],I=[0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],E=[0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176],S={p192:null,p224:null,p521:null,k256:null,p251:null,p25519:null,p448:null},R={NONE:0,QUO:1,REM:2,BOTH:3,EUCLID:4,ALL:7},O=4,A=1<<O-1,x="function"==typeof BigInt,L=function(){function i(t,e,n){b(this,i),this.words=[0],this.length=1,this.negative=0,this.red=null,this.from(t,e,n)}return q(i,[{key:"_iadd",value:function(t,i){var e=0,n=0;if(t.length<i.length){var r=[i,t];t=r[0],i=r[1]}for(t!==this&&this._alloc(t.length);n<i.length;n++){var u=(0|t.words[n])+(0|i.words[n])+e;this.words[n]=67108863&u,e=u>>>26}for(;0!==e&&n<t.length;n++){var s=(0|t.words[n])+e;this.words[n]=67108863&s,e=s>>>26}if(this.length=t.length,0!==e)this._alloc(this.length+1),this.words[this.length++]=e;else if(t!==this)for(;n<t.length;n++)this.words[n]=t.words[n];return this}},{key:"_iaddn",value:function(t){if(this.words[0]+=t,this.words[0]<67108864)return this;var i=0;for(this._alloc(this.length+1),this.words[this.length]=0;i<this.length&&this.words[i]>=67108864;i++)this.words[i]-=67108864,this.words[i+1]+=1;return this.length=Math.max(this.length,i+1),this}},{key:"iadd",value:function(t){if(V(i.isBN(t),"num","bignum"),this.negative===t.negative)this._iadd(this,t);else{var e=this.ucmp(t);if(0===e)return this.words[0]=0,this.length=1,this.negative=0,this;e<0?(this._isub(t,this),this.negative^=1):this._isub(this,t)}return this}},{key:"iaddn",value:function(t){V(rt(t),"num","smi");var i=t<0|0;return i&&(t=-t),this.negative===i?this._iaddn(t):1===this.length&&this.words[0]<t?(this.words[0]=t-this.words[0],this.negative^=1):this._isubn(t),this}},{key:"add",value:function(t){return V(i.isBN(t),"num","bignum"),t.length>this.length?t.clone().iadd(this):this.clone().iadd(t)}},{key:"addn",value:function(t){return this.clone().iaddn(t)}},{key:"_isub",value:function(t,i){var e=0,n=0;for($(t.length>=i.length),t!==this&&this._alloc(t.length);n<i.length;n++){var r=(0|t.words[n])-(0|i.words[n])+e;e=r>>26,this.words[n]=67108863&r}for(;0!==e&&n<t.length;n++){var u=(0|t.words[n])+e;e=u>>26,this.words[n]=67108863&u}if($(0===e),t!==this)for(;n<t.length;n++)this.words[n]=t.words[n];return this.length=Math.max(this.length,n),this._strip()}},{key:"_isubn",value:function(t){if(this.words[0]-=t,this.words[0]>=0)return this._normalize();$(1!==this.length),this._alloc(this.length+1);for(var i=0;i<this.length&&this.words[i]<0;i++)this.words[i]+=67108864,this.words[i+1]-=1;return this.words[this.length]=0,this._strip()}},{key:"isub",value:function(t){if(V(i.isBN(t),"num","bignum"),this.negative!==t.negative)this._iadd(this,t);else{var e=this.ucmp(t);if(0===e)return this.words[0]=0,this.length=1,this.negative=0,this;e<0?(this._isub(t,this),this.negative^=1):this._isub(this,t)}return this}},{key:"isubn",value:function(t){V(rt(t),"num","smi");var i=t<0|0;return i&&(t=-t),this.negative!==i?this._iaddn(t):1===this.length&&this.words[0]<t?(this.words[0]=t-this.words[0],this.negative^=1):this._isubn(t),this}},{key:"sub",value:function(t){return this.clone().isub(t)}},{key:"subn",value:function(t){return this.clone().isubn(t)}},{key:"_mul",value:function(t,e){if(V(i.isBN(t),"num","bignum"),V(i.isBN(e),"out","bignum"),10===this.length&&10===t.length)return gt(this,t,e);var n=this.length+t.length;return n<63?vt(this,t,e):n<1024?dt(this,t,e):ct(this,t,e)}},{key:"imul",value:function(t){return this.mul(t)._move(this)}},{key:"imuln",value:function(t){V(rt(t),"num","smi");var i=t<0|0;i&&(t=-t);for(var e=0,n=0;n<this.length;n++){var r=this.words[n]*t,u=(67108863&r)+(67108863&e);e>>=26,e+=r/67108864|0,e+=u>>>26,this.words[n]=67108863&u}return this.negative^=i,0!==e?(this._alloc(this.length+1),this.words[this.length++]=e):this._strip(),this}},{key:"mul",value:function(t){V(i.isBN(t),"num","bignum");var e=this.length+t.length,n=new i;n.words=new Array(e);for(var r=0;r<e;r++)n.words[r]=0;return this._mul(t,n)}},{key:"muln",value:function(t){return this.clone().imuln(t)}},{key:"mulShift",value:function(t,e){V(i.isBN(t),"num","bignum"),V(e>>>0===e,"bits","uint32");var n=this.mul(t),r=n.utestn(e-1);return n.iushrn(e),this.negative^t.negative?n.isubn(r):n.iaddn(r)}},{key:"_div",value:function(t,e){V(i.isBN(t),"num","bignum"),$((e&R.ALL)===e),$(e!==R.NONE);var n=this,r=t;if(it(!r.isZero()),n.isZero())return[new i(0),new i(0)];var u=n.negative,s=r.negative;n.negative=0,r.negative=0;var h=null,o=null;if(n.ucmp(r)<0)e&R.QUO&&(h=new i(0)),e&R.REM&&(o=n.clone());else if(1===r.length)e&R.QUO&&(h=n.quon(r.words[0])),e&R.REM&&(o=n.remn(r.words[0]));else{var a=c(n._wordDiv(r,e),2);h=a[0],o=a[1]}return n.negative=u,r.negative=s,e&R.QUO&&(h.negative=n.negative^r.negative,h._normalize()),e&R.REM&&(o.negative=n.negative,o._normalize()),e&R.EUCLID&&(e&R.QUO&&($(0!=(e&R.REM)),0!==o.negative&&(0!==r.negative?h.iaddn(1):h.isubn(1))),e&R.REM&&0!==o.negative&&(0!==r.negative?o.isub(r):o.iadd(r))),[h,o]}},{key:"_wordDiv",value:function(t,e){var n,r=this.clone(),u=t,s=null,h=0|u.words[u.length-1],o=26-ht(h);0!==o?(u=u.clone(),r.iushln(o),u.iushln(o),n=0|u.words[u.length-1]):n=h;var a=r.length-u.length;if($(a>=0),e&R.QUO){(s=new i(0)).length=a+1,s.words=new Array(s.length);for(var l=0;l<s.length;l++)s.words[l]=0}var f=r.clone();f._ishlnsubmul(u,1,a),0===f.negative&&(s&&(s.words[a]=1),r=f);for(var m=a-1;m>=0;m--){var v=(67108864*r.words[u.length+m]+r.words[u.length+m-1])/n|0,d=Math.min(v,67108863);for(r._ishlnsubmul(u,d,m);0!==r.negative;)d-=1,r.negative=0,r._ishlnsubmul(u,1,m),r.ineg();s&&(s.words[m]=d)}return s&&s._strip(),e&R.REM&&0!==o&&r.iushrn(o),[s,r]}},{key:"_ishlnsubmul",value:function(t,i,e){var n=0,r=0;for(this._expand(t.length+e);r<t.length;r++){var u=(0|this.words[r+e])+n,s=t.words[r]*i,h=u-(67108863&s);n=(h>>26)-(s/67108864|0),this.words[r+e]=67108863&h}for(;r<this.length-e;r++){var o=(0|this.words[r+e])+n;n=o>>26,this.words[r+e]=67108863&o}if(0===n)return this._strip();$(-1===n),n=0;for(var a=0;a<this.length;a++){var l=-(0|this.words[a])+n;n=l>>26,this.words[a]=67108863&l}return this.negative=1,this._strip()}},{key:"quorem",value:function(t){return this._div(t,R.BOTH)}},{key:"iquo",value:function(t){return this.quo(t)._move(this)}},{key:"iquon",value:function(t){V(rt(t),"num","smi"),it(0!==t);var i=t<0|0;i&&(t=-t);for(var e=0,n=this.length-1;n>=0;n--){var r=(0|this.words[n])+67108864*e;this.words[n]=r/t|0,e=r%t}return this.negative^=i,this._strip()}},{key:"quo",value:function(t){return this._div(t,R.QUO)[0]}},{key:"quon",value:function(t){return this.clone().iquon(t)}},{key:"irem",value:function(t){return this.rem(t)._move(this)}},{key:"iremn",value:function(t){var i=this.remrn(t);return i<0&&(i=-i),this.words[0]=i,this.length=1,this._normalize()}},{key:"rem",value:function(t){return this._div(t,R.REM)[1]}},{key:"remn",value:function(t){return this.clone().iremn(t)}},{key:"remrn",value:function(t){V(rt(t),"num","smi"),it(0!==t),t<0&&(t=-t);for(var i=(1<<26)%t,e=0,n=this.length-1;n>=0;n--)e=(i*e+(0|this.words[n]))%t;return 0!==this.negative?0|-e:e}},{key:"divmod",value:function(t){return this._div(t,R.BOTH|R.EUCLID)}},{key:"idiv",value:function(t){return this.div(t)._move(this)}},{key:"idivn",value:function(t){if(0===this.negative)return this.iquon(t);var i=this.remrn(t);return this.iquon(t),i<0&&(t<0?this.iaddn(1):this.isubn(1)),this}},{key:"div",value:function(t){return this._div(t,R.BOTH|R.EUCLID)[0]}},{key:"divn",value:function(t){return this.clone().idivn(t)}},{key:"imod",value:function(t){return this.ucmp(t)<0?(0!==this.negative&&(this._isub(t,this),this.negative=0),this):this.mod(t)._move(this)}},{key:"imodn",value:function(t){return this.words[0]=this.modrn(t),this.length=1,this.negative=0,this}},{key:"mod",value:function(t){return this._div(t,R.REM|R.EUCLID)[1]}},{key:"modn",value:function(t){return this.clone().imodn(t)}},{key:"modrn",value:function(t){V(rt(t),"num","smi");var i=this.remrn(t);return i<0&&(t<0?i-=t:i+=t),i}},{key:"divRound",value:function(t){var i=c(this.quorem(t),2),e=i[0],n=i[1];if(n.isZero())return e;var r=1&t.words[0];t.iushrn(1);var u=n.ucmp(t);return t.iushln(1),t.words[0]|=r,u<0||t.isOdd()&&0===u?e:this.negative^t.negative?e.isubn(1):e.iaddn(1)}},{key:"ipow",value:function(t){return this.pow(t)._move(this)}},{key:"ipown",value:function(t){return this.pown(t)._move(this)}},{key:"pow",value:function(t){V(i.isBN(t),"num","bignum");for(var e=ht(t.words[t.length-1]),n=new i(1),r=t.length-1;r>=0;r--){for(var u=t.words[r],s=e-1;s>=0;s--)n=n.sqr(),u>>s&1&&(n=n.mul(this));e=26}return n}},{key:"pown",value:function(t){if(V(rt(t),"num","smi"),t<0&&(t=-t),0===t)return new i(1);if(1===t)return this.clone();for(var e=this,n=ht(t)-2;n>=0;n--)e=e.sqr(),t>>n&1&&(e=e.mul(this));return e}},{key:"isqr",value:function(){return this.imul(this)}},{key:"sqr",value:function(){return this.mul(this)}},{key:"_rootrem",value:function(t,e){if(V(t>>>0===t,"num","uint32"),0===t)throw new RangeError("Zeroth root.");if(~t&this.negative)throw new RangeError("Negative with even root.");if(this.ucmpn(1)<=0)return[this.clone(),new i(0)];var n,r,u=new i(0),s=i.shift(1,this.bitLength()/t+1|0);if(0!==this.negative&&s.ineg(),2===t)do{u=s,(s=this.quo(u)).iadd(u),s.iushrn(1)}while(s.ucmp(u)<0);else do{s=(u=s).pown(t-1),s=this.quo(s),n=u.muln(t-1),s.iadd(n),s=s.quon(t)}while(s.ucmp(u)<0);return e&&(s=u.pown(t),r=this.sub(s)),[u,r]}},{key:"rootrem",value:function(t){return this._rootrem(t,1)}},{key:"iroot",value:function(t){return this.root(t)._move(this)}},{key:"root",value:function(t){return this._rootrem(t,0)[0]}},{key:"isPower",value:function(t){return V(t>>>0===t,"num","uint32"),!(0===t||~t&this.negative)&&0===c(this.rootrem(t),2)[1].sign()}},{key:"sqrtrem",value:function(){return this.rootrem(2)}},{key:"isqrt",value:function(){return this.sqrt()._move(this)}},{key:"sqrt",value:function(){return this.root(2)}},{key:"isSquare",value:function(){return this.isPower(2)}},{key:"iand",value:function(t){V(i.isBN(t),"num","bignum");var e=this,n=t;if(e===n)return e;if(0==(e.negative|n.negative))return e.iuand(n);if(1==(e.negative&n.negative))return e.iaddn(1),n.iaddn(1),e.iuor(n),e.isubn(1),n.isubn(1),e;if(0!==e.negative){var r=[n.clone(),e];e=r[0],n=r[1]}var u=e.bitLength();return n.iaddn(1),n.inotn(u),e.iuand(n),n.inotn(u),n.isubn(1),e._move(this)}},{key:"iandn",value:function(t){return V(rt(t),"num","smi"),0!=(this.negative|t<0)?this.iand(new i(t)):(this.words[0]&=t,this.length=1,this)}},{key:"and",value:function(t){return this.clone().iand(t)}},{key:"andn",value:function(t){return this.clone().iandn(t)}},{key:"andrn",value:function(t){if(V(rt(t),"num","smi"),0!=(this.negative|t<0)){var e=this.iand(new i(t));if(e.length>1)throw new RangeError("Number exceeds 26 bits.");return 0!==e.negative?-e.words[0]:e.words[0]}return this.words[0]&t}},{key:"iuand",value:function(t){V(i.isBN(t),"num","bignum"),this.length=Math.min(this.length,t.length);for(var e=0;e<this.length;e++)this.words[e]&=t.words[e];return this._strip()}},{key:"iuandn",value:function(t){return V(rt(t),"num","smi"),this.words[0]&=Math.abs(t),this.length=1,this._normalize()}},{key:"uand",value:function(t){return this.clone().iuand(t)}},{key:"uandn",value:function(t){return this.clone().iuandn(t)}},{key:"uandrn",value:function(t){V(rt(t),"num","smi");var i=this.words[0]&Math.abs(t);return 0!==this.negative?0|-i:i}},{key:"ior",value:function(t){V(i.isBN(t),"num","bignum");var e=this,n=t;if(e===n)return e;if(0==(e.negative|n.negative))return e.iuor(n);if(1==(e.negative&n.negative))return e.iaddn(1),n.iaddn(1),e.iuand(n),e.isubn(1),n.isubn(1),e;if(n=n.clone(),0!==e.negative){var r=[n,e];e=r[0],n=r[1]}return n.iaddn(1),e.inotn(n.bitLength()),n.iuand(e),n.isubn(1),n._move(this)}},{key:"iorn",value:function(t){return V(rt(t),"num","smi"),0!=(this.negative|t<0)?this.ior(new i(t)):(this.words[0]|=t,this)}},{key:"or",value:function(t){return this.clone().ior(t)}},{key:"orn",value:function(t){return this.clone().iorn(t)}},{key:"iuor",value:function(t){V(i.isBN(t),"num","bignum"),this._expand(t.length);for(var e=0;e<t.length;e++)this.words[e]|=t.words[e];return this}},{key:"iuorn",value:function(t){return V(rt(t),"num","smi"),this.words[0]|=Math.abs(t),this}},{key:"uor",value:function(t){return this.clone().iuor(t)}},{key:"uorn",value:function(t){return this.clone().iuorn(t)}},{key:"ixor",value:function(t){V(i.isBN(t),"num","bignum");var e=this,n=t;if(e===n)return e.words[0]=0,e.length=1,e.negative=0,e;if(0==(e.negative|n.negative))return e.iuxor(n);if(1==(e.negative&n.negative))return e.iaddn(1),n.iaddn(1),e.iuxor(n),e.ineg(),n.isubn(1),e;if(0!==e.negative){var r=[n.clone(),e];e=r[0],n=r[1]}return n.iaddn(1),e.iuxor(n),e.iaddn(1),e.ineg(),n.isubn(1),e._move(this)}},{key:"ixorn",value:function(t){return V(rt(t),"num","smi"),0!=(this.negative|t<0)?this.ixor(new i(t)):(this.words[0]^=t,this)}},{key:"xor",value:function(t){return this.clone().ixor(t)}},{key:"xorn",value:function(t){return this.clone().ixorn(t)}},{key:"iuxor",value:function(t){V(i.isBN(t),"num","bignum");var e=this,n=t;if(e.length<n.length){var r=[n,e];e=r[0],n=r[1]}for(var u=0;u<n.length;u++)this.words[u]=e.words[u]^n.words[u];if(e!==this)for(this._alloc(e.length);u<e.length;u++)this.words[u]=e.words[u];return this.length=e.length,this._strip()}},{key:"iuxorn",value:function(t){return V(rt(t),"num","smi"),this.words[0]^=Math.abs(t),this._normalize()}},{key:"uxor",value:function(t){return this.clone().iuxor(t)}},{key:"uxorn",value:function(t){return this.clone().iuxorn(t)}},{key:"inot",value:function(){return 0!==this.negative?this.ineg().isubn(1):this.iaddn(1).ineg(),this}},{key:"not",value:function(){return this.clone().inot()}},{key:"inotn",value:function(t){V(t>>>0===t,"width","uint32");var i=t%26,e=Math.ceil(t/26),n=0;for(this._expand(e),i>0&&(e-=1);n<e;n++)this.words[n]^=67108863;return i>0&&(this.words[n]^=(1<<i)-1),this._strip()}},{key:"notn",value:function(t){return this.clone().inotn(t)}},{key:"ishl",value:function(t){return V(i.isBN(t),"bits","bignum"),V(t.bitLength()<=32,"bits","uint32"),this.ishln(t.toNumber())}},{key:"ishln",value:function(t){return this.iushln(t)}},{key:"shl",value:function(t){return this.clone().ishl(t)}},{key:"shln",value:function(t){return this.clone().ishln(t)}},{key:"iushl",value:function(t){return V(i.isBN(t),"bits","bignum"),V(t.bitLength()<=32,"bits","uint32"),this.iushln(t.toNumber())}},{key:"iushln",value:function(t){V(t>>>0===t,"bits","uint32");var i=t%26,e=(t-i)/26,n=(1<<i)-1<<26-i;if(0!==i){for(var r=0,u=0;u<this.length;u++){var s=this.words[u]&n,h=(0|this.words[u])-s<<i;this.words[u]=h|r,r=s>>>26-i}0!==r&&(this._alloc(this.length+1),this.words[this.length++]=r)}if(0!==e){this._alloc(this.length+e);for(var o=this.length-1;o>=0;o--)this.words[o+e]=this.words[o];for(var a=0;a<e;a++)this.words[a]=0;this.length+=e}return this._strip()}},{key:"ushl",value:function(t){return this.clone().iushl(t)}},{key:"ushln",value:function(t){return this.clone().iushln(t)}},{key:"_split",value:function(t,i){var e=t%26,n=Math.min((t-e)/26,this.length),r=(1<<e)-1;if(i){i._alloc(n);for(var u=0;u<n;u++)i.words[u]=this.words[u];i.length=n}if(0===n);else if(this.length>n){this.length-=n;for(var s=0;s<this.length;s++)this.words[s]=this.words[s+n]}else this.words[0]=0,this.length=1;var h=0;if(0!==e)for(var o=this.length-1;o>=0;o--){var a=0|this.words[o];this.words[o]=h<<26-e|a>>>e,h=a&r}return i&&(0!==h?(i._alloc(i.length+1),i.words[i.length++]=h):(0===i.length&&(i.words[i.length++]=0),i._strip())),this._strip()}},{key:"ishr",value:function(t){return V(i.isBN(t),"bits","bignum"),V(t.bitLength()<=32,"bits","uint32"),this.ishrn(t.toNumber())}},{key:"ishrn",value:function(t){return V(t>>>0===t,"bits","uint32"),0!==this.negative?(this.iaddn(1),this.iushrn(t),this.isubn(1),this):this.iushrn(t)}},{key:"shr",value:function(t){return this.clone().ishr(t)}},{key:"shrn",value:function(t){return this.clone().ishrn(t)}},{key:"iushr",value:function(t){return V(i.isBN(t),"bits","bignum"),V(t.bitLength()<=32,"bits","uint32"),this.iushrn(t.toNumber())}},{key:"iushrn",value:function(t){return V(t>>>0===t,"bits","uint32"),this._split(t,null)}},{key:"ushr",value:function(t){return this.clone().iushr(t)}},{key:"ushrn",value:function(t){return this.clone().iushrn(t)}},{key:"setn",value:function(t,i){return V(t>>>0===t,"bit","uint32"),0!==this.negative?(this.iaddn(1),this.usetn(t,!i),this.isubn(1),this):this.usetn(t,i)}},{key:"usetn",value:function(t,i){V(t>>>0===t,"bit","uint32");var e=t%26,n=(t-e)/26;return this._expand(n+1),i?this.words[n]|=1<<e:this.words[n]&=~(1<<e),this._strip()}},{key:"testn",value:function(t){V(t>>>0===t,"bit","uint32");var i=t%26,e=(t-i)/26;if(this.length<=e)return this.negative;var n=this.words[e],r=n>>i&1;if(0!==this.negative){if(i>0&&n&(1<<i)-1)return 1^r;for(var u=e;u--;)if(this.words[u]>0)return 1^r}return r}},{key:"utestn",value:function(t){V(t>>>0===t,"bit","uint32");var i=t%26,e=(t-i)/26;return this.length<=e?0:this.words[e]>>i&1}},{key:"imaskn",value:function(t){return V(t>>>0===t,"bits","uint32"),0!==this.negative&&(this.iaddn(1),this.inotn(t+1),this.ineg()),this.iumaskn(t)}},{key:"maskn",value:function(t){return this.clone().imaskn(t)}},{key:"iumaskn",value:function(t){V(t>>>0===t,"bits","uint32");var i=t%26,e=(t-i)/26;return this.length<=e?this:(0!==i&&(e+=1),this.length=Math.min(e,this.length),0!==i&&(this.words[this.length-1]&=(1<<i)-1),0===this.length&&(this.words[this.length++]=0),this._strip())}},{key:"umaskn",value:function(t){return this.clone().iumaskn(t)}},{key:"andln",value:function(t){return this.words[0]&t}},{key:"bit",value:function(t){return this.utestn(t)}},{key:"bits",value:function(t,i){V(t>>>0===t,"pos","uint32"),V(i>>>0===i,"width","uint32"),V(i<=26,"width","width");var e=t%26,n=(t-e)/26;if(n>=this.length)return 0;var r=this.words[n]>>e&(1<<i)-1;if(e+i>26&&n+1<this.length){var u=e+i-26;r|=(this.words[n+1]&(1<<u)-1)<<26-e}return r}},{key:"ineg",value:function(){return this.isZero()||(this.negative^=1),this}},{key:"neg",value:function(){return this.clone().ineg()}},{key:"iabs",value:function(){return this.negative=0,this}},{key:"abs",value:function(){return this.clone().iabs()}},{key:"cmp",value:function(t){if(V(i.isBN(t),"num","bignum"),this.negative!==t.negative)return t.negative-this.negative;var e=this.ucmp(t);return 0!==this.negative?0|-e:e}},{key:"cmpn",value:function(t){V(rt(t),"num","smi");var i=t<0|0;if(this.negative!==i)return i-this.negative;var e=this.ucmpn(t);return 0!==this.negative?0|-e:e}},{key:"eq",value:function(t){return 0===this.cmp(t)}},{key:"eqn",value:function(t){return 0===this.cmpn(t)}},{key:"gt",value:function(t){return this.cmp(t)>0}},{key:"gtn",value:function(t){return this.cmpn(t)>0}},{key:"gte",value:function(t){return this.cmp(t)>=0}},{key:"gten",value:function(t){return this.cmpn(t)>=0}},{key:"lt",value:function(t){return this.cmp(t)<0}},{key:"ltn",value:function(t){return this.cmpn(t)<0}},{key:"lte",value:function(t){return this.cmp(t)<=0}},{key:"lten",value:function(t){return this.cmpn(t)<=0}},{key:"sign",value:function(){return 0!==this.negative?-1:1===this.length&&0===this.words[0]?0:1}},{key:"isZero",value:function(){return 1===this.length&&0===this.words[0]}},{key:"isNeg",value:function(){return 0!==this.negative}},{key:"isPos",value:function(){return 0===this.negative}},{key:"isOdd",value:function(){return 1==(1&this.words[0])}},{key:"isEven",value:function(){return 0==(1&this.words[0])}},{key:"ucmp",value:function(t){if(V(i.isBN(t),"num","bignum"),this.length<t.length)return-1;if(this.length>t.length)return 1;for(var e=this.length-1;e>=0;e--){var n=0|this.words[e],r=0|t.words[e];if(n!==r)return(n>r)-(n<r)}return 0}},{key:"ucmpn",value:function(t){if(V(rt(t),"num","smi"),this.length>1)return 1;var i=0|this.words[0];return t<0&&(t=-t),(i>t)-(i<t)}},{key:"legendre",value:function(t){var e=x?i.red(t):i.mont(t);return this.toRed(e).redLegendre()}},{key:"jacobi",value:function(t){if(V(i.isBN(t),"num","bignum"),t.isZero()||t.isEven())throw new Error("jacobi: `num` must be odd.");var e=this._cloneNormal(),n=t.clone(),r=1;for(n.isNeg()&&(e.isNeg()&&(r=-1),n.ineg()),(e.isNeg()||e.ucmp(n)>=0)&&e.imod(n);!e.isZero();){if(1&e._makeOdd()){var u=n.andln(7);3!==u&&5!==u||(r=-r)}if(e.ucmp(n)<0){var s=[n,e];n=s[1],3===(e=s[0]).andln(3)&&3===n.andln(3)&&(r=-r)}e._isub(e,n).iushrn(1);var h=n.andln(7);3!==h&&5!==h||(r=-r)}return 0!==n.cmpn(1)?0:r}},{key:"kronecker",value:function(t){V(i.isBN(t),"num","bignum");var e=[0,1,0,-1,0,-1,0,1],n=this._cloneNormal(),r=t.clone(),u=1;if(r.isZero())return 0===n.ucmpn(1)?u:0;if(!n.isOdd()&&!r.isOdd())return 0;for(1&r._makeOdd()&&(u=e[n.andln(7)]),r.isNeg()&&(n.isNeg()&&(u=-u),r.ineg());!n.isZero();){1&n._makeOdd()&&(u*=e[r.andln(7)]),(n.words[0]^67108863*n.negative)&r.words[0]&2&&(u=-u),r.imod(n);var s=[r,n];n=s[0],(r=s[1]).negative=0}return 0!==r.cmpn(1)?0:u}},{key:"igcd",value:function(t){return this.gcd(t)._move(this)}},{key:"gcd",value:function(t){if(V(i.isBN(t),"num","bignum"),this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;var r=e._factor2(n);for(0!==r&&(e.iushrn(r),n.iushrn(r));;){e._makeOdd(),n._makeOdd();var u=e.ucmp(n);if(u<0){var s=[n,e];e=s[0],n=s[1]}else if(0===u||0===n.ucmpn(1))break;e._isub(e,n)}return n.iushln(r)}},{key:"ilcm",value:function(t){return this.lcm(t)._move(this)}},{key:"lcm",value:function(t){return V(i.isBN(t),"num","bignum"),this.isZero()||t.isZero()?new i(0):this.quo(this.gcd(t)).mul(t).iabs()}},{key:"egcd",value:function(t){if(V(i.isBN(t),"num","bignum"),this.isZero())return[new i(0),new i(t.sign()),t.abs()];if(t.isZero())return[new i(this.sign()),new i(0),this.abs()];var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;var r=new i(1),u=new i(0),s=new i(0),h=new i(1),o=e._factor2(n);o>0&&(e.iushrn(o),n.iushrn(o));for(var a=e.clone(),l=n.clone();!e.isZero();){for(var f=e._makeOdd(),m=n._makeOdd();f--;)(r.isOdd()||u.isOdd())&&(r.iadd(l),u.isub(a)),r.iushrn(1),u.iushrn(1);for(;m--;)(s.isOdd()||h.isOdd())&&(s.iadd(l),h.isub(a)),s.iushrn(1),h.iushrn(1);e.cmp(n)>=0?(e.isub(n),r.isub(s),u.isub(h)):(n.isub(e),s.isub(r),h.isub(u))}return 0!==this.negative&&s.ineg(),0!==t.negative&&h.ineg(),[s,h,n.iushln(o)]}},{key:"iinvert",value:function(t){return this.invert(t)._move(this)}},{key:"invert",value:function(t){if(V(i.isBN(t),"num","bignum"),W(t.sign()>0,"invert"),t.isOdd())return this._invertp(t);if(0===t.cmpn(1))throw new RangeError("Not invertible.");var e=c(this.egcd(t),3),n=e[0];if(0!==e[2].cmpn(1))throw new RangeError("Not invertible.");return n.imod(t)}},{key:"ifermat",value:function(t){return this.fermat(t)._move(this)}},{key:"fermat",value:function(t){var e=x?i.red(t):i.mont(t);return this.toRed(e).redFermat().fromRed()}},{key:"ipowm",value:function(t,i,e){return this.powm(t,i,e)._move(this)}},{key:"powm",value:function(t,e,n){var r=!x&&n?i.mont(e):i.red(e);return this.toRed(r).redPow(t).fromRed()}},{key:"ipowmn",value:function(t,i,e){return this.powmn(t,i,e)._move(this)}},{key:"powmn",value:function(t,e,n){var r=n?i.mont(e):i.red(e);return this.toRed(r).redPown(t).fromRed()}},{key:"isqrtm",value:function(t){return this.sqrtm(t)._move(this)}},{key:"sqrtm",value:function(t){var e;return V(i.isBN(t),"p","bignum"),e=3===t.andln(3)||5===t.andln(7)?i.red(t):i.mont(t),this.toRed(e).redSqrt().fromRed()}},{key:"isqrtpq",value:function(t,i){return this.sqrtpq(t,i)._move(this)}},{key:"sqrtpq",value:function(t,i){var e=this.sqrtm(t),n=this.sqrtm(i),r=c(t.egcd(i),2),u=r[0],s=r[1],h=n.mul(u).mul(t),o=e.mul(s).mul(i),a=t.mul(i);return h.iadd(o).imod(a)}},{key:"isPrime",value:function(t,i,e){return V(i>>>0===i,"reps","uint32"),!!this.isPrimeMR(t,i+1,!0)&&!!this.isPrimeLucas(e)}},{key:"isPrimeMR",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];V(e>>>0===e,"reps","uint32"),V(e>0,"reps","integer"),V("boolean"==typeof n,"force2","boolean");var r=this;if(r.cmpn(7)<0)return 0===r.cmpn(2)||0===r.cmpn(3)||0===r.cmpn(5);if(r.isEven())return!1;var u=r.subn(1),s=u.subn(2),h=u.zeroBits(),o=u.ushrn(h),a=i.red(r),l=u.toRed(a),f=new i(1).toRed(a);t:for(var m=0;m<e;m++){var v=void 0;m===e-1&&n?v=new i(2):(v=i.random(t,0,s)).iaddn(2);var d=v.toRed(a).redPow(o);if(0!==d.cmp(f)&&0!==d.cmp(l)){for(var c=1;c<h;c++){if(0===(d=d.redSqr()).cmp(l))continue t;if(0===d.cmp(f))return!1}return!1}}return!0}},{key:"isPrimeLucas",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;V(t>>>0===t,"limit","uint32");var e=this;if(e.cmpn(1)<=0)return!1;if(e.isEven())return 0===e.cmpn(2);for(var n=3;;){if(n>1e4)throw new Error("Cannot find (D/n) = -1 for ".concat(e.toString(10),"."));if(0!==t&&n>t)return!1;var r=new i(n*n-4).jacobi(e);if(-1===r)break;if(0===r)return 0===e.cmpn(n+2);if(40===n&&e.isSquare())return!1;n+=1}for(var u=e.addn(1),s=u._makeOdd(),h=new i(2),o=new i(n),a=u.bitLength();a>=0;a--)u.utestn(a)?(h=h.mul(o).isubn(n).imod(e),o=o.sqr().isubn(2).imod(e)):(o=o.mul(h).isubn(n).imod(e),h=h.sqr().isubn(2).imod(e));if(0===h.cmpn(2)||0===h.cmp(e.subn(2))){var l=h.muln(n).imod(e),f=o.ushln(1).imod(e);if(0===l.cmp(f))return!0}for(var m=0;m<s-1;m++){if(h.isZero())return!0;if(0===h.cmpn(2))return!1;h=h.sqr().isubn(2).imod(e)}return!1}},{key:"toTwos",value:function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()}},{key:"fromTwos",value:function(t){return V(t>>>0===t,"width","uint32"),W(t>0,"width"),this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()}},{key:"toRed",value:function(t){if(V(t instanceof Q,"ctx","reduction context"),this.red)throw new Error("Already in reduction context.");return t.convertTo(this)}},{key:"fromRed",value:function(){return Y(this.red,"fromRed"),this.red.convertFrom(this)}},{key:"forceRed",value:function(t){if(V(t instanceof Q,"ctx","reduction context"),this.red){if(!t.m.eq(this.red.m)||t.mont!==this.red.mont)throw new Error("Already in reduction context.")}else W(0===this.negative,"red"),W(this.ucmp(t.m)<0,"red");return this.clone()._forceRed(t)}},{key:"redIAdd",value:function(t){return V(i.isBN(t),"num","bignum"),Y(this.red,"redIAdd"),this.red.iadd(this,t)}},{key:"redAdd",value:function(t){return V(i.isBN(t),"num","bignum"),Y(this.red,"redAdd"),this.red.add(this,t)}},{key:"redIAddn",value:function(t){return V(rt(t),"num","smi"),Y(this.red,"redIAddn"),this.red.iaddn(this,t)}},{key:"redAddn",value:function(t){return V(rt(t),"num","smi"),Y(this.red,"redAddn"),this.red.addn(this,t)}},{key:"redISub",value:function(t){return V(i.isBN(t),"num","bignum"),Y(this.red,"redISub"),this.red.isub(this,t)}},{key:"redSub",value:function(t){return V(i.isBN(t),"num","bignum"),Y(this.red,"redSub"),this.red.sub(this,t)}},{key:"redISubn",value:function(t){return V(rt(t),"num","smi"),Y(this.red,"redISubn"),this.red.isubn(this,t)}},{key:"redSubn",value:function(t){return V(rt(t),"num","smi"),Y(this.red,"redSubn"),this.red.subn(this,t)}},{key:"redIMul",value:function(t){return V(i.isBN(t),"num","bignum"),Y(this.red,"redIMul"),this.red.imul(this,t)}},{key:"redMul",value:function(t){return V(i.isBN(t),"num","bignum"),Y(this.red,"redMul"),this.red.mul(this,t)}},{key:"redIMuln",value:function(t){return V(rt(t),"num","smi"),Y(this.red,"redIMuln"),this.red.imuln(this,t)}},{key:"redMuln",value:function(t){return V(rt(t),"num","smi"),Y(this.red,"redMuln"),this.red.muln(this,t)}},{key:"redIDiv",value:function(t){return V(i.isBN(t),"num","bignum"),Y(this.red,"redIDiv"),this.red.idiv(this,t)}},{key:"redDiv",value:function(t){return V(i.isBN(t),"num","bignum"),Y(this.red,"redDiv"),this.red.div(this,t)}},{key:"redIDivn",value:function(t){return V(rt(t),"num","smi"),Y(this.red,"redIDivn"),this.red.idivn(this,t)}},{key:"redDivn",value:function(t){return V(rt(t),"num","smi"),Y(this.red,"redDivn"),this.red.divn(this,t)}},{key:"redIPow",value:function(t){return V(i.isBN(t),"num","bignum"),Y(this.red,"redIPow"),tt(!t.red,"redIPow"),this.red.ipow(this,t)}},{key:"redPow",value:function(t){return V(i.isBN(t),"num","bignum"),Y(this.red,"redPow"),tt(!t.red,"redPow"),this.red.pow(this,t)}},{key:"redIPown",value:function(t){return V(rt(t),"num","smi"),Y(this.red,"redIPown"),this.red.ipown(this,t)}},{key:"redPown",value:function(t){return V(rt(t),"num","smi"),Y(this.red,"redPown"),this.red.pown(this,t)}},{key:"redISqr",value:function(){return Y(this.red,"redISqr"),this.red.isqr(this)}},{key:"redSqr",value:function(){return Y(this.red,"redSqr"),this.red.sqr(this)}},{key:"redISqrt",value:function(){return Y(this.red,"redISqrt"),this.red.isqrt(this)}},{key:"redSqrt",value:function(){return Y(this.red,"redSqrt"),this.red.sqrt(this)}},{key:"redIDivSqrt",value:function(t){return Y(this.red,"redIDivSqrt"),this.red.idivsqrt(this,t)}},{key:"redDivSqrt",value:function(t){return Y(this.red,"redDivSqrt"),this.red.divsqrt(this,t)}},{key:"redIsSquare",value:function(){return Y(this.red,"redIsSquare"),this.red.isSquare(this)}},{key:"redIShl",value:function(t){return V(i.isBN(t),"num","bignum"),Y(this.red,"redIShl"),tt(!t.red,"redIShl"),this.red.ishl(this,t)}},{key:"redShl",value:function(t){return V(i.isBN(t),"num","bignum"),Y(this.red,"redShl"),tt(!t.red,"redShl"),this.red.shl(this,t)}},{key:"redIShln",value:function(t){return V(t>>>0===t,"num","uint32"),Y(this.red,"redIShln"),this.red.ishln(this,t)}},{key:"redShln",value:function(t){return V(t>>>0===t,"num","uint32"),Y(this.red,"redShln"),this.red.shln(this,t)}},{key:"redINeg",value:function(){return Y(this.red,"redINeg"),this.red.ineg(this)}},{key:"redNeg",value:function(){return Y(this.red,"redNeg"),this.red.neg(this)}},{key:"redEq",value:function(t){return V(i.isBN(t),"num","bignum"),Y(this.red,"redEq"),this.red.eq(this,t)}},{key:"redEqn",value:function(t){return V(rt(t),"num","smi"),Y(this.red,"redEqn"),this.red.eqn(this,t)}},{key:"redIsHigh",value:function(){return Y(this.red,"redIsHigh"),this.red.isHigh(this)}},{key:"redIsLow",value:function(){return Y(this.red,"redIsLow"),this.red.isLow(this)}},{key:"redIsOdd",value:function(){return Y(this.red,"redIsOdd"),this.red.isOdd(this)}},{key:"redIsEven",value:function(){return Y(this.red,"redIsEven"),this.red.isEven(this)}},{key:"redLegendre",value:function(){return Y(this.red,"redLegendre"),this.red.legendre(this)}},{key:"redJacobi",value:function(){return Y(this.red,"redJacobi"),this.red.jacobi(this)}},{key:"redKronecker",value:function(){return Y(this.red,"redKronecker"),this.red.kronecker(this)}},{key:"redIInvert",value:function(){return Y(this.red,"redIInvert"),this.red.iinvert(this)}},{key:"redInvert",value:function(){return Y(this.red,"redInvert"),this.red.invert(this)}},{key:"redIFermat",value:function(){return Y(this.red,"redIFermat"),this.red.ifermat(this)}},{key:"redFermat",value:function(){return Y(this.red,"redFermat"),this.red.fermat(this)}},{key:"_move",value:function(t){return t.words=this.words,t.length=this.length,t.negative=this.negative,t.red=this.red,t}},{key:"_alloc",value:function(t){for(;this.words.length<t;)this.words.push(0);return this}},{key:"_expand",value:function(t){for(this._alloc(t);this.length<t;)this.words[this.length++]=0;return this}},{key:"_strip",value:function(){for(;this.length>1&&0===this.words[this.length-1];)this.length-=1;return this._normalize()}},{key:"_normalize",value:function(){return $(this.length>0),1===this.length&&0===this.words[0]&&(this.negative=0),this}},{key:"_check",value:function(){return $(this.length>0),$(this.length<=this.words.length),1===this.length?(0===this.words[0]&&$(0===this.negative),this):($(0!==this.words[this.length-1]),this)}},{key:"_invertp",value:function(t){if(V(i.isBN(t),"p","bignum"),W(t.sign()>0,"invert"),$(t.isOdd()),0===t.cmpn(1))throw new RangeError("Not invertible.");var e=this.clone(),n=t.clone(),r=new i(1),u=new i(0);for((e.isNeg()||e.ucmp(n)>=0)&&e.imod(n);!e.isZero();){for(var s=e._makeOdd(),h=n._makeOdd();s--;)r.isOdd()&&r._iadd(r,t),r.iushrn(1);for(;h--;)u.isOdd()&&u._iadd(u,t),u.iushrn(1);e.ucmp(n)>=0?(e._isub(e,n),r.ucmp(u)<0?(r._isub(u,r),r._isub(t,r)):r._isub(r,u)):(n._isub(n,e),u.ucmp(r)<0?(u._isub(r,u),u._isub(t,u)):u._isub(u,r))}if(0!==n.cmpn(1))throw new RangeError("Not invertible.");return $(0===u.negative),$(u.ucmp(t)<0),u}},{key:"_makeOdd",value:function(){var t=this.zeroBits();return t>0&&this.iushrn(t),t}},{key:"_factor2",value:function(t){if(1&(this.words[0]|t.words[0]))return 0;for(var i=Math.min(this.length,t.length),e=0,n=0;n<i;n++){var r=ot(this.words[n]|t.words[n]);if(e+=r,26!==r)break}return e}},{key:"_cloneNormal",value:function(){return this.red?this.fromRed():this.clone()}},{key:"_forceRed",value:function(t){return this.red=t,this}},{key:"clone",value:function(){var t=new i;t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];return t.length=this.length,t.negative=this.negative,t.red=this.red,t}},{key:"inject",value:function(t){V(i.isBN(t),"num","bignum"),this._alloc(t.length);for(var e=0;e<t.length;e++)this.words[e]=t.words[e];return this.length=t.length,this.negative=t.negative,this.red=t.red,this}},{key:"set",value:function(t,i){return this.fromNumber(t,i)}},{key:"swap",value:function(t){V(i.isBN(t),"num","bignum");var e=this,n=t,r=[n.words,e.words];e.words=r[0],n.words=r[1];var u=[n.length,e.length];e.length=u[0],n.length=u[1];var s=[n.negative,e.negative];e.negative=s[0],n.negative=s[1];var h=[n.red,e.red];return e.red=h[0],n.red=h[1],e}},{key:"reverse",value:function(){var t=this.negative;return this.fromBuffer(this.toBuffer("be"),"le"),this.negative=t,this}},{key:"byteLength",value:function(){return Math.ceil(this.bitLength()/8)}},{key:"bitLength",value:function(){var t=ht(this.words[this.length-1]);return 26*(this.length-1)+t}},{key:"zeroBits",value:function(){if(this.isZero())return 0;if(this.isOdd())return 0;for(var t=0,i=0;i<this.length;i++){var e=ot(this.words[i]);if(t+=e,26!==e)break}return t}},{key:"isSafe",value:function(){return this.length<=2||3===this.length&&1===this.words[2]}},{key:"word",value:function(t){return V(t>>>0===t,"pos","uint32"),t>=this.length?0:this.words[t]}},{key:N,value:function(){var t="BN";return this.red&&(t="BN-R"),"<".concat(t,": ").concat(this.toString(10),">")}},{key:"toNumber",value:function(){var t=this.words[0];if(2===this.length)t+=67108864*this.words[1];else if(3===this.length&&1===this.words[2])t+=4503599627370496+67108864*this.words[1];else if(this.length>2)throw new RangeError("Number can only safely store up to 53 bits.");return 0!==this.negative?-t:t}},{key:"toDouble",value:function(){for(var t=0,i=this.length-1;i>=0;i--)t=67108864*t+this.words[i];return 0!==this.negative?-t:t}},{key:"valueOf",value:function(){return this.toDouble()}},{key:"toBigInt",value:function(){if(!x)throw new Error("BigInt is not supported!");for(var t=BigInt(52),i=BigInt(26),e=this.length-1,n=BigInt(0);e>=1;e-=2){var r=67108864*this.words[e],u=this.words[e-1];n=n<<t|BigInt(r+u)}return e>=0&&(n=n<<i|BigInt(this.words[0])),0!==this.negative?-n:n}},{key:"toBool",value:function(){return!this.isZero()}},{key:"toString",value:function(t,i){if(null==i&&(i=0),0===i&&(i=1),V((t=st(t))>>>0===t,"base","uint32"),V(i>>>0===i,"padding","uint32"),t<2||t>36)throw new RangeError("Base ranges between 2 and 36.");if(this._check(),16===t){for(var e="",n=0,r=0,u=0;u<this.length;u++){var s=this.words[u],h=(16777215&(s<<n|r)).toString(16);e=0!==(r=s>>>24-n&16777215)||u!==this.length-1?B[6-h.length]+h+e:h+e,(n+=2)>=26&&(n-=26,u-=1)}for(0!==r&&(e=r.toString(16)+e);e.length%i!=0;)e="0"+e;return 0!==this.negative&&(e="-"+e),e}var o=I[t-1],a=E[t-1],l=this.clone(),f="";for(l.negative=0;!l.isZero();){var m=l.remrn(a).toString(t);l.iquon(a),f=l.isZero()?m+f:B[o-m.length]+m+f}for(this.isZero()&&(f="0");f.length%i!=0;)f="0"+f;return 0!==this.negative&&(f="-"+f),f}},{key:"toJSON",value:function(){return this.toString(16,2)}},{key:"toArray",value:function(t,i){return this.toArrayLike(Array,t,i)}},{key:"toBuffer",value:function(i,e){return this.toArrayLike(t,i,e)}},{key:"toArrayLike",value:function(t,i,e){null==i&&(i="be"),null==e&&(e=0),V("function"==typeof t,"ArrayType","function"),V("be"===i||"le"===i,"endian","endianness"),V(e>>>0===e,"length","uint32"),this._check();var n=this.byteLength(),r=e||Math.max(1,n);if(n>r)throw new RangeError("Byte array longer than desired length.");var u=ut(t,r);if("be"===i){for(var s=u.length-1,h=0,o=0;o<this.length;o++){var a=(3&o)<<1,l=this.words[o]<<a|h;u[s--]=255&l,s>=0&&(u[s--]=l>>>8&255),s>=0&&(u[s--]=l>>>16&255),6===a?(s>=0&&(u[s--]=l>>>24&255),h=0):h=l>>>24}if(s>=0){for(u[s--]=h;s>=0;)u[s--]=0;h=0}$(0===h)}else{for(var f=0,m=0,v=0;v<this.length;v++){var d=(3&v)<<1,c=this.words[v]<<d|m;u[f++]=255&c,f<u.length&&(u[f++]=c>>>8&255),f<u.length&&(u[f++]=c>>>16&255),6===d?(f<u.length&&(u[f++]=c>>>24&255),m=0):m=c>>>24}if(f<u.length){for(u[f++]=m;f<u.length;)u[f++]=0;m=0}$(0===m)}return u}},{key:"encode",value:function(t,i){return this.toBuffer(t,i)}},{key:"of",value:function(t,i){return this.fromNumber(t,i)}},{key:"fromNumber",value:function(t,i){null==i&&(i="be"),V(nt(t),"num","integer"),V("be"===i||"le"===i,"endian","endianness");var e=t<0|0;return e&&(t=-t),t<67108864?(this.words[0]=67108863&t,this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(this.words=[67108863&t,t/67108864&67108863,1],this.length=3),this.negative=e,"le"===i&&this.reverse(),this}},{key:"fromDouble",value:function(t,i){null==i&&(i="be"),V("number"==typeof t,"num","double"),V("be"===i||"le"===i,"endian","endianness"),isFinite(t)||(t=0);var e=t<=-1|0;for(t<0&&(t=-t),t=Math.floor(t),this.words=[];t>0;){var n=t%67108864,r=(t-n)/67108864;this.words.push(n),t=r}return 0===this.words.length&&this.words.push(0),this.length=this.words.length,this.negative=e,"le"===i&&this.reverse(),this}},{key:"fromBigInt",value:function(t,i){if(null==i&&(i="be"),V("bigint"==typeof t,"num","bigint"),V("be"===i||"le"===i,"endian","endianness"),!x)throw new Error("BigInt is not supported!");var e=t<BigInt(0)|0;return this._fromHex(t.toString(16),e),this.negative=e,"le"===i&&this.reverse(),this}},{key:"fromBool",value:function(t){return V("boolean"==typeof t,"value","boolean"),this.words[0]=0|t,this.length=1,this.negative=0,this}},{key:"fromString",value:function(t,i,e){if("le"===i||"be"===i){var n=[e,i];i=n[0],e=n[1]}if(i=st(i),null==e&&(e="be"),V("string"==typeof t,"string","string"),V(i>>>0===i,"base","uint32"),V("be"===e||"le"===e,"endian","endianness"),i<2||i>36)throw new Error("Base ranges between 2 and 36.");var r=0;return(t=t.replace(/\s+/g,"")).length>0&&45===t.charCodeAt(0)&&(r=1),16===i?this._fromHex(t,r):this._fromBase(t,i,r),this.negative=r,this._normalize(),"le"===e&&this.reverse(),this}},{key:"_fromHex",value:function(t,i){this.length=Math.max(2,Math.ceil((t.length-i)/6)),this.words=new Array(this.length);for(var e=0;e<this.length;e++)this.words[e]=0;for(var n=0,r=t.length-6,u=0;r>=i;r-=6){var s=at(t,r,r+6);this.words[u]|=s<<n&67108863,this.words[u+1]|=s>>>26-n&4194303,(n+=24)>=26&&(n-=26,u+=1)}if(r+6!==i){var h=at(t,i,r+6);this.words[u]|=h<<n&67108863,this.words[u+1]|=h>>>26-n&4194303}return this._strip()}},{key:"_fromBase",value:function(t,i,e){this.words[0]=0,this.length=1,this.negative=0;for(var n=0,r=1;r<=67108863;r*=i)n+=1;n-=1,r=r/i|0;for(var u=t.length-e,s=u%n,h=Math.min(u,u-s)+e,o=e;o<h;o+=n){var a=lt(t,o,o+n,i);this.imuln(r),this._iaddn(a)}if(0!==s){var l=Math.pow(i,s),f=lt(t,o,t.length,i);this.imuln(l),this._iaddn(f)}return this}},{key:"fromJSON",value:function(t){if(i.isBN(t))return t.red?t.fromRed():t.clone();if(Array.isArray(t)){var e,n=d(t);try{for(n.s();!(e=n.n()).done;){V("string"==typeof e.value,"chunk","string")}}catch(r){n.e(r)}finally{n.f()}t=t.join("")}return this.fromString(t,16)}},{key:"fromBN",value:function(t){return this.inject(t)}},{key:"fromArray",value:function(t,i){return V(Array.isArray(t),"data","array"),this.fromArrayLike(t,i)}},{key:"fromBuffer",value:function(i,e){return V(t.isBuffer(i),"data","buffer"),this.fromArrayLike(i,e)}},{key:"fromArrayLike",value:function(t,i){if(null==i&&(i="be"),V(t&&t.length>>>0===t.length,"data","array-like"),V("be"===i||"le"===i,"endian","endianness"),0===t.length)return this.words[0]=0,this.length=1,this.negative=0,this;this.length=Math.max(2,Math.ceil(t.length/3)),this.words=new Array(this.length),this.negative=0;for(var e=0;e<this.length;e++)this.words[e]=0;var n=t.length%3,r=0,u=0,s=0;if("be"===i){for(var h=t.length-1;h>=2;h-=3){var o=t[h]|t[h-1]<<8|t[h-2]<<16;this.words[u]|=o<<r&67108863,this.words[u+1]=o>>>26-r&67108863,(r+=24)>=26&&(r-=26,u+=1)}switch(n){case 2:s=t[1]|t[0]<<8;break;case 1:s=t[0]}}else{for(var a=t.length-n,l=0;l<a;l+=3){var f=t[l]|t[l+1]<<8|t[l+2]<<16;this.words[u]|=f<<r&67108863,this.words[u+1]=f>>>26-r&67108863,(r+=24)>=26&&(r-=26,u+=1)}switch(n){case 2:s=t[a]|t[a+1]<<8;break;case 1:s=t[a]}}return n>0&&(this.words[u]|=s<<r&67108863,this.words[u+1]=s>>>26-r&67108863),this._strip()}},{key:"decode",value:function(t,i){return this.fromBuffer(t,i)}},{key:"from",value:function(t,e,n){if(null==t)return this;if("le"===e||"be"===e){var r=[n,e];e=r[0],n=r[1]}if("number"==typeof t)return this.fromNumber(t,n);if("bigint"==typeof t)return this.fromBigInt(t,n);if("string"==typeof t)return this.fromString(t,e,n);if("object"===v(t)){if(i.isBN(t))return this.fromBN(t,n);if(t.length>>>0===t.length)return this.fromArrayLike(t,n)}if("boolean"==typeof t)return this.fromBool(t);throw new TypeError("Non-numeric object passed to BN.")}}],[{key:"min",value:function(){for(var t=null,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];for(var u=0,s=n;u<s.length;u++){var h=s[u];V(i.isBN(h),"num","bignum"),(!t||h.cmp(t)<0)&&(t=h)}return t||new i(0)}},{key:"max",value:function(){for(var t=null,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];for(var u=0,s=n;u<s.length;u++){var h=s[u];V(i.isBN(h),"num","bignum"),(!t||h.cmp(t)>0)&&(t=h)}return t||new i(0)}},{key:"cmp",value:function(t,e){return V(i.isBN(t),"a","bignum"),t.cmp(e)}},{key:"ucmp",value:function(t,e){return V(i.isBN(t),"a","bignum"),t.ucmp(e)}},{key:"red",value:function(t){return new Q(t)}},{key:"barrett",value:function(t){return new J(t)}},{key:"mont",value:function(t){return new G(t)}},{key:"_prime",value:function(t){if(S[t])return S[t];var i;if("p192"===t)i=new D;else if("p224"===t)i=new z;else if("p521"===t)i=new F;else if("k256"===t)i=new U;else if("p251"===t)i=new C;else if("p25519"===t)i=new H;else{if("p448"!==t)throw new Error('Unknown prime: "'.concat(t,'".'));i=new K}return S[t]=i,i}},{key:"prime",value:function(t){return i._prime(t).p.clone()}},{key:"pow",value:function(t,e){return 2===t?i.shift(1,e):(new i).fromNumber(t).pown(e)}},{key:"shift",value:function(t,e){return 1===t?new i(0).usetn(e,1):(new i).fromNumber(t).ishln(e)}},{key:"mask",value:function(t){return i.shift(1,t).isubn(1)}},{key:"randomBits",value:function(e,n){if(V(null!=e,"rng","rng"),V(n>>>0===n,"bits","uint32"),"object"===v(e)){V("function"==typeof e.randomBytes,"rng","rng");var r=n+7>>>3,u=8*r,s=e.randomBytes(r);if(V(t.isBuffer(s),"bytes","buffer"),s.length!==r)throw new RangeError("Invalid number of bytes returned from RNG.");var h=i.fromBuffer(s);return u>n&&h.iushrn(u-n),h}V("function"==typeof e,"rng","rng");var o=e(n);if(V(i.isBN(o),"num","bignum"),W(0===o.negative,"RNG"),tt(!o.red,"RNG"),o.bitLength()>n)throw new RangeError("Invalid number of bits returned from RNG.");return o}},{key:"random",value:function(t,e,n){if(e=i.cast(e,16),n=i.cast(n,16),e.cmp(n)>0)throw new RangeError("Minimum cannot be greater than maximum.");var r=n.sub(e).iabs(),u=r.bitLength();if(0===u)return e.clone();for(;;){var s=i.randomBits(t,u);if(!(s.cmp(r)>=0))return s.iadd(e),s}}},{key:"of",value:function(t,e){return(new i).of(t,e)}},{key:"fromNumber",value:function(t,e){return(new i).fromNumber(t,e)}},{key:"fromDouble",value:function(t,e){return(new i).fromDouble(t,e)}},{key:"fromBigInt",value:function(t,e){return(new i).fromBigInt(t,e)}},{key:"fromBool",value:function(t){return(new i).fromBool(t)}},{key:"fromString",value:function(t,e,n){return(new i).fromString(t,e,n)}},{key:"fromJSON",value:function(t){return(new i).fromJSON(t)}},{key:"fromBN",value:function(t){return(new i).fromBN(t)}},{key:"fromArray",value:function(t,e){return(new i).fromArray(t,e)}},{key:"fromBuffer",value:function(t,e){return(new i).fromBuffer(t,e)}},{key:"fromArrayLike",value:function(t,e){return(new i).fromArrayLike(t,e)}},{key:"decode",value:function(t,e){return(new i).decode(t,e)}},{key:"from",value:function(t,e,n){return(new i).from(t,e,n)}},{key:"cast",value:function(t,e,n){return i.isBN(t)?t:new i(t,e,n)}},{key:"isBN",value:function(t){return t instanceof i}}]),i}();L.BN=L,L.wordSize=26,L.native=0;var Z=function(){function t(i,e){b(this,t),this.name=i,this.p=new L(e,16),this.n=this.p.bitLength(),this.k=L.shift(1,this.n).isub(this.p),this.lo=this.p.clone(),this.one=this.p.clone()}return q(t,[{key:"ireduce",value:function(t){var i=0!==t.negative,e=t.bitLength();for($(e<=2*this.n),t.negative=0;e>this.n;)this.split(t,this.lo),this.imulK(t),t._iadd(t,this.lo),e=t.bitLength();var n=e<this.n?-1:t.ucmp(this.p);return 0===n?(t.words[0]=0,t.length=1):n>0&&t._isub(t,this.p),i&&!t.isZero()&&t._isub(this.p,t),t}},{key:"split",value:function(t,i){t._split(this.n,i)}},{key:"imulK",value:function(t){return t.imul(this.k)}},{key:"pm2",value:function(t){throw new Error("Not implemented.")}},{key:"fermat",value:function(t){return this.pm2(t)}}]),t}(),j=function(t){s(e,Z);var i=o(e);function e(t,n){return b(this,e),i.call(this,t,n)}return q(e,[{key:"pm3d4",value:function(t){throw new Error("Not implemented.")}},{key:"pp1d4",value:function(t){throw new Error("Not implemented.")}},{key:"sqrt",value:function(t){var i=t.red,e=this.pp1d4(t);if(!i.sqr(e).eq(t))throw new et(e);return e}},{key:"divsqrt",value:function(t,i){var e=t.red,n=e.sqr(t),r=e.mul(n,t),u=e.mul(r,n),s=e.mul(e.sqr(i),i),h=this.pm3d4(e.mul(u,s)),o=e.mul(e.mul(r,i),h);if(e.mul(i,e.sqr(o)).eq(t))return o;throw new et(o)}}]),e}(),T=function(t){s(e,Z);var i=o(e);function e(t,n,r){var u;return b(this,e),(u=i.call(this,t,n)).sm1=new L(r,16),u}return q(e,[{key:"pm5d8",value:function(t){throw new Error("Not implemented.")}},{key:"pp3d8",value:function(t){throw new Error("Not implemented.")}},{key:"sqrt",value:function(t){var i=t.red,e=this.sm1._forceRed(i),n=this.pp3d8(t);if(i.sqr(n).eq(t))return n;var r=i.mul(n,e);if(i.sqr(r).eq(t))return r;throw new et(n)}},{key:"divsqrt",value:function(t,i){var e=t.red,n=this.sm1._forceRed(e),r=e.mul(e.sqr(i),i),u=e.mul(e.sqr(r),i),s=this.pm5d8(e.mul(t,u)),h=e.mul(e.mul(t,r),s),o=e.mul(i,e.sqr(h));if(o.eq(t))return h;var a=e.ineg(o);if(a.eq(t))return e.mul(h,n);if(a.eq(e.mul(t,n)))throw new et(e.mul(h,n));throw new et(h)}}]),e}(),P=function(t){s(e,Z);var i=o(e);function e(t,n,r){var u;return b(this,e),(u=i.call(this,t,n)).g=new L(r,16),u.z=u.p.subn(1).zeroBits(),u}return q(e,[{key:"powS",value:function(t){throw new Error("Not implemented.")}},{key:"powE",value:function(t){throw new Error("Not implemented.")}},{key:"sqrt",value:function(t){var i=t.red;switch(i.jacobi(t)){case-1:throw new et(t);case 0:return t.clone()}for(var e=this.g._forceRed(i),n=this.powE(t),r=this.powS(t),u=this.z;;){for(var s=r,h=0;0!==s.cmpn(1)&&h<u;)s=i.sqr(s),h+=1;if(0===h)break;$(h<u),s=i.sqrn(e,u-h-1),e=i.sqr(s),n=i.mul(n,s),r=i.mul(r,e),u=h}return n}},{key:"divsqrt",value:function(t,i){var e=t.red;if(i.isZero())throw new et(i);return this.sqrt(e.div(t,i))}}]),e}(),D=function(t){s(e,j);var i=o(e);function e(){return b(this,e),i.call(this,"p192","ffffffff ffffffff ffffffff fffffffeffffffff ffffffff")}return q(e,[{key:"imulK",value:function(t){var i=this.one.inject(t);return t.iushln(64)._iadd(t,i)}},{key:"core",value:function(t){var i=t.red,e=i.sqrnmul(t,1,t),n=i.sqrnmul(e,1,t),r=i.sqrnmul(n,3,n),u=i.sqrnmul(r,6,r),s=i.sqrnmul(u,12,u),h=i.sqrnmul(s,6,r),o=i.sqrnmul(h,1,t),a=i.sqrnmul(o,31,o),l=i.sqrnmul(a,62,a),f=i.sqrnmul(l,3,n),m=i.sqrn(f,1);return i.sqrnmul(m,62,a)}},{key:"pm3d4",value:function(t){return this.core(t)}},{key:"pm2",value:function(t){var i=t.red,e=this.core(t),n=i.sqrn(e,1);return i.sqrnmul(n,1,t)}},{key:"pp1d4",value:function(t){var i=t.red,e=i.sqrnmul(t,1,t),n=i.sqrnmul(e,2,e),r=i.sqrnmul(n,4,n),u=i.sqrnmul(r,8,r),s=i.sqrnmul(u,16,u),h=i.sqrnmul(s,32,s),o=i.sqrnmul(h,64,h);return i.sqrn(o,62)}}]),e}(),z=function(t){s(e,P);var i=o(e);function e(){return b(this,e),i.call(this,"p224","ffffffff ffffffff ffffffff ffffffff00000000 00000000 00000001","6a0fec67 8598a792 0c55b2d4 0b2d6ffbbea3d8ce f3fb3632 dc691b74")}return q(e,[{key:"imulK",value:function(t){var i=this.one.inject(t);return t.iushln(96)._isub(t,i)}},{key:"powS",value:function(t){var i=t.red,e=i.sqrnmul(t,1,t),n=i.sqrnmul(e,2,e),r=i.sqrnmul(n,4,n),u=i.sqrnmul(r,8,r),s=i.sqrnmul(u,16,u),h=i.sqrnmul(s,32,s);return i.sqrnmul(h,64,h)}},{key:"powE",value:function(t){return t.red.sqrn(t,127)}},{key:"pm2",value:function(t){var i=t.red,e=i.sqrnmul(t,1,t),n=i.sqrnmul(e,1,t),r=i.sqrnmul(n,3,n),u=i.sqrnmul(r,6,r),s=i.sqrnmul(u,12,u),h=i.sqrnmul(s,24,s),o=i.sqrnmul(h,48,h),a=i.sqrnmul(o,24,s),l=i.sqrnmul(a,6,r),f=i.sqrnmul(l,1,t),m=i.sqrn(f,1);return i.sqrnmul(m,96,o)}}]),e}(),F=function(t){s(e,j);var i=o(e);function e(){return b(this,e),i.call(this,"p521","000001ff ffffffff ffffffff ffffffffffffffff ffffffff ffffffff ffffffffffffffff ffffffff ffffffff ffffffffffffffff ffffffff ffffffff ffffffffffffffff")}return q(e,[{key:"imulK",value:function(t){return t}},{key:"core",value:function(t){var i=t.red,e=i.sqrnmul(t,1,t),n=i.sqrnmul(e,1,t),r=i.sqrnmul(n,3,n),u=i.sqrnmul(r,1,t),s=i.sqrnmul(u,1,t),h=i.sqrnmul(s,8,s),o=i.sqrnmul(h,16,h),a=i.sqrnmul(o,32,o),l=i.sqrnmul(a,64,a),f=i.sqrnmul(l,128,l),m=i.sqrnmul(f,256,f);return i.sqrnmul(m,7,u)}},{key:"pm3d4",value:function(t){return this.core(t)}},{key:"pm2",value:function(t){var i=t.red,e=this.core(t),n=i.sqrn(e,1);return i.sqrnmul(n,1,t)}},{key:"pp1d4",value:function(t){return t.red.sqrn(t,519)}}]),e}(),U=function(t){s(e,j);var i=o(e);function e(){return b(this,e),i.call(this,"k256","ffffffff ffffffff ffffffff ffffffffffffffff ffffffff fffffffe fffffc2f")}return q(e,[{key:"split",value:function(t,i){var e=Math.min(t.length,9);i._alloc(e+1);for(var n=0;n<e;n++)i.words[n]=t.words[n];if(i.length=e,t.length<=9)return i._strip(),t.words[0]=0,void(t.length=1);var r=t.words[9],u=10;for(i.words[i.length++]=4194303&r,i._strip();u<t.length;u++){var s=0|t.words[u];t.words[u-10]=(4194303&s)<<4|r>>>22,r=s}r>>>=22,t.words[u-10]=r,0===r&&t.length>10?t.length-=10:t.length-=9,t._strip()}},{key:"imulK",value:function(t){t._expand(t.length+2);for(var i=0,e=0;e<t.length;e++){var n=t.words[e];i+=977*n,t.words[e]=67108863&i,i=64*n+Math.floor(i/67108864)}return 0===t.words[t.length-1]&&(t.length-=1,0===t.words[t.length-1]&&(t.length-=1)),t}},{key:"core",value:function(t,i){var e=t.red,n=e.sqrnmul(i,1,t),r=e.sqrnmul(n,3,n),u=e.sqrnmul(r,3,n),s=e.sqrnmul(u,2,i),h=e.sqrnmul(s,11,s),o=e.sqrnmul(h,22,h),a=e.sqrnmul(o,44,o),l=e.sqrnmul(a,88,a),f=e.sqrnmul(l,44,o),m=e.sqrnmul(f,3,n),v=e.sqrn(m,1),d=e.sqrnmul(v,22,h);return e.sqrn(d,4)}},{key:"pm3d4",value:function(t){var i=t.red,e=i.sqrnmul(t,1,t),n=this.core(t,e),r=i.sqrnmul(n,1,t),u=i.sqrn(r,1);return i.sqrnmul(u,2,e)}},{key:"pm2",value:function(t){var i=t.red,e=i.sqrnmul(t,1,t),n=this.core(t,e),r=i.sqrnmul(n,1,t),u=i.sqrn(r,1),s=i.sqrnmul(u,2,e),h=i.sqrn(s,1);return i.sqrnmul(h,1,t)}},{key:"pp1d4",value:function(t){var i=t.red,e=i.sqrnmul(t,1,t),n=this.core(t,e),r=i.sqrnmul(n,2,e);return i.sqrn(r,2)}}]),e}(),C=function(t){s(e,j);var i=o(e);function e(){return b(this,e),i.call(this,"p251","07ffffff ffffffff ffffffff ffffffffffffffff ffffffff ffffffff fffffff7")}return q(e,[{key:"imulK",value:function(t){if(t.isZero())return t;for(var i=0,e=0;e<t.length;e++){var n=9*t.words[e]+i;i=n>>>26,t.words[e]=67108863&n}return 0!==i&&(t._alloc(t.length+1),t.words[t.length++]=i),t}},{key:"core",value:function(t){var i=t.red,e=i.sqrnmul(t,1,t),n=i.sqrnmul(e,1,t),r=i.sqrnmul(n,3,n),u=i.sqrnmul(r,6,r),s=i.sqrnmul(u,12,u),h=i.sqrnmul(s,24,s),o=i.sqrnmul(h,48,h),a=i.sqrnmul(o,96,o),l=i.sqrnmul(a,48,h),f=i.sqrnmul(l,6,r);return i.sqrnmul(f,1,t)}},{key:"pm3d4",value:function(t){var i=t.red,e=this.core(t),n=i.sqrn(e,1);return i.sqrnmul(n,1,t)}},{key:"pm2",value:function(t){var i=t.red,e=this.core(t),n=i.sqrn(e,1),r=i.sqrnmul(n,1,t),u=i.sqrn(r,1);return i.sqrnmul(u,1,t)}},{key:"pp1d4",value:function(t){var i=t.red,e=this.core(t),n=i.sqrnmul(e,1,t);return i.sqrn(n,1)}}]),e}(),H=function(t){s(e,T);var i=o(e);function e(){return b(this,e),i.call(this,"p25519","7fffffff ffffffff ffffffff ffffffffffffffff ffffffff ffffffff ffffffed","2b832480 4fc1df0b 2b4d0099 3dfbd7a72f431806 ad2fe478 c4ee1b27 4a0ea0b0")}return q(e,[{key:"imulK",value:function(t){for(var i=0,e=0;e<t.length;e++){var n=19*t.words[e]+i;i=n>>>26,t.words[e]=67108863&n}return 0!==i&&(t._alloc(t.length+1),t.words[t.length++]=i),t}},{key:"core",value:function(t,i){var e=t.red,n=e.sqrnmul(i,2,i),r=e.sqrnmul(n,1,t),u=e.sqrnmul(r,5,r),s=e.sqrnmul(u,10,u),h=e.sqrnmul(s,20,s),o=e.sqrnmul(h,10,u),a=e.sqrnmul(o,50,o),l=e.sqrnmul(a,100,a);return e.sqrnmul(l,50,o)}},{key:"pm5d8",value:function(t){var i=t.red,e=i.sqrnmul(t,1,t),n=this.core(t,e),r=i.sqrn(n,1);return i.sqrnmul(r,1,t)}},{key:"pm2",value:function(t){var i=t.red,e=i.sqrnmul(t,1,t),n=this.core(t,e),r=i.sqrn(n,1),u=i.sqrnmul(r,1,t),s=i.sqrn(u,1);return i.sqrnmul(s,2,e)}},{key:"pp3d8",value:function(t){var i=t.red,e=i.sqrnmul(t,1,t),n=this.core(t,e),r=i.sqrnmul(n,1,t);return i.sqrn(r,1)}}]),e}(),K=function(t){s(e,j);var i=o(e);function e(){return b(this,e),i.call(this,"p448","ffffffff ffffffff ffffffff ffffffffffffffff ffffffff fffffffe ffffffffffffffff ffffffff ffffffff ffffffffffffffff ffffffff")}return q(e,[{key:"imulK",value:function(t){var i=this.one.inject(t);return t.iushln(224)._iadd(t,i)}},{key:"core",value:function(t,i){var e=t.red,n=e.sqrnmul(i,1,t),r=e.sqrnmul(n,3,n),u=e.sqrnmul(r,3,n),s=e.sqrnmul(u,2,i),h=e.sqrnmul(s,11,s),o=e.sqrnmul(h,22,h),a=e.sqrnmul(o,44,o),l=e.sqrnmul(a,88,a),f=e.sqrnmul(l,44,o);return e.sqrnmul(f,2,i)}},{key:"pm3d4",value:function(t){var i=t.red,e=i.sqrnmul(t,1,t),n=this.core(t,e),r=i.sqrnmul(n,1,t),u=i.sqrn(r,1);return i.sqrnmul(u,222,n)}},{key:"pm2",value:function(t){var i=t.red,e=this.pm3d4(t),n=i.sqrn(e,1);return i.sqrnmul(n,1,t)}},{key:"pp1d4",value:function(t){var i=t.red,e=i.sqrnmul(t,1,t),n=this.core(t,e),r=i.sqrnmul(n,2,e);return i.sqrn(r,222)}}]),e}(),Q=function(){function t(i){b(this,t);var e=null;"string"==typeof i&&(i=(e=L._prime(i)).p),V(L.isBN(i),"m","bignum"),tt(!i.red,"reduction"),W(i.sign()>0,"reduction"),this.m=i,this.prime=e,this.mb=null,this.sm1=null}return q(t,[{key:"_verify1",value:function(t){W(0===t.negative,"red"),Y(null!=t.red,"red")}},{key:"_verify2",value:function(t,i){W(0==(t.negative|i.negative),"red"),Y(null!=t.red&&t.red===i.red,"red")}},{key:"mont",get:function(){return!1}},{key:"precompute",value:function(){if(null===this.sm1&&5===this.m.andln(7))if(this.prime)this.sm1=this.prime.sm1.clone()._forceRed(this);else{var t=new L(2).toRed(this),i=this.m.subn(1).iushrn(2);this.sm1=this.pow(t,i)}return this}},{key:"convertTo",value:function(t){var i=t.mod(this.m);return i.red=this,i}},{key:"convertFrom",value:function(t){var i=t.clone();return i.red=null,i}},{key:"intTo",value:function(t){return t}},{key:"intFrom",value:function(t){return t}},{key:"imod",value:function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.imod(this.m)._forceRed(this)}},{key:"iadd",value:function(t,i){return this._verify2(t,i),t._iadd(t,i),t.ucmp(this.m)>=0&&t._isub(t,this.m),t}},{key:"add",value:function(t,i){return t.length<i.length?this.iadd(i.clone(),t):this.iadd(t.clone(),i)}},{key:"iaddn",value:function(t,i){return this._verify1(t),i<0?this.isubn(t,-i):(1===this.m.length&&(i%=this.m.words[0]),t._iaddn(i),t.ucmp(this.m)>=0&&t._isub(t,this.m),t)}},{key:"addn",value:function(t,i){return this.iaddn(t.clone(),i)}},{key:"isub",value:function(t,i){this._verify2(t,i);var e=t.ucmp(i);return 0===e?(t.words[0]=0,t.length=1,t):(e<0?(t._isub(i,t),t._isub(this.m,t)):t._isub(t,i),t)}},{key:"sub",value:function(t,i){return this.isub(t.clone(),i)}},{key:"isubn",value:function(t,i){return this._verify1(t),i<0?this.iaddn(t,-i):(1===this.m.length&&(i%=this.m.words[0]),1===t.length&&t.words[0]<i?(t.words[0]=i-t.words[0],t._isub(this.m,t)):t._isubn(i),t)}},{key:"subn",value:function(t,i){return this.isubn(t.clone(),i)}},{key:"imul",value:function(t,i){return this._verify2(t,i),this.imod(t.imul(i))}},{key:"mul",value:function(t,i){return this._verify2(t,i),this.imod(t.mul(i))}},{key:"imuln",value:function(t,i){if(this._verify1(t),t.isZero())return t;if(0===i)return t.words[0]=0,t.length=1,t;var e=i<0;if(e&&(i=-i),1===this.m.length&&(i%=this.m.words[0]),t.imuln(i),i<=16)for(;t.ucmp(this.m)>=0;)t._isub(t,this.m);else this.imod(t);return e&&this.ineg(t),t}},{key:"muln",value:function(t,i){return this.imuln(t.clone(),i)}},{key:"idiv",value:function(t,i){return this.div(t,i)._move(t)}},{key:"div",value:function(t,i){return this.mul(t,this.invert(i))}},{key:"idivn",value:function(t,i){return this.divn(t,i)._move(t)}},{key:"divn",value:function(t,i){return this.div(t,this.convertTo(new L(i)))}},{key:"ipow",value:function(t,i){return this.pow(t,i)._move(t)}},{key:"pow",value:function(t,i){return this._verify1(t),i.isNeg()&&(t=this.invert(t)),1===i.length?this.pown(t,i.words[0]):x&&!this.prime?this.powInt(t,i):this.powNum(t,i)}},{key:"powNum",value:function(t,i){var e=new L(1).toRed(this),n=new Array(A),r=this.sqr(t);n[0]=t;for(var u=1;u<A;u++)n[u]=this.mul(n[u-1],r);for(var s=i.bitLength(),h=e;s>=O;){var o=O,a=i.bits(s-o,o);if(a<A)h=this.sqr(h),s-=1;else{for(;0==(1&a);)o-=1,a>>=1;h===e?h=n[a>>1].clone():(h=this.sqrn(h,o),h=this.mul(h,n[a>>1])),s-=o}}if(s>0)for(var l=i.bits(0,s);s--;)h=this.sqr(h),l>>s&1&&(h=this.mul(h,t));return h}},{key:"powInt",value:function(t,i){null===this.mb&&(this.mb=this.m.toBigInt());var e=ft(this.intFrom(t.toBigInt()),i,this.mb),n=this.intTo(e);return L.fromBigInt(n)._forceRed(this)}},{key:"sqrn",value:function(t,i){for(;i--;)t=this.sqr(t);return t}},{key:"sqrnmul",value:function(t,i,e){return this.mul(this.sqrn(t,i),e)}},{key:"ipown",value:function(t,i){return this.pown(t,i)._move(t)}},{key:"pown",value:function(t,i){if(this._verify1(t),i<0&&(t=this.invert(t),i=-i),0===i)return new L(1).toRed(this);if(1===i)return t.clone();for(var e=t,n=ht(i)-2;n>=0;n--)e=this.sqr(e),i>>n&1&&(e=this.mul(e,t));return e}},{key:"isqr",value:function(t){return this.imul(t,t)}},{key:"sqr",value:function(t){return this.mul(t,t)}},{key:"isqrt",value:function(t){return this.sqrt(t)._move(t)}},{key:"sqrt",value:function(t){return this._verify1(t),this.prime?this.prime.sqrt(t):3===this.m.andln(3)?this.sqrt3mod4(t):5===this.m.andln(7)?null!=this.sm1?this.sqrt5mod8sm1(t):this.sqrt5mod8(t):this.sqrt0(t)}},{key:"sqrt3mod4",value:function(t){var i=this.m.addn(1).iushrn(2),e=this.pow(t,i);if(!this.sqr(e).eq(t))throw new et(e);return e}},{key:"sqrt5mod8",value:function(t){var i=new L(1).toRed(this),e=this.m.ushrn(3),n=this.add(t,t),r=this.pow(n,e),u=this.mul(n,this.sqr(r)),s=this.mul(this.mul(r,t),this.isub(u,i));if(!this.sqr(s).eq(t))throw new et(s);return s}},{key:"sqrt5mod8sm1",value:function(t){var i=this.m.addn(3).iushrn(3),e=this.pow(t,i);if(this.sqr(e).eq(t))return e;var n=this.mul(e,this.sm1);if(this.sqr(n).eq(t))return n;throw new et(e)}},{key:"sqrt0",value:function(t){if(0===this.m.cmpn(1)||!this.m.isOdd())throw new Error("Invalid prime.");switch(this.jacobi(t)){case-1:throw new et(t);case 0:return t.clone()}for(var i=new L(1).toRed(this),e=this.m.subn(1),n=e._makeOdd(),r=new L(2).toRed(this);-1!==this.jacobi(r);)this.iadd(r,i);for(var u=this.pow(r,e),s=this.pow(t,e),h=this.pow(t,e.iaddn(1).iushrn(1)),o=n;;){for(var a=s,l=0;!a.eq(i)&&l<o;)a=this.sqr(a),l+=1;if(0===l)break;$(l<o),a=this.sqrn(u,o-l-1),u=this.sqr(a),h=this.mul(h,a),s=this.mul(s,u),o=l}return h}},{key:"idivsqrt",value:function(t,i){return this.divsqrt(t,i)._move(t)}},{key:"divsqrt",value:function(t,i){if(this._verify2(t,i),t.isZero()&&i.isZero())throw new et(i);if(this.prime)return this.prime.divsqrt(t,i);if(3===this.m.andln(3))return this.divsqrt3mod4(t,i);if(null!=this.sm1&&5===this.m.andln(7))return this.divsqrt5mod8(t,i);if(i.isZero())throw new et(i);return this.sqrt(this.div(t,i))}},{key:"divsqrt3mod4",value:function(t,i){var e=this.m.subn(3).iushrn(2),n=this.sqr(t),r=this.mul(n,t),u=this.mul(r,n),s=this.mul(this.sqr(i),i),h=this.pow(this.mul(u,s),e),o=this.mul(this.mul(r,i),h);if(this.mul(i,this.sqr(o)).eq(t))return o;throw new et(o)}},{key:"divsqrt5mod8",value:function(t,i){var e=this.m.subn(5).iushrn(3),n=this.mul(this.sqr(i),i),r=this.mul(this.sqr(n),i),u=this.pow(this.mul(t,r),e),s=this.mul(this.mul(t,n),u),h=this.mul(i,this.sqr(s));if(h.eq(t))return s;var o=this.ineg(h);if(o.eq(t))return this.mul(s,this.sm1);if(o.eq(this.mul(t,this.sm1)))throw new et(this.mul(s,this.sm1));throw new et(s)}},{key:"isSquare",value:function(t){return this.m.isOdd()?this.jacobi(t)>=0:this.kronecker(t)>=0}},{key:"ishl",value:function(t,i){return this._verify1(t),this.imod(t.iushl(i))}},{key:"shl",value:function(t,i){return this.ishl(t.clone(),i)}},{key:"ishln",value:function(t,i){if(this._verify1(t),t.iushln(i),i<=4)for(;t.ucmp(this.m)>=0;)t._isub(t,this.m);else this.imod(t);return t}},{key:"shln",value:function(t,i){return this.ishln(t.clone(),i)}},{key:"ineg",value:function(t){return this._verify1(t),t.isZero()||t._isub(this.m,t),t}},{key:"neg",value:function(t){return this.ineg(t.clone())}},{key:"eq",value:function(t,i){return this._verify2(t,i),0===t.ucmp(i)}},{key:"eqn",value:function(t,i){if(this._verify1(t),1===this.m.length)return(i%=this.m.words[0])<0&&(i+=this.m.words[0]),0===t.ucmpn(i);if(i<0){this.m._isubn(-i);var e=t.ucmp(this.m);return this.m._iaddn(-i),0===e}return 0===t.ucmpn(i)}},{key:"isHigh",value:function(t){return!this.isLow(t)}},{key:"isLow",value:function(t){return this._verify1(t),t.ucmp(this.m.ushrn(1))<=0}},{key:"isOdd",value:function(t){return this._verify1(t),t.isOdd()}},{key:"isEven",value:function(t){return this._verify1(t),t.isEven()}},{key:"legendre",value:function(t){if(this._verify1(t),this.m.isEven())throw new Error("legendre: `num` must be odd.");var i=this.m.subn(1).iushrn(1),e=this.pow(t,i);if(e.isZero())return 0;var n=new L(1).toRed(this);if(e.eq(n))return 1;if(e.eq(this.ineg(n)))return-1;throw new Error("Invalid prime.")}},{key:"jacobi",value:function(t){return this._verify1(t),t.jacobi(this.m)}},{key:"kronecker",value:function(t){return this._verify1(t),t.kronecker(this.m)}},{key:"iinvert",value:function(t){return this.invert(t)._move(t)}},{key:"invert",value:function(t){return this._verify1(t),t.invert(this.m)._forceRed(this)}},{key:"ifermat",value:function(t){return this.fermat(t)._move(t)}},{key:"fermat",value:function(t){if(this._verify1(t),t.isZero()||0===this.m.cmpn(1))throw new RangeError("Not invertible.");return this.prime?this.prime.fermat(t):this.pow(t,this.m.subn(2))}},{key:"invertAll",value:function(t){V(Array.isArray(t),"elems","array");var i,e=d(t);try{for(e.s();!(i=e.n()).done;){var n=i.value;V(L.isBN(n),"elem","bignum"),this._verify1(n)}}catch(a){e.e(a)}finally{e.f()}if(0===this.m.cmpn(1)||this.m.isEven())throw new RangeError("Not invertible.");var r=t.length,u=new Array(r);if(0===r)return u;for(var s=new L(1).toRed(this),h=0;h<r;h++)t[h].isZero()?u[h]=t[h].clone():(u[h]=s,s=this.mul(s,t[h]));s=this.invert(s);for(var o=r-1;o>=0;o--)t[o].isZero()||(u[o]=this.mul(s,u[o]),s=this.mul(s,t[o]));return u}},{key:N,value:function(){return this.prime?"<Red: ".concat(this.prime.name,">"):"<Red: ".concat(this.m.toString(10),">")}}]),t}(),J=function(t){s(e,Q);var i=o(e);function e(t){var n;return b(this,e),(n=i.call(this,t)).prime=null,n.n=n.m.bitLength(),n.n%26!=0&&(n.n+=26-n.n%26),n.k=2*n.n,n.w=n.k/26,n.b=L.shift(1,n.k).div(n.m),n}return q(e,[{key:"convertTo",value:function(t){return t.length>this.w?r(m(e.prototype),"convertTo",this).call(this,t):this.imod(t.clone())}},{key:"_shift",value:function(t){for(var i=0,e=this.w;e<t.length;)t.words[i++]=t.words[e++];0===i&&(t.words[i++]=0),t.length=i}},{key:"imod",value:function(t){var i=t.negative;$(t.length<=this.w),t.negative=0;var e=t.mul(this.b);return this._shift(e),t._isub(t,e.mul(this.m)),t.ucmp(this.m)>=0&&t._isub(t,this.m),i&&!t.isZero()&&t._isub(this.m,t),t.red=this,t}}]),e}(),G=function(t){s(e,Q);var i=o(e);function e(t){var n;return b(this,e),(n=i.call(this,t)).prime=null,n.n=26*n.m.length,n.r=L.shift(1,n.n),n.r2=L.shift(1,2*n.n).imod(n.m),n.ri=n.r.invert(n.m),n.mi=n.r.mul(n.ri).isubn(1).div(n.m),n.rib=null,n}return q(e,[{key:"mont",get:function(){return!0}},{key:"convertTo",value:function(t){return t.isNeg()||t.ucmp(this.m)>=0?this.imod(t.ushln(this.n)):this.mul(t,this.r2)}},{key:"convertFrom",value:function(t){var i=this.mul(t,new L(1));return i.red=null,i}},{key:"intTo",value:function(t){return(t<<BigInt(this.n))%this.mb}},{key:"intFrom",value:function(t){return null===this.rib&&(this.rib=this.ri.toBigInt()),t*this.rib%this.mb}},{key:"iaddn",value:function(t,i){return this.iadd(t,this.convertTo(new L(i)))}},{key:"isubn",value:function(t,i){return this.isub(t,this.convertTo(new L(i)))}},{key:"imul",value:function(t,i){return this.mul(t,i)._move(t)}},{key:"mul",value:function(t,i){if(t.isZero()||i.isZero())return new L(0)._forceRed(this);var e=t.mul(i),n=e.umaskn(this.n).mul(this.mi).iumaskn(this.n),r=e.iadd(n.mul(this.m)).iushrn(this.n);return r.ucmp(this.m)>=0&&r._isub(r,this.m),r._forceRed(this)}},{key:"imuln",value:function(t,i){if(this._verify1(t),t.isZero())return t;if(0===i)return t.words[0]=0,t.length=1,t;var e=i<0;e&&(i=-i),1===this.m.length&&(i%=this.m.words[0]);var n=ht(i);if(n>5)this.imul(t,this.convertTo(new L(i)));else if(0==(i&i-1))for(var r=0;r<n-1;r++)this.iadd(t,t);else for(var u=t.clone(),s=n-2;s>=0;s--)this.iadd(t,t),i>>s&1&&this.iadd(t,u);return e&&this.ineg(t),t}},{key:"eqn",value:function(t,i){return this._verify1(t),0===i?t.isZero():0===t.ucmp(this.convertTo(new L(i)))}},{key:"isLow",value:function(t){return this._verify1(t),this.convertFrom(t).ucmp(this.m.ushrn(1))<=0}},{key:"isOdd",value:function(t){return this._verify1(t),this.convertFrom(t).isOdd()}},{key:"isEven",value:function(t){return this._verify1(t),this.convertFrom(t).isEven()}},{key:"invert",value:function(t){return this._verify1(t),this.imod(t.invert(this.m).mul(this.r2))}}]),e}();function X(t,i,e){var n=new t(i);return t.captureStackTrace&&t.captureStackTrace(n,e),n}function $(t,i){if(!t)throw X(Error,i||"Assertion failed.",$)}function V(t,i,e){if(!t){var n='"'.concat(i,'" must be a(n) ').concat(e,".");throw X(TypeError,n,V)}}function W(t,i){if(!t){var e='"'.concat(i,'" only works with positive numbers.');throw X(RangeError,e,W)}}function Y(t,i){if(!t){var e='"'.concat(i,'" only works with red numbers.');throw X(TypeError,e,Y)}}function tt(t,i){if(!t){var e='"'.concat(i,'" only works with normal numbers.');throw X(TypeError,e,tt)}}function it(t){if(!t){throw X(RangeError,"Cannot divide by zero.",it)}}var et=function(t){s(n,i(Error));var e=o(n);function n(t){var i;return b(this,n),(i=e.call(this)).name="SquareRootError",i.message="X is not a square mod P.",i.result=t.fromRed(),Error.captureStackTrace&&Error.captureStackTrace(l(i),n),i}return n}();function nt(t){return Number.isSafeInteger(t)}function rt(t){return nt(t)&&t>=-67108863&&t<=67108863}function ut(t,i){return t.allocUnsafeSlow?t.allocUnsafeSlow(i):new t(i)}function st(t){if(null==t)return 10;if("number"==typeof t)return t;switch(t){case"bin":return 2;case"oct":return 8;case"dec":return 10;case"hex":return 16}return 0}function ht(t){if(Math.clz32)return 32-Math.clz32(t);var i=t,e=0;return i>=4096&&(e+=13,i>>>=13),i>=64&&(e+=7,i>>>=7),i>=8&&(e+=4,i>>>=4),i>=2&&(e+=2,i>>>=2),e+i}function ot(t){if(0===t)return 26;var i=t,e=0;return 0==(8191&i)&&(e+=13,i>>>=13),0==(127&i)&&(e+=7,i>>>=7),0==(15&i)&&(e+=4,i>>>=4),0==(3&i)&&(e+=2,i>>>=2),0==(1&i)&&(e+=1),e}function at(t,i,e){for(var n=Math.min(t.length,e),r=0,u=0,s=i;s<n;s++){var h=t.charCodeAt(s)-48;r<<=4;var o=void 0;r|=o=h>=49&&h<=54?h-49+10:h>=17&&h<=22?h-17+10:h,u|=o}if(-16&u)throw new Error("Invalid string.");return r}function lt(t,i,e,n){for(var r=Math.min(t.length,e),u=0,s=i;s<r;s++){var h=t.charCodeAt(s)-48;u*=n;var o=void 0;if(o=h>=49?h-49+10:h>=17?h-17+10:h,h<0||h>207||o>=n)throw new Error("Invalid string.");u+=o}return u}function ft(t,i,e){var n=BigInt(1),r=new Array(A),u=t*t%e;r[0]=t;for(var s=1;s<A;s++)r[s]=r[s-1]*u%e;for(var h=i.bitLength(),o=n;h>=O;){var a=O,l=i.bits(h-a,a);if(l<A)o=o*o%e,h-=1;else{for(;0==(1&l);)a-=1,l>>=1;o=o===n?r[l>>1]:(o=mt(o,a,e))*r[l>>1]%e,h-=a}}if(h>0)for(var f=i.bits(0,h);h--;)o=o*o%e,f>>h&1&&(o=o*t%e);return o}function mt(t,i,e){for(var n=0;n<i;n++)t=t*t%e;return t}function vt(t,i,e){var n=t.length+i.length;e.negative=t.negative^i.negative,e._alloc(n),e.length=n;var r=t.words[0]*i.words[0],u=67108863&r,s=r/67108864|0,h=1;for(e.words[0]=u;h<e.length-1;h++){for(var o=s>>>26,a=67108863&s,l=Math.max(0,h-t.length+1),f=Math.min(h,i.length-1),m=l;m<=f;m++){var v=h-m,d=t.words[v]*i.words[m]+a;o+=d/67108864|0,a=67108863&d}e.words[h]=0|a,s=0|o}return 0!==s?e.words[h]=0|s:e.length-=1,e._strip()}function dt(t,i,e){var n=t.length+i.length;e.negative=t.negative^i.negative,e._alloc(n),e.length=n;for(var r=0,u=0,s=0;s<e.length-1;s++){var h=u;u=0;for(var o=67108863&r,a=Math.max(0,s-t.length+1),l=Math.min(s,i.length-1),f=a;f<=l;f++){var m=s-f,v=t.words[m]*i.words[f],d=67108863&v;o=67108863&(d=d+o|0),u+=(h=(h=h+(v/67108864|0)|0)+(d>>>26)|0)>>>26,h&=67108863}e.words[s]=o,r=h,h=u}return 0!==r?e.words[s]=r:e.length-=1,e._strip()}function ct(t,i,e){if(!x||t.length+i.length>82595519)return dt(t,i,e);var n=BigInt(0),r=BigInt(67108863),u=BigInt(26),s=t.toBigInt()*i.toBigInt(),h=s<n|0;h&&(s=-s);for(var o=0;s>n;)e.words[o++]=Number(s&r),s>>=u;return 0===o&&(e.words[o++]=0),e.length=o,e.negative=h,e}function gt(t,i,e){var n,r,u,s=t.words,h=i.words,o=e.words,a=0|s[0],l=8191&a,f=a>>>13,m=0|s[1],v=8191&m,d=m>>>13,c=0|s[2],g=8191&c,y=c>>>13,w=0|s[3],k=8191&w,M=w>>>13,b=0|s[4],p=8191&b,q=b>>>13,_=0|s[5],N=8191&_,B=_>>>13,I=0|s[6],E=8191&I,S=I>>>13,R=0|s[7],O=8191&R,A=R>>>13,x=0|s[8],L=8191&x,Z=x>>>13,j=0|s[9],T=8191&j,P=j>>>13,D=0|h[0],z=8191&D,F=D>>>13,U=0|h[1],C=8191&U,H=U>>>13,K=0|h[2],Q=8191&K,J=K>>>13,G=0|h[3],X=8191&G,$=G>>>13,V=0|h[4],W=8191&V,Y=V>>>13,tt=0|h[5],it=8191&tt,et=tt>>>13,nt=0|h[6],rt=8191&nt,ut=nt>>>13,st=0|h[7],ht=8191&st,ot=st>>>13,at=0|h[8],lt=8191&at,ft=at>>>13,mt=0|h[9],vt=8191&mt,dt=mt>>>13,ct=0;e.negative=t.negative^i.negative,e._alloc(20),e.length=19;var gt=(ct+(n=Math.imul(l,z))|0)+((8191&(r=(r=Math.imul(l,F))+Math.imul(f,z)|0))<<13)|0;ct=((u=Math.imul(f,F))+(r>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(v,z),r=(r=Math.imul(v,F))+Math.imul(d,z)|0,u=Math.imul(d,F);var yt=(ct+(n=n+Math.imul(l,C)|0)|0)+((8191&(r=(r=r+Math.imul(l,H)|0)+Math.imul(f,C)|0))<<13)|0;ct=((u=u+Math.imul(f,H)|0)+(r>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(g,z),r=(r=Math.imul(g,F))+Math.imul(y,z)|0,u=Math.imul(y,F),n=n+Math.imul(v,C)|0,r=(r=r+Math.imul(v,H)|0)+Math.imul(d,C)|0,u=u+Math.imul(d,H)|0;var wt=(ct+(n=n+Math.imul(l,Q)|0)|0)+((8191&(r=(r=r+Math.imul(l,J)|0)+Math.imul(f,Q)|0))<<13)|0;ct=((u=u+Math.imul(f,J)|0)+(r>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(k,z),r=(r=Math.imul(k,F))+Math.imul(M,z)|0,u=Math.imul(M,F),n=n+Math.imul(g,C)|0,r=(r=r+Math.imul(g,H)|0)+Math.imul(y,C)|0,u=u+Math.imul(y,H)|0,n=n+Math.imul(v,Q)|0,r=(r=r+Math.imul(v,J)|0)+Math.imul(d,Q)|0,u=u+Math.imul(d,J)|0;var kt=(ct+(n=n+Math.imul(l,X)|0)|0)+((8191&(r=(r=r+Math.imul(l,$)|0)+Math.imul(f,X)|0))<<13)|0;ct=((u=u+Math.imul(f,$)|0)+(r>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(p,z),r=(r=Math.imul(p,F))+Math.imul(q,z)|0,u=Math.imul(q,F),n=n+Math.imul(k,C)|0,r=(r=r+Math.imul(k,H)|0)+Math.imul(M,C)|0,u=u+Math.imul(M,H)|0,n=n+Math.imul(g,Q)|0,r=(r=r+Math.imul(g,J)|0)+Math.imul(y,Q)|0,u=u+Math.imul(y,J)|0,n=n+Math.imul(v,X)|0,r=(r=r+Math.imul(v,$)|0)+Math.imul(d,X)|0,u=u+Math.imul(d,$)|0;var Mt=(ct+(n=n+Math.imul(l,W)|0)|0)+((8191&(r=(r=r+Math.imul(l,Y)|0)+Math.imul(f,W)|0))<<13)|0;ct=((u=u+Math.imul(f,Y)|0)+(r>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(N,z),r=(r=Math.imul(N,F))+Math.imul(B,z)|0,u=Math.imul(B,F),n=n+Math.imul(p,C)|0,r=(r=r+Math.imul(p,H)|0)+Math.imul(q,C)|0,u=u+Math.imul(q,H)|0,n=n+Math.imul(k,Q)|0,r=(r=r+Math.imul(k,J)|0)+Math.imul(M,Q)|0,u=u+Math.imul(M,J)|0,n=n+Math.imul(g,X)|0,r=(r=r+Math.imul(g,$)|0)+Math.imul(y,X)|0,u=u+Math.imul(y,$)|0,n=n+Math.imul(v,W)|0,r=(r=r+Math.imul(v,Y)|0)+Math.imul(d,W)|0,u=u+Math.imul(d,Y)|0;var bt=(ct+(n=n+Math.imul(l,it)|0)|0)+((8191&(r=(r=r+Math.imul(l,et)|0)+Math.imul(f,it)|0))<<13)|0;ct=((u=u+Math.imul(f,et)|0)+(r>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(E,z),r=(r=Math.imul(E,F))+Math.imul(S,z)|0,u=Math.imul(S,F),n=n+Math.imul(N,C)|0,r=(r=r+Math.imul(N,H)|0)+Math.imul(B,C)|0,u=u+Math.imul(B,H)|0,n=n+Math.imul(p,Q)|0,r=(r=r+Math.imul(p,J)|0)+Math.imul(q,Q)|0,u=u+Math.imul(q,J)|0,n=n+Math.imul(k,X)|0,r=(r=r+Math.imul(k,$)|0)+Math.imul(M,X)|0,u=u+Math.imul(M,$)|0,n=n+Math.imul(g,W)|0,r=(r=r+Math.imul(g,Y)|0)+Math.imul(y,W)|0,u=u+Math.imul(y,Y)|0,n=n+Math.imul(v,it)|0,r=(r=r+Math.imul(v,et)|0)+Math.imul(d,it)|0,u=u+Math.imul(d,et)|0;var pt=(ct+(n=n+Math.imul(l,rt)|0)|0)+((8191&(r=(r=r+Math.imul(l,ut)|0)+Math.imul(f,rt)|0))<<13)|0;ct=((u=u+Math.imul(f,ut)|0)+(r>>>13)|0)+(pt>>>26)|0,pt&=67108863,n=Math.imul(O,z),r=(r=Math.imul(O,F))+Math.imul(A,z)|0,u=Math.imul(A,F),n=n+Math.imul(E,C)|0,r=(r=r+Math.imul(E,H)|0)+Math.imul(S,C)|0,u=u+Math.imul(S,H)|0,n=n+Math.imul(N,Q)|0,r=(r=r+Math.imul(N,J)|0)+Math.imul(B,Q)|0,u=u+Math.imul(B,J)|0,n=n+Math.imul(p,X)|0,r=(r=r+Math.imul(p,$)|0)+Math.imul(q,X)|0,u=u+Math.imul(q,$)|0,n=n+Math.imul(k,W)|0,r=(r=r+Math.imul(k,Y)|0)+Math.imul(M,W)|0,u=u+Math.imul(M,Y)|0,n=n+Math.imul(g,it)|0,r=(r=r+Math.imul(g,et)|0)+Math.imul(y,it)|0,u=u+Math.imul(y,et)|0,n=n+Math.imul(v,rt)|0,r=(r=r+Math.imul(v,ut)|0)+Math.imul(d,rt)|0,u=u+Math.imul(d,ut)|0;var qt=(ct+(n=n+Math.imul(l,ht)|0)|0)+((8191&(r=(r=r+Math.imul(l,ot)|0)+Math.imul(f,ht)|0))<<13)|0;ct=((u=u+Math.imul(f,ot)|0)+(r>>>13)|0)+(qt>>>26)|0,qt&=67108863,n=Math.imul(L,z),r=(r=Math.imul(L,F))+Math.imul(Z,z)|0,u=Math.imul(Z,F),n=n+Math.imul(O,C)|0,r=(r=r+Math.imul(O,H)|0)+Math.imul(A,C)|0,u=u+Math.imul(A,H)|0,n=n+Math.imul(E,Q)|0,r=(r=r+Math.imul(E,J)|0)+Math.imul(S,Q)|0,u=u+Math.imul(S,J)|0,n=n+Math.imul(N,X)|0,r=(r=r+Math.imul(N,$)|0)+Math.imul(B,X)|0,u=u+Math.imul(B,$)|0,n=n+Math.imul(p,W)|0,r=(r=r+Math.imul(p,Y)|0)+Math.imul(q,W)|0,u=u+Math.imul(q,Y)|0,n=n+Math.imul(k,it)|0,r=(r=r+Math.imul(k,et)|0)+Math.imul(M,it)|0,u=u+Math.imul(M,et)|0,n=n+Math.imul(g,rt)|0,r=(r=r+Math.imul(g,ut)|0)+Math.imul(y,rt)|0,u=u+Math.imul(y,ut)|0,n=n+Math.imul(v,ht)|0,r=(r=r+Math.imul(v,ot)|0)+Math.imul(d,ht)|0,u=u+Math.imul(d,ot)|0;var _t=(ct+(n=n+Math.imul(l,lt)|0)|0)+((8191&(r=(r=r+Math.imul(l,ft)|0)+Math.imul(f,lt)|0))<<13)|0;ct=((u=u+Math.imul(f,ft)|0)+(r>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(T,z),r=(r=Math.imul(T,F))+Math.imul(P,z)|0,u=Math.imul(P,F),n=n+Math.imul(L,C)|0,r=(r=r+Math.imul(L,H)|0)+Math.imul(Z,C)|0,u=u+Math.imul(Z,H)|0,n=n+Math.imul(O,Q)|0,r=(r=r+Math.imul(O,J)|0)+Math.imul(A,Q)|0,u=u+Math.imul(A,J)|0,n=n+Math.imul(E,X)|0,r=(r=r+Math.imul(E,$)|0)+Math.imul(S,X)|0,u=u+Math.imul(S,$)|0,n=n+Math.imul(N,W)|0,r=(r=r+Math.imul(N,Y)|0)+Math.imul(B,W)|0,u=u+Math.imul(B,Y)|0,n=n+Math.imul(p,it)|0,r=(r=r+Math.imul(p,et)|0)+Math.imul(q,it)|0,u=u+Math.imul(q,et)|0,n=n+Math.imul(k,rt)|0,r=(r=r+Math.imul(k,ut)|0)+Math.imul(M,rt)|0,u=u+Math.imul(M,ut)|0,n=n+Math.imul(g,ht)|0,r=(r=r+Math.imul(g,ot)|0)+Math.imul(y,ht)|0,u=u+Math.imul(y,ot)|0,n=n+Math.imul(v,lt)|0,r=(r=r+Math.imul(v,ft)|0)+Math.imul(d,lt)|0,u=u+Math.imul(d,ft)|0;var Nt=(ct+(n=n+Math.imul(l,vt)|0)|0)+((8191&(r=(r=r+Math.imul(l,dt)|0)+Math.imul(f,vt)|0))<<13)|0;ct=((u=u+Math.imul(f,dt)|0)+(r>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,n=Math.imul(T,C),r=(r=Math.imul(T,H))+Math.imul(P,C)|0,u=Math.imul(P,H),n=n+Math.imul(L,Q)|0,r=(r=r+Math.imul(L,J)|0)+Math.imul(Z,Q)|0,u=u+Math.imul(Z,J)|0,n=n+Math.imul(O,X)|0,r=(r=r+Math.imul(O,$)|0)+Math.imul(A,X)|0,u=u+Math.imul(A,$)|0,n=n+Math.imul(E,W)|0,r=(r=r+Math.imul(E,Y)|0)+Math.imul(S,W)|0,u=u+Math.imul(S,Y)|0,n=n+Math.imul(N,it)|0,r=(r=r+Math.imul(N,et)|0)+Math.imul(B,it)|0,u=u+Math.imul(B,et)|0,n=n+Math.imul(p,rt)|0,r=(r=r+Math.imul(p,ut)|0)+Math.imul(q,rt)|0,u=u+Math.imul(q,ut)|0,n=n+Math.imul(k,ht)|0,r=(r=r+Math.imul(k,ot)|0)+Math.imul(M,ht)|0,u=u+Math.imul(M,ot)|0,n=n+Math.imul(g,lt)|0,r=(r=r+Math.imul(g,ft)|0)+Math.imul(y,lt)|0,u=u+Math.imul(y,ft)|0;var Bt=(ct+(n=n+Math.imul(v,vt)|0)|0)+((8191&(r=(r=r+Math.imul(v,dt)|0)+Math.imul(d,vt)|0))<<13)|0;ct=((u=u+Math.imul(d,dt)|0)+(r>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,n=Math.imul(T,Q),r=(r=Math.imul(T,J))+Math.imul(P,Q)|0,u=Math.imul(P,J),n=n+Math.imul(L,X)|0,r=(r=r+Math.imul(L,$)|0)+Math.imul(Z,X)|0,u=u+Math.imul(Z,$)|0,n=n+Math.imul(O,W)|0,r=(r=r+Math.imul(O,Y)|0)+Math.imul(A,W)|0,u=u+Math.imul(A,Y)|0,n=n+Math.imul(E,it)|0,r=(r=r+Math.imul(E,et)|0)+Math.imul(S,it)|0,u=u+Math.imul(S,et)|0,n=n+Math.imul(N,rt)|0,r=(r=r+Math.imul(N,ut)|0)+Math.imul(B,rt)|0,u=u+Math.imul(B,ut)|0,n=n+Math.imul(p,ht)|0,r=(r=r+Math.imul(p,ot)|0)+Math.imul(q,ht)|0,u=u+Math.imul(q,ot)|0,n=n+Math.imul(k,lt)|0,r=(r=r+Math.imul(k,ft)|0)+Math.imul(M,lt)|0,u=u+Math.imul(M,ft)|0;var It=(ct+(n=n+Math.imul(g,vt)|0)|0)+((8191&(r=(r=r+Math.imul(g,dt)|0)+Math.imul(y,vt)|0))<<13)|0;ct=((u=u+Math.imul(y,dt)|0)+(r>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(T,X),r=(r=Math.imul(T,$))+Math.imul(P,X)|0,u=Math.imul(P,$),n=n+Math.imul(L,W)|0,r=(r=r+Math.imul(L,Y)|0)+Math.imul(Z,W)|0,u=u+Math.imul(Z,Y)|0,n=n+Math.imul(O,it)|0,r=(r=r+Math.imul(O,et)|0)+Math.imul(A,it)|0,u=u+Math.imul(A,et)|0,n=n+Math.imul(E,rt)|0,r=(r=r+Math.imul(E,ut)|0)+Math.imul(S,rt)|0,u=u+Math.imul(S,ut)|0,n=n+Math.imul(N,ht)|0,r=(r=r+Math.imul(N,ot)|0)+Math.imul(B,ht)|0,u=u+Math.imul(B,ot)|0,n=n+Math.imul(p,lt)|0,r=(r=r+Math.imul(p,ft)|0)+Math.imul(q,lt)|0,u=u+Math.imul(q,ft)|0;var Et=(ct+(n=n+Math.imul(k,vt)|0)|0)+((8191&(r=(r=r+Math.imul(k,dt)|0)+Math.imul(M,vt)|0))<<13)|0;ct=((u=u+Math.imul(M,dt)|0)+(r>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(T,W),r=(r=Math.imul(T,Y))+Math.imul(P,W)|0,u=Math.imul(P,Y),n=n+Math.imul(L,it)|0,r=(r=r+Math.imul(L,et)|0)+Math.imul(Z,it)|0,u=u+Math.imul(Z,et)|0,n=n+Math.imul(O,rt)|0,r=(r=r+Math.imul(O,ut)|0)+Math.imul(A,rt)|0,u=u+Math.imul(A,ut)|0,n=n+Math.imul(E,ht)|0,r=(r=r+Math.imul(E,ot)|0)+Math.imul(S,ht)|0,u=u+Math.imul(S,ot)|0,n=n+Math.imul(N,lt)|0,r=(r=r+Math.imul(N,ft)|0)+Math.imul(B,lt)|0,u=u+Math.imul(B,ft)|0;var St=(ct+(n=n+Math.imul(p,vt)|0)|0)+((8191&(r=(r=r+Math.imul(p,dt)|0)+Math.imul(q,vt)|0))<<13)|0;ct=((u=u+Math.imul(q,dt)|0)+(r>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(T,it),r=(r=Math.imul(T,et))+Math.imul(P,it)|0,u=Math.imul(P,et),n=n+Math.imul(L,rt)|0,r=(r=r+Math.imul(L,ut)|0)+Math.imul(Z,rt)|0,u=u+Math.imul(Z,ut)|0,n=n+Math.imul(O,ht)|0,r=(r=r+Math.imul(O,ot)|0)+Math.imul(A,ht)|0,u=u+Math.imul(A,ot)|0,n=n+Math.imul(E,lt)|0,r=(r=r+Math.imul(E,ft)|0)+Math.imul(S,lt)|0,u=u+Math.imul(S,ft)|0;var Rt=(ct+(n=n+Math.imul(N,vt)|0)|0)+((8191&(r=(r=r+Math.imul(N,dt)|0)+Math.imul(B,vt)|0))<<13)|0;ct=((u=u+Math.imul(B,dt)|0)+(r>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(T,rt),r=(r=Math.imul(T,ut))+Math.imul(P,rt)|0,u=Math.imul(P,ut),n=n+Math.imul(L,ht)|0,r=(r=r+Math.imul(L,ot)|0)+Math.imul(Z,ht)|0,u=u+Math.imul(Z,ot)|0,n=n+Math.imul(O,lt)|0,r=(r=r+Math.imul(O,ft)|0)+Math.imul(A,lt)|0,u=u+Math.imul(A,ft)|0;var Ot=(ct+(n=n+Math.imul(E,vt)|0)|0)+((8191&(r=(r=r+Math.imul(E,dt)|0)+Math.imul(S,vt)|0))<<13)|0;ct=((u=u+Math.imul(S,dt)|0)+(r>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,n=Math.imul(T,ht),r=(r=Math.imul(T,ot))+Math.imul(P,ht)|0,u=Math.imul(P,ot),n=n+Math.imul(L,lt)|0,r=(r=r+Math.imul(L,ft)|0)+Math.imul(Z,lt)|0,u=u+Math.imul(Z,ft)|0;var At=(ct+(n=n+Math.imul(O,vt)|0)|0)+((8191&(r=(r=r+Math.imul(O,dt)|0)+Math.imul(A,vt)|0))<<13)|0;ct=((u=u+Math.imul(A,dt)|0)+(r>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(T,lt),r=(r=Math.imul(T,ft))+Math.imul(P,lt)|0,u=Math.imul(P,ft);var xt=(ct+(n=n+Math.imul(L,vt)|0)|0)+((8191&(r=(r=r+Math.imul(L,dt)|0)+Math.imul(Z,vt)|0))<<13)|0;ct=((u=u+Math.imul(Z,dt)|0)+(r>>>13)|0)+(xt>>>26)|0,xt&=67108863;var Lt=(ct+(n=Math.imul(T,vt))|0)+((8191&(r=(r=Math.imul(T,dt))+Math.imul(P,vt)|0))<<13)|0;return ct=((u=Math.imul(P,dt))+(r>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,o[0]=gt,o[1]=yt,o[2]=wt,o[3]=kt,o[4]=Mt,o[5]=bt,o[6]=pt,o[7]=qt,o[8]=_t,o[9]=Nt,o[10]=Bt,o[11]=It,o[12]=Et,o[13]=St,o[14]=Rt,o[15]=Ot,o[16]=At,o[17]=xt,o[18]=Lt,0!==ct&&(o[19]=ct,e.length+=1),e}Math.imul||(gt=vt),L.Red=Q,module.exports=L;
|
||
},{"../internal/custom":"7RpA","buffer":"z1tx"}],"vi+k":[function(require,module,exports) {
|
||
"use strict";module.exports=require("./js/bn");
|
||
},{"./js/bn":"EE4A"}],"IvV+":[function(require,module,exports) {
|
||
var Buffer = require("buffer").Buffer;
|
||
var e=require("buffer").Buffer;function t(e,r,f){return(t=a()?Reflect.construct:function(e,t,r){var f=[null];f.push.apply(f,t);var i=new(Function.bind.apply(e,f));return r&&o(i,r.prototype),i}).apply(null,arguments)}function r(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=v(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var f=0,i=function(){};return{s:i,n:function(){return f>=e.length?{done:!0}:{done:!1,value:e[f++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n,o=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,n=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw n}}}}function f(e,t,r){return(f="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var f=i(e,t);if(f){var n=Object.getOwnPropertyDescriptor(f,t);return n.get?n.get.call(r):n.value}})(e,t,r||e)}function i(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=h(e)););return e}function n(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function s(e){var t=a();return function(){var r,f=h(e);if(t){var i=h(this).constructor;r=Reflect.construct(f,arguments,i)}else r=f.apply(this,arguments);return d(this,r)}}function d(e,t){return!t||"object"!==m(t)&&"function"!=typeof t?u(e):t}function u(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function a(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e,t){return p(e)||b(e,t)||v(e,t)||c()}function c(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function v(e,t){if(e){if("string"==typeof e)return y(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?y(e,t):void 0}}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,f=new Array(t);r<t;r++)f[r]=e[r];return f}function b(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],f=!0,i=!1,n=void 0;try{for(var o,s=e[Symbol.iterator]();!(f=(o=s.next()).done)&&(r.push(o.value),!t||r.length!==t);f=!0);}catch(d){i=!0,n=d}finally{try{f||null==s.return||s.return()}finally{if(i)throw n}}return r}}function p(e){if(Array.isArray(e))return e}function m(e){return(m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function S(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function w(e,t){for(var r=0;r<t.length;r++){var f=t[r];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(e,f.key,f)}}function I(e,t,r){return t&&w(e.prototype,t),r&&w(e,r),e}var k=require("../internal/custom"),g=k.custom,M=require("../bn"),N={AFFINE:0,JACOBIAN:1,PROJECTIVE:2,EXTENDED:3},z=[-3,-1,-5,-7,0,7,5,1,3],A=!1,q=0,_=function(){function t(e,r,f){S(this,t),this.Point=null,this.id=null,this.uid=q++,this.ossl=null,this.type="base",this.endian="be",this.hash=null,this.prefix=null,this.context=!1,this.prime=null,this.p=null,this.red=null,this.fieldSize=0,this.fieldBits=0,this.adjustedSize=0,this.signBit=0,this.mask=0,this.n=null,this.h=null,this.q=null,this.z=null,this.g=null,this.nh=null,this.scalarSize=0,this.scalarBits=0,this.zero=null,this.one=null,this.two=null,this.three=null,this.four=null,this.i2=null,this.i3=null,this.i4=null,this.i6=null,this.torsion=null,this.endo=null,this.hi=null,this._init(e,r,f)}return I(t,[{key:"_init",value:function(t,r,f){ye("function"==typeof t),ye("string"==typeof r),ye(f&&"object"===m(f)),ye(null==f.red||f.red instanceof M.Red),ye(null!=f.p,"Must pass a prime."),ye(null==f.id||"string"==typeof f.id),ye(null==f.ossl||"string"==typeof f.ossl),ye(null==f.endian||"string"==typeof f.endian),ye(null==f.hash||"string"==typeof f.hash),ye(null==f.prefix||"string"==typeof f.prefix),ye(null==f.context||"boolean"==typeof f.context),ye(null==f.prime||"string"==typeof f.prime),ye(null==f.torsion||Array.isArray(f.torsion)),this.Point=t,this.id=f.id||null,this.ossl=f.ossl||null,this.type=r,this.endian=f.endian||("short"===r?"be":"le"),this.hash=f.hash||null,this.prefix=f.prefix?e.from(f.prefix,"binary"):null,this.context=f.context||!1,this.prime=f.prime||null,this.p=M.fromJSON(f.p),f.red?this.red=f.red:(this.red=f.prime?M.red(f.prime):M.mont(this.p),this.red.precompute()),this.fieldSize=this.p.byteLength(),this.fieldBits=this.p.bitLength(),this.adjustedSize=this.fieldSize+(0==(7&this.fieldBits)),this.signBit=8*this.adjustedSize-1,this.mask=255,0!=(7&this.fieldBits)&&(this.mask=(1<<(7&this.fieldBits))-1),this.n=M.fromJSON(f.n||"0"),this.h=M.fromJSON(f.h||"1"),this.q=this.n.mul(this.h),this.z=M.fromJSON(f.z||"0").toRed(this.red),this.g=null,this.nh=this.n.ushrn(1),this.scalarSize=this.n.byteLength(),this.scalarBits=this.n.bitLength(),this.zero=new M(0).toRed(this.red),this.one=new M(1).toRed(this.red),this.two=new M(2).toRed(this.red),this.three=new M(3).toRed(this.red),this.four=new M(4).toRed(this.red),this.i2=this.two.redInvert(),this.i3=this.three.redInvert(),this.i4=this.i2.redSqr(),this.i6=this.i2.redMul(this.i3),this.torsion=new Array(this.h.word(0));for(var i=0;i<this.torsion.length;i++)this.torsion[i]=this.point();return this.endo=null,this.hi=null,this._scale=ke(this._scale,this),this.isIsomorphic=ke(this.isIsomorphic,this),this.isIsogenous=ke(this.isIsogenous,this),ye(this.p.sign()>0&&this.p.isOdd()),ye(this.n.sign()>=0),ye(this.h.sign()>0&&this.h.cmpn(255)<=0),ye("be"===this.endian||"le"===this.endian),this}},{key:"_finalize",value:function(e){if(ye(e&&"object"===m(e)),this.g=e.g?this.pointFromJSON(e.g):this.point(),e.torsion){ye(e.torsion.length===this.torsion.length);for(var t=0;t<this.torsion.length;t++)this.torsion[t]=this.pointFromJSON(e.torsion[t])}return this}},{key:"_findTorsion",value:function(){ye(!this.n.isZero());for(var e=this.h.word(0),t=this.one.redNeg(),r=[this.point()],f=new Set,i=e;r.length<i;){var n=void 0;t.redIAdd(this.one);try{n=this.pointFromX(t.clone())}catch(a){continue}try{n=n.mul(this.n)}catch(a){i=2;continue}if(!n.isInfinity()){n.normalize();for(var o=0,s=[n,n.neg()];o<s.length;o++){var d=s[o],u=d.key();f.has(u)||(r.push(d),f.add(u))}}}for(r.sort(function(e,t){return e.cmp(t)});r.length<e;)r.push(this.point());return r}},{key:"_fixedMul",value:function(e,t){ye(e instanceof x),ye(t instanceof M),ye(e.pre&&e.pre.windows);for(var r=e._getWindows(0,0),f=r.width,i=r.points,n=1<<f,o=(t.bitLength()+f-1)/f>>>0,s=this.jpoint(),d=0;d<o;d++){var u=t.bits(d*f,f);s=s.add(i[d*n+u])}return t.isNeg()&&(s=s.neg()),s}},{key:"_fixedNafMul",value:function(e,t){ye(e instanceof x),ye(t instanceof M),ye(e.pre&&e.pre.doubles);for(var r=e._getDoubles(0,0),f=r.step,i=r.points,n=le(t,2,t.bitLength()+1,f),o=((1<<f+1)-(f%2==0?2:1))/3,s=this.jpoint(),d=this.jpoint(),u=o;u>0;u--){for(var a=0;a<n.length;a++){var h=n[a];h===u?d=d.add(i[a]):h===-u&&(d=d.sub(i[a]))}s=s.add(d)}return s}},{key:"_wnafMul",value:function(e,t,r){ye(t instanceof x),ye(r instanceof M);for(var f=t._safeNAF(e),i=f.width,n=f.points,o=he(r,i,r.bitLength()+1),s=this.jpoint(),d=o.length-1;d>=0;d--){var u=o[d];d!==o.length-1&&(s=s.dbl()),u>0?s=s.add(n[u-1>>1]):u<0&&(s=s.sub(n[-u-1>>1]))}return s}},{key:"_wnafMulAdd",value:function(e,t,r){ye(e>>>0===e),ye(Array.isArray(t)),ye(Array.isArray(r)),ye(t.length===r.length);for(var f=t.length,i=new Array(f),n=new Array(f),o=0,s=0;s<f;s++){var d=t[s],u=r[s];if(ye(d instanceof x),ye(u instanceof M),s>0&&d.type!==t[s-1].type)throw new Error("Cannot mix points.");i[s]=null,n[s]=null,o=Math.max(o,u.bitLength()+1)}for(var a=null,h=null,l=0,c=0;c<f;c++){var v=t[c],y=r[c],b=v._getNAF(0);b?(i[l]=b.points,n[l]=he(y,b.width,o),l+=1):a?(i[l]=a._getJNAF(v),n[l]=ve(h,y,o),a=null,h=null,l+=1):(a=v,h=y)}if(a){var p=a._safeNAF(e);i[l]=p.points,n[l]=he(h,p.width,o),l+=1}for(var m=this.jpoint(),S=o-1;S>=0;S--){S!==o-1&&(m=m.dbl());for(var w=0;w<l;w++){var I=n[w][S];I>0?m=m.add(i[w][I-1>>1]):I<0&&(m=m.sub(i[w][-I-1>>1]))}}return m}},{key:"_endoWnafMulAdd",value:function(e,t){throw new Error("Not implemented.")}},{key:"_scale",value:function(e,r){switch(ye(e instanceof t),ye(e.p.eq(this.p)),e.type){case"short":return this._scaleShort(e,r);case"mont":return this._scaleMont(e,r);case"edwards":return this._scaleEdwards(e,r);default:throw new Error("Not implemented.")}}},{key:"_scaleShort",value:function(e,t){throw new Error("Not implemented.")}},{key:"_scaleMont",value:function(e,t){throw new Error("Not implemented.")}},{key:"_scaleEdwards",value:function(e,t){throw new Error("Not implemented.")}},{key:"isElliptic",value:function(){throw new Error("Not implemented.")}},{key:"jinv",value:function(){throw new Error("Not implemented.")}},{key:"isComplete",value:function(){return!1}},{key:"precompute",value:function(e){return ye(!this.g.isInfinity(),"Must have base point."),ye(!this.n.isZero(),"Must have order."),this.g.precompute(this.n.bitLength(),e),this}},{key:"scalar",value:function(e,t,r){var f=new M(e,t,r);return ye(!f.red),this.n.isZero()?f:f.imod(this.n)}},{key:"field",value:function(e,t,r){var f=M.cast(e,t,r);return f.red?f.forceRed(this.red):f.toRed(this.red)}},{key:"point",value:function(e,t){throw new Error("Not implemented.")}},{key:"jpoint",value:function(e,t,r){throw new Error("Not implemented.")}},{key:"xpoint",value:function(e,t){throw new Error("Not implemented.")}},{key:"cpoint",value:function(e,t,r,f){if(ye(e instanceof M),ye(t instanceof M),ye(r instanceof M),ye(f instanceof M),t.isZero()||f.isZero())return this.point();var i=t.redMul(f).redInvert(),n=e.redMul(f).redMul(i),o=r.redMul(t).redMul(i);return this.point(n,o)}},{key:"solveX2",value:function(e){throw new Error("Not implemented.")}},{key:"solveX",value:function(e){return this.solveX2(e).redSqrt()}},{key:"solveY2",value:function(e){throw new Error("Not implemented.")}},{key:"solveY",value:function(e){return this.solveY2(e).redSqrt()}},{key:"validate",value:function(e){throw new Error("Not implemented.")}},{key:"pointFromX",value:function(e,t){throw new Error("Not implemented.")}},{key:"pointFromY",value:function(e,t){throw new Error("Not implemented.")}},{key:"isIsomorphic",value:function(e){throw new Error("Not implemented.")}},{key:"isIsogenous",value:function(e){throw new Error("Not implemented.")}},{key:"pointFromShort",value:function(e){throw new Error("Not implemented.")}},{key:"pointFromMont",value:function(e,t){throw new Error("Not implemented.")}},{key:"pointFromEdwards",value:function(e){throw new Error("Not implemented.")}},{key:"pointFromUniform",value:function(e){throw new Error("Not implemented.")}},{key:"pointToUniform",value:function(e){throw new Error("Not implemented.")}},{key:"pointFromHash",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(ye(e.isBuffer(t)),ye("boolean"==typeof r),t.length!==2*this.fieldSize)throw new Error("Invalid hash size.");var f=t.slice(0,this.fieldSize),i=t.slice(this.fieldSize),n=this.decodeUniform(f),o=this.decodeUniform(i),s=this.pointFromUniform(n),d=this.pointFromUniform(o),u=s.add(d);return r?u.mulH():u}},{key:"pointToHash",value:function(t,r,f){ye(t instanceof this.Point),ye(r>>>0===r);for(var i=r%this.torsion.length,n=t.add(this.torsion[i]);;){var o=this.randomField(f),s=this.pointFromUniform(o);if(!s.neg().eq(s)){var d=n.sub(s),u=Ie(f),a=void 0;try{a=this.pointToUniform(d,15&u)}catch(c){if("Invalid point."===c.message)continue;throw c}var h=this.encodeUniform(o,u>>>8),l=this.encodeUniform(a,u>>>16);return e.concat([h,l])}}}},{key:"randomScalar",value:function(e){var t=this.n.isZero()?this.p:this.n;return M.random(e,1,t)}},{key:"randomField",value:function(e){return M.random(e,1,this.p).toRed(this.red)}},{key:"randomPoint",value:function(e){for(var t;;){var r=this.randomField(e),f=0!=(1&Ie(e));try{t=this.pointFromX(r,f)}catch(i){continue}return ye(t.validate()),t.mulH()}}},{key:"mulAll",value:function(e,t){return this.jmulAll(e,t)}},{key:"jmulAll",value:function(e,t){return ye(Array.isArray(e)),ye(0===e.length||e[0]instanceof x),this.endo&&e.length>0&&e[0].type===N.AFFINE?this._endoWnafMulAdd(e,t):this._wnafMulAdd(5,e,t)}},{key:"mulH",value:function(e){return ye(e instanceof M),this.imulH(e.clone())}},{key:"imulH",value:function(e){ye(e instanceof M),ye(!e.red);var t=this.h.word(0);if(0==(t&t-1)){var r=this.h.bitLength();return e.iushln(r-1).imod(this.n)}return e.imuln(t).imod(this.n)}},{key:"normalizeAll",value:function(e){ye(Array.isArray(e));for(var t=e.length,r=new Array(t),f=0;f<t;f++){var i=e[f];ye(i instanceof x),ye(i.curve===this),i.type!==N.AFFINE?r[f]=i.z:r[f]=this.one}for(var n=this.red.invertAll(r),o=new Array(t),s=0;s<t;s++)o[s]=e[s].scale(n[s]);return o}},{key:"affinizeAll",value:function(e){return this.normalizeAll(e)}},{key:"clamp",value:function(t){ye(e.isBuffer(t)),ye(t.length===this.scalarSize),ye(this.scalarSize<=this.fieldSize);var r=7&this.fieldBits||8,f=0,i=this.scalarSize-1;if("be"===this.endian){var n=[i,f];f=n[0],i=n[1]}return this.scalarSize<this.fieldSize&&(r=8),t[f]&=255&-this.h.word(0),t[i]&=(1<<r)-1,t[i]|=1<<r-1,t}},{key:"splitHash",value:function(t){ye(e.isBuffer(t)),ye(t.length===2*this.adjustedSize),ye(this.scalarSize<=this.adjustedSize);var r=0;"be"===this.endian&&(r=this.adjustedSize-this.scalarSize);var f=t.slice(r,r+this.scalarSize),i=t.slice(this.adjustedSize);return this.clamp(f),[f,i]}},{key:"encodeField",value:function(e){return ye(e instanceof M),ye(!e.red),e.encode(this.endian,this.fieldSize)}},{key:"decodeField",value:function(t){if(ye(e.isBuffer(t)),t.length!==this.fieldSize)throw new Error("Invalid field element size.");return M.decode(t,this.endian)}},{key:"encodeAdjusted",value:function(e){return ye(e instanceof M),ye(!e.red),e.encode(this.endian,this.adjustedSize)}},{key:"decodeAdjusted",value:function(t){if(ye(e.isBuffer(t)),t.length!==this.adjustedSize)throw new Error("Invalid field element size.");return M.decode(t,this.endian)}},{key:"encodeScalar",value:function(e){return ye(e instanceof M),ye(!e.red),e.encode(this.endian,this.scalarSize)}},{key:"decodeScalar",value:function(t){if(ye(e.isBuffer(t)),t.length!==this.scalarSize)throw new Error("Invalid scalar size.");return M.decode(t,this.endian)}},{key:"encodeClamped",value:function(e){return this.clamp(this.encodeScalar(e))}},{key:"decodeClamped",value:function(t){if(ye(e.isBuffer(t)),t.length!==this.scalarSize)throw new Error("Invalid scalar size.");var r=this.clamp(e.from(t));return M.decode(r,this.endian)}},{key:"encodeUniform",value:function(e,t){ye(e instanceof M),ye(t>>>0===t);var r="le"===this.endian?this.fieldSize-1:0,f=e.fromRed().encode(this.endian,this.fieldSize);return f[r]|=t&~this.mask&255,f}},{key:"decodeUniform",value:function(t){if(ye(e.isBuffer(t)),t.length!==this.fieldSize)throw new Error("Invalid field size.");var r=M.decode(t,this.endian);return r.iumaskn(this.fieldBits),r.toRed(this.red)}},{key:"encodePoint",value:function(e,t){return ye(e instanceof x),e.encode(t)}},{key:"decodePoint",value:function(e){throw new Error("Not implemented.")}},{key:"encodeX",value:function(e){throw new Error("Not implemented.")}},{key:"decodeX",value:function(e){throw new Error("Not implemented.")}},{key:"decodeEven",value:function(e){throw new Error("Not implemented.")}},{key:"decodeSquare",value:function(e){throw new Error("Not implemented.")}},{key:"toShort",value:function(){throw new Error("Not implemented.")}},{key:"toMont",value:function(e){throw new Error("Not implemented.")}},{key:"toEdwards",value:function(e){throw new Error("Not implemented.")}},{key:"pointToJSON",value:function(e,t){return ye(e instanceof x),e.toJSON(t)}},{key:"pointFromJSON",value:function(e){throw new Error("Not implemented.")}},{key:"toJSON",value:function(e){var t,r,f,i,n;return"edwards"===this.type&&(t=this.prefix?this.prefix.toString():null,r=this.context),this.n.isZero()||(f=this.n.toJSON()),this.z.isZero()||(i=this.z.fromRed(),this.z.redIsHigh()&&i.isub(this.p),i=i.toString(16)),this.endo&&(n=this.endo.toJSON()),{id:this.id,ossl:this.ossl,type:this.type,endian:this.endian,hash:this.hash,prefix:t,context:r,prime:this.prime,p:this.p.toJSON(),a:void 0,b:void 0,d:void 0,n:f,h:this.h.toString(16),s:void 0,z:i,c:void 0,g:this.g.toJSON(e),endo:n}}}],[{key:"fromJSON",value:function(e){return new this(e)}}]),t}(),x=function(){function e(t,r){S(this,e),ye(t instanceof _),ye(r>>>0===r),this.curve=t,this.type=r,this.pre=null}return I(e,[{key:"_init",value:function(){throw new Error("Not implemented.")}},{key:"_safeNAF",value:function(e){if(ye(e>>>0===e),this.pre&&this.pre.naf)return this.pre.naf;if(0===e)return null;var t=1<<e-2,r=new Array(t),f=this.toJ(),i=1===t?null:f.dbl();r[0]=f;for(var n=1;n<t;n++)r[n]=r[n-1].add(i);return new D(e,r)}},{key:"_getNAF",value:function(e){if(ye(e>>>0===e),this.pre&&this.pre.naf)return this.pre.naf;if(0===e)return null;var t=this._safeNAF(e).points,r=this.curve.affinizeAll(t);return new D(e,r)}},{key:"_getWindows",value:function(e,t){if(ye(e>>>0===e),ye(t>>>0===t),this.pre&&this.pre.windows)return this.pre.windows;if(0===e)return null;for(var r=1<<e,f=(t+e-1)/e>>>0,i=new Array(f*r),n=this.toJ(),o=0;o<f;o++){i[o*r]=this.curve.jpoint();for(var s=1;s<r;s++)i[o*r+s]=i[o*r+s-1].add(n);n=n.dblp(e)}var d=this.curve.affinizeAll(i);return new B(e,t,d)}},{key:"_getDoubles",value:function(e,t){if(ye(e>>>0===e),ye(t>>>0===t),this.pre&&this.pre.doubles)return this.pre.doubles;if(0===e)return null;var r=Math.ceil(t/e)+1,f=new Array(r),i=this.toJ(),n=0;f[n++]=i;for(var o=0;o<t;o+=e){for(var s=0;s<e;s++)i=i.dbl();f[n++]=i}ye(n===r);var d=this.curve.affinizeAll(f);return new Y(e,d)}},{key:"_getBeta",value:function(){return null}},{key:"_getBlinding",value:function(e){if(this.pre&&this.pre.blinding)return this.pre.blinding;if(!e)return null;if(this.curve.n.isZero())return null;var t=this.curve.randomScalar(e),r=this.mul(t);return new H(t,r)}},{key:"_hasWindows",value:function(e){if(ye(e instanceof M),!this.pre||!this.pre.windows)return!1;var t=this.pre.windows,r=t.width,f=(t.bits+r-1)/r>>>0;return e.bitLength()<=f*r}},{key:"_hasDoubles",value:function(e){if(ye(e instanceof M),!this.pre||!this.pre.doubles)return!1;var t=this.pre.doubles,r=t.step,f=t.points,i=e.bitLength()+1;return f.length>=Math.ceil(i/r)+1}},{key:"_getJNAF",value:function(t){return ye(t instanceof e),ye(t.type===this.type),[this,this.add(t),this.sub(t),t]}},{key:"_blind",value:function(e,t){if(ye(e instanceof M),ye(!e.red),this.pre&&this.pre.blinding){var r=this.pre.blinding,f=r.blind,i=r.unblind;return[this,e.sub(f),i]}return t?this.pre?this.curve.n.isZero()?[this,e,null]:[this,this.curve.randomScalar(t).mul(this.curve.n).iadd(e),null]:[this.randomize(t),e,null]:[this,e,null]}},{key:"clone",value:function(){throw new Error("Not implemented.")}},{key:"precompute",value:function(e,t){return ye(e>>>0===e),this.pre||(this.pre=new X),this.pre.naf||(this.pre.naf=this._getNAF(9)),A&&!this.pre.windows&&(this.pre.windows=this._getWindows(4,e)),this.pre.doubles||(this.pre.doubles=this._getDoubles(4,e+1)),this.pre.beta||(this.pre.beta=this._getBeta()),this.pre.blinding||(this.pre.blinding=this._getBlinding(t)),this}},{key:"validate",value:function(){return this.curve.validate(this)}},{key:"normalize",value:function(){return this}},{key:"scale",value:function(e){throw new Error("Not implemented.")}},{key:"randomize",value:function(e){var t=this.curve.randomField(e);return this.scale(t)}},{key:"neg",value:function(){throw new Error("Not implemented.")}},{key:"add",value:function(e){throw new Error("Not implemented.")}},{key:"sub",value:function(t){return ye(t instanceof e),this.add(t.neg())}},{key:"dbl",value:function(){throw new Error("Not implemented.")}},{key:"dblp",value:function(e){ye(e>>>0===e);for(var t=this,r=0;r<e;r++)t=t.dbl();return t}},{key:"diffAddDbl",value:function(e,t){throw new Error("Not implemented.")}},{key:"getX",value:function(){throw new Error("Not implemented.")}},{key:"getY",value:function(){throw new Error("Not implemented.")}},{key:"eq",value:function(e){throw new Error("Not implemented.")}},{key:"cmp",value:function(e){throw new Error("Not implemented.")}},{key:"isInfinity",value:function(){throw new Error("Not implemented.")}},{key:"isOrder2",value:function(){throw new Error("Not implemented.")}},{key:"isOdd",value:function(){throw new Error("Not implemented.")}},{key:"isEven",value:function(){throw new Error("Not implemented.")}},{key:"isSquare",value:function(){throw new Error("Not implemented.")}},{key:"eqX",value:function(e){throw new Error("Not implemented.")}},{key:"eqR",value:function(e){throw new Error("Not implemented.")}},{key:"isSmall",value:function(){return!this.isInfinity()&&this.jmulH().isInfinity()}},{key:"hasTorsion",value:function(){return!this.isInfinity()&&!this.jmul(this.curve.n).isInfinity()}},{key:"order",value:function(){for(var e=this.curve,t=e.h,r=e.n,f=this.toJ(),i=new M(1);!f.isInfinity();){if(i.iaddn(1),i.cmp(t)>0){i=r.clone();break}f=f.add(this)}return i}},{key:"mul",value:function(e){return this.jmul(e)}},{key:"muln",value:function(e){return this.jmuln(e)}},{key:"mulBlind",value:function(e,t){return this.jmulBlind(e,t)}},{key:"mulAdd",value:function(e,t,r){return this.jmulAdd(e,t,r)}},{key:"mulH",value:function(){return this.jmulH()}},{key:"div",value:function(e){return this.jdiv(e)}},{key:"divn",value:function(e){return this.jdivn(e)}},{key:"divH",value:function(){return this.jdivH()}},{key:"jmul",value:function(e){return A&&this._hasWindows(e)?this.curve._fixedMul(this,e):this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo&&this.type===N.AFFINE?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(5,this,e)}},{key:"jmuln",value:function(e){return ye((0|e)===e),this.jmul(new M(e))}},{key:"jmulBlind",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=l(this._blind(e,t),3),f=r[0],i=r[1],n=r[2],o=f.jmul(i);return n?o.add(n):o}},{key:"jmulAdd",value:function(e,t,r){return this.curve.endo&&this.type===N.AFFINE?this.curve._endoWnafMulAdd([this,t],[e,r]):this.curve._wnafMulAdd(5,[this,t],[e,r])}},{key:"jmulH",value:function(){var e=this.curve.h.word(0);if(0==(e&e-1)){var t=this.curve.h.bitLength();return this.toJ().dblp(t-1)}return this.jmul(this.curve.h)}},{key:"jdiv",value:function(e){return ye(e instanceof M),ye(!e.red),this.jmul(e.invert(this.curve.n))}},{key:"jdivn",value:function(e){return ye(!this.curve.n.isZero()),0===this.curve.h.cmpn(e)?this.jdivH():this.jdiv(new M(e))}},{key:"jdivH",value:function(){return this.curve.n.isZero()?this.toJ():0===this.curve.h.cmpn(1)?this.toJ():(null===this.curve.hi&&(this.curve.hi=this.curve.h.invert(this.curve.n)),this.jmul(this.curve.hi))}},{key:"toP",value:function(){return this.normalize()}},{key:"toJ",value:function(){return this}},{key:"toX",value:function(){return this}},{key:"key",value:function(){if(this.isInfinity())return"".concat(this.curve.uid,":oo");this.normalize();var e=this.getX().toString(16),t=this.getY().toString(16);return"".concat(this.curve.uid,":").concat(e,",").concat(t)}},{key:"encode",value:function(e){throw new Error("Not implemented.")}},{key:"encodeX",value:function(){throw new Error("Not implemented.")}},{key:"toJSON",value:function(e){throw new Error("Not implemented.")}},{key:g,value:function(){return"<Point>"}}],[{key:"decode",value:function(e,t){throw new Error("Not implemented.")}},{key:"decodeX",value:function(e,t){throw new Error("Not implemented.")}},{key:"decodeEven",value:function(e,t){throw new Error("Not implemented.")}},{key:"decodeSquare",value:function(e,t){throw new Error("Not implemented.")}},{key:"fromJSON",value:function(e,t){throw new Error("Not implemented.")}}]),e}(),O=function(e){n(r,_);var t=s(r);function r(e){var f;return S(this,r),(f=t.call(this,E,"short",e)).a=M.fromJSON(e.a).toRed(f.red),f.b=M.fromJSON(e.b).toRed(f.red),f.c=M.fromJSON(e.c||"0").toRed(f.red),f.ai=f.a.isZero()?f.zero:f.a.redInvert(),f.zi=f.z.isZero()?f.zero:f.z.redInvert(),f.zeroA=f.a.isZero(),f.threeA=f.a.eq(f.three.redNeg()),f.redN=f.n.toRed(f.red),f.pmodn=f.p.clone(),f.highOrder=f.n.cmp(f.p)>=0,f.smallGap=!1,f._finalize(e),f}return I(r,[{key:"_finalize",value:function(e){return f(h(r.prototype),"_finalize",this).call(this,e),null!=e.endo?this.endo=C.fromJSON(this,e.endo):this.endo=this._getEndomorphism(),this.n.isZero()||(this.pmodn=this.p.mod(this.n),this.smallGap=this.p.div(this.n).cmpn(1)<=0),this}},{key:"_short",value:function(e,t){return r._isomorphism(this.a,this.b,e,t)}},{key:"_mont",value:function(e,t){var r=l(this._findRS(t),2),f=r[0],i=r[1].redInvert(),n=f.redMuln(3).redMul(i);return null!=e?P._isomorphism(n,i,e):[n,i]}},{key:"_edwards",value:function(e,t){var r=l(this._findRS(t),2),f=r[0],i=r[1],n=f.redMuln(3),o=i.redMuln(2),s=n.redAdd(o),d=n.redSub(o);return null!=e?Z._isomorphism(s,d,e):[s,d]}},{key:"_findRS",value:function(e){ye(null==e||"boolean"==typeof e),ye(this.h.word(0)>=4),ye(!this.n.isZero());for(var t,r=this.one.redNeg();;){r.redIAdd(this.one);try{t=this.pointFromX(r.clone())}catch(n){continue}if(!(t=t.mul(this.n)).isInfinity()&&t.y.isZero())break}var f=t.x,i=f.redSqr().redMuln(3).redIAdd(this.a).redSqrt();return null!=e&&i.redIsOdd()!==e&&i.redINeg(),[f,i]}},{key:"_scale0",value:function(e,t){if(ye(this.a.isZero()===e.isZero()),ye(this.b.isZero()===t.isZero()),this.a.isZero()){var r=this.b.redDiv(this.field(t)),f=we(r),i=f.redSqrt(),n=f.redMul(i);return ye(n.redSqr().eq(r)),ye(!i.isZero()),[f,n]}if(this.b.isZero()){var o=this.a.redDiv(this.field(e)),s=o.redSqrt();1!==s.redJacobi()&&s.redINeg();var d=s.redSqrt(),u=s.redMul(d);return ye(u.redMul(d).eq(o)),ye(!d.isZero()),[s,u]}var a=this.a.redDiv(this.field(e)),h=this.b.redDiv(this.field(t)),l=a.redSqrt();a.redMul(l).eq(h)||l.redINeg(),ye(a.redMul(l).eq(h));var c=l.redSqrt(),v=l.redMul(c);return ye(!c.isZero()),[l,v]}},{key:"_scale1",value:function(e,t){var r=this.g.x.redDiv(this.field(e)),f=this.g.y.redDiv(this.field(t)),i=r.redSqrt();return r.redMul(i).eq(f)||i.redINeg(),ye(r.redMul(i).eq(f)),ye(!i.isZero()),[r,f]}},{key:"_scaleShort",value:function(e){return ye(e instanceof r),this.g.isInfinity()||e.g.isInfinity()?this._scale0(e.a,e.b):this._scale1(e.g.x,e.g.y)}},{key:"_scaleMont",value:function(e){if(ye(e instanceof P),this.g.isInfinity()||e.g.isInfinity()){var t=l(e._short(),2),r=t[0],f=t[1];return this._scale0(r,f)}var i=e.g,n=i.x,o=i.y,s=n.redAdd(e.a3).redMul(e.bi),d=o.redMul(e.bi);return this._scale1(s,d)}},{key:"_scaleEdwards",value:function(e){if(ye(e instanceof Z),this.g.isInfinity()||e.g.isInfinity()){var t=l(e._short(),2),r=t[0],f=t[1];return this._scale0(r,f)}var i=e.g,n=i.x,o=i.y,s=i.z,d=e.a.redMuln(5),u=e.d.redMuln(5),a=e.d.redSub(e.a),h=u.redSub(e.a),c=e.d.redSub(d),v=o.redAdd(s),y=o.redSub(s),b=h.redMul(o).redIAdd(c.redMul(s)),p=y.redMuln(12),m=a.redMul(v).redMul(s),S=y.redMul(n).redIMuln(4),w=p.redMul(S).redInvert(),I=b.redMul(S).redMul(w),k=m.redMul(p).redMul(w);return this._scale1(I,k)}},{key:"_getEndomorphism",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(this.n.isZero()||this.g.isInfinity())return null;if(!this.zeroA||1!==this.p.modrn(3)||1!==this.n.modrn(3))return null;var t,r=l(this._getEndoRoots(this.p),2),f=[r[0],r[1]][1&e].toRed(this.red),i=l(this._getEndoRoots(this.n),2),n=i[0],o=i[1],s=this.point(this.g.x.redMul(f),this.g.y);this.g.mul(n).eq(s)?t=n:(ye(this.g.mul(o).eq(s)),t=o);var d=this._getEndoBasis(t),u=this._getEndoPrecomp(d);return new C(f,t,d,u)}},{key:"_getEndoRoots",value:function(e){var t=e===this.p?this.red:M.mont(e),r=new M(2).toRed(t),f=new M(3).toRed(t),i=r.redInvert(),n=f.redNeg().redSqrt().redMul(i),o=n.redNeg();return[n.redSub(i).fromRed(),o.redSub(i).fromRed()].sort(M.cmp)}},{key:"_getEndoBasis",value:function(e){var t,r,f=l(this._egcdSqrt(e),6),i=f[0],n=f[1],o=f[2],s=f[3],d=f[4],u=f[5],a=o,h=s.neg(),c=i.sqr().iadd(n.sqr()),v=d.sqr().iadd(u.sqr());return c.cmp(v)<=0?(t=i,r=n.neg()):(t=d,r=u.neg()),[new L(a,h),new L(t,r)]}},{key:"_egcdSqrt",value:function(e){ye(e instanceof M),ye(!e.red),ye(e.sign()>0),ye(this.n.sign()>0);for(var t,r,f,i,n,o=this.n.ushrn(this.n.bitLength()>>>1),s=e,d=this.n.clone(),u=new M(1),a=new M(0),h=new M(0),l=new M(1),c=0,v=0;!s.isZero()&&c<2;){var y=d.quo(s),b=d.sub(y.mul(s)),p=h.sub(y.mul(u)),m=l.sub(y.mul(a));0===v&&b.cmp(o)<0&&(t=n,r=u,f=b,i=p,v=1),n=b,d=s,s=b,h=u,u=p,l=a,a=m,c+=v}return ye(0!==v,"Could not find r < sqrt(n)."),[t,r,f,i,h,u]}},{key:"_getEndoPrecomp",value:function(e){ye(Array.isArray(e)),ye(2===e.length),ye(e[0]instanceof L),ye(e[1]instanceof L);var t=l(e,2),r=t[0],f=t[1],i=r.a.mul(f.b).isub(r.b.mul(f.a)),n=i.bitLength(),o=n>=160;ye(i.eq(this.n));var s,d,u=n+Math.ceil(n/2)+1;for(o&&(u-=63&u);u>n&&(s=f.b.ushln(u).divRound(i),d=r.b.ushln(u).divRound(i),!(s.ucmp(i)<0&&d.ucmp(i)<0));)u-=o?64:1;if(u<=n)throw new Error("Could not calculate g1 and g2.");return[u,s,d]}},{key:"_endoSplit",value:function(e){ye(e instanceof M),ye(!e.red),ye(!this.n.isZero());var t=l(this.endo.basis,2),r=t[0],f=t[1],i=f.b.mul(e).divRound(this.n),n=r.b.neg().mul(e).divRound(this.n),o=i.mul(r.a),s=n.mul(f.a),d=i.ineg().mul(r.b),u=n.mul(f.b);return[e.sub(o).isub(s),d.isub(u)]}},{key:"_endoBeta",value:function(e){return ye(e instanceof E),[e,e._getBeta()]}},{key:"_endoWnafMulAdd",value:function(e,t){ye(Array.isArray(e)),ye(Array.isArray(t)),ye(e.length===t.length),ye(null!=this.endo);for(var r=e.length,f=new Array(2*r),i=new Array(2*r),n=0;n<r;n++){var o=l(this._endoBeta(e[n]),2),s=o[0],d=o[1],u=l(this._endoSplit(t[n]),2),a=u[0],h=u[1];f[2*n+0]=s,i[2*n+0]=a,f[2*n+1]=d,i[2*n+1]=h}return this._wnafMulAdd(5,f,i)}},{key:"_sswu",value:function(e){var t=this.b,r=this.z,f=this.ai,i=this.zi,n=this.one,o=r.redSqr(),s=t.redNeg().redMul(f),d=t.redMul(i).redMul(f),u=e.redSqr(),a=u.redSqr(),h=o.redMul(a).redIAdd(r.redMul(u)),l=h.isZero()?h:h.redInvert(),c=l.isZero()?d:s.redMul(n.redAdd(l)),v=r.redMul(u).redMul(c),y=this.solveY2(c),b=this.solveY2(v),p=0|y.redIsSquare(),m=[c,v][1^p],S=[y,b][1^p].redSqrt();return S.redIsOdd()!==e.redIsOdd()&&S.redINeg(),this.point(m,S)}},{key:"_sswui",value:function(e,t){var r=this.a,f=this.b,i=this.z,n=e.x,o=e.y,s=3&t,d=r.redSqr().redMul(n.redSqr()),u=r.redMul(f).redMul(n).redIMuln(2),a=f.redSqr().redMuln(3),h=r.redMul(n).redIAdd(f),l=d.redISub(u).redISub(a).redSqrt(),c=h.redSub(l).redINeg(),v=h.redAdd(l).redINeg(),y=[h.redMul(i).redIMuln(2),f.redMul(i).redIMuln(2)][s>>>1],b=[c,v][1&s].redDivSqrt(y);return b.redIsOdd()!==o.redIsOdd()&&b.redINeg(),b}},{key:"_svdwf",value:function(e){var t=this.c,r=this.z,f=this.zi,i=this.i2,n=this.i3,o=this.solveY2(r),s=n.redMul(f.redSqr()),d=e.redSqr(),u=d.redSqr(),a=d.redAdd(o),h=d.redMul(a),l=h.isZero()?h:h.redInvert(),c=u.redMul(l).redMul(t),v=a.redSqr().redMul(a),y=t.redSub(r).redMul(i).redISub(c),b=c.redSub(t.redAdd(r).redMul(i)),p=r.redSub(v.redMul(l).redMul(s)),m=this.solveY2(y),S=this.solveY2(b),w=this.solveY2(p),I=pe(((1|m.redJacobi())-1)*(1|S.redJacobi()),3);return[[y,b,p][I],[m,S,w][I]]}},{key:"_svdw",value:function(e){var t=l(this._svdwf(e),2),r=t[0],f=t[1].redSqrt();return f.redIsOdd()!==e.redIsOdd()&&f.redINeg(),this.point(r,f)}},{key:"_svdwi",value:function(e,t){var r=this.b,f=this.c,i=this.z,n=this.zero,o=this.two,s=e.x,d=e.y,u=3&t,a=i.redSqr(),h=a.redMul(i),c=a.redSqr(),v=h.redAdd(r),y=v.redMuln(2),b=s.redSqr(),p=s.redMuln(2).redIAdd(i),m=s.redMul(a),S=f.redSub(p),w=f.redAdd(p),I=b.redMul(a).redIAdd(c).redIMuln(9),k=s.redMul(h).redIMuln(18),g=v.redMul(s.redSub(i)).redIMuln(12),M=(u>=2?I.redISub(k).redIAdd(g).redSqrt():n).redMul(i),N=h.redISub(m).redIMuln(3).redISub(y),z=v.redMul(S),A=v.redMul(w),q=N.redAdd(M),_=N.redSub(M),x=[w,S,o,o][u],O=[z,A,q,_][u].redDivSqrt(x);if(!l(this._svdwf(O),1)[0].eq(s))throw new Error("Invalid point.");return O.redIsOdd()!==d.redIsOdd()&&O.redINeg(),O}},{key:"isElliptic",value:function(){var e=this.a,t=this.b,r=e.redSqr().redMul(e);return!t.redSqr().redMuln(27).redIAdd(r.redMuln(4)).isZero()}},{key:"jinv",value:function(){var e=this.a,t=this.b,r=e.redSqr().redMul(e),f=t.redSqr(),i=r.redMuln(4),n=i.redMuln(1728),o=f.redMuln(27).redIAdd(i);if(o.isZero())throw new Error("Curve is not elliptic.");return n.redDiv(o).fromRed()}},{key:"point",value:function(e,t){return new E(this,e,t)}},{key:"jpoint",value:function(e,t,r){return new J(this,e,t,r)}},{key:"solveX",value:function(e){if(ye(e instanceof M),!this.a.isZero())throw new Error("Not implemented.");return Se(e.redSqr().redSub(this.b))}},{key:"solveY2",value:function(e){ye(e instanceof M);var t=e.redSqr().redMul(e).redIAdd(this.b);return this.zeroA||(this.threeA?t.redIAdd(e.redMuln(-3)):t.redIAdd(this.a.redMul(e))),t}},{key:"validate",value:function(e){if(ye(e instanceof E),e.inf)return!0;var t=e.x,r=e.y,f=this.solveY2(t);return r.redSqr().eq(f)}},{key:"pointFromX",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;ye(e instanceof M),ye(null==t||"boolean"==typeof t),e.red||(e=e.toRed(this.red));var r=this.solveY(e);if(null!=t){if(this.h.cmpn(1)>0&&r.isZero()&&t)throw new Error("Invalid point.");r.redIsOdd()!==t&&r.redINeg()}return this.point(e,r)}},{key:"pointFromY",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;ye(e instanceof M),ye(t>>>0===t),e.red||(e=e.toRed(this.red));var r=this.solveX(e);if(t>=r.length)throw new Error("Invalid X coordinate index.");var f=r[t];return this.point(f,e)}},{key:"isIsomorphic",value:function(e){if(ye(e instanceof _),!e.p.eq(this.p))return!1;var t,r;try{var f=l(this._scale(e),2);t=f[0],r=f[1]}catch(a){return!1}if("short"===e.type){var i=this.field(e.a).redMul(t.redSqr()),n=this.field(e.b).redMul(r.redSqr());return this.a.eq(i)&&this.b.eq(n)}if("mont"===e.type){var o=e.a3,s=e.bi,d=this.field(o.redMul(s)).redMul(t);return this.solveY2(d).isZero()}if("edwards"===e.type){var u=this.field(e.ad6).redMul(t);return this.solveY2(u).isZero()}return!1}},{key:"isIsogenous",value:function(e){return ye(e instanceof _),!1}},{key:"pointFromShort",value:function(e){if(ye(e instanceof E),this.isIsomorphic(e.curve)){if(e.isInfinity())return this.point();var t=l(this._scale(e.curve),2),r=t[0],f=t[1],i=this.field(e.x),n=this.field(e.y),o=i.redMul(r),s=n.redMul(f);return this.point(o,s)}throw new Error("Not implemented.")}},{key:"pointFromMont",value:function(e){if(ye(e instanceof R),this.isIsomorphic(e.curve)){if(e.isInfinity())return this.point();var t=e.curve,r=t.a3,f=t.bi,i=l(this._scale(e.curve),2),n=i[0],o=i[1],s=e.x.redAdd(r).redMul(f),d=e.y.redMul(f);return this.point(this.field(s).redMul(n),this.field(d).redMul(o))}throw new Error("Not implemented.")}},{key:"pointFromEdwards",value:function(e){if(ye(e instanceof j),this.isIsomorphic(e.curve)){var t=e.curve,r=t.a,f=t.d,i=t.ad6,n=l(this._scale(e.curve),2),o=n[0],s=n[1];if(e.isInfinity())return this.point();if(e.x.isZero()){var d=this.field(i).redMul(o);return this.point(d,this.zero)}var u=e.x,a=e.y,h=e.z,c=r.redMuln(5),v=f.redMuln(5),y=f.redSub(r),b=v.redSub(r),p=f.redSub(c),m=a.redAdd(h),S=a.redSub(h),w=b.redMul(a).redIAdd(p.redMul(h)),I=S.redMuln(12),k=y.redMul(m).redMul(h),g=S.redMul(u).redIMuln(4);return this.cpoint(this.field(w).redMul(o),this.field(I),this.field(k).redMul(s),this.field(g))}throw new Error("Not implemented.")}},{key:"pointFromUniform",value:function(e){if(ye(e instanceof M),this.z.isZero()||this.b.isZero())throw new Error("Not implemented.");if(!this.a.isZero())return this._sswu(e);if(!this.c.isZero())return this._svdw(e);throw new Error("Not implemented.")}},{key:"pointToUniform",value:function(e,t){var r=this;if(ye(e instanceof E),ye(t>>>0===t),this.z.isZero()||this.b.isZero())throw new Error("Not implemented.");if(e.isInfinity())throw new Error("Invalid point.");var f=(t>>>4&15)%this.torsion.length,i=e.add(this.torsion[f]);return be(function(){if(!r.a.isZero())return r._sswui(i,t);if(!r.c.isZero())return r._svdwi(i,t);throw new Error("Not implemented.")})}},{key:"mulAll",value:function(e,t){return f(h(r.prototype),"mulAll",this).call(this,e,t).toP()}},{key:"affinizeAll",value:function(e){for(var t=this.normalizeAll(e),r=0;r<t.length;r++)t[r]=t[r].toP();return t}},{key:"decodePoint",value:function(e){return E.decode(this,e)}},{key:"encodeX",value:function(e){return ye(e instanceof x),e.encodeX()}},{key:"decodeEven",value:function(e){return E.decodeEven(this,e)}},{key:"decodeSquare",value:function(e){return E.decodeSquare(this,e)}},{key:"toShort",value:function(e,t){var f=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=l(this._short(e,t),2),n=i[0],o=i[1],s=new r({red:this.red,prime:this.prime,p:this.p,a:n,b:o,n:this.n,h:this.h});if(null!=f){var d=l(s._scale(this),2)[1];d.redIsOdd()!==f&&d.redINeg()}this.g.isInfinity()||(s.g=s.pointFromShort(this.g));for(var u=0;u<this.h.word(0);u++)s.torsion[u]=s.pointFromShort(this.torsion[u]);return s}},{key:"toMont",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,f=l(this._mont(e,t),2),i=f[0],n=f[1],o=new P({red:this.red,prime:this.prime,p:this.p,a:i,b:n,n:this.n,h:this.h});if(null!=r){var s=l(this._scale(o),2)[1];s.redIsOdd()!==r&&s.redINeg()}this.g.isInfinity()||(o.g=o.pointFromShort(this.g));for(var d=0;d<this.h.word(0);d++)o.torsion[d]=o.pointFromShort(this.torsion[d]);return o}},{key:"toEdwards",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,f=l(this._edwards(e,t),2),i=f[0],n=f[1],o=new Z({red:this.red,prime:this.prime,p:this.p,a:i,d:n,n:this.n,h:this.h});if(null!=r){var s=l(this._scale(o),2)[1];s.redIsOdd()!==r&&s.redINeg()}if(this.g.isInfinity()||(o.g=o.pointFromShort(this.g),o.g.normalize()),o.isComplete())for(var d=0;d<this.h.word(0);d++)o.torsion[d]=o.pointFromShort(this.torsion[d]),o.torsion[d].normalize();return o}},{key:"pointFromJSON",value:function(e){return E.fromJSON(this,e)}},{key:"toJSON",value:function(e){var t=f(h(r.prototype),"toJSON",this).call(this,e);return t.a=this.a.fromRed().toJSON(),t.b=this.b.fromRed().toJSON(),this.c.isZero()||(t.c=this.c.fromRed().toJSON()),t}}],[{key:"_isomorphism",value:function(e,t,r,f){if(ye(e instanceof M),ye(t instanceof M),ye(r instanceof M),ye(null==f||"boolean"==typeof f),ye(!e.isZero()||!t.isZero()),r.isZero())throw new Error("Invalid coefficient.");if(e.isZero()){var i=r;return ye(1===we(i.redDiv(t)).redJacobi()),[e.clone(),i.clone()]}if(t.isZero()){var n=r,o=n.redDiv(e).redSqrt();if(1!==o.redJacobi()&&o.redINeg(),1!==o.redJacobi())throw new Error("Invalid `a` coefficient.");return[n.clone(),t.clone()]}var s=r,d=s.redDiv(e),u=d.redSqrt();if(null!=f?u.redIsOdd()!==f&&u.redINeg():1!==u.redJacobi()&&u.redINeg(),1!==u.redJacobi())throw new Error("Invalid `a` coefficient.");var a=d.redMul(u),h=e.redMul(d),l=t.redMul(a);return ye(h.eq(s)),[h,l]}}]),r}(),E=function(t){n(i,x);var r=s(i);function i(e,t,f){var n;return S(this,i),ye(e instanceof O),(n=r.call(this,e,N.AFFINE)).x=n.curve.zero,n.y=n.curve.zero,n.inf=!0,null!=t&&n._init(t,f),n}return I(i,[{key:"_init",value:function(e,t){ye(e instanceof M),ye(t instanceof M),this.x=e,this.y=t,this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1}},{key:"_getBeta",value:function(){var e=this;if(!this.curve.endo)return null;if(this.pre&&this.pre.beta)return this.pre.beta;var t=this.x.redMul(this.curve.endo.beta),r=this.curve.point(t,this.y);return this.pre&&(r.pre=this.pre.map(function(t){var r=t.x.redMul(e.curve.endo.beta);return e.curve.point(r,t.y)}),this.pre.beta=r),r}},{key:"_getJNAF",value:function(e){if(ye(e instanceof i),this.inf||e.inf)return f(h(i.prototype),"_getJNAF",this).call(this,e);var t=[this,null,null,e];return this.y.eq(e.y)?(t[1]=this.add(e),t[2]=this.toJ().sub(e)):this.y.eq(e.y.redNeg())?(t[1]=this.toJ().add(e),t[2]=this.sub(e)):(t[1]=this.toJ().add(e),t[2]=this.toJ().sub(e)),t}},{key:"clone",value:function(){return this.inf?this.curve.point():this.curve.point(this.x,this.y)}},{key:"scale",value:function(e){return this.toJ().scale(e)}},{key:"neg",value:function(){return this.inf?this:this.curve.point(this.x,this.y.redNeg())}},{key:"add",value:function(e){if(ye(e instanceof i),this.inf)return e;if(e.inf)return this;if(this.x.eq(e.x))return this.y.eq(e.y)?this.dbl():this.curve.point();if(this.y.eq(e.y)){var t=this.x.redNeg().redISub(e.x),r=this.y.redNeg();return this.curve.point(t,r)}var f=this.x.redSub(e.x),n=this.y.redSub(e.y).redDiv(f),o=n.redSqr().redISub(this.x).redISub(e.x),s=n.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)}},{key:"dbl",value:function(){if(this.inf)return this;if(this.y.isZero())return this.curve.point();var e=this.x.redSqr().redIMuln(3).redIAdd(this.curve.a),t=this.y.redMuln(2),r=e.redDiv(t),f=r.redSqr().redISub(this.x).redISub(this.x),i=r.redMul(this.x.redSub(f)).redISub(this.y);return this.curve.point(f,i)}},{key:"dblp",value:function(e){return this.toJ().dblp(e).toP()}},{key:"getX",value:function(){if(this.inf)throw new Error("Invalid point.");return this.x.fromRed()}},{key:"getY",value:function(){if(this.inf)throw new Error("Invalid point.");return this.y.fromRed()}},{key:"eq",value:function(e){return ye(e instanceof i),this===e||(this.inf?e.inf:!e.inf&&(this.x.eq(e.x)&&this.y.eq(e.y)))}},{key:"cmp",value:function(e){return ye(e instanceof i),this.inf&&!e.inf?-1:!this.inf&&e.inf?1:this.inf&&e.inf?0:this.order().cmp(e.order())||this.getX().cmp(e.getX())||this.getY().cmp(e.getY())}},{key:"isInfinity",value:function(){return this.inf}},{key:"isOrder2",value:function(){return!this.inf&&this.y.isZero()}},{key:"isOdd",value:function(){return!this.inf&&this.y.redIsOdd()}},{key:"isEven",value:function(){return!this.inf&&this.y.redIsEven()}},{key:"isSquare",value:function(){return!this.inf&&-1!==this.y.redJacobi()}},{key:"eqX",value:function(e){return ye(e instanceof M),ye(!e.red),!this.inf&&this.getX().eq(e)}},{key:"eqR",value:function(e){return ye(e instanceof M),ye(!e.red),ye(!this.curve.n.isZero()),!this.inf&&this.getX().imod(this.curve.n).eq(e)}},{key:"mul",value:function(e){return f(h(i.prototype),"mul",this).call(this,e).toP()}},{key:"muln",value:function(e){return f(h(i.prototype),"muln",this).call(this,e).toP()}},{key:"mulBlind",value:function(e,t){return f(h(i.prototype),"mulBlind",this).call(this,e,t).toP()}},{key:"mulAdd",value:function(e,t,r){return f(h(i.prototype),"mulAdd",this).call(this,e,t,r).toP()}},{key:"mulH",value:function(){return f(h(i.prototype),"mulH",this).call(this).toP()}},{key:"div",value:function(e){return f(h(i.prototype),"div",this).call(this,e).toP()}},{key:"divn",value:function(e){return f(h(i.prototype),"divn",this).call(this,e).toP()}},{key:"divH",value:function(){return f(h(i.prototype),"divH",this).call(this).toP()}},{key:"toP",value:function(){return this}},{key:"toJ",value:function(){return this.inf?this.curve.jpoint():this.curve.jpoint(this.x,this.y,this.curve.one)}},{key:"encode",value:function(t){null==t&&(t=!0),ye("boolean"==typeof t);var r=this.curve.fieldSize;if(this.inf)throw new Error("Invalid point.");if(t){var f=e.alloc(1+r),i=this.curve.encodeField(this.getX());return f[0]=2|this.y.redIsOdd(),i.copy(f,1),f}var n=e.alloc(1+2*r),o=this.curve.encodeField(this.getX()),s=this.curve.encodeField(this.getY());return n[0]=4,o.copy(n,1),s.copy(n,1+r),n}},{key:"encodeX",value:function(){return this.curve.encodeField(this.getX())}},{key:"toJSON",value:function(e){if(this.inf)return[];var t=this.getX().toJSON(),r=this.getY().toJSON();return!0===e&&this.pre?[t,r,this.pre.toJSON()]:[t,r]}},{key:"toPretty",value:function(){if(this.inf)return[];var e=2*this.curve.fieldSize;return[ge(this.getX(),e),ge(this.getY(),e)]}},{key:g,value:function(){return this.inf?"<ShortPoint: Infinity>":"<ShortPoint: x="+this.x.fromRed().toString(16,2)+" y="+this.y.fromRed().toString(16,2)+">"}}],[{key:"decode",value:function(t,r){ye(t instanceof O),ye(e.isBuffer(r));var f=t.fieldSize;if(r.length<1+f)throw new Error("Not a point.");var i=r[0];switch(i){case 2:case 3:if(r.length!==1+f)throw new Error("Invalid point size for compressed.");var n=t.decodeField(r.slice(1,1+f));if(n.cmp(t.p)>=0)throw new Error("Invalid point.");var o=t.pointFromX(n,3===i);return ye(!o.isInfinity()),o;case 4:case 6:case 7:if(r.length!==1+2*f)throw new Error("Invalid point size for uncompressed.");var s=t.decodeField(r.slice(1,1+f)),d=t.decodeField(r.slice(1+f,1+2*f));if(s.cmp(t.p)>=0||d.cmp(t.p)>=0)throw new Error("Invalid point.");if(4!==i&&i!==(6|d.isOdd()))throw new Error("Invalid hybrid encoding.");var u=t.point(s,d);if(!u.validate())throw new Error("Invalid point.");return ye(!u.isInfinity()),u;default:throw new Error("Unknown point format.")}}},{key:"decodeEven",value:function(e,t){ye(e instanceof O);var r=e.decodeField(t);if(r.cmp(e.p)>=0)throw new Error("Invalid point.");return e.pointFromX(r,!1)}},{key:"decodeSquare",value:function(e,t){ye(e instanceof O);var r=e.decodeField(t);if(r.cmp(e.p)>=0)throw new Error("Invalid point.");return e.pointFromX(r)}},{key:"fromJSON",value:function(e,t){if(ye(e instanceof O),ye(Array.isArray(t)),ye(0===t.length||2===t.length||3===t.length),0===t.length)return e.point();var r=M.fromJSON(t[0]),f=M.fromJSON(t[1]),i=e.point(r,f);return t.length>2&&null!=t[2]&&(i.pre=X.fromJSON(i,t[2])),i}}]),i}(),J=function(e){n(r,x);var t=s(r);function r(e,f,i,n){var o;return S(this,r),ye(e instanceof O),(o=t.call(this,e,N.JACOBIAN)).x=o.curve.one,o.y=o.curve.one,o.z=o.curve.zero,o.zOne=!1,null!=f&&o._init(f,i,n),o}return I(r,[{key:"_init",value:function(e,t,r){ye(e instanceof M),ye(t instanceof M),ye(null==r||r instanceof M),this.x=e,this.y=t,this.z=r||this.curve.one,this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z.eq(this.curve.one)}},{key:"clone",value:function(){return this.curve.jpoint(this.x,this.y,this.z)}},{key:"validate",value:function(){var e=this.curve,t=e.a,r=e.b;if(this.isInfinity())return!0;if(this.zOne)return this.curve.validate(this.toP());var f=this.y.redSqr(),i=this.x.redSqr().redMul(this.x),n=this.z.redSqr(),o=n.redSqr(),s=o.redMul(n),d=i.redIAdd(r.redMul(s));return this.curve.zeroA||(this.curve.threeA?d.redIAdd(o.redIMuln(-3).redMul(this.x)):d.redIAdd(t.redMul(o).redMul(this.x))),f.eq(d)}},{key:"normalize",value:function(){if(this.zOne)return this;if(this.isInfinity())return this;var e=this.z.redInvert(),t=e.redSqr();return this.x=this.x.redMul(t),this.y=this.y.redMul(t).redMul(e),this.z=this.curve.one,this.zOne=!0,this}},{key:"scale",value:function(e){if(ye(e instanceof M),this.isInfinity())return this.curve.jpoint();var t=e.redSqr(),r=this.x.redMul(t),f=this.y.redMul(t).redMul(e),i=this.z.redMul(e);return this.curve.jpoint(r,f,i)}},{key:"neg",value:function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)}},{key:"add",value:function(e){return ye(e instanceof x),e.type===N.AFFINE?this._mixedAdd(e):this._add(e)}},{key:"_add",value:function(e){return ye(e instanceof r),this.isInfinity()?e:e.isInfinity()?this:this.zOne?e._addJA(this):e.zOne?this._addJA(e):this._addJJ(e)}},{key:"_mixedAdd",value:function(e){return ye(e instanceof E),this.isInfinity()?e.toJ():e.isInfinity()?this:this._addJA(e)}},{key:"_addJJ",value:function(e){var t=this.z.redSqr(),r=e.z.redSqr(),f=this.x.redMul(r),i=e.x.redMul(t),n=this.y.redMul(e.z).redMul(r),o=e.y.redMul(this.z).redMul(t),s=i.redISub(f),d=o.redISub(n);if(s.isZero())return d.isZero()?this.dbl():this.curve.jpoint();var u=s.redSqr(),a=s.redMul(u),h=f.redMul(u),l=d.redSqr().redISub(a).redISub(h).redISub(h),c=d.redMul(h.redISub(l)).redISub(n.redMul(a)),v=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(l,c,v)}},{key:"_addJA",value:function(e){var t=this.z.redSqr(),r=e.x.redMul(t),f=e.y.redMul(this.z).redMul(t),i=r.redISub(this.x),n=f.redISub(this.y).redIMuln(2);if(i.isZero())return n.isZero()?this.dbl():this.curve.jpoint();var o=i.redMuln(2).redSqr(),s=i.redMul(o),d=this.x.redMul(o),u=n.redSqr().redISub(s).redISub(d).redISub(d),a=n.redMul(d.redISub(u)).redISub(this.y.redMul(s).redIMuln(2)),h=this.z.redMul(i).redIMuln(2);return this.curve.jpoint(u,a,h)}},{key:"dbl",value:function(){return this.isInfinity()?this:this.y.isZero()?this.curve.jpoint():this.curve.zeroA?this._dbl0():this.curve.threeA?this._dbl3():this._dblJ()}},{key:"_dblJ",value:function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr(),f=this.x.redMul(t).redIMuln(4),i=e.redIMuln(3).redIAdd(this.curve.a.redMul(r.redSqr())),n=i.redSqr().redISub(f).redISub(f),o=n,s=i.redMul(f.redISub(n)).redISub(t.redSqr().redIMuln(8)),d=this.y.redMul(this.z).redIMuln(2);return this.curve.jpoint(o,s,d)}},{key:"_dbl0",value:function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=t.redSqr(),f=t.redIAdd(this.x).redSqr().redISub(e).redISub(r).redIMuln(2),i=e.redIMuln(3),n=i.redSqr().redISub(f).redISub(f),o=i.redMul(f.redISub(n)).redISub(r.redIMuln(8)),s=this.y.redMul(this.z).redIMuln(2);return this.curve.jpoint(n,o,s)}},{key:"_dbl3",value:function(){var e=this.z.redSqr(),t=this.y.redSqr(),r=this.x.redMul(t),f=this.x.redSub(e),i=this.x.redAdd(e),n=f.redMul(i).redIMuln(3),o=r.redIMuln(4),s=o.redMuln(2),d=t.redSqr().redIMuln(8),u=n.redSqr().redISub(s),a=this.y.redAdd(this.z).redSqr().redISub(t).redISub(e),h=n.redMul(o.redISub(u)).redISub(d);return this.curve.jpoint(u,h,a)}},{key:"getX",value:function(){if(this.isInfinity())throw new Error("Invalid point.");return this.normalize(),this.x.fromRed()}},{key:"getY",value:function(){if(this.isInfinity())throw new Error("Invalid point.");return this.normalize(),this.y.fromRed()}},{key:"eq",value:function(e){if(ye(e instanceof r),this===e)return!0;if(this.isInfinity())return e.isInfinity();if(e.isInfinity())return!1;if(this.z.eq(e.z))return this.x.eq(e.x)&&this.y.eq(e.y);var t=this.z.redSqr(),f=e.z.redSqr(),i=this.x.redMul(f),n=e.x.redMul(t);if(!i.eq(n))return!1;var o=t.redMul(this.z),s=f.redMul(e.z),d=this.y.redMul(s),u=e.y.redMul(o);return d.eq(u)}},{key:"cmp",value:function(e){ye(e instanceof r);var t=this.isInfinity(),f=e.isInfinity();return t&&!f?-1:!t&&f?1:t&&f?0:this.order().cmp(e.order())||this.getX().cmp(e.getX())||this.getY().cmp(e.getY())}},{key:"isInfinity",value:function(){return this.z.isZero()}},{key:"isOrder2",value:function(){return!this.isInfinity()&&this.y.isZero()}},{key:"isOdd",value:function(){return!this.isInfinity()&&(this.normalize(),this.y.redIsOdd())}},{key:"isEven",value:function(){return!this.isInfinity()&&(this.normalize(),this.y.redIsEven())}},{key:"isSquare",value:function(){return!this.isInfinity()&&-1!==this.y.redMul(this.z).redJacobi()}},{key:"eqX",value:function(e){if(ye(e instanceof M),ye(!e.red),this.isInfinity())return!1;var t=this.z.redSqr(),r=e.toRed(this.curve.red).redMul(t);return this.x.eq(r)}},{key:"eqR",value:function(e){if(ye(e instanceof M),ye(!e.red),!this.curve.smallGap)return this.toP().eqR(e);if(this.isInfinity())return!1;if(e.cmp(this.curve.p)>=0)return!1;var t=this.z.redSqr(),r=e.toRed(this.curve.red).redMul(t);if(this.x.eq(r))return!0;if(this.curve.highOrder)return!1;if(e.cmp(this.curve.pmodn)>=0)return!1;var f=this.curve.redN.redMul(t);return r.redIAdd(f),this.x.eq(r)}},{key:"toP",value:function(){return this.isInfinity()?this.curve.point():(this.normalize(),this.curve.point(this.x,this.y))}},{key:"toJ",value:function(){return this}},{key:"encode",value:function(e){return this.toP().encode(e)}},{key:"encodeX",value:function(){return this.toP().encodeX()}},{key:"toJSON",value:function(e){return this.toP().toJSON(e)}},{key:"toPretty",value:function(){return this.toP().toPretty()}},{key:g,value:function(){return this.isInfinity()?"<JPoint: Infinity>":"<JPoint: x="+this.x.fromRed().toString(16,2)+" y="+this.y.fromRed().toString(16,2)+" z="+this.z.fromRed().toString(16,2)+">"}}],[{key:"decode",value:function(e,t){return E.decode(e,t).toJ()}},{key:"decodeEven",value:function(e,t){return E.decodeEven(e,t).toJ()}},{key:"decodeSquare",value:function(e,t){return E.decodeSquare(e,t).toJ()}},{key:"fromJSON",value:function(e,t){return E.fromJSON(e,t).toJ()}}]),r}(),P=function(e){n(r,_);var t=s(r);function r(e){var f;return S(this,r),(f=t.call(this,R,"mont",e)).a=M.fromJSON(e.a).toRed(f.red),f.b=M.fromJSON(e.b).toRed(f.red),f.bi=f.b.redInvert(),f.a2=f.a.redAdd(f.two),f.a24=f.a2.redMul(f.i4),f.a3=f.a.redMul(f.i3),f.a0=f.a.redMul(f.bi),f.b0=f.bi.redSqr(),f._finalize(e),f}return I(r,[{key:"_short",value:function(e,t){var r=this.a,f=this.b,i=this.three,n=r.redSqr(),o=n.redMul(r),s=f.redSqr(),d=s.redMul(f),u=i.redSub(n),a=s.redMuln(3),h=o.redMuln(2).redISub(r.redMuln(9)),l=d.redMuln(27),c=u.redDiv(a),v=h.redDiv(l);return null!=e?O._isomorphism(c,v,e,t):[c,v]}},{key:"_mont",value:function(e){return r._isomorphism(this.a,this.b,e)}},{key:"_edwards",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];ye("boolean"==typeof t);var r=this.two,f=this.bi,i=this.a.redAdd(r).redMul(f),n=this.a.redSub(r).redMul(f);return t&&i.swap(n),null!=e?Z._isomorphism(i,n,e):[i,n]}},{key:"_scaleShort",value:function(e){ye(e instanceof O);var t=l(e._scale(this),2),r=t[0],f=t[1];return[this.field(r.redInvert()),this.field(f.redInvert())]}},{key:"_scaleMont",value:function(e){return ye(e instanceof r),this.g.isInfinity()||e.g.isInfinity()?this.field(e.b).redDivSqrt(this.b):this.g.y.redDiv(this.field(e.g.y))}},{key:"_scaleEdwards",value:function(e,t){ye(e instanceof Z);var r=e._scale(this,t);return this.field(r)}},{key:"_solveY0",value:function(e){ye(e instanceof M);var t=this.a0,r=this.b0,f=e.redSqr();return f.redMul(e).redIAdd(t.redMul(f)).redIAdd(r.redMul(e))}},{key:"_elligator2",value:function(e){var t=this.a0.redNeg(),r=this.one.redAdd(this.z.redMul(e.redSqr()));r.isZero()&&r.inject(this.one);var f=t.redMul(r.redInvert()),i=f.redNeg().redISub(this.a0),n=this._solveY0(f),o=this._solveY0(i),s=0|n.redIsSquare(),d=[f,i][1^s],u=[n,o][1^s].redSqrt();u.redIsOdd()!==e.redIsOdd()&&u.redINeg();var a=this.b.redMul(d),h=this.b.redMul(u);return this.point(a,h)}},{key:"_invert2",value:function(e,t){var r=e.x,f=e.y,i=1&t,n=r.redMul(this.bi),o=f.redMul(this.bi),s=n.redAdd(this.a0),d=n,u=[s,d][i].redINeg(),a=[d,s][i].redMul(this.z),h=u.redDivSqrt(a);return h.redIsOdd()!==o.redIsOdd()&&h.redINeg(),h}},{key:"isElliptic",value:function(){var e=this.a.redSqr();return!this.b.redMul(e.redSub(this.four)).isZero()}},{key:"jinv",value:function(){var e=this.a,t=this.three,r=this.four,f=e.redSqr(),i=f.redSub(t).redPown(3).redIMuln(256),n=f.redSub(r);if(n.isZero())throw new Error("Curve is not elliptic.");return i.redDiv(n).fromRed()}},{key:"point",value:function(e,t){return new R(this,e,t)}},{key:"jpoint",value:function(e,t,r){return ye(null==e&&null==t&&null==r),this.point()}},{key:"xpoint",value:function(e,t){return new F(this,e,t)}},{key:"solveY2",value:function(e){ye(e instanceof M);var t=e.redSqr();return t.redMul(e).redIAdd(this.a.redMul(t)).redIAdd(e).redMul(this.bi)}},{key:"validate",value:function(e){if(ye(e instanceof R),e.isInfinity())return!0;var t=e.x,r=e.y,f=this.solveY2(t);return r.redSqr().eq(f)}},{key:"pointFromX",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;ye(e instanceof M),ye(null==t||"boolean"==typeof t),e.red||(e=e.toRed(this.red));var r=this.solveY(e);if(null!=t){if(r.isZero()&&t)throw new Error("Invalid point.");r.redIsOdd()!==t&&r.redINeg()}return this.point(e,r)}},{key:"isIsomorphic",value:function(e,t){if(ye(e instanceof _),!e.p.eq(this.p))return!1;if("mont"===e.type){var r=this.field(e.a),f=this.field(e.b);return!!this.a.eq(r)&&(!this.b.isZero()&&1===f.redDiv(this.b).redJacobi())}return e.isIsomorphic(this,t)}},{key:"isIsogenous",value:function(e){return ye(e instanceof _),"mont"!==e.type&&e.isIsogenous(this)}},{key:"pointFromShort",value:function(e){if(ye(e instanceof E),this.isIsomorphic(e.curve)){if(e.isInfinity())return this.point();var t=this.a3,r=this.b,f=l(this._scale(e.curve),2),i=f[0],n=f[1],o=this.field(e.x).redMul(i),s=this.field(e.y).redMul(n),d=r.redMul(o).redISub(t),u=r.redMul(s);return this.point(d,u)}throw new Error("Not implemented.")}},{key:"pointFromMont",value:function(e){if(ye(e instanceof R),this.isIsomorphic(e.curve)){if(e.isInfinity())return this.point();var t=this._scale(e.curve),r=this.field(e.x),f=this.field(e.y),i=r,n=t.redMul(f);return this.point(i,n)}throw new Error("Not implemented.")}},{key:"pointFromEdwards",value:function(e){ye(e instanceof j),ye(e.curve.p.eq(this.p));var t=this.field(e.x),r=this.field(e.y),f=this.field(e.z);if(this.isIsogenous(e.curve)){if(e.isInfinity())return this.point();if(e.x.isZero())return this.point(this.zero,this.zero);var i=f.redSqr().redIMuln(2),n=r.redSqr(),o=t.redSqr(),s=i.redISub(o).redISub(n).redMul(r),d=o.redMul(t);return this.cpoint(n,o,s,d)}if(this.isIsomorphic(e.curve,!0)){if(e.isInfinity())return this.point();if(e.x.isZero())return this.point(this.zero,this.zero);var u=this._scale(e.curve,!0),a=r.redAdd(f),h=r.redSub(f),l=u.redMul(f).redMul(a),c=t.redMul(h);return this.cpoint(a,h,l,c)}if(this.isIsomorphic(e.curve,!1)){if(e.isInfinity())return this.point();if(e.x.isZero())return this.point(this.zero,this.zero);var v=this._scale(e.curve,!1),y=f.redAdd(r),b=f.redSub(r),p=v.redMul(f).redMul(y),m=t.redMul(b);return this.cpoint(y,b,p,m)}throw new Error("Not implemented.")}},{key:"pointFromUniform",value:function(e){if(ye(e instanceof M),this.z.isZero()||this.a.isZero())throw new Error("Not implemented.");return this._elligator2(e)}},{key:"pointToUniform",value:function(e,t){var r=this;if(ye(e instanceof R),ye(t>>>0===t),this.z.isZero()||this.a.isZero())throw new Error("Not implemented.");if(e.isInfinity())throw new Error("Invalid point.");var f=(t>>>4&15)%this.torsion.length,i=e.add(this.torsion[f]);return be(function(){return r._invert2(i,t)})}},{key:"decodePoint",value:function(e,t){return R.decode(this,e,t)}},{key:"encodeX",value:function(e){return ye(e instanceof F),e.encode()}},{key:"decodeX",value:function(e){return F.decode(this,e)}},{key:"toShort",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,f=l(this._short(e,t),2),i=f[0],n=f[1],o=new O({red:this.red,prime:this.prime,p:this.p,a:i,b:n,n:this.n,h:this.h});if(null!=r){var s=l(o._scale(this),2)[1];s.redIsOdd()!==r&&s.redINeg()}this.g.isInfinity()||(o.g=o.pointFromMont(this.g));for(var d=0;d<this.h.word(0);d++)o.torsion[d]=o.pointFromMont(this.torsion[d]);return o}},{key:"toMont",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,f=l(this._mont(e),2),i=f[0],n=f[1],o=new r({red:this.red,prime:this.prime,p:this.p,a:i,b:n,n:this.n,h:this.h,z:this.z});if(null!=t){var s=o._scale(this);s.redIsOdd()!==t&&s.redINeg()}this.g.isInfinity()||(o.g=o.pointFromMont(this.g));for(var d=0;d<this.h.word(0);d++)o.torsion[d]=o.pointFromMont(this.torsion[d]);return o}},{key:"toEdwards",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,f=l(this._edwards(e,t),2),i=f[0],n=f[1],o=new Z({red:this.red,prime:this.prime,p:this.p,a:i,d:n,n:this.n,h:this.h,z:this.z});if(null!=r){var s=o._scale(this,t);s.redIsOdd()!==r&&s.redINeg()}if(this.g.isInfinity()||(o.g=o.pointFromMont(this.g),o.g.normalize()),o.isComplete())for(var d=0;d<this.h.word(0);d++)o.torsion[d]=o.pointFromMont(this.torsion[d]),o.torsion[d].normalize();return o}},{key:"pointFromJSON",value:function(e){return R.fromJSON(this,e)}},{key:"toJSON",value:function(e){var t=f(h(r.prototype),"toJSON",this).call(this,e);return t.a=this.a.fromRed().toJSON(),t.b=this.b.fromRed().toJSON(),t}}],[{key:"_isomorphism",value:function(e,t,r){ye(e instanceof M),ye(t instanceof M),ye(r instanceof M);var f=e.clone(),i=r.clone();if(1!==t.redDiv(r).redJacobi())throw new Error("Invalid `b` coefficient.");return[f,i]}}]),r}(),R=function(e){n(r,x);var t=s(r);function r(e,f,i){var n;return S(this,r),ye(e instanceof P),(n=t.call(this,e,N.AFFINE)).x=n.curve.zero,n.y=n.curve.zero,n.inf=!0,null!=f&&n._init(f,i),n}return I(r,[{key:"_init",value:function(e,t){ye(e instanceof M),ye(t instanceof M),this.x=e,this.y=t,this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1}},{key:"clone",value:function(){return this.inf?this.curve.point():this.curve.point(this.x,this.y)}},{key:"scale",value:function(e){return this.clone()}},{key:"randomize",value:function(e){return this.clone()}},{key:"neg",value:function(){return this.inf?this:this.curve.point(this.x,this.y.redNeg())}},{key:"add",value:function(e){if(ye(e instanceof r),this.inf)return e;if(e.inf)return this;if(this.x.eq(e.x))return this.y.eq(e.y)?this.dbl():this.curve.point();var t=e.x.redSub(this.x),f=e.y.redSub(this.y).redDiv(t),i=this.curve.b.redMul(f.redSqr()).redISub(this.curve.a).redISub(this.x).redISub(e.x),n=f.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,n)}},{key:"dbl",value:function(){if(this.inf)return this;if(this.y.isZero())return this.curve.point();var e=this.x.redSqr().redIMuln(3),t=this.curve.a.redMul(this.x).redIMuln(2),r=e.redIAdd(t).redIAdd(this.curve.one),f=this.curve.b.redMul(this.y).redIMuln(2),i=r.redDiv(f),n=this.curve.b.redMul(i.redSqr()).redISub(this.curve.a).redISub(this.x).redISub(this.x),o=i.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,o)}},{key:"getX",value:function(){if(this.inf)throw new Error("Invalid point.");return this.x.fromRed()}},{key:"getY",value:function(){if(this.inf)throw new Error("Invalid point.");return this.y.fromRed()}},{key:"eq",value:function(e){return ye(e instanceof r),this===e||(this.inf?e.inf:!e.inf&&(this.x.eq(e.x)&&this.y.eq(e.y)))}},{key:"cmp",value:function(e){return ye(e instanceof r),this.inf&&!e.inf?-1:!this.inf&&e.inf?1:this.inf&&e.inf?0:this.order().cmp(e.order())||this.getX().cmp(e.getX())||this.getY().cmp(e.getY())}},{key:"isInfinity",value:function(){return this.inf}},{key:"isOrder2",value:function(){return!this.inf&&this.y.isZero()}},{key:"isOdd",value:function(){return!this.inf&&this.y.redIsOdd()}},{key:"isEven",value:function(){return!this.inf&&this.y.redIsEven()}},{key:"toP",value:function(){return this}},{key:"toJ",value:function(){return this}},{key:"toX",value:function(){return this.inf?this.curve.xpoint():this.curve.xpoint(this.x,this.curve.one)}},{key:"encode",value:function(){return this.toX().encode()}},{key:"toJSON",value:function(e){return this.inf?[]:[this.getX().toJSON(),this.getY().toJSON()]}},{key:"toPretty",value:function(){if(this.inf)return[];var e=2*this.curve.fieldSize;return[ge(this.getX(),e),ge(this.getY(),e)]}},{key:g,value:function(){return this.inf?"<MontPoint: Infinity>":"<MontPoint: x="+this.x.fromRed().toString(16,2)+" y="+this.y.fromRed().toString(16,2)+">"}}],[{key:"decode",value:function(e,t,r){return ye(e instanceof P),e.decodeX(t).toP(r)}},{key:"fromJSON",value:function(e,t){if(ye(e instanceof P),ye(Array.isArray(t)),ye(0===t.length||2===t.length||3===t.length),0===t.length)return e.point();var r=M.fromJSON(t[0]),f=M.fromJSON(t[1]);return e.point(r,f)}}]),r}(),F=function(e){n(r,x);var t=s(r);function r(e,f,i){var n;return S(this,r),ye(e instanceof P),(n=t.call(this,e,N.PROJECTIVE)).x=n.curve.one,n.z=n.curve.zero,null!=f&&n._init(f,i),n}return I(r,[{key:"_init",value:function(e,t){ye(e instanceof M),ye(null==t||t instanceof M),this.x=e,this.z=t||this.curve.one,this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red))}},{key:"clone",value:function(){return this.curve.xpoint(this.x,this.z)}},{key:"precompute",value:function(e,t){return this}},{key:"validate",value:function(){if(this.isInfinity())return!0;var e=this.x,t=this.z,r=e.redSqr(),f=r.redMul(e),i=t.redSqr(),n=this.curve.a.redMul(r).redMul(t);return-1!==f.redIAdd(n).redIAdd(e.redMul(i)).redMul(this.curve.bi).redMul(t).redJacobi()}},{key:"normalize",value:function(){return this.isInfinity()?this:this.z.eq(this.curve.one)?this:(this.x=this.x.redDiv(this.z),this.z=this.curve.one,this)}},{key:"scale",value:function(e){if(ye(e instanceof M),this.isInfinity())return this.curve.xpoint();var t=this.x.redMul(e),r=this.z.redMul(e);return this.curve.xpoint(t,r)}},{key:"neg",value:function(){return this}},{key:"dbl",value:function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),f=e.redMul(t),i=r.redMul(t.redIAdd(this.curve.a24.redMul(r)));return this.curve.xpoint(f,i)}},{key:"diffAddDbl",value:function(e,t){ye(e instanceof r),ye(t instanceof r);var f=e.x.redAdd(e.z),i=f.redSqr(),n=e.x.redSub(e.z),o=n.redSqr(),s=i.redSub(o),d=t.x.redAdd(t.z),u=t.x.redSub(t.z).redMul(f),a=d.redMul(n),h=this.z.redMul(u.redAdd(a).redSqr()),l=this.x.redMul(u.redISub(a).redSqr()),c=i.redMul(o),v=s.redMul(o.redIAdd(this.curve.a24.redMul(s)));return[this.curve.xpoint(c,v),this.curve.xpoint(h,l)]}},{key:"getX",value:function(){if(this.isInfinity())throw new Error("Invalid point.");return this.normalize(),this.x.fromRed()}},{key:"getY",value:function(e){return this.toP(e).getY()}},{key:"eq",value:function(e){if(ye(e instanceof r),this===e)return!0;if(this.isInfinity())return e.isInfinity();if(e.isInfinity())return!1;if(this.z.eq(e.z))return this.x.eq(e.x);var t=this.x.redMul(e.z),f=e.x.redMul(this.z);return t.eq(f)}},{key:"cmp",value:function(e){ye(e instanceof r);var t=this.isInfinity(),f=e.isInfinity();return t&&!f?-1:!t&&f?1:t&&f?0:this.order().cmp(e.order())||this.getX().cmp(e.getX())}},{key:"isInfinity",value:function(){return this.z.isZero()}},{key:"isOrder2",value:function(){return!this.isInfinity()&&this.x.isZero()}},{key:"isOdd",value:function(){return!1}},{key:"isEven",value:function(){return!1}},{key:"hasTorsion",value:function(){return!this.isInfinity()&&(!!this.x.isZero()||f(h(r.prototype),"hasTorsion",this).call(this))}},{key:"order",value:function(){try{return this.toP().order()}catch(e){return new M(1)}}},{key:"jmul",value:function(e){ye(e instanceof M),ye(!e.red);for(var t=e.bitLength(),r=this.curve.xpoint(),f=this,i=t-1;i>=0;i--){if(0===e.bit(i)){var n=l(this.diffAddDbl(r,f),2);r=n[0],f=n[1]}else{var o=l(this.diffAddDbl(f,r),2);f=o[0],r=o[1]}}return r}},{key:"jmulBlind",value:function(e,t){return t?this.randomize(t).jmul(e):this.jmul(e)}},{key:"jmulAdd",value:function(e,t,r){throw new Error("Not implemented.")}},{key:"toP",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return ye(null==e||"boolean"==typeof e),this.isInfinity()?this.curve.point():(this.normalize(),this.curve.pointFromX(this.x,e))}},{key:"toJ",value:function(){return this}},{key:"toX",value:function(){return this}},{key:"key",value:function(){if(this.isInfinity())return"".concat(this.curve.uid,":oo");this.normalize();var e=this.getX().toString(16);return"".concat(this.curve.uid,":").concat(e)}},{key:"encode",value:function(){return this.curve.encodeField(this.getX())}},{key:"toJSON",value:function(e){return this.toP().toJSON(e)}},{key:"toPretty",value:function(){return this.toP().toPretty()}},{key:g,value:function(){return this.isInfinity()?"<XPoint: Infinity>":"<XPoint: x="+this.x.fromRed().toString(16,2)+" z="+this.z.fromRed().toString(16,2)+">"}}],[{key:"decode",value:function(e,t){ye(e instanceof P);var r=e.decodeField(t);r.iumaskn(e.fieldBits);var f=e.xpoint(r,e.one);return ye(!f.isInfinity()),f}},{key:"fromJSON",value:function(e,t){return R.fromJSON(e,t).toX()}}]),r}(),Z=function(e){n(r,_);var t=s(r);function r(e){var f;return S(this,r),(f=t.call(this,j,"edwards",e)).a=M.fromJSON(e.a).toRed(f.red),f.d=M.fromJSON(e.d).toRed(f.red),f.s=M.fromJSON(e.s||"0").toRed(f.red),f.si=f.s.isZero()?f.zero:f.s.redInvert(),f.k=f.d.redMuln(2),f.smi=-f.d.redNeg().word(0),f.ad6=f.a.redAdd(f.d).redMul(f.i6),f.twisted=!f.a.eq(f.one),f.oneA=f.a.eq(f.one),f.mOneA=f.a.eq(f.one.redNeg()),f.smallD=null!=f.prime&&1===f.d.redNeg().length,f.alt=null,f._finalize(e),f}return I(r,[{key:"_short",value:function(e,t){var r=this.a,f=this.d,i=r.redSqr(),n=i.redMul(r),o=f.redSqr(),s=o.redMul(f),d=r.redMul(f).redIMuln(14),u=i.redMul(f),a=r.redMul(o),h=u.redIAdd(a).redIMuln(33),l=i.redAdd(d).redIAdd(o).redDivn(-48),c=h.redISub(n).redISub(s).redDivn(864);return null!=e?O._isomorphism(l,c,e,t):[l,c]}},{key:"_mont",value:function(e){var t,r,f=arguments.length>1&&void 0!==arguments[1]&&arguments[1];ye("boolean"==typeof f),f?(t=this.d.redAdd(this.a),r=this.d.redSub(this.a)):(t=this.a.redAdd(this.d),r=this.a.redSub(this.d));var i=r.redInvert(),n=t.redMuln(2).redMul(i),o=i.redMuln(4);return null!=e?P._isomorphism(n,o,e):[n,o]}},{key:"_edwards",value:function(e){return r._isomorphism(this.a,this.d,e)}},{key:"_scaleShort",value:function(e){ye(e instanceof O);var t=l(e._scale(this),2),r=t[0],f=t[1];return[this.field(r.redInvert()),this.field(f.redInvert())]}},{key:"_scaleMont",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(ye(e instanceof P),ye("boolean"==typeof t),this.g.isInfinity()||e.g.isInfinity()){var r=l(e._edwards(null,t),1)[0];return this.field(r).redDivSqrt(this.a)}var f=e.g.x.redDiv(e.g.y);return this.g.x.redDiv(this.field(f))}},{key:"_scaleEdwards",value:function(e){return ye(e instanceof r),this.g.isInfinity()||e.g.isInfinity()?this.field(e.a).redDivSqrt(this.a):this.g.x.redDiv(this.field(e.g.x))}},{key:"_mulA",value:function(e){return ye(e instanceof M),this.oneA?e.clone():this.mOneA?e.redNeg():this.a.redMul(e)}},{key:"_mulD",value:function(e){return ye(e instanceof M),this.smallD?e.redMuln(this.smi):this.d.redMul(e)}},{key:"_elligator1",value:function(e){var t=this.s,r=this.si,f=this.i2,i=this.one,n=this.two,o=r.redSqr().redIMuln(2),s=t.redSqr().redMul(f),d=s.redSqr(),u=o.redAdd(s),a=u.redSqr().redISub(n),h=o.redSub(i),l=i.redSub(e),c=i.redAdd(e),v=c.isZero()?c:l.redDiv(c),y=v.redSqr(),b=y.redMul(v),p=b.redMul(y).redAdd(a.redMul(b)).redIAdd(v),m=this.field(p.redJacobi()),S=this.field(y.redAdd(d).redJacobi()),w=m.redMul(S),I=m.redMul(v),k=m.redMul(p).redSqrt().redMul(w),g=i.redAdd(I),M=u.redMul(I),N=g.redSqr(),z=h.redMul(t).redMul(I).redMul(g),A=v.isZero()?this.one:k,q=M.redSub(N),_=M.redAdd(N);return this.cpoint(z,A,q,_)}},{key:"_invert1",value:function(e,t){var r=this.s,f=this.si,i=this.i2,n=this.one,o=e.x,s=e.y,d=e.z,u=1&t,a=f.redSqr().redIMuln(2),h=r.redSqr().redMul(i),l=h.redSqr(),c=a.redAdd(h),v=a.redSub(n),y=s.redSub(d),b=s.redAdd(d).redIMuln(2),p=b.isZero()?b:y.redDiv(b),m=n.redAdd(p.redMul(c)),S=m.redSqr().redISub(n).redSqrt().redSub(m),w=n.redAdd(S),I=v.redMul(r).redMul(S).redMul(w).redMul(o.redMul(d)),k=S.redSqr().redIAdd(l),g=this.field(I.redMul(k).redJacobi()).redMul(S),M=n.redSub(g),N=n.redAdd(g),z=N.isZero()?N:M.redDiv(N);return z.redIsOdd()!==Boolean(u)&&z.redINeg(),z}},{key:"_alt",value:function(){return this.alt||(this.alt=this.toMont()),this.alt}},{key:"isElliptic",value:function(){var e=this.a.redMul(this.d),t=this.a.redSub(this.d);return!e.redMul(t).isZero()}},{key:"jinv",value:function(){var e=this.a,t=this.d,r=e.redMul(t),f=e.redSub(t).redPown(4),i=e.redSqr(),n=t.redSqr(),o=i.redAdd(r.redMuln(14)).redIAdd(n).redPown(3).redIMuln(16),s=r.redMul(f);if(s.isZero())throw new Error("Curve is not elliptic.");return o.redDiv(s).fromRed()}},{key:"isComplete",value:function(){return 1===this.a.redJacobi()&&-1===this.d.redJacobi()}},{key:"point",value:function(e,t,r,f){return new j(this,e,t,r,f)}},{key:"jpoint",value:function(e,t,r){return ye(null==e&&null==t&&null==r),this.point()}},{key:"cpoint",value:function(e,t,r,f){ye(e instanceof M),ye(t instanceof M),ye(r instanceof M),ye(f instanceof M);var i=e.redMul(f),n=r.redMul(t),o=t.redMul(f),s=e.redMul(r);return this.point(i,n,o,s)}},{key:"solveX2",value:function(e){ye(e instanceof M);var t=e.redSqr(),r=this._mulD(t).redISub(this.a);return t.redISub(this.one).redDiv(r)}},{key:"solveX",value:function(e){var t=e.redSqr(),r=this._mulD(t).redISub(this.a);return t.redISub(this.one).redDivSqrt(r)}},{key:"solveY2",value:function(e){ye(e instanceof M);var t=e.redSqr(),r=this._mulA(t).redISub(this.one),f=this._mulD(t).redISub(this.one);return r.redDiv(f)}},{key:"solveY",value:function(e){var t=e.redSqr(),r=this._mulA(t).redISub(this.one),f=this._mulD(t).redISub(this.one);return r.redDivSqrt(f)}},{key:"validate",value:function(e){if(ye(e instanceof j),e.zOne){var t=e.x.redSqr(),r=e.y.redSqr(),f=this._mulD(t).redMul(r),i=this._mulA(t).redIAdd(r),n=this.one.redAdd(f),o=e.t,s=e.x.redMul(e.y);return i.eq(n)&&o.eq(s)}var d=e.x.redSqr(),u=e.y.redSqr(),a=e.z.redSqr(),h=a.redSqr(),l=this._mulD(d).redMul(u),c=this._mulA(d).redIAdd(u).redMul(a),v=h.redIAdd(l),y=e.t.redMul(e.z),b=e.x.redMul(e.y);return c.eq(v)&&y.eq(b)}},{key:"pointFromX",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;ye(e instanceof M),ye(null==t||"boolean"==typeof t),e.red||(e=e.toRed(this.red));var r=this.solveY(e);if(null!=t){if(r.isZero()&&t)throw new Error("Invalid point.");r.redIsOdd()!==t&&r.redINeg()}return this.point(e,r)}},{key:"pointFromY",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;ye(e instanceof M),ye(null==t||"boolean"==typeof t),e.red||(e=e.toRed(this.red));var r=this.solveX(e);if(null!=t){if(r.isZero()&&t)throw new Error("Invalid point.");r.redIsOdd()!==t&&r.redINeg()}return this.point(r,e)}},{key:"isIsomorphic",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(ye(e instanceof _),ye("boolean"==typeof t),!e.p.eq(this.p))return!1;if("short"===e.type)return e.isIsomorphic(this);if("mont"===e.type){var r,f,i=this.field(e.a);return t?(r=this.d.redAdd(this.a),f=this.d.redSub(this.a)):(r=this.a.redAdd(this.d),f=this.a.redSub(this.d)),i.redMul(f).eq(r.redIMuln(2))}if("edwards"===e.type){var n=this.field(e.a),o=this.field(e.d);return this.a.redMul(o).eq(n.redMul(this.d))}return!1}},{key:"isIsogenous",value:function(e){if(ye(e instanceof _),!e.p.eq(this.p))return!1;if("mont"===e.type){if(!this.a.eq(this.one))return!1;var t=this.field(e.a),r=this.field(e.b),f=this.two.redSub(this.d.redMuln(4));return t.eq(f)&&r.eq(this.one)}if("edwards"===e.type){var i=this.field(e.a),n=this.field(e.d);return i.eq(this.a.redNeg())&&n.eq(this.d.redSub(this.a))}return!1}},{key:"pointFromShort",value:function(e){if(ye(e instanceof E),this.isIsomorphic(e.curve)){if(e.isInfinity())return this.point();if(e.y.isZero())return this.point(this.zero,this.one.redNeg());var t=this.a,r=this.d,f=l(this._scale(e.curve),2),i=f[0],n=f[1],o=t.redMuln(5),s=r.redMuln(5),d=this.field(e.x).redMul(i),u=this.field(e.y).redMul(n),a=d.redMuln(6),h=d.redMuln(12),c=a.redSub(t).redISub(r),v=u.redMuln(6),y=h.redSub(o).redIAdd(r),b=h.redAdd(t).redISub(s);return this.cpoint(c,v,y,b)}throw new Error("Not implemented.")}},{key:"pointFromMont",value:function(e){ye(e instanceof R),ye(e.curve.p.eq(this.p));var t=this.field(e.x),r=this.field(e.y);if(this.isIsogenous(e.curve)){if(e.isInfinity())return this.point();if(e.x.isZero())return this.point();var f=t.redSqr(),i=f.redMul(t),n=i.redMul(t),o=n.redMul(t),s=r.redSqr(),d=r.redMuln(4),u=f.redSub(this.one),a=f.redMuln(2),h=s.redMuln(4),l=i.redIMuln(2),c=t.redMul(s).redIMuln(4),v=f.redMul(s).redIMuln(2),y=s.redIMuln(2),b=d.redMul(u),p=n.redISub(a).redIAdd(h).redIAdd(this.one),m=o.redSub(l).redISub(c).redIAdd(t).redINeg(),S=o.redISub(v).redISub(l).redISub(y).redIAdd(t);return this.cpoint(b,p,m,S).divn(4)}if(this.isIsomorphic(e.curve,!0)){if(e.isInfinity())return this.point();if(e.x.isZero())return this.point(this.zero,this.one.redNeg());var w=this._scale(e.curve,!0).redMul(t),I=r,k=t.redAdd(this.one),g=t.redSub(this.one);return this.cpoint(w,I,k,g)}if(this.isIsomorphic(e.curve,!1)){if(e.isInfinity())return this.point();if(e.x.isZero())return this.point(this.zero,this.one.redNeg());var M=this._scale(e.curve,!1).redMul(t),N=r,z=t.redSub(this.one),A=t.redAdd(this.one);return this.cpoint(M,N,z,A)}throw new Error("Not implemented.")}},{key:"pointFromEdwards",value:function(e){ye(e instanceof j),ye(e.curve.p.eq(this.p));var t=this.field(e.curve.a),r=this.field(e.x),f=this.field(e.y),i=this.field(e.z),n=this.field(e.t);if(this.isIsogenous(e.curve)){var o=r.redMul(f),s=r.redSqr(),d=f.redSqr(),u=i.redSqr(),a=t.redMul(s),h=o.redIMuln(2),l=d.redSub(a),c=d.redAdd(a),v=u.redIMuln(2).redISub(c),y=this.cpoint(h,l,c,v);return this.twisted?y:y.divn(4)}if(this.isIsomorphic(e.curve)){var b=this._scale(e.curve),p=b.redMul(r),m=f,S=i,w=b.redMul(n);return this.point(p,m,S,w)}throw new Error("Not implemented.")}},{key:"pointFromUniform",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;ye(e instanceof M),ye(e.red===this.red),ye(null==t||t instanceof P),t||(t=this._alt());var r=t.field(e),f=t.pointFromUniform(r);return this.pointFromMont(f)}},{key:"pointToUniform",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;ye(e instanceof j),ye(t>>>0===t),ye(null==r||r instanceof P),r||(r=this._alt());var f=(t>>4&15)%this.torsion.length,i=e.add(this.torsion[f]),n=r.pointFromEdwards(i),o=r.pointToUniform(n,15&t);return this.field(o)}},{key:"pointFromHash",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;ye(null==r||r instanceof P),r||(r=this._alt());var f=r.pointFromHash(e,t);return this.pointFromMont(f)}},{key:"pointToHash",value:function(e,t,r){var f=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;ye(e instanceof j),ye(t>>>0===t),ye(null==f||f instanceof P),f||(f=this._alt());var i=t%this.torsion.length,n=e.add(this.torsion[i]),o=f.pointFromEdwards(n);return f.pointToHash(o,0,r)}},{key:"decodePoint",value:function(e){return j.decode(this,e)}},{key:"toShort",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,f=l(this._short(e,t),2),i=f[0],n=f[1],o=new O({red:this.red,prime:this.prime,p:this.p,a:i,b:n,n:this.n,h:this.h});if(null!=r){var s=l(o._scale(this),2)[1];s.redIsOdd()!==r&&s.redINeg()}this.g.isInfinity()||(o.g=o.pointFromEdwards(this.g));for(var d=0;d<this.h.word(0);d++)o.torsion[d]=o.pointFromEdwards(this.torsion[d]);return o}},{key:"toMont",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,f=l(this._mont(e,t),2),i=f[0],n=f[1],o=new P({red:this.red,prime:this.prime,p:this.p,a:i,b:n,n:this.n,h:this.h,z:this.z});if(null!=r){var s=this._scale(o,t);s.redIsOdd()!==r&&s.redINeg()}this.g.isInfinity()||(o.g=o.pointFromEdwards(this.g));for(var d=0;d<this.h.word(0);d++)o.torsion[d]=o.pointFromEdwards(this.torsion[d]);return o}},{key:"toEdwards",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,f=l(this._edwards(e),2),i=f[0],n=f[1],o=new r({red:this.red,prime:this.prime,p:this.p,a:i,d:n,n:this.n,h:this.h,z:this.z});if(null!=t){var s=o._scale(this);s.redIsOdd()!==t&&s.redINeg()}if(this.g.isInfinity()||(o.g=o.pointFromEdwards(this.g),o.g.normalize()),o.isComplete())for(var d=0;d<this.h.word(0);d++)o.torsion[d]=o.pointFromEdwards(this.torsion[d]),o.torsion[d].normalize();return o}},{key:"pointFromJSON",value:function(e){return j.fromJSON(this,e)}},{key:"toJSON",value:function(e){var t=f(h(r.prototype),"toJSON",this).call(this,e);return t.a=this.a.fromRed().toJSON(),t.d=this.d.fromRed().toJSON(),this.s.isZero()||(t.s=this.s.fromRed().toJSON()),t}}],[{key:"_isomorphism",value:function(e,t,r){ye(e instanceof M),ye(t instanceof M),ye(r instanceof M);var f=r.clone(),i=r.redMul(t).redDiv(e);if(1!==e.redDiv(r).redJacobi())throw new Error("Invalid `a` coefficient.");return[f,i]}}]),r}(),j=function(e){n(r,x);var t=s(r);function r(e,f,i,n,o){var s;return S(this,r),ye(e instanceof Z),(s=t.call(this,e,N.EXTENDED)).x=s.curve.zero,s.y=s.curve.one,s.z=s.curve.one,s.t=s.curve.zero,s.zOne=!0,null!=f&&s._init(f,i,n,o),s}return I(r,[{key:"_init",value:function(e,t,r,f){ye(e instanceof M),ye(t instanceof M),ye(null==r||r instanceof M),ye(null==f||f instanceof M),this.x=e,this.y=t,this.z=r||this.curve.one,this.t=f||null,this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z.eq(this.curve.one),this._check(),this.t||(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redDiv(this.z)))}},{key:"_check",value:function(){if(this.z.isZero())throw new Error("Invalid point.")}},{key:"clone",value:function(){return this.curve.point(this.x,this.y,this.z,this.t)}},{key:"normalize",value:function(){if(this.zOne)return this;var e=this.z.redInvert();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t=this.t.redMul(e),this.z=this.curve.one,this.zOne=!0,this}},{key:"scale",value:function(e){ye(e instanceof M);var t=this.x.redMul(e),r=this.y.redMul(e),f=this.z.redMul(e),i=this.t.redMul(e);return this.curve.point(t,r,f,i)}},{key:"neg",value:function(){var e=this.x.redNeg(),t=this.y,r=this.z,f=this.t.redNeg();return this.curve.point(e,t,r,f)}},{key:"add",value:function(e){return ye(e instanceof r),this.isInfinity()?e:e.isInfinity()?this:this.zOne?e._add(this):this._add(e)}},{key:"_add",value:function(e){return this.curve.mOneA?this._addM1(e):this._addA(e)}},{key:"_addM1",value:function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),f=this.t.redMul(this.curve.k).redMul(e.t),i=e.zOne?this.z.redAdd(this.z):this.z.redMul(e.z).redIMuln(2),n=r.redSub(t),o=i.redSub(f),s=i.redIAdd(f),d=r.redIAdd(t),u=n.redMul(o),a=s.redMul(d),h=n.redMul(d),l=o.redMul(s);return this.curve.point(u,a,l,h)}},{key:"_addA",value:function(e){var t=this.x.redMul(e.x),r=this.y.redMul(e.y),f=this.curve._mulD(this.t).redMul(e.t),i=e.zOne?this.z.clone():this.z.redMul(e.z),n=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(t).redISub(r),o=i.redSub(f),s=i.redIAdd(f),d=r.redISub(this.curve._mulA(t)),u=n.redMul(o),a=s.redMul(d),h=n.redMul(d),l=o.redMul(s);return this.curve.point(u,a,l,h)}},{key:"dbl",value:function(){return this.isInfinity()?this:this._dbl()}},{key:"_dbl",value:function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.zOne?this.curve.two:this.z.redSqr().redIMuln(2),f=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),n=f.redAdd(t),o=n.redSub(r),s=f.redISub(t),d=i.redMul(o),u=n.redMul(s),a=i.redMul(s),h=o.redMul(n);return this.curve.point(d,u,h,a)}},{key:"getX",value:function(){return this.normalize(),this.x.fromRed()}},{key:"getY",value:function(){return this.normalize(),this.y.fromRed()}},{key:"eq",value:function(e){if(ye(e instanceof r),ye(!this.z.isZero()),ye(!e.z.isZero()),this===e)return!0;if(this.z.eq(e.z))return this.x.eq(e.x)&&this.y.eq(e.y);var t=this.x.redMul(e.z),f=e.x.redMul(this.z);if(!t.eq(f))return!1;var i=this.y.redMul(e.z),n=e.y.redMul(this.z);return i.eq(n)}},{key:"cmp",value:function(e){return ye(e instanceof r),this.order().cmp(e.order())||this.getY().cmp(e.getY())||this.getX().cmp(e.getX())}},{key:"isInfinity",value:function(){return ye(!this.z.isZero()),!!this.x.isZero()&&this.y.eq(this.z)}},{key:"isOrder2",value:function(){return!this.isInfinity()&&this.x.isZero()}},{key:"isOdd",value:function(){return this.normalize(),this.x.redIsOdd()}},{key:"isEven",value:function(){return this.normalize(),this.x.redIsEven()}},{key:"toP",value:function(){return this.normalize()}},{key:"toJ",value:function(){return this}},{key:"encode",value:function(){var e=this.getY();return e.setn(this.curve.signBit,this.x.redIsOdd()),this.curve.encodeAdjusted(e)}},{key:"toJSON",value:function(e){if(this.isInfinity())return[];var t=this.getX().toJSON(),r=this.getY().toJSON();return!0===e&&this.pre?[t,r,this.pre.toJSON()]:[t,r]}},{key:"toPretty",value:function(){var e=2*this.curve.fieldSize;return[ge(this.getX(),e),ge(this.getY(),e)]}},{key:g,value:function(){return this.isInfinity()?"<EdwardsPoint: Infinity>":"<EdwardsPoint: x="+this.x.fromRed().toString(16,2)+" y="+this.y.fromRed().toString(16,2)+" z="+this.z.fromRed().toString(16,2)+">"}}],[{key:"decode",value:function(e,t){ye(e instanceof Z);var r=e.decodeAdjusted(t),f=0!==r.testn(e.signBit);if(r.setn(e.signBit,0),r.cmp(e.p)>=0)throw new Error("Invalid point.");return e.pointFromY(r,f)}},{key:"fromJSON",value:function(e,t){if(ye(e instanceof Z),ye(Array.isArray(t)),ye(0===t.length||2===t.length||3===t.length),0===t.length)return e.point();var r=M.fromJSON(t[0]),f=M.fromJSON(t[1]),i=e.point(r,f);return t.length>2&&null!=t[2]&&(i.pre=X.fromJSON(i,t[2])),i}}]),r}(),X=function(){function e(){S(this,e),this.naf=null,this.windows=null,this.doubles=null,this.blinding=null,this.beta=null}return I(e,[{key:"map",value:function(e){ye("function"==typeof e);var t=new this.constructor;return this.naf&&(t.naf=this.naf.map(e)),this.doubles&&(t.doubles=this.doubles.map(e)),t}},{key:"toJSON",value:function(){return{naf:this.naf?this.naf.toJSON():null,windows:this.windows?this.windows.toJSON():null,doubles:this.doubles?this.doubles.toJSON():null,blinding:this.blinding?this.blinding.toJSON():void 0}}},{key:"fromJSON",value:function(e,t){return ye(e instanceof x),ye(t&&"object"===m(t)),null!=t.naf&&(this.naf=D.fromJSON(e,t.naf)),null!=t.windows&&(this.windows=B.fromJSON(e,t.windows)),null!=t.doubles&&(this.doubles=Y.fromJSON(e,t.doubles)),null!=t.blinding&&(this.blinding=H.fromJSON(e,t.blinding)),this}}],[{key:"fromJSON",value:function(e,t){return(new this).fromJSON(e,t)}}]),e}(),D=function(){function e(t,r){S(this,e),this.width=t,this.points=r}return I(e,[{key:"map",value:function(e){ye("function"==typeof e);var t,f=this.width,i=[],n=r(this.points);try{for(n.s();!(t=n.n()).done;){var o=t.value;i.push(e(o))}}catch(s){n.e(s)}finally{n.f()}return new this.constructor(f,i)}},{key:"toJSON",value:function(){return{width:this.width,points:this.points.slice(1).map(function(e){return e.toJSON()})}}}],[{key:"fromJSON",value:function(e,t){ye(e instanceof x),ye(t&&"object"===m(t)),ye(t.width>>>0===t.width),ye(Array.isArray(t.points));var f,i=e.curve,n=t.width,o=[e],s=r(t.points);try{for(s.s();!(f=s.n()).done;){var d=f.value;o.push(i.pointFromJSON(d))}}catch(u){s.e(u)}finally{s.f()}return new this(n,o)}}]),e}(),B=function(){function e(t,r,f){S(this,e),this.width=t,this.bits=r,this.points=f}return I(e,[{key:"toJSON",value:function(){return{width:this.width,bits:this.bits,points:this.points.slice(1).map(function(e){return e.toJSON()})}}}],[{key:"fromJSON",value:function(e,t){ye(e instanceof x),ye(t&&"object"===m(t)),ye(t.width>>>0===t.width),ye(t.bits>>>0===t.bits),ye(Array.isArray(t.points));var f,i=e.curve,n=t.width,o=t.bits,s=[e],d=r(t.points);try{for(d.s();!(f=d.n()).done;){var u=f.value;s.push(i.pointFromJSON(u))}}catch(a){d.e(a)}finally{d.f()}return new this(n,o,s)}}]),e}(),Y=function(){function e(t,r){S(this,e),this.step=t,this.points=r}return I(e,[{key:"map",value:function(e){ye("function"==typeof e);var t,f=this.step,i=[],n=r(this.points);try{for(n.s();!(t=n.n()).done;){var o=t.value;i.push(e(o))}}catch(s){n.e(s)}finally{n.f()}return new this.constructor(f,i)}},{key:"toJSON",value:function(){return{step:this.step,points:this.points.slice(1).map(function(e){return e.toJSON()})}}}],[{key:"fromJSON",value:function(e,t){ye(e instanceof x),ye(t&&"object"===m(t)),ye(t.step>>>0===t.step),ye(Array.isArray(t.points));var f,i=e.curve,n=t.step,o=[e],s=r(t.points);try{for(s.s();!(f=s.n()).done;){var d=f.value;o.push(i.pointFromJSON(d))}}catch(u){s.e(u)}finally{s.f()}return new this(n,o)}}]),e}(),H=function(){function e(t,r){S(this,e),this.blind=t,this.unblind=r}return I(e,[{key:"toJSON",value:function(){return{blind:this.blind.toJSON(),unblind:this.unblind.toJSON()}}}],[{key:"fromJSON",value:function(e,t){ye(e instanceof x),ye(t&&"object"===m(t));var r=e.curve;return new this(M.fromJSON(t.blind),r.pointFromJSON(t.unblind))}}]),e}(),C=function(){function e(t,r,f,i){S(this,e),this.beta=t,this.lambda=r,this.basis=f,this.pre=i}return I(e,[{key:"toJSON",value:function(){return{beta:this.beta.fromRed().toJSON(),lambda:this.lambda.toJSON(),basis:[this.basis[0].toJSON(),this.basis[1].toJSON()],pre:[this.pre[0],this.pre[1].toJSON(),this.pre[2].toJSON()]}}}],[{key:"fromJSON",value:function(e,t){return ye(e instanceof _),ye(t&&"object"===m(t)),ye(Array.isArray(t.basis)),ye(Array.isArray(t.pre)),ye(2===t.basis.length),ye(3===t.pre.length),ye(t.pre[0]>>>0===t.pre[0]),new this(M.fromJSON(t.beta).toRed(e.red),M.fromJSON(t.lambda),[L.fromJSON(t.basis[0]),L.fromJSON(t.basis[1])],[t.pre[0],M.fromJSON(t.pre[1]),M.fromJSON(t.pre[2])])}}]),e}(),L=function(){function e(t,r){S(this,e),this.a=t,this.b=r}return I(e,[{key:"toJSON",value:function(){return{a:this.a.toJSON(),b:this.b.toJSON()}}}],[{key:"fromJSON",value:function(e){return ye(e&&"object"===m(e)),new this(M.fromJSON(e.a),M.fromJSON(e.b))}}]),e}(),T=function(e){n(r,O);var t=s(r);function r(e){return S(this,r),t.call(this,{id:"P192",ossl:"prime192v1",type:"short",endian:"be",hash:"SHA256",prime:"p192",p:["ffffffff ffffffff ffffffff fffffffe","ffffffff ffffffff"],a:["ffffffff ffffffff ffffffff fffffffe","ffffffff fffffffc"],b:["64210519 e59c80e7 0fa7e9ab 72243049","feb8deec c146b9b1"],n:["ffffffff ffffffff ffffffff 99def836","146bc9b1 b4d22831"],h:"1",z:"-5",g:[["188da80e b03090f6 7cbf20eb 43a18800","f4ff0afd 82ff1012"],["07192b95 ffc8da78 631011ed 6b24cdd5","73f977a1 1e794811"],e]})}return r}(),U=function(e){n(r,O);var t=s(r);function r(e){return S(this,r),t.call(this,{id:"P224",ossl:"secp224r1",type:"short",endian:"be",hash:"SHA256",prime:"p224",p:["ffffffff ffffffff ffffffff ffffffff","00000000 00000000 00000001"],a:["ffffffff ffffffff ffffffff fffffffe","ffffffff ffffffff fffffffe"],b:["b4050a85 0c04b3ab f5413256 5044b0b7","d7bfd8ba 270b3943 2355ffb4"],n:["ffffffff ffffffff ffffffff ffff16a2","e0b8f03e 13dd2945 5c5c2a3d"],h:"1",z:"1f",g:[["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3","56c21122 343280d6 115c1d21"],["bd376388 b5f723fb 4c22dfe6 cd4375a0","5a074764 44d58199 85007e34"],e]})}return r}(),W=function(e){n(r,O);var t=s(r);function r(e){return S(this,r),t.call(this,{id:"P256",ossl:"prime256v1",type:"short",endian:"be",hash:"SHA256",prime:null,p:["ffffffff 00000001 00000000 00000000","00000000 ffffffff ffffffff ffffffff"],a:["ffffffff 00000001 00000000 00000000","00000000 ffffffff ffffffff fffffffc"],b:["5ac635d8 aa3a93e7 b3ebbd55 769886bc","651d06b0 cc53b0f6 3bce3c3e 27d2604b"],n:["ffffffff 00000000 ffffffff ffffffff","bce6faad a7179e84 f3b9cac2 fc632551"],h:"1",z:"-a",g:[["6b17d1f2 e12c4247 f8bce6e5 63a440f2","77037d81 2deb33a0 f4a13945 d898c296"],["4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16","2bce3357 6b315ece cbb64068 37bf51f5"],e]})}return r}(),K=function(e){n(r,O);var t=s(r);function r(e){return S(this,r),t.call(this,{id:"P384",ossl:"secp384r1",type:"short",endian:"be",hash:"SHA384",prime:null,p:["ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff ffffffff fffffffe","ffffffff 00000000 00000000 ffffffff"],a:["ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff ffffffff fffffffe","ffffffff 00000000 00000000 fffffffc"],b:["b3312fa7 e23ee7e4 988e056b e3f82d19","181d9c6e fe814112 0314088f 5013875a","c656398d 8a2ed19d 2a85c8ed d3ec2aef"],n:["ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff c7634d81 f4372ddf","581a0db2 48b0a77a ecec196a ccc52973"],h:"1",z:"-c",g:[["aa87ca22 be8b0537 8eb1c71e f320ad74","6e1d3b62 8ba79b98 59f741e0 82542a38","5502f25d bf55296c 3a545e38 72760ab7"],["3617de4a 96262c6f 5d9e98bf 9292dc29","f8f41dbd 289a147c e9da3113 b5f0b8c0","0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"],e]})}return r}(),G=function(e){n(r,O);var t=s(r);function r(e){return S(this,r),t.call(this,{id:"P521",ossl:"secp521r1",type:"short",endian:"be",hash:"SHA512",prime:"p521",p:["000001ff ffffffff ffffffff ffffffff","ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff ffffffff ffffffff","ffffffff"],a:["000001ff ffffffff ffffffff ffffffff","ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff ffffffff ffffffff","fffffffc"],b:["00000051 953eb961 8e1c9a1f 929a21a0","b68540ee a2da725b 99b315f3 b8b48991","8ef109e1 56193951 ec7e937b 1652c0bd","3bb1bf07 3573df88 3d2c34f1 ef451fd4","6b503f00"],n:["000001ff ffffffff ffffffff ffffffff","ffffffff ffffffff ffffffff ffffffff","fffffffa 51868783 bf2f966b 7fcc0148","f709a5d0 3bb5c9b8 899c47ae bb6fb71e","91386409"],h:"1",z:"-4",g:[["000000c6 858e06b7 0404e9cd 9e3ecb66","2395b442 9c648139 053fb521 f828af60","6b4d3dba a14b5e77 efe75928 fe1dc127","a2ffa8de 3348b3c1 856a429b f97e7e31","c2e5bd66"],["00000118 39296a78 9a3bc004 5c8a5fb4","2c7d1bd9 98f54449 579b4468 17afbd17","273e662c 97ee7299 5ef42640 c550b901","3fad0761 353c7086 a272c240 88be9476","9fd16650"],e]})}return r}(),V=function(e){n(r,O);var t=s(r);function r(e){return S(this,r),t.call(this,{id:"SECP256K1",ossl:"secp256k1",type:"short",endian:"be",hash:"SHA256",prime:"k256",p:["ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff fffffffe fffffc2f"],a:"0",b:"7",n:["ffffffff ffffffff ffffffff fffffffe","baaedce6 af48a03b bfd25e8c d0364141"],h:"1",z:"1",c:["0a2d2ba9 3507f1df 233770c2 a797962c","c61f6d15 da14ecd4 7d8d27ae 1cd5f852"],g:[["79be667e f9dcbbac 55a06295 ce870b07","029bfcdb 2dce28d9 59f2815b 16f81798"],["483ada77 26a3c465 5da4fbfc 0e1108a8","fd17b448 a6855419 9c47d08f fb10d4b8"],e],endo:{beta:["7ae96a2b 657c0710 6e64479e ac3434e9","9cf04975 12f58995 c1396c28 719501ee"],lambda:["5363ad4c c05c30e0 a5261c02 8812645a","122e22ea 20816678 df02967c 1b23bd72"],basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],pre:[384,["3086d221 a7d46bcd e86c90e4 9284eb15","3daa8a14 71e8ca7f e893209a 45dbb031"],["-","e4437ed6 010e8828 6f547fa9 0abfe4c4","221208ac 9df506c6 1571b4ae 8ac47f71"]]}})}return r}(),$=function(e){n(r,O);var t=s(r);function r(e){return S(this,r),t.call(this,{id:"BRAINPOOLP256",ossl:"brainpoolP256r1",type:"short",endian:"be",hash:"SHA256",prime:null,p:["a9fb57db a1eea9bc 3e660a90 9d838d72","6e3bf623 d5262028 2013481d 1f6e5377"],a:["7d5a0975 fc2c3057 eef67530 417affe7","fb8055c1 26dc5c6c e94a4b44 f330b5d9"],b:["26dc5c6c e94a4b44 f330b5d9 bbd77cbf","95841629 5cf7e1ce 6bccdc18 ff8c07b6"],n:["a9fb57db a1eea9bc 3e660a90 9d838d71","8c397aa3 b561a6f7 901e0e82 974856a7"],h:"1",z:"-2",g:[["8bd2aeb9 cb7e57cb 2c4b482f fc81b7af","b9de27e1 e3bd23c2 3a4453bd 9ace3262"],["547ef835 c3dac4fd 97f8461a 14611dc9","c2774513 2ded8e54 5c1d54c7 2f046997"],e]})}return r}(),Q=function(e){n(r,O);var t=s(r);function r(e){return S(this,r),t.call(this,{id:"BRAINPOOLP384",ossl:"brainpoolP384r1",type:"short",endian:"be",hash:"SHA384",prime:null,p:["8cb91e82 a3386d28 0f5d6f7e 50e641df","152f7109 ed5456b4 12b1da19 7fb71123","acd3a729 901d1a71 87470013 3107ec53"],a:["7bc382c6 3d8c150c 3c72080a ce05afa0","c2bea28e 4fb22787 139165ef ba91f90f","8aa5814a 503ad4eb 04a8c7dd 22ce2826"],b:["04a8c7dd 22ce2826 8b39b554 16f0447c","2fb77de1 07dcd2a6 2e880ea5 3eeb62d5","7cb43902 95dbc994 3ab78696 fa504c11"],n:["8cb91e82 a3386d28 0f5d6f7e 50e641df","152f7109 ed5456b3 1f166e6c ac0425a7","cf3ab6af 6b7fc310 3b883202 e9046565"],h:"1",z:"-5",g:[["1d1c64f0 68cf45ff a2a63a81 b7c13f6b","8847a3e7 7ef14fe3 db7fcafe 0cbd10e8","e826e034 36d646aa ef87b2e2 47d4af1e"],["8abe1d75 20f9c2a4 5cb1eb8e 95cfd552","62b70b29 feec5864 e19c054f f9912928","0e464621 77918111 42820341 263c5315"],e]})}return r}(),ee=function(e){n(r,O);var t=s(r);function r(e){return S(this,r),t.call(this,{id:"BRAINPOOLP512",ossl:"brainpoolP512r1",type:"short",endian:"be",hash:"SHA512",prime:null,p:["aadd9db8 dbe9c48b 3fd4e6ae 33c9fc07","cb308db3 b3c9d20e d6639cca 70330871","7d4d9b00 9bc66842 aecda12a e6a380e6","2881ff2f 2d82c685 28aa6056 583a48f3"],a:["7830a331 8b603b89 e2327145 ac234cc5","94cbdd8d 3df91610 a83441ca ea9863bc","2ded5d5a a8253aa1 0a2ef1c9 8b9ac8b5","7f1117a7 2bf2c7b9 e7c1ac4d 77fc94ca"],b:["3df91610 a83441ca ea9863bc 2ded5d5a","a8253aa1 0a2ef1c9 8b9ac8b5 7f1117a7","2bf2c7b9 e7c1ac4d 77fc94ca dc083e67","984050b7 5ebae5dd 2809bd63 8016f723"],n:["aadd9db8 dbe9c48b 3fd4e6ae 33c9fc07","cb308db3 b3c9d20e d6639cca 70330870","553e5c41 4ca92619 41866119 7fac1047","1db1d381 085ddadd b5879682 9ca90069"],h:"1",z:"7",g:[["81aee4bd d82ed964 5a21322e 9c4c6a93","85ed9f70 b5d916c1 b43b62ee f4d0098e","ff3b1f78 e2d0d48d 50d1687b 93b97d5f","7c6d5047 406a5e68 8b352209 bcb9f822"],["7dde385d 566332ec c0eabfa9 cf7822fd","f209f700 24a57b1a a000c55b 881f8111","b2dcde49 4a5f485e 5bca4bd8 8a2763ae","d1ca2b2f a8f05406 78cd1e0f 3ad80892"],e]})}return r}(),te=function(e){n(r,P);var t=s(r);function r(){return S(this,r),t.call(this,{id:"X25519",ossl:"X25519",type:"mont",endian:"le",hash:"SHA512",prime:"p25519",p:["7fffffff ffffffff ffffffff ffffffff","ffffffff ffffffff ffffffff ffffffed"],a:"76d06",b:"1",n:["10000000 00000000 00000000 00000000","14def9de a2f79cd6 5812631a 5cf5d3ed"],h:"8",z:"2",g:[["00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000009"],["5f51e65e 475f794b 1fe122d3 88b72eb3","6dc2b281 92839e4d d6163a5d 81312c14"]],torsion:[[],[["00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000"],["00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000"]],[["00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000001"],["6be4f497 f9a9c2af c21fa77a d7f4a6ef","635a11c7 284a9363 e9a248ef 9c884415"]],[["00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000001"],["141b0b68 06563d50 3de05885 280b5910","9ca5ee38 d7b56c9c 165db710 6377bbd8"]],[["57119fd0 dd4e22d8 868e1c58 c45c4404","5bef839c 55b1d0b1 248c50a3 bc959c5f"],["68c59389 3d458e64 31c6ca00 45fb5015","20a44346 8eaa68dd 0f103842 048065b7"]],[["57119fd0 dd4e22d8 868e1c58 c45c4404","5bef839c 55b1d0b1 248c50a3 bc959c5f"],["173a6c76 c2ba719b ce3935ff ba04afea","df5bbcb9 71559722 f0efc7bd fb7f9a36"]],[["00b8495f 16056286 fdb1329c eb8d09da","6ac49ff1 fae35616 aeb8413b 7c7aebe0"],["3931c129 569e83a5 29482c14 e628b457","933bfc29 ed801b4d 68871483 92507b1a"]],[["00b8495f 16056286 fdb1329c eb8d09da","6ac49ff1 fae35616 aeb8413b 7c7aebe0"],["46ce3ed6 a9617c5a d6b7d3eb 19d74ba8","6cc403d6 127fe4b2 9778eb7c 6daf84d3"]]]})}return r}(),re=function(e){n(r,P);var t=s(r);function r(){return S(this,r),t.call(this,{id:"X448",ossl:"X448",type:"mont",endian:"le",hash:"SHAKE256",prime:"p448",p:["ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff fffffffe ffffffff","ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff"],a:"262a6",b:"1",n:["3fffffff ffffffff ffffffff ffffffff","ffffffff ffffffff ffffffff 7cca23e9","c44edb49 aed63690 216cc272 8dc58f55","2378c292 ab5844f3"],h:"4",z:"-1",g:[["00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000","00000000 00000005"],["7d235d12 95f5b1f6 6c98ab6e 58326fce","cbae5d34 f55545d0 60f75dc2 8df3f6ed","b8027e23 46430d21 1312c4b1 50677af7","6fd7223d 457b5b1a"]],torsion:[[],[["00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000","00000000 00000000"],["00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000","00000000 00000000"]],[["ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff fffffffe ffffffff","ffffffff ffffffff ffffffff ffffffff","ffffffff fffffffe"],["ba4d3a08 29b6112f 8812e51b a0bb2abe","bc1cb08e b48e5569 36ba50fd d2e7d68a","f8cb3216 0522425b 3f990812 abbe635a","d37a21e1 7551b193"]],[["ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff fffffffe ffffffff","ffffffff ffffffff ffffffff ffffffff","ffffffff fffffffe"],["45b2c5f7 d649eed0 77ed1ae4 5f44d541","43e34f71 4b71aa96 c945af01 2d182975","0734cde9 faddbda4 c066f7ed 54419ca5","2c85de1e 8aae4e6c"]]]})}return r}(),fe=function(e){n(r,P);var t=s(r);function r(){return S(this,r),t.call(this,{id:"MONT448",ossl:null,type:"mont",endian:"le",hash:"SHAKE256",prime:"p448",p:["ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff fffffffe ffffffff","ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff"],a:["b2cf97d2 d43459a9 31ed36b1 fc4e3cb5","5d93f8d2 22746997 60ccffc6 49961ed6","c5b05fca c24864ed 6fb59697 931b78da","84ddecd8 ca2b5cfb"],b:"1",n:["3fffffff ffffffff ffffffff ffffffff","ffffffff ffffffff ffffffff 7cca23e9","c44edb49 aed63690 216cc272 8dc58f55","2378c292 ab5844f3"],h:"4",z:"-1",g:[["ac0d24cc c6c75cb0 eb71f81e 7a6edf51","48e88aee 009a2a24 e795687e c28e125a","3e6730a6 0d46367b aa7fe99d 152128dc","41321bc7 7817f059"],["5a4437f6 80c0d0db 9b061276 d5d0ffcc","e786ff33 b6a53d30 98746425 82e66f09","4433dae7 7244a6e2 6b11e905 7228f483","556c41a5 913f55fe"]],torsion:[[],[["00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000","00000000 00000000"],["00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000","00000000 00000000"]],[["ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff fffffffe ffffffff","ffffffff ffffffff ffffffff ffffffff","ffffffff fffffffe"],["bec92fd0 6da2acf2 b4e261e8 7cef0d34","22e75c18 3c589857 b71924e5 73c2f9ce","e18da5f2 466e2f39 3c2eedf0 f105a60a","b40c717d 4f1e1fd7"]],[["ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff fffffffe ffffffff","ffffffff ffffffff ffffffff ffffffff","ffffffff fffffffe"],["4136d02f 925d530d 4b1d9e17 8310f2cb","dd18a3e7 c3a767a8 48e6db19 8c3d0631","1e725a0d b991d0c6 c3d1120f 0efa59f5","4bf38e82 b0e1e028"]]]})}return r}(),ie=function(e){n(r,Z);var t=s(r);function r(e){return S(this,r),t.call(this,{id:"ED25519",ossl:"ED25519",type:"edwards",endian:"le",hash:"SHA512",prefix:"SigEd25519 no Ed25519 collisions",context:!1,prime:"p25519",p:["7fffffff ffffffff ffffffff ffffffff","ffffffff ffffffff ffffffff ffffffed"],a:"-1",d:["52036cee 2b6ffe73 8cc74079 7779e898","00700a4d 4141d8ab 75eb4dca 135978a3"],n:["10000000 00000000 00000000 00000000","14def9de a2f79cd6 5812631a 5cf5d3ed"],h:"8",z:"2",g:[["216936d3 cd6e53fe c0a4e231 fdd6dc5c","692cc760 9525a7b2 c9562d60 8f25d51a"],["66666666 66666666 66666666 66666666","66666666 66666666 66666666 66666658"],e],torsion:[[["00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000"],["00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000001"]],[["00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000"],["7fffffff ffffffff ffffffff ffffffff","ffffffff ffffffff ffffffff ffffffec"]],[["2b832480 4fc1df0b 2b4d0099 3dfbd7a7","2f431806 ad2fe478 c4ee1b27 4a0ea0b0"],["00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000"]],[["547cdb7f b03e20f4 d4b2ff66 c2042858","d0bce7f9 52d01b87 3b11e4d8 b5f15f3d"],["00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000"]],[["1fd5b9a0 06394a28 e9339932 38de4abb","5c193c70 13e5e238 dea14646 c545d14a"],["05fc536d 880238b1 3933c6d3 05acdfd5","f098eff2 89f4c345 b027b2c2 8f95e826"]],[["602a465f f9c6b5d7 16cc66cd c721b544","a3e6c38f ec1a1dc7 215eb9b9 3aba2ea3"],["05fc536d 880238b1 3933c6d3 05acdfd5","f098eff2 89f4c345 b027b2c2 8f95e826"]],[["1fd5b9a0 06394a28 e9339932 38de4abb","5c193c70 13e5e238 dea14646 c545d14a"],["7a03ac92 77fdc74e c6cc392c fa53202a","0f67100d 760b3cba 4fd84d3d 706a17c7"]],[["602a465f f9c6b5d7 16cc66cd c721b544","a3e6c38f ec1a1dc7 215eb9b9 3aba2ea3"],["7a03ac92 77fdc74e c6cc392c fa53202a","0f67100d 760b3cba 4fd84d3d 706a17c7"]]]})}return r}(),ne=function(e){n(r,Z);var t=s(r);function r(e){return S(this,r),t.call(this,{id:"ISO448",ossl:null,type:"edwards",endian:"le",hash:"SHAKE256",prefix:"SigEd448",context:!0,prime:"p448",p:["ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff fffffffe ffffffff","ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff"],a:"1",d:["d78b4bdc 7f0daf19 f24f38c2 9373a2cc","ad461572 42a50f37 809b1da3 412a12e7","9ccc9c81 264cfe9a d0809970 58fb61c4","243cc32d baa156b9"],n:["3fffffff ffffffff ffffffff ffffffff","ffffffff ffffffff ffffffff 7cca23e9","c44edb49 aed63690 216cc272 8dc58f55","2378c292 ab5844f3"],h:"4",z:"-1",g:[["79a70b2b 70400553 ae7c9df4 16c792c6","1128751a c9296924 0c25a07d 728bdc93","e21f7787 ed697224 9de732f3 8496cd11","69871309 3e9c04fc"],["7fffffff ffffffff ffffffff ffffffff","ffffffff ffffffff ffffffff 80000000","00000000 00000000 00000000 00000000","00000000 00000001"],e],torsion:[[["00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000","00000000 00000000"],["00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000","00000000 00000001"]],[["00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000","00000000 00000000"],["ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff fffffffe ffffffff","ffffffff ffffffff ffffffff ffffffff","ffffffff fffffffe"]],[["00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000","00000000 00000001"],["00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000","00000000 00000000"]],[["ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff fffffffe ffffffff","ffffffff ffffffff ffffffff ffffffff","ffffffff fffffffe"],["00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000","00000000 00000000"]]]})}return r}(),oe=function(e){n(r,Z);var t=s(r);function r(e){return S(this,r),t.call(this,{id:"ED448",ossl:"ED448",type:"edwards",endian:"le",hash:"SHAKE256",prefix:"SigEd448",context:!0,prime:"p448",p:["ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff fffffffe ffffffff","ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff"],a:"1",d:["ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff fffffffe ffffffff","ffffffff ffffffff ffffffff ffffffff","ffffffff ffff6756"],n:["3fffffff ffffffff ffffffff ffffffff","ffffffff ffffffff ffffffff 7cca23e9","c44edb49 aed63690 216cc272 8dc58f55","2378c292 ab5844f3"],h:"4",z:"-1",g:[["4f1970c6 6bed0ded 221d15a6 22bf36da","9e146570 470f1767 ea6de324 a3d3a464","12ae1af7 2ab66511 433b80e1 8b00938e","2626a82b c70cc05e"],["693f4671 6eb6bc24 88762037 56c9c762","4bea7373 6ca39840 87789c1e 05a0c2d7","3ad3ff1c e67c39c4 fdbd132c 4ed7c8ad","9808795b f230fa14"],e],torsion:[[["00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000","00000000 00000000"],["00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000","00000000 00000001"]],[["00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000","00000000 00000000"],["ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff fffffffe ffffffff","ffffffff ffffffff ffffffff ffffffff","ffffffff fffffffe"]],[["00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000","00000000 00000001"],["00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000","00000000 00000000"]],[["ffffffff ffffffff ffffffff ffffffff","ffffffff ffffffff fffffffe ffffffff","ffffffff ffffffff ffffffff ffffffff","ffffffff fffffffe"],["00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000","00000000 00000000 00000000 00000000","00000000 00000000"]]]})}return r}(),se={__proto__:null,P192:T,P224:U,P256:W,P384:K,P521:G,SECP256K1:V,BRAINPOOLP256:$,BRAINPOOLP384:Q,BRAINPOOLP512:ee,X25519:te,X448:re,MONT448:fe,ED25519:ie,ISO448:ne,ED448:oe},de={__proto__:null,P192:null,P224:null,P256:null,P384:null,P521:null,SECP256K1:null,BRAINPOOLP256:null,BRAINPOOLP384:null,BRAINPOOLP512:null,X25519:null,X448:null,MONT448:null,ED25519:null,ISO448:null,ED448:null};function ue(e){ye("string"==typeof e);var r=e.toUpperCase(),f=de[r];if(!f){var i=se[r];if(!i)throw new Error('Curve not found: "'.concat(e,'".'));for(var n=arguments.length,o=new Array(n>1?n-1:0),s=1;s<n;s++)o[s-1]=arguments[s];f=t(i,o),de[r]=f}return f}function ae(e,t){ye("string"==typeof e),ye("function"==typeof t);var r=e.toUpperCase();if(se[r])throw new Error('Curve already registered: "'.concat(e,'".'));se[r]=t,de[r]=null}function he(e,t,r){ye(e instanceof M),ye(!e.red),ye(t>>>0===t),ye(r>>>0===r);var f=new Array(r),i=e.bitLength()+1,n=1|e.sign();ye(i<=r);for(var o=0;o<r;o++)f[o]=0;for(var s,d=0,u=0;d<i;)e.bit(d)!==u?(s=e.bits(d,t)+u,s-=(u=s>>t-1&1)<<t,f[d]=n*s,d+=t):d+=1;return ye(0===u),f}function le(e,t,r,f){ye(f>>>0===f);for(var i=he(e,t,r),n=Math.ceil(i.length/f),o=new Array(n),s=0,d=0;d<i.length;d+=f){for(var u=0,a=d+f-1;a>=d;a--)u=(u<<1)+i[a];o[s++]=u}return ye(s===n),o}function ce(e,t,r){ye(e instanceof M),ye(t instanceof M),ye(!e.red),ye(!t.red),ye(r>>>0===r);var f=[new Array(r),new Array(r)],i=Math.max(e.bitLength(),t.bitLength())+1,n=1|e.sign(),o=1|t.sign();ye(i<=r);for(var s=0,d=0,u=0;u<i;u++){var a=e.bits(u,3),h=t.bits(u,3),l=(3&a)+s&3,c=(3&h)+d&3,v=0,y=0;if(3===l&&(l=-1),3===c&&(c=-1),1&l){var b=(7&a)+s&7;v=3!==b&&5!==b||2!==c?l:-l}if(1&c){var p=(7&h)+d&7;y=3!==p&&5!==p||2!==l?c:-c}f[0][u]=v*n,f[1][u]=y*o,2*s===1+v&&(s=1-s),2*d===1+y&&(d=1-d)}for(var m=i;m<r;m++)f[0][m]=0,f[1][m]=0;return f}function ve(e,t,r){for(var f=ce(e,t,r),i=new Array(r),n=0;n<r;n++){var o=f[0][n],s=f[1][n];i[n]=z[3*(o+1)+(s+1)]}return i}function ye(e,t){if(!e){var r=new Error(t||"Assertion failed");throw Error.captureStackTrace&&Error.captureStackTrace(r,ye),r}}function be(e){ye("function"==typeof e);try{return e()}catch(t){if("X is not a square mod P."===t.message||"Not invertible."===t.message)throw new Error("Invalid point.");throw t}}function pe(e,t){var r=e%t;return r<0&&(t<0?r-=t:r+=t),r}function me(e){ye(e instanceof M),ye(e.red);var t=e.red.m;if(t.cmpn(3)<=0)return e.clone();if(2===t.modrn(3)){var r=t.ushln(1).isubn(1).idivn(3);return e.redPow(r)}var f=t.modrn(9);if(4===f){var i=t.ushln(1).iaddn(1).idivn(9),n=e.redPow(i);if(!n.redSqr().redMul(n).eq(e))throw new Error("X is not a cube mod P.");return n}if(7===f){var o=t.addn(2).idivn(9),s=e.redPow(o);if(!s.redSqr().redMul(s).eq(e))throw new Error("X is not a cube mod P.");return s}throw new Error("Not implemented.")}function Se(e){var t=me(e);if(1===e.red.m.modrn(3)){var r=new M(2).toRed(e.red),f=new M(3).toRed(e.red),i=r.redInvert(),n=f.redNeg().redSqrt().redMul(i),o=n.redNeg(),s=n.redSub(i),d=o.redSub(i),u=t.redMul(s),a=t.redMul(d);return[t,u,a]}return[t]}function we(e){var t,f=r(Se(e));try{for(f.s();!(t=f.n()).done;){var i=t.value;if(i.redJacobi()>=0)return i}}catch(n){f.e(n)}finally{f.f()}throw new Error("X^(1/3) is not a square mod P.")}function Ie(e){return M.randomBits(e,32).toNumber()}function ke(e,t){var r=new WeakMap;return function(f,i){var n=1&i,o=r.get(f);if(o&&null!==o[n])return o[n];var s=e.call(t,f,i);return r.has(f)||r.set(f,[null,null]),r.get(f)[n]=s,s}}function ge(e,t){ye(e instanceof M),ye(t>>>0===t),7&t&&(t+=8-(7&t));var r=e.toString(16,t),f=[],i=[];ye(0==(7&r.length));for(var n=0;n<r.length;n+=8)f.push(r.slice(n,n+8));for(var o=0;o<f.length;o+=4)i.push(f.slice(o,o+4).join(" "));return i}exports.Curve=_,exports.Point=x,exports.ShortCurve=O,exports.ShortPoint=E,exports.JPoint=J,exports.MontCurve=P,exports.MontPoint=R,exports.XPoint=F,exports.EdwardsCurve=Z,exports.EdwardsPoint=j,exports.curves=se,exports.curve=ue,exports.register=ae;
|
||
},{"../internal/custom":"7RpA","../bn":"vi+k","buffer":"z1tx"}],"B6m7":[function(require,module,exports) {
|
||
var global = arguments[3];
|
||
var Buffer = require("buffer").Buffer;
|
||
var e=arguments[3],r=require("buffer").Buffer,n=require("../internal/assert"),t=e.crypto||e.msCrypto,f=t&&"function"==typeof t.getRandomValues,o=f?t.getRandomValues.bind(t):null,a=new Uint32Array(16),u=65536,i=0;function l(e){n(e>>>0===e);var t=r.alloc(e);return b(t,0,e),t}function s(e,t,f){return n(r.isBuffer(e)),null==t&&(t=0),n(t>>>0===t),null==f&&(f=e.length-t),n(f>>>0===f),n(t+f<=e.length),b(e,t,f),e}function g(){return 0==(15&i)&&(y(a),i=0),a[i++]}function h(e,r){n(e>>>0===e),n(r>>>0===r),n(r>=e);var t=r-e;if(0===t)return e;var f,o,a=-t>>>0;do{o=(f=g())%t}while(f-o>a);return o+e}function y(e){if(!f)throw new Error("Entropy source not available.");return o(e)}function b(e,t,f){if(n(r.isBuffer(e)),n(e.buffer instanceof ArrayBuffer),n(e.byteOffset>>>0===e.byteOffset),n(e.byteLength>>>0===e.byteLength),n(t>>>0===t),n(f>>>0===f),n(t+f<=e.byteLength),f>Math.pow(2,31)-1)throw new RangeError('The value "size" is out of range.');var o=e.byteOffset+t,a=new Uint8Array(e.buffer,o,f);if(a.length>u)for(var i=0;i<a.length;i+=u){var l=i+u;l>a.length&&(l=a.length),y(a.subarray(i,l))}else a.length>0&&y(a)}exports.native=0,exports.randomBytes=l,exports.randomFill=s,exports.randomInt=g,exports.randomRange=h;
|
||
},{"../internal/assert":"TXc9","buffer":"z1tx"}],"XBiK":[function(require,module,exports) {
|
||
"use strict";module.exports=require("./js/random");
|
||
},{"./js/random":"B6m7"}],"ZfBm":[function(require,module,exports) {
|
||
var Buffer = require("buffer").Buffer;
|
||
var e=require("buffer").Buffer;function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function t(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function i(e,r){for(var t=0;t<r.length;t++){var i=r[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function n(e,r,t){return r&&i(e.prototype,r),t&&i(e,t),e}var u=require("../internal/assert"),o=require("../bn"),c=require("./elliptic"),a=require("../random"),d=function(){function i(e,r,n){t(this,i),u("string"==typeof e),u(!r||"string"==typeof r),this.id=e,this.type="ecdh",this.eid=r||null,this._pre=n||null,this._curve=null,this._edwards=null,this.native=0}return n(i,[{key:"curve",get:function(){return this._curve||(this._curve=c.curve(this.id)),this._curve}},{key:"edwards",get:function(){return this.eid&&!this._edwards&&(this._edwards=c.curve(this.eid,this._pre),this._edwards.precompute(a),this._pre=null),this._edwards}},{key:"size",get:function(){return this.curve.fieldSize}},{key:"bits",get:function(){return this.curve.fieldBits}},{key:"privateKeyGenerate",value:function(){var e=a.randomBytes(this.curve.scalarSize);return this.curve.clamp(e)}},{key:"privateKeyVerify",value:function(r){return u(e.isBuffer(r)),r.length===this.curve.scalarSize}},{key:"privateKeyExport",value:function(r,t){var i=this.publicKeyCreate(r),n=this.publicKeyExport(i,t),u=n.x,o=n.y;return{d:e.from(r),x:u,y:o}}},{key:"privateKeyImport",value:function(e){u(e&&"object"===r(e));var t=o.decode(e.d,this.curve.endian);if(t.byteLength()>this.curve.scalarSize)throw new Error("Invalid private key.");return this.curve.encodeScalar(t)}},{key:"publicKeyCreate",value:function(e){var r=this.curve.decodeClamped(e);if(this.edwards&&this.edwards.g.pre){var t=this.edwards.g.mulBlind(r);return this.curve.pointFromEdwards(t).encode()}return this.curve.g.toX().mulBlind(r,a).encode()}},{key:"publicKeyConvert",value:function(e,r){if(u(null==r||"boolean"==typeof r),!this.edwards)throw new Error("No equivalent edwards curve.");var t=this.curve.decodePoint(e),i=this.edwards.pointFromMont(t);return null!=r&&i.isOdd()!==r?i.neg().encode():i.encode()}},{key:"publicKeyFromUniform",value:function(e){var r=this.curve.decodeUniform(e);return this.curve.pointFromUniform(r).encode()}},{key:"publicKeyToUniform",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a.randomInt(),t=this.curve.decodePoint(e),i=this.curve.pointToUniform(t,r);return this.curve.encodeUniform(i,r>>>8)}},{key:"publicKeyFromHash",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.curve.pointFromHash(e,r).encode()}},{key:"publicKeyToHash",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a.randomInt(),t=this.curve.decodePoint(e);return this.curve.pointToHash(t,r,a)}},{key:"publicKeyVerify",value:function(r){var t;u(e.isBuffer(r));try{t=this.curve.decodeX(r)}catch(i){return!1}return t.validate()}},{key:"publicKeyIsSmall",value:function(r){var t;u(e.isBuffer(r));try{t=this.curve.decodeX(r)}catch(i){return!1}return!!t.validate()&&t.isSmall()}},{key:"publicKeyHasTorsion",value:function(r){var t;u(e.isBuffer(r));try{t=this.curve.decodeX(r)}catch(i){return!1}return!!t.validate()&&t.hasTorsion()}},{key:"publicKeyExport",value:function(e,r){var t=this.curve.decodePoint(e,r),i=t.x,n=t.y;return{x:this.curve.encodeField(i.fromRed()),y:this.curve.encodeField(n.fromRed())}}},{key:"publicKeyImport",value:function(e){u(e&&"object"===r(e));var t=o.decode(e.x,this.curve.endian);if(t.cmp(this.curve.p)>=0)throw new Error("Invalid point.");if(null!=e.y){var i=o.decode(e.y,this.curve.endian);if(i.cmp(this.curve.p)>=0)throw new Error("Invalid point.");var n=this.curve.point(t,i);if(!n.validate())throw new Error("Invalid point.");return n.encode()}return this.curve.pointFromX(t).encode()}},{key:"derive",value:function(e,r){var t=this.curve.decodeX(e),i=this.curve.decodeClamped(r);return t.mulBlind(i,a).encode()}}]),i}();module.exports=d;
|
||
},{"../internal/assert":"TXc9","../bn":"vi+k","./elliptic":"IvV+","../random":"XBiK","buffer":"z1tx"}],"lx0x":[function(require,module,exports) {
|
||
module.exports={naf:{width:9,points:[["67ae9c4a22928f491ff4ae743edac83a6343981981624886ac62485fd3f8e25c","1267b1d177ee69aba126a18e60269ef79f16ec176724030402c3684878f5b4d4"],["49fda73eade3587bfcef7cf7d12da5de5c2819f93e1be1a591409cc0322ef233","5f4825b298feae6fe02c6e148992466631282eca89430b5d10d21f83d676c8ed"],["14568685fcf4bd4ee9e3ee194b1d810783e809f3bbf1ce955855981af50e4107","31c563e32b47d52f87ce6468dd36ad41f0882b46f7abf23d12c4c4b59f4062b8"],["357cc970c80071651bf336e06f9422b886d80e5c2e4e0294d3e023065185715c","7f3d23c2c2dd0df4b2befce956f2d2fd1f789013236e4430c74e44845522f1c0"],["14e528b1154be417b6cf078dd6712438d381a5b2c593d552ff2fd2c1207cf3cb","2d9082313f21ab975a6f7ce340ff0fce1258591c3c9c58d4308f2dc36a033713"],["107427e0d5f366ccdb33adf0282d304f8843e3e88d22b7b83780e073b7c05fed","12dbb00ded538b7478466022d2da89b83740cfb2289a272387efe1aeea401f80"],["4f162deaec2ec435dc5ac6f95d20419ed9631374770189cb90617f3e66a18dc1","12cbfb2d04ff22f55162f70164d29331ace5af18a19a9aa1946d4cc4ad2e5cdf"],["7dc52d5a7db816e9b850741ea2fd72918d94985b85a20b4dc5597853a876df6a","6f6d2bca60003ef9f24ac245cc919fb717b188723b34f901cd6cfe9bec97be04"],["1d81f74a5ba45c7022e8c140d763b9c1b0e281a5304696e74f791a3a04a94472","3f185a93d95a4347227c5bb6ddd65cf42e1830823f435f3083fe6102691d55b9"],["6f0ac78e5eb90e87958588f9d47541edf252cb1dde3d073cc45e3e7ef9365716","6628d116b7975ae5f323e5ddf4f8cc35ae06d5c5c7d8a56effc66051336d289e"],["2188ac423c67db5625915e05222a391bcaf91f05d9b7cc2cab5798b2d2e14d95","23240c559c57b79a4df69a23fc46e50504277b1fa49369ab663d79782b33c0ee"],["794241471ed9ceb009384b370cb8790fca98552ecb822dc06b19362c36353455","71e918c03cdfca7207772e8d18ee8f9d92d79a0a83f378912362bc68d311dcd0"],["163bc180c22dfc5da23c5c052107bba93a88b4360aa1d4e729611d8f5a7f8079","631107a6ba83f7458194b9766a0a54f638ca20daf800384dbae1498677501939"],["39a32a30f3eb1da0eb7e3903b8ace3da3890b24b61a3a9e79db663b5db0f7a5d","4d4c54675dc1f1c9a1af9ca0010045dc803c16af345823136dd203715d67c491"],["38085391a0e2831f59c33fcce7591515784d359925f11ff958e0e4658efac0e9","42918001a829f49b5634e34ab7fac21b30e24660669ed91955cc31944a19e62a"],["5e3573b049d6135ffbbbbd9a480617434f2455b4a591f719e91153eeb75a32a1","54bc665420c789da1105d53983c1a0fc33bcc2690cd9b37d6566e21a85892871"],["7ed068b25b82c05fdc0e46bd80a357f3acd2f5c3b9330bc8d474e5b28270f6eb","01da83a187da8ccca704d46557a462551d70df7f943a681c3b97b1db6a21b7d3"],["05ca3370e7516f6686111b72650aab4c5484407f14b515ade03951c6a14a0aa3","6f407fc537b95277966e7f0f5e64b86904bf7baee091cee6011a3611834c6903"],["624cb312b698bbd6dbca79b8d2b53cb5d8b3ab33c19306e87c18211f095ab9c3","5b3336b2751e97c793731ac9b9a2243b6229f6d0bbea6b619395d0e5200bd8a3"],["1ddf6ece608fe2901b34b7e4f47cfcb75e947e293c704d8121b11a31a051b5f9","5e2dc58e9a48a749ce5296d229cfb34f96a147a8246d2e9844d52b52112ea94e"],["396b384f3d61cfc060308fbb1c941ebc9418e2d9abd81316e08d625f48c0e101","7223e5f7b66d1ca24962bac273a7aa6618cc60cb8a64a8837e0261107e7ad644"],["53cc3dca3410277fb38d75e4ac0dde8e77a99c817170dbc9696cffe7890fbd50","2592a3aafce64d7c69f4de468d5d5aa19845f5ca08f64a0a40e37d23ececbbe1"],["34705fe600f5aed77b29d3eacdffcd45d886904156d43dc550bb7fc889cc1368","299153c141a8950ffbcc8e9352993e642fa39a476200dd4acf42e158dbe3b01e"],["5969255bd089181b991fce96b1792ba330a14f8a0b061f8118c9c336b8504618","680a805fa0ae93c2a12b193517fb1147d355547e4ab18a9d6ca21575bbb4d7a4"],["27d1d57fa8808d3d452df14bda4248b37902752163b1fd499a92456c59918ecb","0a42f1c0f4c5d7de9e82904f0b4ff63988d31fedb8aad9d8ae009c7a1dff09c3"],["0811d14bfdfdcf2144edd9cf55bce584a9ba17aec3eac8aaa82987ad703d9b8a","42bea70d46f3ee0df0ec77d24c5495ea56ada2e0415920470c4746b68306376e"],["4de090761b863cb0f0650297f154a8e66d00c5119c38e5dd05303d905d527a4a","5eef0efd105361ce198a30e09e7e7edffbe3d70189e63ca68cf6057b9772baa8"],["1d45517858ce45556aaee056ebab7e0ef3dc9ae3740aed570f3e76bfb4fc4817","0b5a9d8fe8b7ccb04c0a5ef77798a3ec6e1bc1138604eb05e83844f0d4c5c699"],["4285edbe9117f30aae1ef5ee419eb1d472106c6b3d7f3ce3701e39324b0eeafc","503aa6104a682bcf2c0a60c84f4c22b50b0caa0fed8db87dedc7173eae04bdbd"],["3ef830cbeff9b79039b1b6bd9bb52bbcfa56d008d91b9703ea1c80351f8687d6","62349ff5d8dbd216a874769eec152ef9734bea9240eed623992c7553dc8ee4c8"],["649a996e6d4d3b60ccb526939ed8929134107e03e2fd4648eaa2fa9830822c1a","1648311b942fe95d492a1ace5e5235c1aea860d036d2475cc8964cd1acedee9c"],["3a95596d97770d050d1ecc075d58a74f5fe6b4b8222740534ba22c8be73f9d56","15a80cdcc03317a830fa4a7461de6bac136993e0a797f83b405c161a34c98fd7"],["2d265d3fe1c88903ca93685209418deec5af886bf0d9fdb3f499d831cbb76ce1","08376fb0663d3aa220948612b519af4a6a1f956622b15a305fb2e60a84210b3c"],["642cb15498d8c6b25803f3e56b98e2ea185ac808cbeab5eb0a610ed5babb9385","21b5ca5020a9e5a2334c0bee15193ea16c909963ffa6e1d93df4b239abeaeb3e"],["38e576301ff6cdd0822a19c6d610d445d3967e2bada903abb6220f68c6e79bef","458fe689e31a24952d2817dda4349109c1b26ef31699fa36c4f8389eeb60eac0"],["372bec78d75011a0ef2233cd08790a7f15c1ec1e3a78cac8d6652678641780db","32e9e47cf2f48612ed3e2c2006ea0c0c8476d3562aa88cefb67ec97abdb538e8"],["1aa3756aabcc3eb65afee34e0a15dd67bfb9fb199eb131f4cc6a3ca9ec4d1c77","42333e27831add6eb49af80e17347c63c26dd684758096ee3dbdbe03a49159ae"],["38db16447d79d3590c4a36e20286beadfbae91a4eed2e5e7dd4f975ac0537dc5","1c48ccaed60ec12ce862ea71165bba7df1739845df2a857f4ef0a0f714f96daa"],["176b78984cddfddef90bae619c6a98e951d9a7ac7d6af218ae7e76b273212fb7","7b5b93eda77443f366e2a127abe12212aad8536767ec1c5861143f777db85852"],["042d154bf7b4a7bd73897ae528c6bc552ea58d74f8109e8e4052d3e9d38bb0f6","42d1831323e279f9f7ee9e3470ba20ca7edc3245eca5d8ffa182de120a71fc90"],["1f8d28dd4f286a8d0687b626b01204434bf5874a9550d6e375116490c154e108","1ce82e2360367e06f41757fd45239f9bc2c61609139446b09b55a9c43da98bb8"],["613eb914c015076e9ae8356bf508c289e50b1c87d9e2546f6e406362e248e5e5","3edbaafcd8c41ef4aa18b254137d201a2ef0ca4ca28807156bc949e920b97353"],["27bf43826bf0310b4b3e3a405eff790a1d77a8d48b04891246cff8e193cb03a9","16a24d749cc1d234fbe8af9cfd782c3aaa5869d6db0afa7b4d4c67037514f2ea"],["769a6a59746d7bead417bdd9c3b5f5ae1dbd924083ffd9e88df7714f57a675c2","22dc1267cfb2b41c590abb7dc3df45619af688d0421f2bdfb50748335ec5da25"],["795734ee4fcc24194219d25d41a2889cdb942f765848e9df63bff0b158c7224d","756420ab5c71127d39d2e79907634a177af0e483e08484ea4d7b76f7100669b5"],["644d12fc5e7fcac5aeb5911d8240971a99fc59fdd2903f46958e6896aefbcf46","173450789fcd40172e8124fea56f7aedad2ee13fa8fc5209cc8cb572175216dc"],["5deca767ef17b9e8d4f351f5c8ad1fcc50e97a2ed687516bf5210679fd6c1110","4ddf2207da12f700708089989da016f3307ce5721c9e27c952599d67898aa396"],["296dcb24cb3185d037a94bef93c97cacd09fc7050ba8472da59d4a689d9d2848","0b17dc85a4acf73833fab728f15abccac97cd09e57975bd996d3e1dd8b060f7b"],["408a3f1af2e77dfe94f8e225b40dfc146abb1002db7bcf15fde61c1a6cf1b93f","4f01ec38854c15a879e7c7924f048e2ec951dcdf04a614088b68fbcc0954e1c8"],["07d2d9234970cdc9483e0a7c5ec52c49077c440e0a993a1e624f90b8fafbbf07","6ac2190030c210ae3e07b9239f6ee7affba263866ee7831a564c511f703f2295"],["2982d553002082320aa899b9b6887e40dedf11868fa931689795d93d58452873","215e16ca447978624cad0ea6bf45aada4eca914425ee275db2a26e980dc349b6"],["1d8649515cb49e136d2895b6276569e5c711fe1a343eeb5a3daaa8d0e7b42d1a","5b21e2f2978f343a3e9ec3316cdc111af3b55f34afa5fc3fcbf6c26c1bb7fb6c"],["5460df4d607147939cdbc04dbdcbdffd37c5eafdd501b50a67213a23ee724a97","69dfc7004263ccb52487d34ab134b80bb3030273999739cb9cdc16d71b9abcd8"],["24623476f0af9f42ca15a0697ad23abeaf5ed9dc4d2b44f7e8175486598125bb","6aebe4a1a22d9e31194dcde6d33ff3af77dda15c22b2ecba9329849b8c042687"],["64e507a02bfd8a8413117bac253b17f94b2911681ebc07c92da0de6a651dd538","513ac992d72b463da110afb612fbae36590248a0507d845ee95fab2d1caa03a4"],["47f3bd11324f6bee230a22a5bb06a3ccddbc0473b810689efaeef894a654bf0e","7e05db9b3ff886bf32608dfc8d14eaa91e2e2ef230e7c75618060e4285c492be"],["4a6d22703a7045d02d656015ea2d168385d42963a739a895e4fd87b3e55c5e0f","4c58d7a8c6ded0451798e51f16ffa5b637a87aa5defb119ba868d8cccf61776d"],["3e22af70a548097244d7798964598172a90391f84c59b04cea7af283ba368eb5","689d8b7cda23b8dea197c5119fbbbd81dd4b59a36cc283dbe292b5b6519a2968"],["61a6ba2ca42d9d557b3a2ff0867c1b8bb8fc40192d31ff637431a302bc065a10","63d805f5a79f845ea2915a25cf0a8cab2e0255212a1bd3c8852b25579b63721d"],["03d963eeae48556e88305f91c478efcfd2168c346b9ba185884ec8621e8cb414","74b75cc839a944ad8c639719d20fd9d48d2099ef24c8633eabec7a9ec1e7e183"],["0f04da69e0202f7b44c58b103c88de09a0599951fedb17e7f2152d6b93a58ae9","1fbc1c9cd03c4cfd46e8e90019debf86e8036587eade038346f91070c800b8c4"],["797899e488353ed0c6666aff11913b33be0190833766e809b2a68cbc671a9cfe","5dd70a33ff94a84b3fe660f7070e6179e86b5c846689265bf985ce424b8909cc"],["735b64bb872606510e4e7d57833eb7ffdc4aa0dbaa242439806be68379f77cdd","384aaaee3ca7ba2436fcb65910859ca5ec30c10af11df7d777d287bc1a2bce2c"],["6f6ea532a62cf4766f55a0a72a86b55e73fe9d3328ee94bfc271e122f99dc1ac","61d8203ef6da5d0b584541c02331c7f58617cf8d4f26d11776236ce8b113ac10"],["5d99a2a3d4aed730b827b68ed836a9910dce4e7b93faf456981ad6cd85748773","7eeacf5680fb6108a8b7edb45f7134644111b08e17c236469685af5a79474b9e"],["31d0b4bb57bd7b69363c064a49bf3c3b9d7635bcc287e7b3059d3d99fd8382e8","1592e581034e13d47d02b8966f5359097e652391be8fb1e803f4219a22aba2c0"],["424cf5c498bbbe8fa7e5c3247049cc3f45946d0e5f38c44a36a6c84b60a84aa0","34acd712d334a2315dc8fd00c5c9b7c5c9f29bca27380a018882a5ab4a0fcb43"],["33a6ae0522936ba774837aa7959972f9804e3ef02ae84c8039be6595598be247","37022798cc08be9b4ded34c1c5062ab3a26081d375cadf517972fb48135a6602"],["5939635b72aeba595b5f6e376d11a3e07d4b1153ab4d0a7ab267b8bcc47cc3cb","382162eb33db2322cbe01a38fa4d13720b6d8edfaf8116a628725ef4293a6c27"],["3649e78d2ae9fb0ee86b691c27386efce4f3e383790e3cfee2bd59c2e85c4036","09b0d9e0dd82e697b9be9d61ce0d1410e281122b483125c48f7942b22f5d5be4"],["62c7585d1677b7619d8200175346ec99118416d8fdf0103730d165934e96a973","5fef7955ee07304429995433a468d68dec4ecf6b08bbe8cd06869080094044de"],["0c94537d311e17f5b0c58989b5be7e40c88b978a8c074a1e9bb07a713f77f6d3","6deaaa5001bcbbbe9ae436fe42f7042ce74fbf83c14058427fad4587ed33c4e2"],["6f5c6894a8d3877312e608c11809c15dffec3df551711095c8cfc810533e1b3e","74eadab9389b40d6ac6cc0d6e333d628ced60a9ef7617751c20630d23477af7b"],["4e16e88e171f9a07e11f97bba65c0fe5483501f255343afb3335ed47fbcee08f","41bcd7dd328871247cb7995bc6bd2e1961e94b0fb12e5fb2f264f9ad2cf47d4c"],["65d8484cef146e6c232fb262c2ac8200a52c63ccec26ff6f038aa5c74982c741","67283346bbae9391952b141e57ca8e3a36f0363d3b81b1c0f2b3c30a92c74235"],["1c588485b64be8cb99bf97f065e75a82138ea2e035ba90b63745354e9cf729f8","7c9a18d6ebf5465a197989cfb9b5b2a66a5402f46c4708ac04187c6b157a0d77"],["2c80c4ad0aebcafab7e9d2519a329f8a1c7df21cb6b1acec7403c0204d6dce71","7f8e62983160756e35356df95d44467e621c7274372997ca74a9fb760b4db36f"],["1e1e5fc87fa2c49e2c44d5718e3d73c73a91a64ac1374652080bd9004291b9c6","153828e90ed8d94c0f86e0eb54ccb31073cd29ed62c34cd9f2dbc5d98872e597"],["0ce0488a30ed446d445efb1bd21ba32ec3d05d538e6393bc0e58e0849ad57129","7278074ac66ac779136f4d6a334b27633645dea0fc98d137e3dbd4015d12b5a1"],["01a6b81f7285f293f19ba019b009aed8280ce285af42fab91e87fb0bbfa6dea4","60f910dc7c9a82e7836f36acfe7ec26b9babfa8bf26b2945b3c1a43b0c19b4dc"],["79b4ce3c6990023859646690c9ea800174902acfa1aad7ff34eca032dbde7150","53a1053d3fc6c749bf8a928854f392d09fa851ba963ca661bffbe74f012ba45b"],["220ee355b5c39c1901ed34c0f50f7778ad1bedcd7259ae167c16514ffe333498","05fd9374986e1e06035dbfada0117035b96b159354262f2b2695af1256d6aa2a"],["1e2f97d2cb4a19ca40403b364253da71f65d2d4665894267e3c6a9db8b4a3a18","22804fb035acb519210ff99ed7a974a725d896a77933789b4dd45a37dea3466d"],["35b8699fa20987876ac3b3086965b05f8cc809d71cab45e017c68ac96e24ed5b","155079de21981778dc438353bf2c6a65967a1a33ebb74c866fb42f4e3cce3e39"],["3cb40c55f5f19c52958e8c4ecd9c459b1d3268b3971b2286d3e58d1fc6b6a6bd","379e1f1f59df05c74485615b87441ba6203f0cdddc6873a883d4cc6dd1b75921"],["6ad916290e0d003ce5c961679f77704dcd768589d7cb728c60f56852031803bf","1e602b4a6725832a56944234f84c4f85f79911b55beef903549089925f2ccbea"],["7c0162492ae668160aa56a60e8bd43ec088555f750d2223cc37362dead5de123","34e60b446eae100d4c3abc6cb02e4ca559457fb5a9030a290a2568fa4cbf118f"],["354c25bf7b3e83dd0c5e1f39b82e3567edeb5337634056c1091cd6a016caacdf","7abb271ef121630f85a9a1049b3ad78d5b889f533b37a713b8801de46770fc3a"],["1e581a4bcf7504f33f4342b2097504d13f9b5a27f4790a6cdde1242209862850","2164d56564360fd2b5dba2f2c6ef1045ab448c3b60b2f2196c2f74625fc39e07"],["533b56f18283ee79b9a180b887c298961bd9aaa6fa3ef97fcb0d5688e694bc3d","6011366753812df2bce83634a92dbac18dd1cffdbf9a97fa1b1d5b49e0026764"],["4b508b94e6e2e6cd260a20664ea7d727ad20587b63ebe826032e0d20cdc6627b","1e8ecd6ff5aabae78172a0214d07a5013992d133af58afa74049de726df2a6c4"],["3398c0c0219f5ac87a8c73fcd17b89311d120a53f5231cb761030c194fed4265","025b234a1dc8662c068c4ba903939c2f79f3f7a3ae64e5edbf667b13599142d9"],["5941a17b04cd3465031cb6745cb94eed24e1ff8d38a6e832f1637ae8e89c78e6","5309792c546b6cda458be331957763b5adb5d535d54a4a61023678faa2ee02ee"],["2cb490d2c0047fcbaffe1df26640bee73c158af6fec91343d606ce9d124a20c9","2e2952ebf089200aebfa3947f241e2fe85797afebdc1ea06d9d26de1b446a964"],["79305236b583232a91c63c7d9ca3750be7ee21711e4d6d257c39ae398212bde1","6f9ecdfa953e302c2014fd8512405e4be0d48302acd15e93936e8dba7d01053b"],["57d9fcb884b94664f35387fa6665cd9bc8136f90d804d77416ea99c3c653ee63","14197e65f0a3599c0b9fcef75b5fbb93580d1b2457b59fb70ce7b9bac88d0fbc"],["6d99df2c28c9fa1e38acddefd3e0931109143d873f3330377a9926bdacdd6523","2f21987905f397f092fc56c5ccd301a1e6afa3c4611627e25017b2e68d07c150"],["749d19591f1755bd481fa12a288166aac42911654c8c551395b265116269ceb9","7ec145aa7558d0342cd87b1750933cb6f3717e727a86a1cc1f2b0c274213688d"],["340f7f5ae19292957902635a5786d14fa38036b324ae759da501e32b8c4073f1","64e231a413f1379a26f4e8223ff91fe2ccd865549571d3c6c28871964b40a0ea"],["4aa33e00bf6e92cac4e84384e5dde0727394233afd5d24d357a8afeb94b08109","3385bb4fbc441937ee01b671d506227a654fd6c1c532cf5221710c6c56ec7e21"],["34b2ffca05f01088de266306c5cc122661e9308eab16929774e58565afc0e4eb","7662faf0f70e82c062c2b835fc6da3353d3cb20b80611ffa6ef2982cf62fa605"],["820fcb51326f1536ddb8dc1052aa198406c7e48f2c81e7664d15f8f9d3715e","756574c23bb01170b97d9fa1663a8ff2f5b97eaa5cd53f34140c1bcec8c262d9"],["0861d7e84cec6d6e33641ff6c85202fc0e9160797809ddc2193802499caf05d3","34936e0a5dc7e2a6217d475fbb8c1c607fb8b3565908a04fd5948abdd399c59f"],["5b4a1dc887ef684d7b4b165b70acb70842a2fa105935af15ecb4a097e33b8f2b","54d21511c05805e5298a72372b8289e9d59c46dc8b5c368bbfda620b68aa652c"],["755493ed60b13f03f9c019362a5af73fb49842dd6916e2572b1b6a312cd20cfc","0750bcbf7e449cec422b93ace1489e1b177d4dbbaa781d315c74d54bb444e9a9"],["5f1c341065b6a81ed2edb6bc38ba81b4c2e3fe2058e5baa13e1406eb2c5b4b4b","6179ebfa7f8086f26820fc99ca2f94c1be19bca672d79cea5b02a836119e06ba"],["1915024ee86acfba3f61ced9707521197195166fb1c4639bf3b3fcf0bf0ded46","5f2e0547032221d2b00937cf524590e3d90901ef0286ea0b032c1a81461b6d92"],["4e942d95930f38c8786ff4a8e576e7a29fb7627afe1fff91cda5006ba0624f5d","45902f695d512d70ce4c1e0520c0060896b94e14d2960b2fcf2ed5e138e0217b"],["63e45f3d91ab915d412bbaa17d1d249e1a1445077fbfaa6be7d35041c5116a91","46dad5a4ec2ad0b86938f5e09f1c03b53b660fc5137648b08527cd20708003da"],["5e2ddd2175417f72c9962c503ac5adf94ed11f28b9d41fccb6a4512886f3cc87","3523b218478911145af1dc431feb7db0a04066eb6e2ade3c7b67d11bc55323aa"],["62ff30a6b179a26e7247a8312cb3af3289e5d722f76a29f203aa623889aa05ec","562beb7999019346beaa80dfd5b95d614e1ff96c1cb1037f65c44997b797d066"],["14988b5d62084fb8335c2f261cdeddc1b634b09cedfce713ff5f0a0bb588a556","447068731fb98e821b8e413b3b48f2d1c8bea308f05aac877006b0f4c3b0cab3"],["1ac777f708a5942cc434236920e82ccc6af920c0a0676712255aa7082b37a5b6","52a6f88d92af1887c781501c6e3a88169a2831b74aefd416f22b47e8335ce317"],["5959792833b71bd5042b78e42212af671f5f87a08eafd8cdde2dcec8140e4bb3","41ce94633eabb8a1b08fac66f762997ed8c9e2af3558e1f6586ad6a5bf5b7b64"],["4464a7962e6722b457336fe98c91765b1ff178f9e892e90129e65fa7688a0607","3d1510b92fd33c501f058a7a86bddedf1b83f9b6e4f04829d321117013f891fe"],["62906d81e7f800e662519f4324ab4c8aac197661c729eed3e744d09efe721c08","4b68efb5b1b709ab86e3253d70bee87ba07875c04a64ecf7e35cd8cdc6c0f7d8"],["4300ff025ac78ef36e58ee7d0d732cf76cd0929fe265b3a093a57f23fc326757","2f92880570846ff2e90d91f16bce3705c9c3ca8011cc543091463b623e4b3c01"],["5427ba28d94652527a9b0c76f57a451e46bdc06cbc8a2481df17f66ffb1524e3","547a97c4afc8d1f74a5d51f7e524f68472f589cc0b396b21368628721537d722"],["424c4493810bfd5e3ffa21776326d8ff62bf8fe74504d7a2db5d3f74e5ce1015","74d0daa832d40405d01551a58b330ffc5abd5356230d6d7cabeb5b1a55046f32"],["54e10980d81b4ae8778896684295fa5c5475e8d68ec2a26e1b0a65383507b3cd","6b1eb48da6886c4d88cea720e9dc8b0d8c51a8f0e1943afa31a40eeb553c0676"],["732eb9e9ebb556e9f024c5574166738f4707b0fd005f568212ab575c1db71ddb","1fc6b00c89e48114d6b13d9920a0c78093994f2b08df147bdbb56bead2cea165"],["74029c04b34b7f314855fee42a04d0ddfdeb92ef3bf7cff629928a97733d96fb","501f63a252dfbc090733b5a208bfe08f81c91419ce3d2d6c0de8cdc5a5625014"],["04524402ebb71a60bf1055001000203a6d4917f112e50dd766cdd7b718a6edd7","71c9e2d15cdc47c565a696ffbe55277570930ed7ade13b9a254059365d5bf338"],["2555c620a50f2bbeeacac66228a96941fa733aa6070855331613578ed7c12794","2b3c1bc5cda7f93242561dbf7572237ac43bf013553230633a5e18b7e71597e5"],["555ea607b0ad18afaf70d7450543d7ffb5b883a3cad3e2778826ca97bf3211a6","6df903158f51aa530d411720a760f8ad0ce9904d54955fda74a349be58eddf5f"],["4db3cfa284207a250a9c83e1fec07e804d70065da586ff2c2a7d2bcb92e6fca6","2a4fbf1c51dc0b2a7783db2be3bd35c2d6462470c88c8b73ae3ce8503fa07154"],["5174e33ffdf28a87184a4d6427d821cbaa3b88ac293a90ca7e1eeae8c5050b16","315ca6bc8e35e4a3d06f89e1db1575b16197963ee8e64746fa998ccd403561cc"]]},doubles:{step:4,points:[["23a4860627e53aeeb8e22b1508249c9109578d33e7bf237459b2596d6c28f9f8","709696f2827fc3729f980f2e3aad6e78b06a11ff8e079c27d87aab37c16727eb"],["5e7e07ed4e1decbfe6e9cbc126905449d4b578fbb561576d20b8bcdd0cc2a556","0f55755c51f102796bf5ebaa81d3260e7d1b3d9ac127d9a80e142031566cf6c7"],["7d13c0248b891b47eb524f2692008e2f97b199bac426cb5902b9003a29ded6ea","59a976ab2c01a81a91f1a56c75ccc77a9e1e9e878e9fe9c3952080a6805b20d5"],["5de7faa2ee4e70132f541f79ca07cd54a39fe1347a6844d19e9d678a8411a565","2c9f23641e1c2e0aab8ea9926b432d92c0e8bc08901d6ff6df85e4cef854ec36"],["06b349eebfed4dad4a805b63a6ed2231a565cda752d9477ff427dd9a8c9ab5ed","07a09289ff3e1f9aab68aa374c48df65f550c2323607b97744dee990608b64f8"],["0af367956af630266b1cc760154256ed79da960dddca9d72a1e8cf27d8d43a77","21108d900134d3b3708dd28ace96b0b23dda9100e4b6a62a8131bd2f2ba408c5"],["1e45a60140a3b2dee9b8dc6ff307154a1b410bcd38e0e38fb10b2f6da1afbe2b","0e730da473dffd60d2f3241a85e68acb47d26e5043ad047d893f072c8dda0a76"],["4d1e116d136158c5ddabd4276832800f2c081c1072de6f2d931797a46abc0cbb","6d415be49d4e35b65cc51354b5008f8c43e84b7b5e8a4b84f44e1efb10c9b91a"],["2b6b892ae94b454b2c2d92bb947fc4d506d173d281779c2c153c001ded42d3d0","7f1cf64e0e180fc4d6e12c1b5c5285f376e979616a52c94a0dea4d48c5880cd2"],["0f6c3a96e0032a9394337a02ffb2c83ba70efb8f566feab530fc90fa3b4710e5","3d4e97e286378675038a4b58e84224ee515e1d6697ac79389f78479be167635a"],["52ee53b981dfbc41ddaa5ddc2754c4175f4811aa45f8e2b19a425657c238a83e","7eb0a1be3400dec87b388cad51613957643cdf0595b891cc6f925fb36da7f1c3"],["52a837bc7a7bc9459bcc2ecf80f74d9ed99def0342e18cfbe8e799fbc504fd52","50d6460185d8924e5485f23f36a98c86053514d163547adab6fe91478a411196"],["6b2bd5d00fab38ceca21a27d6aaec82626b14b555d859527718f8ca404eba4","727340c27a15f6ab3d80547f0827c56ab1ba33bc30d1ef3909ea9a3af10c67e5"],["71dd75fe35761c01a48597ec730bc33237902fd4ad8612cbed1031eebdf40de4","39674a4532078e34378667beae5cb55f814ead9bbaf7e01b3b69533e9f88a411"],["57426aefc21be9ccf162e23d25ac3002ba8534351e65613f870f690f2fd46cf5","6b45b002fb4e8a6f59a6ffb006ed71f75434217333b266325204c7d1ac2e1f34"],["6222bd88bf2df9d5d44b60cfb4a08a960078db7ed51a35eb3e0b6b8ff4eda202","0325bb42ea4ed025dd6bdaed261b7c4f5410b608ba902b068f1efa5782e45313"],["71ac99647b61b9eca6f0c23432a518f738aee708d5932d4ef0f172240250a226","3a96c2c028ebe5f48913be30147e41bc5e1cab9595d5404138a9aa1b5574cf25"],["1f6a1fd8cc0e05b2742ba0fc0369b5247670543637dd033e64dbce90b2f23e9f","779964401ee869a9b31c0ef874a86440ba85d25c2ce932bd31a0865869605e19"],["22e2c039067920c42980dcb3a905fc91601c2b34e819ce1532ada4a5fc39d5cc","631cf9945a09bf26d7e595b3f8e3390696870512820df63c5418577089e1a8bb"],["608de273a9f6a534219d7aaede3cf65a81e4dc03d7a2765eced1d2b7be4610f4","3b31d0113f98d81ab1312fb2837aa9c8dcc7960f84eb371358c6d841f67144fa"],["3f748617ca63ab3e44c6e34f63e7328ea56a2a146da34368a57dca181254fe02","0fed89e6420fc47b3938a2891ba9acee4cbb2899ee4e9ca15a13dc527dc1641e"],["69d98b5ecc35d56c97c0bf312955d199befe116b417d70f5f57e2dfd0af81ce5","3e26d487fbfe36ab44e0ca3b248fe94bce92a69b8154d50e2d5481f8259f4e8e"],["1e34443347f9e627b3531157faab6eaca1bc3114df4a1423cc12bf8417b5d622","295955a5ed061eca7f87b9485666ba9489ec20a9c484224dc920350bb4a6fc79"],["51f4ff8c599b1c96da82941520a9f5abf4a31eb8b84fc95056145ceb3b5775d0","35ac9588d46e41f3f6f99aee3852eeb4b12e807807d4bd1b7f8406b0d7863ac1"],["3faa2a093a19a02424f65a10955101f4dc015c43b2dfce8e001507abd741b845","7a1de10dacfda389ca663b15574bdc8ae8c5b6e7cee647e77b11ddbfc6eb8edc"],["1924416956ea2c1269062588569b18178011ea7cba1a3266284f48aa01d5a90f","0c8e28127b7dcdd206fb6fee96eb88cfc7db7319826ac8cdb8b1fb8adaf021de"],["49761c57ce3c8c4f1435d495903e2f536f3be3712e76af8d0b5a8b7d1ebc8fac","3225035e1065094ef32d7f3e7a6f8ff2748025f96e0c0b44eb35576b61e150a8"],["4339fa86a23242851a16afc3ab05b352a7b4bf53599a49dd7e29d364fc3a757b","6d07cc3462bae9160bbebb997510817040767faa9dbd13f158a5fe8a63a34b0e"],["6bda13918dcbaf8529d6326ae7a9c278b72417c2188c5ea4f062fc50639295fb","2c3fa803b162ee887d0d97a6734866f992f846625f314117075da54bb6c20a36"],["4da4821314574d4fed4dcf692c8b15b99b73f13633210333ce7871359b6e6424","314016034673d2d20529bc93a2dab6e462bcb5f66e1f4a6bf2170759a40a6e65"],["0b2cea0029ee963c0034b61bf19e384435f14554a7d297b5144838c38e375586","47ea95da28d39aaade5edb8ed941c687603cfdd1508776e96d6683199e99daea"],["4c27afff3c45f32c952d3984e14e29a098e685c9c2e723e5fc8047ae60b7e824","5f2c99e6526dc87d95f11eb626c29c3a90d0be1e51a4c49e5bbabd114bf5a66b"],["53e2a4ed1bbb48bd016c524a02f797654cfc969849f867681da94e341f377534","5a2334fdda642732a3c9520ce06581aa7f0f082882554c37b8d390a25a9bd559"],["7b8d2c823baafe0d878a55e8af1db150dec85b1424a4901f9beffd3a6196e3d6","1c45a557b3624f9b89ed15b3c3e1a065f1b453d948f7cf45d9494483f8af0c85"],["78877b5d8777410997dacaeea59400fc9db4421fac02c4282301c67d35fb7ffe","0341b46c328333e4484ce8607619014d41775c408c88856d2f9e19812d90fbf5"],["2b556bbc070b5c4bae9e575836d1d68ee9fbe800448c0d2c233f78185eed3f91","7ba01332807ebd892e00ddb368c0fa1b3f19b5b32efd90b178d984e1d7174d6f"],["0f72556998b0044799f0fd03210ded3d984e3843bbaf3c1d5d692bc94d43c4e7","16c19c5037c103d447caef4efe6bd81a490e7c668f6870f1b080863b5315df5e"],["1cd96ef237b213cd446f13b3ec40d32ecc593bc6ea71e77efc284341a5f3da1a","7a626aeb91efcb5f9777264f5e17ced8b411f68c713673ef0f184a5ccd60dbe3"],["31a75b21cb532622a7caf9e29e652ac4e47b1450edf6655acaf3797b55a7ca46","77006e7cf104982f8865081a2ff8a6911546755e31c3586353b0bd0826c5d790"],["543d84cb04fb2bf787b7aa382eaab5cd8d050ad8ee52aa8a285b945652014031","0358fdc5b63ed49e693d838f182b275846f42dd49a42ec2e6e932ba4de59ef20"],["0a2818f5f5d8937800c30ac6b847db2cdef655b864126302249144a5a15b205a","187c76a49af10851bb049ba97c0fbbb14b2621522a4e8d9670ea46e56c9a1bd6"],["7efb45d3a2851109d7a8d50ddb08fe308bbf674c019b965cdad4570a141e648a","0fe1198b11a1bf56867091c69d71f8b7792257dda321d43652e818acd0c28cda"],["472e960dd122a534f52377235350549df4a1dd7a08cfc580bff5fb4b0a70aa7b","10585d04fc529fef4c0c0776154fc7ebbaedbae8a99937e47598d0578932b7cc"],["04892cfff7f94ff7f07c1241e3ac4945bc46ea9d6a3c1c3adbce109a9afceb6a","3ae2aa25e2555135a7a3251c11a3f8eebe81758bc1c3e2cbc6e6ca461a543130"],["2401d311a3abfd2583f1c6aa519c1f18ff730a0abf730ddcc9c9739b04d8a85e","653224f3488cae1ae19a414a9932035a2bf2c46803b5532bbb645e62387ee34d"],["0ea2c846a535a115972161612a192588d92d68a3c9050eae91b2817b94e68325","3b82a8337b05f11bbac176a113be183a50a0331f3d3116f24b971b5a8b0d031b"],["0fb3f87c2c6c89c65b74299b77f3736546a8b9e41b19197476bff27354e1c128","1034d42c15a2bfe3e682fad49dbc2812caadf0c584bc30b51625b85d74e9d5f7"],["1bc7af1e38185e7c2d8d04371c7e177d7a9ddee1b81d7d26db7ad644c7dad28d","61d909d855661f2f7a5eef87795dc0491d027e12631b270fcaf2f65900314833"],["469d0960dbd0ef9c91c4597ccf7c209549b187ff63bd378b7dac577198d74a4d","0b5f21c7f86832241f2157c288bdc9394f83f8d57457f6d9f6b345e4909478cb"],["5e9ac4ab2f4a3c3526e1317f913d69e3826fe862efd0c80d9310319170c5cbeb","505f00fa8aee03ccbd2f33529ae1e4e4bcf2644fe673d0b0290ec32be5b51bab"],["11cd80e1fdcbc565efed81d17f3f54643ffeed1cff38f3825e115adbd82759f1","43f11943f7ef3fa68b980fee45e98134f1df22263b2d14419d61ffe62822dbe0"],["3328bc121616a9477165ed282053d203c24f4826076c638a2c6723d42c9bfadb","2bbf3f26c21b5cb273e5f4f0114c6718c5eb7291939b7697c74333cdfafac039"],["0ba774bb605dd804cae6887e81f6bd2c59e024fac8bf5f5c48a841a037c28398","54ba013ad2d04dcdfb5a151b7347ee9a10067ddd0a3907e9bc337a77bf911321"],["1074ff0267662dc2b4ce65aaa0229c375a3d0d843ce9349233949581c869b64c","299be0decb680ec28923da4d049770107d42c180b460da13a7b1efc7e6d5b022"],["25ed76d78c87c3bd64b4331902c5a853734283e25f19f320295667b80a340d35","179b5f92f545c7b326b3a63fb0b32a0f52b4159988436d5af50c1d0d76373947"],["75d942c04210dcde5d1bd4fabfc732d3f95568e399382c0423c83c41cb05dc3f","696cc14856cdc13c8fd7e2c5771731cbf38e3fad47a424679765c4874e35ab2d"],["5d9324f56975477d5945599eeeccec67708c996cd3f3f2818bf2591507e3502a","10985a3cfd573205281aec24e2c8b41f5cd8cdfc9d7be34675cf306bbe1b4f6a"],["7511066c0e12105a7b937c7ecef367d5afe6e621e5cabf4e490b09b7ada7ee07","604df365b8391cbca8848f88daa700b770da5bb136f70bfb0a3ea33ba386fcd5"],["2596e5b3cf5494e60d2a750d03c66abc2e0183af53620b893f9cf9fc3b76dc26","68a0a7ac9a0cc093884a6b84f45a2cde595194e0f48dbd566fa78a3174b182fe"],["28bd38d44030dd9ca028b2a2f31a795f4c7a5e85a785df7847e3d525e99d4787","552dd7405c4183733ad3c4e7ccb999b4fed81b7a4444aab499d41d6d78d5bbfc"],["59233a3346f61135f431f96cf0197e24ad38240b222c010a6ce538cf4c24347b","3cce55908611d2b93f221613f09cfc4dbcd2e2b609233eea5439ad1908a10b20"],["5830f025f1078d408948f73096af97de1e9e70b3be85890acb21132c34ff961f","67d451752c2433ffe66e47242e301e56db2b2f8203553cab9de717e25793d41e"],["6a0c8b194571e874b82d904da36d43096bbe36d512e24ff8dcb2b00b57ffd3ec","5f85adb7749cc735ec838bcccfe7d4b52902c6132998d7ac8e032cad031c42b8"],["53b3f967bff8760948dec5e9282f35d1434a5503790b9012e17faefbe7c4d699","404462283c8664a17daa5b4059dcd10e2699fd86d0140de9f3e8ad0566098ae5"]]}};
|
||
},{}],"cm0X":[function(require,module,exports) {
|
||
"use strict";var e=require("./ecdh"),r=require("./precomputed/ed25519.json");module.exports=new e("X25519","ED25519",r);
|
||
},{"./ecdh":"ZfBm","./precomputed/ed25519.json":"lx0x"}],"yQtW":[function(require,module,exports) {
|
||
module.exports=function(o){return null!=o&&null!=o.constructor&&"function"==typeof o.constructor.isBuffer&&o.constructor.isBuffer(o)};
|
||
},{}],"YGSp":[function(require,module,exports) {
|
||
const e=require("bl/BufferList");module.exports=(n=>{const t=async function*(){let t=yield,o=new e;for await(const r of n)if(t)for(o.append(r);o.length>=t;){const n=o.shallowSlice(0,t);if(o.consume(t),!(t=yield n)){o.length&&(t=yield o,o=new e);break}}else t=yield o.append(r),o=new e;if(t)throw Object.assign(new Error(`stream ended before ${t} bytes became available`),{code:"ERR_UNDER_READ",buffer:o})}();return t.next(),t});
|
||
},{"bl/BufferList":"s5uv"}],"jo4g":[function(require,module,exports) {
|
||
"use strict";const e=require("it-reader"),r=require("it-pushable"),t=require("p-defer");module.exports=(s=>{const i=r(),a=e(s.source),c=t();let n;const o=s.sink(async function*(){yield*i;const e=await c.promise;yield*e}());return o.catch(e=>{n=e}),{reader:a,writer:i,stream:{sink:e=>n?Promise.reject(n):(c.resolve(e),o),source:a},rest:()=>i.end(),write:i.push,read:async()=>(await a.next()).value}});
|
||
},{"it-reader":"YGSp","it-pushable":"kBtQ","p-defer":"LOw6"}],"Tse8":[function(require,module,exports) {
|
||
module.exports={encode:require("./encode.js"),decode:require("./decode.js"),encodingLength:require("./length.js")};
|
||
},{"./encode.js":"Q/oY","./decode.js":"J29v","./length.js":"Bq+a"}],"5D3s":[function(require,module,exports) {
|
||
|
||
"use strict";const e=require("varint"),{Buffer:r}=require("buffer"),t=(o,s,u)=>{const n=e.encode(o,s,u);return t.bytes=e.encode.bytes,s||r.from(n)};module.exports=t;
|
||
},{"varint":"Tse8","buffer":"z1tx"}],"UlYf":[function(require,module,exports) {
|
||
|
||
"use strict";const{Buffer:e}=require("buffer"),n=require("bl/BufferList"),t=require("./varint-encode"),o=8,r=10240;function l(l){l=l||{};const s=Math.max(l.poolSize||r,l.minPoolSize||o),c=l.lengthEncoder||t;return t=>(async function*(){let r=e.alloc(s),l=0;for await(const i of t){c(i.length,r,l);const t=r.slice(l,l+c.bytes);l+=c.bytes,r.length-l<o&&(r=e.alloc(s),l=0),yield(new n).append(t).append(i)}})()}l.single=((e,o)=>{const r=(o=o||{}).lengthEncoder||t;return new n([r(e.length),e])}),module.exports=l,module.exports.MIN_POOL_SIZE=o,module.exports.DEFAULT_POOL_SIZE=r;
|
||
},{"buffer":"z1tx","bl/BufferList":"s5uv","./varint-encode":"5D3s"}],"b9NY":[function(require,module,exports) {
|
||
|
||
"use strict";const{Buffer:e}=require("buffer"),r=require("varint"),t=e=>new Proxy({},{get:(r,t)=>"l"===t[0]?e[t]:e.get(parseInt(t))}),s=u=>{const o=r.decode(e.isBuffer(u)?u:t(u));return s.bytes=r.decode.bytes,o};module.exports=s;
|
||
},{"buffer":"z1tx","varint":"Tse8"}],"E20p":[function(require,module,exports) {
|
||
|
||
"use strict";const{Buffer:e}=require("buffer"),t=require("bl/BufferList"),n=require("./varint-decode"),a=8,r=4194304,o=e.alloc(0),h={LENGTH:"readLength",DATA:"readData"},l={[h.LENGTH]:(e,n,a,r)=>{let l;n=n.append(e);try{l=r.lengthDecoder(n)}catch(c){if(n.length>r.maxLengthLength)throw Object.assign(c,{message:"message length too long",code:"ERR_MSG_LENGTH_TOO_LONG"});if(c instanceof RangeError)return{mode:h.LENGTH,buffer:n};throw c}if(l>r.maxDataLength)throw Object.assign(new Error("message data too long"),{code:"ERR_MSG_DATA_TOO_LONG"});return e=n.shallowSlice(r.lengthDecoder.bytes),n=new t,r.onLength&&r.onLength(l),l<=0?(r.onData&&r.onData(o),{mode:h.LENGTH,chunk:e,buffer:n,data:o}):{mode:h.DATA,chunk:e,buffer:n,state:{dataLength:l}}},[h.DATA]:(e,n,a,r)=>{if((n=n.append(e)).length<a.dataLength)return{mode:h.DATA,buffer:n,state:a};const{dataLength:o}=a,l=n.shallowSlice(0,o);return e=n.length>o?n.shallowSlice(o):null,n=new t,r.onData&&r.onData(l),{mode:h.LENGTH,chunk:e,buffer:n,data:l}}};function c(e){return(e=e||{}).lengthDecoder=e.lengthDecoder||n,e.maxLengthLength=e.maxLengthLength||a,e.maxDataLength=e.maxDataLength||r,n=>(async function*(){let a,r=new t,o=h.LENGTH;for await(let t of n)for(;t;){const n=l[o](t,r,a,e);({mode:o,chunk:t,buffer:r,state:a}=n),n.data&&(yield n.data)}if(r.length)throw Object.assign(new Error("unexpected end of input"),{code:"ERR_UNEXPECTED_EOF"})})()}c.fromReader=((e,t)=>{t=t||{};let n=1;const a={[Symbol.asyncIterator](){return this},next:async()=>{try{return await e.next(n)}catch(t){if("ERR_UNDER_READ"===t.code)return{done:!0,value:null};throw t}finally{n=1}}};return t.onLength=(e=>{n=e}),c(t)(a)}),module.exports=c,module.exports.MAX_LENGTH_LENGTH=a,module.exports.MAX_DATA_LENGTH=r;
|
||
},{"buffer":"z1tx","bl/BufferList":"s5uv","./varint-decode":"b9NY"}],"1RXH":[function(require,module,exports) {
|
||
"use strict";exports.encode=require("./encode"),exports.decode=require("./decode"),exports.varintEncode=require("./varint-encode"),exports.varintDecode=require("./varint-decode"),exports.int32BEEncode=require("./int32BE-encode"),exports.int32BEDecode=require("./int32BE-decode");
|
||
},{"./encode":"UlYf","./decode":"E20p","./varint-encode":"5D3s","./varint-decode":"b9NY","./int32BE-encode":"mO86","./int32BE-decode":"zbl+"}],"/zM8":[function(require,module,exports) {
|
||
"use strict";const e=require("is-buffer"),r=require("it-handshake"),t=require("it-length-prefixed");module.exports=((n,a={})=>{const i=r(n),o=t.decode.fromReader(i.reader,a);let s=!1;const d={read:async e=>{const{value:r,done:t}=await i.reader.next(e);if(t&&r.length<e)throw new Error("Couldn't read enough bytes");if(s=t,!r)throw new Error("Value is null");return r},readLP:async()=>{const{value:e,done:r}=await o.next();if(s=r,!e)throw new Error("Value is null");return e},readPB:async r=>{const t=await d.readLP();if(!t)throw new Error("Value is null");const n=e(t)?t:t.slice();return r.decode(n)},write:e=>{i.writer.push(e)},writeLP:e=>{d.write(t.encode.single(e,a))},writePB:(e,r)=>{d.writeLP(r.encode(e))},pb:e=>({read:()=>d.readPB(e),write:r=>d.writePB(r,e)}),unwrap:()=>(i.rest(),i.stream)};return d});
|
||
},{"is-buffer":"yQtW","it-handshake":"jo4g","it-length-prefixed":"1RXH"}],"nut/":[function(require,module,exports) {
|
||
"use strict";const e=require("get-iterator");module.exports=function(){let r,t;return{sink:async n=>{if(r)throw new Error("already piped");r=e(n),t&&t(r)},source:{[Symbol.asyncIterator](){return this},next:()=>r?r.next():new Promise(e=>{t=(r=>{t=null,e(r.next())})})}}};
|
||
},{"get-iterator":"b5QV"}],"ECx4":[function(require,module,exports) {
|
||
var r=require("./");module.exports=function(){var e=r(),s=r();return[{source:e.source,sink:s.sink},{source:s.source,sink:e.sink}]};
|
||
},{"./":"nut/"}],"oUC/":[function(require,module,exports) {
|
||
|
||
"use strict";const{Buffer:e}=require("buffer"),f=require("bl/BufferList");module.exports=async function*(i){for await(const o of i)e.isBuffer(o)?yield o:f.isBufferList(o)?yield o.slice():yield e.from(o)},module.exports.toBuffer=module.exports,module.exports.toList=async function*(i){for await(const o of i)e.isBuffer(o)?yield(new f).append(o):f.isBufferList(o)?yield o:yield(new f).append(e.from(o))};
|
||
},{"buffer":"z1tx","bl/BufferList":"s5uv"}],"CxJC":[function(require,module,exports) {
|
||
var Buffer = require("buffer").Buffer;
|
||
var e=require("buffer").Buffer,r=require("../internal/assert");function t(t,n,i){return r(t&&"string"==typeof t.id),null==n&&(n=e.alloc(0)),null==i&&(i=e.alloc(t.size,0)),t.mac(n,i)}function n(t,n,i,l){if(null==i&&(i=e.alloc(0)),r(t&&"string"==typeof t.id),r(e.isBuffer(n)),r(e.isBuffer(i)),r(l>>>0===l),n.length!==t.size)throw new RangeError("Invalid PRK length.");var a=Math.ceil(l/t.size);if(a>255)throw new RangeError("Invalid output length.");for(var o=e.alloc(a*t.size),u=e.from([0]),f=t.hmac(),s=e.alloc(0),c=0,p=0;p<a;p++)u[0]+=1,f.init(n),f.update(s),f.update(i),f.update(u),c+=(s=f.final()).copy(o,c);return o.slice(0,l)}function i(e,r,i,l,a){return n(e,t(e,r,i),l,a)}exports.native=0,exports.extract=t,exports.expand=n,exports.derive=i;
|
||
},{"../internal/assert":"TXc9","buffer":"z1tx"}],"On4l":[function(require,module,exports) {
|
||
"use strict";module.exports=require("./js/hkdf");
|
||
},{"./js/hkdf":"CxJC"}],"vJS3":[function(require,module,exports) {
|
||
var Buffer = require("buffer").Buffer;
|
||
var t=require("buffer").Buffer;function r(t){return a(t)||i(t)||n(t)||e()}function e(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function n(t,r){if(t){if("string"==typeof t)return o(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?o(t,r):void 0}}function i(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}function a(t){if(Array.isArray(t))return o(t)}function o(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}function u(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function s(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function l(t,r,e){return r&&s(t.prototype,r),e&&s(t,e),t}var h=require("../internal/assert"),f=function(){function e(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];u(this,e),h("function"==typeof t),h(r>>>0===r),h(Array.isArray(n)),h(Array.isArray(i)),this.hash=t,this.size=r,this.x=n,this.y=i,this.inner=new t,this.outer=new t}return l(e,[{key:"init",value:function(e){var n,i;if(h(t.isBuffer(e)),e.length>this.size){var a=new(0,this.hash);a.init.apply(a,r(this.x)),a.update(e),e=a.final.apply(a,r(this.y)),h(e.length<=this.size)}for(var o=t.alloc(this.size),u=0;u<e.length;u++)o[u]=54^e[u];for(var s=e.length;s<o.length;s++)o[s]=54;(n=this.inner).init.apply(n,r(this.x)),this.inner.update(o);for(var l=0;l<e.length;l++)o[l]=92^e[l];for(var f=e.length;f<o.length;f++)o[f]=92;return(i=this.outer).init.apply(i,r(this.x)),this.outer.update(o),this}},{key:"update",value:function(t){return this.inner.update(t),this}},{key:"final",value:function(){var t,e;return this.outer.update((t=this.inner).final.apply(t,r(this.y))),(e=this.outer).final.apply(e,r(this.y))}}]),e}();module.exports=f;
|
||
},{"../internal/assert":"TXc9","buffer":"z1tx"}],"o5jB":[function(require,module,exports) {
|
||
var Buffer = require("buffer").Buffer;
|
||
var t=require("buffer").Buffer;function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function n(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),t}var s=require("../internal/assert"),a=require("../internal/hmac"),r=-1,u=t.alloc(8,0),o=t.alloc(64,0);o[0]=128;var h=new Uint32Array([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]),f=function(){function i(){e(this,i),this.state=new Uint32Array(8),this.msg=new Uint32Array(64),this.block=t.alloc(64),this.size=r}return n(i,[{key:"init",value:function(){return this.state[0]=1779033703,this.state[1]=3144134277,this.state[2]=1013904242,this.state[3]=2773480762,this.state[4]=1359893119,this.state[5]=2600822924,this.state[6]=528734635,this.state[7]=1541459225,this.size=0,this}},{key:"update",value:function(e){return s(t.isBuffer(e)),this._update(e,e.length),this}},{key:"final",value:function(){return this._final(t.alloc(32))}},{key:"_update",value:function(t,e){s(this.size!==r,"Context is not initialized.");var i=63&this.size,n=0;if(this.size+=e,i>0){var a=64-i;if(a>e&&(a=e),t.copy(this.block,i,n,n+a),e-=a,n+=a,(i+=a)<64)return;this._transform(this.block,0)}for(;e>=64;)this._transform(t,n),n+=64,e-=64;e>0&&t.copy(this.block,0,n,n+e)}},{key:"_final",value:function(t){s(this.size!==r,"Context is not initialized.");var e=63&this.size,i=8*this.size;m(u,i*(1/4294967296)>>>0,0),m(u,i>>>0,4),this._update(o,1+(119-e&63)),this._update(u,8);for(var n=0;n<8;n++)m(t,this.state[n],4*n),this.state[n]=0;for(var a=0;a<64;a++)this.msg[a]=0;for(var h=0;h<64;h++)this.block[h]=0;return this.size=r,t}},{key:"_transform",value:function(t,e){for(var i=this.msg,n=this.state[0],s=this.state[1],a=this.state[2],r=this.state[3],u=this.state[4],o=this.state[5],f=this.state[6],m=this.state[7],z=0;z<16;z++)i[z]=d(t,e+4*z);for(;z<64;z++)i[z]=y(i[z-2])+i[z-7]+v(i[z-15])+i[z-16];for(z=0;z<64;z++){var b=m+c(u)+k(u,o,f)+h[z]+i[z],g=l(n)+p(n,s,a);m=f,f=o,o=u,u=r+b>>>0,r=a,a=s,s=n,n=b+g>>>0}this.state[0]+=n,this.state[1]+=s,this.state[2]+=a,this.state[3]+=r,this.state[4]+=u,this.state[5]+=o,this.state[6]+=f,this.state[7]+=m}}],[{key:"hash",value:function(){return new i}},{key:"hmac",value:function(){return new a(i,64)}},{key:"digest",value:function(t){return i.ctx.init().update(t).final()}},{key:"root",value:function(e,n){return s(t.isBuffer(e)&&32===e.length),s(t.isBuffer(n)&&32===n.length),i.ctx.init().update(e).update(n).final()}},{key:"multi",value:function(t,e,n){var s=i.ctx;return s.init(),s.update(t),s.update(e),n&&s.update(n),s.final()}},{key:"mac",value:function(t,e){return i.hmac().init(e).update(t).final()}}]),i}();function l(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function c(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function v(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}function y(t){return(t>>>17|t<<15)^(t>>>19|t<<13)^t>>>10}function k(t,e,i){return i^t&(e^i)}function p(t,e,i){return t&e|i&(t|e)}function d(t,e){return 16777216*t[e++]+65536*t[e++]+256*t[e++]+t[e]}function m(t,e,i){return t[i++]=e>>>24,t[i++]=e>>>16,t[i++]=e>>>8,t[i++]=e,i}f.native=0,f.id="SHA256",f.size=32,f.bits=256,f.blockSize=64,f.zero=t.alloc(32,0),f.ctx=new f,module.exports=f;
|
||
},{"../internal/assert":"TXc9","../internal/hmac":"vJS3","buffer":"z1tx"}],"tjeC":[function(require,module,exports) {
|
||
"use strict";function e(e,n){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=t(e))||n&&e&&"number"==typeof e.length){r&&(e=r);var o=0,i=function(){};return{s:i,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,c=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return c=e.done,e},e:function(e){u=!0,a=e},f:function(){try{c||null==r.return||r.return()}finally{if(u)throw a}}}}function t(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var a=require("./util"),c=a.encodeText,u=function(){function t(e,n,o,i){r(this,t),this.name=e,this.code=n,this.codeBuf=c(this.code),this.alphabet=i,this.codec=o(i)}return i(t,[{key:"encode",value:function(e){return this.codec.encode(e)}},{key:"decode",value:function(t){var n,r=e(t);try{for(r.s();!(n=r.n()).done;){var o=n.value;if(this.alphabet&&this.alphabet.indexOf(o)<0)throw new Error("invalid character '".concat(o,"' in '").concat(t,"'"))}}catch(i){r.e(i)}finally{r.f()}return this.codec.decode(t)}}]),t}();module.exports=u;
|
||
},{"./util":"4dv8"}],"h68j":[function(require,module,exports) {
|
||
"use strict";var e=require("@multiformats/base-x"),a=require("./base.js"),r=require("./rfc4648"),s=r.rfc4648,b=require("./util"),u=b.decodeText,p=b.encodeText,d=function(){return{encode:u,decode:p}},t=[["identity","\0",d,""],["base2","0",s(1),"01"],["base8","7",s(3),"01234567"],["base10","9",e,"0123456789"],["base16","f",s(4),"0123456789abcdef"],["base16upper","F",s(4),"0123456789ABCDEF"],["base32hex","v",s(5),"0123456789abcdefghijklmnopqrstuv"],["base32hexupper","V",s(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV"],["base32hexpad","t",s(5),"0123456789abcdefghijklmnopqrstuv="],["base32hexpadupper","T",s(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV="],["base32","b",s(5),"abcdefghijklmnopqrstuvwxyz234567"],["base32upper","B",s(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"],["base32pad","c",s(5),"abcdefghijklmnopqrstuvwxyz234567="],["base32padupper","C",s(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567="],["base32z","h",s(5),"ybndrfg8ejkmcpqxot1uwisza345h769"],["base36","k",e,"0123456789abcdefghijklmnopqrstuvwxyz"],["base36upper","K",e,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"],["base58btc","z",e,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],["base58flickr","Z",e,"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"],["base64","m",s(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],["base64pad","M",s(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],["base64url","u",s(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"],["base64urlpad","U",s(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="]],c=t.reduce(function(e,r){return e[r[0]]=new a(r[0],r[1],r[2],r[3]),e},{}),n=t.reduce(function(e,a){return e[a[1]]=c[a[0]],e},{});module.exports={names:c,codes:n};
|
||
},{"@multiformats/base-x":"zMOB","./base.js":"tjeC","./rfc4648":"hH6x","./util":"4dv8"}],"VB0b":[function(require,module,exports) {
|
||
"use strict";var e=require("./constants"),r=require("./util"),t=r.encodeText,n=r.decodeText,o=r.concat;function c(e,r){if(!r)throw new Error("requires an encoded Uint8Array");var t=u(e),n=t.name,c=t.codeBuf;return d(n,r),o([c,r],c.length+r.length)}function s(e,r){var n=u(e),c=t(n.encode(r));return o([n.codeBuf,c],n.codeBuf.length+c.length)}function a(e){e instanceof Uint8Array&&(e=n(e));var r=e[0];return["f","F","v","V","t","T","b","B","c","C","h","k","K"].includes(r)&&(e=e.toLowerCase()),u(e[0]).decode(e.substring(1))}function i(e){if(e instanceof Uint8Array&&(e=n(e)),"[object String]"!==Object.prototype.toString.call(e))return!1;try{return u(e[0]).name}catch(r){return!1}}function d(e,r){u(e).decode(n(r))}function u(r){if(Object.prototype.hasOwnProperty.call(e.names,r))return e.names[r];if(Object.prototype.hasOwnProperty.call(e.codes,r))return e.codes[r];throw new Error("Unsupported encoding: ".concat(r))}function f(e){return e instanceof Uint8Array&&(e=n(e)),u(e[0])}exports=module.exports=c,exports.encode=s,exports.decode=a,exports.isEncoded=i,exports.encoding=u,exports.encodingFromData=f;var p=Object.freeze(e.names),l=Object.freeze(e.codes);exports.names=p,exports.codes=l;
|
||
},{"./constants":"h68j","./util":"4dv8"}],"dA5p":[function(require,module,exports) {
|
||
module.exports={encode:require("./encode.js"),decode:require("./decode.js"),encodingLength:require("./length.js")};
|
||
},{"./encode.js":"Q/oY","./decode.js":"J29v","./length.js":"Bq+a"}],"rZEA":[function(require,module,exports) {
|
||
"use strict";const{encoding:e}=require("multibase"),t=new TextDecoder("utf8");function n(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t}function r(r,o="utf8"){return"utf8"===o||"utf-8"===o?t.decode(r):"ascii"===o?n(r):e(o).encode(r)}module.exports=r;
|
||
},{"multibase":"VB0b"}],"Sqgj":[function(require,module,exports) {
|
||
"use strict";const{encoding:e}=require("multibase"),t=new TextEncoder;function n(e){const t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}function r(r,o="utf8"){return"utf8"===o||"utf-8"===o?t.encode(r):"ascii"===o?n(r):e(o).decode(r)}module.exports=r;
|
||
},{"multibase":"VB0b"}],"gjv/":[function(require,module,exports) {
|
||
"use strict";var r=require("multibase"),e=require("varint"),n=require("./constants"),t=n.names,o=require("uint8arrays/to-string"),i=require("uint8arrays/from-string"),a=require("uint8arrays/concat"),c={};for(var s in t){var u=s;c[t[u]]=u}function d(r){if(!(r instanceof Uint8Array))throw new Error("must be passed a Uint8Array");return o(r,"base16")}function h(r){return i(r,"base16")}function f(e){if(!(e instanceof Uint8Array))throw new Error("must be passed a Uint8Array");return o(r.encode("base58btc",e)).slice(1)}function l(e){var n=e instanceof Uint8Array?o(e):e;return r.decode("z"+n)}function w(r){if(!(r instanceof Uint8Array))throw new Error("multihash must be a Uint8Array");if(r.length<2)throw new Error("multihash too short. must be > 2 bytes.");var n=e.decode(r);if(!y(n))throw new Error("multihash unknown function code: 0x".concat(n.toString(16)));r=r.slice(e.decode.bytes);var t=e.decode(r);if(t<0)throw new Error("multihash invalid length: ".concat(t));if((r=r.slice(e.decode.bytes)).length!==t)throw new Error("multihash length inconsistent: 0x".concat(o(r,"base16")));return{code:n,name:c[n],length:t,digest:r}}function g(r,n,t){if(!r||void 0===n)throw new Error("multihash encode requires at least two args: digest, code");var o=m(n);if(!(r instanceof Uint8Array))throw new Error("digest should be a Uint8Array");if(null==t&&(t=r.length),t&&r.length!==t)throw new Error("digest length should be equal to specified length.");var i=e.encode(o),c=e.encode(t);return a([i,c,r],i.length+c.length+r.length)}function m(r){var e=r;if("string"==typeof r){if(void 0===t[r])throw new Error("Unrecognized hash function named: ".concat(r));e=t[r]}if("number"!=typeof e)throw new Error("Hash function code should be a number. Got: ".concat(e));if(void 0===c[e]&&!b(e))throw new Error("Unrecognized function code: ".concat(e));return e}function b(r){return r>0&&r<16}function y(r){return!!b(r)||!!c[r]}function v(r){w(r)}function E(r){return v(r),r.subarray(0,2)}Object.freeze(c),module.exports={names:t,codes:c,toHexString:d,fromHexString:h,toB58String:f,fromB58String:l,decode:w,encode:g,coerceCode:m,isAppCode:b,validate:v,prefix:E,isValidCode:y};
|
||
},{"multibase":"VB0b","varint":"dA5p","./constants":"AwpH","uint8arrays/to-string":"rZEA","uint8arrays/from-string":"Sqgj","uint8arrays/concat":"qYui"}],"UZiH":[function(require,module,exports) {
|
||
"use strict";function e(e,n){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=t(e))||n&&e&&"number"==typeof e.length){r&&(e=r);var o=0,i=function(){};return{s:i,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,c=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return c=e.done,e},e:function(e){u=!0,a=e},f:function(){try{c||null==r.return||r.return()}finally{if(u)throw a}}}}function t(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var a=require("./util"),c=a.encodeText,u=function(){function t(e,n,o,i){r(this,t),this.name=e,this.code=n,this.codeBuf=c(this.code),this.alphabet=i,this.codec=o(i)}return i(t,[{key:"encode",value:function(e){return this.codec.encode(e)}},{key:"decode",value:function(t){var n,r=e(t);try{for(r.s();!(n=r.n()).done;){var o=n.value;if(this.alphabet&&this.alphabet.indexOf(o)<0)throw new Error("invalid character '".concat(o,"' in '").concat(t,"'"))}}catch(i){r.e(i)}finally{r.f()}return this.codec.decode(t)}}]),t}();module.exports=u;
|
||
},{"./util":"4dv8"}],"OJdg":[function(require,module,exports) {
|
||
"use strict";var e=require("@multiformats/base-x"),a=require("./base.js"),r=require("./rfc4648"),s=r.rfc4648,b=require("./util"),u=b.decodeText,p=b.encodeText,d=function(){return{encode:u,decode:p}},t=[["identity","\0",d,""],["base2","0",s(1),"01"],["base8","7",s(3),"01234567"],["base10","9",e,"0123456789"],["base16","f",s(4),"0123456789abcdef"],["base16upper","F",s(4),"0123456789ABCDEF"],["base32hex","v",s(5),"0123456789abcdefghijklmnopqrstuv"],["base32hexupper","V",s(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV"],["base32hexpad","t",s(5),"0123456789abcdefghijklmnopqrstuv="],["base32hexpadupper","T",s(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV="],["base32","b",s(5),"abcdefghijklmnopqrstuvwxyz234567"],["base32upper","B",s(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"],["base32pad","c",s(5),"abcdefghijklmnopqrstuvwxyz234567="],["base32padupper","C",s(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567="],["base32z","h",s(5),"ybndrfg8ejkmcpqxot1uwisza345h769"],["base36","k",e,"0123456789abcdefghijklmnopqrstuvwxyz"],["base36upper","K",e,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"],["base58btc","z",e,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],["base58flickr","Z",e,"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"],["base64","m",s(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],["base64pad","M",s(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],["base64url","u",s(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"],["base64urlpad","U",s(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="]],c=t.reduce(function(e,r){return e[r[0]]=new a(r[0],r[1],r[2],r[3]),e},{}),n=t.reduce(function(e,a){return e[a[1]]=c[a[0]],e},{});module.exports={names:c,codes:n};
|
||
},{"@multiformats/base-x":"zMOB","./base.js":"UZiH","./rfc4648":"hH6x","./util":"4dv8"}],"dt49":[function(require,module,exports) {
|
||
"use strict";var e=require("./constants"),r=require("./util"),t=r.encodeText,n=r.decodeText,o=r.concat;function c(e,r){if(!r)throw new Error("requires an encoded Uint8Array");var t=u(e),n=t.name,c=t.codeBuf;return d(n,r),o([c,r],c.length+r.length)}function s(e,r){var n=u(e),c=t(n.encode(r));return o([n.codeBuf,c],n.codeBuf.length+c.length)}function a(e){e instanceof Uint8Array&&(e=n(e));var r=e[0];return["f","F","v","V","t","T","b","B","c","C","h","k","K"].includes(r)&&(e=e.toLowerCase()),u(e[0]).decode(e.substring(1))}function i(e){if(e instanceof Uint8Array&&(e=n(e)),"[object String]"!==Object.prototype.toString.call(e))return!1;try{return u(e[0]).name}catch(r){return!1}}function d(e,r){u(e).decode(n(r))}function u(r){if(Object.prototype.hasOwnProperty.call(e.names,r))return e.names[r];if(Object.prototype.hasOwnProperty.call(e.codes,r))return e.codes[r];throw new Error("Unsupported encoding: ".concat(r))}function f(e){return e instanceof Uint8Array&&(e=n(e)),u(e[0])}exports=module.exports=c,exports.encode=s,exports.decode=a,exports.isEncoded=i,exports.encoding=u,exports.encodingFromData=f;var p=Object.freeze(e.names),l=Object.freeze(e.codes);exports.names=p,exports.codes=l;
|
||
},{"./constants":"OJdg","./util":"4dv8"}],"CtpW":[function(require,module,exports) {
|
||
module.exports={encode:require("./encode.js"),decode:require("./decode.js"),encodingLength:require("./length.js")};
|
||
},{"./encode.js":"Q/oY","./decode.js":"J29v","./length.js":"Bq+a"}],"OjRh":[function(require,module,exports) {
|
||
"use strict";const{encoding:e}=require("multibase"),t=new TextDecoder("utf8");function n(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t}function r(r,o="utf8"){return"utf8"===o||"utf-8"===o?t.decode(r):"ascii"===o?n(r):e(o).encode(r)}module.exports=r;
|
||
},{"multibase":"dt49"}],"K/qe":[function(require,module,exports) {
|
||
"use strict";const{encoding:e}=require("multibase"),t=new TextEncoder;function n(e){const t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}function r(r,o="utf8"){return"utf8"===o||"utf-8"===o?t.encode(r):"ascii"===o?n(r):e(o).decode(r)}module.exports=r;
|
||
},{"multibase":"dt49"}],"LZvZ":[function(require,module,exports) {
|
||
"use strict";var r=require("multibase"),e=require("varint"),n=require("./constants"),t=n.names,o=require("uint8arrays/to-string"),i=require("uint8arrays/from-string"),a=require("uint8arrays/concat"),c={};for(var s in t){var u=s;c[t[u]]=u}function d(r){if(!(r instanceof Uint8Array))throw new Error("must be passed a Uint8Array");return o(r,"base16")}function h(r){return i(r,"base16")}function f(e){if(!(e instanceof Uint8Array))throw new Error("must be passed a Uint8Array");return o(r.encode("base58btc",e)).slice(1)}function l(e){var n=e instanceof Uint8Array?o(e):e;return r.decode("z"+n)}function w(r){if(!(r instanceof Uint8Array))throw new Error("multihash must be a Uint8Array");if(r.length<2)throw new Error("multihash too short. must be > 2 bytes.");var n=e.decode(r);if(!y(n))throw new Error("multihash unknown function code: 0x".concat(n.toString(16)));r=r.slice(e.decode.bytes);var t=e.decode(r);if(t<0)throw new Error("multihash invalid length: ".concat(t));if((r=r.slice(e.decode.bytes)).length!==t)throw new Error("multihash length inconsistent: 0x".concat(o(r,"base16")));return{code:n,name:c[n],length:t,digest:r}}function g(r,n,t){if(!r||void 0===n)throw new Error("multihash encode requires at least two args: digest, code");var o=m(n);if(!(r instanceof Uint8Array))throw new Error("digest should be a Uint8Array");if(null==t&&(t=r.length),t&&r.length!==t)throw new Error("digest length should be equal to specified length.");var i=e.encode(o),c=e.encode(t);return a([i,c,r],i.length+c.length+r.length)}function m(r){var e=r;if("string"==typeof r){if(void 0===t[r])throw new Error("Unrecognized hash function named: ".concat(r));e=t[r]}if("number"!=typeof e)throw new Error("Hash function code should be a number. Got: ".concat(e));if(void 0===c[e]&&!b(e))throw new Error("Unrecognized function code: ".concat(e));return e}function b(r){return r>0&&r<16}function y(r){return!!b(r)||!!c[r]}function v(r){w(r)}function E(r){return v(r),r.subarray(0,2)}Object.freeze(c),module.exports={names:t,codes:c,toHexString:d,fromHexString:h,toB58String:f,fromB58String:l,decode:w,encode:g,coerceCode:m,isAppCode:b,validate:v,prefix:E,isValidCode:y};
|
||
},{"multibase":"dt49","varint":"CtpW","./constants":"AwpH","uint8arrays/to-string":"OjRh","uint8arrays/from-string":"K/qe","uint8arrays/concat":"qYui"}],"TU2Y":[function(require,module,exports) {
|
||
"use strict";const r=require("varint"),n=require("uint8arrays/to-string"),t=require("uint8arrays/from-string");function e(r){return parseInt(n(r,"base16"),16)}function i(r){let n=r.toString(16);return n.length%2==1&&(n="0"+n),t(n,"base16")}function o(n){return Uint8Array.from(r.encode(e(n)))}function u(n){return Uint8Array.from(r.encode(n))}module.exports={numberToUint8Array:i,uint8ArrayToNumber:e,varintUint8ArrayEncode:o,varintEncode:u};
|
||
},{"varint":"CtpW","uint8arrays/to-string":"OjRh","uint8arrays/from-string":"K/qe"}],"pq2+":[function(require,module,exports) {
|
||
"use strict";const{baseTable:e}=require("./generated-table"),t=require("./util").varintEncode,o={},r={},c={};for(const a in e){const n=a,s=e[n];o[n]=t(s),r[n.toUpperCase().replace(/-/g,"_")]=s,c[s]||(c[s]=n)}Object.freeze(o),Object.freeze(r),Object.freeze(c);const n=Object.freeze(e);module.exports={nameToVarint:o,constantToCode:r,nameToCode:n,codeToName:c};
|
||
},{"./generated-table":"oX+Q","./util":"TU2Y"}],"NCMh":[function(require,module,exports) {
|
||
"use strict";const e=require("varint"),n=require("uint8arrays/concat"),r=require("./util"),{nameToVarint:t,constantToCode:o,nameToCode:i,codeToName:u}=require("./maps");function c(e,o){let i;if(e instanceof Uint8Array)i=r.varintUint8ArrayEncode(e);else{if(!t[e])throw new Error("multicodec not recognized");i=t[e]}return n([i,o],i.length+o.length)}function d(n){return e.decode(n),n.slice(e.decode.bytes)}function a(n){const r=e.decode(n),t=u[r];if(void 0===t)throw new Error(`Code "${r}" not found`);return t}function f(e){return u[e]}function m(e){const n=i[e];if(void 0===n)throw new Error(`Codec "${e}" not found`);return n}function g(n){return e.decode(n)}function s(e){const n=t[e];if(void 0===n)throw new Error(`Codec "${e}" not found`);return n}function C(e){return r.varintEncode(e)}function l(e){return a(e)}function w(e){return f(e)}function N(e){return m(e)}function T(e){return g(e)}function h(e){return s(e)}function v(e){return Array.from(C(e))}module.exports={addPrefix:c,rmPrefix:d,getNameFromData:a,getNameFromCode:f,getCodeFromName:m,getCodeFromData:g,getVarintFromName:s,getVarintFromCode:C,getCodec:l,getName:w,getNumber:N,getCode:T,getCodeVarint:h,getVarint:v,...o,nameToVarint:t,nameToCode:i,codeToName:u};
|
||
},{"varint":"CtpW","uint8arrays/concat":"qYui","./util":"TU2Y","./maps":"pq2+"}],"EKGL":[function(require,module,exports) {
|
||
"use strict";const e=require("multihashes"),t={checkCIDComponents:function(t){if(null==t)return"null values are not valid CIDs";if(0!==t.version&&1!==t.version)return"Invalid version, must be a number equal to 1 or 0";if("string"!=typeof t.codec)return"codec must be string";if(0===t.version){if("dag-pb"!==t.codec)return"codec must be 'dag-pb' for CIDv0";if("base58btc"!==t.multibaseName)return"multibaseName must be 'base58btc' for CIDv0"}if(!(t.multihash instanceof Uint8Array))return"multihash must be a Uint8Array";try{e.validate(t.multihash)}catch(r){let e=r.message;return e||(e="Multihash validation failed"),e}}};module.exports=t;
|
||
},{"multihashes":"LZvZ"}],"gAYb":[function(require,module,exports) {
|
||
"use strict";const t=require("multihashes"),e=require("multibase"),i=require("multicodec"),s=require("./cid-util"),r=require("uint8arrays/concat"),o=require("uint8arrays/to-string"),h=require("uint8arrays/equals"),n=i.nameToCode,a=Object.keys(n).reduce((t,e)=>(t[n[e]]=e,t),{}),c=Symbol.for("@ipld/js-cid/CID");class u{constructor(s,r,o,h){if(this.version,this.codec,this.multihash,Object.defineProperty(this,c,{value:!0}),u.isCID(s)){const t=s;return this.version=t.version,this.codec=t.codec,this.multihash=t.multihash,void(this.multibaseName=t.multibaseName||(0===t.version?"base58btc":"base32"))}if("string"==typeof s){const r=e.isEncoded(s);if(r){const t=e.decode(s);this.version=parseInt(t[0].toString(),16),this.codec=i.getCodec(t.slice(1)),this.multihash=i.rmPrefix(t.slice(1)),this.multibaseName=r}else this.version=0,this.codec="dag-pb",this.multihash=t.fromB58String(s),this.multibaseName="base58btc";return u.validateCID(this),void Object.defineProperty(this,"string",{value:s})}if(s instanceof Uint8Array){const t=parseInt(s[0].toString(),16);if(1===t){const e=s;this.version=t,this.codec=i.getCodec(e.slice(1)),this.multihash=i.rmPrefix(e.slice(1)),this.multibaseName="base32"}else this.version=0,this.codec="dag-pb",this.multihash=s,this.multibaseName="base58btc";u.validateCID(this)}else this.version=s,"number"==typeof r&&(r=a[r]),this.codec=r,this.multihash=o,this.multibaseName=h||(0===s?"base58btc":"base32"),u.validateCID(this)}get bytes(){let t=this._bytes;if(!t){if(0===this.version)t=this.multihash;else{if(1!==this.version)throw new Error("unsupported version");{const e=i.getCodeVarint(this.codec);t=r([[1],e,this.multihash],1+e.byteLength+this.multihash.byteLength)}}Object.defineProperty(this,"_bytes",{value:t})}return t}get prefix(){const e=i.getCodeVarint(this.codec),s=t.prefix(this.multihash);return r([[this.version],e,s],1+e.byteLength+s.byteLength)}get code(){return n[this.codec]}toV0(){if("dag-pb"!==this.codec)throw new Error("Cannot convert a non dag-pb CID to CIDv0");const{name:e,length:i}=t.decode(this.multihash);if("sha2-256"!==e)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");if(32!==i)throw new Error("Cannot convert non 32 byte multihash CID to CIDv0");return new u(0,this.codec,this.multihash)}toV1(){return new u(1,this.codec,this.multihash)}toBaseEncodedString(i=this.multibaseName){if(this.string&&0!==this.string.length&&i===this.multibaseName)return this.string;let s;if(0===this.version){if("base58btc"!==i)throw new Error("not supported with CIDv0, to support different bases, please migrate the instance do CIDv1, you can do that through cid.toV1()");s=t.toB58String(this.multihash)}else{if(1!==this.version)throw new Error("unsupported version");s=o(e.encode(i,this.bytes))}return i===this.multibaseName&&Object.defineProperty(this,"string",{value:s}),s}[Symbol.for("nodejs.util.inspect.custom")](){return"CID("+this.toString()+")"}toString(t){return this.toBaseEncodedString(t)}toJSON(){return{codec:this.codec,version:this.version,hash:this.multihash}}equals(t){return this.codec===t.codec&&this.version===t.version&&h(this.multihash,t.multihash)}static validateCID(t){const e=s.checkCIDComponents(t);if(e)throw new Error(e)}static isCID(t){return t instanceof u||Boolean(t&&t[c])}}u.codecs=n,module.exports=u;
|
||
},{"multihashes":"LZvZ","multibase":"dt49","multicodec":"NCMh","./cid-util":"EKGL","uint8arrays/concat":"qYui","uint8arrays/to-string":"OjRh","uint8arrays/equals":"mZxc"}],"vixE":[function(require,module,exports) {
|
||
"use strict";module.exports=i;var t=require("../util/minimal");function i(t,i){this.lo=t>>>0,this.hi=i>>>0}var o=i.zero=new i(0,0);o.toNumber=function(){return 0},o.zzEncode=o.zzDecode=function(){return this},o.length=function(){return 1};var r=i.zeroHash="\0\0\0\0\0\0\0\0";i.fromNumber=function(t){if(0===t)return o;var r=t<0;r&&(t=-t);var h=t>>>0,n=(t-h)/4294967296>>>0;return r&&(n=~n>>>0,h=~h>>>0,++h>4294967295&&(h=0,++n>4294967295&&(n=0))),new i(h,n)},i.from=function(r){if("number"==typeof r)return i.fromNumber(r);if(t.isString(r)){if(!t.Long)return i.fromNumber(parseInt(r,10));r=t.Long.fromString(r)}return r.low||r.high?new i(r.low>>>0,r.high>>>0):o},i.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var i=1+~this.lo>>>0,o=~this.hi>>>0;return i||(o=o+1>>>0),-(i+4294967296*o)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(i){return t.Long?new t.Long(0|this.lo,0|this.hi,Boolean(i)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(i)}};var h=String.prototype.charCodeAt;i.fromHash=function(t){return t===r?o:new i((h.call(t,0)|h.call(t,1)<<8|h.call(t,2)<<16|h.call(t,3)<<24)>>>0,(h.call(t,4)|h.call(t,5)<<8|h.call(t,6)<<16|h.call(t,7)<<24)>>>0)},i.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},i.prototype.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this},i.prototype.zzDecode=function(){var t=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this},i.prototype.length=function(){var t=this.lo,i=(this.lo>>>28|this.hi<<4)>>>0,o=this.hi>>>24;return 0===o?0===i?t<16384?t<128?1:2:t<2097152?3:4:i<16384?i<128?5:6:i<2097152?7:8:o<128?9:10};
|
||
},{"../util/minimal":"ftAO"}],"ftAO":[function(require,module,exports) {
|
||
var global = arguments[3];
|
||
var Buffer = require("buffer").Buffer;
|
||
var e=arguments[3],r=require("buffer").Buffer,t=exports;function n(e,r,t){for(var n=Object.keys(r),o=0;o<n.length;++o)void 0!==e[n[o]]&&t||(e[n[o]]=r[n[o]]);return e}function o(e){function r(e,t){if(!(this instanceof r))return new r(e,t);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,r):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),t&&n(this,t)}return(r.prototype=Object.create(Error.prototype)).constructor=r,Object.defineProperty(r.prototype,"name",{get:function(){return e}}),r.prototype.toString=function(){return this.name+": "+this.message},r}t.asPromise=require("@protobufjs/aspromise"),t.base64=require("@protobufjs/base64"),t.EventEmitter=require("@protobufjs/eventemitter"),t.float=require("@protobufjs/float"),t.inquire=require("@protobufjs/inquire"),t.utf8=require("@protobufjs/utf8"),t.pool=require("@protobufjs/pool"),t.LongBits=require("./longbits"),t.isNode=Boolean(void 0!==e&&e&&e.process&&e.process.versions&&e.process.versions.node),t.global=t.isNode&&e||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||this,t.emptyArray=Object.freeze?Object.freeze([]):[],t.emptyObject=Object.freeze?Object.freeze({}):{},t.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},t.isString=function(e){return"string"==typeof e||e instanceof String},t.isObject=function(e){return e&&"object"==typeof e},t.isset=t.isSet=function(e,r){var t=e[r];return!(null==t||!e.hasOwnProperty(r))&&("object"!=typeof t||(Array.isArray(t)?t.length:Object.keys(t).length)>0)},t.Buffer=function(){try{var e=t.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(r){return null}}(),t._Buffer_from=null,t._Buffer_allocUnsafe=null,t.newBuffer=function(e){return"number"==typeof e?t.Buffer?t._Buffer_allocUnsafe(e):new t.Array(e):t.Buffer?t._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},t.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,t.Long=t.global.dcodeIO&&t.global.dcodeIO.Long||t.global.Long||t.inquire("long"),t.key2Re=/^true|false|0|1$/,t.key32Re=/^-?(?:0|[1-9][0-9]*)$/,t.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,t.longToHash=function(e){return e?t.LongBits.from(e).toHash():t.LongBits.zeroHash},t.longFromHash=function(e,r){var n=t.LongBits.fromHash(e);return t.Long?t.Long.fromBits(n.lo,n.hi,r):n.toNumber(Boolean(r))},t.merge=n,t.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},t.newError=o,t.ProtocolError=o("ProtocolError"),t.oneOfGetter=function(e){for(var r={},t=0;t<e.length;++t)r[e[t]]=1;return function(){for(var e=Object.keys(this),t=e.length-1;t>-1;--t)if(1===r[e[t]]&&void 0!==this[e[t]]&&null!==this[e[t]])return e[t]}},t.oneOfSetter=function(e){return function(r){for(var t=0;t<e.length;++t)e[t]!==r&&delete this[e[t]]}},t.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},t._configure=function(){var e=t.Buffer;e?(t._Buffer_from=e.from!==Uint8Array.from&&e.from||function(r,t){return new e(r,t)},t._Buffer_allocUnsafe=e.allocUnsafe||function(r){return new e(r)}):t._Buffer_from=t._Buffer_allocUnsafe=null};
|
||
},{"@protobufjs/aspromise":"AnsR","@protobufjs/base64":"08vA","@protobufjs/eventemitter":"rQUj","@protobufjs/float":"lW0B","@protobufjs/inquire":"eAoq","@protobufjs/utf8":"UiC1","@protobufjs/pool":"qHDJ","./longbits":"vixE","buffer":"z1tx"}],"/Abr":[function(require,module,exports) {
|
||
"use strict";module.exports=u;var t,i=require("./util/minimal"),n=i.LongBits,e=i.base64,o=i.utf8;function r(t,i,n){this.fn=t,this.len=i,this.next=void 0,this.val=n}function s(){}function h(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function u(){this.len=0,this.head=new r(s,0,0),this.tail=this.head,this.states=null}var l=function(){return i.Buffer?function(){return(u.create=function(){return new t})()}:function(){return new u}};function p(t,i,n){i[n]=255&t}function a(t,i,n){for(;t>127;)i[n++]=127&t|128,t>>>=7;i[n]=t}function f(t,i){this.len=t,this.next=void 0,this.val=i}function c(t,i,n){for(;t.hi;)i[n++]=127&t.lo|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)i[n++]=127&t.lo|128,t.lo=t.lo>>>7;i[n++]=t.lo}function y(t,i,n){i[n]=255&t,i[n+1]=t>>>8&255,i[n+2]=t>>>16&255,i[n+3]=t>>>24}u.create=l(),u.alloc=function(t){return new i.Array(t)},i.Array!==Array&&(u.alloc=i.pool(u.alloc,i.Array.prototype.subarray)),u.prototype._push=function(t,i,n){return this.tail=this.tail.next=new r(t,i,n),this.len+=i,this},f.prototype=Object.create(r.prototype),f.prototype.fn=a,u.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new f((t>>>=0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this},u.prototype.int32=function(t){return t<0?this._push(c,10,n.fromNumber(t)):this.uint32(t)},u.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)},u.prototype.uint64=function(t){var i=n.from(t);return this._push(c,i.length(),i)},u.prototype.int64=u.prototype.uint64,u.prototype.sint64=function(t){var i=n.from(t).zzEncode();return this._push(c,i.length(),i)},u.prototype.bool=function(t){return this._push(p,1,t?1:0)},u.prototype.fixed32=function(t){return this._push(y,4,t>>>0)},u.prototype.sfixed32=u.prototype.fixed32,u.prototype.fixed64=function(t){var i=n.from(t);return this._push(y,4,i.lo)._push(y,4,i.hi)},u.prototype.sfixed64=u.prototype.fixed64,u.prototype.float=function(t){return this._push(i.float.writeFloatLE,4,t)},u.prototype.double=function(t){return this._push(i.float.writeDoubleLE,8,t)};var d=i.Array.prototype.set?function(t,i,n){i.set(t,n)}:function(t,i,n){for(var e=0;e<t.length;++e)i[n+e]=t[e]};u.prototype.bytes=function(t){var n=t.length>>>0;if(!n)return this._push(p,1,0);if(i.isString(t)){var o=u.alloc(n=e.length(t));e.decode(t,o,0),t=o}return this.uint32(n)._push(d,n,t)},u.prototype.string=function(t){var i=o.length(t);return i?this.uint32(i)._push(o.write,i,t):this._push(p,1,0)},u.prototype.fork=function(){return this.states=new h(this),this.head=this.tail=new r(s,0,0),this.len=0,this},u.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new r(s,0,0),this.len=0),this},u.prototype.ldelim=function(){var t=this.head,i=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=t.next,this.tail=i,this.len+=n),this},u.prototype.finish=function(){for(var t=this.head.next,i=this.constructor.alloc(this.len),n=0;t;)t.fn(t.val,i,n),n+=t.len,t=t.next;return i},u._configure=function(i){t=i,u.create=l(),t._configure()};
|
||
},{"./util/minimal":"ftAO"}],"PN8b":[function(require,module,exports) {
|
||
"use strict";module.exports=r;var t=require("./writer");(r.prototype=Object.create(t.prototype)).constructor=r;var e=require("./util/minimal");function r(){t.call(this)}function i(t,r,i){t.length<40?e.utf8.write(t,r,i):r.utf8Write?r.utf8Write(t,i):r.write(t,i)}r._configure=function(){r.alloc=e._Buffer_allocUnsafe,r.writeBytesBuffer=e.Buffer&&e.Buffer.prototype instanceof Uint8Array&&"set"===e.Buffer.prototype.set.name?function(t,e,r){e.set(t,r)}:function(t,e,r){if(t.copy)t.copy(e,r,0,t.length);else for(var i=0;i<t.length;)e[r++]=t[i++]}},r.prototype.bytes=function(t){e.isString(t)&&(t=e._Buffer_from(t,"base64"));var i=t.length>>>0;return this.uint32(i),i&&this._push(r.writeBytesBuffer,i,t),this},r.prototype.string=function(t){var r=e.Buffer.byteLength(t);return this.uint32(r),r&&this._push(i,r,t),this},r._configure();
|
||
},{"./writer":"/Abr","./util/minimal":"ftAO"}],"4Mrj":[function(require,module,exports) {
|
||
"use strict";module.exports=h;var t,i=require("./util/minimal"),s=i.LongBits,r=i.utf8;function o(t,i){return RangeError("index out of range: "+t.pos+" + "+(i||1)+" > "+t.len)}function h(t){this.buf=t,this.pos=0,this.len=t.length}var n="undefined"!=typeof Uint8Array?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new h(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new h(t);throw Error("illegal buffer")},e=function(){return i.Buffer?function(s){return(h.create=function(s){return i.Buffer.isBuffer(s)?new t(s):n(s)})(s)}:n};function u(){var t=new s(0,0),i=0;if(!(this.len-this.pos>4)){for(;i<3;++i){if(this.pos>=this.len)throw o(this);if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*i)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(127&this.buf[this.pos++])<<7*i)>>>0,t}for(;i<4;++i)if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*i)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(127&this.buf[this.pos])<<28)>>>0,t.hi=(t.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return t;if(i=0,this.len-this.pos>4){for(;i<5;++i)if(t.hi=(t.hi|(127&this.buf[this.pos])<<7*i+3)>>>0,this.buf[this.pos++]<128)return t}else for(;i<5;++i){if(this.pos>=this.len)throw o(this);if(t.hi=(t.hi|(127&this.buf[this.pos])<<7*i+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}function f(t,i){return(t[i-4]|t[i-3]<<8|t[i-2]<<16|t[i-1]<<24)>>>0}function p(){if(this.pos+8>this.len)throw o(this,8);return new s(f(this.buf,this.pos+=4),f(this.buf,this.pos+=4))}h.create=e(),h.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,h.prototype.uint32=function(){var t=4294967295;return function(){if(t=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return t;if(t=(t|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return t;if(t=(t|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return t;if(t=(t|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return t;if(t=(t|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return t;if((this.pos+=5)>this.len)throw this.pos=this.len,o(this,10);return t}}(),h.prototype.int32=function(){return 0|this.uint32()},h.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(1&t)|0},h.prototype.bool=function(){return 0!==this.uint32()},h.prototype.fixed32=function(){if(this.pos+4>this.len)throw o(this,4);return f(this.buf,this.pos+=4)},h.prototype.sfixed32=function(){if(this.pos+4>this.len)throw o(this,4);return 0|f(this.buf,this.pos+=4)},h.prototype.float=function(){if(this.pos+4>this.len)throw o(this,4);var t=i.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t},h.prototype.double=function(){if(this.pos+8>this.len)throw o(this,4);var t=i.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t},h.prototype.bytes=function(){var t=this.uint32(),i=this.pos,s=this.pos+t;if(s>this.len)throw o(this,t);return this.pos+=t,Array.isArray(this.buf)?this.buf.slice(i,s):i===s?new this.buf.constructor(0):this._slice.call(this.buf,i,s)},h.prototype.string=function(){var t=this.bytes();return r.read(t,0,t.length)},h.prototype.skip=function(t){if("number"==typeof t){if(this.pos+t>this.len)throw o(this,t);this.pos+=t}else do{if(this.pos>=this.len)throw o(this)}while(128&this.buf[this.pos++]);return this},h.prototype.skipType=function(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(t=7&this.uint32());)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this},h._configure=function(s){t=s,h.create=e(),t._configure();var r=i.Long?"toLong":"toNumber";i.merge(h.prototype,{int64:function(){return u.call(this)[r](!1)},uint64:function(){return u.call(this)[r](!0)},sint64:function(){return u.call(this).zzDecode()[r](!1)},fixed64:function(){return p.call(this)[r](!0)},sfixed64:function(){return p.call(this)[r](!1)}})};
|
||
},{"./util/minimal":"ftAO"}],"o5om":[function(require,module,exports) {
|
||
"use strict";module.exports=e;var t=require("./reader");(e.prototype=Object.create(t.prototype)).constructor=e;var i=require("./util/minimal");function e(i){t.call(this,i)}e._configure=function(){i.Buffer&&(e.prototype._slice=i.Buffer.prototype.slice)},e.prototype.string=function(){var t=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+t,this.len))},e._configure();
|
||
},{"./reader":"4Mrj","./util/minimal":"ftAO"}],"cjnF":[function(require,module,exports) {
|
||
"use strict";module.exports=t;var e=require("../util/minimal");function t(t,r,i){if("function"!=typeof t)throw TypeError("rpcImpl must be a function");e.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=Boolean(r),this.responseDelimited=Boolean(i)}(t.prototype=Object.create(e.EventEmitter.prototype)).constructor=t,t.prototype.rpcCall=function t(r,i,n,o,l){if(!o)throw TypeError("request must be specified");var u=this;if(!l)return e.asPromise(t,u,r,i,n,o);if(u.rpcImpl)try{return u.rpcImpl(r,i[u.requestDelimited?"encodeDelimited":"encode"](o).finish(),function(e,t){if(e)return u.emit("error",e,r),l(e);if(null!==t){if(!(t instanceof n))try{t=n[u.responseDelimited?"decodeDelimited":"decode"](t)}catch(e){return u.emit("error",e,r),l(e)}return u.emit("data",t,r),l(null,t)}u.end(!0)})}catch(c){return u.emit("error",c,r),void setTimeout(function(){l(c)},0)}else setTimeout(function(){l(Error("already ended"))},0)},t.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this};
|
||
},{"../util/minimal":"ftAO"}],"fXeV":[function(require,module,exports) {
|
||
"use strict";var e=exports;e.Service=require("./rpc/service");
|
||
},{"./rpc/service":"cjnF"}],"1mPc":[function(require,module,exports) {
|
||
"use strict";var r=exports;function e(){r.util._configure(),r.Writer._configure(r.BufferWriter),r.Reader._configure(r.BufferReader)}r.build="minimal",r.Writer=require("./writer"),r.BufferWriter=require("./writer_buffer"),r.Reader=require("./reader"),r.BufferReader=require("./reader_buffer"),r.util=require("./util/minimal"),r.rpc=require("./rpc"),r.roots=require("./roots"),r.configure=e,e();
|
||
},{"./writer":"/Abr","./writer_buffer":"PN8b","./reader":"4Mrj","./reader_buffer":"o5om","./util/minimal":"ftAO","./rpc":"fXeV","./roots":"2V3j"}],"/0Lv":[function(require,module,exports) {
|
||
"use strict";module.exports=require("./src/index-minimal");
|
||
},{"./src/index-minimal":"1mPc"}],"6R3o":[function(require,module,exports) {
|
||
"use strict";var e=require("protobufjs/minimal"),t=e.Reader,a=e.Writer,r=e.util,n=e.roots.default||(e.roots.default={});n.KeyType=function(){var e={},t=Object.create(e);return t[e[0]="RSA"]=0,t[e[1]="Ed25519"]=1,t[e[2]="Secp256k1"]=2,t}(),n.PublicKey=function(){function o(e){if(e)for(var t=Object.keys(e),a=0;a<t.length;++a)null!=e[t[a]]&&(this[t[a]]=e[t[a]])}return o.prototype.Type=0,o.prototype.Data=r.newBuffer([]),o.encode=function(e,t){return t||(t=a.create()),t.uint32(8).int32(e.Type),t.uint32(18).bytes(e.Data),t},o.decode=function(e,a){e instanceof t||(e=t.create(e));for(var o=void 0===a?e.len:e.pos+a,i=new n.PublicKey;e.pos<o;){var s=e.uint32();switch(s>>>3){case 1:i.Type=e.int32();break;case 2:i.Data=e.bytes();break;default:e.skipType(7&s)}}if(!i.hasOwnProperty("Type"))throw r.ProtocolError("missing required 'Type'",{instance:i});if(!i.hasOwnProperty("Data"))throw r.ProtocolError("missing required 'Data'",{instance:i});return i},o.fromObject=function(e){if(e instanceof n.PublicKey)return e;var t=new n.PublicKey;switch(e.Type){case"RSA":case 0:t.Type=0;break;case"Ed25519":case 1:t.Type=1;break;case"Secp256k1":case 2:t.Type=2}return null!=e.Data&&("string"==typeof e.Data?r.base64.decode(e.Data,t.Data=r.newBuffer(r.base64.length(e.Data)),0):e.Data.length&&(t.Data=e.Data)),t},o.toObject=function(e,t){t||(t={});var a={};return t.defaults&&(a.Type=t.enums===String?"RSA":0,t.bytes===String?a.Data="":(a.Data=[],t.bytes!==Array&&(a.Data=r.newBuffer(a.Data)))),null!=e.Type&&e.hasOwnProperty("Type")&&(a.Type=t.enums===String?n.KeyType[e.Type]:e.Type),null!=e.Data&&e.hasOwnProperty("Data")&&(a.Data=t.bytes===String?r.base64.encode(e.Data,0,e.Data.length):t.bytes===Array?Array.prototype.slice.call(e.Data):e.Data),a},o.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},o}(),n.PrivateKey=function(){function o(e){if(e)for(var t=Object.keys(e),a=0;a<t.length;++a)null!=e[t[a]]&&(this[t[a]]=e[t[a]])}return o.prototype.Type=0,o.prototype.Data=r.newBuffer([]),o.encode=function(e,t){return t||(t=a.create()),t.uint32(8).int32(e.Type),t.uint32(18).bytes(e.Data),t},o.decode=function(e,a){e instanceof t||(e=t.create(e));for(var o=void 0===a?e.len:e.pos+a,i=new n.PrivateKey;e.pos<o;){var s=e.uint32();switch(s>>>3){case 1:i.Type=e.int32();break;case 2:i.Data=e.bytes();break;default:e.skipType(7&s)}}if(!i.hasOwnProperty("Type"))throw r.ProtocolError("missing required 'Type'",{instance:i});if(!i.hasOwnProperty("Data"))throw r.ProtocolError("missing required 'Data'",{instance:i});return i},o.fromObject=function(e){if(e instanceof n.PrivateKey)return e;var t=new n.PrivateKey;switch(e.Type){case"RSA":case 0:t.Type=0;break;case"Ed25519":case 1:t.Type=1;break;case"Secp256k1":case 2:t.Type=2}return null!=e.Data&&("string"==typeof e.Data?r.base64.decode(e.Data,t.Data=r.newBuffer(r.base64.length(e.Data)),0):e.Data.length&&(t.Data=e.Data)),t},o.toObject=function(e,t){t||(t={});var a={};return t.defaults&&(a.Type=t.enums===String?"RSA":0,t.bytes===String?a.Data="":(a.Data=[],t.bytes!==Array&&(a.Data=r.newBuffer(a.Data)))),null!=e.Type&&e.hasOwnProperty("Type")&&(a.Type=t.enums===String?n.KeyType[e.Type]:e.Type),null!=e.Data&&e.hasOwnProperty("Data")&&(a.Data=t.bytes===String?r.base64.encode(e.Data,0,e.Data.length):t.bytes===Array?Array.prototype.slice.call(e.Data):e.Data),a},o.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},o}(),module.exports=n;
|
||
},{"protobufjs/minimal":"/0Lv"}],"xBWF":[function(require,module,exports) {
|
||
var process = require("process");
|
||
var global = arguments[3];
|
||
var Buffer = require("buffer").Buffer;
|
||
var t=require("process"),e=arguments[3],r=require("buffer").Buffer;function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=require("./forge"),a=require("./baseN"),o=module.exports=i.util=i.util||{};function s(t){if(8!==t&&16!==t&&24!==t&&32!==t)throw new Error("Only 8, 16, 24, or 32 bits supported: "+t)}function u(t){if(this.data="",this.read=0,"string"==typeof t)this.data=t;else if(o.isArrayBuffer(t)||o.isArrayBufferView(t))if(void 0!==r&&t instanceof r)this.data=t.toString("binary");else{var e=new Uint8Array(t);try{this.data=String.fromCharCode.apply(null,e)}catch(a){for(var i=0;i<e.length;++i)this.putByte(e[i])}}else(t instanceof u||"object"===n(t)&&"string"==typeof t.data&&"number"==typeof t.read)&&(this.data=t.data,this.read=t.read);this._constructedStringLength=0}!function(){if(void 0!==t&&t.nextTick,"function"==typeof setImmediate)return o.setImmediate=function(){return setImmediate.apply(void 0,arguments)},void(o.nextTick=function(t){return setImmediate(t)});if(o.setImmediate=function(t){setTimeout(t,0)},"undefined"!=typeof window&&"function"==typeof window.postMessage){var e="forge.setImmediate",r=[];o.setImmediate=function(t){r.push(t),1===r.length&&window.postMessage(e,"*")},window.addEventListener("message",function(t){if(t.source===window&&t.data===e){t.stopPropagation();var n=r.slice();r.length=0,n.forEach(function(t){t()})}},!0)}if("undefined"!=typeof MutationObserver){var n=Date.now(),i=!0,a=document.createElement("div");r=[];new MutationObserver(function(){var t=r.slice();r.length=0,t.forEach(function(t){t()})}).observe(a,{attributes:!0});var s=o.setImmediate;o.setImmediate=function(t){Date.now()-n>15?(n=Date.now(),s(t)):(r.push(t),1===r.length&&a.setAttribute("a",i=!i))}}o.nextTick=o.setImmediate}(),o.isNodejs=void 0!==t&&t.versions&&t.versions.node,o.globalScope=o.isNodejs?e:"undefined"==typeof self?window:self,o.isArray=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},o.isArrayBuffer=function(t){return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer},o.isArrayBufferView=function(t){return t&&o.isArrayBuffer(t.buffer)&&void 0!==t.byteLength},o.ByteBuffer=u,o.ByteStringBuffer=u;var f=4096;function h(t,e){e=e||{},this.read=e.readOffset||0,this.growSize=e.growSize||1024;var r=o.isArrayBuffer(t),n=o.isArrayBufferView(t);if(r||n)return this.data=r?new DataView(t):new DataView(t.buffer,t.byteOffset,t.byteLength),void(this.write="writeOffset"in e?e.writeOffset:this.data.byteLength);this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!=t&&this.putBytes(t),"writeOffset"in e&&(this.write=e.writeOffset)}o.ByteStringBuffer.prototype._optimizeConstructedString=function(t){this._constructedStringLength+=t,this._constructedStringLength>f&&(this.data.substr(0,1),this._constructedStringLength=0)},o.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},o.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},o.ByteStringBuffer.prototype.putByte=function(t){return this.putBytes(String.fromCharCode(t))},o.ByteStringBuffer.prototype.fillWithByte=function(t,e){t=String.fromCharCode(t);for(var r=this.data;e>0;)1&e&&(r+=t),(e>>>=1)>0&&(t+=t);return this.data=r,this._optimizeConstructedString(e),this},o.ByteStringBuffer.prototype.putBytes=function(t){return this.data+=t,this._optimizeConstructedString(t.length),this},o.ByteStringBuffer.prototype.putString=function(t){return this.putBytes(o.encodeUtf8(t))},o.ByteStringBuffer.prototype.putInt16=function(t){return this.putBytes(String.fromCharCode(t>>8&255)+String.fromCharCode(255&t))},o.ByteStringBuffer.prototype.putInt24=function(t){return this.putBytes(String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(255&t))},o.ByteStringBuffer.prototype.putInt32=function(t){return this.putBytes(String.fromCharCode(t>>24&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(255&t))},o.ByteStringBuffer.prototype.putInt16Le=function(t){return this.putBytes(String.fromCharCode(255&t)+String.fromCharCode(t>>8&255))},o.ByteStringBuffer.prototype.putInt24Le=function(t){return this.putBytes(String.fromCharCode(255&t)+String.fromCharCode(t>>8&255)+String.fromCharCode(t>>16&255))},o.ByteStringBuffer.prototype.putInt32Le=function(t){return this.putBytes(String.fromCharCode(255&t)+String.fromCharCode(t>>8&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>24&255))},o.ByteStringBuffer.prototype.putInt=function(t,e){s(e);var r="";do{e-=8,r+=String.fromCharCode(t>>e&255)}while(e>0);return this.putBytes(r)},o.ByteStringBuffer.prototype.putSignedInt=function(t,e){return t<0&&(t+=2<<e-1),this.putInt(t,e)},o.ByteStringBuffer.prototype.putBuffer=function(t){return this.putBytes(t.getBytes())},o.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},o.ByteStringBuffer.prototype.getInt16=function(){var t=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,t},o.ByteStringBuffer.prototype.getInt24=function(){var t=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,t},o.ByteStringBuffer.prototype.getInt32=function(){var t=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,t},o.ByteStringBuffer.prototype.getInt16Le=function(){var t=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,t},o.ByteStringBuffer.prototype.getInt24Le=function(){var t=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,t},o.ByteStringBuffer.prototype.getInt32Le=function(){var t=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,t},o.ByteStringBuffer.prototype.getInt=function(t){s(t);var e=0;do{e=(e<<8)+this.data.charCodeAt(this.read++),t-=8}while(t>0);return e},o.ByteStringBuffer.prototype.getSignedInt=function(t){var e=this.getInt(t),r=2<<t-2;return e>=r&&(e-=r<<1),e},o.ByteStringBuffer.prototype.getBytes=function(t){var e;return t?(t=Math.min(this.length(),t),e=this.data.slice(this.read,this.read+t),this.read+=t):0===t?e="":(e=0===this.read?this.data:this.data.slice(this.read),this.clear()),e},o.ByteStringBuffer.prototype.bytes=function(t){return void 0===t?this.data.slice(this.read):this.data.slice(this.read,this.read+t)},o.ByteStringBuffer.prototype.at=function(t){return this.data.charCodeAt(this.read+t)},o.ByteStringBuffer.prototype.setAt=function(t,e){return this.data=this.data.substr(0,this.read+t)+String.fromCharCode(e)+this.data.substr(this.read+t+1),this},o.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},o.ByteStringBuffer.prototype.copy=function(){var t=o.createBuffer(this.data);return t.read=this.read,t},o.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},o.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},o.ByteStringBuffer.prototype.truncate=function(t){var e=Math.max(0,this.length()-t);return this.data=this.data.substr(this.read,e),this.read=0,this},o.ByteStringBuffer.prototype.toHex=function(){for(var t="",e=this.read;e<this.data.length;++e){var r=this.data.charCodeAt(e);r<16&&(t+="0"),t+=r.toString(16)}return t},o.ByteStringBuffer.prototype.toString=function(){return o.decodeUtf8(this.bytes())},o.DataBuffer=h,o.DataBuffer.prototype.length=function(){return this.write-this.read},o.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},o.DataBuffer.prototype.accommodate=function(t,e){if(this.length()>=t)return this;e=Math.max(e||this.growSize,t);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+e);return n.set(r),this.data=new DataView(n.buffer),this},o.DataBuffer.prototype.putByte=function(t){return this.accommodate(1),this.data.setUint8(this.write++,t),this},o.DataBuffer.prototype.fillWithByte=function(t,e){this.accommodate(e);for(var r=0;r<e;++r)this.data.setUint8(t);return this},o.DataBuffer.prototype.putBytes=function(t,e){if(o.isArrayBufferView(t)){var r=(i=new Uint8Array(t.buffer,t.byteOffset,t.byteLength)).byteLength-i.byteOffset;return this.accommodate(r),new Uint8Array(this.data.buffer,this.write).set(i),this.write+=r,this}if(o.isArrayBuffer(t)){var i=new Uint8Array(t);return this.accommodate(i.byteLength),new Uint8Array(this.data.buffer).set(i,this.write),this.write+=i.byteLength,this}if(t instanceof o.DataBuffer||"object"===n(t)&&"number"==typeof t.read&&"number"==typeof t.write&&o.isArrayBufferView(t.data)){i=new Uint8Array(t.data.byteLength,t.read,t.length());return this.accommodate(i.byteLength),new Uint8Array(t.data.byteLength,this.write).set(i),this.write+=i.byteLength,this}if(t instanceof o.ByteStringBuffer&&(t=t.data,e="binary"),e=e||"binary","string"==typeof t){var a;if("hex"===e)return this.accommodate(Math.ceil(t.length/2)),a=new Uint8Array(this.data.buffer,this.write),this.write+=o.binary.hex.decode(t,a,this.write),this;if("base64"===e)return this.accommodate(3*Math.ceil(t.length/4)),a=new Uint8Array(this.data.buffer,this.write),this.write+=o.binary.base64.decode(t,a,this.write),this;if("utf8"===e&&(t=o.encodeUtf8(t),e="binary"),"binary"===e||"raw"===e)return this.accommodate(t.length),a=new Uint8Array(this.data.buffer,this.write),this.write+=o.binary.raw.decode(a),this;if("utf16"===e)return this.accommodate(2*t.length),a=new Uint16Array(this.data.buffer,this.write),this.write+=o.text.utf16.encode(a),this;throw new Error("Invalid encoding: "+e)}throw Error("Invalid parameter: "+t)},o.DataBuffer.prototype.putBuffer=function(t){return this.putBytes(t),t.clear(),this},o.DataBuffer.prototype.putString=function(t){return this.putBytes(t,"utf16")},o.DataBuffer.prototype.putInt16=function(t){return this.accommodate(2),this.data.setInt16(this.write,t),this.write+=2,this},o.DataBuffer.prototype.putInt24=function(t){return this.accommodate(3),this.data.setInt16(this.write,t>>8&65535),this.data.setInt8(this.write,t>>16&255),this.write+=3,this},o.DataBuffer.prototype.putInt32=function(t){return this.accommodate(4),this.data.setInt32(this.write,t),this.write+=4,this},o.DataBuffer.prototype.putInt16Le=function(t){return this.accommodate(2),this.data.setInt16(this.write,t,!0),this.write+=2,this},o.DataBuffer.prototype.putInt24Le=function(t){return this.accommodate(3),this.data.setInt8(this.write,t>>16&255),this.data.setInt16(this.write,t>>8&65535,!0),this.write+=3,this},o.DataBuffer.prototype.putInt32Le=function(t){return this.accommodate(4),this.data.setInt32(this.write,t,!0),this.write+=4,this},o.DataBuffer.prototype.putInt=function(t,e){s(e),this.accommodate(e/8);do{e-=8,this.data.setInt8(this.write++,t>>e&255)}while(e>0);return this},o.DataBuffer.prototype.putSignedInt=function(t,e){return s(e),this.accommodate(e/8),t<0&&(t+=2<<e-1),this.putInt(t,e)},o.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},o.DataBuffer.prototype.getInt16=function(){var t=this.data.getInt16(this.read);return this.read+=2,t},o.DataBuffer.prototype.getInt24=function(){var t=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,t},o.DataBuffer.prototype.getInt32=function(){var t=this.data.getInt32(this.read);return this.read+=4,t},o.DataBuffer.prototype.getInt16Le=function(){var t=this.data.getInt16(this.read,!0);return this.read+=2,t},o.DataBuffer.prototype.getInt24Le=function(){var t=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,t},o.DataBuffer.prototype.getInt32Le=function(){var t=this.data.getInt32(this.read,!0);return this.read+=4,t},o.DataBuffer.prototype.getInt=function(t){s(t);var e=0;do{e=(e<<8)+this.data.getInt8(this.read++),t-=8}while(t>0);return e},o.DataBuffer.prototype.getSignedInt=function(t){var e=this.getInt(t),r=2<<t-2;return e>=r&&(e-=r<<1),e},o.DataBuffer.prototype.getBytes=function(t){var e;return t?(t=Math.min(this.length(),t),e=this.data.slice(this.read,this.read+t),this.read+=t):0===t?e="":(e=0===this.read?this.data:this.data.slice(this.read),this.clear()),e},o.DataBuffer.prototype.bytes=function(t){return void 0===t?this.data.slice(this.read):this.data.slice(this.read,this.read+t)},o.DataBuffer.prototype.at=function(t){return this.data.getUint8(this.read+t)},o.DataBuffer.prototype.setAt=function(t,e){return this.data.setUint8(t,e),this},o.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},o.DataBuffer.prototype.copy=function(){return new o.DataBuffer(this)},o.DataBuffer.prototype.compact=function(){if(this.read>0){var t=new Uint8Array(this.data.buffer,this.read),e=new Uint8Array(t.byteLength);e.set(t),this.data=new DataView(e),this.write-=this.read,this.read=0}return this},o.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},o.DataBuffer.prototype.truncate=function(t){return this.write=Math.max(0,this.length()-t),this.read=Math.min(this.read,this.write),this},o.DataBuffer.prototype.toHex=function(){for(var t="",e=this.read;e<this.data.byteLength;++e){var r=this.data.getUint8(e);r<16&&(t+="0"),t+=r.toString(16)}return t},o.DataBuffer.prototype.toString=function(t){var e=new Uint8Array(this.data,this.read,this.length());if("binary"===(t=t||"utf8")||"raw"===t)return o.binary.raw.encode(e);if("hex"===t)return o.binary.hex.encode(e);if("base64"===t)return o.binary.base64.encode(e);if("utf8"===t)return o.text.utf8.decode(e);if("utf16"===t)return o.text.utf16.decode(e);throw new Error("Invalid encoding: "+t)},o.createBuffer=function(t,e){return e=e||"raw",void 0!==t&&"utf8"===e&&(t=o.encodeUtf8(t)),new o.ByteBuffer(t)},o.fillString=function(t,e){for(var r="";e>0;)1&e&&(r+=t),(e>>>=1)>0&&(t+=t);return r},o.xorBytes=function(t,e,r){for(var n="",i="",a="",o=0,s=0;r>0;--r,++o)i=t.charCodeAt(o)^e.charCodeAt(o),s>=10&&(n+=a,a="",s=0),a+=String.fromCharCode(i),++s;return n+=a},o.hexToBytes=function(t){var e="",r=0;for(!0&t.length&&(r=1,e+=String.fromCharCode(parseInt(t[0],16)));r<t.length;r+=2)e+=String.fromCharCode(parseInt(t.substr(r,2),16));return e},o.bytesToHex=function(t){return o.createBuffer(t).toHex()},o.int32ToBytes=function(t){return String.fromCharCode(t>>24&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(255&t)};var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],p="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";o.encode64=function(t,e){for(var r,n,i,a="",o="",s=0;s<t.length;)r=t.charCodeAt(s++),n=t.charCodeAt(s++),i=t.charCodeAt(s++),a+=d.charAt(r>>2),a+=d.charAt((3&r)<<4|n>>4),isNaN(n)?a+="==":(a+=d.charAt((15&n)<<2|i>>6),a+=isNaN(i)?"=":d.charAt(63&i)),e&&a.length>e&&(o+=a.substr(0,e)+"\r\n",a=a.substr(e));return o+=a},o.decode64=function(t){t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var e,r,n,i,a="",o=0;o<t.length;)e=c[t.charCodeAt(o++)-43],r=c[t.charCodeAt(o++)-43],n=c[t.charCodeAt(o++)-43],i=c[t.charCodeAt(o++)-43],a+=String.fromCharCode(e<<2|r>>4),64!==n&&(a+=String.fromCharCode((15&r)<<4|n>>2),64!==i&&(a+=String.fromCharCode((3&n)<<6|i)));return a},o.encodeUtf8=function(t){return unescape(encodeURIComponent(t))},o.decodeUtf8=function(t){return decodeURIComponent(escape(t))},o.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:a.encode,decode:a.decode}},o.binary.raw.encode=function(t){return String.fromCharCode.apply(null,t)},o.binary.raw.decode=function(t,e,r){var n=e;n||(n=new Uint8Array(t.length));for(var i=r=r||0,a=0;a<t.length;++a)n[i++]=t.charCodeAt(a);return e?i-r:n},o.binary.hex.encode=o.bytesToHex,o.binary.hex.decode=function(t,e,r){var n=e;n||(n=new Uint8Array(Math.ceil(t.length/2)));var i=0,a=r=r||0;for(1&t.length&&(i=1,n[a++]=parseInt(t[0],16));i<t.length;i+=2)n[a++]=parseInt(t.substr(i,2),16);return e?a-r:n},o.binary.base64.encode=function(t,e){for(var r,n,i,a="",o="",s=0;s<t.byteLength;)r=t[s++],n=t[s++],i=t[s++],a+=d.charAt(r>>2),a+=d.charAt((3&r)<<4|n>>4),isNaN(n)?a+="==":(a+=d.charAt((15&n)<<2|i>>6),a+=isNaN(i)?"=":d.charAt(63&i)),e&&a.length>e&&(o+=a.substr(0,e)+"\r\n",a=a.substr(e));return o+=a},o.binary.base64.decode=function(t,e,r){var n,i,a,o,s=e;s||(s=new Uint8Array(3*Math.ceil(t.length/4))),t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var u=0,f=r=r||0;u<t.length;)n=c[t.charCodeAt(u++)-43],i=c[t.charCodeAt(u++)-43],a=c[t.charCodeAt(u++)-43],o=c[t.charCodeAt(u++)-43],s[f++]=n<<2|i>>4,64!==a&&(s[f++]=(15&i)<<4|a>>2,64!==o&&(s[f++]=(3&a)<<6|o));return e?f-r:s.subarray(0,f)},o.binary.base58.encode=function(t,e){return o.binary.baseN.encode(t,p,e)},o.binary.base58.decode=function(t,e){return o.binary.baseN.decode(t,p,e)},o.text={utf8:{},utf16:{}},o.text.utf8.encode=function(t,e,r){t=o.encodeUtf8(t);var n=e;n||(n=new Uint8Array(t.length));for(var i=r=r||0,a=0;a<t.length;++a)n[i++]=t.charCodeAt(a);return e?i-r:n},o.text.utf8.decode=function(t){return o.decodeUtf8(String.fromCharCode.apply(null,t))},o.text.utf16.encode=function(t,e,r){var n=e;n||(n=new Uint8Array(2*t.length));for(var i=new Uint16Array(n.buffer),a=r=r||0,o=r,s=0;s<t.length;++s)i[o++]=t.charCodeAt(s),a+=2;return e?a-r:n},o.text.utf16.decode=function(t){return String.fromCharCode.apply(null,new Uint16Array(t.buffer))},o.deflate=function(t,e,r){if(e=o.decode64(t.deflate(o.encode64(e)).rval),r){var n=2;32&e.charCodeAt(1)&&(n=6),e=e.substring(n,e.length-4)}return e},o.inflate=function(t,e,r){var n=t.inflate(o.encode64(e)).rval;return null===n?null:o.decode64(n)};var y=function(t,e,r){if(!t)throw new Error("WebStorage not available.");var n;if(null===r?n=t.removeItem(e):(r=o.encode64(JSON.stringify(r)),n=t.setItem(e,r)),void 0!==n&&!0!==n.rval){var i=new Error(n.error.message);throw i.id=n.error.id,i.name=n.error.name,i}},g=function(t,e){if(!t)throw new Error("WebStorage not available.");var r=t.getItem(e);if(t.init)if(null===r.rval){if(r.error){var n=new Error(r.error.message);throw n.id=r.error.id,n.name=r.error.name,n}r=null}else r=r.rval;return null!==r&&(r=JSON.parse(o.decode64(r))),r},l=function(t,e,r,n){var i=g(t,e);null===i&&(i={}),i[r]=n,y(t,e,i)},B=function(t,e,r){var n=g(t,e);return null!==n&&(n=r in n?n[r]:null),n},m=function(t,e,r){var n=g(t,e);if(null!==n&&r in n){delete n[r];var i=!0;for(var a in n){i=!1;break}i&&(n=null),y(t,e,n)}},v=function(t,e){y(t,e,null)},b=function(t,e,r){var n,i=null;void 0===r&&(r=["web","flash"]);var a=!1,o=null;for(var s in r){n=r[s];try{if("flash"===n||"both"===n){if(null===e[0])throw new Error("Flash local storage not available.");i=t.apply(this,e),a="flash"===n}"web"!==n&&"both"!==n||(e[0]=localStorage,i=t.apply(this,e),a=!0)}catch(u){o=u}if(a)break}if(!a)throw o;return i};o.setItem=function(t,e,r,n,i){b(l,arguments,i)},o.getItem=function(t,e,r,n){return b(B,arguments,n)},o.removeItem=function(t,e,r,n){b(m,arguments,n)},o.clearItems=function(t,e,r){b(v,arguments,r)},o.parseUrl=function(t){var e=/^(https?):\/\/([^:&^\/]*):?(\d*)(.*)$/g;e.lastIndex=0;var r=e.exec(t),n=null===r?null:{full:t,scheme:r[1],host:r[2],port:r[3],path:r[4]};return n&&(n.fullHost=n.host,n.port?80!==n.port&&"http"===n.scheme?n.fullHost+=":"+n.port:443!==n.port&&"https"===n.scheme&&(n.fullHost+=":"+n.port):"http"===n.scheme?n.port=80:"https"===n.scheme&&(n.port=443),n.full=n.scheme+"://"+n.fullHost),n};var w=null;o.getQueryVariables=function(t){var e,r=function(t){for(var e={},r=t.split("&"),n=0;n<r.length;n++){var i,a,o=r[n].indexOf("=");o>0?(i=r[n].substring(0,o),a=r[n].substring(o+1)):(i=r[n],a=null),i in e||(e[i]=[]),i in Object.prototype||null===a||e[i].push(unescape(a))}return e};return void 0===t?(null===w&&(w="undefined"!=typeof window&&window.location&&window.location.search?r(window.location.search.substring(1)):{}),e=w):e=r(t),e},o.parseFragment=function(t){var e=t,r="",n=t.indexOf("?");n>0&&(e=t.substring(0,n),r=t.substring(n+1));var i=e.split("/");return i.length>0&&""===i[0]&&i.shift(),{pathString:e,queryString:r,path:i,query:""===r?{}:o.getQueryVariables(r)}},o.makeRequest=function(t){var e=o.parseFragment(t),r={path:e.pathString,query:e.queryString,getPath:function(t){return void 0===t?e.path:e.path[t]},getQuery:function(t,r){var n;return void 0===t?n=e.query:(n=e.query[t])&&void 0!==r&&(n=n[r]),n},getQueryLast:function(t,e){var n=r.getQuery(t);return n?n[n.length-1]:e}};return r},o.makeLink=function(t,e,r){t=jQuery.isArray(t)?t.join("/"):t;var n=jQuery.param(e||{});return r=r||"",t+(n.length>0?"?"+n:"")+(r.length>0?"#"+r:"")},o.isEmpty=function(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0},o.format=function(t){for(var e,r,n=/%./g,i=0,a=[],o=0;e=n.exec(t);){(r=t.substring(o,n.lastIndex-2)).length>0&&a.push(r),o=n.lastIndex;var s=e[0][1];switch(s){case"s":case"o":i<arguments.length?a.push(arguments[1+i++]):a.push("<?>");break;case"%":a.push("%");break;default:a.push("<%"+s+"?>")}}return a.push(t.substring(o)),a.join("")},o.formatNumber=function(t,e,r,n){var i=t,a=isNaN(e=Math.abs(e))?2:e,o=void 0===r?",":r,s=void 0===n?".":n,u=i<0?"-":"",f=parseInt(i=Math.abs(+i||0).toFixed(a),10)+"",h=f.length>3?f.length%3:0;return u+(h?f.substr(0,h)+s:"")+f.substr(h).replace(/(\d{3})(?=\d)/g,"$1"+s)+(a?o+Math.abs(i-f).toFixed(a).slice(2):"")},o.formatSize=function(t){return t=t>=1073741824?o.formatNumber(t/1073741824,2,".","")+" GiB":t>=1048576?o.formatNumber(t/1048576,2,".","")+" MiB":t>=1024?o.formatNumber(t/1024,0)+" KiB":o.formatNumber(t,0)+" bytes"},o.bytesFromIP=function(t){return-1!==t.indexOf(".")?o.bytesFromIPv4(t):-1!==t.indexOf(":")?o.bytesFromIPv6(t):null},o.bytesFromIPv4=function(t){if(4!==(t=t.split(".")).length)return null;for(var e=o.createBuffer(),r=0;r<t.length;++r){var n=parseInt(t[r],10);if(isNaN(n))return null;e.putByte(n)}return e.getBytes()},o.bytesFromIPv6=function(t){for(var e=0,r=2*(8-(t=t.split(":").filter(function(t){return 0===t.length&&++e,!0})).length+e),n=o.createBuffer(),i=0;i<8;++i)if(t[i]&&0!==t[i].length){var a=o.hexToBytes(t[i]);a.length<2&&n.putByte(0),n.putBytes(a)}else n.fillWithByte(0,r),r=0;return n.getBytes()},o.bytesToIP=function(t){return 4===t.length?o.bytesToIPv4(t):16===t.length?o.bytesToIPv6(t):null},o.bytesToIPv4=function(t){if(4!==t.length)return null;for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r));return e.join(".")},o.bytesToIPv6=function(t){if(16!==t.length)return null;for(var e=[],r=[],n=0,i=0;i<t.length;i+=2){for(var a=o.bytesToHex(t[i]+t[i+1]);"0"===a[0]&&"0"!==a;)a=a.substr(1);if("0"===a){var s=r[r.length-1],u=e.length;s&&u===s.end+1?(s.end=u,s.end-s.start>r[n].end-r[n].start&&(n=r.length-1)):r.push({start:u,end:u})}e.push(a)}if(r.length>0){var f=r[n];f.end-f.start>0&&(e.splice(f.start,f.end-f.start+1,""),0===f.start&&e.unshift(""),7===f.end&&e.push(""))}return e.join(":")},o.estimateCores=function(t,e){if("function"==typeof t&&(e=t,t={}),t=t||{},"cores"in o&&!t.update)return e(null,o.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return o.cores=navigator.hardwareConcurrency,e(null,o.cores);if("undefined"==typeof Worker)return o.cores=1,e(null,o.cores);if("undefined"==typeof Blob)return o.cores=2,e(null,o.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(t){for(var e=Date.now(),r=e+4;Date.now()<r;);self.postMessage({st:e,et:r})})}.toString(),")()"],{type:"application/javascript"}));!function t(n,i,a){if(0===i){var s=Math.floor(n.reduce(function(t,e){return t+e},0)/n.length);return o.cores=Math.max(1,s),URL.revokeObjectURL(r),e(null,o.cores)}!function(t,e){for(var n=[],i=[],a=0;a<t;++a){var o=new Worker(r);o.addEventListener("message",function(r){if(i.push(r.data),i.length===t){for(var a=0;a<t;++a)n[a].terminate();e(null,i)}}),n.push(o)}for(var a=0;a<t;++a)n[a].postMessage(a)}(a,function(e,r){n.push(function(t,e){for(var r=[],n=0;n<t;++n)for(var i=e[n],a=r[n]=[],o=0;o<t;++o)if(n!==o){var s=e[o];(i.st>s.st&&i.st<s.et||s.st>i.st&&s.st<i.et)&&a.push(o)}return r.reduce(function(t,e){return Math.max(t,e.length)},0)}(a,r)),t(n,i-1,a)})}([],5,16)};
|
||
},{"./forge":"sQ2N","./baseN":"mhJr","process":"sC8V","buffer":"sC8V"}],"wnpW":[function(require,module,exports) {
|
||
var i=require("./forge");i.pki=i.pki||{};var t=module.exports=i.pki.oids=i.oids=i.oids||{};function e(i,e){t[i]=e,t[e]=i}function s(i,e){t[i]=e}e("1.2.840.113549.1.1.1","rsaEncryption"),e("1.2.840.113549.1.1.4","md5WithRSAEncryption"),e("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),e("1.2.840.113549.1.1.7","RSAES-OAEP"),e("1.2.840.113549.1.1.8","mgf1"),e("1.2.840.113549.1.1.9","pSpecified"),e("1.2.840.113549.1.1.10","RSASSA-PSS"),e("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),e("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),e("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),e("1.3.101.112","EdDSA25519"),e("1.2.840.10040.4.3","dsa-with-sha1"),e("1.3.14.3.2.7","desCBC"),e("1.3.14.3.2.26","sha1"),e("2.16.840.1.101.3.4.2.1","sha256"),e("2.16.840.1.101.3.4.2.2","sha384"),e("2.16.840.1.101.3.4.2.3","sha512"),e("1.2.840.113549.2.5","md5"),e("1.2.840.113549.1.7.1","data"),e("1.2.840.113549.1.7.2","signedData"),e("1.2.840.113549.1.7.3","envelopedData"),e("1.2.840.113549.1.7.4","signedAndEnvelopedData"),e("1.2.840.113549.1.7.5","digestedData"),e("1.2.840.113549.1.7.6","encryptedData"),e("1.2.840.113549.1.9.1","emailAddress"),e("1.2.840.113549.1.9.2","unstructuredName"),e("1.2.840.113549.1.9.3","contentType"),e("1.2.840.113549.1.9.4","messageDigest"),e("1.2.840.113549.1.9.5","signingTime"),e("1.2.840.113549.1.9.6","counterSignature"),e("1.2.840.113549.1.9.7","challengePassword"),e("1.2.840.113549.1.9.8","unstructuredAddress"),e("1.2.840.113549.1.9.14","extensionRequest"),e("1.2.840.113549.1.9.20","friendlyName"),e("1.2.840.113549.1.9.21","localKeyId"),e("1.2.840.113549.1.9.22.1","x509Certificate"),e("1.2.840.113549.1.12.10.1.1","keyBag"),e("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),e("1.2.840.113549.1.12.10.1.3","certBag"),e("1.2.840.113549.1.12.10.1.4","crlBag"),e("1.2.840.113549.1.12.10.1.5","secretBag"),e("1.2.840.113549.1.12.10.1.6","safeContentsBag"),e("1.2.840.113549.1.5.13","pkcs5PBES2"),e("1.2.840.113549.1.5.12","pkcs5PBKDF2"),e("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),e("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),e("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),e("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),e("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),e("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),e("1.2.840.113549.2.7","hmacWithSHA1"),e("1.2.840.113549.2.8","hmacWithSHA224"),e("1.2.840.113549.2.9","hmacWithSHA256"),e("1.2.840.113549.2.10","hmacWithSHA384"),e("1.2.840.113549.2.11","hmacWithSHA512"),e("1.2.840.113549.3.7","des-EDE3-CBC"),e("2.16.840.1.101.3.4.1.2","aes128-CBC"),e("2.16.840.1.101.3.4.1.22","aes192-CBC"),e("2.16.840.1.101.3.4.1.42","aes256-CBC"),e("2.5.4.3","commonName"),e("2.5.4.5","serialName"),e("2.5.4.6","countryName"),e("2.5.4.7","localityName"),e("2.5.4.8","stateOrProvinceName"),e("2.5.4.9","streetAddress"),e("2.5.4.10","organizationName"),e("2.5.4.11","organizationalUnitName"),e("2.5.4.13","description"),e("2.5.4.15","businessCategory"),e("2.5.4.17","postalCode"),e("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),e("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),e("2.16.840.1.113730.1.1","nsCertType"),e("2.16.840.1.113730.1.13","nsComment"),s("2.5.29.1","authorityKeyIdentifier"),s("2.5.29.2","keyAttributes"),s("2.5.29.3","certificatePolicies"),s("2.5.29.4","keyUsageRestriction"),s("2.5.29.5","policyMapping"),s("2.5.29.6","subtreesConstraint"),s("2.5.29.7","subjectAltName"),s("2.5.29.8","issuerAltName"),s("2.5.29.9","subjectDirectoryAttributes"),s("2.5.29.10","basicConstraints"),s("2.5.29.11","nameConstraints"),s("2.5.29.12","policyConstraints"),s("2.5.29.13","basicConstraints"),e("2.5.29.14","subjectKeyIdentifier"),e("2.5.29.15","keyUsage"),s("2.5.29.16","privateKeyUsagePeriod"),e("2.5.29.17","subjectAltName"),e("2.5.29.18","issuerAltName"),e("2.5.29.19","basicConstraints"),s("2.5.29.20","cRLNumber"),s("2.5.29.21","cRLReason"),s("2.5.29.22","expirationDate"),s("2.5.29.23","instructionCode"),s("2.5.29.24","invalidityDate"),s("2.5.29.25","cRLDistributionPoints"),s("2.5.29.26","issuingDistributionPoint"),s("2.5.29.27","deltaCRLIndicator"),s("2.5.29.28","issuingDistributionPoint"),s("2.5.29.29","certificateIssuer"),s("2.5.29.30","nameConstraints"),e("2.5.29.31","cRLDistributionPoints"),e("2.5.29.32","certificatePolicies"),s("2.5.29.33","policyMappings"),s("2.5.29.34","policyConstraints"),e("2.5.29.35","authorityKeyIdentifier"),s("2.5.29.36","policyConstraints"),e("2.5.29.37","extKeyUsage"),s("2.5.29.46","freshestCRL"),s("2.5.29.54","inhibitAnyPolicy"),e("1.3.6.1.4.1.11129.2.4.2","timestampList"),e("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),e("1.3.6.1.5.5.7.3.1","serverAuth"),e("1.3.6.1.5.5.7.3.2","clientAuth"),e("1.3.6.1.5.5.7.3.3","codeSigning"),e("1.3.6.1.5.5.7.3.4","emailProtection"),e("1.3.6.1.5.5.7.3.8","timeStamping");
|
||
},{"./forge":"sQ2N"}],"a/tu":[function(require,module,exports) {
|
||
function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}var t=require("./forge");require("./util"),require("./oids");var r=module.exports=t.asn1=t.asn1||{};function n(e,t,r){if(r>t){var n=new Error("Too few bytes to parse DER.");throw n.available=e.length(),n.remaining=t,n.requested=r,n}}r.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},r.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},r.create=function(e,n,a,s,i){if(t.util.isArray(s)){for(var u=[],o=0;o<s.length;++o)void 0!==s[o]&&u.push(s[o]);s=u}var l={tagClass:e,type:n,constructed:a,composed:a||t.util.isArray(s),value:s};return i&&"bitStringContents"in i&&(l.bitStringContents=i.bitStringContents,l.original=r.copy(l)),l},r.copy=function(e,n){var a;if(t.util.isArray(e)){a=[];for(var s=0;s<e.length;++s)a.push(r.copy(e[s],n));return a}return"string"==typeof e?e:(a={tagClass:e.tagClass,type:e.type,constructed:e.constructed,composed:e.composed,value:r.copy(e.value,n)},n&&!n.excludeBitStringContents&&(a.bitStringContents=e.bitStringContents),a)},r.equals=function(n,a,s){if(t.util.isArray(n)){if(!t.util.isArray(a))return!1;if(n.length!==a.length)return!1;for(var i=0;i<n.length;++i)if(!r.equals(n[i],a[i]))return!1;return!0}if(e(n)!==e(a))return!1;if("string"==typeof n)return n===a;var u=n.tagClass===a.tagClass&&n.type===a.type&&n.constructed===a.constructed&&n.composed===a.composed&&r.equals(n.value,a.value);return s&&s.includeBitStringContents&&(u=u&&n.bitStringContents===a.bitStringContents),u},r.getBerValueLength=function(e){var t=e.getByte();if(128!==t)return 128&t?e.getInt((127&t)<<3):t};var a=function(e,t){var r=e.getByte();if(128!==r){var a;if(128&r){var s=127&r;n(e,--t,s),a=e.getInt(s<<3)}else a=r;if(a<0)throw new Error("Negative length: "+a);return a}};function s(e,t,i,u){var o;n(e,t,2);var l=e.getByte();t--;var p=192&l,c=31&l;o=e.length();var g,T,f=a(e,t);if(t-=o-e.length(),void 0!==f&&f>t){if(u.strict){var v=new Error("Too few bytes to read ASN.1 value.");throw v.available=e.length(),v.remaining=t,v.requested=f,v}f=t}var y=32==(32&l);if(y)if(g=[],void 0===f)for(;;){if(n(e,t,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),t-=2;break}o=e.length(),g.push(s(e,t,i+1,u)),t-=o-e.length()}else for(;f>0;)o=e.length(),g.push(s(e,f,i+1,u)),t-=o-e.length(),f-=o-e.length();if(void 0===g&&p===r.Class.UNIVERSAL&&c===r.Type.BITSTRING&&(T=e.bytes(f)),void 0===g&&u.decodeBitStrings&&p===r.Class.UNIVERSAL&&c===r.Type.BITSTRING&&f>1){var d=e.read,h=t,I=0;if(c===r.Type.BITSTRING&&(n(e,t,1),I=e.getByte(),t--),0===I)try{o=e.length();var C=s(e,t,i+1,{verbose:u.verbose,strict:!0,decodeBitStrings:!0}),b=o-e.length();t-=b,c==r.Type.BITSTRING&&b++;var S=C.tagClass;b!==f||S!==r.Class.UNIVERSAL&&S!==r.Class.CONTEXT_SPECIFIC||(g=[C])}catch(B){}void 0===g&&(e.read=d,t=h)}if(void 0===g){if(void 0===f){if(u.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");f=t}if(c===r.Type.BMPSTRING)for(g="";f>0;f-=2)n(e,t,2),g+=String.fromCharCode(e.getInt16()),t-=2;else g=e.getBytes(f)}var E=void 0===T?null:{bitStringContents:T};return r.create(p,c,y,g,E)}r.fromDer=function(e,r){return void 0===r&&(r={strict:!0,decodeBitStrings:!0}),"boolean"==typeof r&&(r={strict:r,decodeBitStrings:!0}),"strict"in r||(r.strict=!0),"decodeBitStrings"in r||(r.decodeBitStrings=!0),"string"==typeof e&&(e=t.util.createBuffer(e)),s(e,e.length(),0,r)},r.toDer=function(e){var n=t.util.createBuffer(),a=e.tagClass|e.type,s=t.util.createBuffer(),i=!1;if("bitStringContents"in e&&(i=!0,e.original&&(i=r.equals(e,e.original))),i)s.putBytes(e.bitStringContents);else if(e.composed){e.constructed?a|=32:s.putByte(0);for(var u=0;u<e.value.length;++u)void 0!==e.value[u]&&s.putBuffer(r.toDer(e.value[u]))}else if(e.type===r.Type.BMPSTRING)for(u=0;u<e.value.length;++u)s.putInt16(e.value.charCodeAt(u));else e.type===r.Type.INTEGER&&e.value.length>1&&(0===e.value.charCodeAt(0)&&0==(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128==(128&e.value.charCodeAt(1)))?s.putBytes(e.value.substr(1)):s.putBytes(e.value);if(n.putByte(a),s.length()<=127)n.putByte(127&s.length());else{var o=s.length(),l="";do{l+=String.fromCharCode(255&o),o>>>=8}while(o>0);n.putByte(128|l.length);for(u=l.length-1;u>=0;--u)n.putByte(l.charCodeAt(u))}return n.putBuffer(s),n},r.oidToDer=function(e){var r,n,a,s,i=e.split("."),u=t.util.createBuffer();u.putByte(40*parseInt(i[0],10)+parseInt(i[1],10));for(var o=2;o<i.length;++o){r=!0,n=[],a=parseInt(i[o],10);do{s=127&a,a>>>=7,r||(s|=128),n.push(s),r=!1}while(a>0);for(var l=n.length-1;l>=0;--l)u.putByte(n[l])}return u},r.derToOid=function(e){var r;"string"==typeof e&&(e=t.util.createBuffer(e));var n=e.getByte();r=Math.floor(n/40)+"."+n%40;for(var a=0;e.length()>0;)a<<=7,128&(n=e.getByte())?a+=127&n:(r+="."+(a+n),a=0);return r},r.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(e.substr(2,2),10)-1,a=parseInt(e.substr(4,2),10),s=parseInt(e.substr(6,2),10),i=parseInt(e.substr(8,2),10),u=0;if(e.length>11){var o=e.charAt(10),l=10;"+"!==o&&"-"!==o&&(u=parseInt(e.substr(10,2),10),l+=2)}if(t.setUTCFullYear(r,n,a),t.setUTCHours(s,i,u,0),l&&("+"===(o=e.charAt(l))||"-"===o)){var p=60*parseInt(e.substr(l+1,2),10)+parseInt(e.substr(l+4,2),10);p*=6e4,"+"===o?t.setTime(+t-p):t.setTime(+t+p)}return t},r.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),n=parseInt(e.substr(4,2),10)-1,a=parseInt(e.substr(6,2),10),s=parseInt(e.substr(8,2),10),i=parseInt(e.substr(10,2),10),u=parseInt(e.substr(12,2),10),o=0,l=0,p=!1;"Z"===e.charAt(e.length-1)&&(p=!0);var c=e.length-5,g=e.charAt(c);"+"!==g&&"-"!==g||(l=60*parseInt(e.substr(c+1,2),10)+parseInt(e.substr(c+4,2),10),l*=6e4,"+"===g&&(l*=-1),p=!0);return"."===e.charAt(14)&&(o=1e3*parseFloat(e.substr(14),10)),p?(t.setUTCFullYear(r,n,a),t.setUTCHours(s,i,u,o),t.setTime(+t+l)):(t.setFullYear(r,n,a),t.setHours(s,i,u,o)),t},r.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(t+="0"),t+=r[n];return t+="Z"},r.dateToGeneralizedTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push(""+e.getUTCFullYear()),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(t+="0"),t+=r[n];return t+="Z"},r.integerToDer=function(e){var r=t.util.createBuffer();if(e>=-128&&e<128)return r.putSignedInt(e,8);if(e>=-32768&&e<32768)return r.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return r.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return r.putSignedInt(e,32);var n=new Error("Integer too large; max is 32-bits.");throw n.integer=e,n},r.derToInteger=function(e){"string"==typeof e&&(e=t.util.createBuffer(e));var r=8*e.length();if(r>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(r)},r.validate=function(e,n,a,s){var i=!1;if(e.tagClass!==n.tagClass&&void 0!==n.tagClass||e.type!==n.type&&void 0!==n.type)s&&(e.tagClass!==n.tagClass&&s.push("["+n.name+'] Expected tag class "'+n.tagClass+'", got "'+e.tagClass+'"'),e.type!==n.type&&s.push("["+n.name+'] Expected type "'+n.type+'", got "'+e.type+'"'));else if(e.constructed===n.constructed||void 0===n.constructed){if(i=!0,n.value&&t.util.isArray(n.value))for(var u=0,o=0;i&&o<n.value.length;++o)i=n.value[o].optional||!1,e.value[u]&&((i=r.validate(e.value[u],n.value[o],a,s))?++u:n.value[o].optional&&(i=!0)),!i&&s&&s.push("["+n.name+'] Tag class "'+n.tagClass+'", type "'+n.type+'" expected value length "'+n.value.length+'", got "'+e.value.length+'"');if(i&&a)if(n.capture&&(a[n.capture]=e.value),n.captureAsn1&&(a[n.captureAsn1]=e),n.captureBitStringContents&&"bitStringContents"in e&&(a[n.captureBitStringContents]=e.bitStringContents),n.captureBitStringValue&&"bitStringContents"in e)if(e.bitStringContents.length<2)a[n.captureBitStringValue]="";else{if(0!==e.bitStringContents.charCodeAt(0))throw new Error("captureBitStringValue only supported for zero unused bits");a[n.captureBitStringValue]=e.bitStringContents.slice(1)}}else s&&s.push("["+n.name+'] Expected constructed "'+n.constructed+'", got "'+e.constructed+'"');return i};var i=/[^\\u0000-\\u00ff]/;r.prettyPrint=function(e,n,a){var s="";a=a||2,(n=n||0)>0&&(s+="\n");for(var u="",o=0;o<n*a;++o)u+=" ";switch(s+=u+"Tag: ",e.tagClass){case r.Class.UNIVERSAL:s+="Universal:";break;case r.Class.APPLICATION:s+="Application:";break;case r.Class.CONTEXT_SPECIFIC:s+="Context-Specific:";break;case r.Class.PRIVATE:s+="Private:"}if(e.tagClass===r.Class.UNIVERSAL)switch(s+=e.type,e.type){case r.Type.NONE:s+=" (None)";break;case r.Type.BOOLEAN:s+=" (Boolean)";break;case r.Type.INTEGER:s+=" (Integer)";break;case r.Type.BITSTRING:s+=" (Bit string)";break;case r.Type.OCTETSTRING:s+=" (Octet string)";break;case r.Type.NULL:s+=" (Null)";break;case r.Type.OID:s+=" (Object Identifier)";break;case r.Type.ODESC:s+=" (Object Descriptor)";break;case r.Type.EXTERNAL:s+=" (External or Instance of)";break;case r.Type.REAL:s+=" (Real)";break;case r.Type.ENUMERATED:s+=" (Enumerated)";break;case r.Type.EMBEDDED:s+=" (Embedded PDV)";break;case r.Type.UTF8:s+=" (UTF8)";break;case r.Type.ROID:s+=" (Relative Object Identifier)";break;case r.Type.SEQUENCE:s+=" (Sequence)";break;case r.Type.SET:s+=" (Set)";break;case r.Type.PRINTABLESTRING:s+=" (Printable String)";break;case r.Type.IA5String:s+=" (IA5String (ASCII))";break;case r.Type.UTCTIME:s+=" (UTC time)";break;case r.Type.GENERALIZEDTIME:s+=" (Generalized time)";break;case r.Type.BMPSTRING:s+=" (BMP String)"}else s+=e.type;if(s+="\n",s+=u+"Constructed: "+e.constructed+"\n",e.composed){var l=0,p="";for(o=0;o<e.value.length;++o)void 0!==e.value[o]&&(l+=1,p+=r.prettyPrint(e.value[o],n+1,a),o+1<e.value.length&&(p+=","));s+=u+"Sub values: "+l+p}else{if(s+=u+"Value: ",e.type===r.Type.OID){var c=r.derToOid(e.value);s+=c,t.pki&&t.pki.oids&&c in t.pki.oids&&(s+=" ("+t.pki.oids[c]+") ")}if(e.type===r.Type.INTEGER)try{s+=r.derToInteger(e.value)}catch(T){s+="0x"+t.util.bytesToHex(e.value)}else if(e.type===r.Type.BITSTRING){if(e.value.length>1?s+="0x"+t.util.bytesToHex(e.value.slice(1)):s+="(none)",e.value.length>0){var g=e.value.charCodeAt(0);1==g?s+=" (1 unused bit shown)":g>1&&(s+=" ("+g+" unused bits shown)")}}else e.type===r.Type.OCTETSTRING?(i.test(e.value)||(s+="("+e.value+") "),s+="0x"+t.util.bytesToHex(e.value)):e.type===r.Type.UTF8?s+=t.util.decodeUtf8(e.value):e.type===r.Type.PRINTABLESTRING||e.type===r.Type.IA5String?s+=e.value:i.test(e.value)?s+="0x"+t.util.bytesToHex(e.value):0===e.value.length?s+="[null]":s+=e.value}return s};
|
||
},{"./forge":"sQ2N","./util":"xBWF","./oids":"wnpW"}],"IoiG":[function(require,module,exports) {
|
||
var t=require("./forge");require("./util"),module.exports=t.cipher=t.cipher||{},t.cipher.algorithms=t.cipher.algorithms||{},t.cipher.createCipher=function(i,e){var r=i;if("string"==typeof r&&(r=t.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+i);return new t.cipher.BlockCipher({algorithm:r,key:e,decrypt:!1})},t.cipher.createDecipher=function(i,e){var r=i;if("string"==typeof r&&(r=t.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+i);return new t.cipher.BlockCipher({algorithm:r,key:e,decrypt:!0})},t.cipher.registerAlgorithm=function(i,e){i=i.toUpperCase(),t.cipher.algorithms[i]=e},t.cipher.getAlgorithm=function(i){return(i=i.toUpperCase())in t.cipher.algorithms?t.cipher.algorithms[i]:null};var i=t.cipher.BlockCipher=function(t){this.algorithm=t.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=t.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=t.decrypt,this.algorithm.initialize(t)};i.prototype.start=function(i){i=i||{};var e={};for(var r in i)e[r]=i[r];e.decrypt=this._decrypt,this._finish=!1,this._input=t.util.createBuffer(),this.output=i.output||t.util.createBuffer(),this.mode.start(e)},i.prototype.update=function(t){for(t&&this._input.putBuffer(t);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},i.prototype.finish=function(t){!t||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(i){return t(this.blockSize,i,!1)},this.mode.unpad=function(i){return t(this.blockSize,i,!0)});var i={};return i.decrypt=this._decrypt,i.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,i))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,i))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,i)))};
|
||
},{"./forge":"sQ2N","./util":"xBWF"}],"1/EG":[function(require,module,exports) {
|
||
var t=require("./forge");require("./util"),t.cipher=t.cipher||{};var i=module.exports=t.cipher.modes=t.cipher.modes||{};function s(i,s){if("string"==typeof i&&(i=t.util.createBuffer(i)),t.util.isArray(i)&&i.length>4){var e=i;i=t.util.createBuffer();for(var h=0;h<e.length;++h)i.putByte(e[h])}if(i.length()<s)throw new Error("Invalid IV length; got "+i.length()+" bytes and expected "+s+" bytes.");if(!t.util.isArray(i)){var r=[],o=s/4;for(h=0;h<o;++h)r.push(i.getInt32());i=r}return i}function e(t){t[t.length-1]=t[t.length-1]+1&4294967295}function h(t){return[t/4294967296|0,4294967295&t]}i.ecb=function(t){t=t||{},this.name="ECB",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},i.ecb.prototype.start=function(t){},i.ecb.prototype.encrypt=function(t,i,s){if(t.length()<this.blockSize&&!(s&&t.length()>0))return!0;for(var e=0;e<this._ints;++e)this._inBlock[e]=t.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(e=0;e<this._ints;++e)i.putInt32(this._outBlock[e])},i.ecb.prototype.decrypt=function(t,i,s){if(t.length()<this.blockSize&&!(s&&t.length()>0))return!0;for(var e=0;e<this._ints;++e)this._inBlock[e]=t.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(e=0;e<this._ints;++e)i.putInt32(this._outBlock[e])},i.ecb.prototype.pad=function(t,i){var s=t.length()===this.blockSize?this.blockSize:this.blockSize-t.length();return t.fillWithByte(s,s),!0},i.ecb.prototype.unpad=function(t,i){if(i.overflow>0)return!1;var s=t.length(),e=t.at(s-1);return!(e>this.blockSize<<2)&&(t.truncate(e),!0)},i.cbc=function(t){t=t||{},this.name="CBC",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},i.cbc.prototype.start=function(t){if(null===t.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=s(t.iv,this.blockSize),this._prev=this._iv.slice(0)}},i.cbc.prototype.encrypt=function(t,i,s){if(t.length()<this.blockSize&&!(s&&t.length()>0))return!0;for(var e=0;e<this._ints;++e)this._inBlock[e]=this._prev[e]^t.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(e=0;e<this._ints;++e)i.putInt32(this._outBlock[e]);this._prev=this._outBlock},i.cbc.prototype.decrypt=function(t,i,s){if(t.length()<this.blockSize&&!(s&&t.length()>0))return!0;for(var e=0;e<this._ints;++e)this._inBlock[e]=t.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(e=0;e<this._ints;++e)i.putInt32(this._prev[e]^this._outBlock[e]);this._prev=this._inBlock.slice(0)},i.cbc.prototype.pad=function(t,i){var s=t.length()===this.blockSize?this.blockSize:this.blockSize-t.length();return t.fillWithByte(s,s),!0},i.cbc.prototype.unpad=function(t,i){if(i.overflow>0)return!1;var s=t.length(),e=t.at(s-1);return!(e>this.blockSize<<2)&&(t.truncate(e),!0)},i.cfb=function(i){i=i||{},this.name="CFB",this.cipher=i.cipher,this.blockSize=i.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=t.util.createBuffer(),this._partialBytes=0},i.cfb.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=s(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.cfb.prototype.encrypt=function(t,i,s){var e=t.length();if(0===e)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&e>=this.blockSize)for(var h=0;h<this._ints;++h)this._inBlock[h]=t.getInt32()^this._outBlock[h],i.putInt32(this._inBlock[h]);else{var r=(this.blockSize-e)%this.blockSize;r>0&&(r=this.blockSize-r),this._partialOutput.clear();for(h=0;h<this._ints;++h)this._partialBlock[h]=t.getInt32()^this._outBlock[h],this._partialOutput.putInt32(this._partialBlock[h]);if(r>0)t.read-=this.blockSize;else for(h=0;h<this._ints;++h)this._inBlock[h]=this._partialBlock[h];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),r>0&&!s)return i.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=r,!0;i.putBytes(this._partialOutput.getBytes(e-this._partialBytes)),this._partialBytes=0}},i.cfb.prototype.decrypt=function(t,i,s){var e=t.length();if(0===e)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&e>=this.blockSize)for(var h=0;h<this._ints;++h)this._inBlock[h]=t.getInt32(),i.putInt32(this._inBlock[h]^this._outBlock[h]);else{var r=(this.blockSize-e)%this.blockSize;r>0&&(r=this.blockSize-r),this._partialOutput.clear();for(h=0;h<this._ints;++h)this._partialBlock[h]=t.getInt32(),this._partialOutput.putInt32(this._partialBlock[h]^this._outBlock[h]);if(r>0)t.read-=this.blockSize;else for(h=0;h<this._ints;++h)this._inBlock[h]=this._partialBlock[h];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),r>0&&!s)return i.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=r,!0;i.putBytes(this._partialOutput.getBytes(e-this._partialBytes)),this._partialBytes=0}},i.ofb=function(i){i=i||{},this.name="OFB",this.cipher=i.cipher,this.blockSize=i.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=t.util.createBuffer(),this._partialBytes=0},i.ofb.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=s(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ofb.prototype.encrypt=function(t,i,s){var e=t.length();if(0===t.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&e>=this.blockSize)for(var h=0;h<this._ints;++h)i.putInt32(t.getInt32()^this._outBlock[h]),this._inBlock[h]=this._outBlock[h];else{var r=(this.blockSize-e)%this.blockSize;r>0&&(r=this.blockSize-r),this._partialOutput.clear();for(h=0;h<this._ints;++h)this._partialOutput.putInt32(t.getInt32()^this._outBlock[h]);if(r>0)t.read-=this.blockSize;else for(h=0;h<this._ints;++h)this._inBlock[h]=this._outBlock[h];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),r>0&&!s)return i.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=r,!0;i.putBytes(this._partialOutput.getBytes(e-this._partialBytes)),this._partialBytes=0}},i.ofb.prototype.decrypt=i.ofb.prototype.encrypt,i.ctr=function(i){i=i||{},this.name="CTR",this.cipher=i.cipher,this.blockSize=i.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=t.util.createBuffer(),this._partialBytes=0},i.ctr.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=s(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ctr.prototype.encrypt=function(t,i,s){var h=t.length();if(0===h)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&h>=this.blockSize)for(var r=0;r<this._ints;++r)i.putInt32(t.getInt32()^this._outBlock[r]);else{var o=(this.blockSize-h)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(r=0;r<this._ints;++r)this._partialOutput.putInt32(t.getInt32()^this._outBlock[r]);if(o>0&&(t.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!s)return i.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;i.putBytes(this._partialOutput.getBytes(h-this._partialBytes)),this._partialBytes=0}e(this._inBlock)},i.ctr.prototype.decrypt=i.ctr.prototype.encrypt,i.gcm=function(i){i=i||{},this.name="GCM",this.cipher=i.cipher,this.blockSize=i.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=t.util.createBuffer(),this._partialBytes=0,this._R=3774873600},i.gcm.prototype.start=function(i){if(!("iv"in i))throw new Error("Invalid IV parameter.");var s,r=t.util.createBuffer(i.iv);if(this._cipherLength=0,s="additionalData"in i?t.util.createBuffer(i.additionalData):t.util.createBuffer(),this._tagLength="tagLength"in i?i.tagLength:128,this._tag=null,i.decrypt&&(this._tag=t.util.createBuffer(i.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var o=r.length();if(12===o)this._j0=[r.getInt32(),r.getInt32(),r.getInt32(),1];else{for(this._j0=[0,0,0,0];r.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(h(8*o)))}this._inBlock=this._j0.slice(0),e(this._inBlock),this._partialBytes=0,s=t.util.createBuffer(s),this._aDataLength=h(8*s.length());var a=s.length()%this.blockSize;for(a&&s.fillWithByte(0,this.blockSize-a),this._s=[0,0,0,0];s.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[s.getInt32(),s.getInt32(),s.getInt32(),s.getInt32()])},i.gcm.prototype.encrypt=function(t,i,s){var h=t.length();if(0===h)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&h>=this.blockSize){for(var r=0;r<this._ints;++r)i.putInt32(this._outBlock[r]^=t.getInt32());this._cipherLength+=this.blockSize}else{var o=(this.blockSize-h)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(r=0;r<this._ints;++r)this._partialOutput.putInt32(t.getInt32()^this._outBlock[r]);if(o<=0||s){if(s){var a=h%this.blockSize;this._cipherLength+=a,this._partialOutput.truncate(this.blockSize-a)}else this._cipherLength+=this.blockSize;for(r=0;r<this._ints;++r)this._outBlock[r]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!s)return t.read-=this.blockSize,i.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;i.putBytes(this._partialOutput.getBytes(h-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),e(this._inBlock)},i.gcm.prototype.decrypt=function(t,i,s){var h=t.length();if(h<this.blockSize&&!(s&&h>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),e(this._inBlock),this._hashBlock[0]=t.getInt32(),this._hashBlock[1]=t.getInt32(),this._hashBlock[2]=t.getInt32(),this._hashBlock[3]=t.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var r=0;r<this._ints;++r)i.putInt32(this._outBlock[r]^this._hashBlock[r]);h<this.blockSize?this._cipherLength+=h%this.blockSize:this._cipherLength+=this.blockSize},i.gcm.prototype.afterFinish=function(i,s){var e=!0;s.decrypt&&s.overflow&&i.truncate(this.blockSize-s.overflow),this.tag=t.util.createBuffer();var r=this._aDataLength.concat(h(8*this._cipherLength));this._s=this.ghash(this._hashSubkey,this._s,r);var o=[];this.cipher.encrypt(this._j0,o);for(var a=0;a<this._ints;++a)this.tag.putInt32(this._s[a]^o[a]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),s.decrypt&&this.tag.bytes()!==this._tag&&(e=!1),e},i.gcm.prototype.multiply=function(t,i){for(var s=[0,0,0,0],e=i.slice(0),h=0;h<128;++h){t[h/32|0]&1<<31-h%32&&(s[0]^=e[0],s[1]^=e[1],s[2]^=e[2],s[3]^=e[3]),this.pow(e,e)}return s},i.gcm.prototype.pow=function(t,i){for(var s=1&t[3],e=3;e>0;--e)i[e]=t[e]>>>1|(1&t[e-1])<<31;i[0]=t[0]>>>1,s&&(i[0]^=this._R)},i.gcm.prototype.tableMultiply=function(t){for(var i=[0,0,0,0],s=0;s<32;++s){var e=t[s/8|0]>>>4*(7-s%8)&15,h=this._m[s][e];i[0]^=h[0],i[1]^=h[1],i[2]^=h[2],i[3]^=h[3]}return i},i.gcm.prototype.ghash=function(t,i,s){return i[0]^=s[0],i[1]^=s[1],i[2]^=s[2],i[3]^=s[3],this.tableMultiply(i)},i.gcm.prototype.generateHashTable=function(t,i){for(var s=8/i,e=4*s,h=16*s,r=new Array(h),o=0;o<h;++o){var a=[0,0,0,0],n=(e-1-o%e)*i;a[o/e|0]=1<<i-1<<n,r[o]=this.generateSubHashTable(this.multiply(a,t),i)}return r},i.gcm.prototype.generateSubHashTable=function(t,i){var s=1<<i,e=s>>>1,h=new Array(s);h[e]=t.slice(0);for(var r=e>>>1;r>0;)this.pow(h[2*r],h[r]=[]),r>>=1;for(r=2;r<e;){for(var o=1;o<r;++o){var a=h[r],n=h[o];h[r+o]=[a[0]^n[0],a[1]^n[1],a[2]^n[2],a[3]^n[3]]}r*=2}for(h[0]=[0,0,0,0],r=e+1;r<s;++r){var l=h[r^e];h[r]=[t[0]^l[0],t[1]^l[1],t[2]^l[2],t[3]^l[3]]}return h};
|
||
},{"./forge":"sQ2N","./util":"xBWF"}],"45sZ":[function(require,module,exports) {
|
||
var e=require("./forge");function r(r,t){e.cipher.registerAlgorithm(r,function(){return new e.aes.Algorithm(r,t)})}require("./cipher"),require("./cipherModes"),require("./util"),module.exports=e.aes=e.aes||{},e.aes.startEncrypting=function(e,r,t,n){var i=s({key:e,output:t,decrypt:!1,mode:n});return i.start(r),i},e.aes.createEncryptionCipher=function(e,r){return s({key:e,output:null,decrypt:!1,mode:r})},e.aes.startDecrypting=function(e,r,t,n){var i=s({key:e,output:t,decrypt:!0,mode:n});return i.start(r),i},e.aes.createDecryptionCipher=function(e,r){return s({key:e,output:null,decrypt:!0,mode:r})},e.aes.Algorithm=function(e,r){c||f();var t=this;t.name=e,t.mode=new r({blockSize:16,cipher:{encrypt:function(e,r){return l(t._w,e,r,!1)},decrypt:function(e,r){return l(t._w,e,r,!0)}}}),t._init=!1},e.aes.Algorithm.prototype.initialize=function(r){if(!this._init){var t,n=r.key;if("string"!=typeof n||16!==n.length&&24!==n.length&&32!==n.length){if(e.util.isArray(n)&&(16===n.length||24===n.length||32===n.length)){t=n,n=e.util.createBuffer();for(var i=0;i<t.length;++i)n.putByte(t[i])}}else n=e.util.createBuffer(n);if(!e.util.isArray(n)){t=n,n=[];var o=t.length();if(16===o||24===o||32===o){o>>>=2;for(i=0;i<o;++i)n.push(t.getInt32())}}if(!e.util.isArray(n)||4!==n.length&&6!==n.length&&8!==n.length)throw new Error("Invalid key parameter.");var a=this.mode.name,c=-1!==["CFB","OFB","CTR","GCM"].indexOf(a);this._w=p(n,r.decrypt&&!c),this._init=!0}},e.aes._expandKey=function(e,r){return c||f(),p(e,r)},e.aes._updateBlock=l,r("AES-ECB",e.cipher.modes.ecb),r("AES-CBC",e.cipher.modes.cbc),r("AES-CFB",e.cipher.modes.cfb),r("AES-OFB",e.cipher.modes.ofb),r("AES-CTR",e.cipher.modes.ctr),r("AES-GCM",e.cipher.modes.gcm);var t,n,i,o,a,c=!1,u=4;function f(){c=!0,i=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),r=0;r<128;++r)e[r]=r<<1,e[r+128]=r+128<<1^283;t=new Array(256),n=new Array(256),o=new Array(4),a=new Array(4);for(r=0;r<4;++r)o[r]=new Array(256),a[r]=new Array(256);var u,f,p,l,s,h,y,d=0,g=0;for(r=0;r<256;++r){l=(l=g^g<<1^g<<2^g<<3^g<<4)>>8^255&l^99,t[d]=l,n[l]=d,h=(s=e[l])<<24^l<<16^l<<8^l^s,y=((u=e[d])^(f=e[u])^(p=e[f]))<<24^(d^p)<<16^(d^f^p)<<8^d^u^p;for(var m=0;m<4;++m)o[m][d]=h,a[m][l]=y,h=h<<24|h>>>8,y=y<<24|y>>>8;0===d?d=g=1:(d=u^e[e[e[u^p]]],g^=e[e[g]])}}function p(e,r){for(var n,o=e.slice(0),c=1,f=o.length,p=u*(f+6+1),l=f;l<p;++l)n=o[l-1],l%f==0?(n=t[n>>>16&255]<<24^t[n>>>8&255]<<16^t[255&n]<<8^t[n>>>24]^i[c]<<24,c++):f>6&&l%f==4&&(n=t[n>>>24]<<24^t[n>>>16&255]<<16^t[n>>>8&255]<<8^t[255&n]),o[l]=o[l-f]^n;if(r){for(var s,h=a[0],y=a[1],d=a[2],g=a[3],m=o.slice(0),v=(l=0,(p=o.length)-u);l<p;l+=u,v-=u)if(0===l||l===p-u)m[l]=o[v],m[l+1]=o[v+3],m[l+2]=o[v+2],m[l+3]=o[v+1];else for(var A=0;A<u;++A)s=o[v+A],m[l+(3&-A)]=h[t[s>>>24]]^y[t[s>>>16&255]]^d[t[s>>>8&255]]^g[t[255&s]];o=m}return o}function l(e,r,i,c){var u,f,p,l,s,h,y,d,g,m,v,A,C=e.length/4-1;c?(u=a[0],f=a[1],p=a[2],l=a[3],s=n):(u=o[0],f=o[1],p=o[2],l=o[3],s=t),h=r[0]^e[0],y=r[c?3:1]^e[1],d=r[2]^e[2],g=r[c?1:3]^e[3];for(var w=3,B=1;B<C;++B)m=u[h>>>24]^f[y>>>16&255]^p[d>>>8&255]^l[255&g]^e[++w],v=u[y>>>24]^f[d>>>16&255]^p[g>>>8&255]^l[255&h]^e[++w],A=u[d>>>24]^f[g>>>16&255]^p[h>>>8&255]^l[255&y]^e[++w],g=u[g>>>24]^f[h>>>16&255]^p[y>>>8&255]^l[255&d]^e[++w],h=m,y=v,d=A;i[0]=s[h>>>24]<<24^s[y>>>16&255]<<16^s[d>>>8&255]<<8^s[255&g]^e[++w],i[c?3:1]=s[y>>>24]<<24^s[d>>>16&255]<<16^s[g>>>8&255]<<8^s[255&h]^e[++w],i[2]=s[d>>>24]<<24^s[g>>>16&255]<<16^s[h>>>8&255]<<8^s[255&y]^e[++w],i[c?1:3]=s[g>>>24]<<24^s[h>>>16&255]<<16^s[y>>>8&255]<<8^s[255&d]^e[++w]}function s(r){var t,n="AES-"+((r=r||{}).mode||"CBC").toUpperCase(),i=(t=r.decrypt?e.cipher.createDecipher(n,r.key):e.cipher.createCipher(n,r.key)).start;return t.start=function(r,n){var o=null;n instanceof e.util.ByteBuffer&&(o=n,n={}),(n=n||{}).output=o,n.iv=r,i.call(t,n)},t}
|
||
},{"./forge":"sQ2N","./cipher":"IoiG","./cipherModes":"1/EG","./util":"xBWF"}],"6HoC":[function(require,module,exports) {
|
||
var e=require("./forge");function r(r,t){e.cipher.registerAlgorithm(r,function(){return new e.des.Algorithm(r,t)})}require("./cipher"),require("./cipherModes"),require("./util"),module.exports=e.des=e.des||{},e.des.startEncrypting=function(e,r,t,i){var n=h({key:e,output:t,decrypt:!1,mode:i||(null===r?"ECB":"CBC")});return n.start(r),n},e.des.createEncryptionCipher=function(e,r){return h({key:e,output:null,decrypt:!1,mode:r})},e.des.startDecrypting=function(e,r,t,i){var n=h({key:e,output:t,decrypt:!0,mode:i||(null===r?"ECB":"CBC")});return n.start(r),n},e.des.createDecryptionCipher=function(e,r){return h({key:e,output:null,decrypt:!0,mode:r})},e.des.Algorithm=function(e,r){var t=this;t.name=e,t.mode=new r({blockSize:8,cipher:{encrypt:function(e,r){return d(t._keys,e,r,!1)},decrypt:function(e,r){return d(t._keys,e,r,!0)}}}),t._init=!1},e.des.Algorithm.prototype.initialize=function(r){if(!this._init){var t=e.util.createBuffer(r.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=a(t),this._init=!0}},r("DES-ECB",e.cipher.modes.ecb),r("DES-CBC",e.cipher.modes.cbc),r("DES-CFB",e.cipher.modes.cfb),r("DES-OFB",e.cipher.modes.ofb),r("DES-CTR",e.cipher.modes.ctr),r("3DES-ECB",e.cipher.modes.ecb),r("3DES-CBC",e.cipher.modes.cbc),r("3DES-CFB",e.cipher.modes.cfb),r("3DES-OFB",e.cipher.modes.ofb),r("3DES-CTR",e.cipher.modes.ctr);var t=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],i=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],n=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],c=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],o=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],u=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],p=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],s=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function a(e){for(var r,t=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],i=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],n=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],c=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],o=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],u=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],p=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],s=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],a=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],d=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],h=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],f=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],l=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],y=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],m=e.length()>8?3:1,C=[],E=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],v=0,B=0;B<m;B++){var D=e.getInt32(),g=e.getInt32();D^=(r=252645135&(D>>>4^g))<<4,D^=r=65535&((g^=r)>>>-16^D),D^=(r=858993459&(D>>>2^(g^=r<<-16)))<<2,D^=r=65535&((g^=r)>>>-16^D),D^=(r=1431655765&(D>>>1^(g^=r<<-16)))<<1,D^=r=16711935&((g^=r)>>>8^D),r=(D^=(r=1431655765&(D>>>1^(g^=r<<8)))<<1)<<8|(g^=r)>>>20&240,D=g<<24|g<<8&16711680|g>>>8&65280|g>>>24&240,g=r;for(var S=0;S<E.length;++S){E[S]?(D=D<<2|D>>>26,g=g<<2|g>>>26):(D=D<<1|D>>>27,g=g<<1|g>>>27);var k=t[(D&=-15)>>>28]|i[D>>>24&15]|n[D>>>20&15]|c[D>>>16&15]|o[D>>>12&15]|u[D>>>8&15]|p[D>>>4&15],b=s[(g&=-15)>>>28]|a[g>>>24&15]|d[g>>>20&15]|h[g>>>16&15]|f[g>>>12&15]|l[g>>>8&15]|y[g>>>4&15];r=65535&(b>>>16^k),C[v++]=k^r,C[v++]=b^r<<16}}return C}function d(e,r,a,d){var h,f,l=32===e.length?3:9;h=3===l?d?[30,-2,-2]:[0,32,2]:d?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var y=r[0],m=r[1];y^=(f=252645135&(y>>>4^m))<<4,y^=(f=65535&(y>>>16^(m^=f)))<<16,y^=f=858993459&((m^=f)>>>2^y),y^=f=16711935&((m^=f<<2)>>>8^y),y=(y^=(f=1431655765&(y>>>1^(m^=f<<8)))<<1)<<1|y>>>31,m=(m^=f)<<1|m>>>31;for(var C=0;C<l;C+=3){for(var E=h[C+1],v=h[C+2],B=h[C];B!=E;B+=v){var D=m^e[B],g=(m>>>4|m<<28)^e[B+1];f=y,y=m,m=f^(i[D>>>24&63]|c[D>>>16&63]|u[D>>>8&63]|s[63&D]|t[g>>>24&63]|n[g>>>16&63]|o[g>>>8&63]|p[63&g])}f=y,y=m,m=f}m=m>>>1|m<<31,m^=f=1431655765&((y=y>>>1|y<<31)>>>1^m),m^=(f=16711935&(m>>>8^(y^=f<<1)))<<8,m^=(f=858993459&(m>>>2^(y^=f)))<<2,m^=f=65535&((y^=f)>>>16^m),m^=f=252645135&((y^=f<<16)>>>4^m),y^=f<<4,a[0]=y,a[1]=m}function h(r){var t,i="DES-"+((r=r||{}).mode||"CBC").toUpperCase(),n=(t=r.decrypt?e.cipher.createDecipher(i,r.key):e.cipher.createCipher(i,r.key)).start;return t.start=function(r,i){var c=null;i instanceof e.util.ByteBuffer&&(c=i,i={}),(i=i||{}).output=c,i.iv=r,n.call(t,i)},t}
|
||
},{"./forge":"sQ2N","./cipher":"IoiG","./cipherModes":"1/EG","./util":"xBWF"}],"hxOg":[function(require,module,exports) {
|
||
var m=require("./forge");module.exports=m.md=m.md||{},m.md.algorithms=m.md.algorithms||{};
|
||
},{"./forge":"sQ2N"}],"xfLZ":[function(require,module,exports) {
|
||
var t=require("./forge");require("./md"),require("./util");var e=module.exports=t.hmac=t.hmac||{};e.create=function(){var e=null,r=null,u=null,a=null,i={start:function(i,l){if(null!==i)if("string"==typeof i){if(!((i=i.toLowerCase())in t.md.algorithms))throw new Error('Unknown hash algorithm "'+i+'"');r=t.md.algorithms[i].create()}else r=i;if(null===l)l=e;else{if("string"==typeof l)l=t.util.createBuffer(l);else if(t.util.isArray(l)){var n=l;l=t.util.createBuffer();for(var f=0;f<n.length;++f)l.putByte(n[f])}var o=l.length();o>r.blockLength&&(r.start(),r.update(l.bytes()),l=r.digest()),u=t.util.createBuffer(),a=t.util.createBuffer(),o=l.length();for(f=0;f<o;++f){n=l.at(f);u.putByte(54^n),a.putByte(92^n)}if(o<r.blockLength)for(n=r.blockLength-o,f=0;f<n;++f)u.putByte(54),a.putByte(92);e=l,u=u.bytes(),a=a.bytes()}r.start(),r.update(u)},update:function(t){r.update(t)},getMac:function(){var t=r.digest().bytes();return r.start(),r.update(a),r.update(t),r.digest()}};return i.digest=i.getMac,i};
|
||
},{"./forge":"sQ2N","./md":"hxOg","./util":"xBWF"}],"yGzJ":[function(require,module,exports) {
|
||
var Buffer = require("buffer").Buffer;
|
||
var t=require("buffer").Buffer;function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var e=require("./forge");require("./hmac"),require("./md"),require("./util");var n,i=e.pkcs5=e.pkcs5||{};e.util.isNodejs&&!e.options.usePureJavaScript&&(n=require("crypto")),module.exports=e.pbkdf2=i.pbkdf2=function(i,u,o,l,f,s){if("function"==typeof f&&(s=f,f=null),e.util.isNodejs&&!e.options.usePureJavaScript&&n.pbkdf2&&(null===f||"object"!==r(f))&&(n.pbkdf2Sync.length>4||!f||"sha1"===f))return"string"!=typeof f&&(f="sha1"),i=t.from(i,"binary"),u=t.from(u,"binary"),s?4===n.pbkdf2Sync.length?n.pbkdf2(i,u,o,l,function(t,r){if(t)return s(t);s(null,r.toString("binary"))}):n.pbkdf2(i,u,o,l,f,function(t,r){if(t)return s(t);s(null,r.toString("binary"))}):4===n.pbkdf2Sync.length?n.pbkdf2Sync(i,u,o,l).toString("binary"):n.pbkdf2Sync(i,u,o,l,f).toString("binary");if(null==f&&(f="sha1"),"string"==typeof f){if(!(f in e.md.algorithms))throw new Error("Unknown hash algorithm: "+f);f=e.md[f].create()}var a=f.digestLength;if(l>4294967295*a){var y=new Error("Derived key is too long.");if(s)return s(y);throw y}var p=Math.ceil(l/a),c=l-(p-1)*a,d=e.hmac.create();d.start(f,i);var b,g,m,h="";if(!s){for(var S=1;S<=p;++S){d.start(null,null),d.update(u),d.update(e.util.int32ToBytes(S)),b=m=d.digest().getBytes();for(var k=2;k<=o;++k)d.start(null,null),d.update(m),g=d.digest().getBytes(),b=e.util.xorBytes(b,g,a),m=g;h+=S<p?b:b.substr(0,c)}return h}S=1;function v(){if(S>p)return s(null,h);d.start(null,null),d.update(u),d.update(e.util.int32ToBytes(S)),b=m=d.digest().getBytes(),k=2,B()}function B(){if(k<=o)return d.start(null,null),d.update(m),g=d.digest().getBytes(),b=e.util.xorBytes(b,g,a),m=g,++k,e.util.setImmediate(B);h+=S<p?b:b.substr(0,c),++S,v()}v()};
|
||
},{"./forge":"sQ2N","./hmac":"xfLZ","./md":"hxOg","./util":"xBWF","crypto":"sC8V","buffer":"sC8V"}],"52IQ":[function(require,module,exports) {
|
||
var e=require("./forge");require("./util");var r=module.exports=e.pem=e.pem||{};function n(e){for(var r=e.name+": ",n=[],a=function(e,r){return" "+r},t=0;t<e.values.length;++t)n.push(e.values[t].replace(/^(\S+\r\n)/,a));r+=n.join(",")+"\r\n";var o=0,s=-1;for(t=0;t<r.length;++t,++o)if(o>65&&-1!==s){var l=r[s];","===l?(++s,r=r.substr(0,s)+"\r\n "+r.substr(s)):r=r.substr(0,s)+"\r\n"+l+r.substr(s+1),o=t-s-1,s=-1,++t}else" "!==r[t]&&"\t"!==r[t]&&","!==r[t]||(s=t);return r}function a(e){return e.replace(/^\s+/,"")}r.encode=function(r,a){a=a||{};var t,o="-----BEGIN "+r.type+"-----\r\n";if(r.procType&&(o+=n(t={name:"Proc-Type",values:[String(r.procType.version),r.procType.type]})),r.contentDomain&&(o+=n(t={name:"Content-Domain",values:[r.contentDomain]})),r.dekInfo&&(t={name:"DEK-Info",values:[r.dekInfo.algorithm]},r.dekInfo.parameters&&t.values.push(r.dekInfo.parameters),o+=n(t)),r.headers)for(var s=0;s<r.headers.length;++s)o+=n(r.headers[s]);return r.procType&&(o+="\r\n"),o+=e.util.encode64(r.body,a.maxline||64)+"\r\n",o+="-----END "+r.type+"-----\r\n"},r.decode=function(r){for(var n,t=[],o=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,s=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,l=/\r?\n/;n=o.exec(r);){var i={type:n[1],procType:null,contentDomain:null,dekInfo:null,headers:[],body:e.util.decode64(n[3])};if(t.push(i),n[2]){for(var f=n[2].split(l),u=0;n&&u<f.length;){for(var p=f[u].replace(/\s+$/,""),d=u+1;d<f.length;++d){var m=f[d];if(!/\s/.test(m[0]))break;p+=m,u=d}if(n=p.match(s)){for(var h={name:n[1],values:[]},c=n[2].split(","),v=0;v<c.length;++v)h.values.push(a(c[v]));if(i.procType)if(i.contentDomain||"Content-Domain"!==h.name)if(i.dekInfo||"DEK-Info"!==h.name)i.headers.push(h);else{if(0===h.values.length)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');i.dekInfo={algorithm:c[0],parameters:c[1]||null}}else i.contentDomain=c[0]||"";else{if("Proc-Type"!==h.name)throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==h.values.length)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');i.procType={version:c[0],type:c[1]}}}++u}if("ENCRYPTED"===i.procType&&!i.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(0===t.length)throw new Error("Invalid PEM formatted message.");return t};
|
||
},{"./forge":"sQ2N","./util":"xBWF"}],"B80q":[function(require,module,exports) {
|
||
var e=require("./forge");require("./md"),require("./util");var t=module.exports=e.sha256=e.sha256||{};e.md.sha256=e.md.algorithms.sha256=t,t.create=function(){n||g();var t=null,r=e.util.createBuffer(),s=new Array(64),l={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){l.messageLength=0,l.fullMessageLength=l.messageLength64=[];for(var h=l.messageLengthSize/4,n=0;n<h;++n)l.fullMessageLength.push(0);return r=e.util.createBuffer(),t={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},l}};return l.start(),l.update=function(h,n){"utf8"===n&&(h=e.util.encodeUtf8(h));var g=h.length;l.messageLength+=g,g=[g/4294967296>>>0,g>>>0];for(var a=l.fullMessageLength.length-1;a>=0;--a)l.fullMessageLength[a]+=g[1],g[1]=g[0]+(l.fullMessageLength[a]/4294967296>>>0),l.fullMessageLength[a]=l.fullMessageLength[a]>>>0,g[0]=g[1]/4294967296>>>0;return r.putBytes(h),u(t,s,r),(r.read>2048||0===r.length())&&r.compact(),l},l.digest=function(){var n=e.util.createBuffer();n.putBytes(r.bytes());var g,a=l.fullMessageLength[l.fullMessageLength.length-1]+l.messageLengthSize&l.blockLength-1;n.putBytes(h.substr(0,l.blockLength-a));for(var f=8*l.fullMessageLength[0],i=0;i<l.fullMessageLength.length-1;++i)f+=(g=8*l.fullMessageLength[i+1])/4294967296>>>0,n.putInt32(f>>>0),f=g>>>0;n.putInt32(f);var o={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4,h5:t.h5,h6:t.h6,h7:t.h7};u(o,s,n);var L=e.util.createBuffer();return L.putInt32(o.h0),L.putInt32(o.h1),L.putInt32(o.h2),L.putInt32(o.h3),L.putInt32(o.h4),L.putInt32(o.h5),L.putInt32(o.h6),L.putInt32(o.h7),L},l};var h=null,n=!1,r=null;function g(){h=String.fromCharCode(128),h+=e.util.fillString(String.fromCharCode(0),64),r=[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],n=!0}function u(e,t,h){for(var n,g,u,s,l,a,f,i,o,L,c,p,m,v=h.length();v>=64;){for(l=0;l<16;++l)t[l]=h.getInt32();for(;l<64;++l)n=((n=t[l-2])>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,g=((g=t[l-15])>>>7|g<<25)^(g>>>18|g<<14)^g>>>3,t[l]=n+t[l-7]+g+t[l-16]|0;for(a=e.h0,f=e.h1,i=e.h2,o=e.h3,L=e.h4,c=e.h5,p=e.h6,m=e.h7,l=0;l<64;++l)u=(a>>>2|a<<30)^(a>>>13|a<<19)^(a>>>22|a<<10),s=a&f|i&(a^f),n=m+((L>>>6|L<<26)^(L>>>11|L<<21)^(L>>>25|L<<7))+(p^L&(c^p))+r[l]+t[l],m=p,p=c,c=L,L=o+n>>>0,o=i,i=f,f=a,a=n+(g=u+s)>>>0;e.h0=e.h0+a|0,e.h1=e.h1+f|0,e.h2=e.h2+i|0,e.h3=e.h3+o|0,e.h4=e.h4+L|0,e.h5=e.h5+c|0,e.h6=e.h6+p|0,e.h7=e.h7+m|0,v-=64}}
|
||
},{"./forge":"sQ2N","./md":"hxOg","./util":"xBWF"}],"pN4U":[function(require,module,exports) {
|
||
var process = require("process");
|
||
var e=require("process"),t=require("./forge");require("./util");var r=null;!t.util.isNodejs||t.options.usePureJavaScript||e.versions["node-webkit"]||(r=require("crypto"));var n=module.exports=t.prng=t.prng||{};n.create=function(e){for(var n={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},o=e.md,s=new Array(32),l=0;l<32;++l)s[l]=o.create();function a(){if(n.pools[0].messageLength>=32)return i();var e=32-n.pools[0].messageLength<<5;n.collect(n.seedFileSync(e)),i()}function i(){n.reseeds=4294967295===n.reseeds?0:n.reseeds+1;var e=n.plugin.md.create();e.update(n.keyBytes);for(var t=1,r=0;r<32;++r)n.reseeds%t==0&&(e.update(n.pools[r].digest().getBytes()),n.pools[r].start()),t<<=1;n.keyBytes=e.digest().getBytes(),e.start(),e.update(n.keyBytes);var o=e.digest().getBytes();n.key=n.plugin.formatKey(n.keyBytes),n.seed=n.plugin.formatSeed(o),n.generated=0}function u(e){var r=null,n=t.util.globalScope,o=n.crypto||n.msCrypto;o&&o.getRandomValues&&(r=function(e){return o.getRandomValues(e)});var s=t.util.createBuffer();if(r)for(;s.length()<e;){var l=Math.max(1,Math.min(e-s.length(),65536)/4),a=new Uint32Array(Math.floor(l));try{r(a);for(var i=0;i<a.length;++i)s.putInt32(a[i])}catch(c){if(!("undefined"!=typeof QuotaExceededError&&c instanceof QuotaExceededError))throw c}}if(s.length()<e)for(var u,g,f,d=Math.floor(65536*Math.random());s.length()<e;){g=16807*(65535&d),g+=(32767&(u=16807*(d>>16)))<<16,d=4294967295&(g=(2147483647&(g+=u>>15))+(g>>31));for(i=0;i<3;++i)f=d>>>(i<<3),f^=Math.floor(256*Math.random()),s.putByte(String.fromCharCode(255&f))}return s.getBytes(e)}return n.pools=s,n.pool=0,n.generate=function(e,r){if(!r)return n.generateSync(e);var o=n.plugin.cipher,s=n.plugin.increment,l=n.plugin.formatKey,a=n.plugin.formatSeed,u=t.util.createBuffer();n.key=null,function g(f){if(f)return r(f);if(u.length()>=e)return r(null,u.getBytes(e));n.generated>1048575&&(n.key=null);if(null===n.key)return t.util.nextTick(function(){!function(e){if(n.pools[0].messageLength>=32)return i(),e();var t=32-n.pools[0].messageLength<<5;n.seedFile(t,function(t,r){if(t)return e(t);n.collect(r),i(),e()})}(g)});var d=o(n.key,n.seed);n.generated+=d.length;u.putBytes(d);n.key=l(o(n.key,s(n.seed)));n.seed=a(o(n.key,n.seed));t.util.setImmediate(g)}()},n.generateSync=function(e){var r=n.plugin.cipher,o=n.plugin.increment,s=n.plugin.formatKey,l=n.plugin.formatSeed;n.key=null;for(var i=t.util.createBuffer();i.length()<e;){n.generated>1048575&&(n.key=null),null===n.key&&a();var u=r(n.key,n.seed);n.generated+=u.length,i.putBytes(u),n.key=s(r(n.key,o(n.seed))),n.seed=l(r(n.key,n.seed))}return i.getBytes(e)},r?(n.seedFile=function(e,t){r.randomBytes(e,function(e,r){if(e)return t(e);t(null,r.toString())})},n.seedFileSync=function(e){return r.randomBytes(e).toString()}):(n.seedFile=function(e,t){try{t(null,u(e))}catch(r){t(r)}},n.seedFileSync=u),n.collect=function(e){for(var t=e.length,r=0;r<t;++r)n.pools[n.pool].update(e.substr(r,1)),n.pool=31===n.pool?0:n.pool+1},n.collectInt=function(e,t){for(var r="",o=0;o<t;o+=8)r+=String.fromCharCode(e>>o&255);n.collect(r)},n.registerWorker=function(e){if(e===self)n.seedFile=function(e,t){self.addEventListener("message",function e(r){var n=r.data;n.forge&&n.forge.prng&&(self.removeEventListener("message",e),t(n.forge.prng.err,n.forge.prng.bytes))}),self.postMessage({forge:{prng:{needed:e}}})};else{e.addEventListener("message",function(t){var r=t.data;r.forge&&r.forge.prng&&n.seedFile(r.forge.prng.needed,function(t,r){e.postMessage({forge:{prng:{err:t,bytes:r}}})})})}},n};
|
||
},{"./forge":"sQ2N","./util":"xBWF","crypto":"sC8V","process":"sC8V"}],"nQaA":[function(require,module,exports) {
|
||
var e=require("./forge");require("./aes"),require("./sha256"),require("./prng"),require("./util"),e.random&&e.random.getBytes?module.exports=e.random:function(t){var n={},r=new Array(4),o=e.util.createBuffer();function a(){var t=e.prng.create(n);return t.getBytes=function(e,n){return t.generate(e,n)},t.getBytesSync=function(e){return t.generate(e)},t}n.formatKey=function(t){var n=e.util.createBuffer(t);return(t=new Array(4))[0]=n.getInt32(),t[1]=n.getInt32(),t[2]=n.getInt32(),t[3]=n.getInt32(),e.aes._expandKey(t,!1)},n.formatSeed=function(t){var n=e.util.createBuffer(t);return(t=new Array(4))[0]=n.getInt32(),t[1]=n.getInt32(),t[2]=n.getInt32(),t[3]=n.getInt32(),t},n.cipher=function(t,n){return e.aes._updateBlock(t,n,r,!1),o.putInt32(r[0]),o.putInt32(r[1]),o.putInt32(r[2]),o.putInt32(r[3]),o.getBytes()},n.increment=function(e){return++e[3],e},n.md=e.md.sha256;var u=a(),i=null,c=e.util.globalScope,f=c.crypto||c.msCrypto;if(f&&f.getRandomValues&&(i=function(e){return f.getRandomValues(e)}),e.options.usePureJavaScript||!e.util.isNodejs&&!i){if("undefined"==typeof window||window.document,u.collectInt(+new Date,32),"undefined"!=typeof navigator){var l="";for(var d in navigator)try{"string"==typeof navigator[d]&&(l+=navigator[d])}catch(g){}u.collect(l),l=null}t&&(t().mousemove(function(e){u.collectInt(e.clientX,16),u.collectInt(e.clientY,16)}),t().keypress(function(e){u.collectInt(e.charCode,8)}))}if(e.random)for(var d in u)e.random[d]=u[d];else e.random=u;e.random.createInstance=a,module.exports=e.random}("undefined"!=typeof jQuery?jQuery:null);
|
||
},{"./forge":"sQ2N","./aes":"45sZ","./sha256":"B80q","./prng":"pN4U","./util":"xBWF"}],"qWri":[function(require,module,exports) {
|
||
var t=require("./forge");require("./util");var r=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],e=[1,2,3,5],n=function(t,r){return t<<r&65535|(65535&t)>>16-r},u=function(t,r){return(65535&t)>>r|t<<16-r&65535};module.exports=t.rc2=t.rc2||{},t.rc2.expandKey=function(e,n){"string"==typeof e&&(e=t.util.createBuffer(e)),n=n||128;var u,f=e,i=e.length(),c=n,a=Math.ceil(c/8),o=255>>(7&c);for(u=i;u<128;u++)f.putByte(r[f.at(u-1)+f.at(u-i)&255]);for(f.setAt(128-a,r[f.at(128-a)&o]),u=127-a;u>=0;u--)f.setAt(u,r[f.at(u+1)^f.at(u+a)]);return f};var f=function(r,f,i){var c,a,o,l,p=!1,g=null,h=null,s=null,v=[];for(r=t.rc2.expandKey(r,f),o=0;o<64;o++)v.push(r.getInt16Le());i?(c=function(t){for(o=0;o<4;o++)t[o]+=v[l]+(t[(o+3)%4]&t[(o+2)%4])+(~t[(o+3)%4]&t[(o+1)%4]),t[o]=n(t[o],e[o]),l++},a=function(t){for(o=0;o<4;o++)t[o]+=v[63&t[(o+3)%4]]}):(c=function(t){for(o=3;o>=0;o--)t[o]=u(t[o],e[o]),t[o]-=v[l]+(t[(o+3)%4]&t[(o+2)%4])+(~t[(o+3)%4]&t[(o+1)%4]),l--},a=function(t){for(o=3;o>=0;o--)t[o]-=v[63&t[(o+3)%4]]});var y=function(t){var r=[];for(o=0;o<4;o++){var e=g.getInt16Le();null!==s&&(i?e^=s.getInt16Le():s.putInt16Le(e)),r.push(65535&e)}l=i?0:63;for(var n=0;n<t.length;n++)for(var u=0;u<t[n][0];u++)t[n][1](r);for(o=0;o<4;o++)null!==s&&(i?s.putInt16Le(r[o]):r[o]^=s.getInt16Le()),h.putInt16Le(r[o])},B=null;return B={start:function(r,e){r&&"string"==typeof r&&(r=t.util.createBuffer(r)),p=!1,g=t.util.createBuffer(),h=e||new t.util.createBuffer,s=r,B.output=h},update:function(t){for(p||g.putBuffer(t);g.length()>=8;)y([[5,c],[1,a],[6,c],[1,a],[5,c]])},finish:function(t){var r=!0;if(i)if(t)r=t(8,g,!i);else{var e=8===g.length()?8:8-g.length();g.fillWithByte(e,e)}if(r&&(p=!0,B.update()),!i&&(r=0===g.length()))if(t)r=t(8,h,!i);else{var n=h.length(),u=h.at(n-1);u>n?r=!1:h.truncate(u)}return r}}};t.rc2.startEncrypting=function(r,e,n){var u=t.rc2.createEncryptionCipher(r,128);return u.start(e,n),u},t.rc2.createEncryptionCipher=function(t,r){return f(t,r,!0)},t.rc2.startDecrypting=function(r,e,n){var u=t.rc2.createDecryptionCipher(r,128);return u.start(e,n),u},t.rc2.createDecryptionCipher=function(t,r){return f(t,r,!1)};
|
||
},{"./forge":"sQ2N","./util":"xBWF"}],"sroI":[function(require,module,exports) {
|
||
var t,i=require("./forge");module.exports=i.jsbn=i.jsbn||{};var o=0xdeadbeefcafe,r=15715070==(16777215&o);function s(t,i,o){this.data=[],null!=t&&("number"==typeof t?this.fromNumber(t,i,o):null==i&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,i))}function a(){return new s(null)}function h(t,i,o,r,s,a){for(;--a>=0;){var h=i*this.data[t++]+o.data[r]+s;s=Math.floor(h/67108864),o.data[r++]=67108863&h}return s}function e(t,i,o,r,s,a){for(var h=32767&i,e=i>>15;--a>=0;){var n=32767&this.data[t],u=this.data[t++]>>15,f=e*n+u*h;s=((n=h*n+((32767&f)<<15)+o.data[r]+(1073741823&s))>>>30)+(f>>>15)+e*u+(s>>>30),o.data[r++]=1073741823&n}return s}function n(t,i,o,r,s,a){for(var h=16383&i,e=i>>14;--a>=0;){var n=16383&this.data[t],u=this.data[t++]>>14,f=e*n+u*h;s=((n=h*n+((16383&f)<<14)+o.data[r]+s)>>28)+(f>>14)+e*u,o.data[r++]=268435455&n}return s}i.jsbn.BigInteger=s,"undefined"==typeof navigator?(s.prototype.am=n,t=28):r&&"Microsoft Internet Explorer"==navigator.appName?(s.prototype.am=e,t=30):r&&"Netscape"!=navigator.appName?(s.prototype.am=h,t=26):(s.prototype.am=n,t=28),s.prototype.DB=t,s.prototype.DM=(1<<t)-1,s.prototype.DV=1<<t;var u=52;s.prototype.FV=Math.pow(2,u),s.prototype.F1=u-t,s.prototype.F2=2*t-u;var f,p,d="0123456789abcdefghijklmnopqrstuvwxyz",c=new Array;for(f="0".charCodeAt(0),p=0;p<=9;++p)c[f++]=p;for(f="a".charCodeAt(0),p=10;p<36;++p)c[f++]=p;for(f="A".charCodeAt(0),p=10;p<36;++p)c[f++]=p;function m(t){return d.charAt(t)}function l(t,i){var o=c[t.charCodeAt(i)];return null==o?-1:o}function T(t){for(var i=this.t-1;i>=0;--i)t.data[i]=this.data[i];t.t=this.t,t.s=this.s}function v(t){this.t=1,this.s=t<0?-1:0,t>0?this.data[0]=t:t<-1?this.data[0]=t+this.DV:this.t=0}function y(t){var i=a();return i.fromInt(t),i}function D(t,i){var o;if(16==i)o=4;else if(8==i)o=3;else if(256==i)o=8;else if(2==i)o=1;else if(32==i)o=5;else{if(4!=i)return void this.fromRadix(t,i);o=2}this.t=0,this.s=0;for(var r=t.length,a=!1,h=0;--r>=0;){var e=8==o?255&t[r]:l(t,r);e<0?"-"==t.charAt(r)&&(a=!0):(a=!1,0==h?this.data[this.t++]=e:h+o>this.DB?(this.data[this.t-1]|=(e&(1<<this.DB-h)-1)<<h,this.data[this.t++]=e>>this.DB-h):this.data[this.t-1]|=e<<h,(h+=o)>=this.DB&&(h-=this.DB))}8==o&&0!=(128&t[0])&&(this.s=-1,h>0&&(this.data[this.t-1]|=(1<<this.DB-h)-1<<h)),this.clamp(),a&&s.ZERO.subTo(this,this)}function b(){for(var t=this.s&this.DM;this.t>0&&this.data[this.t-1]==t;)--this.t}function B(t){if(this.s<0)return"-"+this.negate().toString(t);var i;if(16==t)i=4;else if(8==t)i=3;else if(2==t)i=1;else if(32==t)i=5;else{if(4!=t)return this.toRadix(t);i=2}var o,r=(1<<i)-1,s=!1,a="",h=this.t,e=this.DB-h*this.DB%i;if(h-- >0)for(e<this.DB&&(o=this.data[h]>>e)>0&&(s=!0,a=m(o));h>=0;)e<i?(o=(this.data[h]&(1<<e)-1)<<i-e,o|=this.data[--h]>>(e+=this.DB-i)):(o=this.data[h]>>(e-=i)&r,e<=0&&(e+=this.DB,--h)),o>0&&(s=!0),s&&(a+=m(o));return s?a:"0"}function g(){var t=a();return s.ZERO.subTo(this,t),t}function S(){return this.s<0?this.negate():this}function M(t){var i=this.s-t.s;if(0!=i)return i;var o=this.t;if(0!=(i=o-t.t))return this.s<0?-i:i;for(;--o>=0;)if(0!=(i=this.data[o]-t.data[o]))return i;return 0}function w(t){var i,o=1;return 0!=(i=t>>>16)&&(t=i,o+=16),0!=(i=t>>8)&&(t=i,o+=8),0!=(i=t>>4)&&(t=i,o+=4),0!=(i=t>>2)&&(t=i,o+=2),0!=(i=t>>1)&&(t=i,o+=1),o}function E(){return this.t<=0?0:this.DB*(this.t-1)+w(this.data[this.t-1]^this.s&this.DM)}function O(t,i){var o;for(o=this.t-1;o>=0;--o)i.data[o+t]=this.data[o];for(o=t-1;o>=0;--o)i.data[o]=0;i.t=this.t+t,i.s=this.s}function R(t,i){for(var o=t;o<this.t;++o)i.data[o-t]=this.data[o];i.t=Math.max(this.t-t,0),i.s=this.s}function V(t,i){var o,r=t%this.DB,s=this.DB-r,a=(1<<s)-1,h=Math.floor(t/this.DB),e=this.s<<r&this.DM;for(o=this.t-1;o>=0;--o)i.data[o+h+1]=this.data[o]>>s|e,e=(this.data[o]&a)<<r;for(o=h-1;o>=0;--o)i.data[o]=0;i.data[h]=e,i.t=this.t+h+1,i.s=this.s,i.clamp()}function q(t,i){i.s=this.s;var o=Math.floor(t/this.DB);if(o>=this.t)i.t=0;else{var r=t%this.DB,s=this.DB-r,a=(1<<r)-1;i.data[0]=this.data[o]>>r;for(var h=o+1;h<this.t;++h)i.data[h-o-1]|=(this.data[h]&a)<<s,i.data[h-o]=this.data[h]>>r;r>0&&(i.data[this.t-o-1]|=(this.s&a)<<s),i.t=this.t-o,i.clamp()}}function A(t,i){for(var o=0,r=0,s=Math.min(t.t,this.t);o<s;)r+=this.data[o]-t.data[o],i.data[o++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r-=t.s;o<this.t;)r+=this.data[o],i.data[o++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;o<t.t;)r-=t.data[o],i.data[o++]=r&this.DM,r>>=this.DB;r-=t.s}i.s=r<0?-1:0,r<-1?i.data[o++]=this.DV+r:r>0&&(i.data[o++]=r),i.t=o,i.clamp()}function N(t,i){var o=this.abs(),r=t.abs(),a=o.t;for(i.t=a+r.t;--a>=0;)i.data[a]=0;for(a=0;a<r.t;++a)i.data[a+o.t]=o.am(0,r.data[a],i,a,0,o.t);i.s=0,i.clamp(),this.s!=t.s&&s.ZERO.subTo(i,i)}function x(t){for(var i=this.abs(),o=t.t=2*i.t;--o>=0;)t.data[o]=0;for(o=0;o<i.t-1;++o){var r=i.am(o,i.data[o],t,2*o,0,1);(t.data[o+i.t]+=i.am(o+1,2*i.data[o],t,2*o+1,r,i.t-o-1))>=i.DV&&(t.data[o+i.t]-=i.DV,t.data[o+i.t+1]=1)}t.t>0&&(t.data[t.t-1]+=i.am(o,i.data[o],t,2*o,0,1)),t.s=0,t.clamp()}function L(t,i,o){var r=t.abs();if(!(r.t<=0)){var h=this.abs();if(h.t<r.t)return null!=i&&i.fromInt(0),void(null!=o&&this.copyTo(o));null==o&&(o=a());var e=a(),n=this.s,u=t.s,f=this.DB-w(r.data[r.t-1]);f>0?(r.lShiftTo(f,e),h.lShiftTo(f,o)):(r.copyTo(e),h.copyTo(o));var p=e.t,d=e.data[p-1];if(0!=d){var c=d*(1<<this.F1)+(p>1?e.data[p-2]>>this.F2:0),m=this.FV/c,l=(1<<this.F1)/c,T=1<<this.F2,v=o.t,y=v-p,D=null==i?a():i;for(e.dlShiftTo(y,D),o.compareTo(D)>=0&&(o.data[o.t++]=1,o.subTo(D,o)),s.ONE.dlShiftTo(p,D),D.subTo(e,e);e.t<p;)e.data[e.t++]=0;for(;--y>=0;){var b=o.data[--v]==d?this.DM:Math.floor(o.data[v]*m+(o.data[v-1]+T)*l);if((o.data[v]+=e.am(0,b,o,y,0,p))<b)for(e.dlShiftTo(y,D),o.subTo(D,o);o.data[v]<--b;)o.subTo(D,o)}null!=i&&(o.drShiftTo(p,i),n!=u&&s.ZERO.subTo(i,i)),o.t=p,o.clamp(),f>0&&o.rShiftTo(f,o),n<0&&s.ZERO.subTo(o,o)}}}function I(t){var i=a();return this.abs().divRemTo(t,null,i),this.s<0&&i.compareTo(s.ZERO)>0&&t.subTo(i,i),i}function Z(t){this.m=t}function F(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}function P(t){return t}function C(t){t.divRemTo(this.m,null,t)}function j(t,i,o){t.multiplyTo(i,o),this.reduce(o)}function k(t,i){t.squareTo(i),this.reduce(i)}function z(){if(this.t<1)return 0;var t=this.data[0];if(0==(1&t))return 0;var i=3&t;return(i=(i=(i=(i=i*(2-(15&t)*i)&15)*(2-(255&t)*i)&255)*(2-((65535&t)*i&65535))&65535)*(2-t*i%this.DV)%this.DV)>0?this.DV-i:-i}function U(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function G(t){var i=a();return t.abs().dlShiftTo(this.m.t,i),i.divRemTo(this.m,null,i),t.s<0&&i.compareTo(s.ZERO)>0&&this.m.subTo(i,i),i}function H(t){var i=a();return t.copyTo(i),this.reduce(i),i}function J(t){for(;t.t<=this.mt2;)t.data[t.t++]=0;for(var i=0;i<this.m.t;++i){var o=32767&t.data[i],r=o*this.mpl+((o*this.mph+(t.data[i]>>15)*this.mpl&this.um)<<15)&t.DM;for(o=i+this.m.t,t.data[o]+=this.m.am(0,r,t,i,0,this.m.t);t.data[o]>=t.DV;)t.data[o]-=t.DV,t.data[++o]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)}function K(t,i){t.squareTo(i),this.reduce(i)}function Q(t,i,o){t.multiplyTo(i,o),this.reduce(o)}function W(){return 0==(this.t>0?1&this.data[0]:this.s)}function X(t,i){if(t>4294967295||t<1)return s.ONE;var o=a(),r=a(),h=i.convert(this),e=w(t)-1;for(h.copyTo(o);--e>=0;)if(i.sqrTo(o,r),(t&1<<e)>0)i.mulTo(r,h,o);else{var n=o;o=r,r=n}return i.revert(o)}function Y(t,i){var o;return o=t<256||i.isEven()?new Z(i):new U(i),this.exp(t,o)}function $(){var t=a();return this.copyTo(t),t}function _(){if(this.s<0){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]}function tt(){return 0==this.t?this.s:this.data[0]<<24>>24}function it(){return 0==this.t?this.s:this.data[0]<<16>>16}function ot(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}function rt(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1}function st(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var i=this.chunkSize(t),o=Math.pow(t,i),r=y(o),s=a(),h=a(),e="";for(this.divRemTo(r,s,h);s.signum()>0;)e=(o+h.intValue()).toString(t).substr(1)+e,s.divRemTo(r,s,h);return h.intValue().toString(t)+e}function at(t,i){this.fromInt(0),null==i&&(i=10);for(var o=this.chunkSize(i),r=Math.pow(i,o),a=!1,h=0,e=0,n=0;n<t.length;++n){var u=l(t,n);u<0?"-"==t.charAt(n)&&0==this.signum()&&(a=!0):(e=i*e+u,++h>=o&&(this.dMultiply(r),this.dAddOffset(e,0),h=0,e=0))}h>0&&(this.dMultiply(Math.pow(i,h)),this.dAddOffset(e,0)),a&&s.ZERO.subTo(this,this)}function ht(t,i,o){if("number"==typeof i)if(t<2)this.fromInt(1);else for(this.fromNumber(t,o),this.testBit(t-1)||this.bitwiseTo(s.ONE.shiftLeft(t-1),mt,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(i);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(s.ONE.shiftLeft(t-1),this);else{var r=new Array,a=7&t;r.length=1+(t>>3),i.nextBytes(r),a>0?r[0]&=(1<<a)-1:r[0]=0,this.fromString(r,256)}}function et(){var t=this.t,i=new Array;i[0]=this.s;var o,r=this.DB-t*this.DB%8,s=0;if(t-- >0)for(r<this.DB&&(o=this.data[t]>>r)!=(this.s&this.DM)>>r&&(i[s++]=o|this.s<<this.DB-r);t>=0;)r<8?(o=(this.data[t]&(1<<r)-1)<<8-r,o|=this.data[--t]>>(r+=this.DB-8)):(o=this.data[t]>>(r-=8)&255,r<=0&&(r+=this.DB,--t)),0!=(128&o)&&(o|=-256),0==s&&(128&this.s)!=(128&o)&&++s,(s>0||o!=this.s)&&(i[s++]=o);return i}function nt(t){return 0==this.compareTo(t)}function ut(t){return this.compareTo(t)<0?this:t}function ft(t){return this.compareTo(t)>0?this:t}function pt(t,i,o){var r,s,a=Math.min(t.t,this.t);for(r=0;r<a;++r)o.data[r]=i(this.data[r],t.data[r]);if(t.t<this.t){for(s=t.s&this.DM,r=a;r<this.t;++r)o.data[r]=i(this.data[r],s);o.t=this.t}else{for(s=this.s&this.DM,r=a;r<t.t;++r)o.data[r]=i(s,t.data[r]);o.t=t.t}o.s=i(this.s,t.s),o.clamp()}function dt(t,i){return t&i}function ct(t){var i=a();return this.bitwiseTo(t,dt,i),i}function mt(t,i){return t|i}function lt(t){var i=a();return this.bitwiseTo(t,mt,i),i}function Tt(t,i){return t^i}function vt(t){var i=a();return this.bitwiseTo(t,Tt,i),i}function yt(t,i){return t&~i}function Dt(t){var i=a();return this.bitwiseTo(t,yt,i),i}function bt(){for(var t=a(),i=0;i<this.t;++i)t.data[i]=this.DM&~this.data[i];return t.t=this.t,t.s=~this.s,t}function Bt(t){var i=a();return t<0?this.rShiftTo(-t,i):this.lShiftTo(t,i),i}function gt(t){var i=a();return t<0?this.lShiftTo(-t,i):this.rShiftTo(t,i),i}function St(t){if(0==t)return-1;var i=0;return 0==(65535&t)&&(t>>=16,i+=16),0==(255&t)&&(t>>=8,i+=8),0==(15&t)&&(t>>=4,i+=4),0==(3&t)&&(t>>=2,i+=2),0==(1&t)&&++i,i}function Mt(){for(var t=0;t<this.t;++t)if(0!=this.data[t])return t*this.DB+St(this.data[t]);return this.s<0?this.t*this.DB:-1}function wt(t){for(var i=0;0!=t;)t&=t-1,++i;return i}function Et(){for(var t=0,i=this.s&this.DM,o=0;o<this.t;++o)t+=wt(this.data[o]^i);return t}function Ot(t){var i=Math.floor(t/this.DB);return i>=this.t?0!=this.s:0!=(this.data[i]&1<<t%this.DB)}function Rt(t,i){var o=s.ONE.shiftLeft(t);return this.bitwiseTo(o,i,o),o}function Vt(t){return this.changeBit(t,mt)}function qt(t){return this.changeBit(t,yt)}function At(t){return this.changeBit(t,Tt)}function Nt(t,i){for(var o=0,r=0,s=Math.min(t.t,this.t);o<s;)r+=this.data[o]+t.data[o],i.data[o++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r+=t.s;o<this.t;)r+=this.data[o],i.data[o++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;o<t.t;)r+=t.data[o],i.data[o++]=r&this.DM,r>>=this.DB;r+=t.s}i.s=r<0?-1:0,r>0?i.data[o++]=r:r<-1&&(i.data[o++]=this.DV+r),i.t=o,i.clamp()}function xt(t){var i=a();return this.addTo(t,i),i}function Lt(t){var i=a();return this.subTo(t,i),i}function It(t){var i=a();return this.multiplyTo(t,i),i}function Zt(t){var i=a();return this.divRemTo(t,i,null),i}function Ft(t){var i=a();return this.divRemTo(t,null,i),i}function Pt(t){var i=a(),o=a();return this.divRemTo(t,i,o),new Array(i,o)}function Ct(t){this.data[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}function jt(t,i){if(0!=t){for(;this.t<=i;)this.data[this.t++]=0;for(this.data[i]+=t;this.data[i]>=this.DV;)this.data[i]-=this.DV,++i>=this.t&&(this.data[this.t++]=0),++this.data[i]}}function kt(){}function zt(t){return t}function Ut(t,i,o){t.multiplyTo(i,o)}function Gt(t,i){t.squareTo(i)}function Ht(t){return this.exp(t,new kt)}function Jt(t,i,o){var r,s=Math.min(this.t+t.t,i);for(o.s=0,o.t=s;s>0;)o.data[--s]=0;for(r=o.t-this.t;s<r;++s)o.data[s+this.t]=this.am(0,t.data[s],o,s,0,this.t);for(r=Math.min(t.t,i);s<r;++s)this.am(0,t.data[s],o,s,0,i-s);o.clamp()}function Kt(t,i,o){--i;var r=o.t=this.t+t.t-i;for(o.s=0;--r>=0;)o.data[r]=0;for(r=Math.max(i-this.t,0);r<t.t;++r)o.data[this.t+r-i]=this.am(i-r,t.data[r],o,0,0,this.t+r-i);o.clamp(),o.drShiftTo(1,o)}function Qt(t){this.r2=a(),this.q3=a(),s.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}function Wt(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var i=a();return t.copyTo(i),this.reduce(i),i}function Xt(t){return t}function Yt(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)}function $t(t,i){t.squareTo(i),this.reduce(i)}function _t(t,i,o){t.multiplyTo(i,o),this.reduce(o)}function ti(t,i){var o,r,s=t.bitLength(),h=y(1);if(s<=0)return h;o=s<18?1:s<48?3:s<144?4:s<768?5:6,r=s<8?new Z(i):i.isEven()?new Qt(i):new U(i);var e=new Array,n=3,u=o-1,f=(1<<o)-1;if(e[1]=r.convert(this),o>1){var p=a();for(r.sqrTo(e[1],p);n<=f;)e[n]=a(),r.mulTo(p,e[n-2],e[n]),n+=2}var d,c,m=t.t-1,l=!0,T=a();for(s=w(t.data[m])-1;m>=0;){for(s>=u?d=t.data[m]>>s-u&f:(d=(t.data[m]&(1<<s+1)-1)<<u-s,m>0&&(d|=t.data[m-1]>>this.DB+s-u)),n=o;0==(1&d);)d>>=1,--n;if((s-=n)<0&&(s+=this.DB,--m),l)e[d].copyTo(h),l=!1;else{for(;n>1;)r.sqrTo(h,T),r.sqrTo(T,h),n-=2;n>0?r.sqrTo(h,T):(c=h,h=T,T=c),r.mulTo(T,e[d],h)}for(;m>=0&&0==(t.data[m]&1<<s);)r.sqrTo(h,T),c=h,h=T,T=c,--s<0&&(s=this.DB-1,--m)}return r.revert(h)}function ii(t){var i=this.s<0?this.negate():this.clone(),o=t.s<0?t.negate():t.clone();if(i.compareTo(o)<0){var r=i;i=o,o=r}var s=i.getLowestSetBit(),a=o.getLowestSetBit();if(a<0)return i;for(s<a&&(a=s),a>0&&(i.rShiftTo(a,i),o.rShiftTo(a,o));i.signum()>0;)(s=i.getLowestSetBit())>0&&i.rShiftTo(s,i),(s=o.getLowestSetBit())>0&&o.rShiftTo(s,o),i.compareTo(o)>=0?(i.subTo(o,i),i.rShiftTo(1,i)):(o.subTo(i,o),o.rShiftTo(1,o));return a>0&&o.lShiftTo(a,o),o}function oi(t){if(t<=0)return 0;var i=this.DV%t,o=this.s<0?t-1:0;if(this.t>0)if(0==i)o=this.data[0]%t;else for(var r=this.t-1;r>=0;--r)o=(i*o+this.data[r])%t;return o}function ri(t){var i=t.isEven();if(this.isEven()&&i||0==t.signum())return s.ZERO;for(var o=t.clone(),r=this.clone(),a=y(1),h=y(0),e=y(0),n=y(1);0!=o.signum();){for(;o.isEven();)o.rShiftTo(1,o),i?(a.isEven()&&h.isEven()||(a.addTo(this,a),h.subTo(t,h)),a.rShiftTo(1,a)):h.isEven()||h.subTo(t,h),h.rShiftTo(1,h);for(;r.isEven();)r.rShiftTo(1,r),i?(e.isEven()&&n.isEven()||(e.addTo(this,e),n.subTo(t,n)),e.rShiftTo(1,e)):n.isEven()||n.subTo(t,n),n.rShiftTo(1,n);o.compareTo(r)>=0?(o.subTo(r,o),i&&a.subTo(e,a),h.subTo(n,h)):(r.subTo(o,r),i&&e.subTo(a,e),n.subTo(h,n))}return 0!=r.compareTo(s.ONE)?s.ZERO:n.compareTo(t)>=0?n.subtract(t):n.signum()<0?(n.addTo(t,n),n.signum()<0?n.add(t):n):n}Z.prototype.convert=F,Z.prototype.revert=P,Z.prototype.reduce=C,Z.prototype.mulTo=j,Z.prototype.sqrTo=k,U.prototype.convert=G,U.prototype.revert=H,U.prototype.reduce=J,U.prototype.mulTo=Q,U.prototype.sqrTo=K,s.prototype.copyTo=T,s.prototype.fromInt=v,s.prototype.fromString=D,s.prototype.clamp=b,s.prototype.dlShiftTo=O,s.prototype.drShiftTo=R,s.prototype.lShiftTo=V,s.prototype.rShiftTo=q,s.prototype.subTo=A,s.prototype.multiplyTo=N,s.prototype.squareTo=x,s.prototype.divRemTo=L,s.prototype.invDigit=z,s.prototype.isEven=W,s.prototype.exp=X,s.prototype.toString=B,s.prototype.negate=g,s.prototype.abs=S,s.prototype.compareTo=M,s.prototype.bitLength=E,s.prototype.mod=I,s.prototype.modPowInt=Y,s.ZERO=y(0),s.ONE=y(1),kt.prototype.convert=zt,kt.prototype.revert=zt,kt.prototype.mulTo=Ut,kt.prototype.sqrTo=Gt,Qt.prototype.convert=Wt,Qt.prototype.revert=Xt,Qt.prototype.reduce=Yt,Qt.prototype.mulTo=_t,Qt.prototype.sqrTo=$t;var si=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],ai=(1<<26)/si[si.length-1];function hi(t){var i,o=this.abs();if(1==o.t&&o.data[0]<=si[si.length-1]){for(i=0;i<si.length;++i)if(o.data[0]==si[i])return!0;return!1}if(o.isEven())return!1;for(i=1;i<si.length;){for(var r=si[i],s=i+1;s<si.length&&r<ai;)r*=si[s++];for(r=o.modInt(r);i<s;)if(r%si[i++]==0)return!1}return o.millerRabin(t)}function ei(t){var i=this.subtract(s.ONE),o=i.getLowestSetBit();if(o<=0)return!1;for(var r,a=i.shiftRight(o),h=ni(),e=0;e<t;++e){do{r=new s(this.bitLength(),h)}while(r.compareTo(s.ONE)<=0||r.compareTo(i)>=0);var n=r.modPow(a,this);if(0!=n.compareTo(s.ONE)&&0!=n.compareTo(i)){for(var u=1;u++<o&&0!=n.compareTo(i);)if(0==(n=n.modPowInt(2,this)).compareTo(s.ONE))return!1;if(0!=n.compareTo(i))return!1}}return!0}function ni(){return{nextBytes:function(t){for(var i=0;i<t.length;++i)t[i]=Math.floor(256*Math.random())}}}s.prototype.chunkSize=ot,s.prototype.toRadix=st,s.prototype.fromRadix=at,s.prototype.fromNumber=ht,s.prototype.bitwiseTo=pt,s.prototype.changeBit=Rt,s.prototype.addTo=Nt,s.prototype.dMultiply=Ct,s.prototype.dAddOffset=jt,s.prototype.multiplyLowerTo=Jt,s.prototype.multiplyUpperTo=Kt,s.prototype.modInt=oi,s.prototype.millerRabin=ei,s.prototype.clone=$,s.prototype.intValue=_,s.prototype.byteValue=tt,s.prototype.shortValue=it,s.prototype.signum=rt,s.prototype.toByteArray=et,s.prototype.equals=nt,s.prototype.min=ut,s.prototype.max=ft,s.prototype.and=ct,s.prototype.or=lt,s.prototype.xor=vt,s.prototype.andNot=Dt,s.prototype.not=bt,s.prototype.shiftLeft=Bt,s.prototype.shiftRight=gt,s.prototype.getLowestSetBit=Mt,s.prototype.bitCount=Et,s.prototype.testBit=Ot,s.prototype.setBit=Vt,s.prototype.clearBit=qt,s.prototype.flipBit=At,s.prototype.add=xt,s.prototype.subtract=Lt,s.prototype.multiply=It,s.prototype.divide=Zt,s.prototype.remainder=Ft,s.prototype.divideAndRemainder=Pt,s.prototype.modPow=ti,s.prototype.modInverse=ri,s.prototype.pow=Ht,s.prototype.gcd=ii,s.prototype.isProbablePrime=hi;
|
||
},{"./forge":"sQ2N"}],"W52u":[function(require,module,exports) {
|
||
var e=require("./forge");require("./md"),require("./util");var t=module.exports=e.sha1=e.sha1||{};e.md.sha1=e.md.algorithms.sha1=t,t.create=function(){r||n();var t=null,s=e.util.createBuffer(),u=new Array(80),a={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){a.messageLength=0,a.fullMessageLength=a.messageLength64=[];for(var h=a.messageLengthSize/4,r=0;r<h;++r)a.fullMessageLength.push(0);return s=e.util.createBuffer(),t={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},a}};return a.start(),a.update=function(h,r){"utf8"===r&&(h=e.util.encodeUtf8(h));var n=h.length;a.messageLength+=n,n=[n/4294967296>>>0,n>>>0];for(var l=a.fullMessageLength.length-1;l>=0;--l)a.fullMessageLength[l]+=n[1],n[1]=n[0]+(a.fullMessageLength[l]/4294967296>>>0),a.fullMessageLength[l]=a.fullMessageLength[l]>>>0,n[0]=n[1]/4294967296>>>0;return s.putBytes(h),g(t,u,s),(s.read>2048||0===s.length())&&s.compact(),a},a.digest=function(){var r=e.util.createBuffer();r.putBytes(s.bytes());var n,l=a.fullMessageLength[a.fullMessageLength.length-1]+a.messageLengthSize&a.blockLength-1;r.putBytes(h.substr(0,a.blockLength-l));for(var f=8*a.fullMessageLength[0],o=0;o<a.fullMessageLength.length-1;++o)f+=(n=8*a.fullMessageLength[o+1])/4294967296>>>0,r.putInt32(f>>>0),f=n>>>0;r.putInt32(f);var i={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4};g(i,u,r);var L=e.util.createBuffer();return L.putInt32(i.h0),L.putInt32(i.h1),L.putInt32(i.h2),L.putInt32(i.h3),L.putInt32(i.h4),L},a};var h=null,r=!1;function n(){h=String.fromCharCode(128),h+=e.util.fillString(String.fromCharCode(0),64),r=!0}function g(e,t,h){for(var r,n,g,s,u,a,l,f=h.length();f>=64;){for(n=e.h0,g=e.h1,s=e.h2,u=e.h3,a=e.h4,l=0;l<16;++l)r=h.getInt32(),t[l]=r,r=(n<<5|n>>>27)+(u^g&(s^u))+a+1518500249+r,a=u,u=s,s=(g<<30|g>>>2)>>>0,g=n,n=r;for(;l<20;++l)r=(r=t[l-3]^t[l-8]^t[l-14]^t[l-16])<<1|r>>>31,t[l]=r,r=(n<<5|n>>>27)+(u^g&(s^u))+a+1518500249+r,a=u,u=s,s=(g<<30|g>>>2)>>>0,g=n,n=r;for(;l<32;++l)r=(r=t[l-3]^t[l-8]^t[l-14]^t[l-16])<<1|r>>>31,t[l]=r,r=(n<<5|n>>>27)+(g^s^u)+a+1859775393+r,a=u,u=s,s=(g<<30|g>>>2)>>>0,g=n,n=r;for(;l<40;++l)r=(r=t[l-6]^t[l-16]^t[l-28]^t[l-32])<<2|r>>>30,t[l]=r,r=(n<<5|n>>>27)+(g^s^u)+a+1859775393+r,a=u,u=s,s=(g<<30|g>>>2)>>>0,g=n,n=r;for(;l<60;++l)r=(r=t[l-6]^t[l-16]^t[l-28]^t[l-32])<<2|r>>>30,t[l]=r,r=(n<<5|n>>>27)+(g&s|u&(g^s))+a+2400959708+r,a=u,u=s,s=(g<<30|g>>>2)>>>0,g=n,n=r;for(;l<80;++l)r=(r=t[l-6]^t[l-16]^t[l-28]^t[l-32])<<2|r>>>30,t[l]=r,r=(n<<5|n>>>27)+(g^s^u)+a+3395469782+r,a=u,u=s,s=(g<<30|g>>>2)>>>0,g=n,n=r;e.h0=e.h0+n|0,e.h1=e.h1+g|0,e.h2=e.h2+s|0,e.h3=e.h3+u|0,e.h4=e.h4+a|0,f-=64}}
|
||
},{"./forge":"sQ2N","./md":"hxOg","./util":"xBWF"}],"bhPE":[function(require,module,exports) {
|
||
var e=require("./forge");require("./util"),require("./random"),require("./sha1");var t=module.exports=e.pkcs1=e.pkcs1||{};function r(t,r,g){g||(g=e.md.sha1.create());for(var n="",i=Math.ceil(r/g.digestLength),s=0;s<i;++s){var h=String.fromCharCode(s>>24&255,s>>16&255,s>>8&255,255&s);g.start(),g.update(t+h),n+=g.digest().getBytes()}return n.substring(0,r)}t.encode_rsa_oaep=function(t,g,n){var i,s,h,d;"string"==typeof n?(i=n,s=arguments[3]||void 0,h=arguments[4]||void 0):n&&(i=n.label||void 0,s=n.seed||void 0,h=n.md||void 0,n.mgf1&&n.mgf1.md&&(d=n.mgf1.md)),h?h.start():h=e.md.sha1.create(),d||(d=h);var a=Math.ceil(t.n.bitLength()/8),o=a-2*h.digestLength-2;if(g.length>o)throw(c=new Error("RSAES-OAEP input message length is too long.")).length=g.length,c.maxLength=o,c;i||(i=""),h.update(i,"raw");for(var l=h.digest(),u="",v=o-g.length,f=0;f<v;f++)u+="\0";var m=l.getBytes()+u+""+g;if(s){if(s.length!==h.digestLength){var c;throw(c=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.")).seedLength=s.length,c.digestLength=h.digestLength,c}}else s=e.random.getBytes(h.digestLength);var L=r(s,a-h.digestLength-1,d),A=e.util.xorBytes(m,L,m.length),E=r(A,h.digestLength,d);return"\0"+e.util.xorBytes(s,E,s.length)+A},t.decode_rsa_oaep=function(t,g,n){var i,s,h;"string"==typeof n?(i=n,s=arguments[3]||void 0):n&&(i=n.label||void 0,s=n.md||void 0,n.mgf1&&n.mgf1.md&&(h=n.mgf1.md));var d=Math.ceil(t.n.bitLength()/8);if(g.length!==d)throw(L=new Error("RSAES-OAEP encoded message length is invalid.")).length=g.length,L.expectedLength=d,L;if(void 0===s?s=e.md.sha1.create():s.start(),h||(h=s),d<2*s.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");i||(i=""),s.update(i,"raw");for(var a=s.digest().getBytes(),o=g.charAt(0),l=g.substring(1,s.digestLength+1),u=g.substring(1+s.digestLength),v=r(u,s.digestLength,h),f=r(e.util.xorBytes(l,v,l.length),d-s.digestLength-1,h),m=e.util.xorBytes(u,f,u.length),c=m.substring(0,s.digestLength),L="\0"!==o,A=0;A<s.digestLength;++A)L|=a.charAt(A)!==c.charAt(A);for(var E=1,p=s.digestLength,w=s.digestLength;w<m.length;w++){var y=m.charCodeAt(w);L|=y&(E?65534:0),p+=E&=1&y^1}if(L||1!==m.charCodeAt(p))throw new Error("Invalid RSAES-OAEP padding.");return m.substring(p+1)};
|
||
},{"./forge":"sQ2N","./util":"xBWF","./random":"nQaA","./sha1":"W52u"}],"3Opc":[function(require,module,exports) {
|
||
var e=require("./forge");require("./util"),require("./jsbn"),require("./random"),function(){if(e.prime)module.exports=e.prime;else{var r=module.exports=e.prime=e.prime||{},n=e.jsbn.BigInteger,t=[6,4,2,4,2,4,6,2],i=new n(null);i.fromInt(30);var o=function(e,r){return e|r};r.generateProbablePrime=function(r,t,i){"function"==typeof t&&(i=t,t={});var o=(t=t||{}).algorithm||"PRIMEINC";"string"==typeof o&&(o={name:o}),o.options=o.options||{};var u=t.prng||e.random,s={nextBytes:function(e){for(var r=u.getBytesSync(e.length),n=0;n<e.length;++n)e[n]=r.charCodeAt(n)}};if("PRIMEINC"===o.name)return function(r,t,i,o){if("workers"in i)return function(r,t,i,o){if("undefined"==typeof Worker)return a(r,t,i,o);var u=f(r,t),s=i.workers,m=i.workLoad||100,l=30*m/8,d=i.workerScript||"forge/prime.worker.js";if(-1===s)return e.util.estimateCores(function(e,r){e&&(r=2),s=r-1,g()});function g(){s=Math.max(1,s);for(var e=[],i=0;i<s;++i)e[i]=new Worker(d);for(var i=0;i<s;++i)e[i].addEventListener("message",g);var a=!1;function g(i){if(!a){0;var s=i.data;if(s.found){for(var d=0;d<e.length;++d)e[d].terminate();return a=!0,o(null,new n(s.prime,16))}u.bitLength()>r&&(u=f(r,t));var g=u.toString(16);i.target.postMessage({hex:g,workLoad:m}),u.dAddOffset(l,0)}}}g()}(r,t,i,o);return a(r,t,i,o)}(r,s,o.options,i);throw new Error("Invalid prime generation algorithm: "+o.name)}}function a(r,n,i,o){var a=f(r,n),u=function(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}(a.bitLength());"millerRabinTests"in i&&(u=i.millerRabinTests);var s=10;"maxBlockTime"in i&&(s=i.maxBlockTime),function r(n,i,o,a,u,s,m){var l=+new Date;do{if(n.bitLength()>i&&(n=f(i,o)),n.isProbablePrime(u))return m(null,n);n.dAddOffset(t[a++%8],0)}while(s<0||+new Date-l<s);e.util.setImmediate(function(){r(n,i,o,a,u,s,m)})}(a,r,n,0,u,s,o)}function f(e,r){var t=new n(e,r),a=e-1;return t.testBit(a)||t.bitwiseTo(n.ONE.shiftLeft(a),o,t),t.dAddOffset(31-t.mod(i).byteValue(),0),t}}();
|
||
},{"./forge":"sQ2N","./util":"xBWF","./jsbn":"sroI","./random":"nQaA"}],"jinq":[function(require,module,exports) {
|
||
function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}var t=require("./forge");if(require("./asn1"),require("./jsbn"),require("./oids"),require("./pkcs1"),require("./prime"),require("./random"),require("./util"),void 0===r)var r=t.jsbn.BigInteger;var n=t.util.isNodejs?require("crypto"):null,a=t.asn1,o=t.util;t.pki=t.pki||{},module.exports=t.pki.rsa=t.rsa=t.rsa||{};var i=t.pki,s=[6,4,2,4,2,4,6,2],u={name:"PrivateKeyInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},p={name:"RSAPrivateKey",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},l={name:"RSAPublicKey",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},c=t.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:a.Class.UNIVERSAL,type:a.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},y=function(e){var t;if(!(e.algorithm in i.oids)){var r=new Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r}t=i.oids[e.algorithm];var n=a.oidToDer(t).getBytes(),o=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[]),s=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[]);s.value.push(a.create(a.Class.UNIVERSAL,a.Type.OID,!1,n)),s.value.push(a.create(a.Class.UNIVERSAL,a.Type.NULL,!1,""));var u=a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,e.digest().getBytes());return o.value.push(s),o.value.push(u),a.toDer(o).getBytes()},f=function(e,n,a){if(a)return e.modPow(n.e,n.n);if(!n.p||!n.q)return e.modPow(n.d,n.n);var o;n.dP||(n.dP=n.d.mod(n.p.subtract(r.ONE))),n.dQ||(n.dQ=n.d.mod(n.q.subtract(r.ONE))),n.qInv||(n.qInv=n.q.modInverse(n.p));do{o=new r(t.util.bytesToHex(t.random.getBytes(n.n.bitLength()/8)),16)}while(o.compareTo(n.n)>=0||!o.gcd(n.n).equals(r.ONE));for(var i=(e=e.multiply(o.modPow(n.e,n.n)).mod(n.n)).mod(n.p).modPow(n.dP,n.p),s=e.mod(n.q).modPow(n.dQ,n.q);i.compareTo(s)<0;)i=i.add(n.p);var u=i.subtract(s).multiply(n.qInv).mod(n.p).multiply(n.q).add(s);return u=u.multiply(o.modInverse(n.n)).mod(n.n)};function E(e,r,n){var a=t.util.createBuffer(),o=Math.ceil(r.n.bitLength()/8);if(e.length>o-11){var i=new Error("Message is too long for PKCS#1 v1.5 padding.");throw i.length=e.length,i.max=o-11,i}a.putByte(0),a.putByte(n);var s,u=o-3-e.length;if(0===n||1===n){s=0===n?0:255;for(var p=0;p<u;++p)a.putByte(s)}else for(;u>0;){var l=0,c=t.random.getBytes(u);for(p=0;p<u;++p)0===(s=c.charCodeAt(p))?++l:a.putByte(s);u=l}return a.putByte(0),a.putBytes(e),a}function d(e,r,n,a){var o=Math.ceil(r.n.bitLength()/8),i=t.util.createBuffer(e),s=i.getByte(),u=i.getByte();if(0!==s||n&&0!==u&&1!==u||!n&&2!=u||n&&0===u&&void 0===a)throw new Error("Encryption block is invalid.");var p=0;if(0===u){p=o-3-a;for(var l=0;l<p;++l)if(0!==i.getByte())throw new Error("Encryption block is invalid.")}else if(1===u)for(p=0;i.length()>1;){if(255!==i.getByte()){--i.read;break}++p}else if(2===u)for(p=0;i.length()>1;){if(0===i.getByte()){--i.read;break}++p}if(0!==i.getByte()||p!==o-3-i.length())throw new Error("Encryption block is invalid.");return i.getBytes()}function v(e,n,a){"function"==typeof n&&(a=n,n={});var o={algorithm:{name:(n=n||{}).algorithm||"PRIMEINC",options:{workers:n.workers||2,workLoad:n.workLoad||100,workerScript:n.workerScript}}};function s(){u(e.pBits,function(t,r){return t?a(t):(e.p=r,null!==e.q?p(t,e.q):void u(e.qBits,p))})}function u(e,r){t.prime.generateProbablePrime(e,o,r)}function p(t,n){if(t)return a(t);if(e.q=n,e.p.compareTo(e.q)<0){var o=e.p;e.p=e.q,e.q=o}if(0!==e.p.subtract(r.ONE).gcd(e.e).compareTo(r.ONE))return e.p=null,void s();if(0!==e.q.subtract(r.ONE).gcd(e.e).compareTo(r.ONE))return e.q=null,void u(e.qBits,p);if(e.p1=e.p.subtract(r.ONE),e.q1=e.q.subtract(r.ONE),e.phi=e.p1.multiply(e.q1),0!==e.phi.gcd(e.e).compareTo(r.ONE))return e.p=e.q=null,void s();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void u(e.qBits,p);var l=e.e.modInverse(e.phi);e.keys={privateKey:i.rsa.setPrivateKey(e.n,e.e,l,e.p,e.q,l.mod(e.p1),l.mod(e.q1),e.q.modInverse(e.p)),publicKey:i.rsa.setPublicKey(e.n,e.e)},a(null,e.keys)}"prng"in n&&(o.prng=n.prng),s()}function S(e){var r=e.toString(16);r[0]>="8"&&(r="00"+r);var n=t.util.hexToBytes(r);return n.length>1&&(0===n.charCodeAt(0)&&0==(128&n.charCodeAt(1))||255===n.charCodeAt(0)&&128==(128&n.charCodeAt(1)))?n.substr(1):n}function m(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function g(e){return t.util.isNodejs&&"function"==typeof n[e]}function b(t){return void 0!==o.globalScope&&"object"===e(o.globalScope.crypto)&&"object"===e(o.globalScope.crypto.subtle)&&"function"==typeof o.globalScope.crypto.subtle[t]}function K(t){return void 0!==o.globalScope&&"object"===e(o.globalScope.msCrypto)&&"object"===e(o.globalScope.msCrypto.subtle)&&"function"==typeof o.globalScope.msCrypto.subtle[t]}function N(e){for(var r=t.util.hexToBytes(e.toString(16)),n=new Uint8Array(r.length),a=0;a<r.length;++a)n[a]=r.charCodeAt(a);return n}function R(e){if("RSA"!==e.kty)throw new Error('Unsupported key algorithm "'+e.kty+'"; algorithm must be "RSA".');return i.setRsaPrivateKey(I(e.n),I(e.e),I(e.d),I(e.p),I(e.q),I(e.dp),I(e.dq),I(e.qi))}function C(e){if("RSA"!==e.kty)throw new Error('Key algorithm must be "RSA".');return i.setRsaPublicKey(I(e.n),I(e.e))}function I(e){return new r(t.util.bytesToHex(t.util.decode64(e)),16)}i.rsa.encrypt=function(e,n,a){var o,i=a,s=Math.ceil(n.n.bitLength()/8);!1!==a&&!0!==a?(i=2===a,o=E(e,n,a)):(o=t.util.createBuffer()).putBytes(e);for(var u=new r(o.toHex(),16),p=f(u,n,i).toString(16),l=t.util.createBuffer(),c=s-Math.ceil(p.length/2);c>0;)l.putByte(0),--c;return l.putBytes(t.util.hexToBytes(p)),l.getBytes()},i.rsa.decrypt=function(e,n,a,o){var i=Math.ceil(n.n.bitLength()/8);if(e.length!==i){var s=new Error("Encrypted message length is invalid.");throw s.length=e.length,s.expected=i,s}var u=new r(t.util.createBuffer(e).toHex(),16);if(u.compareTo(n.n)>=0)throw new Error("Encrypted message is invalid.");for(var p=f(u,n,a).toString(16),l=t.util.createBuffer(),c=i-Math.ceil(p.length/2);c>0;)l.putByte(0),--c;return l.putBytes(t.util.hexToBytes(p)),!1!==o?d(l.getBytes(),n,a):l.getBytes()},i.rsa.createKeyPairGenerationState=function(e,n,a){"string"==typeof e&&(e=parseInt(e,10)),e=e||2048;var o,i=(a=a||{}).prng||t.random,s={nextBytes:function(e){for(var t=i.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}},u=a.algorithm||"PRIMEINC";if("PRIMEINC"!==u)throw new Error("Invalid key generation algorithm: "+u);return(o={algorithm:u,state:0,bits:e,rng:s,eInt:n||65537,e:new r(null),p:null,q:null,qBits:e>>1,pBits:e-(e>>1),pqState:0,num:null,keys:null}).e.fromInt(o.eInt),o},i.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var n=new r(null);n.fromInt(30);for(var a,o=0,u=function(e,t){return e|t},p=+new Date,l=0;null===e.keys&&(t<=0||l<t);){if(0===e.state){var c=null===e.p?e.pBits:e.qBits,y=c-1;0===e.pqState?(e.num=new r(c,e.rng),e.num.testBit(y)||e.num.bitwiseTo(r.ONE.shiftLeft(y),u,e.num),e.num.dAddOffset(31-e.num.mod(n).byteValue(),0),o=0,++e.pqState):1===e.pqState?e.num.bitLength()>c?e.pqState=0:e.num.isProbablePrime(m(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(s[o++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(r.ONE).gcd(e.e).compareTo(r.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(r.ONE),e.q1=e.q.subtract(r.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(r.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var f=e.e.modInverse(e.phi);e.keys={privateKey:i.rsa.setPrivateKey(e.n,e.e,f,e.p,e.q,f.mod(e.p1),f.mod(e.q1),e.q.modInverse(e.p)),publicKey:i.rsa.setPublicKey(e.n,e.e)}}l+=(a=+new Date)-p,p=a}return null!==e.keys},i.rsa.generateKeyPair=function(r,s,u,p){if(1===arguments.length?"object"===e(r)?(u=r,r=void 0):"function"==typeof r&&(p=r,r=void 0):2===arguments.length?"number"==typeof r?"function"==typeof s?(p=s,s=void 0):"number"!=typeof s&&(u=s,s=void 0):(u=r,p=s,r=void 0,s=void 0):3===arguments.length&&("number"==typeof s?"function"==typeof u&&(p=u,u=void 0):(p=u,u=s,s=void 0)),u=u||{},void 0===r&&(r=u.bits||2048),void 0===s&&(s=u.e||65537),!t.options.usePureJavaScript&&!u.prng&&r>=256&&r<=16384&&(65537===s||3===s))if(p){if(g("generateKeyPair"))return n.generateKeyPair("rsa",{modulusLength:r,publicExponent:s,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(e,t,r){if(e)return p(e);p(null,{privateKey:i.privateKeyFromPem(r),publicKey:i.publicKeyFromPem(t)})});if(b("generateKey")&&b("exportKey"))return o.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:r,publicExponent:N(s),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(e){return o.globalScope.crypto.subtle.exportKey("pkcs8",e.privateKey)}).then(void 0,function(e){p(e)}).then(function(e){if(e){var r=i.privateKeyFromAsn1(a.fromDer(t.util.createBuffer(e)));p(null,{privateKey:r,publicKey:i.setRsaPublicKey(r.n,r.e)})}});if(K("generateKey")&&K("exportKey")){var l=o.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:r,publicExponent:N(s),hash:{name:"SHA-256"}},!0,["sign","verify"]);return l.oncomplete=function(e){var r=e.target.result,n=o.globalScope.msCrypto.subtle.exportKey("pkcs8",r.privateKey);n.oncomplete=function(e){var r=e.target.result,n=i.privateKeyFromAsn1(a.fromDer(t.util.createBuffer(r)));p(null,{privateKey:n,publicKey:i.setRsaPublicKey(n.n,n.e)})},n.onerror=function(e){p(e)}},void(l.onerror=function(e){p(e)})}}else if(g("generateKeyPairSync")){var c=n.generateKeyPairSync("rsa",{modulusLength:r,publicExponent:s,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:i.privateKeyFromPem(c.privateKey),publicKey:i.publicKeyFromPem(c.publicKey)}}var y=i.rsa.createKeyPairGenerationState(r,s,u);if(!p)return i.rsa.stepKeyPairGenerationState(y,0),y.keys;v(y,u,p)},i.setRsaPublicKey=i.rsa.setPublicKey=function(e,r){var n={n:e,e:r,encrypt:function(e,r,a){if("string"==typeof r?r=r.toUpperCase():void 0===r&&(r="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===r)r={encode:function(e,t,r){return E(e,t,2).getBytes()}};else if("RSA-OAEP"===r||"RSAES-OAEP"===r)r={encode:function(e,r){return t.pkcs1.encode_rsa_oaep(r,e,a)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(r))r={encode:function(e){return e}};else if("string"==typeof r)throw new Error('Unsupported encryption scheme: "'+r+'".');var o=r.encode(e,n,!0);return i.rsa.encrypt(o,n,!0)},verify:function(e,t,r){"string"==typeof r?r=r.toUpperCase():void 0===r&&(r="RSASSA-PKCS1-V1_5"),"RSASSA-PKCS1-V1_5"===r?r={verify:function(e,t){return t=d(t,n,!0),e===a.fromDer(t).value[1].value}}:"NONE"!==r&&"NULL"!==r&&null!==r||(r={verify:function(e,t){return e===(t=d(t,n,!0))}});var o=i.rsa.decrypt(t,n,!0,!1);return r.verify(e,o,n.n.bitLength())}};return n},i.setRsaPrivateKey=i.rsa.setPrivateKey=function(e,r,n,a,o,s,u,p){var l={n:e,e:r,d:n,p:a,q:o,dP:s,dQ:u,qInv:p,decrypt:function(e,r,n){"string"==typeof r?r=r.toUpperCase():void 0===r&&(r="RSAES-PKCS1-V1_5");var a=i.rsa.decrypt(e,l,!1,!1);if("RSAES-PKCS1-V1_5"===r)r={decode:d};else if("RSA-OAEP"===r||"RSAES-OAEP"===r)r={decode:function(e,r){return t.pkcs1.decode_rsa_oaep(r,e,n)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(r))throw new Error('Unsupported encryption scheme: "'+r+'".');r={decode:function(e){return e}}}return r.decode(a,l,!1)},sign:function(e,t){var r=!1;"string"==typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:y},r=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},r=1);var n=t.encode(e,l.n.bitLength());return i.rsa.encrypt(n,l,r)}};return l},i.wrapRsaPrivateKey=function(e){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,a.integerToDer(0).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(i.oids.rsaEncryption).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.NULL,!1,"")]),a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,a.toDer(e).getBytes())])},i.privateKeyFromAsn1=function(e){var n,o,s,l,c,y,f,E,d={},v=[];if(a.validate(e,u,d,v)&&(e=a.fromDer(t.util.createBuffer(d.privateKey))),d={},v=[],!a.validate(e,p,d,v)){var S=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw S.errors=v,S}return n=t.util.createBuffer(d.privateKeyModulus).toHex(),o=t.util.createBuffer(d.privateKeyPublicExponent).toHex(),s=t.util.createBuffer(d.privateKeyPrivateExponent).toHex(),l=t.util.createBuffer(d.privateKeyPrime1).toHex(),c=t.util.createBuffer(d.privateKeyPrime2).toHex(),y=t.util.createBuffer(d.privateKeyExponent1).toHex(),f=t.util.createBuffer(d.privateKeyExponent2).toHex(),E=t.util.createBuffer(d.privateKeyCoefficient).toHex(),i.setRsaPrivateKey(new r(n,16),new r(o,16),new r(s,16),new r(l,16),new r(c,16),new r(y,16),new r(f,16),new r(E,16))},i.privateKeyToAsn1=i.privateKeyToRSAPrivateKey=function(e){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,a.integerToDer(0).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,S(e.n)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,S(e.e)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,S(e.d)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,S(e.p)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,S(e.q)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,S(e.dP)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,S(e.dQ)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,S(e.qInv))])},i.publicKeyFromAsn1=function(e){var n={},o=[];if(a.validate(e,c,n,o)){var s,u=a.derToOid(n.publicKeyOid);if(u!==i.oids.rsaEncryption)throw(s=new Error("Cannot read public key. Unknown OID.")).oid=u,s;e=n.rsaPublicKey}if(o=[],!a.validate(e,l,n,o))throw(s=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=o,s;var p=t.util.createBuffer(n.publicKeyModulus).toHex(),y=t.util.createBuffer(n.publicKeyExponent).toHex();return i.setRsaPublicKey(new r(p,16),new r(y,16))},i.publicKeyToAsn1=i.publicKeyToSubjectPublicKeyInfo=function(e){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(i.oids.rsaEncryption).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.NULL,!1,"")]),a.create(a.Class.UNIVERSAL,a.Type.BITSTRING,!1,[i.publicKeyToRSAPublicKey(e)])])},i.publicKeyToRSAPublicKey=function(e){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,S(e.n)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,S(e.e))])};
|
||
},{"./forge":"sQ2N","./asn1":"a/tu","./jsbn":"sroI","./oids":"wnpW","./pkcs1":"bhPE","./prime":"3Opc","./random":"nQaA","./util":"xBWF","crypto":"sC8V"}],"oB5+":[function(require,module,exports) {
|
||
var e=require("./forge");if(require("./aes"),require("./asn1"),require("./des"),require("./md"),require("./oids"),require("./pbkdf2"),require("./pem"),require("./random"),require("./rc2"),require("./rsa"),require("./util"),void 0===t)var t=e.jsbn.BigInteger;var r=e.asn1,a=e.pki=e.pki||{};module.exports=a.pbe=e.pbe=e.pbe||{};var s=a.oids,n={name:"EncryptedPrivateKeyInfo",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:r.Class.UNIVERSAL,type:r.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},i={name:"PBES2Algorithms",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:r.Class.UNIVERSAL,type:r.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:r.Class.UNIVERSAL,type:r.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:r.Class.UNIVERSAL,type:r.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:r.Class.UNIVERSAL,type:r.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},o={name:"pkcs-12PbeParams",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:r.Class.UNIVERSAL,type:r.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:r.Class.UNIVERSAL,type:r.Type.INTEGER,constructed:!1,capture:"iterations"}]};function p(e,t){return e.start().update(t).digest().getBytes()}function c(e){var t;if(e){if(!(t=a.oids[r.derToOid(e)])){var s=new Error("Unsupported PRF OID.");throw s.oid=e,s.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],s}}else t="hmacWithSHA1";return y(t)}function y(t){var r=e.md;switch(t){case"hmacWithSHA224":r=e.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":t=t.substr(8).toLowerCase();break;default:var a=new Error("Unsupported PRF algorithm.");throw a.algorithm=t,a.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],a}if(!(r&&t in r))throw new Error("Unknown hash algorithm: "+t);return r[t].create()}function E(t,s,n,i){var o=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,t),r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,s.getBytes())]);return"hmacWithSHA1"!==i&&o.value.push(r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,e.util.hexToBytes(n.toString(16))),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(a.oids[i]).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.NULL,!1,"")])),o}a.encryptPrivateKeyInfo=function(t,n,i){(i=i||{}).saltSize=i.saltSize||8,i.count=i.count||2048,i.algorithm=i.algorithm||"aes128",i.prfAlgorithm=i.prfAlgorithm||"sha1";var o,p,c,C=e.random.getBytesSync(i.saltSize),d=i.count,l=r.integerToDer(d);if(0===i.algorithm.indexOf("aes")||"des"===i.algorithm){var u,h,S;switch(i.algorithm){case"aes128":o=16,u=16,h=s["aes128-CBC"],S=e.aes.createEncryptionCipher;break;case"aes192":o=24,u=16,h=s["aes192-CBC"],S=e.aes.createEncryptionCipher;break;case"aes256":o=32,u=16,h=s["aes256-CBC"],S=e.aes.createEncryptionCipher;break;case"des":o=8,u=8,h=s.desCBC,S=e.des.createEncryptionCipher;break;default:throw(T=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=i.algorithm,T}var m="hmacWith"+i.prfAlgorithm.toUpperCase(),f=y(m),B=e.pkcs5.pbkdf2(n,C,d,o,f),g=e.random.getBytesSync(u);(v=S(B)).start(g),v.update(r.toDer(t)),v.finish(),c=v.output.getBytes();var A=E(C,l,o,m);p=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(s.pkcs5PBES2).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(s.pkcs5PBKDF2).getBytes()),A]),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(h).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,g)])])])}else{var T;if("3des"!==i.algorithm)throw(T=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=i.algorithm,T;o=24;var v,I=new e.util.ByteBuffer(C);B=a.pbe.generatePkcs12Key(n,I,1,d,o),g=a.pbe.generatePkcs12Key(n,I,2,d,o);(v=e.des.createEncryptionCipher(B)).start(g),v.update(r.toDer(t)),v.finish(),c=v.output.getBytes(),p=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(s["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,C),r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,l.getBytes())])])}return r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[p,r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,c)])},a.decryptPrivateKeyInfo=function(t,s){var i=null,o={},p=[];if(!r.validate(t,n,o,p)){var c=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw c.errors=p,c}var y=r.derToOid(o.encryptionOid),E=a.pbe.getCipher(y,o.encryptionParams,s),C=e.util.createBuffer(o.encryptedData);return E.update(C),E.finish()&&(i=r.fromDer(E.output)),i},a.encryptedPrivateKeyToPem=function(t,a){var s={type:"ENCRYPTED PRIVATE KEY",body:r.toDer(t).getBytes()};return e.pem.encode(s,{maxline:a})},a.encryptedPrivateKeyFromPem=function(t){var a=e.pem.decode(t)[0];if("ENCRYPTED PRIVATE KEY"!==a.type){var s=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw s.headerType=a.type,s}if(a.procType&&"ENCRYPTED"===a.procType.type)throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return r.fromDer(a.body)},a.encryptRsaPrivateKey=function(t,s,n){if(!(n=n||{}).legacy){var i=a.wrapRsaPrivateKey(a.privateKeyToAsn1(t));return i=a.encryptPrivateKeyInfo(i,s,n),a.encryptedPrivateKeyToPem(i)}var o,p,c,y;switch(n.algorithm){case"aes128":o="AES-128-CBC",c=16,p=e.random.getBytesSync(16),y=e.aes.createEncryptionCipher;break;case"aes192":o="AES-192-CBC",c=24,p=e.random.getBytesSync(16),y=e.aes.createEncryptionCipher;break;case"aes256":o="AES-256-CBC",c=32,p=e.random.getBytesSync(16),y=e.aes.createEncryptionCipher;break;case"3des":o="DES-EDE3-CBC",c=24,p=e.random.getBytesSync(8),y=e.des.createEncryptionCipher;break;case"des":o="DES-CBC",c=8,p=e.random.getBytesSync(8),y=e.des.createEncryptionCipher;break;default:var E=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+n.algorithm+'".');throw E.algorithm=n.algorithm,E}var C=y(e.pbe.opensslDeriveBytes(s,p.substr(0,8),c));C.start(p),C.update(r.toDer(a.privateKeyToAsn1(t))),C.finish();var d={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:o,parameters:e.util.bytesToHex(p).toUpperCase()},body:C.output.getBytes()};return e.pem.encode(d)},a.decryptRsaPrivateKey=function(t,s){var n=null,i=e.pem.decode(t)[0];if("ENCRYPTED PRIVATE KEY"!==i.type&&"PRIVATE KEY"!==i.type&&"RSA PRIVATE KEY"!==i.type)throw(c=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".')).headerType=c,c;if(i.procType&&"ENCRYPTED"===i.procType.type){var o,p;switch(i.dekInfo.algorithm){case"DES-CBC":o=8,p=e.des.createDecryptionCipher;break;case"DES-EDE3-CBC":o=24,p=e.des.createDecryptionCipher;break;case"AES-128-CBC":o=16,p=e.aes.createDecryptionCipher;break;case"AES-192-CBC":o=24,p=e.aes.createDecryptionCipher;break;case"AES-256-CBC":o=32,p=e.aes.createDecryptionCipher;break;case"RC2-40-CBC":o=5,p=function(t){return e.rc2.createDecryptionCipher(t,40)};break;case"RC2-64-CBC":o=8,p=function(t){return e.rc2.createDecryptionCipher(t,64)};break;case"RC2-128-CBC":o=16,p=function(t){return e.rc2.createDecryptionCipher(t,128)};break;default:var c;throw(c=new Error('Could not decrypt private key; unsupported encryption algorithm "'+i.dekInfo.algorithm+'".')).algorithm=i.dekInfo.algorithm,c}var y=e.util.hexToBytes(i.dekInfo.parameters),E=p(e.pbe.opensslDeriveBytes(s,y.substr(0,8),o));if(E.start(y),E.update(e.util.createBuffer(i.body)),!E.finish())return n;n=E.output.getBytes()}else n=i.body;return null!==(n="ENCRYPTED PRIVATE KEY"===i.type?a.decryptPrivateKeyInfo(r.fromDer(n),s):r.fromDer(n))&&(n=a.privateKeyFromAsn1(n)),n},a.pbe.generatePkcs12Key=function(t,r,a,s,n,i){var o,p;if(null==i){if(!("sha1"in e.md))throw new Error('"sha1" hash algorithm unavailable.');i=e.md.sha1.create()}var c=i.digestLength,y=i.blockLength,E=new e.util.ByteBuffer,C=new e.util.ByteBuffer;if(null!=t){for(p=0;p<t.length;p++)C.putInt16(t.charCodeAt(p));C.putInt16(0)}var d=C.length(),l=r.length(),u=new e.util.ByteBuffer;u.fillWithByte(a,y);var h=y*Math.ceil(l/y),S=new e.util.ByteBuffer;for(p=0;p<h;p++)S.putByte(r.at(p%l));var m=y*Math.ceil(d/y),f=new e.util.ByteBuffer;for(p=0;p<m;p++)f.putByte(C.at(p%d));var B=S;B.putBuffer(f);for(var g=Math.ceil(n/c),A=1;A<=g;A++){var T=new e.util.ByteBuffer;T.putBytes(u.bytes()),T.putBytes(B.bytes());for(var v=0;v<s;v++)i.start(),i.update(T.getBytes()),T=i.digest();var I=new e.util.ByteBuffer;for(p=0;p<y;p++)I.putByte(T.at(p%c));var R=Math.ceil(l/y)+Math.ceil(d/y),N=new e.util.ByteBuffer;for(o=0;o<R;o++){var P=new e.util.ByteBuffer(B.getBytes(y)),b=511;for(p=I.length()-1;p>=0;p--)b>>=8,b+=I.at(p)+P.at(p),P.setAt(p,255&b);N.putBuffer(P)}B=N,E.putBuffer(T)}return E.truncate(E.length()-n),E},a.pbe.getCipher=function(e,t,r){switch(e){case a.oids.pkcs5PBES2:return a.pbe.getCipherForPBES2(e,t,r);case a.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case a.oids["pbewithSHAAnd40BitRC2-CBC"]:return a.pbe.getCipherForPKCS12PBE(e,t,r);default:var s=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw s.oid=e,s.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],s}},a.pbe.getCipherForPBES2=function(t,s,n){var o,p={},y=[];if(!r.validate(s,i,p,y))throw(o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=y,o;if((t=r.derToOid(p.kdfOid))!==a.oids.pkcs5PBKDF2)throw(o=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.")).oid=t,o.supportedOids=["pkcs5PBKDF2"],o;if((t=r.derToOid(p.encOid))!==a.oids["aes128-CBC"]&&t!==a.oids["aes192-CBC"]&&t!==a.oids["aes256-CBC"]&&t!==a.oids["des-EDE3-CBC"]&&t!==a.oids.desCBC)throw(o=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.")).oid=t,o.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],o;var E,C,d=p.kdfSalt,l=e.util.createBuffer(p.kdfIterationCount);switch(l=l.getInt(l.length()<<3),a.oids[t]){case"aes128-CBC":E=16,C=e.aes.createDecryptionCipher;break;case"aes192-CBC":E=24,C=e.aes.createDecryptionCipher;break;case"aes256-CBC":E=32,C=e.aes.createDecryptionCipher;break;case"des-EDE3-CBC":E=24,C=e.des.createDecryptionCipher;break;case"desCBC":E=8,C=e.des.createDecryptionCipher}var u=c(p.prfOid),h=e.pkcs5.pbkdf2(n,d,l,E,u),S=p.encIv,m=C(h);return m.start(S),m},a.pbe.getCipherForPKCS12PBE=function(t,s,n){var i={},p=[];if(!r.validate(s,o,i,p))throw(u=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=p,u;var y,E,C,d=e.util.createBuffer(i.salt),l=e.util.createBuffer(i.iterations);switch(l=l.getInt(l.length()<<3),t){case a.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:y=24,E=8,C=e.des.startDecrypting;break;case a.oids["pbewithSHAAnd40BitRC2-CBC"]:y=5,E=8,C=function(t,r){var a=e.rc2.createDecryptionCipher(t,40);return a.start(r,null),a};break;default:var u;throw(u=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.")).oid=t,u}var h=c(i.prfOid),S=a.pbe.generatePkcs12Key(n,d,1,l,y,h);return h.start(),C(S,a.pbe.generatePkcs12Key(n,d,2,l,E,h))},a.pbe.opensslDeriveBytes=function(t,r,a,s){if(null==s){if(!("md5"in e.md))throw new Error('"md5" hash algorithm unavailable.');s=e.md.md5.create()}null===r&&(r="");for(var n=[p(s,t+r)],i=16,o=1;i<a;++o,i+=16)n.push(p(s,n[o-1]+t+r));return n.join("").substr(0,a)};
|
||
},{"./forge":"sQ2N","./aes":"45sZ","./asn1":"a/tu","./des":"6HoC","./md":"hxOg","./oids":"wnpW","./pbkdf2":"yGzJ","./pem":"52IQ","./random":"nQaA","./rc2":"qWri","./rsa":"jinq","./util":"xBWF"}],"sNRc":[function(require,module,exports) {
|
||
"use strict";function e(e,t,r,n,i,a,u){try{var s=e[a](u),o=s.value}catch(c){return void r(c)}s.done?t(o):Promise.resolve(o).then(n,i)}function t(t){return function(){var r=this,n=arguments;return new Promise(function(i,a){var u=t.apply(r,n);function s(t){e(u,i,a,s,o,"next",t)}function o(t){e(u,i,a,s,o,"throw",t)}s(void 0)})}}var r=require("uint8arrays/concat"),n=require("uint8arrays/from-string"),i=require("../webcrypto");function a(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=e.algorithm,u=void 0===a?"AES-GCM":a,s=e.nonceLength,o=void 0===s?12:s,c=e.keyLength,v=void 0===c?16:c,p=e.digest,l=void 0===p?"SHA-256":p,y=e.saltLength,d=void 0===y?16:y,m=e.iterations,h=void 0===m?32767:m,f=i.get();function g(){return(g=t(regeneratorRuntime.mark(function e(t,i){var a,s,c,p,y,m,g;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=f.getRandomValues(new Uint8Array(d)),s=f.getRandomValues(new Uint8Array(o)),c={name:u,iv:s},p={name:"PBKDF2",salt:a,iterations:h,hash:{name:l}},e.next=6,f.subtle.importKey("raw",n(i),{name:"PBKDF2"},!1,["deriveKey","deriveBits"]);case 6:return y=e.sent,e.next=9,f.subtle.deriveKey(p,y,{name:u,length:v},!0,["encrypt"]);case 9:return m=e.sent,e.next=12,f.subtle.encrypt(c,m,t);case 12:return g=e.sent,e.abrupt("return",r([a,c.iv,new Uint8Array(g)]));case 14:case"end":return e.stop()}},e)}))).apply(this,arguments)}function w(){return(w=t(regeneratorRuntime.mark(function e(t,r){var i,a,s,c,p,y,m,g;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.slice(0,d),a=t.slice(d,d+o),s=t.slice(d+o),c={name:u,iv:a},p={name:"PBKDF2",salt:i,iterations:h,hash:{name:l}},e.next=7,f.subtle.importKey("raw",n(r),{name:"PBKDF2"},!1,["deriveKey","deriveBits"]);case 7:return y=e.sent,e.next=10,f.subtle.deriveKey(p,y,{name:u,length:v},!0,["decrypt"]);case 10:return m=e.sent,e.next=13,f.subtle.decrypt(c,m,s);case 13:return g=e.sent,e.abrupt("return",new Uint8Array(g));case 15:case"end":return e.stop()}},e)}))).apply(this,arguments)}return v*=8,{encrypt:function(e,t){return g.apply(this,arguments)},decrypt:function(e,t){return w.apply(this,arguments)}}}module.exports={create:a};
|
||
},{"uint8arrays/concat":"qYui","uint8arrays/from-string":"Sqgj","../webcrypto":"AJ6b"}],"GO2o":[function(require,module,exports) {
|
||
"use strict";function e(e,r,t,n,u,i,o){try{var a=e[i](o),c=a.value}catch(s){return void t(s)}a.done?r(c):Promise.resolve(c).then(n,u)}function r(r){return function(){var t=this,n=arguments;return new Promise(function(u,i){var o=r.apply(t,n);function a(r){e(o,u,i,a,c,"next",r)}function c(r){e(o,u,i,a,c,"throw",r)}a(void 0)})}}var t=require("multibase"),n=require("../ciphers/aes-gcm");module.exports={import:function(){var e=r(regeneratorRuntime.mark(function e(r,u){var i,o,a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.names.base64,o=i.decode(r),a=n.create(),e.next=5,a.decrypt(o,u);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}},e)}));return function(r,t){return e.apply(this,arguments)}}()};
|
||
},{"multibase":"VB0b","../ciphers/aes-gcm":"sNRc"}],"D6DO":[function(require,module,exports) {
|
||
"use strict";function e(e,t,r,n,u,a,s){try{var i=e[a](s),o=i.value}catch(c){return void r(c)}i.done?t(o):Promise.resolve(o).then(n,u)}function t(t){return function(){var r=this,n=arguments;return new Promise(function(u,a){var s=t.apply(r,n);function i(t){e(s,u,a,i,o,"next",t)}function o(t){e(s,u,a,i,o,"throw",t)}i(void 0)})}}var r=require("multihashes"),n=self.crypto||self.msCrypto,u=function(){var e=t(regeneratorRuntime.mark(function e(t,r){var u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("undefined"!=typeof self&&n){e.next=2;break}throw new Error("Please use a browser with webcrypto support and ensure the code has been delivered securely via HTTPS/TLS and run within a Secure Context");case 2:e.t0=r,e.next="sha1"===e.t0?5:"sha2-256"===e.t0?10:"sha2-512"===e.t0?15:"dbl-sha2-256"===e.t0?20:28;break;case 5:return e.t1=Uint8Array,e.next=8,n.subtle.digest({name:"SHA-1"},t);case 8:return e.t2=e.sent,e.abrupt("return",new e.t1(e.t2));case 10:return e.t3=Uint8Array,e.next=13,n.subtle.digest({name:"SHA-256"},t);case 13:return e.t4=e.sent,e.abrupt("return",new e.t3(e.t4));case 15:return e.t5=Uint8Array,e.next=18,n.subtle.digest({name:"SHA-512"},t);case 18:return e.t6=e.sent,e.abrupt("return",new e.t5(e.t6));case 20:return e.next=22,n.subtle.digest({name:"SHA-256"},t);case 22:return u=e.sent,e.t7=Uint8Array,e.next=26,n.subtle.digest({name:"SHA-256"},u);case 26:return e.t8=e.sent,e.abrupt("return",new e.t7(e.t8));case 28:throw new Error("".concat(r," is not a supported algorithm"));case 29:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}();module.exports={factory:function(e){return function(){var r=t(regeneratorRuntime.mark(function t(r){return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",u(r,e));case 1:case"end":return t.stop()}},t)}));return function(e){return r.apply(this,arguments)}}()},digest:u,multihashing:function(){var e=t(regeneratorRuntime.mark(function e(t,n,a){var s;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u(t,n);case 2:return s=e.sent,e.abrupt("return",r.encode(s,n,a));case 4:case"end":return e.stop()}},e)}));return function(t,r,n){return e.apply(this,arguments)}}()};
|
||
},{"multihashes":"gjv/"}],"84ko":[function(require,module,exports) {
|
||
var e=require("./forge");require("./md"),require("./util");var t=module.exports=e.sha512=e.sha512||{};e.md.sha512=e.md.algorithms.sha512=t;var a=e.sha384=e.sha512.sha384=e.sha512.sha384||{};a.create=function(){return t.create("SHA-384")},e.md.sha384=e.md.algorithms.sha384=a,e.sha512.sha256=e.sha512.sha256||{create:function(){return t.create("SHA-512/256")}},e.md["sha512/256"]=e.md.algorithms["sha512/256"]=e.sha512.sha256,e.sha512.sha224=e.sha512.sha224||{create:function(){return t.create("SHA-512/224")}},e.md["sha512/224"]=e.md.algorithms["sha512/224"]=e.sha512.sha224,t.create=function(t){if(s||l(),void 0===t&&(t="SHA-512"),!(t in h))throw new Error("Invalid SHA-512 algorithm: "+t);for(var a=h[t],n=null,u=e.util.createBuffer(),f=new Array(80),o=0;o<80;++o)f[o]=new Array(2);var i=64;switch(t){case"SHA-384":i=48;break;case"SHA-512/256":i=32;break;case"SHA-512/224":i=28}var c={algorithm:t.replace("-","").toLowerCase(),blockLength:128,digestLength:i,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){c.messageLength=0,c.fullMessageLength=c.messageLength128=[];for(var t=c.messageLengthSize/4,r=0;r<t;++r)c.fullMessageLength.push(0);u=e.util.createBuffer(),n=new Array(a.length);for(r=0;r<a.length;++r)n[r]=a[r].slice(0);return c}};return c.start(),c.update=function(t,a){"utf8"===a&&(t=e.util.encodeUtf8(t));var r=t.length;c.messageLength+=r,r=[r/4294967296>>>0,r>>>0];for(var s=c.fullMessageLength.length-1;s>=0;--s)c.fullMessageLength[s]+=r[1],r[1]=r[0]+(c.fullMessageLength[s]/4294967296>>>0),c.fullMessageLength[s]=c.fullMessageLength[s]>>>0,r[0]=r[1]/4294967296>>>0;return u.putBytes(t),g(n,f,u),(u.read>2048||0===u.length())&&u.compact(),c},c.digest=function(){var a=e.util.createBuffer();a.putBytes(u.bytes());var s,h=c.fullMessageLength[c.fullMessageLength.length-1]+c.messageLengthSize&c.blockLength-1;a.putBytes(r.substr(0,c.blockLength-h));for(var l=8*c.fullMessageLength[0],o=0;o<c.fullMessageLength.length-1;++o)l+=(s=8*c.fullMessageLength[o+1])/4294967296>>>0,a.putInt32(l>>>0),l=s>>>0;a.putInt32(l);var i=new Array(n.length);for(o=0;o<n.length;++o)i[o]=n[o].slice(0);g(i,f,a);var m,L=e.util.createBuffer();m="SHA-512"===t?i.length:"SHA-384"===t?i.length-2:i.length-4;for(o=0;o<m;++o)L.putInt32(i[o][0]),o===m-1&&"SHA-512/224"===t||L.putInt32(i[o][1]);return L},c};var r=null,s=!1,n=null,h=null;function l(){r=String.fromCharCode(128),r+=e.util.fillString(String.fromCharCode(0),128),n=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],(h={})["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],h["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],h["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],h["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],s=!0}function g(e,t,a){for(var r,s,h,l,g,u,f,o,i,c,m,L,S,d,A,v,H,M,p,w,y,b,B,I,k,C,q,z,x,E,U,j,D,F=a.length();F>=128;){for(q=0;q<16;++q)t[q][0]=a.getInt32()>>>0,t[q][1]=a.getInt32()>>>0;for(;q<80;++q)r=(((z=(E=t[q-2])[0])>>>19|(x=E[1])<<13)^(x>>>29|z<<3)^z>>>6)>>>0,s=((z<<13|x>>>19)^(x<<3|z>>>29)^(z<<26|x>>>6))>>>0,h=(((z=(j=t[q-15])[0])>>>1|(x=j[1])<<31)^(z>>>8|x<<24)^z>>>7)>>>0,l=((z<<31|x>>>1)^(z<<24|x>>>8)^(z<<25|x>>>7))>>>0,U=t[q-7],D=t[q-16],x=s+U[1]+l+D[1],t[q][0]=r+U[0]+h+D[0]+(x/4294967296>>>0)>>>0,t[q][1]=x>>>0;for(m=e[0][0],L=e[0][1],S=e[1][0],d=e[1][1],A=e[2][0],v=e[2][1],H=e[3][0],M=e[3][1],p=e[4][0],w=e[4][1],y=e[5][0],b=e[5][1],B=e[6][0],I=e[6][1],k=e[7][0],C=e[7][1],q=0;q<80;++q)f=((p>>>14|w<<18)^(p>>>18|w<<14)^(w>>>9|p<<23))>>>0,o=(B^p&(y^B))>>>0,g=((m>>>28|L<<4)^(L>>>2|m<<30)^(L>>>7|m<<25))>>>0,u=((m<<4|L>>>28)^(L<<30|m>>>2)^(L<<25|m>>>7))>>>0,i=(m&S|A&(m^S))>>>0,c=(L&d|v&(L^d))>>>0,x=C+(((p<<18|w>>>14)^(p<<14|w>>>18)^(w<<23|p>>>9))>>>0)+((I^w&(b^I))>>>0)+n[q][1]+t[q][1],r=k+f+o+n[q][0]+t[q][0]+(x/4294967296>>>0)>>>0,s=x>>>0,h=g+i+((x=u+c)/4294967296>>>0)>>>0,l=x>>>0,k=B,C=I,B=y,I=b,y=p,b=w,p=H+r+((x=M+s)/4294967296>>>0)>>>0,w=x>>>0,H=A,M=v,A=S,v=d,S=m,d=L,m=r+h+((x=s+l)/4294967296>>>0)>>>0,L=x>>>0;x=e[0][1]+L,e[0][0]=e[0][0]+m+(x/4294967296>>>0)>>>0,e[0][1]=x>>>0,x=e[1][1]+d,e[1][0]=e[1][0]+S+(x/4294967296>>>0)>>>0,e[1][1]=x>>>0,x=e[2][1]+v,e[2][0]=e[2][0]+A+(x/4294967296>>>0)>>>0,e[2][1]=x>>>0,x=e[3][1]+M,e[3][0]=e[3][0]+H+(x/4294967296>>>0)>>>0,e[3][1]=x>>>0,x=e[4][1]+w,e[4][0]=e[4][0]+p+(x/4294967296>>>0)>>>0,e[4][1]=x>>>0,x=e[5][1]+b,e[5][0]=e[5][0]+y+(x/4294967296>>>0)>>>0,e[5][1]=x>>>0,x=e[6][1]+I,e[6][0]=e[6][0]+B+(x/4294967296>>>0)>>>0,e[6][1]=x>>>0,x=e[7][1]+C,e[7][0]=e[7][0]+k+(x/4294967296>>>0)>>>0,e[7][1]=x>>>0,F-=128}}
|
||
},{"./forge":"sQ2N","./md":"hxOg","./util":"xBWF"}],"yg0X":[function(require,module,exports) {
|
||
var e=require("./forge");require("./asn1");var t=e.asn1;exports.privateKeyValidator={name:"PrivateKeyInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},exports.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{tagClass:t.Class.UNIVERSAL,type:t.Type.BITSTRING,constructed:!1,composed:!0,captureBitStringValue:"ed25519PublicKey"}]};
|
||
},{"./forge":"sQ2N","./asn1":"a/tu"}],"fSE7":[function(require,module,exports) {
|
||
var Buffer = require("buffer").Buffer;
|
||
var r=require("buffer").Buffer,n=require("./forge");require("./jsbn"),require("./random"),require("./sha512"),require("./util");var o=require("./asn1-validator"),t=o.publicKeyValidator,e=o.privateKeyValidator;if(void 0===a)var a=n.jsbn.BigInteger;var i=n.util.ByteBuffer,f=void 0===r?Uint8Array:r;n.pki=n.pki||{},module.exports=n.pki.ed25519=n.ed25519=n.ed25519||{};var s=n.ed25519;function u(n){var o=n.message;if(o instanceof Uint8Array||o instanceof f)return o;var t=n.encoding;if(void 0===o){if(!n.md)throw new TypeError('"options.message" or "options.md" not specified.');o=n.md.digest().getBytes(),t="binary"}if("string"==typeof o&&!t)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if("string"==typeof o){if(void 0!==r)return r.from(o,t);o=new i(o,t)}else if(!(o instanceof i))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');for(var e=new f(o.length()),a=0;a<e.length;++a)e[a]=o.at(a);return e}s.constants={},s.constants.PUBLIC_KEY_BYTE_LENGTH=32,s.constants.PRIVATE_KEY_BYTE_LENGTH=64,s.constants.SEED_BYTE_LENGTH=32,s.constants.SIGN_BYTE_LENGTH=64,s.constants.HASH_BYTE_LENGTH=64,s.generateKeyPair=function(r){var o=(r=r||{}).seed;if(void 0===o)o=n.random.getBytesSync(s.constants.SEED_BYTE_LENGTH);else if("string"==typeof o){if(o.length!==s.constants.SEED_BYTE_LENGTH)throw new TypeError('"seed" must be '+s.constants.SEED_BYTE_LENGTH+" bytes in length.")}else if(!(o instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, Uint8Array, or a binary string.');o=u({message:o,encoding:"binary"});for(var t=new f(s.constants.PUBLIC_KEY_BYTE_LENGTH),e=new f(s.constants.PRIVATE_KEY_BYTE_LENGTH),a=0;a<32;++a)e[a]=o[a];return d(t,e),{publicKey:t,privateKey:e}},s.privateKeyFromAsn1=function(r){var o={},t=[];if(!n.asn1.validate(r,e,o,t)){var a=new Error("Invalid Key.");throw a.errors=t,a}var i=n.asn1.derToOid(o.privateKeyOid),f=n.oids.EdDSA25519;if(i!==f)throw new Error('Invalid OID "'+i+'"; OID must be "'+f+'".');var s=o.privateKey;return{privateKeyBytes:u({message:n.asn1.fromDer(s).value,encoding:"binary"})}},s.publicKeyFromAsn1=function(r){var o={},e=[];if(!n.asn1.validate(r,t,o,e)){var a=new Error("Invalid Key.");throw a.errors=e,a}var i=n.asn1.derToOid(o.publicKeyOid),f=n.oids.EdDSA25519;if(i!==f)throw new Error('Invalid OID "'+i+'"; OID must be "'+f+'".');var E=o.ed25519PublicKey;if(E.length!==s.constants.PUBLIC_KEY_BYTE_LENGTH)throw new Error("Key length is invalid.");return u({message:E,encoding:"binary"})},s.publicKeyFromPrivateKey=function(r){var n=u({message:(r=r||{}).privateKey,encoding:"binary"});if(n.length!==s.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+s.constants.PRIVATE_KEY_BYTE_LENGTH);for(var o=new f(s.constants.PUBLIC_KEY_BYTE_LENGTH),t=0;t<o.length;++t)o[t]=n[32+t];return o},s.sign=function(r){var n=u(r=r||{}),o=u({message:r.privateKey,encoding:"binary"});if(o.length===s.constants.SEED_BYTE_LENGTH)o=s.generateKeyPair({seed:o}).privateKey;else if(o.length!==s.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+s.constants.SEED_BYTE_LENGTH+" or "+s.constants.PRIVATE_KEY_BYTE_LENGTH);var t=new f(s.constants.SIGN_BYTE_LENGTH+n.length);B(t,n,n.length,o);for(var e=new f(s.constants.SIGN_BYTE_LENGTH),a=0;a<e.length;++a)e[a]=t[a];return e},s.verify=function(r){var n=u(r=r||{});if(void 0===r.signature)throw new TypeError('"options.signature" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a binary string.');var o=u({message:r.signature,encoding:"binary"});if(o.length!==s.constants.SIGN_BYTE_LENGTH)throw new TypeError('"options.signature" must have a byte length of '+s.constants.SIGN_BYTE_LENGTH);var t=u({message:r.publicKey,encoding:"binary"});if(t.length!==s.constants.PUBLIC_KEY_BYTE_LENGTH)throw new TypeError('"options.publicKey" must have a byte length of '+s.constants.PUBLIC_KEY_BYTE_LENGTH);var e,a=new f(s.constants.SIGN_BYTE_LENGTH+n.length),i=new f(s.constants.SIGN_BYTE_LENGTH+n.length);for(e=0;e<s.constants.SIGN_BYTE_LENGTH;++e)a[e]=o[e];for(e=0;e<n.length;++e)a[e+s.constants.SIGN_BYTE_LENGTH]=n[e];return w(i,a,a.length,t)>=0};var E=C(),c=C([1]),v=C([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),l=C([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),h=C([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),y=C([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),T=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),g=C([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function _(o,t){var e=n.md.sha512.create(),a=new i(o);e.update(a.getBytes(t),"binary");var u=e.digest().getBytes();if(void 0!==r)return r.from(u,"binary");for(var E=new f(s.constants.HASH_BYTE_LENGTH),c=0;c<64;++c)E[c]=u.charCodeAt(c);return E}function d(r,n){var o,t=[C(),C(),C(),C()],e=_(n,32);for(e[0]&=248,e[31]&=127,e[31]|=64,D(t,e),N(r,t),o=0;o<32;++o)n[o+32]=r[o];return 0}function B(r,n,o,t){var e,a,i=new Float64Array(64),f=[C(),C(),C(),C()],s=_(t,32);s[0]&=248,s[31]&=127,s[31]|=64;var u=o+64;for(e=0;e<o;++e)r[64+e]=n[e];for(e=0;e<32;++e)r[32+e]=s[32+e];var E=_(r.subarray(32),o+32);for(Y(E),D(f,E),N(r,f),e=32;e<64;++e)r[e]=t[e];var c=_(r,o+64);for(Y(c),e=32;e<64;++e)i[e]=0;for(e=0;e<32;++e)i[e]=E[e];for(e=0;e<32;++e)for(a=0;a<32;a++)i[e+a]+=c[e]*s[a];return p(r.subarray(32),i),u}function w(r,n,o,t){var e,a=new f(32),i=[C(),C(),C(),C()],s=[C(),C(),C(),C()];if(-1,o<64)return-1;if(L(s,t))return-1;for(e=0;e<o;++e)r[e]=n[e];for(e=0;e<32;++e)r[e+32]=t[e];var u=_(r,o);if(Y(u),P(i,s,u),D(s,n.subarray(32)),b(i,s),N(a,i),o-=64,I(n,0,a,0)){for(e=0;e<o;++e)r[e]=0;return-1}for(e=0;e<o;++e)r[e]=n[e+64];return o}function p(r,n){var o,t,e,a;for(t=63;t>=32;--t){for(o=0,e=t-32,a=t-12;e<a;++e)n[e]+=o-16*n[t]*T[e-(t-32)],o=n[e]+128>>8,n[e]-=256*o;n[e]+=o,n[t]=0}for(o=0,e=0;e<32;++e)n[e]+=o-(n[31]>>4)*T[e],o=n[e]>>8,n[e]&=255;for(e=0;e<32;++e)n[e]-=o*T[e];for(t=0;t<32;++t)n[t+1]+=n[t]>>8,r[t]=255&n[t]}function Y(r){for(var n=new Float64Array(64),o=0;o<64;++o)n[o]=r[o],r[o]=0;p(r,n)}function b(r,n){var o=C(),t=C(),e=C(),a=C(),i=C(),f=C(),s=C(),u=C(),E=C();R(o,r[1],r[0]),R(E,n[1],n[0]),k(o,o,E),F(t,r[0],r[1]),F(E,n[0],n[1]),k(t,t,E),k(e,r[3],n[3]),k(e,e,l),k(a,r[2],n[2]),F(a,a,a),R(i,t,o),R(f,a,e),F(s,a,e),F(u,t,o),k(r[0],i,f),k(r[1],u,s),k(r[2],s,f),k(r[3],i,u)}function G(r,n,o){for(var t=0;t<4;++t)q(r[t],n[t],o)}function N(r,n){var o=C(),t=C(),e=C();O(e,n[2]),k(o,n[0],e),k(t,n[1],e),K(r,t),r[31]^=S(o)<<7}function K(r,n){var o,t,e,a=C(),i=C();for(o=0;o<16;++o)i[o]=n[o];for(V(i),V(i),V(i),t=0;t<2;++t){for(a[0]=i[0]-65517,o=1;o<15;++o)a[o]=i[o]-65535-(a[o-1]>>16&1),a[o-1]&=65535;a[15]=i[15]-32767-(a[14]>>16&1),e=a[15]>>16&1,a[14]&=65535,q(i,a,1-e)}for(o=0;o<16;o++)r[2*o]=255&i[o],r[2*o+1]=i[o]>>8}function L(r,n){var o=C(),t=C(),e=C(),a=C(),i=C(),f=C(),s=C();return U(r[2],c),m(r[1],n),j(e,r[1]),k(a,e,v),R(e,e,r[2]),F(a,r[2],a),j(i,a),j(f,i),k(s,f,i),k(o,s,e),k(o,o,a),H(o,o),k(o,o,e),k(o,o,a),k(o,o,a),k(r[0],o,a),j(t,r[0]),k(t,t,a),M(t,e)&&k(r[0],r[0],g),j(t,r[0]),k(t,t,a),M(t,e)?-1:(S(r[0])===n[31]>>7&&R(r[0],E,r[0]),k(r[3],r[0],r[1]),0)}function m(r,n){var o;for(o=0;o<16;++o)r[o]=n[2*o]+(n[2*o+1]<<8);r[15]&=32767}function H(r,n){var o,t=C();for(o=0;o<16;++o)t[o]=n[o];for(o=250;o>=0;--o)j(t,t),1!==o&&k(t,t,n);for(o=0;o<16;++o)r[o]=t[o]}function M(r,n){var o=new f(32),t=new f(32);return K(o,r),K(t,n),I(o,0,t,0)}function I(r,n,o,t){return A(r,n,o,t,32)}function A(r,n,o,t,e){var a,i=0;for(a=0;a<e;++a)i|=r[n+a]^o[t+a];return(1&i-1>>>8)-1}function S(r){var n=new f(32);return K(n,r),1&n[0]}function P(r,n,o){var t,e;for(U(r[0],E),U(r[1],c),U(r[2],c),U(r[3],E),e=255;e>=0;--e)G(r,n,t=o[e/8|0]>>(7&e)&1),b(n,r),b(r,r),G(r,n,t)}function D(r,n){var o=[C(),C(),C(),C()];U(o[0],h),U(o[1],y),U(o[2],c),k(o[3],h,y),P(r,o,n)}function U(r,n){var o;for(o=0;o<16;o++)r[o]=0|n[o]}function O(r,n){var o,t=C();for(o=0;o<16;++o)t[o]=n[o];for(o=253;o>=0;--o)j(t,t),2!==o&&4!==o&&k(t,t,n);for(o=0;o<16;++o)r[o]=t[o]}function V(r){var n,o,t=1;for(n=0;n<16;++n)o=r[n]+t+65535,t=Math.floor(o/65536),r[n]=o-65536*t;r[0]+=t-1+37*(t-1)}function q(r,n,o){for(var t,e=~(o-1),a=0;a<16;++a)t=e&(r[a]^n[a]),r[a]^=t,n[a]^=t}function C(r){var n,o=new Float64Array(16);if(r)for(n=0;n<r.length;++n)o[n]=r[n];return o}function F(r,n,o){for(var t=0;t<16;++t)r[t]=n[t]+o[t]}function R(r,n,o){for(var t=0;t<16;++t)r[t]=n[t]-o[t]}function j(r,n){k(r,n,n)}function k(r,n,o){var t,e,a=0,i=0,f=0,s=0,u=0,E=0,c=0,v=0,l=0,h=0,y=0,T=0,g=0,_=0,d=0,B=0,w=0,p=0,Y=0,b=0,G=0,N=0,K=0,L=0,m=0,H=0,M=0,I=0,A=0,S=0,P=0,D=o[0],U=o[1],O=o[2],V=o[3],q=o[4],C=o[5],F=o[6],R=o[7],j=o[8],k=o[9],x=o[10],z=o[11],J=o[12],Q=o[13],W=o[14],X=o[15];a+=(t=n[0])*D,i+=t*U,f+=t*O,s+=t*V,u+=t*q,E+=t*C,c+=t*F,v+=t*R,l+=t*j,h+=t*k,y+=t*x,T+=t*z,g+=t*J,_+=t*Q,d+=t*W,B+=t*X,i+=(t=n[1])*D,f+=t*U,s+=t*O,u+=t*V,E+=t*q,c+=t*C,v+=t*F,l+=t*R,h+=t*j,y+=t*k,T+=t*x,g+=t*z,_+=t*J,d+=t*Q,B+=t*W,w+=t*X,f+=(t=n[2])*D,s+=t*U,u+=t*O,E+=t*V,c+=t*q,v+=t*C,l+=t*F,h+=t*R,y+=t*j,T+=t*k,g+=t*x,_+=t*z,d+=t*J,B+=t*Q,w+=t*W,p+=t*X,s+=(t=n[3])*D,u+=t*U,E+=t*O,c+=t*V,v+=t*q,l+=t*C,h+=t*F,y+=t*R,T+=t*j,g+=t*k,_+=t*x,d+=t*z,B+=t*J,w+=t*Q,p+=t*W,Y+=t*X,u+=(t=n[4])*D,E+=t*U,c+=t*O,v+=t*V,l+=t*q,h+=t*C,y+=t*F,T+=t*R,g+=t*j,_+=t*k,d+=t*x,B+=t*z,w+=t*J,p+=t*Q,Y+=t*W,b+=t*X,E+=(t=n[5])*D,c+=t*U,v+=t*O,l+=t*V,h+=t*q,y+=t*C,T+=t*F,g+=t*R,_+=t*j,d+=t*k,B+=t*x,w+=t*z,p+=t*J,Y+=t*Q,b+=t*W,G+=t*X,c+=(t=n[6])*D,v+=t*U,l+=t*O,h+=t*V,y+=t*q,T+=t*C,g+=t*F,_+=t*R,d+=t*j,B+=t*k,w+=t*x,p+=t*z,Y+=t*J,b+=t*Q,G+=t*W,N+=t*X,v+=(t=n[7])*D,l+=t*U,h+=t*O,y+=t*V,T+=t*q,g+=t*C,_+=t*F,d+=t*R,B+=t*j,w+=t*k,p+=t*x,Y+=t*z,b+=t*J,G+=t*Q,N+=t*W,K+=t*X,l+=(t=n[8])*D,h+=t*U,y+=t*O,T+=t*V,g+=t*q,_+=t*C,d+=t*F,B+=t*R,w+=t*j,p+=t*k,Y+=t*x,b+=t*z,G+=t*J,N+=t*Q,K+=t*W,L+=t*X,h+=(t=n[9])*D,y+=t*U,T+=t*O,g+=t*V,_+=t*q,d+=t*C,B+=t*F,w+=t*R,p+=t*j,Y+=t*k,b+=t*x,G+=t*z,N+=t*J,K+=t*Q,L+=t*W,m+=t*X,y+=(t=n[10])*D,T+=t*U,g+=t*O,_+=t*V,d+=t*q,B+=t*C,w+=t*F,p+=t*R,Y+=t*j,b+=t*k,G+=t*x,N+=t*z,K+=t*J,L+=t*Q,m+=t*W,H+=t*X,T+=(t=n[11])*D,g+=t*U,_+=t*O,d+=t*V,B+=t*q,w+=t*C,p+=t*F,Y+=t*R,b+=t*j,G+=t*k,N+=t*x,K+=t*z,L+=t*J,m+=t*Q,H+=t*W,M+=t*X,g+=(t=n[12])*D,_+=t*U,d+=t*O,B+=t*V,w+=t*q,p+=t*C,Y+=t*F,b+=t*R,G+=t*j,N+=t*k,K+=t*x,L+=t*z,m+=t*J,H+=t*Q,M+=t*W,I+=t*X,_+=(t=n[13])*D,d+=t*U,B+=t*O,w+=t*V,p+=t*q,Y+=t*C,b+=t*F,G+=t*R,N+=t*j,K+=t*k,L+=t*x,m+=t*z,H+=t*J,M+=t*Q,I+=t*W,A+=t*X,d+=(t=n[14])*D,B+=t*U,w+=t*O,p+=t*V,Y+=t*q,b+=t*C,G+=t*F,N+=t*R,K+=t*j,L+=t*k,m+=t*x,H+=t*z,M+=t*J,I+=t*Q,A+=t*W,S+=t*X,B+=(t=n[15])*D,i+=38*(p+=t*O),f+=38*(Y+=t*V),s+=38*(b+=t*q),u+=38*(G+=t*C),E+=38*(N+=t*F),c+=38*(K+=t*R),v+=38*(L+=t*j),l+=38*(m+=t*k),h+=38*(H+=t*x),y+=38*(M+=t*z),T+=38*(I+=t*J),g+=38*(A+=t*Q),_+=38*(S+=t*W),d+=38*(P+=t*X),a=(t=(a+=38*(w+=t*U))+(e=1)+65535)-65536*(e=Math.floor(t/65536)),i=(t=i+e+65535)-65536*(e=Math.floor(t/65536)),f=(t=f+e+65535)-65536*(e=Math.floor(t/65536)),s=(t=s+e+65535)-65536*(e=Math.floor(t/65536)),u=(t=u+e+65535)-65536*(e=Math.floor(t/65536)),E=(t=E+e+65535)-65536*(e=Math.floor(t/65536)),c=(t=c+e+65535)-65536*(e=Math.floor(t/65536)),v=(t=v+e+65535)-65536*(e=Math.floor(t/65536)),l=(t=l+e+65535)-65536*(e=Math.floor(t/65536)),h=(t=h+e+65535)-65536*(e=Math.floor(t/65536)),y=(t=y+e+65535)-65536*(e=Math.floor(t/65536)),T=(t=T+e+65535)-65536*(e=Math.floor(t/65536)),g=(t=g+e+65535)-65536*(e=Math.floor(t/65536)),_=(t=_+e+65535)-65536*(e=Math.floor(t/65536)),d=(t=d+e+65535)-65536*(e=Math.floor(t/65536)),B=(t=B+e+65535)-65536*(e=Math.floor(t/65536)),a=(t=(a+=e-1+37*(e-1))+(e=1)+65535)-65536*(e=Math.floor(t/65536)),i=(t=i+e+65535)-65536*(e=Math.floor(t/65536)),f=(t=f+e+65535)-65536*(e=Math.floor(t/65536)),s=(t=s+e+65535)-65536*(e=Math.floor(t/65536)),u=(t=u+e+65535)-65536*(e=Math.floor(t/65536)),E=(t=E+e+65535)-65536*(e=Math.floor(t/65536)),c=(t=c+e+65535)-65536*(e=Math.floor(t/65536)),v=(t=v+e+65535)-65536*(e=Math.floor(t/65536)),l=(t=l+e+65535)-65536*(e=Math.floor(t/65536)),h=(t=h+e+65535)-65536*(e=Math.floor(t/65536)),y=(t=y+e+65535)-65536*(e=Math.floor(t/65536)),T=(t=T+e+65535)-65536*(e=Math.floor(t/65536)),g=(t=g+e+65535)-65536*(e=Math.floor(t/65536)),_=(t=_+e+65535)-65536*(e=Math.floor(t/65536)),d=(t=d+e+65535)-65536*(e=Math.floor(t/65536)),B=(t=B+e+65535)-65536*(e=Math.floor(t/65536)),a+=e-1+37*(e-1),r[0]=a,r[1]=i,r[2]=f,r[3]=s,r[4]=u,r[5]=E,r[6]=c,r[7]=v,r[8]=l,r[9]=h,r[10]=y,r[11]=T,r[12]=g,r[13]=_,r[14]=d,r[15]=B}
|
||
},{"./forge":"sQ2N","./jsbn":"sroI","./random":"nQaA","./sha512":"84ko","./util":"xBWF","./asn1-validator":"yg0X","buffer":"sC8V"}],"rthE":[function(require,module,exports) {
|
||
"use strict";var r=require("iso-random-stream/src/random"),e=require("err-code");module.exports=function(t){if(isNaN(t)||t<=0)throw e(new Error("random bytes length must be a Number bigger than 0"),"ERR_INVALID_LENGTH");return r(t)};
|
||
},{"iso-random-stream/src/random":"aksM","err-code":"hLMW"}],"6O9N":[function(require,module,exports) {
|
||
"use strict";require("node-forge/lib/util"),require("node-forge/lib/jsbn");var r=require("node-forge/lib/forge"),e=require("uint8arrays/from-string"),n=require("uint8arrays/to-string"),t=require("uint8arrays/concat");exports.bigIntegerToUintBase64url=function(r,e){var i=Uint8Array.from(r.abs().toByteArray());if(i=0===i[0]?i.slice(1):i,null!=e){if(i.length>e)throw new Error("byte array longer than desired length");i=t([new Uint8Array(e-i.length),i])}return n(i,"base64url")},exports.base64urlToBigInteger=function(e){var t=exports.base64urlToBuffer(e);return new r.jsbn.BigInteger(n(t,"base16"),16)},exports.base64urlToBuffer=function(r,n){var i=e(r,"base64urlpad");if(null!=n){if(i.length>n)throw new Error("byte array longer than desired length");i=t([new Uint8Array(n-i.length),i])}return i};
|
||
},{"node-forge/lib/util":"xBWF","node-forge/lib/jsbn":"sroI","node-forge/lib/forge":"sQ2N","uint8arrays/from-string":"Sqgj","uint8arrays/to-string":"rZEA","uint8arrays/concat":"qYui"}],"eKfD":[function(require,module,exports) {
|
||
"use strict";require("node-forge/lib/asn1"),require("node-forge/lib/rsa");var e=require("node-forge/lib/forge"),r=require("./../util"),i=r.bigIntegerToUintBase64url,n=r.base64urlToBigInteger,t=require("uint8arrays/from-string"),o=require("uint8arrays/to-string");exports.pkcs1ToJwk=function(r){var n=e.asn1.fromDer(o(r,"ascii")),t=e.pki.privateKeyFromAsn1(n);return{kty:"RSA",n:i(t.n),e:i(t.e),d:i(t.d),p:i(t.p),q:i(t.q),dp:i(t.dP),dq:i(t.dQ),qi:i(t.qInv),alg:"RS256",kid:"2011-04-29"}},exports.jwkToPkcs1=function(r){var i=e.pki.privateKeyToAsn1({n:n(r.n),e:n(r.e),d:n(r.d),p:n(r.p),q:n(r.q),dP:n(r.dp),dQ:n(r.dq),qInv:n(r.qi)});return t(e.asn1.toDer(i).getBytes(),"ascii")},exports.pkixToJwk=function(r){var n=e.asn1.fromDer(o(r,"ascii")),t=e.pki.publicKeyFromAsn1(n);return{kty:"RSA",n:i(t.n),e:i(t.e),alg:"RS256",kid:"2011-04-29"}},exports.jwkToPkix=function(r){var i=e.pki.publicKeyToAsn1({n:n(r.n),e:n(r.e)});return t(e.asn1.toDer(i).getBytes(),"ascii")};
|
||
},{"node-forge/lib/asn1":"a/tu","node-forge/lib/rsa":"jinq","node-forge/lib/forge":"sQ2N","./../util":"6O9N","uint8arrays/from-string":"Sqgj","uint8arrays/to-string":"rZEA"}],"I/Gz":[function(require,module,exports) {
|
||
"use strict";function r(r){return o(r)||n(r)||t(r)||e()}function e(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function t(r,e){if(r){if("string"==typeof r)return i(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?i(r,e):void 0}}function n(r){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(r))return Array.from(r)}function o(r){if(Array.isArray(r))return i(r)}function i(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}require("node-forge/lib/rsa");var a=require("node-forge/lib/forge"),u=require("../util"),c=u.base64urlToBigInteger;function f(r,e){return e.map(function(e){return c(r[e])})}function l(e){var t;return(t=a.pki).setRsaPrivateKey.apply(t,r(f(e,["n","e","d","p","q","dp","dq","qi"])))}function p(e){var t;return(t=a.pki).setRsaPublicKey.apply(t,r(f(e,["n","e"])))}module.exports={jwk2pub:p,jwk2priv:l};
|
||
},{"node-forge/lib/rsa":"jinq","node-forge/lib/forge":"sQ2N","../util":"6O9N"}],"0X23":[function(require,module,exports) {
|
||
"use strict";function e(e,r,t,n,u,a,i){try{var s=e[a](i),o=s.value}catch(c){return void t(c)}s.done?r(o):Promise.resolve(o).then(n,u)}function r(r){return function(){var t=this,n=arguments;return new Promise(function(u,a){var i=r.apply(t,n);function s(r){e(i,u,a,s,o,"next",r)}function o(r){e(i,u,a,s,o,"throw",r)}s(void 0)})}}var t=require("../webcrypto"),n=require("../random-bytes"),u=require("uint8arrays/to-string"),a=require("uint8arrays/from-string");function i(e){return Promise.all([t.get().subtle.exportKey("jwk",e.privateKey),t.get().subtle.exportKey("jwk",e.publicKey)])}function s(e){return t.get().subtle.importKey("jwk",{kty:e.kty,n:e.n,e:e.e},{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"])}exports.utils=require("./rsa-utils"),exports.generateKey=function(){var e=r(regeneratorRuntime.mark(function e(r){var n,u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.get().subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:r,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]);case 2:return n=e.sent,e.next=5,i(n);case 5:return u=e.sent,e.abrupt("return",{privateKey:u[0],publicKey:u[1]});case 7:case"end":return e.stop()}},e)}));return function(r){return e.apply(this,arguments)}}(),exports.unmarshalPrivateKey=function(){var e=r(regeneratorRuntime.mark(function e(r){var n,u,a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.get().subtle.importKey("jwk",r,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]);case 2:return n=e.sent,e.t0=n,e.next=6,s(r);case 6:return e.t1=e.sent,u=[e.t0,e.t1],e.next=10,i({privateKey:u[0],publicKey:u[1]});case 10:return a=e.sent,e.abrupt("return",{privateKey:a[0],publicKey:a[1]});case 12:case"end":return e.stop()}},e)}));return function(r){return e.apply(this,arguments)}}(),exports.getRandomValues=n,exports.hashAndSign=function(){var e=r(regeneratorRuntime.mark(function e(r,n){var u,a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.get().subtle.importKey("jwk",r,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]);case 2:return u=e.sent,e.next=5,t.get().subtle.sign({name:"RSASSA-PKCS1-v1_5"},u,Uint8Array.from(n));case 5:return a=e.sent,e.abrupt("return",new Uint8Array(a,a.byteOffset,a.byteLength));case 7:case"end":return e.stop()}},e)}));return function(r,t){return e.apply(this,arguments)}}(),exports.hashAndVerify=function(){var e=r(regeneratorRuntime.mark(function e(r,n,u){var a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.get().subtle.importKey("jwk",r,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]);case 2:return a=e.sent,e.abrupt("return",t.get().subtle.verify({name:"RSASSA-PKCS1-v1_5"},a,n,u));case 4:case"end":return e.stop()}},e)}));return function(r,t,n){return e.apply(this,arguments)}}();var o=require("./jwk2pem"),c=o.jwk2pub,p=o.jwk2priv;function y(e,r,t,n){var i=r?c(e):p(e),s=n(u(Uint8Array.from(t),"ascii"),i);return a(s,"ascii")}exports.encrypt=function(e,r){return y(e,!0,r,function(e,r){return r.encrypt(e)})},exports.decrypt=function(e,r){return y(e,!1,r,function(e,r){return r.decrypt(e)})};
|
||
},{"../webcrypto":"AJ6b","../random-bytes":"rthE","uint8arrays/to-string":"rZEA","uint8arrays/from-string":"Sqgj","./rsa-utils":"eKfD","./jwk2pem":"I/Gz"}],"S9i/":[function(require,module,exports) {
|
||
"use strict";function e(e,r,n,t,u,o,a){try{var i=e[o](a),c=i.value}catch(s){return void n(s)}i.done?r(c):Promise.resolve(c).then(t,u)}function r(r){return function(){var n=this,t=arguments;return new Promise(function(u,o){var a=r.apply(n,t);function i(r){e(a,u,o,i,c,"next",r)}function c(r){e(a,u,o,i,c,"throw",r)}i(void 0)})}}var n=require("multibase"),t=require("../ciphers/aes-gcm");module.exports={export:function(){var e=r(regeneratorRuntime.mark(function e(r,u){var o,a,i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return o=t.create(),e.next=3,o.encrypt(r,u);case 3:return a=e.sent,i=n.names.base64,e.abrupt("return",i.encode(a));case 6:case"end":return e.stop()}},e)}));return function(r,n){return e.apply(this,arguments)}}()};
|
||
},{"multibase":"VB0b","../ciphers/aes-gcm":"sNRc"}],"k8Et":[function(require,module,exports) {
|
||
"use strict";function e(e,r,t,n,u,i,a){try{var s=e[i](a),o=s.value}catch(c){return void t(c)}s.done?r(o):Promise.resolve(o).then(n,u)}function r(r){return function(){var t=this,n=arguments;return new Promise(function(u,i){var a=r.apply(t,n);function s(r){e(a,u,i,s,o,"next",r)}function o(r){e(a,u,i,s,o,"throw",r)}s(void 0)})}}function t(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function n(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,r,t){return r&&n(e.prototype,r),t&&n(e,t),e}var i=require("multihashing-async/src/sha"),a=require("err-code"),s=require("uint8arrays/equals"),o=require("uint8arrays/to-string");require("node-forge/lib/sha512"),require("node-forge/lib/ed25519");var c=require("node-forge/lib/forge"),p=require("./rsa"),f=require("./keys"),h=require("./exporter"),y=function(){function e(r){t(this,e),this._key=r}return u(e,[{key:"verify",value:function(){var e=r(regeneratorRuntime.mark(function e(r,t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",p.hashAndVerify(this._key,t,r));case 1:case"end":return e.stop()}},e,this)}));return function(r,t){return e.apply(this,arguments)}}()},{key:"marshal",value:function(){return p.utils.jwkToPkix(this._key)}},{key:"bytes",get:function(){return f.PublicKey.encode({Type:f.KeyType.RSA,Data:this.marshal()}).finish()}},{key:"encrypt",value:function(e){return p.encrypt(this._key,e)}},{key:"equals",value:function(e){return s(this.bytes,e.bytes)}},{key:"hash",value:function(){var e=r(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",i.multihashing(this.bytes,"sha2-256"));case 1:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}]),e}(),l=function(){function e(r,n){t(this,e),this._key=r,this._publicKey=n}return u(e,[{key:"genSecret",value:function(){return p.getRandomValues(16)}},{key:"sign",value:function(){var e=r(regeneratorRuntime.mark(function e(r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",p.hashAndSign(this._key,r));case 1:case"end":return e.stop()}},e,this)}));return function(r){return e.apply(this,arguments)}}()},{key:"public",get:function(){if(!this._publicKey)throw a(new Error("public key not provided"),"ERR_PUBKEY_NOT_PROVIDED");return new y(this._publicKey)}},{key:"decrypt",value:function(e){return p.decrypt(this._key,e)}},{key:"marshal",value:function(){return p.utils.jwkToPkcs1(this._key)}},{key:"bytes",get:function(){return f.PrivateKey.encode({Type:f.KeyType.RSA,Data:this.marshal()}).finish()}},{key:"equals",value:function(e){return s(this.bytes,e.bytes)}},{key:"hash",value:function(){var e=r(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",i.multihashing(this.bytes,"sha2-256"));case 1:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"id",value:function(){var e=r(regeneratorRuntime.mark(function e(){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.public.hash();case 2:return r=e.sent,e.abrupt("return",o(r,"base58btc"));case 4:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"export",value:function(){var e=r(regeneratorRuntime.mark(function e(r){var t,n,u,i,s,o=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("pkcs-8"!==(t=o.length>1&&void 0!==o[1]?o[1]:"pkcs-8")){e.next=9;break}return n=new c.util.ByteBuffer(this.marshal()),u=c.asn1.fromDer(n),i=c.pki.privateKeyFromAsn1(u),s={algorithm:"aes256",count:1e4,saltSize:16,prfAlgorithm:"sha512"},e.abrupt("return",c.pki.encryptRsaPrivateKey(i,r,s));case 9:if("libp2p-key"!==t){e.next=13;break}return e.abrupt("return",h.export(this.bytes,r));case 13:throw a(new Error("export format '".concat(t,"' is not supported")),"ERR_INVALID_EXPORT_FORMAT");case 14:case"end":return e.stop()}},e,this)}));return function(r){return e.apply(this,arguments)}}()}]),e}();function v(e){return k.apply(this,arguments)}function k(){return(k=r(regeneratorRuntime.mark(function e(r){var t,n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=p.utils.pkcs1ToJwk(r),e.next=3,p.unmarshalPrivateKey(t);case 3:return n=e.sent,e.abrupt("return",new l(n.privateKey,n.publicKey));case 5:case"end":return e.stop()}},e)}))).apply(this,arguments)}function m(e){var r=p.utils.pkixToJwk(e);return new y(r)}function b(e){return g.apply(this,arguments)}function g(){return(g=r(regeneratorRuntime.mark(function e(r){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,p.unmarshalPrivateKey(r);case 2:return t=e.sent,e.abrupt("return",new l(t.privateKey,t.publicKey));case 4:case"end":return e.stop()}},e)}))).apply(this,arguments)}function w(e){return R.apply(this,arguments)}function R(){return(R=r(regeneratorRuntime.mark(function e(r){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,p.generateKey(r);case 2:return t=e.sent,e.abrupt("return",new l(t.privateKey,t.publicKey));case 4:case"end":return e.stop()}},e)}))).apply(this,arguments)}module.exports={RsaPublicKey:y,RsaPrivateKey:l,unmarshalRsaPublicKey:m,unmarshalRsaPrivateKey:v,generateKeyPair:w,fromJwk:b};
|
||
},{"multihashing-async/src/sha":"D6DO","err-code":"hLMW","uint8arrays/equals":"mZxc","uint8arrays/to-string":"rZEA","node-forge/lib/sha512":"84ko","node-forge/lib/ed25519":"fSE7","node-forge/lib/forge":"sQ2N","./rsa":"0X23","./keys":"6R3o","./exporter":"S9i/"}],"AxDG":[function(require,module,exports) {
|
||
"use strict";function e(e,r,n,t,u,i,a){try{var o=e[i](a),s=o.value}catch(c){return void n(c)}o.done?r(s):Promise.resolve(s).then(t,u)}function r(r){return function(){var n=this,t=arguments;return new Promise(function(u,i){var a=r.apply(n,t);function o(r){e(a,u,i,o,s,"next",r)}function s(r){e(a,u,i,o,s,"throw",r)}o(void 0)})}}require("node-forge/lib/ed25519");var n=require("node-forge/lib/forge");exports.publicKeyLength=n.pki.ed25519.constants.PUBLIC_KEY_BYTE_LENGTH,exports.privateKeyLength=n.pki.ed25519.constants.PRIVATE_KEY_BYTE_LENGTH,exports.generateKey=r(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.pki.ed25519.generateKeyPair());case 1:case"end":return e.stop()}},e)})),exports.generateKeyFromSeed=function(){var e=r(regeneratorRuntime.mark(function e(r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.pki.ed25519.generateKeyPair({seed:r}));case 1:case"end":return e.stop()}},e)}));return function(r){return e.apply(this,arguments)}}(),exports.hashAndSign=function(){var e=r(regeneratorRuntime.mark(function e(r,t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.pki.ed25519.sign({message:t,privateKey:r}));case 1:case"end":return e.stop()}},e)}));return function(r,n){return e.apply(this,arguments)}}(),exports.hashAndVerify=function(){var e=r(regeneratorRuntime.mark(function e(r,t,u){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.pki.ed25519.verify({signature:t,message:u,publicKey:r}));case 1:case"end":return e.stop()}},e)}));return function(r,n,t){return e.apply(this,arguments)}}();
|
||
},{"node-forge/lib/ed25519":"fSE7","node-forge/lib/forge":"sQ2N"}],"FdMy":[function(require,module,exports) {
|
||
"use strict";function e(e,r,t,n,u,i,a){try{var s=e[i](a),o=s.value}catch(c){return void t(c)}s.done?r(o):Promise.resolve(o).then(n,u)}function r(r){return function(){var t=this,n=arguments;return new Promise(function(u,i){var a=r.apply(t,n);function s(r){e(a,u,i,s,o,"next",r)}function o(r){e(a,u,i,s,o,"throw",r)}s(void 0)})}}function t(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function n(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,r,t){return r&&n(e.prototype,r),t&&n(e,t),e}var i=require("multihashing-async/src/sha"),a=require("err-code"),s=require("uint8arrays/equals"),o=require("multihashes"),c=require("./ed25519"),h=require("./keys"),p=require("./exporter"),y=function(){function e(r){t(this,e),this._key=k(r,c.publicKeyLength)}return u(e,[{key:"verify",value:function(){var e=r(regeneratorRuntime.mark(function e(r,t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",c.hashAndVerify(this._key,t,r));case 1:case"end":return e.stop()}},e,this)}));return function(r,t){return e.apply(this,arguments)}}()},{key:"marshal",value:function(){return this._key}},{key:"bytes",get:function(){return h.PublicKey.encode({Type:h.KeyType.Ed25519,Data:this.marshal()}).finish()}},{key:"equals",value:function(e){return s(this.bytes,e.bytes)}},{key:"hash",value:function(){var e=r(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",i.multihashing(this.bytes,"sha2-256"));case 1:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}]),e}(),f=function(){function e(r,n){t(this,e),this._key=k(r,c.privateKeyLength),this._publicKey=k(n,c.publicKeyLength)}return u(e,[{key:"sign",value:function(){var e=r(regeneratorRuntime.mark(function e(r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",c.hashAndSign(this._key,r));case 1:case"end":return e.stop()}},e,this)}));return function(r){return e.apply(this,arguments)}}()},{key:"public",get:function(){return new y(this._publicKey)}},{key:"marshal",value:function(){return this._key}},{key:"bytes",get:function(){return h.PrivateKey.encode({Type:h.KeyType.Ed25519,Data:this.marshal()}).finish()}},{key:"equals",value:function(e){return s(this.bytes,e.bytes)}},{key:"hash",value:function(){var e=r(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",i.multihashing(this.bytes,"sha2-256"));case 1:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"id",value:function(){var e=r(regeneratorRuntime.mark(function e(){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=o.encode(this.public.bytes,"identity"),e.next=3,o.toB58String(r);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"export",value:function(){var e=r(regeneratorRuntime.mark(function e(r){var t,n=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("libp2p-key"!==(t=n.length>1&&void 0!==n[1]?n[1]:"libp2p-key")){e.next=5;break}return e.abrupt("return",p.export(this.bytes,r));case 5:throw a(new Error("export format '".concat(t,"' is not supported")),"ERR_INVALID_EXPORT_FORMAT");case 6:case"end":return e.stop()}},e,this)}));return function(r){return e.apply(this,arguments)}}()}]),e}();function l(e){if(e.length>c.privateKeyLength){var r=(e=k(e,c.privateKeyLength+c.publicKeyLength)).slice(0,c.privateKeyLength),t=e.slice(c.privateKeyLength,e.length);return new f(r,t)}var n=(e=k(e,c.privateKeyLength)).slice(0,c.privateKeyLength),u=e.slice(c.publicKeyLength);return new f(n,u)}function v(e){return e=k(e,c.publicKeyLength),new y(e)}function g(){return m.apply(this,arguments)}function m(){return(m=r(regeneratorRuntime.mark(function e(){var r,t,n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,c.generateKey();case 2:return r=e.sent,t=r.privateKey,n=r.publicKey,e.abrupt("return",new f(t,n));case 6:case"end":return e.stop()}},e)}))).apply(this,arguments)}function b(e){return d.apply(this,arguments)}function d(){return(d=r(regeneratorRuntime.mark(function e(r){var t,n,u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,c.generateKeyFromSeed(r);case 2:return t=e.sent,n=t.privateKey,u=t.publicKey,e.abrupt("return",new f(n,u));case 6:case"end":return e.stop()}},e)}))).apply(this,arguments)}function k(e,r){if((e=Uint8Array.from(e||[])).length!==r)throw a(new Error("Key must be a Uint8Array of length ".concat(r,", got ").concat(e.length)),"ERR_INVALID_KEY_TYPE");return e}module.exports={Ed25519PublicKey:y,Ed25519PrivateKey:f,unmarshalEd25519PrivateKey:l,unmarshalEd25519PublicKey:v,generateKeyPair:g,generateKeyPairFromSeed:b};
|
||
},{"multihashing-async/src/sha":"D6DO","err-code":"hLMW","uint8arrays/equals":"mZxc","multihashes":"gjv/","./ed25519":"AxDG","./keys":"6R3o","./exporter":"S9i/"}],"Y4Tp":[function(require,module,exports) {
|
||
module.exports={_from:"elliptic@^6.5.2",_id:"elliptic@6.5.4",_inBundle:!1,_integrity:"sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==",_location:"/elliptic",_phantomChildren:{},_requested:{type:"range",registry:!0,raw:"elliptic@^6.5.2",name:"elliptic",escapedName:"elliptic",rawSpec:"^6.5.2",saveSpec:null,fetchSpec:"^6.5.2"},_requiredBy:["/browserify-sign","/create-ecdh","/secp256k1"],_resolved:"https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz",_shasum:"da37cebd31e79a1367e941b592ed1fbebd58abbb",_spec:"elliptic@^6.5.2",_where:"/Users/vsantos/work/pl/gh/libp2p/js-libp2p/examples/webrtc-direct/node_modules/secp256k1",author:{name:"Fedor Indutny",email:"fedor@indutny.com"},bugs:{url:"https://github.com/indutny/elliptic/issues"},bundleDependencies:!1,dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},deprecated:!1,description:"EC cryptography",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},files:["lib"],homepage:"https://github.com/indutny/elliptic",keywords:["EC","Elliptic","curve","Cryptography"],license:"MIT",main:"lib/elliptic.js",name:"elliptic",repository:{type:"git",url:"git+ssh://git@github.com/indutny/elliptic.git"},scripts:{lint:"eslint lib test","lint:fix":"npm run lint -- --fix",test:"npm run lint && npm run unit",unit:"istanbul test _mocha --reporter=spec test/index.js",version:"grunt dist && git add dist/"},version:"6.5.4"};
|
||
},{}],"hLmj":[function(require,module,exports) {
|
||
"use strict";var r=exports,n=require("bn.js"),t=require("minimalistic-assert"),e=require("minimalistic-crypto-utils");function i(r,n,t){var e=new Array(Math.max(r.bitLength(),t)+1);e.fill(0);for(var i=1<<n+1,o=r.clone(),a=0;a<e.length;a++){var s,u=o.andln(i-1);o.isOdd()?(s=u>(i>>1)-1?(i>>1)-u:u,o.isubn(s)):s=0,e[a]=s,o.iushrn(1)}return e}function o(r,n){var t=[[],[]];r=r.clone(),n=n.clone();for(var e,i=0,o=0;r.cmpn(-i)>0||n.cmpn(-o)>0;){var a,s,u=r.andln(3)+i&3,c=n.andln(3)+o&3;3===u&&(u=-1),3===c&&(c=-1),a=0==(1&u)?0:3!==(e=r.andln(7)+i&7)&&5!==e||2!==c?u:-u,t[0].push(a),s=0==(1&c)?0:3!==(e=n.andln(7)+o&7)&&5!==e||2!==u?c:-c,t[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),r.iushrn(1),n.iushrn(1)}return t}function a(r,n,t){var e="_"+n;r.prototype[n]=function(){return void 0!==this[e]?this[e]:this[e]=t.call(this)}}function s(n){return"string"==typeof n?r.toArray(n,"hex"):n}function u(r){return new n(r,"hex","le")}r.assert=t,r.toArray=e.toArray,r.zero2=e.zero2,r.toHex=e.toHex,r.encode=e.encode,r.getNAF=i,r.getJSF=o,r.cachedProperty=a,r.parseBytes=s,r.intFromLE=u;
|
||
},{"bn.js":"RJrg","minimalistic-assert":"KsX4","minimalistic-crypto-utils":"wQrH"}],"Qo8X":[function(require,module,exports) {
|
||
"use strict";var t=require("bn.js"),e=require("../utils"),n=e.getNAF,r=e.getJSF,i=e.assert;function o(e,n){this.type=e,this.p=new t(n.p,16),this.red=n.prime?t.red(n.prime):t.mont(this.p),this.zero=new t(0).toRed(this.red),this.one=new t(1).toRed(this.red),this.two=new t(2).toRed(this.red),this.n=n.n&&new t(n.n,16),this.g=n.g&&this.pointFromJSON(n.g,n.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function s(t,e){this.curve=t,this.type=e,this.precomputed=null}module.exports=o,o.prototype.point=function(){throw new Error("Not implemented")},o.prototype.validate=function(){throw new Error("Not implemented")},o.prototype._fixedNafMul=function(t,e){i(t.precomputed);var r=t._getDoubles(),o=n(e,1,this._bitLength),s=(1<<r.step+1)-(r.step%2==0?2:1);s/=3;var p,h,d=[];for(p=0;p<o.length;p+=r.step){h=0;for(var u=p+r.step-1;u>=p;u--)h=(h<<1)+o[u];d.push(h)}for(var a=this.jpoint(null,null,null),l=this.jpoint(null,null,null),f=s;f>0;f--){for(p=0;p<d.length;p++)(h=d[p])===f?l=l.mixedAdd(r.points[p]):h===-f&&(l=l.mixedAdd(r.points[p].neg()));a=a.add(l)}return a.toP()},o.prototype._wnafMul=function(t,e){var r=4,o=t._getNAFPoints(r);r=o.wnd;for(var s=o.points,p=n(e,r,this._bitLength),h=this.jpoint(null,null,null),d=p.length-1;d>=0;d--){for(var u=0;d>=0&&0===p[d];d--)u++;if(d>=0&&u++,h=h.dblp(u),d<0)break;var a=p[d];i(0!==a),h="affine"===t.type?a>0?h.mixedAdd(s[a-1>>1]):h.mixedAdd(s[-a-1>>1].neg()):a>0?h.add(s[a-1>>1]):h.add(s[-a-1>>1].neg())}return"affine"===t.type?h.toP():h},o.prototype._wnafMulAdd=function(t,e,i,o,s){var p,h,d,u=this._wnafT1,a=this._wnafT2,l=this._wnafT3,f=0;for(p=0;p<o;p++){var c=(d=e[p])._getNAFPoints(t);u[p]=c.wnd,a[p]=c.points}for(p=o-1;p>=1;p-=2){var g=p-1,m=p;if(1===u[g]&&1===u[m]){var y=[e[g],null,null,e[m]];0===e[g].y.cmp(e[m].y)?(y[1]=e[g].add(e[m]),y[2]=e[g].toJ().mixedAdd(e[m].neg())):0===e[g].y.cmp(e[m].y.redNeg())?(y[1]=e[g].toJ().mixedAdd(e[m]),y[2]=e[g].add(e[m].neg())):(y[1]=e[g].toJ().mixedAdd(e[m]),y[2]=e[g].toJ().mixedAdd(e[m].neg()));var v=[-3,-1,-5,-7,0,7,5,1,3],w=r(i[g],i[m]);for(f=Math.max(w[0].length,f),l[g]=new Array(f),l[m]=new Array(f),h=0;h<f;h++){var b=0|w[0][h],_=0|w[1][h];l[g][h]=v[3*(b+1)+(_+1)],l[m][h]=0,a[g]=y}}else l[g]=n(i[g],u[g],this._bitLength),l[m]=n(i[m],u[m],this._bitLength),f=Math.max(l[g].length,f),f=Math.max(l[m].length,f)}var A=this.jpoint(null,null,null),x=this._wnafT4;for(p=f;p>=0;p--){for(var N=0;p>=0;){var L=!0;for(h=0;h<o;h++)x[h]=0|l[h][p],0!==x[h]&&(L=!1);if(!L)break;N++,p--}if(p>=0&&N++,A=A.dblp(N),p<0)break;for(h=0;h<o;h++){var P=x[h];0!==P&&(P>0?d=a[h][P-1>>1]:P<0&&(d=a[h][-P-1>>1].neg()),A="affine"===d.type?A.mixedAdd(d):A.add(d))}}for(p=0;p<o;p++)a[p]=null;return s?A:A.toP()},o.BasePoint=s,s.prototype.eq=function(){throw new Error("Not implemented")},s.prototype.validate=function(){return this.curve.validate(this)},o.prototype.decodePoint=function(t,n){t=e.toArray(t,n);var r=this.p.byteLength();if((4===t[0]||6===t[0]||7===t[0])&&t.length-1==2*r)return 6===t[0]?i(t[t.length-1]%2==0):7===t[0]&&i(t[t.length-1]%2==1),this.point(t.slice(1,1+r),t.slice(1+r,1+2*r));if((2===t[0]||3===t[0])&&t.length-1===r)return this.pointFromX(t.slice(1,1+r),3===t[0]);throw new Error("Unknown point format")},s.prototype.encodeCompressed=function(t){return this.encode(t,!0)},s.prototype._encode=function(t){var e=this.curve.p.byteLength(),n=this.getX().toArray("be",e);return t?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",e))},s.prototype.encode=function(t,n){return e.encode(this._encode(n),t)},s.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},s.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return!!e&&e.points.length>=Math.ceil((t.bitLength()+1)/e.step)},s.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i<e;i+=t){for(var o=0;o<t;o++)r=r.dbl();n.push(r)}return{step:t,points:n}},s.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],n=(1<<t)-1,r=1===n?null:this.dbl(),i=1;i<n;i++)e[i]=e[i-1].add(r);return{wnd:t,points:e}},s.prototype._getBeta=function(){return null},s.prototype.dblp=function(t){for(var e=this,n=0;n<t;n++)e=e.dbl();return e};
|
||
},{"bn.js":"RJrg","../utils":"hLmj"}],"JBz3":[function(require,module,exports) {
|
||
"use strict";var r=require("../utils"),e=require("bn.js"),t=require("inherits"),d=require("./base"),i=r.assert;function n(r){d.call(this,"short",r),this.a=new e(r.a,16).toRed(this.red),this.b=new e(r.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(r),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function u(r,t,i,n){d.BasePoint.call(this,r,"affine"),null===t&&null===i?(this.x=null,this.y=null,this.inf=!0):(this.x=new e(t,16),this.y=new e(i,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function s(r,t,i,n){d.BasePoint.call(this,r,"jacobian"),null===t&&null===i&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new e(0)):(this.x=new e(t,16),this.y=new e(i,16),this.z=new e(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}t(n,d),module.exports=n,n.prototype._getEndomorphism=function(r){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,d;if(r.beta)t=new e(r.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(r.lambda)d=new e(r.lambda,16);else{var u=this._getEndoRoots(this.n);0===this.g.mul(u[0]).x.cmp(this.g.x.redMul(t))?d=u[0]:(d=u[1],i(0===this.g.mul(d).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:d,basis:r.basis?r.basis.map(function(r){return{a:new e(r.a,16),b:new e(r.b,16)}}):this._getEndoBasis(d)}}},n.prototype._getEndoRoots=function(r){var t=r===this.p?this.red:e.mont(r),d=new e(2).toRed(t).redInvm(),i=d.redNeg(),n=new e(3).toRed(t).redNeg().redSqrt().redMul(d);return[i.redAdd(n).fromRed(),i.redSub(n).fromRed()]},n.prototype._getEndoBasis=function(r){for(var t,d,i,n,u,s,o,h,p,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),a=r,f=this.n.clone(),c=new e(1),S=new e(0),b=new e(0),v=new e(1),I=0;0!==a.cmpn(0);){var y=f.div(a);h=f.sub(y.mul(a)),p=b.sub(y.mul(c));var A=v.sub(y.mul(S));if(!i&&h.cmp(l)<0)t=o.neg(),d=c,i=h.neg(),n=p;else if(i&&2==++I)break;o=h,f=a,a=h,b=c,c=p,v=S,S=A}u=h.neg(),s=p;var m=i.sqr().add(n.sqr());return u.sqr().add(s.sqr()).cmp(m)>=0&&(u=t,s=d),i.negative&&(i=i.neg(),n=n.neg()),u.negative&&(u=u.neg(),s=s.neg()),[{a:i,b:n},{a:u,b:s}]},n.prototype._endoSplit=function(r){var e=this.endo.basis,t=e[0],d=e[1],i=d.b.mul(r).divRound(this.n),n=t.b.neg().mul(r).divRound(this.n),u=i.mul(t.a),s=n.mul(d.a),o=i.mul(t.b),h=n.mul(d.b);return{k1:r.sub(u).sub(s),k2:o.add(h).neg()}},n.prototype.pointFromX=function(r,t){(r=new e(r,16)).red||(r=r.toRed(this.red));var d=r.redSqr().redMul(r).redIAdd(r.redMul(this.a)).redIAdd(this.b),i=d.redSqrt();if(0!==i.redSqr().redSub(d).cmp(this.zero))throw new Error("invalid point");var n=i.fromRed().isOdd();return(t&&!n||!t&&n)&&(i=i.redNeg()),this.point(r,i)},n.prototype.validate=function(r){if(r.inf)return!0;var e=r.x,t=r.y,d=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(d).redIAdd(this.b);return 0===t.redSqr().redISub(i).cmpn(0)},n.prototype._endoWnafMulAdd=function(r,e,t){for(var d=this._endoWnafT1,i=this._endoWnafT2,n=0;n<r.length;n++){var u=this._endoSplit(e[n]),s=r[n],o=s._getBeta();u.k1.negative&&(u.k1.ineg(),s=s.neg(!0)),u.k2.negative&&(u.k2.ineg(),o=o.neg(!0)),d[2*n]=s,d[2*n+1]=o,i[2*n]=u.k1,i[2*n+1]=u.k2}for(var h=this._wnafMulAdd(1,d,i,2*n,t),p=0;p<2*n;p++)d[p]=null,i[p]=null;return h},t(u,d.BasePoint),n.prototype.point=function(r,e,t){return new u(this,r,e,t)},n.prototype.pointFromJSON=function(r,e){return u.fromJSON(this,r,e)},u.prototype._getBeta=function(){if(this.curve.endo){var r=this.precomputed;if(r&&r.beta)return r.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(r){var t=this.curve,d=function(r){return t.point(r.x.redMul(t.endo.beta),r.y)};r.beta=e,e.precomputed={beta:null,naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(d)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(d)}}}return e}},u.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},u.fromJSON=function(r,e,t){"string"==typeof e&&(e=JSON.parse(e));var d=r.point(e[0],e[1],t);if(!e[2])return d;function i(e){return r.point(e[0],e[1],t)}var n=e[2];return d.precomputed={beta:null,doubles:n.doubles&&{step:n.doubles.step,points:[d].concat(n.doubles.points.map(i))},naf:n.naf&&{wnd:n.naf.wnd,points:[d].concat(n.naf.points.map(i))}},d},u.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},u.prototype.isInfinity=function(){return this.inf},u.prototype.add=function(r){if(this.inf)return r;if(r.inf)return this;if(this.eq(r))return this.dbl();if(this.neg().eq(r))return this.curve.point(null,null);if(0===this.x.cmp(r.x))return this.curve.point(null,null);var e=this.y.redSub(r.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(r.x).redInvm()));var t=e.redSqr().redISub(this.x).redISub(r.x),d=e.redMul(this.x.redSub(t)).redISub(this.y);return this.curve.point(t,d)},u.prototype.dbl=function(){if(this.inf)return this;var r=this.y.redAdd(this.y);if(0===r.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,t=this.x.redSqr(),d=r.redInvm(),i=t.redAdd(t).redIAdd(t).redIAdd(e).redMul(d),n=i.redSqr().redISub(this.x.redAdd(this.x)),u=i.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,u)},u.prototype.getX=function(){return this.x.fromRed()},u.prototype.getY=function(){return this.y.fromRed()},u.prototype.mul=function(r){return r=new e(r,16),this.isInfinity()?this:this._hasDoubles(r)?this.curve._fixedNafMul(this,r):this.curve.endo?this.curve._endoWnafMulAdd([this],[r]):this.curve._wnafMul(this,r)},u.prototype.mulAdd=function(r,e,t){var d=[this,e],i=[r,t];return this.curve.endo?this.curve._endoWnafMulAdd(d,i):this.curve._wnafMulAdd(1,d,i,2)},u.prototype.jmulAdd=function(r,e,t){var d=[this,e],i=[r,t];return this.curve.endo?this.curve._endoWnafMulAdd(d,i,!0):this.curve._wnafMulAdd(1,d,i,2,!0)},u.prototype.eq=function(r){return this===r||this.inf===r.inf&&(this.inf||0===this.x.cmp(r.x)&&0===this.y.cmp(r.y))},u.prototype.neg=function(r){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(r&&this.precomputed){var t=this.precomputed,d=function(r){return r.neg()};e.precomputed={naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(d)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(d)}}}return e},u.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},t(s,d.BasePoint),n.prototype.jpoint=function(r,e,t){return new s(this,r,e,t)},s.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var r=this.z.redInvm(),e=r.redSqr(),t=this.x.redMul(e),d=this.y.redMul(e).redMul(r);return this.curve.point(t,d)},s.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},s.prototype.add=function(r){if(this.isInfinity())return r;if(r.isInfinity())return this;var e=r.z.redSqr(),t=this.z.redSqr(),d=this.x.redMul(e),i=r.x.redMul(t),n=this.y.redMul(e.redMul(r.z)),u=r.y.redMul(t.redMul(this.z)),s=d.redSub(i),o=n.redSub(u);if(0===s.cmpn(0))return 0!==o.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h=s.redSqr(),p=h.redMul(s),l=d.redMul(h),a=o.redSqr().redIAdd(p).redISub(l).redISub(l),f=o.redMul(l.redISub(a)).redISub(n.redMul(p)),c=this.z.redMul(r.z).redMul(s);return this.curve.jpoint(a,f,c)},s.prototype.mixedAdd=function(r){if(this.isInfinity())return r.toJ();if(r.isInfinity())return this;var e=this.z.redSqr(),t=this.x,d=r.x.redMul(e),i=this.y,n=r.y.redMul(e).redMul(this.z),u=t.redSub(d),s=i.redSub(n);if(0===u.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var o=u.redSqr(),h=o.redMul(u),p=t.redMul(o),l=s.redSqr().redIAdd(h).redISub(p).redISub(p),a=s.redMul(p.redISub(l)).redISub(i.redMul(h)),f=this.z.redMul(u);return this.curve.jpoint(l,a,f)},s.prototype.dblp=function(r){if(0===r)return this;if(this.isInfinity())return this;if(!r)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var t=this;for(e=0;e<r;e++)t=t.dbl();return t}var d=this.curve.a,i=this.curve.tinv,n=this.x,u=this.y,s=this.z,o=s.redSqr().redSqr(),h=u.redAdd(u);for(e=0;e<r;e++){var p=n.redSqr(),l=h.redSqr(),a=l.redSqr(),f=p.redAdd(p).redIAdd(p).redIAdd(d.redMul(o)),c=n.redMul(l),S=f.redSqr().redISub(c.redAdd(c)),b=c.redISub(S),v=f.redMul(b);v=v.redIAdd(v).redISub(a);var I=h.redMul(s);e+1<r&&(o=o.redMul(a)),n=S,s=I,h=v}return this.curve.jpoint(n,h.redMul(i),s)},s.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},s.prototype._zeroDbl=function(){var r,e,t;if(this.zOne){var d=this.x.redSqr(),i=this.y.redSqr(),n=i.redSqr(),u=this.x.redAdd(i).redSqr().redISub(d).redISub(n);u=u.redIAdd(u);var s=d.redAdd(d).redIAdd(d),o=s.redSqr().redISub(u).redISub(u),h=n.redIAdd(n);h=(h=h.redIAdd(h)).redIAdd(h),r=o,e=s.redMul(u.redISub(o)).redISub(h),t=this.y.redAdd(this.y)}else{var p=this.x.redSqr(),l=this.y.redSqr(),a=l.redSqr(),f=this.x.redAdd(l).redSqr().redISub(p).redISub(a);f=f.redIAdd(f);var c=p.redAdd(p).redIAdd(p),S=c.redSqr(),b=a.redIAdd(a);b=(b=b.redIAdd(b)).redIAdd(b),r=S.redISub(f).redISub(f),e=c.redMul(f.redISub(r)).redISub(b),t=(t=this.y.redMul(this.z)).redIAdd(t)}return this.curve.jpoint(r,e,t)},s.prototype._threeDbl=function(){var r,e,t;if(this.zOne){var d=this.x.redSqr(),i=this.y.redSqr(),n=i.redSqr(),u=this.x.redAdd(i).redSqr().redISub(d).redISub(n);u=u.redIAdd(u);var s=d.redAdd(d).redIAdd(d).redIAdd(this.curve.a),o=s.redSqr().redISub(u).redISub(u);r=o;var h=n.redIAdd(n);h=(h=h.redIAdd(h)).redIAdd(h),e=s.redMul(u.redISub(o)).redISub(h),t=this.y.redAdd(this.y)}else{var p=this.z.redSqr(),l=this.y.redSqr(),a=this.x.redMul(l),f=this.x.redSub(p).redMul(this.x.redAdd(p));f=f.redAdd(f).redIAdd(f);var c=a.redIAdd(a),S=(c=c.redIAdd(c)).redAdd(c);r=f.redSqr().redISub(S),t=this.y.redAdd(this.z).redSqr().redISub(l).redISub(p);var b=l.redSqr();b=(b=(b=b.redIAdd(b)).redIAdd(b)).redIAdd(b),e=f.redMul(c.redISub(r)).redISub(b)}return this.curve.jpoint(r,e,t)},s.prototype._dbl=function(){var r=this.curve.a,e=this.x,t=this.y,d=this.z,i=d.redSqr().redSqr(),n=e.redSqr(),u=t.redSqr(),s=n.redAdd(n).redIAdd(n).redIAdd(r.redMul(i)),o=e.redAdd(e),h=(o=o.redIAdd(o)).redMul(u),p=s.redSqr().redISub(h.redAdd(h)),l=h.redISub(p),a=u.redSqr();a=(a=(a=a.redIAdd(a)).redIAdd(a)).redIAdd(a);var f=s.redMul(l).redISub(a),c=t.redAdd(t).redMul(d);return this.curve.jpoint(p,f,c)},s.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var r=this.x.redSqr(),e=this.y.redSqr(),t=this.z.redSqr(),d=e.redSqr(),i=r.redAdd(r).redIAdd(r),n=i.redSqr(),u=this.x.redAdd(e).redSqr().redISub(r).redISub(d),s=(u=(u=(u=u.redIAdd(u)).redAdd(u).redIAdd(u)).redISub(n)).redSqr(),o=d.redIAdd(d);o=(o=(o=o.redIAdd(o)).redIAdd(o)).redIAdd(o);var h=i.redIAdd(u).redSqr().redISub(n).redISub(s).redISub(o),p=e.redMul(h);p=(p=p.redIAdd(p)).redIAdd(p);var l=this.x.redMul(s).redISub(p);l=(l=l.redIAdd(l)).redIAdd(l);var a=this.y.redMul(h.redMul(o.redISub(h)).redISub(u.redMul(s)));a=(a=(a=a.redIAdd(a)).redIAdd(a)).redIAdd(a);var f=this.z.redAdd(u).redSqr().redISub(t).redISub(s);return this.curve.jpoint(l,a,f)},s.prototype.mul=function(r,t){return r=new e(r,t),this.curve._wnafMul(this,r)},s.prototype.eq=function(r){if("affine"===r.type)return this.eq(r.toJ());if(this===r)return!0;var e=this.z.redSqr(),t=r.z.redSqr();if(0!==this.x.redMul(t).redISub(r.x.redMul(e)).cmpn(0))return!1;var d=e.redMul(this.z),i=t.redMul(r.z);return 0===this.y.redMul(i).redISub(r.y.redMul(d)).cmpn(0)},s.prototype.eqXToP=function(r){var e=this.z.redSqr(),t=r.toRed(this.curve.red).redMul(e);if(0===this.x.cmp(t))return!0;for(var d=r.clone(),i=this.curve.redN.redMul(e);;){if(d.iadd(this.curve.n),d.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(i),0===this.x.cmp(t))return!0}},s.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},s.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};
|
||
},{"../utils":"hLmj","bn.js":"RJrg","inherits":"4GKf","./base":"Qo8X"}],"iBD7":[function(require,module,exports) {
|
||
"use strict";var t=require("bn.js"),r=require("inherits"),e=require("./base"),i=require("../utils");function o(r){e.call(this,"mont",r),this.a=new t(r.a,16).toRed(this.red),this.b=new t(r.b,16).toRed(this.red),this.i4=new t(4).toRed(this.red).redInvm(),this.two=new t(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function n(r,i,o){e.BasePoint.call(this,r,"projective"),null===i&&null===o?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new t(i,16),this.z=new t(o,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}r(o,e),module.exports=o,o.prototype.validate=function(t){var r=t.normalize().x,e=r.redSqr(),i=e.redMul(r).redAdd(e.redMul(this.a)).redAdd(r);return 0===i.redSqrt().redSqr().cmp(i)},r(n,e.BasePoint),o.prototype.decodePoint=function(t,r){return this.point(i.toArray(t,r),1)},o.prototype.point=function(t,r){return new n(this,t,r)},o.prototype.pointFromJSON=function(t){return n.fromJSON(this,t)},n.prototype.precompute=function(){},n.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},n.fromJSON=function(t,r){return new n(t,r[0],r[1]||t.one)},n.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},n.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},n.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),r=this.x.redSub(this.z).redSqr(),e=t.redSub(r),i=t.redMul(r),o=e.redMul(r.redAdd(this.curve.a24.redMul(e)));return this.curve.point(i,o)},n.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},n.prototype.diffAdd=function(t,r){var e=this.x.redAdd(this.z),i=this.x.redSub(this.z),o=t.x.redAdd(t.z),n=t.x.redSub(t.z).redMul(e),d=o.redMul(i),u=r.z.redMul(n.redAdd(d).redSqr()),s=r.x.redMul(n.redISub(d).redSqr());return this.curve.point(u,s)},n.prototype.mul=function(t){for(var r=t.clone(),e=this,i=this.curve.point(null,null),o=[];0!==r.cmpn(0);r.iushrn(1))o.push(r.andln(1));for(var n=o.length-1;n>=0;n--)0===o[n]?(e=e.diffAdd(i,this),i=i.dbl()):(i=e.diffAdd(i,this),e=e.dbl());return i},n.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},n.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},n.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},n.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},n.prototype.getX=function(){return this.normalize(),this.x.fromRed()};
|
||
},{"bn.js":"RJrg","inherits":"4GKf","./base":"Qo8X","../utils":"hLmj"}],"5zAD":[function(require,module,exports) {
|
||
"use strict";var t=require("../utils"),e=require("bn.js"),r=require("inherits"),i=require("./base"),d=t.assert;function s(t){this.twisted=1!=(0|t.a),this.mOneA=this.twisted&&-1==(0|t.a),this.extended=this.mOneA,i.call(this,"edwards",t),this.a=new e(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new e(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new e(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),d(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|t.c)}function u(t,r,d,s,u){i.BasePoint.call(this,t,"projective"),null===r&&null===d&&null===s?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new e(r,16),this.y=new e(d,16),this.z=s?new e(s,16):this.curve.one,this.t=u&&new e(u,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}r(s,i),module.exports=s,s.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)},s.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)},s.prototype.jpoint=function(t,e,r,i){return this.point(t,e,r,i)},s.prototype.pointFromX=function(t,r){(t=new e(t,16)).red||(t=t.toRed(this.red));var i=t.redSqr(),d=this.c2.redSub(this.a.redMul(i)),s=this.one.redSub(this.c2.redMul(this.d).redMul(i)),u=d.redMul(s.redInvm()),h=u.redSqrt();if(0!==h.redSqr().redSub(u).cmp(this.zero))throw new Error("invalid point");var n=h.fromRed().isOdd();return(r&&!n||!r&&n)&&(h=h.redNeg()),this.point(t,h)},s.prototype.pointFromY=function(t,r){(t=new e(t,16)).red||(t=t.toRed(this.red));var i=t.redSqr(),d=i.redSub(this.c2),s=i.redMul(this.d).redMul(this.c2).redSub(this.a),u=d.redMul(s.redInvm());if(0===u.cmp(this.zero)){if(r)throw new Error("invalid point");return this.point(this.zero,t)}var h=u.redSqrt();if(0!==h.redSqr().redSub(u).cmp(this.zero))throw new Error("invalid point");return h.fromRed().isOdd()!==r&&(h=h.redNeg()),this.point(h,t)},s.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),r=t.y.redSqr(),i=e.redMul(this.a).redAdd(r),d=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(r)));return 0===i.cmp(d)},r(u,i.BasePoint),s.prototype.pointFromJSON=function(t){return u.fromJSON(this,t)},s.prototype.point=function(t,e,r,i){return new u(this,t,e,r,i)},u.fromJSON=function(t,e){return new u(t,e[0],e[1],e[2])},u.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},u.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},u.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var i=this.curve._mulA(t),d=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),s=i.redAdd(e),u=s.redSub(r),h=i.redSub(e),n=d.redMul(u),o=s.redMul(h),c=d.redMul(h),l=u.redMul(s);return this.curve.point(n,o,l,c)},u.prototype._projDbl=function(){var t,e,r,i,d,s,u=this.x.redAdd(this.y).redSqr(),h=this.x.redSqr(),n=this.y.redSqr();if(this.curve.twisted){var o=(i=this.curve._mulA(h)).redAdd(n);this.zOne?(t=u.redSub(h).redSub(n).redMul(o.redSub(this.curve.two)),e=o.redMul(i.redSub(n)),r=o.redSqr().redSub(o).redSub(o)):(d=this.z.redSqr(),s=o.redSub(d).redISub(d),t=u.redSub(h).redISub(n).redMul(s),e=o.redMul(i.redSub(n)),r=o.redMul(s))}else i=h.redAdd(n),d=this.curve._mulC(this.z).redSqr(),s=i.redSub(d).redSub(d),t=this.curve._mulC(u.redISub(i)).redMul(s),e=this.curve._mulC(i).redMul(h.redISub(n)),r=i.redMul(s);return this.curve.point(t,e,r)},u.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},u.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),r=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),i=this.t.redMul(this.curve.dd).redMul(t.t),d=this.z.redMul(t.z.redAdd(t.z)),s=r.redSub(e),u=d.redSub(i),h=d.redAdd(i),n=r.redAdd(e),o=s.redMul(u),c=h.redMul(n),l=s.redMul(n),p=u.redMul(h);return this.curve.point(o,c,p,l)},u.prototype._projAdd=function(t){var e,r,i=this.z.redMul(t.z),d=i.redSqr(),s=this.x.redMul(t.x),u=this.y.redMul(t.y),h=this.curve.d.redMul(s).redMul(u),n=d.redSub(h),o=d.redAdd(h),c=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(s).redISub(u),l=i.redMul(n).redMul(c);return this.curve.twisted?(e=i.redMul(o).redMul(u.redSub(this.curve._mulA(s))),r=n.redMul(o)):(e=i.redMul(o).redMul(u.redSub(s)),r=this.curve._mulC(n).redMul(o)),this.curve.point(l,e,r)},u.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},u.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},u.prototype.mulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!1)},u.prototype.jmulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!0)},u.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},u.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()},u.prototype.getY=function(){return this.normalize(),this.y.fromRed()},u.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},u.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var r=t.clone(),i=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(i),0===this.x.cmp(e))return!0}},u.prototype.toP=u.prototype.normalize,u.prototype.mixedAdd=u.prototype.add;
|
||
},{"../utils":"hLmj","bn.js":"RJrg","inherits":"4GKf","./base":"Qo8X"}],"3fmn":[function(require,module,exports) {
|
||
"use strict";var r=exports;r.base=require("./base"),r.short=require("./short"),r.mont=require("./mont"),r.edwards=require("./edwards");
|
||
},{"./base":"Qo8X","./short":"JBz3","./mont":"iBD7","./edwards":"5zAD"}],"nkOw":[function(require,module,exports) {
|
||
"use strict";var r=require("minimalistic-assert"),t=require("inherits");function n(r,t){return 55296==(64512&r.charCodeAt(t))&&(!(t<0||t+1>=r.length)&&56320==(64512&r.charCodeAt(t+1)))}function e(r,t){if(Array.isArray(r))return r.slice();if(!r)return[];var e=[];if("string"==typeof r)if(t){if("hex"===t)for((r=r.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(r="0"+r),u=0;u<r.length;u+=2)e.push(parseInt(r[u]+r[u+1],16))}else for(var o=0,u=0;u<r.length;u++){var i=r.charCodeAt(u);i<128?e[o++]=i:i<2048?(e[o++]=i>>6|192,e[o++]=63&i|128):n(r,u)?(i=65536+((1023&i)<<10)+(1023&r.charCodeAt(++u)),e[o++]=i>>18|240,e[o++]=i>>12&63|128,e[o++]=i>>6&63|128,e[o++]=63&i|128):(e[o++]=i>>12|224,e[o++]=i>>6&63|128,e[o++]=63&i|128)}else for(u=0;u<r.length;u++)e[u]=0|r[u];return e}function o(r){for(var t="",n=0;n<r.length;n++)t+=s(r[n].toString(16));return t}function u(r){return(r>>>24|r>>>8&65280|r<<8&16711680|(255&r)<<24)>>>0}function i(r,t){for(var n="",e=0;e<r.length;e++){var o=r[e];"little"===t&&(o=u(o)),n+=f(o.toString(16))}return n}function s(r){return 1===r.length?"0"+r:r}function f(r){return 7===r.length?"0"+r:6===r.length?"00"+r:5===r.length?"000"+r:4===r.length?"0000"+r:3===r.length?"00000"+r:2===r.length?"000000"+r:1===r.length?"0000000"+r:r}function c(t,n,e,o){var u=e-n;r(u%4==0);for(var i=new Array(u/4),s=0,f=n;s<i.length;s++,f+=4){var c;c="big"===o?t[f]<<24|t[f+1]<<16|t[f+2]<<8|t[f+3]:t[f+3]<<24|t[f+2]<<16|t[f+1]<<8|t[f],i[s]=c>>>0}return i}function h(r,t){for(var n=new Array(4*r.length),e=0,o=0;e<r.length;e++,o+=4){var u=r[e];"big"===t?(n[o]=u>>>24,n[o+1]=u>>>16&255,n[o+2]=u>>>8&255,n[o+3]=255&u):(n[o+3]=u>>>24,n[o+2]=u>>>16&255,n[o+1]=u>>>8&255,n[o]=255&u)}return n}function l(r,t){return r>>>t|r<<32-t}function p(r,t){return r<<t|r>>>32-t}function a(r,t){return r+t>>>0}function x(r,t,n){return r+t+n>>>0}function g(r,t,n,e){return r+t+n+e>>>0}function _(r,t,n,e,o){return r+t+n+e+o>>>0}function v(r,t,n,e){var o=r[t],u=e+r[t+1]>>>0,i=(u<e?1:0)+n+o;r[t]=i>>>0,r[t+1]=u}function m(r,t,n,e){return(t+e>>>0<t?1:0)+r+n>>>0}function A(r,t,n,e){return t+e>>>0}function y(r,t,n,e,o,u,i,s){var f=0,c=t;return f+=(c=c+e>>>0)<t?1:0,f+=(c=c+u>>>0)<u?1:0,r+n+o+i+(f+=(c=c+s>>>0)<s?1:0)>>>0}function d(r,t,n,e,o,u,i,s){return t+e+u+s>>>0}function C(r,t,n,e,o,u,i,s,f,c){var h=0,l=t;return h+=(l=l+e>>>0)<t?1:0,h+=(l=l+u>>>0)<u?1:0,h+=(l=l+s>>>0)<s?1:0,r+n+o+i+f+(h+=(l=l+c>>>0)<c?1:0)>>>0}function z(r,t,n,e,o,u,i,s,f,c){return t+e+u+s+c>>>0}function b(r,t,n){return(t<<32-n|r>>>n)>>>0}function q(r,t,n){return(r<<32-n|t>>>n)>>>0}function w(r,t,n){return r>>>n}function H(r,t,n){return(r<<32-n|t>>>n)>>>0}exports.inherits=t,exports.toArray=e,exports.toHex=o,exports.htonl=u,exports.toHex32=i,exports.zero2=s,exports.zero8=f,exports.join32=c,exports.split32=h,exports.rotr32=l,exports.rotl32=p,exports.sum32=a,exports.sum32_3=x,exports.sum32_4=g,exports.sum32_5=_,exports.sum64=v,exports.sum64_hi=m,exports.sum64_lo=A,exports.sum64_4_hi=y,exports.sum64_4_lo=d,exports.sum64_5_hi=C,exports.sum64_5_lo=z,exports.rotr64_hi=b,exports.rotr64_lo=q,exports.shr64_hi=w,exports.shr64_lo=H;
|
||
},{"minimalistic-assert":"KsX4","inherits":"4GKf"}],"d5ks":[function(require,module,exports) {
|
||
"use strict";var t=require("./utils"),i=require("minimalistic-assert");function n(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}exports.BlockHash=n,n.prototype.update=function(i,n){if(i=t.toArray(i,n),this.pending?this.pending=this.pending.concat(i):this.pending=i,this.pendingTotal+=i.length,this.pending.length>=this._delta8){var e=(i=this.pending).length%this._delta8;this.pending=i.slice(i.length-e,i.length),0===this.pending.length&&(this.pending=null),i=t.join32(i,0,i.length-e,this.endian);for(var h=0;h<i.length;h+=this._delta32)this._update(i,h,h+this._delta32)}return this},n.prototype.digest=function(t){return this.update(this._pad()),i(null===this.pending),this._digest(t)},n.prototype._pad=function(){var t=this.pendingTotal,i=this._delta8,n=i-(t+this.padLength)%i,e=new Array(n+this.padLength);e[0]=128;for(var h=1;h<n;h++)e[h]=0;if(t<<=3,"big"===this.endian){for(var s=8;s<this.padLength;s++)e[h++]=0;e[h++]=0,e[h++]=0,e[h++]=0,e[h++]=0,e[h++]=t>>>24&255,e[h++]=t>>>16&255,e[h++]=t>>>8&255,e[h++]=255&t}else for(e[h++]=255&t,e[h++]=t>>>8&255,e[h++]=t>>>16&255,e[h++]=t>>>24&255,e[h++]=0,e[h++]=0,e[h++]=0,e[h++]=0,s=8;s<this.padLength;s++)e[h++]=0;return e};
|
||
},{"./utils":"nkOw","minimalistic-assert":"KsX4"}],"DO8W":[function(require,module,exports) {
|
||
"use strict";var r=require("../utils"),t=r.rotr32;function n(r,t,n,s){return 0===r?e(t,n,s):1===r||3===r?o(t,n,s):2===r?u(t,n,s):void 0}function e(r,t,n){return r&t^~r&n}function u(r,t,n){return r&t^r&n^t&n}function o(r,t,n){return r^t^n}function s(r){return t(r,2)^t(r,13)^t(r,22)}function i(r){return t(r,6)^t(r,11)^t(r,25)}function c(r){return t(r,7)^t(r,18)^r>>>3}function f(r){return t(r,17)^t(r,19)^r>>>10}exports.ft_1=n,exports.ch32=e,exports.maj32=u,exports.p32=o,exports.s0_256=s,exports.s1_256=i,exports.g0_256=c,exports.g1_256=f;
|
||
},{"../utils":"nkOw"}],"CO9T":[function(require,module,exports) {
|
||
"use strict";var t=require("../utils"),h=require("../common"),i=require("./common"),s=t.rotl32,e=t.sum32,r=t.sum32_5,o=i.ft_1,n=h.BlockHash,u=[1518500249,1859775393,2400959708,3395469782];function a(){if(!(this instanceof a))return new a;n.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}t.inherits(a,n),module.exports=a,a.blockSize=512,a.outSize=160,a.hmacStrength=80,a.padLength=64,a.prototype._update=function(t,h){for(var i=this.W,n=0;n<16;n++)i[n]=t[h+n];for(;n<i.length;n++)i[n]=s(i[n-3]^i[n-8]^i[n-14]^i[n-16],1);var a=this.h[0],c=this.h[1],l=this.h[2],f=this.h[3],m=this.h[4];for(n=0;n<i.length;n++){var p=~~(n/20),g=r(s(a,5),o(p,c,l,f),m,i[n],u[p]);m=f,f=l,l=s(c,30),c=a,a=g}this.h[0]=e(this.h[0],a),this.h[1]=e(this.h[1],c),this.h[2]=e(this.h[2],l),this.h[3]=e(this.h[3],f),this.h[4]=e(this.h[4],m)},a.prototype._digest=function(h){return"hex"===h?t.toHex32(this.h,"big"):t.split32(this.h,"big")};
|
||
},{"../utils":"nkOw","../common":"d5ks","./common":"DO8W"}],"S4Of":[function(require,module,exports) {
|
||
"use strict";var h=require("../utils"),t=require("../common"),i=require("./common"),s=require("minimalistic-assert"),e=h.sum32,r=h.sum32_4,n=h.sum32_5,o=i.ch32,u=i.maj32,a=i.s0_256,c=i.s1_256,l=i.g0_256,m=i.g1_256,g=t.BlockHash,f=[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];function p(){if(!(this instanceof p))return new p;g.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=f,this.W=new Array(64)}h.inherits(p,g),module.exports=p,p.blockSize=512,p.outSize=256,p.hmacStrength=192,p.padLength=64,p.prototype._update=function(h,t){for(var i=this.W,g=0;g<16;g++)i[g]=h[t+g];for(;g<i.length;g++)i[g]=r(m(i[g-2]),i[g-7],l(i[g-15]),i[g-16]);var f=this.h[0],p=this.h[1],_=this.h[2],k=this.h[3],d=this.h[4],q=this.h[5],v=this.h[6],b=this.h[7];for(s(this.k.length===i.length),g=0;g<i.length;g++){var x=n(b,c(d),o(d,q,v),this.k[g],i[g]),y=e(a(f),u(f,p,_));b=v,v=q,q=d,d=e(k,x),k=_,_=p,p=f,f=e(x,y)}this.h[0]=e(this.h[0],f),this.h[1]=e(this.h[1],p),this.h[2]=e(this.h[2],_),this.h[3]=e(this.h[3],k),this.h[4]=e(this.h[4],d),this.h[5]=e(this.h[5],q),this.h[6]=e(this.h[6],v),this.h[7]=e(this.h[7],b)},p.prototype._digest=function(t){return"hex"===t?h.toHex32(this.h,"big"):h.split32(this.h,"big")};
|
||
},{"../utils":"nkOw","../common":"d5ks","./common":"DO8W","minimalistic-assert":"KsX4"}],"oEQu":[function(require,module,exports) {
|
||
"use strict";var t=require("../utils"),i=require("./256");function e(){if(!(this instanceof e))return new e;i.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}t.inherits(e,i),module.exports=e,e.blockSize=512,e.outSize=224,e.hmacStrength=192,e.padLength=64,e.prototype._digest=function(i){return"hex"===i?t.toHex32(this.h.slice(0,7),"big"):t.split32(this.h.slice(0,7),"big")};
|
||
},{"../utils":"nkOw","./256":"S4Of"}],"qupt":[function(require,module,exports) {
|
||
"use strict";var t=require("../utils"),h=require("../common"),i=require("minimalistic-assert"),r=t.rotr64_hi,n=t.rotr64_lo,s=t.shr64_hi,e=t.shr64_lo,u=t.sum64,o=t.sum64_hi,a=t.sum64_lo,c=t.sum64_4_hi,f=t.sum64_4_lo,l=t.sum64_5_hi,v=t.sum64_5_lo,_=h.BlockHash,p=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function m(){if(!(this instanceof m))return new m;_.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=p,this.W=new Array(160)}function g(t,h,i,r,n){var s=t&i^~t&n;return s<0&&(s+=4294967296),s}function k(t,h,i,r,n,s){var e=h&r^~h&s;return e<0&&(e+=4294967296),e}function d(t,h,i,r,n){var s=t&i^t&n^i&n;return s<0&&(s+=4294967296),s}function y(t,h,i,r,n,s){var e=h&r^h&s^r&s;return e<0&&(e+=4294967296),e}function b(t,h){var i=r(t,h,28)^r(h,t,2)^r(h,t,7);return i<0&&(i+=4294967296),i}function q(t,h){var i=n(t,h,28)^n(h,t,2)^n(h,t,7);return i<0&&(i+=4294967296),i}function x(t,h){var i=r(t,h,14)^r(t,h,18)^r(h,t,9);return i<0&&(i+=4294967296),i}function B(t,h){var i=n(t,h,14)^n(t,h,18)^n(h,t,9);return i<0&&(i+=4294967296),i}function S(t,h){var i=r(t,h,1)^r(t,h,8)^s(t,h,7);return i<0&&(i+=4294967296),i}function W(t,h){var i=n(t,h,1)^n(t,h,8)^e(t,h,7);return i<0&&(i+=4294967296),i}function w(t,h){var i=r(t,h,19)^r(h,t,29)^s(t,h,6);return i<0&&(i+=4294967296),i}function z(t,h){var i=n(t,h,19)^n(h,t,29)^e(t,h,6);return i<0&&(i+=4294967296),i}t.inherits(m,_),module.exports=m,m.blockSize=1024,m.outSize=512,m.hmacStrength=192,m.padLength=128,m.prototype._prepareBlock=function(t,h){for(var i=this.W,r=0;r<32;r++)i[r]=t[h+r];for(;r<i.length;r+=2){var n=w(i[r-4],i[r-3]),s=z(i[r-4],i[r-3]),e=i[r-14],u=i[r-13],o=S(i[r-30],i[r-29]),a=W(i[r-30],i[r-29]),l=i[r-32],v=i[r-31];i[r]=c(n,s,e,u,o,a,l,v),i[r+1]=f(n,s,e,u,o,a,l,v)}},m.prototype._update=function(t,h){this._prepareBlock(t,h);var r=this.W,n=this.h[0],s=this.h[1],e=this.h[2],c=this.h[3],f=this.h[4],_=this.h[5],p=this.h[6],m=this.h[7],S=this.h[8],W=this.h[9],w=this.h[10],z=this.h[11],H=this.h[12],A=this.h[13],L=this.h[14],j=this.h[15];i(this.k.length===r.length);for(var C=0;C<r.length;C+=2){var D=L,E=j,F=x(S,W),G=B(S,W),I=g(S,W,w,z,H,A),J=k(S,W,w,z,H,A),K=this.k[C],M=this.k[C+1],N=r[C],O=r[C+1],P=l(D,E,F,G,I,J,K,M,N,O),Q=v(D,E,F,G,I,J,K,M,N,O);D=b(n,s),E=q(n,s),F=d(n,s,e,c,f,_),G=y(n,s,e,c,f,_);var R=o(D,E,F,G),T=a(D,E,F,G);L=H,j=A,H=w,A=z,w=S,z=W,S=o(p,m,P,Q),W=a(m,m,P,Q),p=f,m=_,f=e,_=c,e=n,c=s,n=o(P,Q,R,T),s=a(P,Q,R,T)}u(this.h,0,n,s),u(this.h,2,e,c),u(this.h,4,f,_),u(this.h,6,p,m),u(this.h,8,S,W),u(this.h,10,w,z),u(this.h,12,H,A),u(this.h,14,L,j)},m.prototype._digest=function(h){return"hex"===h?t.toHex32(this.h,"big"):t.split32(this.h,"big")};
|
||
},{"../utils":"nkOw","../common":"d5ks","minimalistic-assert":"KsX4"}],"4oSX":[function(require,module,exports) {
|
||
"use strict";var t=require("../utils"),i=require("./512");function e(){if(!(this instanceof e))return new e;i.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}t.inherits(e,i),module.exports=e,e.blockSize=1024,e.outSize=384,e.hmacStrength=192,e.padLength=128,e.prototype._digest=function(i){return"hex"===i?t.toHex32(this.h.slice(0,12),"big"):t.split32(this.h.slice(0,12),"big")};
|
||
},{"../utils":"nkOw","./512":"qupt"}],"yBIv":[function(require,module,exports) {
|
||
"use strict";exports.sha1=require("./sha/1"),exports.sha224=require("./sha/224"),exports.sha256=require("./sha/256"),exports.sha384=require("./sha/384"),exports.sha512=require("./sha/512");
|
||
},{"./sha/1":"CO9T","./sha/224":"oEQu","./sha/256":"S4Of","./sha/384":"4oSX","./sha/512":"qupt"}],"hfbr":[function(require,module,exports) {
|
||
"use strict";var t=require("./utils"),h=require("./common"),i=t.rotl32,s=t.sum32,e=t.sum32_3,r=t.sum32_4,n=h.BlockHash;function o(){if(!(this instanceof o))return new o;n.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function u(t,h,i,s){return t<=15?h^i^s:t<=31?h&i|~h&s:t<=47?(h|~i)^s:t<=63?h&s|i&~s:h^(i|~s)}function c(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function l(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}t.inherits(o,n),exports.ripemd160=o,o.blockSize=512,o.outSize=160,o.hmacStrength=192,o.padLength=64,o.prototype._update=function(t,h){for(var n=this.h[0],o=this.h[1],d=this.h[2],v=this.h[3],_=this.h[4],g=n,x=o,S=d,k=v,q=_,y=0;y<80;y++){var z=s(i(r(n,u(y,o,d,v),t[a[y]+h],c(y)),p[y]),_);n=_,_=v,v=i(d,10),d=o,o=z,z=s(i(r(g,u(79-y,x,S,k),t[f[y]+h],l(y)),m[y]),q),g=q,q=k,k=i(S,10),S=x,x=z}z=e(this.h[1],d,k),this.h[1]=e(this.h[2],v,q),this.h[2]=e(this.h[3],_,g),this.h[3]=e(this.h[4],n,x),this.h[4]=e(this.h[0],o,S),this.h[0]=z},o.prototype._digest=function(h){return"hex"===h?t.toHex32(this.h,"little"):t.split32(this.h,"little")};var a=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],f=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],p=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],m=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11];
|
||
},{"./utils":"nkOw","./common":"d5ks"}],"Z8Lw":[function(require,module,exports) {
|
||
"use strict";var t=require("./utils"),i=require("minimalistic-assert");function e(i,s,n){if(!(this instanceof e))return new e(i,s,n);this.Hash=i,this.blockSize=i.blockSize/8,this.outSize=i.outSize/8,this.inner=null,this.outer=null,this._init(t.toArray(s,n))}module.exports=e,e.prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),i(t.length<=this.blockSize);for(var e=t.length;e<this.blockSize;e++)t.push(0);for(e=0;e<t.length;e++)t[e]^=54;for(this.inner=(new this.Hash).update(t),e=0;e<t.length;e++)t[e]^=106;this.outer=(new this.Hash).update(t)},e.prototype.update=function(t,i){return this.inner.update(t,i),this},e.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)};
|
||
},{"./utils":"nkOw","minimalistic-assert":"KsX4"}],"U6lo":[function(require,module,exports) {
|
||
var h=exports;h.utils=require("./hash/utils"),h.common=require("./hash/common"),h.sha=require("./hash/sha"),h.ripemd=require("./hash/ripemd"),h.hmac=require("./hash/hmac"),h.sha1=h.sha.sha1,h.sha256=h.sha.sha256,h.sha224=h.sha.sha224,h.sha384=h.sha.sha384,h.sha512=h.sha.sha512,h.ripemd160=h.ripemd.ripemd160;
|
||
},{"./hash/utils":"nkOw","./hash/common":"d5ks","./hash/sha":"yBIv","./hash/ripemd":"hfbr","./hash/hmac":"Z8Lw"}],"6Yey":[function(require,module,exports) {
|
||
"use strict";var f,e=exports,a=require("hash.js"),b=require("./curve"),c=require("./utils"),d=c.assert;function r(f){"short"===f.type?this.curve=new b.short(f):"edwards"===f.type?this.curve=new b.edwards(f):this.curve=new b.mont(f),this.g=this.curve.g,this.n=this.curve.n,this.hash=f.hash,d(this.g.validate(),"Invalid curve"),d(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function s(f,a){Object.defineProperty(e,f,{configurable:!0,enumerable:!0,get:function(){var b=new r(a);return Object.defineProperty(e,f,{configurable:!0,enumerable:!0,value:b}),b}})}e.PresetCurve=r,s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:a.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:a.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:a.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:a.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:a.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:a.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:a.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{f=require("./precomputed/secp256k1")}catch(t){f=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:a.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",f]});
|
||
},{"hash.js":"U6lo","./curve":"3fmn","./utils":"hLmj","./precomputed/secp256k1":"eVX/"}],"kwdl":[function(require,module,exports) {
|
||
"use strict";var t=require("hash.js"),e=require("minimalistic-crypto-utils"),i=require("minimalistic-assert");function s(t){if(!(this instanceof s))return new s(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var h=e.toArray(t.entropy,t.entropyEnc||"hex"),r=e.toArray(t.nonce,t.nonceEnc||"hex"),n=e.toArray(t.pers,t.persEnc||"hex");i(h.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(h,r,n)}module.exports=s,s.prototype._init=function(t,e,i){var s=t.concat(e).concat(i);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var h=0;h<this.V.length;h++)this.K[h]=0,this.V[h]=1;this._update(s),this._reseed=1,this.reseedInterval=281474976710656},s.prototype._hmac=function(){return new t.hmac(this.hash,this.K)},s.prototype._update=function(t){var e=this._hmac().update(this.V).update([0]);t&&(e=e.update(t)),this.K=e.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},s.prototype.reseed=function(t,s,h,r){"string"!=typeof s&&(r=h,h=s,s=null),t=e.toArray(t,s),h=e.toArray(h,r),i(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(h||[])),this._reseed=1},s.prototype.generate=function(t,i,s,h){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof i&&(h=s,s=i,i=null),s&&(s=e.toArray(s,h||"hex"),this._update(s));for(var r=[];r.length<t;)this.V=this._hmac().update(this.V).digest(),r=r.concat(this.V);var n=r.slice(0,t);return this._update(s),this._reseed++,e.encode(n,i)};
|
||
},{"hash.js":"U6lo","minimalistic-crypto-utils":"wQrH","minimalistic-assert":"KsX4"}],"FvtJ":[function(require,module,exports) {
|
||
"use strict";var t=require("bn.js"),i=require("../utils"),e=i.assert;function r(t,i){this.ec=t,this.priv=null,this.pub=null,i.priv&&this._importPrivate(i.priv,i.privEnc),i.pub&&this._importPublic(i.pub,i.pubEnc)}module.exports=r,r.fromPublic=function(t,i,e){return i instanceof r?i:new r(t,{pub:i,pubEnc:e})},r.fromPrivate=function(t,i,e){return i instanceof r?i:new r(t,{priv:i,privEnc:e})},r.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},r.prototype.getPublic=function(t,i){return"string"==typeof t&&(i=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),i?this.pub.encode(i,t):this.pub},r.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},r.prototype._importPrivate=function(i,e){this.priv=new t(i,e||16),this.priv=this.priv.umod(this.ec.curve.n)},r.prototype._importPublic=function(t,i){if(t.x||t.y)return"mont"===this.ec.curve.type?e(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||e(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,i)},r.prototype.derive=function(t){return t.validate()||e(t.validate(),"public point not validated"),t.mul(this.priv).getX()},r.prototype.sign=function(t,i,e){return this.ec.sign(t,this,i,e)},r.prototype.verify=function(t,i){return this.ec.verify(t,i,this)},r.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};
|
||
},{"bn.js":"RJrg","../utils":"hLmj"}],"7vm1":[function(require,module,exports) {
|
||
"use strict";var r=require("bn.js"),e=require("../utils"),t=e.assert;function n(e,a){if(e instanceof n)return e;this._importDER(e,a)||(t(e.r&&e.s,"Signature without r or s"),this.r=new r(e.r,16),this.s=new r(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function a(){this.place=0}function i(r,e){var t=r[e.place++];if(!(128&t))return t;var n=15&t;if(0===n||n>4)return!1;for(var a=0,i=0,c=e.place;i<n;i++,c++)a<<=8,a|=r[c],a>>>=0;return!(a<=127)&&(e.place=c,a)}function c(r){for(var e=0,t=r.length-1;!r[e]&&!(128&r[e+1])&&e<t;)e++;return 0===e?r:r.slice(e)}function o(r,e){if(e<128)r.push(e);else{var t=1+(Math.log(e)/Math.LN2>>>3);for(r.push(128|t);--t;)r.push(e>>>(t<<3)&255);r.push(e)}}module.exports=n,n.prototype._importDER=function(t,n){t=e.toArray(t,n);var c=new a;if(48!==t[c.place++])return!1;var o=i(t,c);if(!1===o)return!1;if(o+c.place!==t.length)return!1;if(2!==t[c.place++])return!1;var u=i(t,c);if(!1===u)return!1;var s=t.slice(c.place,u+c.place);if(c.place+=u,2!==t[c.place++])return!1;var l=i(t,c);if(!1===l)return!1;if(t.length!==l+c.place)return!1;var f=t.slice(c.place,l+c.place);if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}if(0===f[0]){if(!(128&f[1]))return!1;f=f.slice(1)}return this.r=new r(s),this.s=new r(f),this.recoveryParam=null,!0},n.prototype.toDER=function(r){var t=this.r.toArray(),n=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&n[0]&&(n=[0].concat(n)),t=c(t),n=c(n);!(n[0]||128&n[1]);)n=n.slice(1);var a=[2];o(a,t.length),(a=a.concat(t)).push(2),o(a,n.length);var i=a.concat(n),u=[48];return o(u,i.length),u=u.concat(i),e.encode(u,r)};
|
||
},{"bn.js":"RJrg","../utils":"hLmj"}],"Tbty":[function(require,module,exports) {
|
||
"use strict";var e=require("bn.js"),r=require("hmac-drbg"),t=require("../utils"),n=require("../curves"),i=require("brorand"),s=t.assert,o=require("./key"),u=require("./signature");function h(e){if(!(this instanceof h))return new h(e);"string"==typeof e&&(s(Object.prototype.hasOwnProperty.call(n,e),"Unknown curve "+e),e=n[e]),e instanceof n.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}module.exports=h,h.prototype.keyPair=function(e){return new o(this,e)},h.prototype.keyFromPrivate=function(e,r){return o.fromPrivate(this,e,r)},h.prototype.keyFromPublic=function(e,r){return o.fromPublic(this,e,r)},h.prototype.genKeyPair=function(t){t||(t={});for(var n=new r({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||i(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),s=this.n.byteLength(),o=this.n.sub(new e(2));;){var u=new e(n.generate(s));if(!(u.cmp(o)>0))return u.iaddn(1),this.keyFromPrivate(u)}},h.prototype._truncateToN=function(e,r){var t=8*e.byteLength()-this.n.bitLength();return t>0&&(e=e.ushrn(t)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e},h.prototype.sign=function(t,n,i,s){"object"==typeof i&&(s=i,i=null),s||(s={}),n=this.keyFromPrivate(n,i),t=this._truncateToN(new e(t,16));for(var o=this.n.byteLength(),h=n.getPrivate().toArray("be",o),c=t.toArray("be",o),a=new r({hash:this.hash,entropy:h,nonce:c,pers:s.pers,persEnc:s.persEnc||"utf8"}),p=this.n.sub(new e(1)),m=0;;m++){var v=s.k?s.k(m):new e(a.generate(this.n.byteLength()));if(!((v=this._truncateToN(v,!0)).cmpn(1)<=0||v.cmp(p)>=0)){var y=this.g.mul(v);if(!y.isInfinity()){var f=y.getX(),g=f.umod(this.n);if(0!==g.cmpn(0)){var d=v.invm(this.n).mul(g.mul(n.getPrivate()).iadd(t));if(0!==(d=d.umod(this.n)).cmpn(0)){var l=(y.getY().isOdd()?1:0)|(0!==f.cmp(g)?2:0);return s.canonical&&d.cmp(this.nh)>0&&(d=this.n.sub(d),l^=1),new u({r:g,s:d,recoveryParam:l})}}}}}},h.prototype.verify=function(r,t,n,i){r=this._truncateToN(new e(r,16)),n=this.keyFromPublic(n,i);var s=(t=new u(t,"hex")).r,o=t.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var h,c=o.invm(this.n),a=c.mul(r).umod(this.n),p=c.mul(s).umod(this.n);return this.curve._maxwellTrick?!(h=this.g.jmulAdd(a,n.getPublic(),p)).isInfinity()&&h.eqXToP(s):!(h=this.g.mulAdd(a,n.getPublic(),p)).isInfinity()&&0===h.getX().umod(this.n).cmp(s)},h.prototype.recoverPubKey=function(r,t,n,i){s((3&n)===n,"The recovery param is more than two bits"),t=new u(t,i);var o=this.n,h=new e(r),c=t.r,a=t.s,p=1&n,m=n>>1;if(c.cmp(this.curve.p.umod(this.curve.n))>=0&&m)throw new Error("Unable to find sencond key candinate");c=m?this.curve.pointFromX(c.add(this.curve.n),p):this.curve.pointFromX(c,p);var v=t.r.invm(o),y=o.sub(h).mul(v).umod(o),f=a.mul(v).umod(o);return this.g.mulAdd(y,c,f)},h.prototype.getKeyRecoveryParam=function(e,r,t,n){if(null!==(r=new u(r,n)).recoveryParam)return r.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(e,r,i)}catch(e){continue}if(s.eq(t))return i}throw new Error("Unable to find valid recovery factor")};
|
||
},{"bn.js":"RJrg","hmac-drbg":"kwdl","../utils":"hLmj","../curves":"6Yey","brorand":"2KRs","./key":"FvtJ","./signature":"7vm1"}],"uUCk":[function(require,module,exports) {
|
||
"use strict";var t=require("../utils"),e=t.assert,s=t.parseBytes,i=t.cachedProperty;function n(t,e){this.eddsa=t,this._secret=s(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=s(e.pub)}n.fromPublic=function(t,e){return e instanceof n?e:new n(t,{pub:e})},n.fromSecret=function(t,e){return e instanceof n?e:new n(t,{secret:e})},n.prototype.secret=function(){return this._secret},i(n,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),i(n,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),i(n,"privBytes",function(){var t=this.eddsa,e=this.hash(),s=t.encodingLength-1,i=e.slice(0,t.encodingLength);return i[0]&=248,i[s]&=127,i[s]|=64,i}),i(n,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),i(n,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),i(n,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),n.prototype.sign=function(t){return e(this._secret,"KeyPair can only verify"),this.eddsa.sign(t,this)},n.prototype.verify=function(t,e){return this.eddsa.verify(t,e,this)},n.prototype.getSecret=function(s){return e(this._secret,"KeyPair is public only"),t.encode(this.secret(),s)},n.prototype.getPublic=function(e){return t.encode(this.pubBytes(),e)},module.exports=n;
|
||
},{"../utils":"hLmj"}],"Fvj4":[function(require,module,exports) {
|
||
"use strict";var e=require("bn.js"),t=require("../utils"),n=t.assert,o=t.cachedProperty,d=t.parseBytes;function i(t,o){this.eddsa=t,"object"!=typeof o&&(o=d(o)),Array.isArray(o)&&(o={R:o.slice(0,t.encodingLength),S:o.slice(t.encodingLength)}),n(o.R&&o.S,"Signature without R or S"),t.isPoint(o.R)&&(this._R=o.R),o.S instanceof e&&(this._S=o.S),this._Rencoded=Array.isArray(o.R)?o.R:o.Rencoded,this._Sencoded=Array.isArray(o.S)?o.S:o.Sencoded}o(i,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),o(i,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),o(i,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),o(i,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),i.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},i.prototype.toHex=function(){return t.encode(this.toBytes(),"hex").toUpperCase()},module.exports=i;
|
||
},{"bn.js":"RJrg","../utils":"hLmj"}],"td2I":[function(require,module,exports) {
|
||
"use strict";var t=require("hash.js"),e=require("../curves"),n=require("../utils"),r=n.assert,i=n.parseBytes,o=require("./key"),s=require("./signature");function u(n){if(r("ed25519"===n,"only tested with ed25519 so far"),!(this instanceof u))return new u(n);n=e[n].curve,this.curve=n,this.g=n.g,this.g.precompute(n.n.bitLength()+1),this.pointClass=n.point().constructor,this.encodingLength=Math.ceil(n.n.bitLength()/8),this.hash=t.sha512}module.exports=u,u.prototype.sign=function(t,e){t=i(t);var n=this.keyFromSecret(e),r=this.hashInt(n.messagePrefix(),t),o=this.g.mul(r),s=this.encodePoint(o),u=this.hashInt(s,n.pubBytes(),t).mul(n.priv()),h=r.add(u).umod(this.curve.n);return this.makeSignature({R:o,S:h,Rencoded:s})},u.prototype.verify=function(t,e,n){t=i(t),e=this.makeSignature(e);var r=this.keyFromPublic(n),o=this.hashInt(e.Rencoded(),r.pubBytes(),t),s=this.g.mul(e.S());return e.R().add(r.pub().mul(o)).eq(s)},u.prototype.hashInt=function(){for(var t=this.hash(),e=0;e<arguments.length;e++)t.update(arguments[e]);return n.intFromLE(t.digest()).umod(this.curve.n)},u.prototype.keyFromPublic=function(t){return o.fromPublic(this,t)},u.prototype.keyFromSecret=function(t){return o.fromSecret(this,t)},u.prototype.makeSignature=function(t){return t instanceof s?t:new s(this,t)},u.prototype.encodePoint=function(t){var e=t.getY().toArray("le",this.encodingLength);return e[this.encodingLength-1]|=t.getX().isOdd()?128:0,e},u.prototype.decodePoint=function(t){var e=(t=n.parseBytes(t)).length-1,r=t.slice(0,e).concat(-129&t[e]),i=0!=(128&t[e]),o=n.intFromLE(r);return this.curve.pointFromY(o,i)},u.prototype.encodeInt=function(t){return t.toArray("le",this.encodingLength)},u.prototype.decodeInt=function(t){return n.intFromLE(t)},u.prototype.isPoint=function(t){return t instanceof this.pointClass};
|
||
},{"hash.js":"U6lo","../curves":"6Yey","../utils":"hLmj","./key":"uUCk","./signature":"Fvj4"}],"0G54":[function(require,module,exports) {
|
||
"use strict";var e=exports;e.version=require("../package.json").version,e.utils=require("./elliptic/utils"),e.rand=require("brorand"),e.curve=require("./elliptic/curve"),e.curves=require("./elliptic/curves"),e.ec=require("./elliptic/ec"),e.eddsa=require("./elliptic/eddsa");
|
||
},{"../package.json":"Y4Tp","./elliptic/utils":"hLmj","brorand":"2KRs","./elliptic/curve":"3fmn","./elliptic/curves":"6Yey","./elliptic/ec":"Tbty","./elliptic/eddsa":"td2I"}],"I+AX":[function(require,module,exports) {
|
||
var r=require("elliptic").ec,e=new r("secp256k1"),n=e.curve,t=n.n.constructor;function u(r,u){var i=new t(u);if(i.cmp(n.p)>=0)return null;var a=(i=i.toRed(n.red)).redSqr().redIMul(i).redIAdd(n.b).redSqrt();return 3===r!==a.isOdd()&&(a=a.redNeg()),e.keyPair({pub:{x:i,y:a}})}function i(r,u,i){var a=new t(u),c=new t(i);if(a.cmp(n.p)>=0||c.cmp(n.p)>=0)return null;if(a=a.toRed(n.red),c=c.toRed(n.red),(6===r||7===r)&&c.isOdd()!==(7===r))return null;var l=a.redSqr().redIMul(a);return c.redSqr().redISub(l.redIAdd(n.b)).isZero()?e.keyPair({pub:{x:a,y:c}}):null}function a(r){var e=r[0];switch(e){case 2:case 3:return 33!==r.length?null:u(e,r.subarray(1,33));case 4:case 6:case 7:return 65!==r.length?null:i(e,r.subarray(1,33),r.subarray(33,65));default:return null}}function c(r,e){for(var n=e.encode(null,33===r.length),t=0;t<r.length;++t)r[t]=n[t]}module.exports={contextRandomize:function(){return 0},privateKeyVerify:function(r){var e=new t(r);return e.cmp(n.n)<0&&!e.isZero()?0:1},privateKeyNegate:function(r){var e=new t(r),u=n.n.sub(e).umod(n.n).toArrayLike(Uint8Array,"be",32);return r.set(u),0},privateKeyTweakAdd:function(r,e){var u=new t(e);if(u.cmp(n.n)>=0)return 1;if(u.iadd(new t(r)),u.cmp(n.n)>=0&&u.isub(n.n),u.isZero())return 1;var i=u.toArrayLike(Uint8Array,"be",32);return r.set(i),0},privateKeyTweakMul:function(r,e){var u=new t(e);if(u.cmp(n.n)>=0||u.isZero())return 1;u.imul(new t(r)),u.cmp(n.n)>=0&&(u=u.umod(n.n));var i=u.toArrayLike(Uint8Array,"be",32);return r.set(i),0},publicKeyVerify:function(r){return null===a(r)?1:0},publicKeyCreate:function(r,u){var i=new t(u);return i.cmp(n.n)>=0||i.isZero()?1:(c(r,e.keyFromPrivate(u).getPublic()),0)},publicKeyConvert:function(r,e){var n=a(e);return null===n?1:(c(r,n.getPublic()),0)},publicKeyNegate:function(r,e){var n=a(e);if(null===n)return 1;var t=n.getPublic();return t.y=t.y.redNeg(),c(r,t),0},publicKeyCombine:function(r,e){for(var n=new Array(e.length),t=0;t<e.length;++t)if(n[t]=a(e[t]),null===n[t])return 1;for(var u=n[0].getPublic(),i=1;i<n.length;++i)u=u.add(n[i].pub);return u.isInfinity()?2:(c(r,u),0)},publicKeyTweakAdd:function(r,e,u){var i=a(e);if(null===i)return 1;if((u=new t(u)).cmp(n.n)>=0)return 2;var l=i.getPublic().add(n.g.mul(u));return l.isInfinity()?2:(c(r,l),0)},publicKeyTweakMul:function(r,e,u){var i=a(e);return null===i?1:(u=new t(u)).cmp(n.n)>=0||u.isZero()?2:(c(r,i.getPublic().mul(u)),0)},signatureNormalize:function(r){var u=new t(r.subarray(0,32)),i=new t(r.subarray(32,64));return u.cmp(n.n)>=0||i.cmp(n.n)>=0?1:(1===i.cmp(e.nh)&&r.set(n.n.sub(i).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport:function(r,e){var u=e.subarray(0,32),i=e.subarray(32,64);if(new t(u).cmp(n.n)>=0)return 1;if(new t(i).cmp(n.n)>=0)return 1;var a=r.output,c=a.subarray(4,37);c[0]=0,c.set(u,1);for(var l=33,o=0;l>1&&0===c[o]&&!(128&c[o+1]);--l,++o);if(128&(c=c.subarray(o))[0])return 1;if(l>1&&0===c[0]&&!(128&c[1]))return 1;var s=a.subarray(39,72);s[0]=0,s.set(i,1);for(var f=33,y=0;f>1&&0===s[y]&&!(128&s[y+1]);--f,++y);return 128&(s=s.subarray(y))[0]?1:f>1&&0===s[0]&&!(128&s[1])?1:(r.outputlen=6+l+f,a[0]=48,a[1]=r.outputlen-2,a[2]=2,a[3]=c.length,a.set(c,4),a[4+l]=2,a[5+l]=s.length,a.set(s,6+l),0)},signatureImport:function(r,e){if(e.length<8)return 1;if(e.length>72)return 1;if(48!==e[0])return 1;if(e[1]!==e.length-2)return 1;if(2!==e[2])return 1;var u=e[3];if(0===u)return 1;if(5+u>=e.length)return 1;if(2!==e[4+u])return 1;var i=e[5+u];if(0===i)return 1;if(6+u+i!==e.length)return 1;if(128&e[4])return 1;if(u>1&&0===e[4]&&!(128&e[5]))return 1;if(128&e[u+6])return 1;if(i>1&&0===e[u+6]&&!(128&e[u+7]))return 1;var a=e.subarray(4,4+u);if(33===a.length&&0===a[0]&&(a=a.subarray(1)),a.length>32)return 1;var c=e.subarray(6+u);if(33===c.length&&0===c[0]&&(c=c.slice(1)),c.length>32)throw new Error("S length is too long");var l=new t(a);l.cmp(n.n)>=0&&(l=new t(0));var o=new t(e.subarray(6+u));return o.cmp(n.n)>=0&&(o=new t(0)),r.set(l.toArrayLike(Uint8Array,"be",32),0),r.set(o.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign:function(r,u,i,a,c){if(c){var l=c;c=function(r){var e=l(u,i,null,a,r);if(!(e instanceof Uint8Array&&32===e.length))throw new Error("This is the way");return new t(e)}}var o,s=new t(i);if(s.cmp(n.n)>=0||s.isZero())return 1;try{o=e.sign(u,i,{canonical:!0,k:c,pers:a})}catch(f){return 1}return r.signature.set(o.r.toArrayLike(Uint8Array,"be",32),0),r.signature.set(o.s.toArrayLike(Uint8Array,"be",32),32),r.recid=o.recoveryParam,0},ecdsaVerify:function(r,u,i){var c={r:r.subarray(0,32),s:r.subarray(32,64)},l=new t(c.r),o=new t(c.s);if(l.cmp(n.n)>=0||o.cmp(n.n)>=0)return 1;if(1===o.cmp(e.nh)||l.isZero()||o.isZero())return 3;var s=a(i);if(null===s)return 2;var f=s.getPublic();return e.verify(u,c,f)?0:3},ecdsaRecover:function(r,u,i,a){var l,o={r:u.slice(0,32),s:u.slice(32,64)},s=new t(o.r),f=new t(o.s);if(s.cmp(n.n)>=0||f.cmp(n.n)>=0)return 1;if(s.isZero()||f.isZero())return 2;try{l=e.recoverPubKey(a,o,i)}catch(y){return 2}return c(r,l),0},ecdh:function(r,u,i,c,l,o,s){var f=a(u);if(null===f)return 1;var y=new t(i);if(y.cmp(n.n)>=0||y.isZero())return 2;var v=f.getPublic().mul(y);if(void 0===l)for(var b=v.encode(null,!0),p=e.hash().update(b).digest(),d=0;d<32;++d)r[d]=p[d];else{o||(o=new Uint8Array(32));for(var g=v.getX().toArray("be",32),w=0;w<32;++w)o[w]=g[w];s||(s=new Uint8Array(32));for(var m=v.getY().toArray("be",32),h=0;h<32;++h)s[h]=m[h];var A=l(o,s,c);if(!(A instanceof Uint8Array&&A.length===r.length))return 2;r.set(A)}return 0}};
|
||
},{"elliptic":"0G54"}],"KY6C":[function(require,module,exports) {
|
||
module.exports=require("./lib")(require("./lib/elliptic"));
|
||
},{"./lib":"7E7N","./lib/elliptic":"I+AX"}],"JTSq":[function(require,module,exports) {
|
||
"use strict";function e(e,r,n,t,i,u,a){try{var c=e[u](a),o=c.value}catch(s){return void n(s)}c.done?r(o):Promise.resolve(o).then(t,i)}function r(r){return function(){var n=this,t=arguments;return new Promise(function(i,u){var a=r.apply(n,t);function c(r){e(a,i,u,c,o,"next",r)}function o(r){e(a,i,u,c,o,"throw",r)}c(void 0)})}}var n=require("secp256k1"),t=require("multihashing-async/src/sha"),i="sha2-256";module.exports=function(e){function u(){return(u=r(regeneratorRuntime.mark(function e(r,u){var a,c;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.digest(u,i);case 2:return a=e.sent,c=n.ecdsaSign(a,r),e.abrupt("return",n.signatureExport(c.signature));case 5:case"end":return e.stop()}},e)}))).apply(this,arguments)}function a(){return(a=r(regeneratorRuntime.mark(function e(r,u,a){var c;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.digest(a,i);case 2:return c=e.sent,u=n.signatureImport(u),e.abrupt("return",n.ecdsaVerify(u,c,r));case 5:case"end":return e.stop()}},e)}))).apply(this,arguments)}function c(e){if(!n.privateKeyVerify(e))throw new Error("Invalid private key")}return{generateKey:function(){var r;do{r=e(32)}while(!n.privateKeyVerify(r));return r},privateKeyLength:32,hashAndSign:function(e,r){return u.apply(this,arguments)},hashAndVerify:function(e,r,n){return a.apply(this,arguments)},compressPublicKey:function(e){if(!n.publicKeyVerify(e))throw new Error("Invalid public key");return n.publicKeyConvert(e,!0)},decompressPublicKey:function(e){return n.publicKeyConvert(e,!1)},validatePrivateKey:c,validatePublicKey:function(e){if(!n.publicKeyVerify(e))throw new Error("Invalid public key")},computePublicKey:function(e){return c(e),n.publicKeyCreate(e)}}};
|
||
},{"secp256k1":"KY6C","multihashing-async/src/sha":"D6DO"}],"BGhW":[function(require,module,exports) {
|
||
"use strict";function e(e,t,r,n,i,u,a){try{var s=e[u](a),c=s.value}catch(o){return void r(o)}s.done?t(c):Promise.resolve(c).then(n,i)}function t(t){return function(){var r=this,n=arguments;return new Promise(function(i,u){var a=t.apply(r,n);function s(t){e(a,i,u,s,c,"next",t)}function c(t){e(a,i,u,s,c,"throw",t)}s(void 0)})}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function i(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}var u=require("multihashing-async/src/sha"),a=require("err-code"),s=require("uint8arrays/equals"),c=require("uint8arrays/to-string"),o=require("./exporter");module.exports=function(e,n,y){y=y||require("./secp256k1")(n);var h=function(){function t(e){r(this,t),y.validatePublicKey(e),this._key=e}return i(t,[{key:"verify",value:function(e,t){return y.hashAndVerify(this._key,t,e)}},{key:"marshal",value:function(){return y.compressPublicKey(this._key)}},{key:"bytes",get:function(){return e.PublicKey.encode({Type:e.KeyType.Secp256k1,Data:this.marshal()}).finish()}},{key:"equals",value:function(e){return s(this.bytes,e.bytes)}},{key:"hash",value:function(){return u.multihashing(this.bytes,"sha2-256")}}]),t}(),l=function(){function n(e,t){r(this,n),this._key=e,this._publicKey=t||y.computePublicKey(e),y.validatePrivateKey(this._key),y.validatePublicKey(this._publicKey)}return i(n,[{key:"sign",value:function(e){return y.hashAndSign(this._key,e)}},{key:"public",get:function(){return new h(this._publicKey)}},{key:"marshal",value:function(){return this._key}},{key:"bytes",get:function(){return e.PrivateKey.encode({Type:e.KeyType.Secp256k1,Data:this.marshal()}).finish()}},{key:"equals",value:function(e){return s(this.bytes,e.bytes)}},{key:"hash",value:function(){return u.multihashing(this.bytes,"sha2-256")}},{key:"id",value:function(){var e=t(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.public.hash();case 2:return t=e.sent,e.abrupt("return",c(t,"base58btc"));case 4:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"export",value:function(){var e=t(regeneratorRuntime.mark(function e(t){var r,n=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("libp2p-key"!==(r=n.length>1&&void 0!==n[1]?n[1]:"libp2p-key")){e.next=5;break}return e.abrupt("return",o.export(this.bytes,t));case 5:throw a(new Error("export format '".concat(r,"' is not supported")),"ERR_INVALID_EXPORT_FORMAT");case 6:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),n}();function p(){return(p=t(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,y.generateKey();case 2:return t=e.sent,e.abrupt("return",new l(t));case 4:case"end":return e.stop()}},e)}))).apply(this,arguments)}return{Secp256k1PublicKey:h,Secp256k1PrivateKey:l,unmarshalSecp256k1PrivateKey:function(e){return new l(e)},unmarshalSecp256k1PublicKey:function(e){return new h(e)},generateKeyPair:function(){return p.apply(this,arguments)}}};
|
||
},{"multihashing-async/src/sha":"D6DO","err-code":"hLMW","uint8arrays/equals":"mZxc","uint8arrays/to-string":"rZEA","./exporter":"S9i/","./secp256k1":"JTSq"}],"+CmW":[function(require,module,exports) {
|
||
"use strict";function e(e,r,t,n,u,a,i){try{var o=e[a](i),c=o.value}catch(s){return void t(s)}o.done?r(c):Promise.resolve(c).then(n,u)}function r(r){return function(){var t=this,n=arguments;return new Promise(function(u,a){var i=r.apply(t,n);function o(r){e(i,u,a,o,c,"next",r)}function c(r){e(i,u,a,o,c,"throw",r)}o(void 0)})}}var t=require("../webcrypto"),n=require("./lengths"),u={SHA1:"SHA-1",SHA256:"SHA-256",SHA512:"SHA-512"},a=function(){var e=r(regeneratorRuntime.mark(function e(r,n){var u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.get().subtle.sign({name:"HMAC"},r,n);case 2:return u=e.sent,e.abrupt("return",new Uint8Array(u,u.byteOffset,u.byteLength));case 4:case"end":return e.stop()}},e)}));return function(r,t){return e.apply(this,arguments)}}();exports.create=function(){var e=r(regeneratorRuntime.mark(function e(i,o){var c,s;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return c=u[i],e.next=3,t.get().subtle.importKey("raw",o,{name:"HMAC",hash:{name:c}},!1,["sign"]);case 3:return s=e.sent,e.abrupt("return",{digest:function(){var e=r(regeneratorRuntime.mark(function e(r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",a(s,r));case 1:case"end":return e.stop()}},e)}));return function(r){return e.apply(this,arguments)}}(),length:n[i]});case 5:case"end":return e.stop()}},e)}));return function(r,t){return e.apply(this,arguments)}}();
|
||
},{"../webcrypto":"AJ6b","./lengths":"TD1Y"}],"kkZt":[function(require,module,exports) {
|
||
"use strict";function e(e,r,n,t,i,c,s){try{var a=e[c](s),u=a.value}catch(o){return void n(o)}a.done?r(u):Promise.resolve(u).then(t,i)}function r(r){return function(){var n=this,t=arguments;return new Promise(function(i,c){var s=r.apply(n,t);function a(r){e(s,i,c,a,u,"next",r)}function u(r){e(s,i,c,a,u,"throw",r)}a(void 0)})}}var n=require("err-code"),t=require("uint8arrays/concat"),i=require("uint8arrays/from-string"),c=require("../hmac"),s={"AES-128":{ivSize:16,keySize:16},"AES-256":{ivSize:16,keySize:32},Blowfish:{ivSize:8,cipherKeySize:32}};module.exports=function(){var e=r(regeneratorRuntime.mark(function e(r,a,u){var o,f,h,p,v,y,k,S,l,x,m,w,d,E,g,z,b;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(o=s[r]){e.next=4;break}throw f=Object.keys(s).join(" / "),n(new Error("unknown cipher type '".concat(r,"'. Must be ").concat(f)),"ERR_INVALID_CIPHER_TYPE");case 4:if(a){e.next=6;break}throw n(new Error("missing hash type"),"ERR_MISSING_HASH_TYPE");case 6:return h=o.keySize,p=o.ivSize,20,v=i("key expansion"),y=2*(p+h+20),e.next=13,c.create(a,u);case 13:return k=e.sent,e.next=16,k.digest(v);case 16:S=e.sent,l=[],x=0;case 19:if(!(x<y)){e.next=32;break}return e.next=22,k.digest(t([S,v]));case 22:return m=e.sent,w=m.length,x+w>y&&(w=y-x),l.push(m),x+=w,e.next=29,k.digest(S);case 29:S=e.sent,e.next=19;break;case 32:return d=y/2,E=t(l),g=E.slice(0,d),z=E.slice(d,y),b=function(e){return{iv:e.slice(0,p),cipherKey:e.slice(p,p+h),macKey:e.slice(p+h)}},e.abrupt("return",{k1:b(g),k2:b(z)});case 38:case"end":return e.stop()}},e)}));return function(r,n,t){return e.apply(this,arguments)}}();
|
||
},{"err-code":"hLMW","uint8arrays/concat":"qYui","uint8arrays/from-string":"Sqgj","../hmac":"+CmW"}],"OeV0":[function(require,module,exports) {
|
||
"use strict";var r=require("err-code");module.exports=function(e,n){if(!e.includes(n)){var o=e.join(" / ");throw r(new Error("Unknown curve: ".concat(n,". Must be ").concat(o)),"ERR_INVALID_CURVE")}};
|
||
},{"err-code":"hLMW"}],"mYhW":[function(require,module,exports) {
|
||
"use strict";function e(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}function r(r){for(var n=1;n<arguments.length;n++){var u=null!=arguments[n]?arguments[n]:{};n%2?e(Object(u),!0).forEach(function(e){t(r,e,u[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(u)):e(Object(u)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(u,e))})}return r}function t(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function n(e,r,t,n,u,a,i){try{var c=e[a](i),o=c.value}catch(s){return void t(s)}c.done?r(o):Promise.resolve(o).then(n,u)}function u(e){return function(){var r=this,t=arguments;return new Promise(function(u,a){var i=e.apply(r,t);function c(e){n(i,u,a,c,o,"next",e)}function o(e){n(i,u,a,c,o,"throw",e)}c(void 0)})}}var a=require("err-code"),i=require("../webcrypto"),c=require("../util"),o=c.base64urlToBuffer,s=require("./validate-curve-type"),f=require("uint8arrays/to-string"),p=require("uint8arrays/concat"),y=require("uint8arrays/equals"),b={"P-256":256,"P-384":384,"P-521":521};exports.generateEphmeralKeyPair=function(){var e=u(regeneratorRuntime.mark(function e(r){var t,n,a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return s(Object.keys(b),r),e.next=3,i.get().subtle.generateKey({name:"ECDH",namedCurve:r},!0,["deriveBits"]);case 3:return t=e.sent,n=function(){var e=u(regeneratorRuntime.mark(function e(n,u){var a,c,o;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!u){e.next=6;break}return e.next=3,i.get().subtle.importKey("jwk",g(r,u),{name:"ECDH",namedCurve:r},!1,["deriveBits"]);case 3:a=e.sent,e.next=7;break;case 6:a=t.privateKey;case 7:return e.next=9,i.get().subtle.importKey("jwk",m(r,n),{name:"ECDH",namedCurve:r},!1,[]);case 9:return e.t0=e.sent,e.t1=a,c=[e.t0,e.t1],e.next=14,i.get().subtle.deriveBits({name:"ECDH",namedCurve:r,public:c[0]},c[1],b[r]);case 14:return o=e.sent,e.abrupt("return",new Uint8Array(o,o.byteOffset,o.byteLength));case 16:case"end":return e.stop()}},e)}));return function(r,t){return e.apply(this,arguments)}}(),e.next=7,i.get().subtle.exportKey("jwk",t.publicKey);case 7:return a=e.sent,e.abrupt("return",{key:v(a),genSharedKey:n});case 9:case"end":return e.stop()}},e)}));return function(r){return e.apply(this,arguments)}}();var l={"P-256":32,"P-384":48,"P-521":66};function v(e){var r=l[e.crv];return p([Uint8Array.from([4]),o(e.x,r),o(e.y,r)],1+2*r)}function m(e,r){var t=l[e];if(y(!r.slice(0,1),Uint8Array.from([4])))throw a(new Error("Cannot unmarshal public key - invalid key format"),"ERR_INVALID_KEY_FORMAT");return{kty:"EC",crv:e,x:f(r.slice(1,t+1),"base64url"),y:f(r.slice(1+t),"base64url"),ext:!0}}var g=function(e,t){return r(r({},m(e,t.public)),{},{d:f(t.private,"base64url")})};
|
||
},{"err-code":"hLMW","../webcrypto":"AJ6b","../util":"6O9N","./validate-curve-type":"OeV0","uint8arrays/to-string":"rZEA","uint8arrays/concat":"qYui","uint8arrays/equals":"mZxc"}],"MB6U":[function(require,module,exports) {
|
||
"use strict";function r(r,e,n,t,u,o,i){try{var a=r[o](i),c=a.value}catch(s){return void n(s)}a.done?e(c):Promise.resolve(c).then(t,u)}function e(e){return function(){var n=this,t=arguments;return new Promise(function(u,o){var i=e.apply(n,t);function a(e){r(i,u,o,a,c,"next",e)}function c(e){r(i,u,o,a,c,"throw",e)}a(void 0)})}}var n=require("./ecdh");module.exports=function(){var r=e(regeneratorRuntime.mark(function r(e){return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",n.generateEphmeralKeyPair(e));case 1:case"end":return r.stop()}},r)}));return function(e){return r.apply(this,arguments)}}();
|
||
},{"./ecdh":"mYhW"}],"hv/4":[function(require,module,exports) {
|
||
"use strict";function e(e,r,t,n,a,u,s){try{var i=e[u](s),o=i.value}catch(c){return void t(c)}i.done?r(o):Promise.resolve(o).then(n,a)}function r(r){return function(){var t=this,n=arguments;return new Promise(function(a,u){var s=r.apply(t,n);function i(r){e(s,a,u,i,o,"next",r)}function o(r){e(s,a,u,i,o,"throw",r)}i(void 0)})}}var t=require("./keys");require("node-forge/lib/asn1"),require("node-forge/lib/pbe");var n=require("node-forge/lib/forge"),a=require("err-code"),u=require("uint8arrays/from-string"),s=require("./importer"),i={rsa:require("./rsa-class"),ed25519:require("./ed25519-class"),secp256k1:require("./secp256k1-class")(t,require("../random-bytes"))},o={message:"secp256k1 support requires libp2p-crypto-secp256k1 package",code:"ERR_MISSING_PACKAGE"};function c(e){var r=i[e.toLowerCase()];if(!r){var t=Object.keys(i).join(" / ");throw a(new Error("invalid or unsupported key type ".concat(e,". Must be ").concat(t)),"ERR_UNSUPPORTED_KEY_TYPE")}return r}var p=function(){var e=r(regeneratorRuntime.mark(function e(r,t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",c(r).generateKeyPair(t));case 1:case"end":return e.stop()}},e)}));return function(r,t){return e.apply(this,arguments)}}(),y=function(){var e=r(regeneratorRuntime.mark(function e(r,t,n){var u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(u=c(r),"ed25519"===r.toLowerCase()){e.next=3;break}throw a(new Error("Seed key derivation is unimplemented for RSA or secp256k1"),"ERR_UNSUPPORTED_KEY_DERIVATION_TYPE");case 3:return e.abrupt("return",u.generateKeyPairFromSeed(t,n));case 4:case"end":return e.stop()}},e)}));return function(r,t,n){return e.apply(this,arguments)}}(),l=function(e){var r=t.PublicKey.decode(e),n=r.Data;switch(r.Type){case t.KeyType.RSA:return i.rsa.unmarshalRsaPublicKey(n);case t.KeyType.Ed25519:return i.ed25519.unmarshalEd25519PublicKey(n);case t.KeyType.Secp256k1:if(i.secp256k1)return i.secp256k1.unmarshalSecp256k1PublicKey(n);throw a(new Error(o.message),o.code);default:c(r.Type)}},f=function(e,r){return c(r=(r||"rsa").toLowerCase()),e.bytes},d=function(){var e=r(regeneratorRuntime.mark(function e(r){var n,u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=t.PrivateKey.decode(r),u=n.Data,e.t0=n.Type,e.next=e.t0===t.KeyType.RSA?5:e.t0===t.KeyType.Ed25519?6:e.t0===t.KeyType.Secp256k1?7:12;break;case 5:return e.abrupt("return",i.rsa.unmarshalRsaPrivateKey(u));case 6:return e.abrupt("return",i.ed25519.unmarshalEd25519PrivateKey(u));case 7:if(!i.secp256k1){e.next=11;break}return e.abrupt("return",i.secp256k1.unmarshalSecp256k1PrivateKey(u));case 11:throw a(new Error(o.message),o.code);case 12:c(n.Type);case 13:case"end":return e.stop()}},e)}));return function(r){return e.apply(this,arguments)}}(),m=function(e,r){return c(r=(r||"rsa").toLowerCase()),e.bytes},v=function(){var e=r(regeneratorRuntime.mark(function e(r,t){var o,c,p;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,s.import(r,t);case 3:return o=e.sent,e.abrupt("return",d(o));case 7:e.prev=7,e.t0=e.catch(0);case 9:if(null!==(c=n.pki.decryptRsaPrivateKey(r,t))){e.next=12;break}throw a(new Error("Cannot read the key, most likely the password is wrong or not a RSA key"),"ERR_CANNOT_DECRYPT_PEM");case 12:return p=n.asn1.toDer(n.pki.privateKeyToAsn1(c)),p=u(p.getBytes(),"ascii"),e.abrupt("return",i.rsa.unmarshalRsaPrivateKey(p));case 15:case"end":return e.stop()}},e,null,[[0,7]])}));return function(r,t){return e.apply(this,arguments)}}();module.exports={supportedKeys:i,keysPBM:t,keyStretcher:require("./key-stretcher"),generateEphemeralKeyPair:require("./ephemeral-keys"),generateKeyPair:p,generateKeyPairFromSeed:y,unmarshalPublicKey:l,marshalPublicKey:f,unmarshalPrivateKey:d,marshalPrivateKey:m,import:v};
|
||
},{"./keys":"6R3o","node-forge/lib/asn1":"a/tu","node-forge/lib/pbe":"oB5+","node-forge/lib/forge":"sQ2N","err-code":"hLMW","uint8arrays/from-string":"Sqgj","./importer":"GO2o","./rsa-class":"k8Et","./ed25519-class":"FdMy","./secp256k1-class":"BGhW","../random-bytes":"rthE","./key-stretcher":"kkZt","./ephemeral-keys":"MB6U"}],"JVGk":[function(require,module,exports) {
|
||
"use strict";var e=require("protobufjs/minimal"),r=e.Reader,t=e.Writer,i=e.util,y=e.roots.default||(e.roots.default={});y.PeerIdProto=function(){function n(e){if(e)for(var r=Object.keys(e),t=0;t<r.length;++t)null!=e[r[t]]&&(this[r[t]]=e[r[t]])}return n.prototype.id=i.newBuffer([]),n.prototype.pubKey=i.newBuffer([]),n.prototype.privKey=i.newBuffer([]),n.encode=function(e,r){return r||(r=t.create()),r.uint32(10).bytes(e.id),null!=e.pubKey&&Object.hasOwnProperty.call(e,"pubKey")&&r.uint32(18).bytes(e.pubKey),null!=e.privKey&&Object.hasOwnProperty.call(e,"privKey")&&r.uint32(26).bytes(e.privKey),r},n.decode=function(e,t){e instanceof r||(e=r.create(e));for(var n=void 0===t?e.len:e.pos+t,p=new y.PeerIdProto;e.pos<n;){var o=e.uint32();switch(o>>>3){case 1:p.id=e.bytes();break;case 2:p.pubKey=e.bytes();break;case 3:p.privKey=e.bytes();break;default:e.skipType(7&o)}}if(!p.hasOwnProperty("id"))throw i.ProtocolError("missing required 'id'",{instance:p});return p},n.fromObject=function(e){if(e instanceof y.PeerIdProto)return e;var r=new y.PeerIdProto;return null!=e.id&&("string"==typeof e.id?i.base64.decode(e.id,r.id=i.newBuffer(i.base64.length(e.id)),0):e.id.length&&(r.id=e.id)),null!=e.pubKey&&("string"==typeof e.pubKey?i.base64.decode(e.pubKey,r.pubKey=i.newBuffer(i.base64.length(e.pubKey)),0):e.pubKey.length&&(r.pubKey=e.pubKey)),null!=e.privKey&&("string"==typeof e.privKey?i.base64.decode(e.privKey,r.privKey=i.newBuffer(i.base64.length(e.privKey)),0):e.privKey.length&&(r.privKey=e.privKey)),r},n.toObject=function(e,r){r||(r={});var t={};return r.defaults&&(r.bytes===String?t.id="":(t.id=[],r.bytes!==Array&&(t.id=i.newBuffer(t.id))),r.bytes===String?t.pubKey="":(t.pubKey=[],r.bytes!==Array&&(t.pubKey=i.newBuffer(t.pubKey))),r.bytes===String?t.privKey="":(t.privKey=[],r.bytes!==Array&&(t.privKey=i.newBuffer(t.privKey)))),null!=e.id&&e.hasOwnProperty("id")&&(t.id=r.bytes===String?i.base64.encode(e.id,0,e.id.length):r.bytes===Array?Array.prototype.slice.call(e.id):e.id),null!=e.pubKey&&e.hasOwnProperty("pubKey")&&(t.pubKey=r.bytes===String?i.base64.encode(e.pubKey,0,e.pubKey.length):r.bytes===Array?Array.prototype.slice.call(e.pubKey):e.pubKey),null!=e.privKey&&e.hasOwnProperty("privKey")&&(t.privKey=r.bytes===String?i.base64.encode(e.privKey,0,e.privKey.length):r.bytes===Array?Array.prototype.slice.call(e.privKey):e.privKey),t},n.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},n}(),module.exports=y;
|
||
},{"protobufjs/minimal":"/0Lv"}],"xW92":[function(require,module,exports) {
|
||
"use strict";function e(r){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(r)}function r(e,r,t,n,i,a,u){try{var s=e[a](u),o=s.value}catch(c){return void t(c)}s.done?r(o):Promise.resolve(o).then(n,i)}function t(e){return function(){var t=this,n=arguments;return new Promise(function(i,a){var u=e.apply(t,n);function s(e){r(u,i,a,s,o,"next",e)}function o(e){r(u,i,a,s,o,"throw",e)}s(void 0)})}}function n(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function i(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function a(e,r,t){return r&&i(e.prototype,r),t&&i(e,t),e}var u=require("multihashes"),s=require("cids"),o=require("libp2p-crypto/src/keys"),c=require("class-is"),p=require("./proto"),y=p.PeerIdProto,f=require("uint8arrays/equals"),l=require("uint8arrays/from-string"),b=require("uint8arrays/to-string"),h=function(){function e(r,t,i){if(n(this,e),!(r instanceof Uint8Array))throw new Error("invalid id provided");if(t&&i&&!f(t.public.bytes,i.bytes))throw new Error("inconsistent arguments");this._id=r,this._idB58String=u.toB58String(this.id),this._privKey=t,this._pubKey=i}return a(e,[{key:"id",get:function(){return this._id},set:function(e){throw new Error("Id is immutable")}},{key:"privKey",get:function(){return this._privKey},set:function(e){this._privKey=e}},{key:"pubKey",get:function(){if(this._pubKey)return this._pubKey;if(this._privKey)return this._privKey.public;try{var e=u.decode(this.id);"identity"===e.name&&(this._pubKey=o.unmarshalPublicKey(e.digest))}catch(r){}return this._pubKey},set:function(e){this._pubKey=e}},{key:"marshalPubKey",value:function(){if(this.pubKey)return o.marshalPublicKey(this.pubKey)}},{key:"marshalPrivKey",value:function(){if(this.privKey)return o.marshalPrivateKey(this.privKey)}},{key:"marshal",value:function(e){return y.encode({id:this.toBytes(),pubKey:this.marshalPubKey(),privKey:e?null:this.marshalPrivKey()}).finish()}},{key:"toPrint",value:function(){var e=this.toB58String();e.startsWith("Qm")&&(e=e.slice(2));var r=6;return e.length<r&&(r=e.length),"<peer.ID "+e.substr(0,r)+">"}},{key:"toJSON",value:function(){return{id:this.toB58String(),privKey:k(this.marshalPrivKey()),pubKey:k(this.marshalPubKey())}}},{key:"toHexString",value:function(){return u.toHexString(this.id)}},{key:"toBytes",value:function(){return this.id}},{key:"toB58String",value:function(){return this._idB58String}},{key:"toString",value:function(){if(!this._idCIDString){var e=new s(1,"libp2p-key",this.id,"base32");Object.defineProperty(this,"_idCIDString",{value:e.toBaseEncodedString("base32"),enumerable:!1})}return this._idCIDString}},{key:"equals",value:function(e){if(e instanceof Uint8Array)return f(this.id,e);if(e.id)return f(this.id,e.id);throw new Error("not valid Id")}},{key:"isEqual",value:function(e){return this.equals(e)}},{key:"isValid",value:function(){return Boolean(this.privKey&&this.privKey.public&&this.privKey.public.bytes&&this.pubKey.bytes instanceof Uint8Array&&f(this.privKey.public.bytes,this.pubKey.bytes))}},{key:"hasInlinePublicKey",value:function(){try{if("identity"===u.decode(this.id).name)return!0}catch(e){}return!1}}]),e}(),d=c(h,{className:"PeerId",symbolName:"@libp2p/js-peer-id/PeerId"});exports=module.exports=d;var v=function(e){return e.bytes.length<=42?u.encode(e.bytes,"identity"):e.hash()},m=function(){var e=t(regeneratorRuntime.mark(function e(r,t){var n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,v(t);case 2:return n=e.sent,e.abrupt("return",new d(n,r,t));case 4:case"end":return e.stop()}},e)}));return function(r,t){return e.apply(this,arguments)}}();exports.create=function(){var e=t(regeneratorRuntime.mark(function e(r){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return(r=r||{}).bits=r.bits||2048,r.keyType=r.keyType||"RSA",e.next=5,o.generateKeyPair(r.keyType,r.bits);case 5:return t=e.sent,e.abrupt("return",m(t,t.public));case 7:case"end":return e.stop()}},e)}));return function(r){return e.apply(this,arguments)}}(),exports.createFromHexString=function(e){return new d(u.fromHexString(e))},exports.createFromBytes=function(e){return new d(e)},exports.createFromB58String=function(e){return exports.createFromCID(e)};var x=function(e){return"libp2p-key"===e.codec||"dag-pb"===e.codec};function k(e){if(e)return b(e,"base64pad")}exports.createFromCID=function(e){if(e=s.isCID(e)?e:new s(e),!x(e))throw new Error("Supplied PeerID CID has invalid multicodec: "+e.codec);return new d(e.multihash)},exports.createFromPubKey=function(){var e=t(regeneratorRuntime.mark(function e(r){var t,n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("string"==typeof(t=r)&&(t=l(r,"base64pad")),t instanceof Uint8Array){e.next=4;break}throw new Error("Supplied key is neither a base64 string nor a Uint8Array");case 4:return e.next=6,o.unmarshalPublicKey(t);case 6:return n=e.sent,e.abrupt("return",m(null,n));case 8:case"end":return e.stop()}},e)}));return function(r){return e.apply(this,arguments)}}(),exports.createFromPrivKey=function(){var e=t(regeneratorRuntime.mark(function e(r){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("string"==typeof r&&(r=l(r,"base64pad")),r instanceof Uint8Array){e.next=3;break}throw new Error("Supplied key is neither a base64 string nor a Uint8Array");case 3:return e.next=5,o.unmarshalPrivateKey(r);case 5:return t=e.sent,e.abrupt("return",m(t,t.public));case 7:case"end":return e.stop()}},e)}));return function(r){return e.apply(this,arguments)}}(),exports.createFromJSON=function(){var e=t(regeneratorRuntime.mark(function e(r){var t,n,i,a,s,c,p;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=u.fromB58String(r.id),n=r.privKey&&l(r.privKey,"base64pad"),i=r.pubKey&&l(r.pubKey,"base64pad"),e.t0=i,!e.t0){e.next=8;break}return e.next=7,o.unmarshalPublicKey(i);case 7:e.t0=e.sent;case 8:if(a=e.t0,n){e.next=11;break}return e.abrupt("return",new d(t,null,a));case 11:return e.next=13,o.unmarshalPrivateKey(n);case 13:return s=e.sent,e.next=16,v(s.public);case 16:if(c=e.sent,!a){e.next=21;break}return e.next=20,v(a);case 20:p=e.sent;case 21:if(!a||f(c,p)){e.next=23;break}throw new Error("Public and private key do not match");case 23:if(!t||f(c,t)){e.next=25;break}throw new Error("Id and private key do not match");case 25:return e.abrupt("return",new d(t,s,a));case 26:case"end":return e.stop()}},e)}));return function(r){return e.apply(this,arguments)}}(),exports.createFromProtobuf=function(){var e=t(regeneratorRuntime.mark(function e(r){var t,n,i,a,u,s;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("string"==typeof r&&(r=l(r,"base16")),t=y.decode(r),n=t.id,i=t.privKey,a=t.pubKey,!i){e.next=8;break}return e.next=5,o.unmarshalPrivateKey(i);case 5:e.t0=e.sent,e.next=9;break;case 8:e.t0=!1;case 9:if(i=e.t0,!a){e.next=16;break}return e.next=13,o.unmarshalPublicKey(a);case 13:e.t1=e.sent,e.next=17;break;case 16:e.t1=!1;case 17:if(a=e.t1,!i){e.next=22;break}return e.next=21,v(i.public);case 21:s=e.sent;case 22:if(!a){e.next=26;break}return e.next=25,v(a);case 25:u=e.sent;case 26:if(!i){e.next=31;break}if(!a){e.next=30;break}if(f(s,u)){e.next=30;break}throw new Error("Public and private key do not match");case 30:return e.abrupt("return",new d(s,i,i.public));case 31:if(!a){e.next=33;break}return e.abrupt("return",new d(u,null,a));case 33:if(!n){e.next=35;break}return e.abrupt("return",new d(n));case 35:throw new Error("Protobuf did not contain any usable key material");case 36:case"end":return e.stop()}},e)}));return function(r){return e.apply(this,arguments)}}(),exports.isPeerId=function(r){return Boolean("object"===e(r)&&r._id&&r._idB58String)};
|
||
},{"multihashes":"gjv/","cids":"gAYb","libp2p-crypto/src/keys":"hv/4","class-is":"/PSU","./proto":"JVGk","uint8arrays/equals":"mZxc","uint8arrays/from-string":"Sqgj","uint8arrays/to-string":"rZEA"}],"RADA":[function(require,module,exports) {
|
||
"use strict";function e(e,r,t,n,u,a,i){try{var o=e[a](i),c=o.value}catch(s){return void t(s)}o.done?r(c):Promise.resolve(c).then(n,u)}function r(r){return function(){var t=this,n=arguments;return new Promise(function(u,a){var i=r.apply(t,n);function o(r){e(i,u,a,o,c,"next",r)}function c(r){e(i,u,a,o,c,"throw",r)}o(void 0)})}}var t=require("../webcrypto"),n=require("./lengths"),u={SHA1:"SHA-1",SHA256:"SHA-256",SHA512:"SHA-512"},a=function(){var e=r(regeneratorRuntime.mark(function e(r,n){var u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.get().subtle.sign({name:"HMAC"},r,n);case 2:return u=e.sent,e.abrupt("return",new Uint8Array(u,u.byteOffset,u.byteLength));case 4:case"end":return e.stop()}},e)}));return function(r,t){return e.apply(this,arguments)}}();exports.create=function(){var e=r(regeneratorRuntime.mark(function e(i,o){var c,s;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return c=u[i],e.next=3,t.get().subtle.importKey("raw",o,{name:"HMAC",hash:{name:c}},!1,["sign"]);case 3:return s=e.sent,e.abrupt("return",{digest:function(){var e=r(regeneratorRuntime.mark(function e(r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",a(s,r));case 1:case"end":return e.stop()}},e)}));return function(r){return e.apply(this,arguments)}}(),length:n[i]});case 5:case"end":return e.stop()}},e)}));return function(r,t){return e.apply(this,arguments)}}();
|
||
},{"../webcrypto":"AJ6b","./lengths":"TD1Y"}],"2FVR":[function(require,module,exports) {
|
||
var process = require("process");
|
||
var global = arguments[3];
|
||
var Buffer = require("buffer").Buffer;
|
||
var t=require("process"),e=arguments[3],r=require("buffer").Buffer;function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=require("./forge"),a=require("./baseN"),o=module.exports=i.util=i.util||{};function s(t){if(8!==t&&16!==t&&24!==t&&32!==t)throw new Error("Only 8, 16, 24, or 32 bits supported: "+t)}function u(t){if(this.data="",this.read=0,"string"==typeof t)this.data=t;else if(o.isArrayBuffer(t)||o.isArrayBufferView(t))if(void 0!==r&&t instanceof r)this.data=t.toString("binary");else{var e=new Uint8Array(t);try{this.data=String.fromCharCode.apply(null,e)}catch(a){for(var i=0;i<e.length;++i)this.putByte(e[i])}}else(t instanceof u||"object"===n(t)&&"string"==typeof t.data&&"number"==typeof t.read)&&(this.data=t.data,this.read=t.read);this._constructedStringLength=0}!function(){if(void 0!==t&&t.nextTick,"function"==typeof setImmediate)return o.setImmediate=function(){return setImmediate.apply(void 0,arguments)},void(o.nextTick=function(t){return setImmediate(t)});if(o.setImmediate=function(t){setTimeout(t,0)},"undefined"!=typeof window&&"function"==typeof window.postMessage){var e="forge.setImmediate",r=[];o.setImmediate=function(t){r.push(t),1===r.length&&window.postMessage(e,"*")},window.addEventListener("message",function(t){if(t.source===window&&t.data===e){t.stopPropagation();var n=r.slice();r.length=0,n.forEach(function(t){t()})}},!0)}if("undefined"!=typeof MutationObserver){var n=Date.now(),i=!0,a=document.createElement("div");r=[];new MutationObserver(function(){var t=r.slice();r.length=0,t.forEach(function(t){t()})}).observe(a,{attributes:!0});var s=o.setImmediate;o.setImmediate=function(t){Date.now()-n>15?(n=Date.now(),s(t)):(r.push(t),1===r.length&&a.setAttribute("a",i=!i))}}o.nextTick=o.setImmediate}(),o.isNodejs=void 0!==t&&t.versions&&t.versions.node,o.globalScope=o.isNodejs?e:"undefined"==typeof self?window:self,o.isArray=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},o.isArrayBuffer=function(t){return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer},o.isArrayBufferView=function(t){return t&&o.isArrayBuffer(t.buffer)&&void 0!==t.byteLength},o.ByteBuffer=u,o.ByteStringBuffer=u;var f=4096;function h(t,e){e=e||{},this.read=e.readOffset||0,this.growSize=e.growSize||1024;var r=o.isArrayBuffer(t),n=o.isArrayBufferView(t);if(r||n)return this.data=r?new DataView(t):new DataView(t.buffer,t.byteOffset,t.byteLength),void(this.write="writeOffset"in e?e.writeOffset:this.data.byteLength);this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!=t&&this.putBytes(t),"writeOffset"in e&&(this.write=e.writeOffset)}o.ByteStringBuffer.prototype._optimizeConstructedString=function(t){this._constructedStringLength+=t,this._constructedStringLength>f&&(this.data.substr(0,1),this._constructedStringLength=0)},o.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},o.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},o.ByteStringBuffer.prototype.putByte=function(t){return this.putBytes(String.fromCharCode(t))},o.ByteStringBuffer.prototype.fillWithByte=function(t,e){t=String.fromCharCode(t);for(var r=this.data;e>0;)1&e&&(r+=t),(e>>>=1)>0&&(t+=t);return this.data=r,this._optimizeConstructedString(e),this},o.ByteStringBuffer.prototype.putBytes=function(t){return this.data+=t,this._optimizeConstructedString(t.length),this},o.ByteStringBuffer.prototype.putString=function(t){return this.putBytes(o.encodeUtf8(t))},o.ByteStringBuffer.prototype.putInt16=function(t){return this.putBytes(String.fromCharCode(t>>8&255)+String.fromCharCode(255&t))},o.ByteStringBuffer.prototype.putInt24=function(t){return this.putBytes(String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(255&t))},o.ByteStringBuffer.prototype.putInt32=function(t){return this.putBytes(String.fromCharCode(t>>24&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(255&t))},o.ByteStringBuffer.prototype.putInt16Le=function(t){return this.putBytes(String.fromCharCode(255&t)+String.fromCharCode(t>>8&255))},o.ByteStringBuffer.prototype.putInt24Le=function(t){return this.putBytes(String.fromCharCode(255&t)+String.fromCharCode(t>>8&255)+String.fromCharCode(t>>16&255))},o.ByteStringBuffer.prototype.putInt32Le=function(t){return this.putBytes(String.fromCharCode(255&t)+String.fromCharCode(t>>8&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>24&255))},o.ByteStringBuffer.prototype.putInt=function(t,e){s(e);var r="";do{e-=8,r+=String.fromCharCode(t>>e&255)}while(e>0);return this.putBytes(r)},o.ByteStringBuffer.prototype.putSignedInt=function(t,e){return t<0&&(t+=2<<e-1),this.putInt(t,e)},o.ByteStringBuffer.prototype.putBuffer=function(t){return this.putBytes(t.getBytes())},o.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},o.ByteStringBuffer.prototype.getInt16=function(){var t=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,t},o.ByteStringBuffer.prototype.getInt24=function(){var t=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,t},o.ByteStringBuffer.prototype.getInt32=function(){var t=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,t},o.ByteStringBuffer.prototype.getInt16Le=function(){var t=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,t},o.ByteStringBuffer.prototype.getInt24Le=function(){var t=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,t},o.ByteStringBuffer.prototype.getInt32Le=function(){var t=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,t},o.ByteStringBuffer.prototype.getInt=function(t){s(t);var e=0;do{e=(e<<8)+this.data.charCodeAt(this.read++),t-=8}while(t>0);return e},o.ByteStringBuffer.prototype.getSignedInt=function(t){var e=this.getInt(t),r=2<<t-2;return e>=r&&(e-=r<<1),e},o.ByteStringBuffer.prototype.getBytes=function(t){var e;return t?(t=Math.min(this.length(),t),e=this.data.slice(this.read,this.read+t),this.read+=t):0===t?e="":(e=0===this.read?this.data:this.data.slice(this.read),this.clear()),e},o.ByteStringBuffer.prototype.bytes=function(t){return void 0===t?this.data.slice(this.read):this.data.slice(this.read,this.read+t)},o.ByteStringBuffer.prototype.at=function(t){return this.data.charCodeAt(this.read+t)},o.ByteStringBuffer.prototype.setAt=function(t,e){return this.data=this.data.substr(0,this.read+t)+String.fromCharCode(e)+this.data.substr(this.read+t+1),this},o.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},o.ByteStringBuffer.prototype.copy=function(){var t=o.createBuffer(this.data);return t.read=this.read,t},o.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},o.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},o.ByteStringBuffer.prototype.truncate=function(t){var e=Math.max(0,this.length()-t);return this.data=this.data.substr(this.read,e),this.read=0,this},o.ByteStringBuffer.prototype.toHex=function(){for(var t="",e=this.read;e<this.data.length;++e){var r=this.data.charCodeAt(e);r<16&&(t+="0"),t+=r.toString(16)}return t},o.ByteStringBuffer.prototype.toString=function(){return o.decodeUtf8(this.bytes())},o.DataBuffer=h,o.DataBuffer.prototype.length=function(){return this.write-this.read},o.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},o.DataBuffer.prototype.accommodate=function(t,e){if(this.length()>=t)return this;e=Math.max(e||this.growSize,t);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+e);return n.set(r),this.data=new DataView(n.buffer),this},o.DataBuffer.prototype.putByte=function(t){return this.accommodate(1),this.data.setUint8(this.write++,t),this},o.DataBuffer.prototype.fillWithByte=function(t,e){this.accommodate(e);for(var r=0;r<e;++r)this.data.setUint8(t);return this},o.DataBuffer.prototype.putBytes=function(t,e){if(o.isArrayBufferView(t)){var r=(i=new Uint8Array(t.buffer,t.byteOffset,t.byteLength)).byteLength-i.byteOffset;return this.accommodate(r),new Uint8Array(this.data.buffer,this.write).set(i),this.write+=r,this}if(o.isArrayBuffer(t)){var i=new Uint8Array(t);return this.accommodate(i.byteLength),new Uint8Array(this.data.buffer).set(i,this.write),this.write+=i.byteLength,this}if(t instanceof o.DataBuffer||"object"===n(t)&&"number"==typeof t.read&&"number"==typeof t.write&&o.isArrayBufferView(t.data)){i=new Uint8Array(t.data.byteLength,t.read,t.length());return this.accommodate(i.byteLength),new Uint8Array(t.data.byteLength,this.write).set(i),this.write+=i.byteLength,this}if(t instanceof o.ByteStringBuffer&&(t=t.data,e="binary"),e=e||"binary","string"==typeof t){var a;if("hex"===e)return this.accommodate(Math.ceil(t.length/2)),a=new Uint8Array(this.data.buffer,this.write),this.write+=o.binary.hex.decode(t,a,this.write),this;if("base64"===e)return this.accommodate(3*Math.ceil(t.length/4)),a=new Uint8Array(this.data.buffer,this.write),this.write+=o.binary.base64.decode(t,a,this.write),this;if("utf8"===e&&(t=o.encodeUtf8(t),e="binary"),"binary"===e||"raw"===e)return this.accommodate(t.length),a=new Uint8Array(this.data.buffer,this.write),this.write+=o.binary.raw.decode(a),this;if("utf16"===e)return this.accommodate(2*t.length),a=new Uint16Array(this.data.buffer,this.write),this.write+=o.text.utf16.encode(a),this;throw new Error("Invalid encoding: "+e)}throw Error("Invalid parameter: "+t)},o.DataBuffer.prototype.putBuffer=function(t){return this.putBytes(t),t.clear(),this},o.DataBuffer.prototype.putString=function(t){return this.putBytes(t,"utf16")},o.DataBuffer.prototype.putInt16=function(t){return this.accommodate(2),this.data.setInt16(this.write,t),this.write+=2,this},o.DataBuffer.prototype.putInt24=function(t){return this.accommodate(3),this.data.setInt16(this.write,t>>8&65535),this.data.setInt8(this.write,t>>16&255),this.write+=3,this},o.DataBuffer.prototype.putInt32=function(t){return this.accommodate(4),this.data.setInt32(this.write,t),this.write+=4,this},o.DataBuffer.prototype.putInt16Le=function(t){return this.accommodate(2),this.data.setInt16(this.write,t,!0),this.write+=2,this},o.DataBuffer.prototype.putInt24Le=function(t){return this.accommodate(3),this.data.setInt8(this.write,t>>16&255),this.data.setInt16(this.write,t>>8&65535,!0),this.write+=3,this},o.DataBuffer.prototype.putInt32Le=function(t){return this.accommodate(4),this.data.setInt32(this.write,t,!0),this.write+=4,this},o.DataBuffer.prototype.putInt=function(t,e){s(e),this.accommodate(e/8);do{e-=8,this.data.setInt8(this.write++,t>>e&255)}while(e>0);return this},o.DataBuffer.prototype.putSignedInt=function(t,e){return s(e),this.accommodate(e/8),t<0&&(t+=2<<e-1),this.putInt(t,e)},o.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},o.DataBuffer.prototype.getInt16=function(){var t=this.data.getInt16(this.read);return this.read+=2,t},o.DataBuffer.prototype.getInt24=function(){var t=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,t},o.DataBuffer.prototype.getInt32=function(){var t=this.data.getInt32(this.read);return this.read+=4,t},o.DataBuffer.prototype.getInt16Le=function(){var t=this.data.getInt16(this.read,!0);return this.read+=2,t},o.DataBuffer.prototype.getInt24Le=function(){var t=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,t},o.DataBuffer.prototype.getInt32Le=function(){var t=this.data.getInt32(this.read,!0);return this.read+=4,t},o.DataBuffer.prototype.getInt=function(t){s(t);var e=0;do{e=(e<<8)+this.data.getInt8(this.read++),t-=8}while(t>0);return e},o.DataBuffer.prototype.getSignedInt=function(t){var e=this.getInt(t),r=2<<t-2;return e>=r&&(e-=r<<1),e},o.DataBuffer.prototype.getBytes=function(t){var e;return t?(t=Math.min(this.length(),t),e=this.data.slice(this.read,this.read+t),this.read+=t):0===t?e="":(e=0===this.read?this.data:this.data.slice(this.read),this.clear()),e},o.DataBuffer.prototype.bytes=function(t){return void 0===t?this.data.slice(this.read):this.data.slice(this.read,this.read+t)},o.DataBuffer.prototype.at=function(t){return this.data.getUint8(this.read+t)},o.DataBuffer.prototype.setAt=function(t,e){return this.data.setUint8(t,e),this},o.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},o.DataBuffer.prototype.copy=function(){return new o.DataBuffer(this)},o.DataBuffer.prototype.compact=function(){if(this.read>0){var t=new Uint8Array(this.data.buffer,this.read),e=new Uint8Array(t.byteLength);e.set(t),this.data=new DataView(e),this.write-=this.read,this.read=0}return this},o.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},o.DataBuffer.prototype.truncate=function(t){return this.write=Math.max(0,this.length()-t),this.read=Math.min(this.read,this.write),this},o.DataBuffer.prototype.toHex=function(){for(var t="",e=this.read;e<this.data.byteLength;++e){var r=this.data.getUint8(e);r<16&&(t+="0"),t+=r.toString(16)}return t},o.DataBuffer.prototype.toString=function(t){var e=new Uint8Array(this.data,this.read,this.length());if("binary"===(t=t||"utf8")||"raw"===t)return o.binary.raw.encode(e);if("hex"===t)return o.binary.hex.encode(e);if("base64"===t)return o.binary.base64.encode(e);if("utf8"===t)return o.text.utf8.decode(e);if("utf16"===t)return o.text.utf16.decode(e);throw new Error("Invalid encoding: "+t)},o.createBuffer=function(t,e){return e=e||"raw",void 0!==t&&"utf8"===e&&(t=o.encodeUtf8(t)),new o.ByteBuffer(t)},o.fillString=function(t,e){for(var r="";e>0;)1&e&&(r+=t),(e>>>=1)>0&&(t+=t);return r},o.xorBytes=function(t,e,r){for(var n="",i="",a="",o=0,s=0;r>0;--r,++o)i=t.charCodeAt(o)^e.charCodeAt(o),s>=10&&(n+=a,a="",s=0),a+=String.fromCharCode(i),++s;return n+=a},o.hexToBytes=function(t){var e="",r=0;for(!0&t.length&&(r=1,e+=String.fromCharCode(parseInt(t[0],16)));r<t.length;r+=2)e+=String.fromCharCode(parseInt(t.substr(r,2),16));return e},o.bytesToHex=function(t){return o.createBuffer(t).toHex()},o.int32ToBytes=function(t){return String.fromCharCode(t>>24&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(255&t)};var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],p="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";o.encode64=function(t,e){for(var r,n,i,a="",o="",s=0;s<t.length;)r=t.charCodeAt(s++),n=t.charCodeAt(s++),i=t.charCodeAt(s++),a+=d.charAt(r>>2),a+=d.charAt((3&r)<<4|n>>4),isNaN(n)?a+="==":(a+=d.charAt((15&n)<<2|i>>6),a+=isNaN(i)?"=":d.charAt(63&i)),e&&a.length>e&&(o+=a.substr(0,e)+"\r\n",a=a.substr(e));return o+=a},o.decode64=function(t){t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var e,r,n,i,a="",o=0;o<t.length;)e=c[t.charCodeAt(o++)-43],r=c[t.charCodeAt(o++)-43],n=c[t.charCodeAt(o++)-43],i=c[t.charCodeAt(o++)-43],a+=String.fromCharCode(e<<2|r>>4),64!==n&&(a+=String.fromCharCode((15&r)<<4|n>>2),64!==i&&(a+=String.fromCharCode((3&n)<<6|i)));return a},o.encodeUtf8=function(t){return unescape(encodeURIComponent(t))},o.decodeUtf8=function(t){return decodeURIComponent(escape(t))},o.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:a.encode,decode:a.decode}},o.binary.raw.encode=function(t){return String.fromCharCode.apply(null,t)},o.binary.raw.decode=function(t,e,r){var n=e;n||(n=new Uint8Array(t.length));for(var i=r=r||0,a=0;a<t.length;++a)n[i++]=t.charCodeAt(a);return e?i-r:n},o.binary.hex.encode=o.bytesToHex,o.binary.hex.decode=function(t,e,r){var n=e;n||(n=new Uint8Array(Math.ceil(t.length/2)));var i=0,a=r=r||0;for(1&t.length&&(i=1,n[a++]=parseInt(t[0],16));i<t.length;i+=2)n[a++]=parseInt(t.substr(i,2),16);return e?a-r:n},o.binary.base64.encode=function(t,e){for(var r,n,i,a="",o="",s=0;s<t.byteLength;)r=t[s++],n=t[s++],i=t[s++],a+=d.charAt(r>>2),a+=d.charAt((3&r)<<4|n>>4),isNaN(n)?a+="==":(a+=d.charAt((15&n)<<2|i>>6),a+=isNaN(i)?"=":d.charAt(63&i)),e&&a.length>e&&(o+=a.substr(0,e)+"\r\n",a=a.substr(e));return o+=a},o.binary.base64.decode=function(t,e,r){var n,i,a,o,s=e;s||(s=new Uint8Array(3*Math.ceil(t.length/4))),t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var u=0,f=r=r||0;u<t.length;)n=c[t.charCodeAt(u++)-43],i=c[t.charCodeAt(u++)-43],a=c[t.charCodeAt(u++)-43],o=c[t.charCodeAt(u++)-43],s[f++]=n<<2|i>>4,64!==a&&(s[f++]=(15&i)<<4|a>>2,64!==o&&(s[f++]=(3&a)<<6|o));return e?f-r:s.subarray(0,f)},o.binary.base58.encode=function(t,e){return o.binary.baseN.encode(t,p,e)},o.binary.base58.decode=function(t,e){return o.binary.baseN.decode(t,p,e)},o.text={utf8:{},utf16:{}},o.text.utf8.encode=function(t,e,r){t=o.encodeUtf8(t);var n=e;n||(n=new Uint8Array(t.length));for(var i=r=r||0,a=0;a<t.length;++a)n[i++]=t.charCodeAt(a);return e?i-r:n},o.text.utf8.decode=function(t){return o.decodeUtf8(String.fromCharCode.apply(null,t))},o.text.utf16.encode=function(t,e,r){var n=e;n||(n=new Uint8Array(2*t.length));for(var i=new Uint16Array(n.buffer),a=r=r||0,o=r,s=0;s<t.length;++s)i[o++]=t.charCodeAt(s),a+=2;return e?a-r:n},o.text.utf16.decode=function(t){return String.fromCharCode.apply(null,new Uint16Array(t.buffer))},o.deflate=function(t,e,r){if(e=o.decode64(t.deflate(o.encode64(e)).rval),r){var n=2;32&e.charCodeAt(1)&&(n=6),e=e.substring(n,e.length-4)}return e},o.inflate=function(t,e,r){var n=t.inflate(o.encode64(e)).rval;return null===n?null:o.decode64(n)};var y=function(t,e,r){if(!t)throw new Error("WebStorage not available.");var n;if(null===r?n=t.removeItem(e):(r=o.encode64(JSON.stringify(r)),n=t.setItem(e,r)),void 0!==n&&!0!==n.rval){var i=new Error(n.error.message);throw i.id=n.error.id,i.name=n.error.name,i}},g=function(t,e){if(!t)throw new Error("WebStorage not available.");var r=t.getItem(e);if(t.init)if(null===r.rval){if(r.error){var n=new Error(r.error.message);throw n.id=r.error.id,n.name=r.error.name,n}r=null}else r=r.rval;return null!==r&&(r=JSON.parse(o.decode64(r))),r},l=function(t,e,r,n){var i=g(t,e);null===i&&(i={}),i[r]=n,y(t,e,i)},B=function(t,e,r){var n=g(t,e);return null!==n&&(n=r in n?n[r]:null),n},m=function(t,e,r){var n=g(t,e);if(null!==n&&r in n){delete n[r];var i=!0;for(var a in n){i=!1;break}i&&(n=null),y(t,e,n)}},v=function(t,e){y(t,e,null)},b=function(t,e,r){var n,i=null;void 0===r&&(r=["web","flash"]);var a=!1,o=null;for(var s in r){n=r[s];try{if("flash"===n||"both"===n){if(null===e[0])throw new Error("Flash local storage not available.");i=t.apply(this,e),a="flash"===n}"web"!==n&&"both"!==n||(e[0]=localStorage,i=t.apply(this,e),a=!0)}catch(u){o=u}if(a)break}if(!a)throw o;return i};o.setItem=function(t,e,r,n,i){b(l,arguments,i)},o.getItem=function(t,e,r,n){return b(B,arguments,n)},o.removeItem=function(t,e,r,n){b(m,arguments,n)},o.clearItems=function(t,e,r){b(v,arguments,r)},o.parseUrl=function(t){var e=/^(https?):\/\/([^:&^\/]*):?(\d*)(.*)$/g;e.lastIndex=0;var r=e.exec(t),n=null===r?null:{full:t,scheme:r[1],host:r[2],port:r[3],path:r[4]};return n&&(n.fullHost=n.host,n.port?80!==n.port&&"http"===n.scheme?n.fullHost+=":"+n.port:443!==n.port&&"https"===n.scheme&&(n.fullHost+=":"+n.port):"http"===n.scheme?n.port=80:"https"===n.scheme&&(n.port=443),n.full=n.scheme+"://"+n.fullHost),n};var w=null;o.getQueryVariables=function(t){var e,r=function(t){for(var e={},r=t.split("&"),n=0;n<r.length;n++){var i,a,o=r[n].indexOf("=");o>0?(i=r[n].substring(0,o),a=r[n].substring(o+1)):(i=r[n],a=null),i in e||(e[i]=[]),i in Object.prototype||null===a||e[i].push(unescape(a))}return e};return void 0===t?(null===w&&(w="undefined"!=typeof window&&window.location&&window.location.search?r(window.location.search.substring(1)):{}),e=w):e=r(t),e},o.parseFragment=function(t){var e=t,r="",n=t.indexOf("?");n>0&&(e=t.substring(0,n),r=t.substring(n+1));var i=e.split("/");return i.length>0&&""===i[0]&&i.shift(),{pathString:e,queryString:r,path:i,query:""===r?{}:o.getQueryVariables(r)}},o.makeRequest=function(t){var e=o.parseFragment(t),r={path:e.pathString,query:e.queryString,getPath:function(t){return void 0===t?e.path:e.path[t]},getQuery:function(t,r){var n;return void 0===t?n=e.query:(n=e.query[t])&&void 0!==r&&(n=n[r]),n},getQueryLast:function(t,e){var n=r.getQuery(t);return n?n[n.length-1]:e}};return r},o.makeLink=function(t,e,r){t=jQuery.isArray(t)?t.join("/"):t;var n=jQuery.param(e||{});return r=r||"",t+(n.length>0?"?"+n:"")+(r.length>0?"#"+r:"")},o.isEmpty=function(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0},o.format=function(t){for(var e,r,n=/%./g,i=0,a=[],o=0;e=n.exec(t);){(r=t.substring(o,n.lastIndex-2)).length>0&&a.push(r),o=n.lastIndex;var s=e[0][1];switch(s){case"s":case"o":i<arguments.length?a.push(arguments[1+i++]):a.push("<?>");break;case"%":a.push("%");break;default:a.push("<%"+s+"?>")}}return a.push(t.substring(o)),a.join("")},o.formatNumber=function(t,e,r,n){var i=t,a=isNaN(e=Math.abs(e))?2:e,o=void 0===r?",":r,s=void 0===n?".":n,u=i<0?"-":"",f=parseInt(i=Math.abs(+i||0).toFixed(a),10)+"",h=f.length>3?f.length%3:0;return u+(h?f.substr(0,h)+s:"")+f.substr(h).replace(/(\d{3})(?=\d)/g,"$1"+s)+(a?o+Math.abs(i-f).toFixed(a).slice(2):"")},o.formatSize=function(t){return t=t>=1073741824?o.formatNumber(t/1073741824,2,".","")+" GiB":t>=1048576?o.formatNumber(t/1048576,2,".","")+" MiB":t>=1024?o.formatNumber(t/1024,0)+" KiB":o.formatNumber(t,0)+" bytes"},o.bytesFromIP=function(t){return-1!==t.indexOf(".")?o.bytesFromIPv4(t):-1!==t.indexOf(":")?o.bytesFromIPv6(t):null},o.bytesFromIPv4=function(t){if(4!==(t=t.split(".")).length)return null;for(var e=o.createBuffer(),r=0;r<t.length;++r){var n=parseInt(t[r],10);if(isNaN(n))return null;e.putByte(n)}return e.getBytes()},o.bytesFromIPv6=function(t){for(var e=0,r=2*(8-(t=t.split(":").filter(function(t){return 0===t.length&&++e,!0})).length+e),n=o.createBuffer(),i=0;i<8;++i)if(t[i]&&0!==t[i].length){var a=o.hexToBytes(t[i]);a.length<2&&n.putByte(0),n.putBytes(a)}else n.fillWithByte(0,r),r=0;return n.getBytes()},o.bytesToIP=function(t){return 4===t.length?o.bytesToIPv4(t):16===t.length?o.bytesToIPv6(t):null},o.bytesToIPv4=function(t){if(4!==t.length)return null;for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r));return e.join(".")},o.bytesToIPv6=function(t){if(16!==t.length)return null;for(var e=[],r=[],n=0,i=0;i<t.length;i+=2){for(var a=o.bytesToHex(t[i]+t[i+1]);"0"===a[0]&&"0"!==a;)a=a.substr(1);if("0"===a){var s=r[r.length-1],u=e.length;s&&u===s.end+1?(s.end=u,s.end-s.start>r[n].end-r[n].start&&(n=r.length-1)):r.push({start:u,end:u})}e.push(a)}if(r.length>0){var f=r[n];f.end-f.start>0&&(e.splice(f.start,f.end-f.start+1,""),0===f.start&&e.unshift(""),7===f.end&&e.push(""))}return e.join(":")},o.estimateCores=function(t,e){if("function"==typeof t&&(e=t,t={}),t=t||{},"cores"in o&&!t.update)return e(null,o.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return o.cores=navigator.hardwareConcurrency,e(null,o.cores);if("undefined"==typeof Worker)return o.cores=1,e(null,o.cores);if("undefined"==typeof Blob)return o.cores=2,e(null,o.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(t){for(var e=Date.now(),r=e+4;Date.now()<r;);self.postMessage({st:e,et:r})})}.toString(),")()"],{type:"application/javascript"}));!function t(n,i,a){if(0===i){var s=Math.floor(n.reduce(function(t,e){return t+e},0)/n.length);return o.cores=Math.max(1,s),URL.revokeObjectURL(r),e(null,o.cores)}!function(t,e){for(var n=[],i=[],a=0;a<t;++a){var o=new Worker(r);o.addEventListener("message",function(r){if(i.push(r.data),i.length===t){for(var a=0;a<t;++a)n[a].terminate();e(null,i)}}),n.push(o)}for(var a=0;a<t;++a)n[a].postMessage(a)}(a,function(e,r){n.push(function(t,e){for(var r=[],n=0;n<t;++n)for(var i=e[n],a=r[n]=[],o=0;o<t;++o)if(n!==o){var s=e[o];(i.st>s.st&&i.st<s.et||s.st>i.st&&s.st<i.et)&&a.push(o)}return r.reduce(function(t,e){return Math.max(t,e.length)},0)}(a,r)),t(n,i-1,a)})}([],5,16)};
|
||
},{"./forge":"sQ2N","./baseN":"mhJr","process":"sC8V","buffer":"sC8V"}],"rMNY":[function(require,module,exports) {
|
||
var t=require("./forge");require("./util"),module.exports=t.cipher=t.cipher||{},t.cipher.algorithms=t.cipher.algorithms||{},t.cipher.createCipher=function(i,e){var r=i;if("string"==typeof r&&(r=t.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+i);return new t.cipher.BlockCipher({algorithm:r,key:e,decrypt:!1})},t.cipher.createDecipher=function(i,e){var r=i;if("string"==typeof r&&(r=t.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+i);return new t.cipher.BlockCipher({algorithm:r,key:e,decrypt:!0})},t.cipher.registerAlgorithm=function(i,e){i=i.toUpperCase(),t.cipher.algorithms[i]=e},t.cipher.getAlgorithm=function(i){return(i=i.toUpperCase())in t.cipher.algorithms?t.cipher.algorithms[i]:null};var i=t.cipher.BlockCipher=function(t){this.algorithm=t.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=t.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=t.decrypt,this.algorithm.initialize(t)};i.prototype.start=function(i){i=i||{};var e={};for(var r in i)e[r]=i[r];e.decrypt=this._decrypt,this._finish=!1,this._input=t.util.createBuffer(),this.output=i.output||t.util.createBuffer(),this.mode.start(e)},i.prototype.update=function(t){for(t&&this._input.putBuffer(t);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},i.prototype.finish=function(t){!t||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(i){return t(this.blockSize,i,!1)},this.mode.unpad=function(i){return t(this.blockSize,i,!0)});var i={};return i.decrypt=this._decrypt,i.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,i))&&(this._finish=!0,this.update(),!(this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,i))&&!(this.mode.afterFinish&&!this.mode.afterFinish(this.output,i)))};
|
||
},{"./forge":"sQ2N","./util":"2FVR"}],"pPJ9":[function(require,module,exports) {
|
||
var t=require("./forge");require("./util"),t.cipher=t.cipher||{};var i=module.exports=t.cipher.modes=t.cipher.modes||{};function s(i,s){if("string"==typeof i&&(i=t.util.createBuffer(i)),t.util.isArray(i)&&i.length>4){var e=i;i=t.util.createBuffer();for(var h=0;h<e.length;++h)i.putByte(e[h])}if(i.length()<s)throw new Error("Invalid IV length; got "+i.length()+" bytes and expected "+s+" bytes.");if(!t.util.isArray(i)){var r=[],o=s/4;for(h=0;h<o;++h)r.push(i.getInt32());i=r}return i}function e(t){t[t.length-1]=t[t.length-1]+1&4294967295}function h(t){return[t/4294967296|0,4294967295&t]}i.ecb=function(t){t=t||{},this.name="ECB",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},i.ecb.prototype.start=function(t){},i.ecb.prototype.encrypt=function(t,i,s){if(t.length()<this.blockSize&&!(s&&t.length()>0))return!0;for(var e=0;e<this._ints;++e)this._inBlock[e]=t.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(e=0;e<this._ints;++e)i.putInt32(this._outBlock[e])},i.ecb.prototype.decrypt=function(t,i,s){if(t.length()<this.blockSize&&!(s&&t.length()>0))return!0;for(var e=0;e<this._ints;++e)this._inBlock[e]=t.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(e=0;e<this._ints;++e)i.putInt32(this._outBlock[e])},i.ecb.prototype.pad=function(t,i){var s=t.length()===this.blockSize?this.blockSize:this.blockSize-t.length();return t.fillWithByte(s,s),!0},i.ecb.prototype.unpad=function(t,i){if(i.overflow>0)return!1;var s=t.length(),e=t.at(s-1);return!(e>this.blockSize<<2)&&(t.truncate(e),!0)},i.cbc=function(t){t=t||{},this.name="CBC",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},i.cbc.prototype.start=function(t){if(null===t.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=s(t.iv,this.blockSize),this._prev=this._iv.slice(0)}},i.cbc.prototype.encrypt=function(t,i,s){if(t.length()<this.blockSize&&!(s&&t.length()>0))return!0;for(var e=0;e<this._ints;++e)this._inBlock[e]=this._prev[e]^t.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(e=0;e<this._ints;++e)i.putInt32(this._outBlock[e]);this._prev=this._outBlock},i.cbc.prototype.decrypt=function(t,i,s){if(t.length()<this.blockSize&&!(s&&t.length()>0))return!0;for(var e=0;e<this._ints;++e)this._inBlock[e]=t.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(e=0;e<this._ints;++e)i.putInt32(this._prev[e]^this._outBlock[e]);this._prev=this._inBlock.slice(0)},i.cbc.prototype.pad=function(t,i){var s=t.length()===this.blockSize?this.blockSize:this.blockSize-t.length();return t.fillWithByte(s,s),!0},i.cbc.prototype.unpad=function(t,i){if(i.overflow>0)return!1;var s=t.length(),e=t.at(s-1);return!(e>this.blockSize<<2)&&(t.truncate(e),!0)},i.cfb=function(i){i=i||{},this.name="CFB",this.cipher=i.cipher,this.blockSize=i.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=t.util.createBuffer(),this._partialBytes=0},i.cfb.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=s(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.cfb.prototype.encrypt=function(t,i,s){var e=t.length();if(0===e)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&e>=this.blockSize)for(var h=0;h<this._ints;++h)this._inBlock[h]=t.getInt32()^this._outBlock[h],i.putInt32(this._inBlock[h]);else{var r=(this.blockSize-e)%this.blockSize;r>0&&(r=this.blockSize-r),this._partialOutput.clear();for(h=0;h<this._ints;++h)this._partialBlock[h]=t.getInt32()^this._outBlock[h],this._partialOutput.putInt32(this._partialBlock[h]);if(r>0)t.read-=this.blockSize;else for(h=0;h<this._ints;++h)this._inBlock[h]=this._partialBlock[h];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),r>0&&!s)return i.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=r,!0;i.putBytes(this._partialOutput.getBytes(e-this._partialBytes)),this._partialBytes=0}},i.cfb.prototype.decrypt=function(t,i,s){var e=t.length();if(0===e)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&e>=this.blockSize)for(var h=0;h<this._ints;++h)this._inBlock[h]=t.getInt32(),i.putInt32(this._inBlock[h]^this._outBlock[h]);else{var r=(this.blockSize-e)%this.blockSize;r>0&&(r=this.blockSize-r),this._partialOutput.clear();for(h=0;h<this._ints;++h)this._partialBlock[h]=t.getInt32(),this._partialOutput.putInt32(this._partialBlock[h]^this._outBlock[h]);if(r>0)t.read-=this.blockSize;else for(h=0;h<this._ints;++h)this._inBlock[h]=this._partialBlock[h];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),r>0&&!s)return i.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=r,!0;i.putBytes(this._partialOutput.getBytes(e-this._partialBytes)),this._partialBytes=0}},i.ofb=function(i){i=i||{},this.name="OFB",this.cipher=i.cipher,this.blockSize=i.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=t.util.createBuffer(),this._partialBytes=0},i.ofb.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=s(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ofb.prototype.encrypt=function(t,i,s){var e=t.length();if(0===t.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&e>=this.blockSize)for(var h=0;h<this._ints;++h)i.putInt32(t.getInt32()^this._outBlock[h]),this._inBlock[h]=this._outBlock[h];else{var r=(this.blockSize-e)%this.blockSize;r>0&&(r=this.blockSize-r),this._partialOutput.clear();for(h=0;h<this._ints;++h)this._partialOutput.putInt32(t.getInt32()^this._outBlock[h]);if(r>0)t.read-=this.blockSize;else for(h=0;h<this._ints;++h)this._inBlock[h]=this._outBlock[h];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),r>0&&!s)return i.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=r,!0;i.putBytes(this._partialOutput.getBytes(e-this._partialBytes)),this._partialBytes=0}},i.ofb.prototype.decrypt=i.ofb.prototype.encrypt,i.ctr=function(i){i=i||{},this.name="CTR",this.cipher=i.cipher,this.blockSize=i.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=t.util.createBuffer(),this._partialBytes=0},i.ctr.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=s(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ctr.prototype.encrypt=function(t,i,s){var h=t.length();if(0===h)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&h>=this.blockSize)for(var r=0;r<this._ints;++r)i.putInt32(t.getInt32()^this._outBlock[r]);else{var o=(this.blockSize-h)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(r=0;r<this._ints;++r)this._partialOutput.putInt32(t.getInt32()^this._outBlock[r]);if(o>0&&(t.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!s)return i.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;i.putBytes(this._partialOutput.getBytes(h-this._partialBytes)),this._partialBytes=0}e(this._inBlock)},i.ctr.prototype.decrypt=i.ctr.prototype.encrypt,i.gcm=function(i){i=i||{},this.name="GCM",this.cipher=i.cipher,this.blockSize=i.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=t.util.createBuffer(),this._partialBytes=0,this._R=3774873600},i.gcm.prototype.start=function(i){if(!("iv"in i))throw new Error("Invalid IV parameter.");var s,r=t.util.createBuffer(i.iv);if(this._cipherLength=0,s="additionalData"in i?t.util.createBuffer(i.additionalData):t.util.createBuffer(),this._tagLength="tagLength"in i?i.tagLength:128,this._tag=null,i.decrypt&&(this._tag=t.util.createBuffer(i.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var o=r.length();if(12===o)this._j0=[r.getInt32(),r.getInt32(),r.getInt32(),1];else{for(this._j0=[0,0,0,0];r.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(h(8*o)))}this._inBlock=this._j0.slice(0),e(this._inBlock),this._partialBytes=0,s=t.util.createBuffer(s),this._aDataLength=h(8*s.length());var a=s.length()%this.blockSize;for(a&&s.fillWithByte(0,this.blockSize-a),this._s=[0,0,0,0];s.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[s.getInt32(),s.getInt32(),s.getInt32(),s.getInt32()])},i.gcm.prototype.encrypt=function(t,i,s){var h=t.length();if(0===h)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&h>=this.blockSize){for(var r=0;r<this._ints;++r)i.putInt32(this._outBlock[r]^=t.getInt32());this._cipherLength+=this.blockSize}else{var o=(this.blockSize-h)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(r=0;r<this._ints;++r)this._partialOutput.putInt32(t.getInt32()^this._outBlock[r]);if(o<=0||s){if(s){var a=h%this.blockSize;this._cipherLength+=a,this._partialOutput.truncate(this.blockSize-a)}else this._cipherLength+=this.blockSize;for(r=0;r<this._ints;++r)this._outBlock[r]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!s)return t.read-=this.blockSize,i.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;i.putBytes(this._partialOutput.getBytes(h-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),e(this._inBlock)},i.gcm.prototype.decrypt=function(t,i,s){var h=t.length();if(h<this.blockSize&&!(s&&h>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),e(this._inBlock),this._hashBlock[0]=t.getInt32(),this._hashBlock[1]=t.getInt32(),this._hashBlock[2]=t.getInt32(),this._hashBlock[3]=t.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var r=0;r<this._ints;++r)i.putInt32(this._outBlock[r]^this._hashBlock[r]);h<this.blockSize?this._cipherLength+=h%this.blockSize:this._cipherLength+=this.blockSize},i.gcm.prototype.afterFinish=function(i,s){var e=!0;s.decrypt&&s.overflow&&i.truncate(this.blockSize-s.overflow),this.tag=t.util.createBuffer();var r=this._aDataLength.concat(h(8*this._cipherLength));this._s=this.ghash(this._hashSubkey,this._s,r);var o=[];this.cipher.encrypt(this._j0,o);for(var a=0;a<this._ints;++a)this.tag.putInt32(this._s[a]^o[a]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),s.decrypt&&this.tag.bytes()!==this._tag&&(e=!1),e},i.gcm.prototype.multiply=function(t,i){for(var s=[0,0,0,0],e=i.slice(0),h=0;h<128;++h){t[h/32|0]&1<<31-h%32&&(s[0]^=e[0],s[1]^=e[1],s[2]^=e[2],s[3]^=e[3]),this.pow(e,e)}return s},i.gcm.prototype.pow=function(t,i){for(var s=1&t[3],e=3;e>0;--e)i[e]=t[e]>>>1|(1&t[e-1])<<31;i[0]=t[0]>>>1,s&&(i[0]^=this._R)},i.gcm.prototype.tableMultiply=function(t){for(var i=[0,0,0,0],s=0;s<32;++s){var e=t[s/8|0]>>>4*(7-s%8)&15,h=this._m[s][e];i[0]^=h[0],i[1]^=h[1],i[2]^=h[2],i[3]^=h[3]}return i},i.gcm.prototype.ghash=function(t,i,s){return i[0]^=s[0],i[1]^=s[1],i[2]^=s[2],i[3]^=s[3],this.tableMultiply(i)},i.gcm.prototype.generateHashTable=function(t,i){for(var s=8/i,e=4*s,h=16*s,r=new Array(h),o=0;o<h;++o){var a=[0,0,0,0],n=(e-1-o%e)*i;a[o/e|0]=1<<i-1<<n,r[o]=this.generateSubHashTable(this.multiply(a,t),i)}return r},i.gcm.prototype.generateSubHashTable=function(t,i){var s=1<<i,e=s>>>1,h=new Array(s);h[e]=t.slice(0);for(var r=e>>>1;r>0;)this.pow(h[2*r],h[r]=[]),r>>=1;for(r=2;r<e;){for(var o=1;o<r;++o){var a=h[r],n=h[o];h[r+o]=[a[0]^n[0],a[1]^n[1],a[2]^n[2],a[3]^n[3]]}r*=2}for(h[0]=[0,0,0,0],r=e+1;r<s;++r){var l=h[r^e];h[r]=[t[0]^l[0],t[1]^l[1],t[2]^l[2],t[3]^l[3]]}return h};
|
||
},{"./forge":"sQ2N","./util":"2FVR"}],"tw3v":[function(require,module,exports) {
|
||
var e=require("./forge");function r(r,t){e.cipher.registerAlgorithm(r,function(){return new e.aes.Algorithm(r,t)})}require("./cipher"),require("./cipherModes"),require("./util"),module.exports=e.aes=e.aes||{},e.aes.startEncrypting=function(e,r,t,n){var i=s({key:e,output:t,decrypt:!1,mode:n});return i.start(r),i},e.aes.createEncryptionCipher=function(e,r){return s({key:e,output:null,decrypt:!1,mode:r})},e.aes.startDecrypting=function(e,r,t,n){var i=s({key:e,output:t,decrypt:!0,mode:n});return i.start(r),i},e.aes.createDecryptionCipher=function(e,r){return s({key:e,output:null,decrypt:!0,mode:r})},e.aes.Algorithm=function(e,r){c||f();var t=this;t.name=e,t.mode=new r({blockSize:16,cipher:{encrypt:function(e,r){return l(t._w,e,r,!1)},decrypt:function(e,r){return l(t._w,e,r,!0)}}}),t._init=!1},e.aes.Algorithm.prototype.initialize=function(r){if(!this._init){var t,n=r.key;if("string"!=typeof n||16!==n.length&&24!==n.length&&32!==n.length){if(e.util.isArray(n)&&(16===n.length||24===n.length||32===n.length)){t=n,n=e.util.createBuffer();for(var i=0;i<t.length;++i)n.putByte(t[i])}}else n=e.util.createBuffer(n);if(!e.util.isArray(n)){t=n,n=[];var o=t.length();if(16===o||24===o||32===o){o>>>=2;for(i=0;i<o;++i)n.push(t.getInt32())}}if(!e.util.isArray(n)||4!==n.length&&6!==n.length&&8!==n.length)throw new Error("Invalid key parameter.");var a=this.mode.name,c=-1!==["CFB","OFB","CTR","GCM"].indexOf(a);this._w=p(n,r.decrypt&&!c),this._init=!0}},e.aes._expandKey=function(e,r){return c||f(),p(e,r)},e.aes._updateBlock=l,r("AES-ECB",e.cipher.modes.ecb),r("AES-CBC",e.cipher.modes.cbc),r("AES-CFB",e.cipher.modes.cfb),r("AES-OFB",e.cipher.modes.ofb),r("AES-CTR",e.cipher.modes.ctr),r("AES-GCM",e.cipher.modes.gcm);var t,n,i,o,a,c=!1,u=4;function f(){c=!0,i=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),r=0;r<128;++r)e[r]=r<<1,e[r+128]=r+128<<1^283;t=new Array(256),n=new Array(256),o=new Array(4),a=new Array(4);for(r=0;r<4;++r)o[r]=new Array(256),a[r]=new Array(256);var u,f,p,l,s,h,y,d=0,g=0;for(r=0;r<256;++r){l=(l=g^g<<1^g<<2^g<<3^g<<4)>>8^255&l^99,t[d]=l,n[l]=d,h=(s=e[l])<<24^l<<16^l<<8^l^s,y=((u=e[d])^(f=e[u])^(p=e[f]))<<24^(d^p)<<16^(d^f^p)<<8^d^u^p;for(var m=0;m<4;++m)o[m][d]=h,a[m][l]=y,h=h<<24|h>>>8,y=y<<24|y>>>8;0===d?d=g=1:(d=u^e[e[e[u^p]]],g^=e[e[g]])}}function p(e,r){for(var n,o=e.slice(0),c=1,f=o.length,p=u*(f+6+1),l=f;l<p;++l)n=o[l-1],l%f==0?(n=t[n>>>16&255]<<24^t[n>>>8&255]<<16^t[255&n]<<8^t[n>>>24]^i[c]<<24,c++):f>6&&l%f==4&&(n=t[n>>>24]<<24^t[n>>>16&255]<<16^t[n>>>8&255]<<8^t[255&n]),o[l]=o[l-f]^n;if(r){for(var s,h=a[0],y=a[1],d=a[2],g=a[3],m=o.slice(0),v=(l=0,(p=o.length)-u);l<p;l+=u,v-=u)if(0===l||l===p-u)m[l]=o[v],m[l+1]=o[v+3],m[l+2]=o[v+2],m[l+3]=o[v+1];else for(var A=0;A<u;++A)s=o[v+A],m[l+(3&-A)]=h[t[s>>>24]]^y[t[s>>>16&255]]^d[t[s>>>8&255]]^g[t[255&s]];o=m}return o}function l(e,r,i,c){var u,f,p,l,s,h,y,d,g,m,v,A,C=e.length/4-1;c?(u=a[0],f=a[1],p=a[2],l=a[3],s=n):(u=o[0],f=o[1],p=o[2],l=o[3],s=t),h=r[0]^e[0],y=r[c?3:1]^e[1],d=r[2]^e[2],g=r[c?1:3]^e[3];for(var w=3,B=1;B<C;++B)m=u[h>>>24]^f[y>>>16&255]^p[d>>>8&255]^l[255&g]^e[++w],v=u[y>>>24]^f[d>>>16&255]^p[g>>>8&255]^l[255&h]^e[++w],A=u[d>>>24]^f[g>>>16&255]^p[h>>>8&255]^l[255&y]^e[++w],g=u[g>>>24]^f[h>>>16&255]^p[y>>>8&255]^l[255&d]^e[++w],h=m,y=v,d=A;i[0]=s[h>>>24]<<24^s[y>>>16&255]<<16^s[d>>>8&255]<<8^s[255&g]^e[++w],i[c?3:1]=s[y>>>24]<<24^s[d>>>16&255]<<16^s[g>>>8&255]<<8^s[255&h]^e[++w],i[2]=s[d>>>24]<<24^s[g>>>16&255]<<16^s[h>>>8&255]<<8^s[255&y]^e[++w],i[c?1:3]=s[g>>>24]<<24^s[h>>>16&255]<<16^s[y>>>8&255]<<8^s[255&d]^e[++w]}function s(r){var t,n="AES-"+((r=r||{}).mode||"CBC").toUpperCase(),i=(t=r.decrypt?e.cipher.createDecipher(n,r.key):e.cipher.createCipher(n,r.key)).start;return t.start=function(r,n){var o=null;n instanceof e.util.ByteBuffer&&(o=n,n={}),(n=n||{}).output=o,n.iv=r,i.call(t,n)},t}
|
||
},{"./forge":"sQ2N","./cipher":"rMNY","./cipherModes":"pPJ9","./util":"2FVR"}],"wwPe":[function(require,module,exports) {
|
||
"use strict";function e(e,n){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=t(e))||n&&e&&"number"==typeof e.length){r&&(e=r);var o=0,i=function(){};return{s:i,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,c=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return c=e.done,e},e:function(e){u=!0,a=e},f:function(){try{c||null==r.return||r.return()}finally{if(u)throw a}}}}function t(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var a=require("./util"),c=a.encodeText,u=function(){function t(e,n,o,i){r(this,t),this.name=e,this.code=n,this.codeBuf=c(this.code),this.alphabet=i,this.codec=o(i)}return i(t,[{key:"encode",value:function(e){return this.codec.encode(e)}},{key:"decode",value:function(t){var n,r=e(t);try{for(r.s();!(n=r.n()).done;){var o=n.value;if(this.alphabet&&this.alphabet.indexOf(o)<0)throw new Error("invalid character '".concat(o,"' in '").concat(t,"'"))}}catch(i){r.e(i)}finally{r.f()}return this.codec.decode(t)}}]),t}();module.exports=u;
|
||
},{"./util":"4dv8"}],"h8wW":[function(require,module,exports) {
|
||
"use strict";var e=require("@multiformats/base-x"),a=require("./base.js"),r=require("./rfc4648"),s=r.rfc4648,b=require("./util"),u=b.decodeText,p=b.encodeText,d=function(){return{encode:u,decode:p}},t=[["identity","\0",d,""],["base2","0",s(1),"01"],["base8","7",s(3),"01234567"],["base10","9",e,"0123456789"],["base16","f",s(4),"0123456789abcdef"],["base16upper","F",s(4),"0123456789ABCDEF"],["base32hex","v",s(5),"0123456789abcdefghijklmnopqrstuv"],["base32hexupper","V",s(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV"],["base32hexpad","t",s(5),"0123456789abcdefghijklmnopqrstuv="],["base32hexpadupper","T",s(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV="],["base32","b",s(5),"abcdefghijklmnopqrstuvwxyz234567"],["base32upper","B",s(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"],["base32pad","c",s(5),"abcdefghijklmnopqrstuvwxyz234567="],["base32padupper","C",s(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567="],["base32z","h",s(5),"ybndrfg8ejkmcpqxot1uwisza345h769"],["base36","k",e,"0123456789abcdefghijklmnopqrstuvwxyz"],["base36upper","K",e,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"],["base58btc","z",e,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],["base58flickr","Z",e,"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"],["base64","m",s(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],["base64pad","M",s(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],["base64url","u",s(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"],["base64urlpad","U",s(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="]],c=t.reduce(function(e,r){return e[r[0]]=new a(r[0],r[1],r[2],r[3]),e},{}),n=t.reduce(function(e,a){return e[a[1]]=c[a[0]],e},{});module.exports={names:c,codes:n};
|
||
},{"@multiformats/base-x":"zMOB","./base.js":"wwPe","./rfc4648":"hH6x","./util":"4dv8"}],"DTy7":[function(require,module,exports) {
|
||
"use strict";var e=require("./constants"),r=require("./util"),t=r.encodeText,n=r.decodeText,o=r.concat;function c(e,r){if(!r)throw new Error("requires an encoded Uint8Array");var t=u(e),n=t.name,c=t.codeBuf;return d(n,r),o([c,r],c.length+r.length)}function s(e,r){var n=u(e),c=t(n.encode(r));return o([n.codeBuf,c],n.codeBuf.length+c.length)}function a(e){e instanceof Uint8Array&&(e=n(e));var r=e[0];return["f","F","v","V","t","T","b","B","c","C","h","k","K"].includes(r)&&(e=e.toLowerCase()),u(e[0]).decode(e.substring(1))}function i(e){if(e instanceof Uint8Array&&(e=n(e)),"[object String]"!==Object.prototype.toString.call(e))return!1;try{return u(e[0]).name}catch(r){return!1}}function d(e,r){u(e).decode(n(r))}function u(r){if(Object.prototype.hasOwnProperty.call(e.names,r))return e.names[r];if(Object.prototype.hasOwnProperty.call(e.codes,r))return e.codes[r];throw new Error("Unsupported encoding: ".concat(r))}function f(e){return e instanceof Uint8Array&&(e=n(e)),u(e[0])}exports=module.exports=c,exports.encode=s,exports.decode=a,exports.isEncoded=i,exports.encoding=u,exports.encodingFromData=f;var p=Object.freeze(e.names),l=Object.freeze(e.codes);exports.names=p,exports.codes=l;
|
||
},{"./constants":"h8wW","./util":"4dv8"}],"Jm0S":[function(require,module,exports) {
|
||
"use strict";const{encoding:e}=require("multibase"),t=new TextDecoder("utf8");function n(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t}function r(r,o="utf8"){return"utf8"===o||"utf-8"===o?t.decode(r):"ascii"===o?n(r):e(o).encode(r)}module.exports=r;
|
||
},{"multibase":"DTy7"}],"YucU":[function(require,module,exports) {
|
||
"use strict";const{encoding:e}=require("multibase"),t=new TextEncoder;function n(e){const t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}function r(r,o="utf8"){return"utf8"===o||"utf-8"===o?t.encode(r):"ascii"===o?n(r):e(o).decode(r)}module.exports=r;
|
||
},{"multibase":"DTy7"}],"uPKa":[function(require,module,exports) {
|
||
"use strict";require("node-forge/lib/aes");var e=require("node-forge/lib/forge"),r=require("uint8arrays/to-string"),i=require("uint8arrays/from-string");module.exports={createCipheriv:function(t,a,u){var c=e.cipher.createCipher("AES-CTR",r(a,"ascii"));return c.start({iv:r(u,"ascii")}),{update:function(t){return c.update(e.util.createBuffer(r(t,"ascii"))),i(c.output.getBytes(),"ascii")}}},createDecipheriv:function(t,a,u){var c=e.cipher.createDecipher("AES-CTR",r(a,"ascii"));return c.start({iv:r(u,"ascii")}),{update:function(t){return c.update(e.util.createBuffer(r(t,"ascii"))),i(c.output.getBytes(),"ascii")}}}};
|
||
},{"node-forge/lib/aes":"tw3v","node-forge/lib/forge":"sQ2N","uint8arrays/to-string":"Jm0S","uint8arrays/from-string":"YucU"}],"9ROw":[function(require,module,exports) {
|
||
"use strict";function r(r,n){return a(r)||o(r,n)||e(r,n)||t()}function t(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function e(r,t){if(r){if("string"==typeof r)return n(r,t);var e=Object.prototype.toString.call(r).slice(8,-1);return"Object"===e&&r.constructor&&(e=r.constructor.name),"Map"===e||"Set"===e?Array.from(r):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?n(r,t):void 0}}function n(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=r[e];return n}function o(r,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(r)){var e=[],n=!0,o=!1,a=void 0;try{for(var i,c=r[Symbol.iterator]();!(n=(i=c.next()).done)&&(e.push(i.value),!t||e.length!==t);n=!0);}catch(u){o=!0,a=u}finally{try{n||null==c.return||c.return()}finally{if(o)throw a}}return e}}function a(r){if(Array.isArray(r))return r}var i=require("err-code"),c={16:"aes-128-ctr",32:"aes-256-ctr"};module.exports=function(t){var e=c[t.length];if(!e){var n=Object.entries(c).map(function(t){var e=r(t,2),n=e[0],o=e[1];return"".concat(n," (").concat(o,")")}).join(" / ");throw i(new Error("Invalid key length ".concat(t.length," bytes. Must be ").concat(n)),"ERR_INVALID_KEY_LENGTH")}return e};
|
||
},{"err-code":"hLMW"}],"nBnI":[function(require,module,exports) {
|
||
"use strict";function r(r,e,t,n,u,i,a){try{var c=r[i](a),o=c.value}catch(p){return void t(p)}c.done?e(o):Promise.resolve(o).then(n,u)}function e(e){return function(){var t=this,n=arguments;return new Promise(function(u,i){var a=e.apply(t,n);function c(e){r(a,u,i,c,o,"next",e)}function o(e){r(a,u,i,c,o,"throw",e)}c(void 0)})}}var t=require("./ciphers"),n=require("./cipher-mode");exports.create=function(){var r=e(regeneratorRuntime.mark(function r(u,i){var a,c,o,p;return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return a=n(u),c=t.createCipheriv(a,u,i),o=t.createDecipheriv(a,u,i),p={encrypt:function(){var r=e(regeneratorRuntime.mark(function r(e){return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",c.update(e));case 1:case"end":return r.stop()}},r)}));return function(e){return r.apply(this,arguments)}}(),decrypt:function(){var r=e(regeneratorRuntime.mark(function r(e){return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",o.update(e));case 1:case"end":return r.stop()}},r)}));return function(e){return r.apply(this,arguments)}}()},r.abrupt("return",p);case 5:case"end":return r.stop()}},r)}));return function(e,t){return r.apply(this,arguments)}}();
|
||
},{"./ciphers":"uPKa","./cipher-mode":"9ROw"}],"e2uf":[function(require,module,exports) {
|
||
"use strict";module.exports=i;var t=require("../util/minimal");function i(t,i){this.lo=t>>>0,this.hi=i>>>0}var o=i.zero=new i(0,0);o.toNumber=function(){return 0},o.zzEncode=o.zzDecode=function(){return this},o.length=function(){return 1};var r=i.zeroHash="\0\0\0\0\0\0\0\0";i.fromNumber=function(t){if(0===t)return o;var r=t<0;r&&(t=-t);var h=t>>>0,n=(t-h)/4294967296>>>0;return r&&(n=~n>>>0,h=~h>>>0,++h>4294967295&&(h=0,++n>4294967295&&(n=0))),new i(h,n)},i.from=function(r){if("number"==typeof r)return i.fromNumber(r);if(t.isString(r)){if(!t.Long)return i.fromNumber(parseInt(r,10));r=t.Long.fromString(r)}return r.low||r.high?new i(r.low>>>0,r.high>>>0):o},i.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var i=1+~this.lo>>>0,o=~this.hi>>>0;return i||(o=o+1>>>0),-(i+4294967296*o)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(i){return t.Long?new t.Long(0|this.lo,0|this.hi,Boolean(i)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(i)}};var h=String.prototype.charCodeAt;i.fromHash=function(t){return t===r?o:new i((h.call(t,0)|h.call(t,1)<<8|h.call(t,2)<<16|h.call(t,3)<<24)>>>0,(h.call(t,4)|h.call(t,5)<<8|h.call(t,6)<<16|h.call(t,7)<<24)>>>0)},i.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},i.prototype.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this},i.prototype.zzDecode=function(){var t=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this},i.prototype.length=function(){var t=this.lo,i=(this.lo>>>28|this.hi<<4)>>>0,o=this.hi>>>24;return 0===o?0===i?t<16384?t<128?1:2:t<2097152?3:4:i<16384?i<128?5:6:i<2097152?7:8:o<128?9:10};
|
||
},{"../util/minimal":"IJ4H"}],"IJ4H":[function(require,module,exports) {
|
||
var global = arguments[3];
|
||
var Buffer = require("buffer").Buffer;
|
||
var e=arguments[3],r=require("buffer").Buffer,t=exports;function n(e,r,t){for(var n=Object.keys(r),o=0;o<n.length;++o)void 0!==e[n[o]]&&t||(e[n[o]]=r[n[o]]);return e}function o(e){function r(e,t){if(!(this instanceof r))return new r(e,t);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,r):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),t&&n(this,t)}return(r.prototype=Object.create(Error.prototype)).constructor=r,Object.defineProperty(r.prototype,"name",{get:function(){return e}}),r.prototype.toString=function(){return this.name+": "+this.message},r}t.asPromise=require("@protobufjs/aspromise"),t.base64=require("@protobufjs/base64"),t.EventEmitter=require("@protobufjs/eventemitter"),t.float=require("@protobufjs/float"),t.inquire=require("@protobufjs/inquire"),t.utf8=require("@protobufjs/utf8"),t.pool=require("@protobufjs/pool"),t.LongBits=require("./longbits"),t.isNode=Boolean(void 0!==e&&e&&e.process&&e.process.versions&&e.process.versions.node),t.global=t.isNode&&e||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||this,t.emptyArray=Object.freeze?Object.freeze([]):[],t.emptyObject=Object.freeze?Object.freeze({}):{},t.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},t.isString=function(e){return"string"==typeof e||e instanceof String},t.isObject=function(e){return e&&"object"==typeof e},t.isset=t.isSet=function(e,r){var t=e[r];return!(null==t||!e.hasOwnProperty(r))&&("object"!=typeof t||(Array.isArray(t)?t.length:Object.keys(t).length)>0)},t.Buffer=function(){try{var e=t.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(r){return null}}(),t._Buffer_from=null,t._Buffer_allocUnsafe=null,t.newBuffer=function(e){return"number"==typeof e?t.Buffer?t._Buffer_allocUnsafe(e):new t.Array(e):t.Buffer?t._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},t.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,t.Long=t.global.dcodeIO&&t.global.dcodeIO.Long||t.global.Long||t.inquire("long"),t.key2Re=/^true|false|0|1$/,t.key32Re=/^-?(?:0|[1-9][0-9]*)$/,t.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,t.longToHash=function(e){return e?t.LongBits.from(e).toHash():t.LongBits.zeroHash},t.longFromHash=function(e,r){var n=t.LongBits.fromHash(e);return t.Long?t.Long.fromBits(n.lo,n.hi,r):n.toNumber(Boolean(r))},t.merge=n,t.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},t.newError=o,t.ProtocolError=o("ProtocolError"),t.oneOfGetter=function(e){for(var r={},t=0;t<e.length;++t)r[e[t]]=1;return function(){for(var e=Object.keys(this),t=e.length-1;t>-1;--t)if(1===r[e[t]]&&void 0!==this[e[t]]&&null!==this[e[t]])return e[t]}},t.oneOfSetter=function(e){return function(r){for(var t=0;t<e.length;++t)e[t]!==r&&delete this[e[t]]}},t.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},t._configure=function(){var e=t.Buffer;e?(t._Buffer_from=e.from!==Uint8Array.from&&e.from||function(r,t){return new e(r,t)},t._Buffer_allocUnsafe=e.allocUnsafe||function(r){return new e(r)}):t._Buffer_from=t._Buffer_allocUnsafe=null};
|
||
},{"@protobufjs/aspromise":"AnsR","@protobufjs/base64":"08vA","@protobufjs/eventemitter":"rQUj","@protobufjs/float":"lW0B","@protobufjs/inquire":"eAoq","@protobufjs/utf8":"UiC1","@protobufjs/pool":"qHDJ","./longbits":"e2uf","buffer":"z1tx"}],"dB9j":[function(require,module,exports) {
|
||
"use strict";module.exports=u;var t,i=require("./util/minimal"),n=i.LongBits,e=i.base64,o=i.utf8;function r(t,i,n){this.fn=t,this.len=i,this.next=void 0,this.val=n}function s(){}function h(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function u(){this.len=0,this.head=new r(s,0,0),this.tail=this.head,this.states=null}var l=function(){return i.Buffer?function(){return(u.create=function(){return new t})()}:function(){return new u}};function p(t,i,n){i[n]=255&t}function a(t,i,n){for(;t>127;)i[n++]=127&t|128,t>>>=7;i[n]=t}function f(t,i){this.len=t,this.next=void 0,this.val=i}function c(t,i,n){for(;t.hi;)i[n++]=127&t.lo|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)i[n++]=127&t.lo|128,t.lo=t.lo>>>7;i[n++]=t.lo}function y(t,i,n){i[n]=255&t,i[n+1]=t>>>8&255,i[n+2]=t>>>16&255,i[n+3]=t>>>24}u.create=l(),u.alloc=function(t){return new i.Array(t)},i.Array!==Array&&(u.alloc=i.pool(u.alloc,i.Array.prototype.subarray)),u.prototype._push=function(t,i,n){return this.tail=this.tail.next=new r(t,i,n),this.len+=i,this},f.prototype=Object.create(r.prototype),f.prototype.fn=a,u.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new f((t>>>=0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this},u.prototype.int32=function(t){return t<0?this._push(c,10,n.fromNumber(t)):this.uint32(t)},u.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)},u.prototype.uint64=function(t){var i=n.from(t);return this._push(c,i.length(),i)},u.prototype.int64=u.prototype.uint64,u.prototype.sint64=function(t){var i=n.from(t).zzEncode();return this._push(c,i.length(),i)},u.prototype.bool=function(t){return this._push(p,1,t?1:0)},u.prototype.fixed32=function(t){return this._push(y,4,t>>>0)},u.prototype.sfixed32=u.prototype.fixed32,u.prototype.fixed64=function(t){var i=n.from(t);return this._push(y,4,i.lo)._push(y,4,i.hi)},u.prototype.sfixed64=u.prototype.fixed64,u.prototype.float=function(t){return this._push(i.float.writeFloatLE,4,t)},u.prototype.double=function(t){return this._push(i.float.writeDoubleLE,8,t)};var d=i.Array.prototype.set?function(t,i,n){i.set(t,n)}:function(t,i,n){for(var e=0;e<t.length;++e)i[n+e]=t[e]};u.prototype.bytes=function(t){var n=t.length>>>0;if(!n)return this._push(p,1,0);if(i.isString(t)){var o=u.alloc(n=e.length(t));e.decode(t,o,0),t=o}return this.uint32(n)._push(d,n,t)},u.prototype.string=function(t){var i=o.length(t);return i?this.uint32(i)._push(o.write,i,t):this._push(p,1,0)},u.prototype.fork=function(){return this.states=new h(this),this.head=this.tail=new r(s,0,0),this.len=0,this},u.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new r(s,0,0),this.len=0),this},u.prototype.ldelim=function(){var t=this.head,i=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=t.next,this.tail=i,this.len+=n),this},u.prototype.finish=function(){for(var t=this.head.next,i=this.constructor.alloc(this.len),n=0;t;)t.fn(t.val,i,n),n+=t.len,t=t.next;return i},u._configure=function(i){t=i,u.create=l(),t._configure()};
|
||
},{"./util/minimal":"IJ4H"}],"eV0O":[function(require,module,exports) {
|
||
"use strict";module.exports=r;var t=require("./writer");(r.prototype=Object.create(t.prototype)).constructor=r;var e=require("./util/minimal");function r(){t.call(this)}function i(t,r,i){t.length<40?e.utf8.write(t,r,i):r.utf8Write?r.utf8Write(t,i):r.write(t,i)}r._configure=function(){r.alloc=e._Buffer_allocUnsafe,r.writeBytesBuffer=e.Buffer&&e.Buffer.prototype instanceof Uint8Array&&"set"===e.Buffer.prototype.set.name?function(t,e,r){e.set(t,r)}:function(t,e,r){if(t.copy)t.copy(e,r,0,t.length);else for(var i=0;i<t.length;)e[r++]=t[i++]}},r.prototype.bytes=function(t){e.isString(t)&&(t=e._Buffer_from(t,"base64"));var i=t.length>>>0;return this.uint32(i),i&&this._push(r.writeBytesBuffer,i,t),this},r.prototype.string=function(t){var r=e.Buffer.byteLength(t);return this.uint32(r),r&&this._push(i,r,t),this},r._configure();
|
||
},{"./writer":"dB9j","./util/minimal":"IJ4H"}],"uL2n":[function(require,module,exports) {
|
||
"use strict";module.exports=h;var t,i=require("./util/minimal"),s=i.LongBits,r=i.utf8;function o(t,i){return RangeError("index out of range: "+t.pos+" + "+(i||1)+" > "+t.len)}function h(t){this.buf=t,this.pos=0,this.len=t.length}var n="undefined"!=typeof Uint8Array?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new h(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new h(t);throw Error("illegal buffer")},e=function(){return i.Buffer?function(s){return(h.create=function(s){return i.Buffer.isBuffer(s)?new t(s):n(s)})(s)}:n};function u(){var t=new s(0,0),i=0;if(!(this.len-this.pos>4)){for(;i<3;++i){if(this.pos>=this.len)throw o(this);if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*i)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(127&this.buf[this.pos++])<<7*i)>>>0,t}for(;i<4;++i)if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*i)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(127&this.buf[this.pos])<<28)>>>0,t.hi=(t.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return t;if(i=0,this.len-this.pos>4){for(;i<5;++i)if(t.hi=(t.hi|(127&this.buf[this.pos])<<7*i+3)>>>0,this.buf[this.pos++]<128)return t}else for(;i<5;++i){if(this.pos>=this.len)throw o(this);if(t.hi=(t.hi|(127&this.buf[this.pos])<<7*i+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}function f(t,i){return(t[i-4]|t[i-3]<<8|t[i-2]<<16|t[i-1]<<24)>>>0}function p(){if(this.pos+8>this.len)throw o(this,8);return new s(f(this.buf,this.pos+=4),f(this.buf,this.pos+=4))}h.create=e(),h.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,h.prototype.uint32=function(){var t=4294967295;return function(){if(t=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return t;if(t=(t|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return t;if(t=(t|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return t;if(t=(t|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return t;if(t=(t|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return t;if((this.pos+=5)>this.len)throw this.pos=this.len,o(this,10);return t}}(),h.prototype.int32=function(){return 0|this.uint32()},h.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(1&t)|0},h.prototype.bool=function(){return 0!==this.uint32()},h.prototype.fixed32=function(){if(this.pos+4>this.len)throw o(this,4);return f(this.buf,this.pos+=4)},h.prototype.sfixed32=function(){if(this.pos+4>this.len)throw o(this,4);return 0|f(this.buf,this.pos+=4)},h.prototype.float=function(){if(this.pos+4>this.len)throw o(this,4);var t=i.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t},h.prototype.double=function(){if(this.pos+8>this.len)throw o(this,4);var t=i.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t},h.prototype.bytes=function(){var t=this.uint32(),i=this.pos,s=this.pos+t;if(s>this.len)throw o(this,t);return this.pos+=t,Array.isArray(this.buf)?this.buf.slice(i,s):i===s?new this.buf.constructor(0):this._slice.call(this.buf,i,s)},h.prototype.string=function(){var t=this.bytes();return r.read(t,0,t.length)},h.prototype.skip=function(t){if("number"==typeof t){if(this.pos+t>this.len)throw o(this,t);this.pos+=t}else do{if(this.pos>=this.len)throw o(this)}while(128&this.buf[this.pos++]);return this},h.prototype.skipType=function(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(t=7&this.uint32());)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this},h._configure=function(s){t=s,h.create=e(),t._configure();var r=i.Long?"toLong":"toNumber";i.merge(h.prototype,{int64:function(){return u.call(this)[r](!1)},uint64:function(){return u.call(this)[r](!0)},sint64:function(){return u.call(this).zzDecode()[r](!1)},fixed64:function(){return p.call(this)[r](!0)},sfixed64:function(){return p.call(this)[r](!1)}})};
|
||
},{"./util/minimal":"IJ4H"}],"MAgd":[function(require,module,exports) {
|
||
"use strict";module.exports=e;var t=require("./reader");(e.prototype=Object.create(t.prototype)).constructor=e;var i=require("./util/minimal");function e(i){t.call(this,i)}e._configure=function(){i.Buffer&&(e.prototype._slice=i.Buffer.prototype.slice)},e.prototype.string=function(){var t=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+t,this.len))},e._configure();
|
||
},{"./reader":"uL2n","./util/minimal":"IJ4H"}],"mHFs":[function(require,module,exports) {
|
||
"use strict";module.exports=t;var e=require("../util/minimal");function t(t,r,i){if("function"!=typeof t)throw TypeError("rpcImpl must be a function");e.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=Boolean(r),this.responseDelimited=Boolean(i)}(t.prototype=Object.create(e.EventEmitter.prototype)).constructor=t,t.prototype.rpcCall=function t(r,i,n,o,l){if(!o)throw TypeError("request must be specified");var u=this;if(!l)return e.asPromise(t,u,r,i,n,o);if(u.rpcImpl)try{return u.rpcImpl(r,i[u.requestDelimited?"encodeDelimited":"encode"](o).finish(),function(e,t){if(e)return u.emit("error",e,r),l(e);if(null!==t){if(!(t instanceof n))try{t=n[u.responseDelimited?"decodeDelimited":"decode"](t)}catch(e){return u.emit("error",e,r),l(e)}return u.emit("data",t,r),l(null,t)}u.end(!0)})}catch(c){return u.emit("error",c,r),void setTimeout(function(){l(c)},0)}else setTimeout(function(){l(Error("already ended"))},0)},t.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this};
|
||
},{"../util/minimal":"IJ4H"}],"9YpY":[function(require,module,exports) {
|
||
"use strict";var e=exports;e.Service=require("./rpc/service");
|
||
},{"./rpc/service":"mHFs"}],"POm5":[function(require,module,exports) {
|
||
"use strict";var r=exports;function e(){r.util._configure(),r.Writer._configure(r.BufferWriter),r.Reader._configure(r.BufferReader)}r.build="minimal",r.Writer=require("./writer"),r.BufferWriter=require("./writer_buffer"),r.Reader=require("./reader"),r.BufferReader=require("./reader_buffer"),r.util=require("./util/minimal"),r.rpc=require("./rpc"),r.roots=require("./roots"),r.configure=e,e();
|
||
},{"./writer":"dB9j","./writer_buffer":"eV0O","./reader":"uL2n","./reader_buffer":"MAgd","./util/minimal":"IJ4H","./rpc":"9YpY","./roots":"2V3j"}],"E7pg":[function(require,module,exports) {
|
||
"use strict";module.exports=require("./src/index-minimal");
|
||
},{"./src/index-minimal":"POm5"}],"HRSQ":[function(require,module,exports) {
|
||
"use strict";var e=require("protobufjs/minimal"),t=e.Reader,a=e.Writer,r=e.util,n=e.roots.default||(e.roots.default={});n.KeyType=function(){var e={},t=Object.create(e);return t[e[0]="RSA"]=0,t[e[1]="Ed25519"]=1,t[e[2]="Secp256k1"]=2,t}(),n.PublicKey=function(){function o(e){if(e)for(var t=Object.keys(e),a=0;a<t.length;++a)null!=e[t[a]]&&(this[t[a]]=e[t[a]])}return o.prototype.Type=0,o.prototype.Data=r.newBuffer([]),o.encode=function(e,t){return t||(t=a.create()),t.uint32(8).int32(e.Type),t.uint32(18).bytes(e.Data),t},o.decode=function(e,a){e instanceof t||(e=t.create(e));for(var o=void 0===a?e.len:e.pos+a,i=new n.PublicKey;e.pos<o;){var s=e.uint32();switch(s>>>3){case 1:i.Type=e.int32();break;case 2:i.Data=e.bytes();break;default:e.skipType(7&s)}}if(!i.hasOwnProperty("Type"))throw r.ProtocolError("missing required 'Type'",{instance:i});if(!i.hasOwnProperty("Data"))throw r.ProtocolError("missing required 'Data'",{instance:i});return i},o.fromObject=function(e){if(e instanceof n.PublicKey)return e;var t=new n.PublicKey;switch(e.Type){case"RSA":case 0:t.Type=0;break;case"Ed25519":case 1:t.Type=1;break;case"Secp256k1":case 2:t.Type=2}return null!=e.Data&&("string"==typeof e.Data?r.base64.decode(e.Data,t.Data=r.newBuffer(r.base64.length(e.Data)),0):e.Data.length&&(t.Data=e.Data)),t},o.toObject=function(e,t){t||(t={});var a={};return t.defaults&&(a.Type=t.enums===String?"RSA":0,t.bytes===String?a.Data="":(a.Data=[],t.bytes!==Array&&(a.Data=r.newBuffer(a.Data)))),null!=e.Type&&e.hasOwnProperty("Type")&&(a.Type=t.enums===String?n.KeyType[e.Type]:e.Type),null!=e.Data&&e.hasOwnProperty("Data")&&(a.Data=t.bytes===String?r.base64.encode(e.Data,0,e.Data.length):t.bytes===Array?Array.prototype.slice.call(e.Data):e.Data),a},o.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},o}(),n.PrivateKey=function(){function o(e){if(e)for(var t=Object.keys(e),a=0;a<t.length;++a)null!=e[t[a]]&&(this[t[a]]=e[t[a]])}return o.prototype.Type=0,o.prototype.Data=r.newBuffer([]),o.encode=function(e,t){return t||(t=a.create()),t.uint32(8).int32(e.Type),t.uint32(18).bytes(e.Data),t},o.decode=function(e,a){e instanceof t||(e=t.create(e));for(var o=void 0===a?e.len:e.pos+a,i=new n.PrivateKey;e.pos<o;){var s=e.uint32();switch(s>>>3){case 1:i.Type=e.int32();break;case 2:i.Data=e.bytes();break;default:e.skipType(7&s)}}if(!i.hasOwnProperty("Type"))throw r.ProtocolError("missing required 'Type'",{instance:i});if(!i.hasOwnProperty("Data"))throw r.ProtocolError("missing required 'Data'",{instance:i});return i},o.fromObject=function(e){if(e instanceof n.PrivateKey)return e;var t=new n.PrivateKey;switch(e.Type){case"RSA":case 0:t.Type=0;break;case"Ed25519":case 1:t.Type=1;break;case"Secp256k1":case 2:t.Type=2}return null!=e.Data&&("string"==typeof e.Data?r.base64.decode(e.Data,t.Data=r.newBuffer(r.base64.length(e.Data)),0):e.Data.length&&(t.Data=e.Data)),t},o.toObject=function(e,t){t||(t={});var a={};return t.defaults&&(a.Type=t.enums===String?"RSA":0,t.bytes===String?a.Data="":(a.Data=[],t.bytes!==Array&&(a.Data=r.newBuffer(a.Data)))),null!=e.Type&&e.hasOwnProperty("Type")&&(a.Type=t.enums===String?n.KeyType[e.Type]:e.Type),null!=e.Data&&e.hasOwnProperty("Data")&&(a.Data=t.bytes===String?r.base64.encode(e.Data,0,e.Data.length):t.bytes===Array?Array.prototype.slice.call(e.Data):e.Data),a},o.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},o}(),module.exports=n;
|
||
},{"protobufjs/minimal":"E7pg"}],"Qnxl":[function(require,module,exports) {
|
||
var i=require("./forge");i.pki=i.pki||{};var t=module.exports=i.pki.oids=i.oids=i.oids||{};function e(i,e){t[i]=e,t[e]=i}function s(i,e){t[i]=e}e("1.2.840.113549.1.1.1","rsaEncryption"),e("1.2.840.113549.1.1.4","md5WithRSAEncryption"),e("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),e("1.2.840.113549.1.1.7","RSAES-OAEP"),e("1.2.840.113549.1.1.8","mgf1"),e("1.2.840.113549.1.1.9","pSpecified"),e("1.2.840.113549.1.1.10","RSASSA-PSS"),e("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),e("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),e("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),e("1.3.101.112","EdDSA25519"),e("1.2.840.10040.4.3","dsa-with-sha1"),e("1.3.14.3.2.7","desCBC"),e("1.3.14.3.2.26","sha1"),e("2.16.840.1.101.3.4.2.1","sha256"),e("2.16.840.1.101.3.4.2.2","sha384"),e("2.16.840.1.101.3.4.2.3","sha512"),e("1.2.840.113549.2.5","md5"),e("1.2.840.113549.1.7.1","data"),e("1.2.840.113549.1.7.2","signedData"),e("1.2.840.113549.1.7.3","envelopedData"),e("1.2.840.113549.1.7.4","signedAndEnvelopedData"),e("1.2.840.113549.1.7.5","digestedData"),e("1.2.840.113549.1.7.6","encryptedData"),e("1.2.840.113549.1.9.1","emailAddress"),e("1.2.840.113549.1.9.2","unstructuredName"),e("1.2.840.113549.1.9.3","contentType"),e("1.2.840.113549.1.9.4","messageDigest"),e("1.2.840.113549.1.9.5","signingTime"),e("1.2.840.113549.1.9.6","counterSignature"),e("1.2.840.113549.1.9.7","challengePassword"),e("1.2.840.113549.1.9.8","unstructuredAddress"),e("1.2.840.113549.1.9.14","extensionRequest"),e("1.2.840.113549.1.9.20","friendlyName"),e("1.2.840.113549.1.9.21","localKeyId"),e("1.2.840.113549.1.9.22.1","x509Certificate"),e("1.2.840.113549.1.12.10.1.1","keyBag"),e("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),e("1.2.840.113549.1.12.10.1.3","certBag"),e("1.2.840.113549.1.12.10.1.4","crlBag"),e("1.2.840.113549.1.12.10.1.5","secretBag"),e("1.2.840.113549.1.12.10.1.6","safeContentsBag"),e("1.2.840.113549.1.5.13","pkcs5PBES2"),e("1.2.840.113549.1.5.12","pkcs5PBKDF2"),e("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),e("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),e("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),e("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),e("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),e("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),e("1.2.840.113549.2.7","hmacWithSHA1"),e("1.2.840.113549.2.8","hmacWithSHA224"),e("1.2.840.113549.2.9","hmacWithSHA256"),e("1.2.840.113549.2.10","hmacWithSHA384"),e("1.2.840.113549.2.11","hmacWithSHA512"),e("1.2.840.113549.3.7","des-EDE3-CBC"),e("2.16.840.1.101.3.4.1.2","aes128-CBC"),e("2.16.840.1.101.3.4.1.22","aes192-CBC"),e("2.16.840.1.101.3.4.1.42","aes256-CBC"),e("2.5.4.3","commonName"),e("2.5.4.5","serialName"),e("2.5.4.6","countryName"),e("2.5.4.7","localityName"),e("2.5.4.8","stateOrProvinceName"),e("2.5.4.9","streetAddress"),e("2.5.4.10","organizationName"),e("2.5.4.11","organizationalUnitName"),e("2.5.4.13","description"),e("2.5.4.15","businessCategory"),e("2.5.4.17","postalCode"),e("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),e("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),e("2.16.840.1.113730.1.1","nsCertType"),e("2.16.840.1.113730.1.13","nsComment"),s("2.5.29.1","authorityKeyIdentifier"),s("2.5.29.2","keyAttributes"),s("2.5.29.3","certificatePolicies"),s("2.5.29.4","keyUsageRestriction"),s("2.5.29.5","policyMapping"),s("2.5.29.6","subtreesConstraint"),s("2.5.29.7","subjectAltName"),s("2.5.29.8","issuerAltName"),s("2.5.29.9","subjectDirectoryAttributes"),s("2.5.29.10","basicConstraints"),s("2.5.29.11","nameConstraints"),s("2.5.29.12","policyConstraints"),s("2.5.29.13","basicConstraints"),e("2.5.29.14","subjectKeyIdentifier"),e("2.5.29.15","keyUsage"),s("2.5.29.16","privateKeyUsagePeriod"),e("2.5.29.17","subjectAltName"),e("2.5.29.18","issuerAltName"),e("2.5.29.19","basicConstraints"),s("2.5.29.20","cRLNumber"),s("2.5.29.21","cRLReason"),s("2.5.29.22","expirationDate"),s("2.5.29.23","instructionCode"),s("2.5.29.24","invalidityDate"),s("2.5.29.25","cRLDistributionPoints"),s("2.5.29.26","issuingDistributionPoint"),s("2.5.29.27","deltaCRLIndicator"),s("2.5.29.28","issuingDistributionPoint"),s("2.5.29.29","certificateIssuer"),s("2.5.29.30","nameConstraints"),e("2.5.29.31","cRLDistributionPoints"),e("2.5.29.32","certificatePolicies"),s("2.5.29.33","policyMappings"),s("2.5.29.34","policyConstraints"),e("2.5.29.35","authorityKeyIdentifier"),s("2.5.29.36","policyConstraints"),e("2.5.29.37","extKeyUsage"),s("2.5.29.46","freshestCRL"),s("2.5.29.54","inhibitAnyPolicy"),e("1.3.6.1.4.1.11129.2.4.2","timestampList"),e("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),e("1.3.6.1.5.5.7.3.1","serverAuth"),e("1.3.6.1.5.5.7.3.2","clientAuth"),e("1.3.6.1.5.5.7.3.3","codeSigning"),e("1.3.6.1.5.5.7.3.4","emailProtection"),e("1.3.6.1.5.5.7.3.8","timeStamping");
|
||
},{"./forge":"sQ2N"}],"dLTu":[function(require,module,exports) {
|
||
function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}var t=require("./forge");require("./util"),require("./oids");var r=module.exports=t.asn1=t.asn1||{};function n(e,t,r){if(r>t){var n=new Error("Too few bytes to parse DER.");throw n.available=e.length(),n.remaining=t,n.requested=r,n}}r.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},r.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},r.create=function(e,n,a,s,i){if(t.util.isArray(s)){for(var u=[],o=0;o<s.length;++o)void 0!==s[o]&&u.push(s[o]);s=u}var l={tagClass:e,type:n,constructed:a,composed:a||t.util.isArray(s),value:s};return i&&"bitStringContents"in i&&(l.bitStringContents=i.bitStringContents,l.original=r.copy(l)),l},r.copy=function(e,n){var a;if(t.util.isArray(e)){a=[];for(var s=0;s<e.length;++s)a.push(r.copy(e[s],n));return a}return"string"==typeof e?e:(a={tagClass:e.tagClass,type:e.type,constructed:e.constructed,composed:e.composed,value:r.copy(e.value,n)},n&&!n.excludeBitStringContents&&(a.bitStringContents=e.bitStringContents),a)},r.equals=function(n,a,s){if(t.util.isArray(n)){if(!t.util.isArray(a))return!1;if(n.length!==a.length)return!1;for(var i=0;i<n.length;++i)if(!r.equals(n[i],a[i]))return!1;return!0}if(e(n)!==e(a))return!1;if("string"==typeof n)return n===a;var u=n.tagClass===a.tagClass&&n.type===a.type&&n.constructed===a.constructed&&n.composed===a.composed&&r.equals(n.value,a.value);return s&&s.includeBitStringContents&&(u=u&&n.bitStringContents===a.bitStringContents),u},r.getBerValueLength=function(e){var t=e.getByte();if(128!==t)return 128&t?e.getInt((127&t)<<3):t};var a=function(e,t){var r=e.getByte();if(128!==r){var a;if(128&r){var s=127&r;n(e,--t,s),a=e.getInt(s<<3)}else a=r;if(a<0)throw new Error("Negative length: "+a);return a}};function s(e,t,i,u){var o;n(e,t,2);var l=e.getByte();t--;var p=192&l,c=31&l;o=e.length();var g,T,f=a(e,t);if(t-=o-e.length(),void 0!==f&&f>t){if(u.strict){var v=new Error("Too few bytes to read ASN.1 value.");throw v.available=e.length(),v.remaining=t,v.requested=f,v}f=t}var y=32==(32&l);if(y)if(g=[],void 0===f)for(;;){if(n(e,t,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),t-=2;break}o=e.length(),g.push(s(e,t,i+1,u)),t-=o-e.length()}else for(;f>0;)o=e.length(),g.push(s(e,f,i+1,u)),t-=o-e.length(),f-=o-e.length();if(void 0===g&&p===r.Class.UNIVERSAL&&c===r.Type.BITSTRING&&(T=e.bytes(f)),void 0===g&&u.decodeBitStrings&&p===r.Class.UNIVERSAL&&c===r.Type.BITSTRING&&f>1){var d=e.read,h=t,I=0;if(c===r.Type.BITSTRING&&(n(e,t,1),I=e.getByte(),t--),0===I)try{o=e.length();var C=s(e,t,i+1,{verbose:u.verbose,strict:!0,decodeBitStrings:!0}),b=o-e.length();t-=b,c==r.Type.BITSTRING&&b++;var S=C.tagClass;b!==f||S!==r.Class.UNIVERSAL&&S!==r.Class.CONTEXT_SPECIFIC||(g=[C])}catch(B){}void 0===g&&(e.read=d,t=h)}if(void 0===g){if(void 0===f){if(u.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");f=t}if(c===r.Type.BMPSTRING)for(g="";f>0;f-=2)n(e,t,2),g+=String.fromCharCode(e.getInt16()),t-=2;else g=e.getBytes(f)}var E=void 0===T?null:{bitStringContents:T};return r.create(p,c,y,g,E)}r.fromDer=function(e,r){return void 0===r&&(r={strict:!0,decodeBitStrings:!0}),"boolean"==typeof r&&(r={strict:r,decodeBitStrings:!0}),"strict"in r||(r.strict=!0),"decodeBitStrings"in r||(r.decodeBitStrings=!0),"string"==typeof e&&(e=t.util.createBuffer(e)),s(e,e.length(),0,r)},r.toDer=function(e){var n=t.util.createBuffer(),a=e.tagClass|e.type,s=t.util.createBuffer(),i=!1;if("bitStringContents"in e&&(i=!0,e.original&&(i=r.equals(e,e.original))),i)s.putBytes(e.bitStringContents);else if(e.composed){e.constructed?a|=32:s.putByte(0);for(var u=0;u<e.value.length;++u)void 0!==e.value[u]&&s.putBuffer(r.toDer(e.value[u]))}else if(e.type===r.Type.BMPSTRING)for(u=0;u<e.value.length;++u)s.putInt16(e.value.charCodeAt(u));else e.type===r.Type.INTEGER&&e.value.length>1&&(0===e.value.charCodeAt(0)&&0==(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128==(128&e.value.charCodeAt(1)))?s.putBytes(e.value.substr(1)):s.putBytes(e.value);if(n.putByte(a),s.length()<=127)n.putByte(127&s.length());else{var o=s.length(),l="";do{l+=String.fromCharCode(255&o),o>>>=8}while(o>0);n.putByte(128|l.length);for(u=l.length-1;u>=0;--u)n.putByte(l.charCodeAt(u))}return n.putBuffer(s),n},r.oidToDer=function(e){var r,n,a,s,i=e.split("."),u=t.util.createBuffer();u.putByte(40*parseInt(i[0],10)+parseInt(i[1],10));for(var o=2;o<i.length;++o){r=!0,n=[],a=parseInt(i[o],10);do{s=127&a,a>>>=7,r||(s|=128),n.push(s),r=!1}while(a>0);for(var l=n.length-1;l>=0;--l)u.putByte(n[l])}return u},r.derToOid=function(e){var r;"string"==typeof e&&(e=t.util.createBuffer(e));var n=e.getByte();r=Math.floor(n/40)+"."+n%40;for(var a=0;e.length()>0;)a<<=7,128&(n=e.getByte())?a+=127&n:(r+="."+(a+n),a=0);return r},r.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(e.substr(2,2),10)-1,a=parseInt(e.substr(4,2),10),s=parseInt(e.substr(6,2),10),i=parseInt(e.substr(8,2),10),u=0;if(e.length>11){var o=e.charAt(10),l=10;"+"!==o&&"-"!==o&&(u=parseInt(e.substr(10,2),10),l+=2)}if(t.setUTCFullYear(r,n,a),t.setUTCHours(s,i,u,0),l&&("+"===(o=e.charAt(l))||"-"===o)){var p=60*parseInt(e.substr(l+1,2),10)+parseInt(e.substr(l+4,2),10);p*=6e4,"+"===o?t.setTime(+t-p):t.setTime(+t+p)}return t},r.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),n=parseInt(e.substr(4,2),10)-1,a=parseInt(e.substr(6,2),10),s=parseInt(e.substr(8,2),10),i=parseInt(e.substr(10,2),10),u=parseInt(e.substr(12,2),10),o=0,l=0,p=!1;"Z"===e.charAt(e.length-1)&&(p=!0);var c=e.length-5,g=e.charAt(c);"+"!==g&&"-"!==g||(l=60*parseInt(e.substr(c+1,2),10)+parseInt(e.substr(c+4,2),10),l*=6e4,"+"===g&&(l*=-1),p=!0);return"."===e.charAt(14)&&(o=1e3*parseFloat(e.substr(14),10)),p?(t.setUTCFullYear(r,n,a),t.setUTCHours(s,i,u,o),t.setTime(+t+l)):(t.setFullYear(r,n,a),t.setHours(s,i,u,o)),t},r.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(t+="0"),t+=r[n];return t+="Z"},r.dateToGeneralizedTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push(""+e.getUTCFullYear()),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(t+="0"),t+=r[n];return t+="Z"},r.integerToDer=function(e){var r=t.util.createBuffer();if(e>=-128&&e<128)return r.putSignedInt(e,8);if(e>=-32768&&e<32768)return r.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return r.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return r.putSignedInt(e,32);var n=new Error("Integer too large; max is 32-bits.");throw n.integer=e,n},r.derToInteger=function(e){"string"==typeof e&&(e=t.util.createBuffer(e));var r=8*e.length();if(r>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(r)},r.validate=function(e,n,a,s){var i=!1;if(e.tagClass!==n.tagClass&&void 0!==n.tagClass||e.type!==n.type&&void 0!==n.type)s&&(e.tagClass!==n.tagClass&&s.push("["+n.name+'] Expected tag class "'+n.tagClass+'", got "'+e.tagClass+'"'),e.type!==n.type&&s.push("["+n.name+'] Expected type "'+n.type+'", got "'+e.type+'"'));else if(e.constructed===n.constructed||void 0===n.constructed){if(i=!0,n.value&&t.util.isArray(n.value))for(var u=0,o=0;i&&o<n.value.length;++o)i=n.value[o].optional||!1,e.value[u]&&((i=r.validate(e.value[u],n.value[o],a,s))?++u:n.value[o].optional&&(i=!0)),!i&&s&&s.push("["+n.name+'] Tag class "'+n.tagClass+'", type "'+n.type+'" expected value length "'+n.value.length+'", got "'+e.value.length+'"');if(i&&a)if(n.capture&&(a[n.capture]=e.value),n.captureAsn1&&(a[n.captureAsn1]=e),n.captureBitStringContents&&"bitStringContents"in e&&(a[n.captureBitStringContents]=e.bitStringContents),n.captureBitStringValue&&"bitStringContents"in e)if(e.bitStringContents.length<2)a[n.captureBitStringValue]="";else{if(0!==e.bitStringContents.charCodeAt(0))throw new Error("captureBitStringValue only supported for zero unused bits");a[n.captureBitStringValue]=e.bitStringContents.slice(1)}}else s&&s.push("["+n.name+'] Expected constructed "'+n.constructed+'", got "'+e.constructed+'"');return i};var i=/[^\\u0000-\\u00ff]/;r.prettyPrint=function(e,n,a){var s="";a=a||2,(n=n||0)>0&&(s+="\n");for(var u="",o=0;o<n*a;++o)u+=" ";switch(s+=u+"Tag: ",e.tagClass){case r.Class.UNIVERSAL:s+="Universal:";break;case r.Class.APPLICATION:s+="Application:";break;case r.Class.CONTEXT_SPECIFIC:s+="Context-Specific:";break;case r.Class.PRIVATE:s+="Private:"}if(e.tagClass===r.Class.UNIVERSAL)switch(s+=e.type,e.type){case r.Type.NONE:s+=" (None)";break;case r.Type.BOOLEAN:s+=" (Boolean)";break;case r.Type.INTEGER:s+=" (Integer)";break;case r.Type.BITSTRING:s+=" (Bit string)";break;case r.Type.OCTETSTRING:s+=" (Octet string)";break;case r.Type.NULL:s+=" (Null)";break;case r.Type.OID:s+=" (Object Identifier)";break;case r.Type.ODESC:s+=" (Object Descriptor)";break;case r.Type.EXTERNAL:s+=" (External or Instance of)";break;case r.Type.REAL:s+=" (Real)";break;case r.Type.ENUMERATED:s+=" (Enumerated)";break;case r.Type.EMBEDDED:s+=" (Embedded PDV)";break;case r.Type.UTF8:s+=" (UTF8)";break;case r.Type.ROID:s+=" (Relative Object Identifier)";break;case r.Type.SEQUENCE:s+=" (Sequence)";break;case r.Type.SET:s+=" (Set)";break;case r.Type.PRINTABLESTRING:s+=" (Printable String)";break;case r.Type.IA5String:s+=" (IA5String (ASCII))";break;case r.Type.UTCTIME:s+=" (UTC time)";break;case r.Type.GENERALIZEDTIME:s+=" (Generalized time)";break;case r.Type.BMPSTRING:s+=" (BMP String)"}else s+=e.type;if(s+="\n",s+=u+"Constructed: "+e.constructed+"\n",e.composed){var l=0,p="";for(o=0;o<e.value.length;++o)void 0!==e.value[o]&&(l+=1,p+=r.prettyPrint(e.value[o],n+1,a),o+1<e.value.length&&(p+=","));s+=u+"Sub values: "+l+p}else{if(s+=u+"Value: ",e.type===r.Type.OID){var c=r.derToOid(e.value);s+=c,t.pki&&t.pki.oids&&c in t.pki.oids&&(s+=" ("+t.pki.oids[c]+") ")}if(e.type===r.Type.INTEGER)try{s+=r.derToInteger(e.value)}catch(T){s+="0x"+t.util.bytesToHex(e.value)}else if(e.type===r.Type.BITSTRING){if(e.value.length>1?s+="0x"+t.util.bytesToHex(e.value.slice(1)):s+="(none)",e.value.length>0){var g=e.value.charCodeAt(0);1==g?s+=" (1 unused bit shown)":g>1&&(s+=" ("+g+" unused bits shown)")}}else e.type===r.Type.OCTETSTRING?(i.test(e.value)||(s+="("+e.value+") "),s+="0x"+t.util.bytesToHex(e.value)):e.type===r.Type.UTF8?s+=t.util.decodeUtf8(e.value):e.type===r.Type.PRINTABLESTRING||e.type===r.Type.IA5String?s+=e.value:i.test(e.value)?s+="0x"+t.util.bytesToHex(e.value):0===e.value.length?s+="[null]":s+=e.value}return s};
|
||
},{"./forge":"sQ2N","./util":"2FVR","./oids":"Qnxl"}],"2/nO":[function(require,module,exports) {
|
||
var e=require("./forge");function r(r,t){e.cipher.registerAlgorithm(r,function(){return new e.des.Algorithm(r,t)})}require("./cipher"),require("./cipherModes"),require("./util"),module.exports=e.des=e.des||{},e.des.startEncrypting=function(e,r,t,i){var n=h({key:e,output:t,decrypt:!1,mode:i||(null===r?"ECB":"CBC")});return n.start(r),n},e.des.createEncryptionCipher=function(e,r){return h({key:e,output:null,decrypt:!1,mode:r})},e.des.startDecrypting=function(e,r,t,i){var n=h({key:e,output:t,decrypt:!0,mode:i||(null===r?"ECB":"CBC")});return n.start(r),n},e.des.createDecryptionCipher=function(e,r){return h({key:e,output:null,decrypt:!0,mode:r})},e.des.Algorithm=function(e,r){var t=this;t.name=e,t.mode=new r({blockSize:8,cipher:{encrypt:function(e,r){return d(t._keys,e,r,!1)},decrypt:function(e,r){return d(t._keys,e,r,!0)}}}),t._init=!1},e.des.Algorithm.prototype.initialize=function(r){if(!this._init){var t=e.util.createBuffer(r.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=a(t),this._init=!0}},r("DES-ECB",e.cipher.modes.ecb),r("DES-CBC",e.cipher.modes.cbc),r("DES-CFB",e.cipher.modes.cfb),r("DES-OFB",e.cipher.modes.ofb),r("DES-CTR",e.cipher.modes.ctr),r("3DES-ECB",e.cipher.modes.ecb),r("3DES-CBC",e.cipher.modes.cbc),r("3DES-CFB",e.cipher.modes.cfb),r("3DES-OFB",e.cipher.modes.ofb),r("3DES-CTR",e.cipher.modes.ctr);var t=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],i=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],n=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],c=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],o=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],u=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],p=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],s=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function a(e){for(var r,t=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],i=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],n=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],c=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],o=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],u=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],p=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],s=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],a=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],d=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],h=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],f=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],l=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],y=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],m=e.length()>8?3:1,C=[],E=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],v=0,B=0;B<m;B++){var D=e.getInt32(),g=e.getInt32();D^=(r=252645135&(D>>>4^g))<<4,D^=r=65535&((g^=r)>>>-16^D),D^=(r=858993459&(D>>>2^(g^=r<<-16)))<<2,D^=r=65535&((g^=r)>>>-16^D),D^=(r=1431655765&(D>>>1^(g^=r<<-16)))<<1,D^=r=16711935&((g^=r)>>>8^D),r=(D^=(r=1431655765&(D>>>1^(g^=r<<8)))<<1)<<8|(g^=r)>>>20&240,D=g<<24|g<<8&16711680|g>>>8&65280|g>>>24&240,g=r;for(var S=0;S<E.length;++S){E[S]?(D=D<<2|D>>>26,g=g<<2|g>>>26):(D=D<<1|D>>>27,g=g<<1|g>>>27);var k=t[(D&=-15)>>>28]|i[D>>>24&15]|n[D>>>20&15]|c[D>>>16&15]|o[D>>>12&15]|u[D>>>8&15]|p[D>>>4&15],b=s[(g&=-15)>>>28]|a[g>>>24&15]|d[g>>>20&15]|h[g>>>16&15]|f[g>>>12&15]|l[g>>>8&15]|y[g>>>4&15];r=65535&(b>>>16^k),C[v++]=k^r,C[v++]=b^r<<16}}return C}function d(e,r,a,d){var h,f,l=32===e.length?3:9;h=3===l?d?[30,-2,-2]:[0,32,2]:d?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var y=r[0],m=r[1];y^=(f=252645135&(y>>>4^m))<<4,y^=(f=65535&(y>>>16^(m^=f)))<<16,y^=f=858993459&((m^=f)>>>2^y),y^=f=16711935&((m^=f<<2)>>>8^y),y=(y^=(f=1431655765&(y>>>1^(m^=f<<8)))<<1)<<1|y>>>31,m=(m^=f)<<1|m>>>31;for(var C=0;C<l;C+=3){for(var E=h[C+1],v=h[C+2],B=h[C];B!=E;B+=v){var D=m^e[B],g=(m>>>4|m<<28)^e[B+1];f=y,y=m,m=f^(i[D>>>24&63]|c[D>>>16&63]|u[D>>>8&63]|s[63&D]|t[g>>>24&63]|n[g>>>16&63]|o[g>>>8&63]|p[63&g])}f=y,y=m,m=f}m=m>>>1|m<<31,m^=f=1431655765&((y=y>>>1|y<<31)>>>1^m),m^=(f=16711935&(m>>>8^(y^=f<<1)))<<8,m^=(f=858993459&(m>>>2^(y^=f)))<<2,m^=f=65535&((y^=f)>>>16^m),m^=f=252645135&((y^=f<<16)>>>4^m),y^=f<<4,a[0]=y,a[1]=m}function h(r){var t,i="DES-"+((r=r||{}).mode||"CBC").toUpperCase(),n=(t=r.decrypt?e.cipher.createDecipher(i,r.key):e.cipher.createCipher(i,r.key)).start;return t.start=function(r,i){var c=null;i instanceof e.util.ByteBuffer&&(c=i,i={}),(i=i||{}).output=c,i.iv=r,n.call(t,i)},t}
|
||
},{"./forge":"sQ2N","./cipher":"rMNY","./cipherModes":"pPJ9","./util":"2FVR"}],"dsGL":[function(require,module,exports) {
|
||
var m=require("./forge");module.exports=m.md=m.md||{},m.md.algorithms=m.md.algorithms||{};
|
||
},{"./forge":"sQ2N"}],"xzKI":[function(require,module,exports) {
|
||
var t=require("./forge");require("./md"),require("./util");var e=module.exports=t.hmac=t.hmac||{};e.create=function(){var e=null,r=null,u=null,a=null,i={start:function(i,l){if(null!==i)if("string"==typeof i){if(!((i=i.toLowerCase())in t.md.algorithms))throw new Error('Unknown hash algorithm "'+i+'"');r=t.md.algorithms[i].create()}else r=i;if(null===l)l=e;else{if("string"==typeof l)l=t.util.createBuffer(l);else if(t.util.isArray(l)){var n=l;l=t.util.createBuffer();for(var f=0;f<n.length;++f)l.putByte(n[f])}var o=l.length();o>r.blockLength&&(r.start(),r.update(l.bytes()),l=r.digest()),u=t.util.createBuffer(),a=t.util.createBuffer(),o=l.length();for(f=0;f<o;++f){n=l.at(f);u.putByte(54^n),a.putByte(92^n)}if(o<r.blockLength)for(n=r.blockLength-o,f=0;f<n;++f)u.putByte(54),a.putByte(92);e=l,u=u.bytes(),a=a.bytes()}r.start(),r.update(u)},update:function(t){r.update(t)},getMac:function(){var t=r.digest().bytes();return r.start(),r.update(a),r.update(t),r.digest()}};return i.digest=i.getMac,i};
|
||
},{"./forge":"sQ2N","./md":"dsGL","./util":"2FVR"}],"t4Bf":[function(require,module,exports) {
|
||
var Buffer = require("buffer").Buffer;
|
||
var t=require("buffer").Buffer;function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var e=require("./forge");require("./hmac"),require("./md"),require("./util");var n,i=e.pkcs5=e.pkcs5||{};e.util.isNodejs&&!e.options.usePureJavaScript&&(n=require("crypto")),module.exports=e.pbkdf2=i.pbkdf2=function(i,u,o,l,f,s){if("function"==typeof f&&(s=f,f=null),e.util.isNodejs&&!e.options.usePureJavaScript&&n.pbkdf2&&(null===f||"object"!==r(f))&&(n.pbkdf2Sync.length>4||!f||"sha1"===f))return"string"!=typeof f&&(f="sha1"),i=t.from(i,"binary"),u=t.from(u,"binary"),s?4===n.pbkdf2Sync.length?n.pbkdf2(i,u,o,l,function(t,r){if(t)return s(t);s(null,r.toString("binary"))}):n.pbkdf2(i,u,o,l,f,function(t,r){if(t)return s(t);s(null,r.toString("binary"))}):4===n.pbkdf2Sync.length?n.pbkdf2Sync(i,u,o,l).toString("binary"):n.pbkdf2Sync(i,u,o,l,f).toString("binary");if(null==f&&(f="sha1"),"string"==typeof f){if(!(f in e.md.algorithms))throw new Error("Unknown hash algorithm: "+f);f=e.md[f].create()}var a=f.digestLength;if(l>4294967295*a){var y=new Error("Derived key is too long.");if(s)return s(y);throw y}var p=Math.ceil(l/a),c=l-(p-1)*a,d=e.hmac.create();d.start(f,i);var b,g,m,h="";if(!s){for(var S=1;S<=p;++S){d.start(null,null),d.update(u),d.update(e.util.int32ToBytes(S)),b=m=d.digest().getBytes();for(var k=2;k<=o;++k)d.start(null,null),d.update(m),g=d.digest().getBytes(),b=e.util.xorBytes(b,g,a),m=g;h+=S<p?b:b.substr(0,c)}return h}S=1;function v(){if(S>p)return s(null,h);d.start(null,null),d.update(u),d.update(e.util.int32ToBytes(S)),b=m=d.digest().getBytes(),k=2,B()}function B(){if(k<=o)return d.start(null,null),d.update(m),g=d.digest().getBytes(),b=e.util.xorBytes(b,g,a),m=g,++k,e.util.setImmediate(B);h+=S<p?b:b.substr(0,c),++S,v()}v()};
|
||
},{"./forge":"sQ2N","./hmac":"xzKI","./md":"dsGL","./util":"2FVR","crypto":"sC8V","buffer":"sC8V"}],"8Qcv":[function(require,module,exports) {
|
||
var e=require("./forge");require("./util");var r=module.exports=e.pem=e.pem||{};function n(e){for(var r=e.name+": ",n=[],a=function(e,r){return" "+r},t=0;t<e.values.length;++t)n.push(e.values[t].replace(/^(\S+\r\n)/,a));r+=n.join(",")+"\r\n";var o=0,s=-1;for(t=0;t<r.length;++t,++o)if(o>65&&-1!==s){var l=r[s];","===l?(++s,r=r.substr(0,s)+"\r\n "+r.substr(s)):r=r.substr(0,s)+"\r\n"+l+r.substr(s+1),o=t-s-1,s=-1,++t}else" "!==r[t]&&"\t"!==r[t]&&","!==r[t]||(s=t);return r}function a(e){return e.replace(/^\s+/,"")}r.encode=function(r,a){a=a||{};var t,o="-----BEGIN "+r.type+"-----\r\n";if(r.procType&&(o+=n(t={name:"Proc-Type",values:[String(r.procType.version),r.procType.type]})),r.contentDomain&&(o+=n(t={name:"Content-Domain",values:[r.contentDomain]})),r.dekInfo&&(t={name:"DEK-Info",values:[r.dekInfo.algorithm]},r.dekInfo.parameters&&t.values.push(r.dekInfo.parameters),o+=n(t)),r.headers)for(var s=0;s<r.headers.length;++s)o+=n(r.headers[s]);return r.procType&&(o+="\r\n"),o+=e.util.encode64(r.body,a.maxline||64)+"\r\n",o+="-----END "+r.type+"-----\r\n"},r.decode=function(r){for(var n,t=[],o=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,s=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,l=/\r?\n/;n=o.exec(r);){var i={type:n[1],procType:null,contentDomain:null,dekInfo:null,headers:[],body:e.util.decode64(n[3])};if(t.push(i),n[2]){for(var f=n[2].split(l),u=0;n&&u<f.length;){for(var p=f[u].replace(/\s+$/,""),d=u+1;d<f.length;++d){var m=f[d];if(!/\s/.test(m[0]))break;p+=m,u=d}if(n=p.match(s)){for(var h={name:n[1],values:[]},c=n[2].split(","),v=0;v<c.length;++v)h.values.push(a(c[v]));if(i.procType)if(i.contentDomain||"Content-Domain"!==h.name)if(i.dekInfo||"DEK-Info"!==h.name)i.headers.push(h);else{if(0===h.values.length)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');i.dekInfo={algorithm:c[0],parameters:c[1]||null}}else i.contentDomain=c[0]||"";else{if("Proc-Type"!==h.name)throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==h.values.length)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');i.procType={version:c[0],type:c[1]}}}++u}if("ENCRYPTED"===i.procType&&!i.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(0===t.length)throw new Error("Invalid PEM formatted message.");return t};
|
||
},{"./forge":"sQ2N","./util":"2FVR"}],"ElUT":[function(require,module,exports) {
|
||
var e=require("./forge");require("./md"),require("./util");var t=module.exports=e.sha256=e.sha256||{};e.md.sha256=e.md.algorithms.sha256=t,t.create=function(){n||g();var t=null,r=e.util.createBuffer(),s=new Array(64),l={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){l.messageLength=0,l.fullMessageLength=l.messageLength64=[];for(var h=l.messageLengthSize/4,n=0;n<h;++n)l.fullMessageLength.push(0);return r=e.util.createBuffer(),t={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},l}};return l.start(),l.update=function(h,n){"utf8"===n&&(h=e.util.encodeUtf8(h));var g=h.length;l.messageLength+=g,g=[g/4294967296>>>0,g>>>0];for(var a=l.fullMessageLength.length-1;a>=0;--a)l.fullMessageLength[a]+=g[1],g[1]=g[0]+(l.fullMessageLength[a]/4294967296>>>0),l.fullMessageLength[a]=l.fullMessageLength[a]>>>0,g[0]=g[1]/4294967296>>>0;return r.putBytes(h),u(t,s,r),(r.read>2048||0===r.length())&&r.compact(),l},l.digest=function(){var n=e.util.createBuffer();n.putBytes(r.bytes());var g,a=l.fullMessageLength[l.fullMessageLength.length-1]+l.messageLengthSize&l.blockLength-1;n.putBytes(h.substr(0,l.blockLength-a));for(var f=8*l.fullMessageLength[0],i=0;i<l.fullMessageLength.length-1;++i)f+=(g=8*l.fullMessageLength[i+1])/4294967296>>>0,n.putInt32(f>>>0),f=g>>>0;n.putInt32(f);var o={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4,h5:t.h5,h6:t.h6,h7:t.h7};u(o,s,n);var L=e.util.createBuffer();return L.putInt32(o.h0),L.putInt32(o.h1),L.putInt32(o.h2),L.putInt32(o.h3),L.putInt32(o.h4),L.putInt32(o.h5),L.putInt32(o.h6),L.putInt32(o.h7),L},l};var h=null,n=!1,r=null;function g(){h=String.fromCharCode(128),h+=e.util.fillString(String.fromCharCode(0),64),r=[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],n=!0}function u(e,t,h){for(var n,g,u,s,l,a,f,i,o,L,c,p,m,v=h.length();v>=64;){for(l=0;l<16;++l)t[l]=h.getInt32();for(;l<64;++l)n=((n=t[l-2])>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,g=((g=t[l-15])>>>7|g<<25)^(g>>>18|g<<14)^g>>>3,t[l]=n+t[l-7]+g+t[l-16]|0;for(a=e.h0,f=e.h1,i=e.h2,o=e.h3,L=e.h4,c=e.h5,p=e.h6,m=e.h7,l=0;l<64;++l)u=(a>>>2|a<<30)^(a>>>13|a<<19)^(a>>>22|a<<10),s=a&f|i&(a^f),n=m+((L>>>6|L<<26)^(L>>>11|L<<21)^(L>>>25|L<<7))+(p^L&(c^p))+r[l]+t[l],m=p,p=c,c=L,L=o+n>>>0,o=i,i=f,f=a,a=n+(g=u+s)>>>0;e.h0=e.h0+a|0,e.h1=e.h1+f|0,e.h2=e.h2+i|0,e.h3=e.h3+o|0,e.h4=e.h4+L|0,e.h5=e.h5+c|0,e.h6=e.h6+p|0,e.h7=e.h7+m|0,v-=64}}
|
||
},{"./forge":"sQ2N","./md":"dsGL","./util":"2FVR"}],"ilYG":[function(require,module,exports) {
|
||
var process = require("process");
|
||
var e=require("process"),t=require("./forge");require("./util");var r=null;!t.util.isNodejs||t.options.usePureJavaScript||e.versions["node-webkit"]||(r=require("crypto"));var n=module.exports=t.prng=t.prng||{};n.create=function(e){for(var n={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},o=e.md,s=new Array(32),l=0;l<32;++l)s[l]=o.create();function a(){if(n.pools[0].messageLength>=32)return i();var e=32-n.pools[0].messageLength<<5;n.collect(n.seedFileSync(e)),i()}function i(){n.reseeds=4294967295===n.reseeds?0:n.reseeds+1;var e=n.plugin.md.create();e.update(n.keyBytes);for(var t=1,r=0;r<32;++r)n.reseeds%t==0&&(e.update(n.pools[r].digest().getBytes()),n.pools[r].start()),t<<=1;n.keyBytes=e.digest().getBytes(),e.start(),e.update(n.keyBytes);var o=e.digest().getBytes();n.key=n.plugin.formatKey(n.keyBytes),n.seed=n.plugin.formatSeed(o),n.generated=0}function u(e){var r=null,n=t.util.globalScope,o=n.crypto||n.msCrypto;o&&o.getRandomValues&&(r=function(e){return o.getRandomValues(e)});var s=t.util.createBuffer();if(r)for(;s.length()<e;){var l=Math.max(1,Math.min(e-s.length(),65536)/4),a=new Uint32Array(Math.floor(l));try{r(a);for(var i=0;i<a.length;++i)s.putInt32(a[i])}catch(c){if(!("undefined"!=typeof QuotaExceededError&&c instanceof QuotaExceededError))throw c}}if(s.length()<e)for(var u,g,f,d=Math.floor(65536*Math.random());s.length()<e;){g=16807*(65535&d),g+=(32767&(u=16807*(d>>16)))<<16,d=4294967295&(g=(2147483647&(g+=u>>15))+(g>>31));for(i=0;i<3;++i)f=d>>>(i<<3),f^=Math.floor(256*Math.random()),s.putByte(String.fromCharCode(255&f))}return s.getBytes(e)}return n.pools=s,n.pool=0,n.generate=function(e,r){if(!r)return n.generateSync(e);var o=n.plugin.cipher,s=n.plugin.increment,l=n.plugin.formatKey,a=n.plugin.formatSeed,u=t.util.createBuffer();n.key=null,function g(f){if(f)return r(f);if(u.length()>=e)return r(null,u.getBytes(e));n.generated>1048575&&(n.key=null);if(null===n.key)return t.util.nextTick(function(){!function(e){if(n.pools[0].messageLength>=32)return i(),e();var t=32-n.pools[0].messageLength<<5;n.seedFile(t,function(t,r){if(t)return e(t);n.collect(r),i(),e()})}(g)});var d=o(n.key,n.seed);n.generated+=d.length;u.putBytes(d);n.key=l(o(n.key,s(n.seed)));n.seed=a(o(n.key,n.seed));t.util.setImmediate(g)}()},n.generateSync=function(e){var r=n.plugin.cipher,o=n.plugin.increment,s=n.plugin.formatKey,l=n.plugin.formatSeed;n.key=null;for(var i=t.util.createBuffer();i.length()<e;){n.generated>1048575&&(n.key=null),null===n.key&&a();var u=r(n.key,n.seed);n.generated+=u.length,i.putBytes(u),n.key=s(r(n.key,o(n.seed))),n.seed=l(r(n.key,n.seed))}return i.getBytes(e)},r?(n.seedFile=function(e,t){r.randomBytes(e,function(e,r){if(e)return t(e);t(null,r.toString())})},n.seedFileSync=function(e){return r.randomBytes(e).toString()}):(n.seedFile=function(e,t){try{t(null,u(e))}catch(r){t(r)}},n.seedFileSync=u),n.collect=function(e){for(var t=e.length,r=0;r<t;++r)n.pools[n.pool].update(e.substr(r,1)),n.pool=31===n.pool?0:n.pool+1},n.collectInt=function(e,t){for(var r="",o=0;o<t;o+=8)r+=String.fromCharCode(e>>o&255);n.collect(r)},n.registerWorker=function(e){if(e===self)n.seedFile=function(e,t){self.addEventListener("message",function e(r){var n=r.data;n.forge&&n.forge.prng&&(self.removeEventListener("message",e),t(n.forge.prng.err,n.forge.prng.bytes))}),self.postMessage({forge:{prng:{needed:e}}})};else{e.addEventListener("message",function(t){var r=t.data;r.forge&&r.forge.prng&&n.seedFile(r.forge.prng.needed,function(t,r){e.postMessage({forge:{prng:{err:t,bytes:r}}})})})}},n};
|
||
},{"./forge":"sQ2N","./util":"2FVR","crypto":"sC8V","process":"sC8V"}],"O9pb":[function(require,module,exports) {
|
||
var e=require("./forge");require("./aes"),require("./sha256"),require("./prng"),require("./util"),e.random&&e.random.getBytes?module.exports=e.random:function(t){var n={},r=new Array(4),o=e.util.createBuffer();function a(){var t=e.prng.create(n);return t.getBytes=function(e,n){return t.generate(e,n)},t.getBytesSync=function(e){return t.generate(e)},t}n.formatKey=function(t){var n=e.util.createBuffer(t);return(t=new Array(4))[0]=n.getInt32(),t[1]=n.getInt32(),t[2]=n.getInt32(),t[3]=n.getInt32(),e.aes._expandKey(t,!1)},n.formatSeed=function(t){var n=e.util.createBuffer(t);return(t=new Array(4))[0]=n.getInt32(),t[1]=n.getInt32(),t[2]=n.getInt32(),t[3]=n.getInt32(),t},n.cipher=function(t,n){return e.aes._updateBlock(t,n,r,!1),o.putInt32(r[0]),o.putInt32(r[1]),o.putInt32(r[2]),o.putInt32(r[3]),o.getBytes()},n.increment=function(e){return++e[3],e},n.md=e.md.sha256;var u=a(),i=null,c=e.util.globalScope,f=c.crypto||c.msCrypto;if(f&&f.getRandomValues&&(i=function(e){return f.getRandomValues(e)}),e.options.usePureJavaScript||!e.util.isNodejs&&!i){if("undefined"==typeof window||window.document,u.collectInt(+new Date,32),"undefined"!=typeof navigator){var l="";for(var d in navigator)try{"string"==typeof navigator[d]&&(l+=navigator[d])}catch(g){}u.collect(l),l=null}t&&(t().mousemove(function(e){u.collectInt(e.clientX,16),u.collectInt(e.clientY,16)}),t().keypress(function(e){u.collectInt(e.charCode,8)}))}if(e.random)for(var d in u)e.random[d]=u[d];else e.random=u;e.random.createInstance=a,module.exports=e.random}("undefined"!=typeof jQuery?jQuery:null);
|
||
},{"./forge":"sQ2N","./aes":"tw3v","./sha256":"ElUT","./prng":"ilYG","./util":"2FVR"}],"AoX7":[function(require,module,exports) {
|
||
var t=require("./forge");require("./util");var r=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],e=[1,2,3,5],n=function(t,r){return t<<r&65535|(65535&t)>>16-r},u=function(t,r){return(65535&t)>>r|t<<16-r&65535};module.exports=t.rc2=t.rc2||{},t.rc2.expandKey=function(e,n){"string"==typeof e&&(e=t.util.createBuffer(e)),n=n||128;var u,f=e,i=e.length(),c=n,a=Math.ceil(c/8),o=255>>(7&c);for(u=i;u<128;u++)f.putByte(r[f.at(u-1)+f.at(u-i)&255]);for(f.setAt(128-a,r[f.at(128-a)&o]),u=127-a;u>=0;u--)f.setAt(u,r[f.at(u+1)^f.at(u+a)]);return f};var f=function(r,f,i){var c,a,o,l,p=!1,g=null,h=null,s=null,v=[];for(r=t.rc2.expandKey(r,f),o=0;o<64;o++)v.push(r.getInt16Le());i?(c=function(t){for(o=0;o<4;o++)t[o]+=v[l]+(t[(o+3)%4]&t[(o+2)%4])+(~t[(o+3)%4]&t[(o+1)%4]),t[o]=n(t[o],e[o]),l++},a=function(t){for(o=0;o<4;o++)t[o]+=v[63&t[(o+3)%4]]}):(c=function(t){for(o=3;o>=0;o--)t[o]=u(t[o],e[o]),t[o]-=v[l]+(t[(o+3)%4]&t[(o+2)%4])+(~t[(o+3)%4]&t[(o+1)%4]),l--},a=function(t){for(o=3;o>=0;o--)t[o]-=v[63&t[(o+3)%4]]});var y=function(t){var r=[];for(o=0;o<4;o++){var e=g.getInt16Le();null!==s&&(i?e^=s.getInt16Le():s.putInt16Le(e)),r.push(65535&e)}l=i?0:63;for(var n=0;n<t.length;n++)for(var u=0;u<t[n][0];u++)t[n][1](r);for(o=0;o<4;o++)null!==s&&(i?s.putInt16Le(r[o]):r[o]^=s.getInt16Le()),h.putInt16Le(r[o])},B=null;return B={start:function(r,e){r&&"string"==typeof r&&(r=t.util.createBuffer(r)),p=!1,g=t.util.createBuffer(),h=e||new t.util.createBuffer,s=r,B.output=h},update:function(t){for(p||g.putBuffer(t);g.length()>=8;)y([[5,c],[1,a],[6,c],[1,a],[5,c]])},finish:function(t){var r=!0;if(i)if(t)r=t(8,g,!i);else{var e=8===g.length()?8:8-g.length();g.fillWithByte(e,e)}if(r&&(p=!0,B.update()),!i&&(r=0===g.length()))if(t)r=t(8,h,!i);else{var n=h.length(),u=h.at(n-1);u>n?r=!1:h.truncate(u)}return r}}};t.rc2.startEncrypting=function(r,e,n){var u=t.rc2.createEncryptionCipher(r,128);return u.start(e,n),u},t.rc2.createEncryptionCipher=function(t,r){return f(t,r,!0)},t.rc2.startDecrypting=function(r,e,n){var u=t.rc2.createDecryptionCipher(r,128);return u.start(e,n),u},t.rc2.createDecryptionCipher=function(t,r){return f(t,r,!1)};
|
||
},{"./forge":"sQ2N","./util":"2FVR"}],"Xh/Z":[function(require,module,exports) {
|
||
var t,i=require("./forge");module.exports=i.jsbn=i.jsbn||{};var o=0xdeadbeefcafe,r=15715070==(16777215&o);function s(t,i,o){this.data=[],null!=t&&("number"==typeof t?this.fromNumber(t,i,o):null==i&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,i))}function a(){return new s(null)}function h(t,i,o,r,s,a){for(;--a>=0;){var h=i*this.data[t++]+o.data[r]+s;s=Math.floor(h/67108864),o.data[r++]=67108863&h}return s}function e(t,i,o,r,s,a){for(var h=32767&i,e=i>>15;--a>=0;){var n=32767&this.data[t],u=this.data[t++]>>15,f=e*n+u*h;s=((n=h*n+((32767&f)<<15)+o.data[r]+(1073741823&s))>>>30)+(f>>>15)+e*u+(s>>>30),o.data[r++]=1073741823&n}return s}function n(t,i,o,r,s,a){for(var h=16383&i,e=i>>14;--a>=0;){var n=16383&this.data[t],u=this.data[t++]>>14,f=e*n+u*h;s=((n=h*n+((16383&f)<<14)+o.data[r]+s)>>28)+(f>>14)+e*u,o.data[r++]=268435455&n}return s}i.jsbn.BigInteger=s,"undefined"==typeof navigator?(s.prototype.am=n,t=28):r&&"Microsoft Internet Explorer"==navigator.appName?(s.prototype.am=e,t=30):r&&"Netscape"!=navigator.appName?(s.prototype.am=h,t=26):(s.prototype.am=n,t=28),s.prototype.DB=t,s.prototype.DM=(1<<t)-1,s.prototype.DV=1<<t;var u=52;s.prototype.FV=Math.pow(2,u),s.prototype.F1=u-t,s.prototype.F2=2*t-u;var f,p,d="0123456789abcdefghijklmnopqrstuvwxyz",c=new Array;for(f="0".charCodeAt(0),p=0;p<=9;++p)c[f++]=p;for(f="a".charCodeAt(0),p=10;p<36;++p)c[f++]=p;for(f="A".charCodeAt(0),p=10;p<36;++p)c[f++]=p;function m(t){return d.charAt(t)}function l(t,i){var o=c[t.charCodeAt(i)];return null==o?-1:o}function T(t){for(var i=this.t-1;i>=0;--i)t.data[i]=this.data[i];t.t=this.t,t.s=this.s}function v(t){this.t=1,this.s=t<0?-1:0,t>0?this.data[0]=t:t<-1?this.data[0]=t+this.DV:this.t=0}function y(t){var i=a();return i.fromInt(t),i}function D(t,i){var o;if(16==i)o=4;else if(8==i)o=3;else if(256==i)o=8;else if(2==i)o=1;else if(32==i)o=5;else{if(4!=i)return void this.fromRadix(t,i);o=2}this.t=0,this.s=0;for(var r=t.length,a=!1,h=0;--r>=0;){var e=8==o?255&t[r]:l(t,r);e<0?"-"==t.charAt(r)&&(a=!0):(a=!1,0==h?this.data[this.t++]=e:h+o>this.DB?(this.data[this.t-1]|=(e&(1<<this.DB-h)-1)<<h,this.data[this.t++]=e>>this.DB-h):this.data[this.t-1]|=e<<h,(h+=o)>=this.DB&&(h-=this.DB))}8==o&&0!=(128&t[0])&&(this.s=-1,h>0&&(this.data[this.t-1]|=(1<<this.DB-h)-1<<h)),this.clamp(),a&&s.ZERO.subTo(this,this)}function b(){for(var t=this.s&this.DM;this.t>0&&this.data[this.t-1]==t;)--this.t}function B(t){if(this.s<0)return"-"+this.negate().toString(t);var i;if(16==t)i=4;else if(8==t)i=3;else if(2==t)i=1;else if(32==t)i=5;else{if(4!=t)return this.toRadix(t);i=2}var o,r=(1<<i)-1,s=!1,a="",h=this.t,e=this.DB-h*this.DB%i;if(h-- >0)for(e<this.DB&&(o=this.data[h]>>e)>0&&(s=!0,a=m(o));h>=0;)e<i?(o=(this.data[h]&(1<<e)-1)<<i-e,o|=this.data[--h]>>(e+=this.DB-i)):(o=this.data[h]>>(e-=i)&r,e<=0&&(e+=this.DB,--h)),o>0&&(s=!0),s&&(a+=m(o));return s?a:"0"}function g(){var t=a();return s.ZERO.subTo(this,t),t}function S(){return this.s<0?this.negate():this}function M(t){var i=this.s-t.s;if(0!=i)return i;var o=this.t;if(0!=(i=o-t.t))return this.s<0?-i:i;for(;--o>=0;)if(0!=(i=this.data[o]-t.data[o]))return i;return 0}function w(t){var i,o=1;return 0!=(i=t>>>16)&&(t=i,o+=16),0!=(i=t>>8)&&(t=i,o+=8),0!=(i=t>>4)&&(t=i,o+=4),0!=(i=t>>2)&&(t=i,o+=2),0!=(i=t>>1)&&(t=i,o+=1),o}function E(){return this.t<=0?0:this.DB*(this.t-1)+w(this.data[this.t-1]^this.s&this.DM)}function O(t,i){var o;for(o=this.t-1;o>=0;--o)i.data[o+t]=this.data[o];for(o=t-1;o>=0;--o)i.data[o]=0;i.t=this.t+t,i.s=this.s}function R(t,i){for(var o=t;o<this.t;++o)i.data[o-t]=this.data[o];i.t=Math.max(this.t-t,0),i.s=this.s}function V(t,i){var o,r=t%this.DB,s=this.DB-r,a=(1<<s)-1,h=Math.floor(t/this.DB),e=this.s<<r&this.DM;for(o=this.t-1;o>=0;--o)i.data[o+h+1]=this.data[o]>>s|e,e=(this.data[o]&a)<<r;for(o=h-1;o>=0;--o)i.data[o]=0;i.data[h]=e,i.t=this.t+h+1,i.s=this.s,i.clamp()}function q(t,i){i.s=this.s;var o=Math.floor(t/this.DB);if(o>=this.t)i.t=0;else{var r=t%this.DB,s=this.DB-r,a=(1<<r)-1;i.data[0]=this.data[o]>>r;for(var h=o+1;h<this.t;++h)i.data[h-o-1]|=(this.data[h]&a)<<s,i.data[h-o]=this.data[h]>>r;r>0&&(i.data[this.t-o-1]|=(this.s&a)<<s),i.t=this.t-o,i.clamp()}}function A(t,i){for(var o=0,r=0,s=Math.min(t.t,this.t);o<s;)r+=this.data[o]-t.data[o],i.data[o++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r-=t.s;o<this.t;)r+=this.data[o],i.data[o++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;o<t.t;)r-=t.data[o],i.data[o++]=r&this.DM,r>>=this.DB;r-=t.s}i.s=r<0?-1:0,r<-1?i.data[o++]=this.DV+r:r>0&&(i.data[o++]=r),i.t=o,i.clamp()}function N(t,i){var o=this.abs(),r=t.abs(),a=o.t;for(i.t=a+r.t;--a>=0;)i.data[a]=0;for(a=0;a<r.t;++a)i.data[a+o.t]=o.am(0,r.data[a],i,a,0,o.t);i.s=0,i.clamp(),this.s!=t.s&&s.ZERO.subTo(i,i)}function x(t){for(var i=this.abs(),o=t.t=2*i.t;--o>=0;)t.data[o]=0;for(o=0;o<i.t-1;++o){var r=i.am(o,i.data[o],t,2*o,0,1);(t.data[o+i.t]+=i.am(o+1,2*i.data[o],t,2*o+1,r,i.t-o-1))>=i.DV&&(t.data[o+i.t]-=i.DV,t.data[o+i.t+1]=1)}t.t>0&&(t.data[t.t-1]+=i.am(o,i.data[o],t,2*o,0,1)),t.s=0,t.clamp()}function L(t,i,o){var r=t.abs();if(!(r.t<=0)){var h=this.abs();if(h.t<r.t)return null!=i&&i.fromInt(0),void(null!=o&&this.copyTo(o));null==o&&(o=a());var e=a(),n=this.s,u=t.s,f=this.DB-w(r.data[r.t-1]);f>0?(r.lShiftTo(f,e),h.lShiftTo(f,o)):(r.copyTo(e),h.copyTo(o));var p=e.t,d=e.data[p-1];if(0!=d){var c=d*(1<<this.F1)+(p>1?e.data[p-2]>>this.F2:0),m=this.FV/c,l=(1<<this.F1)/c,T=1<<this.F2,v=o.t,y=v-p,D=null==i?a():i;for(e.dlShiftTo(y,D),o.compareTo(D)>=0&&(o.data[o.t++]=1,o.subTo(D,o)),s.ONE.dlShiftTo(p,D),D.subTo(e,e);e.t<p;)e.data[e.t++]=0;for(;--y>=0;){var b=o.data[--v]==d?this.DM:Math.floor(o.data[v]*m+(o.data[v-1]+T)*l);if((o.data[v]+=e.am(0,b,o,y,0,p))<b)for(e.dlShiftTo(y,D),o.subTo(D,o);o.data[v]<--b;)o.subTo(D,o)}null!=i&&(o.drShiftTo(p,i),n!=u&&s.ZERO.subTo(i,i)),o.t=p,o.clamp(),f>0&&o.rShiftTo(f,o),n<0&&s.ZERO.subTo(o,o)}}}function I(t){var i=a();return this.abs().divRemTo(t,null,i),this.s<0&&i.compareTo(s.ZERO)>0&&t.subTo(i,i),i}function Z(t){this.m=t}function F(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}function P(t){return t}function C(t){t.divRemTo(this.m,null,t)}function j(t,i,o){t.multiplyTo(i,o),this.reduce(o)}function k(t,i){t.squareTo(i),this.reduce(i)}function z(){if(this.t<1)return 0;var t=this.data[0];if(0==(1&t))return 0;var i=3&t;return(i=(i=(i=(i=i*(2-(15&t)*i)&15)*(2-(255&t)*i)&255)*(2-((65535&t)*i&65535))&65535)*(2-t*i%this.DV)%this.DV)>0?this.DV-i:-i}function U(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function G(t){var i=a();return t.abs().dlShiftTo(this.m.t,i),i.divRemTo(this.m,null,i),t.s<0&&i.compareTo(s.ZERO)>0&&this.m.subTo(i,i),i}function H(t){var i=a();return t.copyTo(i),this.reduce(i),i}function J(t){for(;t.t<=this.mt2;)t.data[t.t++]=0;for(var i=0;i<this.m.t;++i){var o=32767&t.data[i],r=o*this.mpl+((o*this.mph+(t.data[i]>>15)*this.mpl&this.um)<<15)&t.DM;for(o=i+this.m.t,t.data[o]+=this.m.am(0,r,t,i,0,this.m.t);t.data[o]>=t.DV;)t.data[o]-=t.DV,t.data[++o]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)}function K(t,i){t.squareTo(i),this.reduce(i)}function Q(t,i,o){t.multiplyTo(i,o),this.reduce(o)}function W(){return 0==(this.t>0?1&this.data[0]:this.s)}function X(t,i){if(t>4294967295||t<1)return s.ONE;var o=a(),r=a(),h=i.convert(this),e=w(t)-1;for(h.copyTo(o);--e>=0;)if(i.sqrTo(o,r),(t&1<<e)>0)i.mulTo(r,h,o);else{var n=o;o=r,r=n}return i.revert(o)}function Y(t,i){var o;return o=t<256||i.isEven()?new Z(i):new U(i),this.exp(t,o)}function $(){var t=a();return this.copyTo(t),t}function _(){if(this.s<0){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]}function tt(){return 0==this.t?this.s:this.data[0]<<24>>24}function it(){return 0==this.t?this.s:this.data[0]<<16>>16}function ot(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}function rt(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1}function st(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var i=this.chunkSize(t),o=Math.pow(t,i),r=y(o),s=a(),h=a(),e="";for(this.divRemTo(r,s,h);s.signum()>0;)e=(o+h.intValue()).toString(t).substr(1)+e,s.divRemTo(r,s,h);return h.intValue().toString(t)+e}function at(t,i){this.fromInt(0),null==i&&(i=10);for(var o=this.chunkSize(i),r=Math.pow(i,o),a=!1,h=0,e=0,n=0;n<t.length;++n){var u=l(t,n);u<0?"-"==t.charAt(n)&&0==this.signum()&&(a=!0):(e=i*e+u,++h>=o&&(this.dMultiply(r),this.dAddOffset(e,0),h=0,e=0))}h>0&&(this.dMultiply(Math.pow(i,h)),this.dAddOffset(e,0)),a&&s.ZERO.subTo(this,this)}function ht(t,i,o){if("number"==typeof i)if(t<2)this.fromInt(1);else for(this.fromNumber(t,o),this.testBit(t-1)||this.bitwiseTo(s.ONE.shiftLeft(t-1),mt,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(i);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(s.ONE.shiftLeft(t-1),this);else{var r=new Array,a=7&t;r.length=1+(t>>3),i.nextBytes(r),a>0?r[0]&=(1<<a)-1:r[0]=0,this.fromString(r,256)}}function et(){var t=this.t,i=new Array;i[0]=this.s;var o,r=this.DB-t*this.DB%8,s=0;if(t-- >0)for(r<this.DB&&(o=this.data[t]>>r)!=(this.s&this.DM)>>r&&(i[s++]=o|this.s<<this.DB-r);t>=0;)r<8?(o=(this.data[t]&(1<<r)-1)<<8-r,o|=this.data[--t]>>(r+=this.DB-8)):(o=this.data[t]>>(r-=8)&255,r<=0&&(r+=this.DB,--t)),0!=(128&o)&&(o|=-256),0==s&&(128&this.s)!=(128&o)&&++s,(s>0||o!=this.s)&&(i[s++]=o);return i}function nt(t){return 0==this.compareTo(t)}function ut(t){return this.compareTo(t)<0?this:t}function ft(t){return this.compareTo(t)>0?this:t}function pt(t,i,o){var r,s,a=Math.min(t.t,this.t);for(r=0;r<a;++r)o.data[r]=i(this.data[r],t.data[r]);if(t.t<this.t){for(s=t.s&this.DM,r=a;r<this.t;++r)o.data[r]=i(this.data[r],s);o.t=this.t}else{for(s=this.s&this.DM,r=a;r<t.t;++r)o.data[r]=i(s,t.data[r]);o.t=t.t}o.s=i(this.s,t.s),o.clamp()}function dt(t,i){return t&i}function ct(t){var i=a();return this.bitwiseTo(t,dt,i),i}function mt(t,i){return t|i}function lt(t){var i=a();return this.bitwiseTo(t,mt,i),i}function Tt(t,i){return t^i}function vt(t){var i=a();return this.bitwiseTo(t,Tt,i),i}function yt(t,i){return t&~i}function Dt(t){var i=a();return this.bitwiseTo(t,yt,i),i}function bt(){for(var t=a(),i=0;i<this.t;++i)t.data[i]=this.DM&~this.data[i];return t.t=this.t,t.s=~this.s,t}function Bt(t){var i=a();return t<0?this.rShiftTo(-t,i):this.lShiftTo(t,i),i}function gt(t){var i=a();return t<0?this.lShiftTo(-t,i):this.rShiftTo(t,i),i}function St(t){if(0==t)return-1;var i=0;return 0==(65535&t)&&(t>>=16,i+=16),0==(255&t)&&(t>>=8,i+=8),0==(15&t)&&(t>>=4,i+=4),0==(3&t)&&(t>>=2,i+=2),0==(1&t)&&++i,i}function Mt(){for(var t=0;t<this.t;++t)if(0!=this.data[t])return t*this.DB+St(this.data[t]);return this.s<0?this.t*this.DB:-1}function wt(t){for(var i=0;0!=t;)t&=t-1,++i;return i}function Et(){for(var t=0,i=this.s&this.DM,o=0;o<this.t;++o)t+=wt(this.data[o]^i);return t}function Ot(t){var i=Math.floor(t/this.DB);return i>=this.t?0!=this.s:0!=(this.data[i]&1<<t%this.DB)}function Rt(t,i){var o=s.ONE.shiftLeft(t);return this.bitwiseTo(o,i,o),o}function Vt(t){return this.changeBit(t,mt)}function qt(t){return this.changeBit(t,yt)}function At(t){return this.changeBit(t,Tt)}function Nt(t,i){for(var o=0,r=0,s=Math.min(t.t,this.t);o<s;)r+=this.data[o]+t.data[o],i.data[o++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r+=t.s;o<this.t;)r+=this.data[o],i.data[o++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;o<t.t;)r+=t.data[o],i.data[o++]=r&this.DM,r>>=this.DB;r+=t.s}i.s=r<0?-1:0,r>0?i.data[o++]=r:r<-1&&(i.data[o++]=this.DV+r),i.t=o,i.clamp()}function xt(t){var i=a();return this.addTo(t,i),i}function Lt(t){var i=a();return this.subTo(t,i),i}function It(t){var i=a();return this.multiplyTo(t,i),i}function Zt(t){var i=a();return this.divRemTo(t,i,null),i}function Ft(t){var i=a();return this.divRemTo(t,null,i),i}function Pt(t){var i=a(),o=a();return this.divRemTo(t,i,o),new Array(i,o)}function Ct(t){this.data[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}function jt(t,i){if(0!=t){for(;this.t<=i;)this.data[this.t++]=0;for(this.data[i]+=t;this.data[i]>=this.DV;)this.data[i]-=this.DV,++i>=this.t&&(this.data[this.t++]=0),++this.data[i]}}function kt(){}function zt(t){return t}function Ut(t,i,o){t.multiplyTo(i,o)}function Gt(t,i){t.squareTo(i)}function Ht(t){return this.exp(t,new kt)}function Jt(t,i,o){var r,s=Math.min(this.t+t.t,i);for(o.s=0,o.t=s;s>0;)o.data[--s]=0;for(r=o.t-this.t;s<r;++s)o.data[s+this.t]=this.am(0,t.data[s],o,s,0,this.t);for(r=Math.min(t.t,i);s<r;++s)this.am(0,t.data[s],o,s,0,i-s);o.clamp()}function Kt(t,i,o){--i;var r=o.t=this.t+t.t-i;for(o.s=0;--r>=0;)o.data[r]=0;for(r=Math.max(i-this.t,0);r<t.t;++r)o.data[this.t+r-i]=this.am(i-r,t.data[r],o,0,0,this.t+r-i);o.clamp(),o.drShiftTo(1,o)}function Qt(t){this.r2=a(),this.q3=a(),s.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}function Wt(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var i=a();return t.copyTo(i),this.reduce(i),i}function Xt(t){return t}function Yt(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)}function $t(t,i){t.squareTo(i),this.reduce(i)}function _t(t,i,o){t.multiplyTo(i,o),this.reduce(o)}function ti(t,i){var o,r,s=t.bitLength(),h=y(1);if(s<=0)return h;o=s<18?1:s<48?3:s<144?4:s<768?5:6,r=s<8?new Z(i):i.isEven()?new Qt(i):new U(i);var e=new Array,n=3,u=o-1,f=(1<<o)-1;if(e[1]=r.convert(this),o>1){var p=a();for(r.sqrTo(e[1],p);n<=f;)e[n]=a(),r.mulTo(p,e[n-2],e[n]),n+=2}var d,c,m=t.t-1,l=!0,T=a();for(s=w(t.data[m])-1;m>=0;){for(s>=u?d=t.data[m]>>s-u&f:(d=(t.data[m]&(1<<s+1)-1)<<u-s,m>0&&(d|=t.data[m-1]>>this.DB+s-u)),n=o;0==(1&d);)d>>=1,--n;if((s-=n)<0&&(s+=this.DB,--m),l)e[d].copyTo(h),l=!1;else{for(;n>1;)r.sqrTo(h,T),r.sqrTo(T,h),n-=2;n>0?r.sqrTo(h,T):(c=h,h=T,T=c),r.mulTo(T,e[d],h)}for(;m>=0&&0==(t.data[m]&1<<s);)r.sqrTo(h,T),c=h,h=T,T=c,--s<0&&(s=this.DB-1,--m)}return r.revert(h)}function ii(t){var i=this.s<0?this.negate():this.clone(),o=t.s<0?t.negate():t.clone();if(i.compareTo(o)<0){var r=i;i=o,o=r}var s=i.getLowestSetBit(),a=o.getLowestSetBit();if(a<0)return i;for(s<a&&(a=s),a>0&&(i.rShiftTo(a,i),o.rShiftTo(a,o));i.signum()>0;)(s=i.getLowestSetBit())>0&&i.rShiftTo(s,i),(s=o.getLowestSetBit())>0&&o.rShiftTo(s,o),i.compareTo(o)>=0?(i.subTo(o,i),i.rShiftTo(1,i)):(o.subTo(i,o),o.rShiftTo(1,o));return a>0&&o.lShiftTo(a,o),o}function oi(t){if(t<=0)return 0;var i=this.DV%t,o=this.s<0?t-1:0;if(this.t>0)if(0==i)o=this.data[0]%t;else for(var r=this.t-1;r>=0;--r)o=(i*o+this.data[r])%t;return o}function ri(t){var i=t.isEven();if(this.isEven()&&i||0==t.signum())return s.ZERO;for(var o=t.clone(),r=this.clone(),a=y(1),h=y(0),e=y(0),n=y(1);0!=o.signum();){for(;o.isEven();)o.rShiftTo(1,o),i?(a.isEven()&&h.isEven()||(a.addTo(this,a),h.subTo(t,h)),a.rShiftTo(1,a)):h.isEven()||h.subTo(t,h),h.rShiftTo(1,h);for(;r.isEven();)r.rShiftTo(1,r),i?(e.isEven()&&n.isEven()||(e.addTo(this,e),n.subTo(t,n)),e.rShiftTo(1,e)):n.isEven()||n.subTo(t,n),n.rShiftTo(1,n);o.compareTo(r)>=0?(o.subTo(r,o),i&&a.subTo(e,a),h.subTo(n,h)):(r.subTo(o,r),i&&e.subTo(a,e),n.subTo(h,n))}return 0!=r.compareTo(s.ONE)?s.ZERO:n.compareTo(t)>=0?n.subtract(t):n.signum()<0?(n.addTo(t,n),n.signum()<0?n.add(t):n):n}Z.prototype.convert=F,Z.prototype.revert=P,Z.prototype.reduce=C,Z.prototype.mulTo=j,Z.prototype.sqrTo=k,U.prototype.convert=G,U.prototype.revert=H,U.prototype.reduce=J,U.prototype.mulTo=Q,U.prototype.sqrTo=K,s.prototype.copyTo=T,s.prototype.fromInt=v,s.prototype.fromString=D,s.prototype.clamp=b,s.prototype.dlShiftTo=O,s.prototype.drShiftTo=R,s.prototype.lShiftTo=V,s.prototype.rShiftTo=q,s.prototype.subTo=A,s.prototype.multiplyTo=N,s.prototype.squareTo=x,s.prototype.divRemTo=L,s.prototype.invDigit=z,s.prototype.isEven=W,s.prototype.exp=X,s.prototype.toString=B,s.prototype.negate=g,s.prototype.abs=S,s.prototype.compareTo=M,s.prototype.bitLength=E,s.prototype.mod=I,s.prototype.modPowInt=Y,s.ZERO=y(0),s.ONE=y(1),kt.prototype.convert=zt,kt.prototype.revert=zt,kt.prototype.mulTo=Ut,kt.prototype.sqrTo=Gt,Qt.prototype.convert=Wt,Qt.prototype.revert=Xt,Qt.prototype.reduce=Yt,Qt.prototype.mulTo=_t,Qt.prototype.sqrTo=$t;var si=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],ai=(1<<26)/si[si.length-1];function hi(t){var i,o=this.abs();if(1==o.t&&o.data[0]<=si[si.length-1]){for(i=0;i<si.length;++i)if(o.data[0]==si[i])return!0;return!1}if(o.isEven())return!1;for(i=1;i<si.length;){for(var r=si[i],s=i+1;s<si.length&&r<ai;)r*=si[s++];for(r=o.modInt(r);i<s;)if(r%si[i++]==0)return!1}return o.millerRabin(t)}function ei(t){var i=this.subtract(s.ONE),o=i.getLowestSetBit();if(o<=0)return!1;for(var r,a=i.shiftRight(o),h=ni(),e=0;e<t;++e){do{r=new s(this.bitLength(),h)}while(r.compareTo(s.ONE)<=0||r.compareTo(i)>=0);var n=r.modPow(a,this);if(0!=n.compareTo(s.ONE)&&0!=n.compareTo(i)){for(var u=1;u++<o&&0!=n.compareTo(i);)if(0==(n=n.modPowInt(2,this)).compareTo(s.ONE))return!1;if(0!=n.compareTo(i))return!1}}return!0}function ni(){return{nextBytes:function(t){for(var i=0;i<t.length;++i)t[i]=Math.floor(256*Math.random())}}}s.prototype.chunkSize=ot,s.prototype.toRadix=st,s.prototype.fromRadix=at,s.prototype.fromNumber=ht,s.prototype.bitwiseTo=pt,s.prototype.changeBit=Rt,s.prototype.addTo=Nt,s.prototype.dMultiply=Ct,s.prototype.dAddOffset=jt,s.prototype.multiplyLowerTo=Jt,s.prototype.multiplyUpperTo=Kt,s.prototype.modInt=oi,s.prototype.millerRabin=ei,s.prototype.clone=$,s.prototype.intValue=_,s.prototype.byteValue=tt,s.prototype.shortValue=it,s.prototype.signum=rt,s.prototype.toByteArray=et,s.prototype.equals=nt,s.prototype.min=ut,s.prototype.max=ft,s.prototype.and=ct,s.prototype.or=lt,s.prototype.xor=vt,s.prototype.andNot=Dt,s.prototype.not=bt,s.prototype.shiftLeft=Bt,s.prototype.shiftRight=gt,s.prototype.getLowestSetBit=Mt,s.prototype.bitCount=Et,s.prototype.testBit=Ot,s.prototype.setBit=Vt,s.prototype.clearBit=qt,s.prototype.flipBit=At,s.prototype.add=xt,s.prototype.subtract=Lt,s.prototype.multiply=It,s.prototype.divide=Zt,s.prototype.remainder=Ft,s.prototype.divideAndRemainder=Pt,s.prototype.modPow=ti,s.prototype.modInverse=ri,s.prototype.pow=Ht,s.prototype.gcd=ii,s.prototype.isProbablePrime=hi;
|
||
},{"./forge":"sQ2N"}],"KfUf":[function(require,module,exports) {
|
||
var e=require("./forge");require("./md"),require("./util");var t=module.exports=e.sha1=e.sha1||{};e.md.sha1=e.md.algorithms.sha1=t,t.create=function(){r||n();var t=null,s=e.util.createBuffer(),u=new Array(80),a={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){a.messageLength=0,a.fullMessageLength=a.messageLength64=[];for(var h=a.messageLengthSize/4,r=0;r<h;++r)a.fullMessageLength.push(0);return s=e.util.createBuffer(),t={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},a}};return a.start(),a.update=function(h,r){"utf8"===r&&(h=e.util.encodeUtf8(h));var n=h.length;a.messageLength+=n,n=[n/4294967296>>>0,n>>>0];for(var l=a.fullMessageLength.length-1;l>=0;--l)a.fullMessageLength[l]+=n[1],n[1]=n[0]+(a.fullMessageLength[l]/4294967296>>>0),a.fullMessageLength[l]=a.fullMessageLength[l]>>>0,n[0]=n[1]/4294967296>>>0;return s.putBytes(h),g(t,u,s),(s.read>2048||0===s.length())&&s.compact(),a},a.digest=function(){var r=e.util.createBuffer();r.putBytes(s.bytes());var n,l=a.fullMessageLength[a.fullMessageLength.length-1]+a.messageLengthSize&a.blockLength-1;r.putBytes(h.substr(0,a.blockLength-l));for(var f=8*a.fullMessageLength[0],o=0;o<a.fullMessageLength.length-1;++o)f+=(n=8*a.fullMessageLength[o+1])/4294967296>>>0,r.putInt32(f>>>0),f=n>>>0;r.putInt32(f);var i={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4};g(i,u,r);var L=e.util.createBuffer();return L.putInt32(i.h0),L.putInt32(i.h1),L.putInt32(i.h2),L.putInt32(i.h3),L.putInt32(i.h4),L},a};var h=null,r=!1;function n(){h=String.fromCharCode(128),h+=e.util.fillString(String.fromCharCode(0),64),r=!0}function g(e,t,h){for(var r,n,g,s,u,a,l,f=h.length();f>=64;){for(n=e.h0,g=e.h1,s=e.h2,u=e.h3,a=e.h4,l=0;l<16;++l)r=h.getInt32(),t[l]=r,r=(n<<5|n>>>27)+(u^g&(s^u))+a+1518500249+r,a=u,u=s,s=(g<<30|g>>>2)>>>0,g=n,n=r;for(;l<20;++l)r=(r=t[l-3]^t[l-8]^t[l-14]^t[l-16])<<1|r>>>31,t[l]=r,r=(n<<5|n>>>27)+(u^g&(s^u))+a+1518500249+r,a=u,u=s,s=(g<<30|g>>>2)>>>0,g=n,n=r;for(;l<32;++l)r=(r=t[l-3]^t[l-8]^t[l-14]^t[l-16])<<1|r>>>31,t[l]=r,r=(n<<5|n>>>27)+(g^s^u)+a+1859775393+r,a=u,u=s,s=(g<<30|g>>>2)>>>0,g=n,n=r;for(;l<40;++l)r=(r=t[l-6]^t[l-16]^t[l-28]^t[l-32])<<2|r>>>30,t[l]=r,r=(n<<5|n>>>27)+(g^s^u)+a+1859775393+r,a=u,u=s,s=(g<<30|g>>>2)>>>0,g=n,n=r;for(;l<60;++l)r=(r=t[l-6]^t[l-16]^t[l-28]^t[l-32])<<2|r>>>30,t[l]=r,r=(n<<5|n>>>27)+(g&s|u&(g^s))+a+2400959708+r,a=u,u=s,s=(g<<30|g>>>2)>>>0,g=n,n=r;for(;l<80;++l)r=(r=t[l-6]^t[l-16]^t[l-28]^t[l-32])<<2|r>>>30,t[l]=r,r=(n<<5|n>>>27)+(g^s^u)+a+3395469782+r,a=u,u=s,s=(g<<30|g>>>2)>>>0,g=n,n=r;e.h0=e.h0+n|0,e.h1=e.h1+g|0,e.h2=e.h2+s|0,e.h3=e.h3+u|0,e.h4=e.h4+a|0,f-=64}}
|
||
},{"./forge":"sQ2N","./md":"dsGL","./util":"2FVR"}],"oc1S":[function(require,module,exports) {
|
||
var e=require("./forge");require("./util"),require("./random"),require("./sha1");var t=module.exports=e.pkcs1=e.pkcs1||{};function r(t,r,g){g||(g=e.md.sha1.create());for(var n="",i=Math.ceil(r/g.digestLength),s=0;s<i;++s){var h=String.fromCharCode(s>>24&255,s>>16&255,s>>8&255,255&s);g.start(),g.update(t+h),n+=g.digest().getBytes()}return n.substring(0,r)}t.encode_rsa_oaep=function(t,g,n){var i,s,h,d;"string"==typeof n?(i=n,s=arguments[3]||void 0,h=arguments[4]||void 0):n&&(i=n.label||void 0,s=n.seed||void 0,h=n.md||void 0,n.mgf1&&n.mgf1.md&&(d=n.mgf1.md)),h?h.start():h=e.md.sha1.create(),d||(d=h);var a=Math.ceil(t.n.bitLength()/8),o=a-2*h.digestLength-2;if(g.length>o)throw(c=new Error("RSAES-OAEP input message length is too long.")).length=g.length,c.maxLength=o,c;i||(i=""),h.update(i,"raw");for(var l=h.digest(),u="",v=o-g.length,f=0;f<v;f++)u+="\0";var m=l.getBytes()+u+""+g;if(s){if(s.length!==h.digestLength){var c;throw(c=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.")).seedLength=s.length,c.digestLength=h.digestLength,c}}else s=e.random.getBytes(h.digestLength);var L=r(s,a-h.digestLength-1,d),A=e.util.xorBytes(m,L,m.length),E=r(A,h.digestLength,d);return"\0"+e.util.xorBytes(s,E,s.length)+A},t.decode_rsa_oaep=function(t,g,n){var i,s,h;"string"==typeof n?(i=n,s=arguments[3]||void 0):n&&(i=n.label||void 0,s=n.md||void 0,n.mgf1&&n.mgf1.md&&(h=n.mgf1.md));var d=Math.ceil(t.n.bitLength()/8);if(g.length!==d)throw(L=new Error("RSAES-OAEP encoded message length is invalid.")).length=g.length,L.expectedLength=d,L;if(void 0===s?s=e.md.sha1.create():s.start(),h||(h=s),d<2*s.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");i||(i=""),s.update(i,"raw");for(var a=s.digest().getBytes(),o=g.charAt(0),l=g.substring(1,s.digestLength+1),u=g.substring(1+s.digestLength),v=r(u,s.digestLength,h),f=r(e.util.xorBytes(l,v,l.length),d-s.digestLength-1,h),m=e.util.xorBytes(u,f,u.length),c=m.substring(0,s.digestLength),L="\0"!==o,A=0;A<s.digestLength;++A)L|=a.charAt(A)!==c.charAt(A);for(var E=1,p=s.digestLength,w=s.digestLength;w<m.length;w++){var y=m.charCodeAt(w);L|=y&(E?65534:0),p+=E&=1&y^1}if(L||1!==m.charCodeAt(p))throw new Error("Invalid RSAES-OAEP padding.");return m.substring(p+1)};
|
||
},{"./forge":"sQ2N","./util":"2FVR","./random":"O9pb","./sha1":"KfUf"}],"mjqs":[function(require,module,exports) {
|
||
var e=require("./forge");require("./util"),require("./jsbn"),require("./random"),function(){if(e.prime)module.exports=e.prime;else{var r=module.exports=e.prime=e.prime||{},n=e.jsbn.BigInteger,t=[6,4,2,4,2,4,6,2],i=new n(null);i.fromInt(30);var o=function(e,r){return e|r};r.generateProbablePrime=function(r,t,i){"function"==typeof t&&(i=t,t={});var o=(t=t||{}).algorithm||"PRIMEINC";"string"==typeof o&&(o={name:o}),o.options=o.options||{};var u=t.prng||e.random,s={nextBytes:function(e){for(var r=u.getBytesSync(e.length),n=0;n<e.length;++n)e[n]=r.charCodeAt(n)}};if("PRIMEINC"===o.name)return function(r,t,i,o){if("workers"in i)return function(r,t,i,o){if("undefined"==typeof Worker)return a(r,t,i,o);var u=f(r,t),s=i.workers,m=i.workLoad||100,l=30*m/8,d=i.workerScript||"forge/prime.worker.js";if(-1===s)return e.util.estimateCores(function(e,r){e&&(r=2),s=r-1,g()});function g(){s=Math.max(1,s);for(var e=[],i=0;i<s;++i)e[i]=new Worker(d);for(var i=0;i<s;++i)e[i].addEventListener("message",g);var a=!1;function g(i){if(!a){0;var s=i.data;if(s.found){for(var d=0;d<e.length;++d)e[d].terminate();return a=!0,o(null,new n(s.prime,16))}u.bitLength()>r&&(u=f(r,t));var g=u.toString(16);i.target.postMessage({hex:g,workLoad:m}),u.dAddOffset(l,0)}}}g()}(r,t,i,o);return a(r,t,i,o)}(r,s,o.options,i);throw new Error("Invalid prime generation algorithm: "+o.name)}}function a(r,n,i,o){var a=f(r,n),u=function(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}(a.bitLength());"millerRabinTests"in i&&(u=i.millerRabinTests);var s=10;"maxBlockTime"in i&&(s=i.maxBlockTime),function r(n,i,o,a,u,s,m){var l=+new Date;do{if(n.bitLength()>i&&(n=f(i,o)),n.isProbablePrime(u))return m(null,n);n.dAddOffset(t[a++%8],0)}while(s<0||+new Date-l<s);e.util.setImmediate(function(){r(n,i,o,a,u,s,m)})}(a,r,n,0,u,s,o)}function f(e,r){var t=new n(e,r),a=e-1;return t.testBit(a)||t.bitwiseTo(n.ONE.shiftLeft(a),o,t),t.dAddOffset(31-t.mod(i).byteValue(),0),t}}();
|
||
},{"./forge":"sQ2N","./util":"2FVR","./jsbn":"Xh/Z","./random":"O9pb"}],"NW38":[function(require,module,exports) {
|
||
function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}var t=require("./forge");if(require("./asn1"),require("./jsbn"),require("./oids"),require("./pkcs1"),require("./prime"),require("./random"),require("./util"),void 0===r)var r=t.jsbn.BigInteger;var n=t.util.isNodejs?require("crypto"):null,a=t.asn1,o=t.util;t.pki=t.pki||{},module.exports=t.pki.rsa=t.rsa=t.rsa||{};var i=t.pki,s=[6,4,2,4,2,4,6,2],u={name:"PrivateKeyInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},p={name:"RSAPrivateKey",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},l={name:"RSAPublicKey",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},c=t.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:a.Class.UNIVERSAL,type:a.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},y=function(e){var t;if(!(e.algorithm in i.oids)){var r=new Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r}t=i.oids[e.algorithm];var n=a.oidToDer(t).getBytes(),o=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[]),s=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[]);s.value.push(a.create(a.Class.UNIVERSAL,a.Type.OID,!1,n)),s.value.push(a.create(a.Class.UNIVERSAL,a.Type.NULL,!1,""));var u=a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,e.digest().getBytes());return o.value.push(s),o.value.push(u),a.toDer(o).getBytes()},f=function(e,n,a){if(a)return e.modPow(n.e,n.n);if(!n.p||!n.q)return e.modPow(n.d,n.n);var o;n.dP||(n.dP=n.d.mod(n.p.subtract(r.ONE))),n.dQ||(n.dQ=n.d.mod(n.q.subtract(r.ONE))),n.qInv||(n.qInv=n.q.modInverse(n.p));do{o=new r(t.util.bytesToHex(t.random.getBytes(n.n.bitLength()/8)),16)}while(o.compareTo(n.n)>=0||!o.gcd(n.n).equals(r.ONE));for(var i=(e=e.multiply(o.modPow(n.e,n.n)).mod(n.n)).mod(n.p).modPow(n.dP,n.p),s=e.mod(n.q).modPow(n.dQ,n.q);i.compareTo(s)<0;)i=i.add(n.p);var u=i.subtract(s).multiply(n.qInv).mod(n.p).multiply(n.q).add(s);return u=u.multiply(o.modInverse(n.n)).mod(n.n)};function E(e,r,n){var a=t.util.createBuffer(),o=Math.ceil(r.n.bitLength()/8);if(e.length>o-11){var i=new Error("Message is too long for PKCS#1 v1.5 padding.");throw i.length=e.length,i.max=o-11,i}a.putByte(0),a.putByte(n);var s,u=o-3-e.length;if(0===n||1===n){s=0===n?0:255;for(var p=0;p<u;++p)a.putByte(s)}else for(;u>0;){var l=0,c=t.random.getBytes(u);for(p=0;p<u;++p)0===(s=c.charCodeAt(p))?++l:a.putByte(s);u=l}return a.putByte(0),a.putBytes(e),a}function d(e,r,n,a){var o=Math.ceil(r.n.bitLength()/8),i=t.util.createBuffer(e),s=i.getByte(),u=i.getByte();if(0!==s||n&&0!==u&&1!==u||!n&&2!=u||n&&0===u&&void 0===a)throw new Error("Encryption block is invalid.");var p=0;if(0===u){p=o-3-a;for(var l=0;l<p;++l)if(0!==i.getByte())throw new Error("Encryption block is invalid.")}else if(1===u)for(p=0;i.length()>1;){if(255!==i.getByte()){--i.read;break}++p}else if(2===u)for(p=0;i.length()>1;){if(0===i.getByte()){--i.read;break}++p}if(0!==i.getByte()||p!==o-3-i.length())throw new Error("Encryption block is invalid.");return i.getBytes()}function v(e,n,a){"function"==typeof n&&(a=n,n={});var o={algorithm:{name:(n=n||{}).algorithm||"PRIMEINC",options:{workers:n.workers||2,workLoad:n.workLoad||100,workerScript:n.workerScript}}};function s(){u(e.pBits,function(t,r){return t?a(t):(e.p=r,null!==e.q?p(t,e.q):void u(e.qBits,p))})}function u(e,r){t.prime.generateProbablePrime(e,o,r)}function p(t,n){if(t)return a(t);if(e.q=n,e.p.compareTo(e.q)<0){var o=e.p;e.p=e.q,e.q=o}if(0!==e.p.subtract(r.ONE).gcd(e.e).compareTo(r.ONE))return e.p=null,void s();if(0!==e.q.subtract(r.ONE).gcd(e.e).compareTo(r.ONE))return e.q=null,void u(e.qBits,p);if(e.p1=e.p.subtract(r.ONE),e.q1=e.q.subtract(r.ONE),e.phi=e.p1.multiply(e.q1),0!==e.phi.gcd(e.e).compareTo(r.ONE))return e.p=e.q=null,void s();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void u(e.qBits,p);var l=e.e.modInverse(e.phi);e.keys={privateKey:i.rsa.setPrivateKey(e.n,e.e,l,e.p,e.q,l.mod(e.p1),l.mod(e.q1),e.q.modInverse(e.p)),publicKey:i.rsa.setPublicKey(e.n,e.e)},a(null,e.keys)}"prng"in n&&(o.prng=n.prng),s()}function S(e){var r=e.toString(16);r[0]>="8"&&(r="00"+r);var n=t.util.hexToBytes(r);return n.length>1&&(0===n.charCodeAt(0)&&0==(128&n.charCodeAt(1))||255===n.charCodeAt(0)&&128==(128&n.charCodeAt(1)))?n.substr(1):n}function m(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function g(e){return t.util.isNodejs&&"function"==typeof n[e]}function b(t){return void 0!==o.globalScope&&"object"===e(o.globalScope.crypto)&&"object"===e(o.globalScope.crypto.subtle)&&"function"==typeof o.globalScope.crypto.subtle[t]}function K(t){return void 0!==o.globalScope&&"object"===e(o.globalScope.msCrypto)&&"object"===e(o.globalScope.msCrypto.subtle)&&"function"==typeof o.globalScope.msCrypto.subtle[t]}function N(e){for(var r=t.util.hexToBytes(e.toString(16)),n=new Uint8Array(r.length),a=0;a<r.length;++a)n[a]=r.charCodeAt(a);return n}function R(e){if("RSA"!==e.kty)throw new Error('Unsupported key algorithm "'+e.kty+'"; algorithm must be "RSA".');return i.setRsaPrivateKey(I(e.n),I(e.e),I(e.d),I(e.p),I(e.q),I(e.dp),I(e.dq),I(e.qi))}function C(e){if("RSA"!==e.kty)throw new Error('Key algorithm must be "RSA".');return i.setRsaPublicKey(I(e.n),I(e.e))}function I(e){return new r(t.util.bytesToHex(t.util.decode64(e)),16)}i.rsa.encrypt=function(e,n,a){var o,i=a,s=Math.ceil(n.n.bitLength()/8);!1!==a&&!0!==a?(i=2===a,o=E(e,n,a)):(o=t.util.createBuffer()).putBytes(e);for(var u=new r(o.toHex(),16),p=f(u,n,i).toString(16),l=t.util.createBuffer(),c=s-Math.ceil(p.length/2);c>0;)l.putByte(0),--c;return l.putBytes(t.util.hexToBytes(p)),l.getBytes()},i.rsa.decrypt=function(e,n,a,o){var i=Math.ceil(n.n.bitLength()/8);if(e.length!==i){var s=new Error("Encrypted message length is invalid.");throw s.length=e.length,s.expected=i,s}var u=new r(t.util.createBuffer(e).toHex(),16);if(u.compareTo(n.n)>=0)throw new Error("Encrypted message is invalid.");for(var p=f(u,n,a).toString(16),l=t.util.createBuffer(),c=i-Math.ceil(p.length/2);c>0;)l.putByte(0),--c;return l.putBytes(t.util.hexToBytes(p)),!1!==o?d(l.getBytes(),n,a):l.getBytes()},i.rsa.createKeyPairGenerationState=function(e,n,a){"string"==typeof e&&(e=parseInt(e,10)),e=e||2048;var o,i=(a=a||{}).prng||t.random,s={nextBytes:function(e){for(var t=i.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}},u=a.algorithm||"PRIMEINC";if("PRIMEINC"!==u)throw new Error("Invalid key generation algorithm: "+u);return(o={algorithm:u,state:0,bits:e,rng:s,eInt:n||65537,e:new r(null),p:null,q:null,qBits:e>>1,pBits:e-(e>>1),pqState:0,num:null,keys:null}).e.fromInt(o.eInt),o},i.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var n=new r(null);n.fromInt(30);for(var a,o=0,u=function(e,t){return e|t},p=+new Date,l=0;null===e.keys&&(t<=0||l<t);){if(0===e.state){var c=null===e.p?e.pBits:e.qBits,y=c-1;0===e.pqState?(e.num=new r(c,e.rng),e.num.testBit(y)||e.num.bitwiseTo(r.ONE.shiftLeft(y),u,e.num),e.num.dAddOffset(31-e.num.mod(n).byteValue(),0),o=0,++e.pqState):1===e.pqState?e.num.bitLength()>c?e.pqState=0:e.num.isProbablePrime(m(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(s[o++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(r.ONE).gcd(e.e).compareTo(r.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(r.ONE),e.q1=e.q.subtract(r.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(r.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var f=e.e.modInverse(e.phi);e.keys={privateKey:i.rsa.setPrivateKey(e.n,e.e,f,e.p,e.q,f.mod(e.p1),f.mod(e.q1),e.q.modInverse(e.p)),publicKey:i.rsa.setPublicKey(e.n,e.e)}}l+=(a=+new Date)-p,p=a}return null!==e.keys},i.rsa.generateKeyPair=function(r,s,u,p){if(1===arguments.length?"object"===e(r)?(u=r,r=void 0):"function"==typeof r&&(p=r,r=void 0):2===arguments.length?"number"==typeof r?"function"==typeof s?(p=s,s=void 0):"number"!=typeof s&&(u=s,s=void 0):(u=r,p=s,r=void 0,s=void 0):3===arguments.length&&("number"==typeof s?"function"==typeof u&&(p=u,u=void 0):(p=u,u=s,s=void 0)),u=u||{},void 0===r&&(r=u.bits||2048),void 0===s&&(s=u.e||65537),!t.options.usePureJavaScript&&!u.prng&&r>=256&&r<=16384&&(65537===s||3===s))if(p){if(g("generateKeyPair"))return n.generateKeyPair("rsa",{modulusLength:r,publicExponent:s,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(e,t,r){if(e)return p(e);p(null,{privateKey:i.privateKeyFromPem(r),publicKey:i.publicKeyFromPem(t)})});if(b("generateKey")&&b("exportKey"))return o.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:r,publicExponent:N(s),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(e){return o.globalScope.crypto.subtle.exportKey("pkcs8",e.privateKey)}).then(void 0,function(e){p(e)}).then(function(e){if(e){var r=i.privateKeyFromAsn1(a.fromDer(t.util.createBuffer(e)));p(null,{privateKey:r,publicKey:i.setRsaPublicKey(r.n,r.e)})}});if(K("generateKey")&&K("exportKey")){var l=o.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:r,publicExponent:N(s),hash:{name:"SHA-256"}},!0,["sign","verify"]);return l.oncomplete=function(e){var r=e.target.result,n=o.globalScope.msCrypto.subtle.exportKey("pkcs8",r.privateKey);n.oncomplete=function(e){var r=e.target.result,n=i.privateKeyFromAsn1(a.fromDer(t.util.createBuffer(r)));p(null,{privateKey:n,publicKey:i.setRsaPublicKey(n.n,n.e)})},n.onerror=function(e){p(e)}},void(l.onerror=function(e){p(e)})}}else if(g("generateKeyPairSync")){var c=n.generateKeyPairSync("rsa",{modulusLength:r,publicExponent:s,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:i.privateKeyFromPem(c.privateKey),publicKey:i.publicKeyFromPem(c.publicKey)}}var y=i.rsa.createKeyPairGenerationState(r,s,u);if(!p)return i.rsa.stepKeyPairGenerationState(y,0),y.keys;v(y,u,p)},i.setRsaPublicKey=i.rsa.setPublicKey=function(e,r){var n={n:e,e:r,encrypt:function(e,r,a){if("string"==typeof r?r=r.toUpperCase():void 0===r&&(r="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===r)r={encode:function(e,t,r){return E(e,t,2).getBytes()}};else if("RSA-OAEP"===r||"RSAES-OAEP"===r)r={encode:function(e,r){return t.pkcs1.encode_rsa_oaep(r,e,a)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(r))r={encode:function(e){return e}};else if("string"==typeof r)throw new Error('Unsupported encryption scheme: "'+r+'".');var o=r.encode(e,n,!0);return i.rsa.encrypt(o,n,!0)},verify:function(e,t,r){"string"==typeof r?r=r.toUpperCase():void 0===r&&(r="RSASSA-PKCS1-V1_5"),"RSASSA-PKCS1-V1_5"===r?r={verify:function(e,t){return t=d(t,n,!0),e===a.fromDer(t).value[1].value}}:"NONE"!==r&&"NULL"!==r&&null!==r||(r={verify:function(e,t){return e===(t=d(t,n,!0))}});var o=i.rsa.decrypt(t,n,!0,!1);return r.verify(e,o,n.n.bitLength())}};return n},i.setRsaPrivateKey=i.rsa.setPrivateKey=function(e,r,n,a,o,s,u,p){var l={n:e,e:r,d:n,p:a,q:o,dP:s,dQ:u,qInv:p,decrypt:function(e,r,n){"string"==typeof r?r=r.toUpperCase():void 0===r&&(r="RSAES-PKCS1-V1_5");var a=i.rsa.decrypt(e,l,!1,!1);if("RSAES-PKCS1-V1_5"===r)r={decode:d};else if("RSA-OAEP"===r||"RSAES-OAEP"===r)r={decode:function(e,r){return t.pkcs1.decode_rsa_oaep(r,e,n)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(r))throw new Error('Unsupported encryption scheme: "'+r+'".');r={decode:function(e){return e}}}return r.decode(a,l,!1)},sign:function(e,t){var r=!1;"string"==typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:y},r=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},r=1);var n=t.encode(e,l.n.bitLength());return i.rsa.encrypt(n,l,r)}};return l},i.wrapRsaPrivateKey=function(e){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,a.integerToDer(0).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(i.oids.rsaEncryption).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.NULL,!1,"")]),a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,a.toDer(e).getBytes())])},i.privateKeyFromAsn1=function(e){var n,o,s,l,c,y,f,E,d={},v=[];if(a.validate(e,u,d,v)&&(e=a.fromDer(t.util.createBuffer(d.privateKey))),d={},v=[],!a.validate(e,p,d,v)){var S=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw S.errors=v,S}return n=t.util.createBuffer(d.privateKeyModulus).toHex(),o=t.util.createBuffer(d.privateKeyPublicExponent).toHex(),s=t.util.createBuffer(d.privateKeyPrivateExponent).toHex(),l=t.util.createBuffer(d.privateKeyPrime1).toHex(),c=t.util.createBuffer(d.privateKeyPrime2).toHex(),y=t.util.createBuffer(d.privateKeyExponent1).toHex(),f=t.util.createBuffer(d.privateKeyExponent2).toHex(),E=t.util.createBuffer(d.privateKeyCoefficient).toHex(),i.setRsaPrivateKey(new r(n,16),new r(o,16),new r(s,16),new r(l,16),new r(c,16),new r(y,16),new r(f,16),new r(E,16))},i.privateKeyToAsn1=i.privateKeyToRSAPrivateKey=function(e){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,a.integerToDer(0).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,S(e.n)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,S(e.e)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,S(e.d)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,S(e.p)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,S(e.q)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,S(e.dP)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,S(e.dQ)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,S(e.qInv))])},i.publicKeyFromAsn1=function(e){var n={},o=[];if(a.validate(e,c,n,o)){var s,u=a.derToOid(n.publicKeyOid);if(u!==i.oids.rsaEncryption)throw(s=new Error("Cannot read public key. Unknown OID.")).oid=u,s;e=n.rsaPublicKey}if(o=[],!a.validate(e,l,n,o))throw(s=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=o,s;var p=t.util.createBuffer(n.publicKeyModulus).toHex(),y=t.util.createBuffer(n.publicKeyExponent).toHex();return i.setRsaPublicKey(new r(p,16),new r(y,16))},i.publicKeyToAsn1=i.publicKeyToSubjectPublicKeyInfo=function(e){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(i.oids.rsaEncryption).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.NULL,!1,"")]),a.create(a.Class.UNIVERSAL,a.Type.BITSTRING,!1,[i.publicKeyToRSAPublicKey(e)])])},i.publicKeyToRSAPublicKey=function(e){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,S(e.n)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,S(e.e))])};
|
||
},{"./forge":"sQ2N","./asn1":"dLTu","./jsbn":"Xh/Z","./oids":"Qnxl","./pkcs1":"oc1S","./prime":"mjqs","./random":"O9pb","./util":"2FVR","crypto":"sC8V"}],"hD6L":[function(require,module,exports) {
|
||
var e=require("./forge");if(require("./aes"),require("./asn1"),require("./des"),require("./md"),require("./oids"),require("./pbkdf2"),require("./pem"),require("./random"),require("./rc2"),require("./rsa"),require("./util"),void 0===t)var t=e.jsbn.BigInteger;var r=e.asn1,a=e.pki=e.pki||{};module.exports=a.pbe=e.pbe=e.pbe||{};var s=a.oids,n={name:"EncryptedPrivateKeyInfo",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:r.Class.UNIVERSAL,type:r.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},i={name:"PBES2Algorithms",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:r.Class.UNIVERSAL,type:r.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:r.Class.UNIVERSAL,type:r.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:r.Class.UNIVERSAL,type:r.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:r.Class.UNIVERSAL,type:r.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},o={name:"pkcs-12PbeParams",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:r.Class.UNIVERSAL,type:r.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:r.Class.UNIVERSAL,type:r.Type.INTEGER,constructed:!1,capture:"iterations"}]};function p(e,t){return e.start().update(t).digest().getBytes()}function c(e){var t;if(e){if(!(t=a.oids[r.derToOid(e)])){var s=new Error("Unsupported PRF OID.");throw s.oid=e,s.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],s}}else t="hmacWithSHA1";return y(t)}function y(t){var r=e.md;switch(t){case"hmacWithSHA224":r=e.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":t=t.substr(8).toLowerCase();break;default:var a=new Error("Unsupported PRF algorithm.");throw a.algorithm=t,a.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],a}if(!(r&&t in r))throw new Error("Unknown hash algorithm: "+t);return r[t].create()}function E(t,s,n,i){var o=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,t),r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,s.getBytes())]);return"hmacWithSHA1"!==i&&o.value.push(r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,e.util.hexToBytes(n.toString(16))),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(a.oids[i]).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.NULL,!1,"")])),o}a.encryptPrivateKeyInfo=function(t,n,i){(i=i||{}).saltSize=i.saltSize||8,i.count=i.count||2048,i.algorithm=i.algorithm||"aes128",i.prfAlgorithm=i.prfAlgorithm||"sha1";var o,p,c,C=e.random.getBytesSync(i.saltSize),d=i.count,l=r.integerToDer(d);if(0===i.algorithm.indexOf("aes")||"des"===i.algorithm){var u,h,S;switch(i.algorithm){case"aes128":o=16,u=16,h=s["aes128-CBC"],S=e.aes.createEncryptionCipher;break;case"aes192":o=24,u=16,h=s["aes192-CBC"],S=e.aes.createEncryptionCipher;break;case"aes256":o=32,u=16,h=s["aes256-CBC"],S=e.aes.createEncryptionCipher;break;case"des":o=8,u=8,h=s.desCBC,S=e.des.createEncryptionCipher;break;default:throw(T=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=i.algorithm,T}var m="hmacWith"+i.prfAlgorithm.toUpperCase(),f=y(m),B=e.pkcs5.pbkdf2(n,C,d,o,f),g=e.random.getBytesSync(u);(v=S(B)).start(g),v.update(r.toDer(t)),v.finish(),c=v.output.getBytes();var A=E(C,l,o,m);p=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(s.pkcs5PBES2).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(s.pkcs5PBKDF2).getBytes()),A]),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(h).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,g)])])])}else{var T;if("3des"!==i.algorithm)throw(T=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=i.algorithm,T;o=24;var v,I=new e.util.ByteBuffer(C);B=a.pbe.generatePkcs12Key(n,I,1,d,o),g=a.pbe.generatePkcs12Key(n,I,2,d,o);(v=e.des.createEncryptionCipher(B)).start(g),v.update(r.toDer(t)),v.finish(),c=v.output.getBytes(),p=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(s["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,C),r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,l.getBytes())])])}return r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[p,r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,c)])},a.decryptPrivateKeyInfo=function(t,s){var i=null,o={},p=[];if(!r.validate(t,n,o,p)){var c=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw c.errors=p,c}var y=r.derToOid(o.encryptionOid),E=a.pbe.getCipher(y,o.encryptionParams,s),C=e.util.createBuffer(o.encryptedData);return E.update(C),E.finish()&&(i=r.fromDer(E.output)),i},a.encryptedPrivateKeyToPem=function(t,a){var s={type:"ENCRYPTED PRIVATE KEY",body:r.toDer(t).getBytes()};return e.pem.encode(s,{maxline:a})},a.encryptedPrivateKeyFromPem=function(t){var a=e.pem.decode(t)[0];if("ENCRYPTED PRIVATE KEY"!==a.type){var s=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw s.headerType=a.type,s}if(a.procType&&"ENCRYPTED"===a.procType.type)throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return r.fromDer(a.body)},a.encryptRsaPrivateKey=function(t,s,n){if(!(n=n||{}).legacy){var i=a.wrapRsaPrivateKey(a.privateKeyToAsn1(t));return i=a.encryptPrivateKeyInfo(i,s,n),a.encryptedPrivateKeyToPem(i)}var o,p,c,y;switch(n.algorithm){case"aes128":o="AES-128-CBC",c=16,p=e.random.getBytesSync(16),y=e.aes.createEncryptionCipher;break;case"aes192":o="AES-192-CBC",c=24,p=e.random.getBytesSync(16),y=e.aes.createEncryptionCipher;break;case"aes256":o="AES-256-CBC",c=32,p=e.random.getBytesSync(16),y=e.aes.createEncryptionCipher;break;case"3des":o="DES-EDE3-CBC",c=24,p=e.random.getBytesSync(8),y=e.des.createEncryptionCipher;break;case"des":o="DES-CBC",c=8,p=e.random.getBytesSync(8),y=e.des.createEncryptionCipher;break;default:var E=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+n.algorithm+'".');throw E.algorithm=n.algorithm,E}var C=y(e.pbe.opensslDeriveBytes(s,p.substr(0,8),c));C.start(p),C.update(r.toDer(a.privateKeyToAsn1(t))),C.finish();var d={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:o,parameters:e.util.bytesToHex(p).toUpperCase()},body:C.output.getBytes()};return e.pem.encode(d)},a.decryptRsaPrivateKey=function(t,s){var n=null,i=e.pem.decode(t)[0];if("ENCRYPTED PRIVATE KEY"!==i.type&&"PRIVATE KEY"!==i.type&&"RSA PRIVATE KEY"!==i.type)throw(c=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".')).headerType=c,c;if(i.procType&&"ENCRYPTED"===i.procType.type){var o,p;switch(i.dekInfo.algorithm){case"DES-CBC":o=8,p=e.des.createDecryptionCipher;break;case"DES-EDE3-CBC":o=24,p=e.des.createDecryptionCipher;break;case"AES-128-CBC":o=16,p=e.aes.createDecryptionCipher;break;case"AES-192-CBC":o=24,p=e.aes.createDecryptionCipher;break;case"AES-256-CBC":o=32,p=e.aes.createDecryptionCipher;break;case"RC2-40-CBC":o=5,p=function(t){return e.rc2.createDecryptionCipher(t,40)};break;case"RC2-64-CBC":o=8,p=function(t){return e.rc2.createDecryptionCipher(t,64)};break;case"RC2-128-CBC":o=16,p=function(t){return e.rc2.createDecryptionCipher(t,128)};break;default:var c;throw(c=new Error('Could not decrypt private key; unsupported encryption algorithm "'+i.dekInfo.algorithm+'".')).algorithm=i.dekInfo.algorithm,c}var y=e.util.hexToBytes(i.dekInfo.parameters),E=p(e.pbe.opensslDeriveBytes(s,y.substr(0,8),o));if(E.start(y),E.update(e.util.createBuffer(i.body)),!E.finish())return n;n=E.output.getBytes()}else n=i.body;return null!==(n="ENCRYPTED PRIVATE KEY"===i.type?a.decryptPrivateKeyInfo(r.fromDer(n),s):r.fromDer(n))&&(n=a.privateKeyFromAsn1(n)),n},a.pbe.generatePkcs12Key=function(t,r,a,s,n,i){var o,p;if(null==i){if(!("sha1"in e.md))throw new Error('"sha1" hash algorithm unavailable.');i=e.md.sha1.create()}var c=i.digestLength,y=i.blockLength,E=new e.util.ByteBuffer,C=new e.util.ByteBuffer;if(null!=t){for(p=0;p<t.length;p++)C.putInt16(t.charCodeAt(p));C.putInt16(0)}var d=C.length(),l=r.length(),u=new e.util.ByteBuffer;u.fillWithByte(a,y);var h=y*Math.ceil(l/y),S=new e.util.ByteBuffer;for(p=0;p<h;p++)S.putByte(r.at(p%l));var m=y*Math.ceil(d/y),f=new e.util.ByteBuffer;for(p=0;p<m;p++)f.putByte(C.at(p%d));var B=S;B.putBuffer(f);for(var g=Math.ceil(n/c),A=1;A<=g;A++){var T=new e.util.ByteBuffer;T.putBytes(u.bytes()),T.putBytes(B.bytes());for(var v=0;v<s;v++)i.start(),i.update(T.getBytes()),T=i.digest();var I=new e.util.ByteBuffer;for(p=0;p<y;p++)I.putByte(T.at(p%c));var R=Math.ceil(l/y)+Math.ceil(d/y),N=new e.util.ByteBuffer;for(o=0;o<R;o++){var P=new e.util.ByteBuffer(B.getBytes(y)),b=511;for(p=I.length()-1;p>=0;p--)b>>=8,b+=I.at(p)+P.at(p),P.setAt(p,255&b);N.putBuffer(P)}B=N,E.putBuffer(T)}return E.truncate(E.length()-n),E},a.pbe.getCipher=function(e,t,r){switch(e){case a.oids.pkcs5PBES2:return a.pbe.getCipherForPBES2(e,t,r);case a.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case a.oids["pbewithSHAAnd40BitRC2-CBC"]:return a.pbe.getCipherForPKCS12PBE(e,t,r);default:var s=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw s.oid=e,s.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],s}},a.pbe.getCipherForPBES2=function(t,s,n){var o,p={},y=[];if(!r.validate(s,i,p,y))throw(o=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=y,o;if((t=r.derToOid(p.kdfOid))!==a.oids.pkcs5PBKDF2)throw(o=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.")).oid=t,o.supportedOids=["pkcs5PBKDF2"],o;if((t=r.derToOid(p.encOid))!==a.oids["aes128-CBC"]&&t!==a.oids["aes192-CBC"]&&t!==a.oids["aes256-CBC"]&&t!==a.oids["des-EDE3-CBC"]&&t!==a.oids.desCBC)throw(o=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.")).oid=t,o.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],o;var E,C,d=p.kdfSalt,l=e.util.createBuffer(p.kdfIterationCount);switch(l=l.getInt(l.length()<<3),a.oids[t]){case"aes128-CBC":E=16,C=e.aes.createDecryptionCipher;break;case"aes192-CBC":E=24,C=e.aes.createDecryptionCipher;break;case"aes256-CBC":E=32,C=e.aes.createDecryptionCipher;break;case"des-EDE3-CBC":E=24,C=e.des.createDecryptionCipher;break;case"desCBC":E=8,C=e.des.createDecryptionCipher}var u=c(p.prfOid),h=e.pkcs5.pbkdf2(n,d,l,E,u),S=p.encIv,m=C(h);return m.start(S),m},a.pbe.getCipherForPKCS12PBE=function(t,s,n){var i={},p=[];if(!r.validate(s,o,i,p))throw(u=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=p,u;var y,E,C,d=e.util.createBuffer(i.salt),l=e.util.createBuffer(i.iterations);switch(l=l.getInt(l.length()<<3),t){case a.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:y=24,E=8,C=e.des.startDecrypting;break;case a.oids["pbewithSHAAnd40BitRC2-CBC"]:y=5,E=8,C=function(t,r){var a=e.rc2.createDecryptionCipher(t,40);return a.start(r,null),a};break;default:var u;throw(u=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.")).oid=t,u}var h=c(i.prfOid),S=a.pbe.generatePkcs12Key(n,d,1,l,y,h);return h.start(),C(S,a.pbe.generatePkcs12Key(n,d,2,l,E,h))},a.pbe.opensslDeriveBytes=function(t,r,a,s){if(null==s){if(!("md5"in e.md))throw new Error('"md5" hash algorithm unavailable.');s=e.md.md5.create()}null===r&&(r="");for(var n=[p(s,t+r)],i=16,o=1;i<a;++o,i+=16)n.push(p(s,n[o-1]+t+r));return n.join("").substr(0,a)};
|
||
},{"./forge":"sQ2N","./aes":"tw3v","./asn1":"dLTu","./des":"2/nO","./md":"dsGL","./oids":"Qnxl","./pbkdf2":"t4Bf","./pem":"8Qcv","./random":"O9pb","./rc2":"AoX7","./rsa":"NW38","./util":"2FVR"}],"kJUv":[function(require,module,exports) {
|
||
"use strict";function e(e,t,r,n,i,a,u){try{var s=e[a](u),o=s.value}catch(c){return void r(c)}s.done?t(o):Promise.resolve(o).then(n,i)}function t(t){return function(){var r=this,n=arguments;return new Promise(function(i,a){var u=t.apply(r,n);function s(t){e(u,i,a,s,o,"next",t)}function o(t){e(u,i,a,s,o,"throw",t)}s(void 0)})}}var r=require("uint8arrays/concat"),n=require("uint8arrays/from-string"),i=require("../webcrypto");function a(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=e.algorithm,u=void 0===a?"AES-GCM":a,s=e.nonceLength,o=void 0===s?12:s,c=e.keyLength,v=void 0===c?16:c,p=e.digest,l=void 0===p?"SHA-256":p,y=e.saltLength,d=void 0===y?16:y,m=e.iterations,h=void 0===m?32767:m,f=i.get();function g(){return(g=t(regeneratorRuntime.mark(function e(t,i){var a,s,c,p,y,m,g;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=f.getRandomValues(new Uint8Array(d)),s=f.getRandomValues(new Uint8Array(o)),c={name:u,iv:s},p={name:"PBKDF2",salt:a,iterations:h,hash:{name:l}},e.next=6,f.subtle.importKey("raw",n(i),{name:"PBKDF2"},!1,["deriveKey","deriveBits"]);case 6:return y=e.sent,e.next=9,f.subtle.deriveKey(p,y,{name:u,length:v},!0,["encrypt"]);case 9:return m=e.sent,e.next=12,f.subtle.encrypt(c,m,t);case 12:return g=e.sent,e.abrupt("return",r([a,c.iv,new Uint8Array(g)]));case 14:case"end":return e.stop()}},e)}))).apply(this,arguments)}function w(){return(w=t(regeneratorRuntime.mark(function e(t,r){var i,a,s,c,p,y,m,g;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.slice(0,d),a=t.slice(d,d+o),s=t.slice(d+o),c={name:u,iv:a},p={name:"PBKDF2",salt:i,iterations:h,hash:{name:l}},e.next=7,f.subtle.importKey("raw",n(r),{name:"PBKDF2"},!1,["deriveKey","deriveBits"]);case 7:return y=e.sent,e.next=10,f.subtle.deriveKey(p,y,{name:u,length:v},!0,["decrypt"]);case 10:return m=e.sent,e.next=13,f.subtle.decrypt(c,m,s);case 13:return g=e.sent,e.abrupt("return",new Uint8Array(g));case 15:case"end":return e.stop()}},e)}))).apply(this,arguments)}return v*=8,{encrypt:function(e,t){return g.apply(this,arguments)},decrypt:function(e,t){return w.apply(this,arguments)}}}module.exports={create:a};
|
||
},{"uint8arrays/concat":"qYui","uint8arrays/from-string":"YucU","../webcrypto":"AJ6b"}],"E9Gl":[function(require,module,exports) {
|
||
"use strict";function e(e,r,t,n,u,i,o){try{var a=e[i](o),c=a.value}catch(s){return void t(s)}a.done?r(c):Promise.resolve(c).then(n,u)}function r(r){return function(){var t=this,n=arguments;return new Promise(function(u,i){var o=r.apply(t,n);function a(r){e(o,u,i,a,c,"next",r)}function c(r){e(o,u,i,a,c,"throw",r)}a(void 0)})}}var t=require("multibase"),n=require("../ciphers/aes-gcm");module.exports={import:function(){var e=r(regeneratorRuntime.mark(function e(r,u){var i,o,a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.names.base64,o=i.decode(r),a=n.create(),e.next=5,a.decrypt(o,u);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}},e)}));return function(r,t){return e.apply(this,arguments)}}()};
|
||
},{"multibase":"DTy7","../ciphers/aes-gcm":"kJUv"}],"6jwI":[function(require,module,exports) {
|
||
module.exports={encode:require("./encode.js"),decode:require("./decode.js"),encodingLength:require("./length.js")};
|
||
},{"./encode.js":"Q/oY","./decode.js":"J29v","./length.js":"Bq+a"}],"SJ3a":[function(require,module,exports) {
|
||
"use strict";var r=require("multibase"),e=require("varint"),n=require("./constants"),t=n.names,o=require("uint8arrays/to-string"),i=require("uint8arrays/from-string"),a=require("uint8arrays/concat"),c={};for(var s in t){var u=s;c[t[u]]=u}function d(r){if(!(r instanceof Uint8Array))throw new Error("must be passed a Uint8Array");return o(r,"base16")}function h(r){return i(r,"base16")}function f(e){if(!(e instanceof Uint8Array))throw new Error("must be passed a Uint8Array");return o(r.encode("base58btc",e)).slice(1)}function l(e){var n=e instanceof Uint8Array?o(e):e;return r.decode("z"+n)}function w(r){if(!(r instanceof Uint8Array))throw new Error("multihash must be a Uint8Array");if(r.length<2)throw new Error("multihash too short. must be > 2 bytes.");var n=e.decode(r);if(!y(n))throw new Error("multihash unknown function code: 0x".concat(n.toString(16)));r=r.slice(e.decode.bytes);var t=e.decode(r);if(t<0)throw new Error("multihash invalid length: ".concat(t));if((r=r.slice(e.decode.bytes)).length!==t)throw new Error("multihash length inconsistent: 0x".concat(o(r,"base16")));return{code:n,name:c[n],length:t,digest:r}}function g(r,n,t){if(!r||void 0===n)throw new Error("multihash encode requires at least two args: digest, code");var o=m(n);if(!(r instanceof Uint8Array))throw new Error("digest should be a Uint8Array");if(null==t&&(t=r.length),t&&r.length!==t)throw new Error("digest length should be equal to specified length.");var i=e.encode(o),c=e.encode(t);return a([i,c,r],i.length+c.length+r.length)}function m(r){var e=r;if("string"==typeof r){if(void 0===t[r])throw new Error("Unrecognized hash function named: ".concat(r));e=t[r]}if("number"!=typeof e)throw new Error("Hash function code should be a number. Got: ".concat(e));if(void 0===c[e]&&!b(e))throw new Error("Unrecognized function code: ".concat(e));return e}function b(r){return r>0&&r<16}function y(r){return!!b(r)||!!c[r]}function v(r){w(r)}function E(r){return v(r),r.subarray(0,2)}Object.freeze(c),module.exports={names:t,codes:c,toHexString:d,fromHexString:h,toB58String:f,fromB58String:l,decode:w,encode:g,coerceCode:m,isAppCode:b,validate:v,prefix:E,isValidCode:y};
|
||
},{"multibase":"DTy7","varint":"6jwI","./constants":"AwpH","uint8arrays/to-string":"Jm0S","uint8arrays/from-string":"YucU","uint8arrays/concat":"qYui"}],"udZl":[function(require,module,exports) {
|
||
"use strict";function e(e,t,r,n,u,a,s){try{var i=e[a](s),o=i.value}catch(c){return void r(c)}i.done?t(o):Promise.resolve(o).then(n,u)}function t(t){return function(){var r=this,n=arguments;return new Promise(function(u,a){var s=t.apply(r,n);function i(t){e(s,u,a,i,o,"next",t)}function o(t){e(s,u,a,i,o,"throw",t)}i(void 0)})}}var r=require("multihashes"),n=self.crypto||self.msCrypto,u=function(){var e=t(regeneratorRuntime.mark(function e(t,r){var u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("undefined"!=typeof self&&n){e.next=2;break}throw new Error("Please use a browser with webcrypto support and ensure the code has been delivered securely via HTTPS/TLS and run within a Secure Context");case 2:e.t0=r,e.next="sha1"===e.t0?5:"sha2-256"===e.t0?10:"sha2-512"===e.t0?15:"dbl-sha2-256"===e.t0?20:28;break;case 5:return e.t1=Uint8Array,e.next=8,n.subtle.digest({name:"SHA-1"},t);case 8:return e.t2=e.sent,e.abrupt("return",new e.t1(e.t2));case 10:return e.t3=Uint8Array,e.next=13,n.subtle.digest({name:"SHA-256"},t);case 13:return e.t4=e.sent,e.abrupt("return",new e.t3(e.t4));case 15:return e.t5=Uint8Array,e.next=18,n.subtle.digest({name:"SHA-512"},t);case 18:return e.t6=e.sent,e.abrupt("return",new e.t5(e.t6));case 20:return e.next=22,n.subtle.digest({name:"SHA-256"},t);case 22:return u=e.sent,e.t7=Uint8Array,e.next=26,n.subtle.digest({name:"SHA-256"},u);case 26:return e.t8=e.sent,e.abrupt("return",new e.t7(e.t8));case 28:throw new Error("".concat(r," is not a supported algorithm"));case 29:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}();module.exports={factory:function(e){return function(){var r=t(regeneratorRuntime.mark(function t(r){return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",u(r,e));case 1:case"end":return t.stop()}},t)}));return function(e){return r.apply(this,arguments)}}()},digest:u,multihashing:function(){var e=t(regeneratorRuntime.mark(function e(t,n,a){var s;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u(t,n);case 2:return s=e.sent,e.abrupt("return",r.encode(s,n,a));case 4:case"end":return e.stop()}},e)}));return function(t,r,n){return e.apply(this,arguments)}}()};
|
||
},{"multihashes":"SJ3a"}],"3udX":[function(require,module,exports) {
|
||
var e=require("./forge");require("./md"),require("./util");var t=module.exports=e.sha512=e.sha512||{};e.md.sha512=e.md.algorithms.sha512=t;var a=e.sha384=e.sha512.sha384=e.sha512.sha384||{};a.create=function(){return t.create("SHA-384")},e.md.sha384=e.md.algorithms.sha384=a,e.sha512.sha256=e.sha512.sha256||{create:function(){return t.create("SHA-512/256")}},e.md["sha512/256"]=e.md.algorithms["sha512/256"]=e.sha512.sha256,e.sha512.sha224=e.sha512.sha224||{create:function(){return t.create("SHA-512/224")}},e.md["sha512/224"]=e.md.algorithms["sha512/224"]=e.sha512.sha224,t.create=function(t){if(s||l(),void 0===t&&(t="SHA-512"),!(t in h))throw new Error("Invalid SHA-512 algorithm: "+t);for(var a=h[t],n=null,u=e.util.createBuffer(),f=new Array(80),o=0;o<80;++o)f[o]=new Array(2);var i=64;switch(t){case"SHA-384":i=48;break;case"SHA-512/256":i=32;break;case"SHA-512/224":i=28}var c={algorithm:t.replace("-","").toLowerCase(),blockLength:128,digestLength:i,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){c.messageLength=0,c.fullMessageLength=c.messageLength128=[];for(var t=c.messageLengthSize/4,r=0;r<t;++r)c.fullMessageLength.push(0);u=e.util.createBuffer(),n=new Array(a.length);for(r=0;r<a.length;++r)n[r]=a[r].slice(0);return c}};return c.start(),c.update=function(t,a){"utf8"===a&&(t=e.util.encodeUtf8(t));var r=t.length;c.messageLength+=r,r=[r/4294967296>>>0,r>>>0];for(var s=c.fullMessageLength.length-1;s>=0;--s)c.fullMessageLength[s]+=r[1],r[1]=r[0]+(c.fullMessageLength[s]/4294967296>>>0),c.fullMessageLength[s]=c.fullMessageLength[s]>>>0,r[0]=r[1]/4294967296>>>0;return u.putBytes(t),g(n,f,u),(u.read>2048||0===u.length())&&u.compact(),c},c.digest=function(){var a=e.util.createBuffer();a.putBytes(u.bytes());var s,h=c.fullMessageLength[c.fullMessageLength.length-1]+c.messageLengthSize&c.blockLength-1;a.putBytes(r.substr(0,c.blockLength-h));for(var l=8*c.fullMessageLength[0],o=0;o<c.fullMessageLength.length-1;++o)l+=(s=8*c.fullMessageLength[o+1])/4294967296>>>0,a.putInt32(l>>>0),l=s>>>0;a.putInt32(l);var i=new Array(n.length);for(o=0;o<n.length;++o)i[o]=n[o].slice(0);g(i,f,a);var m,L=e.util.createBuffer();m="SHA-512"===t?i.length:"SHA-384"===t?i.length-2:i.length-4;for(o=0;o<m;++o)L.putInt32(i[o][0]),o===m-1&&"SHA-512/224"===t||L.putInt32(i[o][1]);return L},c};var r=null,s=!1,n=null,h=null;function l(){r=String.fromCharCode(128),r+=e.util.fillString(String.fromCharCode(0),128),n=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],(h={})["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],h["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],h["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],h["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],s=!0}function g(e,t,a){for(var r,s,h,l,g,u,f,o,i,c,m,L,S,d,A,v,H,M,p,w,y,b,B,I,k,C,q,z,x,E,U,j,D,F=a.length();F>=128;){for(q=0;q<16;++q)t[q][0]=a.getInt32()>>>0,t[q][1]=a.getInt32()>>>0;for(;q<80;++q)r=(((z=(E=t[q-2])[0])>>>19|(x=E[1])<<13)^(x>>>29|z<<3)^z>>>6)>>>0,s=((z<<13|x>>>19)^(x<<3|z>>>29)^(z<<26|x>>>6))>>>0,h=(((z=(j=t[q-15])[0])>>>1|(x=j[1])<<31)^(z>>>8|x<<24)^z>>>7)>>>0,l=((z<<31|x>>>1)^(z<<24|x>>>8)^(z<<25|x>>>7))>>>0,U=t[q-7],D=t[q-16],x=s+U[1]+l+D[1],t[q][0]=r+U[0]+h+D[0]+(x/4294967296>>>0)>>>0,t[q][1]=x>>>0;for(m=e[0][0],L=e[0][1],S=e[1][0],d=e[1][1],A=e[2][0],v=e[2][1],H=e[3][0],M=e[3][1],p=e[4][0],w=e[4][1],y=e[5][0],b=e[5][1],B=e[6][0],I=e[6][1],k=e[7][0],C=e[7][1],q=0;q<80;++q)f=((p>>>14|w<<18)^(p>>>18|w<<14)^(w>>>9|p<<23))>>>0,o=(B^p&(y^B))>>>0,g=((m>>>28|L<<4)^(L>>>2|m<<30)^(L>>>7|m<<25))>>>0,u=((m<<4|L>>>28)^(L<<30|m>>>2)^(L<<25|m>>>7))>>>0,i=(m&S|A&(m^S))>>>0,c=(L&d|v&(L^d))>>>0,x=C+(((p<<18|w>>>14)^(p<<14|w>>>18)^(w<<23|p>>>9))>>>0)+((I^w&(b^I))>>>0)+n[q][1]+t[q][1],r=k+f+o+n[q][0]+t[q][0]+(x/4294967296>>>0)>>>0,s=x>>>0,h=g+i+((x=u+c)/4294967296>>>0)>>>0,l=x>>>0,k=B,C=I,B=y,I=b,y=p,b=w,p=H+r+((x=M+s)/4294967296>>>0)>>>0,w=x>>>0,H=A,M=v,A=S,v=d,S=m,d=L,m=r+h+((x=s+l)/4294967296>>>0)>>>0,L=x>>>0;x=e[0][1]+L,e[0][0]=e[0][0]+m+(x/4294967296>>>0)>>>0,e[0][1]=x>>>0,x=e[1][1]+d,e[1][0]=e[1][0]+S+(x/4294967296>>>0)>>>0,e[1][1]=x>>>0,x=e[2][1]+v,e[2][0]=e[2][0]+A+(x/4294967296>>>0)>>>0,e[2][1]=x>>>0,x=e[3][1]+M,e[3][0]=e[3][0]+H+(x/4294967296>>>0)>>>0,e[3][1]=x>>>0,x=e[4][1]+w,e[4][0]=e[4][0]+p+(x/4294967296>>>0)>>>0,e[4][1]=x>>>0,x=e[5][1]+b,e[5][0]=e[5][0]+y+(x/4294967296>>>0)>>>0,e[5][1]=x>>>0,x=e[6][1]+I,e[6][0]=e[6][0]+B+(x/4294967296>>>0)>>>0,e[6][1]=x>>>0,x=e[7][1]+C,e[7][0]=e[7][0]+k+(x/4294967296>>>0)>>>0,e[7][1]=x>>>0,F-=128}}
|
||
},{"./forge":"sQ2N","./md":"dsGL","./util":"2FVR"}],"ZcDB":[function(require,module,exports) {
|
||
var e=require("./forge");require("./asn1");var t=e.asn1;exports.privateKeyValidator={name:"PrivateKeyInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},exports.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{tagClass:t.Class.UNIVERSAL,type:t.Type.BITSTRING,constructed:!1,composed:!0,captureBitStringValue:"ed25519PublicKey"}]};
|
||
},{"./forge":"sQ2N","./asn1":"dLTu"}],"Swl7":[function(require,module,exports) {
|
||
var Buffer = require("buffer").Buffer;
|
||
var r=require("buffer").Buffer,n=require("./forge");require("./jsbn"),require("./random"),require("./sha512"),require("./util");var o=require("./asn1-validator"),t=o.publicKeyValidator,e=o.privateKeyValidator;if(void 0===a)var a=n.jsbn.BigInteger;var i=n.util.ByteBuffer,f=void 0===r?Uint8Array:r;n.pki=n.pki||{},module.exports=n.pki.ed25519=n.ed25519=n.ed25519||{};var s=n.ed25519;function u(n){var o=n.message;if(o instanceof Uint8Array||o instanceof f)return o;var t=n.encoding;if(void 0===o){if(!n.md)throw new TypeError('"options.message" or "options.md" not specified.');o=n.md.digest().getBytes(),t="binary"}if("string"==typeof o&&!t)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if("string"==typeof o){if(void 0!==r)return r.from(o,t);o=new i(o,t)}else if(!(o instanceof i))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');for(var e=new f(o.length()),a=0;a<e.length;++a)e[a]=o.at(a);return e}s.constants={},s.constants.PUBLIC_KEY_BYTE_LENGTH=32,s.constants.PRIVATE_KEY_BYTE_LENGTH=64,s.constants.SEED_BYTE_LENGTH=32,s.constants.SIGN_BYTE_LENGTH=64,s.constants.HASH_BYTE_LENGTH=64,s.generateKeyPair=function(r){var o=(r=r||{}).seed;if(void 0===o)o=n.random.getBytesSync(s.constants.SEED_BYTE_LENGTH);else if("string"==typeof o){if(o.length!==s.constants.SEED_BYTE_LENGTH)throw new TypeError('"seed" must be '+s.constants.SEED_BYTE_LENGTH+" bytes in length.")}else if(!(o instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, Uint8Array, or a binary string.');o=u({message:o,encoding:"binary"});for(var t=new f(s.constants.PUBLIC_KEY_BYTE_LENGTH),e=new f(s.constants.PRIVATE_KEY_BYTE_LENGTH),a=0;a<32;++a)e[a]=o[a];return d(t,e),{publicKey:t,privateKey:e}},s.privateKeyFromAsn1=function(r){var o={},t=[];if(!n.asn1.validate(r,e,o,t)){var a=new Error("Invalid Key.");throw a.errors=t,a}var i=n.asn1.derToOid(o.privateKeyOid),f=n.oids.EdDSA25519;if(i!==f)throw new Error('Invalid OID "'+i+'"; OID must be "'+f+'".');var s=o.privateKey;return{privateKeyBytes:u({message:n.asn1.fromDer(s).value,encoding:"binary"})}},s.publicKeyFromAsn1=function(r){var o={},e=[];if(!n.asn1.validate(r,t,o,e)){var a=new Error("Invalid Key.");throw a.errors=e,a}var i=n.asn1.derToOid(o.publicKeyOid),f=n.oids.EdDSA25519;if(i!==f)throw new Error('Invalid OID "'+i+'"; OID must be "'+f+'".');var E=o.ed25519PublicKey;if(E.length!==s.constants.PUBLIC_KEY_BYTE_LENGTH)throw new Error("Key length is invalid.");return u({message:E,encoding:"binary"})},s.publicKeyFromPrivateKey=function(r){var n=u({message:(r=r||{}).privateKey,encoding:"binary"});if(n.length!==s.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+s.constants.PRIVATE_KEY_BYTE_LENGTH);for(var o=new f(s.constants.PUBLIC_KEY_BYTE_LENGTH),t=0;t<o.length;++t)o[t]=n[32+t];return o},s.sign=function(r){var n=u(r=r||{}),o=u({message:r.privateKey,encoding:"binary"});if(o.length===s.constants.SEED_BYTE_LENGTH)o=s.generateKeyPair({seed:o}).privateKey;else if(o.length!==s.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+s.constants.SEED_BYTE_LENGTH+" or "+s.constants.PRIVATE_KEY_BYTE_LENGTH);var t=new f(s.constants.SIGN_BYTE_LENGTH+n.length);B(t,n,n.length,o);for(var e=new f(s.constants.SIGN_BYTE_LENGTH),a=0;a<e.length;++a)e[a]=t[a];return e},s.verify=function(r){var n=u(r=r||{});if(void 0===r.signature)throw new TypeError('"options.signature" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a binary string.');var o=u({message:r.signature,encoding:"binary"});if(o.length!==s.constants.SIGN_BYTE_LENGTH)throw new TypeError('"options.signature" must have a byte length of '+s.constants.SIGN_BYTE_LENGTH);var t=u({message:r.publicKey,encoding:"binary"});if(t.length!==s.constants.PUBLIC_KEY_BYTE_LENGTH)throw new TypeError('"options.publicKey" must have a byte length of '+s.constants.PUBLIC_KEY_BYTE_LENGTH);var e,a=new f(s.constants.SIGN_BYTE_LENGTH+n.length),i=new f(s.constants.SIGN_BYTE_LENGTH+n.length);for(e=0;e<s.constants.SIGN_BYTE_LENGTH;++e)a[e]=o[e];for(e=0;e<n.length;++e)a[e+s.constants.SIGN_BYTE_LENGTH]=n[e];return w(i,a,a.length,t)>=0};var E=C(),c=C([1]),v=C([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),l=C([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),h=C([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),y=C([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),T=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),g=C([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function _(o,t){var e=n.md.sha512.create(),a=new i(o);e.update(a.getBytes(t),"binary");var u=e.digest().getBytes();if(void 0!==r)return r.from(u,"binary");for(var E=new f(s.constants.HASH_BYTE_LENGTH),c=0;c<64;++c)E[c]=u.charCodeAt(c);return E}function d(r,n){var o,t=[C(),C(),C(),C()],e=_(n,32);for(e[0]&=248,e[31]&=127,e[31]|=64,D(t,e),N(r,t),o=0;o<32;++o)n[o+32]=r[o];return 0}function B(r,n,o,t){var e,a,i=new Float64Array(64),f=[C(),C(),C(),C()],s=_(t,32);s[0]&=248,s[31]&=127,s[31]|=64;var u=o+64;for(e=0;e<o;++e)r[64+e]=n[e];for(e=0;e<32;++e)r[32+e]=s[32+e];var E=_(r.subarray(32),o+32);for(Y(E),D(f,E),N(r,f),e=32;e<64;++e)r[e]=t[e];var c=_(r,o+64);for(Y(c),e=32;e<64;++e)i[e]=0;for(e=0;e<32;++e)i[e]=E[e];for(e=0;e<32;++e)for(a=0;a<32;a++)i[e+a]+=c[e]*s[a];return p(r.subarray(32),i),u}function w(r,n,o,t){var e,a=new f(32),i=[C(),C(),C(),C()],s=[C(),C(),C(),C()];if(-1,o<64)return-1;if(L(s,t))return-1;for(e=0;e<o;++e)r[e]=n[e];for(e=0;e<32;++e)r[e+32]=t[e];var u=_(r,o);if(Y(u),P(i,s,u),D(s,n.subarray(32)),b(i,s),N(a,i),o-=64,I(n,0,a,0)){for(e=0;e<o;++e)r[e]=0;return-1}for(e=0;e<o;++e)r[e]=n[e+64];return o}function p(r,n){var o,t,e,a;for(t=63;t>=32;--t){for(o=0,e=t-32,a=t-12;e<a;++e)n[e]+=o-16*n[t]*T[e-(t-32)],o=n[e]+128>>8,n[e]-=256*o;n[e]+=o,n[t]=0}for(o=0,e=0;e<32;++e)n[e]+=o-(n[31]>>4)*T[e],o=n[e]>>8,n[e]&=255;for(e=0;e<32;++e)n[e]-=o*T[e];for(t=0;t<32;++t)n[t+1]+=n[t]>>8,r[t]=255&n[t]}function Y(r){for(var n=new Float64Array(64),o=0;o<64;++o)n[o]=r[o],r[o]=0;p(r,n)}function b(r,n){var o=C(),t=C(),e=C(),a=C(),i=C(),f=C(),s=C(),u=C(),E=C();R(o,r[1],r[0]),R(E,n[1],n[0]),k(o,o,E),F(t,r[0],r[1]),F(E,n[0],n[1]),k(t,t,E),k(e,r[3],n[3]),k(e,e,l),k(a,r[2],n[2]),F(a,a,a),R(i,t,o),R(f,a,e),F(s,a,e),F(u,t,o),k(r[0],i,f),k(r[1],u,s),k(r[2],s,f),k(r[3],i,u)}function G(r,n,o){for(var t=0;t<4;++t)q(r[t],n[t],o)}function N(r,n){var o=C(),t=C(),e=C();O(e,n[2]),k(o,n[0],e),k(t,n[1],e),K(r,t),r[31]^=S(o)<<7}function K(r,n){var o,t,e,a=C(),i=C();for(o=0;o<16;++o)i[o]=n[o];for(V(i),V(i),V(i),t=0;t<2;++t){for(a[0]=i[0]-65517,o=1;o<15;++o)a[o]=i[o]-65535-(a[o-1]>>16&1),a[o-1]&=65535;a[15]=i[15]-32767-(a[14]>>16&1),e=a[15]>>16&1,a[14]&=65535,q(i,a,1-e)}for(o=0;o<16;o++)r[2*o]=255&i[o],r[2*o+1]=i[o]>>8}function L(r,n){var o=C(),t=C(),e=C(),a=C(),i=C(),f=C(),s=C();return U(r[2],c),m(r[1],n),j(e,r[1]),k(a,e,v),R(e,e,r[2]),F(a,r[2],a),j(i,a),j(f,i),k(s,f,i),k(o,s,e),k(o,o,a),H(o,o),k(o,o,e),k(o,o,a),k(o,o,a),k(r[0],o,a),j(t,r[0]),k(t,t,a),M(t,e)&&k(r[0],r[0],g),j(t,r[0]),k(t,t,a),M(t,e)?-1:(S(r[0])===n[31]>>7&&R(r[0],E,r[0]),k(r[3],r[0],r[1]),0)}function m(r,n){var o;for(o=0;o<16;++o)r[o]=n[2*o]+(n[2*o+1]<<8);r[15]&=32767}function H(r,n){var o,t=C();for(o=0;o<16;++o)t[o]=n[o];for(o=250;o>=0;--o)j(t,t),1!==o&&k(t,t,n);for(o=0;o<16;++o)r[o]=t[o]}function M(r,n){var o=new f(32),t=new f(32);return K(o,r),K(t,n),I(o,0,t,0)}function I(r,n,o,t){return A(r,n,o,t,32)}function A(r,n,o,t,e){var a,i=0;for(a=0;a<e;++a)i|=r[n+a]^o[t+a];return(1&i-1>>>8)-1}function S(r){var n=new f(32);return K(n,r),1&n[0]}function P(r,n,o){var t,e;for(U(r[0],E),U(r[1],c),U(r[2],c),U(r[3],E),e=255;e>=0;--e)G(r,n,t=o[e/8|0]>>(7&e)&1),b(n,r),b(r,r),G(r,n,t)}function D(r,n){var o=[C(),C(),C(),C()];U(o[0],h),U(o[1],y),U(o[2],c),k(o[3],h,y),P(r,o,n)}function U(r,n){var o;for(o=0;o<16;o++)r[o]=0|n[o]}function O(r,n){var o,t=C();for(o=0;o<16;++o)t[o]=n[o];for(o=253;o>=0;--o)j(t,t),2!==o&&4!==o&&k(t,t,n);for(o=0;o<16;++o)r[o]=t[o]}function V(r){var n,o,t=1;for(n=0;n<16;++n)o=r[n]+t+65535,t=Math.floor(o/65536),r[n]=o-65536*t;r[0]+=t-1+37*(t-1)}function q(r,n,o){for(var t,e=~(o-1),a=0;a<16;++a)t=e&(r[a]^n[a]),r[a]^=t,n[a]^=t}function C(r){var n,o=new Float64Array(16);if(r)for(n=0;n<r.length;++n)o[n]=r[n];return o}function F(r,n,o){for(var t=0;t<16;++t)r[t]=n[t]+o[t]}function R(r,n,o){for(var t=0;t<16;++t)r[t]=n[t]-o[t]}function j(r,n){k(r,n,n)}function k(r,n,o){var t,e,a=0,i=0,f=0,s=0,u=0,E=0,c=0,v=0,l=0,h=0,y=0,T=0,g=0,_=0,d=0,B=0,w=0,p=0,Y=0,b=0,G=0,N=0,K=0,L=0,m=0,H=0,M=0,I=0,A=0,S=0,P=0,D=o[0],U=o[1],O=o[2],V=o[3],q=o[4],C=o[5],F=o[6],R=o[7],j=o[8],k=o[9],x=o[10],z=o[11],J=o[12],Q=o[13],W=o[14],X=o[15];a+=(t=n[0])*D,i+=t*U,f+=t*O,s+=t*V,u+=t*q,E+=t*C,c+=t*F,v+=t*R,l+=t*j,h+=t*k,y+=t*x,T+=t*z,g+=t*J,_+=t*Q,d+=t*W,B+=t*X,i+=(t=n[1])*D,f+=t*U,s+=t*O,u+=t*V,E+=t*q,c+=t*C,v+=t*F,l+=t*R,h+=t*j,y+=t*k,T+=t*x,g+=t*z,_+=t*J,d+=t*Q,B+=t*W,w+=t*X,f+=(t=n[2])*D,s+=t*U,u+=t*O,E+=t*V,c+=t*q,v+=t*C,l+=t*F,h+=t*R,y+=t*j,T+=t*k,g+=t*x,_+=t*z,d+=t*J,B+=t*Q,w+=t*W,p+=t*X,s+=(t=n[3])*D,u+=t*U,E+=t*O,c+=t*V,v+=t*q,l+=t*C,h+=t*F,y+=t*R,T+=t*j,g+=t*k,_+=t*x,d+=t*z,B+=t*J,w+=t*Q,p+=t*W,Y+=t*X,u+=(t=n[4])*D,E+=t*U,c+=t*O,v+=t*V,l+=t*q,h+=t*C,y+=t*F,T+=t*R,g+=t*j,_+=t*k,d+=t*x,B+=t*z,w+=t*J,p+=t*Q,Y+=t*W,b+=t*X,E+=(t=n[5])*D,c+=t*U,v+=t*O,l+=t*V,h+=t*q,y+=t*C,T+=t*F,g+=t*R,_+=t*j,d+=t*k,B+=t*x,w+=t*z,p+=t*J,Y+=t*Q,b+=t*W,G+=t*X,c+=(t=n[6])*D,v+=t*U,l+=t*O,h+=t*V,y+=t*q,T+=t*C,g+=t*F,_+=t*R,d+=t*j,B+=t*k,w+=t*x,p+=t*z,Y+=t*J,b+=t*Q,G+=t*W,N+=t*X,v+=(t=n[7])*D,l+=t*U,h+=t*O,y+=t*V,T+=t*q,g+=t*C,_+=t*F,d+=t*R,B+=t*j,w+=t*k,p+=t*x,Y+=t*z,b+=t*J,G+=t*Q,N+=t*W,K+=t*X,l+=(t=n[8])*D,h+=t*U,y+=t*O,T+=t*V,g+=t*q,_+=t*C,d+=t*F,B+=t*R,w+=t*j,p+=t*k,Y+=t*x,b+=t*z,G+=t*J,N+=t*Q,K+=t*W,L+=t*X,h+=(t=n[9])*D,y+=t*U,T+=t*O,g+=t*V,_+=t*q,d+=t*C,B+=t*F,w+=t*R,p+=t*j,Y+=t*k,b+=t*x,G+=t*z,N+=t*J,K+=t*Q,L+=t*W,m+=t*X,y+=(t=n[10])*D,T+=t*U,g+=t*O,_+=t*V,d+=t*q,B+=t*C,w+=t*F,p+=t*R,Y+=t*j,b+=t*k,G+=t*x,N+=t*z,K+=t*J,L+=t*Q,m+=t*W,H+=t*X,T+=(t=n[11])*D,g+=t*U,_+=t*O,d+=t*V,B+=t*q,w+=t*C,p+=t*F,Y+=t*R,b+=t*j,G+=t*k,N+=t*x,K+=t*z,L+=t*J,m+=t*Q,H+=t*W,M+=t*X,g+=(t=n[12])*D,_+=t*U,d+=t*O,B+=t*V,w+=t*q,p+=t*C,Y+=t*F,b+=t*R,G+=t*j,N+=t*k,K+=t*x,L+=t*z,m+=t*J,H+=t*Q,M+=t*W,I+=t*X,_+=(t=n[13])*D,d+=t*U,B+=t*O,w+=t*V,p+=t*q,Y+=t*C,b+=t*F,G+=t*R,N+=t*j,K+=t*k,L+=t*x,m+=t*z,H+=t*J,M+=t*Q,I+=t*W,A+=t*X,d+=(t=n[14])*D,B+=t*U,w+=t*O,p+=t*V,Y+=t*q,b+=t*C,G+=t*F,N+=t*R,K+=t*j,L+=t*k,m+=t*x,H+=t*z,M+=t*J,I+=t*Q,A+=t*W,S+=t*X,B+=(t=n[15])*D,i+=38*(p+=t*O),f+=38*(Y+=t*V),s+=38*(b+=t*q),u+=38*(G+=t*C),E+=38*(N+=t*F),c+=38*(K+=t*R),v+=38*(L+=t*j),l+=38*(m+=t*k),h+=38*(H+=t*x),y+=38*(M+=t*z),T+=38*(I+=t*J),g+=38*(A+=t*Q),_+=38*(S+=t*W),d+=38*(P+=t*X),a=(t=(a+=38*(w+=t*U))+(e=1)+65535)-65536*(e=Math.floor(t/65536)),i=(t=i+e+65535)-65536*(e=Math.floor(t/65536)),f=(t=f+e+65535)-65536*(e=Math.floor(t/65536)),s=(t=s+e+65535)-65536*(e=Math.floor(t/65536)),u=(t=u+e+65535)-65536*(e=Math.floor(t/65536)),E=(t=E+e+65535)-65536*(e=Math.floor(t/65536)),c=(t=c+e+65535)-65536*(e=Math.floor(t/65536)),v=(t=v+e+65535)-65536*(e=Math.floor(t/65536)),l=(t=l+e+65535)-65536*(e=Math.floor(t/65536)),h=(t=h+e+65535)-65536*(e=Math.floor(t/65536)),y=(t=y+e+65535)-65536*(e=Math.floor(t/65536)),T=(t=T+e+65535)-65536*(e=Math.floor(t/65536)),g=(t=g+e+65535)-65536*(e=Math.floor(t/65536)),_=(t=_+e+65535)-65536*(e=Math.floor(t/65536)),d=(t=d+e+65535)-65536*(e=Math.floor(t/65536)),B=(t=B+e+65535)-65536*(e=Math.floor(t/65536)),a=(t=(a+=e-1+37*(e-1))+(e=1)+65535)-65536*(e=Math.floor(t/65536)),i=(t=i+e+65535)-65536*(e=Math.floor(t/65536)),f=(t=f+e+65535)-65536*(e=Math.floor(t/65536)),s=(t=s+e+65535)-65536*(e=Math.floor(t/65536)),u=(t=u+e+65535)-65536*(e=Math.floor(t/65536)),E=(t=E+e+65535)-65536*(e=Math.floor(t/65536)),c=(t=c+e+65535)-65536*(e=Math.floor(t/65536)),v=(t=v+e+65535)-65536*(e=Math.floor(t/65536)),l=(t=l+e+65535)-65536*(e=Math.floor(t/65536)),h=(t=h+e+65535)-65536*(e=Math.floor(t/65536)),y=(t=y+e+65535)-65536*(e=Math.floor(t/65536)),T=(t=T+e+65535)-65536*(e=Math.floor(t/65536)),g=(t=g+e+65535)-65536*(e=Math.floor(t/65536)),_=(t=_+e+65535)-65536*(e=Math.floor(t/65536)),d=(t=d+e+65535)-65536*(e=Math.floor(t/65536)),B=(t=B+e+65535)-65536*(e=Math.floor(t/65536)),a+=e-1+37*(e-1),r[0]=a,r[1]=i,r[2]=f,r[3]=s,r[4]=u,r[5]=E,r[6]=c,r[7]=v,r[8]=l,r[9]=h,r[10]=y,r[11]=T,r[12]=g,r[13]=_,r[14]=d,r[15]=B}
|
||
},{"./forge":"sQ2N","./jsbn":"Xh/Z","./random":"O9pb","./sha512":"3udX","./util":"2FVR","./asn1-validator":"ZcDB","buffer":"sC8V"}],"x6+9":[function(require,module,exports) {
|
||
"use strict";require("node-forge/lib/util"),require("node-forge/lib/jsbn");var r=require("node-forge/lib/forge"),e=require("uint8arrays/from-string"),n=require("uint8arrays/to-string"),t=require("uint8arrays/concat");exports.bigIntegerToUintBase64url=function(r,e){var i=Uint8Array.from(r.abs().toByteArray());if(i=0===i[0]?i.slice(1):i,null!=e){if(i.length>e)throw new Error("byte array longer than desired length");i=t([new Uint8Array(e-i.length),i])}return n(i,"base64url")},exports.base64urlToBigInteger=function(e){var t=exports.base64urlToBuffer(e);return new r.jsbn.BigInteger(n(t,"base16"),16)},exports.base64urlToBuffer=function(r,n){var i=e(r,"base64urlpad");if(null!=n){if(i.length>n)throw new Error("byte array longer than desired length");i=t([new Uint8Array(n-i.length),i])}return i};
|
||
},{"node-forge/lib/util":"2FVR","node-forge/lib/jsbn":"Xh/Z","node-forge/lib/forge":"sQ2N","uint8arrays/from-string":"YucU","uint8arrays/to-string":"Jm0S","uint8arrays/concat":"qYui"}],"ALsm":[function(require,module,exports) {
|
||
"use strict";require("node-forge/lib/asn1"),require("node-forge/lib/rsa");var e=require("node-forge/lib/forge"),r=require("./../util"),i=r.bigIntegerToUintBase64url,n=r.base64urlToBigInteger,t=require("uint8arrays/from-string"),o=require("uint8arrays/to-string");exports.pkcs1ToJwk=function(r){var n=e.asn1.fromDer(o(r,"ascii")),t=e.pki.privateKeyFromAsn1(n);return{kty:"RSA",n:i(t.n),e:i(t.e),d:i(t.d),p:i(t.p),q:i(t.q),dp:i(t.dP),dq:i(t.dQ),qi:i(t.qInv),alg:"RS256",kid:"2011-04-29"}},exports.jwkToPkcs1=function(r){var i=e.pki.privateKeyToAsn1({n:n(r.n),e:n(r.e),d:n(r.d),p:n(r.p),q:n(r.q),dP:n(r.dp),dQ:n(r.dq),qInv:n(r.qi)});return t(e.asn1.toDer(i).getBytes(),"ascii")},exports.pkixToJwk=function(r){var n=e.asn1.fromDer(o(r,"ascii")),t=e.pki.publicKeyFromAsn1(n);return{kty:"RSA",n:i(t.n),e:i(t.e),alg:"RS256",kid:"2011-04-29"}},exports.jwkToPkix=function(r){var i=e.pki.publicKeyToAsn1({n:n(r.n),e:n(r.e)});return t(e.asn1.toDer(i).getBytes(),"ascii")};
|
||
},{"node-forge/lib/asn1":"dLTu","node-forge/lib/rsa":"NW38","node-forge/lib/forge":"sQ2N","./../util":"x6+9","uint8arrays/from-string":"YucU","uint8arrays/to-string":"Jm0S"}],"LR2D":[function(require,module,exports) {
|
||
"use strict";function r(r){return o(r)||n(r)||t(r)||e()}function e(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function t(r,e){if(r){if("string"==typeof r)return i(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?i(r,e):void 0}}function n(r){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(r))return Array.from(r)}function o(r){if(Array.isArray(r))return i(r)}function i(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}require("node-forge/lib/rsa");var a=require("node-forge/lib/forge"),u=require("../util"),c=u.base64urlToBigInteger;function f(r,e){return e.map(function(e){return c(r[e])})}function l(e){var t;return(t=a.pki).setRsaPrivateKey.apply(t,r(f(e,["n","e","d","p","q","dp","dq","qi"])))}function p(e){var t;return(t=a.pki).setRsaPublicKey.apply(t,r(f(e,["n","e"])))}module.exports={jwk2pub:p,jwk2priv:l};
|
||
},{"node-forge/lib/rsa":"NW38","node-forge/lib/forge":"sQ2N","../util":"x6+9"}],"EVas":[function(require,module,exports) {
|
||
"use strict";function e(e,r,t,n,u,a,i){try{var s=e[a](i),o=s.value}catch(c){return void t(c)}s.done?r(o):Promise.resolve(o).then(n,u)}function r(r){return function(){var t=this,n=arguments;return new Promise(function(u,a){var i=r.apply(t,n);function s(r){e(i,u,a,s,o,"next",r)}function o(r){e(i,u,a,s,o,"throw",r)}s(void 0)})}}var t=require("../webcrypto"),n=require("../random-bytes"),u=require("uint8arrays/to-string"),a=require("uint8arrays/from-string");function i(e){return Promise.all([t.get().subtle.exportKey("jwk",e.privateKey),t.get().subtle.exportKey("jwk",e.publicKey)])}function s(e){return t.get().subtle.importKey("jwk",{kty:e.kty,n:e.n,e:e.e},{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"])}exports.utils=require("./rsa-utils"),exports.generateKey=function(){var e=r(regeneratorRuntime.mark(function e(r){var n,u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.get().subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:r,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]);case 2:return n=e.sent,e.next=5,i(n);case 5:return u=e.sent,e.abrupt("return",{privateKey:u[0],publicKey:u[1]});case 7:case"end":return e.stop()}},e)}));return function(r){return e.apply(this,arguments)}}(),exports.unmarshalPrivateKey=function(){var e=r(regeneratorRuntime.mark(function e(r){var n,u,a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.get().subtle.importKey("jwk",r,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]);case 2:return n=e.sent,e.t0=n,e.next=6,s(r);case 6:return e.t1=e.sent,u=[e.t0,e.t1],e.next=10,i({privateKey:u[0],publicKey:u[1]});case 10:return a=e.sent,e.abrupt("return",{privateKey:a[0],publicKey:a[1]});case 12:case"end":return e.stop()}},e)}));return function(r){return e.apply(this,arguments)}}(),exports.getRandomValues=n,exports.hashAndSign=function(){var e=r(regeneratorRuntime.mark(function e(r,n){var u,a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.get().subtle.importKey("jwk",r,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]);case 2:return u=e.sent,e.next=5,t.get().subtle.sign({name:"RSASSA-PKCS1-v1_5"},u,Uint8Array.from(n));case 5:return a=e.sent,e.abrupt("return",new Uint8Array(a,a.byteOffset,a.byteLength));case 7:case"end":return e.stop()}},e)}));return function(r,t){return e.apply(this,arguments)}}(),exports.hashAndVerify=function(){var e=r(regeneratorRuntime.mark(function e(r,n,u){var a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.get().subtle.importKey("jwk",r,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]);case 2:return a=e.sent,e.abrupt("return",t.get().subtle.verify({name:"RSASSA-PKCS1-v1_5"},a,n,u));case 4:case"end":return e.stop()}},e)}));return function(r,t,n){return e.apply(this,arguments)}}();var o=require("./jwk2pem"),c=o.jwk2pub,p=o.jwk2priv;function y(e,r,t,n){var i=r?c(e):p(e),s=n(u(Uint8Array.from(t),"ascii"),i);return a(s,"ascii")}exports.encrypt=function(e,r){return y(e,!0,r,function(e,r){return r.encrypt(e)})},exports.decrypt=function(e,r){return y(e,!1,r,function(e,r){return r.decrypt(e)})};
|
||
},{"../webcrypto":"AJ6b","../random-bytes":"rthE","uint8arrays/to-string":"Jm0S","uint8arrays/from-string":"YucU","./rsa-utils":"ALsm","./jwk2pem":"LR2D"}],"ZVUN":[function(require,module,exports) {
|
||
"use strict";function e(e,r,n,t,u,o,a){try{var i=e[o](a),c=i.value}catch(s){return void n(s)}i.done?r(c):Promise.resolve(c).then(t,u)}function r(r){return function(){var n=this,t=arguments;return new Promise(function(u,o){var a=r.apply(n,t);function i(r){e(a,u,o,i,c,"next",r)}function c(r){e(a,u,o,i,c,"throw",r)}i(void 0)})}}var n=require("multibase"),t=require("../ciphers/aes-gcm");module.exports={export:function(){var e=r(regeneratorRuntime.mark(function e(r,u){var o,a,i;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return o=t.create(),e.next=3,o.encrypt(r,u);case 3:return a=e.sent,i=n.names.base64,e.abrupt("return",i.encode(a));case 6:case"end":return e.stop()}},e)}));return function(r,n){return e.apply(this,arguments)}}()};
|
||
},{"multibase":"DTy7","../ciphers/aes-gcm":"kJUv"}],"QXfk":[function(require,module,exports) {
|
||
"use strict";function e(e,r,t,n,u,i,a){try{var s=e[i](a),o=s.value}catch(c){return void t(c)}s.done?r(o):Promise.resolve(o).then(n,u)}function r(r){return function(){var t=this,n=arguments;return new Promise(function(u,i){var a=r.apply(t,n);function s(r){e(a,u,i,s,o,"next",r)}function o(r){e(a,u,i,s,o,"throw",r)}s(void 0)})}}function t(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function n(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,r,t){return r&&n(e.prototype,r),t&&n(e,t),e}var i=require("multihashing-async/src/sha"),a=require("err-code"),s=require("uint8arrays/equals"),o=require("uint8arrays/to-string");require("node-forge/lib/sha512"),require("node-forge/lib/ed25519");var c=require("node-forge/lib/forge"),p=require("./rsa"),f=require("./keys"),h=require("./exporter"),y=function(){function e(r){t(this,e),this._key=r}return u(e,[{key:"verify",value:function(){var e=r(regeneratorRuntime.mark(function e(r,t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",p.hashAndVerify(this._key,t,r));case 1:case"end":return e.stop()}},e,this)}));return function(r,t){return e.apply(this,arguments)}}()},{key:"marshal",value:function(){return p.utils.jwkToPkix(this._key)}},{key:"bytes",get:function(){return f.PublicKey.encode({Type:f.KeyType.RSA,Data:this.marshal()}).finish()}},{key:"encrypt",value:function(e){return p.encrypt(this._key,e)}},{key:"equals",value:function(e){return s(this.bytes,e.bytes)}},{key:"hash",value:function(){var e=r(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",i.multihashing(this.bytes,"sha2-256"));case 1:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}]),e}(),l=function(){function e(r,n){t(this,e),this._key=r,this._publicKey=n}return u(e,[{key:"genSecret",value:function(){return p.getRandomValues(16)}},{key:"sign",value:function(){var e=r(regeneratorRuntime.mark(function e(r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",p.hashAndSign(this._key,r));case 1:case"end":return e.stop()}},e,this)}));return function(r){return e.apply(this,arguments)}}()},{key:"public",get:function(){if(!this._publicKey)throw a(new Error("public key not provided"),"ERR_PUBKEY_NOT_PROVIDED");return new y(this._publicKey)}},{key:"decrypt",value:function(e){return p.decrypt(this._key,e)}},{key:"marshal",value:function(){return p.utils.jwkToPkcs1(this._key)}},{key:"bytes",get:function(){return f.PrivateKey.encode({Type:f.KeyType.RSA,Data:this.marshal()}).finish()}},{key:"equals",value:function(e){return s(this.bytes,e.bytes)}},{key:"hash",value:function(){var e=r(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",i.multihashing(this.bytes,"sha2-256"));case 1:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"id",value:function(){var e=r(regeneratorRuntime.mark(function e(){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.public.hash();case 2:return r=e.sent,e.abrupt("return",o(r,"base58btc"));case 4:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"export",value:function(){var e=r(regeneratorRuntime.mark(function e(r){var t,n,u,i,s,o=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("pkcs-8"!==(t=o.length>1&&void 0!==o[1]?o[1]:"pkcs-8")){e.next=9;break}return n=new c.util.ByteBuffer(this.marshal()),u=c.asn1.fromDer(n),i=c.pki.privateKeyFromAsn1(u),s={algorithm:"aes256",count:1e4,saltSize:16,prfAlgorithm:"sha512"},e.abrupt("return",c.pki.encryptRsaPrivateKey(i,r,s));case 9:if("libp2p-key"!==t){e.next=13;break}return e.abrupt("return",h.export(this.bytes,r));case 13:throw a(new Error("export format '".concat(t,"' is not supported")),"ERR_INVALID_EXPORT_FORMAT");case 14:case"end":return e.stop()}},e,this)}));return function(r){return e.apply(this,arguments)}}()}]),e}();function v(e){return k.apply(this,arguments)}function k(){return(k=r(regeneratorRuntime.mark(function e(r){var t,n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=p.utils.pkcs1ToJwk(r),e.next=3,p.unmarshalPrivateKey(t);case 3:return n=e.sent,e.abrupt("return",new l(n.privateKey,n.publicKey));case 5:case"end":return e.stop()}},e)}))).apply(this,arguments)}function m(e){var r=p.utils.pkixToJwk(e);return new y(r)}function b(e){return g.apply(this,arguments)}function g(){return(g=r(regeneratorRuntime.mark(function e(r){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,p.unmarshalPrivateKey(r);case 2:return t=e.sent,e.abrupt("return",new l(t.privateKey,t.publicKey));case 4:case"end":return e.stop()}},e)}))).apply(this,arguments)}function w(e){return R.apply(this,arguments)}function R(){return(R=r(regeneratorRuntime.mark(function e(r){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,p.generateKey(r);case 2:return t=e.sent,e.abrupt("return",new l(t.privateKey,t.publicKey));case 4:case"end":return e.stop()}},e)}))).apply(this,arguments)}module.exports={RsaPublicKey:y,RsaPrivateKey:l,unmarshalRsaPublicKey:m,unmarshalRsaPrivateKey:v,generateKeyPair:w,fromJwk:b};
|
||
},{"multihashing-async/src/sha":"udZl","err-code":"hLMW","uint8arrays/equals":"mZxc","uint8arrays/to-string":"Jm0S","node-forge/lib/sha512":"3udX","node-forge/lib/ed25519":"Swl7","node-forge/lib/forge":"sQ2N","./rsa":"EVas","./keys":"HRSQ","./exporter":"ZVUN"}],"B0cS":[function(require,module,exports) {
|
||
"use strict";function e(e,r,n,t,u,i,a){try{var o=e[i](a),s=o.value}catch(c){return void n(c)}o.done?r(s):Promise.resolve(s).then(t,u)}function r(r){return function(){var n=this,t=arguments;return new Promise(function(u,i){var a=r.apply(n,t);function o(r){e(a,u,i,o,s,"next",r)}function s(r){e(a,u,i,o,s,"throw",r)}o(void 0)})}}require("node-forge/lib/ed25519");var n=require("node-forge/lib/forge");exports.publicKeyLength=n.pki.ed25519.constants.PUBLIC_KEY_BYTE_LENGTH,exports.privateKeyLength=n.pki.ed25519.constants.PRIVATE_KEY_BYTE_LENGTH,exports.generateKey=r(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.pki.ed25519.generateKeyPair());case 1:case"end":return e.stop()}},e)})),exports.generateKeyFromSeed=function(){var e=r(regeneratorRuntime.mark(function e(r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.pki.ed25519.generateKeyPair({seed:r}));case 1:case"end":return e.stop()}},e)}));return function(r){return e.apply(this,arguments)}}(),exports.hashAndSign=function(){var e=r(regeneratorRuntime.mark(function e(r,t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.pki.ed25519.sign({message:t,privateKey:r}));case 1:case"end":return e.stop()}},e)}));return function(r,n){return e.apply(this,arguments)}}(),exports.hashAndVerify=function(){var e=r(regeneratorRuntime.mark(function e(r,t,u){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.pki.ed25519.verify({signature:t,message:u,publicKey:r}));case 1:case"end":return e.stop()}},e)}));return function(r,n,t){return e.apply(this,arguments)}}();
|
||
},{"node-forge/lib/ed25519":"Swl7","node-forge/lib/forge":"sQ2N"}],"UKMf":[function(require,module,exports) {
|
||
"use strict";function e(e,r,t,n,u,i,a){try{var s=e[i](a),o=s.value}catch(c){return void t(c)}s.done?r(o):Promise.resolve(o).then(n,u)}function r(r){return function(){var t=this,n=arguments;return new Promise(function(u,i){var a=r.apply(t,n);function s(r){e(a,u,i,s,o,"next",r)}function o(r){e(a,u,i,s,o,"throw",r)}s(void 0)})}}function t(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function n(e,r){for(var t=0;t<r.length;t++){var n=r[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,r,t){return r&&n(e.prototype,r),t&&n(e,t),e}var i=require("multihashing-async/src/sha"),a=require("err-code"),s=require("uint8arrays/equals"),o=require("multihashes"),c=require("./ed25519"),h=require("./keys"),p=require("./exporter"),y=function(){function e(r){t(this,e),this._key=k(r,c.publicKeyLength)}return u(e,[{key:"verify",value:function(){var e=r(regeneratorRuntime.mark(function e(r,t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",c.hashAndVerify(this._key,t,r));case 1:case"end":return e.stop()}},e,this)}));return function(r,t){return e.apply(this,arguments)}}()},{key:"marshal",value:function(){return this._key}},{key:"bytes",get:function(){return h.PublicKey.encode({Type:h.KeyType.Ed25519,Data:this.marshal()}).finish()}},{key:"equals",value:function(e){return s(this.bytes,e.bytes)}},{key:"hash",value:function(){var e=r(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",i.multihashing(this.bytes,"sha2-256"));case 1:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}]),e}(),f=function(){function e(r,n){t(this,e),this._key=k(r,c.privateKeyLength),this._publicKey=k(n,c.publicKeyLength)}return u(e,[{key:"sign",value:function(){var e=r(regeneratorRuntime.mark(function e(r){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",c.hashAndSign(this._key,r));case 1:case"end":return e.stop()}},e,this)}));return function(r){return e.apply(this,arguments)}}()},{key:"public",get:function(){return new y(this._publicKey)}},{key:"marshal",value:function(){return this._key}},{key:"bytes",get:function(){return h.PrivateKey.encode({Type:h.KeyType.Ed25519,Data:this.marshal()}).finish()}},{key:"equals",value:function(e){return s(this.bytes,e.bytes)}},{key:"hash",value:function(){var e=r(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",i.multihashing(this.bytes,"sha2-256"));case 1:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"id",value:function(){var e=r(regeneratorRuntime.mark(function e(){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=o.encode(this.public.bytes,"identity"),e.next=3,o.toB58String(r);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"export",value:function(){var e=r(regeneratorRuntime.mark(function e(r){var t,n=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("libp2p-key"!==(t=n.length>1&&void 0!==n[1]?n[1]:"libp2p-key")){e.next=5;break}return e.abrupt("return",p.export(this.bytes,r));case 5:throw a(new Error("export format '".concat(t,"' is not supported")),"ERR_INVALID_EXPORT_FORMAT");case 6:case"end":return e.stop()}},e,this)}));return function(r){return e.apply(this,arguments)}}()}]),e}();function l(e){if(e.length>c.privateKeyLength){var r=(e=k(e,c.privateKeyLength+c.publicKeyLength)).slice(0,c.privateKeyLength),t=e.slice(c.privateKeyLength,e.length);return new f(r,t)}var n=(e=k(e,c.privateKeyLength)).slice(0,c.privateKeyLength),u=e.slice(c.publicKeyLength);return new f(n,u)}function v(e){return e=k(e,c.publicKeyLength),new y(e)}function g(){return m.apply(this,arguments)}function m(){return(m=r(regeneratorRuntime.mark(function e(){var r,t,n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,c.generateKey();case 2:return r=e.sent,t=r.privateKey,n=r.publicKey,e.abrupt("return",new f(t,n));case 6:case"end":return e.stop()}},e)}))).apply(this,arguments)}function b(e){return d.apply(this,arguments)}function d(){return(d=r(regeneratorRuntime.mark(function e(r){var t,n,u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,c.generateKeyFromSeed(r);case 2:return t=e.sent,n=t.privateKey,u=t.publicKey,e.abrupt("return",new f(n,u));case 6:case"end":return e.stop()}},e)}))).apply(this,arguments)}function k(e,r){if((e=Uint8Array.from(e||[])).length!==r)throw a(new Error("Key must be a Uint8Array of length ".concat(r,", got ").concat(e.length)),"ERR_INVALID_KEY_TYPE");return e}module.exports={Ed25519PublicKey:y,Ed25519PrivateKey:f,unmarshalEd25519PrivateKey:l,unmarshalEd25519PublicKey:v,generateKeyPair:g,generateKeyPairFromSeed:b};
|
||
},{"multihashing-async/src/sha":"udZl","err-code":"hLMW","uint8arrays/equals":"mZxc","multihashes":"SJ3a","./ed25519":"B0cS","./keys":"HRSQ","./exporter":"ZVUN"}],"btKy":[function(require,module,exports) {
|
||
"use strict";function e(e,r,n,t,i,u,a){try{var c=e[u](a),o=c.value}catch(s){return void n(s)}c.done?r(o):Promise.resolve(o).then(t,i)}function r(r){return function(){var n=this,t=arguments;return new Promise(function(i,u){var a=r.apply(n,t);function c(r){e(a,i,u,c,o,"next",r)}function o(r){e(a,i,u,c,o,"throw",r)}c(void 0)})}}var n=require("secp256k1"),t=require("multihashing-async/src/sha"),i="sha2-256";module.exports=function(e){function u(){return(u=r(regeneratorRuntime.mark(function e(r,u){var a,c;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.digest(u,i);case 2:return a=e.sent,c=n.ecdsaSign(a,r),e.abrupt("return",n.signatureExport(c.signature));case 5:case"end":return e.stop()}},e)}))).apply(this,arguments)}function a(){return(a=r(regeneratorRuntime.mark(function e(r,u,a){var c;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.digest(a,i);case 2:return c=e.sent,u=n.signatureImport(u),e.abrupt("return",n.ecdsaVerify(u,c,r));case 5:case"end":return e.stop()}},e)}))).apply(this,arguments)}function c(e){if(!n.privateKeyVerify(e))throw new Error("Invalid private key")}return{generateKey:function(){var r;do{r=e(32)}while(!n.privateKeyVerify(r));return r},privateKeyLength:32,hashAndSign:function(e,r){return u.apply(this,arguments)},hashAndVerify:function(e,r,n){return a.apply(this,arguments)},compressPublicKey:function(e){if(!n.publicKeyVerify(e))throw new Error("Invalid public key");return n.publicKeyConvert(e,!0)},decompressPublicKey:function(e){return n.publicKeyConvert(e,!1)},validatePrivateKey:c,validatePublicKey:function(e){if(!n.publicKeyVerify(e))throw new Error("Invalid public key")},computePublicKey:function(e){return c(e),n.publicKeyCreate(e)}}};
|
||
},{"secp256k1":"KY6C","multihashing-async/src/sha":"udZl"}],"M1K8":[function(require,module,exports) {
|
||
"use strict";function e(e,t,r,n,i,u,a){try{var s=e[u](a),c=s.value}catch(o){return void r(o)}s.done?t(c):Promise.resolve(c).then(n,i)}function t(t){return function(){var r=this,n=arguments;return new Promise(function(i,u){var a=t.apply(r,n);function s(t){e(a,i,u,s,c,"next",t)}function c(t){e(a,i,u,s,c,"throw",t)}s(void 0)})}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function i(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}var u=require("multihashing-async/src/sha"),a=require("err-code"),s=require("uint8arrays/equals"),c=require("uint8arrays/to-string"),o=require("./exporter");module.exports=function(e,n,y){y=y||require("./secp256k1")(n);var h=function(){function t(e){r(this,t),y.validatePublicKey(e),this._key=e}return i(t,[{key:"verify",value:function(e,t){return y.hashAndVerify(this._key,t,e)}},{key:"marshal",value:function(){return y.compressPublicKey(this._key)}},{key:"bytes",get:function(){return e.PublicKey.encode({Type:e.KeyType.Secp256k1,Data:this.marshal()}).finish()}},{key:"equals",value:function(e){return s(this.bytes,e.bytes)}},{key:"hash",value:function(){return u.multihashing(this.bytes,"sha2-256")}}]),t}(),l=function(){function n(e,t){r(this,n),this._key=e,this._publicKey=t||y.computePublicKey(e),y.validatePrivateKey(this._key),y.validatePublicKey(this._publicKey)}return i(n,[{key:"sign",value:function(e){return y.hashAndSign(this._key,e)}},{key:"public",get:function(){return new h(this._publicKey)}},{key:"marshal",value:function(){return this._key}},{key:"bytes",get:function(){return e.PrivateKey.encode({Type:e.KeyType.Secp256k1,Data:this.marshal()}).finish()}},{key:"equals",value:function(e){return s(this.bytes,e.bytes)}},{key:"hash",value:function(){return u.multihashing(this.bytes,"sha2-256")}},{key:"id",value:function(){var e=t(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.public.hash();case 2:return t=e.sent,e.abrupt("return",c(t,"base58btc"));case 4:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"export",value:function(){var e=t(regeneratorRuntime.mark(function e(t){var r,n=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("libp2p-key"!==(r=n.length>1&&void 0!==n[1]?n[1]:"libp2p-key")){e.next=5;break}return e.abrupt("return",o.export(this.bytes,t));case 5:throw a(new Error("export format '".concat(r,"' is not supported")),"ERR_INVALID_EXPORT_FORMAT");case 6:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),n}();function p(){return(p=t(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,y.generateKey();case 2:return t=e.sent,e.abrupt("return",new l(t));case 4:case"end":return e.stop()}},e)}))).apply(this,arguments)}return{Secp256k1PublicKey:h,Secp256k1PrivateKey:l,unmarshalSecp256k1PrivateKey:function(e){return new l(e)},unmarshalSecp256k1PublicKey:function(e){return new h(e)},generateKeyPair:function(){return p.apply(this,arguments)}}};
|
||
},{"multihashing-async/src/sha":"udZl","err-code":"hLMW","uint8arrays/equals":"mZxc","uint8arrays/to-string":"Jm0S","./exporter":"ZVUN","./secp256k1":"btKy"}],"7XXu":[function(require,module,exports) {
|
||
"use strict";function e(e,r,n,t,i,c,s){try{var a=e[c](s),u=a.value}catch(o){return void n(o)}a.done?r(u):Promise.resolve(u).then(t,i)}function r(r){return function(){var n=this,t=arguments;return new Promise(function(i,c){var s=r.apply(n,t);function a(r){e(s,i,c,a,u,"next",r)}function u(r){e(s,i,c,a,u,"throw",r)}a(void 0)})}}var n=require("err-code"),t=require("uint8arrays/concat"),i=require("uint8arrays/from-string"),c=require("../hmac"),s={"AES-128":{ivSize:16,keySize:16},"AES-256":{ivSize:16,keySize:32},Blowfish:{ivSize:8,cipherKeySize:32}};module.exports=function(){var e=r(regeneratorRuntime.mark(function e(r,a,u){var o,f,h,p,v,y,k,S,l,x,m,w,d,E,g,z,b;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(o=s[r]){e.next=4;break}throw f=Object.keys(s).join(" / "),n(new Error("unknown cipher type '".concat(r,"'. Must be ").concat(f)),"ERR_INVALID_CIPHER_TYPE");case 4:if(a){e.next=6;break}throw n(new Error("missing hash type"),"ERR_MISSING_HASH_TYPE");case 6:return h=o.keySize,p=o.ivSize,20,v=i("key expansion"),y=2*(p+h+20),e.next=13,c.create(a,u);case 13:return k=e.sent,e.next=16,k.digest(v);case 16:S=e.sent,l=[],x=0;case 19:if(!(x<y)){e.next=32;break}return e.next=22,k.digest(t([S,v]));case 22:return m=e.sent,w=m.length,x+w>y&&(w=y-x),l.push(m),x+=w,e.next=29,k.digest(S);case 29:S=e.sent,e.next=19;break;case 32:return d=y/2,E=t(l),g=E.slice(0,d),z=E.slice(d,y),b=function(e){return{iv:e.slice(0,p),cipherKey:e.slice(p,p+h),macKey:e.slice(p+h)}},e.abrupt("return",{k1:b(g),k2:b(z)});case 38:case"end":return e.stop()}},e)}));return function(r,n,t){return e.apply(this,arguments)}}();
|
||
},{"err-code":"hLMW","uint8arrays/concat":"qYui","uint8arrays/from-string":"YucU","../hmac":"RADA"}],"dPmX":[function(require,module,exports) {
|
||
"use strict";function e(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}function r(r){for(var n=1;n<arguments.length;n++){var u=null!=arguments[n]?arguments[n]:{};n%2?e(Object(u),!0).forEach(function(e){t(r,e,u[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(u)):e(Object(u)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(u,e))})}return r}function t(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function n(e,r,t,n,u,a,i){try{var c=e[a](i),o=c.value}catch(s){return void t(s)}c.done?r(o):Promise.resolve(o).then(n,u)}function u(e){return function(){var r=this,t=arguments;return new Promise(function(u,a){var i=e.apply(r,t);function c(e){n(i,u,a,c,o,"next",e)}function o(e){n(i,u,a,c,o,"throw",e)}c(void 0)})}}var a=require("err-code"),i=require("../webcrypto"),c=require("../util"),o=c.base64urlToBuffer,s=require("./validate-curve-type"),f=require("uint8arrays/to-string"),p=require("uint8arrays/concat"),y=require("uint8arrays/equals"),b={"P-256":256,"P-384":384,"P-521":521};exports.generateEphmeralKeyPair=function(){var e=u(regeneratorRuntime.mark(function e(r){var t,n,a;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return s(Object.keys(b),r),e.next=3,i.get().subtle.generateKey({name:"ECDH",namedCurve:r},!0,["deriveBits"]);case 3:return t=e.sent,n=function(){var e=u(regeneratorRuntime.mark(function e(n,u){var a,c,o;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!u){e.next=6;break}return e.next=3,i.get().subtle.importKey("jwk",g(r,u),{name:"ECDH",namedCurve:r},!1,["deriveBits"]);case 3:a=e.sent,e.next=7;break;case 6:a=t.privateKey;case 7:return e.next=9,i.get().subtle.importKey("jwk",m(r,n),{name:"ECDH",namedCurve:r},!1,[]);case 9:return e.t0=e.sent,e.t1=a,c=[e.t0,e.t1],e.next=14,i.get().subtle.deriveBits({name:"ECDH",namedCurve:r,public:c[0]},c[1],b[r]);case 14:return o=e.sent,e.abrupt("return",new Uint8Array(o,o.byteOffset,o.byteLength));case 16:case"end":return e.stop()}},e)}));return function(r,t){return e.apply(this,arguments)}}(),e.next=7,i.get().subtle.exportKey("jwk",t.publicKey);case 7:return a=e.sent,e.abrupt("return",{key:v(a),genSharedKey:n});case 9:case"end":return e.stop()}},e)}));return function(r){return e.apply(this,arguments)}}();var l={"P-256":32,"P-384":48,"P-521":66};function v(e){var r=l[e.crv];return p([Uint8Array.from([4]),o(e.x,r),o(e.y,r)],1+2*r)}function m(e,r){var t=l[e];if(y(!r.slice(0,1),Uint8Array.from([4])))throw a(new Error("Cannot unmarshal public key - invalid key format"),"ERR_INVALID_KEY_FORMAT");return{kty:"EC",crv:e,x:f(r.slice(1,t+1),"base64url"),y:f(r.slice(1+t),"base64url"),ext:!0}}var g=function(e,t){return r(r({},m(e,t.public)),{},{d:f(t.private,"base64url")})};
|
||
},{"err-code":"hLMW","../webcrypto":"AJ6b","../util":"x6+9","./validate-curve-type":"OeV0","uint8arrays/to-string":"Jm0S","uint8arrays/concat":"qYui","uint8arrays/equals":"mZxc"}],"fT8c":[function(require,module,exports) {
|
||
"use strict";function r(r,e,n,t,u,o,i){try{var a=r[o](i),c=a.value}catch(s){return void n(s)}a.done?e(c):Promise.resolve(c).then(t,u)}function e(e){return function(){var n=this,t=arguments;return new Promise(function(u,o){var i=e.apply(n,t);function a(e){r(i,u,o,a,c,"next",e)}function c(e){r(i,u,o,a,c,"throw",e)}a(void 0)})}}var n=require("./ecdh");module.exports=function(){var r=e(regeneratorRuntime.mark(function r(e){return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",n.generateEphmeralKeyPair(e));case 1:case"end":return r.stop()}},r)}));return function(e){return r.apply(this,arguments)}}();
|
||
},{"./ecdh":"dPmX"}],"ytKT":[function(require,module,exports) {
|
||
"use strict";function e(e,r,t,n,a,u,s){try{var i=e[u](s),o=i.value}catch(c){return void t(c)}i.done?r(o):Promise.resolve(o).then(n,a)}function r(r){return function(){var t=this,n=arguments;return new Promise(function(a,u){var s=r.apply(t,n);function i(r){e(s,a,u,i,o,"next",r)}function o(r){e(s,a,u,i,o,"throw",r)}i(void 0)})}}var t=require("./keys");require("node-forge/lib/asn1"),require("node-forge/lib/pbe");var n=require("node-forge/lib/forge"),a=require("err-code"),u=require("uint8arrays/from-string"),s=require("./importer"),i={rsa:require("./rsa-class"),ed25519:require("./ed25519-class"),secp256k1:require("./secp256k1-class")(t,require("../random-bytes"))},o={message:"secp256k1 support requires libp2p-crypto-secp256k1 package",code:"ERR_MISSING_PACKAGE"};function c(e){var r=i[e.toLowerCase()];if(!r){var t=Object.keys(i).join(" / ");throw a(new Error("invalid or unsupported key type ".concat(e,". Must be ").concat(t)),"ERR_UNSUPPORTED_KEY_TYPE")}return r}var p=function(){var e=r(regeneratorRuntime.mark(function e(r,t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",c(r).generateKeyPair(t));case 1:case"end":return e.stop()}},e)}));return function(r,t){return e.apply(this,arguments)}}(),y=function(){var e=r(regeneratorRuntime.mark(function e(r,t,n){var u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(u=c(r),"ed25519"===r.toLowerCase()){e.next=3;break}throw a(new Error("Seed key derivation is unimplemented for RSA or secp256k1"),"ERR_UNSUPPORTED_KEY_DERIVATION_TYPE");case 3:return e.abrupt("return",u.generateKeyPairFromSeed(t,n));case 4:case"end":return e.stop()}},e)}));return function(r,t,n){return e.apply(this,arguments)}}(),l=function(e){var r=t.PublicKey.decode(e),n=r.Data;switch(r.Type){case t.KeyType.RSA:return i.rsa.unmarshalRsaPublicKey(n);case t.KeyType.Ed25519:return i.ed25519.unmarshalEd25519PublicKey(n);case t.KeyType.Secp256k1:if(i.secp256k1)return i.secp256k1.unmarshalSecp256k1PublicKey(n);throw a(new Error(o.message),o.code);default:c(r.Type)}},f=function(e,r){return c(r=(r||"rsa").toLowerCase()),e.bytes},d=function(){var e=r(regeneratorRuntime.mark(function e(r){var n,u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=t.PrivateKey.decode(r),u=n.Data,e.t0=n.Type,e.next=e.t0===t.KeyType.RSA?5:e.t0===t.KeyType.Ed25519?6:e.t0===t.KeyType.Secp256k1?7:12;break;case 5:return e.abrupt("return",i.rsa.unmarshalRsaPrivateKey(u));case 6:return e.abrupt("return",i.ed25519.unmarshalEd25519PrivateKey(u));case 7:if(!i.secp256k1){e.next=11;break}return e.abrupt("return",i.secp256k1.unmarshalSecp256k1PrivateKey(u));case 11:throw a(new Error(o.message),o.code);case 12:c(n.Type);case 13:case"end":return e.stop()}},e)}));return function(r){return e.apply(this,arguments)}}(),m=function(e,r){return c(r=(r||"rsa").toLowerCase()),e.bytes},v=function(){var e=r(regeneratorRuntime.mark(function e(r,t){var o,c,p;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,s.import(r,t);case 3:return o=e.sent,e.abrupt("return",d(o));case 7:e.prev=7,e.t0=e.catch(0);case 9:if(null!==(c=n.pki.decryptRsaPrivateKey(r,t))){e.next=12;break}throw a(new Error("Cannot read the key, most likely the password is wrong or not a RSA key"),"ERR_CANNOT_DECRYPT_PEM");case 12:return p=n.asn1.toDer(n.pki.privateKeyToAsn1(c)),p=u(p.getBytes(),"ascii"),e.abrupt("return",i.rsa.unmarshalRsaPrivateKey(p));case 15:case"end":return e.stop()}},e,null,[[0,7]])}));return function(r,t){return e.apply(this,arguments)}}();module.exports={supportedKeys:i,keysPBM:t,keyStretcher:require("./key-stretcher"),generateEphemeralKeyPair:require("./ephemeral-keys"),generateKeyPair:p,generateKeyPairFromSeed:y,unmarshalPublicKey:l,marshalPublicKey:f,unmarshalPrivateKey:d,marshalPrivateKey:m,import:v};
|
||
},{"./keys":"HRSQ","node-forge/lib/asn1":"dLTu","node-forge/lib/pbe":"hD6L","node-forge/lib/forge":"sQ2N","err-code":"hLMW","uint8arrays/from-string":"YucU","./importer":"E9Gl","./rsa-class":"QXfk","./ed25519-class":"UKMf","./secp256k1-class":"M1K8","../random-bytes":"rthE","./key-stretcher":"7XXu","./ephemeral-keys":"fT8c"}],"6YXu":[function(require,module,exports) {
|
||
"use strict";var r=require("node-forge/lib/pbkdf2"),e=require("node-forge/lib/util"),o=require("err-code"),n={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};function s(s,a,t,i,u){var c=n[u];if(!c){var h=Object.keys(n).join(" / ");throw o(new Error("Hash '".concat(u,"' is unknown or not supported. Must be ").concat(h)),"ERR_UNSUPPORTED_HASH_TYPE")}var d=r(s,a,t,i,c);return e.encode64(d)}module.exports=s;
|
||
},{"node-forge/lib/pbkdf2":"t4Bf","node-forge/lib/util":"2FVR","err-code":"hLMW"}],"3RKZ":[function(require,module,exports) {
|
||
"use strict";var e=require("./hmac"),r=require("./aes"),s=require("./keys");exports.aes=r,exports.hmac=e,exports.keys=s,exports.randomBytes=require("./random-bytes"),exports.pbkdf2=require("./pbkdf2");
|
||
},{"./hmac":"RADA","./aes":"nBnI","./keys":"ytKT","./random-bytes":"rthE","./pbkdf2":"6YXu"}],"tS7d":[function(require,module,exports) {
|
||
var define;
|
||
var t;!function(e,i){"function"==typeof t&&t.amd?t(["protobufjs/minimal"],i):"function"==typeof require&&"object"==typeof module&&module&&module.exports&&(module.exports=i(require("protobufjs/minimal")))}(0,function(t){var e,i=t.Reader,n=t.Writer,y=t.util,d=t.roots.default||(t.roots.default={});return d.pb=((e={}).NoiseHandshakePayload=function(){function e(t){if(t)for(var e=Object.keys(t),i=0;i<e.length;++i)null!=t[e[i]]&&(this[e[i]]=t[e[i]])}return e.prototype.identityKey=y.newBuffer([]),e.prototype.identitySig=y.newBuffer([]),e.prototype.data=y.newBuffer([]),e.create=function(t){return new e(t)},e.encode=function(t,e){return e||(e=n.create()),null!=t.identityKey&&t.hasOwnProperty("identityKey")&&e.uint32(10).bytes(t.identityKey),null!=t.identitySig&&t.hasOwnProperty("identitySig")&&e.uint32(18).bytes(t.identitySig),null!=t.data&&t.hasOwnProperty("data")&&e.uint32(26).bytes(t.data),e},e.encodeDelimited=function(t,e){return this.encode(t,e).ldelim()},e.decode=function(t,e){t instanceof i||(t=i.create(t));for(var n=void 0===e?t.len:t.pos+e,y=new d.pb.NoiseHandshakePayload;t.pos<n;){var a=t.uint32();switch(a>>>3){case 1:y.identityKey=t.bytes();break;case 2:y.identitySig=t.bytes();break;case 3:y.data=t.bytes();break;default:t.skipType(7&a)}}return y},e.decodeDelimited=function(t){return t instanceof i||(t=new i(t)),this.decode(t,t.uint32())},e.verify=function(t){return"object"!=typeof t||null===t?"object expected":null!=t.identityKey&&t.hasOwnProperty("identityKey")&&!(t.identityKey&&"number"==typeof t.identityKey.length||y.isString(t.identityKey))?"identityKey: buffer expected":null!=t.identitySig&&t.hasOwnProperty("identitySig")&&!(t.identitySig&&"number"==typeof t.identitySig.length||y.isString(t.identitySig))?"identitySig: buffer expected":null!=t.data&&t.hasOwnProperty("data")&&!(t.data&&"number"==typeof t.data.length||y.isString(t.data))?"data: buffer expected":null},e.fromObject=function(t){if(t instanceof d.pb.NoiseHandshakePayload)return t;var e=new d.pb.NoiseHandshakePayload;return null!=t.identityKey&&("string"==typeof t.identityKey?y.base64.decode(t.identityKey,e.identityKey=y.newBuffer(y.base64.length(t.identityKey)),0):t.identityKey.length&&(e.identityKey=t.identityKey)),null!=t.identitySig&&("string"==typeof t.identitySig?y.base64.decode(t.identitySig,e.identitySig=y.newBuffer(y.base64.length(t.identitySig)),0):t.identitySig.length&&(e.identitySig=t.identitySig)),null!=t.data&&("string"==typeof t.data?y.base64.decode(t.data,e.data=y.newBuffer(y.base64.length(t.data)),0):t.data.length&&(e.data=t.data)),e},e.toObject=function(t,e){e||(e={});var i={};return e.defaults&&(e.bytes===String?i.identityKey="":(i.identityKey=[],e.bytes!==Array&&(i.identityKey=y.newBuffer(i.identityKey))),e.bytes===String?i.identitySig="":(i.identitySig=[],e.bytes!==Array&&(i.identitySig=y.newBuffer(i.identitySig))),e.bytes===String?i.data="":(i.data=[],e.bytes!==Array&&(i.data=y.newBuffer(i.data)))),null!=t.identityKey&&t.hasOwnProperty("identityKey")&&(i.identityKey=e.bytes===String?y.base64.encode(t.identityKey,0,t.identityKey.length):e.bytes===Array?Array.prototype.slice.call(t.identityKey):t.identityKey),null!=t.identitySig&&t.hasOwnProperty("identitySig")&&(i.identitySig=e.bytes===String?y.base64.encode(t.identitySig,0,t.identitySig.length):e.bytes===Array?Array.prototype.slice.call(t.identitySig):t.identitySig),null!=t.data&&t.hasOwnProperty("data")&&(i.data=e.bytes===String?y.base64.encode(t.data,0,t.data.length):e.bytes===Array?Array.prototype.slice.call(t.data):t.data),i},e.prototype.toJSON=function(){return this.constructor.toObject(this,t.util.toJSONOptions)},e}(),e),d});
|
||
},{"protobufjs/minimal":"E7pg"}],"byDV":[function(require,module,exports) {
|
||
"use strict";var e=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.isValidPublicKey=exports.getHkdf=exports.verifySignedPayload=exports.getHandshakePayload=exports.decodePayload=exports.getPeerIdFromPayload=exports.signPayload=exports.createHandshakePayload=exports.getPayload=exports.generateKeypair=void 0;const t=e(require("bcrypto/lib/hkdf")),r=e(require("bcrypto/lib/js/x25519")),a=e(require("bcrypto/lib/js/sha256")),o=require("buffer"),i=e(require("peer-id")),n=require("libp2p-crypto"),u=require("./proto/payload"),s=e(require("uint8arrays/equals")),d=u.pb.NoiseHandshakePayload;function f(){const e=r.default.privateKeyGenerate();return{publicKey:r.default.publicKeyCreate(e),privateKey:e}}async function l(e,t,r){const a=await y(e,b(t)),i=null!=r?r:o.Buffer.alloc(0);return c(e.marshalPubKey(),a,i)}function c(e,t,r){const a=d.create({identityKey:o.Buffer.from(e),identitySig:t,data:null!=r?r:null});return o.Buffer.from(d.encode(a).finish())}async function y(e,t){return o.Buffer.from(await e.privKey.sign(t))}async function p(e){return await i.default.createFromPubKey(o.Buffer.from(e.identityKey))}function P(e){return d.toObject(d.decode(o.Buffer.from(e)))}function b(e){return o.Buffer.concat([o.Buffer.from("noise-libp2p-static-key:"),e])}async function x(e,t){const r=await i.default.createFromPubKey(t);return s.default(r.id,e)}async function g(e,t,r){const a=o.Buffer.from(t.identityKey);if(!(await x(r.id,a)))throw new Error("Peer ID doesn't match libp2p public key.");const u=b(e),s=n.keys.unmarshalPublicKey(a);if(!t.identitySig||!s.verify(u,o.Buffer.from(t.identitySig)))throw new Error("Static key doesn't match to peer that signed payload!");return await i.default.createFromPubKey(a)}function m(e,r){const i=o.Buffer.alloc(0),n=t.default.extract(a.default,r,e),u=t.default.expand(a.default,n,i,96);return[u.slice(0,32),u.slice(32,64),u.slice(64,96)]}function K(e){return r.default.publicKeyVerify(e.slice(0,32))}exports.generateKeypair=f,exports.getPayload=l,exports.createHandshakePayload=c,exports.signPayload=y,exports.getPeerIdFromPayload=p,exports.decodePayload=P,exports.getHandshakePayload=b,exports.verifySignedPayload=g,exports.getHkdf=m,exports.isValidPublicKey=K;
|
||
},{"bcrypto/lib/hkdf":"On4l","bcrypto/lib/js/x25519":"cm0X","bcrypto/lib/js/sha256":"o5jB","buffer":"z1tx","peer-id":"xW92","libp2p-crypto":"3RKZ","./proto/payload":"tS7d","uint8arrays/equals":"mZxc"}],"BsZ/":[function(require,module,exports) {
|
||
var Buffer = require("buffer").Buffer;
|
||
var t=require("buffer").Buffer;function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var s=0;s<e.length;s++){var i=e[s];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function i(t,e,i){return e&&s(t.prototype,e),i&&s(t,i),t}var r=require("../internal/assert"),n=0===new Int8Array(new Int16Array([1]).buffer)[0],a=function(){function s(){e(this,s),this.state=new Uint32Array(16),this.stream=new Uint32Array(16),this.bytes=new Uint8Array(this.stream.buffer),this.pos=-1,n&&(this.bytes=t.alloc(64))}return i(s,[{key:"init",value:function(e,i,n){if(null==n&&(n=0),r(t.isBuffer(e)),r(t.isBuffer(i)),r(Number.isSafeInteger(n)),16!==e.length&&32!==e.length)throw new RangeError("Invalid key size.");if(i.length>=24&&(e=s.derive(e,i.slice(0,16)),i=i.slice(16)),this.state[0]=1634760805,this.state[1]=e.length<32?824206446:857760878,this.state[2]=e.length<32?2036477238:2036477234,this.state[3]=1797285236,this.state[4]=f(e,0),this.state[5]=f(e,4),this.state[6]=f(e,8),this.state[7]=f(e,12),this.state[8]=f(e,16%e.length),this.state[9]=f(e,20%e.length),this.state[10]=f(e,24%e.length),this.state[11]=f(e,28%e.length),this.state[12]=n>>>0,8===i.length)this.state[13]=n/4294967296>>>0,this.state[14]=f(i,0),this.state[15]=f(i,4);else if(12===i.length)this.state[13]=f(i,0),this.state[14]=f(i,4),this.state[15]=f(i,8);else{if(16!==i.length)throw new RangeError("Invalid nonce size.");this.state[12]=f(i,0),this.state[13]=f(i,4),this.state[14]=f(i,8),this.state[15]=f(i,12)}return this.pos=0,this}},{key:"encrypt",value:function(e){if(r(t.isBuffer(e)),-1===this.pos)throw new Error("Context is not initialized.");for(var s=0;s<e.length;s++)0==(63&this.pos)&&(this._block(),this.pos=0),e[s]^=this.bytes[this.pos++];return e}},{key:"_block",value:function(){for(var t=0;t<16;t++)this.stream[t]=this.state[t];for(var e=0;e<10;e++)h(this.stream,0,4,8,12),h(this.stream,1,5,9,13),h(this.stream,2,6,10,14),h(this.stream,3,7,11,15),h(this.stream,0,5,10,15),h(this.stream,1,6,11,12),h(this.stream,2,7,8,13),h(this.stream,3,4,9,14);for(var s=0;s<16;s++)this.stream[s]+=this.state[s];if(n)for(var i=0;i<16;i++)l(this.bytes,this.stream[i],4*i);this.state[12]+=1,0===this.state[12]&&(this.state[13]+=1)}},{key:"destroy",value:function(){for(var t=0;t<16;t++)this.state[t]=0,this.stream[t]=0;if(n)for(var e=0;e<64;e++)this.bytes[e]=0;return this.pos=-1,this}}],[{key:"derive",value:function(e,s){if(r(t.isBuffer(e)),r(t.isBuffer(s)),16!==e.length&&32!==e.length)throw new RangeError("Invalid key size.");if(16!==s.length)throw new RangeError("Invalid nonce size.");var i=new Uint32Array(16);i[0]=1634760805,i[1]=e.length<32?824206446:857760878,i[2]=e.length<32?2036477238:2036477234,i[3]=1797285236,i[4]=f(e,0),i[5]=f(e,4),i[6]=f(e,8),i[7]=f(e,12),i[8]=f(e,16%e.length),i[9]=f(e,20%e.length),i[10]=f(e,24%e.length),i[11]=f(e,28%e.length),i[12]=f(s,0),i[13]=f(s,4),i[14]=f(s,8),i[15]=f(s,12);for(var n=0;n<10;n++)h(i,0,4,8,12),h(i,1,5,9,13),h(i,2,6,10,14),h(i,3,7,11,15),h(i,0,5,10,15),h(i,1,6,11,12),h(i,2,7,8,13),h(i,3,4,9,14);var a=t.alloc(32);return l(a,i[0],0),l(a,i[1],4),l(a,i[2],8),l(a,i[3],12),l(a,i[12],16),l(a,i[13],20),l(a,i[14],24),l(a,i[15],28),a}}]),s}();function h(t,e,s,i,r){t[e]+=t[s],t[r]=o(t[r]^t[e],16),t[i]+=t[r],t[s]=o(t[s]^t[i],12),t[e]+=t[s],t[r]=o(t[r]^t[e],8),t[i]+=t[r],t[s]=o(t[s]^t[i],7)}function o(t,e){return t<<e|t>>>32-e}function f(t,e){return t[e++]+256*t[e++]+65536*t[e++]+16777216*t[e]}function l(t,e,s){return t[s++]=e,e>>>=8,t[s++]=e,e>>>=8,t[s++]=e,e>>>=8,t[s++]=e,s}a.native=0,module.exports=a;
|
||
},{"../internal/assert":"TXc9","buffer":"z1tx"}],"iQC7":[function(require,module,exports) {
|
||
var Buffer = require("buffer").Buffer;
|
||
var t=require("buffer").Buffer;function h(t,h){if(!(t instanceof h))throw new TypeError("Cannot call a class as a function")}function i(t,h){for(var i=0;i<h.length;i++){var r=h[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function r(t,h,r){return h&&i(t.prototype,h),r&&i(t,r),t}var s=require("../internal/assert"),e=function(){function i(){h(this,i),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.buffer=t.alloc(16),this.fin=-1,this.leftover=0}return r(i,[{key:"init",value:function(h){s(t.isBuffer(h)&&h.length>=32);var i=f(h,0),r=f(h,2),e=f(h,4),n=f(h,6),o=f(h,8),a=f(h,10),v=f(h,12),u=f(h,14);this.r[0]=8191&i,this.r[1]=8191&(i>>>13|r<<3),this.r[2]=7939&(r>>>10|e<<6),this.r[3]=8191&(e>>>7|n<<9),this.r[4]=255&(n>>>4|o<<12),this.r[5]=o>>>1&8190,this.r[6]=8191&(o>>>14|a<<2),this.r[7]=8065&(a>>>11|v<<5),this.r[8]=8191&(v>>>8|u<<8),this.r[9]=u>>>5&127;for(var l=0;l<10;l++)this.h[l]=0;for(var c=0;c<8;c++)this.pad[c]=f(h,16+2*c);return this.fin=0,this.leftover=0,this}},{key:"_blocks",value:function(t,h,i){for(var r=this.fin?0:2048,s=new Uint32Array(10);h>=16;){var e=f(t,i+0),n=f(t,i+2),o=f(t,i+4),a=f(t,i+6),v=f(t,i+8),u=f(t,i+10),l=f(t,i+12),c=f(t,i+14);this.h[0]+=8191&e,this.h[1]+=8191&(e>>>13|n<<3),this.h[2]+=8191&(n>>>10|o<<6),this.h[3]+=8191&(o>>>7|a<<9),this.h[4]+=8191&(a>>>4|v<<12),this.h[5]+=v>>>1&8191,this.h[6]+=8191&(v>>>14|u<<2),this.h[7]+=8191&(u>>>11|l<<5),this.h[8]+=8191&(l>>>8|c<<8),this.h[9]+=c>>>5|r;for(var b=0,y=0;y<10;y++){s[y]=b;for(var d=0;d<10;d++){var w=this.h[d];w*=d<=y?this.r[y-d]:5*this.r[y+10-d],s[y]+=w,4===d&&(b=s[y]>>>13,s[y]&=8191)}b+=s[y]>>>13,s[y]&=8191}b=(b<<2)+b,b+=s[0],s[0]=8191&b,b>>>=13,s[1]+=b;for(var k=0;k<10;k++)this.h[k]=s[k];i+=16,h-=16}}},{key:"update",value:function(h){if(s(t.isBuffer(h)),-1===this.fin)throw new Error("Context is not initialized.");var i=h.length,r=0;if(this.leftover){var e=16-this.leftover;e>i&&(e=i);for(var f=0;f<e;f++)this.buffer[this.leftover+f]=h[r+f];if(i-=e,r+=e,this.leftover+=e,this.leftover<16)return this;this._blocks(this.buffer,16,0),this.leftover=0}if(i>=16){var n=-16&i;this._blocks(h,n,r),r+=n,i-=n}if(i){for(var o=0;o<i;o++)this.buffer[this.leftover+o]=h[r+o];this.leftover+=i}return this}},{key:"final",value:function(){if(-1===this.fin)throw new Error("Context is not initialized.");var h=t.alloc(16),i=new Uint16Array(10);if(this.leftover){var r=this.leftover;for(this.buffer[r++]=1;r<16;r++)this.buffer[r]=0;this.fin=1,this._blocks(this.buffer,16,0)}var s=this.h[1]>>>13;this.h[1]&=8191;for(var e=2;e<10;e++)this.h[e]+=s,s=this.h[e]>>>13,this.h[e]&=8191;this.h[0]+=5*s,s=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=s,s=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=s,i[0]=this.h[0]+5,s=i[0]>>>13,i[0]&=8191;for(var f=1;f<10;f++)i[f]=this.h[f]+s,s=i[f]>>>13,i[f]&=8191;for(var o=(1^s)-1,a=0;a<10;a++)i[a]&=o;o=~o;for(var v=0;v<10;v++)this.h[v]=this.h[v]&o|i[v];this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5);var u=this.h[0]+this.pad[0];this.h[0]=u;for(var l=1;l<8;l++)u=this.h[l]+this.pad[l]+(u>>>16),this.h[l]=u;for(var c=0;c<8;c++)n(h,this.h[c],2*c);return this.destroy(),h}},{key:"destroy",value:function(){for(var t=0;t<10;t++)this.r[t]=0,this.h[t]=0;for(var h=0;h<8;h++)this.pad[h]=0;for(var i=0;i<16;i++)this.buffer[i]=0;this.fin=-1,this.leftover=0}},{key:"verify",value:function(h){s(t.isBuffer(h)),s(16===h.length);for(var i=this.final(),r=0,e=0;e<16;e++)r|=i[e]^h[e];return r-1>>>31!=0}}]),i}();function f(t,h){return t[h++]+256*t[h]}function n(t,h,i){return t[i++]=h,t[i++]=h>>>8,i}e.native=0,module.exports=e;
|
||
},{"../internal/assert":"TXc9","buffer":"z1tx"}],"sIWK":[function(require,module,exports) {
|
||
var Buffer = require("buffer").Buffer;
|
||
var t=require("buffer").Buffer;function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function n(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),t}var r=require("../internal/assert"),a=require("./chacha20"),h=require("./poly1305"),o=t.alloc(16,0),s=function(){function i(){e(this,i),this.chacha=new a,this.poly=new h,this.key=t.alloc(64),this.mode=-1,this.aadLen=0,this.cipherLen=0}return n(i,[{key:"init",value:function(e,i){return r(t.isBuffer(e)),r(t.isBuffer(i)),this.key.fill(0),this.chacha.init(e,i,0),this.chacha.encrypt(this.key),this.poly.init(this.key),this.mode=0,this.aadLen=0,this.cipherLen=0,this}},{key:"aad",value:function(t){if(-1===this.mode)throw new Error("Context is not initialized.");if(0!==this.mode)throw new Error("Invalid state for aad.");return this.poly.update(t),this.aadLen+=t.length,this}},{key:"encrypt",value:function(t){if(-1===this.mode)throw new Error("Context is not initialized.");if(0!==this.mode&&1!==this.mode)throw new Error("Invalid state for encrypt.");return 0===this.mode&&(this._pad16(this.aadLen),this.mode=1),this.chacha.encrypt(t),this.poly.update(t),this.cipherLen+=t.length,t}},{key:"decrypt",value:function(e){if(r(t.isBuffer(e)),-1===this.mode)throw new Error("Context is not initialized.");if(0!==this.mode&&2!==this.mode)throw new Error("Invalid state for decrypt.");return 0===this.mode&&(this._pad16(this.aadLen),this.mode=2),this.cipherLen+=e.length,this.poly.update(e),this.chacha.encrypt(e),e}},{key:"auth",value:function(e){if(r(t.isBuffer(e)),-1===this.mode)throw new Error("Context is not initialized.");if(0!==this.mode&&3!==this.mode)throw new Error("Invalid state for auth.");return 0===this.mode&&(this._pad16(this.aadLen),this.mode=3),this.cipherLen+=e.length,this.poly.update(e),e}},{key:"final",value:function(){if(-1===this.mode)throw new Error("Context is not initialized.");var e=t.alloc(16);d(e,this.aadLen,0),d(e,this.cipherLen,8),0===this.mode&&this._pad16(this.aadLen),this._pad16(this.cipherLen),this.poly.update(e);var i=this.poly.final();return this.destroy(),i}},{key:"destroy",value:function(){this.chacha.destroy(),this.poly.destroy();for(var t=0;t<64;t++)this.key[t]=0;return this.mode=-1,this.aadLen=0,this.cipherLen=0,this}},{key:"verify",value:function(e){r(t.isBuffer(e)),r(16===e.length);for(var i=this.final(),n=0,a=0;a<16;a++)n|=i[a]^e[a];return n-1>>>31!=0}},{key:"_pad16",value:function(t){var e=15&t;e>0&&this.poly.update(o.slice(0,16-e))}}],[{key:"encrypt",value:function(t,e,n,r){var a=new i;return a.init(t,e),r&&a.aad(r),a.encrypt(n),a.final()}},{key:"decrypt",value:function(t,e,n,r,a){var h=new i;return h.init(t,e),a&&h.aad(a),h.decrypt(n),h.verify(r)}},{key:"auth",value:function(t,e,n,r,a){var h=new i;return h.init(t,e),a&&h.aad(a),h.auth(n),h.verify(r)}}]),i}();function u(t,e,i){return t[i++]=e,e>>>=8,t[i++]=e,e>>>=8,t[i++]=e,e>>>=8,t[i++]=e,i}function d(t,e,i){var n=e*(1/4294967296)>>>0;return u(t,e>>>0,i+0),u(t,n,i+4),i+8}s.native=a.native,module.exports=s;
|
||
},{"../internal/assert":"TXc9","./chacha20":"BsZ/","./poly1305":"iQC7","buffer":"z1tx"}],"a1K6":[function(require,module,exports) {
|
||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.DUMP_SESSION_KEYS=exports.NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG=exports.NOISE_MSG_MAX_LENGTH_BYTES=void 0,exports.NOISE_MSG_MAX_LENGTH_BYTES=65535,exports.NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG=exports.NOISE_MSG_MAX_LENGTH_BYTES-16,exports.DUMP_SESSION_KEYS=void 0;
|
||
},{}],"EiWb":[function(require,module,exports) {
|
||
"use strict";var e=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.logCipherState=exports.logRemoteEphemeralKey=exports.logRemoteStaticKey=exports.logLocalEphemeralKeys=exports.logLocalStaticKeys=exports.logger=void 0;const t=e(require("debug")),o=require("./constants");let r;function s(e){r(`LOCAL_STATIC_PUBLIC_KEY ${e.publicKey.toString("hex")}`),r(`LOCAL_STATIC_PRIVATE_KEY ${e.privateKey.toString("hex")}`)}function i(e){e?(r(`LOCAL_PUBLIC_EPHEMERAL_KEY ${e.publicKey.toString("hex")}`),r(`LOCAL_PRIVATE_EPHEMERAL_KEY ${e.privateKey.toString("hex")}`)):r("Missing local ephemeral keys.")}function l(e){r(`REMOTE_STATIC_PUBLIC_KEY ${e.toString("hex")}`)}function E(e){r(`REMOTE_EPHEMERAL_PUBLIC_KEY ${e.toString("hex")}`)}function n(e){e.cs1&&e.cs2?(r(`CIPHER_STATE_1 ${e.cs1.n} ${e.cs1.k.toString("hex")}`),r(`CIPHER_STATE_2 ${e.cs2.n} ${e.cs2.k.toString("hex")}`)):r("Missing cipher state.")}exports.logger=t.default("libp2p:noise"),r=o.DUMP_SESSION_KEYS?exports.logger:()=>{},exports.logLocalStaticKeys=s,exports.logLocalEphemeralKeys=i,exports.logRemoteStaticKey=l,exports.logRemoteEphemeralKey=E,exports.logCipherState=n;
|
||
},{"debug":"j+D9","./constants":"a1K6"}],"otMf":[function(require,module,exports) {
|
||
"use strict";var e=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.AbstractHandshake=exports.MIN_NONCE=void 0;const t=require("buffer"),r=e(require("bcrypto/lib/js/aead")),i=e(require("bcrypto/lib/js/x25519")),s=e(require("bcrypto/lib/js/sha256")),n=require("../utils"),c=require("../logger");exports.MIN_NONCE=0;class a{encryptWithAd(e,t,r){const i=this.encrypt(e.k,e.n,t,r);return this.setNonce(e,this.incrementNonce(e.n)),i}decryptWithAd(e,t,r){const{plaintext:i,valid:s}=this.decrypt(e.k,e.n,t,r);return this.setNonce(e,this.incrementNonce(e.n)),{plaintext:i,valid:s}}hasKey(e){return!this.isEmptyKey(e.k)}setNonce(e,t){e.n=t}createEmptyKey(){return t.Buffer.alloc(32)}isEmptyKey(e){return this.createEmptyKey().equals(e)}incrementNonce(e){return e+1}nonceToBytes(e){const r=t.Buffer.alloc(12);return r.writeUInt32LE(e,4),r}encrypt(e,i,s,n){const c=this.nonceToBytes(i),a=new r.default;return n=t.Buffer.from(n),a.init(e,c),a.aad(s),a.encrypt(n),t.Buffer.concat([n,a.final()])}encryptAndHash(e,t){let r;return r=this.hasKey(e.cs)?this.encryptWithAd(e.cs,e.h,t):t,this.mixHash(e,r),r}decrypt(e,i,s,n){const c=this.nonceToBytes(i),a=new r.default,l=(n=t.Buffer.from(n)).slice(n.length-16);return n=n.slice(0,n.length-16),a.init(e,c),a.aad(s),a.decrypt(n),{plaintext:n,valid:a.verify(l)}}decryptAndHash(e,t){let r,i=!0;return this.hasKey(e.cs)?({plaintext:r,valid:i}=this.decryptWithAd(e.cs,e.h,t)):r=t,this.mixHash(e,t),{plaintext:r,valid:i}}dh(e,r){try{const n=i.default.derive(r,e),a=t.Buffer.alloc(32);return n.copy(a),a}catch(s){return c.logger(s.message),t.Buffer.alloc(32)}}mixHash(e,t){e.h=this.getHash(e.h,t)}getHash(e,r){return s.default.digest(t.Buffer.from([...e,...r]))}mixKey(e,t){const[r,i]=n.getHkdf(e.ck,t);e.cs=this.initializeKey(i),e.ck=r}initializeKey(e){return{k:e,n:exports.MIN_NONCE}}initializeSymmetric(e){const r=t.Buffer.from(e,"utf-8"),i=this.hashProtocolName(r),s=i,n=this.createEmptyKey();return{cs:this.initializeKey(n),ck:s,h:i}}hashProtocolName(e){if(e.length<=32){const r=t.Buffer.alloc(32);return e.copy(r),r}return this.getHash(e,t.Buffer.alloc(0))}split(e){const[r,i]=n.getHkdf(e.ck,t.Buffer.alloc(0));return{cs1:this.initializeKey(r),cs2:this.initializeKey(i)}}writeMessageRegular(e,r){const i=this.encryptWithAd(e,t.Buffer.alloc(0),r);return{ne:this.createEmptyKey(),ns:t.Buffer.alloc(0),ciphertext:i}}readMessageRegular(e,r){return this.decryptWithAd(e,t.Buffer.alloc(0),r.ciphertext)}}exports.AbstractHandshake=a;
|
||
},{"buffer":"z1tx","bcrypto/lib/js/aead":"sIWK","bcrypto/lib/js/x25519":"cm0X","bcrypto/lib/js/sha256":"o5jB","../utils":"byDV","../logger":"EiWb"}],"pDQu":[function(require,module,exports) {
|
||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.XX=void 0;const s=require("buffer"),e=require("../utils"),i=require("./abstract-handshake");class t extends i.AbstractHandshake{initializeInitiator(e,i,t,r){const a=this.initializeSymmetric("Noise_XX_25519_ChaChaPoly_SHA256");return this.mixHash(a,e),{ss:a,s:i,rs:t,psk:r,re:s.Buffer.alloc(32)}}initializeResponder(e,i,t,r){const a=this.initializeSymmetric("Noise_XX_25519_ChaChaPoly_SHA256");return this.mixHash(a,e),{ss:a,s:i,rs:t,psk:r,re:s.Buffer.alloc(32)}}writeMessageA(i,t,r){const a=s.Buffer.alloc(0);i.e=void 0!==r?r:e.generateKeypair();const h=i.e.publicKey;return this.mixHash(i.ss,h),{ne:h,ns:a,ciphertext:this.encryptAndHash(i.ss,t)}}writeMessageB(i,t){i.e=e.generateKeypair();const r=i.e.publicKey;this.mixHash(i.ss,r),this.mixKey(i.ss,this.dh(i.e.privateKey,i.re));const a=s.Buffer.from(i.s.publicKey),h=this.encryptAndHash(i.ss,a);return this.mixKey(i.ss,this.dh(i.s.privateKey,i.re)),{ne:r,ns:h,ciphertext:this.encryptAndHash(i.ss,t)}}writeMessageC(e,i){const t=s.Buffer.from(e.s.publicKey),r=this.encryptAndHash(e.ss,t);this.mixKey(e.ss,this.dh(e.s.privateKey,e.re));const a=this.encryptAndHash(e.ss,i),h={ne:this.createEmptyKey(),ns:r,ciphertext:a},{cs1:n,cs2:c}=this.split(e.ss);return{h:e.ss.h,messageBuffer:h,cs1:n,cs2:c}}readMessageA(s,i){return e.isValidPublicKey(i.ne)&&(s.re=i.ne),this.mixHash(s.ss,s.re),this.decryptAndHash(s.ss,i.ciphertext)}readMessageB(s,i){if(e.isValidPublicKey(i.ne)&&(s.re=i.ne),this.mixHash(s.ss,s.re),!s.e)throw new Error("Handshake state `e` param is missing.");this.mixKey(s.ss,this.dh(s.e.privateKey,s.re));const{plaintext:t,valid:r}=this.decryptAndHash(s.ss,i.ns);r&&32===t.length&&e.isValidPublicKey(t)&&(s.rs=t),this.mixKey(s.ss,this.dh(s.e.privateKey,s.rs));const{plaintext:a,valid:h}=this.decryptAndHash(s.ss,i.ciphertext);return{plaintext:a,valid:r&&h}}readMessageC(s,i){const{plaintext:t,valid:r}=this.decryptAndHash(s.ss,i.ns);if(r&&32===t.length&&e.isValidPublicKey(t)&&(s.rs=t),!s.e)throw new Error("Handshake state `e` param is missing.");this.mixKey(s.ss,this.dh(s.e.privateKey,s.rs));const{plaintext:a,valid:h}=this.decryptAndHash(s.ss,i.ciphertext),{cs1:n,cs2:c}=this.split(s.ss);return{h:s.ss.h,plaintext:a,valid:r&&h,cs1:n,cs2:c}}initSession(e,i,t){const r=this.createEmptyKey(),a=s.Buffer.alloc(32);let h;return{hs:h=e?this.initializeInitiator(i,t,a,r):this.initializeResponder(i,t,a,r),i:e,mc:0}}sendMessage(s,e,i){let t;if(0===s.mc)t=this.writeMessageA(s.hs,e,i);else if(1===s.mc)t=this.writeMessageB(s.hs,e);else if(2===s.mc){const{h:i,messageBuffer:r,cs1:a,cs2:h}=this.writeMessageC(s.hs,e);t=r,s.h=i,s.cs1=a,s.cs2=h}else{if(!(s.mc>2))throw new Error("Session invalid.");if(s.i){if(!s.cs1)throw new Error("CS1 (cipher state) is not defined");t=this.writeMessageRegular(s.cs1,e)}else{if(!s.cs2)throw new Error("CS2 (cipher state) is not defined");t=this.writeMessageRegular(s.cs2,e)}}return s.mc++,t}recvMessage(e,i){let t=s.Buffer.alloc(0),r=!1;if(0===e.mc)({plaintext:t,valid:r}=this.readMessageA(e.hs,i));else if(1===e.mc)({plaintext:t,valid:r}=this.readMessageB(e.hs,i));else if(2===e.mc){const{h:s,plaintext:a,valid:h,cs1:n,cs2:c}=this.readMessageC(e.hs,i);t=a,r=h,e.h=s,e.cs1=n,e.cs2=c}return e.mc++,{plaintext:t,valid:r}}}exports.XX=t;
|
||
},{"buffer":"z1tx","../utils":"byDV","./abstract-handshake":"otMf"}],"TK+v":[function(require,module,exports) {
|
||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.decode2=exports.decode1=exports.decode0=exports.encode2=exports.encode1=exports.encode0=exports.uint16BEDecode=exports.uint16BEEncode=void 0;const e=require("buffer"),t=(t,n,r)=>((n=n||e.Buffer.allocUnsafe(2)).writeUInt16BE(t,r),n);exports.uint16BEEncode=t,exports.uint16BEEncode.bytes=2;const n=e=>{if(e.length<2)throw RangeError("Could not decode int16BE");return e.readUInt16BE(0)};function r(t){return e.Buffer.concat([t.ne,t.ciphertext])}function o(t){return e.Buffer.concat([t.ne,t.ns,t.ciphertext])}function s(t){return e.Buffer.concat([t.ns,t.ciphertext])}function c(t){if(t.length<32)throw new Error("Cannot decode stage 0 MessageBuffer: length less than 32 bytes.");return{ne:t.slice(0,32),ciphertext:t.slice(32,t.length),ns:e.Buffer.alloc(0)}}function d(e){if(e.length<80)throw new Error("Cannot decode stage 1 MessageBuffer: length less than 80 bytes.");return{ne:e.slice(0,32),ns:e.slice(32,80),ciphertext:e.slice(80,e.length)}}function i(t){if(t.length<48)throw new Error("Cannot decode stage 2 MessageBuffer: length less than 48 bytes.");return{ne:e.Buffer.alloc(0),ns:t.slice(0,48),ciphertext:t.slice(48,t.length)}}exports.uint16BEDecode=n,exports.uint16BEDecode.bytes=2,exports.encode0=r,exports.encode1=o,exports.encode2=s,exports.decode0=c,exports.decode1=d,exports.decode2=i;
|
||
},{"buffer":"z1tx"}],"rSt7":[function(require,module,exports) {
|
||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.XXHandshake=void 0;const e=require("buffer"),s=require("./handshakes/xx"),t=require("./utils"),i=require("./logger"),a=require("./encoder");class r{constructor(t,i,a,r,o,n,h){this.isInitiator=t,this.payload=i,this.prologue=a,this.staticKeypair=r,this.connection=o,n&&(this.remotePeer=n),this.xx=null!=h?h:new s.XX,this.session=this.xx.initSession(this.isInitiator,this.prologue,this.staticKeypair),this.remoteEarlyData=e.Buffer.alloc(0)}async propose(){if(i.logLocalStaticKeys(this.session.hs.s),this.isInitiator){i.logger("Stage 0 - Initiator starting to send first message.");const s=this.xx.sendMessage(this.session,e.Buffer.alloc(0));this.connection.writeLP(a.encode0(s)),i.logger("Stage 0 - Initiator finished sending first message."),i.logLocalEphemeralKeys(this.session.hs.e)}else{i.logger("Stage 0 - Responder waiting to receive first message...");const e=a.decode0((await this.connection.readLP()).slice()),{valid:s}=this.xx.recvMessage(this.session,e);if(!s)throw new Error("xx handshake stage 0 validation fail");i.logger("Stage 0 - Responder received first message."),i.logRemoteEphemeralKey(this.session.hs.re)}}async exchange(){if(this.isInitiator){i.logger("Stage 1 - Initiator waiting to receive first message from responder...");const s=a.decode1((await this.connection.readLP()).slice()),{plaintext:r,valid:o}=this.xx.recvMessage(this.session,s);if(!o)throw new Error("xx handshake stage 1 validation fail");i.logger("Stage 1 - Initiator received the message."),i.logRemoteEphemeralKey(this.session.hs.re),i.logRemoteStaticKey(this.session.hs.rs),i.logger("Initiator going to check remote's signature...");try{const i=await t.decodePayload(r);this.remotePeer=this.remotePeer||await t.getPeerIdFromPayload(i),this.remotePeer=await t.verifySignedPayload(s.ns,i,this.remotePeer),this.setRemoteEarlyData(i.data)}catch(e){throw new Error(`Error occurred while verifying signed payload: ${e.message}`)}i.logger("All good with the signature!")}else{i.logger("Stage 1 - Responder sending out first message with signed payload and static key.");const e=this.xx.sendMessage(this.session,this.payload);this.connection.writeLP(a.encode1(e)),i.logger("Stage 1 - Responder sent the second handshake message with signed payload."),i.logLocalEphemeralKeys(this.session.hs.e)}}async finish(){if(this.isInitiator){i.logger("Stage 2 - Initiator sending third handshake message.");const e=this.xx.sendMessage(this.session,this.payload);this.connection.writeLP(a.encode2(e)),i.logger("Stage 2 - Initiator sent message with signed payload.")}else{i.logger("Stage 2 - Responder waiting for third handshake message...");const s=a.decode2((await this.connection.readLP()).slice()),{plaintext:r,valid:o}=this.xx.recvMessage(this.session,s);if(!o)throw new Error("xx handshake stage 2 validation fail");i.logger("Stage 2 - Responder received the message, finished handshake.");try{const s=await t.decodePayload(r);this.remotePeer=this.remotePeer||await t.getPeerIdFromPayload(s),await t.verifySignedPayload(this.session.hs.rs,s,this.remotePeer),this.setRemoteEarlyData(s.data)}catch(e){throw new Error(`Error occurred while verifying signed payload: ${e.message}`)}}i.logCipherState(this.session)}encrypt(s,t){const i=this.getCS(t);return this.xx.encryptWithAd(i,e.Buffer.alloc(0),s)}decrypt(s,t){const i=this.getCS(t,!1);return this.xx.decryptWithAd(i,e.Buffer.alloc(0),s)}getRemoteStaticKey(){return this.session.hs.rs}getCS(e,s=!0){if(!e.cs1||!e.cs2)throw new Error("Handshake not completed properly, cipher state does not exist.");return this.isInitiator?s?e.cs1:e.cs2:s?e.cs2:e.cs1}setRemoteEarlyData(s){s&&(this.remoteEarlyData=e.Buffer.from(s.buffer,s.byteOffset,s.length))}}exports.XXHandshake=r;
|
||
},{"buffer":"z1tx","./handshakes/xx":"pDQu","./utils":"byDV","./logger":"EiWb","./encoder":"TK+v"}],"4h1y":[function(require,module,exports) {
|
||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.IK=void 0;const s=require("buffer"),e=require("../utils"),i=require("./abstract-handshake");class t extends i.AbstractHandshake{initSession(s,e,i,t){const r=this.createEmptyKey();let h;return{hs:h=s?this.initializeInitiator(e,i,t,r):this.initializeResponder(e,i,t,r),i:s,mc:0}}sendMessage(s,e){let i;if(0===s.mc)i=this.writeMessageA(s.hs,e);else if(1===s.mc){const{messageBuffer:t,h:r,cs1:h,cs2:a}=this.writeMessageB(s.hs,e);i=t,s.h=r,s.cs1=h,s.cs2=a}else{if(!(s.mc>1))throw new Error("Session invalid.");if(s.i){if(!s.cs1)throw new Error("CS1 (cipher state) is not defined");i=this.writeMessageRegular(s.cs1,e)}else{if(!s.cs2)throw new Error("CS2 (cipher state) is not defined");i=this.writeMessageRegular(s.cs2,e)}}return s.mc++,i}recvMessage(e,i){let t=s.Buffer.alloc(0),r=!1;if(0===e.mc&&({plaintext:t,valid:r}=this.readMessageA(e.hs,i)),1===e.mc){const{plaintext:s,valid:h,h:a,cs1:n,cs2:c}=this.readMessageB(e.hs,i);t=s,r=h,e.h=a,e.cs1=n,e.cs2=c}return e.mc++,{plaintext:t,valid:r}}writeMessageA(i,t){i.e=e.generateKeypair();const r=i.e.publicKey;this.mixHash(i.ss,r),this.mixKey(i.ss,this.dh(i.e.privateKey,i.rs));const h=s.Buffer.from(i.s.publicKey),a=this.encryptAndHash(i.ss,h);return this.mixKey(i.ss,this.dh(i.s.privateKey,i.rs)),{ne:r,ns:a,ciphertext:this.encryptAndHash(i.ss,t)}}writeMessageB(s,i){s.e=e.generateKeypair();const t=s.e.publicKey;this.mixHash(s.ss,t),this.mixKey(s.ss,this.dh(s.e.privateKey,s.re)),this.mixKey(s.ss,this.dh(s.e.privateKey,s.rs));const r=this.encryptAndHash(s.ss,i),h={ne:t,ns:this.createEmptyKey(),ciphertext:r},{cs1:a,cs2:n}=this.split(s.ss);return{messageBuffer:h,cs1:a,cs2:n,h:s.ss.h}}readMessageA(s,i){e.isValidPublicKey(i.ne)&&(s.re=i.ne),this.mixHash(s.ss,s.re),this.mixKey(s.ss,this.dh(s.s.privateKey,s.re));const{plaintext:t,valid:r}=this.decryptAndHash(s.ss,i.ns);r&&32===t.length&&e.isValidPublicKey(t)&&(s.rs=t),this.mixKey(s.ss,this.dh(s.s.privateKey,s.rs));const{plaintext:h,valid:a}=this.decryptAndHash(s.ss,i.ciphertext);return{plaintext:h,valid:r&&a}}readMessageB(s,i){if(e.isValidPublicKey(i.ne)&&(s.re=i.ne),this.mixHash(s.ss,s.re),!s.e)throw new Error("Handshake state should contain ephemeral key by now.");this.mixKey(s.ss,this.dh(s.e.privateKey,s.re)),this.mixKey(s.ss,this.dh(s.s.privateKey,s.re));const{plaintext:t,valid:r}=this.decryptAndHash(s.ss,i.ciphertext),{cs1:h,cs2:a}=this.split(s.ss);return{h:s.ss.h,valid:r,plaintext:t,cs1:h,cs2:a}}initializeInitiator(e,i,t,r){const h=this.initializeSymmetric("Noise_IK_25519_ChaChaPoly_SHA256");return this.mixHash(h,e),this.mixHash(h,t),{ss:h,s:i,rs:t,re:s.Buffer.alloc(32),psk:r}}initializeResponder(e,i,t,r){const h=this.initializeSymmetric("Noise_IK_25519_ChaChaPoly_SHA256");return this.mixHash(h,e),this.mixHash(h,i.publicKey),{ss:h,s:i,rs:t,re:s.Buffer.alloc(32),psk:r}}}exports.IK=t;
|
||
},{"buffer":"z1tx","../utils":"byDV","./abstract-handshake":"otMf"}],"torS":[function(require,module,exports) {
|
||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.FailedIKError=void 0;class e extends Error{constructor(e,r){super(r),this.initialMsg=e,this.name="FailedIKhandshake"}}exports.FailedIKError=e;
|
||
},{}],"XzBq":[function(require,module,exports) {
|
||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.IKHandshake=void 0;const e=require("./handshakes/ik"),s=require("buffer"),t=require("./encoder"),i=require("./utils"),r=require("./errors"),o=require("./logger");class a{constructor(t,i,r,o,a,n,h,g){this.isInitiator=t,this.payload=s.Buffer.from(i),this.prologue=r,this.staticKeypair=o,this.connection=a,h&&(this.remotePeer=h),this.ik=null!=g?g:new e.IK,this.session=this.ik.initSession(this.isInitiator,this.prologue,this.staticKeypair,n),this.remoteEarlyData=s.Buffer.alloc(0)}async stage0(){if(o.logLocalStaticKeys(this.session.hs.s),o.logRemoteStaticKey(this.session.hs.rs),this.isInitiator){o.logger("IK Stage 0 - Initiator sending message...");const e=this.ik.sendMessage(this.session,this.payload);this.connection.writeLP(t.encode1(e)),o.logger("IK Stage 0 - Initiator sent message."),o.logLocalEphemeralKeys(this.session.hs.e)}else{o.logger("IK Stage 0 - Responder receiving message...");const s=await this.connection.readLP();try{const a=t.decode1(s.slice()),{plaintext:n,valid:h}=this.ik.recvMessage(this.session,a);if(!h)throw new Error("ik handshake stage 0 decryption validation fail");o.logger("IK Stage 0 - Responder got message, going to verify payload.");const g=await i.decodePayload(n);this.remotePeer=this.remotePeer||await i.getPeerIdFromPayload(g),await i.verifySignedPayload(this.session.hs.rs,g,this.remotePeer),this.setRemoteEarlyData(g.data),o.logger("IK Stage 0 - Responder successfully verified payload!"),o.logRemoteEphemeralKey(this.session.hs.re)}catch(e){const t=e;throw o.logger("Responder breaking up with IK handshake in stage 0."),new r.FailedIKError(s,`Error occurred while verifying initiator's signed payload: ${t.message}`)}}}async stage1(){if(this.isInitiator){o.logger("IK Stage 1 - Initiator receiving message...");const a=(await this.connection.readLP()).slice(),n=t.decode0(s.Buffer.from(a)),{plaintext:h,valid:g}=this.ik.recvMessage(this.session,n);o.logger("IK Stage 1 - Initiator got message, going to verify payload.");try{if(!g)throw new Error("ik stage 1 decryption validation fail");const s=await i.decodePayload(h);this.remotePeer=this.remotePeer||await i.getPeerIdFromPayload(s),await i.verifySignedPayload(n.ns.slice(0,32),s,this.remotePeer),this.setRemoteEarlyData(s.data),o.logger("IK Stage 1 - Initiator successfully verified payload!"),o.logRemoteEphemeralKey(this.session.hs.re)}catch(e){const s=e;throw o.logger("Initiator breaking up with IK handshake in stage 1."),new r.FailedIKError(a,`Error occurred while verifying responder's signed payload: ${s.message}`)}}else{o.logger("IK Stage 1 - Responder sending message...");const e=this.ik.sendMessage(this.session,this.payload);this.connection.writeLP(t.encode0(e)),o.logger("IK Stage 1 - Responder sent message..."),o.logLocalEphemeralKeys(this.session.hs.e)}o.logCipherState(this.session)}decrypt(e,t){const i=this.getCS(t,!1);return this.ik.decryptWithAd(i,s.Buffer.alloc(0),e)}encrypt(e,t){const i=this.getCS(t);return this.ik.encryptWithAd(i,s.Buffer.alloc(0),e)}getLocalEphemeralKeys(){if(!this.session.hs.e)throw new Error("Ephemeral keys do not exist.");return this.session.hs.e}getCS(e,s=!0){if(!e.cs1||!e.cs2)throw new Error("Handshake not completed properly, cipher state does not exist.");return this.isInitiator?s?e.cs1:e.cs2:s?e.cs2:e.cs1}setRemoteEarlyData(e){e&&(this.remoteEarlyData=s.Buffer.from(e.buffer,e.byteOffset,e.length))}}exports.IKHandshake=a;
|
||
},{"./handshakes/ik":"4h1y","buffer":"z1tx","./encoder":"TK+v","./utils":"byDV","./errors":"torS","./logger":"EiWb"}],"b1iJ":[function(require,module,exports) {
|
||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.XXFallbackHandshake=void 0;const e=require("buffer"),s=require("./handshake-xx"),a=require("./utils"),t=require("./logger"),i=require("./encoder");class r extends s.XXHandshake{constructor(e,s,a,t,i,r,o,l,n){super(e,s,a,t,i,o,n),l&&(this.ephemeralKeys=l),this.initialMsg=r}async propose(){if(this.isInitiator)this.xx.sendMessage(this.session,e.Buffer.alloc(0),this.ephemeralKeys),t.logger("XX Fallback Stage 0 - Initialized state as the first message was sent by initiator."),t.logLocalEphemeralKeys(this.session.hs.e);else{t.logger("XX Fallback Stage 0 - Responder decoding initial msg from IK.");const s=i.decode0(this.initialMsg),{valid:a}=this.xx.recvMessage(this.session,{ne:s.ne,ns:e.Buffer.alloc(0),ciphertext:e.Buffer.alloc(0)});if(!a)throw new Error("xx fallback stage 0 decryption validation fail");t.logger("XX Fallback Stage 0 - Responder used received message from IK."),t.logRemoteEphemeralKey(this.session.hs.re)}}async exchange(){if(this.isInitiator){const s=i.decode1(this.initialMsg),{plaintext:r,valid:o}=this.xx.recvMessage(this.session,s);if(!o)throw new Error("xx fallback stage 1 decryption validation fail");t.logger("XX Fallback Stage 1 - Initiator used received message from IK."),t.logRemoteEphemeralKey(this.session.hs.re),t.logRemoteStaticKey(this.session.hs.rs),t.logger("Initiator going to check remote's signature...");try{const s=await a.decodePayload(r);this.remotePeer=this.remotePeer||await a.getPeerIdFromPayload(s),await a.verifySignedPayload(this.session.hs.rs,s,this.remotePeer),this.setRemoteEarlyData(s.data)}catch(e){throw new Error(`Error occurred while verifying signed payload from responder: ${e.message}`)}t.logger("All good with the signature!")}else t.logger("XX Fallback Stage 1 - Responder start"),await super.exchange(),t.logger("XX Fallback Stage 1 - Responder end")}}exports.XXFallbackHandshake=r;
|
||
},{"buffer":"z1tx","./handshake-xx":"rSt7","./utils":"byDV","./logger":"EiWb","./encoder":"TK+v"}],"vc8W":[function(require,module,exports) {
|
||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.decryptStream=exports.encryptStream=void 0;const e=require("buffer"),t=require("./constants");function r(r){return async function*(n){for await(const o of n){const n=e.Buffer.from(o.buffer,o.byteOffset,o.length);for(let e=0;e<n.length;e+=t.NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG){let o=e+t.NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG;o>n.length&&(o=n.length);const s=r.encrypt(n.slice(e,o),r.session);yield s}}}}function n(r){return async function*(n){for await(const o of n){const n=e.Buffer.from(o.buffer,o.byteOffset,o.length);for(let e=0;e<n.length;e+=t.NOISE_MSG_MAX_LENGTH_BYTES){let o=e+t.NOISE_MSG_MAX_LENGTH_BYTES;o>n.length&&(o=n.length);const s=n.slice(e,o),{plaintext:f,valid:c}=await r.decrypt(s,r.session);if(!c)throw new Error("Failed to validate decrypted chunk");yield f}}}}exports.encryptStream=r,exports.decryptStream=n;
|
||
},{"buffer":"z1tx","./constants":"a1K6"}],"j6WI":[function(require,module,exports) {
|
||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.KeyCache=void 0;class e{constructor(){this.storage=new Map}store(e,t){this.storage.set(e.id,t)}load(e){var t;return e&&null!==(t=this.storage.get(e.id))&&void 0!==t?t:null}resetStorage(){this.storage.clear()}}const t=new e;exports.KeyCache=t;
|
||
},{}],"HRz0":[function(require,module,exports) {
|
||
"use strict";var e=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.Noise=void 0;const t=e(require("bcrypto/lib/js/x25519")),r=require("buffer"),a=e(require("it-pb-rpc")),i=e(require("it-pair/duplex")),o=e(require("it-buffer")),n=e(require("it-pipe")),s=require("it-length-prefixed"),c=require("./handshake-xx"),u=require("./handshake-ik"),l=require("./handshake-xx-fallback"),h=require("./utils"),d=require("./encoder"),p=require("./crypto"),y=require("./keycache"),f=require("./logger"),m=require("./constants");class g{constructor(e,a){if(this.protocol="/noise",this.prologue=r.Buffer.alloc(0),this.earlyData=null!=a?a:r.Buffer.alloc(0),this.useNoisePipes=!1,e){const r=t.default.publicKeyCreate(e);this.staticKeys={privateKey:e,publicKey:r}}else this.staticKeys=h.generateKeypair()}async secureOutbound(e,t,r){const i=a.default(t,{lengthEncoder:d.uint16BEEncode,lengthDecoder:d.uint16BEDecode,maxDataLength:m.NOISE_MSG_MAX_LENGTH_BYTES}),o=await this.performHandshake({connection:i,isInitiator:!0,localPeer:e,remotePeer:r});return{conn:await this.createSecureConnection(i,o),remoteEarlyData:o.remoteEarlyData,remotePeer:o.remotePeer}}async secureInbound(e,t,r){const i=a.default(t,{lengthEncoder:d.uint16BEEncode,lengthDecoder:d.uint16BEDecode,maxDataLength:m.NOISE_MSG_MAX_LENGTH_BYTES}),o=await this.performHandshake({connection:i,isInitiator:!1,localPeer:e,remotePeer:r});return{conn:await this.createSecureConnection(i,o),remoteEarlyData:o.remoteEarlyData,remotePeer:o.remotePeer}}async performHandshake(e){var t;const a=await h.getPayload(e.localPeer,this.staticKeys.publicKey,this.earlyData);let i=this.useNoisePipes;if(e.isInitiator&&null===y.KeyCache.load(e.remotePeer)&&(i=!1),!i)return await this.performXXHandshake(e,a);{const{remotePeer:i,connection:n,isInitiator:s}=e,c=new u.IKHandshake(s,a,this.prologue,this.staticKeys,n,null!==(t=y.KeyCache.load(e.remotePeer))&&void 0!==t?t:r.Buffer.alloc(32),i);try{return await this.performIKHandshake(c)}catch(o){let t;return e.isInitiator&&(t=c.getLocalEphemeralKeys()),await this.performXXFallbackHandshake(e,a,o.initialMsg,t)}}}async performXXFallbackHandshake(e,t,r,a){const{isInitiator:i,remotePeer:o,connection:n}=e,s=new l.XXFallbackHandshake(i,t,this.prologue,this.staticKeys,n,r,o,a);try{await s.propose(),await s.exchange(),await s.finish()}catch(c){throw f.logger(c),new Error(`Error occurred during XX Fallback handshake: ${c.message}`)}return s}async performXXHandshake(e,t){const{isInitiator:r,remotePeer:a,connection:i}=e,o=new c.XXHandshake(r,t,this.prologue,this.staticKeys,i,a);try{await o.propose(),await o.exchange(),await o.finish(),this.useNoisePipes&&o.remotePeer&&y.KeyCache.store(o.remotePeer,o.getRemoteStaticKey())}catch(n){throw new Error(`Error occurred during XX handshake: ${n.message}`)}return o}async performIKHandshake(e){return await e.stage0(),await e.stage1(),e}async createSecureConnection(e,t){const[r,a]=i.default(),c=e.unwrap();return await n.default(r,o.default,p.encryptStream(t),s.encode({lengthEncoder:d.uint16BEEncode}),c,s.decode({lengthDecoder:d.uint16BEDecode}),o.default,p.decryptStream(t),r),a}}exports.Noise=g;
|
||
},{"bcrypto/lib/js/x25519":"cm0X","buffer":"z1tx","it-pb-rpc":"/zM8","it-pair/duplex":"ECx4","it-buffer":"oUC/","it-pipe":"p27M","it-length-prefixed":"1RXH","./handshake-xx":"rSt7","./handshake-ik":"XzBq","./handshake-xx-fallback":"b1iJ","./utils":"byDV","./encoder":"TK+v","./crypto":"vc8W","./keycache":"j6WI","./logger":"EiWb","./constants":"a1K6"}],"Ta4N":[function(require,module,exports) {
|
||
"use strict";var e=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r),Object.defineProperty(e,o,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),t=this&&this.__exportStar||function(t,r){for(var o in t)"default"===o||Object.prototype.hasOwnProperty.call(r,o)||e(r,t,o)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.NOISE=void 0;const r=require("./noise");t(require("./noise"),exports),exports.NOISE=new r.Noise;
|
||
},{"./noise":"HRz0"}],"H6Il":[function(require,module,exports) {
|
||
"use strict";function e(e,n){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=t(e))||n&&e&&"number"==typeof e.length){r&&(e=r);var o=0,i=function(){};return{s:i,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,c=!0,u=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return c=e.done,e},e:function(e){u=!0,a=e},f:function(){try{c||null==r.return||r.return()}finally{if(u)throw a}}}}function t(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}var a=require("./util"),c=a.encodeText,u=function(){function t(e,n,o,i){r(this,t),this.name=e,this.code=n,this.codeBuf=c(this.code),this.alphabet=i,this.codec=o(i)}return i(t,[{key:"encode",value:function(e){return this.codec.encode(e)}},{key:"decode",value:function(t){var n,r=e(t);try{for(r.s();!(n=r.n()).done;){var o=n.value;if(this.alphabet&&this.alphabet.indexOf(o)<0)throw new Error("invalid character '".concat(o,"' in '").concat(t,"'"))}}catch(i){r.e(i)}finally{r.f()}return this.codec.decode(t)}}]),t}();module.exports=u;
|
||
},{"./util":"4dv8"}],"fgxD":[function(require,module,exports) {
|
||
"use strict";var e=require("@multiformats/base-x"),a=require("./base.js"),r=require("./rfc4648"),s=r.rfc4648,b=require("./util"),u=b.decodeText,p=b.encodeText,d=function(){return{encode:u,decode:p}},t=[["identity","\0",d,""],["base2","0",s(1),"01"],["base8","7",s(3),"01234567"],["base10","9",e,"0123456789"],["base16","f",s(4),"0123456789abcdef"],["base16upper","F",s(4),"0123456789ABCDEF"],["base32hex","v",s(5),"0123456789abcdefghijklmnopqrstuv"],["base32hexupper","V",s(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV"],["base32hexpad","t",s(5),"0123456789abcdefghijklmnopqrstuv="],["base32hexpadupper","T",s(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV="],["base32","b",s(5),"abcdefghijklmnopqrstuvwxyz234567"],["base32upper","B",s(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"],["base32pad","c",s(5),"abcdefghijklmnopqrstuvwxyz234567="],["base32padupper","C",s(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567="],["base32z","h",s(5),"ybndrfg8ejkmcpqxot1uwisza345h769"],["base36","k",e,"0123456789abcdefghijklmnopqrstuvwxyz"],["base36upper","K",e,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"],["base58btc","z",e,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],["base58flickr","Z",e,"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"],["base64","m",s(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],["base64pad","M",s(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],["base64url","u",s(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"],["base64urlpad","U",s(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="]],c=t.reduce(function(e,r){return e[r[0]]=new a(r[0],r[1],r[2],r[3]),e},{}),n=t.reduce(function(e,a){return e[a[1]]=c[a[0]],e},{});module.exports={names:c,codes:n};
|
||
},{"@multiformats/base-x":"zMOB","./base.js":"H6Il","./rfc4648":"hH6x","./util":"4dv8"}],"i0zy":[function(require,module,exports) {
|
||
"use strict";var e=require("./constants"),r=require("./util"),t=r.encodeText,n=r.decodeText,o=r.concat;function c(e,r){if(!r)throw new Error("requires an encoded Uint8Array");var t=u(e),n=t.name,c=t.codeBuf;return d(n,r),o([c,r],c.length+r.length)}function s(e,r){var n=u(e),c=t(n.encode(r));return o([n.codeBuf,c],n.codeBuf.length+c.length)}function a(e){e instanceof Uint8Array&&(e=n(e));var r=e[0];return["f","F","v","V","t","T","b","B","c","C","h","k","K"].includes(r)&&(e=e.toLowerCase()),u(e[0]).decode(e.substring(1))}function i(e){if(e instanceof Uint8Array&&(e=n(e)),"[object String]"!==Object.prototype.toString.call(e))return!1;try{return u(e[0]).name}catch(r){return!1}}function d(e,r){u(e).decode(n(r))}function u(r){if(Object.prototype.hasOwnProperty.call(e.names,r))return e.names[r];if(Object.prototype.hasOwnProperty.call(e.codes,r))return e.codes[r];throw new Error("Unsupported encoding: ".concat(r))}function f(e){return e instanceof Uint8Array&&(e=n(e)),u(e[0])}exports=module.exports=c,exports.encode=s,exports.decode=a,exports.isEncoded=i,exports.encoding=u,exports.encodingFromData=f;var p=Object.freeze(e.names),l=Object.freeze(e.codes);exports.names=p,exports.codes=l;
|
||
},{"./constants":"fgxD","./util":"4dv8"}],"s4P2":[function(require,module,exports) {
|
||
"use strict";const{encoding:e}=require("multibase"),t=new TextDecoder("utf8");function n(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t}function r(r,o="utf8"){return"utf8"===o||"utf-8"===o?t.decode(r):"ascii"===o?n(r):e(o).encode(r)}module.exports=r;
|
||
},{"multibase":"i0zy"}],"/DWs":[function(require,module,exports) {
|
||
"use strict";const e=require("is-ip"),t=require("uint8arrays/to-string"),n=e,i=e.v4,r=e.v6,s=function(e,n,l){let o;if(l=~~l,i(e))o=n||new Uint8Array(l+4),e.split(/\./g).map(function(e){o[l++]=255&parseInt(e,10)});else if(r(e)){const r=e.split(":",8);let p;for(p=0;p<r.length;p++){var f;i(r[p])&&(f=s(r[p]),r[p]=t(f.slice(0,2),"base16")),f&&++p<8&&r.splice(p,0,t(f.slice(2,4),"base16"))}if(""===r[0])for(;r.length<8;)r.unshift("0");else if(""===r[r.length-1])for(;r.length<8;)r.push("0");else if(r.length<8){for(p=0;p<r.length&&""!==r[p];p++);const e=[p,"1"];for(p=9-r.length;p>0;p--)e.push("0");r.splice.apply(r,e)}for(o=n||new Uint8Array(l+16),p=0;p<r.length;p++){const e=parseInt(r[p],16);o[l++]=e>>8&255,o[l++]=255&e}}if(!o)throw Error("Invalid ip address: "+e);return o},l=function(e,t,n){t=~~t,n=n||e.length-t;const i=[];let r;const s=new DataView(e.buffer);if(4===n){for(let r=0;r<n;r++)i.push(e[t+r]);r=i.join(".")}else if(16===n){for(let e=0;e<n;e+=2)i.push(s.getUint16(t+e).toString(16));r=(r=(r=i.join(":")).replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3")).replace(/:{3,4}/,"::")}return r};module.exports={isIP:n,isV4:i,isV6:r,toBytes:s,toString:l};
|
||
},{"is-ip":"U5wz","uint8arrays/to-string":"s4P2"}],"qku6":[function(require,module,exports) {
|
||
module.exports={encode:require("./encode.js"),decode:require("./decode.js"),encodingLength:require("./length.js")};
|
||
},{"./encode.js":"qYQO","./decode.js":"ZJdu","./length.js":"Bq+a"}],"viAT":[function(require,module,exports) {
|
||
"use strict";const{encoding:e}=require("multibase"),t=new TextEncoder;function n(e){const t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}function r(r,o="utf8"){return"utf8"===o||"utf-8"===o?t.encode(r):"ascii"===o?n(r):e(o).decode(r)}module.exports=r;
|
||
},{"multibase":"i0zy"}],"r46n":[function(require,module,exports) {
|
||
"use strict";const e=require("./ip"),n=require("./protocols-table"),r=require("cids"),t=require("multibase"),o=require("varint"),s=require("uint8arrays/to-string"),i=require("uint8arrays/from-string"),a=require("uint8arrays/concat");function c(e,n){return n instanceof Uint8Array?c.toString(e,n):c.toBytes(e,n)}function u(n){if(!e.isIP(n))throw new Error("invalid ip address");return e.toBytes(n)}function d(n){const r=e.toString(n);if(!r||!e.isIP(r))throw new Error("invalid ip address");return r}function l(e){const n=new ArrayBuffer(2);return new DataView(n).setUint16(0,e),new Uint8Array(n)}function f(e){return new DataView(e.buffer).getUint16(0)}function h(e){const n=i(e),r=Uint8Array.from(o.encode(n.length));return a([r,n],r.length+n.length)}function g(e){const n=o.decode(e);if((e=e.slice(o.decode.bytes)).length!==n)throw new Error("inconsistent lengths");return s(e)}function w(e){const n=new r(e).multihash,t=Uint8Array.from(o.encode(n.length));return a([t,n],t.length+n.length)}function b(e){const n=o.decode(e),r=e.slice(o.decode.bytes);if(r.length!==n)throw new Error("inconsistent lengths");return s(r,"base58btc")}function p(e){const n=e.split(":");if(2!==n.length)throw new Error("failed to parse onion addr: "+n+" does not contain a port number");if(16!==n[0].length)throw new Error("failed to parse onion addr: "+n[0]+" not a Tor onion address.");const r=t.decode("b"+n[0]),o=parseInt(n[1],10);if(o<1||o>65536)throw new Error("Port number is not in range(1, 65536)");const s=l(o);return a([r,s],r.length+s.length)}function y(e){const n=e.split(":");if(2!==n.length)throw new Error("failed to parse onion addr: "+n+" does not contain a port number");if(56!==n[0].length)throw new Error("failed to parse onion addr: "+n[0]+" not a Tor onion3 address.");const r=t.decode("b"+n[0]),o=parseInt(n[1],10);if(o<1||o>65536)throw new Error("Port number is not in range(1, 65536)");const s=l(o);return a([r,s],r.length+s.length)}function m(e){const n=e.slice(0,e.length-2),r=e.slice(e.length-2);return s(n,"base32")+":"+f(r)}module.exports=c,c.toString=function(e,r){switch(n(e).code){case 4:case 41:return d(r);case 6:case 273:case 33:case 132:return f(r).toString();case 53:case 54:case 55:case 56:case 400:case 777:return g(r);case 421:return b(r);case 444:case 445:return m(r);default:return s(r,"base16")}},c.toBytes=function(e,r){switch(n(e).code){case 4:case 41:return u(r);case 6:case 273:case 33:case 132:return l(parseInt(r,10));case 53:case 54:case 55:case 56:case 400:case 777:return h(r);case 421:return w(r);case 444:return p(r);case 445:return y(r);default:return i(r,"base16")}};
|
||
},{"./ip":"/DWs","./protocols-table":"f6b+","cids":"gAYb","multibase":"i0zy","varint":"qku6","uint8arrays/to-string":"s4P2","uint8arrays/from-string":"viAT","uint8arrays/concat":"qYui"}],"Mvd4":[function(require,module,exports) {
|
||
"use strict";const r=require("./convert"),t=require("./protocols-table"),e=require("varint"),n=require("uint8arrays/concat"),o=require("uint8arrays/to-string");function i(r){const e=[],n=r.split("/").slice(1);if(1===n.length&&""===n[0])return[];for(let o=0;o<n.length;o++){const i=n[o],s=t(i);if(0!==s.size){if(++o>=n.length)throw b("invalid address: "+r);if(s.path){e.push([i,m(n.slice(o).join("/"))]);break}e.push([i,n[o]])}else e.push([i])}return e}function s(r){const t=[];return r.map(r=>{const e=v(r);return t.push(e.name),r.length>1&&t.push(r[1]),null}),m(t.join("/"))}function u(t){return t.map(t=>{Array.isArray(t)||(t=[t]);const e=v(t);return t.length>1?[e.code,r.toBytes(e.code,t[1])]:[e.code]})}function c(t){return t.map(t=>{const e=v(t);return t[1]?[e.code,r.toString(e.code,t[1])]:[e.code]})}function l(r){return g(n(r.map(r=>{const t=v(r);let o=Uint8Array.from(e.encode(t.code));return r.length>1&&(o=n([o,r[1]])),o})))}function a(r,t){if(r.size>0)return r.size/8;if(0===r.size)return 0;return e.decode(t)+e.decode.bytes}function f(r){const n=[];let i=0;for(;i<r.length;){const s=e.decode(r,i),u=e.decode.bytes,c=a(t(s),r.slice(i+u));if(0===c){n.push([s]),i+=u;continue}const l=r.slice(i+u,i+u+c);if((i+=c+u)>r.length)throw b("Invalid address Uint8Array: "+o(r,"base16"));n.push([s,l])}return n}function d(r){return s(c(f(r)))}function p(r){return l(u(i(r=m(r))))}function h(r){return p(r)}function g(r){const t=y(r);if(t)throw t;return Uint8Array.from(r)}function y(r){try{f(r)}catch(t){return t}}function T(r){return void 0===y(r)}function m(r){return"/"+r.trim().split("/").filter(r=>r).join("/")}function b(r){return new Error("Error parsing address: "+r)}function v(r){return t(r[0])}module.exports={stringToStringTuples:i,stringTuplesToString:s,tuplesToStringTuples:c,stringTuplesToTuples:u,bytesToTuples:f,tuplesToBytes:l,bytesToString:d,stringToBytes:p,fromString:h,fromBytes:g,validateBytes:y,isValidBytes:T,cleanPath:m,ParseError:b,protoFromTuple:v,sizeForAddr:a};
|
||
},{"./convert":"r46n","./protocols-table":"f6b+","varint":"qku6","uint8arrays/concat":"qYui","uint8arrays/to-string":"s4P2"}],"FEl+":[function(require,module,exports) {
|
||
"use strict";const t=require("./codec"),r=require("./protocols-table"),e=require("varint"),s=require("cids"),o=require("err-code"),i=Symbol.for("nodejs.util.inspect.custom"),n=require("uint8arrays/to-string"),a=require("uint8arrays/equals"),l=new Map,u=Symbol.for("@multiformats/js-multiaddr/multiaddr");class d{constructor(r){if(null==r&&(r=""),Object.defineProperty(this,u,{value:!0}),r instanceof Uint8Array)this.bytes=t.fromBytes(r);else if("string"==typeof r){if(r.length>0&&"/"!==r.charAt(0))throw new Error(`multiaddr "${r}" must start with a "/"`);this.bytes=t.fromString(r)}else{if(!d.isMultiaddr(r))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=t.fromBytes(r.bytes)}}toString(){return t.bytesToString(this.bytes)}toJSON(){return this.toString()}toOptions(){const t={},r=this.toString().split("/");return t.family="ip4"===r[1]?4:6,t.host=r[2],t.transport=r[3],t.port=parseInt(r[4]),t}protos(){return this.protoCodes().map(t=>Object.assign({},r(t)))}protoCodes(){const s=[],o=this.bytes;let i=0;for(;i<o.length;){const n=e.decode(o,i),a=e.decode.bytes,l=r(n);i+=t.sizeForAddr(l,o.slice(i+a))+a,s.push(n)}return s}protoNames(){return this.protos().map(t=>t.name)}tuples(){return t.bytesToTuples(this.bytes)}stringTuples(){const r=t.bytesToTuples(this.bytes);return t.tuplesToStringTuples(r)}encapsulate(t){return t=new d(t),new d(this.toString()+t.toString())}decapsulate(t){const r=t.toString(),e=this.toString(),s=e.lastIndexOf(r);if(s<0)throw new Error("Address "+this+" does not contain subaddress: "+t);return new d(e.slice(0,s))}decapsulateCode(r){const e=this.tuples();for(let s=e.length-1;s>=0;s--)if(e[s][0]===r)return new d(t.tuplesToBytes(e.slice(0,s)));return this}getPeerId(){try{const e=this.stringTuples().filter(t=>t[0]===r.names.ipfs.code).pop();return e&&e[1]?n(new s(e[1]).multihash,"base58btc"):null}catch(t){return null}}getPath(){let t=null;try{(t=this.stringTuples().filter(t=>{return!!r(t[0]).path})[0][1])||(t=null)}catch(e){t=null}return t}equals(t){return a(this.bytes,t.bytes)}async resolve(){const t=this.protos().find(t=>t.resolvable);if(!t)return[this];const r=l.get(t.name);if(!r)throw o(new Error(`no available resolver for ${t.name}`),"ERR_NO_AVAILABLE_RESOLVER");return(await r(this)).map(t=>new d(t))}nodeAddress(){const t=this.protoCodes(),r=this.protoNames(),e=this.toString().split("/").slice(1);if(e.length<4)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6}/{address}/{tcp, udp}/{port}".');if(4!==t[0]&&41!==t[0]&&54!==t[0]&&55!==t[0])throw new Error(`no protocol with name: "'${r[0]}'". Must have a valid family name: "{ip4, ip6, dns4, dns6}".`);if("tcp"!==e[2]&&"udp"!==e[2])throw new Error(`no protocol with name: "'${r[1]}'". Must have a valid transport protocol: "{tcp, udp}".`);return{family:41===t[0]||55===t[0]?6:4,address:e[1],port:parseInt(e[3])}}isThinWaistAddress(t){const r=(t||this).protos();return 2===r.length&&((4===r[0].code||41===r[0].code)&&(6===r[1].code||273===r[1].code))}static fromNodeAddress(t,r){if(!t)throw new Error("requires node address object");if(!r)throw new Error("requires transport protocol");let e;switch(t.family){case 4:e="ip4";break;case 6:e="ip6";break;default:throw Error(`Invalid addr family. Got '${t.family}' instead of 4 or 6`)}return new d("/"+[e,t.address,r,t.port].join("/"))}static isName(t){return!!d.isMultiaddr(t)&&t.protos().some(t=>t.resolvable)}static isMultiaddr(t){return t instanceof d||Boolean(t&&t[u])}[i](){return"<Multiaddr "+n(this.bytes,"base16")+" - "+t.bytesToString(this.bytes)+">"}inspect(){return"<Multiaddr "+n(this.bytes,"base16")+" - "+t.bytesToString(this.bytes)+">"}}function p(t){return new d(t)}d.protocols=r,d.resolvers=l,module.exports={Multiaddr:d,multiaddr:p,protocols:r,resolvers:l};
|
||
},{"./codec":"Mvd4","./protocols-table":"f6b+","varint":"qku6","cids":"gAYb","err-code":"hLMW","uint8arrays/to-string":"s4P2","uint8arrays/equals":"mZxc"}],"5PQS":[function(require,module,exports) {
|
||
"use strict";const{Multiaddr:t}=require("multiaddr"),r=C("dns4"),p=C("dns6"),e=C("dnsaddr"),n=N(C("dns"),e,r,p),c=N(C("ip4"),C("ip6")),i=N(y(c,C("tcp")),y(n,C("tcp"))),u=y(c,C("udp")),s=y(u,C("utp")),a=y(u,C("quic")),o=N(y(i,C("ws")),y(n,C("ws"))),l=N(y(i,C("wss")),y(n,C("wss"))),h=N(y(i,C("http")),y(c,C("http")),y(n,C("http"))),d=N(y(i,C("https")),y(c,C("https")),y(n,C("https"))),f=N(y(o,C("p2p-webrtc-star"),C("p2p")),y(l,C("p2p-webrtc-star"),C("p2p")),y(o,C("p2p-webrtc-star")),y(l,C("p2p-webrtc-star"))),b=N(y(o,C("p2p-websocket-star"),C("p2p")),y(l,C("p2p-websocket-star"),C("p2p")),y(o,C("p2p-websocket-star")),y(l,C("p2p-websocket-star"))),w=N(y(h,C("p2p-webrtc-direct"),C("p2p")),y(d,C("p2p-webrtc-direct"),C("p2p")),y(h,C("p2p-webrtc-direct")),y(d,C("p2p-webrtc-direct"))),S=N(o,l,h,d,f,w,i,s,a,n),g=N(y(S,C("p2p-stardust"),C("p2p")),y(S,C("p2p-stardust"))),m=N(y(S,C("p2p")),f,w,C("p2p")),M=N(y(m,C("p2p-circuit"),m),y(m,C("p2p-circuit")),y(C("p2p-circuit"),m),y(S,C("p2p-circuit")),y(C("p2p-circuit"),S),C("p2p-circuit")),P=()=>N(y(M,P),M),D=P(),T=N(y(D,m,D),y(m,D),y(D,m),D,m);function k(r){return function(p){if(!t.isMultiaddr(p))try{p=new t(p)}catch(n){return!1}const e=r(p.protoNames());return null!==e&&(!0===e||!1===e?e:0===e.length)}}function y(...t){function r(r){if(r.length<t.length)return null;let p=r;return t.some(t=>(p="function"==typeof t?t().partialMatch(r):t.partialMatch(r),Array.isArray(p)&&(r=p),null===p)),p}return{toString:function(){return"{ "+t.join(" ")+" }"},input:t,matches:k(r),partialMatch:r}}function N(...t){function r(r){let p=null;return t.some(t=>{const e="function"==typeof t?t().partialMatch(r):t.partialMatch(r);return!!e&&(p=e,!0)}),p}return{toString:function(){return"{ "+t.join(" ")+" }"},input:t,matches:k(r),partialMatch:r}}function C(r){const p=r;return{toString:function(){return p},matches:function(r){if("string"==typeof r)try{r=new t(r)}catch(n){return!1}const e=r.protoNames();return 1===e.length&&e[0]===p},partialMatch:function(t){return 0===t.length?null:t[0]===p?t.slice(1):null}}}module.exports={DNS:n,DNS4:r,DNS6:p,DNSADDR:e,IP:c,TCP:i,UDP:u,QUIC:a,UTP:s,HTTP:h,HTTPS:d,WebSockets:o,WebSocketsSecure:l,WebSocketStar:b,WebRTCStar:f,WebRTCDirect:w,Reliable:S,Stardust:g,Circuit:D,P2P:T,IPFS:T};
|
||
},{"multiaddr":"FEl+"}],"l3hw":[function(require,module,exports) {
|
||
"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function o(t,e,o){return e&&r(t.prototype,e),o&&r(t,o),t}function n(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&i(t,e)}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function u(t){var e=a();return function(){var r,o=l(t);if(e){var n=l(this).constructor;r=Reflect.construct(o,arguments,n)}else r=o.apply(this,arguments);return s(this,r)}}function s(e,r){return!r||"object"!==t(r)&&"function"!=typeof r?c(e):r}function c(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function a(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var f=require("peer-id"),p=require("multiaddr"),y=p.Multiaddr,d=require("mafmt"),v=require("events"),b=v.EventEmitter,h=require("debug"),m=Object.assign(h("libp2p:bootstrap"),{error:h("libp2p:bootstrap:error")}),_=function(t){n(i,b);var r=u(i);function i(){var t,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{list:[]};if(e(this,i),!o.list||!o.list.length)throw new Error("Bootstrap requires a list of peer addresses");return(t=r.call(this))._list=o.list,t._interval=o.interval||1e4,t._timer=null,t}return o(i,[{key:"start",value:function(){var t=this;this._timer||(this._timer=setInterval(function(){return t._discoverBootstrapPeers()},this._interval),m("Starting bootstrap node discovery"),this._discoverBootstrapPeers())}},{key:"_discoverBootstrapPeers",value:function(){var t=this;this._timer&&this._list.forEach(function(e){if(!d.P2P.matches(e))return m.error("Invalid multiaddr");var r=new y(e),o=r.getPeerId();if(o){var n=f.createFromB58String(o);try{t.emit("peer",{id:n,multiaddrs:[r]})}catch(i){m.error("Invalid bootstrap peer id",i)}}else m.error("Invalid bootstrap multiaddr without peer id")})}},{key:"stop",value:function(){this._timer&&clearInterval(this._timer),this._timer=null}}]),i}();exports=module.exports=_,exports.tag="bootstrap";
|
||
},{"peer-id":"xW92","multiaddr":"FEl+","mafmt":"5PQS","events":"wIHY","debug":"j+D9"}],"S9qh":[function(require,module,exports) {
|
||
"use strict";function e(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function t(e,t,n,r,o,i,c){try{var u=e[i](c),a=u.value}catch(p){return void n(p)}u.done?t(a):Promise.resolve(a).then(r,o)}function n(e){return function(){var n=this,r=arguments;return new Promise(function(o,i){var c=e.apply(n,r);function u(e){t(c,o,i,u,a,"next",e)}function a(e){t(c,o,i,u,a,"throw",e)}u(void 0)})}}require("babel-polyfill");var r=require("libp2p"),o=require("libp2p-webrtc-direct"),i=require("libp2p-mplex"),c=require("libp2p-noise"),u=c.NOISE,a=require("libp2p-bootstrap");document.addEventListener("DOMContentLoaded",n(regeneratorRuntime.mark(function t(){var n,c,p,s;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return s=function(e){console.info(e),p.textContent+="".concat(e.trim(),"\n")},"12D3KooWCuo3MdXfMgaqpLC5Houi1TRoFqgK9aoxok4NK5udMu8m",t.next=4,r.create({modules:{transport:[o],streamMuxer:[i],connEncryption:[u],peerDiscovery:[a]},config:{peerDiscovery:e({},a.tag,{enabled:!0,list:["/ip4/127.0.0.1/tcp/9090/http/p2p-webrtc-direct/p2p/".concat("12D3KooWCuo3MdXfMgaqpLC5Houi1TRoFqgK9aoxok4NK5udMu8m")]})}});case 4:return n=t.sent,c=document.getElementById("status"),(p=document.getElementById("output")).textContent="",n.on("peer:discovery",function(e){s("Found peer ".concat(e.toB58String()))}),n.connectionManager.on("peer:connect",function(e){s("Connected to ".concat(e.remotePeer.toB58String()))}),n.connectionManager.on("peer:disconnect",function(e){s("Disconnected from ".concat(e.remotePeer.toB58String()))}),t.next=13,n.start();case 13:c.innerText="libp2p started!",s("libp2p id is ".concat(n.peerId.toB58String()));case 15:case"end":return t.stop()}},t)})));
|
||
},{"babel-polyfill":"JIy0","libp2p":"6NlG","libp2p-webrtc-direct":"w0hI","libp2p-mplex":"Z6gr","libp2p-noise":"Ta4N","libp2p-bootstrap":"l3hw"}]},{},["S9qh"], null)
|
||
//# sourceMappingURL=/dialer.58c9dcfc.js.map |