UNPKG

@thresholdkey/customauth

Version:

CustomAuth login with torus to get user private key

2 lines 602 kB
/*! For license information please see customauth.umd.min.js.LICENSE.txt */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Customauth=t():e.Customauth=t()}(self,(()=>(()=>{var e={1111:(e,t)=>{var r;function n(e,t){navigator.onLine||e("offline"),e("error",t)}function i(e,t,r){navigator.serviceWorker.register(e,r).then((function(e){t("registered",e),e.waiting?t("updated",e):e.onupdatefound=function(){t("updatefound",e);var r=e.installing;r.onstatechange=function(){"installed"===r.state&&(navigator.serviceWorker.controller?t("updated",e):t("cached",e))}}})).catch((function(e){return n(t,e)}))}"undefined"!=typeof window&&(r="undefined"==typeof document||"interactive"!==document.readyState&&"complete"!==document.readyState?"undefined"!=typeof Promise?new Promise((function(e){return window.addEventListener("load",e)})):{then:function(e){return window.addEventListener("load",e)}}:Promise.resolve()),t.z=function(e,t){void 0===t&&(t={});var o=t.registrationOptions;void 0===o&&(o={}),delete t.registrationOptions;var s=function(e){for(var r=[],n=arguments.length-1;n-- >0;)r[n]=arguments[n+1];t&&t[e]&&t[e].apply(t,r)};"serviceWorker"in navigator&&r.then((function(){Boolean("localhost"===window.location.hostname||"[::1]"===window.location.hostname||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/))?(function(e,t,r){fetch(e).then((function(n){404===n.status?(t("error",new Error("Service worker not found at "+e)),unregister()):-1===n.headers.get("content-type").indexOf("javascript")?(t("error",new Error("Expected "+e+" to have javascript content-type, but received "+n.headers.get("content-type"))),unregister()):i(e,t,r)})).catch((function(e){return n(t,e)}))}(e,s,o),navigator.serviceWorker.ready.then((function(e){s("ready",e)}))):(i(e,s,o),navigator.serviceWorker.ready.then((function(e){s("ready",e)})))}))}},4572:(e,t,r)=>{"use strict";var n=r(8834).Buffer,i=new(0,r(7554).ec)("secp256k1"),o=r.g.crypto||r.g.msCrypto||{},s=o.subtle||o.webkitSubtle,a=r(5634);const c=n.from("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141","hex"),f=n.alloc(32,0);function u(e,t){if(!e)throw new Error(t||"Assertion failed")}function h(e){return t=e,!(!n.isBuffer(t)||32!==t.length)&&e.compare(f)>0&&e.compare(c)<0;var t}function d(e){return function(t,r,i){return new Promise((function(o){if(s)return s.importKey("raw",r,{name:"AES-CBC"},!1,[e]).then((function(r){var n={name:"AES-CBC",iv:t};return s[e](n,r,i)})).then((function(e){o(n.from(new Uint8Array(e)))}));if("encrypt"===e){var c=a.createCipheriv("aes-256-cbc",r,t);let e=c.update(i),s=c.final();o(n.concat([e,s]))}else if("decrypt"===e){var f=a.createDecipheriv("aes-256-cbc",r,t);let e=f.update(i),s=f.final();o(n.concat([e,s]))}}))}}d("encrypt"),d("decrypt"),t.rc=function(e){return u(32===e.length,"Bad private key"),u(h(e),"Bad private key"),n.from(i.keyFromPrivate(e).getPublic("arr"))};t.Xx=function(e,t){return new Promise((function(r){u(32===e.length,"Bad private key"),u(h(e),"Bad private key"),u(t.length>0,"Message should not be empty"),u(t.length<=32,"Message is too long"),r(n.from(i.sign(t,e,{canonical:!0}).toDER()))}))}},1019:(e,t,r)=>{"use strict";var n=r(8834).Buffer,i=new(0,r(7554).ec)("secp256k1"),o=r.g.crypto||r.g.msCrypto||{},s=o.subtle||o.webkitSubtle,a=r(5634);const c=n.from("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141","hex"),f=n.alloc(32,0);function u(e,t){if(!e)throw new Error(t||"Assertion failed")}function h(e){return t=e,!(!n.isBuffer(t)||32!==t.length)&&e.compare(f)>0&&e.compare(c)<0;var t}function d(e){var t=new Uint8Array(e);return void 0===o.getRandomValues?n.from(a.randomBytes(e)):(o.getRandomValues(t),n.from(t))}function l(e){return new Promise((function(t){var r=a.createHash("sha512").update(e).digest();t(new Uint8Array(r))}))}function p(e){return function(t,r,i){return new Promise((function(o){if(s)return s.importKey("raw",r,{name:"AES-CBC"},!1,[e]).then((function(r){var n={name:"AES-CBC",iv:t};return s[e](n,r,i)})).then((function(e){o(n.from(new Uint8Array(e)))}));if("encrypt"===e){var c=a.createCipheriv("aes-256-cbc",r,t);let e=c.update(i),s=c.final();o(n.concat([e,s]))}else if("decrypt"===e){var f=a.createDecipheriv("aes-256-cbc",r,t);let e=f.update(i),s=f.final();o(n.concat([e,s]))}}))}}var b=p("encrypt"),y=p("decrypt"),g=t.rc=function(e){return u(32===e.length,"Bad private key"),u(h(e),"Bad private key"),n.from(i.keyFromPrivate(e).getPublic("arr"))},m=function(e,t){return new Promise((function(r){u(n.isBuffer(e),"Bad private key"),u(n.isBuffer(t),"Bad public key"),u(32===e.length,"Bad private key"),u(h(e),"Bad private key"),u(65===t.length||33===t.length,"Bad public key"),65===t.length&&u(4===t[0],"Bad public key"),33===t.length&&u(2===t[0]||3===t[0],"Bad public key");var o=i.keyFromPrivate(e),s=i.keyFromPublic(t),a=o.derive(s.getPublic());r(n.from(a.toArray()))}))},v=function(e,t){return new Promise((function(r){u(n.isBuffer(e),"Bad private key"),u(n.isBuffer(t),"Bad public key"),u(32===e.length,"Bad private key"),u(h(e),"Bad private key"),u(65===t.length||33===t.length,"Bad public key"),65===t.length&&u(4===t[0],"Bad public key"),33===t.length&&u(2===t[0]||3===t[0],"Bad public key");var o=i.keyFromPrivate(e),s=i.keyFromPublic(t),a=o.derive(s.getPublic());r(n.from(a.toString(16,64),"hex"))}))};t.HI=function(e,t,r){var i,o,s,c;return r=r||{},new Promise((function(t){for(var n=r.ephemPrivateKey||d(32);!h(n);)n=r.ephemPrivateKey||d(32);o=g(n),t(v(n,e))})).then((function(e){return l(e)})).then((function(e){i=r.iv||d(16);var n=e.slice(0,32);return c=e.slice(32),b(i,n,t)})).then((function(e){s=e;var t=n.concat([i,o,s]);return function(e,t){return new Promise((function(r){var i=a.createHmac("sha256",n.from(e));i.update(t),r(i.digest())}))}(c,t)})).then((function(e){return{iv:i,ephemPublicKey:o,ciphertext:s,mac:e}}))};const w=function(e,t,r=!1){var i;return(r?v:m)(e,t.ephemPublicKey).then((function(e){return l(e)})).then((function(e){i=e.slice(0,32);var r,o,s,c=e.slice(32),f=n.concat([t.iv,t.ephemPublicKey,t.ciphertext]);return r=c,o=f,s=t.mac,new Promise((function(e){var t=a.createHmac("sha256",n.from(r));t.update(o),e(function(e,t){if(e.length!==t.length)return!1;for(var r=0,n=0;n<e.length;n++)r|=e[n]^t[n];return 0===r}(t.digest(),s))}))})).then((function(o){if(!o&&!1===r)return w(e,t,!0);if(!o&&!0===r)throw new Error("bad MAC after trying padded");return y(t.iv,i,t.ciphertext).then((function(e){return n.from(new Uint8Array(e))}))}))};t.pe=w},2812:(e,t,r)=>{"use strict";const n=t;n.bignum=r(2197),n.define=r(5192).define,n.base=r(4798),n.constants=r(6906),n.decoders=r(8211),n.encoders=r(9116)},5192:(e,t,r)=>{"use strict";const n=r(9116),i=r(8211),o=r(1285);function s(e,t){this.name=e,this.body=t,this.decoders={},this.encoders={}}t.define=function(e,t){return new s(e,t)},s.prototype._createNamed=function(e){const t=this.name;function r(e){this._initNamed(e,t)}return o(r,e),r.prototype._initNamed=function(t,r){e.call(this,t,r)},new r(this)},s.prototype._getDecoder=function(e){return e=e||"der",this.decoders.hasOwnProperty(e)||(this.decoders[e]=this._createNamed(i[e])),this.decoders[e]},s.prototype.decode=function(e,t,r){return this._getDecoder(t).decode(e,r)},s.prototype._getEncoder=function(e){return e=e||"der",this.encoders.hasOwnProperty(e)||(this.encoders[e]=this._createNamed(n[e])),this.encoders[e]},s.prototype.encode=function(e,t,r){return this._getEncoder(t).encode(e,r)}},7362:(e,t,r)=>{"use strict";const n=r(1285),i=r(126).b,o=r(7654).Buffer;function s(e,t){i.call(this,t),o.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function a(e,t){if(Array.isArray(e))this.length=0,this.value=e.map((function(e){return a.isEncoderBuffer(e)||(e=new a(e,t)),this.length+=e.length,e}),this);else if("number"==typeof e){if(!(0<=e&&e<=255))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=o.byteLength(e);else{if(!o.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}n(s,i),t.C=s,s.isDecoderBuffer=function(e){return e instanceof s||"object"==typeof e&&o.isBuffer(e.base)&&"DecoderBuffer"===e.constructor.name&&"number"==typeof e.offset&&"number"==typeof e.length&&"function"==typeof e.save&&"function"==typeof e.restore&&"function"==typeof e.isEmpty&&"function"==typeof e.readUInt8&&"function"==typeof e.skip&&"function"==typeof e.raw},s.prototype.save=function(){return{offset:this.offset,reporter:i.prototype.save.call(this)}},s.prototype.restore=function(e){const t=new s(this.base);return t.offset=e.offset,t.length=this.offset,this.offset=e.offset,i.prototype.restore.call(this,e.reporter),t},s.prototype.isEmpty=function(){return this.offset===this.length},s.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")},s.prototype.skip=function(e,t){if(!(this.offset+e<=this.length))return this.error(t||"DecoderBuffer overrun");const r=new s(this.base);return r._reporterState=this._reporterState,r.offset=this.offset,r.length=this.offset+e,this.offset+=e,r},s.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)},t.R=a,a.isEncoderBuffer=function(e){return e instanceof a||"object"==typeof e&&"EncoderBuffer"===e.constructor.name&&"number"==typeof e.length&&"function"==typeof e.join},a.prototype.join=function(e,t){return e||(e=o.alloc(this.length)),t||(t=0),0===this.length||(Array.isArray(this.value)?this.value.forEach((function(r){r.join(e,t),t+=r.length})):("number"==typeof this.value?e[t]=this.value:"string"==typeof this.value?e.write(this.value,t):o.isBuffer(this.value)&&this.value.copy(e,t),t+=this.length)),e}},4798:(e,t,r)=>{"use strict";const n=t;n.Reporter=r(126).b,n.DecoderBuffer=r(7362).C,n.EncoderBuffer=r(7362).R,n.Node=r(847)},847:(e,t,r)=>{"use strict";const n=r(126).b,i=r(7362).R,o=r(7362).C,s=r(9561),a=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],c=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(a);function f(e,t,r){const n={};this._baseState=n,n.name=r,n.enc=e,n.parent=t||null,n.children=null,n.tag=null,n.args=null,n.reverseArgs=null,n.choice=null,n.optional=!1,n.any=!1,n.obj=!1,n.use=null,n.useDecoder=null,n.key=null,n.default=null,n.explicit=null,n.implicit=null,n.contains=null,n.parent||(n.children=[],this._wrap())}e.exports=f;const u=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];f.prototype.clone=function(){const e=this._baseState,t={};u.forEach((function(r){t[r]=e[r]}));const r=new this.constructor(t.parent);return r._baseState=t,r},f.prototype._wrap=function(){const e=this._baseState;c.forEach((function(t){this[t]=function(){const r=new this.constructor(this);return e.children.push(r),r[t].apply(r,arguments)}}),this)},f.prototype._init=function(e){const t=this._baseState;s(null===t.parent),e.call(this),t.children=t.children.filter((function(e){return e._baseState.parent===this}),this),s.equal(t.children.length,1,"Root node can have only one child")},f.prototype._useArgs=function(e){const t=this._baseState,r=e.filter((function(e){return e instanceof this.constructor}),this);e=e.filter((function(e){return!(e instanceof this.constructor)}),this),0!==r.length&&(s(null===t.children),t.children=r,r.forEach((function(e){e._baseState.parent=this}),this)),0!==e.length&&(s(null===t.args),t.args=e,t.reverseArgs=e.map((function(e){if("object"!=typeof e||e.constructor!==Object)return e;const t={};return Object.keys(e).forEach((function(r){r==(0|r)&&(r|=0);const n=e[r];t[n]=r})),t})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(e){f.prototype[e]=function(){const t=this._baseState;throw new Error(e+" not implemented for encoding: "+t.enc)}})),a.forEach((function(e){f.prototype[e]=function(){const t=this._baseState,r=Array.prototype.slice.call(arguments);return s(null===t.tag),t.tag=e,this._useArgs(r),this}})),f.prototype.use=function(e){s(e);const t=this._baseState;return s(null===t.use),t.use=e,this},f.prototype.optional=function(){return this._baseState.optional=!0,this},f.prototype.def=function(e){const t=this._baseState;return s(null===t.default),t.default=e,t.optional=!0,this},f.prototype.explicit=function(e){const t=this._baseState;return s(null===t.explicit&&null===t.implicit),t.explicit=e,this},f.prototype.implicit=function(e){const t=this._baseState;return s(null===t.explicit&&null===t.implicit),t.implicit=e,this},f.prototype.obj=function(){const e=this._baseState,t=Array.prototype.slice.call(arguments);return e.obj=!0,0!==t.length&&this._useArgs(t),this},f.prototype.key=function(e){const t=this._baseState;return s(null===t.key),t.key=e,this},f.prototype.any=function(){return this._baseState.any=!0,this},f.prototype.choice=function(e){const t=this._baseState;return s(null===t.choice),t.choice=e,this._useArgs(Object.keys(e).map((function(t){return e[t]}))),this},f.prototype.contains=function(e){const t=this._baseState;return s(null===t.use),t.contains=e,this},f.prototype._decode=function(e,t){const r=this._baseState;if(null===r.parent)return e.wrapResult(r.children[0]._decode(e,t));let n,i=r.default,s=!0,a=null;if(null!==r.key&&(a=e.enterKey(r.key)),r.optional){let n=null;if(null!==r.explicit?n=r.explicit:null!==r.implicit?n=r.implicit:null!==r.tag&&(n=r.tag),null!==n||r.any){if(s=this._peekTag(e,n,r.any),e.isError(s))return s}else{const n=e.save();try{null===r.choice?this._decodeGeneric(r.tag,e,t):this._decodeChoice(e,t),s=!0}catch(e){s=!1}e.restore(n)}}if(r.obj&&s&&(n=e.enterObject()),s){if(null!==r.explicit){const t=this._decodeTag(e,r.explicit);if(e.isError(t))return t;e=t}const n=e.offset;if(null===r.use&&null===r.choice){let t;r.any&&(t=e.save());const n=this._decodeTag(e,null!==r.implicit?r.implicit:r.tag,r.any);if(e.isError(n))return n;r.any?i=e.raw(t):e=n}if(t&&t.track&&null!==r.tag&&t.track(e.path(),n,e.length,"tagged"),t&&t.track&&null!==r.tag&&t.track(e.path(),e.offset,e.length,"content"),r.any||(i=null===r.choice?this._decodeGeneric(r.tag,e,t):this._decodeChoice(e,t)),e.isError(i))return i;if(r.any||null!==r.choice||null===r.children||r.children.forEach((function(r){r._decode(e,t)})),r.contains&&("octstr"===r.tag||"bitstr"===r.tag)){const n=new o(i);i=this._getUse(r.contains,e._reporterState.obj)._decode(n,t)}}return r.obj&&s&&(i=e.leaveObject(n)),null===r.key||null===i&&!0!==s?null!==a&&e.exitKey(a):e.leaveKey(a,r.key,i),i},f.prototype._decodeGeneric=function(e,t,r){const n=this._baseState;return"seq"===e||"set"===e?null:"seqof"===e||"setof"===e?this._decodeList(t,e,n.args[0],r):/str$/.test(e)?this._decodeStr(t,e,r):"objid"===e&&n.args?this._decodeObjid(t,n.args[0],n.args[1],r):"objid"===e?this._decodeObjid(t,null,null,r):"gentime"===e||"utctime"===e?this._decodeTime(t,e,r):"null_"===e?this._decodeNull(t,r):"bool"===e?this._decodeBool(t,r):"objDesc"===e?this._decodeStr(t,e,r):"int"===e||"enum"===e?this._decodeInt(t,n.args&&n.args[0],r):null!==n.use?this._getUse(n.use,t._reporterState.obj)._decode(t,r):t.error("unknown tag: "+e)},f.prototype._getUse=function(e,t){const r=this._baseState;return r.useDecoder=this._use(e,t),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},f.prototype._decodeChoice=function(e,t){const r=this._baseState;let n=null,i=!1;return Object.keys(r.choice).some((function(o){const s=e.save(),a=r.choice[o];try{const r=a._decode(e,t);if(e.isError(r))return!1;n={type:o,value:r},i=!0}catch(t){return e.restore(s),!1}return!0}),this),i?n:e.error("Choice not matched")},f.prototype._createEncoderBuffer=function(e){return new i(e,this.reporter)},f.prototype._encode=function(e,t,r){const n=this._baseState;if(null!==n.default&&n.default===e)return;const i=this._encodeValue(e,t,r);return void 0===i||this._skipDefault(i,t,r)?void 0:i},f.prototype._encodeValue=function(e,t,r){const i=this._baseState;if(null===i.parent)return i.children[0]._encode(e,t||new n);let o=null;if(this.reporter=t,i.optional&&void 0===e){if(null===i.default)return;e=i.default}let s=null,a=!1;if(i.any)o=this._createEncoderBuffer(e);else if(i.choice)o=this._encodeChoice(e,t);else if(i.contains)s=this._getUse(i.contains,r)._encode(e,t),a=!0;else if(i.children)s=i.children.map((function(r){if("null_"===r._baseState.tag)return r._encode(null,t,e);if(null===r._baseState.key)return t.error("Child should have a key");const n=t.enterKey(r._baseState.key);if("object"!=typeof e)return t.error("Child expected, but input is not object");const i=r._encode(e[r._baseState.key],t,e);return t.leaveKey(n),i}),this).filter((function(e){return e})),s=this._createEncoderBuffer(s);else if("seqof"===i.tag||"setof"===i.tag){if(!i.args||1!==i.args.length)return t.error("Too many args for : "+i.tag);if(!Array.isArray(e))return t.error("seqof/setof, but data is not Array");const r=this.clone();r._baseState.implicit=null,s=this._createEncoderBuffer(e.map((function(r){const n=this._baseState;return this._getUse(n.args[0],e)._encode(r,t)}),r))}else null!==i.use?o=this._getUse(i.use,r)._encode(e,t):(s=this._encodePrimitive(i.tag,e),a=!0);if(!i.any&&null===i.choice){const e=null!==i.implicit?i.implicit:i.tag,r=null===i.implicit?"universal":"context";null===e?null===i.use&&t.error("Tag could be omitted only for .use()"):null===i.use&&(o=this._encodeComposite(e,a,r,s))}return null!==i.explicit&&(o=this._encodeComposite(i.explicit,!1,"context",o)),o},f.prototype._encodeChoice=function(e,t){const r=this._baseState,n=r.choice[e.type];return n||s(!1,e.type+" not found in "+JSON.stringify(Object.keys(r.choice))),n._encode(e.value,t)},f.prototype._encodePrimitive=function(e,t){const r=this._baseState;if(/str$/.test(e))return this._encodeStr(t,e);if("objid"===e&&r.args)return this._encodeObjid(t,r.reverseArgs[0],r.args[1]);if("objid"===e)return this._encodeObjid(t,null,null);if("gentime"===e||"utctime"===e)return this._encodeTime(t,e);if("null_"===e)return this._encodeNull();if("int"===e||"enum"===e)return this._encodeInt(t,r.args&&r.reverseArgs[0]);if("bool"===e)return this._encodeBool(t);if("objDesc"===e)return this._encodeStr(t,e);throw new Error("Unsupported tag: "+e)},f.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)},f.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(e)}},126:(e,t,r)=>{"use strict";const n=r(1285);function i(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function o(e,t){this.path=e,this.rethrow(t)}t.b=i,i.prototype.isError=function(e){return e instanceof o},i.prototype.save=function(){const e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}},i.prototype.restore=function(e){const t=this._reporterState;t.obj=e.obj,t.path=t.path.slice(0,e.pathLen)},i.prototype.enterKey=function(e){return this._reporterState.path.push(e)},i.prototype.exitKey=function(e){const t=this._reporterState;t.path=t.path.slice(0,e-1)},i.prototype.leaveKey=function(e,t,r){const n=this._reporterState;this.exitKey(e),null!==n.obj&&(n.obj[t]=r)},i.prototype.path=function(){return this._reporterState.path.join("/")},i.prototype.enterObject=function(){const e=this._reporterState,t=e.obj;return e.obj={},t},i.prototype.leaveObject=function(e){const t=this._reporterState,r=t.obj;return t.obj=e,r},i.prototype.error=function(e){let t;const r=this._reporterState,n=e instanceof o;if(t=n?e:new o(r.path.map((function(e){return"["+JSON.stringify(e)+"]"})).join(""),e.message||e,e.stack),!r.options.partial)throw t;return n||r.errors.push(t),t},i.prototype.wrapResult=function(e){const t=this._reporterState;return t.options.partial?{result:this.isError(e)?null:e,errors:t.errors}:e},n(o,Error),o.prototype.rethrow=function(e){if(this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,o),!this.stack)try{throw new Error(this.message)}catch(e){this.stack=e.stack}return this}},4131:(e,t)=>{"use strict";function r(e){const t={};return Object.keys(e).forEach((function(r){(0|r)==r&&(r|=0);const n=e[r];t[n]=r})),t}t.tagClass={0:"universal",1:"application",2:"context",3:"private"},t.tagClassByName=r(t.tagClass),t.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"},t.tagByName=r(t.tag)},6906:(e,t,r)=>{"use strict";const n=t;n._reverse=function(e){const t={};return Object.keys(e).forEach((function(r){(0|r)==r&&(r|=0);const n=e[r];t[n]=r})),t},n.der=r(4131)},1066:(e,t,r)=>{"use strict";const n=r(1285),i=r(2197),o=r(7362).C,s=r(847),a=r(4131);function c(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new f,this.tree._init(e.body)}function f(e){s.call(this,"der",e)}function u(e,t){let r=e.readUInt8(t);if(e.isError(r))return r;const n=a.tagClass[r>>6],i=0==(32&r);if(31==(31&r)){let n=r;for(r=0;128==(128&n);){if(n=e.readUInt8(t),e.isError(n))return n;r<<=7,r|=127&n}}else r&=31;return{cls:n,primitive:i,tag:r,tagStr:a.tag[r]}}function h(e,t,r){let n=e.readUInt8(r);if(e.isError(n))return n;if(!t&&128===n)return null;if(0==(128&n))return n;const i=127&n;if(i>4)return e.error("length octect is too long");n=0;for(let t=0;t<i;t++){n<<=8;const t=e.readUInt8(r);if(e.isError(t))return t;n|=t}return n}e.exports=c,c.prototype.decode=function(e,t){return o.isDecoderBuffer(e)||(e=new o(e,t)),this.tree._decode(e,t)},n(f,s),f.prototype._peekTag=function(e,t,r){if(e.isEmpty())return!1;const n=e.save(),i=u(e,'Failed to peek tag: "'+t+'"');return e.isError(i)?i:(e.restore(n),i.tag===t||i.tagStr===t||i.tagStr+"of"===t||r)},f.prototype._decodeTag=function(e,t,r){const n=u(e,'Failed to decode tag of "'+t+'"');if(e.isError(n))return n;let i=h(e,n.primitive,'Failed to get length of "'+t+'"');if(e.isError(i))return i;if(!r&&n.tag!==t&&n.tagStr!==t&&n.tagStr+"of"!==t)return e.error('Failed to match tag: "'+t+'"');if(n.primitive||null!==i)return e.skip(i,'Failed to match body of: "'+t+'"');const o=e.save(),s=this._skipUntilEnd(e,'Failed to skip indefinite length body: "'+this.tag+'"');return e.isError(s)?s:(i=e.offset-o.offset,e.restore(o),e.skip(i,'Failed to match body of: "'+t+'"'))},f.prototype._skipUntilEnd=function(e,t){for(;;){const r=u(e,t);if(e.isError(r))return r;const n=h(e,r.primitive,t);if(e.isError(n))return n;let i;if(i=r.primitive||null!==n?e.skip(n):this._skipUntilEnd(e,t),e.isError(i))return i;if("end"===r.tagStr)break}},f.prototype._decodeList=function(e,t,r,n){const i=[];for(;!e.isEmpty();){const t=this._peekTag(e,"end");if(e.isError(t))return t;const o=r.decode(e,"der",n);if(e.isError(o)&&t)break;i.push(o)}return i},f.prototype._decodeStr=function(e,t){if("bitstr"===t){const t=e.readUInt8();return e.isError(t)?t:{unused:t,data:e.raw()}}if("bmpstr"===t){const t=e.raw();if(t.length%2==1)return e.error("Decoding of string type: bmpstr length mismatch");let r="";for(let e=0;e<t.length/2;e++)r+=String.fromCharCode(t.readUInt16BE(2*e));return r}if("numstr"===t){const t=e.raw().toString("ascii");return this._isNumstr(t)?t:e.error("Decoding of string type: numstr unsupported characters")}if("octstr"===t)return e.raw();if("objDesc"===t)return e.raw();if("printstr"===t){const t=e.raw().toString("ascii");return this._isPrintstr(t)?t:e.error("Decoding of string type: printstr unsupported characters")}return/str$/.test(t)?e.raw().toString():e.error("Decoding of string type: "+t+" unsupported")},f.prototype._decodeObjid=function(e,t,r){let n;const i=[];let o=0,s=0;for(;!e.isEmpty();)s=e.readUInt8(),o<<=7,o|=127&s,0==(128&s)&&(i.push(o),o=0);128&s&&i.push(o);const a=i[0]/40|0,c=i[0]%40;if(n=r?i:[a,c].concat(i.slice(1)),t){let e=t[n.join(" ")];void 0===e&&(e=t[n.join(".")]),void 0!==e&&(n=e)}return n},f.prototype._decodeTime=function(e,t){const r=e.raw().toString();let n,i,o,s,a,c;if("gentime"===t)n=0|r.slice(0,4),i=0|r.slice(4,6),o=0|r.slice(6,8),s=0|r.slice(8,10),a=0|r.slice(10,12),c=0|r.slice(12,14);else{if("utctime"!==t)return e.error("Decoding "+t+" time is not supported yet");n=0|r.slice(0,2),i=0|r.slice(2,4),o=0|r.slice(4,6),s=0|r.slice(6,8),a=0|r.slice(8,10),c=0|r.slice(10,12),n=n<70?2e3+n:1900+n}return Date.UTC(n,i-1,o,s,a,c,0)},f.prototype._decodeNull=function(){return null},f.prototype._decodeBool=function(e){const t=e.readUInt8();return e.isError(t)?t:0!==t},f.prototype._decodeInt=function(e,t){const r=e.raw();let n=new i(r);return t&&(n=t[n.toString(10)]||n),n},f.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getDecoder("der").tree}},8211:(e,t,r)=>{"use strict";const n=t;n.der=r(1066),n.pem=r(3956)},3956:(e,t,r)=>{"use strict";const n=r(1285),i=r(7654).Buffer,o=r(1066);function s(e){o.call(this,e),this.enc="pem"}n(s,o),e.exports=s,s.prototype.decode=function(e,t){const r=e.toString().split(/[\r\n]+/g),n=t.label.toUpperCase(),s=/^-----(BEGIN|END) ([^-]+)-----$/;let a=-1,c=-1;for(let e=0;e<r.length;e++){const t=r[e].match(s);if(null!==t&&t[2]===n){if(-1!==a){if("END"!==t[1])break;c=e;break}if("BEGIN"!==t[1])break;a=e}}if(-1===a||-1===c)throw new Error("PEM section not found for: "+n);const f=r.slice(a+1,c).join("");f.replace(/[^a-z0-9+/=]+/gi,"");const u=i.from(f,"base64");return o.prototype.decode.call(this,u,t)}},5758:(e,t,r)=>{"use strict";const n=r(1285),i=r(7654).Buffer,o=r(847),s=r(4131);function a(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new c,this.tree._init(e.body)}function c(e){o.call(this,"der",e)}function f(e){return e<10?"0"+e:e}e.exports=a,a.prototype.encode=function(e,t){return this.tree._encode(e,t).join()},n(c,o),c.prototype._encodeComposite=function(e,t,r,n){const o=function(e,t,r,n){let i;if("seqof"===e?e="seq":"setof"===e&&(e="set"),s.tagByName.hasOwnProperty(e))i=s.tagByName[e];else{if("number"!=typeof e||(0|e)!==e)return n.error("Unknown tag: "+e);i=e}return i>=31?n.error("Multi-octet tag encoding unsupported"):(t||(i|=32),i|=s.tagClassByName[r||"universal"]<<6,i)}(e,t,r,this.reporter);if(n.length<128){const e=i.alloc(2);return e[0]=o,e[1]=n.length,this._createEncoderBuffer([e,n])}let a=1;for(let e=n.length;e>=256;e>>=8)a++;const c=i.alloc(2+a);c[0]=o,c[1]=128|a;for(let e=1+a,t=n.length;t>0;e--,t>>=8)c[e]=255&t;return this._createEncoderBuffer([c,n])},c.prototype._encodeStr=function(e,t){if("bitstr"===t)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===t){const t=i.alloc(2*e.length);for(let r=0;r<e.length;r++)t.writeUInt16BE(e.charCodeAt(r),2*r);return this._createEncoderBuffer(t)}return"numstr"===t?this._isNumstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===t?this._isPrintstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(t)||"objDesc"===t?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: "+t+" unsupported")},c.prototype._encodeObjid=function(e,t,r){if("string"==typeof e){if(!t)return this.reporter.error("string objid given, but no values map found");if(!t.hasOwnProperty(e))return this.reporter.error("objid not found in values map");e=t[e].split(/[\s.]+/g);for(let t=0;t<e.length;t++)e[t]|=0}else if(Array.isArray(e)){e=e.slice();for(let t=0;t<e.length;t++)e[t]|=0}if(!Array.isArray(e))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(e));if(!r){if(e[1]>=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,40*e[0]+e[1])}let n=0;for(let t=0;t<e.length;t++){let r=e[t];for(n++;r>=128;r>>=7)n++}const o=i.alloc(n);let s=o.length-1;for(let t=e.length-1;t>=0;t--){let r=e[t];for(o[s--]=127&r;(r>>=7)>0;)o[s--]=128|127&r}return this._createEncoderBuffer(o)},c.prototype._encodeTime=function(e,t){let r;const n=new Date(e);return"gentime"===t?r=[f(n.getUTCFullYear()),f(n.getUTCMonth()+1),f(n.getUTCDate()),f(n.getUTCHours()),f(n.getUTCMinutes()),f(n.getUTCSeconds()),"Z"].join(""):"utctime"===t?r=[f(n.getUTCFullYear()%100),f(n.getUTCMonth()+1),f(n.getUTCDate()),f(n.getUTCHours()),f(n.getUTCMinutes()),f(n.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(r,"octstr")},c.prototype._encodeNull=function(){return this._createEncoderBuffer("")},c.prototype._encodeInt=function(e,t){if("string"==typeof e){if(!t)return this.reporter.error("String int or enum given, but no values map");if(!t.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=t[e]}if("number"!=typeof e&&!i.isBuffer(e)){const t=e.toArray();!e.sign&&128&t[0]&&t.unshift(0),e=i.from(t)}if(i.isBuffer(e)){let t=e.length;0===e.length&&t++;const r=i.alloc(t);return e.copy(r),0===e.length&&(r[0]=0),this._createEncoderBuffer(r)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);let r=1;for(let t=e;t>=256;t>>=8)r++;const n=new Array(r);for(let t=n.length-1;t>=0;t--)n[t]=255&e,e>>=8;return 128&n[0]&&n.unshift(0),this._createEncoderBuffer(i.from(n))},c.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},c.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},c.prototype._skipDefault=function(e,t,r){const n=this._baseState;let i;if(null===n.default)return!1;const o=e.join();if(void 0===n.defaultBuffer&&(n.defaultBuffer=this._encodeValue(n.default,t,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}},9116:(e,t,r)=>{"use strict";const n=t;n.der=r(5758),n.pem=r(9245)},9245:(e,t,r)=>{"use strict";const n=r(1285),i=r(5758);function o(e){i.call(this,e),this.enc="pem"}n(o,i),e.exports=o,o.prototype.encode=function(e,t){const r=i.prototype.encode.call(this,e).toString("base64"),n=["-----BEGIN "+t.label+"-----"];for(let e=0;e<r.length;e+=64)n.push(r.slice(e,e+64));return n.push("-----END "+t.label+"-----"),n.join("\n")}},1696:(e,t,r)=>{"use strict";var n=r(4406);function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}var o,s,a=r(7515).codes,c=a.ERR_AMBIGUOUS_ARGUMENT,f=a.ERR_INVALID_ARG_TYPE,u=a.ERR_INVALID_ARG_VALUE,h=a.ERR_INVALID_RETURN_VALUE,d=a.ERR_MISSING_ARGS,l=r(4082),p=r(3335).inspect,b=r(3335).types,y=b.isPromise,g=b.isRegExp,m=Object.assign?Object.assign:r(4956).assign,v=Object.is?Object.is:r(4679);function w(){var e=r(6796);o=e.isDeepEqual,s=e.isDeepStrictEqual}new Map;var _=!1,S=e.exports=x,E={};function A(e){if(e.message instanceof Error)throw e.message;throw new l(e)}function k(e,t,r,n){if(!r){var i=!1;if(0===t)i=!0,n="No value argument passed to `assert.ok()`";else if(n instanceof Error)throw n;var o=new l({actual:r,expected:!0,message:n,operator:"==",stackStartFn:e});throw o.generatedMessage=i,o}}function x(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];k.apply(void 0,[x,t.length].concat(t))}S.fail=function e(t,r,i,o,s){var a,c=arguments.length;if(0===c?a="Failed":1===c?(i=t,t=void 0):(!1===_&&(_=!0,(n.emitWarning?n.emitWarning:console.warn.bind(console))("assert.fail() with more than one argument is deprecated. Please use assert.strictEqual() instead or only pass a message.","DeprecationWarning","DEP0094")),2===c&&(o="!=")),i instanceof Error)throw i;var f={actual:t,expected:r,operator:void 0===o?"fail":o,stackStartFn:s||e};void 0!==i&&(f.message=i);var u=new l(f);throw a&&(u.message=a,u.generatedMessage=!0),u},S.AssertionError=l,S.ok=x,S.equal=function e(t,r,n){if(arguments.length<2)throw new d("actual","expected");t!=r&&A({actual:t,expected:r,message:n,operator:"==",stackStartFn:e})},S.notEqual=function e(t,r,n){if(arguments.length<2)throw new d("actual","expected");t==r&&A({actual:t,expected:r,message:n,operator:"!=",stackStartFn:e})},S.deepEqual=function e(t,r,n){if(arguments.length<2)throw new d("actual","expected");void 0===o&&w(),o(t,r)||A({actual:t,expected:r,message:n,operator:"deepEqual",stackStartFn:e})},S.notDeepEqual=function e(t,r,n){if(arguments.length<2)throw new d("actual","expected");void 0===o&&w(),o(t,r)&&A({actual:t,expected:r,message:n,operator:"notDeepEqual",stackStartFn:e})},S.deepStrictEqual=function e(t,r,n){if(arguments.length<2)throw new d("actual","expected");void 0===o&&w(),s(t,r)||A({actual:t,expected:r,message:n,operator:"deepStrictEqual",stackStartFn:e})},S.notDeepStrictEqual=function e(t,r,n){if(arguments.length<2)throw new d("actual","expected");void 0===o&&w(),s(t,r)&&A({actual:t,expected:r,message:n,operator:"notDeepStrictEqual",stackStartFn:e})},S.strictEqual=function e(t,r,n){if(arguments.length<2)throw new d("actual","expected");v(t,r)||A({actual:t,expected:r,message:n,operator:"strictEqual",stackStartFn:e})},S.notStrictEqual=function e(t,r,n){if(arguments.length<2)throw new d("actual","expected");v(t,r)&&A({actual:t,expected:r,message:n,operator:"notStrictEqual",stackStartFn:e})};var M=function e(t,r,n){var i=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),r.forEach((function(e){e in t&&(void 0!==n&&"string"==typeof n[e]&&g(t[e])&&t[e].test(n[e])?i[e]=n[e]:i[e]=t[e])}))};function O(e,t,r,n){if("function"!=typeof t){if(g(t))return t.test(e);if(2===arguments.length)throw new f("expected",["Function","RegExp"],t);if("object"!==i(e)||null===e){var a=new l({actual:e,expected:t,message:r,operator:"deepStrictEqual",stackStartFn:n});throw a.operator=n.name,a}var c=Object.keys(t);if(t instanceof Error)c.push("name","message");else if(0===c.length)throw new u("error",t,"may not be an empty object");return void 0===o&&w(),c.forEach((function(i){"string"==typeof e[i]&&g(t[i])&&t[i].test(e[i])||function(e,t,r,n,i,o){if(!(r in e)||!s(e[r],t[r])){if(!n){var a=new M(e,i),c=new M(t,i,e),f=new l({actual:a,expected:c,operator:"deepStrictEqual",stackStartFn:o});throw f.actual=e,f.expected=t,f.operator=o.name,f}A({actual:e,expected:t,message:n,operator:o.name,stackStartFn:o})}}(e,t,i,r,c,n)})),!0}return void 0!==t.prototype&&e instanceof t||!Error.isPrototypeOf(t)&&!0===t.call({},e)}function P(e){if("function"!=typeof e)throw new f("fn","Function",e);try{e()}catch(e){return e}return E}function B(e){return y(e)||null!==e&&"object"===i(e)&&"function"==typeof e.then&&"function"==typeof e.catch}function I(e){return Promise.resolve().then((function(){var t;if("function"==typeof e){if(!B(t=e()))throw new h("instance of Promise","promiseFn",t)}else{if(!B(e))throw new f("promiseFn",["Function","Promise"],e);t=e}return Promise.resolve().then((function(){return t})).then((function(){return E})).catch((function(e){return e}))}))}function R(e,t,r,n){if("string"==typeof r){if(4===arguments.length)throw new f("error",["Object","Error","Function","RegExp"],r);if("object"===i(t)&&null!==t){if(t.message===r)throw new c("error/message",'The error message "'.concat(t.message,'" is identical to the message.'))}else if(t===r)throw new c("error/message",'The error "'.concat(t,'" is identical to the message.'));n=r,r=void 0}else if(null!=r&&"object"!==i(r)&&"function"!=typeof r)throw new f("error",["Object","Error","Function","RegExp"],r);if(t===E){var o="";r&&r.name&&(o+=" (".concat(r.name,")")),o+=n?": ".concat(n):".";var s="rejects"===e.name?"rejection":"exception";A({actual:void 0,expected:r,operator:e.name,message:"Missing expected ".concat(s).concat(o),stackStartFn:e})}if(r&&!O(t,r,n,e))throw t}function T(e,t,r,n){if(t!==E){if("string"==typeof r&&(n=r,r=void 0),!r||O(t,r)){var i=n?": ".concat(n):".",o="doesNotReject"===e.name?"rejection":"exception";A({actual:t,expected:r,operator:e.name,message:"Got unwanted ".concat(o).concat(i,"\n")+'Actual message: "'.concat(t&&t.message,'"'),stackStartFn:e})}throw t}}function j(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];k.apply(void 0,[j,t.length].concat(t))}S.throws=function e(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];R.apply(void 0,[e,P(t)].concat(n))},S.rejects=function e(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return I(t).then((function(t){return R.apply(void 0,[e,t].concat(n))}))},S.doesNotThrow=function e(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];T.apply(void 0,[e,P(t)].concat(n))},S.doesNotReject=function e(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return I(t).then((function(t){return T.apply(void 0,[e,t].concat(n))}))},S.ifError=function e(t){if(null!=t){var r="ifError got unwanted exception: ";"object"===i(t)&&"string"==typeof t.message?0===t.message.length&&t.constructor?r+=t.constructor.name:r+=t.message:r+=p(t);var n=new l({actual:t,expected:null,operator:"ifError",message:r,stackStartFn:e}),o=t.stack;if("string"==typeof o){var s=o.split("\n");s.shift();for(var a=n.stack.split("\n"),c=0;c<s.length;c++){var f=a.indexOf(s[c]);if(-1!==f){a=a.slice(0,f);break}}n.stack="".concat(a.join("\n"),"\n").concat(s.join("\n"))}throw n}},S.strict=m(j,S,{equal:S.strictEqual,deepEqual:S.deepStrictEqual,notEqual:S.notStrictEqual,notDeepEqual:S.notDeepStrictEqual}),S.strict.strict=S.strict},4082:(e,t,r)=>{"use strict";var n=r(4406);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function s(e,t){return!t||"object"!==d(t)&&"function"!=typeof t?a(e):t}function a(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function c(e){var t="function"==typeof Map?new Map:void 0;return c=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return f(e,arguments,h(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),u(n,e)},c(e)}function f(e,t,r){return f=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&u(i,r.prototype),i},f.apply(null,arguments)}function u(e,t){return u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},u(e,t)}function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},h(e)}function d(e){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d(e)}var l=r(3335).inspect,p=r(7515).codes.ERR_INVALID_ARG_TYPE;function b(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}var y="",g="",m="",v="",w={deepStrictEqual:"Expected values to be strictly deep-equal:",strictEqual:"Expected values to be strictly equal:",strictEqualObject:'Expected "actual" to be reference-equal to "expected":',deepEqual:"Expected values to be loosely deep-equal:",equal:"Expected values to be loosely equal:",notDeepStrictEqual:'Expected "actual" not to be strictly deep-equal to:',notStrictEqual:'Expected "actual" to be strictly unequal to:',notStrictEqualObject:'Expected "actual" not to be reference-equal to "expected":',notDeepEqual:'Expected "actual" not to be loosely deep-equal to:',notEqual:'Expected "actual" to be loosely unequal to:',notIdentical:"Values identical but not reference-equal:"};function _(e){var t=Object.keys(e),r=Object.create(Object.getPrototypeOf(e));return t.forEach((function(t){r[t]=e[t]})),Object.defineProperty(r,"message",{value:e.message}),r}function S(e){return l(e,{compact:!1,customInspect:!1,depth:1e3,maxArrayLength:1/0,showHidden:!1,breakLength:1/0,showProxy:!1,sorted:!0,getters:!0})}var E=function(e){function t(e){var r;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),"object"!==d(e)||null===e)throw new p("options","Object",e);var i=e.message,o=e.operator,c=e.stackStartFn,f=e.actual,u=e.expected,l=Error.stackTraceLimit;if(Error.stackTraceLimit=0,null!=i)r=s(this,h(t).call(this,String(i)));else if(n.stderr&&n.stderr.isTTY&&(n.stderr&&n.stderr.getColorDepth&&1!==n.stderr.getColorDepth()?(y="",g="",v="",m=""):(y="",g="",v="",m="")),"object"===d(f)&&null!==f&&"object"===d(u)&&null!==u&&"stack"in f&&f instanceof Error&&"stack"in u&&u instanceof Error&&(f=_(f),u=_(u)),"deepStrictEqual"===o||"strictEqual"===o)r=s(this,h(t).call(this,function(e,t,r){var i="",o="",s=0,a="",c=!1,f=S(e),u=f.split("\n"),h=S(t).split("\n"),l=0,p="";if("strictEqual"===r&&"object"===d(e)&&"object"===d(t)&&null!==e&&null!==t&&(r="strictEqualObject"),1===u.length&&1===h.length&&u[0]!==h[0]){var _=u[0].length+h[0].length;if(_<=10){if(!("object"===d(e)&&null!==e||"object"===d(t)&&null!==t||0===e&&0===t))return"".concat(w[r],"\n\n")+"".concat(u[0]," !== ").concat(h[0],"\n")}else if("strictEqualObject"!==r&&_<(n.stderr&&n.stderr.isTTY?n.stderr.columns:80)){for(;u[0][l]===h[0][l];)l++;l>2&&(p="\n ".concat(function(e,t){if(t=Math.floor(t),0==e.length||0==t)return"";var r=e.length*t;for(t=Math.floor(Math.log(t)/Math.log(2));t;)e+=e,t--;return e+e.substring(0,r-e.length)}(" ",l),"^"),l=0)}}for(var E=u[u.length-1],A=h[h.length-1];E===A&&(l++<2?a="\n ".concat(E).concat(a):i=E,u.pop(),h.pop(),0!==u.length&&0!==h.length);)E=u[u.length-1],A=h[h.length-1];var k=Math.max(u.length,h.length);if(0===k){var x=f.split("\n");if(x.length>30)for(x[26]="".concat(y,"...").concat(v);x.length>27;)x.pop();return"".concat(w.notIdentical,"\n\n").concat(x.join("\n"),"\n")}l>3&&(a="\n".concat(y,"...").concat(v).concat(a),c=!0),""!==i&&(a="\n ".concat(i).concat(a),i="");var M=0,O=w[r]+"\n".concat(g,"+ actual").concat(v," ").concat(m,"- expected").concat(v),P=" ".concat(y,"...").concat(v," Lines skipped");for(l=0;l<k;l++){var B=l-s;if(u.length<l+1)B>1&&l>2&&(B>4?(o+="\n".concat(y,"...").concat(v),c=!0):B>3&&(o+="\n ".concat(h[l-2]),M++),o+="\n ".concat(h[l-1]),M++),s=l,i+="\n".concat(m,"-").concat(v," ").concat(h[l]),M++;else if(h.length<l+1)B>1&&l>2&&(B>4?(o+="\n".concat(y,"...").concat(v),c=!0):B>3&&(o+="\n ".concat(u[l-2]),M++),o+="\n ".concat(u[l-1]),M++),s=l,o+="\n".concat(g,"+").concat(v," ").concat(u[l]),M++;else{var I=h[l],R=u[l],T=R!==I&&(!b(R,",")||R.slice(0,-1)!==I);T&&b(I,",")&&I.slice(0,-1)===R&&(T=!1,R+=","),T?(B>1&&l>2&&(B>4?(o+="\n".concat(y,"...").concat(v),c=!0):B>3&&(o+="\n ".concat(u[l-2]),M++),o+="\n ".concat(u[l-1]),M++),s=l,o+="\n".concat(g,"+").concat(v," ").concat(R),i+="\n".concat(m,"-").concat(v," ").concat(I),M+=2):(o+=i,i="",1!==B&&0!==l||(o+="\n ".concat(R),M++))}if(M>20&&l<k-2)return"".concat(O).concat(P,"\n").concat(o,"\n").concat(y,"...").concat(v).concat(i,"\n")+"".concat(y,"...").concat(v)}return"".concat(O).concat(c?P:"","\n").concat(o).concat(i).concat(a).concat(p)}(f,u,o)));else if("notDeepStrictEqual"===o||"notStrictEqual"===o){var E=w[o],A=S(f).split("\n");if("notStrictEqual"===o&&"object"===d(f)&&null!==f&&(E=w.notStrictEqualObject),A.length>30)for(A[26]="".concat(y,"...").concat(v);A.length>27;)A.pop();r=1===A.length?s(this,h(t).call(this,"".concat(E," ").concat(A[0]))):s(this,h(t).call(this,"".concat(E,"\n\n").concat(A.join("\n"),"\n")))}else{var k=S(f),x="",M=w[o];"notDeepEqual"===o||"notEqual"===o?(k="".concat(w[o],"\n\n").concat(k)).length>1024&&(k="".concat(k.slice(0,1021),"...")):(x="".concat(S(u)),k.length>512&&(k="".concat(k.slice(0,509),"...")),x.length>512&&(x="".concat(x.slice(0,509),"...")),"deepEqual"===o||"equal"===o?k="".concat(M,"\n\n").concat(k,"\n\nshould equal\n\n"):x=" ".concat(o," ").concat(x)),r=s(this,h(t).call(this,"".concat(k).concat(x)))}return Error.stackTraceLimit=l,r.generatedMessage=!i,Object.defineProperty(a(r),"name",{value:"AssertionError [ERR_ASSERTION]",enumerable:!1,writable:!0,configurable:!0}),r.code="ERR_ASSERTION",r.actual=f,r.expected=u,r.operator=o,Error.captureStackTrace&&Error.captureStackTrace(a(r),c),r.stack,r.name="AssertionError",s(r)}var r,c;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&u(e,t)}(t,e),r=t,c=[{key:"toString",value:function(){return"".concat(this.name," [").concat(this.code,"]: ").concat(this.message)}},{key:l.custom,value:function(e,t){return l(this,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){i(e,t,r[t])}))}return e}({},t,{customInspect:!1,depth:0}))}}],c&&o(r.prototype,c),t}(c(Error));e.exports=E},7515:(e,t,r)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function i(e){return i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},i(e)}function o(e,t){return o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},o(e,t)}var s,a,c={};function f(e,t,r){r||(r=Error);var s=function(r){function s(r,o,a){var c;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),c=function(e,t){return!t||"object"!==n(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}(this,i(s).call(this,function(e,r,n){return"string"==typeof t?t:t(e,r,n)}(r,o,a))),c.code=e,c}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}(s,r),s}(r);c[e]=s}function u(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}f("ERR_AMBIGUOUS_ARGUMENT",'The "%s" argument is ambiguous. %s',TypeError),f("ERR_INVALID_ARG_TYPE",(function(e,t,i){var o,a,c,f,h;if(void 0===s&&(s=r(1696)),s("string"==typeof e,"'name' must be a string"),"string"==typeof t&&(a="not ",t.substr(0,4)===a)?(o="must not be",t=t.replace(/^not /,"")):o="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-9,r)===t}(e," argument"))c="The ".concat(e," ").concat(o," ").concat(u(t,"type"));else{var d=("number"!=typeof h&&(h=0),h+1>(f=e).length||-1===f.indexOf(".",h)?"argument":"property");c='The "'.concat(e,'" ').concat(d," ").concat(o," ").concat(u(t,"type"))}return c+". Received type ".concat(n(i))}),TypeError),f("ERR_INVALID_ARG_VALUE",(function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"is invalid";void 0===a&&(a=r(3335));var i=a.inspect(t);return i.length>128&&(i="".concat(i.slice(0,128),"...")),"The argument '".concat(e,"' ").concat(n,". Received ").concat(i)}),TypeError,RangeError),f("ERR_INVALID_RETURN_VALUE",(function(e,t,r){var i;return i=r&&r.constructor&&r.constructor.name?"instance of ".concat(r.constructor.name):"type ".concat(n(r)),"Expected ".concat(e,' to be returned from the "').concat(t,'"')+" function but got ".concat(i,".")}),TypeError),f("ERR_MISSING_ARGS",(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];void 0===s&&(s=r(1696)),s(t.length>0,"At least one arg needs to be specified");var i="The ",o=t.length;switch(t=t.map((function(e){return'"'.concat(e,'"')})),o){case 1:i+="".concat(t[0]," argument");break;case 2:i+="".concat(t[0]," and ").concat(t[1]," arguments");break;default:i+=t.slice(0,o-1).join(", "),i+=", and ".concat(t[o-1]," arguments")}return"".concat(i," must be specified")}),TypeError),e.exports.codes=c},6796:(e,t,r)=>{"use strict";function n(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{n||null==a.return||a