matrix-js-sdk
Version:
Matrix Client-Server SDK for Javascript
1 lines • 1.5 MB
JavaScript
!function e(t,i,n){function r(s,a){if(!i[s]){if(!t[s]){var c="function"==typeof require&&require;if(!a&&c)return c(s,!0);if(o)return o(s,!0);var d=new Error("Cannot find module '"+s+"'");throw d.code="MODULE_NOT_FOUND",d}var l=i[s]={exports:{}};t[s][0].call(l.exports,(function(e){return r(t[s][1][e]||e)}),l,l.exports,e,t,i,n)}return i[s].exports}for(var o="function"==typeof require&&require,s=0;s<n.length;s++)r(n[s]);return r}({1:[function(e,t,i){"use strict";for(var n=/[\\\"\x00-\x1F]/g,r={},o=0;o<32;++o)r[String.fromCharCode(o)]="\\U"+("0000"+o.toString(16)).slice(-4).toUpperCase();function s(e){return n.lastIndex=0,e.replace(n,(function(e){return r[e]}))}function a(e){switch(typeof e){case"string":return'"'+s(e)+'"';case"number":return isFinite(e)?e:"null";case"boolean":return e;case"object":return null===e?"null":Array.isArray(e)?function(e){for(var t="[",i="",n=0;n<e.length;++n)i+=t,t=",",i+=a(e[n]);return","!=t?"[]":i+"]"}(e):function(e){var t="{",i="",n=Object.keys(e);n.sort();for(var r=0;r<n.length;++r){var o=n[r];i+=t+'"'+s(o)+'":',t=",",i+=a(e[o])}return","!=t?"{}":i+"}"}(e);default:throw new Error("Cannot stringify: "+typeof e)}}r["\b"]="\\b",r["\t"]="\\t",r["\n"]="\\n",r["\f"]="\\f",r["\r"]="\\r",r['"']='\\"',r["\\"]="\\\\",t.exports={stringify:a}},{}],2:[function(e,t,i){"use strict";const n=i;n.bignum=e("bn.js"),n.define=e("./asn1/api").define,n.base=e("./asn1/base"),n.constants=e("./asn1/constants"),n.decoders=e("./asn1/decoders"),n.encoders=e("./asn1/encoders")},{"./asn1/api":3,"./asn1/base":5,"./asn1/constants":9,"./asn1/decoders":11,"./asn1/encoders":14,"bn.js":18}],3:[function(e,t,i){"use strict";const n=e("./encoders"),r=e("./decoders"),o=e("inherits");function s(e,t){this.name=e,this.body=t,this.decoders={},this.encoders={}}i.define=function(e,t){return new s(e,t)},s.prototype._createNamed=function(e){const t=this.name;function i(e){this._initNamed(e,t)}return o(i,e),i.prototype._initNamed=function(t,i){e.call(this,t,i)},new i(this)},s.prototype._getDecoder=function(e){return e=e||"der",this.decoders.hasOwnProperty(e)||(this.decoders[e]=this._createNamed(r[e])),this.decoders[e]},s.prototype.decode=function(e,t,i){return this._getDecoder(t).decode(e,i)},s.prototype._getEncoder=function(e){return e=e||"der",this.encoders.hasOwnProperty(e)||(this.encoders[e]=this._createNamed(n[e])),this.encoders[e]},s.prototype.encode=function(e,t,i){return this._getEncoder(t).encode(e,i)}},{"./decoders":11,"./encoders":14,inherits:146}],4:[function(e,t,i){"use strict";const n=e("inherits"),r=e("../base/reporter").Reporter,o=e("safer-buffer").Buffer;function s(e,t){r.call(this,t),o.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function a(e,t){if(Array.isArray(e))this.length=0,this.value=e.map((function(e){return a.isEncoderBuffer(e)||(e=new a(e,t)),this.length+=e.length,e}),this);else if("number"==typeof e){if(!(0<=e&&e<=255))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=o.byteLength(e);else{if(!o.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}n(s,r),i.DecoderBuffer=s,s.isDecoderBuffer=function(e){if(e instanceof s)return!0;return"object"==typeof e&&o.isBuffer(e.base)&&"DecoderBuffer"===e.constructor.name&&"number"==typeof e.offset&&"number"==typeof e.length&&"function"==typeof e.save&&"function"==typeof e.restore&&"function"==typeof e.isEmpty&&"function"==typeof e.readUInt8&&"function"==typeof e.skip&&"function"==typeof e.raw},s.prototype.save=function(){return{offset:this.offset,reporter:r.prototype.save.call(this)}},s.prototype.restore=function(e){const t=new s(this.base);return t.offset=e.offset,t.length=this.offset,this.offset=e.offset,r.prototype.restore.call(this,e.reporter),t},s.prototype.isEmpty=function(){return this.offset===this.length},s.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")},s.prototype.skip=function(e,t){if(!(this.offset+e<=this.length))return this.error(t||"DecoderBuffer overrun");const i=new s(this.base);return i._reporterState=this._reporterState,i.offset=this.offset,i.length=this.offset+e,this.offset+=e,i},s.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)},i.EncoderBuffer=a,a.isEncoderBuffer=function(e){if(e instanceof a)return!0;return"object"==typeof e&&"EncoderBuffer"===e.constructor.name&&"number"==typeof e.length&&"function"==typeof e.join},a.prototype.join=function(e,t){return e||(e=o.alloc(this.length)),t||(t=0),0===this.length||(Array.isArray(this.value)?this.value.forEach((function(i){i.join(e,t),t+=i.length})):("number"==typeof this.value?e[t]=this.value:"string"==typeof this.value?e.write(this.value,t):o.isBuffer(this.value)&&this.value.copy(e,t),t+=this.length)),e}},{"../base/reporter":7,inherits:146,"safer-buffer":251}],5:[function(e,t,i){"use strict";const n=i;n.Reporter=e("./reporter").Reporter,n.DecoderBuffer=e("./buffer").DecoderBuffer,n.EncoderBuffer=e("./buffer").EncoderBuffer,n.Node=e("./node")},{"./buffer":4,"./node":6,"./reporter":7}],6:[function(e,t,i){"use strict";const n=e("../base/reporter").Reporter,r=e("../base/buffer").EncoderBuffer,o=e("../base/buffer").DecoderBuffer,s=e("minimalistic-assert"),a=["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"],c=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(a);function d(e,t,i){const n={};this._baseState=n,n.name=i,n.enc=e,n.parent=t||null,n.children=null,n.tag=null,n.args=null,n.reverseArgs=null,n.choice=null,n.optional=!1,n.any=!1,n.obj=!1,n.use=null,n.useDecoder=null,n.key=null,n.default=null,n.explicit=null,n.implicit=null,n.contains=null,n.parent||(n.children=[],this._wrap())}t.exports=d;const l=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];d.prototype.clone=function(){const e=this._baseState,t={};l.forEach((function(i){t[i]=e[i]}));const i=new this.constructor(t.parent);return i._baseState=t,i},d.prototype._wrap=function(){const e=this._baseState;c.forEach((function(t){this[t]=function(){const i=new this.constructor(this);return e.children.push(i),i[t].apply(i,arguments)}}),this)},d.prototype._init=function(e){const t=this._baseState;s(null===t.parent),e.call(this),t.children=t.children.filter((function(e){return e._baseState.parent===this}),this),s.equal(t.children.length,1,"Root node can have only one child")},d.prototype._useArgs=function(e){const t=this._baseState,i=e.filter((function(e){return e instanceof this.constructor}),this);e=e.filter((function(e){return!(e instanceof this.constructor)}),this),0!==i.length&&(s(null===t.children),t.children=i,i.forEach((function(e){e._baseState.parent=this}),this)),0!==e.length&&(s(null===t.args),t.args=e,t.reverseArgs=e.map((function(e){if("object"!=typeof e||e.constructor!==Object)return e;const t={};return Object.keys(e).forEach((function(i){i==(0|i)&&(i|=0);const n=e[i];t[n]=i})),t})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(e){d.prototype[e]=function(){const t=this._baseState;throw new Error(e+" not implemented for encoding: "+t.enc)}})),a.forEach((function(e){d.prototype[e]=function(){const t=this._baseState,i=Array.prototype.slice.call(arguments);return s(null===t.tag),t.tag=e,this._useArgs(i),this}})),d.prototype.use=function(e){s(e);const t=this._baseState;return s(null===t.use),t.use=e,this},d.prototype.optional=function(){return this._baseState.optional=!0,this},d.prototype.def=function(e){const t=this._baseState;return s(null===t.default),t.default=e,t.optional=!0,this},d.prototype.explicit=function(e){const t=this._baseState;return s(null===t.explicit&&null===t.implicit),t.explicit=e,this},d.prototype.implicit=function(e){const t=this._baseState;return s(null===t.explicit&&null===t.implicit),t.implicit=e,this},d.prototype.obj=function(){const e=this._baseState,t=Array.prototype.slice.call(arguments);return e.obj=!0,0!==t.length&&this._useArgs(t),this},d.prototype.key=function(e){const t=this._baseState;return s(null===t.key),t.key=e,this},d.prototype.any=function(){return this._baseState.any=!0,this},d.prototype.choice=function(e){const t=this._baseState;return s(null===t.choice),t.choice=e,this._useArgs(Object.keys(e).map((function(t){return e[t]}))),this},d.prototype.contains=function(e){const t=this._baseState;return s(null===t.use),t.contains=e,this},d.prototype._decode=function(e,t){const i=this._baseState;if(null===i.parent)return e.wrapResult(i.children[0]._decode(e,t));let n,r=i.default,s=!0,a=null;if(null!==i.key&&(a=e.enterKey(i.key)),i.optional){let n=null;if(null!==i.explicit?n=i.explicit:null!==i.implicit?n=i.implicit:null!==i.tag&&(n=i.tag),null!==n||i.any){if(s=this._peekTag(e,n,i.any),e.isError(s))return s}else{const n=e.save();try{null===i.choice?this._decodeGeneric(i.tag,e,t):this._decodeChoice(e,t),s=!0}catch(e){s=!1}e.restore(n)}}if(i.obj&&s&&(n=e.enterObject()),s){if(null!==i.explicit){const t=this._decodeTag(e,i.explicit);if(e.isError(t))return t;e=t}const n=e.offset;if(null===i.use&&null===i.choice){let t;i.any&&(t=e.save());const n=this._decodeTag(e,null!==i.implicit?i.implicit:i.tag,i.any);if(e.isError(n))return n;i.any?r=e.raw(t):e=n}if(t&&t.track&&null!==i.tag&&t.track(e.path(),n,e.length,"tagged"),t&&t.track&&null!==i.tag&&t.track(e.path(),e.offset,e.length,"content"),i.any||(r=null===i.choice?this._decodeGeneric(i.tag,e,t):this._decodeChoice(e,t)),e.isError(r))return r;if(i.any||null!==i.choice||null===i.children||i.children.forEach((function(i){i._decode(e,t)})),i.contains&&("octstr"===i.tag||"bitstr"===i.tag)){const n=new o(r);r=this._getUse(i.contains,e._reporterState.obj)._decode(n,t)}}return i.obj&&s&&(r=e.leaveObject(n)),null===i.key||null===r&&!0!==s?null!==a&&e.exitKey(a):e.leaveKey(a,i.key,r),r},d.prototype._decodeGeneric=function(e,t,i){const n=this._baseState;return"seq"===e||"set"===e?null:"seqof"===e||"setof"===e?this._decodeList(t,e,n.args[0],i):/str$/.test(e)?this._decodeStr(t,e,i):"objid"===e&&n.args?this._decodeObjid(t,n.args[0],n.args[1],i):"objid"===e?this._decodeObjid(t,null,null,i):"gentime"===e||"utctime"===e?this._decodeTime(t,e,i):"null_"===e?this._decodeNull(t,i):"bool"===e?this._decodeBool(t,i):"objDesc"===e?this._decodeStr(t,e,i):"int"===e||"enum"===e?this._decodeInt(t,n.args&&n.args[0],i):null!==n.use?this._getUse(n.use,t._reporterState.obj)._decode(t,i):t.error("unknown tag: "+e)},d.prototype._getUse=function(e,t){const i=this._baseState;return i.useDecoder=this._use(e,t),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},d.prototype._decodeChoice=function(e,t){const i=this._baseState;let n=null,r=!1;return Object.keys(i.choice).some((function(o){const s=e.save(),a=i.choice[o];try{const i=a._decode(e,t);if(e.isError(i))return!1;n={type:o,value:i},r=!0}catch(t){return e.restore(s),!1}return!0}),this),r?n:e.error("Choice not matched")},d.prototype._createEncoderBuffer=function(e){return new r(e,this.reporter)},d.prototype._encode=function(e,t,i){const n=this._baseState;if(null!==n.default&&n.default===e)return;const r=this._encodeValue(e,t,i);return void 0===r||this._skipDefault(r,t,i)?void 0:r},d.prototype._encodeValue=function(e,t,i){const r=this._baseState;if(null===r.parent)return r.children[0]._encode(e,t||new n);let o=null;if(this.reporter=t,r.optional&&void 0===e){if(null===r.default)return;e=r.default}let s=null,a=!1;if(r.any)o=this._createEncoderBuffer(e);else if(r.choice)o=this._encodeChoice(e,t);else if(r.contains)s=this._getUse(r.contains,i)._encode(e,t),a=!0;else if(r.children)s=r.children.map((function(i){if("null_"===i._baseState.tag)return i._encode(null,t,e);if(null===i._baseState.key)return t.error("Child should have a key");const n=t.enterKey(i._baseState.key);if("object"!=typeof e)return t.error("Child expected, but input is not object");const r=i._encode(e[i._baseState.key],t,e);return t.leaveKey(n),r}),this).filter((function(e){return e})),s=this._createEncoderBuffer(s);else if("seqof"===r.tag||"setof"===r.tag){if(!r.args||1!==r.args.length)return t.error("Too many args for : "+r.tag);if(!Array.isArray(e))return t.error("seqof/setof, but data is not Array");const i=this.clone();i._baseState.implicit=null,s=this._createEncoderBuffer(e.map((function(i){const n=this._baseState;return this._getUse(n.args[0],e)._encode(i,t)}),i))}else null!==r.use?o=this._getUse(r.use,i)._encode(e,t):(s=this._encodePrimitive(r.tag,e),a=!0);if(!r.any&&null===r.choice){const e=null!==r.implicit?r.implicit:r.tag,i=null===r.implicit?"universal":"context";null===e?null===r.use&&t.error("Tag could be omitted only for .use()"):null===r.use&&(o=this._encodeComposite(e,a,i,s))}return null!==r.explicit&&(o=this._encodeComposite(r.explicit,!1,"context",o)),o},d.prototype._encodeChoice=function(e,t){const i=this._baseState,n=i.choice[e.type];return n||s(!1,e.type+" not found in "+JSON.stringify(Object.keys(i.choice))),n._encode(e.value,t)},d.prototype._encodePrimitive=function(e,t){const i=this._baseState;if(/str$/.test(e))return this._encodeStr(t,e);if("objid"===e&&i.args)return this._encodeObjid(t,i.reverseArgs[0],i.args[1]);if("objid"===e)return this._encodeObjid(t,null,null);if("gentime"===e||"utctime"===e)return this._encodeTime(t,e);if("null_"===e)return this._encodeNull();if("int"===e||"enum"===e)return this._encodeInt(t,i.args&&i.reverseArgs[0]);if("bool"===e)return this._encodeBool(t);if("objDesc"===e)return this._encodeStr(t,e);throw new Error("Unsupported tag: "+e)},d.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)},d.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(e)}},{"../base/buffer":4,"../base/reporter":7,"minimalistic-assert":223}],7:[function(e,t,i){"use strict";const n=e("inherits");function r(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function o(e,t){this.path=e,this.rethrow(t)}i.Reporter=r,r.prototype.isError=function(e){return e instanceof o},r.prototype.save=function(){const e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}},r.prototype.restore=function(e){const t=this._reporterState;t.obj=e.obj,t.path=t.path.slice(0,e.pathLen)},r.prototype.enterKey=function(e){return this._reporterState.path.push(e)},r.prototype.exitKey=function(e){const t=this._reporterState;t.path=t.path.slice(0,e-1)},r.prototype.leaveKey=function(e,t,i){const n=this._reporterState;this.exitKey(e),null!==n.obj&&(n.obj[t]=i)},r.prototype.path=function(){return this._reporterState.path.join("/")},r.prototype.enterObject=function(){const e=this._reporterState,t=e.obj;return e.obj={},t},r.prototype.leaveObject=function(e){const t=this._reporterState,i=t.obj;return t.obj=e,i},r.prototype.error=function(e){let t;const i=this._reporterState,n=e instanceof o;if(t=n?e:new o(i.path.map((function(e){return"["+JSON.stringify(e)+"]"})).join(""),e.message||e,e.stack),!i.options.partial)throw t;return n||i.errors.push(t),t},r.prototype.wrapResult=function(e){const t=this._reporterState;return t.options.partial?{result:this.isError(e)?null:e,errors:t.errors}:e},n(o,Error),o.prototype.rethrow=function(e){if(this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,o),!this.stack)try{throw new Error(this.message)}catch(e){this.stack=e.stack}return this}},{inherits:146}],8:[function(e,t,i){"use strict";function n(e){const t={};return Object.keys(e).forEach((function(i){(0|i)==i&&(i|=0);const n=e[i];t[n]=i})),t}i.tagClass={0:"universal",1:"application",2:"context",3:"private"},i.tagClassByName=n(i.tagClass),i.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"},i.tagByName=n(i.tag)},{}],9:[function(e,t,i){"use strict";const n=i;n._reverse=function(e){const t={};return Object.keys(e).forEach((function(i){(0|i)==i&&(i|=0);const n=e[i];t[n]=i})),t},n.der=e("./der")},{"./der":8}],10:[function(e,t,i){"use strict";const n=e("inherits"),r=e("bn.js"),o=e("../base/buffer").DecoderBuffer,s=e("../base/node"),a=e("../constants/der");function c(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new d,this.tree._init(e.body)}function d(e){s.call(this,"der",e)}function l(e,t){let i=e.readUInt8(t);if(e.isError(i))return i;const n=a.tagClass[i>>6],r=0==(32&i);if(31==(31&i)){let n=i;for(i=0;128==(128&n);){if(n=e.readUInt8(t),e.isError(n))return n;i<<=7,i|=127&n}}else i&=31;return{cls:n,primitive:r,tag:i,tagStr:a.tag[i]}}function u(e,t,i){let n=e.readUInt8(i);if(e.isError(n))return n;if(!t&&128===n)return null;if(0==(128&n))return n;const r=127&n;if(r>4)return e.error("length octect is too long");n=0;for(let t=0;t<r;t++){n<<=8;const t=e.readUInt8(i);if(e.isError(t))return t;n|=t}return n}t.exports=c,c.prototype.decode=function(e,t){return o.isDecoderBuffer(e)||(e=new o(e,t)),this.tree._decode(e,t)},n(d,s),d.prototype._peekTag=function(e,t,i){if(e.isEmpty())return!1;const n=e.save(),r=l(e,'Failed to peek tag: "'+t+'"');return e.isError(r)?r:(e.restore(n),r.tag===t||r.tagStr===t||r.tagStr+"of"===t||i)},d.prototype._decodeTag=function(e,t,i){const n=l(e,'Failed to decode tag of "'+t+'"');if(e.isError(n))return n;let r=u(e,n.primitive,'Failed to get length of "'+t+'"');if(e.isError(r))return r;if(!i&&n.tag!==t&&n.tagStr!==t&&n.tagStr+"of"!==t)return e.error('Failed to match tag: "'+t+'"');if(n.primitive||null!==r)return e.skip(r,'Failed to match body of: "'+t+'"');const o=e.save(),s=this._skipUntilEnd(e,'Failed to skip indefinite length body: "'+this.tag+'"');return e.isError(s)?s:(r=e.offset-o.offset,e.restore(o),e.skip(r,'Failed to match body of: "'+t+'"'))},d.prototype._skipUntilEnd=function(e,t){for(;;){const i=l(e,t);if(e.isError(i))return i;const n=u(e,i.primitive,t);if(e.isError(n))return n;let r;if(r=i.primitive||null!==n?e.skip(n):this._skipUntilEnd(e,t),e.isError(r))return r;if("end"===i.tagStr)break}},d.prototype._decodeList=function(e,t,i,n){const r=[];for(;!e.isEmpty();){const t=this._peekTag(e,"end");if(e.isError(t))return t;const o=i.decode(e,"der",n);if(e.isError(o)&&t)break;r.push(o)}return r},d.prototype._decodeStr=function(e,t){if("bitstr"===t){const t=e.readUInt8();return e.isError(t)?t:{unused:t,data:e.raw()}}if("bmpstr"===t){const t=e.raw();if(t.length%2==1)return e.error("Decoding of string type: bmpstr length mismatch");let i="";for(let e=0;e<t.length/2;e++)i+=String.fromCharCode(t.readUInt16BE(2*e));return i}if("numstr"===t){const t=e.raw().toString("ascii");return this._isNumstr(t)?t:e.error("Decoding of string type: numstr unsupported characters")}if("octstr"===t)return e.raw();if("objDesc"===t)return e.raw();if("printstr"===t){const t=e.raw().toString("ascii");return this._isPrintstr(t)?t:e.error("Decoding of string type: printstr unsupported characters")}return/str$/.test(t)?e.raw().toString():e.error("Decoding of string type: "+t+" unsupported")},d.prototype._decodeObjid=function(e,t,i){let n;const r=[];let o=0,s=0;for(;!e.isEmpty();)s=e.readUInt8(),o<<=7,o|=127&s,0==(128&s)&&(r.push(o),o=0);128&s&&r.push(o);const a=r[0]/40|0,c=r[0]%40;if(n=i?r:[a,c].concat(r.slice(1)),t){let e=t[n.join(" ")];void 0===e&&(e=t[n.join(".")]),void 0!==e&&(n=e)}return n},d.prototype._decodeTime=function(e,t){const i=e.raw().toString();let n,r,o,s,a,c;if("gentime"===t)n=0|i.slice(0,4),r=0|i.slice(4,6),o=0|i.slice(6,8),s=0|i.slice(8,10),a=0|i.slice(10,12),c=0|i.slice(12,14);else{if("utctime"!==t)return e.error("Decoding "+t+" time is not supported yet");n=0|i.slice(0,2),r=0|i.slice(2,4),o=0|i.slice(4,6),s=0|i.slice(6,8),a=0|i.slice(8,10),c=0|i.slice(10,12),n=n<70?2e3+n:1900+n}return Date.UTC(n,r-1,o,s,a,c,0)},d.prototype._decodeNull=function(){return null},d.prototype._decodeBool=function(e){const t=e.readUInt8();return e.isError(t)?t:0!==t},d.prototype._decodeInt=function(e,t){const i=e.raw();let n=new r(i);return t&&(n=t[n.toString(10)]||n),n},d.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getDecoder("der").tree}},{"../base/buffer":4,"../base/node":6,"../constants/der":8,"bn.js":18,inherits:146}],11:[function(e,t,i){"use strict";const n=i;n.der=e("./der"),n.pem=e("./pem")},{"./der":10,"./pem":12}],12:[function(e,t,i){"use strict";const n=e("inherits"),r=e("safer-buffer").Buffer,o=e("./der");function s(e){o.call(this,e),this.enc="pem"}n(s,o),t.exports=s,s.prototype.decode=function(e,t){const i=e.toString().split(/[\r\n]+/g),n=t.label.toUpperCase(),s=/^-----(BEGIN|END) ([^-]+)-----$/;let a=-1,c=-1;for(let e=0;e<i.length;e++){const t=i[e].match(s);if(null!==t&&t[2]===n){if(-1!==a){if("END"!==t[1])break;c=e;break}if("BEGIN"!==t[1])break;a=e}}if(-1===a||-1===c)throw new Error("PEM section not found for: "+n);const d=i.slice(a+1,c).join("");d.replace(/[^a-z0-9+/=]+/gi,"");const l=r.from(d,"base64");return o.prototype.decode.call(this,l,t)}},{"./der":10,inherits:146,"safer-buffer":251}],13:[function(e,t,i){"use strict";const n=e("inherits"),r=e("safer-buffer").Buffer,o=e("../base/node"),s=e("../constants/der");function a(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new c,this.tree._init(e.body)}function c(e){o.call(this,"der",e)}function d(e){return e<10?"0"+e:e}t.exports=a,a.prototype.encode=function(e,t){return this.tree._encode(e,t).join()},n(c,o),c.prototype._encodeComposite=function(e,t,i,n){const o=function(e,t,i,n){let r;"seqof"===e?e="seq":"setof"===e&&(e="set");if(s.tagByName.hasOwnProperty(e))r=s.tagByName[e];else{if("number"!=typeof e||(0|e)!==e)return n.error("Unknown tag: "+e);r=e}if(r>=31)return n.error("Multi-octet tag encoding unsupported");t||(r|=32);return r|=s.tagClassByName[i||"universal"]<<6,r}(e,t,i,this.reporter);if(n.length<128){const e=r.alloc(2);return e[0]=o,e[1]=n.length,this._createEncoderBuffer([e,n])}let a=1;for(let e=n.length;e>=256;e>>=8)a++;const c=r.alloc(2+a);c[0]=o,c[1]=128|a;for(let e=1+a,t=n.length;t>0;e--,t>>=8)c[e]=255&t;return this._createEncoderBuffer([c,n])},c.prototype._encodeStr=function(e,t){if("bitstr"===t)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===t){const t=r.alloc(2*e.length);for(let i=0;i<e.length;i++)t.writeUInt16BE(e.charCodeAt(i),2*i);return this._createEncoderBuffer(t)}return"numstr"===t?this._isNumstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===t?this._isPrintstr(e)?this._createEncoderBuffer(e):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(t)||"objDesc"===t?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: "+t+" unsupported")},c.prototype._encodeObjid=function(e,t,i){if("string"==typeof e){if(!t)return this.reporter.error("string objid given, but no values map found");if(!t.hasOwnProperty(e))return this.reporter.error("objid not found in values map");e=t[e].split(/[\s.]+/g);for(let t=0;t<e.length;t++)e[t]|=0}else if(Array.isArray(e)){e=e.slice();for(let t=0;t<e.length;t++)e[t]|=0}if(!Array.isArray(e))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(e));if(!i){if(e[1]>=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,40*e[0]+e[1])}let n=0;for(let t=0;t<e.length;t++){let i=e[t];for(n++;i>=128;i>>=7)n++}const o=r.alloc(n);let s=o.length-1;for(let t=e.length-1;t>=0;t--){let i=e[t];for(o[s--]=127&i;(i>>=7)>0;)o[s--]=128|127&i}return this._createEncoderBuffer(o)},c.prototype._encodeTime=function(e,t){let i;const n=new Date(e);return"gentime"===t?i=[d(n.getUTCFullYear()),d(n.getUTCMonth()+1),d(n.getUTCDate()),d(n.getUTCHours()),d(n.getUTCMinutes()),d(n.getUTCSeconds()),"Z"].join(""):"utctime"===t?i=[d(n.getUTCFullYear()%100),d(n.getUTCMonth()+1),d(n.getUTCDate()),d(n.getUTCHours()),d(n.getUTCMinutes()),d(n.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(i,"octstr")},c.prototype._encodeNull=function(){return this._createEncoderBuffer("")},c.prototype._encodeInt=function(e,t){if("string"==typeof e){if(!t)return this.reporter.error("String int or enum given, but no values map");if(!t.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=t[e]}if("number"!=typeof e&&!r.isBuffer(e)){const t=e.toArray();!e.sign&&128&t[0]&&t.unshift(0),e=r.from(t)}if(r.isBuffer(e)){let t=e.length;0===e.length&&t++;const i=r.alloc(t);return e.copy(i),0===e.length&&(i[0]=0),this._createEncoderBuffer(i)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);let i=1;for(let t=e;t>=256;t>>=8)i++;const n=new Array(i);for(let t=n.length-1;t>=0;t--)n[t]=255&e,e>>=8;return 128&n[0]&&n.unshift(0),this._createEncoderBuffer(r.from(n))},c.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},c.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},c.prototype._skipDefault=function(e,t,i){const n=this._baseState;let r;if(null===n.default)return!1;const o=e.join();if(void 0===n.defaultBuffer&&(n.defaultBuffer=this._encodeValue(n.default,t,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}},{"../base/node":6,"../constants/der":8,inherits:146,"safer-buffer":251}],14:[function(e,t,i){"use strict";const n=i;n.der=e("./der"),n.pem=e("./pem")},{"./der":13,"./pem":15}],15:[function(e,t,i){"use strict";const n=e("inherits"),r=e("./der");function o(e){r.call(this,e),this.enc="pem"}n(o,r),t.exports=o,o.prototype.encode=function(e,t){const i=r.prototype.encode.call(this,e).toString("base64"),n=["-----BEGIN "+t.label+"-----"];for(let e=0;e<i.length;e+=64)n.push(i.slice(e,e+64));return n.push("-----END "+t.label+"-----"),n.join("\n")}},{"./der":13,inherits:146}],16:[function(e,t,i){(function(e){(function(){"use strict";var i=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],n="undefined"==typeof globalThis?e:globalThis;t.exports=function(){for(var e=[],t=0;t<i.length;t++)"function"==typeof n[i[t]]&&(e[e.length]=i[t]);return e}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],17:[function(e,t,i){"use strict";i.byteLength=function(e){var t=d(e),i=t[0],n=t[1];return 3*(i+n)/4-n},i.toByteArray=function(e){var t,i,n=d(e),s=n[0],a=n[1],c=new o(function(e,t,i){return 3*(t+i)/4-i}(0,s,a)),l=0,u=a>0?s-4:s;for(i=0;i<u;i+=4)t=r[e.charCodeAt(i)]<<18|r[e.charCodeAt(i+1)]<<12|r[e.charCodeAt(i+2)]<<6|r[e.charCodeAt(i+3)],c[l++]=t>>16&255,c[l++]=t>>8&255,c[l++]=255&t;2===a&&(t=r[e.charCodeAt(i)]<<2|r[e.charCodeAt(i+1)]>>4,c[l++]=255&t);1===a&&(t=r[e.charCodeAt(i)]<<10|r[e.charCodeAt(i+1)]<<4|r[e.charCodeAt(i+2)]>>2,c[l++]=t>>8&255,c[l++]=255&t);return c},i.fromByteArray=function(e){for(var t,i=e.length,r=i%3,o=[],s=16383,a=0,c=i-r;a<c;a+=s)o.push(l(e,a,a+s>c?c:a+s));1===r?(t=e[i-1],o.push(n[t>>2]+n[t<<4&63]+"==")):2===r&&(t=(e[i-2]<<8)+e[i-1],o.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return o.join("")};for(var n=[],r=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,c=s.length;a<c;++a)n[a]=s[a],r[s.charCodeAt(a)]=a;function d(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var i=e.indexOf("=");return-1===i&&(i=t),[i,i===t?0:4-i%4]}function l(e,t,i){for(var r,o,s=[],a=t;a<i;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(n[(o=r)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return s.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},{}],18:[function(e,t,i){!function(t,i){"use strict";function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function r(e,t){e.super_=t;var i=function(){};i.prototype=t.prototype,e.prototype=new i,e.prototype.constructor=e}function o(e,t,i){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(i=t,t=10),this._init(e||0,t||10,i||"be"))}var s;"object"==typeof t?t.exports=o:i.BN=o,o.BN=o,o.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:e("buffer").Buffer}catch(e){}function a(e,t){var i=e.charCodeAt(t);return i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:i-48&15}function c(e,t,i){var n=a(e,i);return i-1>=t&&(n|=a(e,i-1)<<4),n}function d(e,t,i,n){for(var r=0,o=Math.min(e.length,i),s=t;s<o;s++){var a=e.charCodeAt(s)-48;r*=n,r+=a>=49?a-49+10:a>=17?a-17+10:a}return r}o.isBN=function(e){return e instanceof o||null!==e&&"object"==typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,i){if("number"==typeof e)return this._initNumber(e,t,i);if("object"==typeof e)return this._initArray(e,t,i);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var r=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(r++,this.negative=1),r<e.length&&(16===t?this._parseHex(e,r,i):(this._parseBase(e,t,r),"le"===i&&this._initArray(this.toArray(),t,i)))},o.prototype._initNumber=function(e,t,i){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),t,i)},o.prototype._initArray=function(e,t,i){if(n("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var o,s,a=0;if("be"===i)for(r=e.length-1,o=0;r>=0;r-=3)s=e[r]|e[r-1]<<8|e[r-2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===i)for(r=0,o=0;r<e.length;r+=3)s=e[r]|e[r+1]<<8|e[r+2]<<16,this.words[o]|=s<<a&67108863,this.words[o+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(e,t,i){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var r,o=0,s=0;if("be"===i)for(n=e.length-1;n>=t;n-=2)r=c(e,t,n)<<o,this.words[s]|=67108863&r,o>=18?(o-=18,s+=1,this.words[s]|=r>>>26):o+=8;else for(n=(e.length-t)%2==0?t+1:t;n<e.length;n+=2)r=c(e,t,n)<<o,this.words[s]|=67108863&r,o>=18?(o-=18,s+=1,this.words[s]|=r>>>26):o+=8;this.strip()},o.prototype._parseBase=function(e,t,i){this.words=[0],this.length=1;for(var n=0,r=1;r<=67108863;r*=t)n++;n--,r=r/t|0;for(var o=e.length-i,s=o%n,a=Math.min(o,o-s)+i,c=0,l=i;l<a;l+=n)c=d(e,l,l+n,t),this.imuln(r),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==s){var u=1;for(c=d(e,l,e.length,t),l=0;l<s;l++)u*=t;this.imuln(u),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this.strip()},o.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},o.prototype.clone=function(){var e=new o(null);return this.copy(e),e},o.prototype._expand=function(e){for(;this.length<e;)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 l=["","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"],u=[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],h=[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(e,t,i){i.negative=t.negative^e.negative;var n=e.length+t.length|0;i.length=n,n=n-1|0;var r=0|e.words[0],o=0|t.words[0],s=r*o,a=67108863&s,c=s/67108864|0;i.words[0]=a;for(var d=1;d<n;d++){for(var l=c>>>26,u=67108863&c,h=Math.min(d,t.length-1),f=Math.max(0,d-e.length+1);f<=h;f++){var p=d-f|0;l+=(s=(r=0|e.words[p])*(o=0|t.words[f])+u)/67108864|0,u=67108863&s}i.words[d]=0|u,c=0|l}return 0!==c?i.words[d]=0|c:i.length--,i.strip()}o.prototype.toString=function(e,t){var i;if(t=0|t||1,16===(e=e||10)||"hex"===e){i="";for(var r=0,o=0,s=0;s<this.length;s++){var a=this.words[s],c=(16777215&(a<<r|o)).toString(16);i=0!==(o=a>>>24-r&16777215)||s!==this.length-1?l[6-c.length]+c+i:c+i,(r+=2)>=26&&(r-=26,s--)}for(0!==o&&(i=o.toString(16)+i);i.length%t!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(e===(0|e)&&e>=2&&e<=36){var d=u[e],f=h[e];i="";var p=this.clone();for(p.negative=0;!p.isZero();){var g=p.modn(f).toString(e);i=(p=p.idivn(f)).isZero()?g+i:l[d-g.length]+g+i}for(this.isZero()&&(i="0"+i);i.length%t!=0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(e,t){return n(void 0!==s),this.toArrayLike(s,e,t)},o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,i){var r=this.byteLength(),o=i||Math.max(1,r);n(r<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var s,a,c="le"===t,d=new e(o),l=this.clone();if(c){for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),d[a]=s;for(;a<o;a++)d[a]=0}else{for(a=0;a<o-r;a++)d[a]=0;for(a=0;!l.isZero();a++)s=l.andln(255),l.iushrn(8),d[o-a-1]=s}return d},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,i=0;return t>=4096&&(i+=13,t>>>=13),t>=64&&(i+=7,t>>>=7),t>=8&&(i+=4,t>>>=4),t>=2&&(i+=2,t>>>=2),i+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,i=0;return 0==(8191&t)&&(i+=13,t>>>=13),0==(127&t)&&(i+=7,t>>>=7),0==(15&t)&&(i+=4,t>>>=4),0==(3&t)&&(i+=2,t>>>=2),0==(1&t)&&i++,i},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var i=this._zeroBits(this.words[t]);if(e+=i,26!==i)break}return e},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},o.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).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(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},o.prototype.ior=function(e){return n(0==(this.negative|e.negative)),this.iuor(e)},o.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var i=0;i<t.length;i++)this.words[i]=this.words[i]&e.words[i];return this.length=t.length,this.strip()},o.prototype.iand=function(e){return n(0==(this.negative|e.negative)),this.iuand(e)},o.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,i;this.length>e.length?(t=this,i=e):(t=e,i=this);for(var n=0;n<i.length;n++)this.words[n]=t.words[n]^i.words[n];if(this!==t)for(;n<t.length;n++)this.words[n]=t.words[n];return this.length=t.length,this.strip()},o.prototype.ixor=function(e){return n(0==(this.negative|e.negative)),this.iuxor(e)},o.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),i=e%26;this._expand(t),i>0&&t--;for(var r=0;r<t;r++)this.words[r]=67108863&~this.words[r];return i>0&&(this.words[r]=~this.words[r]&67108863>>26-i),this.strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var i=e/26|0,r=e%26;return this._expand(i+1),this.words[i]=t?this.words[i]|1<<r:this.words[i]&~(1<<r),this.strip()},o.prototype.iadd=function(e){var t,i,n;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(i=this,n=e):(i=e,n=this);for(var r=0,o=0;o<n.length;o++)t=(0|i.words[o])+(0|n.words[o])+r,this.words[o]=67108863&t,r=t>>>26;for(;0!==r&&o<i.length;o++)t=(0|i.words[o])+r,this.words[o]=67108863&t,r=t>>>26;if(this.length=i.length,0!==r)this.words[this.length]=r,this.length++;else if(i!==this)for(;o<i.length;o++)this.words[o]=i.words[o];return this},o.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var i,n,r=this.cmp(e);if(0===r)return this.negative=0,this.length=1,this.words[0]=0,this;r>0?(i=this,n=e):(i=e,n=this);for(var o=0,s=0;s<n.length;s++)o=(t=(0|i.words[s])-(0|n.words[s])+o)>>26,this.words[s]=67108863&t;for(;0!==o&&s<i.length;s++)o=(t=(0|i.words[s])+o)>>26,this.words[s]=67108863&t;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(e){return this.clone().isub(e)};var p=function(e,t,i){var n,r,o,s=e.words,a=t.words,c=i.words,d=0,l=0|s[0],u=8191&l,h=l>>>13,f=0|s[1],p=8191&f,g=f>>>13,v=0|s[2],m=8191&v,y=v>>>13,b=0|s[3],S=8191&b,_=b>>>13,E=0|s[4],w=8191&E,T=E>>>13,I=0|s[5],R=8191&I,M=I>>>13,k=0|s[6],C=8191&k,O=k>>>13,A=0|s[7],P=8191&A,D=A>>>13,x=0|s[8],L=8191&x,U=x>>>13,B=0|s[9],N=8191&B,j=B>>>13,F=0|a[0],K=8191&F,q=F>>>13,$=0|a[1],V=8191&$,H=$>>>13,W=0|a[2],G=8191&W,z=W>>>13,Y=0|a[3],J=8191&Y,Q=Y>>>13,X=0|a[4],Z=8191&X,ee=X>>>13,te=0|a[5],ie=8191&te,ne=te>>>13,re=0|a[6],oe=8191&re,se=re>>>13,ae=0|a[7],ce=8191&ae,de=ae>>>13,le=0|a[8],ue=8191&le,he=le>>>13,fe=0|a[9],pe=8191&fe,ge=fe>>>13;i.negative=e.negative^t.negative,i.length=19;var ve=(d+(n=Math.imul(u,K))|0)+((8191&(r=(r=Math.imul(u,q))+Math.imul(h,K)|0))<<13)|0;d=((o=Math.imul(h,q))+(r>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(p,K),r=(r=Math.imul(p,q))+Math.imul(g,K)|0,o=Math.imul(g,q);var me=(d+(n=n+Math.imul(u,V)|0)|0)+((8191&(r=(r=r+Math.imul(u,H)|0)+Math.imul(h,V)|0))<<13)|0;d=((o=o+Math.imul(h,H)|0)+(r>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(m,K),r=(r=Math.imul(m,q))+Math.imul(y,K)|0,o=Math.imul(y,q),n=n+Math.imul(p,V)|0,r=(r=r+Math.imul(p,H)|0)+Math.imul(g,V)|0,o=o+Math.imul(g,H)|0;var ye=(d+(n=n+Math.imul(u,G)|0)|0)+((8191&(r=(r=r+Math.imul(u,z)|0)+Math.imul(h,G)|0))<<13)|0;d=((o=o+Math.imul(h,z)|0)+(r>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(S,K),r=(r=Math.imul(S,q))+Math.imul(_,K)|0,o=Math.imul(_,q),n=n+Math.imul(m,V)|0,r=(r=r+Math.imul(m,H)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,H)|0,n=n+Math.imul(p,G)|0,r=(r=r+Math.imul(p,z)|0)+Math.imul(g,G)|0,o=o+Math.imul(g,z)|0;var be=(d+(n=n+Math.imul(u,J)|0)|0)+((8191&(r=(r=r+Math.imul(u,Q)|0)+Math.imul(h,J)|0))<<13)|0;d=((o=o+Math.imul(h,Q)|0)+(r>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(w,K),r=(r=Math.imul(w,q))+Math.imul(T,K)|0,o=Math.imul(T,q),n=n+Math.imul(S,V)|0,r=(r=r+Math.imul(S,H)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,H)|0,n=n+Math.imul(m,G)|0,r=(r=r+Math.imul(m,z)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,z)|0,n=n+Math.imul(p,J)|0,r=(r=r+Math.imul(p,Q)|0)+Math.imul(g,J)|0,o=o+Math.imul(g,Q)|0;var Se=(d+(n=n+Math.imul(u,Z)|0)|0)+((8191&(r=(r=r+Math.imul(u,ee)|0)+Math.imul(h,Z)|0))<<13)|0;d=((o=o+Math.imul(h,ee)|0)+(r>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(R,K),r=(r=Math.imul(R,q))+Math.imul(M,K)|0,o=Math.imul(M,q),n=n+Math.imul(w,V)|0,r=(r=r+Math.imul(w,H)|0)+Math.imul(T,V)|0,o=o+Math.imul(T,H)|0,n=n+Math.imul(S,G)|0,r=(r=r+Math.imul(S,z)|0)+Math.imul(_,G)|0,o=o+Math.imul(_,z)|0,n=n+Math.imul(m,J)|0,r=(r=r+Math.imul(m,Q)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,Q)|0,n=n+Math.imul(p,Z)|0,r=(r=r+Math.imul(p,ee)|0)+Math.imul(g,Z)|0,o=o+Math.imul(g,ee)|0;var _e=(d+(n=n+Math.imul(u,ie)|0)|0)+((8191&(r=(r=r+Math.imul(u,ne)|0)+Math.imul(h,ie)|0))<<13)|0;d=((o=o+Math.imul(h,ne)|0)+(r>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(C,K),r=(r=Math.imul(C,q))+Math.imul(O,K)|0,o=Math.imul(O,q),n=n+Math.imul(R,V)|0,r=(r=r+Math.imul(R,H)|0)+Math.imul(M,V)|0,o=o+Math.imul(M,H)|0,n=n+Math.imul(w,G)|0,r=(r=r+Math.imul(w,z)|0)+Math.imul(T,G)|0,o=o+Math.imul(T,z)|0,n=n+Math.imul(S,J)|0,r=(r=r+Math.imul(S,Q)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,Q)|0,n=n+Math.imul(m,Z)|0,r=(r=r+Math.imul(m,ee)|0)+Math.imul(y,Z)|0,o=o+Math.imul(y,ee)|0,n=n+Math.imul(p,ie)|0,r=(r=r+Math.imul(p,ne)|0)+Math.imul(g,ie)|0,o=o+Math.imul(g,ne)|0;var Ee=(d+(n=n+Math.imul(u,oe)|0)|0)+((8191&(r=(r=r+Math.imul(u,se)|0)+Math.imul(h,oe)|0))<<13)|0;d=((o=o+Math.imul(h,se)|0)+(r>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(P,K),r=(r=Math.imul(P,q))+Math.imul(D,K)|0,o=Math.imul(D,q),n=n+Math.imul(C,V)|0,r=(r=r+Math.imul(C,H)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,H)|0,n=n+Math.imul(R,G)|0,r=(r=r+Math.imul(R,z)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,z)|0,n=n+Math.imul(w,J)|0,r=(r=r+Math.imul(w,Q)|0)+Math.imul(T,J)|0,o=o+Math.imul(T,Q)|0,n=n+Math.imul(S,Z)|0,r=(r=r+Math.imul(S,ee)|0)+Math.imul(_,Z)|0,o=o+Math.imul(_,ee)|0,n=n+Math.imul(m,ie)|0,r=(r=r+Math.imul(m,ne)|0)+Math.imul(y,ie)|0,o=o+Math.imul(y,ne)|0,n=n+Math.imul(p,oe)|0,r=(r=r+Math.imul(p,se)|0)+Math.imul(g,oe)|0,o=o+Math.imul(g,se)|0;var we=(d+(n=n+Math.imul(u,ce)|0)|0)+((8191&(r=(r=r+Math.imul(u,de)|0)+Math.imul(h,ce)|0))<<13)|0;d=((o=o+Math.imul(h,de)|0)+(r>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(L,K),r=(r=Math.imul(L,q))+Math.imul(U,K)|0,o=Math.imul(U,q),n=n+Math.imul(P,V)|0,r=(r=r+Math.imul(P,H)|0)+Math.imul(D,V)|0,o=o+Math.imul(D,H)|0,n=n+Math.imul(C,G)|0,r=(r=r+Math.imul(C,z)|0)+Math.imul(O,G)|0,o=o+Math.imul(O,z)|0,n=n+Math.imul(R,J)|0,r=(r=r+Math.imul(R,Q)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,Q)|0,n=n+Math.imul(w,Z)|0,r=(r=r+Math.imul(w,ee)|0)+Math.imul(T,Z)|0,o=o+Math.imul(T,ee)|0,n=n+Math.imul(S,ie)|0,r=(r=r+Math.imul(S,ne)|0)+Math.imul(_,ie)|0,o=o+Math.imul(_,ne)|0,n=n+Math.imul(m,oe)|0,r=(r=r+Math.imul(m,se)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,se)|0,n=n+Math.imul(p,ce)|0,r=(r=r+Math.imul(p,de)|0)+Math.imul(g,ce)|0,o=o+Math.imul(g,de)|0;var Te=(d+(n=n+Math.imul(u,ue)|0)|0)+((8191&(r=(r=r+Math.imul(u,he)|0)+Math.imul(h,ue)|0))<<13)|0;d=((o=o+Math.imul(h,he)|0)+(r>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(N,K),r=(r=Math.imul(N,q))+Math.imul(j,K)|0,o=Math.imul(j,q),n=n+Math.imul(L,V)|0,r=(r=r+Math.imul(L,H)|0)+Math.imul(U,V)|0,o=o+Math.imul(U,H)|0,n=n+Math.imul(P,G)|0,r=(r=r+Math.imul(P,z)|0)+Math.imul(D,G)|0,o=o+Math.imul(D,z)|0,n=n+Math.imul(C,J)|0,r=(r=r+Math.imul(C,Q)|0)+Math.imul(O,J)|0,o=o+Math.imul(O,Q)|0,n=n+Math.imul(R,Z)|0,r=(r=r+Math.imul(R,ee)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,ee)|0,n=n+Math.imul(w,ie)|0,r=(r=r+Math.imul(w,ne)|0)+Math.imul(T,ie)|0,o=o+Math.imul(T,ne)|0,n=n+Math.imul(S,oe)|0,r=(r=r+Math.imul(S,se)|0)+Math.imul(_,oe)|0,o=o+Math.imul(_,se)|0,n=n+Math.imul(m,ce)|0,r=(r=r+Math.imul(m,de)|0)+Math.imul(y,ce)|0,o=o+Math.imul(y,de)|0,n=n+Math.imul(p,ue)|0,r=(r=r+Math.imul(p,he)|0)+Math.imul(g,ue)|0,o=o+Math.imul(g,he)|0;var Ie=(d+(n=n+Math.imul(u,pe)|0)|0)+((8191&(r=(r=r+Math.imul(u,ge)|0)+Math.imul(h,pe)|0))<<13)|0;d=((o=o+Math.imul(h,ge)|0)+(r>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(N,V),r=(r=Math.imul(N,H))+Math.imul(j,V)|0,o=Math.imul(j,H),n=n+Math.imul(L,G)|0,r=(r=r+Math.imul(L,z)|0)+Math.imul(U,G)|0,o=o+Math.imul(U,z)|0,n=n+Math.imul(P,J)|0,r=(r=r+Math.imul(P,Q)|0)+Math.imul(D,J)|0,o=o+Math.imul(D,Q)|0,n=n+Math.imul(C,Z)|0,r=(r=r+Math.imul(C,ee)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,ee)|0,n=n+Math.imul(R,ie)|0,r=(r=r+Math.imul(R,ne)|0)+Math.imul(M,ie)|0,o=o+Math.imul(M,ne)|0,n=n+Math.imul(w,oe)|0,r=(r=r+Math.imul(w,se)|0)+Math.imul(T,oe)|0,o=o+Math.imul(T,se)|0,n=n+Math.imul(S,ce)|0,r=(r=r+Math.imul(S,de)|0)+Math.imul(_,ce)|0,o=o+Math.imul(_,de)|0,n=n+Math.imul(m,ue)|0,r=(r=r+Math.imul(m,he)|0)+Math.imul(y,ue)|0,o=o+Math.imul(y,he)|0;var Re=(d+(n=n+Math.imul(p,pe)|0)|0)+((8191&(r=(r=r+Math.imul(p,ge)|0)+Math.imul(g,pe)|0))<<13)|0;d=((o=o+Math.imul(g,ge)|0)+(r>>>13)|0)+(Re>>>26)|0,Re&=67108863,n=Math.imul(N,G),r=(r=Math.imul(N,z))+Math.imul(j,G)|0,o=Math.imul(j,z),n=n+Math.imul(L,J)|0,r=(r=r+Math.imul(L,Q)|0)+Math.imul(U,J)|0,o=o+Math.imul(U,Q)|0,n=n+Math.imul(P,Z)|0,r=(r=r+Math.imul(P,ee)|0)+Math.imul(D,Z)|0,o=o+Math.imul(D,ee)|0,n=n+Math.imul(C,ie)|0,r=(r=r+Math.imul(C,ne)|0)+Math.imul(O,ie)|0,o=o+Math.imul(O,ne)|0,n=n+Math.imul(R,oe)|0,r=(r=r+Math.imul(R,se)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,se)|0,n=n+Math.imul(w,ce)|0,r=(r=r+Math.imul(w,de)|0)+Math.imul(T,ce)|0,o=o+Math.imul(T,de)|0,n=n+Math.imul(S,ue)|0,r=(r=r+Math.imul(S,he)|0)+Math.imul(_,ue)|0,o=o+Math.imul(_,he)|0;var Me=(d+(n=n+Math.imul(m,pe)|0)|0)+((8191&(r=(r=r+Math.imul(m,ge)|0)+Math.imul(y,pe)|0))<<13)|0;d=((o=o+Math.imul(y,ge)|0)+(r>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(N,J),r=(r=Math.imul(N,Q))+Math.imul(j,J)|0,o=Math.imul(j,Q),n=n+Math.imul(L,Z)|0,r=(r=r+Math.imul(L,ee)|0)+Math.imul(U,Z)|0,o=o+Math.imul(U,ee)|0,n=n+Math.imul(P,ie)|0,r=(r=r+Math.imul(P,ne)|0)+Math.imul(D,ie)|0,o=o+Math.imul(D,ne)|0,n=n+Math.imul(C,oe)|0,r=(r=r+Math.imul(C,se)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,se)|0,n=n+Math.imul(R,ce)|0,r=(r=r+Math.imul(R,de)|0)+Math.imul(M,ce)|0,o=o+Math.imul(M,de)|0,n=n+Math.imul(w,ue)|0,r=(r=r+Math.imul(w,he)|0)+Math.imul(T,ue)|0,o=o+Math.imul(T,he)|0;var ke=(d+(n=n+Math.imul(S,pe)|0)|0)+((8191&(r=(r=r+Math.imul(S,ge)|0)+Math.imul(_,pe)|0))<<13)|0;d=((o=o+Math.imul(_,ge)|0)+(r>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(N,Z),r=(r=Math.imul(N,ee))+Math.imul(j,Z)|0,o=Math.imul(j,ee),n=n+Math.imul(L,ie)|0,r=(r=r+Math.imul(L,ne)|0)+Math.imul(U,ie)|0,o=o+Math.imul(U,ne)|0,n=n+Math.imul(P,oe)|0,r=(r=r+Math.imul(P,se)|0)+Math.imul(D,oe)|0,o=o+Math.imul(D,se)|0,n=n+Math.imul(C,ce)|0,r=(r=r+Math.imul(C,de)|0)+Math.imul(O,ce)|0,o=o+Math.imul(O,de)|0,n=n+Math.imul(R,ue)|0,r=(r=r+Math.imul(R,he)|0)+Math.imul(M,ue)|0,o=o+Math.imul(M,he)|0;var Ce=(d+(n=n+Math.imul(w,pe)|0)|0)+((8191&(r=(r=r+Math.imul(w,ge)|0)+Math.imul(T,pe)|0))<<13)|0;d=((o=o+Math.imul(T,ge)|0)+(r>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(N,ie),r=(r=Math.imul(N,ne))+Math.imul(j,ie)|0,o=Math.imul(j,ne),n=n+Math.imul(L,oe)|0,r=(r=r+Math.imul(L,se)|0)+Math.imul(U,oe)|0,o=o+Math.imul(U,se)|0,n=n+Math.imul(P,ce)|0,r=(r=r+Math.imul(P,de)|0)+Math.imul(D,ce)|0,o=o+Math.imul(D,de)|0,n=n+Math.imul(C,ue)|0,r=(r=r+Math.imul(C,he)|0)+Math.imul(O,ue)|0,o=o+Math.imul(O,he)|0;var Oe=(d+(n=n+Math.imul(R,pe)|0)|0)+((8191&(r=(r=r+Math.imul(R,ge)|0)+Math.imul(M,pe)|0))<<13)|0;d=((o=o+Math.imul(M,ge)|0)+(r>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(N,oe),r=(r=Math.imul(N,se))+Math.imul(j,oe)|0,o=Math.imul(j,se),n=n+Math.imul(L,ce)|0,r=(r=r+Math.imul(L,de)|0)+Math.imul(U,ce)|0,o=o+Math.imul(U,de)|0,n=n+Math.imul(P,ue)|0,r=(r=r+Math.imul(P,he)|0)+Math.imul(D,ue)|0,o=o+Math.imul(D,he)|0;var Ae=(d+(n=n+Math.imul(C,pe)|0)|0)+((8191&(r=(r=r+Math.imul(C,ge)|0)+Math.imul(O,pe)|0))<<13)|0;d=((o=o+Math.imul(O,ge)|0)+(r>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(N,ce),r=(r=Math.imul(N,de))+Math.imul(j,ce)|0,o=Math.imul(j,de),n=n+Math.imul(L,ue)|0,r=(r=r+Math.imul(L,he)|0)+Math.imul(U,ue)|0,o=o+Math.imul(U,he)|0;var Pe=(d+(n=n+Math.imul(P,pe)|0)|0)+((8191&(r=(r=r+Math.i