nodejs-order-book
Version:
Node.js Lmit Order Book for high-frequency trading (HFT).
2 lines • 650 kB
JavaScript
/*! For license information please see index.js.LICENSE.txt */
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.exampleTypescriptPackage=e():t.exampleTypescriptPackage=e()}(this,(()=>(()=>{var __webpack_modules__={7568:(t,e,i)=>{var r=e;r.bignum=i(2344),r.define=i(7363).define,r.base=i(9673),r.constants=i(2153),r.decoders=i(2853),r.encoders=i(4669)},7363:(t,e,i)=>{var r=i(7568),n=i(6698);function o(t,e){this.name=t,this.body=e,this.decoders={},this.encoders={}}e.define=function(t,e){return new o(t,e)},o.prototype._createNamed=function(t){var e;try{e=i(8961).runInThisContext("(function "+this.name+"(entity) {\n this._initNamed(entity);\n})")}catch(t){e=function(t){this._initNamed(t)}}return n(e,t),e.prototype._initNamed=function(e){t.call(this,e)},new e(this)},o.prototype._getDecoder=function(t){return t=t||"der",this.decoders.hasOwnProperty(t)||(this.decoders[t]=this._createNamed(r.decoders[t])),this.decoders[t]},o.prototype.decode=function(t,e,i){return this._getDecoder(e).decode(t,i)},o.prototype._getEncoder=function(t){return t=t||"der",this.encoders.hasOwnProperty(t)||(this.encoders[t]=this._createNamed(r.encoders[t])),this.encoders[t]},o.prototype.encode=function(t,e,i){return this._getEncoder(e).encode(t,i)}},7227:(t,e,i)=>{var r=i(6698),n=i(9673).Reporter,o=i(8287).Buffer;function s(t,e){n.call(this,e),o.isBuffer(t)?(this.base=t,this.offset=0,this.length=t.length):this.error("Input not Buffer")}function h(t,e){if(Array.isArray(t))this.length=0,this.value=t.map((function(t){return t instanceof h||(t=new h(t,e)),this.length+=t.length,t}),this);else if("number"==typeof t){if(!(0<=t&&t<=255))return e.error("non-byte EncoderBuffer value");this.value=t,this.length=1}else if("string"==typeof t)this.value=t,this.length=o.byteLength(t);else{if(!o.isBuffer(t))return e.error("Unsupported type: "+typeof t);this.value=t,this.length=t.length}}r(s,n),e.t=s,s.prototype.save=function(){return{offset:this.offset,reporter:n.prototype.save.call(this)}},s.prototype.restore=function(t){var e=new s(this.base);return e.offset=t.offset,e.length=this.offset,this.offset=t.offset,n.prototype.restore.call(this,t.reporter),e},s.prototype.isEmpty=function(){return this.offset===this.length},s.prototype.readUInt8=function(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},s.prototype.skip=function(t,e){if(!(this.offset+t<=this.length))return this.error(e||"DecoderBuffer overrun");var i=new s(this.base);return i._reporterState=this._reporterState,i.offset=this.offset,i.length=this.offset+t,this.offset+=t,i},s.prototype.raw=function(t){return this.base.slice(t?t.offset:this.offset,this.length)},e.d=h,h.prototype.join=function(t,e){return t||(t=new o(this.length)),e||(e=0),0===this.length||(Array.isArray(this.value)?this.value.forEach((function(i){i.join(t,e),e+=i.length})):("number"==typeof this.value?t[e]=this.value:"string"==typeof this.value?t.write(this.value,e):o.isBuffer(this.value)&&this.value.copy(t,e),e+=this.length)),t}},9673:(t,e,i)=>{var r=e;r.Reporter=i(9220).a,r.DecoderBuffer=i(7227).t,r.EncoderBuffer=i(7227).d,r.Node=i(993)},993:(t,e,i)=>{var r=i(9673).Reporter,n=i(9673).EncoderBuffer,o=i(9673).DecoderBuffer,s=i(3349),h=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],a=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(h);function u(t,e){var i={};this._baseState=i,i.enc=t,i.parent=e||null,i.children=null,i.tag=null,i.args=null,i.reverseArgs=null,i.choice=null,i.optional=!1,i.any=!1,i.obj=!1,i.use=null,i.useDecoder=null,i.key=null,i.default=null,i.explicit=null,i.implicit=null,i.contains=null,i.parent||(i.children=[],this._wrap())}t.exports=u;var f=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];u.prototype.clone=function(){var t=this._baseState,e={};f.forEach((function(i){e[i]=t[i]}));var i=new this.constructor(e.parent);return i._baseState=e,i},u.prototype._wrap=function(){var t=this._baseState;a.forEach((function(e){this[e]=function(){var i=new this.constructor(this);return t.children.push(i),i[e].apply(i,arguments)}}),this)},u.prototype._init=function(t){var e=this._baseState;s(null===e.parent),t.call(this),e.children=e.children.filter((function(t){return t._baseState.parent===this}),this),s.equal(e.children.length,1,"Root node can have only one child")},u.prototype._useArgs=function(t){var e=this._baseState,i=t.filter((function(t){return t instanceof this.constructor}),this);t=t.filter((function(t){return!(t instanceof this.constructor)}),this),0!==i.length&&(s(null===e.children),e.children=i,i.forEach((function(t){t._baseState.parent=this}),this)),0!==t.length&&(s(null===e.args),e.args=t,e.reverseArgs=t.map((function(t){if("object"!=typeof t||t.constructor!==Object)return t;var e={};return Object.keys(t).forEach((function(i){i==(0|i)&&(i|=0);var r=t[i];e[r]=i})),e})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(t){u.prototype[t]=function(){var e=this._baseState;throw new Error(t+" not implemented for encoding: "+e.enc)}})),h.forEach((function(t){u.prototype[t]=function(){var e=this._baseState,i=Array.prototype.slice.call(arguments);return s(null===e.tag),e.tag=t,this._useArgs(i),this}})),u.prototype.use=function(t){s(t);var e=this._baseState;return s(null===e.use),e.use=t,this},u.prototype.optional=function(){return this._baseState.optional=!0,this},u.prototype.def=function(t){var e=this._baseState;return s(null===e.default),e.default=t,e.optional=!0,this},u.prototype.explicit=function(t){var e=this._baseState;return s(null===e.explicit&&null===e.implicit),e.explicit=t,this},u.prototype.implicit=function(t){var e=this._baseState;return s(null===e.explicit&&null===e.implicit),e.implicit=t,this},u.prototype.obj=function(){var t=this._baseState,e=Array.prototype.slice.call(arguments);return t.obj=!0,0!==e.length&&this._useArgs(e),this},u.prototype.key=function(t){var e=this._baseState;return s(null===e.key),e.key=t,this},u.prototype.any=function(){return this._baseState.any=!0,this},u.prototype.choice=function(t){var e=this._baseState;return s(null===e.choice),e.choice=t,this._useArgs(Object.keys(t).map((function(e){return t[e]}))),this},u.prototype.contains=function(t){var e=this._baseState;return s(null===e.use),e.contains=t,this},u.prototype._decode=function(t,e){var i=this._baseState;if(null===i.parent)return t.wrapResult(i.children[0]._decode(t,e));var r,n=i.default,s=!0,h=null;if(null!==i.key&&(h=t.enterKey(i.key)),i.optional){var a=null;if(null!==i.explicit?a=i.explicit:null!==i.implicit?a=i.implicit:null!==i.tag&&(a=i.tag),null!==a||i.any){if(s=this._peekTag(t,a,i.any),t.isError(s))return s}else{var u=t.save();try{null===i.choice?this._decodeGeneric(i.tag,t,e):this._decodeChoice(t,e),s=!0}catch(t){s=!1}t.restore(u)}}if(i.obj&&s&&(r=t.enterObject()),s){if(null!==i.explicit){var f=this._decodeTag(t,i.explicit);if(t.isError(f))return f;t=f}var l=t.offset;if(null===i.use&&null===i.choice){i.any&&(u=t.save());var d=this._decodeTag(t,null!==i.implicit?i.implicit:i.tag,i.any);if(t.isError(d))return d;i.any?n=t.raw(u):t=d}if(e&&e.track&&null!==i.tag&&e.track(t.path(),l,t.length,"tagged"),e&&e.track&&null!==i.tag&&e.track(t.path(),t.offset,t.length,"content"),i.any||(n=null===i.choice?this._decodeGeneric(i.tag,t,e):this._decodeChoice(t,e)),t.isError(n))return n;if(i.any||null!==i.choice||null===i.children||i.children.forEach((function(i){i._decode(t,e)})),i.contains&&("octstr"===i.tag||"bitstr"===i.tag)){var c=new o(n);n=this._getUse(i.contains,t._reporterState.obj)._decode(c,e)}}return i.obj&&s&&(n=t.leaveObject(r)),null===i.key||null===n&&!0!==s?null!==h&&t.exitKey(h):t.leaveKey(h,i.key,n),n},u.prototype._decodeGeneric=function(t,e,i){var r=this._baseState;return"seq"===t||"set"===t?null:"seqof"===t||"setof"===t?this._decodeList(e,t,r.args[0],i):/str$/.test(t)?this._decodeStr(e,t,i):"objid"===t&&r.args?this._decodeObjid(e,r.args[0],r.args[1],i):"objid"===t?this._decodeObjid(e,null,null,i):"gentime"===t||"utctime"===t?this._decodeTime(e,t,i):"null_"===t?this._decodeNull(e,i):"bool"===t?this._decodeBool(e,i):"objDesc"===t?this._decodeStr(e,t,i):"int"===t||"enum"===t?this._decodeInt(e,r.args&&r.args[0],i):null!==r.use?this._getUse(r.use,e._reporterState.obj)._decode(e,i):e.error("unknown tag: "+t)},u.prototype._getUse=function(t,e){var i=this._baseState;return i.useDecoder=this._use(t,e),s(null===i.useDecoder._baseState.parent),i.useDecoder=i.useDecoder._baseState.children[0],i.implicit!==i.useDecoder._baseState.implicit&&(i.useDecoder=i.useDecoder.clone(),i.useDecoder._baseState.implicit=i.implicit),i.useDecoder},u.prototype._decodeChoice=function(t,e){var i=this._baseState,r=null,n=!1;return Object.keys(i.choice).some((function(o){var s=t.save(),h=i.choice[o];try{var a=h._decode(t,e);if(t.isError(a))return!1;r={type:o,value:a},n=!0}catch(e){return t.restore(s),!1}return!0}),this),n?r:t.error("Choice not matched")},u.prototype._createEncoderBuffer=function(t){return new n(t,this.reporter)},u.prototype._encode=function(t,e,i){var r=this._baseState;if(null===r.default||r.default!==t){var n=this._encodeValue(t,e,i);if(void 0!==n&&!this._skipDefault(n,e,i))return n}},u.prototype._encodeValue=function(t,e,i){var n=this._baseState;if(null===n.parent)return n.children[0]._encode(t,e||new r);var o=null;if(this.reporter=e,n.optional&&void 0===t){if(null===n.default)return;t=n.default}var s=null,h=!1;if(n.any)o=this._createEncoderBuffer(t);else if(n.choice)o=this._encodeChoice(t,e);else if(n.contains)s=this._getUse(n.contains,i)._encode(t,e),h=!0;else if(n.children)s=n.children.map((function(i){if("null_"===i._baseState.tag)return i._encode(null,e,t);if(null===i._baseState.key)return e.error("Child should have a key");var r=e.enterKey(i._baseState.key);if("object"!=typeof t)return e.error("Child expected, but input is not object");var n=i._encode(t[i._baseState.key],e,t);return e.leaveKey(r),n}),this).filter((function(t){return t})),s=this._createEncoderBuffer(s);else if("seqof"===n.tag||"setof"===n.tag){if(!n.args||1!==n.args.length)return e.error("Too many args for : "+n.tag);if(!Array.isArray(t))return e.error("seqof/setof, but data is not Array");var a=this.clone();a._baseState.implicit=null,s=this._createEncoderBuffer(t.map((function(i){var r=this._baseState;return this._getUse(r.args[0],t)._encode(i,e)}),a))}else null!==n.use?o=this._getUse(n.use,i)._encode(t,e):(s=this._encodePrimitive(n.tag,t),h=!0);if(!n.any&&null===n.choice){var u=null!==n.implicit?n.implicit:n.tag,f=null===n.implicit?"universal":"context";null===u?null===n.use&&e.error("Tag could be omitted only for .use()"):null===n.use&&(o=this._encodeComposite(u,h,f,s))}return null!==n.explicit&&(o=this._encodeComposite(n.explicit,!1,"context",o)),o},u.prototype._encodeChoice=function(t,e){var i=this._baseState,r=i.choice[t.type];return r||s(!1,t.type+" not found in "+JSON.stringify(Object.keys(i.choice))),r._encode(t.value,e)},u.prototype._encodePrimitive=function(t,e){var i=this._baseState;if(/str$/.test(t))return this._encodeStr(e,t);if("objid"===t&&i.args)return this._encodeObjid(e,i.reverseArgs[0],i.args[1]);if("objid"===t)return this._encodeObjid(e,null,null);if("gentime"===t||"utctime"===t)return this._encodeTime(e,t);if("null_"===t)return this._encodeNull();if("int"===t||"enum"===t)return this._encodeInt(e,i.args&&i.reverseArgs[0]);if("bool"===t)return this._encodeBool(e);if("objDesc"===t)return this._encodeStr(e,t);throw new Error("Unsupported tag: "+t)},u.prototype._isNumstr=function(t){return/^[0-9 ]*$/.test(t)},u.prototype._isPrintstr=function(t){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(t)}},9220:(t,e,i)=>{var r=i(6698);function n(t){this._reporterState={obj:null,path:[],options:t||{},errors:[]}}function o(t,e){this.path=t,this.rethrow(e)}e.a=n,n.prototype.isError=function(t){return t instanceof o},n.prototype.save=function(){var t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}},n.prototype.restore=function(t){var e=this._reporterState;e.obj=t.obj,e.path=e.path.slice(0,t.pathLen)},n.prototype.enterKey=function(t){return this._reporterState.path.push(t)},n.prototype.exitKey=function(t){var e=this._reporterState;e.path=e.path.slice(0,t-1)},n.prototype.leaveKey=function(t,e,i){var r=this._reporterState;this.exitKey(t),null!==r.obj&&(r.obj[e]=i)},n.prototype.path=function(){return this._reporterState.path.join("/")},n.prototype.enterObject=function(){var t=this._reporterState,e=t.obj;return t.obj={},e},n.prototype.leaveObject=function(t){var e=this._reporterState,i=e.obj;return e.obj=t,i},n.prototype.error=function(t){var e,i=this._reporterState,r=t instanceof o;if(e=r?t:new o(i.path.map((function(t){return"["+JSON.stringify(t)+"]"})).join(""),t.message||t,t.stack),!i.options.partial)throw e;return r||i.errors.push(e),e},n.prototype.wrapResult=function(t){var e=this._reporterState;return e.options.partial?{result:this.isError(t)?null:t,errors:e.errors}:t},r(o,Error),o.prototype.rethrow=function(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,o),!this.stack)try{throw new Error(this.message)}catch(t){this.stack=t.stack}return this}},4598:(t,e,i)=>{var r=i(2153);e.tagClass={0:"universal",1:"application",2:"context",3:"private"},e.tagClassByName=r._reverse(e.tagClass),e.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},e.tagByName=r._reverse(e.tag)},2153:(t,e,i)=>{var r=e;r._reverse=function(t){var e={};return Object.keys(t).forEach((function(i){(0|i)==i&&(i|=0);var r=t[i];e[r]=i})),e},r.der=i(4598)},2010:(t,e,i)=>{var r=i(6698),n=i(7568),o=n.base,s=n.bignum,h=n.constants.der;function a(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new u,this.tree._init(t.body)}function u(t){o.Node.call(this,"der",t)}function f(t,e){var i=t.readUInt8(e);if(t.isError(i))return i;var r=h.tagClass[i>>6],n=!(32&i);if(31&~i)i&=31;else{var o=i;for(i=0;!(128&~o);){if(o=t.readUInt8(e),t.isError(o))return o;i<<=7,i|=127&o}}return{cls:r,primitive:n,tag:i,tagStr:h.tag[i]}}function l(t,e,i){var r=t.readUInt8(i);if(t.isError(r))return r;if(!e&&128===r)return null;if(!(128&r))return r;var n=127&r;if(n>4)return t.error("length octect is too long");r=0;for(var o=0;o<n;o++){r<<=8;var s=t.readUInt8(i);if(t.isError(s))return s;r|=s}return r}t.exports=a,a.prototype.decode=function(t,e){return t instanceof o.DecoderBuffer||(t=new o.DecoderBuffer(t,e)),this.tree._decode(t,e)},r(u,o.Node),u.prototype._peekTag=function(t,e,i){if(t.isEmpty())return!1;var r=t.save(),n=f(t,'Failed to peek tag: "'+e+'"');return t.isError(n)?n:(t.restore(r),n.tag===e||n.tagStr===e||n.tagStr+"of"===e||i)},u.prototype._decodeTag=function(t,e,i){var r=f(t,'Failed to decode tag of "'+e+'"');if(t.isError(r))return r;var n=l(t,r.primitive,'Failed to get length of "'+e+'"');if(t.isError(n))return n;if(!i&&r.tag!==e&&r.tagStr!==e&&r.tagStr+"of"!==e)return t.error('Failed to match tag: "'+e+'"');if(r.primitive||null!==n)return t.skip(n,'Failed to match body of: "'+e+'"');var o=t.save(),s=this._skipUntilEnd(t,'Failed to skip indefinite length body: "'+this.tag+'"');return t.isError(s)?s:(n=t.offset-o.offset,t.restore(o),t.skip(n,'Failed to match body of: "'+e+'"'))},u.prototype._skipUntilEnd=function(t,e){for(;;){var i=f(t,e);if(t.isError(i))return i;var r,n=l(t,i.primitive,e);if(t.isError(n))return n;if(r=i.primitive||null!==n?t.skip(n):this._skipUntilEnd(t,e),t.isError(r))return r;if("end"===i.tagStr)break}},u.prototype._decodeList=function(t,e,i,r){for(var n=[];!t.isEmpty();){var o=this._peekTag(t,"end");if(t.isError(o))return o;var s=i.decode(t,"der",r);if(t.isError(s)&&o)break;n.push(s)}return n},u.prototype._decodeStr=function(t,e){if("bitstr"===e){var i=t.readUInt8();return t.isError(i)?i:{unused:i,data:t.raw()}}if("bmpstr"===e){var r=t.raw();if(r.length%2==1)return t.error("Decoding of string type: bmpstr length mismatch");for(var n="",o=0;o<r.length/2;o++)n+=String.fromCharCode(r.readUInt16BE(2*o));return n}if("numstr"===e){var s=t.raw().toString("ascii");return this._isNumstr(s)?s:t.error("Decoding of string type: numstr unsupported characters")}if("octstr"===e)return t.raw();if("objDesc"===e)return t.raw();if("printstr"===e){var h=t.raw().toString("ascii");return this._isPrintstr(h)?h:t.error("Decoding of string type: printstr unsupported characters")}return/str$/.test(e)?t.raw().toString():t.error("Decoding of string type: "+e+" unsupported")},u.prototype._decodeObjid=function(t,e,i){for(var r,n=[],o=0;!t.isEmpty();){var s=t.readUInt8();o<<=7,o|=127&s,128&s||(n.push(o),o=0)}128&s&&n.push(o);var h=n[0]/40|0,a=n[0]%40;if(r=i?n:[h,a].concat(n.slice(1)),e){var u=e[r.join(" ")];void 0===u&&(u=e[r.join(".")]),void 0!==u&&(r=u)}return r},u.prototype._decodeTime=function(t,e){var i=t.raw().toString();if("gentime"===e)var r=0|i.slice(0,4),n=0|i.slice(4,6),o=0|i.slice(6,8),s=0|i.slice(8,10),h=0|i.slice(10,12),a=0|i.slice(12,14);else{if("utctime"!==e)return t.error("Decoding "+e+" time is not supported yet");r=0|i.slice(0,2),n=0|i.slice(2,4),o=0|i.slice(4,6),s=0|i.slice(6,8),h=0|i.slice(8,10),a=0|i.slice(10,12),r=r<70?2e3+r:1900+r}return Date.UTC(r,n-1,o,s,h,a,0)},u.prototype._decodeNull=function(t){return null},u.prototype._decodeBool=function(t){var e=t.readUInt8();return t.isError(e)?e:0!==e},u.prototype._decodeInt=function(t,e){var i=t.raw(),r=new s(i);return e&&(r=e[r.toString(10)]||r),r},u.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getDecoder("der").tree}},2853:(t,e,i)=>{var r=e;r.der=i(2010),r.pem=i(8903)},8903:(t,e,i)=>{var r=i(6698),n=i(8287).Buffer,o=i(2010);function s(t){o.call(this,t),this.enc="pem"}r(s,o),t.exports=s,s.prototype.decode=function(t,e){for(var i=t.toString().split(/[\r\n]+/g),r=e.label.toUpperCase(),s=/^-----(BEGIN|END) ([^-]+)-----$/,h=-1,a=-1,u=0;u<i.length;u++){var f=i[u].match(s);if(null!==f&&f[2]===r){if(-1!==h){if("END"!==f[1])break;a=u;break}if("BEGIN"!==f[1])break;h=u}}if(-1===h||-1===a)throw new Error("PEM section not found for: "+r);var l=i.slice(h+1,a).join("");l.replace(/[^a-z0-9\+\/=]+/gi,"");var d=new n(l,"base64");return o.prototype.decode.call(this,d,e)}},82:(t,e,i)=>{var r=i(6698),n=i(8287).Buffer,o=i(7568),s=o.base,h=o.constants.der;function a(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new u,this.tree._init(t.body)}function u(t){s.Node.call(this,"der",t)}function f(t){return t<10?"0"+t:t}t.exports=a,a.prototype.encode=function(t,e){return this.tree._encode(t,e).join()},r(u,s.Node),u.prototype._encodeComposite=function(t,e,i,r){var o,s=function(t,e,i,r){var n;if("seqof"===t?t="seq":"setof"===t&&(t="set"),h.tagByName.hasOwnProperty(t))n=h.tagByName[t];else{if("number"!=typeof t||(0|t)!==t)return r.error("Unknown tag: "+t);n=t}return n>=31?r.error("Multi-octet tag encoding unsupported"):(e||(n|=32),n|=h.tagClassByName[i||"universal"]<<6)}(t,e,i,this.reporter);if(r.length<128)return(o=new n(2))[0]=s,o[1]=r.length,this._createEncoderBuffer([o,r]);for(var a=1,u=r.length;u>=256;u>>=8)a++;(o=new n(2+a))[0]=s,o[1]=128|a,u=1+a;for(var f=r.length;f>0;u--,f>>=8)o[u]=255&f;return this._createEncoderBuffer([o,r])},u.prototype._encodeStr=function(t,e){if("bitstr"===e)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===e){for(var i=new n(2*t.length),r=0;r<t.length;r++)i.writeUInt16BE(t.charCodeAt(r),2*r);return this._createEncoderBuffer(i)}return"numstr"===e?this._isNumstr(t)?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===e?this._isPrintstr(t)?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(e)||"objDesc"===e?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: "+e+" unsupported")},u.prototype._encodeObjid=function(t,e,i){if("string"==typeof t){if(!e)return this.reporter.error("string objid given, but no values map found");if(!e.hasOwnProperty(t))return this.reporter.error("objid not found in values map");t=e[t].split(/[\s\.]+/g);for(var r=0;r<t.length;r++)t[r]|=0}else if(Array.isArray(t))for(t=t.slice(),r=0;r<t.length;r++)t[r]|=0;if(!Array.isArray(t))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(t));if(!i){if(t[1]>=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}var o=0;for(r=0;r<t.length;r++){var s=t[r];for(o++;s>=128;s>>=7)o++}var h=new n(o),a=h.length-1;for(r=t.length-1;r>=0;r--)for(s=t[r],h[a--]=127&s;(s>>=7)>0;)h[a--]=128|127&s;return this._createEncoderBuffer(h)},u.prototype._encodeTime=function(t,e){var i,r=new Date(t);return"gentime"===e?i=[f(r.getFullYear()),f(r.getUTCMonth()+1),f(r.getUTCDate()),f(r.getUTCHours()),f(r.getUTCMinutes()),f(r.getUTCSeconds()),"Z"].join(""):"utctime"===e?i=[f(r.getFullYear()%100),f(r.getUTCMonth()+1),f(r.getUTCDate()),f(r.getUTCHours()),f(r.getUTCMinutes()),f(r.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+e+" time is not supported yet"),this._encodeStr(i,"octstr")},u.prototype._encodeNull=function(){return this._createEncoderBuffer("")},u.prototype._encodeInt=function(t,e){if("string"==typeof t){if(!e)return this.reporter.error("String int or enum given, but no values map");if(!e.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=e[t]}if("number"!=typeof t&&!n.isBuffer(t)){var i=t.toArray();!t.sign&&128&i[0]&&i.unshift(0),t=new n(i)}if(n.isBuffer(t)){var r=t.length;0===t.length&&r++;var o=new n(r);return t.copy(o),0===t.length&&(o[0]=0),this._createEncoderBuffer(o)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);r=1;for(var s=t;s>=256;s>>=8)r++;for(s=(o=new Array(r)).length-1;s>=0;s--)o[s]=255&t,t>>=8;return 128&o[0]&&o.unshift(0),this._createEncoderBuffer(new n(o))},u.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)},u.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getEncoder("der").tree},u.prototype._skipDefault=function(t,e,i){var r,n=this._baseState;if(null===n.default)return!1;var o=t.join();if(void 0===n.defaultBuffer&&(n.defaultBuffer=this._encodeValue(n.default,e,i).join()),o.length!==n.defaultBuffer.length)return!1;for(r=0;r<o.length;r++)if(o[r]!==n.defaultBuffer[r])return!1;return!0}},4669:(t,e,i)=>{var r=e;r.der=i(82),r.pem=i(735)},735:(t,e,i)=>{var r=i(6698),n=i(82);function o(t){n.call(this,t),this.enc="pem"}r(o,n),t.exports=o,o.prototype.encode=function(t,e){for(var i=n.prototype.encode.call(this,t).toString("base64"),r=["-----BEGIN "+e.label+"-----"],o=0;o<i.length;o+=64)r.push(i.slice(o,o+64));return r.push("-----END "+e.label+"-----"),r.join("\n")}},2344:function(t,e,i){!function(t,e){"use strict";function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var i=function(){};i.prototype=e.prototype,t.prototype=new i,t.prototype.constructor=t}function o(t,e,i){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(i=e,e=10),this._init(t||0,e||10,i||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:i(8982).Buffer}catch(t){}function h(t,e){var i=t.charCodeAt(e);return i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:i-48&15}function a(t,e,i){var r=h(t,i);return i-1>=e&&(r|=h(t,i-1)<<4),r}function u(t,e,i,r){for(var n=0,o=Math.min(t.length,i),s=e;s<o;s++){var h=t.charCodeAt(s)-48;n*=r,n+=h>=49?h-49+10:h>=17?h-17+10:h}return n}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,i){if("number"==typeof t)return this._initNumber(t,e,i);if("object"==typeof t)return this._initArray(t,e,i);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<t.length&&(16===e?this._parseHex(t,n,i):(this._parseBase(t,e,n),"le"===i&&this._initArray(this.toArray(),e,i)))},o.prototype._initNumber=function(t,e,i){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"===i&&this._initArray(this.toArray(),e,i)},o.prototype._initArray=function(t,e,i){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 n=0;n<this.length;n++)this.words[n]=0;var o,s,h=0;if("be"===i)for(n=t.length-1,o=0;n>=0;n-=3)s=t[n]|t[n-1]<<8|t[n-2]<<16,this.words[o]|=s<<h&67108863,this.words[o+1]=s>>>26-h&67108863,(h+=24)>=26&&(h-=26,o++);else if("le"===i)for(n=0,o=0;n<t.length;n+=3)s=t[n]|t[n+1]<<8|t[n+2]<<16,this.words[o]|=s<<h&67108863,this.words[o+1]=s>>>26-h&67108863,(h+=24)>=26&&(h-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e,i){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var n,o=0,s=0;if("be"===i)for(r=t.length-1;r>=e;r-=2)n=a(t,e,r)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r<t.length;r+=2)n=a(t,e,r)<<o,this.words[s]|=67108863&n,o>=18?(o-=18,s+=1,this.words[s]|=n>>>26):o+=8;this.strip()},o.prototype._parseBase=function(t,e,i){this.words=[0],this.length=1;for(var r=0,n=1;n<=67108863;n*=e)r++;r--,n=n/e|0;for(var o=t.length-i,s=o%r,h=Math.min(o,o-s)+i,a=0,f=i;f<h;f+=r)a=u(t,f,f+r,e),this.imuln(n),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a);if(0!==s){var l=1;for(a=u(t,f,t.length,e),f=0;f<s;f++)l*=e;this.imuln(l),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a)}this.strip()},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var f=["","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],d=[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 c(t,e,i){i.negative=e.negative^t.negative;var r=t.length+e.length|0;i.length=r,r=r-1|0;var n=0|t.words[0],o=0|e.words[0],s=n*o,h=67108863&s,a=s/67108864|0;i.words[0]=h;for(var u=1;u<r;u++){for(var f=a>>>26,l=67108863&a,d=Math.min(u,e.length-1),c=Math.max(0,u-t.length+1);c<=d;c++){var p=u-c|0;f+=(s=(n=0|t.words[p])*(o=0|e.words[c])+l)/67108864|0,l=67108863&s}i.words[u]=0|l,a=0|f}return 0!==a?i.words[u]=0|a:i.length--,i.strip()}o.prototype.toString=function(t,e){var i;if(e=0|e||1,16===(t=t||10)||"hex"===t){i="";for(var n=0,o=0,s=0;s<this.length;s++){var h=this.words[s],a=(16777215&(h<<n|o)).toString(16);i=0!=(o=h>>>24-n&16777215)||s!==this.length-1?f[6-a.length]+a+i:a+i,(n+=2)>=26&&(n-=26,s--)}for(0!==o&&(i=o.toString(16)+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(t===(0|t)&&t>=2&&t<=36){var u=l[t],c=d[t];i="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(c).toString(t);i=(p=p.idivn(c)).isZero()?m+i:f[u-m.length]+m+i}for(this.isZero()&&(i="0"+i);i.length%e!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},o.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},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return r(void 0!==s),this.toArrayLike(s,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,i){var n=this.byteLength(),o=i||Math.max(1,n);r(n<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var s,h,a="le"===e,u=new t(o),f=this.clone();if(a){for(h=0;!f.isZero();h++)s=f.andln(255),f.iushrn(8),u[h]=s;for(;h<o;h++)u[h]=0}else{for(h=0;h<o-n;h++)u[h]=0;for(h=0;!f.isZero();h++)s=f.andln(255),f.iushrn(8),u[o-h-1]=s}return u},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,i=0;return e>=4096&&(i+=13,e>>>=13),e>=64&&(i+=7,e>>>=7),e>=8&&(i+=4,e>>>=4),e>=2&&(i+=2,e>>>=2),i+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,i=0;return 8191&e||(i+=13,e>>>=13),127&e||(i+=7,e>>>=7),15&e||(i+=4,e>>>=4),3&e||(i+=2,e>>>=2),1&e||i++,i},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var i=this._zeroBits(this.words[e]);if(t+=i,26!==i)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},o.prototype.ior=function(t){return r(!(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var i=0;i<e.length;i++)this.words[i]=this.words[i]&t.words[i];return this.length=e.length,this.strip()},o.prototype.iand=function(t){return r(!(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,i;this.length>t.length?(e=this,i=t):(e=t,i=this);for(var r=0;r<i.length;r++)this.words[r]=e.words[r]^i.words[r];if(this!==e)for(;r<e.length;r++)this.words[r]=e.words[r];return this.length=e.length,this.strip()},o.prototype.ixor=function(t){return r(!(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),i=t%26;this._expand(e),i>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return i>0&&(this.words[n]=~this.words[n]&67108863>>26-i),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var i=t/26|0,n=t%26;return this._expand(i+1),this.words[i]=e?this.words[i]|1<<n:this.words[i]&~(1<<n),this.strip()},o.prototype.iadd=function(t){var e,i,r;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(i=this,r=t):(i=t,r=this);for(var n=0,o=0;o<r.length;o++)e=(0|i.words[o])+(0|r.words[o])+n,this.words[o]=67108863&e,n=e>>>26;for(;0!==n&&o<i.length;o++)e=(0|i.words[o])+n,this.words[o]=67108863&e,n=e>>>26;if(this.length=i.length,0!==n)this.words[this.length]=n,this.length++;else if(i!==this)for(;o<i.length;o++)this.words[o]=i.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var i,r,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(i=this,r=t):(i=t,r=this);for(var o=0,s=0;s<r.length;s++)o=(e=(0|i.words[s])-(0|r.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<i.length;s++)o=(e=(0|i.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<i.length&&i!==this)for(;s<i.length;s++)this.words[s]=i.words[s];return this.length=Math.max(this.length,s),i!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var p=function(t,e,i){var r,n,o,s=t.words,h=e.words,a=i.words,u=0,f=0|s[0],l=8191&f,d=f>>>13,c=0|s[1],p=8191&c,m=c>>>13,v=0|s[2],g=8191&v,b=v>>>13,y=0|s[3],w=8191&y,M=y>>>13,_=0|s[4],S=8191&_,k=_>>>13,E=0|s[5],A=8191&E,I=E>>>13,R=0|s[6],O=8191&R,x=R>>>13,B=0|s[7],L=8191&B,T=B>>>13,P=0|s[8],N=8191&P,C=P>>>13,j=0|s[9],D=8191&j,q=j>>>13,z=0|h[0],U=8191&z,F=z>>>13,Z=0|h[1],K=8191&Z,V=Z>>>13,H=0|h[2],W=8191&H,Y=H>>>13,J=0|h[3],Q=8191&J,G=J>>>13,X=0|h[4],$=8191&X,tt=X>>>13,et=0|h[5],it=8191&et,rt=et>>>13,nt=0|h[6],ot=8191&nt,st=nt>>>13,ht=0|h[7],at=8191&ht,ut=ht>>>13,ft=0|h[8],lt=8191&ft,dt=ft>>>13,ct=0|h[9],pt=8191&ct,mt=ct>>>13;i.negative=t.negative^e.negative,i.length=19;var vt=(u+(r=Math.imul(l,U))|0)+((8191&(n=(n=Math.imul(l,F))+Math.imul(d,U)|0))<<13)|0;u=((o=Math.imul(d,F))+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(p,U),n=(n=Math.imul(p,F))+Math.imul(m,U)|0,o=Math.imul(m,F);var gt=(u+(r=r+Math.imul(l,K)|0)|0)+((8191&(n=(n=n+Math.imul(l,V)|0)+Math.imul(d,K)|0))<<13)|0;u=((o=o+Math.imul(d,V)|0)+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(g,U),n=(n=Math.imul(g,F))+Math.imul(b,U)|0,o=Math.imul(b,F),r=r+Math.imul(p,K)|0,n=(n=n+Math.imul(p,V)|0)+Math.imul(m,K)|0,o=o+Math.imul(m,V)|0;var bt=(u+(r=r+Math.imul(l,W)|0)|0)+((8191&(n=(n=n+Math.imul(l,Y)|0)+Math.imul(d,W)|0))<<13)|0;u=((o=o+Math.imul(d,Y)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(w,U),n=(n=Math.imul(w,F))+Math.imul(M,U)|0,o=Math.imul(M,F),r=r+Math.imul(g,K)|0,n=(n=n+Math.imul(g,V)|0)+Math.imul(b,K)|0,o=o+Math.imul(b,V)|0,r=r+Math.imul(p,W)|0,n=(n=n+Math.imul(p,Y)|0)+Math.imul(m,W)|0,o=o+Math.imul(m,Y)|0;var yt=(u+(r=r+Math.imul(l,Q)|0)|0)+((8191&(n=(n=n+Math.imul(l,G)|0)+Math.imul(d,Q)|0))<<13)|0;u=((o=o+Math.imul(d,G)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(S,U),n=(n=Math.imul(S,F))+Math.imul(k,U)|0,o=Math.imul(k,F),r=r+Math.imul(w,K)|0,n=(n=n+Math.imul(w,V)|0)+Math.imul(M,K)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(g,W)|0,n=(n=n+Math.imul(g,Y)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,Y)|0,r=r+Math.imul(p,Q)|0,n=(n=n+Math.imul(p,G)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,G)|0;var wt=(u+(r=r+Math.imul(l,$)|0)|0)+((8191&(n=(n=n+Math.imul(l,tt)|0)+Math.imul(d,$)|0))<<13)|0;u=((o=o+Math.imul(d,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(A,U),n=(n=Math.imul(A,F))+Math.imul(I,U)|0,o=Math.imul(I,F),r=r+Math.imul(S,K)|0,n=(n=n+Math.imul(S,V)|0)+Math.imul(k,K)|0,o=o+Math.imul(k,V)|0,r=r+Math.imul(w,W)|0,n=(n=n+Math.imul(w,Y)|0)+Math.imul(M,W)|0,o=o+Math.imul(M,Y)|0,r=r+Math.imul(g,Q)|0,n=(n=n+Math.imul(g,G)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,G)|0,r=r+Math.imul(p,$)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,tt)|0;var Mt=(u+(r=r+Math.imul(l,it)|0)|0)+((8191&(n=(n=n+Math.imul(l,rt)|0)+Math.imul(d,it)|0))<<13)|0;u=((o=o+Math.imul(d,rt)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(O,U),n=(n=Math.imul(O,F))+Math.imul(x,U)|0,o=Math.imul(x,F),r=r+Math.imul(A,K)|0,n=(n=n+Math.imul(A,V)|0)+Math.imul(I,K)|0,o=o+Math.imul(I,V)|0,r=r+Math.imul(S,W)|0,n=(n=n+Math.imul(S,Y)|0)+Math.imul(k,W)|0,o=o+Math.imul(k,Y)|0,r=r+Math.imul(w,Q)|0,n=(n=n+Math.imul(w,G)|0)+Math.imul(M,Q)|0,o=o+Math.imul(M,G)|0,r=r+Math.imul(g,$)|0,n=(n=n+Math.imul(g,tt)|0)+Math.imul(b,$)|0,o=o+Math.imul(b,tt)|0,r=r+Math.imul(p,it)|0,n=(n=n+Math.imul(p,rt)|0)+Math.imul(m,it)|0,o=o+Math.imul(m,rt)|0;var _t=(u+(r=r+Math.imul(l,ot)|0)|0)+((8191&(n=(n=n+Math.imul(l,st)|0)+Math.imul(d,ot)|0))<<13)|0;u=((o=o+Math.imul(d,st)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,r=Math.imul(L,U),n=(n=Math.imul(L,F))+Math.imul(T,U)|0,o=Math.imul(T,F),r=r+Math.imul(O,K)|0,n=(n=n+Math.imul(O,V)|0)+Math.imul(x,K)|0,o=o+Math.imul(x,V)|0,r=r+Math.imul(A,W)|0,n=(n=n+Math.imul(A,Y)|0)+Math.imul(I,W)|0,o=o+Math.imul(I,Y)|0,r=r+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,G)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,G)|0,r=r+Math.imul(w,$)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,r=r+Math.imul(g,it)|0,n=(n=n+Math.imul(g,rt)|0)+Math.imul(b,it)|0,o=o+Math.imul(b,rt)|0,r=r+Math.imul(p,ot)|0,n=(n=n+Math.imul(p,st)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,st)|0;var St=(u+(r=r+Math.imul(l,at)|0)|0)+((8191&(n=(n=n+Math.imul(l,ut)|0)+Math.imul(d,at)|0))<<13)|0;u=((o=o+Math.imul(d,ut)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(N,U),n=(n=Math.imul(N,F))+Math.imul(C,U)|0,o=Math.imul(C,F),r=r+Math.imul(L,K)|0,n=(n=n+Math.imul(L,V)|0)+Math.imul(T,K)|0,o=o+Math.imul(T,V)|0,r=r+Math.imul(O,W)|0,n=(n=n+Math.imul(O,Y)|0)+Math.imul(x,W)|0,o=o+Math.imul(x,Y)|0,r=r+Math.imul(A,Q)|0,n=(n=n+Math.imul(A,G)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,G)|0,r=r+Math.imul(S,$)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(k,$)|0,o=o+Math.imul(k,tt)|0,r=r+Math.imul(w,it)|0,n=(n=n+Math.imul(w,rt)|0)+Math.imul(M,it)|0,o=o+Math.imul(M,rt)|0,r=r+Math.imul(g,ot)|0,n=(n=n+Math.imul(g,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,r=r+Math.imul(p,at)|0,n=(n=n+Math.imul(p,ut)|0)+Math.imul(m,at)|0,o=o+Math.imul(m,ut)|0;var kt=(u+(r=r+Math.imul(l,lt)|0)|0)+((8191&(n=(n=n+Math.imul(l,dt)|0)+Math.imul(d,lt)|0))<<13)|0;u=((o=o+Math.imul(d,dt)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(D,U),n=(n=Math.imul(D,F))+Math.imul(q,U)|0,o=Math.imul(q,F),r=r+Math.imul(N,K)|0,n=(n=n+Math.imul(N,V)|0)+Math.imul(C,K)|0,o=o+Math.imul(C,V)|0,r=r+Math.imul(L,W)|0,n=(n=n+Math.imul(L,Y)|0)+Math.imul(T,W)|0,o=o+Math.imul(T,Y)|0,r=r+Math.imul(O,Q)|0,n=(n=n+Math.imul(O,G)|0)+Math.imul(x,Q)|0,o=o+Math.imul(x,G)|0,r=r+Math.imul(A,$)|0,n=(n=n+Math.imul(A,tt)|0)+Math.imul(I,$)|0,o=o+Math.imul(I,tt)|0,r=r+Math.imul(S,it)|0,n=(n=n+Math.imul(S,rt)|0)+Math.imul(k,it)|0,o=o+Math.imul(k,rt)|0,r=r+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,st)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,st)|0,r=r+Math.imul(g,at)|0,n=(n=n+Math.imul(g,ut)|0)+Math.imul(b,at)|0,o=o+Math.imul(b,ut)|0,r=r+Math.imul(p,lt)|0,n=(n=n+Math.imul(p,dt)|0)+Math.imul(m,lt)|0,o=o+Math.imul(m,dt)|0;var Et=(u+(r=r+Math.imul(l,pt)|0)|0)+((8191&(n=(n=n+Math.imul(l,mt)|0)+Math.imul(d,pt)|0))<<13)|0;u=((o=o+Math.imul(d,mt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(D,K),n=(n=Math.imul(D,V))+Math.imul(q,K)|0,o=Math.imul(q,V),r=r+Math.imul(N,W)|0,n=(n=n+Math.imul(N,Y)|0)+Math.imul(C,W)|0,o=o+Math.imul(C,Y)|0,r=r+Math.imul(L,Q)|0,n=(n=n+Math.imul(L,G)|0)+Math.imul(T,Q)|0,o=o+Math.imul(T,G)|0,r=r+Math.imul(O,$)|0,n=(n=n+Math.imul(O,tt)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,tt)|0,r=r+Math.imul(A,it)|0,n=(n=n+Math.imul(A,rt)|0)+Math.imul(I,it)|0,o=o+Math.imul(I,rt)|0,r=r+Math.imul(S,ot)|0,n=(n=n+Math.imul(S,st)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,st)|0,r=r+Math.imul(w,at)|0,n=(n=n+Math.imul(w,ut)|0)+Math.imul(M,at)|0,o=o+Math.imul(M,ut)|0,r=r+Math.imul(g,lt)|0,n=(n=n+Math.imul(g,dt)|0)+Math.imul(b,lt)|0,o=o+Math.imul(b,dt)|0;var At=(u+(r=r+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;u=((o=o+Math.imul(m,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(D,W),n=(n=Math.imul(D,Y))+Math.imul(q,W)|0,o=Math.imul(q,Y),r=r+Math.imul(N,Q)|0,n=(n=n+Math.imul(N,G)|0)+Math.imul(C,Q)|0,o=o+Math.imul(C,G)|0,r=r+Math.imul(L,$)|0,n=(n=n+Math.imul(L,tt)|0)+Math.imul(T,$)|0,o=o+Math.imul(T,tt)|0,r=r+Math.imul(O,it)|0,n=(n=n+Math.imul(O,rt)|0)+Math.imul(x,it)|0,o=o+Math.imul(x,rt)|0,r=r+Math.imul(A,ot)|0,n=(n=n+Math.imul(A,st)|0)+Math.imul(I,ot)|0,o=o+Math.imul(I,st)|0,r=r+Math.imul(S,at)|0,n=(n=n+Math.imul(S,ut)|0)+Math.imul(k,at)|0,o=o+Math.imul(k,ut)|0,r=r+Math.imul(w,lt)|0,n=(n=n+Math.imul(w,dt)|0)+Math.imul(M,lt)|0,o=o+Math.imul(M,dt)|0;var It=(u+(r=r+Math.imul(g,pt)|0)|0)+((8191&(n=(n=n+Math.imul(g,mt)|0)+Math.imul(b,pt)|0))<<13)|0;u=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(D,Q),n=(n=Math.imul(D,G))+Math.imul(q,Q)|0,o=Math.imul(q,G),r=r+Math.imul(N,$)|0,n=(n=n+Math.imul(N,tt)|0)+Math.imul(C,$)|0,o=o+Math.imul(C,tt)|0,r=r+Math.imul(L,it)|0,n=(n=n+Math.imul(L,rt)|0)+Math.imul(T,it)|0,o=o+Math.imul(T,rt)|0,r=r+Math.imul(O,ot)|0,n=(n=n+Math.imul(O,st)|0)+Math.imul(x,ot)|0,o=o+Math.imul(x,st)|0,r=r+Math.imul(A,at)|0,n=(n=n+Math.imul(A,ut)|0)+Math.imul(I,at)|0,o=o+Math.imul(I,ut)|0,r=r+Math.imul(S,lt)|0,n=(n=n+Math.imul(S,dt)|0)+Math.imul(k,lt)|0,o=o+Math.imul(k,dt)|0;var Rt=(u+(r=r+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(M,pt)|0))<<13)|0;u=((o=o+Math.imul(M,mt)|0)+(n>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,r=Math.imul(D,$),n=(n=Math.imul(D,tt))+Math.imul(q,$)|0,o=Math.imul(q,tt),r=r+Math.imul(N,it)|0,n=(n=n+Math.imul(N,rt)|0)+Math.imul(C,it)|0,o=o+Math.imul(C,rt)|0,r=r+Math.imul(L,ot)|0,n=(n=n+Math.imul(L,st)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,st)|0,r=r+Math.imul(O,at)|0,n=(n=n+Math.imul(O,ut)|0)+Math.imul(x,at)|0,o=o+Math.imul(x,ut)|0,r=r+Math.imul(A,lt)|0,n=(n=n+Math.imul(A,dt)|0)+Math.imul(I,lt)|0,o=o+Math.imul(I,dt)|0;var Ot=(u+(r=r+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,mt)|0)+Math.imul(k,pt)|0))<<13)|0;u=((o=o+Math.imul(k,mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,r=Math.imul(D,it),n=(n=Math.imul(D,rt))+Math.imul(q,it)|0,o=Math.imul(q,rt),r=r+Math.imul(N,ot)|0,n=(n=n+Math.imul(N,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,r=r+Math.imul(L,at)|0,n=(n=n+Math.imul(L,ut)|0)+Math.imul(T,at)|0,o=o+Math.imul(T,ut)|0,r=r+Math.imul(O,lt)|0,n=(n=n+Math.imul(O,dt)|0)+Math.imul(x,lt)|0,o=o+Math.imul(x,dt)|0;var xt=(u+(r=r+Math.imul(A,pt)|0)|0)+((8191&(n=(n=n+Math.imul(A,mt)|0)+Math.imul(I,pt)|0))<<13)|0;u=((o=o+Math.imul(I,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(D,ot),n=(n=Math.imul(D,st))+Math.imul(q,ot)|0,o=Math.imul(q,st),r=r+Math.imul(N,at)|0,n=(n=n+Math.imul(N,ut)|0)+Math.imul(C,at)|0,o=o+Math.imul(C,ut)|0,r=r+Math.imul(L,lt)|0,n=(n=n+Math.imul(L,dt)|0)+Math.imul(T,lt)|0,o=o+Math.imul(T,dt)|0;var Bt=(u+(r=r+Math.imul(O,pt)|0)|0)+((8191&(n=(n=n+Math.imul(O,mt)|0)+Math.imul(x,pt)|0))<<13)|0;u=((o=o+Math.imul(x,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,r=Math.imul(D,at),n=(n=Math.imul(D,ut))+Math.imul(q,at)|0,o=Math.imul(q,ut),r=r+Math.imul(N,lt)|0,n=(n=n+Math.imul(N,dt)|0)+Math.imul(C,lt)|0,o=o+Math.imul(C,dt)|0;var Lt=(u+(r=r+Math.imul(L,pt)|0)|0)+((8191&(n=(n=n+Math.imul(L,mt)|0)+Math.imul(T,pt)|0))<<13)|0;u=((o=o+Math.imul(T,mt)|0)+(n>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(D,lt),n=(n=Math.imul(D,dt))+Math.imul(q,lt)|0,o=Math.imul(q,dt);var Tt=(u+(r=r+Math.imul(N,pt)|0)|0)+((8191&(n=(n=n+Math.imul(N,mt)|0)+Math.imul(C,pt)|0))<<13)|0;u=((o=o+Math.imul(C,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863;var Pt=(u+(r=Math.imul(D,pt))|0)+((8191&(n=(n=Math.imul(D,mt))+Math.imul(q,pt)|0))<<13)|0;return u=((o=Math.imul(q,mt))+(n>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,a[0]=vt,a[1]=gt,a[2]=bt,a[3]=yt,a[4]=wt,a[5]=Mt,a[6]=_t,a[7]=St,a[8]=kt,a[9]=Et,a[10]=At,a[11]=It,a[12]=Rt,a[13]=Ot,a[14]=xt,a[15]=Bt,a[16]=Lt,a[17]=Tt,a[18]=Pt,0!==u&&(a[19]=u,i.length++),i};function m(t,e,i){return(new v).mulp(t,e,i)}function v(t,e){this.x=t,this.y=e}Math.imul||(p=c),o.prototype.mulTo=function(t,e){var i,r=this.length+t.length;return i=10===this.length&&10===t.length?p(this,t,e):r<63?c(this,t,e):r<1024?function(t,e,i){i.negative=e.negative^t.negative,i.length=t.length+e.length;for(var r=0,n=0,o=0;o<i.length-1;o++){var s=n;n=0;for(var h=67108863&r,a=Math.min(o,e.length-1),u=Math.max(0,o-t.length+1);u<=a;u++){var f=o-u,l=(0|t.words[f])*(0|e.words[u]),d=67108863&l;h=67108863&(d=d+h|0),n+=(s=(s=s+(l/67108864|0)|0)+(d>>>26)|0)>>>26,s&=67108863}i.words[o]=h,r=s,s=n}return 0!==r?i.words[o]=r:i.length--,i.strip()}(this,t,e):m(this,t,e),i},v.prototype.makeRBT=function(t){for(var e=new Array(t),i=o.prototype._countBits(t)-1,r=0;r<t;r++)e[r]=this.revBin(r,i,t);return e},v.prototype.revBin=function(t,e,i){if(0===t||t===i-1)return t;for(var r=0,n=0;n<e;n++)r|=(1&t)<<e-n-1,t>>=1;return r},v.prototype.permute=function(t,e,i,r,n,o){for(var s=0;s<o;s++)r[s]=e[t[s]],n[s]=i[t[s]]},v.prototype.transform=function(t,e,i,r,n,o){this.permute(o,t,e,i,r,n);for(var s=1;s<n;s<<=1)for(var h=s<<1,a=Math.cos(2*Math.PI/h),u=Math.sin(2*Math.PI/h),f=0;f<n;f+=h)for(var l=a,d=u,c=0;c<s;c++){var p=i[f+c],m=r[f+c],v=i[f+c+s],g=r[f+c+s],b=l*v-d*g;g=l*g+d*v,v=b,i[f+c]=p+v,r[f+c]=m+g,i[f+c+s]=p-v,r[f+c+s]=m-g,c!==h&&(b=a*l-u*d,d=a*d+u*l,l=b)}},v.prototype.guessLen13b=function(t,e){var i=1|Math.max(e,t),r=1&i,n=0;for(i=i/2|0;i;i>>>=1)n++;return 1<<n+1+r},v.prototype.conjugate=function(t,e,i){if(!(i<=1))for(var r=0;r<i/2;r++){var n=t[r];t[r]=t[i-r-1],t[i-r-1]=n,n=e[r],e[r]=-e[i-r-1],e[i-r-1]=-n}},v.prototype.normalize13b=function(t,e){for(var i=0,r=0;r<e/2;r++){var n=8192*Math.round(t[2*r+1]/e)+Math.round(t[2*r]/e)+i;t[r]=67108863&n,i=n<67108864?0:n/67108864|0}return t},v.prototype.convert13b=function(t,e,i,n){for(var o=0,s=0;s<e;s++)o+=0|t[s],i[2*s]=8191&o,o>>>=13,i[2*s+1]=8191&o,o>>>=13;for(s=2*e;s<n;++s)i[s]=0;r(0===o),r(!(-8192&o))},v.prototype.stub=function(t){for(var e=new Array(t),i=0;i<t;i++)e[i]=0;return e},v.prototype.mulp=function(t,e,i){var r=2*this.guessLen13b(t.length,e.length),n=this.makeRBT(r),o=this.stub(r),s=new Array(r),h=new Array(r),a=new Array(r),u=new Array(r),f=new Array(r),l=new Array(r),d=i.words;d.length=r,this.convert13b(t.words,t.length,s,r),this.convert13b(e.words,e.length,u,r),this.transform(s,o,h,a,r,n),this.transform(u,o,f,l,r,n);for(var c=0;c<r;c++){var p=h[c]*f[c]-a[c]*l[c];a[c]=h[c]*l[c]+a[c]*f[c],h[c]=p}return this.conjugate(h,a,r),this.transform(h,a,d,o,r,n),this.conjugate(d,o,r),this.normalize13b(d,r),i.negative=t.negative^e.negative,i.length=t.length+e.length,i.strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),m(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){r("number"==typeof t),r(t<67108864);for(var e=0,i=0;i<this.length;i++){var n=(0|this.words[i])*t,o=(67108863&n)+(67108863&e);e>>=26,e+=n/67108864|0,e+=o>>>26,this.words[i]=67108863&o}return 0!==e&&(this.words[i]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),i=0;i<e.length;i++){var r=i/26|0,n=i%26;e[i]=(t.words[r]&1<<n)>>>n}return e}(t);if(0===e.length)return new o(1);for(var i=this,r=0;r<e.length&&0===e[r];r++,i=i.sqr());if(++r<e.length)for(var n=i.sqr();r<e.length;r++,n=n.sqr())0!==e[r]&&(i=i.mul(n));return i},o.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,i=t%26,n=(t-i)/26,o=67108863>>>26-i<<26-i;if(0!==i){var s=0;for(e=0;e<this.length;e++){var h=this.words[e]&o,a=(0|this.words[e])-h<<i;this.words[e]=a|s,s=h>>>26-i}s&&(this.words[e]=s,this.length++)}if(0!==n){for(e=this.length-1;e>=0;e--)this.words[e+n]=this.words[e];for(e=0;e<n;e++)this.words[e]=0;this.length+=n}return this.strip()},o.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,i){var n;r("number"==typeof t&&t>=0),n=e?(e-e%26)/26:0;var o=t%26,s=Math.min((t-o)/26,this.length),h=67108863^67108863>>>o<<o,a=i;if(n-=s,n=Math.