diff --git a/docs/main.js b/docs/main.js index e6824ae..41930fb 100644 --- a/docs/main.js +++ b/docs/main.js @@ -1,2 +1,2 @@ /*! For license information please see main.js.LICENSE.txt */ -(()=>{var __webpack_modules__={93619:(e,t,r)=>{"use strict";var n=r(34155);Object.defineProperty(t,"__esModule",{value:!0}),t.DUMP_SESSION_KEYS=t.NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG=t.NOISE_MSG_MAX_LENGTH_BYTES=void 0,t.NOISE_MSG_MAX_LENGTH_BYTES=65535,t.NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG=t.NOISE_MSG_MAX_LENGTH_BYTES-16,t.DUMP_SESSION_KEYS=n.env.DUMP_SESSION_KEYS},14510:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decryptStream=t.encryptStream=void 0;const n=r(48764),i=r(93619);t.encryptStream=function(e){return async function*(t){for await(const r of t){const t=n.Buffer.from(r.buffer,r.byteOffset,r.length);for(let r=0;rt.length&&(n=t.length);const o=e.encrypt(t.slice(r,n),e.session);yield o}}}},t.decryptStream=function(e){return async function*(t){for await(const r of t){const t=n.Buffer.from(r.buffer,r.byteOffset,r.length);for(let r=0;rt.length&&(n=t.length);const o=t.slice(r,n),{plaintext:s,valid:a}=await e.decrypt(o,e.session);if(!a)throw new Error("Failed to validate decrypted chunk");yield s}}}}},33477:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decode2=t.decode1=t.decode0=t.encode2=t.encode1=t.encode0=t.uint16BEDecode=t.uint16BEEncode=void 0;const n=r(48764);t.uint16BEEncode=(e,t,r)=>((t=t||n.Buffer.allocUnsafe(2)).writeUInt16BE(e,r),t),t.uint16BEEncode.bytes=2,t.uint16BEDecode=e=>{if(e.length<2)throw RangeError("Could not decode int16BE");return e.readUInt16BE(0)},t.uint16BEDecode.bytes=2,t.encode0=function(e){return n.Buffer.concat([e.ne,e.ciphertext])},t.encode1=function(e){return n.Buffer.concat([e.ne,e.ns,e.ciphertext])},t.encode2=function(e){return n.Buffer.concat([e.ns,e.ciphertext])},t.decode0=function(e){if(e.length<32)throw new Error("Cannot decode stage 0 MessageBuffer: length less than 32 bytes.");return{ne:e.slice(0,32),ciphertext:e.slice(32,e.length),ns:n.Buffer.alloc(0)}},t.decode1=function(e){if(e.length<80)throw new Error("Cannot decode stage 1 MessageBuffer: length less than 80 bytes.");return{ne:e.slice(0,32),ns:e.slice(32,80),ciphertext:e.slice(80,e.length)}},t.decode2=function(e){if(e.length<48)throw new Error("Cannot decode stage 2 MessageBuffer: length less than 48 bytes.");return{ne:n.Buffer.alloc(0),ns:e.slice(0,48),ciphertext:e.slice(48,e.length)}}},42692:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FailedIKError=void 0;class r extends Error{constructor(e,t){super(t),this.initialMsg=e,this.name="FailedIKhandshake"}}t.FailedIKError=r},59454:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IKHandshake=void 0;const n=r(4240),i=r(48764),o=r(33477),s=r(48338),a=r(42692),c=r(87123);t.IKHandshake=class{constructor(e,t,r,o,s,a,c,u){this.isInitiator=e,this.payload=i.Buffer.from(t),this.prologue=r,this.staticKeypair=o,this.connection=s,c&&(this.remotePeer=c),this.ik=null!=u?u:new n.IK,this.session=this.ik.initSession(this.isInitiator,this.prologue,this.staticKeypair,a),this.remoteEarlyData=i.Buffer.alloc(0)}async stage0(){if(c.logLocalStaticKeys(this.session.hs.s),c.logRemoteStaticKey(this.session.hs.rs),this.isInitiator){c.logger("IK Stage 0 - Initiator sending message...");const e=this.ik.sendMessage(this.session,this.payload);this.connection.writeLP(o.encode1(e)),c.logger("IK Stage 0 - Initiator sent message."),c.logLocalEphemeralKeys(this.session.hs.e)}else{c.logger("IK Stage 0 - Responder receiving message...");const e=await this.connection.readLP();try{const t=o.decode1(e.slice()),{plaintext:r,valid:n}=this.ik.recvMessage(this.session,t);if(!n)throw new Error("ik handshake stage 0 decryption validation fail");c.logger("IK Stage 0 - Responder got message, going to verify payload.");const i=await s.decodePayload(r);this.remotePeer=this.remotePeer||await s.getPeerIdFromPayload(i),await s.verifySignedPayload(this.session.hs.rs,i,this.remotePeer),this.setRemoteEarlyData(i.data),c.logger("IK Stage 0 - Responder successfully verified payload!"),c.logRemoteEphemeralKey(this.session.hs.re)}catch(t){const r=t;throw c.logger("Responder breaking up with IK handshake in stage 0."),new a.FailedIKError(e,`Error occurred while verifying initiator's signed payload: ${r.message}`)}}}async stage1(){if(this.isInitiator){c.logger("IK Stage 1 - Initiator receiving message...");const e=(await this.connection.readLP()).slice(),t=o.decode0(i.Buffer.from(e)),{plaintext:r,valid:n}=this.ik.recvMessage(this.session,t);c.logger("IK Stage 1 - Initiator got message, going to verify payload.");try{if(!n)throw new Error("ik stage 1 decryption validation fail");const e=await s.decodePayload(r);this.remotePeer=this.remotePeer||await s.getPeerIdFromPayload(e),await s.verifySignedPayload(t.ns.slice(0,32),e,this.remotePeer),this.setRemoteEarlyData(e.data),c.logger("IK Stage 1 - Initiator successfully verified payload!"),c.logRemoteEphemeralKey(this.session.hs.re)}catch(t){const r=t;throw c.logger("Initiator breaking up with IK handshake in stage 1."),new a.FailedIKError(e,`Error occurred while verifying responder's signed payload: ${r.message}`)}}else{c.logger("IK Stage 1 - Responder sending message...");const e=this.ik.sendMessage(this.session,this.payload);this.connection.writeLP(o.encode0(e)),c.logger("IK Stage 1 - Responder sent message..."),c.logLocalEphemeralKeys(this.session.hs.e)}c.logCipherState(this.session)}decrypt(e,t){const r=this.getCS(t,!1);return this.ik.decryptWithAd(r,i.Buffer.alloc(0),e)}encrypt(e,t){const r=this.getCS(t);return this.ik.encryptWithAd(r,i.Buffer.alloc(0),e)}getLocalEphemeralKeys(){if(!this.session.hs.e)throw new Error("Ephemeral keys do not exist.");return this.session.hs.e}getCS(e,t=!0){if(!e.cs1||!e.cs2)throw new Error("Handshake not completed properly, cipher state does not exist.");return this.isInitiator?t?e.cs1:e.cs2:t?e.cs2:e.cs1}setRemoteEarlyData(e){e&&(this.remoteEarlyData=i.Buffer.from(e.buffer,e.byteOffset,e.length))}}},37558:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XXFallbackHandshake=void 0;const n=r(48764),i=r(70461),o=r(48338),s=r(87123),a=r(33477);class c extends i.XXHandshake{constructor(e,t,r,n,i,o,s,a,c){super(e,t,r,n,i,s,c),a&&(this.ephemeralKeys=a),this.initialMsg=o}async propose(){if(this.isInitiator)this.xx.sendMessage(this.session,n.Buffer.alloc(0),this.ephemeralKeys),s.logger("XX Fallback Stage 0 - Initialized state as the first message was sent by initiator."),s.logLocalEphemeralKeys(this.session.hs.e);else{s.logger("XX Fallback Stage 0 - Responder decoding initial msg from IK.");const e=a.decode0(this.initialMsg),{valid:t}=this.xx.recvMessage(this.session,{ne:e.ne,ns:n.Buffer.alloc(0),ciphertext:n.Buffer.alloc(0)});if(!t)throw new Error("xx fallback stage 0 decryption validation fail");s.logger("XX Fallback Stage 0 - Responder used received message from IK."),s.logRemoteEphemeralKey(this.session.hs.re)}}async exchange(){if(this.isInitiator){const e=a.decode1(this.initialMsg),{plaintext:t,valid:r}=this.xx.recvMessage(this.session,e);if(!r)throw new Error("xx fallback stage 1 decryption validation fail");s.logger("XX Fallback Stage 1 - Initiator used received message from IK."),s.logRemoteEphemeralKey(this.session.hs.re),s.logRemoteStaticKey(this.session.hs.rs),s.logger("Initiator going to check remote's signature...");try{const e=await o.decodePayload(t);this.remotePeer=this.remotePeer||await o.getPeerIdFromPayload(e),await o.verifySignedPayload(this.session.hs.rs,e,this.remotePeer),this.setRemoteEarlyData(e.data)}catch(e){throw new Error(`Error occurred while verifying signed payload from responder: ${e.message}`)}s.logger("All good with the signature!")}else s.logger("XX Fallback Stage 1 - Responder start"),await super.exchange(),s.logger("XX Fallback Stage 1 - Responder end")}}t.XXFallbackHandshake=c},70461:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XXHandshake=void 0;const n=r(48764),i=r(64604),o=r(48338),s=r(87123),a=r(33477);t.XXHandshake=class{constructor(e,t,r,o,s,a,c){this.isInitiator=e,this.payload=t,this.prologue=r,this.staticKeypair=o,this.connection=s,a&&(this.remotePeer=a),this.xx=null!=c?c:new i.XX,this.session=this.xx.initSession(this.isInitiator,this.prologue,this.staticKeypair),this.remoteEarlyData=n.Buffer.alloc(0)}async propose(){if(s.logLocalStaticKeys(this.session.hs.s),this.isInitiator){s.logger("Stage 0 - Initiator starting to send first message.");const e=this.xx.sendMessage(this.session,n.Buffer.alloc(0));this.connection.writeLP(a.encode0(e)),s.logger("Stage 0 - Initiator finished sending first message."),s.logLocalEphemeralKeys(this.session.hs.e)}else{s.logger("Stage 0 - Responder waiting to receive first message...");const e=a.decode0((await this.connection.readLP()).slice()),{valid:t}=this.xx.recvMessage(this.session,e);if(!t)throw new Error("xx handshake stage 0 validation fail");s.logger("Stage 0 - Responder received first message."),s.logRemoteEphemeralKey(this.session.hs.re)}}async exchange(){if(this.isInitiator){s.logger("Stage 1 - Initiator waiting to receive first message from responder...");const e=a.decode1((await this.connection.readLP()).slice()),{plaintext:t,valid:r}=this.xx.recvMessage(this.session,e);if(!r)throw new Error("xx handshake stage 1 validation fail");s.logger("Stage 1 - Initiator received the message."),s.logRemoteEphemeralKey(this.session.hs.re),s.logRemoteStaticKey(this.session.hs.rs),s.logger("Initiator going to check remote's signature...");try{const r=await o.decodePayload(t);this.remotePeer=this.remotePeer||await o.getPeerIdFromPayload(r),this.remotePeer=await o.verifySignedPayload(e.ns,r,this.remotePeer),this.setRemoteEarlyData(r.data)}catch(e){throw new Error(`Error occurred while verifying signed payload: ${e.message}`)}s.logger("All good with the signature!")}else{s.logger("Stage 1 - Responder sending out first message with signed payload and static key.");const e=this.xx.sendMessage(this.session,this.payload);this.connection.writeLP(a.encode1(e)),s.logger("Stage 1 - Responder sent the second handshake message with signed payload."),s.logLocalEphemeralKeys(this.session.hs.e)}}async finish(){if(this.isInitiator){s.logger("Stage 2 - Initiator sending third handshake message.");const e=this.xx.sendMessage(this.session,this.payload);this.connection.writeLP(a.encode2(e)),s.logger("Stage 2 - Initiator sent message with signed payload.")}else{s.logger("Stage 2 - Responder waiting for third handshake message...");const e=a.decode2((await this.connection.readLP()).slice()),{plaintext:t,valid:r}=this.xx.recvMessage(this.session,e);if(!r)throw new Error("xx handshake stage 2 validation fail");s.logger("Stage 2 - Responder received the message, finished handshake.");try{const e=await o.decodePayload(t);this.remotePeer=this.remotePeer||await o.getPeerIdFromPayload(e),await o.verifySignedPayload(this.session.hs.rs,e,this.remotePeer),this.setRemoteEarlyData(e.data)}catch(e){throw new Error(`Error occurred while verifying signed payload: ${e.message}`)}}s.logCipherState(this.session)}encrypt(e,t){const r=this.getCS(t);return this.xx.encryptWithAd(r,n.Buffer.alloc(0),e)}decrypt(e,t){const r=this.getCS(t,!1);return this.xx.decryptWithAd(r,n.Buffer.alloc(0),e)}getRemoteStaticKey(){return this.session.hs.rs}getCS(e,t=!0){if(!e.cs1||!e.cs2)throw new Error("Handshake not completed properly, cipher state does not exist.");return this.isInitiator?t?e.cs1:e.cs2:t?e.cs2:e.cs1}setRemoteEarlyData(e){e&&(this.remoteEarlyData=n.Buffer.from(e.buffer,e.byteOffset,e.length))}}},88538:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.AbstractHandshake=t.MIN_NONCE=void 0;const s=r(48764),a=o(r(57664)),c=o(r(73294)),u=r(15501),f=r(48338),l=r(87123);t.MIN_NONCE=0,t.AbstractHandshake=class{encryptWithAd(e,t,r){const n=this.encrypt(e.k,e.n,t,r);return this.setNonce(e,this.incrementNonce(e.n)),n}decryptWithAd(e,t,r){const{plaintext:n,valid:i}=this.decrypt(e.k,e.n,t,r);return this.setNonce(e,this.incrementNonce(e.n)),{plaintext:n,valid:i}}hasKey(e){return!this.isEmptyKey(e.k)}setNonce(e,t){e.n=t}createEmptyKey(){return s.Buffer.alloc(32)}isEmptyKey(e){return this.createEmptyKey().equals(e)}incrementNonce(e){return e+1}nonceToBytes(e){const t=s.Buffer.alloc(12);return t.writeUInt32LE(e,4),t}encrypt(e,t,r,n){const i=this.nonceToBytes(t),o=new u.ChaCha20Poly1305(e).seal(i,n,r);return s.Buffer.from(o.buffer,o.byteOffset,o.length)}encryptAndHash(e,t){let r;return r=this.hasKey(e.cs)?this.encryptWithAd(e.cs,e.h,t):t,this.mixHash(e,r),r}decrypt(e,t,r,n){const i=this.nonceToBytes(t),o=new u.ChaCha20Poly1305(e).open(i,n,r);return o?{plaintext:s.Buffer.from(o.buffer,o.byteOffset,o.length),valid:!0}:{plaintext:s.Buffer.from(""),valid:!1}}decryptAndHash(e,t){let r,n=!0;return this.hasKey(e.cs)?({plaintext:r,valid:n}=this.decryptWithAd(e.cs,e.h,t)):r=t,this.mixHash(e,t),{plaintext:r,valid:n}}dh(e,t){try{const r=a.sharedKey(e,t),n=s.Buffer.from(r.buffer,r.byteOffset,r.length),i=s.Buffer.alloc(32);return n.copy(i),i}catch(e){return l.logger(e.message),s.Buffer.alloc(32)}}mixHash(e,t){e.h=this.getHash(e.h,t)}getHash(e,t){const r=c.hash(s.Buffer.from([...e,...t]));return s.Buffer.from(r.buffer,r.byteOffset,r.length)}mixKey(e,t){const[r,n]=f.getHkdf(e.ck,t);e.cs=this.initializeKey(n),e.ck=r}initializeKey(e){return{k:e,n:t.MIN_NONCE}}initializeSymmetric(e){const t=s.Buffer.from(e,"utf-8"),r=this.hashProtocolName(t),n=r,i=this.createEmptyKey();return{cs:this.initializeKey(i),ck:n,h:r}}hashProtocolName(e){if(e.length<=32){const t=s.Buffer.alloc(32);return e.copy(t),t}return this.getHash(e,s.Buffer.alloc(0))}split(e){const[t,r]=f.getHkdf(e.ck,s.Buffer.alloc(0));return{cs1:this.initializeKey(t),cs2:this.initializeKey(r)}}writeMessageRegular(e,t){const r=this.encryptWithAd(e,s.Buffer.alloc(0),t);return{ne:this.createEmptyKey(),ns:s.Buffer.alloc(0),ciphertext:r}}readMessageRegular(e,t){return this.decryptWithAd(e,s.Buffer.alloc(0),t.ciphertext)}}},4240:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IK=void 0;const n=r(48764),i=r(48338),o=r(88538);class s extends o.AbstractHandshake{initSession(e,t,r,n){const i=this.createEmptyKey();let o;return o=e?this.initializeInitiator(t,r,n,i):this.initializeResponder(t,r,n,i),{hs:o,i:e,mc:0}}sendMessage(e,t){let r;if(0===e.mc)r=this.writeMessageA(e.hs,t);else if(1===e.mc){const{messageBuffer:n,h:i,cs1:o,cs2:s}=this.writeMessageB(e.hs,t);r=n,e.h=i,e.cs1=o,e.cs2=s}else{if(!(e.mc>1))throw new Error("Session invalid.");if(e.i){if(!e.cs1)throw new Error("CS1 (cipher state) is not defined");r=this.writeMessageRegular(e.cs1,t)}else{if(!e.cs2)throw new Error("CS2 (cipher state) is not defined");r=this.writeMessageRegular(e.cs2,t)}}return e.mc++,r}recvMessage(e,t){let r=n.Buffer.alloc(0),i=!1;if(0===e.mc&&({plaintext:r,valid:i}=this.readMessageA(e.hs,t)),1===e.mc){const{plaintext:n,valid:o,h:s,cs1:a,cs2:c}=this.readMessageB(e.hs,t);r=n,i=o,e.h=s,e.cs1=a,e.cs2=c}return e.mc++,{plaintext:r,valid:i}}writeMessageA(e,t){e.e=i.generateKeypair();const r=e.e.publicKey;this.mixHash(e.ss,r),this.mixKey(e.ss,this.dh(e.e.privateKey,e.rs));const o=n.Buffer.from(e.s.publicKey),s=this.encryptAndHash(e.ss,o);return this.mixKey(e.ss,this.dh(e.s.privateKey,e.rs)),{ne:r,ns:s,ciphertext:this.encryptAndHash(e.ss,t)}}writeMessageB(e,t){e.e=i.generateKeypair();const r=e.e.publicKey;this.mixHash(e.ss,r),this.mixKey(e.ss,this.dh(e.e.privateKey,e.re)),this.mixKey(e.ss,this.dh(e.e.privateKey,e.rs));const n=this.encryptAndHash(e.ss,t),o={ne:r,ns:this.createEmptyKey(),ciphertext:n},{cs1:s,cs2:a}=this.split(e.ss);return{messageBuffer:o,cs1:s,cs2:a,h:e.ss.h}}readMessageA(e,t){i.isValidPublicKey(t.ne)&&(e.re=t.ne),this.mixHash(e.ss,e.re),this.mixKey(e.ss,this.dh(e.s.privateKey,e.re));const{plaintext:r,valid:n}=this.decryptAndHash(e.ss,t.ns);n&&32===r.length&&i.isValidPublicKey(r)&&(e.rs=r),this.mixKey(e.ss,this.dh(e.s.privateKey,e.rs));const{plaintext:o,valid:s}=this.decryptAndHash(e.ss,t.ciphertext);return{plaintext:o,valid:n&&s}}readMessageB(e,t){if(i.isValidPublicKey(t.ne)&&(e.re=t.ne),this.mixHash(e.ss,e.re),!e.e)throw new Error("Handshake state should contain ephemeral key by now.");this.mixKey(e.ss,this.dh(e.e.privateKey,e.re)),this.mixKey(e.ss,this.dh(e.s.privateKey,e.re));const{plaintext:r,valid:n}=this.decryptAndHash(e.ss,t.ciphertext),{cs1:o,cs2:s}=this.split(e.ss);return{h:e.ss.h,valid:n,plaintext:r,cs1:o,cs2:s}}initializeInitiator(e,t,r,i){const o=this.initializeSymmetric("Noise_IK_25519_ChaChaPoly_SHA256");return this.mixHash(o,e),this.mixHash(o,r),{ss:o,s:t,rs:r,re:n.Buffer.alloc(32),psk:i}}initializeResponder(e,t,r,i){const o=this.initializeSymmetric("Noise_IK_25519_ChaChaPoly_SHA256");return this.mixHash(o,e),this.mixHash(o,t.publicKey),{ss:o,s:t,rs:r,re:n.Buffer.alloc(32),psk:i}}}t.IK=s},64604:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XX=void 0;const n=r(48764),i=r(48338),o=r(88538);class s extends o.AbstractHandshake{initializeInitiator(e,t,r,i){const o=this.initializeSymmetric("Noise_XX_25519_ChaChaPoly_SHA256");return this.mixHash(o,e),{ss:o,s:t,rs:r,psk:i,re:n.Buffer.alloc(32)}}initializeResponder(e,t,r,i){const o=this.initializeSymmetric("Noise_XX_25519_ChaChaPoly_SHA256");return this.mixHash(o,e),{ss:o,s:t,rs:r,psk:i,re:n.Buffer.alloc(32)}}writeMessageA(e,t,r){const o=n.Buffer.alloc(0);e.e=void 0!==r?r:i.generateKeypair();const s=e.e.publicKey;return this.mixHash(e.ss,s),{ne:s,ns:o,ciphertext:this.encryptAndHash(e.ss,t)}}writeMessageB(e,t){e.e=i.generateKeypair();const r=e.e.publicKey;this.mixHash(e.ss,r),this.mixKey(e.ss,this.dh(e.e.privateKey,e.re));const o=n.Buffer.from(e.s.publicKey),s=this.encryptAndHash(e.ss,o);return this.mixKey(e.ss,this.dh(e.s.privateKey,e.re)),{ne:r,ns:s,ciphertext:this.encryptAndHash(e.ss,t)}}writeMessageC(e,t){const r=n.Buffer.from(e.s.publicKey),i=this.encryptAndHash(e.ss,r);this.mixKey(e.ss,this.dh(e.s.privateKey,e.re));const o=this.encryptAndHash(e.ss,t),s={ne:this.createEmptyKey(),ns:i,ciphertext:o},{cs1:a,cs2:c}=this.split(e.ss);return{h:e.ss.h,messageBuffer:s,cs1:a,cs2:c}}readMessageA(e,t){return i.isValidPublicKey(t.ne)&&(e.re=t.ne),this.mixHash(e.ss,e.re),this.decryptAndHash(e.ss,t.ciphertext)}readMessageB(e,t){if(i.isValidPublicKey(t.ne)&&(e.re=t.ne),this.mixHash(e.ss,e.re),!e.e)throw new Error("Handshake state `e` param is missing.");this.mixKey(e.ss,this.dh(e.e.privateKey,e.re));const{plaintext:r,valid:n}=this.decryptAndHash(e.ss,t.ns);n&&32===r.length&&i.isValidPublicKey(r)&&(e.rs=r),this.mixKey(e.ss,this.dh(e.e.privateKey,e.rs));const{plaintext:o,valid:s}=this.decryptAndHash(e.ss,t.ciphertext);return{plaintext:o,valid:n&&s}}readMessageC(e,t){const{plaintext:r,valid:n}=this.decryptAndHash(e.ss,t.ns);if(n&&32===r.length&&i.isValidPublicKey(r)&&(e.rs=r),!e.e)throw new Error("Handshake state `e` param is missing.");this.mixKey(e.ss,this.dh(e.e.privateKey,e.rs));const{plaintext:o,valid:s}=this.decryptAndHash(e.ss,t.ciphertext),{cs1:a,cs2:c}=this.split(e.ss);return{h:e.ss.h,plaintext:o,valid:n&&s,cs1:a,cs2:c}}initSession(e,t,r){const i=this.createEmptyKey(),o=n.Buffer.alloc(32);let s;return s=e?this.initializeInitiator(t,r,o,i):this.initializeResponder(t,r,o,i),{hs:s,i:e,mc:0}}sendMessage(e,t,r){let n;if(0===e.mc)n=this.writeMessageA(e.hs,t,r);else if(1===e.mc)n=this.writeMessageB(e.hs,t);else if(2===e.mc){const{h:r,messageBuffer:i,cs1:o,cs2:s}=this.writeMessageC(e.hs,t);n=i,e.h=r,e.cs1=o,e.cs2=s}else{if(!(e.mc>2))throw new Error("Session invalid.");if(e.i){if(!e.cs1)throw new Error("CS1 (cipher state) is not defined");n=this.writeMessageRegular(e.cs1,t)}else{if(!e.cs2)throw new Error("CS2 (cipher state) is not defined");n=this.writeMessageRegular(e.cs2,t)}}return e.mc++,n}recvMessage(e,t){let r=n.Buffer.alloc(0),i=!1;if(0===e.mc)({plaintext:r,valid:i}=this.readMessageA(e.hs,t));else if(1===e.mc)({plaintext:r,valid:i}=this.readMessageB(e.hs,t));else if(2===e.mc){const{h:n,plaintext:o,valid:s,cs1:a,cs2:c}=this.readMessageC(e.hs,t);r=o,i=s,e.h=n,e.cs1=a,e.cs2=c}return e.mc++,{plaintext:r,valid:i}}}t.XX=s},42641:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.NOISE=void 0;const o=r(88895);i(r(88895),t),t.NOISE=new o.Noise},23786:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.KeyCache=void 0;const r=new class{constructor(){this.storage=new Map}store(e,t){this.storage.set(e.id,t)}load(e){var t;return e&&null!==(t=this.storage.get(e.id))&&void 0!==t?t:null}resetStorage(){this.storage.clear()}};t.KeyCache=r},87123:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.logCipherState=t.logRemoteEphemeralKey=t.logRemoteStaticKey=t.logLocalEphemeralKeys=t.logLocalStaticKeys=t.logger=void 0;const i=n(r(11227)),o=r(93619);let s;t.logger=i.default("libp2p:noise"),s=o.DUMP_SESSION_KEYS?t.logger:()=>{},t.logLocalStaticKeys=function(e){s(`LOCAL_STATIC_PUBLIC_KEY ${e.publicKey.toString("hex")}`),s(`LOCAL_STATIC_PRIVATE_KEY ${e.privateKey.toString("hex")}`)},t.logLocalEphemeralKeys=function(e){e?(s(`LOCAL_PUBLIC_EPHEMERAL_KEY ${e.publicKey.toString("hex")}`),s(`LOCAL_PRIVATE_EPHEMERAL_KEY ${e.privateKey.toString("hex")}`)):s("Missing local ephemeral keys.")},t.logRemoteStaticKey=function(e){s(`REMOTE_STATIC_PUBLIC_KEY ${e.toString("hex")}`)},t.logRemoteEphemeralKey=function(e){s(`REMOTE_EPHEMERAL_PUBLIC_KEY ${e.toString("hex")}`)},t.logCipherState=function(e){e.cs1&&e.cs2?(s(`CIPHER_STATE_1 ${e.cs1.n} ${e.cs1.k.toString("hex")}`),s(`CIPHER_STATE_2 ${e.cs2.n} ${e.cs2.k.toString("hex")}`)):s("Missing cipher state.")}},88895:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Noise=void 0;const a=o(r(57664)),c=r(48764),u=s(r(11712)),f=s(r(63184)),l=s(r(96653)),h=s(r(60618)),d=r(47845),p=r(70461),y=r(59454),g=r(37558),b=r(48338),m=r(33477),v=r(14510),w=r(23786),E=r(87123),_=r(93619);t.Noise=class{constructor(e,t){if(this.protocol="/noise",this.prologue=c.Buffer.alloc(0),this.earlyData=null!=t?t:c.Buffer.alloc(0),this.useNoisePipes=!1,e){const t=a.generateKeyPairFromSeed(e);this.staticKeys={privateKey:c.Buffer.from(t.secretKey.buffer,t.secretKey.byteOffset,t.secretKey.length),publicKey:c.Buffer.from(t.publicKey.buffer,t.publicKey.byteOffset,t.publicKey.length)}}else this.staticKeys=b.generateKeypair()}async secureOutbound(e,t,r){const n=u.default(t,{lengthEncoder:m.uint16BEEncode,lengthDecoder:m.uint16BEDecode,maxDataLength:_.NOISE_MSG_MAX_LENGTH_BYTES}),i=await this.performHandshake({connection:n,isInitiator:!0,localPeer:e,remotePeer:r});return{conn:await this.createSecureConnection(n,i),remoteEarlyData:i.remoteEarlyData,remotePeer:i.remotePeer}}async secureInbound(e,t,r){const n=u.default(t,{lengthEncoder:m.uint16BEEncode,lengthDecoder:m.uint16BEDecode,maxDataLength:_.NOISE_MSG_MAX_LENGTH_BYTES}),i=await this.performHandshake({connection:n,isInitiator:!1,localPeer:e,remotePeer:r});return{conn:await this.createSecureConnection(n,i),remoteEarlyData:i.remoteEarlyData,remotePeer:i.remotePeer}}async performHandshake(e){var t;const r=await b.getPayload(e.localPeer,this.staticKeys.publicKey,this.earlyData);let n=this.useNoisePipes;if(e.isInitiator&&null===w.KeyCache.load(e.remotePeer)&&(n=!1),!n)return await this.performXXHandshake(e,r);{const{remotePeer:n,connection:i,isInitiator:o}=e,s=new y.IKHandshake(o,r,this.prologue,this.staticKeys,i,null!==(t=w.KeyCache.load(e.remotePeer))&&void 0!==t?t:c.Buffer.alloc(32),n);try{return await this.performIKHandshake(s)}catch(t){let n;return e.isInitiator&&(n=s.getLocalEphemeralKeys()),await this.performXXFallbackHandshake(e,r,t.initialMsg,n)}}}async performXXFallbackHandshake(e,t,r,n){const{isInitiator:i,remotePeer:o,connection:s}=e,a=new g.XXFallbackHandshake(i,t,this.prologue,this.staticKeys,s,r,o,n);try{await a.propose(),await a.exchange(),await a.finish()}catch(e){throw E.logger(e),new Error(`Error occurred during XX Fallback handshake: ${e.message}`)}return a}async performXXHandshake(e,t){const{isInitiator:r,remotePeer:n,connection:i}=e,o=new p.XXHandshake(r,t,this.prologue,this.staticKeys,i,n);try{await o.propose(),await o.exchange(),await o.finish(),this.useNoisePipes&&o.remotePeer&&w.KeyCache.store(o.remotePeer,o.getRemoteStaticKey())}catch(e){throw new Error(`Error occurred during XX handshake: ${e.message}`)}return o}async performIKHandshake(e){return await e.stage0(),await e.stage1(),e}async createSecureConnection(e,t){const[r,n]=f.default(),i=e.unwrap();return await h.default(r,l.default,v.encryptStream(t),d.encode({lengthEncoder:m.uint16BEEncode}),i,d.decode({lengthDecoder:m.uint16BEDecode}),l.default,v.decryptStream(t),r),n}}},47144:function(e,t,r){"use strict";var n,i,o;i=[r(62100)],void 0===(o="function"==typeof(n=function(e){var t,r=e.Reader,n=e.Writer,i=e.util,o=e.roots["libp2p-noise"]||(e.roots["libp2p-noise"]={});return o.pb=((t={}).NoiseHandshakePayload=function(){function t(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:i.identityKey=e.bytes();break;case 2:i.identitySig=e.bytes();break;case 3:i.data=e.bytes();break;default:e.skipType(7&s)}}return i},t.decodeDelimited=function(e){return e instanceof r||(e=new r(e)),this.decode(e,e.uint32())},t.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.identityKey&&e.hasOwnProperty("identityKey")&&!(e.identityKey&&"number"==typeof e.identityKey.length||i.isString(e.identityKey))?"identityKey: buffer expected":null!=e.identitySig&&e.hasOwnProperty("identitySig")&&!(e.identitySig&&"number"==typeof e.identitySig.length||i.isString(e.identitySig))?"identitySig: buffer expected":null!=e.data&&e.hasOwnProperty("data")&&!(e.data&&"number"==typeof e.data.length||i.isString(e.data))?"data: buffer expected":null},t.fromObject=function(e){if(e instanceof o.pb.NoiseHandshakePayload)return e;var t=new o.pb.NoiseHandshakePayload;return null!=e.identityKey&&("string"==typeof e.identityKey?i.base64.decode(e.identityKey,t.identityKey=i.newBuffer(i.base64.length(e.identityKey)),0):e.identityKey.length&&(t.identityKey=e.identityKey)),null!=e.identitySig&&("string"==typeof e.identitySig?i.base64.decode(e.identitySig,t.identitySig=i.newBuffer(i.base64.length(e.identitySig)),0):e.identitySig.length&&(t.identitySig=e.identitySig)),null!=e.data&&("string"==typeof e.data?i.base64.decode(e.data,t.data=i.newBuffer(i.base64.length(e.data)),0):e.data.length&&(t.data=e.data)),t},t.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(t.bytes===String?r.identityKey="":(r.identityKey=[],t.bytes!==Array&&(r.identityKey=i.newBuffer(r.identityKey))),t.bytes===String?r.identitySig="":(r.identitySig=[],t.bytes!==Array&&(r.identitySig=i.newBuffer(r.identitySig))),t.bytes===String?r.data="":(r.data=[],t.bytes!==Array&&(r.data=i.newBuffer(r.data)))),null!=e.identityKey&&e.hasOwnProperty("identityKey")&&(r.identityKey=t.bytes===String?i.base64.encode(e.identityKey,0,e.identityKey.length):t.bytes===Array?Array.prototype.slice.call(e.identityKey):e.identityKey),null!=e.identitySig&&e.hasOwnProperty("identitySig")&&(r.identitySig=t.bytes===String?i.base64.encode(e.identitySig,0,e.identitySig.length):t.bytes===Array?Array.prototype.slice.call(e.identitySig):e.identitySig),null!=e.data&&e.hasOwnProperty("data")&&(r.data=t.bytes===String?i.base64.encode(e.data,0,e.data.length):t.bytes===Array?Array.prototype.slice.call(e.data):e.data),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},t}(),t),o})?n.apply(t,i):n)||(e.exports=o)},48338:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.isValidPublicKey=t.getHkdf=t.verifySignedPayload=t.getHandshakePayload=t.decodePayload=t.getPeerIdFromPayload=t.signPayload=t.createHandshakePayload=t.getPayload=t.generateKeypair=void 0;const a=r(512),c=r(73294),u=o(r(57664)),f=r(48764),l=s(r(88785)),h=r(68884),d=r(47144),p=r(19588),y=d.pb.NoiseHandshakePayload;function g(e,t,r){const n=y.create({identityKey:f.Buffer.from(e),identitySig:t,data:null!=r?r:null});return f.Buffer.from(y.encode(n).finish())}async function b(e,t){return f.Buffer.from(await e.privKey.sign(t))}function m(e){return f.Buffer.concat([f.Buffer.from("noise-libp2p-static-key:"),e])}t.generateKeypair=function(){const e=u.generateKeyPair();return{publicKey:f.Buffer.from(e.publicKey.buffer,e.publicKey.byteOffset,e.publicKey.length),privateKey:f.Buffer.from(e.secretKey.buffer,e.secretKey.byteOffset,e.secretKey.length)}},t.getPayload=async function(e,t,r){const n=await b(e,m(t)),i=null!=r?r:f.Buffer.alloc(0);return g(e.marshalPubKey(),n,i)},t.createHandshakePayload=g,t.signPayload=b,t.getPeerIdFromPayload=async function(e){return await l.default.createFromPubKey(f.Buffer.from(e.identityKey))},t.decodePayload=function(e){return y.toObject(y.decode(f.Buffer.from(e)))},t.getHandshakePayload=m,t.verifySignedPayload=async function(e,t,r){const n=f.Buffer.from(t.identityKey);if(!await async function(e,t){const r=await l.default.createFromPubKey(t);return p.equals(r.id,e)}(r.id,n))throw new Error("Peer ID doesn't match libp2p public key.");const i=m(e),o=h.keys.unmarshalPublicKey(n);if(!t.identitySig||!o.verify(i,f.Buffer.from(t.identitySig)))throw new Error("Static key doesn't match to peer that signed payload!");return await l.default.createFromPubKey(n)},t.getHkdf=function(e,t){const r=new a.HKDF(c.SHA256,t,e).expand(96),n=f.Buffer.from(r.buffer,r.byteOffset,r.length);return[n.slice(0,32),n.slice(32,64),n.slice(64,96)]},t.isValidPublicKey=function(e){return!!f.Buffer.isBuffer(e)&&32===e.length}},69345:(e,t,r)=>{"use strict";const{Buffer:n}=r(48764),i=r(9668),o=r(99842),s=4194304,a=n.alloc(0),c="readLength",u="readData",f={[c]:(e,t,r,n)=>{let o;t=t.append(e);try{o=n.lengthDecoder(t)}catch(e){if(t.length>n.maxLengthLength)throw Object.assign(e,{message:"message length too long",code:"ERR_MSG_LENGTH_TOO_LONG"});if(e instanceof RangeError)return{mode:c,buffer:t,chunk:void 0,state:void 0,data:void 0};throw e}if(o>n.maxDataLength)throw Object.assign(new Error("message data too long"),{code:"ERR_MSG_DATA_TOO_LONG"});return e=t.shallowSlice(n.lengthDecoder.bytes),t=new i,n.onLength&&n.onLength(o),o<=0?(n.onData&&n.onData(a),{mode:c,chunk:e,buffer:t,data:a}):{mode:u,chunk:e,buffer:t,state:{dataLength:o},data:void 0}},[u]:(e,t,r,n)=>{if(t=t.append(e),!r)throw new Error("state is required");if(t.lengtho?t.shallowSlice(o):void 0;return t=new i,n.onData&&n.onData(s),{mode:c,chunk:a,buffer:t,state:void 0,data:s}}};function l(e){const t={lengthDecoder:(e=e||{}).lengthDecoder||o,maxLengthLength:e.maxLengthLength||8,maxDataLength:e.maxDataLength||s,onLength:e.onLength,onData:e.onData};return async function*(e){let r,n=new i,o=c;for await(const i of e){let e=i;for(;e;){const i=f[o](e,n,r,t);o=i.mode,e=i.chunk,n=i.buffer,r=i.state,i.data&&(yield i.data)}}if(n.length)throw Object.assign(new Error("unexpected end of input"),{code:"ERR_UNEXPECTED_EOF"})}}l.fromReader=(e,t)=>{let r=1;const n={[Symbol.asyncIterator](){return this},next:async()=>{try{return await e.next(r)}catch(e){if("ERR_UNDER_READ"===e.code)return{done:!0,value:null};throw e}finally{r=1}}};return l({...t||{},onLength:e=>{r=e}})(n)},e.exports=l,e.exports.MAX_LENGTH_LENGTH=8,e.exports.MAX_DATA_LENGTH=s},22997:(e,t,r)=>{"use strict";const{Buffer:n}=r(48764),i=r(9668),o=r(96175);function s(e){e=e||{};const t=Math.max(e.poolSize||10240,e.minPoolSize||8),r=e.lengthEncoder||o;return async function*(e){let o=n.alloc(t),s=0;for await(const a of e){r(a.length,o,s);const e=o.slice(s,s+r.bytes);s+=r.bytes,o.length-s<8&&(o=n.alloc(t),s=0),yield(new i).append(e).append(a)}}}s.single=(e,t)=>{const r=(t=t||{}).lengthEncoder||o;return new i([r(e.length),e.slice()])},e.exports=s,e.exports.MIN_POOL_SIZE=8,e.exports.DEFAULT_POOL_SIZE=10240},47845:(e,t,r)=>{"use strict";t.encode=r(22997),t.decode=r(69345),t.varintEncode=r(96175),t.varintDecode=r(99842),t.int32BEEncode=r(95839),t.int32BEDecode=r(33080)},33080:e=>{"use strict";const t=e=>{if(e.length<4)throw RangeError("Could not decode int32BE");return e.readInt32BE(0)};t.bytes=4,e.exports=t},95839:(e,t,r)=>{"use strict";const{Buffer:n}=r(48764),i=(e,t,r)=>((t=t||n.allocUnsafe(4)).writeInt32BE(e,r),t);i.bytes=4,e.exports=i},99842:(e,t,r)=>{"use strict";const n=r(88256),{Buffer:i}=r(48764),o=e=>{const t=n.decode(i.isBuffer(e)?e:(r=e,new Proxy({},{get:(e,t)=>"l"===t[0]?r[t]:r.get(parseInt(t))})));var r;return o.bytes=n.decode.bytes,t};e.exports=o},96175:(e,t,r)=>{"use strict";const n=r(88256),{Buffer:i}=r(48764),o=(e,t,r)=>{const s=n.encode(e,t,r);return o.bytes=n.encode.bytes,t||i.from(s)};e.exports=o},77715:(e,t,r)=>{"use strict";const n=r(32114),i={16:"aes-128-ctr",32:"aes-256-ctr"};e.exports=function(e){const t=i[e.length];if(!t){const t=Object.entries(i).map((([e,t])=>`${e} (${t})`)).join(" / ");throw n(new Error(`Invalid key length ${e.length} bytes. Must be ${t}`),"ERR_INVALID_KEY_LENGTH")}return t}},60439:(e,t,r)=>{"use strict";r(8925);const n=r(3832),{toString:i}=r(92263),{fromString:o}=r(52217);e.exports={createCipheriv:(e,t,r)=>{const s=n.cipher.createCipher("AES-CTR",i(t,"ascii"));return s.start({iv:i(r,"ascii")}),{update:e=>(s.update(n.util.createBuffer(i(e,"ascii"))),o(s.output.getBytes(),"ascii"))}},createDecipheriv:(e,t,r)=>{const s=n.cipher.createDecipher("AES-CTR",i(t,"ascii"));return s.start({iv:i(r,"ascii")}),{update:e=>(s.update(n.util.createBuffer(i(e,"ascii"))),o(s.output.getBytes(),"ascii"))}}}},60501:(e,t,r)=>{"use strict";const n=r(60439),i=r(77715);t.create=async function(e,t){const r=i(e),o=n.createCipheriv(r,e,t),s=n.createDecipheriv(r,e,t);return{encrypt:async e=>o.update(e),decrypt:async e=>s.update(e)}}},86322:(e,t,r)=>{"use strict";const{concat:n}=r(20605),{fromString:i}=r(52217),o=r(59701);e.exports={create:function({algorithm:e="AES-GCM",nonceLength:t=12,keyLength:r=16,digest:s="SHA-256",saltLength:a=16,iterations:c=32767}={}){const u=o.get();return r*=8,{encrypt:async function(o,f){const l=u.getRandomValues(new Uint8Array(a)),h=u.getRandomValues(new Uint8Array(t)),d={name:e,iv:h},p={name:"PBKDF2",salt:l,iterations:c,hash:{name:s}},y=await u.subtle.importKey("raw",i(f),{name:"PBKDF2"},!1,["deriveKey","deriveBits"]),g=await u.subtle.deriveKey(p,y,{name:e,length:r},!0,["encrypt"]),b=await u.subtle.encrypt(d,g,o);return n([l,d.iv,new Uint8Array(b)])},decrypt:async function(n,o){const f=n.slice(0,a),l=n.slice(a,a+t),h=n.slice(a+t),d={name:e,iv:l},p={name:"PBKDF2",salt:f,iterations:c,hash:{name:s}},y=await u.subtle.importKey("raw",i(o),{name:"PBKDF2"},!1,["deriveKey","deriveBits"]),g=await u.subtle.deriveKey(p,y,{name:e,length:r},!0,["decrypt"]),b=await u.subtle.decrypt(d,g,h);return new Uint8Array(b)}}}}},91500:(e,t,r)=>{"use strict";const n=r(59701),i=r(87193),o={SHA1:"SHA-1",SHA256:"SHA-256",SHA512:"SHA-512"};t.create=async function(e,t){const r=o[e],s=await n.get().subtle.importKey("raw",t,{name:"HMAC",hash:{name:r}},!1,["sign"]);return{digest:async e=>(async(e,t)=>{const r=await n.get().subtle.sign({name:"HMAC"},e,t);return new Uint8Array(r,r.byteOffset,r.byteLength)})(s,e),length:i[e]}}},87193:e=>{"use strict";e.exports={SHA1:20,SHA256:32,SHA512:64}},68884:(e,t,r)=>{"use strict";const n=r(91500),i=r(60501),o=r(49431);t.aes=i,t.hmac=n,t.keys=o,t.randomBytes=r(18633),t.pbkdf2=r(25113)},76164:(e,t,r)=>{"use strict";const n=r(32114),i=r(59701),{base64urlToBuffer:o}=r(27944),s=r(1098),{toString:a}=r(92263),{concat:c}=r(20605),{equals:u}=r(19588),f={"P-256":256,"P-384":384,"P-521":521};t.generateEphmeralKeyPair=async function(e){s(Object.keys(f),e);const t=await i.get().subtle.generateKey({name:"ECDH",namedCurve:e},!0,["deriveBits"]);return{key:h(await i.get().subtle.exportKey("jwk",t.publicKey)),genSharedKey:async(r,n)=>{let o;o=n?await i.get().subtle.importKey("jwk",p(e,n),{name:"ECDH",namedCurve:e},!1,["deriveBits"]):t.privateKey;const s=[await i.get().subtle.importKey("jwk",d(e,r),{name:"ECDH",namedCurve:e},!1,[]),o],a=await i.get().subtle.deriveBits({name:"ECDH",namedCurve:e,public:s[0]},s[1],f[e]);return new Uint8Array(a,a.byteOffset,a.byteLength)}}};const l={"P-256":32,"P-384":48,"P-521":66};function h(e){const t=l[e.crv];return c([Uint8Array.from([4]),o(e.x,t),o(e.y,t)],1+2*t)}function d(e,t){const r=l[e];if(u(!t.slice(0,1),Uint8Array.from([4])))throw n(new Error("Cannot unmarshal public key - invalid key format"),"ERR_INVALID_KEY_FORMAT");return{kty:"EC",crv:e,x:a(t.slice(1,r+1),"base64url"),y:a(t.slice(1+r),"base64url"),ext:!0}}const p=(e,t)=>({...d(e,t.public),d:a(t.private,"base64url")})},15676:(e,t,r)=>{"use strict";const n=r(32114),{equals:i}=r(19588),{sha256:o}=r(56155),{base58btc:s}=r(99086),{identity:a}=r(78103),c=r(82060),u=r(32327),f=r(92352);class l{constructor(e){this._key=d(e,c.publicKeyLength)}async verify(e,t){return c.hashAndVerify(this._key,t,e)}marshal(){return this._key}get bytes(){return u.PublicKey.encode({Type:u.KeyType.Ed25519,Data:this.marshal()}).finish()}equals(e){return i(this.bytes,e.bytes)}async hash(){const{bytes:e}=await o.digest(this.bytes);return e}}class h{constructor(e,t){this._key=d(e,c.privateKeyLength),this._publicKey=d(t,c.publicKeyLength)}async sign(e){return c.hashAndSign(this._key,e)}get public(){return new l(this._publicKey)}marshal(){return this._key}get bytes(){return u.PrivateKey.encode({Type:u.KeyType.Ed25519,Data:this.marshal()}).finish()}equals(e){return i(this.bytes,e.bytes)}async hash(){const{bytes:e}=await o.digest(this.bytes);return e}async id(){const e=await a.digest(this.public.bytes);return s.encode(e.bytes).substring(1)}async export(e,t="libp2p-key"){if("libp2p-key"===t)return f.export(this.bytes,e);throw n(new Error(`export format '${t}' is not supported`),"ERR_INVALID_EXPORT_FORMAT")}}function d(e,t){if((e=Uint8Array.from(e||[])).length!==t)throw n(new Error(`Key must be a Uint8Array of length ${t}, got ${e.length}`),"ERR_INVALID_KEY_TYPE");return e}e.exports={Ed25519PublicKey:l,Ed25519PrivateKey:h,unmarshalEd25519PrivateKey:function(e){if(e.length>c.privateKeyLength){const t=(e=d(e,c.privateKeyLength+c.publicKeyLength)).slice(0,c.privateKeyLength),r=e.slice(c.privateKeyLength,e.length);return new h(t,r)}const t=(e=d(e,c.privateKeyLength)).slice(0,c.privateKeyLength),r=e.slice(c.publicKeyLength);return new h(t,r)},unmarshalEd25519PublicKey:function(e){return e=d(e,c.publicKeyLength),new l(e)},generateKeyPair:async function(){const{privateKey:e,publicKey:t}=await c.generateKey();return new h(e,t)},generateKeyPairFromSeed:async function(e){const{privateKey:t,publicKey:r}=await c.generateKeyFromSeed(e);return new h(t,r)}}},82060:(e,t,r)=>{"use strict";r(80069);const n=r(3832);t.publicKeyLength=n.pki.ed25519.constants.PUBLIC_KEY_BYTE_LENGTH,t.privateKeyLength=n.pki.ed25519.constants.PRIVATE_KEY_BYTE_LENGTH,t.generateKey=async function(){return n.pki.ed25519.generateKeyPair()},t.generateKeyFromSeed=async function(e){return n.pki.ed25519.generateKeyPair({seed:e})},t.hashAndSign=async function(e,t){return n.pki.ed25519.sign({message:t,privateKey:e})},t.hashAndVerify=async function(e,t,r){return n.pki.ed25519.verify({signature:t,message:r,publicKey:e})}},42508:(e,t,r)=>{"use strict";const n=r(76164);e.exports=async e=>n.generateEphmeralKeyPair(e)},92352:(e,t,r)=>{"use strict";const{base64:n}=r(9885),i=r(86322);e.exports={export:async function(e,t){const r=i.create(),o=await r.encrypt(e,t);return n.encode(o)}}},18568:(e,t,r)=>{"use strict";const{base64:n}=r(9885),i=r(86322);e.exports={import:async function(e,t){const r=n.decode(e),o=i.create();return await o.decrypt(r,t)}}},49431:(e,t,r)=>{"use strict";const n=r(32327);r(3068),r(97450);const i=r(3832),o=r(32114),{fromString:s}=r(52217),a=r(18568),c={rsa:r(66406),ed25519:r(15676),secp256k1:r(47233)(n,r(18633))},u="secp256k1 support requires libp2p-crypto-secp256k1 package",f="ERR_MISSING_PACKAGE";function l(e){const t=c[e.toLowerCase()];if(!t){const t=Object.keys(c).join(" / ");throw o(new Error(`invalid or unsupported key type ${e}. Must be ${t}`),"ERR_UNSUPPORTED_KEY_TYPE")}return t}const h=async e=>{const t=n.PrivateKey.decode(e),r=t.Data;switch(t.Type){case n.KeyType.RSA:return c.rsa.unmarshalRsaPrivateKey(r);case n.KeyType.Ed25519:return c.ed25519.unmarshalEd25519PrivateKey(r);case n.KeyType.Secp256k1:if(c.secp256k1)return c.secp256k1.unmarshalSecp256k1PrivateKey(r);throw o(new Error(u),f);default:l(t.Type)}};e.exports={supportedKeys:c,keysPBM:n,keyStretcher:r(94036),generateEphemeralKeyPair:r(42508),generateKeyPair:async(e,t)=>l(e).generateKeyPair(t),generateKeyPairFromSeed:async(e,t,r)=>{const n=l(e);if("ed25519"!==e.toLowerCase())throw o(new Error("Seed key derivation is unimplemented for RSA or secp256k1"),"ERR_UNSUPPORTED_KEY_DERIVATION_TYPE");return n.generateKeyPairFromSeed(t,r)},unmarshalPublicKey:e=>{const t=n.PublicKey.decode(e),r=t.Data;switch(t.Type){case n.KeyType.RSA:return c.rsa.unmarshalRsaPublicKey(r);case n.KeyType.Ed25519:return c.ed25519.unmarshalEd25519PublicKey(r);case n.KeyType.Secp256k1:if(c.secp256k1)return c.secp256k1.unmarshalSecp256k1PublicKey(r);throw o(new Error(u),f);default:l(t.Type)}},marshalPublicKey:(e,t)=>(l(t=(t||"rsa").toLowerCase()),e.bytes),unmarshalPrivateKey:h,marshalPrivateKey:(e,t)=>(l(t=(t||"rsa").toLowerCase()),e.bytes),import:async(e,t)=>{try{const r=await a.import(e,t);return h(r)}catch(e){}const r=i.pki.decryptRsaPrivateKey(e,t);if(null===r)throw o(new Error("Cannot read the key, most likely the password is wrong or not a RSA key"),"ERR_CANNOT_DECRYPT_PEM");let n=i.asn1.toDer(i.pki.privateKeyToAsn1(r));return n=s(n.getBytes(),"ascii"),c.rsa.unmarshalRsaPrivateKey(n)}}},55333:(e,t,r)=>{"use strict";r(28095);const n=r(3832),{base64urlToBigInteger:i}=r(27944);function o(e,t){return t.map((t=>i(e[t])))}e.exports={jwk2pub:function(e){return n.pki.setRsaPublicKey(...o(e,["n","e"]))},jwk2priv:function(e){return n.pki.setRsaPrivateKey(...o(e,["n","e","d","p","q","dp","dq","qi"]))}}},94036:(e,t,r)=>{"use strict";const n=r(32114),{concat:i}=r(20605),{fromString:o}=r(52217),s=r(91500),a={"AES-128":{ivSize:16,keySize:16},"AES-256":{ivSize:16,keySize:32},Blowfish:{ivSize:8,cipherKeySize:32}};e.exports=async(e,t,r)=>{const c=a[e];if(!c){const t=Object.keys(a).join(" / ");throw n(new Error(`unknown cipher type '${e}'. Must be ${t}`),"ERR_INVALID_CIPHER_TYPE")}if(!t)throw n(new Error("missing hash type"),"ERR_MISSING_HASH_TYPE");const u=c.keySize,f=c.ivSize,l=o("key expansion"),h=2*(f+u+20),d=await s.create(t,r);let p=await d.digest(l);const y=[];let g=0;for(;gh&&(t=h-g),y.push(e),g+=t,p=await d.digest(p)}const b=h/2,m=i(y),v=m.slice(0,b),w=m.slice(b,h),E=e=>({iv:e.slice(0,f),cipherKey:e.slice(f,f+u),macKey:e.slice(f+u)});return{k1:E(v),k2:E(w)}}},32327:(e,t,r)=>{"use strict";var n,i,o=r(62100),s=o.Reader,a=o.Writer,c=o.util,u=o.roots["libp2p-crypto-keys"]||(o.roots["libp2p-crypto-keys"]={});u.KeyType=(n={},(i=Object.create(n))[n[0]="RSA"]=0,i[n[1]="Ed25519"]=1,i[n[2]="Secp256k1"]=2,i),u.PublicKey=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.Type=e.int32();break;case 2:n.Data=e.bytes();break;default:e.skipType(7&i)}}if(!n.hasOwnProperty("Type"))throw c.ProtocolError("missing required 'Type'",{instance:n});if(!n.hasOwnProperty("Data"))throw c.ProtocolError("missing required 'Data'",{instance:n});return n},e.fromObject=function(e){if(e instanceof u.PublicKey)return e;var t=new u.PublicKey;switch(e.Type){case"RSA":case 0:t.Type=0;break;case"Ed25519":case 1:t.Type=1;break;case"Secp256k1":case 2:t.Type=2}return null!=e.Data&&("string"==typeof e.Data?c.base64.decode(e.Data,t.Data=c.newBuffer(c.base64.length(e.Data)),0):e.Data.length&&(t.Data=e.Data)),t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(r.Type=t.enums===String?"RSA":0,t.bytes===String?r.Data="":(r.Data=[],t.bytes!==Array&&(r.Data=c.newBuffer(r.Data)))),null!=e.Type&&e.hasOwnProperty("Type")&&(r.Type=t.enums===String?u.KeyType[e.Type]:e.Type),null!=e.Data&&e.hasOwnProperty("Data")&&(r.Data=t.bytes===String?c.base64.encode(e.Data,0,e.Data.length):t.bytes===Array?Array.prototype.slice.call(e.Data):e.Data),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),u.PrivateKey=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.Type=e.int32();break;case 2:n.Data=e.bytes();break;default:e.skipType(7&i)}}if(!n.hasOwnProperty("Type"))throw c.ProtocolError("missing required 'Type'",{instance:n});if(!n.hasOwnProperty("Data"))throw c.ProtocolError("missing required 'Data'",{instance:n});return n},e.fromObject=function(e){if(e instanceof u.PrivateKey)return e;var t=new u.PrivateKey;switch(e.Type){case"RSA":case 0:t.Type=0;break;case"Ed25519":case 1:t.Type=1;break;case"Secp256k1":case 2:t.Type=2}return null!=e.Data&&("string"==typeof e.Data?c.base64.decode(e.Data,t.Data=c.newBuffer(c.base64.length(e.Data)),0):e.Data.length&&(t.Data=e.Data)),t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(r.Type=t.enums===String?"RSA":0,t.bytes===String?r.Data="":(r.Data=[],t.bytes!==Array&&(r.Data=c.newBuffer(r.Data)))),null!=e.Type&&e.hasOwnProperty("Type")&&(r.Type=t.enums===String?u.KeyType[e.Type]:e.Type),null!=e.Data&&e.hasOwnProperty("Data")&&(r.Data=t.bytes===String?c.base64.encode(e.Data,0,e.Data.length):t.bytes===Array?Array.prototype.slice.call(e.Data):e.Data),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),e.exports=u},30319:(e,t,r)=>{"use strict";const n=r(59701),i=r(18633),{toString:o}=r(92263),{fromString:s}=r(52217);function a(e){return Promise.all([n.get().subtle.exportKey("jwk",e.privateKey),n.get().subtle.exportKey("jwk",e.publicKey)])}t.utils=r(43075),t.generateKey=async function(e){const t=await n.get().subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]),r=await a(t);return{privateKey:r[0],publicKey:r[1]}},t.unmarshalPrivateKey=async function(e){const t=[await n.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]),await(r=e,n.get().subtle.importKey("jwk",{kty:r.kty,n:r.n,e:r.e},{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"]))];var r;const i=await a({privateKey:t[0],publicKey:t[1]});return{privateKey:i[0],publicKey:i[1]}},t.getRandomValues=i,t.hashAndSign=async function(e,t){const r=await n.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]),i=await n.get().subtle.sign({name:"RSASSA-PKCS1-v1_5"},r,Uint8Array.from(t));return new Uint8Array(i,i.byteOffset,i.byteLength)},t.hashAndVerify=async function(e,t,r){const i=await n.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]);return n.get().subtle.verify({name:"RSASSA-PKCS1-v1_5"},i,t,r)};const{jwk2pub:c,jwk2priv:u}=r(55333);function f(e,t,r,n){const i=t?c(e):u(e),a=n(o(Uint8Array.from(r),"ascii"),i);return s(a,"ascii")}t.encrypt=function(e,t){return f(e,!0,t,((e,t)=>t.encrypt(e)))},t.decrypt=function(e,t){return f(e,!1,t,((e,t)=>t.decrypt(e)))}},66406:(e,t,r)=>{"use strict";const{sha256:n}=r(56155),i=r(32114),{equals:o}=r(19588),{toString:s}=r(92263);r(63219),r(80069);const a=r(3832),c=r(30319),u=r(32327),f=r(92352);class l{constructor(e){this._key=e}async verify(e,t){return c.hashAndVerify(this._key,t,e)}marshal(){return c.utils.jwkToPkix(this._key)}get bytes(){return u.PublicKey.encode({Type:u.KeyType.RSA,Data:this.marshal()}).finish()}encrypt(e){return c.encrypt(this._key,e)}equals(e){return o(this.bytes,e.bytes)}async hash(){const{bytes:e}=await n.digest(this.bytes);return e}}class h{constructor(e,t){this._key=e,this._publicKey=t}genSecret(){return c.getRandomValues(16)}async sign(e){return c.hashAndSign(this._key,e)}get public(){if(!this._publicKey)throw i(new Error("public key not provided"),"ERR_PUBKEY_NOT_PROVIDED");return new l(this._publicKey)}decrypt(e){return c.decrypt(this._key,e)}marshal(){return c.utils.jwkToPkcs1(this._key)}get bytes(){return u.PrivateKey.encode({Type:u.KeyType.RSA,Data:this.marshal()}).finish()}equals(e){return o(this.bytes,e.bytes)}async hash(){const{bytes:e}=await n.digest(this.bytes);return e}async id(){const e=await this.public.hash();return s(e,"base58btc")}async export(e,t="pkcs-8"){if("pkcs-8"===t){const t=new a.util.ByteBuffer(this.marshal()),r=a.asn1.fromDer(t),n=a.pki.privateKeyFromAsn1(r),i={algorithm:"aes256",count:1e4,saltSize:16,prfAlgorithm:"sha512"};return a.pki.encryptRsaPrivateKey(n,e,i)}if("libp2p-key"===t)return f.export(this.bytes,e);throw i(new Error(`export format '${t}' is not supported`),"ERR_INVALID_EXPORT_FORMAT")}}e.exports={RsaPublicKey:l,RsaPrivateKey:h,unmarshalRsaPublicKey:function(e){const t=c.utils.pkixToJwk(e);return new l(t)},unmarshalRsaPrivateKey:async function(e){const t=c.utils.pkcs1ToJwk(e),r=await c.unmarshalPrivateKey(t);return new h(r.privateKey,r.publicKey)},generateKeyPair:async function(e){const t=await c.generateKey(e);return new h(t.privateKey,t.publicKey)},fromJwk:async function(e){const t=await c.unmarshalPrivateKey(e);return new h(t.privateKey,t.publicKey)}}},43075:(e,t,r)=>{"use strict";r(3068),r(28095);const n=r(3832),{bigIntegerToUintBase64url:i,base64urlToBigInteger:o}=r(27944),{fromString:s}=r(52217),{toString:a}=r(92263);t.pkcs1ToJwk=function(e){const t=n.asn1.fromDer(a(e,"ascii")),r=n.pki.privateKeyFromAsn1(t);return{kty:"RSA",n:i(r.n),e:i(r.e),d:i(r.d),p:i(r.p),q:i(r.q),dp:i(r.dP),dq:i(r.dQ),qi:i(r.qInv),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkcs1=function(e){const t=n.pki.privateKeyToAsn1({n:o(e.n),e:o(e.e),d:o(e.d),p:o(e.p),q:o(e.q),dP:o(e.dp),dQ:o(e.dq),qInv:o(e.qi)});return s(n.asn1.toDer(t).getBytes(),"ascii")},t.pkixToJwk=function(e){const t=n.asn1.fromDer(a(e,"ascii")),r=n.pki.publicKeyFromAsn1(t);return{kty:"RSA",n:i(r.n),e:i(r.e),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkix=function(e){const t=n.pki.publicKeyToAsn1({n:o(e.n),e:o(e.e)});return s(n.asn1.toDer(t).getBytes(),"ascii")}},47233:(e,t,r)=>{"use strict";const{sha256:n}=r(56155),i=r(32114),{equals:o}=r(19588),{toString:s}=r(92263),a=r(92352);e.exports=(e,t,c)=>{c=c||r(27690)(t);class u{constructor(e){c.validatePublicKey(e),this._key=e}verify(e,t){return c.hashAndVerify(this._key,t,e)}marshal(){return c.compressPublicKey(this._key)}get bytes(){return e.PublicKey.encode({Type:e.KeyType.Secp256k1,Data:this.marshal()}).finish()}equals(e){return o(this.bytes,e.bytes)}async hash(){const{bytes:e}=await n.digest(this.bytes);return e}}class f{constructor(e,t){this._key=e,this._publicKey=t||c.computePublicKey(e),c.validatePrivateKey(this._key),c.validatePublicKey(this._publicKey)}sign(e){return c.hashAndSign(this._key,e)}get public(){return new u(this._publicKey)}marshal(){return this._key}get bytes(){return e.PrivateKey.encode({Type:e.KeyType.Secp256k1,Data:this.marshal()}).finish()}equals(e){return o(this.bytes,e.bytes)}async hash(){const{bytes:e}=await n.digest(this.bytes);return e}async id(){const e=await this.public.hash();return s(e,"base58btc")}async export(e,t="libp2p-key"){if("libp2p-key"===t)return a.export(this.bytes,e);throw i(new Error(`export format '${t}' is not supported`),"ERR_INVALID_EXPORT_FORMAT")}}return{Secp256k1PublicKey:u,Secp256k1PrivateKey:f,unmarshalSecp256k1PrivateKey:function(e){return new f(e)},unmarshalSecp256k1PublicKey:function(e){return new u(e)},generateKeyPair:async function(){const e=await c.generateKey();return new f(e)}}}},27690:(e,t,r)=>{"use strict";const n=r(17221),{sha256:i}=r(56155);e.exports=e=>{function t(e){if(!n.privateKeyVerify(e))throw new Error("Invalid private key")}return{generateKey:function(){let t;do{t=e(32)}while(!n.privateKeyVerify(t));return t},privateKeyLength:32,hashAndSign:async function(e,t){const{digest:r}=await i.digest(t),o=n.ecdsaSign(r,e);return n.signatureExport(o.signature)},hashAndVerify:async function(e,t,r){const{digest:o}=await i.digest(r);return t=n.signatureImport(t),n.ecdsaVerify(t,o,e)},compressPublicKey:function(e){if(!n.publicKeyVerify(e))throw new Error("Invalid public key");return n.publicKeyConvert(e,!0)},decompressPublicKey:function(e){return n.publicKeyConvert(e,!1)},validatePrivateKey:t,validatePublicKey:function(e){if(!n.publicKeyVerify(e))throw new Error("Invalid public key")},computePublicKey:function(e){return t(e),n.publicKeyCreate(e)}}}},1098:(e,t,r)=>{"use strict";const n=r(32114);e.exports=function(e,t){if(!e.includes(t)){const r=e.join(" / ");throw n(new Error(`Unknown curve: ${t}. Must be ${r}`),"ERR_INVALID_CURVE")}}},25113:(e,t,r)=>{"use strict";const n=r(98960),i=r(97116),o=r(32114),s={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};e.exports=function(e,t,r,a,c){const u=s[c];if(!u){const e=Object.keys(s).join(" / ");throw o(new Error(`Hash '${c}' is unknown or not supported. Must be ${e}`),"ERR_UNSUPPORTED_HASH_TYPE")}const f=n(e,t,r,a,u);return i.encode64(f)}},18633:(e,t,r)=>{"use strict";const n=r(1914),i=r(32114);e.exports=function(e){if(isNaN(e)||e<=0)throw i(new Error("random bytes length must be a Number bigger than 0"),"ERR_INVALID_LENGTH");return n(e)}},27944:(e,t,r)=>{"use strict";r(97116),r(15764);const n=r(3832),{fromString:i}=r(52217),{toString:o}=r(92263),{concat:s}=r(20605);t.bigIntegerToUintBase64url=(e,t)=>{let r=Uint8Array.from(e.abs().toByteArray());if(r=0===r[0]?r.slice(1):r,null!=t){if(r.length>t)throw new Error("byte array longer than desired length");r=s([new Uint8Array(t-r.length),r])}return o(r,"base64url")},t.base64urlToBigInteger=e=>{const r=t.base64urlToBuffer(e);return new n.jsbn.BigInteger(o(r,"base16"),16)},t.base64urlToBuffer=(e,t)=>{let r=i(e,"base64urlpad");if(null!=t){if(r.length>t)throw new Error("byte array longer than desired length");r=s([new Uint8Array(t-r.length),r])}return r}},59701:(e,t)=>{"use strict";t.get=(e=self)=>{const t=e.crypto||e.msCrypto;if(!t||!t.subtle)throw Object.assign(new Error("Missing Web Crypto API. The most likely cause of this error is that this page is being accessed from an insecure context (i.e. not HTTPS). For more information and possible resolutions see https://github.com/libp2p/js-libp2p-crypto/blob/master/README.md#web-crypto-api"),{code:"ERR_MISSING_WEB_CRYPTO"});return t}},14786:e=>{e.exports=function e(t,r){var n,i=0,o=0,s=r=r||0,a=t.length;do{if(s>=a||o>49)throw e.bytes=0,new RangeError("Could not decode varint");n=t[s++],i+=o<28?(127&n)<=128);return e.bytes=s-r,i}},84099:e=>{e.exports=function e(r,n,i){if(Number.MAX_SAFE_INTEGER&&r>Number.MAX_SAFE_INTEGER)throw e.bytes=0,new RangeError("Could not encode varint");n=n||[];for(var o=i=i||0;r>=t;)n[i++]=255&r|128,r/=128;for(;-128&r;)n[i++]=255&r|128,r>>>=7;return n[i]=0|r,e.bytes=i-o+1,n};var t=Math.pow(2,31)},88256:(e,t,r)=>{e.exports={encode:r(84099),decode:r(14786),encodingLength:r(48984)}},48984:e=>{var t=Math.pow(2,7),r=Math.pow(2,14),n=Math.pow(2,21),i=Math.pow(2,28),o=Math.pow(2,35),s=Math.pow(2,42),a=Math.pow(2,49),c=Math.pow(2,56),u=Math.pow(2,63);e.exports=function(e){return e0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.krasnodar=t.testNet=t.stage=void 0,t.stage=[{multiaddr:"/dns4/stage.fluence.dev/tcp/19001/wss/p2p/12D3KooWHCJbJKGDfCgHSoCuK9q4STyRnVveqLoXAPBbXHTZx9Cv",peerId:"12D3KooWHCJbJKGDfCgHSoCuK9q4STyRnVveqLoXAPBbXHTZx9Cv"},{multiaddr:"/dns4/stage.fluence.dev/tcp/19002/wss/p2p/12D3KooWMigkP4jkVyufq5JnDJL6nXvyjeaDNpRfEZqQhsG3sYCU",peerId:"12D3KooWMigkP4jkVyufq5JnDJL6nXvyjeaDNpRfEZqQhsG3sYCU"},{multiaddr:"/dns4/stage.fluence.dev/tcp/19003/wss/p2p/12D3KooWMMGdfVEJ1rWe1nH1nehYDzNEHhg5ogdfiGk88AupCMnf",peerId:"12D3KooWMMGdfVEJ1rWe1nH1nehYDzNEHhg5ogdfiGk88AupCMnf"},{multiaddr:"/dns4/stage.fluence.dev/tcp/19004/wss/p2p/12D3KooWJ4bTHirdTFNZpCS72TAzwtdmavTBkkEXtzo6wHL25CtE",peerId:"12D3KooWJ4bTHirdTFNZpCS72TAzwtdmavTBkkEXtzo6wHL25CtE"},{multiaddr:"/dns4/stage.fluence.dev/tcp/19005/wss/p2p/12D3KooWAKNos2KogexTXhrkMZzFYpLHuWJ4PgoAhurSAv7o5CWA",peerId:"12D3KooWAKNos2KogexTXhrkMZzFYpLHuWJ4PgoAhurSAv7o5CWA"},{multiaddr:"/dns4/stage.fluence.dev/tcp/19990/wss/p2p/12D3KooWDcpWuyrMTDinqNgmXAuRdfd2mTdY9VoXZSAet2pDzh6r",peerId:"12D3KooWDcpWuyrMTDinqNgmXAuRdfd2mTdY9VoXZSAet2pDzh6r"}],t.testNet=[{multiaddr:"/dns4/net01.fluence.dev/tcp/19001/wss/p2p/12D3KooWEXNUbCXooUwHrHBbrmjsrpHXoEphPwbjQXEGyzbqKnE9",peerId:"12D3KooWEXNUbCXooUwHrHBbrmjsrpHXoEphPwbjQXEGyzbqKnE9"},{multiaddr:"/dns4/net01.fluence.dev/tcp/19990/wss/p2p/12D3KooWMhVpgfQxBLkQkJed8VFNvgN4iE6MD7xCybb1ZYWW2Gtz",peerId:"12D3KooWMhVpgfQxBLkQkJed8VFNvgN4iE6MD7xCybb1ZYWW2Gtz"},{multiaddr:"/dns4/net02.fluence.dev/tcp/19001/wss/p2p/12D3KooWHk9BjDQBUqnavciRPhAYFvqKBe4ZiPPvde7vDaqgn5er",peerId:"12D3KooWHk9BjDQBUqnavciRPhAYFvqKBe4ZiPPvde7vDaqgn5er"},{multiaddr:"/dns4/net03.fluence.dev/tcp/19001/wss/p2p/12D3KooWBUJifCTgaxAUrcM9JysqCcS4CS8tiYH5hExbdWCAoNwb",peerId:"12D3KooWBUJifCTgaxAUrcM9JysqCcS4CS8tiYH5hExbdWCAoNwb"},{multiaddr:"/dns4/net04.fluence.dev/tcp/19001/wss/p2p/12D3KooWJbJFaZ3k5sNd8DjQgg3aERoKtBAnirEvPV8yp76kEXHB",peerId:"12D3KooWJbJFaZ3k5sNd8DjQgg3aERoKtBAnirEvPV8yp76kEXHB"},{multiaddr:"/dns4/net05.fluence.dev/tcp/19001/wss/p2p/12D3KooWCKCeqLPSgMnDjyFsJuWqREDtKNHx1JEBiwaMXhCLNTRb",peerId:"12D3KooWCKCeqLPSgMnDjyFsJuWqREDtKNHx1JEBiwaMXhCLNTRb"},{multiaddr:"/dns4/net06.fluence.dev/tcp/19001/wss/p2p/12D3KooWKnRcsTpYx9axkJ6d69LPfpPXrkVLe96skuPTAo76LLVH",peerId:"12D3KooWKnRcsTpYx9axkJ6d69LPfpPXrkVLe96skuPTAo76LLVH"},{multiaddr:"/dns4/net07.fluence.dev/tcp/19001/wss/p2p/12D3KooWBSdm6TkqnEFrgBuSkpVE3dR1kr6952DsWQRNwJZjFZBv",peerId:"12D3KooWBSdm6TkqnEFrgBuSkpVE3dR1kr6952DsWQRNwJZjFZBv"},{multiaddr:"/dns4/net08.fluence.dev/tcp/19001/wss/p2p/12D3KooWGzNvhSDsgFoHwpWHAyPf1kcTYCGeRBPfznL8J6qdyu2H",peerId:"12D3KooWGzNvhSDsgFoHwpWHAyPf1kcTYCGeRBPfznL8J6qdyu2H"},{multiaddr:"/dns4/net09.fluence.dev/tcp/19001/wss/p2p/12D3KooWF7gjXhQ4LaKj6j7ntxsPpGk34psdQicN2KNfBi9bFKXg",peerId:"12D3KooWF7gjXhQ4LaKj6j7ntxsPpGk34psdQicN2KNfBi9bFKXg"},{multiaddr:"/dns4/net10.fluence.dev/tcp/19001/wss/p2p/12D3KooWB9P1xmV3c7ZPpBemovbwCiRRTKd3Kq2jsVPQN4ZukDfy",peerId:"12D3KooWB9P1xmV3c7ZPpBemovbwCiRRTKd3Kq2jsVPQN4ZukDfy"}],t.krasnodar=[{multiaddr:"/dns4/kras-00.fluence.dev/tcp/19990/wss/p2p/12D3KooWSD5PToNiLQwKDXsu8JSysCwUt8BVUJEqCHcDe7P5h45e",peerId:"12D3KooWSD5PToNiLQwKDXsu8JSysCwUt8BVUJEqCHcDe7P5h45e"},{multiaddr:"/dns4/kras-00.fluence.dev/tcp/19001/wss/p2p/12D3KooWR4cv1a8tv7pps4HH6wePNaK6gf1Hww5wcCMzeWxyNw51",peerId:"12D3KooWR4cv1a8tv7pps4HH6wePNaK6gf1Hww5wcCMzeWxyNw51"},{multiaddr:"/dns4/kras-01.fluence.dev/tcp/19001/wss/p2p/12D3KooWKnEqMfYo9zvfHmqTLpLdiHXPe4SVqUWcWHDJdFGrSmcA",peerId:"12D3KooWKnEqMfYo9zvfHmqTLpLdiHXPe4SVqUWcWHDJdFGrSmcA"},{multiaddr:"/dns4/kras-02.fluence.dev/tcp/19001/wss/p2p/12D3KooWHLxVhUQyAuZe6AHMB29P7wkvTNMn7eDMcsqimJYLKREf",peerId:"12D3KooWHLxVhUQyAuZe6AHMB29P7wkvTNMn7eDMcsqimJYLKREf"},{multiaddr:"/dns4/kras-03.fluence.dev/tcp/19001/wss/p2p/12D3KooWJd3HaMJ1rpLY1kQvcjRPEvnDwcXrH8mJvk7ypcZXqXGE",peerId:"12D3KooWJd3HaMJ1rpLY1kQvcjRPEvnDwcXrH8mJvk7ypcZXqXGE"},{multiaddr:"/dns4/kras-04.fluence.dev/tcp/19001/wss/p2p/12D3KooWFEwNWcHqi9rtsmDhsYcDbRUCDXH84RC4FW6UfsFWaoHi",peerId:"12D3KooWFEwNWcHqi9rtsmDhsYcDbRUCDXH84RC4FW6UfsFWaoHi"},{multiaddr:"/dns4/kras-05.fluence.dev/tcp/19001/wss/p2p/12D3KooWCMr9mU894i8JXAFqpgoFtx6qnV1LFPSfVc3Y34N4h4LS",peerId:"12D3KooWCMr9mU894i8JXAFqpgoFtx6qnV1LFPSfVc3Y34N4h4LS"},{multiaddr:"/dns4/kras-06.fluence.dev/tcp/19001/wss/p2p/12D3KooWDUszU2NeWyUVjCXhGEt1MoZrhvdmaQQwtZUriuGN1jTr",peerId:"12D3KooWDUszU2NeWyUVjCXhGEt1MoZrhvdmaQQwtZUriuGN1jTr"},{multiaddr:"/dns4/kras-07.fluence.dev/tcp/19001/wss/p2p/12D3KooWEFFCZnar1cUJQ3rMWjvPQg6yMV2aXWs2DkJNSRbduBWn",peerId:"12D3KooWEFFCZnar1cUJQ3rMWjvPQg6yMV2aXWs2DkJNSRbduBWn"},{multiaddr:"/dns4/kras-08.fluence.dev/tcp/19001/wss/p2p/12D3KooWFtf3rfCDAfWwt6oLZYZbDfn9Vn7bv7g6QjjQxUUEFVBt",peerId:"12D3KooWFtf3rfCDAfWwt6oLZYZbDfn9Vn7bv7g6QjjQxUUEFVBt"},{multiaddr:"/dns4/kras-09.fluence.dev/tcp/19001/wss/p2p/12D3KooWD7CvsYcpF9HE9CCV9aY3SJ317tkXVykjtZnht2EbzDPm",peerId:"12D3KooWD7CvsYcpF9HE9CCV9aY3SJ317tkXVykjtZnht2EbzDPm"}]},44612:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Fluence=t.setLogLevel=t.FluencePeer=t.KeyPair=void 0;var i=n(r(2043)),o=r(40149),s=r(84165);Object.defineProperty(t,"KeyPair",{enumerable:!0,get:function(){return s.KeyPair}});var a=r(40149);Object.defineProperty(t,"FluencePeer",{enumerable:!0,get:function(){return a.FluencePeer}}),t.setLogLevel=function(e){i.default.setLevel(e)},i.default.setDefaultLevel("WARN");var c=new o.FluencePeer;t.Fluence={start:function(e){return c.start(e)},stop:function(){return c.stop()},getStatus:function(){return c.getStatus()},getPeer:function(){return c}}},29786:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(53818),i=r(48764);t.default=n.isBrowser?i.Buffer:Buffer},84461:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t},s=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},a=this&&this.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.FluencePeer=void 0;var u=r(46584),f=r(33322),l=r(29141),h=r(84461),d=r(84165),p=r(70229),y=r(67652),g=c(r(2043)),b=r(68316),m=r(11189),v=r(51943),w=r(19045),E=c(r(29786)),_=function(){function e(){this._isFluenceAwesome=!0,this._incomingParticles=new y.Subject,this._outgoingParticles=new y.Subject,this._particleSpecificHandlers=new Map,this._commonHandlers=new Map,this._relayPeerId=null,this._timeouts=[],this._particleQueues=new Map,this._legacyParticleSpecificHandlers=new Map}return e.isInstance=function(e){return!(!e||!e._isFluenceAwesome)},e.prototype.getStatus=function(){var e,t;return{isInitialized:void 0!==this._keyPair,isConnected:void 0!==this._connection,peerId:(null===(t=null===(e=this._keyPair)||void 0===e?void 0:e.Libp2pPeerId)||void 0===t?void 0:t.toB58String())||null,relayPeerId:this._relayPeerId||null}},e.prototype.start=function(e){return i(this,void 0,void 0,(function(){var t,r,n,i,s=this;return o(this,(function(o){switch(o.label){case 0:return(null==e?void 0:e.KeyPair)?(this._keyPair=e.KeyPair,[3,3]):[3,1];case 1:return t=this,[4,d.KeyPair.randomEd25519()];case 2:t._keyPair=o.sent(),o.label=3;case 3:return this._defaultTTL=void 0!==(null==e?void 0:e.defaultTtlMs)?null==e?void 0:e.defaultTtlMs:7e3,this._avmRunner=(null==e?void 0:e.avmRunner)||new m.AvmRunnerBackground,[4,this._avmRunner.init((null==e?void 0:e.avmLogLevel)||"off")];case 4:return o.sent(),(null==e?void 0:e.connectTo)?(r=void 0,n=e.connectTo.multiaddr,r=n?new u.Multiaddr(n):new u.Multiaddr(e.connectTo),this._relayPeerId=r.getPeerId(),this._connection?[4,this._connection.disconnect()]:[3,6]):[3,9];case 5:o.sent(),o.label=6;case 6:return i=this,[4,h.FluenceConnection.createConnection({peerId:this._keyPair.Libp2pPeerId,relayAddress:r,dialTimeoutMs:e.dialTimeoutMs,onIncomingParticle:function(e){return s._incomingParticles.next({particle:e,onStageChange:function(){}})}})];case 7:return i._connection=o.sent(),[4,this._connect()];case 8:o.sent(),o.label=9;case 9:return this._legacyCallServiceHandler=new l.CallServiceHandler,function(e){for(var t in b.builtInServices)for(var r in b.builtInServices[t]){var n=b.builtInServices[t][r];e.internals.regHandler.common(t,r,n)}}(this),this._classServices={sig:new v.Sig(this._keyPair)},this._classServices.sig.securityGuard=(0,v.defaultSigGuard)(this.getStatus().peerId),(0,w.registerSig)(this,this._classServices.sig),(0,w.registerSig)(this,this.getStatus().peerId,this._classServices.sig),this._startParticleProcessing(),[2]}}))}))},e.prototype.getServices=function(){return n({},this._classServices)},e.prototype.stop=function(){var e;return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return this._keyPair=void 0,this._relayPeerId=null,this._stopParticleProcessing(),[4,this._disconnect()];case 1:return t.sent(),[4,null===(e=this._avmRunner)||void 0===e?void 0:e.terminate()];case 2:return t.sent(),this._avmRunner=void 0,this._legacyCallServiceHandler=null,this._particleSpecificHandlers.clear(),this._commonHandlers.clear(),[2]}}))}))},Object.defineProperty(e.prototype,"internals",{get:function(){var e=this;return{initiateParticle:function(t,r){if(!e.getStatus().isInitialized)throw"Cannot initiate new particle: peer is not initialized";void 0===t.initPeerId&&(t.initPeerId=e.getStatus().peerId),void 0===t.ttl&&(t.ttl=e._defaultTTL),e._incomingParticles.next({particle:t,onStageChange:r})},regHandler:{common:function(t,r,n){e._commonHandlers.set(A(t,r),n)},forParticle:function(t,r,n,i){var o=e._particleSpecificHandlers.get(t);void 0===o&&(o=new Map,e._particleSpecificHandlers.set(t,o)),o.set(A(r,n),i)}},initiateFlow:function(t){var r=t.particle;e._legacyParticleSpecificHandlers.set(r.id,{handler:t.handler,error:t.error,timeout:t.timeout}),e.internals.initiateParticle(r,(function(e){"interpreterError"===e.stage&&(null==t||t.error(e.errorMessage)),"expired"===e.stage&&(null==t||t.timeout())}))},callServiceHandler:this._legacyCallServiceHandler}},enumerable:!1,configurable:!0}),e.prototype._connect=function(){var e;return i(this,void 0,void 0,(function(){return o(this,(function(t){return[2,null===(e=this._connection)||void 0===e?void 0:e.connect()]}))}))},e.prototype._disconnect=function(){return i(this,void 0,void 0,(function(){return o(this,(function(e){return this._connection?[2,this._connection.disconnect()]:[2]}))}))},e.prototype._startParticleProcessing=function(){var e=this;this._incomingParticles.pipe((0,y.tap)((function(e){e.particle.logTo("debug","particle received:")})),I(this._expireParticle.bind(this))).subscribe((function(t){var r=t.particle,n=e._particleQueues.get(r.id);if(!n){n=e._createParticlesProcessingQueue(),e._particleQueues.set(r.id,n);var i=setTimeout((function(){e._expireParticle(t)}),r.actualTtl());e._timeouts.push(i)}n.next(t)})),this._outgoingParticles.subscribe((function(t){return i(e,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return this.getStatus().isInitialized?this._connection?[4,this._connection.sendParticle(t.particle)]:(t.particle.logTo("error","cannot send particle, peer is not connected"),t.onStageChange({stage:"sendingError"}),[2]):[2];case 1:return e.sent(),t.onStageChange({stage:"sent"}),[2]}}))}))}))},e.prototype._expireParticle=function(e){var t=e.particle.id;g.default.debug("particle "+t+" has expired after "+e.particle.ttl+". Deleting particle-related queues and handlers"),this._particleQueues.delete(t),this._particleSpecificHandlers.delete(t),e.onStageChange({stage:"expired"})},e.prototype._createParticlesProcessingQueue=function(){var e=this,t=new y.Subject,r=E.default.from([]);return t.pipe(I(this._expireParticle.bind(this)),(0,y.concatMap)((function(t){return i(e,void 0,void 0,(function(){var e,i;return o(this,(function(o){switch(o.label){case 0:return this.getStatus().isInitialized?[4,T(this.getStatus().peerId,this._avmRunner,t.particle,r)]:[2,null];case 1:return e=o.sent(),i=E.default.from(e.data),r=i,[2,n(n({},t),{result:e,newData:i})]}}))}))}))).subscribe((function(r){return i(e,void 0,void 0,(function(){var e,i,c,u,l,h,d,y,g,b;return o(this,(function(o){if(!this.getStatus().isInitialized)return[2];if(!S(r.result))return r.onStageChange({stage:"interpreterError",errorMessage:r.result.errorMessage}),[2];if(setTimeout((function(){r.onStageChange({stage:"interpreted"})}),0),r.result.nextPeerPks.length>0&&((e=r.particle.clone()).data=r.newData,this._outgoingParticles.next(n(n({},r),{particle:e}))),r.result.callRequests.length>0){i=function(e,i){var o={fnName:i.functionName,args:i.arguments,serviceId:i.serviceId,tetraplets:i.tetraplets,particleContext:r.particle.getParticleContext()};c._execSingleCallRequest(o).catch((function(e){return{retCode:f.ResultCodes.error,result:'Handler failed. fnName="'+o.fnName+'" serviceId="'+o.serviceId+'" error: '+e.toString()}})).then((function(i){var o={result:(0,p.jsonify)(i.result),retCode:i.retCode},s=r.particle.clone();s.callResults=[[e,o]],s.data=E.default.from([]),t.next(n(n({},r),{particle:s}))}))},c=this;try{for(u=s(r.result.callRequests),l=u.next();!l.done;l=u.next())h=a(l.value,2),d=h[0],y=h[1],i(d,y)}catch(e){g={error:e}}finally{try{l&&!l.done&&(b=u.return)&&b.call(u)}finally{if(g)throw g.error}}}else r.onStageChange({stage:"localWorkDone"});return[2]}))}))})),t},e.prototype._execSingleCallRequest=function(e){return i(this,void 0,void 0,(function(){var t,r,n,i,s,a,c;return o(this,(function(o){switch(o.label){case 0:return g.default.debug("executing call service handler",(0,p.jsonify)(e)),t=e.particleContext.particleId,r=this._legacyParticleSpecificHandlers.get(t),n={result:void 0,retCode:void 0},void 0!==r&&(n=r.handler.execute(e)),void 0===(null==n?void 0:n.result)&&(n=this._legacyCallServiceHandler.execute(e)),void 0!==n.retCode?[3,4]:(i=A(e.serviceId,e.fnName),s=this._particleSpecificHandlers.get(t),a=void 0,void 0!==s&&(a=s.get(i)),void 0===a&&(a=this._commonHandlers.get(i)),a?[4,a(e)]:[3,2]);case 1:return c=o.sent(),[3,3];case 2:c={retCode:f.ResultCodes.error,result:"No handler has been registered for serviceId='"+e.serviceId+"' fnName='"+e.fnName+"' args='"+(0,p.jsonify)(e.args)+"'"},o.label=3;case 3:n=c,o.label=4;case 4:return void 0===n.result&&(n.result=null),g.default.debug("executed call service handler, req and res are: ",(0,p.jsonify)(e),(0,p.jsonify)(n)),[2,n]}}))}))},e.prototype._stopParticleProcessing=function(){var e,t;try{for(var r=s(this._timeouts),n=r.next();!n.done;n=r.next()){var i=n.value;clearTimeout(i)}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}this._particleQueues.clear()},e}();function S(e){return 0===e.retCode}function A(e,t){return e+"/"+t}function T(e,t,r,s){return i(this,void 0,void 0,(function(){var i,a;return o(this,(function(o){switch(o.label){case 0:return r.logTo("debug","Sending particle to interpreter"),g.default.debug("prevData: ",(0,p.dataToString)(s)),[4,t.run(r.script,s,r.data,{initPeerId:r.initPeerId,currentPeerId:e},r.callResults)];case 1:return i=o.sent(),(a=n({},i)).data=(0,p.dataToString)(a.data),S(i)?g.default.debug("Interpreter result: ",(0,p.jsonify)(a)):g.default.error("Interpreter failed: ",(0,p.jsonify)(a)),[2,i]}}))}))}function I(e){return(0,y.pipe)((0,y.tap)((function(t){t.particle.hasExpired()&&e(t)})),(0,y.filter)((function(e){return!e.particle.hasExpired()})))}t.FluencePeer=_},84165:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t},s=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},a=this&&this.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.registerSig=void 0;var n=r(90281);t.registerSig=function(){for(var e=[],t=0;t0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},s=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i1?p("identity accepts up to 1 arguments, received "+e.args.length+" arguments"):d(0===e.args.length?{}:e.args[0])},concat:function(e){var t=e.args.map((function(e,t){return[Array.isArray(e),t]})).filter((function(e){var t=o(e,2),r=t[0];return t[1],!r})).map((function(e){var t=o(e,2);return t[0],t[1]}));if(t.length>0){var r=t.join(", ");return p("All arguments of 'concat' must be arrays: arguments "+r+" are not")}return d([].concat.apply([],e.args))},string_to_b58:function(e){return 1!==e.args.length?p("string_to_b58 accepts only one string argument"):d((0,c.encode)((new TextEncoder).encode(e.args[0])))},string_from_b58:function(e){return 1!==e.args.length?p("string_from_b58 accepts only one string argument"):d((new TextDecoder).decode((0,c.decode)(e.args[0])))},bytes_to_b58:function(e){if(1===e.args.length&&Array.isArray(e.args[0])){var t=e.args[0];return d((0,c.encode)(new Uint8Array(t)))}return p("bytes_to_b58 accepts only single argument: array of numbers")},bytes_from_b58:function(e){return 1!==e.args.length?p("bytes_from_b58 accepts only one string argument"):d(Array.from((0,c.decode)(e.args[0])))},sha256_string:function(e){return n(void 0,void 0,void 0,(function(){var t,r,n,s,a,f,l,y;return i(this,(function(i){switch(i.label){case 0:return e.args.length<1||e.args.length>3?[2,p("sha256_string accepts 1-3 arguments, found: "+e.args.length)]:[3,1];case 1:return t=o(e.args,3),r=t[0],n=t[1],s=t[2],a=h.default.from(r),[4,u.sha256.digest(a)];case 2:return f=i.sent(),l=n?f.digest:f.bytes,y=s?Array.from(l):(0,c.encode)(l),[2,d(y)]}}))}))},concat_strings:function(e){var t="".concat.apply("",s([],o(e.args),!1));return d(t)}},debug:{stringify:function(e){var t;return t=0===e.args.length?"":1===e.args.length?e.args[0]:e.args,d((0,l.jsonify)(t))}},math:{add:function(e){return y("math.add")},sub:function(e){return y("math.sub")},mul:function(e){return y("math.mul")},fmul:function(e){return y("math.fmul")},div:function(e){return y("math.div")},rem:function(e){return y("math.rem")},pow:function(e){return y("math.pow")},log:function(e){return y("math.log")}},cmp:{gt:function(e){return y("cmp.gt")},gte:function(e){return y("cmp.gte")},lt:function(e){return y("cmp.lt")},lte:function(e){return y("cmp.lte")},cmp:function(e){return y("cmp.cmp")}},array:{sum:function(e){return y("array.sum")},dedup:function(e){return y("array.dedup")},intersect:function(e){return y("array.intersect")},diff:function(e){return y("array.diff")},sdiff:function(e){return y("array.sdiff")}}}},33322:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.ResultCodes=void 0,(r=t.ResultCodes||(t.ResultCodes={}))[r.success=0]="success",r[r.error=1]="error"},29141:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},a=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},c=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.jsonify=t.dataToString=t.checkConnection=t.doNothing=t.handleTimeout=t.MakeServiceCall=void 0;var a=s(r(2043)),c=r(33322),u=r(36910),f=s(r(29786));t.MakeServiceCall=function(e){return function(t){return{retCode:c.ResultCodes.success,result:e(t.args)}}},t.handleTimeout=function(e){return function(t){"expired"===t.stage&&e()}},t.doNothing=function(e){},t.checkConnection=function(e,r){return n(void 0,void 0,void 0,(function(){var n,s,c;return i(this,(function(i){switch(i.label){case 0:if(!e.getStatus().isConnected)return[2,!1];n=Math.random().toString(36).substring(7),s=new Promise((function(i,s){var a=u.Particle.createNew('\n (xor\n (seq\n (call %init_peer_id% ("load" "relay") [] init_relay)\n (seq\n (call %init_peer_id% ("load" "msg") [] msg)\n (seq \n (call init_relay ("op" "identity") [msg] result)\n (call %init_peer_id% ("callback" "callback") [result])\n )\n )\n )\n (seq \n (call init_relay ("op" "identity") [])\n (call %init_peer_id% ("callback" "error") [%last_error%])\n )\n )',r);e.internals.regHandler.forParticle(a.id,"load","relay",(0,t.MakeServiceCall)((function(){return e.getStatus().relayPeerId}))),e.internals.regHandler.forParticle(a.id,"load","msg",(0,t.MakeServiceCall)((function(){return n}))),e.internals.regHandler.forParticle(a.id,"callback","callback",(0,t.MakeServiceCall)((function(e){var t=o(e,1)[0];return setTimeout((function(){i(t)}),0),{}}))),e.internals.regHandler.forParticle(a.id,"callback","error",(0,t.MakeServiceCall)((function(e){var t=o(e,1)[0];return setTimeout((function(){s(t)}),0),{}}))),e.internals.initiateParticle(a,(0,t.handleTimeout)((function(){s("particle timed out")})))})),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,s];case 2:return i.sent()!=n&&a.default.warn("unexpected behavior. 'identity' must return the passed arguments."),[2,!0];case 3:return c=i.sent(),a.default.error("Error on establishing connection: ",c),[2,!1];case 4:return[2]}}))}))},t.dataToString=function(e){var t=(new TextDecoder).decode(f.default.from(e));try{return JSON.stringify(JSON.parse(t),null,4)}catch(e){return t}},t.jsonify=function(e){return JSON.stringify(e,null,4)}},34537:e=>{"use strict";e.exports=function(e,t){for(var r=new Array(arguments.length-1),n=0,i=2,o=!0;i{"use strict";var r=t;r.length=function(e){var t=e.length;if(!t)return 0;for(var r=0;--t%4>1&&"="===e.charAt(t);)++r;return Math.ceil(3*e.length)/4-r};for(var n=new Array(64),i=new Array(123),o=0;o<64;)i[n[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;r.encode=function(e,t,r){for(var i,o=null,s=[],a=0,c=0;t>2],i=(3&u)<<4,c=1;break;case 1:s[a++]=n[i|u>>4],i=(15&u)<<2,c=2;break;case 2:s[a++]=n[i|u>>6],s[a++]=n[63&u],c=0}a>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,s)),a=0)}return c&&(s[a++]=n[i],s[a++]=61,1===c&&(s[a++]=61)),o?(a&&o.push(String.fromCharCode.apply(String,s.slice(0,a))),o.join("")):String.fromCharCode.apply(String,s.slice(0,a))};var s="invalid encoding";r.decode=function(e,t,r){for(var n,o=r,a=0,c=0;c1)break;if(void 0===(u=i[u]))throw Error(s);switch(a){case 0:n=u,a=1;break;case 1:t[r++]=n<<2|(48&u)>>4,n=u,a=2;break;case 2:t[r++]=(15&n)<<4|(60&u)>>2,n=u,a=3;break;case 3:t[r++]=(3&n)<<6|u,a=0}}if(1===a)throw Error(s);return r-o},r.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},19211:e=>{"use strict";function t(){this._listeners={}}e.exports=t,t.prototype.on=function(e,t,r){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:r||this}),this},t.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var r=this._listeners[e],n=0;n{"use strict";function t(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),r=new Uint8Array(t.buffer),n=128===r[3];function i(e,n,i){t[0]=e,n[i]=r[0],n[i+1]=r[1],n[i+2]=r[2],n[i+3]=r[3]}function o(e,n,i){t[0]=e,n[i]=r[3],n[i+1]=r[2],n[i+2]=r[1],n[i+3]=r[0]}function s(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],t[0]}function a(e,n){return r[3]=e[n],r[2]=e[n+1],r[1]=e[n+2],r[0]=e[n+3],t[0]}e.writeFloatLE=n?i:o,e.writeFloatBE=n?o:i,e.readFloatLE=n?s:a,e.readFloatBE=n?a:s}():function(){function t(e,t,r,n){var i=t<0?1:0;if(i&&(t=-t),0===t)e(1/t>0?0:2147483648,r,n);else if(isNaN(t))e(2143289344,r,n);else if(t>34028234663852886e22)e((i<<31|2139095040)>>>0,r,n);else if(t<11754943508222875e-54)e((i<<31|Math.round(t/1401298464324817e-60))>>>0,r,n);else{var o=Math.floor(Math.log(t)/Math.LN2);e((i<<31|o+127<<23|8388607&Math.round(t*Math.pow(2,-o)*8388608))>>>0,r,n)}}function s(e,t,r){var n=e(t,r),i=2*(n>>31)+1,o=n>>>23&255,s=8388607&n;return 255===o?s?NaN:i*(1/0):0===o?1401298464324817e-60*i*s:i*Math.pow(2,o-150)*(s+8388608)}e.writeFloatLE=t.bind(null,r),e.writeFloatBE=t.bind(null,n),e.readFloatLE=s.bind(null,i),e.readFloatBE=s.bind(null,o)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),r=new Uint8Array(t.buffer),n=128===r[7];function i(e,n,i){t[0]=e,n[i]=r[0],n[i+1]=r[1],n[i+2]=r[2],n[i+3]=r[3],n[i+4]=r[4],n[i+5]=r[5],n[i+6]=r[6],n[i+7]=r[7]}function o(e,n,i){t[0]=e,n[i]=r[7],n[i+1]=r[6],n[i+2]=r[5],n[i+3]=r[4],n[i+4]=r[3],n[i+5]=r[2],n[i+6]=r[1],n[i+7]=r[0]}function s(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],r[4]=e[n+4],r[5]=e[n+5],r[6]=e[n+6],r[7]=e[n+7],t[0]}function a(e,n){return r[7]=e[n],r[6]=e[n+1],r[5]=e[n+2],r[4]=e[n+3],r[3]=e[n+4],r[2]=e[n+5],r[1]=e[n+6],r[0]=e[n+7],t[0]}e.writeDoubleLE=n?i:o,e.writeDoubleBE=n?o:i,e.readDoubleLE=n?s:a,e.readDoubleBE=n?a:s}():function(){function t(e,t,r,n,i,o){var s=n<0?1:0;if(s&&(n=-n),0===n)e(0,i,o+t),e(1/n>0?0:2147483648,i,o+r);else if(isNaN(n))e(0,i,o+t),e(2146959360,i,o+r);else if(n>17976931348623157e292)e(0,i,o+t),e((s<<31|2146435072)>>>0,i,o+r);else{var a;if(n<22250738585072014e-324)e((a=n/5e-324)>>>0,i,o+t),e((s<<31|a/4294967296)>>>0,i,o+r);else{var c=Math.floor(Math.log(n)/Math.LN2);1024===c&&(c=1023),e(4503599627370496*(a=n*Math.pow(2,-c))>>>0,i,o+t),e((s<<31|c+1023<<20|1048576*a&1048575)>>>0,i,o+r)}}}function s(e,t,r,n,i){var o=e(n,i+t),s=e(n,i+r),a=2*(s>>31)+1,c=s>>>20&2047,u=4294967296*(1048575&s)+o;return 2047===c?u?NaN:a*(1/0):0===c?5e-324*a*u:a*Math.pow(2,c-1075)*(u+4503599627370496)}e.writeDoubleLE=t.bind(null,r,0,4),e.writeDoubleBE=t.bind(null,n,4,0),e.readDoubleLE=s.bind(null,i,0,4),e.readDoubleBE=s.bind(null,o,4,0)}(),e}function r(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}function n(e,t,r){t[r]=e>>>24,t[r+1]=e>>>16&255,t[r+2]=e>>>8&255,t[r+3]=255&e}function i(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function o(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}e.exports=t(t)},67199:module=>{"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}module.exports=inquire},76662:e=>{"use strict";e.exports=function(e,t,r){var n=r||8192,i=n>>>1,o=null,s=n;return function(r){if(r<1||r>i)return e(r);s+r>n&&(o=e(n),s=0);var a=t.call(o,s,s+=r);return 7&s&&(s=1+(7|s)),a}}},94997:(e,t)=>{"use strict";var r=t;r.length=function(e){for(var t=0,r=0,n=0;n191&&n<224?o[s++]=(31&n)<<6|63&e[t++]:n>239&&n<365?(n=((7&n)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,o[s++]=55296+(n>>10),o[s++]=56320+(1023&n)):o[s++]=(15&n)<<12|(63&e[t++])<<6|63&e[t++],s>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,o)),s=0);return i?(s&&i.push(String.fromCharCode.apply(String,o.slice(0,s))),i.join("")):String.fromCharCode.apply(String,o.slice(0,s))},r.write=function(e,t,r){for(var n,i,o=r,s=0;s>6|192,t[r++]=63&n|128):55296==(64512&n)&&56320==(64512&(i=e.charCodeAt(s+1)))?(n=65536+((1023&n)<<10)+(1023&i),++s,t[r++]=n>>18|240,t[r++]=n>>12&63|128,t[r++]=n>>6&63|128,t[r++]=63&n|128):(t[r++]=n>>12|224,t[r++]=n>>6&63|128,t[r++]=63&n|128);return r-o}},98099:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(97117);function i(e,t,r){return void 0===t&&(t=new Uint8Array(2)),void 0===r&&(r=0),t[r+0]=e>>>8,t[r+1]=e>>>0,t}function o(e,t,r){return void 0===t&&(t=new Uint8Array(2)),void 0===r&&(r=0),t[r+0]=e>>>0,t[r+1]=e>>>8,t}function s(e,t){return void 0===t&&(t=0),e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function a(e,t){return void 0===t&&(t=0),(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function c(e,t){return void 0===t&&(t=0),e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]}function u(e,t){return void 0===t&&(t=0),(e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t])>>>0}function f(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),t[r+0]=e>>>24,t[r+1]=e>>>16,t[r+2]=e>>>8,t[r+3]=e>>>0,t}function l(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),t[r+0]=e>>>0,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24,t}function h(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),f(e/4294967296>>>0,t,r),f(e>>>0,t,r+4),t}function d(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),l(e>>>0,t,r),l(e/4294967296>>>0,t,r+4),t}t.readInt16BE=function(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])<<16>>16},t.readUint16BE=function(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])>>>0},t.readInt16LE=function(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])<<16>>16},t.readUint16LE=function(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])>>>0},t.writeUint16BE=i,t.writeInt16BE=i,t.writeUint16LE=o,t.writeInt16LE=o,t.readInt32BE=s,t.readUint32BE=a,t.readInt32LE=c,t.readUint32LE=u,t.writeUint32BE=f,t.writeInt32BE=f,t.writeUint32LE=l,t.writeInt32LE=l,t.readInt64BE=function(e,t){void 0===t&&(t=0);var r=s(e,t),n=s(e,t+4);return 4294967296*r+n-4294967296*(n>>31)},t.readUint64BE=function(e,t){return void 0===t&&(t=0),4294967296*a(e,t)+a(e,t+4)},t.readInt64LE=function(e,t){void 0===t&&(t=0);var r=c(e,t);return 4294967296*c(e,t+4)+r-4294967296*(r>>31)},t.readUint64LE=function(e,t){void 0===t&&(t=0);var r=u(e,t);return 4294967296*u(e,t+4)+r},t.writeUint64BE=h,t.writeInt64BE=h,t.writeUint64LE=d,t.writeInt64LE=d,t.readUintBE=function(e,t,r){if(void 0===r&&(r=0),e%8!=0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(e/8>t.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,o=e/8+r-1;o>=r;o--)n+=t[o]*i,i*=256;return n},t.readUintLE=function(e,t,r){if(void 0===r&&(r=0),e%8!=0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(e/8>t.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,o=r;o=i;s--)r[s]=t/o&255,o*=256;return r},t.writeUintLE=function(e,t,r,i){if(void 0===r&&(r=new Uint8Array(e/8)),void 0===i&&(i=0),e%8!=0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!n.isSafeInteger(t))throw new Error("writeUintLE value must be an integer");for(var o=1,s=i;s{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(98099),i=r(17309);function o(e,t,r){for(var i=1634760805,o=857760878,s=2036477234,a=1797285236,c=r[3]<<24|r[2]<<16|r[1]<<8|r[0],u=r[7]<<24|r[6]<<16|r[5]<<8|r[4],f=r[11]<<24|r[10]<<16|r[9]<<8|r[8],l=r[15]<<24|r[14]<<16|r[13]<<8|r[12],h=r[19]<<24|r[18]<<16|r[17]<<8|r[16],d=r[23]<<24|r[22]<<16|r[21]<<8|r[20],p=r[27]<<24|r[26]<<16|r[25]<<8|r[24],y=r[31]<<24|r[30]<<16|r[29]<<8|r[28],g=t[3]<<24|t[2]<<16|t[1]<<8|t[0],b=t[7]<<24|t[6]<<16|t[5]<<8|t[4],m=t[11]<<24|t[10]<<16|t[9]<<8|t[8],v=t[15]<<24|t[14]<<16|t[13]<<8|t[12],w=i,E=o,_=s,S=a,A=c,T=u,I=f,C=l,P=h,R=d,k=p,B=y,x=g,M=b,O=m,N=v,L=0;L<20;L+=2)A=(A^=P=P+(x=(x^=w=w+A|0)>>>16|x<<16)|0)>>>20|A<<12,T=(T^=R=R+(M=(M^=E=E+T|0)>>>16|M<<16)|0)>>>20|T<<12,I=(I^=k=k+(O=(O^=_=_+I|0)>>>16|O<<16)|0)>>>20|I<<12,C=(C^=B=B+(N=(N^=S=S+C|0)>>>16|N<<16)|0)>>>20|C<<12,I=(I^=k=k+(O=(O^=_=_+I|0)>>>24|O<<8)|0)>>>25|I<<7,C=(C^=B=B+(N=(N^=S=S+C|0)>>>24|N<<8)|0)>>>25|C<<7,T=(T^=R=R+(M=(M^=E=E+T|0)>>>24|M<<8)|0)>>>25|T<<7,A=(A^=P=P+(x=(x^=w=w+A|0)>>>24|x<<8)|0)>>>25|A<<7,T=(T^=k=k+(N=(N^=w=w+T|0)>>>16|N<<16)|0)>>>20|T<<12,I=(I^=B=B+(x=(x^=E=E+I|0)>>>16|x<<16)|0)>>>20|I<<12,C=(C^=P=P+(M=(M^=_=_+C|0)>>>16|M<<16)|0)>>>20|C<<12,A=(A^=R=R+(O=(O^=S=S+A|0)>>>16|O<<16)|0)>>>20|A<<12,C=(C^=P=P+(M=(M^=_=_+C|0)>>>24|M<<8)|0)>>>25|C<<7,A=(A^=R=R+(O=(O^=S=S+A|0)>>>24|O<<8)|0)>>>25|A<<7,I=(I^=B=B+(x=(x^=E=E+I|0)>>>24|x<<8)|0)>>>25|I<<7,T=(T^=k=k+(N=(N^=w=w+T|0)>>>24|N<<8)|0)>>>25|T<<7;n.writeUint32LE(w+i|0,e,0),n.writeUint32LE(E+o|0,e,4),n.writeUint32LE(_+s|0,e,8),n.writeUint32LE(S+a|0,e,12),n.writeUint32LE(A+c|0,e,16),n.writeUint32LE(T+u|0,e,20),n.writeUint32LE(I+f|0,e,24),n.writeUint32LE(C+l|0,e,28),n.writeUint32LE(P+h|0,e,32),n.writeUint32LE(R+d|0,e,36),n.writeUint32LE(k+p|0,e,40),n.writeUint32LE(B+y|0,e,44),n.writeUint32LE(x+g|0,e,48),n.writeUint32LE(M+b|0,e,52),n.writeUint32LE(O+m|0,e,56),n.writeUint32LE(N+v|0,e,60)}function s(e,t,r,n,s){if(void 0===s&&(s=0),32!==e.length)throw new Error("ChaCha: key size must be 32 bytes");if(n.length>>=8,t++;if(n>0)throw new Error("ChaCha: counter overflow")}t.streamXOR=s,t.stream=function(e,t,r,n){return void 0===n&&(n=0),i.wipe(r),s(e,t,r,r,n)}},15501:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(25439),i=r(63027),o=r(17309),s=r(98099),a=r(4153);t.KEY_LENGTH=32,t.NONCE_LENGTH=12,t.TAG_LENGTH=16;var c=new Uint8Array(16),u=function(){function e(e){if(this.nonceLength=t.NONCE_LENGTH,this.tagLength=t.TAG_LENGTH,e.length!==t.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(e)}return e.prototype.seal=function(e,t,r,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var s=new Uint8Array(16);s.set(e,s.length-e.length);var a=new Uint8Array(32);n.stream(this._key,s,a,4);var c,u=t.length+this.tagLength;if(i){if(i.length!==u)throw new Error("ChaCha20Poly1305: incorrect destination length");c=i}else c=new Uint8Array(u);return n.streamXOR(this._key,s,t,c,4),this._authenticate(c.subarray(c.length-this.tagLength,c.length),a,c.subarray(0,c.length-this.tagLength),r),o.wipe(s),c},e.prototype.open=function(e,t,r,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(t.length0&&a.update(c.subarray(n.length%16))),a.update(r),r.length%16>0&&a.update(c.subarray(r.length%16));var u=new Uint8Array(8);n&&s.writeUint64LE(n.length,u),a.update(u),s.writeUint64LE(r.length,u),a.update(u);for(var f=a.digest(),l=0;l{"use strict";function r(e,t){if(e.length!==t.length)return 0;for(var r=0,n=0;n>>8}Object.defineProperty(t,"__esModule",{value:!0}),t.select=function(e,t,r){return~(e-1)&t|e-1&r},t.lessOrEqual=function(e,t){return(0|e)-(0|t)-1>>>31&1},t.compare=r,t.equal=function(e,t){return 0!==e.length&&0!==t.length&&0!==r(e,t)}},79984:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isSerializableHash=function(e){return void 0!==e.saveState&&void 0!==e.restoreState&&void 0!==e.cleanSavedState}},512:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(25629),i=r(17309),o=function(){function e(e,t,r,i){void 0===r&&(r=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=i;var o=n.hmac(this._hash,r,t);this._hmac=new n.HMAC(e,o),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return e.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(0===e)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},e.prototype.expand=function(e){for(var t=new Uint8Array(e),r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(79984),i=r(4153),o=r(17309),s=function(){function e(e,t){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var r=new Uint8Array(this.blockSize);t.length>this.blockSize?this._inner.update(t).finish(r).clean():r.set(t);for(var i=0;i{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mul=Math.imul||function(e,t){var r=65535&e,n=65535&t;return r*n+((e>>>16&65535)*n+r*(t>>>16&65535)<<16>>>0)|0},t.add=function(e,t){return e+t|0},t.sub=function(e,t){return e-t|0},t.rotl=function(e,t){return e<>>32-t},t.rotr=function(e,t){return e<<32-t|e>>>t},t.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(e){return t.isInteger(e)&&e>=-t.MAX_SAFE_INTEGER&&e<=t.MAX_SAFE_INTEGER}},63027:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(4153),i=r(17309);t.DIGEST_LENGTH=16;var o=function(){function e(e){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var r=e[0]|e[1]<<8;this._r[0]=8191&r;var n=e[2]|e[3]<<8;this._r[1]=8191&(r>>>13|n<<3);var i=e[4]|e[5]<<8;this._r[2]=7939&(n>>>10|i<<6);var o=e[6]|e[7]<<8;this._r[3]=8191&(i>>>7|o<<9);var s=e[8]|e[9]<<8;this._r[4]=255&(o>>>4|s<<12),this._r[5]=s>>>1&8190;var a=e[10]|e[11]<<8;this._r[6]=8191&(s>>>14|a<<2);var c=e[12]|e[13]<<8;this._r[7]=8065&(a>>>11|c<<5);var u=e[14]|e[15]<<8;this._r[8]=8191&(c>>>8|u<<8),this._r[9]=u>>>5&127,this._pad[0]=e[16]|e[17]<<8,this._pad[1]=e[18]|e[19]<<8,this._pad[2]=e[20]|e[21]<<8,this._pad[3]=e[22]|e[23]<<8,this._pad[4]=e[24]|e[25]<<8,this._pad[5]=e[26]|e[27]<<8,this._pad[6]=e[28]|e[29]<<8,this._pad[7]=e[30]|e[31]<<8}return e.prototype._blocks=function(e,t,r){for(var n=this._fin?0:2048,i=this._h[0],o=this._h[1],s=this._h[2],a=this._h[3],c=this._h[4],u=this._h[5],f=this._h[6],l=this._h[7],h=this._h[8],d=this._h[9],p=this._r[0],y=this._r[1],g=this._r[2],b=this._r[3],m=this._r[4],v=this._r[5],w=this._r[6],E=this._r[7],_=this._r[8],S=this._r[9];r>=16;){var A=e[t+0]|e[t+1]<<8;i+=8191&A;var T=e[t+2]|e[t+3]<<8;o+=8191&(A>>>13|T<<3);var I=e[t+4]|e[t+5]<<8;s+=8191&(T>>>10|I<<6);var C=e[t+6]|e[t+7]<<8;a+=8191&(I>>>7|C<<9);var P=e[t+8]|e[t+9]<<8;c+=8191&(C>>>4|P<<12),u+=P>>>1&8191;var R=e[t+10]|e[t+11]<<8;f+=8191&(P>>>14|R<<2);var k=e[t+12]|e[t+13]<<8;l+=8191&(R>>>11|k<<5);var B=e[t+14]|e[t+15]<<8,x=0,M=x;M+=i*p,M+=o*(5*S),M+=s*(5*_),M+=a*(5*E),x=(M+=c*(5*w))>>>13,M&=8191,M+=u*(5*v),M+=f*(5*m),M+=l*(5*b),M+=(h+=8191&(k>>>8|B<<8))*(5*g);var O=x+=(M+=(d+=B>>>5|n)*(5*y))>>>13;O+=i*y,O+=o*p,O+=s*(5*S),O+=a*(5*_),x=(O+=c*(5*E))>>>13,O&=8191,O+=u*(5*w),O+=f*(5*v),O+=l*(5*m),O+=h*(5*b),x+=(O+=d*(5*g))>>>13,O&=8191;var N=x;N+=i*g,N+=o*y,N+=s*p,N+=a*(5*S),x=(N+=c*(5*_))>>>13,N&=8191,N+=u*(5*E),N+=f*(5*w),N+=l*(5*v),N+=h*(5*m);var L=x+=(N+=d*(5*b))>>>13;L+=i*b,L+=o*g,L+=s*y,L+=a*p,x=(L+=c*(5*S))>>>13,L&=8191,L+=u*(5*_),L+=f*(5*E),L+=l*(5*w),L+=h*(5*v);var D=x+=(L+=d*(5*m))>>>13;D+=i*m,D+=o*b,D+=s*g,D+=a*y,x=(D+=c*p)>>>13,D&=8191,D+=u*(5*S),D+=f*(5*_),D+=l*(5*E),D+=h*(5*w);var K=x+=(D+=d*(5*v))>>>13;K+=i*v,K+=o*m,K+=s*b,K+=a*g,x=(K+=c*y)>>>13,K&=8191,K+=u*p,K+=f*(5*S),K+=l*(5*_),K+=h*(5*E);var U=x+=(K+=d*(5*w))>>>13;U+=i*w,U+=o*v,U+=s*m,U+=a*b,x=(U+=c*g)>>>13,U&=8191,U+=u*y,U+=f*p,U+=l*(5*S),U+=h*(5*_);var j=x+=(U+=d*(5*E))>>>13;j+=i*E,j+=o*w,j+=s*v,j+=a*m,x=(j+=c*b)>>>13,j&=8191,j+=u*g,j+=f*y,j+=l*p,j+=h*(5*S);var V=x+=(j+=d*(5*_))>>>13;V+=i*_,V+=o*E,V+=s*w,V+=a*v,x=(V+=c*m)>>>13,V&=8191,V+=u*b,V+=f*g,V+=l*y,V+=h*p;var F=x+=(V+=d*(5*S))>>>13;F+=i*S,F+=o*_,F+=s*E,F+=a*w,x=(F+=c*v)>>>13,F&=8191,F+=u*m,F+=f*b,F+=l*g,F+=h*y,i=M=8191&(x=(x=((x+=(F+=d*p)>>>13)<<2)+x|0)+(M&=8191)|0),o=O+=x>>>=13,s=N&=8191,a=L&=8191,c=D&=8191,u=K&=8191,f=U&=8191,l=j&=8191,h=V&=8191,d=F&=8191,t+=16,r-=16}this._h[0]=i,this._h[1]=o,this._h[2]=s,this._h[3]=a,this._h[4]=c,this._h[5]=u,this._h[6]=f,this._h[7]=l,this._h[8]=h,this._h[9]=d},e.prototype.finish=function(e,t){void 0===t&&(t=0);var r,n,i,o,s=new Uint16Array(10);if(this._leftover){for(o=this._leftover,this._buffer[o++]=1;o<16;o++)this._buffer[o]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(r=this._h[1]>>>13,this._h[1]&=8191,o=2;o<10;o++)this._h[o]+=r,r=this._h[o]>>>13,this._h[o]&=8191;for(this._h[0]+=5*r,r=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=r,r=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=r,s[0]=this._h[0]+5,r=s[0]>>>13,s[0]&=8191,o=1;o<10;o++)s[o]=this._h[o]+r,r=s[o]>>>13,s[o]&=8191;for(s[9]-=8192,n=(1^r)-1,o=0;o<10;o++)s[o]&=n;for(n=~n,o=0;o<10;o++)this._h[o]=this._h[o]&n|s[o];for(this._h[0]=65535&(this._h[0]|this._h[1]<<13),this._h[1]=65535&(this._h[1]>>>3|this._h[2]<<10),this._h[2]=65535&(this._h[2]>>>6|this._h[3]<<7),this._h[3]=65535&(this._h[3]>>>9|this._h[4]<<4),this._h[4]=65535&(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14),this._h[5]=65535&(this._h[6]>>>2|this._h[7]<<11),this._h[6]=65535&(this._h[7]>>>5|this._h[8]<<8),this._h[7]=65535&(this._h[8]>>>8|this._h[9]<<5),i=this._h[0]+this._pad[0],this._h[0]=65535&i,o=1;o<8;o++)i=(this._h[o]+this._pad[o]|0)+(i>>>16)|0,this._h[o]=65535&i;return e[t+0]=this._h[0]>>>0,e[t+1]=this._h[0]>>>8,e[t+2]=this._h[1]>>>0,e[t+3]=this._h[1]>>>8,e[t+4]=this._h[2]>>>0,e[t+5]=this._h[2]>>>8,e[t+6]=this._h[3]>>>0,e[t+7]=this._h[3]>>>8,e[t+8]=this._h[4]>>>0,e[t+9]=this._h[4]>>>8,e[t+10]=this._h[5]>>>0,e[t+11]=this._h[5]>>>8,e[t+12]=this._h[6]>>>0,e[t+13]=this._h[6]>>>8,e[t+14]=this._h[7]>>>0,e[t+15]=this._h[7]>>>8,this._finished=!0,this},e.prototype.update=function(e){var t,r=0,n=e.length;if(this._leftover){(t=16-this._leftover)>n&&(t=n);for(var i=0;i=16&&(t=n-n%16,this._blocks(e,r,t),r+=t,n-=t),n){for(i=0;i{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(46008),i=r(98099),o=r(17309);function s(e,r){return void 0===r&&(r=t.defaultRandomSource),r.randomBytes(e)}t.defaultRandomSource=new n.SystemRandomSource,t.randomBytes=s,t.randomUint32=function(e){void 0===e&&(e=t.defaultRandomSource);var r=s(4,e),n=i.readUint32LE(r);return o.wipe(r),n};var a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function c(e,r,n){if(void 0===r&&(r=a),void 0===n&&(n=t.defaultRandomSource),r.length<2)throw new Error("randomString charset is too short");if(r.length>256)throw new Error("randomString charset is too long");for(var i="",c=r.length,u=256-256%c;e>0;){for(var f=s(Math.ceil(256*e/u),n),l=0;l0;l++){var h=f[l];h{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){this.isAvailable=!1,this.isInstantiated=!1;var e="undefined"!=typeof self?self.crypto||self.msCrypto:null;e&&e.getRandomValues&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}return e.prototype.randomBytes=function(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");for(var t=new Uint8Array(e),r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(17309),i=function(){function e(){this.isAvailable=!1,this.isInstantiated=!1;var e=r(35883);e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}return e.prototype.randomBytes=function(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");var t=this._crypto.randomBytes(e);if(t.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");for(var r=new Uint8Array(e),i=0;i{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(75455),i=r(58871),o=function(){function e(){return this.isAvailable=!1,this.name="",this._source=new n.BrowserRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Browser")):(this._source=new i.NodeRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Node")):void 0)}return e.prototype.randomBytes=function(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)},e}();t.SystemRandomSource=o},73294:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(98099),i=r(17309);t.DIGEST_LENGTH=32,t.BLOCK_SIZE=64;var o=function(){function e(){this.digestLength=t.DIGEST_LENGTH,this.blockSize=t.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return e.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},e.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},e.prototype.clean=function(){i.wipe(this._buffer),i.wipe(this._temp),this.reset()},e.prototype.update=function(e,t){if(void 0===t&&(t=e.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var r=0;if(this._bytesHashed+=t,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[r++],t--;this._bufferLength===this.blockSize&&(a(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(t>=this.blockSize&&(r=a(this._temp,this._state,e,r,t),t%=this.blockSize);t>0;)this._buffer[this._bufferLength++]=e[r++],t--;return this},e.prototype.finish=function(e){if(!this._finished){var t=this._bytesHashed,r=this._bufferLength,i=t/536870912|0,o=t<<3,s=t%64<56?64:128;this._buffer[r]=128;for(var c=r+1;c0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},e.prototype.restoreState=function(e){return this._state.set(e.state),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},e.prototype.cleanSavedState=function(e){i.wipe(e.state),e.buffer&&i.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},e}();t.SHA256=o;var s=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function a(e,t,r,i,o){for(;o>=64;){for(var a=t[0],c=t[1],u=t[2],f=t[3],l=t[4],h=t[5],d=t[6],p=t[7],y=0;y<16;y++){var g=i+4*y;e[y]=n.readUint32BE(r,g)}for(y=16;y<64;y++){var b=e[y-2],m=(b>>>17|b<<15)^(b>>>19|b<<13)^b>>>10,v=((b=e[y-15])>>>7|b<<25)^(b>>>18|b<<14)^b>>>3;e[y]=(m+e[y-7]|0)+(v+e[y-16]|0)}for(y=0;y<64;y++)m=(((l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7))+(l&h^~l&d)|0)+(p+(s[y]+e[y]|0)|0)|0,v=((a>>>2|a<<30)^(a>>>13|a<<19)^(a>>>22|a<<10))+(a&c^a&u^c&u)|0,p=d,d=h,h=l,l=f+m|0,f=u,u=c,c=a,a=m+v|0;t[0]+=a,t[1]+=c,t[2]+=u,t[3]+=f,t[4]+=l,t[5]+=h,t[6]+=d,t[7]+=p,i+=64,o-=64}return i}t.hash=function(e){var t=new o;t.update(e);var r=t.digest();return t.clean(),r}},17309:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.wipe=function(e){for(var t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(31416),i=r(17309);function o(e){var t=new Float64Array(16);if(e)for(var r=0;r=0;--m){var v=r[m>>>3]>>>(7&m)&1;u(i,s,v),u(p,y,v),f(g,i,p),l(i,i,p),f(p,s,y),l(s,s,y),d(y,g),d(b,i),h(i,p,i),h(p,s,g),f(g,i,p),l(i,i,p),d(s,i),l(p,y,b),h(i,p,a),f(i,i,y),h(p,p,i),h(i,y,b),h(y,s,n),d(s,g),u(i,s,v),u(p,y,v)}for(m=0;m<16;m++)n[m+16]=i[m],n[m+32]=p[m],n[m+48]=s[m],n[m+64]=y[m];var w=n.subarray(32),E=n.subarray(16);!function(e,t){for(var r=o(),n=0;n<16;n++)r[n]=t[n];for(n=253;n>=0;n--)d(r,r),2!==n&&4!==n&&h(r,r,t);for(n=0;n<16;n++)e[n]=r[n]}(w,w),h(E,E,w);var _=new Uint8Array(32);return function(e,t){for(var r=o(),n=o(),i=0;i<16;i++)n[i]=t[i];c(n),c(n),c(n);for(var s=0;s<2;s++){for(r[0]=n[0]-65517,i=1;i<15;i++)r[i]=n[i]-65535-(r[i-1]>>16&1),r[i-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);var a=r[15]>>16&1;r[14]&=65535,u(n,r,1-a)}for(i=0;i<16;i++)e[2*i]=255&n[i],e[2*i+1]=n[i]>>8}(_,E),_}function y(e){return p(e,s)}function g(e){if(e.length!==t.SECRET_KEY_LENGTH)throw new Error("x25519: seed must be "+t.SECRET_KEY_LENGTH+" bytes");var r=new Uint8Array(e);return{publicKey:y(r),secretKey:r}}t.scalarMult=p,t.scalarMultBase=y,t.generateKeyPairFromSeed=g,t.generateKeyPair=function(e){var t=n.randomBytes(32,e),r=g(t);return i.wipe(t),r},t.sharedKey=function(e,r,n){if(void 0===n&&(n=!1),e.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(r.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");var i=p(e,r);if(n){for(var o=0,s=0;s{"use strict";const r=Math.exp;e.exports=function(e){if("number"!=typeof e)throw new Error("must provide a timespan to the moving average constructor");if(e<=0)throw new Error("must provide a timespan > 0 to the moving average constructor");let t,n,i=0,o=0,s=0,a={push:function(a,c){if(n){const u=1-r(-(a-n)/e),f=c-t;t=u*c+(1-u)*t,i=(1-u)*(i+f*(u*f)),o=Math.sqrt(i),s=t+u*f}else t=c;n=a},movingAverage:function(){return t},variance:function(){return i},deviation:function(){return o},forecast:function(){return s}};return a}},28599:e=>{"use strict";const{AbortController:t,AbortSignal:r}="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0;e.exports=t,e.exports.AbortSignal=r,e.exports.default=t},42235:e=>{e.exports=class extends Error{constructor(e,t){super(e||"The operation was aborted"),this.type="aborted",this.code=t||"ABORT_ERR"}}},61623:(e,t,r)=>{const n=r(22412),i=r(42235),o=(e,t,r)=>s(e,Array.isArray(t)?t:[{signal:t,options:r}]),s=(e,t)=>(e=n(e),t=t.map((({signal:e,options:t})=>({signal:e,options:t||{}}))),async function*(){let r;const n=()=>{r&&r()};for(const{signal:e}of t)e.addEventListener("abort",n);for(;;){let o;try{for(const{signal:e,options:r}of t)if(e.aborted){const{abortMessage:e,abortCode:t}=r;throw new i(e,t)}const n=new Promise(((e,n)=>{r=()=>{const{options:e}=t.find((({signal:e})=>e.aborted)),{abortMessage:r,abortCode:o}=e;n(new i(r,o))}}));o=await Promise.race([n,e.next()]),r=null}catch(r){for(const{signal:e}of t)e.removeEventListener("abort",n);const i=t.find((({signal:e})=>e.aborted)),o="aborted"===r.type&&i;if(o&&i.options.onAbort&&await i.options.onAbort(e),"function"==typeof e.return)try{const t=e.return();t instanceof Promise&&t.catch((e=>{null!=i.options.onReturnError&&i.options.onReturnError(e)}))}catch(e){null!=i.options.onReturnError&&i.options.onReturnError(e)}if(o&&i.options.returnOnAbort)return;throw r}if(o.done)break;yield o.value}for(const{signal:e}of t)e.removeEventListener("abort",n)}()),a=(e,t,r)=>c(e,Array.isArray(t)?t:[{signal:t,options:r}]),c=(e,t)=>r=>e(s(r,t));e.exports=o,e.exports.AbortError=i,e.exports.source=o,e.exports.sink=a,e.exports.transform=a,e.exports.duplex=(e,t,r)=>((e,t)=>({sink:c(e.sink,t),source:s(e.source,t)}))(e,Array.isArray(t)?t:[{signal:t,options:r}])},56455:(e,t,r)=>{"use strict";const n=r(95602),i=r(75281);class o extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError("Expected input to be an Array, got "+typeof e);let t=(e=[...e].map((e=>e instanceof Error?e:null!==e&&"object"==typeof e?Object.assign(new Error(e.message),e):new Error(e)))).map((e=>"string"==typeof e.stack?i(e.stack).replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g,""):String(e))).join("\n");t="\n"+n(t,4),super(t),this.name="AggregateError",Object.defineProperty(this,"_errors",{value:e})}*[Symbol.iterator](){for(const e of this._errors)yield e}}e.exports=o},32044:(e,t,r)=>{const{AbortController:n}=r(35353);function i(e){const t=new n;function r(){t.abort();for(const t of e)t&&t.removeEventListener&&t.removeEventListener("abort",r)}for(const t of e)if(t&&t.addEventListener){if(t.aborted){r();break}t.addEventListener("abort",r)}return t.signal}e.exports=i,e.exports.anySignal=i},58162:(e,t,r)=>{"use strict";var n=r(89509).Buffer;e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r>>0,f=new Uint8Array(s);e[r];){var l=t[e.charCodeAt(r)];if(255===l)return;for(var h=0,d=s-1;(0!==l||h>>0,f[d]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");o=h,r++}for(var p=s-o;p!==s&&0===f[p];)p++;var y=n.allocUnsafe(i+(s-p));y.fill(0,0,i);for(var g=i;p!==s;)y[g++]=f[p++];return y}return{encode:function(t){if((Array.isArray(t)||t instanceof Uint8Array)&&(t=n.from(t)),!n.isBuffer(t))throw new TypeError("Expected Buffer");if(0===t.length)return"";for(var r=0,i=0,o=0,s=t.length;o!==s&&0===t[o];)o++,r++;for(var u=(s-o)*f+1>>>0,l=new Uint8Array(u);o!==s;){for(var h=t[o],d=0,p=u-1;(0!==h||d>>0,l[p]=h%a>>>0,h=h/a>>>0;if(0!==h)throw new Error("Non-zero carry");i=d,o++}for(var y=u-i;y!==u&&0===l[y];)y++;for(var g=c.repeat(r);y{"use strict";t.byteLength=function(e){var t=c(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,o=c(e),s=o[0],a=o[1],u=new i(function(e,t,r){return 3*(t+r)/4-r}(0,s,a)),f=0,l=a>0?s-4:s;for(r=0;r>16&255,u[f++]=t>>8&255,u[f++]=255&t;return 2===a&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[f++]=255&t),1===a&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[f++]=t>>8&255,u[f++]=255&t),u},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],s=16383,a=0,c=n-i;ac?c:a+s));return 1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),o.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,a=o.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function u(e,t,n){for(var i,o,s=[],a=t;a>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},44431:function(e,t,r){var n;!function(i){"use strict";var o,s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,c=Math.floor,u="[BigNumber Error] ",f=u+"Number primitive has more than 15 significant digits: ",l=1e14,h=14,d=9007199254740991,p=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],y=1e7,g=1e9;function b(e){var t=0|e;return e>0||e===t?t:t-1}function m(e){for(var t,r,n=1,i=e.length,o=e[0]+"";nu^r?1:-1;for(a=(c=i.length)<(u=o.length)?c:u,s=0;so[s]^r?1:-1;return c==u?0:c>u^r?1:-1}function w(e,t,r,n){if(er||e!==c(e))throw Error(u+(n||"Argument")+("number"==typeof e?er?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function E(e){var t=e.c.length-1;return b(e.e/h)==t&&e.c[t]%2!=0}function _(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function S(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(++t>(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else tD?b.c=b.e=null:e.e=10;l/=10,u++);return void(u>D?b.c=b.e=null:(b.e=u,b.c=[e]))}g=String(e)}else{if(!s.test(g=String(e)))return i(b,g,p);b.s=45==g.charCodeAt(0)?(g=g.slice(1),-1):1}(u=g.indexOf("."))>-1&&(g=g.replace(".","")),(l=g.search(/e/i))>0?(u<0&&(u=l),u+=+g.slice(l+1),g=g.substring(0,l)):u<0&&(u=g.length)}else{if(w(t,2,F.length,"Base"),10==t&&q)return W(b=new H(e),x+b.e+1,M);if(g=String(e),p="number"==typeof e){if(0*e!=0)return i(b,g,p,t);if(b.s=1/e<0?(g=g.slice(1),-1):1,H.DEBUG&&g.replace(/^0\.0*|\./,"").length>15)throw Error(f+e)}else b.s=45===g.charCodeAt(0)?(g=g.slice(1),-1):1;for(r=F.slice(0,t),u=l=0,y=g.length;lu){u=y;continue}}else if(!a&&(g==g.toUpperCase()&&(g=g.toLowerCase())||g==g.toLowerCase()&&(g=g.toUpperCase()))){a=!0,l=-1,u=0;continue}return i(b,String(e),p,t)}p=!1,(u=(g=n(g,t,10,b.s)).indexOf("."))>-1?g=g.replace(".",""):u=g.length}for(l=0;48===g.charCodeAt(l);l++);for(y=g.length;48===g.charCodeAt(--y););if(g=g.slice(l,++y)){if(y-=l,p&&H.DEBUG&&y>15&&(e>d||e!==c(e)))throw Error(f+b.s*e);if((u=u-l-1)>D)b.c=b.e=null;else if(u=N)?_(c,s):S(c,s,"0");else if(o=(e=W(new H(e),t,r)).e,a=(c=m(e.c)).length,1==n||2==n&&(t<=o||o<=O)){for(;aa){if(--t>0)for(c+=".";t--;c+="0");}else if((t+=o-a)>0)for(o+1==a&&(c+=".");t--;c+="0");return e.s<0&&i?"-"+c:c}function $(e,t){for(var r,n=1,i=new H(e[0]);n=10;i/=10,n++);return(r=n+r*h-1)>D?e.c=e.e=null:r=10;u/=10,i++);if((o=t-i)<0)o+=h,s=t,y=(f=g[d=0])/b[i-s-1]%10|0;else if((d=a((o+1)/h))>=g.length){if(!n)break e;for(;g.length<=d;g.push(0));f=y=0,i=1,s=(o%=h)-h+1}else{for(f=u=g[d],i=1;u>=10;u/=10,i++);y=(s=(o%=h)-h+i)<0?0:f/b[i-s-1]%10|0}if(n=n||t<0||null!=g[d+1]||(s<0?f:f%b[i-s-1]),n=r<4?(y||n)&&(0==r||r==(e.s<0?3:2)):y>5||5==y&&(4==r||n||6==r&&(o>0?s>0?f/b[i-s]:0:g[d-1])%10&1||r==(e.s<0?8:7)),t<1||!g[0])return g.length=0,n?(t-=e.e+1,g[0]=b[(h-t%h)%h],e.e=-t||0):g[0]=e.e=0,e;if(0==o?(g.length=d,u=1,d--):(g.length=d+1,u=b[h-o],g[d]=s>0?c(f/b[i-s]%b[s])*u:0),n)for(;;){if(0==d){for(o=1,s=g[0];s>=10;s/=10,o++);for(s=g[0]+=u,u=1;s>=10;s/=10,u++);o!=u&&(e.e++,g[0]==l&&(g[0]=1));break}if(g[d]+=u,g[d]!=l)break;g[d--]=0,u=1}for(o=g.length;0===g[--o];g.pop());}e.e>D?e.c=e.e=null:e.e=N?_(t,r):S(t,r,"0"),e.s<0?"-"+t:t)}return H.clone=e,H.ROUND_UP=0,H.ROUND_DOWN=1,H.ROUND_CEIL=2,H.ROUND_FLOOR=3,H.ROUND_HALF_UP=4,H.ROUND_HALF_DOWN=5,H.ROUND_HALF_EVEN=6,H.ROUND_HALF_CEIL=7,H.ROUND_HALF_FLOOR=8,H.EUCLID=9,H.config=H.set=function(e){var t,r;if(null!=e){if("object"!=typeof e)throw Error(u+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(w(r=e[t],0,g,t),x=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(w(r=e[t],0,8,t),M=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(w(r[0],-g,0,t),w(r[1],0,g,t),O=r[0],N=r[1]):(w(r,-g,g,t),O=-(N=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)w(r[0],-g,-1,t),w(r[1],1,g,t),L=r[0],D=r[1];else{if(w(r,-g,g,t),!r)throw Error(u+t+" cannot be zero: "+r);L=-(D=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(u+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw K=!r,Error(u+"crypto unavailable");K=r}else K=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(w(r=e[t],0,9,t),U=r),e.hasOwnProperty(t="POW_PRECISION")&&(w(r=e[t],0,g,t),j=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(u+t+" not an object: "+r);V=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(u+t+" invalid: "+r);q="0123456789"==r.slice(0,10),F=r}}return{DECIMAL_PLACES:x,ROUNDING_MODE:M,EXPONENTIAL_AT:[O,N],RANGE:[L,D],CRYPTO:K,MODULO_MODE:U,POW_PRECISION:j,FORMAT:V,ALPHABET:F}},H.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!H.DEBUG)return!0;var t,r,n=e.c,i=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===o||-1===o)&&i>=-g&&i<=g&&i===c(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break e}if((t=(i+1)%h)<1&&(t+=h),String(n[0]).length==t){for(t=0;t=l||r!==c(r))break e;if(0!==r)return!0}}}else if(null===n&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(u+"Invalid BigNumber: "+e)},H.maximum=H.max=function(){return $(arguments,k.lt)},H.minimum=H.min=function(){return $(arguments,k.gt)},H.random=(o=9007199254740992,A=Math.random()*o&2097151?function(){return c(Math.random()*o)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,i,o,s=0,f=[],l=new H(B);if(null==e?e=x:w(e,0,g),i=a(e/h),K)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));s>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[s]=r[0],t[s+1]=r[1]):(f.push(o%1e14),s+=2);s=i/2}else{if(!crypto.randomBytes)throw K=!1,Error(u+"crypto unavailable");for(t=crypto.randomBytes(i*=7);s=9e15?crypto.randomBytes(7).copy(t,s):(f.push(o%1e14),s+=7);s=i/7}if(!K)for(;s=10;o/=10,s++);sr-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/r|0,s[i]%=r)}return s.reverse()}return function(n,i,o,s,a){var c,u,f,l,h,d,p,y,g=n.indexOf("."),b=x,v=M;for(g>=0&&(l=j,j=0,n=n.replace(".",""),d=(y=new H(i)).pow(n.length-g),j=l,y.c=t(S(m(d.c),d.e,"0"),10,o,e),y.e=y.c.length),f=l=(p=t(n,i,o,a?(c=F,e):(c=e,F))).length;0==p[--l];p.pop());if(!p[0])return c.charAt(0);if(g<0?--f:(d.c=p,d.e=f,d.s=s,p=(d=r(d,y,b,v,o)).c,h=d.r,f=d.e),g=p[u=f+b+1],l=o/2,h=h||u<0||null!=p[u+1],h=v<4?(null!=g||h)&&(0==v||v==(d.s<0?3:2)):g>l||g==l&&(4==v||h||6==v&&1&p[u-1]||v==(d.s<0?8:7)),u<1||!p[0])n=h?S(c.charAt(1),-b,c.charAt(0)):c.charAt(0);else{if(p.length=u,h)for(--o;++p[--u]>o;)p[u]=0,u||(++f,p=[1].concat(p));for(l=p.length;!p[--l];);for(g=0,n="";g<=l;n+=c.charAt(p[g++]));n=S(n,f,c.charAt(0))}return n}}(),r=function(){function e(e,t,r){var n,i,o,s,a=0,c=e.length,u=t%y,f=t/y|0;for(e=e.slice();c--;)a=((i=u*(o=e[c]%y)+(n=f*o+(s=e[c]/y|0)*u)%y*y+a)/r|0)+(n/y|0)+f*s,e[c]=i%r;return a&&(e=[a].concat(e)),e}function t(e,t,r,n){var i,o;if(r!=n)o=r>n?1:-1;else for(i=o=0;it[i]?1:-1;break}return o}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]1;e.splice(0,1));}return function(n,i,o,s,a){var u,f,d,p,y,g,m,v,w,E,_,S,A,T,I,C,P,R=n.s==i.s?1:-1,k=n.c,B=i.c;if(!(k&&k[0]&&B&&B[0]))return new H(n.s&&i.s&&(k?!B||k[0]!=B[0]:B)?k&&0==k[0]||!B?0*R:R/0:NaN);for(w=(v=new H(R)).c=[],R=o+(f=n.e-i.e)+1,a||(a=l,f=b(n.e/h)-b(i.e/h),R=R/h|0),d=0;B[d]==(k[d]||0);d++);if(B[d]>(k[d]||0)&&f--,R<0)w.push(1),p=!0;else{for(T=k.length,C=B.length,d=0,R+=2,(y=c(a/(B[0]+1)))>1&&(B=e(B,y,a),k=e(k,y,a),C=B.length,T=k.length),A=C,_=(E=k.slice(0,C)).length;_=a/2&&I++;do{if(y=0,(u=t(B,E,C,_))<0){if(S=E[0],C!=_&&(S=S*a+(E[1]||0)),(y=c(S/I))>1)for(y>=a&&(y=a-1),m=(g=e(B,y,a)).length,_=E.length;1==t(g,E,m,_);)y--,r(g,C=10;R/=10,d++);W(v,o+(v.e=d+f*h-1)+1,s,p)}else v.e=f,v.r=+p;return v}}(),T=/^(-?)0([xbo])(?=\w[\w.]*$)/i,I=/^([^.]+)\.$/,C=/^\.([^.]+)$/,P=/^-?(Infinity|NaN)$/,R=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(e,t,r,n){var i,o=r?t:t.replace(R,"");if(P.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!r&&(o=o.replace(T,(function(e,t,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?e:t})),n&&(i=n,o=o.replace(I,"$1").replace(C,"0.$1")),t!=o))return new H(o,i);if(H.DEBUG)throw Error(u+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},k.absoluteValue=k.abs=function(){var e=new H(this);return e.s<0&&(e.s=1),e},k.comparedTo=function(e,t){return v(this,new H(e,t))},k.decimalPlaces=k.dp=function(e,t){var r,n,i,o=this;if(null!=e)return w(e,0,g),null==t?t=M:w(t,0,8),W(new H(o),e+o.e+1,t);if(!(r=o.c))return null;if(n=((i=r.length-1)-b(this.e/h))*h,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},k.dividedBy=k.div=function(e,t){return r(this,new H(e,t),x,M)},k.dividedToIntegerBy=k.idiv=function(e,t){return r(this,new H(e,t),0,1)},k.exponentiatedBy=k.pow=function(e,t){var r,n,i,o,s,f,l,d,p=this;if((e=new H(e)).c&&!e.isInteger())throw Error(u+"Exponent not an integer: "+Y(e));if(null!=t&&(t=new H(t)),s=e.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!e.c||!e.c[0])return d=new H(Math.pow(+Y(p),s?2-E(e):+Y(e))),t?d.mod(t):d;if(f=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new H(NaN);(n=!f&&p.isInteger()&&t.isInteger())&&(p=p.mod(t))}else{if(e.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||s&&p.c[1]>=24e7:p.c[0]<8e13||s&&p.c[0]<=9999975e7)))return o=p.s<0&&E(e)?-0:0,p.e>-1&&(o=1/o),new H(f?1/o:o);j&&(o=a(j/h+2))}for(s?(r=new H(.5),f&&(e.s=1),l=E(e)):l=(i=Math.abs(+Y(e)))%2,d=new H(B);;){if(l){if(!(d=d.times(p)).c)break;o?d.c.length>o&&(d.c.length=o):n&&(d=d.mod(t))}if(i){if(0===(i=c(i/2)))break;l=i%2}else if(W(e=e.times(r),e.e+1,1),e.e>14)l=E(e);else{if(0==(i=+Y(e)))break;l=i%2}p=p.times(p),o?p.c&&p.c.length>o&&(p.c.length=o):n&&(p=p.mod(t))}return n?d:(f&&(d=B.div(d)),t?d.mod(t):o?W(d,j,M,void 0):d)},k.integerValue=function(e){var t=new H(this);return null==e?e=M:w(e,0,8),W(t,t.e+1,e)},k.isEqualTo=k.eq=function(e,t){return 0===v(this,new H(e,t))},k.isFinite=function(){return!!this.c},k.isGreaterThan=k.gt=function(e,t){return v(this,new H(e,t))>0},k.isGreaterThanOrEqualTo=k.gte=function(e,t){return 1===(t=v(this,new H(e,t)))||0===t},k.isInteger=function(){return!!this.c&&b(this.e/h)>this.c.length-2},k.isLessThan=k.lt=function(e,t){return v(this,new H(e,t))<0},k.isLessThanOrEqualTo=k.lte=function(e,t){return-1===(t=v(this,new H(e,t)))||0===t},k.isNaN=function(){return!this.s},k.isNegative=function(){return this.s<0},k.isPositive=function(){return this.s>0},k.isZero=function(){return!!this.c&&0==this.c[0]},k.minus=function(e,t){var r,n,i,o,s=this,a=s.s;if(t=(e=new H(e,t)).s,!a||!t)return new H(NaN);if(a!=t)return e.s=-t,s.plus(e);var c=s.e/h,u=e.e/h,f=s.c,d=e.c;if(!c||!u){if(!f||!d)return f?(e.s=-t,e):new H(d?s:NaN);if(!f[0]||!d[0])return d[0]?(e.s=-t,e):new H(f[0]?s:3==M?-0:0)}if(c=b(c),u=b(u),f=f.slice(),a=c-u){for((o=a<0)?(a=-a,i=f):(u=c,i=d),i.reverse(),t=a;t--;i.push(0));i.reverse()}else for(n=(o=(a=f.length)<(t=d.length))?a:t,a=t=0;t0)for(;t--;f[r++]=0);for(t=l-1;n>a;){if(f[--n]=0;){for(r=0,p=S[i]%w,g=S[i]/w|0,o=i+(s=c);o>i;)r=((u=p*(u=_[--s]%w)+(a=g*u+(f=_[s]/w|0)*p)%w*w+m[o]+r)/v|0)+(a/w|0)+g*f,m[o--]=u%v;m[o]=r}return r?++n:m.splice(0,1),G(e,m,n)},k.negated=function(){var e=new H(this);return e.s=-e.s||null,e},k.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new H(e,t)).s,!i||!t)return new H(NaN);if(i!=t)return e.s=-t,n.minus(e);var o=n.e/h,s=e.e/h,a=n.c,c=e.c;if(!o||!s){if(!a||!c)return new H(i/0);if(!a[0]||!c[0])return c[0]?e:new H(a[0]?n:0*i)}if(o=b(o),s=b(s),a=a.slice(),i=o-s){for(i>0?(s=o,r=c):(i=-i,r=a),r.reverse();i--;r.push(0));r.reverse()}for((i=a.length)-(t=c.length)<0&&(r=c,c=a,a=r,t=i),i=0;t;)i=(a[--t]=a[t]+c[t]+i)/l|0,a[t]=l===a[t]?0:a[t]%l;return i&&(a=[i].concat(a),++s),G(e,a,s)},k.precision=k.sd=function(e,t){var r,n,i,o=this;if(null!=e&&e!==!!e)return w(e,1,g),null==t?t=M:w(t,0,8),W(new H(o),e,t);if(!(r=o.c))return null;if(n=(i=r.length-1)*h+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&o.e+1>n&&(n=o.e+1),n},k.shiftedBy=function(e){return w(e,-9007199254740991,d),this.times("1e"+e)},k.squareRoot=k.sqrt=function(){var e,t,n,i,o,s=this,a=s.c,c=s.s,u=s.e,f=x+4,l=new H("0.5");if(1!==c||!a||!a[0])return new H(!c||c<0&&(!a||a[0])?NaN:a?s:1/0);if(0==(c=Math.sqrt(+Y(s)))||c==1/0?(((t=m(a)).length+u)%2==0&&(t+="0"),c=Math.sqrt(+t),u=b((u+1)/2)-(u<0||u%2),n=new H(t=c==1/0?"5e"+u:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+u)):n=new H(c+""),n.c[0])for((c=(u=n.e)+f)<3&&(c=0);;)if(o=n,n=l.times(o.plus(r(s,o,f,1))),m(o.c).slice(0,c)===(t=m(n.c)).slice(0,c)){if(n.e0&&y>0){for(o=y%a||a,l=p.substr(0,o);o0&&(l+=f+p.slice(o)),d&&(l="-"+l)}n=h?l+(r.decimalSeparator||"")+((c=+r.fractionGroupSize)?h.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):h):l}return(r.prefix||"")+n+(r.suffix||"")},k.toFraction=function(e){var t,n,i,o,s,a,c,f,l,d,y,g,b=this,v=b.c;if(null!=e&&(!(c=new H(e)).isInteger()&&(c.c||1!==c.s)||c.lt(B)))throw Error(u+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+Y(c));if(!v)return new H(b);for(t=new H(B),l=n=new H(B),i=f=new H(B),g=m(v),s=t.e=g.length-b.e-1,t.c[0]=p[(a=s%h)<0?h+a:a],e=!e||c.comparedTo(t)>0?s>0?t:l:c,a=D,D=1/0,c=new H(g),f.c[0]=0;d=r(c,t,0,1),1!=(o=n.plus(d.times(i))).comparedTo(e);)n=i,i=o,l=f.plus(d.times(o=l)),f=o,t=c.minus(d.times(o=t)),c=o;return o=r(e.minus(n),i,0,1),f=f.plus(o.times(l)),n=n.plus(o.times(i)),f.s=l.s=b.s,y=r(l,i,s*=2,M).minus(b).abs().comparedTo(r(f,n,s,M).minus(b).abs())<1?[l,i]:[f,n],D=a,y},k.toNumber=function(){return+Y(this)},k.toPrecision=function(e,t){return null!=e&&w(e,1,g),z(this,e,t,2)},k.toString=function(e){var t,r=this,i=r.s,o=r.e;return null===o?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(null==e?t=o<=O||o>=N?_(m(r.c),o):S(m(r.c),o,"0"):10===e&&q?t=S(m((r=W(new H(r),x+o+1,M)).c),r.e,"0"):(w(e,2,F.length,"Base"),t=n(S(m(r.c),o,"0"),10,e,i,!0)),i<0&&r.c[0]&&(t="-"+t)),t},k.valueOf=k.toJSON=function(){return Y(this)},k._isBigNumber=!0,null!=t&&H.set(t),H}(),o.default=o.BigNumber=o,void 0===(n=function(){return o}.call(t,r,t,e))||(e.exports=n)}()},9668:(e,t,r)=>{"use strict";const{Buffer:n}=r(48764),i=Symbol.for("BufferList");function o(e){if(!(this instanceof o))return new o(e);o._init.call(this,e)}o._init=function(e){Object.defineProperty(this,i,{value:!0}),this._bufs=[],this.length=0,e&&this.append(e)},o.prototype._new=function(e){return new o(e)},o.prototype._offset=function(e){if(0===e)return[0,0];let t=0;for(let r=0;rthis.length||e<0)return;const t=this._offset(e);return this._bufs[t[0]][t[1]]},o.prototype.slice=function(e,t){return"number"==typeof e&&e<0&&(e+=this.length),"number"==typeof t&&t<0&&(t+=this.length),this.copy(null,0,e,t)},o.prototype.copy=function(e,t,r,i){if(("number"!=typeof r||r<0)&&(r=0),("number"!=typeof i||i>this.length)&&(i=this.length),r>=this.length)return e||n.alloc(0);if(i<=0)return e||n.alloc(0);const o=!!e,s=this._offset(r),a=i-r;let c=a,u=o&&t||0,f=s[1];if(0===r&&i===this.length){if(!o)return 1===this._bufs.length?this._bufs[0]:n.concat(this._bufs,this.length);for(let t=0;tr)){this._bufs[t].copy(e,u,f,f+c),u+=r;break}this._bufs[t].copy(e,u,f),u+=r,c-=r,f&&(f=0)}return e.length>u?e.slice(0,u):e},o.prototype.shallowSlice=function(e,t){if(e=e||0,t="number"!=typeof t?this.length:t,e<0&&(e+=this.length),t<0&&(t+=this.length),e===t)return this._new();const r=this._offset(e),n=this._offset(t),i=this._bufs.slice(r[0],n[0]+1);return 0===n[1]?i.pop():i[i.length-1]=i[i.length-1].slice(0,n[1]),0!==r[1]&&(i[0]=i[0].slice(r[1])),this._new(i)},o.prototype.toString=function(e,t,r){return this.slice(t,r).toString(e)},o.prototype.consume=function(e){if(e=Math.trunc(e),Number.isNaN(e)||e<=0)return this;for(;this._bufs.length;){if(!(e>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},o.prototype.duplicate=function(){const e=this._new();for(let t=0;tthis.length?this.length:t;const i=this._offset(t);let o=i[0],s=i[1];for(;o=e.length){const r=t.indexOf(e,s);if(-1!==r)return this._reverseOffset([o,r]);s=t.length-e.length+1}else{const t=this._reverseOffset([o,s]);if(this._match(t,e))return t;s++}s=0}return-1},o.prototype._match=function(e,t){if(this.length-e=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function c(e,t,r){var n=a(e,r);return r-1>=t&&(n|=a(e,r-1)<<4),n}function u(e,t,r,n){for(var i=0,o=Math.min(e.length,r),s=t;s=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(e){return e instanceof o||null!==e&&"object"==typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n=t;n-=2)i=c(e,t,n)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(e.length-t)%2==0?t+1:t;n=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var o=e.length-r,s=o%n,a=Math.min(o,o-s)+r,c=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,c=s/67108864|0;r.words[0]=a;for(var u=1;u>>26,l=67108863&c,h=Math.min(u,t.length-1),d=Math.max(0,u-e.length+1);d<=h;d++){var p=u-d|0;f+=(s=(i=0|e.words[p])*(o=0|t.words[d])+l)/67108864|0,l=67108863&s}r.words[u]=0|l,c=0|f}return 0!==c?r.words[u]=0|c:r.length--,r.strip()}o.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,o=0,s=0;s>>24-i&16777215)||s!==this.length-1?f[6-c.length]+c+r:c+r,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var u=l[e],d=h[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var y=p.modn(d).toString(e);r=(p=p.idivn(d)).isZero()?y+r:f[u-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(e,t){return n(void 0!==s),this.toArrayLike(s,e,t)},o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var s,a,c="le"===t,u=new e(o),f=this.clone();if(c){for(a=0;!f.isZero();a++)s=f.andln(255),f.iushrn(8),u[a]=s;for(;a=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,d=0|s[1],p=8191&d,y=d>>>13,g=0|s[2],b=8191&g,m=g>>>13,v=0|s[3],w=8191&v,E=v>>>13,_=0|s[4],S=8191&_,A=_>>>13,T=0|s[5],I=8191&T,C=T>>>13,P=0|s[6],R=8191&P,k=P>>>13,B=0|s[7],x=8191&B,M=B>>>13,O=0|s[8],N=8191&O,L=O>>>13,D=0|s[9],K=8191&D,U=D>>>13,j=0|a[0],V=8191&j,F=j>>>13,q=0|a[1],H=8191&q,z=q>>>13,$=0|a[2],G=8191&$,W=$>>>13,Y=0|a[3],X=8191&Y,Q=Y>>>13,J=0|a[4],Z=8191&J,ee=J>>>13,te=0|a[5],re=8191&te,ne=te>>>13,ie=0|a[6],oe=8191&ie,se=ie>>>13,ae=0|a[7],ce=8191&ae,ue=ae>>>13,fe=0|a[8],le=8191&fe,he=fe>>>13,de=0|a[9],pe=8191&de,ye=de>>>13;r.negative=e.negative^t.negative,r.length=19;var ge=(u+(n=Math.imul(l,V))|0)+((8191&(i=(i=Math.imul(l,F))+Math.imul(h,V)|0))<<13)|0;u=((o=Math.imul(h,F))+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(p,V),i=(i=Math.imul(p,F))+Math.imul(y,V)|0,o=Math.imul(y,F);var be=(u+(n=n+Math.imul(l,H)|0)|0)+((8191&(i=(i=i+Math.imul(l,z)|0)+Math.imul(h,H)|0))<<13)|0;u=((o=o+Math.imul(h,z)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(b,V),i=(i=Math.imul(b,F))+Math.imul(m,V)|0,o=Math.imul(m,F),n=n+Math.imul(p,H)|0,i=(i=i+Math.imul(p,z)|0)+Math.imul(y,H)|0,o=o+Math.imul(y,z)|0;var me=(u+(n=n+Math.imul(l,G)|0)|0)+((8191&(i=(i=i+Math.imul(l,W)|0)+Math.imul(h,G)|0))<<13)|0;u=((o=o+Math.imul(h,W)|0)+(i>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(w,V),i=(i=Math.imul(w,F))+Math.imul(E,V)|0,o=Math.imul(E,F),n=n+Math.imul(b,H)|0,i=(i=i+Math.imul(b,z)|0)+Math.imul(m,H)|0,o=o+Math.imul(m,z)|0,n=n+Math.imul(p,G)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,W)|0;var ve=(u+(n=n+Math.imul(l,X)|0)|0)+((8191&(i=(i=i+Math.imul(l,Q)|0)+Math.imul(h,X)|0))<<13)|0;u=((o=o+Math.imul(h,Q)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(S,V),i=(i=Math.imul(S,F))+Math.imul(A,V)|0,o=Math.imul(A,F),n=n+Math.imul(w,H)|0,i=(i=i+Math.imul(w,z)|0)+Math.imul(E,H)|0,o=o+Math.imul(E,z)|0,n=n+Math.imul(b,G)|0,i=(i=i+Math.imul(b,W)|0)+Math.imul(m,G)|0,o=o+Math.imul(m,W)|0,n=n+Math.imul(p,X)|0,i=(i=i+Math.imul(p,Q)|0)+Math.imul(y,X)|0,o=o+Math.imul(y,Q)|0;var we=(u+(n=n+Math.imul(l,Z)|0)|0)+((8191&(i=(i=i+Math.imul(l,ee)|0)+Math.imul(h,Z)|0))<<13)|0;u=((o=o+Math.imul(h,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(I,V),i=(i=Math.imul(I,F))+Math.imul(C,V)|0,o=Math.imul(C,F),n=n+Math.imul(S,H)|0,i=(i=i+Math.imul(S,z)|0)+Math.imul(A,H)|0,o=o+Math.imul(A,z)|0,n=n+Math.imul(w,G)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(E,G)|0,o=o+Math.imul(E,W)|0,n=n+Math.imul(b,X)|0,i=(i=i+Math.imul(b,Q)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,Q)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(y,Z)|0,o=o+Math.imul(y,ee)|0;var Ee=(u+(n=n+Math.imul(l,re)|0)|0)+((8191&(i=(i=i+Math.imul(l,ne)|0)+Math.imul(h,re)|0))<<13)|0;u=((o=o+Math.imul(h,ne)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(R,V),i=(i=Math.imul(R,F))+Math.imul(k,V)|0,o=Math.imul(k,F),n=n+Math.imul(I,H)|0,i=(i=i+Math.imul(I,z)|0)+Math.imul(C,H)|0,o=o+Math.imul(C,z)|0,n=n+Math.imul(S,G)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,W)|0,n=n+Math.imul(w,X)|0,i=(i=i+Math.imul(w,Q)|0)+Math.imul(E,X)|0,o=o+Math.imul(E,Q)|0,n=n+Math.imul(b,Z)|0,i=(i=i+Math.imul(b,ee)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(y,re)|0,o=o+Math.imul(y,ne)|0;var _e=(u+(n=n+Math.imul(l,oe)|0)|0)+((8191&(i=(i=i+Math.imul(l,se)|0)+Math.imul(h,oe)|0))<<13)|0;u=((o=o+Math.imul(h,se)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(x,V),i=(i=Math.imul(x,F))+Math.imul(M,V)|0,o=Math.imul(M,F),n=n+Math.imul(R,H)|0,i=(i=i+Math.imul(R,z)|0)+Math.imul(k,H)|0,o=o+Math.imul(k,z)|0,n=n+Math.imul(I,G)|0,i=(i=i+Math.imul(I,W)|0)+Math.imul(C,G)|0,o=o+Math.imul(C,W)|0,n=n+Math.imul(S,X)|0,i=(i=i+Math.imul(S,Q)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,Q)|0,n=n+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(E,Z)|0,o=o+Math.imul(E,ee)|0,n=n+Math.imul(b,re)|0,i=(i=i+Math.imul(b,ne)|0)+Math.imul(m,re)|0,o=o+Math.imul(m,ne)|0,n=n+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,se)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,se)|0;var Se=(u+(n=n+Math.imul(l,ce)|0)|0)+((8191&(i=(i=i+Math.imul(l,ue)|0)+Math.imul(h,ce)|0))<<13)|0;u=((o=o+Math.imul(h,ue)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(N,V),i=(i=Math.imul(N,F))+Math.imul(L,V)|0,o=Math.imul(L,F),n=n+Math.imul(x,H)|0,i=(i=i+Math.imul(x,z)|0)+Math.imul(M,H)|0,o=o+Math.imul(M,z)|0,n=n+Math.imul(R,G)|0,i=(i=i+Math.imul(R,W)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,W)|0,n=n+Math.imul(I,X)|0,i=(i=i+Math.imul(I,Q)|0)+Math.imul(C,X)|0,o=o+Math.imul(C,Q)|0,n=n+Math.imul(S,Z)|0,i=(i=i+Math.imul(S,ee)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,ee)|0,n=n+Math.imul(w,re)|0,i=(i=i+Math.imul(w,ne)|0)+Math.imul(E,re)|0,o=o+Math.imul(E,ne)|0,n=n+Math.imul(b,oe)|0,i=(i=i+Math.imul(b,se)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,se)|0,n=n+Math.imul(p,ce)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(y,ce)|0,o=o+Math.imul(y,ue)|0;var Ae=(u+(n=n+Math.imul(l,le)|0)|0)+((8191&(i=(i=i+Math.imul(l,he)|0)+Math.imul(h,le)|0))<<13)|0;u=((o=o+Math.imul(h,he)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(K,V),i=(i=Math.imul(K,F))+Math.imul(U,V)|0,o=Math.imul(U,F),n=n+Math.imul(N,H)|0,i=(i=i+Math.imul(N,z)|0)+Math.imul(L,H)|0,o=o+Math.imul(L,z)|0,n=n+Math.imul(x,G)|0,i=(i=i+Math.imul(x,W)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,W)|0,n=n+Math.imul(R,X)|0,i=(i=i+Math.imul(R,Q)|0)+Math.imul(k,X)|0,o=o+Math.imul(k,Q)|0,n=n+Math.imul(I,Z)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(C,Z)|0,o=o+Math.imul(C,ee)|0,n=n+Math.imul(S,re)|0,i=(i=i+Math.imul(S,ne)|0)+Math.imul(A,re)|0,o=o+Math.imul(A,ne)|0,n=n+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,se)|0)+Math.imul(E,oe)|0,o=o+Math.imul(E,se)|0,n=n+Math.imul(b,ce)|0,i=(i=i+Math.imul(b,ue)|0)+Math.imul(m,ce)|0,o=o+Math.imul(m,ue)|0,n=n+Math.imul(p,le)|0,i=(i=i+Math.imul(p,he)|0)+Math.imul(y,le)|0,o=o+Math.imul(y,he)|0;var Te=(u+(n=n+Math.imul(l,pe)|0)|0)+((8191&(i=(i=i+Math.imul(l,ye)|0)+Math.imul(h,pe)|0))<<13)|0;u=((o=o+Math.imul(h,ye)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(K,H),i=(i=Math.imul(K,z))+Math.imul(U,H)|0,o=Math.imul(U,z),n=n+Math.imul(N,G)|0,i=(i=i+Math.imul(N,W)|0)+Math.imul(L,G)|0,o=o+Math.imul(L,W)|0,n=n+Math.imul(x,X)|0,i=(i=i+Math.imul(x,Q)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,Q)|0,n=n+Math.imul(R,Z)|0,i=(i=i+Math.imul(R,ee)|0)+Math.imul(k,Z)|0,o=o+Math.imul(k,ee)|0,n=n+Math.imul(I,re)|0,i=(i=i+Math.imul(I,ne)|0)+Math.imul(C,re)|0,o=o+Math.imul(C,ne)|0,n=n+Math.imul(S,oe)|0,i=(i=i+Math.imul(S,se)|0)+Math.imul(A,oe)|0,o=o+Math.imul(A,se)|0,n=n+Math.imul(w,ce)|0,i=(i=i+Math.imul(w,ue)|0)+Math.imul(E,ce)|0,o=o+Math.imul(E,ue)|0,n=n+Math.imul(b,le)|0,i=(i=i+Math.imul(b,he)|0)+Math.imul(m,le)|0,o=o+Math.imul(m,he)|0;var Ie=(u+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,ye)|0)+Math.imul(y,pe)|0))<<13)|0;u=((o=o+Math.imul(y,ye)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(K,G),i=(i=Math.imul(K,W))+Math.imul(U,G)|0,o=Math.imul(U,W),n=n+Math.imul(N,X)|0,i=(i=i+Math.imul(N,Q)|0)+Math.imul(L,X)|0,o=o+Math.imul(L,Q)|0,n=n+Math.imul(x,Z)|0,i=(i=i+Math.imul(x,ee)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,ee)|0,n=n+Math.imul(R,re)|0,i=(i=i+Math.imul(R,ne)|0)+Math.imul(k,re)|0,o=o+Math.imul(k,ne)|0,n=n+Math.imul(I,oe)|0,i=(i=i+Math.imul(I,se)|0)+Math.imul(C,oe)|0,o=o+Math.imul(C,se)|0,n=n+Math.imul(S,ce)|0,i=(i=i+Math.imul(S,ue)|0)+Math.imul(A,ce)|0,o=o+Math.imul(A,ue)|0,n=n+Math.imul(w,le)|0,i=(i=i+Math.imul(w,he)|0)+Math.imul(E,le)|0,o=o+Math.imul(E,he)|0;var Ce=(u+(n=n+Math.imul(b,pe)|0)|0)+((8191&(i=(i=i+Math.imul(b,ye)|0)+Math.imul(m,pe)|0))<<13)|0;u=((o=o+Math.imul(m,ye)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(K,X),i=(i=Math.imul(K,Q))+Math.imul(U,X)|0,o=Math.imul(U,Q),n=n+Math.imul(N,Z)|0,i=(i=i+Math.imul(N,ee)|0)+Math.imul(L,Z)|0,o=o+Math.imul(L,ee)|0,n=n+Math.imul(x,re)|0,i=(i=i+Math.imul(x,ne)|0)+Math.imul(M,re)|0,o=o+Math.imul(M,ne)|0,n=n+Math.imul(R,oe)|0,i=(i=i+Math.imul(R,se)|0)+Math.imul(k,oe)|0,o=o+Math.imul(k,se)|0,n=n+Math.imul(I,ce)|0,i=(i=i+Math.imul(I,ue)|0)+Math.imul(C,ce)|0,o=o+Math.imul(C,ue)|0,n=n+Math.imul(S,le)|0,i=(i=i+Math.imul(S,he)|0)+Math.imul(A,le)|0,o=o+Math.imul(A,he)|0;var Pe=(u+(n=n+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,ye)|0)+Math.imul(E,pe)|0))<<13)|0;u=((o=o+Math.imul(E,ye)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(K,Z),i=(i=Math.imul(K,ee))+Math.imul(U,Z)|0,o=Math.imul(U,ee),n=n+Math.imul(N,re)|0,i=(i=i+Math.imul(N,ne)|0)+Math.imul(L,re)|0,o=o+Math.imul(L,ne)|0,n=n+Math.imul(x,oe)|0,i=(i=i+Math.imul(x,se)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,se)|0,n=n+Math.imul(R,ce)|0,i=(i=i+Math.imul(R,ue)|0)+Math.imul(k,ce)|0,o=o+Math.imul(k,ue)|0,n=n+Math.imul(I,le)|0,i=(i=i+Math.imul(I,he)|0)+Math.imul(C,le)|0,o=o+Math.imul(C,he)|0;var Re=(u+(n=n+Math.imul(S,pe)|0)|0)+((8191&(i=(i=i+Math.imul(S,ye)|0)+Math.imul(A,pe)|0))<<13)|0;u=((o=o+Math.imul(A,ye)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,n=Math.imul(K,re),i=(i=Math.imul(K,ne))+Math.imul(U,re)|0,o=Math.imul(U,ne),n=n+Math.imul(N,oe)|0,i=(i=i+Math.imul(N,se)|0)+Math.imul(L,oe)|0,o=o+Math.imul(L,se)|0,n=n+Math.imul(x,ce)|0,i=(i=i+Math.imul(x,ue)|0)+Math.imul(M,ce)|0,o=o+Math.imul(M,ue)|0,n=n+Math.imul(R,le)|0,i=(i=i+Math.imul(R,he)|0)+Math.imul(k,le)|0,o=o+Math.imul(k,he)|0;var ke=(u+(n=n+Math.imul(I,pe)|0)|0)+((8191&(i=(i=i+Math.imul(I,ye)|0)+Math.imul(C,pe)|0))<<13)|0;u=((o=o+Math.imul(C,ye)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(K,oe),i=(i=Math.imul(K,se))+Math.imul(U,oe)|0,o=Math.imul(U,se),n=n+Math.imul(N,ce)|0,i=(i=i+Math.imul(N,ue)|0)+Math.imul(L,ce)|0,o=o+Math.imul(L,ue)|0,n=n+Math.imul(x,le)|0,i=(i=i+Math.imul(x,he)|0)+Math.imul(M,le)|0,o=o+Math.imul(M,he)|0;var Be=(u+(n=n+Math.imul(R,pe)|0)|0)+((8191&(i=(i=i+Math.imul(R,ye)|0)+Math.imul(k,pe)|0))<<13)|0;u=((o=o+Math.imul(k,ye)|0)+(i>>>13)|0)+(Be>>>26)|0,Be&=67108863,n=Math.imul(K,ce),i=(i=Math.imul(K,ue))+Math.imul(U,ce)|0,o=Math.imul(U,ue),n=n+Math.imul(N,le)|0,i=(i=i+Math.imul(N,he)|0)+Math.imul(L,le)|0,o=o+Math.imul(L,he)|0;var xe=(u+(n=n+Math.imul(x,pe)|0)|0)+((8191&(i=(i=i+Math.imul(x,ye)|0)+Math.imul(M,pe)|0))<<13)|0;u=((o=o+Math.imul(M,ye)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(K,le),i=(i=Math.imul(K,he))+Math.imul(U,le)|0,o=Math.imul(U,he);var Me=(u+(n=n+Math.imul(N,pe)|0)|0)+((8191&(i=(i=i+Math.imul(N,ye)|0)+Math.imul(L,pe)|0))<<13)|0;u=((o=o+Math.imul(L,ye)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863;var Oe=(u+(n=Math.imul(K,pe))|0)+((8191&(i=(i=Math.imul(K,ye))+Math.imul(U,pe)|0))<<13)|0;return u=((o=Math.imul(U,ye))+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,c[0]=ge,c[1]=be,c[2]=me,c[3]=ve,c[4]=we,c[5]=Ee,c[6]=_e,c[7]=Se,c[8]=Ae,c[9]=Te,c[10]=Ie,c[11]=Ce,c[12]=Pe,c[13]=Re,c[14]=ke,c[15]=Be,c[16]=xe,c[17]=Me,c[18]=Oe,0!==u&&(c[19]=u,r.length++),r};function y(e,t,r){return(new g).mulp(e,t,r)}function g(e,t){this.x=e,this.y=t}Math.imul||(p=d),o.prototype.mulTo=function(e,t){var r,n=this.length+e.length;return r=10===this.length&&10===e.length?p(this,e,t):n<63?d(this,e,t):n<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,e,t):y(this,e,t),r},g.prototype.makeRBT=function(e){for(var t=new Array(e),r=o.prototype._countBits(e)-1,n=0;n>=1;return n},g.prototype.permute=function(e,t,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*t;s>=26,t+=i/67108864|0,t+=o>>>26,this.words[r]=67108863&o}return 0!==t&&(this.words[r]=t,this.length++),this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r>>i}return t}(e);if(0===t.length)return new o(1);for(var r=this,n=0;n=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(t=0;t>>26-r}s&&(this.words[t]=s,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var o=e%26,s=Math.min((e-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,u=0;u=0&&(0!==f||u>=i);u--){var l=0|this.words[u];this.words[u]=f<<26-o|l>>>o,f=l&a}return c&&0!==f&&(c.words[c.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),i=e,s=0|i.words[i.length-1];0!=(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,c=n.length-i.length;if("mod"!==t){(a=new o(null)).length=c+1,a.words=new Array(a.length);for(var u=0;u=0;l--){var h=67108864*(0|n.words[i.length+l])+(0|n.words[i.length+l-1]);for(h=Math.min(h/s|0,67108863),n._ishlnsubmul(i,h,l);0!==n.negative;)h--,n.negative=0,n._ishlnsubmul(i,1,l),n.isZero()||(n.negative^=1);a&&(a.words[l]=h)}return a&&a.strip(),n.strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(i=a.div.neg()),"div"!==t&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(e)),{div:i,mod:s}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(e)),{div:a.div,mod:s}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,s,a},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modn=function(e){n(e<=67108863);for(var t=(1<<26)%e,r=0,i=this.length-1;i>=0;i--)r=(t*r+(0|this.words[i]))%e;return r},o.prototype.idivn=function(e){n(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*t;this.words[r]=i/e|0,t=i%e}return this.strip()},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new o(1),s=new o(0),a=new o(0),c=new o(1),u=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++u;for(var f=r.clone(),l=t.clone();!t.isZero();){for(var h=0,d=1;0==(t.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(f),s.isub(l)),i.iushrn(1),s.iushrn(1);for(var p=0,y=1;0==(r.words[0]&y)&&p<26;++p,y<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||c.isOdd())&&(a.iadd(f),c.isub(l)),a.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),i.isub(a),s.isub(c)):(r.isub(t),a.isub(i),c.isub(s))}return{a,b:c,gcd:r.iushln(u)}},o.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,s=new o(1),a=new o(0),c=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,f=1;0==(t.words[0]&f)&&u<26;++u,f<<=1);if(u>0)for(t.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);for(var l=0,h=1;0==(r.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(r.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);t.cmp(r)>=0?(t.isub(r),s.isub(a)):(r.isub(t),a.isub(s))}return(i=0===t.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(e),i},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var o=t;t=r,r=o}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){ni&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new S(e)},o.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var b={k256:null,p224:null,p192:null,p25519:null};function m(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){m.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){m.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){m.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){m.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function A(e){S.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}m.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},m.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},m.prototype.split=function(e,t){e.iushrn(this.n,0,t)},m.prototype.imulK=function(e){return e.imul(this.k)},i(v,m),v.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),i=0;i>>22,o=s}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},v.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(b[e])return b[e];var t;if("k256"===e)t=new v;else if("p224"===e)t=new w;else if("p192"===e)t=new E;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new _}return b[e]=t,t},S.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},S.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},S.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},S.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},S.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},S.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},S.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},S.prototype.isqr=function(e){return this.imul(e,e.clone())},S.prototype.sqr=function(e){return this.mul(e,e)},S.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new o(1)).iushrn(2);return this.pow(e,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),c=a.redNeg(),u=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);0!==this.pow(f,u).cmp(c);)f.redIAdd(c);for(var l=this.pow(f,i),h=this.pow(e,i.addn(1).iushrn(1)),d=this.pow(e,i),p=s;0!==d.cmp(a);){for(var y=d,g=0;0!==y.cmp(a);g++)y=y.redSqr();n(g=0;n--){for(var u=t.words[n],f=c-1;f>=0;f--){var l=u>>f&1;i!==r[0]&&(i=this.sqr(i)),0!==l||0!==s?(s<<=1,s|=l,(4==++a||0===n&&0===f)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}c=26}return i},S.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},S.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new A(e)},i(A,S),A.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},A.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},A.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},A.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},A.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},29931:(e,t,r)=>{var n;function i(e){this.rand=e}if(e.exports=function(e){return n||(n=new i(null)),n.generate(e)},e.exports.Rand=i,i.prototype.generate=function(e){return this._rand(e)},i.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r{"use strict";var n=r(34155);Object.defineProperty(t,"__esModule",{value:!0});var 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},o="undefined"!=typeof window&&void 0!==window.document,s=void 0!==n&&null!=n.versions&&null!=n.versions.node,a="object"===("undefined"==typeof self?"undefined":i(self))&&self.constructor&&"DedicatedWorkerGlobalScope"===self.constructor.name,c="undefined"!=typeof window&&"nodejs"===window.name||"undefined"!=typeof navigator&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),u="undefined"!=typeof Deno&&void 0!==Deno.core;t.isBrowser=o,t.isWebWorker=a,t.isNode=s,t.isJsDom=c,t.isDeno=u},77191:(e,t,r)=>{var n=r(58162);e.exports=n("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},48764:(e,t,r)=>{"use strict";const n=r(79742),i=r(80645),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=c,t.SlowBuffer=function(e){return+e!=e&&(e=0),c.alloc(+e)},t.INSPECT_MAX_BYTES=50;const s=2147483647;function a(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return l(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|y(e,t);let n=a(r);const i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(Y(e,Uint8Array)){const t=new Uint8Array(e);return d(t.buffer,t.byteOffset,t.byteLength)}return h(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Y(e,ArrayBuffer)||e&&Y(e.buffer,ArrayBuffer))return d(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(Y(e,SharedArrayBuffer)||e&&Y(e.buffer,SharedArrayBuffer)))return d(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return c.from(n,t,r);const i=function(e){if(c.isBuffer(e)){const t=0|p(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||X(e.length)?a(0):h(e):"Buffer"===e.type&&Array.isArray(e.data)?h(e.data):void 0}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function f(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function l(e){return f(e),a(e<0?0:0|p(e))}function h(e){const t=e.length<0?0:0|p(e.length),r=a(t);for(let n=0;n=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function y(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Y(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return $(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return G(e).length;default:if(i)return n?-1:$(e).length;t=(""+t).toLowerCase(),i=!0}}function g(e,t,r){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return k(this,t,r);case"utf8":case"utf-8":return I(this,t,r);case"ascii":return P(this,t,r);case"latin1":case"binary":return R(this,t,r);case"base64":return T(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function b(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function m(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),X(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=c.from(t,n)),c.isBuffer(t))return 0===t.length?-1:v(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):v(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,r,n,i){let o,s=1,a=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){let n=-1;for(o=r;oa&&(r=a-c),o=r;o>=0;o--){let r=!0;for(let n=0;ni&&(n=i):n=i;const o=t.length;let s;for(n>o/2&&(n=o/2),s=0;s>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function T(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function I(e,t,r){r=Math.min(e.length,r);const n=[];let i=t;for(;i239?4:t>223?3:t>191?2:1;if(i+s<=r){let r,n,a,c;switch(s){case 1:t<128&&(o=t);break;case 2:r=e[i+1],128==(192&r)&&(c=(31&t)<<6|63&r,c>127&&(o=c));break;case 3:r=e[i+1],n=e[i+2],128==(192&r)&&128==(192&n)&&(c=(15&t)<<12|(63&r)<<6|63&n,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:r=e[i+1],n=e[i+2],a=e[i+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(c=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&a,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return function(e){const t=e.length;if(t<=C)return String.fromCharCode.apply(String,e);let r="",n=0;for(;nn.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(n,i)):Uint8Array.prototype.set.call(n,t,i);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,i)}i+=t.length}return n},c.byteLength=y,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tr&&(e+=" ... "),""},o&&(c.prototype[o]=c.prototype.inspect),c.prototype.compare=function(e,t,r,n,i){if(Y(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;let o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0);const a=Math.min(o,s),u=this.slice(n,i),f=e.slice(t,r);for(let e=0;e>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return w(this,e,t,r);case"utf8":case"utf-8":return E(this,e,t,r);case"ascii":case"latin1":case"binary":return _(this,e,t,r);case"base64":return S(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const C=4096;function P(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;in)&&(r=n);let i="";for(let n=t;nr)throw new RangeError("Trying to access beyond buffer length")}function M(e,t,r,n,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function O(e,t,r,n,i){F(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,r}function N(e,t,r,n,i){F(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o>>=8,e[r+6]=o,o>>=8,e[r+5]=o,o>>=8,e[r+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=s,s>>=8,e[r+2]=s,s>>=8,e[r+1]=s,s>>=8,e[r]=s,r+8}function L(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(e,t,r,n,o){return t=+t,r>>>=0,o||L(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function K(e,t,r,n,o){return t=+t,r>>>=0,o||L(e,0,r,8),i.write(e,t,r,n,52,8),r+8}c.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||x(e,t,this.length);let n=this[e],i=1,o=0;for(;++o>>=0,t>>>=0,r||x(e,t,this.length);let n=this[e+--t],i=1;for(;t>0&&(i*=256);)n+=this[e+--t]*i;return n},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||x(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||x(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||x(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||x(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||x(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=J((function(e){q(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||H(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(n)+(BigInt(i)<>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||H(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<>>=0,t>>>=0,r||x(e,t,this.length);let n=this[e],i=1,o=0;for(;++o=i&&(n-=Math.pow(2,8*t)),n},c.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||x(e,t,this.length);let n=t,i=1,o=this[e+--n];for(;n>0&&(i*=256);)o+=this[e+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return e>>>=0,t||x(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||x(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(e,t){e>>>=0,t||x(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||x(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||x(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=J((function(e){q(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||H(e,this.length-8);const n=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(n)<>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||H(e,this.length-8);const n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<>>=0,t||x(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||x(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||x(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||x(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||M(this,e,t,r,Math.pow(2,8*r)-1,0);let i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n||M(this,e,t,r,Math.pow(2,8*r)-1,0);let i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=J((function(e,t=0){return O(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=J((function(e,t=0){return N(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);M(this,e,t,r,n-1,-n)}let i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+r},c.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);M(this,e,t,r,n-1,-n)}let i=r-1,o=1,s=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},c.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=J((function(e,t=0){return O(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=J((function(e,t=0){return N(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(e,t,r){return D(this,e,t,!0,r)},c.prototype.writeFloatBE=function(e,t,r){return D(this,e,t,!1,r)},c.prototype.writeDoubleLE=function(e,t,r){return K(this,e,t,!0,r)},c.prototype.writeDoubleBE=function(e,t,r){return K(this,e,t,!1,r)},c.prototype.copy=function(e,t,r,n){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function F(e,t,r,n,i,o){if(e>r||e3?0===t||t===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(o+1)}${n}`:`>= -(2${n} ** ${8*(o+1)-1}${n}) and < 2 ** ${8*(o+1)-1}${n}`:`>= ${t}${n} and <= ${r}${n}`,new U.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,r){q(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||H(t,e.length-(r+1))}(n,i,o)}function q(e,t){if("number"!=typeof e)throw new U.ERR_INVALID_ARG_TYPE(t,"number",e)}function H(e,t,r){if(Math.floor(e)!==e)throw q(e,r),new U.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new U.ERR_BUFFER_OUT_OF_BOUNDS;throw new U.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}j("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),j("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),j("ERR_OUT_OF_RANGE",(function(e,t,r){let n=`The value of "${e}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=V(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=V(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n}),RangeError);const z=/[^+/0-9A-Za-z-_]/g;function $(e,t){let r;t=t||1/0;const n=e.length;let i=null;const o=[];for(let s=0;s55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function G(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(z,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function W(e,t,r,n){let i;for(i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function Y(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function X(e){return e!=e}const Q=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function J(e){return"undefined"==typeof BigInt?Z:e}function Z(){throw new Error("BigInt not supported")}},98514:e=>{"use strict";e.exports=function(e,{className:t,symbolName:r}){const n=Symbol.for(r),i={[t]:class extends e{constructor(...e){super(...e),Object.defineProperty(this,n,{value:!0})}get[Symbol.toStringTag](){return t}}}[t];return i[`is${t}`]=e=>!(!e||!e[n]),i},e.exports.proto=function(e,{className:t,symbolName:r,withoutNew:n}){const i=Symbol.for(r),o={[t]:function(...t){if(n&&!(this instanceof o))return new o(...t);const r=e.call(this,...t)||this;return r&&!r[i]&&Object.defineProperty(r,i,{value:!0}),r}}[t];return o.prototype=Object.create(e.prototype),o.prototype.constructor=o,Object.defineProperty(o.prototype,Symbol.toStringTag,{get:()=>t}),o[`is${t}`]=e=>!(!e||!e[i]),o}},75281:(e,t,r)=>{"use strict";const n=r(5696),i=/\s+at.*(?:\(|\s)(.*)\)?/,o=/^(?:(?:(?:node|(?:internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)\.js:\d+:\d+)|native)/,s=void 0===n.homedir?"":n.homedir();e.exports=(e,t)=>(t=Object.assign({pretty:!1},t),e.replace(/\\/g,"/").split("\n").filter((e=>{const t=e.match(i);if(null===t||!t[1])return!0;const r=t[1];return!r.includes(".app/Contents/Resources/electron.asar")&&!r.includes(".app/Contents/Resources/default_app.asar")&&!o.test(r)})).filter((e=>""!==e.trim())).map((e=>t.pretty?e.replace(i,((e,t)=>e.replace(t,t.replace(s,"~")))):e)).join("\n"))},51424:(e,t,r)=>{"use strict";r.d(t,{Z:()=>a});var n=r(8081),i=r.n(n),o=r(23645),s=r.n(o)()(i());s.push([e.id,".hidden {\n display: none;\n}\n",""]);const a=s},23645:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var r="",n=void 0!==t[5];return t[4]&&(r+="@supports (".concat(t[4],") {")),t[2]&&(r+="@media ".concat(t[2]," {")),n&&(r+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),r+=e(t),n&&(r+="}"),t[2]&&(r+="}"),t[4]&&(r+="}"),r})).join("")},t.i=function(e,r,n,i,o){"string"==typeof e&&(e=[[null,e,void 0]]);var s={};if(n)for(var a=0;a0?" ".concat(f[5]):""," {").concat(f[1],"}")),f[5]=o),r&&(f[2]?(f[1]="@media ".concat(f[2]," {").concat(f[1],"}"),f[2]=r):f[2]=r),i&&(f[4]?(f[1]="@supports (".concat(f[4],") {").concat(f[1],"}"),f[4]=i):f[4]="".concat(i)),t.push(f))}},t}},8081:e=>{"use strict";e.exports=function(e){return e[1]}},11227:(e,t,r)=>{var n=r(34155);t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,i=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(n++,"%c"===e&&(i=n))})),t.splice(i,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&void 0!==n&&"env"in n&&(e=n.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=r(82447)(t);const{formatters:i}=e.exports;i.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},82447:(e,t,r)=>{e.exports=function(e){function t(e){let r,i,o,s=null;function a(...e){if(!a.enabled)return;const n=a,i=Number(new Date),o=i-(r||i);n.diff=o,n.prev=r,n.curr=i,r=i,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,i)=>{if("%%"===r)return"%";s++;const o=t.formatters[i];if("function"==typeof o){const t=e[s];r=o.call(n,t),e.splice(s,1),s--}return r})),t.formatArgs.call(n,e),(n.log||t.log).apply(n,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=n,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==s?s:(i!==t.namespaces&&(i=t.namespaces,o=t.enabled(e)),o),set:e=>{s=e}}),"function"==typeof t.init&&t.init(a),a}function n(e,r){const n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function i(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){const e=[...t.names.map(i),...t.skips.map(i).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),i=n.length;for(r=0;r{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t{"use strict";var t={single_source_shortest_paths:function(e,r,n){var i={},o={};o[r]=0;var s,a,c,u,f,l,h,d=t.PriorityQueue.make();for(d.push(r,0);!d.empty();)for(c in a=(s=d.pop()).value,u=s.cost,f=e[a]||{})f.hasOwnProperty(c)&&(l=u+f[c],h=o[c],(void 0===o[c]||h>l)&&(o[c]=l,d.push(c,l),i[c]=a));if(void 0!==n&&void 0===o[n]){var p=["Could not find a path from ",r," to ",n,"."].join("");throw new Error(p)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var r=[],n=t;n;)r.push(n),e[n],n=e[n];return r.reverse(),r},find_path:function(e,r,n){var i=t.single_source_shortest_paths(e,r,n);return t.extract_shortest_path_from_predecessor_list(i,n)},PriorityQueue:{make:function(e){var r,n=t.PriorityQueue,i={};for(r in e=e||{},n)n.hasOwnProperty(r)&&(i[r]=n[r]);return i.queue=[],i.sorter=e.sorter||n.default_sorter,i},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var r={value:e,cost:t};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};e.exports=t},926:(e,t,r)=>{"use strict";const n=r(11227),i=n("dns-over-http-resolver");i.error=n("dns-over-http-resolver:error");const o=r(73692),s=r(46177);class a{constructor({maxCache:e=100}={}){this._cache=new o({max:e}),this._servers=["https://cloudflare-dns.com/dns-query","https://dns.google/resolve"]}getServers(){return this._servers}_getShuffledServers(){const e=[].concat(this._servers);for(let t=e.length-1;t>0;t--){const r=Math.floor(Math.random()*t),n=e[t];e[t]=e[r],e[r]=n}return e}setServers(e){this._servers=e}resolve(e,t="A"){switch(t){case"A":return this.resolve4(e);case"AAAA":return this.resolve6(e);case"TXT":return this.resolveTxt(e);default:throw new Error(`${t} is not supported`)}}async resolve4(e){const t=this._cache.get(s.getCacheKey(e,"A"));if(t)return t;for(const t of this._getShuffledServers())try{const r=await s.fetch(s.buildResource({serverResolver:t,hostname:e,recordType:"A"})),n=await r.json(),i=n.Answer.map((e=>e.data)),o=Math.min(n.Answer.map((e=>e.TTL)));return this._cache.set(s.getCacheKey(e,"A"),i,{ttl:o}),i}catch(r){i.error(`${t} could not resolve ${e} record A`)}throw new Error(`Could not resolve ${e} record A`)}async resolve6(e){const t="AAAA",r=this._cache.get(s.getCacheKey(e,t));if(r)return r;for(const r of this._getShuffledServers())try{const n=await s.fetch(s.buildResource({serverResolver:r,hostname:e,recordType:t})),i=await n.json(),o=i.Answer.map((e=>e.data)),a=Math.min(i.Answer.map((e=>e.TTL)));return this._cache.set(s.getCacheKey(e,t),o,{ttl:a}),o}catch(t){i.error(`${r} could not resolve ${e} record AAAA`)}throw new Error(`Could not resolve ${e} record AAAA`)}async resolveTxt(e){const t="TXT",r=this._cache.get(s.getCacheKey(e,t));if(r)return r;for(const r of this._getShuffledServers())try{const n=await s.fetch(s.buildResource({serverResolver:r,hostname:e,recordType:t})),i=await n.json(),o=i.Answer.map((e=>[e.data.replace(/['"]+/g,"")])),a=Math.min(i.Answer.map((e=>e.TTL)));return this._cache.set(s.getCacheKey(e,t),o,{ttl:a}),o}catch(t){i.error(`${r} could not resolve ${e} record TXT`)}throw new Error(`Could not resolve ${e} record TXT`)}}a.Resolver=a,e.exports=a},46177:(e,t,r)=>{"use strict";const{default:n,Headers:i}=r(30700);e.exports={buildResource:function({serverResolver:e,hostname:t,recordType:r}){return`${e}?name=${t}&type=${r}`},fetch:function(e){return n(e,{headers:new i({accept:"application/dns-json"})})},getCacheKey:function(e,t){return`${t}_${e}`}}},86266:(e,t,r)=>{"use strict";var n=t;n.version=r(18597).i8,n.utils=r(80953),n.rand=r(29931),n.curve=r(88254),n.curves=r(45427),n.ec=r(57954),n.eddsa=r(65980)},4918:(e,t,r)=>{"use strict";var n=r(13550),i=r(80953),o=i.getNAF,s=i.getJSF,a=i.assert;function c(e,t){this.type=e,this.p=new n(t.p,16),this.red=t.prime?n.red(t.prime):n.mont(this.p),this.zero=new n(0).toRed(this.red),this.one=new n(1).toRed(this.red),this.two=new n(2).toRed(this.red),this.n=t.n&&new n(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function u(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=c,c.prototype.point=function(){throw new Error("Not implemented")},c.prototype.validate=function(){throw new Error("Not implemented")},c.prototype._fixedNafMul=function(e,t){a(e.precomputed);var r=e._getDoubles(),n=o(t,1,this._bitLength),i=(1<=s;f--)c=(c<<1)+n[f];u.push(c)}for(var l=this.jpoint(null,null,null),h=this.jpoint(null,null,null),d=i;d>0;d--){for(s=0;s=0;u--){for(var f=0;u>=0&&0===s[u];u--)f++;if(u>=0&&f++,c=c.dblp(f),u<0)break;var l=s[u];a(0!==l),c="affine"===e.type?l>0?c.mixedAdd(i[l-1>>1]):c.mixedAdd(i[-l-1>>1].neg()):l>0?c.add(i[l-1>>1]):c.add(i[-l-1>>1].neg())}return"affine"===e.type?c.toP():c},c.prototype._wnafMulAdd=function(e,t,r,n,i){var a,c,u,f=this._wnafT1,l=this._wnafT2,h=this._wnafT3,d=0;for(a=0;a=1;a-=2){var y=a-1,g=a;if(1===f[y]&&1===f[g]){var b=[t[y],null,null,t[g]];0===t[y].y.cmp(t[g].y)?(b[1]=t[y].add(t[g]),b[2]=t[y].toJ().mixedAdd(t[g].neg())):0===t[y].y.cmp(t[g].y.redNeg())?(b[1]=t[y].toJ().mixedAdd(t[g]),b[2]=t[y].add(t[g].neg())):(b[1]=t[y].toJ().mixedAdd(t[g]),b[2]=t[y].toJ().mixedAdd(t[g].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],v=s(r[y],r[g]);for(d=Math.max(v[0].length,d),h[y]=new Array(d),h[g]=new Array(d),c=0;c=0;a--){for(var A=0;a>=0;){var T=!0;for(c=0;c=0&&A++,_=_.dblp(A),a<0)break;for(c=0;c0?u=l[c][I-1>>1]:I<0&&(u=l[c][-I-1>>1].neg()),_="affine"===u.type?_.mixedAdd(u):_.add(u))}}for(a=0;a=Math.ceil((e.bitLength()+1)/t.step)},u.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i{"use strict";var n=r(80953),i=r(13550),o=r(35717),s=r(4918),a=n.assert;function c(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,s.call(this,"edwards",e),this.a=new i(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new i(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new i(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),a(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}function u(e,t,r,n,o){s.BasePoint.call(this,e,"projective"),null===t&&null===r&&null===n?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new i(t,16),this.y=new i(r,16),this.z=n?new i(n,16):this.curve.one,this.t=o&&new i(o,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}o(c,s),e.exports=c,c.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},c.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},c.prototype.jpoint=function(e,t,r,n){return this.point(e,t,r,n)},c.prototype.pointFromX=function(e,t){(e=new i(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=this.c2.redSub(this.a.redMul(r)),o=this.one.redSub(this.c2.redMul(this.d).redMul(r)),s=n.redMul(o.redInvm()),a=s.redSqrt();if(0!==a.redSqr().redSub(s).cmp(this.zero))throw new Error("invalid point");var c=a.fromRed().isOdd();return(t&&!c||!t&&c)&&(a=a.redNeg()),this.point(e,a)},c.prototype.pointFromY=function(e,t){(e=new i(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=r.redSub(this.c2),o=r.redMul(this.d).redMul(this.c2).redSub(this.a),s=n.redMul(o.redInvm());if(0===s.cmp(this.zero)){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var a=s.redSqrt();if(0!==a.redSqr().redSub(s).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==t&&(a=a.redNeg()),this.point(a,e)},c.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),r=e.y.redSqr(),n=t.redMul(this.a).redAdd(r),i=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(r)));return 0===n.cmp(i)},o(u,s.BasePoint),c.prototype.pointFromJSON=function(e){return u.fromJSON(this,e)},c.prototype.point=function(e,t,r,n){return new u(this,e,t,r,n)},u.fromJSON=function(e,t){return new u(e,t[0],t[1],t[2])},u.prototype.inspect=function(){return this.isInfinity()?"":""},u.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},u.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),o=n.redAdd(t),s=o.redSub(r),a=n.redSub(t),c=i.redMul(s),u=o.redMul(a),f=i.redMul(a),l=s.redMul(o);return this.curve.point(c,u,l,f)},u.prototype._projDbl=function(){var e,t,r,n,i,o,s=this.x.redAdd(this.y).redSqr(),a=this.x.redSqr(),c=this.y.redSqr();if(this.curve.twisted){var u=(n=this.curve._mulA(a)).redAdd(c);this.zOne?(e=s.redSub(a).redSub(c).redMul(u.redSub(this.curve.two)),t=u.redMul(n.redSub(c)),r=u.redSqr().redSub(u).redSub(u)):(i=this.z.redSqr(),o=u.redSub(i).redISub(i),e=s.redSub(a).redISub(c).redMul(o),t=u.redMul(n.redSub(c)),r=u.redMul(o))}else n=a.redAdd(c),i=this.curve._mulC(this.z).redSqr(),o=n.redSub(i).redSub(i),e=this.curve._mulC(s.redISub(n)).redMul(o),t=this.curve._mulC(n).redMul(a.redISub(c)),r=n.redMul(o);return this.curve.point(e,t,r)},u.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},u.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),o=r.redSub(t),s=i.redSub(n),a=i.redAdd(n),c=r.redAdd(t),u=o.redMul(s),f=a.redMul(c),l=o.redMul(c),h=s.redMul(a);return this.curve.point(u,f,h,l)},u.prototype._projAdd=function(e){var t,r,n=this.z.redMul(e.z),i=n.redSqr(),o=this.x.redMul(e.x),s=this.y.redMul(e.y),a=this.curve.d.redMul(o).redMul(s),c=i.redSub(a),u=i.redAdd(a),f=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(s),l=n.redMul(c).redMul(f);return this.curve.twisted?(t=n.redMul(u).redMul(s.redSub(this.curve._mulA(o))),r=c.redMul(u)):(t=n.redMul(u).redMul(s.redSub(o)),r=this.curve._mulC(c).redMul(u)),this.curve.point(l,t,r)},u.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},u.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},u.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},u.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},u.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},u.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()},u.prototype.getY=function(){return this.normalize(),this.y.fromRed()},u.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},u.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var r=e.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(n),0===this.x.cmp(t))return!0}},u.prototype.toP=u.prototype.normalize,u.prototype.mixedAdd=u.prototype.add},88254:(e,t,r)=>{"use strict";var n=t;n.base=r(4918),n.short=r(6673),n.mont=r(22881),n.edwards=r(31138)},22881:(e,t,r)=>{"use strict";var n=r(13550),i=r(35717),o=r(4918),s=r(80953);function a(e){o.call(this,"mont",e),this.a=new n(e.a,16).toRed(this.red),this.b=new n(e.b,16).toRed(this.red),this.i4=new n(4).toRed(this.red).redInvm(),this.two=new n(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function c(e,t,r){o.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new n(t,16),this.z=new n(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}i(a,o),e.exports=a,a.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),n=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===n.redSqrt().redSqr().cmp(n)},i(c,o.BasePoint),a.prototype.decodePoint=function(e,t){return this.point(s.toArray(e,t),1)},a.prototype.point=function(e,t){return new c(this,e,t)},a.prototype.pointFromJSON=function(e){return c.fromJSON(this,e)},c.prototype.precompute=function(){},c.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},c.fromJSON=function(e,t){return new c(e,t[0],t[1]||e.one)},c.prototype.inspect=function(){return this.isInfinity()?"":""},c.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},c.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),n=e.redMul(t),i=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,i)},c.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=e.x.redAdd(e.z),o=e.x.redSub(e.z).redMul(r),s=i.redMul(n),a=t.z.redMul(o.redAdd(s).redSqr()),c=t.x.redMul(o.redISub(s).redSqr());return this.curve.point(a,c)},c.prototype.mul=function(e){for(var t=e.clone(),r=this,n=this.curve.point(null,null),i=[];0!==t.cmpn(0);t.iushrn(1))i.push(t.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},c.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},c.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},6673:(e,t,r)=>{"use strict";var n=r(80953),i=r(13550),o=r(35717),s=r(4918),a=n.assert;function c(e){s.call(this,"short",e),this.a=new i(e.a,16).toRed(this.red),this.b=new i(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function u(e,t,r,n){s.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(t,16),this.y=new i(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function f(e,t,r,n){s.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(t,16),this.y=new i(r,16),this.z=new i(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(c,s),e.exports=c,c.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new i(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(e.lambda)r=new i(e.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(t))?r=o[0]:(r=o[1],a(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map((function(e){return{a:new i(e.a,16),b:new i(e.b,16)}})):this._getEndoBasis(r)}}},c.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:i.mont(e),r=new i(2).toRed(t).redInvm(),n=r.redNeg(),o=new i(3).toRed(t).redNeg().redSqrt().redMul(r);return[n.redAdd(o).fromRed(),n.redSub(o).fromRed()]},c.prototype._getEndoBasis=function(e){for(var t,r,n,o,s,a,c,u,f,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),h=e,d=this.n.clone(),p=new i(1),y=new i(0),g=new i(0),b=new i(1),m=0;0!==h.cmpn(0);){var v=d.div(h);u=d.sub(v.mul(h)),f=g.sub(v.mul(p));var w=b.sub(v.mul(y));if(!n&&u.cmp(l)<0)t=c.neg(),r=p,n=u.neg(),o=f;else if(n&&2==++m)break;c=u,d=h,h=u,g=p,p=f,b=y,y=w}s=u.neg(),a=f;var E=n.sqr().add(o.sqr());return s.sqr().add(a.sqr()).cmp(E)>=0&&(s=t,a=r),n.negative&&(n=n.neg(),o=o.neg()),s.negative&&(s=s.neg(),a=a.neg()),[{a:n,b:o},{a:s,b:a}]},c.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],i=n.b.mul(e).divRound(this.n),o=r.b.neg().mul(e).divRound(this.n),s=i.mul(r.a),a=o.mul(n.a),c=i.mul(r.b),u=o.mul(n.b);return{k1:e.sub(s).sub(a),k2:c.add(u).neg()}},c.prototype.pointFromX=function(e,t){(e=new i(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var o=n.fromRed().isOdd();return(t&&!o||!t&&o)&&(n=n.redNeg()),this.point(e,n)},c.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},c.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},u.prototype.isInfinity=function(){return this.inf},u.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},u.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},u.prototype.getX=function(){return this.x.fromRed()},u.prototype.getY=function(){return this.y.fromRed()},u.prototype.mul=function(e){return e=new i(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},u.prototype.mulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},u.prototype.jmulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},u.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},u.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},u.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(f,s.BasePoint),c.prototype.jpoint=function(e,t,r){return new f(this,e,t,r)},f.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},f.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},f.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),i=e.x.redMul(r),o=this.y.redMul(t.redMul(e.z)),s=e.y.redMul(r.redMul(this.z)),a=n.redSub(i),c=o.redSub(s);if(0===a.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),f=u.redMul(a),l=n.redMul(u),h=c.redSqr().redIAdd(f).redISub(l).redISub(l),d=c.redMul(l.redISub(h)).redISub(o.redMul(f)),p=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(h,d,p)},f.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),s=r.redSub(n),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),u=c.redMul(s),f=r.redMul(c),l=a.redSqr().redIAdd(u).redISub(f).redISub(f),h=a.redMul(f.redISub(l)).redISub(i.redMul(u)),d=this.z.redMul(s);return this.curve.jpoint(l,h,d)},f.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},f.prototype.inspect=function(){return this.isInfinity()?"":""},f.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},45427:(e,t,r)=>{"use strict";var n,i=t,o=r(33715),s=r(88254),a=r(80953).assert;function c(e){"short"===e.type?this.curve=new s.short(e):"edwards"===e.type?this.curve=new s.edwards(e):this.curve=new s.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function u(e,t){Object.defineProperty(i,e,{configurable:!0,enumerable:!0,get:function(){var r=new c(t);return Object.defineProperty(i,e,{configurable:!0,enumerable:!0,value:r}),r}})}i.PresetCurve=c,u("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),u("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),u("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),u("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),u("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),u("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),u("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=r(91037)}catch(e){n=void 0}u("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})},57954:(e,t,r)=>{"use strict";var n=r(13550),i=r(2156),o=r(80953),s=r(45427),a=r(29931),c=o.assert,u=r(31251),f=r(90611);function l(e){if(!(this instanceof l))return new l(e);"string"==typeof e&&(c(Object.prototype.hasOwnProperty.call(s,e),"Unknown curve "+e),e=s[e]),e instanceof s.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}e.exports=l,l.prototype.keyPair=function(e){return new u(this,e)},l.prototype.keyFromPrivate=function(e,t){return u.fromPrivate(this,e,t)},l.prototype.keyFromPublic=function(e,t){return u.fromPublic(this,e,t)},l.prototype.genKeyPair=function(e){e||(e={});for(var t=new i({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||a(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),o=this.n.sub(new n(2));;){var s=new n(t.generate(r));if(!(s.cmp(o)>0))return s.iaddn(1),this.keyFromPrivate(s)}},l.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},l.prototype.sign=function(e,t,r,o){"object"==typeof r&&(o=r,r=null),o||(o={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new n(e,16));for(var s=this.n.byteLength(),a=t.getPrivate().toArray("be",s),c=e.toArray("be",s),u=new i({hash:this.hash,entropy:a,nonce:c,pers:o.pers,persEnc:o.persEnc||"utf8"}),l=this.n.sub(new n(1)),h=0;;h++){var d=o.k?o.k(h):new n(u.generate(this.n.byteLength()));if(!((d=this._truncateToN(d,!0)).cmpn(1)<=0||d.cmp(l)>=0)){var p=this.g.mul(d);if(!p.isInfinity()){var y=p.getX(),g=y.umod(this.n);if(0!==g.cmpn(0)){var b=d.invm(this.n).mul(g.mul(t.getPrivate()).iadd(e));if(0!==(b=b.umod(this.n)).cmpn(0)){var m=(p.getY().isOdd()?1:0)|(0!==y.cmp(g)?2:0);return o.canonical&&b.cmp(this.nh)>0&&(b=this.n.sub(b),m^=1),new f({r:g,s:b,recoveryParam:m})}}}}}},l.prototype.verify=function(e,t,r,i){e=this._truncateToN(new n(e,16)),r=this.keyFromPublic(r,i);var o=(t=new f(t,"hex")).r,s=t.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var a,c=s.invm(this.n),u=c.mul(e).umod(this.n),l=c.mul(o).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(u,r.getPublic(),l)).isInfinity()&&a.eqXToP(o):!(a=this.g.mulAdd(u,r.getPublic(),l)).isInfinity()&&0===a.getX().umod(this.n).cmp(o)},l.prototype.recoverPubKey=function(e,t,r,i){c((3&r)===r,"The recovery param is more than two bits"),t=new f(t,i);var o=this.n,s=new n(e),a=t.r,u=t.s,l=1&r,h=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&h)throw new Error("Unable to find sencond key candinate");a=h?this.curve.pointFromX(a.add(this.curve.n),l):this.curve.pointFromX(a,l);var d=t.r.invm(o),p=o.sub(s).mul(d).umod(o),y=u.mul(d).umod(o);return this.g.mulAdd(p,a,y)},l.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new f(t,n)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},31251:(e,t,r)=>{"use strict";var n=r(13550),i=r(80953).assert;function o(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}e.exports=o,o.fromPublic=function(e,t,r){return t instanceof o?t:new o(e,{pub:t,pubEnc:r})},o.fromPrivate=function(e,t,r){return t instanceof o?t:new o(e,{priv:t,privEnc:r})},o.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},o.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(e,t){this.priv=new n(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?i(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},o.prototype.derive=function(e){return e.validate()||i(e.validate(),"public point not validated"),e.mul(this.priv).getX()},o.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},o.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},o.prototype.inspect=function(){return""}},90611:(e,t,r)=>{"use strict";var n=r(13550),i=r(80953),o=i.assert;function s(e,t){if(e instanceof s)return e;this._importDER(e,t)||(o(e.r&&e.s,"Signature without r or s"),this.r=new n(e.r,16),this.s=new n(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function a(){this.place=0}function c(e,t){var r=e[t.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,o=0,s=t.place;o>>=0;return!(i<=127)&&(t.place=s,i)}function u(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}e.exports=s,s.prototype._importDER=function(e,t){e=i.toArray(e,t);var r=new a;if(48!==e[r.place++])return!1;var o=c(e,r);if(!1===o)return!1;if(o+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var s=c(e,r);if(!1===s)return!1;var u=e.slice(r.place,s+r.place);if(r.place+=s,2!==e[r.place++])return!1;var f=c(e,r);if(!1===f)return!1;if(e.length!==f+r.place)return!1;var l=e.slice(r.place,f+r.place);if(0===u[0]){if(!(128&u[1]))return!1;u=u.slice(1)}if(0===l[0]){if(!(128&l[1]))return!1;l=l.slice(1)}return this.r=new n(u),this.s=new n(l),this.recoveryParam=null,!0},s.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=u(t),r=u(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];f(n,t.length),(n=n.concat(t)).push(2),f(n,r.length);var o=n.concat(r),s=[48];return f(s,o.length),s=s.concat(o),i.encode(s,e)}},65980:(e,t,r)=>{"use strict";var n=r(33715),i=r(45427),o=r(80953),s=o.assert,a=o.parseBytes,c=r(79087),u=r(23622);function f(e){if(s("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof f))return new f(e);e=i[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=n.sha512}e.exports=f,f.prototype.sign=function(e,t){e=a(e);var r=this.keyFromSecret(t),n=this.hashInt(r.messagePrefix(),e),i=this.g.mul(n),o=this.encodePoint(i),s=this.hashInt(o,r.pubBytes(),e).mul(r.priv()),c=n.add(s).umod(this.curve.n);return this.makeSignature({R:i,S:c,Rencoded:o})},f.prototype.verify=function(e,t,r){e=a(e),t=this.makeSignature(t);var n=this.keyFromPublic(r),i=this.hashInt(t.Rencoded(),n.pubBytes(),e),o=this.g.mul(t.S());return t.R().add(n.pub().mul(i)).eq(o)},f.prototype.hashInt=function(){for(var e=this.hash(),t=0;t{"use strict";var n=r(80953),i=n.assert,o=n.parseBytes,s=n.cachedProperty;function a(e,t){this.eddsa=e,this._secret=o(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=o(t.pub)}a.fromPublic=function(e,t){return t instanceof a?t:new a(e,{pub:t})},a.fromSecret=function(e,t){return t instanceof a?t:new a(e,{secret:t})},a.prototype.secret=function(){return this._secret},s(a,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),s(a,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),s(a,"privBytes",(function(){var e=this.eddsa,t=this.hash(),r=e.encodingLength-1,n=t.slice(0,e.encodingLength);return n[0]&=248,n[r]&=127,n[r]|=64,n})),s(a,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),s(a,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),s(a,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),a.prototype.sign=function(e){return i(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},a.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},a.prototype.getSecret=function(e){return i(this._secret,"KeyPair is public only"),n.encode(this.secret(),e)},a.prototype.getPublic=function(e){return n.encode(this.pubBytes(),e)},e.exports=a},23622:(e,t,r)=>{"use strict";var n=r(13550),i=r(80953),o=i.assert,s=i.cachedProperty,a=i.parseBytes;function c(e,t){this.eddsa=e,"object"!=typeof t&&(t=a(t)),Array.isArray(t)&&(t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),o(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof n&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}s(c,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),s(c,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),s(c,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),s(c,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),c.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},c.prototype.toHex=function(){return i.encode(this.toBytes(),"hex").toUpperCase()},e.exports=c},91037:e=>{e.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}},80953:(e,t,r)=>{"use strict";var n=t,i=r(13550),o=r(79746),s=r(34504);n.assert=o,n.toArray=s.toArray,n.zero2=s.zero2,n.toHex=s.toHex,n.encode=s.encode,n.getNAF=function(e,t,r){var n=new Array(Math.max(e.bitLength(),r)+1);n.fill(0);for(var i=1<(i>>1)-1?(i>>1)-c:c,o.isubn(a)):a=0,n[s]=a,o.iushrn(1)}return n},n.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n,i=0,o=0;e.cmpn(-i)>0||t.cmpn(-o)>0;){var s,a,c=e.andln(3)+i&3,u=t.andln(3)+o&3;3===c&&(c=-1),3===u&&(u=-1),s=0==(1&c)?0:3!=(n=e.andln(7)+i&7)&&5!==n||2!==u?c:-c,r[0].push(s),a=0==(1&u)?0:3!=(n=t.andln(7)+o&7)&&5!==n||2!==c?u:-u,r[1].push(a),2*i===s+1&&(i=1-i),2*o===a+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return r},n.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},n.parseBytes=function(e){return"string"==typeof e?n.toArray(e,"hex"):e},n.intFromLE=function(e){return new i(e,"hex","le")}},62378:e=>{"use strict";e.exports=function(e){for(var t=[],r=e.length,n=0;n=55296&&i<=56319&&r>n+1){var o=e.charCodeAt(n+1);o>=56320&&o<=57343&&(i=1024*(i-55296)+o-56320+65536,n+=1)}i<128?t.push(i):i<2048?(t.push(i>>6|192),t.push(63&i|128)):i<55296||i>=57344&&i<65536?(t.push(i>>12|224),t.push(i>>6&63|128),t.push(63&i|128)):i>=65536&&i<=1114111?(t.push(i>>18|240),t.push(i>>12&63|128),t.push(i>>6&63|128),t.push(63&i|128)):t.push(239,191,189)}return new Uint8Array(t).buffer}},32114:e=>{"use strict";function t(e,t){for(const r in t)Object.defineProperty(e,r,{value:t[r],enumerable:!0,configurable:!0});return e}e.exports=function(e,r,n){if(!e||"string"==typeof e)throw new TypeError("Please pass an Error to err-code");n||(n={}),"object"==typeof r&&(n=r,r=""),r&&(n.code=r);try{return t(e,n)}catch(r){n.message=e.message,n.stack=e.stack;const i=function(){};return i.prototype=Object.create(Object.getPrototypeOf(e)),t(new i,n)}}},76021:(e,t)=>{"use strict";function r(e){if("function"!=typeof e)throw new TypeError("Argument to promisify must be a function");var t=e["__ES6-PROMISIFY--CUSTOM-ARGUMENTS__"],n=r.Promise||Promise;if("function"!=typeof n)throw new Error("No Promise implementation found; do you need a polyfill?");return function(){for(var r=this,i=arguments.length,o=Array(i),s=0;s{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(8231);t.EventIterator=n.EventIterator,t.subscribe=function(e,t,r){return new n.EventIterator((({push:r})=>(this.addEventListener(e,r,t),()=>this.removeEventListener(e,r,t))),r)},t.default=n.EventIterator},8231:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class r{constructor(){this.pullQueue=[],this.pushQueue=[],this.eventHandlers={},this.isPaused=!1,this.isStopped=!1}push(e){if(this.isStopped)return;const t={value:e,done:!1};if(this.pullQueue.length){const e=this.pullQueue.shift();e&&e.resolve(t)}else this.pushQueue.push(Promise.resolve(t)),void 0!==this.highWaterMark&&this.pushQueue.length>=this.highWaterMark&&!this.isPaused&&(this.isPaused=!0,this.eventHandlers.highWater?this.eventHandlers.highWater():console&&console.warn(`EventIterator queue reached ${this.pushQueue.length} items`))}stop(){if(!this.isStopped){this.isStopped=!0,this.remove();for(const e of this.pullQueue)e.resolve({value:void 0,done:!0});this.pullQueue.length=0}}fail(e){if(!this.isStopped)if(this.isStopped=!0,this.remove(),this.pullQueue.length){for(const t of this.pullQueue)t.reject(e);this.pullQueue.length=0}else{const t=Promise.reject(e);t.catch((()=>{})),this.pushQueue.push(t)}}remove(){Promise.resolve().then((()=>{this.removeCallback&&this.removeCallback()}))}[Symbol.asyncIterator](){return{next:e=>{const t=this.pushQueue.shift();return t?(void 0!==this.lowWaterMark&&this.pushQueue.length<=this.lowWaterMark&&this.isPaused&&(this.isPaused=!1,this.eventHandlers.lowWater&&this.eventHandlers.lowWater()),t):this.isStopped?Promise.resolve({value:void 0,done:!0}):new Promise(((e,t)=>{this.pullQueue.push({resolve:e,reject:t})}))},return:()=>(this.isStopped=!0,this.pushQueue.length=0,this.remove(),Promise.resolve({value:void 0,done:!0}))}}}class n{constructor(e,{highWaterMark:t=100,lowWaterMark:n=1}={}){const i=new r;i.highWaterMark=t,i.lowWaterMark=n,i.removeCallback=e({push:e=>i.push(e),stop:()=>i.stop(),fail:e=>i.fail(e),on:(e,t)=>{i.eventHandlers[e]=t}})||(()=>{}),this[Symbol.asyncIterator]=()=>i[Symbol.asyncIterator](),Object.freeze(this)}}t.EventIterator=n,t.default=n},17187:e=>{"use strict";var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}y(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&y(e,"error",t,{once:!0})}(e,i)}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function u(e,t,r,n){var i,o,s,u;if(a(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),s=o[t]),void 0===s)s=o[t]=r,++e._eventsCount;else if("function"==typeof s?s=o[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=c(e))>0&&s.length>i&&!s.warned){s.warned=!0;var f=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");f.name="MaxListenersExceededWarning",f.emitter=e,f.type=t,f.count=s.length,u=f,console&&console.warn&&console.warn(u)}return e}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function l(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=f.bind(n);return i.listener=r,n.wrapFn=i,i}function h(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=o[e];if(void 0===c)return!1;if("function"==typeof c)n(c,this,t);else{var u=c.length,f=p(c,u);for(r=0;r=0;o--)if(r[o]===t||r[o].listener===t){s=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1=0;n--)this.removeListener(e,t[n]);return this},o.prototype.listeners=function(e){return h(this,e,!0)},o.prototype.rawListeners=function(e){return h(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):d.call(e,t)},o.prototype.listenerCount=d,o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},3975:e=>{e.exports=class{constructor(e){if(!(e>0)||0!=(e-1&e))throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e),this.mask=e-1,this.top=0,this.btm=0,this.next=null}push(e){return void 0===this.buffer[this.top]&&(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){const e=this.buffer[this.btm];if(void 0!==e)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}peek(){return this.buffer[this.btm]}isEmpty(){return void 0===this.buffer[this.btm]}}},91607:(e,t,r)=>{const n=r(3975);e.exports=class{constructor(e){this.hwm=e||16,this.head=new n(this.hwm),this.tail=this.head}push(e){if(!this.head.push(e)){const t=this.head;this.head=t.next=new n(2*this.head.buffer.length),this.head.push(e)}}shift(){const e=this.tail.shift();if(void 0===e&&this.tail.next){const e=this.tail.next;return this.tail.next=null,this.tail=e,this.tail.shift()}return e}peek(){return this.tail.peek()}isEmpty(){return this.head.isEmpty()}}},22412:e=>{e.exports=function(e){if(e){if("function"==typeof e[Symbol.iterator])return e[Symbol.iterator]();if("function"==typeof e[Symbol.asyncIterator])return e[Symbol.asyncIterator]();if("function"==typeof e.next)return e}throw new Error("argument is not an iterator or iterable")}},33715:(e,t,r)=>{var n=t;n.utils=r(26436),n.common=r(95772),n.sha=r(89041),n.ripemd=r(12949),n.hmac=r(52344),n.sha1=n.sha.sha1,n.sha256=n.sha.sha256,n.sha224=n.sha.sha224,n.sha384=n.sha.sha384,n.sha512=n.sha.sha512,n.ripemd160=n.ripemd.ripemd160},95772:(e,t,r)=>{"use strict";var n=r(26436),i=r(79746);function o(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}t.BlockHash=o,o.prototype.update=function(e,t){if(e=n.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=n.join32(e,0,e.length-r,this.endian);for(var i=0;i>>24&255,n[i++]=e>>>16&255,n[i++]=e>>>8&255,n[i++]=255&e}else for(n[i++]=255&e,n[i++]=e>>>8&255,n[i++]=e>>>16&255,n[i++]=e>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;o{"use strict";var n=r(26436),i=r(79746);function o(e,t,r){if(!(this instanceof o))return new o(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(n.toArray(t,r))}e.exports=o,o.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),i(e.length<=this.blockSize);for(var t=e.length;t{"use strict";var n=r(26436),i=r(95772),o=n.rotl32,s=n.sum32,a=n.sum32_3,c=n.sum32_4,u=i.BlockHash;function f(){if(!(this instanceof f))return new f;u.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function l(e,t,r,n){return e<=15?t^r^n:e<=31?t&r|~t&n:e<=47?(t|~r)^n:e<=63?t&n|r&~n:t^(r|~n)}function h(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function d(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}n.inherits(f,u),t.ripemd160=f,f.blockSize=512,f.outSize=160,f.hmacStrength=192,f.padLength=64,f.prototype._update=function(e,t){for(var r=this.h[0],n=this.h[1],i=this.h[2],u=this.h[3],f=this.h[4],m=r,v=n,w=i,E=u,_=f,S=0;S<80;S++){var A=s(o(c(r,l(S,n,i,u),e[p[S]+t],h(S)),g[S]),f);r=f,f=u,u=o(i,10),i=n,n=A,A=s(o(c(m,l(79-S,v,w,E),e[y[S]+t],d(S)),b[S]),_),m=_,_=E,E=o(w,10),w=v,v=A}A=a(this.h[1],i,E),this.h[1]=a(this.h[2],u,_),this.h[2]=a(this.h[3],f,m),this.h[3]=a(this.h[4],r,v),this.h[4]=a(this.h[0],n,w),this.h[0]=A},f.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h,"little"):n.split32(this.h,"little")};var p=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],y=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],g=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],b=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},89041:(e,t,r)=>{"use strict";t.sha1=r(84761),t.sha224=r(10799),t.sha256=r(89344),t.sha384=r(80772),t.sha512=r(45900)},84761:(e,t,r)=>{"use strict";var n=r(26436),i=r(95772),o=r(37038),s=n.rotl32,a=n.sum32,c=n.sum32_5,u=o.ft_1,f=i.BlockHash,l=[1518500249,1859775393,2400959708,3395469782];function h(){if(!(this instanceof h))return new h;f.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}n.inherits(h,f),e.exports=h,h.blockSize=512,h.outSize=160,h.hmacStrength=80,h.padLength=64,h.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n{"use strict";var n=r(26436),i=r(89344);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}n.inherits(o,i),e.exports=o,o.blockSize=512,o.outSize=224,o.hmacStrength=192,o.padLength=64,o.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h.slice(0,7),"big"):n.split32(this.h.slice(0,7),"big")}},89344:(e,t,r)=>{"use strict";var n=r(26436),i=r(95772),o=r(37038),s=r(79746),a=n.sum32,c=n.sum32_4,u=n.sum32_5,f=o.ch32,l=o.maj32,h=o.s0_256,d=o.s1_256,p=o.g0_256,y=o.g1_256,g=i.BlockHash,b=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function m(){if(!(this instanceof m))return new m;g.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=b,this.W=new Array(64)}n.inherits(m,g),e.exports=m,m.blockSize=512,m.outSize=256,m.hmacStrength=192,m.padLength=64,m.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n{"use strict";var n=r(26436),i=r(45900);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}n.inherits(o,i),e.exports=o,o.blockSize=1024,o.outSize=384,o.hmacStrength=192,o.padLength=128,o.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h.slice(0,12),"big"):n.split32(this.h.slice(0,12),"big")}},45900:(e,t,r)=>{"use strict";var n=r(26436),i=r(95772),o=r(79746),s=n.rotr64_hi,a=n.rotr64_lo,c=n.shr64_hi,u=n.shr64_lo,f=n.sum64,l=n.sum64_hi,h=n.sum64_lo,d=n.sum64_4_hi,p=n.sum64_4_lo,y=n.sum64_5_hi,g=n.sum64_5_lo,b=i.BlockHash,m=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function v(){if(!(this instanceof v))return new v;b.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=m,this.W=new Array(160)}function w(e,t,r,n,i){var o=e&r^~e&i;return o<0&&(o+=4294967296),o}function E(e,t,r,n,i,o){var s=t&n^~t&o;return s<0&&(s+=4294967296),s}function _(e,t,r,n,i){var o=e&r^e&i^r&i;return o<0&&(o+=4294967296),o}function S(e,t,r,n,i,o){var s=t&n^t&o^n&o;return s<0&&(s+=4294967296),s}function A(e,t){var r=s(e,t,28)^s(t,e,2)^s(t,e,7);return r<0&&(r+=4294967296),r}function T(e,t){var r=a(e,t,28)^a(t,e,2)^a(t,e,7);return r<0&&(r+=4294967296),r}function I(e,t){var r=a(e,t,14)^a(e,t,18)^a(t,e,9);return r<0&&(r+=4294967296),r}function C(e,t){var r=s(e,t,1)^s(e,t,8)^c(e,t,7);return r<0&&(r+=4294967296),r}function P(e,t){var r=a(e,t,1)^a(e,t,8)^u(e,t,7);return r<0&&(r+=4294967296),r}function R(e,t){var r=a(e,t,19)^a(t,e,29)^u(e,t,6);return r<0&&(r+=4294967296),r}n.inherits(v,b),e.exports=v,v.blockSize=1024,v.outSize=512,v.hmacStrength=192,v.padLength=128,v.prototype._prepareBlock=function(e,t){for(var r=this.W,n=0;n<32;n++)r[n]=e[t+n];for(;n{"use strict";var n=r(26436).rotr32;function i(e,t,r){return e&t^~e&r}function o(e,t,r){return e&t^e&r^t&r}function s(e,t,r){return e^t^r}t.ft_1=function(e,t,r,n){return 0===e?i(t,r,n):1===e||3===e?s(t,r,n):2===e?o(t,r,n):void 0},t.ch32=i,t.maj32=o,t.p32=s,t.s0_256=function(e){return n(e,2)^n(e,13)^n(e,22)},t.s1_256=function(e){return n(e,6)^n(e,11)^n(e,25)},t.g0_256=function(e){return n(e,7)^n(e,18)^e>>>3},t.g1_256=function(e){return n(e,17)^n(e,19)^e>>>10}},26436:(e,t,r)=>{"use strict";var n=r(79746),i=r(35717);function o(e,t){return 55296==(64512&e.charCodeAt(t))&&!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1))}function s(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function a(e){return 1===e.length?"0"+e:e}function c(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=i,t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),i=0;i>6|192,r[n++]=63&s|128):o(e,i)?(s=65536+((1023&s)<<10)+(1023&e.charCodeAt(++i)),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=63&s|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=63&s|128)}else for(i=0;i>>0}return s},t.split32=function(e,t){for(var r=new Array(4*e.length),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},t.rotr32=function(e,t){return e>>>t|e<<32-t},t.rotl32=function(e,t){return e<>>32-t},t.sum32=function(e,t){return e+t>>>0},t.sum32_3=function(e,t,r){return e+t+r>>>0},t.sum32_4=function(e,t,r,n){return e+t+r+n>>>0},t.sum32_5=function(e,t,r,n,i){return e+t+r+n+i>>>0},t.sum64=function(e,t,r,n){var i=e[t],o=n+e[t+1]>>>0,s=(o>>0,e[t+1]=o},t.sum64_hi=function(e,t,r,n){return(t+n>>>0>>0},t.sum64_lo=function(e,t,r,n){return t+n>>>0},t.sum64_4_hi=function(e,t,r,n,i,o,s,a){var c=0,u=t;return c+=(u=u+n>>>0)>>0)>>0)>>0},t.sum64_4_lo=function(e,t,r,n,i,o,s,a){return t+n+o+a>>>0},t.sum64_5_hi=function(e,t,r,n,i,o,s,a,c,u){var f=0,l=t;return f+=(l=l+n>>>0)>>0)>>0)>>0)>>0},t.sum64_5_lo=function(e,t,r,n,i,o,s,a,c,u){return t+n+o+a+u>>>0},t.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},t.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},t.shr64_hi=function(e,t,r){return e>>>r},t.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},70248:e=>{e.exports=function(e){if(!e)throw Error("hashlru must have a max value, of type number, greater than 0");var t=0,r=Object.create(null),n=Object.create(null);function i(i,o){r[i]=o,++t>=e&&(t=0,n=r,r=Object.create(null))}return{has:function(e){return void 0!==r[e]||void 0!==n[e]},remove:function(e){void 0!==r[e]&&(r[e]=void 0),void 0!==n[e]&&(n[e]=void 0)},get:function(e){var t=r[e];return void 0!==t?t:void 0!==(t=n[e])?(i(e,t),t):void 0},set:function(e,t){void 0!==r[e]?r[e]=t:i(e,t)},clear:function(){r=Object.create(null),n=Object.create(null)}}}},2156:(e,t,r)=>{"use strict";var n=r(33715),i=r(34504),o=r(79746);function s(e){if(!(this instanceof s))return new s(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=i.toArray(e.entropy,e.entropyEnc||"hex"),r=i.toArray(e.nonce,e.nonceEnc||"hex"),n=i.toArray(e.pers,e.persEnc||"hex");o(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}e.exports=s,s.prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},s.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(n=r,r=t,t=null),r&&(r=i.toArray(r,n||"hex"),this._update(r));for(var o=[];o.length{t.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,c=(1<>1,f=-7,l=r?i-1:0,h=r?-1:1,d=e[t+l];for(l+=h,o=d&(1<<-f)-1,d>>=-f,f+=a;f>0;o=256*o+e[t+l],l+=h,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=n;f>0;s=256*s+e[t+l],l+=h,f-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),o-=u}return(d?-1:1)*s*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var s,a,c,u=8*o-i-1,f=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+l>=1?h/c:h*Math.pow(2,1-l))*c>=2&&(s++,c/=2),s+l>=f?(a=0,s=f):s+l>=1?(a=(t*c-1)*Math.pow(2,i),s+=l):(a=t*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;e[r+d]=255&a,d+=p,a/=256,i-=8);for(s=s<0;e[r+d]=255&s,d+=p,s/=256,u-=8);e[r+d-p]|=128*y}},95602:e=>{"use strict";e.exports=(e,t=1,r)=>{if(r={indent:" ",includeEmptyLines:!1,...r},"string"!=typeof e)throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof e}\``);if("number"!=typeof t)throw new TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof t}\``);if("string"!=typeof r.indent)throw new TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof r.indent}\``);if(0===t)return e;const n=r.includeEmptyLines?/^/gm:/^(?!\s*$)/gm;return e.replace(n,r.indent.repeat(t))}},35717:e=>{"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},91843:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.v6=t.AddressError=t.Address6=t.Address4=void 0;var s=r(62507);Object.defineProperty(t,"Address4",{enumerable:!0,get:function(){return s.Address4}});var a=r(76862);Object.defineProperty(t,"Address6",{enumerable:!0,get:function(){return a.Address6}});var c=r(64762);Object.defineProperty(t,"AddressError",{enumerable:!0,get:function(){return c.AddressError}});var u=o(r(16454));t.v6={helpers:u}},64762:function(e,t){"use strict";var r,n=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},r(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.AddressError=void 0;var i=function(e){function t(t,r){var n=e.call(this,t)||this;return n.name="AddressError",null!==r&&(n.parseMessage=r),n}return n(t,e),t}(Error);t.AddressError=i},72029:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isCorrect=t.isInSubnet=void 0,t.isInSubnet=function(e){return!(this.subnetMaska.BITS)throw new c.AddressError("Invalid subnet mask.");e=e.replace(a.RE_SUBNET_STRING,"")}this.addressMinusSuffix=e,this.parsedAddress=this.parse(e)}return e.isValid=function(t){try{return new e(t),!0}catch(e){return!1}},e.prototype.parse=function(e){var t=e.split(".");if(!e.match(a.RE_ADDRESS))throw new c.AddressError("Invalid IPv4 address.");return t},e.prototype.correctForm=function(){return this.parsedAddress.map((function(e){return parseInt(e,10)})).join(".")},e.fromHex=function(t){var r,n=t.replace(/:/g,"").padStart(8,"0"),i=[];for(r=0;r<8;r+=2){var o=n.slice(r,r+2);i.push(parseInt(o,16))}return new e(i.join("."))},e.fromInteger=function(t){return e.fromHex(t.toString(16))},e.fromArpa=function(t){return new e(t.replace(/(\.in-addr\.arpa)?\.$/,"").split(".").reverse().join("."))},e.prototype.toHex=function(){return this.parsedAddress.map((function(e){return f.sprintf("%02x",parseInt(e,10))})).join(":")},e.prototype.toArray=function(){return this.parsedAddress.map((function(e){return parseInt(e,10)}))},e.prototype.toGroup6=function(){var e,t=[];for(e=0;e%s.%s',e.slice(0,2).join("."),e.slice(2,4).join(".")))},e}();t.Address4=l},76862:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t},s=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r$1$2')).replace(/^(0{1,})(0)$/,'$1$2')}function m(e){return y.sprintf("%04x",parseInt(e,16))}function v(e){return 255&e}var w=function(){function e(e,t){this.addressMinusSuffix="",this.parsedSubnet="",this.subnet="/128",this.subnetMask=128,this.v4=!1,this.zone="",this.isInSubnet=a.isInSubnet,this.isCorrect=a.isCorrect(u.BITS),this.groups=void 0===t?u.GROUPS:t,this.address=e;var r=u.RE_SUBNET_STRING.exec(e);if(r){if(this.parsedSubnet=r[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet="/"+this.subnetMask,Number.isNaN(this.subnetMask)||this.subnetMask<0||this.subnetMask>u.BITS)throw new d.AddressError("Invalid subnet mask.");e=e.replace(u.RE_SUBNET_STRING,"")}else if(/\//.test(e))throw new d.AddressError("Invalid subnet mask.");var n=u.RE_ZONE_STRING.exec(e);n&&(this.zone=n[0],e=e.replace(u.RE_ZONE_STRING,"")),this.addressMinusSuffix=e,this.parsedAddress=this.parse(this.addressMinusSuffix)}return e.isValid=function(t){try{return new e(t),!0}catch(e){return!1}},e.fromBigInteger=function(t){var r,n=t.toString(16).padStart(32,"0"),i=[];for(r=0;r65536)&&(i=null):i=null,{address:new e(r),port:i}},e.fromAddress4=function(t){var r=new l.Address4(t),n=u.BITS-(c.BITS-r.subnetMask);return new e("::ffff:"+r.correctForm()+"/"+n)},e.fromArpa=function(t){var r=t.replace(/(\.ip6\.arpa)?\.$/,"");if(63!==r.length)throw new d.AddressError("Invalid 'ip6.arpa' form.");for(var n=r.split(".").reverse(),i=7;i>0;i--){var o=4*i;n.splice(o,0,":")}return new e(r=n.join(""))},e.prototype.microsoftTranscription=function(){return y.sprintf("%s.ipv6-literal.net",this.correctForm().replace(/:/g,"-"))},e.prototype.mask=function(e){return void 0===e&&(e=this.subnetMask),this.getBitsBase2(0,e)},e.prototype.possibleSubnets=function(e){void 0===e&&(e=128);var t=u.BITS-this.subnetMask-Math.abs(e-u.BITS);return t<0?"0":function(e){for(var t=/(\d+)(\d{3})/;t.test(e);)e=e.replace(t,"$1,$2");return e}(new p.BigInteger("2",10).pow(t).toString(10))},e.prototype._startAddress=function(){return new p.BigInteger(this.mask()+"0".repeat(u.BITS-this.subnetMask),2)},e.prototype.startAddress=function(){return e.fromBigInteger(this._startAddress())},e.prototype.startAddressExclusive=function(){var t=new p.BigInteger("1");return e.fromBigInteger(this._startAddress().add(t))},e.prototype._endAddress=function(){return new p.BigInteger(this.mask()+"1".repeat(u.BITS-this.subnetMask),2)},e.prototype.endAddress=function(){return e.fromBigInteger(this._endAddress())},e.prototype.endAddressExclusive=function(){var t=new p.BigInteger("1");return e.fromBigInteger(this._endAddress().subtract(t))},e.prototype.getScope=function(){var e=u.SCOPES[this.getBits(12,16).intValue()];return"Global unicast"===this.getType()&&"Link local"!==e&&(e="Global"),e||"Unknown"},e.prototype.getType=function(){for(var t=0,r=Object.keys(u.TYPES);t0?e.omitSuffix?r:y.sprintf("%s.ip6.arpa.",r):e.omitSuffix?"":"ip6.arpa."},e.prototype.correctForm=function(){var e,t=[],r=0,n=[];for(e=0;e0&&(r>1&&n.push([e-r,e-1]),r=0)}r>1&&n.push([this.parsedAddress.length-r,this.parsedAddress.length-1]);var o=n.map((function(e){return e[1]-e[0]+1}));if(n.length>0){var s=o.indexOf(Math.max.apply(Math,o));t=function(e,t){var r,n=[],i=[];for(r=0;rt[1]&&i.push(e[r]);return n.concat(["compact"]).concat(i)}(this.parsedAddress,n[s])}else t=this.parsedAddress;for(e=0;e1?"s":"",t.join("")),e.replace(u.RE_BAD_CHARACTERS,'$1'));var r=e.match(u.RE_BAD_ADDRESS);if(r)throw new d.AddressError(y.sprintf("Address failed regex: %s",r.join("")),e.replace(u.RE_BAD_ADDRESS,'$1'));var n=[],i=e.split("::");if(2===i.length){var o=i[0].split(":"),s=i[1].split(":");1===o.length&&""===o[0]&&(o=[]),1===s.length&&""===s[0]&&(s=[]);var a=this.groups-(o.length+s.length);if(!a)throw new d.AddressError("Error parsing groups");this.elidedGroups=a,this.elisionBegin=o.length,this.elisionEnd=o.length+this.elidedGroups,n=n.concat(o);for(var c=0;c=0;o--)n=n.add(i.multiply(new p.BigInteger(t[o].toString(10),10))),i=i.multiply(r);return e.fromBigInteger(n)},e.prototype.isCanonical=function(){return this.addressMinusSuffix===this.canonicalForm()},e.prototype.isLinkLocal=function(){return"1111111010000000000000000000000000000000000000000000000000000000"===this.getBitsBase2(0,64)},e.prototype.isMulticast=function(){return"Multicast"===this.getType()},e.prototype.is4=function(){return this.v4},e.prototype.isTeredo=function(){return this.isInSubnet(new e("2001::/32"))},e.prototype.is6to4=function(){return this.isInSubnet(new e("2002::/16"))},e.prototype.isLoopback=function(){return"Loopback"===this.getType()},e.prototype.href=function(e){return e=void 0===e?"":y.sprintf(":%s",e),y.sprintf("http://[%s]%s/",this.correctForm(),e)},e.prototype.link=function(e){e||(e={}),void 0===e.className&&(e.className=""),void 0===e.prefix&&(e.prefix="/#address="),void 0===e.v4&&(e.v4=!1);var t=this.correctForm;return e.v4&&(t=this.to4in6),e.className?y.sprintf('%2$s',e.prefix,t.call(this),e.className):y.sprintf('%2$s',e.prefix,t.call(this))},e.prototype.group=function(){if(0===this.elidedGroups)return f.simpleGroup(this.address).join(":");g("number"==typeof this.elidedGroups),g("number"==typeof this.elisionBegin);var e=[],t=this.address.split("::"),r=t[0],n=t[1];r.length?e.push.apply(e,f.simpleGroup(r)):e.push("");for(var i=["hover-group"],o=this.elisionBegin;o',i.join(" "))),n.length?e.push.apply(e,f.simpleGroup(n,this.elisionEnd)):e.push(""),this.is4()&&(g(this.address4 instanceof l.Address4),e.pop(),e.push(this.address4.groupForV6())),e.join(":")},e.prototype.regularExpressionString=function(t){void 0===t&&(t=!1);var r=[],n=new e(this.correctForm());if(0===n.elidedGroups)r.push(h.simpleRegularExpression(n.parsedAddress));else if(n.elidedGroups===u.GROUPS)r.push(h.possibleElisions(u.GROUPS));else{var i=n.address.split("::");i[0].length&&r.push(h.simpleRegularExpression(i[0].split(":"))),g("number"==typeof n.elidedGroups),r.push(h.possibleElisions(n.elidedGroups,0!==i[0].length,0!==i[1].length)),i[1].length&&r.push(h.simpleRegularExpression(i[1].split(":"))),r=[r.join(":")]}return t||(r=s(s(["(?=^|",h.ADDRESS_BOUNDARY,"|[^\\w\\:])("],r),[")(?=[^\\w\\:]|",h.ADDRESS_BOUNDARY,"|$)"])),r.join("")},e.prototype.regularExpression=function(e){return void 0===e&&(e=!1),new RegExp(this.regularExpressionString(e),"i")},e}();t.Address6=w},37802:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RE_SUBNET_STRING=t.RE_ADDRESS=t.GROUPS=t.BITS=void 0,t.BITS=32,t.GROUPS=4,t.RE_ADDRESS=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/g,t.RE_SUBNET_STRING=/\/\d{1,2}$/},88521:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RE_URL_WITH_PORT=t.RE_URL=t.RE_ZONE_STRING=t.RE_SUBNET_STRING=t.RE_BAD_ADDRESS=t.RE_BAD_CHARACTERS=t.TYPES=t.SCOPES=t.GROUPS=t.BITS=void 0,t.BITS=128,t.GROUPS=8,t.SCOPES={0:"Reserved",1:"Interface local",2:"Link local",4:"Admin local",5:"Site local",8:"Organization local",14:"Global",15:"Reserved"},t.TYPES={"ff01::1/128":"Multicast (All nodes on this interface)","ff01::2/128":"Multicast (All routers on this interface)","ff02::1/128":"Multicast (All nodes on this link)","ff02::2/128":"Multicast (All routers on this link)","ff05::2/128":"Multicast (All routers in this site)","ff02::5/128":"Multicast (OSPFv3 AllSPF routers)","ff02::6/128":"Multicast (OSPFv3 AllDR routers)","ff02::9/128":"Multicast (RIP routers)","ff02::a/128":"Multicast (EIGRP routers)","ff02::d/128":"Multicast (PIM routers)","ff02::16/128":"Multicast (MLDv2 reports)","ff01::fb/128":"Multicast (mDNSv6)","ff02::fb/128":"Multicast (mDNSv6)","ff05::fb/128":"Multicast (mDNSv6)","ff02::1:2/128":"Multicast (All DHCP servers and relay agents on this link)","ff05::1:2/128":"Multicast (All DHCP servers and relay agents in this site)","ff02::1:3/128":"Multicast (All DHCP servers on this link)","ff05::1:3/128":"Multicast (All DHCP servers in this site)","::/128":"Unspecified","::1/128":"Loopback","ff00::/8":"Multicast","fe80::/10":"Link-local unicast"},t.RE_BAD_CHARACTERS=/([^0-9a-f:/%])/gi,t.RE_BAD_ADDRESS=/([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi,t.RE_SUBNET_STRING=/\/\d{1,3}(?=%|$)/,t.RE_ZONE_STRING=/%.*$/,t.RE_URL=new RegExp(/^\[{0,1}([0-9a-f:]+)\]{0,1}/),t.RE_URL_WITH_PORT=new RegExp(/\[([0-9a-f:]+)\]:([0-9]{1,5})/)},16454:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.simpleGroup=t.spanLeadingZeroes=t.spanAll=t.spanAllZeroes=void 0;var n=r(8975);function i(e){return e.replace(/(0+)/g,'$1')}function o(e){return e.replace(/^(0+)/,'$1')}t.spanAllZeroes=i,t.spanAll=function(e,t){return void 0===t&&(t=0),e.split("").map((function(e,r){return n.sprintf('%s',e,r+t,i(e))})).join("")},t.spanLeadingZeroes=function(e){return e.split(":").map((function(e){return o(e)})).join(":")},t.simpleGroup=function(e,t){return void 0===t&&(t=0),e.split(":").map((function(e,r){return/group-v4/.test(e)?e:n.sprintf('%s',r+t,o(e))}))}},34489:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.possibleElisions=t.simpleRegularExpression=t.ADDRESS_BOUNDARY=t.padGroup=t.groupPossibilities=void 0;var s=o(r(88521)),a=r(8975);function c(e){return a.sprintf("(%s)",e.join("|"))}function u(e){return e.length<4?a.sprintf("0{0,%d}%s",4-e.length,e):e}t.groupPossibilities=c,t.padGroup=u,t.ADDRESS_BOUNDARY="[^A-Fa-f0-9:]",t.simpleRegularExpression=function(e){var t=[];e.forEach((function(e,r){0===parseInt(e,16)&&t.push(r)}));var r=t.map((function(t){return e.map((function(e,r){if(r===t){var n=0===r||r===s.GROUPS-1?":":"";return c([u(e),n])}return u(e)})).join(":")}));return r.push(e.map(u).join(":")),c(r)},t.possibleElisions=function(e,t,r){var n=t?"":":",i=r?"":":",o=[];t||r||o.push("::"),t&&r&&o.push(""),(r&&!t||!r&&t)&&o.push(":"),o.push(a.sprintf("%s(:0{1,4}){1,%d}",n,e-1)),o.push(a.sprintf("(0{1,4}:){1,%d}%s",e-1,i)),o.push(a.sprintf("(0{1,4}:){%d}0{1,4}",e-1));for(var s=1;s{"use strict";const t="[a-fA-F\\d:]",r=e=>e&&e.includeBoundaries?`(?:(?<=\\s|^)(?=${t})|(?<=${t})(?=\\s|$))`:"",n="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",i="[a-fA-F\\d]{1,4}",o=`\n(?:\n(?:${i}:){7}(?:${i}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:${i}:){6}(?:${n}|:${i}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4\n(?:${i}:){5}(?::${n}|(?::${i}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4\n(?:${i}:){4}(?:(?::${i}){0,1}:${n}|(?::${i}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4\n(?:${i}:){3}(?:(?::${i}){0,2}:${n}|(?::${i}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4\n(?:${i}:){2}(?:(?::${i}){0,3}:${n}|(?::${i}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:${i}:){1}(?:(?::${i}){0,4}:${n}|(?::${i}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::${i}){0,5}:${n}|(?::${i}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1\n`.replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),s=new RegExp(`(?:^${n}$)|(?:^${o}$)`),a=new RegExp(`^${n}$`),c=new RegExp(`^${o}$`),u=e=>e&&e.exact?s:new RegExp(`(?:${r(e)}${n}${r(e)})|(?:${r(e)}${o}${r(e)})`,"g");u.v4=e=>e&&e.exact?a:new RegExp(`${r(e)}${n}${r(e)}`,"g"),u.v6=e=>e&&e.exact?c:new RegExp(`${r(e)}${o}${r(e)}`,"g"),e.exports=u},56512:function(e){!function(t){"use strict";const r="(0?\\d+|0x[a-f0-9]+)",n={fourOctet:new RegExp(`^${r}\\.${r}\\.${r}\\.${r}$`,"i"),threeOctet:new RegExp(`^${r}\\.${r}\\.${r}$`,"i"),twoOctet:new RegExp(`^${r}\\.${r}$`,"i"),longValue:new RegExp(`^${r}$`,"i")},i=new RegExp("^0[0-7]+$","i"),o=new RegExp("^0x[a-f0-9]+$","i"),s="%[0-9a-z]{1,}",a="(?:[0-9a-f]+::?)+",c={zoneIndex:new RegExp(s,"i"),native:new RegExp(`^(::)?(${a})?([0-9a-f]+)?(::)?(${s})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${r}\\.${r}\\.${r}\\.${r}(${s})?)$`,"i"),transitional:new RegExp(`^((?:${a})|(?:::)(?:${a})?)${r}\\.${r}\\.${r}\\.${r}(${s})?$`,"i")};function u(e,t){if(e.indexOf("::")!==e.lastIndexOf("::"))return null;let r,n,i=0,o=-1,s=(e.match(c.zoneIndex)||[])[0];for(s&&(s=s.substring(1),e=e.replace(/%.+$/,""));(o=e.indexOf(":",o+1))>=0;)i++;if("::"===e.substr(0,2)&&i--,"::"===e.substr(-2,2)&&i--,i>t)return null;for(n=t-i,r=":";n--;)r+="0:";return":"===(e=e.replace("::",r))[0]&&(e=e.slice(1)),":"===e[e.length-1]&&(e=e.slice(0,-1)),{parts:t=function(){const t=e.split(":"),r=[];for(let e=0;e0;){if(i=r-n,i<0&&(i=0),e[o]>>i!=t[o]>>i)return!1;n-=r,o+=1}return!0}function l(e){if(o.test(e))return parseInt(e,16);if("0"===e[0]&&!isNaN(parseInt(e[1],10))){if(i.test(e))return parseInt(e,8);throw new Error(`ipaddr: cannot parse ${e} as octal`)}return parseInt(e,10)}function h(e,t){for(;e.length=0;n-=1){if(i=this.octets[n],!(i in r))return null;if(o=r[i],t&&0!==o)return null;8!==o&&(t=!0),e+=o}return 32-e},e.prototype.range=function(){return d.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){return this.octets.slice(0)},e.prototype.toIPv4MappedAddress=function(){return d.IPv6.parse(`::ffff:${this.toString()}`)},e.prototype.toNormalizedString=function(){return this.toString()},e.prototype.toString=function(){return this.octets.join(".")},e}(),d.IPv4.broadcastAddressFromCIDR=function(e){try{const t=this.parseCIDR(e),r=t[0].toByteArray(),n=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[];let o=0;for(;o<4;)i.push(parseInt(r[o],10)|255^parseInt(n[o],10)),o++;return new this(i)}catch(e){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},d.IPv4.isIPv4=function(e){return null!==this.parser(e)},d.IPv4.isValid=function(e){try{return new this(this.parser(e)),!0}catch(e){return!1}},d.IPv4.isValidFourPartDecimal=function(e){return!(!d.IPv4.isValid(e)||!e.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},d.IPv4.networkAddressFromCIDR=function(e){let t,r,n,i,o;try{for(t=this.parseCIDR(e),n=t[0].toByteArray(),o=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],r=0;r<4;)i.push(parseInt(n[r],10)&parseInt(o[r],10)),r++;return new this(i)}catch(e){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},d.IPv4.parse=function(e){const t=this.parser(e);if(null===t)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(t)},d.IPv4.parseCIDR=function(e){let t;if(t=e.match(/^(.+)\/(\d+)$/)){const e=parseInt(t[2]);if(e>=0&&e<=32){const r=[this.parse(t[1]),e];return Object.defineProperty(r,"toString",{value:function(){return this.join("/")}}),r}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},d.IPv4.parser=function(e){let t,r,i;if(t=e.match(n.fourOctet))return function(){const e=t.slice(1,6),n=[];for(let t=0;t4294967295||i<0)throw new Error("ipaddr: address outside defined range");return function(){const e=[];let t;for(t=0;t<=24;t+=8)e.push(i>>t&255);return e}().reverse()}return(t=e.match(n.twoOctet))?function(){const e=t.slice(1,4),r=[];if(i=l(e[1]),i>16777215||i<0)throw new Error("ipaddr: address outside defined range");return r.push(l(e[0])),r.push(i>>16&255),r.push(i>>8&255),r.push(255&i),r}():(t=e.match(n.threeOctet))?function(){const e=t.slice(1,5),r=[];if(i=l(e[2]),i>65535||i<0)throw new Error("ipaddr: address outside defined range");return r.push(l(e[0])),r.push(l(e[1])),r.push(i>>8&255),r.push(255&i),r}():null},d.IPv4.subnetMaskFromPrefixLength=function(e){if((e=parseInt(e))<0||e>32)throw new Error("ipaddr: invalid IPv4 prefix length");const t=[0,0,0,0];let r=0;const n=Math.floor(e/8);for(;r=0;o-=1){if(n=this.parts[o],!(n in r))return null;if(i=r[n],t&&0!==i)return null;16!==i&&(t=!0),e+=i}return 128-e},e.prototype.range=function(){return d.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){let e;const t=[],r=this.parts;for(let n=0;n>8),t.push(255&e);return t},e.prototype.toFixedLengthString=function(){const e=function(){const e=[];for(let t=0;t>8,255&t,r>>8,255&r])},e.prototype.toNormalizedString=function(){const e=function(){const e=[];for(let t=0;ti&&(n=r.index,i=r[0].length);return i<0?t:`${t.substring(0,n)}::${t.substring(n+i)}`},e.prototype.toString=function(){return this.toNormalizedString().replace(/((^|:)(0(:|$))+)/,"::")},e}(),d.IPv6.broadcastAddressFromCIDR=function(e){try{const t=this.parseCIDR(e),r=t[0].toByteArray(),n=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[];let o=0;for(;o<16;)i.push(parseInt(r[o],10)|255^parseInt(n[o],10)),o++;return new this(i)}catch(e){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`)}},d.IPv6.isIPv6=function(e){return null!==this.parser(e)},d.IPv6.isValid=function(e){if("string"==typeof e&&-1===e.indexOf(":"))return!1;try{const t=this.parser(e);return new this(t.parts,t.zoneId),!0}catch(e){return!1}},d.IPv6.networkAddressFromCIDR=function(e){let t,r,n,i,o;try{for(t=this.parseCIDR(e),n=t[0].toByteArray(),o=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],r=0;r<16;)i.push(parseInt(n[r],10)&parseInt(o[r],10)),r++;return new this(i)}catch(e){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`)}},d.IPv6.parse=function(e){const t=this.parser(e);if(null===t.parts)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(t.parts,t.zoneId)},d.IPv6.parseCIDR=function(e){let t,r,n;if((r=e.match(/^(.+)\/(\d+)$/))&&(t=parseInt(r[2]),t>=0&&t<=128))return n=[this.parse(r[1]),t],Object.defineProperty(n,"toString",{value:function(){return this.join("/")}}),n;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},d.IPv6.parser=function(e){let t,r,n,i,o,s;if(n=e.match(c.deprecatedTransitional))return this.parser(`::ffff:${n[1]}`);if(c.native.test(e))return u(e,8);if((n=e.match(c.transitional))&&(s=n[6]||"",t=u(n[1].slice(0,-1)+s,6),t.parts)){for(o=[parseInt(n[2]),parseInt(n[3]),parseInt(n[4]),parseInt(n[5])],r=0;r128)throw new Error("ipaddr: invalid IPv6 prefix length");const t=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let r=0;const n=Math.floor(e/8);for(;r{e.exports=function(e){return null!=e&&null!=e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}},59134:(e,t,r)=>{var n=r(34155);e.exports=function(){return"undefined"!=typeof window&&"object"==typeof window.process&&"renderer"===window.process.type||!(void 0===n||"object"!=typeof n.versions||!n.versions.electron)||"object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent.indexOf("Electron")>=0}},5003:(e,t,r)=>{"use strict";const n=r(1476),i=e=>n({exact:!0}).test(e);i.v4=e=>n.v4({exact:!0}).test(e),i.v6=e=>n.v6({exact:!0}).test(e),i.version=e=>i(e)?i.v4(e)?4:6:void 0,e.exports=i},51890:e=>{"use strict";e.exports=function(e){return/^127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(e)||/^::1$/.test(e)}},6898:e=>{"use strict";e.exports=e=>!!e&&("symbol"==typeof Symbol.observable&&"function"==typeof e[Symbol.observable]?e===e[Symbol.observable]():"function"==typeof e["@@observable"]&&e===e["@@observable"]())},33310:e=>{"use strict";e.exports=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}},1914:e=>{"use strict";const t=65536;e.exports=function(e){const r=new Uint8Array(e);let n=0;if(e>0)if(e>t)for(;ne?(crypto.getRandomValues(r.subarray(n,n+(e-n))),n+=e-n):(crypto.getRandomValues(r.subarray(n,n+t)),n+=t);else crypto.getRandomValues(r);return r}},17745:(e,t,r)=>{"use strict";const{URLWithLegacySupport:n,format:i,URLSearchParams:o,defaultBase:s}=r(82049),a=r(15939);e.exports={URL:n,URLSearchParams:o,format:i,relative:a,defaultBase:s}},15939:(e,t,r)=>{"use strict";const{URLWithLegacySupport:n,format:i}=r(82049);e.exports=(e,t={},r={},o)=>{let s,a=t.protocol?t.protocol.replace(":",""):"http";a=(r[a]||o||a)+":";try{s=new n(e)}catch(e){s={}}const c=Object.assign({},t,{protocol:a||s.protocol,host:t.host||s.host});return new n(e,i(c)).toString()}},82049:e=>{"use strict";const t="undefined"!=typeof navigator&&"ReactNative"===navigator.product,r=self.URL,n=t?"http://localhost":self.location?self.location.protocol+"//"+self.location.host:"";e.exports={URLWithLegacySupport:class{constructor(e="",t=n){this.super=new r(e,t),this.path=this.pathname+this.search,this.auth=this.username&&this.password?this.username+":"+this.password:null,this.query=this.search&&this.search.startsWith("?")?this.search.slice(1):null}get hash(){return this.super.hash}get host(){return this.super.host}get hostname(){return this.super.hostname}get href(){return this.super.href}get origin(){return this.super.origin}get password(){return this.super.password}get pathname(){return this.super.pathname}get port(){return this.super.port}get protocol(){return this.super.protocol}get search(){return this.super.search}get searchParams(){return this.super.searchParams}get username(){return this.super.username}set hash(e){this.super.hash=e}set host(e){this.super.host=e}set hostname(e){this.super.hostname=e}set href(e){this.super.href=e}set password(e){this.super.password=e}set pathname(e){this.super.pathname=e}set port(e){this.super.port=e}set protocol(e){this.super.protocol=e}set search(e){this.super.search=e}set username(e){this.super.username=e}static createObjectURL(e){return r.createObjectURL(e)}static revokeObjectURL(e){r.revokeObjectURL(e)}toJSON(){return this.super.toJSON()}toString(){return this.super.toString()}format(){return this.toString()}},URLSearchParams:self.URLSearchParams,defaultBase:n,format:function(e){if("string"==typeof e)return new r(e).toString();if(!(e instanceof r)){const t=e.username&&e.password?`${e.username}:${e.password}@`:"",r=e.auth?e.auth+"@":"",n=e.port?":"+e.port:"",i=e.protocol?e.protocol+"//":"",o=e.host||"",s=e.hostname||"",a=e.search||(e.query?"?"+e.query:""),c=e.hash||"",u=e.pathname||"";return`${i}${t||r}${o||s+n}${e.path||u+a}${c}`}}}},96653:(e,t,r)=>{"use strict";const{Buffer:n}=r(48764),i=r(9668);e.exports=async function*(e){for await(const t of e)n.isBuffer(t)?yield t:i.isBufferList(t)?yield t.slice():yield n.from(t)},e.exports.toBuffer=e.exports,e.exports.toList=async function*(e){for await(const t of e)n.isBuffer(t)?yield(new i).append(t):i.isBufferList(t)?yield t:yield(new i).append(n.from(t))}},64593:e=>{"use strict";e.exports=async e=>{for await(const t of e);}},55565:e=>{"use strict";e.exports=async function*(e,t){for await(const r of e)await t(r)&&(yield r)}},72262:e=>{"use strict";e.exports=async e=>{for await(const t of e)return t}},52261:(e,t,r)=>{"use strict";const n=r(53469),i=r(84975),o=r(63931);e.exports=e=>{const t=i(),r=n(e.source),s=o();let a;const c=e.sink(async function*(){yield*t;const e=await s.promise;yield*e}());return c.catch((e=>{a=e})),{reader:r,writer:t,stream:{sink:e=>a?Promise.reject(a):(s.resolve(e),c),source:r},rest:()=>t.end(),write:t.push,read:async()=>(await r.next()).value}}},33635:(e,t,r)=>{"use strict";const{Buffer:n}=r(12836),i=Symbol.for("BufferList");function o(e){if(!(this instanceof o))return new o(e);o._init.call(this,e)}o._init=function(e){Object.defineProperty(this,i,{value:!0}),this._bufs=[],this.length=0,e&&this.append(e)},o.prototype._new=function(e){return new o(e)},o.prototype._offset=function(e){if(0===e)return[0,0];let t=0;for(let r=0;rthis.length||e<0)return;const t=this._offset(e);return this._bufs[t[0]][t[1]]},o.prototype.slice=function(e,t){return"number"==typeof e&&e<0&&(e+=this.length),"number"==typeof t&&t<0&&(t+=this.length),this.copy(null,0,e,t)},o.prototype.copy=function(e,t,r,i){if(("number"!=typeof r||r<0)&&(r=0),("number"!=typeof i||i>this.length)&&(i=this.length),r>=this.length)return e||n.alloc(0);if(i<=0)return e||n.alloc(0);const o=!!e,s=this._offset(r),a=i-r;let c=a,u=o&&t||0,f=s[1];if(0===r&&i===this.length){if(!o)return 1===this._bufs.length?this._bufs[0]:n.concat(this._bufs,this.length);for(let t=0;tr)){this._bufs[t].copy(e,u,f,f+c),u+=r;break}this._bufs[t].copy(e,u,f),u+=r,c-=r,f&&(f=0)}return e.length>u?e.slice(0,u):e},o.prototype.shallowSlice=function(e,t){if(e=e||0,t="number"!=typeof t?this.length:t,e<0&&(e+=this.length),t<0&&(t+=this.length),e===t)return this._new();const r=this._offset(e),n=this._offset(t),i=this._bufs.slice(r[0],n[0]+1);return 0===n[1]?i.pop():i[i.length-1]=i[i.length-1].slice(0,n[1]),0!==r[1]&&(i[0]=i[0].slice(r[1])),this._new(i)},o.prototype.toString=function(e,t,r){return this.slice(t,r).toString(e)},o.prototype.consume=function(e){if(e=Math.trunc(e),Number.isNaN(e)||e<=0)return this;for(;this._bufs.length;){if(!(e>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},o.prototype.duplicate=function(){const e=this._new();for(let t=0;tthis.length?this.length:t;const i=this._offset(t);let o=i[0],s=i[1];for(;o=e.length){const r=t.indexOf(e,s);if(-1!==r)return this._reverseOffset([o,r]);s=t.length-e.length+1}else{const t=this._reverseOffset([o,s]);if(this._match(t,e))return t;s++}s=0}return-1},o.prototype._match=function(e,t){if(this.length-e{"use strict";var n=r(79742),i=r(80645),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=c,t.SlowBuffer=function(e){return+e!=e&&(e=0),c.alloc(+e)},t.INSPECT_MAX_BYTES=50;var s=2147483647;function a(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return l(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|y(e,t),n=a(r),i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(V(e,Uint8Array)){var t=new Uint8Array(e);return d(t.buffer,t.byteOffset,t.byteLength)}return h(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(V(e,ArrayBuffer)||e&&V(e.buffer,ArrayBuffer))return d(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(V(e,SharedArrayBuffer)||e&&V(e.buffer,SharedArrayBuffer)))return d(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return c.from(n,t,r);var i=function(e){if(c.isBuffer(e)){var t=0|p(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||F(e.length)?a(0):h(e):"Buffer"===e.type&&Array.isArray(e.data)?h(e.data):void 0}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function f(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function l(e){return f(e),a(e<0?0:0|p(e))}function h(e){for(var t=e.length<0?0:0|p(e.length),r=a(t),n=0;n=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function y(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||V(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return K(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return U(e).length;default:if(i)return n?-1:K(e).length;t=(""+t).toLowerCase(),i=!0}}function g(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return k(this,t,r);case"utf8":case"utf-8":return I(this,t,r);case"ascii":return P(this,t,r);case"latin1":case"binary":return R(this,t,r);case"base64":return T(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function b(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function m(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),F(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=c.from(t,n)),c.isBuffer(t))return 0===t.length?-1:v(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):v(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,r,n,i){var o,s=1,a=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var f=-1;for(o=r;oa&&(r=a-c),o=r;o>=0;o--){for(var l=!0,h=0;hi&&(n=i):n=i;var o=t.length;n>o/2&&(n=o/2);for(var s=0;s>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function T(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function I(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i239?4:u>223?3:u>191?2:1;if(i+l<=r)switch(l){case 1:u<128&&(f=u);break;case 2:128==(192&(o=e[i+1]))&&(c=(31&u)<<6|63&o)>127&&(f=c);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(c=(15&u)<<12|(63&o)<<6|63&s)>2047&&(c<55296||c>57343)&&(f=c);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(c=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(f=c)}null===f?(f=65533,l=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),i+=l}return function(e){var t=e.length;if(t<=C)return String.fromCharCode.apply(String,e);for(var r="",n=0;nn.length?c.from(o).copy(n,i):Uint8Array.prototype.set.call(n,o,i);else{if(!c.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i)}i+=o.length}return n},c.byteLength=y,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;tr&&(e+=" ... "),""},o&&(c.prototype[o]=c.prototype.inspect),c.prototype.compare=function(e,t,r,n,i){if(V(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),u=this.slice(n,i),f=e.slice(t,r),l=0;l>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return w(this,e,t,r);case"utf8":case"utf-8":return E(this,e,t,r);case"ascii":case"latin1":case"binary":return _(this,e,t,r);case"base64":return S(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var C=4096;function P(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;in)&&(r=n);for(var i="",o=t;or)throw new RangeError("Trying to access beyond buffer length")}function M(e,t,r,n,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function O(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function N(e,t,r,n,o){return t=+t,r>>>=0,o||O(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function L(e,t,r,n,o){return t=+t,r>>>=0,o||O(e,0,r,8),i.write(e,t,r,n,52,8),r+8}c.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||x(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||x(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||x(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||x(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||x(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||x(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||x(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||x(e,t,this.length);for(var n=this[e],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*t)),n},c.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||x(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return e>>>=0,t||x(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||x(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(e,t){e>>>=0,t||x(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||x(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||x(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return e>>>=0,t||x(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||x(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||x(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||x(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||M(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n||M(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);M(this,e,t,r,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o>0)-a&255;return t+r},c.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);M(this,e,t,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},c.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeFloatLE=function(e,t,r){return N(this,e,t,!0,r)},c.prototype.writeFloatBE=function(e,t,r){return N(this,e,t,!1,r)},c.prototype.writeDoubleLE=function(e,t,r){return L(this,e,t,!0,r)},c.prototype.writeDoubleBE=function(e,t,r){return L(this,e,t,!1,r)},c.prototype.copy=function(e,t,r,n){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function U(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(D,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function j(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function V(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function F(e){return e!=e}var q=function(){for(var e="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)t[n+i]=e[r]+e[i];return t}()},65765:(e,t,r)=>{"use strict";const{Buffer:n}=r(12836),i=r(33635),o=r(72903),s=4194304,a=n.alloc(0),c="readLength",u="readData",f={[c]:(e,t,r,n)=>{let o;t=t.append(e);try{o=n.lengthDecoder(t)}catch(e){if(t.length>n.maxLengthLength)throw Object.assign(e,{message:"message length too long",code:"ERR_MSG_LENGTH_TOO_LONG"});if(e instanceof RangeError)return{mode:c,buffer:t};throw e}if(o>n.maxDataLength)throw Object.assign(new Error("message data too long"),{code:"ERR_MSG_DATA_TOO_LONG"});return e=t.shallowSlice(n.lengthDecoder.bytes),t=new i,n.onLength&&n.onLength(o),o<=0?(n.onData&&n.onData(a),{mode:c,chunk:e,buffer:t,data:a}):{mode:u,chunk:e,buffer:t,state:{dataLength:o}}},[u]:(e,t,r,n)=>{if((t=t.append(e)).lengtho?t.shallowSlice(o):null,t=new i,n.onData&&n.onData(s),{mode:c,chunk:e,buffer:t,data:s}}};function l(e){return(e=e||{}).lengthDecoder=e.lengthDecoder||o,e.maxLengthLength=e.maxLengthLength||8,e.maxDataLength=e.maxDataLength||s,t=>async function*(){let r,n=new i,o=c;for await(let i of t)for(;i;){const t=f[o](i,n,r,e);({mode:o,chunk:i,buffer:n,state:r}=t),t.data&&(yield t.data)}if(n.length)throw Object.assign(new Error("unexpected end of input"),{code:"ERR_UNEXPECTED_EOF"})}()}l.fromReader=(e,t)=>{t=t||{};let r=1;const n={[Symbol.asyncIterator](){return this},next:async()=>{try{return await e.next(r)}catch(e){if("ERR_UNDER_READ"===e.code)return{done:!0,value:null};throw e}finally{r=1}}};return t.onLength=e=>{r=e},l(t)(n)},e.exports=l,e.exports.MAX_LENGTH_LENGTH=8,e.exports.MAX_DATA_LENGTH=s},90278:(e,t,r)=>{"use strict";const{Buffer:n}=r(12836),i=r(33635),o=r(62354);function s(e){e=e||{};const t=Math.max(e.poolSize||10240,e.minPoolSize||8),r=e.lengthEncoder||o;return e=>async function*(){let o=n.alloc(t),s=0;for await(const a of e){r(a.length,o,s);const e=o.slice(s,s+r.bytes);s+=r.bytes,o.length-s<8&&(o=n.alloc(t),s=0),yield(new i).append(e).append(a)}}()}s.single=(e,t)=>{const r=(t=t||{}).lengthEncoder||o;return new i([r(e.length),e])},e.exports=s,e.exports.MIN_POOL_SIZE=8,e.exports.DEFAULT_POOL_SIZE=10240},48963:(e,t,r)=>{"use strict";t.encode=r(90278),t.decode=r(65765),t.varintEncode=r(62354),t.varintDecode=r(72903),t.int32BEEncode=r(71205),t.int32BEDecode=r(93380)},93380:e=>{"use strict";const t=e=>{if(e.length<4)throw RangeError("Could not decode int32BE");return e.readInt32BE(0)};t.bytes=4,e.exports=t},71205:(e,t,r)=>{"use strict";const{Buffer:n}=r(12836),i=(e,t,r)=>((t=t||n.allocUnsafe(4)).writeInt32BE(e,r),t);i.bytes=4,e.exports=i},72903:(e,t,r)=>{"use strict";const{Buffer:n}=r(12836),i=r(94676),o=e=>{const t=i.decode(n.isBuffer(e)?e:(r=e,new Proxy({},{get:(e,t)=>"l"===t[0]?r[t]:r.get(parseInt(t))})));var r;return o.bytes=i.decode.bytes,t};e.exports=o},62354:(e,t,r)=>{"use strict";const n=r(94676),{Buffer:i}=r(12836),o=(e,t,r)=>{const s=n.encode(e,t,r);return o.bytes=n.encode.bytes,t||i.from(s)};e.exports=o},32121:e=>{"use strict";e.exports=async function*(e,t){for await(const r of e)yield t(r)}},74014:(e,t,r)=>{"use strict";const n=r(84975);e.exports=async function*(...e){const t=n();setTimeout((async()=>{try{await Promise.all(e.map((async e=>{for await(const r of e)t.push(r)}))),t.end()}catch(e){t.end(e)}}),0),yield*t}},63184:(e,t,r)=>{var n=r(60154);e.exports=function(){var e=n(),t=n();return[{source:e.source,sink:t.sink},{source:t.source,sink:e.sink}]}},60154:(e,t,r)=>{"use strict";const n=r(22412);e.exports=function(){let e,t;return{sink:async r=>{if(e)throw new Error("already piped");e=n(r),t&&t(e)},source:{[Symbol.asyncIterator](){return this},next:()=>e?e.next():new Promise((e=>{t=r=>{t=null,e(r.next())}}))}}}},61962:(e,t,r)=>{"use strict";const{Buffer:n}=r(48764),i=r(9668),o=r(19552),s=4194304,a=n.alloc(0),c="readLength",u="readData",f={[c]:(e,t,r,n)=>{let o;t=t.append(e);try{o=n.lengthDecoder(t)}catch(e){if(t.length>n.maxLengthLength)throw Object.assign(e,{message:"message length too long",code:"ERR_MSG_LENGTH_TOO_LONG"});if(e instanceof RangeError)return{mode:c,buffer:t,chunk:void 0,state:void 0,data:void 0};throw e}if(o>n.maxDataLength)throw Object.assign(new Error("message data too long"),{code:"ERR_MSG_DATA_TOO_LONG"});return e=t.shallowSlice(n.lengthDecoder.bytes),t=new i,n.onLength&&n.onLength(o),o<=0?(n.onData&&n.onData(a),{mode:c,chunk:e,buffer:t,data:a}):{mode:u,chunk:e,buffer:t,state:{dataLength:o},data:void 0}},[u]:(e,t,r,n)=>{if(t=t.append(e),!r)throw new Error("state is required");if(t.lengtho?t.shallowSlice(o):void 0;return t=new i,n.onData&&n.onData(s),{mode:c,chunk:a,buffer:t,state:void 0,data:s}}};function l(e){const t={lengthDecoder:(e=e||{}).lengthDecoder||o,maxLengthLength:e.maxLengthLength||8,maxDataLength:e.maxDataLength||s,onLength:e.onLength,onData:e.onData};return async function*(e){let r,n=new i,o=c;for await(const i of e){let e=i;for(;e;){const i=f[o](e,n,r,t);o=i.mode,e=i.chunk,n=i.buffer,r=i.state,i.data&&(yield i.data)}}if(n.length)throw Object.assign(new Error("unexpected end of input"),{code:"ERR_UNEXPECTED_EOF"})}}l.fromReader=(e,t)=>{let r=1;const n={[Symbol.asyncIterator](){return this},next:async()=>{try{return await e.next(r)}catch(e){if("ERR_UNDER_READ"===e.code)return{done:!0,value:null};throw e}finally{r=1}}};return l({...t||{},onLength:e=>{r=e}})(n)},e.exports=l,e.exports.MAX_LENGTH_LENGTH=8,e.exports.MAX_DATA_LENGTH=s},64095:(e,t,r)=>{"use strict";const{Buffer:n}=r(48764),i=r(9668),o=r(55735);function s(e){e=e||{};const t=Math.max(e.poolSize||10240,e.minPoolSize||8),r=e.lengthEncoder||o;return async function*(e){let o=n.alloc(t),s=0;for await(const a of e){r(a.length,o,s);const e=o.slice(s,s+r.bytes);s+=r.bytes,o.length-s<8&&(o=n.alloc(t),s=0),yield(new i).append(e).append(a)}}}s.single=(e,t)=>{const r=(t=t||{}).lengthEncoder||o;return new i([r(e.length),e.slice()])},e.exports=s,e.exports.MIN_POOL_SIZE=8,e.exports.DEFAULT_POOL_SIZE=10240},85919:(e,t,r)=>{"use strict";t.encode=r(64095),t.decode=r(61962),t.varintEncode=r(55735),t.varintDecode=r(19552),t.int32BEEncode=r(51643),t.int32BEDecode=r(93058)},93058:e=>{"use strict";const t=e=>{if(e.length<4)throw RangeError("Could not decode int32BE");return e.readInt32BE(0)};t.bytes=4,e.exports=t},51643:(e,t,r)=>{"use strict";const{Buffer:n}=r(48764),i=(e,t,r)=>((t=t||n.allocUnsafe(4)).writeInt32BE(e,r),t);i.bytes=4,e.exports=i},19552:(e,t,r)=>{"use strict";const n=r(41186),{Buffer:i}=r(48764),o=e=>{const t=n.decode(i.isBuffer(e)?e:(r=e,new Proxy({},{get:(e,t)=>"l"===t[0]?r[t]:r.get(parseInt(t))})));var r;return o.bytes=n.decode.bytes,t};e.exports=o},55735:(e,t,r)=>{"use strict";const n=r(41186),{Buffer:i}=r(48764),o=(e,t,r)=>{const s=n.encode(e,t,r);return o.bytes=n.encode.bytes,t||i.from(s)};e.exports=o},46414:e=>{e.exports=function e(t,r){var n,i=0,o=0,s=r=r||0,a=t.length;do{if(s>=a||o>49)throw e.bytes=0,new RangeError("Could not decode varint");n=t[s++],i+=o<28?(127&n)<=128);return e.bytes=s-r,i}},84347:e=>{e.exports=function e(r,n,i){if(Number.MAX_SAFE_INTEGER&&r>Number.MAX_SAFE_INTEGER)throw e.bytes=0,new RangeError("Could not encode varint");n=n||[];for(var o=i=i||0;r>=t;)n[i++]=255&r|128,r/=128;for(;-128&r;)n[i++]=255&r|128,r>>>=7;return n[i]=0|r,e.bytes=i-o+1,n};var t=Math.pow(2,31)},41186:(e,t,r)=>{e.exports={encode:r(84347),decode:r(46414),encodingLength:r(94726)}},94726:e=>{var t=Math.pow(2,7),r=Math.pow(2,14),n=Math.pow(2,21),i=Math.pow(2,28),o=Math.pow(2,35),s=Math.pow(2,42),a=Math.pow(2,49),c=Math.pow(2,56),u=Math.pow(2,63);e.exports=function(e){return e{"use strict";const n=r(48738),i=r(52261),o=r(85919);e.exports=(e,t={})=>{const r=i(e),s=o.decode.fromReader(r.reader,t);let a=!1;const c={read:async e=>{const{value:t,done:n}=await r.reader.next(e);if(n&&t.length{const{value:e,done:t}=await s.next();if(a=t,!e)throw new Error("Value is null");return e},readPB:async e=>{const t=await c.readLP();if(!t)throw new Error("Value is null");const r=n(t)?t:t.slice();return e.decode(r)},write:e=>{r.writer.push(e)},writeLP:e=>{c.write(o.encode.single(e,t))},writePB:(e,t)=>{c.writeLP(t.encode(e))},pb:e=>({read:()=>c.readPB(e),write:t=>c.writePB(t,e)}),unwrap:()=>(r.rest(),r.stream)};return c}},60618:e=>{const t=(...e)=>{let t;for(;e.length;)t=e.shift()(t);return t},r=e=>e&&("function"==typeof e[Symbol.asyncIterator]||"function"==typeof e[Symbol.iterator]||"function"==typeof e.next),n=e=>e&&"function"==typeof e.sink&&r(e.source),i=e=>t=>(e.sink(t),e.source),o=(...e)=>{if(n(e[0])){const t=e[0];e[0]=()=>t.source}else if(r(e[0])){const t=e[0];e[0]=()=>t}if(e.length>1&&n(e[e.length-1])&&(e[e.length-1]=e[e.length-1].sink),e.length>2)for(let t=1;t{const n=r(91607);e.exports=e=>{let t;"function"==typeof(e=e||{})?(t=e,e={}):t=e.onEnd;let r,i,o,s=new n;const a=e=>i?i(e):(s.push(e),r),c=e=>o?r:a({done:!1,value:e}),u=e=>o?r:(o=!0,e?(e=>(s=new n,i?i({error:e}):(s.push({error:e}),r)))(e):a({done:!0}));if(r={[Symbol.asyncIterator](){return this},next:()=>{if(!s.isEmpty()){if(e.writev){let e;const t=[];for(;!s.isEmpty();){if(e=s.shift(),e.error)throw e.error;t.push(e.value)}return{done:e.done,value:t}}const t=s.shift();if(t.error)throw t.error;return t}return o?{done:!0}:new Promise(((t,n)=>{i=o=>(i=null,o.error?n(o.error):e.writev&&!o.done?t({done:o.done,value:[o.value]}):t(o),r)}))},return:()=>(s=new n,u(),{done:!0}),throw:e=>(u(e),{done:!0}),push:c,end:u},!t)return r;const f=r;return r={[Symbol.asyncIterator](){return this},next:()=>f.next(),throw:e=>(f.throw(e),t&&(t(e),t=null),{done:!0}),return:()=>(f.return(),t&&(t(),t=null),{done:!0}),push:c,end:e=>(f.end(e),t&&(t(e),t=null),r)},r}},53469:(e,t,r)=>{const n=r(9668);e.exports=e=>{const t=async function*(){let t=yield,r=new n;for await(const i of e)if(t)for(r.append(i);r.length>=t;){const e=r.shallowSlice(0,t);if(r.consume(t),t=yield e,!t){r.length&&(t=yield r,r=new n);break}}else t=yield r.append(i),r=new n;if(t)throw Object.assign(new Error(`stream ended before ${t} bytes became available`),{code:"ERR_UNDER_READ",buffer:r})}();return t.next(),t}},37939:e=>{"use strict";e.exports=async function*(e,t){let r=0;if(!(t<1))for await(const n of e)if(yield n,r++,r===t)return}},6476:(e,t,r)=>{"use strict";var n=r(78422),i=r(45413),o=r(16044);e.exports=function(e,t={}){const r="undefined"==typeof window?{}:window.location,s=o(e,r),a=new n(s,t.websocket),c=i(a,t);return c.remoteAddress=s,c.close=()=>new Promise(((e,t)=>{a.addEventListener("close",e),a.close()})),c.destroy=()=>{a.terminate?a.terminate():a.close()},c.socket=a,c},e.exports.connect=e.exports},45413:(e,t,r)=>{const n=r(41049),i=r(91252);e.exports=(e,t)=>{(t=t||{}).binaryType?e.binaryType=t.binaryType:t.binary&&(e.binaryType="arraybuffer");const r={sink:i(e,t),source:n(e,t),connected:()=>r.source.connected()};return r}},1434:e=>{e.exports=async e=>{if(e.readyState>=2)throw new Error("socket closed");if(1!==e.readyState)return new Promise(((t,r)=>{const n=e&&(e.removeEventListener||e.removeListener);function i(){"function"==typeof n&&(n.call(e,"open",o),n.call(e,"error",s))}function o(){i(),t()}function s(e){i(),r(e)}e.addEventListener("open",o),e.addEventListener("error",s)}))}},91252:(e,t,r)=>{const n=r(1434);e.exports=(e,t)=>((t=t||{}).closeOnEnd=!1!==t.closeOnEnd,async r=>{for await(const t of r){try{await n(e)}catch(e){if("socket closed"===e.message)break;throw e}e.send(t)}if(t.closeOnEnd&&e.readyState<=1)return new Promise(((t,r)=>{e.addEventListener("close",(e=>{if(e.wasClean||1006===e.code)t();else{const t=Object.assign(new Error("ws error"),{event:e});r(t)}})),setTimeout((()=>e.close()))}))})},41049:(e,t,r)=>{const{Buffer:n}=r(48764),{EventIterator:i}=r(90507);e.exports=e=>{const t=e.removeEventListener||e.removeListener,r=async function*(){const r=new i((({push:r,stop:n,fail:i})=>(e.addEventListener("message",r),e.addEventListener("error",i),e.addEventListener("close",n),()=>{t.call(e,"message",r),t.call(e,"error",i),t.call(e,"close",n)})),{highWaterMark:1/0});for await(const{data:e}of r)yield(o=e,o instanceof ArrayBuffer||null!=o&&null!=o.constructor&&"ArrayBuffer"===o.constructor.name&&"number"==typeof o.byteLength?n.from(e):e);var o}();let o,s=1===e.readyState;return e.addEventListener("open",(()=>{s=!0,o=null})),e.addEventListener("close",(()=>{s=!1,o=null})),e.addEventListener("error",(e=>{s||(o=e)})),r.connected=()=>new Promise(((r,n)=>{if(s)return r();if(o)return n(o);const i=r=>{t.call(e,"open",a),t.call(e,"error",c),r()},a=()=>i(r),c=e=>i((()=>n(e)));e.addEventListener("open",a),e.addEventListener("error",c)})),r}},78422:(e,t,r)=>{e.exports="undefined"==typeof WebSocket?r(89408):WebSocket},16044:(e,t,r)=>{const{relative:n}=r(17745),i={http:"ws",https:"wss"};e.exports=(e,t)=>n(e,t,i,"ws")},36077:function(e,t){(function(){var t;function r(e,t,r){null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function n(){return new r(null)}var i="undefined"!=typeof navigator;i&&"Microsoft Internet Explorer"==navigator.appName?(r.prototype.am=function(e,t,r,n,i,o){for(var s=32767&t,a=t>>15;--o>=0;){var c=32767&this[e],u=this[e++]>>15,f=a*c+u*s;i=((c=s*c+((32767&f)<<15)+r[n]+(1073741823&i))>>>30)+(f>>>15)+a*u+(i>>>30),r[n++]=1073741823&c}return i},t=30):i&&"Netscape"!=navigator.appName?(r.prototype.am=function(e,t,r,n,i,o){for(;--o>=0;){var s=t*this[e++]+r[n]+i;i=Math.floor(s/67108864),r[n++]=67108863&s}return i},t=26):(r.prototype.am=function(e,t,r,n,i,o){for(var s=16383&t,a=t>>14;--o>=0;){var c=16383&this[e],u=this[e++]>>14,f=a*c+u*s;i=((c=s*c+((16383&f)<<14)+r[n]+i)>>28)+(f>>14)+a*u,r[n++]=268435455&c}return i},t=28),r.prototype.DB=t,r.prototype.DM=(1<>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function h(e){this.m=e}function d(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function v(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function w(){}function E(e){return e}function _(e){this.r2=n(),this.q3=n(),r.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}h.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},h.prototype.revert=function(e){return e},h.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},h.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},h.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},d.prototype.convert=function(e){var t=n();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(r.ZERO)>0&&this.m.subTo(t,t),t},d.prototype.revert=function(e){var t=n();return e.copyTo(t),this.reduce(t),t},d.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t>15)*this.mpl&this.um)<<15)&e.DM;for(e[r=t+this.m.t]+=this.m.am(0,n,e,t,0,this.m.t);e[r]>=e.DV;)e[r]-=e.DV,e[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},d.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},d.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},r.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s},r.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0},r.prototype.fromString=function(e,t){var n;if(16==t)n=4;else if(8==t)n=3;else if(256==t)n=8;else if(2==t)n=1;else if(32==t)n=5;else{if(4!=t)return void this.fromRadix(e,t);n=2}this.t=0,this.s=0;for(var i=e.length,o=!1,s=0;--i>=0;){var a=8==n?255&e[i]:u(e,i);a<0?"-"==e.charAt(i)&&(o=!0):(o=!1,0==s?this[this.t++]=a:s+n>this.DB?(this[this.t-1]|=(a&(1<>this.DB-s):this[this.t-1]|=a<=this.DB&&(s-=this.DB))}8==n&&0!=(128&e[0])&&(this.s=-1,s>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==e;)--this.t},r.prototype.dlShiftTo=function(e,t){var r;for(r=this.t-1;r>=0;--r)t[r+e]=this[r];for(r=e-1;r>=0;--r)t[r]=0;t.t=this.t+e,t.s=this.s},r.prototype.drShiftTo=function(e,t){for(var r=e;r=0;--r)t[r+s+1]=this[r]>>i|a,a=(this[r]&o)<=0;--r)t[r]=0;t[s]=a,t.t=this.t+s+1,t.s=this.s,t.clamp()},r.prototype.rShiftTo=function(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var n=e%this.DB,i=this.DB-n,o=(1<>n;for(var s=r+1;s>n;n>0&&(t[this.t-r-1]|=(this.s&o)<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t[r++]=this.DV+n:n>0&&(t[r++]=n),t.t=r,t.clamp()},r.prototype.multiplyTo=function(e,t){var n=this.abs(),i=e.abs(),o=n.t;for(t.t=o+i.t;--o>=0;)t[o]=0;for(o=0;o=0;)e[r]=0;for(r=0;r=t.DV&&(e[r+t.t]-=t.DV,e[r+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(r,t[r],e,2*r,0,1)),e.s=0,e.clamp()},r.prototype.divRemTo=function(e,t,i){var o=e.abs();if(!(o.t<=0)){var s=this.abs();if(s.t0?(o.lShiftTo(f,a),s.lShiftTo(f,i)):(o.copyTo(a),s.copyTo(i));var h=a.t,d=a[h-1];if(0!=d){var p=d*(1<1?a[h-2]>>this.F2:0),y=this.FV/p,g=(1<=0&&(i[i.t++]=1,i.subTo(w,i)),r.ONE.dlShiftTo(h,w),w.subTo(a,a);a.t=0;){var E=i[--m]==d?this.DM:Math.floor(i[m]*y+(i[m-1]+b)*g);if((i[m]+=a.am(0,E,i,v,0,h))0&&i.rShiftTo(f,i),c<0&&r.ZERO.subTo(i,i)}}},r.prototype.invDigit=function(){if(this.t<1)return 0;var e=this[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},r.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},r.prototype.exp=function(e,t){if(e>4294967295||e<1)return r.ONE;var i=n(),o=n(),s=t.convert(this),a=l(e)-1;for(s.copyTo(i);--a>=0;)if(t.sqrTo(i,o),(e&1<0)t.mulTo(o,s,i);else{var c=i;i=o,o=c}return t.revert(i)},r.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<0)for(a>a)>0&&(i=!0,o=c(r));s>=0;)a>(a+=this.DB-t)):(r=this[s]>>(a-=t)&n,a<=0&&(a+=this.DB,--s)),r>0&&(i=!0),i&&(o+=c(r));return i?o:"0"},r.prototype.negate=function(){var e=n();return r.ZERO.subTo(this,e),e},r.prototype.abs=function(){return this.s<0?this.negate():this},r.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this[r]-e[r]))return t;return 0},r.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+l(this[this.t-1]^this.s&this.DM)},r.prototype.mod=function(e){var t=n();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(r.ZERO)>0&&e.subTo(t,t),t},r.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new h(t):new d(t),this.exp(e,r)},r.ZERO=f(0),r.ONE=f(1),w.prototype.convert=E,w.prototype.revert=E,w.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},w.prototype.sqrTo=function(e,t){e.squareTo(t)},_.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=n();return e.copyTo(t),this.reduce(t),t},_.prototype.revert=function(e){return e},_.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},_.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},_.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var S,A,T,I=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],C=(1<<26)/I[I.length-1];function P(){var e;e=(new Date).getTime(),A[T++]^=255&e,A[T++]^=e>>8&255,A[T++]^=e>>16&255,A[T++]^=e>>24&255,T>=N&&(T-=N)}if(r.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},r.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),i=f(r),o=n(),s=n(),a="";for(this.divRemTo(i,o,s);o.signum()>0;)a=(r+s.intValue()).toString(e).substr(1)+a,o.divRemTo(i,o,s);return s.intValue().toString(e)+a},r.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var n=this.chunkSize(t),i=Math.pow(t,n),o=!1,s=0,a=0,c=0;c=n&&(this.dMultiply(i),this.dAddOffset(a,0),s=0,a=0))}s>0&&(this.dMultiply(Math.pow(t,s)),this.dAddOffset(a,0)),o&&r.ZERO.subTo(this,this)},r.prototype.fromNumber=function(e,t,n){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,n),this.testBit(e-1)||this.bitwiseTo(r.ONE.shiftLeft(e-1),y,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(r.ONE.shiftLeft(e-1),this);else{var i=new Array,o=7&e;i.length=1+(e>>3),t.nextBytes(i),o>0?i[0]&=(1<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t[r++]=n:n<-1&&(t[r++]=this.DV+n),t.t=r,t.clamp()},r.prototype.dMultiply=function(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},r.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}},r.prototype.multiplyLowerTo=function(e,t,r){var n,i=Math.min(this.t+e.t,t);for(r.s=0,r.t=i;i>0;)r[--i]=0;for(n=r.t-this.t;i=0;)r[n]=0;for(n=Math.max(t-this.t,0);n0)if(0==t)r=this[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this[n])%e;return r},r.prototype.millerRabin=function(e){var t=this.subtract(r.ONE),i=t.getLowestSetBit();if(i<=0)return!1;var o=t.shiftRight(i);(e=e+1>>1)>I.length&&(e=I.length);for(var s=n(),a=0;a>24},r.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},r.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},r.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var r,n=this.DB-e*this.DB%8,i=0;if(e-- >0)for(n>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<=0;)n<8?(r=(this[e]&(1<>(n+=this.DB-8)):(r=this[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(t[i++]=r);return t},r.prototype.equals=function(e){return 0==this.compareTo(e)},r.prototype.min=function(e){return this.compareTo(e)<0?this:e},r.prototype.max=function(e){return this.compareTo(e)>0?this:e},r.prototype.and=function(e){var t=n();return this.bitwiseTo(e,p,t),t},r.prototype.or=function(e){var t=n();return this.bitwiseTo(e,y,t),t},r.prototype.xor=function(e){var t=n();return this.bitwiseTo(e,g,t),t},r.prototype.andNot=function(e){var t=n();return this.bitwiseTo(e,b,t),t},r.prototype.not=function(){for(var e=n(),t=0;t=this.t?0!=this.s:0!=(this[t]&1<1){var y=n();for(i.sqrTo(a[1],y);c<=p;)a[c]=n(),i.mulTo(y,a[c-2],a[c]),c+=2}var g,b,m=e.t-1,v=!0,w=n();for(o=l(e[m])-1;m>=0;){for(o>=u?g=e[m]>>o-u&p:(g=(e[m]&(1<0&&(g|=e[m-1]>>this.DB+o-u)),c=r;0==(1&g);)g>>=1,--c;if((o-=c)<0&&(o+=this.DB,--m),v)a[g].copyTo(s),v=!1;else{for(;c>1;)i.sqrTo(s,w),i.sqrTo(w,s),c-=2;c>0?i.sqrTo(s,w):(b=s,s=w,w=b),i.mulTo(w,a[g],s)}for(;m>=0&&0==(e[m]&1<=0?(n.subTo(i,n),t&&o.subTo(a,o),s.subTo(c,s)):(i.subTo(n,i),t&&a.subTo(o,a),c.subTo(s,c))}return 0!=i.compareTo(r.ONE)?r.ZERO:c.compareTo(e)>=0?c.subtract(e):c.signum()<0?(c.addTo(e,c),c.signum()<0?c.add(e):c):c},r.prototype.pow=function(e){return this.exp(e,new w)},r.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var i=t.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return t;for(i0&&(t.rShiftTo(o,t),r.rShiftTo(o,r));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r},r.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r[0]<=I[I.length-1]){for(t=0;t>>8,A[T++]=255&R;T=0,P()}function x(){if(null==S){for(P(),(S=new O).init(A),T=0;T{"use strict";const n=r(32114),i={16:"aes-128-ctr",32:"aes-256-ctr"};e.exports=function(e){const t=i[e.length];if(!t){const t=Object.entries(i).map((([e,t])=>`${e} (${t})`)).join(" / ");throw n(new Error(`Invalid key length ${e.length} bytes. Must be ${t}`),"ERR_INVALID_KEY_LENGTH")}return t}},98380:(e,t,r)=>{"use strict";r(8925);const n=r(3832),{toString:i}=r(92263),{fromString:o}=r(52217);e.exports={createCipheriv:(e,t,r)=>{const s=n.cipher.createCipher("AES-CTR",i(t,"ascii"));return s.start({iv:i(r,"ascii")}),{update:e=>(s.update(n.util.createBuffer(i(e,"ascii"))),o(s.output.getBytes(),"ascii"))}},createDecipheriv:(e,t,r)=>{const s=n.cipher.createDecipher("AES-CTR",i(t,"ascii"));return s.start({iv:i(r,"ascii")}),{update:e=>(s.update(n.util.createBuffer(i(e,"ascii"))),o(s.output.getBytes(),"ascii"))}}}},88411:(e,t,r)=>{"use strict";const n=r(98380),i=r(73226);t.create=async function(e,t){const r=i(e),o=n.createCipheriv(r,e,t),s=n.createDecipheriv(r,e,t);return{encrypt:async e=>o.update(e),decrypt:async e=>s.update(e)}}},27552:(e,t,r)=>{"use strict";const{concat:n}=r(20605),{fromString:i}=r(52217),o=r(63649);e.exports={create:function({algorithm:e="AES-GCM",nonceLength:t=12,keyLength:r=16,digest:s="SHA-256",saltLength:a=16,iterations:c=32767}={}){const u=o.get();return r*=8,{encrypt:async function(o,f){const l=u.getRandomValues(new Uint8Array(a)),h=u.getRandomValues(new Uint8Array(t)),d={name:e,iv:h},p={name:"PBKDF2",salt:l,iterations:c,hash:{name:s}},y=await u.subtle.importKey("raw",i(f),{name:"PBKDF2"},!1,["deriveKey","deriveBits"]),g=await u.subtle.deriveKey(p,y,{name:e,length:r},!0,["encrypt"]),b=await u.subtle.encrypt(d,g,o);return n([l,d.iv,new Uint8Array(b)])},decrypt:async function(n,o){const f=n.slice(0,a),l=n.slice(a,a+t),h=n.slice(a+t),d={name:e,iv:l},p={name:"PBKDF2",salt:f,iterations:c,hash:{name:s}},y=await u.subtle.importKey("raw",i(o),{name:"PBKDF2"},!1,["deriveKey","deriveBits"]),g=await u.subtle.deriveKey(p,y,{name:e,length:r},!0,["decrypt"]),b=await u.subtle.decrypt(d,g,h);return new Uint8Array(b)}}}}},31088:(e,t,r)=>{"use strict";const n=r(63649),i=r(38872),o={SHA1:"SHA-1",SHA256:"SHA-256",SHA512:"SHA-512"};t.create=async function(e,t){const r=o[e],s=await n.get().subtle.importKey("raw",t,{name:"HMAC",hash:{name:r}},!1,["sign"]);return{digest:async e=>(async(e,t)=>{const r=await n.get().subtle.sign({name:"HMAC"},e,t);return new Uint8Array(r,r.byteOffset,r.byteLength)})(s,e),length:i[e]}}},38872:e=>{"use strict";e.exports={SHA1:20,SHA256:32,SHA512:64}},82204:(e,t,r)=>{"use strict";const n=r(31088),i=r(88411),o=r(14437);t.aes=i,t.hmac=n,t.keys=o,t.randomBytes=r(87503),t.pbkdf2=r(93221)},78590:(e,t,r)=>{"use strict";const n=r(32114),i=r(63649),{base64urlToBuffer:o}=r(56441),s=r(45753),{toString:a}=r(92263),{concat:c}=r(20605),{equals:u}=r(19588),f={"P-256":256,"P-384":384,"P-521":521};t.generateEphmeralKeyPair=async function(e){s(Object.keys(f),e);const t=await i.get().subtle.generateKey({name:"ECDH",namedCurve:e},!0,["deriveBits"]);return{key:h(await i.get().subtle.exportKey("jwk",t.publicKey)),genSharedKey:async(r,n)=>{let o;o=n?await i.get().subtle.importKey("jwk",p(e,n),{name:"ECDH",namedCurve:e},!1,["deriveBits"]):t.privateKey;const s=[await i.get().subtle.importKey("jwk",d(e,r),{name:"ECDH",namedCurve:e},!1,[]),o],a=await i.get().subtle.deriveBits({name:"ECDH",namedCurve:e,public:s[0]},s[1],f[e]);return new Uint8Array(a,a.byteOffset,a.byteLength)}}};const l={"P-256":32,"P-384":48,"P-521":66};function h(e){const t=l[e.crv];return c([Uint8Array.from([4]),o(e.x,t),o(e.y,t)],1+2*t)}function d(e,t){const r=l[e];if(u(!t.slice(0,1),Uint8Array.from([4])))throw n(new Error("Cannot unmarshal public key - invalid key format"),"ERR_INVALID_KEY_FORMAT");return{kty:"EC",crv:e,x:a(t.slice(1,r+1),"base64url"),y:a(t.slice(1+r),"base64url"),ext:!0}}const p=(e,t)=>({...d(e,t.public),d:a(t.private,"base64url")})},96535:(e,t,r)=>{"use strict";const n=r(32114),{equals:i}=r(19588),{sha256:o}=r(56155),{base58btc:s}=r(99086),{identity:a}=r(78103),c=r(71127),u=r(17241),f=r(69716);class l{constructor(e){this._key=d(e,c.publicKeyLength)}async verify(e,t){return c.hashAndVerify(this._key,t,e)}marshal(){return this._key}get bytes(){return u.PublicKey.encode({Type:u.KeyType.Ed25519,Data:this.marshal()}).finish()}equals(e){return i(this.bytes,e.bytes)}async hash(){const{bytes:e}=await o.digest(this.bytes);return e}}class h{constructor(e,t){this._key=d(e,c.privateKeyLength),this._publicKey=d(t,c.publicKeyLength)}async sign(e){return c.hashAndSign(this._key,e)}get public(){return new l(this._publicKey)}marshal(){return this._key}get bytes(){return u.PrivateKey.encode({Type:u.KeyType.Ed25519,Data:this.marshal()}).finish()}equals(e){return i(this.bytes,e.bytes)}async hash(){const{bytes:e}=await o.digest(this.bytes);return e}async id(){const e=await a.digest(this.public.bytes);return s.encode(e.bytes).substring(1)}async export(e,t="libp2p-key"){if("libp2p-key"===t)return f.export(this.bytes,e);throw n(new Error(`export format '${t}' is not supported`),"ERR_INVALID_EXPORT_FORMAT")}}function d(e,t){if((e=Uint8Array.from(e||[])).length!==t)throw n(new Error(`Key must be a Uint8Array of length ${t}, got ${e.length}`),"ERR_INVALID_KEY_TYPE");return e}e.exports={Ed25519PublicKey:l,Ed25519PrivateKey:h,unmarshalEd25519PrivateKey:function(e){if(e.length>c.privateKeyLength){const t=(e=d(e,c.privateKeyLength+c.publicKeyLength)).slice(0,c.privateKeyLength),r=e.slice(c.privateKeyLength,e.length);return new h(t,r)}const t=(e=d(e,c.privateKeyLength)).slice(0,c.privateKeyLength),r=e.slice(c.publicKeyLength);return new h(t,r)},unmarshalEd25519PublicKey:function(e){return e=d(e,c.publicKeyLength),new l(e)},generateKeyPair:async function(){const{privateKey:e,publicKey:t}=await c.generateKey();return new h(e,t)},generateKeyPairFromSeed:async function(e){const{privateKey:t,publicKey:r}=await c.generateKeyFromSeed(e);return new h(t,r)}}},71127:(e,t,r)=>{"use strict";const n=r(53710);function i(e,r){const n=new Uint8Array(t.privateKeyLength);for(let t=0;t<32;t++)n[t]=e[t],n[32+t]=r[t];return n}t.publicKeyLength=32,t.privateKeyLength=64,t.generateKey=async function(){const e=n.utils.randomPrivateKey(),t=await n.getPublicKey(e);return{privateKey:i(e,t),publicKey:t}},t.generateKeyFromSeed=async function(e){if(32!==e.length)throw new TypeError('"seed" must be 32 bytes in length.');if(!(e instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, or Uint8Array.');const t=e,r=await n.getPublicKey(t);return{privateKey:i(t,r),publicKey:r}},t.hashAndSign=function(e,t){const r=e.slice(0,32);return n.sign(t,r)},t.hashAndVerify=function(e,t,r){return n.verify(t,r,e)}},55563:(e,t,r)=>{"use strict";const n=r(78590);e.exports=async e=>n.generateEphmeralKeyPair(e)},69716:(e,t,r)=>{"use strict";const{base64:n}=r(9885),i=r(27552);e.exports={export:async function(e,t){const r=i.create(),o=await r.encrypt(e,t);return n.encode(o)}}},24709:(e,t,r)=>{"use strict";const{base64:n}=r(9885),i=r(27552);e.exports={import:async function(e,t){const r=n.decode(e),o=i.create();return await o.decrypt(r,t)}}},14437:(e,t,r)=>{"use strict";const n=r(17241);r(3068),r(97450);const i=r(3832),o=r(32114),{fromString:s}=r(52217),a=r(24709),c={rsa:r(19950),ed25519:r(96535),secp256k1:r(49434)(n,r(87503))},u="secp256k1 support requires libp2p-crypto-secp256k1 package",f="ERR_MISSING_PACKAGE";function l(e){const t=c[e.toLowerCase()];if(!t){const t=Object.keys(c).join(" / ");throw o(new Error(`invalid or unsupported key type ${e}. Must be ${t}`),"ERR_UNSUPPORTED_KEY_TYPE")}return t}const h=async e=>{const t=n.PrivateKey.decode(e),r=t.Data;switch(t.Type){case n.KeyType.RSA:return c.rsa.unmarshalRsaPrivateKey(r);case n.KeyType.Ed25519:return c.ed25519.unmarshalEd25519PrivateKey(r);case n.KeyType.Secp256k1:if(c.secp256k1)return c.secp256k1.unmarshalSecp256k1PrivateKey(r);throw o(new Error(u),f);default:l(t.Type)}};e.exports={supportedKeys:c,keysPBM:n,keyStretcher:r(73494),generateEphemeralKeyPair:r(55563),generateKeyPair:async(e,t)=>l(e).generateKeyPair(t),generateKeyPairFromSeed:async(e,t,r)=>{const n=l(e);if("ed25519"!==e.toLowerCase())throw o(new Error("Seed key derivation is unimplemented for RSA or secp256k1"),"ERR_UNSUPPORTED_KEY_DERIVATION_TYPE");return n.generateKeyPairFromSeed(t,r)},unmarshalPublicKey:e=>{const t=n.PublicKey.decode(e),r=t.Data;switch(t.Type){case n.KeyType.RSA:return c.rsa.unmarshalRsaPublicKey(r);case n.KeyType.Ed25519:return c.ed25519.unmarshalEd25519PublicKey(r);case n.KeyType.Secp256k1:if(c.secp256k1)return c.secp256k1.unmarshalSecp256k1PublicKey(r);throw o(new Error(u),f);default:l(t.Type)}},marshalPublicKey:(e,t)=>(l(t=(t||"rsa").toLowerCase()),e.bytes),unmarshalPrivateKey:h,marshalPrivateKey:(e,t)=>(l(t=(t||"rsa").toLowerCase()),e.bytes),import:async(e,t)=>{try{const r=await a.import(e,t);return h(r)}catch(e){}const r=i.pki.decryptRsaPrivateKey(e,t);if(null===r)throw o(new Error("Cannot read the key, most likely the password is wrong or not a RSA key"),"ERR_CANNOT_DECRYPT_PEM");let n=i.asn1.toDer(i.pki.privateKeyToAsn1(r));return n=s(n.getBytes(),"ascii"),c.rsa.unmarshalRsaPrivateKey(n)}}},925:(e,t,r)=>{"use strict";r(28095);const n=r(3832),{base64urlToBigInteger:i}=r(56441);function o(e,t){return t.map((t=>i(e[t])))}e.exports={jwk2pub:function(e){return n.pki.setRsaPublicKey(...o(e,["n","e"]))},jwk2priv:function(e){return n.pki.setRsaPrivateKey(...o(e,["n","e","d","p","q","dp","dq","qi"]))}}},73494:(e,t,r)=>{"use strict";const n=r(32114),{concat:i}=r(20605),{fromString:o}=r(52217),s=r(31088),a={"AES-128":{ivSize:16,keySize:16},"AES-256":{ivSize:16,keySize:32},Blowfish:{ivSize:8,cipherKeySize:32}};e.exports=async(e,t,r)=>{const c=a[e];if(!c){const t=Object.keys(a).join(" / ");throw n(new Error(`unknown cipher type '${e}'. Must be ${t}`),"ERR_INVALID_CIPHER_TYPE")}if(!t)throw n(new Error("missing hash type"),"ERR_MISSING_HASH_TYPE");const u=c.keySize,f=c.ivSize,l=o("key expansion"),h=2*(f+u+20),d=await s.create(t,r);let p=await d.digest(l);const y=[];let g=0;for(;gh&&(t=h-g),y.push(e),g+=t,p=await d.digest(p)}const b=h/2,m=i(y),v=m.slice(0,b),w=m.slice(b,h),E=e=>({iv:e.slice(0,f),cipherKey:e.slice(f,f+u),macKey:e.slice(f+u)});return{k1:E(v),k2:E(w)}}},17241:(e,t,r)=>{"use strict";var n,i,o=r(62100),s=o.Reader,a=o.Writer,c=o.util,u=o.roots["libp2p-crypto-keys"]||(o.roots["libp2p-crypto-keys"]={});u.KeyType=(n={},(i=Object.create(n))[n[0]="RSA"]=0,i[n[1]="Ed25519"]=1,i[n[2]="Secp256k1"]=2,i),u.PublicKey=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.Type=e.int32();break;case 2:n.Data=e.bytes();break;default:e.skipType(7&i)}}if(!n.hasOwnProperty("Type"))throw c.ProtocolError("missing required 'Type'",{instance:n});if(!n.hasOwnProperty("Data"))throw c.ProtocolError("missing required 'Data'",{instance:n});return n},e.fromObject=function(e){if(e instanceof u.PublicKey)return e;var t=new u.PublicKey;switch(e.Type){case"RSA":case 0:t.Type=0;break;case"Ed25519":case 1:t.Type=1;break;case"Secp256k1":case 2:t.Type=2}return null!=e.Data&&("string"==typeof e.Data?c.base64.decode(e.Data,t.Data=c.newBuffer(c.base64.length(e.Data)),0):e.Data.length&&(t.Data=e.Data)),t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(r.Type=t.enums===String?"RSA":0,t.bytes===String?r.Data="":(r.Data=[],t.bytes!==Array&&(r.Data=c.newBuffer(r.Data)))),null!=e.Type&&e.hasOwnProperty("Type")&&(r.Type=t.enums===String?u.KeyType[e.Type]:e.Type),null!=e.Data&&e.hasOwnProperty("Data")&&(r.Data=t.bytes===String?c.base64.encode(e.Data,0,e.Data.length):t.bytes===Array?Array.prototype.slice.call(e.Data):e.Data),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),u.PrivateKey=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.Type=e.int32();break;case 2:n.Data=e.bytes();break;default:e.skipType(7&i)}}if(!n.hasOwnProperty("Type"))throw c.ProtocolError("missing required 'Type'",{instance:n});if(!n.hasOwnProperty("Data"))throw c.ProtocolError("missing required 'Data'",{instance:n});return n},e.fromObject=function(e){if(e instanceof u.PrivateKey)return e;var t=new u.PrivateKey;switch(e.Type){case"RSA":case 0:t.Type=0;break;case"Ed25519":case 1:t.Type=1;break;case"Secp256k1":case 2:t.Type=2}return null!=e.Data&&("string"==typeof e.Data?c.base64.decode(e.Data,t.Data=c.newBuffer(c.base64.length(e.Data)),0):e.Data.length&&(t.Data=e.Data)),t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(r.Type=t.enums===String?"RSA":0,t.bytes===String?r.Data="":(r.Data=[],t.bytes!==Array&&(r.Data=c.newBuffer(r.Data)))),null!=e.Type&&e.hasOwnProperty("Type")&&(r.Type=t.enums===String?u.KeyType[e.Type]:e.Type),null!=e.Data&&e.hasOwnProperty("Data")&&(r.Data=t.bytes===String?c.base64.encode(e.Data,0,e.Data.length):t.bytes===Array?Array.prototype.slice.call(e.Data):e.Data),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),e.exports=u},96741:(e,t,r)=>{"use strict";const n=r(63649),i=r(87503),{toString:o}=r(92263),{fromString:s}=r(52217);function a(e){return Promise.all([n.get().subtle.exportKey("jwk",e.privateKey),n.get().subtle.exportKey("jwk",e.publicKey)])}t.utils=r(94604),t.generateKey=async function(e){const t=await n.get().subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]),r=await a(t);return{privateKey:r[0],publicKey:r[1]}},t.unmarshalPrivateKey=async function(e){const t=[await n.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]),await(r=e,n.get().subtle.importKey("jwk",{kty:r.kty,n:r.n,e:r.e},{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"]))];var r;const i=await a({privateKey:t[0],publicKey:t[1]});return{privateKey:i[0],publicKey:i[1]}},t.getRandomValues=i,t.hashAndSign=async function(e,t){const r=await n.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]),i=await n.get().subtle.sign({name:"RSASSA-PKCS1-v1_5"},r,Uint8Array.from(t));return new Uint8Array(i,i.byteOffset,i.byteLength)},t.hashAndVerify=async function(e,t,r){const i=await n.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]);return n.get().subtle.verify({name:"RSASSA-PKCS1-v1_5"},i,t,r)};const{jwk2pub:c,jwk2priv:u}=r(925);function f(e,t,r,n){const i=t?c(e):u(e),a=n(o(Uint8Array.from(r),"ascii"),i);return s(a,"ascii")}t.encrypt=function(e,t){return f(e,!0,t,((e,t)=>t.encrypt(e)))},t.decrypt=function(e,t){return f(e,!1,t,((e,t)=>t.decrypt(e)))}},19950:(e,t,r)=>{"use strict";const{sha256:n}=r(56155),i=r(32114),{equals:o}=r(19588),{toString:s}=r(92263);r(63219);const a=r(3832),c=r(96741),u=r(17241),f=r(69716);class l{constructor(e){this._key=e}async verify(e,t){return c.hashAndVerify(this._key,t,e)}marshal(){return c.utils.jwkToPkix(this._key)}get bytes(){return u.PublicKey.encode({Type:u.KeyType.RSA,Data:this.marshal()}).finish()}encrypt(e){return c.encrypt(this._key,e)}equals(e){return o(this.bytes,e.bytes)}async hash(){const{bytes:e}=await n.digest(this.bytes);return e}}class h{constructor(e,t){this._key=e,this._publicKey=t}genSecret(){return c.getRandomValues(16)}async sign(e){return c.hashAndSign(this._key,e)}get public(){if(!this._publicKey)throw i(new Error("public key not provided"),"ERR_PUBKEY_NOT_PROVIDED");return new l(this._publicKey)}decrypt(e){return c.decrypt(this._key,e)}marshal(){return c.utils.jwkToPkcs1(this._key)}get bytes(){return u.PrivateKey.encode({Type:u.KeyType.RSA,Data:this.marshal()}).finish()}equals(e){return o(this.bytes,e.bytes)}async hash(){const{bytes:e}=await n.digest(this.bytes);return e}async id(){const e=await this.public.hash();return s(e,"base58btc")}async export(e,t="pkcs-8"){if("pkcs-8"===t){const t=new a.util.ByteBuffer(this.marshal()),r=a.asn1.fromDer(t),n=a.pki.privateKeyFromAsn1(r),i={algorithm:"aes256",count:1e4,saltSize:16,prfAlgorithm:"sha512"};return a.pki.encryptRsaPrivateKey(n,e,i)}if("libp2p-key"===t)return f.export(this.bytes,e);throw i(new Error(`export format '${t}' is not supported`),"ERR_INVALID_EXPORT_FORMAT")}}e.exports={RsaPublicKey:l,RsaPrivateKey:h,unmarshalRsaPublicKey:function(e){const t=c.utils.pkixToJwk(e);return new l(t)},unmarshalRsaPrivateKey:async function(e){const t=c.utils.pkcs1ToJwk(e),r=await c.unmarshalPrivateKey(t);return new h(r.privateKey,r.publicKey)},generateKeyPair:async function(e){const t=await c.generateKey(e);return new h(t.privateKey,t.publicKey)},fromJwk:async function(e){const t=await c.unmarshalPrivateKey(e);return new h(t.privateKey,t.publicKey)}}},94604:(e,t,r)=>{"use strict";r(3068),r(28095);const n=r(3832),{bigIntegerToUintBase64url:i,base64urlToBigInteger:o}=r(56441),{fromString:s}=r(52217),{toString:a}=r(92263);t.pkcs1ToJwk=function(e){const t=n.asn1.fromDer(a(e,"ascii")),r=n.pki.privateKeyFromAsn1(t);return{kty:"RSA",n:i(r.n),e:i(r.e),d:i(r.d),p:i(r.p),q:i(r.q),dp:i(r.dP),dq:i(r.dQ),qi:i(r.qInv),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkcs1=function(e){const t=n.pki.privateKeyToAsn1({n:o(e.n),e:o(e.e),d:o(e.d),p:o(e.p),q:o(e.q),dP:o(e.dp),dQ:o(e.dq),qInv:o(e.qi)});return s(n.asn1.toDer(t).getBytes(),"ascii")},t.pkixToJwk=function(e){const t=n.asn1.fromDer(a(e,"ascii")),r=n.pki.publicKeyFromAsn1(t);return{kty:"RSA",n:i(r.n),e:i(r.e),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkix=function(e){const t=n.pki.publicKeyToAsn1({n:o(e.n),e:o(e.e)});return s(n.asn1.toDer(t).getBytes(),"ascii")}},49434:(e,t,r)=>{"use strict";const{sha256:n}=r(56155),i=r(32114),{equals:o}=r(19588),{toString:s}=r(92263),a=r(69716);e.exports=(e,t,c)=>{c=c||r(54056)();class u{constructor(e){c.validatePublicKey(e),this._key=e}verify(e,t){return c.hashAndVerify(this._key,t,e)}marshal(){return c.compressPublicKey(this._key)}get bytes(){return e.PublicKey.encode({Type:e.KeyType.Secp256k1,Data:this.marshal()}).finish()}equals(e){return o(this.bytes,e.bytes)}async hash(){const{bytes:e}=await n.digest(this.bytes);return e}}class f{constructor(e,t){this._key=e,this._publicKey=t||c.computePublicKey(e),c.validatePrivateKey(this._key),c.validatePublicKey(this._publicKey)}sign(e){return c.hashAndSign(this._key,e)}get public(){return new u(this._publicKey)}marshal(){return this._key}get bytes(){return e.PrivateKey.encode({Type:e.KeyType.Secp256k1,Data:this.marshal()}).finish()}equals(e){return o(this.bytes,e.bytes)}async hash(){const{bytes:e}=await n.digest(this.bytes);return e}async id(){const e=await this.public.hash();return s(e,"base58btc")}async export(e,t="libp2p-key"){if("libp2p-key"===t)return a.export(this.bytes,e);throw i(new Error(`export format '${t}' is not supported`),"ERR_INVALID_EXPORT_FORMAT")}}return{Secp256k1PublicKey:u,Secp256k1PrivateKey:f,unmarshalSecp256k1PrivateKey:function(e){return new f(e)},unmarshalSecp256k1PublicKey:function(e){return new u(e)},generateKeyPair:async function(){const e=await c.generateKey();return new f(e)}}}},54056:(e,t,r)=>{"use strict";const n=r(32114),i=r(1795),{sha256:o}=r(56155);e.exports=()=>({generateKey:function(){return i.utils.randomPrivateKey()},privateKeyLength:32,hashAndSign:async function(e,t){const{digest:r}=await o.digest(t);try{return await i.sign(r,e)}catch(e){throw n(e,"ERR_INVALID_INPUT")}},hashAndVerify:async function(e,t,r){try{const{digest:n}=await o.digest(r);return i.verify(t,n,e)}catch(e){throw n(e,"ERR_INVALID_INPUT")}},compressPublicKey:function(e){return i.Point.fromHex(e).toRawBytes(!0)},decompressPublicKey:function(e){return i.Point.fromHex(e).toRawBytes(!1)},validatePrivateKey:function(e){try{i.getPublicKey(e,!0)}catch(e){throw n(e,"ERR_INVALID_PRIVATE_KEY")}},validatePublicKey:function(e){try{i.Point.fromHex(e)}catch(e){throw n(e,"ERR_INVALID_PUBLIC_KEY")}},computePublicKey:function(e){try{return i.getPublicKey(e,!0)}catch(e){throw n(e,"ERR_INVALID_PRIVATE_KEY")}}})},45753:(e,t,r)=>{"use strict";const n=r(32114);e.exports=function(e,t){if(!e.includes(t)){const r=e.join(" / ");throw n(new Error(`Unknown curve: ${t}. Must be ${r}`),"ERR_INVALID_CURVE")}}},93221:(e,t,r)=>{"use strict";const n=r(98960),i=r(97116),o=r(32114),s={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};e.exports=function(e,t,r,a,c){const u=s[c];if(!u){const e=Object.keys(s).join(" / ");throw o(new Error(`Hash '${c}' is unknown or not supported. Must be ${e}`),"ERR_UNSUPPORTED_HASH_TYPE")}const f=n(e,t,r,a,u);return i.encode64(f)}},87503:(e,t,r)=>{"use strict";const n=r(1914),i=r(32114);e.exports=function(e){if(isNaN(e)||e<=0)throw i(new Error("random bytes length must be a Number bigger than 0"),"ERR_INVALID_LENGTH");return n(e)}},56441:(e,t,r)=>{"use strict";r(97116),r(15764);const n=r(3832),{fromString:i}=r(52217),{toString:o}=r(92263),{concat:s}=r(20605);t.bigIntegerToUintBase64url=(e,t)=>{let r=Uint8Array.from(e.abs().toByteArray());if(r=0===r[0]?r.slice(1):r,null!=t){if(r.length>t)throw new Error("byte array longer than desired length");r=s([new Uint8Array(t-r.length),r])}return o(r,"base64url")},t.base64urlToBigInteger=e=>{const r=t.base64urlToBuffer(e);return new n.jsbn.BigInteger(o(r,"base16"),16)},t.base64urlToBuffer=(e,t)=>{let r=i(e,"base64urlpad");if(null!=t){if(r.length>t)throw new Error("byte array longer than desired length");r=s([new Uint8Array(t-r.length),r])}return r}},63649:(e,t)=>{"use strict";t.get=(e=globalThis)=>{const t=e.crypto;if(!t||!t.subtle)throw Object.assign(new Error("Missing Web Crypto API. The most likely cause of this error is that this page is being accessed from an insecure context (i.e. not HTTPS). For more information and possible resolutions see https://github.com/libp2p/js-libp2p-crypto/blob/master/README.md#web-crypto-api"),{code:"ERR_MISSING_WEB_CRYPTO"});return t}},79414:(e,t,r)=>{"use strict";const n=r(88785),{Multiaddr:i}=r(46584),o=r(32114),{OPEN:s,CLOSING:a,CLOSED:c}=r(26067),u=Symbol.for("@libp2p/interface-connection/connection");class f{constructor({localAddr:e,remoteAddr:t,localPeer:r,remotePeer:a,newStream:c,close:u,getStreams:f,stat:l}){!function(e,t,r,s,a,c,u){if(e&&!i.isMultiaddr(e))throw o(new Error("localAddr must be an instance of multiaddr"),"ERR_INVALID_PARAMETERS");if(!n.isPeerId(t))throw o(new Error("localPeer must be an instance of peer-id"),"ERR_INVALID_PARAMETERS");if(!n.isPeerId(r))throw o(new Error("remotePeer must be an instance of peer-id"),"ERR_INVALID_PARAMETERS");if("function"!=typeof s)throw o(new Error("new stream must be a function"),"ERR_INVALID_PARAMETERS");if("function"!=typeof a)throw o(new Error("close must be a function"),"ERR_INVALID_PARAMETERS");if("function"!=typeof c)throw o(new Error("getStreams must be a function"),"ERR_INVALID_PARAMETERS");if(!u)throw o(new Error("connection metadata object must be provided"),"ERR_INVALID_PARAMETERS");if("inbound"!==u.direction&&"outbound"!==u.direction)throw o(new Error('direction must be "inbound" or "outbound"'),"ERR_INVALID_PARAMETERS");if(!u.timeline)throw o(new Error("connection timeline object must be provided in the stat object"),"ERR_INVALID_PARAMETERS");if(!u.timeline.open)throw o(new Error("connection open timestamp must be provided"),"ERR_INVALID_PARAMETERS");if(!u.timeline.upgraded)throw o(new Error("connection upgraded timestamp must be provided"),"ERR_INVALID_PARAMETERS")}(e,r,a,c,u,f,l),this.id=parseInt(String(1e9*Math.random())).toString(36)+Date.now(),this.localAddr=e,this.remoteAddr=t,this.localPeer=r,this.remotePeer=a,this._stat={...l,status:s},this._newStream=c,this._close=u,this._getStreams=f,this.registry=new Map,this.tags=[]}get[Symbol.toStringTag](){return"Connection"}get[u](){return!0}static isConnection(e){return Boolean(e&&e[u])}get stat(){return this._stat}get streams(){return this._getStreams()}async newStream(e){if(this.stat.status===a)throw o(new Error("the connection is being closed"),"ERR_CONNECTION_BEING_CLOSED");if(this.stat.status===c)throw o(new Error("the connection is closed"),"ERR_CONNECTION_CLOSED");Array.isArray(e)||(e=[e]);const{stream:t,protocol:r}=await this._newStream(e);return this.addStream(t,{protocol:r}),{stream:t,protocol:r}}addStream(e,{protocol:t,metadata:r={}}){this.registry.set(e.id,{protocol:t,...r})}removeStream(e){this.registry.delete(e)}async close(){if(this.stat.status!==c){if(this._closing)return this._closing;this.stat.status=a,this._closing=await this._close(),this._stat.timeline.close=Date.now(),this.stat.status=c}}}e.exports=f},15458:(e,t,r)=>{"use strict";t.Connection=r(79414)},26067:e=>{"use strict";e.exports={OPEN:"open",CLOSING:"closing",CLOSED:"closed"}},7609:e=>{"use strict";const t=()=>{},r=Symbol.for("@libp2p/js-interfaces/topology");class n{constructor({min:e=0,max:r=1/0,handlers:n={}}){this.min=e,this.max=r,this._onConnect=n.onConnect||t,this._onDisconnect=n.onDisconnect||t,this.peers=new Set}get[Symbol.toStringTag](){return"Topology"}get[r](){return!0}static isTopology(e){return Boolean(e&&e[r])}set registrar(e){this._registrar=e}disconnect(e){this._onDisconnect(e)}}e.exports=n},13939:(e,t,r)=>{"use strict";const{Buffer:n}=r(24921),i=Symbol.for("BufferList");function o(e){if(!(this instanceof o))return new o(e);o._init.call(this,e)}o._init=function(e){Object.defineProperty(this,i,{value:!0}),this._bufs=[],this.length=0,e&&this.append(e)},o.prototype._new=function(e){return new o(e)},o.prototype._offset=function(e){if(0===e)return[0,0];let t=0;for(let r=0;rthis.length||e<0)return;const t=this._offset(e);return this._bufs[t[0]][t[1]]},o.prototype.slice=function(e,t){return"number"==typeof e&&e<0&&(e+=this.length),"number"==typeof t&&t<0&&(t+=this.length),this.copy(null,0,e,t)},o.prototype.copy=function(e,t,r,i){if(("number"!=typeof r||r<0)&&(r=0),("number"!=typeof i||i>this.length)&&(i=this.length),r>=this.length)return e||n.alloc(0);if(i<=0)return e||n.alloc(0);const o=!!e,s=this._offset(r),a=i-r;let c=a,u=o&&t||0,f=s[1];if(0===r&&i===this.length){if(!o)return 1===this._bufs.length?this._bufs[0]:n.concat(this._bufs,this.length);for(let t=0;tr)){this._bufs[t].copy(e,u,f,f+c),u+=r;break}this._bufs[t].copy(e,u,f),u+=r,c-=r,f&&(f=0)}return e.length>u?e.slice(0,u):e},o.prototype.shallowSlice=function(e,t){if(e=e||0,t="number"!=typeof t?this.length:t,e<0&&(e+=this.length),t<0&&(t+=this.length),e===t)return this._new();const r=this._offset(e),n=this._offset(t),i=this._bufs.slice(r[0],n[0]+1);return 0===n[1]?i.pop():i[i.length-1]=i[i.length-1].slice(0,n[1]),0!==r[1]&&(i[0]=i[0].slice(r[1])),this._new(i)},o.prototype.toString=function(e,t,r){return this.slice(t,r).toString(e)},o.prototype.consume=function(e){if(e=Math.trunc(e),Number.isNaN(e)||e<=0)return this;for(;this._bufs.length;){if(!(e>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},o.prototype.duplicate=function(){const e=this._new();for(let t=0;tthis.length?this.length:t;const i=this._offset(t);let o=i[0],s=i[1];for(;o=e.length){const r=t.indexOf(e,s);if(-1!==r)return this._reverseOffset([o,r]);s=t.length-e.length+1}else{const t=this._reverseOffset([o,s]);if(this._match(t,e))return t;s++}s=0}return-1},o.prototype._match=function(e,t){if(this.length-e{"use strict";var n=r(79742),i=r(80645),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=c,t.SlowBuffer=function(e){return+e!=e&&(e=0),c.alloc(+e)},t.INSPECT_MAX_BYTES=50;var s=2147483647;function a(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return l(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|y(e,t),n=a(r),i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(V(e,Uint8Array)){var t=new Uint8Array(e);return d(t.buffer,t.byteOffset,t.byteLength)}return h(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(V(e,ArrayBuffer)||e&&V(e.buffer,ArrayBuffer))return d(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(V(e,SharedArrayBuffer)||e&&V(e.buffer,SharedArrayBuffer)))return d(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return c.from(n,t,r);var i=function(e){if(c.isBuffer(e)){var t=0|p(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||F(e.length)?a(0):h(e):"Buffer"===e.type&&Array.isArray(e.data)?h(e.data):void 0}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function f(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function l(e){return f(e),a(e<0?0:0|p(e))}function h(e){for(var t=e.length<0?0:0|p(e.length),r=a(t),n=0;n=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function y(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||V(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return K(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return U(e).length;default:if(i)return n?-1:K(e).length;t=(""+t).toLowerCase(),i=!0}}function g(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return k(this,t,r);case"utf8":case"utf-8":return I(this,t,r);case"ascii":return P(this,t,r);case"latin1":case"binary":return R(this,t,r);case"base64":return T(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function b(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function m(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),F(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=c.from(t,n)),c.isBuffer(t))return 0===t.length?-1:v(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):v(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,r,n,i){var o,s=1,a=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var f=-1;for(o=r;oa&&(r=a-c),o=r;o>=0;o--){for(var l=!0,h=0;hi&&(n=i):n=i;var o=t.length;n>o/2&&(n=o/2);for(var s=0;s>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function T(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function I(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i239?4:u>223?3:u>191?2:1;if(i+l<=r)switch(l){case 1:u<128&&(f=u);break;case 2:128==(192&(o=e[i+1]))&&(c=(31&u)<<6|63&o)>127&&(f=c);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(c=(15&u)<<12|(63&o)<<6|63&s)>2047&&(c<55296||c>57343)&&(f=c);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(c=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(f=c)}null===f?(f=65533,l=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),i+=l}return function(e){var t=e.length;if(t<=C)return String.fromCharCode.apply(String,e);for(var r="",n=0;nn.length?c.from(o).copy(n,i):Uint8Array.prototype.set.call(n,o,i);else{if(!c.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i)}i+=o.length}return n},c.byteLength=y,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;tr&&(e+=" ... "),""},o&&(c.prototype[o]=c.prototype.inspect),c.prototype.compare=function(e,t,r,n,i){if(V(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),u=this.slice(n,i),f=e.slice(t,r),l=0;l>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return w(this,e,t,r);case"utf8":case"utf-8":return E(this,e,t,r);case"ascii":case"latin1":case"binary":return _(this,e,t,r);case"base64":return S(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var C=4096;function P(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;in)&&(r=n);for(var i="",o=t;or)throw new RangeError("Trying to access beyond buffer length")}function M(e,t,r,n,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function O(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function N(e,t,r,n,o){return t=+t,r>>>=0,o||O(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function L(e,t,r,n,o){return t=+t,r>>>=0,o||O(e,0,r,8),i.write(e,t,r,n,52,8),r+8}c.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||x(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||x(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||x(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||x(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||x(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||x(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||x(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||x(e,t,this.length);for(var n=this[e],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*t)),n},c.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||x(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return e>>>=0,t||x(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||x(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(e,t){e>>>=0,t||x(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||x(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||x(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return e>>>=0,t||x(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||x(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||x(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||x(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||M(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n||M(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);M(this,e,t,r,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o>0)-a&255;return t+r},c.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);M(this,e,t,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},c.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeFloatLE=function(e,t,r){return N(this,e,t,!0,r)},c.prototype.writeFloatBE=function(e,t,r){return N(this,e,t,!1,r)},c.prototype.writeDoubleLE=function(e,t,r){return L(this,e,t,!0,r)},c.prototype.writeDoubleBE=function(e,t,r){return L(this,e,t,!1,r)},c.prototype.copy=function(e,t,r,n){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function U(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(D,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function j(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function V(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function F(e){return e!=e}var q=function(){for(var e="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)t[n+i]=e[r]+e[i];return t}()},72842:e=>{"use strict";function t(e,t){for(const r in t)Object.defineProperty(e,r,{value:t[r],enumerable:!0,configurable:!0});return e}e.exports=function(e,r,n){if(!e||"string"==typeof e)throw new TypeError("Please pass an Error to err-code");n||(n={}),"object"==typeof r&&(n=r,r=void 0),null!=r&&(n.code=r);try{return t(e,n)}catch(r){n.message=e.message,n.stack=e.stack;const i=function(){};return i.prototype=Object.create(Object.getPrototypeOf(e)),t(new i,n)}}},3477:e=>{e.exports=function e(t,r){var n,i=0,o=0,s=r=r||0,a=t.length;do{if(s>=a||o>49)throw e.bytes=0,new RangeError("Could not decode varint");n=t[s++],i+=o<28?(127&n)<=128);return e.bytes=s-r,i}},38575:e=>{e.exports=function e(r,n,i){if(Number.MAX_SAFE_INTEGER&&r>Number.MAX_SAFE_INTEGER)throw e.bytes=0,new RangeError("Could not encode varint");n=n||[];for(var o=i=i||0;r>=t;)n[i++]=255&r|128,r/=128;for(;-128&r;)n[i++]=255&r|128,r>>>=7;return n[i]=0|r,e.bytes=i-o+1,n};var t=Math.pow(2,31)},4941:(e,t,r)=>{e.exports={encode:r(38575),decode:r(3477),encodingLength:r(23963)}},23963:e=>{var t=Math.pow(2,7),r=Math.pow(2,14),n=Math.pow(2,21),i=Math.pow(2,28),o=Math.pow(2,35),s=Math.pow(2,42),a=Math.pow(2,49),c=Math.pow(2,56),u=Math.pow(2,63);e.exports=function(e){return e{"use strict";const n=r(4941),i=r(13939);e.exports=e=>async function*(){const t=new o;for await(const r of e){const e=t.write(r);e.length&&(yield e)}}();class o{constructor(){this._buffer=new i,this._bufferProxy=new Proxy({},{get:(e,t)=>"l"===t[0]?this._buffer[t]:this._buffer.get(parseInt(t))}),this._headerInfo=null}write(e){if(!e||!e.length)return[];this._buffer.append(e);const t=[];for(;;){if(!this._headerInfo)try{this._headerInfo=this._decodeHeader(this._bufferProxy)}catch(e){break}const{id:e,type:r,length:n,offset:i}=this._headerInfo;if(this._buffer.length-i>3,type:7&t,offset:r,length:i}}}},45164:(e,t,r)=>{"use strict";const n=r(4941),i=r(13939),o=10240,s=new class{constructor(){this._pool=new Uint8Array(o),this._poolOffset=0}write(e){const t=this._pool;let r=this._poolOffset;n.encode(e.id<<3|e.type,t,r),r+=n.encode.bytes,n.encode(e.data?e.data.length:0,t,r),r+=n.encode.bytes;const i=t.subarray(this._poolOffset,r);return o-r<100?(this._pool=new Uint8Array(o),this._poolOffset=0):this._poolOffset=r,e.data?[i,e.data]:i}};e.exports=e=>async function*(){for await(const t of e)Array.isArray(t)?yield new i(t.map((e=>s.write(e)))):yield new i(s.write(t))}()},73209:(e,t,r)=>{"use strict";t.encode=r(45164),t.decode=r(75516)},1267:(e,t,r)=>{"use strict";e.exports=r(47932)},82492:(e,t)=>{"use strict";const r=Object.freeze({NEW_STREAM:0,MESSAGE_RECEIVER:1,MESSAGE_INITIATOR:2,CLOSE_RECEIVER:3,CLOSE_INITIATOR:4,RESET_RECEIVER:5,RESET_INITIATOR:6});t.MessageTypes=r,t.InitiatorMessageTypes=Object.freeze({NEW_STREAM:r.NEW_STREAM,MESSAGE:r.MESSAGE_INITIATOR,CLOSE:r.CLOSE_INITIATOR,RESET:r.RESET_INITIATOR}),t.ReceiverMessageTypes=Object.freeze({MESSAGE:r.MESSAGE_RECEIVER,CLOSE:r.CLOSE_RECEIVER,RESET:r.RESET_RECEIVER}),t.MessageTypeNames=Object.freeze(Object.entries(r).reduce(((e,t)=>(e[t[1]]=t[0],e)),{}))},47932:(e,t,r)=>{"use strict";const n=r(60618),i=r(84975),o=r(11227)("libp2p:mplex"),s=r(61623),a=r(73209),c=r(40092),{MessageTypes:u,MessageTypeNames:f}=r(82492),l=r(16048);class h{constructor(e){e="function"==typeof(e=e||{})?{onStream:e}:e,this._streamId=0,this._streams={initiators:new Map,receivers:new Map},this._options=e,this.sink=this._createSink(),this.source=this._createSource(),this.onStream=e.onStream,this.onStreamEnd=e.onStreamEnd}get streams(){const e=[];return this._streams.initiators.forEach((t=>{e.push(t)})),this._streams.receivers.forEach((t=>{e.push(t)})),e}newStream(e){const t=this._streamId++;e=null==e?t.toString():String(e);const r=this._streams.initiators;return this._newStream({id:t,name:e,type:"initiator",registry:r})}_newReceiverStream({id:e,name:t}){const r=this._streams.receivers;return this._newStream({id:e,name:t,type:"receiver",registry:r})}_newStream({id:e,name:t,type:r,registry:n}){if(n.has(e))throw new Error(`${r} stream ${e} already exists!`);o("new %s stream %s %s",r,e,t);const i=l({id:e,name:t,send:n=>(o.enabled&&o("%s stream %s %s send",r,e,t,{...n,type:f[n.type],data:n.data&&n.data.slice()}),this.source.push(n)),type:r,onEnd:()=>{o("%s stream %s %s ended",r,e,t),n.delete(e),this.onStreamEnd&&this.onStreamEnd(i)},maxMsgSize:this._options.maxMsgSize});return n.set(e,i),i}_createSink(){return async e=>{this._options.signal&&(e=s(e,this._options.signal));try{await n(e,a.decode,c(this._options.maxMsgSize),(async e=>{for await(const t of e)for(const e of t)this._handleIncoming(e)}))}catch(e){return o("error in sink",e),this.source.end(e)}this.source.end()}}_createSource(){const e=i({onEnd:e=>{const{initiators:t,receivers:r}=this._streams;for(const r of t.values())r.abort(e);for(const t of r.values())t.abort(e)},writev:!0});return Object.assign(a.encode(e),{push:e.push,end:e.end,return:e.return})}_handleIncoming({id:e,type:t,data:r}){if(o.enabled&&o("incoming message",{id:e,type:f[t],data:r.slice()}),t===u.NEW_STREAM&&this.onStream){const t=this._newReceiverStream({id:e,name:r.toString()});return this.onStream(t)}const n=(1&t?this._streams.initiators:this._streams.receivers).get(e);if(!n)return o("missing stream %s",e);switch(t){case u.MESSAGE_INITIATOR:case u.MESSAGE_RECEIVER:n.source.push(r);break;case u.CLOSE_INITIATOR:case u.CLOSE_RECEIVER:n.close();break;case u.RESET_INITIATOR:case u.RESET_RECEIVER:n.reset();break;default:o("unknown message type %s",t)}}}h.multicodec="/mplex/6.7.0",e.exports=h},40092:e=>{"use strict";const t=1<<20;e.exports=e=>{e=e||t;const r=t=>{if(t.data&&t.data.length>e)throw Object.assign(new Error("message size too large!"),{code:"ERR_MSG_TOO_BIG"})};return e=>async function*(){for await(const t of e)Array.isArray(t)?t.forEach(r):r(t),yield t}()},e.exports.MAX_MSG_SIZE=t},16048:(e,t,r)=>{"use strict";const n=r(61623),i=r(28599),o=r(11227)("libp2p:mplex:stream"),s=r(84975),a=r(13939),c=r(72842),{MAX_MSG_SIZE:u}=r(40092),{InitiatorMessageTypes:f,ReceiverMessageTypes:l}=r(82492),h="ERR_MPLEX_STREAM_RESET";e.exports=({id:e,name:t,send:r,onEnd:d=(()=>{}),type:p="initiator",maxMsgSize:y=u})=>{const g=new i,b=new i,m="initiator"===p?f:l,v="initiator"===p?`i${e}`:`r${e}`;t=String(null==t?e:t);let w,E=!1,_=!1;const S=e=>{_||(_=!0,o("%s stream %s sink end",p,t,e),e&&!w&&(w=e),E&&(A.timeline.close=Date.now(),d(w)))},A={close:()=>A.source.end(),abort:e=>{o("%s stream %s abort",p,t,e),A.source.end(e),g.abort(),S(e)},reset:()=>{const e=c(new Error("stream reset"),h);b.abort(),A.source.end(e),S(e)},sink:async i=>{i=n(i,[{signal:g.signal,options:{abortMessage:"stream aborted",abortCode:"ERR_MPLEX_STREAM_ABORT"}},{signal:b.signal,options:{abortMessage:"stream reset",abortCode:h}}]),"initiator"===p&&r({id:e,type:m.NEW_STREAM,data:t});try{for await(let t of i)for(;t.length;){if(t.length<=y){r({id:e,type:m.MESSAGE,data:t});break}t=a.isBufferList(t)?t:new a(t),r({id:e,type:m.MESSAGE,data:t.shallowSlice(0,y)}),t.consume(y)}}catch(n){return n.code===h?o("%s stream %s reset",p,t):(o("%s stream %s error",p,t,n),r({id:e,type:m.RESET})),A.source.end(n),S(n)}r({id:e,type:m.CLOSE}),S()},source:s((e=>{E||(E=!0,o("%s stream %s source end",p,t,e),e&&!w&&(w=e),_&&(A.timeline.close=Date.now(),d(w)))})),timeline:{open:Date.now(),close:null},id:v};return A}},53737:(e,t,r)=>{"use strict";const n=r(81980);function i(e,t){const r=n(e.multiaddr),i=n(t.multiaddr);return r&&!i?1:!r&&i||e.isCertified&&!t.isCertified?-1:!e.isCertified&&t.isCertified?1:0}e.exports.publicAddressesFirst=function(e){return[...e].sort(i)}},52942:e=>{"use strict";e.exports=function(e,t){return e.length===t.length&&t.sort()&&e.sort().every(((e,r)=>t[r].equals(e)))}},489:(e,t,r)=>{"use strict";const n=r(11227),i=Object.assign(n("libp2p:ip-port-to-multiaddr"),{error:n("libp2p:ip-port-to-multiaddr:err")}),{Multiaddr:o}=r(46584),s=r(32114),{Address4:a,Address6:c}=r(91843),u={ERR_INVALID_IP_PARAMETER:"ERR_INVALID_IP_PARAMETER",ERR_INVALID_PORT_PARAMETER:"ERR_INVALID_PORT_PARAMETER",ERR_INVALID_IP:"ERR_INVALID_IP"};e.exports=function(e,t){if("string"!=typeof e)throw s(new Error(`invalid ip provided: ${e}`),u.ERR_INVALID_IP_PARAMETER);if("string"==typeof t&&(t=parseInt(t)),isNaN(t))throw s(new Error(`invalid port provided: ${t}`),u.ERR_INVALID_PORT_PARAMETER);try{return new a(e),new o(`/ip4/${e}/tcp/${t}`)}catch{}try{const r=new c(e);return r.is4()?new o(`/ip4/${r.to4().correctForm()}/tcp/${t}`):new o(`/ip6/${e}/tcp/${t}`)}catch(r){const n=`invalid ip:port for creating a multiaddr: ${e}:${t}`;throw i.error(n),s(new Error(n),u.ERR_INVALID_IP)}},e.exports.Errors=u},23830:(e,t,r)=>{"use strict";const n=r(51890);e.exports=function(e){const{address:t}=e.nodeAddress();return n(t)}},81980:(e,t,r)=>{"use strict";const n=r(290);e.exports=function(e){const{address:t}=e.nodeAddress();return n(t)}},15091:(e,t,r)=>{"use strict";const{source:n}=r(61623),i=r(11227)("libp2p:stream:converter");e.exports=function({stream:e,remoteAddr:t,localAddr:r},o={}){const{sink:s,source:a}=e,c={async sink(e){o.signal&&(e=n(e,o.signal));try{await s(e)}catch(e){"aborted"!==e.type&&i(e)}u()},source:o.signal?n(a,o.signal):a,conn:e,localAddr:r,remoteAddr:t,timeline:{open:Date.now(),close:void 0},close:()=>(s(new Uint8Array(0)),u())};function u(){return c.timeline.close||(c.timeline.close=Date.now()),Promise.resolve()}return c}},16288:(e,t,r)=>{"use strict";var n=r(34155);const i=r(59134),o="object"==typeof window&&"object"==typeof document&&9===document.nodeType,s=i(),a=o&&!s,c=s&&!o,u=s&&o,f=void 0!==n&&void 0!==n.release&&"node"===n.release.name&&!s,l="function"==typeof importScripts&&"undefined"!=typeof self&&"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,h=void 0!==n&&void 0!==n.env&&!1,d="undefined"!=typeof navigator&&"ReactNative"===navigator.product;e.exports={isTest:h,isElectron:s,isElectronMain:c,isElectronRenderer:u,isNode:f,isBrowser:a,isWebWorker:l,isEnvWithDom:o,isReactNative:d}},61073:(e,t,r)=>{const{Multiaddr:n}=r(46584),i=(e,t)=>t,o={ip4:i,ip6:(e,t,r,n)=>1===n.length&&"ip6"===n[0].protocol?t:`[${t}]`,tcp:(e,t,r,n,i)=>n.some((e=>["http","https","ws","wss"].includes(e.protocol)))?`${e}:${t}`:((e,t,r,n)=>{if(n&&!1===n.assumeHttp)return`tcp://${e}:${t}`;let i="tcp",o=`:${t}`;return"tcp"===r[r.length-1].protocol&&(i="443"===t?"https":"http",o="443"===t||"80"===t?"":o),`${i}://${e}${o}`})(e,t,n,i),udp:(e,t)=>`udp://${e}:${t}`,dnsaddr:i,dns4:i,dns6:i,ipfs:(e,t)=>`${e}/ipfs/${t}`,p2p:(e,t)=>`${e}/p2p/${t}`,http:e=>`http://${e}`,https:e=>`https://${e}`,ws:e=>`ws://${e}`,wss:e=>`wss://${e}`,"p2p-websocket-star":e=>`${e}/p2p-websocket-star`,"p2p-webrtc-star":e=>`${e}/p2p-webrtc-star`,"p2p-webrtc-direct":e=>`${e}/p2p-webrtc-direct`};e.exports=(e,t)=>{const r=new n(e),i=e.toString().split("/").slice(1);return r.tuples().map((e=>({protocol:i.shift(),content:e[1]?i.shift():null}))).reduce(((e,r,n,i)=>{const s=o[r.protocol];if(!s)throw new Error(`Unsupported protocol ${r.protocol}`);return s(e,r.content,n,i,t)}),"")}},33199:(e,t)=>{"use strict";t.CODE_P2P=421,t.CODE_CIRCUIT=290,t.CODE_TCP=6,t.CODE_WS=477,t.CODE_WSS=478,t.CLOSE_TIMEOUT=2e3},70040:(e,t,r)=>{"use strict";const n=r(29175),{CODE_CIRCUIT:i,CODE_P2P:o,CODE_TCP:s,CODE_WS:a,CODE_WSS:c}=r(33199);e.exports={all:e=>e.filter((e=>{if(e.protoCodes().includes(i))return!1;const t=e.decapsulateCode(o);return n.WebSockets.matches(t)||n.WebSocketsSecure.matches(t)})),dnsWss:e=>e.filter((e=>{if(e.protoCodes().includes(i))return!1;const t=e.decapsulateCode(o);return n.WebSocketsSecure.matches(t)&&n.DNS.matches(t.decapsulateCode(s).decapsulateCode(c))})),dnsWsOrWss:e=>e.filter((e=>{if(e.protoCodes().includes(i))return!1;const t=e.decapsulateCode(o);return n.WebSockets.matches(t)?n.DNS.matches(t.decapsulateCode(s).decapsulateCode(a)):n.WebSocketsSecure.matches(t)&&n.DNS.matches(t.decapsulateCode(s).decapsulateCode(c))}))}},29846:(e,t,r)=>{"use strict";const n=r(6476),i=r(98514),o=r(61073),{AbortError:s}=r(61623),a=r(63931),c=r(11227),u=c("libp2p:websockets");u.error=c("libp2p:websockets:error");const f=r(16288),l=r(89174),h=r(10863),d=r(70040);e.exports=i(class{constructor({upgrader:e,filter:t}){if(!e)throw new Error("An upgrader must be provided. See https://github.com/libp2p/interface-transport#upgrader.");this._upgrader=e,this._filter=t}async dial(e,t={}){u("dialing %s",e);const r=await this._connect(e,t),n=h(r,{remoteAddr:e,signal:t.signal});u("new outbound connection %s",n.remoteAddr);const i=await this._upgrader.upgradeOutbound(n);return u("outbound connection %s upgraded",n.remoteAddr),i}async _connect(e,t={}){if(t.signal&&t.signal.aborted)throw new s;const r=e.toOptions();u("dialing %s:%s",r.host,r.port);const i=a(),c=e=>{const t=`connection error: ${e.message}`;u.error(t),i.reject(e)},f=n(o(e),Object.assign({binary:!0},t));if(f.socket.on?f.socket.on("error",c):f.socket.onerror=c,!t.signal)return await Promise.race([f.connected(),i.promise]),u("connected %s",e),f;let l;const h=new Promise(((e,r)=>{if(l=()=>{r(new s),setTimeout((()=>{f.close()}))},t.signal.aborted)return l();t.signal.addEventListener("abort",l)}));try{await Promise.race([h,i.promise,f.connected()])}finally{t.signal.removeEventListener("abort",l)}return u("connected %s",e),f}createListener(e={},t){return"function"==typeof e&&(t=e,e={}),l({handler:t,upgrader:this._upgrader},e)}filter(e){return e=Array.isArray(e)?e:[e],this._filter?this._filter(e):f.isBrowser||f.isWebWorker?d.dnsWss(e):d.all(e)}},{className:"WebSockets",symbolName:"@libp2p/js-libp2p-websockets/websockets"})},89174:e=>{"use strict";e.exports=function(){throw new Error("WebSocket Servers can not be created in the browser!")}},10863:(e,t,r)=>{"use strict";const n=r(61623),{CLOSE_TIMEOUT:i}=r(33199),o=r(489),s=r(58147),a=r(11227),c=a("libp2p:websockets:socket");c.error=a("libp2p:websockets:socket:error"),e.exports=(e,t={})=>{const r={async sink(r){t.signal&&(r=n(r,t.signal));try{await e.sink(async function*(){for await(const e of r)yield e instanceof Uint8Array?e:e.slice()}())}catch(e){"aborted"!==e.type&&c.error(e)}},source:t.signal?n(e.source,t.signal):e.source,conn:e,localAddr:t.localAddr||(e.localAddress&&e.localPort?o(e.localAddress,e.localPort):void 0),remoteAddr:t.remoteAddr||o(e.remoteAddress,e.remotePort),timeline:{open:Date.now()},async close(){const t=Date.now();try{await s(e.close(),i)}catch(n){const{host:i,port:o}=r.remoteAddr.toOptions();c("timeout closing stream to %s:%s after %dms, destroying it manually",i,o,Date.now()-t),e.destroy()}finally{r.timeline.close=Date.now()}}};return e.socket.once&&e.socket.once("close",(()=>{r.timeline.close||(r.timeline.close=Date.now())})),r}},72826:(e,t,r)=>{"use strict";const{Buffer:n}=r(48764),i=r(9668),o=r(56842),s=4194304,a=n.alloc(0),c="readLength",u="readData",f={[c]:(e,t,r,n)=>{let o;t=t.append(e);try{o=n.lengthDecoder(t)}catch(e){if(t.length>n.maxLengthLength)throw Object.assign(e,{message:"message length too long",code:"ERR_MSG_LENGTH_TOO_LONG"});if(e instanceof RangeError)return{mode:c,buffer:t,chunk:void 0,state:void 0,data:void 0};throw e}if(o>n.maxDataLength)throw Object.assign(new Error("message data too long"),{code:"ERR_MSG_DATA_TOO_LONG"});return e=t.shallowSlice(n.lengthDecoder.bytes),t=new i,n.onLength&&n.onLength(o),o<=0?(n.onData&&n.onData(a),{mode:c,chunk:e,buffer:t,data:a}):{mode:u,chunk:e,buffer:t,state:{dataLength:o},data:void 0}},[u]:(e,t,r,n)=>{if(t=t.append(e),!r)throw new Error("state is required");if(t.lengtho?t.shallowSlice(o):void 0;return t=new i,n.onData&&n.onData(s),{mode:c,chunk:a,buffer:t,state:void 0,data:s}}};function l(e){const t={lengthDecoder:(e=e||{}).lengthDecoder||o,maxLengthLength:e.maxLengthLength||8,maxDataLength:e.maxDataLength||s,onLength:e.onLength,onData:e.onData};return async function*(e){let r,n=new i,o=c;for await(const i of e){let e=i;for(;e;){const i=f[o](e,n,r,t);o=i.mode,e=i.chunk,n=i.buffer,r=i.state,i.data&&(yield i.data)}}if(n.length)throw Object.assign(new Error("unexpected end of input"),{code:"ERR_UNEXPECTED_EOF"})}}l.fromReader=(e,t)=>{let r=1;const n={[Symbol.asyncIterator](){return this},next:async()=>{try{return await e.next(r)}catch(e){if("ERR_UNDER_READ"===e.code)return{done:!0,value:null};throw e}finally{r=1}}};return l({...t||{},onLength:e=>{r=e}})(n)},e.exports=l,e.exports.MAX_LENGTH_LENGTH=8,e.exports.MAX_DATA_LENGTH=s},50396:(e,t,r)=>{"use strict";const{Buffer:n}=r(48764),i=r(9668),o=r(60911);function s(e){e=e||{};const t=Math.max(e.poolSize||10240,e.minPoolSize||8),r=e.lengthEncoder||o;return async function*(e){let o=n.alloc(t),s=0;for await(const a of e){r(a.length,o,s);const e=o.slice(s,s+r.bytes);s+=r.bytes,o.length-s<8&&(o=n.alloc(t),s=0),yield(new i).append(e).append(a)}}}s.single=(e,t)=>{const r=(t=t||{}).lengthEncoder||o;return new i([r(e.length),e.slice()])},e.exports=s,e.exports.MIN_POOL_SIZE=8,e.exports.DEFAULT_POOL_SIZE=10240},63500:(e,t,r)=>{"use strict";t.encode=r(50396),t.decode=r(72826),t.varintEncode=r(60911),t.varintDecode=r(56842),t.int32BEEncode=r(22660),t.int32BEDecode=r(3100)},3100:e=>{"use strict";const t=e=>{if(e.length<4)throw RangeError("Could not decode int32BE");return e.readInt32BE(0)};t.bytes=4,e.exports=t},22660:(e,t,r)=>{"use strict";const{Buffer:n}=r(48764),i=(e,t,r)=>((t=t||n.allocUnsafe(4)).writeInt32BE(e,r),t);i.bytes=4,e.exports=i},56842:(e,t,r)=>{"use strict";const n=r(31997),{Buffer:i}=r(48764),o=e=>{const t=n.decode(i.isBuffer(e)?e:(r=e,new Proxy({},{get:(e,t)=>"l"===t[0]?r[t]:r.get(parseInt(t))})));var r;return o.bytes=n.decode.bytes,t};e.exports=o},60911:(e,t,r)=>{"use strict";const n=r(31997),{Buffer:i}=r(48764),o=(e,t,r)=>{const s=n.encode(e,t,r);return o.bytes=n.encode.bytes,t||i.from(s)};e.exports=o},78621:(e,t,r)=>{"use strict";const n=r(32114),i={16:"aes-128-ctr",32:"aes-256-ctr"};e.exports=function(e){const t=i[e.length];if(!t){const t=Object.entries(i).map((([e,t])=>`${e} (${t})`)).join(" / ");throw n(new Error(`Invalid key length ${e.length} bytes. Must be ${t}`),"ERR_INVALID_KEY_LENGTH")}return t}},76590:(e,t,r)=>{"use strict";r(8925);const n=r(3832),{toString:i}=r(92263),{fromString:o}=r(52217);e.exports={createCipheriv:(e,t,r)=>{const s=n.cipher.createCipher("AES-CTR",i(t,"ascii"));return s.start({iv:i(r,"ascii")}),{update:e=>(s.update(n.util.createBuffer(i(e,"ascii"))),o(s.output.getBytes(),"ascii"))}},createDecipheriv:(e,t,r)=>{const s=n.cipher.createDecipher("AES-CTR",i(t,"ascii"));return s.start({iv:i(r,"ascii")}),{update:e=>(s.update(n.util.createBuffer(i(e,"ascii"))),o(s.output.getBytes(),"ascii"))}}}},32100:(e,t,r)=>{"use strict";const n=r(76590),i=r(78621);t.create=async function(e,t){const r=i(e),o=n.createCipheriv(r,e,t),s=n.createDecipheriv(r,e,t);return{encrypt:async e=>o.update(e),decrypt:async e=>s.update(e)}}},92485:(e,t,r)=>{"use strict";const{concat:n}=r(20605),{fromString:i}=r(52217),o=r(87518);e.exports={create:function({algorithm:e="AES-GCM",nonceLength:t=12,keyLength:r=16,digest:s="SHA-256",saltLength:a=16,iterations:c=32767}={}){const u=o.get();return r*=8,{encrypt:async function(o,f){const l=u.getRandomValues(new Uint8Array(a)),h=u.getRandomValues(new Uint8Array(t)),d={name:e,iv:h},p={name:"PBKDF2",salt:l,iterations:c,hash:{name:s}},y=await u.subtle.importKey("raw",i(f),{name:"PBKDF2"},!1,["deriveKey","deriveBits"]),g=await u.subtle.deriveKey(p,y,{name:e,length:r},!0,["encrypt"]),b=await u.subtle.encrypt(d,g,o);return n([l,d.iv,new Uint8Array(b)])},decrypt:async function(n,o){const f=n.slice(0,a),l=n.slice(a,a+t),h=n.slice(a+t),d={name:e,iv:l},p={name:"PBKDF2",salt:f,iterations:c,hash:{name:s}},y=await u.subtle.importKey("raw",i(o),{name:"PBKDF2"},!1,["deriveKey","deriveBits"]),g=await u.subtle.deriveKey(p,y,{name:e,length:r},!0,["decrypt"]),b=await u.subtle.decrypt(d,g,h);return new Uint8Array(b)}}}}},48690:(e,t,r)=>{"use strict";const n=r(87518),i=r(36482),o={SHA1:"SHA-1",SHA256:"SHA-256",SHA512:"SHA-512"};t.create=async function(e,t){const r=o[e],s=await n.get().subtle.importKey("raw",t,{name:"HMAC",hash:{name:r}},!1,["sign"]);return{digest:async e=>(async(e,t)=>{const r=await n.get().subtle.sign({name:"HMAC"},e,t);return new Uint8Array(r,r.byteOffset,r.byteLength)})(s,e),length:i[e]}}},36482:e=>{"use strict";e.exports={SHA1:20,SHA256:32,SHA512:64}},49928:(e,t,r)=>{"use strict";const n=r(48690),i=r(32100),o=r(92826);t.aes=i,t.hmac=n,t.keys=o,t.randomBytes=r(53890),t.pbkdf2=r(57493)},18294:(e,t,r)=>{"use strict";const n=r(32114),i=r(87518),{base64urlToBuffer:o}=r(28894),s=r(50439),{toString:a}=r(92263),{concat:c}=r(20605),{equals:u}=r(19588),f={"P-256":256,"P-384":384,"P-521":521};t.generateEphmeralKeyPair=async function(e){s(Object.keys(f),e);const t=await i.get().subtle.generateKey({name:"ECDH",namedCurve:e},!0,["deriveBits"]);return{key:h(await i.get().subtle.exportKey("jwk",t.publicKey)),genSharedKey:async(r,n)=>{let o;o=n?await i.get().subtle.importKey("jwk",p(e,n),{name:"ECDH",namedCurve:e},!1,["deriveBits"]):t.privateKey;const s=[await i.get().subtle.importKey("jwk",d(e,r),{name:"ECDH",namedCurve:e},!1,[]),o],a=await i.get().subtle.deriveBits({name:"ECDH",namedCurve:e,public:s[0]},s[1],f[e]);return new Uint8Array(a,a.byteOffset,a.byteLength)}}};const l={"P-256":32,"P-384":48,"P-521":66};function h(e){const t=l[e.crv];return c([Uint8Array.from([4]),o(e.x,t),o(e.y,t)],1+2*t)}function d(e,t){const r=l[e];if(u(!t.slice(0,1),Uint8Array.from([4])))throw n(new Error("Cannot unmarshal public key - invalid key format"),"ERR_INVALID_KEY_FORMAT");return{kty:"EC",crv:e,x:a(t.slice(1,r+1),"base64url"),y:a(t.slice(1+r),"base64url"),ext:!0}}const p=(e,t)=>({...d(e,t.public),d:a(t.private,"base64url")})},23924:(e,t,r)=>{"use strict";const n=r(32114),{equals:i}=r(19588),{sha256:o}=r(56155),{base58btc:s}=r(99086),{identity:a}=r(78103),c=r(57217),u=r(5345),f=r(70427);class l{constructor(e){this._key=d(e,c.publicKeyLength)}async verify(e,t){return c.hashAndVerify(this._key,t,e)}marshal(){return this._key}get bytes(){return u.PublicKey.encode({Type:u.KeyType.Ed25519,Data:this.marshal()}).finish()}equals(e){return i(this.bytes,e.bytes)}async hash(){const{bytes:e}=await o.digest(this.bytes);return e}}class h{constructor(e,t){this._key=d(e,c.privateKeyLength),this._publicKey=d(t,c.publicKeyLength)}async sign(e){return c.hashAndSign(this._key,e)}get public(){return new l(this._publicKey)}marshal(){return this._key}get bytes(){return u.PrivateKey.encode({Type:u.KeyType.Ed25519,Data:this.marshal()}).finish()}equals(e){return i(this.bytes,e.bytes)}async hash(){const{bytes:e}=await o.digest(this.bytes);return e}async id(){const e=await a.digest(this.public.bytes);return s.encode(e.bytes).substring(1)}async export(e,t="libp2p-key"){if("libp2p-key"===t)return f.export(this.bytes,e);throw n(new Error(`export format '${t}' is not supported`),"ERR_INVALID_EXPORT_FORMAT")}}function d(e,t){if((e=Uint8Array.from(e||[])).length!==t)throw n(new Error(`Key must be a Uint8Array of length ${t}, got ${e.length}`),"ERR_INVALID_KEY_TYPE");return e}e.exports={Ed25519PublicKey:l,Ed25519PrivateKey:h,unmarshalEd25519PrivateKey:function(e){if(e.length>c.privateKeyLength){const t=(e=d(e,c.privateKeyLength+c.publicKeyLength)).slice(0,c.privateKeyLength),r=e.slice(c.privateKeyLength,e.length);return new h(t,r)}const t=(e=d(e,c.privateKeyLength)).slice(0,c.privateKeyLength),r=e.slice(c.publicKeyLength);return new h(t,r)},unmarshalEd25519PublicKey:function(e){return e=d(e,c.publicKeyLength),new l(e)},generateKeyPair:async function(){const{privateKey:e,publicKey:t}=await c.generateKey();return new h(e,t)},generateKeyPairFromSeed:async function(e){const{privateKey:t,publicKey:r}=await c.generateKeyFromSeed(e);return new h(t,r)}}},57217:(e,t,r)=>{"use strict";r(80069);const n=r(3832);t.publicKeyLength=n.pki.ed25519.constants.PUBLIC_KEY_BYTE_LENGTH,t.privateKeyLength=n.pki.ed25519.constants.PRIVATE_KEY_BYTE_LENGTH,t.generateKey=async function(){return n.pki.ed25519.generateKeyPair()},t.generateKeyFromSeed=async function(e){return n.pki.ed25519.generateKeyPair({seed:e})},t.hashAndSign=async function(e,t){return n.pki.ed25519.sign({message:t,privateKey:e})},t.hashAndVerify=async function(e,t,r){return n.pki.ed25519.verify({signature:t,message:r,publicKey:e})}},74340:(e,t,r)=>{"use strict";const n=r(18294);e.exports=async e=>n.generateEphmeralKeyPair(e)},70427:(e,t,r)=>{"use strict";const{base64:n}=r(9885),i=r(92485);e.exports={export:async function(e,t){const r=i.create(),o=await r.encrypt(e,t);return n.encode(o)}}},75475:(e,t,r)=>{"use strict";const{base64:n}=r(9885),i=r(92485);e.exports={import:async function(e,t){const r=n.decode(e),o=i.create();return await o.decrypt(r,t)}}},92826:(e,t,r)=>{"use strict";const n=r(5345);r(3068),r(97450);const i=r(3832),o=r(32114),{fromString:s}=r(52217),a=r(75475),c={rsa:r(42162),ed25519:r(23924),secp256k1:r(9321)(n,r(53890))},u="secp256k1 support requires libp2p-crypto-secp256k1 package",f="ERR_MISSING_PACKAGE";function l(e){const t=c[e.toLowerCase()];if(!t){const t=Object.keys(c).join(" / ");throw o(new Error(`invalid or unsupported key type ${e}. Must be ${t}`),"ERR_UNSUPPORTED_KEY_TYPE")}return t}const h=async e=>{const t=n.PrivateKey.decode(e),r=t.Data;switch(t.Type){case n.KeyType.RSA:return c.rsa.unmarshalRsaPrivateKey(r);case n.KeyType.Ed25519:return c.ed25519.unmarshalEd25519PrivateKey(r);case n.KeyType.Secp256k1:if(c.secp256k1)return c.secp256k1.unmarshalSecp256k1PrivateKey(r);throw o(new Error(u),f);default:l(t.Type)}};e.exports={supportedKeys:c,keysPBM:n,keyStretcher:r(65954),generateEphemeralKeyPair:r(74340),generateKeyPair:async(e,t)=>l(e).generateKeyPair(t),generateKeyPairFromSeed:async(e,t,r)=>{const n=l(e);if("ed25519"!==e.toLowerCase())throw o(new Error("Seed key derivation is unimplemented for RSA or secp256k1"),"ERR_UNSUPPORTED_KEY_DERIVATION_TYPE");return n.generateKeyPairFromSeed(t,r)},unmarshalPublicKey:e=>{const t=n.PublicKey.decode(e),r=t.Data;switch(t.Type){case n.KeyType.RSA:return c.rsa.unmarshalRsaPublicKey(r);case n.KeyType.Ed25519:return c.ed25519.unmarshalEd25519PublicKey(r);case n.KeyType.Secp256k1:if(c.secp256k1)return c.secp256k1.unmarshalSecp256k1PublicKey(r);throw o(new Error(u),f);default:l(t.Type)}},marshalPublicKey:(e,t)=>(l(t=(t||"rsa").toLowerCase()),e.bytes),unmarshalPrivateKey:h,marshalPrivateKey:(e,t)=>(l(t=(t||"rsa").toLowerCase()),e.bytes),import:async(e,t)=>{try{const r=await a.import(e,t);return h(r)}catch(e){}const r=i.pki.decryptRsaPrivateKey(e,t);if(null===r)throw o(new Error("Cannot read the key, most likely the password is wrong or not a RSA key"),"ERR_CANNOT_DECRYPT_PEM");let n=i.asn1.toDer(i.pki.privateKeyToAsn1(r));return n=s(n.getBytes(),"ascii"),c.rsa.unmarshalRsaPrivateKey(n)}}},75396:(e,t,r)=>{"use strict";r(28095);const n=r(3832),{base64urlToBigInteger:i}=r(28894);function o(e,t){return t.map((t=>i(e[t])))}e.exports={jwk2pub:function(e){return n.pki.setRsaPublicKey(...o(e,["n","e"]))},jwk2priv:function(e){return n.pki.setRsaPrivateKey(...o(e,["n","e","d","p","q","dp","dq","qi"]))}}},65954:(e,t,r)=>{"use strict";const n=r(32114),{concat:i}=r(20605),{fromString:o}=r(52217),s=r(48690),a={"AES-128":{ivSize:16,keySize:16},"AES-256":{ivSize:16,keySize:32},Blowfish:{ivSize:8,cipherKeySize:32}};e.exports=async(e,t,r)=>{const c=a[e];if(!c){const t=Object.keys(a).join(" / ");throw n(new Error(`unknown cipher type '${e}'. Must be ${t}`),"ERR_INVALID_CIPHER_TYPE")}if(!t)throw n(new Error("missing hash type"),"ERR_MISSING_HASH_TYPE");const u=c.keySize,f=c.ivSize,l=o("key expansion"),h=2*(f+u+20),d=await s.create(t,r);let p=await d.digest(l);const y=[];let g=0;for(;gh&&(t=h-g),y.push(e),g+=t,p=await d.digest(p)}const b=h/2,m=i(y),v=m.slice(0,b),w=m.slice(b,h),E=e=>({iv:e.slice(0,f),cipherKey:e.slice(f,f+u),macKey:e.slice(f+u)});return{k1:E(v),k2:E(w)}}},5345:(e,t,r)=>{"use strict";var n,i,o=r(62100),s=o.Reader,a=o.Writer,c=o.util,u=o.roots["libp2p-crypto-keys"]||(o.roots["libp2p-crypto-keys"]={});u.KeyType=(n={},(i=Object.create(n))[n[0]="RSA"]=0,i[n[1]="Ed25519"]=1,i[n[2]="Secp256k1"]=2,i),u.PublicKey=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.Type=e.int32();break;case 2:n.Data=e.bytes();break;default:e.skipType(7&i)}}if(!n.hasOwnProperty("Type"))throw c.ProtocolError("missing required 'Type'",{instance:n});if(!n.hasOwnProperty("Data"))throw c.ProtocolError("missing required 'Data'",{instance:n});return n},e.fromObject=function(e){if(e instanceof u.PublicKey)return e;var t=new u.PublicKey;switch(e.Type){case"RSA":case 0:t.Type=0;break;case"Ed25519":case 1:t.Type=1;break;case"Secp256k1":case 2:t.Type=2}return null!=e.Data&&("string"==typeof e.Data?c.base64.decode(e.Data,t.Data=c.newBuffer(c.base64.length(e.Data)),0):e.Data.length&&(t.Data=e.Data)),t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(r.Type=t.enums===String?"RSA":0,t.bytes===String?r.Data="":(r.Data=[],t.bytes!==Array&&(r.Data=c.newBuffer(r.Data)))),null!=e.Type&&e.hasOwnProperty("Type")&&(r.Type=t.enums===String?u.KeyType[e.Type]:e.Type),null!=e.Data&&e.hasOwnProperty("Data")&&(r.Data=t.bytes===String?c.base64.encode(e.Data,0,e.Data.length):t.bytes===Array?Array.prototype.slice.call(e.Data):e.Data),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),u.PrivateKey=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.Type=e.int32();break;case 2:n.Data=e.bytes();break;default:e.skipType(7&i)}}if(!n.hasOwnProperty("Type"))throw c.ProtocolError("missing required 'Type'",{instance:n});if(!n.hasOwnProperty("Data"))throw c.ProtocolError("missing required 'Data'",{instance:n});return n},e.fromObject=function(e){if(e instanceof u.PrivateKey)return e;var t=new u.PrivateKey;switch(e.Type){case"RSA":case 0:t.Type=0;break;case"Ed25519":case 1:t.Type=1;break;case"Secp256k1":case 2:t.Type=2}return null!=e.Data&&("string"==typeof e.Data?c.base64.decode(e.Data,t.Data=c.newBuffer(c.base64.length(e.Data)),0):e.Data.length&&(t.Data=e.Data)),t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(r.Type=t.enums===String?"RSA":0,t.bytes===String?r.Data="":(r.Data=[],t.bytes!==Array&&(r.Data=c.newBuffer(r.Data)))),null!=e.Type&&e.hasOwnProperty("Type")&&(r.Type=t.enums===String?u.KeyType[e.Type]:e.Type),null!=e.Data&&e.hasOwnProperty("Data")&&(r.Data=t.bytes===String?c.base64.encode(e.Data,0,e.Data.length):t.bytes===Array?Array.prototype.slice.call(e.Data):e.Data),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),e.exports=u},41860:(e,t,r)=>{"use strict";const n=r(87518),i=r(53890),{toString:o}=r(92263),{fromString:s}=r(52217);function a(e){return Promise.all([n.get().subtle.exportKey("jwk",e.privateKey),n.get().subtle.exportKey("jwk",e.publicKey)])}t.utils=r(48707),t.generateKey=async function(e){const t=await n.get().subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]),r=await a(t);return{privateKey:r[0],publicKey:r[1]}},t.unmarshalPrivateKey=async function(e){const t=[await n.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]),await(r=e,n.get().subtle.importKey("jwk",{kty:r.kty,n:r.n,e:r.e},{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"]))];var r;const i=await a({privateKey:t[0],publicKey:t[1]});return{privateKey:i[0],publicKey:i[1]}},t.getRandomValues=i,t.hashAndSign=async function(e,t){const r=await n.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]),i=await n.get().subtle.sign({name:"RSASSA-PKCS1-v1_5"},r,Uint8Array.from(t));return new Uint8Array(i,i.byteOffset,i.byteLength)},t.hashAndVerify=async function(e,t,r){const i=await n.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]);return n.get().subtle.verify({name:"RSASSA-PKCS1-v1_5"},i,t,r)};const{jwk2pub:c,jwk2priv:u}=r(75396);function f(e,t,r,n){const i=t?c(e):u(e),a=n(o(Uint8Array.from(r),"ascii"),i);return s(a,"ascii")}t.encrypt=function(e,t){return f(e,!0,t,((e,t)=>t.encrypt(e)))},t.decrypt=function(e,t){return f(e,!1,t,((e,t)=>t.decrypt(e)))}},42162:(e,t,r)=>{"use strict";const{sha256:n}=r(56155),i=r(32114),{equals:o}=r(19588),{toString:s}=r(92263);r(63219),r(80069);const a=r(3832),c=r(41860),u=r(5345),f=r(70427);class l{constructor(e){this._key=e}async verify(e,t){return c.hashAndVerify(this._key,t,e)}marshal(){return c.utils.jwkToPkix(this._key)}get bytes(){return u.PublicKey.encode({Type:u.KeyType.RSA,Data:this.marshal()}).finish()}encrypt(e){return c.encrypt(this._key,e)}equals(e){return o(this.bytes,e.bytes)}async hash(){const{bytes:e}=await n.digest(this.bytes);return e}}class h{constructor(e,t){this._key=e,this._publicKey=t}genSecret(){return c.getRandomValues(16)}async sign(e){return c.hashAndSign(this._key,e)}get public(){if(!this._publicKey)throw i(new Error("public key not provided"),"ERR_PUBKEY_NOT_PROVIDED");return new l(this._publicKey)}decrypt(e){return c.decrypt(this._key,e)}marshal(){return c.utils.jwkToPkcs1(this._key)}get bytes(){return u.PrivateKey.encode({Type:u.KeyType.RSA,Data:this.marshal()}).finish()}equals(e){return o(this.bytes,e.bytes)}async hash(){const{bytes:e}=await n.digest(this.bytes);return e}async id(){const e=await this.public.hash();return s(e,"base58btc")}async export(e,t="pkcs-8"){if("pkcs-8"===t){const t=new a.util.ByteBuffer(this.marshal()),r=a.asn1.fromDer(t),n=a.pki.privateKeyFromAsn1(r),i={algorithm:"aes256",count:1e4,saltSize:16,prfAlgorithm:"sha512"};return a.pki.encryptRsaPrivateKey(n,e,i)}if("libp2p-key"===t)return f.export(this.bytes,e);throw i(new Error(`export format '${t}' is not supported`),"ERR_INVALID_EXPORT_FORMAT")}}e.exports={RsaPublicKey:l,RsaPrivateKey:h,unmarshalRsaPublicKey:function(e){const t=c.utils.pkixToJwk(e);return new l(t)},unmarshalRsaPrivateKey:async function(e){const t=c.utils.pkcs1ToJwk(e),r=await c.unmarshalPrivateKey(t);return new h(r.privateKey,r.publicKey)},generateKeyPair:async function(e){const t=await c.generateKey(e);return new h(t.privateKey,t.publicKey)},fromJwk:async function(e){const t=await c.unmarshalPrivateKey(e);return new h(t.privateKey,t.publicKey)}}},48707:(e,t,r)=>{"use strict";r(3068),r(28095);const n=r(3832),{bigIntegerToUintBase64url:i,base64urlToBigInteger:o}=r(28894),{fromString:s}=r(52217),{toString:a}=r(92263);t.pkcs1ToJwk=function(e){const t=n.asn1.fromDer(a(e,"ascii")),r=n.pki.privateKeyFromAsn1(t);return{kty:"RSA",n:i(r.n),e:i(r.e),d:i(r.d),p:i(r.p),q:i(r.q),dp:i(r.dP),dq:i(r.dQ),qi:i(r.qInv),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkcs1=function(e){const t=n.pki.privateKeyToAsn1({n:o(e.n),e:o(e.e),d:o(e.d),p:o(e.p),q:o(e.q),dP:o(e.dp),dQ:o(e.dq),qInv:o(e.qi)});return s(n.asn1.toDer(t).getBytes(),"ascii")},t.pkixToJwk=function(e){const t=n.asn1.fromDer(a(e,"ascii")),r=n.pki.publicKeyFromAsn1(t);return{kty:"RSA",n:i(r.n),e:i(r.e),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkix=function(e){const t=n.pki.publicKeyToAsn1({n:o(e.n),e:o(e.e)});return s(n.asn1.toDer(t).getBytes(),"ascii")}},9321:(e,t,r)=>{"use strict";const{sha256:n}=r(56155),i=r(32114),{equals:o}=r(19588),{toString:s}=r(92263),a=r(70427);e.exports=(e,t,c)=>{c=c||r(76835)(t);class u{constructor(e){c.validatePublicKey(e),this._key=e}verify(e,t){return c.hashAndVerify(this._key,t,e)}marshal(){return c.compressPublicKey(this._key)}get bytes(){return e.PublicKey.encode({Type:e.KeyType.Secp256k1,Data:this.marshal()}).finish()}equals(e){return o(this.bytes,e.bytes)}async hash(){const{bytes:e}=await n.digest(this.bytes);return e}}class f{constructor(e,t){this._key=e,this._publicKey=t||c.computePublicKey(e),c.validatePrivateKey(this._key),c.validatePublicKey(this._publicKey)}sign(e){return c.hashAndSign(this._key,e)}get public(){return new u(this._publicKey)}marshal(){return this._key}get bytes(){return e.PrivateKey.encode({Type:e.KeyType.Secp256k1,Data:this.marshal()}).finish()}equals(e){return o(this.bytes,e.bytes)}async hash(){const{bytes:e}=await n.digest(this.bytes);return e}async id(){const e=await this.public.hash();return s(e,"base58btc")}async export(e,t="libp2p-key"){if("libp2p-key"===t)return a.export(this.bytes,e);throw i(new Error(`export format '${t}' is not supported`),"ERR_INVALID_EXPORT_FORMAT")}}return{Secp256k1PublicKey:u,Secp256k1PrivateKey:f,unmarshalSecp256k1PrivateKey:function(e){return new f(e)},unmarshalSecp256k1PublicKey:function(e){return new u(e)},generateKeyPair:async function(){const e=await c.generateKey();return new f(e)}}}},76835:(e,t,r)=>{"use strict";const n=r(17221),{sha256:i}=r(56155);e.exports=e=>{function t(e){if(!n.privateKeyVerify(e))throw new Error("Invalid private key")}return{generateKey:function(){let t;do{t=e(32)}while(!n.privateKeyVerify(t));return t},privateKeyLength:32,hashAndSign:async function(e,t){const{digest:r}=await i.digest(t),o=n.ecdsaSign(r,e);return n.signatureExport(o.signature)},hashAndVerify:async function(e,t,r){const{digest:o}=await i.digest(r);return t=n.signatureImport(t),n.ecdsaVerify(t,o,e)},compressPublicKey:function(e){if(!n.publicKeyVerify(e))throw new Error("Invalid public key");return n.publicKeyConvert(e,!0)},decompressPublicKey:function(e){return n.publicKeyConvert(e,!1)},validatePrivateKey:t,validatePublicKey:function(e){if(!n.publicKeyVerify(e))throw new Error("Invalid public key")},computePublicKey:function(e){return t(e),n.publicKeyCreate(e)}}}},50439:(e,t,r)=>{"use strict";const n=r(32114);e.exports=function(e,t){if(!e.includes(t)){const r=e.join(" / ");throw n(new Error(`Unknown curve: ${t}. Must be ${r}`),"ERR_INVALID_CURVE")}}},57493:(e,t,r)=>{"use strict";const n=r(98960),i=r(97116),o=r(32114),s={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};e.exports=function(e,t,r,a,c){const u=s[c];if(!u){const e=Object.keys(s).join(" / ");throw o(new Error(`Hash '${c}' is unknown or not supported. Must be ${e}`),"ERR_UNSUPPORTED_HASH_TYPE")}const f=n(e,t,r,a,u);return i.encode64(f)}},53890:(e,t,r)=>{"use strict";const n=r(1914),i=r(32114);e.exports=function(e){if(isNaN(e)||e<=0)throw i(new Error("random bytes length must be a Number bigger than 0"),"ERR_INVALID_LENGTH");return n(e)}},28894:(e,t,r)=>{"use strict";r(97116),r(15764);const n=r(3832),{fromString:i}=r(52217),{toString:o}=r(92263),{concat:s}=r(20605);t.bigIntegerToUintBase64url=(e,t)=>{let r=Uint8Array.from(e.abs().toByteArray());if(r=0===r[0]?r.slice(1):r,null!=t){if(r.length>t)throw new Error("byte array longer than desired length");r=s([new Uint8Array(t-r.length),r])}return o(r,"base64url")},t.base64urlToBigInteger=e=>{const r=t.base64urlToBuffer(e);return new n.jsbn.BigInteger(o(r,"base16"),16)},t.base64urlToBuffer=(e,t)=>{let r=i(e,"base64urlpad");if(null!=t){if(r.length>t)throw new Error("byte array longer than desired length");r=s([new Uint8Array(t-r.length),r])}return r}},87518:(e,t)=>{"use strict";t.get=(e=self)=>{const t=e.crypto||e.msCrypto;if(!t||!t.subtle)throw Object.assign(new Error("Missing Web Crypto API. The most likely cause of this error is that this page is being accessed from an insecure context (i.e. not HTTPS). For more information and possible resolutions see https://github.com/libp2p/js-libp2p-crypto/blob/master/README.md#web-crypto-api"),{code:"ERR_MISSING_WEB_CRYPTO"});return t}},54808:e=>{e.exports=function e(t,r){var n,i=0,o=0,s=r=r||0,a=t.length;do{if(s>=a||o>49)throw e.bytes=0,new RangeError("Could not decode varint");n=t[s++],i+=o<28?(127&n)<=128);return e.bytes=s-r,i}},17471:e=>{e.exports=function e(r,n,i){if(Number.MAX_SAFE_INTEGER&&r>Number.MAX_SAFE_INTEGER)throw e.bytes=0,new RangeError("Could not encode varint");n=n||[];for(var o=i=i||0;r>=t;)n[i++]=255&r|128,r/=128;for(;-128&r;)n[i++]=255&r|128,r>>>=7;return n[i]=0|r,e.bytes=i-o+1,n};var t=Math.pow(2,31)},31997:(e,t,r)=>{e.exports={encode:r(17471),decode:r(54808),encodingLength:r(21941)}},21941:e=>{var t=Math.pow(2,7),r=Math.pow(2,14),n=Math.pow(2,21),i=Math.pow(2,28),o=Math.pow(2,35),s=Math.pow(2,42),a=Math.pow(2,49),c=Math.pow(2,56),u=Math.pow(2,63);e.exports=function(e){return e{"use strict";const{EventEmitter:n}=r(17187),{Multiaddr:i}=r(46584),o=r(88785);e.exports=class extends n{constructor(e,{listen:t=[],announce:r=[]}={}){super(),this.peerId=e,this.listen=new Set(t.map((e=>e.toString()))),this.announce=new Set(r.map((e=>e.toString()))),this.observed=new Set}getListenAddrs(){return Array.from(this.listen).map((e=>new i(e)))}getAnnounceAddrs(){return Array.from(this.announce).map((e=>new i(e)))}getObservedAddrs(){return Array.from(this.observed).map((e=>new i(e)))}addObservedAddr(e){let t=new i(e);const r=t.getPeerId();r&&o.createFromB58String(r).equals(this.peerId)&&(t=t.decapsulate(new i(`/p2p/${this.peerId}`)));const n=t.toString();this.observed.has(n)||(this.observed.add(n),this.emit("change:addresses"))}}},58126:(e,t,r)=>{"use strict";const n=r(11227),i=Object.assign(n("libp2p:auto-relay"),{error:n("libp2p:auto-relay:err")}),{fromString:o}=r(52217),{toString:s}=r(92263),{Multiaddr:a}=r(46584),c=r(88785),{relay:u}=r(49284),{canHop:f}=r(71466),{namespaceToCid:l}=r(32497),{CIRCUIT_PROTO_CODE:h,HOP_METADATA_KEY:d,HOP_METADATA_VALUE:p,RELAY_RENDEZVOUS_NS:y}=r(33053);e.exports=class{constructor({libp2p:e,maxListeners:t=1,onError:r}){this._libp2p=e,this._peerId=e.peerId,this._peerStore=e.peerStore,this._connectionManager=e.connectionManager,this._transportManager=e.transportManager,this._addressSorter=e.dialer.addressSorter,this.maxListeners=t,this._listenRelays=new Set,this._onProtocolChange=this._onProtocolChange.bind(this),this._onPeerDisconnected=this._onPeerDisconnected.bind(this),this._peerStore.on("change:protocols",this._onProtocolChange),this._connectionManager.on("peer:disconnect",this._onPeerDisconnected),this._onError=(e,t)=>{i.error(t||e),r&&r(e,t)}}async _onProtocolChange({peerId:e,protocols:t}){const r=e.toB58String(),n=t.find((e=>e===u));if(n||!this._listenRelays.has(r)){if(n&&!this._listenRelays.has(r))try{const t=this._connectionManager.get(e);if(!t)return;if(t.remoteAddr.protoCodes().includes(h))return void i(`relayed connection to ${r} will not be used to hop on`);await f({connection:t})&&(this._peerStore.metadataBook.set(e,d,o(p)),await this._addListenRelay(t,r))}catch(e){this._onError(e)}}else this._removeListenRelay(r)}_onPeerDisconnected(e){const t=e.remotePeer.toB58String();this._listenRelays.has(t)&&this._removeListenRelay(t)}async _addListenRelay(e,t){if(this._listenRelays.size>=this.maxListeners)return;const r=this._peerStore.addressBook.getMultiaddrsForPeer(e.remotePeer,this._addressSorter);if(!r||!r.length)return;const n=`${r[0].toString()}/p2p-circuit`;this._listenRelays.add(t);try{await this._transportManager.listen([new a(n)])}catch(e){this._onError(e),this._listenRelays.delete(t)}}_removeListenRelay(e){this._listenRelays.delete(e)&&this._listenOnAvailableHopRelays([e])}async _listenOnAvailableHopRelays(e=[]){if(this._listenRelays.size>=this.maxListeners)return;const t=[];for(const[r,n]of this._peerStore.metadataBook.data.entries()){if(this._listenRelays.has(r)||e.includes(r))continue;const i=n.get(d);if(!i||s(i)!==p)continue;const o=c.createFromB58String(r),a=this._connectionManager.get(o);if(a){if(await this._addListenRelay(a,r),this._listenRelays.size>=this.maxListeners)return}else t.push(o)}for(const e of t)if(await this._tryToListenOnRelay(e),this._listenRelays.size>=this.maxListeners)return;try{const e=await l(y);for await(const t of this._libp2p.contentRouting.findProviders(e)){if(!t.multiaddrs.length)continue;const e=t.id;if(this._peerStore.addressBook.add(e,t.multiaddrs),await this._tryToListenOnRelay(e),this._listenRelays.size>=this.maxListeners)return}}catch(e){this._onError(e)}}async _tryToListenOnRelay(e){try{const t=await this._libp2p.dial(e);await this._addListenRelay(t,e.toB58String())}catch(t){this._onError(t,`could not connect and listen on known hop relay ${e.toB58String()}`)}}}},71466:(e,t,r)=>{"use strict";const n=r(11227),i=Object.assign(n("libp2p:circuit:hop"),{error:n("libp2p:circuit:hop:err")}),o=r(32114),s=r(88785),{validateAddrs:a}=r(44780),c=r(72866),{CircuitRelay:u}=r(79123),{pipe:f}=r(60618),{codes:l}=r(23416),{stop:h}=r(10655),d=r(49284);e.exports={handleHop:async function({connection:e,request:t,streamHandler:r,circuit:n}){if(!n._options.hop.enabled)return i("HOP request received but we are not acting as a relay"),r.end({type:u.Type.STATUS,code:u.Status.HOP_CANT_SPEAK_RELAY});try{a(t,r)}catch(t){return i.error("invalid hop request via peer %s",e.remotePeer.toB58String(),t)}if(!t.dstPeer)return void i("HOP request received but we do not receive a dstPeer");const o=new s(t.dstPeer.id),c=n._connectionManager.get(o);if(!c&&!n._options.hop.active)return i("HOP request received but we are not connected to the destination peer"),r.end({type:u.Type.STATUS,code:u.Status.HOP_NO_CONN_TO_DST});if(!c)return;const l={type:u.Type.STOP,dstPeer:t.dstPeer,srcPeer:t.srcPeer};let d;try{d=await h({connection:c,request:l})}catch(e){return i.error(e)}i("hop request from %s is valid",e.remotePeer.toB58String()),r.write({type:u.Type.STATUS,code:u.Status.SUCCESS});const p=r.rest();return f(p,d,p)},hop:async function({connection:e,request:t}){const{stream:r}=await e.newStream([d.relay]),n=new c({stream:r});n.write(t);const s=await n.read();if(!s)throw o(new Error("HOP request had no response"),l.ERR_HOP_REQUEST_FAILED);if(s.code===u.Status.SUCCESS)return i("hop request was successful"),n.rest();throw i("hop request failed with code %d, closing stream",s.code),n.close(),o(new Error(`HOP request failed with code ${s.code}`),l.ERR_HOP_REQUEST_FAILED)},canHop:async function({connection:e}){const{stream:t}=await e.newStream([d.relay]),r=new c({stream:t});r.write({type:u.Type.CAN_HOP});const n=await r.read();return await r.close(),!(!n||n.code!==u.Status.SUCCESS)},handleCanHop:function({connection:e,streamHandler:t,circuit:r}){const n=r._options.hop.enabled;i("can hop (%s) request from %s",n,e.remotePeer.toB58String()),t.end({type:u.Type.STATUS,code:n?u.Status.SUCCESS:u.Status.HOP_CANT_SPEAK_RELAY})}}},10655:(e,t,r)=>{"use strict";const n=r(11227),i=Object.assign(n("libp2p:circuit:stop"),{error:n("libp2p:circuit:stop:err")}),{CircuitRelay:o}=r(79123),s=r(49284),a=r(72866),{validateAddrs:c}=r(44780);e.exports.handleStop=function({connection:e,request:t,streamHandler:r}){try{c(t,r)}catch(t){return i.error("invalid stop request via peer %s",e.remotePeer.toB58String(),t)}return i("stop request is valid"),r.write({type:o.Type.STATUS,code:o.Status.SUCCESS}),r.rest()},e.exports.stop=async function({connection:e,request:t}){const{stream:r}=await e.newStream([s.relay]);i("starting stop request to %s",e.remotePeer.toB58String());const n=new a({stream:r});n.write(t);const c=await n.read();return c?c.code===o.Status.SUCCESS?(i("stop request to %s was successful",e.remotePeer.toB58String()),n.rest()):(i("stop request failed with code %d",c.code),void n.close()):n.close()}},72866:(e,t,r)=>{"use strict";const n=r(11227),i=Object.assign(n("libp2p:circuit:stream-handler"),{error:n("libp2p:circuit:stream-handler:err")}),o=r(63500),s=r(52261),{CircuitRelay:a}=r(79123);e.exports=class{constructor({stream:e,maxLength:t=4096}){this.stream=e,this.shake=s(this.stream),this.decoder=o.decode.fromReader(this.shake.reader,{maxDataLength:t})}async read(){const e=await this.decoder.next();if(e.value){const t=a.decode(e.value.slice());return i("read message type",t.type),t}i("read received no value, closing stream"),this.close()}write(e){i("write message type %s",e.type),this.shake.write(o.encode.single(a.encode(e).finish()))}rest(){return this.shake.rest(),this.shake.stream}end(e){this.write(e),this.close()}close(){i("closing the stream"),this.rest().sink([])}}},44780:(e,t,r)=>{"use strict";const{Multiaddr:n}=r(46584),{CircuitRelay:i}=r(79123);function o(e,t){e.write({type:i.Type.STATUS,code:t})}e.exports={validateAddrs:function(e,t){try{e.dstPeer&&e.dstPeer.addrs&&e.dstPeer.addrs.forEach((e=>new n(e)))}catch(r){throw o(t,e.type===i.Type.HOP?i.Status.HOP_DST_MULTIADDR_INVALID:i.Status.STOP_DST_MULTIADDR_INVALID),r}try{e.srcPeer&&e.srcPeer.addrs&&e.srcPeer.addrs.forEach((e=>new n(e)))}catch(r){throw o(t,e.type===i.Type.HOP?i.Status.HOP_SRC_MULTIADDR_INVALID:i.Status.STOP_SRC_MULTIADDR_INVALID),r}}}},33053:e=>{"use strict";e.exports={ADVERTISE_BOOT_DELAY:9e5,ADVERTISE_TTL:18e5,CIRCUIT_PROTO_CODE:290,HOP_METADATA_KEY:"hop_relay",HOP_METADATA_VALUE:"true",RELAY_RENDEZVOUS_NS:"/libp2p/relay"}},2715:(e,t,r)=>{"use strict";const n=r(11227),i=Object.assign(n("libp2p:relay"),{error:n("libp2p:relay:err")}),{setDelayedInterval:o,clearDelayedInterval:s}=r(27695),a=r(58126),{namespaceToCid:c}=r(32497),{RELAY_RENDEZVOUS_NS:u}=r(33053);e.exports=class{constructor(e){this._libp2p=e,this._options={...e._config.relay},this._autoRelay=this._options.autoRelay.enabled&&new a({libp2p:e,...this._options.autoRelay}),this._advertiseService=this._advertiseService.bind(this)}start(){this._options.hop.enabled&&this._options.advertise.enabled&&(this._timeout=o(this._advertiseService,this._options.advertise.ttl,this._options.advertise.bootDelay))}stop(){s(this._timeout)}async _advertiseService(){try{const e=await c(u);await this._libp2p.contentRouting.provide(e)}catch(e){"NO_ROUTERS_AVAILABLE"===e.code?(i.error("a content router, such as a DHT, must be provided in order to advertise the relay service",e),this.stop()):i.error(e)}}}},64538:(e,t,r)=>{"use strict";const{EventEmitter:n}=r(17187),{Multiaddr:i}=r(46584);e.exports=e=>{const t=new Map,r=Object.assign(new n,{close:()=>Promise.resolve(),listen:async function(n){const o=String(n).split("/p2p-circuit").find((e=>""!==e)),s=await e.dial(new i(o)),a=s.remoteAddr.encapsulate("/p2p-circuit");t.set(s.remotePeer.toB58String(),a),r.emit("listening")},getAddrs:function(){const e=[];for(const r of t.values())e.push(r);return e}});return e.connectionManager.on("peer:disconnect",(e=>{t.delete(e.remotePeer.toB58String())&&r.emit("close")})),r}},49284:e=>{"use strict";e.exports={relay:"/libp2p/circuit/relay/0.1.0"}},79123:(e,t,r)=>{"use strict";var n=r(62100),i=n.Reader,o=n.Writer,s=n.util,a=n.roots["libp2p-circuit"]||(n.roots["libp2p-circuit"]={});a.CircuitRelay=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.type=e.int32();break;case 2:n.srcPeer=a.CircuitRelay.Peer.decode(e,e.uint32());break;case 3:n.dstPeer=a.CircuitRelay.Peer.decode(e,e.uint32());break;case 4:n.code=e.int32();break;default:e.skipType(7&o)}}return n},e.fromObject=function(e){if(e instanceof a.CircuitRelay)return e;var t=new a.CircuitRelay;switch(e.type){case"HOP":case 1:t.type=1;break;case"STOP":case 2:t.type=2;break;case"STATUS":case 3:t.type=3;break;case"CAN_HOP":case 4:t.type=4}if(null!=e.srcPeer){if("object"!=typeof e.srcPeer)throw TypeError(".CircuitRelay.srcPeer: object expected");t.srcPeer=a.CircuitRelay.Peer.fromObject(e.srcPeer)}if(null!=e.dstPeer){if("object"!=typeof e.dstPeer)throw TypeError(".CircuitRelay.dstPeer: object expected");t.dstPeer=a.CircuitRelay.Peer.fromObject(e.dstPeer)}switch(e.code){case"SUCCESS":case 100:t.code=100;break;case"HOP_SRC_ADDR_TOO_LONG":case 220:t.code=220;break;case"HOP_DST_ADDR_TOO_LONG":case 221:t.code=221;break;case"HOP_SRC_MULTIADDR_INVALID":case 250:t.code=250;break;case"HOP_DST_MULTIADDR_INVALID":case 251:t.code=251;break;case"HOP_NO_CONN_TO_DST":case 260:t.code=260;break;case"HOP_CANT_DIAL_DST":case 261:t.code=261;break;case"HOP_CANT_OPEN_DST_STREAM":case 262:t.code=262;break;case"HOP_CANT_SPEAK_RELAY":case 270:t.code=270;break;case"HOP_CANT_RELAY_TO_SELF":case 280:t.code=280;break;case"STOP_SRC_ADDR_TOO_LONG":case 320:t.code=320;break;case"STOP_DST_ADDR_TOO_LONG":case 321:t.code=321;break;case"STOP_SRC_MULTIADDR_INVALID":case 350:t.code=350;break;case"STOP_DST_MULTIADDR_INVALID":case 351:t.code=351;break;case"STOP_RELAY_REFUSED":case 390:t.code=390;break;case"MALFORMED_MESSAGE":case 400:t.code=400}return t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(r.type=t.enums===String?"HOP":1,r.srcPeer=null,r.dstPeer=null,r.code=t.enums===String?"SUCCESS":100),null!=e.type&&e.hasOwnProperty("type")&&(r.type=t.enums===String?a.CircuitRelay.Type[e.type]:e.type),null!=e.srcPeer&&e.hasOwnProperty("srcPeer")&&(r.srcPeer=a.CircuitRelay.Peer.toObject(e.srcPeer,t)),null!=e.dstPeer&&e.hasOwnProperty("dstPeer")&&(r.dstPeer=a.CircuitRelay.Peer.toObject(e.dstPeer,t)),null!=e.code&&e.hasOwnProperty("code")&&(r.code=t.enums===String?a.CircuitRelay.Status[e.code]:e.code),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,n.util.toJSONOptions)},e.Status=(t={},(r=Object.create(t))[t[100]="SUCCESS"]=100,r[t[220]="HOP_SRC_ADDR_TOO_LONG"]=220,r[t[221]="HOP_DST_ADDR_TOO_LONG"]=221,r[t[250]="HOP_SRC_MULTIADDR_INVALID"]=250,r[t[251]="HOP_DST_MULTIADDR_INVALID"]=251,r[t[260]="HOP_NO_CONN_TO_DST"]=260,r[t[261]="HOP_CANT_DIAL_DST"]=261,r[t[262]="HOP_CANT_OPEN_DST_STREAM"]=262,r[t[270]="HOP_CANT_SPEAK_RELAY"]=270,r[t[280]="HOP_CANT_RELAY_TO_SELF"]=280,r[t[320]="STOP_SRC_ADDR_TOO_LONG"]=320,r[t[321]="STOP_DST_ADDR_TOO_LONG"]=321,r[t[350]="STOP_SRC_MULTIADDR_INVALID"]=350,r[t[351]="STOP_DST_MULTIADDR_INVALID"]=351,r[t[390]="STOP_RELAY_REFUSED"]=390,r[t[400]="MALFORMED_MESSAGE"]=400,r),e.Type=function(){var e={},t=Object.create(e);return t[e[1]="HOP"]=1,t[e[2]="STOP"]=2,t[e[3]="STATUS"]=3,t[e[4]="CAN_HOP"]=4,t}(),e.Peer=function(){function e(e){if(this.addrs=[],e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.id=e.bytes();break;case 2:n.addrs&&n.addrs.length||(n.addrs=[]),n.addrs.push(e.bytes());break;default:e.skipType(7&o)}}if(!n.hasOwnProperty("id"))throw s.ProtocolError("missing required 'id'",{instance:n});return n},e.fromObject=function(e){if(e instanceof a.CircuitRelay.Peer)return e;var t=new a.CircuitRelay.Peer;if(null!=e.id&&("string"==typeof e.id?s.base64.decode(e.id,t.id=s.newBuffer(s.base64.length(e.id)),0):e.id.length&&(t.id=e.id)),e.addrs){if(!Array.isArray(e.addrs))throw TypeError(".CircuitRelay.Peer.addrs: array expected");t.addrs=[];for(var r=0;r{"use strict";const n=r(11227),i=Object.assign(n("libp2p:circuit"),{error:n("libp2p:circuit:err")}),o=r(32114),s=r(29175),{Multiaddr:a}=r(46584),c=r(88785),{CircuitRelay:u}=r(79123),{codes:f}=r(23416),l=r(15091),{relay:h}=r(49284),d=r(64538),{handleCanHop:p,handleHop:y,hop:g}=r(71466),{handleStop:b}=r(10655),m=r(72866),v=Symbol.for("@libp2p/js-libp2p-circuit/circuit");class w{constructor({libp2p:e,upgrader:t}){this._dialer=e.dialer,this._registrar=e.registrar,this._connectionManager=e.connectionManager,this._upgrader=t,this._options=e._config.relay,this._libp2p=e,this.peerId=e.peerId,this._registrar.handle(h,this._onProtocol.bind(this))}async _onProtocol({connection:e,stream:t}){const r=new m({stream:t}),n=await r.read();if(!n)return;const o=this;let s;switch(n.type){case u.Type.CAN_HOP:i("received CAN_HOP request from %s",e.remotePeer.toB58String()),await p({circuit:o,connection:e,streamHandler:r});break;case u.Type.HOP:i("received HOP request from %s",e.remotePeer.toB58String()),s=await y({connection:e,request:n,streamHandler:r,circuit:o});break;case u.Type.STOP:i("received STOP request from %s",e.remotePeer.toB58String()),s=await b({connection:e,request:n,streamHandler:r});break;default:i("Request of type %s not supported",n.type)}if(s){const e=new a(n.dstPeer.addrs[0]),t=new a(n.srcPeer.addrs[0]),r=l({stream:s,remoteAddr:e,localAddr:t}),o=n.type===u.Type.HOP?"relay":"inbound";i("new %s connection %s",o,r.remoteAddr);const c=await this._upgrader.upgradeInbound(r);i("%s connection %s upgraded",o,r.remoteAddr),this.handler&&this.handler(c)}}async dial(e,t){const r=e.toString().split("/p2p-circuit"),n=new a(r[0]),s=new a(r[r.length-1]),h=n.getPeerId(),d=s.getPeerId();if(!h||!d){const e="Circuit relay dial failed as addresses did not have peer id";throw i.error(e),o(new Error(e),f.ERR_RELAYED_DIAL)}const p=c.createFromB58String(h),y=c.createFromB58String(d);let b=!1,m=this._connectionManager.get(p);m||(m=await this._dialer.connectToPeer(n,t),b=!0);try{const t=await g({connection:m,request:{type:u.Type.HOP,srcPeer:{id:this.peerId.toBytes(),addrs:this._libp2p.multiaddrs.map((e=>e.bytes))},dstPeer:{id:y.toBytes(),addrs:[new a(s).bytes]}}}),r=n.encapsulate(`/p2p-circuit/p2p/${this.peerId.toB58String()}`),o=l({stream:t,remoteAddr:e,localAddr:r});return i("new outbound connection %s",o.remoteAddr),this._upgrader.upgradeOutbound(o)}catch(e){throw i.error("Circuit relay dial failed",e),b&&await m.close(),e}}createListener(e,t){return"function"==typeof e&&(t=e,e={}),this.handler=t,d(this._libp2p)}filter(e){return(e=Array.isArray(e)?e:[e]).filter((e=>s.Circuit.matches(e)))}get[Symbol.toStringTag](){return"Circuit"}static isTransport(e){return Boolean(e&&e[v])}}e.exports=w},32497:(e,t,r)=>{"use strict";const{CID:n}=r(81362),{sha256:i}=r(56155);e.exports.namespaceToCid=async e=>{const t=(new TextEncoder).encode(e),r=await i.digest(t);return n.createV0(r)}},36195:(e,t,r)=>{"use strict";const n=r(70942),{dnsaddrResolver:i}=r(39004),o=r(3524),{AGENT_VERSION:s}=r(78508),a=r(33053),{publicAddressesFirst:c}=r(53737),{FaultTolerance:u}=r(6984),f={addresses:{listen:[],announce:[],noAnnounce:[],announceFilter:e=>e},connectionManager:{minConnections:25},transportManager:{faultTolerance:u.FATAL_ALL},dialer:{maxParallelDials:o.MAX_PARALLEL_DIALS,maxDialsPerPeer:o.MAX_PER_PEER_DIALS,dialTimeout:o.DIAL_TIMEOUT,resolvers:{dnsaddr:i},addressSorter:c},host:{agentVersion:s},metrics:{enabled:!1},peerStore:{persistence:!1,threshold:5},peerRouting:{refreshManager:{enabled:!0,interval:6e5,bootDelay:1e4}},config:{protocolPrefix:"ipfs",dht:{enabled:!1,kBucketSize:20,randomWalk:{enabled:!1,queriesPerPeriod:1,interval:3e5,timeout:1e4}},nat:{enabled:!0,ttl:7200,keepAlive:!0,gateway:null,externalIp:null,pmp:{enabled:!1}},peerDiscovery:{autoDial:!0},pubsub:{enabled:!0},relay:{enabled:!0,advertise:{bootDelay:a.ADVERTISE_BOOT_DELAY,enabled:!1,ttl:a.ADVERTISE_TTL},hop:{enabled:!1,active:!1},autoRelay:{enabled:!1,maxListeners:2}},transport:{}}};e.exports.validate=e=>{const t=n(f,e);if(t.modules.transport.length<1)throw new Error("'options.modules.transport' must contain at least 1 transport");return t}},7376:(e,t,r)=>{"use strict";const n=r(11227),i=Object.assign(n("libp2p:connection-manager"),{error:n("libp2p:connection-manager:err")}),o=r(32114),s=r(70942),a=r(84593),c=r(82916),{EventEmitter:u}=r(17187),f=r(88785),{codes:{ERR_INVALID_PARAMETERS:l}}=r(23416),h={maxConnections:1/0,minConnections:0,maxData:1/0,maxSentData:1/0,maxReceivedData:1/0,maxEventLoopDelay:1/0,pollInterval:2e3,autoDialInterval:1e4,movingAverageInterval:6e4,defaultPeerValue:1};e.exports=class extends u{constructor(e,t={}){if(super(),this._libp2p=e,this._peerId=e.peerId.toB58String(),this._options=s.call({ignoreUndefined:!0},h,t),this._options.maxConnectionse+t.length),0)}start(){this._libp2p.metrics&&(this._timer=this._timer||c(this._checkMetrics,this._options.pollInterval)),this._latencyMonitor.start(),this._onLatencyMeasure=this._onLatencyMeasure.bind(this),this._latencyMonitor.on("data",this._onLatencyMeasure),this._started=!0,i("started"),this._options.autoDial&&this._autoDial()}async stop(){this._autoDialTimeout&&this._autoDialTimeout.clear(),this._timer&&this._timer.clear(),this._latencyMonitor.removeListener("data",this._onLatencyMeasure),this._latencyMonitor.stop(),this._started=!1,await this._close(),i("stopped")}async _close(){const e=[];for(const t of this.connections.values())for(const r of t)e.push(r.close());await Promise.all(e),this.connections.clear()}setPeerValue(e,t){if(t<0||t>1)throw new Error("value should be a number between 0 and 1");this._peerValues.set(e.toB58String(),t)}_checkMetrics(){if(this._libp2p.metrics){const e=this._libp2p.metrics.global.movingAverages,t=e.dataReceived[this._options.movingAverageInterval].movingAverage();this._checkMaxLimit("maxReceivedData",t);const r=e.dataSent[this._options.movingAverageInterval].movingAverage();this._checkMaxLimit("maxSentData",r);const n=t+r;this._checkMaxLimit("maxData",n),i("metrics update",n),this._timer=c(this._checkMetrics,this._options.pollInterval)}}onConnect(e){const t=e.remotePeer,r=t.toB58String(),n=this.connections.get(r);this.emit("peer:connect",e),n?n.push(e):this.connections.set(r,[e]),this._libp2p.peerStore.keyBook.set(t,t.pubKey),this._peerValues.has(r)||this._peerValues.set(r,this._options.defaultPeerValue),this._checkMaxLimit("maxConnections",this.size)}onDisconnect(e){const t=e.remotePeer.toB58String();let r=this.connections.get(t);r&&r.length>1?(r=r.filter((t=>t.id!==e.id)),this.connections.set(t,r)):r&&(this.connections.delete(t),this._peerValues.delete(e.remotePeer.toB58String()),this.emit("peer:disconnect",e))}get(e){const t=this.getAll(e);return t.length?t[0]:null}getAll(e){if(!f.isPeerId(e))throw o(new Error("peerId must be an instance of peer-id"),l);const t=e.toB58String(),r=this.connections.get(t);return r?r.filter((e=>"open"===e.stat.status)):[]}_onLatencyMeasure(e){this._checkMaxLimit("maxEventLoopDelay",e.avgMs)}_checkMaxLimit(e,t){const r=this._options[e];i("checking limit of %s. current value: %d of %d",e,t,r),t>r&&(i("%s: limit exceeded: %s, %d",this._peerId,e,t),this._maybeDisconnectOne())}async _autoDial(){const e=this._options.minConnections;if(this.size>=e)return void(this._autoDialTimeout=c(this._autoDial,this._options.autoDialInterval));const t=Array.from(this._libp2p.peerStore.peers.values()).sort(((e,t)=>!t.protocols||!t.protocols.length||e.protocols&&e.protocols.length?t.id.pubKey&&!e.id.pubKey?1:-1:1));for(let r=0;re[1]-t[1]))));i("%s: sorted peer values: %j",this._peerId,e);const t=e[0];if(t){const e=t[0];i("%s: lowest value peer is %s",this._peerId,e),i("%s: closing a connection to %j",this._peerId,e);for(const t of this.connections.values())if(t[0].remotePeer.toB58String()===e){t[0].close();break}}}}}},84593:(e,t,r)=>{"use strict";const{EventEmitter:n}=r(17187),i=r(7527),o=r(11227)("latency-monitor:LatencyMonitor");e.exports=class extends n{constructor({latencyCheckIntervalMs:e,dataEmitIntervalMs:t,asyncTestFn:r,latencyRandomPercentage:n}={}){super();const i=this;i.latencyCheckIntervalMs=e||500,i.latencyRandomPercentage=n||10,i._latecyCheckMultiply=i.latencyRandomPercentage/100*2*i.latencyCheckIntervalMs,i._latecyCheckSubtract=i._latecyCheckMultiply/2,i.dataEmitIntervalMs=null===t||0===t?void 0:t||5e3,o("latencyCheckIntervalMs: %s dataEmitIntervalMs: %s",i.latencyCheckIntervalMs,i.dataEmitIntervalMs),i.dataEmitIntervalMs?o("Expecting ~%s events per summary",i.latencyCheckIntervalMs/i.dataEmitIntervalMs):o("Not emitting summaries"),i.asyncTestFn=r}start(){globalThis.process&&globalThis.process.hrtime?(o("Using process.hrtime for timing"),this.now=globalThis.process.hrtime,this.getDeltaMS=e=>{const t=this.now(e);return 1e3*t[0]+t[1]/1e6}):"undefined"!=typeof window&&window.performance&&window.performance.now?(o("Using performance.now for timing"),this.now=window.performance.now.bind(window.performance),this.getDeltaMS=e=>Math.round(this.now()-e)):(o("Using Date.now for timing"),this.now=Date.now,this.getDeltaMS=e=>this.now()-e),this._latencyData=this._initLatencyData(),"undefined"!=typeof window&&(this._visibilityChangeEmitter=new i,this._visibilityChangeEmitter.on("visibilityChange",(e=>{e?this._startTimers():(this._emitSummary(),this._stopTimers())}))),this._visibilityChangeEmitter&&!this._visibilityChangeEmitter.isVisible()||this._startTimers()}stop(){this._stopTimers()}_startTimers(){this._checkLatencyID||(this._checkLatency(),this.dataEmitIntervalMs&&(this._emitIntervalID=setInterval((()=>this._emitSummary()),this.dataEmitIntervalMs),"function"==typeof this._emitIntervalID.unref&&this._emitIntervalID.unref()))}_stopTimers(){this._checkLatencyID&&(clearTimeout(this._checkLatencyID),this._checkLatencyID=void 0),this._emitIntervalID&&(clearInterval(this._emitIntervalID),this._emitIntervalID=void 0)}_emitSummary(){const e=this.getSummary();e.events>0&&this.emit("data",e)}getSummary(){const e={events:this._latencyData.events,minMs:this._latencyData.minMs,maxMs:this._latencyData.maxMs,avgMs:this._latencyData.events?this._latencyData.totalMs/this._latencyData.events:Number.POSITIVE_INFINITY,lengthMs:this.getDeltaMS(this._latencyData.startTime)};return this._latencyData=this._initLatencyData(),o("Summary: %O",e),e}_checkLatency(){const e=this,t=Math.random()*e._latecyCheckMultiply-e._latecyCheckSubtract,r={deltaOffset:Math.ceil(e.latencyCheckIntervalMs+t),startTime:e.now()},n=()=>{if(!this._checkLatencyID)return;const t=e.getDeltaMS(r.startTime)-r.deltaOffset;e._checkLatency(),e._latencyData.events++,e._latencyData.minMs=Math.min(e._latencyData.minMs,t),e._latencyData.maxMs=Math.max(e._latencyData.maxMs,t),e._latencyData.totalMs+=t,o("MS: %s Data: %O",t,e._latencyData)};o("localData: %O",r),this._checkLatencyID=setTimeout((()=>{e.asyncTestFn?(r.deltaOffset=0,r.startTime=e.now(),e.asyncTestFn(n)):(r.deltaOffset-=1,n())}),r.deltaOffset),"function"==typeof this._checkLatencyID.unref&&this._checkLatencyID.unref()}_initLatencyData(){return{startTime:this.now(),minMs:Number.POSITIVE_INFINITY,maxMs:Number.NEGATIVE_INFINITY,events:0,totalMs:0}}}},7527:(e,t,r)=>{"use strict";const{EventEmitter:n}=r(17187),i=r(11227)("latency-monitor:VisibilityChangeEmitter");e.exports=class extends n{constructor(){super(),"undefined"!=typeof document?(this._initializeVisibilityVarNames(),this._addVisibilityChangeListener()):i('This is not a browser, no "document" found. Stopping.')}_initializeVisibilityVarNames(){let e,t;void 0!==document.hidden?(e="hidden",t="visibilitychange"):void 0!==document.mozHidden?(e="mozHidden",t="mozvisibilitychange"):void 0!==document.msHidden?(e="msHidden",t="msvisibilitychange"):void 0!==document.webkitHidden&&(e="webkitHidden",t="webkitvisibilitychange"),this._hidden=e,this._visibilityChange=t}_addVisibilityChangeListener(){void 0===document.addEventListener||void 0===document[this._hidden]?i("Checking page visibility requires a browser that supports the Page Visibility API."):document.addEventListener(this._visibilityChange,this._handleVisibilityChange.bind(this),!1)}isVisible(){if(void 0!==this._hidden&&void 0!==document[this._hidden])return!document[this._hidden]}_handleVisibilityChange(){const e=!document[this._hidden];i(e?"Page Visible":"Page Hidden"),this.emit("visibilityChange",e)}}},3524:e=>{"use strict";e.exports={DIAL_TIMEOUT:3e4,MAX_PARALLEL_DIALS:100,MAX_PER_PEER_DIALS:4,MAX_ADDRS_TO_DIAL:25,METRICS:{computeThrottleMaxQueueSize:1e3,computeThrottleTimeout:2e3,movingAverageIntervals:[6e4,3e5,9e5],maxOldPeersRetention:50}}},57197:(e,t,r)=>{"use strict";const n=r(32114),{messages:i,codes:o}=r(23416),{storeAddresses:s,uniquePeers:a,requirePeers:c,maybeLimitSource:u}=r(63952),f=r(74014),{pipe:l}=r(60618);e.exports=class{constructor(e){this.libp2p=e,this.routers=e._modules.contentRouting||[],this.dht=e._dht,this.dht&&e._config.dht.enabled&&this.routers.push(this.dht)}async*findProviders(e,t={}){if(!this.routers.length)throw n(new Error("No content this.routers available"),"NO_ROUTERS_AVAILABLE");yield*l(f(...this.routers.map((r=>r.findProviders(e,t)))),(e=>s(e,this.libp2p.peerStore)),(e=>a(e)),(e=>u(e,t.maxNumProviders)),(e=>c(e)))}async provide(e){if(!this.routers.length)throw n(new Error("No content routers available"),"NO_ROUTERS_AVAILABLE");await Promise.all(this.routers.map((t=>t.provide(e))))}put(e,t,r){if(!this.libp2p.isStarted()||!this.dht.isStarted)throw n(new Error(i.NOT_STARTED_YET),o.DHT_NOT_STARTED);return this.dht.put(e,t,r)}get(e,t){if(!this.libp2p.isStarted()||!this.dht.isStarted)throw n(new Error(i.NOT_STARTED_YET),o.DHT_NOT_STARTED);return this.dht.get(e,t)}async getMany(e,t,r){if(!this.libp2p.isStarted()||!this.dht.isStarted)throw n(new Error(i.NOT_STARTED_YET),o.DHT_NOT_STARTED);return this.dht.getMany(e,t,r)}}},63952:(e,t,r)=>{"use strict";const n=r(32114),i=r(55565),o=r(32121),s=r(37939);e.exports={storeAddresses:function(e,t){return o(e,(e=>(t.addressBook.add(e.id,e.multiaddrs),e)))},uniquePeers:function(e){const t=new Set;return i(e,(e=>!t.has(e.id.toString())&&(t.add(e.id.toString()),!0)))},requirePeers:async function*(e,t=1){let r=0;for await(const t of e)r++,yield t;if(r{"use strict";const n=r(32114),i=r(28599).default,{anySignal:o}=r(32044),s=r(35103),a=r(61750);e.exports=class{constructor({addrs:e,dialAction:t,dialer:r}){this.addrs=e,this.dialer=r,this.dialAction=t}async run(e={}){const t=this.dialer.getTokens(this.addrs.length);if(t.length<1)throw n(new Error("No dial tokens available"),"ERR_NO_DIAL_TOKENS");const r=new s;t.forEach((e=>r.push(e)));const c=this.addrs.map((()=>new i));let u=0;try{return await a(this.addrs.map((async(n,i)=>{const s=await r.shift();let a;try{const f=c[i].signal;a=await this.dialAction(n,{...e,signal:e.signal?o([f,e.signal]):f}),c.splice(i,1)}finally{u++,this.addrs.length-u>=t.length?r.push(s):this.dialer.releaseToken(t.splice(t.indexOf(s),1)[0])}return a})))}finally{c.map((e=>e.abort())),t.forEach((e=>this.dialer.releaseToken(e)))}}}},63849:(e,t,r)=>{"use strict";const n=r(11227),i=Object.assign(n("libp2p:dialer"),{error:n("libp2p:dialer:err")}),o=r(32114),{Multiaddr:s}=r(46584),a=r(10715),{AbortError:c}=r(61623),{anySignal:u}=r(32044),f=r(65639),{publicAddressesFirst:l}=r(53737),h=r(43079),{codes:d}=r(23416),{DIAL_TIMEOUT:p,MAX_PARALLEL_DIALS:y,MAX_PER_PEER_DIALS:g,MAX_ADDRS_TO_DIAL:b}=r(3524);e.exports=class{constructor({transportManager:e,peerStore:t,addressSorter:r=l,maxParallelDials:n=y,maxAddrsToDial:i=b,dialTimeout:o=p,maxDialsPerPeer:a=g,resolvers:c={}}){this.transportManager=e,this.peerStore=t,this.addressSorter=r,this.maxParallelDials=n,this.maxAddrsToDial=i,this.timeout=o,this.maxDialsPerPeer=a,this.tokens=[...new Array(n)].map(((e,t)=>t)),this._pendingDials=new Map,this._pendingDialTargets=new Map;for(const[e,t]of Object.entries(c))s.resolvers.set(e,t)}destroy(){for(const e of this._pendingDials.values())try{e.controller.abort()}catch(e){i.error(e)}this._pendingDials.clear();for(const e of this._pendingDialTargets.values())e.reject(new c("Dialer was destroyed"));this._pendingDialTargets.clear()}async connectToPeer(e,t={}){const r=await this._createCancellableDialTarget(e);if(!r.addrs.length)throw o(new Error("The dial request has no valid addresses"),d.ERR_NO_VALID_ADDRESSES);const n=this._pendingDials.get(r.id)||this._createPendingDial(r,t);try{const e=await n.promise;return i("dial succeeded to %s",r.id),e}catch(e){throw n.controller.signal.aborted&&(e.code=d.ERR_TIMEOUT),i.error(e),e}finally{n.destroy()}}async _createCancellableDialTarget(e){const t=`${parseInt(String(1e9*Math.random()),10).toString()+Date.now()}`,r=new Promise(((e,r)=>{this._pendingDialTargets.set(t,{resolve:e,reject:r})})),n=await Promise.race([this._createDialTarget(e),r]);return this._pendingDialTargets.delete(t),n}async _createDialTarget(e){const{id:t,multiaddrs:r}=h(e);r&&this.peerStore.addressBook.add(t,r);let n=this.peerStore.addressBook.getMultiaddrsForPeer(t,this.addressSorter)||[];s.isMultiaddr(e)&&(n=n.filter((t=>!e.equals(t))),n.unshift(e));const i=[];for(const e of n)(await this._resolve(e)).forEach((e=>i.push(e)));const a=i.filter((e=>this.transportManager.transportForMultiaddr(e)));if(a.length>this.maxAddrsToDial)throw this.peerStore.delete(t),o(new Error("dial with more addresses than allowed"),d.ERR_TOO_MANY_ADDRESSES);return{id:t.toB58String(),addrs:a}}_createPendingDial(e,t={}){const r=new f({addrs:e.addrs,dialAction:(e,t)=>{if(t.signal.aborted)throw o(new Error("already aborted"),d.ERR_ALREADY_ABORTED);return this.transportManager.dial(e,t)},dialer:this}),n=new a(this.timeout),i=[n.signal];t.signal&&i.push(t.signal);const s=u(i),c={dialRequest:r,controller:n,promise:r.run({...t,signal:s}),destroy:()=>{n.clear(),this._pendingDials.delete(e.id)}};return this._pendingDials.set(e.id,c),c}getTokens(e){const t=Math.min(e,this.maxDialsPerPeer,this.tokens.length),r=this.tokens.splice(0,t);return i("%d tokens request, returning %d, %d remaining",e,t,this.tokens.length),r}releaseToken(e){this.tokens.indexOf(e)>-1||(i("token %d released",e),this.tokens.push(e))}async _resolve(e){if(!e.protoNames().includes("dnsaddr"))return[e];const t=await this._resolveRecord(e);return(await Promise.all(t.map((e=>this._resolve(e))))).flat().reduce(((e,t)=>(e.find((e=>e.equals(t)))||e.push(t),e)),[])}async _resolveRecord(e){try{return e=new s(e.toString()),await e.resolve()}catch(t){return i.error(`multiaddr ${e} could not be resolved`),[]}}}},23416:(e,t)=>{"use strict";t.messages={NOT_STARTED_YET:"The libp2p node is not started yet",DHT_DISABLED:"DHT is not available",CONN_ENCRYPTION_REQUIRED:"At least one connection encryption module is required"},t.codes={DHT_DISABLED:"ERR_DHT_DISABLED",PUBSUB_NOT_STARTED:"ERR_PUBSUB_NOT_STARTED",DHT_NOT_STARTED:"ERR_DHT_NOT_STARTED",CONN_ENCRYPTION_REQUIRED:"ERR_CONN_ENCRYPTION_REQUIRED",ERR_INVALID_PROTOCOLS_FOR_STREAM:"ERR_INVALID_PROTOCOLS_FOR_STREAM",ERR_CONNECTION_ENDED:"ERR_CONNECTION_ENDED",ERR_CONNECTION_FAILED:"ERR_CONNECTION_FAILED",ERR_NODE_NOT_STARTED:"ERR_NODE_NOT_STARTED",ERR_ALREADY_ABORTED:"ERR_ALREADY_ABORTED",ERR_TOO_MANY_ADDRESSES:"ERR_TOO_MANY_ADDRESSES",ERR_NO_VALID_ADDRESSES:"ERR_NO_VALID_ADDRESSES",ERR_RELAYED_DIAL:"ERR_RELAYED_DIAL",ERR_DIALED_SELF:"ERR_DIALED_SELF",ERR_DISCOVERED_SELF:"ERR_DISCOVERED_SELF",ERR_DUPLICATE_TRANSPORT:"ERR_DUPLICATE_TRANSPORT",ERR_ENCRYPTION_FAILED:"ERR_ENCRYPTION_FAILED",ERR_HOP_REQUEST_FAILED:"ERR_HOP_REQUEST_FAILED",ERR_INVALID_KEY:"ERR_INVALID_KEY",ERR_INVALID_MESSAGE:"ERR_INVALID_MESSAGE",ERR_INVALID_PARAMETERS:"ERR_INVALID_PARAMETERS",ERR_INVALID_PEER:"ERR_INVALID_PEER",ERR_MUXER_UNAVAILABLE:"ERR_MUXER_UNAVAILABLE",ERR_TIMEOUT:"ERR_TIMEOUT",ERR_TRANSPORT_UNAVAILABLE:"ERR_TRANSPORT_UNAVAILABLE",ERR_TRANSPORT_DIAL_FAILED:"ERR_TRANSPORT_DIAL_FAILED",ERR_UNSUPPORTED_PROTOCOL:"ERR_UNSUPPORTED_PROTOCOL",ERR_INVALID_MULTIADDR:"ERR_INVALID_MULTIADDR",ERR_SIGNATURE_NOT_VALID:"ERR_SIGNATURE_NOT_VALID"}},43079:(e,t,r)=>{"use strict";const n=r(88785),{Multiaddr:i}=r(46584),o=r(32114),{codes:s}=r(23416);e.exports=function(e){let t;if("string"==typeof e&&(e=new i(e)),i.isMultiaddr(e)){t=e;const r=e.getPeerId();if(!r)throw o(new Error(`${e} does not have a valid peer type`),s.ERR_INVALID_MULTIADDR);try{e=n.createFromB58String(r)}catch(t){throw o(new Error(`${e} is not a valid peer type`),s.ERR_INVALID_MULTIADDR)}}return{id:e,multiaddrs:t?[t]:void 0}}},78508:(e,t,r)=>{"use strict";const n=r(28362).version;e.exports.PROTOCOL_VERSION="ipfs/0.1.0",e.exports.AGENT_VERSION=`js-libp2p/${n}`,e.exports.MULTICODEC_IDENTIFY="/ipfs/id/1.0.0",e.exports.MULTICODEC_IDENTIFY_PUSH="/ipfs/id/push/1.0.0",e.exports.IDENTIFY_PROTOCOL_VERSION="0.1.0",e.exports.MULTICODEC_IDENTIFY_PROTOCOL_NAME="id",e.exports.MULTICODEC_IDENTIFY_PUSH_PROTOCOL_NAME="id/push",e.exports.MULTICODEC_IDENTIFY_PROTOCOL_VERSION="1.0.0",e.exports.MULTICODEC_IDENTIFY_PUSH_PROTOCOL_VERSION="1.0.0"},26078:(e,t,r)=>{"use strict";const n=r(11227),i=Object.assign(n("libp2p:identify"),{error:n("libp2p:identify:err")}),o=r(32114),s=r(63500),{pipe:a}=r(60618),{collect:c,take:u,consume:f}=r(38386),{fromString:l}=r(52217),h=r(88785),{Multiaddr:d}=r(46584),{toBuffer:p}=r(96653),y=r(29966),g=r(31244),b=r(61131),{MULTICODEC_IDENTIFY:m,MULTICODEC_IDENTIFY_PUSH:v,IDENTIFY_PROTOCOL_VERSION:w,MULTICODEC_IDENTIFY_PROTOCOL_NAME:E,MULTICODEC_IDENTIFY_PUSH_PROTOCOL_NAME:_,MULTICODEC_IDENTIFY_PROTOCOL_VERSION:S,MULTICODEC_IDENTIFY_PUSH_PROTOCOL_VERSION:A}=r(78508),{codes:T}=r(23416);class I{static getProtocolStr(e){return{identifyProtocolStr:`/${e._config.protocolPrefix}/${E}/${S}`,identifyPushProtocolStr:`/${e._config.protocolPrefix}/${_}/${A}`}}constructor({libp2p:e}){this._libp2p=e,this.peerStore=e.peerStore,this.addressManager=e.addressManager,this.connectionManager=e.connectionManager,this.peerId=e.peerId,this.handleMessage=this.handleMessage.bind(this);const t=I.getProtocolStr(e);this.identifyProtocolStr=t.identifyProtocolStr,this.identifyPushProtocolStr=t.identifyPushProtocolStr,this._host={protocolVersion:`${e._config.protocolPrefix}/${w}`,...e._options.host},this.peerStore.metadataBook.set(this.peerId,"AgentVersion",l(this._host.agentVersion)),this.peerStore.metadataBook.set(this.peerId,"ProtocolVersion",l(this._host.protocolVersion)),this.connectionManager.on("peer:connect",(e=>{this.identify(e).catch(i.error)})),this.peerStore.on("change:multiaddrs",(({peerId:e})=>{e.toString()===this.peerId.toString()&&this.pushToPeerStore()})),this.peerStore.on("change:protocols",(({peerId:e})=>{e.toString()===this.peerId.toString()&&this.pushToPeerStore()}))}async push(e){const t=await this.peerStore.addressBook.getRawEnvelope(this.peerId),r=this._libp2p.multiaddrs.map((e=>e.bytes)),n=this.peerStore.protoBook.get(this.peerId)||[],o=e.map((async e=>{try{const{stream:i}=await e.newStream(this.identifyPushProtocolStr);await a([y.Identify.encode({listenAddrs:r,signedPeerRecord:t,protocols:n}).finish()],s.encode(),i,f)}catch(e){i.error("could not push identify update to peer",e)}}));return Promise.all(o)}pushToPeerStore(){if(!this._libp2p.isStarted())return;const e=[];let t;for(const r of this.peerStore.peers.values())r.protocols.includes(this.identifyPushProtocolStr)&&(t=this.connectionManager.get(r.id))&&e.push(t);this.push(e)}async identify(e){const{stream:t}=await e.newStream(this.identifyProtocolStr),[r]=await a([],t,s.decode(),u(1),p,c);if(!r)throw o(new Error("No data could be retrieved"),T.ERR_CONNECTION_ENDED);let n;try{n=y.Identify.decode(r)}catch(e){throw o(e,T.ERR_INVALID_MESSAGE)}const{publicKey:f,listenAddrs:m,protocols:v,observedAddr:w,signedPeerRecord:E}=n,_=await h.createFromPubKey(f);if(e.remotePeer.toB58String()!==_.toB58String())throw o(new Error("identified peer does not match the expected peer"),T.ERR_INVALID_PEER);const S=I.getCleanMultiaddr(w);try{const e=await g.openAndCertify(E,b.DOMAIN);if(this.peerStore.addressBook.consumePeerRecord(e))return this.peerStore.protoBook.set(_,v),this.peerStore.metadataBook.set(_,"AgentVersion",l(n.agentVersion)),void this.peerStore.metadataBook.set(_,"ProtocolVersion",l(n.protocolVersion))}catch(e){i("received invalid envelope, discard it and fallback to listenAddrs is available",e)}try{this.peerStore.addressBook.set(_,m.map((e=>new d(e))))}catch(e){i.error("received invalid addrs",e)}this.peerStore.protoBook.set(_,v),this.peerStore.metadataBook.set(_,"AgentVersion",l(n.agentVersion)),this.peerStore.metadataBook.set(_,"ProtocolVersion",l(n.protocolVersion)),i("received observed address of %s",S)}handleMessage({connection:e,stream:t,protocol:r}){switch(r){case this.identifyProtocolStr:return this._handleIdentify({connection:e,stream:t});case this.identifyPushProtocolStr:return this._handlePush({connection:e,stream:t});default:i.error("cannot handle unknown protocol %s",r)}}async _handleIdentify({connection:e,stream:t}){let r=new Uint8Array(0);this.peerId.pubKey&&(r=this.peerId.pubKey.bytes);const n=await this.peerStore.addressBook.getRawEnvelope(this.peerId),o=this.peerStore.protoBook.get(this.peerId)||[],c=y.Identify.encode({protocolVersion:this._host.protocolVersion,agentVersion:this._host.agentVersion,publicKey:r,listenAddrs:this._libp2p.multiaddrs.map((e=>e.bytes)),signedPeerRecord:n,observedAddr:e.remoteAddr.bytes,protocols:o}).finish();try{await a([c],s.encode(),t,f)}catch(e){i.error("could not respond to identify request",e)}}async _handlePush({connection:e,stream:t}){let r;try{const[e]=await a([],t,s.decode(),u(1),p,c);r=y.Identify.decode(e)}catch(e){return i.error("received invalid message",e)}const n=e.remotePeer;try{const e=await g.openAndCertify(r.signedPeerRecord,b.DOMAIN);if(this.peerStore.addressBook.consumePeerRecord(e))return void this.peerStore.protoBook.set(n,r.protocols)}catch(e){i("received invalid envelope, discard it and fallback to listenAddrs is available",e)}try{this.peerStore.addressBook.set(n,r.listenAddrs.map((e=>new d(e))))}catch(e){i.error("received invalid addrs",e)}this.peerStore.protoBook.set(n,r.protocols)}static getCleanMultiaddr(e){if(e&&e.length>0)try{return new d(e)}catch(e){return null}return null}}const C={IDENTIFY:m,IDENTIFY_PUSH:v};I.multicodecs=C,I.Messsage=y,e.exports=I},29966:(e,t,r)=>{"use strict";var n=r(62100),i=n.Reader,o=n.Writer,s=n.util,a=n.roots["libp2p-identify"]||(n.roots["libp2p-identify"]={});a.Identify=function(){function e(e){if(this.listenAddrs=[],this.protocols=[],e)for(var t=Object.keys(e),r=0;r>>3){case 5:n.protocolVersion=e.string();break;case 6:n.agentVersion=e.string();break;case 1:n.publicKey=e.bytes();break;case 2:n.listenAddrs&&n.listenAddrs.length||(n.listenAddrs=[]),n.listenAddrs.push(e.bytes());break;case 4:n.observedAddr=e.bytes();break;case 3:n.protocols&&n.protocols.length||(n.protocols=[]),n.protocols.push(e.string());break;case 8:n.signedPeerRecord=e.bytes();break;default:e.skipType(7&o)}}return n},e.fromObject=function(e){if(e instanceof a.Identify)return e;var t=new a.Identify;if(null!=e.protocolVersion&&(t.protocolVersion=String(e.protocolVersion)),null!=e.agentVersion&&(t.agentVersion=String(e.agentVersion)),null!=e.publicKey&&("string"==typeof e.publicKey?s.base64.decode(e.publicKey,t.publicKey=s.newBuffer(s.base64.length(e.publicKey)),0):e.publicKey.length&&(t.publicKey=e.publicKey)),e.listenAddrs){if(!Array.isArray(e.listenAddrs))throw TypeError(".Identify.listenAddrs: array expected");t.listenAddrs=[];for(var r=0;r{"use strict";const n=r(11227),i=Object.assign(n("libp2p"),{error:n("libp2p:err")}),{EventEmitter:o}=r(17187),s=r(32114),a=r(88785),{Multiaddr:c}=r(46584),u=r(51203),f=r(57197),l=r(43079),{validate:h}=r(36195),{codes:d,messages:p}=r(23416),y=r(14942),g=r(7376),b=r(91491),m=r(2715),v=r(63849),w=r(40298),E=r(31175),_=r(6984),S=r(21003),A=r(4323),T=r(65993),I=r(78112),C=r(28861),P=r(75466),R=r(26078),k=r(64205),{updateSelfPeerRecord:B}=r(1001);class x extends o{static async create(e){if(e.peerId)return new x(e);const t=await a.create();return e.peerId=t,new x(e)}constructor(e){if(super(),this._options=h(e),this.peerId=this._options.peerId,this.datastore=this._options.datastore,this.peerStore=this.datastore&&this._options.peerStore.persistence?new I({peerId:this.peerId,datastore:this.datastore,...this._options.peerStore}):new A({peerId:this.peerId}),this.addresses=this._options.addresses,this.addressManager=new y(this.peerId,this._options.addresses),this.addressManager.on("change:addresses",(()=>{B(this).catch((e=>{i.error("Error updating self peer record",e)}))})),this._modules=this._options.modules,this._config=this._options.config,this._transport=[],this._discovery=new Map,this.connectionManager=new g(this,{autoDial:this._config.peerDiscovery.autoDial,...this._options.connectionManager}),this._options.metrics.enabled&&(this.metrics=new E({...this._options.metrics,connectionManager:this.connectionManager})),this._options.keychain&&this._options.keychain.datastore){i("creating keychain");const e=w.generateOptions();this.keychain=new w(this._options.keychain.datastore,{...e,...this._options.keychain}),i("keychain constructed")}if(this.upgrader=new S({localPeer:this.peerId,metrics:this.metrics,onConnection:e=>this.connectionManager.onConnect(e),onConnectionEnd:e=>this.connectionManager.onDisconnect(e)}),this.transportManager=new _({libp2p:this,upgrader:this.upgrader,faultTolerance:this._options.transportManager.faultTolerance}),this.natManager=new k({peerId:this.peerId,addressManager:this.addressManager,transportManager:this.transportManager,...this._options.config.nat}),this.registrar=new C({peerStore:this.peerStore,connectionManager:this.connectionManager}),this.handle=this.handle.bind(this),this.registrar.handle=this.handle,!this._modules.connEncryption||!this._modules.connEncryption.length)throw s(new Error(p.CONN_ENCRYPTION_REQUIRED),d.CONN_ENCRYPTION_REQUIRED);if(this._modules.connEncryption.forEach((e=>{this.upgrader.cryptos.set(e.protocol,e)})),this.dialer=new v({transportManager:this.transportManager,peerStore:this.peerStore,...this._options.dialer}),this._modules.transport.forEach((e=>{const t=e.prototype[Symbol.toStringTag],r=this._config.transport[t];this.transportManager.add(t,e,r)})),this._config.relay.enabled&&(this.transportManager.add(b.prototype[Symbol.toStringTag],b),this.relay=new m(this)),this._modules.streamMuxer&&(this._modules.streamMuxer.forEach((e=>{this.upgrader.muxers.set(e.multicodec,e)})),this.identifyService=new R({libp2p:this}),this.handle(Object.values(R.getProtocolStr(this)),this.identifyService.handleMessage)),this._modules.connProtector)this.upgrader.protector=this._modules.connProtector;else if(void 0!==globalThis.process&&globalThis.process.env&&globalThis.process.env.LIBP2P_FORCE_PNET)throw new Error("Private network is enforced, but no protector was provided");if(this._modules.dht){const e=this._modules.dht;this._dht=new e({libp2p:this,dialer:this.dialer,peerId:this.peerId,peerStore:this.peerStore,registrar:this.registrar,datastore:this.datastore,...this._config.dht})}if(this._modules.pubsub){const e=this._modules.pubsub;this.pubsub=T(e,this,this._config.pubsub)}this.peerRouting=new u(this),this.contentRouting=new f(this),P.mount(this),this._onDiscoveryPeer=this._onDiscoveryPeer.bind(this)}emit(e,...t){return"error"!==e||this._events.error?super.emit(e,...t):(i.error(t),!1)}async start(){i("libp2p is starting");try{await this._onStarting(),await this._onDidStart(),i("libp2p has started")}catch(e){throw this.emit("error",e),i.error("An error occurred starting libp2p",e),await this.stop(),e}}async stop(){i("libp2p is stopping");try{this._isStarted=!1,this.relay&&this.relay.stop(),this.peerRouting.stop();for(const e of this._discovery.values())e.removeListener("peer",this._onDiscoveryPeer);await Promise.all(Array.from(this._discovery.values(),(e=>e.stop()))),this._discovery=new Map,await this.peerStore.stop(),await this.connectionManager.stop(),await Promise.all([this.pubsub&&this.pubsub.stop(),this._dht&&this._dht.stop(),this.metrics&&this.metrics.stop()]),await this.natManager.stop(),await this.transportManager.close(),P.unmount(this),this.dialer.destroy()}catch(e){e&&(i.error(e),this.emit("error",e))}i("libp2p has stopped")}async loadKeychain(){if(this.keychain)try{await this.keychain.findKeyByName("self")}catch(e){await this.keychain.importPeer("self",this.peerId)}}isStarted(){return this._isStarted}get connections(){return this.connectionManager.connections}dial(e,t){return this._dial(e,t)}async dialProtocol(e,t,r){if(!t||!t.length)throw s(new Error("no protocols were provided to open a stream"),d.ERR_INVALID_PROTOCOLS_FOR_STREAM);return(await this._dial(e,r)).newStream(t)}async _dial(e,t){const{id:r,multiaddrs:n}=l(e);if(r.equals(this.peerId))throw s(new Error("Cannot dial self"),d.ERR_DIALED_SELF);let i=this.connectionManager.get(r);return i?n&&this.peerStore.addressBook.add(r,n):i=await this.dialer.connectToPeer(e,t),i}get multiaddrs(){let e=this.addressManager.getAnnounceAddrs().map((e=>e.toString()));e.length||(e=this.transportManager.getAddrs().map((e=>e.toString()))),e=e.concat(this.addressManager.getObservedAddrs().map((e=>e.toString())));const t=this._options.addresses.announceFilter,r=new Set(e);return t(Array.from(r).map((e=>new c(e))))}async hangUp(e){const{id:t}=l(e),r=this.connectionManager.connections.get(t.toB58String());r&&await Promise.all(r.map((e=>e.close())))}ping(e){const{id:t,multiaddrs:r}=l(e);return P(this,r?r[0]:t)}handle(e,t){(e=Array.isArray(e)?e:[e]).forEach((e=>{this.upgrader.protocols.set(e,t)})),this.peerStore.protoBook.add(this.peerId,e)}unhandle(e){(e=Array.isArray(e)?e:[e]).forEach((e=>{this.upgrader.protocols.delete(e)})),this.peerStore.protoBook.remove(this.peerId,e)}async _onStarting(){const e=this.addressManager.getListenAddrs();await this.transportManager.listen(e),this.natManager.start(),await this.peerStore.start(),this._config.pubsub.enabled&&this.pubsub&&this.pubsub.start(),this._config.dht.enabled&&(this._dht&&this._dht.start(),this._dht.on("peer",this._onDiscoveryPeer)),this.metrics&&this.metrics.start()}async _onDidStart(){this._isStarted=!0,this.peerStore.on("peer",(e=>{this.emit("peer:discovery",e),this._maybeConnect(e)}));for(const e of this.peerStore.peers.values())this.emit("peer:discovery",e.id);this.connectionManager.start(),await this._setupPeerDiscovery(),this.relay&&this.relay.start(),this.peerRouting.start()}_onDiscoveryPeer(e){e.id.toB58String()!==this.peerId.toB58String()?(e.multiaddrs&&this.peerStore.addressBook.add(e.id,e.multiaddrs),e.protocols&&this.peerStore.protoBook.set(e.id,e.protocols)):i.error(new Error(d.ERR_DISCOVERED_SELF))}async _maybeConnect(e){if(!0===this._config.peerDiscovery.autoDial&&!this.connectionManager.get(e)&&(this._options.connectionManager.minConnections||0)>this.connectionManager.size){i("connecting to discovered peer %s",e.toB58String());try{await this.dialer.connectToPeer(e)}catch(t){i.error(`could not connect to discovered peer ${e.toB58String()} with ${t}`)}}}async _setupPeerDiscovery(){const e=e=>{let t={enabled:!0};if(e.tag&&this._config.peerDiscovery&&this._config.peerDiscovery[e.tag]&&(t={...t,...this._config.peerDiscovery[e.tag]}),t.enabled&&!this._discovery.has(e.tag)){let r;r="function"==typeof e?new e(Object.assign({},t,{peerId:this.peerId,libp2p:this})):e,r.on("peer",this._onDiscoveryPeer),this._discovery.set(e.tag,r)}};for(const t of this._modules.peerDiscovery||[])e(t);for(const t of this.transportManager.getTransports())t.discovery&&e(t.discovery);await Promise.all(Array.from(this._discovery.values(),(e=>e.start())))}}e.exports=x},89138:(e,t,r)=>{"use strict";r(79437),r(97450);const n=r(3832),{certificateForKey:i,findAsync:o}=r(48913),s=r(32114),{fromString:a}=r(52217),{toString:c}=r(92263),u=new WeakMap;e.exports=class{constructor(e,t){if(!e)throw s(new Error("keychain is required"),"ERR_KEYCHAIN_REQUIRED");this.keychain=e,u.set(this,{dek:t})}async encrypt(e,t){if(!(t instanceof Uint8Array))throw s(new Error("Plain data must be a Uint8Array"),"ERR_INVALID_PARAMS");const r=await this.keychain.findKeyByName(e),o=await this.keychain._getPrivateKey(e),c=u.get(this).dek,f=n.pki.decryptRsaPrivateKey(o,c),l=await i(r,f),h=n.pkcs7.createEnvelopedData();h.addRecipient(l),h.content=n.util.createBuffer(t),h.encrypt();const d=n.asn1.toDer(h.toAsn1()).getBytes();return a(d,"ascii")}async decrypt(e){if(!(e instanceof Uint8Array))throw s(new Error("CMS data is required"),"ERR_INVALID_PARAMS");let t;try{const r=n.util.createBuffer(c(e,"ascii")),i=n.asn1.fromDer(r);t=n.pkcs7.messageFromAsn1(i)}catch(e){throw s(new Error("Invalid CMS: "+e.message),"ERR_INVALID_CMS")}const r=t.recipients.filter((e=>e.issuer.find((e=>"O"===e.shortName&&"ipfs"===e.value)))).filter((e=>e.issuer.find((e=>"CN"===e.shortName)))).map((e=>({recipient:e,keyId:e.issuer.find((e=>"CN"===e.shortName)).value}))),i=await o(r,(async e=>{try{if(await this.keychain.findKeyById(e.keyId))return!0}catch(e){return!1}return!1}));if(!i){const e=r.map((e=>e.keyId));throw s(new Error("Decryption needs one of the key(s): "+e.join(", ")),"ERR_MISSING_KEYS",{missingKeys:e})}const f=await this.keychain.findKeyById(i.keyId);if(!f)throw s(new Error("No key available to decrypto"),"ERR_NO_KEY");const l=await this.keychain._getPrivateKey(f.name),h=u.get(this).dek,d=n.pki.decryptRsaPrivateKey(l,h);return t.decrypt(i.recipient,d),a(t.content.getBytes(),"ascii")}}},40298:(e,t,r)=>{"use strict";const n=r(11227),i=Object.assign(n("libp2p:keychain"),{error:n("libp2p:keychain:err")}),o=r(50202),s=r(70942),a=r(49928),{Key:c}=r(82233),u=r(89138),f=r(32114),{toString:l}=r(92263),{fromString:h}=r(52217);r(63219);const d="/info/",p=new WeakMap,y={dek:{keyLength:64,iterationCount:1e4,salt:"you should override this value with a crypto secure random number",hash:"sha2-512"}};function g(e){return!!e&&"string"==typeof e&&e===o(e.trim())}async function b(e){const t=800*Math.random()+200;throw await new Promise((e=>setTimeout(e,t))),e}function m(e){return new c("/pkcs8/"+e)}function v(e){return new c(d+e)}e.exports=class{constructor(e,t){if(!e)throw new Error("store is required");if(this.store=e,this.opts=s(y,t),this.opts.pass&&this.opts.pass.length<20)throw new Error("pass must be least 20 characters");if(this.opts.dek.keyLength<14)throw new Error("dek.keyLength must be least 14 bytes");if(this.opts.dek.salt.length<16)throw new Error("dek.saltLength must be least 16 bytes");if(this.opts.dek.iterationCount<1e3)throw new Error("dek.iterationCount must be least 1000");const r=this.opts.pass?a.pbkdf2(this.opts.pass,this.opts.dek.salt,this.opts.dek.iterationCount,this.opts.dek.keyLength,this.opts.dek.hash):"";p.set(this,{dek:r})}get cms(){return new u(this,p.get(this).dek)}static generateOptions(){const e=Object.assign({},y),t=3*Math.ceil(16/3);return e.dek.salt=l(a.randomBytes(t),"base64"),e}static get options(){return y}async createKey(e,t,r=2048){const n=this;if(!g(e)||"self"===e)return b(f(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));if("string"!=typeof t)return b(f(new Error(`Invalid key type '${t}'`),"ERR_INVALID_KEY_TYPE"));const i=m(e);if(await n.store.has(i))return b(f(new Error(`Key '${e}' already exists`),"ERR_KEY_ALREADY_EXISTS"));if("rsa"===t.toLowerCase()&&(!Number.isSafeInteger(r)||r<2048))return b(f(new Error(`Invalid RSA key size ${r}`),"ERR_INVALID_KEY_SIZE"));let o;try{const s=await a.keys.generateKeyPair(t,r),c=await s.id(),u=p.get(this).dek,f=await s.export(u);o={name:e,id:c};const l=n.store.batch();l.put(i,h(f)),l.put(v(e),h(JSON.stringify(o))),await l.commit()}catch(e){return b(e)}return o}async listKeys(){const e=this,t={prefix:d},r=[];for await(const n of e.store.query(t))r.push(JSON.parse(l(n.value)));return r}async findKeyById(e){try{return(await this.listKeys()).find((t=>t.id===e))}catch(e){return b(e)}}async findKeyByName(e){if(!g(e))return b(f(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));const t=v(e);try{const e=await this.store.get(t);return JSON.parse(l(e))}catch(t){return b(f(new Error(`Key '${e}' does not exist. ${t.message}`),"ERR_KEY_NOT_FOUND"))}}async removeKey(e){if(!g(e)||"self"===e)return b(f(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));const t=m(e),r=await this.findKeyByName(e),n=this.store.batch();return n.delete(t),n.delete(v(e)),await n.commit(),r}async renameKey(e,t){const r=this;if(!g(e)||"self"===e)return b(f(new Error(`Invalid old key name '${e}'`),"ERR_OLD_KEY_NAME_INVALID"));if(!g(t)||"self"===t)return b(f(new Error(`Invalid new key name '${t}'`),"ERR_NEW_KEY_NAME_INVALID"));const n=m(e),i=m(t),o=v(e),s=v(t);if(await r.store.has(i))return b(f(new Error(`Key '${t}' already exists`),"ERR_KEY_ALREADY_EXISTS"));try{const e=await r.store.get(n),a=await r.store.get(o),c=JSON.parse(l(a));c.name=t;const u=r.store.batch();return u.put(i,e),u.put(s,h(JSON.stringify(c))),u.delete(n),u.delete(o),await u.commit(),c}catch(e){return b(e)}}async exportKey(e,t){if(!g(e))return b(f(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));if(!t)return b(f(new Error("Password is required"),"ERR_PASSWORD_REQUIRED"));const r=m(e);try{const e=await this.store.get(r),n=l(e),i=p.get(this).dek;return(await a.keys.import(n,i)).export(t)}catch(e){return b(e)}}async importKey(e,t,r){if(!g(e)||"self"===e)return b(f(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));if(!t)return b(f(new Error("PEM encoded key is required"),"ERR_PEM_REQUIRED"));const n=m(e);if(await this.store.has(n))return b(f(new Error(`Key '${e}' already exists`),"ERR_KEY_ALREADY_EXISTS"));let i,o;try{i=await a.keys.import(t,r)}catch(e){return b(f(new Error("Cannot read the key, most likely the password is wrong"),"ERR_CANNOT_READ_KEY"))}try{o=await i.id();const e=p.get(this).dek;t=await i.export(e)}catch(e){return b(e)}const s={name:e,id:o},c=this.store.batch();return c.put(n,h(t)),c.put(v(e),h(JSON.stringify(s))),await c.commit(),s}async importPeer(e,t){const r=this;if(!g(e))return b(f(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));if(!t||!t.privKey)return b(f(new Error("Peer.privKey is required"),"ERR_MISSING_PRIVATE_KEY"));const n=t.privKey,i=m(e);if(await r.store.has(i))return b(f(new Error(`Key '${e}' already exists`),"ERR_KEY_ALREADY_EXISTS"));try{const t=await n.id(),o=p.get(this).dek,s=await n.export(o),a={name:e,id:t},c=r.store.batch();return c.put(i,h(s)),c.put(v(e),h(JSON.stringify(a))),await c.commit(),a}catch(e){return b(e)}}async _getPrivateKey(e){if(!g(e))return b(f(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));try{const t=m(e),r=await this.store.get(t);return l(r)}catch(t){return b(f(new Error(`Key '${e}' does not exist. ${t.message}`),"ERR_KEY_NOT_FOUND"))}}async rotateKeychainPass(e,t){if("string"!=typeof e)return b(f(new Error(`Invalid old pass type '${typeof e}'`),"ERR_INVALID_OLD_PASS_TYPE"));if("string"!=typeof t)return b(f(new Error(`Invalid new pass type '${typeof t}'`),"ERR_INVALID_NEW_PASS_TYPE"));if(t.length<20)return b(f(new Error(`Invalid pass length ${t.length}`),"ERR_INVALID_PASS_LENGTH"));i("recreating keychain");const r=p.get(this).dek;this.opts.pass=t;const n=t?a.pbkdf2(t,this.opts.dek.salt,this.opts.dek.iterationCount,this.opts.dek.keyLength,this.opts.dek.hash):"";p.set(this,{dek:n});const o=await this.listKeys();for(const e of o){const t=await this.store.get(m(e.name)),i=l(t),o=await a.keys.import(i,r),s=n.toString(),c=await o.export(s),u=this.store.batch(),f={name:e.name,id:e.id};u.put(m(e.name),h(c)),u.put(v(e.name),h(JSON.stringify(f))),await u.commit()}i("keychain reconstructed")}}},48913:(e,t,r)=>{"use strict";r(25414);const n=r(3832).pki;e.exports={certificateForKey:(e,t)=>{const r=n.setRsaPublicKey(t.n,t.e),i=n.createCertificate();i.publicKey=r,i.serialNumber="01",i.validity.notBefore=new Date,i.validity.notAfter=new Date,i.validity.notAfter.setFullYear(i.validity.notBefore.getFullYear()+10);const o=[{name:"organizationName",value:"ipfs"},{shortName:"OU",value:"keystore"},{name:"commonName",value:e.id}];return i.setSubject(o),i.setIssuer(o),i.setExtensions([{name:"basicConstraints",cA:!0},{name:"keyUsage",keyCertSign:!0,digitalSignature:!0,nonRepudiation:!0,keyEncipherment:!0,dataEncipherment:!0},{name:"extKeyUsage",serverAuth:!0,clientAuth:!0,codeSigning:!0,emailProtection:!0,timeStamping:!0},{name:"nsCertType",client:!0,server:!0,email:!0,objsign:!0,sslCA:!0,emailCA:!0,objCA:!0}]),i.sign(t),i},findAsync:async function(e,t){const r=e.map(t);return e[(await Promise.all(r)).findIndex((e=>e))]}}},31175:(e,t,r)=>{"use strict";const n=r(70942),{pipe:i}=r(60618),{tap:o}=r(38386),s=r(87787),{METRICS:a}=r(3524),c=r(61094),u=["dataReceived","dataSent"],f={in:"dataReceived",out:"dataSent"};class l{constructor(e){this._options=n(a,e),this._globalStats=new c(u,this._options),this._peerStats=new Map,this._protocolStats=new Map,this._oldPeers=s(this._options.maxOldPeersRetention),this._running=!1,this._onMessage=this._onMessage.bind(this),this._connectionManager=e.connectionManager,this._connectionManager.on("peer:disconnect",(e=>{this.onPeerDisconnected(e.remotePeer)}))}start(){this._running=!0}stop(){this._running=!1,this._globalStats.stop();for(const e of this._peerStats.values())e.stop();for(const e of this._protocolStats.values())e.stop()}get global(){return this._globalStats}get peers(){return Array.from(this._peerStats.keys())}forPeer(e){const t=e.toB58String();return this._peerStats.get(t)||this._oldPeers.get(t)}get protocols(){return Array.from(this._protocolStats.keys())}forProtocol(e){return this._protocolStats.get(e)}onPeerDisconnected(e){const t=e.toB58String(),r=this._peerStats.get(t);r&&(r.stop(),this._peerStats.delete(t),this._oldPeers.set(t,r))}_onMessage({remotePeer:e,protocol:t,direction:r,dataLength:n}){if(!this._running)return;const i=f[r];let o=this.forPeer(e);if(o||(o=new c(u,this._options),this._peerStats.set(e.toB58String(),o)),o.push(i,n),this._globalStats.push(i,n),t){let e=this.forProtocol(t);e||(e=new c(u,this._options),this._protocolStats.set(t,e)),e.push(i,n)}}updatePlaceholder(e,t){if(!this._running)return;const r=this.forPeer(e),n=t.toB58String(),i=this.forPeer(t);let o=r;i&&(o=l.mergeStats(i,o),this._oldPeers.delete(n)),this._peerStats.delete(e.toB58String()),this._peerStats.set(n,o),o.start()}trackStream({stream:e,remotePeer:t,protocol:r}){const n=this,s=e.source;e.source=o((e=>n._onMessage({remotePeer:t,protocol:r,direction:"in",dataLength:e.length})))(s);const a=e.sink;return e.sink=e=>i(e,o((e=>n._onMessage({remotePeer:t,protocol:r,direction:"out",dataLength:e.length}))),a),e}static mergeStats(e,t){return e.stop(),t.stop(),e._queue=[...e._queue,...t._queue],e}}e.exports=l},87787:(e,t,r)=>{"use strict";const n=r(70248);e.exports=e=>{const t=n(e);return t.delete=t.remove,t}},61094:(e,t,r)=>{"use strict";const{EventEmitter:n}=r(17187),{BigNumber:i}=r(44431),o=r(63573),s=r(82916);e.exports=class extends n{constructor(e,t){super(),this._options=t,this._queue=[],this._stats={dataReceived:i(0),dataSent:i(0)},this._frequencyLastTime=Date.now(),this._frequencyAccumulators={},this._movingAverages={},this._update=this._update.bind(this);const r=this._options.movingAverageIntervals;for(let t=0;t{this._updateFrequencyFor(r,t,e)})),this._frequencyLastTime=e}_updateFrequencyFor(e,t,r){const n=this._frequencyAccumulators[e]||0;this._frequencyAccumulators[e]=0;const i=n/(t||1)*1e3;let s=this._movingAverages[e];s||(s=this._movingAverages[e]={});const a=this._options.movingAverageIntervals;for(let e=0;e{"use strict";const n=r(57600),i=r(11227),{promisify:o}=r(76021),{Multiaddr:s}=r(46584),a=Object.assign(i("libp2p:nat"),{error:i("libp2p:nat:err")}),{isBrowser:c}=r(97916),u=r(42693),f=r(290),l=r(28362),h=r(32114),{codes:{ERR_INVALID_PARAMETERS:d}}=r(23416),p=r(23830);function y(e=1024,t=65535){return Math.floor(Math.random()*(t-e+1)+e)}e.exports=class{constructor({peerId:e,addressManager:t,transportManager:r,...n}){if(this._peerId=e,this._addressManager=t,this._transportManager=r,this._enabled=n.enabled,this._externalIp=n.externalIp,this._options={description:n.description||`${l.name}@${l.version} ${this._peerId}`,ttl:n.ttl||7200,autoUpdate:n.keepAlive||!0,gateway:n.gateway,enablePMP:Boolean(n.pmp&&n.pmp.enabled)},this._options.ttl<7200)throw h(new Error("NatManager ttl should be at least 7200 seconds"),d)}start(){!c&&this._enabled&&this._start().catch((e=>{a.error(e)}))}async _start(){const e=this._transportManager.getAddrs();for(const t of e){const{family:e,host:r,port:n,transport:i}=t.toOptions();if(!t.isThinWaistAddress()||"tcp"!==i)continue;if(p(t))continue;if(4!==e)continue;const o=this._getClient(),c=this._externalIp||await o.externalIp();if(f(c))throw new Error(`${c} is private - please set config.nat.externalIp to an externally routable IP or ensure you are not behind a double NAT`);const u=y();a(`opening uPnP connection from ${c}:${u} to ${r}:${n}`),await o.map({publicPort:u,privatePort:n,protocol:i.toUpperCase()}),this._addressManager.addObservedAddr(s.fromNodeAddress({family:4,address:c,port:u},i))}}_getClient(){if(this._client)return this._client;const e=new n(this._options),t=o(e.map.bind(e)),r=o(e.destroy.bind(e)),i=o(e.externalIp.bind(e));return this._client={map:(...e)=>u((()=>t(...e)),{onFailedAttempt:a.error,unref:!0}),destroy:(...e)=>u((()=>r(...e)),{onFailedAttempt:a.error,unref:!0}),externalIp:(...e)=>u((()=>i(...e)),{onFailedAttempt:a.error,unref:!0})},this._client}async stop(){if(!c&&this._client)try{await this._client.destroy(),this._client=null}catch(e){a.error(e)}}}},51203:(e,t,r)=>{"use strict";const n=r(11227),i=Object.assign(n("libp2p:peer-routing"),{error:n("libp2p:peer-routing:err")}),o=r(32114),{storeAddresses:s,uniquePeers:a,requirePeers:c}=r(63952),u=r(74014),{pipe:f}=r(60618),l=r(72262),h=r(64593),d=r(55565),{setDelayedInterval:p,clearDelayedInterval:y}=r(27695);e.exports=class{constructor(e){this._peerId=e.peerId,this._peerStore=e.peerStore,this._routers=e._modules.peerRouting||[],e._dht&&e._config.dht.enabled&&this._routers.push(e._dht),this._refreshManagerOptions=e._options.peerRouting.refreshManager,this._findClosestPeersTask=this._findClosestPeersTask.bind(this)}start(){this._routers.length&&!this._timeoutId&&this._refreshManagerOptions.enabled&&(this._timeoutId=p(this._findClosestPeersTask,this._refreshManagerOptions.interval,this._refreshManagerOptions.bootDelay))}async _findClosestPeersTask(){try{await h(this.getClosestPeers(this._peerId.id))}catch(e){i.error(e)}}stop(){y(this._timeoutId)}async findPeer(e,t){if(!this._routers.length)throw o(new Error("No peer routers available"),"NO_ROUTERS_AVAILABLE");if(e.toB58String()===this._peerId.toB58String())throw o(new Error("Should not try to find self"),"ERR_FIND_SELF");const r=await f(u(...this._routers.map((r=>[r.findPeer(e,t)]))),(e=>d(e,Boolean)),(e=>s(e,this._peerStore)),(e=>l(e)));if(r)return r;throw o(new Error("not found"),"NOT_FOUND")}async*getClosestPeers(e,t={timeout:3e4}){if(!this._routers.length)throw o(new Error("No peer routers available"),"NO_ROUTERS_AVAILABLE");yield*f(u(...this._routers.map((r=>r.getClosestPeers(e,t)))),(e=>s(e,this._peerStore)),(e=>a(e)),(e=>c(e)))}}},3721:(e,t,r)=>{"use strict";const n=r(11227),i=Object.assign(n("libp2p:peer-store:address-book"),{error:n("libp2p:peer-store:address-book:err")}),o=r(32114),{Multiaddr:s}=r(46584),a=r(88785),c=r(94903),u=r(61131),{codes:{ERR_INVALID_PARAMETERS:f}}=r(23416),l=r(31244);e.exports=class extends c{constructor(e){super({peerStore:e,eventName:"change:multiaddrs",eventProperty:"multiaddrs",eventTransformer:e=>e.addresses?e.addresses.map((e=>e.multiaddr)):[]}),this.data=new Map}consumePeerRecord(e){let t;try{t=u.createFromProtobuf(e.payload)}catch(e){return i.error("invalid peer record received"),!1}if(!t.peerId.equals(e.peerId))return i("signing key does not match PeerId in the PeerRecord"),!1;if(!t.multiaddrs||!t.multiaddrs.length)return!1;const r=t.peerId,n=r.toB58String(),o=(this.data.get(n)||{record:void 0}).record;if(o&&o.seqNumber>=t.seqNumber)return!1;const s=this._toAddresses(t.multiaddrs,!0);return this._setData(r,{addresses:s,record:{raw:e.marshal(),seqNumber:t.seqNumber}}),i(`stored provided peer record for ${n}`),!0}getRawEnvelope(e){const t=this.data.get(e.toB58String());if(t&&t.record&&t.record.raw)return t.record.raw}getPeerRecord(e){const t=this.getRawEnvelope(e);if(t)return l.createFromProtobuf(t)}set(e,t){if(!a.isPeerId(e))throw i.error("peerId must be an instance of peer-id to store data"),o(new Error("peerId must be an instance of peer-id"),f);const r=this._toAddresses(t);if(!r.length)return this;const n=e.toB58String(),s=this.data.get(n);return s&&s.addresses&&s.addresses.length===r.length&&s.addresses.filter((e=>r.some((t=>e.multiaddr.equals(t.multiaddr))))).length===s.addresses.length?(i(`the addresses provided to store are equal to the already stored for ${n}`),this):(this._setData(e,{addresses:r,record:s&&s.record}),i(`stored provided multiaddrs for ${n}`),s||this._ps.emit("peer",e),this)}add(e,t){if(!a.isPeerId(e))throw i.error("peerId must be an instance of peer-id to store data"),o(new Error("peerId must be an instance of peer-id"),f);const r=this._toAddresses(t),n=e.toB58String();if(!r.length)return this;const s=this.data.get(n);return s&&s.addresses&&(s.addresses.forEach((e=>{r.find((t=>t.multiaddr.equals(e.multiaddr)))||r.push(e)})),s.addresses.length===r.length)?(i(`the addresses provided to store are already stored for ${n}`),this):(this._setData(e,{addresses:r,record:s&&s.record}),i(`added provided multiaddrs for ${n}`),s&&s.addresses||this._ps.emit("peer",e),this)}get(e){if(!a.isPeerId(e))throw o(new Error("peerId must be an instance of peer-id"),f);const t=this.data.get(e.toB58String());return t&&t.addresses?[...t.addresses]:void 0}_toAddresses(e,t=!1){if(!e)throw i.error("multiaddrs must be provided to store data"),o(new Error("multiaddrs must be provided"),f);const r=[];return e.forEach((e=>{if(!s.isMultiaddr(e))throw i.error(`multiaddr ${e} must be an instance of multiaddr`),o(new Error(`multiaddr ${e} must be an instance of multiaddr`),f);r.find((t=>t.multiaddr.equals(e)))||r.push({multiaddr:e,isCertified:t})})),r}getMultiaddrsForPeer(e,t=(e=>e)){if(!a.isPeerId(e))throw o(new Error("peerId must be an instance of peer-id"),f);const r=this.data.get(e.toB58String());if(r&&r.addresses)return t(r.addresses||[]).map((t=>{const r=t.multiaddr,n=r.getPeerId();return n&&n===e.toB58String()?r:r.encapsulate(`/p2p/${e.toB58String()}`)}))}}},94903:(e,t,r)=>{"use strict";const n=r(32114),i=r(88785),{codes:{ERR_INVALID_PARAMETERS:o}}=r(23416),s=e=>e;e.exports=class{constructor({peerStore:e,eventName:t,eventProperty:r,eventTransformer:n=s}){this._ps=e,this.eventName=t,this.eventProperty=r,this.eventTransformer=n,this.data=new Map}set(e,t){throw n(new Error("set must be implemented by the subclass"),"ERR_NOT_IMPLEMENTED")}_setData(e,t,{emit:r=!0}={}){const n=e.toB58String();this.data.set(n,t),r&&this._emit(e,t)}_emit(e,t){this._ps.emit(this.eventName,{peerId:e,[this.eventProperty]:this.eventTransformer(t)})}get(e){if(!i.isPeerId(e))throw n(new Error("peerId must be an instance of peer-id"),o);const t=this.data.get(e.toB58String());return t?[...t]:void 0}delete(e){if(!i.isPeerId(e))throw n(new Error("peerId must be an instance of peer-id"),o);return!!this.data.delete(e.toB58String())&&(this._emit(e,[]),!0)}}},4323:(e,t,r)=>{"use strict";const n=r(32114),{EventEmitter:i}=r(17187),o=r(88785),s=r(3721),a=r(61062),c=r(3350),u=r(51979),{codes:{ERR_INVALID_PARAMETERS:f}}=r(23416);e.exports=class extends i{constructor({peerId:e}){super(),this._peerId=e,this.addressBook=new s(this),this.keyBook=new a(this),this.metadataBook=new c(this),this.protoBook=new u(this)}start(){}stop(){}get peers(){const e=new Set([...this.addressBook.data.keys(),...this.keyBook.data.keys(),...this.protoBook.data.keys(),...this.metadataBook.data.keys()]);this._peerId&&e.delete(this._peerId.toB58String());const t=new Map;return e.forEach((e=>{t.set(e,this.get(o.createFromB58String(e)))})),t}delete(e){const t=this.addressBook.delete(e),r=this.keyBook.delete(e),n=this.protoBook.delete(e),i=this.metadataBook.delete(e);return t||r||n||i}get(e){if(!o.isPeerId(e))throw n(new Error("peerId must be an instance of peer-id"),f);const t=this.keyBook.data.get(e.toB58String()),r=this.addressBook.get(e),i=this.metadataBook.get(e),s=this.protoBook.get(e);if(t||r||i||s)return{id:t||e,addresses:r||[],protocols:s||[],metadata:i}}}},61062:(e,t,r)=>{"use strict";const n=r(11227),i=Object.assign(n("libp2p:peer-store:key-book"),{error:n("libp2p:peer-store:key-book:err")}),o=r(32114),s=r(88785),a=r(94903),{codes:{ERR_INVALID_PARAMETERS:c}}=r(23416);e.exports=class extends a{constructor(e){super({peerStore:e,eventName:"change:pubkey",eventProperty:"pubkey",eventTransformer:e=>e.pubKey}),this.data=new Map}set(e,t){if(!s.isPeerId(e))throw i.error("peerId must be an instance of peer-id to store data"),o(new Error("peerId must be an instance of peer-id"),c);const r=e.toB58String();return!this.data.get(r)&&t&&(e.pubKey=t,this._setData(e,e),i(`stored provided public key for ${r}`)),this}get(e){if(!s.isPeerId(e))throw o(new Error("peerId must be an instance of peer-id"),c);const t=this.data.get(e.toB58String());return t?t.pubKey:void 0}}},3350:(e,t,r)=>{"use strict";const n=r(11227),i=Object.assign(n("libp2p:peer-store:proto-book"),{error:n("libp2p:peer-store:proto-book:err")}),o=r(32114),{equals:s}=r(19588),a=r(88785),c=r(94903),{codes:{ERR_INVALID_PARAMETERS:u}}=r(23416);e.exports=class extends c{constructor(e){super({peerStore:e,eventName:"change:metadata",eventProperty:"metadata"}),this.data=new Map}set(e,t,r){if(!a.isPeerId(e))throw i.error("peerId must be an instance of peer-id to store data"),o(new Error("peerId must be an instance of peer-id"),u);if("string"!=typeof t||!(r instanceof Uint8Array))throw i.error("valid key and value must be provided to store data"),o(new Error("valid key and value must be provided"),u);return this._setValue(e,t,r),this}_setValue(e,t,r,{emit:n=!0}={}){const o=e.toB58String(),a=this.data.get(o)||new Map,c=a.get(t);c&&s(r,c)?i(`the metadata provided to store is equal to the already stored for ${o} on ${t}`):(a.set(t,r),this.data.set(o,a),n&&this._emit(e,t))}get(e){if(!a.isPeerId(e))throw o(new Error("peerId must be an instance of peer-id"),u);return this.data.get(e.toB58String())}getValue(e,t){if(!a.isPeerId(e))throw o(new Error("peerId must be an instance of peer-id"),u);const r=this.data.get(e.toB58String());return r&&r.get(t)}delete(e){if(!a.isPeerId(e))throw o(new Error("peerId must be an instance of peer-id"),u);return!!this.data.delete(e.toB58String())&&(this._emit(e),!0)}deleteValue(e,t){if(!a.isPeerId(e))throw o(new Error("peerId must be an instance of peer-id"),u);const r=this.data.get(e.toB58String());return!(!r||!r.delete(t)||(this._emit(e,t),0))}}},5922:e=>{"use strict";e.exports.NAMESPACE_COMMON="/peers/",e.exports.NAMESPACE_ADDRESS="/peers/addrs/",e.exports.NAMESPACE_KEYS="/peers/keys/",e.exports.NAMESPACE_METADATA="/peers/metadata/",e.exports.NAMESPACE_PROTOCOL="/peers/protos/"},78112:(e,t,r)=>{"use strict";const n=r(11227),i=Object.assign(n("libp2p:persistent-peer-store"),{error:n("libp2p:persistent-peer-store:err")}),{Key:o}=r(82233),{Multiaddr:s}=r(46584),a=r(88785),{base32:c}=r(22817),u=r(4323),{NAMESPACE_ADDRESS:f,NAMESPACE_COMMON:l,NAMESPACE_KEYS:h,NAMESPACE_METADATA:d,NAMESPACE_PROTOCOL:p}=r(5922),{Addresses:y}=r(7448),{Protocols:g}=r(82299);e.exports=class extends u{constructor({peerId:e,datastore:t,threshold:r=5}){super({peerId:e}),this._datastore=t,this._dirtyPeers=new Set,this._dirtyMetadata=new Map,this.threshold=r,this._addDirtyPeer=this._addDirtyPeer.bind(this)}async start(){i("PeerStore is starting"),this.on("change:protocols",this._addDirtyPeer),this.on("change:multiaddrs",this._addDirtyPeer),this.on("change:pubkey",this._addDirtyPeerKey),this.on("change:metadata",this._addDirtyPeerMetadata);for await(const e of this._datastore.query({prefix:l}))await this._processDatastoreEntry(e);i("PeerStore started")}async stop(){i("PeerStore is stopping"),this.removeAllListeners(),await this._commitData(),i("PeerStore stopped")}_addDirtyPeer({peerId:e}){const t=e.toB58String();i("add dirty peer",t),this._dirtyPeers.add(t),this._dirtyPeers.size>=this.threshold&&this._commitData().catch((e=>{i.error("error committing data",e)}))}_addDirtyPeerKey({peerId:e}){if(e.hasInlinePublicKey())return;const t=e.toB58String();i("add dirty peer key",t),this._dirtyPeers.add(t),this._dirtyPeers.size>=this.threshold&&this._commitData().catch((e=>{i.error("error committing data",e)}))}_addDirtyPeerMetadata({peerId:e,metadata:t}){const r=e.toB58String();i("add dirty metadata peer",r),this._dirtyPeers.add(r);const n=this._dirtyMetadata.get(r)||new Set;n.add(t),this._dirtyMetadata.set(r,n),this._dirtyPeers.size>=this.threshold&&this._commitData().catch((e=>{i.error("error committing data",e)}))}async _commitData(){const e=Array.from(this._dirtyPeers);if(!e.length)return;this._dirtyPeers.clear(),i("create batch commit");const t=this._datastore.batch();for(const r of e){const e=this.keyBook.data.get(r)||a.createFromB58String(r);this._batchAddressBook(e,t),!e.hasInlinePublicKey()&&this._batchKeyBook(e,t),this._batchMetadataBook(e,t),this._batchProtoBook(e,t)}await t.commit(),i("batch committed")}_batchAddressBook(e,t){const r=e.toString(),n=new o(`${f}${r}`),s=this.addressBook.data.get(e.toB58String());try{if(!s)return void t.delete(n);const e=y.encode({addrs:s.addresses.map((e=>({multiaddr:e.multiaddr.bytes,isCertified:e.isCertified}))),certifiedRecord:s.record?{seq:s.record.seqNumber,raw:s.record.raw}:void 0}).finish();t.put(n,e)}catch(e){i.error(e)}}_batchKeyBook(e,t){const r=e.toString(),n=new o(`${h}${r}`);try{if(!e.pubKey)return void t.delete(n);const r=e.marshalPubKey();t.put(n,r)}catch(e){i.error(e)}}_batchMetadataBook(e,t){const r=e.toString(),n=this._dirtyMetadata.get(e.toB58String())||[];try{n.forEach((n=>{const i=new o(`${d}${r}/${n}`),s=this.metadataBook.getValue(e,n);s?t.put(i,s):t.delete(i)}))}catch(e){i.error(e)}}_batchProtoBook(e,t){const r=e.toString(),n=new o(`${p}${r}`),s=this.protoBook.get(e);try{if(!s)return void t.delete(n);const e=g.encode({protocols:s}).finish();t.put(n,e)}catch(e){i.error(e)}}async _processDatastoreEntry({key:e,value:t}){try{const r=e.toString().split("/"),n=a.createFromBytes(c.decode(r[3]));let o;switch(r[2]){case"addrs":o=y.decode(t),this.addressBook._setData(n,{addresses:o.addrs.map((e=>({multiaddr:new s(e.multiaddr),isCertified:Boolean(e.isCertified)}))),record:o.certifiedRecord?{raw:o.certifiedRecord.raw,seqNumber:o.certifiedRecord.seq}:void 0},{emit:!1});break;case"keys":o=await a.createFromPubKey(t),this.keyBook._setData(o,o,{emit:!1});break;case"metadata":this.metadataBook._setValue(n,r[4],t,{emit:!1});break;case"protos":o=g.decode(t),this.protoBook._setData(n,new Set(o.protocols),{emit:!1});break;default:i("invalid data persisted for: ",e.toString())}}catch(e){i.error(e)}}}},7448:(e,t,r)=>{"use strict";var n=r(62100),i=n.Reader,o=n.Writer,s=n.util,a=n.roots["libp2p-address-book"]||(n.roots["libp2p-address-book"]={});a.Addresses=function(){function e(e){if(this.addrs=[],e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.addrs&&n.addrs.length||(n.addrs=[]),n.addrs.push(a.Addresses.Address.decode(e,e.uint32()));break;case 2:n.certifiedRecord=a.Addresses.CertifiedRecord.decode(e,e.uint32());break;default:e.skipType(7&o)}}return n},e.fromObject=function(e){if(e instanceof a.Addresses)return e;var t=new a.Addresses;if(e.addrs){if(!Array.isArray(e.addrs))throw TypeError(".Addresses.addrs: array expected");t.addrs=[];for(var r=0;r>>3){case 1:n.multiaddr=e.bytes();break;case 2:n.isCertified=e.bool();break;default:e.skipType(7&o)}}return n},e.fromObject=function(e){if(e instanceof a.Addresses.Address)return e;var t=new a.Addresses.Address;return null!=e.multiaddr&&("string"==typeof e.multiaddr?s.base64.decode(e.multiaddr,t.multiaddr=s.newBuffer(s.base64.length(e.multiaddr)),0):e.multiaddr.length&&(t.multiaddr=e.multiaddr)),null!=e.isCertified&&(t.isCertified=Boolean(e.isCertified)),t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(t.bytes===String?r.multiaddr="":(r.multiaddr=[],t.bytes!==Array&&(r.multiaddr=s.newBuffer(r.multiaddr))),r.isCertified=!1),null!=e.multiaddr&&e.hasOwnProperty("multiaddr")&&(r.multiaddr=t.bytes===String?s.base64.encode(e.multiaddr,0,e.multiaddr.length):t.bytes===Array?Array.prototype.slice.call(e.multiaddr):e.multiaddr),null!=e.isCertified&&e.hasOwnProperty("isCertified")&&(r.isCertified=e.isCertified),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,n.util.toJSONOptions)},e}(),e.CertifiedRecord=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.seq=e.uint64();break;case 2:n.raw=e.bytes();break;default:e.skipType(7&o)}}return n},e.fromObject=function(e){if(e instanceof a.Addresses.CertifiedRecord)return e;var t=new a.Addresses.CertifiedRecord;return null!=e.seq&&(s.Long?(t.seq=s.Long.fromValue(e.seq)).unsigned=!0:"string"==typeof e.seq?t.seq=parseInt(e.seq,10):"number"==typeof e.seq?t.seq=e.seq:"object"==typeof e.seq&&(t.seq=new s.LongBits(e.seq.low>>>0,e.seq.high>>>0).toNumber(!0))),null!=e.raw&&("string"==typeof e.raw?s.base64.decode(e.raw,t.raw=s.newBuffer(s.base64.length(e.raw)),0):e.raw.length&&(t.raw=e.raw)),t},e.toObject=function(e,t){t||(t={});var r={};if(t.defaults){if(s.Long){var n=new s.Long(0,0,!0);r.seq=t.longs===String?n.toString():t.longs===Number?n.toNumber():n}else r.seq=t.longs===String?"0":0;t.bytes===String?r.raw="":(r.raw=[],t.bytes!==Array&&(r.raw=s.newBuffer(r.raw)))}return null!=e.seq&&e.hasOwnProperty("seq")&&("number"==typeof e.seq?r.seq=t.longs===String?String(e.seq):e.seq:r.seq=t.longs===String?s.Long.prototype.toString.call(e.seq):t.longs===Number?new s.LongBits(e.seq.low>>>0,e.seq.high>>>0).toNumber(!0):e.seq),null!=e.raw&&e.hasOwnProperty("raw")&&(r.raw=t.bytes===String?s.base64.encode(e.raw,0,e.raw.length):t.bytes===Array?Array.prototype.slice.call(e.raw):e.raw),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,n.util.toJSONOptions)},e}(),e}(),e.exports=a},82299:(e,t,r)=>{"use strict";var n=r(62100),i=n.Reader,o=n.Writer,s=n.util,a=n.roots["libp2p-proto-book"]||(n.roots["libp2p-proto-book"]={});a.Protocols=function(){function e(e){if(this.protocols=[],e)for(var t=Object.keys(e),r=0;r>>3==1?(n.protocols&&n.protocols.length||(n.protocols=[]),n.protocols.push(e.string())):e.skipType(7&o)}return n},e.fromObject=function(e){if(e instanceof a.Protocols)return e;var t=new a.Protocols;if(e.protocols){if(!Array.isArray(e.protocols))throw TypeError(".Protocols.protocols: array expected");t.protocols=[];for(var r=0;r{"use strict";const n=r(11227),i=Object.assign(n("libp2p:peer-store:proto-book"),{error:n("libp2p:peer-store:proto-book:err")}),o=r(32114),s=r(88785),a=r(94903),{codes:{ERR_INVALID_PARAMETERS:c}}=r(23416);e.exports=class extends a{constructor(e){super({peerStore:e,eventName:"change:protocols",eventProperty:"protocols",eventTransformer:e=>Array.from(e)}),this.data=new Map}set(e,t){if(!s.isPeerId(e))throw i.error("peerId must be an instance of peer-id to store data"),o(new Error("peerId must be an instance of peer-id"),c);if(!t)throw i.error("protocols must be provided to store data"),o(new Error("protocols must be provided"),c);const r=e.toB58String(),n=this.data.get(r),a=new Set(t);return n&&(f=a,(u=n).size===f.size&&[...u].every((e=>f.has(e))))?(i(`the protocols provided to store are equal to the already stored for ${r}`),this):(this._setData(e,a),i(`stored provided protocols for ${r}`),this);var u,f}add(e,t){if(!s.isPeerId(e))throw i.error("peerId must be an instance of peer-id to store data"),o(new Error("peerId must be an instance of peer-id"),c);if(!t)throw i.error("protocols must be provided to store data"),o(new Error("protocols must be provided"),c);const r=e.toB58String(),n=this.data.get(r)||new Set,a=new Set([...n,...t]);return n.size===a.size?(i(`the protocols provided to store are already stored for ${r}`),this):(this._setData(e,a),i(`added provided protocols for ${r}`),this)}remove(e,t){if(!s.isPeerId(e))throw i.error("peerId must be an instance of peer-id to store data"),o(new Error("peerId must be an instance of peer-id"),c);if(!t)throw i.error("protocols must be provided to store data"),o(new Error("protocols must be provided"),c);const r=e.toB58String(),n=this.data.get(r);if(n){const o=new Set([...n].filter((e=>!t.includes(e))));if(n.size===o.size)return this;this._setData(e,o),i(`removed provided protocols for ${r}`)}return this}}},77667:e=>{"use strict";e.exports={PROTOCOL:"/ipfs/ping/1.0.0",PING_LENGTH:32,PROTOCOL_VERSION:"1.0.0",PROTOCOL_NAME:"ping"}},75466:(e,t,r)=>{"use strict";const n=r(11227),i=Object.assign(n("libp2p:ping"),{error:n("libp2p:ping:err")}),o=r(32114),s=r(49928),{pipe:a}=r(60618),{toBuffer:c}=r(96653),{collect:u,take:f}=r(38386),{equals:l}=r(19588),{PROTOCOL_NAME:h,PING_LENGTH:d,PROTOCOL_VERSION:p}=r(77667);(t=e.exports=async function(e,t){const r=`/${e._config.protocolPrefix}/${h}/${p}`;i("dialing %s to %s",r,t.toB58String?t.toB58String():t);const n=await e.dial(t),{stream:y}=await n.newStream(r),g=Date.now(),b=s.randomBytes(d),[m]=await a([b],y,(e=>f(1,e)),c,u),v=Date.now();if(!l(b,m))throw o(new Error("Received wrong ping ack"),"ERR_WRONG_PING_ACK");return v-g}).mount=function(e){e.handle(`/${e._config.protocolPrefix}/${h}/${p}`,(({stream:e})=>a(e,e)))},t.unmount=function(e){e.unhandle(`/${e._config.protocolPrefix}/${h}/${p}`)}},65993:e=>{"use strict";e.exports=function(e,t,r){const n=new e(t,r);return n._subscribeAdapter=n.subscribe,n._unsubscribeAdapter=n.unsubscribe,n.subscribe=function(e,t){t&&n.on(e,t),n._subscribeAdapter(e)},n.unsubscribe=function(e,t){t?n.removeListener(e,t):n.removeAllListeners(e),0===n.listenerCount(e)&&n._unsubscribeAdapter(e)},n}},60709:(e,t,r)=>{"use strict";var n=r(62100),i=n.Reader,o=n.Writer,s=n.util,a=n.roots["libp2p-envelope"]||(n.roots["libp2p-envelope"]={});a.Envelope=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.publicKey=e.bytes();break;case 2:n.payloadType=e.bytes();break;case 3:n.payload=e.bytes();break;case 5:n.signature=e.bytes();break;default:e.skipType(7&o)}}return n},e.fromObject=function(e){if(e instanceof a.Envelope)return e;var t=new a.Envelope;return null!=e.publicKey&&("string"==typeof e.publicKey?s.base64.decode(e.publicKey,t.publicKey=s.newBuffer(s.base64.length(e.publicKey)),0):e.publicKey.length&&(t.publicKey=e.publicKey)),null!=e.payloadType&&("string"==typeof e.payloadType?s.base64.decode(e.payloadType,t.payloadType=s.newBuffer(s.base64.length(e.payloadType)),0):e.payloadType.length&&(t.payloadType=e.payloadType)),null!=e.payload&&("string"==typeof e.payload?s.base64.decode(e.payload,t.payload=s.newBuffer(s.base64.length(e.payload)),0):e.payload.length&&(t.payload=e.payload)),null!=e.signature&&("string"==typeof e.signature?s.base64.decode(e.signature,t.signature=s.newBuffer(s.base64.length(e.signature)),0):e.signature.length&&(t.signature=e.signature)),t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(t.bytes===String?r.publicKey="":(r.publicKey=[],t.bytes!==Array&&(r.publicKey=s.newBuffer(r.publicKey))),t.bytes===String?r.payloadType="":(r.payloadType=[],t.bytes!==Array&&(r.payloadType=s.newBuffer(r.payloadType))),t.bytes===String?r.payload="":(r.payload=[],t.bytes!==Array&&(r.payload=s.newBuffer(r.payload))),t.bytes===String?r.signature="":(r.signature=[],t.bytes!==Array&&(r.signature=s.newBuffer(r.signature)))),null!=e.publicKey&&e.hasOwnProperty("publicKey")&&(r.publicKey=t.bytes===String?s.base64.encode(e.publicKey,0,e.publicKey.length):t.bytes===Array?Array.prototype.slice.call(e.publicKey):e.publicKey),null!=e.payloadType&&e.hasOwnProperty("payloadType")&&(r.payloadType=t.bytes===String?s.base64.encode(e.payloadType,0,e.payloadType.length):t.bytes===Array?Array.prototype.slice.call(e.payloadType):e.payloadType),null!=e.payload&&e.hasOwnProperty("payload")&&(r.payload=t.bytes===String?s.base64.encode(e.payload,0,e.payload.length):t.bytes===Array?Array.prototype.slice.call(e.payload):e.payload),null!=e.signature&&e.hasOwnProperty("signature")&&(r.signature=t.bytes===String?s.base64.encode(e.signature,0,e.signature.length):t.bytes===Array?Array.prototype.slice.call(e.signature):e.signature),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,n.util.toJSONOptions)},e}(),e.exports=a},31244:(e,t,r)=>{"use strict";const n=r(32114),{concat:i}=r(20605),{fromString:o}=r(52217),s=r(92826),a=r(88785),c=r(31997),{equals:u}=r(19588),{codes:f}=r(23416),{Envelope:l}=r(60709);class h{constructor({peerId:e,payloadType:t,payload:r,signature:n}){this.peerId=e,this.payloadType=t,this.payload=r,this.signature=n,this._marshal=void 0}marshal(){if(this._marshal)return this._marshal;const e=s.marshalPublicKey(this.peerId.pubKey);return this._marshal=l.encode({publicKey:e,payloadType:this.payloadType,payload:this.payload,signature:this.signature}).finish(),this._marshal}equals(e){return u(this.peerId.pubKey.bytes,e.peerId.pubKey.bytes)&&u(this.payloadType,e.payloadType)&&u(this.payload,e.payload)&&u(this.signature,e.signature)}validate(e){const t=d(e,this.payloadType,this.payload);return this.peerId.pubKey.verify(t,this.signature)}}const d=(e,t,r)=>{const n=o(e),s=c.encode(n.byteLength),a=c.encode(t.length),u=c.encode(r.length);return i([new Uint8Array(s),n,new Uint8Array(a),t,new Uint8Array(u),r])};h.createFromProtobuf=async e=>{const t=l.decode(e),r=await a.createFromPubKey(t.publicKey);return new h({peerId:r,payloadType:t.payloadType,payload:t.payload,signature:t.signature})},h.seal=async(e,t)=>{const r=e.domain,n=e.codec,i=e.marshal(),o=d(r,n,i),s=await t.privKey.sign(o);return new h({peerId:t,payloadType:n,payload:i,signature:s})},h.openAndCertify=async(e,t)=>{const r=await h.createFromProtobuf(e);if(!await r.validate(t))throw n(new Error("envelope signature is not valid for the given domain"),f.ERR_SIGNATURE_NOT_VALID);return r},e.exports=h},77854:e=>{"use strict";const t=Uint8Array.from([3,1]);e.exports={ENVELOPE_DOMAIN_PEER_RECORD:"libp2p-peer-record",ENVELOPE_PAYLOAD_TYPE_PEER_RECORD:t}},61131:(e,t,r)=>{"use strict";const{Multiaddr:n}=r(46584),i=r(88785),o=r(52942),{PeerRecord:s}=r(81183),{ENVELOPE_DOMAIN_PEER_RECORD:a,ENVELOPE_PAYLOAD_TYPE_PEER_RECORD:c}=r(77854);class u{constructor({peerId:e,multiaddrs:t=[],seqNumber:r=Date.now()}){this.domain=a,this.codec=c,this.peerId=e,this.multiaddrs=t,this.seqNumber=r,this._marshal=void 0}marshal(){return this._marshal||(this._marshal=s.encode({peerId:this.peerId.toBytes(),seq:this.seqNumber,addresses:this.multiaddrs.map((e=>({multiaddr:e.bytes})))}).finish()),this._marshal}equals(e){return e instanceof u&&!!this.peerId.equals(e.peerId)&&this.seqNumber===e.seqNumber&&!!o(this.multiaddrs,e.multiaddrs)}}u.createFromProtobuf=e=>{const t=s.decode(e),r=i.createFromBytes(t.peerId),o=(t.addresses||[]).map((e=>new n(e.multiaddr))),a=Number(t.seq);return new u({peerId:r,multiaddrs:o,seqNumber:a})},u.DOMAIN=a,e.exports=u},81183:(e,t,r)=>{"use strict";var n=r(62100),i=n.Reader,o=n.Writer,s=n.util,a=n.roots["libp2p-peer-record"]||(n.roots["libp2p-peer-record"]={});a.PeerRecord=function(){function e(e){if(this.addresses=[],e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.peerId=e.bytes();break;case 2:n.seq=e.uint64();break;case 3:n.addresses&&n.addresses.length||(n.addresses=[]),n.addresses.push(a.PeerRecord.AddressInfo.decode(e,e.uint32()));break;default:e.skipType(7&o)}}return n},e.fromObject=function(e){if(e instanceof a.PeerRecord)return e;var t=new a.PeerRecord;if(null!=e.peerId&&("string"==typeof e.peerId?s.base64.decode(e.peerId,t.peerId=s.newBuffer(s.base64.length(e.peerId)),0):e.peerId.length&&(t.peerId=e.peerId)),null!=e.seq&&(s.Long?(t.seq=s.Long.fromValue(e.seq)).unsigned=!0:"string"==typeof e.seq?t.seq=parseInt(e.seq,10):"number"==typeof e.seq?t.seq=e.seq:"object"==typeof e.seq&&(t.seq=new s.LongBits(e.seq.low>>>0,e.seq.high>>>0).toNumber(!0))),e.addresses){if(!Array.isArray(e.addresses))throw TypeError(".PeerRecord.addresses: array expected");t.addresses=[];for(var r=0;r>>0,e.seq.high>>>0).toNumber(!0):e.seq),e.addresses&&e.addresses.length){r.addresses=[];for(var i=0;i>>3==1?n.multiaddr=e.bytes():e.skipType(7&o)}return n},e.fromObject=function(e){if(e instanceof a.PeerRecord.AddressInfo)return e;var t=new a.PeerRecord.AddressInfo;return null!=e.multiaddr&&("string"==typeof e.multiaddr?s.base64.decode(e.multiaddr,t.multiaddr=s.newBuffer(s.base64.length(e.multiaddr)),0):e.multiaddr.length&&(t.multiaddr=e.multiaddr)),t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(t.bytes===String?r.multiaddr="":(r.multiaddr=[],t.bytes!==Array&&(r.multiaddr=s.newBuffer(r.multiaddr)))),null!=e.multiaddr&&e.hasOwnProperty("multiaddr")&&(r.multiaddr=t.bytes===String?s.base64.encode(e.multiaddr,0,e.multiaddr.length):t.bytes===Array?Array.prototype.slice.call(e.multiaddr):e.multiaddr),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,n.util.toJSONOptions)},e}(),e}(),e.exports=a},1001:(e,t,r)=>{"use strict";const n=r(31244),i=r(61131);e.exports.updateSelfPeerRecord=async function(e){const t=new i({peerId:e.peerId,multiaddrs:e.multiaddrs}),r=await n.seal(t,e.peerId);e.peerStore.addressBook.consumePeerRecord(r)}},28861:(e,t,r)=>{"use strict";const n=r(11227),i=Object.assign(n("libp2p:registrar"),{error:n("libp2p:registrar:err")}),o=r(32114),{codes:{ERR_INVALID_PARAMETERS:s}}=r(23416),a=r(7609);e.exports=class{constructor({peerStore:e,connectionManager:t}){this.peerStore=e,this.connectionManager=t,this.topologies=new Map,this._handle=void 0,this._onDisconnect=this._onDisconnect.bind(this),this.connectionManager.on("peer:disconnect",this._onDisconnect)}get handle(){return this._handle}set handle(e){this._handle=e}getConnection(e){return this.connectionManager.get(e)}register(e){if(!a.isTopology(e))throw i.error("topology must be an instance of interfaces/topology"),o(new Error("topology must be an instance of interfaces/topology"),s);const t=(1e9*Math.random()).toString(36)+Date.now();return this.topologies.set(t,e),e.registrar=this,t}unregister(e){return this.topologies.delete(e)}_onDisconnect(e){for(const[,t]of this.topologies)t.disconnect(e.remotePeer)}}},6984:(e,t,r)=>{"use strict";const n=r(11227),i=Object.assign(n("libp2p:transports"),{error:n("libp2p:transports:err")}),o=r(13296),{codes:s}=r(23416),a=r(32114),{updateSelfPeerRecord:c}=r(1001);class u{constructor({libp2p:e,upgrader:t,faultTolerance:r=f.FATAL_ALL}){this.libp2p=e,this.upgrader=t,this._transports=new Map,this._listeners=new Map,this._listenerOptions=new Map,this.faultTolerance=r}add(e,t,r={}){if(i("adding %s",e),!e)throw a(new Error(`Transport must have a valid key, was given '${e}'`),s.ERR_INVALID_KEY);if(this._transports.has(e))throw a(new Error("There is already a transport with this key"),s.ERR_DUPLICATE_TRANSPORT);const n=new t({...r,libp2p:this.libp2p,upgrader:this.upgrader});this._transports.set(e,n),this._listenerOptions.set(e,r.listenerOptions||{}),this._listeners.has(e)||this._listeners.set(e,[])}async close(){const e=[];for(const[t,r]of this._listeners)for(i("closing listeners for %s",t);r.length;){const t=r.pop();t.removeAllListeners("listening"),t.removeAllListeners("close"),e.push(t.close())}await Promise.all(e),i("all listeners closed");for(const e of this._listeners.keys())this._listeners.set(e,[])}async dial(e,t){const r=this.transportForMultiaddr(e);if(!r)throw a(new Error(`No transport available for address ${String(e)}`),s.ERR_TRANSPORT_UNAVAILABLE);try{return await r.dial(e,t)}catch(e){throw e.code||(e.code=s.ERR_TRANSPORT_DIAL_FAILED),e}}getAddrs(){let e=[];for(const t of this._listeners.values())for(const r of t)e=[...e,...r.getAddrs()];return e}getTransports(){return this._transports.values()}transportForMultiaddr(e){for(const t of this._transports.values())if(t.filter([e]).length)return t;return null}async listen(e){if(!e||0===e.length)return void i("no addresses were provided for listening, this node is dial only");const t=[];for(const[r,n]of this._transports.entries()){const u=n.filter(e),l=[];for(const e of u){i("creating listener for %s on %s",r,e);const t=n.createListener(this._listenerOptions.get(r));this._listeners.get(r).push(t),t.on("listening",(()=>c(this.libp2p))),t.on("close",(()=>c(this.libp2p))),l.push(t.listen(e))}if(0!==l.length){if(!(await o(l)).find((e=>!0===e.isFulfilled))&&this.faultTolerance!==f.NO_FATAL)throw a(new Error(`Transport (${r}) could not listen on any available address`),s.ERR_NO_VALID_ADDRESSES)}else t.push(r)}if(t.length===this._transports.size){const e=`no valid addresses were provided for transports [${t}]`;if(this.faultTolerance===f.FATAL_ALL)throw a(new Error(e),s.ERR_NO_VALID_ADDRESSES);i(`libp2p in dial mode only: ${e}`)}}async remove(e){if(i("removing %s",e),this._listeners.has(e))for(const t of this._listeners.get(e))t.removeAllListeners("listening"),t.removeAllListeners("close"),await t.close();this._transports.delete(e),this._listeners.delete(e)}async removeAll(){const e=[];for(const t of this._transports.keys())e.push(this.remove(t));await Promise.all(e)}}const f={FATAL_ALL:0,NO_FATAL:1};u.FaultTolerance=f,e.exports=u},21003:(e,t,r)=>{"use strict";const n=r(11227),i=Object.assign(n("libp2p:upgrader"),{error:n("libp2p:upgrader:err")}),o=r(32114),s=r(8738),{Connection:a}=r(15458),c=r(88785),{pipe:u}=r(60618),f=r(99633),{codes:l}=r(23416);e.exports=class{constructor({localPeer:e,metrics:t,cryptos:r=new Map,muxers:n=new Map,onConnectionEnd:i=(()=>{}),onConnection:o=(()=>{})}){this.localPeer=e,this.metrics=t,this.cryptos=r,this.muxers=n,this.protector=null,this.protocols=new Map,this.onConnection=o,this.onConnectionEnd=i}async upgradeInbound(e){let t,r,n,o,s,a,c;if(this.metrics){({setTarget:a,proxy:c}=f());const t=(1e9*Math.random()).toString(36)+Date.now();a({toB58String:()=>t}),e=this.metrics.trackStream({stream:e,remotePeer:c})}i("Starting the inbound connection upgrade");let u=e;this.protector&&(u=await this.protector.protect(e));try{({conn:t,remotePeer:r,protocol:s}=await this._encryptInbound(this.localPeer,u,this.cryptos)),this.muxers.size?({stream:n,Muxer:o}=await this._multiplexInbound(t,this.muxers)):n=t}catch(t){throw i.error("Failed to upgrade inbound connection",t),await e.close(t),t}return this.metrics&&(this.metrics.updatePlaceholder(c,r),a(r)),i("Successfully upgraded inbound connection"),this._createConnection({cryptoProtocol:s,direction:"inbound",maConn:e,upgradedConn:n,Muxer:o,remotePeer:r})}async upgradeOutbound(e){const t=e.remoteAddr.getPeerId();if(!t)throw o(new Error("outbound connection must have a peer id"),l.ERR_INVALID_MULTIADDR);const r=c.createFromB58String(t);let n,s,a,u,h,d,p;if(this.metrics){({setTarget:d,proxy:p}=f());const t=(1e9*Math.random()).toString(36)+Date.now();d({toB58String:()=>t}),e=this.metrics.trackStream({stream:e,remotePeer:p})}i("Starting the outbound connection upgrade");let y=e;this.protector&&(y=await this.protector.protect(e));try{({conn:n,remotePeer:s,protocol:u}=await this._encryptOutbound(this.localPeer,y,r,this.cryptos)),this.muxers.size?({stream:a,Muxer:h}=await this._multiplexOutbound(n,this.muxers)):a=n}catch(t){throw i.error("Failed to upgrade outbound connection",t),await e.close(t),t}return this.metrics&&(this.metrics.updatePlaceholder(p,s),d(s)),i("Successfully upgraded outbound connection"),this._createConnection({cryptoProtocol:u,direction:"outbound",maConn:e,upgradedConn:a,Muxer:h,remotePeer:s})}_createConnection({cryptoProtocol:e,direction:t,maConn:r,upgradedConn:n,Muxer:c,remotePeer:f}){let h,d,p;c&&(h=new c({onStream:async e=>{if(!p)return;const r=new s.Listener(e);try{const{stream:n,protocol:o}=await r.handle(Array.from(this.protocols.keys()));i("%s: incoming stream opened on %s",t,o),this.metrics&&this.metrics.trackStream({stream:n,remotePeer:f,protocol:o}),p.addStream(e,{protocol:o}),this._onStream({connection:p,stream:{...e,...n},protocol:o})}catch(e){i.error(e)}},onStreamEnd:e=>{p.removeStream(e.id)}}),d=async e=>{i("%s: starting new stream on %s",t,e);const r=h.newStream(),n=new s.Dialer(r);try{const{stream:t,protocol:i}=await n.select(e);return this.metrics&&this.metrics.trackStream({stream:t,remotePeer:f,protocol:i}),{stream:{...r,...t},protocol:i}}catch(e){throw i.error("could not create new stream",e),o(e,l.ERR_UNSUPPORTED_PROTOCOL)}},u(n,h,n).catch(i.error));const y=r.timeline;r.timeline=new Proxy(y,{set:(...e)=>(p&&"close"===e[1]&&e[2]&&!y.close&&(async()=>{try{"open"===p.stat.status&&await p.close()}catch(e){i.error(e)}finally{this.onConnectionEnd(p)}})(),Reflect.set(...e))}),r.timeline.upgraded=Date.now();const g=()=>{throw o(new Error("connection is not multiplexed"),"ERR_CONNECTION_NOT_MULTIPLEXED")};return p=new a({localAddr:r.localAddr,remoteAddr:r.remoteAddr,localPeer:this.localPeer,remotePeer:f,stat:{direction:t,timeline:r.timeline,multiplexer:c&&c.multicodec,encryption:e},newStream:d||g,getStreams:()=>h?h.streams:g(),close:async()=>{await r.close(),h&&h.streams.map((e=>e.abort()))}}),this.onConnection(p),p}_onStream({connection:e,stream:t,protocol:r}){this.protocols.get(r)({connection:e,stream:t,protocol:r})}async _encryptInbound(e,t,r){const n=new s.Listener(t),a=Array.from(r.keys());i("handling inbound crypto protocol selection",a);try{const{stream:t,protocol:o}=await n.handle(a),s=r.get(o);if(i("encrypting inbound connection..."),!s)throw new Error(`no crypto module found for ${o}`);return{...await s.secureInbound(e,t),protocol:o}}catch(e){throw o(e,l.ERR_ENCRYPTION_FAILED)}}async _encryptOutbound(e,t,r,n){const a=new s.Dialer(t),c=Array.from(n.keys());i("selecting outbound crypto protocol",c);try{const{stream:t,protocol:o}=await a.select(c),s=n.get(o);if(i("encrypting outbound connection to %j",r),!s)throw new Error(`no crypto module found for ${o}`);return{...await s.secureOutbound(e,t,r),protocol:o}}catch(e){throw o(e,l.ERR_ENCRYPTION_FAILED)}}async _multiplexOutbound(e,t){const r=new s.Dialer(e),n=Array.from(t.keys());i("outbound selecting muxer %s",n);try{const{stream:e,protocol:o}=await r.select(n);return i("%s selected as muxer protocol",o),{stream:e,Muxer:t.get(o)}}catch(e){throw o(e,l.ERR_MUXER_UNAVAILABLE)}}async _multiplexInbound(e,t){const r=new s.Listener(e),n=Array.from(t.keys());i("inbound handling muxers %s",n);try{const{stream:e,protocol:i}=await r.handle(n);return{stream:e,Muxer:t.get(i)}}catch(e){throw o(e,l.ERR_MUXER_UNAVAILABLE)}}}},2043:function(e,t,r){var n,i;!function(o,s){"use strict";n=function(){var e=function(){},t="undefined",r=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),n=["trace","debug","info","warn","error"];function i(e,t){var r=e[t];if("function"==typeof r.bind)return r.bind(e);try{return Function.prototype.bind.call(r,e)}catch(t){return function(){return Function.prototype.apply.apply(r,[e,arguments])}}}function o(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function s(n){return"debug"===n&&(n="log"),typeof console!==t&&("trace"===n&&r?o:void 0!==console[n]?i(console,n):void 0!==console.log?i(console,"log"):e)}function a(t,r){for(var i=0;i=0&&r<=s.levels.SILENT))throw"log.setLevel() called with invalid level: "+r;if(o=r,!1!==i&&function(e){var r=(n[e]||"silent").toUpperCase();if(typeof window!==t&&c){try{return void(window.localStorage[c]=r)}catch(e){}try{window.document.cookie=encodeURIComponent(c)+"="+r+";"}catch(e){}}}(r),a.call(s,r,e),typeof console===t&&r{"use strict";const{Multiaddr:n}=r(46584),i=k("dns4"),o=k("dns6"),s=k("dnsaddr"),a=R(k("dns"),s,i,o),c=R(k("ip4"),k("ip6")),u=R(P(c,k("tcp")),P(a,k("tcp"))),f=P(c,k("udp")),l=P(f,k("utp")),h=P(f,k("quic")),d=R(P(u,k("ws")),P(a,k("ws"))),p=R(P(u,k("wss")),P(a,k("wss"))),y=R(P(u,k("http")),P(c,k("http")),P(a,k("http"))),g=R(P(u,k("https")),P(c,k("https")),P(a,k("https"))),b=R(P(d,k("p2p-webrtc-star"),k("p2p")),P(p,k("p2p-webrtc-star"),k("p2p")),P(d,k("p2p-webrtc-star")),P(p,k("p2p-webrtc-star"))),m=R(P(d,k("p2p-websocket-star"),k("p2p")),P(p,k("p2p-websocket-star"),k("p2p")),P(d,k("p2p-websocket-star")),P(p,k("p2p-websocket-star"))),v=R(P(y,k("p2p-webrtc-direct"),k("p2p")),P(g,k("p2p-webrtc-direct"),k("p2p")),P(y,k("p2p-webrtc-direct")),P(g,k("p2p-webrtc-direct"))),w=R(d,p,y,g,b,v,u,l,h,a),E=R(P(w,k("p2p-stardust"),k("p2p")),P(w,k("p2p-stardust"))),_=R(P(w,k("p2p")),b,v,k("p2p")),S=R(P(_,k("p2p-circuit"),_),P(_,k("p2p-circuit")),P(k("p2p-circuit"),_),P(w,k("p2p-circuit")),P(k("p2p-circuit"),w),k("p2p-circuit")),A=()=>R(P(S,A),S),T=A(),I=R(P(T,_,T),P(_,T),P(T,_),T,_);function C(e){return function(t){if(!n.isMultiaddr(t))try{t=new n(t)}catch(e){return!1}const r=e(t.protoNames());return null!==r&&(!0===r||!1===r?r:0===r.length)}}function P(...e){function t(t){if(t.length(r="function"==typeof e?e().partialMatch(t):e.partialMatch(t),Array.isArray(r)&&(t=r),null===r))),r}return{toString:function(){return"{ "+e.join(" ")+" }"},input:e,matches:C(t),partialMatch:t}}function R(...e){function t(t){let r=null;return e.some((e=>{const n="function"==typeof e?e().partialMatch(t):e.partialMatch(t);return!!n&&(r=n,!0)})),r}return{toString:function(){return"{ "+e.join(" ")+" }"},input:e,matches:C(t),partialMatch:t}}function k(e){const t=e;return{toString:function(){return t},matches:function(e){let r;if("string"==typeof e||e instanceof Uint8Array)try{r=new n(e)}catch(e){return!1}else r=e;const i=r.protoNames();return 1===i.length&&i[0]===t},partialMatch:function(e){return 0===e.length?null:e[0]===t?e.slice(1):null}}}e.exports={DNS:a,DNS4:i,DNS6:o,DNSADDR:s,IP:c,TCP:u,UDP:f,QUIC:h,UTP:l,HTTP:y,HTTPS:g,WebSockets:d,WebSocketsSecure:p,WebSocketStar:m,WebRTCStar:b,WebRTCDirect:v,Reliable:w,Stardust:E,Circuit:T,P2P:I,IPFS:I}},70942:function(e,t,r){"use strict";const n=r(33310),{hasOwnProperty:i}=Object.prototype,{propertyIsEnumerable:o}=Object,s=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0}),a=this,c={concatArrays:!1,ignoreUndefined:!1},u=e=>{const t=[];for(const r in e)i.call(e,r)&&t.push(r);if(Object.getOwnPropertySymbols){const r=Object.getOwnPropertySymbols(e);for(const n of r)o.call(e,n)&&t.push(n)}return t};function f(e){return Array.isArray(e)?function(e){const t=e.slice(0,0);return u(e).forEach((r=>{s(t,r,f(e[r]))})),t}(e):n(e)?function(e){const t=null===Object.getPrototypeOf(e)?Object.create(null):{};return u(e).forEach((r=>{s(t,r,f(e[r]))})),t}(e):e}const l=(e,t,r,n)=>(r.forEach((r=>{void 0===t[r]&&n.ignoreUndefined||(r in e&&e[r]!==Object.getPrototypeOf(e)?s(e,r,h(e[r],t[r],n)):s(e,r,f(t[r])))})),e);function h(e,t,r){return r.concatArrays&&Array.isArray(e)&&Array.isArray(t)?((e,t,r)=>{let n=e.slice(0,0),o=0;return[e,t].forEach((t=>{const a=[];for(let r=0;r!a.includes(e))),r)})),n})(e,t,r):n(t)&&n(e)?l(e,t,u(t),r):f(t)}e.exports=function(...e){const t=h(f(c),this!==a&&this||{},c);let r={_:{}};for(const i of e)if(void 0!==i){if(!n(i))throw new TypeError("`"+i+"` is not an Option Object");r=h(r,{_:i},t)}return r._}},79746:e=>{function t(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=t,t.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)}},34504:(e,t)=>{"use strict";var r=t;function n(e){return 1===e.length?"0"+e:e}function i(e){for(var t="",r=0;r>8,s=255&i;o?r.push(o,s):r.push(s)}return r},r.zero2=n,r.toHex=i,r.encode=function(e,t){return"hex"===t?i(e):e}},57824:e=>{var t=1e3,r=60*t,n=60*r,i=24*n;function o(e,t,r,n){var i=t>=1.5*r;return Math.round(e/r)+" "+n+(i?"s":"")}e.exports=function(e,s){s=s||{};var a,c,u=typeof e;if("string"===u&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var o=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(o){var s=parseFloat(o[1]);switch((o[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*s;case"weeks":case"week":case"w":return 6048e5*s;case"days":case"day":case"d":return s*i;case"hours":case"hour":case"hrs":case"hr":case"h":return s*n;case"minutes":case"minute":case"mins":case"min":case"m":return s*r;case"seconds":case"second":case"secs":case"sec":case"s":return s*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s;default:return}}}}(e);if("number"===u&&isFinite(e))return s.long?(a=e,(c=Math.abs(a))>=i?o(a,c,i,"day"):c>=n?o(a,c,n,"hour"):c>=r?o(a,c,r,"minute"):c>=t?o(a,c,t,"second"):a+" ms"):function(e){var o=Math.abs(e);return o>=i?Math.round(e/i)+"d":o>=n?Math.round(e/n)+"h":o>=r?Math.round(e/r)+"m":o>=t?Math.round(e/t)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},15602:e=>{e.exports=function e(t,r){var n,i=0,o=0,s=r=r||0,a=t.length;do{if(s>=a||o>49)throw e.bytes=0,new RangeError("Could not decode varint");n=t[s++],i+=o<28?(127&n)<=128);return e.bytes=s-r,i}},62137:e=>{e.exports=function e(r,n,i){if(Number.MAX_SAFE_INTEGER&&r>Number.MAX_SAFE_INTEGER)throw e.bytes=0,new RangeError("Could not encode varint");n=n||[];for(var o=i=i||0;r>=t;)n[i++]=255&r|128,r/=128;for(;-128&r;)n[i++]=255&r|128,r>>>=7;return n[i]=0|r,e.bytes=i-o+1,n};var t=Math.pow(2,31)},57328:(e,t,r)=>{e.exports={encode:r(62137),decode:r(15602),encodingLength:r(27766)}},27766:e=>{var t=Math.pow(2,7),r=Math.pow(2,14),n=Math.pow(2,21),i=Math.pow(2,28),o=Math.pow(2,35),s=Math.pow(2,42),a=Math.pow(2,49),c=Math.pow(2,56),u=Math.pow(2,63);e.exports=function(e){return e{"use strict";const n=r(99918),i=r(89768),o=r(57328),{concat:s}=r(20605),{toString:a}=r(92263);function c(e){const t=[],r=e.split("/").slice(1);if(1===r.length&&""===r[0])return[];for(let n=0;n=r.length)throw v("invalid address: "+e);if(s.path){t.push([o,m(r.slice(n).join("/"))]);break}t.push([o,r[n]])}else t.push([o])}return t}function u(e){const t=[];return e.map((e=>{const r=w(e);return t.push(r.name),e.length>1&&t.push(e[1]),null})),m(t.join("/"))}function f(e){return e.map((e=>{Array.isArray(e)||(e=[e]);const t=w(e);return e.length>1?[t.code,n.toBytes(t.code,e[1])]:[t.code]}))}function l(e){return e.map((e=>{const t=w(e);return e[1]?[t.code,n.toString(t.code,e[1])]:[t.code]}))}function h(e){return g(s(e.map((e=>{const t=w(e);let r=Uint8Array.from(o.encode(t.code));return e.length>1&&(r=s([r,e[1]])),r}))))}function d(e,t){return e.size>0?e.size/8:0===e.size?0:o.decode(t)+o.decode.bytes}function p(e){const t=[];let r=0;for(;re.length)throw v("Invalid address Uint8Array: "+a(e,"base16"));t.push([n,u])}return t}function y(e){return h(f(c(e=m(e))))}function g(e){const t=b(e);if(t)throw t;return Uint8Array.from(e)}function b(e){try{p(e)}catch(e){return e}}function m(e){return"/"+e.trim().split("/").filter((e=>e)).join("/")}function v(e){return new Error("Error parsing address: "+e)}function w(e){return i(e[0])}e.exports={stringToStringTuples:c,stringTuplesToString:u,tuplesToStringTuples:l,stringTuplesToTuples:f,bytesToTuples:p,tuplesToBytes:h,bytesToString:function(e){return u(l(p(e)))},stringToBytes:y,fromString:function(e){return y(e)},fromBytes:g,validateBytes:b,isValidBytes:function(e){return void 0===b(e)},cleanPath:m,ParseError:v,protoFromTuple:w,sizeForAddr:d}},99918:(e,t,r)=>{"use strict";const n=r(33692),i=r(89768),{CID:o}=r(81362),{base32:s}=r(22817),{base58btc:a}=r(99086),c=r(28924),u=r(57328),{toString:f}=r(92263),{fromString:l}=r(52217),{concat:h}=r(20605);function d(e,t){return t instanceof Uint8Array?d.toString(e,t):d.toBytes(e,t)}function p(e){const t=new ArrayBuffer(2);return new DataView(t).setUint16(0,e),new Uint8Array(t)}function y(e){return new DataView(e.buffer).getUint16(e.byteOffset)}e.exports=d,d.toString=function(e,t){switch(i(e).code){case 4:case 41:return function(e){const t=n.toString(e);if(!t||!n.isIP(t))throw new Error("invalid ip address");return t}(t);case 6:case 273:case 33:case 132:return y(t).toString();case 53:case 54:case 55:case 56:case 400:case 777:return function(e){const t=u.decode(e);if((e=e.slice(u.decode.bytes)).length!==t)throw new Error("inconsistent lengths");return f(e)}(t);case 421:return function(e){const t=u.decode(e),r=e.slice(u.decode.bytes);if(r.length!==t)throw new Error("inconsistent lengths");return f(r,"base58btc")}(t);case 444:case 445:return function(e){const t=e.slice(0,e.length-2),r=e.slice(e.length-2);return f(t,"base32")+":"+y(r)}(t);default:return f(t,"base16")}},d.toBytes=function(e,t){switch(i(e).code){case 4:case 41:return function(e){if(!n.isIP(e))throw new Error("invalid ip address");return n.toBytes(e)}(t);case 6:case 273:case 33:case 132:return p(parseInt(t,10));case 53:case 54:case 55:case 56:case 400:case 777:return function(e){const t=l(e),r=Uint8Array.from(u.encode(t.length));return h([r,t],r.length+t.length)}(t);case 421:return function(e){let t;t="Q"===e[0]||"1"===e[0]?c.decode(a.decode(`z${e}`)).bytes:o.parse(e).multihash.bytes;const r=Uint8Array.from(u.encode(t.length));return h([r,t],r.length+t.length)}(t);case 444:return function(e){const t=e.split(":");if(2!==t.length)throw new Error("failed to parse onion addr: "+t+" does not contain a port number");if(16!==t[0].length)throw new Error("failed to parse onion addr: "+t[0]+" not a Tor onion address.");const r=s.decode("b"+t[0]),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");const i=p(n);return h([r,i],r.length+i.length)}(t);case 445:return function(e){const t=e.split(":");if(2!==t.length)throw new Error("failed to parse onion addr: "+t+" does not contain a port number");if(56!==t[0].length)throw new Error("failed to parse onion addr: "+t[0]+" not a Tor onion3 address.");const r=s.decode("b"+t[0]),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");const i=p(n);return h([r,i],r.length+i.length)}(t);default:return l(t,"base16")}}},46584:(e,t,r)=>{"use strict";const n=r(18190),i=r(89768),o=r(57328),{CID:s}=r(81362),{base58btc:a}=r(99086),c=r(32114),u=Symbol.for("nodejs.util.inspect.custom"),{toString:f}=r(92263),{equals:l}=r(19588),h=new Map,d=Symbol.for("@multiformats/js-multiaddr/multiaddr");class p{constructor(e){if(null==e&&(e=""),Object.defineProperty(this,d,{value:!0}),e instanceof Uint8Array)this.bytes=n.fromBytes(e);else if("string"==typeof e){if(e.length>0&&"/"!==e.charAt(0))throw new Error(`multiaddr "${e}" must start with a "/"`);this.bytes=n.fromString(e)}else{if(!p.isMultiaddr(e))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=n.fromBytes(e.bytes)}}toString(){return n.bytesToString(this.bytes)}toJSON(){return this.toString()}toOptions(){const e={},t=this.toString().split("/");return e.family="ip4"===t[1]?4:6,e.host=t[2],e.transport=t[3],e.port=parseInt(t[4]),e}protos(){return this.protoCodes().map((e=>Object.assign({},i(e))))}protoCodes(){const e=[],t=this.bytes;let r=0;for(;re.name))}tuples(){return n.bytesToTuples(this.bytes)}stringTuples(){const e=n.bytesToTuples(this.bytes);return n.tuplesToStringTuples(e)}encapsulate(e){return e=new p(e),new p(this.toString()+e.toString())}decapsulate(e){const t=e.toString(),r=this.toString(),n=r.lastIndexOf(t);if(n<0)throw new Error("Address "+this+" does not contain subaddress: "+e);return new p(r.slice(0,n))}decapsulateCode(e){const t=this.tuples();for(let r=t.length-1;r>=0;r--)if(t[r][0]===e)return new p(n.tuplesToBytes(t.slice(0,r)));return this}getPeerId(){try{const e=this.stringTuples().filter((e=>e[0]===i.names.ipfs.code)),t=e.pop();if(t&&t[1]){const e=t[1];return"Q"===e[0]||"1"===e[0]?f(a.decode(`z${e}`),"base58btc"):f(s.parse(e).multihash.bytes,"base58btc")}return null}catch(e){return null}}getPath(){let e=null;try{e=this.stringTuples().filter((e=>!!i(e[0]).path))[0][1],e||(e=null)}catch(t){e=null}return e}equals(e){return l(this.bytes,e.bytes)}async resolve(){const e=this.protos().find((e=>e.resolvable));if(!e)return[this];const t=h.get(e.name);if(!t)throw c(new Error(`no available resolver for ${e.name}`),"ERR_NO_AVAILABLE_RESOLVER");return(await t(this)).map((e=>new p(e)))}nodeAddress(){const e=this.protoCodes(),t=this.protoNames(),r=this.toString().split("/").slice(1);if(r.length<4)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6}/{address}/{tcp, udp}/{port}".');if(4!==e[0]&&41!==e[0]&&54!==e[0]&&55!==e[0])throw new Error(`no protocol with name: "'${t[0]}'". Must have a valid family name: "{ip4, ip6, dns4, dns6}".`);if("tcp"!==r[2]&&"udp"!==r[2])throw new Error(`no protocol with name: "'${t[1]}'". Must have a valid transport protocol: "{tcp, udp}".`);return{family:41===e[0]||55===e[0]?6:4,address:r[1],port:parseInt(r[3])}}isThinWaistAddress(e){const t=(e||this).protos();return!(2!==t.length||4!==t[0].code&&41!==t[0].code||6!==t[1].code&&273!==t[1].code)}static fromNodeAddress(e,t){if(!e)throw new Error("requires node address object");if(!t)throw new Error("requires transport protocol");let r;switch(e.family){case 4:r="ip4";break;case 6:r="ip6";break;default:throw Error(`Invalid addr family. Got '${e.family}' instead of 4 or 6`)}return new p("/"+[r,e.address,t,e.port].join("/"))}static isName(e){return!!p.isMultiaddr(e)&&e.protos().some((e=>e.resolvable))}static isMultiaddr(e){return e instanceof p||Boolean(e&&e[d])}[u](){return""}inspect(){return""}}p.protocols=i,p.resolvers=h,e.exports={Multiaddr:p,multiaddr:function(e){return new p(e)},protocols:i,resolvers:h}},33692:(e,t,r)=>{"use strict";const n=r(5003),{toString:i}=r(92263),o=n,s=n.v4,a=n.v6,c=function(e,t,r){let n;if(r=~~r,s(e))n=t||new Uint8Array(r+4),e.split(/\./g).map((function(e){n[r++]=255&parseInt(e,10)}));else if(a(e)){const o=e.split(":",8);let a;for(a=0;a0;a--)e.push("0");o.splice.apply(o,e)}for(n=t||new Uint8Array(r+16),a=0;a>8&255,n[r++]=255&e}}if(!n)throw Error("Invalid ip address: "+e);return n};e.exports={isIP:o,isV4:s,isV6:a,toBytes:c,toString:function(e,t,r){t=~~t,r=r||e.length-t;const n=[];let i;const o=new DataView(e.buffer);if(4===r){for(let i=0;i{"use strict";function t(e){if("number"==typeof e){if(t.codes[e])return t.codes[e];throw new Error("no protocol with code: "+e)}if("string"==typeof e){if(t.names[e])return t.names[e];throw new Error("no protocol with name: "+e)}throw new Error("invalid protocol id type: "+e)}const r=-1;function n(e,t,r,n,i){return{code:e,size:t,name:r,resolvable:Boolean(n),path:Boolean(i)}}t.lengthPrefixedVarSize=r,t.V=r,t.table=[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,r,"ip6zone"],[53,r,"dns","resolvable"],[54,r,"dns4","resolvable"],[55,r,"dns6","resolvable"],[56,r,"dnsaddr","resolvable"],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,r,"unix",!1,"path"],[421,r,"ipfs"],[421,r,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,r,"garlic64"],[460,0,"quic"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,r,"memory"]],t.names={},t.codes={},t.table.map((e=>{const r=n.apply(null,e);return t.codes[r.code]=r,t.names[r.name]=r,null})),t.object=n,e.exports=t},56557:(e,t,r)=>{"use strict";const n=r(926);e.exports=n},39004:(e,t,r)=>{"use strict";const n=r(89768),{code:i}=n("dnsaddr");e.exports={dnsaddrResolver:async function(e){const t=new(r(56557)),n=e.getPeerId(),[,o]=e.stringTuples().find((([e])=>e===i))||[];let s=(await t.resolveTxt(`_dnsaddr.${o}`)).flat().map((e=>e.split("=")[1]));return n&&(s=s.filter((e=>e.includes(n)))),s}}},16159:(e,t,r)=>{"use strict";const{Buffer:n}=r(48764),i=r(9668),o=r(92877),s=4194304,a=n.alloc(0),c="readLength",u="readData",f={[c]:(e,t,r,n)=>{let o;t=t.append(e);try{o=n.lengthDecoder(t)}catch(e){if(t.length>n.maxLengthLength)throw Object.assign(e,{message:"message length too long",code:"ERR_MSG_LENGTH_TOO_LONG"});if(e instanceof RangeError)return{mode:c,buffer:t,chunk:void 0,state:void 0,data:void 0};throw e}if(o>n.maxDataLength)throw Object.assign(new Error("message data too long"),{code:"ERR_MSG_DATA_TOO_LONG"});return e=t.shallowSlice(n.lengthDecoder.bytes),t=new i,n.onLength&&n.onLength(o),o<=0?(n.onData&&n.onData(a),{mode:c,chunk:e,buffer:t,data:a}):{mode:u,chunk:e,buffer:t,state:{dataLength:o},data:void 0}},[u]:(e,t,r,n)=>{if(t=t.append(e),!r)throw new Error("state is required");if(t.lengtho?t.shallowSlice(o):void 0;return t=new i,n.onData&&n.onData(s),{mode:c,chunk:a,buffer:t,state:void 0,data:s}}};function l(e){const t={lengthDecoder:(e=e||{}).lengthDecoder||o,maxLengthLength:e.maxLengthLength||8,maxDataLength:e.maxDataLength||s,onLength:e.onLength,onData:e.onData};return async function*(e){let r,n=new i,o=c;for await(const i of e){let e=i;for(;e;){const i=f[o](e,n,r,t);o=i.mode,e=i.chunk,n=i.buffer,r=i.state,i.data&&(yield i.data)}}if(n.length)throw Object.assign(new Error("unexpected end of input"),{code:"ERR_UNEXPECTED_EOF"})}}l.fromReader=(e,t)=>{let r=1;const n={[Symbol.asyncIterator](){return this},next:async()=>{try{return await e.next(r)}catch(e){if("ERR_UNDER_READ"===e.code)return{done:!0,value:null};throw e}finally{r=1}}};return l({...t||{},onLength:e=>{r=e}})(n)},e.exports=l,e.exports.MAX_LENGTH_LENGTH=8,e.exports.MAX_DATA_LENGTH=s},98025:(e,t,r)=>{"use strict";const{Buffer:n}=r(48764),i=r(9668),o=r(17448);function s(e){e=e||{};const t=Math.max(e.poolSize||10240,e.minPoolSize||8),r=e.lengthEncoder||o;return async function*(e){let o=n.alloc(t),s=0;for await(const a of e){r(a.length,o,s);const e=o.slice(s,s+r.bytes);s+=r.bytes,o.length-s<8&&(o=n.alloc(t),s=0),yield(new i).append(e).append(a)}}}s.single=(e,t)=>{const r=(t=t||{}).lengthEncoder||o;return new i([r(e.length),e.slice()])},e.exports=s,e.exports.MIN_POOL_SIZE=8,e.exports.DEFAULT_POOL_SIZE=10240},88567:(e,t,r)=>{"use strict";t.encode=r(98025),t.decode=r(16159),t.varintEncode=r(17448),t.varintDecode=r(92877),t.int32BEEncode=r(83681),t.int32BEDecode=r(56063)},56063:e=>{"use strict";const t=e=>{if(e.length<4)throw RangeError("Could not decode int32BE");return e.readInt32BE(0)};t.bytes=4,e.exports=t},83681:(e,t,r)=>{"use strict";const{Buffer:n}=r(48764),i=(e,t,r)=>((t=t||n.allocUnsafe(4)).writeInt32BE(e,r),t);i.bytes=4,e.exports=i},92877:(e,t,r)=>{"use strict";const n=r(83387),{Buffer:i}=r(48764),o=e=>{const t=n.decode(i.isBuffer(e)?e:(r=e,new Proxy({},{get:(e,t)=>"l"===t[0]?r[t]:r.get(parseInt(t))})));var r;return o.bytes=n.decode.bytes,t};e.exports=o},17448:(e,t,r)=>{"use strict";const n=r(83387),{Buffer:i}=r(48764),o=(e,t,r)=>{const s=n.encode(e,t,r);return o.bytes=n.encode.bytes,t||i.from(s)};e.exports=o},70419:e=>{e.exports=function e(t,r){var n,i=0,o=0,s=r=r||0,a=t.length;do{if(s>=a||o>49)throw e.bytes=0,new RangeError("Could not decode varint");n=t[s++],i+=o<28?(127&n)<=128);return e.bytes=s-r,i}},30778:e=>{e.exports=function e(r,n,i){if(Number.MAX_SAFE_INTEGER&&r>Number.MAX_SAFE_INTEGER)throw e.bytes=0,new RangeError("Could not encode varint");n=n||[];for(var o=i=i||0;r>=t;)n[i++]=255&r|128,r/=128;for(;-128&r;)n[i++]=255&r|128,r>>>=7;return n[i]=0|r,e.bytes=i-o+1,n};var t=Math.pow(2,31)},83387:(e,t,r)=>{e.exports={encode:r(30778),decode:r(70419),encodingLength:r(73912)}},73912:e=>{var t=Math.pow(2,7),r=Math.pow(2,14),n=Math.pow(2,21),i=Math.pow(2,28),o=Math.pow(2,35),s=Math.pow(2,42),a=Math.pow(2,49),c=Math.pow(2,56),u=Math.pow(2,63);e.exports=function(e){return e{"use strict";t.PROTOCOL_ID="/multistream/1.0.0"},43868:(e,t,r)=>{"use strict";const n=r(11227)("mss:handle"),i=r(9668),o=r(60878),s=r(52261),{PROTOCOL_ID:a}=r(48506);e.exports=async(e,t)=>{t=Array.isArray(t)?t:[t];const{writer:r,reader:c,rest:u,stream:f}=s(e);for(;;){const e=(await o.read(c)).toString();if(n('read "%s"',e),e!==a){if(t.includes(e))return o.write(r,e),n('respond with "%s" for "%s"',e,e),u(),{stream:f,protocol:e};"ls"!==e?(o.write(r,"na"),n('respond with "na" for "%s"',e)):(o.write(r,new i(t.map((e=>o.encode(e))))),n('respond with "%s" for %s',t,e))}else n('respond with "%s" for "%s"',a,e),o.write(r,a)}}},8738:(e,t,r)=>{"use strict";const n=r(27578),i=r(43868),o=r(77372),{PROTOCOL_ID:s}=r(48506);t.PROTOCOL_ID=s;class a{constructor(e){this._stream=e,this._shaken=!1}async _handshake(){if(this._shaken)return;const{stream:e}=await n(this._stream,s);this._stream=e,this._shaken=!0}}t.Dialer=class extends a{select(e){return n(this._stream,e,this._shaken?null:s)}async ls(){await this._handshake();const{stream:e,protocols:t}=await o(this._stream);return this._stream=e,t}},t.Listener=class extends a{handle(e){return i(this._stream,e)}}},77372:(e,t,r)=>{"use strict";const n=r(53469),i=r(11227)("it-multistream-select:ls"),o=r(60878),s=r(52261),a=r(88567),c=r(60618);e.exports=async e=>{const{reader:t,writer:r,rest:u,stream:f}=s(e);i('write "ls"'),o.write(r,"ls"),u();const l=await o.read(t),h=n([l]),d=[];return await c(h,a.decode(),(async e=>{for await(const t of e)d.push(t.shallowSlice(0,-1).toString())})),{stream:f,protocols:d}}},60878:(e,t,r)=>{"use strict";const n=r(9668),i=r(88567),o=r(60618),s=r(32114),{fromString:a}=r(52217),c=r(72262),u=a("\n");t.encode=e=>i.encode.single(new n([e,u])),t.write=(e,r)=>e.push(t.encode(r)),t.writeAll=(e,r)=>{e.push(r.reduce(((e,r)=>e.append(t.encode(r))),new n))},t.read=async e=>{let t=1;const r={[Symbol.asyncIterator](){return this},next:()=>e.next(t)},n=await o(r,i.decode({onLength:e=>{t=e}}),c);if(n.get(n.length-1)!==u[0])throw s(new Error("missing newline"),"ERR_INVALID_MULTISTREAM_SELECT_MESSAGE");return n.shallowSlice(0,-1)}},27578:(e,t,r)=>{"use strict";const n=r(11227)("mss:select"),i=r(32114),o=r(60878),s=r(52261);e.exports=async(e,t,r)=>{t=Array.isArray(t)?[...t]:[t];const{reader:a,writer:c,rest:u,stream:f}=s(e),l=t.shift();r?(n('select: write ["%s", "%s"]',r,l),o.writeAll(c,[r,l])):(n('select: write "%s"',l),o.write(c,l));let h=(await o.read(a)).toString();if(n('select: read "%s"',h),h===r&&(h=(await o.read(a)).toString(),n('select: read "%s"',h)),h===l)return u(),{stream:f,protocol:l};for(const e of t){n('select: write "%s"',e),o.write(c,e);const t=(await o.read(a)).toString();if(n('select: read "%s" for "%s"',t,e),t===e)return u(),{stream:f,protocol:e}}throw u(),i(new Error("protocol selection failed"),"ERR_UNSUPPORTED_PROTOCOL")}},99633:e=>{"use strict";function t(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t{"use strict";let n;n=globalThis.AbortController&&globalThis.AbortSignal?globalThis:r(28599),e.exports.AbortSignal=n.AbortSignal,e.exports.AbortController=n.AbortController},30700:(e,t,r)=>{"use strict";globalThis.fetch&&globalThis.Headers&&globalThis.Request&&globalThis.Response?e.exports={default:globalThis.fetch,Headers:globalThis.Headers,Request:globalThis.Request,Response:globalThis.Response}:e.exports={default:r(83300).default,Headers:r(83300).Headers,Request:r(83300).Request,Response:r(83300).Response}},28951:function(e,t){(function(){var e,r,n,i,o,s,a,c;c=function(e){return[(e&255<<24)>>>24,(e&255<<16)>>>16,(65280&e)>>>8,255&e].join(".")},a=function(e){var t,n,i,o,s,a;for(t=[],i=o=0;o<=3&&0!==e.length;i=++o){if(i>0){if("."!==e[0])throw new Error("Invalid IP");e=e.substring(1)}s=(a=r(e))[0],n=a[1],e=e.substring(n),t.push(s)}if(0!==e.length)throw new Error("Invalid IP");switch(t.length){case 1:if(t[0]>4294967295)throw new Error("Invalid IP");return t[0]>>>0;case 2:if(t[0]>255||t[1]>16777215)throw new Error("Invalid IP");return(t[0]<<24|t[1])>>>0;case 3:if(t[0]>255||t[1]>255||t[2]>65535)throw new Error("Invalid IP");return(t[0]<<24|t[1]<<16|t[2])>>>0;case 4:if(t[0]>255||t[1]>255||t[2]>255||t[3]>255)throw new Error("Invalid IP");return(t[0]<<24|t[1]<<16|t[2]<<8|t[3])>>>0;default:throw new Error("Invalid IP")}},i=(n=function(e){return e.charCodeAt(0)})("0"),s=n("a"),o=n("A"),r=function(e){var t,r,a,c,u;for(c=0,t=10,r="9",a=0,e.length>1&&"0"===e[a]&&("x"===e[a+1]||"X"===e[a+1]?(a+=2,t=16):"0"<=e[a+1]&&e[a+1]<="9"&&(a++,t=8,r="7")),u=a;a>>0;else{if(16!==t)break;if("a"<=e[a]&&e[a]<="f")c=c*t+(10+n(e[a])-s)>>>0;else{if(!("A"<=e[a]&&e[a]<="F"))break;c=c*t+(10+n(e[a])-o)>>>0}}if(c>4294967295)throw new Error("too large");a++}if(a===u)throw new Error("empty octet");return[c,a]},e=function(){function e(e,t){var r,n,i;if("string"!=typeof e)throw new Error("Missing `net' parameter");if(t||(i=e.split("/",2),e=i[0],t=i[1]),t||(t=32),"string"==typeof t&&t.indexOf(".")>-1){try{this.maskLong=a(t)}catch(e){throw new Error("Invalid mask: "+t)}for(r=n=32;n>=0;r=--n)if(this.maskLong===4294967295<<32-r>>>0){this.bitmask=r;break}}else{if(!t&&0!==t)throw new Error("Invalid mask: empty");this.bitmask=parseInt(t,10),this.maskLong=0,this.bitmask>0&&(this.maskLong=4294967295<<32-this.bitmask>>>0)}try{this.netLong=(a(e)&this.maskLong)>>>0}catch(t){throw new Error("Invalid net address: "+e)}if(!(this.bitmask<=32))throw new Error("Invalid mask for ip4: "+t);this.size=Math.pow(2,32-this.bitmask),this.base=c(this.netLong),this.mask=c(this.maskLong),this.hostmask=c(~this.maskLong),this.first=this.bitmask<=30?c(this.netLong+1):this.base,this.last=this.bitmask<=30?c(this.netLong+this.size-2):c(this.netLong+this.size-1),this.broadcast=this.bitmask<=30?c(this.netLong+this.size-1):void 0}return e.prototype.contains=function(t){return"string"==typeof t&&(t.indexOf("/")>0||4!==t.split(".").length)&&(t=new e(t)),t instanceof e?this.contains(t.base)&&this.contains(t.broadcast||t.last):(a(t)&this.maskLong)>>>0==(this.netLong&this.maskLong)>>>0},e.prototype.next=function(t){return null==t&&(t=1),new e(c(this.netLong+this.size*t),this.mask)},e.prototype.forEach=function(e){var t,r,n;for(n=a(this.first),r=a(this.last),t=0;n<=r;)e(c(n),n,t),t++,n++},e.prototype.toString=function(){return this.base+"/"+this.bitmask},e}(),t.ip2long=a,t.long2ip=c,t.Netmask=e}).call(this)},53710:(e,t,r)=>{"use strict";e=r.nmd(e),Object.defineProperty(t,"__esModule",{value:!0}),t.utils=t.verify=t.sign=t.getPublicKey=t.SignResult=t.Signature=t.Point=t.ExtendedPoint=t.CURVE=void 0;const n={a:-1n,d:37095705934669439343138083508754565189542113879843219016388785533085940283555n,P:2n**255n-19n,n:2n**252n+27742317777372353535851937790883648493n,h:8n,Gx:15112221349535400772501151409588531511454012693041857206046113283949847762202n,Gy:46316835694926478169428394003475163141307993866256225615783033603165251855960n};t.CURVE=n;const i=32,o=19681161376707505956807079304988542015446066515923890162744021073123829784752n,s=25063068953384623474111414158702152701244531502492656460079210482610430750235n,a=54469307008909316920995813868745141605393597292927456921205312896311721017578n,c=1159843021668779879193775521855586647937357759715417654439879720876111806838n,u=40440834346308536858101042469323190826248399146238708352240133220865137265952n;class f{constructor(e,t,r,n){this.x=e,this.y=t,this.z=r,this.t=n}static fromAffine(e){if(!(e instanceof h))throw new TypeError("ExtendedPoint#fromAffine: expected Point");return e.equals(h.ZERO)?f.ZERO:new f(e.x,e.y,1n,_(e.x*e.y))}static toAffineBatch(e){const t=function(e,t=n.P){const r=e.length,i=new Array(r);let o=1n;for(let n=0;n=0;n--){if(0n===e[n])continue;let r=_(o*e[n],t);e[n]=_(o*i[n],t),o=r}return e}(e.map((e=>e.z)));return e.map(((e,r)=>e.toAffine(t[r])))}static normalizeZ(e){return this.toAffineBatch(e).map(this.fromAffine)}static fromRistrettoHash(e){const t=E(e.slice(0,i)),r=this.calcElligatorRistrettoMap(t),n=E(e.slice(i,64)),o=this.calcElligatorRistrettoMap(n);return r.add(o)}static calcElligatorRistrettoMap(e){const{d:t}=n,r=_(o*e*e),i=_((r+1n)*c);let a=-1n;const l=_((a-t*r)*_(r+t));let{isValid:h,value:d}=T(i,l),p=_(d*e);m(p)||(p=_(-p)),h||(d=p),h||(a=r);const y=_(a*(r-1n)*u-l),g=d*d,b=_((d+d)*l),v=_(y*s),w=_(1n-g),E=_(1n+g);return new f(_(b*E),_(w*v),_(v*E),_(b*w))}static fromRistrettoBytes(e){const{a:t,d:r}=n,o="ExtendedPoint.fromRistrettoBytes: Cannot convert bytes to Ristretto Point",s=E(e);if(!function(e,t){if(e.length!==t.length)return!1;for(let r=0;r0n;)1n&t&&(r=r.add(i)),i=i.double(),t>>=1n;return r}precomputeWindow(e){const t=256/e+1;let r=[],n=this,i=n;for(let o=0;o>=d,s>a&&(s-=u,e+=1n),0===s)o=o.add(t%2?n[r].negate():n[r]);else{const e=n[r+Math.abs(s)-1];i=i.add(s<0?e.negate():e)}}return[i,o]}multiply(e,t){if(!v(e))throw new TypeError("Point#multiply: expected number or bigint");const r=_(BigInt(e),n.n);return f.normalizeZ(this.wNAF(r,t))[0]}toAffine(e=S(this.z)){const t=_(this.x*e),r=_(this.y*e);return new h(t,r)}}t.ExtendedPoint=f,f.BASE=new f(n.Gx,n.Gy,1n,_(n.Gx*n.Gy)),f.ZERO=new f(0n,1n,1n,0n);const l=new WeakMap;class h{constructor(e,t){this.x=e,this.y=t}_setWindowSize(e){this._WINDOW_SIZE=e,l.delete(this)}static fromHex(e){const{d:t,P:r}=n,i=e instanceof Uint8Array?e:y(e);if(32!==i.length)throw new Error("Point.fromHex: expected 32 bytes");const o=i[31],s=-129&o,a=0!=(128&o),c=w(Uint8Array.from(Array.from(i.slice(0,31)).concat(s)));if(c>=r)throw new Error("Point.fromHex expects hex <= Fp");const u=_(c*c),f=_(u-1n),l=_(t*u+1n);let{isValid:d,value:p}=T(f,l);if(!d)throw new Error("Point.fromHex: invalid y coordinate");return a!==(1n===(1n&p))&&(p=_(-p)),new h(p,c)}static async fromPrivateKey(e){const r=await t.utils.sha512(k(e));return h.BASE.multiply(P(r))}toRawBytes(){const e=g(this.y),t=new Uint8Array(i);for(let r=e.length-2,n=0;n=0;r-=2,n++)t[n]=Number.parseInt(e[r]+e[r+1],16);const r=1n&this.x?128:0;return t[31]|=r,t}toHex(){return p(this.toRawBytes())}toX25519(){return _((1n+this.y)*S(1n-this.y))}equals(e){return this.x===e.x&&this.y===e.y}negate(){return new h(_(-this.x),this.y)}add(e){return f.fromAffine(this).add(f.fromAffine(e)).toAffine()}subtract(e){return this.add(e.negate())}multiply(e){return f.fromAffine(this).multiply(e,this).toAffine()}}t.Point=h,h.BASE=new h(n.Gx,n.Gy),h.ZERO=new h(0n,1n);class d{constructor(e,t){this.r=e,this.s=t}static fromHex(e){e=R(e);const t=h.fromHex(e.slice(0,32)),r=w(e.slice(32));if(!(0<(i=r)&&i0n||!!("number"==typeof e&&e>0&&Number.isSafeInteger(e))}function w(e){let t=0n;for(let r=0;r=0n?r:t+r}function S(e,t=n.P){if(0n===e||t<=0n)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let r=_(e,t),i=t,[o,s,a,c]=[0n,1n,1n,0n];for(;0n!==r;){const e=i/r,t=i%r,n=o-a*e,u=s-c*e;[i,r]=[r,t],[o,s]=[a,c],[a,c]=[n,u]}if(1n!==i)throw new Error("invert: does not exist");return _(o,t)}function A(e,t){const{P:r}=n;let i=e;for(;t-- >0n;)i*=i,i%=r;return i}function T(e,t){const r=_(t*t*t),i=_(r*r*t);let s=_(e*r*function(e){const{P:t}=n,r=e*e%t*e%t,i=A(r,2n)*r%t,o=A(i,1n)*e%t,s=A(o,5n)*o%t,a=A(s,10n)*s%t,c=A(a,20n)*a%t,u=A(c,40n)*c%t,f=A(u,80n)*u%t,l=A(f,80n)*u%t,h=A(l,10n)*s%t;return A(h,2n)*e%t}(e*i));const a=_(t*s*s),c=s,u=_(s*o),f=a===e,l=a===_(-e),h=a===_(-e*o);return f&&(s=c),(l||h)&&(s=u),m(s)&&(s=_(-s)),{isValid:f||l,value:s}}function I(e){return T(1n,e)}async function C(...e){const r=function(...e){if(1===e.length)return e[0];const t=e.reduce(((e,t)=>e+t.length),0),r=new Uint8Array(t);for(let t=0,n=0;t2n**256n)throw new Error("Expected 32 bytes of private key");e=t.toString(16).padStart(64,"0")}if("string"==typeof e){if(64!==e.length)throw new Error("Expected 32 bytes of private key");return y(e)}if(e instanceof Uint8Array){if(32!==e.length)throw new Error("Expected 32 bytes of private key");return e}throw new TypeError("Expected valid private key")}t.Signature=d,t.SignResult=d,t.getPublicKey=async function(e){const t=await h.fromPrivateKey(e);return"string"==typeof e?t.toHex():t.toRawBytes()},t.sign=async function(e,r){const o=await t.utils.sha512(k(r)),s=P(o),a=h.BASE.multiply(s),c=R(e),u=await C((f=o,f.slice(i)),c);var f;const l=h.BASE.multiply(u),p=_(u+await C(l.toRawBytes(),a.toRawBytes(),c)*s,n.n),y=new d(l,p);return"string"==typeof e?y.toHex():y.toRawBytes()},t.verify=async function(e,t,r){t=R(t),r instanceof h||(r=h.fromHex(r)),e instanceof d||(e=d.fromHex(e));const n=await C(e.r.toRawBytes(),r.toRawBytes(),t),i=f.fromAffine(r).multiplyUnsafe(n),o=f.BASE.multiply(e.s);return f.fromAffine(e.r).add(i).subtract(o).multiplyUnsafe(8n).equals(f.ZERO)},h.BASE._setWindowSize(8);const B=(()=>{const t="object"==typeof self&&"crypto"in self?self.crypto:void 0,r="function"==typeof e.require&&e.require.bind(e);return{node:r&&!t?r("crypto"):void 0,web:t}})();t.utils={TORSION_SUBGROUP:["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"],randomBytes:(e=32)=>{if(B.web)return B.web.getRandomValues(new Uint8Array(e));if(B.node){const{randomBytes:t}=B.node;return new Uint8Array(t(e).buffer)}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>{let e=1024;for(;e--;){const e=t.utils.randomBytes(32),r=w(e);if(r>1n&&r{if(B.web){const t=await B.web.subtle.digest("SHA-512",e.buffer);return new Uint8Array(t)}if(B.node)return Uint8Array.from(B.node.createHash("sha512").update(e).digest());throw new Error("The environment doesn't have sha512 function")},precompute(e=8,t=h.BASE){const r=t.equals(h.BASE)?t:new h(t.x,t.y);return r._setWindowSize(e),r.multiply(1n),r}}},1795:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.utils=t.schnorr=t.verify=t.signSync=t.sign=t.getSharedSecret=t.recoverPublicKey=t.getPublicKey=t.SignResult=t.Signature=t.Point=t.CURVE=void 0;const n={a:0n,b:7n,P:2n**256n-2n**32n-977n,n:2n**256n-432420386565659656852420866394968145599n,h:1n,Gx:55066263022277343669578718895168534326250603453777594175500187360389116729240n,Gy:32670510020758816978083085130507043184471273380659243275938904335757337482424n,beta:0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501een};function i(e){const{a:t,b:r}=n;return _(e**3n+t*e+r)}t.CURVE=n;const o=0n===n.a;class s{constructor(e,t,r){this.x=e,this.y=t,this.z=r}static fromAffine(e){if(!(e instanceof c))throw new TypeError("JacobianPoint#fromAffine: expected Point");return new s(e.x,e.y,1n)}static toAffineBatch(e){const t=function(e,t=n.P){const r=e.length,i=new Array(r);let o=1n;for(let n=0;n=0;n--){if(0n===e[n])continue;const r=_(o*e[n],t);e[n]=_(o*i[n],t),o=r}return e}(e.map((e=>e.z)));return e.map(((e,r)=>e.toAffine(t[r])))}static normalizeZ(e){return s.toAffineBatch(e).map(s.fromAffine)}equals(e){const t=this,r=e,n=_(t.z*t.z),i=_(t.z*n),o=_(r.z*r.z),s=_(r.z*o);return _(t.x*o)===_(n*r.x)&&_(t.y*s)===_(i*r.y)}negate(){return new s(this.x,_(-this.y),this.z)}double(){const e=this.x,t=this.y,r=this.z,n=_(e**2n),i=_(t**2n),o=_(i**2n),a=_(2n*(_(_((e+i)**2n))-n-o)),c=_(3n*n),u=_(c**2n),f=_(u-2n*a),l=_(c*(a-f)-8n*o),h=_(2n*t*r);return new s(f,l,h)}add(e){if(!(e instanceof s))throw new TypeError("JacobianPoint#add: expected JacobianPoint");const t=this.x,r=this.y,n=this.z,i=e.x,o=e.y,a=e.z;if(0n===i||0n===o)return this;if(0n===t||0n===r)return e;const c=_(n**2n),u=_(a**2n),f=_(t*u),l=_(i*c),h=_(r*a*u),d=_(_(o*n)*c),p=_(l-f),y=_(d-h);if(0n===p)return 0n===y?this.double():s.ZERO;const g=_(p**2n),b=_(p*g),m=_(f*g),v=_(y**2n-b-2n*m),w=_(y*(m-v)-h*b),E=_(n*a*p);return new s(v,w,E)}subtract(e){return this.add(e.negate())}multiplyUnsafe(e){if(!E(e))throw new TypeError("Point#multiply: expected valid scalar");let t=_(BigInt(e),n.n);if(!o){let e=s.ZERO,r=this;for(;t>0n;)1n&t&&(e=e.add(r)),r=r.double(),t>>=1n;return e}let[r,i,a,c]=C(t),u=s.ZERO,f=s.ZERO,l=this;for(;i>0n||c>0n;)1n&i&&(u=u.add(l)),1n&c&&(f=f.add(l)),l=l.double(),i>>=1n,c>>=1n;return r&&(u=u.negate()),a&&(f=f.negate()),f=new s(_(f.x*n.beta),f.y,f.z),u.add(f)}precomputeWindow(e){const t=o?128/e+1:256/e+1;let r=[],n=this,i=n;for(let o=0;o>=p,o>l&&(o-=d,e+=1n),0===o)u=u.add(t%2?n[r].negate():n[r]);else{const e=n[r+Math.abs(o)-1];i=i.add(o<0?e.negate():e)}}return[i,u]}multiply(e,t){if(!E(e))throw new TypeError("Point#multiply: expected valid scalar");let r,i,a=_(BigInt(e),n.n);if(o){const[e,o,c,u]=C(a);let f,l,h,d;[f,h]=this.wNAF(o,t),[l,d]=this.wNAF(u,t),e&&(f=f.negate()),c&&(l=l.negate()),l=new s(_(l.x*n.beta),l.y,l.z),[r,i]=[f.add(l),h.add(d)]}else[r,i]=this.wNAF(a,t);return s.normalizeZ([r,i])[0]}toAffine(e=A(this.z)){const t=e**2n,r=_(this.x*t),n=_(this.y*t*e);return new c(r,n)}}s.BASE=new s(n.Gx,n.Gy,1n),s.ZERO=new s(0n,1n,0n);const a=new WeakMap;class c{constructor(e,t){this.x=e,this.y=t}_setWindowSize(e){this._WINDOW_SIZE=e,a.delete(this)}static fromCompressedHex(e){const t=32===e.length,r=v(t?e:e.slice(1));let o=function(e){const{P:t}=n,r=e*e*e%t,i=r*r*e%t,o=S(i,3n)*i%t,s=S(o,3n)*i%t,a=S(s,2n)*r%t,c=S(a,11n)*a%t,u=S(c,22n)*c%t,f=S(u,44n)*u%t,l=S(f,88n)*f%t,h=S(l,44n)*u%t,d=S(h,3n)*i%t,p=S(d,23n)*c%t,y=S(p,6n)*r%t;return S(y,2n)}(i(r));const s=1n===(1n&o);t?s&&(o=_(-o)):1==(1&e[0])!==s&&(o=_(-o));const a=new c(r,o);return a.assertValidity(),a}static fromUncompressedHex(e){const t=v(e.slice(1,33)),r=v(e.slice(33)),n=new c(t,r);return n.assertValidity(),n}static fromHex(e){const t=m(e),r=t[0];if(32===t.length||33===t.length&&(2===r||3===r))return this.fromCompressedHex(t);if(65===t.length&&4===r)return this.fromUncompressedHex(t);throw new Error(`Point.fromHex: received invalid point. Expected 32-33 compressed bytes or 65 uncompressed bytes, not ${t.length}`)}static fromPrivateKey(e){return c.BASE.multiply(B(e))}static fromSignature(e,t,r){let i=e instanceof Uint8Array?v(e):g(e);const o=M(t),{r:a,s:u}=o;if(0!==r&&1!==r)throw new Error("Cannot recover signature: invalid yParity bit");const f=2+(1&r),l=c.fromHex(`0${f}${d(a)}`),h=s.fromAffine(l).multiplyUnsafe(u),p=s.BASE.multiply(i),y=A(a,n.n),b=h.subtract(p).multiplyUnsafe(y).toAffine();return b.assertValidity(),b}toRawBytes(e=!1){return b(this.toHex(e))}toHex(e=!1){const t=d(this.x);return e?`${1n&this.y?"03":"02"}${t}`:`04${t}${d(this.y)}`}toHexX(){return this.toHex(!0).slice(2)}toRawX(){return this.toRawBytes(!0).slice(1)}assertValidity(){const e="Point is not on elliptic curve",{P:t}=n,{x:r,y:o}=this;if(0n===r||0n===o||r>=t||o>=t)throw new Error(e);if((_(o*o)-i(r))%t!==0n)throw new Error(e)}equals(e){return this.x===e.x&&this.y===e.y}negate(){return new c(this.x,_(-this.y))}double(){return s.fromAffine(this).double().toAffine()}add(e){return s.fromAffine(this).add(s.fromAffine(e)).toAffine()}subtract(e){return this.add(e.negate())}multiply(e){return s.fromAffine(this).multiply(e,this).toAffine()}}function u(e){return Number.parseInt(e[0],16)>=8?"00"+e:e}t.Point=c,c.BASE=new c(n.Gx,n.Gy),c.ZERO=new c(0n,0n);class f{constructor(e,t){this.r=e,this.s=t}static fromCompact(e){if("string"!=typeof e&&!(e instanceof Uint8Array))throw new TypeError("Signature.fromCompact: Expected string or Uint8Array");const t=e instanceof Uint8Array?h(e):e;if(128!==t.length)throw new Error("Signature.fromCompact: Expected 64-byte hex");const r=new f(g(t.slice(0,64)),g(t.slice(64,128)));return r.assertValidity(),r}static fromDER(e){const t="Signature.fromDER";if("string"!=typeof e&&!(e instanceof Uint8Array))throw new TypeError(`${t}: Expected string or Uint8Array`);const r=e instanceof Uint8Array?h(e):e,n=w(r.slice(2,4));if("30"!==r.slice(0,2)||n!==r.length-4||"02"!==r.slice(4,6))throw new Error(`${t}: Invalid signature ${r}`);const i=w(r.slice(6,8)),o=8+i,s=r.slice(8,o);if(s.startsWith("00")&&w(s.slice(2,4))<=127)throw new Error(`${t}: Invalid r with trailing length`);const a=g(s);if("02"!==r.slice(o,o+2))throw new Error(`${t}: Invalid r-s separator`);const c=w(r.slice(o+2,o+4)),u=n-c-i-10;if(u>0||-4===u)throw new Error(`${t}: Invalid total length`);if(c>n-i-4)throw new Error(`${t}: Invalid s`);const l=o+4,d=r.slice(l,l+c);if(d.startsWith("00")&&w(d.slice(2,4))<=127)throw new Error(`${t}: Invalid s with trailing length`);const p=g(d),y=new f(a,p);return y.assertValidity(),y}static fromHex(e){return this.fromDER(e)}assertValidity(){const{r:e,s:t}=this;if(!R(e))throw new Error("Invalid Signature: r must be 0 < r < n");if(!R(t))throw new Error("Invalid Signature: s must be 0 < s < n")}toDERRawBytes(e=!1){return b(this.toDERHex(e))}toDERHex(e=!1){const t=u(y(this.s));if(e)return t;const r=u(y(this.r)),n=y(r.length/2),i=y(t.length/2);return`30${y(r.length/2+t.length/2+4)}02${n}${r}02${i}${t}`}toRawBytes(){return this.toDERRawBytes()}toHex(){return this.toDERHex()}toCompactRawBytes(){return b(this.toCompactHex())}toCompactHex(){return d(this.r)+d(this.s)}}function l(...e){if(1===e.length)return e[0];const t=e.reduce(((e,t)=>e+t.length),0),r=new Uint8Array(t);for(let t=0,n=0;t0n||!!("number"==typeof e&&e>0&&Number.isSafeInteger(e))}function _(e,t=n.P){const r=e%t;return r>=0?r:t+r}function S(e,t){const{P:r}=n;let i=e;for(;t-- >0n;)i*=i,i%=r;return i}function A(e,t=n.P){if(0n===e||t<=0n)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let r=_(e,t),i=t,[o,s,a,c]=[0n,1n,1n,0n];for(;0n!==r;){const e=i/r,t=i%r,n=o-a*e,u=s-c*e;[i,r]=[r,t],[o,s]=[a,c],[a,c]=[n,u]}if(1n!==i)throw new Error("invert: does not exist");return _(o,t)}t.Signature=f,t.SignResult=f;const T=(e,t)=>(e+t/2n)/t,I=2n**128n;function C(e){const{n:t}=n,r=0x3086d221a7d46bcde86c90e49284eb15n,i=-0xe4437ed6010e88286f547fa90abfe4c3n,o=r,s=T(o*e,t),a=T(-i*e,t);let c=_(e-s*r-0x114ca50f7a8e2f3f657c1108d9d44cfd8n*a,t),u=_(-s*i-a*o,t);const f=c>I,l=u>I;if(f&&(c=t-c),l&&(u=t-u),c>I||u>I)throw new Error("splitScalarEndo: Endomorphism failed");return[f,c,l,u]}function P(e,t){if(null==e)throw new Error(`sign: expected valid msgHash, not "${e}"`);const r=p("string"==typeof e?g(e):v(e));return[r,v(r),p(t),new Uint8Array(32).fill(1),new Uint8Array(32).fill(0),Uint8Array.from([0]),Uint8Array.from([1])]}function R(e){return 00)t=BigInt(e);else if("string"==typeof e){if(64!==e.length)throw new Error("Expected 32 bytes of private key");t=g(e)}else{if(!(e instanceof Uint8Array))throw new TypeError("Expected valid private key");if(32!==e.length)throw new Error("Expected 32 bytes of private key");t=v(e)}if(!R(t))throw new Error("Expected private key: 0 < key < n");return t}function x(e){return e instanceof c?(e.assertValidity(),e):c.fromHex(e)}function M(e){return e instanceof f?(e.assertValidity(),e):f.fromDER(e)}function O(e){const t=e instanceof Uint8Array,r="string"==typeof e,n=(t||r)&&e.length;return t?33===n||65===n:r?66===n||130===n:e instanceof c}function N(e,t,r=!1){const[i,o,s]=e;let{canonical:a,der:c,recovered:u}=t,l=(i.x===o?0:2)|Number(1n&i.y),h=s;s>n.n>>1n&&a&&(h=n.n-s,l^=1);const d=new f(o,h);d.assertValidity();const p=!1===c?d.toCompactHex():d.toDERHex(),y=r?p:b(p);return u?[y,l]:y}async function L(e,...r){const n=new Uint8Array(e.split("").map((e=>e.charCodeAt(0)))),i=await t.utils.sha256(n);return v(await t.utils.sha256(l(i,i,...r)))}async function D(e,t,r){const i=p(e);return _(await L("BIP0340/challenge",i,t.toRawX(),r),n.n)}function K(e){return 0n===_(e.y,2n)}t.getPublicKey=function(e,t=!1){const r=c.fromPrivateKey(e);return"string"==typeof e?r.toHex(t):r.toRawBytes(t)},t.recoverPublicKey=function(e,t,r){const n=c.fromSignature(e,t,r);return"string"==typeof e?n.toHex():n.toRawBytes()},t.getSharedSecret=function(e,t,r=!1){if(O(e))throw new TypeError("getSharedSecret: first arg must be private key");if(!O(t))throw new TypeError("getSharedSecret: second arg must be public key");const n=x(t);n.assertValidity();const i=n.multiply(B(e));return"string"==typeof e?i.toHex(r):i.toRawBytes(r)},t.sign=async function(e,r,n={}){return N(await async function(e,r){const n=B(r);let[i,o,s,a,c,u,f]=P(e,n);const l=t.utils.hmacSha256;c=await l(c,a,u,s,i),a=await l(c,a),c=await l(c,a,f,s,i),a=await l(c,a);for(let e=0;e<1e3;e++){a=await l(c,a);let e=k(a,o,n);if(e)return e;c=await l(c,a,u),a=await l(c,a)}throw new TypeError("secp256k1: Tried 1,000 k values for sign(), all were invalid")}(e,r),n,"string"==typeof e)},t.signSync=function(e,r,n={}){return N(function(e,r){const n=B(r);let[i,o,s,a,c,u,f]=P(e,n);const l=t.utils.hmacSha256Sync;if(!l)throw new Error("utils.hmacSha256Sync is undefined, you need to set it");if(c=l(c,a,u,s,i),c instanceof Promise)throw new Error("To use sync sign(), ensure utils.hmacSha256 is sync");a=l(c,a),c=l(c,a,f,s,i),a=l(c,a);for(let e=0;e<1e3;e++){a=l(c,a);let e=k(a,o,n);if(e)return e;c=l(c,a,u),a=l(c,a)}throw new TypeError("secp256k1: Tried 1,000 k values for sign(), all were invalid")}(e,r),n,"string"==typeof e)},t.verify=function(e,t,r){const{n:i}=n;let o;try{o=M(e)}catch(e){return!1}const{r:a,s:c}=o,u=function(e){"string"!=typeof e&&(e=h(e));let t=g(e||"0");const r=e.length/2*8-256;return r>0&&(t>>=BigInt(r)),t>=n.n&&(t-=n.n),t}(t);if(0n===u)return!1;const f=s.fromAffine(x(r)),l=A(c,i),d=_(u*l,i),p=_(a*l,i),y=s.BASE.multiply(d),b=f.multiplyUnsafe(p);return _(y.add(b).toAffine().x,i)===a};class U{constructor(e,t){if(this.r=e,this.s=t,e<=0n||t<=0n||e>=n.P||t>=n.n)throw new Error("Invalid signature")}static fromHex(e){const t=m(e);if(64!==t.length)throw new TypeError(`SchnorrSignature.fromHex: expected 64 bytes, not ${t.length}`);const r=v(t.slice(0,32)),n=v(t.slice(32));return new U(r,n)}toHex(){return d(this.r)+d(this.s)}toRawBytes(){return b(this.toHex())}}async function j(e,t,r){const n=e instanceof U?e:U.fromHex(e),i="string"==typeof t?b(t):t,o=x(r),s=await D(n.r,o,i),a=c.fromPrivateKey(n.s),u=o.multiply(s),f=a.subtract(u);return!(f.equals(c.BASE)||!K(f)||f.x!==n.r)}t.schnorr={Signature:U,getPublicKey:function(e){const t=c.fromPrivateKey(e);return"string"==typeof e?t.toHexX():t.toRawX()},sign:async function(e,r,i=t.utils.randomBytes()){if(null==e)throw new TypeError(`sign: Expected valid message, not "${e}"`);r||(r=0n);const{n:o}=n,s=m(e),a=B(r),u=m(i);if(32!==u.length)throw new TypeError("sign: Expected 32 bytes of aux randomness");const f=c.fromPrivateKey(a),l=K(f)?a:o-a,h=l^await L("BIP0340/aux",u),d=_(await L("BIP0340/nonce",p(h),f.toRawX(),s),o);if(0n===d)throw new Error("sign: Creation of signature failed. k is zero");const y=c.fromPrivateKey(d),g=K(y)?d:o-d,b=await D(y.x,f,s),v=new U(y.x,_(g+b*l,o));if(!await j(v.toRawBytes(),s,f.toRawX()))throw new Error("sign: Invalid signature produced");return"string"==typeof e?v.toHex():v.toRawBytes()},verify:j},c.BASE._setWindowSize(8);const V=(()=>{const e="object"==typeof self&&"crypto"in self?self.crypto:void 0;return{node:e?void 0:r(39370),web:e}})();t.utils={isValidPrivateKey(e){try{return B(e),!0}catch(e){return!1}},randomBytes:(e=32)=>{if(V.web)return V.web.getRandomValues(new Uint8Array(e));if(V.node){const{randomBytes:t}=V.node;return new Uint8Array(t(e).buffer)}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>{let e=8;for(;e--;){const e=t.utils.randomBytes(32),r=v(e);if(R(r)&&1n!==r)return e}throw new Error("Valid private key was not found in 8 iterations. PRNG is broken")},sha256:async e=>{if(V.web){const t=await V.web.subtle.digest("SHA-256",e.buffer);return new Uint8Array(t)}if(V.node){const{createHash:t}=V.node;return Uint8Array.from(t("sha256").update(e).digest())}throw new Error("The environment doesn't have sha256 function")},hmacSha256:async(e,...t)=>{if(V.web){const r=await V.web.subtle.importKey("raw",e,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),n=l(...t),i=await V.web.subtle.sign("HMAC",r,n);return new Uint8Array(i)}if(V.node){const{createHmac:r}=V.node,n=r("sha256",e);for(let e of t)n.update(e);return Uint8Array.from(n.digest())}throw new Error("The environment doesn't have hmac-sha256 function")},sha256Sync:void 0,hmacSha256Sync:void 0,precompute(e=8,t=c.BASE){const r=t===c.BASE?t:new c(t.x,t.y);return r._setWindowSize(e),r.multiply(3n),r}}},83300:(e,t)=>{"use strict";var r=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==r)return r;throw new Error("unable to locate global object")}();e.exports=t=r.fetch,r.fetch&&(t.default=r.fetch.bind(r)),t.Headers=r.Headers,t.Request=r.Request,t.Response=r.Response},8925:(e,t,r)=>{var n=r(3832);function i(e,t){n.cipher.registerAlgorithm(e,(function(){return new n.aes.Algorithm(e,t)}))}r(85649),r(61967),r(97116),e.exports=n.aes=n.aes||{},n.aes.startEncrypting=function(e,t,r,n){var i=p({key:e,output:r,decrypt:!1,mode:n});return i.start(t),i},n.aes.createEncryptionCipher=function(e,t){return p({key:e,output:null,decrypt:!1,mode:t})},n.aes.startDecrypting=function(e,t,r,n){var i=p({key:e,output:r,decrypt:!0,mode:n});return i.start(t),i},n.aes.createDecryptionCipher=function(e,t){return p({key:e,output:null,decrypt:!0,mode:t})},n.aes.Algorithm=function(e,t){f||l();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return d(r._w,e,t,!1)},decrypt:function(e,t){return d(r._w,e,t,!0)}}}),r._init=!1},n.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t,r=e.key;if("string"!=typeof r||16!==r.length&&24!==r.length&&32!==r.length){if(n.util.isArray(r)&&(16===r.length||24===r.length||32===r.length)){t=r,r=n.util.createBuffer();for(var i=0;i>>=2,i=0;i>8^255&l^99,o[y]=l,s[l]=y,d=(h=e[l])<<24^l<<16^l<<8^l^h,p=((r=e[y])^(n=e[r])^(i=e[n]))<<24^(y^i)<<16^(y^n^i)<<8^y^r^i;for(var b=0;b<4;++b)c[b][y]=d,u[b][l]=p,d=d<<24|d>>>8,p=p<<24|p>>>8;0===y?y=g=1:(y=r^e[e[e[r^i]]],g^=e[e[g]])}}function h(e,t){for(var r,n=e.slice(0),i=1,s=n.length,c=4*(s+6+1),f=s;f>>16&255]<<24^o[r>>>8&255]<<16^o[255&r]<<8^o[r>>>24]^a[i]<<24,i++):s>6&&f%s==4&&(r=o[r>>>24]<<24^o[r>>>16&255]<<16^o[r>>>8&255]<<8^o[255&r]),n[f]=n[f-s]^r;if(t){for(var l,h=u[0],d=u[1],p=u[2],y=u[3],g=n.slice(0),b=(f=0,(c=n.length)-4);f>>24]]^d[o[l>>>16&255]]^p[o[l>>>8&255]]^y[o[255&l]];n=g}return n}function d(e,t,r,n){var i,a,f,l,h,d,p,y,g,b,m,v,w=e.length/4-1;n?(i=u[0],a=u[1],f=u[2],l=u[3],h=s):(i=c[0],a=c[1],f=c[2],l=c[3],h=o),d=t[0]^e[0],p=t[n?3:1]^e[1],y=t[2]^e[2],g=t[n?1:3]^e[3];for(var E=3,_=1;_>>24]^a[p>>>16&255]^f[y>>>8&255]^l[255&g]^e[++E],m=i[p>>>24]^a[y>>>16&255]^f[g>>>8&255]^l[255&d]^e[++E],v=i[y>>>24]^a[g>>>16&255]^f[d>>>8&255]^l[255&p]^e[++E],g=i[g>>>24]^a[d>>>16&255]^f[p>>>8&255]^l[255&y]^e[++E],d=b,p=m,y=v;r[0]=h[d>>>24]<<24^h[p>>>16&255]<<16^h[y>>>8&255]<<8^h[255&g]^e[++E],r[n?3:1]=h[p>>>24]<<24^h[y>>>16&255]<<16^h[g>>>8&255]<<8^h[255&d]^e[++E],r[2]=h[y>>>24]<<24^h[g>>>16&255]<<16^h[d>>>8&255]<<8^h[255&p]^e[++E],r[n?1:3]=h[g>>>24]<<24^h[d>>>16&255]<<16^h[p>>>8&255]<<8^h[255&y]^e[++E]}function p(e){var t,r="AES-"+((e=e||{}).mode||"CBC").toUpperCase(),i=(t=e.decrypt?n.cipher.createDecipher(r,e.key):n.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var o=null;r instanceof n.util.ByteBuffer&&(o=r,r={}),(r=r||{}).output=o,r.iv=e,i.call(t,r)},t}},59205:(e,t,r)=>{var n=r(3832);r(3068);var i=n.asn1;t.privateKeyValidator={name:"PrivateKeyInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},t.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,composed:!0,captureBitStringValue:"ed25519PublicKey"}]}},3068:(e,t,r)=>{var n=r(3832);r(97116),r(66270);var i=e.exports=n.asn1=n.asn1||{};function o(e,t,r){if(r>t){var n=new Error("Too few bytes to parse DER.");throw n.available=e.length(),n.remaining=t,n.requested=r,n}}function s(e,t,r,n){var a;o(e,t,2);var c=e.getByte();t--;var u=192&c,f=31&c;a=e.length();var l,h,d=function(e,t){var r=e.getByte();if(t--,128!==r){var n;if(128&r){var i=127&r;o(e,t,i),n=e.getInt(i<<3)}else n=r;if(n<0)throw new Error("Negative length: "+n);return n}}(e,t);if(t-=a-e.length(),void 0!==d&&d>t){if(n.strict){var p=new Error("Too few bytes to read ASN.1 value.");throw p.available=e.length(),p.remaining=t,p.requested=d,p}d=t}var y=32==(32&c);if(y)if(l=[],void 0===d)for(;;){if(o(e,t,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),t-=2;break}a=e.length(),l.push(s(e,t,r+1,n)),t-=a-e.length()}else for(;d>0;)a=e.length(),l.push(s(e,d,r+1,n)),t-=a-e.length(),d-=a-e.length();if(void 0===l&&u===i.Class.UNIVERSAL&&f===i.Type.BITSTRING&&(h=e.bytes(d)),void 0===l&&n.decodeBitStrings&&u===i.Class.UNIVERSAL&&f===i.Type.BITSTRING&&d>1){var g=e.read,b=t,m=0;if(f===i.Type.BITSTRING&&(o(e,t,1),m=e.getByte(),t--),0===m)try{a=e.length();var v=s(e,t,r+1,{verbose:n.verbose,strict:!0,decodeBitStrings:!0}),w=a-e.length();t-=w,f==i.Type.BITSTRING&&w++;var E=v.tagClass;w!==d||E!==i.Class.UNIVERSAL&&E!==i.Class.CONTEXT_SPECIFIC||(l=[v])}catch(e){}void 0===l&&(e.read=g,t=b)}if(void 0===l){if(void 0===d){if(n.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");d=t}if(f===i.Type.BMPSTRING)for(l="";d>0;d-=2)o(e,t,2),l+=String.fromCharCode(e.getInt16()),t-=2;else l=e.getBytes(d)}var _=void 0===h?null:{bitStringContents:h};return i.create(u,f,y,l,_)}i.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},i.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},i.create=function(e,t,r,o,s){if(n.util.isArray(o)){for(var a=[],c=0;c1&&(0===e.value.charCodeAt(0)&&0==(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128==(128&e.value.charCodeAt(1)))?o.putBytes(e.value.substr(1)):o.putBytes(e.value);if(t.putByte(r),o.length()<=127)t.putByte(127&o.length());else{var c=o.length(),u="";do{u+=String.fromCharCode(255&c),c>>>=8}while(c>0);for(t.putByte(128|u.length),a=u.length-1;a>=0;--a)t.putByte(u.charCodeAt(a))}return t.putBuffer(o),t},i.oidToDer=function(e){var t,r,i,o,s=e.split("."),a=n.util.createBuffer();a.putByte(40*parseInt(s[0],10)+parseInt(s[1],10));for(var c=2;c>>=7,t||(o|=128),r.push(o),t=!1}while(i>0);for(var u=r.length-1;u>=0;--u)a.putByte(r[u])}return a},i.derToOid=function(e){var t;"string"==typeof e&&(e=n.util.createBuffer(e));var r=e.getByte();t=Math.floor(r/40)+"."+r%40;for(var i=0;e.length()>0;)i<<=7,128&(r=e.getByte())?i+=127&r:(t+="."+(i+r),i=0);return t},i.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(e.substr(2,2),10)-1,i=parseInt(e.substr(4,2),10),o=parseInt(e.substr(6,2),10),s=parseInt(e.substr(8,2),10),a=0;if(e.length>11){var c=e.charAt(10),u=10;"+"!==c&&"-"!==c&&(a=parseInt(e.substr(10,2),10),u+=2)}if(t.setUTCFullYear(r,n,i),t.setUTCHours(o,s,a,0),u&&("+"===(c=e.charAt(u))||"-"===c)){var f=60*parseInt(e.substr(u+1,2),10)+parseInt(e.substr(u+4,2),10);f*=6e4,"+"===c?t.setTime(+t-f):t.setTime(+t+f)}return t},i.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),n=parseInt(e.substr(4,2),10)-1,i=parseInt(e.substr(6,2),10),o=parseInt(e.substr(8,2),10),s=parseInt(e.substr(10,2),10),a=parseInt(e.substr(12,2),10),c=0,u=0,f=!1;"Z"===e.charAt(e.length-1)&&(f=!0);var l=e.length-5,h=e.charAt(l);return"+"!==h&&"-"!==h||(u=60*parseInt(e.substr(l+1,2),10)+parseInt(e.substr(l+4,2),10),u*=6e4,"+"===h&&(u*=-1),f=!0),"."===e.charAt(14)&&(c=1e3*parseFloat(e.substr(14),10)),f?(t.setUTCFullYear(r,n,i),t.setUTCHours(o,s,a,c),t.setTime(+t+u)):(t.setFullYear(r,n,i),t.setHours(o,s,a,c)),t},i.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=e,r},i.derToInteger=function(e){"string"==typeof e&&(e=n.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},i.validate=function(e,t,r,o){var s=!1;if(e.tagClass!==t.tagClass&&void 0!==t.tagClass||e.type!==t.type&&void 0!==t.type)o&&(e.tagClass!==t.tagClass&&o.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&o.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||void 0===t.constructed){if(s=!0,t.value&&n.util.isArray(t.value))for(var a=0,c=0;s&&c0&&(o+="\n");for(var s="",c=0;c1?o+="0x"+n.util.bytesToHex(e.value.slice(1)):o+="(none)",e.value.length>0){var h=e.value.charCodeAt(0);1==h?o+=" (1 unused bit shown)":h>1&&(o+=" ("+h+" unused bits shown)")}}else e.type===i.Type.OCTETSTRING?(a.test(e.value)||(o+="("+e.value+") "),o+="0x"+n.util.bytesToHex(e.value)):e.type===i.Type.UTF8?o+=n.util.decodeUtf8(e.value):e.type===i.Type.PRINTABLESTRING||e.type===i.Type.IA5String?o+=e.value:a.test(e.value)?o+="0x"+n.util.bytesToHex(e.value):0===e.value.length?o+="[null]":o+=e.value}return o}},78807:e=>{var t={};e.exports=t;var r={};t.encode=function(e,t,r){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==r&&"number"!=typeof r)throw new TypeError('"maxline" must be a number.');var n="";if(e instanceof Uint8Array){var i=0,o=t.length,s=t.charAt(0),a=[0];for(i=0;i0;)a.push(u%o),u=u/o|0}for(i=0;0===e[i]&&i=0;--i)n+=t[a[i]]}else n=function(e,t){var r=0,n=t.length,i=t.charAt(0),o=[0];for(r=0;r0;)o.push(a%n),a=a/n|0}var c="";for(r=0;0===e.at(r)&&r=0;--r)c+=t[o[r]];return c}(e,t);if(r){var f=new RegExp(".{1,"+r+"}","g");n=n.match(f).join("\r\n")}return n},t.decode=function(e,t){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');var n=r[t];if(!n){n=r[t]=[];for(var i=0;i>=8;for(;f>0;)a.push(255&f),f>>=8}for(var l=0;e[l]===s&&l{var n=r(3832);r(97116),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return(e=e.toUpperCase())in n.cipher.algorithms?n.cipher.algorithms[e]:null};var i=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};i.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},i.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},i.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t)||(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t)||this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},61967:(e,t,r)=>{var n=r(3832);r(97116),n.cipher=n.cipher||{};var i=e.exports=n.cipher.modes=n.cipher.modes||{};function o(e,t){if("string"==typeof e&&(e=n.util.createBuffer(e)),n.util.isArray(e)&&e.length>4){var r=e;e=n.util.createBuffer();for(var i=0;i0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2||(e.truncate(n),0))},i.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},i.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv,this.blockSize),this._prev=this._iv.slice(0)}},i.cbc.prototype.encrypt=function(e,t,r){if(e.length()0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2||(e.truncate(n),0))},i.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear(),i=0;i0)e.read-=this.blockSize;else for(i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear(),i=0;i0)e.read-=this.blockSize;else for(i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear(),i=0;i0)e.read-=this.blockSize;else for(i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.ofb.prototype.decrypt=i.ofb.prototype.encrypt,i.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear(),i=0;i0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}s(this._inBlock)},i.ctr.prototype.decrypt=i.ctr.prototype.encrypt,i.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0,this._R=3774873600},i.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t,r=n.util.createBuffer(e.iv);if(this._cipherLength=0,t="additionalData"in e?n.util.createBuffer(e.additionalData):n.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=n.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var i=r.length();if(12===i)this._j0=[r.getInt32(),r.getInt32(),r.getInt32(),1];else{for(this._j0=[0,0,0,0];r.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(a(8*i)))}this._inBlock=this._j0.slice(0),s(this._inBlock),this._partialBytes=0,t=n.util.createBuffer(t),this._aDataLength=a(8*t.length());var o=t.length()%this.blockSize;for(o&&t.fillWithByte(0,this.blockSize-o),this._s=[0,0,0,0];t.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()])},i.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear(),i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),s(this._inBlock)},i.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),s(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},i.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=e[r/8|0]>>>4*(7-r%8)&15,i=this._m[r][n];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3]}return t},i.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},i.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,i=16*r,o=new Array(i),s=0;s>>1,i=new Array(r);i[n]=e.slice(0);for(var o=n>>>1;o>0;)this.pow(i[2*o],i[o]=[]),o>>=1;for(o=2;o{var n=r(3832);function i(e,t){n.cipher.registerAlgorithm(e,(function(){return new n.des.Algorithm(e,t)}))}r(85649),r(61967),r(97116),e.exports=n.des=n.des||{},n.des.startEncrypting=function(e,t,r,n){var i=p({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return i.start(t),i},n.des.createEncryptionCipher=function(e,t){return p({key:e,output:null,decrypt:!1,mode:t})},n.des.startDecrypting=function(e,t,r,n){var i=p({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return i.start(t),i},n.des.createDecryptionCipher=function(e,t){return p({key:e,output:null,decrypt:!0,mode:t})},n.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return d(r._keys,e,t,!1)},decrypt:function(e,t){return d(r._keys,e,t,!0)}}}),r._init=!1},n.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=n.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=function(e){for(var t,r=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],n=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],i=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],o=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],s=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],a=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],c=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],u=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],f=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],l=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],h=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],d=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],p=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],y=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],g=e.length()>8?3:1,b=[],m=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],v=0,w=0;w>>4^_))<<4,E^=t=65535&((_^=t)>>>-16^E),E^=(t=858993459&(E>>>2^(_^=t<<-16)))<<2,E^=t=65535&((_^=t)>>>-16^E),E^=(t=1431655765&(E>>>1^(_^=t<<-16)))<<1,E^=t=16711935&((_^=t)>>>8^E),t=(E^=(t=1431655765&(E>>>1^(_^=t<<8)))<<1)<<8|(_^=t)>>>20&240,E=_<<24|_<<8&16711680|_>>>8&65280|_>>>24&240,_=t;for(var S=0;S>>26,_=_<<2|_>>>26):(E=E<<1|E>>>27,_=_<<1|_>>>27);var A=r[(E&=-15)>>>28]|n[E>>>24&15]|i[E>>>20&15]|o[E>>>16&15]|s[E>>>12&15]|a[E>>>8&15]|c[E>>>4&15],T=u[(_&=-15)>>>28]|f[_>>>24&15]|l[_>>>20&15]|h[_>>>16&15]|d[_>>>12&15]|p[_>>>8&15]|y[_>>>4&15];t=65535&(T>>>16^A),b[v++]=A^t,b[v++]=T^t<<16}}return b}(t),this._init=!0}},i("DES-ECB",n.cipher.modes.ecb),i("DES-CBC",n.cipher.modes.cbc),i("DES-CFB",n.cipher.modes.cfb),i("DES-OFB",n.cipher.modes.ofb),i("DES-CTR",n.cipher.modes.ctr),i("3DES-ECB",n.cipher.modes.ecb),i("3DES-CBC",n.cipher.modes.cbc),i("3DES-CFB",n.cipher.modes.cfb),i("3DES-OFB",n.cipher.modes.ofb),i("3DES-CTR",n.cipher.modes.ctr);var o=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],s=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],a=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],c=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],u=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],f=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],l=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],h=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function d(e,t,r,n){var i,d,p=32===e.length?3:9;i=3===p?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var y=t[0],g=t[1];y^=(d=252645135&(y>>>4^g))<<4,y^=(d=65535&(y>>>16^(g^=d)))<<16,y^=d=858993459&((g^=d)>>>2^y),y^=d=16711935&((g^=d<<2)>>>8^y),y=(y^=(d=1431655765&(y>>>1^(g^=d<<8)))<<1)<<1|y>>>31,g=(g^=d)<<1|g>>>31;for(var b=0;b>>4|g<<28)^e[w+1];d=y,y=g,g=d^(s[E>>>24&63]|c[E>>>16&63]|f[E>>>8&63]|h[63&E]|o[_>>>24&63]|a[_>>>16&63]|u[_>>>8&63]|l[63&_])}d=y,y=g,g=d}g=g>>>1|g<<31,g^=d=1431655765&((y=y>>>1|y<<31)>>>1^g),g^=(d=16711935&(g>>>8^(y^=d<<1)))<<8,g^=(d=858993459&(g>>>2^(y^=d)))<<2,g^=d=65535&((y^=d)>>>16^g),g^=d=252645135&((y^=d<<16)>>>4^g),y^=d<<4,r[0]=y,r[1]=g}function p(e){var t,r="DES-"+((e=e||{}).mode||"CBC").toUpperCase(),i=(t=e.decrypt?n.cipher.createDecipher(r,e.key):n.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var o=null;r instanceof n.util.ByteBuffer&&(o=r,r={}),(r=r||{}).output=o,r.iv=e,i.call(t,r)},t}},80069:(e,t,r)=>{var n=r(3832);r(15764),r(49563),r(63219),r(97116);var i=r(59205),o=i.publicKeyValidator,s=i.privateKeyValidator;if(void 0===a)var a=n.jsbn.BigInteger;var c=n.util.ByteBuffer,u="undefined"==typeof Buffer?Uint8Array:Buffer;n.pki=n.pki||{},e.exports=n.pki.ed25519=n.ed25519=n.ed25519||{};var f=n.ed25519;function l(e){var t=e.message;if(t instanceof Uint8Array||t instanceof u)return t;var r=e.encoding;if(void 0===t){if(!e.md)throw new TypeError('"options.message" or "options.md" not specified.');t=e.md.digest().getBytes(),r="binary"}if("string"==typeof t&&!r)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if("string"==typeof t){if("undefined"!=typeof Buffer)return Buffer.from(t,r);t=new c(t,r)}else if(!(t instanceof c))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');for(var n=new u(t.length()),i=0;i=0;--r)K(n,n),1!==r&&U(n,n,t);for(r=0;r<16;++r)e[r]=n[r]}(r,r),U(r,r,i),U(r,r,o),U(r,r,o),U(e[0],r,o),K(n,e[0]),U(n,n,o),C(n,i)&&U(e[0],e[0],v),K(n,e[0]),U(n,n,o),C(n,i)?-1:(R(e[0])===t[31]>>7&&D(e[0],h,e[0]),U(e[3],e[0],e[1]),0)}(a,n))return-1;for(i=0;i=0};var h=N(),d=N([1]),p=N([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),y=N([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),g=N([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),b=N([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),m=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),v=N([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function w(e,t){var r=n.md.sha512.create(),i=new c(e);r.update(i.getBytes(t),"binary");var o=r.digest().getBytes();if("undefined"!=typeof Buffer)return Buffer.from(o,"binary");for(var s=new u(f.constants.HASH_BYTE_LENGTH),a=0;a<64;++a)s[a]=o.charCodeAt(a);return s}function E(e,t){var r,n,i,o;for(n=63;n>=32;--n){for(r=0,i=n-32,o=n-12;i>8,t[i]-=256*r;t[i]+=r,t[n]=0}for(r=0,i=0;i<32;++i)t[i]+=r-(t[31]>>4)*m[i],r=t[i]>>8,t[i]&=255;for(i=0;i<32;++i)t[i]-=r*m[i];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function _(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;E(e,t)}function S(e,t){var r=N(),n=N(),i=N(),o=N(),s=N(),a=N(),c=N(),u=N(),f=N();D(r,e[1],e[0]),D(f,t[1],t[0]),U(r,r,f),L(n,e[0],e[1]),L(f,t[0],t[1]),U(n,n,f),U(i,e[3],t[3]),U(i,i,y),U(o,e[2],t[2]),L(o,o,o),D(s,n,r),D(a,o,i),L(c,o,i),L(u,n,r),U(e[0],s,a),U(e[1],u,c),U(e[2],c,a),U(e[3],s,u)}function A(e,t,r){for(var n=0;n<4;++n)O(e[n],t[n],r)}function T(e,t){var r=N(),n=N(),i=N();!function(e,t){var r,n=N();for(r=0;r<16;++r)n[r]=t[r];for(r=253;r>=0;--r)K(n,n),2!==r&&4!==r&&U(n,n,t);for(r=0;r<16;++r)e[r]=n[r]}(i,t[2]),U(r,t[0],i),U(n,t[1],i),I(e,n),e[31]^=R(r)<<7}function I(e,t){var r,n,i,o=N(),s=N();for(r=0;r<16;++r)s[r]=t[r];for(M(s),M(s),M(s),n=0;n<2;++n){for(o[0]=s[0]-65517,r=1;r<15;++r)o[r]=s[r]-65535-(o[r-1]>>16&1),o[r-1]&=65535;o[15]=s[15]-32767-(o[14]>>16&1),i=o[15]>>16&1,o[14]&=65535,O(s,o,1-i)}for(r=0;r<16;r++)e[2*r]=255&s[r],e[2*r+1]=s[r]>>8}function C(e,t){var r=new u(32),n=new u(32);return I(r,e),I(n,t),P(r,0,n,0)}function P(e,t,r,n){return function(e,t,r,n,i){var o,s=0;for(o=0;o<32;++o)s|=e[t+o]^r[n+o];return(1&s-1>>>8)-1}(e,t,r,n)}function R(e){var t=new u(32);return I(t,e),1&t[0]}function k(e,t,r){var n,i;for(x(e[0],h),x(e[1],d),x(e[2],d),x(e[3],h),i=255;i>=0;--i)A(e,t,n=r[i/8|0]>>(7&i)&1),S(t,e),S(e,e),A(e,t,n)}function B(e,t){var r=[N(),N(),N(),N()];x(r[0],g),x(r[1],b),x(r[2],d),U(r[3],g,b),k(e,r,t)}function x(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function M(e){var t,r,n=1;for(t=0;t<16;++t)r=e[t]+n+65535,n=Math.floor(r/65536),e[t]=r-65536*n;e[0]+=n-1+37*(n-1)}function O(e,t,r){for(var n,i=~(r-1),o=0;o<16;++o)n=i&(e[o]^t[o]),e[o]^=n,t[o]^=n}function N(e){var t,r=new Float64Array(16);if(e)for(t=0;t{e.exports={options:{usePureJavaScript:!1}}},36607:(e,t,r)=>{var n=r(3832);r(28991),r(97116),(e.exports=n.hmac=n.hmac||{}).create=function(){var e=null,t=null,r=null,i=null,o={start:function(o,s){if(null!==o)if("string"==typeof o){if(!((o=o.toLowerCase())in n.md.algorithms))throw new Error('Unknown hash algorithm "'+o+'"');t=n.md.algorithms[o].create()}else t=o;if(null===s)s=e;else{if("string"==typeof s)s=n.util.createBuffer(s);else if(n.util.isArray(s)){var a=s;s=n.util.createBuffer();for(var c=0;ct.blockLength&&(t.start(),t.update(s.bytes()),s=t.digest()),r=n.util.createBuffer(),i=n.util.createBuffer(),u=s.length(),c=0;c{var n,i=r(3832);function o(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function s(){return new o(null)}function a(e,t,r,n,i,o){for(var s=16383&t,a=t>>14;--o>=0;){var c=16383&this.data[e],u=this.data[e++]>>14,f=a*c+u*s;i=((c=s*c+((16383&f)<<14)+r.data[n]+i)>>28)+(f>>14)+a*u,r.data[n++]=268435455&c}return i}e.exports=i.jsbn=i.jsbn||{},i.jsbn.BigInteger=o,"undefined"==typeof navigator?(o.prototype.am=a,n=28):"Microsoft Internet Explorer"==navigator.appName?(o.prototype.am=function(e,t,r,n,i,o){for(var s=32767&t,a=t>>15;--o>=0;){var c=32767&this.data[e],u=this.data[e++]>>15,f=a*c+u*s;i=((c=s*c+((32767&f)<<15)+r.data[n]+(1073741823&i))>>>30)+(f>>>15)+a*u+(i>>>30),r.data[n++]=1073741823&c}return i},n=30):"Netscape"!=navigator.appName?(o.prototype.am=function(e,t,r,n,i,o){for(;--o>=0;){var s=t*this.data[e++]+r.data[n]+i;i=Math.floor(s/67108864),r.data[n++]=67108863&s}return i},n=26):(o.prototype.am=a,n=28),o.prototype.DB=n,o.prototype.DM=(1<>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function y(e){this.m=e}function g(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function _(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function S(){}function A(e){return e}function T(e){this.r2=s(),this.q3=s(),o.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}y.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},y.prototype.revert=function(e){return e},y.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},y.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},y.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},g.prototype.convert=function(e){var t=s();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(o.ZERO)>0&&this.m.subTo(t,t),t},g.prototype.revert=function(e){var t=s();return e.copyTo(t),this.reduce(t),t},g.prototype.reduce=function(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e.data[r]+=this.m.am(0,n,e,t,0,this.m.t);e.data[r]>=e.DV;)e.data[r]-=e.DV,e.data[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},g.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},g.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},o.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s},o.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0},o.prototype.fromString=function(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var n=e.length,i=!1,s=0;--n>=0;){var a=8==r?255&e[n]:h(e,n);a<0?"-"==e.charAt(n)&&(i=!0):(i=!1,0==s?this.data[this.t++]=a:s+r>this.DB?(this.data[this.t-1]|=(a&(1<>this.DB-s):this.data[this.t-1]|=a<=this.DB&&(s-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,s>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==e;)--this.t},o.prototype.dlShiftTo=function(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s},o.prototype.drShiftTo=function(e,t){for(var r=e;r=0;--r)t.data[r+s+1]=this.data[r]>>i|a,a=(this.data[r]&o)<=0;--r)t.data[r]=0;t.data[s]=a,t.t=this.t+s+1,t.s=this.s,t.clamp()},o.prototype.rShiftTo=function(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var n=e%this.DB,i=this.DB-n,o=(1<>n;for(var s=r+1;s>n;n>0&&(t.data[this.t-r-1]|=(this.s&o)<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()},o.prototype.multiplyTo=function(e,t){var r=this.abs(),n=e.abs(),i=r.t;for(t.t=i+n.t;--i>=0;)t.data[i]=0;for(i=0;i=0;)e.data[r]=0;for(r=0;r=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()},o.prototype.divRemTo=function(e,t,r){var n=e.abs();if(!(n.t<=0)){var i=this.abs();if(i.t0?(n.lShiftTo(f,a),i.lShiftTo(f,r)):(n.copyTo(a),i.copyTo(r));var l=a.t,h=a.data[l-1];if(0!=h){var d=h*(1<1?a.data[l-2]>>this.F2:0),y=this.FV/d,g=(1<=0&&(r.data[r.t++]=1,r.subTo(w,r)),o.ONE.dlShiftTo(l,w),w.subTo(a,a);a.t=0;){var E=r.data[--m]==h?this.DM:Math.floor(r.data[m]*y+(r.data[m-1]+b)*g);if((r.data[m]+=a.am(0,E,r,v,0,l))0&&r.rShiftTo(f,r),c<0&&o.ZERO.subTo(r,r)}}},o.prototype.invDigit=function(){if(this.t<1)return 0;var e=this.data[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},o.prototype.isEven=function(){return 0==(this.t>0?1&this.data[0]:this.s)},o.prototype.exp=function(e,t){if(e>4294967295||e<1)return o.ONE;var r=s(),n=s(),i=t.convert(this),a=p(e)-1;for(i.copyTo(r);--a>=0;)if(t.sqrTo(r,n),(e&1<0)t.mulTo(n,i,r);else{var c=r;r=n,n=c}return t.revert(r)},o.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<0)for(a>a)>0&&(i=!0,o=l(r));s>=0;)a>(a+=this.DB-t)):(r=this.data[s]>>(a-=t)&n,a<=0&&(a+=this.DB,--s)),r>0&&(i=!0),i&&(o+=l(r));return i?o:"0"},o.prototype.negate=function(){var e=s();return o.ZERO.subTo(this,e),e},o.prototype.abs=function(){return this.s<0?this.negate():this},o.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0},o.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+p(this.data[this.t-1]^this.s&this.DM)},o.prototype.mod=function(e){var t=s();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(o.ZERO)>0&&e.subTo(t,t),t},o.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new y(t):new g(t),this.exp(e,r)},o.ZERO=d(0),o.ONE=d(1),S.prototype.convert=A,S.prototype.revert=A,S.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},S.prototype.sqrTo=function(e,t){e.squareTo(t)},T.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=s();return e.copyTo(t),this.reduce(t),t},T.prototype.revert=function(e){return e},T.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},T.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},T.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var I=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],C=(1<<26)/I[I.length-1];o.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},o.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=d(r),i=s(),o=s(),a="";for(this.divRemTo(n,i,o);i.signum()>0;)a=(r+o.intValue()).toString(e).substr(1)+a,i.divRemTo(n,i,o);return o.intValue().toString(e)+a},o.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),i=!1,s=0,a=0,c=0;c=r&&(this.dMultiply(n),this.dAddOffset(a,0),s=0,a=0))}s>0&&(this.dMultiply(Math.pow(t,s)),this.dAddOffset(a,0)),i&&o.ZERO.subTo(this,this)},o.prototype.fromNumber=function(e,t,r){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(o.ONE.shiftLeft(e-1),m,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(o.ONE.shiftLeft(e-1),this);else{var n=new Array,i=7&e;n.length=1+(e>>3),t.nextBytes(n),i>0?n[0]&=(1<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t.data[r++]=n:n<-1&&(t.data[r++]=this.DV+n),t.t=r,t.clamp()},o.prototype.dMultiply=function(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},o.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}},o.prototype.multiplyLowerTo=function(e,t,r){var n,i=Math.min(this.t+e.t,t);for(r.s=0,r.t=i;i>0;)r.data[--i]=0;for(n=r.t-this.t;i=0;)r.data[n]=0;for(n=Math.max(t-this.t,0);n0)if(0==t)r=this.data[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this.data[n])%e;return r},o.prototype.millerRabin=function(e){var t=this.subtract(o.ONE),r=t.getLowestSetBit();if(r<=0)return!1;for(var n,i=t.shiftRight(r),s={nextBytes:function(e){for(var t=0;t=0);var c=n.modPow(i,this);if(0!=c.compareTo(o.ONE)&&0!=c.compareTo(t)){for(var u=1;u++>24},o.prototype.shortValue=function(){return 0==this.t?this.s:this.data[0]<<16>>16},o.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1},o.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var r,n=this.DB-e*this.DB%8,i=0;if(e-- >0)for(n>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<=0;)n<8?(r=(this.data[e]&(1<>(n+=this.DB-8)):(r=this.data[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(t[i++]=r);return t},o.prototype.equals=function(e){return 0==this.compareTo(e)},o.prototype.min=function(e){return this.compareTo(e)<0?this:e},o.prototype.max=function(e){return this.compareTo(e)>0?this:e},o.prototype.and=function(e){var t=s();return this.bitwiseTo(e,b,t),t},o.prototype.or=function(e){var t=s();return this.bitwiseTo(e,m,t),t},o.prototype.xor=function(e){var t=s();return this.bitwiseTo(e,v,t),t},o.prototype.andNot=function(e){var t=s();return this.bitwiseTo(e,w,t),t},o.prototype.not=function(){for(var e=s(),t=0;t=this.t?0!=this.s:0!=(this.data[t]&1<1){var l=s();for(n.sqrTo(a[1],l);c<=f;)a[c]=s(),n.mulTo(l,a[c-2],a[c]),c+=2}var h,b,m=e.t-1,v=!0,w=s();for(i=p(e.data[m])-1;m>=0;){for(i>=u?h=e.data[m]>>i-u&f:(h=(e.data[m]&(1<0&&(h|=e.data[m-1]>>this.DB+i-u)),c=r;0==(1&h);)h>>=1,--c;if((i-=c)<0&&(i+=this.DB,--m),v)a[h].copyTo(o),v=!1;else{for(;c>1;)n.sqrTo(o,w),n.sqrTo(w,o),c-=2;c>0?n.sqrTo(o,w):(b=o,o=w,w=b),n.mulTo(w,a[h],o)}for(;m>=0&&0==(e.data[m]&1<=0?(r.subTo(n,r),t&&i.subTo(a,i),s.subTo(c,s)):(n.subTo(r,n),t&&a.subTo(i,a),c.subTo(s,c))}return 0!=n.compareTo(o.ONE)?o.ZERO:c.compareTo(e)>=0?c.subtract(e):c.signum()<0?(c.addTo(e,c),c.signum()<0?c.add(e):c):c},o.prototype.pow=function(e){return this.exp(e,new S)},o.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var i=t.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return t;for(i0&&(t.rShiftTo(o,t),r.rShiftTo(o,r));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r},o.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r.data[0]<=I[I.length-1]){for(t=0;t{var n=r(3832);e.exports=n.md=n.md||{},n.md.algorithms=n.md.algorithms||{}},86971:(e,t,r)=>{var n=r(3832);r(83453),e.exports=n.mgf=n.mgf||{},n.mgf.mgf1=n.mgf1},83453:(e,t,r)=>{var n=r(3832);r(97116),n.mgf=n.mgf||{},(e.exports=n.mgf.mgf1=n.mgf1=n.mgf1||{}).create=function(e){return{generate:function(t,r){for(var i=new n.util.ByteBuffer,o=Math.ceil(r/e.digestLength),s=0;s{var n=r(3832);n.pki=n.pki||{};var i=e.exports=n.pki.oids=n.oids=n.oids||{};function o(e,t){i[e]=t,i[t]=e}function s(e,t){i[e]=t}o("1.2.840.113549.1.1.1","rsaEncryption"),o("1.2.840.113549.1.1.4","md5WithRSAEncryption"),o("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),o("1.2.840.113549.1.1.7","RSAES-OAEP"),o("1.2.840.113549.1.1.8","mgf1"),o("1.2.840.113549.1.1.9","pSpecified"),o("1.2.840.113549.1.1.10","RSASSA-PSS"),o("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),o("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),o("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),o("1.3.101.112","EdDSA25519"),o("1.2.840.10040.4.3","dsa-with-sha1"),o("1.3.14.3.2.7","desCBC"),o("1.3.14.3.2.26","sha1"),o("2.16.840.1.101.3.4.2.1","sha256"),o("2.16.840.1.101.3.4.2.2","sha384"),o("2.16.840.1.101.3.4.2.3","sha512"),o("1.2.840.113549.2.5","md5"),o("1.2.840.113549.1.7.1","data"),o("1.2.840.113549.1.7.2","signedData"),o("1.2.840.113549.1.7.3","envelopedData"),o("1.2.840.113549.1.7.4","signedAndEnvelopedData"),o("1.2.840.113549.1.7.5","digestedData"),o("1.2.840.113549.1.7.6","encryptedData"),o("1.2.840.113549.1.9.1","emailAddress"),o("1.2.840.113549.1.9.2","unstructuredName"),o("1.2.840.113549.1.9.3","contentType"),o("1.2.840.113549.1.9.4","messageDigest"),o("1.2.840.113549.1.9.5","signingTime"),o("1.2.840.113549.1.9.6","counterSignature"),o("1.2.840.113549.1.9.7","challengePassword"),o("1.2.840.113549.1.9.8","unstructuredAddress"),o("1.2.840.113549.1.9.14","extensionRequest"),o("1.2.840.113549.1.9.20","friendlyName"),o("1.2.840.113549.1.9.21","localKeyId"),o("1.2.840.113549.1.9.22.1","x509Certificate"),o("1.2.840.113549.1.12.10.1.1","keyBag"),o("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),o("1.2.840.113549.1.12.10.1.3","certBag"),o("1.2.840.113549.1.12.10.1.4","crlBag"),o("1.2.840.113549.1.12.10.1.5","secretBag"),o("1.2.840.113549.1.12.10.1.6","safeContentsBag"),o("1.2.840.113549.1.5.13","pkcs5PBES2"),o("1.2.840.113549.1.5.12","pkcs5PBKDF2"),o("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),o("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),o("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),o("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),o("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),o("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),o("1.2.840.113549.2.7","hmacWithSHA1"),o("1.2.840.113549.2.8","hmacWithSHA224"),o("1.2.840.113549.2.9","hmacWithSHA256"),o("1.2.840.113549.2.10","hmacWithSHA384"),o("1.2.840.113549.2.11","hmacWithSHA512"),o("1.2.840.113549.3.7","des-EDE3-CBC"),o("2.16.840.1.101.3.4.1.2","aes128-CBC"),o("2.16.840.1.101.3.4.1.22","aes192-CBC"),o("2.16.840.1.101.3.4.1.42","aes256-CBC"),o("2.5.4.3","commonName"),o("2.5.4.5","serialName"),o("2.5.4.6","countryName"),o("2.5.4.7","localityName"),o("2.5.4.8","stateOrProvinceName"),o("2.5.4.9","streetAddress"),o("2.5.4.10","organizationName"),o("2.5.4.11","organizationalUnitName"),o("2.5.4.13","description"),o("2.5.4.15","businessCategory"),o("2.5.4.17","postalCode"),o("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),o("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),o("2.16.840.1.113730.1.1","nsCertType"),o("2.16.840.1.113730.1.13","nsComment"),s("2.5.29.1","authorityKeyIdentifier"),s("2.5.29.2","keyAttributes"),s("2.5.29.3","certificatePolicies"),s("2.5.29.4","keyUsageRestriction"),s("2.5.29.5","policyMapping"),s("2.5.29.6","subtreesConstraint"),s("2.5.29.7","subjectAltName"),s("2.5.29.8","issuerAltName"),s("2.5.29.9","subjectDirectoryAttributes"),s("2.5.29.10","basicConstraints"),s("2.5.29.11","nameConstraints"),s("2.5.29.12","policyConstraints"),s("2.5.29.13","basicConstraints"),o("2.5.29.14","subjectKeyIdentifier"),o("2.5.29.15","keyUsage"),s("2.5.29.16","privateKeyUsagePeriod"),o("2.5.29.17","subjectAltName"),o("2.5.29.18","issuerAltName"),o("2.5.29.19","basicConstraints"),s("2.5.29.20","cRLNumber"),s("2.5.29.21","cRLReason"),s("2.5.29.22","expirationDate"),s("2.5.29.23","instructionCode"),s("2.5.29.24","invalidityDate"),s("2.5.29.25","cRLDistributionPoints"),s("2.5.29.26","issuingDistributionPoint"),s("2.5.29.27","deltaCRLIndicator"),s("2.5.29.28","issuingDistributionPoint"),s("2.5.29.29","certificateIssuer"),s("2.5.29.30","nameConstraints"),o("2.5.29.31","cRLDistributionPoints"),o("2.5.29.32","certificatePolicies"),s("2.5.29.33","policyMappings"),s("2.5.29.34","policyConstraints"),o("2.5.29.35","authorityKeyIdentifier"),s("2.5.29.36","policyConstraints"),o("2.5.29.37","extKeyUsage"),s("2.5.29.46","freshestCRL"),s("2.5.29.54","inhibitAnyPolicy"),o("1.3.6.1.4.1.11129.2.4.2","timestampList"),o("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),o("1.3.6.1.5.5.7.3.1","serverAuth"),o("1.3.6.1.5.5.7.3.2","clientAuth"),o("1.3.6.1.5.5.7.3.3","codeSigning"),o("1.3.6.1.5.5.7.3.4","emailProtection"),o("1.3.6.1.5.5.7.3.8","timeStamping")},97450:(e,t,r)=>{var n=r(3832);if(r(8925),r(3068),r(33480),r(28991),r(66270),r(98960),r(26953),r(49563),r(69372),r(28095),r(97116),void 0===i)var i=n.jsbn.BigInteger;var o=n.asn1,s=n.pki=n.pki||{};e.exports=s.pbe=n.pbe=n.pbe||{};var a=s.oids,c={name:"EncryptedPrivateKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},u={name:"PBES2Algorithms",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},f={name:"pkcs-12PbeParams",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"iterations"}]};function l(e,t){return e.start().update(t).digest().getBytes()}function h(e){var t;if(e){if(!(t=s.oids[o.derToOid(e)])){var r=new Error("Unsupported PRF OID.");throw r.oid=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}}else t="hmacWithSHA1";return d(t)}function d(e){var t=n.md;switch(e){case"hmacWithSHA224":t=n.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":e=e.substr(8).toLowerCase();break;default:var r=new Error("Unsupported PRF algorithm.");throw r.algorithm=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}if(!t||!(e in t))throw new Error("Unknown hash algorithm: "+e);return t[e].create()}s.encryptPrivateKeyInfo=function(e,t,r){(r=r||{}).saltSize=r.saltSize||8,r.count=r.count||2048,r.algorithm=r.algorithm||"aes128",r.prfAlgorithm=r.prfAlgorithm||"sha1";var i,c,u,f=n.random.getBytesSync(r.saltSize),l=r.count,h=o.integerToDer(l);if(0===r.algorithm.indexOf("aes")||"des"===r.algorithm){var p,y,g;switch(r.algorithm){case"aes128":i=16,p=16,y=a["aes128-CBC"],g=n.aes.createEncryptionCipher;break;case"aes192":i=24,p=16,y=a["aes192-CBC"],g=n.aes.createEncryptionCipher;break;case"aes256":i=32,p=16,y=a["aes256-CBC"],g=n.aes.createEncryptionCipher;break;case"des":i=8,p=8,y=a.desCBC,g=n.des.createEncryptionCipher;break;default:throw(_=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,_}var b="hmacWith"+r.prfAlgorithm.toUpperCase(),m=d(b),v=n.pkcs5.pbkdf2(t,f,l,i,m),w=n.random.getBytesSync(p);(S=g(v)).start(w),S.update(o.toDer(e)),S.finish(),u=S.output.getBytes();var E=function(e,t,r,i){var a=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,e),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,t.getBytes())]);return"hmacWithSHA1"!==i&&a.value.push(o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,n.util.hexToBytes(r.toString(16))),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(s.oids[i]).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")])),a}(f,h,i,b);c=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a.pkcs5PBES2).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a.pkcs5PBKDF2).getBytes()),E]),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(y).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,w)])])])}else{var _;if("3des"!==r.algorithm)throw(_=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,_;i=24;var S,A=new n.util.ByteBuffer(f);v=s.pbe.generatePkcs12Key(t,A,1,l,i),w=s.pbe.generatePkcs12Key(t,A,2,l,i),(S=n.des.createEncryptionCipher(v)).start(w),S.update(o.toDer(e)),S.finish(),u=S.output.getBytes(),c=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,f),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,h.getBytes())])])}return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[c,o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,u)])},s.decryptPrivateKeyInfo=function(e,t){var r=null,i={},a=[];if(!o.validate(e,c,i,a)){var u=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw u.errors=a,u}var f=o.derToOid(i.encryptionOid),l=s.pbe.getCipher(f,i.encryptionParams,t),h=n.util.createBuffer(i.encryptedData);return l.update(h),l.finish()&&(r=o.fromDer(l.output)),r},s.encryptedPrivateKeyToPem=function(e,t){var r={type:"ENCRYPTED PRIVATE KEY",body:o.toDer(e).getBytes()};return n.pem.encode(r,{maxline:t})},s.encryptedPrivateKeyFromPem=function(e){var t=n.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==t.type){var r=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return o.fromDer(t.body)},s.encryptRsaPrivateKey=function(e,t,r){if(!(r=r||{}).legacy){var i=s.wrapRsaPrivateKey(s.privateKeyToAsn1(e));return i=s.encryptPrivateKeyInfo(i,t,r),s.encryptedPrivateKeyToPem(i)}var a,c,u,f;switch(r.algorithm){case"aes128":a="AES-128-CBC",u=16,c=n.random.getBytesSync(16),f=n.aes.createEncryptionCipher;break;case"aes192":a="AES-192-CBC",u=24,c=n.random.getBytesSync(16),f=n.aes.createEncryptionCipher;break;case"aes256":a="AES-256-CBC",u=32,c=n.random.getBytesSync(16),f=n.aes.createEncryptionCipher;break;case"3des":a="DES-EDE3-CBC",u=24,c=n.random.getBytesSync(8),f=n.des.createEncryptionCipher;break;case"des":a="DES-CBC",u=8,c=n.random.getBytesSync(8),f=n.des.createEncryptionCipher;break;default:var l=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+r.algorithm+'".');throw l.algorithm=r.algorithm,l}var h=f(n.pbe.opensslDeriveBytes(t,c.substr(0,8),u));h.start(c),h.update(o.toDer(s.privateKeyToAsn1(e))),h.finish();var d={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:a,parameters:n.util.bytesToHex(c).toUpperCase()},body:h.output.getBytes()};return n.pem.encode(d)},s.decryptRsaPrivateKey=function(e,t){var r=null,i=n.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==i.type&&"PRIVATE KEY"!==i.type&&"RSA PRIVATE KEY"!==i.type)throw(u=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".')).headerType=u,u;if(i.procType&&"ENCRYPTED"===i.procType.type){var a,c;switch(i.dekInfo.algorithm){case"DES-CBC":a=8,c=n.des.createDecryptionCipher;break;case"DES-EDE3-CBC":a=24,c=n.des.createDecryptionCipher;break;case"AES-128-CBC":a=16,c=n.aes.createDecryptionCipher;break;case"AES-192-CBC":a=24,c=n.aes.createDecryptionCipher;break;case"AES-256-CBC":a=32,c=n.aes.createDecryptionCipher;break;case"RC2-40-CBC":a=5,c=function(e){return n.rc2.createDecryptionCipher(e,40)};break;case"RC2-64-CBC":a=8,c=function(e){return n.rc2.createDecryptionCipher(e,64)};break;case"RC2-128-CBC":a=16,c=function(e){return n.rc2.createDecryptionCipher(e,128)};break;default:var u;throw(u=new Error('Could not decrypt private key; unsupported encryption algorithm "'+i.dekInfo.algorithm+'".')).algorithm=i.dekInfo.algorithm,u}var f=n.util.hexToBytes(i.dekInfo.parameters),l=c(n.pbe.opensslDeriveBytes(t,f.substr(0,8),a));if(l.start(f),l.update(n.util.createBuffer(i.body)),!l.finish())return r;r=l.output.getBytes()}else r=i.body;return null!==(r="ENCRYPTED PRIVATE KEY"===i.type?s.decryptPrivateKeyInfo(o.fromDer(r),t):o.fromDer(r))&&(r=s.privateKeyFromAsn1(r)),r},s.pbe.generatePkcs12Key=function(e,t,r,i,o,s){var a,c;if(null==s){if(!("sha1"in n.md))throw new Error('"sha1" hash algorithm unavailable.');s=n.md.sha1.create()}var u=s.digestLength,f=s.blockLength,l=new n.util.ByteBuffer,h=new n.util.ByteBuffer;if(null!=e){for(c=0;c=0;c--)R>>=8,R+=T.at(c)+P.at(c),P.setAt(c,255&R);C.putBuffer(P)}w=C,l.putBuffer(S)}return l.truncate(l.length()-o),l},s.pbe.getCipher=function(e,t,r){switch(e){case s.oids.pkcs5PBES2:return s.pbe.getCipherForPBES2(e,t,r);case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case s.oids["pbewithSHAAnd40BitRC2-CBC"]:return s.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},s.pbe.getCipherForPBES2=function(e,t,r){var i,a={},c=[];if(!o.validate(t,u,a,c))throw(i=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=c,i;if((e=o.derToOid(a.kdfOid))!==s.oids.pkcs5PBKDF2)throw(i=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.")).oid=e,i.supportedOids=["pkcs5PBKDF2"],i;if((e=o.derToOid(a.encOid))!==s.oids["aes128-CBC"]&&e!==s.oids["aes192-CBC"]&&e!==s.oids["aes256-CBC"]&&e!==s.oids["des-EDE3-CBC"]&&e!==s.oids.desCBC)throw(i=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.")).oid=e,i.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],i;var f,l,d=a.kdfSalt,p=n.util.createBuffer(a.kdfIterationCount);switch(p=p.getInt(p.length()<<3),s.oids[e]){case"aes128-CBC":f=16,l=n.aes.createDecryptionCipher;break;case"aes192-CBC":f=24,l=n.aes.createDecryptionCipher;break;case"aes256-CBC":f=32,l=n.aes.createDecryptionCipher;break;case"des-EDE3-CBC":f=24,l=n.des.createDecryptionCipher;break;case"desCBC":f=8,l=n.des.createDecryptionCipher}var y=h(a.prfOid),g=n.pkcs5.pbkdf2(r,d,p,f,y),b=a.encIv,m=l(g);return m.start(b),m},s.pbe.getCipherForPKCS12PBE=function(e,t,r){var i={},a=[];if(!o.validate(t,f,i,a))throw(y=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=a,y;var c,u,l,d=n.util.createBuffer(i.salt),p=n.util.createBuffer(i.iterations);switch(p=p.getInt(p.length()<<3),e){case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:c=24,u=8,l=n.des.startDecrypting;break;case s.oids["pbewithSHAAnd40BitRC2-CBC"]:c=5,u=8,l=function(e,t){var r=n.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var y;throw(y=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.")).oid=e,y}var g=h(i.prfOid),b=s.pbe.generatePkcs12Key(r,d,1,p,c,g);return g.start(),l(b,s.pbe.generatePkcs12Key(r,d,2,p,u,g))},s.pbe.opensslDeriveBytes=function(e,t,r,i){if(null==i){if(!("md5"in n.md))throw new Error('"md5" hash algorithm unavailable.');i=n.md.md5.create()}null===t&&(t="");for(var o=[l(i,e+t)],s=16,a=1;s{var n=r(3832);r(36607),r(28991),r(97116);var i,o=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(i=r(25819)),e.exports=n.pbkdf2=o.pbkdf2=function(e,t,r,o,s,a){if("function"==typeof s&&(a=s,s=null),n.util.isNodejs&&!n.options.usePureJavaScript&&i.pbkdf2&&(null===s||"object"!=typeof s)&&(i.pbkdf2Sync.length>4||!s||"sha1"===s))return"string"!=typeof s&&(s="sha1"),e=Buffer.from(e,"binary"),t=Buffer.from(t,"binary"),a?4===i.pbkdf2Sync.length?i.pbkdf2(e,t,r,o,(function(e,t){if(e)return a(e);a(null,t.toString("binary"))})):i.pbkdf2(e,t,r,o,s,(function(e,t){if(e)return a(e);a(null,t.toString("binary"))})):4===i.pbkdf2Sync.length?i.pbkdf2Sync(e,t,r,o).toString("binary"):i.pbkdf2Sync(e,t,r,o,s).toString("binary");if(null==s&&(s="sha1"),"string"==typeof s){if(!(s in n.md.algorithms))throw new Error("Unknown hash algorithm: "+s);s=n.md[s].create()}var c=s.digestLength;if(o>4294967295*c){var u=new Error("Derived key is too long.");if(a)return a(u);throw u}var f=Math.ceil(o/c),l=o-(f-1)*c,h=n.hmac.create();h.start(s,e);var d,p,y,g="";if(!a){for(var b=1;b<=f;++b){h.start(null,null),h.update(t),h.update(n.util.int32ToBytes(b)),d=y=h.digest().getBytes();for(var m=2;m<=r;++m)h.start(null,null),h.update(y),p=h.digest().getBytes(),d=n.util.xorBytes(d,p,c),y=p;g+=bf)return a(null,g);h.start(null,null),h.update(t),h.update(n.util.int32ToBytes(b)),d=y=h.digest().getBytes(),m=2,w()}function w(){if(m<=r)return h.start(null,null),h.update(y),p=h.digest().getBytes(),d=n.util.xorBytes(d,p,c),y=p,++m,n.util.setImmediate(w);g+=b{var n=r(3832);r(97116);var i=e.exports=n.pem=n.pem||{};function o(e){for(var t=e.name+": ",r=[],n=function(e,t){return" "+t},i=0;i65&&-1!==s){var a=t[s];","===a?(++s,t=t.substr(0,s)+"\r\n "+t.substr(s)):t=t.substr(0,s)+"\r\n"+a+t.substr(s+1),o=i-s-1,s=-1,++i}else" "!==t[i]&&"\t"!==t[i]&&","!==t[i]||(s=i);return t}function s(e){return e.replace(/^\s+/,"")}i.encode=function(e,t){t=t||{};var r,i="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(i+=o(r={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]})),e.contentDomain&&(i+=o(r={name:"Content-Domain",values:[e.contentDomain]})),e.dekInfo&&(r={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&r.values.push(e.dekInfo.parameters),i+=o(r)),e.headers)for(var s=0;s{var n=r(3832);r(97116),r(49563),r(137);var i=e.exports=n.pkcs1=n.pkcs1||{};function o(e,t,r){r||(r=n.md.sha1.create());for(var i="",o=Math.ceil(t/r.digestLength),s=0;s>24&255,s>>16&255,s>>8&255,255&s);r.start(),r.update(e+a),i+=r.digest().getBytes()}return i.substring(0,t)}i.encode_rsa_oaep=function(e,t,r){var i,s,a,c;"string"==typeof r?(i=r,s=arguments[3]||void 0,a=arguments[4]||void 0):r&&(i=r.label||void 0,s=r.seed||void 0,a=r.md||void 0,r.mgf1&&r.mgf1.md&&(c=r.mgf1.md)),a?a.start():a=n.md.sha1.create(),c||(c=a);var u=Math.ceil(e.n.bitLength()/8),f=u-2*a.digestLength-2;if(t.length>f)throw(g=new Error("RSAES-OAEP input message length is too long.")).length=t.length,g.maxLength=f,g;i||(i=""),a.update(i,"raw");for(var l=a.digest(),h="",d=f-t.length,p=0;p{var n=r(3832);r(8925),r(3068),r(33480),r(66270),r(26953),r(95496),r(49563),r(97116),r(25414);var i=n.asn1,o=e.exports=n.pkcs7=n.pkcs7||{};function s(e){var t={},r=[];if(!i.validate(e,o.asn1.recipientInfoValidator,t,r)){var s=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw s.errors=r,s}return{version:t.version.charCodeAt(0),issuer:n.pki.RDNAttributesAsArray(t.issuer),serialNumber:n.util.createBuffer(t.serial).toHex(),encryptedContent:{algorithm:i.derToOid(t.encAlgorithm),parameter:t.encParameter.value,content:t.encKey}}}function a(e){for(var t,r=[],o=0;o0){for(var r=i.create(i.Class.CONTEXT_SPECIFIC,1,!0,[]),o=0;o=r&&s0&&s.value[0].value.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,t)),o.length>0&&s.value[0].value.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,o)),s.value[0].value.push(i.create(i.Class.UNIVERSAL,i.Type.SET,!0,e.signerInfos)),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.type).getBytes()),s])},addSigner:function(t){var r=t.issuer,i=t.serialNumber;if(t.certificate){var o=t.certificate;"string"==typeof o&&(o=n.pki.certificateFromPem(o)),r=o.issuer.attributes,i=o.serialNumber}var s=t.key;if(!s)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"==typeof s&&(s=n.pki.privateKeyFromPem(s));var a=t.digestAlgorithm||n.pki.oids.sha1;switch(a){case n.pki.oids.sha1:case n.pki.oids.sha256:case n.pki.oids.sha384:case n.pki.oids.sha512:case n.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+a)}var c=t.authenticatedAttributes||[];if(c.length>0){for(var u=!1,f=!1,l=0;l{var n=r(3832);r(3068),r(97116);var i=n.asn1,o=e.exports=n.pkcs7asn1=n.pkcs7asn1||{};n.pkcs7=n.pkcs7||{},n.pkcs7.asn1=o;var s={name:"ContentInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};o.contentInfoValidator=s;var a={name:"EncryptedContentInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};o.envelopedDataValidator={name:"EnvelopedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(a)},o.encryptedDataValidator={name:"EncryptedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"}].concat(a)};var c={name:"SignerInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};o.signedDataValidator={name:"SignedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},s,{name:"SignedData.Certificates",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,capture:"signerInfos",optional:!0,value:[c]}]},o.recipientInfoValidator={name:"RecipientInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter"}]},{name:"RecipientInfo.encryptedKey",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}},29654:(e,t,r)=>{var n=r(3832);r(97116),r(15764),r(49563),function(){if(n.prime)e.exports=n.prime;else{var t=e.exports=n.prime=n.prime||{},r=n.jsbn.BigInteger,i=[6,4,2,4,2,4,6,2],o=new r(null);o.fromInt(30);var s=function(e,t){return e|t};t.generateProbablePrime=function(e,t,i){"function"==typeof t&&(i=t,t={});var o=(t=t||{}).algorithm||"PRIMEINC";"string"==typeof o&&(o={name:o}),o.options=o.options||{};var s=t.prng||n.random,c={nextBytes:function(e){for(var t=s.getBytesSync(e.length),r=0;re&&(s=u(e,t));var d=s.toString(16);i.target.postMessage({hex:d,workLoad:f}),s.dAddOffset(l,0)}}}d()}(e,t,i,o):a(e,t,i,o)}(e,c,o.options,i);throw new Error("Invalid prime generation algorithm: "+o.name)}}function a(e,t,r,n){var i=u(e,t),o=function(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}(i.bitLength());"millerRabinTests"in r&&(o=r.millerRabinTests);var s=10;"maxBlockTime"in r&&(s=r.maxBlockTime),c(i,e,t,0,o,s,n)}function c(e,t,r,o,s,a,f){var l=+new Date;do{if(e.bitLength()>t&&(e=u(t,r)),e.isProbablePrime(s))return f(null,e);e.dAddOffset(i[o++%8],0)}while(a<0||+new Date-l{var n=r(34155),i=r(3832);r(97116);var o=null;!i.util.isNodejs||i.options.usePureJavaScript||n.versions["node-webkit"]||(o=r(25819)),(e.exports=i.prng=i.prng||{}).create=function(e){for(var t={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},r=e.md,n=new Array(32),s=0;s<32;++s)n[s]=r.create();function a(){if(t.pools[0].messageLength>=32)return c();var e=32-t.pools[0].messageLength<<5;t.collect(t.seedFileSync(e)),c()}function c(){t.reseeds=4294967295===t.reseeds?0:t.reseeds+1;var e=t.plugin.md.create();e.update(t.keyBytes);for(var r=1,n=0;n<32;++n)t.reseeds%r==0&&(e.update(t.pools[n].digest().getBytes()),t.pools[n].start()),r<<=1;t.keyBytes=e.digest().getBytes(),e.start(),e.update(t.keyBytes);var i=e.digest().getBytes();t.key=t.plugin.formatKey(t.keyBytes),t.seed=t.plugin.formatSeed(i),t.generated=0}function u(e){var t=null,r=i.util.globalScope,n=r.crypto||r.msCrypto;n&&n.getRandomValues&&(t=function(e){return n.getRandomValues(e)});var o=i.util.createBuffer();if(t)for(;o.length()>16)))<<16,h=4294967295&(f=(2147483647&(f+=u>>15))+(f>>31)),c=0;c<3;++c)l=h>>>(c<<3),l^=Math.floor(256*Math.random()),o.putByte(String.fromCharCode(255&l));return o.getBytes(e)}return t.pools=n,t.pool=0,t.generate=function(e,r){if(!r)return t.generateSync(e);var n=t.plugin.cipher,o=t.plugin.increment,s=t.plugin.formatKey,a=t.plugin.formatSeed,u=i.util.createBuffer();t.key=null,function f(l){if(l)return r(l);if(u.length()>=e)return r(null,u.getBytes(e));if(t.generated>1048575&&(t.key=null),null===t.key)return i.util.nextTick((function(){!function(e){if(t.pools[0].messageLength>=32)return c(),e();var r=32-t.pools[0].messageLength<<5;t.seedFile(r,(function(r,n){if(r)return e(r);t.collect(n),c(),e()}))}(f)}));var h=n(t.key,t.seed);t.generated+=h.length,u.putBytes(h),t.key=s(n(t.key,o(t.seed))),t.seed=a(n(t.key,t.seed)),i.util.setImmediate(f)}()},t.generateSync=function(e){var r=t.plugin.cipher,n=t.plugin.increment,o=t.plugin.formatKey,s=t.plugin.formatSeed;t.key=null;for(var c=i.util.createBuffer();c.length()1048575&&(t.key=null),null===t.key&&a();var u=r(t.key,t.seed);t.generated+=u.length,c.putBytes(u),t.key=o(r(t.key,n(t.seed))),t.seed=s(r(t.key,t.seed))}return c.getBytes(e)},o?(t.seedFile=function(e,t){o.randomBytes(e,(function(e,r){if(e)return t(e);t(null,r.toString())}))},t.seedFileSync=function(e){return o.randomBytes(e).toString()}):(t.seedFile=function(e,t){try{t(null,u(e))}catch(e){t(e)}},t.seedFileSync=u),t.collect=function(e){for(var r=e.length,n=0;n>i&255);t.collect(n)},t.registerWorker=function(e){e===self?t.seedFile=function(e,t){self.addEventListener("message",(function e(r){var n=r.data;n.forge&&n.forge.prng&&(self.removeEventListener("message",e),t(n.forge.prng.err,n.forge.prng.bytes))})),self.postMessage({forge:{prng:{needed:e}}})}:e.addEventListener("message",(function(r){var n=r.data;n.forge&&n.forge.prng&&t.seedFile(n.forge.prng.needed,(function(t,r){e.postMessage({forge:{prng:{err:t,bytes:r}}})}))}))},t}},96007:(e,t,r)=>{var n=r(3832);r(49563),r(97116),(e.exports=n.pss=n.pss||{}).create=function(e){3===arguments.length&&(e={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var t,r=e.md,i=e.mgf,o=r.digestLength,s=e.salt||null;if("string"==typeof s&&(s=n.util.createBuffer(s)),"saltLength"in e)t=e.saltLength;else{if(null===s)throw new Error("Salt length not specified or specific salt not given.");t=s.length()}if(null!==s&&s.length()!==t)throw new Error("Given salt length does not match length of given salt.");var a=e.prng||n.random,c={encode:function(e,c){var u,f,l=c-1,h=Math.ceil(l/8),d=e.digest().getBytes();if(h>8*h-l&255;return(w=String.fromCharCode(w.charCodeAt(0)&~E)+w.substr(1))+y+String.fromCharCode(188)},verify:function(e,s,a){var c,u=a-1,f=Math.ceil(u/8);if(s=s.substr(-f),f>8*f-u&255;if(0!=(h.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var y=i.generate(d,l),g="";for(c=0;c{var n=r(3832);r(8925),r(41668),r(74933),r(97116),n.random&&n.random.getBytes?e.exports=n.random:function(t){var r={},i=new Array(4),o=n.util.createBuffer();function s(){var e=n.prng.create(r);return e.getBytes=function(t,r){return e.generate(t,r)},e.getBytesSync=function(t){return e.generate(t)},e}r.formatKey=function(e){var t=n.util.createBuffer(e);return(e=new Array(4))[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),n.aes._expandKey(e,!1)},r.formatSeed=function(e){var t=n.util.createBuffer(e);return(e=new Array(4))[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),e},r.cipher=function(e,t){return n.aes._updateBlock(e,t,i,!1),o.putInt32(i[0]),o.putInt32(i[1]),o.putInt32(i[2]),o.putInt32(i[3]),o.getBytes()},r.increment=function(e){return++e[3],e},r.md=n.md.sha256;var a=s(),c=null,u=n.util.globalScope,f=u.crypto||u.msCrypto;if(f&&f.getRandomValues&&(c=function(e){return f.getRandomValues(e)}),n.options.usePureJavaScript||!n.util.isNodejs&&!c){if("undefined"==typeof window||window.document,a.collectInt(+new Date,32),"undefined"!=typeof navigator){var l="";for(var h in navigator)try{"string"==typeof navigator[h]&&(l+=navigator[h])}catch(e){}a.collect(l),l=null}t&&(t().mousemove((function(e){a.collectInt(e.clientX,16),a.collectInt(e.clientY,16)})),t().keypress((function(e){a.collectInt(e.charCode,8)})))}if(n.random)for(var h in a)n.random[h]=a[h];else n.random=a;n.random.createInstance=s,e.exports=n.random}("undefined"!=typeof jQuery?jQuery:null)},69372:(e,t,r)=>{var n=r(3832);r(97116);var i=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],o=[1,2,3,5],s=function(e,t){return e<>16-t},a=function(e,t){return(65535&e)>>t|e<<16-t&65535};e.exports=n.rc2=n.rc2||{},n.rc2.expandKey=function(e,t){"string"==typeof e&&(e=n.util.createBuffer(e)),t=t||128;var r,o=e,s=e.length(),a=t,c=Math.ceil(a/8),u=255>>(7&a);for(r=s;r<128;r++)o.putByte(i[o.at(r-1)+o.at(r-s)&255]);for(o.setAt(128-c,i[o.at(128-c)&u]),r=127-c;r>=0;r--)o.setAt(r,i[o.at(r+1)^o.at(r+c)]);return o};var c=function(e,t,r){var i,c,u,f,l=!1,h=null,d=null,p=null,y=[];for(e=n.rc2.expandKey(e,t),u=0;u<64;u++)y.push(e.getInt16Le());r?(i=function(e){for(u=0;u<4;u++)e[u]+=y[f]+(e[(u+3)%4]&e[(u+2)%4])+(~e[(u+3)%4]&e[(u+1)%4]),e[u]=s(e[u],o[u]),f++},c=function(e){for(u=0;u<4;u++)e[u]+=y[63&e[(u+3)%4]]}):(i=function(e){for(u=3;u>=0;u--)e[u]=a(e[u],o[u]),e[u]-=y[f]+(e[(u+3)%4]&e[(u+2)%4])+(~e[(u+3)%4]&e[(u+1)%4]),f--},c=function(e){for(u=3;u>=0;u--)e[u]-=y[63&e[(u+3)%4]]});var g=function(e){var t=[];for(u=0;u<4;u++){var n=h.getInt16Le();null!==p&&(r?n^=p.getInt16Le():p.putInt16Le(n)),t.push(65535&n)}f=r?0:63;for(var i=0;i=8;)g([[5,i],[1,c],[6,i],[1,c],[5,i]])},finish:function(e){var t=!0;if(r)if(e)t=e(8,h,!r);else{var n=8===h.length()?8:8-h.length();h.fillWithByte(n,n)}if(t&&(l=!0,b.update()),!r&&(t=0===h.length()))if(e)t=e(8,d,!r);else{var i=d.length(),o=d.at(i-1);o>i?t=!1:d.truncate(o)}return t}}};n.rc2.startEncrypting=function(e,t,r){var i=n.rc2.createEncryptionCipher(e,128);return i.start(t,r),i},n.rc2.createEncryptionCipher=function(e,t){return c(e,t,!0)},n.rc2.startDecrypting=function(e,t,r){var i=n.rc2.createDecryptionCipher(e,128);return i.start(t,r),i},n.rc2.createDecryptionCipher=function(e,t){return c(e,t,!1)}},28095:(e,t,r)=>{var n=r(3832);if(r(3068),r(15764),r(66270),r(18936),r(29654),r(49563),r(97116),void 0===i)var i=n.jsbn.BigInteger;var o=n.util.isNodejs?r(25819):null,s=n.asn1,a=n.util;n.pki=n.pki||{},e.exports=n.pki.rsa=n.rsa=n.rsa||{};var c=n.pki,u=[6,4,2,4,2,4,6,2],f={name:"PrivateKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},l={name:"RSAPrivateKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},h={name:"RSAPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},d=n.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},p=function(e){var t;if(!(e.algorithm in c.oids)){var r=new Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r}t=c.oids[e.algorithm];var n=s.oidToDer(t).getBytes(),i=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[]),o=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[]);o.value.push(s.create(s.Class.UNIVERSAL,s.Type.OID,!1,n)),o.value.push(s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,""));var a=s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,e.digest().getBytes());return i.value.push(o),i.value.push(a),s.toDer(i).getBytes()},y=function(e,t,r){if(r)return e.modPow(t.e,t.n);if(!t.p||!t.q)return e.modPow(t.d,t.n);var o;t.dP||(t.dP=t.d.mod(t.p.subtract(i.ONE))),t.dQ||(t.dQ=t.d.mod(t.q.subtract(i.ONE))),t.qInv||(t.qInv=t.q.modInverse(t.p));do{o=new i(n.util.bytesToHex(n.random.getBytes(t.n.bitLength()/8)),16)}while(o.compareTo(t.n)>=0||!o.gcd(t.n).equals(i.ONE));for(var s=(e=e.multiply(o.modPow(t.e,t.n)).mod(t.n)).mod(t.p).modPow(t.dP,t.p),a=e.mod(t.q).modPow(t.dQ,t.q);s.compareTo(a)<0;)s=s.add(t.p);var c=s.subtract(a).multiply(t.qInv).mod(t.p).multiply(t.q).add(a);return c.multiply(o.modInverse(t.n)).mod(t.n)};function g(e,t,r){var i=n.util.createBuffer(),o=Math.ceil(t.n.bitLength()/8);if(e.length>o-11){var s=new Error("Message is too long for PKCS#1 v1.5 padding.");throw s.length=e.length,s.max=o-11,s}i.putByte(0),i.putByte(r);var a,c=o-3-e.length;if(0===r||1===r){a=0===r?0:255;for(var u=0;u0;){var f=0,l=n.random.getBytes(c);for(u=0;u1;){if(255!==s.getByte()){--s.read;break}++u}else if(2===c)for(u=0;s.length()>1;){if(0===s.getByte()){--s.read;break}++u}if(0!==s.getByte()||u!==o-3-s.length())throw new Error("Encryption block is invalid.");return s.getBytes()}function m(e,t,r){"function"==typeof t&&(r=t,t={});var o={algorithm:{name:(t=t||{}).algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};function s(){a(e.pBits,(function(t,n){return t?r(t):(e.p=n,null!==e.q?u(t,e.q):void a(e.qBits,u))}))}function a(e,t){n.prime.generateProbablePrime(e,o,t)}function u(t,n){if(t)return r(t);if(e.q=n,e.p.compareTo(e.q)<0){var o=e.p;e.p=e.q,e.q=o}if(0!==e.p.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.p=null,void s();if(0!==e.q.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.q=null,void a(e.qBits,u);if(e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),0!==e.phi.gcd(e.e).compareTo(i.ONE))return e.p=e.q=null,void s();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void a(e.qBits,u);var f=e.e.modInverse(e.phi);e.keys={privateKey:c.rsa.setPrivateKey(e.n,e.e,f,e.p,e.q,f.mod(e.p1),f.mod(e.q1),e.q.modInverse(e.p)),publicKey:c.rsa.setPublicKey(e.n,e.e)},r(null,e.keys)}"prng"in t&&(o.prng=t.prng),s()}function v(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var r=n.util.hexToBytes(t);return r.length>1&&(0===r.charCodeAt(0)&&0==(128&r.charCodeAt(1))||255===r.charCodeAt(0)&&128==(128&r.charCodeAt(1)))?r.substr(1):r}function w(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function E(e){return n.util.isNodejs&&"function"==typeof o[e]}function _(e){return void 0!==a.globalScope&&"object"==typeof a.globalScope.crypto&&"object"==typeof a.globalScope.crypto.subtle&&"function"==typeof a.globalScope.crypto.subtle[e]}function S(e){return void 0!==a.globalScope&&"object"==typeof a.globalScope.msCrypto&&"object"==typeof a.globalScope.msCrypto.subtle&&"function"==typeof a.globalScope.msCrypto.subtle[e]}function A(e){for(var t=n.util.hexToBytes(e.toString(16)),r=new Uint8Array(t.length),i=0;i0;)f.putByte(0),--l;return f.putBytes(n.util.hexToBytes(u)),f.getBytes()},c.rsa.decrypt=function(e,t,r,o){var s=Math.ceil(t.n.bitLength()/8);if(e.length!==s){var a=new Error("Encrypted message length is invalid.");throw a.length=e.length,a.expected=s,a}var c=new i(n.util.createBuffer(e).toHex(),16);if(c.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var u=y(c,t,r).toString(16),f=n.util.createBuffer(),l=s-Math.ceil(u.length/2);l>0;)f.putByte(0),--l;return f.putBytes(n.util.hexToBytes(u)),!1!==o?b(f.getBytes(),t,r):f.getBytes()},c.rsa.createKeyPairGenerationState=function(e,t,r){"string"==typeof e&&(e=parseInt(e,10)),e=e||2048;var o,s=(r=r||{}).prng||n.random,a={nextBytes:function(e){for(var t=s.getBytesSync(e.length),r=0;r>1,pBits:e-(e>>1),pqState:0,num:null,keys:null}).e.fromInt(o.eInt),o},c.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var r=new i(null);r.fromInt(30);for(var n,o=0,s=function(e,t){return e|t},a=+new Date,f=0;null===e.keys&&(t<=0||fl?e.pqState=0:e.num.isProbablePrime(w(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(u[o++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(i.ONE).gcd(e.e).compareTo(i.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(i.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var d=e.e.modInverse(e.phi);e.keys={privateKey:c.rsa.setPrivateKey(e.n,e.e,d,e.p,e.q,d.mod(e.p1),d.mod(e.q1),e.q.modInverse(e.p)),publicKey:c.rsa.setPublicKey(e.n,e.e)}}f+=(n=+new Date)-a,a=n}return null!==e.keys},c.rsa.generateKeyPair=function(e,t,r,i){if(1===arguments.length?"object"==typeof e?(r=e,e=void 0):"function"==typeof e&&(i=e,e=void 0):2===arguments.length?"number"==typeof e?"function"==typeof t?(i=t,t=void 0):"number"!=typeof t&&(r=t,t=void 0):(r=e,i=t,e=void 0,t=void 0):3===arguments.length&&("number"==typeof t?"function"==typeof r&&(i=r,r=void 0):(i=r,r=t,t=void 0)),r=r||{},void 0===e&&(e=r.bits||2048),void 0===t&&(t=r.e||65537),!n.options.usePureJavaScript&&!r.prng&&e>=256&&e<=16384&&(65537===t||3===t))if(i){if(E("generateKeyPair"))return o.generateKeyPair("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},(function(e,t,r){if(e)return i(e);i(null,{privateKey:c.privateKeyFromPem(r),publicKey:c.publicKeyFromPem(t)})}));if(_("generateKey")&&_("exportKey"))return a.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:A(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then((function(e){return a.globalScope.crypto.subtle.exportKey("pkcs8",e.privateKey)})).then(void 0,(function(e){i(e)})).then((function(e){if(e){var t=c.privateKeyFromAsn1(s.fromDer(n.util.createBuffer(e)));i(null,{privateKey:t,publicKey:c.setRsaPublicKey(t.n,t.e)})}}));if(S("generateKey")&&S("exportKey")){var u=a.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:A(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);return u.oncomplete=function(e){var t=e.target.result,r=a.globalScope.msCrypto.subtle.exportKey("pkcs8",t.privateKey);r.oncomplete=function(e){var t=e.target.result,r=c.privateKeyFromAsn1(s.fromDer(n.util.createBuffer(t)));i(null,{privateKey:r,publicKey:c.setRsaPublicKey(r.n,r.e)})},r.onerror=function(e){i(e)}},void(u.onerror=function(e){i(e)})}}else if(E("generateKeyPairSync")){var f=o.generateKeyPairSync("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:c.privateKeyFromPem(f.privateKey),publicKey:c.publicKeyFromPem(f.publicKey)}}var l=c.rsa.createKeyPairGenerationState(e,t,r);if(!i)return c.rsa.stepKeyPairGenerationState(l,0),l.keys;m(l,r,i)},c.setRsaPublicKey=c.rsa.setPublicKey=function(e,t){var r={n:e,e:t,encrypt:function(e,t,i){if("string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===t)t={encode:function(e,t,r){return g(e,t,2).getBytes()}};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={encode:function(e,t){return n.pkcs1.encode_rsa_oaep(t,e,i)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(t))t={encode:function(e){return e}};else if("string"==typeof t)throw new Error('Unsupported encryption scheme: "'+t+'".');var o=t.encode(e,r,!0);return c.rsa.encrypt(o,r,!0)},verify:function(e,t,n){"string"==typeof n?n=n.toUpperCase():void 0===n&&(n="RSASSA-PKCS1-V1_5"),"RSASSA-PKCS1-V1_5"===n?n={verify:function(e,t){return t=b(t,r,!0),e===s.fromDer(t).value[1].value}}:"NONE"!==n&&"NULL"!==n&&null!==n||(n={verify:function(e,t){return e===b(t,r,!0)}});var i=c.rsa.decrypt(t,r,!0,!1);return n.verify(e,i,r.n.bitLength())}};return r},c.setRsaPrivateKey=c.rsa.setPrivateKey=function(e,t,r,i,o,s,a,u){var f={n:e,e:t,d:r,p:i,q:o,dP:s,dQ:a,qInv:u,decrypt:function(e,t,r){"string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5");var i=c.rsa.decrypt(e,f,!1,!1);if("RSAES-PKCS1-V1_5"===t)t={decode:b};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={decode:function(e,t){return n.pkcs1.decode_rsa_oaep(t,e,r)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(t))throw new Error('Unsupported encryption scheme: "'+t+'".');t={decode:function(e){return e}}}return t.decode(i,f,!1)},sign:function(e,t){var r=!1;"string"==typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:p},r=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},r=1);var n=t.encode(e,f.n.bitLength());return c.rsa.encrypt(n,f,r)}};return f},c.wrapRsaPrivateKey=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,s.integerToDer(0).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(c.oids.rsaEncryption).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,"")]),s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,s.toDer(e).getBytes())])},c.privateKeyFromAsn1=function(e){var t,r,o,a,u,h,d,p,y={},g=[];if(s.validate(e,f,y,g)&&(e=s.fromDer(n.util.createBuffer(y.privateKey))),y={},g=[],!s.validate(e,l,y,g)){var b=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw b.errors=g,b}return t=n.util.createBuffer(y.privateKeyModulus).toHex(),r=n.util.createBuffer(y.privateKeyPublicExponent).toHex(),o=n.util.createBuffer(y.privateKeyPrivateExponent).toHex(),a=n.util.createBuffer(y.privateKeyPrime1).toHex(),u=n.util.createBuffer(y.privateKeyPrime2).toHex(),h=n.util.createBuffer(y.privateKeyExponent1).toHex(),d=n.util.createBuffer(y.privateKeyExponent2).toHex(),p=n.util.createBuffer(y.privateKeyCoefficient).toHex(),c.setRsaPrivateKey(new i(t,16),new i(r,16),new i(o,16),new i(a,16),new i(u,16),new i(h,16),new i(d,16),new i(p,16))},c.privateKeyToAsn1=c.privateKeyToRSAPrivateKey=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,s.integerToDer(0).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,v(e.n)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,v(e.e)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,v(e.d)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,v(e.p)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,v(e.q)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,v(e.dP)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,v(e.dQ)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,v(e.qInv))])},c.publicKeyFromAsn1=function(e){var t={},r=[];if(s.validate(e,d,t,r)){var o,a=s.derToOid(t.publicKeyOid);if(a!==c.oids.rsaEncryption)throw(o=new Error("Cannot read public key. Unknown OID.")).oid=a,o;e=t.rsaPublicKey}if(r=[],!s.validate(e,h,t,r))throw(o=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=r,o;var u=n.util.createBuffer(t.publicKeyModulus).toHex(),f=n.util.createBuffer(t.publicKeyExponent).toHex();return c.setRsaPublicKey(new i(u,16),new i(f,16))},c.publicKeyToAsn1=c.publicKeyToSubjectPublicKeyInfo=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(c.oids.rsaEncryption).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,"")]),s.create(s.Class.UNIVERSAL,s.Type.BITSTRING,!1,[c.publicKeyToRSAPublicKey(e)])])},c.publicKeyToRSAPublicKey=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,v(e.n)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,v(e.e))])}},137:(e,t,r)=>{var n=r(3832);r(28991),r(97116);var i=e.exports=n.sha1=n.sha1||{};n.md.sha1=n.md.algorithms.sha1=i,i.create=function(){s||(o=String.fromCharCode(128),o+=n.util.fillString(String.fromCharCode(0),64),s=!0);var e=null,t=n.util.createBuffer(),r=new Array(80),i={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var r=i.messageLengthSize/4,o=0;o>>0,c>>>0];for(var u=i.fullMessageLength.length-1;u>=0;--u)i.fullMessageLength[u]+=c[1],c[1]=c[0]+(i.fullMessageLength[u]/4294967296>>>0),i.fullMessageLength[u]=i.fullMessageLength[u]>>>0,c[0]=c[1]/4294967296>>>0;return t.putBytes(o),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var s=n.util.createBuffer();s.putBytes(t.bytes());var c,u=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;s.putBytes(o.substr(0,i.blockLength-u));for(var f=8*i.fullMessageLength[0],l=0;l>>0,s.putInt32(f>>>0),f=c>>>0;s.putInt32(f);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};a(h,r,s);var d=n.util.createBuffer();return d.putInt32(h.h0),d.putInt32(h.h1),d.putInt32(h.h2),d.putInt32(h.h3),d.putInt32(h.h4),d},i};var o=null,s=!1;function a(e,t,r){for(var n,i,o,s,a,c,u,f=r.length();f>=64;){for(i=e.h0,o=e.h1,s=e.h2,a=e.h3,c=e.h4,u=0;u<16;++u)n=r.getInt32(),t[u]=n,n=(i<<5|i>>>27)+(a^o&(s^a))+c+1518500249+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;u<20;++u)n=(n=t[u-3]^t[u-8]^t[u-14]^t[u-16])<<1|n>>>31,t[u]=n,n=(i<<5|i>>>27)+(a^o&(s^a))+c+1518500249+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;u<32;++u)n=(n=t[u-3]^t[u-8]^t[u-14]^t[u-16])<<1|n>>>31,t[u]=n,n=(i<<5|i>>>27)+(o^s^a)+c+1859775393+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;u<40;++u)n=(n=t[u-6]^t[u-16]^t[u-28]^t[u-32])<<2|n>>>30,t[u]=n,n=(i<<5|i>>>27)+(o^s^a)+c+1859775393+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;u<60;++u)n=(n=t[u-6]^t[u-16]^t[u-28]^t[u-32])<<2|n>>>30,t[u]=n,n=(i<<5|i>>>27)+(o&s|a&(o^s))+c+2400959708+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;u<80;++u)n=(n=t[u-6]^t[u-16]^t[u-28]^t[u-32])<<2|n>>>30,t[u]=n,n=(i<<5|i>>>27)+(o^s^a)+c+3395469782+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;e.h0=e.h0+i|0,e.h1=e.h1+o|0,e.h2=e.h2+s|0,e.h3=e.h3+a|0,e.h4=e.h4+c|0,f-=64}}},41668:(e,t,r)=>{var n=r(3832);r(28991),r(97116);var i=e.exports=n.sha256=n.sha256||{};n.md.sha256=n.md.algorithms.sha256=i,i.create=function(){s||(o=String.fromCharCode(128),o+=n.util.fillString(String.fromCharCode(0),64),a=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],s=!0);var e=null,t=n.util.createBuffer(),r=new Array(64),i={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var r=i.messageLengthSize/4,o=0;o>>0,a>>>0];for(var u=i.fullMessageLength.length-1;u>=0;--u)i.fullMessageLength[u]+=a[1],a[1]=a[0]+(i.fullMessageLength[u]/4294967296>>>0),i.fullMessageLength[u]=i.fullMessageLength[u]>>>0,a[0]=a[1]/4294967296>>>0;return t.putBytes(o),c(e,r,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var s=n.util.createBuffer();s.putBytes(t.bytes());var a,u=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;s.putBytes(o.substr(0,i.blockLength-u));for(var f=8*i.fullMessageLength[0],l=0;l>>0,s.putInt32(f>>>0),f=a>>>0;s.putInt32(f);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};c(h,r,s);var d=n.util.createBuffer();return d.putInt32(h.h0),d.putInt32(h.h1),d.putInt32(h.h2),d.putInt32(h.h3),d.putInt32(h.h4),d.putInt32(h.h5),d.putInt32(h.h6),d.putInt32(h.h7),d},i};var o=null,s=!1,a=null;function c(e,t,r){for(var n,i,o,s,c,u,f,l,h,d,p,y,g,b=r.length();b>=64;){for(c=0;c<16;++c)t[c]=r.getInt32();for(;c<64;++c)n=((n=t[c-2])>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,i=((i=t[c-15])>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,t[c]=n+t[c-7]+i+t[c-16]|0;for(u=e.h0,f=e.h1,l=e.h2,h=e.h3,d=e.h4,p=e.h5,y=e.h6,g=e.h7,c=0;c<64;++c)o=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),s=u&f|l&(u^f),n=g+((d>>>6|d<<26)^(d>>>11|d<<21)^(d>>>25|d<<7))+(y^d&(p^y))+a[c]+t[c],g=y,y=p,p=d,d=h+n>>>0,h=l,l=f,f=u,u=n+(i=o+s)>>>0;e.h0=e.h0+u|0,e.h1=e.h1+f|0,e.h2=e.h2+l|0,e.h3=e.h3+h|0,e.h4=e.h4+d|0,e.h5=e.h5+p|0,e.h6=e.h6+y|0,e.h7=e.h7+g|0,b-=64}}},63219:(e,t,r)=>{var n=r(3832);r(28991),r(97116);var i=e.exports=n.sha512=n.sha512||{};n.md.sha512=n.md.algorithms.sha512=i;var o=n.sha384=n.sha512.sha384=n.sha512.sha384||{};o.create=function(){return i.create("SHA-384")},n.md.sha384=n.md.algorithms.sha384=o,n.sha512.sha256=n.sha512.sha256||{create:function(){return i.create("SHA-512/256")}},n.md["sha512/256"]=n.md.algorithms["sha512/256"]=n.sha512.sha256,n.sha512.sha224=n.sha512.sha224||{create:function(){return i.create("SHA-512/224")}},n.md["sha512/224"]=n.md.algorithms["sha512/224"]=n.sha512.sha224,i.create=function(e){if(a||(s=String.fromCharCode(128),s+=n.util.fillString(String.fromCharCode(0),128),c=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],(u={})["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],u["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],u["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],u["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],a=!0),void 0===e&&(e="SHA-512"),!(e in u))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=u[e],r=null,i=n.util.createBuffer(),o=new Array(80),l=0;l<80;++l)o[l]=new Array(2);var h=64;switch(e){case"SHA-384":h=48;break;case"SHA-512/256":h=32;break;case"SHA-512/224":h=28}var d={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:h,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){d.messageLength=0,d.fullMessageLength=d.messageLength128=[];for(var e=d.messageLengthSize/4,o=0;o>>0,s>>>0];for(var a=d.fullMessageLength.length-1;a>=0;--a)d.fullMessageLength[a]+=s[1],s[1]=s[0]+(d.fullMessageLength[a]/4294967296>>>0),d.fullMessageLength[a]=d.fullMessageLength[a]>>>0,s[0]=s[1]/4294967296>>>0;return i.putBytes(e),f(r,o,i),(i.read>2048||0===i.length())&&i.compact(),d},d.digest=function(){var t=n.util.createBuffer();t.putBytes(i.bytes());var a,c=d.fullMessageLength[d.fullMessageLength.length-1]+d.messageLengthSize&d.blockLength-1;t.putBytes(s.substr(0,d.blockLength-c));for(var u=8*d.fullMessageLength[0],l=0;l>>0,t.putInt32(u>>>0),u=a>>>0;t.putInt32(u);var h=new Array(r.length);for(l=0;l=128;){for(k=0;k<16;++k)t[k][0]=r.getInt32()>>>0,t[k][1]=r.getInt32()>>>0;for(;k<80;++k)n=(((B=(M=t[k-2])[0])>>>19|(x=M[1])<<13)^(x>>>29|B<<3)^B>>>6)>>>0,i=((B<<13|x>>>19)^(x<<3|B>>>29)^(B<<26|x>>>6))>>>0,o=(((B=(N=t[k-15])[0])>>>1|(x=N[1])<<31)^(B>>>8|x<<24)^B>>>7)>>>0,s=((B<<31|x>>>1)^(B<<24|x>>>8)^(B<<25|x>>>7))>>>0,O=t[k-7],L=t[k-16],x=i+O[1]+s+L[1],t[k][0]=n+O[0]+o+L[0]+(x/4294967296>>>0)>>>0,t[k][1]=x>>>0;for(p=e[0][0],y=e[0][1],g=e[1][0],b=e[1][1],m=e[2][0],v=e[2][1],w=e[3][0],E=e[3][1],_=e[4][0],S=e[4][1],A=e[5][0],T=e[5][1],I=e[6][0],C=e[6][1],P=e[7][0],R=e[7][1],k=0;k<80;++k)f=((_>>>14|S<<18)^(_>>>18|S<<14)^(S>>>9|_<<23))>>>0,l=(I^_&(A^I))>>>0,a=((p>>>28|y<<4)^(y>>>2|p<<30)^(y>>>7|p<<25))>>>0,u=((p<<4|y>>>28)^(y<<30|p>>>2)^(y<<25|p>>>7))>>>0,h=(p&g|m&(p^g))>>>0,d=(y&b|v&(y^b))>>>0,x=R+(((_<<18|S>>>14)^(_<<14|S>>>18)^(S<<23|_>>>9))>>>0)+((C^S&(T^C))>>>0)+c[k][1]+t[k][1],n=P+f+l+c[k][0]+t[k][0]+(x/4294967296>>>0)>>>0,i=x>>>0,o=a+h+((x=u+d)/4294967296>>>0)>>>0,s=x>>>0,P=I,R=C,I=A,C=T,A=_,T=S,_=w+n+((x=E+i)/4294967296>>>0)>>>0,S=x>>>0,w=m,E=v,m=g,v=b,g=p,b=y,p=n+o+((x=i+s)/4294967296>>>0)>>>0,y=x>>>0;x=e[0][1]+y,e[0][0]=e[0][0]+p+(x/4294967296>>>0)>>>0,e[0][1]=x>>>0,x=e[1][1]+b,e[1][0]=e[1][0]+g+(x/4294967296>>>0)>>>0,e[1][1]=x>>>0,x=e[2][1]+v,e[2][0]=e[2][0]+m+(x/4294967296>>>0)>>>0,e[2][1]=x>>>0,x=e[3][1]+E,e[3][0]=e[3][0]+w+(x/4294967296>>>0)>>>0,e[3][1]=x>>>0,x=e[4][1]+S,e[4][0]=e[4][0]+_+(x/4294967296>>>0)>>>0,e[4][1]=x>>>0,x=e[5][1]+T,e[5][0]=e[5][0]+A+(x/4294967296>>>0)>>>0,e[5][1]=x>>>0,x=e[6][1]+C,e[6][0]=e[6][0]+I+(x/4294967296>>>0)>>>0,e[6][1]=x>>>0,x=e[7][1]+R,e[7][0]=e[7][0]+P+(x/4294967296>>>0)>>>0,e[7][1]=x>>>0,D-=128}}},97116:(e,t,r)=>{var n=r(34155),i=r(3832),o=r(78807),s=e.exports=i.util=i.util||{};function a(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function c(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(s.isArrayBuffer(e)||s.isArrayBufferView(e))if("undefined"!=typeof Buffer&&e instanceof Buffer)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(e){for(var r=0;r15?(r=Date.now(),a(e)):(t.push(e),1===t.length&&o.setAttribute("a",i=!i))}}s.nextTick=s.setImmediate}(),s.isNodejs=void 0!==n&&n.versions&&n.versions.node,s.globalScope=s.isNodejs?r.g:"undefined"==typeof self?window:self,s.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},s.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},s.isArrayBufferView=function(e){return e&&s.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},s.ByteBuffer=c,s.ByteStringBuffer=c,s.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},s.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},s.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},s.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},s.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},s.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},s.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(s.encodeUtf8(e))},s.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},s.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},s.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},s.ByteStringBuffer.prototype.putInt=function(e,t){a(t);var r="";do{t-=8,r+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(r)},s.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<0);return t},s.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},s.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},s.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},s.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},s.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},s.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},s.ByteStringBuffer.prototype.copy=function(){var e=s.createBuffer(this.data);return e.read=this.read,e},s.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},s.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},s.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},s.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t=e)return this;t=Math.max(t||this.growSize,e);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+t);return n.set(r),this.data=new DataView(n.buffer),this},s.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},s.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},s.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},s.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},s.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},s.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},s.DataBuffer.prototype.putInt=function(e,t){a(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},s.DataBuffer.prototype.putSignedInt=function(e,t){return a(t),this.accommodate(t/8),e<0&&(e+=2<0);return t},s.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},s.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},s.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},s.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},s.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},s.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},s.DataBuffer.prototype.copy=function(){return new s.DataBuffer(this)},s.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},s.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},s.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},s.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return r},s.xorBytes=function(e,t,r){for(var n="",i="",o="",s=0,a=0;r>0;--r,++s)i=e.charCodeAt(s)^t.charCodeAt(s),a>=10&&(n+=o,o="",a=0),o+=String.fromCharCode(i),++a;return n+o},s.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",f=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],l="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";s.encode64=function(e,t){for(var r,n,i,o="",s="",a=0;a>2),o+=u.charAt((3&r)<<4|n>>4),isNaN(n)?o+="==":(o+=u.charAt((15&n)<<2|i>>6),o+=isNaN(i)?"=":u.charAt(63&i)),t&&o.length>t&&(s+=o.substr(0,t)+"\r\n",o=o.substr(t));return s+o},s.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,n,i,o="",s=0;s>4),64!==n&&(o+=String.fromCharCode((15&r)<<4|n>>2),64!==i&&(o+=String.fromCharCode((3&n)<<6|i)));return o},s.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},s.decodeUtf8=function(e){return decodeURIComponent(escape(e))},s.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:o.encode,decode:o.decode}},s.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},s.binary.raw.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length));for(var i=r=r||0,o=0;o>2),o+=u.charAt((3&r)<<4|n>>4),isNaN(n)?o+="==":(o+=u.charAt((15&n)<<2|i>>6),o+=isNaN(i)?"=":u.charAt(63&i)),t&&o.length>t&&(s+=o.substr(0,t)+"\r\n",o=o.substr(t));return s+o},s.binary.base64.decode=function(e,t,r){var n,i,o,s,a=t;a||(a=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var c=0,u=r=r||0;c>4,64!==o&&(a[u++]=(15&i)<<4|o>>2,64!==s&&(a[u++]=(3&o)<<6|s));return t?u-r:a.subarray(0,u)},s.binary.base58.encode=function(e,t){return s.binary.baseN.encode(e,l,t)},s.binary.base58.decode=function(e,t){return s.binary.baseN.decode(e,l,t)},s.text={utf8:{},utf16:{}},s.text.utf8.encode=function(e,t,r){e=s.encodeUtf8(e);var n=t;n||(n=new Uint8Array(e.length));for(var i=r=r||0,o=0;o0?(i=r[n].substring(0,s),o=r[n].substring(s+1)):(i=r[n],o=null),i in t||(t[i]=[]),i in Object.prototype||null===o||t[i].push(unescape(o))}return t};return void 0===e?(null===v&&(v="undefined"!=typeof window&&window.location&&window.location.search?r(window.location.search.substring(1)):{}),t=v):t=r(e),t},s.parseFragment=function(e){var t=e,r="",n=e.indexOf("?");n>0&&(t=e.substring(0,n),r=e.substring(n+1));var i=t.split("/");return i.length>0&&""===i[0]&&i.shift(),{pathString:t,queryString:r,path:i,query:""===r?{}:s.getQueryVariables(r)}},s.makeRequest=function(e){var t=s.parseFragment(e),r={path:t.pathString,query:t.queryString,getPath:function(e){return void 0===e?t.path:t.path[e]},getQuery:function(e,r){var n;return void 0===e?n=t.query:(n=t.query[e])&&void 0!==r&&(n=n[r]),n},getQueryLast:function(e,t){var n=r.getQuery(e);return n?n[n.length-1]:t}};return r},s.makeLink=function(e,t,r){e=jQuery.isArray(e)?e.join("/"):e;var n=jQuery.param(t||{});return r=r||"",e+(n.length>0?"?"+n:"")+(r.length>0?"#"+r:"")},s.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},s.format=function(e){for(var t,r,n=/%./g,i=0,o=[],s=0;t=n.exec(e);){(r=e.substring(s,n.lastIndex-2)).length>0&&o.push(r),s=n.lastIndex;var a=t[0][1];switch(a){case"s":case"o":i");break;case"%":o.push("%");break;default:o.push("<%"+a+"?>")}}return o.push(e.substring(s)),o.join("")},s.formatNumber=function(e,t,r,n){var i=e,o=isNaN(t=Math.abs(t))?2:t,s=void 0===r?",":r,a=void 0===n?".":n,c=i<0?"-":"",u=parseInt(i=Math.abs(+i||0).toFixed(o),10)+"",f=u.length>3?u.length%3:0;return c+(f?u.substr(0,f)+a:"")+u.substr(f).replace(/(\d{3})(?=\d)/g,"$1"+a)+(o?s+Math.abs(i-u).toFixed(o).slice(2):"")},s.formatSize=function(e){return e>=1073741824?s.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?s.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?s.formatNumber(e/1024,0)+" KiB":s.formatNumber(e,0)+" bytes"},s.bytesFromIP=function(e){return-1!==e.indexOf(".")?s.bytesFromIPv4(e):-1!==e.indexOf(":")?s.bytesFromIPv6(e):null},s.bytesFromIPv4=function(e){if(4!==(e=e.split(".")).length)return null;for(var t=s.createBuffer(),r=0;rr[n].end-r[n].start&&(n=r.length-1)):r.push({start:c,end:c})}t.push(o)}if(r.length>0){var u=r[n];u.end-u.start>0&&(t.splice(u.start,u.end-u.start+1,""),0===u.start&&t.unshift(""),7===u.end&&t.push(""))}return t.join(":")},s.estimateCores=function(e,t){if("function"==typeof e&&(t=e,e={}),e=e||{},"cores"in s&&!e.update)return t(null,s.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return s.cores=navigator.hardwareConcurrency,t(null,s.cores);if("undefined"==typeof Worker)return s.cores=1,t(null,s.cores);if("undefined"==typeof Blob)return s.cores=2,t(null,s.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",(function(e){for(var t=Date.now(),r=t+4;Date.now()a.st&&i.sti.st&&a.st{var n=r(3832);r(8925),r(3068),r(33480),r(28991),r(86971),r(66270),r(26953),r(96007),r(28095),r(97116);var i=n.asn1,o=e.exports=n.pki=n.pki||{},s=o.oids,a={};a.CN=s.commonName,a.commonName="CN",a.C=s.countryName,a.countryName="C",a.L=s.localityName,a.localityName="L",a.ST=s.stateOrProvinceName,a.stateOrProvinceName="ST",a.O=s.organizationName,a.organizationName="O",a.OU=s.organizationalUnitName,a.organizationalUnitName="OU",a.E=s.emailAddress,a.emailAddress="E";var c=n.pki.rsa.publicKeyValidator,u={name:"Certificate",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:i.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:i.Class.UNIVERSAL,type:i.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:i.Class.UNIVERSAL,type:i.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:i.Class.UNIVERSAL,type:i.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:i.Class.UNIVERSAL,type:i.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},c,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:i.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:i.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:i.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},f={name:"rsapss",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:i.Class.UNIVERSAL,type:i.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:i.Class.UNIVERSAL,type:i.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:i.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:i.Class.UNIVERSAL,type:i.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:i.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:i.Class.UNIVERSAL,type:i.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},l={name:"CertificationRequestInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},c,{name:"CertificationRequestInfo.attributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0}]}]}]},h={name:"CertificationRequest",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[l,{name:"CertificationRequest.signatureAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:i.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};function d(e,t){"string"==typeof t&&(t={shortName:t});for(var r,n=null,i=0;null===n&&i128)throw new Error('Invalid "nsComment" content.');e.value=i.create(i.Class.UNIVERSAL,i.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&t.cert){var d=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=d.toHex(),e.value=i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,d.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){if(e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),f=e.value.value,e.keyIdentifier){var p=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;f.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!1,p))}if(e.authorityCertIssuer){var g=[i.create(i.Class.CONTEXT_SPECIFIC,4,!0,[y(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];f.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,g))}if(e.serialNumber){var b=n.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);f.push(i.create(i.Class.CONTEXT_SPECIFIC,2,!1,b))}}else if("cRLDistributionPoints"===e.name){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),f=e.value.value;var m,v=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),w=i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[]);for(h=0;h2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(l.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(c.validity.notBefore=l[0],c.validity.notAfter=l[1],c.tbsCertificate=r.tbsCertificate,t){var h;if(c.md=null,c.signatureOid in s)switch(s[c.signatureOid]){case"sha1WithRSAEncryption":c.md=n.md.sha1.create();break;case"md5WithRSAEncryption":c.md=n.md.md5.create();break;case"sha256WithRSAEncryption":case"RSASSA-PSS":c.md=n.md.sha256.create();break;case"sha384WithRSAEncryption":c.md=n.md.sha384.create();break;case"sha512WithRSAEncryption":c.md=n.md.sha512.create()}if(null===c.md)throw(h=new Error("Could not compute certificate digest. Unknown signature OID.")).signatureOid=c.signatureOid,h;var y=i.toDer(c.tbsCertificate);c.md.update(y.getBytes())}var b=n.md.sha1.create();c.issuer.getField=function(e){return d(c.issuer,e)},c.issuer.addField=function(e){g([e]),c.issuer.attributes.push(e)},c.issuer.attributes=o.RDNAttributesAsArray(r.certIssuer,b),r.certIssuerUniqueId&&(c.issuer.uniqueId=r.certIssuerUniqueId),c.issuer.hash=b.digest().toHex();var m=n.md.sha1.create();return c.subject.getField=function(e){return d(c.subject,e)},c.subject.addField=function(e){g([e]),c.subject.attributes.push(e)},c.subject.attributes=o.RDNAttributesAsArray(r.certSubject,m),r.certSubjectUniqueId&&(c.subject.uniqueId=r.certSubjectUniqueId),c.subject.hash=m.digest().toHex(),r.certExtensions?c.extensions=o.certificateExtensionsFromAsn1(r.certExtensions):c.extensions=[],c.publicKey=o.publicKeyFromAsn1(r.subjectPublicKeyInfo),c},o.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r1&&(r=c.value.charCodeAt(1),o=c.value.length>2?c.value.charCodeAt(2):0),t.digitalSignature=128==(128&r),t.nonRepudiation=64==(64&r),t.keyEncipherment=32==(32&r),t.dataEncipherment=16==(16&r),t.keyAgreement=8==(8&r),t.keyCertSign=4==(4&r),t.cRLSign=2==(2&r),t.encipherOnly=1==(1&r),t.decipherOnly=128==(128&o)}else if("basicConstraints"===t.name){(c=i.fromDer(t.value)).value.length>0&&c.value[0].type===i.Type.BOOLEAN?t.cA=0!==c.value[0].value.charCodeAt(0):t.cA=!1;var a=null;c.value.length>0&&c.value[0].type===i.Type.INTEGER?a=c.value[0].value:c.value.length>1&&(a=c.value[1].value),null!==a&&(t.pathLenConstraint=i.derToInteger(a))}else if("extKeyUsage"===t.name)for(var c=i.fromDer(t.value),u=0;u1&&(r=c.value.charCodeAt(1)),t.client=128==(128&r),t.server=64==(64&r),t.email=32==(32&r),t.objsign=16==(16&r),t.reserved=8==(8&r),t.sslCA=4==(4&r),t.emailCA=2==(2&r),t.objCA=1==(1&r);else if("subjectAltName"===t.name||"issuerAltName"===t.name){var l;t.altNames=[],c=i.fromDer(t.value);for(var h=0;h=w&&e0&&s.value.push(o.certificateExtensionsToAsn1(e.extensions)),s},o.getCertificationRequestInfo=function(e){return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes()),y(e.subject),o.publicKeyToAsn1(e.publicKey),v(e)])},o.distinguishedNameToAsn1=function(e){return y(e)},o.certificateToAsn1=function(e){var t=e.tbsCertificate||o.getTBSCertificate(e);return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[t,i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.signatureOid).getBytes()),m(e.signatureOid,e.signatureParameters)]),i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},o.certificateExtensionsToAsn1=function(e){var t=i.create(i.Class.CONTEXT_SPECIFIC,3,!0,[]),r=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;nf.validity.notAfter)&&(c={message:"Certificate is not valid yet or has expired.",error:o.certificateError.certificate_expired,notBefore:f.validity.notBefore,notAfter:f.validity.notAfter,now:s}),null===c){if(null===(l=t[0]||e.getIssuer(f))&&f.isIssuer(f)&&(h=!0,l=f),l){var d=l;n.util.isArray(d)||(d=[d]);for(var p=!1;!p&&d.length>0;){l=d.shift();try{p=l.verify(f)}catch(e){}}p||(c={message:"Certificate signature is invalid.",error:o.certificateError.bad_certificate})}null!==c||l&&!h||e.hasCertificate(f)||(c={message:"Certificate is not trusted.",error:o.certificateError.unknown_ca})}if(null===c&&l&&!f.isIssuer(l)&&(c={message:"Certificate issuer is invalid.",error:o.certificateError.bad_certificate}),null===c)for(var y={keyUsage:!0,basicConstraints:!0},g=0;null===c&&gm.pathLenConstraint&&(c={message:"Certificate basicConstraints pathLenConstraint violated.",error:o.certificateError.bad_certificate})}var w=null===c||c.error,E=r.verify?r.verify(w,u,i):w;if(!0!==E)throw!0===w&&(c={message:"The application rejected the certificate.",error:o.certificateError.bad_certificate}),(E||0===E)&&("object"!=typeof E||n.util.isArray(E)?"string"==typeof E&&(c.error=E):(E.message&&(c.message=E.message),E.error&&(c.error=E.error))),c;c=null,a=!1,++u}while(t.length>0);return!0}},35049:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Observable:()=>E,Subject:()=>P,filter:()=>S,flatMap:()=>A,interval:()=>T,map:()=>I,merge:()=>C,multicast:()=>R,scan:()=>k,unsubscribe:()=>_});class n{constructor(e){this._baseObserver=e,this._pendingPromises=new Set}complete(){Promise.all(this._pendingPromises).then((()=>this._baseObserver.complete())).catch((e=>this._baseObserver.error(e)))}error(e){this._baseObserver.error(e)}schedule(e){const t=Promise.all(this._pendingPromises),r=[],n=e=>r.push(e),i=Promise.resolve().then((()=>{return o=this,s=void 0,c=function*(){yield t,yield e(n),this._pendingPromises.delete(i);for(const e of r)this._baseObserver.next(e)},new((a=void 0)||(a=Promise))((function(e,t){function r(e){try{i(c.next(e))}catch(e){t(e)}}function n(e){try{i(c.throw(e))}catch(e){t(e)}}function i(t){var i;t.done?e(t.value):(i=t.value,i instanceof a?i:new a((function(e){e(i)}))).then(r,n)}i((c=c.apply(o,s||[])).next())}));var o,s,a,c})).catch((e=>{this._pendingPromises.delete(i),this._baseObserver.error(e)}));this._pendingPromises.add(i)}}const i=()=>"function"==typeof Symbol,o=e=>i()&&Boolean(Symbol[e]),s=e=>o(e)?Symbol[e]:"@@"+e;o("asyncIterator")||(Symbol.asyncIterator=Symbol.asyncIterator||Symbol.for("Symbol.asyncIterator"));const a=s("iterator"),c=s("observable"),u=s("species");function f(e,t){const r=e[t];if(null!=r){if("function"!=typeof r)throw new TypeError(r+" is not a function");return r}}function l(e){let t=e.constructor;return void 0!==t&&(t=t[u],null===t&&(t=void 0)),void 0!==t?t:w}function h(e){h.log?h.log(e):setTimeout((()=>{throw e}),0)}function d(e){Promise.resolve().then((()=>{try{e()}catch(e){h(e)}}))}function p(e){const t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{const e=f(t,"unsubscribe");e&&e.call(t)}}catch(e){h(e)}}function y(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function g(e,t,r){e._state="running";const n=e._observer;try{const i=n?f(n,t):void 0;switch(t){case"next":i&&i.call(n,r);break;case"error":if(y(e),!i)throw r;i.call(n,r);break;case"complete":y(e),i&&i.call(n)}}catch(e){h(e)}"closed"===e._state?p(e):"running"===e._state&&(e._state="ready")}function b(e,t,r){if("closed"!==e._state)return"buffering"===e._state?(e._queue=e._queue||[],void e._queue.push({type:t,value:r})):"ready"!==e._state?(e._state="buffering",e._queue=[{type:t,value:r}],void d((()=>function(e){const t=e._queue;if(t){e._queue=void 0,e._state="ready";for(const r of t)if(g(e,r.type,r.value),"closed"===e._state)break}}(e)))):void g(e,t,r)}class m{constructor(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";const r=new v(this);try{this._cleanup=t.call(void 0,r)}catch(e){r.error(e)}"initializing"===this._state&&(this._state="ready")}get closed(){return"closed"===this._state}unsubscribe(){"closed"!==this._state&&(y(this),p(this))}}class v{constructor(e){this._subscription=e}get closed(){return"closed"===this._subscription._state}next(e){b(this._subscription,"next",e)}error(e){b(this._subscription,"error",e)}complete(){b(this._subscription,"complete")}}class w{constructor(e){if(!(this instanceof w))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof e)throw new TypeError("Observable initializer must be a function");this._subscriber=e}subscribe(e,t,r){return"object"==typeof e&&null!==e||(e={next:e,error:t,complete:r}),new m(e,this._subscriber)}pipe(e,...t){let r=this;for(const n of[e,...t])r=n(r);return r}tap(e,t,r){const n="object"!=typeof e||null===e?{next:e,error:t,complete:r}:e;return new w((e=>this.subscribe({next(t){n.next&&n.next(t),e.next(t)},error(t){n.error&&n.error(t),e.error(t)},complete(){n.complete&&n.complete(),e.complete()},start(e){n.start&&n.start(e)}})))}forEach(e){return new Promise(((t,r)=>{if("function"!=typeof e)return void r(new TypeError(e+" is not a function"));function n(){i.unsubscribe(),t(void 0)}const i=this.subscribe({next(t){try{e(t,n)}catch(e){r(e),i.unsubscribe()}},error(e){r(e)},complete(){t(void 0)}})}))}map(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(l(this))((t=>this.subscribe({next(r){let n=r;try{n=e(r)}catch(e){return t.error(e)}t.next(n)},error(e){t.error(e)},complete(){t.complete()}})))}filter(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(l(this))((t=>this.subscribe({next(r){try{if(!e(r))return}catch(e){return t.error(e)}t.next(r)},error(e){t.error(e)},complete(){t.complete()}})))}reduce(e,t){if("function"!=typeof e)throw new TypeError(e+" is not a function");const r=l(this),n=arguments.length>1;let i=!1,o=t;return new r((t=>this.subscribe({next(r){const s=!i;if(i=!0,!s||n)try{o=e(o,r)}catch(e){return t.error(e)}else o=r},error(e){t.error(e)},complete(){if(!i&&!n)return t.error(new TypeError("Cannot reduce an empty sequence"));t.next(o),t.complete()}})))}concat(...e){const t=l(this);return new t((r=>{let n,i=0;return function o(s){n=s.subscribe({next(e){r.next(e)},error(e){r.error(e)},complete(){i===e.length?(n=void 0,r.complete()):o(t.from(e[i++]))}})}(this),()=>{n&&(n.unsubscribe(),n=void 0)}}))}flatMap(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");const t=l(this);return new t((r=>{const n=[],i=this.subscribe({next(i){let s;if(e)try{s=e(i)}catch(e){return r.error(e)}else s=i;const a=t.from(s).subscribe({next(e){r.next(e)},error(e){r.error(e)},complete(){const e=n.indexOf(a);e>=0&&n.splice(e,1),o()}});n.push(a)},error(e){r.error(e)},complete(){o()}});function o(){i.closed&&0===n.length&&r.complete()}return()=>{n.forEach((e=>e.unsubscribe())),i.unsubscribe()}}))}[(Symbol.observable,c)](){return this}static from(e){const t="function"==typeof this?this:w;if(null==e)throw new TypeError(e+" is not an object");const r=f(e,c);if(r){const n=r.call(e);if(Object(n)!==n)throw new TypeError(n+" is not an object");return function(e){return e instanceof w}(n)&&n.constructor===t?n:new t((e=>n.subscribe(e)))}if(o("iterator")){const r=f(e,a);if(r)return new t((t=>{d((()=>{if(!t.closed){for(const n of r.call(e))if(t.next(n),t.closed)return;t.complete()}}))}))}if(Array.isArray(e))return new t((t=>{d((()=>{if(!t.closed){for(const r of e)if(t.next(r),t.closed)return;t.complete()}}))}));throw new TypeError(e+" is not observable")}static of(...e){return new("function"==typeof this?this:w)((t=>{d((()=>{if(!t.closed){for(const r of e)if(t.next(r),t.closed)return;t.complete()}}))}))}static get[u](){return this}}i()&&Object.defineProperty(w,Symbol("extensions"),{value:{symbol:c,hostReportError:h},configurable:!0});const E=w,_=function(e){"function"==typeof e?e():e&&"function"==typeof e.unsubscribe&&e.unsubscribe()};const S=function(e){return t=>new E((r=>{const i=new n(r),o=t.subscribe({complete(){i.complete()},error(e){i.error(e)},next(t){i.schedule((r=>{return n=this,i=void 0,s=function*(){(yield e(t))&&r(t)},new((o=void 0)||(o=Promise))((function(e,t){function r(e){try{c(s.next(e))}catch(e){t(e)}}function a(e){try{c(s.throw(e))}catch(e){t(e)}}function c(t){var n;t.done?e(t.value):(n=t.value,n instanceof o?n:new o((function(e){e(n)}))).then(r,a)}c((s=s.apply(n,i||[])).next())}));var n,i,o,s}))}});return()=>_(o)}))};const A=function(e){return t=>new E((r=>{const i=new n(r),s=t.subscribe({complete(){i.complete()},error(e){i.error(e)},next(t){i.schedule((r=>{return n=this,i=void 0,a=function*(){var n,i;const s=yield e(t);if((u=s)&&o("iterator")&&u[Symbol.iterator]||function(e){return e&&o("asyncIterator")&&e[Symbol.asyncIterator]}(s))try{for(var a,c=function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise((function(n,i){!function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)}(n,i,(t=e[r](t)).done,t.value)}))}}}(s);!(a=yield c.next()).done;){const e=a.value;r(e)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(i=c.return)&&(yield i.call(c))}finally{if(n)throw n.error}}else s.map((e=>r(e)));var u},new((s=void 0)||(s=Promise))((function(e,t){function r(e){try{c(a.next(e))}catch(e){t(e)}}function o(e){try{c(a.throw(e))}catch(e){t(e)}}function c(t){var n;t.done?e(t.value):(n=t.value,n instanceof s?n:new s((function(e){e(n)}))).then(r,o)}c((a=a.apply(n,i||[])).next())}));var n,i,s,a}))}});return()=>_(s)}))};function T(e){return new w((t=>{let r=0;const n=setInterval((()=>{t.next(r++)}),e);return()=>clearInterval(n)}))}const I=function(e){return t=>new E((r=>{const i=new n(r),o=t.subscribe({complete(){i.complete()},error(e){i.error(e)},next(t){i.schedule((r=>{return n=this,i=void 0,s=function*(){const n=yield e(t);r(n)},new((o=void 0)||(o=Promise))((function(e,t){function r(e){try{c(s.next(e))}catch(e){t(e)}}function a(e){try{c(s.throw(e))}catch(e){t(e)}}function c(t){var n;t.done?e(t.value):(n=t.value,n instanceof o?n:new o((function(e){e(n)}))).then(r,a)}c((s=s.apply(n,i||[])).next())}));var n,i,o,s}))}});return()=>_(o)}))},C=function(...e){return 0===e.length?w.from([]):new w((t=>{let r=0;const n=e.map((n=>n.subscribe({error(e){t.error(e),i()},next(e){t.next(e)},complete(){++r===e.length&&(t.complete(),i())}}))),i=()=>{n.forEach((e=>_(e)))};return i}))},P=class extends E{constructor(){super((e=>(this._observers.add(e),()=>this._observers.delete(e)))),this._observers=new Set}next(e){for(const t of this._observers)t.next(e)}error(e){for(const t of this._observers)t.error(e)}complete(){for(const e of this._observers)e.complete()}},R=function(e){const t=new P;let r,n=0;return new E((i=>{r||(r=e.subscribe(t));const o=t.subscribe(i);return n++,()=>{n--,o.unsubscribe(),0===n&&(_(r),r=void 0)}}))};const k=function(e,t){return r=>new E((i=>{let o,s=0;const a=new n(i),c=r.subscribe({complete(){a.complete()},error(e){a.error(e)},next(r){a.schedule((n=>{return i=this,a=void 0,u=function*(){const i=0===s?void 0===t?r:t:o;o=yield e(i,r,s++),n(o)},new((c=void 0)||(c=Promise))((function(e,t){function r(e){try{o(u.next(e))}catch(e){t(e)}}function n(e){try{o(u.throw(e))}catch(e){t(e)}}function o(t){var i;t.done?e(t.value):(i=t.value,i instanceof c?i:new c((function(e){e(i)}))).then(r,n)}o((u=u.apply(i,a||[])).next())}));var i,a,c,u}))}});return()=>_(c)}))}},61750:(e,t,r)=>{"use strict";const n=r(97759),i=r(80341);e.exports=(e,t)=>{const r=n(e,{...t,count:1});return i.fn((async e=>{e((()=>{r.cancel()}));const[t]=await r;return t}))()},e.exports.AggregateError=n.AggregateError},80341:e=>{"use strict";class t extends Error{constructor(e){super(e||"Promise was canceled"),this.name="CancelError"}get isCanceled(){return!0}}class r{static fn(e){return(...t)=>new r(((r,n,i)=>{t.push(i),e(...t).then(r,n)}))}constructor(e){this._cancelHandlers=[],this._isPending=!0,this._isCanceled=!1,this._rejectOnCancel=!0,this._promise=new Promise(((t,r)=>{this._reject=r;const n=e=>{if(!this._isPending)throw new Error("The `onCancel` handler was attached after the promise settled.");this._cancelHandlers.push(e)};return Object.defineProperties(n,{shouldReject:{get:()=>this._rejectOnCancel,set:e=>{this._rejectOnCancel=e}}}),e((e=>{this._isCanceled&&n.shouldReject||(this._isPending=!1,t(e))}),(e=>{this._isPending=!1,r(e)}),n)}))}then(e,t){return this._promise.then(e,t)}catch(e){return this._promise.catch(e)}finally(e){return this._promise.finally(e)}cancel(e){if(this._isPending&&!this._isCanceled){if(this._isCanceled=!0,this._cancelHandlers.length>0)try{for(const e of this._cancelHandlers)e()}catch(e){return void this._reject(e)}this._rejectOnCancel&&this._reject(new t(e))}}get isCanceled(){return this._isCanceled}}Object.setPrototypeOf(r.prototype,Promise.prototype),e.exports=r,e.exports.CancelError=t},63931:e=>{"use strict";e.exports=()=>{const e={};return e.promise=new Promise(((t,r)=>{e.resolve=t,e.reject=r})),e}},35103:(e,t,r)=>{const n=r(91607),i=r(63931);e.exports=class{constructor(){this._buffer=new n,this._waitingConsumers=new n}push(e){const{promise:t,resolve:r}=i();return this._buffer.push({chunk:e,resolve:r}),this._consume(),t}_consume(){for(;!this._waitingConsumers.isEmpty()&&!this._buffer.isEmpty();){const e=this._waitingConsumers.shift(),t=this._buffer.shift();e.resolve(t.chunk),t.resolve()}}shift(){const{promise:e,resolve:t}=i();return this._waitingConsumers.push({resolve:t}),this._consume(),e}isEmpty(){return this._buffer.isEmpty()}}},80406:(e,t,r)=>{"use strict";const n=r(89161),i=e=>{if(!Number.isInteger(e)&&e!==1/0||!(e>0))return Promise.reject(new TypeError("Expected `concurrency` to be a number from 1 and up"));const t=[];let r=0;const i=()=>{r--,t.length>0&&t.shift()()},o=(e,t,...o)=>{r++;const s=n(e,...o);t(s),s.then(i,i)},s=(n,...i)=>new Promise((s=>((n,i,...s)=>{rr},pendingCount:{get:()=>t.length},clearQueue:{value:()=>{t.length=0}}}),s};e.exports=i,e.exports.default=i},47924:e=>{"use strict";const t=async e=>{try{return{isFulfilled:!0,isRejected:!1,value:await e}}catch(e){return{isFulfilled:!1,isRejected:!0,reason:e}}};e.exports=t,e.exports.default=t},42693:(e,t,r)=>{"use strict";const n=r(99353),i=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"];class o extends Error{constructor(e){super(),e instanceof Error?(this.originalError=e,({message:e}=e)):(this.originalError=new Error(e),this.originalError.stack=this.stack),this.name="AbortError",this.message=e}}const s=(e,t)=>new Promise(((r,s)=>{t={onFailedAttempt:()=>{},retries:10,...t};const a=n.operation(t);a.attempt((async n=>{try{r(await e(n))}catch(e){if(!(e instanceof Error))return void s(new TypeError(`Non-error was thrown: "${e}". You should only throw errors.`));if(e instanceof o)a.stop(),s(e.originalError);else if(e instanceof TypeError&&(c=e.message,!i.includes(c)))a.stop(),s(e);else{((e,t,r)=>{const n=r.retries-(t-1);e.attemptNumber=t,e.retriesLeft=n})(e,n,t);try{await t.onFailedAttempt(e)}catch(e){return void s(e)}a.retry(e)||s(a.mainError())}}var c}))}));e.exports=s,e.exports.default=s,e.exports.AbortError=o},13296:(e,t,r)=>{"use strict";const n=r(47924),i=r(80406);e.exports=async(e,t={})=>{const{concurrency:r=1/0}=t,o=i(r);return Promise.all(e.map((e=>e&&"function"==typeof e.then?n(e):n("function"==typeof e?o((()=>e())):Promise.resolve(e)))))}},97759:(e,t,r)=>{"use strict";const n=r(56455),i=r(80341);class o extends Error{}e.exports=(e,t)=>new i(((r,i,s)=>{const{count:a,filter:c=(()=>!0)}=t;if(!Number.isFinite(a))return void i(new TypeError("Expected a finite number, got "+typeof t.count));const u=[],f=[];let l=0,h=!1;const d=new Set,p=()=>{for(const t of e)d.has(t)||"function"!=typeof t.cancel||t.cancel()};s(p);for(const t of e)l++,(async()=>{try{const e=await t;if(h)return;if(!c(e))throw new o("Value does not satisfy filter");u.push(e)}catch(e){f.push(e)}finally{d.add(t),!h&&(u.length===a&&(r(u),h=!0),l-f.lengthl&&(i(new RangeError(`Expected input to contain at least ${t.count} items, but contains ${l} items`)),p())})),e.exports.AggregateError=n,e.exports.FilterError=o},58147:e=>{"use strict";class t extends Error{constructor(e){super(e),this.name="TimeoutError"}}const r=(e,r,n,i)=>{let o;const s=new Promise(((s,a)=>{if("number"!=typeof r||r<0)throw new TypeError("Expected `milliseconds` to be a positive number");r!==1/0?(i={customTimers:{setTimeout,clearTimeout},...i},o=i.customTimers.setTimeout.call(void 0,(()=>{if("function"==typeof n){try{s(n())}catch(e){a(e)}return}const i=n instanceof Error?n:new t("string"==typeof n?n:`Promise timed out after ${r} milliseconds`);"function"==typeof e.cancel&&e.cancel(),a(i)}),r),(async()=>{try{s(await e)}catch(e){a(e)}finally{i.customTimers.clearTimeout.call(void 0,o)}})()):s(e)}));return s.clear=()=>{clearTimeout(o),o=void 0},s};e.exports=r,e.exports.default=r,e.exports.TimeoutError=t},89161:e=>{"use strict";const t=(e,...t)=>new Promise((r=>{r(e(...t))}));e.exports=t,e.exports.default=t},88785:(e,t,r)=>{"use strict";const{CID:n}=r(81362),i=r(22817),o=r(98441),s=r(99086),a=r(9885),{base58btc:c}=r(99086),{base32:u}=r(22817),{base16:f}=r(84835),l=r(28924),h=r(14437),d=r(98514),{PeerIdProto:p}=r(28780),{equals:y}=r(19588),{fromString:g}=r(52217),{toString:b}=r(92263),{identity:m}=r(78103),v={...i,...o,...s,...a},w=Object.keys(v).reduce(((e,t)=>e.or(v[t])),u.decoder),E=d(class{constructor(e,t,r){if(!(e instanceof Uint8Array))throw new Error("invalid id provided");if(t&&r&&!y(t.public.bytes,r.bytes))throw new Error("inconsistent arguments");this._id=e,this._idB58String=c.encode(this.id).substring(1),this._privKey=t,this._pubKey=r}get id(){return this._id}set id(e){throw new Error("Id is immutable")}get privKey(){return this._privKey}set privKey(e){this._privKey=e}get pubKey(){if(this._pubKey)return this._pubKey;if(this._privKey)return this._privKey.public;try{const e=l.decode(this.id);e.code===m.code&&(this._pubKey=h.unmarshalPublicKey(e.digest))}catch(e){}return this._pubKey}set pubKey(e){this._pubKey=e}marshalPubKey(){if(this.pubKey)return h.marshalPublicKey(this.pubKey)}marshalPrivKey(){if(this.privKey)return h.marshalPrivateKey(this.privKey)}marshal(e){return p.encode({id:this.toBytes(),pubKey:this.marshalPubKey(),privKey:e?null:this.marshalPrivKey()}).finish()}toPrint(){let e=this.toB58String();e.startsWith("Qm")&&(e=e.slice(2));let t=6;return e.length"}toJSON(){return{id:this.toB58String(),privKey:T(this.marshalPrivKey()),pubKey:T(this.marshalPubKey())}}toHexString(){return f.encode(this.id).substring(1)}toBytes(){return this.id}toB58String(){return this._idB58String}toString(){if(!this._idCIDString){const e=n.createV1(114,l.decode(this.id));Object.defineProperty(this,"_idCIDString",{value:e.toString(),enumerable:!1})}return this._idCIDString}equals(e){if(e instanceof Uint8Array)return y(this.id,e);if(e.id)return y(this.id,e.id);throw new Error("not valid Id")}isEqual(e){return this.equals(e)}isValid(){return Boolean(this.privKey&&this.privKey.public&&this.privKey.public.bytes&&this.pubKey.bytes instanceof Uint8Array&&y(this.privKey.public.bytes,this.pubKey.bytes))}hasInlinePublicKey(){try{if(l.decode(this.id).code===m.code)return!0}catch(e){}return!1}},{className:"PeerId",symbolName:"@libp2p/js-peer-id/PeerId"});t=e.exports=E;const _=e=>e.bytes.length<=42?l.create(m.code,e.bytes).bytes:e.hash(),S=async(e,t)=>{const r=await _(t);return new E(r,e,t)};t.create=async e=>{(e=e||{}).bits=e.bits||2048,e.keyType=e.keyType||"RSA";const t=await h.generateKeyPair(e.keyType,e.bits);return S(t,t.public)},t.createFromHexString=e=>new E(f.decode("f"+e)),t.createFromBytes=e=>{try{const r=n.decode(e);if(!A(r))throw new Error("Supplied PeerID CID is invalid");return t.createFromCID(r)}catch{if(l.decode(e).code!==m.code)throw new Error("Supplied PeerID CID is invalid");return new E(e)}},t.createFromB58String=e=>t.createFromBytes(c.decode("z"+e));const A=e=>114===e.code||112===e.code;function T(e){if(e)return b(e,"base64pad")}t.createFromCID=e=>{if(!(e=n.asCID(e))||!A(e))throw new Error("Supplied PeerID CID is invalid");return new E(e.multihash.bytes)},t.createFromPubKey=async e=>{let t=e;if("string"==typeof t&&(t=g(e,"base64pad")),!(t instanceof Uint8Array))throw new Error("Supplied key is neither a base64 string nor a Uint8Array");const r=await h.unmarshalPublicKey(t);return S(void 0,r)},t.createFromPrivKey=async e=>{if("string"==typeof e&&(e=g(e,"base64pad")),!(e instanceof Uint8Array))throw new Error("Supplied key is neither a base64 string nor a Uint8Array");const t=await h.unmarshalPrivateKey(e);return S(t,t.public)},t.createFromJSON=async e=>{const t=c.decode("z"+e.id),r=e.privKey&&g(e.privKey,"base64pad"),n=e.pubKey&&g(e.pubKey,"base64pad"),i=n&&await h.unmarshalPublicKey(n);if(!r)return new E(t,void 0,i);const o=await h.unmarshalPrivateKey(r),s=await _(o.public);let a;if(i&&(a=await _(i)),i&&!y(s,a))throw new Error("Public and private key do not match");if(t&&!y(s,t))throw new Error("Id and private key do not match");return new E(t,o,i)},t.createFromProtobuf=async e=>{"string"==typeof e&&(e=g(e,"base16"));let t,r,{id:n,privKey:i,pubKey:o}=p.decode(e);if(i=!!i&&await h.unmarshalPrivateKey(i),o=!!o&&await h.unmarshalPublicKey(o),i&&(r=await _(i.public)),o&&(t=await _(o)),i){if(o&&!y(r,t))throw new Error("Public and private key do not match");return new E(r,i,i.public)}if(o)return new E(t,void 0,o);if(n)return new E(n);throw new Error("Protobuf did not contain any usable key material")},t.parse=e=>("1"!==e.charAt(0)&&"Q"!==e.charAt(0)||(e=`z${e}`),t.createFromBytes(w.decode(e))),t.isPeerId=e=>Boolean("object"==typeof e&&e._id&&e._idB58String)},28780:(e,t,r)=>{"use strict";var n=r(62100),i=n.Reader,o=n.Writer,s=n.util,a=n.roots["libp2p-peer-id"]||(n.roots["libp2p-peer-id"]={});a.PeerIdProto=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.id=e.bytes();break;case 2:n.pubKey=e.bytes();break;case 3:n.privKey=e.bytes();break;default:e.skipType(7&o)}}if(!n.hasOwnProperty("id"))throw s.ProtocolError("missing required 'id'",{instance:n});return n},e.fromObject=function(e){if(e instanceof a.PeerIdProto)return e;var t=new a.PeerIdProto;return null!=e.id&&("string"==typeof e.id?s.base64.decode(e.id,t.id=s.newBuffer(s.base64.length(e.id)),0):e.id.length&&(t.id=e.id)),null!=e.pubKey&&("string"==typeof e.pubKey?s.base64.decode(e.pubKey,t.pubKey=s.newBuffer(s.base64.length(e.pubKey)),0):e.pubKey.length&&(t.pubKey=e.pubKey)),null!=e.privKey&&("string"==typeof e.privKey?s.base64.decode(e.privKey,t.privKey=s.newBuffer(s.base64.length(e.privKey)),0):e.privKey.length&&(t.privKey=e.privKey)),t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(t.bytes===String?r.id="":(r.id=[],t.bytes!==Array&&(r.id=s.newBuffer(r.id))),t.bytes===String?r.pubKey="":(r.pubKey=[],t.bytes!==Array&&(r.pubKey=s.newBuffer(r.pubKey))),t.bytes===String?r.privKey="":(r.privKey=[],t.bytes!==Array&&(r.privKey=s.newBuffer(r.privKey)))),null!=e.id&&e.hasOwnProperty("id")&&(r.id=t.bytes===String?s.base64.encode(e.id,0,e.id.length):t.bytes===Array?Array.prototype.slice.call(e.id):e.id),null!=e.pubKey&&e.hasOwnProperty("pubKey")&&(r.pubKey=t.bytes===String?s.base64.encode(e.pubKey,0,e.pubKey.length):t.bytes===Array?Array.prototype.slice.call(e.pubKey):e.pubKey),null!=e.privKey&&e.hasOwnProperty("privKey")&&(r.privKey=t.bytes===String?s.base64.encode(e.privKey,0,e.privKey.length):t.bytes===Array?Array.prototype.slice.call(e.privKey):e.privKey),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,n.util.toJSONOptions)},e}(),e.exports=a},290:(e,t,r)=>{"use strict";e.exports=r(96114).default},96114:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=r(28951),o=n(r(1476)),s=n(r(5003)),a=r(56512),c=["0.0.0.0/8","10.0.0.0/8","100.64.0.0/10","127.0.0.0/8","169.254.0.0/16","172.16.0.0/12","192.0.0.0/24","192.0.0.0/29","192.0.0.8/32","192.0.0.9/32","192.0.0.10/32","192.0.0.170/32","192.0.0.171/32","192.0.2.0/24","192.31.196.0/24","192.52.193.0/24","192.88.99.0/24","192.168.0.0/16","192.175.48.0/24","198.18.0.0/15","198.51.100.0/24","203.0.113.0/24","240.0.0.0/4","255.255.255.255/32"].map((e=>new i.Netmask(e)));function u(e){return/^::$/.test(e)||/^::1$/.test(e)||/^::f{4}:([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(e)||/^::f{4}:0.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(e)||/^64:ff9b::([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(e)||/^100::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(e)||/^2001::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(e)||/^2001:2[0-9a-fA-F]:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(e)||/^2001:db8:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(e)||/^2002:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(e)||/^f[c-d]([0-9a-fA-F]{2,2}):/i.test(e)||/^fe[8-9a-bA-B][0-9a-fA-F]:/i.test(e)||/^ff([0-9a-fA-F]{2,2}):/i.test(e)}t.default=e=>{if(a.isValid(e)){const t=a.parse(e);if("ipv4"===t.kind())return function(e){for(let t of c)if(t.contains(e))return!0;return!1}(t.toNormalizedString());if("ipv6"===t.kind())return u(e)}else if(s.default(e)&&o.default.v6().test(e))return u(e)}},34155:e=>{var t,r,n=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var a,c=[],u=!1,f=-1;function l(){u&&a&&(u=!1,a.length?c=a.concat(c):f=-1,c.length&&h())}function h(){if(!u){var e=s(l);u=!0;for(var t=c.length;t;){for(a=c,c=[];++f1)for(var r=1;r{"use strict";e.exports=r(89482)},89482:(e,t,r)=>{"use strict";var n=t;function i(){n.util._configure(),n.Writer._configure(n.BufferWriter),n.Reader._configure(n.BufferReader)}n.build="minimal",n.Writer=r(41173),n.BufferWriter=r(43155),n.Reader=r(51408),n.BufferReader=r(50593),n.util=r(99693),n.rpc=r(35994),n.roots=r(85054),n.configure=i,i()},51408:(e,t,r)=>{"use strict";e.exports=c;var n,i=r(99693),o=i.LongBits,s=i.utf8;function a(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function c(e){this.buf=e,this.pos=0,this.len=e.length}var u,f="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new c(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new c(e);throw Error("illegal buffer")},l=function(){return i.Buffer?function(e){return(c.create=function(e){return i.Buffer.isBuffer(e)?new n(e):f(e)})(e)}:f};function h(){var e=new o(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function d(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function p(){if(this.pos+8>this.len)throw a(this,8);return new o(d(this.buf,this.pos+=4),d(this.buf,this.pos+=4))}c.create=l(),c.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,c.prototype.uint32=(u=4294967295,function(){if(u=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return u;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return u}),c.prototype.int32=function(){return 0|this.uint32()},c.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},c.prototype.bool=function(){return 0!==this.uint32()},c.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return d(this.buf,this.pos+=4)},c.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return 0|d(this.buf,this.pos+=4)},c.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var e=i.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},c.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var e=i.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},c.prototype.bytes=function(){var e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?new this.buf.constructor(0):this._slice.call(this.buf,t,r)},c.prototype.string=function(){var e=this.bytes();return s.read(e,0,e.length)},c.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},c.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},c._configure=function(e){n=e,c.create=l(),n._configure();var t=i.Long?"toLong":"toNumber";i.merge(c.prototype,{int64:function(){return h.call(this)[t](!1)},uint64:function(){return h.call(this)[t](!0)},sint64:function(){return h.call(this).zzDecode()[t](!1)},fixed64:function(){return p.call(this)[t](!0)},sfixed64:function(){return p.call(this)[t](!1)}})}},50593:(e,t,r)=>{"use strict";e.exports=o;var n=r(51408);(o.prototype=Object.create(n.prototype)).constructor=o;var i=r(99693);function o(e){n.call(this,e)}o._configure=function(){i.Buffer&&(o.prototype._slice=i.Buffer.prototype.slice)},o.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},o._configure()},85054:e=>{"use strict";e.exports={}},35994:(e,t,r)=>{"use strict";t.Service=r(77948)},77948:(e,t,r)=>{"use strict";e.exports=i;var n=r(99693);function i(e,t,r){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");n.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(r)}(i.prototype=Object.create(n.EventEmitter.prototype)).constructor=i,i.prototype.rpcCall=function e(t,r,i,o,s){if(!o)throw TypeError("request must be specified");var a=this;if(!s)return n.asPromise(e,a,t,r,i,o);if(a.rpcImpl)try{return a.rpcImpl(t,r[a.requestDelimited?"encodeDelimited":"encode"](o).finish(),(function(e,r){if(e)return a.emit("error",e,t),s(e);if(null!==r){if(!(r instanceof i))try{r=i[a.responseDelimited?"decodeDelimited":"decode"](r)}catch(e){return a.emit("error",e,t),s(e)}return a.emit("data",r,t),s(null,r)}a.end(!0)}))}catch(e){return a.emit("error",e,t),void setTimeout((function(){s(e)}),0)}else setTimeout((function(){s(Error("already ended"))}),0)},i.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},1945:(e,t,r)=>{"use strict";e.exports=i;var n=r(99693);function i(e,t){this.lo=e>>>0,this.hi=t>>>0}var o=i.zero=new i(0,0);o.toNumber=function(){return 0},o.zzEncode=o.zzDecode=function(){return this},o.length=function(){return 1};var s=i.zeroHash="\0\0\0\0\0\0\0\0";i.fromNumber=function(e){if(0===e)return o;var t=e<0;t&&(e=-e);var r=e>>>0,n=(e-r)/4294967296>>>0;return t&&(n=~n>>>0,r=~r>>>0,++r>4294967295&&(r=0,++n>4294967295&&(n=0))),new i(r,n)},i.from=function(e){if("number"==typeof e)return i.fromNumber(e);if(n.isString(e)){if(!n.Long)return i.fromNumber(parseInt(e,10));e=n.Long.fromString(e)}return e.low||e.high?new i(e.low>>>0,e.high>>>0):o},i.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(e){return n.Long?new n.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var a=String.prototype.charCodeAt;i.fromHash=function(e){return e===s?o:new i((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},i.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},i.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},i.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},i.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}},99693:function(e,t,r){"use strict";var n=t;function i(e,t,r){for(var n=Object.keys(t),i=0;i0)},n.Buffer=function(){try{var e=n.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),n._Buffer_from=null,n._Buffer_allocUnsafe=null,n.newBuffer=function(e){return"number"==typeof e?n.Buffer?n._Buffer_allocUnsafe(e):new n.Array(e):n.Buffer?n._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},n.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,n.Long=n.global.dcodeIO&&n.global.dcodeIO.Long||n.global.Long||n.inquire("long"),n.key2Re=/^true|false|0|1$/,n.key32Re=/^-?(?:0|[1-9][0-9]*)$/,n.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,n.longToHash=function(e){return e?n.LongBits.from(e).toHash():n.LongBits.zeroHash},n.longFromHash=function(e,t){var r=n.LongBits.fromHash(e);return n.Long?n.Long.fromBits(r.lo,r.hi,t):r.toNumber(Boolean(t))},n.merge=i,n.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},n.newError=o,n.ProtocolError=o("ProtocolError"),n.oneOfGetter=function(e){for(var t={},r=0;r-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}},n.oneOfSetter=function(e){return function(t){for(var r=0;r{"use strict";e.exports=l;var n,i=r(99693),o=i.LongBits,s=i.base64,a=i.utf8;function c(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function u(){}function f(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function l(){this.len=0,this.head=new c(u,0,0),this.tail=this.head,this.states=null}var h=function(){return i.Buffer?function(){return(l.create=function(){return new n})()}:function(){return new l}};function d(e,t,r){t[r]=255&e}function p(e,t){this.len=e,this.next=void 0,this.val=t}function y(e,t,r){for(;e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function g(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}l.create=h(),l.alloc=function(e){return new i.Array(e)},i.Array!==Array&&(l.alloc=i.pool(l.alloc,i.Array.prototype.subarray)),l.prototype._push=function(e,t,r){return this.tail=this.tail.next=new c(e,t,r),this.len+=t,this},p.prototype=Object.create(c.prototype),p.prototype.fn=function(e,t,r){for(;e>127;)t[r++]=127&e|128,e>>>=7;t[r]=e},l.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new p((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},l.prototype.int32=function(e){return e<0?this._push(y,10,o.fromNumber(e)):this.uint32(e)},l.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},l.prototype.uint64=function(e){var t=o.from(e);return this._push(y,t.length(),t)},l.prototype.int64=l.prototype.uint64,l.prototype.sint64=function(e){var t=o.from(e).zzEncode();return this._push(y,t.length(),t)},l.prototype.bool=function(e){return this._push(d,1,e?1:0)},l.prototype.fixed32=function(e){return this._push(g,4,e>>>0)},l.prototype.sfixed32=l.prototype.fixed32,l.prototype.fixed64=function(e){var t=o.from(e);return this._push(g,4,t.lo)._push(g,4,t.hi)},l.prototype.sfixed64=l.prototype.fixed64,l.prototype.float=function(e){return this._push(i.float.writeFloatLE,4,e)},l.prototype.double=function(e){return this._push(i.float.writeDoubleLE,8,e)};var b=i.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n>>0;if(!t)return this._push(d,1,0);if(i.isString(e)){var r=l.alloc(t=s.length(e));s.decode(e,r,0),e=r}return this.uint32(t)._push(b,t,e)},l.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(d,1,0)},l.prototype.fork=function(){return this.states=new f(this),this.head=this.tail=new c(u,0,0),this.len=0,this},l.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new c(u,0,0),this.len=0),this},l.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},l.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},l._configure=function(e){n=e,l.create=h(),n._configure()}},43155:(e,t,r)=>{"use strict";e.exports=o;var n=r(41173);(o.prototype=Object.create(n.prototype)).constructor=o;var i=r(99693);function o(){n.call(this)}function s(e,t,r){e.length<40?i.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}o._configure=function(){o.alloc=i._Buffer_allocUnsafe,o.writeBytesBuffer=i.Buffer&&i.Buffer.prototype instanceof Uint8Array&&"set"===i.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var n=0;n>>0;return this.uint32(t),t&&this._push(o.writeBytesBuffer,t,e),this},o.prototype.string=function(e){var t=i.Buffer.byteLength(e);return this.uint32(t),t&&this._push(s,t,e),this},o._configure()},92592:(e,t,r)=>{const n=r(47138),i=r(95115),o=r(6907),s=r(93776);function a(e,t,r,o,s){const a=[].slice.call(arguments,1),c=a.length,u="function"==typeof a[c-1];if(!u&&!n())throw new Error("Callback required as last argument");if(!u){if(c<1)throw new Error("Too few arguments provided");return 1===c?(r=t,t=o=void 0):2!==c||t.getContext||(o=r,r=t,t=void 0),new Promise((function(n,s){try{const s=i.create(r,o);n(e(s,t,o))}catch(e){s(e)}}))}if(c<2)throw new Error("Too few arguments provided");2===c?(s=r,r=t,t=o=void 0):3===c&&(t.getContext&&void 0===s?(s=o,o=void 0):(s=o,o=r,r=t,t=void 0));try{const n=i.create(r,o);s(null,e(n,t,o))}catch(e){s(e)}}t.create=i.create,t.toCanvas=a.bind(null,o.render),t.toDataURL=a.bind(null,o.renderToDataURL),t.toString=a.bind(null,(function(e,t,r){return s.render(e,r)}))},47138:e=>{e.exports=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then}},21845:(e,t,r)=>{const n=r(10242).getSymbolSize;t.getRowColCoords=function(e){if(1===e)return[];const t=Math.floor(e/7)+2,r=n(e),i=145===r?26:2*Math.ceil((r-13)/(2*t-2)),o=[r-7];for(let e=1;e{const n=r(76910),i=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function o(e){this.mode=n.ALPHANUMERIC,this.data=e}o.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},o.prototype.getLength=function(){return this.data.length},o.prototype.getBitsLength=function(){return o.getBitsLength(this.data.length)},o.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let r=45*i.indexOf(this.data[t]);r+=i.indexOf(this.data[t+1]),e.put(r,11)}this.data.length%2&&e.put(i.indexOf(this.data[t]),6)},e.exports=o},97245:e=>{function t(){this.buffer=[],this.length=0}t.prototype={get:function(e){const t=Math.floor(e/8);return 1==(this.buffer[t]>>>7-e%8&1)},put:function(e,t){for(let r=0;r>>t-r-1&1))},getLengthInBits:function(){return this.length},putBit:function(e){const t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},e.exports=t},73280:e=>{function t(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}t.prototype.set=function(e,t,r,n){const i=e*this.size+t;this.data[i]=r,n&&(this.reservedBit[i]=!0)},t.prototype.get=function(e,t){return this.data[e*this.size+t]},t.prototype.xor=function(e,t,r){this.data[e*this.size+t]^=r},t.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},e.exports=t},43424:(e,t,r)=>{const n=r(62378),i=r(76910);function o(e){this.mode=i.BYTE,this.data=new Uint8Array(n(e))}o.getBitsLength=function(e){return 8*e},o.prototype.getLength=function(){return this.data.length},o.prototype.getBitsLength=function(){return o.getBitsLength(this.data.length)},o.prototype.write=function(e){for(let t=0,r=this.data.length;t{const n=r(64908),i=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],o=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];t.getBlocksCount=function(e,t){switch(t){case n.L:return i[4*(e-1)+0];case n.M:return i[4*(e-1)+1];case n.Q:return i[4*(e-1)+2];case n.H:return i[4*(e-1)+3];default:return}},t.getTotalCodewordsCount=function(e,t){switch(t){case n.L:return o[4*(e-1)+0];case n.M:return o[4*(e-1)+1];case n.Q:return o[4*(e-1)+2];case n.H:return o[4*(e-1)+3];default:return}}},64908:(e,t)=>{t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2},t.isValid=function(e){return e&&void 0!==e.bit&&e.bit>=0&&e.bit<4},t.from=function(e,r){if(t.isValid(e))return e;try{return function(e){if("string"!=typeof e)throw new Error("Param is not a string");switch(e.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+e)}}(e)}catch(e){return r}}},76526:(e,t,r)=>{const n=r(10242).getSymbolSize;t.getPositions=function(e){const t=n(e);return[[0,0],[t-7,0],[0,t-7]]}},61642:(e,t,r)=>{const n=r(10242),i=n.getBCHDigit(1335);t.getEncodedBits=function(e,t){const r=e.bit<<3|t;let o=r<<10;for(;n.getBCHDigit(o)-i>=0;)o^=1335<{const r=new Uint8Array(512),n=new Uint8Array(256);!function(){let e=1;for(let t=0;t<255;t++)r[t]=e,n[e]=t,e<<=1,256&e&&(e^=285);for(let e=255;e<512;e++)r[e]=r[e-255]}(),t.log=function(e){if(e<1)throw new Error("log("+e+")");return n[e]},t.exp=function(e){return r[e]},t.mul=function(e,t){return 0===e||0===t?0:r[n[e]+n[t]]}},35442:(e,t,r)=>{const n=r(76910),i=r(10242);function o(e){this.mode=n.KANJI,this.data=e}o.getBitsLength=function(e){return 13*e},o.prototype.getLength=function(){return this.data.length},o.prototype.getBitsLength=function(){return o.getBitsLength(this.data.length)},o.prototype.write=function(e){let t;for(t=0;t=33088&&r<=40956)r-=33088;else{if(!(r>=57408&&r<=60351))throw new Error("Invalid SJIS character: "+this.data[t]+"\nMake sure your charset is UTF-8");r-=49472}r=192*(r>>>8&255)+(255&r),e.put(r,13)}},e.exports=o},27126:(e,t)=>{t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};function r(e,r,n){switch(e){case t.Patterns.PATTERN000:return(r+n)%2==0;case t.Patterns.PATTERN001:return r%2==0;case t.Patterns.PATTERN010:return n%3==0;case t.Patterns.PATTERN011:return(r+n)%3==0;case t.Patterns.PATTERN100:return(Math.floor(r/2)+Math.floor(n/3))%2==0;case t.Patterns.PATTERN101:return r*n%2+r*n%3==0;case t.Patterns.PATTERN110:return(r*n%2+r*n%3)%2==0;case t.Patterns.PATTERN111:return(r*n%3+(r+n)%2)%2==0;default:throw new Error("bad maskPattern:"+e)}}t.isValid=function(e){return null!=e&&""!==e&&!isNaN(e)&&e>=0&&e<=7},t.from=function(e){return t.isValid(e)?parseInt(e,10):void 0},t.getPenaltyN1=function(e){const t=e.size;let r=0,n=0,i=0,o=null,s=null;for(let a=0;a=5&&(r+=n-5+3),o=t,n=1),t=e.get(c,a),t===s?i++:(i>=5&&(r+=i-5+3),s=t,i=1)}n>=5&&(r+=n-5+3),i>=5&&(r+=i-5+3)}return r},t.getPenaltyN2=function(e){const t=e.size;let r=0;for(let n=0;n=10&&(1488===n||93===n)&&r++,i=i<<1&2047|e.get(s,o),s>=10&&(1488===i||93===i)&&r++}return 40*r},t.getPenaltyN4=function(e){let t=0;const r=e.data.length;for(let n=0;n{const n=r(43114),i=r(7007);t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(e,t){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!n.isValid(t))throw new Error("Invalid version: "+t);return t>=1&&t<10?e.ccBits[0]:t<27?e.ccBits[1]:e.ccBits[2]},t.getBestModeForData=function(e){return i.testNumeric(e)?t.NUMERIC:i.testAlphanumeric(e)?t.ALPHANUMERIC:i.testKanji(e)?t.KANJI:t.BYTE},t.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")},t.isValid=function(e){return e&&e.bit&&e.ccBits},t.from=function(e,r){if(t.isValid(e))return e;try{return function(e){if("string"!=typeof e)throw new Error("Param is not a string");switch(e.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+e)}}(e)}catch(e){return r}}},41085:(e,t,r)=>{const n=r(76910);function i(e){this.mode=n.NUMERIC,this.data=e.toString()}i.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t,r,n;for(t=0;t+3<=this.data.length;t+=3)r=this.data.substr(t,3),n=parseInt(r,10),e.put(n,10);const i=this.data.length-t;i>0&&(r=this.data.substr(t),n=parseInt(r,10),e.put(n,3*i+1))},e.exports=i},26143:(e,t,r)=>{const n=r(69729);t.mul=function(e,t){const r=new Uint8Array(e.length+t.length-1);for(let i=0;i=0;){const e=r[0];for(let i=0;i{const n=r(10242),i=r(64908),o=r(97245),s=r(73280),a=r(21845),c=r(76526),u=r(27126),f=r(35393),l=r(52882),h=r(23103),d=r(61642),p=r(76910),y=r(16130);function g(e,t,r){const n=e.size,i=d.getEncodedBits(t,r);let o,s;for(o=0;o<15;o++)s=1==(i>>o&1),o<6?e.set(o,8,s,!0):o<8?e.set(o+1,8,s,!0):e.set(n-15+o,8,s,!0),o<8?e.set(8,n-o-1,s,!0):o<9?e.set(8,15-o-1+1,s,!0):e.set(8,15-o-1,s,!0);e.set(n-8,8,1,!0)}function b(e,t,r,i){let d;if(Array.isArray(e))d=y.fromArray(e);else{if("string"!=typeof e)throw new Error("Invalid data");{let n=t;if(!n){const t=y.rawSplit(e);n=h.getBestVersionForData(t,r)}d=y.fromString(e,n||40)}}const b=h.getBestVersionForData(d,r);if(!b)throw new Error("The amount of data is too big to be stored in a QR Code");if(t){if(t=0&&t<=6&&(0===n||6===n)||n>=0&&n<=6&&(0===t||6===t)||t>=2&&t<=4&&n>=2&&n<=4?e.set(i+t,o+n,!0,!0):e.set(i+t,o+n,!1,!0))}}(w,t),function(e){const t=e.size;for(let r=8;r=7&&function(e,t){const r=e.size,n=h.getEncodedBits(t);let i,o,s;for(let t=0;t<18;t++)i=Math.floor(t/3),o=t%3+r-8-3,s=1==(n>>t&1),e.set(i,o,s,!0),e.set(o,i,s,!0)}(w,t),function(e,t){const r=e.size;let n=-1,i=r-1,o=7,s=0;for(let a=r-1;a>0;a-=2)for(6===a&&a--;;){for(let r=0;r<2;r++)if(!e.isReserved(i,a-r)){let n=!1;s>>o&1)),e.set(i,a-r,n),o--,-1===o&&(s++,o=7)}if(i+=n,i<0||r<=i){i-=n,n=-n;break}}}(w,m),isNaN(i)&&(i=u.getBestMask(w,g.bind(null,w,r))),u.applyMask(i,w),g(w,r,i),{modules:w,version:t,errorCorrectionLevel:r,maskPattern:i,segments:d}}t.create=function(e,t){if(void 0===e||""===e)throw new Error("No input text");let r,o,s=i.M;return void 0!==t&&(s=i.from(t.errorCorrectionLevel,i.M),r=h.from(t.version),o=u.from(t.maskPattern),t.toSJISFunc&&n.setToSJISFunction(t.toSJISFunc)),b(e,r,s,o)}},52882:(e,t,r)=>{const n=r(26143);function i(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}i.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},i.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");const t=new Uint8Array(e.length+this.degree);t.set(e);const r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){const e=new Uint8Array(this.degree);return e.set(r,i),e}return r},e.exports=i},7007:(e,t)=>{let r="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";r=r.replace(/u/g,"\\u");const n="(?:(?![A-Z0-9 $%*+\\-./:]|"+r+")(?:.|[\r\n]))+";t.KANJI=new RegExp(r,"g"),t.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),t.BYTE=new RegExp(n,"g"),t.NUMERIC=new RegExp("[0-9]+","g"),t.ALPHANUMERIC=new RegExp("[A-Z $%*+\\-./:]+","g");const i=new RegExp("^"+r+"$"),o=new RegExp("^[0-9]+$"),s=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");t.testKanji=function(e){return i.test(e)},t.testNumeric=function(e){return o.test(e)},t.testAlphanumeric=function(e){return s.test(e)}},16130:(e,t,r)=>{const n=r(76910),i=r(41085),o=r(8260),s=r(43424),a=r(35442),c=r(7007),u=r(10242),f=r(65987);function l(e){return unescape(encodeURIComponent(e)).length}function h(e,t,r){const n=[];let i;for(;null!==(i=e.exec(r));)n.push({data:i[0],index:i.index,mode:t,length:i[0].length});return n}function d(e){const t=h(c.NUMERIC,n.NUMERIC,e),r=h(c.ALPHANUMERIC,n.ALPHANUMERIC,e);let i,o;return u.isKanjiModeEnabled()?(i=h(c.BYTE,n.BYTE,e),o=h(c.KANJI,n.KANJI,e)):(i=h(c.BYTE_KANJI,n.BYTE,e),o=[]),t.concat(r,i,o).sort((function(e,t){return e.index-t.index})).map((function(e){return{data:e.data,mode:e.mode,length:e.length}}))}function p(e,t){switch(t){case n.NUMERIC:return i.getBitsLength(e);case n.ALPHANUMERIC:return o.getBitsLength(e);case n.KANJI:return a.getBitsLength(e);case n.BYTE:return s.getBitsLength(e)}}function y(e,t){let r;const c=n.getBestModeForData(e);if(r=n.from(t,c),r!==n.BYTE&&r.bit=0?e[e.length-1]:null;return r&&r.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)}),[]))},t.rawSplit=function(e){return t.fromArray(d(e,u.isKanjiModeEnabled()))}},10242:(e,t)=>{let r;const n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];t.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return 4*e+17},t.getSymbolTotalCodewords=function(e){return n[e]},t.getBCHDigit=function(e){let t=0;for(;0!==e;)t++,e>>>=1;return t},t.setToSJISFunction=function(e){if("function"!=typeof e)throw new Error('"toSJISFunc" is not a valid function.');r=e},t.isKanjiModeEnabled=function(){return void 0!==r},t.toSJIS=function(e){return r(e)}},43114:(e,t)=>{t.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}},23103:(e,t,r)=>{const n=r(10242),i=r(35393),o=r(64908),s=r(76910),a=r(43114),c=n.getBCHDigit(7973);function u(e,t){return s.getCharCountIndicator(e,t)+4}function f(e,t){let r=0;return e.forEach((function(e){const n=u(e.mode,t);r+=n+e.getBitsLength()})),r}t.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},t.getCapacity=function(e,t,r){if(!a.isValid(e))throw new Error("Invalid QR Code version");void 0===r&&(r=s.BYTE);const o=8*(n.getSymbolTotalCodewords(e)-i.getTotalCodewordsCount(e,t));if(r===s.MIXED)return o;const c=o-u(r,e);switch(r){case s.NUMERIC:return Math.floor(c/10*3);case s.ALPHANUMERIC:return Math.floor(c/11*2);case s.KANJI:return Math.floor(c/13);case s.BYTE:default:return Math.floor(c/8)}},t.getBestVersionForData=function(e,r){let n;const i=o.from(r,o.M);if(Array.isArray(e)){if(e.length>1)return function(e,r){for(let n=1;n<=40;n++)if(f(e,n)<=t.getCapacity(n,r,s.MIXED))return n}(e,i);if(0===e.length)return 1;n=e[0]}else n=e;return function(e,r,n){for(let i=1;i<=40;i++)if(r<=t.getCapacity(i,n,e))return i}(n.mode,n.getLength(),i)},t.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw new Error("Invalid QR Code version");let t=e<<12;for(;n.getBCHDigit(t)-c>=0;)t^=7973<{const n=r(89653);t.render=function(e,t,r){let i=r,o=t;void 0!==i||t&&t.getContext||(i=t,t=void 0),t||(o=function(){try{return document.createElement("canvas")}catch(e){throw new Error("You need to specify a canvas element")}}()),i=n.getOptions(i);const s=n.getImageWidth(e.modules.size,i),a=o.getContext("2d"),c=a.createImageData(s,s);return n.qrToImageData(c.data,e,i),function(e,t,r){e.clearRect(0,0,t.width,t.height),t.style||(t.style={}),t.height=r,t.width=r,t.style.height=r+"px",t.style.width=r+"px"}(a,o,s),a.putImageData(c,0,0),o},t.renderToDataURL=function(e,r,n){let i=n;void 0!==i||r&&r.getContext||(i=r,r=void 0),i||(i={});const o=t.render(e,r,i),s=i.type||"image/png",a=i.rendererOpts||{};return o.toDataURL(s,a.quality)}},93776:(e,t,r)=>{const n=r(89653);function i(e,t){const r=e.a/255,n=t+'="'+e.hex+'"';return r<1?n+" "+t+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function o(e,t,r){let n=e+t;return void 0!==r&&(n+=" "+r),n}t.render=function(e,t,r){const s=n.getOptions(t),a=e.modules.size,c=e.modules.data,u=a+2*s.margin,f=s.color.light.a?"':"",l="0&&u>0&&e[c-1]||(n+=s?o("M",u+r,.5+f+r):o("m",i,0),i=0,s=!1),u+1',h='viewBox="0 0 '+u+" "+u+'"',d=''+f+l+"\n";return"function"==typeof r&&r(null,d),d}},89653:(e,t)=>{function r(e){if("number"==typeof e&&(e=e.toString()),"string"!=typeof e)throw new Error("Color should be defined as hex string");let t=e.slice().replace("#","").split("");if(t.length<3||5===t.length||t.length>8)throw new Error("Invalid hex color: "+e);3!==t.length&&4!==t.length||(t=Array.prototype.concat.apply([],t.map((function(e){return[e,e]})))),6===t.length&&t.push("F","F");const r=parseInt(t.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:255&r,hex:"#"+t.slice(0,6).join("")}}t.getOptions=function(e){e||(e={}),e.color||(e.color={});const t=void 0===e.margin||null===e.margin||e.margin<0?4:e.margin,n=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:n,scale:n?4:i,margin:t,color:{dark:r(e.color.dark||"#000000ff"),light:r(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}},t.getScale=function(e,t){return t.width&&t.width>=e+2*t.margin?t.width/(e+2*t.margin):t.scale},t.getImageWidth=function(e,r){const n=t.getScale(e,r);return Math.floor((e+2*r.margin)*n)},t.qrToImageData=function(e,r,n){const i=r.modules.size,o=r.modules.data,s=t.getScale(i,n),a=Math.floor((i+2*n.margin)*s),c=n.margin*s,u=[n.color.light,n.color.dark];for(let t=0;t=c&&r>=c&&t{"use strict";e.exports=s;var n=r(57824),i=s.prototype,o=new Date%1e9;function s(e){e=e||{},this.id=e.id||(1e9*Math.random()>>>0)+o++,this.max=e.max||1/0,this.items=e.items||[],this._lookup={},this.size=this.items.length,this.lastModified=new Date(e.lastModified||new Date);for(var t,r,n=this.items.length;n--;)t=this.items[n],r=new Date(t.expires)-new Date,this._lookup[t.key]=t,r>0?this.expire(t.key,r):r<=0&&this.delete(t.key)}i.has=function(e){return e in this._lookup},i.get=function(e){if(!this.has(e))return null;var t=this._lookup[e];return t.refresh&&this.expire(e,t.refresh),this.items.splice(this.items.indexOf(t),1),this.items.push(t),t.value},i.meta=function(e){if(!this.has(e))return null;var t=this._lookup[e];return"meta"in t?t.meta:null},i.set=function(e,t,r){var n=this._lookup[e],i=this._lookup[e]={key:e,value:t};return this.lastModified=new Date,n?(clearTimeout(n.timeout),this.items.splice(this.items.indexOf(n),1,i)):(this.size>=this.max&&this.delete(this.items[0].key),this.items.push(i),this.size++),r&&("ttl"in r&&this.expire(e,r.ttl),"meta"in r&&(i.meta=r.meta),r.refresh&&(i.refresh=r.ttl)),this},i.delete=function(e){var t=this._lookup[e];return!!t&&(this.lastModified=new Date,this.items.splice(this.items.indexOf(t),1),clearTimeout(t.timeout),delete this._lookup[e],this.size--,this)},i.expire=function(e,t){var r=t||0,i=this._lookup[e];if(!i)return this;if("string"==typeof r&&(r=n(t)),"number"!=typeof r)throw new TypeError("Expiration time must be a string or number.");return clearTimeout(i.timeout),i.timeout=setTimeout(this.delete.bind(this,i.key),r),i.expires=Number(new Date)+r,this},i.clear=function(){for(var e=this.items.length;e--;)this.delete(this.items[e].key);return this},i.toJSON=function(){for(var e,t=new Array(this.items.length),r=t.length;r--;)e=this.items[r],t[r]={key:e.key,meta:e.meta,value:e.value,expires:e.expires,refresh:e.refresh};return{id:this.id,max:isFinite(this.max)?this.max:void 0,lastModified:this.lastModified,items:t}}},82916:(e,t,r)=>{"use strict";const n=r(41807);class i{constructor(e,t,r){const i=this;this._started=n(),this._rescheduled=0,this._scheduled=t,this._args=r,this._triggered=!1,this._timerWrapper=()=>{i._rescheduled>0?(i._scheduled=i._rescheduled-(n()-i._started),i._schedule(i._scheduled)):(i._triggered=!0,e.apply(null,i._args))},this._timer=setTimeout(this._timerWrapper,t)}reschedule(e){e||(e=this._scheduled);const t=n();t+e-(this._started+this._scheduled)<0?(clearTimeout(this._timer),this._schedule(e)):this._triggered?this._schedule(e):(this._started=t,this._rescheduled=e)}_schedule(e){this._triggered=!1,this._started=n(),this._rescheduled=0,this._scheduled=e,this._timer=setTimeout(this._timerWrapper,e)}clear(){clearTimeout(this._timer)}}e.exports=function(){if("function"!=typeof arguments[0])throw new Error("callback needed");if("number"!=typeof arguments[1])throw new Error("timeout needed");let e;if(arguments.length>0){e=new Array(arguments.length-2);for(var t=0;t{"use strict";e.exports=function(){return Date.now()}},99353:(e,t,r)=>{e.exports=r(71846)},71846:(e,t,r)=>{var n=r(41960);t.operation=function(e){var r=t.timeouts(e);return new n(r,{forever:e&&(e.forever||e.retries===1/0),unref:e&&e.unref,maxRetryTime:e&&e.maxRetryTime})},t.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1e3,maxTimeout:1/0,randomize:!1};for(var r in e)t[r]=e[r];if(t.minTimeout>t.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var n=[],i=0;i{function t(e,t){"boolean"==typeof t&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}e.exports=t,t.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},t.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},t.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=(new Date).getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.push(e),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(e);var r=this._timeouts.shift();if(void 0===r){if(!this._cachedTimeouts)return!1;this._errors.splice(0,this._errors.length-1),r=this._cachedTimeouts.slice(-1)}var n=this;return this._timer=setTimeout((function(){n._attempts++,n._operationTimeoutCb&&(n._timeout=setTimeout((function(){n._operationTimeoutCb(n._attempts)}),n._operationTimeout),n._options.unref&&n._timeout.unref()),n._fn(n._attempts)}),r),this._options.unref&&this._timer.unref(),!0},t.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout((function(){r._operationTimeoutCb()}),r._operationTimeout)),this._operationStart=(new Date).getTime(),this._fn(this._attempts)},t.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)},t.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)},t.prototype.start=t.prototype.try,t.prototype.errors=function(){return this._errors},t.prototype.attempts=function(){return this._attempts},t.prototype.mainError=function(){if(0===this._errors.length)return null;for(var e={},t=null,r=0,n=0;n=r&&(t=i,r=s)}return t}},67652:(e,t,r)=>{"use strict";r.r(t),r.d(t,{ArgumentOutOfRangeError:()=>ft,AsyncSubject:()=>oe,BehaviorSubject:()=>re,ConnectableObservable:()=>$,EMPTY:()=>ke,EmptyError:()=>at,NEVER:()=>Jt,NotFoundError:()=>lt,Notification:()=>it,NotificationKind:()=>Fe,ObjectUnsubscribedError:()=>Z,Observable:()=>U,ReplaySubject:()=>ie,Scheduler:()=>ge,SequenceError:()=>ht,Subject:()=>ee,Subscriber:()=>C,Subscription:()=>y,TimeoutError:()=>pt,UnsubscriptionError:()=>d,VirtualAction:()=>Re,VirtualTimeScheduler:()=>Pe,animationFrame:()=>Ce,animationFrameScheduler:()=>Ie,animationFrames:()=>Y,asap:()=>ve,asapScheduler:()=>me,async:()=>Ee,asyncScheduler:()=>we,audit:()=>dr,auditTime:()=>pr,bindCallback:()=>Et,bindNodeCallback:()=>_t,buffer:()=>yr,bufferCount:()=>gr,bufferTime:()=>br,bufferToggle:()=>mr,bufferWhen:()=>vr,catchError:()=>wr,combineAll:()=>Cr,combineLatest:()=>Rt,combineLatestAll:()=>Ir,combineLatestWith:()=>Rr,concat:()=>Lt,concatAll:()=>Nt,concatMap:()=>kr,concatMapTo:()=>Br,concatWith:()=>Mr,config:()=>v,connect:()=>Nr,connectable:()=>Ut,count:()=>Lr,debounce:()=>Dr,debounceTime:()=>Kr,defaultIfEmpty:()=>Ur,defer:()=>Dt,delay:()=>Hr,delayWhen:()=>qr,dematerialize:()=>zr,distinct:()=>$r,distinctUntilChanged:()=>Gr,distinctUntilKeyChanged:()=>Yr,elementAt:()=>Jr,empty:()=>Be,endWith:()=>Zr,every:()=>en,exhaust:()=>rn,exhaustAll:()=>tn,exhaustMap:()=>nn,expand:()=>on,filter:()=>sr,finalize:()=>sn,find:()=>an,findIndex:()=>un,first:()=>fn,firstValueFrom:()=>ut,flatMap:()=>bn,forkJoin:()=>jt,from:()=>tt,fromEvent:()=>Ht,fromEventPattern:()=>$t,generate:()=>Gt,groupBy:()=>ln,identity:()=>L,ignoreElements:()=>Vr,iif:()=>Wt,interval:()=>Xt,isEmpty:()=>hn,isObservable:()=>st,last:()=>pn,lastValueFrom:()=>ct,map:()=>bt,mapTo:()=>Fr,materialize:()=>yn,max:()=>gn,merge:()=>Qt,mergeAll:()=>Ot,mergeMap:()=>Mt,mergeMapTo:()=>mn,mergeScan:()=>vn,mergeWith:()=>En,min:()=>_n,multicast:()=>Sn,never:()=>Zt,noop:()=>_,observable:()=>N,observeOn:()=>Xe,of:()=>rt,onErrorResumeNext:()=>nr,pairs:()=>ir,pairwise:()=>An,partition:()=>ar,pipe:()=>D,pluck:()=>Tn,publish:()=>In,publishBehavior:()=>Cn,publishLast:()=>Pn,publishReplay:()=>Rn,queue:()=>Ae,queueScheduler:()=>Se,race:()=>cr,raceWith:()=>kn,range:()=>fr,reduce:()=>_r,refCount:()=>z,repeat:()=>Bn,repeatWhen:()=>xn,retry:()=>Mn,retryWhen:()=>On,sample:()=>Nn,sampleTime:()=>Ln,scan:()=>Dn,scheduled:()=>et,sequenceEqual:()=>Kn,share:()=>Un,shareReplay:()=>Vn,single:()=>Fn,skip:()=>qn,skipLast:()=>Hn,skipUntil:()=>zn,skipWhile:()=>$n,startWith:()=>Gn,subscribeOn:()=>Qe,switchAll:()=>Yn,switchMap:()=>Wn,switchMapTo:()=>Xn,switchScan:()=>Qn,take:()=>jr,takeLast:()=>dn,takeUntil:()=>Jn,takeWhile:()=>Zn,tap:()=>ei,throttle:()=>ri,throttleTime:()=>ni,throwError:()=>nt,throwIfEmpty:()=>Xr,timeInterval:()=>ii,timeout:()=>yt,timeoutWith:()=>si,timer:()=>Yt,timestamp:()=>ai,toArray:()=>Ar,using:()=>lr,window:()=>ci,windowCount:()=>ui,windowTime:()=>fi,windowToggle:()=>li,windowWhen:()=>hi,withLatestFrom:()=>di,zip:()=>hr,zipAll:()=>pi,zipWith:()=>gi});var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)};function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function o(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function a(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}function c(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i1||a(e,t)}))})}function a(e,t){try{(r=i[e](t)).value instanceof u?Promise.resolve(r.value.v).then(c,f):l(o[0][2],r)}catch(e){l(o[0][3],e)}var r}function c(e){a("next",e)}function f(e){a("throw",e)}function l(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}function l(e){return"function"==typeof e}function h(e){var t=e((function(e){Error.call(e),e.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}Object.create,Object.create;var d=h((function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}));function p(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var y=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._teardowns=null}return e.prototype.unsubscribe=function(){var e,t,r,n,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var u=s(o),f=u.next();!f.done;f=u.next())f.value.remove(this)}catch(t){e={error:t}}finally{try{f&&!f.done&&(t=u.return)&&t.call(u)}finally{if(e)throw e.error}}else o.remove(this);var h=this.initialTeardown;if(l(h))try{h()}catch(e){i=e instanceof d?e.errors:[e]}var p=this._teardowns;if(p){this._teardowns=null;try{for(var y=s(p),g=y.next();!g.done;g=y.next()){var b=g.value;try{m(b)}catch(e){i=null!=i?i:[],e instanceof d?i=c(c([],a(i)),a(e.errors)):i.push(e)}}}catch(e){r={error:e}}finally{try{g&&!g.done&&(n=y.return)&&n.call(y)}finally{if(r)throw r.error}}}if(i)throw new d(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)m(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._teardowns=null!==(r=this._teardowns)&&void 0!==r?r:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&p(t,e)},e.prototype.remove=function(t){var r=this._teardowns;r&&p(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}(),g=y.EMPTY;function b(e){return e instanceof y||e&&"closed"in e&&l(e.remove)&&l(e.add)&&l(e.unsubscribe)}function m(e){l(e)?e():e.unsubscribe()}var v={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},w={setTimeout:function(){for(var e=[],t=0;t0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,r=t.hasError,n=t.isStopped,i=t.observers;return r||n?g:(i.push(e),new y((function(){return p(i,e)})))},t.prototype._checkFinalizedStatuses=function(e){var t=this,r=t.hasError,n=t.thrownError,i=t.isStopped;r?e.error(n):i&&e.complete()},t.prototype.asObservable=function(){var e=new U;return e.source=this,e},t.create=function(e,t){return new te(e,t)},t}(U),te=function(e){function t(t,r){var n=e.call(this)||this;return n.destination=t,n.source=r,n}return i(t,e),t.prototype.next=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===r||r.call(t,e)},t.prototype.error=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===r||r.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,r;return null!==(r=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==r?r:g},t}(ee),re=function(e){function t(t){var r=e.call(this)||this;return r._value=t,r}return i(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(t){var r=e.prototype._subscribe.call(this,t);return!r.closed&&t.next(this._value),r},t.prototype.getValue=function(){var e=this,t=e.hasError,r=e.thrownError,n=e._value;if(t)throw r;return this._throwIfClosed(),n},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},t}(ee),ne={now:function(){return(ne.delegate||Date).now()},delegate:void 0},ie=function(e){function t(t,r,n){void 0===t&&(t=1/0),void 0===r&&(r=1/0),void 0===n&&(n=ne);var i=e.call(this)||this;return i._bufferSize=t,i._windowTime=r,i._timestampProvider=n,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=r===1/0,i._bufferSize=Math.max(1,t),i._windowTime=Math.max(1,r),i}return i(t,e),t.prototype.next=function(t){var r=this,n=r.isStopped,i=r._buffer,o=r._infiniteTimeWindow,s=r._timestampProvider,a=r._windowTime;n||(i.push(t),!o&&i.push(s.now()+a)),this._trimBuffer(),e.prototype.next.call(this,t)},t.prototype._subscribe=function(e){this._throwIfClosed(),this._trimBuffer();for(var t=this._innerSubscribe(e),r=this._infiniteTimeWindow,n=this._buffer.slice(),i=0;i0?e.prototype.requestAsyncId.call(this,t,r,n):(t.actions.push(this),t._scheduled||(t._scheduled=pe.setImmediate(t.flush.bind(t,void 0))))},t.prototype.recycleAsyncId=function(t,r,n){if(void 0===n&&(n=0),null!=n&&n>0||null==n&&this.delay>0)return e.prototype.recycleAsyncId.call(this,t,r,n);t.actions.some((function(e){return e.id===r}))||(pe.clearImmediate(r),t._scheduled=void 0)},t}(ce),ge=function(){function e(t,r){void 0===r&&(r=e.now),this.schedulerActionCtor=t,this.now=r}return e.prototype.schedule=function(e,t,r){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(r,t)},e.now=ne.now,e}(),be=function(e){function t(t,r){void 0===r&&(r=ge.now);var n=e.call(this,t,r)||this;return n.actions=[],n._active=!1,n._scheduled=void 0,n}return i(t,e),t.prototype.flush=function(e){var t=this.actions;if(this._active)t.push(e);else{var r;this._active=!0;do{if(r=e.execute(e.state,e.delay))break}while(e=t.shift());if(this._active=!1,r){for(;e=t.shift();)e.unsubscribe();throw r}}},t}(ge),me=new(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.flush=function(e){this._active=!0;var t=this._scheduled;this._scheduled=void 0;var r,n=this.actions;e=e||n.shift();do{if(r=e.execute(e.state,e.delay))break}while((e=n[0])&&e.id===t&&n.shift());if(this._active=!1,r){for(;(e=n[0])&&e.id===t&&n.shift();)e.unsubscribe();throw r}},t}(be))(ye),ve=me,we=new be(ce),Ee=we,_e=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n}return i(t,e),t.prototype.schedule=function(t,r){return void 0===r&&(r=0),r>0?e.prototype.schedule.call(this,t,r):(this.delay=r,this.state=t,this.scheduler.flush(this),this)},t.prototype.execute=function(t,r){return r>0||this.closed?e.prototype.execute.call(this,t,r):this._execute(t,r)},t.prototype.requestAsyncId=function(t,r,n){return void 0===n&&(n=0),null!=n&&n>0||null==n&&this.delay>0?e.prototype.requestAsyncId.call(this,t,r,n):t.flush(this)},t}(ce),Se=new(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t}(be))(_e),Ae=Se,Te=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n}return i(t,e),t.prototype.requestAsyncId=function(t,r,n){return void 0===n&&(n=0),null!==n&&n>0?e.prototype.requestAsyncId.call(this,t,r,n):(t.actions.push(this),t._scheduled||(t._scheduled=W.requestAnimationFrame((function(){return t.flush(void 0)}))))},t.prototype.recycleAsyncId=function(t,r,n){if(void 0===n&&(n=0),null!=n&&n>0||null==n&&this.delay>0)return e.prototype.recycleAsyncId.call(this,t,r,n);t.actions.some((function(e){return e.id===r}))||(W.cancelAnimationFrame(r),t._scheduled=void 0)},t}(ce),Ie=new(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.flush=function(e){this._active=!0;var t=this._scheduled;this._scheduled=void 0;var r,n=this.actions;e=e||n.shift();do{if(r=e.execute(e.state,e.delay))break}while((e=n[0])&&e.id===t&&n.shift());if(this._active=!1,r){for(;(e=n[0])&&e.id===t&&n.shift();)e.unsubscribe();throw r}},t}(be))(Te),Ce=Ie,Pe=function(e){function t(t,r){void 0===t&&(t=Re),void 0===r&&(r=1/0);var n=e.call(this,t,(function(){return n.frame}))||this;return n.maxFrames=r,n.frame=0,n.index=-1,n}return i(t,e),t.prototype.flush=function(){for(var e,t,r=this.actions,n=this.maxFrames;(t=r[0])&&t.delay<=n&&(r.shift(),this.frame=t.delay,!(e=t.execute(t.state,t.delay))););if(e){for(;t=r.shift();)t.unsubscribe();throw e}},t.frameTimeFactor=10,t}(be),Re=function(e){function t(t,r,n){void 0===n&&(n=t.index+=1);var i=e.call(this,t,r)||this;return i.scheduler=t,i.work=r,i.index=n,i.active=!0,i.index=t.index=n,i}return i(t,e),t.prototype.schedule=function(r,n){if(void 0===n&&(n=0),Number.isFinite(n)){if(!this.id)return e.prototype.schedule.call(this,r,n);this.active=!1;var i=new t(this.scheduler,this.work);return this.add(i),i.schedule(r,n)}return y.EMPTY},t.prototype.requestAsyncId=function(e,r,n){void 0===n&&(n=0),this.delay=e.frame+n;var i=e.actions;return i.push(this),i.sort(t.sortActions),!0},t.prototype.recycleAsyncId=function(e,t,r){void 0===r&&(r=0)},t.prototype._execute=function(t,r){if(!0===this.active)return e.prototype._execute.call(this,t,r)},t.sortActions=function(e,t){return e.delay===t.delay?e.index===t.index?0:e.index>t.index?1:-1:e.delay>t.delay?1:-1},t}(ce),ke=new U((function(e){return e.complete()}));function Be(e){return e?function(e){return new U((function(t){return e.schedule((function(){return t.complete()}))}))}(e):ke}function xe(e){return e&&l(e.schedule)}function Me(e){return e[e.length-1]}function Oe(e){return l(Me(e))?e.pop():void 0}function Ne(e){return xe(Me(e))?e.pop():void 0}function Le(e,t){return"number"==typeof Me(e)?e.pop():t}var De=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function Ke(e){return l(null==e?void 0:e.then)}function Ue(e){return l(e[N])}function je(e){return Symbol.asyncIterator&&l(null==e?void 0:e[Symbol.asyncIterator])}function Ve(e){return new TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var Fe,qe="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function He(e){return l(null==e?void 0:e[qe])}function ze(e){return f(this,arguments,(function(){var t,r,n;return o(this,(function(i){switch(i.label){case 0:t=e.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,u(t.read())];case 3:return r=i.sent(),n=r.value,r.done?[4,u(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,u(n)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}}))}))}function $e(e){return l(null==e?void 0:e.getReader)}function Ge(e){if(e instanceof U)return e;if(null!=e){if(Ue(e))return i=e,new U((function(e){var t=i[N]();if(l(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(De(e))return n=e,new U((function(e){for(var t=0;t0&&l(i)}),void 0,void 0,(function(){(null==o?void 0:o.closed)||null==o||o.unsubscribe(),a=null}))),l(null!=n?"number"==typeof n?n:+n-c.now():i)}))}function gt(e){throw new pt(e)}function bt(e,t){return F((function(r,n){var i=0;r.subscribe(q(n,(function(r){n.next(e.call(t,r,i++))})))}))}var mt=Array.isArray;function vt(e){return bt((function(t){return function(e,t){return mt(t)?e.apply(void 0,c([],a(t))):e(t)}(e,t)}))}function wt(e,t,r,n){if(r){if(!xe(r))return function(){for(var i=[],o=0;o0){var e=void 0;try{e=Ge(n.shift())}catch(e){return void i()}var r=q(t,void 0,_,_);e.subscribe(r),r.add(i)}else t.complete()};i()}))}function nr(){for(var e=[],t=0;t=0?Ye(r,o,f,a,!0):i=!0,f();var l=q(r,(function(e){var t,r,i=n.slice();try{for(var o=s(i),a=o.next();!a.done;a=o.next()){var f=a.value,l=f.buffer;l.push(e),c<=l.length&&u(f)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}}),(function(){for(;null==n?void 0:n.length;)r.next(n.shift().buffer);null==l||l.unsubscribe(),r.complete(),r.unsubscribe()}),void 0,(function(){return n=null}));t.subscribe(l)}))}function mr(e,t){return F((function(r,n){var i=[];Ge(e).subscribe(q(n,(function(e){var r=[];i.push(r);var o=new y;o.add(Ge(t(e)).subscribe(q(n,(function(){p(i,r),n.next(r),o.unsubscribe()}),_)))}),_)),r.subscribe(q(n,(function(e){var t,r;try{for(var n=s(i),o=n.next();!o.done;o=n.next())o.value.push(e)}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}}),(function(){for(;i.length>0;)n.next(i.shift());n.complete()})))}))}function vr(e){return F((function(t,r){var n=null,i=null,o=function(){null==i||i.unsubscribe();var t=n;n=[],t&&r.next(t),Ge(e()).subscribe(i=q(r,o,_))};o(),t.subscribe(q(r,(function(e){return null==n?void 0:n.push(e)}),(function(){n&&r.next(n),r.complete()}),void 0,(function(){return n=i=null})))}))}function wr(e){return F((function(t,r){var n,i=null,o=!1;i=t.subscribe(q(r,void 0,void 0,(function(s){n=Ge(e(s,wr(e)(t))),i?(i.unsubscribe(),i=null,n.subscribe(r)):o=!0}))),o&&(i.unsubscribe(),i=null,n.subscribe(r))}))}function Er(e,t,r,n,i){return function(o,s){var a=r,c=t,u=0;o.subscribe(q(s,(function(t){var r=u++;c=a?e(c,t,r):(a=!0,t),n&&s.next(c)}),i&&function(){a&&s.next(c),s.complete()}))}}function _r(e,t){return F(Er(e,t,arguments.length>=2,!1,!0))}var Sr=function(e,t){return e.push(t),e};function Ar(){return F((function(e,t){_r(Sr,[])(e).subscribe(t)}))}function Tr(e,t){return D(Ar(),Mt((function(t){return e(t)})),t?vt(t):L)}function Ir(e){return Tr(Rt,e)}var Cr=Ir;function Pr(){for(var e=[],t=0;t=2;return function(n){return n.pipe(sr((function(t,r){return r===e})),jr(1),r?Ur(t):Xr((function(){return new ft})))}}function Zr(){for(var e=[],t=0;t=2;return function(n){return n.pipe(e?sr((function(t,r){return e(t,r,n)})):L,jr(1),r?Ur(t):Xr((function(){return new at})))}}function ln(e,t,r,n){return F((function(i,o){var s;t&&"function"!=typeof t?(r=t.duration,s=t.element,n=t.connector):s=t;var a=new Map,c=function(e){a.forEach(e),e(o)},u=function(e){return c((function(t){return t.error(e)}))},f=0,l=!1,h=new H(o,(function(t){try{var i=e(t),c=a.get(i);if(!c){a.set(i,c=n?n():new ee);var d=(y=i,g=c,(b=new U((function(e){f++;var t=g.subscribe(e);return function(){t.unsubscribe(),0==--f&&l&&h.unsubscribe()}}))).key=y,b);if(o.next(d),r){var p=q(c,(function(){c.complete(),null==p||p.unsubscribe()}),void 0,void 0,(function(){return a.delete(i)}));h.add(Ge(r(d)).subscribe(p))}}c.next(s?s(t):t)}catch(e){u(e)}var y,g,b}),(function(){return c((function(e){return e.complete()}))}),u,(function(){return a.clear()}),(function(){return l=!0,0===f}));i.subscribe(h)}))}function hn(){return F((function(e,t){e.subscribe(q(t,(function(){t.next(!1),t.complete()}),(function(){t.next(!0),t.complete()})))}))}function dn(e){return e<=0?function(){return ke}:F((function(t,r){var n=[];t.subscribe(q(r,(function(t){n.push(t),e=2;return function(n){return n.pipe(e?sr((function(t,r){return e(t,r,n)})):L,dn(1),r?Ur(t):Xr((function(){return new at})))}}function yn(){return F((function(e,t){e.subscribe(q(t,(function(e){t.next(it.createNext(e))}),(function(){t.next(it.createComplete()),t.complete()}),(function(e){t.next(it.createError(e)),t.complete()})))}))}function gn(e){return _r(l(e)?function(t,r){return e(t,r)>0?t:r}:function(e,t){return e>t?e:t})}var bn=Mt;function mn(e,t,r){return void 0===r&&(r=1/0),l(t)?Mt((function(){return e}),t,r):("number"==typeof t&&(r=t),Mt((function(){return e}),r))}function vn(e,t,r){return void 0===r&&(r=1/0),F((function(n,i){var o=t;return xt(n,i,(function(t,r){return e(o,t,r)}),r,(function(e){o=e}),!1,void 0,(function(){return o=null}))}))}function wn(){for(var e=[],t=0;t=2,!0))}function Kn(e,t){return void 0===t&&(t=function(e,t){return e===t}),F((function(r,n){var i={buffer:[],complete:!1},o={buffer:[],complete:!1},s=function(e){n.next(e),n.complete()},a=function(e,r){var i=q(n,(function(n){var i=r.buffer,o=r.complete;0===i.length?o?s(!1):e.buffer.push(n):!t(n,i.shift())&&s(!1)}),(function(){e.complete=!0;var t=r.complete,n=r.buffer;t&&s(0===n.length),null==i||i.unsubscribe()}));return i};r.subscribe(a(i,o)),e.subscribe(a(o,i))}))}function Un(e){void 0===e&&(e={});var t=e.connector,r=void 0===t?function(){return new ee}:t,n=e.resetOnError,i=void 0===n||n,o=e.resetOnComplete,s=void 0===o||o,a=e.resetOnRefCountZero,c=void 0===a||a;return function(e){var t=null,n=null,o=null,a=0,u=!1,f=!1,l=function(){null==n||n.unsubscribe(),n=null},h=function(){l(),t=o=null,u=f=!1},d=function(){var e=t;h(),null==e||e.unsubscribe()};return F((function(e,p){a++,f||u||l();var y=o=null!=o?o:r();p.add((function(){0!=--a||f||u||(n=jn(d,c))})),y.subscribe(p),t||(t=new B({next:function(e){return y.next(e)},error:function(e){f=!0,l(),n=jn(h,i,e),y.error(e)},complete:function(){u=!0,l(),n=jn(h,s),y.complete()}}),tt(e).subscribe(t))}))(e)}}function jn(e,t){for(var r=[],n=2;n0?t:e;return F((function(t,n){var i=[new ee],o=0;n.next(i[0].asObservable()),t.subscribe(q(n,(function(t){var a,c;try{for(var u=s(i),f=u.next();!f.done;f=u.next())f.value.next(t)}catch(e){a={error:e}}finally{try{f&&!f.done&&(c=u.return)&&c.call(u)}finally{if(a)throw a.error}}var l=o-e+1;if(l>=0&&l%r==0&&i.shift().complete(),++o%r==0){var h=new ee;i.push(h),n.next(h.asObservable())}}),(function(){for(;i.length>0;)i.shift().complete();n.complete()}),(function(e){for(;i.length>0;)i.shift().error(e);n.error(e)}),(function(){i=null})))}))}function fi(e){for(var t,r,n=[],i=1;i=0?Ye(r,o,u,s,!0):i=!0,u();var f=function(e){return n.slice().forEach(e)},l=function(e){f((function(t){var r=t.window;return e(r)})),e(r),r.unsubscribe()};return t.subscribe(q(r,(function(e){f((function(t){t.window.next(e),a<=++t.seen&&c(t)}))}),(function(){return l((function(e){return e.complete()}))}),(function(e){return l((function(t){return t.error(e)}))}))),function(){n=null}}))}function li(e,t){return F((function(r,n){var i=[],o=function(e){for(;0{var n=r(48764),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,t),t.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},s.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},50202:(e,t,r)=>{"use strict";var n=r(63700),i=/[\/\?<>\\:\*\|"]/g,o=/[\x00-\x1f\x80-\x9f]/g,s=/^\.+$/,a=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i,c=/[\. ]+$/;function u(e,t){if("string"!=typeof e)throw new Error("Input must be string");var r=e.replace(i,t).replace(o,t).replace(s,t).replace(a,t).replace(c,t);return n(r,255)}e.exports=function(e,t){var r=t&&t.replacement||"",n=u(e,r);return""===r?n:u(n,"")}},17221:(e,t,r)=>{e.exports=r(59119)(r(58573))},58573:(e,t,r)=>{const n=new(0,r(86266).ec)("secp256k1"),i=n.curve,o=i.n.constructor;function s(e){const t=e[0];switch(t){case 2:case 3:return 33!==e.length?null:function(e,t){let r=new o(t);if(r.cmp(i.p)>=0)return null;r=r.toRed(i.red);let s=r.redSqr().redIMul(r).redIAdd(i.b).redSqrt();return 3===e!==s.isOdd()&&(s=s.redNeg()),n.keyPair({pub:{x:r,y:s}})}(t,e.subarray(1,33));case 4:case 6:case 7:return 65!==e.length?null:function(e,t,r){let s=new o(t),a=new o(r);if(s.cmp(i.p)>=0||a.cmp(i.p)>=0)return null;if(s=s.toRed(i.red),a=a.toRed(i.red),(6===e||7===e)&&a.isOdd()!==(7===e))return null;const c=s.redSqr().redIMul(s);return a.redSqr().redISub(c.redIAdd(i.b)).isZero()?n.keyPair({pub:{x:s,y:a}}):null}(t,e.subarray(1,33),e.subarray(33,65));default:return null}}function a(e,t){const r=t.encode(null,33===e.length);for(let t=0;t0,privateKeyVerify(e){const t=new o(e);return t.cmp(i.n)<0&&!t.isZero()?0:1},privateKeyNegate(e){const t=new o(e),r=i.n.sub(t).umod(i.n).toArrayLike(Uint8Array,"be",32);return e.set(r),0},privateKeyTweakAdd(e,t){const r=new o(t);if(r.cmp(i.n)>=0)return 1;if(r.iadd(new o(e)),r.cmp(i.n)>=0&&r.isub(i.n),r.isZero())return 1;const n=r.toArrayLike(Uint8Array,"be",32);return e.set(n),0},privateKeyTweakMul(e,t){let r=new o(t);if(r.cmp(i.n)>=0||r.isZero())return 1;r.imul(new o(e)),r.cmp(i.n)>=0&&(r=r.umod(i.n));const n=r.toArrayLike(Uint8Array,"be",32);return e.set(n),0},publicKeyVerify:e=>null===s(e)?1:0,publicKeyCreate(e,t){const r=new o(t);return r.cmp(i.n)>=0||r.isZero()?1:(a(e,n.keyFromPrivate(t).getPublic()),0)},publicKeyConvert(e,t){const r=s(t);return null===r?1:(a(e,r.getPublic()),0)},publicKeyNegate(e,t){const r=s(t);if(null===r)return 1;const n=r.getPublic();return n.y=n.y.redNeg(),a(e,n),0},publicKeyCombine(e,t){const r=new Array(t.length);for(let e=0;e=0)return 2;const c=n.getPublic().add(i.g.mul(r));return c.isInfinity()?2:(a(e,c),0)},publicKeyTweakMul(e,t,r){const n=s(t);return null===n?1:(r=new o(r)).cmp(i.n)>=0||r.isZero()?2:(a(e,n.getPublic().mul(r)),0)},signatureNormalize(e){const t=new o(e.subarray(0,32)),r=new o(e.subarray(32,64));return t.cmp(i.n)>=0||r.cmp(i.n)>=0?1:(1===r.cmp(n.nh)&&e.set(i.n.sub(r).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(e,t){const r=t.subarray(0,32),n=t.subarray(32,64);if(new o(r).cmp(i.n)>=0)return 1;if(new o(n).cmp(i.n)>=0)return 1;const{output:s}=e;let a=s.subarray(4,37);a[0]=0,a.set(r,1);let c=33,u=0;for(;c>1&&0===a[u]&&!(128&a[u+1]);--c,++u);if(a=a.subarray(u),128&a[0])return 1;if(c>1&&0===a[0]&&!(128&a[1]))return 1;let f=s.subarray(39,72);f[0]=0,f.set(n,1);let l=33,h=0;for(;l>1&&0===f[h]&&!(128&f[h+1]);--l,++h);return f=f.subarray(h),128&f[0]||l>1&&0===f[0]&&!(128&f[1])?1:(e.outputlen=6+c+l,s[0]=48,s[1]=e.outputlen-2,s[2]=2,s[3]=a.length,s.set(a,4),s[4+c]=2,s[5+c]=f.length,s.set(f,6+c),0)},signatureImport(e,t){if(t.length<8)return 1;if(t.length>72)return 1;if(48!==t[0])return 1;if(t[1]!==t.length-2)return 1;if(2!==t[2])return 1;const r=t[3];if(0===r)return 1;if(5+r>=t.length)return 1;if(2!==t[4+r])return 1;const n=t[5+r];if(0===n)return 1;if(6+r+n!==t.length)return 1;if(128&t[4])return 1;if(r>1&&0===t[4]&&!(128&t[5]))return 1;if(128&t[r+6])return 1;if(n>1&&0===t[r+6]&&!(128&t[r+7]))return 1;let s=t.subarray(4,4+r);if(33===s.length&&0===s[0]&&(s=s.subarray(1)),s.length>32)return 1;let a=t.subarray(6+r);if(33===a.length&&0===a[0]&&(a=a.slice(1)),a.length>32)throw new Error("S length is too long");let c=new o(s);c.cmp(i.n)>=0&&(c=new o(0));let u=new o(t.subarray(6+r));return u.cmp(i.n)>=0&&(u=new o(0)),e.set(c.toArrayLike(Uint8Array,"be",32),0),e.set(u.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(e,t,r,s,a){if(a){const e=a;a=n=>{const i=e(t,r,null,s,n);if(!(i instanceof Uint8Array&&32===i.length))throw new Error("This is the way");return new o(i)}}const c=new o(r);if(c.cmp(i.n)>=0||c.isZero())return 1;let u;try{u=n.sign(t,r,{canonical:!0,k:a,pers:s})}catch(e){return 1}return e.signature.set(u.r.toArrayLike(Uint8Array,"be",32),0),e.signature.set(u.s.toArrayLike(Uint8Array,"be",32),32),e.recid=u.recoveryParam,0},ecdsaVerify(e,t,r){const a={r:e.subarray(0,32),s:e.subarray(32,64)},c=new o(a.r),u=new o(a.s);if(c.cmp(i.n)>=0||u.cmp(i.n)>=0)return 1;if(1===u.cmp(n.nh)||c.isZero()||u.isZero())return 3;const f=s(r);if(null===f)return 2;const l=f.getPublic();return n.verify(t,a,l)?0:3},ecdsaRecover(e,t,r,s){const c={r:t.slice(0,32),s:t.slice(32,64)},u=new o(c.r),f=new o(c.s);if(u.cmp(i.n)>=0||f.cmp(i.n)>=0)return 1;if(u.isZero()||f.isZero())return 2;let l;try{l=n.recoverPubKey(s,c,r)}catch(e){return 2}return a(e,l),0},ecdh(e,t,r,a,c,u,f){const l=s(t);if(null===l)return 1;const h=new o(r);if(h.cmp(i.n)>=0||h.isZero())return 2;const d=l.getPublic().mul(h);if(void 0===c){const t=d.encode(null,!0),r=n.hash().update(t).digest();for(let t=0;t<32;++t)e[t]=r[t]}else{u||(u=new Uint8Array(32));const t=d.getX().toArray("be",32);for(let e=0;e<32;++e)u[e]=t[e];f||(f=new Uint8Array(32));const r=d.getY().toArray("be",32);for(let e=0;e<32;++e)f[e]=r[e];const n=c(u,f,a);if(!(n instanceof Uint8Array&&n.length===e.length))return 2;e.set(n)}return 0}}},59119:e=>{const t="Impossible case. Please create issue.",r="The tweak was out of range or the resulted private key is invalid",n="The tweak was out of range or equal to zero",i="Public Key could not be parsed",o="Public Key serialization error",s="Signature could not be parsed";function a(e,t){if(!e)throw new Error(t)}function c(e,t,r){if(a(t instanceof Uint8Array,`Expected ${e} to be an Uint8Array`),void 0!==r)if(Array.isArray(r)){const n=`Expected ${e} to be an Uint8Array with length [${r.join(", ")}]`;a(r.includes(t.length),n)}else{const n=`Expected ${e} to be an Uint8Array with length ${r}`;a(t.length===r,n)}}function u(e){a("Boolean"===l(e),"Expected compressed to be a Boolean")}function f(e=(e=>new Uint8Array(e)),t){return"function"==typeof e&&(e=e(t)),c("output",e,t),e}function l(e){return Object.prototype.toString.call(e).slice(8,-1)}e.exports=e=>({contextRandomize(t){if(a(null===t||t instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),null!==t&&c("seed",t,32),1===e.contextRandomize(t))throw new Error("Unknow error on context randomization")},privateKeyVerify:t=>(c("private key",t,32),0===e.privateKeyVerify(t)),privateKeyNegate(r){switch(c("private key",r,32),e.privateKeyNegate(r)){case 0:return r;case 1:throw new Error(t)}},privateKeyTweakAdd(t,n){switch(c("private key",t,32),c("tweak",n,32),e.privateKeyTweakAdd(t,n)){case 0:return t;case 1:throw new Error(r)}},privateKeyTweakMul(t,r){switch(c("private key",t,32),c("tweak",r,32),e.privateKeyTweakMul(t,r)){case 0:return t;case 1:throw new Error(n)}},publicKeyVerify:t=>(c("public key",t,[33,65]),0===e.publicKeyVerify(t)),publicKeyCreate(t,r=!0,n){switch(c("private key",t,32),u(r),n=f(n,r?33:65),e.publicKeyCreate(n,t)){case 0:return n;case 1:throw new Error("Private Key is invalid");case 2:throw new Error(o)}},publicKeyConvert(t,r=!0,n){switch(c("public key",t,[33,65]),u(r),n=f(n,r?33:65),e.publicKeyConvert(n,t)){case 0:return n;case 1:throw new Error(i);case 2:throw new Error(o)}},publicKeyNegate(r,n=!0,s){switch(c("public key",r,[33,65]),u(n),s=f(s,n?33:65),e.publicKeyNegate(s,r)){case 0:return s;case 1:throw new Error(i);case 2:throw new Error(t);case 3:throw new Error(o)}},publicKeyCombine(t,r=!0,n){a(Array.isArray(t),"Expected public keys to be an Array"),a(t.length>0,"Expected public keys array will have more than zero items");for(const e of t)c("public key",e,[33,65]);switch(u(r),n=f(n,r?33:65),e.publicKeyCombine(n,t)){case 0:return n;case 1:throw new Error(i);case 2:throw new Error("The sum of the public keys is not valid");case 3:throw new Error(o)}},publicKeyTweakAdd(t,n,o=!0,s){switch(c("public key",t,[33,65]),c("tweak",n,32),u(o),s=f(s,o?33:65),e.publicKeyTweakAdd(s,t,n)){case 0:return s;case 1:throw new Error(i);case 2:throw new Error(r)}},publicKeyTweakMul(t,r,o=!0,s){switch(c("public key",t,[33,65]),c("tweak",r,32),u(o),s=f(s,o?33:65),e.publicKeyTweakMul(s,t,r)){case 0:return s;case 1:throw new Error(i);case 2:throw new Error(n)}},signatureNormalize(t){switch(c("signature",t,64),e.signatureNormalize(t)){case 0:return t;case 1:throw new Error(s)}},signatureExport(r,n){c("signature",r,64);const i={output:n=f(n,72),outputlen:72};switch(e.signatureExport(i,r)){case 0:return n.slice(0,i.outputlen);case 1:throw new Error(s);case 2:throw new Error(t)}},signatureImport(r,n){switch(c("signature",r),n=f(n,64),e.signatureImport(n,r)){case 0:return n;case 1:throw new Error(s);case 2:throw new Error(t)}},ecdsaSign(r,n,i={},o){c("message",r,32),c("private key",n,32),a("Object"===l(i),"Expected options to be an Object"),void 0!==i.data&&c("options.data",i.data),void 0!==i.noncefn&&a("Function"===l(i.noncefn),"Expected options.noncefn to be a Function");const s={signature:o=f(o,64),recid:null};switch(e.ecdsaSign(s,r,n,i.data,i.noncefn)){case 0:return s;case 1:throw new Error("The nonce generation function failed, or the private key was invalid");case 2:throw new Error(t)}},ecdsaVerify(t,r,n){switch(c("signature",t,64),c("message",r,32),c("public key",n,[33,65]),e.ecdsaVerify(t,r,n)){case 0:return!0;case 3:return!1;case 1:throw new Error(s);case 2:throw new Error(i)}},ecdsaRecover(r,n,i,o=!0,h){switch(c("signature",r,64),a("Number"===l(n)&&n>=0&&n<=3,"Expected recovery id to be a Number within interval [0, 3]"),c("message",i,32),u(o),h=f(h,o?33:65),e.ecdsaRecover(h,r,n,i)){case 0:return h;case 1:throw new Error(s);case 2:throw new Error("Public key could not be recover");case 3:throw new Error(t)}},ecdh(t,r,n={},o){switch(c("public key",t,[33,65]),c("private key",r,32),a("Object"===l(n),"Expected options to be an Object"),void 0!==n.data&&c("options.data",n.data),void 0!==n.hashfn?(a("Function"===l(n.hashfn),"Expected options.hashfn to be a Function"),void 0!==n.xbuf&&c("options.xbuf",n.xbuf,32),void 0!==n.ybuf&&c("options.ybuf",n.ybuf,32),c("output",o)):o=f(o,32),e.ecdh(o,t,r,n.data,n.hashfn,n.xbuf,n.ybuf)){case 0:return o;case 1:throw new Error(i);case 2:throw new Error("Scalar was invalid (zero or overflow)")}}})},27695:e=>{"use strict";const t=new Map;e.exports={setDelayedInterval:function(e,r,n){n=n||r;const i=`${Date.now()}:${Math.floor(1e6*Math.random())}`,o=setTimeout((()=>{!async function(e,r,n){for(;t.get(n);){try{await e()}catch(e){setTimeout((()=>{throw e}),1);break}if(!t.get(n))break;await new Promise((e=>{const i=setTimeout(e,r);t.set(n,i)}))}}(e,r,i)}),n);return t.set(i,o),i},clearDelayedInterval:function(e){const r=t.get(e);r&&(clearTimeout(r),t.delete(e))}}},8975:(e,t,r)=>{var n;!function(){"use strict";var i={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function o(e){return a(u(e),arguments)}function s(e,t){return o.apply(null,[e].concat(t||[]))}function a(e,t){var r,n,s,a,c,u,f,l,h,d=1,p=e.length,y="";for(n=0;n=0),a.type){case"b":r=parseInt(r,10).toString(2);break;case"c":r=String.fromCharCode(parseInt(r,10));break;case"d":case"i":r=parseInt(r,10);break;case"j":r=JSON.stringify(r,null,a.width?parseInt(a.width):0);break;case"e":r=a.precision?parseFloat(r).toExponential(a.precision):parseFloat(r).toExponential();break;case"f":r=a.precision?parseFloat(r).toFixed(a.precision):parseFloat(r);break;case"g":r=a.precision?String(Number(r.toPrecision(a.precision))):parseFloat(r);break;case"o":r=(parseInt(r,10)>>>0).toString(8);break;case"s":r=String(r),r=a.precision?r.substring(0,a.precision):r;break;case"t":r=String(!!r),r=a.precision?r.substring(0,a.precision):r;break;case"T":r=Object.prototype.toString.call(r).slice(8,-1).toLowerCase(),r=a.precision?r.substring(0,a.precision):r;break;case"u":r=parseInt(r,10)>>>0;break;case"v":r=r.valueOf(),r=a.precision?r.substring(0,a.precision):r;break;case"x":r=(parseInt(r,10)>>>0).toString(16);break;case"X":r=(parseInt(r,10)>>>0).toString(16).toUpperCase()}i.json.test(a.type)?y+=r:(!i.number.test(a.type)||l&&!a.sign?h="":(h=l?"+":"-",r=r.toString().replace(i.sign,"")),u=a.pad_char?"0"===a.pad_char?"0":a.pad_char.charAt(1):" ",f=a.width-(h+r).length,c=a.width&&f>0?u.repeat(f):"",y+=a.align?h+r+c:"0"===u?h+c+r:c+h+r)}return y}var c=Object.create(null);function u(e){if(c[e])return c[e];for(var t,r=e,n=[],o=0;r;){if(null!==(t=i.text.exec(r)))n.push(t[0]);else if(null!==(t=i.modulo.exec(r)))n.push("%");else{if(null===(t=i.placeholder.exec(r)))throw new SyntaxError("[sprintf] unexpected placeholder");if(t[2]){o|=1;var s=[],a=t[2],u=[];if(null===(u=i.key.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(s.push(u[1]);""!==(a=a.substring(u[0].length));)if(null!==(u=i.key_access.exec(a)))s.push(u[1]);else{if(null===(u=i.index_access.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");s.push(u[1])}t[2]=s}else o|=2;if(3===o)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n.push({placeholder:t[0],param_no:t[1],keys:t[2],sign:t[3],pad_char:t[4],align:t[5],width:t[6],precision:t[7],type:t[8]})}r=r.substring(t[0].length)}return c[e]=n}t.sprintf=o,t.vsprintf=s,"undefined"!=typeof window&&(window.sprintf=o,window.vsprintf=s,void 0===(n=function(){return{sprintf:o,vsprintf:s}}.call(t,r,t,e))||(e.exports=n))}()},38386:function(e,t,r){var n=r(34155);!function(e){"use strict";function t(e,r){return void 0===r?r=>t(e,r):r[Symbol.asyncIterator]?async function*(e,t){let r=[];for await(const n of t)r.push(n),r.length===e&&(yield r,r=[]);r.length>0&&(yield r)}(e,r):function*(e,t){let r=[];for(const n of t)r.push(n),r.length===e&&(yield r,r=[]);r.length>0&&(yield r)}(e,r)}const r=Symbol("TIMEOUT");async function*i(e,t,n){const i=n[Symbol.asyncIterator]();let o,s,a,c=[];const u=()=>{f(),[s,a]=(e=>{let t;return[new Promise((n=>{t=setTimeout((()=>n(r)),e)})),()=>{clearTimeout(t)}]})(t)},f=()=>{a&&a(),s=void 0};for(o=i.next();;){const t=await(s?Promise.race([o,s]):o);if(t===r||t.done){if(c.length&&(yield c,c=[]),f(),t!==r)break}else o=i.next(),c.push(t.value),1===c.length&&u(),c.length!==e||(yield c,c=[],f())}}function o(e){if("function"==typeof e.next)return e;if("function"==typeof e[Symbol.iterator])return e[Symbol.iterator]();if("function"==typeof e[Symbol.asyncIterator])return e[Symbol.asyncIterator]();throw new TypeError('"values" does not to conform to any of the iterator or iterable protocols')}function s(){let e,t;return{promise:new Promise(((r,n)=>{t=r,e=n})),reject:e,resolve:t}}function a(e,t){const r=o(t),n=[],i=[];let a=!1,c=!1;async function u(){if(!c&&!(a||n.length>=e)){a=!0;try{const{done:e,value:t}=await r.next();e?c=!0:n.push({value:t})}catch(e){c=!0,n.push({error:e})}(function(){for(;i.length>0&&n.length>0;){const e=i.shift(),{error:t,value:r}=n.shift();t?e.reject(t):e.resolve({done:!1,value:r})}for(;i.length>0&&c;){const{resolve:e}=i.shift();e({done:!0,value:void 0})}})(),a=!1,u()}}const f={next:async function(){if(n.length>0){const{error:e,value:t}=n.shift();if(e)throw e;return u(),{done:!1,value:t}}if(c)return{done:!0,value:void 0};const e=s();return i.push(e),u(),e.promise},[Symbol.asyncIterator]:()=>f};return f}function c(e,t){return void 0===t?t=>c(e,t):0===e?t:t[Symbol.asyncIterator]?a(e,t):function*(e,t){const r=[];let n;try{for(const n of t)r.push(n),r.length<=e||(yield r.shift())}catch(e){n=e}for(const e of r)yield e;if(n)throw n}(e,t)}async function*u(e,t){for await(const r of t)await e(r)&&(yield r)}function f(e,t){return void 0===t?t=>u(e,t):u(e,t)}async function*l(e){for await(const t of e)t&&"string"!=typeof t&&(t[Symbol.iterator]||t[Symbol.asyncIterator])?yield*l(t):yield t}async function*h(e,t){for await(const r of t)yield await e(r)}function d(e,t){return void 0===t?t=>h(e,t):h(e,t)}function p(e,t,r){const n=o(r),i=[],a=[];let c=!1,u=!1,f=0,l=null;function h(){for(;a.length>0&&i.length>0;){const{resolve:e}=a.shift();e({done:!1,value:i.shift()})}for(;a.length>0&&0===f&&c;){const{resolve:e,reject:t}=a.shift();l?(t(l),l=null):e({done:!0,value:void 0})}}async function d(){if(c)h();else if(!(u||f+i.length>=e)){u=!0,f++;try{const{done:e,value:r}=await n.next();e?(c=!0,f--,h()):async function(e){try{const r=await t(e);if(r&&r[Symbol.asyncIterator])for await(const e of r)i.push(e);else i.push(r)}catch(e){c=!0,l=e}f--,h(),d()}(r)}catch(e){c=!0,f--,l=e,h()}u=!1,d()}}const p={next:async function(){if(0===i.length){const e=s();return a.push(e),d(),e.promise}const e=i.shift();return d(),{done:!1,value:e}},[Symbol.asyncIterator]:()=>p};return p}async function y(e){return new Promise((t=>{e.once("readable",(()=>{t()}))}))}function g(e,...t){let r=e();for(const e of t)r=e(r);return r}function b(e,t,r){return void 0===t?(t,r)=>b(e,t,r):void 0===r?r=>b(e,t,r):1===e?d(t,r):async function*(e,t,r){let n=null;const i=o(g((()=>r),c(1),(async function*(e){for await(const t of e){if(n)return;yield t}}),d((e=>({value:t(e)}))),c(e-1)));for(;;){const{value:e,done:t}=await i.next();if(t)break;try{const t=await e.value;n||(yield t)}catch(e){n=e}}if(n)throw n}(e,t,r)}async function m(e,t,r){let n=t;for await(const t of r)n=await e(n,t);return n}async function*v(e,t){for await(const r of t)await e(r),yield r}const w=e=>new Promise((t=>setTimeout(t,e)));function E(e,t,r){if(!Number.isFinite(e))throw new TypeError("Expected `limit` to be a finite number");if(e<=0)throw new TypeError("Expected `limit` to be greater than 0");if(!Number.isFinite(t))throw new TypeError("Expected `interval` to be a finite number");return async function*(){let n,i=0;for await(const o of r){if(i0&&await w(s),n=Date.now(),i=1,yield o}}()}function _(e,t){let r=e[0]+t[0],n=e[1]+t[1];if(n>=1e9){const e=n%1e9;r+=(n-e)/1e9,n=e}return[r,n]}function S(e,t,r){const n=o(r),i=[],a=[];let c=!1,u=!1,f=0,l=null;function h(){for(;a.length>0&&i.length>0;){const{resolve:e}=a.shift();e({done:!1,value:i.shift()})}for(;a.length>0&&0===f&&c;){const{resolve:e,reject:t}=a.shift();l?(t(l),l=null):e({done:!0,value:void 0})}}async function d(){if(c)h();else if(!(u||f+i.length>=e)){u=!0,f++;try{const{done:e,value:r}=await n.next();e?(c=!0,f--,h()):async function(e){try{const r=await t(e);i.push(r)}catch(e){c=!0,l=e}f--,h(),d()}(r)}catch(e){c=!0,f--,l=e,h()}u=!1,d()}}const p={next:async function(){if(0===i.length){const e=s();return a.push(e),d(),e.promise}const e=i.shift();return d(),{done:!1,value:e}},[Symbol.asyncIterator]:()=>p};return p}async function A(e,t){let r=null,n=null,i=null;const o=e=>{r=e,n&&n(e)},s=()=>{i&&i()};e.once("error",o);for await(const o of t)if(!1===e.write(o)&&await new Promise(((t,o)=>{if(r)return o(r);e.once("drain",s),i=t,n=o})),r)break;if(e.removeListener("error",o),e.removeListener("drain",s),r)throw r}e.batch=t,e.batchWithTimeout=function e(r,n,o){return void 0===o?t=>e(r,n,t):o[Symbol.asyncIterator]&&n!==1/0?i(r,n,o):t(r,o)},e.buffer=c,e.collect=function(e){return e[Symbol.asyncIterator]?async function(e){const t=[];for await(const r of e)t.push(r);return t}(e):Array.from(e)},e.concat=function(...e){return e.find((e=>void 0!==e[Symbol.asyncIterator]))?async function*(e){for await(const t of e)yield*t}(e):function*(e){for(const t of e)yield*t}(e)},e.consume=function(e){if(e[Symbol.asyncIterator])return async function(e){for await(const t of e);}(e);for(const t of e);},e.filter=f,e.flatMap=function e(t,r){return void 0===r?r=>e(t,r):f((e=>null!=e),l(d(t,r)))},e.flatTransform=function e(t,r,n){return void 0===r?(r,n)=>n?e(t,r,n):e(t,r):void 0===n?n=>e(t,r,n):f((e=>null!=e),l(p(t,r,n)))},e.flatten=l,e.fromStream=function(e){return"function"==typeof e[Symbol.asyncIterator]?e:async function*(e){for(;;){const t=e.read();if(null===t){if(e._readableState.ended)break;await y(e)}else yield t}}(e)},e.getIterator=o,e.map=d,e.merge=async function*(...e){const t=new Set(e.map(o));for(;t.size>0;)for(const e of t){const r=await e.next();r.done?t.delete(e):yield r.value}},e.parallelFlatMap=function e(t,r,n){return void 0===r?(r,n)=>n?e(t,r,n):e(t,r):void 0===n?n=>e(t,r,n):f((e=>null!=e),l(b(t,r,n)))},e.parallelMap=b,e.parallelMerge=async function*(...e){const t=e.map(o),r=new Set,n=new Map;let i=null,s=null,a=null;const c=e=>{i=e,s&&s(e)},u=e=>{a&&a(e)},f=e=>{const t=Promise.resolve(e.next()).then((async({done:i,value:o})=>{i||n.set(e,o),r.delete(t)}));r.add(t),t.then(u,c)};for(const e of t)f(e);for(;;){if(0===r.size&&0===n.size)return;await new Promise(((e,t)=>{if(i&&t(i),n.size>0)return e();a=e,s=t}));for(const[e,t]of n)n.delete(e),yield t,f(e)}},e.pipeline=g,e.reduce=function e(t,r,n){return void 0===r?(r,n)=>n?m(t,r,n):e(t,r):void 0===n?n=>e(t,r,n):m(t,r,n)},e.take=function e(t,r){return void 0===r?r=>e(t,r):r[Symbol.asyncIterator]?async function*(e,t){let r=0;for await(const n of t)if(yield await n,r++,r>=e)break}(t,r):function*(e,t){let r=0;for(const n of t)if(yield n,r++,r>=e)break}(t,r)},e.tap=function(e,t){return void 0===t?t=>v(e,t):v(e,t)},e.throttle=function(e,t,r){return void 0===r?r=>E(e,t,r):E(e,t,r)},e.time=function e(t={},r){return void 0===r?r=>e(t,r):void 0!==r[Symbol.asyncIterator]?async function*(e,t){const r=t[Symbol.asyncIterator]();let i=[0,0];for(;;){const t=n.hrtime(),{value:o,done:s}=await r.next(),a=n.hrtime(t);if(i=_(i,a),e.progress&&e.progress(a,i),s)return e.total&&e.total(i),o;yield o}}(t,r):function*(e,t){const r=t[Symbol.iterator]();let i=[0,0];for(;;){const t=n.hrtime(),{value:o,done:s}=r.next(),a=n.hrtime(t);if(i=_(i,a),e.progress&&e.progress(a,i),s)return e.total&&e.total(i),o;yield o}}(t,r)},e.transform=function e(t,r,n){return void 0===r?(r,n)=>n?e(t,r,n):e(t,r):void 0===n?n=>e(t,r,n):S(t,r,n)},e.writeToStream=function(e,t){return void 0===t?t=>A(e,t):A(e,t)},Object.defineProperty(e,"__esModule",{value:!0})}(t)},98548:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>b});var n=r(93379),i=r.n(n),o=r(7795),s=r.n(o),a=r(90569),c=r.n(a),u=r(3565),f=r.n(u),l=r(19216),h=r.n(l),d=r(44589),p=r.n(d),y=r(51424),g={};g.styleTagTransform=p(),g.setAttributes=f(),g.insert=c().bind(null,"head"),g.domAPI=s(),g.insertStyleElement=h(),i()(y.Z,g);const b=y.Z&&y.Z.locals?y.Z.locals:void 0},93379:e=>{"use strict";var t=[];function r(e){for(var r=-1,n=0;n{"use strict";var t={};e.exports=function(e,r){var n=function(e){if(void 0===t[e]){var r=document.querySelector(e);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(e){r=null}t[e]=r}return t[e]}(e);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");n.appendChild(r)}},19216:e=>{"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},3565:(e,t,r)=>{"use strict";e.exports=function(e){var t=r.nc;t&&e.setAttribute("nonce",t)}},7795:e=>{"use strict";e.exports=function(e){var t=e.insertStyleElement(e);return{update:function(r){!function(e,t,r){var n="";r.supports&&(n+="@supports (".concat(r.supports,") {")),r.media&&(n+="@media ".concat(r.media," {"));var i=void 0!==r.layer;i&&(n+="@layer".concat(r.layer.length>0?" ".concat(r.layer):""," {")),n+=r.css,i&&(n+="}"),r.media&&(n+="}"),r.supports&&(n+="}");var o=r.sourceMap;o&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),t.styleTagTransform(n,e,t.options)}(t,e,r)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},44589:e=>{"use strict";e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},22467:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.serialize=t.deserialize=t.registerSerializer=void 0;const n=r(37381);let i=n.DefaultSerializer;t.registerSerializer=function(e){i=n.extendSerializer(i,e)},t.deserialize=function(e){return i.deserialize(e)},t.serialize=function(e){return i.serialize(e)}},43734:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.Transfer=t.DefaultSerializer=t.expose=t.registerSerializer=void 0;var o=r(22467);Object.defineProperty(t,"registerSerializer",{enumerable:!0,get:function(){return o.registerSerializer}}),i(r(75063),t);var s=r(11934);Object.defineProperty(t,"expose",{enumerable:!0,get:function(){return s.expose}});var a=r(37381);Object.defineProperty(t,"DefaultSerializer",{enumerable:!0,get:function(){return a.DefaultSerializer}});var c=r(88180);Object.defineProperty(t,"Transfer",{enumerable:!0,get:function(){return c.Transfer}})},14211:(e,t)=>{"use strict";let r;function n(e){return(""+e).replace(/^((?:https?|file|ftp|chrome-extension|moz-extension):\/\/.+)?\/[^/]+(?:\?.*)?$/,"$1")+"/"}Object.defineProperty(t,"__esModule",{value:!0}),t.getBundleURL=t.getBaseURL=void 0,t.getBundleURL=function(){return r||(r=function(){try{throw new Error}catch(e){const t=(""+e.stack).match(/(https?|file|ftp|chrome-extension|moz-extension):\/\/[^)\n]+/g);if(t)return n(t[0])}return"/"}()),r},t.getBaseURL=n},58390:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isWorkerRuntime=t.getWorkerImplementation=t.defaultPoolSize=void 0;const n=r(14211);t.defaultPoolSize="undefined"!=typeof navigator&&navigator.hardwareConcurrency?navigator.hardwareConcurrency:4;const i=e=>/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(e);function o(e){const t=new Blob([e],{type:"application/javascript"});return URL.createObjectURL(t)}let s;t.getWorkerImplementation=function(){return s||(s=function(){if("undefined"==typeof Worker)return class{constructor(){throw Error("No web worker implementation available. You might have tried to spawn a worker within a worker in a browser that doesn't support workers in workers.")}};class e extends Worker{constructor(e,t){var r,s;"string"==typeof e&&t&&t._baseURL?e=new URL(e,t._baseURL):"string"==typeof e&&!i(e)&&n.getBundleURL().match(/^file:\/\//i)&&(e=new URL(e,n.getBundleURL().replace(/\/[^\/]+$/,"/")),(null===(r=null==t?void 0:t.CORSWorkaround)||void 0===r||r)&&(e=o(`importScripts(${JSON.stringify(e)});`))),"string"==typeof e&&i(e)&&(null===(s=null==t?void 0:t.CORSWorkaround)||void 0===s||s)&&(e=o(`importScripts(${JSON.stringify(e)});`)),super(e,t)}}class t extends e{constructor(e,t){super(window.URL.createObjectURL(e),t)}static fromText(e,r){const n=new window.Blob([e],{type:"text/javascript"});return new t(n,r)}}return{blob:t,default:e}}()),s},t.isWorkerRuntime=function(){const e="undefined"!=typeof self&&"undefined"!=typeof Window&&self instanceof Window;return!("undefined"==typeof self||!self.postMessage||e)}},75063:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Worker=t.BlobWorker=t.isWorkerRuntime=t.Thread=t.spawn=t.Pool=void 0;const n=r(58390);Object.defineProperty(t,"isWorkerRuntime",{enumerable:!0,get:function(){return n.isWorkerRuntime}});var i=r(99337);Object.defineProperty(t,"Pool",{enumerable:!0,get:function(){return i.Pool}});var o=r(61264);Object.defineProperty(t,"spawn",{enumerable:!0,get:function(){return o.spawn}});var s=r(54235);Object.defineProperty(t,"Thread",{enumerable:!0,get:function(){return s.Thread}}),t.BlobWorker=n.getWorkerImplementation().blob,t.Worker=n.getWorkerImplementation().default},56891:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.createProxyModule=t.createProxyFunction=void 0;const i=n(r(11227)),o=r(35049),s=r(22467),a=r(62015),c=r(88180),u=r(43229),f=i.default("threads:master:messages");let l=1;function h(e,t){return(...r)=>{const n=l++,{args:i,transferables:h}=function(e){if(0===e.length)return{args:[],transferables:[]};const t=[],r=[];for(const n of e)c.isTransferDescriptor(n)?(t.push(s.serialize(n.send)),r.push(...n.transferables)):t.push(s.serialize(n));return{args:t,transferables:0===r.length?r:(n=r,Array.from(new Set(n)))};var n}(r),d={type:u.MasterMessageType.run,uid:n,method:t,args:i};f("Sending command to run function to worker:",d);try{e.postMessage(d,h)}catch(e){return a.ObservablePromise.from(Promise.reject(e))}return a.ObservablePromise.from(o.multicast(function(e,t){return new o.Observable((r=>{let n;const i=o=>{var a;if(f("Message from worker:",o.data),o.data&&o.data.uid===t)if((a=o.data)&&a.type===u.WorkerMessageType.running)n=o.data.resultType;else if((e=>e&&e.type===u.WorkerMessageType.result)(o.data))"promise"===n?(void 0!==o.data.payload&&r.next(s.deserialize(o.data.payload)),r.complete(),e.removeEventListener("message",i)):(o.data.payload&&r.next(s.deserialize(o.data.payload)),o.data.complete&&(r.complete(),e.removeEventListener("message",i)));else if((e=>e&&e.type===u.WorkerMessageType.error)(o.data)){const t=s.deserialize(o.data.error);r.error(t),e.removeEventListener("message",i)}};return e.addEventListener("message",i),()=>{if("observable"===n||!n){const r={type:u.MasterMessageType.cancel,uid:t};e.postMessage(r)}e.removeEventListener("message",i)}}))}(e,n)))}}t.createProxyFunction=h,t.createProxyModule=function(e,t){const r={};for(const n of t)r[n]=h(e,n);return r}},26774:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.PoolEventType=void 0,(r=t.PoolEventType||(t.PoolEventType={})).initialized="initialized",r.taskCanceled="taskCanceled",r.taskCompleted="taskCompleted",r.taskFailed="taskFailed",r.taskQueued="taskQueued",r.taskQueueDrained="taskQueueDrained",r.taskStart="taskStart",r.terminated="terminated"},99337:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Pool=t.Thread=t.PoolEventType=void 0;const o=i(r(11227)),s=r(35049),a=r(90531),c=r(58390),u=r(26774);Object.defineProperty(t,"PoolEventType",{enumerable:!0,get:function(){return u.PoolEventType}});const f=r(54235);Object.defineProperty(t,"Thread",{enumerable:!0,get:function(){return f.Thread}});let l=1;class h{constructor(e,t){this.eventSubject=new s.Subject,this.initErrors=[],this.isClosing=!1,this.nextTaskID=1,this.taskQueue=[];const r="number"==typeof t?{size:t}:t||{},{size:n=c.defaultPoolSize}=r;var i;this.debug=o.default(`threads:pool:${i=r.name||String(l++),i.replace(/\W/g," ").trim().replace(/\s+/g,"-")}`),this.options=r,this.workers=function(e,t){return function(e){const t=[];for(let r=0;r({init:e(),runningTasks:[]})))}(e,n),this.eventObservable=s.multicast(s.Observable.from(this.eventSubject)),Promise.all(this.workers.map((e=>e.init))).then((()=>this.eventSubject.next({type:u.PoolEventType.initialized,size:this.workers.length})),(e=>{this.debug("Error while initializing pool worker:",e),this.eventSubject.error(e),this.initErrors.push(e)}))}findIdlingWorker(){const{concurrency:e=1}=this.options;return this.workers.find((t=>t.runningTasks.lengthn(this,void 0,void 0,(function*(){yield(0,new Promise((e=>setTimeout(e,0))));try{yield this.runPoolTask(e,t)}finally{e.runningTasks=e.runningTasks.filter((e=>e!==r)),this.isClosing||this.scheduleWork()}})))();e.runningTasks.push(r)}))}scheduleWork(){this.debug("Attempt de-queueing a task in order to run it...");const e=this.findIdlingWorker();if(!e)return;const t=this.taskQueue.shift();if(!t)return this.debug("Task queue is empty"),void this.eventSubject.next({type:u.PoolEventType.taskQueueDrained});this.run(e,t)}taskCompletion(e){return new Promise(((t,r)=>{const n=this.events().subscribe((i=>{i.type===u.PoolEventType.taskCompleted&&i.taskID===e?(n.unsubscribe(),t(i.returnValue)):i.type===u.PoolEventType.taskFailed&&i.taskID===e?(n.unsubscribe(),r(i.error)):i.type===u.PoolEventType.terminated&&(n.unsubscribe(),r(Error("Pool has been terminated before task was run.")))}))}))}settled(e=!1){return n(this,void 0,void 0,(function*(){const t=()=>{return e=this.workers,t=e=>e.runningTasks,e.reduce(((e,r)=>[...e,...t(r)]),[]);var e,t},r=[],n=this.eventObservable.subscribe((e=>{e.type===u.PoolEventType.taskFailed&&r.push(e.error)}));return this.initErrors.length>0?Promise.reject(this.initErrors[0]):e&&0===this.taskQueue.length?(yield a.allSettled(t()),r):(yield new Promise(((e,t)=>{const r=this.eventObservable.subscribe({next(t){t.type===u.PoolEventType.taskQueueDrained&&(r.unsubscribe(),e(void 0))},error:t})})),yield a.allSettled(t()),n.unsubscribe(),r)}))}completed(e=!1){return n(this,void 0,void 0,(function*(){const t=this.settled(e),r=new Promise(((e,r)=>{const n=this.eventObservable.subscribe({next(i){i.type===u.PoolEventType.taskQueueDrained?(n.unsubscribe(),e(t)):i.type===u.PoolEventType.taskFailed&&(n.unsubscribe(),r(i.error))},error:r})})),n=yield Promise.race([t,r]);if(n.length>0)throw n[0]}))}events(){return this.eventObservable}queue(e){const{maxQueuedJobs:t=1/0}=this.options;if(this.isClosing)throw Error("Cannot schedule pool tasks after terminate() has been called.");if(this.initErrors.length>0)throw this.initErrors[0];const r=this.nextTaskID++,n=this.taskCompletion(r);n.catch((e=>{this.debug(`Task #${r} errored:`,e)}));const i={id:r,run:e,cancel:()=>{-1!==this.taskQueue.indexOf(i)&&(this.taskQueue=this.taskQueue.filter((e=>e!==i)),this.eventSubject.next({type:u.PoolEventType.taskCanceled,taskID:i.id}))},then:n.then.bind(n)};if(this.taskQueue.length>=t)throw Error("Maximum number of pool tasks queued. Refusing to queue another one.\nThis usually happens for one of two reasons: We are either at peak workload right now or some tasks just won't finish, thus blocking the pool.");return this.debug(`Queueing task #${i.id}...`),this.taskQueue.push(i),this.eventSubject.next({type:u.PoolEventType.taskQueued,taskID:i.id}),this.scheduleWork(),i}terminate(e){return n(this,void 0,void 0,(function*(){this.isClosing=!0,e||(yield this.completed(!0)),this.eventSubject.next({type:u.PoolEventType.terminated,remainingQueue:[...this.taskQueue]}),this.eventSubject.complete(),yield Promise.all(this.workers.map((e=>n(this,void 0,void 0,(function*(){return f.Thread.terminate(yield e.init)})))))}))}}function d(e,t){return new h(e,t)}h.EventType=u.PoolEventType,d.EventType=u.PoolEventType,t.Pool=d},61264:function(e,t,r){"use strict";var n=r(34155),i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.spawn=void 0;const s=o(r(11227)),a=r(35049),c=r(22467),u=r(53104),f=r(8258),l=r(56356),h=r(56891),d=s.default("threads:master:messages"),p=s.default("threads:master:spawn"),y=s.default("threads:master:thread-utils"),g=void 0!==n&&n.env.THREADS_WORKER_INIT_TIMEOUT?Number.parseInt(n.env.THREADS_WORKER_INIT_TIMEOUT,10):1e4;function b(e,t,r,n){const i=r.filter((e=>e.type===l.WorkerEventType.internalError)).map((e=>e.error));return Object.assign(e,{[f.$errors]:i,[f.$events]:r,[f.$terminate]:n,[f.$worker]:t})}t.spawn=function(e,t){return i(this,void 0,void 0,(function*(){p("Initializing new thread");const r=t&&t.timeout?t.timeout:g,n=yield function(e,t,r){return i(this,void 0,void 0,(function*(){let n;const i=new Promise(((e,i)=>{n=setTimeout((()=>i(Error(r))),t)})),o=yield Promise.race([e,i]);return clearTimeout(n),o}))}(function(e){return new Promise(((t,r)=>{const n=i=>{var o;d("Message from worker before finishing initialization:",i.data),(o=i.data)&&"init"===o.type?(e.removeEventListener("message",n),t(i.data)):(e=>e&&"uncaughtError"===e.type)(i.data)&&(e.removeEventListener("message",n),r(c.deserialize(i.data.error)))};e.addEventListener("message",n)}))}(e),r,`Timeout: Did not receive an init message from worker after ${r}ms. Make sure the worker calls expose().`),o=n.exposed,{termination:s,terminate:f}=function(e){const[t,r]=u.createPromiseWithResolver();return{terminate:()=>i(this,void 0,void 0,(function*(){y("Terminating worker"),yield e.terminate(),r()})),termination:t}}(e),m=function(e,t){return new a.Observable((r=>{const n=e=>{const t={type:l.WorkerEventType.message,data:e.data};r.next(t)},i=e=>{y("Unhandled promise rejection event in thread:",e);const t={type:l.WorkerEventType.internalError,error:Error(e.reason)};r.next(t)};e.addEventListener("message",n),e.addEventListener("unhandledrejection",i),t.then((()=>{const t={type:l.WorkerEventType.termination};e.removeEventListener("message",n),e.removeEventListener("unhandledrejection",i),r.next(t),r.complete()}))}))}(e,s);if("function"===o.type)return b(h.createProxyFunction(e),e,m,f);if("module"===o.type)return b(h.createProxyModule(e,o.methods),e,m,f);{const e=o.type;throw Error(`Worker init message states unexpected type of expose(): ${e}`)}}))}},54235:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Thread=void 0;const n=r(8258);function i(e){throw Error(e)}t.Thread={errors:e=>e[n.$errors]||i("Error observable not found. Make sure to pass a thread instance as returned by the spawn() promise."),events:e=>e[n.$events]||i("Events observable not found. Make sure to pass a thread instance as returned by the spawn() promise."),terminate:e=>e[n.$terminate]()}},62015:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ObservablePromise=void 0;const n=r(35049),i=()=>{},o=e=>e,s=e=>Promise.resolve().then(e);function a(e){throw e}class c extends n.Observable{constructor(e){super((t=>{const r=this,n=Object.assign(Object.assign({},t),{complete(){t.complete(),r.onCompletion()},error(e){t.error(e),r.onError(e)},next(e){t.next(e),r.onNext(e)}});try{return this.initHasRun=!0,e(n)}catch(e){n.error(e)}})),this.initHasRun=!1,this.fulfillmentCallbacks=[],this.rejectionCallbacks=[],this.firstValueSet=!1,this.state="pending"}onNext(e){this.firstValueSet||(this.firstValue=e,this.firstValueSet=!0)}onError(e){this.state="rejected",this.rejection=e;for(const t of this.rejectionCallbacks)s((()=>t(e)))}onCompletion(){this.state="fulfilled";for(const e of this.fulfillmentCallbacks)s((()=>e(this.firstValue)))}then(e,t){const r=e||o,n=t||a;let i=!1;return new Promise(((e,t)=>{const o=r=>{if(!i){i=!0;try{e(n(r))}catch(e){t(e)}}};return this.initHasRun||this.subscribe({error:o}),"fulfilled"===this.state?e(r(this.firstValue)):"rejected"===this.state?(i=!0,e(n(this.rejection))):(this.fulfillmentCallbacks.push((t=>{try{e(r(t))}catch(e){o(e)}})),void this.rejectionCallbacks.push(o))}))}catch(e){return this.then(void 0,e)}finally(e){const t=e||i;return this.then((e=>(t(),e)),(()=>t()))}static from(e){return function(e){return e&&"function"==typeof e.then}(e)?new c((t=>{e.then((e=>{t.next(e),t.complete()}),(e=>{t.error(e)}))})):super.from(e)}}t.ObservablePromise=c},90531:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.allSettled=void 0,t.allSettled=function(e){return Promise.all(e.map((e=>{const t=e=>({status:"fulfilled",value:e}),r=e=>({status:"rejected",reason:e}),n=Promise.resolve(e);try{return n.then(t,r)}catch(e){return Promise.reject(e)}})))}},53104:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createPromiseWithResolver=void 0;const r=()=>{};t.createPromiseWithResolver=function(){let e,t=!1,n=r;return[new Promise((r=>{t?r(e):n=r})),r=>{t=!0,e=r,n(e)}]}},37381:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultSerializer=t.extendSerializer=void 0,t.extendSerializer=function(e,t){const r=e.deserialize.bind(e),n=e.serialize.bind(e);return{deserialize:e=>t.deserialize(e,r),serialize:e=>t.serialize(e,n)}};const r=e=>Object.assign(Error(e.message),{name:e.name,stack:e.stack}),n=e=>({__error_marker:"$$error",message:e.message,name:e.name,stack:e.stack});t.DefaultSerializer={deserialize(e){return(t=e)&&"object"==typeof t&&"__error_marker"in t&&"$$error"===t.__error_marker?r(e):e;var t},serialize:e=>e instanceof Error?n(e):e}},8258:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.$worker=t.$transferable=t.$terminate=t.$events=t.$errors=void 0,t.$errors=Symbol("thread.errors"),t.$events=Symbol("thread.events"),t.$terminate=Symbol("thread.terminate"),t.$transferable=Symbol("thread.transferable"),t.$worker=Symbol("thread.worker")},88180:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Transfer=t.isTransferDescriptor=void 0;const n=r(8258);t.isTransferDescriptor=function(e){return e&&"object"==typeof e&&e[n.$transferable]},t.Transfer=function(e,t){if(!t){if(!(r=e)||"object"!=typeof r)throw Error();t=[e]}var r;return{[n.$transferable]:!0,send:e,transferables:t}}},56356:(e,t,r)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.WorkerEventType=void 0,r(8258),(n=t.WorkerEventType||(t.WorkerEventType={})).internalError="internalError",n.message="message",n.termination="termination"},43229:(e,t)=>{"use strict";var r,n;Object.defineProperty(t,"__esModule",{value:!0}),t.WorkerMessageType=t.MasterMessageType=void 0,(n=t.MasterMessageType||(t.MasterMessageType={})).cancel="cancel",n.run="run",(r=t.WorkerMessageType||(t.WorkerMessageType={})).error="error",r.init="init",r.result="result",r.running="running",r.uncaughtError="uncaughtError"},3447:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={isWorkerRuntime:function(){const e="undefined"!=typeof self&&"undefined"!=typeof Window&&self instanceof Window;return!("undefined"==typeof self||!self.postMessage||e)},postMessageToMaster:function(e,t){self.postMessage(e,t)},subscribeToMasterMessages:function(e){const t=t=>{e(t.data)};return self.addEventListener("message",t),()=>{self.removeEventListener("message",t)}}}},11934:function(e,t,r){"use strict";var n=r(34155),i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.expose=t.isWorkerRuntime=t.Transfer=t.registerSerializer=void 0;const s=o(r(6898)),a=r(22467),c=r(88180),u=r(43229),f=o(r(3447));var l=r(22467);Object.defineProperty(t,"registerSerializer",{enumerable:!0,get:function(){return l.registerSerializer}});var h=r(88180);Object.defineProperty(t,"Transfer",{enumerable:!0,get:function(){return h.Transfer}}),t.isWorkerRuntime=f.default.isWorkerRuntime;let d=!1;const p=new Map,y=e=>e&&e.type===u.MasterMessageType.run,g=e=>s.default(e)||function(e){return e&&"object"==typeof e&&"function"==typeof e.subscribe}(e);function b(e){return c.isTransferDescriptor(e)?{payload:e.send,transferables:e.transferables}:{payload:e,transferables:void 0}}function m(e,t){const{payload:r,transferables:n}=b(t),i={type:u.WorkerMessageType.error,uid:e,error:a.serialize(r)};f.default.postMessageToMaster(i,n)}function v(e,t,r){const{payload:n,transferables:i}=b(r),o={type:u.WorkerMessageType.result,uid:e,complete:!!t||void 0,payload:n};f.default.postMessageToMaster(o,i)}function w(e){try{const t={type:u.WorkerMessageType.uncaughtError,error:a.serialize(e)};f.default.postMessageToMaster(t)}catch(t){console.error("Not reporting uncaught error back to master thread as it occured while reporting an uncaught error already.\nLatest error:",t,"\nOriginal error:",e)}}function E(e,t,r){return i(this,void 0,void 0,(function*(){let n;try{n=t(...r)}catch(t){return m(e,t)}const i=g(n)?"observable":"promise";if(function(e,t){const r={type:u.WorkerMessageType.running,uid:e,resultType:t};f.default.postMessageToMaster(r)}(e,i),g(n)){const t=n.subscribe((t=>v(e,!1,a.serialize(t))),(t=>{m(e,a.serialize(t)),p.delete(e)}),(()=>{v(e,!0),p.delete(e)}));p.set(e,t)}else try{const t=yield n;v(e,!0,a.serialize(t))}catch(t){m(e,a.serialize(t))}}))}t.expose=function(e){if(!f.default.isWorkerRuntime())throw Error("expose() called in the master thread.");if(d)throw Error("expose() called more than once. This is not possible. Pass an object to expose() if you want to expose multiple functions.");if(d=!0,"function"==typeof e)f.default.subscribeToMasterMessages((t=>{y(t)&&!t.method&&E(t.uid,e,t.args.map(a.deserialize))})),function(){const e={type:u.WorkerMessageType.init,exposed:{type:"function"}};f.default.postMessageToMaster(e)}();else{if("object"!=typeof e||!e)throw Error(`Invalid argument passed to expose(). Expected a function or an object, got: ${e}`);f.default.subscribeToMasterMessages((t=>{y(t)&&t.method&&E(t.uid,e[t.method],t.args.map(a.deserialize))})),function(e){const t={type:u.WorkerMessageType.init,exposed:{type:"module",methods:e}};f.default.postMessageToMaster(t)}(Object.keys(e).filter((t=>"function"==typeof e[t])))}f.default.subscribeToMasterMessages((e=>{if((t=e)&&t.type===u.MasterMessageType.cancel){const t=e.uid,r=p.get(t);r&&(r.unsubscribe(),p.delete(t))}var t}))},"undefined"!=typeof self&&"function"==typeof self.addEventListener&&f.default.isWorkerRuntime()&&(self.addEventListener("error",(e=>{setTimeout((()=>w(e.error||e)),250)})),self.addEventListener("unhandledrejection",(e=>{const t=e.reason;t&&"string"==typeof t.message&&setTimeout((()=>w(t)),250)}))),void 0!==n&&"function"==typeof n.on&&f.default.isWorkerRuntime()&&(n.on("uncaughtException",(e=>{setTimeout((()=>w(e)),250)})),n.on("unhandledRejection",(e=>{e&&"string"==typeof e.message&&setTimeout((()=>w(e)),250)})))},10715:(e,t,r)=>{"use strict";const{AbortController:n}="undefined"!=typeof self?self:"undefined"!=typeof window?window:r(28599),i=r(9539);class o extends n{constructor(e){super(),this._ms=e,this._timer=i((()=>this.abort()),e),Object.setPrototypeOf(this,o.prototype)}abort(){return this._timer.clear(),super.abort()}clear(){this._timer.clear()}reset(){this._timer.clear(),this._timer=i((()=>this.abort()),this._ms)}}e.exports=o,e.exports.TimeoutController=o},9539:(e,t,r)=>{"use strict";var n=r(41283);function i(e,t,r){var i=this;this._started=n(),this._rescheduled=0,this._scheduled=t,this._args=r,this._timer=setTimeout((function t(){i._rescheduled>0?(i._scheduled=i._rescheduled-(n()-i._started),i._timer=setTimeout(t,i._scheduled),i._rescheduled=0):e.apply(null,i._args)}),t)}i.prototype.reschedule=function(e){var t=n();return!(t+e-(this._started+this._scheduled)<0||(this._started=t,this._rescheduled=e,0))},i.prototype.clear=function(){clearTimeout(this._timer)},e.exports=function(){if("function"!=typeof arguments[0])throw new Error("callback needed");if("number"!=typeof arguments[1])throw new Error("timeout needed");var e;if(arguments.length>0){e=new Array(arguments.length-2);for(var t=0;t{"use strict";e.exports=function(){return Date.now()}},63700:(e,t,r)=>{"use strict";var n=r(71156),i=r(90793);e.exports=n.bind(null,i)},71156:e=>{"use strict";function t(e){return e>=55296&&e<=56319}function r(e){return e>=56320&&e<=57343}e.exports=function(e,n,i){if("string"!=typeof n)throw new Error("Input must be string");for(var o,s,a=n.length,c=0,u=0;ui)return n.slice(0,u-s.length+1)}return n}},4257:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.discoverAndNotify=t.createMyRoute=t.registerDiscoveryService=void 0;var n=r(90281);t.registerDiscoveryService=function(){for(var e=[],t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(11189);t.default=new n.AvmRunnerBackground({method:"fetch-from-url",baseUrl:"https://fluence.one/registry-demo/",filePaths:{avm:"avm.wasm",marine:"marine-js.wasm"}})},63607:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]\n \n\t\t\t'),(r=document.createElement("li")).innerHTML=t,[2,r]}))}))})),[4,Promise.all(t)];case 1:for(r=h.sent(),null==(o=document.getElementById("user-list"))||o.replaceChildren.apply(o,r),s=0,a=e;s{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.instanceOf=t.select=t.not=t.when=void 0;const n=r(98149);t.when=e=>({[n.PatternKind]:n.Guard,[n.Guard]:e}),t.not=e=>({[n.PatternKind]:n.Not,[n.Not]:e}),t.select=function(e){return void 0===e?{[n.PatternKind]:n.Select,[n.Select]:n.AnonymousSelectKey}:{[n.PatternKind]:n.Select,[n.Select]:e}},t.instanceOf=e=>(0,t.when)(function(e){return t=>t instanceof e}(e))},16176:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isMatching=t.match=t.instanceOf=t.select=t.not=t.when=t.__=void 0;const n=r(98149),i=r(29840);Object.defineProperty(t,"when",{enumerable:!0,get:function(){return i.when}}),Object.defineProperty(t,"not",{enumerable:!0,get:function(){return i.not}}),Object.defineProperty(t,"select",{enumerable:!0,get:function(){return i.select}}),Object.defineProperty(t,"instanceOf",{enumerable:!0,get:function(){return i.instanceOf}});const o=r(71586);Object.defineProperty(t,"__",{enumerable:!0,get:function(){return o.__}}),t.match=e=>s(e,[]);const s=(e,t)=>{const r=()=>{const r=t.find((({test:t})=>t(e)));if(!r){let t;try{t=JSON.stringify(e)}catch(r){t=e}throw new Error(`Pattern matching error: no pattern matches value ${t}`)}return r.handler(r.select(e),e)};return{with(...r){const i=r[r.length-1],o=[],a=[];for(let e=0;eBoolean(o.some((t=>c(t,e,((e,t)=>{u[e]=t}))))&&a.every((t=>t(e)))),handler:i,select:e=>Object.keys(u).length?n.AnonymousSelectKey in u?u[n.AnonymousSelectKey]:u:e}]))},when:(r,n)=>s(e,t.concat([{test:r,handler:n,select:e=>e}])),otherwise:r=>s(e,t.concat([{test:()=>!0,handler:r,select:e=>e}])).run(),exhaustive:()=>r(),run:r}},a=e=>Boolean(e&&"object"==typeof e),c=(e,t,r)=>{if(a(e)){if((i=e)&&i[n.PatternKind]===n.Guard)return Boolean(e[n.Guard](t));if((e=>e&&e[n.PatternKind]===n.Select)(e))return r(e[n.Select],t),!0;if((e=>e&&e[n.PatternKind]===n.Not)(e))return!c(e[n.Not],t,r);if(!a(t))return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;if(1===e.length){const n={},i=(e,t)=>{n[e]=(n[e]||[]).concat([t])},o=t.every((t=>c(e[0],t,i)));return o&&Object.keys(n).forEach((e=>r(e,n[e]))),o}return e.length===t.length&&e.every(((e,n)=>c(e,t[n],r)))}if(e instanceof Map)return t instanceof Map&&[...e.keys()].every((n=>c(e.get(n),t.get(n),r)));if(e instanceof Set){if(!(t instanceof Set))return!1;if(0===e.size)return 0===t.size;if(1===e.size){const[n]=[...e.values()];return Object.values(o.__).includes(n)?c([n],[...t.values()],r):t.has(n)}return[...e.values()].every((e=>t.has(e)))}return Object.keys(e).every((n=>n in t&&c(e[n],t[n],r)))}var i;return t===e};t.isMatching=function(...e){if(1===e.length){const[t]=e;return e=>c(t,e,(()=>{}))}if(2===e.length){const[t,r]=e;return c(t,r,(()=>{}))}throw new Error(`isMatching wasn't given enough arguments: expected 1 or 2, received ${e.length}.`)}},98149:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AnonymousSelectKey=t.Select=t.Not=t.Guard=t.PatternKind=void 0,t.PatternKind=Symbol("@ts-pattern/pattern-kind"),t.Guard=Symbol("@ts-pattern/guard"),t.Not=Symbol("@ts-pattern/not"),t.Select=Symbol("@ts-pattern/select"),t.AnonymousSelectKey="@ts-pattern/__anonymous-select-key"},71586:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.__=void 0;const n=r(29840),i=(0,n.when)((function(e){return!0})),o=(0,n.when)((function(e){return"string"==typeof e})),s=(0,n.when)((function(e){return"number"==typeof e})),a=(0,n.when)((function(e){return Number.isNaN(e)})),c=(0,n.when)((function(e){return"boolean"==typeof e})),u=(0,n.when)((function(e){return null==e}));t.__=Object.assign(i,{string:o,number:s,NaN:a,boolean:c,nullish:u})},90793:e=>{"use strict";function t(e){return e>=55296&&e<=56319}function r(e){return e>=56320&&e<=57343}e.exports=function(e){if("string"!=typeof e)throw new Error("Input must be string");for(var n=e.length,i=0,o=null,s=null,a=0;a=128&&o<=2047?i+=2:o>=2048&&o<=65535&&(i+=3),s=o;return i}},21614:(e,t,r)=>{"use strict";r.r(t),r.d(t,{NIL:()=>k,parse:()=>g,stringify:()=>f,v1:()=>y,v3:()=>T,v4:()=>I,v5:()=>R,validate:()=>a,version:()=>B});var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),i=new Uint8Array(16);function o(){if(!n)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return n(i)}const s=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,a=function(e){return"string"==typeof e&&s.test(e)};for(var c=[],u=0;u<256;++u)c.push((u+256).toString(16).substr(1));const f=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(c[e[t+0]]+c[e[t+1]]+c[e[t+2]]+c[e[t+3]]+"-"+c[e[t+4]]+c[e[t+5]]+"-"+c[e[t+6]]+c[e[t+7]]+"-"+c[e[t+8]]+c[e[t+9]]+"-"+c[e[t+10]]+c[e[t+11]]+c[e[t+12]]+c[e[t+13]]+c[e[t+14]]+c[e[t+15]]).toLowerCase();if(!a(r))throw TypeError("Stringified UUID is invalid");return r};var l,h,d=0,p=0;const y=function(e,t,r){var n=t&&r||0,i=t||new Array(16),s=(e=e||{}).node||l,a=void 0!==e.clockseq?e.clockseq:h;if(null==s||null==a){var c=e.random||(e.rng||o)();null==s&&(s=l=[1|c[0],c[1],c[2],c[3],c[4],c[5]]),null==a&&(a=h=16383&(c[6]<<8|c[7]))}var u=void 0!==e.msecs?e.msecs:Date.now(),y=void 0!==e.nsecs?e.nsecs:p+1,g=u-d+(y-p)/1e4;if(g<0&&void 0===e.clockseq&&(a=a+1&16383),(g<0||u>d)&&void 0===e.nsecs&&(y=0),y>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");d=u,p=y,h=a;var b=(1e4*(268435455&(u+=122192928e5))+y)%4294967296;i[n++]=b>>>24&255,i[n++]=b>>>16&255,i[n++]=b>>>8&255,i[n++]=255&b;var m=u/4294967296*1e4&268435455;i[n++]=m>>>8&255,i[n++]=255&m,i[n++]=m>>>24&15|16,i[n++]=m>>>16&255,i[n++]=a>>>8|128,i[n++]=255&a;for(var v=0;v<6;++v)i[n+v]=s[v];return t||f(i)},g=function(e){if(!a(e))throw TypeError("Invalid UUID");var t,r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=255&t,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=255&t,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=255&t,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=255&t,r};function b(e,t,r){function n(e,n,i,o){if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));for(var t=[],r=0;r>>9<<4)+1}function v(e,t){var r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function w(e,t,r,n,i,o){return v((s=v(v(t,e),v(n,o)))<<(a=i)|s>>>32-a,r);var s,a}function E(e,t,r,n,i,o,s){return w(t&r|~t&n,e,t,i,o,s)}function _(e,t,r,n,i,o,s){return w(t&n|r&~n,e,t,i,o,s)}function S(e,t,r,n,i,o,s){return w(t^r^n,e,t,i,o,s)}function A(e,t,r,n,i,o,s){return w(r^(t|~n),e,t,i,o,s)}const T=b("v3",48,(function(e){if("string"==typeof e){var t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(var r=0;r>5]>>>i%32&255,s=parseInt(n.charAt(o>>>4&15)+n.charAt(15&o),16);t.push(s)}return t}(function(e,t){e[t>>5]|=128<>5]|=(255&e[n/8])<>>32-t}const R=b("v5",80,(function(e){var t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){var n=unescape(encodeURIComponent(e));e=[];for(var i=0;i>>0;v=m,m=b,b=P(g,30)>>>0,g=y,y=_}r[0]=r[0]+y>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+b>>>0,r[3]=r[3]+m>>>0,r[4]=r[4]+v>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,255&r[0],r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,255&r[1],r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,255&r[2],r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,255&r[3],r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,255&r[4]]})),k="00000000-0000-0000-0000-000000000000",B=function(e){if(!a(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)}},26988:e=>{e.exports=function e(t,r){var n,i=0,o=0,s=r=r||0,a=t.length;do{if(s>=a)throw e.bytes=0,new RangeError("Could not decode varint");n=t[s++],i+=o<28?(127&n)<=128);return e.bytes=s-r,i}},1312:e=>{e.exports=function e(r,n,i){n=n||[];for(var o=i=i||0;r>=t;)n[i++]=255&r|128,r/=128;for(;-128&r;)n[i++]=255&r|128,r>>>=7;return n[i]=0|r,e.bytes=i-o+1,n};var t=Math.pow(2,31)},94676:(e,t,r)=>{e.exports={encode:r(1312),decode:r(26988),encodingLength:r(10082)}},10082:e=>{var t=Math.pow(2,7),r=Math.pow(2,14),n=Math.pow(2,21),i=Math.pow(2,28),o=Math.pow(2,35),s=Math.pow(2,42),a=Math.pow(2,49),c=Math.pow(2,56),u=Math.pow(2,63);e.exports=function(e){return e{"use strict";var n=r(34155);const i=r(59134),o="object"==typeof window&&"object"==typeof document&&9===document.nodeType,s=i(),a=o&&!s,c=s&&!o,u=s&&o,f=void 0!==n&&void 0!==n.release&&"node"===n.release.name&&!s,l="function"==typeof importScripts&&"undefined"!=typeof self&&"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,h=void 0!==n&&void 0!==n.env&&!1;e.exports={isTest:h,isElectron:s,isElectronMain:c,isElectronRenderer:u,isNode:f,isBrowser:a,isWebWorker:l,isEnvWithDom:o}},35883:()=>{},46601:()=>{},89214:()=>{},5696:()=>{},89408:()=>{},57600:()=>{},39370:()=>{},25819:()=>{},82233:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Key:()=>c});var n=r(92263),i=r(52217);const o="/",s=(new TextEncoder).encode(o),a=s[0];class c{constructor(e,t){if("string"==typeof e)this._buf=(0,i.fromString)(e);else{if(!(e instanceof Uint8Array))throw new Error("Invalid key, should be String of Uint8Array");this._buf=e}if(null==t&&(t=!0),t&&this.clean(),0===this._buf.byteLength||this._buf[0]!==a)throw new Error("Invalid key")}toString(e="utf8"){return(0,n.toString)(this._buf,e)}uint8Array(){return this._buf}get[Symbol.toStringTag](){return`Key(${this.toString()})`}static withNamespaces(e){return new c(e.join(o))}static random(){return new c(((e=21)=>{let t="",r=crypto.getRandomValues(new Uint8Array(e));for(;e--;){let n=63&r[e];t+=n<36?n.toString(36):n<62?(n-26).toString(36).toUpperCase():n<63?"_":"-"}return t})().replace(/-/g,""))}static asKey(e){return e instanceof Uint8Array||"string"==typeof e?new c(e):e.uint8Array?new c(e.uint8Array()):null}clean(){if(this._buf&&0!==this._buf.byteLength||(this._buf=s),this._buf[0]!==a){const e=new Uint8Array(this._buf.byteLength+1);e.fill(a,0,1),e.set(this._buf,1),this._buf=e}for(;this._buf.byteLength>1&&this._buf[this._buf.byteLength-1]===a;)this._buf=this._buf.subarray(0,-1)}less(e){const t=this.list(),r=e.list();for(let e=0;ei)return!1}return t.lengthe.namespaces())),[].concat(...t))]);var t}}},89880:(e,t,r)=>{"use strict";r.d(t,{kU:()=>f,Dp:()=>u,ET:()=>l});var n=r(95934);class i{constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class o{constructor(e,t,r){this.name=e,this.prefix=t,this.baseDecode=r}decode(e){if("string"==typeof e){if(e[0]===this.prefix)return this.baseDecode(e.slice(1));throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`)}throw Error("Can only multibase decode strings")}or(e){return a(this,e)}}class s{constructor(e){this.decoders=e}or(e){return a(this,e)}decode(e){const t=e[0],r=this.decoders[t];if(r)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const a=(e,t)=>new s({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class c{constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new i(e,t,r),this.decoder=new o(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const u=({name:e,prefix:t,encode:r,decode:n})=>new c(e,t,r,n),f=({prefix:e,name:t,alphabet:r})=>{const{encode:i,decode:o}=function(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,s=new Uint8Array(o);e[t];){var f=r[e.charCodeAt(t)];if(255===f)return;for(var l=0,h=o-1;(0!==f||l>>0,s[h]=f%256>>>0,f=f/256>>>0;if(0!==f)throw new Error("Non-zero carry");i=l,t++}if(" "!==e[t]){for(var d=o-i;d!==o&&0===s[d];)d++;for(var p=new Uint8Array(n+(o-d)),y=n;d!==o;)p[y++]=s[d++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,i=0,o=t.length;i!==o&&0===t[i];)i++,r++;for(var s=(o-i)*f+1>>>0,u=new Uint8Array(s);i!==o;){for(var l=t[i],h=0,d=s-1;(0!==l||h>>0,u[d]=l%a>>>0,l=l/a>>>0;if(0!==l)throw new Error("Non-zero carry");n=h,i++}for(var p=s-n;p!==s&&0===u[p];)p++;for(var y=c.repeat(r);p(0,n.oQ)(o(e))})},l=({name:e,prefix:t,bitsPerChar:r,alphabet:n})=>u({prefix:t,name:e,encode:e=>((e,t,r)=>{const n="="===t[t.length-1],i=(1<r;)s-=r,o+=t[i&a>>s];if(s&&(o+=t[i&a<((e,t,r,n)=>{const i={};for(let e=0;e=8&&(a-=8,s[u++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return s})(t,n,r,e)})},84835:(e,t,r)=>{"use strict";r.r(t),r.d(t,{base16:()=>i,base16upper:()=>o});var n=r(89880);const i=(0,n.ET)({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),o=(0,n.ET)({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})},22817:(e,t,r)=>{"use strict";r.r(t),r.d(t,{base32:()=>i,base32upper:()=>o,base32pad:()=>s,base32padupper:()=>a,base32hex:()=>c,base32hexupper:()=>u,base32hexpad:()=>f,base32hexpadupper:()=>l,base32z:()=>h});var n=r(89880);const i=(0,n.ET)({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),o=(0,n.ET)({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),s=(0,n.ET)({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),a=(0,n.ET)({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),c=(0,n.ET)({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),u=(0,n.ET)({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),f=(0,n.ET)({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),l=(0,n.ET)({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),h=(0,n.ET)({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})},98441:(e,t,r)=>{"use strict";r.r(t),r.d(t,{base36:()=>i,base36upper:()=>o});var n=r(89880);const i=(0,n.kU)({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),o=(0,n.kU)({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})},99086:(e,t,r)=>{"use strict";r.r(t),r.d(t,{base58btc:()=>i,base58flickr:()=>o});var n=r(89880);const i=(0,n.kU)({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),o=(0,n.kU)({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})},9885:(e,t,r)=>{"use strict";r.r(t),r.d(t,{base64:()=>i,base64pad:()=>o,base64url:()=>s,base64urlpad:()=>a});var n=r(89880);const i=(0,n.ET)({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),o=(0,n.ET)({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),s=(0,n.ET)({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),a=(0,n.ET)({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})},95934:(e,t,r)=>{"use strict";r.d(t,{fS:()=>n,oQ:()=>i,mL:()=>o,BB:()=>s}),new Uint8Array(0);const n=(e,t)=>{if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")},o=e=>(new TextEncoder).encode(e),s=e=>(new TextDecoder).decode(e)},81362:(e,t,r)=>{"use strict";r.r(t),r.d(t,{CID:()=>c});var n=r(4714),i=r(28924),o=r(99086),s=r(22817),a=r(95934);class c{constructor(e,t,r,n){this.code=t,this.version=e,this.multihash=r,this.bytes=n,this.byteOffset=n.byteOffset,this.byteLength=n.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:b,byteLength:b,code:g,version:g,multihash:g,bytes:g,_baseCache:b,asCID:b})}toV0(){if(0===this.version)return this;{const{code:e,multihash:t}=this;if(e!==h)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==d)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return c.createV0(t)}}toV1(){switch(this.version){case 0:{const{code:e,digest:t}=this.multihash,r=i.create(e,t);return c.createV1(this.code,r)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}equals(e){return e&&this.code===e.code&&this.version===e.version&&i.equals(this.multihash,e.multihash)}toString(e){const{bytes:t,version:r,_baseCache:n}=this;return 0===r?f(t,n,e||o.base58btc.encoder):l(t,n,e||s.base32.encoder)}toJSON(){return{code:this.code,version:this.version,hash:this.multihash.bytes}}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return"CID("+this.toString()+")"}static isCID(e){return m(/^0\.0/,v),!(!e||!e[y]&&e.asCID!==e)}get toBaseEncodedString(){throw new Error("Deprecated, use .toString()")}get codec(){throw new Error('"codec" property is deprecated, use integer "code" property instead')}get buffer(){throw new Error("Deprecated .buffer property, use .bytes to get Uint8Array instead")}get multibaseName(){throw new Error('"multibaseName" property is deprecated')}get prefix(){throw new Error('"prefix" property is deprecated')}static asCID(e){if(e instanceof c)return e;if(null!=e&&e.asCID===e){const{version:t,code:r,multihash:n,bytes:i}=e;return new c(t,r,n,i||p(t,r,n.bytes))}if(null!=e&&!0===e[y]){const{version:t,multihash:r,code:n}=e,o=i.decode(r);return c.create(t,n,o)}return null}static create(e,t,r){if("number"!=typeof t)throw new Error("String codecs are no longer supported");switch(e){case 0:if(t!==h)throw new Error(`Version 0 CID must use dag-pb (code: ${h}) block encoding`);return new c(e,t,r,r.bytes);case 1:{const n=p(e,t,r.bytes);return new c(e,t,r,n)}default:throw new Error("Invalid version")}}static createV0(e){return c.create(0,h,e)}static createV1(e,t){return c.create(1,e,t)}static decode(e){const[t,r]=c.decodeFirst(e);if(r.length)throw new Error("Incorrect length");return t}static decodeFirst(e){const t=c.inspectBytes(e),r=t.size-t.multihashSize,n=(0,a.oQ)(e.subarray(r,r+t.multihashSize));if(n.byteLength!==t.multihashSize)throw new Error("Incorrect length");const o=n.subarray(t.multihashSize-t.digestSize),s=new i.Digest(t.multihashCode,t.digestSize,o,n);return[0===t.version?c.createV0(s):c.createV1(t.codec,s),e.subarray(t.size)]}static inspectBytes(e){let t=0;const r=()=>{const[r,i]=n.Jx(e.subarray(t));return t+=i,r};let i=r(),o=h;if(18===i?(i=0,t=0):1===i&&(o=r()),0!==i&&1!==i)throw new RangeError(`Invalid CID version ${i}`);const s=t,a=r(),c=r(),u=t+c;return{version:i,codec:o,multihashCode:a,digestSize:c,multihashSize:u-s,size:u}}static parse(e,t){const[r,n]=u(e,t),i=c.decode(n);return i._baseCache.set(r,e),i}}const u=(e,t)=>{switch(e[0]){case"Q":{const r=t||o.base58btc;return[o.base58btc.prefix,r.decode(`${o.base58btc.prefix}${e}`)]}case o.base58btc.prefix:{const r=t||o.base58btc;return[o.base58btc.prefix,r.decode(e)]}case s.base32.prefix:{const r=t||s.base32;return[s.base32.prefix,r.decode(e)]}default:if(null==t)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}},f=(e,t,r)=>{const{prefix:n}=r;if(n!==o.base58btc.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);const i=t.get(n);if(null==i){const i=r.encode(e).slice(1);return t.set(n,i),i}return i},l=(e,t,r)=>{const{prefix:n}=r,i=t.get(n);if(null==i){const i=r.encode(e);return t.set(n,i),i}return i},h=112,d=18,p=(e,t,r)=>{const i=n.P$(e),o=i+n.P$(t),s=new Uint8Array(o+r.byteLength);return n.mL(e,s,0),n.mL(t,s,i),s.set(r,o),s},y=Symbol.for("@ipld/js-cid/CID"),g={writable:!1,configurable:!1,enumerable:!0},b={writable:!1,enumerable:!1,configurable:!1},m=(e,t)=>{if(!e.test("0.0.0-dev"))throw new Error(t);console.warn(t)},v="CID.isCID(v) is deprecated and will be removed in the next major release.\nFollowing code pattern:\n\nif (CID.isCID(value)) {\n doSomethingWithCID(value)\n}\n\nIs replaced with:\n\nconst cid = CID.asCID(value)\nif (cid) {\n // Make sure to use cid instead of value\n doSomethingWithCID(cid)\n}\n"},28924:(e,t,r)=>{"use strict";r.r(t),r.d(t,{create:()=>o,decode:()=>s,equals:()=>a,Digest:()=>c});var n=r(95934),i=r(4714);const o=(e,t)=>{const r=t.byteLength,n=i.P$(e),o=n+i.P$(r),s=new Uint8Array(o+r);return i.mL(e,s,0),i.mL(r,s,n),s.set(t,o),new c(e,r,t,s)},s=e=>{const t=(0,n.oQ)(e),[r,o]=i.Jx(t),[s,a]=i.Jx(t.subarray(o)),u=t.subarray(o+a);if(u.byteLength!==s)throw new Error("Incorrect length");return new c(r,s,u,t)},a=(e,t)=>e===t||e.code===t.code&&e.size===t.size&&(0,n.fS)(e.bytes,t.bytes);class c{constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}}},7225:(e,t,r)=>{"use strict";r.d(t,{D:()=>i});var n=r(28924);const i=({name:e,code:t,encode:r})=>new o(e,t,r);class o{constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?n.create(this.code,t):t.then((e=>n.create(this.code,e)))}throw Error("Unknown type, must be binary type")}}},78103:(e,t,r)=>{"use strict";r.r(t),r.d(t,{identity:()=>s});var n=r(95934),i=r(28924);const o=n.oQ,s={code:0,name:"identity",encode:o,digest:e=>i.create(0,o(e))}},56155:(e,t,r)=>{"use strict";r.r(t),r.d(t,{sha256:()=>o,sha512:()=>s});var n=r(7225);const i=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),o=(0,n.D)({name:"sha2-256",code:18,encode:i("SHA-256")}),s=(0,n.D)({name:"sha2-512",code:19,encode:i("SHA-512")})},4714:(e,t,r)=>{"use strict";r.d(t,{Jx:()=>p,mL:()=>y,P$:()=>g});var n=Math.pow(2,31),i=Math.pow(2,7),o=Math.pow(2,14),s=Math.pow(2,21),a=Math.pow(2,28),c=Math.pow(2,35),u=Math.pow(2,42),f=Math.pow(2,49),l=Math.pow(2,56),h=Math.pow(2,63);const d={encode:function e(t,r,i){r=r||[];for(var o=i=i||0;t>=n;)r[i++]=255&t|128,t/=128;for(;-128&t;)r[i++]=255&t|128,t>>>=7;return r[i]=0|t,e.bytes=i-o+1,r},decode:function e(t,r){var n,i=0,o=0,s=r=r||0,a=t.length;do{if(s>=a)throw e.bytes=0,new RangeError("Could not decode varint");n=t[s++],i+=o<28?(127&n)<=128);return e.bytes=s-r,i},encodingLength:function(e){return e[d.decode(e),d.decode.bytes],y=(e,t,r=0)=>(d.encode(e,t,r),t),g=e=>d.encodingLength(e)},20605:(e,t,r)=>{"use strict";function n(e,t){t||(t=e.reduce(((e,t)=>e+t.length),0));const r=new Uint8Array(t);let n=0;for(const t of e)r.set(t,n),n+=t.length;return r}r.r(t),r.d(t,{concat:()=>n})},19588:(e,t,r)=>{"use strict";function n(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;rn})},52217:(e,t,r)=>{"use strict";r.r(t),r.d(t,{fromString:()=>i});var n=r(32280);function i(e,t="utf8"){const r=n.Z[t];if(!r)throw new Error(`Unsupported encoding "${t}"`);return r.decoder.decode(`${r.prefix}${e}`)}},92263:(e,t,r)=>{"use strict";r.r(t),r.d(t,{toString:()=>i});var n=r(32280);function i(e,t="utf8"){const r=n.Z[t];if(!r)throw new Error(`Unsupported encoding "${t}"`);return r.encoder.encode(e).substring(1)}},32280:(e,t,r)=>{"use strict";r.d(t,{Z:()=>O});var n={};r.r(n),r.d(n,{identity:()=>l});var i={};r.r(i),r.d(i,{base2:()=>h});var o={};r.r(o),r.d(o,{base8:()=>d});var s={};r.r(s),r.d(s,{base10:()=>p});var a={};r.r(a),r.d(a,{code:()=>E,decode:()=>S,encode:()=>_,name:()=>w});var c={};r.r(c),r.d(c,{code:()=>C,decode:()=>R,encode:()=>P,name:()=>I});var u=r(89880),f=r(95934);const l=(0,u.Dp)({prefix:"\0",name:"identity",encode:e=>(0,f.BB)(e),decode:e=>(0,f.mL)(e)}),h=(0,u.ET)({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),d=(0,u.ET)({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),p=(0,u.kU)({prefix:"9",name:"base10",alphabet:"0123456789"});var y=r(84835),g=r(22817),b=r(98441),m=r(99086),v=r(9885);r(56155),r(78103);const w="raw",E=85,_=e=>(0,f.oQ)(e),S=e=>(0,f.oQ)(e),A=new TextEncoder,T=new TextDecoder,I="json",C=512,P=e=>A.encode(JSON.stringify(e)),R=e=>JSON.parse(T.decode(e));r(81362),r(4714),r(7225),r(28924);const k={...n,...i,...o,...s,...y,...g,...b,...m,...v};function B(e,t,r,n){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:n}}}const x=B("utf8","u",(e=>"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),M=B("ascii","a",(e=>{let t="a";for(let r=0;r{e=e.substring(1);const t=new Uint8Array(e.length);for(let r=0;r{"use strict";e.exports={i8:"6.5.4"}},28362:e=>{"use strict";e.exports=JSON.parse('{"name":"libp2p","version":"0.33.0","description":"JavaScript implementation of libp2p, a modular peer to peer network stack","leadMaintainer":"Jacob Heun ","main":"src/index.js","types":"dist/src/index.d.ts","typesVersions":{"*":{"src/*":["dist/src/*","dist/src/*/index"]}},"files":["dist","src"],"scripts":{"lint":"aegir lint","build":"aegir build","build:proto":"npm run build:proto:circuit && npm run build:proto:identify && npm run build:proto:plaintext && npm run build:proto:address-book && npm run build:proto:proto-book && npm run build:proto:peer-record && npm run build:proto:envelope","build:proto:circuit":"pbjs -t static-module -w commonjs -r libp2p-circuit --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/circuit/protocol/index.js ./src/circuit/protocol/index.proto","build:proto:identify":"pbjs -t static-module -w commonjs -r libp2p-identify --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/identify/message.js ./src/identify/message.proto","build:proto:plaintext":"pbjs -t static-module -w commonjs -r libp2p-plaintext --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/insecure/proto.js ./src/insecure/proto.proto","build:proto:address-book":"pbjs -t static-module -w commonjs -r libp2p-address-book --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/peer-store/persistent/pb/address-book.js ./src/peer-store/persistent/pb/address-book.proto","build:proto:proto-book":"pbjs -t static-module -w commonjs -r libp2p-proto-book --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/peer-store/persistent/pb/proto-book.js ./src/peer-store/persistent/pb/proto-book.proto","build:proto:peer-record":"pbjs -t static-module -w commonjs -r libp2p-peer-record --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/record/peer-record/peer-record.js ./src/record/peer-record/peer-record.proto","build:proto:envelope":"pbjs -t static-module -w commonjs -r libp2p-envelope --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/record/envelope/envelope.js ./src/record/envelope/envelope.proto","build:proto-types":"npm run build:proto-types:circuit && npm run build:proto-types:identify && npm run build:proto-types:plaintext && npm run build:proto-types:address-book && npm run build:proto-types:proto-book && npm run build:proto-types:peer-record && npm run build:proto-types:envelope","build:proto-types:circuit":"pbts -o src/circuit/protocol/index.d.ts src/circuit/protocol/index.js","build:proto-types:identify":"pbts -o src/identify/message.d.ts src/identify/message.js","build:proto-types:plaintext":"pbts -o src/insecure/proto.d.ts src/insecure/proto.js","build:proto-types:address-book":"pbts -o src/peer-store/persistent/pb/address-book.d.ts src/peer-store/persistent/pb/address-book.js","build:proto-types:proto-book":"pbts -o src/peer-store/persistent/pb/proto-book.d.ts src/peer-store/persistent/pb/proto-book.js","build:proto-types:peer-record":"pbts -o src/record/peer-record/peer-record.d.ts src/record/peer-record/peer-record.js","build:proto-types:envelope":"pbts -o src/record/envelope/envelope.d.ts src/record/envelope/envelope.js","test":"aegir test","test:ts":"aegir build --no-bundle && npm run test --prefix test/ts-use","test:node":"aegir test -t node -f \\"./test/**/*.{node,spec}.js\\"","test:browser":"aegir test -t browser","test:examples":"cd examples && npm run test:all","prepare":"aegir build --no-bundle","release":"aegir release -t node -t browser","release-minor":"aegir release --type minor -t node -t browser","release-major":"aegir release --type major -t node -t browser","coverage":"nyc --reporter=text --reporter=lcov npm run test:node"},"repository":{"type":"git","url":"https://github.com/libp2p/js-libp2p.git"},"keywords":["libp2p","network","p2p","peer","peer-to-peer","IPFS"],"bugs":{"url":"https://github.com/libp2p/js-libp2p/issues"},"homepage":"https://libp2p.io","license":"MIT","engines":{"node":">=14.0.0"},"browser":{"@motrix/nat-api":false},"eslintConfig":{"extends":"ipfs","ignorePatterns":["!.aegir.js","test/ts-use"]},"dependencies":{"abortable-iterator":"^3.0.0","@motrix/nat-api":"^0.3.1","@vascosantos/moving-average":"^1.1.0","abort-controller":"^3.0.0","aggregate-error":"^3.1.0","any-signal":"^2.1.1","bignumber.js":"^9.0.1","class-is":"^1.1.0","debug":"^4.3.1","err-code":"^3.0.0","es6-promisify":"^7.0.0","events":"^3.3.0","hashlru":"^2.3.0","interface-datastore":"^6.0.2","it-all":"^1.0.4","it-buffer":"^0.1.2","it-drain":"^1.0.3","it-filter":"^1.0.1","it-first":"^1.0.4","it-handshake":"^2.0.0","it-length-prefixed":"^5.0.2","it-map":"^1.0.4","it-merge":"^1.0.0","it-pipe":"^1.1.0","it-take":"^1.0.0","libp2p-crypto":"^0.19.4","libp2p-interfaces":"^1.0.0","libp2p-utils":"^0.4.0","mafmt":"^10.0.0","merge-options":"^3.0.4","multiaddr":"^10.0.0","multiformats":"^9.0.0","multistream-select":"^2.0.0","mutable-proxy":"^1.0.0","node-forge":"^0.10.0","p-any":"^3.0.0","p-fifo":"^1.0.0","p-retry":"^4.4.0","p-settle":"^4.1.1","peer-id":"^0.15.0","private-ip":"^2.1.0","protobufjs":"^6.10.2","retimer":"^3.0.0","sanitize-filename":"^1.6.3","set-delayed-interval":"^1.0.0","streaming-iterables":"^6.0.0","timeout-abort-controller":"^1.1.1","uint8arrays":"^3.0.0","varint":"^6.0.0","wherearewe":"^1.0.0","xsalsa20":"^1.1.0"},"devDependencies":{"@chainsafe/libp2p-noise":"^4.0.0","@nodeutils/defaults-deep":"^1.1.0","@types/es6-promisify":"^6.0.0","@types/node":"^16.0.1","@types/node-forge":"^0.10.1","@types/varint":"^6.0.0","aegir":"^33.1.1","buffer":"^6.0.3","datastore-core":"^6.0.7","delay":"^5.0.0","interop-libp2p":"^0.4.0","into-stream":"^7.0.0","ipfs-http-client":"^52.0.2","it-concat":"^2.0.0","it-pair":"^1.0.0","it-pushable":"^1.4.0","libp2p":".","libp2p-bootstrap":"^0.13.0","libp2p-delegated-content-routing":"^0.11.0","libp2p-delegated-peer-routing":"^0.10.0","libp2p-floodsub":"^0.27.0","libp2p-gossipsub":"^0.11.0","libp2p-interfaces-compliance-tests":"^1.0.0","libp2p-kad-dht":"^0.24.2","libp2p-mdns":"^0.17.0","libp2p-mplex":"^0.10.1","libp2p-tcp":"^0.17.0","libp2p-webrtc-star":"^0.23.0","libp2p-websockets":"^0.16.0","nock":"^13.0.3","p-defer":"^3.0.0","p-times":"^3.0.0","p-wait-for":"^3.2.0","rimraf":"^3.0.2","sinon":"^11.1.1","util":"^0.12.3"},"contributors":["Vasco Santos ","David Dias ","Jacob Heun ","Alex Potsides ","Alan Shaw ","Cayman ","Pedro Teixeira ","Friedel Ziegelmayer ","Maciej Krüger ","Hugo Dias ","Chris Dostert ","dirkmc ","Volker Mische ","zeim839 <50573884+zeim839@users.noreply.github.com>","Richard Littauer ","a1300 ","Ryan Bell ","ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ ","Franck Royer ","Thomas Eizinger ","Giovanni T. Parra ","acolytec3 <17355484+acolytec3@users.noreply.github.com>","Elven ","Andrew Nesbitt ","Samlior ","Didrik Nordström ","RasmusErik Voel Jensen ","Robert Kiel ","Smite Chow ","Soeren ","Sönke Hahn ","TJKoury ","Tiago Alves ","XiaoZhang ","Yusef Napora ","Zane Starr ","ebinks ","Aditya Bose <13054902+adbose@users.noreply.github.com>","isan_rivkin ","mayerwin ","mcclure ","phillmac ","robertkiel ","shresthagrawal <34920931+shresthagrawal@users.noreply.github.com>","swedneck <40505480+swedneck@users.noreply.github.com>","greenSnot ","Aleksei ","Bernd Strehl ","Chris Bratlien ","Cindy Wu ","Daijiro Wachi ","Diogo Silva ","Dmitriy Ryajov ","Ethan Lam ","Fei Liu ","Felipe Martins ","Florian-Merle ","Francis Gulotta ","Guy Sviry <32539816+guysv@users.noreply.github.com>","Henrique Dias ","Irakli Gozalishvili ","Joel Gustafson ","John Rees ","João Santos ","Julien Bouquillon ","Kevin Kwok ","Kevin Lacker ","Lars Gierth ","Leask Wong ","Marcin Tojek ","Michael Burns <5170+mburns@users.noreply.github.com>","Miguel Mota ","Nuno Nogueira ","Philipp Muens "]}')}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var r=__webpack_module_cache__[e]={id:e,loaded:!1,exports:{}};return __webpack_modules__[e].call(r.exports,r,r.exports,__webpack_require__),r.loaded=!0,r.exports}__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var r in t)__webpack_require__.o(t,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var __webpack_exports__=__webpack_require__(63607)})(); \ No newline at end of file +(()=>{var __webpack_modules__={93619:(e,t,r)=>{"use strict";var n=r(34155);Object.defineProperty(t,"__esModule",{value:!0}),t.DUMP_SESSION_KEYS=t.NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG=t.NOISE_MSG_MAX_LENGTH_BYTES=void 0,t.NOISE_MSG_MAX_LENGTH_BYTES=65535,t.NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG=t.NOISE_MSG_MAX_LENGTH_BYTES-16,t.DUMP_SESSION_KEYS=n.env.DUMP_SESSION_KEYS},14510:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decryptStream=t.encryptStream=void 0;const n=r(48764),i=r(93619);t.encryptStream=function(e){return async function*(t){for await(const r of t){const t=n.Buffer.from(r.buffer,r.byteOffset,r.length);for(let r=0;rt.length&&(n=t.length);const o=e.encrypt(t.slice(r,n),e.session);yield o}}}},t.decryptStream=function(e){return async function*(t){for await(const r of t){const t=n.Buffer.from(r.buffer,r.byteOffset,r.length);for(let r=0;rt.length&&(n=t.length);const o=t.slice(r,n),{plaintext:s,valid:a}=await e.decrypt(o,e.session);if(!a)throw new Error("Failed to validate decrypted chunk");yield s}}}}},33477:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decode2=t.decode1=t.decode0=t.encode2=t.encode1=t.encode0=t.uint16BEDecode=t.uint16BEEncode=void 0;const n=r(48764);t.uint16BEEncode=(e,t,r)=>((t=t||n.Buffer.allocUnsafe(2)).writeUInt16BE(e,r),t),t.uint16BEEncode.bytes=2,t.uint16BEDecode=e=>{if(e.length<2)throw RangeError("Could not decode int16BE");return e.readUInt16BE(0)},t.uint16BEDecode.bytes=2,t.encode0=function(e){return n.Buffer.concat([e.ne,e.ciphertext])},t.encode1=function(e){return n.Buffer.concat([e.ne,e.ns,e.ciphertext])},t.encode2=function(e){return n.Buffer.concat([e.ns,e.ciphertext])},t.decode0=function(e){if(e.length<32)throw new Error("Cannot decode stage 0 MessageBuffer: length less than 32 bytes.");return{ne:e.slice(0,32),ciphertext:e.slice(32,e.length),ns:n.Buffer.alloc(0)}},t.decode1=function(e){if(e.length<80)throw new Error("Cannot decode stage 1 MessageBuffer: length less than 80 bytes.");return{ne:e.slice(0,32),ns:e.slice(32,80),ciphertext:e.slice(80,e.length)}},t.decode2=function(e){if(e.length<48)throw new Error("Cannot decode stage 2 MessageBuffer: length less than 48 bytes.");return{ne:n.Buffer.alloc(0),ns:e.slice(0,48),ciphertext:e.slice(48,e.length)}}},42692:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FailedIKError=void 0;class r extends Error{constructor(e,t){super(t),this.initialMsg=e,this.name="FailedIKhandshake"}}t.FailedIKError=r},59454:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IKHandshake=void 0;const n=r(4240),i=r(48764),o=r(33477),s=r(48338),a=r(42692),c=r(87123);t.IKHandshake=class{constructor(e,t,r,o,s,a,c,u){this.isInitiator=e,this.payload=i.Buffer.from(t),this.prologue=r,this.staticKeypair=o,this.connection=s,c&&(this.remotePeer=c),this.ik=null!=u?u:new n.IK,this.session=this.ik.initSession(this.isInitiator,this.prologue,this.staticKeypair,a),this.remoteEarlyData=i.Buffer.alloc(0)}async stage0(){if(c.logLocalStaticKeys(this.session.hs.s),c.logRemoteStaticKey(this.session.hs.rs),this.isInitiator){c.logger("IK Stage 0 - Initiator sending message...");const e=this.ik.sendMessage(this.session,this.payload);this.connection.writeLP(o.encode1(e)),c.logger("IK Stage 0 - Initiator sent message."),c.logLocalEphemeralKeys(this.session.hs.e)}else{c.logger("IK Stage 0 - Responder receiving message...");const e=await this.connection.readLP();try{const t=o.decode1(e.slice()),{plaintext:r,valid:n}=this.ik.recvMessage(this.session,t);if(!n)throw new Error("ik handshake stage 0 decryption validation fail");c.logger("IK Stage 0 - Responder got message, going to verify payload.");const i=await s.decodePayload(r);this.remotePeer=this.remotePeer||await s.getPeerIdFromPayload(i),await s.verifySignedPayload(this.session.hs.rs,i,this.remotePeer),this.setRemoteEarlyData(i.data),c.logger("IK Stage 0 - Responder successfully verified payload!"),c.logRemoteEphemeralKey(this.session.hs.re)}catch(t){const r=t;throw c.logger("Responder breaking up with IK handshake in stage 0."),new a.FailedIKError(e,`Error occurred while verifying initiator's signed payload: ${r.message}`)}}}async stage1(){if(this.isInitiator){c.logger("IK Stage 1 - Initiator receiving message...");const e=(await this.connection.readLP()).slice(),t=o.decode0(i.Buffer.from(e)),{plaintext:r,valid:n}=this.ik.recvMessage(this.session,t);c.logger("IK Stage 1 - Initiator got message, going to verify payload.");try{if(!n)throw new Error("ik stage 1 decryption validation fail");const e=await s.decodePayload(r);this.remotePeer=this.remotePeer||await s.getPeerIdFromPayload(e),await s.verifySignedPayload(t.ns.slice(0,32),e,this.remotePeer),this.setRemoteEarlyData(e.data),c.logger("IK Stage 1 - Initiator successfully verified payload!"),c.logRemoteEphemeralKey(this.session.hs.re)}catch(t){const r=t;throw c.logger("Initiator breaking up with IK handshake in stage 1."),new a.FailedIKError(e,`Error occurred while verifying responder's signed payload: ${r.message}`)}}else{c.logger("IK Stage 1 - Responder sending message...");const e=this.ik.sendMessage(this.session,this.payload);this.connection.writeLP(o.encode0(e)),c.logger("IK Stage 1 - Responder sent message..."),c.logLocalEphemeralKeys(this.session.hs.e)}c.logCipherState(this.session)}decrypt(e,t){const r=this.getCS(t,!1);return this.ik.decryptWithAd(r,i.Buffer.alloc(0),e)}encrypt(e,t){const r=this.getCS(t);return this.ik.encryptWithAd(r,i.Buffer.alloc(0),e)}getLocalEphemeralKeys(){if(!this.session.hs.e)throw new Error("Ephemeral keys do not exist.");return this.session.hs.e}getCS(e,t=!0){if(!e.cs1||!e.cs2)throw new Error("Handshake not completed properly, cipher state does not exist.");return this.isInitiator?t?e.cs1:e.cs2:t?e.cs2:e.cs1}setRemoteEarlyData(e){e&&(this.remoteEarlyData=i.Buffer.from(e.buffer,e.byteOffset,e.length))}}},37558:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XXFallbackHandshake=void 0;const n=r(48764),i=r(70461),o=r(48338),s=r(87123),a=r(33477);class c extends i.XXHandshake{constructor(e,t,r,n,i,o,s,a,c){super(e,t,r,n,i,s,c),a&&(this.ephemeralKeys=a),this.initialMsg=o}async propose(){if(this.isInitiator)this.xx.sendMessage(this.session,n.Buffer.alloc(0),this.ephemeralKeys),s.logger("XX Fallback Stage 0 - Initialized state as the first message was sent by initiator."),s.logLocalEphemeralKeys(this.session.hs.e);else{s.logger("XX Fallback Stage 0 - Responder decoding initial msg from IK.");const e=a.decode0(this.initialMsg),{valid:t}=this.xx.recvMessage(this.session,{ne:e.ne,ns:n.Buffer.alloc(0),ciphertext:n.Buffer.alloc(0)});if(!t)throw new Error("xx fallback stage 0 decryption validation fail");s.logger("XX Fallback Stage 0 - Responder used received message from IK."),s.logRemoteEphemeralKey(this.session.hs.re)}}async exchange(){if(this.isInitiator){const e=a.decode1(this.initialMsg),{plaintext:t,valid:r}=this.xx.recvMessage(this.session,e);if(!r)throw new Error("xx fallback stage 1 decryption validation fail");s.logger("XX Fallback Stage 1 - Initiator used received message from IK."),s.logRemoteEphemeralKey(this.session.hs.re),s.logRemoteStaticKey(this.session.hs.rs),s.logger("Initiator going to check remote's signature...");try{const e=await o.decodePayload(t);this.remotePeer=this.remotePeer||await o.getPeerIdFromPayload(e),await o.verifySignedPayload(this.session.hs.rs,e,this.remotePeer),this.setRemoteEarlyData(e.data)}catch(e){throw new Error(`Error occurred while verifying signed payload from responder: ${e.message}`)}s.logger("All good with the signature!")}else s.logger("XX Fallback Stage 1 - Responder start"),await super.exchange(),s.logger("XX Fallback Stage 1 - Responder end")}}t.XXFallbackHandshake=c},70461:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XXHandshake=void 0;const n=r(48764),i=r(64604),o=r(48338),s=r(87123),a=r(33477);t.XXHandshake=class{constructor(e,t,r,o,s,a,c){this.isInitiator=e,this.payload=t,this.prologue=r,this.staticKeypair=o,this.connection=s,a&&(this.remotePeer=a),this.xx=null!=c?c:new i.XX,this.session=this.xx.initSession(this.isInitiator,this.prologue,this.staticKeypair),this.remoteEarlyData=n.Buffer.alloc(0)}async propose(){if(s.logLocalStaticKeys(this.session.hs.s),this.isInitiator){s.logger("Stage 0 - Initiator starting to send first message.");const e=this.xx.sendMessage(this.session,n.Buffer.alloc(0));this.connection.writeLP(a.encode0(e)),s.logger("Stage 0 - Initiator finished sending first message."),s.logLocalEphemeralKeys(this.session.hs.e)}else{s.logger("Stage 0 - Responder waiting to receive first message...");const e=a.decode0((await this.connection.readLP()).slice()),{valid:t}=this.xx.recvMessage(this.session,e);if(!t)throw new Error("xx handshake stage 0 validation fail");s.logger("Stage 0 - Responder received first message."),s.logRemoteEphemeralKey(this.session.hs.re)}}async exchange(){if(this.isInitiator){s.logger("Stage 1 - Initiator waiting to receive first message from responder...");const e=a.decode1((await this.connection.readLP()).slice()),{plaintext:t,valid:r}=this.xx.recvMessage(this.session,e);if(!r)throw new Error("xx handshake stage 1 validation fail");s.logger("Stage 1 - Initiator received the message."),s.logRemoteEphemeralKey(this.session.hs.re),s.logRemoteStaticKey(this.session.hs.rs),s.logger("Initiator going to check remote's signature...");try{const r=await o.decodePayload(t);this.remotePeer=this.remotePeer||await o.getPeerIdFromPayload(r),this.remotePeer=await o.verifySignedPayload(e.ns,r,this.remotePeer),this.setRemoteEarlyData(r.data)}catch(e){throw new Error(`Error occurred while verifying signed payload: ${e.message}`)}s.logger("All good with the signature!")}else{s.logger("Stage 1 - Responder sending out first message with signed payload and static key.");const e=this.xx.sendMessage(this.session,this.payload);this.connection.writeLP(a.encode1(e)),s.logger("Stage 1 - Responder sent the second handshake message with signed payload."),s.logLocalEphemeralKeys(this.session.hs.e)}}async finish(){if(this.isInitiator){s.logger("Stage 2 - Initiator sending third handshake message.");const e=this.xx.sendMessage(this.session,this.payload);this.connection.writeLP(a.encode2(e)),s.logger("Stage 2 - Initiator sent message with signed payload.")}else{s.logger("Stage 2 - Responder waiting for third handshake message...");const e=a.decode2((await this.connection.readLP()).slice()),{plaintext:t,valid:r}=this.xx.recvMessage(this.session,e);if(!r)throw new Error("xx handshake stage 2 validation fail");s.logger("Stage 2 - Responder received the message, finished handshake.");try{const e=await o.decodePayload(t);this.remotePeer=this.remotePeer||await o.getPeerIdFromPayload(e),await o.verifySignedPayload(this.session.hs.rs,e,this.remotePeer),this.setRemoteEarlyData(e.data)}catch(e){throw new Error(`Error occurred while verifying signed payload: ${e.message}`)}}s.logCipherState(this.session)}encrypt(e,t){const r=this.getCS(t);return this.xx.encryptWithAd(r,n.Buffer.alloc(0),e)}decrypt(e,t){const r=this.getCS(t,!1);return this.xx.decryptWithAd(r,n.Buffer.alloc(0),e)}getRemoteStaticKey(){return this.session.hs.rs}getCS(e,t=!0){if(!e.cs1||!e.cs2)throw new Error("Handshake not completed properly, cipher state does not exist.");return this.isInitiator?t?e.cs1:e.cs2:t?e.cs2:e.cs1}setRemoteEarlyData(e){e&&(this.remoteEarlyData=n.Buffer.from(e.buffer,e.byteOffset,e.length))}}},88538:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.AbstractHandshake=t.MIN_NONCE=void 0;const s=r(48764),a=o(r(57664)),c=o(r(73294)),u=r(15501),f=r(48338),l=r(87123);t.MIN_NONCE=0,t.AbstractHandshake=class{encryptWithAd(e,t,r){const n=this.encrypt(e.k,e.n,t,r);return this.setNonce(e,this.incrementNonce(e.n)),n}decryptWithAd(e,t,r){const{plaintext:n,valid:i}=this.decrypt(e.k,e.n,t,r);return this.setNonce(e,this.incrementNonce(e.n)),{plaintext:n,valid:i}}hasKey(e){return!this.isEmptyKey(e.k)}setNonce(e,t){e.n=t}createEmptyKey(){return s.Buffer.alloc(32)}isEmptyKey(e){return this.createEmptyKey().equals(e)}incrementNonce(e){return e+1}nonceToBytes(e){const t=s.Buffer.alloc(12);return t.writeUInt32LE(e,4),t}encrypt(e,t,r,n){const i=this.nonceToBytes(t),o=new u.ChaCha20Poly1305(e).seal(i,n,r);return s.Buffer.from(o.buffer,o.byteOffset,o.length)}encryptAndHash(e,t){let r;return r=this.hasKey(e.cs)?this.encryptWithAd(e.cs,e.h,t):t,this.mixHash(e,r),r}decrypt(e,t,r,n){const i=this.nonceToBytes(t),o=new u.ChaCha20Poly1305(e).open(i,n,r);return o?{plaintext:s.Buffer.from(o.buffer,o.byteOffset,o.length),valid:!0}:{plaintext:s.Buffer.from(""),valid:!1}}decryptAndHash(e,t){let r,n=!0;return this.hasKey(e.cs)?({plaintext:r,valid:n}=this.decryptWithAd(e.cs,e.h,t)):r=t,this.mixHash(e,t),{plaintext:r,valid:n}}dh(e,t){try{const r=a.sharedKey(e,t),n=s.Buffer.from(r.buffer,r.byteOffset,r.length),i=s.Buffer.alloc(32);return n.copy(i),i}catch(e){return l.logger(e.message),s.Buffer.alloc(32)}}mixHash(e,t){e.h=this.getHash(e.h,t)}getHash(e,t){const r=c.hash(s.Buffer.from([...e,...t]));return s.Buffer.from(r.buffer,r.byteOffset,r.length)}mixKey(e,t){const[r,n]=f.getHkdf(e.ck,t);e.cs=this.initializeKey(n),e.ck=r}initializeKey(e){return{k:e,n:t.MIN_NONCE}}initializeSymmetric(e){const t=s.Buffer.from(e,"utf-8"),r=this.hashProtocolName(t),n=r,i=this.createEmptyKey();return{cs:this.initializeKey(i),ck:n,h:r}}hashProtocolName(e){if(e.length<=32){const t=s.Buffer.alloc(32);return e.copy(t),t}return this.getHash(e,s.Buffer.alloc(0))}split(e){const[t,r]=f.getHkdf(e.ck,s.Buffer.alloc(0));return{cs1:this.initializeKey(t),cs2:this.initializeKey(r)}}writeMessageRegular(e,t){const r=this.encryptWithAd(e,s.Buffer.alloc(0),t);return{ne:this.createEmptyKey(),ns:s.Buffer.alloc(0),ciphertext:r}}readMessageRegular(e,t){return this.decryptWithAd(e,s.Buffer.alloc(0),t.ciphertext)}}},4240:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IK=void 0;const n=r(48764),i=r(48338),o=r(88538);class s extends o.AbstractHandshake{initSession(e,t,r,n){const i=this.createEmptyKey();let o;return o=e?this.initializeInitiator(t,r,n,i):this.initializeResponder(t,r,n,i),{hs:o,i:e,mc:0}}sendMessage(e,t){let r;if(0===e.mc)r=this.writeMessageA(e.hs,t);else if(1===e.mc){const{messageBuffer:n,h:i,cs1:o,cs2:s}=this.writeMessageB(e.hs,t);r=n,e.h=i,e.cs1=o,e.cs2=s}else{if(!(e.mc>1))throw new Error("Session invalid.");if(e.i){if(!e.cs1)throw new Error("CS1 (cipher state) is not defined");r=this.writeMessageRegular(e.cs1,t)}else{if(!e.cs2)throw new Error("CS2 (cipher state) is not defined");r=this.writeMessageRegular(e.cs2,t)}}return e.mc++,r}recvMessage(e,t){let r=n.Buffer.alloc(0),i=!1;if(0===e.mc&&({plaintext:r,valid:i}=this.readMessageA(e.hs,t)),1===e.mc){const{plaintext:n,valid:o,h:s,cs1:a,cs2:c}=this.readMessageB(e.hs,t);r=n,i=o,e.h=s,e.cs1=a,e.cs2=c}return e.mc++,{plaintext:r,valid:i}}writeMessageA(e,t){e.e=i.generateKeypair();const r=e.e.publicKey;this.mixHash(e.ss,r),this.mixKey(e.ss,this.dh(e.e.privateKey,e.rs));const o=n.Buffer.from(e.s.publicKey),s=this.encryptAndHash(e.ss,o);return this.mixKey(e.ss,this.dh(e.s.privateKey,e.rs)),{ne:r,ns:s,ciphertext:this.encryptAndHash(e.ss,t)}}writeMessageB(e,t){e.e=i.generateKeypair();const r=e.e.publicKey;this.mixHash(e.ss,r),this.mixKey(e.ss,this.dh(e.e.privateKey,e.re)),this.mixKey(e.ss,this.dh(e.e.privateKey,e.rs));const n=this.encryptAndHash(e.ss,t),o={ne:r,ns:this.createEmptyKey(),ciphertext:n},{cs1:s,cs2:a}=this.split(e.ss);return{messageBuffer:o,cs1:s,cs2:a,h:e.ss.h}}readMessageA(e,t){i.isValidPublicKey(t.ne)&&(e.re=t.ne),this.mixHash(e.ss,e.re),this.mixKey(e.ss,this.dh(e.s.privateKey,e.re));const{plaintext:r,valid:n}=this.decryptAndHash(e.ss,t.ns);n&&32===r.length&&i.isValidPublicKey(r)&&(e.rs=r),this.mixKey(e.ss,this.dh(e.s.privateKey,e.rs));const{plaintext:o,valid:s}=this.decryptAndHash(e.ss,t.ciphertext);return{plaintext:o,valid:n&&s}}readMessageB(e,t){if(i.isValidPublicKey(t.ne)&&(e.re=t.ne),this.mixHash(e.ss,e.re),!e.e)throw new Error("Handshake state should contain ephemeral key by now.");this.mixKey(e.ss,this.dh(e.e.privateKey,e.re)),this.mixKey(e.ss,this.dh(e.s.privateKey,e.re));const{plaintext:r,valid:n}=this.decryptAndHash(e.ss,t.ciphertext),{cs1:o,cs2:s}=this.split(e.ss);return{h:e.ss.h,valid:n,plaintext:r,cs1:o,cs2:s}}initializeInitiator(e,t,r,i){const o=this.initializeSymmetric("Noise_IK_25519_ChaChaPoly_SHA256");return this.mixHash(o,e),this.mixHash(o,r),{ss:o,s:t,rs:r,re:n.Buffer.alloc(32),psk:i}}initializeResponder(e,t,r,i){const o=this.initializeSymmetric("Noise_IK_25519_ChaChaPoly_SHA256");return this.mixHash(o,e),this.mixHash(o,t.publicKey),{ss:o,s:t,rs:r,re:n.Buffer.alloc(32),psk:i}}}t.IK=s},64604:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XX=void 0;const n=r(48764),i=r(48338),o=r(88538);class s extends o.AbstractHandshake{initializeInitiator(e,t,r,i){const o=this.initializeSymmetric("Noise_XX_25519_ChaChaPoly_SHA256");return this.mixHash(o,e),{ss:o,s:t,rs:r,psk:i,re:n.Buffer.alloc(32)}}initializeResponder(e,t,r,i){const o=this.initializeSymmetric("Noise_XX_25519_ChaChaPoly_SHA256");return this.mixHash(o,e),{ss:o,s:t,rs:r,psk:i,re:n.Buffer.alloc(32)}}writeMessageA(e,t,r){const o=n.Buffer.alloc(0);e.e=void 0!==r?r:i.generateKeypair();const s=e.e.publicKey;return this.mixHash(e.ss,s),{ne:s,ns:o,ciphertext:this.encryptAndHash(e.ss,t)}}writeMessageB(e,t){e.e=i.generateKeypair();const r=e.e.publicKey;this.mixHash(e.ss,r),this.mixKey(e.ss,this.dh(e.e.privateKey,e.re));const o=n.Buffer.from(e.s.publicKey),s=this.encryptAndHash(e.ss,o);return this.mixKey(e.ss,this.dh(e.s.privateKey,e.re)),{ne:r,ns:s,ciphertext:this.encryptAndHash(e.ss,t)}}writeMessageC(e,t){const r=n.Buffer.from(e.s.publicKey),i=this.encryptAndHash(e.ss,r);this.mixKey(e.ss,this.dh(e.s.privateKey,e.re));const o=this.encryptAndHash(e.ss,t),s={ne:this.createEmptyKey(),ns:i,ciphertext:o},{cs1:a,cs2:c}=this.split(e.ss);return{h:e.ss.h,messageBuffer:s,cs1:a,cs2:c}}readMessageA(e,t){return i.isValidPublicKey(t.ne)&&(e.re=t.ne),this.mixHash(e.ss,e.re),this.decryptAndHash(e.ss,t.ciphertext)}readMessageB(e,t){if(i.isValidPublicKey(t.ne)&&(e.re=t.ne),this.mixHash(e.ss,e.re),!e.e)throw new Error("Handshake state `e` param is missing.");this.mixKey(e.ss,this.dh(e.e.privateKey,e.re));const{plaintext:r,valid:n}=this.decryptAndHash(e.ss,t.ns);n&&32===r.length&&i.isValidPublicKey(r)&&(e.rs=r),this.mixKey(e.ss,this.dh(e.e.privateKey,e.rs));const{plaintext:o,valid:s}=this.decryptAndHash(e.ss,t.ciphertext);return{plaintext:o,valid:n&&s}}readMessageC(e,t){const{plaintext:r,valid:n}=this.decryptAndHash(e.ss,t.ns);if(n&&32===r.length&&i.isValidPublicKey(r)&&(e.rs=r),!e.e)throw new Error("Handshake state `e` param is missing.");this.mixKey(e.ss,this.dh(e.e.privateKey,e.rs));const{plaintext:o,valid:s}=this.decryptAndHash(e.ss,t.ciphertext),{cs1:a,cs2:c}=this.split(e.ss);return{h:e.ss.h,plaintext:o,valid:n&&s,cs1:a,cs2:c}}initSession(e,t,r){const i=this.createEmptyKey(),o=n.Buffer.alloc(32);let s;return s=e?this.initializeInitiator(t,r,o,i):this.initializeResponder(t,r,o,i),{hs:s,i:e,mc:0}}sendMessage(e,t,r){let n;if(0===e.mc)n=this.writeMessageA(e.hs,t,r);else if(1===e.mc)n=this.writeMessageB(e.hs,t);else if(2===e.mc){const{h:r,messageBuffer:i,cs1:o,cs2:s}=this.writeMessageC(e.hs,t);n=i,e.h=r,e.cs1=o,e.cs2=s}else{if(!(e.mc>2))throw new Error("Session invalid.");if(e.i){if(!e.cs1)throw new Error("CS1 (cipher state) is not defined");n=this.writeMessageRegular(e.cs1,t)}else{if(!e.cs2)throw new Error("CS2 (cipher state) is not defined");n=this.writeMessageRegular(e.cs2,t)}}return e.mc++,n}recvMessage(e,t){let r=n.Buffer.alloc(0),i=!1;if(0===e.mc)({plaintext:r,valid:i}=this.readMessageA(e.hs,t));else if(1===e.mc)({plaintext:r,valid:i}=this.readMessageB(e.hs,t));else if(2===e.mc){const{h:n,plaintext:o,valid:s,cs1:a,cs2:c}=this.readMessageC(e.hs,t);r=o,i=s,e.h=n,e.cs1=a,e.cs2=c}return e.mc++,{plaintext:r,valid:i}}}t.XX=s},42641:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.NOISE=void 0;const o=r(88895);i(r(88895),t),t.NOISE=new o.Noise},23786:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.KeyCache=void 0;const r=new class{constructor(){this.storage=new Map}store(e,t){this.storage.set(e.id,t)}load(e){var t;return e&&null!==(t=this.storage.get(e.id))&&void 0!==t?t:null}resetStorage(){this.storage.clear()}};t.KeyCache=r},87123:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.logCipherState=t.logRemoteEphemeralKey=t.logRemoteStaticKey=t.logLocalEphemeralKeys=t.logLocalStaticKeys=t.logger=void 0;const i=n(r(11227)),o=r(93619);let s;t.logger=i.default("libp2p:noise"),s=o.DUMP_SESSION_KEYS?t.logger:()=>{},t.logLocalStaticKeys=function(e){s(`LOCAL_STATIC_PUBLIC_KEY ${e.publicKey.toString("hex")}`),s(`LOCAL_STATIC_PRIVATE_KEY ${e.privateKey.toString("hex")}`)},t.logLocalEphemeralKeys=function(e){e?(s(`LOCAL_PUBLIC_EPHEMERAL_KEY ${e.publicKey.toString("hex")}`),s(`LOCAL_PRIVATE_EPHEMERAL_KEY ${e.privateKey.toString("hex")}`)):s("Missing local ephemeral keys.")},t.logRemoteStaticKey=function(e){s(`REMOTE_STATIC_PUBLIC_KEY ${e.toString("hex")}`)},t.logRemoteEphemeralKey=function(e){s(`REMOTE_EPHEMERAL_PUBLIC_KEY ${e.toString("hex")}`)},t.logCipherState=function(e){e.cs1&&e.cs2?(s(`CIPHER_STATE_1 ${e.cs1.n} ${e.cs1.k.toString("hex")}`),s(`CIPHER_STATE_2 ${e.cs2.n} ${e.cs2.k.toString("hex")}`)):s("Missing cipher state.")}},88895:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Noise=void 0;const a=o(r(57664)),c=r(48764),u=s(r(11712)),f=s(r(63184)),l=s(r(96653)),h=s(r(60618)),d=r(47845),p=r(70461),y=r(59454),g=r(37558),b=r(48338),m=r(33477),v=r(14510),w=r(23786),E=r(87123),_=r(93619);t.Noise=class{constructor(e,t){if(this.protocol="/noise",this.prologue=c.Buffer.alloc(0),this.earlyData=null!=t?t:c.Buffer.alloc(0),this.useNoisePipes=!1,e){const t=a.generateKeyPairFromSeed(e);this.staticKeys={privateKey:c.Buffer.from(t.secretKey.buffer,t.secretKey.byteOffset,t.secretKey.length),publicKey:c.Buffer.from(t.publicKey.buffer,t.publicKey.byteOffset,t.publicKey.length)}}else this.staticKeys=b.generateKeypair()}async secureOutbound(e,t,r){const n=u.default(t,{lengthEncoder:m.uint16BEEncode,lengthDecoder:m.uint16BEDecode,maxDataLength:_.NOISE_MSG_MAX_LENGTH_BYTES}),i=await this.performHandshake({connection:n,isInitiator:!0,localPeer:e,remotePeer:r});return{conn:await this.createSecureConnection(n,i),remoteEarlyData:i.remoteEarlyData,remotePeer:i.remotePeer}}async secureInbound(e,t,r){const n=u.default(t,{lengthEncoder:m.uint16BEEncode,lengthDecoder:m.uint16BEDecode,maxDataLength:_.NOISE_MSG_MAX_LENGTH_BYTES}),i=await this.performHandshake({connection:n,isInitiator:!1,localPeer:e,remotePeer:r});return{conn:await this.createSecureConnection(n,i),remoteEarlyData:i.remoteEarlyData,remotePeer:i.remotePeer}}async performHandshake(e){var t;const r=await b.getPayload(e.localPeer,this.staticKeys.publicKey,this.earlyData);let n=this.useNoisePipes;if(e.isInitiator&&null===w.KeyCache.load(e.remotePeer)&&(n=!1),!n)return await this.performXXHandshake(e,r);{const{remotePeer:n,connection:i,isInitiator:o}=e,s=new y.IKHandshake(o,r,this.prologue,this.staticKeys,i,null!==(t=w.KeyCache.load(e.remotePeer))&&void 0!==t?t:c.Buffer.alloc(32),n);try{return await this.performIKHandshake(s)}catch(t){let n;return e.isInitiator&&(n=s.getLocalEphemeralKeys()),await this.performXXFallbackHandshake(e,r,t.initialMsg,n)}}}async performXXFallbackHandshake(e,t,r,n){const{isInitiator:i,remotePeer:o,connection:s}=e,a=new g.XXFallbackHandshake(i,t,this.prologue,this.staticKeys,s,r,o,n);try{await a.propose(),await a.exchange(),await a.finish()}catch(e){throw E.logger(e),new Error(`Error occurred during XX Fallback handshake: ${e.message}`)}return a}async performXXHandshake(e,t){const{isInitiator:r,remotePeer:n,connection:i}=e,o=new p.XXHandshake(r,t,this.prologue,this.staticKeys,i,n);try{await o.propose(),await o.exchange(),await o.finish(),this.useNoisePipes&&o.remotePeer&&w.KeyCache.store(o.remotePeer,o.getRemoteStaticKey())}catch(e){throw new Error(`Error occurred during XX handshake: ${e.message}`)}return o}async performIKHandshake(e){return await e.stage0(),await e.stage1(),e}async createSecureConnection(e,t){const[r,n]=f.default(),i=e.unwrap();return await h.default(r,l.default,v.encryptStream(t),d.encode({lengthEncoder:m.uint16BEEncode}),i,d.decode({lengthDecoder:m.uint16BEDecode}),l.default,v.decryptStream(t),r),n}}},47144:function(e,t,r){"use strict";var n,i,o;i=[r(62100)],void 0===(o="function"==typeof(n=function(e){var t,r=e.Reader,n=e.Writer,i=e.util,o=e.roots["libp2p-noise"]||(e.roots["libp2p-noise"]={});return o.pb=((t={}).NoiseHandshakePayload=function(){function t(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:i.identityKey=e.bytes();break;case 2:i.identitySig=e.bytes();break;case 3:i.data=e.bytes();break;default:e.skipType(7&s)}}return i},t.decodeDelimited=function(e){return e instanceof r||(e=new r(e)),this.decode(e,e.uint32())},t.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.identityKey&&e.hasOwnProperty("identityKey")&&!(e.identityKey&&"number"==typeof e.identityKey.length||i.isString(e.identityKey))?"identityKey: buffer expected":null!=e.identitySig&&e.hasOwnProperty("identitySig")&&!(e.identitySig&&"number"==typeof e.identitySig.length||i.isString(e.identitySig))?"identitySig: buffer expected":null!=e.data&&e.hasOwnProperty("data")&&!(e.data&&"number"==typeof e.data.length||i.isString(e.data))?"data: buffer expected":null},t.fromObject=function(e){if(e instanceof o.pb.NoiseHandshakePayload)return e;var t=new o.pb.NoiseHandshakePayload;return null!=e.identityKey&&("string"==typeof e.identityKey?i.base64.decode(e.identityKey,t.identityKey=i.newBuffer(i.base64.length(e.identityKey)),0):e.identityKey.length&&(t.identityKey=e.identityKey)),null!=e.identitySig&&("string"==typeof e.identitySig?i.base64.decode(e.identitySig,t.identitySig=i.newBuffer(i.base64.length(e.identitySig)),0):e.identitySig.length&&(t.identitySig=e.identitySig)),null!=e.data&&("string"==typeof e.data?i.base64.decode(e.data,t.data=i.newBuffer(i.base64.length(e.data)),0):e.data.length&&(t.data=e.data)),t},t.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(t.bytes===String?r.identityKey="":(r.identityKey=[],t.bytes!==Array&&(r.identityKey=i.newBuffer(r.identityKey))),t.bytes===String?r.identitySig="":(r.identitySig=[],t.bytes!==Array&&(r.identitySig=i.newBuffer(r.identitySig))),t.bytes===String?r.data="":(r.data=[],t.bytes!==Array&&(r.data=i.newBuffer(r.data)))),null!=e.identityKey&&e.hasOwnProperty("identityKey")&&(r.identityKey=t.bytes===String?i.base64.encode(e.identityKey,0,e.identityKey.length):t.bytes===Array?Array.prototype.slice.call(e.identityKey):e.identityKey),null!=e.identitySig&&e.hasOwnProperty("identitySig")&&(r.identitySig=t.bytes===String?i.base64.encode(e.identitySig,0,e.identitySig.length):t.bytes===Array?Array.prototype.slice.call(e.identitySig):e.identitySig),null!=e.data&&e.hasOwnProperty("data")&&(r.data=t.bytes===String?i.base64.encode(e.data,0,e.data.length):t.bytes===Array?Array.prototype.slice.call(e.data):e.data),r},t.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},t}(),t),o})?n.apply(t,i):n)||(e.exports=o)},48338:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.isValidPublicKey=t.getHkdf=t.verifySignedPayload=t.getHandshakePayload=t.decodePayload=t.getPeerIdFromPayload=t.signPayload=t.createHandshakePayload=t.getPayload=t.generateKeypair=void 0;const a=r(512),c=r(73294),u=o(r(57664)),f=r(48764),l=s(r(88785)),h=r(68884),d=r(47144),p=r(19588),y=d.pb.NoiseHandshakePayload;function g(e,t,r){const n=y.create({identityKey:f.Buffer.from(e),identitySig:t,data:null!=r?r:null});return f.Buffer.from(y.encode(n).finish())}async function b(e,t){return f.Buffer.from(await e.privKey.sign(t))}function m(e){return f.Buffer.concat([f.Buffer.from("noise-libp2p-static-key:"),e])}t.generateKeypair=function(){const e=u.generateKeyPair();return{publicKey:f.Buffer.from(e.publicKey.buffer,e.publicKey.byteOffset,e.publicKey.length),privateKey:f.Buffer.from(e.secretKey.buffer,e.secretKey.byteOffset,e.secretKey.length)}},t.getPayload=async function(e,t,r){const n=await b(e,m(t)),i=null!=r?r:f.Buffer.alloc(0);return g(e.marshalPubKey(),n,i)},t.createHandshakePayload=g,t.signPayload=b,t.getPeerIdFromPayload=async function(e){return await l.default.createFromPubKey(f.Buffer.from(e.identityKey))},t.decodePayload=function(e){return y.toObject(y.decode(f.Buffer.from(e)))},t.getHandshakePayload=m,t.verifySignedPayload=async function(e,t,r){const n=f.Buffer.from(t.identityKey);if(!await async function(e,t){const r=await l.default.createFromPubKey(t);return p.equals(r.id,e)}(r.id,n))throw new Error("Peer ID doesn't match libp2p public key.");const i=m(e),o=h.keys.unmarshalPublicKey(n);if(!t.identitySig||!o.verify(i,f.Buffer.from(t.identitySig)))throw new Error("Static key doesn't match to peer that signed payload!");return await l.default.createFromPubKey(n)},t.getHkdf=function(e,t){const r=new a.HKDF(c.SHA256,t,e).expand(96),n=f.Buffer.from(r.buffer,r.byteOffset,r.length);return[n.slice(0,32),n.slice(32,64),n.slice(64,96)]},t.isValidPublicKey=function(e){return!!f.Buffer.isBuffer(e)&&32===e.length}},69345:(e,t,r)=>{"use strict";const{Buffer:n}=r(48764),i=r(9668),o=r(99842),s=4194304,a=n.alloc(0),c="readLength",u="readData",f={[c]:(e,t,r,n)=>{let o;t=t.append(e);try{o=n.lengthDecoder(t)}catch(e){if(t.length>n.maxLengthLength)throw Object.assign(e,{message:"message length too long",code:"ERR_MSG_LENGTH_TOO_LONG"});if(e instanceof RangeError)return{mode:c,buffer:t,chunk:void 0,state:void 0,data:void 0};throw e}if(o>n.maxDataLength)throw Object.assign(new Error("message data too long"),{code:"ERR_MSG_DATA_TOO_LONG"});return e=t.shallowSlice(n.lengthDecoder.bytes),t=new i,n.onLength&&n.onLength(o),o<=0?(n.onData&&n.onData(a),{mode:c,chunk:e,buffer:t,data:a}):{mode:u,chunk:e,buffer:t,state:{dataLength:o},data:void 0}},[u]:(e,t,r,n)=>{if(t=t.append(e),!r)throw new Error("state is required");if(t.lengtho?t.shallowSlice(o):void 0;return t=new i,n.onData&&n.onData(s),{mode:c,chunk:a,buffer:t,state:void 0,data:s}}};function l(e){const t={lengthDecoder:(e=e||{}).lengthDecoder||o,maxLengthLength:e.maxLengthLength||8,maxDataLength:e.maxDataLength||s,onLength:e.onLength,onData:e.onData};return async function*(e){let r,n=new i,o=c;for await(const i of e){let e=i;for(;e;){const i=f[o](e,n,r,t);o=i.mode,e=i.chunk,n=i.buffer,r=i.state,i.data&&(yield i.data)}}if(n.length)throw Object.assign(new Error("unexpected end of input"),{code:"ERR_UNEXPECTED_EOF"})}}l.fromReader=(e,t)=>{let r=1;const n={[Symbol.asyncIterator](){return this},next:async()=>{try{return await e.next(r)}catch(e){if("ERR_UNDER_READ"===e.code)return{done:!0,value:null};throw e}finally{r=1}}};return l({...t||{},onLength:e=>{r=e}})(n)},e.exports=l,e.exports.MAX_LENGTH_LENGTH=8,e.exports.MAX_DATA_LENGTH=s},22997:(e,t,r)=>{"use strict";const{Buffer:n}=r(48764),i=r(9668),o=r(96175);function s(e){e=e||{};const t=Math.max(e.poolSize||10240,e.minPoolSize||8),r=e.lengthEncoder||o;return async function*(e){let o=n.alloc(t),s=0;for await(const a of e){r(a.length,o,s);const e=o.slice(s,s+r.bytes);s+=r.bytes,o.length-s<8&&(o=n.alloc(t),s=0),yield(new i).append(e).append(a)}}}s.single=(e,t)=>{const r=(t=t||{}).lengthEncoder||o;return new i([r(e.length),e.slice()])},e.exports=s,e.exports.MIN_POOL_SIZE=8,e.exports.DEFAULT_POOL_SIZE=10240},47845:(e,t,r)=>{"use strict";t.encode=r(22997),t.decode=r(69345),t.varintEncode=r(96175),t.varintDecode=r(99842),t.int32BEEncode=r(95839),t.int32BEDecode=r(33080)},33080:e=>{"use strict";const t=e=>{if(e.length<4)throw RangeError("Could not decode int32BE");return e.readInt32BE(0)};t.bytes=4,e.exports=t},95839:(e,t,r)=>{"use strict";const{Buffer:n}=r(48764),i=(e,t,r)=>((t=t||n.allocUnsafe(4)).writeInt32BE(e,r),t);i.bytes=4,e.exports=i},99842:(e,t,r)=>{"use strict";const n=r(88256),{Buffer:i}=r(48764),o=e=>{const t=n.decode(i.isBuffer(e)?e:(r=e,new Proxy({},{get:(e,t)=>"l"===t[0]?r[t]:r.get(parseInt(t))})));var r;return o.bytes=n.decode.bytes,t};e.exports=o},96175:(e,t,r)=>{"use strict";const n=r(88256),{Buffer:i}=r(48764),o=(e,t,r)=>{const s=n.encode(e,t,r);return o.bytes=n.encode.bytes,t||i.from(s)};e.exports=o},77715:(e,t,r)=>{"use strict";const n=r(32114),i={16:"aes-128-ctr",32:"aes-256-ctr"};e.exports=function(e){const t=i[e.length];if(!t){const t=Object.entries(i).map((([e,t])=>`${e} (${t})`)).join(" / ");throw n(new Error(`Invalid key length ${e.length} bytes. Must be ${t}`),"ERR_INVALID_KEY_LENGTH")}return t}},60439:(e,t,r)=>{"use strict";r(8925);const n=r(3832),{toString:i}=r(92263),{fromString:o}=r(52217);e.exports={createCipheriv:(e,t,r)=>{const s=n.cipher.createCipher("AES-CTR",i(t,"ascii"));return s.start({iv:i(r,"ascii")}),{update:e=>(s.update(n.util.createBuffer(i(e,"ascii"))),o(s.output.getBytes(),"ascii"))}},createDecipheriv:(e,t,r)=>{const s=n.cipher.createDecipher("AES-CTR",i(t,"ascii"));return s.start({iv:i(r,"ascii")}),{update:e=>(s.update(n.util.createBuffer(i(e,"ascii"))),o(s.output.getBytes(),"ascii"))}}}},60501:(e,t,r)=>{"use strict";const n=r(60439),i=r(77715);t.create=async function(e,t){const r=i(e),o=n.createCipheriv(r,e,t),s=n.createDecipheriv(r,e,t);return{encrypt:async e=>o.update(e),decrypt:async e=>s.update(e)}}},86322:(e,t,r)=>{"use strict";const{concat:n}=r(20605),{fromString:i}=r(52217),o=r(59701);e.exports={create:function({algorithm:e="AES-GCM",nonceLength:t=12,keyLength:r=16,digest:s="SHA-256",saltLength:a=16,iterations:c=32767}={}){const u=o.get();return r*=8,{encrypt:async function(o,f){const l=u.getRandomValues(new Uint8Array(a)),h=u.getRandomValues(new Uint8Array(t)),d={name:e,iv:h},p={name:"PBKDF2",salt:l,iterations:c,hash:{name:s}},y=await u.subtle.importKey("raw",i(f),{name:"PBKDF2"},!1,["deriveKey","deriveBits"]),g=await u.subtle.deriveKey(p,y,{name:e,length:r},!0,["encrypt"]),b=await u.subtle.encrypt(d,g,o);return n([l,d.iv,new Uint8Array(b)])},decrypt:async function(n,o){const f=n.slice(0,a),l=n.slice(a,a+t),h=n.slice(a+t),d={name:e,iv:l},p={name:"PBKDF2",salt:f,iterations:c,hash:{name:s}},y=await u.subtle.importKey("raw",i(o),{name:"PBKDF2"},!1,["deriveKey","deriveBits"]),g=await u.subtle.deriveKey(p,y,{name:e,length:r},!0,["decrypt"]),b=await u.subtle.decrypt(d,g,h);return new Uint8Array(b)}}}}},91500:(e,t,r)=>{"use strict";const n=r(59701),i=r(87193),o={SHA1:"SHA-1",SHA256:"SHA-256",SHA512:"SHA-512"};t.create=async function(e,t){const r=o[e],s=await n.get().subtle.importKey("raw",t,{name:"HMAC",hash:{name:r}},!1,["sign"]);return{digest:async e=>(async(e,t)=>{const r=await n.get().subtle.sign({name:"HMAC"},e,t);return new Uint8Array(r,r.byteOffset,r.byteLength)})(s,e),length:i[e]}}},87193:e=>{"use strict";e.exports={SHA1:20,SHA256:32,SHA512:64}},68884:(e,t,r)=>{"use strict";const n=r(91500),i=r(60501),o=r(49431);t.aes=i,t.hmac=n,t.keys=o,t.randomBytes=r(18633),t.pbkdf2=r(25113)},76164:(e,t,r)=>{"use strict";const n=r(32114),i=r(59701),{base64urlToBuffer:o}=r(27944),s=r(1098),{toString:a}=r(92263),{concat:c}=r(20605),{equals:u}=r(19588),f={"P-256":256,"P-384":384,"P-521":521};t.generateEphmeralKeyPair=async function(e){s(Object.keys(f),e);const t=await i.get().subtle.generateKey({name:"ECDH",namedCurve:e},!0,["deriveBits"]);return{key:h(await i.get().subtle.exportKey("jwk",t.publicKey)),genSharedKey:async(r,n)=>{let o;o=n?await i.get().subtle.importKey("jwk",p(e,n),{name:"ECDH",namedCurve:e},!1,["deriveBits"]):t.privateKey;const s=[await i.get().subtle.importKey("jwk",d(e,r),{name:"ECDH",namedCurve:e},!1,[]),o],a=await i.get().subtle.deriveBits({name:"ECDH",namedCurve:e,public:s[0]},s[1],f[e]);return new Uint8Array(a,a.byteOffset,a.byteLength)}}};const l={"P-256":32,"P-384":48,"P-521":66};function h(e){const t=l[e.crv];return c([Uint8Array.from([4]),o(e.x,t),o(e.y,t)],1+2*t)}function d(e,t){const r=l[e];if(u(!t.slice(0,1),Uint8Array.from([4])))throw n(new Error("Cannot unmarshal public key - invalid key format"),"ERR_INVALID_KEY_FORMAT");return{kty:"EC",crv:e,x:a(t.slice(1,r+1),"base64url"),y:a(t.slice(1+r),"base64url"),ext:!0}}const p=(e,t)=>({...d(e,t.public),d:a(t.private,"base64url")})},15676:(e,t,r)=>{"use strict";const n=r(32114),{equals:i}=r(19588),{sha256:o}=r(56155),{base58btc:s}=r(99086),{identity:a}=r(78103),c=r(82060),u=r(32327),f=r(92352);class l{constructor(e){this._key=d(e,c.publicKeyLength)}async verify(e,t){return c.hashAndVerify(this._key,t,e)}marshal(){return this._key}get bytes(){return u.PublicKey.encode({Type:u.KeyType.Ed25519,Data:this.marshal()}).finish()}equals(e){return i(this.bytes,e.bytes)}async hash(){const{bytes:e}=await o.digest(this.bytes);return e}}class h{constructor(e,t){this._key=d(e,c.privateKeyLength),this._publicKey=d(t,c.publicKeyLength)}async sign(e){return c.hashAndSign(this._key,e)}get public(){return new l(this._publicKey)}marshal(){return this._key}get bytes(){return u.PrivateKey.encode({Type:u.KeyType.Ed25519,Data:this.marshal()}).finish()}equals(e){return i(this.bytes,e.bytes)}async hash(){const{bytes:e}=await o.digest(this.bytes);return e}async id(){const e=await a.digest(this.public.bytes);return s.encode(e.bytes).substring(1)}async export(e,t="libp2p-key"){if("libp2p-key"===t)return f.export(this.bytes,e);throw n(new Error(`export format '${t}' is not supported`),"ERR_INVALID_EXPORT_FORMAT")}}function d(e,t){if((e=Uint8Array.from(e||[])).length!==t)throw n(new Error(`Key must be a Uint8Array of length ${t}, got ${e.length}`),"ERR_INVALID_KEY_TYPE");return e}e.exports={Ed25519PublicKey:l,Ed25519PrivateKey:h,unmarshalEd25519PrivateKey:function(e){if(e.length>c.privateKeyLength){const t=(e=d(e,c.privateKeyLength+c.publicKeyLength)).slice(0,c.privateKeyLength),r=e.slice(c.privateKeyLength,e.length);return new h(t,r)}const t=(e=d(e,c.privateKeyLength)).slice(0,c.privateKeyLength),r=e.slice(c.publicKeyLength);return new h(t,r)},unmarshalEd25519PublicKey:function(e){return e=d(e,c.publicKeyLength),new l(e)},generateKeyPair:async function(){const{privateKey:e,publicKey:t}=await c.generateKey();return new h(e,t)},generateKeyPairFromSeed:async function(e){const{privateKey:t,publicKey:r}=await c.generateKeyFromSeed(e);return new h(t,r)}}},82060:(e,t,r)=>{"use strict";r(80069);const n=r(3832);t.publicKeyLength=n.pki.ed25519.constants.PUBLIC_KEY_BYTE_LENGTH,t.privateKeyLength=n.pki.ed25519.constants.PRIVATE_KEY_BYTE_LENGTH,t.generateKey=async function(){return n.pki.ed25519.generateKeyPair()},t.generateKeyFromSeed=async function(e){return n.pki.ed25519.generateKeyPair({seed:e})},t.hashAndSign=async function(e,t){return n.pki.ed25519.sign({message:t,privateKey:e})},t.hashAndVerify=async function(e,t,r){return n.pki.ed25519.verify({signature:t,message:r,publicKey:e})}},42508:(e,t,r)=>{"use strict";const n=r(76164);e.exports=async e=>n.generateEphmeralKeyPair(e)},92352:(e,t,r)=>{"use strict";const{base64:n}=r(9885),i=r(86322);e.exports={export:async function(e,t){const r=i.create(),o=await r.encrypt(e,t);return n.encode(o)}}},18568:(e,t,r)=>{"use strict";const{base64:n}=r(9885),i=r(86322);e.exports={import:async function(e,t){const r=n.decode(e),o=i.create();return await o.decrypt(r,t)}}},49431:(e,t,r)=>{"use strict";const n=r(32327);r(3068),r(97450);const i=r(3832),o=r(32114),{fromString:s}=r(52217),a=r(18568),c={rsa:r(66406),ed25519:r(15676),secp256k1:r(47233)(n,r(18633))},u="secp256k1 support requires libp2p-crypto-secp256k1 package",f="ERR_MISSING_PACKAGE";function l(e){const t=c[e.toLowerCase()];if(!t){const t=Object.keys(c).join(" / ");throw o(new Error(`invalid or unsupported key type ${e}. Must be ${t}`),"ERR_UNSUPPORTED_KEY_TYPE")}return t}const h=async e=>{const t=n.PrivateKey.decode(e),r=t.Data;switch(t.Type){case n.KeyType.RSA:return c.rsa.unmarshalRsaPrivateKey(r);case n.KeyType.Ed25519:return c.ed25519.unmarshalEd25519PrivateKey(r);case n.KeyType.Secp256k1:if(c.secp256k1)return c.secp256k1.unmarshalSecp256k1PrivateKey(r);throw o(new Error(u),f);default:l(t.Type)}};e.exports={supportedKeys:c,keysPBM:n,keyStretcher:r(94036),generateEphemeralKeyPair:r(42508),generateKeyPair:async(e,t)=>l(e).generateKeyPair(t),generateKeyPairFromSeed:async(e,t,r)=>{const n=l(e);if("ed25519"!==e.toLowerCase())throw o(new Error("Seed key derivation is unimplemented for RSA or secp256k1"),"ERR_UNSUPPORTED_KEY_DERIVATION_TYPE");return n.generateKeyPairFromSeed(t,r)},unmarshalPublicKey:e=>{const t=n.PublicKey.decode(e),r=t.Data;switch(t.Type){case n.KeyType.RSA:return c.rsa.unmarshalRsaPublicKey(r);case n.KeyType.Ed25519:return c.ed25519.unmarshalEd25519PublicKey(r);case n.KeyType.Secp256k1:if(c.secp256k1)return c.secp256k1.unmarshalSecp256k1PublicKey(r);throw o(new Error(u),f);default:l(t.Type)}},marshalPublicKey:(e,t)=>(l(t=(t||"rsa").toLowerCase()),e.bytes),unmarshalPrivateKey:h,marshalPrivateKey:(e,t)=>(l(t=(t||"rsa").toLowerCase()),e.bytes),import:async(e,t)=>{try{const r=await a.import(e,t);return h(r)}catch(e){}const r=i.pki.decryptRsaPrivateKey(e,t);if(null===r)throw o(new Error("Cannot read the key, most likely the password is wrong or not a RSA key"),"ERR_CANNOT_DECRYPT_PEM");let n=i.asn1.toDer(i.pki.privateKeyToAsn1(r));return n=s(n.getBytes(),"ascii"),c.rsa.unmarshalRsaPrivateKey(n)}}},55333:(e,t,r)=>{"use strict";r(28095);const n=r(3832),{base64urlToBigInteger:i}=r(27944);function o(e,t){return t.map((t=>i(e[t])))}e.exports={jwk2pub:function(e){return n.pki.setRsaPublicKey(...o(e,["n","e"]))},jwk2priv:function(e){return n.pki.setRsaPrivateKey(...o(e,["n","e","d","p","q","dp","dq","qi"]))}}},94036:(e,t,r)=>{"use strict";const n=r(32114),{concat:i}=r(20605),{fromString:o}=r(52217),s=r(91500),a={"AES-128":{ivSize:16,keySize:16},"AES-256":{ivSize:16,keySize:32},Blowfish:{ivSize:8,cipherKeySize:32}};e.exports=async(e,t,r)=>{const c=a[e];if(!c){const t=Object.keys(a).join(" / ");throw n(new Error(`unknown cipher type '${e}'. Must be ${t}`),"ERR_INVALID_CIPHER_TYPE")}if(!t)throw n(new Error("missing hash type"),"ERR_MISSING_HASH_TYPE");const u=c.keySize,f=c.ivSize,l=o("key expansion"),h=2*(f+u+20),d=await s.create(t,r);let p=await d.digest(l);const y=[];let g=0;for(;gh&&(t=h-g),y.push(e),g+=t,p=await d.digest(p)}const b=h/2,m=i(y),v=m.slice(0,b),w=m.slice(b,h),E=e=>({iv:e.slice(0,f),cipherKey:e.slice(f,f+u),macKey:e.slice(f+u)});return{k1:E(v),k2:E(w)}}},32327:(e,t,r)=>{"use strict";var n,i,o=r(62100),s=o.Reader,a=o.Writer,c=o.util,u=o.roots["libp2p-crypto-keys"]||(o.roots["libp2p-crypto-keys"]={});u.KeyType=(n={},(i=Object.create(n))[n[0]="RSA"]=0,i[n[1]="Ed25519"]=1,i[n[2]="Secp256k1"]=2,i),u.PublicKey=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.Type=e.int32();break;case 2:n.Data=e.bytes();break;default:e.skipType(7&i)}}if(!n.hasOwnProperty("Type"))throw c.ProtocolError("missing required 'Type'",{instance:n});if(!n.hasOwnProperty("Data"))throw c.ProtocolError("missing required 'Data'",{instance:n});return n},e.fromObject=function(e){if(e instanceof u.PublicKey)return e;var t=new u.PublicKey;switch(e.Type){case"RSA":case 0:t.Type=0;break;case"Ed25519":case 1:t.Type=1;break;case"Secp256k1":case 2:t.Type=2}return null!=e.Data&&("string"==typeof e.Data?c.base64.decode(e.Data,t.Data=c.newBuffer(c.base64.length(e.Data)),0):e.Data.length&&(t.Data=e.Data)),t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(r.Type=t.enums===String?"RSA":0,t.bytes===String?r.Data="":(r.Data=[],t.bytes!==Array&&(r.Data=c.newBuffer(r.Data)))),null!=e.Type&&e.hasOwnProperty("Type")&&(r.Type=t.enums===String?u.KeyType[e.Type]:e.Type),null!=e.Data&&e.hasOwnProperty("Data")&&(r.Data=t.bytes===String?c.base64.encode(e.Data,0,e.Data.length):t.bytes===Array?Array.prototype.slice.call(e.Data):e.Data),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),u.PrivateKey=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.Type=e.int32();break;case 2:n.Data=e.bytes();break;default:e.skipType(7&i)}}if(!n.hasOwnProperty("Type"))throw c.ProtocolError("missing required 'Type'",{instance:n});if(!n.hasOwnProperty("Data"))throw c.ProtocolError("missing required 'Data'",{instance:n});return n},e.fromObject=function(e){if(e instanceof u.PrivateKey)return e;var t=new u.PrivateKey;switch(e.Type){case"RSA":case 0:t.Type=0;break;case"Ed25519":case 1:t.Type=1;break;case"Secp256k1":case 2:t.Type=2}return null!=e.Data&&("string"==typeof e.Data?c.base64.decode(e.Data,t.Data=c.newBuffer(c.base64.length(e.Data)),0):e.Data.length&&(t.Data=e.Data)),t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(r.Type=t.enums===String?"RSA":0,t.bytes===String?r.Data="":(r.Data=[],t.bytes!==Array&&(r.Data=c.newBuffer(r.Data)))),null!=e.Type&&e.hasOwnProperty("Type")&&(r.Type=t.enums===String?u.KeyType[e.Type]:e.Type),null!=e.Data&&e.hasOwnProperty("Data")&&(r.Data=t.bytes===String?c.base64.encode(e.Data,0,e.Data.length):t.bytes===Array?Array.prototype.slice.call(e.Data):e.Data),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),e.exports=u},30319:(e,t,r)=>{"use strict";const n=r(59701),i=r(18633),{toString:o}=r(92263),{fromString:s}=r(52217);function a(e){return Promise.all([n.get().subtle.exportKey("jwk",e.privateKey),n.get().subtle.exportKey("jwk",e.publicKey)])}t.utils=r(43075),t.generateKey=async function(e){const t=await n.get().subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]),r=await a(t);return{privateKey:r[0],publicKey:r[1]}},t.unmarshalPrivateKey=async function(e){const t=[await n.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]),await(r=e,n.get().subtle.importKey("jwk",{kty:r.kty,n:r.n,e:r.e},{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"]))];var r;const i=await a({privateKey:t[0],publicKey:t[1]});return{privateKey:i[0],publicKey:i[1]}},t.getRandomValues=i,t.hashAndSign=async function(e,t){const r=await n.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]),i=await n.get().subtle.sign({name:"RSASSA-PKCS1-v1_5"},r,Uint8Array.from(t));return new Uint8Array(i,i.byteOffset,i.byteLength)},t.hashAndVerify=async function(e,t,r){const i=await n.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]);return n.get().subtle.verify({name:"RSASSA-PKCS1-v1_5"},i,t,r)};const{jwk2pub:c,jwk2priv:u}=r(55333);function f(e,t,r,n){const i=t?c(e):u(e),a=n(o(Uint8Array.from(r),"ascii"),i);return s(a,"ascii")}t.encrypt=function(e,t){return f(e,!0,t,((e,t)=>t.encrypt(e)))},t.decrypt=function(e,t){return f(e,!1,t,((e,t)=>t.decrypt(e)))}},66406:(e,t,r)=>{"use strict";const{sha256:n}=r(56155),i=r(32114),{equals:o}=r(19588),{toString:s}=r(92263);r(63219),r(80069);const a=r(3832),c=r(30319),u=r(32327),f=r(92352);class l{constructor(e){this._key=e}async verify(e,t){return c.hashAndVerify(this._key,t,e)}marshal(){return c.utils.jwkToPkix(this._key)}get bytes(){return u.PublicKey.encode({Type:u.KeyType.RSA,Data:this.marshal()}).finish()}encrypt(e){return c.encrypt(this._key,e)}equals(e){return o(this.bytes,e.bytes)}async hash(){const{bytes:e}=await n.digest(this.bytes);return e}}class h{constructor(e,t){this._key=e,this._publicKey=t}genSecret(){return c.getRandomValues(16)}async sign(e){return c.hashAndSign(this._key,e)}get public(){if(!this._publicKey)throw i(new Error("public key not provided"),"ERR_PUBKEY_NOT_PROVIDED");return new l(this._publicKey)}decrypt(e){return c.decrypt(this._key,e)}marshal(){return c.utils.jwkToPkcs1(this._key)}get bytes(){return u.PrivateKey.encode({Type:u.KeyType.RSA,Data:this.marshal()}).finish()}equals(e){return o(this.bytes,e.bytes)}async hash(){const{bytes:e}=await n.digest(this.bytes);return e}async id(){const e=await this.public.hash();return s(e,"base58btc")}async export(e,t="pkcs-8"){if("pkcs-8"===t){const t=new a.util.ByteBuffer(this.marshal()),r=a.asn1.fromDer(t),n=a.pki.privateKeyFromAsn1(r),i={algorithm:"aes256",count:1e4,saltSize:16,prfAlgorithm:"sha512"};return a.pki.encryptRsaPrivateKey(n,e,i)}if("libp2p-key"===t)return f.export(this.bytes,e);throw i(new Error(`export format '${t}' is not supported`),"ERR_INVALID_EXPORT_FORMAT")}}e.exports={RsaPublicKey:l,RsaPrivateKey:h,unmarshalRsaPublicKey:function(e){const t=c.utils.pkixToJwk(e);return new l(t)},unmarshalRsaPrivateKey:async function(e){const t=c.utils.pkcs1ToJwk(e),r=await c.unmarshalPrivateKey(t);return new h(r.privateKey,r.publicKey)},generateKeyPair:async function(e){const t=await c.generateKey(e);return new h(t.privateKey,t.publicKey)},fromJwk:async function(e){const t=await c.unmarshalPrivateKey(e);return new h(t.privateKey,t.publicKey)}}},43075:(e,t,r)=>{"use strict";r(3068),r(28095);const n=r(3832),{bigIntegerToUintBase64url:i,base64urlToBigInteger:o}=r(27944),{fromString:s}=r(52217),{toString:a}=r(92263);t.pkcs1ToJwk=function(e){const t=n.asn1.fromDer(a(e,"ascii")),r=n.pki.privateKeyFromAsn1(t);return{kty:"RSA",n:i(r.n),e:i(r.e),d:i(r.d),p:i(r.p),q:i(r.q),dp:i(r.dP),dq:i(r.dQ),qi:i(r.qInv),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkcs1=function(e){const t=n.pki.privateKeyToAsn1({n:o(e.n),e:o(e.e),d:o(e.d),p:o(e.p),q:o(e.q),dP:o(e.dp),dQ:o(e.dq),qInv:o(e.qi)});return s(n.asn1.toDer(t).getBytes(),"ascii")},t.pkixToJwk=function(e){const t=n.asn1.fromDer(a(e,"ascii")),r=n.pki.publicKeyFromAsn1(t);return{kty:"RSA",n:i(r.n),e:i(r.e),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkix=function(e){const t=n.pki.publicKeyToAsn1({n:o(e.n),e:o(e.e)});return s(n.asn1.toDer(t).getBytes(),"ascii")}},47233:(e,t,r)=>{"use strict";const{sha256:n}=r(56155),i=r(32114),{equals:o}=r(19588),{toString:s}=r(92263),a=r(92352);e.exports=(e,t,c)=>{c=c||r(27690)(t);class u{constructor(e){c.validatePublicKey(e),this._key=e}verify(e,t){return c.hashAndVerify(this._key,t,e)}marshal(){return c.compressPublicKey(this._key)}get bytes(){return e.PublicKey.encode({Type:e.KeyType.Secp256k1,Data:this.marshal()}).finish()}equals(e){return o(this.bytes,e.bytes)}async hash(){const{bytes:e}=await n.digest(this.bytes);return e}}class f{constructor(e,t){this._key=e,this._publicKey=t||c.computePublicKey(e),c.validatePrivateKey(this._key),c.validatePublicKey(this._publicKey)}sign(e){return c.hashAndSign(this._key,e)}get public(){return new u(this._publicKey)}marshal(){return this._key}get bytes(){return e.PrivateKey.encode({Type:e.KeyType.Secp256k1,Data:this.marshal()}).finish()}equals(e){return o(this.bytes,e.bytes)}async hash(){const{bytes:e}=await n.digest(this.bytes);return e}async id(){const e=await this.public.hash();return s(e,"base58btc")}async export(e,t="libp2p-key"){if("libp2p-key"===t)return a.export(this.bytes,e);throw i(new Error(`export format '${t}' is not supported`),"ERR_INVALID_EXPORT_FORMAT")}}return{Secp256k1PublicKey:u,Secp256k1PrivateKey:f,unmarshalSecp256k1PrivateKey:function(e){return new f(e)},unmarshalSecp256k1PublicKey:function(e){return new u(e)},generateKeyPair:async function(){const e=await c.generateKey();return new f(e)}}}},27690:(e,t,r)=>{"use strict";const n=r(17221),{sha256:i}=r(56155);e.exports=e=>{function t(e){if(!n.privateKeyVerify(e))throw new Error("Invalid private key")}return{generateKey:function(){let t;do{t=e(32)}while(!n.privateKeyVerify(t));return t},privateKeyLength:32,hashAndSign:async function(e,t){const{digest:r}=await i.digest(t),o=n.ecdsaSign(r,e);return n.signatureExport(o.signature)},hashAndVerify:async function(e,t,r){const{digest:o}=await i.digest(r);return t=n.signatureImport(t),n.ecdsaVerify(t,o,e)},compressPublicKey:function(e){if(!n.publicKeyVerify(e))throw new Error("Invalid public key");return n.publicKeyConvert(e,!0)},decompressPublicKey:function(e){return n.publicKeyConvert(e,!1)},validatePrivateKey:t,validatePublicKey:function(e){if(!n.publicKeyVerify(e))throw new Error("Invalid public key")},computePublicKey:function(e){return t(e),n.publicKeyCreate(e)}}}},1098:(e,t,r)=>{"use strict";const n=r(32114);e.exports=function(e,t){if(!e.includes(t)){const r=e.join(" / ");throw n(new Error(`Unknown curve: ${t}. Must be ${r}`),"ERR_INVALID_CURVE")}}},25113:(e,t,r)=>{"use strict";const n=r(98960),i=r(97116),o=r(32114),s={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};e.exports=function(e,t,r,a,c){const u=s[c];if(!u){const e=Object.keys(s).join(" / ");throw o(new Error(`Hash '${c}' is unknown or not supported. Must be ${e}`),"ERR_UNSUPPORTED_HASH_TYPE")}const f=n(e,t,r,a,u);return i.encode64(f)}},18633:(e,t,r)=>{"use strict";const n=r(1914),i=r(32114);e.exports=function(e){if(isNaN(e)||e<=0)throw i(new Error("random bytes length must be a Number bigger than 0"),"ERR_INVALID_LENGTH");return n(e)}},27944:(e,t,r)=>{"use strict";r(97116),r(15764);const n=r(3832),{fromString:i}=r(52217),{toString:o}=r(92263),{concat:s}=r(20605);t.bigIntegerToUintBase64url=(e,t)=>{let r=Uint8Array.from(e.abs().toByteArray());if(r=0===r[0]?r.slice(1):r,null!=t){if(r.length>t)throw new Error("byte array longer than desired length");r=s([new Uint8Array(t-r.length),r])}return o(r,"base64url")},t.base64urlToBigInteger=e=>{const r=t.base64urlToBuffer(e);return new n.jsbn.BigInteger(o(r,"base16"),16)},t.base64urlToBuffer=(e,t)=>{let r=i(e,"base64urlpad");if(null!=t){if(r.length>t)throw new Error("byte array longer than desired length");r=s([new Uint8Array(t-r.length),r])}return r}},59701:(e,t)=>{"use strict";t.get=(e=self)=>{const t=e.crypto||e.msCrypto;if(!t||!t.subtle)throw Object.assign(new Error("Missing Web Crypto API. The most likely cause of this error is that this page is being accessed from an insecure context (i.e. not HTTPS). For more information and possible resolutions see https://github.com/libp2p/js-libp2p-crypto/blob/master/README.md#web-crypto-api"),{code:"ERR_MISSING_WEB_CRYPTO"});return t}},14786:e=>{e.exports=function e(t,r){var n,i=0,o=0,s=r=r||0,a=t.length;do{if(s>=a||o>49)throw e.bytes=0,new RangeError("Could not decode varint");n=t[s++],i+=o<28?(127&n)<=128);return e.bytes=s-r,i}},84099:e=>{e.exports=function e(r,n,i){if(Number.MAX_SAFE_INTEGER&&r>Number.MAX_SAFE_INTEGER)throw e.bytes=0,new RangeError("Could not encode varint");n=n||[];for(var o=i=i||0;r>=t;)n[i++]=255&r|128,r/=128;for(;-128&r;)n[i++]=255&r|128,r>>>=7;return n[i]=0|r,e.bytes=i-o+1,n};var t=Math.pow(2,31)},88256:(e,t,r)=>{e.exports={encode:r(84099),decode:r(14786),encodingLength:r(48984)}},48984:e=>{var t=Math.pow(2,7),r=Math.pow(2,14),n=Math.pow(2,21),i=Math.pow(2,28),o=Math.pow(2,35),s=Math.pow(2,42),a=Math.pow(2,49),c=Math.pow(2,56),u=Math.pow(2,63);e.exports=function(e){return e0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.krasnodar=t.testNet=t.stage=void 0,t.stage=[{multiaddr:"/dns4/stage.fluence.dev/tcp/19001/wss/p2p/12D3KooWHCJbJKGDfCgHSoCuK9q4STyRnVveqLoXAPBbXHTZx9Cv",peerId:"12D3KooWHCJbJKGDfCgHSoCuK9q4STyRnVveqLoXAPBbXHTZx9Cv"},{multiaddr:"/dns4/stage.fluence.dev/tcp/19002/wss/p2p/12D3KooWMigkP4jkVyufq5JnDJL6nXvyjeaDNpRfEZqQhsG3sYCU",peerId:"12D3KooWMigkP4jkVyufq5JnDJL6nXvyjeaDNpRfEZqQhsG3sYCU"},{multiaddr:"/dns4/stage.fluence.dev/tcp/19003/wss/p2p/12D3KooWMMGdfVEJ1rWe1nH1nehYDzNEHhg5ogdfiGk88AupCMnf",peerId:"12D3KooWMMGdfVEJ1rWe1nH1nehYDzNEHhg5ogdfiGk88AupCMnf"},{multiaddr:"/dns4/stage.fluence.dev/tcp/19004/wss/p2p/12D3KooWJ4bTHirdTFNZpCS72TAzwtdmavTBkkEXtzo6wHL25CtE",peerId:"12D3KooWJ4bTHirdTFNZpCS72TAzwtdmavTBkkEXtzo6wHL25CtE"},{multiaddr:"/dns4/stage.fluence.dev/tcp/19005/wss/p2p/12D3KooWAKNos2KogexTXhrkMZzFYpLHuWJ4PgoAhurSAv7o5CWA",peerId:"12D3KooWAKNos2KogexTXhrkMZzFYpLHuWJ4PgoAhurSAv7o5CWA"},{multiaddr:"/dns4/stage.fluence.dev/tcp/19990/wss/p2p/12D3KooWDcpWuyrMTDinqNgmXAuRdfd2mTdY9VoXZSAet2pDzh6r",peerId:"12D3KooWDcpWuyrMTDinqNgmXAuRdfd2mTdY9VoXZSAet2pDzh6r"}],t.testNet=[{multiaddr:"/dns4/net01.fluence.dev/tcp/19001/wss/p2p/12D3KooWEXNUbCXooUwHrHBbrmjsrpHXoEphPwbjQXEGyzbqKnE9",peerId:"12D3KooWEXNUbCXooUwHrHBbrmjsrpHXoEphPwbjQXEGyzbqKnE9"},{multiaddr:"/dns4/net01.fluence.dev/tcp/19990/wss/p2p/12D3KooWMhVpgfQxBLkQkJed8VFNvgN4iE6MD7xCybb1ZYWW2Gtz",peerId:"12D3KooWMhVpgfQxBLkQkJed8VFNvgN4iE6MD7xCybb1ZYWW2Gtz"},{multiaddr:"/dns4/net02.fluence.dev/tcp/19001/wss/p2p/12D3KooWHk9BjDQBUqnavciRPhAYFvqKBe4ZiPPvde7vDaqgn5er",peerId:"12D3KooWHk9BjDQBUqnavciRPhAYFvqKBe4ZiPPvde7vDaqgn5er"},{multiaddr:"/dns4/net03.fluence.dev/tcp/19001/wss/p2p/12D3KooWBUJifCTgaxAUrcM9JysqCcS4CS8tiYH5hExbdWCAoNwb",peerId:"12D3KooWBUJifCTgaxAUrcM9JysqCcS4CS8tiYH5hExbdWCAoNwb"},{multiaddr:"/dns4/net04.fluence.dev/tcp/19001/wss/p2p/12D3KooWJbJFaZ3k5sNd8DjQgg3aERoKtBAnirEvPV8yp76kEXHB",peerId:"12D3KooWJbJFaZ3k5sNd8DjQgg3aERoKtBAnirEvPV8yp76kEXHB"},{multiaddr:"/dns4/net05.fluence.dev/tcp/19001/wss/p2p/12D3KooWCKCeqLPSgMnDjyFsJuWqREDtKNHx1JEBiwaMXhCLNTRb",peerId:"12D3KooWCKCeqLPSgMnDjyFsJuWqREDtKNHx1JEBiwaMXhCLNTRb"},{multiaddr:"/dns4/net06.fluence.dev/tcp/19001/wss/p2p/12D3KooWKnRcsTpYx9axkJ6d69LPfpPXrkVLe96skuPTAo76LLVH",peerId:"12D3KooWKnRcsTpYx9axkJ6d69LPfpPXrkVLe96skuPTAo76LLVH"},{multiaddr:"/dns4/net07.fluence.dev/tcp/19001/wss/p2p/12D3KooWBSdm6TkqnEFrgBuSkpVE3dR1kr6952DsWQRNwJZjFZBv",peerId:"12D3KooWBSdm6TkqnEFrgBuSkpVE3dR1kr6952DsWQRNwJZjFZBv"},{multiaddr:"/dns4/net08.fluence.dev/tcp/19001/wss/p2p/12D3KooWGzNvhSDsgFoHwpWHAyPf1kcTYCGeRBPfznL8J6qdyu2H",peerId:"12D3KooWGzNvhSDsgFoHwpWHAyPf1kcTYCGeRBPfznL8J6qdyu2H"},{multiaddr:"/dns4/net09.fluence.dev/tcp/19001/wss/p2p/12D3KooWF7gjXhQ4LaKj6j7ntxsPpGk34psdQicN2KNfBi9bFKXg",peerId:"12D3KooWF7gjXhQ4LaKj6j7ntxsPpGk34psdQicN2KNfBi9bFKXg"},{multiaddr:"/dns4/net10.fluence.dev/tcp/19001/wss/p2p/12D3KooWB9P1xmV3c7ZPpBemovbwCiRRTKd3Kq2jsVPQN4ZukDfy",peerId:"12D3KooWB9P1xmV3c7ZPpBemovbwCiRRTKd3Kq2jsVPQN4ZukDfy"}],t.krasnodar=[{multiaddr:"/dns4/kras-00.fluence.dev/tcp/19990/wss/p2p/12D3KooWSD5PToNiLQwKDXsu8JSysCwUt8BVUJEqCHcDe7P5h45e",peerId:"12D3KooWSD5PToNiLQwKDXsu8JSysCwUt8BVUJEqCHcDe7P5h45e"},{multiaddr:"/dns4/kras-00.fluence.dev/tcp/19001/wss/p2p/12D3KooWR4cv1a8tv7pps4HH6wePNaK6gf1Hww5wcCMzeWxyNw51",peerId:"12D3KooWR4cv1a8tv7pps4HH6wePNaK6gf1Hww5wcCMzeWxyNw51"},{multiaddr:"/dns4/kras-01.fluence.dev/tcp/19001/wss/p2p/12D3KooWKnEqMfYo9zvfHmqTLpLdiHXPe4SVqUWcWHDJdFGrSmcA",peerId:"12D3KooWKnEqMfYo9zvfHmqTLpLdiHXPe4SVqUWcWHDJdFGrSmcA"},{multiaddr:"/dns4/kras-02.fluence.dev/tcp/19001/wss/p2p/12D3KooWHLxVhUQyAuZe6AHMB29P7wkvTNMn7eDMcsqimJYLKREf",peerId:"12D3KooWHLxVhUQyAuZe6AHMB29P7wkvTNMn7eDMcsqimJYLKREf"},{multiaddr:"/dns4/kras-03.fluence.dev/tcp/19001/wss/p2p/12D3KooWJd3HaMJ1rpLY1kQvcjRPEvnDwcXrH8mJvk7ypcZXqXGE",peerId:"12D3KooWJd3HaMJ1rpLY1kQvcjRPEvnDwcXrH8mJvk7ypcZXqXGE"},{multiaddr:"/dns4/kras-04.fluence.dev/tcp/19001/wss/p2p/12D3KooWFEwNWcHqi9rtsmDhsYcDbRUCDXH84RC4FW6UfsFWaoHi",peerId:"12D3KooWFEwNWcHqi9rtsmDhsYcDbRUCDXH84RC4FW6UfsFWaoHi"},{multiaddr:"/dns4/kras-05.fluence.dev/tcp/19001/wss/p2p/12D3KooWCMr9mU894i8JXAFqpgoFtx6qnV1LFPSfVc3Y34N4h4LS",peerId:"12D3KooWCMr9mU894i8JXAFqpgoFtx6qnV1LFPSfVc3Y34N4h4LS"},{multiaddr:"/dns4/kras-06.fluence.dev/tcp/19001/wss/p2p/12D3KooWDUszU2NeWyUVjCXhGEt1MoZrhvdmaQQwtZUriuGN1jTr",peerId:"12D3KooWDUszU2NeWyUVjCXhGEt1MoZrhvdmaQQwtZUriuGN1jTr"},{multiaddr:"/dns4/kras-07.fluence.dev/tcp/19001/wss/p2p/12D3KooWEFFCZnar1cUJQ3rMWjvPQg6yMV2aXWs2DkJNSRbduBWn",peerId:"12D3KooWEFFCZnar1cUJQ3rMWjvPQg6yMV2aXWs2DkJNSRbduBWn"},{multiaddr:"/dns4/kras-08.fluence.dev/tcp/19001/wss/p2p/12D3KooWFtf3rfCDAfWwt6oLZYZbDfn9Vn7bv7g6QjjQxUUEFVBt",peerId:"12D3KooWFtf3rfCDAfWwt6oLZYZbDfn9Vn7bv7g6QjjQxUUEFVBt"},{multiaddr:"/dns4/kras-09.fluence.dev/tcp/19001/wss/p2p/12D3KooWD7CvsYcpF9HE9CCV9aY3SJ317tkXVykjtZnht2EbzDPm",peerId:"12D3KooWD7CvsYcpF9HE9CCV9aY3SJ317tkXVykjtZnht2EbzDPm"}]},44612:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Fluence=t.setLogLevel=t.FluencePeer=t.KeyPair=void 0;var i=n(r(2043)),o=r(40149),s=r(84165);Object.defineProperty(t,"KeyPair",{enumerable:!0,get:function(){return s.KeyPair}});var a=r(40149);Object.defineProperty(t,"FluencePeer",{enumerable:!0,get:function(){return a.FluencePeer}}),t.setLogLevel=function(e){i.default.setLevel(e)},i.default.setDefaultLevel("WARN");var c=new o.FluencePeer;t.Fluence={start:function(e){return c.start(e)},stop:function(){return c.stop()},getStatus:function(){return c.getStatus()},getPeer:function(){return c}}},29786:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(53818),i=r(48764);t.default=n.isBrowser?i.Buffer:Buffer},84461:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t},s=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},a=this&&this.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.FluencePeer=void 0;var u=r(46584),f=r(33322),l=r(29141),h=r(84461),d=r(84165),p=r(70229),y=r(67652),g=c(r(2043)),b=r(68316),m=r(11189),v=r(51943),w=r(19045),E=c(r(29786)),_=function(){function e(){this._isFluenceAwesome=!0,this._incomingParticles=new y.Subject,this._outgoingParticles=new y.Subject,this._particleSpecificHandlers=new Map,this._commonHandlers=new Map,this._relayPeerId=null,this._timeouts=[],this._particleQueues=new Map,this._legacyParticleSpecificHandlers=new Map}return e.isInstance=function(e){return!(!e||!e._isFluenceAwesome)},e.prototype.getStatus=function(){var e,t;return{isInitialized:void 0!==this._keyPair,isConnected:void 0!==this._connection,peerId:(null===(t=null===(e=this._keyPair)||void 0===e?void 0:e.Libp2pPeerId)||void 0===t?void 0:t.toB58String())||null,relayPeerId:this._relayPeerId||null}},e.prototype.start=function(e){return i(this,void 0,void 0,(function(){var t,r,n,i,s=this;return o(this,(function(o){switch(o.label){case 0:return(null==e?void 0:e.KeyPair)?(this._keyPair=e.KeyPair,[3,3]):[3,1];case 1:return t=this,[4,d.KeyPair.randomEd25519()];case 2:t._keyPair=o.sent(),o.label=3;case 3:return this._defaultTTL=void 0!==(null==e?void 0:e.defaultTtlMs)?null==e?void 0:e.defaultTtlMs:7e3,this._avmRunner=(null==e?void 0:e.avmRunner)||new m.AvmRunnerBackground,[4,this._avmRunner.init((null==e?void 0:e.avmLogLevel)||"off")];case 4:return o.sent(),(null==e?void 0:e.connectTo)?(r=void 0,n=e.connectTo.multiaddr,r=n?new u.Multiaddr(n):new u.Multiaddr(e.connectTo),this._relayPeerId=r.getPeerId(),this._connection?[4,this._connection.disconnect()]:[3,6]):[3,9];case 5:o.sent(),o.label=6;case 6:return i=this,[4,h.FluenceConnection.createConnection({peerId:this._keyPair.Libp2pPeerId,relayAddress:r,dialTimeoutMs:e.dialTimeoutMs,onIncomingParticle:function(e){return s._incomingParticles.next({particle:e,onStageChange:function(){}})}})];case 7:return i._connection=o.sent(),[4,this._connect()];case 8:o.sent(),o.label=9;case 9:return this._legacyCallServiceHandler=new l.CallServiceHandler,function(e){for(var t in b.builtInServices)for(var r in b.builtInServices[t]){var n=b.builtInServices[t][r];e.internals.regHandler.common(t,r,n)}}(this),this._classServices={sig:new v.Sig(this._keyPair)},this._classServices.sig.securityGuard=(0,v.defaultSigGuard)(this.getStatus().peerId),(0,w.registerSig)(this,this._classServices.sig),(0,w.registerSig)(this,this.getStatus().peerId,this._classServices.sig),this._startParticleProcessing(),[2]}}))}))},e.prototype.getServices=function(){return n({},this._classServices)},e.prototype.stop=function(){var e;return i(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return this._keyPair=void 0,this._relayPeerId=null,this._stopParticleProcessing(),[4,this._disconnect()];case 1:return t.sent(),[4,null===(e=this._avmRunner)||void 0===e?void 0:e.terminate()];case 2:return t.sent(),this._avmRunner=void 0,this._legacyCallServiceHandler=null,this._particleSpecificHandlers.clear(),this._commonHandlers.clear(),[2]}}))}))},Object.defineProperty(e.prototype,"internals",{get:function(){var e=this;return{initiateParticle:function(t,r){if(!e.getStatus().isInitialized)throw"Cannot initiate new particle: peer is not initialized";void 0===t.initPeerId&&(t.initPeerId=e.getStatus().peerId),void 0===t.ttl&&(t.ttl=e._defaultTTL),e._incomingParticles.next({particle:t,onStageChange:r})},regHandler:{common:function(t,r,n){e._commonHandlers.set(A(t,r),n)},forParticle:function(t,r,n,i){var o=e._particleSpecificHandlers.get(t);void 0===o&&(o=new Map,e._particleSpecificHandlers.set(t,o)),o.set(A(r,n),i)}},initiateFlow:function(t){var r=t.particle;e._legacyParticleSpecificHandlers.set(r.id,{handler:t.handler,error:t.error,timeout:t.timeout}),e.internals.initiateParticle(r,(function(e){"interpreterError"===e.stage&&(null==t||t.error(e.errorMessage)),"expired"===e.stage&&(null==t||t.timeout())}))},callServiceHandler:this._legacyCallServiceHandler}},enumerable:!1,configurable:!0}),e.prototype._connect=function(){var e;return i(this,void 0,void 0,(function(){return o(this,(function(t){return[2,null===(e=this._connection)||void 0===e?void 0:e.connect()]}))}))},e.prototype._disconnect=function(){return i(this,void 0,void 0,(function(){return o(this,(function(e){return this._connection?[2,this._connection.disconnect()]:[2]}))}))},e.prototype._startParticleProcessing=function(){var e=this;this._incomingParticles.pipe((0,y.tap)((function(e){e.particle.logTo("debug","particle received:")})),I(this._expireParticle.bind(this))).subscribe((function(t){var r=t.particle,n=e._particleQueues.get(r.id);if(!n){n=e._createParticlesProcessingQueue(),e._particleQueues.set(r.id,n);var i=setTimeout((function(){e._expireParticle(t)}),r.actualTtl());e._timeouts.push(i)}n.next(t)})),this._outgoingParticles.subscribe((function(t){return i(e,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return this.getStatus().isInitialized?this._connection?[4,this._connection.sendParticle(t.particle)]:(t.particle.logTo("error","cannot send particle, peer is not connected"),t.onStageChange({stage:"sendingError"}),[2]):[2];case 1:return e.sent(),t.onStageChange({stage:"sent"}),[2]}}))}))}))},e.prototype._expireParticle=function(e){var t=e.particle.id;g.default.debug("particle "+t+" has expired after "+e.particle.ttl+". Deleting particle-related queues and handlers"),this._particleQueues.delete(t),this._particleSpecificHandlers.delete(t),e.onStageChange({stage:"expired"})},e.prototype._createParticlesProcessingQueue=function(){var e=this,t=new y.Subject,r=E.default.from([]);return t.pipe(I(this._expireParticle.bind(this)),(0,y.concatMap)((function(t){return i(e,void 0,void 0,(function(){var e,i;return o(this,(function(o){switch(o.label){case 0:return this.getStatus().isInitialized?[4,T(this.getStatus().peerId,this._avmRunner,t.particle,r)]:[2,null];case 1:return e=o.sent(),i=E.default.from(e.data),r=i,[2,n(n({},t),{result:e,newData:i})]}}))}))}))).subscribe((function(r){return i(e,void 0,void 0,(function(){var e,i,c,u,l,h,d,y,g,b;return o(this,(function(o){if(!this.getStatus().isInitialized)return[2];if(!S(r.result))return r.onStageChange({stage:"interpreterError",errorMessage:r.result.errorMessage}),[2];if(setTimeout((function(){r.onStageChange({stage:"interpreted"})}),0),r.result.nextPeerPks.length>0&&((e=r.particle.clone()).data=r.newData,this._outgoingParticles.next(n(n({},r),{particle:e}))),r.result.callRequests.length>0){i=function(e,i){var o={fnName:i.functionName,args:i.arguments,serviceId:i.serviceId,tetraplets:i.tetraplets,particleContext:r.particle.getParticleContext()};c._execSingleCallRequest(o).catch((function(e){return{retCode:f.ResultCodes.error,result:'Handler failed. fnName="'+o.fnName+'" serviceId="'+o.serviceId+'" error: '+e.toString()}})).then((function(i){var o={result:(0,p.jsonify)(i.result),retCode:i.retCode},s=r.particle.clone();s.callResults=[[e,o]],s.data=E.default.from([]),t.next(n(n({},r),{particle:s}))}))},c=this;try{for(u=s(r.result.callRequests),l=u.next();!l.done;l=u.next())h=a(l.value,2),d=h[0],y=h[1],i(d,y)}catch(e){g={error:e}}finally{try{l&&!l.done&&(b=u.return)&&b.call(u)}finally{if(g)throw g.error}}}else r.onStageChange({stage:"localWorkDone"});return[2]}))}))})),t},e.prototype._execSingleCallRequest=function(e){return i(this,void 0,void 0,(function(){var t,r,n,i,s,a,c;return o(this,(function(o){switch(o.label){case 0:return g.default.debug("executing call service handler",(0,p.jsonify)(e)),t=e.particleContext.particleId,r=this._legacyParticleSpecificHandlers.get(t),n={result:void 0,retCode:void 0},void 0!==r&&(n=r.handler.execute(e)),void 0===(null==n?void 0:n.result)&&(n=this._legacyCallServiceHandler.execute(e)),void 0!==n.retCode?[3,4]:(i=A(e.serviceId,e.fnName),s=this._particleSpecificHandlers.get(t),a=void 0,void 0!==s&&(a=s.get(i)),void 0===a&&(a=this._commonHandlers.get(i)),a?[4,a(e)]:[3,2]);case 1:return c=o.sent(),[3,3];case 2:c={retCode:f.ResultCodes.error,result:"No handler has been registered for serviceId='"+e.serviceId+"' fnName='"+e.fnName+"' args='"+(0,p.jsonify)(e.args)+"'"},o.label=3;case 3:n=c,o.label=4;case 4:return void 0===n.result&&(n.result=null),g.default.debug("executed call service handler, req and res are: ",(0,p.jsonify)(e),(0,p.jsonify)(n)),[2,n]}}))}))},e.prototype._stopParticleProcessing=function(){var e,t;try{for(var r=s(this._timeouts),n=r.next();!n.done;n=r.next()){var i=n.value;clearTimeout(i)}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}this._particleQueues.clear()},e}();function S(e){return 0===e.retCode}function A(e,t){return e+"/"+t}function T(e,t,r,s){return i(this,void 0,void 0,(function(){var i,a;return o(this,(function(o){switch(o.label){case 0:return r.logTo("debug","Sending particle to interpreter"),g.default.debug("prevData: ",(0,p.dataToString)(s)),[4,t.run(r.script,s,r.data,{initPeerId:r.initPeerId,currentPeerId:e},r.callResults)];case 1:return i=o.sent(),(a=n({},i)).data=(0,p.dataToString)(a.data),S(i)?g.default.debug("Interpreter result: ",(0,p.jsonify)(a)):g.default.error("Interpreter failed: ",(0,p.jsonify)(a)),[2,i]}}))}))}function I(e){return(0,y.pipe)((0,y.tap)((function(t){t.particle.hasExpired()&&e(t)})),(0,y.filter)((function(e){return!e.particle.hasExpired()})))}t.FluencePeer=_},84165:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t},s=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},a=this&&this.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.registerSig=void 0;var n=r(90281);t.registerSig=function(){for(var e=[],t=0;t0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},s=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i1?p("identity accepts up to 1 arguments, received "+e.args.length+" arguments"):d(0===e.args.length?{}:e.args[0])},concat:function(e){var t=e.args.map((function(e,t){return[Array.isArray(e),t]})).filter((function(e){var t=o(e,2),r=t[0];return t[1],!r})).map((function(e){var t=o(e,2);return t[0],t[1]}));if(t.length>0){var r=t.join(", ");return p("All arguments of 'concat' must be arrays: arguments "+r+" are not")}return d([].concat.apply([],e.args))},string_to_b58:function(e){return 1!==e.args.length?p("string_to_b58 accepts only one string argument"):d((0,c.encode)((new TextEncoder).encode(e.args[0])))},string_from_b58:function(e){return 1!==e.args.length?p("string_from_b58 accepts only one string argument"):d((new TextDecoder).decode((0,c.decode)(e.args[0])))},bytes_to_b58:function(e){if(1===e.args.length&&Array.isArray(e.args[0])){var t=e.args[0];return d((0,c.encode)(new Uint8Array(t)))}return p("bytes_to_b58 accepts only single argument: array of numbers")},bytes_from_b58:function(e){return 1!==e.args.length?p("bytes_from_b58 accepts only one string argument"):d(Array.from((0,c.decode)(e.args[0])))},sha256_string:function(e){return n(void 0,void 0,void 0,(function(){var t,r,n,s,a,f,l,y;return i(this,(function(i){switch(i.label){case 0:return e.args.length<1||e.args.length>3?[2,p("sha256_string accepts 1-3 arguments, found: "+e.args.length)]:[3,1];case 1:return t=o(e.args,3),r=t[0],n=t[1],s=t[2],a=h.default.from(r),[4,u.sha256.digest(a)];case 2:return f=i.sent(),l=n?f.digest:f.bytes,y=s?Array.from(l):(0,c.encode)(l),[2,d(y)]}}))}))},concat_strings:function(e){var t="".concat.apply("",s([],o(e.args),!1));return d(t)}},debug:{stringify:function(e){var t;return t=0===e.args.length?"":1===e.args.length?e.args[0]:e.args,d((0,l.jsonify)(t))}},math:{add:function(e){return y("math.add")},sub:function(e){return y("math.sub")},mul:function(e){return y("math.mul")},fmul:function(e){return y("math.fmul")},div:function(e){return y("math.div")},rem:function(e){return y("math.rem")},pow:function(e){return y("math.pow")},log:function(e){return y("math.log")}},cmp:{gt:function(e){return y("cmp.gt")},gte:function(e){return y("cmp.gte")},lt:function(e){return y("cmp.lt")},lte:function(e){return y("cmp.lte")},cmp:function(e){return y("cmp.cmp")}},array:{sum:function(e){return y("array.sum")},dedup:function(e){return y("array.dedup")},intersect:function(e){return y("array.intersect")},diff:function(e){return y("array.diff")},sdiff:function(e){return y("array.sdiff")}}}},33322:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.ResultCodes=void 0,(r=t.ResultCodes||(t.ResultCodes={}))[r.success=0]="success",r[r.error=1]="error"},29141:function(e,t,r){"use strict";var n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},i=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},a=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},c=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.jsonify=t.dataToString=t.checkConnection=t.doNothing=t.handleTimeout=t.MakeServiceCall=void 0;var a=s(r(2043)),c=r(33322),u=r(36910),f=s(r(29786));t.MakeServiceCall=function(e){return function(t){return{retCode:c.ResultCodes.success,result:e(t.args)}}},t.handleTimeout=function(e){return function(t){"expired"===t.stage&&e()}},t.doNothing=function(e){},t.checkConnection=function(e,r){return n(void 0,void 0,void 0,(function(){var n,s,c;return i(this,(function(i){switch(i.label){case 0:if(!e.getStatus().isConnected)return[2,!1];n=Math.random().toString(36).substring(7),s=new Promise((function(i,s){var a=u.Particle.createNew('\n (xor\n (seq\n (call %init_peer_id% ("load" "relay") [] init_relay)\n (seq\n (call %init_peer_id% ("load" "msg") [] msg)\n (seq \n (call init_relay ("op" "identity") [msg] result)\n (call %init_peer_id% ("callback" "callback") [result])\n )\n )\n )\n (seq \n (call init_relay ("op" "identity") [])\n (call %init_peer_id% ("callback" "error") [%last_error%])\n )\n )',r);e.internals.regHandler.forParticle(a.id,"load","relay",(0,t.MakeServiceCall)((function(){return e.getStatus().relayPeerId}))),e.internals.regHandler.forParticle(a.id,"load","msg",(0,t.MakeServiceCall)((function(){return n}))),e.internals.regHandler.forParticle(a.id,"callback","callback",(0,t.MakeServiceCall)((function(e){var t=o(e,1)[0];return setTimeout((function(){i(t)}),0),{}}))),e.internals.regHandler.forParticle(a.id,"callback","error",(0,t.MakeServiceCall)((function(e){var t=o(e,1)[0];return setTimeout((function(){s(t)}),0),{}}))),e.internals.initiateParticle(a,(0,t.handleTimeout)((function(){s("particle timed out")})))})),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,s];case 2:return i.sent()!=n&&a.default.warn("unexpected behavior. 'identity' must return the passed arguments."),[2,!0];case 3:return c=i.sent(),a.default.error("Error on establishing connection: ",c),[2,!1];case 4:return[2]}}))}))},t.dataToString=function(e){var t=(new TextDecoder).decode(f.default.from(e));try{return JSON.stringify(JSON.parse(t),null,4)}catch(e){return t}},t.jsonify=function(e){return JSON.stringify(e,null,4)}},34537:e=>{"use strict";e.exports=function(e,t){for(var r=new Array(arguments.length-1),n=0,i=2,o=!0;i{"use strict";var r=t;r.length=function(e){var t=e.length;if(!t)return 0;for(var r=0;--t%4>1&&"="===e.charAt(t);)++r;return Math.ceil(3*e.length)/4-r};for(var n=new Array(64),i=new Array(123),o=0;o<64;)i[n[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;r.encode=function(e,t,r){for(var i,o=null,s=[],a=0,c=0;t>2],i=(3&u)<<4,c=1;break;case 1:s[a++]=n[i|u>>4],i=(15&u)<<2,c=2;break;case 2:s[a++]=n[i|u>>6],s[a++]=n[63&u],c=0}a>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,s)),a=0)}return c&&(s[a++]=n[i],s[a++]=61,1===c&&(s[a++]=61)),o?(a&&o.push(String.fromCharCode.apply(String,s.slice(0,a))),o.join("")):String.fromCharCode.apply(String,s.slice(0,a))};var s="invalid encoding";r.decode=function(e,t,r){for(var n,o=r,a=0,c=0;c1)break;if(void 0===(u=i[u]))throw Error(s);switch(a){case 0:n=u,a=1;break;case 1:t[r++]=n<<2|(48&u)>>4,n=u,a=2;break;case 2:t[r++]=(15&n)<<4|(60&u)>>2,n=u,a=3;break;case 3:t[r++]=(3&n)<<6|u,a=0}}if(1===a)throw Error(s);return r-o},r.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},19211:e=>{"use strict";function t(){this._listeners={}}e.exports=t,t.prototype.on=function(e,t,r){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:r||this}),this},t.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var r=this._listeners[e],n=0;n{"use strict";function t(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),r=new Uint8Array(t.buffer),n=128===r[3];function i(e,n,i){t[0]=e,n[i]=r[0],n[i+1]=r[1],n[i+2]=r[2],n[i+3]=r[3]}function o(e,n,i){t[0]=e,n[i]=r[3],n[i+1]=r[2],n[i+2]=r[1],n[i+3]=r[0]}function s(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],t[0]}function a(e,n){return r[3]=e[n],r[2]=e[n+1],r[1]=e[n+2],r[0]=e[n+3],t[0]}e.writeFloatLE=n?i:o,e.writeFloatBE=n?o:i,e.readFloatLE=n?s:a,e.readFloatBE=n?a:s}():function(){function t(e,t,r,n){var i=t<0?1:0;if(i&&(t=-t),0===t)e(1/t>0?0:2147483648,r,n);else if(isNaN(t))e(2143289344,r,n);else if(t>34028234663852886e22)e((i<<31|2139095040)>>>0,r,n);else if(t<11754943508222875e-54)e((i<<31|Math.round(t/1401298464324817e-60))>>>0,r,n);else{var o=Math.floor(Math.log(t)/Math.LN2);e((i<<31|o+127<<23|8388607&Math.round(t*Math.pow(2,-o)*8388608))>>>0,r,n)}}function s(e,t,r){var n=e(t,r),i=2*(n>>31)+1,o=n>>>23&255,s=8388607&n;return 255===o?s?NaN:i*(1/0):0===o?1401298464324817e-60*i*s:i*Math.pow(2,o-150)*(s+8388608)}e.writeFloatLE=t.bind(null,r),e.writeFloatBE=t.bind(null,n),e.readFloatLE=s.bind(null,i),e.readFloatBE=s.bind(null,o)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),r=new Uint8Array(t.buffer),n=128===r[7];function i(e,n,i){t[0]=e,n[i]=r[0],n[i+1]=r[1],n[i+2]=r[2],n[i+3]=r[3],n[i+4]=r[4],n[i+5]=r[5],n[i+6]=r[6],n[i+7]=r[7]}function o(e,n,i){t[0]=e,n[i]=r[7],n[i+1]=r[6],n[i+2]=r[5],n[i+3]=r[4],n[i+4]=r[3],n[i+5]=r[2],n[i+6]=r[1],n[i+7]=r[0]}function s(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],r[4]=e[n+4],r[5]=e[n+5],r[6]=e[n+6],r[7]=e[n+7],t[0]}function a(e,n){return r[7]=e[n],r[6]=e[n+1],r[5]=e[n+2],r[4]=e[n+3],r[3]=e[n+4],r[2]=e[n+5],r[1]=e[n+6],r[0]=e[n+7],t[0]}e.writeDoubleLE=n?i:o,e.writeDoubleBE=n?o:i,e.readDoubleLE=n?s:a,e.readDoubleBE=n?a:s}():function(){function t(e,t,r,n,i,o){var s=n<0?1:0;if(s&&(n=-n),0===n)e(0,i,o+t),e(1/n>0?0:2147483648,i,o+r);else if(isNaN(n))e(0,i,o+t),e(2146959360,i,o+r);else if(n>17976931348623157e292)e(0,i,o+t),e((s<<31|2146435072)>>>0,i,o+r);else{var a;if(n<22250738585072014e-324)e((a=n/5e-324)>>>0,i,o+t),e((s<<31|a/4294967296)>>>0,i,o+r);else{var c=Math.floor(Math.log(n)/Math.LN2);1024===c&&(c=1023),e(4503599627370496*(a=n*Math.pow(2,-c))>>>0,i,o+t),e((s<<31|c+1023<<20|1048576*a&1048575)>>>0,i,o+r)}}}function s(e,t,r,n,i){var o=e(n,i+t),s=e(n,i+r),a=2*(s>>31)+1,c=s>>>20&2047,u=4294967296*(1048575&s)+o;return 2047===c?u?NaN:a*(1/0):0===c?5e-324*a*u:a*Math.pow(2,c-1075)*(u+4503599627370496)}e.writeDoubleLE=t.bind(null,r,0,4),e.writeDoubleBE=t.bind(null,n,4,0),e.readDoubleLE=s.bind(null,i,0,4),e.readDoubleBE=s.bind(null,o,4,0)}(),e}function r(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}function n(e,t,r){t[r]=e>>>24,t[r+1]=e>>>16&255,t[r+2]=e>>>8&255,t[r+3]=255&e}function i(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function o(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}e.exports=t(t)},67199:module=>{"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}module.exports=inquire},76662:e=>{"use strict";e.exports=function(e,t,r){var n=r||8192,i=n>>>1,o=null,s=n;return function(r){if(r<1||r>i)return e(r);s+r>n&&(o=e(n),s=0);var a=t.call(o,s,s+=r);return 7&s&&(s=1+(7|s)),a}}},94997:(e,t)=>{"use strict";var r=t;r.length=function(e){for(var t=0,r=0,n=0;n191&&n<224?o[s++]=(31&n)<<6|63&e[t++]:n>239&&n<365?(n=((7&n)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,o[s++]=55296+(n>>10),o[s++]=56320+(1023&n)):o[s++]=(15&n)<<12|(63&e[t++])<<6|63&e[t++],s>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,o)),s=0);return i?(s&&i.push(String.fromCharCode.apply(String,o.slice(0,s))),i.join("")):String.fromCharCode.apply(String,o.slice(0,s))},r.write=function(e,t,r){for(var n,i,o=r,s=0;s>6|192,t[r++]=63&n|128):55296==(64512&n)&&56320==(64512&(i=e.charCodeAt(s+1)))?(n=65536+((1023&n)<<10)+(1023&i),++s,t[r++]=n>>18|240,t[r++]=n>>12&63|128,t[r++]=n>>6&63|128,t[r++]=63&n|128):(t[r++]=n>>12|224,t[r++]=n>>6&63|128,t[r++]=63&n|128);return r-o}},98099:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(97117);function i(e,t,r){return void 0===t&&(t=new Uint8Array(2)),void 0===r&&(r=0),t[r+0]=e>>>8,t[r+1]=e>>>0,t}function o(e,t,r){return void 0===t&&(t=new Uint8Array(2)),void 0===r&&(r=0),t[r+0]=e>>>0,t[r+1]=e>>>8,t}function s(e,t){return void 0===t&&(t=0),e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function a(e,t){return void 0===t&&(t=0),(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function c(e,t){return void 0===t&&(t=0),e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]}function u(e,t){return void 0===t&&(t=0),(e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t])>>>0}function f(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),t[r+0]=e>>>24,t[r+1]=e>>>16,t[r+2]=e>>>8,t[r+3]=e>>>0,t}function l(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),t[r+0]=e>>>0,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24,t}function h(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),f(e/4294967296>>>0,t,r),f(e>>>0,t,r+4),t}function d(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),l(e>>>0,t,r),l(e/4294967296>>>0,t,r+4),t}t.readInt16BE=function(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])<<16>>16},t.readUint16BE=function(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])>>>0},t.readInt16LE=function(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])<<16>>16},t.readUint16LE=function(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])>>>0},t.writeUint16BE=i,t.writeInt16BE=i,t.writeUint16LE=o,t.writeInt16LE=o,t.readInt32BE=s,t.readUint32BE=a,t.readInt32LE=c,t.readUint32LE=u,t.writeUint32BE=f,t.writeInt32BE=f,t.writeUint32LE=l,t.writeInt32LE=l,t.readInt64BE=function(e,t){void 0===t&&(t=0);var r=s(e,t),n=s(e,t+4);return 4294967296*r+n-4294967296*(n>>31)},t.readUint64BE=function(e,t){return void 0===t&&(t=0),4294967296*a(e,t)+a(e,t+4)},t.readInt64LE=function(e,t){void 0===t&&(t=0);var r=c(e,t);return 4294967296*c(e,t+4)+r-4294967296*(r>>31)},t.readUint64LE=function(e,t){void 0===t&&(t=0);var r=u(e,t);return 4294967296*u(e,t+4)+r},t.writeUint64BE=h,t.writeInt64BE=h,t.writeUint64LE=d,t.writeInt64LE=d,t.readUintBE=function(e,t,r){if(void 0===r&&(r=0),e%8!=0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(e/8>t.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,o=e/8+r-1;o>=r;o--)n+=t[o]*i,i*=256;return n},t.readUintLE=function(e,t,r){if(void 0===r&&(r=0),e%8!=0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(e/8>t.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,o=r;o=i;s--)r[s]=t/o&255,o*=256;return r},t.writeUintLE=function(e,t,r,i){if(void 0===r&&(r=new Uint8Array(e/8)),void 0===i&&(i=0),e%8!=0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!n.isSafeInteger(t))throw new Error("writeUintLE value must be an integer");for(var o=1,s=i;s{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(98099),i=r(17309);function o(e,t,r){for(var i=1634760805,o=857760878,s=2036477234,a=1797285236,c=r[3]<<24|r[2]<<16|r[1]<<8|r[0],u=r[7]<<24|r[6]<<16|r[5]<<8|r[4],f=r[11]<<24|r[10]<<16|r[9]<<8|r[8],l=r[15]<<24|r[14]<<16|r[13]<<8|r[12],h=r[19]<<24|r[18]<<16|r[17]<<8|r[16],d=r[23]<<24|r[22]<<16|r[21]<<8|r[20],p=r[27]<<24|r[26]<<16|r[25]<<8|r[24],y=r[31]<<24|r[30]<<16|r[29]<<8|r[28],g=t[3]<<24|t[2]<<16|t[1]<<8|t[0],b=t[7]<<24|t[6]<<16|t[5]<<8|t[4],m=t[11]<<24|t[10]<<16|t[9]<<8|t[8],v=t[15]<<24|t[14]<<16|t[13]<<8|t[12],w=i,E=o,_=s,S=a,A=c,T=u,I=f,C=l,P=h,R=d,k=p,B=y,x=g,M=b,O=m,N=v,L=0;L<20;L+=2)A=(A^=P=P+(x=(x^=w=w+A|0)>>>16|x<<16)|0)>>>20|A<<12,T=(T^=R=R+(M=(M^=E=E+T|0)>>>16|M<<16)|0)>>>20|T<<12,I=(I^=k=k+(O=(O^=_=_+I|0)>>>16|O<<16)|0)>>>20|I<<12,C=(C^=B=B+(N=(N^=S=S+C|0)>>>16|N<<16)|0)>>>20|C<<12,I=(I^=k=k+(O=(O^=_=_+I|0)>>>24|O<<8)|0)>>>25|I<<7,C=(C^=B=B+(N=(N^=S=S+C|0)>>>24|N<<8)|0)>>>25|C<<7,T=(T^=R=R+(M=(M^=E=E+T|0)>>>24|M<<8)|0)>>>25|T<<7,A=(A^=P=P+(x=(x^=w=w+A|0)>>>24|x<<8)|0)>>>25|A<<7,T=(T^=k=k+(N=(N^=w=w+T|0)>>>16|N<<16)|0)>>>20|T<<12,I=(I^=B=B+(x=(x^=E=E+I|0)>>>16|x<<16)|0)>>>20|I<<12,C=(C^=P=P+(M=(M^=_=_+C|0)>>>16|M<<16)|0)>>>20|C<<12,A=(A^=R=R+(O=(O^=S=S+A|0)>>>16|O<<16)|0)>>>20|A<<12,C=(C^=P=P+(M=(M^=_=_+C|0)>>>24|M<<8)|0)>>>25|C<<7,A=(A^=R=R+(O=(O^=S=S+A|0)>>>24|O<<8)|0)>>>25|A<<7,I=(I^=B=B+(x=(x^=E=E+I|0)>>>24|x<<8)|0)>>>25|I<<7,T=(T^=k=k+(N=(N^=w=w+T|0)>>>24|N<<8)|0)>>>25|T<<7;n.writeUint32LE(w+i|0,e,0),n.writeUint32LE(E+o|0,e,4),n.writeUint32LE(_+s|0,e,8),n.writeUint32LE(S+a|0,e,12),n.writeUint32LE(A+c|0,e,16),n.writeUint32LE(T+u|0,e,20),n.writeUint32LE(I+f|0,e,24),n.writeUint32LE(C+l|0,e,28),n.writeUint32LE(P+h|0,e,32),n.writeUint32LE(R+d|0,e,36),n.writeUint32LE(k+p|0,e,40),n.writeUint32LE(B+y|0,e,44),n.writeUint32LE(x+g|0,e,48),n.writeUint32LE(M+b|0,e,52),n.writeUint32LE(O+m|0,e,56),n.writeUint32LE(N+v|0,e,60)}function s(e,t,r,n,s){if(void 0===s&&(s=0),32!==e.length)throw new Error("ChaCha: key size must be 32 bytes");if(n.length>>=8,t++;if(n>0)throw new Error("ChaCha: counter overflow")}t.streamXOR=s,t.stream=function(e,t,r,n){return void 0===n&&(n=0),i.wipe(r),s(e,t,r,r,n)}},15501:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(25439),i=r(63027),o=r(17309),s=r(98099),a=r(4153);t.KEY_LENGTH=32,t.NONCE_LENGTH=12,t.TAG_LENGTH=16;var c=new Uint8Array(16),u=function(){function e(e){if(this.nonceLength=t.NONCE_LENGTH,this.tagLength=t.TAG_LENGTH,e.length!==t.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(e)}return e.prototype.seal=function(e,t,r,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var s=new Uint8Array(16);s.set(e,s.length-e.length);var a=new Uint8Array(32);n.stream(this._key,s,a,4);var c,u=t.length+this.tagLength;if(i){if(i.length!==u)throw new Error("ChaCha20Poly1305: incorrect destination length");c=i}else c=new Uint8Array(u);return n.streamXOR(this._key,s,t,c,4),this._authenticate(c.subarray(c.length-this.tagLength,c.length),a,c.subarray(0,c.length-this.tagLength),r),o.wipe(s),c},e.prototype.open=function(e,t,r,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(t.length0&&a.update(c.subarray(n.length%16))),a.update(r),r.length%16>0&&a.update(c.subarray(r.length%16));var u=new Uint8Array(8);n&&s.writeUint64LE(n.length,u),a.update(u),s.writeUint64LE(r.length,u),a.update(u);for(var f=a.digest(),l=0;l{"use strict";function r(e,t){if(e.length!==t.length)return 0;for(var r=0,n=0;n>>8}Object.defineProperty(t,"__esModule",{value:!0}),t.select=function(e,t,r){return~(e-1)&t|e-1&r},t.lessOrEqual=function(e,t){return(0|e)-(0|t)-1>>>31&1},t.compare=r,t.equal=function(e,t){return 0!==e.length&&0!==t.length&&0!==r(e,t)}},79984:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isSerializableHash=function(e){return void 0!==e.saveState&&void 0!==e.restoreState&&void 0!==e.cleanSavedState}},512:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(25629),i=r(17309),o=function(){function e(e,t,r,i){void 0===r&&(r=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=i;var o=n.hmac(this._hash,r,t);this._hmac=new n.HMAC(e,o),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return e.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(0===e)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},e.prototype.expand=function(e){for(var t=new Uint8Array(e),r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(79984),i=r(4153),o=r(17309),s=function(){function e(e,t){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var r=new Uint8Array(this.blockSize);t.length>this.blockSize?this._inner.update(t).finish(r).clean():r.set(t);for(var i=0;i{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.mul=Math.imul||function(e,t){var r=65535&e,n=65535&t;return r*n+((e>>>16&65535)*n+r*(t>>>16&65535)<<16>>>0)|0},t.add=function(e,t){return e+t|0},t.sub=function(e,t){return e-t|0},t.rotl=function(e,t){return e<>>32-t},t.rotr=function(e,t){return e<<32-t|e>>>t},t.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(e){return t.isInteger(e)&&e>=-t.MAX_SAFE_INTEGER&&e<=t.MAX_SAFE_INTEGER}},63027:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(4153),i=r(17309);t.DIGEST_LENGTH=16;var o=function(){function e(e){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var r=e[0]|e[1]<<8;this._r[0]=8191&r;var n=e[2]|e[3]<<8;this._r[1]=8191&(r>>>13|n<<3);var i=e[4]|e[5]<<8;this._r[2]=7939&(n>>>10|i<<6);var o=e[6]|e[7]<<8;this._r[3]=8191&(i>>>7|o<<9);var s=e[8]|e[9]<<8;this._r[4]=255&(o>>>4|s<<12),this._r[5]=s>>>1&8190;var a=e[10]|e[11]<<8;this._r[6]=8191&(s>>>14|a<<2);var c=e[12]|e[13]<<8;this._r[7]=8065&(a>>>11|c<<5);var u=e[14]|e[15]<<8;this._r[8]=8191&(c>>>8|u<<8),this._r[9]=u>>>5&127,this._pad[0]=e[16]|e[17]<<8,this._pad[1]=e[18]|e[19]<<8,this._pad[2]=e[20]|e[21]<<8,this._pad[3]=e[22]|e[23]<<8,this._pad[4]=e[24]|e[25]<<8,this._pad[5]=e[26]|e[27]<<8,this._pad[6]=e[28]|e[29]<<8,this._pad[7]=e[30]|e[31]<<8}return e.prototype._blocks=function(e,t,r){for(var n=this._fin?0:2048,i=this._h[0],o=this._h[1],s=this._h[2],a=this._h[3],c=this._h[4],u=this._h[5],f=this._h[6],l=this._h[7],h=this._h[8],d=this._h[9],p=this._r[0],y=this._r[1],g=this._r[2],b=this._r[3],m=this._r[4],v=this._r[5],w=this._r[6],E=this._r[7],_=this._r[8],S=this._r[9];r>=16;){var A=e[t+0]|e[t+1]<<8;i+=8191&A;var T=e[t+2]|e[t+3]<<8;o+=8191&(A>>>13|T<<3);var I=e[t+4]|e[t+5]<<8;s+=8191&(T>>>10|I<<6);var C=e[t+6]|e[t+7]<<8;a+=8191&(I>>>7|C<<9);var P=e[t+8]|e[t+9]<<8;c+=8191&(C>>>4|P<<12),u+=P>>>1&8191;var R=e[t+10]|e[t+11]<<8;f+=8191&(P>>>14|R<<2);var k=e[t+12]|e[t+13]<<8;l+=8191&(R>>>11|k<<5);var B=e[t+14]|e[t+15]<<8,x=0,M=x;M+=i*p,M+=o*(5*S),M+=s*(5*_),M+=a*(5*E),x=(M+=c*(5*w))>>>13,M&=8191,M+=u*(5*v),M+=f*(5*m),M+=l*(5*b),M+=(h+=8191&(k>>>8|B<<8))*(5*g);var O=x+=(M+=(d+=B>>>5|n)*(5*y))>>>13;O+=i*y,O+=o*p,O+=s*(5*S),O+=a*(5*_),x=(O+=c*(5*E))>>>13,O&=8191,O+=u*(5*w),O+=f*(5*v),O+=l*(5*m),O+=h*(5*b),x+=(O+=d*(5*g))>>>13,O&=8191;var N=x;N+=i*g,N+=o*y,N+=s*p,N+=a*(5*S),x=(N+=c*(5*_))>>>13,N&=8191,N+=u*(5*E),N+=f*(5*w),N+=l*(5*v),N+=h*(5*m);var L=x+=(N+=d*(5*b))>>>13;L+=i*b,L+=o*g,L+=s*y,L+=a*p,x=(L+=c*(5*S))>>>13,L&=8191,L+=u*(5*_),L+=f*(5*E),L+=l*(5*w),L+=h*(5*v);var D=x+=(L+=d*(5*m))>>>13;D+=i*m,D+=o*b,D+=s*g,D+=a*y,x=(D+=c*p)>>>13,D&=8191,D+=u*(5*S),D+=f*(5*_),D+=l*(5*E),D+=h*(5*w);var K=x+=(D+=d*(5*v))>>>13;K+=i*v,K+=o*m,K+=s*b,K+=a*g,x=(K+=c*y)>>>13,K&=8191,K+=u*p,K+=f*(5*S),K+=l*(5*_),K+=h*(5*E);var U=x+=(K+=d*(5*w))>>>13;U+=i*w,U+=o*v,U+=s*m,U+=a*b,x=(U+=c*g)>>>13,U&=8191,U+=u*y,U+=f*p,U+=l*(5*S),U+=h*(5*_);var j=x+=(U+=d*(5*E))>>>13;j+=i*E,j+=o*w,j+=s*v,j+=a*m,x=(j+=c*b)>>>13,j&=8191,j+=u*g,j+=f*y,j+=l*p,j+=h*(5*S);var V=x+=(j+=d*(5*_))>>>13;V+=i*_,V+=o*E,V+=s*w,V+=a*v,x=(V+=c*m)>>>13,V&=8191,V+=u*b,V+=f*g,V+=l*y,V+=h*p;var F=x+=(V+=d*(5*S))>>>13;F+=i*S,F+=o*_,F+=s*E,F+=a*w,x=(F+=c*v)>>>13,F&=8191,F+=u*m,F+=f*b,F+=l*g,F+=h*y,i=M=8191&(x=(x=((x+=(F+=d*p)>>>13)<<2)+x|0)+(M&=8191)|0),o=O+=x>>>=13,s=N&=8191,a=L&=8191,c=D&=8191,u=K&=8191,f=U&=8191,l=j&=8191,h=V&=8191,d=F&=8191,t+=16,r-=16}this._h[0]=i,this._h[1]=o,this._h[2]=s,this._h[3]=a,this._h[4]=c,this._h[5]=u,this._h[6]=f,this._h[7]=l,this._h[8]=h,this._h[9]=d},e.prototype.finish=function(e,t){void 0===t&&(t=0);var r,n,i,o,s=new Uint16Array(10);if(this._leftover){for(o=this._leftover,this._buffer[o++]=1;o<16;o++)this._buffer[o]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(r=this._h[1]>>>13,this._h[1]&=8191,o=2;o<10;o++)this._h[o]+=r,r=this._h[o]>>>13,this._h[o]&=8191;for(this._h[0]+=5*r,r=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=r,r=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=r,s[0]=this._h[0]+5,r=s[0]>>>13,s[0]&=8191,o=1;o<10;o++)s[o]=this._h[o]+r,r=s[o]>>>13,s[o]&=8191;for(s[9]-=8192,n=(1^r)-1,o=0;o<10;o++)s[o]&=n;for(n=~n,o=0;o<10;o++)this._h[o]=this._h[o]&n|s[o];for(this._h[0]=65535&(this._h[0]|this._h[1]<<13),this._h[1]=65535&(this._h[1]>>>3|this._h[2]<<10),this._h[2]=65535&(this._h[2]>>>6|this._h[3]<<7),this._h[3]=65535&(this._h[3]>>>9|this._h[4]<<4),this._h[4]=65535&(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14),this._h[5]=65535&(this._h[6]>>>2|this._h[7]<<11),this._h[6]=65535&(this._h[7]>>>5|this._h[8]<<8),this._h[7]=65535&(this._h[8]>>>8|this._h[9]<<5),i=this._h[0]+this._pad[0],this._h[0]=65535&i,o=1;o<8;o++)i=(this._h[o]+this._pad[o]|0)+(i>>>16)|0,this._h[o]=65535&i;return e[t+0]=this._h[0]>>>0,e[t+1]=this._h[0]>>>8,e[t+2]=this._h[1]>>>0,e[t+3]=this._h[1]>>>8,e[t+4]=this._h[2]>>>0,e[t+5]=this._h[2]>>>8,e[t+6]=this._h[3]>>>0,e[t+7]=this._h[3]>>>8,e[t+8]=this._h[4]>>>0,e[t+9]=this._h[4]>>>8,e[t+10]=this._h[5]>>>0,e[t+11]=this._h[5]>>>8,e[t+12]=this._h[6]>>>0,e[t+13]=this._h[6]>>>8,e[t+14]=this._h[7]>>>0,e[t+15]=this._h[7]>>>8,this._finished=!0,this},e.prototype.update=function(e){var t,r=0,n=e.length;if(this._leftover){(t=16-this._leftover)>n&&(t=n);for(var i=0;i=16&&(t=n-n%16,this._blocks(e,r,t),r+=t,n-=t),n){for(i=0;i{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(46008),i=r(98099),o=r(17309);function s(e,r){return void 0===r&&(r=t.defaultRandomSource),r.randomBytes(e)}t.defaultRandomSource=new n.SystemRandomSource,t.randomBytes=s,t.randomUint32=function(e){void 0===e&&(e=t.defaultRandomSource);var r=s(4,e),n=i.readUint32LE(r);return o.wipe(r),n};var a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function c(e,r,n){if(void 0===r&&(r=a),void 0===n&&(n=t.defaultRandomSource),r.length<2)throw new Error("randomString charset is too short");if(r.length>256)throw new Error("randomString charset is too long");for(var i="",c=r.length,u=256-256%c;e>0;){for(var f=s(Math.ceil(256*e/u),n),l=0;l0;l++){var h=f[l];h{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){this.isAvailable=!1,this.isInstantiated=!1;var e="undefined"!=typeof self?self.crypto||self.msCrypto:null;e&&e.getRandomValues&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}return e.prototype.randomBytes=function(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");for(var t=new Uint8Array(e),r=0;r{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(17309),i=function(){function e(){this.isAvailable=!1,this.isInstantiated=!1;var e=r(35883);e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}return e.prototype.randomBytes=function(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");var t=this._crypto.randomBytes(e);if(t.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");for(var r=new Uint8Array(e),i=0;i{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(75455),i=r(58871),o=function(){function e(){return this.isAvailable=!1,this.name="",this._source=new n.BrowserRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Browser")):(this._source=new i.NodeRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Node")):void 0)}return e.prototype.randomBytes=function(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)},e}();t.SystemRandomSource=o},73294:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(98099),i=r(17309);t.DIGEST_LENGTH=32,t.BLOCK_SIZE=64;var o=function(){function e(){this.digestLength=t.DIGEST_LENGTH,this.blockSize=t.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return e.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},e.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},e.prototype.clean=function(){i.wipe(this._buffer),i.wipe(this._temp),this.reset()},e.prototype.update=function(e,t){if(void 0===t&&(t=e.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var r=0;if(this._bytesHashed+=t,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[r++],t--;this._bufferLength===this.blockSize&&(a(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(t>=this.blockSize&&(r=a(this._temp,this._state,e,r,t),t%=this.blockSize);t>0;)this._buffer[this._bufferLength++]=e[r++],t--;return this},e.prototype.finish=function(e){if(!this._finished){var t=this._bytesHashed,r=this._bufferLength,i=t/536870912|0,o=t<<3,s=t%64<56?64:128;this._buffer[r]=128;for(var c=r+1;c0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},e.prototype.restoreState=function(e){return this._state.set(e.state),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},e.prototype.cleanSavedState=function(e){i.wipe(e.state),e.buffer&&i.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},e}();t.SHA256=o;var s=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function a(e,t,r,i,o){for(;o>=64;){for(var a=t[0],c=t[1],u=t[2],f=t[3],l=t[4],h=t[5],d=t[6],p=t[7],y=0;y<16;y++){var g=i+4*y;e[y]=n.readUint32BE(r,g)}for(y=16;y<64;y++){var b=e[y-2],m=(b>>>17|b<<15)^(b>>>19|b<<13)^b>>>10,v=((b=e[y-15])>>>7|b<<25)^(b>>>18|b<<14)^b>>>3;e[y]=(m+e[y-7]|0)+(v+e[y-16]|0)}for(y=0;y<64;y++)m=(((l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7))+(l&h^~l&d)|0)+(p+(s[y]+e[y]|0)|0)|0,v=((a>>>2|a<<30)^(a>>>13|a<<19)^(a>>>22|a<<10))+(a&c^a&u^c&u)|0,p=d,d=h,h=l,l=f+m|0,f=u,u=c,c=a,a=m+v|0;t[0]+=a,t[1]+=c,t[2]+=u,t[3]+=f,t[4]+=l,t[5]+=h,t[6]+=d,t[7]+=p,i+=64,o-=64}return i}t.hash=function(e){var t=new o;t.update(e);var r=t.digest();return t.clean(),r}},17309:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.wipe=function(e){for(var t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(31416),i=r(17309);function o(e){var t=new Float64Array(16);if(e)for(var r=0;r=0;--m){var v=r[m>>>3]>>>(7&m)&1;u(i,s,v),u(p,y,v),f(g,i,p),l(i,i,p),f(p,s,y),l(s,s,y),d(y,g),d(b,i),h(i,p,i),h(p,s,g),f(g,i,p),l(i,i,p),d(s,i),l(p,y,b),h(i,p,a),f(i,i,y),h(p,p,i),h(i,y,b),h(y,s,n),d(s,g),u(i,s,v),u(p,y,v)}for(m=0;m<16;m++)n[m+16]=i[m],n[m+32]=p[m],n[m+48]=s[m],n[m+64]=y[m];var w=n.subarray(32),E=n.subarray(16);!function(e,t){for(var r=o(),n=0;n<16;n++)r[n]=t[n];for(n=253;n>=0;n--)d(r,r),2!==n&&4!==n&&h(r,r,t);for(n=0;n<16;n++)e[n]=r[n]}(w,w),h(E,E,w);var _=new Uint8Array(32);return function(e,t){for(var r=o(),n=o(),i=0;i<16;i++)n[i]=t[i];c(n),c(n),c(n);for(var s=0;s<2;s++){for(r[0]=n[0]-65517,i=1;i<15;i++)r[i]=n[i]-65535-(r[i-1]>>16&1),r[i-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);var a=r[15]>>16&1;r[14]&=65535,u(n,r,1-a)}for(i=0;i<16;i++)e[2*i]=255&n[i],e[2*i+1]=n[i]>>8}(_,E),_}function y(e){return p(e,s)}function g(e){if(e.length!==t.SECRET_KEY_LENGTH)throw new Error("x25519: seed must be "+t.SECRET_KEY_LENGTH+" bytes");var r=new Uint8Array(e);return{publicKey:y(r),secretKey:r}}t.scalarMult=p,t.scalarMultBase=y,t.generateKeyPairFromSeed=g,t.generateKeyPair=function(e){var t=n.randomBytes(32,e),r=g(t);return i.wipe(t),r},t.sharedKey=function(e,r,n){if(void 0===n&&(n=!1),e.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(r.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");var i=p(e,r);if(n){for(var o=0,s=0;s{"use strict";const r=Math.exp;e.exports=function(e){if("number"!=typeof e)throw new Error("must provide a timespan to the moving average constructor");if(e<=0)throw new Error("must provide a timespan > 0 to the moving average constructor");let t,n,i=0,o=0,s=0,a={push:function(a,c){if(n){const u=1-r(-(a-n)/e),f=c-t;t=u*c+(1-u)*t,i=(1-u)*(i+f*(u*f)),o=Math.sqrt(i),s=t+u*f}else t=c;n=a},movingAverage:function(){return t},variance:function(){return i},deviation:function(){return o},forecast:function(){return s}};return a}},28599:e=>{"use strict";const{AbortController:t,AbortSignal:r}="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0;e.exports=t,e.exports.AbortSignal=r,e.exports.default=t},42235:e=>{e.exports=class extends Error{constructor(e,t){super(e||"The operation was aborted"),this.type="aborted",this.code=t||"ABORT_ERR"}}},61623:(e,t,r)=>{const n=r(22412),i=r(42235),o=(e,t,r)=>s(e,Array.isArray(t)?t:[{signal:t,options:r}]),s=(e,t)=>(e=n(e),t=t.map((({signal:e,options:t})=>({signal:e,options:t||{}}))),async function*(){let r;const n=()=>{r&&r()};for(const{signal:e}of t)e.addEventListener("abort",n);for(;;){let o;try{for(const{signal:e,options:r}of t)if(e.aborted){const{abortMessage:e,abortCode:t}=r;throw new i(e,t)}const n=new Promise(((e,n)=>{r=()=>{const{options:e}=t.find((({signal:e})=>e.aborted)),{abortMessage:r,abortCode:o}=e;n(new i(r,o))}}));o=await Promise.race([n,e.next()]),r=null}catch(r){for(const{signal:e}of t)e.removeEventListener("abort",n);const i=t.find((({signal:e})=>e.aborted)),o="aborted"===r.type&&i;if(o&&i.options.onAbort&&await i.options.onAbort(e),"function"==typeof e.return)try{const t=e.return();t instanceof Promise&&t.catch((e=>{null!=i.options.onReturnError&&i.options.onReturnError(e)}))}catch(e){null!=i.options.onReturnError&&i.options.onReturnError(e)}if(o&&i.options.returnOnAbort)return;throw r}if(o.done)break;yield o.value}for(const{signal:e}of t)e.removeEventListener("abort",n)}()),a=(e,t,r)=>c(e,Array.isArray(t)?t:[{signal:t,options:r}]),c=(e,t)=>r=>e(s(r,t));e.exports=o,e.exports.AbortError=i,e.exports.source=o,e.exports.sink=a,e.exports.transform=a,e.exports.duplex=(e,t,r)=>((e,t)=>({sink:c(e.sink,t),source:s(e.source,t)}))(e,Array.isArray(t)?t:[{signal:t,options:r}])},56455:(e,t,r)=>{"use strict";const n=r(95602),i=r(75281);class o extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError("Expected input to be an Array, got "+typeof e);let t=(e=[...e].map((e=>e instanceof Error?e:null!==e&&"object"==typeof e?Object.assign(new Error(e.message),e):new Error(e)))).map((e=>"string"==typeof e.stack?i(e.stack).replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g,""):String(e))).join("\n");t="\n"+n(t,4),super(t),this.name="AggregateError",Object.defineProperty(this,"_errors",{value:e})}*[Symbol.iterator](){for(const e of this._errors)yield e}}e.exports=o},32044:(e,t,r)=>{const{AbortController:n}=r(35353);function i(e){const t=new n;function r(){t.abort();for(const t of e)t&&t.removeEventListener&&t.removeEventListener("abort",r)}for(const t of e)if(t&&t.addEventListener){if(t.aborted){r();break}t.addEventListener("abort",r)}return t.signal}e.exports=i,e.exports.anySignal=i},58162:(e,t,r)=>{"use strict";var n=r(89509).Buffer;e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r>>0,f=new Uint8Array(s);e[r];){var l=t[e.charCodeAt(r)];if(255===l)return;for(var h=0,d=s-1;(0!==l||h>>0,f[d]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");o=h,r++}for(var p=s-o;p!==s&&0===f[p];)p++;var y=n.allocUnsafe(i+(s-p));y.fill(0,0,i);for(var g=i;p!==s;)y[g++]=f[p++];return y}return{encode:function(t){if((Array.isArray(t)||t instanceof Uint8Array)&&(t=n.from(t)),!n.isBuffer(t))throw new TypeError("Expected Buffer");if(0===t.length)return"";for(var r=0,i=0,o=0,s=t.length;o!==s&&0===t[o];)o++,r++;for(var u=(s-o)*f+1>>>0,l=new Uint8Array(u);o!==s;){for(var h=t[o],d=0,p=u-1;(0!==h||d>>0,l[p]=h%a>>>0,h=h/a>>>0;if(0!==h)throw new Error("Non-zero carry");i=d,o++}for(var y=u-i;y!==u&&0===l[y];)y++;for(var g=c.repeat(r);y{"use strict";t.byteLength=function(e){var t=c(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,o=c(e),s=o[0],a=o[1],u=new i(function(e,t,r){return 3*(t+r)/4-r}(0,s,a)),f=0,l=a>0?s-4:s;for(r=0;r>16&255,u[f++]=t>>8&255,u[f++]=255&t;return 2===a&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[f++]=255&t),1===a&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[f++]=t>>8&255,u[f++]=255&t),u},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],s=16383,a=0,c=n-i;ac?c:a+s));return 1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),o.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,a=o.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function u(e,t,n){for(var i,o,s=[],a=t;a>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},44431:function(e,t,r){var n;!function(i){"use strict";var o,s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,c=Math.floor,u="[BigNumber Error] ",f=u+"Number primitive has more than 15 significant digits: ",l=1e14,h=14,d=9007199254740991,p=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],y=1e7,g=1e9;function b(e){var t=0|e;return e>0||e===t?t:t-1}function m(e){for(var t,r,n=1,i=e.length,o=e[0]+"";nu^r?1:-1;for(a=(c=i.length)<(u=o.length)?c:u,s=0;so[s]^r?1:-1;return c==u?0:c>u^r?1:-1}function w(e,t,r,n){if(er||e!==c(e))throw Error(u+(n||"Argument")+("number"==typeof e?er?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function E(e){var t=e.c.length-1;return b(e.e/h)==t&&e.c[t]%2!=0}function _(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function S(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(++t>(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else tD?b.c=b.e=null:e.e=10;l/=10,u++);return void(u>D?b.c=b.e=null:(b.e=u,b.c=[e]))}g=String(e)}else{if(!s.test(g=String(e)))return i(b,g,p);b.s=45==g.charCodeAt(0)?(g=g.slice(1),-1):1}(u=g.indexOf("."))>-1&&(g=g.replace(".","")),(l=g.search(/e/i))>0?(u<0&&(u=l),u+=+g.slice(l+1),g=g.substring(0,l)):u<0&&(u=g.length)}else{if(w(t,2,F.length,"Base"),10==t&&q)return W(b=new H(e),x+b.e+1,M);if(g=String(e),p="number"==typeof e){if(0*e!=0)return i(b,g,p,t);if(b.s=1/e<0?(g=g.slice(1),-1):1,H.DEBUG&&g.replace(/^0\.0*|\./,"").length>15)throw Error(f+e)}else b.s=45===g.charCodeAt(0)?(g=g.slice(1),-1):1;for(r=F.slice(0,t),u=l=0,y=g.length;lu){u=y;continue}}else if(!a&&(g==g.toUpperCase()&&(g=g.toLowerCase())||g==g.toLowerCase()&&(g=g.toUpperCase()))){a=!0,l=-1,u=0;continue}return i(b,String(e),p,t)}p=!1,(u=(g=n(g,t,10,b.s)).indexOf("."))>-1?g=g.replace(".",""):u=g.length}for(l=0;48===g.charCodeAt(l);l++);for(y=g.length;48===g.charCodeAt(--y););if(g=g.slice(l,++y)){if(y-=l,p&&H.DEBUG&&y>15&&(e>d||e!==c(e)))throw Error(f+b.s*e);if((u=u-l-1)>D)b.c=b.e=null;else if(u=N)?_(c,s):S(c,s,"0");else if(o=(e=W(new H(e),t,r)).e,a=(c=m(e.c)).length,1==n||2==n&&(t<=o||o<=O)){for(;aa){if(--t>0)for(c+=".";t--;c+="0");}else if((t+=o-a)>0)for(o+1==a&&(c+=".");t--;c+="0");return e.s<0&&i?"-"+c:c}function $(e,t){for(var r,n=1,i=new H(e[0]);n=10;i/=10,n++);return(r=n+r*h-1)>D?e.c=e.e=null:r=10;u/=10,i++);if((o=t-i)<0)o+=h,s=t,y=(f=g[d=0])/b[i-s-1]%10|0;else if((d=a((o+1)/h))>=g.length){if(!n)break e;for(;g.length<=d;g.push(0));f=y=0,i=1,s=(o%=h)-h+1}else{for(f=u=g[d],i=1;u>=10;u/=10,i++);y=(s=(o%=h)-h+i)<0?0:f/b[i-s-1]%10|0}if(n=n||t<0||null!=g[d+1]||(s<0?f:f%b[i-s-1]),n=r<4?(y||n)&&(0==r||r==(e.s<0?3:2)):y>5||5==y&&(4==r||n||6==r&&(o>0?s>0?f/b[i-s]:0:g[d-1])%10&1||r==(e.s<0?8:7)),t<1||!g[0])return g.length=0,n?(t-=e.e+1,g[0]=b[(h-t%h)%h],e.e=-t||0):g[0]=e.e=0,e;if(0==o?(g.length=d,u=1,d--):(g.length=d+1,u=b[h-o],g[d]=s>0?c(f/b[i-s]%b[s])*u:0),n)for(;;){if(0==d){for(o=1,s=g[0];s>=10;s/=10,o++);for(s=g[0]+=u,u=1;s>=10;s/=10,u++);o!=u&&(e.e++,g[0]==l&&(g[0]=1));break}if(g[d]+=u,g[d]!=l)break;g[d--]=0,u=1}for(o=g.length;0===g[--o];g.pop());}e.e>D?e.c=e.e=null:e.e=N?_(t,r):S(t,r,"0"),e.s<0?"-"+t:t)}return H.clone=e,H.ROUND_UP=0,H.ROUND_DOWN=1,H.ROUND_CEIL=2,H.ROUND_FLOOR=3,H.ROUND_HALF_UP=4,H.ROUND_HALF_DOWN=5,H.ROUND_HALF_EVEN=6,H.ROUND_HALF_CEIL=7,H.ROUND_HALF_FLOOR=8,H.EUCLID=9,H.config=H.set=function(e){var t,r;if(null!=e){if("object"!=typeof e)throw Error(u+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(w(r=e[t],0,g,t),x=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(w(r=e[t],0,8,t),M=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(w(r[0],-g,0,t),w(r[1],0,g,t),O=r[0],N=r[1]):(w(r,-g,g,t),O=-(N=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)w(r[0],-g,-1,t),w(r[1],1,g,t),L=r[0],D=r[1];else{if(w(r,-g,g,t),!r)throw Error(u+t+" cannot be zero: "+r);L=-(D=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(u+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw K=!r,Error(u+"crypto unavailable");K=r}else K=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(w(r=e[t],0,9,t),U=r),e.hasOwnProperty(t="POW_PRECISION")&&(w(r=e[t],0,g,t),j=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(u+t+" not an object: "+r);V=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(u+t+" invalid: "+r);q="0123456789"==r.slice(0,10),F=r}}return{DECIMAL_PLACES:x,ROUNDING_MODE:M,EXPONENTIAL_AT:[O,N],RANGE:[L,D],CRYPTO:K,MODULO_MODE:U,POW_PRECISION:j,FORMAT:V,ALPHABET:F}},H.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!H.DEBUG)return!0;var t,r,n=e.c,i=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===o||-1===o)&&i>=-g&&i<=g&&i===c(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break e}if((t=(i+1)%h)<1&&(t+=h),String(n[0]).length==t){for(t=0;t=l||r!==c(r))break e;if(0!==r)return!0}}}else if(null===n&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(u+"Invalid BigNumber: "+e)},H.maximum=H.max=function(){return $(arguments,k.lt)},H.minimum=H.min=function(){return $(arguments,k.gt)},H.random=(o=9007199254740992,A=Math.random()*o&2097151?function(){return c(Math.random()*o)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,i,o,s=0,f=[],l=new H(B);if(null==e?e=x:w(e,0,g),i=a(e/h),K)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));s>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[s]=r[0],t[s+1]=r[1]):(f.push(o%1e14),s+=2);s=i/2}else{if(!crypto.randomBytes)throw K=!1,Error(u+"crypto unavailable");for(t=crypto.randomBytes(i*=7);s=9e15?crypto.randomBytes(7).copy(t,s):(f.push(o%1e14),s+=7);s=i/7}if(!K)for(;s=10;o/=10,s++);sr-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/r|0,s[i]%=r)}return s.reverse()}return function(n,i,o,s,a){var c,u,f,l,h,d,p,y,g=n.indexOf("."),b=x,v=M;for(g>=0&&(l=j,j=0,n=n.replace(".",""),d=(y=new H(i)).pow(n.length-g),j=l,y.c=t(S(m(d.c),d.e,"0"),10,o,e),y.e=y.c.length),f=l=(p=t(n,i,o,a?(c=F,e):(c=e,F))).length;0==p[--l];p.pop());if(!p[0])return c.charAt(0);if(g<0?--f:(d.c=p,d.e=f,d.s=s,p=(d=r(d,y,b,v,o)).c,h=d.r,f=d.e),g=p[u=f+b+1],l=o/2,h=h||u<0||null!=p[u+1],h=v<4?(null!=g||h)&&(0==v||v==(d.s<0?3:2)):g>l||g==l&&(4==v||h||6==v&&1&p[u-1]||v==(d.s<0?8:7)),u<1||!p[0])n=h?S(c.charAt(1),-b,c.charAt(0)):c.charAt(0);else{if(p.length=u,h)for(--o;++p[--u]>o;)p[u]=0,u||(++f,p=[1].concat(p));for(l=p.length;!p[--l];);for(g=0,n="";g<=l;n+=c.charAt(p[g++]));n=S(n,f,c.charAt(0))}return n}}(),r=function(){function e(e,t,r){var n,i,o,s,a=0,c=e.length,u=t%y,f=t/y|0;for(e=e.slice();c--;)a=((i=u*(o=e[c]%y)+(n=f*o+(s=e[c]/y|0)*u)%y*y+a)/r|0)+(n/y|0)+f*s,e[c]=i%r;return a&&(e=[a].concat(e)),e}function t(e,t,r,n){var i,o;if(r!=n)o=r>n?1:-1;else for(i=o=0;it[i]?1:-1;break}return o}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]1;e.splice(0,1));}return function(n,i,o,s,a){var u,f,d,p,y,g,m,v,w,E,_,S,A,T,I,C,P,R=n.s==i.s?1:-1,k=n.c,B=i.c;if(!(k&&k[0]&&B&&B[0]))return new H(n.s&&i.s&&(k?!B||k[0]!=B[0]:B)?k&&0==k[0]||!B?0*R:R/0:NaN);for(w=(v=new H(R)).c=[],R=o+(f=n.e-i.e)+1,a||(a=l,f=b(n.e/h)-b(i.e/h),R=R/h|0),d=0;B[d]==(k[d]||0);d++);if(B[d]>(k[d]||0)&&f--,R<0)w.push(1),p=!0;else{for(T=k.length,C=B.length,d=0,R+=2,(y=c(a/(B[0]+1)))>1&&(B=e(B,y,a),k=e(k,y,a),C=B.length,T=k.length),A=C,_=(E=k.slice(0,C)).length;_=a/2&&I++;do{if(y=0,(u=t(B,E,C,_))<0){if(S=E[0],C!=_&&(S=S*a+(E[1]||0)),(y=c(S/I))>1)for(y>=a&&(y=a-1),m=(g=e(B,y,a)).length,_=E.length;1==t(g,E,m,_);)y--,r(g,C=10;R/=10,d++);W(v,o+(v.e=d+f*h-1)+1,s,p)}else v.e=f,v.r=+p;return v}}(),T=/^(-?)0([xbo])(?=\w[\w.]*$)/i,I=/^([^.]+)\.$/,C=/^\.([^.]+)$/,P=/^-?(Infinity|NaN)$/,R=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(e,t,r,n){var i,o=r?t:t.replace(R,"");if(P.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!r&&(o=o.replace(T,(function(e,t,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?e:t})),n&&(i=n,o=o.replace(I,"$1").replace(C,"0.$1")),t!=o))return new H(o,i);if(H.DEBUG)throw Error(u+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},k.absoluteValue=k.abs=function(){var e=new H(this);return e.s<0&&(e.s=1),e},k.comparedTo=function(e,t){return v(this,new H(e,t))},k.decimalPlaces=k.dp=function(e,t){var r,n,i,o=this;if(null!=e)return w(e,0,g),null==t?t=M:w(t,0,8),W(new H(o),e+o.e+1,t);if(!(r=o.c))return null;if(n=((i=r.length-1)-b(this.e/h))*h,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},k.dividedBy=k.div=function(e,t){return r(this,new H(e,t),x,M)},k.dividedToIntegerBy=k.idiv=function(e,t){return r(this,new H(e,t),0,1)},k.exponentiatedBy=k.pow=function(e,t){var r,n,i,o,s,f,l,d,p=this;if((e=new H(e)).c&&!e.isInteger())throw Error(u+"Exponent not an integer: "+Y(e));if(null!=t&&(t=new H(t)),s=e.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!e.c||!e.c[0])return d=new H(Math.pow(+Y(p),s?2-E(e):+Y(e))),t?d.mod(t):d;if(f=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new H(NaN);(n=!f&&p.isInteger()&&t.isInteger())&&(p=p.mod(t))}else{if(e.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||s&&p.c[1]>=24e7:p.c[0]<8e13||s&&p.c[0]<=9999975e7)))return o=p.s<0&&E(e)?-0:0,p.e>-1&&(o=1/o),new H(f?1/o:o);j&&(o=a(j/h+2))}for(s?(r=new H(.5),f&&(e.s=1),l=E(e)):l=(i=Math.abs(+Y(e)))%2,d=new H(B);;){if(l){if(!(d=d.times(p)).c)break;o?d.c.length>o&&(d.c.length=o):n&&(d=d.mod(t))}if(i){if(0===(i=c(i/2)))break;l=i%2}else if(W(e=e.times(r),e.e+1,1),e.e>14)l=E(e);else{if(0==(i=+Y(e)))break;l=i%2}p=p.times(p),o?p.c&&p.c.length>o&&(p.c.length=o):n&&(p=p.mod(t))}return n?d:(f&&(d=B.div(d)),t?d.mod(t):o?W(d,j,M,void 0):d)},k.integerValue=function(e){var t=new H(this);return null==e?e=M:w(e,0,8),W(t,t.e+1,e)},k.isEqualTo=k.eq=function(e,t){return 0===v(this,new H(e,t))},k.isFinite=function(){return!!this.c},k.isGreaterThan=k.gt=function(e,t){return v(this,new H(e,t))>0},k.isGreaterThanOrEqualTo=k.gte=function(e,t){return 1===(t=v(this,new H(e,t)))||0===t},k.isInteger=function(){return!!this.c&&b(this.e/h)>this.c.length-2},k.isLessThan=k.lt=function(e,t){return v(this,new H(e,t))<0},k.isLessThanOrEqualTo=k.lte=function(e,t){return-1===(t=v(this,new H(e,t)))||0===t},k.isNaN=function(){return!this.s},k.isNegative=function(){return this.s<0},k.isPositive=function(){return this.s>0},k.isZero=function(){return!!this.c&&0==this.c[0]},k.minus=function(e,t){var r,n,i,o,s=this,a=s.s;if(t=(e=new H(e,t)).s,!a||!t)return new H(NaN);if(a!=t)return e.s=-t,s.plus(e);var c=s.e/h,u=e.e/h,f=s.c,d=e.c;if(!c||!u){if(!f||!d)return f?(e.s=-t,e):new H(d?s:NaN);if(!f[0]||!d[0])return d[0]?(e.s=-t,e):new H(f[0]?s:3==M?-0:0)}if(c=b(c),u=b(u),f=f.slice(),a=c-u){for((o=a<0)?(a=-a,i=f):(u=c,i=d),i.reverse(),t=a;t--;i.push(0));i.reverse()}else for(n=(o=(a=f.length)<(t=d.length))?a:t,a=t=0;t0)for(;t--;f[r++]=0);for(t=l-1;n>a;){if(f[--n]=0;){for(r=0,p=S[i]%w,g=S[i]/w|0,o=i+(s=c);o>i;)r=((u=p*(u=_[--s]%w)+(a=g*u+(f=_[s]/w|0)*p)%w*w+m[o]+r)/v|0)+(a/w|0)+g*f,m[o--]=u%v;m[o]=r}return r?++n:m.splice(0,1),G(e,m,n)},k.negated=function(){var e=new H(this);return e.s=-e.s||null,e},k.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new H(e,t)).s,!i||!t)return new H(NaN);if(i!=t)return e.s=-t,n.minus(e);var o=n.e/h,s=e.e/h,a=n.c,c=e.c;if(!o||!s){if(!a||!c)return new H(i/0);if(!a[0]||!c[0])return c[0]?e:new H(a[0]?n:0*i)}if(o=b(o),s=b(s),a=a.slice(),i=o-s){for(i>0?(s=o,r=c):(i=-i,r=a),r.reverse();i--;r.push(0));r.reverse()}for((i=a.length)-(t=c.length)<0&&(r=c,c=a,a=r,t=i),i=0;t;)i=(a[--t]=a[t]+c[t]+i)/l|0,a[t]=l===a[t]?0:a[t]%l;return i&&(a=[i].concat(a),++s),G(e,a,s)},k.precision=k.sd=function(e,t){var r,n,i,o=this;if(null!=e&&e!==!!e)return w(e,1,g),null==t?t=M:w(t,0,8),W(new H(o),e,t);if(!(r=o.c))return null;if(n=(i=r.length-1)*h+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&o.e+1>n&&(n=o.e+1),n},k.shiftedBy=function(e){return w(e,-9007199254740991,d),this.times("1e"+e)},k.squareRoot=k.sqrt=function(){var e,t,n,i,o,s=this,a=s.c,c=s.s,u=s.e,f=x+4,l=new H("0.5");if(1!==c||!a||!a[0])return new H(!c||c<0&&(!a||a[0])?NaN:a?s:1/0);if(0==(c=Math.sqrt(+Y(s)))||c==1/0?(((t=m(a)).length+u)%2==0&&(t+="0"),c=Math.sqrt(+t),u=b((u+1)/2)-(u<0||u%2),n=new H(t=c==1/0?"5e"+u:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+u)):n=new H(c+""),n.c[0])for((c=(u=n.e)+f)<3&&(c=0);;)if(o=n,n=l.times(o.plus(r(s,o,f,1))),m(o.c).slice(0,c)===(t=m(n.c)).slice(0,c)){if(n.e0&&y>0){for(o=y%a||a,l=p.substr(0,o);o0&&(l+=f+p.slice(o)),d&&(l="-"+l)}n=h?l+(r.decimalSeparator||"")+((c=+r.fractionGroupSize)?h.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):h):l}return(r.prefix||"")+n+(r.suffix||"")},k.toFraction=function(e){var t,n,i,o,s,a,c,f,l,d,y,g,b=this,v=b.c;if(null!=e&&(!(c=new H(e)).isInteger()&&(c.c||1!==c.s)||c.lt(B)))throw Error(u+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+Y(c));if(!v)return new H(b);for(t=new H(B),l=n=new H(B),i=f=new H(B),g=m(v),s=t.e=g.length-b.e-1,t.c[0]=p[(a=s%h)<0?h+a:a],e=!e||c.comparedTo(t)>0?s>0?t:l:c,a=D,D=1/0,c=new H(g),f.c[0]=0;d=r(c,t,0,1),1!=(o=n.plus(d.times(i))).comparedTo(e);)n=i,i=o,l=f.plus(d.times(o=l)),f=o,t=c.minus(d.times(o=t)),c=o;return o=r(e.minus(n),i,0,1),f=f.plus(o.times(l)),n=n.plus(o.times(i)),f.s=l.s=b.s,y=r(l,i,s*=2,M).minus(b).abs().comparedTo(r(f,n,s,M).minus(b).abs())<1?[l,i]:[f,n],D=a,y},k.toNumber=function(){return+Y(this)},k.toPrecision=function(e,t){return null!=e&&w(e,1,g),z(this,e,t,2)},k.toString=function(e){var t,r=this,i=r.s,o=r.e;return null===o?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(null==e?t=o<=O||o>=N?_(m(r.c),o):S(m(r.c),o,"0"):10===e&&q?t=S(m((r=W(new H(r),x+o+1,M)).c),r.e,"0"):(w(e,2,F.length,"Base"),t=n(S(m(r.c),o,"0"),10,e,i,!0)),i<0&&r.c[0]&&(t="-"+t)),t},k.valueOf=k.toJSON=function(){return Y(this)},k._isBigNumber=!0,null!=t&&H.set(t),H}(),o.default=o.BigNumber=o,void 0===(n=function(){return o}.call(t,r,t,e))||(e.exports=n)}()},9668:(e,t,r)=>{"use strict";const{Buffer:n}=r(48764),i=Symbol.for("BufferList");function o(e){if(!(this instanceof o))return new o(e);o._init.call(this,e)}o._init=function(e){Object.defineProperty(this,i,{value:!0}),this._bufs=[],this.length=0,e&&this.append(e)},o.prototype._new=function(e){return new o(e)},o.prototype._offset=function(e){if(0===e)return[0,0];let t=0;for(let r=0;rthis.length||e<0)return;const t=this._offset(e);return this._bufs[t[0]][t[1]]},o.prototype.slice=function(e,t){return"number"==typeof e&&e<0&&(e+=this.length),"number"==typeof t&&t<0&&(t+=this.length),this.copy(null,0,e,t)},o.prototype.copy=function(e,t,r,i){if(("number"!=typeof r||r<0)&&(r=0),("number"!=typeof i||i>this.length)&&(i=this.length),r>=this.length)return e||n.alloc(0);if(i<=0)return e||n.alloc(0);const o=!!e,s=this._offset(r),a=i-r;let c=a,u=o&&t||0,f=s[1];if(0===r&&i===this.length){if(!o)return 1===this._bufs.length?this._bufs[0]:n.concat(this._bufs,this.length);for(let t=0;tr)){this._bufs[t].copy(e,u,f,f+c),u+=r;break}this._bufs[t].copy(e,u,f),u+=r,c-=r,f&&(f=0)}return e.length>u?e.slice(0,u):e},o.prototype.shallowSlice=function(e,t){if(e=e||0,t="number"!=typeof t?this.length:t,e<0&&(e+=this.length),t<0&&(t+=this.length),e===t)return this._new();const r=this._offset(e),n=this._offset(t),i=this._bufs.slice(r[0],n[0]+1);return 0===n[1]?i.pop():i[i.length-1]=i[i.length-1].slice(0,n[1]),0!==r[1]&&(i[0]=i[0].slice(r[1])),this._new(i)},o.prototype.toString=function(e,t,r){return this.slice(t,r).toString(e)},o.prototype.consume=function(e){if(e=Math.trunc(e),Number.isNaN(e)||e<=0)return this;for(;this._bufs.length;){if(!(e>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},o.prototype.duplicate=function(){const e=this._new();for(let t=0;tthis.length?this.length:t;const i=this._offset(t);let o=i[0],s=i[1];for(;o=e.length){const r=t.indexOf(e,s);if(-1!==r)return this._reverseOffset([o,r]);s=t.length-e.length+1}else{const t=this._reverseOffset([o,s]);if(this._match(t,e))return t;s++}s=0}return-1},o.prototype._match=function(e,t){if(this.length-e=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function c(e,t,r){var n=a(e,r);return r-1>=t&&(n|=a(e,r-1)<<4),n}function u(e,t,r,n){for(var i=0,o=Math.min(e.length,r),s=t;s=49?a-49+10:a>=17?a-17+10:a}return i}o.isBN=function(e){return e instanceof o||null!==e&&"object"==typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)s=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=s<>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,o++);return this.strip()},o.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n=t;n-=2)i=c(e,t,n)<=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;else for(n=(e.length-t)%2==0?t+1:t;n=18?(o-=18,s+=1,this.words[s]|=i>>>26):o+=8;this.strip()},o.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var o=e.length-r,s=o%n,a=Math.min(o,o-s)+r,c=0,f=r;f1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,c=s/67108864|0;r.words[0]=a;for(var u=1;u>>26,l=67108863&c,h=Math.min(u,t.length-1),d=Math.max(0,u-e.length+1);d<=h;d++){var p=u-d|0;f+=(s=(i=0|e.words[p])*(o=0|t.words[d])+l)/67108864|0,l=67108863&s}r.words[u]=0|l,c=0|f}return 0!==c?r.words[u]=0|c:r.length--,r.strip()}o.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,o=0,s=0;s>>24-i&16777215)||s!==this.length-1?f[6-c.length]+c+r:c+r,(i+=2)>=26&&(i-=26,s--)}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var u=l[e],d=h[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var y=p.modn(d).toString(e);r=(p=p.idivn(d)).isZero()?y+r:f[u-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(e,t){return n(void 0!==s),this.toArrayLike(s,e,t)},o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var s,a,c="le"===t,u=new e(o),f=this.clone();if(c){for(a=0;!f.isZero();a++)s=f.andln(255),f.iushrn(8),u[a]=s;for(;a=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var o=0,s=0;s>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,d=0|s[1],p=8191&d,y=d>>>13,g=0|s[2],b=8191&g,m=g>>>13,v=0|s[3],w=8191&v,E=v>>>13,_=0|s[4],S=8191&_,A=_>>>13,T=0|s[5],I=8191&T,C=T>>>13,P=0|s[6],R=8191&P,k=P>>>13,B=0|s[7],x=8191&B,M=B>>>13,O=0|s[8],N=8191&O,L=O>>>13,D=0|s[9],K=8191&D,U=D>>>13,j=0|a[0],V=8191&j,F=j>>>13,q=0|a[1],H=8191&q,z=q>>>13,$=0|a[2],G=8191&$,W=$>>>13,Y=0|a[3],X=8191&Y,Q=Y>>>13,J=0|a[4],Z=8191&J,ee=J>>>13,te=0|a[5],re=8191&te,ne=te>>>13,ie=0|a[6],oe=8191&ie,se=ie>>>13,ae=0|a[7],ce=8191&ae,ue=ae>>>13,fe=0|a[8],le=8191&fe,he=fe>>>13,de=0|a[9],pe=8191&de,ye=de>>>13;r.negative=e.negative^t.negative,r.length=19;var ge=(u+(n=Math.imul(l,V))|0)+((8191&(i=(i=Math.imul(l,F))+Math.imul(h,V)|0))<<13)|0;u=((o=Math.imul(h,F))+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(p,V),i=(i=Math.imul(p,F))+Math.imul(y,V)|0,o=Math.imul(y,F);var be=(u+(n=n+Math.imul(l,H)|0)|0)+((8191&(i=(i=i+Math.imul(l,z)|0)+Math.imul(h,H)|0))<<13)|0;u=((o=o+Math.imul(h,z)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(b,V),i=(i=Math.imul(b,F))+Math.imul(m,V)|0,o=Math.imul(m,F),n=n+Math.imul(p,H)|0,i=(i=i+Math.imul(p,z)|0)+Math.imul(y,H)|0,o=o+Math.imul(y,z)|0;var me=(u+(n=n+Math.imul(l,G)|0)|0)+((8191&(i=(i=i+Math.imul(l,W)|0)+Math.imul(h,G)|0))<<13)|0;u=((o=o+Math.imul(h,W)|0)+(i>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(w,V),i=(i=Math.imul(w,F))+Math.imul(E,V)|0,o=Math.imul(E,F),n=n+Math.imul(b,H)|0,i=(i=i+Math.imul(b,z)|0)+Math.imul(m,H)|0,o=o+Math.imul(m,z)|0,n=n+Math.imul(p,G)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,W)|0;var ve=(u+(n=n+Math.imul(l,X)|0)|0)+((8191&(i=(i=i+Math.imul(l,Q)|0)+Math.imul(h,X)|0))<<13)|0;u=((o=o+Math.imul(h,Q)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(S,V),i=(i=Math.imul(S,F))+Math.imul(A,V)|0,o=Math.imul(A,F),n=n+Math.imul(w,H)|0,i=(i=i+Math.imul(w,z)|0)+Math.imul(E,H)|0,o=o+Math.imul(E,z)|0,n=n+Math.imul(b,G)|0,i=(i=i+Math.imul(b,W)|0)+Math.imul(m,G)|0,o=o+Math.imul(m,W)|0,n=n+Math.imul(p,X)|0,i=(i=i+Math.imul(p,Q)|0)+Math.imul(y,X)|0,o=o+Math.imul(y,Q)|0;var we=(u+(n=n+Math.imul(l,Z)|0)|0)+((8191&(i=(i=i+Math.imul(l,ee)|0)+Math.imul(h,Z)|0))<<13)|0;u=((o=o+Math.imul(h,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(I,V),i=(i=Math.imul(I,F))+Math.imul(C,V)|0,o=Math.imul(C,F),n=n+Math.imul(S,H)|0,i=(i=i+Math.imul(S,z)|0)+Math.imul(A,H)|0,o=o+Math.imul(A,z)|0,n=n+Math.imul(w,G)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(E,G)|0,o=o+Math.imul(E,W)|0,n=n+Math.imul(b,X)|0,i=(i=i+Math.imul(b,Q)|0)+Math.imul(m,X)|0,o=o+Math.imul(m,Q)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(y,Z)|0,o=o+Math.imul(y,ee)|0;var Ee=(u+(n=n+Math.imul(l,re)|0)|0)+((8191&(i=(i=i+Math.imul(l,ne)|0)+Math.imul(h,re)|0))<<13)|0;u=((o=o+Math.imul(h,ne)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(R,V),i=(i=Math.imul(R,F))+Math.imul(k,V)|0,o=Math.imul(k,F),n=n+Math.imul(I,H)|0,i=(i=i+Math.imul(I,z)|0)+Math.imul(C,H)|0,o=o+Math.imul(C,z)|0,n=n+Math.imul(S,G)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(A,G)|0,o=o+Math.imul(A,W)|0,n=n+Math.imul(w,X)|0,i=(i=i+Math.imul(w,Q)|0)+Math.imul(E,X)|0,o=o+Math.imul(E,Q)|0,n=n+Math.imul(b,Z)|0,i=(i=i+Math.imul(b,ee)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(y,re)|0,o=o+Math.imul(y,ne)|0;var _e=(u+(n=n+Math.imul(l,oe)|0)|0)+((8191&(i=(i=i+Math.imul(l,se)|0)+Math.imul(h,oe)|0))<<13)|0;u=((o=o+Math.imul(h,se)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(x,V),i=(i=Math.imul(x,F))+Math.imul(M,V)|0,o=Math.imul(M,F),n=n+Math.imul(R,H)|0,i=(i=i+Math.imul(R,z)|0)+Math.imul(k,H)|0,o=o+Math.imul(k,z)|0,n=n+Math.imul(I,G)|0,i=(i=i+Math.imul(I,W)|0)+Math.imul(C,G)|0,o=o+Math.imul(C,W)|0,n=n+Math.imul(S,X)|0,i=(i=i+Math.imul(S,Q)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,Q)|0,n=n+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(E,Z)|0,o=o+Math.imul(E,ee)|0,n=n+Math.imul(b,re)|0,i=(i=i+Math.imul(b,ne)|0)+Math.imul(m,re)|0,o=o+Math.imul(m,ne)|0,n=n+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,se)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,se)|0;var Se=(u+(n=n+Math.imul(l,ce)|0)|0)+((8191&(i=(i=i+Math.imul(l,ue)|0)+Math.imul(h,ce)|0))<<13)|0;u=((o=o+Math.imul(h,ue)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(N,V),i=(i=Math.imul(N,F))+Math.imul(L,V)|0,o=Math.imul(L,F),n=n+Math.imul(x,H)|0,i=(i=i+Math.imul(x,z)|0)+Math.imul(M,H)|0,o=o+Math.imul(M,z)|0,n=n+Math.imul(R,G)|0,i=(i=i+Math.imul(R,W)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,W)|0,n=n+Math.imul(I,X)|0,i=(i=i+Math.imul(I,Q)|0)+Math.imul(C,X)|0,o=o+Math.imul(C,Q)|0,n=n+Math.imul(S,Z)|0,i=(i=i+Math.imul(S,ee)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,ee)|0,n=n+Math.imul(w,re)|0,i=(i=i+Math.imul(w,ne)|0)+Math.imul(E,re)|0,o=o+Math.imul(E,ne)|0,n=n+Math.imul(b,oe)|0,i=(i=i+Math.imul(b,se)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,se)|0,n=n+Math.imul(p,ce)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(y,ce)|0,o=o+Math.imul(y,ue)|0;var Ae=(u+(n=n+Math.imul(l,le)|0)|0)+((8191&(i=(i=i+Math.imul(l,he)|0)+Math.imul(h,le)|0))<<13)|0;u=((o=o+Math.imul(h,he)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(K,V),i=(i=Math.imul(K,F))+Math.imul(U,V)|0,o=Math.imul(U,F),n=n+Math.imul(N,H)|0,i=(i=i+Math.imul(N,z)|0)+Math.imul(L,H)|0,o=o+Math.imul(L,z)|0,n=n+Math.imul(x,G)|0,i=(i=i+Math.imul(x,W)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,W)|0,n=n+Math.imul(R,X)|0,i=(i=i+Math.imul(R,Q)|0)+Math.imul(k,X)|0,o=o+Math.imul(k,Q)|0,n=n+Math.imul(I,Z)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(C,Z)|0,o=o+Math.imul(C,ee)|0,n=n+Math.imul(S,re)|0,i=(i=i+Math.imul(S,ne)|0)+Math.imul(A,re)|0,o=o+Math.imul(A,ne)|0,n=n+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,se)|0)+Math.imul(E,oe)|0,o=o+Math.imul(E,se)|0,n=n+Math.imul(b,ce)|0,i=(i=i+Math.imul(b,ue)|0)+Math.imul(m,ce)|0,o=o+Math.imul(m,ue)|0,n=n+Math.imul(p,le)|0,i=(i=i+Math.imul(p,he)|0)+Math.imul(y,le)|0,o=o+Math.imul(y,he)|0;var Te=(u+(n=n+Math.imul(l,pe)|0)|0)+((8191&(i=(i=i+Math.imul(l,ye)|0)+Math.imul(h,pe)|0))<<13)|0;u=((o=o+Math.imul(h,ye)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(K,H),i=(i=Math.imul(K,z))+Math.imul(U,H)|0,o=Math.imul(U,z),n=n+Math.imul(N,G)|0,i=(i=i+Math.imul(N,W)|0)+Math.imul(L,G)|0,o=o+Math.imul(L,W)|0,n=n+Math.imul(x,X)|0,i=(i=i+Math.imul(x,Q)|0)+Math.imul(M,X)|0,o=o+Math.imul(M,Q)|0,n=n+Math.imul(R,Z)|0,i=(i=i+Math.imul(R,ee)|0)+Math.imul(k,Z)|0,o=o+Math.imul(k,ee)|0,n=n+Math.imul(I,re)|0,i=(i=i+Math.imul(I,ne)|0)+Math.imul(C,re)|0,o=o+Math.imul(C,ne)|0,n=n+Math.imul(S,oe)|0,i=(i=i+Math.imul(S,se)|0)+Math.imul(A,oe)|0,o=o+Math.imul(A,se)|0,n=n+Math.imul(w,ce)|0,i=(i=i+Math.imul(w,ue)|0)+Math.imul(E,ce)|0,o=o+Math.imul(E,ue)|0,n=n+Math.imul(b,le)|0,i=(i=i+Math.imul(b,he)|0)+Math.imul(m,le)|0,o=o+Math.imul(m,he)|0;var Ie=(u+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,ye)|0)+Math.imul(y,pe)|0))<<13)|0;u=((o=o+Math.imul(y,ye)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(K,G),i=(i=Math.imul(K,W))+Math.imul(U,G)|0,o=Math.imul(U,W),n=n+Math.imul(N,X)|0,i=(i=i+Math.imul(N,Q)|0)+Math.imul(L,X)|0,o=o+Math.imul(L,Q)|0,n=n+Math.imul(x,Z)|0,i=(i=i+Math.imul(x,ee)|0)+Math.imul(M,Z)|0,o=o+Math.imul(M,ee)|0,n=n+Math.imul(R,re)|0,i=(i=i+Math.imul(R,ne)|0)+Math.imul(k,re)|0,o=o+Math.imul(k,ne)|0,n=n+Math.imul(I,oe)|0,i=(i=i+Math.imul(I,se)|0)+Math.imul(C,oe)|0,o=o+Math.imul(C,se)|0,n=n+Math.imul(S,ce)|0,i=(i=i+Math.imul(S,ue)|0)+Math.imul(A,ce)|0,o=o+Math.imul(A,ue)|0,n=n+Math.imul(w,le)|0,i=(i=i+Math.imul(w,he)|0)+Math.imul(E,le)|0,o=o+Math.imul(E,he)|0;var Ce=(u+(n=n+Math.imul(b,pe)|0)|0)+((8191&(i=(i=i+Math.imul(b,ye)|0)+Math.imul(m,pe)|0))<<13)|0;u=((o=o+Math.imul(m,ye)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(K,X),i=(i=Math.imul(K,Q))+Math.imul(U,X)|0,o=Math.imul(U,Q),n=n+Math.imul(N,Z)|0,i=(i=i+Math.imul(N,ee)|0)+Math.imul(L,Z)|0,o=o+Math.imul(L,ee)|0,n=n+Math.imul(x,re)|0,i=(i=i+Math.imul(x,ne)|0)+Math.imul(M,re)|0,o=o+Math.imul(M,ne)|0,n=n+Math.imul(R,oe)|0,i=(i=i+Math.imul(R,se)|0)+Math.imul(k,oe)|0,o=o+Math.imul(k,se)|0,n=n+Math.imul(I,ce)|0,i=(i=i+Math.imul(I,ue)|0)+Math.imul(C,ce)|0,o=o+Math.imul(C,ue)|0,n=n+Math.imul(S,le)|0,i=(i=i+Math.imul(S,he)|0)+Math.imul(A,le)|0,o=o+Math.imul(A,he)|0;var Pe=(u+(n=n+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,ye)|0)+Math.imul(E,pe)|0))<<13)|0;u=((o=o+Math.imul(E,ye)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(K,Z),i=(i=Math.imul(K,ee))+Math.imul(U,Z)|0,o=Math.imul(U,ee),n=n+Math.imul(N,re)|0,i=(i=i+Math.imul(N,ne)|0)+Math.imul(L,re)|0,o=o+Math.imul(L,ne)|0,n=n+Math.imul(x,oe)|0,i=(i=i+Math.imul(x,se)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,se)|0,n=n+Math.imul(R,ce)|0,i=(i=i+Math.imul(R,ue)|0)+Math.imul(k,ce)|0,o=o+Math.imul(k,ue)|0,n=n+Math.imul(I,le)|0,i=(i=i+Math.imul(I,he)|0)+Math.imul(C,le)|0,o=o+Math.imul(C,he)|0;var Re=(u+(n=n+Math.imul(S,pe)|0)|0)+((8191&(i=(i=i+Math.imul(S,ye)|0)+Math.imul(A,pe)|0))<<13)|0;u=((o=o+Math.imul(A,ye)|0)+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,n=Math.imul(K,re),i=(i=Math.imul(K,ne))+Math.imul(U,re)|0,o=Math.imul(U,ne),n=n+Math.imul(N,oe)|0,i=(i=i+Math.imul(N,se)|0)+Math.imul(L,oe)|0,o=o+Math.imul(L,se)|0,n=n+Math.imul(x,ce)|0,i=(i=i+Math.imul(x,ue)|0)+Math.imul(M,ce)|0,o=o+Math.imul(M,ue)|0,n=n+Math.imul(R,le)|0,i=(i=i+Math.imul(R,he)|0)+Math.imul(k,le)|0,o=o+Math.imul(k,he)|0;var ke=(u+(n=n+Math.imul(I,pe)|0)|0)+((8191&(i=(i=i+Math.imul(I,ye)|0)+Math.imul(C,pe)|0))<<13)|0;u=((o=o+Math.imul(C,ye)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(K,oe),i=(i=Math.imul(K,se))+Math.imul(U,oe)|0,o=Math.imul(U,se),n=n+Math.imul(N,ce)|0,i=(i=i+Math.imul(N,ue)|0)+Math.imul(L,ce)|0,o=o+Math.imul(L,ue)|0,n=n+Math.imul(x,le)|0,i=(i=i+Math.imul(x,he)|0)+Math.imul(M,le)|0,o=o+Math.imul(M,he)|0;var Be=(u+(n=n+Math.imul(R,pe)|0)|0)+((8191&(i=(i=i+Math.imul(R,ye)|0)+Math.imul(k,pe)|0))<<13)|0;u=((o=o+Math.imul(k,ye)|0)+(i>>>13)|0)+(Be>>>26)|0,Be&=67108863,n=Math.imul(K,ce),i=(i=Math.imul(K,ue))+Math.imul(U,ce)|0,o=Math.imul(U,ue),n=n+Math.imul(N,le)|0,i=(i=i+Math.imul(N,he)|0)+Math.imul(L,le)|0,o=o+Math.imul(L,he)|0;var xe=(u+(n=n+Math.imul(x,pe)|0)|0)+((8191&(i=(i=i+Math.imul(x,ye)|0)+Math.imul(M,pe)|0))<<13)|0;u=((o=o+Math.imul(M,ye)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(K,le),i=(i=Math.imul(K,he))+Math.imul(U,le)|0,o=Math.imul(U,he);var Me=(u+(n=n+Math.imul(N,pe)|0)|0)+((8191&(i=(i=i+Math.imul(N,ye)|0)+Math.imul(L,pe)|0))<<13)|0;u=((o=o+Math.imul(L,ye)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863;var Oe=(u+(n=Math.imul(K,pe))|0)+((8191&(i=(i=Math.imul(K,ye))+Math.imul(U,pe)|0))<<13)|0;return u=((o=Math.imul(U,ye))+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,c[0]=ge,c[1]=be,c[2]=me,c[3]=ve,c[4]=we,c[5]=Ee,c[6]=_e,c[7]=Se,c[8]=Ae,c[9]=Te,c[10]=Ie,c[11]=Ce,c[12]=Pe,c[13]=Re,c[14]=ke,c[15]=Be,c[16]=xe,c[17]=Me,c[18]=Oe,0!==u&&(c[19]=u,r.length++),r};function y(e,t,r){return(new g).mulp(e,t,r)}function g(e,t){this.x=e,this.y=t}Math.imul||(p=d),o.prototype.mulTo=function(e,t){var r,n=this.length+e.length;return r=10===this.length&&10===e.length?p(this,e,t):n<63?d(this,e,t):n<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,e,t):y(this,e,t),r},g.prototype.makeRBT=function(e){for(var t=new Array(e),r=o.prototype._countBits(e)-1,n=0;n>=1;return n},g.prototype.permute=function(e,t,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*s+1]=8191&o,o>>>=13;for(s=2*t;s>=26,t+=i/67108864|0,t+=o>>>26,this.words[r]=67108863&o}return 0!==t&&(this.words[r]=t,this.length++),this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r>>i}return t}(e);if(0===t.length)return new o(1);for(var r=this,n=0;n=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var s=0;for(t=0;t>>26-r}s&&(this.words[t]=s,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var o=e%26,s=Math.min((e-o)/26,this.length),a=67108863^67108863>>>o<s)for(this.length-=s,u=0;u=0&&(0!==f||u>=i);u--){var l=0|this.words[u];this.words[u]=f<<26-o|l>>>o,f=l&a}return c&&0!==f&&(c.words[c.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===a)return this.strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),i=e,s=0|i.words[i.length-1];0!=(r=26-this._countBits(s))&&(i=i.ushln(r),n.iushln(r),s=0|i.words[i.length-1]);var a,c=n.length-i.length;if("mod"!==t){(a=new o(null)).length=c+1,a.words=new Array(a.length);for(var u=0;u=0;l--){var h=67108864*(0|n.words[i.length+l])+(0|n.words[i.length+l-1]);for(h=Math.min(h/s|0,67108863),n._ishlnsubmul(i,h,l);0!==n.negative;)h--,n.negative=0,n._ishlnsubmul(i,1,l),n.isZero()||(n.negative^=1);a&&(a.words[l]=h)}return a&&a.strip(),n.strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},o.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(i=a.div.neg()),"div"!==t&&(s=a.mod.neg(),r&&0!==s.negative&&s.iadd(e)),{div:i,mod:s}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(i=a.div.neg()),{div:i,mod:a.mod}):0!=(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(s=a.mod.neg(),r&&0!==s.negative&&s.isub(e)),{div:a.div,mod:s}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,s,a},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modn=function(e){n(e<=67108863);for(var t=(1<<26)%e,r=0,i=this.length-1;i>=0;i--)r=(t*r+(0|this.words[i]))%e;return r},o.prototype.idivn=function(e){n(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*t;this.words[r]=i/e|0,t=i%e}return this.strip()},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new o(1),s=new o(0),a=new o(0),c=new o(1),u=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++u;for(var f=r.clone(),l=t.clone();!t.isZero();){for(var h=0,d=1;0==(t.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(i.isOdd()||s.isOdd())&&(i.iadd(f),s.isub(l)),i.iushrn(1),s.iushrn(1);for(var p=0,y=1;0==(r.words[0]&y)&&p<26;++p,y<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||c.isOdd())&&(a.iadd(f),c.isub(l)),a.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),i.isub(a),s.isub(c)):(r.isub(t),a.isub(i),c.isub(s))}return{a,b:c,gcd:r.iushln(u)}},o.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,s=new o(1),a=new o(0),c=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,f=1;0==(t.words[0]&f)&&u<26;++u,f<<=1);if(u>0)for(t.iushrn(u);u-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);for(var l=0,h=1;0==(r.words[0]&h)&&l<26;++l,h<<=1);if(l>0)for(r.iushrn(l);l-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);t.cmp(r)>=0?(t.isub(r),s.isub(a)):(r.isub(t),a.isub(s))}return(i=0===t.cmpn(1)?s:a).cmpn(0)<0&&i.iadd(e),i},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var o=t;t=r,r=o}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<>>26,a&=67108863,this.words[s]=a}return 0!==o&&(this.words[s]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){ni&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new S(e)},o.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var b={k256:null,p224:null,p192:null,p25519:null};function m(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){m.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){m.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){m.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){m.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function A(e){S.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}m.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},m.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},m.prototype.split=function(e,t){e.iushrn(this.n,0,t)},m.prototype.imulK=function(e){return e.imul(this.k)},i(v,m),v.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),i=0;i>>22,o=s}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},v.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(b[e])return b[e];var t;if("k256"===e)t=new v;else if("p224"===e)t=new w;else if("p192"===e)t=new E;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new _}return b[e]=t,t},S.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},S.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},S.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},S.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},S.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},S.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},S.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},S.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},S.prototype.isqr=function(e){return this.imul(e,e.clone())},S.prototype.sqr=function(e){return this.mul(e,e)},S.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new o(1)).iushrn(2);return this.pow(e,r)}for(var i=this.m.subn(1),s=0;!i.isZero()&&0===i.andln(1);)s++,i.iushrn(1);n(!i.isZero());var a=new o(1).toRed(this),c=a.redNeg(),u=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);0!==this.pow(f,u).cmp(c);)f.redIAdd(c);for(var l=this.pow(f,i),h=this.pow(e,i.addn(1).iushrn(1)),d=this.pow(e,i),p=s;0!==d.cmp(a);){for(var y=d,g=0;0!==y.cmp(a);g++)y=y.redSqr();n(g=0;n--){for(var u=t.words[n],f=c-1;f>=0;f--){var l=u>>f&1;i!==r[0]&&(i=this.sqr(i)),0!==l||0!==s?(s<<=1,s|=l,(4==++a||0===n&&0===f)&&(i=this.mul(i,r[s]),a=0,s=0)):a=0}c=26}return i},S.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},S.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new A(e)},i(A,S),A.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},A.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},A.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},A.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},A.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},29931:(e,t,r)=>{var n;function i(e){this.rand=e}if(e.exports=function(e){return n||(n=new i(null)),n.generate(e)},e.exports.Rand=i,i.prototype.generate=function(e){return this._rand(e)},i.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r{"use strict";var n=r(34155);Object.defineProperty(t,"__esModule",{value:!0});var 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},o="undefined"!=typeof window&&void 0!==window.document,s=void 0!==n&&null!=n.versions&&null!=n.versions.node,a="object"===("undefined"==typeof self?"undefined":i(self))&&self.constructor&&"DedicatedWorkerGlobalScope"===self.constructor.name,c="undefined"!=typeof window&&"nodejs"===window.name||"undefined"!=typeof navigator&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),u="undefined"!=typeof Deno&&void 0!==Deno.core;t.isBrowser=o,t.isWebWorker=a,t.isNode=s,t.isJsDom=c,t.isDeno=u},77191:(e,t,r)=>{var n=r(58162);e.exports=n("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},48764:(e,t,r)=>{"use strict";const n=r(79742),i=r(80645),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=c,t.SlowBuffer=function(e){return+e!=e&&(e=0),c.alloc(+e)},t.INSPECT_MAX_BYTES=50;const s=2147483647;function a(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return l(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|y(e,t);let n=a(r);const i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(Y(e,Uint8Array)){const t=new Uint8Array(e);return d(t.buffer,t.byteOffset,t.byteLength)}return h(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Y(e,ArrayBuffer)||e&&Y(e.buffer,ArrayBuffer))return d(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(Y(e,SharedArrayBuffer)||e&&Y(e.buffer,SharedArrayBuffer)))return d(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return c.from(n,t,r);const i=function(e){if(c.isBuffer(e)){const t=0|p(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||X(e.length)?a(0):h(e):"Buffer"===e.type&&Array.isArray(e.data)?h(e.data):void 0}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function f(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function l(e){return f(e),a(e<0?0:0|p(e))}function h(e){const t=e.length<0?0:0|p(e.length),r=a(t);for(let n=0;n=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function y(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Y(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return $(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return G(e).length;default:if(i)return n?-1:$(e).length;t=(""+t).toLowerCase(),i=!0}}function g(e,t,r){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return k(this,t,r);case"utf8":case"utf-8":return I(this,t,r);case"ascii":return P(this,t,r);case"latin1":case"binary":return R(this,t,r);case"base64":return T(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function b(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function m(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),X(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=c.from(t,n)),c.isBuffer(t))return 0===t.length?-1:v(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):v(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,r,n,i){let o,s=1,a=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){let n=-1;for(o=r;oa&&(r=a-c),o=r;o>=0;o--){let r=!0;for(let n=0;ni&&(n=i):n=i;const o=t.length;let s;for(n>o/2&&(n=o/2),s=0;s>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function T(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function I(e,t,r){r=Math.min(e.length,r);const n=[];let i=t;for(;i239?4:t>223?3:t>191?2:1;if(i+s<=r){let r,n,a,c;switch(s){case 1:t<128&&(o=t);break;case 2:r=e[i+1],128==(192&r)&&(c=(31&t)<<6|63&r,c>127&&(o=c));break;case 3:r=e[i+1],n=e[i+2],128==(192&r)&&128==(192&n)&&(c=(15&t)<<12|(63&r)<<6|63&n,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:r=e[i+1],n=e[i+2],a=e[i+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(c=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&a,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return function(e){const t=e.length;if(t<=C)return String.fromCharCode.apply(String,e);let r="",n=0;for(;nn.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(n,i)):Uint8Array.prototype.set.call(n,t,i);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,i)}i+=t.length}return n},c.byteLength=y,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tr&&(e+=" ... "),""},o&&(c.prototype[o]=c.prototype.inspect),c.prototype.compare=function(e,t,r,n,i){if(Y(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;let o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0);const a=Math.min(o,s),u=this.slice(n,i),f=e.slice(t,r);for(let e=0;e>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return w(this,e,t,r);case"utf8":case"utf-8":return E(this,e,t,r);case"ascii":case"latin1":case"binary":return _(this,e,t,r);case"base64":return S(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const C=4096;function P(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;in)&&(r=n);let i="";for(let n=t;nr)throw new RangeError("Trying to access beyond buffer length")}function M(e,t,r,n,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function O(e,t,r,n,i){F(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,r}function N(e,t,r,n,i){F(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o>>=8,e[r+6]=o,o>>=8,e[r+5]=o,o>>=8,e[r+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=s,s>>=8,e[r+2]=s,s>>=8,e[r+1]=s,s>>=8,e[r]=s,r+8}function L(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function D(e,t,r,n,o){return t=+t,r>>>=0,o||L(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function K(e,t,r,n,o){return t=+t,r>>>=0,o||L(e,0,r,8),i.write(e,t,r,n,52,8),r+8}c.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||x(e,t,this.length);let n=this[e],i=1,o=0;for(;++o>>=0,t>>>=0,r||x(e,t,this.length);let n=this[e+--t],i=1;for(;t>0&&(i*=256);)n+=this[e+--t]*i;return n},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||x(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||x(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||x(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||x(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||x(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=J((function(e){q(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||H(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(n)+(BigInt(i)<>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||H(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<>>=0,t>>>=0,r||x(e,t,this.length);let n=this[e],i=1,o=0;for(;++o=i&&(n-=Math.pow(2,8*t)),n},c.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||x(e,t,this.length);let n=t,i=1,o=this[e+--n];for(;n>0&&(i*=256);)o+=this[e+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return e>>>=0,t||x(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||x(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(e,t){e>>>=0,t||x(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||x(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||x(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=J((function(e){q(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||H(e,this.length-8);const n=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(n)<>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||H(e,this.length-8);const n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<>>=0,t||x(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||x(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||x(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||x(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||M(this,e,t,r,Math.pow(2,8*r)-1,0);let i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n||M(this,e,t,r,Math.pow(2,8*r)-1,0);let i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=J((function(e,t=0){return O(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=J((function(e,t=0){return N(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);M(this,e,t,r,n-1,-n)}let i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+r},c.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);M(this,e,t,r,n-1,-n)}let i=r-1,o=1,s=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},c.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=J((function(e,t=0){return O(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=J((function(e,t=0){return N(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(e,t,r){return D(this,e,t,!0,r)},c.prototype.writeFloatBE=function(e,t,r){return D(this,e,t,!1,r)},c.prototype.writeDoubleLE=function(e,t,r){return K(this,e,t,!0,r)},c.prototype.writeDoubleBE=function(e,t,r){return K(this,e,t,!1,r)},c.prototype.copy=function(e,t,r,n){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function F(e,t,r,n,i,o){if(e>r||e3?0===t||t===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(o+1)}${n}`:`>= -(2${n} ** ${8*(o+1)-1}${n}) and < 2 ** ${8*(o+1)-1}${n}`:`>= ${t}${n} and <= ${r}${n}`,new U.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,r){q(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||H(t,e.length-(r+1))}(n,i,o)}function q(e,t){if("number"!=typeof e)throw new U.ERR_INVALID_ARG_TYPE(t,"number",e)}function H(e,t,r){if(Math.floor(e)!==e)throw q(e,r),new U.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new U.ERR_BUFFER_OUT_OF_BOUNDS;throw new U.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}j("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),j("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),j("ERR_OUT_OF_RANGE",(function(e,t,r){let n=`The value of "${e}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=V(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=V(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n}),RangeError);const z=/[^+/0-9A-Za-z-_]/g;function $(e,t){let r;t=t||1/0;const n=e.length;let i=null;const o=[];for(let s=0;s55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function G(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(z,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function W(e,t,r,n){let i;for(i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function Y(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function X(e){return e!=e}const Q=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function J(e){return"undefined"==typeof BigInt?Z:e}function Z(){throw new Error("BigInt not supported")}},98514:e=>{"use strict";e.exports=function(e,{className:t,symbolName:r}){const n=Symbol.for(r),i={[t]:class extends e{constructor(...e){super(...e),Object.defineProperty(this,n,{value:!0})}get[Symbol.toStringTag](){return t}}}[t];return i[`is${t}`]=e=>!(!e||!e[n]),i},e.exports.proto=function(e,{className:t,symbolName:r,withoutNew:n}){const i=Symbol.for(r),o={[t]:function(...t){if(n&&!(this instanceof o))return new o(...t);const r=e.call(this,...t)||this;return r&&!r[i]&&Object.defineProperty(r,i,{value:!0}),r}}[t];return o.prototype=Object.create(e.prototype),o.prototype.constructor=o,Object.defineProperty(o.prototype,Symbol.toStringTag,{get:()=>t}),o[`is${t}`]=e=>!(!e||!e[i]),o}},75281:(e,t,r)=>{"use strict";const n=r(5696),i=/\s+at.*(?:\(|\s)(.*)\)?/,o=/^(?:(?:(?:node|(?:internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)\.js:\d+:\d+)|native)/,s=void 0===n.homedir?"":n.homedir();e.exports=(e,t)=>(t=Object.assign({pretty:!1},t),e.replace(/\\/g,"/").split("\n").filter((e=>{const t=e.match(i);if(null===t||!t[1])return!0;const r=t[1];return!r.includes(".app/Contents/Resources/electron.asar")&&!r.includes(".app/Contents/Resources/default_app.asar")&&!o.test(r)})).filter((e=>""!==e.trim())).map((e=>t.pretty?e.replace(i,((e,t)=>e.replace(t,t.replace(s,"~")))):e)).join("\n"))},51424:(e,t,r)=>{"use strict";r.d(t,{Z:()=>a});var n=r(8081),i=r.n(n),o=r(23645),s=r.n(o)()(i());s.push([e.id,".hidden {\n display: none;\n}\n",""]);const a=s},23645:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var r="",n=void 0!==t[5];return t[4]&&(r+="@supports (".concat(t[4],") {")),t[2]&&(r+="@media ".concat(t[2]," {")),n&&(r+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),r+=e(t),n&&(r+="}"),t[2]&&(r+="}"),t[4]&&(r+="}"),r})).join("")},t.i=function(e,r,n,i,o){"string"==typeof e&&(e=[[null,e,void 0]]);var s={};if(n)for(var a=0;a0?" ".concat(f[5]):""," {").concat(f[1],"}")),f[5]=o),r&&(f[2]?(f[1]="@media ".concat(f[2]," {").concat(f[1],"}"),f[2]=r):f[2]=r),i&&(f[4]?(f[1]="@supports (".concat(f[4],") {").concat(f[1],"}"),f[4]=i):f[4]="".concat(i)),t.push(f))}},t}},8081:e=>{"use strict";e.exports=function(e){return e[1]}},11227:(e,t,r)=>{var n=r(34155);t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,i=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(n++,"%c"===e&&(i=n))})),t.splice(i,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&void 0!==n&&"env"in n&&(e=n.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=r(82447)(t);const{formatters:i}=e.exports;i.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},82447:(e,t,r)=>{e.exports=function(e){function t(e){let r,i,o,s=null;function a(...e){if(!a.enabled)return;const n=a,i=Number(new Date),o=i-(r||i);n.diff=o,n.prev=r,n.curr=i,r=i,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,i)=>{if("%%"===r)return"%";s++;const o=t.formatters[i];if("function"==typeof o){const t=e[s];r=o.call(n,t),e.splice(s,1),s--}return r})),t.formatArgs.call(n,e),(n.log||t.log).apply(n,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=n,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==s?s:(i!==t.namespaces&&(i=t.namespaces,o=t.enabled(e)),o),set:e=>{s=e}}),"function"==typeof t.init&&t.init(a),a}function n(e,r){const n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function i(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){const e=[...t.names.map(i),...t.skips.map(i).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),i=n.length;for(r=0;r{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t{"use strict";var t={single_source_shortest_paths:function(e,r,n){var i={},o={};o[r]=0;var s,a,c,u,f,l,h,d=t.PriorityQueue.make();for(d.push(r,0);!d.empty();)for(c in a=(s=d.pop()).value,u=s.cost,f=e[a]||{})f.hasOwnProperty(c)&&(l=u+f[c],h=o[c],(void 0===o[c]||h>l)&&(o[c]=l,d.push(c,l),i[c]=a));if(void 0!==n&&void 0===o[n]){var p=["Could not find a path from ",r," to ",n,"."].join("");throw new Error(p)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var r=[],n=t;n;)r.push(n),e[n],n=e[n];return r.reverse(),r},find_path:function(e,r,n){var i=t.single_source_shortest_paths(e,r,n);return t.extract_shortest_path_from_predecessor_list(i,n)},PriorityQueue:{make:function(e){var r,n=t.PriorityQueue,i={};for(r in e=e||{},n)n.hasOwnProperty(r)&&(i[r]=n[r]);return i.queue=[],i.sorter=e.sorter||n.default_sorter,i},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var r={value:e,cost:t};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};e.exports=t},926:(e,t,r)=>{"use strict";const n=r(11227),i=n("dns-over-http-resolver");i.error=n("dns-over-http-resolver:error");const o=r(73692),s=r(46177);class a{constructor({maxCache:e=100}={}){this._cache=new o({max:e}),this._servers=["https://cloudflare-dns.com/dns-query","https://dns.google/resolve"]}getServers(){return this._servers}_getShuffledServers(){const e=[].concat(this._servers);for(let t=e.length-1;t>0;t--){const r=Math.floor(Math.random()*t),n=e[t];e[t]=e[r],e[r]=n}return e}setServers(e){this._servers=e}resolve(e,t="A"){switch(t){case"A":return this.resolve4(e);case"AAAA":return this.resolve6(e);case"TXT":return this.resolveTxt(e);default:throw new Error(`${t} is not supported`)}}async resolve4(e){const t=this._cache.get(s.getCacheKey(e,"A"));if(t)return t;for(const t of this._getShuffledServers())try{const r=await s.fetch(s.buildResource({serverResolver:t,hostname:e,recordType:"A"})),n=await r.json(),i=n.Answer.map((e=>e.data)),o=Math.min(n.Answer.map((e=>e.TTL)));return this._cache.set(s.getCacheKey(e,"A"),i,{ttl:o}),i}catch(r){i.error(`${t} could not resolve ${e} record A`)}throw new Error(`Could not resolve ${e} record A`)}async resolve6(e){const t="AAAA",r=this._cache.get(s.getCacheKey(e,t));if(r)return r;for(const r of this._getShuffledServers())try{const n=await s.fetch(s.buildResource({serverResolver:r,hostname:e,recordType:t})),i=await n.json(),o=i.Answer.map((e=>e.data)),a=Math.min(i.Answer.map((e=>e.TTL)));return this._cache.set(s.getCacheKey(e,t),o,{ttl:a}),o}catch(t){i.error(`${r} could not resolve ${e} record AAAA`)}throw new Error(`Could not resolve ${e} record AAAA`)}async resolveTxt(e){const t="TXT",r=this._cache.get(s.getCacheKey(e,t));if(r)return r;for(const r of this._getShuffledServers())try{const n=await s.fetch(s.buildResource({serverResolver:r,hostname:e,recordType:t})),i=await n.json(),o=i.Answer.map((e=>[e.data.replace(/['"]+/g,"")])),a=Math.min(i.Answer.map((e=>e.TTL)));return this._cache.set(s.getCacheKey(e,t),o,{ttl:a}),o}catch(t){i.error(`${r} could not resolve ${e} record TXT`)}throw new Error(`Could not resolve ${e} record TXT`)}}a.Resolver=a,e.exports=a},46177:(e,t,r)=>{"use strict";const{default:n,Headers:i}=r(30700);e.exports={buildResource:function({serverResolver:e,hostname:t,recordType:r}){return`${e}?name=${t}&type=${r}`},fetch:function(e){return n(e,{headers:new i({accept:"application/dns-json"})})},getCacheKey:function(e,t){return`${t}_${e}`}}},86266:(e,t,r)=>{"use strict";var n=t;n.version=r(18597).i8,n.utils=r(80953),n.rand=r(29931),n.curve=r(88254),n.curves=r(45427),n.ec=r(57954),n.eddsa=r(65980)},4918:(e,t,r)=>{"use strict";var n=r(13550),i=r(80953),o=i.getNAF,s=i.getJSF,a=i.assert;function c(e,t){this.type=e,this.p=new n(t.p,16),this.red=t.prime?n.red(t.prime):n.mont(this.p),this.zero=new n(0).toRed(this.red),this.one=new n(1).toRed(this.red),this.two=new n(2).toRed(this.red),this.n=t.n&&new n(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function u(e,t){this.curve=e,this.type=t,this.precomputed=null}e.exports=c,c.prototype.point=function(){throw new Error("Not implemented")},c.prototype.validate=function(){throw new Error("Not implemented")},c.prototype._fixedNafMul=function(e,t){a(e.precomputed);var r=e._getDoubles(),n=o(t,1,this._bitLength),i=(1<=s;f--)c=(c<<1)+n[f];u.push(c)}for(var l=this.jpoint(null,null,null),h=this.jpoint(null,null,null),d=i;d>0;d--){for(s=0;s=0;u--){for(var f=0;u>=0&&0===s[u];u--)f++;if(u>=0&&f++,c=c.dblp(f),u<0)break;var l=s[u];a(0!==l),c="affine"===e.type?l>0?c.mixedAdd(i[l-1>>1]):c.mixedAdd(i[-l-1>>1].neg()):l>0?c.add(i[l-1>>1]):c.add(i[-l-1>>1].neg())}return"affine"===e.type?c.toP():c},c.prototype._wnafMulAdd=function(e,t,r,n,i){var a,c,u,f=this._wnafT1,l=this._wnafT2,h=this._wnafT3,d=0;for(a=0;a=1;a-=2){var y=a-1,g=a;if(1===f[y]&&1===f[g]){var b=[t[y],null,null,t[g]];0===t[y].y.cmp(t[g].y)?(b[1]=t[y].add(t[g]),b[2]=t[y].toJ().mixedAdd(t[g].neg())):0===t[y].y.cmp(t[g].y.redNeg())?(b[1]=t[y].toJ().mixedAdd(t[g]),b[2]=t[y].add(t[g].neg())):(b[1]=t[y].toJ().mixedAdd(t[g]),b[2]=t[y].toJ().mixedAdd(t[g].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],v=s(r[y],r[g]);for(d=Math.max(v[0].length,d),h[y]=new Array(d),h[g]=new Array(d),c=0;c=0;a--){for(var A=0;a>=0;){var T=!0;for(c=0;c=0&&A++,_=_.dblp(A),a<0)break;for(c=0;c0?u=l[c][I-1>>1]:I<0&&(u=l[c][-I-1>>1].neg()),_="affine"===u.type?_.mixedAdd(u):_.add(u))}}for(a=0;a=Math.ceil((e.bitLength()+1)/t.step)},u.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i{"use strict";var n=r(80953),i=r(13550),o=r(35717),s=r(4918),a=n.assert;function c(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,s.call(this,"edwards",e),this.a=new i(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new i(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new i(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),a(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}function u(e,t,r,n,o){s.BasePoint.call(this,e,"projective"),null===t&&null===r&&null===n?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new i(t,16),this.y=new i(r,16),this.z=n?new i(n,16):this.curve.one,this.t=o&&new i(o,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}o(c,s),e.exports=c,c.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},c.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},c.prototype.jpoint=function(e,t,r,n){return this.point(e,t,r,n)},c.prototype.pointFromX=function(e,t){(e=new i(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=this.c2.redSub(this.a.redMul(r)),o=this.one.redSub(this.c2.redMul(this.d).redMul(r)),s=n.redMul(o.redInvm()),a=s.redSqrt();if(0!==a.redSqr().redSub(s).cmp(this.zero))throw new Error("invalid point");var c=a.fromRed().isOdd();return(t&&!c||!t&&c)&&(a=a.redNeg()),this.point(e,a)},c.prototype.pointFromY=function(e,t){(e=new i(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=r.redSub(this.c2),o=r.redMul(this.d).redMul(this.c2).redSub(this.a),s=n.redMul(o.redInvm());if(0===s.cmp(this.zero)){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var a=s.redSqrt();if(0!==a.redSqr().redSub(s).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==t&&(a=a.redNeg()),this.point(a,e)},c.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),r=e.y.redSqr(),n=t.redMul(this.a).redAdd(r),i=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(r)));return 0===n.cmp(i)},o(u,s.BasePoint),c.prototype.pointFromJSON=function(e){return u.fromJSON(this,e)},c.prototype.point=function(e,t,r,n){return new u(this,e,t,r,n)},u.fromJSON=function(e,t){return new u(e,t[0],t[1],t[2])},u.prototype.inspect=function(){return this.isInfinity()?"":""},u.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},u.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),o=n.redAdd(t),s=o.redSub(r),a=n.redSub(t),c=i.redMul(s),u=o.redMul(a),f=i.redMul(a),l=s.redMul(o);return this.curve.point(c,u,l,f)},u.prototype._projDbl=function(){var e,t,r,n,i,o,s=this.x.redAdd(this.y).redSqr(),a=this.x.redSqr(),c=this.y.redSqr();if(this.curve.twisted){var u=(n=this.curve._mulA(a)).redAdd(c);this.zOne?(e=s.redSub(a).redSub(c).redMul(u.redSub(this.curve.two)),t=u.redMul(n.redSub(c)),r=u.redSqr().redSub(u).redSub(u)):(i=this.z.redSqr(),o=u.redSub(i).redISub(i),e=s.redSub(a).redISub(c).redMul(o),t=u.redMul(n.redSub(c)),r=u.redMul(o))}else n=a.redAdd(c),i=this.curve._mulC(this.z).redSqr(),o=n.redSub(i).redSub(i),e=this.curve._mulC(s.redISub(n)).redMul(o),t=this.curve._mulC(n).redMul(a.redISub(c)),r=n.redMul(o);return this.curve.point(e,t,r)},u.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},u.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),o=r.redSub(t),s=i.redSub(n),a=i.redAdd(n),c=r.redAdd(t),u=o.redMul(s),f=a.redMul(c),l=o.redMul(c),h=s.redMul(a);return this.curve.point(u,f,h,l)},u.prototype._projAdd=function(e){var t,r,n=this.z.redMul(e.z),i=n.redSqr(),o=this.x.redMul(e.x),s=this.y.redMul(e.y),a=this.curve.d.redMul(o).redMul(s),c=i.redSub(a),u=i.redAdd(a),f=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(s),l=n.redMul(c).redMul(f);return this.curve.twisted?(t=n.redMul(u).redMul(s.redSub(this.curve._mulA(o))),r=c.redMul(u)):(t=n.redMul(u).redMul(s.redSub(o)),r=this.curve._mulC(c).redMul(u)),this.curve.point(l,t,r)},u.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},u.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},u.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},u.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},u.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},u.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},u.prototype.getX=function(){return this.normalize(),this.x.fromRed()},u.prototype.getY=function(){return this.normalize(),this.y.fromRed()},u.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},u.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var r=e.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(n),0===this.x.cmp(t))return!0}},u.prototype.toP=u.prototype.normalize,u.prototype.mixedAdd=u.prototype.add},88254:(e,t,r)=>{"use strict";var n=t;n.base=r(4918),n.short=r(6673),n.mont=r(22881),n.edwards=r(31138)},22881:(e,t,r)=>{"use strict";var n=r(13550),i=r(35717),o=r(4918),s=r(80953);function a(e){o.call(this,"mont",e),this.a=new n(e.a,16).toRed(this.red),this.b=new n(e.b,16).toRed(this.red),this.i4=new n(4).toRed(this.red).redInvm(),this.two=new n(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function c(e,t,r){o.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new n(t,16),this.z=new n(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}i(a,o),e.exports=a,a.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),n=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===n.redSqrt().redSqr().cmp(n)},i(c,o.BasePoint),a.prototype.decodePoint=function(e,t){return this.point(s.toArray(e,t),1)},a.prototype.point=function(e,t){return new c(this,e,t)},a.prototype.pointFromJSON=function(e){return c.fromJSON(this,e)},c.prototype.precompute=function(){},c.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},c.fromJSON=function(e,t){return new c(e,t[0],t[1]||e.one)},c.prototype.inspect=function(){return this.isInfinity()?"":""},c.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},c.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),n=e.redMul(t),i=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,i)},c.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=e.x.redAdd(e.z),o=e.x.redSub(e.z).redMul(r),s=i.redMul(n),a=t.z.redMul(o.redAdd(s).redSqr()),c=t.x.redMul(o.redISub(s).redSqr());return this.curve.point(a,c)},c.prototype.mul=function(e){for(var t=e.clone(),r=this,n=this.curve.point(null,null),i=[];0!==t.cmpn(0);t.iushrn(1))i.push(t.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},c.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},c.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},c.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},6673:(e,t,r)=>{"use strict";var n=r(80953),i=r(13550),o=r(35717),s=r(4918),a=n.assert;function c(e){s.call(this,"short",e),this.a=new i(e.a,16).toRed(this.red),this.b=new i(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function u(e,t,r,n){s.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(t,16),this.y=new i(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function f(e,t,r,n){s.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(t,16),this.y=new i(r,16),this.z=new i(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(c,s),e.exports=c,c.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new i(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(e.lambda)r=new i(e.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(t))?r=o[0]:(r=o[1],a(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map((function(e){return{a:new i(e.a,16),b:new i(e.b,16)}})):this._getEndoBasis(r)}}},c.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:i.mont(e),r=new i(2).toRed(t).redInvm(),n=r.redNeg(),o=new i(3).toRed(t).redNeg().redSqrt().redMul(r);return[n.redAdd(o).fromRed(),n.redSub(o).fromRed()]},c.prototype._getEndoBasis=function(e){for(var t,r,n,o,s,a,c,u,f,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),h=e,d=this.n.clone(),p=new i(1),y=new i(0),g=new i(0),b=new i(1),m=0;0!==h.cmpn(0);){var v=d.div(h);u=d.sub(v.mul(h)),f=g.sub(v.mul(p));var w=b.sub(v.mul(y));if(!n&&u.cmp(l)<0)t=c.neg(),r=p,n=u.neg(),o=f;else if(n&&2==++m)break;c=u,d=h,h=u,g=p,p=f,b=y,y=w}s=u.neg(),a=f;var E=n.sqr().add(o.sqr());return s.sqr().add(a.sqr()).cmp(E)>=0&&(s=t,a=r),n.negative&&(n=n.neg(),o=o.neg()),s.negative&&(s=s.neg(),a=a.neg()),[{a:n,b:o},{a:s,b:a}]},c.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],i=n.b.mul(e).divRound(this.n),o=r.b.neg().mul(e).divRound(this.n),s=i.mul(r.a),a=o.mul(n.a),c=i.mul(r.b),u=o.mul(n.b);return{k1:e.sub(s).sub(a),k2:c.add(u).neg()}},c.prototype.pointFromX=function(e,t){(e=new i(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var o=n.fromRed().isOdd();return(t&&!o||!t&&o)&&(n=n.redNeg()),this.point(e,n)},c.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},c.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},u.prototype.isInfinity=function(){return this.inf},u.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},u.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},u.prototype.getX=function(){return this.x.fromRed()},u.prototype.getY=function(){return this.y.fromRed()},u.prototype.mul=function(e){return e=new i(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},u.prototype.mulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},u.prototype.jmulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},u.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},u.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},u.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(f,s.BasePoint),c.prototype.jpoint=function(e,t,r){return new f(this,e,t,r)},f.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},f.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},f.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),i=e.x.redMul(r),o=this.y.redMul(t.redMul(e.z)),s=e.y.redMul(r.redMul(this.z)),a=n.redSub(i),c=o.redSub(s);if(0===a.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),f=u.redMul(a),l=n.redMul(u),h=c.redSqr().redIAdd(f).redISub(l).redISub(l),d=c.redMul(l.redISub(h)).redISub(o.redMul(f)),p=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(h,d,p)},f.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),s=r.redSub(n),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),u=c.redMul(s),f=r.redMul(c),l=a.redSqr().redIAdd(u).redISub(f).redISub(f),h=a.redMul(f.redISub(l)).redISub(i.redMul(u)),d=this.z.redMul(s);return this.curve.jpoint(l,h,d)},f.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},f.prototype.inspect=function(){return this.isInfinity()?"":""},f.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},45427:(e,t,r)=>{"use strict";var n,i=t,o=r(33715),s=r(88254),a=r(80953).assert;function c(e){"short"===e.type?this.curve=new s.short(e):"edwards"===e.type?this.curve=new s.edwards(e):this.curve=new s.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function u(e,t){Object.defineProperty(i,e,{configurable:!0,enumerable:!0,get:function(){var r=new c(t);return Object.defineProperty(i,e,{configurable:!0,enumerable:!0,value:r}),r}})}i.PresetCurve=c,u("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),u("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),u("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),u("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),u("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),u("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),u("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=r(91037)}catch(e){n=void 0}u("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})},57954:(e,t,r)=>{"use strict";var n=r(13550),i=r(2156),o=r(80953),s=r(45427),a=r(29931),c=o.assert,u=r(31251),f=r(90611);function l(e){if(!(this instanceof l))return new l(e);"string"==typeof e&&(c(Object.prototype.hasOwnProperty.call(s,e),"Unknown curve "+e),e=s[e]),e instanceof s.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}e.exports=l,l.prototype.keyPair=function(e){return new u(this,e)},l.prototype.keyFromPrivate=function(e,t){return u.fromPrivate(this,e,t)},l.prototype.keyFromPublic=function(e,t){return u.fromPublic(this,e,t)},l.prototype.genKeyPair=function(e){e||(e={});for(var t=new i({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||a(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),o=this.n.sub(new n(2));;){var s=new n(t.generate(r));if(!(s.cmp(o)>0))return s.iaddn(1),this.keyFromPrivate(s)}},l.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},l.prototype.sign=function(e,t,r,o){"object"==typeof r&&(o=r,r=null),o||(o={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new n(e,16));for(var s=this.n.byteLength(),a=t.getPrivate().toArray("be",s),c=e.toArray("be",s),u=new i({hash:this.hash,entropy:a,nonce:c,pers:o.pers,persEnc:o.persEnc||"utf8"}),l=this.n.sub(new n(1)),h=0;;h++){var d=o.k?o.k(h):new n(u.generate(this.n.byteLength()));if(!((d=this._truncateToN(d,!0)).cmpn(1)<=0||d.cmp(l)>=0)){var p=this.g.mul(d);if(!p.isInfinity()){var y=p.getX(),g=y.umod(this.n);if(0!==g.cmpn(0)){var b=d.invm(this.n).mul(g.mul(t.getPrivate()).iadd(e));if(0!==(b=b.umod(this.n)).cmpn(0)){var m=(p.getY().isOdd()?1:0)|(0!==y.cmp(g)?2:0);return o.canonical&&b.cmp(this.nh)>0&&(b=this.n.sub(b),m^=1),new f({r:g,s:b,recoveryParam:m})}}}}}},l.prototype.verify=function(e,t,r,i){e=this._truncateToN(new n(e,16)),r=this.keyFromPublic(r,i);var o=(t=new f(t,"hex")).r,s=t.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var a,c=s.invm(this.n),u=c.mul(e).umod(this.n),l=c.mul(o).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(u,r.getPublic(),l)).isInfinity()&&a.eqXToP(o):!(a=this.g.mulAdd(u,r.getPublic(),l)).isInfinity()&&0===a.getX().umod(this.n).cmp(o)},l.prototype.recoverPubKey=function(e,t,r,i){c((3&r)===r,"The recovery param is more than two bits"),t=new f(t,i);var o=this.n,s=new n(e),a=t.r,u=t.s,l=1&r,h=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&h)throw new Error("Unable to find sencond key candinate");a=h?this.curve.pointFromX(a.add(this.curve.n),l):this.curve.pointFromX(a,l);var d=t.r.invm(o),p=o.sub(s).mul(d).umod(o),y=u.mul(d).umod(o);return this.g.mulAdd(p,a,y)},l.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new f(t,n)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},31251:(e,t,r)=>{"use strict";var n=r(13550),i=r(80953).assert;function o(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}e.exports=o,o.fromPublic=function(e,t,r){return t instanceof o?t:new o(e,{pub:t,pubEnc:r})},o.fromPrivate=function(e,t,r){return t instanceof o?t:new o(e,{priv:t,privEnc:r})},o.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},o.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(e,t){this.priv=new n(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?i(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},o.prototype.derive=function(e){return e.validate()||i(e.validate(),"public point not validated"),e.mul(this.priv).getX()},o.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},o.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},o.prototype.inspect=function(){return""}},90611:(e,t,r)=>{"use strict";var n=r(13550),i=r(80953),o=i.assert;function s(e,t){if(e instanceof s)return e;this._importDER(e,t)||(o(e.r&&e.s,"Signature without r or s"),this.r=new n(e.r,16),this.s=new n(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function a(){this.place=0}function c(e,t){var r=e[t.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,o=0,s=t.place;o>>=0;return!(i<=127)&&(t.place=s,i)}function u(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}e.exports=s,s.prototype._importDER=function(e,t){e=i.toArray(e,t);var r=new a;if(48!==e[r.place++])return!1;var o=c(e,r);if(!1===o)return!1;if(o+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var s=c(e,r);if(!1===s)return!1;var u=e.slice(r.place,s+r.place);if(r.place+=s,2!==e[r.place++])return!1;var f=c(e,r);if(!1===f)return!1;if(e.length!==f+r.place)return!1;var l=e.slice(r.place,f+r.place);if(0===u[0]){if(!(128&u[1]))return!1;u=u.slice(1)}if(0===l[0]){if(!(128&l[1]))return!1;l=l.slice(1)}return this.r=new n(u),this.s=new n(l),this.recoveryParam=null,!0},s.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=u(t),r=u(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];f(n,t.length),(n=n.concat(t)).push(2),f(n,r.length);var o=n.concat(r),s=[48];return f(s,o.length),s=s.concat(o),i.encode(s,e)}},65980:(e,t,r)=>{"use strict";var n=r(33715),i=r(45427),o=r(80953),s=o.assert,a=o.parseBytes,c=r(79087),u=r(23622);function f(e){if(s("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof f))return new f(e);e=i[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=n.sha512}e.exports=f,f.prototype.sign=function(e,t){e=a(e);var r=this.keyFromSecret(t),n=this.hashInt(r.messagePrefix(),e),i=this.g.mul(n),o=this.encodePoint(i),s=this.hashInt(o,r.pubBytes(),e).mul(r.priv()),c=n.add(s).umod(this.curve.n);return this.makeSignature({R:i,S:c,Rencoded:o})},f.prototype.verify=function(e,t,r){e=a(e),t=this.makeSignature(t);var n=this.keyFromPublic(r),i=this.hashInt(t.Rencoded(),n.pubBytes(),e),o=this.g.mul(t.S());return t.R().add(n.pub().mul(i)).eq(o)},f.prototype.hashInt=function(){for(var e=this.hash(),t=0;t{"use strict";var n=r(80953),i=n.assert,o=n.parseBytes,s=n.cachedProperty;function a(e,t){this.eddsa=e,this._secret=o(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=o(t.pub)}a.fromPublic=function(e,t){return t instanceof a?t:new a(e,{pub:t})},a.fromSecret=function(e,t){return t instanceof a?t:new a(e,{secret:t})},a.prototype.secret=function(){return this._secret},s(a,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),s(a,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),s(a,"privBytes",(function(){var e=this.eddsa,t=this.hash(),r=e.encodingLength-1,n=t.slice(0,e.encodingLength);return n[0]&=248,n[r]&=127,n[r]|=64,n})),s(a,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),s(a,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),s(a,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),a.prototype.sign=function(e){return i(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},a.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},a.prototype.getSecret=function(e){return i(this._secret,"KeyPair is public only"),n.encode(this.secret(),e)},a.prototype.getPublic=function(e){return n.encode(this.pubBytes(),e)},e.exports=a},23622:(e,t,r)=>{"use strict";var n=r(13550),i=r(80953),o=i.assert,s=i.cachedProperty,a=i.parseBytes;function c(e,t){this.eddsa=e,"object"!=typeof t&&(t=a(t)),Array.isArray(t)&&(t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),o(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof n&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}s(c,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),s(c,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),s(c,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),s(c,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),c.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},c.prototype.toHex=function(){return i.encode(this.toBytes(),"hex").toUpperCase()},e.exports=c},91037:e=>{e.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}},80953:(e,t,r)=>{"use strict";var n=t,i=r(13550),o=r(79746),s=r(34504);n.assert=o,n.toArray=s.toArray,n.zero2=s.zero2,n.toHex=s.toHex,n.encode=s.encode,n.getNAF=function(e,t,r){var n=new Array(Math.max(e.bitLength(),r)+1);n.fill(0);for(var i=1<(i>>1)-1?(i>>1)-c:c,o.isubn(a)):a=0,n[s]=a,o.iushrn(1)}return n},n.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n,i=0,o=0;e.cmpn(-i)>0||t.cmpn(-o)>0;){var s,a,c=e.andln(3)+i&3,u=t.andln(3)+o&3;3===c&&(c=-1),3===u&&(u=-1),s=0==(1&c)?0:3!=(n=e.andln(7)+i&7)&&5!==n||2!==u?c:-c,r[0].push(s),a=0==(1&u)?0:3!=(n=t.andln(7)+o&7)&&5!==n||2!==c?u:-u,r[1].push(a),2*i===s+1&&(i=1-i),2*o===a+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return r},n.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},n.parseBytes=function(e){return"string"==typeof e?n.toArray(e,"hex"):e},n.intFromLE=function(e){return new i(e,"hex","le")}},62378:e=>{"use strict";e.exports=function(e){for(var t=[],r=e.length,n=0;n=55296&&i<=56319&&r>n+1){var o=e.charCodeAt(n+1);o>=56320&&o<=57343&&(i=1024*(i-55296)+o-56320+65536,n+=1)}i<128?t.push(i):i<2048?(t.push(i>>6|192),t.push(63&i|128)):i<55296||i>=57344&&i<65536?(t.push(i>>12|224),t.push(i>>6&63|128),t.push(63&i|128)):i>=65536&&i<=1114111?(t.push(i>>18|240),t.push(i>>12&63|128),t.push(i>>6&63|128),t.push(63&i|128)):t.push(239,191,189)}return new Uint8Array(t).buffer}},32114:e=>{"use strict";function t(e,t){for(const r in t)Object.defineProperty(e,r,{value:t[r],enumerable:!0,configurable:!0});return e}e.exports=function(e,r,n){if(!e||"string"==typeof e)throw new TypeError("Please pass an Error to err-code");n||(n={}),"object"==typeof r&&(n=r,r=""),r&&(n.code=r);try{return t(e,n)}catch(r){n.message=e.message,n.stack=e.stack;const i=function(){};return i.prototype=Object.create(Object.getPrototypeOf(e)),t(new i,n)}}},76021:(e,t)=>{"use strict";function r(e){if("function"!=typeof e)throw new TypeError("Argument to promisify must be a function");var t=e["__ES6-PROMISIFY--CUSTOM-ARGUMENTS__"],n=r.Promise||Promise;if("function"!=typeof n)throw new Error("No Promise implementation found; do you need a polyfill?");return function(){for(var r=this,i=arguments.length,o=Array(i),s=0;s{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(8231);t.EventIterator=n.EventIterator,t.subscribe=function(e,t,r){return new n.EventIterator((({push:r})=>(this.addEventListener(e,r,t),()=>this.removeEventListener(e,r,t))),r)},t.default=n.EventIterator},8231:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class r{constructor(){this.pullQueue=[],this.pushQueue=[],this.eventHandlers={},this.isPaused=!1,this.isStopped=!1}push(e){if(this.isStopped)return;const t={value:e,done:!1};if(this.pullQueue.length){const e=this.pullQueue.shift();e&&e.resolve(t)}else this.pushQueue.push(Promise.resolve(t)),void 0!==this.highWaterMark&&this.pushQueue.length>=this.highWaterMark&&!this.isPaused&&(this.isPaused=!0,this.eventHandlers.highWater?this.eventHandlers.highWater():console&&console.warn(`EventIterator queue reached ${this.pushQueue.length} items`))}stop(){if(!this.isStopped){this.isStopped=!0,this.remove();for(const e of this.pullQueue)e.resolve({value:void 0,done:!0});this.pullQueue.length=0}}fail(e){if(!this.isStopped)if(this.isStopped=!0,this.remove(),this.pullQueue.length){for(const t of this.pullQueue)t.reject(e);this.pullQueue.length=0}else{const t=Promise.reject(e);t.catch((()=>{})),this.pushQueue.push(t)}}remove(){Promise.resolve().then((()=>{this.removeCallback&&this.removeCallback()}))}[Symbol.asyncIterator](){return{next:e=>{const t=this.pushQueue.shift();return t?(void 0!==this.lowWaterMark&&this.pushQueue.length<=this.lowWaterMark&&this.isPaused&&(this.isPaused=!1,this.eventHandlers.lowWater&&this.eventHandlers.lowWater()),t):this.isStopped?Promise.resolve({value:void 0,done:!0}):new Promise(((e,t)=>{this.pullQueue.push({resolve:e,reject:t})}))},return:()=>(this.isStopped=!0,this.pushQueue.length=0,this.remove(),Promise.resolve({value:void 0,done:!0}))}}}class n{constructor(e,{highWaterMark:t=100,lowWaterMark:n=1}={}){const i=new r;i.highWaterMark=t,i.lowWaterMark=n,i.removeCallback=e({push:e=>i.push(e),stop:()=>i.stop(),fail:e=>i.fail(e),on:(e,t)=>{i.eventHandlers[e]=t}})||(()=>{}),this[Symbol.asyncIterator]=()=>i[Symbol.asyncIterator](),Object.freeze(this)}}t.EventIterator=n,t.default=n},17187:e=>{"use strict";var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}y(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&y(e,"error",t,{once:!0})}(e,i)}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function u(e,t,r,n){var i,o,s,u;if(a(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),s=o[t]),void 0===s)s=o[t]=r,++e._eventsCount;else if("function"==typeof s?s=o[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=c(e))>0&&s.length>i&&!s.warned){s.warned=!0;var f=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");f.name="MaxListenersExceededWarning",f.emitter=e,f.type=t,f.count=s.length,u=f,console&&console.warn&&console.warn(u)}return e}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function l(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=f.bind(n);return i.listener=r,n.wrapFn=i,i}function h(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=o[e];if(void 0===c)return!1;if("function"==typeof c)n(c,this,t);else{var u=c.length,f=p(c,u);for(r=0;r=0;o--)if(r[o]===t||r[o].listener===t){s=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1=0;n--)this.removeListener(e,t[n]);return this},o.prototype.listeners=function(e){return h(this,e,!0)},o.prototype.rawListeners=function(e){return h(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):d.call(e,t)},o.prototype.listenerCount=d,o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},3975:e=>{e.exports=class{constructor(e){if(!(e>0)||0!=(e-1&e))throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(e),this.mask=e-1,this.top=0,this.btm=0,this.next=null}push(e){return void 0===this.buffer[this.top]&&(this.buffer[this.top]=e,this.top=this.top+1&this.mask,!0)}shift(){const e=this.buffer[this.btm];if(void 0!==e)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,e}peek(){return this.buffer[this.btm]}isEmpty(){return void 0===this.buffer[this.btm]}}},91607:(e,t,r)=>{const n=r(3975);e.exports=class{constructor(e){this.hwm=e||16,this.head=new n(this.hwm),this.tail=this.head}push(e){if(!this.head.push(e)){const t=this.head;this.head=t.next=new n(2*this.head.buffer.length),this.head.push(e)}}shift(){const e=this.tail.shift();if(void 0===e&&this.tail.next){const e=this.tail.next;return this.tail.next=null,this.tail=e,this.tail.shift()}return e}peek(){return this.tail.peek()}isEmpty(){return this.head.isEmpty()}}},22412:e=>{e.exports=function(e){if(e){if("function"==typeof e[Symbol.iterator])return e[Symbol.iterator]();if("function"==typeof e[Symbol.asyncIterator])return e[Symbol.asyncIterator]();if("function"==typeof e.next)return e}throw new Error("argument is not an iterator or iterable")}},33715:(e,t,r)=>{var n=t;n.utils=r(26436),n.common=r(95772),n.sha=r(89041),n.ripemd=r(12949),n.hmac=r(52344),n.sha1=n.sha.sha1,n.sha256=n.sha.sha256,n.sha224=n.sha.sha224,n.sha384=n.sha.sha384,n.sha512=n.sha.sha512,n.ripemd160=n.ripemd.ripemd160},95772:(e,t,r)=>{"use strict";var n=r(26436),i=r(79746);function o(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}t.BlockHash=o,o.prototype.update=function(e,t){if(e=n.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=n.join32(e,0,e.length-r,this.endian);for(var i=0;i>>24&255,n[i++]=e>>>16&255,n[i++]=e>>>8&255,n[i++]=255&e}else for(n[i++]=255&e,n[i++]=e>>>8&255,n[i++]=e>>>16&255,n[i++]=e>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;o{"use strict";var n=r(26436),i=r(79746);function o(e,t,r){if(!(this instanceof o))return new o(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(n.toArray(t,r))}e.exports=o,o.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),i(e.length<=this.blockSize);for(var t=e.length;t{"use strict";var n=r(26436),i=r(95772),o=n.rotl32,s=n.sum32,a=n.sum32_3,c=n.sum32_4,u=i.BlockHash;function f(){if(!(this instanceof f))return new f;u.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function l(e,t,r,n){return e<=15?t^r^n:e<=31?t&r|~t&n:e<=47?(t|~r)^n:e<=63?t&n|r&~n:t^(r|~n)}function h(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function d(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}n.inherits(f,u),t.ripemd160=f,f.blockSize=512,f.outSize=160,f.hmacStrength=192,f.padLength=64,f.prototype._update=function(e,t){for(var r=this.h[0],n=this.h[1],i=this.h[2],u=this.h[3],f=this.h[4],m=r,v=n,w=i,E=u,_=f,S=0;S<80;S++){var A=s(o(c(r,l(S,n,i,u),e[p[S]+t],h(S)),g[S]),f);r=f,f=u,u=o(i,10),i=n,n=A,A=s(o(c(m,l(79-S,v,w,E),e[y[S]+t],d(S)),b[S]),_),m=_,_=E,E=o(w,10),w=v,v=A}A=a(this.h[1],i,E),this.h[1]=a(this.h[2],u,_),this.h[2]=a(this.h[3],f,m),this.h[3]=a(this.h[4],r,v),this.h[4]=a(this.h[0],n,w),this.h[0]=A},f.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h,"little"):n.split32(this.h,"little")};var p=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],y=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],g=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],b=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},89041:(e,t,r)=>{"use strict";t.sha1=r(84761),t.sha224=r(10799),t.sha256=r(89344),t.sha384=r(80772),t.sha512=r(45900)},84761:(e,t,r)=>{"use strict";var n=r(26436),i=r(95772),o=r(37038),s=n.rotl32,a=n.sum32,c=n.sum32_5,u=o.ft_1,f=i.BlockHash,l=[1518500249,1859775393,2400959708,3395469782];function h(){if(!(this instanceof h))return new h;f.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}n.inherits(h,f),e.exports=h,h.blockSize=512,h.outSize=160,h.hmacStrength=80,h.padLength=64,h.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n{"use strict";var n=r(26436),i=r(89344);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}n.inherits(o,i),e.exports=o,o.blockSize=512,o.outSize=224,o.hmacStrength=192,o.padLength=64,o.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h.slice(0,7),"big"):n.split32(this.h.slice(0,7),"big")}},89344:(e,t,r)=>{"use strict";var n=r(26436),i=r(95772),o=r(37038),s=r(79746),a=n.sum32,c=n.sum32_4,u=n.sum32_5,f=o.ch32,l=o.maj32,h=o.s0_256,d=o.s1_256,p=o.g0_256,y=o.g1_256,g=i.BlockHash,b=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function m(){if(!(this instanceof m))return new m;g.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=b,this.W=new Array(64)}n.inherits(m,g),e.exports=m,m.blockSize=512,m.outSize=256,m.hmacStrength=192,m.padLength=64,m.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;n{"use strict";var n=r(26436),i=r(45900);function o(){if(!(this instanceof o))return new o;i.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}n.inherits(o,i),e.exports=o,o.blockSize=1024,o.outSize=384,o.hmacStrength=192,o.padLength=128,o.prototype._digest=function(e){return"hex"===e?n.toHex32(this.h.slice(0,12),"big"):n.split32(this.h.slice(0,12),"big")}},45900:(e,t,r)=>{"use strict";var n=r(26436),i=r(95772),o=r(79746),s=n.rotr64_hi,a=n.rotr64_lo,c=n.shr64_hi,u=n.shr64_lo,f=n.sum64,l=n.sum64_hi,h=n.sum64_lo,d=n.sum64_4_hi,p=n.sum64_4_lo,y=n.sum64_5_hi,g=n.sum64_5_lo,b=i.BlockHash,m=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function v(){if(!(this instanceof v))return new v;b.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=m,this.W=new Array(160)}function w(e,t,r,n,i){var o=e&r^~e&i;return o<0&&(o+=4294967296),o}function E(e,t,r,n,i,o){var s=t&n^~t&o;return s<0&&(s+=4294967296),s}function _(e,t,r,n,i){var o=e&r^e&i^r&i;return o<0&&(o+=4294967296),o}function S(e,t,r,n,i,o){var s=t&n^t&o^n&o;return s<0&&(s+=4294967296),s}function A(e,t){var r=s(e,t,28)^s(t,e,2)^s(t,e,7);return r<0&&(r+=4294967296),r}function T(e,t){var r=a(e,t,28)^a(t,e,2)^a(t,e,7);return r<0&&(r+=4294967296),r}function I(e,t){var r=a(e,t,14)^a(e,t,18)^a(t,e,9);return r<0&&(r+=4294967296),r}function C(e,t){var r=s(e,t,1)^s(e,t,8)^c(e,t,7);return r<0&&(r+=4294967296),r}function P(e,t){var r=a(e,t,1)^a(e,t,8)^u(e,t,7);return r<0&&(r+=4294967296),r}function R(e,t){var r=a(e,t,19)^a(t,e,29)^u(e,t,6);return r<0&&(r+=4294967296),r}n.inherits(v,b),e.exports=v,v.blockSize=1024,v.outSize=512,v.hmacStrength=192,v.padLength=128,v.prototype._prepareBlock=function(e,t){for(var r=this.W,n=0;n<32;n++)r[n]=e[t+n];for(;n{"use strict";var n=r(26436).rotr32;function i(e,t,r){return e&t^~e&r}function o(e,t,r){return e&t^e&r^t&r}function s(e,t,r){return e^t^r}t.ft_1=function(e,t,r,n){return 0===e?i(t,r,n):1===e||3===e?s(t,r,n):2===e?o(t,r,n):void 0},t.ch32=i,t.maj32=o,t.p32=s,t.s0_256=function(e){return n(e,2)^n(e,13)^n(e,22)},t.s1_256=function(e){return n(e,6)^n(e,11)^n(e,25)},t.g0_256=function(e){return n(e,7)^n(e,18)^e>>>3},t.g1_256=function(e){return n(e,17)^n(e,19)^e>>>10}},26436:(e,t,r)=>{"use strict";var n=r(79746),i=r(35717);function o(e,t){return 55296==(64512&e.charCodeAt(t))&&!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1))}function s(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function a(e){return 1===e.length?"0"+e:e}function c(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=i,t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),i=0;i>6|192,r[n++]=63&s|128):o(e,i)?(s=65536+((1023&s)<<10)+(1023&e.charCodeAt(++i)),r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=63&s|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=63&s|128)}else for(i=0;i>>0}return s},t.split32=function(e,t){for(var r=new Array(4*e.length),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},t.rotr32=function(e,t){return e>>>t|e<<32-t},t.rotl32=function(e,t){return e<>>32-t},t.sum32=function(e,t){return e+t>>>0},t.sum32_3=function(e,t,r){return e+t+r>>>0},t.sum32_4=function(e,t,r,n){return e+t+r+n>>>0},t.sum32_5=function(e,t,r,n,i){return e+t+r+n+i>>>0},t.sum64=function(e,t,r,n){var i=e[t],o=n+e[t+1]>>>0,s=(o>>0,e[t+1]=o},t.sum64_hi=function(e,t,r,n){return(t+n>>>0>>0},t.sum64_lo=function(e,t,r,n){return t+n>>>0},t.sum64_4_hi=function(e,t,r,n,i,o,s,a){var c=0,u=t;return c+=(u=u+n>>>0)>>0)>>0)>>0},t.sum64_4_lo=function(e,t,r,n,i,o,s,a){return t+n+o+a>>>0},t.sum64_5_hi=function(e,t,r,n,i,o,s,a,c,u){var f=0,l=t;return f+=(l=l+n>>>0)>>0)>>0)>>0)>>0},t.sum64_5_lo=function(e,t,r,n,i,o,s,a,c,u){return t+n+o+a+u>>>0},t.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},t.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},t.shr64_hi=function(e,t,r){return e>>>r},t.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},70248:e=>{e.exports=function(e){if(!e)throw Error("hashlru must have a max value, of type number, greater than 0");var t=0,r=Object.create(null),n=Object.create(null);function i(i,o){r[i]=o,++t>=e&&(t=0,n=r,r=Object.create(null))}return{has:function(e){return void 0!==r[e]||void 0!==n[e]},remove:function(e){void 0!==r[e]&&(r[e]=void 0),void 0!==n[e]&&(n[e]=void 0)},get:function(e){var t=r[e];return void 0!==t?t:void 0!==(t=n[e])?(i(e,t),t):void 0},set:function(e,t){void 0!==r[e]?r[e]=t:i(e,t)},clear:function(){r=Object.create(null),n=Object.create(null)}}}},2156:(e,t,r)=>{"use strict";var n=r(33715),i=r(34504),o=r(79746);function s(e){if(!(this instanceof s))return new s(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=i.toArray(e.entropy,e.entropyEnc||"hex"),r=i.toArray(e.nonce,e.nonceEnc||"hex"),n=i.toArray(e.pers,e.persEnc||"hex");o(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}e.exports=s,s.prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},s.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(n=r,r=t,t=null),r&&(r=i.toArray(r,n||"hex"),this._update(r));for(var o=[];o.length{t.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,c=(1<>1,f=-7,l=r?i-1:0,h=r?-1:1,d=e[t+l];for(l+=h,o=d&(1<<-f)-1,d>>=-f,f+=a;f>0;o=256*o+e[t+l],l+=h,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=n;f>0;s=256*s+e[t+l],l+=h,f-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,n),o-=u}return(d?-1:1)*s*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var s,a,c,u=8*o-i-1,f=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+l>=1?h/c:h*Math.pow(2,1-l))*c>=2&&(s++,c/=2),s+l>=f?(a=0,s=f):s+l>=1?(a=(t*c-1)*Math.pow(2,i),s+=l):(a=t*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;e[r+d]=255&a,d+=p,a/=256,i-=8);for(s=s<0;e[r+d]=255&s,d+=p,s/=256,u-=8);e[r+d-p]|=128*y}},95602:e=>{"use strict";e.exports=(e,t=1,r)=>{if(r={indent:" ",includeEmptyLines:!1,...r},"string"!=typeof e)throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof e}\``);if("number"!=typeof t)throw new TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof t}\``);if("string"!=typeof r.indent)throw new TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof r.indent}\``);if(0===t)return e;const n=r.includeEmptyLines?/^/gm:/^(?!\s*$)/gm;return e.replace(n,r.indent.repeat(t))}},35717:e=>{"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},91843:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.v6=t.AddressError=t.Address6=t.Address4=void 0;var s=r(62507);Object.defineProperty(t,"Address4",{enumerable:!0,get:function(){return s.Address4}});var a=r(76862);Object.defineProperty(t,"Address6",{enumerable:!0,get:function(){return a.Address6}});var c=r(64762);Object.defineProperty(t,"AddressError",{enumerable:!0,get:function(){return c.AddressError}});var u=o(r(16454));t.v6={helpers:u}},64762:function(e,t){"use strict";var r,n=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},r(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.AddressError=void 0;var i=function(e){function t(t,r){var n=e.call(this,t)||this;return n.name="AddressError",null!==r&&(n.parseMessage=r),n}return n(t,e),t}(Error);t.AddressError=i},72029:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isCorrect=t.isInSubnet=void 0,t.isInSubnet=function(e){return!(this.subnetMaska.BITS)throw new c.AddressError("Invalid subnet mask.");e=e.replace(a.RE_SUBNET_STRING,"")}this.addressMinusSuffix=e,this.parsedAddress=this.parse(e)}return e.isValid=function(t){try{return new e(t),!0}catch(e){return!1}},e.prototype.parse=function(e){var t=e.split(".");if(!e.match(a.RE_ADDRESS))throw new c.AddressError("Invalid IPv4 address.");return t},e.prototype.correctForm=function(){return this.parsedAddress.map((function(e){return parseInt(e,10)})).join(".")},e.fromHex=function(t){var r,n=t.replace(/:/g,"").padStart(8,"0"),i=[];for(r=0;r<8;r+=2){var o=n.slice(r,r+2);i.push(parseInt(o,16))}return new e(i.join("."))},e.fromInteger=function(t){return e.fromHex(t.toString(16))},e.fromArpa=function(t){return new e(t.replace(/(\.in-addr\.arpa)?\.$/,"").split(".").reverse().join("."))},e.prototype.toHex=function(){return this.parsedAddress.map((function(e){return f.sprintf("%02x",parseInt(e,10))})).join(":")},e.prototype.toArray=function(){return this.parsedAddress.map((function(e){return parseInt(e,10)}))},e.prototype.toGroup6=function(){var e,t=[];for(e=0;e%s.%s',e.slice(0,2).join("."),e.slice(2,4).join(".")))},e}();t.Address4=l},76862:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t},s=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r$1$2')).replace(/^(0{1,})(0)$/,'$1$2')}function m(e){return y.sprintf("%04x",parseInt(e,16))}function v(e){return 255&e}var w=function(){function e(e,t){this.addressMinusSuffix="",this.parsedSubnet="",this.subnet="/128",this.subnetMask=128,this.v4=!1,this.zone="",this.isInSubnet=a.isInSubnet,this.isCorrect=a.isCorrect(u.BITS),this.groups=void 0===t?u.GROUPS:t,this.address=e;var r=u.RE_SUBNET_STRING.exec(e);if(r){if(this.parsedSubnet=r[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet="/"+this.subnetMask,Number.isNaN(this.subnetMask)||this.subnetMask<0||this.subnetMask>u.BITS)throw new d.AddressError("Invalid subnet mask.");e=e.replace(u.RE_SUBNET_STRING,"")}else if(/\//.test(e))throw new d.AddressError("Invalid subnet mask.");var n=u.RE_ZONE_STRING.exec(e);n&&(this.zone=n[0],e=e.replace(u.RE_ZONE_STRING,"")),this.addressMinusSuffix=e,this.parsedAddress=this.parse(this.addressMinusSuffix)}return e.isValid=function(t){try{return new e(t),!0}catch(e){return!1}},e.fromBigInteger=function(t){var r,n=t.toString(16).padStart(32,"0"),i=[];for(r=0;r65536)&&(i=null):i=null,{address:new e(r),port:i}},e.fromAddress4=function(t){var r=new l.Address4(t),n=u.BITS-(c.BITS-r.subnetMask);return new e("::ffff:"+r.correctForm()+"/"+n)},e.fromArpa=function(t){var r=t.replace(/(\.ip6\.arpa)?\.$/,"");if(63!==r.length)throw new d.AddressError("Invalid 'ip6.arpa' form.");for(var n=r.split(".").reverse(),i=7;i>0;i--){var o=4*i;n.splice(o,0,":")}return new e(r=n.join(""))},e.prototype.microsoftTranscription=function(){return y.sprintf("%s.ipv6-literal.net",this.correctForm().replace(/:/g,"-"))},e.prototype.mask=function(e){return void 0===e&&(e=this.subnetMask),this.getBitsBase2(0,e)},e.prototype.possibleSubnets=function(e){void 0===e&&(e=128);var t=u.BITS-this.subnetMask-Math.abs(e-u.BITS);return t<0?"0":function(e){for(var t=/(\d+)(\d{3})/;t.test(e);)e=e.replace(t,"$1,$2");return e}(new p.BigInteger("2",10).pow(t).toString(10))},e.prototype._startAddress=function(){return new p.BigInteger(this.mask()+"0".repeat(u.BITS-this.subnetMask),2)},e.prototype.startAddress=function(){return e.fromBigInteger(this._startAddress())},e.prototype.startAddressExclusive=function(){var t=new p.BigInteger("1");return e.fromBigInteger(this._startAddress().add(t))},e.prototype._endAddress=function(){return new p.BigInteger(this.mask()+"1".repeat(u.BITS-this.subnetMask),2)},e.prototype.endAddress=function(){return e.fromBigInteger(this._endAddress())},e.prototype.endAddressExclusive=function(){var t=new p.BigInteger("1");return e.fromBigInteger(this._endAddress().subtract(t))},e.prototype.getScope=function(){var e=u.SCOPES[this.getBits(12,16).intValue()];return"Global unicast"===this.getType()&&"Link local"!==e&&(e="Global"),e||"Unknown"},e.prototype.getType=function(){for(var t=0,r=Object.keys(u.TYPES);t0?e.omitSuffix?r:y.sprintf("%s.ip6.arpa.",r):e.omitSuffix?"":"ip6.arpa."},e.prototype.correctForm=function(){var e,t=[],r=0,n=[];for(e=0;e0&&(r>1&&n.push([e-r,e-1]),r=0)}r>1&&n.push([this.parsedAddress.length-r,this.parsedAddress.length-1]);var o=n.map((function(e){return e[1]-e[0]+1}));if(n.length>0){var s=o.indexOf(Math.max.apply(Math,o));t=function(e,t){var r,n=[],i=[];for(r=0;rt[1]&&i.push(e[r]);return n.concat(["compact"]).concat(i)}(this.parsedAddress,n[s])}else t=this.parsedAddress;for(e=0;e1?"s":"",t.join("")),e.replace(u.RE_BAD_CHARACTERS,'$1'));var r=e.match(u.RE_BAD_ADDRESS);if(r)throw new d.AddressError(y.sprintf("Address failed regex: %s",r.join("")),e.replace(u.RE_BAD_ADDRESS,'$1'));var n=[],i=e.split("::");if(2===i.length){var o=i[0].split(":"),s=i[1].split(":");1===o.length&&""===o[0]&&(o=[]),1===s.length&&""===s[0]&&(s=[]);var a=this.groups-(o.length+s.length);if(!a)throw new d.AddressError("Error parsing groups");this.elidedGroups=a,this.elisionBegin=o.length,this.elisionEnd=o.length+this.elidedGroups,n=n.concat(o);for(var c=0;c=0;o--)n=n.add(i.multiply(new p.BigInteger(t[o].toString(10),10))),i=i.multiply(r);return e.fromBigInteger(n)},e.prototype.isCanonical=function(){return this.addressMinusSuffix===this.canonicalForm()},e.prototype.isLinkLocal=function(){return"1111111010000000000000000000000000000000000000000000000000000000"===this.getBitsBase2(0,64)},e.prototype.isMulticast=function(){return"Multicast"===this.getType()},e.prototype.is4=function(){return this.v4},e.prototype.isTeredo=function(){return this.isInSubnet(new e("2001::/32"))},e.prototype.is6to4=function(){return this.isInSubnet(new e("2002::/16"))},e.prototype.isLoopback=function(){return"Loopback"===this.getType()},e.prototype.href=function(e){return e=void 0===e?"":y.sprintf(":%s",e),y.sprintf("http://[%s]%s/",this.correctForm(),e)},e.prototype.link=function(e){e||(e={}),void 0===e.className&&(e.className=""),void 0===e.prefix&&(e.prefix="/#address="),void 0===e.v4&&(e.v4=!1);var t=this.correctForm;return e.v4&&(t=this.to4in6),e.className?y.sprintf('%2$s',e.prefix,t.call(this),e.className):y.sprintf('%2$s',e.prefix,t.call(this))},e.prototype.group=function(){if(0===this.elidedGroups)return f.simpleGroup(this.address).join(":");g("number"==typeof this.elidedGroups),g("number"==typeof this.elisionBegin);var e=[],t=this.address.split("::"),r=t[0],n=t[1];r.length?e.push.apply(e,f.simpleGroup(r)):e.push("");for(var i=["hover-group"],o=this.elisionBegin;o',i.join(" "))),n.length?e.push.apply(e,f.simpleGroup(n,this.elisionEnd)):e.push(""),this.is4()&&(g(this.address4 instanceof l.Address4),e.pop(),e.push(this.address4.groupForV6())),e.join(":")},e.prototype.regularExpressionString=function(t){void 0===t&&(t=!1);var r=[],n=new e(this.correctForm());if(0===n.elidedGroups)r.push(h.simpleRegularExpression(n.parsedAddress));else if(n.elidedGroups===u.GROUPS)r.push(h.possibleElisions(u.GROUPS));else{var i=n.address.split("::");i[0].length&&r.push(h.simpleRegularExpression(i[0].split(":"))),g("number"==typeof n.elidedGroups),r.push(h.possibleElisions(n.elidedGroups,0!==i[0].length,0!==i[1].length)),i[1].length&&r.push(h.simpleRegularExpression(i[1].split(":"))),r=[r.join(":")]}return t||(r=s(s(["(?=^|",h.ADDRESS_BOUNDARY,"|[^\\w\\:])("],r),[")(?=[^\\w\\:]|",h.ADDRESS_BOUNDARY,"|$)"])),r.join("")},e.prototype.regularExpression=function(e){return void 0===e&&(e=!1),new RegExp(this.regularExpressionString(e),"i")},e}();t.Address6=w},37802:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RE_SUBNET_STRING=t.RE_ADDRESS=t.GROUPS=t.BITS=void 0,t.BITS=32,t.GROUPS=4,t.RE_ADDRESS=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/g,t.RE_SUBNET_STRING=/\/\d{1,2}$/},88521:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RE_URL_WITH_PORT=t.RE_URL=t.RE_ZONE_STRING=t.RE_SUBNET_STRING=t.RE_BAD_ADDRESS=t.RE_BAD_CHARACTERS=t.TYPES=t.SCOPES=t.GROUPS=t.BITS=void 0,t.BITS=128,t.GROUPS=8,t.SCOPES={0:"Reserved",1:"Interface local",2:"Link local",4:"Admin local",5:"Site local",8:"Organization local",14:"Global",15:"Reserved"},t.TYPES={"ff01::1/128":"Multicast (All nodes on this interface)","ff01::2/128":"Multicast (All routers on this interface)","ff02::1/128":"Multicast (All nodes on this link)","ff02::2/128":"Multicast (All routers on this link)","ff05::2/128":"Multicast (All routers in this site)","ff02::5/128":"Multicast (OSPFv3 AllSPF routers)","ff02::6/128":"Multicast (OSPFv3 AllDR routers)","ff02::9/128":"Multicast (RIP routers)","ff02::a/128":"Multicast (EIGRP routers)","ff02::d/128":"Multicast (PIM routers)","ff02::16/128":"Multicast (MLDv2 reports)","ff01::fb/128":"Multicast (mDNSv6)","ff02::fb/128":"Multicast (mDNSv6)","ff05::fb/128":"Multicast (mDNSv6)","ff02::1:2/128":"Multicast (All DHCP servers and relay agents on this link)","ff05::1:2/128":"Multicast (All DHCP servers and relay agents in this site)","ff02::1:3/128":"Multicast (All DHCP servers on this link)","ff05::1:3/128":"Multicast (All DHCP servers in this site)","::/128":"Unspecified","::1/128":"Loopback","ff00::/8":"Multicast","fe80::/10":"Link-local unicast"},t.RE_BAD_CHARACTERS=/([^0-9a-f:/%])/gi,t.RE_BAD_ADDRESS=/([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi,t.RE_SUBNET_STRING=/\/\d{1,3}(?=%|$)/,t.RE_ZONE_STRING=/%.*$/,t.RE_URL=new RegExp(/^\[{0,1}([0-9a-f:]+)\]{0,1}/),t.RE_URL_WITH_PORT=new RegExp(/\[([0-9a-f:]+)\]:([0-9]{1,5})/)},16454:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.simpleGroup=t.spanLeadingZeroes=t.spanAll=t.spanAllZeroes=void 0;var n=r(8975);function i(e){return e.replace(/(0+)/g,'$1')}function o(e){return e.replace(/^(0+)/,'$1')}t.spanAllZeroes=i,t.spanAll=function(e,t){return void 0===t&&(t=0),e.split("").map((function(e,r){return n.sprintf('%s',e,r+t,i(e))})).join("")},t.spanLeadingZeroes=function(e){return e.split(":").map((function(e){return o(e)})).join(":")},t.simpleGroup=function(e,t){return void 0===t&&(t=0),e.split(":").map((function(e,r){return/group-v4/.test(e)?e:n.sprintf('%s',r+t,o(e))}))}},34489:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.possibleElisions=t.simpleRegularExpression=t.ADDRESS_BOUNDARY=t.padGroup=t.groupPossibilities=void 0;var s=o(r(88521)),a=r(8975);function c(e){return a.sprintf("(%s)",e.join("|"))}function u(e){return e.length<4?a.sprintf("0{0,%d}%s",4-e.length,e):e}t.groupPossibilities=c,t.padGroup=u,t.ADDRESS_BOUNDARY="[^A-Fa-f0-9:]",t.simpleRegularExpression=function(e){var t=[];e.forEach((function(e,r){0===parseInt(e,16)&&t.push(r)}));var r=t.map((function(t){return e.map((function(e,r){if(r===t){var n=0===r||r===s.GROUPS-1?":":"";return c([u(e),n])}return u(e)})).join(":")}));return r.push(e.map(u).join(":")),c(r)},t.possibleElisions=function(e,t,r){var n=t?"":":",i=r?"":":",o=[];t||r||o.push("::"),t&&r&&o.push(""),(r&&!t||!r&&t)&&o.push(":"),o.push(a.sprintf("%s(:0{1,4}){1,%d}",n,e-1)),o.push(a.sprintf("(0{1,4}:){1,%d}%s",e-1,i)),o.push(a.sprintf("(0{1,4}:){%d}0{1,4}",e-1));for(var s=1;s{"use strict";const t="[a-fA-F\\d:]",r=e=>e&&e.includeBoundaries?`(?:(?<=\\s|^)(?=${t})|(?<=${t})(?=\\s|$))`:"",n="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",i="[a-fA-F\\d]{1,4}",o=`\n(?:\n(?:${i}:){7}(?:${i}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:${i}:){6}(?:${n}|:${i}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4\n(?:${i}:){5}(?::${n}|(?::${i}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4\n(?:${i}:){4}(?:(?::${i}){0,1}:${n}|(?::${i}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4\n(?:${i}:){3}(?:(?::${i}){0,2}:${n}|(?::${i}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4\n(?:${i}:){2}(?:(?::${i}){0,3}:${n}|(?::${i}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:${i}:){1}(?:(?::${i}){0,4}:${n}|(?::${i}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::${i}){0,5}:${n}|(?::${i}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1\n`.replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),s=new RegExp(`(?:^${n}$)|(?:^${o}$)`),a=new RegExp(`^${n}$`),c=new RegExp(`^${o}$`),u=e=>e&&e.exact?s:new RegExp(`(?:${r(e)}${n}${r(e)})|(?:${r(e)}${o}${r(e)})`,"g");u.v4=e=>e&&e.exact?a:new RegExp(`${r(e)}${n}${r(e)}`,"g"),u.v6=e=>e&&e.exact?c:new RegExp(`${r(e)}${o}${r(e)}`,"g"),e.exports=u},56512:function(e){!function(t){"use strict";const r="(0?\\d+|0x[a-f0-9]+)",n={fourOctet:new RegExp(`^${r}\\.${r}\\.${r}\\.${r}$`,"i"),threeOctet:new RegExp(`^${r}\\.${r}\\.${r}$`,"i"),twoOctet:new RegExp(`^${r}\\.${r}$`,"i"),longValue:new RegExp(`^${r}$`,"i")},i=new RegExp("^0[0-7]+$","i"),o=new RegExp("^0x[a-f0-9]+$","i"),s="%[0-9a-z]{1,}",a="(?:[0-9a-f]+::?)+",c={zoneIndex:new RegExp(s,"i"),native:new RegExp(`^(::)?(${a})?([0-9a-f]+)?(::)?(${s})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${r}\\.${r}\\.${r}\\.${r}(${s})?)$`,"i"),transitional:new RegExp(`^((?:${a})|(?:::)(?:${a})?)${r}\\.${r}\\.${r}\\.${r}(${s})?$`,"i")};function u(e,t){if(e.indexOf("::")!==e.lastIndexOf("::"))return null;let r,n,i=0,o=-1,s=(e.match(c.zoneIndex)||[])[0];for(s&&(s=s.substring(1),e=e.replace(/%.+$/,""));(o=e.indexOf(":",o+1))>=0;)i++;if("::"===e.substr(0,2)&&i--,"::"===e.substr(-2,2)&&i--,i>t)return null;for(n=t-i,r=":";n--;)r+="0:";return":"===(e=e.replace("::",r))[0]&&(e=e.slice(1)),":"===e[e.length-1]&&(e=e.slice(0,-1)),{parts:t=function(){const t=e.split(":"),r=[];for(let e=0;e0;){if(i=r-n,i<0&&(i=0),e[o]>>i!=t[o]>>i)return!1;n-=r,o+=1}return!0}function l(e){if(o.test(e))return parseInt(e,16);if("0"===e[0]&&!isNaN(parseInt(e[1],10))){if(i.test(e))return parseInt(e,8);throw new Error(`ipaddr: cannot parse ${e} as octal`)}return parseInt(e,10)}function h(e,t){for(;e.length=0;n-=1){if(i=this.octets[n],!(i in r))return null;if(o=r[i],t&&0!==o)return null;8!==o&&(t=!0),e+=o}return 32-e},e.prototype.range=function(){return d.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){return this.octets.slice(0)},e.prototype.toIPv4MappedAddress=function(){return d.IPv6.parse(`::ffff:${this.toString()}`)},e.prototype.toNormalizedString=function(){return this.toString()},e.prototype.toString=function(){return this.octets.join(".")},e}(),d.IPv4.broadcastAddressFromCIDR=function(e){try{const t=this.parseCIDR(e),r=t[0].toByteArray(),n=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[];let o=0;for(;o<4;)i.push(parseInt(r[o],10)|255^parseInt(n[o],10)),o++;return new this(i)}catch(e){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},d.IPv4.isIPv4=function(e){return null!==this.parser(e)},d.IPv4.isValid=function(e){try{return new this(this.parser(e)),!0}catch(e){return!1}},d.IPv4.isValidFourPartDecimal=function(e){return!(!d.IPv4.isValid(e)||!e.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},d.IPv4.networkAddressFromCIDR=function(e){let t,r,n,i,o;try{for(t=this.parseCIDR(e),n=t[0].toByteArray(),o=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],r=0;r<4;)i.push(parseInt(n[r],10)&parseInt(o[r],10)),r++;return new this(i)}catch(e){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},d.IPv4.parse=function(e){const t=this.parser(e);if(null===t)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(t)},d.IPv4.parseCIDR=function(e){let t;if(t=e.match(/^(.+)\/(\d+)$/)){const e=parseInt(t[2]);if(e>=0&&e<=32){const r=[this.parse(t[1]),e];return Object.defineProperty(r,"toString",{value:function(){return this.join("/")}}),r}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},d.IPv4.parser=function(e){let t,r,i;if(t=e.match(n.fourOctet))return function(){const e=t.slice(1,6),n=[];for(let t=0;t4294967295||i<0)throw new Error("ipaddr: address outside defined range");return function(){const e=[];let t;for(t=0;t<=24;t+=8)e.push(i>>t&255);return e}().reverse()}return(t=e.match(n.twoOctet))?function(){const e=t.slice(1,4),r=[];if(i=l(e[1]),i>16777215||i<0)throw new Error("ipaddr: address outside defined range");return r.push(l(e[0])),r.push(i>>16&255),r.push(i>>8&255),r.push(255&i),r}():(t=e.match(n.threeOctet))?function(){const e=t.slice(1,5),r=[];if(i=l(e[2]),i>65535||i<0)throw new Error("ipaddr: address outside defined range");return r.push(l(e[0])),r.push(l(e[1])),r.push(i>>8&255),r.push(255&i),r}():null},d.IPv4.subnetMaskFromPrefixLength=function(e){if((e=parseInt(e))<0||e>32)throw new Error("ipaddr: invalid IPv4 prefix length");const t=[0,0,0,0];let r=0;const n=Math.floor(e/8);for(;r=0;o-=1){if(n=this.parts[o],!(n in r))return null;if(i=r[n],t&&0!==i)return null;16!==i&&(t=!0),e+=i}return 128-e},e.prototype.range=function(){return d.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){let e;const t=[],r=this.parts;for(let n=0;n>8),t.push(255&e);return t},e.prototype.toFixedLengthString=function(){const e=function(){const e=[];for(let t=0;t>8,255&t,r>>8,255&r])},e.prototype.toNormalizedString=function(){const e=function(){const e=[];for(let t=0;ti&&(n=r.index,i=r[0].length);return i<0?t:`${t.substring(0,n)}::${t.substring(n+i)}`},e.prototype.toString=function(){return this.toNormalizedString().replace(/((^|:)(0(:|$))+)/,"::")},e}(),d.IPv6.broadcastAddressFromCIDR=function(e){try{const t=this.parseCIDR(e),r=t[0].toByteArray(),n=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[];let o=0;for(;o<16;)i.push(parseInt(r[o],10)|255^parseInt(n[o],10)),o++;return new this(i)}catch(e){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`)}},d.IPv6.isIPv6=function(e){return null!==this.parser(e)},d.IPv6.isValid=function(e){if("string"==typeof e&&-1===e.indexOf(":"))return!1;try{const t=this.parser(e);return new this(t.parts,t.zoneId),!0}catch(e){return!1}},d.IPv6.networkAddressFromCIDR=function(e){let t,r,n,i,o;try{for(t=this.parseCIDR(e),n=t[0].toByteArray(),o=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],r=0;r<16;)i.push(parseInt(n[r],10)&parseInt(o[r],10)),r++;return new this(i)}catch(e){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`)}},d.IPv6.parse=function(e){const t=this.parser(e);if(null===t.parts)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(t.parts,t.zoneId)},d.IPv6.parseCIDR=function(e){let t,r,n;if((r=e.match(/^(.+)\/(\d+)$/))&&(t=parseInt(r[2]),t>=0&&t<=128))return n=[this.parse(r[1]),t],Object.defineProperty(n,"toString",{value:function(){return this.join("/")}}),n;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},d.IPv6.parser=function(e){let t,r,n,i,o,s;if(n=e.match(c.deprecatedTransitional))return this.parser(`::ffff:${n[1]}`);if(c.native.test(e))return u(e,8);if((n=e.match(c.transitional))&&(s=n[6]||"",t=u(n[1].slice(0,-1)+s,6),t.parts)){for(o=[parseInt(n[2]),parseInt(n[3]),parseInt(n[4]),parseInt(n[5])],r=0;r128)throw new Error("ipaddr: invalid IPv6 prefix length");const t=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let r=0;const n=Math.floor(e/8);for(;r{e.exports=function(e){return null!=e&&null!=e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}},59134:(e,t,r)=>{var n=r(34155);e.exports=function(){return"undefined"!=typeof window&&"object"==typeof window.process&&"renderer"===window.process.type||!(void 0===n||"object"!=typeof n.versions||!n.versions.electron)||"object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent.indexOf("Electron")>=0}},5003:(e,t,r)=>{"use strict";const n=r(1476),i=e=>n({exact:!0}).test(e);i.v4=e=>n.v4({exact:!0}).test(e),i.v6=e=>n.v6({exact:!0}).test(e),i.version=e=>i(e)?i.v4(e)?4:6:void 0,e.exports=i},51890:e=>{"use strict";e.exports=function(e){return/^127\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/i.test(e)||/^::1$/.test(e)}},6898:e=>{"use strict";e.exports=e=>!!e&&("symbol"==typeof Symbol.observable&&"function"==typeof e[Symbol.observable]?e===e[Symbol.observable]():"function"==typeof e["@@observable"]&&e===e["@@observable"]())},33310:e=>{"use strict";e.exports=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}},1914:e=>{"use strict";const t=65536;e.exports=function(e){const r=new Uint8Array(e);let n=0;if(e>0)if(e>t)for(;ne?(crypto.getRandomValues(r.subarray(n,n+(e-n))),n+=e-n):(crypto.getRandomValues(r.subarray(n,n+t)),n+=t);else crypto.getRandomValues(r);return r}},17745:(e,t,r)=>{"use strict";const{URLWithLegacySupport:n,format:i,URLSearchParams:o,defaultBase:s}=r(82049),a=r(15939);e.exports={URL:n,URLSearchParams:o,format:i,relative:a,defaultBase:s}},15939:(e,t,r)=>{"use strict";const{URLWithLegacySupport:n,format:i}=r(82049);e.exports=(e,t={},r={},o)=>{let s,a=t.protocol?t.protocol.replace(":",""):"http";a=(r[a]||o||a)+":";try{s=new n(e)}catch(e){s={}}const c=Object.assign({},t,{protocol:a||s.protocol,host:t.host||s.host});return new n(e,i(c)).toString()}},82049:e=>{"use strict";const t="undefined"!=typeof navigator&&"ReactNative"===navigator.product,r=self.URL,n=t?"http://localhost":self.location?self.location.protocol+"//"+self.location.host:"";e.exports={URLWithLegacySupport:class{constructor(e="",t=n){this.super=new r(e,t),this.path=this.pathname+this.search,this.auth=this.username&&this.password?this.username+":"+this.password:null,this.query=this.search&&this.search.startsWith("?")?this.search.slice(1):null}get hash(){return this.super.hash}get host(){return this.super.host}get hostname(){return this.super.hostname}get href(){return this.super.href}get origin(){return this.super.origin}get password(){return this.super.password}get pathname(){return this.super.pathname}get port(){return this.super.port}get protocol(){return this.super.protocol}get search(){return this.super.search}get searchParams(){return this.super.searchParams}get username(){return this.super.username}set hash(e){this.super.hash=e}set host(e){this.super.host=e}set hostname(e){this.super.hostname=e}set href(e){this.super.href=e}set password(e){this.super.password=e}set pathname(e){this.super.pathname=e}set port(e){this.super.port=e}set protocol(e){this.super.protocol=e}set search(e){this.super.search=e}set username(e){this.super.username=e}static createObjectURL(e){return r.createObjectURL(e)}static revokeObjectURL(e){r.revokeObjectURL(e)}toJSON(){return this.super.toJSON()}toString(){return this.super.toString()}format(){return this.toString()}},URLSearchParams:self.URLSearchParams,defaultBase:n,format:function(e){if("string"==typeof e)return new r(e).toString();if(!(e instanceof r)){const t=e.username&&e.password?`${e.username}:${e.password}@`:"",r=e.auth?e.auth+"@":"",n=e.port?":"+e.port:"",i=e.protocol?e.protocol+"//":"",o=e.host||"",s=e.hostname||"",a=e.search||(e.query?"?"+e.query:""),c=e.hash||"",u=e.pathname||"";return`${i}${t||r}${o||s+n}${e.path||u+a}${c}`}}}},96653:(e,t,r)=>{"use strict";const{Buffer:n}=r(48764),i=r(9668);e.exports=async function*(e){for await(const t of e)n.isBuffer(t)?yield t:i.isBufferList(t)?yield t.slice():yield n.from(t)},e.exports.toBuffer=e.exports,e.exports.toList=async function*(e){for await(const t of e)n.isBuffer(t)?yield(new i).append(t):i.isBufferList(t)?yield t:yield(new i).append(n.from(t))}},64593:e=>{"use strict";e.exports=async e=>{for await(const t of e);}},55565:e=>{"use strict";e.exports=async function*(e,t){for await(const r of e)await t(r)&&(yield r)}},72262:e=>{"use strict";e.exports=async e=>{for await(const t of e)return t}},52261:(e,t,r)=>{"use strict";const n=r(53469),i=r(84975),o=r(63931);e.exports=e=>{const t=i(),r=n(e.source),s=o();let a;const c=e.sink(async function*(){yield*t;const e=await s.promise;yield*e}());return c.catch((e=>{a=e})),{reader:r,writer:t,stream:{sink:e=>a?Promise.reject(a):(s.resolve(e),c),source:r},rest:()=>t.end(),write:t.push,read:async()=>(await r.next()).value}}},33635:(e,t,r)=>{"use strict";const{Buffer:n}=r(12836),i=Symbol.for("BufferList");function o(e){if(!(this instanceof o))return new o(e);o._init.call(this,e)}o._init=function(e){Object.defineProperty(this,i,{value:!0}),this._bufs=[],this.length=0,e&&this.append(e)},o.prototype._new=function(e){return new o(e)},o.prototype._offset=function(e){if(0===e)return[0,0];let t=0;for(let r=0;rthis.length||e<0)return;const t=this._offset(e);return this._bufs[t[0]][t[1]]},o.prototype.slice=function(e,t){return"number"==typeof e&&e<0&&(e+=this.length),"number"==typeof t&&t<0&&(t+=this.length),this.copy(null,0,e,t)},o.prototype.copy=function(e,t,r,i){if(("number"!=typeof r||r<0)&&(r=0),("number"!=typeof i||i>this.length)&&(i=this.length),r>=this.length)return e||n.alloc(0);if(i<=0)return e||n.alloc(0);const o=!!e,s=this._offset(r),a=i-r;let c=a,u=o&&t||0,f=s[1];if(0===r&&i===this.length){if(!o)return 1===this._bufs.length?this._bufs[0]:n.concat(this._bufs,this.length);for(let t=0;tr)){this._bufs[t].copy(e,u,f,f+c),u+=r;break}this._bufs[t].copy(e,u,f),u+=r,c-=r,f&&(f=0)}return e.length>u?e.slice(0,u):e},o.prototype.shallowSlice=function(e,t){if(e=e||0,t="number"!=typeof t?this.length:t,e<0&&(e+=this.length),t<0&&(t+=this.length),e===t)return this._new();const r=this._offset(e),n=this._offset(t),i=this._bufs.slice(r[0],n[0]+1);return 0===n[1]?i.pop():i[i.length-1]=i[i.length-1].slice(0,n[1]),0!==r[1]&&(i[0]=i[0].slice(r[1])),this._new(i)},o.prototype.toString=function(e,t,r){return this.slice(t,r).toString(e)},o.prototype.consume=function(e){if(e=Math.trunc(e),Number.isNaN(e)||e<=0)return this;for(;this._bufs.length;){if(!(e>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},o.prototype.duplicate=function(){const e=this._new();for(let t=0;tthis.length?this.length:t;const i=this._offset(t);let o=i[0],s=i[1];for(;o=e.length){const r=t.indexOf(e,s);if(-1!==r)return this._reverseOffset([o,r]);s=t.length-e.length+1}else{const t=this._reverseOffset([o,s]);if(this._match(t,e))return t;s++}s=0}return-1},o.prototype._match=function(e,t){if(this.length-e{"use strict";var n=r(79742),i=r(80645),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=c,t.SlowBuffer=function(e){return+e!=e&&(e=0),c.alloc(+e)},t.INSPECT_MAX_BYTES=50;var s=2147483647;function a(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return l(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|y(e,t),n=a(r),i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(V(e,Uint8Array)){var t=new Uint8Array(e);return d(t.buffer,t.byteOffset,t.byteLength)}return h(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(V(e,ArrayBuffer)||e&&V(e.buffer,ArrayBuffer))return d(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(V(e,SharedArrayBuffer)||e&&V(e.buffer,SharedArrayBuffer)))return d(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return c.from(n,t,r);var i=function(e){if(c.isBuffer(e)){var t=0|p(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||F(e.length)?a(0):h(e):"Buffer"===e.type&&Array.isArray(e.data)?h(e.data):void 0}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function f(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function l(e){return f(e),a(e<0?0:0|p(e))}function h(e){for(var t=e.length<0?0:0|p(e.length),r=a(t),n=0;n=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function y(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||V(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return K(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return U(e).length;default:if(i)return n?-1:K(e).length;t=(""+t).toLowerCase(),i=!0}}function g(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return k(this,t,r);case"utf8":case"utf-8":return I(this,t,r);case"ascii":return P(this,t,r);case"latin1":case"binary":return R(this,t,r);case"base64":return T(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function b(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function m(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),F(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=c.from(t,n)),c.isBuffer(t))return 0===t.length?-1:v(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):v(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,r,n,i){var o,s=1,a=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var f=-1;for(o=r;oa&&(r=a-c),o=r;o>=0;o--){for(var l=!0,h=0;hi&&(n=i):n=i;var o=t.length;n>o/2&&(n=o/2);for(var s=0;s>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function T(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function I(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i239?4:u>223?3:u>191?2:1;if(i+l<=r)switch(l){case 1:u<128&&(f=u);break;case 2:128==(192&(o=e[i+1]))&&(c=(31&u)<<6|63&o)>127&&(f=c);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(c=(15&u)<<12|(63&o)<<6|63&s)>2047&&(c<55296||c>57343)&&(f=c);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(c=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(f=c)}null===f?(f=65533,l=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),i+=l}return function(e){var t=e.length;if(t<=C)return String.fromCharCode.apply(String,e);for(var r="",n=0;nn.length?c.from(o).copy(n,i):Uint8Array.prototype.set.call(n,o,i);else{if(!c.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i)}i+=o.length}return n},c.byteLength=y,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;tr&&(e+=" ... "),""},o&&(c.prototype[o]=c.prototype.inspect),c.prototype.compare=function(e,t,r,n,i){if(V(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),u=this.slice(n,i),f=e.slice(t,r),l=0;l>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return w(this,e,t,r);case"utf8":case"utf-8":return E(this,e,t,r);case"ascii":case"latin1":case"binary":return _(this,e,t,r);case"base64":return S(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var C=4096;function P(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;in)&&(r=n);for(var i="",o=t;or)throw new RangeError("Trying to access beyond buffer length")}function M(e,t,r,n,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function O(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function N(e,t,r,n,o){return t=+t,r>>>=0,o||O(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function L(e,t,r,n,o){return t=+t,r>>>=0,o||O(e,0,r,8),i.write(e,t,r,n,52,8),r+8}c.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||x(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||x(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||x(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||x(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||x(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||x(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||x(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||x(e,t,this.length);for(var n=this[e],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*t)),n},c.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||x(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return e>>>=0,t||x(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||x(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(e,t){e>>>=0,t||x(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||x(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||x(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return e>>>=0,t||x(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||x(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||x(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||x(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||M(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n||M(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);M(this,e,t,r,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o>0)-a&255;return t+r},c.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);M(this,e,t,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},c.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeFloatLE=function(e,t,r){return N(this,e,t,!0,r)},c.prototype.writeFloatBE=function(e,t,r){return N(this,e,t,!1,r)},c.prototype.writeDoubleLE=function(e,t,r){return L(this,e,t,!0,r)},c.prototype.writeDoubleBE=function(e,t,r){return L(this,e,t,!1,r)},c.prototype.copy=function(e,t,r,n){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function U(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(D,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function j(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function V(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function F(e){return e!=e}var q=function(){for(var e="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)t[n+i]=e[r]+e[i];return t}()},65765:(e,t,r)=>{"use strict";const{Buffer:n}=r(12836),i=r(33635),o=r(72903),s=4194304,a=n.alloc(0),c="readLength",u="readData",f={[c]:(e,t,r,n)=>{let o;t=t.append(e);try{o=n.lengthDecoder(t)}catch(e){if(t.length>n.maxLengthLength)throw Object.assign(e,{message:"message length too long",code:"ERR_MSG_LENGTH_TOO_LONG"});if(e instanceof RangeError)return{mode:c,buffer:t};throw e}if(o>n.maxDataLength)throw Object.assign(new Error("message data too long"),{code:"ERR_MSG_DATA_TOO_LONG"});return e=t.shallowSlice(n.lengthDecoder.bytes),t=new i,n.onLength&&n.onLength(o),o<=0?(n.onData&&n.onData(a),{mode:c,chunk:e,buffer:t,data:a}):{mode:u,chunk:e,buffer:t,state:{dataLength:o}}},[u]:(e,t,r,n)=>{if((t=t.append(e)).lengtho?t.shallowSlice(o):null,t=new i,n.onData&&n.onData(s),{mode:c,chunk:e,buffer:t,data:s}}};function l(e){return(e=e||{}).lengthDecoder=e.lengthDecoder||o,e.maxLengthLength=e.maxLengthLength||8,e.maxDataLength=e.maxDataLength||s,t=>async function*(){let r,n=new i,o=c;for await(let i of t)for(;i;){const t=f[o](i,n,r,e);({mode:o,chunk:i,buffer:n,state:r}=t),t.data&&(yield t.data)}if(n.length)throw Object.assign(new Error("unexpected end of input"),{code:"ERR_UNEXPECTED_EOF"})}()}l.fromReader=(e,t)=>{t=t||{};let r=1;const n={[Symbol.asyncIterator](){return this},next:async()=>{try{return await e.next(r)}catch(e){if("ERR_UNDER_READ"===e.code)return{done:!0,value:null};throw e}finally{r=1}}};return t.onLength=e=>{r=e},l(t)(n)},e.exports=l,e.exports.MAX_LENGTH_LENGTH=8,e.exports.MAX_DATA_LENGTH=s},90278:(e,t,r)=>{"use strict";const{Buffer:n}=r(12836),i=r(33635),o=r(62354);function s(e){e=e||{};const t=Math.max(e.poolSize||10240,e.minPoolSize||8),r=e.lengthEncoder||o;return e=>async function*(){let o=n.alloc(t),s=0;for await(const a of e){r(a.length,o,s);const e=o.slice(s,s+r.bytes);s+=r.bytes,o.length-s<8&&(o=n.alloc(t),s=0),yield(new i).append(e).append(a)}}()}s.single=(e,t)=>{const r=(t=t||{}).lengthEncoder||o;return new i([r(e.length),e])},e.exports=s,e.exports.MIN_POOL_SIZE=8,e.exports.DEFAULT_POOL_SIZE=10240},48963:(e,t,r)=>{"use strict";t.encode=r(90278),t.decode=r(65765),t.varintEncode=r(62354),t.varintDecode=r(72903),t.int32BEEncode=r(71205),t.int32BEDecode=r(93380)},93380:e=>{"use strict";const t=e=>{if(e.length<4)throw RangeError("Could not decode int32BE");return e.readInt32BE(0)};t.bytes=4,e.exports=t},71205:(e,t,r)=>{"use strict";const{Buffer:n}=r(12836),i=(e,t,r)=>((t=t||n.allocUnsafe(4)).writeInt32BE(e,r),t);i.bytes=4,e.exports=i},72903:(e,t,r)=>{"use strict";const{Buffer:n}=r(12836),i=r(94676),o=e=>{const t=i.decode(n.isBuffer(e)?e:(r=e,new Proxy({},{get:(e,t)=>"l"===t[0]?r[t]:r.get(parseInt(t))})));var r;return o.bytes=i.decode.bytes,t};e.exports=o},62354:(e,t,r)=>{"use strict";const n=r(94676),{Buffer:i}=r(12836),o=(e,t,r)=>{const s=n.encode(e,t,r);return o.bytes=n.encode.bytes,t||i.from(s)};e.exports=o},32121:e=>{"use strict";e.exports=async function*(e,t){for await(const r of e)yield t(r)}},74014:(e,t,r)=>{"use strict";const n=r(84975);e.exports=async function*(...e){const t=n();setTimeout((async()=>{try{await Promise.all(e.map((async e=>{for await(const r of e)t.push(r)}))),t.end()}catch(e){t.end(e)}}),0),yield*t}},63184:(e,t,r)=>{var n=r(60154);e.exports=function(){var e=n(),t=n();return[{source:e.source,sink:t.sink},{source:t.source,sink:e.sink}]}},60154:(e,t,r)=>{"use strict";const n=r(22412);e.exports=function(){let e,t;return{sink:async r=>{if(e)throw new Error("already piped");e=n(r),t&&t(e)},source:{[Symbol.asyncIterator](){return this},next:()=>e?e.next():new Promise((e=>{t=r=>{t=null,e(r.next())}}))}}}},61962:(e,t,r)=>{"use strict";const{Buffer:n}=r(48764),i=r(9668),o=r(19552),s=4194304,a=n.alloc(0),c="readLength",u="readData",f={[c]:(e,t,r,n)=>{let o;t=t.append(e);try{o=n.lengthDecoder(t)}catch(e){if(t.length>n.maxLengthLength)throw Object.assign(e,{message:"message length too long",code:"ERR_MSG_LENGTH_TOO_LONG"});if(e instanceof RangeError)return{mode:c,buffer:t,chunk:void 0,state:void 0,data:void 0};throw e}if(o>n.maxDataLength)throw Object.assign(new Error("message data too long"),{code:"ERR_MSG_DATA_TOO_LONG"});return e=t.shallowSlice(n.lengthDecoder.bytes),t=new i,n.onLength&&n.onLength(o),o<=0?(n.onData&&n.onData(a),{mode:c,chunk:e,buffer:t,data:a}):{mode:u,chunk:e,buffer:t,state:{dataLength:o},data:void 0}},[u]:(e,t,r,n)=>{if(t=t.append(e),!r)throw new Error("state is required");if(t.lengtho?t.shallowSlice(o):void 0;return t=new i,n.onData&&n.onData(s),{mode:c,chunk:a,buffer:t,state:void 0,data:s}}};function l(e){const t={lengthDecoder:(e=e||{}).lengthDecoder||o,maxLengthLength:e.maxLengthLength||8,maxDataLength:e.maxDataLength||s,onLength:e.onLength,onData:e.onData};return async function*(e){let r,n=new i,o=c;for await(const i of e){let e=i;for(;e;){const i=f[o](e,n,r,t);o=i.mode,e=i.chunk,n=i.buffer,r=i.state,i.data&&(yield i.data)}}if(n.length)throw Object.assign(new Error("unexpected end of input"),{code:"ERR_UNEXPECTED_EOF"})}}l.fromReader=(e,t)=>{let r=1;const n={[Symbol.asyncIterator](){return this},next:async()=>{try{return await e.next(r)}catch(e){if("ERR_UNDER_READ"===e.code)return{done:!0,value:null};throw e}finally{r=1}}};return l({...t||{},onLength:e=>{r=e}})(n)},e.exports=l,e.exports.MAX_LENGTH_LENGTH=8,e.exports.MAX_DATA_LENGTH=s},64095:(e,t,r)=>{"use strict";const{Buffer:n}=r(48764),i=r(9668),o=r(55735);function s(e){e=e||{};const t=Math.max(e.poolSize||10240,e.minPoolSize||8),r=e.lengthEncoder||o;return async function*(e){let o=n.alloc(t),s=0;for await(const a of e){r(a.length,o,s);const e=o.slice(s,s+r.bytes);s+=r.bytes,o.length-s<8&&(o=n.alloc(t),s=0),yield(new i).append(e).append(a)}}}s.single=(e,t)=>{const r=(t=t||{}).lengthEncoder||o;return new i([r(e.length),e.slice()])},e.exports=s,e.exports.MIN_POOL_SIZE=8,e.exports.DEFAULT_POOL_SIZE=10240},85919:(e,t,r)=>{"use strict";t.encode=r(64095),t.decode=r(61962),t.varintEncode=r(55735),t.varintDecode=r(19552),t.int32BEEncode=r(51643),t.int32BEDecode=r(93058)},93058:e=>{"use strict";const t=e=>{if(e.length<4)throw RangeError("Could not decode int32BE");return e.readInt32BE(0)};t.bytes=4,e.exports=t},51643:(e,t,r)=>{"use strict";const{Buffer:n}=r(48764),i=(e,t,r)=>((t=t||n.allocUnsafe(4)).writeInt32BE(e,r),t);i.bytes=4,e.exports=i},19552:(e,t,r)=>{"use strict";const n=r(41186),{Buffer:i}=r(48764),o=e=>{const t=n.decode(i.isBuffer(e)?e:(r=e,new Proxy({},{get:(e,t)=>"l"===t[0]?r[t]:r.get(parseInt(t))})));var r;return o.bytes=n.decode.bytes,t};e.exports=o},55735:(e,t,r)=>{"use strict";const n=r(41186),{Buffer:i}=r(48764),o=(e,t,r)=>{const s=n.encode(e,t,r);return o.bytes=n.encode.bytes,t||i.from(s)};e.exports=o},46414:e=>{e.exports=function e(t,r){var n,i=0,o=0,s=r=r||0,a=t.length;do{if(s>=a||o>49)throw e.bytes=0,new RangeError("Could not decode varint");n=t[s++],i+=o<28?(127&n)<=128);return e.bytes=s-r,i}},84347:e=>{e.exports=function e(r,n,i){if(Number.MAX_SAFE_INTEGER&&r>Number.MAX_SAFE_INTEGER)throw e.bytes=0,new RangeError("Could not encode varint");n=n||[];for(var o=i=i||0;r>=t;)n[i++]=255&r|128,r/=128;for(;-128&r;)n[i++]=255&r|128,r>>>=7;return n[i]=0|r,e.bytes=i-o+1,n};var t=Math.pow(2,31)},41186:(e,t,r)=>{e.exports={encode:r(84347),decode:r(46414),encodingLength:r(94726)}},94726:e=>{var t=Math.pow(2,7),r=Math.pow(2,14),n=Math.pow(2,21),i=Math.pow(2,28),o=Math.pow(2,35),s=Math.pow(2,42),a=Math.pow(2,49),c=Math.pow(2,56),u=Math.pow(2,63);e.exports=function(e){return e{"use strict";const n=r(48738),i=r(52261),o=r(85919);e.exports=(e,t={})=>{const r=i(e),s=o.decode.fromReader(r.reader,t);let a=!1;const c={read:async e=>{const{value:t,done:n}=await r.reader.next(e);if(n&&t.length{const{value:e,done:t}=await s.next();if(a=t,!e)throw new Error("Value is null");return e},readPB:async e=>{const t=await c.readLP();if(!t)throw new Error("Value is null");const r=n(t)?t:t.slice();return e.decode(r)},write:e=>{r.writer.push(e)},writeLP:e=>{c.write(o.encode.single(e,t))},writePB:(e,t)=>{c.writeLP(t.encode(e))},pb:e=>({read:()=>c.readPB(e),write:t=>c.writePB(t,e)}),unwrap:()=>(r.rest(),r.stream)};return c}},60618:e=>{const t=(...e)=>{let t;for(;e.length;)t=e.shift()(t);return t},r=e=>e&&("function"==typeof e[Symbol.asyncIterator]||"function"==typeof e[Symbol.iterator]||"function"==typeof e.next),n=e=>e&&"function"==typeof e.sink&&r(e.source),i=e=>t=>(e.sink(t),e.source),o=(...e)=>{if(n(e[0])){const t=e[0];e[0]=()=>t.source}else if(r(e[0])){const t=e[0];e[0]=()=>t}if(e.length>1&&n(e[e.length-1])&&(e[e.length-1]=e[e.length-1].sink),e.length>2)for(let t=1;t{const n=r(91607);e.exports=e=>{let t;"function"==typeof(e=e||{})?(t=e,e={}):t=e.onEnd;let r,i,o,s=new n;const a=e=>i?i(e):(s.push(e),r),c=e=>o?r:a({done:!1,value:e}),u=e=>o?r:(o=!0,e?(e=>(s=new n,i?i({error:e}):(s.push({error:e}),r)))(e):a({done:!0}));if(r={[Symbol.asyncIterator](){return this},next:()=>{if(!s.isEmpty()){if(e.writev){let e;const t=[];for(;!s.isEmpty();){if(e=s.shift(),e.error)throw e.error;t.push(e.value)}return{done:e.done,value:t}}const t=s.shift();if(t.error)throw t.error;return t}return o?{done:!0}:new Promise(((t,n)=>{i=o=>(i=null,o.error?n(o.error):e.writev&&!o.done?t({done:o.done,value:[o.value]}):t(o),r)}))},return:()=>(s=new n,u(),{done:!0}),throw:e=>(u(e),{done:!0}),push:c,end:u},!t)return r;const f=r;return r={[Symbol.asyncIterator](){return this},next:()=>f.next(),throw:e=>(f.throw(e),t&&(t(e),t=null),{done:!0}),return:()=>(f.return(),t&&(t(),t=null),{done:!0}),push:c,end:e=>(f.end(e),t&&(t(e),t=null),r)},r}},53469:(e,t,r)=>{const n=r(9668);e.exports=e=>{const t=async function*(){let t=yield,r=new n;for await(const i of e)if(t)for(r.append(i);r.length>=t;){const e=r.shallowSlice(0,t);if(r.consume(t),t=yield e,!t){r.length&&(t=yield r,r=new n);break}}else t=yield r.append(i),r=new n;if(t)throw Object.assign(new Error(`stream ended before ${t} bytes became available`),{code:"ERR_UNDER_READ",buffer:r})}();return t.next(),t}},37939:e=>{"use strict";e.exports=async function*(e,t){let r=0;if(!(t<1))for await(const n of e)if(yield n,r++,r===t)return}},6476:(e,t,r)=>{"use strict";var n=r(78422),i=r(45413),o=r(16044);e.exports=function(e,t={}){const r="undefined"==typeof window?{}:window.location,s=o(e,r),a=new n(s,t.websocket),c=i(a,t);return c.remoteAddress=s,c.close=()=>new Promise(((e,t)=>{a.addEventListener("close",e),a.close()})),c.destroy=()=>{a.terminate?a.terminate():a.close()},c.socket=a,c},e.exports.connect=e.exports},45413:(e,t,r)=>{const n=r(41049),i=r(91252);e.exports=(e,t)=>{(t=t||{}).binaryType?e.binaryType=t.binaryType:t.binary&&(e.binaryType="arraybuffer");const r={sink:i(e,t),source:n(e,t),connected:()=>r.source.connected()};return r}},1434:e=>{e.exports=async e=>{if(e.readyState>=2)throw new Error("socket closed");if(1!==e.readyState)return new Promise(((t,r)=>{const n=e&&(e.removeEventListener||e.removeListener);function i(){"function"==typeof n&&(n.call(e,"open",o),n.call(e,"error",s))}function o(){i(),t()}function s(e){i(),r(e)}e.addEventListener("open",o),e.addEventListener("error",s)}))}},91252:(e,t,r)=>{const n=r(1434);e.exports=(e,t)=>((t=t||{}).closeOnEnd=!1!==t.closeOnEnd,async r=>{for await(const t of r){try{await n(e)}catch(e){if("socket closed"===e.message)break;throw e}e.send(t)}if(t.closeOnEnd&&e.readyState<=1)return new Promise(((t,r)=>{e.addEventListener("close",(e=>{if(e.wasClean||1006===e.code)t();else{const t=Object.assign(new Error("ws error"),{event:e});r(t)}})),setTimeout((()=>e.close()))}))})},41049:(e,t,r)=>{const{Buffer:n}=r(48764),{EventIterator:i}=r(90507);e.exports=e=>{const t=e.removeEventListener||e.removeListener,r=async function*(){const r=new i((({push:r,stop:n,fail:i})=>(e.addEventListener("message",r),e.addEventListener("error",i),e.addEventListener("close",n),()=>{t.call(e,"message",r),t.call(e,"error",i),t.call(e,"close",n)})),{highWaterMark:1/0});for await(const{data:e}of r)yield(o=e,o instanceof ArrayBuffer||null!=o&&null!=o.constructor&&"ArrayBuffer"===o.constructor.name&&"number"==typeof o.byteLength?n.from(e):e);var o}();let o,s=1===e.readyState;return e.addEventListener("open",(()=>{s=!0,o=null})),e.addEventListener("close",(()=>{s=!1,o=null})),e.addEventListener("error",(e=>{s||(o=e)})),r.connected=()=>new Promise(((r,n)=>{if(s)return r();if(o)return n(o);const i=r=>{t.call(e,"open",a),t.call(e,"error",c),r()},a=()=>i(r),c=e=>i((()=>n(e)));e.addEventListener("open",a),e.addEventListener("error",c)})),r}},78422:(e,t,r)=>{e.exports="undefined"==typeof WebSocket?r(89408):WebSocket},16044:(e,t,r)=>{const{relative:n}=r(17745),i={http:"ws",https:"wss"};e.exports=(e,t)=>n(e,t,i,"ws")},36077:function(e,t){(function(){var t;function r(e,t,r){null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function n(){return new r(null)}var i="undefined"!=typeof navigator;i&&"Microsoft Internet Explorer"==navigator.appName?(r.prototype.am=function(e,t,r,n,i,o){for(var s=32767&t,a=t>>15;--o>=0;){var c=32767&this[e],u=this[e++]>>15,f=a*c+u*s;i=((c=s*c+((32767&f)<<15)+r[n]+(1073741823&i))>>>30)+(f>>>15)+a*u+(i>>>30),r[n++]=1073741823&c}return i},t=30):i&&"Netscape"!=navigator.appName?(r.prototype.am=function(e,t,r,n,i,o){for(;--o>=0;){var s=t*this[e++]+r[n]+i;i=Math.floor(s/67108864),r[n++]=67108863&s}return i},t=26):(r.prototype.am=function(e,t,r,n,i,o){for(var s=16383&t,a=t>>14;--o>=0;){var c=16383&this[e],u=this[e++]>>14,f=a*c+u*s;i=((c=s*c+((16383&f)<<14)+r[n]+i)>>28)+(f>>14)+a*u,r[n++]=268435455&c}return i},t=28),r.prototype.DB=t,r.prototype.DM=(1<>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function h(e){this.m=e}function d(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function v(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function w(){}function E(e){return e}function _(e){this.r2=n(),this.q3=n(),r.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}h.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},h.prototype.revert=function(e){return e},h.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},h.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},h.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},d.prototype.convert=function(e){var t=n();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(r.ZERO)>0&&this.m.subTo(t,t),t},d.prototype.revert=function(e){var t=n();return e.copyTo(t),this.reduce(t),t},d.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t>15)*this.mpl&this.um)<<15)&e.DM;for(e[r=t+this.m.t]+=this.m.am(0,n,e,t,0,this.m.t);e[r]>=e.DV;)e[r]-=e.DV,e[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},d.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},d.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},r.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s},r.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0},r.prototype.fromString=function(e,t){var n;if(16==t)n=4;else if(8==t)n=3;else if(256==t)n=8;else if(2==t)n=1;else if(32==t)n=5;else{if(4!=t)return void this.fromRadix(e,t);n=2}this.t=0,this.s=0;for(var i=e.length,o=!1,s=0;--i>=0;){var a=8==n?255&e[i]:u(e,i);a<0?"-"==e.charAt(i)&&(o=!0):(o=!1,0==s?this[this.t++]=a:s+n>this.DB?(this[this.t-1]|=(a&(1<>this.DB-s):this[this.t-1]|=a<=this.DB&&(s-=this.DB))}8==n&&0!=(128&e[0])&&(this.s=-1,s>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==e;)--this.t},r.prototype.dlShiftTo=function(e,t){var r;for(r=this.t-1;r>=0;--r)t[r+e]=this[r];for(r=e-1;r>=0;--r)t[r]=0;t.t=this.t+e,t.s=this.s},r.prototype.drShiftTo=function(e,t){for(var r=e;r=0;--r)t[r+s+1]=this[r]>>i|a,a=(this[r]&o)<=0;--r)t[r]=0;t[s]=a,t.t=this.t+s+1,t.s=this.s,t.clamp()},r.prototype.rShiftTo=function(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var n=e%this.DB,i=this.DB-n,o=(1<>n;for(var s=r+1;s>n;n>0&&(t[this.t-r-1]|=(this.s&o)<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t[r++]=this.DV+n:n>0&&(t[r++]=n),t.t=r,t.clamp()},r.prototype.multiplyTo=function(e,t){var n=this.abs(),i=e.abs(),o=n.t;for(t.t=o+i.t;--o>=0;)t[o]=0;for(o=0;o=0;)e[r]=0;for(r=0;r=t.DV&&(e[r+t.t]-=t.DV,e[r+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(r,t[r],e,2*r,0,1)),e.s=0,e.clamp()},r.prototype.divRemTo=function(e,t,i){var o=e.abs();if(!(o.t<=0)){var s=this.abs();if(s.t0?(o.lShiftTo(f,a),s.lShiftTo(f,i)):(o.copyTo(a),s.copyTo(i));var h=a.t,d=a[h-1];if(0!=d){var p=d*(1<1?a[h-2]>>this.F2:0),y=this.FV/p,g=(1<=0&&(i[i.t++]=1,i.subTo(w,i)),r.ONE.dlShiftTo(h,w),w.subTo(a,a);a.t=0;){var E=i[--m]==d?this.DM:Math.floor(i[m]*y+(i[m-1]+b)*g);if((i[m]+=a.am(0,E,i,v,0,h))0&&i.rShiftTo(f,i),c<0&&r.ZERO.subTo(i,i)}}},r.prototype.invDigit=function(){if(this.t<1)return 0;var e=this[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},r.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},r.prototype.exp=function(e,t){if(e>4294967295||e<1)return r.ONE;var i=n(),o=n(),s=t.convert(this),a=l(e)-1;for(s.copyTo(i);--a>=0;)if(t.sqrTo(i,o),(e&1<0)t.mulTo(o,s,i);else{var c=i;i=o,o=c}return t.revert(i)},r.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<0)for(a>a)>0&&(i=!0,o=c(r));s>=0;)a>(a+=this.DB-t)):(r=this[s]>>(a-=t)&n,a<=0&&(a+=this.DB,--s)),r>0&&(i=!0),i&&(o+=c(r));return i?o:"0"},r.prototype.negate=function(){var e=n();return r.ZERO.subTo(this,e),e},r.prototype.abs=function(){return this.s<0?this.negate():this},r.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this[r]-e[r]))return t;return 0},r.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+l(this[this.t-1]^this.s&this.DM)},r.prototype.mod=function(e){var t=n();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(r.ZERO)>0&&e.subTo(t,t),t},r.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new h(t):new d(t),this.exp(e,r)},r.ZERO=f(0),r.ONE=f(1),w.prototype.convert=E,w.prototype.revert=E,w.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},w.prototype.sqrTo=function(e,t){e.squareTo(t)},_.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=n();return e.copyTo(t),this.reduce(t),t},_.prototype.revert=function(e){return e},_.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},_.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},_.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var S,A,T,I=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],C=(1<<26)/I[I.length-1];function P(){var e;e=(new Date).getTime(),A[T++]^=255&e,A[T++]^=e>>8&255,A[T++]^=e>>16&255,A[T++]^=e>>24&255,T>=N&&(T-=N)}if(r.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},r.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),i=f(r),o=n(),s=n(),a="";for(this.divRemTo(i,o,s);o.signum()>0;)a=(r+s.intValue()).toString(e).substr(1)+a,o.divRemTo(i,o,s);return s.intValue().toString(e)+a},r.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var n=this.chunkSize(t),i=Math.pow(t,n),o=!1,s=0,a=0,c=0;c=n&&(this.dMultiply(i),this.dAddOffset(a,0),s=0,a=0))}s>0&&(this.dMultiply(Math.pow(t,s)),this.dAddOffset(a,0)),o&&r.ZERO.subTo(this,this)},r.prototype.fromNumber=function(e,t,n){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,n),this.testBit(e-1)||this.bitwiseTo(r.ONE.shiftLeft(e-1),y,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(r.ONE.shiftLeft(e-1),this);else{var i=new Array,o=7&e;i.length=1+(e>>3),t.nextBytes(i),o>0?i[0]&=(1<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t[r++]=n:n<-1&&(t[r++]=this.DV+n),t.t=r,t.clamp()},r.prototype.dMultiply=function(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},r.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}},r.prototype.multiplyLowerTo=function(e,t,r){var n,i=Math.min(this.t+e.t,t);for(r.s=0,r.t=i;i>0;)r[--i]=0;for(n=r.t-this.t;i=0;)r[n]=0;for(n=Math.max(t-this.t,0);n0)if(0==t)r=this[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this[n])%e;return r},r.prototype.millerRabin=function(e){var t=this.subtract(r.ONE),i=t.getLowestSetBit();if(i<=0)return!1;var o=t.shiftRight(i);(e=e+1>>1)>I.length&&(e=I.length);for(var s=n(),a=0;a>24},r.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},r.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},r.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var r,n=this.DB-e*this.DB%8,i=0;if(e-- >0)for(n>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<=0;)n<8?(r=(this[e]&(1<>(n+=this.DB-8)):(r=this[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(t[i++]=r);return t},r.prototype.equals=function(e){return 0==this.compareTo(e)},r.prototype.min=function(e){return this.compareTo(e)<0?this:e},r.prototype.max=function(e){return this.compareTo(e)>0?this:e},r.prototype.and=function(e){var t=n();return this.bitwiseTo(e,p,t),t},r.prototype.or=function(e){var t=n();return this.bitwiseTo(e,y,t),t},r.prototype.xor=function(e){var t=n();return this.bitwiseTo(e,g,t),t},r.prototype.andNot=function(e){var t=n();return this.bitwiseTo(e,b,t),t},r.prototype.not=function(){for(var e=n(),t=0;t=this.t?0!=this.s:0!=(this[t]&1<1){var y=n();for(i.sqrTo(a[1],y);c<=p;)a[c]=n(),i.mulTo(y,a[c-2],a[c]),c+=2}var g,b,m=e.t-1,v=!0,w=n();for(o=l(e[m])-1;m>=0;){for(o>=u?g=e[m]>>o-u&p:(g=(e[m]&(1<0&&(g|=e[m-1]>>this.DB+o-u)),c=r;0==(1&g);)g>>=1,--c;if((o-=c)<0&&(o+=this.DB,--m),v)a[g].copyTo(s),v=!1;else{for(;c>1;)i.sqrTo(s,w),i.sqrTo(w,s),c-=2;c>0?i.sqrTo(s,w):(b=s,s=w,w=b),i.mulTo(w,a[g],s)}for(;m>=0&&0==(e[m]&1<=0?(n.subTo(i,n),t&&o.subTo(a,o),s.subTo(c,s)):(i.subTo(n,i),t&&a.subTo(o,a),c.subTo(s,c))}return 0!=i.compareTo(r.ONE)?r.ZERO:c.compareTo(e)>=0?c.subtract(e):c.signum()<0?(c.addTo(e,c),c.signum()<0?c.add(e):c):c},r.prototype.pow=function(e){return this.exp(e,new w)},r.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var i=t.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return t;for(i0&&(t.rShiftTo(o,t),r.rShiftTo(o,r));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r},r.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r[0]<=I[I.length-1]){for(t=0;t>>8,A[T++]=255&R;T=0,P()}function x(){if(null==S){for(P(),(S=new O).init(A),T=0;T{"use strict";const n=r(32114),i={16:"aes-128-ctr",32:"aes-256-ctr"};e.exports=function(e){const t=i[e.length];if(!t){const t=Object.entries(i).map((([e,t])=>`${e} (${t})`)).join(" / ");throw n(new Error(`Invalid key length ${e.length} bytes. Must be ${t}`),"ERR_INVALID_KEY_LENGTH")}return t}},98380:(e,t,r)=>{"use strict";r(8925);const n=r(3832),{toString:i}=r(92263),{fromString:o}=r(52217);e.exports={createCipheriv:(e,t,r)=>{const s=n.cipher.createCipher("AES-CTR",i(t,"ascii"));return s.start({iv:i(r,"ascii")}),{update:e=>(s.update(n.util.createBuffer(i(e,"ascii"))),o(s.output.getBytes(),"ascii"))}},createDecipheriv:(e,t,r)=>{const s=n.cipher.createDecipher("AES-CTR",i(t,"ascii"));return s.start({iv:i(r,"ascii")}),{update:e=>(s.update(n.util.createBuffer(i(e,"ascii"))),o(s.output.getBytes(),"ascii"))}}}},88411:(e,t,r)=>{"use strict";const n=r(98380),i=r(73226);t.create=async function(e,t){const r=i(e),o=n.createCipheriv(r,e,t),s=n.createDecipheriv(r,e,t);return{encrypt:async e=>o.update(e),decrypt:async e=>s.update(e)}}},27552:(e,t,r)=>{"use strict";const{concat:n}=r(20605),{fromString:i}=r(52217),o=r(63649);e.exports={create:function({algorithm:e="AES-GCM",nonceLength:t=12,keyLength:r=16,digest:s="SHA-256",saltLength:a=16,iterations:c=32767}={}){const u=o.get();return r*=8,{encrypt:async function(o,f){const l=u.getRandomValues(new Uint8Array(a)),h=u.getRandomValues(new Uint8Array(t)),d={name:e,iv:h},p={name:"PBKDF2",salt:l,iterations:c,hash:{name:s}},y=await u.subtle.importKey("raw",i(f),{name:"PBKDF2"},!1,["deriveKey","deriveBits"]),g=await u.subtle.deriveKey(p,y,{name:e,length:r},!0,["encrypt"]),b=await u.subtle.encrypt(d,g,o);return n([l,d.iv,new Uint8Array(b)])},decrypt:async function(n,o){const f=n.slice(0,a),l=n.slice(a,a+t),h=n.slice(a+t),d={name:e,iv:l},p={name:"PBKDF2",salt:f,iterations:c,hash:{name:s}},y=await u.subtle.importKey("raw",i(o),{name:"PBKDF2"},!1,["deriveKey","deriveBits"]),g=await u.subtle.deriveKey(p,y,{name:e,length:r},!0,["decrypt"]),b=await u.subtle.decrypt(d,g,h);return new Uint8Array(b)}}}}},31088:(e,t,r)=>{"use strict";const n=r(63649),i=r(38872),o={SHA1:"SHA-1",SHA256:"SHA-256",SHA512:"SHA-512"};t.create=async function(e,t){const r=o[e],s=await n.get().subtle.importKey("raw",t,{name:"HMAC",hash:{name:r}},!1,["sign"]);return{digest:async e=>(async(e,t)=>{const r=await n.get().subtle.sign({name:"HMAC"},e,t);return new Uint8Array(r,r.byteOffset,r.byteLength)})(s,e),length:i[e]}}},38872:e=>{"use strict";e.exports={SHA1:20,SHA256:32,SHA512:64}},82204:(e,t,r)=>{"use strict";const n=r(31088),i=r(88411),o=r(14437);t.aes=i,t.hmac=n,t.keys=o,t.randomBytes=r(87503),t.pbkdf2=r(93221)},78590:(e,t,r)=>{"use strict";const n=r(32114),i=r(63649),{base64urlToBuffer:o}=r(56441),s=r(45753),{toString:a}=r(92263),{concat:c}=r(20605),{equals:u}=r(19588),f={"P-256":256,"P-384":384,"P-521":521};t.generateEphmeralKeyPair=async function(e){s(Object.keys(f),e);const t=await i.get().subtle.generateKey({name:"ECDH",namedCurve:e},!0,["deriveBits"]);return{key:h(await i.get().subtle.exportKey("jwk",t.publicKey)),genSharedKey:async(r,n)=>{let o;o=n?await i.get().subtle.importKey("jwk",p(e,n),{name:"ECDH",namedCurve:e},!1,["deriveBits"]):t.privateKey;const s=[await i.get().subtle.importKey("jwk",d(e,r),{name:"ECDH",namedCurve:e},!1,[]),o],a=await i.get().subtle.deriveBits({name:"ECDH",namedCurve:e,public:s[0]},s[1],f[e]);return new Uint8Array(a,a.byteOffset,a.byteLength)}}};const l={"P-256":32,"P-384":48,"P-521":66};function h(e){const t=l[e.crv];return c([Uint8Array.from([4]),o(e.x,t),o(e.y,t)],1+2*t)}function d(e,t){const r=l[e];if(u(!t.slice(0,1),Uint8Array.from([4])))throw n(new Error("Cannot unmarshal public key - invalid key format"),"ERR_INVALID_KEY_FORMAT");return{kty:"EC",crv:e,x:a(t.slice(1,r+1),"base64url"),y:a(t.slice(1+r),"base64url"),ext:!0}}const p=(e,t)=>({...d(e,t.public),d:a(t.private,"base64url")})},96535:(e,t,r)=>{"use strict";const n=r(32114),{equals:i}=r(19588),{sha256:o}=r(56155),{base58btc:s}=r(99086),{identity:a}=r(78103),c=r(71127),u=r(17241),f=r(69716);class l{constructor(e){this._key=d(e,c.publicKeyLength)}async verify(e,t){return c.hashAndVerify(this._key,t,e)}marshal(){return this._key}get bytes(){return u.PublicKey.encode({Type:u.KeyType.Ed25519,Data:this.marshal()}).finish()}equals(e){return i(this.bytes,e.bytes)}async hash(){const{bytes:e}=await o.digest(this.bytes);return e}}class h{constructor(e,t){this._key=d(e,c.privateKeyLength),this._publicKey=d(t,c.publicKeyLength)}async sign(e){return c.hashAndSign(this._key,e)}get public(){return new l(this._publicKey)}marshal(){return this._key}get bytes(){return u.PrivateKey.encode({Type:u.KeyType.Ed25519,Data:this.marshal()}).finish()}equals(e){return i(this.bytes,e.bytes)}async hash(){const{bytes:e}=await o.digest(this.bytes);return e}async id(){const e=await a.digest(this.public.bytes);return s.encode(e.bytes).substring(1)}async export(e,t="libp2p-key"){if("libp2p-key"===t)return f.export(this.bytes,e);throw n(new Error(`export format '${t}' is not supported`),"ERR_INVALID_EXPORT_FORMAT")}}function d(e,t){if((e=Uint8Array.from(e||[])).length!==t)throw n(new Error(`Key must be a Uint8Array of length ${t}, got ${e.length}`),"ERR_INVALID_KEY_TYPE");return e}e.exports={Ed25519PublicKey:l,Ed25519PrivateKey:h,unmarshalEd25519PrivateKey:function(e){if(e.length>c.privateKeyLength){const t=(e=d(e,c.privateKeyLength+c.publicKeyLength)).slice(0,c.privateKeyLength),r=e.slice(c.privateKeyLength,e.length);return new h(t,r)}const t=(e=d(e,c.privateKeyLength)).slice(0,c.privateKeyLength),r=e.slice(c.publicKeyLength);return new h(t,r)},unmarshalEd25519PublicKey:function(e){return e=d(e,c.publicKeyLength),new l(e)},generateKeyPair:async function(){const{privateKey:e,publicKey:t}=await c.generateKey();return new h(e,t)},generateKeyPairFromSeed:async function(e){const{privateKey:t,publicKey:r}=await c.generateKeyFromSeed(e);return new h(t,r)}}},71127:(e,t,r)=>{"use strict";const n=r(53710);function i(e,r){const n=new Uint8Array(t.privateKeyLength);for(let t=0;t<32;t++)n[t]=e[t],n[32+t]=r[t];return n}t.publicKeyLength=32,t.privateKeyLength=64,t.generateKey=async function(){const e=n.utils.randomPrivateKey(),t=await n.getPublicKey(e);return{privateKey:i(e,t),publicKey:t}},t.generateKeyFromSeed=async function(e){if(32!==e.length)throw new TypeError('"seed" must be 32 bytes in length.');if(!(e instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, or Uint8Array.');const t=e,r=await n.getPublicKey(t);return{privateKey:i(t,r),publicKey:r}},t.hashAndSign=function(e,t){const r=e.slice(0,32);return n.sign(t,r)},t.hashAndVerify=function(e,t,r){return n.verify(t,r,e)}},55563:(e,t,r)=>{"use strict";const n=r(78590);e.exports=async e=>n.generateEphmeralKeyPair(e)},69716:(e,t,r)=>{"use strict";const{base64:n}=r(9885),i=r(27552);e.exports={export:async function(e,t){const r=i.create(),o=await r.encrypt(e,t);return n.encode(o)}}},24709:(e,t,r)=>{"use strict";const{base64:n}=r(9885),i=r(27552);e.exports={import:async function(e,t){const r=n.decode(e),o=i.create();return await o.decrypt(r,t)}}},14437:(e,t,r)=>{"use strict";const n=r(17241);r(3068),r(97450);const i=r(3832),o=r(32114),{fromString:s}=r(52217),a=r(24709),c={rsa:r(19950),ed25519:r(96535),secp256k1:r(49434)(n,r(87503))},u="secp256k1 support requires libp2p-crypto-secp256k1 package",f="ERR_MISSING_PACKAGE";function l(e){const t=c[e.toLowerCase()];if(!t){const t=Object.keys(c).join(" / ");throw o(new Error(`invalid or unsupported key type ${e}. Must be ${t}`),"ERR_UNSUPPORTED_KEY_TYPE")}return t}const h=async e=>{const t=n.PrivateKey.decode(e),r=t.Data;switch(t.Type){case n.KeyType.RSA:return c.rsa.unmarshalRsaPrivateKey(r);case n.KeyType.Ed25519:return c.ed25519.unmarshalEd25519PrivateKey(r);case n.KeyType.Secp256k1:if(c.secp256k1)return c.secp256k1.unmarshalSecp256k1PrivateKey(r);throw o(new Error(u),f);default:l(t.Type)}};e.exports={supportedKeys:c,keysPBM:n,keyStretcher:r(73494),generateEphemeralKeyPair:r(55563),generateKeyPair:async(e,t)=>l(e).generateKeyPair(t),generateKeyPairFromSeed:async(e,t,r)=>{const n=l(e);if("ed25519"!==e.toLowerCase())throw o(new Error("Seed key derivation is unimplemented for RSA or secp256k1"),"ERR_UNSUPPORTED_KEY_DERIVATION_TYPE");return n.generateKeyPairFromSeed(t,r)},unmarshalPublicKey:e=>{const t=n.PublicKey.decode(e),r=t.Data;switch(t.Type){case n.KeyType.RSA:return c.rsa.unmarshalRsaPublicKey(r);case n.KeyType.Ed25519:return c.ed25519.unmarshalEd25519PublicKey(r);case n.KeyType.Secp256k1:if(c.secp256k1)return c.secp256k1.unmarshalSecp256k1PublicKey(r);throw o(new Error(u),f);default:l(t.Type)}},marshalPublicKey:(e,t)=>(l(t=(t||"rsa").toLowerCase()),e.bytes),unmarshalPrivateKey:h,marshalPrivateKey:(e,t)=>(l(t=(t||"rsa").toLowerCase()),e.bytes),import:async(e,t)=>{try{const r=await a.import(e,t);return h(r)}catch(e){}const r=i.pki.decryptRsaPrivateKey(e,t);if(null===r)throw o(new Error("Cannot read the key, most likely the password is wrong or not a RSA key"),"ERR_CANNOT_DECRYPT_PEM");let n=i.asn1.toDer(i.pki.privateKeyToAsn1(r));return n=s(n.getBytes(),"ascii"),c.rsa.unmarshalRsaPrivateKey(n)}}},925:(e,t,r)=>{"use strict";r(28095);const n=r(3832),{base64urlToBigInteger:i}=r(56441);function o(e,t){return t.map((t=>i(e[t])))}e.exports={jwk2pub:function(e){return n.pki.setRsaPublicKey(...o(e,["n","e"]))},jwk2priv:function(e){return n.pki.setRsaPrivateKey(...o(e,["n","e","d","p","q","dp","dq","qi"]))}}},73494:(e,t,r)=>{"use strict";const n=r(32114),{concat:i}=r(20605),{fromString:o}=r(52217),s=r(31088),a={"AES-128":{ivSize:16,keySize:16},"AES-256":{ivSize:16,keySize:32},Blowfish:{ivSize:8,cipherKeySize:32}};e.exports=async(e,t,r)=>{const c=a[e];if(!c){const t=Object.keys(a).join(" / ");throw n(new Error(`unknown cipher type '${e}'. Must be ${t}`),"ERR_INVALID_CIPHER_TYPE")}if(!t)throw n(new Error("missing hash type"),"ERR_MISSING_HASH_TYPE");const u=c.keySize,f=c.ivSize,l=o("key expansion"),h=2*(f+u+20),d=await s.create(t,r);let p=await d.digest(l);const y=[];let g=0;for(;gh&&(t=h-g),y.push(e),g+=t,p=await d.digest(p)}const b=h/2,m=i(y),v=m.slice(0,b),w=m.slice(b,h),E=e=>({iv:e.slice(0,f),cipherKey:e.slice(f,f+u),macKey:e.slice(f+u)});return{k1:E(v),k2:E(w)}}},17241:(e,t,r)=>{"use strict";var n,i,o=r(62100),s=o.Reader,a=o.Writer,c=o.util,u=o.roots["libp2p-crypto-keys"]||(o.roots["libp2p-crypto-keys"]={});u.KeyType=(n={},(i=Object.create(n))[n[0]="RSA"]=0,i[n[1]="Ed25519"]=1,i[n[2]="Secp256k1"]=2,i),u.PublicKey=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.Type=e.int32();break;case 2:n.Data=e.bytes();break;default:e.skipType(7&i)}}if(!n.hasOwnProperty("Type"))throw c.ProtocolError("missing required 'Type'",{instance:n});if(!n.hasOwnProperty("Data"))throw c.ProtocolError("missing required 'Data'",{instance:n});return n},e.fromObject=function(e){if(e instanceof u.PublicKey)return e;var t=new u.PublicKey;switch(e.Type){case"RSA":case 0:t.Type=0;break;case"Ed25519":case 1:t.Type=1;break;case"Secp256k1":case 2:t.Type=2}return null!=e.Data&&("string"==typeof e.Data?c.base64.decode(e.Data,t.Data=c.newBuffer(c.base64.length(e.Data)),0):e.Data.length&&(t.Data=e.Data)),t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(r.Type=t.enums===String?"RSA":0,t.bytes===String?r.Data="":(r.Data=[],t.bytes!==Array&&(r.Data=c.newBuffer(r.Data)))),null!=e.Type&&e.hasOwnProperty("Type")&&(r.Type=t.enums===String?u.KeyType[e.Type]:e.Type),null!=e.Data&&e.hasOwnProperty("Data")&&(r.Data=t.bytes===String?c.base64.encode(e.Data,0,e.Data.length):t.bytes===Array?Array.prototype.slice.call(e.Data):e.Data),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),u.PrivateKey=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.Type=e.int32();break;case 2:n.Data=e.bytes();break;default:e.skipType(7&i)}}if(!n.hasOwnProperty("Type"))throw c.ProtocolError("missing required 'Type'",{instance:n});if(!n.hasOwnProperty("Data"))throw c.ProtocolError("missing required 'Data'",{instance:n});return n},e.fromObject=function(e){if(e instanceof u.PrivateKey)return e;var t=new u.PrivateKey;switch(e.Type){case"RSA":case 0:t.Type=0;break;case"Ed25519":case 1:t.Type=1;break;case"Secp256k1":case 2:t.Type=2}return null!=e.Data&&("string"==typeof e.Data?c.base64.decode(e.Data,t.Data=c.newBuffer(c.base64.length(e.Data)),0):e.Data.length&&(t.Data=e.Data)),t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(r.Type=t.enums===String?"RSA":0,t.bytes===String?r.Data="":(r.Data=[],t.bytes!==Array&&(r.Data=c.newBuffer(r.Data)))),null!=e.Type&&e.hasOwnProperty("Type")&&(r.Type=t.enums===String?u.KeyType[e.Type]:e.Type),null!=e.Data&&e.hasOwnProperty("Data")&&(r.Data=t.bytes===String?c.base64.encode(e.Data,0,e.Data.length):t.bytes===Array?Array.prototype.slice.call(e.Data):e.Data),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),e.exports=u},96741:(e,t,r)=>{"use strict";const n=r(63649),i=r(87503),{toString:o}=r(92263),{fromString:s}=r(52217);function a(e){return Promise.all([n.get().subtle.exportKey("jwk",e.privateKey),n.get().subtle.exportKey("jwk",e.publicKey)])}t.utils=r(94604),t.generateKey=async function(e){const t=await n.get().subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]),r=await a(t);return{privateKey:r[0],publicKey:r[1]}},t.unmarshalPrivateKey=async function(e){const t=[await n.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]),await(r=e,n.get().subtle.importKey("jwk",{kty:r.kty,n:r.n,e:r.e},{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"]))];var r;const i=await a({privateKey:t[0],publicKey:t[1]});return{privateKey:i[0],publicKey:i[1]}},t.getRandomValues=i,t.hashAndSign=async function(e,t){const r=await n.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]),i=await n.get().subtle.sign({name:"RSASSA-PKCS1-v1_5"},r,Uint8Array.from(t));return new Uint8Array(i,i.byteOffset,i.byteLength)},t.hashAndVerify=async function(e,t,r){const i=await n.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]);return n.get().subtle.verify({name:"RSASSA-PKCS1-v1_5"},i,t,r)};const{jwk2pub:c,jwk2priv:u}=r(925);function f(e,t,r,n){const i=t?c(e):u(e),a=n(o(Uint8Array.from(r),"ascii"),i);return s(a,"ascii")}t.encrypt=function(e,t){return f(e,!0,t,((e,t)=>t.encrypt(e)))},t.decrypt=function(e,t){return f(e,!1,t,((e,t)=>t.decrypt(e)))}},19950:(e,t,r)=>{"use strict";const{sha256:n}=r(56155),i=r(32114),{equals:o}=r(19588),{toString:s}=r(92263);r(63219);const a=r(3832),c=r(96741),u=r(17241),f=r(69716);class l{constructor(e){this._key=e}async verify(e,t){return c.hashAndVerify(this._key,t,e)}marshal(){return c.utils.jwkToPkix(this._key)}get bytes(){return u.PublicKey.encode({Type:u.KeyType.RSA,Data:this.marshal()}).finish()}encrypt(e){return c.encrypt(this._key,e)}equals(e){return o(this.bytes,e.bytes)}async hash(){const{bytes:e}=await n.digest(this.bytes);return e}}class h{constructor(e,t){this._key=e,this._publicKey=t}genSecret(){return c.getRandomValues(16)}async sign(e){return c.hashAndSign(this._key,e)}get public(){if(!this._publicKey)throw i(new Error("public key not provided"),"ERR_PUBKEY_NOT_PROVIDED");return new l(this._publicKey)}decrypt(e){return c.decrypt(this._key,e)}marshal(){return c.utils.jwkToPkcs1(this._key)}get bytes(){return u.PrivateKey.encode({Type:u.KeyType.RSA,Data:this.marshal()}).finish()}equals(e){return o(this.bytes,e.bytes)}async hash(){const{bytes:e}=await n.digest(this.bytes);return e}async id(){const e=await this.public.hash();return s(e,"base58btc")}async export(e,t="pkcs-8"){if("pkcs-8"===t){const t=new a.util.ByteBuffer(this.marshal()),r=a.asn1.fromDer(t),n=a.pki.privateKeyFromAsn1(r),i={algorithm:"aes256",count:1e4,saltSize:16,prfAlgorithm:"sha512"};return a.pki.encryptRsaPrivateKey(n,e,i)}if("libp2p-key"===t)return f.export(this.bytes,e);throw i(new Error(`export format '${t}' is not supported`),"ERR_INVALID_EXPORT_FORMAT")}}e.exports={RsaPublicKey:l,RsaPrivateKey:h,unmarshalRsaPublicKey:function(e){const t=c.utils.pkixToJwk(e);return new l(t)},unmarshalRsaPrivateKey:async function(e){const t=c.utils.pkcs1ToJwk(e),r=await c.unmarshalPrivateKey(t);return new h(r.privateKey,r.publicKey)},generateKeyPair:async function(e){const t=await c.generateKey(e);return new h(t.privateKey,t.publicKey)},fromJwk:async function(e){const t=await c.unmarshalPrivateKey(e);return new h(t.privateKey,t.publicKey)}}},94604:(e,t,r)=>{"use strict";r(3068),r(28095);const n=r(3832),{bigIntegerToUintBase64url:i,base64urlToBigInteger:o}=r(56441),{fromString:s}=r(52217),{toString:a}=r(92263);t.pkcs1ToJwk=function(e){const t=n.asn1.fromDer(a(e,"ascii")),r=n.pki.privateKeyFromAsn1(t);return{kty:"RSA",n:i(r.n),e:i(r.e),d:i(r.d),p:i(r.p),q:i(r.q),dp:i(r.dP),dq:i(r.dQ),qi:i(r.qInv),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkcs1=function(e){const t=n.pki.privateKeyToAsn1({n:o(e.n),e:o(e.e),d:o(e.d),p:o(e.p),q:o(e.q),dP:o(e.dp),dQ:o(e.dq),qInv:o(e.qi)});return s(n.asn1.toDer(t).getBytes(),"ascii")},t.pkixToJwk=function(e){const t=n.asn1.fromDer(a(e,"ascii")),r=n.pki.publicKeyFromAsn1(t);return{kty:"RSA",n:i(r.n),e:i(r.e),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkix=function(e){const t=n.pki.publicKeyToAsn1({n:o(e.n),e:o(e.e)});return s(n.asn1.toDer(t).getBytes(),"ascii")}},49434:(e,t,r)=>{"use strict";const{sha256:n}=r(56155),i=r(32114),{equals:o}=r(19588),{toString:s}=r(92263),a=r(69716);e.exports=(e,t,c)=>{c=c||r(54056)();class u{constructor(e){c.validatePublicKey(e),this._key=e}verify(e,t){return c.hashAndVerify(this._key,t,e)}marshal(){return c.compressPublicKey(this._key)}get bytes(){return e.PublicKey.encode({Type:e.KeyType.Secp256k1,Data:this.marshal()}).finish()}equals(e){return o(this.bytes,e.bytes)}async hash(){const{bytes:e}=await n.digest(this.bytes);return e}}class f{constructor(e,t){this._key=e,this._publicKey=t||c.computePublicKey(e),c.validatePrivateKey(this._key),c.validatePublicKey(this._publicKey)}sign(e){return c.hashAndSign(this._key,e)}get public(){return new u(this._publicKey)}marshal(){return this._key}get bytes(){return e.PrivateKey.encode({Type:e.KeyType.Secp256k1,Data:this.marshal()}).finish()}equals(e){return o(this.bytes,e.bytes)}async hash(){const{bytes:e}=await n.digest(this.bytes);return e}async id(){const e=await this.public.hash();return s(e,"base58btc")}async export(e,t="libp2p-key"){if("libp2p-key"===t)return a.export(this.bytes,e);throw i(new Error(`export format '${t}' is not supported`),"ERR_INVALID_EXPORT_FORMAT")}}return{Secp256k1PublicKey:u,Secp256k1PrivateKey:f,unmarshalSecp256k1PrivateKey:function(e){return new f(e)},unmarshalSecp256k1PublicKey:function(e){return new u(e)},generateKeyPair:async function(){const e=await c.generateKey();return new f(e)}}}},54056:(e,t,r)=>{"use strict";const n=r(32114),i=r(1795),{sha256:o}=r(56155);e.exports=()=>({generateKey:function(){return i.utils.randomPrivateKey()},privateKeyLength:32,hashAndSign:async function(e,t){const{digest:r}=await o.digest(t);try{return await i.sign(r,e)}catch(e){throw n(e,"ERR_INVALID_INPUT")}},hashAndVerify:async function(e,t,r){try{const{digest:n}=await o.digest(r);return i.verify(t,n,e)}catch(e){throw n(e,"ERR_INVALID_INPUT")}},compressPublicKey:function(e){return i.Point.fromHex(e).toRawBytes(!0)},decompressPublicKey:function(e){return i.Point.fromHex(e).toRawBytes(!1)},validatePrivateKey:function(e){try{i.getPublicKey(e,!0)}catch(e){throw n(e,"ERR_INVALID_PRIVATE_KEY")}},validatePublicKey:function(e){try{i.Point.fromHex(e)}catch(e){throw n(e,"ERR_INVALID_PUBLIC_KEY")}},computePublicKey:function(e){try{return i.getPublicKey(e,!0)}catch(e){throw n(e,"ERR_INVALID_PRIVATE_KEY")}}})},45753:(e,t,r)=>{"use strict";const n=r(32114);e.exports=function(e,t){if(!e.includes(t)){const r=e.join(" / ");throw n(new Error(`Unknown curve: ${t}. Must be ${r}`),"ERR_INVALID_CURVE")}}},93221:(e,t,r)=>{"use strict";const n=r(98960),i=r(97116),o=r(32114),s={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};e.exports=function(e,t,r,a,c){const u=s[c];if(!u){const e=Object.keys(s).join(" / ");throw o(new Error(`Hash '${c}' is unknown or not supported. Must be ${e}`),"ERR_UNSUPPORTED_HASH_TYPE")}const f=n(e,t,r,a,u);return i.encode64(f)}},87503:(e,t,r)=>{"use strict";const n=r(1914),i=r(32114);e.exports=function(e){if(isNaN(e)||e<=0)throw i(new Error("random bytes length must be a Number bigger than 0"),"ERR_INVALID_LENGTH");return n(e)}},56441:(e,t,r)=>{"use strict";r(97116),r(15764);const n=r(3832),{fromString:i}=r(52217),{toString:o}=r(92263),{concat:s}=r(20605);t.bigIntegerToUintBase64url=(e,t)=>{let r=Uint8Array.from(e.abs().toByteArray());if(r=0===r[0]?r.slice(1):r,null!=t){if(r.length>t)throw new Error("byte array longer than desired length");r=s([new Uint8Array(t-r.length),r])}return o(r,"base64url")},t.base64urlToBigInteger=e=>{const r=t.base64urlToBuffer(e);return new n.jsbn.BigInteger(o(r,"base16"),16)},t.base64urlToBuffer=(e,t)=>{let r=i(e,"base64urlpad");if(null!=t){if(r.length>t)throw new Error("byte array longer than desired length");r=s([new Uint8Array(t-r.length),r])}return r}},63649:(e,t)=>{"use strict";t.get=(e=globalThis)=>{const t=e.crypto;if(!t||!t.subtle)throw Object.assign(new Error("Missing Web Crypto API. The most likely cause of this error is that this page is being accessed from an insecure context (i.e. not HTTPS). For more information and possible resolutions see https://github.com/libp2p/js-libp2p-crypto/blob/master/README.md#web-crypto-api"),{code:"ERR_MISSING_WEB_CRYPTO"});return t}},79414:(e,t,r)=>{"use strict";const n=r(88785),{Multiaddr:i}=r(46584),o=r(32114),{OPEN:s,CLOSING:a,CLOSED:c}=r(26067),u=Symbol.for("@libp2p/interface-connection/connection");class f{constructor({localAddr:e,remoteAddr:t,localPeer:r,remotePeer:a,newStream:c,close:u,getStreams:f,stat:l}){!function(e,t,r,s,a,c,u){if(e&&!i.isMultiaddr(e))throw o(new Error("localAddr must be an instance of multiaddr"),"ERR_INVALID_PARAMETERS");if(!n.isPeerId(t))throw o(new Error("localPeer must be an instance of peer-id"),"ERR_INVALID_PARAMETERS");if(!n.isPeerId(r))throw o(new Error("remotePeer must be an instance of peer-id"),"ERR_INVALID_PARAMETERS");if("function"!=typeof s)throw o(new Error("new stream must be a function"),"ERR_INVALID_PARAMETERS");if("function"!=typeof a)throw o(new Error("close must be a function"),"ERR_INVALID_PARAMETERS");if("function"!=typeof c)throw o(new Error("getStreams must be a function"),"ERR_INVALID_PARAMETERS");if(!u)throw o(new Error("connection metadata object must be provided"),"ERR_INVALID_PARAMETERS");if("inbound"!==u.direction&&"outbound"!==u.direction)throw o(new Error('direction must be "inbound" or "outbound"'),"ERR_INVALID_PARAMETERS");if(!u.timeline)throw o(new Error("connection timeline object must be provided in the stat object"),"ERR_INVALID_PARAMETERS");if(!u.timeline.open)throw o(new Error("connection open timestamp must be provided"),"ERR_INVALID_PARAMETERS");if(!u.timeline.upgraded)throw o(new Error("connection upgraded timestamp must be provided"),"ERR_INVALID_PARAMETERS")}(e,r,a,c,u,f,l),this.id=parseInt(String(1e9*Math.random())).toString(36)+Date.now(),this.localAddr=e,this.remoteAddr=t,this.localPeer=r,this.remotePeer=a,this._stat={...l,status:s},this._newStream=c,this._close=u,this._getStreams=f,this.registry=new Map,this.tags=[]}get[Symbol.toStringTag](){return"Connection"}get[u](){return!0}static isConnection(e){return Boolean(e&&e[u])}get stat(){return this._stat}get streams(){return this._getStreams()}async newStream(e){if(this.stat.status===a)throw o(new Error("the connection is being closed"),"ERR_CONNECTION_BEING_CLOSED");if(this.stat.status===c)throw o(new Error("the connection is closed"),"ERR_CONNECTION_CLOSED");Array.isArray(e)||(e=[e]);const{stream:t,protocol:r}=await this._newStream(e);return this.addStream(t,{protocol:r}),{stream:t,protocol:r}}addStream(e,{protocol:t,metadata:r={}}){this.registry.set(e.id,{protocol:t,...r})}removeStream(e){this.registry.delete(e)}async close(){if(this.stat.status!==c){if(this._closing)return this._closing;this.stat.status=a,this._closing=await this._close(),this._stat.timeline.close=Date.now(),this.stat.status=c}}}e.exports=f},15458:(e,t,r)=>{"use strict";t.Connection=r(79414)},26067:e=>{"use strict";e.exports={OPEN:"open",CLOSING:"closing",CLOSED:"closed"}},7609:e=>{"use strict";const t=()=>{},r=Symbol.for("@libp2p/js-interfaces/topology");class n{constructor({min:e=0,max:r=1/0,handlers:n={}}){this.min=e,this.max=r,this._onConnect=n.onConnect||t,this._onDisconnect=n.onDisconnect||t,this.peers=new Set}get[Symbol.toStringTag](){return"Topology"}get[r](){return!0}static isTopology(e){return Boolean(e&&e[r])}set registrar(e){this._registrar=e}disconnect(e){this._onDisconnect(e)}}e.exports=n},13939:(e,t,r)=>{"use strict";const{Buffer:n}=r(24921),i=Symbol.for("BufferList");function o(e){if(!(this instanceof o))return new o(e);o._init.call(this,e)}o._init=function(e){Object.defineProperty(this,i,{value:!0}),this._bufs=[],this.length=0,e&&this.append(e)},o.prototype._new=function(e){return new o(e)},o.prototype._offset=function(e){if(0===e)return[0,0];let t=0;for(let r=0;rthis.length||e<0)return;const t=this._offset(e);return this._bufs[t[0]][t[1]]},o.prototype.slice=function(e,t){return"number"==typeof e&&e<0&&(e+=this.length),"number"==typeof t&&t<0&&(t+=this.length),this.copy(null,0,e,t)},o.prototype.copy=function(e,t,r,i){if(("number"!=typeof r||r<0)&&(r=0),("number"!=typeof i||i>this.length)&&(i=this.length),r>=this.length)return e||n.alloc(0);if(i<=0)return e||n.alloc(0);const o=!!e,s=this._offset(r),a=i-r;let c=a,u=o&&t||0,f=s[1];if(0===r&&i===this.length){if(!o)return 1===this._bufs.length?this._bufs[0]:n.concat(this._bufs,this.length);for(let t=0;tr)){this._bufs[t].copy(e,u,f,f+c),u+=r;break}this._bufs[t].copy(e,u,f),u+=r,c-=r,f&&(f=0)}return e.length>u?e.slice(0,u):e},o.prototype.shallowSlice=function(e,t){if(e=e||0,t="number"!=typeof t?this.length:t,e<0&&(e+=this.length),t<0&&(t+=this.length),e===t)return this._new();const r=this._offset(e),n=this._offset(t),i=this._bufs.slice(r[0],n[0]+1);return 0===n[1]?i.pop():i[i.length-1]=i[i.length-1].slice(0,n[1]),0!==r[1]&&(i[0]=i[0].slice(r[1])),this._new(i)},o.prototype.toString=function(e,t,r){return this.slice(t,r).toString(e)},o.prototype.consume=function(e){if(e=Math.trunc(e),Number.isNaN(e)||e<=0)return this;for(;this._bufs.length;){if(!(e>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},o.prototype.duplicate=function(){const e=this._new();for(let t=0;tthis.length?this.length:t;const i=this._offset(t);let o=i[0],s=i[1];for(;o=e.length){const r=t.indexOf(e,s);if(-1!==r)return this._reverseOffset([o,r]);s=t.length-e.length+1}else{const t=this._reverseOffset([o,s]);if(this._match(t,e))return t;s++}s=0}return-1},o.prototype._match=function(e,t){if(this.length-e{"use strict";var n=r(79742),i=r(80645),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=c,t.SlowBuffer=function(e){return+e!=e&&(e=0),c.alloc(+e)},t.INSPECT_MAX_BYTES=50;var s=2147483647;function a(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return l(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|y(e,t),n=a(r),i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(V(e,Uint8Array)){var t=new Uint8Array(e);return d(t.buffer,t.byteOffset,t.byteLength)}return h(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(V(e,ArrayBuffer)||e&&V(e.buffer,ArrayBuffer))return d(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(V(e,SharedArrayBuffer)||e&&V(e.buffer,SharedArrayBuffer)))return d(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return c.from(n,t,r);var i=function(e){if(c.isBuffer(e)){var t=0|p(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||F(e.length)?a(0):h(e):"Buffer"===e.type&&Array.isArray(e.data)?h(e.data):void 0}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function f(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function l(e){return f(e),a(e<0?0:0|p(e))}function h(e){for(var t=e.length<0?0:0|p(e.length),r=a(t),n=0;n=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function y(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||V(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return K(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return U(e).length;default:if(i)return n?-1:K(e).length;t=(""+t).toLowerCase(),i=!0}}function g(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return k(this,t,r);case"utf8":case"utf-8":return I(this,t,r);case"ascii":return P(this,t,r);case"latin1":case"binary":return R(this,t,r);case"base64":return T(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function b(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function m(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),F(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=c.from(t,n)),c.isBuffer(t))return 0===t.length?-1:v(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):v(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,r,n,i){var o,s=1,a=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var f=-1;for(o=r;oa&&(r=a-c),o=r;o>=0;o--){for(var l=!0,h=0;hi&&(n=i):n=i;var o=t.length;n>o/2&&(n=o/2);for(var s=0;s>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function T(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function I(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i239?4:u>223?3:u>191?2:1;if(i+l<=r)switch(l){case 1:u<128&&(f=u);break;case 2:128==(192&(o=e[i+1]))&&(c=(31&u)<<6|63&o)>127&&(f=c);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(c=(15&u)<<12|(63&o)<<6|63&s)>2047&&(c<55296||c>57343)&&(f=c);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(c=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(f=c)}null===f?(f=65533,l=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),i+=l}return function(e){var t=e.length;if(t<=C)return String.fromCharCode.apply(String,e);for(var r="",n=0;nn.length?c.from(o).copy(n,i):Uint8Array.prototype.set.call(n,o,i);else{if(!c.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i)}i+=o.length}return n},c.byteLength=y,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;tr&&(e+=" ... "),""},o&&(c.prototype[o]=c.prototype.inspect),c.prototype.compare=function(e,t,r,n,i){if(V(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),u=this.slice(n,i),f=e.slice(t,r),l=0;l>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return w(this,e,t,r);case"utf8":case"utf-8":return E(this,e,t,r);case"ascii":case"latin1":case"binary":return _(this,e,t,r);case"base64":return S(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var C=4096;function P(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;in)&&(r=n);for(var i="",o=t;or)throw new RangeError("Trying to access beyond buffer length")}function M(e,t,r,n,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function O(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function N(e,t,r,n,o){return t=+t,r>>>=0,o||O(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function L(e,t,r,n,o){return t=+t,r>>>=0,o||O(e,0,r,8),i.write(e,t,r,n,52,8),r+8}c.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||x(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||x(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||x(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||x(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||x(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||x(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||x(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||x(e,t,this.length);for(var n=this[e],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*t)),n},c.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||x(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return e>>>=0,t||x(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||x(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(e,t){e>>>=0,t||x(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||x(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||x(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return e>>>=0,t||x(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||x(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||x(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||x(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||M(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n||M(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);M(this,e,t,r,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o>0)-a&255;return t+r},c.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);M(this,e,t,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},c.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||M(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeFloatLE=function(e,t,r){return N(this,e,t,!0,r)},c.prototype.writeFloatBE=function(e,t,r){return N(this,e,t,!1,r)},c.prototype.writeDoubleLE=function(e,t,r){return L(this,e,t,!0,r)},c.prototype.writeDoubleBE=function(e,t,r){return L(this,e,t,!1,r)},c.prototype.copy=function(e,t,r,n){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function U(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(D,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function j(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function V(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function F(e){return e!=e}var q=function(){for(var e="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)t[n+i]=e[r]+e[i];return t}()},72842:e=>{"use strict";function t(e,t){for(const r in t)Object.defineProperty(e,r,{value:t[r],enumerable:!0,configurable:!0});return e}e.exports=function(e,r,n){if(!e||"string"==typeof e)throw new TypeError("Please pass an Error to err-code");n||(n={}),"object"==typeof r&&(n=r,r=void 0),null!=r&&(n.code=r);try{return t(e,n)}catch(r){n.message=e.message,n.stack=e.stack;const i=function(){};return i.prototype=Object.create(Object.getPrototypeOf(e)),t(new i,n)}}},3477:e=>{e.exports=function e(t,r){var n,i=0,o=0,s=r=r||0,a=t.length;do{if(s>=a||o>49)throw e.bytes=0,new RangeError("Could not decode varint");n=t[s++],i+=o<28?(127&n)<=128);return e.bytes=s-r,i}},38575:e=>{e.exports=function e(r,n,i){if(Number.MAX_SAFE_INTEGER&&r>Number.MAX_SAFE_INTEGER)throw e.bytes=0,new RangeError("Could not encode varint");n=n||[];for(var o=i=i||0;r>=t;)n[i++]=255&r|128,r/=128;for(;-128&r;)n[i++]=255&r|128,r>>>=7;return n[i]=0|r,e.bytes=i-o+1,n};var t=Math.pow(2,31)},4941:(e,t,r)=>{e.exports={encode:r(38575),decode:r(3477),encodingLength:r(23963)}},23963:e=>{var t=Math.pow(2,7),r=Math.pow(2,14),n=Math.pow(2,21),i=Math.pow(2,28),o=Math.pow(2,35),s=Math.pow(2,42),a=Math.pow(2,49),c=Math.pow(2,56),u=Math.pow(2,63);e.exports=function(e){return e{"use strict";const n=r(4941),i=r(13939);e.exports=e=>async function*(){const t=new o;for await(const r of e){const e=t.write(r);e.length&&(yield e)}}();class o{constructor(){this._buffer=new i,this._bufferProxy=new Proxy({},{get:(e,t)=>"l"===t[0]?this._buffer[t]:this._buffer.get(parseInt(t))}),this._headerInfo=null}write(e){if(!e||!e.length)return[];this._buffer.append(e);const t=[];for(;;){if(!this._headerInfo)try{this._headerInfo=this._decodeHeader(this._bufferProxy)}catch(e){break}const{id:e,type:r,length:n,offset:i}=this._headerInfo;if(this._buffer.length-i>3,type:7&t,offset:r,length:i}}}},45164:(e,t,r)=>{"use strict";const n=r(4941),i=r(13939),o=10240,s=new class{constructor(){this._pool=new Uint8Array(o),this._poolOffset=0}write(e){const t=this._pool;let r=this._poolOffset;n.encode(e.id<<3|e.type,t,r),r+=n.encode.bytes,n.encode(e.data?e.data.length:0,t,r),r+=n.encode.bytes;const i=t.subarray(this._poolOffset,r);return o-r<100?(this._pool=new Uint8Array(o),this._poolOffset=0):this._poolOffset=r,e.data?[i,e.data]:i}};e.exports=e=>async function*(){for await(const t of e)Array.isArray(t)?yield new i(t.map((e=>s.write(e)))):yield new i(s.write(t))}()},73209:(e,t,r)=>{"use strict";t.encode=r(45164),t.decode=r(75516)},1267:(e,t,r)=>{"use strict";e.exports=r(47932)},82492:(e,t)=>{"use strict";const r=Object.freeze({NEW_STREAM:0,MESSAGE_RECEIVER:1,MESSAGE_INITIATOR:2,CLOSE_RECEIVER:3,CLOSE_INITIATOR:4,RESET_RECEIVER:5,RESET_INITIATOR:6});t.MessageTypes=r,t.InitiatorMessageTypes=Object.freeze({NEW_STREAM:r.NEW_STREAM,MESSAGE:r.MESSAGE_INITIATOR,CLOSE:r.CLOSE_INITIATOR,RESET:r.RESET_INITIATOR}),t.ReceiverMessageTypes=Object.freeze({MESSAGE:r.MESSAGE_RECEIVER,CLOSE:r.CLOSE_RECEIVER,RESET:r.RESET_RECEIVER}),t.MessageTypeNames=Object.freeze(Object.entries(r).reduce(((e,t)=>(e[t[1]]=t[0],e)),{}))},47932:(e,t,r)=>{"use strict";const n=r(60618),i=r(84975),o=r(11227)("libp2p:mplex"),s=r(61623),a=r(73209),c=r(40092),{MessageTypes:u,MessageTypeNames:f}=r(82492),l=r(16048);class h{constructor(e){e="function"==typeof(e=e||{})?{onStream:e}:e,this._streamId=0,this._streams={initiators:new Map,receivers:new Map},this._options=e,this.sink=this._createSink(),this.source=this._createSource(),this.onStream=e.onStream,this.onStreamEnd=e.onStreamEnd}get streams(){const e=[];return this._streams.initiators.forEach((t=>{e.push(t)})),this._streams.receivers.forEach((t=>{e.push(t)})),e}newStream(e){const t=this._streamId++;e=null==e?t.toString():String(e);const r=this._streams.initiators;return this._newStream({id:t,name:e,type:"initiator",registry:r})}_newReceiverStream({id:e,name:t}){const r=this._streams.receivers;return this._newStream({id:e,name:t,type:"receiver",registry:r})}_newStream({id:e,name:t,type:r,registry:n}){if(n.has(e))throw new Error(`${r} stream ${e} already exists!`);o("new %s stream %s %s",r,e,t);const i=l({id:e,name:t,send:n=>(o.enabled&&o("%s stream %s %s send",r,e,t,{...n,type:f[n.type],data:n.data&&n.data.slice()}),this.source.push(n)),type:r,onEnd:()=>{o("%s stream %s %s ended",r,e,t),n.delete(e),this.onStreamEnd&&this.onStreamEnd(i)},maxMsgSize:this._options.maxMsgSize});return n.set(e,i),i}_createSink(){return async e=>{this._options.signal&&(e=s(e,this._options.signal));try{await n(e,a.decode,c(this._options.maxMsgSize),(async e=>{for await(const t of e)for(const e of t)this._handleIncoming(e)}))}catch(e){return o("error in sink",e),this.source.end(e)}this.source.end()}}_createSource(){const e=i({onEnd:e=>{const{initiators:t,receivers:r}=this._streams;for(const r of t.values())r.abort(e);for(const t of r.values())t.abort(e)},writev:!0});return Object.assign(a.encode(e),{push:e.push,end:e.end,return:e.return})}_handleIncoming({id:e,type:t,data:r}){if(o.enabled&&o("incoming message",{id:e,type:f[t],data:r.slice()}),t===u.NEW_STREAM&&this.onStream){const t=this._newReceiverStream({id:e,name:r.toString()});return this.onStream(t)}const n=(1&t?this._streams.initiators:this._streams.receivers).get(e);if(!n)return o("missing stream %s",e);switch(t){case u.MESSAGE_INITIATOR:case u.MESSAGE_RECEIVER:n.source.push(r);break;case u.CLOSE_INITIATOR:case u.CLOSE_RECEIVER:n.close();break;case u.RESET_INITIATOR:case u.RESET_RECEIVER:n.reset();break;default:o("unknown message type %s",t)}}}h.multicodec="/mplex/6.7.0",e.exports=h},40092:e=>{"use strict";const t=1<<20;e.exports=e=>{e=e||t;const r=t=>{if(t.data&&t.data.length>e)throw Object.assign(new Error("message size too large!"),{code:"ERR_MSG_TOO_BIG"})};return e=>async function*(){for await(const t of e)Array.isArray(t)?t.forEach(r):r(t),yield t}()},e.exports.MAX_MSG_SIZE=t},16048:(e,t,r)=>{"use strict";const n=r(61623),i=r(28599),o=r(11227)("libp2p:mplex:stream"),s=r(84975),a=r(13939),c=r(72842),{MAX_MSG_SIZE:u}=r(40092),{InitiatorMessageTypes:f,ReceiverMessageTypes:l}=r(82492),h="ERR_MPLEX_STREAM_RESET";e.exports=({id:e,name:t,send:r,onEnd:d=(()=>{}),type:p="initiator",maxMsgSize:y=u})=>{const g=new i,b=new i,m="initiator"===p?f:l,v="initiator"===p?`i${e}`:`r${e}`;t=String(null==t?e:t);let w,E=!1,_=!1;const S=e=>{_||(_=!0,o("%s stream %s sink end",p,t,e),e&&!w&&(w=e),E&&(A.timeline.close=Date.now(),d(w)))},A={close:()=>A.source.end(),abort:e=>{o("%s stream %s abort",p,t,e),A.source.end(e),g.abort(),S(e)},reset:()=>{const e=c(new Error("stream reset"),h);b.abort(),A.source.end(e),S(e)},sink:async i=>{i=n(i,[{signal:g.signal,options:{abortMessage:"stream aborted",abortCode:"ERR_MPLEX_STREAM_ABORT"}},{signal:b.signal,options:{abortMessage:"stream reset",abortCode:h}}]),"initiator"===p&&r({id:e,type:m.NEW_STREAM,data:t});try{for await(let t of i)for(;t.length;){if(t.length<=y){r({id:e,type:m.MESSAGE,data:t});break}t=a.isBufferList(t)?t:new a(t),r({id:e,type:m.MESSAGE,data:t.shallowSlice(0,y)}),t.consume(y)}}catch(n){return n.code===h?o("%s stream %s reset",p,t):(o("%s stream %s error",p,t,n),r({id:e,type:m.RESET})),A.source.end(n),S(n)}r({id:e,type:m.CLOSE}),S()},source:s((e=>{E||(E=!0,o("%s stream %s source end",p,t,e),e&&!w&&(w=e),_&&(A.timeline.close=Date.now(),d(w)))})),timeline:{open:Date.now(),close:null},id:v};return A}},53737:(e,t,r)=>{"use strict";const n=r(81980);function i(e,t){const r=n(e.multiaddr),i=n(t.multiaddr);return r&&!i?1:!r&&i||e.isCertified&&!t.isCertified?-1:!e.isCertified&&t.isCertified?1:0}e.exports.publicAddressesFirst=function(e){return[...e].sort(i)}},52942:e=>{"use strict";e.exports=function(e,t){return e.length===t.length&&t.sort()&&e.sort().every(((e,r)=>t[r].equals(e)))}},489:(e,t,r)=>{"use strict";const n=r(11227),i=Object.assign(n("libp2p:ip-port-to-multiaddr"),{error:n("libp2p:ip-port-to-multiaddr:err")}),{Multiaddr:o}=r(46584),s=r(32114),{Address4:a,Address6:c}=r(91843),u={ERR_INVALID_IP_PARAMETER:"ERR_INVALID_IP_PARAMETER",ERR_INVALID_PORT_PARAMETER:"ERR_INVALID_PORT_PARAMETER",ERR_INVALID_IP:"ERR_INVALID_IP"};e.exports=function(e,t){if("string"!=typeof e)throw s(new Error(`invalid ip provided: ${e}`),u.ERR_INVALID_IP_PARAMETER);if("string"==typeof t&&(t=parseInt(t)),isNaN(t))throw s(new Error(`invalid port provided: ${t}`),u.ERR_INVALID_PORT_PARAMETER);try{return new a(e),new o(`/ip4/${e}/tcp/${t}`)}catch{}try{const r=new c(e);return r.is4()?new o(`/ip4/${r.to4().correctForm()}/tcp/${t}`):new o(`/ip6/${e}/tcp/${t}`)}catch(r){const n=`invalid ip:port for creating a multiaddr: ${e}:${t}`;throw i.error(n),s(new Error(n),u.ERR_INVALID_IP)}},e.exports.Errors=u},23830:(e,t,r)=>{"use strict";const n=r(51890);e.exports=function(e){const{address:t}=e.nodeAddress();return n(t)}},81980:(e,t,r)=>{"use strict";const n=r(290);e.exports=function(e){const{address:t}=e.nodeAddress();return n(t)}},15091:(e,t,r)=>{"use strict";const{source:n}=r(61623),i=r(11227)("libp2p:stream:converter");e.exports=function({stream:e,remoteAddr:t,localAddr:r},o={}){const{sink:s,source:a}=e,c={async sink(e){o.signal&&(e=n(e,o.signal));try{await s(e)}catch(e){"aborted"!==e.type&&i(e)}u()},source:o.signal?n(a,o.signal):a,conn:e,localAddr:r,remoteAddr:t,timeline:{open:Date.now(),close:void 0},close:()=>(s(new Uint8Array(0)),u())};function u(){return c.timeline.close||(c.timeline.close=Date.now()),Promise.resolve()}return c}},16288:(e,t,r)=>{"use strict";var n=r(34155);const i=r(59134),o="object"==typeof window&&"object"==typeof document&&9===document.nodeType,s=i(),a=o&&!s,c=s&&!o,u=s&&o,f=void 0!==n&&void 0!==n.release&&"node"===n.release.name&&!s,l="function"==typeof importScripts&&"undefined"!=typeof self&&"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,h=void 0!==n&&void 0!==n.env&&!1,d="undefined"!=typeof navigator&&"ReactNative"===navigator.product;e.exports={isTest:h,isElectron:s,isElectronMain:c,isElectronRenderer:u,isNode:f,isBrowser:a,isWebWorker:l,isEnvWithDom:o,isReactNative:d}},61073:(e,t,r)=>{const{Multiaddr:n}=r(46584),i=(e,t)=>t,o={ip4:i,ip6:(e,t,r,n)=>1===n.length&&"ip6"===n[0].protocol?t:`[${t}]`,tcp:(e,t,r,n,i)=>n.some((e=>["http","https","ws","wss"].includes(e.protocol)))?`${e}:${t}`:((e,t,r,n)=>{if(n&&!1===n.assumeHttp)return`tcp://${e}:${t}`;let i="tcp",o=`:${t}`;return"tcp"===r[r.length-1].protocol&&(i="443"===t?"https":"http",o="443"===t||"80"===t?"":o),`${i}://${e}${o}`})(e,t,n,i),udp:(e,t)=>`udp://${e}:${t}`,dnsaddr:i,dns4:i,dns6:i,ipfs:(e,t)=>`${e}/ipfs/${t}`,p2p:(e,t)=>`${e}/p2p/${t}`,http:e=>`http://${e}`,https:e=>`https://${e}`,ws:e=>`ws://${e}`,wss:e=>`wss://${e}`,"p2p-websocket-star":e=>`${e}/p2p-websocket-star`,"p2p-webrtc-star":e=>`${e}/p2p-webrtc-star`,"p2p-webrtc-direct":e=>`${e}/p2p-webrtc-direct`};e.exports=(e,t)=>{const r=new n(e),i=e.toString().split("/").slice(1);return r.tuples().map((e=>({protocol:i.shift(),content:e[1]?i.shift():null}))).reduce(((e,r,n,i)=>{const s=o[r.protocol];if(!s)throw new Error(`Unsupported protocol ${r.protocol}`);return s(e,r.content,n,i,t)}),"")}},33199:(e,t)=>{"use strict";t.CODE_P2P=421,t.CODE_CIRCUIT=290,t.CODE_TCP=6,t.CODE_WS=477,t.CODE_WSS=478,t.CLOSE_TIMEOUT=2e3},70040:(e,t,r)=>{"use strict";const n=r(29175),{CODE_CIRCUIT:i,CODE_P2P:o,CODE_TCP:s,CODE_WS:a,CODE_WSS:c}=r(33199);e.exports={all:e=>e.filter((e=>{if(e.protoCodes().includes(i))return!1;const t=e.decapsulateCode(o);return n.WebSockets.matches(t)||n.WebSocketsSecure.matches(t)})),dnsWss:e=>e.filter((e=>{if(e.protoCodes().includes(i))return!1;const t=e.decapsulateCode(o);return n.WebSocketsSecure.matches(t)&&n.DNS.matches(t.decapsulateCode(s).decapsulateCode(c))})),dnsWsOrWss:e=>e.filter((e=>{if(e.protoCodes().includes(i))return!1;const t=e.decapsulateCode(o);return n.WebSockets.matches(t)?n.DNS.matches(t.decapsulateCode(s).decapsulateCode(a)):n.WebSocketsSecure.matches(t)&&n.DNS.matches(t.decapsulateCode(s).decapsulateCode(c))}))}},29846:(e,t,r)=>{"use strict";const n=r(6476),i=r(98514),o=r(61073),{AbortError:s}=r(61623),a=r(63931),c=r(11227),u=c("libp2p:websockets");u.error=c("libp2p:websockets:error");const f=r(16288),l=r(89174),h=r(10863),d=r(70040);e.exports=i(class{constructor({upgrader:e,filter:t}){if(!e)throw new Error("An upgrader must be provided. See https://github.com/libp2p/interface-transport#upgrader.");this._upgrader=e,this._filter=t}async dial(e,t={}){u("dialing %s",e);const r=await this._connect(e,t),n=h(r,{remoteAddr:e,signal:t.signal});u("new outbound connection %s",n.remoteAddr);const i=await this._upgrader.upgradeOutbound(n);return u("outbound connection %s upgraded",n.remoteAddr),i}async _connect(e,t={}){if(t.signal&&t.signal.aborted)throw new s;const r=e.toOptions();u("dialing %s:%s",r.host,r.port);const i=a(),c=e=>{const t=`connection error: ${e.message}`;u.error(t),i.reject(e)},f=n(o(e),Object.assign({binary:!0},t));if(f.socket.on?f.socket.on("error",c):f.socket.onerror=c,!t.signal)return await Promise.race([f.connected(),i.promise]),u("connected %s",e),f;let l;const h=new Promise(((e,r)=>{if(l=()=>{r(new s),setTimeout((()=>{f.close()}))},t.signal.aborted)return l();t.signal.addEventListener("abort",l)}));try{await Promise.race([h,i.promise,f.connected()])}finally{t.signal.removeEventListener("abort",l)}return u("connected %s",e),f}createListener(e={},t){return"function"==typeof e&&(t=e,e={}),l({handler:t,upgrader:this._upgrader},e)}filter(e){return e=Array.isArray(e)?e:[e],this._filter?this._filter(e):f.isBrowser||f.isWebWorker?d.dnsWss(e):d.all(e)}},{className:"WebSockets",symbolName:"@libp2p/js-libp2p-websockets/websockets"})},89174:e=>{"use strict";e.exports=function(){throw new Error("WebSocket Servers can not be created in the browser!")}},10863:(e,t,r)=>{"use strict";const n=r(61623),{CLOSE_TIMEOUT:i}=r(33199),o=r(489),s=r(58147),a=r(11227),c=a("libp2p:websockets:socket");c.error=a("libp2p:websockets:socket:error"),e.exports=(e,t={})=>{const r={async sink(r){t.signal&&(r=n(r,t.signal));try{await e.sink(async function*(){for await(const e of r)yield e instanceof Uint8Array?e:e.slice()}())}catch(e){"aborted"!==e.type&&c.error(e)}},source:t.signal?n(e.source,t.signal):e.source,conn:e,localAddr:t.localAddr||(e.localAddress&&e.localPort?o(e.localAddress,e.localPort):void 0),remoteAddr:t.remoteAddr||o(e.remoteAddress,e.remotePort),timeline:{open:Date.now()},async close(){const t=Date.now();try{await s(e.close(),i)}catch(n){const{host:i,port:o}=r.remoteAddr.toOptions();c("timeout closing stream to %s:%s after %dms, destroying it manually",i,o,Date.now()-t),e.destroy()}finally{r.timeline.close=Date.now()}}};return e.socket.once&&e.socket.once("close",(()=>{r.timeline.close||(r.timeline.close=Date.now())})),r}},72826:(e,t,r)=>{"use strict";const{Buffer:n}=r(48764),i=r(9668),o=r(56842),s=4194304,a=n.alloc(0),c="readLength",u="readData",f={[c]:(e,t,r,n)=>{let o;t=t.append(e);try{o=n.lengthDecoder(t)}catch(e){if(t.length>n.maxLengthLength)throw Object.assign(e,{message:"message length too long",code:"ERR_MSG_LENGTH_TOO_LONG"});if(e instanceof RangeError)return{mode:c,buffer:t,chunk:void 0,state:void 0,data:void 0};throw e}if(o>n.maxDataLength)throw Object.assign(new Error("message data too long"),{code:"ERR_MSG_DATA_TOO_LONG"});return e=t.shallowSlice(n.lengthDecoder.bytes),t=new i,n.onLength&&n.onLength(o),o<=0?(n.onData&&n.onData(a),{mode:c,chunk:e,buffer:t,data:a}):{mode:u,chunk:e,buffer:t,state:{dataLength:o},data:void 0}},[u]:(e,t,r,n)=>{if(t=t.append(e),!r)throw new Error("state is required");if(t.lengtho?t.shallowSlice(o):void 0;return t=new i,n.onData&&n.onData(s),{mode:c,chunk:a,buffer:t,state:void 0,data:s}}};function l(e){const t={lengthDecoder:(e=e||{}).lengthDecoder||o,maxLengthLength:e.maxLengthLength||8,maxDataLength:e.maxDataLength||s,onLength:e.onLength,onData:e.onData};return async function*(e){let r,n=new i,o=c;for await(const i of e){let e=i;for(;e;){const i=f[o](e,n,r,t);o=i.mode,e=i.chunk,n=i.buffer,r=i.state,i.data&&(yield i.data)}}if(n.length)throw Object.assign(new Error("unexpected end of input"),{code:"ERR_UNEXPECTED_EOF"})}}l.fromReader=(e,t)=>{let r=1;const n={[Symbol.asyncIterator](){return this},next:async()=>{try{return await e.next(r)}catch(e){if("ERR_UNDER_READ"===e.code)return{done:!0,value:null};throw e}finally{r=1}}};return l({...t||{},onLength:e=>{r=e}})(n)},e.exports=l,e.exports.MAX_LENGTH_LENGTH=8,e.exports.MAX_DATA_LENGTH=s},50396:(e,t,r)=>{"use strict";const{Buffer:n}=r(48764),i=r(9668),o=r(60911);function s(e){e=e||{};const t=Math.max(e.poolSize||10240,e.minPoolSize||8),r=e.lengthEncoder||o;return async function*(e){let o=n.alloc(t),s=0;for await(const a of e){r(a.length,o,s);const e=o.slice(s,s+r.bytes);s+=r.bytes,o.length-s<8&&(o=n.alloc(t),s=0),yield(new i).append(e).append(a)}}}s.single=(e,t)=>{const r=(t=t||{}).lengthEncoder||o;return new i([r(e.length),e.slice()])},e.exports=s,e.exports.MIN_POOL_SIZE=8,e.exports.DEFAULT_POOL_SIZE=10240},63500:(e,t,r)=>{"use strict";t.encode=r(50396),t.decode=r(72826),t.varintEncode=r(60911),t.varintDecode=r(56842),t.int32BEEncode=r(22660),t.int32BEDecode=r(3100)},3100:e=>{"use strict";const t=e=>{if(e.length<4)throw RangeError("Could not decode int32BE");return e.readInt32BE(0)};t.bytes=4,e.exports=t},22660:(e,t,r)=>{"use strict";const{Buffer:n}=r(48764),i=(e,t,r)=>((t=t||n.allocUnsafe(4)).writeInt32BE(e,r),t);i.bytes=4,e.exports=i},56842:(e,t,r)=>{"use strict";const n=r(31997),{Buffer:i}=r(48764),o=e=>{const t=n.decode(i.isBuffer(e)?e:(r=e,new Proxy({},{get:(e,t)=>"l"===t[0]?r[t]:r.get(parseInt(t))})));var r;return o.bytes=n.decode.bytes,t};e.exports=o},60911:(e,t,r)=>{"use strict";const n=r(31997),{Buffer:i}=r(48764),o=(e,t,r)=>{const s=n.encode(e,t,r);return o.bytes=n.encode.bytes,t||i.from(s)};e.exports=o},78621:(e,t,r)=>{"use strict";const n=r(32114),i={16:"aes-128-ctr",32:"aes-256-ctr"};e.exports=function(e){const t=i[e.length];if(!t){const t=Object.entries(i).map((([e,t])=>`${e} (${t})`)).join(" / ");throw n(new Error(`Invalid key length ${e.length} bytes. Must be ${t}`),"ERR_INVALID_KEY_LENGTH")}return t}},76590:(e,t,r)=>{"use strict";r(8925);const n=r(3832),{toString:i}=r(92263),{fromString:o}=r(52217);e.exports={createCipheriv:(e,t,r)=>{const s=n.cipher.createCipher("AES-CTR",i(t,"ascii"));return s.start({iv:i(r,"ascii")}),{update:e=>(s.update(n.util.createBuffer(i(e,"ascii"))),o(s.output.getBytes(),"ascii"))}},createDecipheriv:(e,t,r)=>{const s=n.cipher.createDecipher("AES-CTR",i(t,"ascii"));return s.start({iv:i(r,"ascii")}),{update:e=>(s.update(n.util.createBuffer(i(e,"ascii"))),o(s.output.getBytes(),"ascii"))}}}},32100:(e,t,r)=>{"use strict";const n=r(76590),i=r(78621);t.create=async function(e,t){const r=i(e),o=n.createCipheriv(r,e,t),s=n.createDecipheriv(r,e,t);return{encrypt:async e=>o.update(e),decrypt:async e=>s.update(e)}}},92485:(e,t,r)=>{"use strict";const{concat:n}=r(20605),{fromString:i}=r(52217),o=r(87518);e.exports={create:function({algorithm:e="AES-GCM",nonceLength:t=12,keyLength:r=16,digest:s="SHA-256",saltLength:a=16,iterations:c=32767}={}){const u=o.get();return r*=8,{encrypt:async function(o,f){const l=u.getRandomValues(new Uint8Array(a)),h=u.getRandomValues(new Uint8Array(t)),d={name:e,iv:h},p={name:"PBKDF2",salt:l,iterations:c,hash:{name:s}},y=await u.subtle.importKey("raw",i(f),{name:"PBKDF2"},!1,["deriveKey","deriveBits"]),g=await u.subtle.deriveKey(p,y,{name:e,length:r},!0,["encrypt"]),b=await u.subtle.encrypt(d,g,o);return n([l,d.iv,new Uint8Array(b)])},decrypt:async function(n,o){const f=n.slice(0,a),l=n.slice(a,a+t),h=n.slice(a+t),d={name:e,iv:l},p={name:"PBKDF2",salt:f,iterations:c,hash:{name:s}},y=await u.subtle.importKey("raw",i(o),{name:"PBKDF2"},!1,["deriveKey","deriveBits"]),g=await u.subtle.deriveKey(p,y,{name:e,length:r},!0,["decrypt"]),b=await u.subtle.decrypt(d,g,h);return new Uint8Array(b)}}}}},48690:(e,t,r)=>{"use strict";const n=r(87518),i=r(36482),o={SHA1:"SHA-1",SHA256:"SHA-256",SHA512:"SHA-512"};t.create=async function(e,t){const r=o[e],s=await n.get().subtle.importKey("raw",t,{name:"HMAC",hash:{name:r}},!1,["sign"]);return{digest:async e=>(async(e,t)=>{const r=await n.get().subtle.sign({name:"HMAC"},e,t);return new Uint8Array(r,r.byteOffset,r.byteLength)})(s,e),length:i[e]}}},36482:e=>{"use strict";e.exports={SHA1:20,SHA256:32,SHA512:64}},49928:(e,t,r)=>{"use strict";const n=r(48690),i=r(32100),o=r(92826);t.aes=i,t.hmac=n,t.keys=o,t.randomBytes=r(53890),t.pbkdf2=r(57493)},18294:(e,t,r)=>{"use strict";const n=r(32114),i=r(87518),{base64urlToBuffer:o}=r(28894),s=r(50439),{toString:a}=r(92263),{concat:c}=r(20605),{equals:u}=r(19588),f={"P-256":256,"P-384":384,"P-521":521};t.generateEphmeralKeyPair=async function(e){s(Object.keys(f),e);const t=await i.get().subtle.generateKey({name:"ECDH",namedCurve:e},!0,["deriveBits"]);return{key:h(await i.get().subtle.exportKey("jwk",t.publicKey)),genSharedKey:async(r,n)=>{let o;o=n?await i.get().subtle.importKey("jwk",p(e,n),{name:"ECDH",namedCurve:e},!1,["deriveBits"]):t.privateKey;const s=[await i.get().subtle.importKey("jwk",d(e,r),{name:"ECDH",namedCurve:e},!1,[]),o],a=await i.get().subtle.deriveBits({name:"ECDH",namedCurve:e,public:s[0]},s[1],f[e]);return new Uint8Array(a,a.byteOffset,a.byteLength)}}};const l={"P-256":32,"P-384":48,"P-521":66};function h(e){const t=l[e.crv];return c([Uint8Array.from([4]),o(e.x,t),o(e.y,t)],1+2*t)}function d(e,t){const r=l[e];if(u(!t.slice(0,1),Uint8Array.from([4])))throw n(new Error("Cannot unmarshal public key - invalid key format"),"ERR_INVALID_KEY_FORMAT");return{kty:"EC",crv:e,x:a(t.slice(1,r+1),"base64url"),y:a(t.slice(1+r),"base64url"),ext:!0}}const p=(e,t)=>({...d(e,t.public),d:a(t.private,"base64url")})},23924:(e,t,r)=>{"use strict";const n=r(32114),{equals:i}=r(19588),{sha256:o}=r(56155),{base58btc:s}=r(99086),{identity:a}=r(78103),c=r(57217),u=r(5345),f=r(70427);class l{constructor(e){this._key=d(e,c.publicKeyLength)}async verify(e,t){return c.hashAndVerify(this._key,t,e)}marshal(){return this._key}get bytes(){return u.PublicKey.encode({Type:u.KeyType.Ed25519,Data:this.marshal()}).finish()}equals(e){return i(this.bytes,e.bytes)}async hash(){const{bytes:e}=await o.digest(this.bytes);return e}}class h{constructor(e,t){this._key=d(e,c.privateKeyLength),this._publicKey=d(t,c.publicKeyLength)}async sign(e){return c.hashAndSign(this._key,e)}get public(){return new l(this._publicKey)}marshal(){return this._key}get bytes(){return u.PrivateKey.encode({Type:u.KeyType.Ed25519,Data:this.marshal()}).finish()}equals(e){return i(this.bytes,e.bytes)}async hash(){const{bytes:e}=await o.digest(this.bytes);return e}async id(){const e=await a.digest(this.public.bytes);return s.encode(e.bytes).substring(1)}async export(e,t="libp2p-key"){if("libp2p-key"===t)return f.export(this.bytes,e);throw n(new Error(`export format '${t}' is not supported`),"ERR_INVALID_EXPORT_FORMAT")}}function d(e,t){if((e=Uint8Array.from(e||[])).length!==t)throw n(new Error(`Key must be a Uint8Array of length ${t}, got ${e.length}`),"ERR_INVALID_KEY_TYPE");return e}e.exports={Ed25519PublicKey:l,Ed25519PrivateKey:h,unmarshalEd25519PrivateKey:function(e){if(e.length>c.privateKeyLength){const t=(e=d(e,c.privateKeyLength+c.publicKeyLength)).slice(0,c.privateKeyLength),r=e.slice(c.privateKeyLength,e.length);return new h(t,r)}const t=(e=d(e,c.privateKeyLength)).slice(0,c.privateKeyLength),r=e.slice(c.publicKeyLength);return new h(t,r)},unmarshalEd25519PublicKey:function(e){return e=d(e,c.publicKeyLength),new l(e)},generateKeyPair:async function(){const{privateKey:e,publicKey:t}=await c.generateKey();return new h(e,t)},generateKeyPairFromSeed:async function(e){const{privateKey:t,publicKey:r}=await c.generateKeyFromSeed(e);return new h(t,r)}}},57217:(e,t,r)=>{"use strict";r(80069);const n=r(3832);t.publicKeyLength=n.pki.ed25519.constants.PUBLIC_KEY_BYTE_LENGTH,t.privateKeyLength=n.pki.ed25519.constants.PRIVATE_KEY_BYTE_LENGTH,t.generateKey=async function(){return n.pki.ed25519.generateKeyPair()},t.generateKeyFromSeed=async function(e){return n.pki.ed25519.generateKeyPair({seed:e})},t.hashAndSign=async function(e,t){return n.pki.ed25519.sign({message:t,privateKey:e})},t.hashAndVerify=async function(e,t,r){return n.pki.ed25519.verify({signature:t,message:r,publicKey:e})}},74340:(e,t,r)=>{"use strict";const n=r(18294);e.exports=async e=>n.generateEphmeralKeyPair(e)},70427:(e,t,r)=>{"use strict";const{base64:n}=r(9885),i=r(92485);e.exports={export:async function(e,t){const r=i.create(),o=await r.encrypt(e,t);return n.encode(o)}}},75475:(e,t,r)=>{"use strict";const{base64:n}=r(9885),i=r(92485);e.exports={import:async function(e,t){const r=n.decode(e),o=i.create();return await o.decrypt(r,t)}}},92826:(e,t,r)=>{"use strict";const n=r(5345);r(3068),r(97450);const i=r(3832),o=r(32114),{fromString:s}=r(52217),a=r(75475),c={rsa:r(42162),ed25519:r(23924),secp256k1:r(9321)(n,r(53890))},u="secp256k1 support requires libp2p-crypto-secp256k1 package",f="ERR_MISSING_PACKAGE";function l(e){const t=c[e.toLowerCase()];if(!t){const t=Object.keys(c).join(" / ");throw o(new Error(`invalid or unsupported key type ${e}. Must be ${t}`),"ERR_UNSUPPORTED_KEY_TYPE")}return t}const h=async e=>{const t=n.PrivateKey.decode(e),r=t.Data;switch(t.Type){case n.KeyType.RSA:return c.rsa.unmarshalRsaPrivateKey(r);case n.KeyType.Ed25519:return c.ed25519.unmarshalEd25519PrivateKey(r);case n.KeyType.Secp256k1:if(c.secp256k1)return c.secp256k1.unmarshalSecp256k1PrivateKey(r);throw o(new Error(u),f);default:l(t.Type)}};e.exports={supportedKeys:c,keysPBM:n,keyStretcher:r(65954),generateEphemeralKeyPair:r(74340),generateKeyPair:async(e,t)=>l(e).generateKeyPair(t),generateKeyPairFromSeed:async(e,t,r)=>{const n=l(e);if("ed25519"!==e.toLowerCase())throw o(new Error("Seed key derivation is unimplemented for RSA or secp256k1"),"ERR_UNSUPPORTED_KEY_DERIVATION_TYPE");return n.generateKeyPairFromSeed(t,r)},unmarshalPublicKey:e=>{const t=n.PublicKey.decode(e),r=t.Data;switch(t.Type){case n.KeyType.RSA:return c.rsa.unmarshalRsaPublicKey(r);case n.KeyType.Ed25519:return c.ed25519.unmarshalEd25519PublicKey(r);case n.KeyType.Secp256k1:if(c.secp256k1)return c.secp256k1.unmarshalSecp256k1PublicKey(r);throw o(new Error(u),f);default:l(t.Type)}},marshalPublicKey:(e,t)=>(l(t=(t||"rsa").toLowerCase()),e.bytes),unmarshalPrivateKey:h,marshalPrivateKey:(e,t)=>(l(t=(t||"rsa").toLowerCase()),e.bytes),import:async(e,t)=>{try{const r=await a.import(e,t);return h(r)}catch(e){}const r=i.pki.decryptRsaPrivateKey(e,t);if(null===r)throw o(new Error("Cannot read the key, most likely the password is wrong or not a RSA key"),"ERR_CANNOT_DECRYPT_PEM");let n=i.asn1.toDer(i.pki.privateKeyToAsn1(r));return n=s(n.getBytes(),"ascii"),c.rsa.unmarshalRsaPrivateKey(n)}}},75396:(e,t,r)=>{"use strict";r(28095);const n=r(3832),{base64urlToBigInteger:i}=r(28894);function o(e,t){return t.map((t=>i(e[t])))}e.exports={jwk2pub:function(e){return n.pki.setRsaPublicKey(...o(e,["n","e"]))},jwk2priv:function(e){return n.pki.setRsaPrivateKey(...o(e,["n","e","d","p","q","dp","dq","qi"]))}}},65954:(e,t,r)=>{"use strict";const n=r(32114),{concat:i}=r(20605),{fromString:o}=r(52217),s=r(48690),a={"AES-128":{ivSize:16,keySize:16},"AES-256":{ivSize:16,keySize:32},Blowfish:{ivSize:8,cipherKeySize:32}};e.exports=async(e,t,r)=>{const c=a[e];if(!c){const t=Object.keys(a).join(" / ");throw n(new Error(`unknown cipher type '${e}'. Must be ${t}`),"ERR_INVALID_CIPHER_TYPE")}if(!t)throw n(new Error("missing hash type"),"ERR_MISSING_HASH_TYPE");const u=c.keySize,f=c.ivSize,l=o("key expansion"),h=2*(f+u+20),d=await s.create(t,r);let p=await d.digest(l);const y=[];let g=0;for(;gh&&(t=h-g),y.push(e),g+=t,p=await d.digest(p)}const b=h/2,m=i(y),v=m.slice(0,b),w=m.slice(b,h),E=e=>({iv:e.slice(0,f),cipherKey:e.slice(f,f+u),macKey:e.slice(f+u)});return{k1:E(v),k2:E(w)}}},5345:(e,t,r)=>{"use strict";var n,i,o=r(62100),s=o.Reader,a=o.Writer,c=o.util,u=o.roots["libp2p-crypto-keys"]||(o.roots["libp2p-crypto-keys"]={});u.KeyType=(n={},(i=Object.create(n))[n[0]="RSA"]=0,i[n[1]="Ed25519"]=1,i[n[2]="Secp256k1"]=2,i),u.PublicKey=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.Type=e.int32();break;case 2:n.Data=e.bytes();break;default:e.skipType(7&i)}}if(!n.hasOwnProperty("Type"))throw c.ProtocolError("missing required 'Type'",{instance:n});if(!n.hasOwnProperty("Data"))throw c.ProtocolError("missing required 'Data'",{instance:n});return n},e.fromObject=function(e){if(e instanceof u.PublicKey)return e;var t=new u.PublicKey;switch(e.Type){case"RSA":case 0:t.Type=0;break;case"Ed25519":case 1:t.Type=1;break;case"Secp256k1":case 2:t.Type=2}return null!=e.Data&&("string"==typeof e.Data?c.base64.decode(e.Data,t.Data=c.newBuffer(c.base64.length(e.Data)),0):e.Data.length&&(t.Data=e.Data)),t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(r.Type=t.enums===String?"RSA":0,t.bytes===String?r.Data="":(r.Data=[],t.bytes!==Array&&(r.Data=c.newBuffer(r.Data)))),null!=e.Type&&e.hasOwnProperty("Type")&&(r.Type=t.enums===String?u.KeyType[e.Type]:e.Type),null!=e.Data&&e.hasOwnProperty("Data")&&(r.Data=t.bytes===String?c.base64.encode(e.Data,0,e.Data.length):t.bytes===Array?Array.prototype.slice.call(e.Data):e.Data),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),u.PrivateKey=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.Type=e.int32();break;case 2:n.Data=e.bytes();break;default:e.skipType(7&i)}}if(!n.hasOwnProperty("Type"))throw c.ProtocolError("missing required 'Type'",{instance:n});if(!n.hasOwnProperty("Data"))throw c.ProtocolError("missing required 'Data'",{instance:n});return n},e.fromObject=function(e){if(e instanceof u.PrivateKey)return e;var t=new u.PrivateKey;switch(e.Type){case"RSA":case 0:t.Type=0;break;case"Ed25519":case 1:t.Type=1;break;case"Secp256k1":case 2:t.Type=2}return null!=e.Data&&("string"==typeof e.Data?c.base64.decode(e.Data,t.Data=c.newBuffer(c.base64.length(e.Data)),0):e.Data.length&&(t.Data=e.Data)),t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(r.Type=t.enums===String?"RSA":0,t.bytes===String?r.Data="":(r.Data=[],t.bytes!==Array&&(r.Data=c.newBuffer(r.Data)))),null!=e.Type&&e.hasOwnProperty("Type")&&(r.Type=t.enums===String?u.KeyType[e.Type]:e.Type),null!=e.Data&&e.hasOwnProperty("Data")&&(r.Data=t.bytes===String?c.base64.encode(e.Data,0,e.Data.length):t.bytes===Array?Array.prototype.slice.call(e.Data):e.Data),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},e}(),e.exports=u},41860:(e,t,r)=>{"use strict";const n=r(87518),i=r(53890),{toString:o}=r(92263),{fromString:s}=r(52217);function a(e){return Promise.all([n.get().subtle.exportKey("jwk",e.privateKey),n.get().subtle.exportKey("jwk",e.publicKey)])}t.utils=r(48707),t.generateKey=async function(e){const t=await n.get().subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"]),r=await a(t);return{privateKey:r[0],publicKey:r[1]}},t.unmarshalPrivateKey=async function(e){const t=[await n.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["sign"]),await(r=e,n.get().subtle.importKey("jwk",{kty:r.kty,n:r.n,e:r.e},{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!0,["verify"]))];var r;const i=await a({privateKey:t[0],publicKey:t[1]});return{privateKey:i[0],publicKey:i[1]}},t.getRandomValues=i,t.hashAndSign=async function(e,t){const r=await n.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["sign"]),i=await n.get().subtle.sign({name:"RSASSA-PKCS1-v1_5"},r,Uint8Array.from(t));return new Uint8Array(i,i.byteOffset,i.byteLength)},t.hashAndVerify=async function(e,t,r){const i=await n.get().subtle.importKey("jwk",e,{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}},!1,["verify"]);return n.get().subtle.verify({name:"RSASSA-PKCS1-v1_5"},i,t,r)};const{jwk2pub:c,jwk2priv:u}=r(75396);function f(e,t,r,n){const i=t?c(e):u(e),a=n(o(Uint8Array.from(r),"ascii"),i);return s(a,"ascii")}t.encrypt=function(e,t){return f(e,!0,t,((e,t)=>t.encrypt(e)))},t.decrypt=function(e,t){return f(e,!1,t,((e,t)=>t.decrypt(e)))}},42162:(e,t,r)=>{"use strict";const{sha256:n}=r(56155),i=r(32114),{equals:o}=r(19588),{toString:s}=r(92263);r(63219),r(80069);const a=r(3832),c=r(41860),u=r(5345),f=r(70427);class l{constructor(e){this._key=e}async verify(e,t){return c.hashAndVerify(this._key,t,e)}marshal(){return c.utils.jwkToPkix(this._key)}get bytes(){return u.PublicKey.encode({Type:u.KeyType.RSA,Data:this.marshal()}).finish()}encrypt(e){return c.encrypt(this._key,e)}equals(e){return o(this.bytes,e.bytes)}async hash(){const{bytes:e}=await n.digest(this.bytes);return e}}class h{constructor(e,t){this._key=e,this._publicKey=t}genSecret(){return c.getRandomValues(16)}async sign(e){return c.hashAndSign(this._key,e)}get public(){if(!this._publicKey)throw i(new Error("public key not provided"),"ERR_PUBKEY_NOT_PROVIDED");return new l(this._publicKey)}decrypt(e){return c.decrypt(this._key,e)}marshal(){return c.utils.jwkToPkcs1(this._key)}get bytes(){return u.PrivateKey.encode({Type:u.KeyType.RSA,Data:this.marshal()}).finish()}equals(e){return o(this.bytes,e.bytes)}async hash(){const{bytes:e}=await n.digest(this.bytes);return e}async id(){const e=await this.public.hash();return s(e,"base58btc")}async export(e,t="pkcs-8"){if("pkcs-8"===t){const t=new a.util.ByteBuffer(this.marshal()),r=a.asn1.fromDer(t),n=a.pki.privateKeyFromAsn1(r),i={algorithm:"aes256",count:1e4,saltSize:16,prfAlgorithm:"sha512"};return a.pki.encryptRsaPrivateKey(n,e,i)}if("libp2p-key"===t)return f.export(this.bytes,e);throw i(new Error(`export format '${t}' is not supported`),"ERR_INVALID_EXPORT_FORMAT")}}e.exports={RsaPublicKey:l,RsaPrivateKey:h,unmarshalRsaPublicKey:function(e){const t=c.utils.pkixToJwk(e);return new l(t)},unmarshalRsaPrivateKey:async function(e){const t=c.utils.pkcs1ToJwk(e),r=await c.unmarshalPrivateKey(t);return new h(r.privateKey,r.publicKey)},generateKeyPair:async function(e){const t=await c.generateKey(e);return new h(t.privateKey,t.publicKey)},fromJwk:async function(e){const t=await c.unmarshalPrivateKey(e);return new h(t.privateKey,t.publicKey)}}},48707:(e,t,r)=>{"use strict";r(3068),r(28095);const n=r(3832),{bigIntegerToUintBase64url:i,base64urlToBigInteger:o}=r(28894),{fromString:s}=r(52217),{toString:a}=r(92263);t.pkcs1ToJwk=function(e){const t=n.asn1.fromDer(a(e,"ascii")),r=n.pki.privateKeyFromAsn1(t);return{kty:"RSA",n:i(r.n),e:i(r.e),d:i(r.d),p:i(r.p),q:i(r.q),dp:i(r.dP),dq:i(r.dQ),qi:i(r.qInv),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkcs1=function(e){const t=n.pki.privateKeyToAsn1({n:o(e.n),e:o(e.e),d:o(e.d),p:o(e.p),q:o(e.q),dP:o(e.dp),dQ:o(e.dq),qInv:o(e.qi)});return s(n.asn1.toDer(t).getBytes(),"ascii")},t.pkixToJwk=function(e){const t=n.asn1.fromDer(a(e,"ascii")),r=n.pki.publicKeyFromAsn1(t);return{kty:"RSA",n:i(r.n),e:i(r.e),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkix=function(e){const t=n.pki.publicKeyToAsn1({n:o(e.n),e:o(e.e)});return s(n.asn1.toDer(t).getBytes(),"ascii")}},9321:(e,t,r)=>{"use strict";const{sha256:n}=r(56155),i=r(32114),{equals:o}=r(19588),{toString:s}=r(92263),a=r(70427);e.exports=(e,t,c)=>{c=c||r(76835)(t);class u{constructor(e){c.validatePublicKey(e),this._key=e}verify(e,t){return c.hashAndVerify(this._key,t,e)}marshal(){return c.compressPublicKey(this._key)}get bytes(){return e.PublicKey.encode({Type:e.KeyType.Secp256k1,Data:this.marshal()}).finish()}equals(e){return o(this.bytes,e.bytes)}async hash(){const{bytes:e}=await n.digest(this.bytes);return e}}class f{constructor(e,t){this._key=e,this._publicKey=t||c.computePublicKey(e),c.validatePrivateKey(this._key),c.validatePublicKey(this._publicKey)}sign(e){return c.hashAndSign(this._key,e)}get public(){return new u(this._publicKey)}marshal(){return this._key}get bytes(){return e.PrivateKey.encode({Type:e.KeyType.Secp256k1,Data:this.marshal()}).finish()}equals(e){return o(this.bytes,e.bytes)}async hash(){const{bytes:e}=await n.digest(this.bytes);return e}async id(){const e=await this.public.hash();return s(e,"base58btc")}async export(e,t="libp2p-key"){if("libp2p-key"===t)return a.export(this.bytes,e);throw i(new Error(`export format '${t}' is not supported`),"ERR_INVALID_EXPORT_FORMAT")}}return{Secp256k1PublicKey:u,Secp256k1PrivateKey:f,unmarshalSecp256k1PrivateKey:function(e){return new f(e)},unmarshalSecp256k1PublicKey:function(e){return new u(e)},generateKeyPair:async function(){const e=await c.generateKey();return new f(e)}}}},76835:(e,t,r)=>{"use strict";const n=r(17221),{sha256:i}=r(56155);e.exports=e=>{function t(e){if(!n.privateKeyVerify(e))throw new Error("Invalid private key")}return{generateKey:function(){let t;do{t=e(32)}while(!n.privateKeyVerify(t));return t},privateKeyLength:32,hashAndSign:async function(e,t){const{digest:r}=await i.digest(t),o=n.ecdsaSign(r,e);return n.signatureExport(o.signature)},hashAndVerify:async function(e,t,r){const{digest:o}=await i.digest(r);return t=n.signatureImport(t),n.ecdsaVerify(t,o,e)},compressPublicKey:function(e){if(!n.publicKeyVerify(e))throw new Error("Invalid public key");return n.publicKeyConvert(e,!0)},decompressPublicKey:function(e){return n.publicKeyConvert(e,!1)},validatePrivateKey:t,validatePublicKey:function(e){if(!n.publicKeyVerify(e))throw new Error("Invalid public key")},computePublicKey:function(e){return t(e),n.publicKeyCreate(e)}}}},50439:(e,t,r)=>{"use strict";const n=r(32114);e.exports=function(e,t){if(!e.includes(t)){const r=e.join(" / ");throw n(new Error(`Unknown curve: ${t}. Must be ${r}`),"ERR_INVALID_CURVE")}}},57493:(e,t,r)=>{"use strict";const n=r(98960),i=r(97116),o=r(32114),s={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};e.exports=function(e,t,r,a,c){const u=s[c];if(!u){const e=Object.keys(s).join(" / ");throw o(new Error(`Hash '${c}' is unknown or not supported. Must be ${e}`),"ERR_UNSUPPORTED_HASH_TYPE")}const f=n(e,t,r,a,u);return i.encode64(f)}},53890:(e,t,r)=>{"use strict";const n=r(1914),i=r(32114);e.exports=function(e){if(isNaN(e)||e<=0)throw i(new Error("random bytes length must be a Number bigger than 0"),"ERR_INVALID_LENGTH");return n(e)}},28894:(e,t,r)=>{"use strict";r(97116),r(15764);const n=r(3832),{fromString:i}=r(52217),{toString:o}=r(92263),{concat:s}=r(20605);t.bigIntegerToUintBase64url=(e,t)=>{let r=Uint8Array.from(e.abs().toByteArray());if(r=0===r[0]?r.slice(1):r,null!=t){if(r.length>t)throw new Error("byte array longer than desired length");r=s([new Uint8Array(t-r.length),r])}return o(r,"base64url")},t.base64urlToBigInteger=e=>{const r=t.base64urlToBuffer(e);return new n.jsbn.BigInteger(o(r,"base16"),16)},t.base64urlToBuffer=(e,t)=>{let r=i(e,"base64urlpad");if(null!=t){if(r.length>t)throw new Error("byte array longer than desired length");r=s([new Uint8Array(t-r.length),r])}return r}},87518:(e,t)=>{"use strict";t.get=(e=self)=>{const t=e.crypto||e.msCrypto;if(!t||!t.subtle)throw Object.assign(new Error("Missing Web Crypto API. The most likely cause of this error is that this page is being accessed from an insecure context (i.e. not HTTPS). For more information and possible resolutions see https://github.com/libp2p/js-libp2p-crypto/blob/master/README.md#web-crypto-api"),{code:"ERR_MISSING_WEB_CRYPTO"});return t}},54808:e=>{e.exports=function e(t,r){var n,i=0,o=0,s=r=r||0,a=t.length;do{if(s>=a||o>49)throw e.bytes=0,new RangeError("Could not decode varint");n=t[s++],i+=o<28?(127&n)<=128);return e.bytes=s-r,i}},17471:e=>{e.exports=function e(r,n,i){if(Number.MAX_SAFE_INTEGER&&r>Number.MAX_SAFE_INTEGER)throw e.bytes=0,new RangeError("Could not encode varint");n=n||[];for(var o=i=i||0;r>=t;)n[i++]=255&r|128,r/=128;for(;-128&r;)n[i++]=255&r|128,r>>>=7;return n[i]=0|r,e.bytes=i-o+1,n};var t=Math.pow(2,31)},31997:(e,t,r)=>{e.exports={encode:r(17471),decode:r(54808),encodingLength:r(21941)}},21941:e=>{var t=Math.pow(2,7),r=Math.pow(2,14),n=Math.pow(2,21),i=Math.pow(2,28),o=Math.pow(2,35),s=Math.pow(2,42),a=Math.pow(2,49),c=Math.pow(2,56),u=Math.pow(2,63);e.exports=function(e){return e{"use strict";const{EventEmitter:n}=r(17187),{Multiaddr:i}=r(46584),o=r(88785);e.exports=class extends n{constructor(e,{listen:t=[],announce:r=[]}={}){super(),this.peerId=e,this.listen=new Set(t.map((e=>e.toString()))),this.announce=new Set(r.map((e=>e.toString()))),this.observed=new Set}getListenAddrs(){return Array.from(this.listen).map((e=>new i(e)))}getAnnounceAddrs(){return Array.from(this.announce).map((e=>new i(e)))}getObservedAddrs(){return Array.from(this.observed).map((e=>new i(e)))}addObservedAddr(e){let t=new i(e);const r=t.getPeerId();r&&o.createFromB58String(r).equals(this.peerId)&&(t=t.decapsulate(new i(`/p2p/${this.peerId}`)));const n=t.toString();this.observed.has(n)||(this.observed.add(n),this.emit("change:addresses"))}}},58126:(e,t,r)=>{"use strict";const n=r(11227),i=Object.assign(n("libp2p:auto-relay"),{error:n("libp2p:auto-relay:err")}),{fromString:o}=r(52217),{toString:s}=r(92263),{Multiaddr:a}=r(46584),c=r(88785),{relay:u}=r(49284),{canHop:f}=r(71466),{namespaceToCid:l}=r(32497),{CIRCUIT_PROTO_CODE:h,HOP_METADATA_KEY:d,HOP_METADATA_VALUE:p,RELAY_RENDEZVOUS_NS:y}=r(33053);e.exports=class{constructor({libp2p:e,maxListeners:t=1,onError:r}){this._libp2p=e,this._peerId=e.peerId,this._peerStore=e.peerStore,this._connectionManager=e.connectionManager,this._transportManager=e.transportManager,this._addressSorter=e.dialer.addressSorter,this.maxListeners=t,this._listenRelays=new Set,this._onProtocolChange=this._onProtocolChange.bind(this),this._onPeerDisconnected=this._onPeerDisconnected.bind(this),this._peerStore.on("change:protocols",this._onProtocolChange),this._connectionManager.on("peer:disconnect",this._onPeerDisconnected),this._onError=(e,t)=>{i.error(t||e),r&&r(e,t)}}async _onProtocolChange({peerId:e,protocols:t}){const r=e.toB58String(),n=t.find((e=>e===u));if(n||!this._listenRelays.has(r)){if(n&&!this._listenRelays.has(r))try{const t=this._connectionManager.get(e);if(!t)return;if(t.remoteAddr.protoCodes().includes(h))return void i(`relayed connection to ${r} will not be used to hop on`);await f({connection:t})&&(this._peerStore.metadataBook.set(e,d,o(p)),await this._addListenRelay(t,r))}catch(e){this._onError(e)}}else this._removeListenRelay(r)}_onPeerDisconnected(e){const t=e.remotePeer.toB58String();this._listenRelays.has(t)&&this._removeListenRelay(t)}async _addListenRelay(e,t){if(this._listenRelays.size>=this.maxListeners)return;const r=this._peerStore.addressBook.getMultiaddrsForPeer(e.remotePeer,this._addressSorter);if(!r||!r.length)return;const n=`${r[0].toString()}/p2p-circuit`;this._listenRelays.add(t);try{await this._transportManager.listen([new a(n)])}catch(e){this._onError(e),this._listenRelays.delete(t)}}_removeListenRelay(e){this._listenRelays.delete(e)&&this._listenOnAvailableHopRelays([e])}async _listenOnAvailableHopRelays(e=[]){if(this._listenRelays.size>=this.maxListeners)return;const t=[];for(const[r,n]of this._peerStore.metadataBook.data.entries()){if(this._listenRelays.has(r)||e.includes(r))continue;const i=n.get(d);if(!i||s(i)!==p)continue;const o=c.createFromB58String(r),a=this._connectionManager.get(o);if(a){if(await this._addListenRelay(a,r),this._listenRelays.size>=this.maxListeners)return}else t.push(o)}for(const e of t)if(await this._tryToListenOnRelay(e),this._listenRelays.size>=this.maxListeners)return;try{const e=await l(y);for await(const t of this._libp2p.contentRouting.findProviders(e)){if(!t.multiaddrs.length)continue;const e=t.id;if(this._peerStore.addressBook.add(e,t.multiaddrs),await this._tryToListenOnRelay(e),this._listenRelays.size>=this.maxListeners)return}}catch(e){this._onError(e)}}async _tryToListenOnRelay(e){try{const t=await this._libp2p.dial(e);await this._addListenRelay(t,e.toB58String())}catch(t){this._onError(t,`could not connect and listen on known hop relay ${e.toB58String()}`)}}}},71466:(e,t,r)=>{"use strict";const n=r(11227),i=Object.assign(n("libp2p:circuit:hop"),{error:n("libp2p:circuit:hop:err")}),o=r(32114),s=r(88785),{validateAddrs:a}=r(44780),c=r(72866),{CircuitRelay:u}=r(79123),{pipe:f}=r(60618),{codes:l}=r(23416),{stop:h}=r(10655),d=r(49284);e.exports={handleHop:async function({connection:e,request:t,streamHandler:r,circuit:n}){if(!n._options.hop.enabled)return i("HOP request received but we are not acting as a relay"),r.end({type:u.Type.STATUS,code:u.Status.HOP_CANT_SPEAK_RELAY});try{a(t,r)}catch(t){return i.error("invalid hop request via peer %s",e.remotePeer.toB58String(),t)}if(!t.dstPeer)return void i("HOP request received but we do not receive a dstPeer");const o=new s(t.dstPeer.id),c=n._connectionManager.get(o);if(!c&&!n._options.hop.active)return i("HOP request received but we are not connected to the destination peer"),r.end({type:u.Type.STATUS,code:u.Status.HOP_NO_CONN_TO_DST});if(!c)return;const l={type:u.Type.STOP,dstPeer:t.dstPeer,srcPeer:t.srcPeer};let d;try{d=await h({connection:c,request:l})}catch(e){return i.error(e)}i("hop request from %s is valid",e.remotePeer.toB58String()),r.write({type:u.Type.STATUS,code:u.Status.SUCCESS});const p=r.rest();return f(p,d,p)},hop:async function({connection:e,request:t}){const{stream:r}=await e.newStream([d.relay]),n=new c({stream:r});n.write(t);const s=await n.read();if(!s)throw o(new Error("HOP request had no response"),l.ERR_HOP_REQUEST_FAILED);if(s.code===u.Status.SUCCESS)return i("hop request was successful"),n.rest();throw i("hop request failed with code %d, closing stream",s.code),n.close(),o(new Error(`HOP request failed with code ${s.code}`),l.ERR_HOP_REQUEST_FAILED)},canHop:async function({connection:e}){const{stream:t}=await e.newStream([d.relay]),r=new c({stream:t});r.write({type:u.Type.CAN_HOP});const n=await r.read();return await r.close(),!(!n||n.code!==u.Status.SUCCESS)},handleCanHop:function({connection:e,streamHandler:t,circuit:r}){const n=r._options.hop.enabled;i("can hop (%s) request from %s",n,e.remotePeer.toB58String()),t.end({type:u.Type.STATUS,code:n?u.Status.SUCCESS:u.Status.HOP_CANT_SPEAK_RELAY})}}},10655:(e,t,r)=>{"use strict";const n=r(11227),i=Object.assign(n("libp2p:circuit:stop"),{error:n("libp2p:circuit:stop:err")}),{CircuitRelay:o}=r(79123),s=r(49284),a=r(72866),{validateAddrs:c}=r(44780);e.exports.handleStop=function({connection:e,request:t,streamHandler:r}){try{c(t,r)}catch(t){return i.error("invalid stop request via peer %s",e.remotePeer.toB58String(),t)}return i("stop request is valid"),r.write({type:o.Type.STATUS,code:o.Status.SUCCESS}),r.rest()},e.exports.stop=async function({connection:e,request:t}){const{stream:r}=await e.newStream([s.relay]);i("starting stop request to %s",e.remotePeer.toB58String());const n=new a({stream:r});n.write(t);const c=await n.read();return c?c.code===o.Status.SUCCESS?(i("stop request to %s was successful",e.remotePeer.toB58String()),n.rest()):(i("stop request failed with code %d",c.code),void n.close()):n.close()}},72866:(e,t,r)=>{"use strict";const n=r(11227),i=Object.assign(n("libp2p:circuit:stream-handler"),{error:n("libp2p:circuit:stream-handler:err")}),o=r(63500),s=r(52261),{CircuitRelay:a}=r(79123);e.exports=class{constructor({stream:e,maxLength:t=4096}){this.stream=e,this.shake=s(this.stream),this.decoder=o.decode.fromReader(this.shake.reader,{maxDataLength:t})}async read(){const e=await this.decoder.next();if(e.value){const t=a.decode(e.value.slice());return i("read message type",t.type),t}i("read received no value, closing stream"),this.close()}write(e){i("write message type %s",e.type),this.shake.write(o.encode.single(a.encode(e).finish()))}rest(){return this.shake.rest(),this.shake.stream}end(e){this.write(e),this.close()}close(){i("closing the stream"),this.rest().sink([])}}},44780:(e,t,r)=>{"use strict";const{Multiaddr:n}=r(46584),{CircuitRelay:i}=r(79123);function o(e,t){e.write({type:i.Type.STATUS,code:t})}e.exports={validateAddrs:function(e,t){try{e.dstPeer&&e.dstPeer.addrs&&e.dstPeer.addrs.forEach((e=>new n(e)))}catch(r){throw o(t,e.type===i.Type.HOP?i.Status.HOP_DST_MULTIADDR_INVALID:i.Status.STOP_DST_MULTIADDR_INVALID),r}try{e.srcPeer&&e.srcPeer.addrs&&e.srcPeer.addrs.forEach((e=>new n(e)))}catch(r){throw o(t,e.type===i.Type.HOP?i.Status.HOP_SRC_MULTIADDR_INVALID:i.Status.STOP_SRC_MULTIADDR_INVALID),r}}}},33053:e=>{"use strict";e.exports={ADVERTISE_BOOT_DELAY:9e5,ADVERTISE_TTL:18e5,CIRCUIT_PROTO_CODE:290,HOP_METADATA_KEY:"hop_relay",HOP_METADATA_VALUE:"true",RELAY_RENDEZVOUS_NS:"/libp2p/relay"}},2715:(e,t,r)=>{"use strict";const n=r(11227),i=Object.assign(n("libp2p:relay"),{error:n("libp2p:relay:err")}),{setDelayedInterval:o,clearDelayedInterval:s}=r(27695),a=r(58126),{namespaceToCid:c}=r(32497),{RELAY_RENDEZVOUS_NS:u}=r(33053);e.exports=class{constructor(e){this._libp2p=e,this._options={...e._config.relay},this._autoRelay=this._options.autoRelay.enabled&&new a({libp2p:e,...this._options.autoRelay}),this._advertiseService=this._advertiseService.bind(this)}start(){this._options.hop.enabled&&this._options.advertise.enabled&&(this._timeout=o(this._advertiseService,this._options.advertise.ttl,this._options.advertise.bootDelay))}stop(){s(this._timeout)}async _advertiseService(){try{const e=await c(u);await this._libp2p.contentRouting.provide(e)}catch(e){"NO_ROUTERS_AVAILABLE"===e.code?(i.error("a content router, such as a DHT, must be provided in order to advertise the relay service",e),this.stop()):i.error(e)}}}},64538:(e,t,r)=>{"use strict";const{EventEmitter:n}=r(17187),{Multiaddr:i}=r(46584);e.exports=e=>{const t=new Map,r=Object.assign(new n,{close:()=>Promise.resolve(),listen:async function(n){const o=String(n).split("/p2p-circuit").find((e=>""!==e)),s=await e.dial(new i(o)),a=s.remoteAddr.encapsulate("/p2p-circuit");t.set(s.remotePeer.toB58String(),a),r.emit("listening")},getAddrs:function(){const e=[];for(const r of t.values())e.push(r);return e}});return e.connectionManager.on("peer:disconnect",(e=>{t.delete(e.remotePeer.toB58String())&&r.emit("close")})),r}},49284:e=>{"use strict";e.exports={relay:"/libp2p/circuit/relay/0.1.0"}},79123:(e,t,r)=>{"use strict";var n=r(62100),i=n.Reader,o=n.Writer,s=n.util,a=n.roots["libp2p-circuit"]||(n.roots["libp2p-circuit"]={});a.CircuitRelay=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.type=e.int32();break;case 2:n.srcPeer=a.CircuitRelay.Peer.decode(e,e.uint32());break;case 3:n.dstPeer=a.CircuitRelay.Peer.decode(e,e.uint32());break;case 4:n.code=e.int32();break;default:e.skipType(7&o)}}return n},e.fromObject=function(e){if(e instanceof a.CircuitRelay)return e;var t=new a.CircuitRelay;switch(e.type){case"HOP":case 1:t.type=1;break;case"STOP":case 2:t.type=2;break;case"STATUS":case 3:t.type=3;break;case"CAN_HOP":case 4:t.type=4}if(null!=e.srcPeer){if("object"!=typeof e.srcPeer)throw TypeError(".CircuitRelay.srcPeer: object expected");t.srcPeer=a.CircuitRelay.Peer.fromObject(e.srcPeer)}if(null!=e.dstPeer){if("object"!=typeof e.dstPeer)throw TypeError(".CircuitRelay.dstPeer: object expected");t.dstPeer=a.CircuitRelay.Peer.fromObject(e.dstPeer)}switch(e.code){case"SUCCESS":case 100:t.code=100;break;case"HOP_SRC_ADDR_TOO_LONG":case 220:t.code=220;break;case"HOP_DST_ADDR_TOO_LONG":case 221:t.code=221;break;case"HOP_SRC_MULTIADDR_INVALID":case 250:t.code=250;break;case"HOP_DST_MULTIADDR_INVALID":case 251:t.code=251;break;case"HOP_NO_CONN_TO_DST":case 260:t.code=260;break;case"HOP_CANT_DIAL_DST":case 261:t.code=261;break;case"HOP_CANT_OPEN_DST_STREAM":case 262:t.code=262;break;case"HOP_CANT_SPEAK_RELAY":case 270:t.code=270;break;case"HOP_CANT_RELAY_TO_SELF":case 280:t.code=280;break;case"STOP_SRC_ADDR_TOO_LONG":case 320:t.code=320;break;case"STOP_DST_ADDR_TOO_LONG":case 321:t.code=321;break;case"STOP_SRC_MULTIADDR_INVALID":case 350:t.code=350;break;case"STOP_DST_MULTIADDR_INVALID":case 351:t.code=351;break;case"STOP_RELAY_REFUSED":case 390:t.code=390;break;case"MALFORMED_MESSAGE":case 400:t.code=400}return t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(r.type=t.enums===String?"HOP":1,r.srcPeer=null,r.dstPeer=null,r.code=t.enums===String?"SUCCESS":100),null!=e.type&&e.hasOwnProperty("type")&&(r.type=t.enums===String?a.CircuitRelay.Type[e.type]:e.type),null!=e.srcPeer&&e.hasOwnProperty("srcPeer")&&(r.srcPeer=a.CircuitRelay.Peer.toObject(e.srcPeer,t)),null!=e.dstPeer&&e.hasOwnProperty("dstPeer")&&(r.dstPeer=a.CircuitRelay.Peer.toObject(e.dstPeer,t)),null!=e.code&&e.hasOwnProperty("code")&&(r.code=t.enums===String?a.CircuitRelay.Status[e.code]:e.code),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,n.util.toJSONOptions)},e.Status=(t={},(r=Object.create(t))[t[100]="SUCCESS"]=100,r[t[220]="HOP_SRC_ADDR_TOO_LONG"]=220,r[t[221]="HOP_DST_ADDR_TOO_LONG"]=221,r[t[250]="HOP_SRC_MULTIADDR_INVALID"]=250,r[t[251]="HOP_DST_MULTIADDR_INVALID"]=251,r[t[260]="HOP_NO_CONN_TO_DST"]=260,r[t[261]="HOP_CANT_DIAL_DST"]=261,r[t[262]="HOP_CANT_OPEN_DST_STREAM"]=262,r[t[270]="HOP_CANT_SPEAK_RELAY"]=270,r[t[280]="HOP_CANT_RELAY_TO_SELF"]=280,r[t[320]="STOP_SRC_ADDR_TOO_LONG"]=320,r[t[321]="STOP_DST_ADDR_TOO_LONG"]=321,r[t[350]="STOP_SRC_MULTIADDR_INVALID"]=350,r[t[351]="STOP_DST_MULTIADDR_INVALID"]=351,r[t[390]="STOP_RELAY_REFUSED"]=390,r[t[400]="MALFORMED_MESSAGE"]=400,r),e.Type=function(){var e={},t=Object.create(e);return t[e[1]="HOP"]=1,t[e[2]="STOP"]=2,t[e[3]="STATUS"]=3,t[e[4]="CAN_HOP"]=4,t}(),e.Peer=function(){function e(e){if(this.addrs=[],e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.id=e.bytes();break;case 2:n.addrs&&n.addrs.length||(n.addrs=[]),n.addrs.push(e.bytes());break;default:e.skipType(7&o)}}if(!n.hasOwnProperty("id"))throw s.ProtocolError("missing required 'id'",{instance:n});return n},e.fromObject=function(e){if(e instanceof a.CircuitRelay.Peer)return e;var t=new a.CircuitRelay.Peer;if(null!=e.id&&("string"==typeof e.id?s.base64.decode(e.id,t.id=s.newBuffer(s.base64.length(e.id)),0):e.id.length&&(t.id=e.id)),e.addrs){if(!Array.isArray(e.addrs))throw TypeError(".CircuitRelay.Peer.addrs: array expected");t.addrs=[];for(var r=0;r{"use strict";const n=r(11227),i=Object.assign(n("libp2p:circuit"),{error:n("libp2p:circuit:err")}),o=r(32114),s=r(29175),{Multiaddr:a}=r(46584),c=r(88785),{CircuitRelay:u}=r(79123),{codes:f}=r(23416),l=r(15091),{relay:h}=r(49284),d=r(64538),{handleCanHop:p,handleHop:y,hop:g}=r(71466),{handleStop:b}=r(10655),m=r(72866),v=Symbol.for("@libp2p/js-libp2p-circuit/circuit");class w{constructor({libp2p:e,upgrader:t}){this._dialer=e.dialer,this._registrar=e.registrar,this._connectionManager=e.connectionManager,this._upgrader=t,this._options=e._config.relay,this._libp2p=e,this.peerId=e.peerId,this._registrar.handle(h,this._onProtocol.bind(this))}async _onProtocol({connection:e,stream:t}){const r=new m({stream:t}),n=await r.read();if(!n)return;const o=this;let s;switch(n.type){case u.Type.CAN_HOP:i("received CAN_HOP request from %s",e.remotePeer.toB58String()),await p({circuit:o,connection:e,streamHandler:r});break;case u.Type.HOP:i("received HOP request from %s",e.remotePeer.toB58String()),s=await y({connection:e,request:n,streamHandler:r,circuit:o});break;case u.Type.STOP:i("received STOP request from %s",e.remotePeer.toB58String()),s=await b({connection:e,request:n,streamHandler:r});break;default:i("Request of type %s not supported",n.type)}if(s){const e=new a(n.dstPeer.addrs[0]),t=new a(n.srcPeer.addrs[0]),r=l({stream:s,remoteAddr:e,localAddr:t}),o=n.type===u.Type.HOP?"relay":"inbound";i("new %s connection %s",o,r.remoteAddr);const c=await this._upgrader.upgradeInbound(r);i("%s connection %s upgraded",o,r.remoteAddr),this.handler&&this.handler(c)}}async dial(e,t){const r=e.toString().split("/p2p-circuit"),n=new a(r[0]),s=new a(r[r.length-1]),h=n.getPeerId(),d=s.getPeerId();if(!h||!d){const e="Circuit relay dial failed as addresses did not have peer id";throw i.error(e),o(new Error(e),f.ERR_RELAYED_DIAL)}const p=c.createFromB58String(h),y=c.createFromB58String(d);let b=!1,m=this._connectionManager.get(p);m||(m=await this._dialer.connectToPeer(n,t),b=!0);try{const t=await g({connection:m,request:{type:u.Type.HOP,srcPeer:{id:this.peerId.toBytes(),addrs:this._libp2p.multiaddrs.map((e=>e.bytes))},dstPeer:{id:y.toBytes(),addrs:[new a(s).bytes]}}}),r=n.encapsulate(`/p2p-circuit/p2p/${this.peerId.toB58String()}`),o=l({stream:t,remoteAddr:e,localAddr:r});return i("new outbound connection %s",o.remoteAddr),this._upgrader.upgradeOutbound(o)}catch(e){throw i.error("Circuit relay dial failed",e),b&&await m.close(),e}}createListener(e,t){return"function"==typeof e&&(t=e,e={}),this.handler=t,d(this._libp2p)}filter(e){return(e=Array.isArray(e)?e:[e]).filter((e=>s.Circuit.matches(e)))}get[Symbol.toStringTag](){return"Circuit"}static isTransport(e){return Boolean(e&&e[v])}}e.exports=w},32497:(e,t,r)=>{"use strict";const{CID:n}=r(81362),{sha256:i}=r(56155);e.exports.namespaceToCid=async e=>{const t=(new TextEncoder).encode(e),r=await i.digest(t);return n.createV0(r)}},36195:(e,t,r)=>{"use strict";const n=r(70942),{dnsaddrResolver:i}=r(39004),o=r(3524),{AGENT_VERSION:s}=r(78508),a=r(33053),{publicAddressesFirst:c}=r(53737),{FaultTolerance:u}=r(6984),f={addresses:{listen:[],announce:[],noAnnounce:[],announceFilter:e=>e},connectionManager:{minConnections:25},transportManager:{faultTolerance:u.FATAL_ALL},dialer:{maxParallelDials:o.MAX_PARALLEL_DIALS,maxDialsPerPeer:o.MAX_PER_PEER_DIALS,dialTimeout:o.DIAL_TIMEOUT,resolvers:{dnsaddr:i},addressSorter:c},host:{agentVersion:s},metrics:{enabled:!1},peerStore:{persistence:!1,threshold:5},peerRouting:{refreshManager:{enabled:!0,interval:6e5,bootDelay:1e4}},config:{protocolPrefix:"ipfs",dht:{enabled:!1,kBucketSize:20,randomWalk:{enabled:!1,queriesPerPeriod:1,interval:3e5,timeout:1e4}},nat:{enabled:!0,ttl:7200,keepAlive:!0,gateway:null,externalIp:null,pmp:{enabled:!1}},peerDiscovery:{autoDial:!0},pubsub:{enabled:!0},relay:{enabled:!0,advertise:{bootDelay:a.ADVERTISE_BOOT_DELAY,enabled:!1,ttl:a.ADVERTISE_TTL},hop:{enabled:!1,active:!1},autoRelay:{enabled:!1,maxListeners:2}},transport:{}}};e.exports.validate=e=>{const t=n(f,e);if(t.modules.transport.length<1)throw new Error("'options.modules.transport' must contain at least 1 transport");return t}},7376:(e,t,r)=>{"use strict";const n=r(11227),i=Object.assign(n("libp2p:connection-manager"),{error:n("libp2p:connection-manager:err")}),o=r(32114),s=r(70942),a=r(84593),c=r(82916),{EventEmitter:u}=r(17187),f=r(88785),{codes:{ERR_INVALID_PARAMETERS:l}}=r(23416),h={maxConnections:1/0,minConnections:0,maxData:1/0,maxSentData:1/0,maxReceivedData:1/0,maxEventLoopDelay:1/0,pollInterval:2e3,autoDialInterval:1e4,movingAverageInterval:6e4,defaultPeerValue:1};e.exports=class extends u{constructor(e,t={}){if(super(),this._libp2p=e,this._peerId=e.peerId.toB58String(),this._options=s.call({ignoreUndefined:!0},h,t),this._options.maxConnectionse+t.length),0)}start(){this._libp2p.metrics&&(this._timer=this._timer||c(this._checkMetrics,this._options.pollInterval)),this._latencyMonitor.start(),this._onLatencyMeasure=this._onLatencyMeasure.bind(this),this._latencyMonitor.on("data",this._onLatencyMeasure),this._started=!0,i("started"),this._options.autoDial&&this._autoDial()}async stop(){this._autoDialTimeout&&this._autoDialTimeout.clear(),this._timer&&this._timer.clear(),this._latencyMonitor.removeListener("data",this._onLatencyMeasure),this._latencyMonitor.stop(),this._started=!1,await this._close(),i("stopped")}async _close(){const e=[];for(const t of this.connections.values())for(const r of t)e.push(r.close());await Promise.all(e),this.connections.clear()}setPeerValue(e,t){if(t<0||t>1)throw new Error("value should be a number between 0 and 1");this._peerValues.set(e.toB58String(),t)}_checkMetrics(){if(this._libp2p.metrics){const e=this._libp2p.metrics.global.movingAverages,t=e.dataReceived[this._options.movingAverageInterval].movingAverage();this._checkMaxLimit("maxReceivedData",t);const r=e.dataSent[this._options.movingAverageInterval].movingAverage();this._checkMaxLimit("maxSentData",r);const n=t+r;this._checkMaxLimit("maxData",n),i("metrics update",n),this._timer=c(this._checkMetrics,this._options.pollInterval)}}onConnect(e){const t=e.remotePeer,r=t.toB58String(),n=this.connections.get(r);this.emit("peer:connect",e),n?n.push(e):this.connections.set(r,[e]),this._libp2p.peerStore.keyBook.set(t,t.pubKey),this._peerValues.has(r)||this._peerValues.set(r,this._options.defaultPeerValue),this._checkMaxLimit("maxConnections",this.size)}onDisconnect(e){const t=e.remotePeer.toB58String();let r=this.connections.get(t);r&&r.length>1?(r=r.filter((t=>t.id!==e.id)),this.connections.set(t,r)):r&&(this.connections.delete(t),this._peerValues.delete(e.remotePeer.toB58String()),this.emit("peer:disconnect",e))}get(e){const t=this.getAll(e);return t.length?t[0]:null}getAll(e){if(!f.isPeerId(e))throw o(new Error("peerId must be an instance of peer-id"),l);const t=e.toB58String(),r=this.connections.get(t);return r?r.filter((e=>"open"===e.stat.status)):[]}_onLatencyMeasure(e){this._checkMaxLimit("maxEventLoopDelay",e.avgMs)}_checkMaxLimit(e,t){const r=this._options[e];i("checking limit of %s. current value: %d of %d",e,t,r),t>r&&(i("%s: limit exceeded: %s, %d",this._peerId,e,t),this._maybeDisconnectOne())}async _autoDial(){const e=this._options.minConnections;if(this.size>=e)return void(this._autoDialTimeout=c(this._autoDial,this._options.autoDialInterval));const t=Array.from(this._libp2p.peerStore.peers.values()).sort(((e,t)=>!t.protocols||!t.protocols.length||e.protocols&&e.protocols.length?t.id.pubKey&&!e.id.pubKey?1:-1:1));for(let r=0;re[1]-t[1]))));i("%s: sorted peer values: %j",this._peerId,e);const t=e[0];if(t){const e=t[0];i("%s: lowest value peer is %s",this._peerId,e),i("%s: closing a connection to %j",this._peerId,e);for(const t of this.connections.values())if(t[0].remotePeer.toB58String()===e){t[0].close();break}}}}}},84593:(e,t,r)=>{"use strict";const{EventEmitter:n}=r(17187),i=r(7527),o=r(11227)("latency-monitor:LatencyMonitor");e.exports=class extends n{constructor({latencyCheckIntervalMs:e,dataEmitIntervalMs:t,asyncTestFn:r,latencyRandomPercentage:n}={}){super();const i=this;i.latencyCheckIntervalMs=e||500,i.latencyRandomPercentage=n||10,i._latecyCheckMultiply=i.latencyRandomPercentage/100*2*i.latencyCheckIntervalMs,i._latecyCheckSubtract=i._latecyCheckMultiply/2,i.dataEmitIntervalMs=null===t||0===t?void 0:t||5e3,o("latencyCheckIntervalMs: %s dataEmitIntervalMs: %s",i.latencyCheckIntervalMs,i.dataEmitIntervalMs),i.dataEmitIntervalMs?o("Expecting ~%s events per summary",i.latencyCheckIntervalMs/i.dataEmitIntervalMs):o("Not emitting summaries"),i.asyncTestFn=r}start(){globalThis.process&&globalThis.process.hrtime?(o("Using process.hrtime for timing"),this.now=globalThis.process.hrtime,this.getDeltaMS=e=>{const t=this.now(e);return 1e3*t[0]+t[1]/1e6}):"undefined"!=typeof window&&window.performance&&window.performance.now?(o("Using performance.now for timing"),this.now=window.performance.now.bind(window.performance),this.getDeltaMS=e=>Math.round(this.now()-e)):(o("Using Date.now for timing"),this.now=Date.now,this.getDeltaMS=e=>this.now()-e),this._latencyData=this._initLatencyData(),"undefined"!=typeof window&&(this._visibilityChangeEmitter=new i,this._visibilityChangeEmitter.on("visibilityChange",(e=>{e?this._startTimers():(this._emitSummary(),this._stopTimers())}))),this._visibilityChangeEmitter&&!this._visibilityChangeEmitter.isVisible()||this._startTimers()}stop(){this._stopTimers()}_startTimers(){this._checkLatencyID||(this._checkLatency(),this.dataEmitIntervalMs&&(this._emitIntervalID=setInterval((()=>this._emitSummary()),this.dataEmitIntervalMs),"function"==typeof this._emitIntervalID.unref&&this._emitIntervalID.unref()))}_stopTimers(){this._checkLatencyID&&(clearTimeout(this._checkLatencyID),this._checkLatencyID=void 0),this._emitIntervalID&&(clearInterval(this._emitIntervalID),this._emitIntervalID=void 0)}_emitSummary(){const e=this.getSummary();e.events>0&&this.emit("data",e)}getSummary(){const e={events:this._latencyData.events,minMs:this._latencyData.minMs,maxMs:this._latencyData.maxMs,avgMs:this._latencyData.events?this._latencyData.totalMs/this._latencyData.events:Number.POSITIVE_INFINITY,lengthMs:this.getDeltaMS(this._latencyData.startTime)};return this._latencyData=this._initLatencyData(),o("Summary: %O",e),e}_checkLatency(){const e=this,t=Math.random()*e._latecyCheckMultiply-e._latecyCheckSubtract,r={deltaOffset:Math.ceil(e.latencyCheckIntervalMs+t),startTime:e.now()},n=()=>{if(!this._checkLatencyID)return;const t=e.getDeltaMS(r.startTime)-r.deltaOffset;e._checkLatency(),e._latencyData.events++,e._latencyData.minMs=Math.min(e._latencyData.minMs,t),e._latencyData.maxMs=Math.max(e._latencyData.maxMs,t),e._latencyData.totalMs+=t,o("MS: %s Data: %O",t,e._latencyData)};o("localData: %O",r),this._checkLatencyID=setTimeout((()=>{e.asyncTestFn?(r.deltaOffset=0,r.startTime=e.now(),e.asyncTestFn(n)):(r.deltaOffset-=1,n())}),r.deltaOffset),"function"==typeof this._checkLatencyID.unref&&this._checkLatencyID.unref()}_initLatencyData(){return{startTime:this.now(),minMs:Number.POSITIVE_INFINITY,maxMs:Number.NEGATIVE_INFINITY,events:0,totalMs:0}}}},7527:(e,t,r)=>{"use strict";const{EventEmitter:n}=r(17187),i=r(11227)("latency-monitor:VisibilityChangeEmitter");e.exports=class extends n{constructor(){super(),"undefined"!=typeof document?(this._initializeVisibilityVarNames(),this._addVisibilityChangeListener()):i('This is not a browser, no "document" found. Stopping.')}_initializeVisibilityVarNames(){let e,t;void 0!==document.hidden?(e="hidden",t="visibilitychange"):void 0!==document.mozHidden?(e="mozHidden",t="mozvisibilitychange"):void 0!==document.msHidden?(e="msHidden",t="msvisibilitychange"):void 0!==document.webkitHidden&&(e="webkitHidden",t="webkitvisibilitychange"),this._hidden=e,this._visibilityChange=t}_addVisibilityChangeListener(){void 0===document.addEventListener||void 0===document[this._hidden]?i("Checking page visibility requires a browser that supports the Page Visibility API."):document.addEventListener(this._visibilityChange,this._handleVisibilityChange.bind(this),!1)}isVisible(){if(void 0!==this._hidden&&void 0!==document[this._hidden])return!document[this._hidden]}_handleVisibilityChange(){const e=!document[this._hidden];i(e?"Page Visible":"Page Hidden"),this.emit("visibilityChange",e)}}},3524:e=>{"use strict";e.exports={DIAL_TIMEOUT:3e4,MAX_PARALLEL_DIALS:100,MAX_PER_PEER_DIALS:4,MAX_ADDRS_TO_DIAL:25,METRICS:{computeThrottleMaxQueueSize:1e3,computeThrottleTimeout:2e3,movingAverageIntervals:[6e4,3e5,9e5],maxOldPeersRetention:50}}},57197:(e,t,r)=>{"use strict";const n=r(32114),{messages:i,codes:o}=r(23416),{storeAddresses:s,uniquePeers:a,requirePeers:c,maybeLimitSource:u}=r(63952),f=r(74014),{pipe:l}=r(60618);e.exports=class{constructor(e){this.libp2p=e,this.routers=e._modules.contentRouting||[],this.dht=e._dht,this.dht&&e._config.dht.enabled&&this.routers.push(this.dht)}async*findProviders(e,t={}){if(!this.routers.length)throw n(new Error("No content this.routers available"),"NO_ROUTERS_AVAILABLE");yield*l(f(...this.routers.map((r=>r.findProviders(e,t)))),(e=>s(e,this.libp2p.peerStore)),(e=>a(e)),(e=>u(e,t.maxNumProviders)),(e=>c(e)))}async provide(e){if(!this.routers.length)throw n(new Error("No content routers available"),"NO_ROUTERS_AVAILABLE");await Promise.all(this.routers.map((t=>t.provide(e))))}put(e,t,r){if(!this.libp2p.isStarted()||!this.dht.isStarted)throw n(new Error(i.NOT_STARTED_YET),o.DHT_NOT_STARTED);return this.dht.put(e,t,r)}get(e,t){if(!this.libp2p.isStarted()||!this.dht.isStarted)throw n(new Error(i.NOT_STARTED_YET),o.DHT_NOT_STARTED);return this.dht.get(e,t)}async getMany(e,t,r){if(!this.libp2p.isStarted()||!this.dht.isStarted)throw n(new Error(i.NOT_STARTED_YET),o.DHT_NOT_STARTED);return this.dht.getMany(e,t,r)}}},63952:(e,t,r)=>{"use strict";const n=r(32114),i=r(55565),o=r(32121),s=r(37939);e.exports={storeAddresses:function(e,t){return o(e,(e=>(t.addressBook.add(e.id,e.multiaddrs),e)))},uniquePeers:function(e){const t=new Set;return i(e,(e=>!t.has(e.id.toString())&&(t.add(e.id.toString()),!0)))},requirePeers:async function*(e,t=1){let r=0;for await(const t of e)r++,yield t;if(r{"use strict";const n=r(32114),i=r(28599).default,{anySignal:o}=r(32044),s=r(35103),a=r(61750);e.exports=class{constructor({addrs:e,dialAction:t,dialer:r}){this.addrs=e,this.dialer=r,this.dialAction=t}async run(e={}){const t=this.dialer.getTokens(this.addrs.length);if(t.length<1)throw n(new Error("No dial tokens available"),"ERR_NO_DIAL_TOKENS");const r=new s;t.forEach((e=>r.push(e)));const c=this.addrs.map((()=>new i));let u=0;try{return await a(this.addrs.map((async(n,i)=>{const s=await r.shift();let a;try{const f=c[i].signal;a=await this.dialAction(n,{...e,signal:e.signal?o([f,e.signal]):f}),c.splice(i,1)}finally{u++,this.addrs.length-u>=t.length?r.push(s):this.dialer.releaseToken(t.splice(t.indexOf(s),1)[0])}return a})))}finally{c.map((e=>e.abort())),t.forEach((e=>this.dialer.releaseToken(e)))}}}},63849:(e,t,r)=>{"use strict";const n=r(11227),i=Object.assign(n("libp2p:dialer"),{error:n("libp2p:dialer:err")}),o=r(32114),{Multiaddr:s}=r(46584),a=r(10715),{AbortError:c}=r(61623),{anySignal:u}=r(32044),f=r(65639),{publicAddressesFirst:l}=r(53737),h=r(43079),{codes:d}=r(23416),{DIAL_TIMEOUT:p,MAX_PARALLEL_DIALS:y,MAX_PER_PEER_DIALS:g,MAX_ADDRS_TO_DIAL:b}=r(3524);e.exports=class{constructor({transportManager:e,peerStore:t,addressSorter:r=l,maxParallelDials:n=y,maxAddrsToDial:i=b,dialTimeout:o=p,maxDialsPerPeer:a=g,resolvers:c={}}){this.transportManager=e,this.peerStore=t,this.addressSorter=r,this.maxParallelDials=n,this.maxAddrsToDial=i,this.timeout=o,this.maxDialsPerPeer=a,this.tokens=[...new Array(n)].map(((e,t)=>t)),this._pendingDials=new Map,this._pendingDialTargets=new Map;for(const[e,t]of Object.entries(c))s.resolvers.set(e,t)}destroy(){for(const e of this._pendingDials.values())try{e.controller.abort()}catch(e){i.error(e)}this._pendingDials.clear();for(const e of this._pendingDialTargets.values())e.reject(new c("Dialer was destroyed"));this._pendingDialTargets.clear()}async connectToPeer(e,t={}){const r=await this._createCancellableDialTarget(e);if(!r.addrs.length)throw o(new Error("The dial request has no valid addresses"),d.ERR_NO_VALID_ADDRESSES);const n=this._pendingDials.get(r.id)||this._createPendingDial(r,t);try{const e=await n.promise;return i("dial succeeded to %s",r.id),e}catch(e){throw n.controller.signal.aborted&&(e.code=d.ERR_TIMEOUT),i.error(e),e}finally{n.destroy()}}async _createCancellableDialTarget(e){const t=`${parseInt(String(1e9*Math.random()),10).toString()+Date.now()}`,r=new Promise(((e,r)=>{this._pendingDialTargets.set(t,{resolve:e,reject:r})})),n=await Promise.race([this._createDialTarget(e),r]);return this._pendingDialTargets.delete(t),n}async _createDialTarget(e){const{id:t,multiaddrs:r}=h(e);r&&this.peerStore.addressBook.add(t,r);let n=this.peerStore.addressBook.getMultiaddrsForPeer(t,this.addressSorter)||[];s.isMultiaddr(e)&&(n=n.filter((t=>!e.equals(t))),n.unshift(e));const i=[];for(const e of n)(await this._resolve(e)).forEach((e=>i.push(e)));const a=i.filter((e=>this.transportManager.transportForMultiaddr(e)));if(a.length>this.maxAddrsToDial)throw this.peerStore.delete(t),o(new Error("dial with more addresses than allowed"),d.ERR_TOO_MANY_ADDRESSES);return{id:t.toB58String(),addrs:a}}_createPendingDial(e,t={}){const r=new f({addrs:e.addrs,dialAction:(e,t)=>{if(t.signal.aborted)throw o(new Error("already aborted"),d.ERR_ALREADY_ABORTED);return this.transportManager.dial(e,t)},dialer:this}),n=new a(this.timeout),i=[n.signal];t.signal&&i.push(t.signal);const s=u(i),c={dialRequest:r,controller:n,promise:r.run({...t,signal:s}),destroy:()=>{n.clear(),this._pendingDials.delete(e.id)}};return this._pendingDials.set(e.id,c),c}getTokens(e){const t=Math.min(e,this.maxDialsPerPeer,this.tokens.length),r=this.tokens.splice(0,t);return i("%d tokens request, returning %d, %d remaining",e,t,this.tokens.length),r}releaseToken(e){this.tokens.indexOf(e)>-1||(i("token %d released",e),this.tokens.push(e))}async _resolve(e){if(!e.protoNames().includes("dnsaddr"))return[e];const t=await this._resolveRecord(e);return(await Promise.all(t.map((e=>this._resolve(e))))).flat().reduce(((e,t)=>(e.find((e=>e.equals(t)))||e.push(t),e)),[])}async _resolveRecord(e){try{return e=new s(e.toString()),await e.resolve()}catch(t){return i.error(`multiaddr ${e} could not be resolved`),[]}}}},23416:(e,t)=>{"use strict";t.messages={NOT_STARTED_YET:"The libp2p node is not started yet",DHT_DISABLED:"DHT is not available",CONN_ENCRYPTION_REQUIRED:"At least one connection encryption module is required"},t.codes={DHT_DISABLED:"ERR_DHT_DISABLED",PUBSUB_NOT_STARTED:"ERR_PUBSUB_NOT_STARTED",DHT_NOT_STARTED:"ERR_DHT_NOT_STARTED",CONN_ENCRYPTION_REQUIRED:"ERR_CONN_ENCRYPTION_REQUIRED",ERR_INVALID_PROTOCOLS_FOR_STREAM:"ERR_INVALID_PROTOCOLS_FOR_STREAM",ERR_CONNECTION_ENDED:"ERR_CONNECTION_ENDED",ERR_CONNECTION_FAILED:"ERR_CONNECTION_FAILED",ERR_NODE_NOT_STARTED:"ERR_NODE_NOT_STARTED",ERR_ALREADY_ABORTED:"ERR_ALREADY_ABORTED",ERR_TOO_MANY_ADDRESSES:"ERR_TOO_MANY_ADDRESSES",ERR_NO_VALID_ADDRESSES:"ERR_NO_VALID_ADDRESSES",ERR_RELAYED_DIAL:"ERR_RELAYED_DIAL",ERR_DIALED_SELF:"ERR_DIALED_SELF",ERR_DISCOVERED_SELF:"ERR_DISCOVERED_SELF",ERR_DUPLICATE_TRANSPORT:"ERR_DUPLICATE_TRANSPORT",ERR_ENCRYPTION_FAILED:"ERR_ENCRYPTION_FAILED",ERR_HOP_REQUEST_FAILED:"ERR_HOP_REQUEST_FAILED",ERR_INVALID_KEY:"ERR_INVALID_KEY",ERR_INVALID_MESSAGE:"ERR_INVALID_MESSAGE",ERR_INVALID_PARAMETERS:"ERR_INVALID_PARAMETERS",ERR_INVALID_PEER:"ERR_INVALID_PEER",ERR_MUXER_UNAVAILABLE:"ERR_MUXER_UNAVAILABLE",ERR_TIMEOUT:"ERR_TIMEOUT",ERR_TRANSPORT_UNAVAILABLE:"ERR_TRANSPORT_UNAVAILABLE",ERR_TRANSPORT_DIAL_FAILED:"ERR_TRANSPORT_DIAL_FAILED",ERR_UNSUPPORTED_PROTOCOL:"ERR_UNSUPPORTED_PROTOCOL",ERR_INVALID_MULTIADDR:"ERR_INVALID_MULTIADDR",ERR_SIGNATURE_NOT_VALID:"ERR_SIGNATURE_NOT_VALID"}},43079:(e,t,r)=>{"use strict";const n=r(88785),{Multiaddr:i}=r(46584),o=r(32114),{codes:s}=r(23416);e.exports=function(e){let t;if("string"==typeof e&&(e=new i(e)),i.isMultiaddr(e)){t=e;const r=e.getPeerId();if(!r)throw o(new Error(`${e} does not have a valid peer type`),s.ERR_INVALID_MULTIADDR);try{e=n.createFromB58String(r)}catch(t){throw o(new Error(`${e} is not a valid peer type`),s.ERR_INVALID_MULTIADDR)}}return{id:e,multiaddrs:t?[t]:void 0}}},78508:(e,t,r)=>{"use strict";const n=r(28362).version;e.exports.PROTOCOL_VERSION="ipfs/0.1.0",e.exports.AGENT_VERSION=`js-libp2p/${n}`,e.exports.MULTICODEC_IDENTIFY="/ipfs/id/1.0.0",e.exports.MULTICODEC_IDENTIFY_PUSH="/ipfs/id/push/1.0.0",e.exports.IDENTIFY_PROTOCOL_VERSION="0.1.0",e.exports.MULTICODEC_IDENTIFY_PROTOCOL_NAME="id",e.exports.MULTICODEC_IDENTIFY_PUSH_PROTOCOL_NAME="id/push",e.exports.MULTICODEC_IDENTIFY_PROTOCOL_VERSION="1.0.0",e.exports.MULTICODEC_IDENTIFY_PUSH_PROTOCOL_VERSION="1.0.0"},26078:(e,t,r)=>{"use strict";const n=r(11227),i=Object.assign(n("libp2p:identify"),{error:n("libp2p:identify:err")}),o=r(32114),s=r(63500),{pipe:a}=r(60618),{collect:c,take:u,consume:f}=r(38386),{fromString:l}=r(52217),h=r(88785),{Multiaddr:d}=r(46584),{toBuffer:p}=r(96653),y=r(29966),g=r(31244),b=r(61131),{MULTICODEC_IDENTIFY:m,MULTICODEC_IDENTIFY_PUSH:v,IDENTIFY_PROTOCOL_VERSION:w,MULTICODEC_IDENTIFY_PROTOCOL_NAME:E,MULTICODEC_IDENTIFY_PUSH_PROTOCOL_NAME:_,MULTICODEC_IDENTIFY_PROTOCOL_VERSION:S,MULTICODEC_IDENTIFY_PUSH_PROTOCOL_VERSION:A}=r(78508),{codes:T}=r(23416);class I{static getProtocolStr(e){return{identifyProtocolStr:`/${e._config.protocolPrefix}/${E}/${S}`,identifyPushProtocolStr:`/${e._config.protocolPrefix}/${_}/${A}`}}constructor({libp2p:e}){this._libp2p=e,this.peerStore=e.peerStore,this.addressManager=e.addressManager,this.connectionManager=e.connectionManager,this.peerId=e.peerId,this.handleMessage=this.handleMessage.bind(this);const t=I.getProtocolStr(e);this.identifyProtocolStr=t.identifyProtocolStr,this.identifyPushProtocolStr=t.identifyPushProtocolStr,this._host={protocolVersion:`${e._config.protocolPrefix}/${w}`,...e._options.host},this.peerStore.metadataBook.set(this.peerId,"AgentVersion",l(this._host.agentVersion)),this.peerStore.metadataBook.set(this.peerId,"ProtocolVersion",l(this._host.protocolVersion)),this.connectionManager.on("peer:connect",(e=>{this.identify(e).catch(i.error)})),this.peerStore.on("change:multiaddrs",(({peerId:e})=>{e.toString()===this.peerId.toString()&&this.pushToPeerStore()})),this.peerStore.on("change:protocols",(({peerId:e})=>{e.toString()===this.peerId.toString()&&this.pushToPeerStore()}))}async push(e){const t=await this.peerStore.addressBook.getRawEnvelope(this.peerId),r=this._libp2p.multiaddrs.map((e=>e.bytes)),n=this.peerStore.protoBook.get(this.peerId)||[],o=e.map((async e=>{try{const{stream:i}=await e.newStream(this.identifyPushProtocolStr);await a([y.Identify.encode({listenAddrs:r,signedPeerRecord:t,protocols:n}).finish()],s.encode(),i,f)}catch(e){i.error("could not push identify update to peer",e)}}));return Promise.all(o)}pushToPeerStore(){if(!this._libp2p.isStarted())return;const e=[];let t;for(const r of this.peerStore.peers.values())r.protocols.includes(this.identifyPushProtocolStr)&&(t=this.connectionManager.get(r.id))&&e.push(t);this.push(e)}async identify(e){const{stream:t}=await e.newStream(this.identifyProtocolStr),[r]=await a([],t,s.decode(),u(1),p,c);if(!r)throw o(new Error("No data could be retrieved"),T.ERR_CONNECTION_ENDED);let n;try{n=y.Identify.decode(r)}catch(e){throw o(e,T.ERR_INVALID_MESSAGE)}const{publicKey:f,listenAddrs:m,protocols:v,observedAddr:w,signedPeerRecord:E}=n,_=await h.createFromPubKey(f);if(e.remotePeer.toB58String()!==_.toB58String())throw o(new Error("identified peer does not match the expected peer"),T.ERR_INVALID_PEER);const S=I.getCleanMultiaddr(w);try{const e=await g.openAndCertify(E,b.DOMAIN);if(this.peerStore.addressBook.consumePeerRecord(e))return this.peerStore.protoBook.set(_,v),this.peerStore.metadataBook.set(_,"AgentVersion",l(n.agentVersion)),void this.peerStore.metadataBook.set(_,"ProtocolVersion",l(n.protocolVersion))}catch(e){i("received invalid envelope, discard it and fallback to listenAddrs is available",e)}try{this.peerStore.addressBook.set(_,m.map((e=>new d(e))))}catch(e){i.error("received invalid addrs",e)}this.peerStore.protoBook.set(_,v),this.peerStore.metadataBook.set(_,"AgentVersion",l(n.agentVersion)),this.peerStore.metadataBook.set(_,"ProtocolVersion",l(n.protocolVersion)),i("received observed address of %s",S)}handleMessage({connection:e,stream:t,protocol:r}){switch(r){case this.identifyProtocolStr:return this._handleIdentify({connection:e,stream:t});case this.identifyPushProtocolStr:return this._handlePush({connection:e,stream:t});default:i.error("cannot handle unknown protocol %s",r)}}async _handleIdentify({connection:e,stream:t}){let r=new Uint8Array(0);this.peerId.pubKey&&(r=this.peerId.pubKey.bytes);const n=await this.peerStore.addressBook.getRawEnvelope(this.peerId),o=this.peerStore.protoBook.get(this.peerId)||[],c=y.Identify.encode({protocolVersion:this._host.protocolVersion,agentVersion:this._host.agentVersion,publicKey:r,listenAddrs:this._libp2p.multiaddrs.map((e=>e.bytes)),signedPeerRecord:n,observedAddr:e.remoteAddr.bytes,protocols:o}).finish();try{await a([c],s.encode(),t,f)}catch(e){i.error("could not respond to identify request",e)}}async _handlePush({connection:e,stream:t}){let r;try{const[e]=await a([],t,s.decode(),u(1),p,c);r=y.Identify.decode(e)}catch(e){return i.error("received invalid message",e)}const n=e.remotePeer;try{const e=await g.openAndCertify(r.signedPeerRecord,b.DOMAIN);if(this.peerStore.addressBook.consumePeerRecord(e))return void this.peerStore.protoBook.set(n,r.protocols)}catch(e){i("received invalid envelope, discard it and fallback to listenAddrs is available",e)}try{this.peerStore.addressBook.set(n,r.listenAddrs.map((e=>new d(e))))}catch(e){i.error("received invalid addrs",e)}this.peerStore.protoBook.set(n,r.protocols)}static getCleanMultiaddr(e){if(e&&e.length>0)try{return new d(e)}catch(e){return null}return null}}const C={IDENTIFY:m,IDENTIFY_PUSH:v};I.multicodecs=C,I.Messsage=y,e.exports=I},29966:(e,t,r)=>{"use strict";var n=r(62100),i=n.Reader,o=n.Writer,s=n.util,a=n.roots["libp2p-identify"]||(n.roots["libp2p-identify"]={});a.Identify=function(){function e(e){if(this.listenAddrs=[],this.protocols=[],e)for(var t=Object.keys(e),r=0;r>>3){case 5:n.protocolVersion=e.string();break;case 6:n.agentVersion=e.string();break;case 1:n.publicKey=e.bytes();break;case 2:n.listenAddrs&&n.listenAddrs.length||(n.listenAddrs=[]),n.listenAddrs.push(e.bytes());break;case 4:n.observedAddr=e.bytes();break;case 3:n.protocols&&n.protocols.length||(n.protocols=[]),n.protocols.push(e.string());break;case 8:n.signedPeerRecord=e.bytes();break;default:e.skipType(7&o)}}return n},e.fromObject=function(e){if(e instanceof a.Identify)return e;var t=new a.Identify;if(null!=e.protocolVersion&&(t.protocolVersion=String(e.protocolVersion)),null!=e.agentVersion&&(t.agentVersion=String(e.agentVersion)),null!=e.publicKey&&("string"==typeof e.publicKey?s.base64.decode(e.publicKey,t.publicKey=s.newBuffer(s.base64.length(e.publicKey)),0):e.publicKey.length&&(t.publicKey=e.publicKey)),e.listenAddrs){if(!Array.isArray(e.listenAddrs))throw TypeError(".Identify.listenAddrs: array expected");t.listenAddrs=[];for(var r=0;r{"use strict";const n=r(11227),i=Object.assign(n("libp2p"),{error:n("libp2p:err")}),{EventEmitter:o}=r(17187),s=r(32114),a=r(88785),{Multiaddr:c}=r(46584),u=r(51203),f=r(57197),l=r(43079),{validate:h}=r(36195),{codes:d,messages:p}=r(23416),y=r(14942),g=r(7376),b=r(91491),m=r(2715),v=r(63849),w=r(40298),E=r(31175),_=r(6984),S=r(21003),A=r(4323),T=r(65993),I=r(78112),C=r(28861),P=r(75466),R=r(26078),k=r(64205),{updateSelfPeerRecord:B}=r(1001);class x extends o{static async create(e){if(e.peerId)return new x(e);const t=await a.create();return e.peerId=t,new x(e)}constructor(e){if(super(),this._options=h(e),this.peerId=this._options.peerId,this.datastore=this._options.datastore,this.peerStore=this.datastore&&this._options.peerStore.persistence?new I({peerId:this.peerId,datastore:this.datastore,...this._options.peerStore}):new A({peerId:this.peerId}),this.addresses=this._options.addresses,this.addressManager=new y(this.peerId,this._options.addresses),this.addressManager.on("change:addresses",(()=>{B(this).catch((e=>{i.error("Error updating self peer record",e)}))})),this._modules=this._options.modules,this._config=this._options.config,this._transport=[],this._discovery=new Map,this.connectionManager=new g(this,{autoDial:this._config.peerDiscovery.autoDial,...this._options.connectionManager}),this._options.metrics.enabled&&(this.metrics=new E({...this._options.metrics,connectionManager:this.connectionManager})),this._options.keychain&&this._options.keychain.datastore){i("creating keychain");const e=w.generateOptions();this.keychain=new w(this._options.keychain.datastore,{...e,...this._options.keychain}),i("keychain constructed")}if(this.upgrader=new S({localPeer:this.peerId,metrics:this.metrics,onConnection:e=>this.connectionManager.onConnect(e),onConnectionEnd:e=>this.connectionManager.onDisconnect(e)}),this.transportManager=new _({libp2p:this,upgrader:this.upgrader,faultTolerance:this._options.transportManager.faultTolerance}),this.natManager=new k({peerId:this.peerId,addressManager:this.addressManager,transportManager:this.transportManager,...this._options.config.nat}),this.registrar=new C({peerStore:this.peerStore,connectionManager:this.connectionManager}),this.handle=this.handle.bind(this),this.registrar.handle=this.handle,!this._modules.connEncryption||!this._modules.connEncryption.length)throw s(new Error(p.CONN_ENCRYPTION_REQUIRED),d.CONN_ENCRYPTION_REQUIRED);if(this._modules.connEncryption.forEach((e=>{this.upgrader.cryptos.set(e.protocol,e)})),this.dialer=new v({transportManager:this.transportManager,peerStore:this.peerStore,...this._options.dialer}),this._modules.transport.forEach((e=>{const t=e.prototype[Symbol.toStringTag],r=this._config.transport[t];this.transportManager.add(t,e,r)})),this._config.relay.enabled&&(this.transportManager.add(b.prototype[Symbol.toStringTag],b),this.relay=new m(this)),this._modules.streamMuxer&&(this._modules.streamMuxer.forEach((e=>{this.upgrader.muxers.set(e.multicodec,e)})),this.identifyService=new R({libp2p:this}),this.handle(Object.values(R.getProtocolStr(this)),this.identifyService.handleMessage)),this._modules.connProtector)this.upgrader.protector=this._modules.connProtector;else if(void 0!==globalThis.process&&globalThis.process.env&&globalThis.process.env.LIBP2P_FORCE_PNET)throw new Error("Private network is enforced, but no protector was provided");if(this._modules.dht){const e=this._modules.dht;this._dht=new e({libp2p:this,dialer:this.dialer,peerId:this.peerId,peerStore:this.peerStore,registrar:this.registrar,datastore:this.datastore,...this._config.dht})}if(this._modules.pubsub){const e=this._modules.pubsub;this.pubsub=T(e,this,this._config.pubsub)}this.peerRouting=new u(this),this.contentRouting=new f(this),P.mount(this),this._onDiscoveryPeer=this._onDiscoveryPeer.bind(this)}emit(e,...t){return"error"!==e||this._events.error?super.emit(e,...t):(i.error(t),!1)}async start(){i("libp2p is starting");try{await this._onStarting(),await this._onDidStart(),i("libp2p has started")}catch(e){throw this.emit("error",e),i.error("An error occurred starting libp2p",e),await this.stop(),e}}async stop(){i("libp2p is stopping");try{this._isStarted=!1,this.relay&&this.relay.stop(),this.peerRouting.stop();for(const e of this._discovery.values())e.removeListener("peer",this._onDiscoveryPeer);await Promise.all(Array.from(this._discovery.values(),(e=>e.stop()))),this._discovery=new Map,await this.peerStore.stop(),await this.connectionManager.stop(),await Promise.all([this.pubsub&&this.pubsub.stop(),this._dht&&this._dht.stop(),this.metrics&&this.metrics.stop()]),await this.natManager.stop(),await this.transportManager.close(),P.unmount(this),this.dialer.destroy()}catch(e){e&&(i.error(e),this.emit("error",e))}i("libp2p has stopped")}async loadKeychain(){if(this.keychain)try{await this.keychain.findKeyByName("self")}catch(e){await this.keychain.importPeer("self",this.peerId)}}isStarted(){return this._isStarted}get connections(){return this.connectionManager.connections}dial(e,t){return this._dial(e,t)}async dialProtocol(e,t,r){if(!t||!t.length)throw s(new Error("no protocols were provided to open a stream"),d.ERR_INVALID_PROTOCOLS_FOR_STREAM);return(await this._dial(e,r)).newStream(t)}async _dial(e,t){const{id:r,multiaddrs:n}=l(e);if(r.equals(this.peerId))throw s(new Error("Cannot dial self"),d.ERR_DIALED_SELF);let i=this.connectionManager.get(r);return i?n&&this.peerStore.addressBook.add(r,n):i=await this.dialer.connectToPeer(e,t),i}get multiaddrs(){let e=this.addressManager.getAnnounceAddrs().map((e=>e.toString()));e.length||(e=this.transportManager.getAddrs().map((e=>e.toString()))),e=e.concat(this.addressManager.getObservedAddrs().map((e=>e.toString())));const t=this._options.addresses.announceFilter,r=new Set(e);return t(Array.from(r).map((e=>new c(e))))}async hangUp(e){const{id:t}=l(e),r=this.connectionManager.connections.get(t.toB58String());r&&await Promise.all(r.map((e=>e.close())))}ping(e){const{id:t,multiaddrs:r}=l(e);return P(this,r?r[0]:t)}handle(e,t){(e=Array.isArray(e)?e:[e]).forEach((e=>{this.upgrader.protocols.set(e,t)})),this.peerStore.protoBook.add(this.peerId,e)}unhandle(e){(e=Array.isArray(e)?e:[e]).forEach((e=>{this.upgrader.protocols.delete(e)})),this.peerStore.protoBook.remove(this.peerId,e)}async _onStarting(){const e=this.addressManager.getListenAddrs();await this.transportManager.listen(e),this.natManager.start(),await this.peerStore.start(),this._config.pubsub.enabled&&this.pubsub&&this.pubsub.start(),this._config.dht.enabled&&(this._dht&&this._dht.start(),this._dht.on("peer",this._onDiscoveryPeer)),this.metrics&&this.metrics.start()}async _onDidStart(){this._isStarted=!0,this.peerStore.on("peer",(e=>{this.emit("peer:discovery",e),this._maybeConnect(e)}));for(const e of this.peerStore.peers.values())this.emit("peer:discovery",e.id);this.connectionManager.start(),await this._setupPeerDiscovery(),this.relay&&this.relay.start(),this.peerRouting.start()}_onDiscoveryPeer(e){e.id.toB58String()!==this.peerId.toB58String()?(e.multiaddrs&&this.peerStore.addressBook.add(e.id,e.multiaddrs),e.protocols&&this.peerStore.protoBook.set(e.id,e.protocols)):i.error(new Error(d.ERR_DISCOVERED_SELF))}async _maybeConnect(e){if(!0===this._config.peerDiscovery.autoDial&&!this.connectionManager.get(e)&&(this._options.connectionManager.minConnections||0)>this.connectionManager.size){i("connecting to discovered peer %s",e.toB58String());try{await this.dialer.connectToPeer(e)}catch(t){i.error(`could not connect to discovered peer ${e.toB58String()} with ${t}`)}}}async _setupPeerDiscovery(){const e=e=>{let t={enabled:!0};if(e.tag&&this._config.peerDiscovery&&this._config.peerDiscovery[e.tag]&&(t={...t,...this._config.peerDiscovery[e.tag]}),t.enabled&&!this._discovery.has(e.tag)){let r;r="function"==typeof e?new e(Object.assign({},t,{peerId:this.peerId,libp2p:this})):e,r.on("peer",this._onDiscoveryPeer),this._discovery.set(e.tag,r)}};for(const t of this._modules.peerDiscovery||[])e(t);for(const t of this.transportManager.getTransports())t.discovery&&e(t.discovery);await Promise.all(Array.from(this._discovery.values(),(e=>e.start())))}}e.exports=x},89138:(e,t,r)=>{"use strict";r(79437),r(97450);const n=r(3832),{certificateForKey:i,findAsync:o}=r(48913),s=r(32114),{fromString:a}=r(52217),{toString:c}=r(92263),u=new WeakMap;e.exports=class{constructor(e,t){if(!e)throw s(new Error("keychain is required"),"ERR_KEYCHAIN_REQUIRED");this.keychain=e,u.set(this,{dek:t})}async encrypt(e,t){if(!(t instanceof Uint8Array))throw s(new Error("Plain data must be a Uint8Array"),"ERR_INVALID_PARAMS");const r=await this.keychain.findKeyByName(e),o=await this.keychain._getPrivateKey(e),c=u.get(this).dek,f=n.pki.decryptRsaPrivateKey(o,c),l=await i(r,f),h=n.pkcs7.createEnvelopedData();h.addRecipient(l),h.content=n.util.createBuffer(t),h.encrypt();const d=n.asn1.toDer(h.toAsn1()).getBytes();return a(d,"ascii")}async decrypt(e){if(!(e instanceof Uint8Array))throw s(new Error("CMS data is required"),"ERR_INVALID_PARAMS");let t;try{const r=n.util.createBuffer(c(e,"ascii")),i=n.asn1.fromDer(r);t=n.pkcs7.messageFromAsn1(i)}catch(e){throw s(new Error("Invalid CMS: "+e.message),"ERR_INVALID_CMS")}const r=t.recipients.filter((e=>e.issuer.find((e=>"O"===e.shortName&&"ipfs"===e.value)))).filter((e=>e.issuer.find((e=>"CN"===e.shortName)))).map((e=>({recipient:e,keyId:e.issuer.find((e=>"CN"===e.shortName)).value}))),i=await o(r,(async e=>{try{if(await this.keychain.findKeyById(e.keyId))return!0}catch(e){return!1}return!1}));if(!i){const e=r.map((e=>e.keyId));throw s(new Error("Decryption needs one of the key(s): "+e.join(", ")),"ERR_MISSING_KEYS",{missingKeys:e})}const f=await this.keychain.findKeyById(i.keyId);if(!f)throw s(new Error("No key available to decrypto"),"ERR_NO_KEY");const l=await this.keychain._getPrivateKey(f.name),h=u.get(this).dek,d=n.pki.decryptRsaPrivateKey(l,h);return t.decrypt(i.recipient,d),a(t.content.getBytes(),"ascii")}}},40298:(e,t,r)=>{"use strict";const n=r(11227),i=Object.assign(n("libp2p:keychain"),{error:n("libp2p:keychain:err")}),o=r(50202),s=r(70942),a=r(49928),{Key:c}=r(82233),u=r(89138),f=r(32114),{toString:l}=r(92263),{fromString:h}=r(52217);r(63219);const d="/info/",p=new WeakMap,y={dek:{keyLength:64,iterationCount:1e4,salt:"you should override this value with a crypto secure random number",hash:"sha2-512"}};function g(e){return!!e&&"string"==typeof e&&e===o(e.trim())}async function b(e){const t=800*Math.random()+200;throw await new Promise((e=>setTimeout(e,t))),e}function m(e){return new c("/pkcs8/"+e)}function v(e){return new c(d+e)}e.exports=class{constructor(e,t){if(!e)throw new Error("store is required");if(this.store=e,this.opts=s(y,t),this.opts.pass&&this.opts.pass.length<20)throw new Error("pass must be least 20 characters");if(this.opts.dek.keyLength<14)throw new Error("dek.keyLength must be least 14 bytes");if(this.opts.dek.salt.length<16)throw new Error("dek.saltLength must be least 16 bytes");if(this.opts.dek.iterationCount<1e3)throw new Error("dek.iterationCount must be least 1000");const r=this.opts.pass?a.pbkdf2(this.opts.pass,this.opts.dek.salt,this.opts.dek.iterationCount,this.opts.dek.keyLength,this.opts.dek.hash):"";p.set(this,{dek:r})}get cms(){return new u(this,p.get(this).dek)}static generateOptions(){const e=Object.assign({},y),t=3*Math.ceil(16/3);return e.dek.salt=l(a.randomBytes(t),"base64"),e}static get options(){return y}async createKey(e,t,r=2048){const n=this;if(!g(e)||"self"===e)return b(f(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));if("string"!=typeof t)return b(f(new Error(`Invalid key type '${t}'`),"ERR_INVALID_KEY_TYPE"));const i=m(e);if(await n.store.has(i))return b(f(new Error(`Key '${e}' already exists`),"ERR_KEY_ALREADY_EXISTS"));if("rsa"===t.toLowerCase()&&(!Number.isSafeInteger(r)||r<2048))return b(f(new Error(`Invalid RSA key size ${r}`),"ERR_INVALID_KEY_SIZE"));let o;try{const s=await a.keys.generateKeyPair(t,r),c=await s.id(),u=p.get(this).dek,f=await s.export(u);o={name:e,id:c};const l=n.store.batch();l.put(i,h(f)),l.put(v(e),h(JSON.stringify(o))),await l.commit()}catch(e){return b(e)}return o}async listKeys(){const e=this,t={prefix:d},r=[];for await(const n of e.store.query(t))r.push(JSON.parse(l(n.value)));return r}async findKeyById(e){try{return(await this.listKeys()).find((t=>t.id===e))}catch(e){return b(e)}}async findKeyByName(e){if(!g(e))return b(f(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));const t=v(e);try{const e=await this.store.get(t);return JSON.parse(l(e))}catch(t){return b(f(new Error(`Key '${e}' does not exist. ${t.message}`),"ERR_KEY_NOT_FOUND"))}}async removeKey(e){if(!g(e)||"self"===e)return b(f(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));const t=m(e),r=await this.findKeyByName(e),n=this.store.batch();return n.delete(t),n.delete(v(e)),await n.commit(),r}async renameKey(e,t){const r=this;if(!g(e)||"self"===e)return b(f(new Error(`Invalid old key name '${e}'`),"ERR_OLD_KEY_NAME_INVALID"));if(!g(t)||"self"===t)return b(f(new Error(`Invalid new key name '${t}'`),"ERR_NEW_KEY_NAME_INVALID"));const n=m(e),i=m(t),o=v(e),s=v(t);if(await r.store.has(i))return b(f(new Error(`Key '${t}' already exists`),"ERR_KEY_ALREADY_EXISTS"));try{const e=await r.store.get(n),a=await r.store.get(o),c=JSON.parse(l(a));c.name=t;const u=r.store.batch();return u.put(i,e),u.put(s,h(JSON.stringify(c))),u.delete(n),u.delete(o),await u.commit(),c}catch(e){return b(e)}}async exportKey(e,t){if(!g(e))return b(f(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));if(!t)return b(f(new Error("Password is required"),"ERR_PASSWORD_REQUIRED"));const r=m(e);try{const e=await this.store.get(r),n=l(e),i=p.get(this).dek;return(await a.keys.import(n,i)).export(t)}catch(e){return b(e)}}async importKey(e,t,r){if(!g(e)||"self"===e)return b(f(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));if(!t)return b(f(new Error("PEM encoded key is required"),"ERR_PEM_REQUIRED"));const n=m(e);if(await this.store.has(n))return b(f(new Error(`Key '${e}' already exists`),"ERR_KEY_ALREADY_EXISTS"));let i,o;try{i=await a.keys.import(t,r)}catch(e){return b(f(new Error("Cannot read the key, most likely the password is wrong"),"ERR_CANNOT_READ_KEY"))}try{o=await i.id();const e=p.get(this).dek;t=await i.export(e)}catch(e){return b(e)}const s={name:e,id:o},c=this.store.batch();return c.put(n,h(t)),c.put(v(e),h(JSON.stringify(s))),await c.commit(),s}async importPeer(e,t){const r=this;if(!g(e))return b(f(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));if(!t||!t.privKey)return b(f(new Error("Peer.privKey is required"),"ERR_MISSING_PRIVATE_KEY"));const n=t.privKey,i=m(e);if(await r.store.has(i))return b(f(new Error(`Key '${e}' already exists`),"ERR_KEY_ALREADY_EXISTS"));try{const t=await n.id(),o=p.get(this).dek,s=await n.export(o),a={name:e,id:t},c=r.store.batch();return c.put(i,h(s)),c.put(v(e),h(JSON.stringify(a))),await c.commit(),a}catch(e){return b(e)}}async _getPrivateKey(e){if(!g(e))return b(f(new Error(`Invalid key name '${e}'`),"ERR_INVALID_KEY_NAME"));try{const t=m(e),r=await this.store.get(t);return l(r)}catch(t){return b(f(new Error(`Key '${e}' does not exist. ${t.message}`),"ERR_KEY_NOT_FOUND"))}}async rotateKeychainPass(e,t){if("string"!=typeof e)return b(f(new Error(`Invalid old pass type '${typeof e}'`),"ERR_INVALID_OLD_PASS_TYPE"));if("string"!=typeof t)return b(f(new Error(`Invalid new pass type '${typeof t}'`),"ERR_INVALID_NEW_PASS_TYPE"));if(t.length<20)return b(f(new Error(`Invalid pass length ${t.length}`),"ERR_INVALID_PASS_LENGTH"));i("recreating keychain");const r=p.get(this).dek;this.opts.pass=t;const n=t?a.pbkdf2(t,this.opts.dek.salt,this.opts.dek.iterationCount,this.opts.dek.keyLength,this.opts.dek.hash):"";p.set(this,{dek:n});const o=await this.listKeys();for(const e of o){const t=await this.store.get(m(e.name)),i=l(t),o=await a.keys.import(i,r),s=n.toString(),c=await o.export(s),u=this.store.batch(),f={name:e.name,id:e.id};u.put(m(e.name),h(c)),u.put(v(e.name),h(JSON.stringify(f))),await u.commit()}i("keychain reconstructed")}}},48913:(e,t,r)=>{"use strict";r(25414);const n=r(3832).pki;e.exports={certificateForKey:(e,t)=>{const r=n.setRsaPublicKey(t.n,t.e),i=n.createCertificate();i.publicKey=r,i.serialNumber="01",i.validity.notBefore=new Date,i.validity.notAfter=new Date,i.validity.notAfter.setFullYear(i.validity.notBefore.getFullYear()+10);const o=[{name:"organizationName",value:"ipfs"},{shortName:"OU",value:"keystore"},{name:"commonName",value:e.id}];return i.setSubject(o),i.setIssuer(o),i.setExtensions([{name:"basicConstraints",cA:!0},{name:"keyUsage",keyCertSign:!0,digitalSignature:!0,nonRepudiation:!0,keyEncipherment:!0,dataEncipherment:!0},{name:"extKeyUsage",serverAuth:!0,clientAuth:!0,codeSigning:!0,emailProtection:!0,timeStamping:!0},{name:"nsCertType",client:!0,server:!0,email:!0,objsign:!0,sslCA:!0,emailCA:!0,objCA:!0}]),i.sign(t),i},findAsync:async function(e,t){const r=e.map(t);return e[(await Promise.all(r)).findIndex((e=>e))]}}},31175:(e,t,r)=>{"use strict";const n=r(70942),{pipe:i}=r(60618),{tap:o}=r(38386),s=r(87787),{METRICS:a}=r(3524),c=r(61094),u=["dataReceived","dataSent"],f={in:"dataReceived",out:"dataSent"};class l{constructor(e){this._options=n(a,e),this._globalStats=new c(u,this._options),this._peerStats=new Map,this._protocolStats=new Map,this._oldPeers=s(this._options.maxOldPeersRetention),this._running=!1,this._onMessage=this._onMessage.bind(this),this._connectionManager=e.connectionManager,this._connectionManager.on("peer:disconnect",(e=>{this.onPeerDisconnected(e.remotePeer)}))}start(){this._running=!0}stop(){this._running=!1,this._globalStats.stop();for(const e of this._peerStats.values())e.stop();for(const e of this._protocolStats.values())e.stop()}get global(){return this._globalStats}get peers(){return Array.from(this._peerStats.keys())}forPeer(e){const t=e.toB58String();return this._peerStats.get(t)||this._oldPeers.get(t)}get protocols(){return Array.from(this._protocolStats.keys())}forProtocol(e){return this._protocolStats.get(e)}onPeerDisconnected(e){const t=e.toB58String(),r=this._peerStats.get(t);r&&(r.stop(),this._peerStats.delete(t),this._oldPeers.set(t,r))}_onMessage({remotePeer:e,protocol:t,direction:r,dataLength:n}){if(!this._running)return;const i=f[r];let o=this.forPeer(e);if(o||(o=new c(u,this._options),this._peerStats.set(e.toB58String(),o)),o.push(i,n),this._globalStats.push(i,n),t){let e=this.forProtocol(t);e||(e=new c(u,this._options),this._protocolStats.set(t,e)),e.push(i,n)}}updatePlaceholder(e,t){if(!this._running)return;const r=this.forPeer(e),n=t.toB58String(),i=this.forPeer(t);let o=r;i&&(o=l.mergeStats(i,o),this._oldPeers.delete(n)),this._peerStats.delete(e.toB58String()),this._peerStats.set(n,o),o.start()}trackStream({stream:e,remotePeer:t,protocol:r}){const n=this,s=e.source;e.source=o((e=>n._onMessage({remotePeer:t,protocol:r,direction:"in",dataLength:e.length})))(s);const a=e.sink;return e.sink=e=>i(e,o((e=>n._onMessage({remotePeer:t,protocol:r,direction:"out",dataLength:e.length}))),a),e}static mergeStats(e,t){return e.stop(),t.stop(),e._queue=[...e._queue,...t._queue],e}}e.exports=l},87787:(e,t,r)=>{"use strict";const n=r(70248);e.exports=e=>{const t=n(e);return t.delete=t.remove,t}},61094:(e,t,r)=>{"use strict";const{EventEmitter:n}=r(17187),{BigNumber:i}=r(44431),o=r(63573),s=r(82916);e.exports=class extends n{constructor(e,t){super(),this._options=t,this._queue=[],this._stats={dataReceived:i(0),dataSent:i(0)},this._frequencyLastTime=Date.now(),this._frequencyAccumulators={},this._movingAverages={},this._update=this._update.bind(this);const r=this._options.movingAverageIntervals;for(let t=0;t{this._updateFrequencyFor(r,t,e)})),this._frequencyLastTime=e}_updateFrequencyFor(e,t,r){const n=this._frequencyAccumulators[e]||0;this._frequencyAccumulators[e]=0;const i=n/(t||1)*1e3;let s=this._movingAverages[e];s||(s=this._movingAverages[e]={});const a=this._options.movingAverageIntervals;for(let e=0;e{"use strict";const n=r(57600),i=r(11227),{promisify:o}=r(76021),{Multiaddr:s}=r(46584),a=Object.assign(i("libp2p:nat"),{error:i("libp2p:nat:err")}),{isBrowser:c}=r(97916),u=r(42693),f=r(290),l=r(28362),h=r(32114),{codes:{ERR_INVALID_PARAMETERS:d}}=r(23416),p=r(23830);function y(e=1024,t=65535){return Math.floor(Math.random()*(t-e+1)+e)}e.exports=class{constructor({peerId:e,addressManager:t,transportManager:r,...n}){if(this._peerId=e,this._addressManager=t,this._transportManager=r,this._enabled=n.enabled,this._externalIp=n.externalIp,this._options={description:n.description||`${l.name}@${l.version} ${this._peerId}`,ttl:n.ttl||7200,autoUpdate:n.keepAlive||!0,gateway:n.gateway,enablePMP:Boolean(n.pmp&&n.pmp.enabled)},this._options.ttl<7200)throw h(new Error("NatManager ttl should be at least 7200 seconds"),d)}start(){!c&&this._enabled&&this._start().catch((e=>{a.error(e)}))}async _start(){const e=this._transportManager.getAddrs();for(const t of e){const{family:e,host:r,port:n,transport:i}=t.toOptions();if(!t.isThinWaistAddress()||"tcp"!==i)continue;if(p(t))continue;if(4!==e)continue;const o=this._getClient(),c=this._externalIp||await o.externalIp();if(f(c))throw new Error(`${c} is private - please set config.nat.externalIp to an externally routable IP or ensure you are not behind a double NAT`);const u=y();a(`opening uPnP connection from ${c}:${u} to ${r}:${n}`),await o.map({publicPort:u,privatePort:n,protocol:i.toUpperCase()}),this._addressManager.addObservedAddr(s.fromNodeAddress({family:4,address:c,port:u},i))}}_getClient(){if(this._client)return this._client;const e=new n(this._options),t=o(e.map.bind(e)),r=o(e.destroy.bind(e)),i=o(e.externalIp.bind(e));return this._client={map:(...e)=>u((()=>t(...e)),{onFailedAttempt:a.error,unref:!0}),destroy:(...e)=>u((()=>r(...e)),{onFailedAttempt:a.error,unref:!0}),externalIp:(...e)=>u((()=>i(...e)),{onFailedAttempt:a.error,unref:!0})},this._client}async stop(){if(!c&&this._client)try{await this._client.destroy(),this._client=null}catch(e){a.error(e)}}}},51203:(e,t,r)=>{"use strict";const n=r(11227),i=Object.assign(n("libp2p:peer-routing"),{error:n("libp2p:peer-routing:err")}),o=r(32114),{storeAddresses:s,uniquePeers:a,requirePeers:c}=r(63952),u=r(74014),{pipe:f}=r(60618),l=r(72262),h=r(64593),d=r(55565),{setDelayedInterval:p,clearDelayedInterval:y}=r(27695);e.exports=class{constructor(e){this._peerId=e.peerId,this._peerStore=e.peerStore,this._routers=e._modules.peerRouting||[],e._dht&&e._config.dht.enabled&&this._routers.push(e._dht),this._refreshManagerOptions=e._options.peerRouting.refreshManager,this._findClosestPeersTask=this._findClosestPeersTask.bind(this)}start(){this._routers.length&&!this._timeoutId&&this._refreshManagerOptions.enabled&&(this._timeoutId=p(this._findClosestPeersTask,this._refreshManagerOptions.interval,this._refreshManagerOptions.bootDelay))}async _findClosestPeersTask(){try{await h(this.getClosestPeers(this._peerId.id))}catch(e){i.error(e)}}stop(){y(this._timeoutId)}async findPeer(e,t){if(!this._routers.length)throw o(new Error("No peer routers available"),"NO_ROUTERS_AVAILABLE");if(e.toB58String()===this._peerId.toB58String())throw o(new Error("Should not try to find self"),"ERR_FIND_SELF");const r=await f(u(...this._routers.map((r=>[r.findPeer(e,t)]))),(e=>d(e,Boolean)),(e=>s(e,this._peerStore)),(e=>l(e)));if(r)return r;throw o(new Error("not found"),"NOT_FOUND")}async*getClosestPeers(e,t={timeout:3e4}){if(!this._routers.length)throw o(new Error("No peer routers available"),"NO_ROUTERS_AVAILABLE");yield*f(u(...this._routers.map((r=>r.getClosestPeers(e,t)))),(e=>s(e,this._peerStore)),(e=>a(e)),(e=>c(e)))}}},3721:(e,t,r)=>{"use strict";const n=r(11227),i=Object.assign(n("libp2p:peer-store:address-book"),{error:n("libp2p:peer-store:address-book:err")}),o=r(32114),{Multiaddr:s}=r(46584),a=r(88785),c=r(94903),u=r(61131),{codes:{ERR_INVALID_PARAMETERS:f}}=r(23416),l=r(31244);e.exports=class extends c{constructor(e){super({peerStore:e,eventName:"change:multiaddrs",eventProperty:"multiaddrs",eventTransformer:e=>e.addresses?e.addresses.map((e=>e.multiaddr)):[]}),this.data=new Map}consumePeerRecord(e){let t;try{t=u.createFromProtobuf(e.payload)}catch(e){return i.error("invalid peer record received"),!1}if(!t.peerId.equals(e.peerId))return i("signing key does not match PeerId in the PeerRecord"),!1;if(!t.multiaddrs||!t.multiaddrs.length)return!1;const r=t.peerId,n=r.toB58String(),o=(this.data.get(n)||{record:void 0}).record;if(o&&o.seqNumber>=t.seqNumber)return!1;const s=this._toAddresses(t.multiaddrs,!0);return this._setData(r,{addresses:s,record:{raw:e.marshal(),seqNumber:t.seqNumber}}),i(`stored provided peer record for ${n}`),!0}getRawEnvelope(e){const t=this.data.get(e.toB58String());if(t&&t.record&&t.record.raw)return t.record.raw}getPeerRecord(e){const t=this.getRawEnvelope(e);if(t)return l.createFromProtobuf(t)}set(e,t){if(!a.isPeerId(e))throw i.error("peerId must be an instance of peer-id to store data"),o(new Error("peerId must be an instance of peer-id"),f);const r=this._toAddresses(t);if(!r.length)return this;const n=e.toB58String(),s=this.data.get(n);return s&&s.addresses&&s.addresses.length===r.length&&s.addresses.filter((e=>r.some((t=>e.multiaddr.equals(t.multiaddr))))).length===s.addresses.length?(i(`the addresses provided to store are equal to the already stored for ${n}`),this):(this._setData(e,{addresses:r,record:s&&s.record}),i(`stored provided multiaddrs for ${n}`),s||this._ps.emit("peer",e),this)}add(e,t){if(!a.isPeerId(e))throw i.error("peerId must be an instance of peer-id to store data"),o(new Error("peerId must be an instance of peer-id"),f);const r=this._toAddresses(t),n=e.toB58String();if(!r.length)return this;const s=this.data.get(n);return s&&s.addresses&&(s.addresses.forEach((e=>{r.find((t=>t.multiaddr.equals(e.multiaddr)))||r.push(e)})),s.addresses.length===r.length)?(i(`the addresses provided to store are already stored for ${n}`),this):(this._setData(e,{addresses:r,record:s&&s.record}),i(`added provided multiaddrs for ${n}`),s&&s.addresses||this._ps.emit("peer",e),this)}get(e){if(!a.isPeerId(e))throw o(new Error("peerId must be an instance of peer-id"),f);const t=this.data.get(e.toB58String());return t&&t.addresses?[...t.addresses]:void 0}_toAddresses(e,t=!1){if(!e)throw i.error("multiaddrs must be provided to store data"),o(new Error("multiaddrs must be provided"),f);const r=[];return e.forEach((e=>{if(!s.isMultiaddr(e))throw i.error(`multiaddr ${e} must be an instance of multiaddr`),o(new Error(`multiaddr ${e} must be an instance of multiaddr`),f);r.find((t=>t.multiaddr.equals(e)))||r.push({multiaddr:e,isCertified:t})})),r}getMultiaddrsForPeer(e,t=(e=>e)){if(!a.isPeerId(e))throw o(new Error("peerId must be an instance of peer-id"),f);const r=this.data.get(e.toB58String());if(r&&r.addresses)return t(r.addresses||[]).map((t=>{const r=t.multiaddr,n=r.getPeerId();return n&&n===e.toB58String()?r:r.encapsulate(`/p2p/${e.toB58String()}`)}))}}},94903:(e,t,r)=>{"use strict";const n=r(32114),i=r(88785),{codes:{ERR_INVALID_PARAMETERS:o}}=r(23416),s=e=>e;e.exports=class{constructor({peerStore:e,eventName:t,eventProperty:r,eventTransformer:n=s}){this._ps=e,this.eventName=t,this.eventProperty=r,this.eventTransformer=n,this.data=new Map}set(e,t){throw n(new Error("set must be implemented by the subclass"),"ERR_NOT_IMPLEMENTED")}_setData(e,t,{emit:r=!0}={}){const n=e.toB58String();this.data.set(n,t),r&&this._emit(e,t)}_emit(e,t){this._ps.emit(this.eventName,{peerId:e,[this.eventProperty]:this.eventTransformer(t)})}get(e){if(!i.isPeerId(e))throw n(new Error("peerId must be an instance of peer-id"),o);const t=this.data.get(e.toB58String());return t?[...t]:void 0}delete(e){if(!i.isPeerId(e))throw n(new Error("peerId must be an instance of peer-id"),o);return!!this.data.delete(e.toB58String())&&(this._emit(e,[]),!0)}}},4323:(e,t,r)=>{"use strict";const n=r(32114),{EventEmitter:i}=r(17187),o=r(88785),s=r(3721),a=r(61062),c=r(3350),u=r(51979),{codes:{ERR_INVALID_PARAMETERS:f}}=r(23416);e.exports=class extends i{constructor({peerId:e}){super(),this._peerId=e,this.addressBook=new s(this),this.keyBook=new a(this),this.metadataBook=new c(this),this.protoBook=new u(this)}start(){}stop(){}get peers(){const e=new Set([...this.addressBook.data.keys(),...this.keyBook.data.keys(),...this.protoBook.data.keys(),...this.metadataBook.data.keys()]);this._peerId&&e.delete(this._peerId.toB58String());const t=new Map;return e.forEach((e=>{t.set(e,this.get(o.createFromB58String(e)))})),t}delete(e){const t=this.addressBook.delete(e),r=this.keyBook.delete(e),n=this.protoBook.delete(e),i=this.metadataBook.delete(e);return t||r||n||i}get(e){if(!o.isPeerId(e))throw n(new Error("peerId must be an instance of peer-id"),f);const t=this.keyBook.data.get(e.toB58String()),r=this.addressBook.get(e),i=this.metadataBook.get(e),s=this.protoBook.get(e);if(t||r||i||s)return{id:t||e,addresses:r||[],protocols:s||[],metadata:i}}}},61062:(e,t,r)=>{"use strict";const n=r(11227),i=Object.assign(n("libp2p:peer-store:key-book"),{error:n("libp2p:peer-store:key-book:err")}),o=r(32114),s=r(88785),a=r(94903),{codes:{ERR_INVALID_PARAMETERS:c}}=r(23416);e.exports=class extends a{constructor(e){super({peerStore:e,eventName:"change:pubkey",eventProperty:"pubkey",eventTransformer:e=>e.pubKey}),this.data=new Map}set(e,t){if(!s.isPeerId(e))throw i.error("peerId must be an instance of peer-id to store data"),o(new Error("peerId must be an instance of peer-id"),c);const r=e.toB58String();return!this.data.get(r)&&t&&(e.pubKey=t,this._setData(e,e),i(`stored provided public key for ${r}`)),this}get(e){if(!s.isPeerId(e))throw o(new Error("peerId must be an instance of peer-id"),c);const t=this.data.get(e.toB58String());return t?t.pubKey:void 0}}},3350:(e,t,r)=>{"use strict";const n=r(11227),i=Object.assign(n("libp2p:peer-store:proto-book"),{error:n("libp2p:peer-store:proto-book:err")}),o=r(32114),{equals:s}=r(19588),a=r(88785),c=r(94903),{codes:{ERR_INVALID_PARAMETERS:u}}=r(23416);e.exports=class extends c{constructor(e){super({peerStore:e,eventName:"change:metadata",eventProperty:"metadata"}),this.data=new Map}set(e,t,r){if(!a.isPeerId(e))throw i.error("peerId must be an instance of peer-id to store data"),o(new Error("peerId must be an instance of peer-id"),u);if("string"!=typeof t||!(r instanceof Uint8Array))throw i.error("valid key and value must be provided to store data"),o(new Error("valid key and value must be provided"),u);return this._setValue(e,t,r),this}_setValue(e,t,r,{emit:n=!0}={}){const o=e.toB58String(),a=this.data.get(o)||new Map,c=a.get(t);c&&s(r,c)?i(`the metadata provided to store is equal to the already stored for ${o} on ${t}`):(a.set(t,r),this.data.set(o,a),n&&this._emit(e,t))}get(e){if(!a.isPeerId(e))throw o(new Error("peerId must be an instance of peer-id"),u);return this.data.get(e.toB58String())}getValue(e,t){if(!a.isPeerId(e))throw o(new Error("peerId must be an instance of peer-id"),u);const r=this.data.get(e.toB58String());return r&&r.get(t)}delete(e){if(!a.isPeerId(e))throw o(new Error("peerId must be an instance of peer-id"),u);return!!this.data.delete(e.toB58String())&&(this._emit(e),!0)}deleteValue(e,t){if(!a.isPeerId(e))throw o(new Error("peerId must be an instance of peer-id"),u);const r=this.data.get(e.toB58String());return!(!r||!r.delete(t)||(this._emit(e,t),0))}}},5922:e=>{"use strict";e.exports.NAMESPACE_COMMON="/peers/",e.exports.NAMESPACE_ADDRESS="/peers/addrs/",e.exports.NAMESPACE_KEYS="/peers/keys/",e.exports.NAMESPACE_METADATA="/peers/metadata/",e.exports.NAMESPACE_PROTOCOL="/peers/protos/"},78112:(e,t,r)=>{"use strict";const n=r(11227),i=Object.assign(n("libp2p:persistent-peer-store"),{error:n("libp2p:persistent-peer-store:err")}),{Key:o}=r(82233),{Multiaddr:s}=r(46584),a=r(88785),{base32:c}=r(22817),u=r(4323),{NAMESPACE_ADDRESS:f,NAMESPACE_COMMON:l,NAMESPACE_KEYS:h,NAMESPACE_METADATA:d,NAMESPACE_PROTOCOL:p}=r(5922),{Addresses:y}=r(7448),{Protocols:g}=r(82299);e.exports=class extends u{constructor({peerId:e,datastore:t,threshold:r=5}){super({peerId:e}),this._datastore=t,this._dirtyPeers=new Set,this._dirtyMetadata=new Map,this.threshold=r,this._addDirtyPeer=this._addDirtyPeer.bind(this)}async start(){i("PeerStore is starting"),this.on("change:protocols",this._addDirtyPeer),this.on("change:multiaddrs",this._addDirtyPeer),this.on("change:pubkey",this._addDirtyPeerKey),this.on("change:metadata",this._addDirtyPeerMetadata);for await(const e of this._datastore.query({prefix:l}))await this._processDatastoreEntry(e);i("PeerStore started")}async stop(){i("PeerStore is stopping"),this.removeAllListeners(),await this._commitData(),i("PeerStore stopped")}_addDirtyPeer({peerId:e}){const t=e.toB58String();i("add dirty peer",t),this._dirtyPeers.add(t),this._dirtyPeers.size>=this.threshold&&this._commitData().catch((e=>{i.error("error committing data",e)}))}_addDirtyPeerKey({peerId:e}){if(e.hasInlinePublicKey())return;const t=e.toB58String();i("add dirty peer key",t),this._dirtyPeers.add(t),this._dirtyPeers.size>=this.threshold&&this._commitData().catch((e=>{i.error("error committing data",e)}))}_addDirtyPeerMetadata({peerId:e,metadata:t}){const r=e.toB58String();i("add dirty metadata peer",r),this._dirtyPeers.add(r);const n=this._dirtyMetadata.get(r)||new Set;n.add(t),this._dirtyMetadata.set(r,n),this._dirtyPeers.size>=this.threshold&&this._commitData().catch((e=>{i.error("error committing data",e)}))}async _commitData(){const e=Array.from(this._dirtyPeers);if(!e.length)return;this._dirtyPeers.clear(),i("create batch commit");const t=this._datastore.batch();for(const r of e){const e=this.keyBook.data.get(r)||a.createFromB58String(r);this._batchAddressBook(e,t),!e.hasInlinePublicKey()&&this._batchKeyBook(e,t),this._batchMetadataBook(e,t),this._batchProtoBook(e,t)}await t.commit(),i("batch committed")}_batchAddressBook(e,t){const r=e.toString(),n=new o(`${f}${r}`),s=this.addressBook.data.get(e.toB58String());try{if(!s)return void t.delete(n);const e=y.encode({addrs:s.addresses.map((e=>({multiaddr:e.multiaddr.bytes,isCertified:e.isCertified}))),certifiedRecord:s.record?{seq:s.record.seqNumber,raw:s.record.raw}:void 0}).finish();t.put(n,e)}catch(e){i.error(e)}}_batchKeyBook(e,t){const r=e.toString(),n=new o(`${h}${r}`);try{if(!e.pubKey)return void t.delete(n);const r=e.marshalPubKey();t.put(n,r)}catch(e){i.error(e)}}_batchMetadataBook(e,t){const r=e.toString(),n=this._dirtyMetadata.get(e.toB58String())||[];try{n.forEach((n=>{const i=new o(`${d}${r}/${n}`),s=this.metadataBook.getValue(e,n);s?t.put(i,s):t.delete(i)}))}catch(e){i.error(e)}}_batchProtoBook(e,t){const r=e.toString(),n=new o(`${p}${r}`),s=this.protoBook.get(e);try{if(!s)return void t.delete(n);const e=g.encode({protocols:s}).finish();t.put(n,e)}catch(e){i.error(e)}}async _processDatastoreEntry({key:e,value:t}){try{const r=e.toString().split("/"),n=a.createFromBytes(c.decode(r[3]));let o;switch(r[2]){case"addrs":o=y.decode(t),this.addressBook._setData(n,{addresses:o.addrs.map((e=>({multiaddr:new s(e.multiaddr),isCertified:Boolean(e.isCertified)}))),record:o.certifiedRecord?{raw:o.certifiedRecord.raw,seqNumber:o.certifiedRecord.seq}:void 0},{emit:!1});break;case"keys":o=await a.createFromPubKey(t),this.keyBook._setData(o,o,{emit:!1});break;case"metadata":this.metadataBook._setValue(n,r[4],t,{emit:!1});break;case"protos":o=g.decode(t),this.protoBook._setData(n,new Set(o.protocols),{emit:!1});break;default:i("invalid data persisted for: ",e.toString())}}catch(e){i.error(e)}}}},7448:(e,t,r)=>{"use strict";var n=r(62100),i=n.Reader,o=n.Writer,s=n.util,a=n.roots["libp2p-address-book"]||(n.roots["libp2p-address-book"]={});a.Addresses=function(){function e(e){if(this.addrs=[],e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.addrs&&n.addrs.length||(n.addrs=[]),n.addrs.push(a.Addresses.Address.decode(e,e.uint32()));break;case 2:n.certifiedRecord=a.Addresses.CertifiedRecord.decode(e,e.uint32());break;default:e.skipType(7&o)}}return n},e.fromObject=function(e){if(e instanceof a.Addresses)return e;var t=new a.Addresses;if(e.addrs){if(!Array.isArray(e.addrs))throw TypeError(".Addresses.addrs: array expected");t.addrs=[];for(var r=0;r>>3){case 1:n.multiaddr=e.bytes();break;case 2:n.isCertified=e.bool();break;default:e.skipType(7&o)}}return n},e.fromObject=function(e){if(e instanceof a.Addresses.Address)return e;var t=new a.Addresses.Address;return null!=e.multiaddr&&("string"==typeof e.multiaddr?s.base64.decode(e.multiaddr,t.multiaddr=s.newBuffer(s.base64.length(e.multiaddr)),0):e.multiaddr.length&&(t.multiaddr=e.multiaddr)),null!=e.isCertified&&(t.isCertified=Boolean(e.isCertified)),t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(t.bytes===String?r.multiaddr="":(r.multiaddr=[],t.bytes!==Array&&(r.multiaddr=s.newBuffer(r.multiaddr))),r.isCertified=!1),null!=e.multiaddr&&e.hasOwnProperty("multiaddr")&&(r.multiaddr=t.bytes===String?s.base64.encode(e.multiaddr,0,e.multiaddr.length):t.bytes===Array?Array.prototype.slice.call(e.multiaddr):e.multiaddr),null!=e.isCertified&&e.hasOwnProperty("isCertified")&&(r.isCertified=e.isCertified),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,n.util.toJSONOptions)},e}(),e.CertifiedRecord=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.seq=e.uint64();break;case 2:n.raw=e.bytes();break;default:e.skipType(7&o)}}return n},e.fromObject=function(e){if(e instanceof a.Addresses.CertifiedRecord)return e;var t=new a.Addresses.CertifiedRecord;return null!=e.seq&&(s.Long?(t.seq=s.Long.fromValue(e.seq)).unsigned=!0:"string"==typeof e.seq?t.seq=parseInt(e.seq,10):"number"==typeof e.seq?t.seq=e.seq:"object"==typeof e.seq&&(t.seq=new s.LongBits(e.seq.low>>>0,e.seq.high>>>0).toNumber(!0))),null!=e.raw&&("string"==typeof e.raw?s.base64.decode(e.raw,t.raw=s.newBuffer(s.base64.length(e.raw)),0):e.raw.length&&(t.raw=e.raw)),t},e.toObject=function(e,t){t||(t={});var r={};if(t.defaults){if(s.Long){var n=new s.Long(0,0,!0);r.seq=t.longs===String?n.toString():t.longs===Number?n.toNumber():n}else r.seq=t.longs===String?"0":0;t.bytes===String?r.raw="":(r.raw=[],t.bytes!==Array&&(r.raw=s.newBuffer(r.raw)))}return null!=e.seq&&e.hasOwnProperty("seq")&&("number"==typeof e.seq?r.seq=t.longs===String?String(e.seq):e.seq:r.seq=t.longs===String?s.Long.prototype.toString.call(e.seq):t.longs===Number?new s.LongBits(e.seq.low>>>0,e.seq.high>>>0).toNumber(!0):e.seq),null!=e.raw&&e.hasOwnProperty("raw")&&(r.raw=t.bytes===String?s.base64.encode(e.raw,0,e.raw.length):t.bytes===Array?Array.prototype.slice.call(e.raw):e.raw),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,n.util.toJSONOptions)},e}(),e}(),e.exports=a},82299:(e,t,r)=>{"use strict";var n=r(62100),i=n.Reader,o=n.Writer,s=n.util,a=n.roots["libp2p-proto-book"]||(n.roots["libp2p-proto-book"]={});a.Protocols=function(){function e(e){if(this.protocols=[],e)for(var t=Object.keys(e),r=0;r>>3==1?(n.protocols&&n.protocols.length||(n.protocols=[]),n.protocols.push(e.string())):e.skipType(7&o)}return n},e.fromObject=function(e){if(e instanceof a.Protocols)return e;var t=new a.Protocols;if(e.protocols){if(!Array.isArray(e.protocols))throw TypeError(".Protocols.protocols: array expected");t.protocols=[];for(var r=0;r{"use strict";const n=r(11227),i=Object.assign(n("libp2p:peer-store:proto-book"),{error:n("libp2p:peer-store:proto-book:err")}),o=r(32114),s=r(88785),a=r(94903),{codes:{ERR_INVALID_PARAMETERS:c}}=r(23416);e.exports=class extends a{constructor(e){super({peerStore:e,eventName:"change:protocols",eventProperty:"protocols",eventTransformer:e=>Array.from(e)}),this.data=new Map}set(e,t){if(!s.isPeerId(e))throw i.error("peerId must be an instance of peer-id to store data"),o(new Error("peerId must be an instance of peer-id"),c);if(!t)throw i.error("protocols must be provided to store data"),o(new Error("protocols must be provided"),c);const r=e.toB58String(),n=this.data.get(r),a=new Set(t);return n&&(f=a,(u=n).size===f.size&&[...u].every((e=>f.has(e))))?(i(`the protocols provided to store are equal to the already stored for ${r}`),this):(this._setData(e,a),i(`stored provided protocols for ${r}`),this);var u,f}add(e,t){if(!s.isPeerId(e))throw i.error("peerId must be an instance of peer-id to store data"),o(new Error("peerId must be an instance of peer-id"),c);if(!t)throw i.error("protocols must be provided to store data"),o(new Error("protocols must be provided"),c);const r=e.toB58String(),n=this.data.get(r)||new Set,a=new Set([...n,...t]);return n.size===a.size?(i(`the protocols provided to store are already stored for ${r}`),this):(this._setData(e,a),i(`added provided protocols for ${r}`),this)}remove(e,t){if(!s.isPeerId(e))throw i.error("peerId must be an instance of peer-id to store data"),o(new Error("peerId must be an instance of peer-id"),c);if(!t)throw i.error("protocols must be provided to store data"),o(new Error("protocols must be provided"),c);const r=e.toB58String(),n=this.data.get(r);if(n){const o=new Set([...n].filter((e=>!t.includes(e))));if(n.size===o.size)return this;this._setData(e,o),i(`removed provided protocols for ${r}`)}return this}}},77667:e=>{"use strict";e.exports={PROTOCOL:"/ipfs/ping/1.0.0",PING_LENGTH:32,PROTOCOL_VERSION:"1.0.0",PROTOCOL_NAME:"ping"}},75466:(e,t,r)=>{"use strict";const n=r(11227),i=Object.assign(n("libp2p:ping"),{error:n("libp2p:ping:err")}),o=r(32114),s=r(49928),{pipe:a}=r(60618),{toBuffer:c}=r(96653),{collect:u,take:f}=r(38386),{equals:l}=r(19588),{PROTOCOL_NAME:h,PING_LENGTH:d,PROTOCOL_VERSION:p}=r(77667);(t=e.exports=async function(e,t){const r=`/${e._config.protocolPrefix}/${h}/${p}`;i("dialing %s to %s",r,t.toB58String?t.toB58String():t);const n=await e.dial(t),{stream:y}=await n.newStream(r),g=Date.now(),b=s.randomBytes(d),[m]=await a([b],y,(e=>f(1,e)),c,u),v=Date.now();if(!l(b,m))throw o(new Error("Received wrong ping ack"),"ERR_WRONG_PING_ACK");return v-g}).mount=function(e){e.handle(`/${e._config.protocolPrefix}/${h}/${p}`,(({stream:e})=>a(e,e)))},t.unmount=function(e){e.unhandle(`/${e._config.protocolPrefix}/${h}/${p}`)}},65993:e=>{"use strict";e.exports=function(e,t,r){const n=new e(t,r);return n._subscribeAdapter=n.subscribe,n._unsubscribeAdapter=n.unsubscribe,n.subscribe=function(e,t){t&&n.on(e,t),n._subscribeAdapter(e)},n.unsubscribe=function(e,t){t?n.removeListener(e,t):n.removeAllListeners(e),0===n.listenerCount(e)&&n._unsubscribeAdapter(e)},n}},60709:(e,t,r)=>{"use strict";var n=r(62100),i=n.Reader,o=n.Writer,s=n.util,a=n.roots["libp2p-envelope"]||(n.roots["libp2p-envelope"]={});a.Envelope=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.publicKey=e.bytes();break;case 2:n.payloadType=e.bytes();break;case 3:n.payload=e.bytes();break;case 5:n.signature=e.bytes();break;default:e.skipType(7&o)}}return n},e.fromObject=function(e){if(e instanceof a.Envelope)return e;var t=new a.Envelope;return null!=e.publicKey&&("string"==typeof e.publicKey?s.base64.decode(e.publicKey,t.publicKey=s.newBuffer(s.base64.length(e.publicKey)),0):e.publicKey.length&&(t.publicKey=e.publicKey)),null!=e.payloadType&&("string"==typeof e.payloadType?s.base64.decode(e.payloadType,t.payloadType=s.newBuffer(s.base64.length(e.payloadType)),0):e.payloadType.length&&(t.payloadType=e.payloadType)),null!=e.payload&&("string"==typeof e.payload?s.base64.decode(e.payload,t.payload=s.newBuffer(s.base64.length(e.payload)),0):e.payload.length&&(t.payload=e.payload)),null!=e.signature&&("string"==typeof e.signature?s.base64.decode(e.signature,t.signature=s.newBuffer(s.base64.length(e.signature)),0):e.signature.length&&(t.signature=e.signature)),t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(t.bytes===String?r.publicKey="":(r.publicKey=[],t.bytes!==Array&&(r.publicKey=s.newBuffer(r.publicKey))),t.bytes===String?r.payloadType="":(r.payloadType=[],t.bytes!==Array&&(r.payloadType=s.newBuffer(r.payloadType))),t.bytes===String?r.payload="":(r.payload=[],t.bytes!==Array&&(r.payload=s.newBuffer(r.payload))),t.bytes===String?r.signature="":(r.signature=[],t.bytes!==Array&&(r.signature=s.newBuffer(r.signature)))),null!=e.publicKey&&e.hasOwnProperty("publicKey")&&(r.publicKey=t.bytes===String?s.base64.encode(e.publicKey,0,e.publicKey.length):t.bytes===Array?Array.prototype.slice.call(e.publicKey):e.publicKey),null!=e.payloadType&&e.hasOwnProperty("payloadType")&&(r.payloadType=t.bytes===String?s.base64.encode(e.payloadType,0,e.payloadType.length):t.bytes===Array?Array.prototype.slice.call(e.payloadType):e.payloadType),null!=e.payload&&e.hasOwnProperty("payload")&&(r.payload=t.bytes===String?s.base64.encode(e.payload,0,e.payload.length):t.bytes===Array?Array.prototype.slice.call(e.payload):e.payload),null!=e.signature&&e.hasOwnProperty("signature")&&(r.signature=t.bytes===String?s.base64.encode(e.signature,0,e.signature.length):t.bytes===Array?Array.prototype.slice.call(e.signature):e.signature),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,n.util.toJSONOptions)},e}(),e.exports=a},31244:(e,t,r)=>{"use strict";const n=r(32114),{concat:i}=r(20605),{fromString:o}=r(52217),s=r(92826),a=r(88785),c=r(31997),{equals:u}=r(19588),{codes:f}=r(23416),{Envelope:l}=r(60709);class h{constructor({peerId:e,payloadType:t,payload:r,signature:n}){this.peerId=e,this.payloadType=t,this.payload=r,this.signature=n,this._marshal=void 0}marshal(){if(this._marshal)return this._marshal;const e=s.marshalPublicKey(this.peerId.pubKey);return this._marshal=l.encode({publicKey:e,payloadType:this.payloadType,payload:this.payload,signature:this.signature}).finish(),this._marshal}equals(e){return u(this.peerId.pubKey.bytes,e.peerId.pubKey.bytes)&&u(this.payloadType,e.payloadType)&&u(this.payload,e.payload)&&u(this.signature,e.signature)}validate(e){const t=d(e,this.payloadType,this.payload);return this.peerId.pubKey.verify(t,this.signature)}}const d=(e,t,r)=>{const n=o(e),s=c.encode(n.byteLength),a=c.encode(t.length),u=c.encode(r.length);return i([new Uint8Array(s),n,new Uint8Array(a),t,new Uint8Array(u),r])};h.createFromProtobuf=async e=>{const t=l.decode(e),r=await a.createFromPubKey(t.publicKey);return new h({peerId:r,payloadType:t.payloadType,payload:t.payload,signature:t.signature})},h.seal=async(e,t)=>{const r=e.domain,n=e.codec,i=e.marshal(),o=d(r,n,i),s=await t.privKey.sign(o);return new h({peerId:t,payloadType:n,payload:i,signature:s})},h.openAndCertify=async(e,t)=>{const r=await h.createFromProtobuf(e);if(!await r.validate(t))throw n(new Error("envelope signature is not valid for the given domain"),f.ERR_SIGNATURE_NOT_VALID);return r},e.exports=h},77854:e=>{"use strict";const t=Uint8Array.from([3,1]);e.exports={ENVELOPE_DOMAIN_PEER_RECORD:"libp2p-peer-record",ENVELOPE_PAYLOAD_TYPE_PEER_RECORD:t}},61131:(e,t,r)=>{"use strict";const{Multiaddr:n}=r(46584),i=r(88785),o=r(52942),{PeerRecord:s}=r(81183),{ENVELOPE_DOMAIN_PEER_RECORD:a,ENVELOPE_PAYLOAD_TYPE_PEER_RECORD:c}=r(77854);class u{constructor({peerId:e,multiaddrs:t=[],seqNumber:r=Date.now()}){this.domain=a,this.codec=c,this.peerId=e,this.multiaddrs=t,this.seqNumber=r,this._marshal=void 0}marshal(){return this._marshal||(this._marshal=s.encode({peerId:this.peerId.toBytes(),seq:this.seqNumber,addresses:this.multiaddrs.map((e=>({multiaddr:e.bytes})))}).finish()),this._marshal}equals(e){return e instanceof u&&!!this.peerId.equals(e.peerId)&&this.seqNumber===e.seqNumber&&!!o(this.multiaddrs,e.multiaddrs)}}u.createFromProtobuf=e=>{const t=s.decode(e),r=i.createFromBytes(t.peerId),o=(t.addresses||[]).map((e=>new n(e.multiaddr))),a=Number(t.seq);return new u({peerId:r,multiaddrs:o,seqNumber:a})},u.DOMAIN=a,e.exports=u},81183:(e,t,r)=>{"use strict";var n=r(62100),i=n.Reader,o=n.Writer,s=n.util,a=n.roots["libp2p-peer-record"]||(n.roots["libp2p-peer-record"]={});a.PeerRecord=function(){function e(e){if(this.addresses=[],e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.peerId=e.bytes();break;case 2:n.seq=e.uint64();break;case 3:n.addresses&&n.addresses.length||(n.addresses=[]),n.addresses.push(a.PeerRecord.AddressInfo.decode(e,e.uint32()));break;default:e.skipType(7&o)}}return n},e.fromObject=function(e){if(e instanceof a.PeerRecord)return e;var t=new a.PeerRecord;if(null!=e.peerId&&("string"==typeof e.peerId?s.base64.decode(e.peerId,t.peerId=s.newBuffer(s.base64.length(e.peerId)),0):e.peerId.length&&(t.peerId=e.peerId)),null!=e.seq&&(s.Long?(t.seq=s.Long.fromValue(e.seq)).unsigned=!0:"string"==typeof e.seq?t.seq=parseInt(e.seq,10):"number"==typeof e.seq?t.seq=e.seq:"object"==typeof e.seq&&(t.seq=new s.LongBits(e.seq.low>>>0,e.seq.high>>>0).toNumber(!0))),e.addresses){if(!Array.isArray(e.addresses))throw TypeError(".PeerRecord.addresses: array expected");t.addresses=[];for(var r=0;r>>0,e.seq.high>>>0).toNumber(!0):e.seq),e.addresses&&e.addresses.length){r.addresses=[];for(var i=0;i>>3==1?n.multiaddr=e.bytes():e.skipType(7&o)}return n},e.fromObject=function(e){if(e instanceof a.PeerRecord.AddressInfo)return e;var t=new a.PeerRecord.AddressInfo;return null!=e.multiaddr&&("string"==typeof e.multiaddr?s.base64.decode(e.multiaddr,t.multiaddr=s.newBuffer(s.base64.length(e.multiaddr)),0):e.multiaddr.length&&(t.multiaddr=e.multiaddr)),t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(t.bytes===String?r.multiaddr="":(r.multiaddr=[],t.bytes!==Array&&(r.multiaddr=s.newBuffer(r.multiaddr)))),null!=e.multiaddr&&e.hasOwnProperty("multiaddr")&&(r.multiaddr=t.bytes===String?s.base64.encode(e.multiaddr,0,e.multiaddr.length):t.bytes===Array?Array.prototype.slice.call(e.multiaddr):e.multiaddr),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,n.util.toJSONOptions)},e}(),e}(),e.exports=a},1001:(e,t,r)=>{"use strict";const n=r(31244),i=r(61131);e.exports.updateSelfPeerRecord=async function(e){const t=new i({peerId:e.peerId,multiaddrs:e.multiaddrs}),r=await n.seal(t,e.peerId);e.peerStore.addressBook.consumePeerRecord(r)}},28861:(e,t,r)=>{"use strict";const n=r(11227),i=Object.assign(n("libp2p:registrar"),{error:n("libp2p:registrar:err")}),o=r(32114),{codes:{ERR_INVALID_PARAMETERS:s}}=r(23416),a=r(7609);e.exports=class{constructor({peerStore:e,connectionManager:t}){this.peerStore=e,this.connectionManager=t,this.topologies=new Map,this._handle=void 0,this._onDisconnect=this._onDisconnect.bind(this),this.connectionManager.on("peer:disconnect",this._onDisconnect)}get handle(){return this._handle}set handle(e){this._handle=e}getConnection(e){return this.connectionManager.get(e)}register(e){if(!a.isTopology(e))throw i.error("topology must be an instance of interfaces/topology"),o(new Error("topology must be an instance of interfaces/topology"),s);const t=(1e9*Math.random()).toString(36)+Date.now();return this.topologies.set(t,e),e.registrar=this,t}unregister(e){return this.topologies.delete(e)}_onDisconnect(e){for(const[,t]of this.topologies)t.disconnect(e.remotePeer)}}},6984:(e,t,r)=>{"use strict";const n=r(11227),i=Object.assign(n("libp2p:transports"),{error:n("libp2p:transports:err")}),o=r(13296),{codes:s}=r(23416),a=r(32114),{updateSelfPeerRecord:c}=r(1001);class u{constructor({libp2p:e,upgrader:t,faultTolerance:r=f.FATAL_ALL}){this.libp2p=e,this.upgrader=t,this._transports=new Map,this._listeners=new Map,this._listenerOptions=new Map,this.faultTolerance=r}add(e,t,r={}){if(i("adding %s",e),!e)throw a(new Error(`Transport must have a valid key, was given '${e}'`),s.ERR_INVALID_KEY);if(this._transports.has(e))throw a(new Error("There is already a transport with this key"),s.ERR_DUPLICATE_TRANSPORT);const n=new t({...r,libp2p:this.libp2p,upgrader:this.upgrader});this._transports.set(e,n),this._listenerOptions.set(e,r.listenerOptions||{}),this._listeners.has(e)||this._listeners.set(e,[])}async close(){const e=[];for(const[t,r]of this._listeners)for(i("closing listeners for %s",t);r.length;){const t=r.pop();t.removeAllListeners("listening"),t.removeAllListeners("close"),e.push(t.close())}await Promise.all(e),i("all listeners closed");for(const e of this._listeners.keys())this._listeners.set(e,[])}async dial(e,t){const r=this.transportForMultiaddr(e);if(!r)throw a(new Error(`No transport available for address ${String(e)}`),s.ERR_TRANSPORT_UNAVAILABLE);try{return await r.dial(e,t)}catch(e){throw e.code||(e.code=s.ERR_TRANSPORT_DIAL_FAILED),e}}getAddrs(){let e=[];for(const t of this._listeners.values())for(const r of t)e=[...e,...r.getAddrs()];return e}getTransports(){return this._transports.values()}transportForMultiaddr(e){for(const t of this._transports.values())if(t.filter([e]).length)return t;return null}async listen(e){if(!e||0===e.length)return void i("no addresses were provided for listening, this node is dial only");const t=[];for(const[r,n]of this._transports.entries()){const u=n.filter(e),l=[];for(const e of u){i("creating listener for %s on %s",r,e);const t=n.createListener(this._listenerOptions.get(r));this._listeners.get(r).push(t),t.on("listening",(()=>c(this.libp2p))),t.on("close",(()=>c(this.libp2p))),l.push(t.listen(e))}if(0!==l.length){if(!(await o(l)).find((e=>!0===e.isFulfilled))&&this.faultTolerance!==f.NO_FATAL)throw a(new Error(`Transport (${r}) could not listen on any available address`),s.ERR_NO_VALID_ADDRESSES)}else t.push(r)}if(t.length===this._transports.size){const e=`no valid addresses were provided for transports [${t}]`;if(this.faultTolerance===f.FATAL_ALL)throw a(new Error(e),s.ERR_NO_VALID_ADDRESSES);i(`libp2p in dial mode only: ${e}`)}}async remove(e){if(i("removing %s",e),this._listeners.has(e))for(const t of this._listeners.get(e))t.removeAllListeners("listening"),t.removeAllListeners("close"),await t.close();this._transports.delete(e),this._listeners.delete(e)}async removeAll(){const e=[];for(const t of this._transports.keys())e.push(this.remove(t));await Promise.all(e)}}const f={FATAL_ALL:0,NO_FATAL:1};u.FaultTolerance=f,e.exports=u},21003:(e,t,r)=>{"use strict";const n=r(11227),i=Object.assign(n("libp2p:upgrader"),{error:n("libp2p:upgrader:err")}),o=r(32114),s=r(8738),{Connection:a}=r(15458),c=r(88785),{pipe:u}=r(60618),f=r(99633),{codes:l}=r(23416);e.exports=class{constructor({localPeer:e,metrics:t,cryptos:r=new Map,muxers:n=new Map,onConnectionEnd:i=(()=>{}),onConnection:o=(()=>{})}){this.localPeer=e,this.metrics=t,this.cryptos=r,this.muxers=n,this.protector=null,this.protocols=new Map,this.onConnection=o,this.onConnectionEnd=i}async upgradeInbound(e){let t,r,n,o,s,a,c;if(this.metrics){({setTarget:a,proxy:c}=f());const t=(1e9*Math.random()).toString(36)+Date.now();a({toB58String:()=>t}),e=this.metrics.trackStream({stream:e,remotePeer:c})}i("Starting the inbound connection upgrade");let u=e;this.protector&&(u=await this.protector.protect(e));try{({conn:t,remotePeer:r,protocol:s}=await this._encryptInbound(this.localPeer,u,this.cryptos)),this.muxers.size?({stream:n,Muxer:o}=await this._multiplexInbound(t,this.muxers)):n=t}catch(t){throw i.error("Failed to upgrade inbound connection",t),await e.close(t),t}return this.metrics&&(this.metrics.updatePlaceholder(c,r),a(r)),i("Successfully upgraded inbound connection"),this._createConnection({cryptoProtocol:s,direction:"inbound",maConn:e,upgradedConn:n,Muxer:o,remotePeer:r})}async upgradeOutbound(e){const t=e.remoteAddr.getPeerId();if(!t)throw o(new Error("outbound connection must have a peer id"),l.ERR_INVALID_MULTIADDR);const r=c.createFromB58String(t);let n,s,a,u,h,d,p;if(this.metrics){({setTarget:d,proxy:p}=f());const t=(1e9*Math.random()).toString(36)+Date.now();d({toB58String:()=>t}),e=this.metrics.trackStream({stream:e,remotePeer:p})}i("Starting the outbound connection upgrade");let y=e;this.protector&&(y=await this.protector.protect(e));try{({conn:n,remotePeer:s,protocol:u}=await this._encryptOutbound(this.localPeer,y,r,this.cryptos)),this.muxers.size?({stream:a,Muxer:h}=await this._multiplexOutbound(n,this.muxers)):a=n}catch(t){throw i.error("Failed to upgrade outbound connection",t),await e.close(t),t}return this.metrics&&(this.metrics.updatePlaceholder(p,s),d(s)),i("Successfully upgraded outbound connection"),this._createConnection({cryptoProtocol:u,direction:"outbound",maConn:e,upgradedConn:a,Muxer:h,remotePeer:s})}_createConnection({cryptoProtocol:e,direction:t,maConn:r,upgradedConn:n,Muxer:c,remotePeer:f}){let h,d,p;c&&(h=new c({onStream:async e=>{if(!p)return;const r=new s.Listener(e);try{const{stream:n,protocol:o}=await r.handle(Array.from(this.protocols.keys()));i("%s: incoming stream opened on %s",t,o),this.metrics&&this.metrics.trackStream({stream:n,remotePeer:f,protocol:o}),p.addStream(e,{protocol:o}),this._onStream({connection:p,stream:{...e,...n},protocol:o})}catch(e){i.error(e)}},onStreamEnd:e=>{p.removeStream(e.id)}}),d=async e=>{i("%s: starting new stream on %s",t,e);const r=h.newStream(),n=new s.Dialer(r);try{const{stream:t,protocol:i}=await n.select(e);return this.metrics&&this.metrics.trackStream({stream:t,remotePeer:f,protocol:i}),{stream:{...r,...t},protocol:i}}catch(e){throw i.error("could not create new stream",e),o(e,l.ERR_UNSUPPORTED_PROTOCOL)}},u(n,h,n).catch(i.error));const y=r.timeline;r.timeline=new Proxy(y,{set:(...e)=>(p&&"close"===e[1]&&e[2]&&!y.close&&(async()=>{try{"open"===p.stat.status&&await p.close()}catch(e){i.error(e)}finally{this.onConnectionEnd(p)}})(),Reflect.set(...e))}),r.timeline.upgraded=Date.now();const g=()=>{throw o(new Error("connection is not multiplexed"),"ERR_CONNECTION_NOT_MULTIPLEXED")};return p=new a({localAddr:r.localAddr,remoteAddr:r.remoteAddr,localPeer:this.localPeer,remotePeer:f,stat:{direction:t,timeline:r.timeline,multiplexer:c&&c.multicodec,encryption:e},newStream:d||g,getStreams:()=>h?h.streams:g(),close:async()=>{await r.close(),h&&h.streams.map((e=>e.abort()))}}),this.onConnection(p),p}_onStream({connection:e,stream:t,protocol:r}){this.protocols.get(r)({connection:e,stream:t,protocol:r})}async _encryptInbound(e,t,r){const n=new s.Listener(t),a=Array.from(r.keys());i("handling inbound crypto protocol selection",a);try{const{stream:t,protocol:o}=await n.handle(a),s=r.get(o);if(i("encrypting inbound connection..."),!s)throw new Error(`no crypto module found for ${o}`);return{...await s.secureInbound(e,t),protocol:o}}catch(e){throw o(e,l.ERR_ENCRYPTION_FAILED)}}async _encryptOutbound(e,t,r,n){const a=new s.Dialer(t),c=Array.from(n.keys());i("selecting outbound crypto protocol",c);try{const{stream:t,protocol:o}=await a.select(c),s=n.get(o);if(i("encrypting outbound connection to %j",r),!s)throw new Error(`no crypto module found for ${o}`);return{...await s.secureOutbound(e,t,r),protocol:o}}catch(e){throw o(e,l.ERR_ENCRYPTION_FAILED)}}async _multiplexOutbound(e,t){const r=new s.Dialer(e),n=Array.from(t.keys());i("outbound selecting muxer %s",n);try{const{stream:e,protocol:o}=await r.select(n);return i("%s selected as muxer protocol",o),{stream:e,Muxer:t.get(o)}}catch(e){throw o(e,l.ERR_MUXER_UNAVAILABLE)}}async _multiplexInbound(e,t){const r=new s.Listener(e),n=Array.from(t.keys());i("inbound handling muxers %s",n);try{const{stream:e,protocol:i}=await r.handle(n);return{stream:e,Muxer:t.get(i)}}catch(e){throw o(e,l.ERR_MUXER_UNAVAILABLE)}}}},2043:function(e,t,r){var n,i;!function(o,s){"use strict";n=function(){var e=function(){},t="undefined",r=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),n=["trace","debug","info","warn","error"];function i(e,t){var r=e[t];if("function"==typeof r.bind)return r.bind(e);try{return Function.prototype.bind.call(r,e)}catch(t){return function(){return Function.prototype.apply.apply(r,[e,arguments])}}}function o(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function s(n){return"debug"===n&&(n="log"),typeof console!==t&&("trace"===n&&r?o:void 0!==console[n]?i(console,n):void 0!==console.log?i(console,"log"):e)}function a(t,r){for(var i=0;i=0&&r<=s.levels.SILENT))throw"log.setLevel() called with invalid level: "+r;if(o=r,!1!==i&&function(e){var r=(n[e]||"silent").toUpperCase();if(typeof window!==t&&c){try{return void(window.localStorage[c]=r)}catch(e){}try{window.document.cookie=encodeURIComponent(c)+"="+r+";"}catch(e){}}}(r),a.call(s,r,e),typeof console===t&&r{"use strict";const{Multiaddr:n}=r(46584),i=k("dns4"),o=k("dns6"),s=k("dnsaddr"),a=R(k("dns"),s,i,o),c=R(k("ip4"),k("ip6")),u=R(P(c,k("tcp")),P(a,k("tcp"))),f=P(c,k("udp")),l=P(f,k("utp")),h=P(f,k("quic")),d=R(P(u,k("ws")),P(a,k("ws"))),p=R(P(u,k("wss")),P(a,k("wss"))),y=R(P(u,k("http")),P(c,k("http")),P(a,k("http"))),g=R(P(u,k("https")),P(c,k("https")),P(a,k("https"))),b=R(P(d,k("p2p-webrtc-star"),k("p2p")),P(p,k("p2p-webrtc-star"),k("p2p")),P(d,k("p2p-webrtc-star")),P(p,k("p2p-webrtc-star"))),m=R(P(d,k("p2p-websocket-star"),k("p2p")),P(p,k("p2p-websocket-star"),k("p2p")),P(d,k("p2p-websocket-star")),P(p,k("p2p-websocket-star"))),v=R(P(y,k("p2p-webrtc-direct"),k("p2p")),P(g,k("p2p-webrtc-direct"),k("p2p")),P(y,k("p2p-webrtc-direct")),P(g,k("p2p-webrtc-direct"))),w=R(d,p,y,g,b,v,u,l,h,a),E=R(P(w,k("p2p-stardust"),k("p2p")),P(w,k("p2p-stardust"))),_=R(P(w,k("p2p")),b,v,k("p2p")),S=R(P(_,k("p2p-circuit"),_),P(_,k("p2p-circuit")),P(k("p2p-circuit"),_),P(w,k("p2p-circuit")),P(k("p2p-circuit"),w),k("p2p-circuit")),A=()=>R(P(S,A),S),T=A(),I=R(P(T,_,T),P(_,T),P(T,_),T,_);function C(e){return function(t){if(!n.isMultiaddr(t))try{t=new n(t)}catch(e){return!1}const r=e(t.protoNames());return null!==r&&(!0===r||!1===r?r:0===r.length)}}function P(...e){function t(t){if(t.length(r="function"==typeof e?e().partialMatch(t):e.partialMatch(t),Array.isArray(r)&&(t=r),null===r))),r}return{toString:function(){return"{ "+e.join(" ")+" }"},input:e,matches:C(t),partialMatch:t}}function R(...e){function t(t){let r=null;return e.some((e=>{const n="function"==typeof e?e().partialMatch(t):e.partialMatch(t);return!!n&&(r=n,!0)})),r}return{toString:function(){return"{ "+e.join(" ")+" }"},input:e,matches:C(t),partialMatch:t}}function k(e){const t=e;return{toString:function(){return t},matches:function(e){let r;if("string"==typeof e||e instanceof Uint8Array)try{r=new n(e)}catch(e){return!1}else r=e;const i=r.protoNames();return 1===i.length&&i[0]===t},partialMatch:function(e){return 0===e.length?null:e[0]===t?e.slice(1):null}}}e.exports={DNS:a,DNS4:i,DNS6:o,DNSADDR:s,IP:c,TCP:u,UDP:f,QUIC:h,UTP:l,HTTP:y,HTTPS:g,WebSockets:d,WebSocketsSecure:p,WebSocketStar:m,WebRTCStar:b,WebRTCDirect:v,Reliable:w,Stardust:E,Circuit:T,P2P:I,IPFS:I}},70942:function(e,t,r){"use strict";const n=r(33310),{hasOwnProperty:i}=Object.prototype,{propertyIsEnumerable:o}=Object,s=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0}),a=this,c={concatArrays:!1,ignoreUndefined:!1},u=e=>{const t=[];for(const r in e)i.call(e,r)&&t.push(r);if(Object.getOwnPropertySymbols){const r=Object.getOwnPropertySymbols(e);for(const n of r)o.call(e,n)&&t.push(n)}return t};function f(e){return Array.isArray(e)?function(e){const t=e.slice(0,0);return u(e).forEach((r=>{s(t,r,f(e[r]))})),t}(e):n(e)?function(e){const t=null===Object.getPrototypeOf(e)?Object.create(null):{};return u(e).forEach((r=>{s(t,r,f(e[r]))})),t}(e):e}const l=(e,t,r,n)=>(r.forEach((r=>{void 0===t[r]&&n.ignoreUndefined||(r in e&&e[r]!==Object.getPrototypeOf(e)?s(e,r,h(e[r],t[r],n)):s(e,r,f(t[r])))})),e);function h(e,t,r){return r.concatArrays&&Array.isArray(e)&&Array.isArray(t)?((e,t,r)=>{let n=e.slice(0,0),o=0;return[e,t].forEach((t=>{const a=[];for(let r=0;r!a.includes(e))),r)})),n})(e,t,r):n(t)&&n(e)?l(e,t,u(t),r):f(t)}e.exports=function(...e){const t=h(f(c),this!==a&&this||{},c);let r={_:{}};for(const i of e)if(void 0!==i){if(!n(i))throw new TypeError("`"+i+"` is not an Option Object");r=h(r,{_:i},t)}return r._}},79746:e=>{function t(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=t,t.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)}},34504:(e,t)=>{"use strict";var r=t;function n(e){return 1===e.length?"0"+e:e}function i(e){for(var t="",r=0;r>8,s=255&i;o?r.push(o,s):r.push(s)}return r},r.zero2=n,r.toHex=i,r.encode=function(e,t){return"hex"===t?i(e):e}},57824:e=>{var t=1e3,r=60*t,n=60*r,i=24*n;function o(e,t,r,n){var i=t>=1.5*r;return Math.round(e/r)+" "+n+(i?"s":"")}e.exports=function(e,s){s=s||{};var a,c,u=typeof e;if("string"===u&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var o=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(o){var s=parseFloat(o[1]);switch((o[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*s;case"weeks":case"week":case"w":return 6048e5*s;case"days":case"day":case"d":return s*i;case"hours":case"hour":case"hrs":case"hr":case"h":return s*n;case"minutes":case"minute":case"mins":case"min":case"m":return s*r;case"seconds":case"second":case"secs":case"sec":case"s":return s*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s;default:return}}}}(e);if("number"===u&&isFinite(e))return s.long?(a=e,(c=Math.abs(a))>=i?o(a,c,i,"day"):c>=n?o(a,c,n,"hour"):c>=r?o(a,c,r,"minute"):c>=t?o(a,c,t,"second"):a+" ms"):function(e){var o=Math.abs(e);return o>=i?Math.round(e/i)+"d":o>=n?Math.round(e/n)+"h":o>=r?Math.round(e/r)+"m":o>=t?Math.round(e/t)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},15602:e=>{e.exports=function e(t,r){var n,i=0,o=0,s=r=r||0,a=t.length;do{if(s>=a||o>49)throw e.bytes=0,new RangeError("Could not decode varint");n=t[s++],i+=o<28?(127&n)<=128);return e.bytes=s-r,i}},62137:e=>{e.exports=function e(r,n,i){if(Number.MAX_SAFE_INTEGER&&r>Number.MAX_SAFE_INTEGER)throw e.bytes=0,new RangeError("Could not encode varint");n=n||[];for(var o=i=i||0;r>=t;)n[i++]=255&r|128,r/=128;for(;-128&r;)n[i++]=255&r|128,r>>>=7;return n[i]=0|r,e.bytes=i-o+1,n};var t=Math.pow(2,31)},57328:(e,t,r)=>{e.exports={encode:r(62137),decode:r(15602),encodingLength:r(27766)}},27766:e=>{var t=Math.pow(2,7),r=Math.pow(2,14),n=Math.pow(2,21),i=Math.pow(2,28),o=Math.pow(2,35),s=Math.pow(2,42),a=Math.pow(2,49),c=Math.pow(2,56),u=Math.pow(2,63);e.exports=function(e){return e{"use strict";const n=r(99918),i=r(89768),o=r(57328),{concat:s}=r(20605),{toString:a}=r(92263);function c(e){const t=[],r=e.split("/").slice(1);if(1===r.length&&""===r[0])return[];for(let n=0;n=r.length)throw v("invalid address: "+e);if(s.path){t.push([o,m(r.slice(n).join("/"))]);break}t.push([o,r[n]])}else t.push([o])}return t}function u(e){const t=[];return e.map((e=>{const r=w(e);return t.push(r.name),e.length>1&&t.push(e[1]),null})),m(t.join("/"))}function f(e){return e.map((e=>{Array.isArray(e)||(e=[e]);const t=w(e);return e.length>1?[t.code,n.toBytes(t.code,e[1])]:[t.code]}))}function l(e){return e.map((e=>{const t=w(e);return e[1]?[t.code,n.toString(t.code,e[1])]:[t.code]}))}function h(e){return g(s(e.map((e=>{const t=w(e);let r=Uint8Array.from(o.encode(t.code));return e.length>1&&(r=s([r,e[1]])),r}))))}function d(e,t){return e.size>0?e.size/8:0===e.size?0:o.decode(t)+o.decode.bytes}function p(e){const t=[];let r=0;for(;re.length)throw v("Invalid address Uint8Array: "+a(e,"base16"));t.push([n,u])}return t}function y(e){return h(f(c(e=m(e))))}function g(e){const t=b(e);if(t)throw t;return Uint8Array.from(e)}function b(e){try{p(e)}catch(e){return e}}function m(e){return"/"+e.trim().split("/").filter((e=>e)).join("/")}function v(e){return new Error("Error parsing address: "+e)}function w(e){return i(e[0])}e.exports={stringToStringTuples:c,stringTuplesToString:u,tuplesToStringTuples:l,stringTuplesToTuples:f,bytesToTuples:p,tuplesToBytes:h,bytesToString:function(e){return u(l(p(e)))},stringToBytes:y,fromString:function(e){return y(e)},fromBytes:g,validateBytes:b,isValidBytes:function(e){return void 0===b(e)},cleanPath:m,ParseError:v,protoFromTuple:w,sizeForAddr:d}},99918:(e,t,r)=>{"use strict";const n=r(33692),i=r(89768),{CID:o}=r(81362),{base32:s}=r(22817),{base58btc:a}=r(99086),c=r(28924),u=r(57328),{toString:f}=r(92263),{fromString:l}=r(52217),{concat:h}=r(20605);function d(e,t){return t instanceof Uint8Array?d.toString(e,t):d.toBytes(e,t)}function p(e){const t=new ArrayBuffer(2);return new DataView(t).setUint16(0,e),new Uint8Array(t)}function y(e){return new DataView(e.buffer).getUint16(e.byteOffset)}e.exports=d,d.toString=function(e,t){switch(i(e).code){case 4:case 41:return function(e){const t=n.toString(e);if(!t||!n.isIP(t))throw new Error("invalid ip address");return t}(t);case 6:case 273:case 33:case 132:return y(t).toString();case 53:case 54:case 55:case 56:case 400:case 777:return function(e){const t=u.decode(e);if((e=e.slice(u.decode.bytes)).length!==t)throw new Error("inconsistent lengths");return f(e)}(t);case 421:return function(e){const t=u.decode(e),r=e.slice(u.decode.bytes);if(r.length!==t)throw new Error("inconsistent lengths");return f(r,"base58btc")}(t);case 444:case 445:return function(e){const t=e.slice(0,e.length-2),r=e.slice(e.length-2);return f(t,"base32")+":"+y(r)}(t);default:return f(t,"base16")}},d.toBytes=function(e,t){switch(i(e).code){case 4:case 41:return function(e){if(!n.isIP(e))throw new Error("invalid ip address");return n.toBytes(e)}(t);case 6:case 273:case 33:case 132:return p(parseInt(t,10));case 53:case 54:case 55:case 56:case 400:case 777:return function(e){const t=l(e),r=Uint8Array.from(u.encode(t.length));return h([r,t],r.length+t.length)}(t);case 421:return function(e){let t;t="Q"===e[0]||"1"===e[0]?c.decode(a.decode(`z${e}`)).bytes:o.parse(e).multihash.bytes;const r=Uint8Array.from(u.encode(t.length));return h([r,t],r.length+t.length)}(t);case 444:return function(e){const t=e.split(":");if(2!==t.length)throw new Error("failed to parse onion addr: "+t+" does not contain a port number");if(16!==t[0].length)throw new Error("failed to parse onion addr: "+t[0]+" not a Tor onion address.");const r=s.decode("b"+t[0]),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");const i=p(n);return h([r,i],r.length+i.length)}(t);case 445:return function(e){const t=e.split(":");if(2!==t.length)throw new Error("failed to parse onion addr: "+t+" does not contain a port number");if(56!==t[0].length)throw new Error("failed to parse onion addr: "+t[0]+" not a Tor onion3 address.");const r=s.decode("b"+t[0]),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");const i=p(n);return h([r,i],r.length+i.length)}(t);default:return l(t,"base16")}}},46584:(e,t,r)=>{"use strict";const n=r(18190),i=r(89768),o=r(57328),{CID:s}=r(81362),{base58btc:a}=r(99086),c=r(32114),u=Symbol.for("nodejs.util.inspect.custom"),{toString:f}=r(92263),{equals:l}=r(19588),h=new Map,d=Symbol.for("@multiformats/js-multiaddr/multiaddr");class p{constructor(e){if(null==e&&(e=""),Object.defineProperty(this,d,{value:!0}),e instanceof Uint8Array)this.bytes=n.fromBytes(e);else if("string"==typeof e){if(e.length>0&&"/"!==e.charAt(0))throw new Error(`multiaddr "${e}" must start with a "/"`);this.bytes=n.fromString(e)}else{if(!p.isMultiaddr(e))throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=n.fromBytes(e.bytes)}}toString(){return n.bytesToString(this.bytes)}toJSON(){return this.toString()}toOptions(){const e={},t=this.toString().split("/");return e.family="ip4"===t[1]?4:6,e.host=t[2],e.transport=t[3],e.port=parseInt(t[4]),e}protos(){return this.protoCodes().map((e=>Object.assign({},i(e))))}protoCodes(){const e=[],t=this.bytes;let r=0;for(;re.name))}tuples(){return n.bytesToTuples(this.bytes)}stringTuples(){const e=n.bytesToTuples(this.bytes);return n.tuplesToStringTuples(e)}encapsulate(e){return e=new p(e),new p(this.toString()+e.toString())}decapsulate(e){const t=e.toString(),r=this.toString(),n=r.lastIndexOf(t);if(n<0)throw new Error("Address "+this+" does not contain subaddress: "+e);return new p(r.slice(0,n))}decapsulateCode(e){const t=this.tuples();for(let r=t.length-1;r>=0;r--)if(t[r][0]===e)return new p(n.tuplesToBytes(t.slice(0,r)));return this}getPeerId(){try{const e=this.stringTuples().filter((e=>e[0]===i.names.ipfs.code)),t=e.pop();if(t&&t[1]){const e=t[1];return"Q"===e[0]||"1"===e[0]?f(a.decode(`z${e}`),"base58btc"):f(s.parse(e).multihash.bytes,"base58btc")}return null}catch(e){return null}}getPath(){let e=null;try{e=this.stringTuples().filter((e=>!!i(e[0]).path))[0][1],e||(e=null)}catch(t){e=null}return e}equals(e){return l(this.bytes,e.bytes)}async resolve(){const e=this.protos().find((e=>e.resolvable));if(!e)return[this];const t=h.get(e.name);if(!t)throw c(new Error(`no available resolver for ${e.name}`),"ERR_NO_AVAILABLE_RESOLVER");return(await t(this)).map((e=>new p(e)))}nodeAddress(){const e=this.protoCodes(),t=this.protoNames(),r=this.toString().split("/").slice(1);if(r.length<4)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6}/{address}/{tcp, udp}/{port}".');if(4!==e[0]&&41!==e[0]&&54!==e[0]&&55!==e[0])throw new Error(`no protocol with name: "'${t[0]}'". Must have a valid family name: "{ip4, ip6, dns4, dns6}".`);if("tcp"!==r[2]&&"udp"!==r[2])throw new Error(`no protocol with name: "'${t[1]}'". Must have a valid transport protocol: "{tcp, udp}".`);return{family:41===e[0]||55===e[0]?6:4,address:r[1],port:parseInt(r[3])}}isThinWaistAddress(e){const t=(e||this).protos();return!(2!==t.length||4!==t[0].code&&41!==t[0].code||6!==t[1].code&&273!==t[1].code)}static fromNodeAddress(e,t){if(!e)throw new Error("requires node address object");if(!t)throw new Error("requires transport protocol");let r;switch(e.family){case 4:r="ip4";break;case 6:r="ip6";break;default:throw Error(`Invalid addr family. Got '${e.family}' instead of 4 or 6`)}return new p("/"+[r,e.address,t,e.port].join("/"))}static isName(e){return!!p.isMultiaddr(e)&&e.protos().some((e=>e.resolvable))}static isMultiaddr(e){return e instanceof p||Boolean(e&&e[d])}[u](){return""}inspect(){return""}}p.protocols=i,p.resolvers=h,e.exports={Multiaddr:p,multiaddr:function(e){return new p(e)},protocols:i,resolvers:h}},33692:(e,t,r)=>{"use strict";const n=r(5003),{toString:i}=r(92263),o=n,s=n.v4,a=n.v6,c=function(e,t,r){let n;if(r=~~r,s(e))n=t||new Uint8Array(r+4),e.split(/\./g).map((function(e){n[r++]=255&parseInt(e,10)}));else if(a(e)){const o=e.split(":",8);let a;for(a=0;a0;a--)e.push("0");o.splice.apply(o,e)}for(n=t||new Uint8Array(r+16),a=0;a>8&255,n[r++]=255&e}}if(!n)throw Error("Invalid ip address: "+e);return n};e.exports={isIP:o,isV4:s,isV6:a,toBytes:c,toString:function(e,t,r){t=~~t,r=r||e.length-t;const n=[];let i;const o=new DataView(e.buffer);if(4===r){for(let i=0;i{"use strict";function t(e){if("number"==typeof e){if(t.codes[e])return t.codes[e];throw new Error("no protocol with code: "+e)}if("string"==typeof e){if(t.names[e])return t.names[e];throw new Error("no protocol with name: "+e)}throw new Error("invalid protocol id type: "+e)}const r=-1;function n(e,t,r,n,i){return{code:e,size:t,name:r,resolvable:Boolean(n),path:Boolean(i)}}t.lengthPrefixedVarSize=r,t.V=r,t.table=[[4,32,"ip4"],[6,16,"tcp"],[33,16,"dccp"],[41,128,"ip6"],[42,r,"ip6zone"],[53,r,"dns","resolvable"],[54,r,"dns4","resolvable"],[55,r,"dns6","resolvable"],[56,r,"dnsaddr","resolvable"],[132,16,"sctp"],[273,16,"udp"],[275,0,"p2p-webrtc-star"],[276,0,"p2p-webrtc-direct"],[277,0,"p2p-stardust"],[290,0,"p2p-circuit"],[301,0,"udt"],[302,0,"utp"],[400,r,"unix",!1,"path"],[421,r,"ipfs"],[421,r,"p2p"],[443,0,"https"],[444,96,"onion"],[445,296,"onion3"],[446,r,"garlic64"],[460,0,"quic"],[477,0,"ws"],[478,0,"wss"],[479,0,"p2p-websocket-star"],[480,0,"http"],[777,r,"memory"]],t.names={},t.codes={},t.table.map((e=>{const r=n.apply(null,e);return t.codes[r.code]=r,t.names[r.name]=r,null})),t.object=n,e.exports=t},56557:(e,t,r)=>{"use strict";const n=r(926);e.exports=n},39004:(e,t,r)=>{"use strict";const n=r(89768),{code:i}=n("dnsaddr");e.exports={dnsaddrResolver:async function(e){const t=new(r(56557)),n=e.getPeerId(),[,o]=e.stringTuples().find((([e])=>e===i))||[];let s=(await t.resolveTxt(`_dnsaddr.${o}`)).flat().map((e=>e.split("=")[1]));return n&&(s=s.filter((e=>e.includes(n)))),s}}},16159:(e,t,r)=>{"use strict";const{Buffer:n}=r(48764),i=r(9668),o=r(92877),s=4194304,a=n.alloc(0),c="readLength",u="readData",f={[c]:(e,t,r,n)=>{let o;t=t.append(e);try{o=n.lengthDecoder(t)}catch(e){if(t.length>n.maxLengthLength)throw Object.assign(e,{message:"message length too long",code:"ERR_MSG_LENGTH_TOO_LONG"});if(e instanceof RangeError)return{mode:c,buffer:t,chunk:void 0,state:void 0,data:void 0};throw e}if(o>n.maxDataLength)throw Object.assign(new Error("message data too long"),{code:"ERR_MSG_DATA_TOO_LONG"});return e=t.shallowSlice(n.lengthDecoder.bytes),t=new i,n.onLength&&n.onLength(o),o<=0?(n.onData&&n.onData(a),{mode:c,chunk:e,buffer:t,data:a}):{mode:u,chunk:e,buffer:t,state:{dataLength:o},data:void 0}},[u]:(e,t,r,n)=>{if(t=t.append(e),!r)throw new Error("state is required");if(t.lengtho?t.shallowSlice(o):void 0;return t=new i,n.onData&&n.onData(s),{mode:c,chunk:a,buffer:t,state:void 0,data:s}}};function l(e){const t={lengthDecoder:(e=e||{}).lengthDecoder||o,maxLengthLength:e.maxLengthLength||8,maxDataLength:e.maxDataLength||s,onLength:e.onLength,onData:e.onData};return async function*(e){let r,n=new i,o=c;for await(const i of e){let e=i;for(;e;){const i=f[o](e,n,r,t);o=i.mode,e=i.chunk,n=i.buffer,r=i.state,i.data&&(yield i.data)}}if(n.length)throw Object.assign(new Error("unexpected end of input"),{code:"ERR_UNEXPECTED_EOF"})}}l.fromReader=(e,t)=>{let r=1;const n={[Symbol.asyncIterator](){return this},next:async()=>{try{return await e.next(r)}catch(e){if("ERR_UNDER_READ"===e.code)return{done:!0,value:null};throw e}finally{r=1}}};return l({...t||{},onLength:e=>{r=e}})(n)},e.exports=l,e.exports.MAX_LENGTH_LENGTH=8,e.exports.MAX_DATA_LENGTH=s},98025:(e,t,r)=>{"use strict";const{Buffer:n}=r(48764),i=r(9668),o=r(17448);function s(e){e=e||{};const t=Math.max(e.poolSize||10240,e.minPoolSize||8),r=e.lengthEncoder||o;return async function*(e){let o=n.alloc(t),s=0;for await(const a of e){r(a.length,o,s);const e=o.slice(s,s+r.bytes);s+=r.bytes,o.length-s<8&&(o=n.alloc(t),s=0),yield(new i).append(e).append(a)}}}s.single=(e,t)=>{const r=(t=t||{}).lengthEncoder||o;return new i([r(e.length),e.slice()])},e.exports=s,e.exports.MIN_POOL_SIZE=8,e.exports.DEFAULT_POOL_SIZE=10240},88567:(e,t,r)=>{"use strict";t.encode=r(98025),t.decode=r(16159),t.varintEncode=r(17448),t.varintDecode=r(92877),t.int32BEEncode=r(83681),t.int32BEDecode=r(56063)},56063:e=>{"use strict";const t=e=>{if(e.length<4)throw RangeError("Could not decode int32BE");return e.readInt32BE(0)};t.bytes=4,e.exports=t},83681:(e,t,r)=>{"use strict";const{Buffer:n}=r(48764),i=(e,t,r)=>((t=t||n.allocUnsafe(4)).writeInt32BE(e,r),t);i.bytes=4,e.exports=i},92877:(e,t,r)=>{"use strict";const n=r(83387),{Buffer:i}=r(48764),o=e=>{const t=n.decode(i.isBuffer(e)?e:(r=e,new Proxy({},{get:(e,t)=>"l"===t[0]?r[t]:r.get(parseInt(t))})));var r;return o.bytes=n.decode.bytes,t};e.exports=o},17448:(e,t,r)=>{"use strict";const n=r(83387),{Buffer:i}=r(48764),o=(e,t,r)=>{const s=n.encode(e,t,r);return o.bytes=n.encode.bytes,t||i.from(s)};e.exports=o},70419:e=>{e.exports=function e(t,r){var n,i=0,o=0,s=r=r||0,a=t.length;do{if(s>=a||o>49)throw e.bytes=0,new RangeError("Could not decode varint");n=t[s++],i+=o<28?(127&n)<=128);return e.bytes=s-r,i}},30778:e=>{e.exports=function e(r,n,i){if(Number.MAX_SAFE_INTEGER&&r>Number.MAX_SAFE_INTEGER)throw e.bytes=0,new RangeError("Could not encode varint");n=n||[];for(var o=i=i||0;r>=t;)n[i++]=255&r|128,r/=128;for(;-128&r;)n[i++]=255&r|128,r>>>=7;return n[i]=0|r,e.bytes=i-o+1,n};var t=Math.pow(2,31)},83387:(e,t,r)=>{e.exports={encode:r(30778),decode:r(70419),encodingLength:r(73912)}},73912:e=>{var t=Math.pow(2,7),r=Math.pow(2,14),n=Math.pow(2,21),i=Math.pow(2,28),o=Math.pow(2,35),s=Math.pow(2,42),a=Math.pow(2,49),c=Math.pow(2,56),u=Math.pow(2,63);e.exports=function(e){return e{"use strict";t.PROTOCOL_ID="/multistream/1.0.0"},43868:(e,t,r)=>{"use strict";const n=r(11227)("mss:handle"),i=r(9668),o=r(60878),s=r(52261),{PROTOCOL_ID:a}=r(48506);e.exports=async(e,t)=>{t=Array.isArray(t)?t:[t];const{writer:r,reader:c,rest:u,stream:f}=s(e);for(;;){const e=(await o.read(c)).toString();if(n('read "%s"',e),e!==a){if(t.includes(e))return o.write(r,e),n('respond with "%s" for "%s"',e,e),u(),{stream:f,protocol:e};"ls"!==e?(o.write(r,"na"),n('respond with "na" for "%s"',e)):(o.write(r,new i(t.map((e=>o.encode(e))))),n('respond with "%s" for %s',t,e))}else n('respond with "%s" for "%s"',a,e),o.write(r,a)}}},8738:(e,t,r)=>{"use strict";const n=r(27578),i=r(43868),o=r(77372),{PROTOCOL_ID:s}=r(48506);t.PROTOCOL_ID=s;class a{constructor(e){this._stream=e,this._shaken=!1}async _handshake(){if(this._shaken)return;const{stream:e}=await n(this._stream,s);this._stream=e,this._shaken=!0}}t.Dialer=class extends a{select(e){return n(this._stream,e,this._shaken?null:s)}async ls(){await this._handshake();const{stream:e,protocols:t}=await o(this._stream);return this._stream=e,t}},t.Listener=class extends a{handle(e){return i(this._stream,e)}}},77372:(e,t,r)=>{"use strict";const n=r(53469),i=r(11227)("it-multistream-select:ls"),o=r(60878),s=r(52261),a=r(88567),c=r(60618);e.exports=async e=>{const{reader:t,writer:r,rest:u,stream:f}=s(e);i('write "ls"'),o.write(r,"ls"),u();const l=await o.read(t),h=n([l]),d=[];return await c(h,a.decode(),(async e=>{for await(const t of e)d.push(t.shallowSlice(0,-1).toString())})),{stream:f,protocols:d}}},60878:(e,t,r)=>{"use strict";const n=r(9668),i=r(88567),o=r(60618),s=r(32114),{fromString:a}=r(52217),c=r(72262),u=a("\n");t.encode=e=>i.encode.single(new n([e,u])),t.write=(e,r)=>e.push(t.encode(r)),t.writeAll=(e,r)=>{e.push(r.reduce(((e,r)=>e.append(t.encode(r))),new n))},t.read=async e=>{let t=1;const r={[Symbol.asyncIterator](){return this},next:()=>e.next(t)},n=await o(r,i.decode({onLength:e=>{t=e}}),c);if(n.get(n.length-1)!==u[0])throw s(new Error("missing newline"),"ERR_INVALID_MULTISTREAM_SELECT_MESSAGE");return n.shallowSlice(0,-1)}},27578:(e,t,r)=>{"use strict";const n=r(11227)("mss:select"),i=r(32114),o=r(60878),s=r(52261);e.exports=async(e,t,r)=>{t=Array.isArray(t)?[...t]:[t];const{reader:a,writer:c,rest:u,stream:f}=s(e),l=t.shift();r?(n('select: write ["%s", "%s"]',r,l),o.writeAll(c,[r,l])):(n('select: write "%s"',l),o.write(c,l));let h=(await o.read(a)).toString();if(n('select: read "%s"',h),h===r&&(h=(await o.read(a)).toString(),n('select: read "%s"',h)),h===l)return u(),{stream:f,protocol:l};for(const e of t){n('select: write "%s"',e),o.write(c,e);const t=(await o.read(a)).toString();if(n('select: read "%s" for "%s"',t,e),t===e)return u(),{stream:f,protocol:e}}throw u(),i(new Error("protocol selection failed"),"ERR_UNSUPPORTED_PROTOCOL")}},99633:e=>{"use strict";function t(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t{"use strict";let n;n=globalThis.AbortController&&globalThis.AbortSignal?globalThis:r(28599),e.exports.AbortSignal=n.AbortSignal,e.exports.AbortController=n.AbortController},30700:(e,t,r)=>{"use strict";globalThis.fetch&&globalThis.Headers&&globalThis.Request&&globalThis.Response?e.exports={default:globalThis.fetch,Headers:globalThis.Headers,Request:globalThis.Request,Response:globalThis.Response}:e.exports={default:r(83300).default,Headers:r(83300).Headers,Request:r(83300).Request,Response:r(83300).Response}},28951:function(e,t){(function(){var e,r,n,i,o,s,a,c;c=function(e){return[(e&255<<24)>>>24,(e&255<<16)>>>16,(65280&e)>>>8,255&e].join(".")},a=function(e){var t,n,i,o,s,a;for(t=[],i=o=0;o<=3&&0!==e.length;i=++o){if(i>0){if("."!==e[0])throw new Error("Invalid IP");e=e.substring(1)}s=(a=r(e))[0],n=a[1],e=e.substring(n),t.push(s)}if(0!==e.length)throw new Error("Invalid IP");switch(t.length){case 1:if(t[0]>4294967295)throw new Error("Invalid IP");return t[0]>>>0;case 2:if(t[0]>255||t[1]>16777215)throw new Error("Invalid IP");return(t[0]<<24|t[1])>>>0;case 3:if(t[0]>255||t[1]>255||t[2]>65535)throw new Error("Invalid IP");return(t[0]<<24|t[1]<<16|t[2])>>>0;case 4:if(t[0]>255||t[1]>255||t[2]>255||t[3]>255)throw new Error("Invalid IP");return(t[0]<<24|t[1]<<16|t[2]<<8|t[3])>>>0;default:throw new Error("Invalid IP")}},i=(n=function(e){return e.charCodeAt(0)})("0"),s=n("a"),o=n("A"),r=function(e){var t,r,a,c,u;for(c=0,t=10,r="9",a=0,e.length>1&&"0"===e[a]&&("x"===e[a+1]||"X"===e[a+1]?(a+=2,t=16):"0"<=e[a+1]&&e[a+1]<="9"&&(a++,t=8,r="7")),u=a;a>>0;else{if(16!==t)break;if("a"<=e[a]&&e[a]<="f")c=c*t+(10+n(e[a])-s)>>>0;else{if(!("A"<=e[a]&&e[a]<="F"))break;c=c*t+(10+n(e[a])-o)>>>0}}if(c>4294967295)throw new Error("too large");a++}if(a===u)throw new Error("empty octet");return[c,a]},e=function(){function e(e,t){var r,n,i;if("string"!=typeof e)throw new Error("Missing `net' parameter");if(t||(i=e.split("/",2),e=i[0],t=i[1]),t||(t=32),"string"==typeof t&&t.indexOf(".")>-1){try{this.maskLong=a(t)}catch(e){throw new Error("Invalid mask: "+t)}for(r=n=32;n>=0;r=--n)if(this.maskLong===4294967295<<32-r>>>0){this.bitmask=r;break}}else{if(!t&&0!==t)throw new Error("Invalid mask: empty");this.bitmask=parseInt(t,10),this.maskLong=0,this.bitmask>0&&(this.maskLong=4294967295<<32-this.bitmask>>>0)}try{this.netLong=(a(e)&this.maskLong)>>>0}catch(t){throw new Error("Invalid net address: "+e)}if(!(this.bitmask<=32))throw new Error("Invalid mask for ip4: "+t);this.size=Math.pow(2,32-this.bitmask),this.base=c(this.netLong),this.mask=c(this.maskLong),this.hostmask=c(~this.maskLong),this.first=this.bitmask<=30?c(this.netLong+1):this.base,this.last=this.bitmask<=30?c(this.netLong+this.size-2):c(this.netLong+this.size-1),this.broadcast=this.bitmask<=30?c(this.netLong+this.size-1):void 0}return e.prototype.contains=function(t){return"string"==typeof t&&(t.indexOf("/")>0||4!==t.split(".").length)&&(t=new e(t)),t instanceof e?this.contains(t.base)&&this.contains(t.broadcast||t.last):(a(t)&this.maskLong)>>>0==(this.netLong&this.maskLong)>>>0},e.prototype.next=function(t){return null==t&&(t=1),new e(c(this.netLong+this.size*t),this.mask)},e.prototype.forEach=function(e){var t,r,n;for(n=a(this.first),r=a(this.last),t=0;n<=r;)e(c(n),n,t),t++,n++},e.prototype.toString=function(){return this.base+"/"+this.bitmask},e}(),t.ip2long=a,t.long2ip=c,t.Netmask=e}).call(this)},53710:(e,t,r)=>{"use strict";e=r.nmd(e),Object.defineProperty(t,"__esModule",{value:!0}),t.utils=t.verify=t.sign=t.getPublicKey=t.SignResult=t.Signature=t.Point=t.ExtendedPoint=t.CURVE=void 0;const n={a:-1n,d:37095705934669439343138083508754565189542113879843219016388785533085940283555n,P:2n**255n-19n,n:2n**252n+27742317777372353535851937790883648493n,h:8n,Gx:15112221349535400772501151409588531511454012693041857206046113283949847762202n,Gy:46316835694926478169428394003475163141307993866256225615783033603165251855960n};t.CURVE=n;const i=32,o=19681161376707505956807079304988542015446066515923890162744021073123829784752n,s=25063068953384623474111414158702152701244531502492656460079210482610430750235n,a=54469307008909316920995813868745141605393597292927456921205312896311721017578n,c=1159843021668779879193775521855586647937357759715417654439879720876111806838n,u=40440834346308536858101042469323190826248399146238708352240133220865137265952n;class f{constructor(e,t,r,n){this.x=e,this.y=t,this.z=r,this.t=n}static fromAffine(e){if(!(e instanceof h))throw new TypeError("ExtendedPoint#fromAffine: expected Point");return e.equals(h.ZERO)?f.ZERO:new f(e.x,e.y,1n,_(e.x*e.y))}static toAffineBatch(e){const t=function(e,t=n.P){const r=e.length,i=new Array(r);let o=1n;for(let n=0;n=0;n--){if(0n===e[n])continue;let r=_(o*e[n],t);e[n]=_(o*i[n],t),o=r}return e}(e.map((e=>e.z)));return e.map(((e,r)=>e.toAffine(t[r])))}static normalizeZ(e){return this.toAffineBatch(e).map(this.fromAffine)}static fromRistrettoHash(e){const t=E(e.slice(0,i)),r=this.calcElligatorRistrettoMap(t),n=E(e.slice(i,64)),o=this.calcElligatorRistrettoMap(n);return r.add(o)}static calcElligatorRistrettoMap(e){const{d:t}=n,r=_(o*e*e),i=_((r+1n)*c);let a=-1n;const l=_((a-t*r)*_(r+t));let{isValid:h,value:d}=T(i,l),p=_(d*e);m(p)||(p=_(-p)),h||(d=p),h||(a=r);const y=_(a*(r-1n)*u-l),g=d*d,b=_((d+d)*l),v=_(y*s),w=_(1n-g),E=_(1n+g);return new f(_(b*E),_(w*v),_(v*E),_(b*w))}static fromRistrettoBytes(e){const{a:t,d:r}=n,o="ExtendedPoint.fromRistrettoBytes: Cannot convert bytes to Ristretto Point",s=E(e);if(!function(e,t){if(e.length!==t.length)return!1;for(let r=0;r0n;)1n&t&&(r=r.add(i)),i=i.double(),t>>=1n;return r}precomputeWindow(e){const t=256/e+1;let r=[],n=this,i=n;for(let o=0;o>=d,s>a&&(s-=u,e+=1n),0===s)o=o.add(t%2?n[r].negate():n[r]);else{const e=n[r+Math.abs(s)-1];i=i.add(s<0?e.negate():e)}}return[i,o]}multiply(e,t){if(!v(e))throw new TypeError("Point#multiply: expected number or bigint");const r=_(BigInt(e),n.n);return f.normalizeZ(this.wNAF(r,t))[0]}toAffine(e=S(this.z)){const t=_(this.x*e),r=_(this.y*e);return new h(t,r)}}t.ExtendedPoint=f,f.BASE=new f(n.Gx,n.Gy,1n,_(n.Gx*n.Gy)),f.ZERO=new f(0n,1n,1n,0n);const l=new WeakMap;class h{constructor(e,t){this.x=e,this.y=t}_setWindowSize(e){this._WINDOW_SIZE=e,l.delete(this)}static fromHex(e){const{d:t,P:r}=n,i=e instanceof Uint8Array?e:y(e);if(32!==i.length)throw new Error("Point.fromHex: expected 32 bytes");const o=i[31],s=-129&o,a=0!=(128&o),c=w(Uint8Array.from(Array.from(i.slice(0,31)).concat(s)));if(c>=r)throw new Error("Point.fromHex expects hex <= Fp");const u=_(c*c),f=_(u-1n),l=_(t*u+1n);let{isValid:d,value:p}=T(f,l);if(!d)throw new Error("Point.fromHex: invalid y coordinate");return a!==(1n===(1n&p))&&(p=_(-p)),new h(p,c)}static async fromPrivateKey(e){const r=await t.utils.sha512(k(e));return h.BASE.multiply(P(r))}toRawBytes(){const e=g(this.y),t=new Uint8Array(i);for(let r=e.length-2,n=0;n=0;r-=2,n++)t[n]=Number.parseInt(e[r]+e[r+1],16);const r=1n&this.x?128:0;return t[31]|=r,t}toHex(){return p(this.toRawBytes())}toX25519(){return _((1n+this.y)*S(1n-this.y))}equals(e){return this.x===e.x&&this.y===e.y}negate(){return new h(_(-this.x),this.y)}add(e){return f.fromAffine(this).add(f.fromAffine(e)).toAffine()}subtract(e){return this.add(e.negate())}multiply(e){return f.fromAffine(this).multiply(e,this).toAffine()}}t.Point=h,h.BASE=new h(n.Gx,n.Gy),h.ZERO=new h(0n,1n);class d{constructor(e,t){this.r=e,this.s=t}static fromHex(e){e=R(e);const t=h.fromHex(e.slice(0,32)),r=w(e.slice(32));if(!(0<(i=r)&&i0n||!!("number"==typeof e&&e>0&&Number.isSafeInteger(e))}function w(e){let t=0n;for(let r=0;r=0n?r:t+r}function S(e,t=n.P){if(0n===e||t<=0n)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let r=_(e,t),i=t,[o,s,a,c]=[0n,1n,1n,0n];for(;0n!==r;){const e=i/r,t=i%r,n=o-a*e,u=s-c*e;[i,r]=[r,t],[o,s]=[a,c],[a,c]=[n,u]}if(1n!==i)throw new Error("invert: does not exist");return _(o,t)}function A(e,t){const{P:r}=n;let i=e;for(;t-- >0n;)i*=i,i%=r;return i}function T(e,t){const r=_(t*t*t),i=_(r*r*t);let s=_(e*r*function(e){const{P:t}=n,r=e*e%t*e%t,i=A(r,2n)*r%t,o=A(i,1n)*e%t,s=A(o,5n)*o%t,a=A(s,10n)*s%t,c=A(a,20n)*a%t,u=A(c,40n)*c%t,f=A(u,80n)*u%t,l=A(f,80n)*u%t,h=A(l,10n)*s%t;return A(h,2n)*e%t}(e*i));const a=_(t*s*s),c=s,u=_(s*o),f=a===e,l=a===_(-e),h=a===_(-e*o);return f&&(s=c),(l||h)&&(s=u),m(s)&&(s=_(-s)),{isValid:f||l,value:s}}function I(e){return T(1n,e)}async function C(...e){const r=function(...e){if(1===e.length)return e[0];const t=e.reduce(((e,t)=>e+t.length),0),r=new Uint8Array(t);for(let t=0,n=0;t2n**256n)throw new Error("Expected 32 bytes of private key");e=t.toString(16).padStart(64,"0")}if("string"==typeof e){if(64!==e.length)throw new Error("Expected 32 bytes of private key");return y(e)}if(e instanceof Uint8Array){if(32!==e.length)throw new Error("Expected 32 bytes of private key");return e}throw new TypeError("Expected valid private key")}t.Signature=d,t.SignResult=d,t.getPublicKey=async function(e){const t=await h.fromPrivateKey(e);return"string"==typeof e?t.toHex():t.toRawBytes()},t.sign=async function(e,r){const o=await t.utils.sha512(k(r)),s=P(o),a=h.BASE.multiply(s),c=R(e),u=await C((f=o,f.slice(i)),c);var f;const l=h.BASE.multiply(u),p=_(u+await C(l.toRawBytes(),a.toRawBytes(),c)*s,n.n),y=new d(l,p);return"string"==typeof e?y.toHex():y.toRawBytes()},t.verify=async function(e,t,r){t=R(t),r instanceof h||(r=h.fromHex(r)),e instanceof d||(e=d.fromHex(e));const n=await C(e.r.toRawBytes(),r.toRawBytes(),t),i=f.fromAffine(r).multiplyUnsafe(n),o=f.BASE.multiply(e.s);return f.fromAffine(e.r).add(i).subtract(o).multiplyUnsafe(8n).equals(f.ZERO)},h.BASE._setWindowSize(8);const B=(()=>{const t="object"==typeof self&&"crypto"in self?self.crypto:void 0,r="function"==typeof e.require&&e.require.bind(e);return{node:r&&!t?r("crypto"):void 0,web:t}})();t.utils={TORSION_SUBGROUP:["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"],randomBytes:(e=32)=>{if(B.web)return B.web.getRandomValues(new Uint8Array(e));if(B.node){const{randomBytes:t}=B.node;return new Uint8Array(t(e).buffer)}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>{let e=1024;for(;e--;){const e=t.utils.randomBytes(32),r=w(e);if(r>1n&&r{if(B.web){const t=await B.web.subtle.digest("SHA-512",e.buffer);return new Uint8Array(t)}if(B.node)return Uint8Array.from(B.node.createHash("sha512").update(e).digest());throw new Error("The environment doesn't have sha512 function")},precompute(e=8,t=h.BASE){const r=t.equals(h.BASE)?t:new h(t.x,t.y);return r._setWindowSize(e),r.multiply(1n),r}}},1795:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.utils=t.schnorr=t.verify=t.signSync=t.sign=t.getSharedSecret=t.recoverPublicKey=t.getPublicKey=t.SignResult=t.Signature=t.Point=t.CURVE=void 0;const n={a:0n,b:7n,P:2n**256n-2n**32n-977n,n:2n**256n-432420386565659656852420866394968145599n,h:1n,Gx:55066263022277343669578718895168534326250603453777594175500187360389116729240n,Gy:32670510020758816978083085130507043184471273380659243275938904335757337482424n,beta:0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501een};function i(e){const{a:t,b:r}=n;return _(e**3n+t*e+r)}t.CURVE=n;const o=0n===n.a;class s{constructor(e,t,r){this.x=e,this.y=t,this.z=r}static fromAffine(e){if(!(e instanceof c))throw new TypeError("JacobianPoint#fromAffine: expected Point");return new s(e.x,e.y,1n)}static toAffineBatch(e){const t=function(e,t=n.P){const r=e.length,i=new Array(r);let o=1n;for(let n=0;n=0;n--){if(0n===e[n])continue;const r=_(o*e[n],t);e[n]=_(o*i[n],t),o=r}return e}(e.map((e=>e.z)));return e.map(((e,r)=>e.toAffine(t[r])))}static normalizeZ(e){return s.toAffineBatch(e).map(s.fromAffine)}equals(e){const t=this,r=e,n=_(t.z*t.z),i=_(t.z*n),o=_(r.z*r.z),s=_(r.z*o);return _(t.x*o)===_(n*r.x)&&_(t.y*s)===_(i*r.y)}negate(){return new s(this.x,_(-this.y),this.z)}double(){const e=this.x,t=this.y,r=this.z,n=_(e**2n),i=_(t**2n),o=_(i**2n),a=_(2n*(_(_((e+i)**2n))-n-o)),c=_(3n*n),u=_(c**2n),f=_(u-2n*a),l=_(c*(a-f)-8n*o),h=_(2n*t*r);return new s(f,l,h)}add(e){if(!(e instanceof s))throw new TypeError("JacobianPoint#add: expected JacobianPoint");const t=this.x,r=this.y,n=this.z,i=e.x,o=e.y,a=e.z;if(0n===i||0n===o)return this;if(0n===t||0n===r)return e;const c=_(n**2n),u=_(a**2n),f=_(t*u),l=_(i*c),h=_(r*a*u),d=_(_(o*n)*c),p=_(l-f),y=_(d-h);if(0n===p)return 0n===y?this.double():s.ZERO;const g=_(p**2n),b=_(p*g),m=_(f*g),v=_(y**2n-b-2n*m),w=_(y*(m-v)-h*b),E=_(n*a*p);return new s(v,w,E)}subtract(e){return this.add(e.negate())}multiplyUnsafe(e){if(!E(e))throw new TypeError("Point#multiply: expected valid scalar");let t=_(BigInt(e),n.n);if(!o){let e=s.ZERO,r=this;for(;t>0n;)1n&t&&(e=e.add(r)),r=r.double(),t>>=1n;return e}let[r,i,a,c]=C(t),u=s.ZERO,f=s.ZERO,l=this;for(;i>0n||c>0n;)1n&i&&(u=u.add(l)),1n&c&&(f=f.add(l)),l=l.double(),i>>=1n,c>>=1n;return r&&(u=u.negate()),a&&(f=f.negate()),f=new s(_(f.x*n.beta),f.y,f.z),u.add(f)}precomputeWindow(e){const t=o?128/e+1:256/e+1;let r=[],n=this,i=n;for(let o=0;o>=p,o>l&&(o-=d,e+=1n),0===o)u=u.add(t%2?n[r].negate():n[r]);else{const e=n[r+Math.abs(o)-1];i=i.add(o<0?e.negate():e)}}return[i,u]}multiply(e,t){if(!E(e))throw new TypeError("Point#multiply: expected valid scalar");let r,i,a=_(BigInt(e),n.n);if(o){const[e,o,c,u]=C(a);let f,l,h,d;[f,h]=this.wNAF(o,t),[l,d]=this.wNAF(u,t),e&&(f=f.negate()),c&&(l=l.negate()),l=new s(_(l.x*n.beta),l.y,l.z),[r,i]=[f.add(l),h.add(d)]}else[r,i]=this.wNAF(a,t);return s.normalizeZ([r,i])[0]}toAffine(e=A(this.z)){const t=e**2n,r=_(this.x*t),n=_(this.y*t*e);return new c(r,n)}}s.BASE=new s(n.Gx,n.Gy,1n),s.ZERO=new s(0n,1n,0n);const a=new WeakMap;class c{constructor(e,t){this.x=e,this.y=t}_setWindowSize(e){this._WINDOW_SIZE=e,a.delete(this)}static fromCompressedHex(e){const t=32===e.length,r=v(t?e:e.slice(1));let o=function(e){const{P:t}=n,r=e*e*e%t,i=r*r*e%t,o=S(i,3n)*i%t,s=S(o,3n)*i%t,a=S(s,2n)*r%t,c=S(a,11n)*a%t,u=S(c,22n)*c%t,f=S(u,44n)*u%t,l=S(f,88n)*f%t,h=S(l,44n)*u%t,d=S(h,3n)*i%t,p=S(d,23n)*c%t,y=S(p,6n)*r%t;return S(y,2n)}(i(r));const s=1n===(1n&o);t?s&&(o=_(-o)):1==(1&e[0])!==s&&(o=_(-o));const a=new c(r,o);return a.assertValidity(),a}static fromUncompressedHex(e){const t=v(e.slice(1,33)),r=v(e.slice(33)),n=new c(t,r);return n.assertValidity(),n}static fromHex(e){const t=m(e),r=t[0];if(32===t.length||33===t.length&&(2===r||3===r))return this.fromCompressedHex(t);if(65===t.length&&4===r)return this.fromUncompressedHex(t);throw new Error(`Point.fromHex: received invalid point. Expected 32-33 compressed bytes or 65 uncompressed bytes, not ${t.length}`)}static fromPrivateKey(e){return c.BASE.multiply(B(e))}static fromSignature(e,t,r){let i=e instanceof Uint8Array?v(e):g(e);const o=M(t),{r:a,s:u}=o;if(0!==r&&1!==r)throw new Error("Cannot recover signature: invalid yParity bit");const f=2+(1&r),l=c.fromHex(`0${f}${d(a)}`),h=s.fromAffine(l).multiplyUnsafe(u),p=s.BASE.multiply(i),y=A(a,n.n),b=h.subtract(p).multiplyUnsafe(y).toAffine();return b.assertValidity(),b}toRawBytes(e=!1){return b(this.toHex(e))}toHex(e=!1){const t=d(this.x);return e?`${1n&this.y?"03":"02"}${t}`:`04${t}${d(this.y)}`}toHexX(){return this.toHex(!0).slice(2)}toRawX(){return this.toRawBytes(!0).slice(1)}assertValidity(){const e="Point is not on elliptic curve",{P:t}=n,{x:r,y:o}=this;if(0n===r||0n===o||r>=t||o>=t)throw new Error(e);if((_(o*o)-i(r))%t!==0n)throw new Error(e)}equals(e){return this.x===e.x&&this.y===e.y}negate(){return new c(this.x,_(-this.y))}double(){return s.fromAffine(this).double().toAffine()}add(e){return s.fromAffine(this).add(s.fromAffine(e)).toAffine()}subtract(e){return this.add(e.negate())}multiply(e){return s.fromAffine(this).multiply(e,this).toAffine()}}function u(e){return Number.parseInt(e[0],16)>=8?"00"+e:e}t.Point=c,c.BASE=new c(n.Gx,n.Gy),c.ZERO=new c(0n,0n);class f{constructor(e,t){this.r=e,this.s=t}static fromCompact(e){if("string"!=typeof e&&!(e instanceof Uint8Array))throw new TypeError("Signature.fromCompact: Expected string or Uint8Array");const t=e instanceof Uint8Array?h(e):e;if(128!==t.length)throw new Error("Signature.fromCompact: Expected 64-byte hex");const r=new f(g(t.slice(0,64)),g(t.slice(64,128)));return r.assertValidity(),r}static fromDER(e){const t="Signature.fromDER";if("string"!=typeof e&&!(e instanceof Uint8Array))throw new TypeError(`${t}: Expected string or Uint8Array`);const r=e instanceof Uint8Array?h(e):e,n=w(r.slice(2,4));if("30"!==r.slice(0,2)||n!==r.length-4||"02"!==r.slice(4,6))throw new Error(`${t}: Invalid signature ${r}`);const i=w(r.slice(6,8)),o=8+i,s=r.slice(8,o);if(s.startsWith("00")&&w(s.slice(2,4))<=127)throw new Error(`${t}: Invalid r with trailing length`);const a=g(s);if("02"!==r.slice(o,o+2))throw new Error(`${t}: Invalid r-s separator`);const c=w(r.slice(o+2,o+4)),u=n-c-i-10;if(u>0||-4===u)throw new Error(`${t}: Invalid total length`);if(c>n-i-4)throw new Error(`${t}: Invalid s`);const l=o+4,d=r.slice(l,l+c);if(d.startsWith("00")&&w(d.slice(2,4))<=127)throw new Error(`${t}: Invalid s with trailing length`);const p=g(d),y=new f(a,p);return y.assertValidity(),y}static fromHex(e){return this.fromDER(e)}assertValidity(){const{r:e,s:t}=this;if(!R(e))throw new Error("Invalid Signature: r must be 0 < r < n");if(!R(t))throw new Error("Invalid Signature: s must be 0 < s < n")}toDERRawBytes(e=!1){return b(this.toDERHex(e))}toDERHex(e=!1){const t=u(y(this.s));if(e)return t;const r=u(y(this.r)),n=y(r.length/2),i=y(t.length/2);return`30${y(r.length/2+t.length/2+4)}02${n}${r}02${i}${t}`}toRawBytes(){return this.toDERRawBytes()}toHex(){return this.toDERHex()}toCompactRawBytes(){return b(this.toCompactHex())}toCompactHex(){return d(this.r)+d(this.s)}}function l(...e){if(1===e.length)return e[0];const t=e.reduce(((e,t)=>e+t.length),0),r=new Uint8Array(t);for(let t=0,n=0;t0n||!!("number"==typeof e&&e>0&&Number.isSafeInteger(e))}function _(e,t=n.P){const r=e%t;return r>=0?r:t+r}function S(e,t){const{P:r}=n;let i=e;for(;t-- >0n;)i*=i,i%=r;return i}function A(e,t=n.P){if(0n===e||t<=0n)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let r=_(e,t),i=t,[o,s,a,c]=[0n,1n,1n,0n];for(;0n!==r;){const e=i/r,t=i%r,n=o-a*e,u=s-c*e;[i,r]=[r,t],[o,s]=[a,c],[a,c]=[n,u]}if(1n!==i)throw new Error("invert: does not exist");return _(o,t)}t.Signature=f,t.SignResult=f;const T=(e,t)=>(e+t/2n)/t,I=2n**128n;function C(e){const{n:t}=n,r=0x3086d221a7d46bcde86c90e49284eb15n,i=-0xe4437ed6010e88286f547fa90abfe4c3n,o=r,s=T(o*e,t),a=T(-i*e,t);let c=_(e-s*r-0x114ca50f7a8e2f3f657c1108d9d44cfd8n*a,t),u=_(-s*i-a*o,t);const f=c>I,l=u>I;if(f&&(c=t-c),l&&(u=t-u),c>I||u>I)throw new Error("splitScalarEndo: Endomorphism failed");return[f,c,l,u]}function P(e,t){if(null==e)throw new Error(`sign: expected valid msgHash, not "${e}"`);const r=p("string"==typeof e?g(e):v(e));return[r,v(r),p(t),new Uint8Array(32).fill(1),new Uint8Array(32).fill(0),Uint8Array.from([0]),Uint8Array.from([1])]}function R(e){return 00)t=BigInt(e);else if("string"==typeof e){if(64!==e.length)throw new Error("Expected 32 bytes of private key");t=g(e)}else{if(!(e instanceof Uint8Array))throw new TypeError("Expected valid private key");if(32!==e.length)throw new Error("Expected 32 bytes of private key");t=v(e)}if(!R(t))throw new Error("Expected private key: 0 < key < n");return t}function x(e){return e instanceof c?(e.assertValidity(),e):c.fromHex(e)}function M(e){return e instanceof f?(e.assertValidity(),e):f.fromDER(e)}function O(e){const t=e instanceof Uint8Array,r="string"==typeof e,n=(t||r)&&e.length;return t?33===n||65===n:r?66===n||130===n:e instanceof c}function N(e,t,r=!1){const[i,o,s]=e;let{canonical:a,der:c,recovered:u}=t,l=(i.x===o?0:2)|Number(1n&i.y),h=s;s>n.n>>1n&&a&&(h=n.n-s,l^=1);const d=new f(o,h);d.assertValidity();const p=!1===c?d.toCompactHex():d.toDERHex(),y=r?p:b(p);return u?[y,l]:y}async function L(e,...r){const n=new Uint8Array(e.split("").map((e=>e.charCodeAt(0)))),i=await t.utils.sha256(n);return v(await t.utils.sha256(l(i,i,...r)))}async function D(e,t,r){const i=p(e);return _(await L("BIP0340/challenge",i,t.toRawX(),r),n.n)}function K(e){return 0n===_(e.y,2n)}t.getPublicKey=function(e,t=!1){const r=c.fromPrivateKey(e);return"string"==typeof e?r.toHex(t):r.toRawBytes(t)},t.recoverPublicKey=function(e,t,r){const n=c.fromSignature(e,t,r);return"string"==typeof e?n.toHex():n.toRawBytes()},t.getSharedSecret=function(e,t,r=!1){if(O(e))throw new TypeError("getSharedSecret: first arg must be private key");if(!O(t))throw new TypeError("getSharedSecret: second arg must be public key");const n=x(t);n.assertValidity();const i=n.multiply(B(e));return"string"==typeof e?i.toHex(r):i.toRawBytes(r)},t.sign=async function(e,r,n={}){return N(await async function(e,r){const n=B(r);let[i,o,s,a,c,u,f]=P(e,n);const l=t.utils.hmacSha256;c=await l(c,a,u,s,i),a=await l(c,a),c=await l(c,a,f,s,i),a=await l(c,a);for(let e=0;e<1e3;e++){a=await l(c,a);let e=k(a,o,n);if(e)return e;c=await l(c,a,u),a=await l(c,a)}throw new TypeError("secp256k1: Tried 1,000 k values for sign(), all were invalid")}(e,r),n,"string"==typeof e)},t.signSync=function(e,r,n={}){return N(function(e,r){const n=B(r);let[i,o,s,a,c,u,f]=P(e,n);const l=t.utils.hmacSha256Sync;if(!l)throw new Error("utils.hmacSha256Sync is undefined, you need to set it");if(c=l(c,a,u,s,i),c instanceof Promise)throw new Error("To use sync sign(), ensure utils.hmacSha256 is sync");a=l(c,a),c=l(c,a,f,s,i),a=l(c,a);for(let e=0;e<1e3;e++){a=l(c,a);let e=k(a,o,n);if(e)return e;c=l(c,a,u),a=l(c,a)}throw new TypeError("secp256k1: Tried 1,000 k values for sign(), all were invalid")}(e,r),n,"string"==typeof e)},t.verify=function(e,t,r){const{n:i}=n;let o;try{o=M(e)}catch(e){return!1}const{r:a,s:c}=o,u=function(e){"string"!=typeof e&&(e=h(e));let t=g(e||"0");const r=e.length/2*8-256;return r>0&&(t>>=BigInt(r)),t>=n.n&&(t-=n.n),t}(t);if(0n===u)return!1;const f=s.fromAffine(x(r)),l=A(c,i),d=_(u*l,i),p=_(a*l,i),y=s.BASE.multiply(d),b=f.multiplyUnsafe(p);return _(y.add(b).toAffine().x,i)===a};class U{constructor(e,t){if(this.r=e,this.s=t,e<=0n||t<=0n||e>=n.P||t>=n.n)throw new Error("Invalid signature")}static fromHex(e){const t=m(e);if(64!==t.length)throw new TypeError(`SchnorrSignature.fromHex: expected 64 bytes, not ${t.length}`);const r=v(t.slice(0,32)),n=v(t.slice(32));return new U(r,n)}toHex(){return d(this.r)+d(this.s)}toRawBytes(){return b(this.toHex())}}async function j(e,t,r){const n=e instanceof U?e:U.fromHex(e),i="string"==typeof t?b(t):t,o=x(r),s=await D(n.r,o,i),a=c.fromPrivateKey(n.s),u=o.multiply(s),f=a.subtract(u);return!(f.equals(c.BASE)||!K(f)||f.x!==n.r)}t.schnorr={Signature:U,getPublicKey:function(e){const t=c.fromPrivateKey(e);return"string"==typeof e?t.toHexX():t.toRawX()},sign:async function(e,r,i=t.utils.randomBytes()){if(null==e)throw new TypeError(`sign: Expected valid message, not "${e}"`);r||(r=0n);const{n:o}=n,s=m(e),a=B(r),u=m(i);if(32!==u.length)throw new TypeError("sign: Expected 32 bytes of aux randomness");const f=c.fromPrivateKey(a),l=K(f)?a:o-a,h=l^await L("BIP0340/aux",u),d=_(await L("BIP0340/nonce",p(h),f.toRawX(),s),o);if(0n===d)throw new Error("sign: Creation of signature failed. k is zero");const y=c.fromPrivateKey(d),g=K(y)?d:o-d,b=await D(y.x,f,s),v=new U(y.x,_(g+b*l,o));if(!await j(v.toRawBytes(),s,f.toRawX()))throw new Error("sign: Invalid signature produced");return"string"==typeof e?v.toHex():v.toRawBytes()},verify:j},c.BASE._setWindowSize(8);const V=(()=>{const e="object"==typeof self&&"crypto"in self?self.crypto:void 0;return{node:e?void 0:r(39370),web:e}})();t.utils={isValidPrivateKey(e){try{return B(e),!0}catch(e){return!1}},randomBytes:(e=32)=>{if(V.web)return V.web.getRandomValues(new Uint8Array(e));if(V.node){const{randomBytes:t}=V.node;return new Uint8Array(t(e).buffer)}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>{let e=8;for(;e--;){const e=t.utils.randomBytes(32),r=v(e);if(R(r)&&1n!==r)return e}throw new Error("Valid private key was not found in 8 iterations. PRNG is broken")},sha256:async e=>{if(V.web){const t=await V.web.subtle.digest("SHA-256",e.buffer);return new Uint8Array(t)}if(V.node){const{createHash:t}=V.node;return Uint8Array.from(t("sha256").update(e).digest())}throw new Error("The environment doesn't have sha256 function")},hmacSha256:async(e,...t)=>{if(V.web){const r=await V.web.subtle.importKey("raw",e,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),n=l(...t),i=await V.web.subtle.sign("HMAC",r,n);return new Uint8Array(i)}if(V.node){const{createHmac:r}=V.node,n=r("sha256",e);for(let e of t)n.update(e);return Uint8Array.from(n.digest())}throw new Error("The environment doesn't have hmac-sha256 function")},sha256Sync:void 0,hmacSha256Sync:void 0,precompute(e=8,t=c.BASE){const r=t===c.BASE?t:new c(t.x,t.y);return r._setWindowSize(e),r.multiply(3n),r}}},83300:(e,t)=>{"use strict";var r=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==r)return r;throw new Error("unable to locate global object")}();e.exports=t=r.fetch,r.fetch&&(t.default=r.fetch.bind(r)),t.Headers=r.Headers,t.Request=r.Request,t.Response=r.Response},8925:(e,t,r)=>{var n=r(3832);function i(e,t){n.cipher.registerAlgorithm(e,(function(){return new n.aes.Algorithm(e,t)}))}r(85649),r(61967),r(97116),e.exports=n.aes=n.aes||{},n.aes.startEncrypting=function(e,t,r,n){var i=p({key:e,output:r,decrypt:!1,mode:n});return i.start(t),i},n.aes.createEncryptionCipher=function(e,t){return p({key:e,output:null,decrypt:!1,mode:t})},n.aes.startDecrypting=function(e,t,r,n){var i=p({key:e,output:r,decrypt:!0,mode:n});return i.start(t),i},n.aes.createDecryptionCipher=function(e,t){return p({key:e,output:null,decrypt:!0,mode:t})},n.aes.Algorithm=function(e,t){f||l();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return d(r._w,e,t,!1)},decrypt:function(e,t){return d(r._w,e,t,!0)}}}),r._init=!1},n.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t,r=e.key;if("string"!=typeof r||16!==r.length&&24!==r.length&&32!==r.length){if(n.util.isArray(r)&&(16===r.length||24===r.length||32===r.length)){t=r,r=n.util.createBuffer();for(var i=0;i>>=2,i=0;i>8^255&l^99,o[y]=l,s[l]=y,d=(h=e[l])<<24^l<<16^l<<8^l^h,p=((r=e[y])^(n=e[r])^(i=e[n]))<<24^(y^i)<<16^(y^n^i)<<8^y^r^i;for(var b=0;b<4;++b)c[b][y]=d,u[b][l]=p,d=d<<24|d>>>8,p=p<<24|p>>>8;0===y?y=g=1:(y=r^e[e[e[r^i]]],g^=e[e[g]])}}function h(e,t){for(var r,n=e.slice(0),i=1,s=n.length,c=4*(s+6+1),f=s;f>>16&255]<<24^o[r>>>8&255]<<16^o[255&r]<<8^o[r>>>24]^a[i]<<24,i++):s>6&&f%s==4&&(r=o[r>>>24]<<24^o[r>>>16&255]<<16^o[r>>>8&255]<<8^o[255&r]),n[f]=n[f-s]^r;if(t){for(var l,h=u[0],d=u[1],p=u[2],y=u[3],g=n.slice(0),b=(f=0,(c=n.length)-4);f>>24]]^d[o[l>>>16&255]]^p[o[l>>>8&255]]^y[o[255&l]];n=g}return n}function d(e,t,r,n){var i,a,f,l,h,d,p,y,g,b,m,v,w=e.length/4-1;n?(i=u[0],a=u[1],f=u[2],l=u[3],h=s):(i=c[0],a=c[1],f=c[2],l=c[3],h=o),d=t[0]^e[0],p=t[n?3:1]^e[1],y=t[2]^e[2],g=t[n?1:3]^e[3];for(var E=3,_=1;_>>24]^a[p>>>16&255]^f[y>>>8&255]^l[255&g]^e[++E],m=i[p>>>24]^a[y>>>16&255]^f[g>>>8&255]^l[255&d]^e[++E],v=i[y>>>24]^a[g>>>16&255]^f[d>>>8&255]^l[255&p]^e[++E],g=i[g>>>24]^a[d>>>16&255]^f[p>>>8&255]^l[255&y]^e[++E],d=b,p=m,y=v;r[0]=h[d>>>24]<<24^h[p>>>16&255]<<16^h[y>>>8&255]<<8^h[255&g]^e[++E],r[n?3:1]=h[p>>>24]<<24^h[y>>>16&255]<<16^h[g>>>8&255]<<8^h[255&d]^e[++E],r[2]=h[y>>>24]<<24^h[g>>>16&255]<<16^h[d>>>8&255]<<8^h[255&p]^e[++E],r[n?1:3]=h[g>>>24]<<24^h[d>>>16&255]<<16^h[p>>>8&255]<<8^h[255&y]^e[++E]}function p(e){var t,r="AES-"+((e=e||{}).mode||"CBC").toUpperCase(),i=(t=e.decrypt?n.cipher.createDecipher(r,e.key):n.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var o=null;r instanceof n.util.ByteBuffer&&(o=r,r={}),(r=r||{}).output=o,r.iv=e,i.call(t,r)},t}},59205:(e,t,r)=>{var n=r(3832);r(3068);var i=n.asn1;t.privateKeyValidator={name:"PrivateKeyInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},t.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,composed:!0,captureBitStringValue:"ed25519PublicKey"}]}},3068:(e,t,r)=>{var n=r(3832);r(97116),r(66270);var i=e.exports=n.asn1=n.asn1||{};function o(e,t,r){if(r>t){var n=new Error("Too few bytes to parse DER.");throw n.available=e.length(),n.remaining=t,n.requested=r,n}}function s(e,t,r,n){var a;o(e,t,2);var c=e.getByte();t--;var u=192&c,f=31&c;a=e.length();var l,h,d=function(e,t){var r=e.getByte();if(t--,128!==r){var n;if(128&r){var i=127&r;o(e,t,i),n=e.getInt(i<<3)}else n=r;if(n<0)throw new Error("Negative length: "+n);return n}}(e,t);if(t-=a-e.length(),void 0!==d&&d>t){if(n.strict){var p=new Error("Too few bytes to read ASN.1 value.");throw p.available=e.length(),p.remaining=t,p.requested=d,p}d=t}var y=32==(32&c);if(y)if(l=[],void 0===d)for(;;){if(o(e,t,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),t-=2;break}a=e.length(),l.push(s(e,t,r+1,n)),t-=a-e.length()}else for(;d>0;)a=e.length(),l.push(s(e,d,r+1,n)),t-=a-e.length(),d-=a-e.length();if(void 0===l&&u===i.Class.UNIVERSAL&&f===i.Type.BITSTRING&&(h=e.bytes(d)),void 0===l&&n.decodeBitStrings&&u===i.Class.UNIVERSAL&&f===i.Type.BITSTRING&&d>1){var g=e.read,b=t,m=0;if(f===i.Type.BITSTRING&&(o(e,t,1),m=e.getByte(),t--),0===m)try{a=e.length();var v=s(e,t,r+1,{verbose:n.verbose,strict:!0,decodeBitStrings:!0}),w=a-e.length();t-=w,f==i.Type.BITSTRING&&w++;var E=v.tagClass;w!==d||E!==i.Class.UNIVERSAL&&E!==i.Class.CONTEXT_SPECIFIC||(l=[v])}catch(e){}void 0===l&&(e.read=g,t=b)}if(void 0===l){if(void 0===d){if(n.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");d=t}if(f===i.Type.BMPSTRING)for(l="";d>0;d-=2)o(e,t,2),l+=String.fromCharCode(e.getInt16()),t-=2;else l=e.getBytes(d)}var _=void 0===h?null:{bitStringContents:h};return i.create(u,f,y,l,_)}i.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},i.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},i.create=function(e,t,r,o,s){if(n.util.isArray(o)){for(var a=[],c=0;c1&&(0===e.value.charCodeAt(0)&&0==(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128==(128&e.value.charCodeAt(1)))?o.putBytes(e.value.substr(1)):o.putBytes(e.value);if(t.putByte(r),o.length()<=127)t.putByte(127&o.length());else{var c=o.length(),u="";do{u+=String.fromCharCode(255&c),c>>>=8}while(c>0);for(t.putByte(128|u.length),a=u.length-1;a>=0;--a)t.putByte(u.charCodeAt(a))}return t.putBuffer(o),t},i.oidToDer=function(e){var t,r,i,o,s=e.split("."),a=n.util.createBuffer();a.putByte(40*parseInt(s[0],10)+parseInt(s[1],10));for(var c=2;c>>=7,t||(o|=128),r.push(o),t=!1}while(i>0);for(var u=r.length-1;u>=0;--u)a.putByte(r[u])}return a},i.derToOid=function(e){var t;"string"==typeof e&&(e=n.util.createBuffer(e));var r=e.getByte();t=Math.floor(r/40)+"."+r%40;for(var i=0;e.length()>0;)i<<=7,128&(r=e.getByte())?i+=127&r:(t+="."+(i+r),i=0);return t},i.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(e.substr(2,2),10)-1,i=parseInt(e.substr(4,2),10),o=parseInt(e.substr(6,2),10),s=parseInt(e.substr(8,2),10),a=0;if(e.length>11){var c=e.charAt(10),u=10;"+"!==c&&"-"!==c&&(a=parseInt(e.substr(10,2),10),u+=2)}if(t.setUTCFullYear(r,n,i),t.setUTCHours(o,s,a,0),u&&("+"===(c=e.charAt(u))||"-"===c)){var f=60*parseInt(e.substr(u+1,2),10)+parseInt(e.substr(u+4,2),10);f*=6e4,"+"===c?t.setTime(+t-f):t.setTime(+t+f)}return t},i.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),n=parseInt(e.substr(4,2),10)-1,i=parseInt(e.substr(6,2),10),o=parseInt(e.substr(8,2),10),s=parseInt(e.substr(10,2),10),a=parseInt(e.substr(12,2),10),c=0,u=0,f=!1;"Z"===e.charAt(e.length-1)&&(f=!0);var l=e.length-5,h=e.charAt(l);return"+"!==h&&"-"!==h||(u=60*parseInt(e.substr(l+1,2),10)+parseInt(e.substr(l+4,2),10),u*=6e4,"+"===h&&(u*=-1),f=!0),"."===e.charAt(14)&&(c=1e3*parseFloat(e.substr(14),10)),f?(t.setUTCFullYear(r,n,i),t.setUTCHours(o,s,a,c),t.setTime(+t+u)):(t.setFullYear(r,n,i),t.setHours(o,s,a,c)),t},i.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=e,r},i.derToInteger=function(e){"string"==typeof e&&(e=n.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},i.validate=function(e,t,r,o){var s=!1;if(e.tagClass!==t.tagClass&&void 0!==t.tagClass||e.type!==t.type&&void 0!==t.type)o&&(e.tagClass!==t.tagClass&&o.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&o.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||void 0===t.constructed){if(s=!0,t.value&&n.util.isArray(t.value))for(var a=0,c=0;s&&c0&&(o+="\n");for(var s="",c=0;c1?o+="0x"+n.util.bytesToHex(e.value.slice(1)):o+="(none)",e.value.length>0){var h=e.value.charCodeAt(0);1==h?o+=" (1 unused bit shown)":h>1&&(o+=" ("+h+" unused bits shown)")}}else e.type===i.Type.OCTETSTRING?(a.test(e.value)||(o+="("+e.value+") "),o+="0x"+n.util.bytesToHex(e.value)):e.type===i.Type.UTF8?o+=n.util.decodeUtf8(e.value):e.type===i.Type.PRINTABLESTRING||e.type===i.Type.IA5String?o+=e.value:a.test(e.value)?o+="0x"+n.util.bytesToHex(e.value):0===e.value.length?o+="[null]":o+=e.value}return o}},78807:e=>{var t={};e.exports=t;var r={};t.encode=function(e,t,r){if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');if(void 0!==r&&"number"!=typeof r)throw new TypeError('"maxline" must be a number.');var n="";if(e instanceof Uint8Array){var i=0,o=t.length,s=t.charAt(0),a=[0];for(i=0;i0;)a.push(u%o),u=u/o|0}for(i=0;0===e[i]&&i=0;--i)n+=t[a[i]]}else n=function(e,t){var r=0,n=t.length,i=t.charAt(0),o=[0];for(r=0;r0;)o.push(a%n),a=a/n|0}var c="";for(r=0;0===e.at(r)&&r=0;--r)c+=t[o[r]];return c}(e,t);if(r){var f=new RegExp(".{1,"+r+"}","g");n=n.match(f).join("\r\n")}return n},t.decode=function(e,t){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');var n=r[t];if(!n){n=r[t]=[];for(var i=0;i>=8;for(;f>0;)a.push(255&f),f>>=8}for(var l=0;e[l]===s&&l{var n=r(3832);r(97116),e.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})},n.cipher.createDecipher=function(e,t){var r=e;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+e);return new n.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})},n.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),n.cipher.algorithms[e]=t},n.cipher.getAlgorithm=function(e){return(e=e.toUpperCase())in n.cipher.algorithms?n.cipher.algorithms[e]:null};var i=n.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};i.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=e.output||n.util.createBuffer(),this.mode.start(t)},i.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},i.prototype.finish=function(e){!e||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(t){return e(this.blockSize,t,!1)},this.mode.unpad=function(t){return e(this.blockSize,t,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t)||(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t)||this.mode.afterFinish&&!this.mode.afterFinish(this.output,t)))}},61967:(e,t,r)=>{var n=r(3832);r(97116),n.cipher=n.cipher||{};var i=e.exports=n.cipher.modes=n.cipher.modes||{};function o(e,t){if("string"==typeof e&&(e=n.util.createBuffer(e)),n.util.isArray(e)&&e.length>4){var r=e;e=n.util.createBuffer();for(var i=0;i0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2||(e.truncate(n),0))},i.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},i.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv,this.blockSize),this._prev=this._iv.slice(0)}},i.cbc.prototype.encrypt=function(e,t,r){if(e.length()0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2||(e.truncate(n),0))},i.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear(),i=0;i0)e.read-=this.blockSize;else for(i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear(),i=0;i0)e.read-=this.blockSize;else for(i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear(),i=0;i0)e.read-=this.blockSize;else for(i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.ofb.prototype.decrypt=i.ofb.prototype.encrypt,i.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear(),i=0;i0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}s(this._inBlock)},i.ctr.prototype.decrypt=i.ctr.prototype.encrypt,i.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0,this._R=3774873600},i.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t,r=n.util.createBuffer(e.iv);if(this._cipherLength=0,t="additionalData"in e?n.util.createBuffer(e.additionalData):n.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=n.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var i=r.length();if(12===i)this._j0=[r.getInt32(),r.getInt32(),r.getInt32(),1];else{for(this._j0=[0,0,0,0];r.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(a(8*i)))}this._inBlock=this._j0.slice(0),s(this._inBlock),this._partialBytes=0,t=n.util.createBuffer(t),this._aDataLength=a(8*t.length());var o=t.length()%this.blockSize;for(o&&t.fillWithByte(0,this.blockSize-o),this._s=[0,0,0,0];t.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()])},i.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i0&&(o=this.blockSize-o),this._partialOutput.clear(),i=0;i0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),s(this._inBlock)},i.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),s(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},i.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=e[r/8|0]>>>4*(7-r%8)&15,i=this._m[r][n];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3]}return t},i.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},i.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,i=16*r,o=new Array(i),s=0;s>>1,i=new Array(r);i[n]=e.slice(0);for(var o=n>>>1;o>0;)this.pow(i[2*o],i[o]=[]),o>>=1;for(o=2;o{var n=r(3832);function i(e,t){n.cipher.registerAlgorithm(e,(function(){return new n.des.Algorithm(e,t)}))}r(85649),r(61967),r(97116),e.exports=n.des=n.des||{},n.des.startEncrypting=function(e,t,r,n){var i=p({key:e,output:r,decrypt:!1,mode:n||(null===t?"ECB":"CBC")});return i.start(t),i},n.des.createEncryptionCipher=function(e,t){return p({key:e,output:null,decrypt:!1,mode:t})},n.des.startDecrypting=function(e,t,r,n){var i=p({key:e,output:r,decrypt:!0,mode:n||(null===t?"ECB":"CBC")});return i.start(t),i},n.des.createDecryptionCipher=function(e,t){return p({key:e,output:null,decrypt:!0,mode:t})},n.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return d(r._keys,e,t,!1)},decrypt:function(e,t){return d(r._keys,e,t,!0)}}}),r._init=!1},n.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=n.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=function(e){for(var t,r=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],n=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],i=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],o=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],s=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],a=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],c=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],u=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],f=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],l=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],h=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],d=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],p=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],y=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],g=e.length()>8?3:1,b=[],m=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],v=0,w=0;w>>4^_))<<4,E^=t=65535&((_^=t)>>>-16^E),E^=(t=858993459&(E>>>2^(_^=t<<-16)))<<2,E^=t=65535&((_^=t)>>>-16^E),E^=(t=1431655765&(E>>>1^(_^=t<<-16)))<<1,E^=t=16711935&((_^=t)>>>8^E),t=(E^=(t=1431655765&(E>>>1^(_^=t<<8)))<<1)<<8|(_^=t)>>>20&240,E=_<<24|_<<8&16711680|_>>>8&65280|_>>>24&240,_=t;for(var S=0;S>>26,_=_<<2|_>>>26):(E=E<<1|E>>>27,_=_<<1|_>>>27);var A=r[(E&=-15)>>>28]|n[E>>>24&15]|i[E>>>20&15]|o[E>>>16&15]|s[E>>>12&15]|a[E>>>8&15]|c[E>>>4&15],T=u[(_&=-15)>>>28]|f[_>>>24&15]|l[_>>>20&15]|h[_>>>16&15]|d[_>>>12&15]|p[_>>>8&15]|y[_>>>4&15];t=65535&(T>>>16^A),b[v++]=A^t,b[v++]=T^t<<16}}return b}(t),this._init=!0}},i("DES-ECB",n.cipher.modes.ecb),i("DES-CBC",n.cipher.modes.cbc),i("DES-CFB",n.cipher.modes.cfb),i("DES-OFB",n.cipher.modes.ofb),i("DES-CTR",n.cipher.modes.ctr),i("3DES-ECB",n.cipher.modes.ecb),i("3DES-CBC",n.cipher.modes.cbc),i("3DES-CFB",n.cipher.modes.cfb),i("3DES-OFB",n.cipher.modes.ofb),i("3DES-CTR",n.cipher.modes.ctr);var o=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],s=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],a=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],c=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],u=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],f=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],l=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],h=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function d(e,t,r,n){var i,d,p=32===e.length?3:9;i=3===p?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var y=t[0],g=t[1];y^=(d=252645135&(y>>>4^g))<<4,y^=(d=65535&(y>>>16^(g^=d)))<<16,y^=d=858993459&((g^=d)>>>2^y),y^=d=16711935&((g^=d<<2)>>>8^y),y=(y^=(d=1431655765&(y>>>1^(g^=d<<8)))<<1)<<1|y>>>31,g=(g^=d)<<1|g>>>31;for(var b=0;b>>4|g<<28)^e[w+1];d=y,y=g,g=d^(s[E>>>24&63]|c[E>>>16&63]|f[E>>>8&63]|h[63&E]|o[_>>>24&63]|a[_>>>16&63]|u[_>>>8&63]|l[63&_])}d=y,y=g,g=d}g=g>>>1|g<<31,g^=d=1431655765&((y=y>>>1|y<<31)>>>1^g),g^=(d=16711935&(g>>>8^(y^=d<<1)))<<8,g^=(d=858993459&(g>>>2^(y^=d)))<<2,g^=d=65535&((y^=d)>>>16^g),g^=d=252645135&((y^=d<<16)>>>4^g),y^=d<<4,r[0]=y,r[1]=g}function p(e){var t,r="DES-"+((e=e||{}).mode||"CBC").toUpperCase(),i=(t=e.decrypt?n.cipher.createDecipher(r,e.key):n.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var o=null;r instanceof n.util.ByteBuffer&&(o=r,r={}),(r=r||{}).output=o,r.iv=e,i.call(t,r)},t}},80069:(e,t,r)=>{var n=r(3832);r(15764),r(49563),r(63219),r(97116);var i=r(59205),o=i.publicKeyValidator,s=i.privateKeyValidator;if(void 0===a)var a=n.jsbn.BigInteger;var c=n.util.ByteBuffer,u="undefined"==typeof Buffer?Uint8Array:Buffer;n.pki=n.pki||{},e.exports=n.pki.ed25519=n.ed25519=n.ed25519||{};var f=n.ed25519;function l(e){var t=e.message;if(t instanceof Uint8Array||t instanceof u)return t;var r=e.encoding;if(void 0===t){if(!e.md)throw new TypeError('"options.message" or "options.md" not specified.');t=e.md.digest().getBytes(),r="binary"}if("string"==typeof t&&!r)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if("string"==typeof t){if("undefined"!=typeof Buffer)return Buffer.from(t,r);t=new c(t,r)}else if(!(t instanceof c))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');for(var n=new u(t.length()),i=0;i=0;--r)K(n,n),1!==r&&U(n,n,t);for(r=0;r<16;++r)e[r]=n[r]}(r,r),U(r,r,i),U(r,r,o),U(r,r,o),U(e[0],r,o),K(n,e[0]),U(n,n,o),C(n,i)&&U(e[0],e[0],v),K(n,e[0]),U(n,n,o),C(n,i)?-1:(R(e[0])===t[31]>>7&&D(e[0],h,e[0]),U(e[3],e[0],e[1]),0)}(a,n))return-1;for(i=0;i=0};var h=N(),d=N([1]),p=N([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),y=N([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),g=N([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),b=N([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),m=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),v=N([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function w(e,t){var r=n.md.sha512.create(),i=new c(e);r.update(i.getBytes(t),"binary");var o=r.digest().getBytes();if("undefined"!=typeof Buffer)return Buffer.from(o,"binary");for(var s=new u(f.constants.HASH_BYTE_LENGTH),a=0;a<64;++a)s[a]=o.charCodeAt(a);return s}function E(e,t){var r,n,i,o;for(n=63;n>=32;--n){for(r=0,i=n-32,o=n-12;i>8,t[i]-=256*r;t[i]+=r,t[n]=0}for(r=0,i=0;i<32;++i)t[i]+=r-(t[31]>>4)*m[i],r=t[i]>>8,t[i]&=255;for(i=0;i<32;++i)t[i]-=r*m[i];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function _(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;E(e,t)}function S(e,t){var r=N(),n=N(),i=N(),o=N(),s=N(),a=N(),c=N(),u=N(),f=N();D(r,e[1],e[0]),D(f,t[1],t[0]),U(r,r,f),L(n,e[0],e[1]),L(f,t[0],t[1]),U(n,n,f),U(i,e[3],t[3]),U(i,i,y),U(o,e[2],t[2]),L(o,o,o),D(s,n,r),D(a,o,i),L(c,o,i),L(u,n,r),U(e[0],s,a),U(e[1],u,c),U(e[2],c,a),U(e[3],s,u)}function A(e,t,r){for(var n=0;n<4;++n)O(e[n],t[n],r)}function T(e,t){var r=N(),n=N(),i=N();!function(e,t){var r,n=N();for(r=0;r<16;++r)n[r]=t[r];for(r=253;r>=0;--r)K(n,n),2!==r&&4!==r&&U(n,n,t);for(r=0;r<16;++r)e[r]=n[r]}(i,t[2]),U(r,t[0],i),U(n,t[1],i),I(e,n),e[31]^=R(r)<<7}function I(e,t){var r,n,i,o=N(),s=N();for(r=0;r<16;++r)s[r]=t[r];for(M(s),M(s),M(s),n=0;n<2;++n){for(o[0]=s[0]-65517,r=1;r<15;++r)o[r]=s[r]-65535-(o[r-1]>>16&1),o[r-1]&=65535;o[15]=s[15]-32767-(o[14]>>16&1),i=o[15]>>16&1,o[14]&=65535,O(s,o,1-i)}for(r=0;r<16;r++)e[2*r]=255&s[r],e[2*r+1]=s[r]>>8}function C(e,t){var r=new u(32),n=new u(32);return I(r,e),I(n,t),P(r,0,n,0)}function P(e,t,r,n){return function(e,t,r,n,i){var o,s=0;for(o=0;o<32;++o)s|=e[t+o]^r[n+o];return(1&s-1>>>8)-1}(e,t,r,n)}function R(e){var t=new u(32);return I(t,e),1&t[0]}function k(e,t,r){var n,i;for(x(e[0],h),x(e[1],d),x(e[2],d),x(e[3],h),i=255;i>=0;--i)A(e,t,n=r[i/8|0]>>(7&i)&1),S(t,e),S(e,e),A(e,t,n)}function B(e,t){var r=[N(),N(),N(),N()];x(r[0],g),x(r[1],b),x(r[2],d),U(r[3],g,b),k(e,r,t)}function x(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function M(e){var t,r,n=1;for(t=0;t<16;++t)r=e[t]+n+65535,n=Math.floor(r/65536),e[t]=r-65536*n;e[0]+=n-1+37*(n-1)}function O(e,t,r){for(var n,i=~(r-1),o=0;o<16;++o)n=i&(e[o]^t[o]),e[o]^=n,t[o]^=n}function N(e){var t,r=new Float64Array(16);if(e)for(t=0;t{e.exports={options:{usePureJavaScript:!1}}},36607:(e,t,r)=>{var n=r(3832);r(28991),r(97116),(e.exports=n.hmac=n.hmac||{}).create=function(){var e=null,t=null,r=null,i=null,o={start:function(o,s){if(null!==o)if("string"==typeof o){if(!((o=o.toLowerCase())in n.md.algorithms))throw new Error('Unknown hash algorithm "'+o+'"');t=n.md.algorithms[o].create()}else t=o;if(null===s)s=e;else{if("string"==typeof s)s=n.util.createBuffer(s);else if(n.util.isArray(s)){var a=s;s=n.util.createBuffer();for(var c=0;ct.blockLength&&(t.start(),t.update(s.bytes()),s=t.digest()),r=n.util.createBuffer(),i=n.util.createBuffer(),u=s.length(),c=0;c{var n,i=r(3832);function o(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function s(){return new o(null)}function a(e,t,r,n,i,o){for(var s=16383&t,a=t>>14;--o>=0;){var c=16383&this.data[e],u=this.data[e++]>>14,f=a*c+u*s;i=((c=s*c+((16383&f)<<14)+r.data[n]+i)>>28)+(f>>14)+a*u,r.data[n++]=268435455&c}return i}e.exports=i.jsbn=i.jsbn||{},i.jsbn.BigInteger=o,"undefined"==typeof navigator?(o.prototype.am=a,n=28):"Microsoft Internet Explorer"==navigator.appName?(o.prototype.am=function(e,t,r,n,i,o){for(var s=32767&t,a=t>>15;--o>=0;){var c=32767&this.data[e],u=this.data[e++]>>15,f=a*c+u*s;i=((c=s*c+((32767&f)<<15)+r.data[n]+(1073741823&i))>>>30)+(f>>>15)+a*u+(i>>>30),r.data[n++]=1073741823&c}return i},n=30):"Netscape"!=navigator.appName?(o.prototype.am=function(e,t,r,n,i,o){for(;--o>=0;){var s=t*this.data[e++]+r.data[n]+i;i=Math.floor(s/67108864),r.data[n++]=67108863&s}return i},n=26):(o.prototype.am=a,n=28),o.prototype.DB=n,o.prototype.DM=(1<>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function y(e){this.m=e}function g(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function _(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function S(){}function A(e){return e}function T(e){this.r2=s(),this.q3=s(),o.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}y.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},y.prototype.revert=function(e){return e},y.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},y.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},y.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},g.prototype.convert=function(e){var t=s();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(o.ZERO)>0&&this.m.subTo(t,t),t},g.prototype.revert=function(e){var t=s();return e.copyTo(t),this.reduce(t),t},g.prototype.reduce=function(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e.data[r]+=this.m.am(0,n,e,t,0,this.m.t);e.data[r]>=e.DV;)e.data[r]-=e.DV,e.data[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},g.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},g.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},o.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s},o.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0},o.prototype.fromString=function(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var n=e.length,i=!1,s=0;--n>=0;){var a=8==r?255&e[n]:h(e,n);a<0?"-"==e.charAt(n)&&(i=!0):(i=!1,0==s?this.data[this.t++]=a:s+r>this.DB?(this.data[this.t-1]|=(a&(1<>this.DB-s):this.data[this.t-1]|=a<=this.DB&&(s-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,s>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==e;)--this.t},o.prototype.dlShiftTo=function(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s},o.prototype.drShiftTo=function(e,t){for(var r=e;r=0;--r)t.data[r+s+1]=this.data[r]>>i|a,a=(this.data[r]&o)<=0;--r)t.data[r]=0;t.data[s]=a,t.t=this.t+s+1,t.s=this.s,t.clamp()},o.prototype.rShiftTo=function(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var n=e%this.DB,i=this.DB-n,o=(1<>n;for(var s=r+1;s>n;n>0&&(t.data[this.t-r-1]|=(this.s&o)<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()},o.prototype.multiplyTo=function(e,t){var r=this.abs(),n=e.abs(),i=r.t;for(t.t=i+n.t;--i>=0;)t.data[i]=0;for(i=0;i=0;)e.data[r]=0;for(r=0;r=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()},o.prototype.divRemTo=function(e,t,r){var n=e.abs();if(!(n.t<=0)){var i=this.abs();if(i.t0?(n.lShiftTo(f,a),i.lShiftTo(f,r)):(n.copyTo(a),i.copyTo(r));var l=a.t,h=a.data[l-1];if(0!=h){var d=h*(1<1?a.data[l-2]>>this.F2:0),y=this.FV/d,g=(1<=0&&(r.data[r.t++]=1,r.subTo(w,r)),o.ONE.dlShiftTo(l,w),w.subTo(a,a);a.t=0;){var E=r.data[--m]==h?this.DM:Math.floor(r.data[m]*y+(r.data[m-1]+b)*g);if((r.data[m]+=a.am(0,E,r,v,0,l))0&&r.rShiftTo(f,r),c<0&&o.ZERO.subTo(r,r)}}},o.prototype.invDigit=function(){if(this.t<1)return 0;var e=this.data[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},o.prototype.isEven=function(){return 0==(this.t>0?1&this.data[0]:this.s)},o.prototype.exp=function(e,t){if(e>4294967295||e<1)return o.ONE;var r=s(),n=s(),i=t.convert(this),a=p(e)-1;for(i.copyTo(r);--a>=0;)if(t.sqrTo(r,n),(e&1<0)t.mulTo(n,i,r);else{var c=r;r=n,n=c}return t.revert(r)},o.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<0)for(a>a)>0&&(i=!0,o=l(r));s>=0;)a>(a+=this.DB-t)):(r=this.data[s]>>(a-=t)&n,a<=0&&(a+=this.DB,--s)),r>0&&(i=!0),i&&(o+=l(r));return i?o:"0"},o.prototype.negate=function(){var e=s();return o.ZERO.subTo(this,e),e},o.prototype.abs=function(){return this.s<0?this.negate():this},o.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0},o.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+p(this.data[this.t-1]^this.s&this.DM)},o.prototype.mod=function(e){var t=s();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(o.ZERO)>0&&e.subTo(t,t),t},o.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new y(t):new g(t),this.exp(e,r)},o.ZERO=d(0),o.ONE=d(1),S.prototype.convert=A,S.prototype.revert=A,S.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},S.prototype.sqrTo=function(e,t){e.squareTo(t)},T.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=s();return e.copyTo(t),this.reduce(t),t},T.prototype.revert=function(e){return e},T.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},T.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},T.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var I=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],C=(1<<26)/I[I.length-1];o.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},o.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=d(r),i=s(),o=s(),a="";for(this.divRemTo(n,i,o);i.signum()>0;)a=(r+o.intValue()).toString(e).substr(1)+a,i.divRemTo(n,i,o);return o.intValue().toString(e)+a},o.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),i=!1,s=0,a=0,c=0;c=r&&(this.dMultiply(n),this.dAddOffset(a,0),s=0,a=0))}s>0&&(this.dMultiply(Math.pow(t,s)),this.dAddOffset(a,0)),i&&o.ZERO.subTo(this,this)},o.prototype.fromNumber=function(e,t,r){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(o.ONE.shiftLeft(e-1),m,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(o.ONE.shiftLeft(e-1),this);else{var n=new Array,i=7&e;n.length=1+(e>>3),t.nextBytes(n),i>0?n[0]&=(1<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t.data[r++]=n:n<-1&&(t.data[r++]=this.DV+n),t.t=r,t.clamp()},o.prototype.dMultiply=function(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},o.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}},o.prototype.multiplyLowerTo=function(e,t,r){var n,i=Math.min(this.t+e.t,t);for(r.s=0,r.t=i;i>0;)r.data[--i]=0;for(n=r.t-this.t;i=0;)r.data[n]=0;for(n=Math.max(t-this.t,0);n0)if(0==t)r=this.data[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this.data[n])%e;return r},o.prototype.millerRabin=function(e){var t=this.subtract(o.ONE),r=t.getLowestSetBit();if(r<=0)return!1;for(var n,i=t.shiftRight(r),s={nextBytes:function(e){for(var t=0;t=0);var c=n.modPow(i,this);if(0!=c.compareTo(o.ONE)&&0!=c.compareTo(t)){for(var u=1;u++>24},o.prototype.shortValue=function(){return 0==this.t?this.s:this.data[0]<<16>>16},o.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1},o.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var r,n=this.DB-e*this.DB%8,i=0;if(e-- >0)for(n>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<=0;)n<8?(r=(this.data[e]&(1<>(n+=this.DB-8)):(r=this.data[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(t[i++]=r);return t},o.prototype.equals=function(e){return 0==this.compareTo(e)},o.prototype.min=function(e){return this.compareTo(e)<0?this:e},o.prototype.max=function(e){return this.compareTo(e)>0?this:e},o.prototype.and=function(e){var t=s();return this.bitwiseTo(e,b,t),t},o.prototype.or=function(e){var t=s();return this.bitwiseTo(e,m,t),t},o.prototype.xor=function(e){var t=s();return this.bitwiseTo(e,v,t),t},o.prototype.andNot=function(e){var t=s();return this.bitwiseTo(e,w,t),t},o.prototype.not=function(){for(var e=s(),t=0;t=this.t?0!=this.s:0!=(this.data[t]&1<1){var l=s();for(n.sqrTo(a[1],l);c<=f;)a[c]=s(),n.mulTo(l,a[c-2],a[c]),c+=2}var h,b,m=e.t-1,v=!0,w=s();for(i=p(e.data[m])-1;m>=0;){for(i>=u?h=e.data[m]>>i-u&f:(h=(e.data[m]&(1<0&&(h|=e.data[m-1]>>this.DB+i-u)),c=r;0==(1&h);)h>>=1,--c;if((i-=c)<0&&(i+=this.DB,--m),v)a[h].copyTo(o),v=!1;else{for(;c>1;)n.sqrTo(o,w),n.sqrTo(w,o),c-=2;c>0?n.sqrTo(o,w):(b=o,o=w,w=b),n.mulTo(w,a[h],o)}for(;m>=0&&0==(e.data[m]&1<=0?(r.subTo(n,r),t&&i.subTo(a,i),s.subTo(c,s)):(n.subTo(r,n),t&&a.subTo(i,a),c.subTo(s,c))}return 0!=n.compareTo(o.ONE)?o.ZERO:c.compareTo(e)>=0?c.subtract(e):c.signum()<0?(c.addTo(e,c),c.signum()<0?c.add(e):c):c},o.prototype.pow=function(e){return this.exp(e,new S)},o.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var i=t.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return t;for(i0&&(t.rShiftTo(o,t),r.rShiftTo(o,r));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r},o.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r.data[0]<=I[I.length-1]){for(t=0;t{var n=r(3832);e.exports=n.md=n.md||{},n.md.algorithms=n.md.algorithms||{}},86971:(e,t,r)=>{var n=r(3832);r(83453),e.exports=n.mgf=n.mgf||{},n.mgf.mgf1=n.mgf1},83453:(e,t,r)=>{var n=r(3832);r(97116),n.mgf=n.mgf||{},(e.exports=n.mgf.mgf1=n.mgf1=n.mgf1||{}).create=function(e){return{generate:function(t,r){for(var i=new n.util.ByteBuffer,o=Math.ceil(r/e.digestLength),s=0;s{var n=r(3832);n.pki=n.pki||{};var i=e.exports=n.pki.oids=n.oids=n.oids||{};function o(e,t){i[e]=t,i[t]=e}function s(e,t){i[e]=t}o("1.2.840.113549.1.1.1","rsaEncryption"),o("1.2.840.113549.1.1.4","md5WithRSAEncryption"),o("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),o("1.2.840.113549.1.1.7","RSAES-OAEP"),o("1.2.840.113549.1.1.8","mgf1"),o("1.2.840.113549.1.1.9","pSpecified"),o("1.2.840.113549.1.1.10","RSASSA-PSS"),o("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),o("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),o("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),o("1.3.101.112","EdDSA25519"),o("1.2.840.10040.4.3","dsa-with-sha1"),o("1.3.14.3.2.7","desCBC"),o("1.3.14.3.2.26","sha1"),o("2.16.840.1.101.3.4.2.1","sha256"),o("2.16.840.1.101.3.4.2.2","sha384"),o("2.16.840.1.101.3.4.2.3","sha512"),o("1.2.840.113549.2.5","md5"),o("1.2.840.113549.1.7.1","data"),o("1.2.840.113549.1.7.2","signedData"),o("1.2.840.113549.1.7.3","envelopedData"),o("1.2.840.113549.1.7.4","signedAndEnvelopedData"),o("1.2.840.113549.1.7.5","digestedData"),o("1.2.840.113549.1.7.6","encryptedData"),o("1.2.840.113549.1.9.1","emailAddress"),o("1.2.840.113549.1.9.2","unstructuredName"),o("1.2.840.113549.1.9.3","contentType"),o("1.2.840.113549.1.9.4","messageDigest"),o("1.2.840.113549.1.9.5","signingTime"),o("1.2.840.113549.1.9.6","counterSignature"),o("1.2.840.113549.1.9.7","challengePassword"),o("1.2.840.113549.1.9.8","unstructuredAddress"),o("1.2.840.113549.1.9.14","extensionRequest"),o("1.2.840.113549.1.9.20","friendlyName"),o("1.2.840.113549.1.9.21","localKeyId"),o("1.2.840.113549.1.9.22.1","x509Certificate"),o("1.2.840.113549.1.12.10.1.1","keyBag"),o("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),o("1.2.840.113549.1.12.10.1.3","certBag"),o("1.2.840.113549.1.12.10.1.4","crlBag"),o("1.2.840.113549.1.12.10.1.5","secretBag"),o("1.2.840.113549.1.12.10.1.6","safeContentsBag"),o("1.2.840.113549.1.5.13","pkcs5PBES2"),o("1.2.840.113549.1.5.12","pkcs5PBKDF2"),o("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),o("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),o("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),o("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),o("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),o("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),o("1.2.840.113549.2.7","hmacWithSHA1"),o("1.2.840.113549.2.8","hmacWithSHA224"),o("1.2.840.113549.2.9","hmacWithSHA256"),o("1.2.840.113549.2.10","hmacWithSHA384"),o("1.2.840.113549.2.11","hmacWithSHA512"),o("1.2.840.113549.3.7","des-EDE3-CBC"),o("2.16.840.1.101.3.4.1.2","aes128-CBC"),o("2.16.840.1.101.3.4.1.22","aes192-CBC"),o("2.16.840.1.101.3.4.1.42","aes256-CBC"),o("2.5.4.3","commonName"),o("2.5.4.5","serialName"),o("2.5.4.6","countryName"),o("2.5.4.7","localityName"),o("2.5.4.8","stateOrProvinceName"),o("2.5.4.9","streetAddress"),o("2.5.4.10","organizationName"),o("2.5.4.11","organizationalUnitName"),o("2.5.4.13","description"),o("2.5.4.15","businessCategory"),o("2.5.4.17","postalCode"),o("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),o("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),o("2.16.840.1.113730.1.1","nsCertType"),o("2.16.840.1.113730.1.13","nsComment"),s("2.5.29.1","authorityKeyIdentifier"),s("2.5.29.2","keyAttributes"),s("2.5.29.3","certificatePolicies"),s("2.5.29.4","keyUsageRestriction"),s("2.5.29.5","policyMapping"),s("2.5.29.6","subtreesConstraint"),s("2.5.29.7","subjectAltName"),s("2.5.29.8","issuerAltName"),s("2.5.29.9","subjectDirectoryAttributes"),s("2.5.29.10","basicConstraints"),s("2.5.29.11","nameConstraints"),s("2.5.29.12","policyConstraints"),s("2.5.29.13","basicConstraints"),o("2.5.29.14","subjectKeyIdentifier"),o("2.5.29.15","keyUsage"),s("2.5.29.16","privateKeyUsagePeriod"),o("2.5.29.17","subjectAltName"),o("2.5.29.18","issuerAltName"),o("2.5.29.19","basicConstraints"),s("2.5.29.20","cRLNumber"),s("2.5.29.21","cRLReason"),s("2.5.29.22","expirationDate"),s("2.5.29.23","instructionCode"),s("2.5.29.24","invalidityDate"),s("2.5.29.25","cRLDistributionPoints"),s("2.5.29.26","issuingDistributionPoint"),s("2.5.29.27","deltaCRLIndicator"),s("2.5.29.28","issuingDistributionPoint"),s("2.5.29.29","certificateIssuer"),s("2.5.29.30","nameConstraints"),o("2.5.29.31","cRLDistributionPoints"),o("2.5.29.32","certificatePolicies"),s("2.5.29.33","policyMappings"),s("2.5.29.34","policyConstraints"),o("2.5.29.35","authorityKeyIdentifier"),s("2.5.29.36","policyConstraints"),o("2.5.29.37","extKeyUsage"),s("2.5.29.46","freshestCRL"),s("2.5.29.54","inhibitAnyPolicy"),o("1.3.6.1.4.1.11129.2.4.2","timestampList"),o("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),o("1.3.6.1.5.5.7.3.1","serverAuth"),o("1.3.6.1.5.5.7.3.2","clientAuth"),o("1.3.6.1.5.5.7.3.3","codeSigning"),o("1.3.6.1.5.5.7.3.4","emailProtection"),o("1.3.6.1.5.5.7.3.8","timeStamping")},97450:(e,t,r)=>{var n=r(3832);if(r(8925),r(3068),r(33480),r(28991),r(66270),r(98960),r(26953),r(49563),r(69372),r(28095),r(97116),void 0===i)var i=n.jsbn.BigInteger;var o=n.asn1,s=n.pki=n.pki||{};e.exports=s.pbe=n.pbe=n.pbe||{};var a=s.oids,c={name:"EncryptedPrivateKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},u={name:"PBES2Algorithms",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},f={name:"pkcs-12PbeParams",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"iterations"}]};function l(e,t){return e.start().update(t).digest().getBytes()}function h(e){var t;if(e){if(!(t=s.oids[o.derToOid(e)])){var r=new Error("Unsupported PRF OID.");throw r.oid=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}}else t="hmacWithSHA1";return d(t)}function d(e){var t=n.md;switch(e){case"hmacWithSHA224":t=n.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":e=e.substr(8).toLowerCase();break;default:var r=new Error("Unsupported PRF algorithm.");throw r.algorithm=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}if(!t||!(e in t))throw new Error("Unknown hash algorithm: "+e);return t[e].create()}s.encryptPrivateKeyInfo=function(e,t,r){(r=r||{}).saltSize=r.saltSize||8,r.count=r.count||2048,r.algorithm=r.algorithm||"aes128",r.prfAlgorithm=r.prfAlgorithm||"sha1";var i,c,u,f=n.random.getBytesSync(r.saltSize),l=r.count,h=o.integerToDer(l);if(0===r.algorithm.indexOf("aes")||"des"===r.algorithm){var p,y,g;switch(r.algorithm){case"aes128":i=16,p=16,y=a["aes128-CBC"],g=n.aes.createEncryptionCipher;break;case"aes192":i=24,p=16,y=a["aes192-CBC"],g=n.aes.createEncryptionCipher;break;case"aes256":i=32,p=16,y=a["aes256-CBC"],g=n.aes.createEncryptionCipher;break;case"des":i=8,p=8,y=a.desCBC,g=n.des.createEncryptionCipher;break;default:throw(_=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,_}var b="hmacWith"+r.prfAlgorithm.toUpperCase(),m=d(b),v=n.pkcs5.pbkdf2(t,f,l,i,m),w=n.random.getBytesSync(p);(S=g(v)).start(w),S.update(o.toDer(e)),S.finish(),u=S.output.getBytes();var E=function(e,t,r,i){var a=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,e),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,t.getBytes())]);return"hmacWithSHA1"!==i&&a.value.push(o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,n.util.hexToBytes(r.toString(16))),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(s.oids[i]).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")])),a}(f,h,i,b);c=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a.pkcs5PBES2).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a.pkcs5PBKDF2).getBytes()),E]),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(y).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,w)])])])}else{var _;if("3des"!==r.algorithm)throw(_=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,_;i=24;var S,A=new n.util.ByteBuffer(f);v=s.pbe.generatePkcs12Key(t,A,1,l,i),w=s.pbe.generatePkcs12Key(t,A,2,l,i),(S=n.des.createEncryptionCipher(v)).start(w),S.update(o.toDer(e)),S.finish(),u=S.output.getBytes(),c=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,f),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,h.getBytes())])])}return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[c,o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,u)])},s.decryptPrivateKeyInfo=function(e,t){var r=null,i={},a=[];if(!o.validate(e,c,i,a)){var u=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw u.errors=a,u}var f=o.derToOid(i.encryptionOid),l=s.pbe.getCipher(f,i.encryptionParams,t),h=n.util.createBuffer(i.encryptedData);return l.update(h),l.finish()&&(r=o.fromDer(l.output)),r},s.encryptedPrivateKeyToPem=function(e,t){var r={type:"ENCRYPTED PRIVATE KEY",body:o.toDer(e).getBytes()};return n.pem.encode(r,{maxline:t})},s.encryptedPrivateKeyFromPem=function(e){var t=n.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==t.type){var r=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return o.fromDer(t.body)},s.encryptRsaPrivateKey=function(e,t,r){if(!(r=r||{}).legacy){var i=s.wrapRsaPrivateKey(s.privateKeyToAsn1(e));return i=s.encryptPrivateKeyInfo(i,t,r),s.encryptedPrivateKeyToPem(i)}var a,c,u,f;switch(r.algorithm){case"aes128":a="AES-128-CBC",u=16,c=n.random.getBytesSync(16),f=n.aes.createEncryptionCipher;break;case"aes192":a="AES-192-CBC",u=24,c=n.random.getBytesSync(16),f=n.aes.createEncryptionCipher;break;case"aes256":a="AES-256-CBC",u=32,c=n.random.getBytesSync(16),f=n.aes.createEncryptionCipher;break;case"3des":a="DES-EDE3-CBC",u=24,c=n.random.getBytesSync(8),f=n.des.createEncryptionCipher;break;case"des":a="DES-CBC",u=8,c=n.random.getBytesSync(8),f=n.des.createEncryptionCipher;break;default:var l=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+r.algorithm+'".');throw l.algorithm=r.algorithm,l}var h=f(n.pbe.opensslDeriveBytes(t,c.substr(0,8),u));h.start(c),h.update(o.toDer(s.privateKeyToAsn1(e))),h.finish();var d={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:a,parameters:n.util.bytesToHex(c).toUpperCase()},body:h.output.getBytes()};return n.pem.encode(d)},s.decryptRsaPrivateKey=function(e,t){var r=null,i=n.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==i.type&&"PRIVATE KEY"!==i.type&&"RSA PRIVATE KEY"!==i.type)throw(u=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".')).headerType=u,u;if(i.procType&&"ENCRYPTED"===i.procType.type){var a,c;switch(i.dekInfo.algorithm){case"DES-CBC":a=8,c=n.des.createDecryptionCipher;break;case"DES-EDE3-CBC":a=24,c=n.des.createDecryptionCipher;break;case"AES-128-CBC":a=16,c=n.aes.createDecryptionCipher;break;case"AES-192-CBC":a=24,c=n.aes.createDecryptionCipher;break;case"AES-256-CBC":a=32,c=n.aes.createDecryptionCipher;break;case"RC2-40-CBC":a=5,c=function(e){return n.rc2.createDecryptionCipher(e,40)};break;case"RC2-64-CBC":a=8,c=function(e){return n.rc2.createDecryptionCipher(e,64)};break;case"RC2-128-CBC":a=16,c=function(e){return n.rc2.createDecryptionCipher(e,128)};break;default:var u;throw(u=new Error('Could not decrypt private key; unsupported encryption algorithm "'+i.dekInfo.algorithm+'".')).algorithm=i.dekInfo.algorithm,u}var f=n.util.hexToBytes(i.dekInfo.parameters),l=c(n.pbe.opensslDeriveBytes(t,f.substr(0,8),a));if(l.start(f),l.update(n.util.createBuffer(i.body)),!l.finish())return r;r=l.output.getBytes()}else r=i.body;return null!==(r="ENCRYPTED PRIVATE KEY"===i.type?s.decryptPrivateKeyInfo(o.fromDer(r),t):o.fromDer(r))&&(r=s.privateKeyFromAsn1(r)),r},s.pbe.generatePkcs12Key=function(e,t,r,i,o,s){var a,c;if(null==s){if(!("sha1"in n.md))throw new Error('"sha1" hash algorithm unavailable.');s=n.md.sha1.create()}var u=s.digestLength,f=s.blockLength,l=new n.util.ByteBuffer,h=new n.util.ByteBuffer;if(null!=e){for(c=0;c=0;c--)R>>=8,R+=T.at(c)+P.at(c),P.setAt(c,255&R);C.putBuffer(P)}w=C,l.putBuffer(S)}return l.truncate(l.length()-o),l},s.pbe.getCipher=function(e,t,r){switch(e){case s.oids.pkcs5PBES2:return s.pbe.getCipherForPBES2(e,t,r);case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case s.oids["pbewithSHAAnd40BitRC2-CBC"]:return s.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},s.pbe.getCipherForPBES2=function(e,t,r){var i,a={},c=[];if(!o.validate(t,u,a,c))throw(i=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=c,i;if((e=o.derToOid(a.kdfOid))!==s.oids.pkcs5PBKDF2)throw(i=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.")).oid=e,i.supportedOids=["pkcs5PBKDF2"],i;if((e=o.derToOid(a.encOid))!==s.oids["aes128-CBC"]&&e!==s.oids["aes192-CBC"]&&e!==s.oids["aes256-CBC"]&&e!==s.oids["des-EDE3-CBC"]&&e!==s.oids.desCBC)throw(i=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.")).oid=e,i.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],i;var f,l,d=a.kdfSalt,p=n.util.createBuffer(a.kdfIterationCount);switch(p=p.getInt(p.length()<<3),s.oids[e]){case"aes128-CBC":f=16,l=n.aes.createDecryptionCipher;break;case"aes192-CBC":f=24,l=n.aes.createDecryptionCipher;break;case"aes256-CBC":f=32,l=n.aes.createDecryptionCipher;break;case"des-EDE3-CBC":f=24,l=n.des.createDecryptionCipher;break;case"desCBC":f=8,l=n.des.createDecryptionCipher}var y=h(a.prfOid),g=n.pkcs5.pbkdf2(r,d,p,f,y),b=a.encIv,m=l(g);return m.start(b),m},s.pbe.getCipherForPKCS12PBE=function(e,t,r){var i={},a=[];if(!o.validate(t,f,i,a))throw(y=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=a,y;var c,u,l,d=n.util.createBuffer(i.salt),p=n.util.createBuffer(i.iterations);switch(p=p.getInt(p.length()<<3),e){case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:c=24,u=8,l=n.des.startDecrypting;break;case s.oids["pbewithSHAAnd40BitRC2-CBC"]:c=5,u=8,l=function(e,t){var r=n.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var y;throw(y=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.")).oid=e,y}var g=h(i.prfOid),b=s.pbe.generatePkcs12Key(r,d,1,p,c,g);return g.start(),l(b,s.pbe.generatePkcs12Key(r,d,2,p,u,g))},s.pbe.opensslDeriveBytes=function(e,t,r,i){if(null==i){if(!("md5"in n.md))throw new Error('"md5" hash algorithm unavailable.');i=n.md.md5.create()}null===t&&(t="");for(var o=[l(i,e+t)],s=16,a=1;s{var n=r(3832);r(36607),r(28991),r(97116);var i,o=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(i=r(25819)),e.exports=n.pbkdf2=o.pbkdf2=function(e,t,r,o,s,a){if("function"==typeof s&&(a=s,s=null),n.util.isNodejs&&!n.options.usePureJavaScript&&i.pbkdf2&&(null===s||"object"!=typeof s)&&(i.pbkdf2Sync.length>4||!s||"sha1"===s))return"string"!=typeof s&&(s="sha1"),e=Buffer.from(e,"binary"),t=Buffer.from(t,"binary"),a?4===i.pbkdf2Sync.length?i.pbkdf2(e,t,r,o,(function(e,t){if(e)return a(e);a(null,t.toString("binary"))})):i.pbkdf2(e,t,r,o,s,(function(e,t){if(e)return a(e);a(null,t.toString("binary"))})):4===i.pbkdf2Sync.length?i.pbkdf2Sync(e,t,r,o).toString("binary"):i.pbkdf2Sync(e,t,r,o,s).toString("binary");if(null==s&&(s="sha1"),"string"==typeof s){if(!(s in n.md.algorithms))throw new Error("Unknown hash algorithm: "+s);s=n.md[s].create()}var c=s.digestLength;if(o>4294967295*c){var u=new Error("Derived key is too long.");if(a)return a(u);throw u}var f=Math.ceil(o/c),l=o-(f-1)*c,h=n.hmac.create();h.start(s,e);var d,p,y,g="";if(!a){for(var b=1;b<=f;++b){h.start(null,null),h.update(t),h.update(n.util.int32ToBytes(b)),d=y=h.digest().getBytes();for(var m=2;m<=r;++m)h.start(null,null),h.update(y),p=h.digest().getBytes(),d=n.util.xorBytes(d,p,c),y=p;g+=bf)return a(null,g);h.start(null,null),h.update(t),h.update(n.util.int32ToBytes(b)),d=y=h.digest().getBytes(),m=2,w()}function w(){if(m<=r)return h.start(null,null),h.update(y),p=h.digest().getBytes(),d=n.util.xorBytes(d,p,c),y=p,++m,n.util.setImmediate(w);g+=b{var n=r(3832);r(97116);var i=e.exports=n.pem=n.pem||{};function o(e){for(var t=e.name+": ",r=[],n=function(e,t){return" "+t},i=0;i65&&-1!==s){var a=t[s];","===a?(++s,t=t.substr(0,s)+"\r\n "+t.substr(s)):t=t.substr(0,s)+"\r\n"+a+t.substr(s+1),o=i-s-1,s=-1,++i}else" "!==t[i]&&"\t"!==t[i]&&","!==t[i]||(s=i);return t}function s(e){return e.replace(/^\s+/,"")}i.encode=function(e,t){t=t||{};var r,i="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(i+=o(r={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]})),e.contentDomain&&(i+=o(r={name:"Content-Domain",values:[e.contentDomain]})),e.dekInfo&&(r={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&r.values.push(e.dekInfo.parameters),i+=o(r)),e.headers)for(var s=0;s{var n=r(3832);r(97116),r(49563),r(137);var i=e.exports=n.pkcs1=n.pkcs1||{};function o(e,t,r){r||(r=n.md.sha1.create());for(var i="",o=Math.ceil(t/r.digestLength),s=0;s>24&255,s>>16&255,s>>8&255,255&s);r.start(),r.update(e+a),i+=r.digest().getBytes()}return i.substring(0,t)}i.encode_rsa_oaep=function(e,t,r){var i,s,a,c;"string"==typeof r?(i=r,s=arguments[3]||void 0,a=arguments[4]||void 0):r&&(i=r.label||void 0,s=r.seed||void 0,a=r.md||void 0,r.mgf1&&r.mgf1.md&&(c=r.mgf1.md)),a?a.start():a=n.md.sha1.create(),c||(c=a);var u=Math.ceil(e.n.bitLength()/8),f=u-2*a.digestLength-2;if(t.length>f)throw(g=new Error("RSAES-OAEP input message length is too long.")).length=t.length,g.maxLength=f,g;i||(i=""),a.update(i,"raw");for(var l=a.digest(),h="",d=f-t.length,p=0;p{var n=r(3832);r(8925),r(3068),r(33480),r(66270),r(26953),r(95496),r(49563),r(97116),r(25414);var i=n.asn1,o=e.exports=n.pkcs7=n.pkcs7||{};function s(e){var t={},r=[];if(!i.validate(e,o.asn1.recipientInfoValidator,t,r)){var s=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw s.errors=r,s}return{version:t.version.charCodeAt(0),issuer:n.pki.RDNAttributesAsArray(t.issuer),serialNumber:n.util.createBuffer(t.serial).toHex(),encryptedContent:{algorithm:i.derToOid(t.encAlgorithm),parameter:t.encParameter.value,content:t.encKey}}}function a(e){for(var t,r=[],o=0;o0){for(var r=i.create(i.Class.CONTEXT_SPECIFIC,1,!0,[]),o=0;o=r&&s0&&s.value[0].value.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,t)),o.length>0&&s.value[0].value.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,o)),s.value[0].value.push(i.create(i.Class.UNIVERSAL,i.Type.SET,!0,e.signerInfos)),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.type).getBytes()),s])},addSigner:function(t){var r=t.issuer,i=t.serialNumber;if(t.certificate){var o=t.certificate;"string"==typeof o&&(o=n.pki.certificateFromPem(o)),r=o.issuer.attributes,i=o.serialNumber}var s=t.key;if(!s)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"==typeof s&&(s=n.pki.privateKeyFromPem(s));var a=t.digestAlgorithm||n.pki.oids.sha1;switch(a){case n.pki.oids.sha1:case n.pki.oids.sha256:case n.pki.oids.sha384:case n.pki.oids.sha512:case n.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+a)}var c=t.authenticatedAttributes||[];if(c.length>0){for(var u=!1,f=!1,l=0;l{var n=r(3832);r(3068),r(97116);var i=n.asn1,o=e.exports=n.pkcs7asn1=n.pkcs7asn1||{};n.pkcs7=n.pkcs7||{},n.pkcs7.asn1=o;var s={name:"ContentInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};o.contentInfoValidator=s;var a={name:"EncryptedContentInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};o.envelopedDataValidator={name:"EnvelopedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(a)},o.encryptedDataValidator={name:"EncryptedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"}].concat(a)};var c={name:"SignerInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};o.signedDataValidator={name:"SignedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},s,{name:"SignedData.Certificates",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,capture:"signerInfos",optional:!0,value:[c]}]},o.recipientInfoValidator={name:"RecipientInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter"}]},{name:"RecipientInfo.encryptedKey",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}},29654:(e,t,r)=>{var n=r(3832);r(97116),r(15764),r(49563),function(){if(n.prime)e.exports=n.prime;else{var t=e.exports=n.prime=n.prime||{},r=n.jsbn.BigInteger,i=[6,4,2,4,2,4,6,2],o=new r(null);o.fromInt(30);var s=function(e,t){return e|t};t.generateProbablePrime=function(e,t,i){"function"==typeof t&&(i=t,t={});var o=(t=t||{}).algorithm||"PRIMEINC";"string"==typeof o&&(o={name:o}),o.options=o.options||{};var s=t.prng||n.random,c={nextBytes:function(e){for(var t=s.getBytesSync(e.length),r=0;re&&(s=u(e,t));var d=s.toString(16);i.target.postMessage({hex:d,workLoad:f}),s.dAddOffset(l,0)}}}d()}(e,t,i,o):a(e,t,i,o)}(e,c,o.options,i);throw new Error("Invalid prime generation algorithm: "+o.name)}}function a(e,t,r,n){var i=u(e,t),o=function(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}(i.bitLength());"millerRabinTests"in r&&(o=r.millerRabinTests);var s=10;"maxBlockTime"in r&&(s=r.maxBlockTime),c(i,e,t,0,o,s,n)}function c(e,t,r,o,s,a,f){var l=+new Date;do{if(e.bitLength()>t&&(e=u(t,r)),e.isProbablePrime(s))return f(null,e);e.dAddOffset(i[o++%8],0)}while(a<0||+new Date-l{var n=r(34155),i=r(3832);r(97116);var o=null;!i.util.isNodejs||i.options.usePureJavaScript||n.versions["node-webkit"]||(o=r(25819)),(e.exports=i.prng=i.prng||{}).create=function(e){for(var t={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},r=e.md,n=new Array(32),s=0;s<32;++s)n[s]=r.create();function a(){if(t.pools[0].messageLength>=32)return c();var e=32-t.pools[0].messageLength<<5;t.collect(t.seedFileSync(e)),c()}function c(){t.reseeds=4294967295===t.reseeds?0:t.reseeds+1;var e=t.plugin.md.create();e.update(t.keyBytes);for(var r=1,n=0;n<32;++n)t.reseeds%r==0&&(e.update(t.pools[n].digest().getBytes()),t.pools[n].start()),r<<=1;t.keyBytes=e.digest().getBytes(),e.start(),e.update(t.keyBytes);var i=e.digest().getBytes();t.key=t.plugin.formatKey(t.keyBytes),t.seed=t.plugin.formatSeed(i),t.generated=0}function u(e){var t=null,r=i.util.globalScope,n=r.crypto||r.msCrypto;n&&n.getRandomValues&&(t=function(e){return n.getRandomValues(e)});var o=i.util.createBuffer();if(t)for(;o.length()>16)))<<16,h=4294967295&(f=(2147483647&(f+=u>>15))+(f>>31)),c=0;c<3;++c)l=h>>>(c<<3),l^=Math.floor(256*Math.random()),o.putByte(String.fromCharCode(255&l));return o.getBytes(e)}return t.pools=n,t.pool=0,t.generate=function(e,r){if(!r)return t.generateSync(e);var n=t.plugin.cipher,o=t.plugin.increment,s=t.plugin.formatKey,a=t.plugin.formatSeed,u=i.util.createBuffer();t.key=null,function f(l){if(l)return r(l);if(u.length()>=e)return r(null,u.getBytes(e));if(t.generated>1048575&&(t.key=null),null===t.key)return i.util.nextTick((function(){!function(e){if(t.pools[0].messageLength>=32)return c(),e();var r=32-t.pools[0].messageLength<<5;t.seedFile(r,(function(r,n){if(r)return e(r);t.collect(n),c(),e()}))}(f)}));var h=n(t.key,t.seed);t.generated+=h.length,u.putBytes(h),t.key=s(n(t.key,o(t.seed))),t.seed=a(n(t.key,t.seed)),i.util.setImmediate(f)}()},t.generateSync=function(e){var r=t.plugin.cipher,n=t.plugin.increment,o=t.plugin.formatKey,s=t.plugin.formatSeed;t.key=null;for(var c=i.util.createBuffer();c.length()1048575&&(t.key=null),null===t.key&&a();var u=r(t.key,t.seed);t.generated+=u.length,c.putBytes(u),t.key=o(r(t.key,n(t.seed))),t.seed=s(r(t.key,t.seed))}return c.getBytes(e)},o?(t.seedFile=function(e,t){o.randomBytes(e,(function(e,r){if(e)return t(e);t(null,r.toString())}))},t.seedFileSync=function(e){return o.randomBytes(e).toString()}):(t.seedFile=function(e,t){try{t(null,u(e))}catch(e){t(e)}},t.seedFileSync=u),t.collect=function(e){for(var r=e.length,n=0;n>i&255);t.collect(n)},t.registerWorker=function(e){e===self?t.seedFile=function(e,t){self.addEventListener("message",(function e(r){var n=r.data;n.forge&&n.forge.prng&&(self.removeEventListener("message",e),t(n.forge.prng.err,n.forge.prng.bytes))})),self.postMessage({forge:{prng:{needed:e}}})}:e.addEventListener("message",(function(r){var n=r.data;n.forge&&n.forge.prng&&t.seedFile(n.forge.prng.needed,(function(t,r){e.postMessage({forge:{prng:{err:t,bytes:r}}})}))}))},t}},96007:(e,t,r)=>{var n=r(3832);r(49563),r(97116),(e.exports=n.pss=n.pss||{}).create=function(e){3===arguments.length&&(e={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var t,r=e.md,i=e.mgf,o=r.digestLength,s=e.salt||null;if("string"==typeof s&&(s=n.util.createBuffer(s)),"saltLength"in e)t=e.saltLength;else{if(null===s)throw new Error("Salt length not specified or specific salt not given.");t=s.length()}if(null!==s&&s.length()!==t)throw new Error("Given salt length does not match length of given salt.");var a=e.prng||n.random,c={encode:function(e,c){var u,f,l=c-1,h=Math.ceil(l/8),d=e.digest().getBytes();if(h>8*h-l&255;return(w=String.fromCharCode(w.charCodeAt(0)&~E)+w.substr(1))+y+String.fromCharCode(188)},verify:function(e,s,a){var c,u=a-1,f=Math.ceil(u/8);if(s=s.substr(-f),f>8*f-u&255;if(0!=(h.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var y=i.generate(d,l),g="";for(c=0;c{var n=r(3832);r(8925),r(41668),r(74933),r(97116),n.random&&n.random.getBytes?e.exports=n.random:function(t){var r={},i=new Array(4),o=n.util.createBuffer();function s(){var e=n.prng.create(r);return e.getBytes=function(t,r){return e.generate(t,r)},e.getBytesSync=function(t){return e.generate(t)},e}r.formatKey=function(e){var t=n.util.createBuffer(e);return(e=new Array(4))[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),n.aes._expandKey(e,!1)},r.formatSeed=function(e){var t=n.util.createBuffer(e);return(e=new Array(4))[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),e},r.cipher=function(e,t){return n.aes._updateBlock(e,t,i,!1),o.putInt32(i[0]),o.putInt32(i[1]),o.putInt32(i[2]),o.putInt32(i[3]),o.getBytes()},r.increment=function(e){return++e[3],e},r.md=n.md.sha256;var a=s(),c=null,u=n.util.globalScope,f=u.crypto||u.msCrypto;if(f&&f.getRandomValues&&(c=function(e){return f.getRandomValues(e)}),n.options.usePureJavaScript||!n.util.isNodejs&&!c){if("undefined"==typeof window||window.document,a.collectInt(+new Date,32),"undefined"!=typeof navigator){var l="";for(var h in navigator)try{"string"==typeof navigator[h]&&(l+=navigator[h])}catch(e){}a.collect(l),l=null}t&&(t().mousemove((function(e){a.collectInt(e.clientX,16),a.collectInt(e.clientY,16)})),t().keypress((function(e){a.collectInt(e.charCode,8)})))}if(n.random)for(var h in a)n.random[h]=a[h];else n.random=a;n.random.createInstance=s,e.exports=n.random}("undefined"!=typeof jQuery?jQuery:null)},69372:(e,t,r)=>{var n=r(3832);r(97116);var i=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],o=[1,2,3,5],s=function(e,t){return e<>16-t},a=function(e,t){return(65535&e)>>t|e<<16-t&65535};e.exports=n.rc2=n.rc2||{},n.rc2.expandKey=function(e,t){"string"==typeof e&&(e=n.util.createBuffer(e)),t=t||128;var r,o=e,s=e.length(),a=t,c=Math.ceil(a/8),u=255>>(7&a);for(r=s;r<128;r++)o.putByte(i[o.at(r-1)+o.at(r-s)&255]);for(o.setAt(128-c,i[o.at(128-c)&u]),r=127-c;r>=0;r--)o.setAt(r,i[o.at(r+1)^o.at(r+c)]);return o};var c=function(e,t,r){var i,c,u,f,l=!1,h=null,d=null,p=null,y=[];for(e=n.rc2.expandKey(e,t),u=0;u<64;u++)y.push(e.getInt16Le());r?(i=function(e){for(u=0;u<4;u++)e[u]+=y[f]+(e[(u+3)%4]&e[(u+2)%4])+(~e[(u+3)%4]&e[(u+1)%4]),e[u]=s(e[u],o[u]),f++},c=function(e){for(u=0;u<4;u++)e[u]+=y[63&e[(u+3)%4]]}):(i=function(e){for(u=3;u>=0;u--)e[u]=a(e[u],o[u]),e[u]-=y[f]+(e[(u+3)%4]&e[(u+2)%4])+(~e[(u+3)%4]&e[(u+1)%4]),f--},c=function(e){for(u=3;u>=0;u--)e[u]-=y[63&e[(u+3)%4]]});var g=function(e){var t=[];for(u=0;u<4;u++){var n=h.getInt16Le();null!==p&&(r?n^=p.getInt16Le():p.putInt16Le(n)),t.push(65535&n)}f=r?0:63;for(var i=0;i=8;)g([[5,i],[1,c],[6,i],[1,c],[5,i]])},finish:function(e){var t=!0;if(r)if(e)t=e(8,h,!r);else{var n=8===h.length()?8:8-h.length();h.fillWithByte(n,n)}if(t&&(l=!0,b.update()),!r&&(t=0===h.length()))if(e)t=e(8,d,!r);else{var i=d.length(),o=d.at(i-1);o>i?t=!1:d.truncate(o)}return t}}};n.rc2.startEncrypting=function(e,t,r){var i=n.rc2.createEncryptionCipher(e,128);return i.start(t,r),i},n.rc2.createEncryptionCipher=function(e,t){return c(e,t,!0)},n.rc2.startDecrypting=function(e,t,r){var i=n.rc2.createDecryptionCipher(e,128);return i.start(t,r),i},n.rc2.createDecryptionCipher=function(e,t){return c(e,t,!1)}},28095:(e,t,r)=>{var n=r(3832);if(r(3068),r(15764),r(66270),r(18936),r(29654),r(49563),r(97116),void 0===i)var i=n.jsbn.BigInteger;var o=n.util.isNodejs?r(25819):null,s=n.asn1,a=n.util;n.pki=n.pki||{},e.exports=n.pki.rsa=n.rsa=n.rsa||{};var c=n.pki,u=[6,4,2,4,2,4,6,2],f={name:"PrivateKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},l={name:"RSAPrivateKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},h={name:"RSAPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},d=n.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},p=function(e){var t;if(!(e.algorithm in c.oids)){var r=new Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r}t=c.oids[e.algorithm];var n=s.oidToDer(t).getBytes(),i=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[]),o=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[]);o.value.push(s.create(s.Class.UNIVERSAL,s.Type.OID,!1,n)),o.value.push(s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,""));var a=s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,e.digest().getBytes());return i.value.push(o),i.value.push(a),s.toDer(i).getBytes()},y=function(e,t,r){if(r)return e.modPow(t.e,t.n);if(!t.p||!t.q)return e.modPow(t.d,t.n);var o;t.dP||(t.dP=t.d.mod(t.p.subtract(i.ONE))),t.dQ||(t.dQ=t.d.mod(t.q.subtract(i.ONE))),t.qInv||(t.qInv=t.q.modInverse(t.p));do{o=new i(n.util.bytesToHex(n.random.getBytes(t.n.bitLength()/8)),16)}while(o.compareTo(t.n)>=0||!o.gcd(t.n).equals(i.ONE));for(var s=(e=e.multiply(o.modPow(t.e,t.n)).mod(t.n)).mod(t.p).modPow(t.dP,t.p),a=e.mod(t.q).modPow(t.dQ,t.q);s.compareTo(a)<0;)s=s.add(t.p);var c=s.subtract(a).multiply(t.qInv).mod(t.p).multiply(t.q).add(a);return c.multiply(o.modInverse(t.n)).mod(t.n)};function g(e,t,r){var i=n.util.createBuffer(),o=Math.ceil(t.n.bitLength()/8);if(e.length>o-11){var s=new Error("Message is too long for PKCS#1 v1.5 padding.");throw s.length=e.length,s.max=o-11,s}i.putByte(0),i.putByte(r);var a,c=o-3-e.length;if(0===r||1===r){a=0===r?0:255;for(var u=0;u0;){var f=0,l=n.random.getBytes(c);for(u=0;u1;){if(255!==s.getByte()){--s.read;break}++u}else if(2===c)for(u=0;s.length()>1;){if(0===s.getByte()){--s.read;break}++u}if(0!==s.getByte()||u!==o-3-s.length())throw new Error("Encryption block is invalid.");return s.getBytes()}function m(e,t,r){"function"==typeof t&&(r=t,t={});var o={algorithm:{name:(t=t||{}).algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};function s(){a(e.pBits,(function(t,n){return t?r(t):(e.p=n,null!==e.q?u(t,e.q):void a(e.qBits,u))}))}function a(e,t){n.prime.generateProbablePrime(e,o,t)}function u(t,n){if(t)return r(t);if(e.q=n,e.p.compareTo(e.q)<0){var o=e.p;e.p=e.q,e.q=o}if(0!==e.p.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.p=null,void s();if(0!==e.q.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.q=null,void a(e.qBits,u);if(e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),0!==e.phi.gcd(e.e).compareTo(i.ONE))return e.p=e.q=null,void s();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void a(e.qBits,u);var f=e.e.modInverse(e.phi);e.keys={privateKey:c.rsa.setPrivateKey(e.n,e.e,f,e.p,e.q,f.mod(e.p1),f.mod(e.q1),e.q.modInverse(e.p)),publicKey:c.rsa.setPublicKey(e.n,e.e)},r(null,e.keys)}"prng"in t&&(o.prng=t.prng),s()}function v(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var r=n.util.hexToBytes(t);return r.length>1&&(0===r.charCodeAt(0)&&0==(128&r.charCodeAt(1))||255===r.charCodeAt(0)&&128==(128&r.charCodeAt(1)))?r.substr(1):r}function w(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function E(e){return n.util.isNodejs&&"function"==typeof o[e]}function _(e){return void 0!==a.globalScope&&"object"==typeof a.globalScope.crypto&&"object"==typeof a.globalScope.crypto.subtle&&"function"==typeof a.globalScope.crypto.subtle[e]}function S(e){return void 0!==a.globalScope&&"object"==typeof a.globalScope.msCrypto&&"object"==typeof a.globalScope.msCrypto.subtle&&"function"==typeof a.globalScope.msCrypto.subtle[e]}function A(e){for(var t=n.util.hexToBytes(e.toString(16)),r=new Uint8Array(t.length),i=0;i0;)f.putByte(0),--l;return f.putBytes(n.util.hexToBytes(u)),f.getBytes()},c.rsa.decrypt=function(e,t,r,o){var s=Math.ceil(t.n.bitLength()/8);if(e.length!==s){var a=new Error("Encrypted message length is invalid.");throw a.length=e.length,a.expected=s,a}var c=new i(n.util.createBuffer(e).toHex(),16);if(c.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var u=y(c,t,r).toString(16),f=n.util.createBuffer(),l=s-Math.ceil(u.length/2);l>0;)f.putByte(0),--l;return f.putBytes(n.util.hexToBytes(u)),!1!==o?b(f.getBytes(),t,r):f.getBytes()},c.rsa.createKeyPairGenerationState=function(e,t,r){"string"==typeof e&&(e=parseInt(e,10)),e=e||2048;var o,s=(r=r||{}).prng||n.random,a={nextBytes:function(e){for(var t=s.getBytesSync(e.length),r=0;r>1,pBits:e-(e>>1),pqState:0,num:null,keys:null}).e.fromInt(o.eInt),o},c.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var r=new i(null);r.fromInt(30);for(var n,o=0,s=function(e,t){return e|t},a=+new Date,f=0;null===e.keys&&(t<=0||fl?e.pqState=0:e.num.isProbablePrime(w(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(u[o++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(i.ONE).gcd(e.e).compareTo(i.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(i.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var d=e.e.modInverse(e.phi);e.keys={privateKey:c.rsa.setPrivateKey(e.n,e.e,d,e.p,e.q,d.mod(e.p1),d.mod(e.q1),e.q.modInverse(e.p)),publicKey:c.rsa.setPublicKey(e.n,e.e)}}f+=(n=+new Date)-a,a=n}return null!==e.keys},c.rsa.generateKeyPair=function(e,t,r,i){if(1===arguments.length?"object"==typeof e?(r=e,e=void 0):"function"==typeof e&&(i=e,e=void 0):2===arguments.length?"number"==typeof e?"function"==typeof t?(i=t,t=void 0):"number"!=typeof t&&(r=t,t=void 0):(r=e,i=t,e=void 0,t=void 0):3===arguments.length&&("number"==typeof t?"function"==typeof r&&(i=r,r=void 0):(i=r,r=t,t=void 0)),r=r||{},void 0===e&&(e=r.bits||2048),void 0===t&&(t=r.e||65537),!n.options.usePureJavaScript&&!r.prng&&e>=256&&e<=16384&&(65537===t||3===t))if(i){if(E("generateKeyPair"))return o.generateKeyPair("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},(function(e,t,r){if(e)return i(e);i(null,{privateKey:c.privateKeyFromPem(r),publicKey:c.publicKeyFromPem(t)})}));if(_("generateKey")&&_("exportKey"))return a.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:A(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then((function(e){return a.globalScope.crypto.subtle.exportKey("pkcs8",e.privateKey)})).then(void 0,(function(e){i(e)})).then((function(e){if(e){var t=c.privateKeyFromAsn1(s.fromDer(n.util.createBuffer(e)));i(null,{privateKey:t,publicKey:c.setRsaPublicKey(t.n,t.e)})}}));if(S("generateKey")&&S("exportKey")){var u=a.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:A(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);return u.oncomplete=function(e){var t=e.target.result,r=a.globalScope.msCrypto.subtle.exportKey("pkcs8",t.privateKey);r.oncomplete=function(e){var t=e.target.result,r=c.privateKeyFromAsn1(s.fromDer(n.util.createBuffer(t)));i(null,{privateKey:r,publicKey:c.setRsaPublicKey(r.n,r.e)})},r.onerror=function(e){i(e)}},void(u.onerror=function(e){i(e)})}}else if(E("generateKeyPairSync")){var f=o.generateKeyPairSync("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:c.privateKeyFromPem(f.privateKey),publicKey:c.publicKeyFromPem(f.publicKey)}}var l=c.rsa.createKeyPairGenerationState(e,t,r);if(!i)return c.rsa.stepKeyPairGenerationState(l,0),l.keys;m(l,r,i)},c.setRsaPublicKey=c.rsa.setPublicKey=function(e,t){var r={n:e,e:t,encrypt:function(e,t,i){if("string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===t)t={encode:function(e,t,r){return g(e,t,2).getBytes()}};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={encode:function(e,t){return n.pkcs1.encode_rsa_oaep(t,e,i)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(t))t={encode:function(e){return e}};else if("string"==typeof t)throw new Error('Unsupported encryption scheme: "'+t+'".');var o=t.encode(e,r,!0);return c.rsa.encrypt(o,r,!0)},verify:function(e,t,n){"string"==typeof n?n=n.toUpperCase():void 0===n&&(n="RSASSA-PKCS1-V1_5"),"RSASSA-PKCS1-V1_5"===n?n={verify:function(e,t){return t=b(t,r,!0),e===s.fromDer(t).value[1].value}}:"NONE"!==n&&"NULL"!==n&&null!==n||(n={verify:function(e,t){return e===b(t,r,!0)}});var i=c.rsa.decrypt(t,r,!0,!1);return n.verify(e,i,r.n.bitLength())}};return r},c.setRsaPrivateKey=c.rsa.setPrivateKey=function(e,t,r,i,o,s,a,u){var f={n:e,e:t,d:r,p:i,q:o,dP:s,dQ:a,qInv:u,decrypt:function(e,t,r){"string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5");var i=c.rsa.decrypt(e,f,!1,!1);if("RSAES-PKCS1-V1_5"===t)t={decode:b};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={decode:function(e,t){return n.pkcs1.decode_rsa_oaep(t,e,r)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(t))throw new Error('Unsupported encryption scheme: "'+t+'".');t={decode:function(e){return e}}}return t.decode(i,f,!1)},sign:function(e,t){var r=!1;"string"==typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:p},r=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},r=1);var n=t.encode(e,f.n.bitLength());return c.rsa.encrypt(n,f,r)}};return f},c.wrapRsaPrivateKey=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,s.integerToDer(0).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(c.oids.rsaEncryption).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,"")]),s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,s.toDer(e).getBytes())])},c.privateKeyFromAsn1=function(e){var t,r,o,a,u,h,d,p,y={},g=[];if(s.validate(e,f,y,g)&&(e=s.fromDer(n.util.createBuffer(y.privateKey))),y={},g=[],!s.validate(e,l,y,g)){var b=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw b.errors=g,b}return t=n.util.createBuffer(y.privateKeyModulus).toHex(),r=n.util.createBuffer(y.privateKeyPublicExponent).toHex(),o=n.util.createBuffer(y.privateKeyPrivateExponent).toHex(),a=n.util.createBuffer(y.privateKeyPrime1).toHex(),u=n.util.createBuffer(y.privateKeyPrime2).toHex(),h=n.util.createBuffer(y.privateKeyExponent1).toHex(),d=n.util.createBuffer(y.privateKeyExponent2).toHex(),p=n.util.createBuffer(y.privateKeyCoefficient).toHex(),c.setRsaPrivateKey(new i(t,16),new i(r,16),new i(o,16),new i(a,16),new i(u,16),new i(h,16),new i(d,16),new i(p,16))},c.privateKeyToAsn1=c.privateKeyToRSAPrivateKey=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,s.integerToDer(0).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,v(e.n)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,v(e.e)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,v(e.d)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,v(e.p)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,v(e.q)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,v(e.dP)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,v(e.dQ)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,v(e.qInv))])},c.publicKeyFromAsn1=function(e){var t={},r=[];if(s.validate(e,d,t,r)){var o,a=s.derToOid(t.publicKeyOid);if(a!==c.oids.rsaEncryption)throw(o=new Error("Cannot read public key. Unknown OID.")).oid=a,o;e=t.rsaPublicKey}if(r=[],!s.validate(e,h,t,r))throw(o=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=r,o;var u=n.util.createBuffer(t.publicKeyModulus).toHex(),f=n.util.createBuffer(t.publicKeyExponent).toHex();return c.setRsaPublicKey(new i(u,16),new i(f,16))},c.publicKeyToAsn1=c.publicKeyToSubjectPublicKeyInfo=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(c.oids.rsaEncryption).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,"")]),s.create(s.Class.UNIVERSAL,s.Type.BITSTRING,!1,[c.publicKeyToRSAPublicKey(e)])])},c.publicKeyToRSAPublicKey=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,v(e.n)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,v(e.e))])}},137:(e,t,r)=>{var n=r(3832);r(28991),r(97116);var i=e.exports=n.sha1=n.sha1||{};n.md.sha1=n.md.algorithms.sha1=i,i.create=function(){s||(o=String.fromCharCode(128),o+=n.util.fillString(String.fromCharCode(0),64),s=!0);var e=null,t=n.util.createBuffer(),r=new Array(80),i={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var r=i.messageLengthSize/4,o=0;o>>0,c>>>0];for(var u=i.fullMessageLength.length-1;u>=0;--u)i.fullMessageLength[u]+=c[1],c[1]=c[0]+(i.fullMessageLength[u]/4294967296>>>0),i.fullMessageLength[u]=i.fullMessageLength[u]>>>0,c[0]=c[1]/4294967296>>>0;return t.putBytes(o),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var s=n.util.createBuffer();s.putBytes(t.bytes());var c,u=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;s.putBytes(o.substr(0,i.blockLength-u));for(var f=8*i.fullMessageLength[0],l=0;l>>0,s.putInt32(f>>>0),f=c>>>0;s.putInt32(f);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};a(h,r,s);var d=n.util.createBuffer();return d.putInt32(h.h0),d.putInt32(h.h1),d.putInt32(h.h2),d.putInt32(h.h3),d.putInt32(h.h4),d},i};var o=null,s=!1;function a(e,t,r){for(var n,i,o,s,a,c,u,f=r.length();f>=64;){for(i=e.h0,o=e.h1,s=e.h2,a=e.h3,c=e.h4,u=0;u<16;++u)n=r.getInt32(),t[u]=n,n=(i<<5|i>>>27)+(a^o&(s^a))+c+1518500249+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;u<20;++u)n=(n=t[u-3]^t[u-8]^t[u-14]^t[u-16])<<1|n>>>31,t[u]=n,n=(i<<5|i>>>27)+(a^o&(s^a))+c+1518500249+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;u<32;++u)n=(n=t[u-3]^t[u-8]^t[u-14]^t[u-16])<<1|n>>>31,t[u]=n,n=(i<<5|i>>>27)+(o^s^a)+c+1859775393+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;u<40;++u)n=(n=t[u-6]^t[u-16]^t[u-28]^t[u-32])<<2|n>>>30,t[u]=n,n=(i<<5|i>>>27)+(o^s^a)+c+1859775393+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;u<60;++u)n=(n=t[u-6]^t[u-16]^t[u-28]^t[u-32])<<2|n>>>30,t[u]=n,n=(i<<5|i>>>27)+(o&s|a&(o^s))+c+2400959708+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;u<80;++u)n=(n=t[u-6]^t[u-16]^t[u-28]^t[u-32])<<2|n>>>30,t[u]=n,n=(i<<5|i>>>27)+(o^s^a)+c+3395469782+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;e.h0=e.h0+i|0,e.h1=e.h1+o|0,e.h2=e.h2+s|0,e.h3=e.h3+a|0,e.h4=e.h4+c|0,f-=64}}},41668:(e,t,r)=>{var n=r(3832);r(28991),r(97116);var i=e.exports=n.sha256=n.sha256||{};n.md.sha256=n.md.algorithms.sha256=i,i.create=function(){s||(o=String.fromCharCode(128),o+=n.util.fillString(String.fromCharCode(0),64),a=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],s=!0);var e=null,t=n.util.createBuffer(),r=new Array(64),i={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var r=i.messageLengthSize/4,o=0;o>>0,a>>>0];for(var u=i.fullMessageLength.length-1;u>=0;--u)i.fullMessageLength[u]+=a[1],a[1]=a[0]+(i.fullMessageLength[u]/4294967296>>>0),i.fullMessageLength[u]=i.fullMessageLength[u]>>>0,a[0]=a[1]/4294967296>>>0;return t.putBytes(o),c(e,r,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var s=n.util.createBuffer();s.putBytes(t.bytes());var a,u=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;s.putBytes(o.substr(0,i.blockLength-u));for(var f=8*i.fullMessageLength[0],l=0;l>>0,s.putInt32(f>>>0),f=a>>>0;s.putInt32(f);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};c(h,r,s);var d=n.util.createBuffer();return d.putInt32(h.h0),d.putInt32(h.h1),d.putInt32(h.h2),d.putInt32(h.h3),d.putInt32(h.h4),d.putInt32(h.h5),d.putInt32(h.h6),d.putInt32(h.h7),d},i};var o=null,s=!1,a=null;function c(e,t,r){for(var n,i,o,s,c,u,f,l,h,d,p,y,g,b=r.length();b>=64;){for(c=0;c<16;++c)t[c]=r.getInt32();for(;c<64;++c)n=((n=t[c-2])>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,i=((i=t[c-15])>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,t[c]=n+t[c-7]+i+t[c-16]|0;for(u=e.h0,f=e.h1,l=e.h2,h=e.h3,d=e.h4,p=e.h5,y=e.h6,g=e.h7,c=0;c<64;++c)o=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),s=u&f|l&(u^f),n=g+((d>>>6|d<<26)^(d>>>11|d<<21)^(d>>>25|d<<7))+(y^d&(p^y))+a[c]+t[c],g=y,y=p,p=d,d=h+n>>>0,h=l,l=f,f=u,u=n+(i=o+s)>>>0;e.h0=e.h0+u|0,e.h1=e.h1+f|0,e.h2=e.h2+l|0,e.h3=e.h3+h|0,e.h4=e.h4+d|0,e.h5=e.h5+p|0,e.h6=e.h6+y|0,e.h7=e.h7+g|0,b-=64}}},63219:(e,t,r)=>{var n=r(3832);r(28991),r(97116);var i=e.exports=n.sha512=n.sha512||{};n.md.sha512=n.md.algorithms.sha512=i;var o=n.sha384=n.sha512.sha384=n.sha512.sha384||{};o.create=function(){return i.create("SHA-384")},n.md.sha384=n.md.algorithms.sha384=o,n.sha512.sha256=n.sha512.sha256||{create:function(){return i.create("SHA-512/256")}},n.md["sha512/256"]=n.md.algorithms["sha512/256"]=n.sha512.sha256,n.sha512.sha224=n.sha512.sha224||{create:function(){return i.create("SHA-512/224")}},n.md["sha512/224"]=n.md.algorithms["sha512/224"]=n.sha512.sha224,i.create=function(e){if(a||(s=String.fromCharCode(128),s+=n.util.fillString(String.fromCharCode(0),128),c=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],(u={})["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],u["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],u["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],u["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],a=!0),void 0===e&&(e="SHA-512"),!(e in u))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=u[e],r=null,i=n.util.createBuffer(),o=new Array(80),l=0;l<80;++l)o[l]=new Array(2);var h=64;switch(e){case"SHA-384":h=48;break;case"SHA-512/256":h=32;break;case"SHA-512/224":h=28}var d={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:h,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){d.messageLength=0,d.fullMessageLength=d.messageLength128=[];for(var e=d.messageLengthSize/4,o=0;o>>0,s>>>0];for(var a=d.fullMessageLength.length-1;a>=0;--a)d.fullMessageLength[a]+=s[1],s[1]=s[0]+(d.fullMessageLength[a]/4294967296>>>0),d.fullMessageLength[a]=d.fullMessageLength[a]>>>0,s[0]=s[1]/4294967296>>>0;return i.putBytes(e),f(r,o,i),(i.read>2048||0===i.length())&&i.compact(),d},d.digest=function(){var t=n.util.createBuffer();t.putBytes(i.bytes());var a,c=d.fullMessageLength[d.fullMessageLength.length-1]+d.messageLengthSize&d.blockLength-1;t.putBytes(s.substr(0,d.blockLength-c));for(var u=8*d.fullMessageLength[0],l=0;l>>0,t.putInt32(u>>>0),u=a>>>0;t.putInt32(u);var h=new Array(r.length);for(l=0;l=128;){for(k=0;k<16;++k)t[k][0]=r.getInt32()>>>0,t[k][1]=r.getInt32()>>>0;for(;k<80;++k)n=(((B=(M=t[k-2])[0])>>>19|(x=M[1])<<13)^(x>>>29|B<<3)^B>>>6)>>>0,i=((B<<13|x>>>19)^(x<<3|B>>>29)^(B<<26|x>>>6))>>>0,o=(((B=(N=t[k-15])[0])>>>1|(x=N[1])<<31)^(B>>>8|x<<24)^B>>>7)>>>0,s=((B<<31|x>>>1)^(B<<24|x>>>8)^(B<<25|x>>>7))>>>0,O=t[k-7],L=t[k-16],x=i+O[1]+s+L[1],t[k][0]=n+O[0]+o+L[0]+(x/4294967296>>>0)>>>0,t[k][1]=x>>>0;for(p=e[0][0],y=e[0][1],g=e[1][0],b=e[1][1],m=e[2][0],v=e[2][1],w=e[3][0],E=e[3][1],_=e[4][0],S=e[4][1],A=e[5][0],T=e[5][1],I=e[6][0],C=e[6][1],P=e[7][0],R=e[7][1],k=0;k<80;++k)f=((_>>>14|S<<18)^(_>>>18|S<<14)^(S>>>9|_<<23))>>>0,l=(I^_&(A^I))>>>0,a=((p>>>28|y<<4)^(y>>>2|p<<30)^(y>>>7|p<<25))>>>0,u=((p<<4|y>>>28)^(y<<30|p>>>2)^(y<<25|p>>>7))>>>0,h=(p&g|m&(p^g))>>>0,d=(y&b|v&(y^b))>>>0,x=R+(((_<<18|S>>>14)^(_<<14|S>>>18)^(S<<23|_>>>9))>>>0)+((C^S&(T^C))>>>0)+c[k][1]+t[k][1],n=P+f+l+c[k][0]+t[k][0]+(x/4294967296>>>0)>>>0,i=x>>>0,o=a+h+((x=u+d)/4294967296>>>0)>>>0,s=x>>>0,P=I,R=C,I=A,C=T,A=_,T=S,_=w+n+((x=E+i)/4294967296>>>0)>>>0,S=x>>>0,w=m,E=v,m=g,v=b,g=p,b=y,p=n+o+((x=i+s)/4294967296>>>0)>>>0,y=x>>>0;x=e[0][1]+y,e[0][0]=e[0][0]+p+(x/4294967296>>>0)>>>0,e[0][1]=x>>>0,x=e[1][1]+b,e[1][0]=e[1][0]+g+(x/4294967296>>>0)>>>0,e[1][1]=x>>>0,x=e[2][1]+v,e[2][0]=e[2][0]+m+(x/4294967296>>>0)>>>0,e[2][1]=x>>>0,x=e[3][1]+E,e[3][0]=e[3][0]+w+(x/4294967296>>>0)>>>0,e[3][1]=x>>>0,x=e[4][1]+S,e[4][0]=e[4][0]+_+(x/4294967296>>>0)>>>0,e[4][1]=x>>>0,x=e[5][1]+T,e[5][0]=e[5][0]+A+(x/4294967296>>>0)>>>0,e[5][1]=x>>>0,x=e[6][1]+C,e[6][0]=e[6][0]+I+(x/4294967296>>>0)>>>0,e[6][1]=x>>>0,x=e[7][1]+R,e[7][0]=e[7][0]+P+(x/4294967296>>>0)>>>0,e[7][1]=x>>>0,D-=128}}},97116:(e,t,r)=>{var n=r(34155),i=r(3832),o=r(78807),s=e.exports=i.util=i.util||{};function a(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function c(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(s.isArrayBuffer(e)||s.isArrayBufferView(e))if("undefined"!=typeof Buffer&&e instanceof Buffer)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(e){for(var r=0;r15?(r=Date.now(),a(e)):(t.push(e),1===t.length&&o.setAttribute("a",i=!i))}}s.nextTick=s.setImmediate}(),s.isNodejs=void 0!==n&&n.versions&&n.versions.node,s.globalScope=s.isNodejs?r.g:"undefined"==typeof self?window:self,s.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},s.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},s.isArrayBufferView=function(e){return e&&s.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},s.ByteBuffer=c,s.ByteStringBuffer=c,s.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},s.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},s.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},s.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},s.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},s.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},s.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(s.encodeUtf8(e))},s.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},s.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},s.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},s.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},s.ByteStringBuffer.prototype.putInt=function(e,t){a(t);var r="";do{t-=8,r+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(r)},s.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<0);return t},s.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},s.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},s.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},s.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},s.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},s.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},s.ByteStringBuffer.prototype.copy=function(){var e=s.createBuffer(this.data);return e.read=this.read,e},s.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},s.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},s.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},s.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t=e)return this;t=Math.max(t||this.growSize,e);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+t);return n.set(r),this.data=new DataView(n.buffer),this},s.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},s.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},s.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},s.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},s.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},s.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},s.DataBuffer.prototype.putInt=function(e,t){a(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},s.DataBuffer.prototype.putSignedInt=function(e,t){return a(t),this.accommodate(t/8),e<0&&(e+=2<0);return t},s.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},s.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},s.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},s.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},s.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},s.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},s.DataBuffer.prototype.copy=function(){return new s.DataBuffer(this)},s.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},s.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},s.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},s.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return r},s.xorBytes=function(e,t,r){for(var n="",i="",o="",s=0,a=0;r>0;--r,++s)i=e.charCodeAt(s)^t.charCodeAt(s),a>=10&&(n+=o,o="",a=0),o+=String.fromCharCode(i),++a;return n+o},s.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",f=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],l="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";s.encode64=function(e,t){for(var r,n,i,o="",s="",a=0;a>2),o+=u.charAt((3&r)<<4|n>>4),isNaN(n)?o+="==":(o+=u.charAt((15&n)<<2|i>>6),o+=isNaN(i)?"=":u.charAt(63&i)),t&&o.length>t&&(s+=o.substr(0,t)+"\r\n",o=o.substr(t));return s+o},s.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,n,i,o="",s=0;s>4),64!==n&&(o+=String.fromCharCode((15&r)<<4|n>>2),64!==i&&(o+=String.fromCharCode((3&n)<<6|i)));return o},s.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},s.decodeUtf8=function(e){return decodeURIComponent(escape(e))},s.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:o.encode,decode:o.decode}},s.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},s.binary.raw.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length));for(var i=r=r||0,o=0;o>2),o+=u.charAt((3&r)<<4|n>>4),isNaN(n)?o+="==":(o+=u.charAt((15&n)<<2|i>>6),o+=isNaN(i)?"=":u.charAt(63&i)),t&&o.length>t&&(s+=o.substr(0,t)+"\r\n",o=o.substr(t));return s+o},s.binary.base64.decode=function(e,t,r){var n,i,o,s,a=t;a||(a=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var c=0,u=r=r||0;c>4,64!==o&&(a[u++]=(15&i)<<4|o>>2,64!==s&&(a[u++]=(3&o)<<6|s));return t?u-r:a.subarray(0,u)},s.binary.base58.encode=function(e,t){return s.binary.baseN.encode(e,l,t)},s.binary.base58.decode=function(e,t){return s.binary.baseN.decode(e,l,t)},s.text={utf8:{},utf16:{}},s.text.utf8.encode=function(e,t,r){e=s.encodeUtf8(e);var n=t;n||(n=new Uint8Array(e.length));for(var i=r=r||0,o=0;o0?(i=r[n].substring(0,s),o=r[n].substring(s+1)):(i=r[n],o=null),i in t||(t[i]=[]),i in Object.prototype||null===o||t[i].push(unescape(o))}return t};return void 0===e?(null===v&&(v="undefined"!=typeof window&&window.location&&window.location.search?r(window.location.search.substring(1)):{}),t=v):t=r(e),t},s.parseFragment=function(e){var t=e,r="",n=e.indexOf("?");n>0&&(t=e.substring(0,n),r=e.substring(n+1));var i=t.split("/");return i.length>0&&""===i[0]&&i.shift(),{pathString:t,queryString:r,path:i,query:""===r?{}:s.getQueryVariables(r)}},s.makeRequest=function(e){var t=s.parseFragment(e),r={path:t.pathString,query:t.queryString,getPath:function(e){return void 0===e?t.path:t.path[e]},getQuery:function(e,r){var n;return void 0===e?n=t.query:(n=t.query[e])&&void 0!==r&&(n=n[r]),n},getQueryLast:function(e,t){var n=r.getQuery(e);return n?n[n.length-1]:t}};return r},s.makeLink=function(e,t,r){e=jQuery.isArray(e)?e.join("/"):e;var n=jQuery.param(t||{});return r=r||"",e+(n.length>0?"?"+n:"")+(r.length>0?"#"+r:"")},s.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},s.format=function(e){for(var t,r,n=/%./g,i=0,o=[],s=0;t=n.exec(e);){(r=e.substring(s,n.lastIndex-2)).length>0&&o.push(r),s=n.lastIndex;var a=t[0][1];switch(a){case"s":case"o":i");break;case"%":o.push("%");break;default:o.push("<%"+a+"?>")}}return o.push(e.substring(s)),o.join("")},s.formatNumber=function(e,t,r,n){var i=e,o=isNaN(t=Math.abs(t))?2:t,s=void 0===r?",":r,a=void 0===n?".":n,c=i<0?"-":"",u=parseInt(i=Math.abs(+i||0).toFixed(o),10)+"",f=u.length>3?u.length%3:0;return c+(f?u.substr(0,f)+a:"")+u.substr(f).replace(/(\d{3})(?=\d)/g,"$1"+a)+(o?s+Math.abs(i-u).toFixed(o).slice(2):"")},s.formatSize=function(e){return e>=1073741824?s.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?s.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?s.formatNumber(e/1024,0)+" KiB":s.formatNumber(e,0)+" bytes"},s.bytesFromIP=function(e){return-1!==e.indexOf(".")?s.bytesFromIPv4(e):-1!==e.indexOf(":")?s.bytesFromIPv6(e):null},s.bytesFromIPv4=function(e){if(4!==(e=e.split(".")).length)return null;for(var t=s.createBuffer(),r=0;rr[n].end-r[n].start&&(n=r.length-1)):r.push({start:c,end:c})}t.push(o)}if(r.length>0){var u=r[n];u.end-u.start>0&&(t.splice(u.start,u.end-u.start+1,""),0===u.start&&t.unshift(""),7===u.end&&t.push(""))}return t.join(":")},s.estimateCores=function(e,t){if("function"==typeof e&&(t=e,e={}),e=e||{},"cores"in s&&!e.update)return t(null,s.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return s.cores=navigator.hardwareConcurrency,t(null,s.cores);if("undefined"==typeof Worker)return s.cores=1,t(null,s.cores);if("undefined"==typeof Blob)return s.cores=2,t(null,s.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",(function(e){for(var t=Date.now(),r=t+4;Date.now()a.st&&i.sti.st&&a.st{var n=r(3832);r(8925),r(3068),r(33480),r(28991),r(86971),r(66270),r(26953),r(96007),r(28095),r(97116);var i=n.asn1,o=e.exports=n.pki=n.pki||{},s=o.oids,a={};a.CN=s.commonName,a.commonName="CN",a.C=s.countryName,a.countryName="C",a.L=s.localityName,a.localityName="L",a.ST=s.stateOrProvinceName,a.stateOrProvinceName="ST",a.O=s.organizationName,a.organizationName="O",a.OU=s.organizationalUnitName,a.organizationalUnitName="OU",a.E=s.emailAddress,a.emailAddress="E";var c=n.pki.rsa.publicKeyValidator,u={name:"Certificate",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:i.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:i.Class.UNIVERSAL,type:i.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:i.Class.UNIVERSAL,type:i.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:i.Class.UNIVERSAL,type:i.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:i.Class.UNIVERSAL,type:i.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},c,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:i.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:i.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:i.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},f={name:"rsapss",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:i.Class.UNIVERSAL,type:i.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:i.Class.UNIVERSAL,type:i.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:i.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:i.Class.UNIVERSAL,type:i.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:i.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:i.Class.UNIVERSAL,type:i.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},l={name:"CertificationRequestInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},c,{name:"CertificationRequestInfo.attributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0}]}]}]},h={name:"CertificationRequest",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[l,{name:"CertificationRequest.signatureAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:i.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};function d(e,t){"string"==typeof t&&(t={shortName:t});for(var r,n=null,i=0;null===n&&i128)throw new Error('Invalid "nsComment" content.');e.value=i.create(i.Class.UNIVERSAL,i.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&t.cert){var d=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=d.toHex(),e.value=i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,d.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){if(e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),f=e.value.value,e.keyIdentifier){var p=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;f.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!1,p))}if(e.authorityCertIssuer){var g=[i.create(i.Class.CONTEXT_SPECIFIC,4,!0,[y(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];f.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,g))}if(e.serialNumber){var b=n.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);f.push(i.create(i.Class.CONTEXT_SPECIFIC,2,!1,b))}}else if("cRLDistributionPoints"===e.name){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),f=e.value.value;var m,v=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),w=i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[]);for(h=0;h2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(l.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(c.validity.notBefore=l[0],c.validity.notAfter=l[1],c.tbsCertificate=r.tbsCertificate,t){var h;if(c.md=null,c.signatureOid in s)switch(s[c.signatureOid]){case"sha1WithRSAEncryption":c.md=n.md.sha1.create();break;case"md5WithRSAEncryption":c.md=n.md.md5.create();break;case"sha256WithRSAEncryption":case"RSASSA-PSS":c.md=n.md.sha256.create();break;case"sha384WithRSAEncryption":c.md=n.md.sha384.create();break;case"sha512WithRSAEncryption":c.md=n.md.sha512.create()}if(null===c.md)throw(h=new Error("Could not compute certificate digest. Unknown signature OID.")).signatureOid=c.signatureOid,h;var y=i.toDer(c.tbsCertificate);c.md.update(y.getBytes())}var b=n.md.sha1.create();c.issuer.getField=function(e){return d(c.issuer,e)},c.issuer.addField=function(e){g([e]),c.issuer.attributes.push(e)},c.issuer.attributes=o.RDNAttributesAsArray(r.certIssuer,b),r.certIssuerUniqueId&&(c.issuer.uniqueId=r.certIssuerUniqueId),c.issuer.hash=b.digest().toHex();var m=n.md.sha1.create();return c.subject.getField=function(e){return d(c.subject,e)},c.subject.addField=function(e){g([e]),c.subject.attributes.push(e)},c.subject.attributes=o.RDNAttributesAsArray(r.certSubject,m),r.certSubjectUniqueId&&(c.subject.uniqueId=r.certSubjectUniqueId),c.subject.hash=m.digest().toHex(),r.certExtensions?c.extensions=o.certificateExtensionsFromAsn1(r.certExtensions):c.extensions=[],c.publicKey=o.publicKeyFromAsn1(r.subjectPublicKeyInfo),c},o.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r1&&(r=c.value.charCodeAt(1),o=c.value.length>2?c.value.charCodeAt(2):0),t.digitalSignature=128==(128&r),t.nonRepudiation=64==(64&r),t.keyEncipherment=32==(32&r),t.dataEncipherment=16==(16&r),t.keyAgreement=8==(8&r),t.keyCertSign=4==(4&r),t.cRLSign=2==(2&r),t.encipherOnly=1==(1&r),t.decipherOnly=128==(128&o)}else if("basicConstraints"===t.name){(c=i.fromDer(t.value)).value.length>0&&c.value[0].type===i.Type.BOOLEAN?t.cA=0!==c.value[0].value.charCodeAt(0):t.cA=!1;var a=null;c.value.length>0&&c.value[0].type===i.Type.INTEGER?a=c.value[0].value:c.value.length>1&&(a=c.value[1].value),null!==a&&(t.pathLenConstraint=i.derToInteger(a))}else if("extKeyUsage"===t.name)for(var c=i.fromDer(t.value),u=0;u1&&(r=c.value.charCodeAt(1)),t.client=128==(128&r),t.server=64==(64&r),t.email=32==(32&r),t.objsign=16==(16&r),t.reserved=8==(8&r),t.sslCA=4==(4&r),t.emailCA=2==(2&r),t.objCA=1==(1&r);else if("subjectAltName"===t.name||"issuerAltName"===t.name){var l;t.altNames=[],c=i.fromDer(t.value);for(var h=0;h=w&&e0&&s.value.push(o.certificateExtensionsToAsn1(e.extensions)),s},o.getCertificationRequestInfo=function(e){return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes()),y(e.subject),o.publicKeyToAsn1(e.publicKey),v(e)])},o.distinguishedNameToAsn1=function(e){return y(e)},o.certificateToAsn1=function(e){var t=e.tbsCertificate||o.getTBSCertificate(e);return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[t,i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.signatureOid).getBytes()),m(e.signatureOid,e.signatureParameters)]),i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},o.certificateExtensionsToAsn1=function(e){var t=i.create(i.Class.CONTEXT_SPECIFIC,3,!0,[]),r=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;nf.validity.notAfter)&&(c={message:"Certificate is not valid yet or has expired.",error:o.certificateError.certificate_expired,notBefore:f.validity.notBefore,notAfter:f.validity.notAfter,now:s}),null===c){if(null===(l=t[0]||e.getIssuer(f))&&f.isIssuer(f)&&(h=!0,l=f),l){var d=l;n.util.isArray(d)||(d=[d]);for(var p=!1;!p&&d.length>0;){l=d.shift();try{p=l.verify(f)}catch(e){}}p||(c={message:"Certificate signature is invalid.",error:o.certificateError.bad_certificate})}null!==c||l&&!h||e.hasCertificate(f)||(c={message:"Certificate is not trusted.",error:o.certificateError.unknown_ca})}if(null===c&&l&&!f.isIssuer(l)&&(c={message:"Certificate issuer is invalid.",error:o.certificateError.bad_certificate}),null===c)for(var y={keyUsage:!0,basicConstraints:!0},g=0;null===c&&gm.pathLenConstraint&&(c={message:"Certificate basicConstraints pathLenConstraint violated.",error:o.certificateError.bad_certificate})}var w=null===c||c.error,E=r.verify?r.verify(w,u,i):w;if(!0!==E)throw!0===w&&(c={message:"The application rejected the certificate.",error:o.certificateError.bad_certificate}),(E||0===E)&&("object"!=typeof E||n.util.isArray(E)?"string"==typeof E&&(c.error=E):(E.message&&(c.message=E.message),E.error&&(c.error=E.error))),c;c=null,a=!1,++u}while(t.length>0);return!0}},35049:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Observable:()=>E,Subject:()=>P,filter:()=>S,flatMap:()=>A,interval:()=>T,map:()=>I,merge:()=>C,multicast:()=>R,scan:()=>k,unsubscribe:()=>_});class n{constructor(e){this._baseObserver=e,this._pendingPromises=new Set}complete(){Promise.all(this._pendingPromises).then((()=>this._baseObserver.complete())).catch((e=>this._baseObserver.error(e)))}error(e){this._baseObserver.error(e)}schedule(e){const t=Promise.all(this._pendingPromises),r=[],n=e=>r.push(e),i=Promise.resolve().then((()=>{return o=this,s=void 0,c=function*(){yield t,yield e(n),this._pendingPromises.delete(i);for(const e of r)this._baseObserver.next(e)},new((a=void 0)||(a=Promise))((function(e,t){function r(e){try{i(c.next(e))}catch(e){t(e)}}function n(e){try{i(c.throw(e))}catch(e){t(e)}}function i(t){var i;t.done?e(t.value):(i=t.value,i instanceof a?i:new a((function(e){e(i)}))).then(r,n)}i((c=c.apply(o,s||[])).next())}));var o,s,a,c})).catch((e=>{this._pendingPromises.delete(i),this._baseObserver.error(e)}));this._pendingPromises.add(i)}}const i=()=>"function"==typeof Symbol,o=e=>i()&&Boolean(Symbol[e]),s=e=>o(e)?Symbol[e]:"@@"+e;o("asyncIterator")||(Symbol.asyncIterator=Symbol.asyncIterator||Symbol.for("Symbol.asyncIterator"));const a=s("iterator"),c=s("observable"),u=s("species");function f(e,t){const r=e[t];if(null!=r){if("function"!=typeof r)throw new TypeError(r+" is not a function");return r}}function l(e){let t=e.constructor;return void 0!==t&&(t=t[u],null===t&&(t=void 0)),void 0!==t?t:w}function h(e){h.log?h.log(e):setTimeout((()=>{throw e}),0)}function d(e){Promise.resolve().then((()=>{try{e()}catch(e){h(e)}}))}function p(e){const t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{const e=f(t,"unsubscribe");e&&e.call(t)}}catch(e){h(e)}}function y(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function g(e,t,r){e._state="running";const n=e._observer;try{const i=n?f(n,t):void 0;switch(t){case"next":i&&i.call(n,r);break;case"error":if(y(e),!i)throw r;i.call(n,r);break;case"complete":y(e),i&&i.call(n)}}catch(e){h(e)}"closed"===e._state?p(e):"running"===e._state&&(e._state="ready")}function b(e,t,r){if("closed"!==e._state)return"buffering"===e._state?(e._queue=e._queue||[],void e._queue.push({type:t,value:r})):"ready"!==e._state?(e._state="buffering",e._queue=[{type:t,value:r}],void d((()=>function(e){const t=e._queue;if(t){e._queue=void 0,e._state="ready";for(const r of t)if(g(e,r.type,r.value),"closed"===e._state)break}}(e)))):void g(e,t,r)}class m{constructor(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";const r=new v(this);try{this._cleanup=t.call(void 0,r)}catch(e){r.error(e)}"initializing"===this._state&&(this._state="ready")}get closed(){return"closed"===this._state}unsubscribe(){"closed"!==this._state&&(y(this),p(this))}}class v{constructor(e){this._subscription=e}get closed(){return"closed"===this._subscription._state}next(e){b(this._subscription,"next",e)}error(e){b(this._subscription,"error",e)}complete(){b(this._subscription,"complete")}}class w{constructor(e){if(!(this instanceof w))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof e)throw new TypeError("Observable initializer must be a function");this._subscriber=e}subscribe(e,t,r){return"object"==typeof e&&null!==e||(e={next:e,error:t,complete:r}),new m(e,this._subscriber)}pipe(e,...t){let r=this;for(const n of[e,...t])r=n(r);return r}tap(e,t,r){const n="object"!=typeof e||null===e?{next:e,error:t,complete:r}:e;return new w((e=>this.subscribe({next(t){n.next&&n.next(t),e.next(t)},error(t){n.error&&n.error(t),e.error(t)},complete(){n.complete&&n.complete(),e.complete()},start(e){n.start&&n.start(e)}})))}forEach(e){return new Promise(((t,r)=>{if("function"!=typeof e)return void r(new TypeError(e+" is not a function"));function n(){i.unsubscribe(),t(void 0)}const i=this.subscribe({next(t){try{e(t,n)}catch(e){r(e),i.unsubscribe()}},error(e){r(e)},complete(){t(void 0)}})}))}map(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(l(this))((t=>this.subscribe({next(r){let n=r;try{n=e(r)}catch(e){return t.error(e)}t.next(n)},error(e){t.error(e)},complete(){t.complete()}})))}filter(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(l(this))((t=>this.subscribe({next(r){try{if(!e(r))return}catch(e){return t.error(e)}t.next(r)},error(e){t.error(e)},complete(){t.complete()}})))}reduce(e,t){if("function"!=typeof e)throw new TypeError(e+" is not a function");const r=l(this),n=arguments.length>1;let i=!1,o=t;return new r((t=>this.subscribe({next(r){const s=!i;if(i=!0,!s||n)try{o=e(o,r)}catch(e){return t.error(e)}else o=r},error(e){t.error(e)},complete(){if(!i&&!n)return t.error(new TypeError("Cannot reduce an empty sequence"));t.next(o),t.complete()}})))}concat(...e){const t=l(this);return new t((r=>{let n,i=0;return function o(s){n=s.subscribe({next(e){r.next(e)},error(e){r.error(e)},complete(){i===e.length?(n=void 0,r.complete()):o(t.from(e[i++]))}})}(this),()=>{n&&(n.unsubscribe(),n=void 0)}}))}flatMap(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");const t=l(this);return new t((r=>{const n=[],i=this.subscribe({next(i){let s;if(e)try{s=e(i)}catch(e){return r.error(e)}else s=i;const a=t.from(s).subscribe({next(e){r.next(e)},error(e){r.error(e)},complete(){const e=n.indexOf(a);e>=0&&n.splice(e,1),o()}});n.push(a)},error(e){r.error(e)},complete(){o()}});function o(){i.closed&&0===n.length&&r.complete()}return()=>{n.forEach((e=>e.unsubscribe())),i.unsubscribe()}}))}[(Symbol.observable,c)](){return this}static from(e){const t="function"==typeof this?this:w;if(null==e)throw new TypeError(e+" is not an object");const r=f(e,c);if(r){const n=r.call(e);if(Object(n)!==n)throw new TypeError(n+" is not an object");return function(e){return e instanceof w}(n)&&n.constructor===t?n:new t((e=>n.subscribe(e)))}if(o("iterator")){const r=f(e,a);if(r)return new t((t=>{d((()=>{if(!t.closed){for(const n of r.call(e))if(t.next(n),t.closed)return;t.complete()}}))}))}if(Array.isArray(e))return new t((t=>{d((()=>{if(!t.closed){for(const r of e)if(t.next(r),t.closed)return;t.complete()}}))}));throw new TypeError(e+" is not observable")}static of(...e){return new("function"==typeof this?this:w)((t=>{d((()=>{if(!t.closed){for(const r of e)if(t.next(r),t.closed)return;t.complete()}}))}))}static get[u](){return this}}i()&&Object.defineProperty(w,Symbol("extensions"),{value:{symbol:c,hostReportError:h},configurable:!0});const E=w,_=function(e){"function"==typeof e?e():e&&"function"==typeof e.unsubscribe&&e.unsubscribe()};const S=function(e){return t=>new E((r=>{const i=new n(r),o=t.subscribe({complete(){i.complete()},error(e){i.error(e)},next(t){i.schedule((r=>{return n=this,i=void 0,s=function*(){(yield e(t))&&r(t)},new((o=void 0)||(o=Promise))((function(e,t){function r(e){try{c(s.next(e))}catch(e){t(e)}}function a(e){try{c(s.throw(e))}catch(e){t(e)}}function c(t){var n;t.done?e(t.value):(n=t.value,n instanceof o?n:new o((function(e){e(n)}))).then(r,a)}c((s=s.apply(n,i||[])).next())}));var n,i,o,s}))}});return()=>_(o)}))};const A=function(e){return t=>new E((r=>{const i=new n(r),s=t.subscribe({complete(){i.complete()},error(e){i.error(e)},next(t){i.schedule((r=>{return n=this,i=void 0,a=function*(){var n,i;const s=yield e(t);if((u=s)&&o("iterator")&&u[Symbol.iterator]||function(e){return e&&o("asyncIterator")&&e[Symbol.asyncIterator]}(s))try{for(var a,c=function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise((function(n,i){!function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)}(n,i,(t=e[r](t)).done,t.value)}))}}}(s);!(a=yield c.next()).done;){const e=a.value;r(e)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(i=c.return)&&(yield i.call(c))}finally{if(n)throw n.error}}else s.map((e=>r(e)));var u},new((s=void 0)||(s=Promise))((function(e,t){function r(e){try{c(a.next(e))}catch(e){t(e)}}function o(e){try{c(a.throw(e))}catch(e){t(e)}}function c(t){var n;t.done?e(t.value):(n=t.value,n instanceof s?n:new s((function(e){e(n)}))).then(r,o)}c((a=a.apply(n,i||[])).next())}));var n,i,s,a}))}});return()=>_(s)}))};function T(e){return new w((t=>{let r=0;const n=setInterval((()=>{t.next(r++)}),e);return()=>clearInterval(n)}))}const I=function(e){return t=>new E((r=>{const i=new n(r),o=t.subscribe({complete(){i.complete()},error(e){i.error(e)},next(t){i.schedule((r=>{return n=this,i=void 0,s=function*(){const n=yield e(t);r(n)},new((o=void 0)||(o=Promise))((function(e,t){function r(e){try{c(s.next(e))}catch(e){t(e)}}function a(e){try{c(s.throw(e))}catch(e){t(e)}}function c(t){var n;t.done?e(t.value):(n=t.value,n instanceof o?n:new o((function(e){e(n)}))).then(r,a)}c((s=s.apply(n,i||[])).next())}));var n,i,o,s}))}});return()=>_(o)}))},C=function(...e){return 0===e.length?w.from([]):new w((t=>{let r=0;const n=e.map((n=>n.subscribe({error(e){t.error(e),i()},next(e){t.next(e)},complete(){++r===e.length&&(t.complete(),i())}}))),i=()=>{n.forEach((e=>_(e)))};return i}))},P=class extends E{constructor(){super((e=>(this._observers.add(e),()=>this._observers.delete(e)))),this._observers=new Set}next(e){for(const t of this._observers)t.next(e)}error(e){for(const t of this._observers)t.error(e)}complete(){for(const e of this._observers)e.complete()}},R=function(e){const t=new P;let r,n=0;return new E((i=>{r||(r=e.subscribe(t));const o=t.subscribe(i);return n++,()=>{n--,o.unsubscribe(),0===n&&(_(r),r=void 0)}}))};const k=function(e,t){return r=>new E((i=>{let o,s=0;const a=new n(i),c=r.subscribe({complete(){a.complete()},error(e){a.error(e)},next(r){a.schedule((n=>{return i=this,a=void 0,u=function*(){const i=0===s?void 0===t?r:t:o;o=yield e(i,r,s++),n(o)},new((c=void 0)||(c=Promise))((function(e,t){function r(e){try{o(u.next(e))}catch(e){t(e)}}function n(e){try{o(u.throw(e))}catch(e){t(e)}}function o(t){var i;t.done?e(t.value):(i=t.value,i instanceof c?i:new c((function(e){e(i)}))).then(r,n)}o((u=u.apply(i,a||[])).next())}));var i,a,c,u}))}});return()=>_(c)}))}},61750:(e,t,r)=>{"use strict";const n=r(97759),i=r(80341);e.exports=(e,t)=>{const r=n(e,{...t,count:1});return i.fn((async e=>{e((()=>{r.cancel()}));const[t]=await r;return t}))()},e.exports.AggregateError=n.AggregateError},80341:e=>{"use strict";class t extends Error{constructor(e){super(e||"Promise was canceled"),this.name="CancelError"}get isCanceled(){return!0}}class r{static fn(e){return(...t)=>new r(((r,n,i)=>{t.push(i),e(...t).then(r,n)}))}constructor(e){this._cancelHandlers=[],this._isPending=!0,this._isCanceled=!1,this._rejectOnCancel=!0,this._promise=new Promise(((t,r)=>{this._reject=r;const n=e=>{if(!this._isPending)throw new Error("The `onCancel` handler was attached after the promise settled.");this._cancelHandlers.push(e)};return Object.defineProperties(n,{shouldReject:{get:()=>this._rejectOnCancel,set:e=>{this._rejectOnCancel=e}}}),e((e=>{this._isCanceled&&n.shouldReject||(this._isPending=!1,t(e))}),(e=>{this._isPending=!1,r(e)}),n)}))}then(e,t){return this._promise.then(e,t)}catch(e){return this._promise.catch(e)}finally(e){return this._promise.finally(e)}cancel(e){if(this._isPending&&!this._isCanceled){if(this._isCanceled=!0,this._cancelHandlers.length>0)try{for(const e of this._cancelHandlers)e()}catch(e){return void this._reject(e)}this._rejectOnCancel&&this._reject(new t(e))}}get isCanceled(){return this._isCanceled}}Object.setPrototypeOf(r.prototype,Promise.prototype),e.exports=r,e.exports.CancelError=t},63931:e=>{"use strict";e.exports=()=>{const e={};return e.promise=new Promise(((t,r)=>{e.resolve=t,e.reject=r})),e}},35103:(e,t,r)=>{const n=r(91607),i=r(63931);e.exports=class{constructor(){this._buffer=new n,this._waitingConsumers=new n}push(e){const{promise:t,resolve:r}=i();return this._buffer.push({chunk:e,resolve:r}),this._consume(),t}_consume(){for(;!this._waitingConsumers.isEmpty()&&!this._buffer.isEmpty();){const e=this._waitingConsumers.shift(),t=this._buffer.shift();e.resolve(t.chunk),t.resolve()}}shift(){const{promise:e,resolve:t}=i();return this._waitingConsumers.push({resolve:t}),this._consume(),e}isEmpty(){return this._buffer.isEmpty()}}},80406:(e,t,r)=>{"use strict";const n=r(89161),i=e=>{if(!Number.isInteger(e)&&e!==1/0||!(e>0))return Promise.reject(new TypeError("Expected `concurrency` to be a number from 1 and up"));const t=[];let r=0;const i=()=>{r--,t.length>0&&t.shift()()},o=(e,t,...o)=>{r++;const s=n(e,...o);t(s),s.then(i,i)},s=(n,...i)=>new Promise((s=>((n,i,...s)=>{rr},pendingCount:{get:()=>t.length},clearQueue:{value:()=>{t.length=0}}}),s};e.exports=i,e.exports.default=i},47924:e=>{"use strict";const t=async e=>{try{return{isFulfilled:!0,isRejected:!1,value:await e}}catch(e){return{isFulfilled:!1,isRejected:!0,reason:e}}};e.exports=t,e.exports.default=t},42693:(e,t,r)=>{"use strict";const n=r(99353),i=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"];class o extends Error{constructor(e){super(),e instanceof Error?(this.originalError=e,({message:e}=e)):(this.originalError=new Error(e),this.originalError.stack=this.stack),this.name="AbortError",this.message=e}}const s=(e,t)=>new Promise(((r,s)=>{t={onFailedAttempt:()=>{},retries:10,...t};const a=n.operation(t);a.attempt((async n=>{try{r(await e(n))}catch(e){if(!(e instanceof Error))return void s(new TypeError(`Non-error was thrown: "${e}". You should only throw errors.`));if(e instanceof o)a.stop(),s(e.originalError);else if(e instanceof TypeError&&(c=e.message,!i.includes(c)))a.stop(),s(e);else{((e,t,r)=>{const n=r.retries-(t-1);e.attemptNumber=t,e.retriesLeft=n})(e,n,t);try{await t.onFailedAttempt(e)}catch(e){return void s(e)}a.retry(e)||s(a.mainError())}}var c}))}));e.exports=s,e.exports.default=s,e.exports.AbortError=o},13296:(e,t,r)=>{"use strict";const n=r(47924),i=r(80406);e.exports=async(e,t={})=>{const{concurrency:r=1/0}=t,o=i(r);return Promise.all(e.map((e=>e&&"function"==typeof e.then?n(e):n("function"==typeof e?o((()=>e())):Promise.resolve(e)))))}},97759:(e,t,r)=>{"use strict";const n=r(56455),i=r(80341);class o extends Error{}e.exports=(e,t)=>new i(((r,i,s)=>{const{count:a,filter:c=(()=>!0)}=t;if(!Number.isFinite(a))return void i(new TypeError("Expected a finite number, got "+typeof t.count));const u=[],f=[];let l=0,h=!1;const d=new Set,p=()=>{for(const t of e)d.has(t)||"function"!=typeof t.cancel||t.cancel()};s(p);for(const t of e)l++,(async()=>{try{const e=await t;if(h)return;if(!c(e))throw new o("Value does not satisfy filter");u.push(e)}catch(e){f.push(e)}finally{d.add(t),!h&&(u.length===a&&(r(u),h=!0),l-f.lengthl&&(i(new RangeError(`Expected input to contain at least ${t.count} items, but contains ${l} items`)),p())})),e.exports.AggregateError=n,e.exports.FilterError=o},58147:e=>{"use strict";class t extends Error{constructor(e){super(e),this.name="TimeoutError"}}const r=(e,r,n,i)=>{let o;const s=new Promise(((s,a)=>{if("number"!=typeof r||r<0)throw new TypeError("Expected `milliseconds` to be a positive number");r!==1/0?(i={customTimers:{setTimeout,clearTimeout},...i},o=i.customTimers.setTimeout.call(void 0,(()=>{if("function"==typeof n){try{s(n())}catch(e){a(e)}return}const i=n instanceof Error?n:new t("string"==typeof n?n:`Promise timed out after ${r} milliseconds`);"function"==typeof e.cancel&&e.cancel(),a(i)}),r),(async()=>{try{s(await e)}catch(e){a(e)}finally{i.customTimers.clearTimeout.call(void 0,o)}})()):s(e)}));return s.clear=()=>{clearTimeout(o),o=void 0},s};e.exports=r,e.exports.default=r,e.exports.TimeoutError=t},89161:e=>{"use strict";const t=(e,...t)=>new Promise((r=>{r(e(...t))}));e.exports=t,e.exports.default=t},88785:(e,t,r)=>{"use strict";const{CID:n}=r(81362),i=r(22817),o=r(98441),s=r(99086),a=r(9885),{base58btc:c}=r(99086),{base32:u}=r(22817),{base16:f}=r(84835),l=r(28924),h=r(14437),d=r(98514),{PeerIdProto:p}=r(28780),{equals:y}=r(19588),{fromString:g}=r(52217),{toString:b}=r(92263),{identity:m}=r(78103),v={...i,...o,...s,...a},w=Object.keys(v).reduce(((e,t)=>e.or(v[t])),u.decoder),E=d(class{constructor(e,t,r){if(!(e instanceof Uint8Array))throw new Error("invalid id provided");if(t&&r&&!y(t.public.bytes,r.bytes))throw new Error("inconsistent arguments");this._id=e,this._idB58String=c.encode(this.id).substring(1),this._privKey=t,this._pubKey=r}get id(){return this._id}set id(e){throw new Error("Id is immutable")}get privKey(){return this._privKey}set privKey(e){this._privKey=e}get pubKey(){if(this._pubKey)return this._pubKey;if(this._privKey)return this._privKey.public;try{const e=l.decode(this.id);e.code===m.code&&(this._pubKey=h.unmarshalPublicKey(e.digest))}catch(e){}return this._pubKey}set pubKey(e){this._pubKey=e}marshalPubKey(){if(this.pubKey)return h.marshalPublicKey(this.pubKey)}marshalPrivKey(){if(this.privKey)return h.marshalPrivateKey(this.privKey)}marshal(e){return p.encode({id:this.toBytes(),pubKey:this.marshalPubKey(),privKey:e?null:this.marshalPrivKey()}).finish()}toPrint(){let e=this.toB58String();e.startsWith("Qm")&&(e=e.slice(2));let t=6;return e.length"}toJSON(){return{id:this.toB58String(),privKey:T(this.marshalPrivKey()),pubKey:T(this.marshalPubKey())}}toHexString(){return f.encode(this.id).substring(1)}toBytes(){return this.id}toB58String(){return this._idB58String}toString(){if(!this._idCIDString){const e=n.createV1(114,l.decode(this.id));Object.defineProperty(this,"_idCIDString",{value:e.toString(),enumerable:!1})}return this._idCIDString}equals(e){if(e instanceof Uint8Array)return y(this.id,e);if(e.id)return y(this.id,e.id);throw new Error("not valid Id")}isEqual(e){return this.equals(e)}isValid(){return Boolean(this.privKey&&this.privKey.public&&this.privKey.public.bytes&&this.pubKey.bytes instanceof Uint8Array&&y(this.privKey.public.bytes,this.pubKey.bytes))}hasInlinePublicKey(){try{if(l.decode(this.id).code===m.code)return!0}catch(e){}return!1}},{className:"PeerId",symbolName:"@libp2p/js-peer-id/PeerId"});t=e.exports=E;const _=e=>e.bytes.length<=42?l.create(m.code,e.bytes).bytes:e.hash(),S=async(e,t)=>{const r=await _(t);return new E(r,e,t)};t.create=async e=>{(e=e||{}).bits=e.bits||2048,e.keyType=e.keyType||"RSA";const t=await h.generateKeyPair(e.keyType,e.bits);return S(t,t.public)},t.createFromHexString=e=>new E(f.decode("f"+e)),t.createFromBytes=e=>{try{const r=n.decode(e);if(!A(r))throw new Error("Supplied PeerID CID is invalid");return t.createFromCID(r)}catch{if(l.decode(e).code!==m.code)throw new Error("Supplied PeerID CID is invalid");return new E(e)}},t.createFromB58String=e=>t.createFromBytes(c.decode("z"+e));const A=e=>114===e.code||112===e.code;function T(e){if(e)return b(e,"base64pad")}t.createFromCID=e=>{if(!(e=n.asCID(e))||!A(e))throw new Error("Supplied PeerID CID is invalid");return new E(e.multihash.bytes)},t.createFromPubKey=async e=>{let t=e;if("string"==typeof t&&(t=g(e,"base64pad")),!(t instanceof Uint8Array))throw new Error("Supplied key is neither a base64 string nor a Uint8Array");const r=await h.unmarshalPublicKey(t);return S(void 0,r)},t.createFromPrivKey=async e=>{if("string"==typeof e&&(e=g(e,"base64pad")),!(e instanceof Uint8Array))throw new Error("Supplied key is neither a base64 string nor a Uint8Array");const t=await h.unmarshalPrivateKey(e);return S(t,t.public)},t.createFromJSON=async e=>{const t=c.decode("z"+e.id),r=e.privKey&&g(e.privKey,"base64pad"),n=e.pubKey&&g(e.pubKey,"base64pad"),i=n&&await h.unmarshalPublicKey(n);if(!r)return new E(t,void 0,i);const o=await h.unmarshalPrivateKey(r),s=await _(o.public);let a;if(i&&(a=await _(i)),i&&!y(s,a))throw new Error("Public and private key do not match");if(t&&!y(s,t))throw new Error("Id and private key do not match");return new E(t,o,i)},t.createFromProtobuf=async e=>{"string"==typeof e&&(e=g(e,"base16"));let t,r,{id:n,privKey:i,pubKey:o}=p.decode(e);if(i=!!i&&await h.unmarshalPrivateKey(i),o=!!o&&await h.unmarshalPublicKey(o),i&&(r=await _(i.public)),o&&(t=await _(o)),i){if(o&&!y(r,t))throw new Error("Public and private key do not match");return new E(r,i,i.public)}if(o)return new E(t,void 0,o);if(n)return new E(n);throw new Error("Protobuf did not contain any usable key material")},t.parse=e=>("1"!==e.charAt(0)&&"Q"!==e.charAt(0)||(e=`z${e}`),t.createFromBytes(w.decode(e))),t.isPeerId=e=>Boolean("object"==typeof e&&e._id&&e._idB58String)},28780:(e,t,r)=>{"use strict";var n=r(62100),i=n.Reader,o=n.Writer,s=n.util,a=n.roots["libp2p-peer-id"]||(n.roots["libp2p-peer-id"]={});a.PeerIdProto=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r>>3){case 1:n.id=e.bytes();break;case 2:n.pubKey=e.bytes();break;case 3:n.privKey=e.bytes();break;default:e.skipType(7&o)}}if(!n.hasOwnProperty("id"))throw s.ProtocolError("missing required 'id'",{instance:n});return n},e.fromObject=function(e){if(e instanceof a.PeerIdProto)return e;var t=new a.PeerIdProto;return null!=e.id&&("string"==typeof e.id?s.base64.decode(e.id,t.id=s.newBuffer(s.base64.length(e.id)),0):e.id.length&&(t.id=e.id)),null!=e.pubKey&&("string"==typeof e.pubKey?s.base64.decode(e.pubKey,t.pubKey=s.newBuffer(s.base64.length(e.pubKey)),0):e.pubKey.length&&(t.pubKey=e.pubKey)),null!=e.privKey&&("string"==typeof e.privKey?s.base64.decode(e.privKey,t.privKey=s.newBuffer(s.base64.length(e.privKey)),0):e.privKey.length&&(t.privKey=e.privKey)),t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(t.bytes===String?r.id="":(r.id=[],t.bytes!==Array&&(r.id=s.newBuffer(r.id))),t.bytes===String?r.pubKey="":(r.pubKey=[],t.bytes!==Array&&(r.pubKey=s.newBuffer(r.pubKey))),t.bytes===String?r.privKey="":(r.privKey=[],t.bytes!==Array&&(r.privKey=s.newBuffer(r.privKey)))),null!=e.id&&e.hasOwnProperty("id")&&(r.id=t.bytes===String?s.base64.encode(e.id,0,e.id.length):t.bytes===Array?Array.prototype.slice.call(e.id):e.id),null!=e.pubKey&&e.hasOwnProperty("pubKey")&&(r.pubKey=t.bytes===String?s.base64.encode(e.pubKey,0,e.pubKey.length):t.bytes===Array?Array.prototype.slice.call(e.pubKey):e.pubKey),null!=e.privKey&&e.hasOwnProperty("privKey")&&(r.privKey=t.bytes===String?s.base64.encode(e.privKey,0,e.privKey.length):t.bytes===Array?Array.prototype.slice.call(e.privKey):e.privKey),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,n.util.toJSONOptions)},e}(),e.exports=a},290:(e,t,r)=>{"use strict";e.exports=r(96114).default},96114:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=r(28951),o=n(r(1476)),s=n(r(5003)),a=r(56512),c=["0.0.0.0/8","10.0.0.0/8","100.64.0.0/10","127.0.0.0/8","169.254.0.0/16","172.16.0.0/12","192.0.0.0/24","192.0.0.0/29","192.0.0.8/32","192.0.0.9/32","192.0.0.10/32","192.0.0.170/32","192.0.0.171/32","192.0.2.0/24","192.31.196.0/24","192.52.193.0/24","192.88.99.0/24","192.168.0.0/16","192.175.48.0/24","198.18.0.0/15","198.51.100.0/24","203.0.113.0/24","240.0.0.0/4","255.255.255.255/32"].map((e=>new i.Netmask(e)));function u(e){return/^::$/.test(e)||/^::1$/.test(e)||/^::f{4}:([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(e)||/^::f{4}:0.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(e)||/^64:ff9b::([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(e)||/^100::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(e)||/^2001::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(e)||/^2001:2[0-9a-fA-F]:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(e)||/^2001:db8:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(e)||/^2002:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(e)||/^f[c-d]([0-9a-fA-F]{2,2}):/i.test(e)||/^fe[8-9a-bA-B][0-9a-fA-F]:/i.test(e)||/^ff([0-9a-fA-F]{2,2}):/i.test(e)}t.default=e=>{if(a.isValid(e)){const t=a.parse(e);if("ipv4"===t.kind())return function(e){for(let t of c)if(t.contains(e))return!0;return!1}(t.toNormalizedString());if("ipv6"===t.kind())return u(e)}else if(s.default(e)&&o.default.v6().test(e))return u(e)}},34155:e=>{var t,r,n=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var a,c=[],u=!1,f=-1;function l(){u&&a&&(u=!1,a.length?c=a.concat(c):f=-1,c.length&&h())}function h(){if(!u){var e=s(l);u=!0;for(var t=c.length;t;){for(a=c,c=[];++f1)for(var r=1;r{"use strict";e.exports=r(89482)},89482:(e,t,r)=>{"use strict";var n=t;function i(){n.util._configure(),n.Writer._configure(n.BufferWriter),n.Reader._configure(n.BufferReader)}n.build="minimal",n.Writer=r(41173),n.BufferWriter=r(43155),n.Reader=r(51408),n.BufferReader=r(50593),n.util=r(99693),n.rpc=r(35994),n.roots=r(85054),n.configure=i,i()},51408:(e,t,r)=>{"use strict";e.exports=c;var n,i=r(99693),o=i.LongBits,s=i.utf8;function a(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function c(e){this.buf=e,this.pos=0,this.len=e.length}var u,f="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new c(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new c(e);throw Error("illegal buffer")},l=function(){return i.Buffer?function(e){return(c.create=function(e){return i.Buffer.isBuffer(e)?new n(e):f(e)})(e)}:f};function h(){var e=new o(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function d(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function p(){if(this.pos+8>this.len)throw a(this,8);return new o(d(this.buf,this.pos+=4),d(this.buf,this.pos+=4))}c.create=l(),c.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,c.prototype.uint32=(u=4294967295,function(){if(u=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return u;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return u}),c.prototype.int32=function(){return 0|this.uint32()},c.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},c.prototype.bool=function(){return 0!==this.uint32()},c.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return d(this.buf,this.pos+=4)},c.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return 0|d(this.buf,this.pos+=4)},c.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var e=i.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},c.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var e=i.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},c.prototype.bytes=function(){var e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?new this.buf.constructor(0):this._slice.call(this.buf,t,r)},c.prototype.string=function(){var e=this.bytes();return s.read(e,0,e.length)},c.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},c.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},c._configure=function(e){n=e,c.create=l(),n._configure();var t=i.Long?"toLong":"toNumber";i.merge(c.prototype,{int64:function(){return h.call(this)[t](!1)},uint64:function(){return h.call(this)[t](!0)},sint64:function(){return h.call(this).zzDecode()[t](!1)},fixed64:function(){return p.call(this)[t](!0)},sfixed64:function(){return p.call(this)[t](!1)}})}},50593:(e,t,r)=>{"use strict";e.exports=o;var n=r(51408);(o.prototype=Object.create(n.prototype)).constructor=o;var i=r(99693);function o(e){n.call(this,e)}o._configure=function(){i.Buffer&&(o.prototype._slice=i.Buffer.prototype.slice)},o.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},o._configure()},85054:e=>{"use strict";e.exports={}},35994:(e,t,r)=>{"use strict";t.Service=r(77948)},77948:(e,t,r)=>{"use strict";e.exports=i;var n=r(99693);function i(e,t,r){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");n.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(r)}(i.prototype=Object.create(n.EventEmitter.prototype)).constructor=i,i.prototype.rpcCall=function e(t,r,i,o,s){if(!o)throw TypeError("request must be specified");var a=this;if(!s)return n.asPromise(e,a,t,r,i,o);if(a.rpcImpl)try{return a.rpcImpl(t,r[a.requestDelimited?"encodeDelimited":"encode"](o).finish(),(function(e,r){if(e)return a.emit("error",e,t),s(e);if(null!==r){if(!(r instanceof i))try{r=i[a.responseDelimited?"decodeDelimited":"decode"](r)}catch(e){return a.emit("error",e,t),s(e)}return a.emit("data",r,t),s(null,r)}a.end(!0)}))}catch(e){return a.emit("error",e,t),void setTimeout((function(){s(e)}),0)}else setTimeout((function(){s(Error("already ended"))}),0)},i.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},1945:(e,t,r)=>{"use strict";e.exports=i;var n=r(99693);function i(e,t){this.lo=e>>>0,this.hi=t>>>0}var o=i.zero=new i(0,0);o.toNumber=function(){return 0},o.zzEncode=o.zzDecode=function(){return this},o.length=function(){return 1};var s=i.zeroHash="\0\0\0\0\0\0\0\0";i.fromNumber=function(e){if(0===e)return o;var t=e<0;t&&(e=-e);var r=e>>>0,n=(e-r)/4294967296>>>0;return t&&(n=~n>>>0,r=~r>>>0,++r>4294967295&&(r=0,++n>4294967295&&(n=0))),new i(r,n)},i.from=function(e){if("number"==typeof e)return i.fromNumber(e);if(n.isString(e)){if(!n.Long)return i.fromNumber(parseInt(e,10));e=n.Long.fromString(e)}return e.low||e.high?new i(e.low>>>0,e.high>>>0):o},i.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(e){return n.Long?new n.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var a=String.prototype.charCodeAt;i.fromHash=function(e){return e===s?o:new i((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},i.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},i.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},i.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},i.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}},99693:function(e,t,r){"use strict";var n=t;function i(e,t,r){for(var n=Object.keys(t),i=0;i0)},n.Buffer=function(){try{var e=n.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),n._Buffer_from=null,n._Buffer_allocUnsafe=null,n.newBuffer=function(e){return"number"==typeof e?n.Buffer?n._Buffer_allocUnsafe(e):new n.Array(e):n.Buffer?n._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},n.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,n.Long=n.global.dcodeIO&&n.global.dcodeIO.Long||n.global.Long||n.inquire("long"),n.key2Re=/^true|false|0|1$/,n.key32Re=/^-?(?:0|[1-9][0-9]*)$/,n.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,n.longToHash=function(e){return e?n.LongBits.from(e).toHash():n.LongBits.zeroHash},n.longFromHash=function(e,t){var r=n.LongBits.fromHash(e);return n.Long?n.Long.fromBits(r.lo,r.hi,t):r.toNumber(Boolean(t))},n.merge=i,n.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},n.newError=o,n.ProtocolError=o("ProtocolError"),n.oneOfGetter=function(e){for(var t={},r=0;r-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}},n.oneOfSetter=function(e){return function(t){for(var r=0;r{"use strict";e.exports=l;var n,i=r(99693),o=i.LongBits,s=i.base64,a=i.utf8;function c(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function u(){}function f(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function l(){this.len=0,this.head=new c(u,0,0),this.tail=this.head,this.states=null}var h=function(){return i.Buffer?function(){return(l.create=function(){return new n})()}:function(){return new l}};function d(e,t,r){t[r]=255&e}function p(e,t){this.len=e,this.next=void 0,this.val=t}function y(e,t,r){for(;e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function g(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}l.create=h(),l.alloc=function(e){return new i.Array(e)},i.Array!==Array&&(l.alloc=i.pool(l.alloc,i.Array.prototype.subarray)),l.prototype._push=function(e,t,r){return this.tail=this.tail.next=new c(e,t,r),this.len+=t,this},p.prototype=Object.create(c.prototype),p.prototype.fn=function(e,t,r){for(;e>127;)t[r++]=127&e|128,e>>>=7;t[r]=e},l.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new p((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},l.prototype.int32=function(e){return e<0?this._push(y,10,o.fromNumber(e)):this.uint32(e)},l.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},l.prototype.uint64=function(e){var t=o.from(e);return this._push(y,t.length(),t)},l.prototype.int64=l.prototype.uint64,l.prototype.sint64=function(e){var t=o.from(e).zzEncode();return this._push(y,t.length(),t)},l.prototype.bool=function(e){return this._push(d,1,e?1:0)},l.prototype.fixed32=function(e){return this._push(g,4,e>>>0)},l.prototype.sfixed32=l.prototype.fixed32,l.prototype.fixed64=function(e){var t=o.from(e);return this._push(g,4,t.lo)._push(g,4,t.hi)},l.prototype.sfixed64=l.prototype.fixed64,l.prototype.float=function(e){return this._push(i.float.writeFloatLE,4,e)},l.prototype.double=function(e){return this._push(i.float.writeDoubleLE,8,e)};var b=i.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n>>0;if(!t)return this._push(d,1,0);if(i.isString(e)){var r=l.alloc(t=s.length(e));s.decode(e,r,0),e=r}return this.uint32(t)._push(b,t,e)},l.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(d,1,0)},l.prototype.fork=function(){return this.states=new f(this),this.head=this.tail=new c(u,0,0),this.len=0,this},l.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new c(u,0,0),this.len=0),this},l.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},l.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},l._configure=function(e){n=e,l.create=h(),n._configure()}},43155:(e,t,r)=>{"use strict";e.exports=o;var n=r(41173);(o.prototype=Object.create(n.prototype)).constructor=o;var i=r(99693);function o(){n.call(this)}function s(e,t,r){e.length<40?i.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}o._configure=function(){o.alloc=i._Buffer_allocUnsafe,o.writeBytesBuffer=i.Buffer&&i.Buffer.prototype instanceof Uint8Array&&"set"===i.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var n=0;n>>0;return this.uint32(t),t&&this._push(o.writeBytesBuffer,t,e),this},o.prototype.string=function(e){var t=i.Buffer.byteLength(e);return this.uint32(t),t&&this._push(s,t,e),this},o._configure()},92592:(e,t,r)=>{const n=r(47138),i=r(95115),o=r(6907),s=r(93776);function a(e,t,r,o,s){const a=[].slice.call(arguments,1),c=a.length,u="function"==typeof a[c-1];if(!u&&!n())throw new Error("Callback required as last argument");if(!u){if(c<1)throw new Error("Too few arguments provided");return 1===c?(r=t,t=o=void 0):2!==c||t.getContext||(o=r,r=t,t=void 0),new Promise((function(n,s){try{const s=i.create(r,o);n(e(s,t,o))}catch(e){s(e)}}))}if(c<2)throw new Error("Too few arguments provided");2===c?(s=r,r=t,t=o=void 0):3===c&&(t.getContext&&void 0===s?(s=o,o=void 0):(s=o,o=r,r=t,t=void 0));try{const n=i.create(r,o);s(null,e(n,t,o))}catch(e){s(e)}}t.create=i.create,t.toCanvas=a.bind(null,o.render),t.toDataURL=a.bind(null,o.renderToDataURL),t.toString=a.bind(null,(function(e,t,r){return s.render(e,r)}))},47138:e=>{e.exports=function(){return"function"==typeof Promise&&Promise.prototype&&Promise.prototype.then}},21845:(e,t,r)=>{const n=r(10242).getSymbolSize;t.getRowColCoords=function(e){if(1===e)return[];const t=Math.floor(e/7)+2,r=n(e),i=145===r?26:2*Math.ceil((r-13)/(2*t-2)),o=[r-7];for(let e=1;e{const n=r(76910),i=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function o(e){this.mode=n.ALPHANUMERIC,this.data=e}o.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},o.prototype.getLength=function(){return this.data.length},o.prototype.getBitsLength=function(){return o.getBitsLength(this.data.length)},o.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let r=45*i.indexOf(this.data[t]);r+=i.indexOf(this.data[t+1]),e.put(r,11)}this.data.length%2&&e.put(i.indexOf(this.data[t]),6)},e.exports=o},97245:e=>{function t(){this.buffer=[],this.length=0}t.prototype={get:function(e){const t=Math.floor(e/8);return 1==(this.buffer[t]>>>7-e%8&1)},put:function(e,t){for(let r=0;r>>t-r-1&1))},getLengthInBits:function(){return this.length},putBit:function(e){const t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},e.exports=t},73280:e=>{function t(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}t.prototype.set=function(e,t,r,n){const i=e*this.size+t;this.data[i]=r,n&&(this.reservedBit[i]=!0)},t.prototype.get=function(e,t){return this.data[e*this.size+t]},t.prototype.xor=function(e,t,r){this.data[e*this.size+t]^=r},t.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},e.exports=t},43424:(e,t,r)=>{const n=r(62378),i=r(76910);function o(e){this.mode=i.BYTE,this.data=new Uint8Array(n(e))}o.getBitsLength=function(e){return 8*e},o.prototype.getLength=function(){return this.data.length},o.prototype.getBitsLength=function(){return o.getBitsLength(this.data.length)},o.prototype.write=function(e){for(let t=0,r=this.data.length;t{const n=r(64908),i=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],o=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];t.getBlocksCount=function(e,t){switch(t){case n.L:return i[4*(e-1)+0];case n.M:return i[4*(e-1)+1];case n.Q:return i[4*(e-1)+2];case n.H:return i[4*(e-1)+3];default:return}},t.getTotalCodewordsCount=function(e,t){switch(t){case n.L:return o[4*(e-1)+0];case n.M:return o[4*(e-1)+1];case n.Q:return o[4*(e-1)+2];case n.H:return o[4*(e-1)+3];default:return}}},64908:(e,t)=>{t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2},t.isValid=function(e){return e&&void 0!==e.bit&&e.bit>=0&&e.bit<4},t.from=function(e,r){if(t.isValid(e))return e;try{return function(e){if("string"!=typeof e)throw new Error("Param is not a string");switch(e.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+e)}}(e)}catch(e){return r}}},76526:(e,t,r)=>{const n=r(10242).getSymbolSize;t.getPositions=function(e){const t=n(e);return[[0,0],[t-7,0],[0,t-7]]}},61642:(e,t,r)=>{const n=r(10242),i=n.getBCHDigit(1335);t.getEncodedBits=function(e,t){const r=e.bit<<3|t;let o=r<<10;for(;n.getBCHDigit(o)-i>=0;)o^=1335<{const r=new Uint8Array(512),n=new Uint8Array(256);!function(){let e=1;for(let t=0;t<255;t++)r[t]=e,n[e]=t,e<<=1,256&e&&(e^=285);for(let e=255;e<512;e++)r[e]=r[e-255]}(),t.log=function(e){if(e<1)throw new Error("log("+e+")");return n[e]},t.exp=function(e){return r[e]},t.mul=function(e,t){return 0===e||0===t?0:r[n[e]+n[t]]}},35442:(e,t,r)=>{const n=r(76910),i=r(10242);function o(e){this.mode=n.KANJI,this.data=e}o.getBitsLength=function(e){return 13*e},o.prototype.getLength=function(){return this.data.length},o.prototype.getBitsLength=function(){return o.getBitsLength(this.data.length)},o.prototype.write=function(e){let t;for(t=0;t=33088&&r<=40956)r-=33088;else{if(!(r>=57408&&r<=60351))throw new Error("Invalid SJIS character: "+this.data[t]+"\nMake sure your charset is UTF-8");r-=49472}r=192*(r>>>8&255)+(255&r),e.put(r,13)}},e.exports=o},27126:(e,t)=>{t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};function r(e,r,n){switch(e){case t.Patterns.PATTERN000:return(r+n)%2==0;case t.Patterns.PATTERN001:return r%2==0;case t.Patterns.PATTERN010:return n%3==0;case t.Patterns.PATTERN011:return(r+n)%3==0;case t.Patterns.PATTERN100:return(Math.floor(r/2)+Math.floor(n/3))%2==0;case t.Patterns.PATTERN101:return r*n%2+r*n%3==0;case t.Patterns.PATTERN110:return(r*n%2+r*n%3)%2==0;case t.Patterns.PATTERN111:return(r*n%3+(r+n)%2)%2==0;default:throw new Error("bad maskPattern:"+e)}}t.isValid=function(e){return null!=e&&""!==e&&!isNaN(e)&&e>=0&&e<=7},t.from=function(e){return t.isValid(e)?parseInt(e,10):void 0},t.getPenaltyN1=function(e){const t=e.size;let r=0,n=0,i=0,o=null,s=null;for(let a=0;a=5&&(r+=n-5+3),o=t,n=1),t=e.get(c,a),t===s?i++:(i>=5&&(r+=i-5+3),s=t,i=1)}n>=5&&(r+=n-5+3),i>=5&&(r+=i-5+3)}return r},t.getPenaltyN2=function(e){const t=e.size;let r=0;for(let n=0;n=10&&(1488===n||93===n)&&r++,i=i<<1&2047|e.get(s,o),s>=10&&(1488===i||93===i)&&r++}return 40*r},t.getPenaltyN4=function(e){let t=0;const r=e.data.length;for(let n=0;n{const n=r(43114),i=r(7007);t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(e,t){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!n.isValid(t))throw new Error("Invalid version: "+t);return t>=1&&t<10?e.ccBits[0]:t<27?e.ccBits[1]:e.ccBits[2]},t.getBestModeForData=function(e){return i.testNumeric(e)?t.NUMERIC:i.testAlphanumeric(e)?t.ALPHANUMERIC:i.testKanji(e)?t.KANJI:t.BYTE},t.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")},t.isValid=function(e){return e&&e.bit&&e.ccBits},t.from=function(e,r){if(t.isValid(e))return e;try{return function(e){if("string"!=typeof e)throw new Error("Param is not a string");switch(e.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+e)}}(e)}catch(e){return r}}},41085:(e,t,r)=>{const n=r(76910);function i(e){this.mode=n.NUMERIC,this.data=e.toString()}i.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t,r,n;for(t=0;t+3<=this.data.length;t+=3)r=this.data.substr(t,3),n=parseInt(r,10),e.put(n,10);const i=this.data.length-t;i>0&&(r=this.data.substr(t),n=parseInt(r,10),e.put(n,3*i+1))},e.exports=i},26143:(e,t,r)=>{const n=r(69729);t.mul=function(e,t){const r=new Uint8Array(e.length+t.length-1);for(let i=0;i=0;){const e=r[0];for(let i=0;i{const n=r(10242),i=r(64908),o=r(97245),s=r(73280),a=r(21845),c=r(76526),u=r(27126),f=r(35393),l=r(52882),h=r(23103),d=r(61642),p=r(76910),y=r(16130);function g(e,t,r){const n=e.size,i=d.getEncodedBits(t,r);let o,s;for(o=0;o<15;o++)s=1==(i>>o&1),o<6?e.set(o,8,s,!0):o<8?e.set(o+1,8,s,!0):e.set(n-15+o,8,s,!0),o<8?e.set(8,n-o-1,s,!0):o<9?e.set(8,15-o-1+1,s,!0):e.set(8,15-o-1,s,!0);e.set(n-8,8,1,!0)}function b(e,t,r,i){let d;if(Array.isArray(e))d=y.fromArray(e);else{if("string"!=typeof e)throw new Error("Invalid data");{let n=t;if(!n){const t=y.rawSplit(e);n=h.getBestVersionForData(t,r)}d=y.fromString(e,n||40)}}const b=h.getBestVersionForData(d,r);if(!b)throw new Error("The amount of data is too big to be stored in a QR Code");if(t){if(t=0&&t<=6&&(0===n||6===n)||n>=0&&n<=6&&(0===t||6===t)||t>=2&&t<=4&&n>=2&&n<=4?e.set(i+t,o+n,!0,!0):e.set(i+t,o+n,!1,!0))}}(w,t),function(e){const t=e.size;for(let r=8;r=7&&function(e,t){const r=e.size,n=h.getEncodedBits(t);let i,o,s;for(let t=0;t<18;t++)i=Math.floor(t/3),o=t%3+r-8-3,s=1==(n>>t&1),e.set(i,o,s,!0),e.set(o,i,s,!0)}(w,t),function(e,t){const r=e.size;let n=-1,i=r-1,o=7,s=0;for(let a=r-1;a>0;a-=2)for(6===a&&a--;;){for(let r=0;r<2;r++)if(!e.isReserved(i,a-r)){let n=!1;s>>o&1)),e.set(i,a-r,n),o--,-1===o&&(s++,o=7)}if(i+=n,i<0||r<=i){i-=n,n=-n;break}}}(w,m),isNaN(i)&&(i=u.getBestMask(w,g.bind(null,w,r))),u.applyMask(i,w),g(w,r,i),{modules:w,version:t,errorCorrectionLevel:r,maskPattern:i,segments:d}}t.create=function(e,t){if(void 0===e||""===e)throw new Error("No input text");let r,o,s=i.M;return void 0!==t&&(s=i.from(t.errorCorrectionLevel,i.M),r=h.from(t.version),o=u.from(t.maskPattern),t.toSJISFunc&&n.setToSJISFunction(t.toSJISFunc)),b(e,r,s,o)}},52882:(e,t,r)=>{const n=r(26143);function i(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}i.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},i.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");const t=new Uint8Array(e.length+this.degree);t.set(e);const r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){const e=new Uint8Array(this.degree);return e.set(r,i),e}return r},e.exports=i},7007:(e,t)=>{let r="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";r=r.replace(/u/g,"\\u");const n="(?:(?![A-Z0-9 $%*+\\-./:]|"+r+")(?:.|[\r\n]))+";t.KANJI=new RegExp(r,"g"),t.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),t.BYTE=new RegExp(n,"g"),t.NUMERIC=new RegExp("[0-9]+","g"),t.ALPHANUMERIC=new RegExp("[A-Z $%*+\\-./:]+","g");const i=new RegExp("^"+r+"$"),o=new RegExp("^[0-9]+$"),s=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");t.testKanji=function(e){return i.test(e)},t.testNumeric=function(e){return o.test(e)},t.testAlphanumeric=function(e){return s.test(e)}},16130:(e,t,r)=>{const n=r(76910),i=r(41085),o=r(8260),s=r(43424),a=r(35442),c=r(7007),u=r(10242),f=r(65987);function l(e){return unescape(encodeURIComponent(e)).length}function h(e,t,r){const n=[];let i;for(;null!==(i=e.exec(r));)n.push({data:i[0],index:i.index,mode:t,length:i[0].length});return n}function d(e){const t=h(c.NUMERIC,n.NUMERIC,e),r=h(c.ALPHANUMERIC,n.ALPHANUMERIC,e);let i,o;return u.isKanjiModeEnabled()?(i=h(c.BYTE,n.BYTE,e),o=h(c.KANJI,n.KANJI,e)):(i=h(c.BYTE_KANJI,n.BYTE,e),o=[]),t.concat(r,i,o).sort((function(e,t){return e.index-t.index})).map((function(e){return{data:e.data,mode:e.mode,length:e.length}}))}function p(e,t){switch(t){case n.NUMERIC:return i.getBitsLength(e);case n.ALPHANUMERIC:return o.getBitsLength(e);case n.KANJI:return a.getBitsLength(e);case n.BYTE:return s.getBitsLength(e)}}function y(e,t){let r;const c=n.getBestModeForData(e);if(r=n.from(t,c),r!==n.BYTE&&r.bit=0?e[e.length-1]:null;return r&&r.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)}),[]))},t.rawSplit=function(e){return t.fromArray(d(e,u.isKanjiModeEnabled()))}},10242:(e,t)=>{let r;const n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];t.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return 4*e+17},t.getSymbolTotalCodewords=function(e){return n[e]},t.getBCHDigit=function(e){let t=0;for(;0!==e;)t++,e>>>=1;return t},t.setToSJISFunction=function(e){if("function"!=typeof e)throw new Error('"toSJISFunc" is not a valid function.');r=e},t.isKanjiModeEnabled=function(){return void 0!==r},t.toSJIS=function(e){return r(e)}},43114:(e,t)=>{t.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}},23103:(e,t,r)=>{const n=r(10242),i=r(35393),o=r(64908),s=r(76910),a=r(43114),c=n.getBCHDigit(7973);function u(e,t){return s.getCharCountIndicator(e,t)+4}function f(e,t){let r=0;return e.forEach((function(e){const n=u(e.mode,t);r+=n+e.getBitsLength()})),r}t.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},t.getCapacity=function(e,t,r){if(!a.isValid(e))throw new Error("Invalid QR Code version");void 0===r&&(r=s.BYTE);const o=8*(n.getSymbolTotalCodewords(e)-i.getTotalCodewordsCount(e,t));if(r===s.MIXED)return o;const c=o-u(r,e);switch(r){case s.NUMERIC:return Math.floor(c/10*3);case s.ALPHANUMERIC:return Math.floor(c/11*2);case s.KANJI:return Math.floor(c/13);case s.BYTE:default:return Math.floor(c/8)}},t.getBestVersionForData=function(e,r){let n;const i=o.from(r,o.M);if(Array.isArray(e)){if(e.length>1)return function(e,r){for(let n=1;n<=40;n++)if(f(e,n)<=t.getCapacity(n,r,s.MIXED))return n}(e,i);if(0===e.length)return 1;n=e[0]}else n=e;return function(e,r,n){for(let i=1;i<=40;i++)if(r<=t.getCapacity(i,n,e))return i}(n.mode,n.getLength(),i)},t.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw new Error("Invalid QR Code version");let t=e<<12;for(;n.getBCHDigit(t)-c>=0;)t^=7973<{const n=r(89653);t.render=function(e,t,r){let i=r,o=t;void 0!==i||t&&t.getContext||(i=t,t=void 0),t||(o=function(){try{return document.createElement("canvas")}catch(e){throw new Error("You need to specify a canvas element")}}()),i=n.getOptions(i);const s=n.getImageWidth(e.modules.size,i),a=o.getContext("2d"),c=a.createImageData(s,s);return n.qrToImageData(c.data,e,i),function(e,t,r){e.clearRect(0,0,t.width,t.height),t.style||(t.style={}),t.height=r,t.width=r,t.style.height=r+"px",t.style.width=r+"px"}(a,o,s),a.putImageData(c,0,0),o},t.renderToDataURL=function(e,r,n){let i=n;void 0!==i||r&&r.getContext||(i=r,r=void 0),i||(i={});const o=t.render(e,r,i),s=i.type||"image/png",a=i.rendererOpts||{};return o.toDataURL(s,a.quality)}},93776:(e,t,r)=>{const n=r(89653);function i(e,t){const r=e.a/255,n=t+'="'+e.hex+'"';return r<1?n+" "+t+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function o(e,t,r){let n=e+t;return void 0!==r&&(n+=" "+r),n}t.render=function(e,t,r){const s=n.getOptions(t),a=e.modules.size,c=e.modules.data,u=a+2*s.margin,f=s.color.light.a?"':"",l="0&&u>0&&e[c-1]||(n+=s?o("M",u+r,.5+f+r):o("m",i,0),i=0,s=!1),u+1',h='viewBox="0 0 '+u+" "+u+'"',d=''+f+l+"\n";return"function"==typeof r&&r(null,d),d}},89653:(e,t)=>{function r(e){if("number"==typeof e&&(e=e.toString()),"string"!=typeof e)throw new Error("Color should be defined as hex string");let t=e.slice().replace("#","").split("");if(t.length<3||5===t.length||t.length>8)throw new Error("Invalid hex color: "+e);3!==t.length&&4!==t.length||(t=Array.prototype.concat.apply([],t.map((function(e){return[e,e]})))),6===t.length&&t.push("F","F");const r=parseInt(t.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:255&r,hex:"#"+t.slice(0,6).join("")}}t.getOptions=function(e){e||(e={}),e.color||(e.color={});const t=void 0===e.margin||null===e.margin||e.margin<0?4:e.margin,n=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:n,scale:n?4:i,margin:t,color:{dark:r(e.color.dark||"#000000ff"),light:r(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}},t.getScale=function(e,t){return t.width&&t.width>=e+2*t.margin?t.width/(e+2*t.margin):t.scale},t.getImageWidth=function(e,r){const n=t.getScale(e,r);return Math.floor((e+2*r.margin)*n)},t.qrToImageData=function(e,r,n){const i=r.modules.size,o=r.modules.data,s=t.getScale(i,n),a=Math.floor((i+2*n.margin)*s),c=n.margin*s,u=[n.color.light,n.color.dark];for(let t=0;t=c&&r>=c&&t{"use strict";e.exports=s;var n=r(57824),i=s.prototype,o=new Date%1e9;function s(e){e=e||{},this.id=e.id||(1e9*Math.random()>>>0)+o++,this.max=e.max||1/0,this.items=e.items||[],this._lookup={},this.size=this.items.length,this.lastModified=new Date(e.lastModified||new Date);for(var t,r,n=this.items.length;n--;)t=this.items[n],r=new Date(t.expires)-new Date,this._lookup[t.key]=t,r>0?this.expire(t.key,r):r<=0&&this.delete(t.key)}i.has=function(e){return e in this._lookup},i.get=function(e){if(!this.has(e))return null;var t=this._lookup[e];return t.refresh&&this.expire(e,t.refresh),this.items.splice(this.items.indexOf(t),1),this.items.push(t),t.value},i.meta=function(e){if(!this.has(e))return null;var t=this._lookup[e];return"meta"in t?t.meta:null},i.set=function(e,t,r){var n=this._lookup[e],i=this._lookup[e]={key:e,value:t};return this.lastModified=new Date,n?(clearTimeout(n.timeout),this.items.splice(this.items.indexOf(n),1,i)):(this.size>=this.max&&this.delete(this.items[0].key),this.items.push(i),this.size++),r&&("ttl"in r&&this.expire(e,r.ttl),"meta"in r&&(i.meta=r.meta),r.refresh&&(i.refresh=r.ttl)),this},i.delete=function(e){var t=this._lookup[e];return!!t&&(this.lastModified=new Date,this.items.splice(this.items.indexOf(t),1),clearTimeout(t.timeout),delete this._lookup[e],this.size--,this)},i.expire=function(e,t){var r=t||0,i=this._lookup[e];if(!i)return this;if("string"==typeof r&&(r=n(t)),"number"!=typeof r)throw new TypeError("Expiration time must be a string or number.");return clearTimeout(i.timeout),i.timeout=setTimeout(this.delete.bind(this,i.key),r),i.expires=Number(new Date)+r,this},i.clear=function(){for(var e=this.items.length;e--;)this.delete(this.items[e].key);return this},i.toJSON=function(){for(var e,t=new Array(this.items.length),r=t.length;r--;)e=this.items[r],t[r]={key:e.key,meta:e.meta,value:e.value,expires:e.expires,refresh:e.refresh};return{id:this.id,max:isFinite(this.max)?this.max:void 0,lastModified:this.lastModified,items:t}}},82916:(e,t,r)=>{"use strict";const n=r(41807);class i{constructor(e,t,r){const i=this;this._started=n(),this._rescheduled=0,this._scheduled=t,this._args=r,this._triggered=!1,this._timerWrapper=()=>{i._rescheduled>0?(i._scheduled=i._rescheduled-(n()-i._started),i._schedule(i._scheduled)):(i._triggered=!0,e.apply(null,i._args))},this._timer=setTimeout(this._timerWrapper,t)}reschedule(e){e||(e=this._scheduled);const t=n();t+e-(this._started+this._scheduled)<0?(clearTimeout(this._timer),this._schedule(e)):this._triggered?this._schedule(e):(this._started=t,this._rescheduled=e)}_schedule(e){this._triggered=!1,this._started=n(),this._rescheduled=0,this._scheduled=e,this._timer=setTimeout(this._timerWrapper,e)}clear(){clearTimeout(this._timer)}}e.exports=function(){if("function"!=typeof arguments[0])throw new Error("callback needed");if("number"!=typeof arguments[1])throw new Error("timeout needed");let e;if(arguments.length>0){e=new Array(arguments.length-2);for(var t=0;t{"use strict";e.exports=function(){return Date.now()}},99353:(e,t,r)=>{e.exports=r(71846)},71846:(e,t,r)=>{var n=r(41960);t.operation=function(e){var r=t.timeouts(e);return new n(r,{forever:e&&(e.forever||e.retries===1/0),unref:e&&e.unref,maxRetryTime:e&&e.maxRetryTime})},t.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1e3,maxTimeout:1/0,randomize:!1};for(var r in e)t[r]=e[r];if(t.minTimeout>t.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var n=[],i=0;i{function t(e,t){"boolean"==typeof t&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}e.exports=t,t.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},t.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},t.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=(new Date).getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.push(e),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(e);var r=this._timeouts.shift();if(void 0===r){if(!this._cachedTimeouts)return!1;this._errors.splice(0,this._errors.length-1),r=this._cachedTimeouts.slice(-1)}var n=this;return this._timer=setTimeout((function(){n._attempts++,n._operationTimeoutCb&&(n._timeout=setTimeout((function(){n._operationTimeoutCb(n._attempts)}),n._operationTimeout),n._options.unref&&n._timeout.unref()),n._fn(n._attempts)}),r),this._options.unref&&this._timer.unref(),!0},t.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout((function(){r._operationTimeoutCb()}),r._operationTimeout)),this._operationStart=(new Date).getTime(),this._fn(this._attempts)},t.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)},t.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)},t.prototype.start=t.prototype.try,t.prototype.errors=function(){return this._errors},t.prototype.attempts=function(){return this._attempts},t.prototype.mainError=function(){if(0===this._errors.length)return null;for(var e={},t=null,r=0,n=0;n=r&&(t=i,r=s)}return t}},67652:(e,t,r)=>{"use strict";r.r(t),r.d(t,{ArgumentOutOfRangeError:()=>ft,AsyncSubject:()=>oe,BehaviorSubject:()=>re,ConnectableObservable:()=>$,EMPTY:()=>ke,EmptyError:()=>at,NEVER:()=>Jt,NotFoundError:()=>lt,Notification:()=>it,NotificationKind:()=>Fe,ObjectUnsubscribedError:()=>Z,Observable:()=>U,ReplaySubject:()=>ie,Scheduler:()=>ge,SequenceError:()=>ht,Subject:()=>ee,Subscriber:()=>C,Subscription:()=>y,TimeoutError:()=>pt,UnsubscriptionError:()=>d,VirtualAction:()=>Re,VirtualTimeScheduler:()=>Pe,animationFrame:()=>Ce,animationFrameScheduler:()=>Ie,animationFrames:()=>Y,asap:()=>ve,asapScheduler:()=>me,async:()=>Ee,asyncScheduler:()=>we,audit:()=>dr,auditTime:()=>pr,bindCallback:()=>Et,bindNodeCallback:()=>_t,buffer:()=>yr,bufferCount:()=>gr,bufferTime:()=>br,bufferToggle:()=>mr,bufferWhen:()=>vr,catchError:()=>wr,combineAll:()=>Cr,combineLatest:()=>Rt,combineLatestAll:()=>Ir,combineLatestWith:()=>Rr,concat:()=>Lt,concatAll:()=>Nt,concatMap:()=>kr,concatMapTo:()=>Br,concatWith:()=>Mr,config:()=>v,connect:()=>Nr,connectable:()=>Ut,count:()=>Lr,debounce:()=>Dr,debounceTime:()=>Kr,defaultIfEmpty:()=>Ur,defer:()=>Dt,delay:()=>Hr,delayWhen:()=>qr,dematerialize:()=>zr,distinct:()=>$r,distinctUntilChanged:()=>Gr,distinctUntilKeyChanged:()=>Yr,elementAt:()=>Jr,empty:()=>Be,endWith:()=>Zr,every:()=>en,exhaust:()=>rn,exhaustAll:()=>tn,exhaustMap:()=>nn,expand:()=>on,filter:()=>sr,finalize:()=>sn,find:()=>an,findIndex:()=>un,first:()=>fn,firstValueFrom:()=>ut,flatMap:()=>bn,forkJoin:()=>jt,from:()=>tt,fromEvent:()=>Ht,fromEventPattern:()=>$t,generate:()=>Gt,groupBy:()=>ln,identity:()=>L,ignoreElements:()=>Vr,iif:()=>Wt,interval:()=>Xt,isEmpty:()=>hn,isObservable:()=>st,last:()=>pn,lastValueFrom:()=>ct,map:()=>bt,mapTo:()=>Fr,materialize:()=>yn,max:()=>gn,merge:()=>Qt,mergeAll:()=>Ot,mergeMap:()=>Mt,mergeMapTo:()=>mn,mergeScan:()=>vn,mergeWith:()=>En,min:()=>_n,multicast:()=>Sn,never:()=>Zt,noop:()=>_,observable:()=>N,observeOn:()=>Xe,of:()=>rt,onErrorResumeNext:()=>nr,pairs:()=>ir,pairwise:()=>An,partition:()=>ar,pipe:()=>D,pluck:()=>Tn,publish:()=>In,publishBehavior:()=>Cn,publishLast:()=>Pn,publishReplay:()=>Rn,queue:()=>Ae,queueScheduler:()=>Se,race:()=>cr,raceWith:()=>kn,range:()=>fr,reduce:()=>_r,refCount:()=>z,repeat:()=>Bn,repeatWhen:()=>xn,retry:()=>Mn,retryWhen:()=>On,sample:()=>Nn,sampleTime:()=>Ln,scan:()=>Dn,scheduled:()=>et,sequenceEqual:()=>Kn,share:()=>Un,shareReplay:()=>Vn,single:()=>Fn,skip:()=>qn,skipLast:()=>Hn,skipUntil:()=>zn,skipWhile:()=>$n,startWith:()=>Gn,subscribeOn:()=>Qe,switchAll:()=>Yn,switchMap:()=>Wn,switchMapTo:()=>Xn,switchScan:()=>Qn,take:()=>jr,takeLast:()=>dn,takeUntil:()=>Jn,takeWhile:()=>Zn,tap:()=>ei,throttle:()=>ri,throttleTime:()=>ni,throwError:()=>nt,throwIfEmpty:()=>Xr,timeInterval:()=>ii,timeout:()=>yt,timeoutWith:()=>si,timer:()=>Yt,timestamp:()=>ai,toArray:()=>Ar,using:()=>lr,window:()=>ci,windowCount:()=>ui,windowTime:()=>fi,windowToggle:()=>li,windowWhen:()=>hi,withLatestFrom:()=>di,zip:()=>hr,zipAll:()=>pi,zipWith:()=>gi});var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)};function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function o(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function a(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return s}function c(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i1||a(e,t)}))})}function a(e,t){try{(r=i[e](t)).value instanceof u?Promise.resolve(r.value.v).then(c,f):l(o[0][2],r)}catch(e){l(o[0][3],e)}var r}function c(e){a("next",e)}function f(e){a("throw",e)}function l(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}function l(e){return"function"==typeof e}function h(e){var t=e((function(e){Error.call(e),e.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}Object.create,Object.create;var d=h((function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}));function p(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var y=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._teardowns=null}return e.prototype.unsubscribe=function(){var e,t,r,n,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var u=s(o),f=u.next();!f.done;f=u.next())f.value.remove(this)}catch(t){e={error:t}}finally{try{f&&!f.done&&(t=u.return)&&t.call(u)}finally{if(e)throw e.error}}else o.remove(this);var h=this.initialTeardown;if(l(h))try{h()}catch(e){i=e instanceof d?e.errors:[e]}var p=this._teardowns;if(p){this._teardowns=null;try{for(var y=s(p),g=y.next();!g.done;g=y.next()){var b=g.value;try{m(b)}catch(e){i=null!=i?i:[],e instanceof d?i=c(c([],a(i)),a(e.errors)):i.push(e)}}}catch(e){r={error:e}}finally{try{g&&!g.done&&(n=y.return)&&n.call(y)}finally{if(r)throw r.error}}}if(i)throw new d(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)m(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._teardowns=null!==(r=this._teardowns)&&void 0!==r?r:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&p(t,e)},e.prototype.remove=function(t){var r=this._teardowns;r&&p(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}(),g=y.EMPTY;function b(e){return e instanceof y||e&&"closed"in e&&l(e.remove)&&l(e.add)&&l(e.unsubscribe)}function m(e){l(e)?e():e.unsubscribe()}var v={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},w={setTimeout:function(){for(var e=[],t=0;t0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,r=t.hasError,n=t.isStopped,i=t.observers;return r||n?g:(i.push(e),new y((function(){return p(i,e)})))},t.prototype._checkFinalizedStatuses=function(e){var t=this,r=t.hasError,n=t.thrownError,i=t.isStopped;r?e.error(n):i&&e.complete()},t.prototype.asObservable=function(){var e=new U;return e.source=this,e},t.create=function(e,t){return new te(e,t)},t}(U),te=function(e){function t(t,r){var n=e.call(this)||this;return n.destination=t,n.source=r,n}return i(t,e),t.prototype.next=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===r||r.call(t,e)},t.prototype.error=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===r||r.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,r;return null!==(r=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==r?r:g},t}(ee),re=function(e){function t(t){var r=e.call(this)||this;return r._value=t,r}return i(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(t){var r=e.prototype._subscribe.call(this,t);return!r.closed&&t.next(this._value),r},t.prototype.getValue=function(){var e=this,t=e.hasError,r=e.thrownError,n=e._value;if(t)throw r;return this._throwIfClosed(),n},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},t}(ee),ne={now:function(){return(ne.delegate||Date).now()},delegate:void 0},ie=function(e){function t(t,r,n){void 0===t&&(t=1/0),void 0===r&&(r=1/0),void 0===n&&(n=ne);var i=e.call(this)||this;return i._bufferSize=t,i._windowTime=r,i._timestampProvider=n,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=r===1/0,i._bufferSize=Math.max(1,t),i._windowTime=Math.max(1,r),i}return i(t,e),t.prototype.next=function(t){var r=this,n=r.isStopped,i=r._buffer,o=r._infiniteTimeWindow,s=r._timestampProvider,a=r._windowTime;n||(i.push(t),!o&&i.push(s.now()+a)),this._trimBuffer(),e.prototype.next.call(this,t)},t.prototype._subscribe=function(e){this._throwIfClosed(),this._trimBuffer();for(var t=this._innerSubscribe(e),r=this._infiniteTimeWindow,n=this._buffer.slice(),i=0;i0?e.prototype.requestAsyncId.call(this,t,r,n):(t.actions.push(this),t._scheduled||(t._scheduled=pe.setImmediate(t.flush.bind(t,void 0))))},t.prototype.recycleAsyncId=function(t,r,n){if(void 0===n&&(n=0),null!=n&&n>0||null==n&&this.delay>0)return e.prototype.recycleAsyncId.call(this,t,r,n);t.actions.some((function(e){return e.id===r}))||(pe.clearImmediate(r),t._scheduled=void 0)},t}(ce),ge=function(){function e(t,r){void 0===r&&(r=e.now),this.schedulerActionCtor=t,this.now=r}return e.prototype.schedule=function(e,t,r){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(r,t)},e.now=ne.now,e}(),be=function(e){function t(t,r){void 0===r&&(r=ge.now);var n=e.call(this,t,r)||this;return n.actions=[],n._active=!1,n._scheduled=void 0,n}return i(t,e),t.prototype.flush=function(e){var t=this.actions;if(this._active)t.push(e);else{var r;this._active=!0;do{if(r=e.execute(e.state,e.delay))break}while(e=t.shift());if(this._active=!1,r){for(;e=t.shift();)e.unsubscribe();throw r}}},t}(ge),me=new(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.flush=function(e){this._active=!0;var t=this._scheduled;this._scheduled=void 0;var r,n=this.actions;e=e||n.shift();do{if(r=e.execute(e.state,e.delay))break}while((e=n[0])&&e.id===t&&n.shift());if(this._active=!1,r){for(;(e=n[0])&&e.id===t&&n.shift();)e.unsubscribe();throw r}},t}(be))(ye),ve=me,we=new be(ce),Ee=we,_e=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n}return i(t,e),t.prototype.schedule=function(t,r){return void 0===r&&(r=0),r>0?e.prototype.schedule.call(this,t,r):(this.delay=r,this.state=t,this.scheduler.flush(this),this)},t.prototype.execute=function(t,r){return r>0||this.closed?e.prototype.execute.call(this,t,r):this._execute(t,r)},t.prototype.requestAsyncId=function(t,r,n){return void 0===n&&(n=0),null!=n&&n>0||null==n&&this.delay>0?e.prototype.requestAsyncId.call(this,t,r,n):t.flush(this)},t}(ce),Se=new(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t}(be))(_e),Ae=Se,Te=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n}return i(t,e),t.prototype.requestAsyncId=function(t,r,n){return void 0===n&&(n=0),null!==n&&n>0?e.prototype.requestAsyncId.call(this,t,r,n):(t.actions.push(this),t._scheduled||(t._scheduled=W.requestAnimationFrame((function(){return t.flush(void 0)}))))},t.prototype.recycleAsyncId=function(t,r,n){if(void 0===n&&(n=0),null!=n&&n>0||null==n&&this.delay>0)return e.prototype.recycleAsyncId.call(this,t,r,n);t.actions.some((function(e){return e.id===r}))||(W.cancelAnimationFrame(r),t._scheduled=void 0)},t}(ce),Ie=new(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.flush=function(e){this._active=!0;var t=this._scheduled;this._scheduled=void 0;var r,n=this.actions;e=e||n.shift();do{if(r=e.execute(e.state,e.delay))break}while((e=n[0])&&e.id===t&&n.shift());if(this._active=!1,r){for(;(e=n[0])&&e.id===t&&n.shift();)e.unsubscribe();throw r}},t}(be))(Te),Ce=Ie,Pe=function(e){function t(t,r){void 0===t&&(t=Re),void 0===r&&(r=1/0);var n=e.call(this,t,(function(){return n.frame}))||this;return n.maxFrames=r,n.frame=0,n.index=-1,n}return i(t,e),t.prototype.flush=function(){for(var e,t,r=this.actions,n=this.maxFrames;(t=r[0])&&t.delay<=n&&(r.shift(),this.frame=t.delay,!(e=t.execute(t.state,t.delay))););if(e){for(;t=r.shift();)t.unsubscribe();throw e}},t.frameTimeFactor=10,t}(be),Re=function(e){function t(t,r,n){void 0===n&&(n=t.index+=1);var i=e.call(this,t,r)||this;return i.scheduler=t,i.work=r,i.index=n,i.active=!0,i.index=t.index=n,i}return i(t,e),t.prototype.schedule=function(r,n){if(void 0===n&&(n=0),Number.isFinite(n)){if(!this.id)return e.prototype.schedule.call(this,r,n);this.active=!1;var i=new t(this.scheduler,this.work);return this.add(i),i.schedule(r,n)}return y.EMPTY},t.prototype.requestAsyncId=function(e,r,n){void 0===n&&(n=0),this.delay=e.frame+n;var i=e.actions;return i.push(this),i.sort(t.sortActions),!0},t.prototype.recycleAsyncId=function(e,t,r){void 0===r&&(r=0)},t.prototype._execute=function(t,r){if(!0===this.active)return e.prototype._execute.call(this,t,r)},t.sortActions=function(e,t){return e.delay===t.delay?e.index===t.index?0:e.index>t.index?1:-1:e.delay>t.delay?1:-1},t}(ce),ke=new U((function(e){return e.complete()}));function Be(e){return e?function(e){return new U((function(t){return e.schedule((function(){return t.complete()}))}))}(e):ke}function xe(e){return e&&l(e.schedule)}function Me(e){return e[e.length-1]}function Oe(e){return l(Me(e))?e.pop():void 0}function Ne(e){return xe(Me(e))?e.pop():void 0}function Le(e,t){return"number"==typeof Me(e)?e.pop():t}var De=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function Ke(e){return l(null==e?void 0:e.then)}function Ue(e){return l(e[N])}function je(e){return Symbol.asyncIterator&&l(null==e?void 0:e[Symbol.asyncIterator])}function Ve(e){return new TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var Fe,qe="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function He(e){return l(null==e?void 0:e[qe])}function ze(e){return f(this,arguments,(function(){var t,r,n;return o(this,(function(i){switch(i.label){case 0:t=e.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,u(t.read())];case 3:return r=i.sent(),n=r.value,r.done?[4,u(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,u(n)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}}))}))}function $e(e){return l(null==e?void 0:e.getReader)}function Ge(e){if(e instanceof U)return e;if(null!=e){if(Ue(e))return i=e,new U((function(e){var t=i[N]();if(l(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(De(e))return n=e,new U((function(e){for(var t=0;t0&&l(i)}),void 0,void 0,(function(){(null==o?void 0:o.closed)||null==o||o.unsubscribe(),a=null}))),l(null!=n?"number"==typeof n?n:+n-c.now():i)}))}function gt(e){throw new pt(e)}function bt(e,t){return F((function(r,n){var i=0;r.subscribe(q(n,(function(r){n.next(e.call(t,r,i++))})))}))}var mt=Array.isArray;function vt(e){return bt((function(t){return function(e,t){return mt(t)?e.apply(void 0,c([],a(t))):e(t)}(e,t)}))}function wt(e,t,r,n){if(r){if(!xe(r))return function(){for(var i=[],o=0;o0){var e=void 0;try{e=Ge(n.shift())}catch(e){return void i()}var r=q(t,void 0,_,_);e.subscribe(r),r.add(i)}else t.complete()};i()}))}function nr(){for(var e=[],t=0;t=0?Ye(r,o,f,a,!0):i=!0,f();var l=q(r,(function(e){var t,r,i=n.slice();try{for(var o=s(i),a=o.next();!a.done;a=o.next()){var f=a.value,l=f.buffer;l.push(e),c<=l.length&&u(f)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}}),(function(){for(;null==n?void 0:n.length;)r.next(n.shift().buffer);null==l||l.unsubscribe(),r.complete(),r.unsubscribe()}),void 0,(function(){return n=null}));t.subscribe(l)}))}function mr(e,t){return F((function(r,n){var i=[];Ge(e).subscribe(q(n,(function(e){var r=[];i.push(r);var o=new y;o.add(Ge(t(e)).subscribe(q(n,(function(){p(i,r),n.next(r),o.unsubscribe()}),_)))}),_)),r.subscribe(q(n,(function(e){var t,r;try{for(var n=s(i),o=n.next();!o.done;o=n.next())o.value.push(e)}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}}),(function(){for(;i.length>0;)n.next(i.shift());n.complete()})))}))}function vr(e){return F((function(t,r){var n=null,i=null,o=function(){null==i||i.unsubscribe();var t=n;n=[],t&&r.next(t),Ge(e()).subscribe(i=q(r,o,_))};o(),t.subscribe(q(r,(function(e){return null==n?void 0:n.push(e)}),(function(){n&&r.next(n),r.complete()}),void 0,(function(){return n=i=null})))}))}function wr(e){return F((function(t,r){var n,i=null,o=!1;i=t.subscribe(q(r,void 0,void 0,(function(s){n=Ge(e(s,wr(e)(t))),i?(i.unsubscribe(),i=null,n.subscribe(r)):o=!0}))),o&&(i.unsubscribe(),i=null,n.subscribe(r))}))}function Er(e,t,r,n,i){return function(o,s){var a=r,c=t,u=0;o.subscribe(q(s,(function(t){var r=u++;c=a?e(c,t,r):(a=!0,t),n&&s.next(c)}),i&&function(){a&&s.next(c),s.complete()}))}}function _r(e,t){return F(Er(e,t,arguments.length>=2,!1,!0))}var Sr=function(e,t){return e.push(t),e};function Ar(){return F((function(e,t){_r(Sr,[])(e).subscribe(t)}))}function Tr(e,t){return D(Ar(),Mt((function(t){return e(t)})),t?vt(t):L)}function Ir(e){return Tr(Rt,e)}var Cr=Ir;function Pr(){for(var e=[],t=0;t=2;return function(n){return n.pipe(sr((function(t,r){return r===e})),jr(1),r?Ur(t):Xr((function(){return new ft})))}}function Zr(){for(var e=[],t=0;t=2;return function(n){return n.pipe(e?sr((function(t,r){return e(t,r,n)})):L,jr(1),r?Ur(t):Xr((function(){return new at})))}}function ln(e,t,r,n){return F((function(i,o){var s;t&&"function"!=typeof t?(r=t.duration,s=t.element,n=t.connector):s=t;var a=new Map,c=function(e){a.forEach(e),e(o)},u=function(e){return c((function(t){return t.error(e)}))},f=0,l=!1,h=new H(o,(function(t){try{var i=e(t),c=a.get(i);if(!c){a.set(i,c=n?n():new ee);var d=(y=i,g=c,(b=new U((function(e){f++;var t=g.subscribe(e);return function(){t.unsubscribe(),0==--f&&l&&h.unsubscribe()}}))).key=y,b);if(o.next(d),r){var p=q(c,(function(){c.complete(),null==p||p.unsubscribe()}),void 0,void 0,(function(){return a.delete(i)}));h.add(Ge(r(d)).subscribe(p))}}c.next(s?s(t):t)}catch(e){u(e)}var y,g,b}),(function(){return c((function(e){return e.complete()}))}),u,(function(){return a.clear()}),(function(){return l=!0,0===f}));i.subscribe(h)}))}function hn(){return F((function(e,t){e.subscribe(q(t,(function(){t.next(!1),t.complete()}),(function(){t.next(!0),t.complete()})))}))}function dn(e){return e<=0?function(){return ke}:F((function(t,r){var n=[];t.subscribe(q(r,(function(t){n.push(t),e=2;return function(n){return n.pipe(e?sr((function(t,r){return e(t,r,n)})):L,dn(1),r?Ur(t):Xr((function(){return new at})))}}function yn(){return F((function(e,t){e.subscribe(q(t,(function(e){t.next(it.createNext(e))}),(function(){t.next(it.createComplete()),t.complete()}),(function(e){t.next(it.createError(e)),t.complete()})))}))}function gn(e){return _r(l(e)?function(t,r){return e(t,r)>0?t:r}:function(e,t){return e>t?e:t})}var bn=Mt;function mn(e,t,r){return void 0===r&&(r=1/0),l(t)?Mt((function(){return e}),t,r):("number"==typeof t&&(r=t),Mt((function(){return e}),r))}function vn(e,t,r){return void 0===r&&(r=1/0),F((function(n,i){var o=t;return xt(n,i,(function(t,r){return e(o,t,r)}),r,(function(e){o=e}),!1,void 0,(function(){return o=null}))}))}function wn(){for(var e=[],t=0;t=2,!0))}function Kn(e,t){return void 0===t&&(t=function(e,t){return e===t}),F((function(r,n){var i={buffer:[],complete:!1},o={buffer:[],complete:!1},s=function(e){n.next(e),n.complete()},a=function(e,r){var i=q(n,(function(n){var i=r.buffer,o=r.complete;0===i.length?o?s(!1):e.buffer.push(n):!t(n,i.shift())&&s(!1)}),(function(){e.complete=!0;var t=r.complete,n=r.buffer;t&&s(0===n.length),null==i||i.unsubscribe()}));return i};r.subscribe(a(i,o)),e.subscribe(a(o,i))}))}function Un(e){void 0===e&&(e={});var t=e.connector,r=void 0===t?function(){return new ee}:t,n=e.resetOnError,i=void 0===n||n,o=e.resetOnComplete,s=void 0===o||o,a=e.resetOnRefCountZero,c=void 0===a||a;return function(e){var t=null,n=null,o=null,a=0,u=!1,f=!1,l=function(){null==n||n.unsubscribe(),n=null},h=function(){l(),t=o=null,u=f=!1},d=function(){var e=t;h(),null==e||e.unsubscribe()};return F((function(e,p){a++,f||u||l();var y=o=null!=o?o:r();p.add((function(){0!=--a||f||u||(n=jn(d,c))})),y.subscribe(p),t||(t=new B({next:function(e){return y.next(e)},error:function(e){f=!0,l(),n=jn(h,i,e),y.error(e)},complete:function(){u=!0,l(),n=jn(h,s),y.complete()}}),tt(e).subscribe(t))}))(e)}}function jn(e,t){for(var r=[],n=2;n0?t:e;return F((function(t,n){var i=[new ee],o=0;n.next(i[0].asObservable()),t.subscribe(q(n,(function(t){var a,c;try{for(var u=s(i),f=u.next();!f.done;f=u.next())f.value.next(t)}catch(e){a={error:e}}finally{try{f&&!f.done&&(c=u.return)&&c.call(u)}finally{if(a)throw a.error}}var l=o-e+1;if(l>=0&&l%r==0&&i.shift().complete(),++o%r==0){var h=new ee;i.push(h),n.next(h.asObservable())}}),(function(){for(;i.length>0;)i.shift().complete();n.complete()}),(function(e){for(;i.length>0;)i.shift().error(e);n.error(e)}),(function(){i=null})))}))}function fi(e){for(var t,r,n=[],i=1;i=0?Ye(r,o,u,s,!0):i=!0,u();var f=function(e){return n.slice().forEach(e)},l=function(e){f((function(t){var r=t.window;return e(r)})),e(r),r.unsubscribe()};return t.subscribe(q(r,(function(e){f((function(t){t.window.next(e),a<=++t.seen&&c(t)}))}),(function(){return l((function(e){return e.complete()}))}),(function(e){return l((function(t){return t.error(e)}))}))),function(){n=null}}))}function li(e,t){return F((function(r,n){var i=[],o=function(e){for(;0{var n=r(48764),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,t),t.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},s.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},50202:(e,t,r)=>{"use strict";var n=r(63700),i=/[\/\?<>\\:\*\|"]/g,o=/[\x00-\x1f\x80-\x9f]/g,s=/^\.+$/,a=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i,c=/[\. ]+$/;function u(e,t){if("string"!=typeof e)throw new Error("Input must be string");var r=e.replace(i,t).replace(o,t).replace(s,t).replace(a,t).replace(c,t);return n(r,255)}e.exports=function(e,t){var r=t&&t.replacement||"",n=u(e,r);return""===r?n:u(n,"")}},17221:(e,t,r)=>{e.exports=r(59119)(r(58573))},58573:(e,t,r)=>{const n=new(0,r(86266).ec)("secp256k1"),i=n.curve,o=i.n.constructor;function s(e){const t=e[0];switch(t){case 2:case 3:return 33!==e.length?null:function(e,t){let r=new o(t);if(r.cmp(i.p)>=0)return null;r=r.toRed(i.red);let s=r.redSqr().redIMul(r).redIAdd(i.b).redSqrt();return 3===e!==s.isOdd()&&(s=s.redNeg()),n.keyPair({pub:{x:r,y:s}})}(t,e.subarray(1,33));case 4:case 6:case 7:return 65!==e.length?null:function(e,t,r){let s=new o(t),a=new o(r);if(s.cmp(i.p)>=0||a.cmp(i.p)>=0)return null;if(s=s.toRed(i.red),a=a.toRed(i.red),(6===e||7===e)&&a.isOdd()!==(7===e))return null;const c=s.redSqr().redIMul(s);return a.redSqr().redISub(c.redIAdd(i.b)).isZero()?n.keyPair({pub:{x:s,y:a}}):null}(t,e.subarray(1,33),e.subarray(33,65));default:return null}}function a(e,t){const r=t.encode(null,33===e.length);for(let t=0;t0,privateKeyVerify(e){const t=new o(e);return t.cmp(i.n)<0&&!t.isZero()?0:1},privateKeyNegate(e){const t=new o(e),r=i.n.sub(t).umod(i.n).toArrayLike(Uint8Array,"be",32);return e.set(r),0},privateKeyTweakAdd(e,t){const r=new o(t);if(r.cmp(i.n)>=0)return 1;if(r.iadd(new o(e)),r.cmp(i.n)>=0&&r.isub(i.n),r.isZero())return 1;const n=r.toArrayLike(Uint8Array,"be",32);return e.set(n),0},privateKeyTweakMul(e,t){let r=new o(t);if(r.cmp(i.n)>=0||r.isZero())return 1;r.imul(new o(e)),r.cmp(i.n)>=0&&(r=r.umod(i.n));const n=r.toArrayLike(Uint8Array,"be",32);return e.set(n),0},publicKeyVerify:e=>null===s(e)?1:0,publicKeyCreate(e,t){const r=new o(t);return r.cmp(i.n)>=0||r.isZero()?1:(a(e,n.keyFromPrivate(t).getPublic()),0)},publicKeyConvert(e,t){const r=s(t);return null===r?1:(a(e,r.getPublic()),0)},publicKeyNegate(e,t){const r=s(t);if(null===r)return 1;const n=r.getPublic();return n.y=n.y.redNeg(),a(e,n),0},publicKeyCombine(e,t){const r=new Array(t.length);for(let e=0;e=0)return 2;const c=n.getPublic().add(i.g.mul(r));return c.isInfinity()?2:(a(e,c),0)},publicKeyTweakMul(e,t,r){const n=s(t);return null===n?1:(r=new o(r)).cmp(i.n)>=0||r.isZero()?2:(a(e,n.getPublic().mul(r)),0)},signatureNormalize(e){const t=new o(e.subarray(0,32)),r=new o(e.subarray(32,64));return t.cmp(i.n)>=0||r.cmp(i.n)>=0?1:(1===r.cmp(n.nh)&&e.set(i.n.sub(r).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(e,t){const r=t.subarray(0,32),n=t.subarray(32,64);if(new o(r).cmp(i.n)>=0)return 1;if(new o(n).cmp(i.n)>=0)return 1;const{output:s}=e;let a=s.subarray(4,37);a[0]=0,a.set(r,1);let c=33,u=0;for(;c>1&&0===a[u]&&!(128&a[u+1]);--c,++u);if(a=a.subarray(u),128&a[0])return 1;if(c>1&&0===a[0]&&!(128&a[1]))return 1;let f=s.subarray(39,72);f[0]=0,f.set(n,1);let l=33,h=0;for(;l>1&&0===f[h]&&!(128&f[h+1]);--l,++h);return f=f.subarray(h),128&f[0]||l>1&&0===f[0]&&!(128&f[1])?1:(e.outputlen=6+c+l,s[0]=48,s[1]=e.outputlen-2,s[2]=2,s[3]=a.length,s.set(a,4),s[4+c]=2,s[5+c]=f.length,s.set(f,6+c),0)},signatureImport(e,t){if(t.length<8)return 1;if(t.length>72)return 1;if(48!==t[0])return 1;if(t[1]!==t.length-2)return 1;if(2!==t[2])return 1;const r=t[3];if(0===r)return 1;if(5+r>=t.length)return 1;if(2!==t[4+r])return 1;const n=t[5+r];if(0===n)return 1;if(6+r+n!==t.length)return 1;if(128&t[4])return 1;if(r>1&&0===t[4]&&!(128&t[5]))return 1;if(128&t[r+6])return 1;if(n>1&&0===t[r+6]&&!(128&t[r+7]))return 1;let s=t.subarray(4,4+r);if(33===s.length&&0===s[0]&&(s=s.subarray(1)),s.length>32)return 1;let a=t.subarray(6+r);if(33===a.length&&0===a[0]&&(a=a.slice(1)),a.length>32)throw new Error("S length is too long");let c=new o(s);c.cmp(i.n)>=0&&(c=new o(0));let u=new o(t.subarray(6+r));return u.cmp(i.n)>=0&&(u=new o(0)),e.set(c.toArrayLike(Uint8Array,"be",32),0),e.set(u.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(e,t,r,s,a){if(a){const e=a;a=n=>{const i=e(t,r,null,s,n);if(!(i instanceof Uint8Array&&32===i.length))throw new Error("This is the way");return new o(i)}}const c=new o(r);if(c.cmp(i.n)>=0||c.isZero())return 1;let u;try{u=n.sign(t,r,{canonical:!0,k:a,pers:s})}catch(e){return 1}return e.signature.set(u.r.toArrayLike(Uint8Array,"be",32),0),e.signature.set(u.s.toArrayLike(Uint8Array,"be",32),32),e.recid=u.recoveryParam,0},ecdsaVerify(e,t,r){const a={r:e.subarray(0,32),s:e.subarray(32,64)},c=new o(a.r),u=new o(a.s);if(c.cmp(i.n)>=0||u.cmp(i.n)>=0)return 1;if(1===u.cmp(n.nh)||c.isZero()||u.isZero())return 3;const f=s(r);if(null===f)return 2;const l=f.getPublic();return n.verify(t,a,l)?0:3},ecdsaRecover(e,t,r,s){const c={r:t.slice(0,32),s:t.slice(32,64)},u=new o(c.r),f=new o(c.s);if(u.cmp(i.n)>=0||f.cmp(i.n)>=0)return 1;if(u.isZero()||f.isZero())return 2;let l;try{l=n.recoverPubKey(s,c,r)}catch(e){return 2}return a(e,l),0},ecdh(e,t,r,a,c,u,f){const l=s(t);if(null===l)return 1;const h=new o(r);if(h.cmp(i.n)>=0||h.isZero())return 2;const d=l.getPublic().mul(h);if(void 0===c){const t=d.encode(null,!0),r=n.hash().update(t).digest();for(let t=0;t<32;++t)e[t]=r[t]}else{u||(u=new Uint8Array(32));const t=d.getX().toArray("be",32);for(let e=0;e<32;++e)u[e]=t[e];f||(f=new Uint8Array(32));const r=d.getY().toArray("be",32);for(let e=0;e<32;++e)f[e]=r[e];const n=c(u,f,a);if(!(n instanceof Uint8Array&&n.length===e.length))return 2;e.set(n)}return 0}}},59119:e=>{const t="Impossible case. Please create issue.",r="The tweak was out of range or the resulted private key is invalid",n="The tweak was out of range or equal to zero",i="Public Key could not be parsed",o="Public Key serialization error",s="Signature could not be parsed";function a(e,t){if(!e)throw new Error(t)}function c(e,t,r){if(a(t instanceof Uint8Array,`Expected ${e} to be an Uint8Array`),void 0!==r)if(Array.isArray(r)){const n=`Expected ${e} to be an Uint8Array with length [${r.join(", ")}]`;a(r.includes(t.length),n)}else{const n=`Expected ${e} to be an Uint8Array with length ${r}`;a(t.length===r,n)}}function u(e){a("Boolean"===l(e),"Expected compressed to be a Boolean")}function f(e=(e=>new Uint8Array(e)),t){return"function"==typeof e&&(e=e(t)),c("output",e,t),e}function l(e){return Object.prototype.toString.call(e).slice(8,-1)}e.exports=e=>({contextRandomize(t){if(a(null===t||t instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),null!==t&&c("seed",t,32),1===e.contextRandomize(t))throw new Error("Unknow error on context randomization")},privateKeyVerify:t=>(c("private key",t,32),0===e.privateKeyVerify(t)),privateKeyNegate(r){switch(c("private key",r,32),e.privateKeyNegate(r)){case 0:return r;case 1:throw new Error(t)}},privateKeyTweakAdd(t,n){switch(c("private key",t,32),c("tweak",n,32),e.privateKeyTweakAdd(t,n)){case 0:return t;case 1:throw new Error(r)}},privateKeyTweakMul(t,r){switch(c("private key",t,32),c("tweak",r,32),e.privateKeyTweakMul(t,r)){case 0:return t;case 1:throw new Error(n)}},publicKeyVerify:t=>(c("public key",t,[33,65]),0===e.publicKeyVerify(t)),publicKeyCreate(t,r=!0,n){switch(c("private key",t,32),u(r),n=f(n,r?33:65),e.publicKeyCreate(n,t)){case 0:return n;case 1:throw new Error("Private Key is invalid");case 2:throw new Error(o)}},publicKeyConvert(t,r=!0,n){switch(c("public key",t,[33,65]),u(r),n=f(n,r?33:65),e.publicKeyConvert(n,t)){case 0:return n;case 1:throw new Error(i);case 2:throw new Error(o)}},publicKeyNegate(r,n=!0,s){switch(c("public key",r,[33,65]),u(n),s=f(s,n?33:65),e.publicKeyNegate(s,r)){case 0:return s;case 1:throw new Error(i);case 2:throw new Error(t);case 3:throw new Error(o)}},publicKeyCombine(t,r=!0,n){a(Array.isArray(t),"Expected public keys to be an Array"),a(t.length>0,"Expected public keys array will have more than zero items");for(const e of t)c("public key",e,[33,65]);switch(u(r),n=f(n,r?33:65),e.publicKeyCombine(n,t)){case 0:return n;case 1:throw new Error(i);case 2:throw new Error("The sum of the public keys is not valid");case 3:throw new Error(o)}},publicKeyTweakAdd(t,n,o=!0,s){switch(c("public key",t,[33,65]),c("tweak",n,32),u(o),s=f(s,o?33:65),e.publicKeyTweakAdd(s,t,n)){case 0:return s;case 1:throw new Error(i);case 2:throw new Error(r)}},publicKeyTweakMul(t,r,o=!0,s){switch(c("public key",t,[33,65]),c("tweak",r,32),u(o),s=f(s,o?33:65),e.publicKeyTweakMul(s,t,r)){case 0:return s;case 1:throw new Error(i);case 2:throw new Error(n)}},signatureNormalize(t){switch(c("signature",t,64),e.signatureNormalize(t)){case 0:return t;case 1:throw new Error(s)}},signatureExport(r,n){c("signature",r,64);const i={output:n=f(n,72),outputlen:72};switch(e.signatureExport(i,r)){case 0:return n.slice(0,i.outputlen);case 1:throw new Error(s);case 2:throw new Error(t)}},signatureImport(r,n){switch(c("signature",r),n=f(n,64),e.signatureImport(n,r)){case 0:return n;case 1:throw new Error(s);case 2:throw new Error(t)}},ecdsaSign(r,n,i={},o){c("message",r,32),c("private key",n,32),a("Object"===l(i),"Expected options to be an Object"),void 0!==i.data&&c("options.data",i.data),void 0!==i.noncefn&&a("Function"===l(i.noncefn),"Expected options.noncefn to be a Function");const s={signature:o=f(o,64),recid:null};switch(e.ecdsaSign(s,r,n,i.data,i.noncefn)){case 0:return s;case 1:throw new Error("The nonce generation function failed, or the private key was invalid");case 2:throw new Error(t)}},ecdsaVerify(t,r,n){switch(c("signature",t,64),c("message",r,32),c("public key",n,[33,65]),e.ecdsaVerify(t,r,n)){case 0:return!0;case 3:return!1;case 1:throw new Error(s);case 2:throw new Error(i)}},ecdsaRecover(r,n,i,o=!0,h){switch(c("signature",r,64),a("Number"===l(n)&&n>=0&&n<=3,"Expected recovery id to be a Number within interval [0, 3]"),c("message",i,32),u(o),h=f(h,o?33:65),e.ecdsaRecover(h,r,n,i)){case 0:return h;case 1:throw new Error(s);case 2:throw new Error("Public key could not be recover");case 3:throw new Error(t)}},ecdh(t,r,n={},o){switch(c("public key",t,[33,65]),c("private key",r,32),a("Object"===l(n),"Expected options to be an Object"),void 0!==n.data&&c("options.data",n.data),void 0!==n.hashfn?(a("Function"===l(n.hashfn),"Expected options.hashfn to be a Function"),void 0!==n.xbuf&&c("options.xbuf",n.xbuf,32),void 0!==n.ybuf&&c("options.ybuf",n.ybuf,32),c("output",o)):o=f(o,32),e.ecdh(o,t,r,n.data,n.hashfn,n.xbuf,n.ybuf)){case 0:return o;case 1:throw new Error(i);case 2:throw new Error("Scalar was invalid (zero or overflow)")}}})},27695:e=>{"use strict";const t=new Map;e.exports={setDelayedInterval:function(e,r,n){n=n||r;const i=`${Date.now()}:${Math.floor(1e6*Math.random())}`,o=setTimeout((()=>{!async function(e,r,n){for(;t.get(n);){try{await e()}catch(e){setTimeout((()=>{throw e}),1);break}if(!t.get(n))break;await new Promise((e=>{const i=setTimeout(e,r);t.set(n,i)}))}}(e,r,i)}),n);return t.set(i,o),i},clearDelayedInterval:function(e){const r=t.get(e);r&&(clearTimeout(r),t.delete(e))}}},8975:(e,t,r)=>{var n;!function(){"use strict";var i={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function o(e){return a(u(e),arguments)}function s(e,t){return o.apply(null,[e].concat(t||[]))}function a(e,t){var r,n,s,a,c,u,f,l,h,d=1,p=e.length,y="";for(n=0;n=0),a.type){case"b":r=parseInt(r,10).toString(2);break;case"c":r=String.fromCharCode(parseInt(r,10));break;case"d":case"i":r=parseInt(r,10);break;case"j":r=JSON.stringify(r,null,a.width?parseInt(a.width):0);break;case"e":r=a.precision?parseFloat(r).toExponential(a.precision):parseFloat(r).toExponential();break;case"f":r=a.precision?parseFloat(r).toFixed(a.precision):parseFloat(r);break;case"g":r=a.precision?String(Number(r.toPrecision(a.precision))):parseFloat(r);break;case"o":r=(parseInt(r,10)>>>0).toString(8);break;case"s":r=String(r),r=a.precision?r.substring(0,a.precision):r;break;case"t":r=String(!!r),r=a.precision?r.substring(0,a.precision):r;break;case"T":r=Object.prototype.toString.call(r).slice(8,-1).toLowerCase(),r=a.precision?r.substring(0,a.precision):r;break;case"u":r=parseInt(r,10)>>>0;break;case"v":r=r.valueOf(),r=a.precision?r.substring(0,a.precision):r;break;case"x":r=(parseInt(r,10)>>>0).toString(16);break;case"X":r=(parseInt(r,10)>>>0).toString(16).toUpperCase()}i.json.test(a.type)?y+=r:(!i.number.test(a.type)||l&&!a.sign?h="":(h=l?"+":"-",r=r.toString().replace(i.sign,"")),u=a.pad_char?"0"===a.pad_char?"0":a.pad_char.charAt(1):" ",f=a.width-(h+r).length,c=a.width&&f>0?u.repeat(f):"",y+=a.align?h+r+c:"0"===u?h+c+r:c+h+r)}return y}var c=Object.create(null);function u(e){if(c[e])return c[e];for(var t,r=e,n=[],o=0;r;){if(null!==(t=i.text.exec(r)))n.push(t[0]);else if(null!==(t=i.modulo.exec(r)))n.push("%");else{if(null===(t=i.placeholder.exec(r)))throw new SyntaxError("[sprintf] unexpected placeholder");if(t[2]){o|=1;var s=[],a=t[2],u=[];if(null===(u=i.key.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(s.push(u[1]);""!==(a=a.substring(u[0].length));)if(null!==(u=i.key_access.exec(a)))s.push(u[1]);else{if(null===(u=i.index_access.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");s.push(u[1])}t[2]=s}else o|=2;if(3===o)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n.push({placeholder:t[0],param_no:t[1],keys:t[2],sign:t[3],pad_char:t[4],align:t[5],width:t[6],precision:t[7],type:t[8]})}r=r.substring(t[0].length)}return c[e]=n}t.sprintf=o,t.vsprintf=s,"undefined"!=typeof window&&(window.sprintf=o,window.vsprintf=s,void 0===(n=function(){return{sprintf:o,vsprintf:s}}.call(t,r,t,e))||(e.exports=n))}()},38386:function(e,t,r){var n=r(34155);!function(e){"use strict";function t(e,r){return void 0===r?r=>t(e,r):r[Symbol.asyncIterator]?async function*(e,t){let r=[];for await(const n of t)r.push(n),r.length===e&&(yield r,r=[]);r.length>0&&(yield r)}(e,r):function*(e,t){let r=[];for(const n of t)r.push(n),r.length===e&&(yield r,r=[]);r.length>0&&(yield r)}(e,r)}const r=Symbol("TIMEOUT");async function*i(e,t,n){const i=n[Symbol.asyncIterator]();let o,s,a,c=[];const u=()=>{f(),[s,a]=(e=>{let t;return[new Promise((n=>{t=setTimeout((()=>n(r)),e)})),()=>{clearTimeout(t)}]})(t)},f=()=>{a&&a(),s=void 0};for(o=i.next();;){const t=await(s?Promise.race([o,s]):o);if(t===r||t.done){if(c.length&&(yield c,c=[]),f(),t!==r)break}else o=i.next(),c.push(t.value),1===c.length&&u(),c.length!==e||(yield c,c=[],f())}}function o(e){if("function"==typeof e.next)return e;if("function"==typeof e[Symbol.iterator])return e[Symbol.iterator]();if("function"==typeof e[Symbol.asyncIterator])return e[Symbol.asyncIterator]();throw new TypeError('"values" does not to conform to any of the iterator or iterable protocols')}function s(){let e,t;return{promise:new Promise(((r,n)=>{t=r,e=n})),reject:e,resolve:t}}function a(e,t){const r=o(t),n=[],i=[];let a=!1,c=!1;async function u(){if(!c&&!(a||n.length>=e)){a=!0;try{const{done:e,value:t}=await r.next();e?c=!0:n.push({value:t})}catch(e){c=!0,n.push({error:e})}(function(){for(;i.length>0&&n.length>0;){const e=i.shift(),{error:t,value:r}=n.shift();t?e.reject(t):e.resolve({done:!1,value:r})}for(;i.length>0&&c;){const{resolve:e}=i.shift();e({done:!0,value:void 0})}})(),a=!1,u()}}const f={next:async function(){if(n.length>0){const{error:e,value:t}=n.shift();if(e)throw e;return u(),{done:!1,value:t}}if(c)return{done:!0,value:void 0};const e=s();return i.push(e),u(),e.promise},[Symbol.asyncIterator]:()=>f};return f}function c(e,t){return void 0===t?t=>c(e,t):0===e?t:t[Symbol.asyncIterator]?a(e,t):function*(e,t){const r=[];let n;try{for(const n of t)r.push(n),r.length<=e||(yield r.shift())}catch(e){n=e}for(const e of r)yield e;if(n)throw n}(e,t)}async function*u(e,t){for await(const r of t)await e(r)&&(yield r)}function f(e,t){return void 0===t?t=>u(e,t):u(e,t)}async function*l(e){for await(const t of e)t&&"string"!=typeof t&&(t[Symbol.iterator]||t[Symbol.asyncIterator])?yield*l(t):yield t}async function*h(e,t){for await(const r of t)yield await e(r)}function d(e,t){return void 0===t?t=>h(e,t):h(e,t)}function p(e,t,r){const n=o(r),i=[],a=[];let c=!1,u=!1,f=0,l=null;function h(){for(;a.length>0&&i.length>0;){const{resolve:e}=a.shift();e({done:!1,value:i.shift()})}for(;a.length>0&&0===f&&c;){const{resolve:e,reject:t}=a.shift();l?(t(l),l=null):e({done:!0,value:void 0})}}async function d(){if(c)h();else if(!(u||f+i.length>=e)){u=!0,f++;try{const{done:e,value:r}=await n.next();e?(c=!0,f--,h()):async function(e){try{const r=await t(e);if(r&&r[Symbol.asyncIterator])for await(const e of r)i.push(e);else i.push(r)}catch(e){c=!0,l=e}f--,h(),d()}(r)}catch(e){c=!0,f--,l=e,h()}u=!1,d()}}const p={next:async function(){if(0===i.length){const e=s();return a.push(e),d(),e.promise}const e=i.shift();return d(),{done:!1,value:e}},[Symbol.asyncIterator]:()=>p};return p}async function y(e){return new Promise((t=>{e.once("readable",(()=>{t()}))}))}function g(e,...t){let r=e();for(const e of t)r=e(r);return r}function b(e,t,r){return void 0===t?(t,r)=>b(e,t,r):void 0===r?r=>b(e,t,r):1===e?d(t,r):async function*(e,t,r){let n=null;const i=o(g((()=>r),c(1),(async function*(e){for await(const t of e){if(n)return;yield t}}),d((e=>({value:t(e)}))),c(e-1)));for(;;){const{value:e,done:t}=await i.next();if(t)break;try{const t=await e.value;n||(yield t)}catch(e){n=e}}if(n)throw n}(e,t,r)}async function m(e,t,r){let n=t;for await(const t of r)n=await e(n,t);return n}async function*v(e,t){for await(const r of t)await e(r),yield r}const w=e=>new Promise((t=>setTimeout(t,e)));function E(e,t,r){if(!Number.isFinite(e))throw new TypeError("Expected `limit` to be a finite number");if(e<=0)throw new TypeError("Expected `limit` to be greater than 0");if(!Number.isFinite(t))throw new TypeError("Expected `interval` to be a finite number");return async function*(){let n,i=0;for await(const o of r){if(i0&&await w(s),n=Date.now(),i=1,yield o}}()}function _(e,t){let r=e[0]+t[0],n=e[1]+t[1];if(n>=1e9){const e=n%1e9;r+=(n-e)/1e9,n=e}return[r,n]}function S(e,t,r){const n=o(r),i=[],a=[];let c=!1,u=!1,f=0,l=null;function h(){for(;a.length>0&&i.length>0;){const{resolve:e}=a.shift();e({done:!1,value:i.shift()})}for(;a.length>0&&0===f&&c;){const{resolve:e,reject:t}=a.shift();l?(t(l),l=null):e({done:!0,value:void 0})}}async function d(){if(c)h();else if(!(u||f+i.length>=e)){u=!0,f++;try{const{done:e,value:r}=await n.next();e?(c=!0,f--,h()):async function(e){try{const r=await t(e);i.push(r)}catch(e){c=!0,l=e}f--,h(),d()}(r)}catch(e){c=!0,f--,l=e,h()}u=!1,d()}}const p={next:async function(){if(0===i.length){const e=s();return a.push(e),d(),e.promise}const e=i.shift();return d(),{done:!1,value:e}},[Symbol.asyncIterator]:()=>p};return p}async function A(e,t){let r=null,n=null,i=null;const o=e=>{r=e,n&&n(e)},s=()=>{i&&i()};e.once("error",o);for await(const o of t)if(!1===e.write(o)&&await new Promise(((t,o)=>{if(r)return o(r);e.once("drain",s),i=t,n=o})),r)break;if(e.removeListener("error",o),e.removeListener("drain",s),r)throw r}e.batch=t,e.batchWithTimeout=function e(r,n,o){return void 0===o?t=>e(r,n,t):o[Symbol.asyncIterator]&&n!==1/0?i(r,n,o):t(r,o)},e.buffer=c,e.collect=function(e){return e[Symbol.asyncIterator]?async function(e){const t=[];for await(const r of e)t.push(r);return t}(e):Array.from(e)},e.concat=function(...e){return e.find((e=>void 0!==e[Symbol.asyncIterator]))?async function*(e){for await(const t of e)yield*t}(e):function*(e){for(const t of e)yield*t}(e)},e.consume=function(e){if(e[Symbol.asyncIterator])return async function(e){for await(const t of e);}(e);for(const t of e);},e.filter=f,e.flatMap=function e(t,r){return void 0===r?r=>e(t,r):f((e=>null!=e),l(d(t,r)))},e.flatTransform=function e(t,r,n){return void 0===r?(r,n)=>n?e(t,r,n):e(t,r):void 0===n?n=>e(t,r,n):f((e=>null!=e),l(p(t,r,n)))},e.flatten=l,e.fromStream=function(e){return"function"==typeof e[Symbol.asyncIterator]?e:async function*(e){for(;;){const t=e.read();if(null===t){if(e._readableState.ended)break;await y(e)}else yield t}}(e)},e.getIterator=o,e.map=d,e.merge=async function*(...e){const t=new Set(e.map(o));for(;t.size>0;)for(const e of t){const r=await e.next();r.done?t.delete(e):yield r.value}},e.parallelFlatMap=function e(t,r,n){return void 0===r?(r,n)=>n?e(t,r,n):e(t,r):void 0===n?n=>e(t,r,n):f((e=>null!=e),l(b(t,r,n)))},e.parallelMap=b,e.parallelMerge=async function*(...e){const t=e.map(o),r=new Set,n=new Map;let i=null,s=null,a=null;const c=e=>{i=e,s&&s(e)},u=e=>{a&&a(e)},f=e=>{const t=Promise.resolve(e.next()).then((async({done:i,value:o})=>{i||n.set(e,o),r.delete(t)}));r.add(t),t.then(u,c)};for(const e of t)f(e);for(;;){if(0===r.size&&0===n.size)return;await new Promise(((e,t)=>{if(i&&t(i),n.size>0)return e();a=e,s=t}));for(const[e,t]of n)n.delete(e),yield t,f(e)}},e.pipeline=g,e.reduce=function e(t,r,n){return void 0===r?(r,n)=>n?m(t,r,n):e(t,r):void 0===n?n=>e(t,r,n):m(t,r,n)},e.take=function e(t,r){return void 0===r?r=>e(t,r):r[Symbol.asyncIterator]?async function*(e,t){let r=0;for await(const n of t)if(yield await n,r++,r>=e)break}(t,r):function*(e,t){let r=0;for(const n of t)if(yield n,r++,r>=e)break}(t,r)},e.tap=function(e,t){return void 0===t?t=>v(e,t):v(e,t)},e.throttle=function(e,t,r){return void 0===r?r=>E(e,t,r):E(e,t,r)},e.time=function e(t={},r){return void 0===r?r=>e(t,r):void 0!==r[Symbol.asyncIterator]?async function*(e,t){const r=t[Symbol.asyncIterator]();let i=[0,0];for(;;){const t=n.hrtime(),{value:o,done:s}=await r.next(),a=n.hrtime(t);if(i=_(i,a),e.progress&&e.progress(a,i),s)return e.total&&e.total(i),o;yield o}}(t,r):function*(e,t){const r=t[Symbol.iterator]();let i=[0,0];for(;;){const t=n.hrtime(),{value:o,done:s}=r.next(),a=n.hrtime(t);if(i=_(i,a),e.progress&&e.progress(a,i),s)return e.total&&e.total(i),o;yield o}}(t,r)},e.transform=function e(t,r,n){return void 0===r?(r,n)=>n?e(t,r,n):e(t,r):void 0===n?n=>e(t,r,n):S(t,r,n)},e.writeToStream=function(e,t){return void 0===t?t=>A(e,t):A(e,t)},Object.defineProperty(e,"__esModule",{value:!0})}(t)},98548:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>b});var n=r(93379),i=r.n(n),o=r(7795),s=r.n(o),a=r(90569),c=r.n(a),u=r(3565),f=r.n(u),l=r(19216),h=r.n(l),d=r(44589),p=r.n(d),y=r(51424),g={};g.styleTagTransform=p(),g.setAttributes=f(),g.insert=c().bind(null,"head"),g.domAPI=s(),g.insertStyleElement=h(),i()(y.Z,g);const b=y.Z&&y.Z.locals?y.Z.locals:void 0},93379:e=>{"use strict";var t=[];function r(e){for(var r=-1,n=0;n{"use strict";var t={};e.exports=function(e,r){var n=function(e){if(void 0===t[e]){var r=document.querySelector(e);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(e){r=null}t[e]=r}return t[e]}(e);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");n.appendChild(r)}},19216:e=>{"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},3565:(e,t,r)=>{"use strict";e.exports=function(e){var t=r.nc;t&&e.setAttribute("nonce",t)}},7795:e=>{"use strict";e.exports=function(e){var t=e.insertStyleElement(e);return{update:function(r){!function(e,t,r){var n="";r.supports&&(n+="@supports (".concat(r.supports,") {")),r.media&&(n+="@media ".concat(r.media," {"));var i=void 0!==r.layer;i&&(n+="@layer".concat(r.layer.length>0?" ".concat(r.layer):""," {")),n+=r.css,i&&(n+="}"),r.media&&(n+="}"),r.supports&&(n+="}");var o=r.sourceMap;o&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),t.styleTagTransform(n,e,t.options)}(t,e,r)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},44589:e=>{"use strict";e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},22467:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.serialize=t.deserialize=t.registerSerializer=void 0;const n=r(37381);let i=n.DefaultSerializer;t.registerSerializer=function(e){i=n.extendSerializer(i,e)},t.deserialize=function(e){return i.deserialize(e)},t.serialize=function(e){return i.serialize(e)}},43734:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.Transfer=t.DefaultSerializer=t.expose=t.registerSerializer=void 0;var o=r(22467);Object.defineProperty(t,"registerSerializer",{enumerable:!0,get:function(){return o.registerSerializer}}),i(r(75063),t);var s=r(11934);Object.defineProperty(t,"expose",{enumerable:!0,get:function(){return s.expose}});var a=r(37381);Object.defineProperty(t,"DefaultSerializer",{enumerable:!0,get:function(){return a.DefaultSerializer}});var c=r(88180);Object.defineProperty(t,"Transfer",{enumerable:!0,get:function(){return c.Transfer}})},14211:(e,t)=>{"use strict";let r;function n(e){return(""+e).replace(/^((?:https?|file|ftp|chrome-extension|moz-extension):\/\/.+)?\/[^/]+(?:\?.*)?$/,"$1")+"/"}Object.defineProperty(t,"__esModule",{value:!0}),t.getBundleURL=t.getBaseURL=void 0,t.getBundleURL=function(){return r||(r=function(){try{throw new Error}catch(e){const t=(""+e.stack).match(/(https?|file|ftp|chrome-extension|moz-extension):\/\/[^)\n]+/g);if(t)return n(t[0])}return"/"}()),r},t.getBaseURL=n},58390:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isWorkerRuntime=t.getWorkerImplementation=t.defaultPoolSize=void 0;const n=r(14211);t.defaultPoolSize="undefined"!=typeof navigator&&navigator.hardwareConcurrency?navigator.hardwareConcurrency:4;const i=e=>/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(e);function o(e){const t=new Blob([e],{type:"application/javascript"});return URL.createObjectURL(t)}let s;t.getWorkerImplementation=function(){return s||(s=function(){if("undefined"==typeof Worker)return class{constructor(){throw Error("No web worker implementation available. You might have tried to spawn a worker within a worker in a browser that doesn't support workers in workers.")}};class e extends Worker{constructor(e,t){var r,s;"string"==typeof e&&t&&t._baseURL?e=new URL(e,t._baseURL):"string"==typeof e&&!i(e)&&n.getBundleURL().match(/^file:\/\//i)&&(e=new URL(e,n.getBundleURL().replace(/\/[^\/]+$/,"/")),(null===(r=null==t?void 0:t.CORSWorkaround)||void 0===r||r)&&(e=o(`importScripts(${JSON.stringify(e)});`))),"string"==typeof e&&i(e)&&(null===(s=null==t?void 0:t.CORSWorkaround)||void 0===s||s)&&(e=o(`importScripts(${JSON.stringify(e)});`)),super(e,t)}}class t extends e{constructor(e,t){super(window.URL.createObjectURL(e),t)}static fromText(e,r){const n=new window.Blob([e],{type:"text/javascript"});return new t(n,r)}}return{blob:t,default:e}}()),s},t.isWorkerRuntime=function(){const e="undefined"!=typeof self&&"undefined"!=typeof Window&&self instanceof Window;return!("undefined"==typeof self||!self.postMessage||e)}},75063:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Worker=t.BlobWorker=t.isWorkerRuntime=t.Thread=t.spawn=t.Pool=void 0;const n=r(58390);Object.defineProperty(t,"isWorkerRuntime",{enumerable:!0,get:function(){return n.isWorkerRuntime}});var i=r(99337);Object.defineProperty(t,"Pool",{enumerable:!0,get:function(){return i.Pool}});var o=r(61264);Object.defineProperty(t,"spawn",{enumerable:!0,get:function(){return o.spawn}});var s=r(54235);Object.defineProperty(t,"Thread",{enumerable:!0,get:function(){return s.Thread}}),t.BlobWorker=n.getWorkerImplementation().blob,t.Worker=n.getWorkerImplementation().default},56891:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.createProxyModule=t.createProxyFunction=void 0;const i=n(r(11227)),o=r(35049),s=r(22467),a=r(62015),c=r(88180),u=r(43229),f=i.default("threads:master:messages");let l=1;function h(e,t){return(...r)=>{const n=l++,{args:i,transferables:h}=function(e){if(0===e.length)return{args:[],transferables:[]};const t=[],r=[];for(const n of e)c.isTransferDescriptor(n)?(t.push(s.serialize(n.send)),r.push(...n.transferables)):t.push(s.serialize(n));return{args:t,transferables:0===r.length?r:(n=r,Array.from(new Set(n)))};var n}(r),d={type:u.MasterMessageType.run,uid:n,method:t,args:i};f("Sending command to run function to worker:",d);try{e.postMessage(d,h)}catch(e){return a.ObservablePromise.from(Promise.reject(e))}return a.ObservablePromise.from(o.multicast(function(e,t){return new o.Observable((r=>{let n;const i=o=>{var a;if(f("Message from worker:",o.data),o.data&&o.data.uid===t)if((a=o.data)&&a.type===u.WorkerMessageType.running)n=o.data.resultType;else if((e=>e&&e.type===u.WorkerMessageType.result)(o.data))"promise"===n?(void 0!==o.data.payload&&r.next(s.deserialize(o.data.payload)),r.complete(),e.removeEventListener("message",i)):(o.data.payload&&r.next(s.deserialize(o.data.payload)),o.data.complete&&(r.complete(),e.removeEventListener("message",i)));else if((e=>e&&e.type===u.WorkerMessageType.error)(o.data)){const t=s.deserialize(o.data.error);r.error(t),e.removeEventListener("message",i)}};return e.addEventListener("message",i),()=>{if("observable"===n||!n){const r={type:u.MasterMessageType.cancel,uid:t};e.postMessage(r)}e.removeEventListener("message",i)}}))}(e,n)))}}t.createProxyFunction=h,t.createProxyModule=function(e,t){const r={};for(const n of t)r[n]=h(e,n);return r}},26774:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.PoolEventType=void 0,(r=t.PoolEventType||(t.PoolEventType={})).initialized="initialized",r.taskCanceled="taskCanceled",r.taskCompleted="taskCompleted",r.taskFailed="taskFailed",r.taskQueued="taskQueued",r.taskQueueDrained="taskQueueDrained",r.taskStart="taskStart",r.terminated="terminated"},99337:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Pool=t.Thread=t.PoolEventType=void 0;const o=i(r(11227)),s=r(35049),a=r(90531),c=r(58390),u=r(26774);Object.defineProperty(t,"PoolEventType",{enumerable:!0,get:function(){return u.PoolEventType}});const f=r(54235);Object.defineProperty(t,"Thread",{enumerable:!0,get:function(){return f.Thread}});let l=1;class h{constructor(e,t){this.eventSubject=new s.Subject,this.initErrors=[],this.isClosing=!1,this.nextTaskID=1,this.taskQueue=[];const r="number"==typeof t?{size:t}:t||{},{size:n=c.defaultPoolSize}=r;var i;this.debug=o.default(`threads:pool:${i=r.name||String(l++),i.replace(/\W/g," ").trim().replace(/\s+/g,"-")}`),this.options=r,this.workers=function(e,t){return function(e){const t=[];for(let r=0;r({init:e(),runningTasks:[]})))}(e,n),this.eventObservable=s.multicast(s.Observable.from(this.eventSubject)),Promise.all(this.workers.map((e=>e.init))).then((()=>this.eventSubject.next({type:u.PoolEventType.initialized,size:this.workers.length})),(e=>{this.debug("Error while initializing pool worker:",e),this.eventSubject.error(e),this.initErrors.push(e)}))}findIdlingWorker(){const{concurrency:e=1}=this.options;return this.workers.find((t=>t.runningTasks.lengthn(this,void 0,void 0,(function*(){yield(0,new Promise((e=>setTimeout(e,0))));try{yield this.runPoolTask(e,t)}finally{e.runningTasks=e.runningTasks.filter((e=>e!==r)),this.isClosing||this.scheduleWork()}})))();e.runningTasks.push(r)}))}scheduleWork(){this.debug("Attempt de-queueing a task in order to run it...");const e=this.findIdlingWorker();if(!e)return;const t=this.taskQueue.shift();if(!t)return this.debug("Task queue is empty"),void this.eventSubject.next({type:u.PoolEventType.taskQueueDrained});this.run(e,t)}taskCompletion(e){return new Promise(((t,r)=>{const n=this.events().subscribe((i=>{i.type===u.PoolEventType.taskCompleted&&i.taskID===e?(n.unsubscribe(),t(i.returnValue)):i.type===u.PoolEventType.taskFailed&&i.taskID===e?(n.unsubscribe(),r(i.error)):i.type===u.PoolEventType.terminated&&(n.unsubscribe(),r(Error("Pool has been terminated before task was run.")))}))}))}settled(e=!1){return n(this,void 0,void 0,(function*(){const t=()=>{return e=this.workers,t=e=>e.runningTasks,e.reduce(((e,r)=>[...e,...t(r)]),[]);var e,t},r=[],n=this.eventObservable.subscribe((e=>{e.type===u.PoolEventType.taskFailed&&r.push(e.error)}));return this.initErrors.length>0?Promise.reject(this.initErrors[0]):e&&0===this.taskQueue.length?(yield a.allSettled(t()),r):(yield new Promise(((e,t)=>{const r=this.eventObservable.subscribe({next(t){t.type===u.PoolEventType.taskQueueDrained&&(r.unsubscribe(),e(void 0))},error:t})})),yield a.allSettled(t()),n.unsubscribe(),r)}))}completed(e=!1){return n(this,void 0,void 0,(function*(){const t=this.settled(e),r=new Promise(((e,r)=>{const n=this.eventObservable.subscribe({next(i){i.type===u.PoolEventType.taskQueueDrained?(n.unsubscribe(),e(t)):i.type===u.PoolEventType.taskFailed&&(n.unsubscribe(),r(i.error))},error:r})})),n=yield Promise.race([t,r]);if(n.length>0)throw n[0]}))}events(){return this.eventObservable}queue(e){const{maxQueuedJobs:t=1/0}=this.options;if(this.isClosing)throw Error("Cannot schedule pool tasks after terminate() has been called.");if(this.initErrors.length>0)throw this.initErrors[0];const r=this.nextTaskID++,n=this.taskCompletion(r);n.catch((e=>{this.debug(`Task #${r} errored:`,e)}));const i={id:r,run:e,cancel:()=>{-1!==this.taskQueue.indexOf(i)&&(this.taskQueue=this.taskQueue.filter((e=>e!==i)),this.eventSubject.next({type:u.PoolEventType.taskCanceled,taskID:i.id}))},then:n.then.bind(n)};if(this.taskQueue.length>=t)throw Error("Maximum number of pool tasks queued. Refusing to queue another one.\nThis usually happens for one of two reasons: We are either at peak workload right now or some tasks just won't finish, thus blocking the pool.");return this.debug(`Queueing task #${i.id}...`),this.taskQueue.push(i),this.eventSubject.next({type:u.PoolEventType.taskQueued,taskID:i.id}),this.scheduleWork(),i}terminate(e){return n(this,void 0,void 0,(function*(){this.isClosing=!0,e||(yield this.completed(!0)),this.eventSubject.next({type:u.PoolEventType.terminated,remainingQueue:[...this.taskQueue]}),this.eventSubject.complete(),yield Promise.all(this.workers.map((e=>n(this,void 0,void 0,(function*(){return f.Thread.terminate(yield e.init)})))))}))}}function d(e,t){return new h(e,t)}h.EventType=u.PoolEventType,d.EventType=u.PoolEventType,t.Pool=d},61264:function(e,t,r){"use strict";var n=r(34155),i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.spawn=void 0;const s=o(r(11227)),a=r(35049),c=r(22467),u=r(53104),f=r(8258),l=r(56356),h=r(56891),d=s.default("threads:master:messages"),p=s.default("threads:master:spawn"),y=s.default("threads:master:thread-utils"),g=void 0!==n&&n.env.THREADS_WORKER_INIT_TIMEOUT?Number.parseInt(n.env.THREADS_WORKER_INIT_TIMEOUT,10):1e4;function b(e,t,r,n){const i=r.filter((e=>e.type===l.WorkerEventType.internalError)).map((e=>e.error));return Object.assign(e,{[f.$errors]:i,[f.$events]:r,[f.$terminate]:n,[f.$worker]:t})}t.spawn=function(e,t){return i(this,void 0,void 0,(function*(){p("Initializing new thread");const r=t&&t.timeout?t.timeout:g,n=yield function(e,t,r){return i(this,void 0,void 0,(function*(){let n;const i=new Promise(((e,i)=>{n=setTimeout((()=>i(Error(r))),t)})),o=yield Promise.race([e,i]);return clearTimeout(n),o}))}(function(e){return new Promise(((t,r)=>{const n=i=>{var o;d("Message from worker before finishing initialization:",i.data),(o=i.data)&&"init"===o.type?(e.removeEventListener("message",n),t(i.data)):(e=>e&&"uncaughtError"===e.type)(i.data)&&(e.removeEventListener("message",n),r(c.deserialize(i.data.error)))};e.addEventListener("message",n)}))}(e),r,`Timeout: Did not receive an init message from worker after ${r}ms. Make sure the worker calls expose().`),o=n.exposed,{termination:s,terminate:f}=function(e){const[t,r]=u.createPromiseWithResolver();return{terminate:()=>i(this,void 0,void 0,(function*(){y("Terminating worker"),yield e.terminate(),r()})),termination:t}}(e),m=function(e,t){return new a.Observable((r=>{const n=e=>{const t={type:l.WorkerEventType.message,data:e.data};r.next(t)},i=e=>{y("Unhandled promise rejection event in thread:",e);const t={type:l.WorkerEventType.internalError,error:Error(e.reason)};r.next(t)};e.addEventListener("message",n),e.addEventListener("unhandledrejection",i),t.then((()=>{const t={type:l.WorkerEventType.termination};e.removeEventListener("message",n),e.removeEventListener("unhandledrejection",i),r.next(t),r.complete()}))}))}(e,s);if("function"===o.type)return b(h.createProxyFunction(e),e,m,f);if("module"===o.type)return b(h.createProxyModule(e,o.methods),e,m,f);{const e=o.type;throw Error(`Worker init message states unexpected type of expose(): ${e}`)}}))}},54235:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Thread=void 0;const n=r(8258);function i(e){throw Error(e)}t.Thread={errors:e=>e[n.$errors]||i("Error observable not found. Make sure to pass a thread instance as returned by the spawn() promise."),events:e=>e[n.$events]||i("Events observable not found. Make sure to pass a thread instance as returned by the spawn() promise."),terminate:e=>e[n.$terminate]()}},62015:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ObservablePromise=void 0;const n=r(35049),i=()=>{},o=e=>e,s=e=>Promise.resolve().then(e);function a(e){throw e}class c extends n.Observable{constructor(e){super((t=>{const r=this,n=Object.assign(Object.assign({},t),{complete(){t.complete(),r.onCompletion()},error(e){t.error(e),r.onError(e)},next(e){t.next(e),r.onNext(e)}});try{return this.initHasRun=!0,e(n)}catch(e){n.error(e)}})),this.initHasRun=!1,this.fulfillmentCallbacks=[],this.rejectionCallbacks=[],this.firstValueSet=!1,this.state="pending"}onNext(e){this.firstValueSet||(this.firstValue=e,this.firstValueSet=!0)}onError(e){this.state="rejected",this.rejection=e;for(const t of this.rejectionCallbacks)s((()=>t(e)))}onCompletion(){this.state="fulfilled";for(const e of this.fulfillmentCallbacks)s((()=>e(this.firstValue)))}then(e,t){const r=e||o,n=t||a;let i=!1;return new Promise(((e,t)=>{const o=r=>{if(!i){i=!0;try{e(n(r))}catch(e){t(e)}}};return this.initHasRun||this.subscribe({error:o}),"fulfilled"===this.state?e(r(this.firstValue)):"rejected"===this.state?(i=!0,e(n(this.rejection))):(this.fulfillmentCallbacks.push((t=>{try{e(r(t))}catch(e){o(e)}})),void this.rejectionCallbacks.push(o))}))}catch(e){return this.then(void 0,e)}finally(e){const t=e||i;return this.then((e=>(t(),e)),(()=>t()))}static from(e){return function(e){return e&&"function"==typeof e.then}(e)?new c((t=>{e.then((e=>{t.next(e),t.complete()}),(e=>{t.error(e)}))})):super.from(e)}}t.ObservablePromise=c},90531:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.allSettled=void 0,t.allSettled=function(e){return Promise.all(e.map((e=>{const t=e=>({status:"fulfilled",value:e}),r=e=>({status:"rejected",reason:e}),n=Promise.resolve(e);try{return n.then(t,r)}catch(e){return Promise.reject(e)}})))}},53104:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createPromiseWithResolver=void 0;const r=()=>{};t.createPromiseWithResolver=function(){let e,t=!1,n=r;return[new Promise((r=>{t?r(e):n=r})),r=>{t=!0,e=r,n(e)}]}},37381:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultSerializer=t.extendSerializer=void 0,t.extendSerializer=function(e,t){const r=e.deserialize.bind(e),n=e.serialize.bind(e);return{deserialize:e=>t.deserialize(e,r),serialize:e=>t.serialize(e,n)}};const r=e=>Object.assign(Error(e.message),{name:e.name,stack:e.stack}),n=e=>({__error_marker:"$$error",message:e.message,name:e.name,stack:e.stack});t.DefaultSerializer={deserialize(e){return(t=e)&&"object"==typeof t&&"__error_marker"in t&&"$$error"===t.__error_marker?r(e):e;var t},serialize:e=>e instanceof Error?n(e):e}},8258:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.$worker=t.$transferable=t.$terminate=t.$events=t.$errors=void 0,t.$errors=Symbol("thread.errors"),t.$events=Symbol("thread.events"),t.$terminate=Symbol("thread.terminate"),t.$transferable=Symbol("thread.transferable"),t.$worker=Symbol("thread.worker")},88180:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Transfer=t.isTransferDescriptor=void 0;const n=r(8258);t.isTransferDescriptor=function(e){return e&&"object"==typeof e&&e[n.$transferable]},t.Transfer=function(e,t){if(!t){if(!(r=e)||"object"!=typeof r)throw Error();t=[e]}var r;return{[n.$transferable]:!0,send:e,transferables:t}}},56356:(e,t,r)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.WorkerEventType=void 0,r(8258),(n=t.WorkerEventType||(t.WorkerEventType={})).internalError="internalError",n.message="message",n.termination="termination"},43229:(e,t)=>{"use strict";var r,n;Object.defineProperty(t,"__esModule",{value:!0}),t.WorkerMessageType=t.MasterMessageType=void 0,(n=t.MasterMessageType||(t.MasterMessageType={})).cancel="cancel",n.run="run",(r=t.WorkerMessageType||(t.WorkerMessageType={})).error="error",r.init="init",r.result="result",r.running="running",r.uncaughtError="uncaughtError"},3447:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={isWorkerRuntime:function(){const e="undefined"!=typeof self&&"undefined"!=typeof Window&&self instanceof Window;return!("undefined"==typeof self||!self.postMessage||e)},postMessageToMaster:function(e,t){self.postMessage(e,t)},subscribeToMasterMessages:function(e){const t=t=>{e(t.data)};return self.addEventListener("message",t),()=>{self.removeEventListener("message",t)}}}},11934:function(e,t,r){"use strict";var n=r(34155),i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.expose=t.isWorkerRuntime=t.Transfer=t.registerSerializer=void 0;const s=o(r(6898)),a=r(22467),c=r(88180),u=r(43229),f=o(r(3447));var l=r(22467);Object.defineProperty(t,"registerSerializer",{enumerable:!0,get:function(){return l.registerSerializer}});var h=r(88180);Object.defineProperty(t,"Transfer",{enumerable:!0,get:function(){return h.Transfer}}),t.isWorkerRuntime=f.default.isWorkerRuntime;let d=!1;const p=new Map,y=e=>e&&e.type===u.MasterMessageType.run,g=e=>s.default(e)||function(e){return e&&"object"==typeof e&&"function"==typeof e.subscribe}(e);function b(e){return c.isTransferDescriptor(e)?{payload:e.send,transferables:e.transferables}:{payload:e,transferables:void 0}}function m(e,t){const{payload:r,transferables:n}=b(t),i={type:u.WorkerMessageType.error,uid:e,error:a.serialize(r)};f.default.postMessageToMaster(i,n)}function v(e,t,r){const{payload:n,transferables:i}=b(r),o={type:u.WorkerMessageType.result,uid:e,complete:!!t||void 0,payload:n};f.default.postMessageToMaster(o,i)}function w(e){try{const t={type:u.WorkerMessageType.uncaughtError,error:a.serialize(e)};f.default.postMessageToMaster(t)}catch(t){console.error("Not reporting uncaught error back to master thread as it occured while reporting an uncaught error already.\nLatest error:",t,"\nOriginal error:",e)}}function E(e,t,r){return i(this,void 0,void 0,(function*(){let n;try{n=t(...r)}catch(t){return m(e,t)}const i=g(n)?"observable":"promise";if(function(e,t){const r={type:u.WorkerMessageType.running,uid:e,resultType:t};f.default.postMessageToMaster(r)}(e,i),g(n)){const t=n.subscribe((t=>v(e,!1,a.serialize(t))),(t=>{m(e,a.serialize(t)),p.delete(e)}),(()=>{v(e,!0),p.delete(e)}));p.set(e,t)}else try{const t=yield n;v(e,!0,a.serialize(t))}catch(t){m(e,a.serialize(t))}}))}t.expose=function(e){if(!f.default.isWorkerRuntime())throw Error("expose() called in the master thread.");if(d)throw Error("expose() called more than once. This is not possible. Pass an object to expose() if you want to expose multiple functions.");if(d=!0,"function"==typeof e)f.default.subscribeToMasterMessages((t=>{y(t)&&!t.method&&E(t.uid,e,t.args.map(a.deserialize))})),function(){const e={type:u.WorkerMessageType.init,exposed:{type:"function"}};f.default.postMessageToMaster(e)}();else{if("object"!=typeof e||!e)throw Error(`Invalid argument passed to expose(). Expected a function or an object, got: ${e}`);f.default.subscribeToMasterMessages((t=>{y(t)&&t.method&&E(t.uid,e[t.method],t.args.map(a.deserialize))})),function(e){const t={type:u.WorkerMessageType.init,exposed:{type:"module",methods:e}};f.default.postMessageToMaster(t)}(Object.keys(e).filter((t=>"function"==typeof e[t])))}f.default.subscribeToMasterMessages((e=>{if((t=e)&&t.type===u.MasterMessageType.cancel){const t=e.uid,r=p.get(t);r&&(r.unsubscribe(),p.delete(t))}var t}))},"undefined"!=typeof self&&"function"==typeof self.addEventListener&&f.default.isWorkerRuntime()&&(self.addEventListener("error",(e=>{setTimeout((()=>w(e.error||e)),250)})),self.addEventListener("unhandledrejection",(e=>{const t=e.reason;t&&"string"==typeof t.message&&setTimeout((()=>w(t)),250)}))),void 0!==n&&"function"==typeof n.on&&f.default.isWorkerRuntime()&&(n.on("uncaughtException",(e=>{setTimeout((()=>w(e)),250)})),n.on("unhandledRejection",(e=>{e&&"string"==typeof e.message&&setTimeout((()=>w(e)),250)})))},10715:(e,t,r)=>{"use strict";const{AbortController:n}="undefined"!=typeof self?self:"undefined"!=typeof window?window:r(28599),i=r(9539);class o extends n{constructor(e){super(),this._ms=e,this._timer=i((()=>this.abort()),e),Object.setPrototypeOf(this,o.prototype)}abort(){return this._timer.clear(),super.abort()}clear(){this._timer.clear()}reset(){this._timer.clear(),this._timer=i((()=>this.abort()),this._ms)}}e.exports=o,e.exports.TimeoutController=o},9539:(e,t,r)=>{"use strict";var n=r(41283);function i(e,t,r){var i=this;this._started=n(),this._rescheduled=0,this._scheduled=t,this._args=r,this._timer=setTimeout((function t(){i._rescheduled>0?(i._scheduled=i._rescheduled-(n()-i._started),i._timer=setTimeout(t,i._scheduled),i._rescheduled=0):e.apply(null,i._args)}),t)}i.prototype.reschedule=function(e){var t=n();return!(t+e-(this._started+this._scheduled)<0||(this._started=t,this._rescheduled=e,0))},i.prototype.clear=function(){clearTimeout(this._timer)},e.exports=function(){if("function"!=typeof arguments[0])throw new Error("callback needed");if("number"!=typeof arguments[1])throw new Error("timeout needed");var e;if(arguments.length>0){e=new Array(arguments.length-2);for(var t=0;t{"use strict";e.exports=function(){return Date.now()}},63700:(e,t,r)=>{"use strict";var n=r(71156),i=r(90793);e.exports=n.bind(null,i)},71156:e=>{"use strict";function t(e){return e>=55296&&e<=56319}function r(e){return e>=56320&&e<=57343}e.exports=function(e,n,i){if("string"!=typeof n)throw new Error("Input must be string");for(var o,s,a=n.length,c=0,u=0;ui)return n.slice(0,u-s.length+1)}return n}},4257:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.discoverAndNotify=t.createMyRoute=t.registerDiscoveryService=void 0;var n=r(90281);t.registerDiscoveryService=function(){for(var e=[],t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(11189);t.default=new n.AvmRunnerBackground({method:"fetch-from-url",baseUrl:"https://fluence.one/registry-demo/",filePaths:{avm:"avm.wasm",marine:"marine-js.wasm"}})},63607:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(e){o(e)}}function a(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,n=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]\n \n\t\t\t'),(r=document.createElement("li")).innerHTML=t,[2,r]}))}))})),[4,Promise.all(t)];case 1:for(r=h.sent(),null==(o=document.getElementById("user-list"))||o.replaceChildren.apply(o,r),s=0,a=e;s{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.instanceOf=t.select=t.not=t.when=void 0;const n=r(98149);t.when=e=>({[n.PatternKind]:n.Guard,[n.Guard]:e}),t.not=e=>({[n.PatternKind]:n.Not,[n.Not]:e}),t.select=function(e){return void 0===e?{[n.PatternKind]:n.Select,[n.Select]:n.AnonymousSelectKey}:{[n.PatternKind]:n.Select,[n.Select]:e}},t.instanceOf=e=>(0,t.when)(function(e){return t=>t instanceof e}(e))},16176:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isMatching=t.match=t.instanceOf=t.select=t.not=t.when=t.__=void 0;const n=r(98149),i=r(29840);Object.defineProperty(t,"when",{enumerable:!0,get:function(){return i.when}}),Object.defineProperty(t,"not",{enumerable:!0,get:function(){return i.not}}),Object.defineProperty(t,"select",{enumerable:!0,get:function(){return i.select}}),Object.defineProperty(t,"instanceOf",{enumerable:!0,get:function(){return i.instanceOf}});const o=r(71586);Object.defineProperty(t,"__",{enumerable:!0,get:function(){return o.__}}),t.match=e=>s(e,[]);const s=(e,t)=>{const r=()=>{const r=t.find((({test:t})=>t(e)));if(!r){let t;try{t=JSON.stringify(e)}catch(r){t=e}throw new Error(`Pattern matching error: no pattern matches value ${t}`)}return r.handler(r.select(e),e)};return{with(...r){const i=r[r.length-1],o=[],a=[];for(let e=0;eBoolean(o.some((t=>c(t,e,((e,t)=>{u[e]=t}))))&&a.every((t=>t(e)))),handler:i,select:e=>Object.keys(u).length?n.AnonymousSelectKey in u?u[n.AnonymousSelectKey]:u:e}]))},when:(r,n)=>s(e,t.concat([{test:r,handler:n,select:e=>e}])),otherwise:r=>s(e,t.concat([{test:()=>!0,handler:r,select:e=>e}])).run(),exhaustive:()=>r(),run:r}},a=e=>Boolean(e&&"object"==typeof e),c=(e,t,r)=>{if(a(e)){if((i=e)&&i[n.PatternKind]===n.Guard)return Boolean(e[n.Guard](t));if((e=>e&&e[n.PatternKind]===n.Select)(e))return r(e[n.Select],t),!0;if((e=>e&&e[n.PatternKind]===n.Not)(e))return!c(e[n.Not],t,r);if(!a(t))return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;if(1===e.length){const n={},i=(e,t)=>{n[e]=(n[e]||[]).concat([t])},o=t.every((t=>c(e[0],t,i)));return o&&Object.keys(n).forEach((e=>r(e,n[e]))),o}return e.length===t.length&&e.every(((e,n)=>c(e,t[n],r)))}if(e instanceof Map)return t instanceof Map&&[...e.keys()].every((n=>c(e.get(n),t.get(n),r)));if(e instanceof Set){if(!(t instanceof Set))return!1;if(0===e.size)return 0===t.size;if(1===e.size){const[n]=[...e.values()];return Object.values(o.__).includes(n)?c([n],[...t.values()],r):t.has(n)}return[...e.values()].every((e=>t.has(e)))}return Object.keys(e).every((n=>n in t&&c(e[n],t[n],r)))}var i;return t===e};t.isMatching=function(...e){if(1===e.length){const[t]=e;return e=>c(t,e,(()=>{}))}if(2===e.length){const[t,r]=e;return c(t,r,(()=>{}))}throw new Error(`isMatching wasn't given enough arguments: expected 1 or 2, received ${e.length}.`)}},98149:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AnonymousSelectKey=t.Select=t.Not=t.Guard=t.PatternKind=void 0,t.PatternKind=Symbol("@ts-pattern/pattern-kind"),t.Guard=Symbol("@ts-pattern/guard"),t.Not=Symbol("@ts-pattern/not"),t.Select=Symbol("@ts-pattern/select"),t.AnonymousSelectKey="@ts-pattern/__anonymous-select-key"},71586:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.__=void 0;const n=r(29840),i=(0,n.when)((function(e){return!0})),o=(0,n.when)((function(e){return"string"==typeof e})),s=(0,n.when)((function(e){return"number"==typeof e})),a=(0,n.when)((function(e){return Number.isNaN(e)})),c=(0,n.when)((function(e){return"boolean"==typeof e})),u=(0,n.when)((function(e){return null==e}));t.__=Object.assign(i,{string:o,number:s,NaN:a,boolean:c,nullish:u})},90793:e=>{"use strict";function t(e){return e>=55296&&e<=56319}function r(e){return e>=56320&&e<=57343}e.exports=function(e){if("string"!=typeof e)throw new Error("Input must be string");for(var n=e.length,i=0,o=null,s=null,a=0;a=128&&o<=2047?i+=2:o>=2048&&o<=65535&&(i+=3),s=o;return i}},21614:(e,t,r)=>{"use strict";r.r(t),r.d(t,{NIL:()=>k,parse:()=>g,stringify:()=>f,v1:()=>y,v3:()=>T,v4:()=>I,v5:()=>R,validate:()=>a,version:()=>B});var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),i=new Uint8Array(16);function o(){if(!n)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return n(i)}const s=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,a=function(e){return"string"==typeof e&&s.test(e)};for(var c=[],u=0;u<256;++u)c.push((u+256).toString(16).substr(1));const f=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(c[e[t+0]]+c[e[t+1]]+c[e[t+2]]+c[e[t+3]]+"-"+c[e[t+4]]+c[e[t+5]]+"-"+c[e[t+6]]+c[e[t+7]]+"-"+c[e[t+8]]+c[e[t+9]]+"-"+c[e[t+10]]+c[e[t+11]]+c[e[t+12]]+c[e[t+13]]+c[e[t+14]]+c[e[t+15]]).toLowerCase();if(!a(r))throw TypeError("Stringified UUID is invalid");return r};var l,h,d=0,p=0;const y=function(e,t,r){var n=t&&r||0,i=t||new Array(16),s=(e=e||{}).node||l,a=void 0!==e.clockseq?e.clockseq:h;if(null==s||null==a){var c=e.random||(e.rng||o)();null==s&&(s=l=[1|c[0],c[1],c[2],c[3],c[4],c[5]]),null==a&&(a=h=16383&(c[6]<<8|c[7]))}var u=void 0!==e.msecs?e.msecs:Date.now(),y=void 0!==e.nsecs?e.nsecs:p+1,g=u-d+(y-p)/1e4;if(g<0&&void 0===e.clockseq&&(a=a+1&16383),(g<0||u>d)&&void 0===e.nsecs&&(y=0),y>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");d=u,p=y,h=a;var b=(1e4*(268435455&(u+=122192928e5))+y)%4294967296;i[n++]=b>>>24&255,i[n++]=b>>>16&255,i[n++]=b>>>8&255,i[n++]=255&b;var m=u/4294967296*1e4&268435455;i[n++]=m>>>8&255,i[n++]=255&m,i[n++]=m>>>24&15|16,i[n++]=m>>>16&255,i[n++]=a>>>8|128,i[n++]=255&a;for(var v=0;v<6;++v)i[n+v]=s[v];return t||f(i)},g=function(e){if(!a(e))throw TypeError("Invalid UUID");var t,r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=255&t,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=255&t,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=255&t,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=255&t,r};function b(e,t,r){function n(e,n,i,o){if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));for(var t=[],r=0;r>>9<<4)+1}function v(e,t){var r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function w(e,t,r,n,i,o){return v((s=v(v(t,e),v(n,o)))<<(a=i)|s>>>32-a,r);var s,a}function E(e,t,r,n,i,o,s){return w(t&r|~t&n,e,t,i,o,s)}function _(e,t,r,n,i,o,s){return w(t&n|r&~n,e,t,i,o,s)}function S(e,t,r,n,i,o,s){return w(t^r^n,e,t,i,o,s)}function A(e,t,r,n,i,o,s){return w(r^(t|~n),e,t,i,o,s)}const T=b("v3",48,(function(e){if("string"==typeof e){var t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(var r=0;r>5]>>>i%32&255,s=parseInt(n.charAt(o>>>4&15)+n.charAt(15&o),16);t.push(s)}return t}(function(e,t){e[t>>5]|=128<>5]|=(255&e[n/8])<>>32-t}const R=b("v5",80,(function(e){var t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){var n=unescape(encodeURIComponent(e));e=[];for(var i=0;i>>0;v=m,m=b,b=P(g,30)>>>0,g=y,y=_}r[0]=r[0]+y>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+b>>>0,r[3]=r[3]+m>>>0,r[4]=r[4]+v>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,255&r[0],r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,255&r[1],r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,255&r[2],r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,255&r[3],r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,255&r[4]]})),k="00000000-0000-0000-0000-000000000000",B=function(e){if(!a(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)}},26988:e=>{e.exports=function e(t,r){var n,i=0,o=0,s=r=r||0,a=t.length;do{if(s>=a)throw e.bytes=0,new RangeError("Could not decode varint");n=t[s++],i+=o<28?(127&n)<=128);return e.bytes=s-r,i}},1312:e=>{e.exports=function e(r,n,i){n=n||[];for(var o=i=i||0;r>=t;)n[i++]=255&r|128,r/=128;for(;-128&r;)n[i++]=255&r|128,r>>>=7;return n[i]=0|r,e.bytes=i-o+1,n};var t=Math.pow(2,31)},94676:(e,t,r)=>{e.exports={encode:r(1312),decode:r(26988),encodingLength:r(10082)}},10082:e=>{var t=Math.pow(2,7),r=Math.pow(2,14),n=Math.pow(2,21),i=Math.pow(2,28),o=Math.pow(2,35),s=Math.pow(2,42),a=Math.pow(2,49),c=Math.pow(2,56),u=Math.pow(2,63);e.exports=function(e){return e{"use strict";var n=r(34155);const i=r(59134),o="object"==typeof window&&"object"==typeof document&&9===document.nodeType,s=i(),a=o&&!s,c=s&&!o,u=s&&o,f=void 0!==n&&void 0!==n.release&&"node"===n.release.name&&!s,l="function"==typeof importScripts&&"undefined"!=typeof self&&"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,h=void 0!==n&&void 0!==n.env&&!1;e.exports={isTest:h,isElectron:s,isElectronMain:c,isElectronRenderer:u,isNode:f,isBrowser:a,isWebWorker:l,isEnvWithDom:o}},35883:()=>{},46601:()=>{},89214:()=>{},5696:()=>{},89408:()=>{},57600:()=>{},39370:()=>{},25819:()=>{},82233:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Key:()=>c});var n=r(92263),i=r(52217);const o="/",s=(new TextEncoder).encode(o),a=s[0];class c{constructor(e,t){if("string"==typeof e)this._buf=(0,i.fromString)(e);else{if(!(e instanceof Uint8Array))throw new Error("Invalid key, should be String of Uint8Array");this._buf=e}if(null==t&&(t=!0),t&&this.clean(),0===this._buf.byteLength||this._buf[0]!==a)throw new Error("Invalid key")}toString(e="utf8"){return(0,n.toString)(this._buf,e)}uint8Array(){return this._buf}get[Symbol.toStringTag](){return`Key(${this.toString()})`}static withNamespaces(e){return new c(e.join(o))}static random(){return new c(((e=21)=>{let t="",r=crypto.getRandomValues(new Uint8Array(e));for(;e--;){let n=63&r[e];t+=n<36?n.toString(36):n<62?(n-26).toString(36).toUpperCase():n<63?"_":"-"}return t})().replace(/-/g,""))}static asKey(e){return e instanceof Uint8Array||"string"==typeof e?new c(e):e.uint8Array?new c(e.uint8Array()):null}clean(){if(this._buf&&0!==this._buf.byteLength||(this._buf=s),this._buf[0]!==a){const e=new Uint8Array(this._buf.byteLength+1);e.fill(a,0,1),e.set(this._buf,1),this._buf=e}for(;this._buf.byteLength>1&&this._buf[this._buf.byteLength-1]===a;)this._buf=this._buf.subarray(0,-1)}less(e){const t=this.list(),r=e.list();for(let e=0;ei)return!1}return t.lengthe.namespaces())),[].concat(...t))]);var t}}},89880:(e,t,r)=>{"use strict";r.d(t,{kU:()=>f,Dp:()=>u,ET:()=>l});var n=r(95934);class i{constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class o{constructor(e,t,r){this.name=e,this.prefix=t,this.baseDecode=r}decode(e){if("string"==typeof e){if(e[0]===this.prefix)return this.baseDecode(e.slice(1));throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`)}throw Error("Can only multibase decode strings")}or(e){return a(this,e)}}class s{constructor(e){this.decoders=e}or(e){return a(this,e)}decode(e){const t=e[0],r=this.decoders[t];if(r)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const a=(e,t)=>new s({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class c{constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new i(e,t,r),this.decoder=new o(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const u=({name:e,prefix:t,encode:r,decode:n})=>new c(e,t,r,n),f=({prefix:e,name:t,alphabet:r})=>{const{encode:i,decode:o}=function(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,s=new Uint8Array(o);e[t];){var f=r[e.charCodeAt(t)];if(255===f)return;for(var l=0,h=o-1;(0!==f||l>>0,s[h]=f%256>>>0,f=f/256>>>0;if(0!==f)throw new Error("Non-zero carry");i=l,t++}if(" "!==e[t]){for(var d=o-i;d!==o&&0===s[d];)d++;for(var p=new Uint8Array(n+(o-d)),y=n;d!==o;)p[y++]=s[d++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,i=0,o=t.length;i!==o&&0===t[i];)i++,r++;for(var s=(o-i)*f+1>>>0,u=new Uint8Array(s);i!==o;){for(var l=t[i],h=0,d=s-1;(0!==l||h>>0,u[d]=l%a>>>0,l=l/a>>>0;if(0!==l)throw new Error("Non-zero carry");n=h,i++}for(var p=s-n;p!==s&&0===u[p];)p++;for(var y=c.repeat(r);p(0,n.oQ)(o(e))})},l=({name:e,prefix:t,bitsPerChar:r,alphabet:n})=>u({prefix:t,name:e,encode:e=>((e,t,r)=>{const n="="===t[t.length-1],i=(1<r;)s-=r,o+=t[i&a>>s];if(s&&(o+=t[i&a<((e,t,r,n)=>{const i={};for(let e=0;e=8&&(a-=8,s[u++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return s})(t,n,r,e)})},84835:(e,t,r)=>{"use strict";r.r(t),r.d(t,{base16:()=>i,base16upper:()=>o});var n=r(89880);const i=(0,n.ET)({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),o=(0,n.ET)({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})},22817:(e,t,r)=>{"use strict";r.r(t),r.d(t,{base32:()=>i,base32upper:()=>o,base32pad:()=>s,base32padupper:()=>a,base32hex:()=>c,base32hexupper:()=>u,base32hexpad:()=>f,base32hexpadupper:()=>l,base32z:()=>h});var n=r(89880);const i=(0,n.ET)({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),o=(0,n.ET)({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),s=(0,n.ET)({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),a=(0,n.ET)({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),c=(0,n.ET)({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),u=(0,n.ET)({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),f=(0,n.ET)({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),l=(0,n.ET)({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),h=(0,n.ET)({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})},98441:(e,t,r)=>{"use strict";r.r(t),r.d(t,{base36:()=>i,base36upper:()=>o});var n=r(89880);const i=(0,n.kU)({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),o=(0,n.kU)({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})},99086:(e,t,r)=>{"use strict";r.r(t),r.d(t,{base58btc:()=>i,base58flickr:()=>o});var n=r(89880);const i=(0,n.kU)({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),o=(0,n.kU)({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})},9885:(e,t,r)=>{"use strict";r.r(t),r.d(t,{base64:()=>i,base64pad:()=>o,base64url:()=>s,base64urlpad:()=>a});var n=r(89880);const i=(0,n.ET)({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),o=(0,n.ET)({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),s=(0,n.ET)({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),a=(0,n.ET)({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})},95934:(e,t,r)=>{"use strict";r.d(t,{fS:()=>n,oQ:()=>i,mL:()=>o,BB:()=>s}),new Uint8Array(0);const n=(e,t)=>{if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")},o=e=>(new TextEncoder).encode(e),s=e=>(new TextDecoder).decode(e)},81362:(e,t,r)=>{"use strict";r.r(t),r.d(t,{CID:()=>c});var n=r(4714),i=r(28924),o=r(99086),s=r(22817),a=r(95934);class c{constructor(e,t,r,n){this.code=t,this.version=e,this.multihash=r,this.bytes=n,this.byteOffset=n.byteOffset,this.byteLength=n.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:b,byteLength:b,code:g,version:g,multihash:g,bytes:g,_baseCache:b,asCID:b})}toV0(){if(0===this.version)return this;{const{code:e,multihash:t}=this;if(e!==h)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==d)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return c.createV0(t)}}toV1(){switch(this.version){case 0:{const{code:e,digest:t}=this.multihash,r=i.create(e,t);return c.createV1(this.code,r)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}equals(e){return e&&this.code===e.code&&this.version===e.version&&i.equals(this.multihash,e.multihash)}toString(e){const{bytes:t,version:r,_baseCache:n}=this;return 0===r?f(t,n,e||o.base58btc.encoder):l(t,n,e||s.base32.encoder)}toJSON(){return{code:this.code,version:this.version,hash:this.multihash.bytes}}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return"CID("+this.toString()+")"}static isCID(e){return m(/^0\.0/,v),!(!e||!e[y]&&e.asCID!==e)}get toBaseEncodedString(){throw new Error("Deprecated, use .toString()")}get codec(){throw new Error('"codec" property is deprecated, use integer "code" property instead')}get buffer(){throw new Error("Deprecated .buffer property, use .bytes to get Uint8Array instead")}get multibaseName(){throw new Error('"multibaseName" property is deprecated')}get prefix(){throw new Error('"prefix" property is deprecated')}static asCID(e){if(e instanceof c)return e;if(null!=e&&e.asCID===e){const{version:t,code:r,multihash:n,bytes:i}=e;return new c(t,r,n,i||p(t,r,n.bytes))}if(null!=e&&!0===e[y]){const{version:t,multihash:r,code:n}=e,o=i.decode(r);return c.create(t,n,o)}return null}static create(e,t,r){if("number"!=typeof t)throw new Error("String codecs are no longer supported");switch(e){case 0:if(t!==h)throw new Error(`Version 0 CID must use dag-pb (code: ${h}) block encoding`);return new c(e,t,r,r.bytes);case 1:{const n=p(e,t,r.bytes);return new c(e,t,r,n)}default:throw new Error("Invalid version")}}static createV0(e){return c.create(0,h,e)}static createV1(e,t){return c.create(1,e,t)}static decode(e){const[t,r]=c.decodeFirst(e);if(r.length)throw new Error("Incorrect length");return t}static decodeFirst(e){const t=c.inspectBytes(e),r=t.size-t.multihashSize,n=(0,a.oQ)(e.subarray(r,r+t.multihashSize));if(n.byteLength!==t.multihashSize)throw new Error("Incorrect length");const o=n.subarray(t.multihashSize-t.digestSize),s=new i.Digest(t.multihashCode,t.digestSize,o,n);return[0===t.version?c.createV0(s):c.createV1(t.codec,s),e.subarray(t.size)]}static inspectBytes(e){let t=0;const r=()=>{const[r,i]=n.Jx(e.subarray(t));return t+=i,r};let i=r(),o=h;if(18===i?(i=0,t=0):1===i&&(o=r()),0!==i&&1!==i)throw new RangeError(`Invalid CID version ${i}`);const s=t,a=r(),c=r(),u=t+c;return{version:i,codec:o,multihashCode:a,digestSize:c,multihashSize:u-s,size:u}}static parse(e,t){const[r,n]=u(e,t),i=c.decode(n);return i._baseCache.set(r,e),i}}const u=(e,t)=>{switch(e[0]){case"Q":{const r=t||o.base58btc;return[o.base58btc.prefix,r.decode(`${o.base58btc.prefix}${e}`)]}case o.base58btc.prefix:{const r=t||o.base58btc;return[o.base58btc.prefix,r.decode(e)]}case s.base32.prefix:{const r=t||s.base32;return[s.base32.prefix,r.decode(e)]}default:if(null==t)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}},f=(e,t,r)=>{const{prefix:n}=r;if(n!==o.base58btc.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);const i=t.get(n);if(null==i){const i=r.encode(e).slice(1);return t.set(n,i),i}return i},l=(e,t,r)=>{const{prefix:n}=r,i=t.get(n);if(null==i){const i=r.encode(e);return t.set(n,i),i}return i},h=112,d=18,p=(e,t,r)=>{const i=n.P$(e),o=i+n.P$(t),s=new Uint8Array(o+r.byteLength);return n.mL(e,s,0),n.mL(t,s,i),s.set(r,o),s},y=Symbol.for("@ipld/js-cid/CID"),g={writable:!1,configurable:!1,enumerable:!0},b={writable:!1,enumerable:!1,configurable:!1},m=(e,t)=>{if(!e.test("0.0.0-dev"))throw new Error(t);console.warn(t)},v="CID.isCID(v) is deprecated and will be removed in the next major release.\nFollowing code pattern:\n\nif (CID.isCID(value)) {\n doSomethingWithCID(value)\n}\n\nIs replaced with:\n\nconst cid = CID.asCID(value)\nif (cid) {\n // Make sure to use cid instead of value\n doSomethingWithCID(cid)\n}\n"},28924:(e,t,r)=>{"use strict";r.r(t),r.d(t,{create:()=>o,decode:()=>s,equals:()=>a,Digest:()=>c});var n=r(95934),i=r(4714);const o=(e,t)=>{const r=t.byteLength,n=i.P$(e),o=n+i.P$(r),s=new Uint8Array(o+r);return i.mL(e,s,0),i.mL(r,s,n),s.set(t,o),new c(e,r,t,s)},s=e=>{const t=(0,n.oQ)(e),[r,o]=i.Jx(t),[s,a]=i.Jx(t.subarray(o)),u=t.subarray(o+a);if(u.byteLength!==s)throw new Error("Incorrect length");return new c(r,s,u,t)},a=(e,t)=>e===t||e.code===t.code&&e.size===t.size&&(0,n.fS)(e.bytes,t.bytes);class c{constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}}},7225:(e,t,r)=>{"use strict";r.d(t,{D:()=>i});var n=r(28924);const i=({name:e,code:t,encode:r})=>new o(e,t,r);class o{constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?n.create(this.code,t):t.then((e=>n.create(this.code,e)))}throw Error("Unknown type, must be binary type")}}},78103:(e,t,r)=>{"use strict";r.r(t),r.d(t,{identity:()=>s});var n=r(95934),i=r(28924);const o=n.oQ,s={code:0,name:"identity",encode:o,digest:e=>i.create(0,o(e))}},56155:(e,t,r)=>{"use strict";r.r(t),r.d(t,{sha256:()=>o,sha512:()=>s});var n=r(7225);const i=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),o=(0,n.D)({name:"sha2-256",code:18,encode:i("SHA-256")}),s=(0,n.D)({name:"sha2-512",code:19,encode:i("SHA-512")})},4714:(e,t,r)=>{"use strict";r.d(t,{Jx:()=>p,mL:()=>y,P$:()=>g});var n=Math.pow(2,31),i=Math.pow(2,7),o=Math.pow(2,14),s=Math.pow(2,21),a=Math.pow(2,28),c=Math.pow(2,35),u=Math.pow(2,42),f=Math.pow(2,49),l=Math.pow(2,56),h=Math.pow(2,63);const d={encode:function e(t,r,i){r=r||[];for(var o=i=i||0;t>=n;)r[i++]=255&t|128,t/=128;for(;-128&t;)r[i++]=255&t|128,t>>>=7;return r[i]=0|t,e.bytes=i-o+1,r},decode:function e(t,r){var n,i=0,o=0,s=r=r||0,a=t.length;do{if(s>=a)throw e.bytes=0,new RangeError("Could not decode varint");n=t[s++],i+=o<28?(127&n)<=128);return e.bytes=s-r,i},encodingLength:function(e){return e[d.decode(e),d.decode.bytes],y=(e,t,r=0)=>(d.encode(e,t,r),t),g=e=>d.encodingLength(e)},20605:(e,t,r)=>{"use strict";function n(e,t){t||(t=e.reduce(((e,t)=>e+t.length),0));const r=new Uint8Array(t);let n=0;for(const t of e)r.set(t,n),n+=t.length;return r}r.r(t),r.d(t,{concat:()=>n})},19588:(e,t,r)=>{"use strict";function n(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;rn})},52217:(e,t,r)=>{"use strict";r.r(t),r.d(t,{fromString:()=>i});var n=r(32280);function i(e,t="utf8"){const r=n.Z[t];if(!r)throw new Error(`Unsupported encoding "${t}"`);return r.decoder.decode(`${r.prefix}${e}`)}},92263:(e,t,r)=>{"use strict";r.r(t),r.d(t,{toString:()=>i});var n=r(32280);function i(e,t="utf8"){const r=n.Z[t];if(!r)throw new Error(`Unsupported encoding "${t}"`);return r.encoder.encode(e).substring(1)}},32280:(e,t,r)=>{"use strict";r.d(t,{Z:()=>O});var n={};r.r(n),r.d(n,{identity:()=>l});var i={};r.r(i),r.d(i,{base2:()=>h});var o={};r.r(o),r.d(o,{base8:()=>d});var s={};r.r(s),r.d(s,{base10:()=>p});var a={};r.r(a),r.d(a,{code:()=>E,decode:()=>S,encode:()=>_,name:()=>w});var c={};r.r(c),r.d(c,{code:()=>C,decode:()=>R,encode:()=>P,name:()=>I});var u=r(89880),f=r(95934);const l=(0,u.Dp)({prefix:"\0",name:"identity",encode:e=>(0,f.BB)(e),decode:e=>(0,f.mL)(e)}),h=(0,u.ET)({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),d=(0,u.ET)({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),p=(0,u.kU)({prefix:"9",name:"base10",alphabet:"0123456789"});var y=r(84835),g=r(22817),b=r(98441),m=r(99086),v=r(9885);r(56155),r(78103);const w="raw",E=85,_=e=>(0,f.oQ)(e),S=e=>(0,f.oQ)(e),A=new TextEncoder,T=new TextDecoder,I="json",C=512,P=e=>A.encode(JSON.stringify(e)),R=e=>JSON.parse(T.decode(e));r(81362),r(4714),r(7225),r(28924);const k={...n,...i,...o,...s,...y,...g,...b,...m,...v};function B(e,t,r,n){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:n}}}const x=B("utf8","u",(e=>"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),M=B("ascii","a",(e=>{let t="a";for(let r=0;r{e=e.substring(1);const t=new Uint8Array(e.length);for(let r=0;r{"use strict";e.exports={i8:"6.5.4"}},28362:e=>{"use strict";e.exports=JSON.parse('{"name":"libp2p","version":"0.33.0","description":"JavaScript implementation of libp2p, a modular peer to peer network stack","leadMaintainer":"Jacob Heun ","main":"src/index.js","types":"dist/src/index.d.ts","typesVersions":{"*":{"src/*":["dist/src/*","dist/src/*/index"]}},"files":["dist","src"],"scripts":{"lint":"aegir lint","build":"aegir build","build:proto":"npm run build:proto:circuit && npm run build:proto:identify && npm run build:proto:plaintext && npm run build:proto:address-book && npm run build:proto:proto-book && npm run build:proto:peer-record && npm run build:proto:envelope","build:proto:circuit":"pbjs -t static-module -w commonjs -r libp2p-circuit --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/circuit/protocol/index.js ./src/circuit/protocol/index.proto","build:proto:identify":"pbjs -t static-module -w commonjs -r libp2p-identify --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/identify/message.js ./src/identify/message.proto","build:proto:plaintext":"pbjs -t static-module -w commonjs -r libp2p-plaintext --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/insecure/proto.js ./src/insecure/proto.proto","build:proto:address-book":"pbjs -t static-module -w commonjs -r libp2p-address-book --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/peer-store/persistent/pb/address-book.js ./src/peer-store/persistent/pb/address-book.proto","build:proto:proto-book":"pbjs -t static-module -w commonjs -r libp2p-proto-book --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/peer-store/persistent/pb/proto-book.js ./src/peer-store/persistent/pb/proto-book.proto","build:proto:peer-record":"pbjs -t static-module -w commonjs -r libp2p-peer-record --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/record/peer-record/peer-record.js ./src/record/peer-record/peer-record.proto","build:proto:envelope":"pbjs -t static-module -w commonjs -r libp2p-envelope --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/record/envelope/envelope.js ./src/record/envelope/envelope.proto","build:proto-types":"npm run build:proto-types:circuit && npm run build:proto-types:identify && npm run build:proto-types:plaintext && npm run build:proto-types:address-book && npm run build:proto-types:proto-book && npm run build:proto-types:peer-record && npm run build:proto-types:envelope","build:proto-types:circuit":"pbts -o src/circuit/protocol/index.d.ts src/circuit/protocol/index.js","build:proto-types:identify":"pbts -o src/identify/message.d.ts src/identify/message.js","build:proto-types:plaintext":"pbts -o src/insecure/proto.d.ts src/insecure/proto.js","build:proto-types:address-book":"pbts -o src/peer-store/persistent/pb/address-book.d.ts src/peer-store/persistent/pb/address-book.js","build:proto-types:proto-book":"pbts -o src/peer-store/persistent/pb/proto-book.d.ts src/peer-store/persistent/pb/proto-book.js","build:proto-types:peer-record":"pbts -o src/record/peer-record/peer-record.d.ts src/record/peer-record/peer-record.js","build:proto-types:envelope":"pbts -o src/record/envelope/envelope.d.ts src/record/envelope/envelope.js","test":"aegir test","test:ts":"aegir build --no-bundle && npm run test --prefix test/ts-use","test:node":"aegir test -t node -f \\"./test/**/*.{node,spec}.js\\"","test:browser":"aegir test -t browser","test:examples":"cd examples && npm run test:all","prepare":"aegir build --no-bundle","release":"aegir release -t node -t browser","release-minor":"aegir release --type minor -t node -t browser","release-major":"aegir release --type major -t node -t browser","coverage":"nyc --reporter=text --reporter=lcov npm run test:node"},"repository":{"type":"git","url":"https://github.com/libp2p/js-libp2p.git"},"keywords":["libp2p","network","p2p","peer","peer-to-peer","IPFS"],"bugs":{"url":"https://github.com/libp2p/js-libp2p/issues"},"homepage":"https://libp2p.io","license":"MIT","engines":{"node":">=14.0.0"},"browser":{"@motrix/nat-api":false},"eslintConfig":{"extends":"ipfs","ignorePatterns":["!.aegir.js","test/ts-use"]},"dependencies":{"abortable-iterator":"^3.0.0","@motrix/nat-api":"^0.3.1","@vascosantos/moving-average":"^1.1.0","abort-controller":"^3.0.0","aggregate-error":"^3.1.0","any-signal":"^2.1.1","bignumber.js":"^9.0.1","class-is":"^1.1.0","debug":"^4.3.1","err-code":"^3.0.0","es6-promisify":"^7.0.0","events":"^3.3.0","hashlru":"^2.3.0","interface-datastore":"^6.0.2","it-all":"^1.0.4","it-buffer":"^0.1.2","it-drain":"^1.0.3","it-filter":"^1.0.1","it-first":"^1.0.4","it-handshake":"^2.0.0","it-length-prefixed":"^5.0.2","it-map":"^1.0.4","it-merge":"^1.0.0","it-pipe":"^1.1.0","it-take":"^1.0.0","libp2p-crypto":"^0.19.4","libp2p-interfaces":"^1.0.0","libp2p-utils":"^0.4.0","mafmt":"^10.0.0","merge-options":"^3.0.4","multiaddr":"^10.0.0","multiformats":"^9.0.0","multistream-select":"^2.0.0","mutable-proxy":"^1.0.0","node-forge":"^0.10.0","p-any":"^3.0.0","p-fifo":"^1.0.0","p-retry":"^4.4.0","p-settle":"^4.1.1","peer-id":"^0.15.0","private-ip":"^2.1.0","protobufjs":"^6.10.2","retimer":"^3.0.0","sanitize-filename":"^1.6.3","set-delayed-interval":"^1.0.0","streaming-iterables":"^6.0.0","timeout-abort-controller":"^1.1.1","uint8arrays":"^3.0.0","varint":"^6.0.0","wherearewe":"^1.0.0","xsalsa20":"^1.1.0"},"devDependencies":{"@chainsafe/libp2p-noise":"^4.0.0","@nodeutils/defaults-deep":"^1.1.0","@types/es6-promisify":"^6.0.0","@types/node":"^16.0.1","@types/node-forge":"^0.10.1","@types/varint":"^6.0.0","aegir":"^33.1.1","buffer":"^6.0.3","datastore-core":"^6.0.7","delay":"^5.0.0","interop-libp2p":"^0.4.0","into-stream":"^7.0.0","ipfs-http-client":"^52.0.2","it-concat":"^2.0.0","it-pair":"^1.0.0","it-pushable":"^1.4.0","libp2p":".","libp2p-bootstrap":"^0.13.0","libp2p-delegated-content-routing":"^0.11.0","libp2p-delegated-peer-routing":"^0.10.0","libp2p-floodsub":"^0.27.0","libp2p-gossipsub":"^0.11.0","libp2p-interfaces-compliance-tests":"^1.0.0","libp2p-kad-dht":"^0.24.2","libp2p-mdns":"^0.17.0","libp2p-mplex":"^0.10.1","libp2p-tcp":"^0.17.0","libp2p-webrtc-star":"^0.23.0","libp2p-websockets":"^0.16.0","nock":"^13.0.3","p-defer":"^3.0.0","p-times":"^3.0.0","p-wait-for":"^3.2.0","rimraf":"^3.0.2","sinon":"^11.1.1","util":"^0.12.3"},"contributors":["Vasco Santos ","David Dias ","Jacob Heun ","Alex Potsides ","Alan Shaw ","Cayman ","Pedro Teixeira ","Friedel Ziegelmayer ","Maciej Krüger ","Hugo Dias ","Chris Dostert ","dirkmc ","Volker Mische ","zeim839 <50573884+zeim839@users.noreply.github.com>","Richard Littauer ","a1300 ","Ryan Bell ","ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ ","Franck Royer ","Thomas Eizinger ","Giovanni T. Parra ","acolytec3 <17355484+acolytec3@users.noreply.github.com>","Elven ","Andrew Nesbitt ","Samlior ","Didrik Nordström ","RasmusErik Voel Jensen ","Robert Kiel ","Smite Chow ","Soeren ","Sönke Hahn ","TJKoury ","Tiago Alves ","XiaoZhang ","Yusef Napora ","Zane Starr ","ebinks ","Aditya Bose <13054902+adbose@users.noreply.github.com>","isan_rivkin ","mayerwin ","mcclure ","phillmac ","robertkiel ","shresthagrawal <34920931+shresthagrawal@users.noreply.github.com>","swedneck <40505480+swedneck@users.noreply.github.com>","greenSnot ","Aleksei ","Bernd Strehl ","Chris Bratlien ","Cindy Wu ","Daijiro Wachi ","Diogo Silva ","Dmitriy Ryajov ","Ethan Lam ","Fei Liu ","Felipe Martins ","Florian-Merle ","Francis Gulotta ","Guy Sviry <32539816+guysv@users.noreply.github.com>","Henrique Dias ","Irakli Gozalishvili ","Joel Gustafson ","John Rees ","João Santos ","Julien Bouquillon ","Kevin Kwok ","Kevin Lacker ","Lars Gierth ","Leask Wong ","Marcin Tojek ","Michael Burns <5170+mburns@users.noreply.github.com>","Miguel Mota ","Nuno Nogueira ","Philipp Muens "]}')}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var r=__webpack_module_cache__[e]={id:e,loaded:!1,exports:{}};return __webpack_modules__[e].call(r.exports,r,r.exports,__webpack_require__),r.loaded=!0,r.exports}__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var r in t)__webpack_require__.o(t,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var __webpack_exports__=__webpack_require__(63607)})(); \ No newline at end of file diff --git a/src/util.ts b/src/util.ts index 206a8c0..e4df329 100644 --- a/src/util.ts +++ b/src/util.ts @@ -49,7 +49,7 @@ export function enable(id: string) { } export function link(id: string): string { - return window.location.origin + '?join=' + id; + return window.location.hostname + '?join=' + id; } interface DiscoveredUser {