npm.asn1.js.b4e99b8ff4ec3b233679.0.1.0.js 65 KB

1
  1. (window.webpackJsonp=window.webpackJsonp||[]).push([["npm.asn1.js"],{"0211":function(t,e,r){var i=e;i._reverse=function(t){var e={};return Object.keys(t).forEach((function(r){(0|r)==r&&(r|=0);var i=t[r];e[i]=r})),e},i.der=r("8b71")},"20f6":function(t,e,r){var i=e;i.der=r("cfbd"),i.pem=r("8df7")},"343e":function(t,e,r){var i=e;i.der=r("3768"),i.pem=r("85b3")},3768:function(t,e,r){var i=r("3fb5"),n=r("b639").Buffer,o=r("7f7a"),s=o.base,h=o.constants.der;function u(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new a,this.tree._init(t.body)}function a(t){s.Node.call(this,"der",t)}function l(t){return t<10?"0"+t:t}function f(t,e,r,i){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 i.error("Unknown tag: "+t);n=t}return n>=31?i.error("Multi-octet tag encoding unsupported"):(e||(n|=32),n|=h.tagClassByName[r||"universal"]<<6)}t.exports=u,u.prototype.encode=function(t,e){return this.tree._encode(t,e).join()},i(a,s.Node),a.prototype._encodeComposite=function(t,e,r,i){var o=f(t,e,r,this.reporter);if(i.length<128){var s=new n(2);return s[0]=o,s[1]=i.length,this._createEncoderBuffer([s,i])}for(var h=1,u=i.length;u>=256;u>>=8)h++;(s=new n(2+h))[0]=o,s[1]=128|h,u=1+h;for(var a=i.length;a>0;u--,a>>=8)s[u]=255&a;return this._createEncoderBuffer([s,i])},a.prototype._encodeStr=function(t,e){if("bitstr"===e)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===e){for(var r=new n(2*t.length),i=0;i<t.length;i++)r.writeUInt16BE(t.charCodeAt(i),2*i);return this._createEncoderBuffer(r)}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")},a.prototype._encodeObjid=function(t,e,r){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 i=0;i<t.length;i++)t[i]|=0}else if(Array.isArray(t))for(t=t.slice(),i=0;i<t.length;i++)t[i]|=0;if(!Array.isArray(t))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(t));if(!r){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(i=0;i<t.length;i++){var s=t[i];for(o++;s>=128;s>>=7)o++}var h=new n(o),u=h.length-1;for(i=t.length-1;i>=0;i--)for(s=t[i],h[u--]=127&s;(s>>=7)>0;)h[u--]=128|127&s;return this._createEncoderBuffer(h)},a.prototype._encodeTime=function(t,e){var r,i=new Date(t);return"gentime"===e?r=[l(i.getFullYear()),l(i.getUTCMonth()+1),l(i.getUTCDate()),l(i.getUTCHours()),l(i.getUTCMinutes()),l(i.getUTCSeconds()),"Z"].join(""):"utctime"===e?r=[l(i.getFullYear()%100),l(i.getUTCMonth()+1),l(i.getUTCDate()),l(i.getUTCHours()),l(i.getUTCMinutes()),l(i.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+e+" time is not supported yet"),this._encodeStr(r,"octstr")},a.prototype._encodeNull=function(){return this._createEncoderBuffer("")},a.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 r=t.toArray();!t.sign&&128&r[0]&&r.unshift(0),t=new n(r)}if(n.isBuffer(t)){var i=t.length;0===t.length&&i++;var o=new n(i);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]);i=1;for(var s=t;s>=256;s>>=8)i++;for(s=(o=new Array(i)).length-1;s>=0;s--)o[s]=255&t,t>>=8;return 128&o[0]&&o.unshift(0),this._createEncoderBuffer(new n(o))},a.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)},a.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getEncoder("der").tree},a.prototype._skipDefault=function(t,e,r){var i,n=this._baseState;if(null===n.default)return!1;var o=t.join();if(void 0===n.defaultBuffer&&(n.defaultBuffer=this._encodeValue(n.default,e,r).join()),o.length!==n.defaultBuffer.length)return!1;for(i=0;i<o.length;i++)if(o[i]!==n.defaultBuffer[i])return!1;return!0}},"41df":function(t,e,r){var i=e;i.Reporter=r("d1c8").Reporter,i.DecoderBuffer=r("6283").DecoderBuffer,i.EncoderBuffer=r("6283").EncoderBuffer,i.Node=r("8360")},6283:function(t,e,r){var i=r("3fb5"),n=r("41df").Reporter,o=r("b639").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}}i(s,n),e.DecoderBuffer=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 r=new s(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+t,this.offset+=t,r},s.prototype.raw=function(t){return this.base.slice(t?t.offset:this.offset,this.length)},e.EncoderBuffer=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(r){r.join(t,e),e+=r.length})):("number"==typeof this.value?t[e]=this.value:"string"==typeof this.value?t.write(this.value,e):o.isBuffer(this.value)&&this.value.copy(t,e),e+=this.length)),t}},"7f7a":function(t,e,r){var i=e;i.bignum=r("bc12"),i.define=r("ef3a").define,i.base=r("41df"),i.constants=r("0211"),i.decoders=r("20f6"),i.encoders=r("343e")},8360:function(t,e,r){var i=r("41df").Reporter,n=r("41df").EncoderBuffer,o=r("41df").DecoderBuffer,s=r("da3e"),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"],u=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(h);function a(t,e){var r={};this._baseState=r,r.enc=t,r.parent=e||null,r.children=null,r.tag=null,r.args=null,r.reverseArgs=null,r.choice=null,r.optional=!1,r.any=!1,r.obj=!1,r.use=null,r.useDecoder=null,r.key=null,r.default=null,r.explicit=null,r.implicit=null,r.contains=null,r.parent||(r.children=[],this._wrap())}t.exports=a;var l=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];a.prototype.clone=function(){var t=this._baseState,e={};l.forEach((function(r){e[r]=t[r]}));var r=new this.constructor(e.parent);return r._baseState=e,r},a.prototype._wrap=function(){var t=this._baseState;u.forEach((function(e){this[e]=function(){var r=new this.constructor(this);return t.children.push(r),r[e].apply(r,arguments)}}),this)},a.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")},a.prototype._useArgs=function(t){var e=this._baseState,r=t.filter((function(t){return t instanceof this.constructor}),this);t=t.filter((function(t){return!(t instanceof this.constructor)}),this),0!==r.length&&(s(null===e.children),e.children=r,r.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(r){r==(0|r)&&(r|=0);var i=t[r];e[i]=r})),e})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(t){a.prototype[t]=function(){var e=this._baseState;throw new Error(t+" not implemented for encoding: "+e.enc)}})),h.forEach((function(t){a.prototype[t]=function(){var e=this._baseState,r=Array.prototype.slice.call(arguments);return s(null===e.tag),e.tag=t,this._useArgs(r),this}})),a.prototype.use=function(t){s(t);var e=this._baseState;return s(null===e.use),e.use=t,this},a.prototype.optional=function(){return this._baseState.optional=!0,this},a.prototype.def=function(t){var e=this._baseState;return s(null===e.default),e.default=t,e.optional=!0,this},a.prototype.explicit=function(t){var e=this._baseState;return s(null===e.explicit&&null===e.implicit),e.explicit=t,this},a.prototype.implicit=function(t){var e=this._baseState;return s(null===e.explicit&&null===e.implicit),e.implicit=t,this},a.prototype.obj=function(){var t=this._baseState,e=Array.prototype.slice.call(arguments);return t.obj=!0,0!==e.length&&this._useArgs(e),this},a.prototype.key=function(t){var e=this._baseState;return s(null===e.key),e.key=t,this},a.prototype.any=function(){return this._baseState.any=!0,this},a.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},a.prototype.contains=function(t){var e=this._baseState;return s(null===e.use),e.contains=t,this},a.prototype._decode=function(t,e){var r=this._baseState;if(null===r.parent)return t.wrapResult(r.children[0]._decode(t,e));var i,n=r.default,s=!0,h=null;if(null!==r.key&&(h=t.enterKey(r.key)),r.optional){var u=null;if(null!==r.explicit?u=r.explicit:null!==r.implicit?u=r.implicit:null!==r.tag&&(u=r.tag),null!==u||r.any){if(s=this._peekTag(t,u,r.any),t.isError(s))return s}else{var a=t.save();try{null===r.choice?this._decodeGeneric(r.tag,t,e):this._decodeChoice(t,e),s=!0}catch(t){s=!1}t.restore(a)}}if(r.obj&&s&&(i=t.enterObject()),s){if(null!==r.explicit){var l=this._decodeTag(t,r.explicit);if(t.isError(l))return l;t=l}var f=t.offset;if(null===r.use&&null===r.choice){r.any&&(a=t.save());var c=this._decodeTag(t,null!==r.implicit?r.implicit:r.tag,r.any);if(t.isError(c))return c;r.any?n=t.raw(a):t=c}if(e&&e.track&&null!==r.tag&&e.track(t.path(),f,t.length,"tagged"),e&&e.track&&null!==r.tag&&e.track(t.path(),t.offset,t.length,"content"),n=r.any?n:null===r.choice?this._decodeGeneric(r.tag,t,e):this._decodeChoice(t,e),t.isError(n))return n;if(r.any||null!==r.choice||null===r.children||r.children.forEach((function(r){r._decode(t,e)})),r.contains&&("octstr"===r.tag||"bitstr"===r.tag)){var d=new o(n);n=this._getUse(r.contains,t._reporterState.obj)._decode(d,e)}}return r.obj&&s&&(n=t.leaveObject(i)),null===r.key||null===n&&!0!==s?null!==h&&t.exitKey(h):t.leaveKey(h,r.key,n),n},a.prototype._decodeGeneric=function(t,e,r){var i=this._baseState;return"seq"===t||"set"===t?null:"seqof"===t||"setof"===t?this._decodeList(e,t,i.args[0],r):/str$/.test(t)?this._decodeStr(e,t,r):"objid"===t&&i.args?this._decodeObjid(e,i.args[0],i.args[1],r):"objid"===t?this._decodeObjid(e,null,null,r):"gentime"===t||"utctime"===t?this._decodeTime(e,t,r):"null_"===t?this._decodeNull(e,r):"bool"===t?this._decodeBool(e,r):"objDesc"===t?this._decodeStr(e,t,r):"int"===t||"enum"===t?this._decodeInt(e,i.args&&i.args[0],r):null!==i.use?this._getUse(i.use,e._reporterState.obj)._decode(e,r):e.error("unknown tag: "+t)},a.prototype._getUse=function(t,e){var r=this._baseState;return r.useDecoder=this._use(t,e),s(null===r.useDecoder._baseState.parent),r.useDecoder=r.useDecoder._baseState.children[0],r.implicit!==r.useDecoder._baseState.implicit&&(r.useDecoder=r.useDecoder.clone(),r.useDecoder._baseState.implicit=r.implicit),r.useDecoder},a.prototype._decodeChoice=function(t,e){var r=this._baseState,i=null,n=!1;return Object.keys(r.choice).some((function(o){var s=t.save(),h=r.choice[o];try{var u=h._decode(t,e);if(t.isError(u))return!1;i={type:o,value:u},n=!0}catch(e){return t.restore(s),!1}return!0}),this),n?i:t.error("Choice not matched")},a.prototype._createEncoderBuffer=function(t){return new n(t,this.reporter)},a.prototype._encode=function(t,e,r){var i=this._baseState;if(null===i.default||i.default!==t){var n=this._encodeValue(t,e,r);if(void 0!==n&&!this._skipDefault(n,e,r))return n}},a.prototype._encodeValue=function(t,e,r){var n=this._baseState;if(null===n.parent)return n.children[0]._encode(t,e||new i);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,r)._encode(t,e),h=!0;else if(n.children)s=n.children.map((function(r){if("null_"===r._baseState.tag)return r._encode(null,e,t);if(null===r._baseState.key)return e.error("Child should have a key");var i=e.enterKey(r._baseState.key);if("object"!=typeof t)return e.error("Child expected, but input is not object");var n=r._encode(t[r._baseState.key],e,t);return e.leaveKey(i),n}),this).filter((function(t){return t})),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 u=this.clone();u._baseState.implicit=null,s=this._createEncoderBuffer(t.map((function(r){var i=this._baseState;return this._getUse(i.args[0],t)._encode(r,e)}),u))}else null!==n.use?o=this._getUse(n.use,r)._encode(t,e):(s=this._encodePrimitive(n.tag,t),h=!0);if(!n.any&&null===n.choice){var a=null!==n.implicit?n.implicit:n.tag,l=null===n.implicit?"universal":"context";null===a?null===n.use&&e.error("Tag could be omitted only for .use()"):null===n.use&&(o=this._encodeComposite(a,h,l,s))}return null!==n.explicit&&(o=this._encodeComposite(n.explicit,!1,"context",o)),o},a.prototype._encodeChoice=function(t,e){var r=this._baseState,i=r.choice[t.type];return i||s(!1,t.type+" not found in "+JSON.stringify(Object.keys(r.choice))),i._encode(t.value,e)},a.prototype._encodePrimitive=function(t,e){var r=this._baseState;if(/str$/.test(t))return this._encodeStr(e,t);if("objid"===t&&r.args)return this._encodeObjid(e,r.reverseArgs[0],r.args[1]);if("objid"===t)return this._encodeObjid(e,null,null);if("gentime"===t||"utctime"===t)return this._encodeTime(e,t);if("null_"===t)return this._encodeNull();if("int"===t||"enum"===t)return this._encodeInt(e,r.args&&r.reverseArgs[0]);if("bool"===t)return this._encodeBool(e);if("objDesc"===t)return this._encodeStr(e,t);throw new Error("Unsupported tag: "+t)},a.prototype._isNumstr=function(t){return/^[0-9 ]*$/.test(t)},a.prototype._isPrintstr=function(t){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(t)}},"85b3":function(t,e,r){var i=r("3fb5"),n=r("3768");function o(t){n.call(this,t),this.enc="pem"}i(o,n),t.exports=o,o.prototype.encode=function(t,e){for(var r=n.prototype.encode.call(this,t).toString("base64"),i=["-----BEGIN "+e.label+"-----"],o=0;o<r.length;o+=64)i.push(r.slice(o,o+64));return i.push("-----END "+e.label+"-----"),i.join("\n")}},"8b71":function(t,e,r){var i=r("0211");e.tagClass={0:"universal",1:"application",2:"context",3:"private"},e.tagClassByName=i._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=i._reverse(e.tag)},"8df7":function(t,e,r){var i=r("3fb5"),n=r("b639").Buffer,o=r("cfbd");function s(t){o.call(this,t),this.enc="pem"}i(s,o),t.exports=s,s.prototype.decode=function(t,e){for(var r=t.toString().split(/[\r\n]+/g),i=e.label.toUpperCase(),s=/^-----(BEGIN|END) ([^-]+)-----$/,h=-1,u=-1,a=0;a<r.length;a++){var l=r[a].match(s);if(null!==l&&l[2]===i){if(-1!==h){if("END"!==l[1])break;u=a;break}if("BEGIN"!==l[1])break;h=a}}if(-1===h||-1===u)throw new Error("PEM section not found for: "+i);var f=r.slice(h+1,u).join("");f.replace(/[^a-z0-9\+\/=]+/gi,"");var c=new n(f,"base64");return o.prototype.decode.call(this,c,e)}},bc12:function(t,e,r){(function(t){!function(t,e){"use strict";function i(t,e){if(!t)throw new Error(e||"Assertion failed")}function n(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var s;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{s=r(13).Buffer}catch(t){}function h(t,e,r){for(var i=0,n=Math.min(t.length,r),o=e;o<n;o++){var s=t.charCodeAt(o)-48;i<<=4,i|=s>=49&&s<=54?s-49+10:s>=17&&s<=22?s-17+10:15&s}return i}function u(t,e,r,i){for(var n=0,o=Math.min(t.length,r),s=e;s<o;s++){var h=t.charCodeAt(s)-48;n*=i,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,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),i(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&n++,16===e?this._parseHex(t,n):this._parseBase(t,e,n),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initNumber=function(t,e,r){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):(i(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initArray=function(t,e,r){if(i("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"===r)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"===r)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){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 i,n,o=0;for(r=t.length-6,i=0;r>=e;r-=6)n=h(t,r,r+6),this.words[i]|=n<<o&67108863,this.words[i+1]|=n>>>26-o&4194303,(o+=24)>=26&&(o-=26,i++);r+6!==e&&(n=h(t,e,r+6),this.words[i]|=n<<o&67108863,this.words[i+1]|=n>>>26-o&4194303),this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=e)i++;i--,n=n/e|0;for(var o=t.length-r,s=o%i,h=Math.min(o,o-s)+r,a=0,l=r;l<h;l+=i)a=u(t,l,l+i,e),this.imuln(n),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a);if(0!==s){var f=1;for(a=u(t,l,t.length,e),l=0;l<s;l++)f*=e;this.imuln(f),this.words[0]+a<67108864?this.words[0]+=a:this._iaddn(a)}},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 a=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],f=[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,r){r.negative=e.negative^t.negative;var i=t.length+e.length|0;r.length=i,i=i-1|0;var n=0|t.words[0],o=0|e.words[0],s=n*o,h=67108863&s,u=s/67108864|0;r.words[0]=h;for(var a=1;a<i;a++){for(var l=u>>>26,f=67108863&u,c=Math.min(a,e.length-1),d=Math.max(0,a-t.length+1);d<=c;d++){var p=a-d|0;l+=(s=(n=0|t.words[p])*(o=0|e.words[d])+f)/67108864|0,f=67108863&s}r.words[a]=0|f,u=0|l}return 0!==u?r.words[a]=0|u:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var n=0,o=0,s=0;s<this.length;s++){var h=this.words[s],u=(16777215&(h<<n|o)).toString(16);r=0!==(o=h>>>24-n&16777215)||s!==this.length-1?a[6-u.length]+u+r:u+r,(n+=2)>=26&&(n-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var c=l[t],d=f[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(d).toString(t);r=(p=p.idivn(d)).isZero()?m+r:a[c-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!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&&i(!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 i(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,r){var n=this.byteLength(),o=r||Math.max(1,n);i(n<=o,"byte array longer than desired length"),i(o>0,"Requested array length <= 0"),this.strip();var s,h,u="le"===e,a=new t(o),l=this.clone();if(u){for(h=0;!l.isZero();h++)s=l.andln(255),l.iushrn(8),a[h]=s;for(;h<o;h++)a[h]=0}else{for(h=0;h<o-n;h++)a[h]=0;for(h=0;!l.isZero();h++)s=l.andln(255),l.iushrn(8),a[o-h-1]=s}return a},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,r=0;return e>=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},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 r=this._zeroBits(this.words[e]);if(t+=r,26!==r)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 i(0==(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 r=0;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},o.prototype.iand=function(t){return i(0==(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,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var i=0;i<r.length;i++)this.words[i]=e.words[i]^r.words[i];if(this!==e)for(;i<e.length;i++)this.words[i]=e.words[i];return this.length=e.length,this.strip()},o.prototype.ixor=function(t){return i(0==(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){i("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return r>0&&(this.words[n]=~this.words[n]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){i("number"==typeof t&&t>=0);var r=t/26|0,n=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<<n:this.words[r]&~(1<<n),this.strip()},o.prototype.iadd=function(t){var e,r,i;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?(r=this,i=t):(r=t,i=this);for(var n=0,o=0;o<i.length;o++)e=(0|r.words[o])+(0|i.words[o])+n,this.words[o]=67108863&e,n=e>>>26;for(;0!==n&&o<r.length;o++)e=(0|r.words[o])+n,this.words[o]=67108863&e,n=e>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,this.length++;else if(r!==this)for(;o<r.length;o++)this.words[o]=r.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 r,i,n=this.cmp(t);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(r=this,i=t):(r=t,i=this);for(var o=0,s=0;s<i.length;s++)o=(e=(0|r.words[s])-(0|i.words[s])+o)>>26,this.words[s]=67108863&e;for(;0!==o&&s<r.length;s++)o=(e=(0|r.words[s])+o)>>26,this.words[s]=67108863&e;if(0===o&&s<r.length&&r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=Math.max(this.length,s),r!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var d=function(t,e,r){var i,n,o,s=t.words,h=e.words,u=r.words,a=0,l=0|s[0],f=8191&l,c=l>>>13,d=0|s[1],p=8191&d,m=d>>>13,g=0|s[2],v=8191&g,y=g>>>13,M=0|s[3],w=8191&M,b=M>>>13,_=0|s[4],S=8191&_,k=_>>>13,E=0|s[5],B=8191&E,j=E>>>13,A=0|s[6],x=8191&A,N=A>>>13,D=0|s[7],T=8191&D,O=D>>>13,U=0|s[8],q=8191&U,C=U>>>13,I=0|s[9],R=8191&I,Z=I>>>13,L=0|h[0],P=8191&L,K=L>>>13,z=0|h[1],F=8191&z,J=z>>>13,$=0|h[2],G=8191&$,H=$>>>13,V=0|h[3],Y=8191&V,Q=V>>>13,W=0|h[4],X=8191&W,tt=W>>>13,et=0|h[5],rt=8191&et,it=et>>>13,nt=0|h[6],ot=8191&nt,st=nt>>>13,ht=0|h[7],ut=8191&ht,at=ht>>>13,lt=0|h[8],ft=8191&lt,ct=lt>>>13,dt=0|h[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(a+(i=Math.imul(f,P))|0)+((8191&(n=(n=Math.imul(f,K))+Math.imul(c,P)|0))<<13)|0;a=((o=Math.imul(c,K))+(n>>>13)|0)+(gt>>>26)|0,gt&=67108863,i=Math.imul(p,P),n=(n=Math.imul(p,K))+Math.imul(m,P)|0,o=Math.imul(m,K);var vt=(a+(i=i+Math.imul(f,F)|0)|0)+((8191&(n=(n=n+Math.imul(f,J)|0)+Math.imul(c,F)|0))<<13)|0;a=((o=o+Math.imul(c,J)|0)+(n>>>13)|0)+(vt>>>26)|0,vt&=67108863,i=Math.imul(v,P),n=(n=Math.imul(v,K))+Math.imul(y,P)|0,o=Math.imul(y,K),i=i+Math.imul(p,F)|0,n=(n=n+Math.imul(p,J)|0)+Math.imul(m,F)|0,o=o+Math.imul(m,J)|0;var yt=(a+(i=i+Math.imul(f,G)|0)|0)+((8191&(n=(n=n+Math.imul(f,H)|0)+Math.imul(c,G)|0))<<13)|0;a=((o=o+Math.imul(c,H)|0)+(n>>>13)|0)+(yt>>>26)|0,yt&=67108863,i=Math.imul(w,P),n=(n=Math.imul(w,K))+Math.imul(b,P)|0,o=Math.imul(b,K),i=i+Math.imul(v,F)|0,n=(n=n+Math.imul(v,J)|0)+Math.imul(y,F)|0,o=o+Math.imul(y,J)|0,i=i+Math.imul(p,G)|0,n=(n=n+Math.imul(p,H)|0)+Math.imul(m,G)|0,o=o+Math.imul(m,H)|0;var Mt=(a+(i=i+Math.imul(f,Y)|0)|0)+((8191&(n=(n=n+Math.imul(f,Q)|0)+Math.imul(c,Y)|0))<<13)|0;a=((o=o+Math.imul(c,Q)|0)+(n>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,i=Math.imul(S,P),n=(n=Math.imul(S,K))+Math.imul(k,P)|0,o=Math.imul(k,K),i=i+Math.imul(w,F)|0,n=(n=n+Math.imul(w,J)|0)+Math.imul(b,F)|0,o=o+Math.imul(b,J)|0,i=i+Math.imul(v,G)|0,n=(n=n+Math.imul(v,H)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,H)|0,i=i+Math.imul(p,Y)|0,n=(n=n+Math.imul(p,Q)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,Q)|0;var wt=(a+(i=i+Math.imul(f,X)|0)|0)+((8191&(n=(n=n+Math.imul(f,tt)|0)+Math.imul(c,X)|0))<<13)|0;a=((o=o+Math.imul(c,tt)|0)+(n>>>13)|0)+(wt>>>26)|0,wt&=67108863,i=Math.imul(B,P),n=(n=Math.imul(B,K))+Math.imul(j,P)|0,o=Math.imul(j,K),i=i+Math.imul(S,F)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul(k,F)|0,o=o+Math.imul(k,J)|0,i=i+Math.imul(w,G)|0,n=(n=n+Math.imul(w,H)|0)+Math.imul(b,G)|0,o=o+Math.imul(b,H)|0,i=i+Math.imul(v,Y)|0,n=(n=n+Math.imul(v,Q)|0)+Math.imul(y,Y)|0,o=o+Math.imul(y,Q)|0,i=i+Math.imul(p,X)|0,n=(n=n+Math.imul(p,tt)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,tt)|0;var bt=(a+(i=i+Math.imul(f,rt)|0)|0)+((8191&(n=(n=n+Math.imul(f,it)|0)+Math.imul(c,rt)|0))<<13)|0;a=((o=o+Math.imul(c,it)|0)+(n>>>13)|0)+(bt>>>26)|0,bt&=67108863,i=Math.imul(x,P),n=(n=Math.imul(x,K))+Math.imul(N,P)|0,o=Math.imul(N,K),i=i+Math.imul(B,F)|0,n=(n=n+Math.imul(B,J)|0)+Math.imul(j,F)|0,o=o+Math.imul(j,J)|0,i=i+Math.imul(S,G)|0,n=(n=n+Math.imul(S,H)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,H)|0,i=i+Math.imul(w,Y)|0,n=(n=n+Math.imul(w,Q)|0)+Math.imul(b,Y)|0,o=o+Math.imul(b,Q)|0,i=i+Math.imul(v,X)|0,n=(n=n+Math.imul(v,tt)|0)+Math.imul(y,X)|0,o=o+Math.imul(y,tt)|0,i=i+Math.imul(p,rt)|0,n=(n=n+Math.imul(p,it)|0)+Math.imul(m,rt)|0,o=o+Math.imul(m,it)|0;var _t=(a+(i=i+Math.imul(f,ot)|0)|0)+((8191&(n=(n=n+Math.imul(f,st)|0)+Math.imul(c,ot)|0))<<13)|0;a=((o=o+Math.imul(c,st)|0)+(n>>>13)|0)+(_t>>>26)|0,_t&=67108863,i=Math.imul(T,P),n=(n=Math.imul(T,K))+Math.imul(O,P)|0,o=Math.imul(O,K),i=i+Math.imul(x,F)|0,n=(n=n+Math.imul(x,J)|0)+Math.imul(N,F)|0,o=o+Math.imul(N,J)|0,i=i+Math.imul(B,G)|0,n=(n=n+Math.imul(B,H)|0)+Math.imul(j,G)|0,o=o+Math.imul(j,H)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,Q)|0)+Math.imul(k,Y)|0,o=o+Math.imul(k,Q)|0,i=i+Math.imul(w,X)|0,n=(n=n+Math.imul(w,tt)|0)+Math.imul(b,X)|0,o=o+Math.imul(b,tt)|0,i=i+Math.imul(v,rt)|0,n=(n=n+Math.imul(v,it)|0)+Math.imul(y,rt)|0,o=o+Math.imul(y,it)|0,i=i+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=(a+(i=i+Math.imul(f,ut)|0)|0)+((8191&(n=(n=n+Math.imul(f,at)|0)+Math.imul(c,ut)|0))<<13)|0;a=((o=o+Math.imul(c,at)|0)+(n>>>13)|0)+(St>>>26)|0,St&=67108863,i=Math.imul(q,P),n=(n=Math.imul(q,K))+Math.imul(C,P)|0,o=Math.imul(C,K),i=i+Math.imul(T,F)|0,n=(n=n+Math.imul(T,J)|0)+Math.imul(O,F)|0,o=o+Math.imul(O,J)|0,i=i+Math.imul(x,G)|0,n=(n=n+Math.imul(x,H)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,H)|0,i=i+Math.imul(B,Y)|0,n=(n=n+Math.imul(B,Q)|0)+Math.imul(j,Y)|0,o=o+Math.imul(j,Q)|0,i=i+Math.imul(S,X)|0,n=(n=n+Math.imul(S,tt)|0)+Math.imul(k,X)|0,o=o+Math.imul(k,tt)|0,i=i+Math.imul(w,rt)|0,n=(n=n+Math.imul(w,it)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,it)|0,i=i+Math.imul(v,ot)|0,n=(n=n+Math.imul(v,st)|0)+Math.imul(y,ot)|0,o=o+Math.imul(y,st)|0,i=i+Math.imul(p,ut)|0,n=(n=n+Math.imul(p,at)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,at)|0;var kt=(a+(i=i+Math.imul(f,ft)|0)|0)+((8191&(n=(n=n+Math.imul(f,ct)|0)+Math.imul(c,ft)|0))<<13)|0;a=((o=o+Math.imul(c,ct)|0)+(n>>>13)|0)+(kt>>>26)|0,kt&=67108863,i=Math.imul(R,P),n=(n=Math.imul(R,K))+Math.imul(Z,P)|0,o=Math.imul(Z,K),i=i+Math.imul(q,F)|0,n=(n=n+Math.imul(q,J)|0)+Math.imul(C,F)|0,o=o+Math.imul(C,J)|0,i=i+Math.imul(T,G)|0,n=(n=n+Math.imul(T,H)|0)+Math.imul(O,G)|0,o=o+Math.imul(O,H)|0,i=i+Math.imul(x,Y)|0,n=(n=n+Math.imul(x,Q)|0)+Math.imul(N,Y)|0,o=o+Math.imul(N,Q)|0,i=i+Math.imul(B,X)|0,n=(n=n+Math.imul(B,tt)|0)+Math.imul(j,X)|0,o=o+Math.imul(j,tt)|0,i=i+Math.imul(S,rt)|0,n=(n=n+Math.imul(S,it)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,it)|0,i=i+Math.imul(w,ot)|0,n=(n=n+Math.imul(w,st)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,st)|0,i=i+Math.imul(v,ut)|0,n=(n=n+Math.imul(v,at)|0)+Math.imul(y,ut)|0,o=o+Math.imul(y,at)|0,i=i+Math.imul(p,ft)|0,n=(n=n+Math.imul(p,ct)|0)+Math.imul(m,ft)|0,o=o+Math.imul(m,ct)|0;var Et=(a+(i=i+Math.imul(f,pt)|0)|0)+((8191&(n=(n=n+Math.imul(f,mt)|0)+Math.imul(c,pt)|0))<<13)|0;a=((o=o+Math.imul(c,mt)|0)+(n>>>13)|0)+(Et>>>26)|0,Et&=67108863,i=Math.imul(R,F),n=(n=Math.imul(R,J))+Math.imul(Z,F)|0,o=Math.imul(Z,J),i=i+Math.imul(q,G)|0,n=(n=n+Math.imul(q,H)|0)+Math.imul(C,G)|0,o=o+Math.imul(C,H)|0,i=i+Math.imul(T,Y)|0,n=(n=n+Math.imul(T,Q)|0)+Math.imul(O,Y)|0,o=o+Math.imul(O,Q)|0,i=i+Math.imul(x,X)|0,n=(n=n+Math.imul(x,tt)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,tt)|0,i=i+Math.imul(B,rt)|0,n=(n=n+Math.imul(B,it)|0)+Math.imul(j,rt)|0,o=o+Math.imul(j,it)|0,i=i+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,i=i+Math.imul(w,ut)|0,n=(n=n+Math.imul(w,at)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,at)|0,i=i+Math.imul(v,ft)|0,n=(n=n+Math.imul(v,ct)|0)+Math.imul(y,ft)|0,o=o+Math.imul(y,ct)|0;var Bt=(a+(i=i+Math.imul(p,pt)|0)|0)+((8191&(n=(n=n+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;a=((o=o+Math.imul(m,mt)|0)+(n>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,i=Math.imul(R,G),n=(n=Math.imul(R,H))+Math.imul(Z,G)|0,o=Math.imul(Z,H),i=i+Math.imul(q,Y)|0,n=(n=n+Math.imul(q,Q)|0)+Math.imul(C,Y)|0,o=o+Math.imul(C,Q)|0,i=i+Math.imul(T,X)|0,n=(n=n+Math.imul(T,tt)|0)+Math.imul(O,X)|0,o=o+Math.imul(O,tt)|0,i=i+Math.imul(x,rt)|0,n=(n=n+Math.imul(x,it)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,it)|0,i=i+Math.imul(B,ot)|0,n=(n=n+Math.imul(B,st)|0)+Math.imul(j,ot)|0,o=o+Math.imul(j,st)|0,i=i+Math.imul(S,ut)|0,n=(n=n+Math.imul(S,at)|0)+Math.imul(k,ut)|0,o=o+Math.imul(k,at)|0,i=i+Math.imul(w,ft)|0,n=(n=n+Math.imul(w,ct)|0)+Math.imul(b,ft)|0,o=o+Math.imul(b,ct)|0;var jt=(a+(i=i+Math.imul(v,pt)|0)|0)+((8191&(n=(n=n+Math.imul(v,mt)|0)+Math.imul(y,pt)|0))<<13)|0;a=((o=o+Math.imul(y,mt)|0)+(n>>>13)|0)+(jt>>>26)|0,jt&=67108863,i=Math.imul(R,Y),n=(n=Math.imul(R,Q))+Math.imul(Z,Y)|0,o=Math.imul(Z,Q),i=i+Math.imul(q,X)|0,n=(n=n+Math.imul(q,tt)|0)+Math.imul(C,X)|0,o=o+Math.imul(C,tt)|0,i=i+Math.imul(T,rt)|0,n=(n=n+Math.imul(T,it)|0)+Math.imul(O,rt)|0,o=o+Math.imul(O,it)|0,i=i+Math.imul(x,ot)|0,n=(n=n+Math.imul(x,st)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,st)|0,i=i+Math.imul(B,ut)|0,n=(n=n+Math.imul(B,at)|0)+Math.imul(j,ut)|0,o=o+Math.imul(j,at)|0,i=i+Math.imul(S,ft)|0,n=(n=n+Math.imul(S,ct)|0)+Math.imul(k,ft)|0,o=o+Math.imul(k,ct)|0;var At=(a+(i=i+Math.imul(w,pt)|0)|0)+((8191&(n=(n=n+Math.imul(w,mt)|0)+Math.imul(b,pt)|0))<<13)|0;a=((o=o+Math.imul(b,mt)|0)+(n>>>13)|0)+(At>>>26)|0,At&=67108863,i=Math.imul(R,X),n=(n=Math.imul(R,tt))+Math.imul(Z,X)|0,o=Math.imul(Z,tt),i=i+Math.imul(q,rt)|0,n=(n=n+Math.imul(q,it)|0)+Math.imul(C,rt)|0,o=o+Math.imul(C,it)|0,i=i+Math.imul(T,ot)|0,n=(n=n+Math.imul(T,st)|0)+Math.imul(O,ot)|0,o=o+Math.imul(O,st)|0,i=i+Math.imul(x,ut)|0,n=(n=n+Math.imul(x,at)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,at)|0,i=i+Math.imul(B,ft)|0,n=(n=n+Math.imul(B,ct)|0)+Math.imul(j,ft)|0,o=o+Math.imul(j,ct)|0;var xt=(a+(i=i+Math.imul(S,pt)|0)|0)+((8191&(n=(n=n+Math.imul(S,mt)|0)+Math.imul(k,pt)|0))<<13)|0;a=((o=o+Math.imul(k,mt)|0)+(n>>>13)|0)+(xt>>>26)|0,xt&=67108863,i=Math.imul(R,rt),n=(n=Math.imul(R,it))+Math.imul(Z,rt)|0,o=Math.imul(Z,it),i=i+Math.imul(q,ot)|0,n=(n=n+Math.imul(q,st)|0)+Math.imul(C,ot)|0,o=o+Math.imul(C,st)|0,i=i+Math.imul(T,ut)|0,n=(n=n+Math.imul(T,at)|0)+Math.imul(O,ut)|0,o=o+Math.imul(O,at)|0,i=i+Math.imul(x,ft)|0,n=(n=n+Math.imul(x,ct)|0)+Math.imul(N,ft)|0,o=o+Math.imul(N,ct)|0;var Nt=(a+(i=i+Math.imul(B,pt)|0)|0)+((8191&(n=(n=n+Math.imul(B,mt)|0)+Math.imul(j,pt)|0))<<13)|0;a=((o=o+Math.imul(j,mt)|0)+(n>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,i=Math.imul(R,ot),n=(n=Math.imul(R,st))+Math.imul(Z,ot)|0,o=Math.imul(Z,st),i=i+Math.imul(q,ut)|0,n=(n=n+Math.imul(q,at)|0)+Math.imul(C,ut)|0,o=o+Math.imul(C,at)|0,i=i+Math.imul(T,ft)|0,n=(n=n+Math.imul(T,ct)|0)+Math.imul(O,ft)|0,o=o+Math.imul(O,ct)|0;var Dt=(a+(i=i+Math.imul(x,pt)|0)|0)+((8191&(n=(n=n+Math.imul(x,mt)|0)+Math.imul(N,pt)|0))<<13)|0;a=((o=o+Math.imul(N,mt)|0)+(n>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,i=Math.imul(R,ut),n=(n=Math.imul(R,at))+Math.imul(Z,ut)|0,o=Math.imul(Z,at),i=i+Math.imul(q,ft)|0,n=(n=n+Math.imul(q,ct)|0)+Math.imul(C,ft)|0,o=o+Math.imul(C,ct)|0;var Tt=(a+(i=i+Math.imul(T,pt)|0)|0)+((8191&(n=(n=n+Math.imul(T,mt)|0)+Math.imul(O,pt)|0))<<13)|0;a=((o=o+Math.imul(O,mt)|0)+(n>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,i=Math.imul(R,ft),n=(n=Math.imul(R,ct))+Math.imul(Z,ft)|0,o=Math.imul(Z,ct);var Ot=(a+(i=i+Math.imul(q,pt)|0)|0)+((8191&(n=(n=n+Math.imul(q,mt)|0)+Math.imul(C,pt)|0))<<13)|0;a=((o=o+Math.imul(C,mt)|0)+(n>>>13)|0)+(Ot>>>26)|0,Ot&=67108863;var Ut=(a+(i=Math.imul(R,pt))|0)+((8191&(n=(n=Math.imul(R,mt))+Math.imul(Z,pt)|0))<<13)|0;return a=((o=Math.imul(Z,mt))+(n>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,u[0]=gt,u[1]=vt,u[2]=yt,u[3]=Mt,u[4]=wt,u[5]=bt,u[6]=_t,u[7]=St,u[8]=kt,u[9]=Et,u[10]=Bt,u[11]=jt,u[12]=At,u[13]=xt,u[14]=Nt,u[15]=Dt,u[16]=Tt,u[17]=Ot,u[18]=Ut,0!==a&&(u[19]=a,r.length++),r};function p(t,e,r){return(new m).mulp(t,e,r)}function m(t,e){this.x=t,this.y=e}Math.imul||(d=c),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?d(this,t,e):r<63?c(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var i=0,n=0,o=0;o<r.length-1;o++){var s=n;n=0;for(var h=67108863&i,u=Math.min(o,e.length-1),a=Math.max(0,o-t.length+1);a<=u;a++){var l=o-a,f=(0|t.words[l])*(0|e.words[a]),c=67108863&f;h=67108863&(c=c+h|0),n+=(s=(s=s+(f/67108864|0)|0)+(c>>>26)|0)>>>26,s&=67108863}r.words[o]=h,i=s,s=n}return 0!==i?r.words[o]=i:r.length--,r.strip()}(this,t,e):p(this,t,e)},m.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,i=0;i<t;i++)e[i]=this.revBin(i,r,t);return e},m.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var i=0,n=0;n<e;n++)i|=(1&t)<<e-n-1,t>>=1;return i},m.prototype.permute=function(t,e,r,i,n,o){for(var s=0;s<o;s++)i[s]=e[t[s]],n[s]=r[t[s]]},m.prototype.transform=function(t,e,r,i,n,o){this.permute(o,t,e,r,i,n);for(var s=1;s<n;s<<=1)for(var h=s<<1,u=Math.cos(2*Math.PI/h),a=Math.sin(2*Math.PI/h),l=0;l<n;l+=h)for(var f=u,c=a,d=0;d<s;d++){var p=r[l+d],m=i[l+d],g=r[l+d+s],v=i[l+d+s],y=f*g-c*v;v=f*v+c*g,g=y,r[l+d]=p+g,i[l+d]=m+v,r[l+d+s]=p-g,i[l+d+s]=m-v,d!==h&&(y=u*f-a*c,c=u*c+a*f,f=y)}},m.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},m.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=t[i];t[i]=t[r-i-1],t[r-i-1]=n,n=e[i],e[i]=-e[r-i-1],e[r-i-1]=-n}},m.prototype.normalize13b=function(t,e){for(var r=0,i=0;i<e/2;i++){var n=8192*Math.round(t[2*i+1]/e)+Math.round(t[2*i]/e)+r;t[i]=67108863&n,r=n<67108864?0:n/67108864|0}return t},m.prototype.convert13b=function(t,e,r,n){for(var o=0,s=0;s<e;s++)o+=0|t[s],r[2*s]=8191&o,o>>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*e;s<n;++s)r[s]=0;i(0===o),i(0==(-8192&o))},m.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},m.prototype.mulp=function(t,e,r){var i=2*this.guessLen13b(t.length,e.length),n=this.makeRBT(i),o=this.stub(i),s=new Array(i),h=new Array(i),u=new Array(i),a=new Array(i),l=new Array(i),f=new Array(i),c=r.words;c.length=i,this.convert13b(t.words,t.length,s,i),this.convert13b(e.words,e.length,a,i),this.transform(s,o,h,u,i,n),this.transform(a,o,l,f,i,n);for(var d=0;d<i;d++){var p=h[d]*l[d]-u[d]*f[d];u[d]=h[d]*f[d]+u[d]*l[d],h[d]=p}return this.conjugate(h,u,i),this.transform(h,u,c,o,i,n),this.conjugate(c,o,i),this.normalize13b(c,i),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.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),p(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){i("number"==typeof t),i(t<67108864);for(var e=0,r=0;r<this.length;r++){var n=(0|this.words[r])*t,o=(67108863&n)+(67108863&e);e>>=26,e+=n/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=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()),r=0;r<e.length;r++){var i=r/26|0,n=r%26;e[r]=(t.words[i]&1<<n)>>>n}return e}(t);if(0===e.length)return new o(1);for(var r=this,i=0;i<e.length&&0===e[i];i++,r=r.sqr());if(++i<e.length)for(var n=r.sqr();i<e.length;i++,n=n.sqr())0!==e[i]&&(r=r.mul(n));return r},o.prototype.iushln=function(t){i("number"==typeof t&&t>=0);var e,r=t%26,n=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(e=0;e<this.length;e++){var h=this.words[e]&o,u=(0|this.words[e])-h<<r;this.words[e]=u|s,s=h>>>26-r}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 i(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,r){var n;i("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,u=r;if(n-=s,n=Math.max(0,n),u){for(var a=0;a<s;a++)u.words[a]=this.words[a];u.length=s}if(0===s);else if(this.length>s)for(this.length-=s,a=0;a<this.length;a++)this.words[a]=this.words[a+s];else this.words[0]=0,this.length=1;var l=0;for(a=this.length-1;a>=0&&(0!==l||a>=n);a--){var f=0|this.words[a];this.words[a]=l<<26-o|f>>>o,l=f&h}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return i(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,n=1<<e;return!(this.length<=r)&&!!(this.words[r]&n)},o.prototype.imaskn=function(t){i("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;if(i(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var n=67108863^67108863>>>e<<e;this.words[this.length-1]&=n}return this.strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return i("number"==typeof t),i(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(i("number"==typeof t),i(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,r){var n,o,s=t.length+r;this._expand(s);var h=0;for(n=0;n<t.length;n++){o=(0|this.words[n+r])+h;var u=(0|t.words[n])*e;h=((o-=67108863&u)>>26)-(u/67108864|0),this.words[n+r]=67108863&o}for(;n<this.length-r;n++)h=(o=(0|this.words[n+r])+h)>>26,this.words[n+r]=67108863&o;if(0===h)return this.strip();for(i(-1===h),h=0,n=0;n<this.length;n++)h=(o=-(0|this.words[n])+h)>>26,this.words[n]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),i=this.clone(),n=t,s=0|n.words[n.length-1];0!==(r=26-this._countBits(s))&&(n=n.ushln(r),i.iushln(r),s=0|n.words[n.length-1]);var h,u=i.length-n.length;if("mod"!==e){(h=new o(null)).length=u+1,h.words=new Array(h.length);for(var a=0;a<h.length;a++)h.words[a]=0}var l=i.clone()._ishlnsubmul(n,1,u);0===l.negative&&(i=l,h&&(h.words[u]=1));for(var f=u-1;f>=0;f--){var c=67108864*(0|i.words[n.length+f])+(0|i.words[n.length+f-1]);for(c=Math.min(c/s|0,67108863),i._ishlnsubmul(n,c,f);0!==i.negative;)c--,i.negative=0,i._ishlnsubmul(n,1,f),i.isZero()||(i.negative^=1);h&&(h.words[f]=c)}return h&&h.strip(),i.strip(),"div"!==e&&0!==r&&i.iushrn(r),{div:h||null,mod:i}},o.prototype.divmod=function(t,e,r){return i(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(h=this.neg().divmod(t,e),"mod"!==e&&(n=h.div.neg()),"div"!==e&&(s=h.mod.neg(),r&&0!==s.negative&&s.iadd(t)),{div:n,mod:s}):0===this.negative&&0!==t.negative?(h=this.divmod(t.neg(),e),"mod"!==e&&(n=h.div.neg()),{div:n,mod:h.mod}):0!=(this.negative&t.negative)?(h=this.neg().divmod(t.neg(),e),"div"!==e&&(s=h.mod.neg(),r&&0!==s.negative&&s.isub(t)),{div:h.div,mod:s}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var n,s,h},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,i=t.ushrn(1),n=t.andln(1),o=r.cmp(i);return o<0||1===n&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){i(t<=67108863);for(var e=(1<<26)%t,r=0,n=this.length-1;n>=0;n--)r=(e*r+(0|this.words[n]))%t;return r},o.prototype.idivn=function(t){i(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var n=(0|this.words[r])+67108864*e;this.words[r]=n/t|0,e=n%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n=new o(1),s=new o(0),h=new o(0),u=new o(1),a=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++a;for(var l=r.clone(),f=e.clone();!e.isZero();){for(var c=0,d=1;0==(e.words[0]&d)&&c<26;++c,d<<=1);if(c>0)for(e.iushrn(c);c-- >0;)(n.isOdd()||s.isOdd())&&(n.iadd(l),s.isub(f)),n.iushrn(1),s.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(h.isOdd()||u.isOdd())&&(h.iadd(l),u.isub(f)),h.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),n.isub(h),s.isub(u)):(r.isub(e),h.isub(n),u.isub(s))}return{a:h,b:u,gcd:r.iushln(a)}},o.prototype._invmp=function(t){i(0===t.negative),i(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var n,s=new o(1),h=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var a=0,l=1;0==(e.words[0]&l)&&a<26;++a,l<<=1);if(a>0)for(e.iushrn(a);a-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);for(var f=0,c=1;0==(r.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(r.iushrn(f);f-- >0;)h.isOdd()&&h.iadd(u),h.iushrn(1);e.cmp(r)>=0?(e.isub(r),s.isub(h)):(r.isub(e),h.isub(s))}return(n=0===e.cmpn(1)?s:h).cmpn(0)<0&&n.iadd(t),n},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var i=0;e.isEven()&&r.isEven();i++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=e.cmp(r);if(n<0){var o=e;e=r,r=o}else if(0===n||0===r.cmpn(1))break;e.isub(r)}return r.iushln(i)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){i("number"==typeof t);var e=t%26,r=(t-e)/26,n=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=n,this;for(var o=n,s=r;0!==o&&s<this.length;s++){var h=0|this.words[s];o=(h+=o)>>>26,h&=67108863,this.words[s]=h}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),i(t<=67108863,"Number is too big");var n=0|this.words[0];e=n===t?0:n<t?-1:1}return 0!==this.negative?0|-e:e},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var i=0|this.words[r],n=0|t.words[r];if(i!==n){i<n?e=-1:i>n&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new _(t)},o.prototype.toRed=function(t){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return i(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return i(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function y(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function b(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else i(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function S(t){_.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var i=e<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>0?r.isub(this.p):r.strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},n(y,v),y.prototype.split=function(t,e){for(var r=4194303,i=Math.min(t.length,9),n=0;n<i;n++)e.words[n]=t.words[n];if(e.length=i,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&r,n=10;n<t.length;n++){var s=0|t.words[n];t.words[n-10]=(s&r)<<4|o>>>22,o=s}o>>>=22,t.words[n-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},y.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r<t.length;r++){var i=0|t.words[r];e+=977*i,t.words[r]=67108863&e,e=64*i+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},n(M,v),n(w,v),n(b,v),b.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var i=19*(0|t.words[r])+e,n=67108863&i;i>>>=26,t.words[r]=n,e=i}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new y;else if("p224"===t)e=new M;else if("p192"===t)e=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new b}return g[t]=e,e},_.prototype._verify1=function(t){i(0===t.negative,"red works only with positives"),i(t.red,"red works only with red numbers")},_.prototype._verify2=function(t,e){i(0==(t.negative|e.negative),"red works only with positives"),i(t.red&&t.red===e.red,"red works only with red numbers")},_.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},_.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},_.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},_.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},_.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},_.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},_.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},_.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},_.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},_.prototype.isqr=function(t){return this.imul(t,t.clone())},_.prototype.sqr=function(t){return this.mul(t,t)},_.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(i(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var n=this.m.subn(1),s=0;!n.isZero()&&0===n.andln(1);)s++,n.iushrn(1);i(!n.isZero());var h=new o(1).toRed(this),u=h.redNeg(),a=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,a).cmp(u);)l.redIAdd(u);for(var f=this.pow(l,n),c=this.pow(t,n.addn(1).iushrn(1)),d=this.pow(t,n),p=s;0!==d.cmp(h);){for(var m=d,g=0;0!==m.cmp(h);g++)m=m.redSqr();i(g<p);var v=this.pow(f,new o(1).iushln(p-g-1));c=c.redMul(v),f=v.redSqr(),d=d.redMul(f),p=g}return c},_.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},_.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new o(1).toRed(this),r[1]=t;for(var i=2;i<r.length;i++)r[i]=this.mul(r[i-1],t);var n=r[0],s=0,h=0,u=e.bitLength()%26;for(0===u&&(u=26),i=e.length-1;i>=0;i--){for(var a=e.words[i],l=u-1;l>=0;l--){var f=a>>l&1;n!==r[0]&&(n=this.sqr(n)),0!==f||0!==s?(s<<=1,s|=f,(4===++h||0===i&&0===l)&&(n=this.mul(n,r[s]),h=0,s=0)):h=0}u=26}return n},_.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},_.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new S(t)},n(S,_),S.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},S.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},S.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):n.cmpn(0)<0&&(o=n.iadd(this.m)),o._forceRed(this)},S.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):n.cmpn(0)<0&&(s=n.iadd(this.m)),s._forceRed(this)},S.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,r("62e4")(t))},cfbd:function(t,e,r){var i=r("3fb5"),n=r("7f7a"),o=n.base,s=n.bignum,h=n.constants.der;function u(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new a,this.tree._init(t.body)}function a(t){o.Node.call(this,"der",t)}function l(t,e){var r=t.readUInt8(e);if(t.isError(r))return r;var i=h.tagClass[r>>6],n=0==(32&r);if(31==(31&r)){var o=r;for(r=0;128==(128&o);){if(o=t.readUInt8(e),t.isError(o))return o;r<<=7,r|=127&o}}else r&=31;return{cls:i,primitive:n,tag:r,tagStr:h.tag[r]}}function f(t,e,r){var i=t.readUInt8(r);if(t.isError(i))return i;if(!e&&128===i)return null;if(0==(128&i))return i;var n=127&i;if(n>4)return t.error("length octect is too long");i=0;for(var o=0;o<n;o++){i<<=8;var s=t.readUInt8(r);if(t.isError(s))return s;i|=s}return i}t.exports=u,u.prototype.decode=function(t,e){return t instanceof o.DecoderBuffer||(t=new o.DecoderBuffer(t,e)),this.tree._decode(t,e)},i(a,o.Node),a.prototype._peekTag=function(t,e,r){if(t.isEmpty())return!1;var i=t.save(),n=l(t,'Failed to peek tag: "'+e+'"');return t.isError(n)?n:(t.restore(i),n.tag===e||n.tagStr===e||n.tagStr+"of"===e||r)},a.prototype._decodeTag=function(t,e,r){var i=l(t,'Failed to decode tag of "'+e+'"');if(t.isError(i))return i;var n=f(t,i.primitive,'Failed to get length of "'+e+'"');if(t.isError(n))return n;if(!r&&i.tag!==e&&i.tagStr!==e&&i.tagStr+"of"!==e)return t.error('Failed to match tag: "'+e+'"');if(i.primitive||null!==n)return t.skip(n,'Failed to match body of: "'+e+'"');var o=t.save(),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+'"'))},a.prototype._skipUntilEnd=function(t,e){for(;;){var r=l(t,e);if(t.isError(r))return r;var i,n=f(t,r.primitive,e);if(t.isError(n))return n;if(i=r.primitive||null!==n?t.skip(n):this._skipUntilEnd(t,e),t.isError(i))return i;if("end"===r.tagStr)break}},a.prototype._decodeList=function(t,e,r,i){for(var n=[];!t.isEmpty();){var o=this._peekTag(t,"end");if(t.isError(o))return o;var s=r.decode(t,"der",i);if(t.isError(s)&&o)break;n.push(s)}return n},a.prototype._decodeStr=function(t,e){if("bitstr"===e){var r=t.readUInt8();return t.isError(r)?r:{unused:r,data:t.raw()}}if("bmpstr"===e){var i=t.raw();if(i.length%2==1)return t.error("Decoding of string type: bmpstr length mismatch");for(var n="",o=0;o<i.length/2;o++)n+=String.fromCharCode(i.readUInt16BE(2*o));return n}if("numstr"===e){var 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")},a.prototype._decodeObjid=function(t,e,r){for(var i,n=[],o=0;!t.isEmpty();){var s=t.readUInt8();o<<=7,o|=127&s,0==(128&s)&&(n.push(o),o=0)}128&s&&n.push(o);var h=n[0]/40|0,u=n[0]%40;if(i=r?n:[h,u].concat(n.slice(1)),e){var a=e[i.join(" ")];void 0===a&&(a=e[i.join(".")]),void 0!==a&&(i=a)}return i},a.prototype._decodeTime=function(t,e){var r=t.raw().toString();if("gentime"===e)var i=0|r.slice(0,4),n=0|r.slice(4,6),o=0|r.slice(6,8),s=0|r.slice(8,10),h=0|r.slice(10,12),u=0|r.slice(12,14);else{if("utctime"!==e)return t.error("Decoding "+e+" time is not supported yet");i=0|r.slice(0,2),n=0|r.slice(2,4),o=0|r.slice(4,6),s=0|r.slice(6,8),h=0|r.slice(8,10),u=0|r.slice(10,12),i=i<70?2e3+i:1900+i}return Date.UTC(i,n-1,o,s,h,u,0)},a.prototype._decodeNull=function(t){return null},a.prototype._decodeBool=function(t){var e=t.readUInt8();return t.isError(e)?e:0!==e},a.prototype._decodeInt=function(t,e){var r=t.raw(),i=new s(r);return e&&(i=e[i.toString(10)]||i),i},a.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getDecoder("der").tree}},d1c8:function(t,e,r){var i=r("3fb5");function n(t){this._reporterState={obj:null,path:[],options:t||{},errors:[]}}function o(t,e){this.path=t,this.rethrow(e)}e.Reporter=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,r){var i=this._reporterState;this.exitKey(t),null!==i.obj&&(i.obj[e]=r)},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,r=e.obj;return e.obj=t,r},n.prototype.error=function(t){var e,r=this._reporterState,i=t instanceof o;if(e=i?t:new o(r.path.map((function(t){return"["+JSON.stringify(t)+"]"})).join(""),t.message||t,t.stack),!r.options.partial)throw e;return i||r.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},i(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}},ef3a:function(t,e,r){var i=r("7f7a"),n=r("3fb5");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=r("0706").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(i.decoders[t])),this.decoders[t]},o.prototype.decode=function(t,e,r){return this._getDecoder(e).decode(t,r)},o.prototype._getEncoder=function(t){return t=t||"der",this.encoders.hasOwnProperty(t)||(this.encoders[t]=this._createNamed(i.encoders[t])),this.encoders[t]},o.prototype.encode=function(t,e,r){return this._getEncoder(e).encode(t,r)}}}]);