molstar
Version:
A comprehensive macromolecular library.
2 lines • 4.24 MB
JavaScript
/*! For license information please see molstar.js.LICENSE.txt */
!function(A,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.molstar=e():A.molstar=e()}(self,(function(){return(()=>{var A={1944:()=>{"use strict";var A,e,t,r,n,i,o,a;"undefined"!=typeof window&&function(){window.console=window.console||{};for(var A,e,t=window.console,r={},n=function(){},i="memory".split(","),o="assert,clear,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn".split(",");A=i.pop();)t[A]||(t[A]=r);for(;e=o.pop();)t[e]||(t[e]=n)}(),void 0===window.HTMLCanvasElement||window.HTMLCanvasElement.prototype.toBlob||Object.defineProperty(window.HTMLCanvasElement.prototype,"toBlob",{value:function(A,e,t){for(var r=window.atob(this.toDataURL(e,t).split(",")[1]),n=r.length,i=n>>2,o=new Uint8Array(n),a=new Uint32Array(o.buffer,0,i),s=0,g=0;g<i;g++)a[g]=r.charCodeAt(s++)|r.charCodeAt(s++)<<8|r.charCodeAt(s++)<<16|r.charCodeAt(s++)<<24;for(var u=3&n;u--;)o[s]=r.charCodeAt(s++);A(new window.Blob([o],{type:e||"image/png"}))}}),Math.cbrt=Math.cbrt||function(A){var e=Math.pow(Math.abs(A),1/3);return A<0?-e:e},Math.sign||(Math.sign=function(A){return 0==(A=+A)||isNaN(A)?Number(A):A>0?1:-1}),Number.isInteger||(Number.isInteger=function(A){return"number"==typeof A&&isFinite(A)&&A>-9007199254740992&&A<9007199254740992&&Math.floor(A)===A}),Number.isNaN||(Number.isNaN=function(A){return A!=A}),Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:function(A){if(null==A)throw new TypeError("Cannot convert first argument to object");for(var e,t=Object(A),r=!1,n=1;n<arguments.length;n++){var i=arguments[n];if(null!=i){for(var o=Object.keys(Object(i)),a=0,s=o.length;a<s;a++){var g=o[a];try{var u=Object.getOwnPropertyDescriptor(i,g);void 0!==u&&u.enumerable&&(t[g]=i[g])}catch(A){r||(r=!0,e=A)}}if(r)throw e}}return t}}),String.prototype.startsWith||(A=function(){var A;try{var e={},t=Object.defineProperty;A=t(e,e,e)&&t}catch(A){}return A}(),e={}.toString,t=function(A){if(null===this)throw TypeError();var t=String(this);if(A&&"[object RegExp]"===e.call(A))throw TypeError();var r=t.length,n=String(A),i=n.length,o=arguments.length>1?arguments[1]:void 0,a=o?Number(o):0;Number.isNaN(a)&&(a=0);var s=Math.min(Math.max(a,0),r);if(i+s>r)return!1;for(var g=-1;++g<i;)if(t.charCodeAt(s+g)!==n.charCodeAt(g))return!1;return!0},A?A(String.prototype,"startsWith",{value:t,configurable:!0,writable:!0}):String.prototype.startsWith=t),String.prototype.endsWith||(String.prototype.endsWith=function(A,e){var t=this.toString();("number"!=typeof e||!isFinite(e)||Math.floor(e)!==e||e>t.length)&&(e=t.length),e-=A.length;var r=t.indexOf(A,e);return-1!==r&&r===e}),String.prototype.repeat||(String.prototype.repeat=function(A){if(null===this)throw new TypeError("can't convert "+this+" to object");var e=""+this;if(A=+A,Number.isNaN(A)&&(A=0),A<0)throw new RangeError("repeat count must be non-negative");if(A===1/0)throw new RangeError("repeat count must be less than infinity");if(A=Math.floor(A),0===e.length||0===A)return"";if(e.length*A>=1<<28)throw new RangeError("repeat count must not overflow maximum string size");for(var t="";1==(1&A)&&(t+=e),0!=(A>>>=1);)e+=e;return t}),String.prototype.includes||(String.prototype.includes=function(A,e){return"number"!=typeof e&&(e=0),!(e+A.length>this.length)&&-1!==this.indexOf(A,e)}),Array.prototype.includes||(Array.prototype.includes=function(A){if(null==this)throw new TypeError("Array.prototype.includes called on null or undefined");var e=Object(this),t=parseInt(e.length,10)||0;if(0===t)return!1;var r,n,i=parseInt(arguments[1],10)||0;for(i>=0?r=i:(r=t+i)<0&&(r=0);r<t;){if(A===(n=e[r])||Number.isNaN(A)&&Number.isNaN(n))return!0;r++}return!1}),Array.from||(Array.from=(r=Object.prototype.toString,n=function(A){return"function"==typeof A||"[object Function]"===r.call(A)},i=Math.pow(2,53)-1,o=function(A){var e=function(A){var e=Number(A);return isNaN(e)?0:0!==e&&isFinite(e)?(e>0?1:-1)*Math.floor(Math.abs(e)):e}(A);return Math.min(Math.max(e,0),i)},function(A){var e=this,t=Object(A);if(null==A)throw new TypeError("Array.from requires an array-like object - not null or undefined");var r,i=arguments.length>1?arguments[1]:void 0;if(void 0!==i){if(!n(i))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(r=arguments[2])}for(var a,s=o(t.length),g=n(e)?Object(new e(s)):new Array(s),u=0;u<s;)a=t[u],g[u]=i?void 0===r?i(a,u):i.call(r,a,u):a,u+=1;return g.length=s,g})),"undefined"!=typeof window&&function(){for(var A=0,e=["ms","moz","webkit","o"],t=0;t<e.length&&!window.requestAnimationFrame;++t)window.requestAnimationFrame=window[e[t]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[e[t]+"CancelAnimationFrame"]||window[e[t]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(e){var t=(new Date).getTime(),r=Math.max(0,16-(t-A)),n=window.setTimeout((function(){e(t+r)}),r);return A=t+r,n}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(A){clearTimeout(A)})}(),void 0===Function.prototype.name&&void 0!==Object.defineProperty&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1]}}),"undefined"!=typeof window&&(void 0===window.performance&&(window.performance={}),void 0===window.performance.now&&(a=Date.now(),window.performance.now=function(){return Date.now()-a})),void 0!==Object.defineProperty&&(void 0===Number.MAX_SAFE_INTEGER&&Object.defineProperty(Number,"MAX_SAFE_INTEGER",{enumerable:!1,configurable:!1,writable:!1,value:Math.pow(2,53)-1}),void 0===Number.MIN_SAFE_INTEGER&&Object.defineProperty(Number,"MIN_SAFE_INTEGER",{enumerable:!1,configurable:!1,writable:!1,value:-(Math.pow(2,53)-1)})),Object.entries||(Object.entries=function(A){for(var e=Object.keys(A),t=e.length,r=new Array(t);t--;)r[t]=[e[t],A[e[t]]];return r}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(A){if(null==this)throw TypeError('"this" is null or not defined');var e=Object(this),t=e.length>>>0;if("function"!=typeof A)throw TypeError("predicate must be a function");for(var r=arguments[1],n=0;n<t;){var i=e[n];if(A.call(r,i,n,e))return i;n++}},configurable:!0,writable:!0}),Array.prototype.fill||Object.defineProperty(Array.prototype,"fill",{value:function(A){if(null==this)throw new TypeError("this is null or not defined");for(var e=Object(this),t=e.length>>>0,r=arguments[1],n=r>>0,i=n<0?Math.max(t+n,0):Math.min(n,t),o=arguments[2],a=void 0===o?t:o>>0,s=a<0?Math.max(t+a,0):Math.min(a,t);i<s;)e[i]=A,i++;return e}}),Array.prototype.copyWithin||Object.defineProperty(Array.prototype,"copyWithin",{value:function(A,e){if(null==this)throw new TypeError("this is null or not defined");var t=Object(this),r=t.length>>>0,n=A>>0,i=n<0?Math.max(r+n,0):Math.min(n,r),o=e>>0,a=o<0?Math.max(r+o,0):Math.min(o,r),s=arguments[2],g=void 0===s?r:s>>0,u=g<0?Math.max(r+g,0):Math.min(g,r),c=Math.min(u-a,r-i),B=1;for(a<i&&i<a+c&&(B=-1,a+=c-1,i+=c-1);c>0;)a in t?t[i]=t[a]:delete t[i],a+=B,i+=B,c--;return t},configurable:!0,writable:!0}),Int8Array.prototype.copyWithin||Object.defineProperty(Int8Array.prototype,"copyWithin",{value:Array.prototype.copyWithin}),Int16Array.prototype.copyWithin||Object.defineProperty(Int16Array.prototype,"copyWithin",{value:Array.prototype.copyWithin}),Int32Array.prototype.copyWithin||Object.defineProperty(Int32Array.prototype,"copyWithin",{value:Array.prototype.copyWithin}),Uint8Array.prototype.copyWithin||Object.defineProperty(Uint8Array.prototype,"copyWithin",{value:Array.prototype.copyWithin}),Uint16Array.prototype.copyWithin||Object.defineProperty(Uint16Array.prototype,"copyWithin",{value:Array.prototype.copyWithin}),Uint32Array.prototype.copyWithin||Object.defineProperty(Uint32Array.prototype,"copyWithin",{value:Array.prototype.copyWithin}),Float32Array.prototype.copyWithin||Object.defineProperty(Float32Array.prototype,"copyWithin",{value:Array.prototype.copyWithin}),Float64Array.prototype.copyWithin||Object.defineProperty(Float64Array.prototype,"copyWithin",{value:Array.prototype.copyWithin})},9809:(A,e,t)=>{"use strict";const r=e;r.bignum=t(4590),r.define=t(2500).define,r.base=t(1979),r.constants=t(6826),r.decoders=t(8307),r.encoders=t(6579)},2500:(A,e,t)=>{"use strict";const r=t(6579),n=t(8307),i=t(5717);function o(A,e){this.name=A,this.body=e,this.decoders={},this.encoders={}}e.define=function(A,e){return new o(A,e)},o.prototype._createNamed=function(A){const e=this.name;function t(A){this._initNamed(A,e)}return i(t,A),t.prototype._initNamed=function(e,t){A.call(this,e,t)},new t(this)},o.prototype._getDecoder=function(A){return A=A||"der",this.decoders.hasOwnProperty(A)||(this.decoders[A]=this._createNamed(n[A])),this.decoders[A]},o.prototype.decode=function(A,e,t){return this._getDecoder(e).decode(A,t)},o.prototype._getEncoder=function(A){return A=A||"der",this.encoders.hasOwnProperty(A)||(this.encoders[A]=this._createNamed(r[A])),this.encoders[A]},o.prototype.encode=function(A,e,t){return this._getEncoder(e).encode(A,t)}},6625:(A,e,t)=>{"use strict";const r=t(5717),n=t(8465).b,i=t(2399).Buffer;function o(A,e){n.call(this,e),i.isBuffer(A)?(this.base=A,this.offset=0,this.length=A.length):this.error("Input not Buffer")}function a(A,e){if(Array.isArray(A))this.length=0,this.value=A.map((function(A){return a.isEncoderBuffer(A)||(A=new a(A,e)),this.length+=A.length,A}),this);else if("number"==typeof A){if(!(0<=A&&A<=255))return e.error("non-byte EncoderBuffer value");this.value=A,this.length=1}else if("string"==typeof A)this.value=A,this.length=i.byteLength(A);else{if(!i.isBuffer(A))return e.error("Unsupported type: "+typeof A);this.value=A,this.length=A.length}}r(o,n),e.C=o,o.isDecoderBuffer=function(A){return A instanceof o||"object"==typeof A&&i.isBuffer(A.base)&&"DecoderBuffer"===A.constructor.name&&"number"==typeof A.offset&&"number"==typeof A.length&&"function"==typeof A.save&&"function"==typeof A.restore&&"function"==typeof A.isEmpty&&"function"==typeof A.readUInt8&&"function"==typeof A.skip&&"function"==typeof A.raw},o.prototype.save=function(){return{offset:this.offset,reporter:n.prototype.save.call(this)}},o.prototype.restore=function(A){const e=new o(this.base);return e.offset=A.offset,e.length=this.offset,this.offset=A.offset,n.prototype.restore.call(this,A.reporter),e},o.prototype.isEmpty=function(){return this.offset===this.length},o.prototype.readUInt8=function(A){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(A||"DecoderBuffer overrun")},o.prototype.skip=function(A,e){if(!(this.offset+A<=this.length))return this.error(e||"DecoderBuffer overrun");const t=new o(this.base);return t._reporterState=this._reporterState,t.offset=this.offset,t.length=this.offset+A,this.offset+=A,t},o.prototype.raw=function(A){return this.base.slice(A?A.offset:this.offset,this.length)},e.R=a,a.isEncoderBuffer=function(A){return A instanceof a||"object"==typeof A&&"EncoderBuffer"===A.constructor.name&&"number"==typeof A.length&&"function"==typeof A.join},a.prototype.join=function(A,e){return A||(A=i.alloc(this.length)),e||(e=0),0===this.length||(Array.isArray(this.value)?this.value.forEach((function(t){t.join(A,e),e+=t.length})):("number"==typeof this.value?A[e]=this.value:"string"==typeof this.value?A.write(this.value,e):i.isBuffer(this.value)&&this.value.copy(A,e),e+=this.length)),A}},1979:(A,e,t)=>{"use strict";const r=e;r.Reporter=t(8465).b,r.DecoderBuffer=t(6625).C,r.EncoderBuffer=t(6625).R,r.Node=t(1949)},1949:(A,e,t)=>{"use strict";const r=t(8465).b,n=t(6625).R,i=t(6625).C,o=t(9746),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"],s=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(a);function g(A,e,t){const r={};this._baseState=r,r.name=t,r.enc=A,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())}A.exports=g;const u=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];g.prototype.clone=function(){const A=this._baseState,e={};u.forEach((function(t){e[t]=A[t]}));const t=new this.constructor(e.parent);return t._baseState=e,t},g.prototype._wrap=function(){const A=this._baseState;s.forEach((function(e){this[e]=function(){const t=new this.constructor(this);return A.children.push(t),t[e].apply(t,arguments)}}),this)},g.prototype._init=function(A){const e=this._baseState;o(null===e.parent),A.call(this),e.children=e.children.filter((function(A){return A._baseState.parent===this}),this),o.equal(e.children.length,1,"Root node can have only one child")},g.prototype._useArgs=function(A){const e=this._baseState,t=A.filter((function(A){return A instanceof this.constructor}),this);A=A.filter((function(A){return!(A instanceof this.constructor)}),this),0!==t.length&&(o(null===e.children),e.children=t,t.forEach((function(A){A._baseState.parent=this}),this)),0!==A.length&&(o(null===e.args),e.args=A,e.reverseArgs=A.map((function(A){if("object"!=typeof A||A.constructor!==Object)return A;const e={};return Object.keys(A).forEach((function(t){t==(0|t)&&(t|=0);const r=A[t];e[r]=t})),e})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(A){g.prototype[A]=function(){const e=this._baseState;throw new Error(A+" not implemented for encoding: "+e.enc)}})),a.forEach((function(A){g.prototype[A]=function(){const e=this._baseState,t=Array.prototype.slice.call(arguments);return o(null===e.tag),e.tag=A,this._useArgs(t),this}})),g.prototype.use=function(A){o(A);const e=this._baseState;return o(null===e.use),e.use=A,this},g.prototype.optional=function(){return this._baseState.optional=!0,this},g.prototype.def=function(A){const e=this._baseState;return o(null===e.default),e.default=A,e.optional=!0,this},g.prototype.explicit=function(A){const e=this._baseState;return o(null===e.explicit&&null===e.implicit),e.explicit=A,this},g.prototype.implicit=function(A){const e=this._baseState;return o(null===e.explicit&&null===e.implicit),e.implicit=A,this},g.prototype.obj=function(){const A=this._baseState,e=Array.prototype.slice.call(arguments);return A.obj=!0,0!==e.length&&this._useArgs(e),this},g.prototype.key=function(A){const e=this._baseState;return o(null===e.key),e.key=A,this},g.prototype.any=function(){return this._baseState.any=!0,this},g.prototype.choice=function(A){const e=this._baseState;return o(null===e.choice),e.choice=A,this._useArgs(Object.keys(A).map((function(e){return A[e]}))),this},g.prototype.contains=function(A){const e=this._baseState;return o(null===e.use),e.contains=A,this},g.prototype._decode=function(A,e){const t=this._baseState;if(null===t.parent)return A.wrapResult(t.children[0]._decode(A,e));let r,n=t.default,o=!0,a=null;if(null!==t.key&&(a=A.enterKey(t.key)),t.optional){let r=null;if(null!==t.explicit?r=t.explicit:null!==t.implicit?r=t.implicit:null!==t.tag&&(r=t.tag),null!==r||t.any){if(o=this._peekTag(A,r,t.any),A.isError(o))return o}else{const r=A.save();try{null===t.choice?this._decodeGeneric(t.tag,A,e):this._decodeChoice(A,e),o=!0}catch(A){o=!1}A.restore(r)}}if(t.obj&&o&&(r=A.enterObject()),o){if(null!==t.explicit){const e=this._decodeTag(A,t.explicit);if(A.isError(e))return e;A=e}const r=A.offset;if(null===t.use&&null===t.choice){let e;t.any&&(e=A.save());const r=this._decodeTag(A,null!==t.implicit?t.implicit:t.tag,t.any);if(A.isError(r))return r;t.any?n=A.raw(e):A=r}if(e&&e.track&&null!==t.tag&&e.track(A.path(),r,A.length,"tagged"),e&&e.track&&null!==t.tag&&e.track(A.path(),A.offset,A.length,"content"),t.any||(n=null===t.choice?this._decodeGeneric(t.tag,A,e):this._decodeChoice(A,e)),A.isError(n))return n;if(t.any||null!==t.choice||null===t.children||t.children.forEach((function(t){t._decode(A,e)})),t.contains&&("octstr"===t.tag||"bitstr"===t.tag)){const r=new i(n);n=this._getUse(t.contains,A._reporterState.obj)._decode(r,e)}}return t.obj&&o&&(n=A.leaveObject(r)),null===t.key||null===n&&!0!==o?null!==a&&A.exitKey(a):A.leaveKey(a,t.key,n),n},g.prototype._decodeGeneric=function(A,e,t){const r=this._baseState;return"seq"===A||"set"===A?null:"seqof"===A||"setof"===A?this._decodeList(e,A,r.args[0],t):/str$/.test(A)?this._decodeStr(e,A,t):"objid"===A&&r.args?this._decodeObjid(e,r.args[0],r.args[1],t):"objid"===A?this._decodeObjid(e,null,null,t):"gentime"===A||"utctime"===A?this._decodeTime(e,A,t):"null_"===A?this._decodeNull(e,t):"bool"===A?this._decodeBool(e,t):"objDesc"===A?this._decodeStr(e,A,t):"int"===A||"enum"===A?this._decodeInt(e,r.args&&r.args[0],t):null!==r.use?this._getUse(r.use,e._reporterState.obj)._decode(e,t):e.error("unknown tag: "+A)},g.prototype._getUse=function(A,e){const t=this._baseState;return t.useDecoder=this._use(A,e),o(null===t.useDecoder._baseState.parent),t.useDecoder=t.useDecoder._baseState.children[0],t.implicit!==t.useDecoder._baseState.implicit&&(t.useDecoder=t.useDecoder.clone(),t.useDecoder._baseState.implicit=t.implicit),t.useDecoder},g.prototype._decodeChoice=function(A,e){const t=this._baseState;let r=null,n=!1;return Object.keys(t.choice).some((function(i){const o=A.save(),a=t.choice[i];try{const t=a._decode(A,e);if(A.isError(t))return!1;r={type:i,value:t},n=!0}catch(e){return A.restore(o),!1}return!0}),this),n?r:A.error("Choice not matched")},g.prototype._createEncoderBuffer=function(A){return new n(A,this.reporter)},g.prototype._encode=function(A,e,t){const r=this._baseState;if(null!==r.default&&r.default===A)return;const n=this._encodeValue(A,e,t);return void 0===n||this._skipDefault(n,e,t)?void 0:n},g.prototype._encodeValue=function(A,e,t){const n=this._baseState;if(null===n.parent)return n.children[0]._encode(A,e||new r);let i=null;if(this.reporter=e,n.optional&&void 0===A){if(null===n.default)return;A=n.default}let o=null,a=!1;if(n.any)i=this._createEncoderBuffer(A);else if(n.choice)i=this._encodeChoice(A,e);else if(n.contains)o=this._getUse(n.contains,t)._encode(A,e),a=!0;else if(n.children)o=n.children.map((function(t){if("null_"===t._baseState.tag)return t._encode(null,e,A);if(null===t._baseState.key)return e.error("Child should have a key");const r=e.enterKey(t._baseState.key);if("object"!=typeof A)return e.error("Child expected, but input is not object");const n=t._encode(A[t._baseState.key],e,A);return e.leaveKey(r),n}),this).filter((function(A){return A})),o=this._createEncoderBuffer(o);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(A))return e.error("seqof/setof, but data is not Array");const t=this.clone();t._baseState.implicit=null,o=this._createEncoderBuffer(A.map((function(t){const r=this._baseState;return this._getUse(r.args[0],A)._encode(t,e)}),t))}else null!==n.use?i=this._getUse(n.use,t)._encode(A,e):(o=this._encodePrimitive(n.tag,A),a=!0);if(!n.any&&null===n.choice){const A=null!==n.implicit?n.implicit:n.tag,t=null===n.implicit?"universal":"context";null===A?null===n.use&&e.error("Tag could be omitted only for .use()"):null===n.use&&(i=this._encodeComposite(A,a,t,o))}return null!==n.explicit&&(i=this._encodeComposite(n.explicit,!1,"context",i)),i},g.prototype._encodeChoice=function(A,e){const t=this._baseState,r=t.choice[A.type];return r||o(!1,A.type+" not found in "+JSON.stringify(Object.keys(t.choice))),r._encode(A.value,e)},g.prototype._encodePrimitive=function(A,e){const t=this._baseState;if(/str$/.test(A))return this._encodeStr(e,A);if("objid"===A&&t.args)return this._encodeObjid(e,t.reverseArgs[0],t.args[1]);if("objid"===A)return this._encodeObjid(e,null,null);if("gentime"===A||"utctime"===A)return this._encodeTime(e,A);if("null_"===A)return this._encodeNull();if("int"===A||"enum"===A)return this._encodeInt(e,t.args&&t.reverseArgs[0]);if("bool"===A)return this._encodeBool(e);if("objDesc"===A)return this._encodeStr(e,A);throw new Error("Unsupported tag: "+A)},g.prototype._isNumstr=function(A){return/^[0-9 ]*$/.test(A)},g.prototype._isPrintstr=function(A){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(A)}},8465:(A,e,t)=>{"use strict";const r=t(5717);function n(A){this._reporterState={obj:null,path:[],options:A||{},errors:[]}}function i(A,e){this.path=A,this.rethrow(e)}e.b=n,n.prototype.isError=function(A){return A instanceof i},n.prototype.save=function(){const A=this._reporterState;return{obj:A.obj,pathLen:A.path.length}},n.prototype.restore=function(A){const e=this._reporterState;e.obj=A.obj,e.path=e.path.slice(0,A.pathLen)},n.prototype.enterKey=function(A){return this._reporterState.path.push(A)},n.prototype.exitKey=function(A){const e=this._reporterState;e.path=e.path.slice(0,A-1)},n.prototype.leaveKey=function(A,e,t){const r=this._reporterState;this.exitKey(A),null!==r.obj&&(r.obj[e]=t)},n.prototype.path=function(){return this._reporterState.path.join("/")},n.prototype.enterObject=function(){const A=this._reporterState,e=A.obj;return A.obj={},e},n.prototype.leaveObject=function(A){const e=this._reporterState,t=e.obj;return e.obj=A,t},n.prototype.error=function(A){let e;const t=this._reporterState,r=A instanceof i;if(e=r?A:new i(t.path.map((function(A){return"["+JSON.stringify(A)+"]"})).join(""),A.message||A,A.stack),!t.options.partial)throw e;return r||t.errors.push(e),e},n.prototype.wrapResult=function(A){const e=this._reporterState;return e.options.partial?{result:this.isError(A)?null:A,errors:e.errors}:A},r(i,Error),i.prototype.rethrow=function(A){if(this.message=A+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,i),!this.stack)try{throw new Error(this.message)}catch(A){this.stack=A.stack}return this}},160:(A,e)=>{"use strict";function t(A){const e={};return Object.keys(A).forEach((function(t){(0|t)==t&&(t|=0);const r=A[t];e[r]=t})),e}e.tagClass={0:"universal",1:"application",2:"context",3:"private"},e.tagClassByName=t(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=t(e.tag)},6826:(A,e,t)=>{"use strict";const r=e;r._reverse=function(A){const e={};return Object.keys(A).forEach((function(t){(0|t)==t&&(t|=0);const r=A[t];e[r]=t})),e},r.der=t(160)},1671:(A,e,t)=>{"use strict";const r=t(5717),n=t(4590),i=t(6625).C,o=t(1949),a=t(160);function s(A){this.enc="der",this.name=A.name,this.entity=A,this.tree=new g,this.tree._init(A.body)}function g(A){o.call(this,"der",A)}function u(A,e){let t=A.readUInt8(e);if(A.isError(t))return t;const r=a.tagClass[t>>6],n=0==(32&t);if(31==(31&t)){let r=t;for(t=0;128==(128&r);){if(r=A.readUInt8(e),A.isError(r))return r;t<<=7,t|=127&r}}else t&=31;return{cls:r,primitive:n,tag:t,tagStr:a.tag[t]}}function c(A,e,t){let r=A.readUInt8(t);if(A.isError(r))return r;if(!e&&128===r)return null;if(0==(128&r))return r;const n=127&r;if(n>4)return A.error("length octect is too long");r=0;for(let e=0;e<n;e++){r<<=8;const e=A.readUInt8(t);if(A.isError(e))return e;r|=e}return r}A.exports=s,s.prototype.decode=function(A,e){return i.isDecoderBuffer(A)||(A=new i(A,e)),this.tree._decode(A,e)},r(g,o),g.prototype._peekTag=function(A,e,t){if(A.isEmpty())return!1;const r=A.save(),n=u(A,'Failed to peek tag: "'+e+'"');return A.isError(n)?n:(A.restore(r),n.tag===e||n.tagStr===e||n.tagStr+"of"===e||t)},g.prototype._decodeTag=function(A,e,t){const r=u(A,'Failed to decode tag of "'+e+'"');if(A.isError(r))return r;let n=c(A,r.primitive,'Failed to get length of "'+e+'"');if(A.isError(n))return n;if(!t&&r.tag!==e&&r.tagStr!==e&&r.tagStr+"of"!==e)return A.error('Failed to match tag: "'+e+'"');if(r.primitive||null!==n)return A.skip(n,'Failed to match body of: "'+e+'"');const i=A.save(),o=this._skipUntilEnd(A,'Failed to skip indefinite length body: "'+this.tag+'"');return A.isError(o)?o:(n=A.offset-i.offset,A.restore(i),A.skip(n,'Failed to match body of: "'+e+'"'))},g.prototype._skipUntilEnd=function(A,e){for(;;){const t=u(A,e);if(A.isError(t))return t;const r=c(A,t.primitive,e);if(A.isError(r))return r;let n;if(n=t.primitive||null!==r?A.skip(r):this._skipUntilEnd(A,e),A.isError(n))return n;if("end"===t.tagStr)break}},g.prototype._decodeList=function(A,e,t,r){const n=[];for(;!A.isEmpty();){const e=this._peekTag(A,"end");if(A.isError(e))return e;const i=t.decode(A,"der",r);if(A.isError(i)&&e)break;n.push(i)}return n},g.prototype._decodeStr=function(A,e){if("bitstr"===e){const e=A.readUInt8();return A.isError(e)?e:{unused:e,data:A.raw()}}if("bmpstr"===e){const e=A.raw();if(e.length%2==1)return A.error("Decoding of string type: bmpstr length mismatch");let t="";for(let A=0;A<e.length/2;A++)t+=String.fromCharCode(e.readUInt16BE(2*A));return t}if("numstr"===e){const e=A.raw().toString("ascii");return this._isNumstr(e)?e:A.error("Decoding of string type: numstr unsupported characters")}if("octstr"===e)return A.raw();if("objDesc"===e)return A.raw();if("printstr"===e){const e=A.raw().toString("ascii");return this._isPrintstr(e)?e:A.error("Decoding of string type: printstr unsupported characters")}return/str$/.test(e)?A.raw().toString():A.error("Decoding of string type: "+e+" unsupported")},g.prototype._decodeObjid=function(A,e,t){let r;const n=[];let i=0,o=0;for(;!A.isEmpty();)o=A.readUInt8(),i<<=7,i|=127&o,0==(128&o)&&(n.push(i),i=0);128&o&&n.push(i);const a=n[0]/40|0,s=n[0]%40;if(r=t?n:[a,s].concat(n.slice(1)),e){let A=e[r.join(" ")];void 0===A&&(A=e[r.join(".")]),void 0!==A&&(r=A)}return r},g.prototype._decodeTime=function(A,e){const t=A.raw().toString();let r,n,i,o,a,s;if("gentime"===e)r=0|t.slice(0,4),n=0|t.slice(4,6),i=0|t.slice(6,8),o=0|t.slice(8,10),a=0|t.slice(10,12),s=0|t.slice(12,14);else{if("utctime"!==e)return A.error("Decoding "+e+" time is not supported yet");r=0|t.slice(0,2),n=0|t.slice(2,4),i=0|t.slice(4,6),o=0|t.slice(6,8),a=0|t.slice(8,10),s=0|t.slice(10,12),r=r<70?2e3+r:1900+r}return Date.UTC(r,n-1,i,o,a,s,0)},g.prototype._decodeNull=function(){return null},g.prototype._decodeBool=function(A){const e=A.readUInt8();return A.isError(e)?e:0!==e},g.prototype._decodeInt=function(A,e){const t=A.raw();let r=new n(t);return e&&(r=e[r.toString(10)]||r),r},g.prototype._use=function(A,e){return"function"==typeof A&&(A=A(e)),A._getDecoder("der").tree}},8307:(A,e,t)=>{"use strict";const r=e;r.der=t(1671),r.pem=t(9631)},9631:(A,e,t)=>{"use strict";const r=t(5717),n=t(2399).Buffer,i=t(1671);function o(A){i.call(this,A),this.enc="pem"}r(o,i),A.exports=o,o.prototype.decode=function(A,e){const t=A.toString().split(/[\r\n]+/g),r=e.label.toUpperCase(),o=/^-----(BEGIN|END) ([^-]+)-----$/;let a=-1,s=-1;for(let A=0;A<t.length;A++){const e=t[A].match(o);if(null!==e&&e[2]===r){if(-1!==a){if("END"!==e[1])break;s=A;break}if("BEGIN"!==e[1])break;a=A}}if(-1===a||-1===s)throw new Error("PEM section not found for: "+r);const g=t.slice(a+1,s).join("");g.replace(/[^a-z0-9+/=]+/gi,"");const u=n.from(g,"base64");return i.prototype.decode.call(this,u,e)}},6984:(A,e,t)=>{"use strict";const r=t(5717),n=t(2399).Buffer,i=t(1949),o=t(160);function a(A){this.enc="der",this.name=A.name,this.entity=A,this.tree=new s,this.tree._init(A.body)}function s(A){i.call(this,"der",A)}function g(A){return A<10?"0"+A:A}A.exports=a,a.prototype.encode=function(A,e){return this.tree._encode(A,e).join()},r(s,i),s.prototype._encodeComposite=function(A,e,t,r){const i=function(A,e,t,r){let n;if("seqof"===A?A="seq":"setof"===A&&(A="set"),o.tagByName.hasOwnProperty(A))n=o.tagByName[A];else{if("number"!=typeof A||(0|A)!==A)return r.error("Unknown tag: "+A);n=A}return n>=31?r.error("Multi-octet tag encoding unsupported"):(e||(n|=32),n|=o.tagClassByName[t||"universal"]<<6,n)}(A,e,t,this.reporter);if(r.length<128){const A=n.alloc(2);return A[0]=i,A[1]=r.length,this._createEncoderBuffer([A,r])}let a=1;for(let A=r.length;A>=256;A>>=8)a++;const s=n.alloc(2+a);s[0]=i,s[1]=128|a;for(let A=1+a,e=r.length;e>0;A--,e>>=8)s[A]=255&e;return this._createEncoderBuffer([s,r])},s.prototype._encodeStr=function(A,e){if("bitstr"===e)return this._createEncoderBuffer([0|A.unused,A.data]);if("bmpstr"===e){const e=n.alloc(2*A.length);for(let t=0;t<A.length;t++)e.writeUInt16BE(A.charCodeAt(t),2*t);return this._createEncoderBuffer(e)}return"numstr"===e?this._isNumstr(A)?this._createEncoderBuffer(A):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===e?this._isPrintstr(A)?this._createEncoderBuffer(A):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(A):this.reporter.error("Encoding of string type: "+e+" unsupported")},s.prototype._encodeObjid=function(A,e,t){if("string"==typeof A){if(!e)return this.reporter.error("string objid given, but no values map found");if(!e.hasOwnProperty(A))return this.reporter.error("objid not found in values map");A=e[A].split(/[\s.]+/g);for(let e=0;e<A.length;e++)A[e]|=0}else if(Array.isArray(A)){A=A.slice();for(let e=0;e<A.length;e++)A[e]|=0}if(!Array.isArray(A))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(A));if(!t){if(A[1]>=40)return this.reporter.error("Second objid identifier OOB");A.splice(0,2,40*A[0]+A[1])}let r=0;for(let e=0;e<A.length;e++){let t=A[e];for(r++;t>=128;t>>=7)r++}const i=n.alloc(r);let o=i.length-1;for(let e=A.length-1;e>=0;e--){let t=A[e];for(i[o--]=127&t;(t>>=7)>0;)i[o--]=128|127&t}return this._createEncoderBuffer(i)},s.prototype._encodeTime=function(A,e){let t;const r=new Date(A);return"gentime"===e?t=[g(r.getUTCFullYear()),g(r.getUTCMonth()+1),g(r.getUTCDate()),g(r.getUTCHours()),g(r.getUTCMinutes()),g(r.getUTCSeconds()),"Z"].join(""):"utctime"===e?t=[g(r.getUTCFullYear()%100),g(r.getUTCMonth()+1),g(r.getUTCDate()),g(r.getUTCHours()),g(r.getUTCMinutes()),g(r.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+e+" time is not supported yet"),this._encodeStr(t,"octstr")},s.prototype._encodeNull=function(){return this._createEncoderBuffer("")},s.prototype._encodeInt=function(A,e){if("string"==typeof A){if(!e)return this.reporter.error("String int or enum given, but no values map");if(!e.hasOwnProperty(A))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(A));A=e[A]}if("number"!=typeof A&&!n.isBuffer(A)){const e=A.toArray();!A.sign&&128&e[0]&&e.unshift(0),A=n.from(e)}if(n.isBuffer(A)){let e=A.length;0===A.length&&e++;const t=n.alloc(e);return A.copy(t),0===A.length&&(t[0]=0),this._createEncoderBuffer(t)}if(A<128)return this._createEncoderBuffer(A);if(A<256)return this._createEncoderBuffer([0,A]);let t=1;for(let e=A;e>=256;e>>=8)t++;const r=new Array(t);for(let e=r.length-1;e>=0;e--)r[e]=255&A,A>>=8;return 128&r[0]&&r.unshift(0),this._createEncoderBuffer(n.from(r))},s.prototype._encodeBool=function(A){return this._createEncoderBuffer(A?255:0)},s.prototype._use=function(A,e){return"function"==typeof A&&(A=A(e)),A._getEncoder("der").tree},s.prototype._skipDefault=function(A,e,t){const r=this._baseState;let n;if(null===r.default)return!1;const i=A.join();if(void 0===r.defaultBuffer&&(r.defaultBuffer=this._encodeValue(r.default,e,t).join()),i.length!==r.defaultBuffer.length)return!1;for(n=0;n<i.length;n++)if(i[n]!==r.defaultBuffer[n])return!1;return!0}},6579:(A,e,t)=>{"use strict";const r=e;r.der=t(6984),r.pem=t(2883)},2883:(A,e,t)=>{"use strict";const r=t(5717),n=t(6984);function i(A){n.call(this,A),this.enc="pem"}r(i,n),A.exports=i,i.prototype.encode=function(A,e){const t=n.prototype.encode.call(this,A).toString("base64"),r=["-----BEGIN "+e.label+"-----"];for(let A=0;A<t.length;A+=64)r.push(t.slice(A,A+64));return r.push("-----END "+e.label+"-----"),r.join("\n")}},4590:function(A,e,t){!function(A,e){"use strict";function r(A,e){if(!A)throw new Error(e||"Assertion failed")}function n(A,e){A.super_=e;var t=function(){};t.prototype=e.prototype,A.prototype=new t,A.prototype.constructor=A}function i(A,e,t){if(i.isBN(A))return A;this.negative=0,this.words=null,this.length=0,this.red=null,null!==A&&("le"!==e&&"be"!==e||(t=e,e=10),this._init(A||0,e||10,t||"be"))}var o;"object"==typeof A?A.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:t(950).Buffer}catch(A){}function a(A,e){var t=A.charCodeAt(e);return t>=65&&t<=70?t-55:t>=97&&t<=102?t-87:t-48&15}function s(A,e,t){var r=a(A,t);return t-1>=e&&(r|=a(A,t-1)<<4),r}function g(A,e,t,r){for(var n=0,i=Math.min(A.length,t),o=e;o<i;o++){var a=A.charCodeAt(o)-48;n*=r,n+=a>=49?a-49+10:a>=17?a-17+10:a}return n}i.isBN=function(A){return A instanceof i||null!==A&&"object"==typeof A&&A.constructor.wordSize===i.wordSize&&Array.isArray(A.words)},i.max=function(A,e){return A.cmp(e)>0?A:e},i.min=function(A,e){return A.cmp(e)<0?A:e},i.prototype._init=function(A,e,t){if("number"==typeof A)return this._initNumber(A,e,t);if("object"==typeof A)return this._initArray(A,e,t);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var n=0;"-"===(A=A.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<A.length&&(16===e?this._parseHex(A,n,t):(this._parseBase(A,e,n),"le"===t&&this._initArray(this.toArray(),e,t)))},i.prototype._initNumber=function(A,e,t){A<0&&(this.negative=1,A=-A),A<67108864?(this.words=[67108863&A],this.length=1):A<4503599627370496?(this.words=[67108863&A,A/67108864&67108863],this.length=2):(r(A<9007199254740992),this.words=[67108863&A,A/67108864&67108863,1],this.length=3),"le"===t&&this._initArray(this.toArray(),e,t)},i.prototype._initArray=function(A,e,t){if(r("number"==typeof A.length),A.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(A.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var i,o,a=0;if("be"===t)for(n=A.length-1,i=0;n>=0;n-=3)o=A[n]|A[n-1]<<8|A[n-2]<<16,this.words[i]|=o<<a&67108863,this.words[i+1]=o>>>26-a&67108863,(a+=24)>=26&&(a-=26,i++);else if("le"===t)for(n=0,i=0;n<A.length;n+=3)o=A[n]|A[n+1]<<8|A[n+2]<<16,this.words[i]|=o<<a&67108863,this.words[i+1]=o>>>26-a&67108863,(a+=24)>=26&&(a-=26,i++);return this.strip()},i.prototype._parseHex=function(A,e,t){this.length=Math.ceil((A.length-e)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var n,i=0,o=0;if("be"===t)for(r=A.length-1;r>=e;r-=2)n=s(A,e,r)<<i,this.words[o]|=67108863&n,i>=18?(i-=18,o+=1,this.words[o]|=n>>>26):i+=8;else for(r=(A.length-e)%2==0?e+1:e;r<A.length;r+=2)n=s(A,e,r)<<i,this.words[o]|=67108863&n,i>=18?(i-=18,o+=1,this.words[o]|=n>>>26):i+=8;this.strip()},i.prototype._parseBase=function(A,e,t){this.words=[0],this.length=1;for(var r=0,n=1;n<=67108863;n*=e)r++;r--,n=n/e|0;for(var i=A.length-t,o=i%r,a=Math.min(i,i-o)+t,s=0,u=t;u<a;u+=r)s=g(A,u,u+r,e),this.imuln(n),this.words[0]+s<67108864?this.words[0]+=s:this._iaddn(s);if(0!==o){var c=1;for(s=g(A,u,A.length,e),u=0;u<o;u++)c*=e;this.imuln(c),this.words[0]+s<67108864?this.words[0]+=s:this._iaddn(s)}this.strip()},i.prototype.copy=function(A){A.words=new Array(this.length);for(var e=0;e<this.length;e++)A.words[e]=this.words[e];A.length=this.length,A.negative=this.negative,A.red=this.red},i.prototype.clone=function(){var A=new i(null);return this.copy(A),A},i.prototype._expand=function(A){for(;this.length<A;)this.words[this.length++]=0;return this},i.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","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"],c=[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],B=[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 l(A,e,t){t.negative=e.negative^A.negative;var r=A.length+e.length|0;t.length=r,r=r-1|0;var n=0|A.words[0],i=0|e.words[0],o=n*i,a=67108863&o,s=o/67108864|0;t.words[0]=a;for(var g=1;g<r;g++){for(var u=s>>>26,c=67108863&s,B=Math.min(g,e.length-1),l=Math.max(0,g-A.length+1);l<=B;l++){var Q=g-l|0;u+=(o=(n=0|A.words[Q])*(i=0|e.words[l])+c)/67108864|0,c=67108863&o}t.words[g]=0|c,s=0|u}return 0!==s?t.words[g]=0|s:t.length--,t.strip()}i.prototype.toString=function(A,e){var t;if(e=0|e||1,16===(A=A||10)||"hex"===A){t="";for(var n=0,i=0,o=0;o<this.length;o++){var a=this.words[o],s=(16777215&(a<<n|i)).toString(16);t=0!=(i=a>>>24-n&16777215)||o!==this.length-1?u[6-s.length]+s+t:s+t,(n+=2)>=26&&(n-=26,o--)}for(0!==i&&(t=i.toString(16)+t);t.length%e!=0;)t="0"+t;return 0!==this.negative&&(t="-"+t),t}if(A===(0|A)&&A>=2&&A<=36){var g=c[A],l=B[A];t="";var Q=this.clone();for(Q.negative=0;!Q.isZero();){var I=Q.modn(l).toString(A);t=(Q=Q.idivn(l)).isZero()?I+t:u[g-I.length]+I+t}for(this.isZero()&&(t="0"+t);t.length%e!=0;)t="0"+t;return 0!==this.negative&&(t="-"+t),t}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var A=this.words[0];return 2===this.length?A+=67108864*this.words[1]:3===this.length&&1===this.words[2]?A+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-A:A},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(A,e){return r(void 0!==o),this.toArrayLike(o,A,e)},i.prototype.toArray=function(A,e){return this.toArrayLike(Array,A,e)},i.prototype.toArrayLike=function(A,e,t){var n=this.byteLength(),i=t||Math.max(1,n);r(n<=i,"byte array longer than desired length"),r(i>0,"Requested array length <= 0"),this.strip();var o,a,s="le"===e,g=new A(i),u=this.clone();if(s){for(a=0;!u.isZero();a++)o=u.andln(255),u.iushrn(8),g[a]=o;for(;a<i;a++)g[a]=0}else{for(a=0;a<i-n;a++)g[a]=0;for(a=0;!u.isZero();a++)o=u.andln(255),u.iushrn(8),g[i-a-1]=o}return g},Math.clz32?i.prototype._countBits=function(A){return 32-Math.clz32(A)}:i.prototype._countBits=function(A){var e=A,t=0;return e>=4096&&(t+=13,e>>>=13),e>=64&&(t+=7,e>>>=7),e>=8&&(t+=4,e>>>=4),e>=2&&(t+=2,e>>>=2),t+e},i.prototype._zeroBits=function(A){if(0===A)return 26;var e=A,t=0;return 0==(8191&e)&&(t+=13,e>>>=13),0==(127&e)&&(t+=7,e>>>=7),0==(15&e)&&(t+=4,e>>>=4),0==(3&e)&&(t+=2,e>>>=2),0==(1&e)&&t++,t},i.prototype.bitLength=function(){var A=this.words[this.length-1],e=this._countBits(A);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var A=0,e=0;e<this.length;e++){var t=this._zeroBits(this.words[e]);if(A+=t,26!==t)break}return A},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(A){return 0!==this.negative?this.abs().inotn(A).iaddn(1):this.clone()},i.prototype.fromTwos=function(A){return this.testn(A-1)?this.notn(A).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(A){for(;this.length<A.length;)this.words[this.length++]=0;for(var e=0;e<A.length;e++)this.words[e]=this.words[e]|A.words[e];return this.strip()},i.prototype.ior=function(A){return r(0==(this.negative|A.negative)),this.iuor(A)},i.prototype.or=function(A){return this.length>A.length?this.clone().ior(A):A.clone().ior(this)},i.prototype.uor=function(A){return this.length>A.length?this.clone().iuor(A):A.clone().iuor(this)},i.prototype.iuand=function(A){var e;e=this.length>A.length?A:this;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]&A.words[t];return this.length=e.length,this.strip()},i.prototype.iand=function(A){return r(0==(this.negative|A.negative)),this.iuand(A)},i.prototype.and=function(A){return this.length>A.length?this.clone().iand(A):A.clone().iand(this)},i.prototype.uand=function(A){return this.length>A.length?this.clone().iuand(A):A.clone().iuand(this)},i.prototype.iuxor=function(A){var e,t;this.length>A.length?(e=this,t=A):(e=A,t=this);for(var r=0;r<t.length;r++)this.words[r]=e.words[r]^t.words[r];if(this!==e)for(;r<e.length;r++)this.words[r]=e.words[r];return this.length=e.length,this.strip()},i.prototype.ixor=function(A){return r(0==(this.negative|A.negative)),this.iuxor(A)},i.prototype.xor=function(A){return this.length>A.length?this.clone().ixor(A):A.clone().ixor(this)},i.prototype.uxor=function(A){return this.length>A.length?this.clone().iuxor(A):A.clone().iuxor(this)},i.prototype.inotn=function(A){r("number"==typeof A&&A>=0);var e=0|Math.ceil(A/26),t=A%26;this._expand(e),t>0&&e--;for(var n=0;n<e;n++)this.words[n]=67108863&~this.words[n];return t>0&&(this.words[n]=~this.words[n]&67108863>>26-t),this.strip()},i.prototype.notn=function(A){return this.clone().inotn(A)},i.prototype.setn=function(A,e){r("number"==typeof A&&A>=0);var t=A/26|0,n=A%26;return this._expand(t+1),this.words[t]=e?this.words[t]|1<<n:this.words[t]&~(1<<n),this.strip()},i.prototype.iadd=function(A){var e,t,r;if(0!==this.negative&&0===A.negative)return this.negative=0,e=this.isub(A),this.negative^=1,this._normSign();if(0===this.negative&&0!==A.negative)return A.negative=0,e=this.isub(A),A.negative=1,e._normSign();this.length>A.length?(t=this,r=A):(t=A,r=this);for(var n=0,i=0;i<r.length;i++)e=(0|t.words[i])+(0|r.words[i])+n,this.words[i]=67108863&e,n=e>>>26;for(;0!==n&&i<t.length;i++)e=(0|t.words[i])+n,this.words[i]=67108863&e,n=e>>>26;if(this.length=t.length,0!==n)this.words[this.length]=n,this.length++;else if(t!==this)for(;i<t.length;i++)this.words[i]=t.words[i];return this},i.prototype.add=function(A){var e;return 0!==A.negative&&0===this.negative?(A.negative=0,e=this.sub(A),A.negative^=1,e):0===A.negative&&0!==this.negative?(this.negative=0,e=A.sub(this),this.negative=1,e):this.length>A.length?this.clone().iadd(A):A.clone().iadd(this)},i.prototype.isub=function(A){if(0!==A.negative){A.negative=0;var e=this.iadd(A);return A.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(A),this.negative=1,this._normSign();var t,r,n=this.cmp(A);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(t=this,r=A):(t=A,r=this);for(var i=0,o=0;o<r.length;o++)i=(e=(0|t.words[o])-(0|r.words[o])+i)>>26,this.words[o]=67108863&e;for(;0!==i&&o<t.length;o++)i=(e=(0|t.words[o])+i)>>26,this.words[o]=67108863&e;if(0===i&&o<t.length&&t!==this)for(;o<t.length;o++)this.words[o]=t.words[o];return this.length=Math.max(this.length,o),t!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(A){return this.clone().isub(A)};var Q=function(A,e,t){var r,n,i,o=A.words,a=e.words,s=t.words,g=0,u=0|o[0],c=8191&u,B=u>>>13,l=0|o[1],Q=8191&l,I=l>>>13,d=0|o[2],h=8191&d,E=d>>>13,f=0|o[3],C=8191&f,p=f>>>13,m=0|o[4],y=8191&m,v=m>>>13,D=0|o[5],w=8191&D,b=D>>>13,F=0|o[6],U=8191&F,S=F>>>13,N=0|o[7],R=8191&N,H=N>>>13,G=0|o[8],M=8191&G,L=G>>>13,x=0|o[9],k=8191&x,Y=x>>>13,_=0|a[0],V=8191&_,P=_>>>13,T=0|a[1],J=8191&T,K=T>>>13,O=0|a[2],j=8191&O,z=O>>>13,q=0|a[3],Z=8191&q,W=q>>>13,X=0|a[4],$=8191&X,AA=X>>>13,eA=0|a[5],tA=8191&eA,rA=eA>>>13,nA=0|a[6],iA=8191&nA,oA=nA>>>13,aA=0|a[7],sA=8191&aA,gA=aA>>>13,uA=0|a[8],cA=8191&uA,BA=uA>>>13,lA=0|a[9],QA=8191&lA,IA=lA>>>13;t.negative=A.negative^e.negative,t.length=19;var dA=(g+(r=Math.imul(c,V))|0)+((8191&(n=(n=Math.imul(c,P))+Math.imul(B,V)|0))<<13)|0;g=((i=Math.imul(B,P))+(n>>>13)|0)+(dA>>>26)|0,dA&=67108863,r=Math.imul(Q,V),n=(n=Math.imul(Q,P))+Math.imul(I,V)|0,i=Math.imul(I,P);var hA=(g+(r=r+Math.imul(c,J)|0)|0)+((8191&(n=(n=n+Math.imul(c,K)|0)+Math.imul(B,J)|0))<<13)|0;g=((i=i+Math.imul(B,K)|0)+(n>>>13)|0)+(hA>>>26)|0,hA&=67108863,r=Math.imul(h,V),n=(n=Math.imul(h,P))+Math.imul(E,V)|0,i=Math.imul(E,P),r=r+Math.imul(Q,J)|0,n=(n=n+Math.imul(Q,K)|0)+Math.imul(I,J)|0,i=i+Math.imul(I,K)|0;var EA=(g+(r=r+Math.imul(c,j)|0)|0)+((8191&(n=(n=n+Math.imul(c,z)|0)+Math.imul(B,j)|0))<<13)|0;g=((i=i+Math.imul(B,z)|0)+(n>>>13)|0)+(EA>>>26)|0,EA&=67108863,r=Math.imul(C,V),n=(n=Math.imul(C,P))+Math.imul(p,V)|0,i=Math.imul(p,P),r=r+Math.imul(h,J)|0,n=(n=n+Math.imul(h,K)|0)+Math.imul(E,J)|0,i=i+Math.imul(E,K)|0,r=r+Math.imul(Q,j)|0,n=(n=n+Math.imul(Q,z)|0)+Math.imul(I,j)|0,i=i+Math.imul(I,z)|0;var fA=(g+(r=r+Math.imul(c,Z)|0)|0)+((8191&(n=(n=n+Math.imul(c,W)|0)+Math.imul(B,Z)|0))<<13)|0;g=((i=i+Math.imul(B,W)|0)+(n>>>13)|0)+(fA>>>26)|0,fA&=67108863,r=Math.imul(y,V),n=(n=Math.imul(y,P))+Math.imul(v,V)|0,i=Math.imul(v,P),r=r+Math.imul(C,J)|0,n=(n=n+Math.imul(C,K)|0)+Math.imul(p,J)|0,i=i+Math.imul(p,K)|0,r=r+Math.imul(h,j)|0,n=(n=n+Math.imul(h,z)|0)+Math.imul(E,j)|0,i=i+Math.imul(E,z)|0,r=r+Math.imul(Q,Z)|0,n=(n=n+Math.imul(Q,W)|0)+Math.imul(I,Z)|0,i=i+Math.imul(I,W)|0;var CA=(g+(r=r+Math.imul(c,$)|0)|0)+((8191&(n=(n=n+Math.imul(c,AA)|0)+Math.imul(B,$)|0))<<13)|0;g=((i=i+Math.imul(B,AA)|0)+(n>>>13)|0)+(CA>>>26)|0,CA&=67108863,r=Math.imul(w,V),n=(n=Math.imul(w,P))+Math.imul(b,V)|0,i=Math.imul(b,P),r=r+Math.imul(y,J)|0,n=(n=n+Math.imul(y,K)|0)+Math.imul(v,J)|0,i=i+Math.imul(v,K)|0,r=r+Math.imul(C,j)|0,n=(n=n+Math.imul(C,z)|0)+Math.imul(p,j)|0,i=i+Math.imul(p,z)|0,r=r+Math.imul(h,Z)|0,n=(n=n+Math.imul(h,W)|0)+Math.imul(E,Z)|0,i=i+Math.imul(E,W)|0,r=r+Math.imul(Q,$)|0,n=(n=n+Math.imul(Q,AA)|0)+Math.imul(I,$)|0,i=i+Math.imul(I,AA)|0;var pA=(g+(r=r+Math.imul(c,tA)|0)|0)+((8191&(n=(n=n+Math.imul(c,rA)|0)+Math.imul(B,tA)|0))<<13)|0;g=((i=i+Math.imul(B,rA)|0)+(n>>>13)|0)+(pA>>>26)|0,pA&=67108863,r=Math.imul(U,V),n=(n=Math.imul(U,P))+Math.imul(S,V)|0,i=Math.imul(S,P),r=r+Math.imul(w,J)|0,n=(n=n+Math.imul(w,K)|0)+Math.imul(b,J)|0,i=i+Math.imul(b,K)|0,r=r+Math.imul(y,j)|0,n=(n=n+Math.imul(y,z)|0)+Math.imul(v,j)|0,i=i+Math.imul(v,z)|0,r=r+Math.imul(C,Z)|0,n=(n=n+Math.imul(C,W)|0)+Math.imul(p,Z)|0,i=i+Math.imul(p,W)|0,r=r+Math.imul(h,$)|0,n=(n=n+Math.imul(h,AA)|0)+Math.imul(E,$)|0,i=i+Math.imul(E,AA)|0,r=r+Math.imul(Q,tA)|0,n=(n=n+Math.imul(Q,rA)|0)+Math.imul(I,tA)|0,i=i+Math.imul(I,rA)|0;var mA=(g+(r=r+Math.imul(c,iA)|0)|0)+((8191&(n=(n=n+Math.imul(c,oA)|0)+Math.imul(B,iA)|0))<<13)|0;g=((i=i+Math.imul(B,oA)|0)+(n>>>13)|0)+(mA>>>26)|0,mA&=67108863,r=Math.imul(R,V),n=(n=Math.imul(R,P))+Math.imul(H,V)|0,i=Math.imul(H,P),r=r+Math.imul(U,J)|0,n=(n=n+Math.imul(U,K)|0)+Math.imul(S,J)|0,i=i+Math.imul(S,K)|0,r=r+Math.imul(w,j)|0,n=(n=n+Math.imul(w,z)|0)+Math.imul(b,j)|0,i=i+Math.imul(b,z)|0,r=r+Math.imul(y,Z)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(v,Z)|0,i=i+Math.imul(v,W)|0,r=r+Math.imul(C,$)|0,n=(n=n+Math.imul(C,AA)|0)+Math.imul(p,$)|0,i=i+Math.imul(p,AA)|0,r=r+Math.imul(h,tA)|0,n=(n=n+Math.imul(h,rA)|0)+Math.imul(E,tA)|0,i=i+Math.imul(E,rA)|0,r=r+Math.imul(Q,iA)|0,n=(n=n+Math.imul(Q,oA)|0)+Math.imul(I,iA)|0,i=i+Math.imul(I,oA)|0;var yA=(g+(r=r+Math.imul(c,sA)|0)|0)+((8191&(n=(n=n+Math.imul(c,gA)|0)+Math.imul(B,sA)|0))<<13)|0;g=((i=i+Math.imul(B,gA)|0)+(n>>>13)|0)+(yA>>>26)|0,yA&=67108863,r=Math.imul(M,V),n=(n=Math.imul(M,P))+Math.imul(L,V)|0,i=Math.imul(L,P),r=r+Math.imul(R,J)|0,n=(n=n+Math.imul(R,K)|0)+Math.imul(H,J)|0,i=i+Math.imul(H,K)|0,r=r+Math.imul(U,j)|0,n=(n=n+Math.imul(U,z)|0)+Math.imul(S,j)|0,i=i+Math.imul(S,z)|0,r=r+Math.imul(w,Z)|0,n=(n=n+Math.imul(w,W)|0)+Math.imul(b,Z)|0,i=i+Math.imul(b,W)|0,r=r+Math.imul(y,$)|0,n=(n=n+Math.imul(y,AA)|0)+Math.imul(v,$)|0,i=i+Math.imul(v,AA)|0,r=r+Math.imul(C,tA)|0,n=(n=n+Math.imul(C,rA)|0)+Math.imul(p,tA)|0,i=i+Math.imul(p,rA)|0,r=r+Math.imul(h,iA)|0,n=(n=n+Math.imul(h,oA)|0)+Math.imul(E,iA)|0,i=i+Math.imul(E,oA)|0,r=r+Math.imul(Q,sA)|0,n=(n=n+Math.imul(Q,gA)|0)+Math.imul(I,sA)|0,i=i+Math.imul(I,gA)|0;var vA=(g+(r=r+Math.imul(c,cA)|0)|0)+((8191&(n=(n=n+Math.imul(c,BA)|0)+Math.imul(B,cA)|0))<<13)|0;g=((i=i+Math.imul(B,BA)|0)+(n>>>13)|0)+(vA>>>26)|0,vA&=67108863,r=Math.imul(k,V),n=(n=Math.imul(k,P))+Math.imul(Y,V)|0,i=Math.imul(Y,P),r=r+Math.imul(M,J)|0,n=(n=n+Math.imul(M,K)|0)+Math.imul(L,J)|0,i=i+Math.imul(L,K)|0,r=r+Math.imul(R,j)|0,n=(n=n+Math.imul(R,z)|0)+Math.imul(H,j)|0,i=i+Math.imul(H,z)|0,r=r+Math.imul(U,Z)|0,n=(n=n+Math.imul(U,W)|0)+Math.imul(S,Z)|0,i=i+Math.imul(S,W)|0,r=r+Math.imul(w,$)|0,n=(n=n+Math.imul(w,AA)|0)+Math.imul(b,$)|0,i=i+Math.imul(b,AA)|0,r=r+Math.imul(y,tA)|0,n=(n=n+Math.imul(y,rA)|0)+Math.imul(v,tA)|0,i=i+Math.imul(v,rA)|0,r=r+Math.imul(C,iA)|0,n=(n=n+Math.imul(C,oA)|0)+Math.imul(p,iA)|0,i=i+Math.imul(p,oA)|0,r=r+Math.imul(h,sA)|0,n=(n=n+Math.imul(h,gA)|0)+Math.imul(E,sA)|0,i=i+Math.imul(E,gA)|0,r=r+Math.imul(Q,cA)|0,n=(n=n+Math.imul(Q,BA)|0)+Math.imul(I,cA)|0,i=i+Math.imul(I,BA)|0;var DA=(g+(r=r+Math.imul(c,QA)|0)|0)+((8191&(n=(n=n+Math.imul(c,IA)|0)+Math.imul(B,QA)|0))<<13)|0;g=((i=i+Math.imul(B,IA)|0)+(n>>>13)|0)+(DA>>>26)|0,DA&