status-im-auto 393b1e08e5 Updates
2022-06-01 02:06:51 +00:00

3 lines
1.3 MiB

/*! For license information please see main.9a7bb4e0.js.LICENSE.txt */
(()=>{var __webpack_modules__={77788:(e,t)=>{"use strict";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={NODE_ENV:"production",PUBLIC_URL:"/examples/relay-reactjs-chat",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0}.DUMP_SESSION_KEYS},87477:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decryptStream=t.encryptStream=void 0;const n=r(77788);t.encryptStream=function(e){return async function*(t){for await(const r of t)for(let t=0;t<r.length;t+=n.NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG){let i=t+n.NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG;i>r.length&&(i=r.length);const s=e.encrypt(r.slice(t,i),e.session);yield s}}},t.decryptStream=function(e){return async function*(t){for await(const r of t)for(let t=0;t<r.length;t+=n.NOISE_MSG_MAX_LENGTH_BYTES){let i=t+n.NOISE_MSG_MAX_LENGTH_BYTES;i>r.length&&(i=r.length);const{plaintext:s,valid:o}=await e.decrypt(r.slice(t,i),e.session);if(!o)throw new Error("Failed to validate decrypted chunk");yield s}}}},75698: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.decode2=t.decode1=t.decode0=t.encode2=t.encode1=t.encode0=t.uint16BEDecode=t.uint16BEEncode=void 0;const i=n(r(41976)),s=r(62110);t.uint16BEEncode=(e,t,r)=>{var n;return t=t||(n=2,globalThis.Buffer?globalThis.Buffer.allocUnsafe(n):new Uint8Array(n)),new DataView(t.buffer,t.byteOffset,t.byteLength).setUint16(r,e,!1),t},t.uint16BEEncode.bytes=2;t.uint16BEDecode=e=>{if(e.length<2)throw RangeError("Could not decode int16BE");return e instanceof i.default?e.readUInt16BE(0):new DataView(e.buffer,e.byteOffset,e.byteLength).getUint16(0,!1)},t.uint16BEDecode.bytes=2,t.encode0=function(e){return(0,s.concat)([e.ne,e.ciphertext],e.ne.length+e.ciphertext.length)},t.encode1=function(e){return(0,s.concat)([e.ne,e.ns,e.ciphertext],e.ne.length+e.ns.length+e.ciphertext.length)},t.encode2=function(e){return(0,s.concat)([e.ns,e.ciphertext],e.ns.length+e.ciphertext.length)},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:new Uint8Array(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:new Uint8Array(0),ns:e.slice(0,48),ciphertext:e.slice(48,e.length)}}},88919:(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},77827:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IKHandshake=void 0;const n=r(8609),i=r(75698),s=r(83605),o=r(88919),a=r(46400);t.IKHandshake=class{constructor(e,t,r,i,s,o,a,c){this.isInitiator=e,this.payload=t,this.prologue=r,this.staticKeypair=i,this.connection=s,a&&(this.remotePeer=a),this.ik=null!==c&&void 0!==c?c:new n.IK,this.session=this.ik.initSession(this.isInitiator,this.prologue,this.staticKeypair,o),this.remoteEarlyData=new Uint8Array}async stage0(){if((0,a.logLocalStaticKeys)(this.session.hs.s),(0,a.logRemoteStaticKey)(this.session.hs.rs),this.isInitiator){(0,a.logger)("IK Stage 0 - Initiator sending message...");const e=this.ik.sendMessage(this.session,this.payload);this.connection.writeLP((0,i.encode1)(e)),(0,a.logger)("IK Stage 0 - Initiator sent message."),(0,a.logLocalEphemeralKeys)(this.session.hs.e)}else{(0,a.logger)("IK Stage 0 - Responder receiving message...");const t=await this.connection.readLP();try{const e=(0,i.decode1)(t.slice()),{plaintext:r,valid:n}=this.ik.recvMessage(this.session,e);if(!n)throw new Error("ik handshake stage 0 decryption validation fail");(0,a.logger)("IK Stage 0 - Responder got message, going to verify payload.");const o=await(0,s.decodePayload)(r);this.remotePeer=this.remotePeer||await(0,s.getPeerIdFromPayload)(o),await(0,s.verifySignedPayload)(this.session.hs.rs,o,this.remotePeer),this.setRemoteEarlyData(o.data),(0,a.logger)("IK Stage 0 - Responder successfully verified payload!"),(0,a.logRemoteEphemeralKey)(this.session.hs.re)}catch(e){const r=e;throw(0,a.logger)("Responder breaking up with IK handshake in stage 0."),new o.FailedIKError(t,"Error occurred while verifying initiator's signed payload: ".concat(r.message))}}}async stage1(){if(this.isInitiator){(0,a.logger)("IK Stage 1 - Initiator receiving message...");const t=(await this.connection.readLP()).slice(),r=(0,i.decode0)(t),{plaintext:n,valid:c}=this.ik.recvMessage(this.session,r);(0,a.logger)("IK Stage 1 - Initiator got message, going to verify payload.");try{if(!c)throw new Error("ik stage 1 decryption validation fail");const e=await(0,s.decodePayload)(n);this.remotePeer=this.remotePeer||await(0,s.getPeerIdFromPayload)(e),await(0,s.verifySignedPayload)(r.ns.slice(0,32),e,this.remotePeer),this.setRemoteEarlyData(e.data),(0,a.logger)("IK Stage 1 - Initiator successfully verified payload!"),(0,a.logRemoteEphemeralKey)(this.session.hs.re)}catch(e){const r=e;throw(0,a.logger)("Initiator breaking up with IK handshake in stage 1."),new o.FailedIKError(t,"Error occurred while verifying responder's signed payload: ".concat(r.message))}}else{(0,a.logger)("IK Stage 1 - Responder sending message...");const e=this.ik.sendMessage(this.session,this.payload);this.connection.writeLP((0,i.encode0)(e)),(0,a.logger)("IK Stage 1 - Responder sent message..."),(0,a.logLocalEphemeralKeys)(this.session.hs.e)}(0,a.logCipherState)(this.session)}decrypt(e,t){const r=this.getCS(t,!1);return this.ik.decryptWithAd(r,new Uint8Array(0),e)}encrypt(e,t){const r=this.getCS(t);return this.ik.encryptWithAd(r,new Uint8Array(0),e)}getLocalEphemeralKeys(){if(!this.session.hs.e)throw new Error("Ephemeral keys do not exist.");return this.session.hs.e}getCS(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];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=e)}}},7548:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XXFallbackHandshake=void 0;const n=r(8382),i=r(83605),s=r(46400),o=r(75698);class a extends n.XXHandshake{constructor(e,t,r,n,i,s,o,a,c){super(e,t,r,n,i,o,c),a&&(this.ephemeralKeys=a),this.initialMsg=s}async propose(){if(this.isInitiator)this.xx.sendMessage(this.session,new Uint8Array(0),this.ephemeralKeys),(0,s.logger)("XX Fallback Stage 0 - Initialized state as the first message was sent by initiator."),(0,s.logLocalEphemeralKeys)(this.session.hs.e);else{(0,s.logger)("XX Fallback Stage 0 - Responder decoding initial msg from IK.");const e=(0,o.decode0)(this.initialMsg),{valid:t}=this.xx.recvMessage(this.session,{ne:e.ne,ns:new Uint8Array(0),ciphertext:new Uint8Array(0)});if(!t)throw new Error("xx fallback stage 0 decryption validation fail");(0,s.logger)("XX Fallback Stage 0 - Responder used received message from IK."),(0,s.logRemoteEphemeralKey)(this.session.hs.re)}}async exchange(){if(this.isInitiator){const t=(0,o.decode1)(this.initialMsg),{plaintext:r,valid:n}=this.xx.recvMessage(this.session,t);if(!n)throw new Error("xx fallback stage 1 decryption validation fail");(0,s.logger)("XX Fallback Stage 1 - Initiator used received message from IK."),(0,s.logRemoteEphemeralKey)(this.session.hs.re),(0,s.logRemoteStaticKey)(this.session.hs.rs),(0,s.logger)("Initiator going to check remote's signature...");try{const e=await(0,i.decodePayload)(r);this.remotePeer=this.remotePeer||await(0,i.getPeerIdFromPayload)(e),await(0,i.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: ".concat(e.message))}(0,s.logger)("All good with the signature!")}else(0,s.logger)("XX Fallback Stage 1 - Responder start"),await super.exchange(),(0,s.logger)("XX Fallback Stage 1 - Responder end")}}t.XXFallbackHandshake=a},8382:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XXHandshake=void 0;const n=r(22757),i=r(83605),s=r(46400),o=r(75698);t.XXHandshake=class{constructor(e,t,r,i,s,o,a){this.isInitiator=e,this.payload=t,this.prologue=r,this.staticKeypair=i,this.connection=s,o&&(this.remotePeer=o),this.xx=null!==a&&void 0!==a?a:new n.XX,this.session=this.xx.initSession(this.isInitiator,this.prologue,this.staticKeypair),this.remoteEarlyData=new Uint8Array(0)}async propose(){if((0,s.logLocalStaticKeys)(this.session.hs.s),this.isInitiator){(0,s.logger)("Stage 0 - Initiator starting to send first message.");const e=this.xx.sendMessage(this.session,new Uint8Array(0));this.connection.writeLP((0,o.encode0)(e)),(0,s.logger)("Stage 0 - Initiator finished sending first message."),(0,s.logLocalEphemeralKeys)(this.session.hs.e)}else{(0,s.logger)("Stage 0 - Responder waiting to receive first message...");const e=(0,o.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");(0,s.logger)("Stage 0 - Responder received first message."),(0,s.logRemoteEphemeralKey)(this.session.hs.re)}}async exchange(){if(this.isInitiator){(0,s.logger)("Stage 1 - Initiator waiting to receive first message from responder...");const t=(0,o.decode1)((await this.connection.readLP()).slice()),{plaintext:r,valid:n}=this.xx.recvMessage(this.session,t);if(!n)throw new Error("xx handshake stage 1 validation fail");(0,s.logger)("Stage 1 - Initiator received the message."),(0,s.logRemoteEphemeralKey)(this.session.hs.re),(0,s.logRemoteStaticKey)(this.session.hs.rs),(0,s.logger)("Initiator going to check remote's signature...");try{const e=await(0,i.decodePayload)(r);this.remotePeer=this.remotePeer||await(0,i.getPeerIdFromPayload)(e),this.remotePeer=await(0,i.verifySignedPayload)(t.ns,e,this.remotePeer),this.setRemoteEarlyData(e.data)}catch(e){throw new Error("Error occurred while verifying signed payload: ".concat(e.message))}(0,s.logger)("All good with the signature!")}else{(0,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((0,o.encode1)(e)),(0,s.logger)("Stage 1 - Responder sent the second handshake message with signed payload."),(0,s.logLocalEphemeralKeys)(this.session.hs.e)}}async finish(){if(this.isInitiator){(0,s.logger)("Stage 2 - Initiator sending third handshake message.");const e=this.xx.sendMessage(this.session,this.payload);this.connection.writeLP((0,o.encode2)(e)),(0,s.logger)("Stage 2 - Initiator sent message with signed payload.")}else{(0,s.logger)("Stage 2 - Responder waiting for third handshake message...");const t=(0,o.decode2)((await this.connection.readLP()).slice()),{plaintext:r,valid:n}=this.xx.recvMessage(this.session,t);if(!n)throw new Error("xx handshake stage 2 validation fail");(0,s.logger)("Stage 2 - Responder received the message, finished handshake.");try{const e=await(0,i.decodePayload)(r);this.remotePeer=this.remotePeer||await(0,i.getPeerIdFromPayload)(e),await(0,i.verifySignedPayload)(this.session.hs.rs,e,this.remotePeer),this.setRemoteEarlyData(e.data)}catch(e){throw new Error("Error occurred while verifying signed payload: ".concat(e.message))}}(0,s.logCipherState)(this.session)}encrypt(e,t){const r=this.getCS(t);return this.xx.encryptWithAd(r,new Uint8Array(0),e)}decrypt(e,t){const r=this.getCS(t,!1);return this.xx.decryptWithAd(r,new Uint8Array(0),e)}getRemoteStaticKey(){return this.session.hs.rs}getCS(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];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=e)}}},68006: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}),s=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.MAX_NONCE=t.MIN_NONCE=void 0;const o=s(r(52029)),a=s(r(24888)),c=r(53642),u=r(98779),l=r(62110),h=r(79421),d=r(83605),f=r(46400);t.MIN_NONCE=0,t.MAX_NONCE=Number.MAX_SAFE_INTEGER;const p="Cipherstate has reached maximum n, a new handshake must be performed";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 new Uint8Array(32)}isEmptyKey(e){const t=this.createEmptyKey();return(0,u.equals)(t,e)}incrementNonce(e){return e+1}nonceToBytes(e){const t=new Uint8Array(12);return new DataView(t.buffer,t.byteOffset,t.byteLength).setUint32(4,e,!0),t}encrypt(e,r,n,i){if(r>t.MAX_NONCE)throw new Error(p);const s=this.nonceToBytes(r);return new c.ChaCha20Poly1305(e).seal(s,i,n)}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,r,n,i){if(r>t.MAX_NONCE)throw new Error(p);const s=this.nonceToBytes(r),o=new c.ChaCha20Poly1305(e).open(s,i,n);return o?{plaintext:o,valid:!0}:{plaintext:new Uint8Array(0),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=o.sharedKey(e,t);return 32===r.length?r:r.slice(0,32)}catch(r){return(0,f.logger)(r.message),new Uint8Array(32)}}mixHash(e,t){e.h=this.getHash(e.h,t)}getHash(e,t){return a.hash((0,l.concat)([e,t],e.length+t.length))}mixKey(e,t){const[r,n]=(0,d.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=(0,h.fromString)(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=new Uint8Array(32);return t.set(e),t}return this.getHash(e,new Uint8Array(0))}split(e){const[t,r]=(0,d.getHkdf)(e.ck,new Uint8Array(0));return{cs1:this.initializeKey(t),cs2:this.initializeKey(r)}}writeMessageRegular(e,t){const r=this.encryptWithAd(e,new Uint8Array(0),t);return{ne:this.createEmptyKey(),ns:new Uint8Array(0),ciphertext:r}}readMessageRegular(e,t){return this.decryptWithAd(e,new Uint8Array(0),t.ciphertext)}}},8609:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IK=void 0;const n=r(83605),i=r(68006);class s extends i.AbstractHandshake{initSession(e,t,r,n){const i=this.createEmptyKey();let s;return s=e?this.initializeInitiator(t,r,n,i):this.initializeResponder(t,r,n,i),{hs:s,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:s,cs2:o}=this.writeMessageB(e.hs,t);r=n,e.h=i,e.cs1=s,e.cs2=o}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=new Uint8Array(0),n=!1;if(0===e.mc&&({plaintext:r,valid:n}=this.readMessageA(e.hs,t)),1===e.mc){const{plaintext:i,valid:s,h:o,cs1:a,cs2:c}=this.readMessageB(e.hs,t);r=i,n=s,e.h=o,e.cs1=a,e.cs2=c}return e.mc++,{plaintext:r,valid:n}}writeMessageA(e,t){e.e=(0,n.generateKeypair)();const r=e.e.publicKey;this.mixHash(e.ss,r),this.mixKey(e.ss,this.dh(e.e.privateKey,e.rs));const i=e.s.publicKey,s=this.encryptAndHash(e.ss,i);this.mixKey(e.ss,this.dh(e.s.privateKey,e.rs));return{ne:r,ns:s,ciphertext:this.encryptAndHash(e.ss,t)}}writeMessageB(e,t){e.e=(0,n.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 i=this.encryptAndHash(e.ss,t),s={ne:r,ns:this.createEmptyKey(),ciphertext:i},{cs1:o,cs2:a}=this.split(e.ss);return{messageBuffer:s,cs1:o,cs2:a,h:e.ss.h}}readMessageA(e,t){(0,n.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:i}=this.decryptAndHash(e.ss,t.ns);i&&32===r.length&&(0,n.isValidPublicKey)(r)&&(e.rs=r),this.mixKey(e.ss,this.dh(e.s.privateKey,e.rs));const{plaintext:s,valid:o}=this.decryptAndHash(e.ss,t.ciphertext);return{plaintext:s,valid:i&&o}}readMessageB(e,t){if((0,n.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:i}=this.decryptAndHash(e.ss,t.ciphertext),{cs1:s,cs2:o}=this.split(e.ss);return{h:e.ss.h,valid:i,plaintext:r,cs1:s,cs2:o}}initializeInitiator(e,t,r,n){const i=this.initializeSymmetric("Noise_IK_25519_ChaChaPoly_SHA256");this.mixHash(i,e),this.mixHash(i,r);return{ss:i,s:t,rs:r,re:new Uint8Array(32),psk:n}}initializeResponder(e,t,r,n){const i=this.initializeSymmetric("Noise_IK_25519_ChaChaPoly_SHA256");this.mixHash(i,e),this.mixHash(i,t.publicKey);return{ss:i,s:t,rs:r,re:new Uint8Array(32),psk:n}}}t.IK=s},22757:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XX=void 0;const n=r(83605),i=r(68006);class s extends i.AbstractHandshake{initializeInitiator(e,t,r,n){const i=this.initializeSymmetric("Noise_XX_25519_ChaChaPoly_SHA256");this.mixHash(i,e);return{ss:i,s:t,rs:r,psk:n,re:new Uint8Array(32)}}initializeResponder(e,t,r,n){const i=this.initializeSymmetric("Noise_XX_25519_ChaChaPoly_SHA256");this.mixHash(i,e);return{ss:i,s:t,rs:r,psk:n,re:new Uint8Array(32)}}writeMessageA(e,t,r){const i=new Uint8Array(0);e.e=void 0!==r?r:(0,n.generateKeypair)();const s=e.e.publicKey;this.mixHash(e.ss,s);return{ne:s,ns:i,ciphertext:this.encryptAndHash(e.ss,t)}}writeMessageB(e,t){e.e=(0,n.generateKeypair)();const r=e.e.publicKey;this.mixHash(e.ss,r),this.mixKey(e.ss,this.dh(e.e.privateKey,e.re));const i=e.s.publicKey,s=this.encryptAndHash(e.ss,i);this.mixKey(e.ss,this.dh(e.s.privateKey,e.re));return{ne:r,ns:s,ciphertext:this.encryptAndHash(e.ss,t)}}writeMessageC(e,t){const r=e.s.publicKey,n=this.encryptAndHash(e.ss,r);this.mixKey(e.ss,this.dh(e.s.privateKey,e.re));const i=this.encryptAndHash(e.ss,t),s={ne:this.createEmptyKey(),ns:n,ciphertext:i},{cs1:o,cs2:a}=this.split(e.ss);return{h:e.ss.h,messageBuffer:s,cs1:o,cs2:a}}readMessageA(e,t){return(0,n.isValidPublicKey)(t.ne)&&(e.re=t.ne),this.mixHash(e.ss,e.re),this.decryptAndHash(e.ss,t.ciphertext)}readMessageB(e,t){if((0,n.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:i}=this.decryptAndHash(e.ss,t.ns);i&&32===r.length&&(0,n.isValidPublicKey)(r)&&(e.rs=r),this.mixKey(e.ss,this.dh(e.e.privateKey,e.rs));const{plaintext:s,valid:o}=this.decryptAndHash(e.ss,t.ciphertext);return{plaintext:s,valid:i&&o}}readMessageC(e,t){const{plaintext:r,valid:i}=this.decryptAndHash(e.ss,t.ns);if(i&&32===r.length&&(0,n.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:s,valid:o}=this.decryptAndHash(e.ss,t.ciphertext),{cs1:a,cs2:c}=this.split(e.ss);return{h:e.ss.h,plaintext:s,valid:i&&o,cs1:a,cs2:c}}initSession(e,t,r){const n=this.createEmptyKey(),i=new Uint8Array(32);let s;return s=e?this.initializeInitiator(t,r,i,n):this.initializeResponder(t,r,i,n),{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:s,cs2:o}=this.writeMessageC(e.hs,t);n=i,e.h=r,e.cs1=s,e.cs2=o}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=new Uint8Array(0),n=!1;if(0===e.mc)({plaintext:r,valid:n}=this.readMessageA(e.hs,t));else if(1===e.mc)({plaintext:r,valid:n}=this.readMessageB(e.hs,t));else if(2===e.mc){const{h:i,plaintext:s,valid:o,cs1:a,cs2:c}=this.readMessageC(e.hs,t);r=s,n=o,e.h=i,e.cs1=a,e.cs2=c}return e.mc++,{plaintext:r,valid:n}}}t.XX=s},28278: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 s=r(97806);i(r(97806),t),t.NOISE=new s.Noise},52109:(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},46400: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(18392)),s=r(77788),o=r(82051);let a;t.logger=(0,i.default)("libp2p:noise"),a=s.DUMP_SESSION_KEYS?t.logger:()=>{},t.logLocalStaticKeys=function(e){a("LOCAL_STATIC_PUBLIC_KEY ".concat((0,o.toString)(e.publicKey,"hex"))),a("LOCAL_STATIC_PRIVATE_KEY ".concat((0,o.toString)(e.privateKey,"hex")))},t.logLocalEphemeralKeys=function(e){e?(a("LOCAL_PUBLIC_EPHEMERAL_KEY ".concat((0,o.toString)(e.publicKey,"hex"))),a("LOCAL_PRIVATE_EPHEMERAL_KEY ".concat((0,o.toString)(e.privateKey,"hex")))):a("Missing local ephemeral keys.")},t.logRemoteStaticKey=function(e){a("REMOTE_STATIC_PUBLIC_KEY ".concat((0,o.toString)(e,"hex")))},t.logRemoteEphemeralKey=function(e){a("REMOTE_EPHEMERAL_PUBLIC_KEY ".concat((0,o.toString)(e,"hex")))},t.logCipherState=function(e){e.cs1&&e.cs2?(a("CIPHER_STATE_1 ".concat(e.cs1.n," ").concat((0,o.toString)(e.cs1.k,"hex"))),a("CIPHER_STATE_2 ".concat(e.cs2.n," ").concat((0,o.toString)(e.cs2.k,"hex")))):a("Missing cipher state.")}},97806: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}),s=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},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Noise=void 0;const a=s(r(52029)),c=o(r(85551)),u=o(r(85907)),l=o(r(90351)),h=o(r(79023)),d=r(44709),f=r(8382),p=r(77827),y=r(7548),g=r(83605),m=r(75698),v=r(87477),b=r(52109),w=r(46400),E=r(77788);t.Noise=class{constructor(e,t){if(this.protocol="/noise",this.prologue=new Uint8Array(0),this.earlyData=null!==t&&void 0!==t?t:new Uint8Array(0),this.useNoisePipes=!1,e){const t=a.generateKeyPairFromSeed(e);this.staticKeys={privateKey:t.secretKey,publicKey:t.publicKey}}else this.staticKeys=(0,g.generateKeypair)()}async secureOutbound(e,t,r){const n=(0,c.default)(t,{lengthEncoder:m.uint16BEEncode,lengthDecoder:m.uint16BEDecode,maxDataLength:E.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=(0,c.default)(t,{lengthEncoder:m.uint16BEEncode,lengthDecoder:m.uint16BEDecode,maxDataLength:E.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(0,g.getPayload)(e.localPeer,this.staticKeys.publicKey,this.earlyData);let n=this.useNoisePipes;if(e.isInitiator&&null===b.KeyCache.load(e.remotePeer)&&(n=!1),!n)return await this.performXXHandshake(e,r);{const{remotePeer:n,connection:s,isInitiator:o}=e,a=new p.IKHandshake(o,r,this.prologue,this.staticKeys,s,null!==(t=b.KeyCache.load(e.remotePeer))&&void 0!==t?t:new Uint8Array(32),n);try{return await this.performIKHandshake(a)}catch(i){let t;return e.isInitiator&&(t=a.getLocalEphemeralKeys()),await this.performXXFallbackHandshake(e,r,i.initialMsg,t)}}}async performXXFallbackHandshake(e,t,r,n){const{isInitiator:i,remotePeer:s,connection:o}=e,a=new y.XXFallbackHandshake(i,t,this.prologue,this.staticKeys,o,r,s,n);try{await a.propose(),await a.exchange(),await a.finish()}catch(c){(0,w.logger)(c);throw new Error("Error occurred during XX Fallback handshake: ".concat(c.message))}return a}async performXXHandshake(e,t){const{isInitiator:r,remotePeer:n,connection:i}=e,s=new f.XXHandshake(r,t,this.prologue,this.staticKeys,i,n);try{await s.propose(),await s.exchange(),await s.finish(),this.useNoisePipes&&s.remotePeer&&b.KeyCache.store(s.remotePeer,s.getRemoteStaticKey())}catch(o){throw new Error("Error occurred during XX handshake: ".concat(o.message))}return s}async performIKHandshake(e){return await e.stage0(),await e.stage1(),e}async createSecureConnection(e,t){const[r,n]=(0,u.default)(),i=e.unwrap();return await(0,h.default)(r,l.default,(0,v.encryptStream)(t),(0,d.encode)({lengthEncoder:m.uint16BEEncode}),i,(0,d.decode)({lengthDecoder:m.uint16BEDecode}),l.default,(0,v.decryptStream)(t),r),n}}},14660:function(e,t,r){"use strict";var n,i,s;i=[r(80886)],void 0===(s="function"===typeof(n=function(e){var t=e.Reader,r=e.Writer,n=e.util,i=e.roots["libp2p-noise"]||(e.roots["libp2p-noise"]={});return i.pb=function(){var s={};return s.NoiseHandshakePayload=function(){function s(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return s.prototype.identityKey=n.newBuffer([]),s.prototype.identitySig=n.newBuffer([]),s.prototype.data=n.newBuffer([]),s.create=function(e){return new s(e)},s.encode=function(e,t){return t||(t=r.create()),null!=e.identityKey&&Object.hasOwnProperty.call(e,"identityKey")&&t.uint32(10).bytes(e.identityKey),null!=e.identitySig&&Object.hasOwnProperty.call(e,"identitySig")&&t.uint32(18).bytes(e.identitySig),null!=e.data&&Object.hasOwnProperty.call(e,"data")&&t.uint32(26).bytes(e.data),t},s.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},s.decode=function(e,r){e instanceof t||(e=t.create(e));for(var n=void 0===r?e.len:e.pos+r,s=new i.pb.NoiseHandshakePayload;e.pos<n;){var o=e.uint32();switch(o>>>3){case 1:s.identityKey=e.bytes();break;case 2:s.identitySig=e.bytes();break;case 3:s.data=e.bytes();break;default:e.skipType(7&o)}}return s},s.decodeDelimited=function(e){return e instanceof t||(e=new t(e)),this.decode(e,e.uint32())},s.verify=function(e){return"object"!==typeof e||null===e?"object expected":null!=e.identityKey&&e.hasOwnProperty("identityKey")&&!(e.identityKey&&"number"===typeof e.identityKey.length||n.isString(e.identityKey))?"identityKey: buffer expected":null!=e.identitySig&&e.hasOwnProperty("identitySig")&&!(e.identitySig&&"number"===typeof e.identitySig.length||n.isString(e.identitySig))?"identitySig: buffer expected":null!=e.data&&e.hasOwnProperty("data")&&!(e.data&&"number"===typeof e.data.length||n.isString(e.data))?"data: buffer expected":null},s.fromObject=function(e){if(e instanceof i.pb.NoiseHandshakePayload)return e;var t=new i.pb.NoiseHandshakePayload;return null!=e.identityKey&&("string"===typeof e.identityKey?n.base64.decode(e.identityKey,t.identityKey=n.newBuffer(n.base64.length(e.identityKey)),0):e.identityKey.length&&(t.identityKey=e.identityKey)),null!=e.identitySig&&("string"===typeof e.identitySig?n.base64.decode(e.identitySig,t.identitySig=n.newBuffer(n.base64.length(e.identitySig)),0):e.identitySig.length&&(t.identitySig=e.identitySig)),null!=e.data&&("string"===typeof e.data?n.base64.decode(e.data,t.data=n.newBuffer(n.base64.length(e.data)),0):e.data.length&&(t.data=e.data)),t},s.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(t.bytes===String?r.identityKey="":(r.identityKey=[],t.bytes!==Array&&(r.identityKey=n.newBuffer(r.identityKey))),t.bytes===String?r.identitySig="":(r.identitySig=[],t.bytes!==Array&&(r.identitySig=n.newBuffer(r.identitySig))),t.bytes===String?r.data="":(r.data=[],t.bytes!==Array&&(r.data=n.newBuffer(r.data)))),null!=e.identityKey&&e.hasOwnProperty("identityKey")&&(r.identityKey=t.bytes===String?n.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?n.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?n.base64.encode(e.data,0,e.data.length):t.bytes===Array?Array.prototype.slice.call(e.data):e.data),r},s.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},s}(),s}(),i})?n.apply(t,i):n)||(e.exports=s)},83605: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}),s=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},o=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(52497),c=r(24888),u=s(r(52029)),l=o(r(90190)),h=r(14660),d=r(98779),f=r(46765),p=r(62110),y=h.pb.NoiseHandshakePayload;function g(e,t,r){const n=y.create({identityKey:e,identitySig:t,data:null!==r&&void 0!==r?r:null});return y.encode(n).finish()}async function m(e,t){return await e.privKey.sign(t)}function v(e){const t=(0,f.fromString)("noise-libp2p-static-key:");return(0,p.concat)([t,e],t.length+e.length)}t.generateKeypair=function(){const e=u.generateKeyPair();return{publicKey:e.publicKey,privateKey:e.secretKey}},t.getPayload=async function(e,t,r){const n=await m(e,v(t)),i=null!==r&&void 0!==r?r:new Uint8Array(0);return g(e.marshalPubKey(),n,i)},t.createHandshakePayload=g,t.signPayload=m,t.getPeerIdFromPayload=async function(e){return await l.default.createFromPubKey(e.identityKey)},t.decodePayload=function(e){return y.toObject(y.decode(e))},t.getHandshakePayload=v,t.verifySignedPayload=async function(e,t,r){const n=t.identityKey;if(!await async function(e,t){const r=await l.default.createFromPubKey(t);return(0,d.equals)(r.id,e)}(r.id,n))throw new Error("Peer ID doesn't match libp2p public key.");const i=v(e),s=await l.default.createFromPubKey(n);if(!t.identitySig||!s.pubKey.verify(i,t.identitySig))throw new Error("Static key doesn't match to peer that signed payload!");return s},t.getHkdf=function(e,t){const r=new a.HKDF(c.SHA256,t,e).expand(96);return[r.slice(0,32),r.slice(32,64),r.slice(64,96)]},t.isValidPublicKey=function(e){return e instanceof Uint8Array&&32===e.length}},67845:(e,t,r)=>{"use strict";r.r(t),r.d(t,{decode:()=>k,encode:()=>C});let n=!1,i=!1;const s={debug:1,default:2,info:2,warning:3,error:4,off:5};let o=s.default,a=null;const c=function(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach((t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(r){e.push(t)}})),e.length)throw new Error("missing "+e.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){return e.message}return null}();var u,l;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(u||(u={})),function(e){e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT="TIMEOUT",e.BUFFER_OVERRUN="BUFFER_OVERRUN",e.NUMERIC_FAULT="NUMERIC_FAULT",e.MISSING_NEW="MISSING_NEW",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",e.TRANSACTION_REPLACED="TRANSACTION_REPLACED"}(l||(l={}));const h="0123456789abcdef";class d{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==s[r]&&this.throwArgumentError("invalid log level name","logLevel",e),o>s[r]||console.log.apply(console,t)}debug(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this._log(d.levels.DEBUG,t)}info(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this._log(d.levels.INFO,t)}warn(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this._log(d.levels.WARNING,t)}makeError(e,t,r){if(i)return this.makeError("censored error",t,{});t||(t=d.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((e=>{const t=r[e];try{if(t instanceof Uint8Array){let r="";for(let e=0;e<t.length;e++)r+=h[t[e]>>4],r+=h[15&t[e]];n.push(e+"=Uint8Array(0x"+r+")")}else n.push(e+"="+JSON.stringify(t))}catch(a){n.push(e+"="+JSON.stringify(r[e].toString()))}})),n.push("code=".concat(t)),n.push("version=".concat(this.version));const s=e;let o="";switch(t){case l.NUMERIC_FAULT:{o="NUMERIC_FAULT";const t=e;switch(t){case"overflow":case"underflow":case"division-by-zero":o+="-"+t;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case l.CALL_EXCEPTION:case l.INSUFFICIENT_FUNDS:case l.MISSING_NEW:case l.NONCE_EXPIRED:case l.REPLACEMENT_UNDERPRICED:case l.TRANSACTION_REPLACED:case l.UNPREDICTABLE_GAS_LIMIT:o=t}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(e+=" ("+n.join(", ")+")");const a=new Error(e);return a.reason=s,a.code=t,Object.keys(r).forEach((function(e){a[e]=r[e]})),a}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(e,t,r){return this.throwError(e,d.errors.INVALID_ARGUMENT,{argument:t,value:r})}assert(e,t,r,n){e||this.throwError(t,r,n)}assertArgument(e,t,r,n){e||this.throwArgumentError(t,r,n)}checkNormalize(e){null==e&&(e="platform missing String.prototype.normalize"),c&&this.throwError("platform missing String.prototype.normalize",d.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:c})}checkSafeUint53(e,t){"number"===typeof e&&(null==t&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,d.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,d.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,r){r=r?": "+r:"",e<t&&this.throwError("missing argument"+r,d.errors.MISSING_ARGUMENT,{count:e,expectedCount:t}),e>t&&this.throwError("too many arguments"+r,d.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){e!==Object&&null!=e||this.throwError("missing new",d.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",d.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):e!==Object&&null!=e||this.throwError("missing new",d.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return a||(a=new d("logger/5.6.0")),a}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",d.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),n){if(!e)return;this.globalLogger().throwError("error censorship permanent",d.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}i=!!e,n=!!t}static setLogLevel(e){const t=s[e.toLowerCase()];null!=t?o=t:d.globalLogger().warn("invalid log level - "+e)}static from(e){return new d(e)}}d.errors=l,d.levels=u;const f=new d("bytes/5.6.0");function p(e){return!!e.toHexString}function y(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return y(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function g(e){return w(e)&&!(e.length%2)||v(e)}function m(e){return"number"===typeof e&&e==e&&e%1===0}function v(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"===typeof e)return!1;if(!m(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){const r=e[t];if(!m(r)||r<0||r>=256)return!1}return!0}function b(e,t){if(t||(t={}),"number"===typeof e){f.checkSafeUint53(e,"invalid arrayify value");const t=[];for(;e;)t.unshift(255&e),e=parseInt(String(e/256));return 0===t.length&&t.push(0),y(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"===typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),p(e)&&(e=e.toHexString()),w(e)){let r=e.substring(2);r.length%2&&("left"===t.hexPad?r="0x0"+r.substring(2):"right"===t.hexPad?r+="0":f.throwArgumentError("hex data is odd-length","value",e));const n=[];for(let e=0;e<r.length;e+=2)n.push(parseInt(r.substring(e,e+2),16));return y(new Uint8Array(n))}return v(e)?y(new Uint8Array(e)):f.throwArgumentError("invalid arrayify value","value",e)}function w(e,t){return!("string"!==typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}const E="0123456789abcdef";function S(e,t){if(t||(t={}),"number"===typeof e){f.checkSafeUint53(e,"invalid hexlify value");let t="";for(;e;)t=E[15&e]+t,e=Math.floor(e/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if("bigint"===typeof e)return(e=e.toString(16)).length%2?"0x0"+e:"0x"+e;if(t.allowMissingPrefix&&"string"===typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),p(e))return e.toHexString();if(w(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":f.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(v(e)){let t="0x";for(let r=0;r<e.length;r++){let n=e[r];t+=E[(240&n)>>4]+E[15&n]}return t}return f.throwArgumentError("invalid hexlify value","value",e)}const _=new d("rlp/5.6.0");function I(e){const t=[];for(;e;)t.unshift(255&e),e>>=8;return t}function T(e,t,r){let n=0;for(let i=0;i<r;i++)n=256*n+e[t+i];return n}function A(e){if(Array.isArray(e)){let t=[];if(e.forEach((function(e){t=t.concat(A(e))})),t.length<=55)return t.unshift(192+t.length),t;const r=I(t.length);return r.unshift(247+r.length),r.concat(t)}g(e)||_.throwArgumentError("RLP object must be BytesLike","object",e);const t=Array.prototype.slice.call(b(e));if(1===t.length&&t[0]<=127)return t;if(t.length<=55)return t.unshift(128+t.length),t;const r=I(t.length);return r.unshift(183+r.length),r.concat(t)}function C(e){return S(A(e))}function R(e,t,r,n){const i=[];for(;r<t+1+n;){const s=P(e,r);i.push(s.result),(r+=s.consumed)>t+1+n&&_.throwError("child data too short",d.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:i}}function P(e,t){if(0===e.length&&_.throwError("data too short",d.errors.BUFFER_OVERRUN,{}),e[t]>=248){const r=e[t]-247;t+1+r>e.length&&_.throwError("data short segment too short",d.errors.BUFFER_OVERRUN,{});const n=T(e,t+1,r);return t+1+r+n>e.length&&_.throwError("data long segment too short",d.errors.BUFFER_OVERRUN,{}),R(e,t,t+1+r,r+n)}if(e[t]>=192){const r=e[t]-192;return t+1+r>e.length&&_.throwError("data array too short",d.errors.BUFFER_OVERRUN,{}),R(e,t,t+1,r)}if(e[t]>=184){const r=e[t]-183;t+1+r>e.length&&_.throwError("data array too short",d.errors.BUFFER_OVERRUN,{});const n=T(e,t+1,r);t+1+r+n>e.length&&_.throwError("data array too short",d.errors.BUFFER_OVERRUN,{});return{consumed:1+r+n,result:S(e.slice(t+1+r,t+1+r+n))}}if(e[t]>=128){const r=e[t]-128;t+1+r>e.length&&_.throwError("data too short",d.errors.BUFFER_OVERRUN,{});return{consumed:1+r,result:S(e.slice(t+1,t+1+r))}}return{consumed:1,result:S(e[t])}}function k(e){const t=b(e),r=P(t,0);return r.consumed!==t.length&&_.throwArgumentError("invalid rlp data","data",e),r.result}},17612:e=>{const t=/^(\d{1,3}\.){3,3}\d{1,3}$/,r=/^(::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?$/i,n={name:"v4",size:4,isFormat:e=>t.test(e),encode(e,t,r){r=~~r,t=t||new Uint8Array(r+4);const n=e.length;let i=0;for(let s=0;s<n;){const n=e.charCodeAt(s++);46===n?(t[r++]=i,i=0):i=10*i+(n-48)}return t[r]=i,t},decode:(e,t)=>(t=~~t,"".concat(e[t++],".").concat(e[t++],".").concat(e[t++],".").concat(e[t]))},i={name:"v6",size:16,isFormat:e=>e.length>0&&r.test(e),encode(e,t,r){let n=(r=~~r)+16,i=-1,s=0,o=0,a=!0,c=!1;t=t||new Uint8Array(r+16);for(let u=0;u<e.length;u++){let l=e.charCodeAt(u);58===l?(a?-1!==i?(r<n&&(t[r]=0),r<n-1&&(t[r+1]=0),r+=2):r<n&&(i=r):(!0===c?(r<n&&(t[r]=o),r++):(r<n&&(t[r]=s>>8),r<n-1&&(t[r+1]=255&s),r+=2),s=0,o=0),a=!0,c=!1):46===l?(r<n&&(t[r]=o),r++,o=0,s=0,a=!1,c=!0):(a=!1,l>=97?l-=87:l>=65?l-=55:(l-=48,o=10*o+l),s=(s<<4)+l)}if(!1===a)!0===c?(r<n&&(t[r]=o),r++):(r<n&&(t[r]=s>>8),r<n-1&&(t[r+1]=255&s),r+=2);else if(0===i)r<n&&(t[r]=0),r<n-1&&(t[r+1]=0),r+=2;else if(-1!==i){r+=2;for(let e=Math.min(r-1,n-1);e>=i+2;e--)t[e]=t[e-2];t[i]=0,t[i+1]=0,i=r}if(i!==r&&-1!==i)for(r>n-2&&(r=n-2);n>i;)t[--n]=r<n&&r>i?t[--r]:0;else for(;r<n;)t[r++]=0;return t},decode(e,t){t=~~t;let r="";for(let n=0;n<16;n+=2)0!==n&&(r+=":"),r+=(e[t+n]<<8|e[t+n+1]).toString(16);return r.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3").replace(/:{3,4}/,"::")}};function s(e){if(n.isFormat(e))return n.size;if(i.isFormat(e))return i.size;throw Error("Invalid ip address: ".concat(e))}e.exports=Object.freeze({name:"ip",sizeOf:s,familyOf:e=>s(e)===n.size?1:2,v4:n,v6:i,encode(e,t,r){r=~~r;const o=s(e);return"function"===typeof t&&(t=t(r+o)),o===n.size?n.encode(e,t,r):i.encode(e,t,r)},decode(e,t,r){if(t=~~t,(r=r||e.length-t)===n.size)return n.decode(e,t,r);if(r===i.size)return i.decode(e,t,r);throw Error("Invalid buffer size needs to be ".concat(n.size," for v4 or ").concat(i.size," for v6."))}})},47835: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.utils=t.curve25519=t.getSharedSecret=t.verify=t.sign=t.getPublicKey=t.Signature=t.Point=t.RistrettoPoint=t.ExtendedPoint=t.CURVE=void 0;const i=n(r(43094)),s=BigInt(0),o=BigInt(1),a=BigInt(2),c=BigInt(255),u=a**BigInt(252)+BigInt("27742317777372353535851937790883648493"),l={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),P:a**c-BigInt(19),l:u,n:u,h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960")};t.CURVE=l;const h=a**BigInt(256),d=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),f=(BigInt("6853475219497561581579357271197624642482790079785650197046958215289687604742"),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235")),p=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),y=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),g=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952");class m{constructor(e,t,r,n){this.x=e,this.y=t,this.z=r,this.t=n}static fromAffine(e){if(!(e instanceof _))throw new TypeError("ExtendedPoint#fromAffine: expected Point");return e.equals(_.ZERO)?m.ZERO:new m(e.x,e.y,o,D(e.x*e.y))}static toAffineBatch(e){const t=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l.P;const r=new Array(e.length),n=L(e.reduce(((e,n,i)=>n===s?e:(r[i]=e,D(e*n,t))),o),t);return e.reduceRight(((e,n,i)=>n===s?e:(r[i]=D(e*r[i],t),D(e*n,t))),n),r}(e.map((e=>e.z)));return e.map(((e,r)=>e.toAffine(t[r])))}static normalizeZ(e){return this.toAffineBatch(e).map(this.fromAffine)}equals(e){v(e);const{x:t,y:r,z:n}=this,{x:i,y:s,z:o}=e,a=D(t*o),c=D(i*n),u=D(r*o),l=D(s*n);return a===c&&u===l}negate(){return new m(D(-this.x),this.y,this.z,D(-this.t))}double(){const{x:e,y:t,z:r}=this,{a:n}=l,i=D(e**a),s=D(t**a),o=D(a*D(r**a)),c=D(n*i),u=D(D((e+t)**a)-i-s),h=c+s,d=h-o,f=c-s,p=D(u*d),y=D(h*f),g=D(u*f),v=D(d*h);return new m(p,y,v,g)}add(e){v(e);const{x:t,y:r,z:n,t:i}=this,{x:o,y:c,z:u,t:l}=e,h=D((r-t)*(c+o)),d=D((r+t)*(c-o)),f=D(d-h);if(f===s)return this.double();const p=D(n*a*l),y=D(i*a*u),g=y+p,b=d+h,w=y-p,E=D(g*f),S=D(b*w),_=D(g*w),I=D(f*b);return new m(E,S,I,_)}subtract(e){return this.add(e.negate())}precomputeWindow(e){const t=1+256/e,r=[];let n=this,i=n;for(let s=0;s<t;s++){i=n,r.push(i);for(let t=1;t<2**(e-1);t++)i=i.add(n),r.push(i);n=i.double()}return r}wNAF(e,t){!t&&this.equals(m.BASE)&&(t=_.BASE);const r=t&&t._WINDOW_SIZE||1;if(256%r)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");let n=t&&S.get(t);n||(n=this.precomputeWindow(r),t&&1!==r&&(n=m.normalizeZ(n),S.set(t,n)));let i=m.ZERO,s=m.ZERO;const a=1+256/r,c=2**(r-1),u=BigInt(2**r-1),l=2**r,h=BigInt(r);for(let d=0;d<a;d++){const t=d*c;let r=Number(e&u);if(e>>=h,r>c&&(r-=l,e+=o),0===r){let e=n[t];d%2&&(e=e.negate()),s=s.add(e)}else{let e=n[t+Math.abs(r)-1];r<0&&(e=e.negate()),i=i.add(e)}}return m.normalizeZ([i,s])[0]}multiply(e,t){return this.wNAF(V(e,l.l),t)}multiplyUnsafe(e){let t=V(e,l.l,!1);const r=m.BASE,n=m.ZERO;if(t===s)return n;if(this.equals(n)||t===o)return this;if(this.equals(r))return this.wNAF(t);let i=n,a=this;for(;t>s;)t&o&&(i=i.add(a)),a=a.double(),t>>=o;return i}isSmallOrder(){return this.multiplyUnsafe(l.h).equals(m.ZERO)}isTorsionFree(){return this.multiplyUnsafe(l.l).equals(m.ZERO)}toAffine(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:L(this.z);const{x:t,y:r,z:n}=this,i=D(t*e),s=D(r*e);if(D(n*e)!==o)throw new Error("invZ was invalid");return new _(i,s)}fromRistrettoBytes(){w()}toRistrettoBytes(){w()}fromRistrettoHash(){w()}}function v(e){if(!(e instanceof m))throw new TypeError("ExtendedPoint expected")}function b(e){if(!(e instanceof E))throw new TypeError("RistrettoPoint expected")}function w(){throw new Error("Legacy method: switch to RistrettoPoint")}t.ExtendedPoint=m,m.BASE=new m(l.Gx,l.Gy,o,D(l.Gx*l.Gy)),m.ZERO=new m(s,o,o,s);class E{constructor(e){this.ep=e}static calcElligatorRistrettoMap(e){const{d:t}=l,r=D(d*e*e),n=D((r+o)*y);let i=BigInt(-1);const s=D((i-t*r)*D(r+t));let{isValid:a,value:c}=U(n,s),u=D(c*e);O(u)||(u=D(-u)),a||(c=u),a||(i=r);const h=D(i*(r-o)*g-s),p=c*c,v=D((c+c)*s),b=D(h*f),w=D(o-p),E=D(o+p);return new m(D(v*E),D(w*b),D(b*E),D(v*w))}static hashToCurve(e){const t=N((e=F(e,64)).slice(0,32)),r=this.calcElligatorRistrettoMap(t),n=N(e.slice(32,64)),i=this.calcElligatorRistrettoMap(n);return new E(r.add(i))}static fromHex(e){e=F(e,32);const{a:t,d:r}=l,n="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",i=N(e);if(!function(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}(k(i),e)||O(i))throw new Error(n);const a=D(i*i),c=D(o+t*a),u=D(o-t*a),h=D(c*c),d=D(u*u),f=D(t*r*h-d),{isValid:p,value:y}=K(D(f*d)),g=D(y*u),v=D(y*g*f);let b=D((i+i)*g);O(b)&&(b=D(-b));const w=D(c*v),S=D(b*w);if(!p||O(S)||w===s)throw new Error(n);return new E(new m(b,w,o,S))}toRawBytes(){let{x:e,y:t,z:r,t:n}=this.ep;const i=D(D(r+t)*D(r-t)),s=D(e*t),{value:o}=K(D(i*s**a)),c=D(o*i),u=D(o*s),l=D(c*u*n);let h;if(O(n*l)){let r=D(t*d),n=D(e*d);e=r,t=n,h=D(c*p)}else h=u;O(e*l)&&(t=D(-t));let f=D((r-t)*h);return O(f)&&(f=D(-f)),k(f)}toHex(){return C(this.toRawBytes())}toString(){return this.toHex()}equals(e){b(e);const t=this.ep,r=e.ep,n=D(t.x*r.y)===D(t.y*r.x),i=D(t.y*r.y)===D(t.x*r.x);return n||i}add(e){return b(e),new E(this.ep.add(e.ep))}subtract(e){return b(e),new E(this.ep.subtract(e.ep))}multiply(e){return new E(this.ep.multiply(e))}multiplyUnsafe(e){return new E(this.ep.multiplyUnsafe(e))}}t.RistrettoPoint=E,E.BASE=new E(m.BASE),E.ZERO=new E(m.ZERO);const S=new WeakMap;class _{constructor(e,t){this.x=e,this.y=t}_setWindowSize(e){this._WINDOW_SIZE=e,S.delete(this)}static fromHex(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const{d:r,P:n}=l,i=(e=F(e,32)).slice();i[31]=-129&e[31];const s=B(i);if(t&&s>=n)throw new Error("Expected 0 < hex < P");if(!t&&s>=h)throw new Error("Expected 0 < hex < 2**256");const a=D(s*s),c=D(a-o),u=D(r*a+o);let{isValid:d,value:f}=U(c,u);if(!d)throw new Error("Point.fromHex: invalid y coordinate");const p=(f&o)===o;return 0!==(128&e[31])!==p&&(f=D(-f)),new _(f,s)}static async fromPrivateKey(e){return(await z(e)).point}toRawBytes(){const e=k(this.y);return e[31]|=this.x&o?128:0,e}toHex(){return C(this.toRawBytes())}toX25519(){const{y:e}=this;return k(D((o+e)*L(o-e)))}isTorsionFree(){return m.fromAffine(this).isTorsionFree()}equals(e){return this.x===e.x&&this.y===e.y}negate(){return new _(D(-this.x),this.y)}add(e){return m.fromAffine(this).add(m.fromAffine(e)).toAffine()}subtract(e){return this.add(e.negate())}multiply(e){return m.fromAffine(this).multiply(e,this).toAffine()}}t.Point=_,_.BASE=new _(l.Gx,l.Gy),_.ZERO=new _(s,o);class I{constructor(e,t){this.r=e,this.s=t,this.assertValidity()}static fromHex(e){const t=F(e,64),r=_.fromHex(t.slice(0,32),!1),n=B(t.slice(32,64));return new I(r,n)}assertValidity(){const{r:e,s:t}=this;if(!(e instanceof _))throw new Error("Expected Point instance");return V(t,l.l,!1),this}toRawBytes(){const e=new Uint8Array(64);return e.set(this.r.toRawBytes()),e.set(k(this.s),32),e}toHex(){return C(this.toRawBytes())}}function T(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(!t.every((e=>e instanceof Uint8Array)))throw new Error("Expected Uint8Array list");if(1===t.length)return t[0];const n=t.reduce(((e,t)=>e+t.length),0),i=new Uint8Array(n);for(let s=0,o=0;s<t.length;s++){const e=t[s];i.set(e,o),o+=e.length}return i}t.Signature=I;const A=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function C(e){if(!(e instanceof Uint8Array))throw new Error("Uint8Array expected");let t="";for(let r=0;r<e.length;r++)t+=A[e[r]];return t}function R(e){if("string"!==typeof e)throw new TypeError("hexToBytes: expected string, got "+typeof e);if(e.length%2)throw new Error("hexToBytes: received invalid unpadded hex");const t=new Uint8Array(e.length/2);for(let r=0;r<t.length;r++){const n=2*r,i=e.slice(n,n+2),s=Number.parseInt(i,16);if(Number.isNaN(s)||s<0)throw new Error("Invalid byte sequence");t[r]=s}return t}function P(e){return R(e.toString(16).padStart(64,"0"))}function k(e){return P(e).reverse()}function O(e){return(D(e)&o)===o}function B(e){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");return BigInt("0x"+C(Uint8Array.from(e).reverse()))}function N(e){return D(B(e)&a**c-o)}function D(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l.P;const r=e%t;return r>=s?r:t+r}function L(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l.P;if(e===s||t<=s)throw new Error("invert: expected positive integers, got n=".concat(e," mod=").concat(t));let r=D(e,t),n=t,i=s,a=o,c=o,u=s;for(;r!==s;){const e=n/r,t=n%r,s=i-c*e,o=a-u*e;n=r,r=t,i=c,a=u,c=s,u=o}const h=n;if(h!==o)throw new Error("invert: does not exist");return D(i,t)}function x(e,t){const{P:r}=l;let n=e;for(;t-- >s;)n*=n,n%=r;return n}function M(e){const{P:t}=l,r=BigInt(5),n=BigInt(10),i=BigInt(20),s=BigInt(40),c=BigInt(80),u=e*e%t*e%t,h=x(u,a)*u%t,d=x(h,o)*e%t,f=x(d,r)*d%t,p=x(f,n)*f%t,y=x(p,i)*p%t,g=x(y,s)*y%t,m=x(g,c)*g%t,v=x(m,c)*g%t,b=x(v,n)*f%t;return{pow_p_5_8:x(b,a)*e%t,b2:u}}function U(e,t){const r=D(t*t*t),n=D(r*r*t);let i=D(e*r*M(e*n).pow_p_5_8);const s=D(t*i*i),o=i,a=D(i*d),c=s===e,u=s===D(-e),l=s===D(-e*d);return c&&(i=o),(u||l)&&(i=a),O(i)&&(i=D(-i)),{isValid:c||u,value:i}}function K(e){return U(o,e)}async function j(){const e=await t.utils.sha512(T(...arguments)),r=B(e);return D(r,l.l)}function F(e,t){const r=e instanceof Uint8Array?Uint8Array.from(e):R(e);if("number"===typeof t&&r.length!==t)throw new Error("Expected ".concat(t," bytes"));return r}function V(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!t)throw new TypeError("Specify max value");if("number"===typeof e&&Number.isSafeInteger(e)&&(e=BigInt(e)),"bigint"===typeof e&&e<t)if(r){if(s<e)return e}else if(s<=e)return e;throw new TypeError("Expected valid scalar: 0 < scalar < max")}function q(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}async function z(e){if(32!==(e="bigint"===typeof e||"number"===typeof e?P(V(e,h)):F(e)).length)throw new Error("Expected 32 bytes");const r=await t.utils.sha512(e),n=q(r.slice(0,32)),i=r.slice(32,64),s=D(B(n),l.l),o=_.BASE.multiply(s),a=o.toRawBytes();return{head:n,prefix:i,scalar:s,point:o,pointBytes:a}}function H(e,t,r){const n=D(e*(t-r));return[t=D(t-n),r=D(r+n)]}t.getPublicKey=async function(e){return(await z(e)).pointBytes},t.sign=async function(e,t){e=F(e);const{prefix:r,scalar:n,pointBytes:i}=await z(t),s=await j(r,e),o=_.BASE.multiply(s),a=D(s+await j(o.toRawBytes(),i,e)*n,l.l);return new I(o,a).toRawBytes()},t.verify=async function(e,t,r){t=F(t),r instanceof _||(r=_.fromHex(r,!1));const{r:n,s:i}=e instanceof I?e.assertValidity():I.fromHex(e),s=m.BASE.multiplyUnsafe(i),o=await j(n.toRawBytes(),r.toRawBytes(),t),a=m.fromAffine(r).multiplyUnsafe(o);return m.fromAffine(n).add(a).subtract(s).multiplyUnsafe(l.h).equals(m.ZERO)},t.getSharedSecret=async function(e,r){const{head:n}=await z(e),i=_.fromHex(r).toX25519();return t.curve25519.scalarMult(n,i)},_.BASE._setWindowSize(8),t.curve25519={BASE_POINT_U:"0900000000000000000000000000000000000000000000000000000000000000",scalarMult(e,t){const r=function(e,t){const{P:r}=l,n=V(e,r),i=V(t,r),c=BigInt(121665),u=n;let h,d=o,f=s,p=n,y=o,g=s;for(let l=BigInt(254);l>=s;l--){const e=i>>l&o;g^=e,h=H(g,d,p),d=h[0],p=h[1],h=H(g,f,y),f=h[0],y=h[1],g=e;const t=d+f,r=D(t*t),n=d-f,s=D(n*n),m=r-s,v=p+y,b=D((p-y)*t),w=D(v*n);p=D((b+w)**a),y=D(u*(b-w)**a),d=D(r*s),f=D(m*(r+D(c*m)))}h=H(g,d,p),d=h[0],p=h[1],h=H(g,f,y),f=h[0],y=h[1];const{pow_p_5_8:m,b2:v}=M(f),b=D(x(m,BigInt(3))*v);return D(d*b)}(function(e){const t=F(e,32);return t[31]&=127,B(t)}(t),B(q(F(e,32))));if(r===s)throw new Error("Invalid private or public key received");return function(e){return k(D(e,l.P))}(r)},scalarMultBase:e=>t.curve25519.scalarMult(e,t.curve25519.BASE_POINT_U)};const G={node:i.default,web:"object"===typeof self&&"crypto"in self?self.crypto:void 0};t.utils={TORSION_SUBGROUP:["0100000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a","0000000000000000000000000000000000000000000000000000000000000080","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05","ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f","26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85","0000000000000000000000000000000000000000000000000000000000000000","c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa"],bytesToHex:C,getExtendedPublicKey:z,mod:D,invert:L,hashToPrivateScalar:e=>{if((e=F(e)).length<40||e.length>1024)throw new Error("Expected 40-1024 bytes of private key as per FIPS 186");const t=D(B(e),l.l);if(t===s||t===o)throw new Error("Invalid private key");return t},randomBytes:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:32;if(G.web)return G.web.getRandomValues(new Uint8Array(e));if(G.node){const{randomBytes:t}=G.node;return new Uint8Array(t(e).buffer)}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>t.utils.randomBytes(32),sha512:async e=>{if(G.web){const t=await G.web.subtle.digest("SHA-512",e.buffer);return new Uint8Array(t)}if(G.node)return Uint8Array.from(G.node.createHash("sha512").update(e).digest());throw new Error("The environment doesn't have sha512 function")},precompute(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:8,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_.BASE;const r=t.equals(_.BASE)?t:new _(t.x,t.y);return r._setWindowSize(e),r.multiply(a),r}}},53845: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.utils=t.schnorr=t.verify=t.signSync=t.sign=t.getSharedSecret=t.recoverPublicKey=t.getPublicKey=t.Signature=t.Point=t.CURVE=void 0;const i=n(r(69159)),s=BigInt(0),o=BigInt(1),a=BigInt(2),c=BigInt(3),u=BigInt(8),l=a**BigInt(256),h={a:s,b:BigInt(7),P:l-a**BigInt(32)-BigInt(977),n:l-BigInt("432420386565659656852420866394968145599"),h:o,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee")};function d(e){const{a:t,b:r}=h,n=B(e*e),i=B(n*e);return B(i+t*e+r)}t.CURVE=h;const f=h.a===s;class p{constructor(e,t,r){this.x=e,this.y=t,this.z=r}static fromAffine(e){if(!(e instanceof g))throw new TypeError("JacobianPoint#fromAffine: expected Point");return new p(e.x,e.y,o)}static toAffineBatch(e){const t=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:h.P;const r=new Array(e.length),n=D(e.reduce(((e,n,i)=>n===s?e:(r[i]=e,B(e*n,t))),o),t);return e.reduceRight(((e,n,i)=>n===s?e:(r[i]=B(e*r[i],t),B(e*n,t))),n),r}(e.map((e=>e.z)));return e.map(((e,r)=>e.toAffine(t[r])))}static normalizeZ(e){return p.toAffineBatch(e).map(p.fromAffine)}equals(e){if(!(e instanceof p))throw new TypeError("JacobianPoint expected");const{x:t,y:r,z:n}=this,{x:i,y:s,z:o}=e,c=B(n**a),u=B(o**a),l=B(t*u),h=B(i*c),d=B(B(r*o)*u),f=B(B(s*n)*c);return l===h&&d===f}negate(){return new p(this.x,B(-this.y),this.z)}double(){const{x:e,y:t,z:r}=this,n=B(e**a),i=B(t**a),s=B(i**a),o=B(a*(B((e+i)**a)-n-s)),l=B(c*n),h=B(l**a),d=B(h-a*o),f=B(l*(o-d)-u*s),y=B(a*t*r);return new p(d,f,y)}add(e){if(!(e instanceof p))throw new TypeError("JacobianPoint expected");const{x:t,y:r,z:n}=this,{x:i,y:o,z:c}=e;if(i===s||o===s)return this;if(t===s||r===s)return e;const u=B(n**a),l=B(c**a),h=B(t*l),d=B(i*u),f=B(B(r*c)*l),y=B(B(o*n)*u),g=B(d-h),m=B(y-f);if(g===s)return m===s?this.double():p.ZERO;const v=B(g**a),b=B(g*v),w=B(h*v),E=B(m**a-b-a*w),S=B(m*(w-E)-f*b),_=B(n*c*g);return new p(E,S,_)}subtract(e){return this.add(e.negate())}multiplyUnsafe(e){let t=O(e);const r=p.BASE,n=p.ZERO;if(t===s)return n;if(this.equals(n)||t===o)return this;if(this.equals(r))return this.wNAF(t).p;if(!f){let e=n,r=this;for(;t>s;)t&o&&(e=e.add(r)),r=r.double(),t>>=o;return e}let{k1neg:i,k1:a,k2neg:c,k2:u}=M(t),l=n,d=n,y=this;for(;a>s||u>s;)a&o&&(l=l.add(y)),u&o&&(d=d.add(y)),y=y.double(),a>>=o,u>>=o;return i&&(l=l.negate()),c&&(d=d.negate()),d=new p(B(d.x*h.beta),d.y,d.z),l.add(d)}precomputeWindow(e){const t=f?128/e+1:256/e+1,r=[];let n=this,i=n;for(let s=0;s<t;s++){i=n,r.push(i);for(let t=1;t<2**(e-1);t++)i=i.add(n),r.push(i);n=i.double()}return r}wNAF(e,t){!t&&this.equals(p.BASE)&&(t=g.BASE);const r=t&&t._WINDOW_SIZE||1;if(256%r)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");let n=t&&y.get(t);n||(n=this.precomputeWindow(r),t&&1!==r&&(n=p.normalizeZ(n),y.set(t,n)));let i=p.ZERO,s=p.ZERO;const a=1+(f?128/r:256/r),c=2**(r-1),u=BigInt(2**r-1),l=2**r,h=BigInt(r);for(let d=0;d<a;d++){const t=d*c;let r=Number(e&u);if(e>>=h,r>c&&(r-=l,e+=o),0===r){let e=n[t];d%2&&(e=e.negate()),s=s.add(e)}else{let e=n[t+Math.abs(r)-1];r<0&&(e=e.negate()),i=i.add(e)}}return{p:i,f:s}}multiply(e,t){let r,n,i=O(e);if(f){const{k1neg:e,k1:s,k2neg:o,k2:a}=M(i);let{p:c,f:u}=this.wNAF(s,t),{p:l,f:d}=this.wNAF(a,t);e&&(c=c.negate()),o&&(l=l.negate()),l=new p(B(l.x*h.beta),l.y,l.z),r=c.add(l),n=u.add(d)}else{const{p:e,f:s}=this.wNAF(i,t);r=e,n=s}return p.normalizeZ([r,n])[0]}toAffine(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:D(this.z);const{x:t,y:r,z:n}=this,i=e,s=B(i*i),a=B(s*i),c=B(t*s),u=B(r*a);if(B(n*i)!==o)throw new Error("invZ was invalid");return new g(c,u)}}p.BASE=new p(h.Gx,h.Gy,o),p.ZERO=new p(s,o,s);const y=new WeakMap;class g{constructor(e,t){this.x=e,this.y=t}_setWindowSize(e){this._WINDOW_SIZE=e,y.delete(this)}static fromCompressedHex(e){const t=32===e.length,r=P(t?e:e.slice(1));if(!F(r))throw new Error("Point is not on curve");let n=function(e){const{P:t}=h,r=BigInt(6),n=BigInt(11),i=BigInt(22),s=BigInt(23),o=BigInt(44),u=BigInt(88),l=e*e*e%t,d=l*l*e%t,f=N(d,c)*d%t,p=N(f,c)*d%t,y=N(p,a)*l%t,g=N(y,n)*y%t,m=N(g,i)*g%t,v=N(m,o)*m%t,b=N(v,u)*v%t,w=N(b,o)*m%t,E=N(w,c)*d%t,S=N(E,s)*g%t,_=N(S,r)*l%t;return N(_,a)}(d(r));const i=(n&o)===o;if(t)i&&(n=B(-n));else{1===(1&e[0])!==i&&(n=B(-n))}const s=new g(r,n);return s.assertValidity(),s}static fromUncompressedHex(e){const t=P(e.slice(1,33)),r=P(e.slice(33)),n=new g(t,r);return n.assertValidity(),n}static fromHex(e){const t=k(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 ".concat(t.length))}static fromPrivateKey(e){return g.BASE.multiply(q(e))}static fromSignature(e,t,r){const n=U(e=k(e)),{r:i,s:o}=H(t);if(0!==r&&1!==r)throw new Error("Cannot recover signature: invalid recovery bit");if(n===s)throw new Error("Cannot recover signature: msgHash cannot be 0");const a=2+(1&r),c=g.fromHex("0".concat(a).concat(I(i))),u=p.fromAffine(c).multiplyUnsafe(o),l=p.BASE.multiply(n),d=D(i,h.n),f=u.subtract(l).multiplyUnsafe(d).toAffine();return f.assertValidity(),f}toRawBytes(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return R(this.toHex(e))}toHex(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=I(this.x);return e?"".concat(this.y&o?"03":"02").concat(t):"04".concat(t).concat(I(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",{x:t,y:r}=this;if(!F(t)||!F(r))throw new Error(e);const n=B(r*r);if(B(n-d(t))!==s)throw new Error(e)}equals(e){return this.x===e.x&&this.y===e.y}negate(){return new g(this.x,B(-this.y))}double(){return p.fromAffine(this).double().toAffine()}add(e){return p.fromAffine(this).add(p.fromAffine(e)).toAffine()}subtract(e){return this.add(e.negate())}multiply(e){return p.fromAffine(this).multiply(e,this).toAffine()}}function m(e){return Number.parseInt(e[0],16)>=8?"00"+e:e}function v(e){if(e.length<2||2!==e[0])throw new Error("Invalid signature integer tag: ".concat(_(e)));const t=e[1],r=e.subarray(2,t+2);if(!t||r.length!==t)throw new Error("Invalid signature integer: wrong length");if(0===r[0]&&r[1]<=127)throw new Error("Invalid signature integer: trailing length");return{data:P(r),left:e.subarray(t+2)}}t.Point=g,g.BASE=new g(h.Gx,h.Gy),g.ZERO=new g(s,s);class b{constructor(e,t){this.r=e,this.s=t,this.assertValidity()}static fromCompact(e){const t=E(e),r="Signature.fromCompact";if("string"!==typeof e&&!t)throw new TypeError("".concat(r,": Expected string or Uint8Array"));const n=t?_(e):e;if(128!==n.length)throw new Error("".concat(r,": Expected 64-byte hex"));return new b(C(n.slice(0,64)),C(n.slice(64,128)))}static fromDER(e){const t=E(e);if("string"!==typeof e&&!t)throw new TypeError("Signature.fromDER: Expected string or Uint8Array");const{r:r,s:n}=function(e){if(e.length<2||48!=e[0])throw new Error("Invalid signature tag: ".concat(_(e)));if(e[1]!==e.length-2)throw new Error("Invalid signature: incorrect length");const{data:t,left:r}=v(e.subarray(2)),{data:n,left:i}=v(r);if(i.length)throw new Error("Invalid signature: left bytes after parsing: ".concat(_(i)));return{r:t,s:n}}(t?e:R(e));return new b(r,n)}static fromHex(e){return this.fromDER(e)}assertValidity(){const{r:e,s:t}=this;if(!j(e))throw new Error("Invalid Signature: r must be 0 < r < n");if(!j(t))throw new Error("Invalid Signature: s must be 0 < s < n")}hasHighS(){const e=h.n>>o;return this.s>e}normalizeS(){return this.hasHighS()?new b(this.r,h.n-this.s):this}toDERRawBytes(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return R(this.toDERHex(e))}toDERHex(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=m(A(this.s));if(e)return t;const r=m(A(this.r)),n=A(r.length/2),i=A(t.length/2),s=A(r.length/2+t.length/2+4);return"30".concat(s,"02").concat(n).concat(r,"02").concat(i).concat(t)}toRawBytes(){return this.toDERRawBytes()}toHex(){return this.toDERHex()}toCompactRawBytes(){return R(this.toCompactHex())}toCompactHex(){return I(this.r)+I(this.s)}}function w(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(!t.every(E))throw new Error("Uint8Array list expected");if(1===t.length)return t[0];const n=t.reduce(((e,t)=>e+t.length),0),i=new Uint8Array(n);for(let s=0,o=0;s<t.length;s++){const e=t[s];i.set(e,o),o+=e.length}return i}function E(e){return e instanceof Uint8Array}t.Signature=b;const S=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function _(e){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");let t="";for(let r=0;r<e.length;r++)t+=S[e[r]];return t}function I(e){if(e>l)throw new Error("Expected number < 2^256");return e.toString(16).padStart(64,"0")}function T(e){return R(I(e))}function A(e){const t=e.toString(16);return 1&t.length?"0".concat(t):t}function C(e){if("string"!==typeof e)throw new TypeError("hexToNumber: expected string, got "+typeof e);return BigInt("0x".concat(e))}function R(e){if("string"!==typeof e)throw new TypeError("hexToBytes: expected string, got "+typeof e);if(e.length%2)throw new Error("hexToBytes: received invalid unpadded hex"+e.length);const t=new Uint8Array(e.length/2);for(let r=0;r<t.length;r++){const n=2*r,i=e.slice(n,n+2),s=Number.parseInt(i,16);if(Number.isNaN(s)||s<0)throw new Error("Invalid byte sequence");t[r]=s}return t}function P(e){return C(_(e))}function k(e){return e instanceof Uint8Array?Uint8Array.from(e):R(e)}function O(e){if("number"===typeof e&&Number.isSafeInteger(e)&&e>0)return BigInt(e);if("bigint"===typeof e&&j(e))return e;throw new TypeError("Expected valid private scalar: 0 < scalar < curve.n")}function B(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:h.P;const r=e%t;return r>=s?r:t+r}function N(e,t){const{P:r}=h;let n=e;for(;t-- >s;)n*=n,n%=r;return n}function D(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:h.P;if(e===s||t<=s)throw new Error("invert: expected positive integers, got n=".concat(e," mod=").concat(t));let r=B(e,t),n=t,i=s,a=o,c=o,u=s;for(;r!==s;){const e=n/r,t=n%r,s=i-c*e,o=a-u*e;n=r,r=t,i=c,a=u,c=s,u=o}const l=n;if(l!==o)throw new Error("invert: does not exist");return B(i,t)}const L=(e,t)=>(e+t/a)/t,x=a**BigInt(128);function M(e){const{n:t}=h,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-o*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,a=L(s*e,t),c=L(-n*e,t);let u=B(e-a*r-c*i,t),l=B(-a*n-c*s,t);const d=u>x,f=l>x;if(d&&(u=t-u),f&&(l=t-l),u>x||l>x)throw new Error("splitScalarEndo: Endomorphism failed, k="+e);return{k1neg:d,k1:u,k2neg:f,k2:l}}function U(e){const{n:t}=h,r=8*e.length-256;let n=P(e);return r>0&&(n>>=BigInt(r)),n>=t&&(n-=t),n}class K{constructor(){this.v=new Uint8Array(32).fill(1),this.k=new Uint8Array(32).fill(0),this.counter=0}hmac(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return t.utils.hmacSha256(this.k,...r)}hmacSync(){if("function"!==typeof t.utils.hmacSha256Sync)throw new Error("utils.hmacSha256Sync is undefined, you need to set it");for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];const i=t.utils.hmacSha256Sync(this.k,...r);if(i instanceof Promise)throw new Error("To use sync sign(), ensure utils.hmacSha256 is sync");return i}incr(){if(this.counter>=1e3)throw new Error("Tried 1,000 k values for sign(), all were invalid");this.counter+=1}async reseed(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Uint8Array;this.k=await this.hmac(this.v,Uint8Array.from([0]),e),this.v=await this.hmac(this.v),0!==e.length&&(this.k=await this.hmac(this.v,Uint8Array.from([1]),e),this.v=await this.hmac(this.v))}reseedSync(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Uint8Array;this.k=this.hmacSync(this.v,Uint8Array.from([0]),e),this.v=this.hmacSync(this.v),0!==e.length&&(this.k=this.hmacSync(this.v,Uint8Array.from([1]),e),this.v=this.hmacSync(this.v))}async generate(){return this.incr(),this.v=await this.hmac(this.v),this.v}generateSync(){return this.incr(),this.v=this.hmacSync(this.v),this.v}}function j(e){return s<e&&e<h.n}function F(e){return s<e&&e<h.P}function V(e,t,r){const n=P(e);if(!j(n))return;const{n:i}=h,a=g.BASE.multiply(n),c=B(a.x,i);if(c===s)return;const u=B(D(n,i)*B(t+r*c,i),i);if(u===s)return;const l=new b(c,u);return{sig:l,recovery:(a.x===l.r?0:2)|Number(a.y&o)}}function q(e){let t;if("bigint"===typeof e)t=e;else if("number"===typeof e&&Number.isSafeInteger(e)&&e>0)t=BigInt(e);else if("string"===typeof e){if(64!==e.length)throw new Error("Expected 32 bytes of private key");t=C(e)}else{if(!E(e))throw new TypeError("Expected valid private key");if(32!==e.length)throw new Error("Expected 32 bytes of private key");t=P(e)}if(!j(t))throw new Error("Expected private key: 0 < key < n");return t}function z(e){return e instanceof g?(e.assertValidity(),e):g.fromHex(e)}function H(e){if(e instanceof b)return e.assertValidity(),e;try{return b.fromDER(e)}catch(t){return b.fromCompact(e)}}function G(e){const t=E(e),r="string"===typeof e,n=(t||r)&&e.length;return t?33===n||65===n:r?66===n||130===n:e instanceof g}function W(e){return P(e.length>32?e.slice(0,32):e)}function Y(e){const t=W(e),r=B(t,h.n);return Q(r<s?t:r)}function Q(e){if("bigint"!==typeof e)throw new Error("Expected bigint");return R(I(e))}function J(e,r,n){if(null==e)throw new Error('sign: expected valid message hash, not "'.concat(e,'"'));const i=k(e),s=q(r),o=[Q(s),Y(i)];if(null!=n){!0===n&&(n=t.utils.randomBytes(32));const e=k(n);if(32!==e.length)throw new Error("sign: Expected 32 bytes of extra data");o.push(e)}return{seed:w(...o),m:W(i),d:s}}function X(e,t){let{sig:r,recovery:n}=e;const{canonical:i,der:s,recovered:o}=Object.assign({canonical:!0,der:!0},t);i&&r.hasHighS()&&(r=r.normalizeS(),n^=1);const a=s?r.toDERRawBytes():r.toCompactRawBytes();return o?[a,n]:a}t.getPublicKey=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return g.fromPrivateKey(e).toRawBytes(t)},t.recoverPublicKey=function(e,t,r){return g.fromSignature(e,t,r).toRawBytes()},t.getSharedSecret=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(G(e))throw new TypeError("getSharedSecret: first arg must be private key");if(!G(t))throw new TypeError("getSharedSecret: second arg must be public key");const n=z(t);return n.assertValidity(),n.multiply(q(e)).toRawBytes(r)},t.sign=async function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{seed:n,m:i,d:s}=J(e,t,r.extraEntropy);let o;const a=new K;for(await a.reseed(n);!(o=V(await a.generate(),i,s));)await a.reseed();return X(o,r)},t.signSync=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{seed:n,m:i,d:s}=J(e,t,r.extraEntropy);let o;const a=new K;for(a.reseedSync(n);!(o=V(a.generateSync(),i,s));)a.reseedSync();return X(o,r)};const $={strict:!0};async function Z(e){const r=new Uint8Array(e.split("").map((e=>e.charCodeAt(0)))),n=await t.utils.sha256(r);for(var i=arguments.length,s=new Array(i>1?i-1:0),o=1;o<i;o++)s[o-1]=arguments[o];const a=await t.utils.sha256(w(n,n,...s));return P(a)}async function ee(e,t,r){const n=T(e);return B(await Z("BIP0340/challenge",n,t.toRawX(),r),h.n)}function te(e){return B(e.y,a)===s}t.verify=function(e,t,r){let n,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:$;try{n=H(e),t=k(t)}catch(w){return!1}const{r:o,s:a}=n;if(i.strict&&n.hasHighS())return!1;const c=U(t);if(c===s)return!1;let u;try{u=p.fromAffine(z(r))}catch(w){return!1}const{n:l}=h,d=D(a,l),f=B(c*d,l),y=B(o*d,l),g=p.BASE.multiply(f),m=u.multiplyUnsafe(y),v=g.add(m).toAffine(),b=B(v.x,l);return b===o};class re{constructor(e,t){if(this.r=e,this.s=t,!F(e)||!j(t))throw new Error("Invalid signature")}static fromHex(e){const t=k(e);if(64!==t.length)throw new TypeError("SchnorrSignature.fromHex: expected 64 bytes, not ".concat(t.length));const r=P(t.slice(0,32)),n=P(t.slice(32,64));return new re(r,n)}toHex(){return I(this.r)+I(this.s)}toRawBytes(){return R(this.toHex())}}async function ne(e,t,r){const n=e instanceof re?e:re.fromHex(e),i=k(t),s=z(r),o=await ee(n.r,s,i),a=g.fromPrivateKey(n.s),c=s.multiply(o),u=a.subtract(c);return!(u.equals(g.BASE)||!te(u)||u.x!==n.r)}t.schnorr={Signature:re,getPublicKey:function(e){return g.fromPrivateKey(e).toRawX()},sign:async function(e,r){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.utils.randomBytes();if(null==e)throw new TypeError('sign: Expected valid message, not "'.concat(e,'"'));const{n:i}=h,o=k(e),a=q(r),c=k(n);if(32!==c.length)throw new TypeError("sign: Expected 32 bytes of aux randomness");const u=g.fromPrivateKey(a),l=te(u)?a:i-a,d=await Z("BIP0340/aux",c),f=l^d,p=await Z("BIP0340/nonce",T(f),u.toRawX(),o),y=B(p,i);if(y===s)throw new Error("sign: Creation of signature failed. k is zero");const m=g.fromPrivateKey(y),v=te(m)?y:i-y,b=await ee(m.x,u,o),w=new re(m.x,B(v+b*l,i)),E=await ne(w.toRawBytes(),o,u.toRawX());if(!E)throw new Error("sign: Invalid signature produced");return w.toRawBytes()},verify:ne},g.BASE._setWindowSize(8);const ie={node:i.default,web:"object"===typeof self&&"crypto"in self?self.crypto:void 0};t.utils={isValidPrivateKey(e){try{return q(e),!0}catch(t){return!1}},hashToPrivateKey:e=>{if((e=k(e)).length<40||e.length>1024)throw new Error("Expected 40-1024 bytes of private key as per FIPS 186");const t=B(P(e),h.n);if(t===s||t===o)throw new Error("Invalid private key");return T(t)},randomBytes:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:32;if(ie.web)return ie.web.getRandomValues(new Uint8Array(e));if(ie.node){const{randomBytes:t}=ie.node;return Uint8Array.from(t(e))}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:()=>t.utils.hashToPrivateKey(t.utils.randomBytes(40)),bytesToHex:_,mod:B,sha256:async e=>{if(ie.web){const t=await ie.web.subtle.digest("SHA-256",e.buffer);return new Uint8Array(t)}if(ie.node){const{createHash:t}=ie.node;return Uint8Array.from(t("sha256").update(e).digest())}throw new Error("The environment doesn't have sha256 function")},hmacSha256:async function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if(ie.web){const t=await ie.web.subtle.importKey("raw",e,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),n=w(...r),i=await ie.web.subtle.sign("HMAC",t,n);return new Uint8Array(i)}if(ie.node){const{createHmac:t}=ie.node,n=t("sha256",e);return r.forEach((e=>n.update(e))),Uint8Array.from(n.digest())}throw new Error("The environment doesn't have hmac-sha256 function")},sha256Sync:void 0,hmacSha256Sync:void 0,precompute(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:8,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g.BASE;const r=t===g.BASE?t:new g(t.x,t.y);return r._setWindowSize(e),r.multiply(c),r}}},17206:e=>{"use strict";e.exports=function(e,t){var r=new Array(arguments.length-1),n=0,i=2,s=!0;for(;i<arguments.length;)r[n++]=arguments[i++];return new Promise((function(i,o){r[n]=function(e){if(s)if(s=!1,e)o(e);else{for(var t=new Array(arguments.length-1),r=0;r<t.length;)t[r++]=arguments[r];i.apply(null,t)}};try{e.apply(t||null,r)}catch(a){s&&(s=!1,o(a))}}))}},70001:(e,t)=>{"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),s=0;s<64;)i[n[s]=s<26?s+65:s<52?s+71:s<62?s-4:s-59|43]=s++;r.encode=function(e,t,r){for(var i,s=null,o=[],a=0,c=0;t<r;){var u=e[t++];switch(c){case 0:o[a++]=n[u>>2],i=(3&u)<<4,c=1;break;case 1:o[a++]=n[i|u>>4],i=(15&u)<<2,c=2;break;case 2:o[a++]=n[i|u>>6],o[a++]=n[63&u],c=0}a>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,o)),a=0)}return c&&(o[a++]=n[i],o[a++]=61,1===c&&(o[a++]=61)),s?(a&&s.push(String.fromCharCode.apply(String,o.slice(0,a))),s.join("")):String.fromCharCode.apply(String,o.slice(0,a))};var o="invalid encoding";r.decode=function(e,t,r){for(var n,s=r,a=0,c=0;c<e.length;){var u=e.charCodeAt(c++);if(61===u&&a>1)break;if(void 0===(u=i[u]))throw Error(o);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(o);return r-s},r.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},33297:e=>{"use strict";function t(e,r){"string"===typeof e&&(r=e,e=void 0);var n=[];function i(e){if("string"!==typeof e){var r=s();if(t.verbose&&console.log("codegen: "+r),r="return "+r,e){for(var o=Object.keys(e),a=new Array(o.length+1),c=new Array(o.length),u=0;u<o.length;)a[u]=o[u],c[u]=e[o[u++]];return a[u]=r,Function.apply(null,a).apply(null,c)}return Function(r)()}for(var l=new Array(arguments.length-1),h=0;h<l.length;)l[h]=arguments[++h];if(h=0,e=e.replace(/%([%dfijs])/g,(function(e,t){var r=l[h++];switch(t){case"d":case"f":return String(Number(r));case"i":return String(Math.floor(r));case"j":return JSON.stringify(r);case"s":return String(r)}return"%"})),h!==l.length)throw Error("parameter count mismatch");return n.push(e),i}function s(t){return"function "+(t||r||"")+"("+(e&&e.join(",")||"")+"){\n "+n.join("\n ")+"\n}"}return i.toString=s,i}e.exports=t,t.verbose=!1},27111: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<r.length;)r[n].fn===t?r.splice(n,1):++n;return this},t.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var r=[],n=1;n<arguments.length;)r.push(arguments[n++]);for(n=0;n<t.length;)t[n].fn.apply(t[n++].ctx,r)}return this}},37635:(e,t,r)=>{"use strict";e.exports=s;var n=r(17206),i=r(77172)("fs");function s(e,t,r){return"function"===typeof t?(r=t,t={}):t||(t={}),r?!t.xhr&&i&&i.readFile?i.readFile(e,(function(n,i){return n&&"undefined"!==typeof XMLHttpRequest?s.xhr(e,t,r):n?r(n):r(null,t.binary?i:i.toString("utf8"))})):s.xhr(e,t,r):n(s,this,e,t)}s.xhr=function(e,t,r){var n=new XMLHttpRequest;n.onreadystatechange=function(){if(4===n.readyState){if(0!==n.status&&200!==n.status)return r(Error("status "+n.status));if(t.binary){var e=n.response;if(!e){e=[];for(var i=0;i<n.responseText.length;++i)e.push(255&n.responseText.charCodeAt(i))}return r(null,"undefined"!==typeof Uint8Array?new Uint8Array(e):e)}return r(null,n.responseText)}},t.binary&&("overrideMimeType"in n&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.responseType="arraybuffer"),n.open("GET",e),n.send()}},30802:e=>{"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 s(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 o(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:s,e.writeFloatBE=n?s:i,e.readFloatLE=n?o:a,e.readFloatBE=n?a:o}():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 s=Math.floor(Math.log(t)/Math.LN2);e((i<<31|s+127<<23|8388607&Math.round(t*Math.pow(2,-s)*8388608))>>>0,r,n)}}function o(e,t,r){var n=e(t,r),i=2*(n>>31)+1,s=n>>>23&255,o=8388607&n;return 255===s?o?NaN:i*(1/0):0===s?1401298464324817e-60*i*o:i*Math.pow(2,s-150)*(o+8388608)}e.writeFloatLE=t.bind(null,r),e.writeFloatBE=t.bind(null,n),e.readFloatLE=o.bind(null,i),e.readFloatBE=o.bind(null,s)}(),"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 s(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 o(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:s,e.writeDoubleBE=n?s:i,e.readDoubleLE=n?o:a,e.readDoubleBE=n?a:o}():function(){function t(e,t,r,n,i,s){var o=n<0?1:0;if(o&&(n=-n),0===n)e(0,i,s+t),e(1/n>0?0:2147483648,i,s+r);else if(isNaN(n))e(0,i,s+t),e(2146959360,i,s+r);else if(n>17976931348623157e292)e(0,i,s+t),e((o<<31|2146435072)>>>0,i,s+r);else{var a;if(n<22250738585072014e-324)e((a=n/5e-324)>>>0,i,s+t),e((o<<31|a/4294967296)>>>0,i,s+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,s+t),e((o<<31|c+1023<<20|1048576*a&1048575)>>>0,i,s+r)}}}function o(e,t,r,n,i){var s=e(n,i+t),o=e(n,i+r),a=2*(o>>31)+1,c=o>>>20&2047,u=4294967296*(1048575&o)+s;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=o.bind(null,i,0,4),e.readDoubleBE=o.bind(null,s,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 s(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}e.exports=t(t)},77172: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},77468:(e,t)=>{"use strict";var r=t,n=r.isAbsolute=function(e){return/^(?:\/|\w+:)/.test(e)},i=r.normalize=function(e){var t=(e=e.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),r=n(e),i="";r&&(i=t.shift()+"/");for(var s=0;s<t.length;)".."===t[s]?s>0&&".."!==t[s-1]?t.splice(--s,2):r?t.splice(s,1):++s:"."===t[s]?t.splice(s,1):++s;return i+t.join("/")};r.resolve=function(e,t,r){return r||(t=i(t)),n(t)?t:(r||(e=i(e)),(e=e.replace(/(?:\/|^)[^/]+$/,"")).length?i(e+"/"+t):t)}},58236:e=>{"use strict";e.exports=function(e,t,r){var n=r||8192,i=n>>>1,s=null,o=n;return function(r){if(r<1||r>i)return e(r);o+r>n&&(s=e(n),o=0);var a=t.call(s,o,o+=r);return 7&o&&(o=1+(7|o)),a}}},93861:(e,t)=>{"use strict";var r=t;r.length=function(e){for(var t=0,r=0,n=0;n<e.length;++n)(r=e.charCodeAt(n))<128?t+=1:r<2048?t+=2:55296===(64512&r)&&56320===(64512&e.charCodeAt(n+1))?(++n,t+=4):t+=3;return t},r.read=function(e,t,r){if(r-t<1)return"";for(var n,i=null,s=[],o=0;t<r;)(n=e[t++])<128?s[o++]=n:n>191&&n<224?s[o++]=(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,s[o++]=55296+(n>>10),s[o++]=56320+(1023&n)):s[o++]=(15&n)<<12|(63&e[t++])<<6|63&e[t++],o>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),o=0);return i?(o&&i.push(String.fromCharCode.apply(String,s.slice(0,o))),i.join("")):String.fromCharCode.apply(String,s.slice(0,o))},r.write=function(e,t,r){for(var n,i,s=r,o=0;o<e.length;++o)(n=e.charCodeAt(o))<128?t[r++]=n:n<2048?(t[r++]=n>>6|192,t[r++]=63&n|128):55296===(64512&n)&&56320===(64512&(i=e.charCodeAt(o+1)))?(n=65536+((1023&n)<<10)+(1023&i),++o,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-s}},76232:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(45073);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 s(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 o(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 l(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 h(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 d(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),l(e/4294967296>>>0,t,r),l(e>>>0,t,r+4),t}function f(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),h(e>>>0,t,r),h(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=s,t.writeInt16LE=s,t.readInt32BE=o,t.readUint32BE=a,t.readInt32LE=c,t.readUint32LE=u,t.writeUint32BE=l,t.writeInt32BE=l,t.writeUint32LE=h,t.writeInt32LE=h,t.readInt64BE=function(e,t){void 0===t&&(t=0);var r=o(e,t),n=o(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=d,t.writeInt64BE=d,t.writeUint64LE=f,t.writeInt64LE=f,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,s=e/8+r-1;s>=r;s--)n+=t[s]*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,s=r;s<r+e/8;s++)n+=t[s]*i,i*=256;return n},t.writeUintBE=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("writeUintBE supports only bitLengths divisible by 8");if(!n.isSafeInteger(t))throw new Error("writeUintBE value must be an integer");for(var s=1,o=e/8+i-1;o>=i;o--)r[o]=t/s&255,s*=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 s=1,o=i;o<i+e/8;o++)r[o]=t/s&255,s*=256;return r},t.readFloat32BE=function(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat32(t)},t.readFloat32LE=function(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat32(t,!0)},t.readFloat64BE=function(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat64(t)},t.readFloat64LE=function(e,t){return void 0===t&&(t=0),new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat64(t,!0)},t.writeFloat32BE=function(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat32(r,e),t},t.writeFloat32LE=function(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat32(r,e,!0),t},t.writeFloat64BE=function(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat64(r,e),t},t.writeFloat64LE=function(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),new DataView(t.buffer,t.byteOffset,t.byteLength).setFloat64(r,e,!0),t}},78284:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(76232),i=r(9116);function s(e,t,r){for(var i=1634760805,s=857760878,o=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],l=r[11]<<24|r[10]<<16|r[9]<<8|r[8],h=r[15]<<24|r[14]<<16|r[13]<<8|r[12],d=r[19]<<24|r[18]<<16|r[17]<<8|r[16],f=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],m=t[7]<<24|t[6]<<16|t[5]<<8|t[4],v=t[11]<<24|t[10]<<16|t[9]<<8|t[8],b=t[15]<<24|t[14]<<16|t[13]<<8|t[12],w=i,E=s,S=o,_=a,I=c,T=u,A=l,C=h,R=d,P=f,k=p,O=y,B=g,N=m,D=v,L=b,x=0;x<20;x+=2)I=(I^=R=R+(B=(B^=w=w+I|0)>>>16|B<<16)|0)>>>20|I<<12,T=(T^=P=P+(N=(N^=E=E+T|0)>>>16|N<<16)|0)>>>20|T<<12,A=(A^=k=k+(D=(D^=S=S+A|0)>>>16|D<<16)|0)>>>20|A<<12,C=(C^=O=O+(L=(L^=_=_+C|0)>>>16|L<<16)|0)>>>20|C<<12,A=(A^=k=k+(D=(D^=S=S+A|0)>>>24|D<<8)|0)>>>25|A<<7,C=(C^=O=O+(L=(L^=_=_+C|0)>>>24|L<<8)|0)>>>25|C<<7,T=(T^=P=P+(N=(N^=E=E+T|0)>>>24|N<<8)|0)>>>25|T<<7,I=(I^=R=R+(B=(B^=w=w+I|0)>>>24|B<<8)|0)>>>25|I<<7,T=(T^=k=k+(L=(L^=w=w+T|0)>>>16|L<<16)|0)>>>20|T<<12,A=(A^=O=O+(B=(B^=E=E+A|0)>>>16|B<<16)|0)>>>20|A<<12,C=(C^=R=R+(N=(N^=S=S+C|0)>>>16|N<<16)|0)>>>20|C<<12,I=(I^=P=P+(D=(D^=_=_+I|0)>>>16|D<<16)|0)>>>20|I<<12,C=(C^=R=R+(N=(N^=S=S+C|0)>>>24|N<<8)|0)>>>25|C<<7,I=(I^=P=P+(D=(D^=_=_+I|0)>>>24|D<<8)|0)>>>25|I<<7,A=(A^=O=O+(B=(B^=E=E+A|0)>>>24|B<<8)|0)>>>25|A<<7,T=(T^=k=k+(L=(L^=w=w+T|0)>>>24|L<<8)|0)>>>25|T<<7;n.writeUint32LE(w+i|0,e,0),n.writeUint32LE(E+s|0,e,4),n.writeUint32LE(S+o|0,e,8),n.writeUint32LE(_+a|0,e,12),n.writeUint32LE(I+c|0,e,16),n.writeUint32LE(T+u|0,e,20),n.writeUint32LE(A+l|0,e,24),n.writeUint32LE(C+h|0,e,28),n.writeUint32LE(R+d|0,e,32),n.writeUint32LE(P+f|0,e,36),n.writeUint32LE(k+p|0,e,40),n.writeUint32LE(O+y|0,e,44),n.writeUint32LE(B+g|0,e,48),n.writeUint32LE(N+m|0,e,52),n.writeUint32LE(D+v|0,e,56),n.writeUint32LE(L+b|0,e,60)}function o(e,t,r,n,o){if(void 0===o&&(o=0),32!==e.length)throw new Error("ChaCha: key size must be 32 bytes");if(n.length<r.length)throw new Error("ChaCha: destination is shorter than source");var c,u;if(0===o){if(8!==t.length&&12!==t.length)throw new Error("ChaCha nonce must be 8 or 12 bytes");u=(c=new Uint8Array(16)).length-t.length,c.set(t,u)}else{if(16!==t.length)throw new Error("ChaCha nonce with counter must be 16 bytes");c=t,u=o}for(var l=new Uint8Array(64),h=0;h<r.length;h+=64){s(l,c,e);for(var d=h;d<h+64&&d<r.length;d++)n[d]=r[d]^l[d-h];a(c,0,u)}return i.wipe(l),0===o&&i.wipe(c),n}function a(e,t,r){for(var n=1;r--;)n=n+(255&e[t])|0,e[t]=255&n,n>>>=8,t++;if(n>0)throw new Error("ChaCha: counter overflow")}t.streamXOR=o,t.stream=function(e,t,r,n){return void 0===n&&(n=0),i.wipe(r),o(e,t,r,r,n)}},53642:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(78284),i=r(75629),s=r(9116),o=r(76232),a=r(68770);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 o=new Uint8Array(16);o.set(e,o.length-e.length);var a=new Uint8Array(32);n.stream(this._key,o,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,o,t,c,4),this._authenticate(c.subarray(c.length-this.tagLength,c.length),a,c.subarray(0,c.length-this.tagLength),r),s.wipe(o),c},e.prototype.open=function(e,t,r,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(t.length<this.tagLength)return null;var o=new Uint8Array(16);o.set(e,o.length-e.length);var c=new Uint8Array(32);n.stream(this._key,o,c,4);var u=new Uint8Array(this.tagLength);if(this._authenticate(u,c,t.subarray(0,t.length-this.tagLength),r),!a.equal(u,t.subarray(t.length-this.tagLength,t.length)))return null;var l,h=t.length-this.tagLength;if(i){if(i.length!==h)throw new Error("ChaCha20Poly1305: incorrect destination length");l=i}else l=new Uint8Array(h);return n.streamXOR(this._key,o,t.subarray(0,t.length-this.tagLength),l,4),s.wipe(o),l},e.prototype.clean=function(){return s.wipe(this._key),this},e.prototype._authenticate=function(e,t,r,n){var a=new i.Poly1305(t);n&&(a.update(n),n.length%16>0&&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&&o.writeUint64LE(n.length,u),a.update(u),o.writeUint64LE(r.length,u),a.update(u);for(var l=a.digest(),h=0;h<l.length;h++)e[h]=l[h];a.clean(),s.wipe(l),s.wipe(u)},e}();t.ChaCha20Poly1305=u},68770:(e,t)=>{"use strict";function r(e,t){if(e.length!==t.length)return 0;for(var r=0,n=0;n<e.length;n++)r|=e[n]^t[n];return 1&r-1>>>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)}},41412:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isSerializableHash=function(e){return"undefined"!==typeof e.saveState&&"undefined"!==typeof e.restoreState&&"undefined"!==typeof e.cleanSavedState}},52497:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(5499),i=r(9116),s=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 s=n.hmac(this._hash,r,t);this._hmac=new n.HMAC(e,s),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<t.length;r++)this._bufpos===this._buffer.length&&this._fillBuffer(),t[r]=this._buffer[this._bufpos++];return t},e.prototype.clean=function(){this._hmac.clean(),i.wipe(this._buffer),i.wipe(this._counter),this._bufpos=0},e}();t.HKDF=s},5499:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(41412),i=r(68770),s=r(9116),o=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<r.length;i++)r[i]^=54;this._inner.update(r);for(i=0;i<r.length;i++)r[i]^=106;this._outer.update(r),n.isSerializableHash(this._inner)&&n.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),s.wipe(r)}return e.prototype.reset=function(){if(!n.isSerializableHash(this._inner)||!n.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},e.prototype.clean=function(){n.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),n.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},e.prototype.update=function(e){return this._inner.update(e),this},e.prototype.finish=function(e){return this._finished?(this._outer.finish(e),this):(this._inner.finish(e),this._outer.update(e.subarray(0,this.digestLength)).finish(e),this._finished=!0,this)},e.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},e.prototype.saveState=function(){if(!n.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},e.prototype.restoreState=function(e){if(!n.isSerializableHash(this._inner)||!n.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(e),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},e.prototype.cleanSavedState=function(e){if(!n.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(e)},e}();t.HMAC=o,t.hmac=function(e,t,r){var n=new o(e,t);n.update(r);var i=n.digest();return n.clean(),i},t.equal=i.equal},45073:(e,t)=>{"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<<t|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}},75629:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(68770),i=r(9116);t.DIGEST_LENGTH=16;var s=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 s=e[6]|e[7]<<8;this._r[3]=8191&(i>>>7|s<<9);var o=e[8]|e[9]<<8;this._r[4]=255&(s>>>4|o<<12),this._r[5]=o>>>1&8190;var a=e[10]|e[11]<<8;this._r[6]=8191&(o>>>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],s=this._h[1],o=this._h[2],a=this._h[3],c=this._h[4],u=this._h[5],l=this._h[6],h=this._h[7],d=this._h[8],f=this._h[9],p=this._r[0],y=this._r[1],g=this._r[2],m=this._r[3],v=this._r[4],b=this._r[5],w=this._r[6],E=this._r[7],S=this._r[8],_=this._r[9];r>=16;){var I=e[t+0]|e[t+1]<<8;i+=8191&I;var T=e[t+2]|e[t+3]<<8;s+=8191&(I>>>13|T<<3);var A=e[t+4]|e[t+5]<<8;o+=8191&(T>>>10|A<<6);var C=e[t+6]|e[t+7]<<8;a+=8191&(A>>>7|C<<9);var R=e[t+8]|e[t+9]<<8;c+=8191&(C>>>4|R<<12),u+=R>>>1&8191;var P=e[t+10]|e[t+11]<<8;l+=8191&(R>>>14|P<<2);var k=e[t+12]|e[t+13]<<8;h+=8191&(P>>>11|k<<5);var O=e[t+14]|e[t+15]<<8,B=0,N=B;N+=i*p,N+=s*(5*_),N+=o*(5*S),N+=a*(5*E),B=(N+=c*(5*w))>>>13,N&=8191,N+=u*(5*b),N+=l*(5*v),N+=h*(5*m),N+=(d+=8191&(k>>>8|O<<8))*(5*g);var D=B+=(N+=(f+=O>>>5|n)*(5*y))>>>13;D+=i*y,D+=s*p,D+=o*(5*_),D+=a*(5*S),B=(D+=c*(5*E))>>>13,D&=8191,D+=u*(5*w),D+=l*(5*b),D+=h*(5*v),D+=d*(5*m),B+=(D+=f*(5*g))>>>13,D&=8191;var L=B;L+=i*g,L+=s*y,L+=o*p,L+=a*(5*_),B=(L+=c*(5*S))>>>13,L&=8191,L+=u*(5*E),L+=l*(5*w),L+=h*(5*b),L+=d*(5*v);var x=B+=(L+=f*(5*m))>>>13;x+=i*m,x+=s*g,x+=o*y,x+=a*p,B=(x+=c*(5*_))>>>13,x&=8191,x+=u*(5*S),x+=l*(5*E),x+=h*(5*w),x+=d*(5*b);var M=B+=(x+=f*(5*v))>>>13;M+=i*v,M+=s*m,M+=o*g,M+=a*y,B=(M+=c*p)>>>13,M&=8191,M+=u*(5*_),M+=l*(5*S),M+=h*(5*E),M+=d*(5*w);var U=B+=(M+=f*(5*b))>>>13;U+=i*b,U+=s*v,U+=o*m,U+=a*g,B=(U+=c*y)>>>13,U&=8191,U+=u*p,U+=l*(5*_),U+=h*(5*S),U+=d*(5*E);var K=B+=(U+=f*(5*w))>>>13;K+=i*w,K+=s*b,K+=o*v,K+=a*m,B=(K+=c*g)>>>13,K&=8191,K+=u*y,K+=l*p,K+=h*(5*_),K+=d*(5*S);var j=B+=(K+=f*(5*E))>>>13;j+=i*E,j+=s*w,j+=o*b,j+=a*v,B=(j+=c*m)>>>13,j&=8191,j+=u*g,j+=l*y,j+=h*p,j+=d*(5*_);var F=B+=(j+=f*(5*S))>>>13;F+=i*S,F+=s*E,F+=o*w,F+=a*b,B=(F+=c*v)>>>13,F&=8191,F+=u*m,F+=l*g,F+=h*y,F+=d*p;var V=B+=(F+=f*(5*_))>>>13;V+=i*_,V+=s*S,V+=o*E,V+=a*w,B=(V+=c*b)>>>13,V&=8191,V+=u*v,V+=l*m,V+=h*g,V+=d*y,i=N=8191&(B=(B=((B+=(V+=f*p)>>>13)<<2)+B|0)+(N&=8191)|0),s=D+=B>>>=13,o=L&=8191,a=x&=8191,c=M&=8191,u=U&=8191,l=K&=8191,h=j&=8191,d=F&=8191,f=V&=8191,t+=16,r-=16}this._h[0]=i,this._h[1]=s,this._h[2]=o,this._h[3]=a,this._h[4]=c,this._h[5]=u,this._h[6]=l,this._h[7]=h,this._h[8]=d,this._h[9]=f},e.prototype.finish=function(e,t){void 0===t&&(t=0);var r,n,i,s,o=new Uint16Array(10);if(this._leftover){for(s=this._leftover,this._buffer[s++]=1;s<16;s++)this._buffer[s]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(r=this._h[1]>>>13,this._h[1]&=8191,s=2;s<10;s++)this._h[s]+=r,r=this._h[s]>>>13,this._h[s]&=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,o[0]=this._h[0]+5,r=o[0]>>>13,o[0]&=8191,s=1;s<10;s++)o[s]=this._h[s]+r,r=o[s]>>>13,o[s]&=8191;for(o[9]-=8192,n=(1^r)-1,s=0;s<10;s++)o[s]&=n;for(n=~n,s=0;s<10;s++)this._h[s]=this._h[s]&n|o[s];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,s=1;s<8;s++)i=(this._h[s]+this._pad[s]|0)+(i>>>16)|0,this._h[s]=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<t;i++)this._buffer[this._leftover+i]=e[r+i];if(n-=t,r+=t,this._leftover+=t,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(n>=16&&(t=n-n%16,this._blocks(e,r,t),r+=t,n-=t),n){for(i=0;i<n;i++)this._buffer[this._leftover+i]=e[r+i];this._leftover+=n}return this},e.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var e=new Uint8Array(16);return this.finish(e),e},e.prototype.clean=function(){return i.wipe(this._buffer),i.wipe(this._r),i.wipe(this._h),i.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},e}();t.Poly1305=s,t.oneTimeAuth=function(e,t){var r=new s(e);r.update(t);var n=r.digest();return r.clean(),n},t.equal=function(e,r){return e.length===t.DIGEST_LENGTH&&r.length===t.DIGEST_LENGTH&&n.equal(e,r)}},56271:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(933),i=r(76232),s=r(9116);function o(e,r){return void 0===r&&(r=t.defaultRandomSource),r.randomBytes(e)}t.defaultRandomSource=new n.SystemRandomSource,t.randomBytes=o,t.randomUint32=function(e){void 0===e&&(e=t.defaultRandomSource);var r=o(4,e),n=i.readUint32LE(r);return s.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 l=o(Math.ceil(256*e/u),n),h=0;h<l.length&&e>0;h++){var d=l[h];d<u&&(i+=r.charAt(d%c),e--)}s.wipe(l)}return i}t.randomString=c,t.randomStringForEntropy=function(e,r,n){return void 0===r&&(r=a),void 0===n&&(n=t.defaultRandomSource),c(Math.ceil(e/(Math.log(r.length)/Math.LN2)),r,n)}},98136:(e,t)=>{"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<t.length;r+=65536)this._crypto.getRandomValues(t.subarray(r,r+Math.min(t.length-r,65536)));return t},e}();t.BrowserRandomSource=r},38188:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(9116),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<r.length;i++)r[i]=t[i];return n.wipe(t),r},e}();t.NodeRandomSource=i},933:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(98136),i=r(38188),s=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=s},24888:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(76232),i=r(9116);t.DIGEST_LENGTH=32,t.BLOCK_SIZE=64;var s=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._bufferLength<this.blockSize&&t>0;)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,s=t<<3,o=t%64<56?64:128;this._buffer[r]=128;for(var c=r+1;c<o-8;c++)this._buffer[c]=0;n.writeUint32BE(i,this._buffer,o-8),n.writeUint32BE(s,this._buffer,o-4),a(this._temp,this._state,this._buffer,0,o),this._finished=!0}for(c=0;c<this.digestLength/4;c++)n.writeUint32BE(this._state[c],e,4*c);return this},e.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},e.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?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=s;var o=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,s){for(;s>=64;){for(var a=t[0],c=t[1],u=t[2],l=t[3],h=t[4],d=t[5],f=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 m=e[y-2],v=(m>>>17|m<<15)^(m>>>19|m<<13)^m>>>10,b=((m=e[y-15])>>>7|m<<25)^(m>>>18|m<<14)^m>>>3;e[y]=(v+e[y-7]|0)+(b+e[y-16]|0)}for(y=0;y<64;y++){v=(((h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7))+(h&d^~h&f)|0)+(p+(o[y]+e[y]|0)|0)|0,b=((a>>>2|a<<30)^(a>>>13|a<<19)^(a>>>22|a<<10))+(a&c^a&u^c&u)|0;p=f,f=d,d=h,h=l+v|0,l=u,u=c,c=a,a=v+b|0}t[0]+=a,t[1]+=c,t[2]+=u,t[3]+=l,t[4]+=h,t[5]+=d,t[6]+=f,t[7]+=p,i+=64,s-=64}return i}t.hash=function(e){var t=new s;t.update(e);var r=t.digest();return t.clean(),r}},9116:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.wipe=function(e){for(var t=0;t<e.length;t++)e[t]=0;return e}},52029:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(56271),i=r(9116);function s(e){var t=new Float64Array(16);if(e)for(var r=0;r<e.length;r++)t[r]=e[r];return t}t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;var o=new Uint8Array(32);o[0]=9;var a=s([56129,1]);function c(e){for(var t=1,r=0;r<16;r++){var n=e[r]+t+65535;t=Math.floor(n/65536),e[r]=n-65536*t}e[0]+=t-1+37*(t-1)}function u(e,t,r){for(var n=~(r-1),i=0;i<16;i++){var s=n&(e[i]^t[i]);e[i]^=s,t[i]^=s}}function l(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]+r[n]}function h(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]-r[n]}function d(e,t,r){var n,i,s=0,o=0,a=0,c=0,u=0,l=0,h=0,d=0,f=0,p=0,y=0,g=0,m=0,v=0,b=0,w=0,E=0,S=0,_=0,I=0,T=0,A=0,C=0,R=0,P=0,k=0,O=0,B=0,N=0,D=0,L=0,x=r[0],M=r[1],U=r[2],K=r[3],j=r[4],F=r[5],V=r[6],q=r[7],z=r[8],H=r[9],G=r[10],W=r[11],Y=r[12],Q=r[13],J=r[14],X=r[15];s+=(n=t[0])*x,o+=n*M,a+=n*U,c+=n*K,u+=n*j,l+=n*F,h+=n*V,d+=n*q,f+=n*z,p+=n*H,y+=n*G,g+=n*W,m+=n*Y,v+=n*Q,b+=n*J,w+=n*X,o+=(n=t[1])*x,a+=n*M,c+=n*U,u+=n*K,l+=n*j,h+=n*F,d+=n*V,f+=n*q,p+=n*z,y+=n*H,g+=n*G,m+=n*W,v+=n*Y,b+=n*Q,w+=n*J,E+=n*X,a+=(n=t[2])*x,c+=n*M,u+=n*U,l+=n*K,h+=n*j,d+=n*F,f+=n*V,p+=n*q,y+=n*z,g+=n*H,m+=n*G,v+=n*W,b+=n*Y,w+=n*Q,E+=n*J,S+=n*X,c+=(n=t[3])*x,u+=n*M,l+=n*U,h+=n*K,d+=n*j,f+=n*F,p+=n*V,y+=n*q,g+=n*z,m+=n*H,v+=n*G,b+=n*W,w+=n*Y,E+=n*Q,S+=n*J,_+=n*X,u+=(n=t[4])*x,l+=n*M,h+=n*U,d+=n*K,f+=n*j,p+=n*F,y+=n*V,g+=n*q,m+=n*z,v+=n*H,b+=n*G,w+=n*W,E+=n*Y,S+=n*Q,_+=n*J,I+=n*X,l+=(n=t[5])*x,h+=n*M,d+=n*U,f+=n*K,p+=n*j,y+=n*F,g+=n*V,m+=n*q,v+=n*z,b+=n*H,w+=n*G,E+=n*W,S+=n*Y,_+=n*Q,I+=n*J,T+=n*X,h+=(n=t[6])*x,d+=n*M,f+=n*U,p+=n*K,y+=n*j,g+=n*F,m+=n*V,v+=n*q,b+=n*z,w+=n*H,E+=n*G,S+=n*W,_+=n*Y,I+=n*Q,T+=n*J,A+=n*X,d+=(n=t[7])*x,f+=n*M,p+=n*U,y+=n*K,g+=n*j,m+=n*F,v+=n*V,b+=n*q,w+=n*z,E+=n*H,S+=n*G,_+=n*W,I+=n*Y,T+=n*Q,A+=n*J,C+=n*X,f+=(n=t[8])*x,p+=n*M,y+=n*U,g+=n*K,m+=n*j,v+=n*F,b+=n*V,w+=n*q,E+=n*z,S+=n*H,_+=n*G,I+=n*W,T+=n*Y,A+=n*Q,C+=n*J,R+=n*X,p+=(n=t[9])*x,y+=n*M,g+=n*U,m+=n*K,v+=n*j,b+=n*F,w+=n*V,E+=n*q,S+=n*z,_+=n*H,I+=n*G,T+=n*W,A+=n*Y,C+=n*Q,R+=n*J,P+=n*X,y+=(n=t[10])*x,g+=n*M,m+=n*U,v+=n*K,b+=n*j,w+=n*F,E+=n*V,S+=n*q,_+=n*z,I+=n*H,T+=n*G,A+=n*W,C+=n*Y,R+=n*Q,P+=n*J,k+=n*X,g+=(n=t[11])*x,m+=n*M,v+=n*U,b+=n*K,w+=n*j,E+=n*F,S+=n*V,_+=n*q,I+=n*z,T+=n*H,A+=n*G,C+=n*W,R+=n*Y,P+=n*Q,k+=n*J,O+=n*X,m+=(n=t[12])*x,v+=n*M,b+=n*U,w+=n*K,E+=n*j,S+=n*F,_+=n*V,I+=n*q,T+=n*z,A+=n*H,C+=n*G,R+=n*W,P+=n*Y,k+=n*Q,O+=n*J,B+=n*X,v+=(n=t[13])*x,b+=n*M,w+=n*U,E+=n*K,S+=n*j,_+=n*F,I+=n*V,T+=n*q,A+=n*z,C+=n*H,R+=n*G,P+=n*W,k+=n*Y,O+=n*Q,B+=n*J,N+=n*X,b+=(n=t[14])*x,w+=n*M,E+=n*U,S+=n*K,_+=n*j,I+=n*F,T+=n*V,A+=n*q,C+=n*z,R+=n*H,P+=n*G,k+=n*W,O+=n*Y,B+=n*Q,N+=n*J,D+=n*X,w+=(n=t[15])*x,o+=38*(S+=n*U),a+=38*(_+=n*K),c+=38*(I+=n*j),u+=38*(T+=n*F),l+=38*(A+=n*V),h+=38*(C+=n*q),d+=38*(R+=n*z),f+=38*(P+=n*H),p+=38*(k+=n*G),y+=38*(O+=n*W),g+=38*(B+=n*Y),m+=38*(N+=n*Q),v+=38*(D+=n*J),b+=38*(L+=n*X),s=(n=(s+=38*(E+=n*M))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),o=(n=o+i+65535)-65536*(i=Math.floor(n/65536)),a=(n=a+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),w=(n=w+i+65535)-65536*(i=Math.floor(n/65536)),s=(n=(s+=i-1+37*(i-1))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),o=(n=o+i+65535)-65536*(i=Math.floor(n/65536)),a=(n=a+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),w=(n=w+i+65535)-65536*(i=Math.floor(n/65536)),s+=i-1+37*(i-1),e[0]=s,e[1]=o,e[2]=a,e[3]=c,e[4]=u,e[5]=l,e[6]=h,e[7]=d,e[8]=f,e[9]=p,e[10]=y,e[11]=g,e[12]=m,e[13]=v,e[14]=b,e[15]=w}function f(e,t){d(e,t,t)}function p(e,t){for(var r=new Uint8Array(32),n=new Float64Array(80),i=s(),o=s(),p=s(),y=s(),g=s(),m=s(),v=0;v<31;v++)r[v]=e[v];r[31]=127&e[31]|64,r[0]&=248,function(e,t){for(var r=0;r<16;r++)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}(n,t);for(v=0;v<16;v++)o[v]=n[v];i[0]=y[0]=1;for(v=254;v>=0;--v){var b=r[v>>>3]>>>(7&v)&1;u(i,o,b),u(p,y,b),l(g,i,p),h(i,i,p),l(p,o,y),h(o,o,y),f(y,g),f(m,i),d(i,p,i),d(p,o,g),l(g,i,p),h(i,i,p),f(o,i),h(p,y,m),d(i,p,a),l(i,i,y),d(p,p,i),d(i,y,m),d(y,o,n),f(o,g),u(i,o,b),u(p,y,b)}for(v=0;v<16;v++)n[v+16]=i[v],n[v+32]=p[v],n[v+48]=o[v],n[v+64]=y[v];var w=n.subarray(32),E=n.subarray(16);!function(e,t){for(var r=s(),n=0;n<16;n++)r[n]=t[n];for(n=253;n>=0;n--)f(r,r),2!==n&&4!==n&&d(r,r,t);for(n=0;n<16;n++)e[n]=r[n]}(w,w),d(E,E,w);var S=new Uint8Array(32);return function(e,t){for(var r=s(),n=s(),i=0;i<16;i++)n[i]=t[i];c(n),c(n),c(n);for(var o=0;o<2;o++){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}(S,E),S}function y(e){return p(e,o)}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 s=0,o=0;o<i.length;o++)s|=i[o];if(0===s)throw new Error("X25519: invalid shared key")}return i}},56755:(e,t)=>{"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,s=0,o=0,a={};return a.push=function(a,c){if(n){const u=1-r(-(a-n)/e),l=c-t;t=u*c+(1-u)*t,i=(1-u)*(i+l*(u*l)),s=Math.sqrt(i),o=t+u*l}else t=c;n=a},a.movingAverage=function(){return t},a.variance=function(){return i},a.deviation=function(){return s},a.forecast=function(){return o},a}},67418:e=>{e.exports=class extends Error{constructor(e,t){super(e||"The operation was aborted"),this.type="aborted",this.code=t||"ABORT_ERR"}}},64183:(e,t,r)=>{const n=r(38295),i=r(67418),s=(e,t,r)=>o(e,Array.isArray(t)?t:[{signal:t,options:r}]),o=(e,t)=>(e=n(e),t=t.map((e=>{let{signal:t,options:r}=e;return{signal:t,options:r||{}}})),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((e=>{let{signal:t}=e;return t.aborted})),{abortMessage:r,abortCode:s}=e;n(new i(r,s))}}));o=await Promise.race([n,e.next()]),r=null}catch(s){for(const{signal:e}of t)e.removeEventListener("abort",n);const r=t.find((e=>{let{signal:t}=e;return t.aborted})),i="aborted"===s.type&&r;if(i&&r.options.onAbort&&await r.options.onAbort(e),"function"===typeof e.return)try{const t=e.return();t instanceof Promise&&t.catch((e=>{null!=r.options.onReturnError&&r.options.onReturnError(e)}))}catch(s){null!=r.options.onReturnError&&r.options.onReturnError(s)}if(i&&r.options.returnOnAbort)return;throw s}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(o(r,t)),u=(e,t)=>({sink:c(e.sink,t),source:o(e.source,t)});e.exports=s,e.exports.AbortError=i,e.exports.source=s,e.exports.sink=a,e.exports.transform=a,e.exports.duplex=(e,t,r)=>u(e,Array.isArray(t)?t:[{signal:t,options:r}])},64928:(e,t,r)=>{"use strict";const n=r(67263),i=r(75235);class s extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError("Expected input to be an Array, got ".concat(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=s},66622:e=>{const{AbortController:t}=globalThis;function r(e){const r=new t;function n(){r.abort();for(const t of e)t&&t.removeEventListener&&t.removeEventListener("abort",n)}for(const t of e)if(t&&t.addEventListener){if(t.aborted){n();break}t.addEventListener("abort",n)}return r.signal}e.exports=r,e.exports.anySignal=r},2009:(e,t)=>{"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,s=c(e),o=s[0],a=s[1],u=new i(function(e,t,r){return 3*(t+r)/4-r}(0,o,a)),l=0,h=a>0?o-4:o;for(r=0;r<h;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===a&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[l++]=255&t);1===a&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,s=[],o=16383,a=0,c=n-i;a<c;a+=o)s.push(u(e,a,a+o>c?c:a+o));1===i?(t=e[n-1],s.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],s.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return s.join("")};for(var r=[],n=[],i="undefined"!==typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,a=s.length;o<a;++o)r[o]=s[o],n[s.charCodeAt(o)]=o;function c(e){var t=e.length;if(t%4>0)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,s,o=[],a=t;a<n;a+=3)i=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),o.push(r[(s=i)>>18&63]+r[s>>12&63]+r[s>>6&63]+r[63&s]);return o.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},17144:function(e,t,r){var n;!function(i){"use strict";var s,o=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,c=Math.floor,u="[BigNumber Error] ",l=u+"Number primitive has more than 15 significant digits: ",h=1e14,d=14,f=9007199254740991,p=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],y=1e7,g=1e9;function m(e){var t=0|e;return e>0||e===t?t:t-1}function v(e){for(var t,r,n=1,i=e.length,s=e[0]+"";n<i;){for(t=e[n++]+"",r=d-t.length;r--;t="0"+t);s+=t}for(i=s.length;48===s.charCodeAt(--i););return s.slice(0,i+1||1)}function b(e,t){var r,n,i=e.c,s=t.c,o=e.s,a=t.s,c=e.e,u=t.e;if(!o||!a)return null;if(r=i&&!i[0],n=s&&!s[0],r||n)return r?n?0:-a:o;if(o!=a)return o;if(r=o<0,n=c==u,!i||!s)return n?0:!i^r?1:-1;if(!n)return c>u^r?1:-1;for(a=(c=i.length)<(u=s.length)?c:u,o=0;o<a;o++)if(i[o]!=s[o])return i[o]>s[o]^r?1:-1;return c==u?0:c>u^r?1:-1}function w(e,t,r,n){if(e<t||e>r||e!==c(e))throw Error(u+(n||"Argument")+("number"==typeof e?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function E(e){var t=e.c.length-1;return m(e.e/d)==t&&e.c[t]%2!=0}function S(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function _(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 t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}s=function e(t){var r,n,i,s=M.prototype={constructor:M,toString:null,valueOf:null},I=new M(1),T=20,A=4,C=-7,R=21,P=-1e7,k=1e7,O=!1,B=1,N=0,D={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xa0",suffix:""},L="0123456789abcdefghijklmnopqrstuvwxyz",x=!0;function M(e,t){var r,s,a,u,h,p,y,g,m=this;if(!(m instanceof M))return new M(e,t);if(null==t){if(e&&!0===e._isBigNumber)return m.s=e.s,void(!e.c||e.e>k?m.c=m.e=null:e.e<P?m.c=[m.e=0]:(m.e=e.e,m.c=e.c.slice()));if((p="number"==typeof e)&&0*e==0){if(m.s=1/e<0?(e=-e,-1):1,e===~~e){for(u=0,h=e;h>=10;h/=10,u++);return void(u>k?m.c=m.e=null:(m.e=u,m.c=[e]))}g=String(e)}else{if(!o.test(g=String(e)))return i(m,g,p);m.s=45==g.charCodeAt(0)?(g=g.slice(1),-1):1}(u=g.indexOf("."))>-1&&(g=g.replace(".","")),(h=g.search(/e/i))>0?(u<0&&(u=h),u+=+g.slice(h+1),g=g.substring(0,h)):u<0&&(u=g.length)}else{if(w(t,2,L.length,"Base"),10==t&&x)return F(m=new M(e),T+m.e+1,A);if(g=String(e),p="number"==typeof e){if(0*e!=0)return i(m,g,p,t);if(m.s=1/e<0?(g=g.slice(1),-1):1,M.DEBUG&&g.replace(/^0\.0*|\./,"").length>15)throw Error(l+e)}else m.s=45===g.charCodeAt(0)?(g=g.slice(1),-1):1;for(r=L.slice(0,t),u=h=0,y=g.length;h<y;h++)if(r.indexOf(s=g.charAt(h))<0){if("."==s){if(h>u){u=y;continue}}else if(!a&&(g==g.toUpperCase()&&(g=g.toLowerCase())||g==g.toLowerCase()&&(g=g.toUpperCase()))){a=!0,h=-1,u=0;continue}return i(m,String(e),p,t)}p=!1,(u=(g=n(g,t,10,m.s)).indexOf("."))>-1?g=g.replace(".",""):u=g.length}for(h=0;48===g.charCodeAt(h);h++);for(y=g.length;48===g.charCodeAt(--y););if(g=g.slice(h,++y)){if(y-=h,p&&M.DEBUG&&y>15&&(e>f||e!==c(e)))throw Error(l+m.s*e);if((u=u-h-1)>k)m.c=m.e=null;else if(u<P)m.c=[m.e=0];else{if(m.e=u,m.c=[],h=(u+1)%d,u<0&&(h+=d),h<y){for(h&&m.c.push(+g.slice(0,h)),y-=d;h<y;)m.c.push(+g.slice(h,h+=d));h=d-(g=g.slice(h)).length}else h-=y;for(;h--;g+="0");m.c.push(+g)}}else m.c=[m.e=0]}function U(e,t,r,n){var i,s,o,a,c;if(null==r?r=A:w(r,0,8),!e.c)return e.toString();if(i=e.c[0],o=e.e,null==t)c=v(e.c),c=1==n||2==n&&(o<=C||o>=R)?S(c,o):_(c,o,"0");else if(s=(e=F(new M(e),t,r)).e,a=(c=v(e.c)).length,1==n||2==n&&(t<=s||s<=C)){for(;a<t;c+="0",a++);c=S(c,s)}else if(t-=o,c=_(c,s,"0"),s+1>a){if(--t>0)for(c+=".";t--;c+="0");}else if((t+=s-a)>0)for(s+1==a&&(c+=".");t--;c+="0");return e.s<0&&i?"-"+c:c}function K(e,t){for(var r,n=1,i=new M(e[0]);n<e.length;n++){if(!(r=new M(e[n])).s){i=r;break}t.call(i,r)&&(i=r)}return i}function j(e,t,r){for(var n=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,n++);return(r=n+r*d-1)>k?e.c=e.e=null:r<P?e.c=[e.e=0]:(e.e=r,e.c=t),e}function F(e,t,r,n){var i,s,o,u,l,f,y,g=e.c,m=p;if(g){e:{for(i=1,u=g[0];u>=10;u/=10,i++);if((s=t-i)<0)s+=d,o=t,y=(l=g[f=0])/m[i-o-1]%10|0;else if((f=a((s+1)/d))>=g.length){if(!n)break e;for(;g.length<=f;g.push(0));l=y=0,i=1,o=(s%=d)-d+1}else{for(l=u=g[f],i=1;u>=10;u/=10,i++);y=(o=(s%=d)-d+i)<0?0:l/m[i-o-1]%10|0}if(n=n||t<0||null!=g[f+1]||(o<0?l:l%m[i-o-1]),n=r<4?(y||n)&&(0==r||r==(e.s<0?3:2)):y>5||5==y&&(4==r||n||6==r&&(s>0?o>0?l/m[i-o]:0:g[f-1])%10&1||r==(e.s<0?8:7)),t<1||!g[0])return g.length=0,n?(t-=e.e+1,g[0]=m[(d-t%d)%d],e.e=-t||0):g[0]=e.e=0,e;if(0==s?(g.length=f,u=1,f--):(g.length=f+1,u=m[d-s],g[f]=o>0?c(l/m[i-o]%m[o])*u:0),n)for(;;){if(0==f){for(s=1,o=g[0];o>=10;o/=10,s++);for(o=g[0]+=u,u=1;o>=10;o/=10,u++);s!=u&&(e.e++,g[0]==h&&(g[0]=1));break}if(g[f]+=u,g[f]!=h)break;g[f--]=0,u=1}for(s=g.length;0===g[--s];g.pop());}e.e>k?e.c=e.e=null:e.e<P&&(e.c=[e.e=0])}return e}function V(e){var t,r=e.e;return null===r?e.toString():(t=v(e.c),t=r<=C||r>=R?S(t,r):_(t,r,"0"),e.s<0?"-"+t:t)}return M.clone=e,M.ROUND_UP=0,M.ROUND_DOWN=1,M.ROUND_CEIL=2,M.ROUND_FLOOR=3,M.ROUND_HALF_UP=4,M.ROUND_HALF_DOWN=5,M.ROUND_HALF_EVEN=6,M.ROUND_HALF_CEIL=7,M.ROUND_HALF_FLOOR=8,M.EUCLID=9,M.config=M.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),T=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(w(r=e[t],0,8,t),A=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(w(r[0],-g,0,t),w(r[1],0,g,t),C=r[0],R=r[1]):(w(r,-g,g,t),C=-(R=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),P=r[0],k=r[1];else{if(w(r,-g,g,t),!r)throw Error(u+t+" cannot be zero: "+r);P=-(k=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 O=!r,Error(u+"crypto unavailable");O=r}else O=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(w(r=e[t],0,9,t),B=r),e.hasOwnProperty(t="POW_PRECISION")&&(w(r=e[t],0,g,t),N=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(u+t+" not an object: "+r);D=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(u+t+" invalid: "+r);x="0123456789"==r.slice(0,10),L=r}}return{DECIMAL_PLACES:T,ROUNDING_MODE:A,EXPONENTIAL_AT:[C,R],RANGE:[P,k],CRYPTO:O,MODULO_MODE:B,POW_PRECISION:N,FORMAT:D,ALPHABET:L}},M.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!M.DEBUG)return!0;var t,r,n=e.c,i=e.e,s=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===s||-1===s)&&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)%d)<1&&(t+=d),String(n[0]).length==t){for(t=0;t<n.length;t++)if((r=n[t])<0||r>=h||r!==c(r))break e;if(0!==r)return!0}}}else if(null===n&&null===i&&(null===s||1===s||-1===s))return!0;throw Error(u+"Invalid BigNumber: "+e)},M.maximum=M.max=function(){return K(arguments,s.lt)},M.minimum=M.min=function(){return K(arguments,s.gt)},M.random=function(){var e=9007199254740992,t=Math.random()*e&2097151?function(){return c(Math.random()*e)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)};return function(e){var r,n,i,s,o,l=0,h=[],f=new M(I);if(null==e?e=T:w(e,0,g),s=a(e/d),O)if(crypto.getRandomValues){for(r=crypto.getRandomValues(new Uint32Array(s*=2));l<s;)(o=131072*r[l]+(r[l+1]>>>11))>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),r[l]=n[0],r[l+1]=n[1]):(h.push(o%1e14),l+=2);l=s/2}else{if(!crypto.randomBytes)throw O=!1,Error(u+"crypto unavailable");for(r=crypto.randomBytes(s*=7);l<s;)(o=281474976710656*(31&r[l])+1099511627776*r[l+1]+4294967296*r[l+2]+16777216*r[l+3]+(r[l+4]<<16)+(r[l+5]<<8)+r[l+6])>=9e15?crypto.randomBytes(7).copy(r,l):(h.push(o%1e14),l+=7);l=s/7}if(!O)for(;l<s;)(o=t())<9e15&&(h[l++]=o%1e14);for(s=h[--l],e%=d,s&&e&&(o=p[d-e],h[l]=c(s/o)*o);0===h[l];h.pop(),l--);if(l<0)h=[i=0];else{for(i=-1;0===h[0];h.splice(0,1),i-=d);for(l=1,o=h[0];o>=10;o/=10,l++);l<d&&(i-=d-l)}return f.e=i,f.c=h,f}}(),M.sum=function(){for(var e=1,t=arguments,r=new M(t[0]);e<t.length;)r=r.plus(t[e++]);return r},n=function(){var e="0123456789";function t(e,t,r,n){for(var i,s,o=[0],a=0,c=e.length;a<c;){for(s=o.length;s--;o[s]*=t);for(o[0]+=n.indexOf(e.charAt(a++)),i=0;i<o.length;i++)o[i]>r-1&&(null==o[i+1]&&(o[i+1]=0),o[i+1]+=o[i]/r|0,o[i]%=r)}return o.reverse()}return function(n,i,s,o,a){var c,u,l,h,d,f,p,y,g=n.indexOf("."),m=T,b=A;for(g>=0&&(h=N,N=0,n=n.replace(".",""),f=(y=new M(i)).pow(n.length-g),N=h,y.c=t(_(v(f.c),f.e,"0"),10,s,e),y.e=y.c.length),l=h=(p=t(n,i,s,a?(c=L,e):(c=e,L))).length;0==p[--h];p.pop());if(!p[0])return c.charAt(0);if(g<0?--l:(f.c=p,f.e=l,f.s=o,p=(f=r(f,y,m,b,s)).c,d=f.r,l=f.e),g=p[u=l+m+1],h=s/2,d=d||u<0||null!=p[u+1],d=b<4?(null!=g||d)&&(0==b||b==(f.s<0?3:2)):g>h||g==h&&(4==b||d||6==b&&1&p[u-1]||b==(f.s<0?8:7)),u<1||!p[0])n=d?_(c.charAt(1),-m,c.charAt(0)):c.charAt(0);else{if(p.length=u,d)for(--s;++p[--u]>s;)p[u]=0,u||(++l,p=[1].concat(p));for(h=p.length;!p[--h];);for(g=0,n="";g<=h;n+=c.charAt(p[g++]));n=_(n,l,c.charAt(0))}return n}}(),r=function(){function e(e,t,r){var n,i,s,o,a=0,c=e.length,u=t%y,l=t/y|0;for(e=e.slice();c--;)a=((i=u*(s=e[c]%y)+(n=l*s+(o=e[c]/y|0)*u)%y*y+a)/r|0)+(n/y|0)+l*o,e[c]=i%r;return a&&(e=[a].concat(e)),e}function t(e,t,r,n){var i,s;if(r!=n)s=r>n?1:-1;else for(i=s=0;i<r;i++)if(e[i]!=t[i]){s=e[i]>t[i]?1:-1;break}return s}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]<t[r]?1:0,e[r]=i*n+e[r]-t[r];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(n,i,s,o,a){var u,l,f,p,y,g,v,b,w,E,S,_,I,T,A,C,R,P=n.s==i.s?1:-1,k=n.c,O=i.c;if(!k||!k[0]||!O||!O[0])return new M(n.s&&i.s&&(k?!O||k[0]!=O[0]:O)?k&&0==k[0]||!O?0*P:P/0:NaN);for(w=(b=new M(P)).c=[],P=s+(l=n.e-i.e)+1,a||(a=h,l=m(n.e/d)-m(i.e/d),P=P/d|0),f=0;O[f]==(k[f]||0);f++);if(O[f]>(k[f]||0)&&l--,P<0)w.push(1),p=!0;else{for(T=k.length,C=O.length,f=0,P+=2,(y=c(a/(O[0]+1)))>1&&(O=e(O,y,a),k=e(k,y,a),C=O.length,T=k.length),I=C,S=(E=k.slice(0,C)).length;S<C;E[S++]=0);R=O.slice(),R=[0].concat(R),A=O[0],O[1]>=a/2&&A++;do{if(y=0,(u=t(O,E,C,S))<0){if(_=E[0],C!=S&&(_=_*a+(E[1]||0)),(y=c(_/A))>1)for(y>=a&&(y=a-1),v=(g=e(O,y,a)).length,S=E.length;1==t(g,E,v,S);)y--,r(g,C<v?R:O,v,a),v=g.length,u=1;else 0==y&&(u=y=1),v=(g=O.slice()).length;if(v<S&&(g=[0].concat(g)),r(E,g,S,a),S=E.length,-1==u)for(;t(O,E,C,S)<1;)y++,r(E,C<S?R:O,S,a),S=E.length}else 0===u&&(y++,E=[0]);w[f++]=y,E[0]?E[S++]=k[I]||0:(E=[k[I]],S=1)}while((I++<T||null!=E[0])&&P--);p=null!=E[0],w[0]||w.splice(0,1)}if(a==h){for(f=1,P=w[0];P>=10;P/=10,f++);F(b,s+(b.e=f+l*d-1)+1,o,p)}else b.e=l,b.r=+p;return b}}(),i=function(){var e=/^(-?)0([xbo])(?=\w[\w.]*$)/i,t=/^([^.]+)\.$/,r=/^\.([^.]+)$/,n=/^-?(Infinity|NaN)$/,i=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(s,o,a,c){var l,h=a?o:o.replace(i,"");if(n.test(h))s.s=isNaN(h)?null:h<0?-1:1;else{if(!a&&(h=h.replace(e,(function(e,t,r){return l="x"==(r=r.toLowerCase())?16:"b"==r?2:8,c&&c!=l?e:t})),c&&(l=c,h=h.replace(t,"$1").replace(r,"0.$1")),o!=h))return new M(h,l);if(M.DEBUG)throw Error(u+"Not a"+(c?" base "+c:"")+" number: "+o);s.s=null}s.c=s.e=null}}(),s.absoluteValue=s.abs=function(){var e=new M(this);return e.s<0&&(e.s=1),e},s.comparedTo=function(e,t){return b(this,new M(e,t))},s.decimalPlaces=s.dp=function(e,t){var r,n,i,s=this;if(null!=e)return w(e,0,g),null==t?t=A:w(t,0,8),F(new M(s),e+s.e+1,t);if(!(r=s.c))return null;if(n=((i=r.length-1)-m(this.e/d))*d,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},s.dividedBy=s.div=function(e,t){return r(this,new M(e,t),T,A)},s.dividedToIntegerBy=s.idiv=function(e,t){return r(this,new M(e,t),0,1)},s.exponentiatedBy=s.pow=function(e,t){var r,n,i,s,o,l,h,f,p=this;if((e=new M(e)).c&&!e.isInteger())throw Error(u+"Exponent not an integer: "+V(e));if(null!=t&&(t=new M(t)),o=e.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!e.c||!e.c[0])return f=new M(Math.pow(+V(p),o?2-E(e):+V(e))),t?f.mod(t):f;if(l=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new M(NaN);(n=!l&&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||o&&p.c[1]>=24e7:p.c[0]<8e13||o&&p.c[0]<=9999975e7)))return s=p.s<0&&E(e)?-0:0,p.e>-1&&(s=1/s),new M(l?1/s:s);N&&(s=a(N/d+2))}for(o?(r=new M(.5),l&&(e.s=1),h=E(e)):h=(i=Math.abs(+V(e)))%2,f=new M(I);;){if(h){if(!(f=f.times(p)).c)break;s?f.c.length>s&&(f.c.length=s):n&&(f=f.mod(t))}if(i){if(0===(i=c(i/2)))break;h=i%2}else if(F(e=e.times(r),e.e+1,1),e.e>14)h=E(e);else{if(0===(i=+V(e)))break;h=i%2}p=p.times(p),s?p.c&&p.c.length>s&&(p.c.length=s):n&&(p=p.mod(t))}return n?f:(l&&(f=I.div(f)),t?f.mod(t):s?F(f,N,A,undefined):f)},s.integerValue=function(e){var t=new M(this);return null==e?e=A:w(e,0,8),F(t,t.e+1,e)},s.isEqualTo=s.eq=function(e,t){return 0===b(this,new M(e,t))},s.isFinite=function(){return!!this.c},s.isGreaterThan=s.gt=function(e,t){return b(this,new M(e,t))>0},s.isGreaterThanOrEqualTo=s.gte=function(e,t){return 1===(t=b(this,new M(e,t)))||0===t},s.isInteger=function(){return!!this.c&&m(this.e/d)>this.c.length-2},s.isLessThan=s.lt=function(e,t){return b(this,new M(e,t))<0},s.isLessThanOrEqualTo=s.lte=function(e,t){return-1===(t=b(this,new M(e,t)))||0===t},s.isNaN=function(){return!this.s},s.isNegative=function(){return this.s<0},s.isPositive=function(){return this.s>0},s.isZero=function(){return!!this.c&&0==this.c[0]},s.minus=function(e,t){var r,n,i,s,o=this,a=o.s;if(t=(e=new M(e,t)).s,!a||!t)return new M(NaN);if(a!=t)return e.s=-t,o.plus(e);var c=o.e/d,u=e.e/d,l=o.c,f=e.c;if(!c||!u){if(!l||!f)return l?(e.s=-t,e):new M(f?o:NaN);if(!l[0]||!f[0])return f[0]?(e.s=-t,e):new M(l[0]?o:3==A?-0:0)}if(c=m(c),u=m(u),l=l.slice(),a=c-u){for((s=a<0)?(a=-a,i=l):(u=c,i=f),i.reverse(),t=a;t--;i.push(0));i.reverse()}else for(n=(s=(a=l.length)<(t=f.length))?a:t,a=t=0;t<n;t++)if(l[t]!=f[t]){s=l[t]<f[t];break}if(s&&(i=l,l=f,f=i,e.s=-e.s),(t=(n=f.length)-(r=l.length))>0)for(;t--;l[r++]=0);for(t=h-1;n>a;){if(l[--n]<f[n]){for(r=n;r&&!l[--r];l[r]=t);--l[r],l[n]+=h}l[n]-=f[n]}for(;0==l[0];l.splice(0,1),--u);return l[0]?j(e,l,u):(e.s=3==A?-1:1,e.c=[e.e=0],e)},s.modulo=s.mod=function(e,t){var n,i,s=this;return e=new M(e,t),!s.c||!e.s||e.c&&!e.c[0]?new M(NaN):!e.c||s.c&&!s.c[0]?new M(s):(9==B?(i=e.s,e.s=1,n=r(s,e,0,3),e.s=i,n.s*=i):n=r(s,e,0,B),(e=s.minus(n.times(e))).c[0]||1!=B||(e.s=s.s),e)},s.multipliedBy=s.times=function(e,t){var r,n,i,s,o,a,c,u,l,f,p,g,v,b,w,E=this,S=E.c,_=(e=new M(e,t)).c;if(!S||!_||!S[0]||!_[0])return!E.s||!e.s||S&&!S[0]&&!_||_&&!_[0]&&!S?e.c=e.e=e.s=null:(e.s*=E.s,S&&_?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=m(E.e/d)+m(e.e/d),e.s*=E.s,(c=S.length)<(f=_.length)&&(v=S,S=_,_=v,i=c,c=f,f=i),i=c+f,v=[];i--;v.push(0));for(b=h,w=y,i=f;--i>=0;){for(r=0,p=_[i]%w,g=_[i]/w|0,s=i+(o=c);s>i;)r=((u=p*(u=S[--o]%w)+(a=g*u+(l=S[o]/w|0)*p)%w*w+v[s]+r)/b|0)+(a/w|0)+g*l,v[s--]=u%b;v[s]=r}return r?++n:v.splice(0,1),j(e,v,n)},s.negated=function(){var e=new M(this);return e.s=-e.s||null,e},s.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new M(e,t)).s,!i||!t)return new M(NaN);if(i!=t)return e.s=-t,n.minus(e);var s=n.e/d,o=e.e/d,a=n.c,c=e.c;if(!s||!o){if(!a||!c)return new M(i/0);if(!a[0]||!c[0])return c[0]?e:new M(a[0]?n:0*i)}if(s=m(s),o=m(o),a=a.slice(),i=s-o){for(i>0?(o=s,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)/h|0,a[t]=h===a[t]?0:a[t]%h;return i&&(a=[i].concat(a),++o),j(e,a,o)},s.precision=s.sd=function(e,t){var r,n,i,s=this;if(null!=e&&e!==!!e)return w(e,1,g),null==t?t=A:w(t,0,8),F(new M(s),e,t);if(!(r=s.c))return null;if(n=(i=r.length-1)*d+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&s.e+1>n&&(n=s.e+1),n},s.shiftedBy=function(e){return w(e,-9007199254740991,f),this.times("1e"+e)},s.squareRoot=s.sqrt=function(){var e,t,n,i,s,o=this,a=o.c,c=o.s,u=o.e,l=T+4,h=new M("0.5");if(1!==c||!a||!a[0])return new M(!c||c<0&&(!a||a[0])?NaN:a?o:1/0);if(0==(c=Math.sqrt(+V(o)))||c==1/0?(((t=v(a)).length+u)%2==0&&(t+="0"),c=Math.sqrt(+t),u=m((u+1)/2)-(u<0||u%2),n=new M(t=c==1/0?"5e"+u:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+u)):n=new M(c+""),n.c[0])for((c=(u=n.e)+l)<3&&(c=0);;)if(s=n,n=h.times(s.plus(r(o,s,l,1))),v(s.c).slice(0,c)===(t=v(n.c)).slice(0,c)){if(n.e<u&&--c,"9999"!=(t=t.slice(c-3,c+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(F(n,n.e+T+2,1),e=!n.times(n).eq(o));break}if(!i&&(F(s,s.e+T+2,0),s.times(s).eq(o))){n=s;break}l+=4,c+=4,i=1}return F(n,n.e+T+1,A,e)},s.toExponential=function(e,t){return null!=e&&(w(e,0,g),e++),U(this,e,t,1)},s.toFixed=function(e,t){return null!=e&&(w(e,0,g),e=e+this.e+1),U(this,e,t)},s.toFormat=function(e,t,r){var n,i=this;if(null==r)null!=e&&t&&"object"==typeof t?(r=t,t=null):e&&"object"==typeof e?(r=e,e=t=null):r=D;else if("object"!=typeof r)throw Error(u+"Argument not an object: "+r);if(n=i.toFixed(e,t),i.c){var s,o=n.split("."),a=+r.groupSize,c=+r.secondaryGroupSize,l=r.groupSeparator||"",h=o[0],d=o[1],f=i.s<0,p=f?h.slice(1):h,y=p.length;if(c&&(s=a,a=c,c=s,y-=s),a>0&&y>0){for(s=y%a||a,h=p.substr(0,s);s<y;s+=a)h+=l+p.substr(s,a);c>0&&(h+=l+p.slice(s)),f&&(h="-"+h)}n=d?h+(r.decimalSeparator||"")+((c=+r.fractionGroupSize)?d.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):d):h}return(r.prefix||"")+n+(r.suffix||"")},s.toFraction=function(e){var t,n,i,s,o,a,c,l,h,f,y,g,m=this,b=m.c;if(null!=e&&(!(c=new M(e)).isInteger()&&(c.c||1!==c.s)||c.lt(I)))throw Error(u+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+V(c));if(!b)return new M(m);for(t=new M(I),h=n=new M(I),i=l=new M(I),g=v(b),o=t.e=g.length-m.e-1,t.c[0]=p[(a=o%d)<0?d+a:a],e=!e||c.comparedTo(t)>0?o>0?t:h:c,a=k,k=1/0,c=new M(g),l.c[0]=0;f=r(c,t,0,1),1!=(s=n.plus(f.times(i))).comparedTo(e);)n=i,i=s,h=l.plus(f.times(s=h)),l=s,t=c.minus(f.times(s=t)),c=s;return s=r(e.minus(n),i,0,1),l=l.plus(s.times(h)),n=n.plus(s.times(i)),l.s=h.s=m.s,y=r(h,i,o*=2,A).minus(m).abs().comparedTo(r(l,n,o,A).minus(m).abs())<1?[h,i]:[l,n],k=a,y},s.toNumber=function(){return+V(this)},s.toPrecision=function(e,t){return null!=e&&w(e,1,g),U(this,e,t,2)},s.toString=function(e){var t,r=this,i=r.s,s=r.e;return null===s?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(null==e?t=s<=C||s>=R?S(v(r.c),s):_(v(r.c),s,"0"):10===e&&x?t=_(v((r=F(new M(r),T+s+1,A)).c),r.e,"0"):(w(e,2,L.length,"Base"),t=n(_(v(r.c),s,"0"),10,e,i,!0)),i<0&&r.c[0]&&(t="-"+t)),t},s.valueOf=s.toJSON=function(){return V(this)},s._isBigNumber=!0,null!=t&&M.set(t),M}(),s.default=s.BigNumber=s,void 0===(n=function(){return s}.call(t,r,t,e))||(e.exports=n)}()},41976:(e,t,r)=>{"use strict";const{Buffer:n}=r(19778),i=Symbol.for("BufferList");function s(e){if(!(this instanceof s))return new s(e);s._init.call(this,e)}s._init=function(e){Object.defineProperty(this,i,{value:!0}),this._bufs=[],this.length=0,e&&this.append(e)},s.prototype._new=function(e){return new s(e)},s.prototype._offset=function(e){if(0===e)return[0,0];let t=0;for(let r=0;r<this._bufs.length;r++){const n=t+this._bufs[r].length;if(e<n||r===this._bufs.length-1)return[r,e-t];t=n}},s.prototype._reverseOffset=function(e){const t=e[0];let r=e[1];for(let n=0;n<t;n++)r+=this._bufs[n].length;return r},s.prototype.get=function(e){if(e>this.length||e<0)return;const t=this._offset(e);return this._bufs[t[0]][t[1]]},s.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)},s.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 s=!!e,o=this._offset(r),a=i-r;let c=a,u=s&&t||0,l=o[1];if(0===r&&i===this.length){if(!s)return 1===this._bufs.length?this._bufs[0]:n.concat(this._bufs,this.length);for(let t=0;t<this._bufs.length;t++)this._bufs[t].copy(e,u),u+=this._bufs[t].length;return e}if(c<=this._bufs[o[0]].length-l)return s?this._bufs[o[0]].copy(e,t,l,l+c):this._bufs[o[0]].slice(l,l+c);s||(e=n.allocUnsafe(a));for(let n=o[0];n<this._bufs.length;n++){const t=this._bufs[n].length-l;if(!(c>t)){this._bufs[n].copy(e,u,l,l+c),u+=t;break}this._bufs[n].copy(e,u,l),u+=t,c-=t,l&&(l=0)}return e.length>u?e.slice(0,u):e},s.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)},s.prototype.toString=function(e,t,r){return this.slice(t,r).toString(e)},s.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},s.prototype.duplicate=function(){const e=this._new();for(let t=0;t<this._bufs.length;t++)e.append(this._bufs[t]);return e},s.prototype.append=function(e){if(null==e)return this;if(e.buffer)this._appendBuffer(n.from(e.buffer,e.byteOffset,e.byteLength));else if(Array.isArray(e))for(let t=0;t<e.length;t++)this.append(e[t]);else if(this._isBufferList(e))for(let t=0;t<e._bufs.length;t++)this.append(e._bufs[t]);else"number"===typeof e&&(e=e.toString()),this._appendBuffer(n.from(e));return this},s.prototype._appendBuffer=function(e){this._bufs.push(e),this.length+=e.length},s.prototype.indexOf=function(e,t,r){if(void 0===r&&"string"===typeof t&&(r=t,t=void 0),"function"===typeof e||Array.isArray(e))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if("number"===typeof e?e=n.from([e]):"string"===typeof e?e=n.from(e,r):this._isBufferList(e)?e=e.slice():Array.isArray(e.buffer)?e=n.from(e.buffer,e.byteOffset,e.byteLength):n.isBuffer(e)||(e=n.from(e)),t=Number(t||0),isNaN(t)&&(t=0),t<0&&(t=this.length+t),t<0&&(t=0),0===e.length)return t>this.length?this.length:t;const i=this._offset(t);let s=i[0],o=i[1];for(;s<this._bufs.length;s++){const t=this._bufs[s];for(;o<t.length;){if(t.length-o>=e.length){const r=t.indexOf(e,o);if(-1!==r)return this._reverseOffset([s,r]);o=t.length-e.length+1}else{const t=this._reverseOffset([s,o]);if(this._match(t,e))return t;o++}}o=0}return-1},s.prototype._match=function(e,t){if(this.length-e<t.length)return!1;for(let r=0;r<t.length;r++)if(this.get(e+r)!==t[r])return!1;return!0},function(){const e={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(const t in e)!function(t){s.prototype[t]=null===e[t]?function(e,r){return this.slice(e,e+r)[t](0,r)}:function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.slice(r,r+e[t])[t](0)}}(t)}(),s.prototype._isBufferList=function(e){return e instanceof s||s.isBufferList(e)},s.isBufferList=function(e){return null!=e&&e[i]},e.exports=s},19778:(e,t,r)=>{"use strict";const n=r(2009),i=r(84038),s="function"===typeof Symbol&&"function"===typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=c,t.SlowBuffer=function(e){+e!=e&&(e=0);return c.alloc(+e)},t.INSPECT_MAX_BYTES=50;const o=2147483647;function a(e){if(e>o)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 h(e)}return u(e,t,r)}function u(e,t,r){if("string"===typeof e)return function(e,t){"string"===typeof t&&""!==t||(t="utf8");if(!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);i!==r&&(n=n.slice(0,i));return n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(Q(e,Uint8Array)){const t=new Uint8Array(e);return f(t.buffer,t.byteOffset,t.byteLength)}return d(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(Q(e,ArrayBuffer)||e&&Q(e.buffer,ArrayBuffer))return f(e,t,r);if("undefined"!==typeof SharedArrayBuffer&&(Q(e,SharedArrayBuffer)||e&&Q(e.buffer,SharedArrayBuffer)))return f(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}if(void 0!==e.length)return"number"!==typeof e.length||J(e.length)?a(0):d(e);if("Buffer"===e.type&&Array.isArray(e.data))return d(e.data)}(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 l(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 h(e){return l(e),a(e<0?0:0|p(e))}function d(e){const t=e.length<0?0:0|p(e.length),r=a(t);for(let n=0;n<t;n+=1)r[n]=255&e[n];return r}function f(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(n,c.prototype),n}function p(e){if(e>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|e}function y(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Q(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 G(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return W(e).length;default:if(i)return n?-1:G(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 A(this,t,r);case"ascii":return R(this,t,r);case"latin1":case"binary":return P(this,t,r);case"base64":return T(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function m(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function v(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),J(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:b(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):b(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function b(e,t,r,n,i){let s,o=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;o=2,a/=2,c/=2,r/=2}function u(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){let n=-1;for(s=r;s<a;s++)if(u(e,s)===u(t,-1===n?0:s-n)){if(-1===n&&(n=s),s-n+1===c)return n*o}else-1!==n&&(s-=s-n),n=-1}else for(r+c>a&&(r=a-c),s=r;s>=0;s--){let r=!0;for(let n=0;n<c;n++)if(u(e,s+n)!==u(t,n)){r=!1;break}if(r)return s}return-1}function w(e,t,r,n){r=Number(r)||0;const i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;const s=t.length;let o;for(n>s/2&&(n=s/2),o=0;o<n;++o){const n=parseInt(t.substr(2*o,2),16);if(J(n))return o;e[r+o]=n}return o}function E(e,t,r,n){return Y(G(t,e.length-r),e,r,n)}function S(e,t,r,n){return Y(function(e){const t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function _(e,t,r,n){return Y(W(t),e,r,n)}function I(e,t,r,n){return Y(function(e,t){let r,n,i;const s=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)r=e.charCodeAt(o),n=r>>8,i=r%256,s.push(i),s.push(n);return s}(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 A(e,t,r){r=Math.min(e.length,r);const n=[];let i=t;for(;i<r;){const t=e[i];let s=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=r){let r,n,a,c;switch(o){case 1:t<128&&(s=t);break;case 2:r=e[i+1],128===(192&r)&&(c=(31&t)<<6|63&r,c>127&&(s=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)&&(s=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&&(s=c))}}null===s?(s=65533,o=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),i+=o}return function(e){const t=e.length;if(t<=C)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=C));return r}(n)}t.kMaxLength=o,c.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),c.TYPED_ARRAY_SUPPORT||"undefined"===typeof console||"function"!==typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),c.poolSize=8192,c.from=function(e,t,r){return u(e,t,r)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(e,t,r){return function(e,t,r){return l(e),e<=0?a(e):void 0!==t?"string"===typeof r?a(e).fill(t,r):a(e).fill(t):a(e)}(e,t,r)},c.allocUnsafe=function(e){return h(e)},c.allocUnsafeSlow=function(e){return h(e)},c.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==c.prototype},c.compare=function(e,t){if(Q(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),Q(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(e)||!c.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,n=t.length;for(let i=0,s=Math.min(r,n);i<s;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},c.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return c.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;const n=c.allocUnsafe(t);let i=0;for(r=0;r<e.length;++r){let t=e[r];if(Q(t,Uint8Array))i+t.length>n.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;t<e;t+=2)m(this,t,t+1);return this},c.prototype.swap32=function(){const e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},c.prototype.swap64=function(){const e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},c.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?A(this,0,e):g.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){let e="";const r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},s&&(c.prototype[s]=c.prototype.inspect),c.prototype.compare=function(e,t,r,n,i){if(Q(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 s=(i>>>=0)-(n>>>=0),o=(r>>>=0)-(t>>>=0);const a=Math.min(s,o),u=this.slice(n,i),l=e.slice(t,r);for(let c=0;c<a;++c)if(u[c]!==l[c]){s=u[c],o=l[c];break}return s<o?-1:o<s?1:0},c.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},c.prototype.indexOf=function(e,t,r){return v(this,e,t,r,!0)},c.prototype.lastIndexOf=function(e,t,r){return v(this,e,t,r,!1)},c.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"===typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=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 s=!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 S(this,e,t,r);case"base64":return _(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,t,r);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const C=4096;function R(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function P(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function k(e,t,r){const n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let i="";for(let s=t;s<r;++s)i+=X[e[s]];return i}function O(e,t,r){const n=e.slice(t,r);let i="";for(let s=0;s<n.length-1;s+=2)i+=String.fromCharCode(n[s]+256*n[s+1]);return i}function B(e,t,r){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,r,n,i,s){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function D(e,t,r,n,i){V(t,n,i,e,r,7);let s=Number(t&BigInt(4294967295));e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,r}function L(e,t,r,n,i){V(t,n,i,e,r,7);let s=Number(t&BigInt(4294967295));e[r+7]=s,s>>=8,e[r+6]=s,s>>=8,e[r+5]=s,s>>=8,e[r+4]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=o,o>>=8,e[r+2]=o,o>>=8,e[r+1]=o,o>>=8,e[r]=o,r+8}function x(e,t,r,n,i,s){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function M(e,t,r,n,s){return t=+t,r>>>=0,s||x(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function U(e,t,r,n,s){return t=+t,r>>>=0,s||x(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<e&&(t=e);const n=this.subarray(e,t);return Object.setPrototypeOf(n,c.prototype),n},c.prototype.readUintLE=c.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||B(e,t,this.length);let n=this[e],i=1,s=0;for(;++s<t&&(i*=256);)n+=this[e+s]*i;return n},c.prototype.readUintBE=c.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||B(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||B(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||B(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||B(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||B(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||B(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=$((function(e){q(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||z(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)<<BigInt(32))})),c.prototype.readBigUInt64BE=$((function(e){q(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||z(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)<<BigInt(32))+BigInt(i)})),c.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||B(e,t,this.length);let n=this[e],i=1,s=0;for(;++s<t&&(i*=256);)n+=this[e+s]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*t)),n},c.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||B(e,t,this.length);let n=t,i=1,s=this[e+--n];for(;n>0&&(i*=256);)s+=this[e+--n]*i;return i*=128,s>=i&&(s-=Math.pow(2,8*t)),s},c.prototype.readInt8=function(e,t){return e>>>=0,t||B(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||B(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||B(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||B(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||B(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=$((function(e){q(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||z(e,this.length-8);const n=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),c.prototype.readBigInt64BE=$((function(e){q(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||z(e,this.length-8);const n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+r)})),c.prototype.readFloatLE=function(e,t){return e>>>=0,t||B(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||B(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||B(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||B(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){N(this,e,t,r,Math.pow(2,8*r)-1,0)}let i=1,s=0;for(this[t]=255&e;++s<r&&(i*=256);)this[t+s]=e/i&255;return t+r},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){N(this,e,t,r,Math.pow(2,8*r)-1,0)}let i=r-1,s=1;for(this[t+i]=255&e;--i>=0&&(s*=256);)this[t+i]=e/s&255;return t+r},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||N(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||N(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||N(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||N(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||N(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=$((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return D(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=$((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return L(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);N(this,e,t,r,n-1,-n)}let i=0,s=1,o=0;for(this[t]=255&e;++i<r&&(s*=256);)e<0&&0===o&&0!==this[t+i-1]&&(o=1),this[t+i]=(e/s>>0)-o&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);N(this,e,t,r,n-1,-n)}let i=r-1,s=1,o=0;for(this[t+i]=255&e;--i>=0&&(s*=256);)e<0&&0===o&&0!==this[t+i+1]&&(o=1),this[t+i]=(e/s>>0)-o&255;return t+r},c.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||N(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||N(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||N(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||N(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||N(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=$((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return D(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=$((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return L(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(e,t,r){return M(this,e,t,!0,r)},c.prototype.writeFloatBE=function(e,t,r){return M(this,e,t,!1,r)},c.prototype.writeDoubleLE=function(e,t,r){return U(this,e,t,!0,r)},c.prototype.writeDoubleBE=function(e,t,r){return U(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<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=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<n-r&&(n=e.length-t+r);const i=n-r;return this===e&&"function"===typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),i},c.prototype.fill=function(e,t,r,n){if("string"===typeof e){if("string"===typeof t?(n=t,t=0,r=this.length):"string"===typeof r&&(n=r,r=this.length),void 0!==n&&"string"!==typeof n)throw new TypeError("encoding must be a string");if("string"===typeof n&&!c.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){const t=e.charCodeAt(0);("utf8"===n&&t<128||"latin1"===n)&&(e=t)}}else"number"===typeof e?e&=255:"boolean"===typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;let i;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"===typeof e)for(i=t;i<r;++i)this[i]=e;else{const s=c.isBuffer(e)?e:c.from(e,n),o=s.length;if(0===o)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=s[i%o]}return this};const K={};function j(e,t,r){K[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name="".concat(this.name," [").concat(e,"]"),this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return"".concat(this.name," [").concat(e,"]: ").concat(this.message)}}}function F(e){let t="",r=e.length;const n="-"===e[0]?1:0;for(;r>=n+4;r-=3)t="_".concat(e.slice(r-3,r)).concat(t);return"".concat(e.slice(0,r)).concat(t)}function V(e,t,r,n,i,s){if(e>r||e<t){const n="bigint"===typeof t?"n":"";let i;throw i=s>3?0===t||t===BigInt(0)?">= 0".concat(n," and < 2").concat(n," ** ").concat(8*(s+1)).concat(n):">= -(2".concat(n," ** ").concat(8*(s+1)-1).concat(n,") and < 2 ** ")+"".concat(8*(s+1)-1).concat(n):">= ".concat(t).concat(n," and <= ").concat(r).concat(n),new K.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,r){q(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||z(t,e.length-(r+1))}(n,i,s)}function q(e,t){if("number"!==typeof e)throw new K.ERR_INVALID_ARG_TYPE(t,"number",e)}function z(e,t,r){if(Math.floor(e)!==e)throw q(e,r),new K.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new K.ERR_BUFFER_OUT_OF_BOUNDS;throw new K.ERR_OUT_OF_RANGE(r||"offset",">= ".concat(r?1:0," and <= ").concat(t),e)}j("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?"".concat(e," is outside of buffer bounds"):"Attempt to access memory outside buffer bounds"}),RangeError),j("ERR_INVALID_ARG_TYPE",(function(e,t){return'The "'.concat(e,'" argument must be of type number. Received type ').concat(typeof t)}),TypeError),j("ERR_OUT_OF_RANGE",(function(e,t,r){let n='The value of "'.concat(e,'" is out of range.'),i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=F(String(r)):"bigint"===typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=F(i)),i+="n"),n+=" It must be ".concat(t,". Received ").concat(i),n}),RangeError);const H=/[^+/0-9A-Za-z-_]/g;function G(e,t){let r;t=t||1/0;const n=e.length;let i=null;const s=[];for(let o=0;o<n;++o){if(r=e.charCodeAt(o),r>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.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;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function W(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(H,"")).length<2)return"";for(;e.length%4!==0;)e+="=";return e}(e))}function Y(e,t,r,n){let i;for(i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function Q(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function J(e){return e!==e}const X=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 $(e){return"undefined"===typeof BigInt?Z:e}function Z(){throw new Error("BigInt not supported")}},83708:e=>{"use strict";e.exports=function(e,t){let{className:r,symbolName:n}=t;const i=Symbol.for(n),s={[r]:class extends e{constructor(){super(...arguments),Object.defineProperty(this,i,{value:!0})}get[Symbol.toStringTag](){return r}}}[r];return s["is".concat(r)]=e=>!(!e||!e[i]),s},e.exports.proto=function(e,t){let{className:r,symbolName:n,withoutNew:i}=t;const s=Symbol.for(n),o={[r]:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];if(i&&!(this instanceof o))return new o(...r);const a=e.call(this,...r)||this;return a&&!a[s]&&Object.defineProperty(a,s,{value:!0}),a}}[r];return o.prototype=Object.create(e.prototype),o.prototype.constructor=o,Object.defineProperty(o.prototype,Symbol.toStringTag,{get:()=>r}),o["is".concat(r)]=e=>!(!e||!e[s]),o}},75235:(e,t,r)=>{"use strict";const n=r(5696),i=/\s+at.*(?:\(|\s)(.*)\)?/,s=/^(?:(?:(?:node|(?:internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)\.js:\d+:\d+)|native)/,o="undefined"===typeof 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")&&!s.test(r)})).filter((e=>""!==e.trim())).map((e=>t.pretty?e.replace(i,((e,t)=>e.replace(t,t.replace(o,"~")))):e)).join("\n"))},18392:(e,t,r)=>{var n=r(21964);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(r){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(r){}!e&&"undefined"!==typeof n&&"env"in n&&(e={NODE_ENV:"production",PUBLIC_URL:"/examples/relay-reactjs-chat",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0}.DEBUG);return e},t.useColors=function(){if("undefined"!==typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!==typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"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(18472)(t);const{formatters:i}=e.exports;i.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}},18472:(e,t,r)=>{e.exports=function(e){function t(e){let r,i,s,o=null;function a(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];if(!a.enabled)return;const s=a,o=Number(new Date),c=o-(r||o);s.diff=c,s.prev=r,s.curr=o,r=o,n[0]=t.coerce(n[0]),"string"!==typeof n[0]&&n.unshift("%O");let u=0;n[0]=n[0].replace(/%([a-zA-Z%])/g,((e,r)=>{if("%%"===e)return"%";u++;const i=t.formatters[r];if("function"===typeof i){const t=n[u];e=i.call(s,t),n.splice(u,1),u--}return e})),t.formatArgs.call(s,n);const l=s.log||t.log;l.apply(s,n)}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!==o?o:(i!==t.namespaces&&(i=t.namespaces,s=t.enabled(e)),s),set:e=>{o=e}}),"function"===typeof t.init&&t.init(a),a}function n(e,r){const n=t(this.namespace+("undefined"===typeof 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){if(e instanceof Error)return e.stack||e.message;return 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<i;r++)n[r]&&("-"===(e=n[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=r(78193),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((r=>{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t}},68718:e=>{"use strict";function t(e,t){t=t||{};this._head=0,this._tail=0,this._capacity=t.capacity,this._capacityMask=3,this._list=new Array(4),Array.isArray(e)&&this._fromArray(e)}t.prototype.peekAt=function(e){var t=e;if(t===(0|t)){var r=this.size();if(!(t>=r||t<-r))return t<0&&(t+=r),t=this._head+t&this._capacityMask,this._list[t]}},t.prototype.get=function(e){return this.peekAt(e)},t.prototype.peek=function(){if(this._head!==this._tail)return this._list[this._head]},t.prototype.peekFront=function(){return this.peek()},t.prototype.peekBack=function(){return this.peekAt(-1)},Object.defineProperty(t.prototype,"length",{get:function(){return this.size()}}),t.prototype.size=function(){return this._head===this._tail?0:this._head<this._tail?this._tail-this._head:this._capacityMask+1-(this._head-this._tail)},t.prototype.unshift=function(e){if(void 0===e)return this.size();var t=this._list.length;return this._head=this._head-1+t&this._capacityMask,this._list[this._head]=e,this._tail===this._head&&this._growArray(),this._capacity&&this.size()>this._capacity&&this.pop(),this._head<this._tail?this._tail-this._head:this._capacityMask+1-(this._head-this._tail)},t.prototype.shift=function(){var e=this._head;if(e!==this._tail){var t=this._list[e];return this._list[e]=void 0,this._head=e+1&this._capacityMask,e<2&&this._tail>1e4&&this._tail<=this._list.length>>>2&&this._shrinkArray(),t}},t.prototype.push=function(e){if(void 0===e)return this.size();var t=this._tail;return this._list[t]=e,this._tail=t+1&this._capacityMask,this._tail===this._head&&this._growArray(),this._capacity&&this.size()>this._capacity&&this.shift(),this._head<this._tail?this._tail-this._head:this._capacityMask+1-(this._head-this._tail)},t.prototype.pop=function(){var e=this._tail;if(e!==this._head){var t=this._list.length;this._tail=e-1+t&this._capacityMask;var r=this._list[this._tail];return this._list[this._tail]=void 0,this._head<2&&e>1e4&&e<=t>>>2&&this._shrinkArray(),r}},t.prototype.removeOne=function(e){var t=e;if(t===(0|t)&&this._head!==this._tail){var r=this.size(),n=this._list.length;if(!(t>=r||t<-r)){t<0&&(t+=r),t=this._head+t&this._capacityMask;var i,s=this._list[t];if(e<r/2){for(i=e;i>0;i--)this._list[t]=this._list[t=t-1+n&this._capacityMask];this._list[t]=void 0,this._head=this._head+1+n&this._capacityMask}else{for(i=r-1-e;i>0;i--)this._list[t]=this._list[t=t+1+n&this._capacityMask];this._list[t]=void 0,this._tail=this._tail-1+n&this._capacityMask}return s}}},t.prototype.remove=function(e,t){var r,n=e,i=t;if(n===(0|n)&&this._head!==this._tail){var s=this.size(),o=this._list.length;if(!(n>=s||n<-s||t<1)){if(n<0&&(n+=s),1===t||!t)return(r=new Array(1))[0]=this.removeOne(n),r;if(0===n&&n+t>=s)return r=this.toArray(),this.clear(),r;var a;for(n+t>s&&(t=s-n),r=new Array(t),a=0;a<t;a++)r[a]=this._list[this._head+n+a&this._capacityMask];if(n=this._head+n&this._capacityMask,e+t===s){for(this._tail=this._tail-t+o&this._capacityMask,a=t;a>0;a--)this._list[n=n+1+o&this._capacityMask]=void 0;return r}if(0===e){for(this._head=this._head+t+o&this._capacityMask,a=t-1;a>0;a--)this._list[n=n+1+o&this._capacityMask]=void 0;return r}if(n<s/2){for(this._head=this._head+e+t+o&this._capacityMask,a=e;a>0;a--)this.unshift(this._list[n=n-1+o&this._capacityMask]);for(n=this._head-1+o&this._capacityMask;i>0;)this._list[n=n-1+o&this._capacityMask]=void 0,i--;e<0&&(this._tail=n)}else{for(this._tail=n,n=n+t+o&this._capacityMask,a=s-(t+e);a>0;a--)this.push(this._list[n++]);for(n=this._tail;i>0;)this._list[n=n+1+o&this._capacityMask]=void 0,i--}return this._head<2&&this._tail>1e4&&this._tail<=o>>>2&&this._shrinkArray(),r}}},t.prototype.splice=function(e,t){var r=e;if(r===(0|r)){var n=this.size();if(r<0&&(r+=n),!(r>n)){if(arguments.length>2){var i,s,o,a=arguments.length,c=this._list.length,u=2;if(!n||r<n/2){for(s=new Array(r),i=0;i<r;i++)s[i]=this._list[this._head+i&this._capacityMask];for(0===t?(o=[],r>0&&(this._head=this._head+r+c&this._capacityMask)):(o=this.remove(r,t),this._head=this._head+r+c&this._capacityMask);a>u;)this.unshift(arguments[--a]);for(i=r;i>0;i--)this.unshift(s[i-1])}else{var l=(s=new Array(n-(r+t))).length;for(i=0;i<l;i++)s[i]=this._list[this._head+r+t+i&this._capacityMask];for(0===t?(o=[],r!=n&&(this._tail=this._head+r+c&this._capacityMask)):(o=this.remove(r,t),this._tail=this._tail-l+c&this._capacityMask);u<a;)this.push(arguments[u++]);for(i=0;i<l;i++)this.push(s[i])}return o}return this.remove(r,t)}}},t.prototype.clear=function(){this._head=0,this._tail=0},t.prototype.isEmpty=function(){return this._head===this._tail},t.prototype.toArray=function(){return this._copyArray(!1)},t.prototype._fromArray=function(e){for(var t=0;t<e.length;t++)this.push(e[t])},t.prototype._copyArray=function(e){var t,r=[],n=this._list,i=n.length;if(e||this._head>this._tail){for(t=this._head;t<i;t++)r.push(n[t]);for(t=0;t<this._tail;t++)r.push(n[t])}else for(t=this._head;t<this._tail;t++)r.push(n[t]);return r},t.prototype._growArray=function(){this._head&&(this._list=this._copyArray(!0),this._head=0),this._tail=this._list.length,this._list.length<<=1,this._capacityMask=this._capacityMask<<1|1},t.prototype._shrinkArray=function(){this._list.length>>>=1,this._capacityMask>>>=1},e.exports=t},18259:(e,t,r)=>{"use strict";const n=r(18392),i=n("dns-over-http-resolver");i.error=n("dns-over-http-resolver:error");const s=r(449),o=r(20827);class a{constructor(){let{maxCache:e=100}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._cache=new s({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){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"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("".concat(t," is not supported"))}}async resolve4(e){const t="A",r=this._cache.get(o.getCacheKey(e,t));if(r)return r;for(const s of this._getShuffledServers())try{const r=await o.fetch(o.buildResource({serverResolver:s,hostname:e,recordType:t})),n=await r.json(),i=n.Answer.map((e=>e.data)),a=Math.min(n.Answer.map((e=>e.TTL)));return this._cache.set(o.getCacheKey(e,t),i,{ttl:a}),i}catch(n){i.error("".concat(s," could not resolve ").concat(e," record ").concat(t))}throw new Error("Could not resolve ".concat(e," record ").concat(t))}async resolve6(e){const t="AAAA",r=this._cache.get(o.getCacheKey(e,t));if(r)return r;for(const s of this._getShuffledServers())try{const r=await o.fetch(o.buildResource({serverResolver:s,hostname:e,recordType:t})),n=await r.json(),i=n.Answer.map((e=>e.data)),a=Math.min(n.Answer.map((e=>e.TTL)));return this._cache.set(o.getCacheKey(e,t),i,{ttl:a}),i}catch(n){i.error("".concat(s," could not resolve ").concat(e," record ").concat(t))}throw new Error("Could not resolve ".concat(e," record ").concat(t))}async resolveTxt(e){const t="TXT",r=this._cache.get(o.getCacheKey(e,t));if(r)return r;for(const s of this._getShuffledServers())try{const r=await o.fetch(o.buildResource({serverResolver:s,hostname:e,recordType:t})),n=await r.json(),i=n.Answer.map((e=>[e.data.replace(/['"]+/g,"")])),a=Math.min(n.Answer.map((e=>e.TTL)));return this._cache.set(o.getCacheKey(e,t),i,{ttl:a}),i}catch(n){i.error("".concat(s," could not resolve ").concat(e," record ").concat(t))}throw new Error("Could not resolve ".concat(e," record ").concat(t))}}a.Resolver=a,e.exports=a},20827:(e,t,r)=>{"use strict";const{default:n,Headers:i}=r(1900);e.exports={buildResource:function(e){let{serverResolver:t,hostname:r,recordType:n}=e;return"".concat(t,"?name=").concat(r,"&type=").concat(n)},fetch:function(e){return n(e,{headers:new i({accept:"application/dns-json"})})},getCacheKey:function(e,t){return"".concat(t,"_").concat(e)}}},82010:(e,t,r)=>{"use strict";function n(e,t){Object.defineProperty(e,"super_",{value:t,writable:!0,configurable:!0}),Object.setPrototypeOf(e.prototype,t.prototype)}let i="undefined"!==typeof r.g?r.g.AbortError:"undefined"!==typeof window?window.AbortError:null;function s(e,t,r){Error.captureStackTrace(this,s),this.message="status="+t+" while requesting "+e+" ["+r+"]",this.uri=e,this.status=t,this.method=r}function o(e,t){Error.captureStackTrace(this,o),this.message=e,this.cause=t}function a(e){Error.captureStackTrace(this,a),this.message="Timeout (t="+e+").",this.timeout=e}function c(e){if(e.protocol){if(!["http:","https:","udp4:","udp6:"].includes(e.protocol))throw new Error('Invalid Endpoint: unsupported protocol "'.concat(e.protocol,'" for endpoint: ').concat(JSON.stringify(e)))}else e.protocol="https:";if("string"!==typeof e.host)throw new Error('Invalid Endpoint: host "'.concat(e.host,'" needs to be a string: ').concat(JSON.stringify(e)));if("number"!==typeof e.port&&!isNaN(e.port))throw new Error('Invalid Endpoint: port "'.concat(e.port,'" needs to be a number: ').concat(JSON.stringify(e)));for(const t in e)void 0!==e[t]&&(this[t]=e[t])}i||(i=function(){Error.captureStackTrace(this,i),this.message="Request aborted."},n(i,Error),i.prototype.code="ABORT_ERR",i.prototype.name="AbortError"),n(s,Error),s.prototype.code="HTTP_STATUS",s.prototype.name="StatusError",n(o,Error),o.prototype.code="RESPONSE_ERR",o.prototype.name="ResponseError",n(a,Error),a.prototype.code="ETIMEOUT",a.prototype.name="TimeoutError";const u=r(35438),l={};for(const h in u)l[h]=new c(u[h]);e.exports={endpoints:l,AbortError:i,HTTPStatusError:s,ResponseError:o,TimeoutError:a,Endpoint:c}},54535:(e,t,r)=>{"use strict";const n=r(85720),i=r(11313),s=r(82010),o=s.AbortError,a=s.ResponseError,c=s.Endpoint,u=s.endpoints,l=/^((\d{1,3}\.){3,3}\d{1,3})(:(\d{2,5}))?$/,h=/^((::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?)(:(\d{2,5}))?$/i;function d(e,t,r,s){return s&&s.aborted?Promise.reject(new o):"udp4:"===e.protocol||"udp6:"===e.protocol?i.queryDns(e,t,r,s):function(e,t,r,s){const o=e.protocol||"https:";return new Promise((function(c,u){i.request(o,e.host,e.port?parseInt(e.port,10):"https:"===o?443:80,e.path||"/dns-query",/^post$/i.test(e.method)?"POST":"GET",n.encode(Object.assign({flags:n.RECURSION_DESIRED,type:"query"},t)),r,s,(function(t,r,i){let s;if(null===t)if(0===r.length)t=new a("Empty.");else try{s=n.decode(r)}catch(o){t=new a("Invalid packet (cause="+o.message+")",o)}null!==t?u(Object.assign(t,{response:i,endpoint:e})):(s.endpoint=e,s.response=i,c(s))}))}))}(e,t,r,s)}function f(e,t){let r;t=Object.assign({retries:5,timeout:3e4},t);try{if(r="doh"===t.endpoints?i.endpoints({doh:!0,dns:!1}):"dns"===t.endpoints?i.endpoints({doh:!1,dns:!0}):p(t.endpoints)||i.endpoints({doh:!0,dns:!0}),!r||0===r.length)throw new Error("No endpoints defined.")}catch(n){return Promise.reject(n)}return function(e,t,r){const n=1===e.length?e[0]:e[Math.floor(Math.random()*e.length)%e.length];return d(n,t,r.timeout,r.signal).then((e=>(e.endpoint=n,e)),(e=>{if("AbortError"===e.name||0===r.retries)throw e;return r.retries>0&&(r.retries-=1),f(t,r)}))}(r,e,t)}function p(e){if(!e)return;if("function"!==typeof e[Symbol.iterator]||"string"===typeof e)throw new Error("Endpoints needs to be iterable.");const t=[];for(let r of e)"object"===typeof r?(r instanceof c||(r=new c(r)),t.push(r)):"string"===typeof r&&t.push(u[r]||y(r));return t}function y(e){const t=/^(([^:]+?:)\/\/)?([^/]*?)(\/.*?)?(\s\[(post|get)\])?$/i.exec(e);let r,n,i=t[2]||"https:",s=1;const o=h.exec(t[3]);if(o){const e=l.exec(t[3]);e?(r=e[1],e[4]&&(n=parseInt(e[4]))):(s=2,r=o[1],o[9]&&(n=parseInt(o[10])))}else{const e=/^([^:]*)(:(.*))?$/.exec(t[3]);r=e[1],e[3]&&(n=parseInt(e[3]))}return"udp:"===i&&(i=2===s?"udp6:":"udp4:"),new c({protocol:i,host:r,port:n,path:t[4],method:t[6]})}e.exports={query:f,endpoints:u,parseEndpoints:p,AbortError:o,ResponseError:a,TimeoutError:s.TimeoutError,HTTPStatusError:s.HTTPStatusError,Endpoint:c}},11313:(e,t,r)=>{"use strict";const n=r(19778).Buffer,i=r(82010),s=i.AbortError,o=i.HTTPStatusError,a=i.TimeoutError,c="application/dns-message",u=Object.values(i.endpoints).filter((function(e){return!e.filter&&!e.logging&&e.cors}));function l(){}e.exports={request:function(e,t,r,i,u,h,d,f,p){const y=e+"//"+t+":"+r+i+("GET"===u?"?dns="+h.toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"):""),g=new XMLHttpRequest;g.open(u,y,!0),g.setRequestHeader("Accept",c),"POST"===u&&g.setRequestHeader("Content-Type",c),g.responseType="arraybuffer",g.timeout=d,g.ontimeout=function(){m(new a(d));try{g.abort()}catch(e){}},g.onreadystatechange=function(){if(g.readyState>1&&200!==g.status&&0!==g.status){m(new o(y,g.status,u));try{g.abort()}catch(e){}}},g.onerror=function(){m(200===g.status?new Error("Inexplicable XHR Error"):new o(y,g.status,u))},g.onload=function(){200!==g.status?m(new o(y,g.status,u)):m(null,n.from(g.response))},"GET"===u?g.send():g.send(h),f&&f.addEventListener("abort",v);let m=function(e,t){m=l,f&&f.removeEventListener("abort",v),p(e,t,g)};function v(){m(new s);try{g.abort()}catch(e){}}},queryDns:function(){throw new Error('Only "doh" endpoints are supported in the browser')},endpoints:e=>{if(e.doh)return u;if(e.dns)throw new Error('Only "doh" is supported in the browser')}}},99882:(e,t)=>{"use strict";t.toString=function(e){switch(e){case 1:return"IN";case 2:return"CS";case 3:return"CH";case 4:return"HS";case 255:return"ANY"}return"UNKNOWN_"+e},t.toClass=function(e){switch(e.toUpperCase()){case"IN":return 1;case"CS":return 2;case"CH":return 3;case"HS":return 4;case"ANY":return 255}return 0}},85720:(e,t,r)=>{"use strict";const n=r(19778).Buffer,i=r(82936),s=r(2266),o=r(71365),a=r(99882),c=r(61974),u=r(17612),l=32768,h=t.name={};h.encode=function(e,t,r){t||(t=n.alloc(h.encodingLength(e))),r||(r=0);const i=r,s=e.replace(/^\.|\.$/gm,"");if(s.length){const e=s.split(".");for(let n=0;n<e.length;n++){const i=t.write(e[n],r+1);t[r]=i,r+=i+1}}return t[r++]=0,h.encode.bytes=r-i,t},h.encode.bytes=0,h.decode=function(e,t){t||(t=0);const r=[];let n=t,i=0,s=0,o=!1;for(;;){if(t>=e.length)throw new Error("Cannot decode name (buffer overflow)");const a=e[t++];if(s+=o?0:1,0===a)break;if(0===(192&a)){if(t+a>e.length)throw new Error("Cannot decode name (buffer overflow)");if(i+=a+1,i>254)throw new Error("Cannot decode name (name too long)");r.push(e.toString("utf-8",t,t+a)),t+=a,s+=o?0:a}else{if(192!==(192&a))throw new Error("Cannot decode name (bad label)");{if(t+1>e.length)throw new Error("Cannot decode name (buffer overflow)");const r=e.readUInt16BE(t-1)-49152;if(r>=n)throw new Error("Cannot decode name (bad pointer)");t=r,n=r,s+=o?0:1,o=!0}}}return h.decode.bytes=s,0===r.length?".":r.join(".")},h.decode.bytes=0,h.encodingLength=function(e){return"."===e||".."===e?1:n.byteLength(e.replace(/^\.|\.$/gm,""))+2};const d={encode:function(e,t,r){t||(t=n.alloc(d.encodingLength(e))),r||(r=0);const i=t.write(e,r+1);return t[r]=i,d.encode.bytes=i+1,t}};d.encode.bytes=0,d.decode=function(e,t){t||(t=0);const r=e[t],n=e.toString("utf-8",t+1,t+1+r);return d.decode.bytes=r+1,n},d.decode.bytes=0,d.encodingLength=function(e){return n.byteLength(e)+1};const f={encode:function(e,t,r){t||(t=f.encodingLength(e)),r||(r=0);const n=32767&(e.flags||0),i="response"===e.type?32768:0;return t.writeUInt16BE(e.id||0,r),t.writeUInt16BE(n|i,r+2),t.writeUInt16BE(e.questions.length,r+4),t.writeUInt16BE(e.answers.length,r+6),t.writeUInt16BE(e.authorities.length,r+8),t.writeUInt16BE(e.additionals.length,r+10),t}};f.encode.bytes=12,f.decode=function(e,t){if(t||(t=0),e.length<12)throw new Error("Header must be 12 bytes");const r=e.readUInt16BE(t+2);return{id:e.readUInt16BE(t),type:32768&r?"response":"query",flags:32767&r,flag_qr:1===(r>>15&1),opcode:o.toString(r>>11&15),flag_aa:1===(r>>10&1),flag_tc:1===(r>>9&1),flag_rd:1===(r>>8&1),flag_ra:1===(r>>7&1),flag_z:1===(r>>6&1),flag_ad:1===(r>>5&1),flag_cd:1===(r>>4&1),rcode:s.toString(15&r),questions:new Array(e.readUInt16BE(t+4)),answers:new Array(e.readUInt16BE(t+6)),authorities:new Array(e.readUInt16BE(t+8)),additionals:new Array(e.readUInt16BE(t+10))}},f.decode.bytes=12,f.encodingLength=function(){return 12};const p=t.unknown={};p.encode=function(e,t,r){return t||(t=n.alloc(p.encodingLength(e))),r||(r=0),t.writeUInt16BE(e.length,r),e.copy(t,r+2),p.encode.bytes=e.length+2,t},p.encode.bytes=0,p.decode=function(e,t){t||(t=0);const r=e.readUInt16BE(t),n=e.slice(t+2,t+2+r);return p.decode.bytes=r+2,n},p.decode.bytes=0,p.encodingLength=function(e){return e.length+2};const y=t.ns={};y.encode=function(e,t,r){return t||(t=n.alloc(y.encodingLength(e))),r||(r=0),h.encode(e,t,r+2),t.writeUInt16BE(h.encode.bytes,r),y.encode.bytes=h.encode.bytes+2,t},y.encode.bytes=0,y.decode=function(e,t){t||(t=0);const r=e.readUInt16BE(t),n=h.decode(e,t+2);return y.decode.bytes=r+2,n},y.decode.bytes=0,y.encodingLength=function(e){return h.encodingLength(e)+2};const g=t.soa={};g.encode=function(e,t,r){t||(t=n.alloc(g.encodingLength(e))),r||(r=0);const i=r;return r+=2,h.encode(e.mname,t,r),r+=h.encode.bytes,h.encode(e.rname,t,r),r+=h.encode.bytes,t.writeUInt32BE(e.serial||0,r),r+=4,t.writeUInt32BE(e.refresh||0,r),r+=4,t.writeUInt32BE(e.retry||0,r),r+=4,t.writeUInt32BE(e.expire||0,r),r+=4,t.writeUInt32BE(e.minimum||0,r),r+=4,t.writeUInt16BE(r-i-2,i),g.encode.bytes=r-i,t},g.encode.bytes=0,g.decode=function(e,t){t||(t=0);const r=t,n={};return t+=2,n.mname=h.decode(e,t),t+=h.decode.bytes,n.rname=h.decode(e,t),t+=h.decode.bytes,n.serial=e.readUInt32BE(t),t+=4,n.refresh=e.readUInt32BE(t),t+=4,n.retry=e.readUInt32BE(t),t+=4,n.expire=e.readUInt32BE(t),t+=4,n.minimum=e.readUInt32BE(t),t+=4,g.decode.bytes=t-r,n},g.decode.bytes=0,g.encodingLength=function(e){return 22+h.encodingLength(e.mname)+h.encodingLength(e.rname)};const m=t.txt={};m.encode=function(e,t,r){Array.isArray(e)||(e=[e]);for(let s=0;s<e.length;s++)if("string"===typeof e[s]&&(e[s]=n.from(e[s])),!n.isBuffer(e[s]))throw new Error("Must be a Buffer");t||(t=n.alloc(m.encodingLength(e))),r||(r=0);const i=r;return r+=2,e.forEach((function(e){t[r++]=e.length,e.copy(t,r,0,e.length),r+=e.length})),t.writeUInt16BE(r-i-2,i),m.encode.bytes=r-i,t},m.encode.bytes=0,m.decode=function(e,t){t||(t=0);const r=t;let n=e.readUInt16BE(t);t+=2;let i=[];for(;n>0;){const r=e[t++];if(--n,n<r)throw new Error("Buffer overflow");i.push(e.slice(t,t+r)),t+=r,n-=r}return m.decode.bytes=t-r,i},m.decode.bytes=0,m.encodingLength=function(e){Array.isArray(e)||(e=[e]);let t=2;return e.forEach((function(e){t+="string"===typeof e?n.byteLength(e)+1:e.length+1})),t};const v=t.null={};v.encode=function(e,t,r){t||(t=n.alloc(v.encodingLength(e))),r||(r=0),"string"===typeof e&&(e=n.from(e)),e||(e=n.alloc(0));const i=r;r+=2;const s=e.length;return e.copy(t,r,0,s),r+=s,t.writeUInt16BE(r-i-2,i),v.encode.bytes=r-i,t},v.encode.bytes=0,v.decode=function(e,t){t||(t=0);const r=t,n=e.readUInt16BE(t);t+=2;const i=e.slice(t,t+n);return t+=n,v.decode.bytes=t-r,i},v.decode.bytes=0,v.encodingLength=function(e){return e?(n.isBuffer(e)?e.length:n.byteLength(e))+2:2};const b=t.hinfo={};b.encode=function(e,t,r){t||(t=n.alloc(b.encodingLength(e))),r||(r=0);const i=r;return r+=2,d.encode(e.cpu,t,r),r+=d.encode.bytes,d.encode(e.os,t,r),r+=d.encode.bytes,t.writeUInt16BE(r-i-2,i),b.encode.bytes=r-i,t},b.encode.bytes=0,b.decode=function(e,t){t||(t=0);const r=t,n={};return t+=2,n.cpu=d.decode(e,t),t+=d.decode.bytes,n.os=d.decode(e,t),t+=d.decode.bytes,b.decode.bytes=t-r,n},b.decode.bytes=0,b.encodingLength=function(e){return d.encodingLength(e.cpu)+d.encodingLength(e.os)+2};const w=t.ptr={},E=t.cname=w,S=t.dname=w;w.encode=function(e,t,r){return t||(t=n.alloc(w.encodingLength(e))),r||(r=0),h.encode(e,t,r+2),t.writeUInt16BE(h.encode.bytes,r),w.encode.bytes=h.encode.bytes+2,t},w.encode.bytes=0,w.decode=function(e,t){t||(t=0);const r=h.decode(e,t+2);return w.decode.bytes=h.decode.bytes+2,r},w.decode.bytes=0,w.encodingLength=function(e){return h.encodingLength(e)+2};const _=t.srv={};_.encode=function(e,t,r){t||(t=n.alloc(_.encodingLength(e))),r||(r=0),t.writeUInt16BE(e.priority||0,r+2),t.writeUInt16BE(e.weight||0,r+4),t.writeUInt16BE(e.port||0,r+6),h.encode(e.target,t,r+8);const i=h.encode.bytes+6;return t.writeUInt16BE(i,r),_.encode.bytes=i+2,t},_.encode.bytes=0,_.decode=function(e,t){t||(t=0);const r=e.readUInt16BE(t),n={};return n.priority=e.readUInt16BE(t+2),n.weight=e.readUInt16BE(t+4),n.port=e.readUInt16BE(t+6),n.target=h.decode(e,t+8),_.decode.bytes=r+2,n},_.decode.bytes=0,_.encodingLength=function(e){return 8+h.encodingLength(e.target)};const I=t.caa={};I.ISSUER_CRITICAL=128,I.encode=function(e,t,r){const i=I.encodingLength(e);return t||(t=n.alloc(I.encodingLength(e))),r||(r=0),e.issuerCritical&&(e.flags=I.ISSUER_CRITICAL),t.writeUInt16BE(i-2,r),r+=2,t.writeUInt8(e.flags||0,r),r+=1,d.encode(e.tag,t,r),r+=d.encode.bytes,t.write(e.value,r),r+=n.byteLength(e.value),I.encode.bytes=i,t},I.encode.bytes=0,I.decode=function(e,t){t||(t=0);const r=e.readUInt16BE(t),n=t+=2,i={};return i.flags=e.readUInt8(t),t+=1,i.tag=d.decode(e,t),t+=d.decode.bytes,i.value=e.toString("utf-8",t,n+r),i.issuerCritical=!!(i.flags&I.ISSUER_CRITICAL),I.decode.bytes=r+2,i},I.decode.bytes=0,I.encodingLength=function(e){return d.encodingLength(e.tag)+d.encodingLength(e.value)+2};const T=t.mx={};T.encode=function(e,t,r){t||(t=n.alloc(T.encodingLength(e))),r||(r=0);const i=r;return r+=2,t.writeUInt16BE(e.preference||0,r),r+=2,h.encode(e.exchange,t,r),r+=h.encode.bytes,t.writeUInt16BE(r-i-2,i),T.encode.bytes=r-i,t},T.encode.bytes=0,T.decode=function(e,t){t||(t=0);const r=t,n={};return t+=2,n.preference=e.readUInt16BE(t),t+=2,n.exchange=h.decode(e,t),t+=h.decode.bytes,T.decode.bytes=t-r,n},T.encodingLength=function(e){return 4+h.encodingLength(e.exchange)};const A=t.a={};A.encode=function(e,t,r){return t||(t=n.alloc(A.encodingLength(e))),r||(r=0),t.writeUInt16BE(4,r),r+=2,u.v4.encode(e,t,r),A.encode.bytes=6,t},A.encode.bytes=0,A.decode=function(e,t){t||(t=0),t+=2;const r=u.v4.decode(e,t);return A.decode.bytes=6,r},A.decode.bytes=0,A.encodingLength=function(){return 6};const C=t.aaaa={};C.encode=function(e,t,r){return t||(t=n.alloc(C.encodingLength(e))),r||(r=0),t.writeUInt16BE(16,r),r+=2,u.v6.encode(e,t,r),C.encode.bytes=18,t},C.encode.bytes=0,C.decode=function(e,t){t||(t=0),t+=2;const r=u.v6.decode(e,t);return C.decode.bytes=18,r},C.decode.bytes=0,C.encodingLength=function(){return 18};const R=t.option={};R.encode=function(e,t,r){t||(t=n.alloc(R.encodingLength(e))),r||(r=0);const i=r,s=c.toCode(e.code);if(t.writeUInt16BE(s,r),r+=2,e.data)t.writeUInt16BE(e.data.length,r),r+=2,e.data.copy(t,r),r+=e.data.length;else switch(s){case 8:const i=e.sourcePrefixLength||0,s=e.family||u.familyOf(e.ip),o=u.encode(e.ip,n.alloc),a=Math.ceil(i/8);t.writeUInt16BE(a+4,r),r+=2,t.writeUInt16BE(s,r),r+=2,t.writeUInt8(i,r++),t.writeUInt8(e.scopePrefixLength||0,r++),o.copy(t,r,0,a),r+=a;break;case 11:e.timeout?(t.writeUInt16BE(2,r),r+=2,t.writeUInt16BE(e.timeout,r),r+=2):(t.writeUInt16BE(0,r),r+=2);break;case 12:const c=e.length||0;t.writeUInt16BE(c,r),r+=2,t.fill(0,r,r+c),r+=c;break;case 14:const l=2*e.tags.length;t.writeUInt16BE(l,r),r+=2;for(const n of e.tags)t.writeUInt16BE(n,r),r+=2;break;default:throw new Error("Unknown roption code: ".concat(e.code))}return R.encode.bytes=r-i,t},R.encode.bytes=0,R.decode=function(e,t){t||(t=0);const r={};r.code=e.readUInt16BE(t),r.type=c.toString(r.code),t+=2;const i=e.readUInt16BE(t);switch(t+=2,r.data=e.slice(t,t+i),r.code){case 8:r.family=e.readUInt16BE(t),t+=2,r.sourcePrefixLength=e.readUInt8(t++),r.scopePrefixLength=e.readUInt8(t++);const s=n.alloc(1===r.family?4:16);e.copy(s,0,t,t+i-4),r.ip=u.decode(s);break;case 11:i>0&&(r.timeout=e.readUInt16BE(t),t+=2);break;case 14:r.tags=[];for(let n=0;n<i;n+=2)r.tags.push(e.readUInt16BE(t)),t+=2}return R.decode.bytes=i+4,r},R.decode.bytes=0,R.encodingLength=function(e){if(e.data)return e.data.length+4;switch(c.toCode(e.code)){case 8:const t=e.sourcePrefixLength||0;return Math.ceil(t/8)+8;case 11:return"number"===typeof e.timeout?6:4;case 12:return e.length+4;case 14:return 4+2*e.tags.length}throw new Error("Unknown roption code: ".concat(e.code))};const P=t.opt={};P.encode=function(e,t,r){t||(t=n.alloc(P.encodingLength(e))),r||(r=0);const i=r,s=j(e,R);return t.writeUInt16BE(s,r),r=F(e,R,t,r+2),P.encode.bytes=r-i,t},P.encode.bytes=0,P.decode=function(e,t){t||(t=0);const r=t,n=[];let i=e.readUInt16BE(t);t+=2;let s=0;for(;i>0;)n[s++]=R.decode(e,t),t+=R.decode.bytes,i-=R.decode.bytes;return P.decode.bytes=t-r,n},P.decode.bytes=0,P.encodingLength=function(e){return 2+j(e||[],R)};const k=t.dnskey={};k.PROTOCOL_DNSSEC=3,k.ZONE_KEY=128,k.SECURE_ENTRYPOINT=32768,k.encode=function(e,t,r){t||(t=n.alloc(k.encodingLength(e))),r||(r=0);const i=r,s=e.key;if(!n.isBuffer(s))throw new Error("Key must be a Buffer");return r+=2,t.writeUInt16BE(e.flags,r),r+=2,t.writeUInt8(k.PROTOCOL_DNSSEC,r),r+=1,t.writeUInt8(e.algorithm,r),r+=1,s.copy(t,r,0,s.length),r+=s.length,k.encode.bytes=r-i,t.writeUInt16BE(k.encode.bytes-2,i),t},k.encode.bytes=0,k.decode=function(e,t){t||(t=0);const r=t;var n={},i=e.readUInt16BE(t);if(t+=2,n.flags=e.readUInt16BE(t),t+=2,e.readUInt8(t)!==k.PROTOCOL_DNSSEC)throw new Error("Protocol must be 3");return t+=1,n.algorithm=e.readUInt8(t),t+=1,n.key=e.slice(t,r+i+2),t+=n.key.length,k.decode.bytes=t-r,n},k.decode.bytes=0,k.encodingLength=function(e){return 6+n.byteLength(e.key)};const O=t.rrsig={};O.encode=function(e,t,r){t||(t=n.alloc(O.encodingLength(e))),r||(r=0);const s=r,o=e.signature;if(!n.isBuffer(o))throw new Error("Signature must be a Buffer");return r+=2,t.writeUInt16BE(i.toType(e.typeCovered),r),r+=2,t.writeUInt8(e.algorithm,r),r+=1,t.writeUInt8(e.labels,r),r+=1,t.writeUInt32BE(e.originalTTL,r),r+=4,t.writeUInt32BE(e.expiration,r),r+=4,t.writeUInt32BE(e.inception,r),r+=4,t.writeUInt16BE(e.keyTag,r),r+=2,h.encode(e.signersName,t,r),r+=h.encode.bytes,o.copy(t,r,0,o.length),r+=o.length,O.encode.bytes=r-s,t.writeUInt16BE(O.encode.bytes-2,s),t},O.encode.bytes=0,O.decode=function(e,t){t||(t=0);const r=t;var n={},s=e.readUInt16BE(t);return t+=2,n.typeCovered=i.toString(e.readUInt16BE(t)),t+=2,n.algorithm=e.readUInt8(t),t+=1,n.labels=e.readUInt8(t),t+=1,n.originalTTL=e.readUInt32BE(t),t+=4,n.expiration=e.readUInt32BE(t),t+=4,n.inception=e.readUInt32BE(t),t+=4,n.keyTag=e.readUInt16BE(t),t+=2,n.signersName=h.decode(e,t),t+=h.decode.bytes,n.signature=e.slice(t,r+s+2),t+=n.signature.length,O.decode.bytes=t-r,n},O.decode.bytes=0,O.encodingLength=function(e){return 20+h.encodingLength(e.signersName)+n.byteLength(e.signature)};const B=t.rp={};B.encode=function(e,t,r){t||(t=n.alloc(B.encodingLength(e))),r||(r=0);const i=r;return r+=2,h.encode(e.mbox||".",t,r),r+=h.encode.bytes,h.encode(e.txt||".",t,r),r+=h.encode.bytes,B.encode.bytes=r-i,t.writeUInt16BE(B.encode.bytes-2,i),t},B.encode.bytes=0,B.decode=function(e,t){t||(t=0);const r=t,n={};return t+=2,n.mbox=h.decode(e,t)||".",t+=h.decode.bytes,n.txt=h.decode(e,t)||".",t+=h.decode.bytes,B.decode.bytes=t-r,n},B.decode.bytes=0,B.encodingLength=function(e){return 2+h.encodingLength(e.mbox||".")+h.encodingLength(e.txt||".")};const N={encode:function(e,t,r){t||(t=n.alloc(N.encodingLength(e))),r||(r=0);const s=r;for(var o=[],a=0;a<e.length;a++){var c=i.toType(e[a]);void 0===o[c>>8]&&(o[c>>8]=[]),o[c>>8][c>>3&31]|=1<<7-(7&c)}for(a=0;a<o.length;a++)if(void 0!==o[a]){var u=n.from(o[a]);t.writeUInt8(a,r),r+=1,t.writeUInt8(u.length,r),r+=1,u.copy(t,r),r+=u.length}return N.encode.bytes=r-s,t}};N.encode.bytes=0,N.decode=function(e,t,r){t||(t=0);const n=t;for(var s=[];t-n<r;){var o=e.readUInt8(t);t+=1;var a=e.readUInt8(t);t+=1;for(var c=0;c<a;c++)for(var u=e.readUInt8(t+c),l=0;l<8;l++)if(u&1<<7-l){var h=i.toString(o<<8|c<<3|l);s.push(h)}t+=a}return N.decode.bytes=t-n,s},N.decode.bytes=0,N.encodingLength=function(e){for(var t=[],r=0;r<e.length;r++){var n=i.toType(e[r]);t[n>>8]=Math.max(t[n>>8]||0,255&n)}var s=0;for(r=0;r<t.length;r++)void 0!==t[r]&&(s+=2+Math.ceil((t[r]+1)/8));return s};const D=t.nsec={};D.encode=function(e,t,r){t||(t=n.alloc(D.encodingLength(e))),r||(r=0);const i=r;return r+=2,h.encode(e.nextDomain,t,r),r+=h.encode.bytes,N.encode(e.rrtypes,t,r),r+=N.encode.bytes,D.encode.bytes=r-i,t.writeUInt16BE(D.encode.bytes-2,i),t},D.encode.bytes=0,D.decode=function(e,t){t||(t=0);const r=t;var n={},i=e.readUInt16BE(t);return t+=2,n.nextDomain=h.decode(e,t),t+=h.decode.bytes,n.rrtypes=N.decode(e,t,i-(t-r)),t+=N.decode.bytes,D.decode.bytes=t-r,n},D.decode.bytes=0,D.encodingLength=function(e){return 2+h.encodingLength(e.nextDomain)+N.encodingLength(e.rrtypes)};const L=t.nsec3={};L.encode=function(e,t,r){t||(t=n.alloc(L.encodingLength(e))),r||(r=0);const i=r,s=e.salt;if(!n.isBuffer(s))throw new Error("salt must be a Buffer");const o=e.nextDomain;if(!n.isBuffer(o))throw new Error("nextDomain must be a Buffer");return r+=2,t.writeUInt8(e.algorithm,r),r+=1,t.writeUInt8(e.flags,r),r+=1,t.writeUInt16BE(e.iterations,r),r+=2,t.writeUInt8(s.length,r),r+=1,s.copy(t,r,0,s.length),r+=s.length,t.writeUInt8(o.length,r),r+=1,o.copy(t,r,0,o.length),r+=o.length,N.encode(e.rrtypes,t,r),r+=N.encode.bytes,L.encode.bytes=r-i,t.writeUInt16BE(L.encode.bytes-2,i),t},L.encode.bytes=0,L.decode=function(e,t){t||(t=0);const r=t;var n={},i=e.readUInt16BE(t);t+=2,n.algorithm=e.readUInt8(t),t+=1,n.flags=e.readUInt8(t),t+=1,n.iterations=e.readUInt16BE(t),t+=2;const s=e.readUInt8(t);t+=1,n.salt=e.slice(t,t+s),t+=s;const o=e.readUInt8(t);return t+=1,n.nextDomain=e.slice(t,t+o),t+=o,n.rrtypes=N.decode(e,t,i-(t-r)),t+=N.decode.bytes,L.decode.bytes=t-r,n},L.decode.bytes=0,L.encodingLength=function(e){return 8+e.salt.length+e.nextDomain.length+N.encodingLength(e.rrtypes)};const x=t.ds={};x.encode=function(e,t,r){t||(t=n.alloc(x.encodingLength(e))),r||(r=0);const i=r,s=e.digest;if(!n.isBuffer(s))throw new Error("Digest must be a Buffer");return r+=2,t.writeUInt16BE(e.keyTag,r),r+=2,t.writeUInt8(e.algorithm,r),r+=1,t.writeUInt8(e.digestType,r),r+=1,s.copy(t,r,0,s.length),r+=s.length,x.encode.bytes=r-i,t.writeUInt16BE(x.encode.bytes-2,i),t},x.encode.bytes=0,x.decode=function(e,t){t||(t=0);const r=t;var n={},i=e.readUInt16BE(t);return t+=2,n.keyTag=e.readUInt16BE(t),t+=2,n.algorithm=e.readUInt8(t),t+=1,n.digestType=e.readUInt8(t),t+=1,n.digest=e.slice(t,r+i+2),t+=n.digest.length,x.decode.bytes=t-r,n},x.decode.bytes=0,x.encodingLength=function(e){return 6+n.byteLength(e.digest)};const M=t.record=function(e){switch(e.toUpperCase()){case"A":return A;case"PTR":return w;case"CNAME":return E;case"DNAME":return S;case"TXT":return m;case"NULL":return v;case"AAAA":return C;case"SRV":return _;case"HINFO":return b;case"CAA":return I;case"NS":return y;case"SOA":return g;case"MX":return T;case"OPT":return P;case"DNSKEY":return k;case"RRSIG":return O;case"RP":return B;case"NSEC":return D;case"NSEC3":return L;case"DS":return x}return p},U=t.answer={};U.encode=function(e,t,r){t||(t=n.alloc(U.encodingLength(e))),r||(r=0);const s=r;if(h.encode(e.name,t,r),r+=h.encode.bytes,t.writeUInt16BE(i.toType(e.type),r),"OPT"===e.type.toUpperCase()){if("."!==e.name)throw new Error("OPT name must be root.");t.writeUInt16BE(e.udpPayloadSize||4096,r+2),t.writeUInt8(e.extendedRcode||0,r+4),t.writeUInt8(e.ednsVersion||0,r+5),t.writeUInt16BE(e.flags||0,r+6),r+=8,P.encode(e.options||[],t,r),r+=P.encode.bytes}else{let n=a.toClass(void 0===e.class?"IN":e.class);e.flush&&(n|=l),t.writeUInt16BE(n,r+2),t.writeUInt32BE(e.ttl||0,r+4),r+=8;const i=M(e.type);i.encode(e.data,t,r),r+=i.encode.bytes}return U.encode.bytes=r-s,t},U.encode.bytes=0,U.decode=function(e,t){t||(t=0);const r={},n=t;if(r.name=h.decode(e,t),t+=h.decode.bytes,r.type=i.toString(e.readUInt16BE(t)),"OPT"===r.type)r.udpPayloadSize=e.readUInt16BE(t+2),r.extendedRcode=e.readUInt8(t+4),r.ednsVersion=e.readUInt8(t+5),r.flags=e.readUInt16BE(t+6),r.flag_do=1===(r.flags>>15&1),r.options=P.decode(e,t+8),t+=8+P.decode.bytes;else{const n=e.readUInt16BE(t+2);r.ttl=e.readUInt32BE(t+4),r.class=a.toString(-32769&n),r.flush=!!(n&l);const i=M(r.type);r.data=i.decode(e,t+8),t+=8+i.decode.bytes}return U.decode.bytes=t-n,r},U.decode.bytes=0,U.encodingLength=function(e){const t=null!==e.data&&void 0!==e.data?e.data:e.options;return h.encodingLength(e.name)+8+M(e.type).encodingLength(t)};const K=t.question={};function j(e,t){let r=0;for(let n=0;n<e.length;n++)r+=t.encodingLength(e[n]);return r}function F(e,t,r,n){for(let i=0;i<e.length;i++)t.encode(e[i],r,n),n+=t.encode.bytes;return n}function V(e,t,r,n){for(let i=0;i<e.length;i++)e[i]=t.decode(r,n),n+=t.decode.bytes;return n}K.encode=function(e,t,r){t||(t=n.alloc(K.encodingLength(e))),r||(r=0);const s=r;return h.encode(e.name,t,r),r+=h.encode.bytes,t.writeUInt16BE(i.toType(e.type),r),r+=2,t.writeUInt16BE(a.toClass(void 0===e.class?"IN":e.class),r),r+=2,K.encode.bytes=r-s,e},K.encode.bytes=0,K.decode=function(e,t){t||(t=0);const r=t,n={};n.name=h.decode(e,t),t+=h.decode.bytes,n.type=i.toString(e.readUInt16BE(t)),t+=2,n.class=a.toString(e.readUInt16BE(t)),t+=2;return!!(32768&n.class)&&(n.class&=-32769),K.decode.bytes=t-r,n},K.decode.bytes=0,K.encodingLength=function(e){return h.encodingLength(e.name)+4},t.AUTHORITATIVE_ANSWER=1024,t.TRUNCATED_RESPONSE=512,t.RECURSION_DESIRED=256,t.RECURSION_AVAILABLE=128,t.AUTHENTIC_DATA=32,t.CHECKING_DISABLED=16,t.DNSSEC_OK=32768,t.encode=function(e,r,i){const s=!r;s&&(r=n.alloc(t.encodingLength(e))),i||(i=0);const o=i;return e.questions||(e.questions=[]),e.answers||(e.answers=[]),e.authorities||(e.authorities=[]),e.additionals||(e.additionals=[]),f.encode(e,r,i),i+=f.encode.bytes,i=F(e.questions,K,r,i),i=F(e.answers,U,r,i),i=F(e.authorities,U,r,i),i=F(e.additionals,U,r,i),t.encode.bytes=i-o,s&&t.encode.bytes!==r.length?r.slice(0,t.encode.bytes):r},t.encode.bytes=0,t.decode=function(e,r){r||(r=0);const n=r,i=f.decode(e,r);return r+=f.decode.bytes,r=V(i.questions,K,e,r),r=V(i.answers,U,e,r),r=V(i.authorities,U,e,r),r=V(i.additionals,U,e,r),t.decode.bytes=r-n,i},t.decode.bytes=0,t.encodingLength=function(e){return f.encodingLength(e)+j(e.questions||[],K)+j(e.answers||[],U)+j(e.authorities||[],U)+j(e.additionals||[],U)},t.streamEncode=function(e){const r=t.encode(e),i=n.alloc(2);i.writeUInt16BE(r.byteLength);const s=n.concat([i,r]);return t.streamEncode.bytes=s.byteLength,s},t.streamEncode.bytes=0,t.streamDecode=function(e){const r=e.readUInt16BE(0);if(e.byteLength<r+2)return null;const n=t.decode(e.slice(2));return t.streamDecode.bytes=t.decode.bytes,n},t.streamDecode.bytes=0},71365:(e,t)=>{"use strict";t.toString=function(e){switch(e){case 0:return"QUERY";case 1:return"IQUERY";case 2:return"STATUS";case 3:return"OPCODE_3";case 4:return"NOTIFY";case 5:return"UPDATE";case 6:return"OPCODE_6";case 7:return"OPCODE_7";case 8:return"OPCODE_8";case 9:return"OPCODE_9";case 10:return"OPCODE_10";case 11:return"OPCODE_11";case 12:return"OPCODE_12";case 13:return"OPCODE_13";case 14:return"OPCODE_14";case 15:return"OPCODE_15"}return"OPCODE_"+e},t.toOpcode=function(e){switch(e.toUpperCase()){case"QUERY":return 0;case"IQUERY":return 1;case"STATUS":return 2;case"OPCODE_3":return 3;case"NOTIFY":return 4;case"UPDATE":return 5;case"OPCODE_6":return 6;case"OPCODE_7":return 7;case"OPCODE_8":return 8;case"OPCODE_9":return 9;case"OPCODE_10":return 10;case"OPCODE_11":return 11;case"OPCODE_12":return 12;case"OPCODE_13":return 13;case"OPCODE_14":return 14;case"OPCODE_15":return 15}return 0}},61974:(e,t)=>{"use strict";t.toString=function(e){switch(e){case 1:return"LLQ";case 2:return"UL";case 3:return"NSID";case 5:return"DAU";case 6:return"DHU";case 7:return"N3U";case 8:return"CLIENT_SUBNET";case 9:return"EXPIRE";case 10:return"COOKIE";case 11:return"TCP_KEEPALIVE";case 12:return"PADDING";case 13:return"CHAIN";case 14:return"KEY_TAG";case 26946:return"DEVICEID"}return e<0?null:"OPTION_".concat(e)},t.toCode=function(e){if("number"===typeof e)return e;if(!e)return-1;switch(e.toUpperCase()){case"OPTION_0":return 0;case"LLQ":return 1;case"UL":return 2;case"NSID":return 3;case"OPTION_4":return 4;case"DAU":return 5;case"DHU":return 6;case"N3U":return 7;case"CLIENT_SUBNET":return 8;case"EXPIRE":return 9;case"COOKIE":return 10;case"TCP_KEEPALIVE":return 11;case"PADDING":return 12;case"CHAIN":return 13;case"KEY_TAG":return 14;case"DEVICEID":return 26946;case"OPTION_65535":return 65535}const t=e.match(/_(\d+)$/);return t?parseInt(t[1],10):-1}},2266:(e,t)=>{"use strict";t.toString=function(e){switch(e){case 0:return"NOERROR";case 1:return"FORMERR";case 2:return"SERVFAIL";case 3:return"NXDOMAIN";case 4:return"NOTIMP";case 5:return"REFUSED";case 6:return"YXDOMAIN";case 7:return"YXRRSET";case 8:return"NXRRSET";case 9:return"NOTAUTH";case 10:return"NOTZONE";case 11:return"RCODE_11";case 12:return"RCODE_12";case 13:return"RCODE_13";case 14:return"RCODE_14";case 15:return"RCODE_15"}return"RCODE_"+e},t.toRcode=function(e){switch(e.toUpperCase()){case"NOERROR":return 0;case"FORMERR":return 1;case"SERVFAIL":return 2;case"NXDOMAIN":return 3;case"NOTIMP":return 4;case"REFUSED":return 5;case"YXDOMAIN":return 6;case"YXRRSET":return 7;case"NXRRSET":return 8;case"NOTAUTH":return 9;case"NOTZONE":return 10;case"RCODE_11":return 11;case"RCODE_12":return 12;case"RCODE_13":return 13;case"RCODE_14":return 14;case"RCODE_15":return 15}return 0}},82936:(e,t)=>{"use strict";t.toString=function(e){switch(e){case 1:return"A";case 10:return"NULL";case 28:return"AAAA";case 18:return"AFSDB";case 42:return"APL";case 257:return"CAA";case 60:return"CDNSKEY";case 59:return"CDS";case 37:return"CERT";case 5:return"CNAME";case 49:return"DHCID";case 32769:return"DLV";case 39:return"DNAME";case 48:return"DNSKEY";case 43:return"DS";case 55:return"HIP";case 13:return"HINFO";case 45:return"IPSECKEY";case 25:return"KEY";case 36:return"KX";case 29:return"LOC";case 15:return"MX";case 35:return"NAPTR";case 2:return"NS";case 47:return"NSEC";case 50:return"NSEC3";case 51:return"NSEC3PARAM";case 12:return"PTR";case 46:return"RRSIG";case 17:return"RP";case 24:return"SIG";case 6:return"SOA";case 99:return"SPF";case 33:return"SRV";case 44:return"SSHFP";case 32768:return"TA";case 249:return"TKEY";case 52:return"TLSA";case 250:return"TSIG";case 16:return"TXT";case 252:return"AXFR";case 251:return"IXFR";case 41:return"OPT";case 255:return"ANY"}return"UNKNOWN_"+e},t.toType=function(e){switch(e.toUpperCase()){case"A":return 1;case"NULL":return 10;case"AAAA":return 28;case"AFSDB":return 18;case"APL":return 42;case"CAA":return 257;case"CDNSKEY":return 60;case"CDS":return 59;case"CERT":return 37;case"CNAME":return 5;case"DHCID":return 49;case"DLV":return 32769;case"DNAME":return 39;case"DNSKEY":return 48;case"DS":return 43;case"HIP":return 55;case"HINFO":return 13;case"IPSECKEY":return 45;case"KEY":return 25;case"KX":return 36;case"LOC":return 29;case"MX":return 15;case"NAPTR":return 35;case"NS":return 2;case"NSEC":return 47;case"NSEC3":return 50;case"NSEC3PARAM":return 51;case"PTR":return 12;case"RRSIG":return 46;case"RP":return 17;case"SIG":return 24;case"SOA":return 6;case"SPF":return 99;case"SRV":return 33;case"SSHFP":return 44;case"TA":return 32768;case"TKEY":return 249;case"TLSA":return 52;case"TSIG":return 250;case"TXT":return 16;case"AXFR":return 252;case"IXFR":return 251;case"OPT":return 41;case"ANY":case"*":return 255}return e.toUpperCase().startsWith("UNKNOWN_")?parseInt(e.slice(8)):0}},67963: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(i){n.message=e.message,n.stack=e.stack;const r=function(){};r.prototype=Object.create(Object.getPrototypeOf(e));return t(new r,n)}}},51590:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.promisify=r;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,s=Array(i),o=0;o<i;o++)s[o]=arguments[o];return new n((function(n,i){s.push((function(e){if(e)return i(e);for(var r=arguments.length,s=Array(1<r?r-1:0),o=1;o<r;o++)s[o-1]=arguments[o];if(1===s.length||!t)return n(s[0]);var a={};s.forEach((function(e,r){var n=t[r];n&&(a[n]=e)})),n(a)})),e.apply(r,s)}))}}r.argumentNames="__ES6-PROMISIFY--CUSTOM-ARGUMENTS__",r.Promise=void 0},3634:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(45413);t.EventIterator=n.EventIterator,t.subscribe=function(e,t,r){return new n.EventIterator((r=>{let{push:n}=r;return this.addEventListener(e,n,t),()=>this.removeEventListener(e,n,t)}),r)},t.default=n.EventIterator},45413:(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 ".concat(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){let{highWaterMark:t=100,lowWaterMark:n=1}=arguments.length>1&&void 0!==arguments[1]?arguments[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},97143:e=>{"use strict";var t=Object.prototype.hasOwnProperty,r="~";function n(){}function i(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function s(e,t,n,s,o){if("function"!==typeof n)throw new TypeError("The listener must be a function");var a=new i(n,s||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],a]:e._events[c].push(a):(e._events[c]=a,e._eventsCount++),e}function o(e,t){0===--e._eventsCount?e._events=new n:delete e._events[t]}function a(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),a.prototype.eventNames=function(){var e,n,i=[];if(0===this._eventsCount)return i;for(n in e=this._events)t.call(e,n)&&i.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},a.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,s=n.length,o=new Array(s);i<s;i++)o[i]=n[i].fn;return o},a.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},a.prototype.emit=function(e,t,n,i,s,o){var a=r?r+e:e;if(!this._events[a])return!1;var c,u,l=this._events[a],h=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,n),!0;case 4:return l.fn.call(l.context,t,n,i),!0;case 5:return l.fn.call(l.context,t,n,i,s),!0;case 6:return l.fn.call(l.context,t,n,i,s,o),!0}for(u=1,c=new Array(h-1);u<h;u++)c[u-1]=arguments[u];l.fn.apply(l.context,c)}else{var d,f=l.length;for(u=0;u<f;u++)switch(l[u].once&&this.removeListener(e,l[u].fn,void 0,!0),h){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,t);break;case 3:l[u].fn.call(l[u].context,t,n);break;case 4:l[u].fn.call(l[u].context,t,n,i);break;default:if(!c)for(d=1,c=new Array(h-1);d<h;d++)c[d-1]=arguments[d];l[u].fn.apply(l[u].context,c)}}return!0},a.prototype.on=function(e,t,r){return s(this,e,t,r,!1)},a.prototype.once=function(e,t,r){return s(this,e,t,r,!0)},a.prototype.removeListener=function(e,t,n,i){var s=r?r+e:e;if(!this._events[s])return this;if(!t)return o(this,s),this;var a=this._events[s];if(a.fn)a.fn!==t||i&&!a.once||n&&a.context!==n||o(this,s);else{for(var c=0,u=[],l=a.length;c<l;c++)(a[c].fn!==t||i&&!a[c].once||n&&a[c].context!==n)&&u.push(a[c]);u.length?this._events[s]=1===u.length?u[0]:u:o(this,s)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&o(this,t)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=r,a.EventEmitter=a,e.exports=a},47465: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 s(){s.init.call(this)}e.exports=s,e.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,s),n(r)}function s(){"function"===typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}y(e,t,s,{once:!0}),"error"!==t&&function(e,t,r){"function"===typeof e.on&&y(e,"error",t,r)}(e,i,{once:!0})}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var o=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?s.defaultMaxListeners:e._maxListeners}function u(e,t,r,n){var i,s,o,u;if(a(r),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),s=e._events),o=s[t]),void 0===o)o=s[t]=r,++e._eventsCount;else if("function"===typeof o?o=s[t]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),(i=c(e))>0&&o.length>i&&!o.warned){o.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=o.length,u=l,console&&console.warn&&console.warn(u)}return e}function l(){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 h(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=l.bind(n);return i.listener=r,n.wrapFn=i,i}function d(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;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):p(i,i.length)}function f(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"===typeof r)return 1;if(void 0!==r)return r.length}return 0}function p(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function y(e,t,r,n){if("function"===typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!==typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(s){n.once&&e.removeEventListener(t,i),r(s)}))}}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(e){if("number"!==typeof e||e<0||i(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");o=e}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if("number"!==typeof e||e<0||i(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return c(this)},s.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,s=this._events;if(void 0!==s)i=i&&void 0===s.error;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=s[e];if(void 0===c)return!1;if("function"===typeof c)n(c,this,t);else{var u=c.length,l=p(c,u);for(r=0;r<u;++r)n(l[r],this,t)}return!0},s.prototype.addListener=function(e,t){return u(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return u(this,e,t,!0)},s.prototype.once=function(e,t){return a(t),this.on(e,h(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,h(this,e,t)),this},s.prototype.removeListener=function(e,t){var r,n,i,s,o;if(a(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0===--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!==typeof r){for(i=-1,s=r.length-1;s>=0;s--)if(r[s]===t||r[s].listener===t){o=r[s].listener,i=s;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0===--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,s=Object.keys(r);for(n=0;n<s.length;++n)"removeListener"!==(i=s[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"===typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},s.prototype.listeners=function(e){return d(this,e,!0)},s.prototype.rawListeners=function(e){return d(this,e,!1)},s.listenerCount=function(e,t){return"function"===typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},s.prototype.listenerCount=f,s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},11167: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]}}},75125:(e,t,r)=>{const n=r(11167);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()}}},38295: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")}},34737: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,s){r[i]=s,++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)}}}},49437:(e,t,r)=>{var n,i=r(21964);!function(){"use strict";var t="object"===typeof window?window:{};!t.HI_BASE32_NO_NODE_JS&&"object"===typeof i&&i.versions&&i.versions.node&&(t=r.g);var s=!t.HI_BASE32_NO_COMMON_JS&&e.exports,o=r.amdO,a="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567".split(""),c={A:0,B:1,C:2,D:3,E:4,F:5,G:6,H:7,I:8,J:9,K:10,L:11,M:12,N:13,O:14,P:15,Q:16,R:17,S:18,T:19,U:20,V:21,W:22,X:23,Y:24,Z:25,2:26,3:27,4:28,5:29,6:30,7:31},u=[0,0,0,0,0,0,0,0],l=function(e,t){t.length>10&&(t="..."+t.substr(-10));var r=new Error("Decoded data is not valid UTF-8. Maybe try base32.decode.asBytes()? Partial data after reading "+e+" bytes: "+t+" <-");throw r.position=e,r},h=function(e){if(""===e)return[];if(!/^[A-Z2-7=]+$/.test(e))throw new Error("Invalid base32 characters");for(var t,r,n,i,s,o,a,u,l=[],h=0,d=(e=e.replace(/=/g,"")).length,f=0,p=d>>3<<3;f<p;)t=c[e.charAt(f++)],r=c[e.charAt(f++)],n=c[e.charAt(f++)],i=c[e.charAt(f++)],s=c[e.charAt(f++)],o=c[e.charAt(f++)],a=c[e.charAt(f++)],u=c[e.charAt(f++)],l[h++]=255&(t<<3|r>>>2),l[h++]=255&(r<<6|n<<1|i>>>4),l[h++]=255&(i<<4|s>>>1),l[h++]=255&(s<<7|o<<2|a>>>3),l[h++]=255&(a<<5|u);var y=d-p;return 2===y?(t=c[e.charAt(f++)],r=c[e.charAt(f++)],l[h++]=255&(t<<3|r>>>2)):4===y?(t=c[e.charAt(f++)],r=c[e.charAt(f++)],n=c[e.charAt(f++)],i=c[e.charAt(f++)],l[h++]=255&(t<<3|r>>>2),l[h++]=255&(r<<6|n<<1|i>>>4)):5===y?(t=c[e.charAt(f++)],r=c[e.charAt(f++)],n=c[e.charAt(f++)],i=c[e.charAt(f++)],s=c[e.charAt(f++)],l[h++]=255&(t<<3|r>>>2),l[h++]=255&(r<<6|n<<1|i>>>4),l[h++]=255&(i<<4|s>>>1)):7===y&&(t=c[e.charAt(f++)],r=c[e.charAt(f++)],n=c[e.charAt(f++)],i=c[e.charAt(f++)],s=c[e.charAt(f++)],o=c[e.charAt(f++)],a=c[e.charAt(f++)],l[h++]=255&(t<<3|r>>>2),l[h++]=255&(r<<6|n<<1|i>>>4),l[h++]=255&(i<<4|s>>>1),l[h++]=255&(s<<7|o<<2|a>>>3)),l},d=function(e,t){if(!t)return function(e){for(var t,r,n="",i=e.length,s=0,o=0;s<i;)if((t=e[s++])<=127)n+=String.fromCharCode(t);else{t>191&&t<=223?(r=31&t,o=1):t<=239?(r=15&t,o=2):t<=247?(r=7&t,o=3):l(s,n);for(var a=0;a<o;++a)((t=e[s++])<128||t>191)&&l(s,n),r<<=6,r+=63&t;r>=55296&&r<=57343&&l(s,n),r>1114111&&l(s,n),r<=65535?n+=String.fromCharCode(r):(r-=65536,n+=String.fromCharCode(55296+(r>>10)),n+=String.fromCharCode(56320+(1023&r)))}return n}(h(e));if(""===e)return"";if(!/^[A-Z2-7=]+$/.test(e))throw new Error("Invalid base32 characters");var r,n,i,s,o,a,u,d,f="",p=e.indexOf("=");-1===p&&(p=e.length);for(var y=0,g=p>>3<<3;y<g;)r=c[e.charAt(y++)],n=c[e.charAt(y++)],i=c[e.charAt(y++)],s=c[e.charAt(y++)],o=c[e.charAt(y++)],a=c[e.charAt(y++)],u=c[e.charAt(y++)],d=c[e.charAt(y++)],f+=String.fromCharCode(255&(r<<3|n>>>2))+String.fromCharCode(255&(n<<6|i<<1|s>>>4))+String.fromCharCode(255&(s<<4|o>>>1))+String.fromCharCode(255&(o<<7|a<<2|u>>>3))+String.fromCharCode(255&(u<<5|d));var m=p-g;return 2===m?(r=c[e.charAt(y++)],n=c[e.charAt(y++)],f+=String.fromCharCode(255&(r<<3|n>>>2))):4===m?(r=c[e.charAt(y++)],n=c[e.charAt(y++)],i=c[e.charAt(y++)],s=c[e.charAt(y++)],f+=String.fromCharCode(255&(r<<3|n>>>2))+String.fromCharCode(255&(n<<6|i<<1|s>>>4))):5===m?(r=c[e.charAt(y++)],n=c[e.charAt(y++)],i=c[e.charAt(y++)],s=c[e.charAt(y++)],o=c[e.charAt(y++)],f+=String.fromCharCode(255&(r<<3|n>>>2))+String.fromCharCode(255&(n<<6|i<<1|s>>>4))+String.fromCharCode(255&(s<<4|o>>>1))):7===m&&(r=c[e.charAt(y++)],n=c[e.charAt(y++)],i=c[e.charAt(y++)],s=c[e.charAt(y++)],o=c[e.charAt(y++)],a=c[e.charAt(y++)],u=c[e.charAt(y++)],f+=String.fromCharCode(255&(r<<3|n>>>2))+String.fromCharCode(255&(n<<6|i<<1|s>>>4))+String.fromCharCode(255&(s<<4|o>>>1))+String.fromCharCode(255&(o<<7|a<<2|u>>>3))),f},f={encode:function(e,t){var r="string"!==typeof e;return r&&e.constructor===ArrayBuffer&&(e=new Uint8Array(e)),r?function(e){for(var t,r,n,i,s,o="",c=e.length,u=0,l=5*parseInt(c/5);u<l;)t=e[u++],r=e[u++],n=e[u++],i=e[u++],s=e[u++],o+=a[t>>>3]+a[31&(t<<2|r>>>6)]+a[r>>>1&31]+a[31&(r<<4|n>>>4)]+a[31&(n<<1|i>>>7)]+a[i>>>2&31]+a[31&(i<<3|s>>>5)]+a[31&s];var h=c-l;return 1===h?(t=e[u],o+=a[t>>>3]+a[t<<2&31]+"======"):2===h?(t=e[u++],r=e[u],o+=a[t>>>3]+a[31&(t<<2|r>>>6)]+a[r>>>1&31]+a[r<<4&31]+"===="):3===h?(t=e[u++],r=e[u++],n=e[u],o+=a[t>>>3]+a[31&(t<<2|r>>>6)]+a[r>>>1&31]+a[31&(r<<4|n>>>4)]+a[n<<1&31]+"==="):4===h&&(t=e[u++],r=e[u++],n=e[u++],i=e[u],o+=a[t>>>3]+a[31&(t<<2|r>>>6)]+a[r>>>1&31]+a[31&(r<<4|n>>>4)]+a[31&(n<<1|i>>>7)]+a[i>>>2&31]+a[i<<3&31]+"="),o}(e):t?function(e){for(var t,r,n,i,s,o="",c=e.length,u=0,l=5*parseInt(c/5);u<l;)t=e.charCodeAt(u++),r=e.charCodeAt(u++),n=e.charCodeAt(u++),i=e.charCodeAt(u++),s=e.charCodeAt(u++),o+=a[t>>>3]+a[31&(t<<2|r>>>6)]+a[r>>>1&31]+a[31&(r<<4|n>>>4)]+a[31&(n<<1|i>>>7)]+a[i>>>2&31]+a[31&(i<<3|s>>>5)]+a[31&s];var h=c-l;return 1===h?(t=e.charCodeAt(u),o+=a[t>>>3]+a[t<<2&31]+"======"):2===h?(t=e.charCodeAt(u++),r=e.charCodeAt(u),o+=a[t>>>3]+a[31&(t<<2|r>>>6)]+a[r>>>1&31]+a[r<<4&31]+"===="):3===h?(t=e.charCodeAt(u++),r=e.charCodeAt(u++),n=e.charCodeAt(u),o+=a[t>>>3]+a[31&(t<<2|r>>>6)]+a[r>>>1&31]+a[31&(r<<4|n>>>4)]+a[n<<1&31]+"==="):4===h&&(t=e.charCodeAt(u++),r=e.charCodeAt(u++),n=e.charCodeAt(u++),i=e.charCodeAt(u),o+=a[t>>>3]+a[31&(t<<2|r>>>6)]+a[r>>>1&31]+a[31&(r<<4|n>>>4)]+a[31&(n<<1|i>>>7)]+a[i>>>2&31]+a[i<<3&31]+"="),o}(e):function(e){var t,r,n,i,s,o,c,l=!1,h="",d=0,f=0,p=e.length;if(""===e)return h;do{for(u[0]=u[5],u[1]=u[6],u[2]=u[7],c=f;d<p&&c<5;++d)(o=e.charCodeAt(d))<128?u[c++]=o:o<2048?(u[c++]=192|o>>6,u[c++]=128|63&o):o<55296||o>=57344?(u[c++]=224|o>>12,u[c++]=128|o>>6&63,u[c++]=128|63&o):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++d)),u[c++]=240|o>>18,u[c++]=128|o>>12&63,u[c++]=128|o>>6&63,u[c++]=128|63&o);f=c-5,d===p&&++d,d>p&&c<6&&(l=!0),t=u[0],c>4?(r=u[1],n=u[2],i=u[3],s=u[4],h+=a[t>>>3]+a[31&(t<<2|r>>>6)]+a[r>>>1&31]+a[31&(r<<4|n>>>4)]+a[31&(n<<1|i>>>7)]+a[i>>>2&31]+a[31&(i<<3|s>>>5)]+a[31&s]):1===c?h+=a[t>>>3]+a[t<<2&31]+"======":2===c?(r=u[1],h+=a[t>>>3]+a[31&(t<<2|r>>>6)]+a[r>>>1&31]+a[r<<4&31]+"===="):3===c?(r=u[1],n=u[2],h+=a[t>>>3]+a[31&(t<<2|r>>>6)]+a[r>>>1&31]+a[31&(r<<4|n>>>4)]+a[n<<1&31]+"==="):(r=u[1],n=u[2],i=u[3],h+=a[t>>>3]+a[31&(t<<2|r>>>6)]+a[r>>>1&31]+a[31&(r<<4|n>>>4)]+a[31&(n<<1|i>>>7)]+a[i>>>2&31]+a[i<<3&31]+"=")}while(!l);return h}(e)},decode:d};d.asBytes=h,s?e.exports=f:(t.base32=f,o&&(void 0===(n=function(){return f}.call(f,r,f,e))||(e.exports=n)))}()},84038:(e,t)=>{t.read=function(e,t,r,n,i){var s,o,a=8*i-n-1,c=(1<<a)-1,u=c>>1,l=-7,h=r?i-1:0,d=r?-1:1,f=e[t+h];for(h+=d,s=f&(1<<-l)-1,f>>=-l,l+=a;l>0;s=256*s+e[t+h],h+=d,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=n;l>0;o=256*o+e[t+h],h+=d,l-=8);if(0===s)s=1-u;else{if(s===c)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,n),s-=u}return(f?-1:1)*o*Math.pow(2,s-n)},t.write=function(e,t,r,n,i,s){var o,a,c,u=8*s-i-1,l=(1<<u)-1,h=l>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:s-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,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),(t+=o+h>=1?d/c:d*Math.pow(2,1-h))*c>=2&&(o++,c/=2),o+h>=l?(a=0,o=l):o+h>=1?(a=(t*c-1)*Math.pow(2,i),o+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;e[r+f]=255&a,f+=p,a/=256,i-=8);for(o=o<<i|a,u+=i;u>0;e[r+f]=255&o,f+=p,o/=256,u-=8);e[r+f-p]|=128*y}},67263:e=>{"use strict";e.exports=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2?arguments[2]:void 0;if(r={indent:" ",includeEmptyLines:!1,...r},"string"!==typeof e)throw new TypeError("Expected `input` to be a `string`, got `".concat(typeof e,"`"));if("number"!==typeof t)throw new TypeError("Expected `count` to be a `number`, got `".concat(typeof t,"`"));if("string"!==typeof r.indent)throw new TypeError("Expected `options.indent` to be a `string`, got `".concat(typeof r.indent,"`"));if(0===t)return e;const n=r.includeEmptyLines?/^/gm:/^(?!\s*$)/gm;return e.replace(n,r.indent.repeat(t))}},96831: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}),s=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 o=r(84595);Object.defineProperty(t,"Address4",{enumerable:!0,get:function(){return o.Address4}});var a=r(44111);Object.defineProperty(t,"Address6",{enumerable:!0,get:function(){return a.Address6}});var c=r(5383);Object.defineProperty(t,"AddressError",{enumerable:!0,get:function(){return c.AddressError}});var u=s(r(15011));t.v6={helpers:u}},5383:function(e,t){"use strict";var r=this&&this.__extends||function(){var e=function(t,r){return e=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])},e(t,r)};return function(t,r){if("function"!==typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0}),t.AddressError=void 0;var n=function(e){function t(t,r){var n=e.call(this,t)||this;return n.name="AddressError",null!==r&&(n.parseMessage=r),n}return r(t,e),t}(Error);t.AddressError=n},44201:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isCorrect=t.isInSubnet=void 0,t.isInSubnet=function(e){return!(this.subnetMask<e.subnetMask)&&this.mask(e.subnetMask)===e.mask()},t.isCorrect=function(e){return function(){return this.addressMinusSuffix===this.correctForm()&&(this.subnetMask===e&&!this.parsedSubnet||this.parsedSubnet===String(this.subnetMask))}}},84595: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}),s=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.Address4=void 0;var o=s(r(44201)),a=s(r(81765)),c=r(5383),u=r(87018),l=r(430),h=function(){function e(e){this.groups=a.GROUPS,this.parsedAddress=[],this.parsedSubnet="",this.subnet="/32",this.subnetMask=32,this.v4=!0,this.isCorrect=o.isCorrect(a.BITS),this.isInSubnet=o.isInSubnet,this.address=e;var t=a.RE_SUBNET_STRING.exec(e);if(t){if(this.parsedSubnet=t[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet="/"+this.subnetMask,this.subnetMask<0||this.subnetMask>a.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(r){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 s=n.slice(r,r+2);i.push(parseInt(s,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 l.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<a.GROUPS;e+=2){var r=l.sprintf("%02x%02x",parseInt(this.parsedAddress[e],10),parseInt(this.parsedAddress[e+1],10));t.push(l.sprintf("%x",parseInt(r,16)))}return t.join(":")},e.prototype.bigInteger=function(){return new u.BigInteger(this.parsedAddress.map((function(e){return l.sprintf("%02x",parseInt(e,10))})).join(""),16)},e.prototype._startAddress=function(){return new u.BigInteger(this.mask()+"0".repeat(a.BITS-this.subnetMask),2)},e.prototype.startAddress=function(){return e.fromBigInteger(this._startAddress())},e.prototype.startAddressExclusive=function(){var t=new u.BigInteger("1");return e.fromBigInteger(this._startAddress().add(t))},e.prototype._endAddress=function(){return new u.BigInteger(this.mask()+"1".repeat(a.BITS-this.subnetMask),2)},e.prototype.endAddress=function(){return e.fromBigInteger(this._endAddress())},e.prototype.endAddressExclusive=function(){var t=new u.BigInteger("1");return e.fromBigInteger(this._endAddress().subtract(t))},e.fromBigInteger=function(t){return e.fromInteger(parseInt(t.toString(),10))},e.prototype.mask=function(e){return void 0===e&&(e=this.subnetMask),this.getBitsBase2(0,e)},e.prototype.getBitsBase2=function(e,t){return this.binaryZeroPad().slice(e,t)},e.prototype.reverseForm=function(e){e||(e={});var t=this.correctForm().split(".").reverse().join(".");return e.omitSuffix?t:l.sprintf("%s.in-addr.arpa.",t)},e.prototype.isMulticast=function(){return this.isInSubnet(new e("224.0.0.0/4"))},e.prototype.binaryZeroPad=function(){return this.bigInteger().toString(2).padStart(a.BITS,"0")},e.prototype.groupForV6=function(){var e=this.parsedAddress;return this.address.replace(a.RE_ADDRESS,l.sprintf('<span class="hover-group group-v4 group-6">%s</span>.<span class="hover-group group-v4 group-7">%s</span>',e.slice(0,2).join("."),e.slice(2,4).join(".")))},e}();t.Address4=h},44111: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}),s=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},o=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.Address6=void 0;var a=s(r(44201)),c=s(r(81765)),u=s(r(69511)),l=s(r(15011)),h=r(84595),d=r(92703),f=r(5383),p=r(87018),y=r(430);function g(e){if(!e)throw new Error("Assertion failed.")}function m(e){return e=(e=e.replace(/^(0{1,})([1-9]+)$/,'<span class="parse-error">$1</span>$2')).replace(/^(0{1,})(0)$/,'<span class="parse-error">$1</span>$2')}function v(e){return y.sprintf("%04x",parseInt(e,16))}function b(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 f.AddressError("Invalid subnet mask.");e=e.replace(u.RE_SUBNET_STRING,"")}else if(/\//.test(e))throw new f.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(r){return!1}},e.fromBigInteger=function(t){var r,n=t.toString(16).padStart(32,"0"),i=[];for(r=0;r<u.GROUPS;r++)i.push(n.slice(4*r,4*(r+1)));return new e(i.join(":"))},e.fromURL=function(t){var r,n,i=null;if(-1!==t.indexOf("[")&&-1!==t.indexOf("]:")){if(null===(n=u.RE_URL_WITH_PORT.exec(t)))return{error:"failed to parse address with port",address:null,port:null};r=n[1],i=n[2]}else if(-1!==t.indexOf("/")){if(t=t.replace(/^[a-z0-9]+:\/\//,""),null===(n=u.RE_URL.exec(t)))return{error:"failed to parse address from URL",address:null,port:null};r=n[1]}else r=t;return i?((i=parseInt(i,10))<0||i>65536)&&(i=null):i=null,{address:new e(r),port:i}},e.fromAddress4=function(t){var r=new h.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 f.AddressError("Invalid 'ip6.arpa' form.");for(var n=r.split(".").reverse(),i=7;i>0;i--){var s=4*i;n.splice(s,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);t<r.length;t++){var n=r[t];if(this.isInSubnet(new e(n)))return u.TYPES[n]}return"Global unicast"},e.prototype.getBits=function(e,t){return new p.BigInteger(this.getBitsBase2(e,t),2)},e.prototype.getBitsBase2=function(e,t){return this.binaryZeroPad().slice(e,t)},e.prototype.getBitsBase16=function(e,t){var r=t-e;if(r%4!==0)throw new Error("Length of bits to retrieve must be divisible by four");return this.getBits(e,t).toString(16).padStart(r/4,"0")},e.prototype.getBitsPastSubnet=function(){return this.getBitsBase2(this.subnetMask,u.BITS)},e.prototype.reverseForm=function(e){e||(e={});var t=Math.floor(this.subnetMask/4),r=this.canonicalForm().replace(/:/g,"").split("").slice(0,t).reverse().join(".");return t>0?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;e<this.parsedAddress.length;e++){var i=parseInt(this.parsedAddress[e],16);0===i&&r++,0!==i&&r>0&&(r>1&&n.push([e-r,e-1]),r=0)}r>1&&n.push([this.parsedAddress.length-r,this.parsedAddress.length-1]);var s=n.map((function(e){return e[1]-e[0]+1}));if(n.length>0){var o=s.indexOf(Math.max.apply(Math,s));t=function(e,t){var r,n=[],i=[];for(r=0;r<e.length;r++)r<t[0]?n.push(e[r]):r>t[1]&&i.push(e[r]);return n.concat(["compact"]).concat(i)}(this.parsedAddress,n[o])}else t=this.parsedAddress;for(e=0;e<t.length;e++)"compact"!==t[e]&&(t[e]=parseInt(t[e],16).toString(16));var a=t.join(":");return a=(a=(a=a.replace(/^compact$/,"::")).replace(/^compact|compact$/,":")).replace(/compact/,"")},e.prototype.binaryZeroPad=function(){return this.bigInteger().toString(2).padStart(u.BITS,"0")},e.prototype.parse4in6=function(e){var t=e.split(":"),r=t.slice(-1)[0].match(c.RE_ADDRESS);if(r){this.parsedAddress4=r[0],this.address4=new h.Address4(this.parsedAddress4);for(var n=0;n<this.address4.groups;n++)if(/^0[0-9]+/.test(this.address4.parsedAddress[n]))throw new f.AddressError("IPv4 addresses can't have leading zeroes.",e.replace(c.RE_ADDRESS,this.address4.parsedAddress.map(m).join(".")));this.v4=!0,t[t.length-1]=this.address4.toGroup6(),e=t.join(":")}return e},e.prototype.parse=function(e){var t=(e=this.parse4in6(e)).match(u.RE_BAD_CHARACTERS);if(t)throw new f.AddressError(y.sprintf("Bad character%s detected in address: %s",t.length>1?"s":"",t.join("")),e.replace(u.RE_BAD_CHARACTERS,'<span class="parse-error">$1</span>'));var r=e.match(u.RE_BAD_ADDRESS);if(r)throw new f.AddressError(y.sprintf("Address failed regex: %s",r.join("")),e.replace(u.RE_BAD_ADDRESS,'<span class="parse-error">$1</span>'));var n=[],i=e.split("::");if(2===i.length){var s=i[0].split(":"),o=i[1].split(":");1===s.length&&""===s[0]&&(s=[]),1===o.length&&""===o[0]&&(o=[]);var a=this.groups-(s.length+o.length);if(!a)throw new f.AddressError("Error parsing groups");this.elidedGroups=a,this.elisionBegin=s.length,this.elisionEnd=s.length+this.elidedGroups,n=n.concat(s);for(var c=0;c<a;c++)n.push("0");n=n.concat(o)}else{if(1!==i.length)throw new f.AddressError("Too many :: groups found");n=e.split(":"),this.elidedGroups=0}if((n=n.map((function(e){return y.sprintf("%x",parseInt(e,16))}))).length!==this.groups)throw new f.AddressError("Incorrect number of groups found");return n},e.prototype.canonicalForm=function(){return this.parsedAddress.map(v).join(":")},e.prototype.decimal=function(){return this.parsedAddress.map((function(e){return y.sprintf("%05d",parseInt(e,16))})).join(":")},e.prototype.bigInteger=function(){return new p.BigInteger(this.parsedAddress.map(v).join(""),16)},e.prototype.to4=function(){var e=this.binaryZeroPad().split("");return h.Address4.fromHex(new p.BigInteger(e.slice(96,128).join(""),2).toString(16))},e.prototype.to4in6=function(){var t=this.to4(),r=new e(this.parsedAddress.slice(0,6).join(":"),6).correctForm(),n="";return/:$/.test(r)||(n=":"),r+n+t.address},e.prototype.inspectTeredo=function(){var e=this.getBitsBase16(0,32),t=this.getBits(80,96).xor(new p.BigInteger("ffff",16)).toString(),r=h.Address4.fromHex(this.getBitsBase16(32,64)),n=h.Address4.fromHex(this.getBits(96,128).xor(new p.BigInteger("ffffffff",16)).toString(16)),i=this.getBits(64,80),s=this.getBitsBase2(64,80),o=i.testBit(15),a=i.testBit(14),c=i.testBit(8),u=i.testBit(9),l=new p.BigInteger(s.slice(2,6)+s.slice(8,16),2).toString(10);return{prefix:y.sprintf("%s:%s",e.slice(0,4),e.slice(4,8)),server4:r.address,client4:n.address,flags:s,coneNat:o,microsoft:{reserved:a,universalLocal:u,groupIndividual:c,nonce:l},udpPort:t}},e.prototype.inspect6to4=function(){var e=this.getBitsBase16(0,16),t=h.Address4.fromHex(this.getBitsBase16(16,48));return{prefix:y.sprintf("%s",e.slice(0,4)),gateway:t.address}},e.prototype.to6to4=function(){return this.is4()?new e(["2002",this.getBitsBase16(96,112),this.getBitsBase16(112,128),"","/16"].join(":")):null},e.prototype.toByteArray=function(){var e=this.bigInteger().toByteArray();return 17===e.length&&0===e[0]?e.slice(1):e},e.prototype.toUnsignedByteArray=function(){return this.toByteArray().map(b)},e.fromByteArray=function(e){return this.fromUnsignedByteArray(e.map(b))},e.fromUnsignedByteArray=function(t){for(var r=new p.BigInteger("256",10),n=new p.BigInteger("0",10),i=new p.BigInteger("1",10),s=t.length-1;s>=0;s--)n=n.add(i.multiply(new p.BigInteger(t[s].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('<a href="%1$s%2$s" class="%3$s">%2$s</a>',e.prefix,t.call(this),e.className):y.sprintf('<a href="%1$s%2$s">%2$s</a>',e.prefix,t.call(this))},e.prototype.group=function(){if(0===this.elidedGroups)return l.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,l.simpleGroup(r)):e.push("");for(var i=["hover-group"],s=this.elisionBegin;s<this.elisionBegin+this.elidedGroups;s++)i.push(y.sprintf("group-%d",s));return e.push(y.sprintf('<span class="%s"></span>',i.join(" "))),n.length?e.push.apply(e,l.simpleGroup(n,this.elisionEnd)):e.push(""),this.is4()&&(g(this.address4 instanceof h.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(d.simpleRegularExpression(n.parsedAddress));else if(n.elidedGroups===u.GROUPS)r.push(d.possibleElisions(u.GROUPS));else{var i=n.address.split("::");i[0].length&&r.push(d.simpleRegularExpression(i[0].split(":"))),g("number"===typeof n.elidedGroups),r.push(d.possibleElisions(n.elidedGroups,0!==i[0].length,0!==i[1].length)),i[1].length&&r.push(d.simpleRegularExpression(i[1].split(":"))),r=[r.join(":")]}return t||(r=o(o(["(?=^|",d.ADDRESS_BOUNDARY,"|[^\\w\\:])("],r),[")(?=[^\\w\\:]|",d.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},81765:(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}$/},69511:(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})/)},15011:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.simpleGroup=t.spanLeadingZeroes=t.spanAll=t.spanAllZeroes=void 0;var n=r(430);function i(e){return e.replace(/(0+)/g,'<span class="zero">$1</span>')}function s(e){return e.replace(/^(0+)/,'<span class="zero">$1</span>')}t.spanAllZeroes=i,t.spanAll=function(e,t){return void 0===t&&(t=0),e.split("").map((function(e,r){return n.sprintf('<span class="digit value-%s position-%d">%s</span>',e,r+t,i(e))})).join("")},t.spanLeadingZeroes=function(e){return e.split(":").map((function(e){return s(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('<span class="hover-group group-%d">%s</span>',r+t,s(e))}))}},92703: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}),s=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 o=s(r(69511)),a=r(430);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===o.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?"":":",s=[];t||r||s.push("::"),t&&r&&s.push(""),(r&&!t||!r&&t)&&s.push(":"),s.push(a.sprintf("%s(:0{1,4}){1,%d}",n,e-1)),s.push(a.sprintf("(0{1,4}:){1,%d}%s",e-1,i)),s.push(a.sprintf("(0{1,4}:){%d}0{1,4}",e-1));for(var o=1;o<e-1;o++)for(var u=1;u<e-o;u++)s.push(a.sprintf("(0{1,4}:){%d}:(0{1,4}:){%d}0{1,4}",u,e-u-o-1));return c(s)}},430:(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 s(e){return a(u(e),arguments)}function o(e,t){return s.apply(null,[e].concat(t||[]))}function a(e,t){var r,n,o,a,c,u,l,h,d,f=1,p=e.length,y="";for(n=0;n<p;n++)if("string"===typeof e[n])y+=e[n];else if("object"===typeof e[n]){if((a=e[n]).keys)for(r=t[f],o=0;o<a.keys.length;o++){if(void 0==r)throw new Error(s('[sprintf] Cannot access property "%s" of undefined value "%s"',a.keys[o],a.keys[o-1]));r=r[a.keys[o]]}else r=a.param_no?t[a.param_no]:t[f++];if(i.not_type.test(a.type)&&i.not_primitive.test(a.type)&&r instanceof Function&&(r=r()),i.numeric_arg.test(a.type)&&"number"!==typeof r&&isNaN(r))throw new TypeError(s("[sprintf] expecting number but found %T",r));switch(i.number.test(a.type)&&(h=r>=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)||h&&!a.sign?d="":(d=h?"+":"-",r=r.toString().replace(i.sign,"")),u=a.pad_char?"0"===a.pad_char?"0":a.pad_char.charAt(1):" ",l=a.width-(d+r).length,c=a.width&&l>0?u.repeat(l):"",y+=a.align?d+r+c:"0"===u?d+c+r:c+d+r)}return y}var c=Object.create(null);function u(e){if(c[e])return c[e];for(var t,r=e,n=[],s=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]){s|=1;var o=[],a=t[2],u=[];if(null===(u=i.key.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(o.push(u[1]);""!==(a=a.substring(u[0].length));)if(null!==(u=i.key_access.exec(a)))o.push(u[1]);else{if(null===(u=i.index_access.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");o.push(u[1])}t[2]=o}else s|=2;if(3===s)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=s,t.vsprintf=o,"undefined"!==typeof window&&(window.sprintf=s,window.vsprintf=o,void 0===(n=function(){return{sprintf:s,vsprintf:o}}.call(t,r,t,e))||(e.exports=n))}()},28974:e=>{"use strict";const t="[a-fA-F\\d:]",r=e=>e&&e.includeBoundaries?"(?:(?<=\\s|^)(?=".concat(t,")|(?<=").concat(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}",s="\n(?:\n(?:".concat(i,":){7}(?:").concat(i,"|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:").concat(i,":){6}(?:").concat(n,"|:").concat(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(?:").concat(i,":){5}(?::").concat(n,"|(?::").concat(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(?:").concat(i,":){4}(?:(?::").concat(i,"){0,1}:").concat(n,"|(?::").concat(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(?:").concat(i,":){3}(?:(?::").concat(i,"){0,2}:").concat(n,"|(?::").concat(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(?:").concat(i,":){2}(?:(?::").concat(i,"){0,3}:").concat(n,"|(?::").concat(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(?:").concat(i,":){1}(?:(?::").concat(i,"){0,4}:").concat(n,"|(?::").concat(i,"){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::").concat(i,"){0,5}:").concat(n,"|(?::").concat(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(),o=new RegExp("(?:^".concat(n,"$)|(?:^").concat(s,"$)")),a=new RegExp("^".concat(n,"$")),c=new RegExp("^".concat(s,"$")),u=e=>e&&e.exact?o:new RegExp("(?:".concat(r(e)).concat(n).concat(r(e),")|(?:").concat(r(e)).concat(s).concat(r(e),")"),"g");u.v4=e=>e&&e.exact?a:new RegExp("".concat(r(e)).concat(n).concat(r(e)),"g"),u.v6=e=>e&&e.exact?c:new RegExp("".concat(r(e)).concat(s).concat(r(e)),"g"),e.exports=u},87201:function(e){!function(t){"use strict";const r="(0?\\d+|0x[a-f0-9]+)",n={fourOctet:new RegExp("^".concat(r,"\\.").concat(r,"\\.").concat(r,"\\.").concat(r,"$"),"i"),threeOctet:new RegExp("^".concat(r,"\\.").concat(r,"\\.").concat(r,"$"),"i"),twoOctet:new RegExp("^".concat(r,"\\.").concat(r,"$"),"i"),longValue:new RegExp("^".concat(r,"$"),"i")},i=new RegExp("^0[0-7]+$","i"),s=new RegExp("^0x[a-f0-9]+$","i"),o="%[0-9a-z]{1,}",a="(?:[0-9a-f]+::?)+",c={zoneIndex:new RegExp(o,"i"),native:new RegExp("^(::)?(".concat(a,")?([0-9a-f]+)?(::)?(").concat(o,")?$"),"i"),deprecatedTransitional:new RegExp("^(?:::)(".concat(r,"\\.").concat(r,"\\.").concat(r,"\\.").concat(r,"(").concat(o,")?)$"),"i"),transitional:new RegExp("^((?:".concat(a,")|(?:::)(?:").concat(a,")?)").concat(r,"\\.").concat(r,"\\.").concat(r,"\\.").concat(r,"(").concat(o,")?$"),"i")};function u(e,t){if(e.indexOf("::")!==e.lastIndexOf("::"))return null;let r,n,i=0,s=-1,o=(e.match(c.zoneIndex)||[])[0];for(o&&(o=o.substring(1),e=e.replace(/%.+$/,""));(s=e.indexOf(":",s+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;e<t.length;e++)r.push(parseInt(t[e],16));return r}(),zoneId:o}}function l(e,t,r,n){if(e.length!==t.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let i,s=0;for(;n>0;){if(i=r-n,i<0&&(i=0),e[s]>>i!==t[s]>>i)return!1;n-=r,s+=1}return!0}function h(e){if(s.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 ".concat(e," as octal"))}return parseInt(e,10)}function d(e,t){for(;e.length<t;)e="0".concat(e);return e}const f={};f.IPv4=function(){function e(e){if(4!==e.length)throw new Error("ipaddr: ipv4 octet count should be 4");let t,r;for(t=0;t<e.length;t++)if(r=e[t],!(0<=r&&r<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=e}return e.prototype.SpecialRanges={unspecified:[[new e([0,0,0,0]),8]],broadcast:[[new e([255,255,255,255]),32]],multicast:[[new e([224,0,0,0]),4]],linkLocal:[[new e([169,254,0,0]),16]],loopback:[[new e([127,0,0,0]),8]],carrierGradeNat:[[new e([100,64,0,0]),10]],private:[[new e([10,0,0,0]),8],[new e([172,16,0,0]),12],[new e([192,168,0,0]),16]],reserved:[[new e([192,0,0,0]),24],[new e([192,0,2,0]),24],[new e([192,88,99,0]),24],[new e([198,51,100,0]),24],[new e([203,0,113,0]),24],[new e([240,0,0,0]),4]]},e.prototype.kind=function(){return"ipv4"},e.prototype.match=function(e,t){let r;if(void 0===t&&(r=e,e=r[0],t=r[1]),"ipv4"!==e.kind())throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return l(this.octets,e.octets,8,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1;const r={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0};let n,i,s;for(n=3;n>=0;n-=1){if(i=this.octets[n],!(i in r))return null;if(s=r[i],t&&0!==s)return null;8!==s&&(t=!0),e+=s}return 32-e},e.prototype.range=function(){return f.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){return this.octets.slice(0)},e.prototype.toIPv4MappedAddress=function(){return f.IPv6.parse("::ffff:".concat(this.toString()))},e.prototype.toNormalizedString=function(){return this.toString()},e.prototype.toString=function(){return this.octets.join(".")},e}(),f.IPv4.broadcastAddressFromCIDR=function(e){try{const t=this.parseCIDR(e),r=t[0].toByteArray(),n=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[];let s=0;for(;s<4;)i.push(parseInt(r[s],10)|255^parseInt(n[s],10)),s++;return new this(i)}catch(t){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},f.IPv4.isIPv4=function(e){return null!==this.parser(e)},f.IPv4.isValid=function(e){try{return new this(this.parser(e)),!0}catch(t){return!1}},f.IPv4.isValidFourPartDecimal=function(e){return!(!f.IPv4.isValid(e)||!e.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},f.IPv4.networkAddressFromCIDR=function(e){let t,r,n,i,s;try{for(t=this.parseCIDR(e),n=t[0].toByteArray(),s=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],r=0;r<4;)i.push(parseInt(n[r],10)&parseInt(s[r],10)),r++;return new this(i)}catch(o){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},f.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)},f.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")},f.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;t<e.length;t++)r=e[t],n.push(h(r));return n}();if(t=e.match(n.longValue)){if(i=h(t[1]),i>4294967295||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=h(e[1]),i>16777215||i<0)throw new Error("ipaddr: address outside defined range");return r.push(h(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=h(e[2]),i>65535||i<0)throw new Error("ipaddr: address outside defined range");return r.push(h(e[0])),r.push(h(e[1])),r.push(i>>8&255),r.push(255&i),r}():null},f.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<n;)t[r]=255,r++;return n<4&&(t[n]=Math.pow(2,e%8)-1<<8-e%8),new this(t)},f.IPv6=function(){function e(e,t){let r,n;if(16===e.length)for(this.parts=[],r=0;r<=14;r+=2)this.parts.push(e[r]<<8|e[r+1]);else{if(8!==e.length)throw new Error("ipaddr: ipv6 part count should be 8 or 16");this.parts=e}for(r=0;r<this.parts.length;r++)if(n=this.parts[r],!(0<=n&&n<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");t&&(this.zoneId=t)}return e.prototype.SpecialRanges={unspecified:[new e([0,0,0,0,0,0,0,0]),128],linkLocal:[new e([65152,0,0,0,0,0,0,0]),10],multicast:[new e([65280,0,0,0,0,0,0,0]),8],loopback:[new e([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new e([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new e([0,0,0,0,0,65535,0,0]),96],rfc6145:[new e([0,0,0,0,65535,0,0,0]),96],rfc6052:[new e([100,65435,0,0,0,0,0,0]),96],"6to4":[new e([8194,0,0,0,0,0,0,0]),16],teredo:[new e([8193,0,0,0,0,0,0,0]),32],reserved:[[new e([8193,3512,0,0,0,0,0,0]),32]]},e.prototype.isIPv4MappedAddress=function(){return"ipv4Mapped"===this.range()},e.prototype.kind=function(){return"ipv6"},e.prototype.match=function(e,t){let r;if(void 0===t&&(r=e,e=r[0],t=r[1]),"ipv6"!==e.kind())throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return l(this.parts,e.parts,16,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1;const r={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0};let n,i;for(let s=7;s>=0;s-=1){if(n=this.parts[s],!(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 f.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){let e;const t=[],r=this.parts;for(let n=0;n<r.length;n++)e=r[n],t.push(e>>8),t.push(255&e);return t},e.prototype.toFixedLengthString=function(){const e=function(){const e=[];for(let t=0;t<this.parts.length;t++)e.push(d(this.parts[t].toString(16),4));return e}.call(this).join(":");let t="";return this.zoneId&&(t="%".concat(this.zoneId)),e+t},e.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");const e=this.parts.slice(-2),t=e[0],r=e[1];return new f.IPv4([t>>8,255&t,r>>8,255&r])},e.prototype.toNormalizedString=function(){const e=function(){const e=[];for(let t=0;t<this.parts.length;t++)e.push(this.parts[t].toString(16));return e}.call(this).join(":");let t="";return this.zoneId&&(t="%".concat(this.zoneId)),e+t},e.prototype.toRFC5952String=function(){const e=/((^|:)(0(:|$)){2,})/g,t=this.toNormalizedString();let r,n=0,i=-1;for(;r=e.exec(t);)r[0].length>i&&(n=r.index,i=r[0].length);return i<0?t:"".concat(t.substring(0,n),"::").concat(t.substring(n+i))},e.prototype.toString=function(){return this.toNormalizedString().replace(/((^|:)(0(:|$))+)/,"::")},e}(),f.IPv6.broadcastAddressFromCIDR=function(e){try{const t=this.parseCIDR(e),r=t[0].toByteArray(),n=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[];let s=0;for(;s<16;)i.push(parseInt(r[s],10)|255^parseInt(n[s],10)),s++;return new this(i)}catch(t){throw new Error("ipaddr: the address does not have IPv6 CIDR format (".concat(t,")"))}},f.IPv6.isIPv6=function(e){return null!==this.parser(e)},f.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(t){return!1}},f.IPv6.networkAddressFromCIDR=function(e){let t,r,n,i,s;try{for(t=this.parseCIDR(e),n=t[0].toByteArray(),s=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],r=0;r<16;)i.push(parseInt(n[r],10)&parseInt(s[r],10)),r++;return new this(i)}catch(o){throw new Error("ipaddr: the address does not have IPv6 CIDR format (".concat(o,")"))}},f.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)},f.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")},f.IPv6.parser=function(e){let t,r,n,i,s,o;if(n=e.match(c.deprecatedTransitional))return this.parser("::ffff:".concat(n[1]));if(c.native.test(e))return u(e,8);if((n=e.match(c.transitional))&&(o=n[6]||"",t=u(n[1].slice(0,-1)+o,6),t.parts)){for(s=[parseInt(n[2]),parseInt(n[3]),parseInt(n[4]),parseInt(n[5])],r=0;r<s.length;r++)if(i=s[r],!(0<=i&&i<=255))return null;return t.parts.push(s[0]<<8|s[1]),t.parts.push(s[2]<<8|s[3]),{parts:t.parts,zoneId:t.zoneId}}return null},f.IPv6.subnetMaskFromPrefixLength=function(e){if((e=parseInt(e))<0||e>128)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<n;)t[r]=255,r++;return n<16&&(t[n]=Math.pow(2,e%8)-1<<8-e%8),new this(t)},f.fromByteArray=function(e){const t=e.length;if(4===t)return new f.IPv4(e);if(16===t)return new f.IPv6(e);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},f.isValid=function(e){return f.IPv6.isValid(e)||f.IPv4.isValid(e)},f.parse=function(e){if(f.IPv6.isValid(e))return f.IPv6.parse(e);if(f.IPv4.isValid(e))return f.IPv4.parse(e);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},f.parseCIDR=function(e){try{return f.IPv6.parseCIDR(e)}catch(t){try{return f.IPv4.parseCIDR(e)}catch(r){throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},f.process=function(e){const t=this.parse(e);return"ipv6"===t.kind()&&t.isIPv4MappedAddress()?t.toIPv4Address():t},f.subnetMatch=function(e,t,r){let n,i,s,o;for(i in void 0!==r&&null!==r||(r="unicast"),t)if(Object.prototype.hasOwnProperty.call(t,i))for(s=t[i],!s[0]||s[0]instanceof Array||(s=[s]),n=0;n<s.length;n++)if(o=s[n],e.kind()===o[0].kind()&&e.match.apply(e,o))return i;return r},e.exports?e.exports=f:t.ipaddr=f}(this)},96927:(e,t,r)=>{"use strict";var n=r(21964);const i=r(82193),s="object"===typeof window&&"object"===typeof document&&9===document.nodeType,o=i(),a=s&&!o,c=o&&!s,u=o&&s,l="undefined"!==typeof n&&"undefined"!==typeof n.release&&"node"===n.release.name&&!o,h="function"===typeof importScripts&&"undefined"!==typeof self&&"undefined"!==typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,d="undefined"!==typeof n&&!1,f="undefined"!==typeof navigator&&"ReactNative"===navigator.product;e.exports={isTest:d,isElectron:o,isElectronMain:c,isElectronRenderer:u,isNode:l,isBrowser:a,isWebWorker:h,isEnvWithDom:s,isReactNative:f}},82193:(e,t,r)=>{var n=r(21964);e.exports=function(){return"undefined"!==typeof window&&"object"===typeof window.process&&"renderer"===window.process.type||(!("undefined"===typeof n||"object"!==typeof n.versions||!n.versions.electron)||"object"===typeof navigator&&"string"===typeof navigator.userAgent&&navigator.userAgent.indexOf("Electron")>=0)}},62795:(e,t,r)=>{"use strict";const n=r(28974),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},56209: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)}},25410: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(;n<e;)n+t>e?(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}},16791:(e,t,r)=>{"use strict";const{URLWithLegacySupport:n,format:i,URLSearchParams:s,defaultBase:o}=r(85732),a=r(89640);e.exports={URL:n,URLSearchParams:s,format:i,relative:a,defaultBase:o}},89640:(e,t,r)=>{"use strict";const{URLWithLegacySupport:n,format:i}=r(85732);e.exports=function(e){let t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3?arguments[3]:void 0,a=r.protocol?r.protocol.replace(":",""):"http";a=(s[a]||o||a)+":";try{t=new n(e)}catch(u){t={}}const c=Object.assign({},r,{protocol:a||t.protocol,host:r.host||t.host});return new n(e,i(c)).toString()}},85732:e=>{"use strict";const t="undefined"!==typeof navigator&&"ReactNative"===navigator.product;const r=self.URL,n=t?"http://localhost":self.location?self.location.protocol+"//"+self.location.host:"";e.exports={URLWithLegacySupport:class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]: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?"".concat(e.username,":").concat(e.password,"@"):"",r=e.auth?e.auth+"@":"",n=e.port?":"+e.port:"",i=e.protocol?e.protocol+"//":"",s=e.host||"",o=e.hostname||"",a=e.search||(e.query?"?"+e.query:""),c=e.hash||"",u=e.pathname||"",l=e.path||u+a;return"".concat(i).concat(t||r).concat(s||o+n).concat(l).concat(c)}}}},50464:e=>{"use strict";e.exports=async e=>{const t=[];for await(const r of e)t.push(r);return t}},90351:(e,t,r)=>{"use strict";const{Buffer:n}=r(19778),i=r(41976);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))}},72934:(e,t,r)=>{const n=r(41976),i={string:()=>"",buffer:()=>n()};e.exports=async(e,t)=>{if((t=t||{}).type&&!i[t.type])throw new Error('invalid type "'.concat(t.type,'"'));let r,n;for await(const s of e)r||(n=t.type||("string"===typeof s?"string":"buffer"),r=i[n]()),"string"===n?r+=s:r.append(s);return r||i[t.type||"buffer"]()}},79272:e=>{"use strict";e.exports=async e=>{for await(const t of e);}},12393:e=>{"use strict";e.exports=async function*(e,t){for await(const r of e)await t(r)&&(yield r)}},84744:e=>{"use strict";e.exports=async e=>{for await(const t of e)return t}},61309:e=>{"use strict";e.exports=async function*(e,t){for await(const r of e)await t(r),yield r}},39610:(e,t,r)=>{"use strict";const n=r(55502),i=r(77674),s=r(70121);e.exports=e=>{const t=i(),r=n(e.source),o=s();let a;const c=e.sink(async function*(){yield*t;const e=await o.promise;yield*e}());c.catch((e=>{a=e}));return{reader:r,writer:t,stream:{sink:e=>a?Promise.reject(a):(o.resolve(e),c),source:r},rest:()=>t.end(),write:t.push,read:async()=>(await r.next()).value}}},96596:(e,t,r)=>{"use strict";const{Buffer:n}=r(19778),i=r(41976),s=r(17104),o=4194304,a=n.alloc(0),c="readLength",u="readData",l={[c]:(e,t,r,n)=>{let s;t=t.append(e);try{s=n.lengthDecoder(t)}catch(o){if(t.length>n.maxLengthLength)throw Object.assign(o,{message:"message length too long",code:"ERR_MSG_LENGTH_TOO_LONG"});if(o instanceof RangeError)return{mode:c,buffer:t,chunk:void 0,state:void 0,data:void 0};throw o}if(s>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(s),s<=0?(n.onData&&n.onData(a),{mode:c,chunk:e,buffer:t,data:a}):{mode:u,chunk:e,buffer:t,state:{dataLength:s},data:void 0}},[u]:(e,t,r,n)=>{if(t=t.append(e),!r)throw new Error("state is required");if(t.length<r.dataLength)return{mode:u,buffer:t,state:r,chunk:void 0,data:void 0};const{dataLength:s}=r,o=t.shallowSlice(0,s),a=t.length>s?t.shallowSlice(s):void 0;return t=new i,n.onData&&n.onData(o),{mode:c,chunk:a,buffer:t,state:void 0,data:o}}};function h(e){const t={lengthDecoder:(e=e||{}).lengthDecoder||s,maxLengthLength:e.maxLengthLength||8,maxDataLength:e.maxDataLength||o,onLength:e.onLength,onData:e.onData};return async function*(e){let r,n=new i,s=c;for await(const i of e){let e=i;for(;e;){const i=l[s](e,n,r,t);s=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"})}}h.fromReader=(e,t)=>{let r=1;const n={[Symbol.asyncIterator](){return this},next:async()=>{try{return await e.next(r)}catch(t){if("ERR_UNDER_READ"===t.code)return{done:!0,value:null};throw t}finally{r=1}}};return h({...t||{},onLength:e=>{r=e}})(n)},e.exports=h,e.exports.MAX_LENGTH_LENGTH=8,e.exports.MAX_DATA_LENGTH=o},82986:(e,t,r)=>{"use strict";const{Buffer:n}=r(19778),i=r(41976),s=r(28859);function o(e){e=e||{};const t=Math.max(e.poolSize||10240,e.minPoolSize||8),r=e.lengthEncoder||s;return async function*(e){let s=n.alloc(t),o=0;for await(const a of e){r(a.length,s,o);const e=s.slice(o,o+r.bytes);o+=r.bytes,s.length-o<8&&(s=n.alloc(t),o=0),yield(new i).append(e).append(a)}}}o.single=(e,t)=>{const r=(t=t||{}).lengthEncoder||s;return new i([r(e.length),e.slice()])},e.exports=o,e.exports.MIN_POOL_SIZE=8,e.exports.DEFAULT_POOL_SIZE=10240},44709:(e,t,r)=>{"use strict";t.encode=r(82986),t.decode=r(96596),t.varintEncode=r(28859),t.varintDecode=r(17104),t.int32BEEncode=r(95441),t.int32BEDecode=r(61336)},61336: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},95441:(e,t,r)=>{"use strict";const{Buffer:n}=r(19778),i=(e,t,r)=>((t=t||n.allocUnsafe(4)).writeInt32BE(e,r),t);i.bytes=4,e.exports=i},17104:(e,t,r)=>{"use strict";const n=r(74561),{Buffer:i}=r(19778),s=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 s.bytes=n.decode.bytes,t};e.exports=s},28859:(e,t,r)=>{"use strict";const n=r(74561),{Buffer:i}=r(19778),s=(e,t,r)=>{const o=n.encode(e,t,r);return s.bytes=n.encode.bytes,t||i.from(o)};e.exports=s},27889:e=>{"use strict";e.exports=async function*(e,t){for await(const r of e)yield t(r)}},96155:(e,t,r)=>{"use strict";const n=r(77674);e.exports=async function*(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const i=n();setTimeout((async()=>{try{await Promise.all(t.map((async e=>{for await(const t of e)i.push(t)}))),i.end()}catch(e){i.end(e)}}),0),yield*i}},85907:(e,t,r)=>{var n=r(52227);e.exports=function(){var e=n(),t=n();return[{source:e.source,sink:t.sink},{source:t.source,sink:e.sink}]}},52227:(e,t,r)=>{"use strict";const n=r(38295);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())}}))}}}},85551:(e,t,r)=>{"use strict";const n=r(39610),i=r(44709);e.exports=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=n(e),s=i.decode.fromReader(r.reader,t);let o=!1;const a={read:async e=>{const{value:t,done:n}=await r.reader.next(e);if(n&&t.length<e)throw new Error("Couldn't read enough bytes");if(o=n,!t)throw new Error("Value is null");return t},readLP:async()=>{const{value:e,done:t}=await s.next();if(o=t,!e)throw new Error("Value is null");return e},readPB:async e=>{const t=await a.readLP();if(!t)throw new Error("Value is null");const r=t instanceof Uint8Array?t:t.slice();return e.decode(r)},write:e=>{r.writer.push(e)},writeLP:e=>{a.write(i.encode.single(e,t))},writePB:(e,t)=>{a.writeLP(t.encode(e))},pb:e=>({read:()=>a.readPB(e),write:t=>a.writePB(t,e)}),unwrap:()=>(r.rest(),r.stream)};return a}},79023:e=>{const t=function(){let e;for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];for(;r.length;)e=r.shift()(e);return e},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),s=function(){for(var e=arguments.length,s=new Array(e),o=0;o<e;o++)s[o]=arguments[o];if(n(s[0])){const e=s[0];s[0]=()=>e.source}else if(r(s[0])){const e=s[0];s[0]=()=>e}if(s.length>1&&n(s[s.length-1])&&(s[s.length-1]=s[s.length-1].sink),s.length>2)for(let t=1;t<s.length-1;t++)n(s[t])&&(s[t]=i(s[t]));return t(...s)};e.exports=s,e.exports.pipe=s,e.exports.rawPipe=t,e.exports.isIterable=r,e.exports.isDuplex=n},77674:(e,t,r)=>{const n=r(75125);e.exports=e=>{let t;"function"===typeof(e=e||{})?(t=e,e={}):t=e.onEnd;let r,i,s,o=new n;const a=e=>i?i(e):(o.push(e),r),c=e=>s?r:a({done:!1,value:e}),u=e=>s?r:(s=!0,e?(e=>(o=new n,i?i({error:e}):(o.push({error:e}),r)))(e):a({done:!0}));if(r={[Symbol.asyncIterator](){return this},next:()=>{if(!o.isEmpty()){if(e.writev){let e;const t=[];for(;!o.isEmpty();){if(e=o.shift(),e.error)throw e.error;t.push(e.value)}return{done:e.done,value:t}}const t=o.shift();if(t.error)throw t.error;return t}return s?{done:!0}:new Promise(((t,n)=>{i=s=>(i=null,s.error?n(s.error):e.writev&&!s.done?t({done:s.done,value:[s.value]}):t(s),r)}))},return:()=>(o=new n,u(),{done:!0}),throw:e=>(u(e),{done:!0}),push:c,end:u},!t)return r;const l=r;return r={[Symbol.asyncIterator](){return this},next:()=>l.next(),throw:e=>(l.throw(e),t&&(t(e),t=null),{done:!0}),return:()=>(l.return(),t&&(t(),t=null),{done:!0}),push:c,end:e=>(l.end(e),t&&(t(e),t=null),r)},r}},55502:(e,t,r)=>{const n=r(41976);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 ".concat(t," bytes became available")),{code:"ERR_UNDER_READ",buffer:r})}();return t.next(),t}},22035:(e,t,r)=>{"use strict";const n=r(50464);e.exports=async function*(e,t){const r=await n(e);yield*r.sort(t)}},35959: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}},88042:(e,t,r)=>{"use strict";var n=r(87191),i=r(18335),s=r(40142);e.exports=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r="undefined"===typeof window?{}:window.location,o=s(e,r),a=new n(o,t.websocket),c=i(a,t);return c.remoteAddress=o,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},18335:(e,t,r)=>{const n=r(95593),i=r(91747);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}},27208: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",s),n.call(e,"error",o))}function s(){i(),t()}function o(e){i(),r(e)}e.addEventListener("open",s),e.addEventListener("error",o)}))}},91747:(e,t,r)=>{const n=r(27208);e.exports=(e,t)=>((t=t||{}).closeOnEnd=!1!==t.closeOnEnd,async r=>{for await(const t of r){try{await n(e)}catch(i){if("socket closed"===i.message)break;throw i}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()))}))})},95593:(e,t,r)=>{const{Buffer:n}=r(19778),{EventIterator:i}=r(3634);e.exports=e=>{const t=e.removeEventListener||e.removeListener,r=async function*(){const r=new i((r=>{let{push:n,stop:i,fail:s}=r;return e.addEventListener("message",n),e.addEventListener("error",s),e.addEventListener("close",i),()=>{t.call(e,"message",n),t.call(e,"error",s),t.call(e,"close",i)}}),{highWaterMark:1/0});for await(const{data:e}of r)yield(s=e,s instanceof ArrayBuffer||null!=s&&null!=s.constructor&&"ArrayBuffer"===s.constructor.name&&"number"===typeof s.byteLength?n.from(e):e);var s}();let s,o=1===e.readyState;return e.addEventListener("open",(()=>{o=!0,s=null})),e.addEventListener("close",(()=>{o=!1,s=null})),e.addEventListener("error",(e=>{o||(s=e)})),r.connected=()=>new Promise(((r,n)=>{if(o)return r();if(s)return n(s);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}},87191:(e,t,r)=>{e.exports="undefined"===typeof WebSocket?r(89408):WebSocket},40142:(e,t,r)=>{const{relative:n}=r(16791),i={http:"ws",https:"wss"};e.exports=(e,t)=>n(e,t,i,"ws")},27898:(e,t,r)=>{var n,i=r(21964);!function(){"use strict";var s="input is invalid type",o="object"===typeof window,a=o?window:{};a.JS_SHA3_NO_WINDOW&&(o=!1);var c=!o&&"object"===typeof self;!a.JS_SHA3_NO_NODE_JS&&"object"===typeof i&&i.versions&&i.versions.node?a=r.g:c&&(a=self);var u=!a.JS_SHA3_NO_COMMON_JS&&e.exports,l=r.amdO,h=!a.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!==typeof ArrayBuffer,d="0123456789abcdef".split(""),f=[4,1024,262144,67108864],p=[0,8,16,24],y=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],g=[224,256,384,512],m=[128,256],v=["hex","buffer","arrayBuffer","array","digest"],b={128:168,256:136};!a.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!h||!a.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"===typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var w=function(e,t,r){return function(n){return new L(e,t,e).update(n)[r]()}},E=function(e,t,r){return function(n,i){return new L(e,t,i).update(n)[r]()}},S=function(e,t,r){return function(t,n,i,s){return C["cshake"+e].update(t,n,i,s)[r]()}},_=function(e,t,r){return function(t,n,i,s){return C["kmac"+e].update(t,n,i,s)[r]()}},I=function(e,t,r,n){for(var i=0;i<v.length;++i){var s=v[i];e[s]=t(r,n,s)}return e},T=function(e,t){var r=w(e,t,"hex");return r.create=function(){return new L(e,t,e)},r.update=function(e){return r.create().update(e)},I(r,w,e,t)},A=[{name:"keccak",padding:[1,256,65536,16777216],bits:g,createMethod:T},{name:"sha3",padding:[6,1536,393216,100663296],bits:g,createMethod:T},{name:"shake",padding:[31,7936,2031616,520093696],bits:m,createMethod:function(e,t){var r=E(e,t,"hex");return r.create=function(r){return new L(e,t,r)},r.update=function(e,t){return r.create(t).update(e)},I(r,E,e,t)}},{name:"cshake",padding:f,bits:m,createMethod:function(e,t){var r=b[e],n=S(e,0,"hex");return n.create=function(n,i,s){return i||s?new L(e,t,n).bytepad([i,s],r):C["shake"+e].create(n)},n.update=function(e,t,r,i){return n.create(t,r,i).update(e)},I(n,S,e,t)}},{name:"kmac",padding:f,bits:m,createMethod:function(e,t){var r=b[e],n=_(e,0,"hex");return n.create=function(n,i,s){return new x(e,t,i).bytepad(["KMAC",s],r).bytepad([n],r)},n.update=function(e,t,r,i){return n.create(e,r,i).update(t)},I(n,_,e,t)}}],C={},R=[],P=0;P<A.length;++P)for(var k=A[P],O=k.bits,B=0;B<O.length;++B){var N=k.name+"_"+O[B];if(R.push(N),C[N]=k.createMethod(O[B],k.padding),"sha3"!==k.name){var D=k.name+O[B];R.push(D),C[D]=C[N]}}function L(e,t,r){this.blocks=[],this.s=[],this.padding=t,this.outputBits=r,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(e<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function x(e,t,r){L.call(this,e,t,r)}L.prototype.update=function(e){if(this.finalized)throw new Error("finalize already called");var t,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(s);if(null===e)throw new Error(s);if(h&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!Array.isArray(e)&&(!h||!ArrayBuffer.isView(e)))throw new Error(s);t=!0}for(var n,i,o=this.blocks,a=this.byteCount,c=e.length,u=this.blockCount,l=0,d=this.s;l<c;){if(this.reset)for(this.reset=!1,o[0]=this.block,n=1;n<u+1;++n)o[n]=0;if(t)for(n=this.start;l<c&&n<a;++l)o[n>>2]|=e[l]<<p[3&n++];else for(n=this.start;l<c&&n<a;++l)(i=e.charCodeAt(l))<128?o[n>>2]|=i<<p[3&n++]:i<2048?(o[n>>2]|=(192|i>>6)<<p[3&n++],o[n>>2]|=(128|63&i)<<p[3&n++]):i<55296||i>=57344?(o[n>>2]|=(224|i>>12)<<p[3&n++],o[n>>2]|=(128|i>>6&63)<<p[3&n++],o[n>>2]|=(128|63&i)<<p[3&n++]):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++l)),o[n>>2]|=(240|i>>18)<<p[3&n++],o[n>>2]|=(128|i>>12&63)<<p[3&n++],o[n>>2]|=(128|i>>6&63)<<p[3&n++],o[n>>2]|=(128|63&i)<<p[3&n++]);if(this.lastByteIndex=n,n>=a){for(this.start=n-a,this.block=o[u],n=0;n<u;++n)d[n]^=o[n];M(d),this.reset=!0}else this.start=n}return this},L.prototype.encode=function(e,t){var r=255&e,n=1,i=[r];for(r=255&(e>>=8);r>0;)i.unshift(r),r=255&(e>>=8),++n;return t?i.push(n):i.unshift(n),this.update(i),i.length},L.prototype.encodeString=function(e){var t,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(s);if(null===e)throw new Error(s);if(h&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!Array.isArray(e)&&(!h||!ArrayBuffer.isView(e)))throw new Error(s);t=!0}var n=0,i=e.length;if(t)n=i;else for(var o=0;o<e.length;++o){var a=e.charCodeAt(o);a<128?n+=1:a<2048?n+=2:a<55296||a>=57344?n+=3:(a=65536+((1023&a)<<10|1023&e.charCodeAt(++o)),n+=4)}return n+=this.encode(8*n),this.update(e),n},L.prototype.bytepad=function(e,t){for(var r=this.encode(t),n=0;n<e.length;++n)r+=this.encodeString(e[n]);var i=t-r%t,s=[];return s.length=i,this.update(s),this},L.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex,r=this.blockCount,n=this.s;if(e[t>>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t<r+1;++t)e[t]=0;for(e[r-1]|=2147483648,t=0;t<r;++t)n[t]^=e[t];M(n)}},L.prototype.toString=L.prototype.hex=function(){this.finalize();for(var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,s=0,o=0,a="";o<n;){for(s=0;s<t&&o<n;++s,++o)e=r[s],a+=d[e>>4&15]+d[15&e]+d[e>>12&15]+d[e>>8&15]+d[e>>20&15]+d[e>>16&15]+d[e>>28&15]+d[e>>24&15];o%t===0&&(M(r),s=0)}return i&&(e=r[s],a+=d[e>>4&15]+d[15&e],i>1&&(a+=d[e>>12&15]+d[e>>8&15]),i>2&&(a+=d[e>>20&15]+d[e>>16&15])),a},L.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,s=0,o=0,a=this.outputBits>>3;e=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(a);for(var c=new Uint32Array(e);o<n;){for(s=0;s<t&&o<n;++s,++o)c[o]=r[s];o%t===0&&M(r)}return i&&(c[s]=r[s],e=e.slice(0,a)),e},L.prototype.buffer=L.prototype.arrayBuffer,L.prototype.digest=L.prototype.array=function(){this.finalize();for(var e,t,r=this.blockCount,n=this.s,i=this.outputBlocks,s=this.extraBytes,o=0,a=0,c=[];a<i;){for(o=0;o<r&&a<i;++o,++a)e=a<<2,t=n[o],c[e]=255&t,c[e+1]=t>>8&255,c[e+2]=t>>16&255,c[e+3]=t>>24&255;a%r===0&&M(n)}return s&&(e=a<<2,t=n[o],c[e]=255&t,s>1&&(c[e+1]=t>>8&255),s>2&&(c[e+2]=t>>16&255)),c},x.prototype=new L,x.prototype.finalize=function(){return this.encode(this.outputBits,!0),L.prototype.finalize.call(this)};var M=function(e){var t,r,n,i,s,o,a,c,u,l,h,d,f,p,g,m,v,b,w,E,S,_,I,T,A,C,R,P,k,O,B,N,D,L,x,M,U,K,j,F,V,q,z,H,G,W,Y,Q,J,X,$,Z,ee,te,re,ne,ie,se,oe,ae,ce,ue,le;for(n=0;n<48;n+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],s=e[1]^e[11]^e[21]^e[31]^e[41],o=e[2]^e[12]^e[22]^e[32]^e[42],a=e[3]^e[13]^e[23]^e[33]^e[43],c=e[4]^e[14]^e[24]^e[34]^e[44],u=e[5]^e[15]^e[25]^e[35]^e[45],l=e[6]^e[16]^e[26]^e[36]^e[46],h=e[7]^e[17]^e[27]^e[37]^e[47],t=(d=e[8]^e[18]^e[28]^e[38]^e[48])^(o<<1|a>>>31),r=(f=e[9]^e[19]^e[29]^e[39]^e[49])^(a<<1|o>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=i^(c<<1|u>>>31),r=s^(u<<1|c>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=o^(l<<1|h>>>31),r=a^(h<<1|l>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=c^(d<<1|f>>>31),r=u^(f<<1|d>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=l^(i<<1|s>>>31),r=h^(s<<1|i>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,p=e[0],g=e[1],W=e[11]<<4|e[10]>>>28,Y=e[10]<<4|e[11]>>>28,P=e[20]<<3|e[21]>>>29,k=e[21]<<3|e[20]>>>29,ae=e[31]<<9|e[30]>>>23,ce=e[30]<<9|e[31]>>>23,q=e[40]<<18|e[41]>>>14,z=e[41]<<18|e[40]>>>14,L=e[2]<<1|e[3]>>>31,x=e[3]<<1|e[2]>>>31,m=e[13]<<12|e[12]>>>20,v=e[12]<<12|e[13]>>>20,Q=e[22]<<10|e[23]>>>22,J=e[23]<<10|e[22]>>>22,O=e[33]<<13|e[32]>>>19,B=e[32]<<13|e[33]>>>19,ue=e[42]<<2|e[43]>>>30,le=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,re=e[4]<<30|e[5]>>>2,M=e[14]<<6|e[15]>>>26,U=e[15]<<6|e[14]>>>26,b=e[25]<<11|e[24]>>>21,w=e[24]<<11|e[25]>>>21,X=e[34]<<15|e[35]>>>17,$=e[35]<<15|e[34]>>>17,N=e[45]<<29|e[44]>>>3,D=e[44]<<29|e[45]>>>3,T=e[6]<<28|e[7]>>>4,A=e[7]<<28|e[6]>>>4,ne=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,K=e[26]<<25|e[27]>>>7,j=e[27]<<25|e[26]>>>7,E=e[36]<<21|e[37]>>>11,S=e[37]<<21|e[36]>>>11,Z=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,H=e[8]<<27|e[9]>>>5,G=e[9]<<27|e[8]>>>5,C=e[18]<<20|e[19]>>>12,R=e[19]<<20|e[18]>>>12,se=e[29]<<7|e[28]>>>25,oe=e[28]<<7|e[29]>>>25,F=e[38]<<8|e[39]>>>24,V=e[39]<<8|e[38]>>>24,_=e[48]<<14|e[49]>>>18,I=e[49]<<14|e[48]>>>18,e[0]=p^~m&b,e[1]=g^~v&w,e[10]=T^~C&P,e[11]=A^~R&k,e[20]=L^~M&K,e[21]=x^~U&j,e[30]=H^~W&Q,e[31]=G^~Y&J,e[40]=te^~ne&se,e[41]=re^~ie&oe,e[2]=m^~b&E,e[3]=v^~w&S,e[12]=C^~P&O,e[13]=R^~k&B,e[22]=M^~K&F,e[23]=U^~j&V,e[32]=W^~Q&X,e[33]=Y^~J&$,e[42]=ne^~se&ae,e[43]=ie^~oe&ce,e[4]=b^~E&_,e[5]=w^~S&I,e[14]=P^~O&N,e[15]=k^~B&D,e[24]=K^~F&q,e[25]=j^~V&z,e[34]=Q^~X&Z,e[35]=J^~$&ee,e[44]=se^~ae&ue,e[45]=oe^~ce&le,e[6]=E^~_&p,e[7]=S^~I&g,e[16]=O^~N&T,e[17]=B^~D&A,e[26]=F^~q&L,e[27]=V^~z&x,e[36]=X^~Z&H,e[37]=$^~ee&G,e[46]=ae^~ue&te,e[47]=ce^~le&re,e[8]=_^~p&m,e[9]=I^~g&v,e[18]=N^~T&C,e[19]=D^~A&R,e[28]=q^~L&M,e[29]=z^~x&U,e[38]=Z^~H&W,e[39]=ee^~G&Y,e[48]=ue^~te&ne,e[49]=le^~re&ie,e[0]^=y[n],e[1]^=y[n+1]};if(u)e.exports=C;else{for(P=0;P<R.length;++P)a[R[P]]=C[R[P]];l&&(void 0===(n=function(){return C}.call(t,r,t,e))||(e.exports=n))}}()},12738: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}),s=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.StoreCodecs=t.WakuStore=t.PageDirection=t.waku_store=t.RelayCodecs=t.WakuRelay=t.waku_relay=t.PushResponse=t.LightPushCodec=t.WakuLightPush=t.waku_light_push=t.WakuMessage=t.waku_message=t.Protocols=t.DefaultPubSubTopic=t.Waku=t.waku=t.utils=t.enr=t.discovery=t.getPredefinedBootstrapNodes=t.getPublicKey=t.generateSymmetricKey=t.generatePrivateKey=void 0;var o=r(5602);Object.defineProperty(t,"generatePrivateKey",{enumerable:!0,get:function(){return o.generatePrivateKey}}),Object.defineProperty(t,"generateSymmetricKey",{enumerable:!0,get:function(){return o.generateSymmetricKey}}),Object.defineProperty(t,"getPublicKey",{enumerable:!0,get:function(){return o.getPublicKey}});var a=r(93656);Object.defineProperty(t,"getPredefinedBootstrapNodes",{enumerable:!0,get:function(){return a.getPredefinedBootstrapNodes}}),t.discovery=s(r(93656)),t.enr=s(r(58420)),t.utils=s(r(58928)),t.waku=s(r(5151));var c=r(5151);Object.defineProperty(t,"Waku",{enumerable:!0,get:function(){return c.Waku}}),Object.defineProperty(t,"DefaultPubSubTopic",{enumerable:!0,get:function(){return c.DefaultPubSubTopic}}),Object.defineProperty(t,"Protocols",{enumerable:!0,get:function(){return c.Protocols}}),t.waku_message=s(r(31195));var u=r(31195);Object.defineProperty(t,"WakuMessage",{enumerable:!0,get:function(){return u.WakuMessage}}),t.waku_light_push=s(r(50510));var l=r(50510);Object.defineProperty(t,"WakuLightPush",{enumerable:!0,get:function(){return l.WakuLightPush}}),Object.defineProperty(t,"LightPushCodec",{enumerable:!0,get:function(){return l.LightPushCodec}}),Object.defineProperty(t,"PushResponse",{enumerable:!0,get:function(){return l.PushResponse}}),t.waku_relay=s(r(45549));var h=r(45549);Object.defineProperty(t,"WakuRelay",{enumerable:!0,get:function(){return h.WakuRelay}}),Object.defineProperty(t,"RelayCodecs",{enumerable:!0,get:function(){return h.RelayCodecs}}),t.waku_store=s(r(93539));var d=r(93539);Object.defineProperty(t,"PageDirection",{enumerable:!0,get:function(){return d.PageDirection}}),Object.defineProperty(t,"WakuStore",{enumerable:!0,get:function(){return d.WakuStore}}),Object.defineProperty(t,"StoreCodecs",{enumerable:!0,get:function(){return d.StoreCodecs}})},5602: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}),s=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},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.verifySignature=t.compressPublicKey=t.keccak256=t.sign=t.getPublicKey=t.generateSymmetricKey=t.generatePrivateKey=t.sha256=t.randomBytes=t.getSubtle=void 0;const a=o(r(28339)),c=s(r(53845)),u=s(r(27898)),l=r(62110),h=s(r(52620)),d=r(57834),f={node:a.default,web:"object"===typeof self&&"crypto"in self?self.crypto:void 0};t.getSubtle=function(){if(f.web)return f.web.subtle;if(f.node)return f.node.webcrypto.subtle;throw new Error("The environment doesn't have Crypto Subtle API (if in the browser, be sure to use to be in a secure context, ie, https)")},t.randomBytes=c.utils.randomBytes,t.sha256=c.utils.sha256,t.generatePrivateKey=function(){return(0,t.randomBytes)(d.PrivateKeySize)},t.generateSymmetricKey=function(){return(0,t.randomBytes)(h.KeySize)},t.getPublicKey=c.getPublicKey,t.sign=async function(e,t){const[r,n]=await c.sign(e,t,{recovered:!0,der:!1});return(0,l.concat)([r,[n]],r.length+1)},t.keccak256=function(e){return new Uint8Array(u.keccak256.arrayBuffer(e))},t.compressPublicKey=function(e){return 64===e.length&&(e=(0,l.concat)([[4],e],65)),c.Point.fromHex(e).toRawBytes(!0)},t.verifySignature=function(e,t,r){try{const n=c.Signature.fromCompact(e.slice(0,64));return c.verify(n,t,r)}catch{return!1}}},55007: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.Bootstrap=void 0;const i=n(r(18392)),s=r(98719),o=r(22872),a=r(93656),c=(0,i.default)("waku:discovery:bootstrap");class u{constructor(e){var t;const r=null!==(t=e.maxPeers)&&void 0!==t?t:u.DefaultMaxPeers;if(e.default)c("Use hosted list of peers."),this.getBootstrapPeers=()=>Promise.resolve((0,a.getPredefinedBootstrapNodes)(void 0,r));else if(void 0!==e.peers&&e.peers.length>0){const t=e.peers.map((e=>"string"===typeof e?new s.Multiaddr(e):e)),n=(0,a.getPseudoRandomSubset)(t,r);c("Use provided list of peers (reduced to maxPeers)",t.map((e=>e.toString()))),this.getBootstrapPeers=()=>Promise.resolve(n)}else if("function"===typeof e.getPeers){c("Bootstrap: Use provided getPeers function.");const t=e.getPeers;this.getBootstrapPeers=async()=>{const e=await t();return(0,a.getPseudoRandomSubset)(e,r).map((e=>new s.Multiaddr(e)))}}else if(e.enrUrl){const t=e.wantedNodeCapabilityCount;if(!t)throw"`wantedNodeCapabilityCount` must be defined when using `enrUrl`";const r=e.enrUrl;c("Use provided EIP-1459 ENR Tree URL.");const n=o.DnsNodeDiscovery.dnsOverHttp();this.getBootstrapPeers=async()=>{const e=await n.getPeers([r],t);return c("Found ".concat(e.length," peers")),e.map((e=>e.getFullMultiaddrs())).flat()}}else c("No bootstrap method specified, no peer will be returned"),this.getBootstrapPeers=void 0}}t.Bootstrap=u,u.DefaultMaxPeers=1},22872: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.DnsNodeDiscovery=void 0;const i=r(18392),s=r(58420),o=r(42132),a=r(52039),c=n(r(81930)),u=(0,i.debug)("waku:discovery:dns");class l{constructor(e){this._errorTolerance=10,this._DNSTreeCache={},this.dns=e}static dnsOverHttp(e){const t=new o.DnsOverHttps(e);return new l(t)}async getPeers(e,t){const r=Math.floor(Math.random()*e.length),{publicKey:n,domain:i}=a.ENRTree.parseTree(e[r]),s={domain:i,publicKey:n,visits:{}},o=await(0,c.default)(t,this._errorTolerance,(()=>this._search(i,s)));return u("retrieved peers: ",o),o}async _search(e,t){try{const n=await this._getTXTRecord(e,t);let i,o;t.visits[e]=!0;const c=function(e){return e.startsWith(a.ENRTree.ROOT_PREFIX)?a.ENRTree.ROOT_PREFIX:e.startsWith(a.ENRTree.BRANCH_PREFIX)?a.ENRTree.BRANCH_PREFIX:e.startsWith(a.ENRTree.RECORD_PREFIX)?a.ENRTree.RECORD_PREFIX:""}(n);try{switch(c){case a.ENRTree.ROOT_PREFIX:return i=a.ENRTree.parseAndVerifyRoot(n,t.publicKey),await this._search(i,t);case a.ENRTree.BRANCH_PREFIX:return o=a.ENRTree.parseBranch(n),i=function(e,t){const r={};for(const[i,s]of e.entries())t.visits[s]&&(r[i]=!0);if(Object.keys(r).length===e.length)throw new Error("Unresolvable circular path detected");let n;do{n=Math.floor(Math.random()*e.length)}while(r[n]);return e[n]}(o,t),await this._search(i,t);case a.ENRTree.RECORD_PREFIX:return s.ENR.decodeTxt(n);default:return null}}catch(r){return u("Failed to search DNS tree ".concat(c," at subdomain ").concat(e,": ").concat(r)),null}}catch(r){return u("Failed to retrieve TXT record at subdomain ".concat(e,": ").concat(r)),null}}async _getTXTRecord(e,t){if(this._DNSTreeCache[e])return this._DNSTreeCache[e];const r=e!==t.domain?"".concat(e,".").concat(t.domain):t.domain,n=await this.dns.resolveTXT(r);if(!n.length)throw new Error("Received empty result array while fetching TXT record");if(!n[0].length)throw new Error("Received empty TXT record");const i=n.join("");return this._DNSTreeCache[e]=i,i}}t.DnsNodeDiscovery=l},42132:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DnsOverHttps=void 0;const n=r(54535),i=r(58928),{cloudflare:s,google:o,opendns:a}=n.endpoints;t.DnsOverHttps=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[s,o,a];this.endpoints=e}async resolveTXT(e){const t=(await(0,n.query)({questions:[{type:"TXT",name:e}]})).answers.map((e=>e.data)),r=[];return t.forEach((e=>{"string"===typeof e?r.push(e):Array.isArray(e)?e.forEach((e=>{"string"===typeof e?r.push(e):r.push((0,i.bytesToUtf8)(e))})):r.push((0,i.bytesToUtf8)(e))})),r}}},52039: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}),s=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.ENRTree=void 0;const o=s(r(49437)),a=r(46765),c=r(5602),u=r(58420),l=r(58928);class h{static parseAndVerifyRoot(e,t){if(!e.startsWith(this.ROOT_PREFIX))throw new Error("ENRTree root entry must start with '".concat(this.ROOT_PREFIX,"'"));const r=h.parseRootValues(e),n=o.decode.asBytes(t),i=e.split(" sig")[0],s=(0,l.utf8ToBytes)(i),u=(0,a.fromString)(r.signature,"base64url").slice(0,64);if(!(0,c.verifySignature)(u,(0,c.keccak256)(s),new Uint8Array(n)))throw new Error("Unable to verify ENRTree root signature");return r.eRoot}static parseRootValues(e){const t=e.match(/^enrtree-root:v1 e=([^ ]+) l=([^ ]+) seq=(\d+) sig=([^ ]+)$/);if(!Array.isArray(t))throw new Error("Could not parse ENRTree root entry");t.shift();const[r,n,i,s]=t;if(!r)throw new Error("Could not parse 'e' value from ENRTree root entry");if(!n)throw new Error("Could not parse 'l' value from ENRTree root entry");if(!i)throw new Error("Could not parse 'seq' value from ENRTree root entry");if(!s)throw new Error("Could not parse 'sig' value from ENRTree root entry");return{eRoot:r,lRoot:n,seq:Number(i),signature:s}}static parseTree(e){if(!e.startsWith(this.TREE_PREFIX))throw new Error("ENRTree tree entry must start with '".concat(this.TREE_PREFIX,"'"));const t=e.match(/^enrtree:\/\/([^@]+)@(.+)$/);if(!Array.isArray(t))throw new Error("Could not parse ENRTree tree entry");t.shift();const[r,n]=t;if(!r)throw new Error("Could not parse public key from ENRTree tree entry");if(!n)throw new Error("Could not parse domain from ENRTree tree entry");return{publicKey:r,domain:n}}static parseBranch(e){if(!e.startsWith(this.BRANCH_PREFIX))throw new Error("ENRTree branch entry must start with '".concat(this.BRANCH_PREFIX,"'"));return e.split(this.BRANCH_PREFIX)[1].split(",")}}t.ENRTree=h,h.RECORD_PREFIX=u.ENR.RECORD_PREFIX,h.TREE_PREFIX="enrtree:",h.BRANCH_PREFIX="enrtree-branch:",h.ROOT_PREFIX="enrtree-root:"},81930:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=(0,r(18392).debug)("waku:discovery:fetch_nodes");function i(e,t){return t.relay>=e.relay&&t.store>=e.store&&t.filter>=e.filter&&t.lightPush>=e.lightPush}function s(e,t){if(!e.nodeId)return!1;for(const r of t)if(e.nodeId===r.nodeId)return!1;return!0}function o(e,t){e.relay&&(t.relay+=1),e.store&&(t.store+=1),e.filter&&(t.filter+=1),e.lightPush&&(t.lightPush+=1)}function a(e,t,r){if(i(t,r))throw"Internal Error: Waku2 wanted capabilities are already fulfilled";const n=function(e,t){return{relay:t.relay<e.relay,store:t.store<e.store,filter:t.filter<e.filter,lightPush:t.lightPush<e.lightPush}}(t,r);return n.relay&&e.relay||n.store&&e.store||n.filter&&e.filter||n.lightPush&&e.lightPush}t.default=async function(e,t,r){var c,u,l,h;const d={relay:null!==(c=e.relay)&&void 0!==c?c:0,store:null!==(u=e.store)&&void 0!==u?u:0,filter:null!==(l=e.filter)&&void 0!==l?l:0,lightPush:null!==(h=e.lightPush)&&void 0!==h?h:0},f=d.relay+d.store+d.filter+d.lightPush,p={relay:0,store:0,filter:0,lightPush:0};let y=0;const g=[];for(;!i(d,p)&&y<f+t;){const e=await r();e&&s(e,g)&&(e.waku2&&a(e.waku2,d,p)&&(o(e.waku2,p),g.push(e)),n("got new peer candidate from DNS address=".concat(e.nodeId,"@").concat(e.ip))),y++}return g}},93656: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}),s=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.getPseudoRandomSubset=t.ENRTree=t.DnsOverHttps=t.dns=t.Bootstrap=t.predefined=t.getPredefinedBootstrapNodes=void 0;const o=r(53357);var a=r(21370);Object.defineProperty(t,"getPredefinedBootstrapNodes",{enumerable:!0,get:function(){return a.getPredefinedBootstrapNodes}}),t.predefined=s(r(21370));var c=r(55007);Object.defineProperty(t,"Bootstrap",{enumerable:!0,get:function(){return c.Bootstrap}}),t.dns=s(r(22872));var u=r(42132);Object.defineProperty(t,"DnsOverHttps",{enumerable:!0,get:function(){return u.DnsOverHttps}});var l=r(52039);Object.defineProperty(t,"ENRTree",{enumerable:!0,get:function(){return l.ENRTree}}),t.getPseudoRandomSubset=function(e,t){return e.length<=t?e:(0,o.shuffle)(e).slice(0,t)}},21370:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fleets=t.getPredefinedBootstrapNodes=t.Fleet=t.DefaultWantedNumber=void 0;const n=r(98719),i=r(93656);var s;t.DefaultWantedNumber=1,function(e){e.Prod="prod",e.Test="test"}(s=t.Fleet||(t.Fleet={})),t.getPredefinedBootstrapNodes=function(){let e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:s.Prod,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.DefaultWantedNumber;if(o<=0)return[];switch(r){case s.Prod:e=t.fleets.fleets["wakuv2.prod"]["waku-websocket"];break;case s.Test:e=t.fleets.fleets["wakuv2.test"]["waku-websocket"];break;default:e=t.fleets.fleets["wakuv2.prod"]["waku-websocket"]}return e=Object.values(e),e=e.map((e=>new n.Multiaddr(e))),(0,i.getPseudoRandomSubset)(e,o)},t.fleets={fleets:{"wakuv2.prod":{"waku-websocket":{"node-01.ac-cn-hongkong-c.wakuv2.prod":"/dns4/node-01.ac-cn-hongkong-c.wakuv2.prod.statusim.net/tcp/443/wss/p2p/16Uiu2HAm4v86W3bmT1BiH6oSPzcsSr24iDQpSN5Qa992BCjjwgrD","node-01.do-ams3.wakuv2.prod":"/dns4/node-01.do-ams3.wakuv2.prod.statusim.net/tcp/443/wss/p2p/16Uiu2HAmL5okWopX7NqZWBUKVqW8iUxCEmd5GMHLVPwCgzYzQv3e","node-01.gc-us-central1-a.wakuv2.prod":"/dns4/node-01.gc-us-central1-a.wakuv2.prod.statusim.net/tcp/443/wss/p2p/16Uiu2HAmVkKntsECaYfefR1V2yCR79CegLATuTPE6B9TxgxBiiiA"}},"wakuv2.test":{"waku-websocket":{"node-01.ac-cn-hongkong-c.wakuv2.test":"/dns4/node-01.ac-cn-hongkong-c.wakuv2.test.statusim.net/tcp/443/wss/p2p/16Uiu2HAkvWiyFsgRhuJEb9JfjYxEkoHLgnUQmr1N5mKWnYjxYRVm","node-01.do-ams3.wakuv2.test":"/dns4/node-01.do-ams3.wakuv2.test.statusim.net/tcp/443/wss/p2p/16Uiu2HAmPLe7Mzm8TsYUubgCAW1aJoeFScxrLj8ppHFivPo97bUZ","node-01.gc-us-central1-a.wakuv2.test":"/dns4/node-01.gc-us-central1-a.wakuv2.test.statusim.net/tcp/443/wss/p2p/16Uiu2HAmJb2e28qLXxT5kZxVUUoJt72EMzNGXB47Rxx5hw3q4YjS"}}}}},74029:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MULTIADDR_LENGTH_SIZE=t.ERR_NO_SIGNATURE=t.ERR_INVALID_ID=t.MAX_RECORD_SIZE=void 0,t.MAX_RECORD_SIZE=300,t.ERR_INVALID_ID="Invalid record id",t.ERR_NO_SIGNATURE="No valid signature found",t.MULTIADDR_LENGTH_SIZE=2},81326: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}),s=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},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ENR=void 0;const a=s(r(67845)),c=o(r(18392)),u=r(98719),l=o(r(93516)),h=r(46765),d=r(82051),f=r(74561),p=r(5602),y=r(58928),g=r(74029),m=r(3063),v=r(47159),b=s(r(71734)),w=r(97342),E=(0,c.default)("waku:enr");class S extends Map{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:BigInt(1),r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;super(Object.entries(e)),this.seq=t,this.signature=r}static async create(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:BigInt(1);const r=new S(e,t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null);try{const e=r.publicKey;if(e){const t=(0,m.createKeypair)(r.keypairType,void 0,e);r.peerId=await(0,m.createPeerIdFromKeypair)(t)}}catch(n){E("Could not calculate peer id for ENR",n)}return r}static createV4(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return 33!==e.length&&(e=(0,p.compressPublicKey)(e)),S.create({...t,id:(0,y.utf8ToBytes)("v4"),secp256k1:e})}static createFromPeerId(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=(0,m.createKeypairFromPeerId)(e);if(r.type===m.KeypairType.secp256k1)return S.createV4(r.publicKey,t);throw new Error}static async decodeFromValues(e){if(!Array.isArray(e))throw new Error("Decoded ENR must be an array");if(e.length%2!==0)throw new Error("Decoded ENR must have an even number of elements");const[t,r,...n]=e;if(!t||Array.isArray(t))throw new Error("Decoded ENR invalid signature: must be a byte array");if(!r||Array.isArray(r))throw new Error("Decoded ENR invalid sequence number: must be a byte array");const i={};for(let a=0;a<n.length;a+=2)try{i[(0,y.bytesToUtf8)(n[a])]=n[a+1]}catch(u){E("Failed to decode ENR key to UTF-8, skipping it",n[a],u)}const s="0x"+(r.length?(0,y.bytesToHex)(r):"00"),o=await S.create(i,BigInt(s),t),c=(0,y.hexToBytes)(a.encode([r,...n]));if(!o.verify(c,t))throw new Error("Unable to verify ENR signature");return o}static decode(e){const t=a.decode(e).map(y.hexToBytes);return S.decodeFromValues(t)}static decodeTxt(e){if(!e.startsWith(this.RECORD_PREFIX))throw new Error("\"string encoded ENR must start with '".concat(this.RECORD_PREFIX,"'"));return S.decode((0,h.fromString)(e.slice(4),"base64url"))}set(e,t){return this.signature=null,this.seq++,super.set(e,t)}get id(){const e=this.get("id");if(!e)throw new Error("id not found.");return(0,y.bytesToUtf8)(e)}get keypairType(){if("v4"===this.id)return m.KeypairType.secp256k1;throw new Error(g.ERR_INVALID_ID)}get publicKey(){if("v4"===this.id)return this.get("secp256k1");throw new Error(g.ERR_INVALID_ID)}get keypair(){if(this.publicKey){const e=this.publicKey;return(0,m.createKeypair)(this.keypairType,void 0,e)}}get nodeId(){if("v4"===this.id)return this.publicKey?b.nodeId(this.publicKey):void 0;throw new Error(g.ERR_INVALID_ID)}get ip(){const e=this.get("ip");return e?l.default.toString(u.protocols.names.ip4.code,e):void 0}set ip(e){e?this.set("ip",l.default.toBytes(u.protocols.names.ip4.code,e)):this.delete("ip")}get tcp(){const e=this.get("tcp");return e?Number(l.default.toString(u.protocols.names.tcp.code,e)):void 0}set tcp(e){void 0===e?this.delete("tcp"):this.set("tcp",l.default.toBytes(u.protocols.names.tcp.code,e))}get udp(){const e=this.get("udp");return e?Number(l.default.toString(u.protocols.names.udp.code,e)):void 0}set udp(e){void 0===e?this.delete("udp"):this.set("udp",l.default.toBytes(u.protocols.names.udp.code,e))}get ip6(){const e=this.get("ip6");return e?l.default.toString(u.protocols.names.ip6.code,e):void 0}set ip6(e){e?this.set("ip6",l.default.toBytes(u.protocols.names.ip6.code,e)):this.delete("ip6")}get tcp6(){const e=this.get("tcp6");return e?Number(l.default.toString(u.protocols.names.tcp.code,e)):void 0}set tcp6(e){void 0===e?this.delete("tcp6"):this.set("tcp6",l.default.toBytes(u.protocols.names.tcp.code,e))}get udp6(){const e=this.get("udp6");return e?Number(l.default.toString(u.protocols.names.udp.code,e)):void 0}set udp6(e){void 0===e?this.delete("udp6"):this.set("udp6",l.default.toBytes(u.protocols.names.udp.code,e))}get multiaddrs(){const e=this.get("multiaddrs");if(e)return(0,v.decodeMultiaddrs)(e)}set multiaddrs(e){if(void 0===e)this.delete("multiaddrs");else{const t=(0,v.encodeMultiaddrs)(e);this.set("multiaddrs",t)}}getLocationMultiaddr(e){if("udp"===e)return this.getLocationMultiaddr("udp4")||this.getLocationMultiaddr("udp6");if("tcp"===e)return this.getLocationMultiaddr("tcp4")||this.getLocationMultiaddr("tcp6");const t=e.endsWith("6"),r=this.get(t?"ip6":"ip");if(!r)return;const n=e.startsWith("udp"),i=e.startsWith("tcp");let s,o;if(n)s="udp",o=t?this.get("udp6"):this.get("udp");else{if(!i)return;s="tcp",o=t?this.get("tcp6"):this.get("tcp")}if(!o)return;const a=u.protocols.names[t?"ip6":"ip4"],c=a.size/8,l=u.protocols.names[s],h=(0,f.encode)(l.code),d=new Uint8Array(3+c+h.length);return d[0]=a.code,d.set(r,1),d.set(h,1+c),d.set(o,1+c+h.length),new u.Multiaddr(d)}setLocationMultiaddr(e){const t=e.protoNames();if(2!==t.length&&"udp"!==t[1]&&"tcp"!==t[1])throw new Error("Invalid multiaddr");const r=e.tuples();if(!r[0][1]||!r[1][1])throw new Error("Invalid multiaddr");4===r[0][0]?(this.set("ip",r[0][1]),this.set(t[1],r[1][1])):(this.set("ip6",r[0][1]),this.set(t[1]+"6",r[1][1]))}getFullMultiaddr(e){if(this.peerId){const t=this.getLocationMultiaddr(e);if(t)return t.encapsulate("/p2p/".concat(this.peerId.toB58String()))}}getFullMultiaddrs(){if(this.peerId&&this.multiaddrs){const e=this.peerId;return this.multiaddrs.map((t=>t.encapsulate("/p2p/".concat(e.toB58String()))))}return[]}get waku2(){const e=this.get("waku2");if(e)return(0,w.decodeWaku2)(e[0])}set waku2(e){if(void 0===e)this.delete("waku2");else{const t=(0,w.encodeWaku2)(e);this.set("waku2",new Uint8Array([t]))}}verify(e,t){if(!this.get("id")||"v4"!==this.id)throw new Error(g.ERR_INVALID_ID);if(!this.publicKey)throw new Error("Failed to verify ENR: No public key");return(0,p.verifySignature)(t,(0,p.keccak256)(e),this.publicKey)}async sign(e,t){if("v4"!==this.id)throw new Error(g.ERR_INVALID_ID);return this.signature=await b.sign(t,e),this.signature}async encodeToValues(e){const t=Array.from(this.keys()).sort(((e,t)=>e.localeCompare(t))).map((e=>[e,this.get(e)])).map((e=>{let[t,r]=e;return[(0,y.utf8ToBytes)(t),r]})).flat();if(t.unshift(new Uint8Array([Number(this.seq)])),e)t.unshift(await this.sign((0,y.hexToBytes)(a.encode(t)),e));else{if(!this.signature)throw new Error(g.ERR_NO_SIGNATURE);t.unshift(this.signature)}return t}async encode(e){const t=(0,y.hexToBytes)(a.encode(await this.encodeToValues(e)));if(t.length>=g.MAX_RECORD_SIZE)throw new Error("ENR must be less than 300 bytes");return t}async encodeTxt(e){return S.RECORD_PREFIX+(0,d.toString)(await this.encode(e),"base64url")}}t.ENR=S,S.RECORD_PREFIX="enr:"},58420: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}),s=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},o=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.v4=void 0;const a=s(r(71734));t.v4=a,o(r(74029),t),o(r(81326),t),o(r(59477),t),o(r(3063),t),o(r(97342),t)},3063: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)},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.createKeypairFromPeerId=t.createPeerIdFromKeypair=t.createKeypair=t.generateKeypair=t.ERR_TYPE_NOT_IMPLEMENTED=void 0;const o=r(25504),a=r(60173),c=s(r(90190)),u=r(31981),l=r(71288),{keysPBM:h,supportedKeys:d}=o.keys;function f(e,r,n){if(e===l.KeypairType.secp256k1)return new u.Secp256k1Keypair(r,n);throw new Error(t.ERR_TYPE_NOT_IMPLEMENTED)}t.ERR_TYPE_NOT_IMPLEMENTED="Keypair type not implemented",i(r(71288),t),i(r(31981),t),t.generateKeypair=async function(e){if(e===l.KeypairType.secp256k1)return await u.Secp256k1Keypair.generate();throw new Error(t.ERR_TYPE_NOT_IMPLEMENTED)},t.createKeypair=f,t.createPeerIdFromKeypair=async function(e){if(e.type===l.KeypairType.secp256k1){const t=e.hasPrivateKey()?new d.secp256k1.Secp256k1PrivateKey(e.privateKey,e.publicKey):void 0,r=new d.secp256k1.Secp256k1PublicKey(e.publicKey),n=await a.identity.digest(r.bytes);return new c.default(n.bytes,t,r)}throw new Error(t.ERR_TYPE_NOT_IMPLEMENTED)},t.createKeypairFromPeerId=function(e){const t=h.PublicKey.decode(e.pubKey.bytes);return f(t.Type,e.privKey?e.privKey.marshal():void 0,t.Data)}},31981: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}),s=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.Secp256k1Keypair=void 0;const o=s(r(53845)),a=r(5602),c=r(71288);class u{constructor(e,t){let r=t;if(r&&(r=(0,a.compressPublicKey)(r)),(this._privateKey=e)&&!this.privateKeyVerify())throw new Error("Invalid private key");if((this._publicKey=r)&&!this.publicKeyVerify())throw new Error("Invalid public key");this.type=c.KeypairType.secp256k1}static async generate(){const e=(0,a.randomBytes)(32),t=o.getPublicKey(e);return new u(e,t)}privateKeyVerify(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._privateKey;return!e||o.utils.isValidPrivateKey(e)}publicKeyVerify(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._publicKey;if(e)try{return o.Point.fromHex(e),!0}catch{return!1}return!0}get privateKey(){if(!this._privateKey)throw new Error;return this._privateKey}get publicKey(){if(!this._publicKey)throw new Error;return this._publicKey}hasPrivateKey(){return!!this._privateKey}}t.Secp256k1Keypair=u},71288:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.KeypairType=void 0,function(e){e[e.rsa=0]="rsa",e[e.ed25519=1]="ed25519",e[e.secp256k1=2]="secp256k1"}(t.KeypairType||(t.KeypairType={}))},47159:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.encodeMultiaddrs=t.decodeMultiaddrs=void 0;const n=r(98719),i=r(74029);t.decodeMultiaddrs=function(e){const t=[];let r=0;for(;r<e.length;){const s=new DataView(e.buffer,r,i.MULTIADDR_LENGTH_SIZE).getUint16(0);r+=i.MULTIADDR_LENGTH_SIZE;const o=e.slice(r,r+s);r+=s;const a=new n.Multiaddr(o);t.push(a)}return t},t.encodeMultiaddrs=function(e){const t=e.reduce(((e,t)=>e+i.MULTIADDR_LENGTH_SIZE+t.bytes.length),0),r=new Uint8Array(t),n=new DataView(r.buffer);let s=0;return e.forEach((e=>{if(e.getPeerId())throw new Error("`multiaddr` field MUST not contain peer id");n.setUint16(s,e.bytes.length),s+=i.MULTIADDR_LENGTH_SIZE,r.set(e.bytes,s),s+=e.bytes.length})),r}},59477:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},71734: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}),s=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.nodeId=t.sign=void 0;const o=s(r(53845)),a=r(5602),c=r(58928);t.sign=async function(e,t){return o.sign((0,a.keccak256)(t),e,{der:!1})},t.nodeId=function(e){const t=o.Point.fromHex(e).toRawBytes(!1);return(0,c.bytesToHex)((0,a.keccak256)(t.slice(1)))}},97342:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decodeWaku2=t.encodeWaku2=void 0,t.encodeWaku2=function(e){let t=0;return e.lightPush&&(t+=1),t<<=1,e.filter&&(t+=1),t<<=1,e.store&&(t+=1),t<<=1,e.relay&&(t+=1),t},t.decodeWaku2=function(e){const t={relay:!1,store:!1,filter:!1,lightPush:!1};return e%2&&(t.relay=!0),(e>>=1)%2&&(t.store=!0),(e>>=1)%2&&(t.filter=!0),(e>>=1)%2&&(t.lightPush=!0),t}},19370:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getPeersForProtocol=t.selectRandomPeer=void 0,t.selectRandomPeer=async function(e){const t=[];for await(const r of e)t.push(r);if(0===t.length)return;return t[Math.round(Math.random()*(t.length-1))]},t.getPeersForProtocol=async function*(e,t){for await(const r of e.peerStore.getPeers()){let e=!1;for(let n=0;n<t.length;n++)if(r.protocols.includes(t[n])){e=!0;break}e&&(yield r)}}},58928:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.utf8ToBytes=t.bytesToUtf8=t.bytesToHex=t.hexToBytes=void 0;const n=r(46765),i=r(82051);t.hexToBytes=function(e){if("string"===typeof e){const t=e.replace(/^0x/i,"");return(0,n.fromString)(t,"base16")}return e};t.bytesToHex=e=>(0,i.toString)(e,"base16");t.bytesToUtf8=e=>(0,i.toString)(e,"utf8");t.utf8ToBytes=e=>(0,n.fromString)(e,"utf8")},5151: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.Waku=t.Protocols=t.DefaultPubSubTopic=t.DefaultRelayKeepAliveValueSecs=t.DefaultPingKeepAliveValueSecs=void 0;const i=r(28278),s=n(r(18392)),o=n(r(6197)),a=n(r(44786)),c=n(r(34875)),u=n(r(3300)),l=n(r(44169)),h=n(r(66321)),d=r(98719),f=n(r(90190)),p=r(93656),y=r(7071),g=r(50510),m=r(31195),v=r(45549),b=r(21923),w=r(93539),E=u.default.prototype[Symbol.toStringTag];t.DefaultPingKeepAliveValueSecs=0,t.DefaultRelayKeepAliveValueSecs=300,t.DefaultPubSubTopic="/waku/2/default-waku/proto";const S=(0,s.default)("waku:waku");var _;!function(e){e.Relay="relay",e.Store="store",e.LightPush="lightpush",e.Filter="filter"}(_=t.Protocols||(t.Protocols={}));class I{constructor(e,r,n,i,s){var o;this.libp2p=r,this.relay=r.pubsub,this.store=n,this.filter=s,this.lightPush=i,this.pingKeepAliveTimers={},this.relayKeepAliveTimers={};const a=e.pingKeepAlive||t.DefaultPingKeepAliveValueSecs,c=e.relayKeepAlive||t.DefaultRelayKeepAliveValueSecs;r.connectionManager.on("peer:connect",(e=>{this.startKeepAlive(e.remotePeer,a,c)})),r.connectionManager.on("peer:disconnect",(e=>{this.stopKeepAlive(e.remotePeer)})),null===e||void 0===e||null===(o=e.decryptionKeys)||void 0===o||o.forEach((e=>{this.addDecryptionKey(e)}))}static async create(e){var t,r,n;const s=Object.assign({},null===e||void 0===e?void 0:e.libp2p);if(s.config=Object.assign({transport:{[E]:{filter:l.default.all}}},null===e||void 0===e||null===(t=e.libp2p)||void 0===t?void 0:t.config),null!==e&&void 0!==e&&e.pubSubTopic&&(s.config.pubsub=Object.assign({pubSubTopic:e.pubSubTopic},s.config.pubsub)),s.modules=Object.assign({},null===e||void 0===e||null===(r=e.libp2p)||void 0===r?void 0:r.modules),s.modules=Object.assign({transport:[u.default]},null===e||void 0===e||null===(n=e.libp2p)||void 0===n?void 0:n.modules),s.modules=Object.assign(s.modules,{streamMuxer:[c.default],connEncryption:[new i.Noise(null===e||void 0===e?void 0:e.staticNoiseKey)],pubsub:v.WakuRelay}),null!==e&&void 0!==e&&e.bootstrap){const t=new p.Bootstrap(null===e||void 0===e?void 0:e.bootstrap);if(void 0!==t.getBootstrapPeers)try{const e=await t.getBootstrapPeers();s.modules=Object.assign(s.modules,{peerDiscovery:[a.default]}),s.config.peerDiscovery={[a.default.tag]:{list:e,enabled:!0}}}catch(b){S("Failed to retrieve bootstrap nodes",b)}}const h=await o.default.create(s),d=new w.WakuStore(h,{pubSubTopic:null===e||void 0===e?void 0:e.pubSubTopic}),f=new g.WakuLightPush(h),m=new y.WakuFilter(h);return await h.start(),new I(e||{},h,d,f,m)}async dial(e,t){const r=null!==t&&void 0!==t?t:[_.Relay],n=[];if(r.includes(_.Relay)&&v.RelayCodecs.forEach((e=>n.push(e))),r.includes(_.Store))for(const i of Object.values(w.StoreCodecs))n.push(i);return r.includes(_.LightPush)&&n.push(g.LightPushCodec),r.includes(_.Filter)&&n.push(y.FilterCodec),this.libp2p.dialProtocol(e,n)}addPeerToAddressBook(e,t){let r;r="string"===typeof e?f.default.createFromB58String(e):e;const n=t.map((e=>"string"===typeof e?(0,d.multiaddr)(e):e));this.libp2p.peerStore.addressBook.set(r,n)}async stop(){return this.libp2p.stop()}addDecryptionKey(e,t){this.relay.addDecryptionKey(e,t),this.store.addDecryptionKey(e,t),this.filter.addDecryptionKey(e,t)}deleteDecryptionKey(e){this.relay.deleteDecryptionKey(e),this.store.deleteDecryptionKey(e),this.filter.deleteDecryptionKey(e)}getLocalMultiaddrWithID(){const e=this.libp2p.multiaddrs.find((e=>e.toString().match(/127\.0\.0\.1/)));if(!e||""===e.toString())throw"Not listening on localhost";return e+"/p2p/"+this.libp2p.peerId.toB58String()}async waitForRemotePeer(e,t){var r;const n=[];if((e=null!==(r=e)&&void 0!==r?r:[_.Relay]).includes(_.Relay)){if(0==this.relay.getPeers().size){const e=new Promise((e=>{this.libp2p.pubsub.once("pubsub:subscription-change",(()=>{this.libp2p.pubsub.once("gossipsub:heartbeat",e)}))}));n.push(e)}}if(e.includes(_.Store)){const e=(async()=>{for await(const e of this.store.peers){S("Store peer found",e.id.toB58String());break}})();n.push(e)}if(e.includes(_.LightPush)){const e=(async()=>{for await(const e of this.lightPush.peers){S("Light Push peer found",e.id.toB58String());break}})();n.push(e)}if(e.includes(_.Filter)){const e=(async()=>{for await(const e of this.filter.peers){S("Filter peer found",e.id.toB58String());break}})();n.push(e)}t?await A(Promise.all(n),t,"Timed out waiting for a remote peer."):await Promise.all(n)}startKeepAlive(e,t,r){this.stopKeepAlive(e);const n=e.toB58String();if(0!==t){const r=new h.default(this.libp2p);this.pingKeepAliveTimers[n]=setInterval((()=>{r.ping(e).catch((e=>{S("Ping failed (".concat(n,")"),e)}))}),1e3*t)}0!==r&&(this.relayKeepAliveTimers[n]=setInterval((()=>{m.WakuMessage.fromBytes(new Uint8Array,b.RelayPingContentTopic).then((e=>this.relay.send(e)))}),1e3*r))}stopKeepAlive(e){const t=e.toB58String();this.pingKeepAliveTimers[t]&&(clearInterval(this.pingKeepAliveTimers[t]),delete this.pingKeepAliveTimers[t]),this.relayKeepAliveTimers[t]&&(clearInterval(this.relayKeepAliveTimers[t]),delete this.relayKeepAliveTimers[t])}}t.Waku=I;const T=(e,t)=>new Promise(((r,n)=>setTimeout((()=>n(t)),e))),A=(e,t,r)=>Promise.race([e,T(t,r)])},80441: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}),s=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.FilterRPC=void 0;const o=r(80886),a=r(75658),c=s(r(82176));class u{constructor(e){this.proto=e}static createRequest(e,t,r){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];return new u({requestId:r||(0,a.v4)(),request:{subscribe:n,topic:e,contentFilters:t},push:void 0})}static decode(e){const t=c.FilterRPC.decode(o.Reader.create(e));return new u(t)}encode(){return c.FilterRPC.encode(this.proto).finish()}get push(){return this.proto.push}get requestId(){return this.proto.requestId}}t.FilterRPC=u},7071: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.WakuFilter=t.FilterCodec=void 0;const i=n(r(18392)),s=n(r(44709)),o=r(79023),a=r(19370),c=r(58928),u=r(5151),l=r(31195),h=r(80441);t.FilterCodec="/vac/waku/filter/2.0.0-beta1";const d=(0,i.default)("waku:filter");t.WakuFilter=class{constructor(e){this.libp2p=e,this.subscriptions=new Map,this.decryptionKeys=new Map,this.libp2p.handle(t.FilterCodec,this.onRequest.bind(this))}async subscribe(e,t,r){const n=(null===r||void 0===r?void 0:r.pubsubTopic)||u.DefaultPubSubTopic,i=t.map((e=>({contentTopic:e}))),a=h.FilterRPC.createRequest(n,i,void 0,!0),c=await this.getPeer(null===r||void 0===r?void 0:r.peerId),l=await this.newStream(c);try{await(0,o.pipe)([a.encode()],s.default.encode(),l)}catch(f){throw d("Error subscribing to peer ",c.id.toB58String(),"for content topics",t,": ",f),f}return this.addCallback(a.requestId,e),async()=>{await this.unsubscribe(n,i,a.requestId,c),this.removeCallback(a.requestId)}}async onRequest(e){let{stream:t}=e;d("Receiving message push");try{await(0,o.pipe)(t.source,s.default.decode(),(async e=>{for await(const n of e){var t,r;const e=h.FilterRPC.decode(n.slice());null!==(t=e.push)&&void 0!==t&&null!==(r=t.messages)&&void 0!==r&&r.length&&await this.pushMessages(e.requestId,e.push.messages)}}))}catch(r){d("Error decoding message",r)}}async pushMessages(e,t){const r=this.subscriptions.get(e);if(!r)return void d("No callback registered for request ID ".concat(e));const n=Array.from(this.decryptionKeys).map((e=>{let[t,{method:r,contentTopics:n}]=e;return{key:t,method:r,contentTopics:n}}));for(const i of t){const e=await l.WakuMessage.decodeProto(i,n);e?r(e):d("Not able to decode message")}}addCallback(e,t){this.subscriptions.set(e,t)}removeCallback(e){this.subscriptions.delete(e)}async unsubscribe(e,t,r,n){const i=h.FilterRPC.createRequest(e,t,r,!1),a=await this.newStream(n);try{await(0,o.pipe)([i.encode()],s.default.encode(),a.sink)}catch(c){throw d("Error unsubscribing",c),c}}async newStream(e){const r=this.libp2p.connectionManager.get(e.id);if(!r)throw new Error("Failed to get a connection to the peer");const{stream:n}=await r.newStream(t.FilterCodec);return n}async getPeer(e){let t;if(e){if(t=await this.libp2p.peerStore.get(e),!t)throw new Error("Failed to retrieve connection details for provided peer in peer store: ".concat(e.toB58String()))}else if(t=await this.randomPeer,!t)throw new Error("Failed to find known peer that registers waku filter protocol");return t}addDecryptionKey(e,t){this.decryptionKeys.set((0,c.hexToBytes)(e),null!==t&&void 0!==t?t:{})}deleteDecryptionKey(e){this.decryptionKeys.delete((0,c.hexToBytes)(e))}get peers(){return(0,a.getPeersForProtocol)(this.libp2p,[t.FilterCodec])}get randomPeer(){return(0,a.selectRandomPeer)(this.peers)}}},50510: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.WakuLightPush=t.PushResponse=t.LightPushCodec=void 0;const i=n(r(72934)),s=n(r(44709)),o=r(79023),a=r(63623);Object.defineProperty(t,"PushResponse",{enumerable:!0,get:function(){return a.PushResponse}});const c=r(19370),u=r(5151),l=r(80522);t.LightPushCodec="/vac/waku/lightpush/2.0.0-beta1";t.WakuLightPush=class{constructor(e,t){this.libp2p=e,null!==t&&void 0!==t&&t.pubSubTopic?this.pubSubTopic=t.pubSubTopic:this.pubSubTopic=u.DefaultPubSubTopic}async push(e,r){let n;if(null!==r&&void 0!==r&&r.peerId){if(n=await this.libp2p.peerStore.get(r.peerId),!n)throw"Peer is unknown"}else n=await this.randomPeer;if(!n)throw"No peer available";if(!n.protocols.includes(t.LightPushCodec))throw"Peer does not register waku light push protocol";const a=this.libp2p.connectionManager.get(n.id);if(!a)throw"Failed to get a connection to the peer";const{stream:c}=await a.newStream(t.LightPushCodec);try{const t=null!==r&&void 0!==r&&r.pubSubTopic?r.pubSubTopic:this.pubSubTopic,n=l.PushRPC.createRequest(e,t),a=await(0,o.pipe)([n.encode()],s.default.encode(),c,s.default.decode(),i.default);try{const e=l.PushRPC.decode(a.slice()).response;return e||(console.log("No response in PushRPC"),null)}catch(u){console.log("Failed to decode push reply",u)}}catch(u){console.log("Failed to send waku light push request",u)}return null}get peers(){return(0,c.getPeersForProtocol)(this.libp2p,[t.LightPushCodec])}get randomPeer(){return(0,c.selectRandomPeer)(this.peers)}}},80522: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}),s=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.PushRPC=void 0;const o=r(80886),a=r(75658),c=s(r(63623));class u{constructor(e){this.proto=e}static createRequest(e,t){return new u({requestId:(0,a.v4)(),request:{message:e.proto,pubSubTopic:t},response:void 0})}static decode(e){const t=c.PushRPC.decode(o.Reader.create(e));return new u(t)}encode(){return c.PushRPC.encode(this.proto).finish()}get query(){return this.proto.request}get response(){return this.proto.response}}t.PushRPC=u},28799: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}),s=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.decrypt=t.encrypt=void 0;const o=s(r(53845)),a=r(62110),c=r(5602),u=r(58928);function l(e,t){let r=1,n=0,i=Promise.resolve(new Uint8Array);for(;n<t;){const t=new Uint8Array([r>>24,r>>16,r>>8,r]),s=(0,a.concat)([t,e],t.length+e.length),o=(0,c.sha256)(s);i=i.then((e=>o.then((t=>{const r=new Uint8Array(t);return(0,a.concat)([e,r],e.length+r.length)})))),n+=32,r+=1}return i}function h(e,t){if(32!==e.length)throw new Error("Bad private key, it should be 32 bytes but it's actually ".concat(e.length," bytes long"));if(65!==t.length)throw new Error("Bad public key, it should be 65 bytes but it's actually ".concat(t.length," bytes long"));if(4!==t[0])throw new Error("Bad public key, a valid public key would begin with 4");{const r=o.getSharedSecret(e,t,!0);return new Uint8Array((0,u.hexToBytes)(r).slice(1))}}t.encrypt=async function(e,t){const r=(0,c.randomBytes)(32),n=await h(r,e),i=await l(n,32),s=(0,c.randomBytes)(16),u=i.slice(0,16),d=await(f=s,p=u,y=t,(0,c.getSubtle)().importKey("raw",p,"AES-CTR",!1,["encrypt"]).then((e=>(0,c.getSubtle)().encrypt({name:"AES-CTR",counter:f,length:128},e,y))).then((e=>new Uint8Array(e))));var f,p,y;const g=(0,a.concat)([s,d],s.length+d.length),m=await(0,c.sha256)(i.slice(16)),v=await function(e,t){const r={name:"HMAC",hash:{name:"SHA-256"}};return(0,c.getSubtle)().importKey("raw",e,r,!1,["sign"]).then((e=>(0,c.getSubtle)().sign(r,e,t))).then((e=>new Uint8Array(e)))}(m,g),b=o.getPublicKey(r,!1);return(0,a.concat)([b,g,v],b.length+g.length+v.length)};t.decrypt=async function(e,t){if(t.length<=113)throw new Error("Invalid Ciphertext. Data is too small. It should ba at least ".concat(113," bytes"));if(4!==t[0])throw new Error("Not a valid ciphertext. It should begin with 4 but actually begin with ".concat(t[0]));{const s=t.slice(0,65),o=t.length-113,a=t.slice(65,81),u=t.slice(65,81+o),d=u.slice(16),f=t.slice(81+o),p=h(e,s),y=await l(p,32),[g,m]=await(0,c.sha256)(y.slice(16)).then((e=>[y.slice(0,16),e]));if(!await function(e,t,r){const n={name:"HMAC",hash:{name:"SHA-256"}};return(0,c.getSubtle)().importKey("raw",e,n,!1,["verify"]).then((e=>(0,c.getSubtle)().verify(n,e,r,t)))}(m,u,f))throw new Error("Incorrect MAC");return r=a,n=g,i=d,(0,c.getSubtle)().importKey("raw",n,"AES-CTR",!1,["decrypt"]).then((e=>(0,c.getSubtle)().decrypt({name:"AES-CTR",counter:r,length:128},e,i))).then((e=>new Uint8Array(e)))}var r,n,i}},31195: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}),s=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},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.WakuMessage=t.DecryptionMethod=void 0;const a=o(r(18392)),c=o(r(18987)),u=r(80886),l=s(r(52494)),h=r(58928),d=s(r(57834)),f=(0,a.default)("waku:message");var p;!function(e){e.Asymmetric="asymmetric",e.Symmetric="symmetric"}(p=t.DecryptionMethod||(t.DecryptionMethod={}));class y{constructor(e,t,r){this.proto=e,this._signaturePublicKey=t,this._signature=r}static async fromUtf8String(e,t,r){const n=(0,h.utf8ToBytes)(e);return y.fromBytes(n,t,r)}static async fromBytes(e,t,r){var n,i;const{timestamp:s,encPublicKey:o,symKey:a,sigPrivKey:u}=Object.assign({timestamp:new Date},r||{});let l,h=e,f=0;if(o&&a)throw"Pass either `encPublicKey` or `symKey`, not both.";if(o){const e=await d.clearEncode(h,u);h=await d.encryptAsymmetric(e.payload,o),l=e.sig,f=1}else if(a){const e=await d.clearEncode(h,u);h=await d.encryptSymmetric(e.payload,a),l=e.sig,f=1}return new y({payload:h,timestampDeprecated:s.valueOf()/1e3,timestamp:c.default.fromNumber(s.valueOf()).mul(1e6),version:f,contentTopic:t},null===(n=l)||void 0===n?void 0:n.publicKey,null===(i=l)||void 0===i?void 0:i.signature)}static async decode(e,t){const r=l.WakuMessage.decode(u.Reader.create(e));return y.decodeProto(r,t)}static async decodeProto(e,t){if(void 0===e.payload)return void f("Payload is undefined");const r=e.payload;let n,i;if(1===e.version&&e.payload){var s,o;if(void 0===t)return void f("Payload is encrypted but no private keys have been provided.");const a=e=>!!e,c=(await Promise.all(t.map((async t=>{let{key:n,method:i,contentTopics:s}=t;if(!s||e.contentTopic&&s.includes(e.contentTopic))switch(i){case p.Asymmetric:try{return await d.decryptAsymmetric(r,n)}catch(o){return void f("Failed to decrypt message using asymmetric encryption despite decryption method being specified",o)}case p.Symmetric:try{return await d.decryptSymmetric(r,n)}catch(o){return void f("Failed to decrypt message using asymmetric encryption despite decryption method being specified",o)}default:try{return await d.decryptSymmetric(r,n)}catch(o){f("Failed to decrypt message using symmetric encryption",o);try{return await d.decryptAsymmetric(r,n)}catch(o){return void f("Failed to decrypt message using asymmetric encryption",o)}}}})))).filter(a);if(0===c.length)return void f("Failed to decrypt payload.");const u=c[0],l=await d.clearDecode(u);if(!l)return void f("Failed to decode payload.");Object.assign(e,{payload:l.payload}),n=null===(s=l.sig)||void 0===s?void 0:s.publicKey,i=null===(o=l.sig)||void 0===o?void 0:o.signature}return new y(e,n,i)}encode(){return l.WakuMessage.encode(this.proto).finish()}get payloadAsUtf8(){if(!this.payload)return"";try{return(0,h.bytesToUtf8)(this.payload)}catch(e){return f("Could not decode byte as UTF-8",e),""}}get payload(){if(this.proto.payload)return new Uint8Array(this.proto.payload)}get contentTopic(){return this.proto.contentTopic}get version(){return this.proto.version}get timestamp(){try{if(this.proto.timestamp){const e=this.proto.timestamp.div(1e6).toNumber();return new Date(e)}if(this.proto.timestampDeprecated)return new Date(1e3*this.proto.timestampDeprecated)}catch(e){return}}get signaturePublicKey(){return this._signaturePublicKey}get signature(){return this._signature}}t.WakuMessage=y},52620:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.generateIv=t.decrypt=t.encrypt=t.TagSize=t.IvSize=t.KeySize=void 0;const n=r(5602);t.KeySize=32,t.IvSize=12,t.TagSize=16;const i={name:"AES-GCM",length:128};t.encrypt=async function(e,t,r){return(0,n.getSubtle)().importKey("raw",t,i,!1,["encrypt"]).then((t=>(0,n.getSubtle)().encrypt({iv:e,...i},t,r))).then((e=>new Uint8Array(e)))},t.decrypt=async function(e,t,r){return(0,n.getSubtle)().importKey("raw",t,i,!1,["decrypt"]).then((t=>(0,n.getSubtle)().decrypt({iv:e,...i},t,r))).then((e=>new Uint8Array(e)))},t.generateIv=function(){return(0,n.randomBytes)(t.IvSize)}},57834: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}),s=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.decryptSymmetric=t.encryptSymmetric=t.decryptAsymmetric=t.encryptAsymmetric=t.clearDecode=t.clearEncode=t.PrivateKeySize=void 0;const o=s(r(53845)),a=r(62110),c=r(5602),u=r(58928),l=s(r(28799)),h=s(r(52620));function d(e){let t=1;for(let r=e.length;r>=256;r/=256)t++;return t}t.PrivateKeySize=32,t.clearEncode=async function(e,t){let r=new Uint8Array([0]);r=function(e,t){const r=d(t);let n=new Uint8Array(4);return new DataView(n.buffer).setUint32(0,t.length,!0),n=n.slice(0,r),(e=(0,a.concat)([e,n]))[0]|=r,e}(r,e),r=(0,a.concat)([r,e]);let n=1+d(e)+e.length;t&&(n+=65);const i=256-n%256,s=(0,c.randomBytes)(i);if(!function(e,t){if(e.length!==t)return!1;return t<=3||-1!==e.findIndex((e=>0!==e))}(s,i))throw new Error("failed to generate random padding of size "+i);let u;if(r=(0,a.concat)([r,s]),t){r[0]|=4;const e=(0,c.keccak256)(r),n=await(0,c.sign)(e,t);r=(0,a.concat)([r,n]),u={signature:n,publicKey:o.getPublicKey(t,!1)}}return{payload:r,sig:u}},t.clearDecode=function(e){const t=function(e){return 3&new DataView(e.buffer).getUint8(0)}(e);if(0===t)return;const r=function(e,t){let r=e.slice(1,1+t);t<4&&(r=(0,a.concat)([r,new Uint8Array(4-t)],4));return new DataView(r.buffer).getInt32(0,!0)}(e,t),n=1+t,i=e.slice(n,n+r),s=function(e){return 4==(4&new DataView(e.buffer).getUint8(0))}(e);let u;if(s){const t=function(e){return e.slice(e.length-65,e.length)}(e),r=function(e,t){if(t)return(0,c.keccak256)(e.slice(0,e.length-65));return(0,c.keccak256)(e)}(e,s),n=function(e,t){const r=new DataView(t.slice(64).buffer).getUint8(0),n=o.Signature.fromCompact(t.slice(0,64));return o.recoverPublicKey(e,n,r,!1)}(r,t);u={signature:t,publicKey:n}}return{payload:i,sig:u}},t.encryptAsymmetric=async function(e,t){return l.encrypt((0,u.hexToBytes)(t),e)},t.decryptAsymmetric=async function(e,t){return l.decrypt(t,e)},t.encryptSymmetric=async function(e,t){const r=h.generateIv(),n=await h.encrypt(r,(0,u.hexToBytes)(t),e);return(0,a.concat)([n,r])},t.decryptSymmetric=async function(e,t){const r=e.length-h.IvSize,n=e.slice(0,r),i=e.slice(r);return h.decrypt(i,(0,u.hexToBytes)(t),n)}},21923:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RelayMaxIHaveLength=t.RelayOpportunisticGraftPeers=t.RelayOpportunisticGraftTicks=t.RelayFanoutTTL=t.RelayPruneBackoff=t.RelayPrunePeers=t.RelayHeartbeatInterval=t.RelayHeartbeatInitialDelay=t.RelayGossipFactor=t.RelayPingContentTopic=t.RelayCodecs=t.minute=t.second=void 0,t.second=1e3,t.minute=60*t.second,t.RelayCodecs=["/vac/waku/relay/2.0.0-beta2","/vac/waku/relay/2.0.0"],t.RelayPingContentTopic="/relay-ping/1/ping/null",t.RelayGossipFactor=.25,t.RelayHeartbeatInitialDelay=100,t.RelayHeartbeatInterval=t.second,t.RelayPrunePeers=16,t.RelayPruneBackoff=t.minute,t.RelayFanoutTTL=t.minute,t.RelayOpportunisticGraftTicks=60,t.RelayOpportunisticGraftPeers=2,t.RelayMaxIHaveLength=5e3},65346:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getRelayPeers=void 0;const n=r(53357),i=r(45549);t.getRelayPeers=function(e,t,r){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:()=>!0;const o=e.topics.get(t);if(!o)return new Set;let a=[];return o.forEach((t=>{const r=e.peers.get(t);r&&i.RelayCodecs.includes(r.protocol)&&s(t)&&a.push(t)})),a=(0,n.shuffle)(a),r>0&&a.length>r&&(a=a.slice(0,r)),new Set(a)}},45549: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}),s=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},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.WakuRelay=t.RelayCodecs=void 0;const a=o(r(18392)),c=o(r(37976)),u=r(53357),l=r(83983),h=o(r(90190)),d=r(58928),f=r(5151),p=r(31195),y=s(r(21923)),g=r(21923);Object.defineProperty(t,"RelayCodecs",{enumerable:!0,get:function(){return g.RelayCodecs}});const m=r(65346),v=r(23274),b=(0,a.default)("waku:relay");class w extends c.default{constructor(e,t){var r;super(e,Object.assign(t,{globalSignaturePolicy:l.SignaturePolicy.StrictNoSign})),this.heartbeat=new v.RelayHeartbeat(this),this.observers={},this.decryptionKeys=new Map;const n=y.RelayCodecs;Object.assign(this,{multicodecs:n}),this.pubSubTopic=(null===t||void 0===t?void 0:t.pubSubTopic)||f.DefaultPubSubTopic,null===t||void 0===t||null===(r=t.decryptionKeys)||void 0===r||r.forEach((e=>{this.addDecryptionKey(e)}))}async start(){await super.start(),this.subscribe(this.pubSubTopic)}async send(e){const t=e.encode();await super.publish(this.pubSubTopic,t)}addDecryptionKey(e,t){this.decryptionKeys.set((0,d.hexToBytes)(e),null!==t&&void 0!==t?t:{})}deleteDecryptionKey(e){this.decryptionKeys.delete((0,d.hexToBytes)(e))}addObserver(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];0===t.length?(this.observers[""]||(this.observers[""]=new Set),this.observers[""].add(e)):t.forEach((t=>{this.observers[t]||(this.observers[t]=new Set),this.observers[t].add(e)}))}deleteObserver(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];0===t.length?this.observers[""]&&this.observers[""].delete(e):t.forEach((t=>{this.observers[t]&&this.observers[t].delete(e)}))}getPeers(){return(0,m.getRelayPeers)(this,this.pubSubTopic,this._options.D,(e=>this.score.score(e)>=this._options.scoreThresholds.publishThreshold))}subscribe(e){this.on(e,(t=>{const r=Array.from(this.decryptionKeys).map((e=>{let[t,{method:r,contentTopics:n}]=e;return{key:t,method:r,contentTopics:n}}));b("Message received on ".concat(e)),p.WakuMessage.decode(t.data,r).then((e=>{e?(this.observers[""]&&this.observers[""].forEach((t=>{t(e)})),e.contentTopic&&this.observers[e.contentTopic]&&this.observers[e.contentTopic].forEach((t=>{t(e)}))):b("Failed to decode Waku Message")})).catch((e=>{b("Failed to decode Waku Message",e)}))})),super.subscribe(e)}join(e){var t;if(!this.started)throw new Error("WakuRelayPubSub has not started");const r=this.fanout.get(e);if(r)r.forEach((e=>{this.score.score(e)<0&&r.delete(e)})),r.size<this._options.D&&(0,m.getRelayPeers)(this,e,this._options.D-r.size,(e=>!r.has(e)&&!this.direct.has(e)&&this.score.score(e)>=0)).forEach((e=>r.add(e))),this.mesh.set(e,r),this.fanout.delete(e),this.lastpub.delete(e);else{const t=(0,m.getRelayPeers)(this,e,this._options.D,(e=>!this.direct.has(e)&&this.score.score(e)>=0));this.mesh.set(e,t)}null===(t=this.mesh.get(e))||void 0===t||t.forEach((t=>{this.log("JOIN: Add mesh link to %s in %s",t,e),this._sendGraft(t,e)}))}async _publish(e){const t=await this.getCanonicalMsgIdStr(e);e.receivedFrom!==this.peerId.toB58String()&&(this.score.deliverMessage(e,t),this.gossipTracer.deliverMessage(t)),this.seenCache.put(t),this.messageCache.put(e,t);const r=new Set;e.topicIDs.forEach((e=>{var t;if(!this.topics.get(e))return;this.direct.forEach((e=>{r.add(e)}));let n=this.mesh.get(e);if(!n||!n.size){if(n=this.fanout.get(e),!n){const t=(0,m.getRelayPeers)(this,e,this._options.D,(e=>this.score.score(e)>=this._options.scoreThresholds.publishThreshold));t.size>0?(n=t,this.fanout.set(e,t)):n=new Set}this.lastpub.set(e,this._now())}null===(t=n)||void 0===t||t.forEach((e=>{r.add(e)}))}));const n=(0,u.createGossipRpc)([c.default.utils.normalizeOutRpcMessage(e)]);b("Relay message to ".concat(r.size," peers")),r.forEach((t=>{t!==e.from&&(b("Relay message to",t),this._sendRpc(t,n))}))}_emitGossip(e,t){const r=this.messageCache.getGossipIDs(e);if(!r.length)return;(0,u.shuffle)(r),r.length>y.RelayMaxIHaveLength&&this.log("too many messages for gossip; will truncate IHAVE list (%d messages)",r.length);const n=[],i=this.topics.get(e);if(!i)return;i.forEach((e=>{const r=this.peers.get(e);r&&!t.has(e)&&!this.direct.has(e)&&y.RelayCodecs.includes(r.protocol)&&this.score.score(e)>=this._options.scoreThresholds.gossipThreshold&&n.push(e)}));let s=this._options.Dlazy;const o=y.RelayGossipFactor*n.length;o>s&&(s=o),s>n.length?s=n.length:(0,u.shuffle)(n),n.slice(0,s).forEach((t=>{let n=r;r.length>y.RelayMaxIHaveLength&&(n=(0,u.shuffle)(n.slice()).slice(0,y.RelayMaxIHaveLength)),this._pushGossip(t,{topicID:e,messageIDs:n})}))}async _makePrune(e,t,r){const n=y.RelayPruneBackoff/1e3;if(!r)return{topicID:t,peers:[],backoff:n};const i=(0,m.getRelayPeers)(this,t,y.RelayPrunePeers,(t=>t!==e&&this.score.score(t)>=0));return{topicID:t,peers:await Promise.all(Array.from(i).map((async e=>{const t=h.default.createFromB58String(e);return{peerID:t.toBytes(),signedPeerRecord:await this._libp2p.peerStore.addressBook.getRawEnvelope(t)}}))),backoff:n}}}t.WakuRelay=w},23274: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}),s=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.RelayHeartbeat=void 0;const o=r(93234),a=r(53357),c=s(r(21923)),u=r(65346);class l extends o.Heartbeat{constructor(e){super(e)}start(){if(this._heartbeatTimer)return;const e=this._heartbeat.bind(this),t=setTimeout((()=>{var t;e(),null===(t=this._heartbeatTimer)||void 0===t||t.runPeriodically(e,c.RelayHeartbeatInterval)}),c.RelayHeartbeatInitialDelay);this._heartbeatTimer={_intervalId:void 0,runPeriodically:(e,t)=>{this._heartbeatTimer._intervalId=setInterval(e,t)},cancel:()=>{var e;clearTimeout(t),clearInterval(null===(e=this._heartbeatTimer)||void 0===e?void 0:e._intervalId)}}}stop(){this._heartbeatTimer&&(this._heartbeatTimer.cancel(),this._heartbeatTimer=null)}_heartbeat(){const{D:e,Dlo:t,Dhi:r,Dscore:n,Dout:i}=this.gossipsub._options;this.gossipsub.heartbeatTicks++;const s=new Map,o=e=>{let t=s.get(e);return void 0===t&&(t=this.gossipsub.score.score(e),s.set(e,t)),t},l=new Map,h=new Map,d=new Map;this.gossipsub._clearBackoff(),this.gossipsub.peerhave.clear(),this.gossipsub.iasked.clear(),this.gossipsub._applyIwantPenalties(),this.gossipsub._directConnect(),this.gossipsub.mesh.forEach(((s,f)=>{const p=e=>{this.gossipsub.log("HEARTBEAT: Remove mesh link to %s in %s",e,f),this.gossipsub.score.prune(e,f),this.gossipsub._addBackoff(e,f),s.delete(e);const t=h.get(e);t?t.push(f):h.set(e,[f])},y=e=>{this.gossipsub.log("HEARTBEAT: Add mesh link to %s in %s",e,f),this.gossipsub.score.graft(e,f),s.add(e);const t=l.get(e);t?t.push(f):l.set(e,[f])};if(s.forEach((e=>{const t=o(e);t<0&&(this.gossipsub.log("HEARTBEAT: Prune peer %s with negative score: score=%d, topic=%s",e,t,f),p(e),d.set(e,!0))})),s.size<t){const t=this.gossipsub.backoff.get(f),r=e-s.size;(0,u.getRelayPeers)(this.gossipsub,f,r,(e=>!s.has(e)&&!this.gossipsub.direct.has(e)&&(!t||!t.has(e))&&o(e)>=0)).forEach(y)}if(s.size>r){let t=Array.from(s);t.sort(((e,t)=>o(t)-o(e))),t=t.slice(0,n).concat((0,a.shuffle)(t.slice(n)));let r=0;if(t.slice(0,e).forEach((e=>{this.gossipsub.outbound.get(e)&&r++})),r<i){const n=e=>{const r=t[e];for(let n=e;n>0;n--)t[n]=t[n-1];t[0]=r};if(r>0){let i=r;for(let r=1;r<e&&i>0;r++)this.gossipsub.outbound.get(t[r])&&(n(r),i--)}let i=e-r;for(let r=e;r<t.length&&i>0;r++)this.gossipsub.outbound.get(t[r])&&(n(r),i--)}t.slice(e).forEach(p)}if(s.size>=t){let e=0;if(s.forEach((t=>{this.gossipsub.outbound.get(t)&&e++})),e<i){const t=i-e,r=this.gossipsub.backoff.get(f);(0,u.getRelayPeers)(this.gossipsub,f,t,(e=>!s.has(e)&&!this.gossipsub.direct.has(e)&&(!r||!r.has(e))&&o(e)>=0)).forEach(y)}}if(this.gossipsub.heartbeatTicks%c.RelayOpportunisticGraftTicks===0&&s.size>1){const e=Array.from(s).sort(((e,t)=>o(e)-o(t))),t=Math.floor(s.size/2),r=o(e[t]);if(r<this.gossipsub._options.scoreThresholds.opportunisticGraftThreshold){const e=this.gossipsub.backoff.get(f);(0,u.getRelayPeers)(this.gossipsub,f,c.RelayOpportunisticGraftPeers,(t=>s.has(t)&&!this.gossipsub.direct.has(t)&&(!e||!e.has(t))&&o(t)>r)).forEach((e=>{this.gossipsub.log("HEARTBEAT: Opportunistically graft peer %s on topic %s",e,f),y(e)}))}}this.gossipsub._emitGossip(f,s)}));const f=this.gossipsub._now();this.gossipsub.lastpub.forEach(((e,t)=>{e+c.RelayFanoutTTL<f&&(this.gossipsub.fanout.delete(t),this.gossipsub.lastpub.delete(t))})),this.gossipsub.fanout.forEach(((t,r)=>{const n=this.gossipsub.topics.get(r);if(t.forEach((e=>{(null===n||void 0===n||!n.has(e)||o(e)<this.gossipsub._options.scoreThresholds.publishThreshold)&&t.delete(e)})),t.size<e){const n=e-t.size;(0,u.getRelayPeers)(this.gossipsub,r,n,(e=>!t.has(e)&&!this.gossipsub.direct.has(e)&&o(e)>=this.gossipsub._options.scoreThresholds.publishThreshold)).forEach((e=>{t.add(e)}))}this.gossipsub._emitGossip(r,t)})),this.gossipsub._sendGraftPrune(l,h,d),this.gossipsub._flush(),this.gossipsub.messageCache.shift(),this.gossipsub.emit("gossipsub:heartbeat")}}t.RelayHeartbeat=l},47954: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}),s=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},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.HistoryRPC=t.PageDirection=void 0;const a=o(r(18987)),c=r(80886),u=r(75658),l=s(r(63953)),h=s(r(39938)),d=r(93539);var f;!function(e){e.BACKWARD="backward",e.FORWARD="forward"}(f=t.PageDirection||(t.PageDirection={}));class p{constructor(e,t){switch(this.proto=e,this.storeCodec=t,t){case d.StoreCodecs.V2Beta3:this.protoCodec=l;break;case d.StoreCodecs.V2Beta4:this.protoCodec=h;break;default:throw"Internal Error: Unexpected store codec value received in constructor: ".concat(t)}}get query(){return this.proto.query}get response(){return this.proto.response}static createQuery(e){var t;const r=null!==(t=e.storeCodec)&&void 0!==t?t:d.StoreCodecs.V2Beta4,n=e.contentTopics.map((e=>({contentTopic:e}))),i=function(e){switch(e){case f.BACKWARD:return h.PagingInfo_Direction.DIRECTION_BACKWARD_UNSPECIFIED;case f.FORWARD:return h.PagingInfo_Direction.DIRECTION_FORWARD;default:return h.PagingInfo_Direction.DIRECTION_BACKWARD_UNSPECIFIED}}(e.pageDirection);switch(r){case d.StoreCodecs.V2Beta3:return(()=>{const t={pageSize:a.default.fromNumber(e.pageSize),cursor:e.cursor,direction:i};let s,o;return e.startTime&&(s=e.startTime.valueOf()/1e3),e.endTime&&(o=e.endTime.valueOf()/1e3),new p({requestId:(0,u.v4)(),query:{pubSubTopic:e.pubSubTopic,contentFilters:n,pagingInfo:t,startTime:s,endTime:o},response:void 0},r)})();case d.StoreCodecs.V2Beta4:return(()=>{const t={pageSize:a.default.fromNumber(e.pageSize),cursor:e.cursor,direction:i};let s,o;return e.startTime&&(s=a.default.fromNumber(e.startTime.valueOf()).mul(1e6)),e.endTime&&(o=a.default.fromNumber(e.endTime.valueOf()).mul(1e6)),new p({requestId:(0,u.v4)(),query:{pubSubTopic:e.pubSubTopic,contentFilters:n,pagingInfo:t,startTime:s,endTime:o},response:void 0},r)})();default:throw"Internal Error: Unexpected store codec value received in createQuery: ".concat(r)}}decode(e){const t=this.protoCodec.HistoryRPC.decode(c.Reader.create(e));return new p(t,this.storeCodec)}encode(){return this.protoCodec.HistoryRPC.encode(this.proto).finish()}}t.HistoryRPC=p},93539: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.WakuStore=t.PageDirection=t.DefaultPageSize=t.StoreCodecs=void 0;const i=n(r(18392)),s=n(r(72934)),o=n(r(44709)),a=r(79023),c=r(19370),u=r(58928),l=r(5151),h=r(31195),d=r(47954);Object.defineProperty(t,"PageDirection",{enumerable:!0,get:function(){return d.PageDirection}});const f=(0,i.default)("waku:store");var p;!function(e){e.V2Beta3="/vac/waku/store/2.0.0-beta3",e.V2Beta4="/vac/waku/store/2.0.0-beta4"}(p=t.StoreCodecs||(t.StoreCodecs={})),t.DefaultPageSize=10;t.WakuStore=class{constructor(e,t){this.libp2p=e,null!==t&&void 0!==t&&t.pubSubTopic?this.pubSubTopic=t.pubSubTopic:this.pubSubTopic=l.DefaultPubSubTopic,this.decryptionKeys=new Map}async queryHistory(e,r){var n;let i,c;null!==r&&void 0!==r&&r.timeFilter&&(i=r.timeFilter.startTime,c=r.timeFilter.endTime);const l=Object.assign({pubSubTopic:this.pubSubTopic,pageDirection:d.PageDirection.BACKWARD,pageSize:t.DefaultPageSize},r,{contentTopics:e,startTime:i,endTime:c});let y;if(f("Querying history with the following options",{peerId:null===r||void 0===r||null===(n=r.peerId)||void 0===n?void 0:n.toB58String(),...r}),l.peerId){if(y=await this.libp2p.peerStore.get(l.peerId),!y)throw"Failed to retrieve connection details for provided peer in peer store: ".concat(l.peerId.toB58String())}else if(y=await this.randomPeer,!y)throw"Failed to find known peer that registers waku store protocol";let g="";for(const t of Object.values(p))y.protocols.includes(t)&&(g=t);if(f("Use store codec ".concat(g)),!g)throw"Peer does not register waku store protocol: ".concat(y.id.toB58String());Object.assign(l,{storeCodec:g});const m=this.libp2p.connectionManager.get(y.id);if(!m)throw"Failed to get a connection to the peer";const v=Array.from(this.decryptionKeys).map((e=>{let[t,{method:r,contentTopics:n}]=e;return{key:t,method:r,contentTopics:n}}));l.decryptionKeys&&l.decryptionKeys.forEach((t=>{v.push({key:(0,u.hexToBytes)(t),contentTopics:e.length?e:void 0,method:void 0})}));const b=[];let w;for(;;){var E,S,_,I;const{stream:e}=await m.newStream(g),t=Object.assign(l,{cursor:w}),r=d.HistoryRPC.createQuery(t);f("Querying store peer",m.remoteAddr.toString());const n=await(0,a.pipe)([r.encode()],o.default.encode(),e,o.default.decode(),s.default),i=r.decode(n.slice()).response;if(!i)throw"History response misses response field";if(i.error)throw"History response contains an Error"+i.error;if(!i.messages||!i.messages.length)return console.log("No messages present in HistoryRPC response"),b;f("".concat(i.messages.length," messages retrieved for pubsub topic ").concat(l.pubSubTopic));const c=[];await Promise.all(i.messages.map((async e=>{const t=await h.WakuMessage.decodeProto(e,v);t&&(b.push(t),c.push(t))})));let u=!1;l.callback&&(u=Boolean(l.callback(c)));const p=null===(E=i.pagingInfo)||void 0===E?void 0:E.pageSize,y=null===(S=r.query)||void 0===S||null===(_=S.pagingInfo)||void 0===_?void 0:_.pageSize;if(u||p&&y&&p<y)return b;if(w=null===(I=i.pagingInfo)||void 0===I?void 0:I.cursor,void 0===w)return console.log("No cursor returned by peer."),b}}addDecryptionKey(e,t){this.decryptionKeys.set((0,u.hexToBytes)(e),null!==t&&void 0!==t?t:{})}deleteDecryptionKey(e){this.decryptionKeys.delete((0,u.hexToBytes)(e))}get peers(){const e=[];for(const t of Object.values(p))e.push(t);return(0,c.getPeersForProtocol)(this.libp2p,e)}get randomPeer(){return(0,c.selectRandomPeer)(this.peers)}}},82176: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.FilterRPC=t.MessagePush=t.FilterRequest_ContentFilter=t.FilterRequest=t.protobufPackage=void 0;const i=n(r(18987)),s=n(r(80886)),o=r(52494);function a(e){return null!==e&&void 0!==e}t.protobufPackage="waku.v2",t.FilterRequest={encode(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s.default.Writer.create();!0===e.subscribe&&r.uint32(8).bool(e.subscribe),""!==e.topic&&r.uint32(18).string(e.topic);for(const n of e.contentFilters)t.FilterRequest_ContentFilter.encode(n,r.uint32(26).fork()).ldelim();return r},decode(e,r){const n=e instanceof s.default.Reader?e:new s.default.Reader(e);let i=void 0===r?n.len:n.pos+r;const o={subscribe:!1,topic:"",contentFilters:[]};for(;n.pos<i;){const e=n.uint32();switch(e>>>3){case 1:o.subscribe=n.bool();break;case 2:o.topic=n.string();break;case 3:o.contentFilters.push(t.FilterRequest_ContentFilter.decode(n,n.uint32()));break;default:n.skipType(7&e)}}return o},fromJSON:e=>({subscribe:!!a(e.subscribe)&&Boolean(e.subscribe),topic:a(e.topic)?String(e.topic):"",contentFilters:Array.isArray(null===e||void 0===e?void 0:e.contentFilters)?e.contentFilters.map((e=>t.FilterRequest_ContentFilter.fromJSON(e))):[]}),toJSON(e){const r={};return void 0!==e.subscribe&&(r.subscribe=e.subscribe),void 0!==e.topic&&(r.topic=e.topic),e.contentFilters?r.contentFilters=e.contentFilters.map((e=>e?t.FilterRequest_ContentFilter.toJSON(e):void 0)):r.contentFilters=[],r},fromPartial(e){var r,n,i;const s={subscribe:!1,topic:"",contentFilters:[]};return s.subscribe=null!==(r=e.subscribe)&&void 0!==r&&r,s.topic=null!==(n=e.topic)&&void 0!==n?n:"",s.contentFilters=(null===(i=e.contentFilters)||void 0===i?void 0:i.map((e=>t.FilterRequest_ContentFilter.fromPartial(e))))||[],s}},t.FilterRequest_ContentFilter={encode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s.default.Writer.create();return""!==e.contentTopic&&t.uint32(10).string(e.contentTopic),t},decode(e,t){const r=e instanceof s.default.Reader?e:new s.default.Reader(e);let n=void 0===t?r.len:r.pos+t;const i={contentTopic:""};for(;r.pos<n;){const e=r.uint32();if(e>>>3===1)i.contentTopic=r.string();else r.skipType(7&e)}return i},fromJSON:e=>({contentTopic:a(e.contentTopic)?String(e.contentTopic):""}),toJSON(e){const t={};return void 0!==e.contentTopic&&(t.contentTopic=e.contentTopic),t},fromPartial(e){var t;const r={contentTopic:""};return r.contentTopic=null!==(t=e.contentTopic)&&void 0!==t?t:"",r}},t.MessagePush={encode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s.default.Writer.create();for(const r of e.messages)o.WakuMessage.encode(r,t.uint32(10).fork()).ldelim();return t},decode(e,t){const r=e instanceof s.default.Reader?e:new s.default.Reader(e);let n=void 0===t?r.len:r.pos+t;const i={messages:[]};for(;r.pos<n;){const e=r.uint32();if(e>>>3===1)i.messages.push(o.WakuMessage.decode(r,r.uint32()));else r.skipType(7&e)}return i},fromJSON:e=>({messages:Array.isArray(null===e||void 0===e?void 0:e.messages)?e.messages.map((e=>o.WakuMessage.fromJSON(e))):[]}),toJSON(e){const t={};return e.messages?t.messages=e.messages.map((e=>e?o.WakuMessage.toJSON(e):void 0)):t.messages=[],t},fromPartial(e){var t;const r={messages:[]};return r.messages=(null===(t=e.messages)||void 0===t?void 0:t.map((e=>o.WakuMessage.fromPartial(e))))||[],r}},t.FilterRPC={encode(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s.default.Writer.create();return""!==e.requestId&&r.uint32(10).string(e.requestId),void 0!==e.request&&t.FilterRequest.encode(e.request,r.uint32(18).fork()).ldelim(),void 0!==e.push&&t.MessagePush.encode(e.push,r.uint32(26).fork()).ldelim(),r},decode(e,r){const n=e instanceof s.default.Reader?e:new s.default.Reader(e);let i=void 0===r?n.len:n.pos+r;const o={requestId:"",request:void 0,push:void 0};for(;n.pos<i;){const e=n.uint32();switch(e>>>3){case 1:o.requestId=n.string();break;case 2:o.request=t.FilterRequest.decode(n,n.uint32());break;case 3:o.push=t.MessagePush.decode(n,n.uint32());break;default:n.skipType(7&e)}}return o},fromJSON:e=>({requestId:a(e.requestId)?String(e.requestId):"",request:a(e.request)?t.FilterRequest.fromJSON(e.request):void 0,push:a(e.push)?t.MessagePush.fromJSON(e.push):void 0}),toJSON(e){const r={};return void 0!==e.requestId&&(r.requestId=e.requestId),void 0!==e.request&&(r.request=e.request?t.FilterRequest.toJSON(e.request):void 0),void 0!==e.push&&(r.push=e.push?t.MessagePush.toJSON(e.push):void 0),r},fromPartial(e){var r;const n={requestId:"",request:void 0,push:void 0};return n.requestId=null!==(r=e.requestId)&&void 0!==r?r:"",n.request=void 0!==e.request&&null!==e.request?t.FilterRequest.fromPartial(e.request):void 0,n.push=void 0!==e.push&&null!==e.push?t.MessagePush.fromPartial(e.push):void 0,n}},s.default.util.Long!==i.default&&(s.default.util.Long=i.default,s.default.configure())},63623: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.PushRPC=t.PushResponse=t.PushRequest=t.protobufPackage=void 0;const i=n(r(18987)),s=n(r(80886)),o=r(52494);function a(e){return null!==e&&void 0!==e}t.protobufPackage="waku.v2",t.PushRequest={encode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s.default.Writer.create();return""!==e.pubSubTopic&&t.uint32(10).string(e.pubSubTopic),void 0!==e.message&&o.WakuMessage.encode(e.message,t.uint32(18).fork()).ldelim(),t},decode(e,t){const r=e instanceof s.default.Reader?e:new s.default.Reader(e);let n=void 0===t?r.len:r.pos+t;const i={pubSubTopic:"",message:void 0};for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.pubSubTopic=r.string();break;case 2:i.message=o.WakuMessage.decode(r,r.uint32());break;default:r.skipType(7&e)}}return i},fromJSON:e=>({pubSubTopic:a(e.pubSubTopic)?String(e.pubSubTopic):"",message:a(e.message)?o.WakuMessage.fromJSON(e.message):void 0}),toJSON(e){const t={};return void 0!==e.pubSubTopic&&(t.pubSubTopic=e.pubSubTopic),void 0!==e.message&&(t.message=e.message?o.WakuMessage.toJSON(e.message):void 0),t},fromPartial(e){var t;const r={pubSubTopic:"",message:void 0};return r.pubSubTopic=null!==(t=e.pubSubTopic)&&void 0!==t?t:"",r.message=void 0!==e.message&&null!==e.message?o.WakuMessage.fromPartial(e.message):void 0,r}},t.PushResponse={encode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s.default.Writer.create();return!0===e.isSuccess&&t.uint32(8).bool(e.isSuccess),""!==e.info&&t.uint32(18).string(e.info),t},decode(e,t){const r=e instanceof s.default.Reader?e:new s.default.Reader(e);let n=void 0===t?r.len:r.pos+t;const i={isSuccess:!1,info:""};for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.isSuccess=r.bool();break;case 2:i.info=r.string();break;default:r.skipType(7&e)}}return i},fromJSON:e=>({isSuccess:!!a(e.isSuccess)&&Boolean(e.isSuccess),info:a(e.info)?String(e.info):""}),toJSON(e){const t={};return void 0!==e.isSuccess&&(t.isSuccess=e.isSuccess),void 0!==e.info&&(t.info=e.info),t},fromPartial(e){var t,r;const n={isSuccess:!1,info:""};return n.isSuccess=null!==(t=e.isSuccess)&&void 0!==t&&t,n.info=null!==(r=e.info)&&void 0!==r?r:"",n}},t.PushRPC={encode(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s.default.Writer.create();return""!==e.requestId&&r.uint32(10).string(e.requestId),void 0!==e.request&&t.PushRequest.encode(e.request,r.uint32(18).fork()).ldelim(),void 0!==e.response&&t.PushResponse.encode(e.response,r.uint32(26).fork()).ldelim(),r},decode(e,r){const n=e instanceof s.default.Reader?e:new s.default.Reader(e);let i=void 0===r?n.len:n.pos+r;const o={requestId:"",request:void 0,response:void 0};for(;n.pos<i;){const e=n.uint32();switch(e>>>3){case 1:o.requestId=n.string();break;case 2:o.request=t.PushRequest.decode(n,n.uint32());break;case 3:o.response=t.PushResponse.decode(n,n.uint32());break;default:n.skipType(7&e)}}return o},fromJSON:e=>({requestId:a(e.requestId)?String(e.requestId):"",request:a(e.request)?t.PushRequest.fromJSON(e.request):void 0,response:a(e.response)?t.PushResponse.fromJSON(e.response):void 0}),toJSON(e){const r={};return void 0!==e.requestId&&(r.requestId=e.requestId),void 0!==e.request&&(r.request=e.request?t.PushRequest.toJSON(e.request):void 0),void 0!==e.response&&(r.response=e.response?t.PushResponse.toJSON(e.response):void 0),r},fromPartial(e){var r;const n={requestId:"",request:void 0,response:void 0};return n.requestId=null!==(r=e.requestId)&&void 0!==r?r:"",n.request=void 0!==e.request&&null!==e.request?t.PushRequest.fromPartial(e.request):void 0,n.response=void 0!==e.response&&null!==e.response?t.PushResponse.fromPartial(e.response):void 0,n}},s.default.util.Long!==i.default&&(s.default.util.Long=i.default,s.default.configure())},52494: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.WakuMessage=t.protobufPackage=void 0;const i=n(r(18987)),s=n(r(80886));t.protobufPackage="waku.v2",t.WakuMessage={encode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s.default.Writer.create();return void 0!==e.payload&&t.uint32(10).bytes(e.payload),void 0!==e.contentTopic&&t.uint32(18).string(e.contentTopic),void 0!==e.version&&t.uint32(24).uint32(e.version),void 0!==e.timestampDeprecated&&t.uint32(33).double(e.timestampDeprecated),void 0!==e.timestamp&&t.uint32(80).sint64(e.timestamp),t},decode(e,t){const r=e instanceof s.default.Reader?e:new s.default.Reader(e);let n=void 0===t?r.len:r.pos+t;const i={payload:void 0,contentTopic:void 0,version:void 0,timestampDeprecated:void 0,timestamp:void 0};for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.payload=r.bytes();break;case 2:i.contentTopic=r.string();break;case 3:i.version=r.uint32();break;case 4:i.timestampDeprecated=r.double();break;case 10:i.timestamp=r.sint64();break;default:r.skipType(7&e)}}return i},fromJSON:e=>({payload:l(e.payload)?c(e.payload):void 0,contentTopic:l(e.contentTopic)?String(e.contentTopic):void 0,version:l(e.version)?Number(e.version):void 0,timestampDeprecated:l(e.timestampDeprecated)?Number(e.timestampDeprecated):void 0,timestamp:l(e.timestamp)?i.default.fromString(e.timestamp):void 0}),toJSON(e){const t={};return void 0!==e.payload&&(t.payload=void 0!==e.payload?function(e){const t=[];for(const r of e)t.push(String.fromCharCode(r));return u(t.join(""))}(e.payload):void 0),void 0!==e.contentTopic&&(t.contentTopic=e.contentTopic),void 0!==e.version&&(t.version=Math.round(e.version)),void 0!==e.timestampDeprecated&&(t.timestampDeprecated=e.timestampDeprecated),void 0!==e.timestamp&&(t.timestamp=(e.timestamp||void 0).toString()),t},fromPartial(e){var t,r,n,s;const o={payload:void 0,contentTopic:void 0,version:void 0,timestampDeprecated:void 0,timestamp:void 0};return o.payload=null!==(t=e.payload)&&void 0!==t?t:void 0,o.contentTopic=null!==(r=e.contentTopic)&&void 0!==r?r:void 0,o.version=null!==(n=e.version)&&void 0!==n?n:void 0,o.timestampDeprecated=null!==(s=e.timestampDeprecated)&&void 0!==s?s:void 0,o.timestamp=void 0!==e.timestamp&&null!==e.timestamp?i.default.fromValue(e.timestamp):void 0,o}};var o=(()=>{if("undefined"!==typeof o)return o;if("undefined"!==typeof self)return self;if("undefined"!==typeof window)return window;if("undefined"!==typeof r.g)return r.g;throw"Unable to locate global object"})();const a=o.atob||(e=>o.Buffer.from(e,"base64").toString("binary"));function c(e){const t=a(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;++n)r[n]=t.charCodeAt(n);return r}const u=o.btoa||(e=>o.Buffer.from(e,"binary").toString("base64"));function l(e){return null!==e&&void 0!==e}s.default.util.Long!==i.default&&(s.default.util.Long=i.default,s.default.configure())},63953: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.HistoryRPC=t.HistoryResponse=t.HistoryQuery=t.ContentFilter=t.PagingInfo=t.Index=t.historyResponse_ErrorToJSON=t.historyResponse_ErrorFromJSON=t.HistoryResponse_Error=t.pagingInfo_DirectionToJSON=t.pagingInfo_DirectionFromJSON=t.PagingInfo_Direction=t.protobufPackage=void 0;const i=n(r(18987)),s=n(r(80886)),o=r(52494);var a,c;function u(e){switch(e){case 0:case"DIRECTION_BACKWARD_UNSPECIFIED":return a.DIRECTION_BACKWARD_UNSPECIFIED;case 1:case"DIRECTION_FORWARD":return a.DIRECTION_FORWARD;default:return a.UNRECOGNIZED}}function l(e){switch(e){case a.DIRECTION_BACKWARD_UNSPECIFIED:return"DIRECTION_BACKWARD_UNSPECIFIED";case a.DIRECTION_FORWARD:return"DIRECTION_FORWARD";default:return"UNKNOWN"}}function h(e){switch(e){case 0:case"ERROR_NONE_UNSPECIFIED":return c.ERROR_NONE_UNSPECIFIED;case 1:case"ERROR_INVALID_CURSOR":return c.ERROR_INVALID_CURSOR;default:return c.UNRECOGNIZED}}function d(e){switch(e){case c.ERROR_NONE_UNSPECIFIED:return"ERROR_NONE_UNSPECIFIED";case c.ERROR_INVALID_CURSOR:return"ERROR_INVALID_CURSOR";default:return"UNKNOWN"}}function f(){return{digest:new Uint8Array,receivedTime:0,senderTime:0}}function p(){return{pageSize:i.default.UZERO,cursor:void 0,direction:0}}t.protobufPackage="waku.v2.store.v2beta3",function(e){e[e.DIRECTION_BACKWARD_UNSPECIFIED=0]="DIRECTION_BACKWARD_UNSPECIFIED",e[e.DIRECTION_FORWARD=1]="DIRECTION_FORWARD",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"}(a=t.PagingInfo_Direction||(t.PagingInfo_Direction={})),t.pagingInfo_DirectionFromJSON=u,t.pagingInfo_DirectionToJSON=l,function(e){e[e.ERROR_NONE_UNSPECIFIED=0]="ERROR_NONE_UNSPECIFIED",e[e.ERROR_INVALID_CURSOR=1]="ERROR_INVALID_CURSOR",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"}(c=t.HistoryResponse_Error||(t.HistoryResponse_Error={})),t.historyResponse_ErrorFromJSON=h,t.historyResponse_ErrorToJSON=d,t.Index={encode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s.default.Writer.create();return 0!==e.digest.length&&t.uint32(10).bytes(e.digest),0!==e.receivedTime&&t.uint32(17).double(e.receivedTime),0!==e.senderTime&&t.uint32(25).double(e.senderTime),t},decode(e,t){const r=e instanceof s.default.Reader?e:new s.default.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=f();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.digest=r.bytes();break;case 2:i.receivedTime=r.double();break;case 3:i.senderTime=r.double();break;default:r.skipType(7&e)}}return i},fromJSON:e=>({digest:b(e.digest)?m(e.digest):new Uint8Array,receivedTime:b(e.receivedTime)?Number(e.receivedTime):0,senderTime:b(e.senderTime)?Number(e.senderTime):0}),toJSON(e){const t={};return void 0!==e.digest&&(t.digest=function(e){const t=[];for(const r of e)t.push(String.fromCharCode(r));return v(t.join(""))}(void 0!==e.digest?e.digest:new Uint8Array)),void 0!==e.receivedTime&&(t.receivedTime=e.receivedTime),void 0!==e.senderTime&&(t.senderTime=e.senderTime),t},fromPartial(e){var t,r,n;const i=f();return i.digest=null!==(t=e.digest)&&void 0!==t?t:new Uint8Array,i.receivedTime=null!==(r=e.receivedTime)&&void 0!==r?r:0,i.senderTime=null!==(n=e.senderTime)&&void 0!==n?n:0,i}},t.PagingInfo={encode(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s.default.Writer.create();return e.pageSize.isZero()||r.uint32(8).uint64(e.pageSize),void 0!==e.cursor&&t.Index.encode(e.cursor,r.uint32(18).fork()).ldelim(),0!==e.direction&&r.uint32(24).int32(e.direction),r},decode(e,r){const n=e instanceof s.default.Reader?e:new s.default.Reader(e);let i=void 0===r?n.len:n.pos+r;const o=p();for(;n.pos<i;){const e=n.uint32();switch(e>>>3){case 1:o.pageSize=n.uint64();break;case 2:o.cursor=t.Index.decode(n,n.uint32());break;case 3:o.direction=n.int32();break;default:n.skipType(7&e)}}return o},fromJSON:e=>({pageSize:b(e.pageSize)?i.default.fromString(e.pageSize):i.default.UZERO,cursor:b(e.cursor)?t.Index.fromJSON(e.cursor):void 0,direction:b(e.direction)?u(e.direction):0}),toJSON(e){const r={};return void 0!==e.pageSize&&(r.pageSize=(e.pageSize||i.default.UZERO).toString()),void 0!==e.cursor&&(r.cursor=e.cursor?t.Index.toJSON(e.cursor):void 0),void 0!==e.direction&&(r.direction=l(e.direction)),r},fromPartial(e){var r;const n=p();return n.pageSize=void 0!==e.pageSize&&null!==e.pageSize?i.default.fromValue(e.pageSize):i.default.UZERO,n.cursor=void 0!==e.cursor&&null!==e.cursor?t.Index.fromPartial(e.cursor):void 0,n.direction=null!==(r=e.direction)&&void 0!==r?r:0,n}},t.ContentFilter={encode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s.default.Writer.create();return""!==e.contentTopic&&t.uint32(10).string(e.contentTopic),t},decode(e,t){const r=e instanceof s.default.Reader?e:new s.default.Reader(e);let n=void 0===t?r.len:r.pos+t;const i={contentTopic:""};for(;r.pos<n;){const e=r.uint32();if(e>>>3===1)i.contentTopic=r.string();else r.skipType(7&e)}return i},fromJSON:e=>({contentTopic:b(e.contentTopic)?String(e.contentTopic):""}),toJSON(e){const t={};return void 0!==e.contentTopic&&(t.contentTopic=e.contentTopic),t},fromPartial(e){var t;const r={contentTopic:""};return r.contentTopic=null!==(t=e.contentTopic)&&void 0!==t?t:"",r}},t.HistoryQuery={encode(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s.default.Writer.create();void 0!==e.pubSubTopic&&r.uint32(18).string(e.pubSubTopic);for(const n of e.contentFilters)t.ContentFilter.encode(n,r.uint32(26).fork()).ldelim();return void 0!==e.pagingInfo&&t.PagingInfo.encode(e.pagingInfo,r.uint32(34).fork()).ldelim(),void 0!==e.startTime&&r.uint32(41).double(e.startTime),void 0!==e.endTime&&r.uint32(49).double(e.endTime),r},decode(e,r){const n=e instanceof s.default.Reader?e:new s.default.Reader(e);let i=void 0===r?n.len:n.pos+r;const o={pubSubTopic:void 0,contentFilters:[],pagingInfo:void 0,startTime:void 0,endTime:void 0};for(;n.pos<i;){const e=n.uint32();switch(e>>>3){case 2:o.pubSubTopic=n.string();break;case 3:o.contentFilters.push(t.ContentFilter.decode(n,n.uint32()));break;case 4:o.pagingInfo=t.PagingInfo.decode(n,n.uint32());break;case 5:o.startTime=n.double();break;case 6:o.endTime=n.double();break;default:n.skipType(7&e)}}return o},fromJSON:e=>({pubSubTopic:b(e.pubSubTopic)?String(e.pubSubTopic):void 0,contentFilters:Array.isArray(null===e||void 0===e?void 0:e.contentFilters)?e.contentFilters.map((e=>t.ContentFilter.fromJSON(e))):[],pagingInfo:b(e.pagingInfo)?t.PagingInfo.fromJSON(e.pagingInfo):void 0,startTime:b(e.startTime)?Number(e.startTime):void 0,endTime:b(e.endTime)?Number(e.endTime):void 0}),toJSON(e){const r={};return void 0!==e.pubSubTopic&&(r.pubSubTopic=e.pubSubTopic),e.contentFilters?r.contentFilters=e.contentFilters.map((e=>e?t.ContentFilter.toJSON(e):void 0)):r.contentFilters=[],void 0!==e.pagingInfo&&(r.pagingInfo=e.pagingInfo?t.PagingInfo.toJSON(e.pagingInfo):void 0),void 0!==e.startTime&&(r.startTime=e.startTime),void 0!==e.endTime&&(r.endTime=e.endTime),r},fromPartial(e){var r,n,i,s;const o={pubSubTopic:void 0,contentFilters:[],pagingInfo:void 0,startTime:void 0,endTime:void 0};return o.pubSubTopic=null!==(r=e.pubSubTopic)&&void 0!==r?r:void 0,o.contentFilters=(null===(n=e.contentFilters)||void 0===n?void 0:n.map((e=>t.ContentFilter.fromPartial(e))))||[],o.pagingInfo=void 0!==e.pagingInfo&&null!==e.pagingInfo?t.PagingInfo.fromPartial(e.pagingInfo):void 0,o.startTime=null!==(i=e.startTime)&&void 0!==i?i:void 0,o.endTime=null!==(s=e.endTime)&&void 0!==s?s:void 0,o}},t.HistoryResponse={encode(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s.default.Writer.create();for(const t of e.messages)o.WakuMessage.encode(t,r.uint32(18).fork()).ldelim();return void 0!==e.pagingInfo&&t.PagingInfo.encode(e.pagingInfo,r.uint32(26).fork()).ldelim(),0!==e.error&&r.uint32(32).int32(e.error),r},decode(e,r){const n=e instanceof s.default.Reader?e:new s.default.Reader(e);let i=void 0===r?n.len:n.pos+r;const a={messages:[],pagingInfo:void 0,error:0};for(;n.pos<i;){const e=n.uint32();switch(e>>>3){case 2:a.messages.push(o.WakuMessage.decode(n,n.uint32()));break;case 3:a.pagingInfo=t.PagingInfo.decode(n,n.uint32());break;case 4:a.error=n.int32();break;default:n.skipType(7&e)}}return a},fromJSON:e=>({messages:Array.isArray(null===e||void 0===e?void 0:e.messages)?e.messages.map((e=>o.WakuMessage.fromJSON(e))):[],pagingInfo:b(e.pagingInfo)?t.PagingInfo.fromJSON(e.pagingInfo):void 0,error:b(e.error)?h(e.error):0}),toJSON(e){const r={};return e.messages?r.messages=e.messages.map((e=>e?o.WakuMessage.toJSON(e):void 0)):r.messages=[],void 0!==e.pagingInfo&&(r.pagingInfo=e.pagingInfo?t.PagingInfo.toJSON(e.pagingInfo):void 0),void 0!==e.error&&(r.error=d(e.error)),r},fromPartial(e){var r,n;const i={messages:[],pagingInfo:void 0,error:0};return i.messages=(null===(r=e.messages)||void 0===r?void 0:r.map((e=>o.WakuMessage.fromPartial(e))))||[],i.pagingInfo=void 0!==e.pagingInfo&&null!==e.pagingInfo?t.PagingInfo.fromPartial(e.pagingInfo):void 0,i.error=null!==(n=e.error)&&void 0!==n?n:0,i}},t.HistoryRPC={encode(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s.default.Writer.create();return""!==e.requestId&&r.uint32(10).string(e.requestId),void 0!==e.query&&t.HistoryQuery.encode(e.query,r.uint32(18).fork()).ldelim(),void 0!==e.response&&t.HistoryResponse.encode(e.response,r.uint32(26).fork()).ldelim(),r},decode(e,r){const n=e instanceof s.default.Reader?e:new s.default.Reader(e);let i=void 0===r?n.len:n.pos+r;const o={requestId:"",query:void 0,response:void 0};for(;n.pos<i;){const e=n.uint32();switch(e>>>3){case 1:o.requestId=n.string();break;case 2:o.query=t.HistoryQuery.decode(n,n.uint32());break;case 3:o.response=t.HistoryResponse.decode(n,n.uint32());break;default:n.skipType(7&e)}}return o},fromJSON:e=>({requestId:b(e.requestId)?String(e.requestId):"",query:b(e.query)?t.HistoryQuery.fromJSON(e.query):void 0,response:b(e.response)?t.HistoryResponse.fromJSON(e.response):void 0}),toJSON(e){const r={};return void 0!==e.requestId&&(r.requestId=e.requestId),void 0!==e.query&&(r.query=e.query?t.HistoryQuery.toJSON(e.query):void 0),void 0!==e.response&&(r.response=e.response?t.HistoryResponse.toJSON(e.response):void 0),r},fromPartial(e){var r;const n={requestId:"",query:void 0,response:void 0};return n.requestId=null!==(r=e.requestId)&&void 0!==r?r:"",n.query=void 0!==e.query&&null!==e.query?t.HistoryQuery.fromPartial(e.query):void 0,n.response=void 0!==e.response&&null!==e.response?t.HistoryResponse.fromPartial(e.response):void 0,n}};var y=(()=>{if("undefined"!==typeof y)return y;if("undefined"!==typeof self)return self;if("undefined"!==typeof window)return window;if("undefined"!==typeof r.g)return r.g;throw"Unable to locate global object"})();const g=y.atob||(e=>y.Buffer.from(e,"base64").toString("binary"));function m(e){const t=g(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;++n)r[n]=t.charCodeAt(n);return r}const v=y.btoa||(e=>y.Buffer.from(e,"binary").toString("base64"));function b(e){return null!==e&&void 0!==e}s.default.util.Long!==i.default&&(s.default.util.Long=i.default,s.default.configure())},39938: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.HistoryRPC=t.HistoryResponse=t.HistoryQuery=t.ContentFilter=t.PagingInfo=t.Index=t.historyResponse_ErrorToJSON=t.historyResponse_ErrorFromJSON=t.HistoryResponse_Error=t.pagingInfo_DirectionToJSON=t.pagingInfo_DirectionFromJSON=t.PagingInfo_Direction=t.protobufPackage=void 0;const i=n(r(18987)),s=n(r(80886)),o=r(52494);var a,c;function u(e){switch(e){case 0:case"DIRECTION_BACKWARD_UNSPECIFIED":return a.DIRECTION_BACKWARD_UNSPECIFIED;case 1:case"DIRECTION_FORWARD":return a.DIRECTION_FORWARD;default:return a.UNRECOGNIZED}}function l(e){switch(e){case a.DIRECTION_BACKWARD_UNSPECIFIED:return"DIRECTION_BACKWARD_UNSPECIFIED";case a.DIRECTION_FORWARD:return"DIRECTION_FORWARD";default:return"UNKNOWN"}}function h(e){switch(e){case 0:case"ERROR_NONE_UNSPECIFIED":return c.ERROR_NONE_UNSPECIFIED;case 1:case"ERROR_INVALID_CURSOR":return c.ERROR_INVALID_CURSOR;default:return c.UNRECOGNIZED}}function d(e){switch(e){case c.ERROR_NONE_UNSPECIFIED:return"ERROR_NONE_UNSPECIFIED";case c.ERROR_INVALID_CURSOR:return"ERROR_INVALID_CURSOR";default:return"UNKNOWN"}}function f(){return{digest:new Uint8Array,receivedTime:i.default.ZERO,senderTime:i.default.ZERO,pubsubTopic:""}}function p(){return{pageSize:i.default.UZERO,cursor:void 0,direction:0}}t.protobufPackage="waku.v2.store.v2beta4",function(e){e[e.DIRECTION_BACKWARD_UNSPECIFIED=0]="DIRECTION_BACKWARD_UNSPECIFIED",e[e.DIRECTION_FORWARD=1]="DIRECTION_FORWARD",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"}(a=t.PagingInfo_Direction||(t.PagingInfo_Direction={})),t.pagingInfo_DirectionFromJSON=u,t.pagingInfo_DirectionToJSON=l,function(e){e[e.ERROR_NONE_UNSPECIFIED=0]="ERROR_NONE_UNSPECIFIED",e[e.ERROR_INVALID_CURSOR=1]="ERROR_INVALID_CURSOR",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"}(c=t.HistoryResponse_Error||(t.HistoryResponse_Error={})),t.historyResponse_ErrorFromJSON=h,t.historyResponse_ErrorToJSON=d,t.Index={encode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s.default.Writer.create();return 0!==e.digest.length&&t.uint32(10).bytes(e.digest),e.receivedTime.isZero()||t.uint32(16).sint64(e.receivedTime),e.senderTime.isZero()||t.uint32(24).sint64(e.senderTime),""!==e.pubsubTopic&&t.uint32(34).string(e.pubsubTopic),t},decode(e,t){const r=e instanceof s.default.Reader?e:new s.default.Reader(e);let n=void 0===t?r.len:r.pos+t;const i=f();for(;r.pos<n;){const e=r.uint32();switch(e>>>3){case 1:i.digest=r.bytes();break;case 2:i.receivedTime=r.sint64();break;case 3:i.senderTime=r.sint64();break;case 4:i.pubsubTopic=r.string();break;default:r.skipType(7&e)}}return i},fromJSON:e=>({digest:b(e.digest)?m(e.digest):new Uint8Array,receivedTime:b(e.receivedTime)?i.default.fromString(e.receivedTime):i.default.ZERO,senderTime:b(e.senderTime)?i.default.fromString(e.senderTime):i.default.ZERO,pubsubTopic:b(e.pubsubTopic)?String(e.pubsubTopic):""}),toJSON(e){const t={};return void 0!==e.digest&&(t.digest=function(e){const t=[];for(const r of e)t.push(String.fromCharCode(r));return v(t.join(""))}(void 0!==e.digest?e.digest:new Uint8Array)),void 0!==e.receivedTime&&(t.receivedTime=(e.receivedTime||i.default.ZERO).toString()),void 0!==e.senderTime&&(t.senderTime=(e.senderTime||i.default.ZERO).toString()),void 0!==e.pubsubTopic&&(t.pubsubTopic=e.pubsubTopic),t},fromPartial(e){var t,r;const n=f();return n.digest=null!==(t=e.digest)&&void 0!==t?t:new Uint8Array,n.receivedTime=void 0!==e.receivedTime&&null!==e.receivedTime?i.default.fromValue(e.receivedTime):i.default.ZERO,n.senderTime=void 0!==e.senderTime&&null!==e.senderTime?i.default.fromValue(e.senderTime):i.default.ZERO,n.pubsubTopic=null!==(r=e.pubsubTopic)&&void 0!==r?r:"",n}},t.PagingInfo={encode(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s.default.Writer.create();return e.pageSize.isZero()||r.uint32(8).uint64(e.pageSize),void 0!==e.cursor&&t.Index.encode(e.cursor,r.uint32(18).fork()).ldelim(),0!==e.direction&&r.uint32(24).int32(e.direction),r},decode(e,r){const n=e instanceof s.default.Reader?e:new s.default.Reader(e);let i=void 0===r?n.len:n.pos+r;const o=p();for(;n.pos<i;){const e=n.uint32();switch(e>>>3){case 1:o.pageSize=n.uint64();break;case 2:o.cursor=t.Index.decode(n,n.uint32());break;case 3:o.direction=n.int32();break;default:n.skipType(7&e)}}return o},fromJSON:e=>({pageSize:b(e.pageSize)?i.default.fromString(e.pageSize):i.default.UZERO,cursor:b(e.cursor)?t.Index.fromJSON(e.cursor):void 0,direction:b(e.direction)?u(e.direction):0}),toJSON(e){const r={};return void 0!==e.pageSize&&(r.pageSize=(e.pageSize||i.default.UZERO).toString()),void 0!==e.cursor&&(r.cursor=e.cursor?t.Index.toJSON(e.cursor):void 0),void 0!==e.direction&&(r.direction=l(e.direction)),r},fromPartial(e){var r;const n=p();return n.pageSize=void 0!==e.pageSize&&null!==e.pageSize?i.default.fromValue(e.pageSize):i.default.UZERO,n.cursor=void 0!==e.cursor&&null!==e.cursor?t.Index.fromPartial(e.cursor):void 0,n.direction=null!==(r=e.direction)&&void 0!==r?r:0,n}},t.ContentFilter={encode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s.default.Writer.create();return""!==e.contentTopic&&t.uint32(10).string(e.contentTopic),t},decode(e,t){const r=e instanceof s.default.Reader?e:new s.default.Reader(e);let n=void 0===t?r.len:r.pos+t;const i={contentTopic:""};for(;r.pos<n;){const e=r.uint32();if(e>>>3===1)i.contentTopic=r.string();else r.skipType(7&e)}return i},fromJSON:e=>({contentTopic:b(e.contentTopic)?String(e.contentTopic):""}),toJSON(e){const t={};return void 0!==e.contentTopic&&(t.contentTopic=e.contentTopic),t},fromPartial(e){var t;const r={contentTopic:""};return r.contentTopic=null!==(t=e.contentTopic)&&void 0!==t?t:"",r}},t.HistoryQuery={encode(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s.default.Writer.create();void 0!==e.pubSubTopic&&r.uint32(18).string(e.pubSubTopic);for(const n of e.contentFilters)t.ContentFilter.encode(n,r.uint32(26).fork()).ldelim();return void 0!==e.pagingInfo&&t.PagingInfo.encode(e.pagingInfo,r.uint32(34).fork()).ldelim(),void 0!==e.startTime&&r.uint32(40).sint64(e.startTime),void 0!==e.endTime&&r.uint32(48).sint64(e.endTime),r},decode(e,r){const n=e instanceof s.default.Reader?e:new s.default.Reader(e);let i=void 0===r?n.len:n.pos+r;const o={pubSubTopic:void 0,contentFilters:[],pagingInfo:void 0,startTime:void 0,endTime:void 0};for(;n.pos<i;){const e=n.uint32();switch(e>>>3){case 2:o.pubSubTopic=n.string();break;case 3:o.contentFilters.push(t.ContentFilter.decode(n,n.uint32()));break;case 4:o.pagingInfo=t.PagingInfo.decode(n,n.uint32());break;case 5:o.startTime=n.sint64();break;case 6:o.endTime=n.sint64();break;default:n.skipType(7&e)}}return o},fromJSON:e=>({pubSubTopic:b(e.pubSubTopic)?String(e.pubSubTopic):void 0,contentFilters:Array.isArray(null===e||void 0===e?void 0:e.contentFilters)?e.contentFilters.map((e=>t.ContentFilter.fromJSON(e))):[],pagingInfo:b(e.pagingInfo)?t.PagingInfo.fromJSON(e.pagingInfo):void 0,startTime:b(e.startTime)?i.default.fromString(e.startTime):void 0,endTime:b(e.endTime)?i.default.fromString(e.endTime):void 0}),toJSON(e){const r={};return void 0!==e.pubSubTopic&&(r.pubSubTopic=e.pubSubTopic),e.contentFilters?r.contentFilters=e.contentFilters.map((e=>e?t.ContentFilter.toJSON(e):void 0)):r.contentFilters=[],void 0!==e.pagingInfo&&(r.pagingInfo=e.pagingInfo?t.PagingInfo.toJSON(e.pagingInfo):void 0),void 0!==e.startTime&&(r.startTime=(e.startTime||void 0).toString()),void 0!==e.endTime&&(r.endTime=(e.endTime||void 0).toString()),r},fromPartial(e){var r,n;const s={pubSubTopic:void 0,contentFilters:[],pagingInfo:void 0,startTime:void 0,endTime:void 0};return s.pubSubTopic=null!==(r=e.pubSubTopic)&&void 0!==r?r:void 0,s.contentFilters=(null===(n=e.contentFilters)||void 0===n?void 0:n.map((e=>t.ContentFilter.fromPartial(e))))||[],s.pagingInfo=void 0!==e.pagingInfo&&null!==e.pagingInfo?t.PagingInfo.fromPartial(e.pagingInfo):void 0,s.startTime=void 0!==e.startTime&&null!==e.startTime?i.default.fromValue(e.startTime):void 0,s.endTime=void 0!==e.endTime&&null!==e.endTime?i.default.fromValue(e.endTime):void 0,s}},t.HistoryResponse={encode(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s.default.Writer.create();for(const t of e.messages)o.WakuMessage.encode(t,r.uint32(18).fork()).ldelim();return void 0!==e.pagingInfo&&t.PagingInfo.encode(e.pagingInfo,r.uint32(26).fork()).ldelim(),0!==e.error&&r.uint32(32).int32(e.error),r},decode(e,r){const n=e instanceof s.default.Reader?e:new s.default.Reader(e);let i=void 0===r?n.len:n.pos+r;const a={messages:[],pagingInfo:void 0,error:0};for(;n.pos<i;){const e=n.uint32();switch(e>>>3){case 2:a.messages.push(o.WakuMessage.decode(n,n.uint32()));break;case 3:a.pagingInfo=t.PagingInfo.decode(n,n.uint32());break;case 4:a.error=n.int32();break;default:n.skipType(7&e)}}return a},fromJSON:e=>({messages:Array.isArray(null===e||void 0===e?void 0:e.messages)?e.messages.map((e=>o.WakuMessage.fromJSON(e))):[],pagingInfo:b(e.pagingInfo)?t.PagingInfo.fromJSON(e.pagingInfo):void 0,error:b(e.error)?h(e.error):0}),toJSON(e){const r={};return e.messages?r.messages=e.messages.map((e=>e?o.WakuMessage.toJSON(e):void 0)):r.messages=[],void 0!==e.pagingInfo&&(r.pagingInfo=e.pagingInfo?t.PagingInfo.toJSON(e.pagingInfo):void 0),void 0!==e.error&&(r.error=d(e.error)),r},fromPartial(e){var r,n;const i={messages:[],pagingInfo:void 0,error:0};return i.messages=(null===(r=e.messages)||void 0===r?void 0:r.map((e=>o.WakuMessage.fromPartial(e))))||[],i.pagingInfo=void 0!==e.pagingInfo&&null!==e.pagingInfo?t.PagingInfo.fromPartial(e.pagingInfo):void 0,i.error=null!==(n=e.error)&&void 0!==n?n:0,i}},t.HistoryRPC={encode(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s.default.Writer.create();return""!==e.requestId&&r.uint32(10).string(e.requestId),void 0!==e.query&&t.HistoryQuery.encode(e.query,r.uint32(18).fork()).ldelim(),void 0!==e.response&&t.HistoryResponse.encode(e.response,r.uint32(26).fork()).ldelim(),r},decode(e,r){const n=e instanceof s.default.Reader?e:new s.default.Reader(e);let i=void 0===r?n.len:n.pos+r;const o={requestId:"",query:void 0,response:void 0};for(;n.pos<i;){const e=n.uint32();switch(e>>>3){case 1:o.requestId=n.string();break;case 2:o.query=t.HistoryQuery.decode(n,n.uint32());break;case 3:o.response=t.HistoryResponse.decode(n,n.uint32());break;default:n.skipType(7&e)}}return o},fromJSON:e=>({requestId:b(e.requestId)?String(e.requestId):"",query:b(e.query)?t.HistoryQuery.fromJSON(e.query):void 0,response:b(e.response)?t.HistoryResponse.fromJSON(e.response):void 0}),toJSON(e){const r={};return void 0!==e.requestId&&(r.requestId=e.requestId),void 0!==e.query&&(r.query=e.query?t.HistoryQuery.toJSON(e.query):void 0),void 0!==e.response&&(r.response=e.response?t.HistoryResponse.toJSON(e.response):void 0),r},fromPartial(e){var r;const n={requestId:"",query:void 0,response:void 0};return n.requestId=null!==(r=e.requestId)&&void 0!==r?r:"",n.query=void 0!==e.query&&null!==e.query?t.HistoryQuery.fromPartial(e.query):void 0,n.response=void 0!==e.response&&null!==e.response?t.HistoryResponse.fromPartial(e.response):void 0,n}};var y=(()=>{if("undefined"!==typeof y)return y;if("undefined"!==typeof self)return self;if("undefined"!==typeof window)return window;if("undefined"!==typeof r.g)return r.g;throw"Unable to locate global object"})();const g=y.atob||(e=>y.Buffer.from(e,"base64").toString("binary"));function m(e){const t=g(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;++n)r[n]=t.charCodeAt(n);return r}const v=y.btoa||(e=>y.Buffer.from(e,"binary").toString("base64"));function b(e){return null!==e&&void 0!==e}s.default.util.Long!==i.default&&(s.default.util.Long=i.default,s.default.configure())},87018: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,s){for(var o=32767&t,a=t>>15;--s>=0;){var c=32767&this[e],u=this[e++]>>15,l=a*c+u*o;i=((c=o*c+((32767&l)<<15)+r[n]+(1073741823&i))>>>30)+(l>>>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,s){for(;--s>=0;){var o=t*this[e++]+r[n]+i;i=Math.floor(o/67108864),r[n++]=67108863&o}return i},t=26):(r.prototype.am=function(e,t,r,n,i,s){for(var o=16383&t,a=t>>14;--s>=0;){var c=16383&this[e],u=this[e++]>>14,l=a*c+u*o;i=((c=o*c+((16383&l)<<14)+r[n]+i)>>28)+(l>>14)+a*u,r[n++]=268435455&c}return i},t=28),r.prototype.DB=t,r.prototype.DM=(1<<t)-1,r.prototype.DV=1<<t;r.prototype.FV=Math.pow(2,52),r.prototype.F1=52-t,r.prototype.F2=2*t-52;var s,o,a=new Array;for(s="0".charCodeAt(0),o=0;o<=9;++o)a[s++]=o;for(s="a".charCodeAt(0),o=10;o<36;++o)a[s++]=o;for(s="A".charCodeAt(0),o=10;o<36;++o)a[s++]=o;function c(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function u(e,t){var r=a[e.charCodeAt(t)];return null==r?-1:r}function l(e){var t=n();return t.fromInt(e),t}function h(e){var t,r=1;return 0!=(t=e>>>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 d(e){this.m=e}function f(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function p(e,t){return e&t}function y(e,t){return e|t}function g(e,t){return e^t}function m(e,t){return e&~t}function v(e){if(0==e)return-1;var t=0;return 0==(65535&e)&&(e>>=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 b(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function w(){}function E(e){return e}function S(e){this.r2=n(),this.q3=n(),r.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}d.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},d.prototype.revert=function(e){return e},d.prototype.reduce=function(e){e.divRemTo(this.m,null,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)},f.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},f.prototype.revert=function(e){var t=n();return e.copyTo(t),this.reduce(t),t},f.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=32767&e[t],n=r*this.mpl+((r*this.mph+(e[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)},f.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},f.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,s=!1,o=0;--i>=0;){var a=8==n?255&e[i]:u(e,i);a<0?"-"==e.charAt(i)&&(s=!0):(s=!1,0==o?this[this.t++]=a:o+n>this.DB?(this[this.t-1]|=(a&(1<<this.DB-o)-1)<<o,this[this.t++]=a>>this.DB-o):this[this.t-1]|=a<<o,(o+=n)>=this.DB&&(o-=this.DB))}8==n&&0!=(128&e[0])&&(this.s=-1,o>0&&(this[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),s&&r.ZERO.subTo(this,this)},r.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>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<this.t;++r)t[r-e]=this[r];t.t=Math.max(this.t-e,0),t.s=this.s},r.prototype.lShiftTo=function(e,t){var r,n=e%this.DB,i=this.DB-n,s=(1<<i)-1,o=Math.floor(e/this.DB),a=this.s<<n&this.DM;for(r=this.t-1;r>=0;--r)t[r+o+1]=this[r]>>i|a,a=(this[r]&s)<<n;for(r=o-1;r>=0;--r)t[r]=0;t[o]=a,t.t=this.t+o+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,s=(1<<n)-1;t[0]=this[r]>>n;for(var o=r+1;o<this.t;++o)t[o-r-1]|=(this[o]&s)<<i,t[o-r]=this[o]>>n;n>0&&(t[this.t-r-1]|=(this.s&s)<<i),t.t=this.t-r,t.clamp()}},r.prototype.subTo=function(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this[r]-e[r],t[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n-=e.s;r<this.t;)n+=this[r],t[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n-=e[r],t[r++]=n&this.DM,n>>=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(),s=n.t;for(t.t=s+i.t;--s>=0;)t[s]=0;for(s=0;s<i.t;++s)t[s+n.t]=n.am(0,i[s],t,s,0,n.t);t.s=0,t.clamp(),this.s!=e.s&&r.ZERO.subTo(t,t)},r.prototype.squareTo=function(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e[r]=0;for(r=0;r<t.t-1;++r){var n=t.am(r,t[r],e,2*r,0,1);(e[r+t.t]+=t.am(r+1,2*t[r],e,2*r+1,n,t.t-r-1))>=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 s=e.abs();if(!(s.t<=0)){var o=this.abs();if(o.t<s.t)return null!=t&&t.fromInt(0),void(null!=i&&this.copyTo(i));null==i&&(i=n());var a=n(),c=this.s,u=e.s,l=this.DB-h(s[s.t-1]);l>0?(s.lShiftTo(l,a),o.lShiftTo(l,i)):(s.copyTo(a),o.copyTo(i));var d=a.t,f=a[d-1];if(0!=f){var p=f*(1<<this.F1)+(d>1?a[d-2]>>this.F2:0),y=this.FV/p,g=(1<<this.F1)/p,m=1<<this.F2,v=i.t,b=v-d,w=null==t?n():t;for(a.dlShiftTo(b,w),i.compareTo(w)>=0&&(i[i.t++]=1,i.subTo(w,i)),r.ONE.dlShiftTo(d,w),w.subTo(a,a);a.t<d;)a[a.t++]=0;for(;--b>=0;){var E=i[--v]==f?this.DM:Math.floor(i[v]*y+(i[v-1]+m)*g);if((i[v]+=a.am(0,E,i,b,0,d))<E)for(a.dlShiftTo(b,w),i.subTo(w,i);i[v]<--E;)i.subTo(w,i)}null!=t&&(i.drShiftTo(d,t),c!=u&&r.ZERO.subTo(t,t)),i.t=d,i.clamp(),l>0&&i.rShiftTo(l,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(),s=n(),o=t.convert(this),a=h(e)-1;for(o.copyTo(i);--a>=0;)if(t.sqrTo(i,s),(e&1<<a)>0)t.mulTo(s,o,i);else{var c=i;i=s,s=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<<t)-1,i=!1,s="",o=this.t,a=this.DB-o*this.DB%t;if(o-- >0)for(a<this.DB&&(r=this[o]>>a)>0&&(i=!0,s=c(r));o>=0;)a<t?(r=(this[o]&(1<<a)-1)<<t-a,r|=this[--o]>>(a+=this.DB-t)):(r=this[o]>>(a-=t)&n,a<=0&&(a+=this.DB,--o)),r>0&&(i=!0),i&&(s+=c(r));return i?s:"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)+h(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 d(t):new f(t),this.exp(e,r)},r.ZERO=l(0),r.ONE=l(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)},S.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},S.prototype.revert=function(e){return e},S.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)},S.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},S.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var _,I,T,A=[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)/A[A.length-1];function R(){var e;e=(new Date).getTime(),I[T++]^=255&e,I[T++]^=e>>8&255,I[T++]^=e>>16&255,I[T++]^=e>>24&255,T>=L&&(T-=L)}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=l(r),s=n(),o=n(),a="";for(this.divRemTo(i,s,o);s.signum()>0;)a=(r+o.intValue()).toString(e).substr(1)+a,s.divRemTo(i,s,o);return o.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),s=!1,o=0,a=0,c=0;c<e.length;++c){var l=u(e,c);l<0?"-"==e.charAt(c)&&0==this.signum()&&(s=!0):(a=t*a+l,++o>=n&&(this.dMultiply(i),this.dAddOffset(a,0),o=0,a=0))}o>0&&(this.dMultiply(Math.pow(t,o)),this.dAddOffset(a,0)),s&&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,s=7&e;i.length=1+(e>>3),t.nextBytes(i),s>0?i[0]&=(1<<s)-1:i[0]=0,this.fromString(i,256)}},r.prototype.bitwiseTo=function(e,t,r){var n,i,s=Math.min(e.t,this.t);for(n=0;n<s;++n)r[n]=t(this[n],e[n]);if(e.t<this.t){for(i=e.s&this.DM,n=s;n<this.t;++n)r[n]=t(this[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=s;n<e.t;++n)r[n]=t(i,e[n]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()},r.prototype.changeBit=function(e,t){var n=r.ONE.shiftLeft(e);return this.bitwiseTo(n,t,n),n},r.prototype.addTo=function(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this[r]+e[r],t[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n+=e.s;r<this.t;)n+=this[r],t[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n+=e[r],t[r++]=n&this.DM,n>>=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<n;++i)r[i+this.t]=this.am(0,e[i],r,i,0,this.t);for(n=Math.min(e.t,t);i<n;++i)this.am(0,e[i],r,i,0,t-i);r.clamp()},r.prototype.multiplyUpperTo=function(e,t,r){--t;var n=r.t=this.t+e.t-t;for(r.s=0;--n>=0;)r[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)r[this.t+n-t]=this.am(t-n,e[n],r,0,0,this.t+n-t);r.clamp(),r.drShiftTo(1,r)},r.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)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 s=t.shiftRight(i);(e=e+1>>1)>A.length&&(e=A.length);for(var o=n(),a=0;a<e;++a){o.fromInt(A[Math.floor(Math.random()*A.length)]);var c=o.modPow(s,this);if(0!=c.compareTo(r.ONE)&&0!=c.compareTo(t)){for(var u=1;u++<i&&0!=c.compareTo(t);)if(0==(c=c.modPowInt(2,this)).compareTo(r.ONE))return!1;if(0!=c.compareTo(t))return!1}}return!0},r.prototype.clone=function(){var e=n();return this.copyTo(e),e},r.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},r.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>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<this.DB&&(r=this[e]>>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<<this.DB-n);e>=0;)n<8?(r=(this[e]&(1<<n)-1)<<8-n,r|=this[--e]>>(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,m,t),t},r.prototype.not=function(){for(var e=n(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e},r.prototype.shiftLeft=function(e){var t=n();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},r.prototype.shiftRight=function(e){var t=n();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},r.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this[e])return e*this.DB+v(this[e]);return this.s<0?this.t*this.DB:-1},r.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=b(this[r]^t);return e},r.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:0!=(this[t]&1<<e%this.DB)},r.prototype.setBit=function(e){return this.changeBit(e,y)},r.prototype.clearBit=function(e){return this.changeBit(e,m)},r.prototype.flipBit=function(e){return this.changeBit(e,g)},r.prototype.add=function(e){var t=n();return this.addTo(e,t),t},r.prototype.subtract=function(e){var t=n();return this.subTo(e,t),t},r.prototype.multiply=function(e){var t=n();return this.multiplyTo(e,t),t},r.prototype.divide=function(e){var t=n();return this.divRemTo(e,t,null),t},r.prototype.remainder=function(e){var t=n();return this.divRemTo(e,null,t),t},r.prototype.divideAndRemainder=function(e){var t=n(),r=n();return this.divRemTo(e,t,r),new Array(t,r)},r.prototype.modPow=function(e,t){var r,i,s=e.bitLength(),o=l(1);if(s<=0)return o;r=s<18?1:s<48?3:s<144?4:s<768?5:6,i=s<8?new d(t):t.isEven()?new S(t):new f(t);var a=new Array,c=3,u=r-1,p=(1<<r)-1;if(a[1]=i.convert(this),r>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,m,v=e.t-1,b=!0,w=n();for(s=h(e[v])-1;v>=0;){for(s>=u?g=e[v]>>s-u&p:(g=(e[v]&(1<<s+1)-1)<<u-s,v>0&&(g|=e[v-1]>>this.DB+s-u)),c=r;0==(1&g);)g>>=1,--c;if((s-=c)<0&&(s+=this.DB,--v),b)a[g].copyTo(o),b=!1;else{for(;c>1;)i.sqrTo(o,w),i.sqrTo(w,o),c-=2;c>0?i.sqrTo(o,w):(m=o,o=w,w=m),i.mulTo(w,a[g],o)}for(;v>=0&&0==(e[v]&1<<s);)i.sqrTo(o,w),m=o,o=w,w=m,--s<0&&(s=this.DB-1,--v)}return i.revert(o)},r.prototype.modInverse=function(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return r.ZERO;for(var n=e.clone(),i=this.clone(),s=l(1),o=l(0),a=l(0),c=l(1);0!=n.signum();){for(;n.isEven();)n.rShiftTo(1,n),t?(s.isEven()&&o.isEven()||(s.addTo(this,s),o.subTo(e,o)),s.rShiftTo(1,s)):o.isEven()||o.subTo(e,o),o.rShiftTo(1,o);for(;i.isEven();)i.rShiftTo(1,i),t?(a.isEven()&&c.isEven()||(a.addTo(this,a),c.subTo(e,c)),a.rShiftTo(1,a)):c.isEven()||c.subTo(e,c),c.rShiftTo(1,c);n.compareTo(i)>=0?(n.subTo(i,n),t&&s.subTo(a,s),o.subTo(c,o)):(i.subTo(n,i),t&&a.subTo(s,a),c.subTo(o,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(),s=r.getLowestSetBit();if(s<0)return t;for(i<s&&(s=i),s>0&&(t.rShiftTo(s,t),r.rShiftTo(s,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 s>0&&r.lShiftTo(s,r),r},r.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r[0]<=A[A.length-1]){for(t=0;t<A.length;++t)if(r[0]==A[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<A.length;){for(var n=A[t],i=t+1;i<A.length&&n<C;)n*=A[i++];for(n=r.modInt(n);t<i;)if(n%A[t++]==0)return!1}return r.millerRabin(e)},r.prototype.square=function(){var e=n();return this.squareTo(e),e},r.prototype.Barrett=S,null==I){var P;if(I=new Array,T=0,"undefined"!==typeof window&&window.crypto)if(window.crypto.getRandomValues){var k=new Uint8Array(32);for(window.crypto.getRandomValues(k),P=0;P<32;++P)I[T++]=k[P]}else if("Netscape"==navigator.appName&&navigator.appVersion<"5"){var O=window.crypto.random(32);for(P=0;P<O.length;++P)I[T++]=255&O.charCodeAt(P)}for(;T<L;)P=Math.floor(65536*Math.random()),I[T++]=P>>>8,I[T++]=255&P;T=0,R()}function B(){if(null==_){for(R(),(_=new D).init(I),T=0;T<I.length;++T)I[T]=0;T=0}return _.next()}function N(){}function D(){this.i=0,this.j=0,this.S=new Array}N.prototype.nextBytes=function(e){var t;for(t=0;t<e.length;++t)e[t]=B()},D.prototype.init=function(e){var t,r,n;for(t=0;t<256;++t)this.S[t]=t;for(r=0,t=0;t<256;++t)r=r+this.S[t]+e[t%e.length]&255,n=this.S[t],this.S[t]=this.S[r],this.S[r]=n;this.i=0,this.j=0},D.prototype.next=function(){var e;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,e=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=e,this.S[e+this.S[this.i]&255]};var L=256;e.exports={default:r,BigInteger:r,SecureRandom:N}}).call(this)},44786:(e,t,r)=>{"use strict";const n=r(90190),{Multiaddr:i}=r(98719),s=r(18322),{EventEmitter:o}=r(47465),a=r(18392),c=Object.assign(a("libp2p:bootstrap"),{error:a("libp2p:bootstrap:error")});(e.exports=class extends o{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{list:[]};if(!e.list||!e.list.length)throw new Error("Bootstrap requires a list of peer addresses");super(),this._list=e.list,this._interval=e.interval||1e4,this._timer=null}start(){this._timer||(this._timer=setInterval((()=>this._discoverBootstrapPeers()),this._interval),c("Starting bootstrap node discovery"),this._discoverBootstrapPeers())}_discoverBootstrapPeers(){this._timer&&this._list.forEach((e=>{if(!s.P2P.matches(e))return c.error("Invalid multiaddr");const t=new i(e),r=t.getPeerId();if(!r)return void c.error("Invalid bootstrap multiaddr without peer id");const o=n.createFromB58String(r);try{this.emit("peer",{id:o,multiaddrs:[t]})}catch(a){c.error("Invalid bootstrap peer id",a)}}))}stop(){this._timer&&clearInterval(this._timer),this._timer=null}}).tag="bootstrap"},40110:(e,t,r)=>{var n=r(98942);function i(e,t){n.cipher.registerAlgorithm(e,(function(){return new n.aes.Algorithm(e,t)}))}r(89032),r(57300),r(94384),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){l||h();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return f(r._w,e,t,!1)},decrypt:function(e,t){return f(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<t.length;++i)r.putByte(t[i])}}else r=n.util.createBuffer(r);if(!n.util.isArray(r)){t=r,r=[];var s=t.length();if(16===s||24===s||32===s){s>>>=2;for(i=0;i<s;++i)r.push(t.getInt32())}}if(!n.util.isArray(r)||4!==r.length&&6!==r.length&&8!==r.length)throw new Error("Invalid key parameter.");var o=this.mode.name,a=-1!==["CFB","OFB","CTR","GCM"].indexOf(o);this._w=d(r,e.decrypt&&!a),this._init=!0}},n.aes._expandKey=function(e,t){return l||h(),d(e,t)},n.aes._updateBlock=f,i("AES-ECB",n.cipher.modes.ecb),i("AES-CBC",n.cipher.modes.cbc),i("AES-CFB",n.cipher.modes.cfb),i("AES-OFB",n.cipher.modes.ofb),i("AES-CTR",n.cipher.modes.ctr),i("AES-GCM",n.cipher.modes.gcm);var s,o,a,c,u,l=!1;function h(){l=!0,a=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),t=0;t<128;++t)e[t]=t<<1,e[t+128]=t+128<<1^283;s=new Array(256),o=new Array(256),c=new Array(4),u=new Array(4);for(t=0;t<4;++t)c[t]=new Array(256),u[t]=new Array(256);var r,n,i,h,d,f,p,y=0,g=0;for(t=0;t<256;++t){h=(h=g^g<<1^g<<2^g<<3^g<<4)>>8^255&h^99,s[y]=h,o[h]=y,f=(d=e[h])<<24^h<<16^h<<8^h^d,p=((r=e[y])^(n=e[r])^(i=e[n]))<<24^(y^i)<<16^(y^n^i)<<8^y^r^i;for(var m=0;m<4;++m)c[m][y]=f,u[m][h]=p,f=f<<24|f>>>8,p=p<<24|p>>>8;0===y?y=g=1:(y=r^e[e[e[r^i]]],g^=e[e[g]])}}function d(e,t){for(var r,n=e.slice(0),i=1,o=n.length,c=4*(o+6+1),l=o;l<c;++l)r=n[l-1],l%o===0?(r=s[r>>>16&255]<<24^s[r>>>8&255]<<16^s[255&r]<<8^s[r>>>24]^a[i]<<24,i++):o>6&&l%o===4&&(r=s[r>>>24]<<24^s[r>>>16&255]<<16^s[r>>>8&255]<<8^s[255&r]),n[l]=n[l-o]^r;if(t){for(var h,d=u[0],f=u[1],p=u[2],y=u[3],g=n.slice(0),m=(l=0,(c=n.length)-4);l<c;l+=4,m-=4)if(0===l||l===c-4)g[l]=n[m],g[l+1]=n[m+3],g[l+2]=n[m+2],g[l+3]=n[m+1];else for(var v=0;v<4;++v)h=n[m+v],g[l+(3&-v)]=d[s[h>>>24]]^f[s[h>>>16&255]]^p[s[h>>>8&255]]^y[s[255&h]];n=g}return n}function f(e,t,r,n){var i,a,l,h,d,f,p,y,g,m,v,b,w=e.length/4-1;n?(i=u[0],a=u[1],l=u[2],h=u[3],d=o):(i=c[0],a=c[1],l=c[2],h=c[3],d=s),f=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,S=1;S<w;++S)m=i[f>>>24]^a[p>>>16&255]^l[y>>>8&255]^h[255&g]^e[++E],v=i[p>>>24]^a[y>>>16&255]^l[g>>>8&255]^h[255&f]^e[++E],b=i[y>>>24]^a[g>>>16&255]^l[f>>>8&255]^h[255&p]^e[++E],g=i[g>>>24]^a[f>>>16&255]^l[p>>>8&255]^h[255&y]^e[++E],f=m,p=v,y=b;r[0]=d[f>>>24]<<24^d[p>>>16&255]<<16^d[y>>>8&255]<<8^d[255&g]^e[++E],r[n?3:1]=d[p>>>24]<<24^d[y>>>16&255]<<16^d[g>>>8&255]<<8^d[255&f]^e[++E],r[2]=d[y>>>24]<<24^d[g>>>16&255]<<16^d[f>>>8&255]<<8^d[255&p]^e[++E],r[n?1:3]=d[g>>>24]<<24^d[f>>>16&255]<<16^d[p>>>8&255]<<8^d[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 s=null;r instanceof n.util.ByteBuffer&&(s=r,r={}),(r=r||{}).output=s,r.iv=e,i.call(t,r)},t}},20759:(e,t,r)=>{var n=r(98942);r(94384),r(54300);var i=e.exports=n.asn1=n.asn1||{};function s(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}}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,s,o){if(n.util.isArray(s)){for(var a=[],c=0;c<s.length;++c)void 0!==s[c]&&a.push(s[c]);s=a}var u={tagClass:e,type:t,constructed:r,composed:r||n.util.isArray(s),value:s};return o&&"bitStringContents"in o&&(u.bitStringContents=o.bitStringContents,u.original=i.copy(u)),u},i.copy=function(e,t){var r;if(n.util.isArray(e)){r=[];for(var s=0;s<e.length;++s)r.push(i.copy(e[s],t));return r}return"string"===typeof e?e:(r={tagClass:e.tagClass,type:e.type,constructed:e.constructed,composed:e.composed,value:i.copy(e.value,t)},t&&!t.excludeBitStringContents&&(r.bitStringContents=e.bitStringContents),r)},i.equals=function(e,t,r){if(n.util.isArray(e)){if(!n.util.isArray(t))return!1;if(e.length!==t.length)return!1;for(var s=0;s<e.length;++s)if(!i.equals(e[s],t[s]))return!1;return!0}if(typeof e!==typeof t)return!1;if("string"===typeof e)return e===t;var o=e.tagClass===t.tagClass&&e.type===t.type&&e.constructed===t.constructed&&e.composed===t.composed&&i.equals(e.value,t.value);return r&&r.includeBitStringContents&&(o=o&&e.bitStringContents===t.bitStringContents),o},i.getBerValueLength=function(e){var t=e.getByte();if(128!==t)return 128&t?e.getInt((127&t)<<3):t};function o(e,t,r,n){var a;s(e,t,2);var c=e.getByte();t--;var u=192&c,l=31&c;a=e.length();var h,d,f=function(e,t){var r=e.getByte();if(t--,128!==r){var n;if(128&r){var i=127&r;s(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!==f&&f>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=f,p}f=t}var y=32===(32&c);if(y)if(h=[],void 0===f)for(;;){if(s(e,t,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),t-=2;break}a=e.length(),h.push(o(e,t,r+1,n)),t-=a-e.length()}else for(;f>0;)a=e.length(),h.push(o(e,f,r+1,n)),t-=a-e.length(),f-=a-e.length();if(void 0===h&&u===i.Class.UNIVERSAL&&l===i.Type.BITSTRING&&(d=e.bytes(f)),void 0===h&&n.decodeBitStrings&&u===i.Class.UNIVERSAL&&l===i.Type.BITSTRING&&f>1){var g=e.read,m=t,v=0;if(l===i.Type.BITSTRING&&(s(e,t,1),v=e.getByte(),t--),0===v)try{a=e.length();var b=o(e,t,r+1,{verbose:n.verbose,strict:!0,decodeBitStrings:!0}),w=a-e.length();t-=w,l==i.Type.BITSTRING&&w++;var E=b.tagClass;w!==f||E!==i.Class.UNIVERSAL&&E!==i.Class.CONTEXT_SPECIFIC||(h=[b])}catch(_){}void 0===h&&(e.read=g,t=m)}if(void 0===h){if(void 0===f){if(n.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");f=t}if(l===i.Type.BMPSTRING)for(h="";f>0;f-=2)s(e,t,2),h+=String.fromCharCode(e.getInt16()),t-=2;else h=e.getBytes(f)}var S=void 0===d?null:{bitStringContents:d};return i.create(u,l,y,h,S)}i.fromDer=function(e,t){return void 0===t&&(t={strict:!0,decodeBitStrings:!0}),"boolean"===typeof t&&(t={strict:t,decodeBitStrings:!0}),"strict"in t||(t.strict=!0),"decodeBitStrings"in t||(t.decodeBitStrings=!0),"string"===typeof e&&(e=n.util.createBuffer(e)),o(e,e.length(),0,t)},i.toDer=function(e){var t=n.util.createBuffer(),r=e.tagClass|e.type,s=n.util.createBuffer(),o=!1;if("bitStringContents"in e&&(o=!0,e.original&&(o=i.equals(e,e.original))),o)s.putBytes(e.bitStringContents);else if(e.composed){e.constructed?r|=32:s.putByte(0);for(var a=0;a<e.value.length;++a)void 0!==e.value[a]&&s.putBuffer(i.toDer(e.value[a]))}else if(e.type===i.Type.BMPSTRING)for(a=0;a<e.value.length;++a)s.putInt16(e.value.charCodeAt(a));else e.type===i.Type.INTEGER&&e.value.length>1&&(0===e.value.charCodeAt(0)&&0===(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128===(128&e.value.charCodeAt(1)))?s.putBytes(e.value.substr(1)):s.putBytes(e.value);if(t.putByte(r),s.length()<=127)t.putByte(127&s.length());else{var c=s.length(),u="";do{u+=String.fromCharCode(255&c),c>>>=8}while(c>0);t.putByte(128|u.length);for(a=u.length-1;a>=0;--a)t.putByte(u.charCodeAt(a))}return t.putBuffer(s),t},i.oidToDer=function(e){var t,r,i,s,o=e.split("."),a=n.util.createBuffer();a.putByte(40*parseInt(o[0],10)+parseInt(o[1],10));for(var c=2;c<o.length;++c){t=!0,r=[],i=parseInt(o[c],10);do{s=127&i,i>>>=7,t||(s|=128),r.push(s),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),s=parseInt(e.substr(6,2),10),o=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(s,o,a,0),u&&("+"===(c=e.charAt(u))||"-"===c)){var l=60*parseInt(e.substr(u+1,2),10)+parseInt(e.substr(u+4,2),10);l*=6e4,"+"===c?t.setTime(+t-l):t.setTime(+t+l)}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),s=parseInt(e.substr(8,2),10),o=parseInt(e.substr(10,2),10),a=parseInt(e.substr(12,2),10),c=0,u=0,l=!1;"Z"===e.charAt(e.length-1)&&(l=!0);var h=e.length-5,d=e.charAt(h);"+"!==d&&"-"!==d||(u=60*parseInt(e.substr(h+1,2),10)+parseInt(e.substr(h+4,2),10),u*=6e4,"+"===d&&(u*=-1),l=!0);return"."===e.charAt(14)&&(c=1e3*parseFloat(e.substr(14),10)),l?(t.setUTCFullYear(r,n,i),t.setUTCHours(s,o,a,c),t.setTime(+t+u)):(t.setFullYear(r,n,i),t.setHours(s,o,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<r.length;++n)r[n].length<2&&(t+="0"),t+=r[n];return t+="Z"},i.dateToGeneralizedTime=function(e){if("string"===typeof e)return e;var t="",r=[];r.push(""+e.getUTCFullYear()),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<r.length;++n)r[n].length<2&&(t+="0"),t+=r[n];return t+="Z"},i.integerToDer=function(e){var t=n.util.createBuffer();if(e>=-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,s){var o=!1;if(e.tagClass!==t.tagClass&&"undefined"!==typeof t.tagClass||e.type!==t.type&&"undefined"!==typeof t.type)s&&(e.tagClass!==t.tagClass&&s.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&s.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||"undefined"===typeof t.constructed){if(o=!0,t.value&&n.util.isArray(t.value))for(var a=0,c=0;o&&c<t.value.length;++c)o=t.value[c].optional||!1,e.value[a]&&((o=i.validate(e.value[a],t.value[c],r,s))?++a:t.value[c].optional&&(o=!0)),!o&&s&&s.push("["+t.name+'] Tag class "'+t.tagClass+'", type "'+t.type+'" expected value length "'+t.value.length+'", got "'+e.value.length+'"');if(o&&r)if(t.capture&&(r[t.capture]=e.value),t.captureAsn1&&(r[t.captureAsn1]=e),t.captureBitStringContents&&"bitStringContents"in e&&(r[t.captureBitStringContents]=e.bitStringContents),t.captureBitStringValue&&"bitStringContents"in e)if(e.bitStringContents.length<2)r[t.captureBitStringValue]="";else{if(0!==e.bitStringContents.charCodeAt(0))throw new Error("captureBitStringValue only supported for zero unused bits");r[t.captureBitStringValue]=e.bitStringContents.slice(1)}}else s&&s.push("["+t.name+'] Expected constructed "'+t.constructed+'", got "'+e.constructed+'"');return o};var a=/[^\\u0000-\\u00ff]/;i.prettyPrint=function(e,t,r){var s="";r=r||2,(t=t||0)>0&&(s+="\n");for(var o="",c=0;c<t*r;++c)o+=" ";switch(s+=o+"Tag: ",e.tagClass){case i.Class.UNIVERSAL:s+="Universal:";break;case i.Class.APPLICATION:s+="Application:";break;case i.Class.CONTEXT_SPECIFIC:s+="Context-Specific:";break;case i.Class.PRIVATE:s+="Private:"}if(e.tagClass===i.Class.UNIVERSAL)switch(s+=e.type,e.type){case i.Type.NONE:s+=" (None)";break;case i.Type.BOOLEAN:s+=" (Boolean)";break;case i.Type.INTEGER:s+=" (Integer)";break;case i.Type.BITSTRING:s+=" (Bit string)";break;case i.Type.OCTETSTRING:s+=" (Octet string)";break;case i.Type.NULL:s+=" (Null)";break;case i.Type.OID:s+=" (Object Identifier)";break;case i.Type.ODESC:s+=" (Object Descriptor)";break;case i.Type.EXTERNAL:s+=" (External or Instance of)";break;case i.Type.REAL:s+=" (Real)";break;case i.Type.ENUMERATED:s+=" (Enumerated)";break;case i.Type.EMBEDDED:s+=" (Embedded PDV)";break;case i.Type.UTF8:s+=" (UTF8)";break;case i.Type.ROID:s+=" (Relative Object Identifier)";break;case i.Type.SEQUENCE:s+=" (Sequence)";break;case i.Type.SET:s+=" (Set)";break;case i.Type.PRINTABLESTRING:s+=" (Printable String)";break;case i.Type.IA5String:s+=" (IA5String (ASCII))";break;case i.Type.UTCTIME:s+=" (UTC time)";break;case i.Type.GENERALIZEDTIME:s+=" (Generalized time)";break;case i.Type.BMPSTRING:s+=" (BMP String)"}else s+=e.type;if(s+="\n",s+=o+"Constructed: "+e.constructed+"\n",e.composed){var u=0,l="";for(c=0;c<e.value.length;++c)void 0!==e.value[c]&&(u+=1,l+=i.prettyPrint(e.value[c],t+1,r),c+1<e.value.length&&(l+=","));s+=o+"Sub values: "+u+l}else{if(s+=o+"Value: ",e.type===i.Type.OID){var h=i.derToOid(e.value);s+=h,n.pki&&n.pki.oids&&h in n.pki.oids&&(s+=" ("+n.pki.oids[h]+") ")}if(e.type===i.Type.INTEGER)try{s+=i.derToInteger(e.value)}catch(f){s+="0x"+n.util.bytesToHex(e.value)}else if(e.type===i.Type.BITSTRING){if(e.value.length>1?s+="0x"+n.util.bytesToHex(e.value.slice(1)):s+="(none)",e.value.length>0){var d=e.value.charCodeAt(0);1==d?s+=" (1 unused bit shown)":d>1&&(s+=" ("+d+" unused bits shown)")}}else e.type===i.Type.OCTETSTRING?(a.test(e.value)||(s+="("+e.value+") "),s+="0x"+n.util.bytesToHex(e.value)):e.type===i.Type.UTF8?s+=n.util.decodeUtf8(e.value):e.type===i.Type.PRINTABLESTRING||e.type===i.Type.IA5String?s+=e.value:a.test(e.value)?s+="0x"+n.util.bytesToHex(e.value):0===e.value.length?s+="[null]":s+=e.value}return s}},91559:(e,t,r)=>{var n=r(82161).Buffer,i={};e.exports=i;var s={};i.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,s=t.length,o=t.charAt(0),a=[0];for(i=0;i<e.length;++i){for(var c=0,u=e[i];c<a.length;++c)u+=a[c]<<8,a[c]=u%s,u=u/s|0;for(;u>0;)a.push(u%s),u=u/s|0}for(i=0;0===e[i]&&i<e.length-1;++i)n+=o;for(i=a.length-1;i>=0;--i)n+=t[a[i]]}else n=function(e,t){var r=0,n=t.length,i=t.charAt(0),s=[0];for(r=0;r<e.length();++r){for(var o=0,a=e.at(r);o<s.length;++o)a+=s[o]<<8,s[o]=a%n,a=a/n|0;for(;a>0;)s.push(a%n),a=a/n|0}var c="";for(r=0;0===e.at(r)&&r<e.length()-1;++r)c+=i;for(r=s.length-1;r>=0;--r)c+=t[s[r]];return c}(e,t);if(r){var l=new RegExp(".{1,"+r+"}","g");n=n.match(l).join("\r\n")}return n},i.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 r=s[t];if(!r){r=s[t]=[];for(var i=0;i<t.length;++i)r[t.charCodeAt(i)]=i}e=e.replace(/\s/g,"");var o=t.length,a=t.charAt(0),c=[0];for(i=0;i<e.length;i++){var u=r[e.charCodeAt(i)];if(void 0===u)return;for(var l=0,h=u;l<c.length;++l)h+=c[l]*o,c[l]=255&h,h>>=8;for(;h>0;)c.push(255&h),h>>=8}for(var d=0;e[d]===a&&d<e.length-1;++d)c.push(0);return"undefined"!==typeof n?n.from(c.reverse()):new Uint8Array(c.reverse())}},89032:(e,t,r)=>{var n=r(98942);r(94384),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)))}},57300:(e,t,r)=>{var n=r(98942);r(94384),n.cipher=n.cipher||{};var i=e.exports=n.cipher.modes=n.cipher.modes||{};function s(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;i<r.length;++i)e.putByte(r[i])}if(e.length()<t)throw new Error("Invalid IV length; got "+e.length()+" bytes and expected "+t+" bytes.");if(!n.util.isArray(e)){var s=[],o=t/4;for(i=0;i<o;++i)s.push(e.getInt32());e=s}return e}function o(e){e[e.length-1]=e[e.length-1]+1&4294967295}function a(e){return[e/4294967296|0,4294967295&e]}i.ecb=function(e){e=e||{},this.name="ECB",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.ecb.prototype.start=function(e){},i.ecb.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(n=0;n<this._ints;++n)t.putInt32(this._outBlock[n])},i.ecb.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(n=0;n<this._ints;++n)t.putInt32(this._outBlock[n])},i.ecb.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},i.ecb.prototype.unpad=function(e,t){if(t.overflow>0)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=s(e.iv,this.blockSize),this._prev=this._iv.slice(0)}},i.cbc.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=this._prev[n]^e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(n=0;n<this._ints;++n)t.putInt32(this._outBlock[n]);this._prev=this._outBlock},i.cbc.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(n=0;n<this._ints;++n)t.putInt32(this._prev[n]^this._outBlock[n]);this._prev=this._inBlock.slice(0)},i.cbc.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},i.cbc.prototype.unpad=function(e,t){if(t.overflow>0)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=s(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;i<this._ints;++i)this._inBlock[i]=e.getInt32()^this._outBlock[i],t.putInt32(this._inBlock[i]);else{var s=(this.blockSize-n)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialBlock[i]=e.getInt32()^this._outBlock[i],this._partialOutput.putInt32(this._partialBlock[i]);if(s>0)e.read-=this.blockSize;else for(i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!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;i<this._ints;++i)this._inBlock[i]=e.getInt32(),t.putInt32(this._inBlock[i]^this._outBlock[i]);else{var s=(this.blockSize-n)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialBlock[i]=e.getInt32(),this._partialOutput.putInt32(this._partialBlock[i]^this._outBlock[i]);if(s>0)e.read-=this.blockSize;else for(i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!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=s(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;i<this._ints;++i)t.putInt32(e.getInt32()^this._outBlock[i]),this._inBlock[i]=this._outBlock[i];else{var s=(this.blockSize-n)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(s>0)e.read-=this.blockSize;else for(i=0;i<this._ints;++i)this._inBlock[i]=this._outBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!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=s(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;i<this._ints;++i)t.putInt32(e.getInt32()^this._outBlock[i]);else{var s=(this.blockSize-n)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(s>0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}o(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),o(this._inBlock),this._partialBytes=0,t=n.util.createBuffer(t),this._aDataLength=a(8*t.length());var s=t.length()%this.blockSize;for(s&&t.fillWithByte(0,this.blockSize-s),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;i<this._ints;++i)t.putInt32(this._outBlock[i]^=e.getInt32());this._cipherLength+=this.blockSize}else{var s=(this.blockSize-n)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(s<=0||r){if(r){var a=n%this.blockSize;this._cipherLength+=a,this._partialOutput.truncate(this.blockSize-a)}else this._cipherLength+=this.blockSize;for(i=0;i<this._ints;++i)this._outBlock[i]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),o(this._inBlock)},i.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n<this.blockSize&&!(r&&n>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),o(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;i<this._ints;++i)t.putInt32(this._outBlock[i]^this._hashBlock[i]);n<this.blockSize?this._cipherLength+=n%this.blockSize:this._cipherLength+=this.blockSize},i.gcm.prototype.afterFinish=function(e,t){var r=!0;t.decrypt&&t.overflow&&e.truncate(this.blockSize-t.overflow),this.tag=n.util.createBuffer();var i=this._aDataLength.concat(a(8*this._cipherLength));this._s=this.ghash(this._hashSubkey,this._s,i);var s=[];this.cipher.encrypt(this._j0,s);for(var o=0;o<this._ints;++o)this.tag.putInt32(this._s[o]^s[o]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),t.decrypt&&this.tag.bytes()!==this._tag&&(r=!1),r},i.gcm.prototype.multiply=function(e,t){for(var r=[0,0,0,0],n=t.slice(0),i=0;i<128;++i){e[i/32|0]&1<<31-i%32&&(r[0]^=n[0],r[1]^=n[1],r[2]^=n[2],r[3]^=n[3]),this.pow(n,n)}return r},i.gcm.prototype.pow=function(e,t){for(var r=1&e[3],n=3;n>0;--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,s=new Array(i),o=0;o<i;++o){var a=[0,0,0,0],c=(n-1-o%n)*t;a[o/n|0]=1<<t-1<<c,s[o]=this.generateSubHashTable(this.multiply(a,e),t)}return s},i.gcm.prototype.generateSubHashTable=function(e,t){var r=1<<t,n=r>>>1,i=new Array(r);i[n]=e.slice(0);for(var s=n>>>1;s>0;)this.pow(i[2*s],i[s]=[]),s>>=1;for(s=2;s<n;){for(var o=1;o<s;++o){var a=i[s],c=i[o];i[s+o]=[a[0]^c[0],a[1]^c[1],a[2]^c[2],a[3]^c[3]]}s*=2}for(i[0]=[0,0,0,0],s=n+1;s<r;++s){var u=i[s^n];i[s]=[e[0]^u[0],e[1]^u[1],e[2]^u[2],e[3]^u[3]]}return i}},69530:(e,t,r)=>{var n=r(98942);function i(e,t){n.cipher.registerAlgorithm(e,(function(){return new n.des.Algorithm(e,t)}))}r(89032),r(57300),r(94384),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 f(r._keys,e,t,!1)},decrypt:function(e,t){return f(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],s=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],o=[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],l=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],h=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],d=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],f=[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,m=[],v=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,w=0;w<g;w++){var E=e.getInt32(),S=e.getInt32();E^=(t=252645135&(E>>>4^S))<<4,E^=t=65535&((S^=t)>>>-16^E),E^=(t=858993459&(E>>>2^(S^=t<<-16)))<<2,E^=t=65535&((S^=t)>>>-16^E),E^=(t=1431655765&(E>>>1^(S^=t<<-16)))<<1,E^=t=16711935&((S^=t)>>>8^E),t=(E^=(t=1431655765&(E>>>1^(S^=t<<8)))<<1)<<8|(S^=t)>>>20&240,E=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=t;for(var _=0;_<v.length;++_){v[_]?(E=E<<2|E>>>26,S=S<<2|S>>>26):(E=E<<1|E>>>27,S=S<<1|S>>>27),S&=-15;var I=r[(E&=-15)>>>28]|n[E>>>24&15]|i[E>>>20&15]|s[E>>>16&15]|o[E>>>12&15]|a[E>>>8&15]|c[E>>>4&15],T=u[S>>>28]|l[S>>>24&15]|h[S>>>20&15]|d[S>>>16&15]|f[S>>>12&15]|p[S>>>8&15]|y[S>>>4&15];t=65535&(T>>>16^I),m[b++]=I^t,m[b++]=T^t<<16}}return m}(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 s=[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],o=[-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],l=[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],h=[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],d=[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 f(e,t,r,n){var i,f,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^=(f=252645135&(y>>>4^g))<<4,y^=(f=65535&(y>>>16^(g^=f)))<<16,y^=f=858993459&((g^=f)>>>2^y),y^=f=16711935&((g^=f<<2)>>>8^y),y=(y^=(f=1431655765&(y>>>1^(g^=f<<8)))<<1)<<1|y>>>31,g=(g^=f)<<1|g>>>31;for(var m=0;m<p;m+=3){for(var v=i[m+1],b=i[m+2],w=i[m];w!=v;w+=b){var E=g^e[w],S=(g>>>4|g<<28)^e[w+1];f=y,y=g,g=f^(o[E>>>24&63]|c[E>>>16&63]|l[E>>>8&63]|d[63&E]|s[S>>>24&63]|a[S>>>16&63]|u[S>>>8&63]|h[63&S])}f=y,y=g,g=f}g=g>>>1|g<<31,g^=f=1431655765&((y=y>>>1|y<<31)>>>1^g),g^=(f=16711935&(g>>>8^(y^=f<<1)))<<8,g^=(f=858993459&(g>>>2^(y^=f)))<<2,g^=f=65535&((y^=f)>>>16^g),g^=f=252645135&((y^=f<<16)>>>4^g),y^=f<<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 s=null;r instanceof n.util.ByteBuffer&&(s=r,r={}),(r=r||{}).output=s,r.iv=e,i.call(t,r)},t}},98942:e=>{e.exports={options:{usePureJavaScript:!1}}},25547:(e,t,r)=>{var n=r(98942);r(73547),r(94384),(e.exports=n.hmac=n.hmac||{}).create=function(){var e=null,t=null,r=null,i=null,s={start:function(s,o){if(null!==s)if("string"===typeof s){if(!((s=s.toLowerCase())in n.md.algorithms))throw new Error('Unknown hash algorithm "'+s+'"');t=n.md.algorithms[s].create()}else t=s;if(null===o)o=e;else{if("string"===typeof o)o=n.util.createBuffer(o);else if(n.util.isArray(o)){var a=o;o=n.util.createBuffer();for(var c=0;c<a.length;++c)o.putByte(a[c])}var u=o.length();u>t.blockLength&&(t.start(),t.update(o.bytes()),o=t.digest()),r=n.util.createBuffer(),i=n.util.createBuffer(),u=o.length();for(c=0;c<u;++c){a=o.at(c);r.putByte(54^a),i.putByte(92^a)}if(u<t.blockLength)for(a=t.blockLength-u,c=0;c<a;++c)r.putByte(54),i.putByte(92);e=o,r=r.bytes(),i=i.bytes()}t.start(),t.update(r)},update:function(e){t.update(e)},getMac:function(){var e=t.digest().bytes();return t.start(),t.update(i),t.update(e),t.digest()}};return s.digest=s.getMac,s}},70217:(e,t,r)=>{var n,i=r(98942);e.exports=i.jsbn=i.jsbn||{};function s(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 o(){return new s(null)}function a(e,t,r,n,i,s){for(var o=16383&t,a=t>>14;--s>=0;){var c=16383&this.data[e],u=this.data[e++]>>14,l=a*c+u*o;i=((c=o*c+((16383&l)<<14)+r.data[n]+i)>>28)+(l>>14)+a*u,r.data[n++]=268435455&c}return i}i.jsbn.BigInteger=s,"undefined"===typeof navigator?(s.prototype.am=a,n=28):"Microsoft Internet Explorer"==navigator.appName?(s.prototype.am=function(e,t,r,n,i,s){for(var o=32767&t,a=t>>15;--s>=0;){var c=32767&this.data[e],u=this.data[e++]>>15,l=a*c+u*o;i=((c=o*c+((32767&l)<<15)+r.data[n]+(1073741823&i))>>>30)+(l>>>15)+a*u+(i>>>30),r.data[n++]=1073741823&c}return i},n=30):"Netscape"!=navigator.appName?(s.prototype.am=function(e,t,r,n,i,s){for(;--s>=0;){var o=t*this.data[e++]+r.data[n]+i;i=Math.floor(o/67108864),r.data[n++]=67108863&o}return i},n=26):(s.prototype.am=a,n=28),s.prototype.DB=n,s.prototype.DM=(1<<n)-1,s.prototype.DV=1<<n;s.prototype.FV=Math.pow(2,52),s.prototype.F1=52-n,s.prototype.F2=2*n-52;var c,u,l=new Array;for(c="0".charCodeAt(0),u=0;u<=9;++u)l[c++]=u;for(c="a".charCodeAt(0),u=10;u<36;++u)l[c++]=u;for(c="A".charCodeAt(0),u=10;u<36;++u)l[c++]=u;function h(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function d(e,t){var r=l[e.charCodeAt(t)];return null==r?-1:r}function f(e){var t=o();return t.fromInt(e),t}function p(e){var t,r=1;return 0!=(t=e>>>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<<e.DB-15)-1,this.mt2=2*e.t}function m(e,t){return e&t}function v(e,t){return e|t}function b(e,t){return e^t}function w(e,t){return e&~t}function E(e){if(0==e)return-1;var t=0;return 0==(65535&e)&&(e>>=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 S(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function _(){}function I(e){return e}function T(e){this.r2=o(),this.q3=o(),s.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=o();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(s.ZERO)>0&&this.m.subTo(t,t),t},g.prototype.revert=function(e){var t=o();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<this.m.t;++t){var r=32767&e.data[t],n=r*this.mpl+((r*this.mph+(e.data[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)},s.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},s.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},s.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,o=0;--n>=0;){var a=8==r?255&e[n]:d(e,n);a<0?"-"==e.charAt(n)&&(i=!0):(i=!1,0==o?this.data[this.t++]=a:o+r>this.DB?(this.data[this.t-1]|=(a&(1<<this.DB-o)-1)<<o,this.data[this.t++]=a>>this.DB-o):this.data[this.t-1]|=a<<o,(o+=r)>=this.DB&&(o-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),i&&s.ZERO.subTo(this,this)},s.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this.data[this.t-1]==e;)--this.t},s.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},s.prototype.drShiftTo=function(e,t){for(var r=e;r<this.t;++r)t.data[r-e]=this.data[r];t.t=Math.max(this.t-e,0),t.s=this.s},s.prototype.lShiftTo=function(e,t){var r,n=e%this.DB,i=this.DB-n,s=(1<<i)-1,o=Math.floor(e/this.DB),a=this.s<<n&this.DM;for(r=this.t-1;r>=0;--r)t.data[r+o+1]=this.data[r]>>i|a,a=(this.data[r]&s)<<n;for(r=o-1;r>=0;--r)t.data[r]=0;t.data[o]=a,t.t=this.t+o+1,t.s=this.s,t.clamp()},s.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,s=(1<<n)-1;t.data[0]=this.data[r]>>n;for(var o=r+1;o<this.t;++o)t.data[o-r-1]|=(this.data[o]&s)<<i,t.data[o-r]=this.data[o]>>n;n>0&&(t.data[this.t-r-1]|=(this.s&s)<<i),t.t=this.t-r,t.clamp()}},s.prototype.subTo=function(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this.data[r]-e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n-=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n-=e.data[r],t.data[r++]=n&this.DM,n>>=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()},s.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<n.t;++i)t.data[i+r.t]=r.am(0,n.data[i],t,i,0,r.t);t.s=0,t.clamp(),this.s!=e.s&&s.ZERO.subTo(t,t)},s.prototype.squareTo=function(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e.data[r]=0;for(r=0;r<t.t-1;++r){var n=t.am(r,t.data[r],e,2*r,0,1);(e.data[r+t.t]+=t.am(r+1,2*t.data[r],e,2*r+1,n,t.t-r-1))>=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()},s.prototype.divRemTo=function(e,t,r){var n=e.abs();if(!(n.t<=0)){var i=this.abs();if(i.t<n.t)return null!=t&&t.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=o());var a=o(),c=this.s,u=e.s,l=this.DB-p(n.data[n.t-1]);l>0?(n.lShiftTo(l,a),i.lShiftTo(l,r)):(n.copyTo(a),i.copyTo(r));var h=a.t,d=a.data[h-1];if(0!=d){var f=d*(1<<this.F1)+(h>1?a.data[h-2]>>this.F2:0),y=this.FV/f,g=(1<<this.F1)/f,m=1<<this.F2,v=r.t,b=v-h,w=null==t?o():t;for(a.dlShiftTo(b,w),r.compareTo(w)>=0&&(r.data[r.t++]=1,r.subTo(w,r)),s.ONE.dlShiftTo(h,w),w.subTo(a,a);a.t<h;)a.data[a.t++]=0;for(;--b>=0;){var E=r.data[--v]==d?this.DM:Math.floor(r.data[v]*y+(r.data[v-1]+m)*g);if((r.data[v]+=a.am(0,E,r,b,0,h))<E)for(a.dlShiftTo(b,w),r.subTo(w,r);r.data[v]<--E;)r.subTo(w,r)}null!=t&&(r.drShiftTo(h,t),c!=u&&s.ZERO.subTo(t,t)),r.t=h,r.clamp(),l>0&&r.rShiftTo(l,r),c<0&&s.ZERO.subTo(r,r)}}},s.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},s.prototype.isEven=function(){return 0==(this.t>0?1&this.data[0]:this.s)},s.prototype.exp=function(e,t){if(e>4294967295||e<1)return s.ONE;var r=o(),n=o(),i=t.convert(this),a=p(e)-1;for(i.copyTo(r);--a>=0;)if(t.sqrTo(r,n),(e&1<<a)>0)t.mulTo(n,i,r);else{var c=r;r=n,n=c}return t.revert(r)},s.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<<t)-1,i=!1,s="",o=this.t,a=this.DB-o*this.DB%t;if(o-- >0)for(a<this.DB&&(r=this.data[o]>>a)>0&&(i=!0,s=h(r));o>=0;)a<t?(r=(this.data[o]&(1<<a)-1)<<t-a,r|=this.data[--o]>>(a+=this.DB-t)):(r=this.data[o]>>(a-=t)&n,a<=0&&(a+=this.DB,--o)),r>0&&(i=!0),i&&(s+=h(r));return i?s:"0"},s.prototype.negate=function(){var e=o();return s.ZERO.subTo(this,e),e},s.prototype.abs=function(){return this.s<0?this.negate():this},s.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},s.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+p(this.data[this.t-1]^this.s&this.DM)},s.prototype.mod=function(e){var t=o();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(s.ZERO)>0&&e.subTo(t,t),t},s.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new y(t):new g(t),this.exp(e,r)},s.ZERO=f(0),s.ONE=f(1),_.prototype.convert=I,_.prototype.revert=I,_.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},_.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=o();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 A=[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)/A[A.length-1];s.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},s.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=f(r),i=o(),s=o(),a="";for(this.divRemTo(n,i,s);i.signum()>0;)a=(r+s.intValue()).toString(e).substr(1)+a,i.divRemTo(n,i,s);return s.intValue().toString(e)+a},s.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,o=0,a=0,c=0;c<e.length;++c){var u=d(e,c);u<0?"-"==e.charAt(c)&&0==this.signum()&&(i=!0):(a=t*a+u,++o>=r&&(this.dMultiply(n),this.dAddOffset(a,0),o=0,a=0))}o>0&&(this.dMultiply(Math.pow(t,o)),this.dAddOffset(a,0)),i&&s.ZERO.subTo(this,this)},s.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(s.ONE.shiftLeft(e-1),v,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(s.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<<i)-1:n[0]=0,this.fromString(n,256)}},s.prototype.bitwiseTo=function(e,t,r){var n,i,s=Math.min(e.t,this.t);for(n=0;n<s;++n)r.data[n]=t(this.data[n],e.data[n]);if(e.t<this.t){for(i=e.s&this.DM,n=s;n<this.t;++n)r.data[n]=t(this.data[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=s;n<e.t;++n)r.data[n]=t(i,e.data[n]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()},s.prototype.changeBit=function(e,t){var r=s.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r},s.prototype.addTo=function(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this.data[r]+e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n+=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n+=e.data[r],t.data[r++]=n&this.DM,n>>=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()},s.prototype.dMultiply=function(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},s.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]}},s.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<n;++i)r.data[i+this.t]=this.am(0,e.data[i],r,i,0,this.t);for(n=Math.min(e.t,t);i<n;++i)this.am(0,e.data[i],r,i,0,t-i);r.clamp()},s.prototype.multiplyUpperTo=function(e,t,r){--t;var n=r.t=this.t+e.t-t;for(r.s=0;--n>=0;)r.data[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)r.data[this.t+n-t]=this.am(t-n,e.data[n],r,0,0,this.t+n-t);r.clamp(),r.drShiftTo(1,r)},s.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)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},s.prototype.millerRabin=function(e){var t=this.subtract(s.ONE),r=t.getLowestSetBit();if(r<=0)return!1;for(var n,i=t.shiftRight(r),o={nextBytes:function(e){for(var t=0;t<e.length;++t)e[t]=Math.floor(256*Math.random())}},a=0;a<e;++a){do{n=new s(this.bitLength(),o)}while(n.compareTo(s.ONE)<=0||n.compareTo(t)>=0);var c=n.modPow(i,this);if(0!=c.compareTo(s.ONE)&&0!=c.compareTo(t)){for(var u=1;u++<r&&0!=c.compareTo(t);)if(0==(c=c.modPowInt(2,this)).compareTo(s.ONE))return!1;if(0!=c.compareTo(t))return!1}}return!0},s.prototype.clone=function(){var e=o();return this.copyTo(e),e},s.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]},s.prototype.byteValue=function(){return 0==this.t?this.s:this.data[0]<<24>>24},s.prototype.shortValue=function(){return 0==this.t?this.s:this.data[0]<<16>>16},s.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1},s.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<this.DB&&(r=this.data[e]>>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<<this.DB-n);e>=0;)n<8?(r=(this.data[e]&(1<<n)-1)<<8-n,r|=this.data[--e]>>(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},s.prototype.equals=function(e){return 0==this.compareTo(e)},s.prototype.min=function(e){return this.compareTo(e)<0?this:e},s.prototype.max=function(e){return this.compareTo(e)>0?this:e},s.prototype.and=function(e){var t=o();return this.bitwiseTo(e,m,t),t},s.prototype.or=function(e){var t=o();return this.bitwiseTo(e,v,t),t},s.prototype.xor=function(e){var t=o();return this.bitwiseTo(e,b,t),t},s.prototype.andNot=function(e){var t=o();return this.bitwiseTo(e,w,t),t},s.prototype.not=function(){for(var e=o(),t=0;t<this.t;++t)e.data[t]=this.DM&~this.data[t];return e.t=this.t,e.s=~this.s,e},s.prototype.shiftLeft=function(e){var t=o();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},s.prototype.shiftRight=function(e){var t=o();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},s.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this.data[e])return e*this.DB+E(this.data[e]);return this.s<0?this.t*this.DB:-1},s.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=S(this.data[r]^t);return e},s.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:0!=(this.data[t]&1<<e%this.DB)},s.prototype.setBit=function(e){return this.changeBit(e,v)},s.prototype.clearBit=function(e){return this.changeBit(e,w)},s.prototype.flipBit=function(e){return this.changeBit(e,b)},s.prototype.add=function(e){var t=o();return this.addTo(e,t),t},s.prototype.subtract=function(e){var t=o();return this.subTo(e,t),t},s.prototype.multiply=function(e){var t=o();return this.multiplyTo(e,t),t},s.prototype.divide=function(e){var t=o();return this.divRemTo(e,t,null),t},s.prototype.remainder=function(e){var t=o();return this.divRemTo(e,null,t),t},s.prototype.divideAndRemainder=function(e){var t=o(),r=o();return this.divRemTo(e,t,r),new Array(t,r)},s.prototype.modPow=function(e,t){var r,n,i=e.bitLength(),s=f(1);if(i<=0)return s;r=i<18?1:i<48?3:i<144?4:i<768?5:6,n=i<8?new y(t):t.isEven()?new T(t):new g(t);var a=new Array,c=3,u=r-1,l=(1<<r)-1;if(a[1]=n.convert(this),r>1){var h=o();for(n.sqrTo(a[1],h);c<=l;)a[c]=o(),n.mulTo(h,a[c-2],a[c]),c+=2}var d,m,v=e.t-1,b=!0,w=o();for(i=p(e.data[v])-1;v>=0;){for(i>=u?d=e.data[v]>>i-u&l:(d=(e.data[v]&(1<<i+1)-1)<<u-i,v>0&&(d|=e.data[v-1]>>this.DB+i-u)),c=r;0==(1&d);)d>>=1,--c;if((i-=c)<0&&(i+=this.DB,--v),b)a[d].copyTo(s),b=!1;else{for(;c>1;)n.sqrTo(s,w),n.sqrTo(w,s),c-=2;c>0?n.sqrTo(s,w):(m=s,s=w,w=m),n.mulTo(w,a[d],s)}for(;v>=0&&0==(e.data[v]&1<<i);)n.sqrTo(s,w),m=s,s=w,w=m,--i<0&&(i=this.DB-1,--v)}return n.revert(s)},s.prototype.modInverse=function(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return s.ZERO;for(var r=e.clone(),n=this.clone(),i=f(1),o=f(0),a=f(0),c=f(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),t?(i.isEven()&&o.isEven()||(i.addTo(this,i),o.subTo(e,o)),i.rShiftTo(1,i)):o.isEven()||o.subTo(e,o),o.rShiftTo(1,o);for(;n.isEven();)n.rShiftTo(1,n),t?(a.isEven()&&c.isEven()||(a.addTo(this,a),c.subTo(e,c)),a.rShiftTo(1,a)):c.isEven()||c.subTo(e,c),c.rShiftTo(1,c);r.compareTo(n)>=0?(r.subTo(n,r),t&&i.subTo(a,i),o.subTo(c,o)):(n.subTo(r,n),t&&a.subTo(i,a),c.subTo(o,c))}return 0!=n.compareTo(s.ONE)?s.ZERO:c.compareTo(e)>=0?c.subtract(e):c.signum()<0?(c.addTo(e,c),c.signum()<0?c.add(e):c):c},s.prototype.pow=function(e){return this.exp(e,new _)},s.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(),s=r.getLowestSetBit();if(s<0)return t;for(i<s&&(s=i),s>0&&(t.rShiftTo(s,t),r.rShiftTo(s,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 s>0&&r.lShiftTo(s,r),r},s.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r.data[0]<=A[A.length-1]){for(t=0;t<A.length;++t)if(r.data[0]==A[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<A.length;){for(var n=A[t],i=t+1;i<A.length&&n<C;)n*=A[i++];for(n=r.modInt(n);t<i;)if(n%A[t++]==0)return!1}return r.millerRabin(e)}},73547:(e,t,r)=>{var n=r(98942);e.exports=n.md=n.md||{},n.md.algorithms=n.md.algorithms||{}},54300:(e,t,r)=>{var n=r(98942);n.pki=n.pki||{};var i=e.exports=n.pki.oids=n.oids=n.oids||{};function s(e,t){i[e]=t,i[t]=e}function o(e,t){i[e]=t}s("1.2.840.113549.1.1.1","rsaEncryption"),s("1.2.840.113549.1.1.4","md5WithRSAEncryption"),s("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),s("1.2.840.113549.1.1.7","RSAES-OAEP"),s("1.2.840.113549.1.1.8","mgf1"),s("1.2.840.113549.1.1.9","pSpecified"),s("1.2.840.113549.1.1.10","RSASSA-PSS"),s("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),s("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),s("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),s("1.3.101.112","EdDSA25519"),s("1.2.840.10040.4.3","dsa-with-sha1"),s("1.3.14.3.2.7","desCBC"),s("1.3.14.3.2.26","sha1"),s("1.3.14.3.2.29","sha1WithRSASignature"),s("2.16.840.1.101.3.4.2.1","sha256"),s("2.16.840.1.101.3.4.2.2","sha384"),s("2.16.840.1.101.3.4.2.3","sha512"),s("1.2.840.113549.2.5","md5"),s("1.2.840.113549.1.7.1","data"),s("1.2.840.113549.1.7.2","signedData"),s("1.2.840.113549.1.7.3","envelopedData"),s("1.2.840.113549.1.7.4","signedAndEnvelopedData"),s("1.2.840.113549.1.7.5","digestedData"),s("1.2.840.113549.1.7.6","encryptedData"),s("1.2.840.113549.1.9.1","emailAddress"),s("1.2.840.113549.1.9.2","unstructuredName"),s("1.2.840.113549.1.9.3","contentType"),s("1.2.840.113549.1.9.4","messageDigest"),s("1.2.840.113549.1.9.5","signingTime"),s("1.2.840.113549.1.9.6","counterSignature"),s("1.2.840.113549.1.9.7","challengePassword"),s("1.2.840.113549.1.9.8","unstructuredAddress"),s("1.2.840.113549.1.9.14","extensionRequest"),s("1.2.840.113549.1.9.20","friendlyName"),s("1.2.840.113549.1.9.21","localKeyId"),s("1.2.840.113549.1.9.22.1","x509Certificate"),s("1.2.840.113549.1.12.10.1.1","keyBag"),s("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),s("1.2.840.113549.1.12.10.1.3","certBag"),s("1.2.840.113549.1.12.10.1.4","crlBag"),s("1.2.840.113549.1.12.10.1.5","secretBag"),s("1.2.840.113549.1.12.10.1.6","safeContentsBag"),s("1.2.840.113549.1.5.13","pkcs5PBES2"),s("1.2.840.113549.1.5.12","pkcs5PBKDF2"),s("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),s("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),s("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),s("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),s("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),s("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),s("1.2.840.113549.2.7","hmacWithSHA1"),s("1.2.840.113549.2.8","hmacWithSHA224"),s("1.2.840.113549.2.9","hmacWithSHA256"),s("1.2.840.113549.2.10","hmacWithSHA384"),s("1.2.840.113549.2.11","hmacWithSHA512"),s("1.2.840.113549.3.7","des-EDE3-CBC"),s("2.16.840.1.101.3.4.1.2","aes128-CBC"),s("2.16.840.1.101.3.4.1.22","aes192-CBC"),s("2.16.840.1.101.3.4.1.42","aes256-CBC"),s("2.5.4.3","commonName"),s("2.5.4.4","surname"),s("2.5.4.5","serialNumber"),s("2.5.4.6","countryName"),s("2.5.4.7","localityName"),s("2.5.4.8","stateOrProvinceName"),s("2.5.4.9","streetAddress"),s("2.5.4.10","organizationName"),s("2.5.4.11","organizationalUnitName"),s("2.5.4.12","title"),s("2.5.4.13","description"),s("2.5.4.15","businessCategory"),s("2.5.4.17","postalCode"),s("2.5.4.42","givenName"),s("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),s("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),s("2.16.840.1.113730.1.1","nsCertType"),s("2.16.840.1.113730.1.13","nsComment"),o("2.5.29.1","authorityKeyIdentifier"),o("2.5.29.2","keyAttributes"),o("2.5.29.3","certificatePolicies"),o("2.5.29.4","keyUsageRestriction"),o("2.5.29.5","policyMapping"),o("2.5.29.6","subtreesConstraint"),o("2.5.29.7","subjectAltName"),o("2.5.29.8","issuerAltName"),o("2.5.29.9","subjectDirectoryAttributes"),o("2.5.29.10","basicConstraints"),o("2.5.29.11","nameConstraints"),o("2.5.29.12","policyConstraints"),o("2.5.29.13","basicConstraints"),s("2.5.29.14","subjectKeyIdentifier"),s("2.5.29.15","keyUsage"),o("2.5.29.16","privateKeyUsagePeriod"),s("2.5.29.17","subjectAltName"),s("2.5.29.18","issuerAltName"),s("2.5.29.19","basicConstraints"),o("2.5.29.20","cRLNumber"),o("2.5.29.21","cRLReason"),o("2.5.29.22","expirationDate"),o("2.5.29.23","instructionCode"),o("2.5.29.24","invalidityDate"),o("2.5.29.25","cRLDistributionPoints"),o("2.5.29.26","issuingDistributionPoint"),o("2.5.29.27","deltaCRLIndicator"),o("2.5.29.28","issuingDistributionPoint"),o("2.5.29.29","certificateIssuer"),o("2.5.29.30","nameConstraints"),s("2.5.29.31","cRLDistributionPoints"),s("2.5.29.32","certificatePolicies"),o("2.5.29.33","policyMappings"),o("2.5.29.34","policyConstraints"),s("2.5.29.35","authorityKeyIdentifier"),o("2.5.29.36","policyConstraints"),s("2.5.29.37","extKeyUsage"),o("2.5.29.46","freshestCRL"),o("2.5.29.54","inhibitAnyPolicy"),s("1.3.6.1.4.1.11129.2.4.2","timestampList"),s("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),s("1.3.6.1.5.5.7.3.1","serverAuth"),s("1.3.6.1.5.5.7.3.2","clientAuth"),s("1.3.6.1.5.5.7.3.3","codeSigning"),s("1.3.6.1.5.5.7.3.4","emailProtection"),s("1.3.6.1.5.5.7.3.8","timeStamping")},37202:(e,t,r)=>{var n=r(98942);if(r(40110),r(20759),r(69530),r(73547),r(54300),r(27033),r(88059),r(3688),r(59857),r(46712),r(94384),"undefined"===typeof i)var i=n.jsbn.BigInteger;var s=n.asn1,o=n.pki=n.pki||{};e.exports=o.pbe=n.pbe=n.pbe||{};var a=o.oids,c={name:"EncryptedPrivateKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",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:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},u={name:"PBES2Algorithms",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},l={name:"pkcs-12PbeParams",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"iterations"}]};function h(e,t){return e.start().update(t).digest().getBytes()}function d(e){var t;if(e){if(!(t=o.oids[s.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 f(t)}function f(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()}o.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,l=n.random.getBytesSync(r.saltSize),h=r.count,d=s.integerToDer(h);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(S=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,S}var m="hmacWith"+r.prfAlgorithm.toUpperCase(),v=f(m),b=n.pkcs5.pbkdf2(t,l,h,i,v),w=n.random.getBytesSync(p);(_=g(b)).start(w),_.update(s.toDer(e)),_.finish(),u=_.output.getBytes();var E=function(e,t,r,i){var a=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,e),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,t.getBytes())]);"hmacWithSHA1"!==i&&a.value.push(s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,n.util.hexToBytes(r.toString(16))),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(o.oids[i]).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,"")]));return a}(l,d,i,m);c=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(a.pkcs5PBES2).getBytes()),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(a.pkcs5PBKDF2).getBytes()),E]),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(y).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,w)])])])}else{var S;if("3des"!==r.algorithm)throw(S=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,S;i=24;var _,I=new n.util.ByteBuffer(l);b=o.pbe.generatePkcs12Key(t,I,1,h,i),w=o.pbe.generatePkcs12Key(t,I,2,h,i);(_=n.des.createEncryptionCipher(b)).start(w),_.update(s.toDer(e)),_.finish(),u=_.output.getBytes(),c=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(a["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,l),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,d.getBytes())])])}return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[c,s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,u)])},o.decryptPrivateKeyInfo=function(e,t){var r=null,i={},a=[];if(!s.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 l=s.derToOid(i.encryptionOid),h=o.pbe.getCipher(l,i.encryptionParams,t),d=n.util.createBuffer(i.encryptedData);return h.update(d),h.finish()&&(r=s.fromDer(h.output)),r},o.encryptedPrivateKeyToPem=function(e,t){var r={type:"ENCRYPTED PRIVATE KEY",body:s.toDer(e).getBytes()};return n.pem.encode(r,{maxline:t})},o.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 s.fromDer(t.body)},o.encryptRsaPrivateKey=function(e,t,r){if(!(r=r||{}).legacy){var i=o.wrapRsaPrivateKey(o.privateKeyToAsn1(e));return i=o.encryptPrivateKeyInfo(i,t,r),o.encryptedPrivateKeyToPem(i)}var a,c,u,l;switch(r.algorithm){case"aes128":a="AES-128-CBC",u=16,c=n.random.getBytesSync(16),l=n.aes.createEncryptionCipher;break;case"aes192":a="AES-192-CBC",u=24,c=n.random.getBytesSync(16),l=n.aes.createEncryptionCipher;break;case"aes256":a="AES-256-CBC",u=32,c=n.random.getBytesSync(16),l=n.aes.createEncryptionCipher;break;case"3des":a="DES-EDE3-CBC",u=24,c=n.random.getBytesSync(8),l=n.des.createEncryptionCipher;break;case"des":a="DES-CBC",u=8,c=n.random.getBytesSync(8),l=n.des.createEncryptionCipher;break;default:var h=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+r.algorithm+'".');throw h.algorithm=r.algorithm,h}var d=l(n.pbe.opensslDeriveBytes(t,c.substr(0,8),u));d.start(c),d.update(s.toDer(o.privateKeyToAsn1(e))),d.finish();var f={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:a,parameters:n.util.bytesToHex(c).toUpperCase()},body:d.output.getBytes()};return n.pem.encode(f)},o.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 l=n.util.hexToBytes(i.dekInfo.parameters),h=c(n.pbe.opensslDeriveBytes(t,l.substr(0,8),a));if(h.start(l),h.update(n.util.createBuffer(i.body)),!h.finish())return r;r=h.output.getBytes()}else r=i.body;return null!==(r="ENCRYPTED PRIVATE KEY"===i.type?o.decryptPrivateKeyInfo(s.fromDer(r),t):s.fromDer(r))&&(r=o.privateKeyFromAsn1(r)),r},o.pbe.generatePkcs12Key=function(e,t,r,i,s,o){var a,c;if("undefined"===typeof o||null===o){if(!("sha1"in n.md))throw new Error('"sha1" hash algorithm unavailable.');o=n.md.sha1.create()}var u=o.digestLength,l=o.blockLength,h=new n.util.ByteBuffer,d=new n.util.ByteBuffer;if(null!==e&&void 0!==e){for(c=0;c<e.length;c++)d.putInt16(e.charCodeAt(c));d.putInt16(0)}var f=d.length(),p=t.length(),y=new n.util.ByteBuffer;y.fillWithByte(r,l);var g=l*Math.ceil(p/l),m=new n.util.ByteBuffer;for(c=0;c<g;c++)m.putByte(t.at(c%p));var v=l*Math.ceil(f/l),b=new n.util.ByteBuffer;for(c=0;c<v;c++)b.putByte(d.at(c%f));var w=m;w.putBuffer(b);for(var E=Math.ceil(s/u),S=1;S<=E;S++){var _=new n.util.ByteBuffer;_.putBytes(y.bytes()),_.putBytes(w.bytes());for(var I=0;I<i;I++)o.start(),o.update(_.getBytes()),_=o.digest();var T=new n.util.ByteBuffer;for(c=0;c<l;c++)T.putByte(_.at(c%u));var A=Math.ceil(p/l)+Math.ceil(f/l),C=new n.util.ByteBuffer;for(a=0;a<A;a++){var R=new n.util.ByteBuffer(w.getBytes(l)),P=511;for(c=T.length()-1;c>=0;c--)P>>=8,P+=T.at(c)+R.at(c),R.setAt(c,255&P);C.putBuffer(R)}w=C,h.putBuffer(_)}return h.truncate(h.length()-s),h},o.pbe.getCipher=function(e,t,r){switch(e){case o.oids.pkcs5PBES2:return o.pbe.getCipherForPBES2(e,t,r);case o.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case o.oids["pbewithSHAAnd40BitRC2-CBC"]:return o.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}},o.pbe.getCipherForPBES2=function(e,t,r){var i,a={},c=[];if(!s.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=s.derToOid(a.kdfOid))!==o.oids.pkcs5PBKDF2)throw(i=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.")).oid=e,i.supportedOids=["pkcs5PBKDF2"],i;if((e=s.derToOid(a.encOid))!==o.oids["aes128-CBC"]&&e!==o.oids["aes192-CBC"]&&e!==o.oids["aes256-CBC"]&&e!==o.oids["des-EDE3-CBC"]&&e!==o.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 l,h,f=a.kdfSalt,p=n.util.createBuffer(a.kdfIterationCount);switch(p=p.getInt(p.length()<<3),o.oids[e]){case"aes128-CBC":l=16,h=n.aes.createDecryptionCipher;break;case"aes192-CBC":l=24,h=n.aes.createDecryptionCipher;break;case"aes256-CBC":l=32,h=n.aes.createDecryptionCipher;break;case"des-EDE3-CBC":l=24,h=n.des.createDecryptionCipher;break;case"desCBC":l=8,h=n.des.createDecryptionCipher}var y=d(a.prfOid),g=n.pkcs5.pbkdf2(r,f,p,l,y),m=a.encIv,v=h(g);return v.start(m),v},o.pbe.getCipherForPKCS12PBE=function(e,t,r){var i={},a=[];if(!s.validate(t,l,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,h,f=n.util.createBuffer(i.salt),p=n.util.createBuffer(i.iterations);switch(p=p.getInt(p.length()<<3),e){case o.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:c=24,u=8,h=n.des.startDecrypting;break;case o.oids["pbewithSHAAnd40BitRC2-CBC"]:c=5,u=8,h=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=d(i.prfOid),m=o.pbe.generatePkcs12Key(r,f,1,p,c,g);return g.start(),h(m,o.pbe.generatePkcs12Key(r,f,2,p,u,g))},o.pbe.opensslDeriveBytes=function(e,t,r,i){if("undefined"===typeof i||null===i){if(!("md5"in n.md))throw new Error('"md5" hash algorithm unavailable.');i=n.md.md5.create()}null===t&&(t="");for(var s=[h(i,e+t)],o=16,a=1;o<r;++a,o+=16)s.push(h(i,s[a-1]+e+t));return s.join("").substr(0,r)}},27033:(e,t,r)=>{var n=r(82161).Buffer,i=r(98942);r(25547),r(73547),r(94384);var s,o=i.pkcs5=i.pkcs5||{};i.util.isNodejs&&!i.options.usePureJavaScript&&(s=r(17111)),e.exports=i.pbkdf2=o.pbkdf2=function(e,t,r,o,a,c){if("function"===typeof a&&(c=a,a=null),i.util.isNodejs&&!i.options.usePureJavaScript&&s.pbkdf2&&(null===a||"object"!==typeof a)&&(s.pbkdf2Sync.length>4||!a||"sha1"===a))return"string"!==typeof a&&(a="sha1"),e=n.from(e,"binary"),t=n.from(t,"binary"),c?4===s.pbkdf2Sync.length?s.pbkdf2(e,t,r,o,(function(e,t){if(e)return c(e);c(null,t.toString("binary"))})):s.pbkdf2(e,t,r,o,a,(function(e,t){if(e)return c(e);c(null,t.toString("binary"))})):4===s.pbkdf2Sync.length?s.pbkdf2Sync(e,t,r,o).toString("binary"):s.pbkdf2Sync(e,t,r,o,a).toString("binary");if("undefined"!==typeof a&&null!==a||(a="sha1"),"string"===typeof a){if(!(a in i.md.algorithms))throw new Error("Unknown hash algorithm: "+a);a=i.md[a].create()}var u=a.digestLength;if(o>4294967295*u){var l=new Error("Derived key is too long.");if(c)return c(l);throw l}var h=Math.ceil(o/u),d=o-(h-1)*u,f=i.hmac.create();f.start(a,e);var p,y,g,m="";if(!c){for(var v=1;v<=h;++v){f.start(null,null),f.update(t),f.update(i.util.int32ToBytes(v)),p=g=f.digest().getBytes();for(var b=2;b<=r;++b)f.start(null,null),f.update(g),y=f.digest().getBytes(),p=i.util.xorBytes(p,y,u),g=y;m+=v<h?p:p.substr(0,d)}return m}v=1;function w(){if(v>h)return c(null,m);f.start(null,null),f.update(t),f.update(i.util.int32ToBytes(v)),p=g=f.digest().getBytes(),b=2,E()}function E(){if(b<=r)return f.start(null,null),f.update(g),y=f.digest().getBytes(),p=i.util.xorBytes(p,y,u),g=y,++b,i.util.setImmediate(E);m+=v<h?p:p.substr(0,d),++v,w()}w()}},88059:(e,t,r)=>{var n=r(98942);r(94384);var i=e.exports=n.pem=n.pem||{};function s(e){for(var t=e.name+": ",r=[],n=function(e,t){return" "+t},i=0;i<e.values.length;++i)r.push(e.values[i].replace(/^(\S+\r\n)/,n));t+=r.join(",")+"\r\n";var s=0,o=-1;for(i=0;i<t.length;++i,++s)if(s>65&&-1!==o){var a=t[o];","===a?(++o,t=t.substr(0,o)+"\r\n "+t.substr(o)):t=t.substr(0,o)+"\r\n"+a+t.substr(o+1),s=i-o-1,o=-1,++i}else" "!==t[i]&&"\t"!==t[i]&&","!==t[i]||(o=i);return t}function o(e){return e.replace(/^\s+/,"")}i.encode=function(e,t){t=t||{};var r,i="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(i+=s(r={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]})),e.contentDomain&&(i+=s(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+=s(r)),e.headers)for(var o=0;o<e.headers.length;++o)i+=s(e.headers[o]);return e.procType&&(i+="\r\n"),i+=n.util.encode64(e.body,t.maxline||64)+"\r\n",i+="-----END "+e.type+"-----\r\n"},i.decode=function(e){for(var t,r=[],i=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,s=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,a=/\r?\n/;t=i.exec(e);){var c=t[1];"NEW CERTIFICATE REQUEST"===c&&(c="CERTIFICATE REQUEST");var u={type:c,procType:null,contentDomain:null,dekInfo:null,headers:[],body:n.util.decode64(t[3])};if(r.push(u),t[2]){for(var l=t[2].split(a),h=0;t&&h<l.length;){for(var d=l[h].replace(/\s+$/,""),f=h+1;f<l.length;++f){var p=l[f];if(!/\s/.test(p[0]))break;d+=p,h=f}if(t=d.match(s)){for(var y={name:t[1],values:[]},g=t[2].split(","),m=0;m<g.length;++m)y.values.push(o(g[m]));if(u.procType)if(u.contentDomain||"Content-Domain"!==y.name)if(u.dekInfo||"DEK-Info"!==y.name)u.headers.push(y);else{if(0===y.values.length)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');u.dekInfo={algorithm:g[0],parameters:g[1]||null}}else u.contentDomain=g[0]||"";else{if("Proc-Type"!==y.name)throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==y.values.length)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');u.procType={version:g[0],type:g[1]}}}++h}if("ENCRYPTED"===u.procType&&!u.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(0===r.length)throw new Error("Invalid PEM formatted message.");return r}},5209:(e,t,r)=>{var n=r(98942);r(94384),r(3688),r(6437);var i=e.exports=n.pkcs1=n.pkcs1||{};function s(e,t,r){r||(r=n.md.sha1.create());for(var i="",s=Math.ceil(t/r.digestLength),o=0;o<s;++o){var a=String.fromCharCode(o>>24&255,o>>16&255,o>>8&255,255&o);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,o,a,c;"string"===typeof r?(i=r,o=arguments[3]||void 0,a=arguments[4]||void 0):r&&(i=r.label||void 0,o=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),l=u-2*a.digestLength-2;if(t.length>l)throw(g=new Error("RSAES-OAEP input message length is too long.")).length=t.length,g.maxLength=l,g;i||(i=""),a.update(i,"raw");for(var h=a.digest(),d="",f=l-t.length,p=0;p<f;p++)d+="\0";var y=h.getBytes()+d+"\x01"+t;if(o){if(o.length!==a.digestLength){var g;throw(g=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.")).seedLength=o.length,g.digestLength=a.digestLength,g}}else o=n.random.getBytes(a.digestLength);var m=s(o,u-a.digestLength-1,c),v=n.util.xorBytes(y,m,y.length),b=s(v,a.digestLength,c),w=n.util.xorBytes(o,b,o.length);return"\0"+w+v},i.decode_rsa_oaep=function(e,t,r){var i,o,a;"string"===typeof r?(i=r,o=arguments[3]||void 0):r&&(i=r.label||void 0,o=r.md||void 0,r.mgf1&&r.mgf1.md&&(a=r.mgf1.md));var c=Math.ceil(e.n.bitLength()/8);if(t.length!==c)throw(v=new Error("RSAES-OAEP encoded message length is invalid.")).length=t.length,v.expectedLength=c,v;if(void 0===o?o=n.md.sha1.create():o.start(),a||(a=o),c<2*o.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");i||(i=""),o.update(i,"raw");for(var u=o.digest().getBytes(),l=t.charAt(0),h=t.substring(1,o.digestLength+1),d=t.substring(1+o.digestLength),f=s(d,o.digestLength,a),p=n.util.xorBytes(h,f,h.length),y=s(p,c-o.digestLength-1,a),g=n.util.xorBytes(d,y,d.length),m=g.substring(0,o.digestLength),v="\0"!==l,b=0;b<o.digestLength;++b)v|=u.charAt(b)!==m.charAt(b);for(var w=1,E=o.digestLength,S=o.digestLength;S<g.length;S++){var _=g.charCodeAt(S),I=1&_^1,T=w?65534:0;v|=_&T,E+=w&=I}if(v||1!==g.charCodeAt(E))throw new Error("Invalid RSAES-OAEP padding.");return g.substring(E+1)}},7724:(e,t,r)=>{var n=r(98942);r(94384),r(70217),r(3688),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],s=new r(null);s.fromInt(30);var o=function(e,t){return e|t};t.generateProbablePrime=function(e,t,i){"function"===typeof t&&(i=t,t={});var s=(t=t||{}).algorithm||"PRIMEINC";"string"===typeof s&&(s={name:s}),s.options=s.options||{};var o=t.prng||n.random,c={nextBytes:function(e){for(var t=o.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}};if("PRIMEINC"===s.name)return function(e,t,i,s){if("workers"in i)return function(e,t,i,s){if("undefined"===typeof Worker)return a(e,t,i,s);var o=u(e,t),c=i.workers,l=i.workLoad||100,h=30*l/8,d=i.workerScript||"forge/prime.worker.js";if(-1===c)return n.util.estimateCores((function(e,t){e&&(t=2),c=t-1,f()}));function f(){c=Math.max(1,c);for(var n=[],i=0;i<c;++i)n[i]=new Worker(d);for(i=0;i<c;++i)n[i].addEventListener("message",f);var a=!1;function f(i){if(!a){0;var c=i.data;if(c.found){for(var d=0;d<n.length;++d)n[d].terminate();return a=!0,s(null,new r(c.prime,16))}o.bitLength()>e&&(o=u(e,t));var f=o.toString(16);i.target.postMessage({hex:f,workLoad:l}),o.dAddOffset(h,0)}}}f()}(e,t,i,s);return a(e,t,i,s)}(e,c,s.options,i);throw new Error("Invalid prime generation algorithm: "+s.name)}}function a(e,t,r,n){var i=u(e,t),s=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&&(s=r.millerRabinTests);var o=10;"maxBlockTime"in r&&(o=r.maxBlockTime),c(i,e,t,0,s,o,n)}function c(e,t,r,s,o,a,l){var h=+new Date;do{if(e.bitLength()>t&&(e=u(t,r)),e.isProbablePrime(o))return l(null,e);e.dAddOffset(i[s++%8],0)}while(a<0||+new Date-h<a);n.util.setImmediate((function(){c(e,t,r,s,o,a,l)}))}function u(e,t){var n=new r(e,t),i=e-1;return n.testBit(i)||n.bitwiseTo(r.ONE.shiftLeft(i),o,n),n.dAddOffset(31-n.mod(s).byteValue(),0),n}}()},77057:(e,t,r)=>{var n=r(21964),i=r(98942);r(94384);var s=null;!i.util.isNodejs||i.options.usePureJavaScript||n.versions["node-webkit"]||(s=r(17111)),(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),o=0;o<32;++o)n[o]=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 s=i.util.createBuffer();if(t)for(;s.length()<e;){var o=Math.max(1,Math.min(e-s.length(),65536)/4),a=new Uint32Array(Math.floor(o));try{t(a);for(var c=0;c<a.length;++c)s.putInt32(a[c])}catch(f){if(!("undefined"!==typeof QuotaExceededError&&f instanceof QuotaExceededError))throw f}}if(s.length()<e)for(var u,l,h,d=Math.floor(65536*Math.random());s.length()<e;){l=16807*(65535&d),l+=(32767&(u=16807*(d>>16)))<<16,d=4294967295&(l=(2147483647&(l+=u>>15))+(l>>31));for(c=0;c<3;++c)h=d>>>(c<<3),h^=Math.floor(256*Math.random()),s.putByte(255&h)}return s.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,s=t.plugin.increment,o=t.plugin.formatKey,a=t.plugin.formatSeed,u=i.util.createBuffer();t.key=null,function l(h){if(h)return r(h);if(u.length()>=e)return r(null,u.getBytes(e));t.generated>1048575&&(t.key=null);if(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()}))}(l)}));var d=n(t.key,t.seed);t.generated+=d.length,u.putBytes(d),t.key=o(n(t.key,s(t.seed))),t.seed=a(n(t.key,t.seed)),i.util.setImmediate(l)}()},t.generateSync=function(e){var r=t.plugin.cipher,n=t.plugin.increment,s=t.plugin.formatKey,o=t.plugin.formatSeed;t.key=null;for(var c=i.util.createBuffer();c.length()<e;){t.generated>1048575&&(t.key=null),null===t.key&&a();var u=r(t.key,t.seed);t.generated+=u.length,c.putBytes(u),t.key=s(r(t.key,n(t.seed))),t.seed=o(r(t.key,t.seed))}return c.getBytes(e)},s?(t.seedFile=function(e,t){s.randomBytes(e,(function(e,r){if(e)return t(e);t(null,r.toString())}))},t.seedFileSync=function(e){return s.randomBytes(e).toString()}):(t.seedFile=function(e,t){try{t(null,u(e))}catch(r){t(r)}},t.seedFileSync=u),t.collect=function(e){for(var r=e.length,n=0;n<r;++n)t.pools[t.pool].update(e.substr(n,1)),t.pool=31===t.pool?0:t.pool+1},t.collectInt=function(e,r){for(var n="",i=0;i<r;i+=8)n+=String.fromCharCode(e>>i&255);t.collect(n)},t.registerWorker=function(e){if(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}}})};else{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}},3688:(e,t,r)=>{var n=r(98942);r(40110),r(46932),r(77057),r(94384),n.random&&n.random.getBytes?e.exports=n.random:function(t){var r={},i=new Array(4),s=n.util.createBuffer();function o(){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),s.putInt32(i[0]),s.putInt32(i[1]),s.putInt32(i[2]),s.putInt32(i[3]),s.getBytes()},r.increment=function(e){return++e[3],e},r.md=n.md.sha256;var a=o(),c=null,u=n.util.globalScope,l=u.crypto||u.msCrypto;if(l&&l.getRandomValues&&(c=function(e){return l.getRandomValues(e)}),n.options.usePureJavaScript||!n.util.isNodejs&&!c){if("undefined"===typeof window||window.document,a.collectInt(+new Date,32),"undefined"!==typeof navigator){var h="";for(var d in navigator)try{"string"==typeof navigator[d]&&(h+=navigator[d])}catch(f){}a.collect(h),h=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 d in a)n.random[d]=a[d];else n.random=a;n.random.createInstance=o,e.exports=n.random}("undefined"!==typeof jQuery?jQuery:null)},59857:(e,t,r)=>{var n=r(98942);r(94384);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],s=[1,2,3,5],o=function(e,t){return e<<t&65535|(65535&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,s=e,o=e.length(),a=t,c=Math.ceil(a/8),u=255>>(7&a);for(r=o;r<128;r++)s.putByte(i[s.at(r-1)+s.at(r-o)&255]);for(s.setAt(128-c,i[s.at(128-c)&u]),r=127-c;r>=0;r--)s.setAt(r,i[s.at(r+1)^s.at(r+c)]);return s};var c=function(e,t,r){var i,c,u,l,h=!1,d=null,f=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[l]+(e[(u+3)%4]&e[(u+2)%4])+(~e[(u+3)%4]&e[(u+1)%4]),e[u]=o(e[u],s[u]),l++},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],s[u]),e[u]-=y[l]+(e[(u+3)%4]&e[(u+2)%4])+(~e[(u+3)%4]&e[(u+1)%4]),l--},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=d.getInt16Le();null!==p&&(r?n^=p.getInt16Le():p.putInt16Le(n)),t.push(65535&n)}l=r?0:63;for(var i=0;i<e.length;i++)for(var s=0;s<e[i][0];s++)e[i][1](t);for(u=0;u<4;u++)null!==p&&(r?p.putInt16Le(t[u]):t[u]^=p.getInt16Le()),f.putInt16Le(t[u])},m=null;return m={start:function(e,t){e&&"string"===typeof e&&(e=n.util.createBuffer(e)),h=!1,d=n.util.createBuffer(),f=t||new n.util.createBuffer,p=e,m.output=f},update:function(e){for(h||d.putBuffer(e);d.length()>=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,d,!r);else{var n=8===d.length()?8:8-d.length();d.fillWithByte(n,n)}if(t&&(h=!0,m.update()),!r&&(t=0===d.length()))if(e)t=e(8,f,!r);else{var i=f.length(),s=f.at(i-1);s>i?t=!1:f.truncate(s)}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)}},46712:(e,t,r)=>{var n=r(98942);if(r(20759),r(70217),r(54300),r(5209),r(7724),r(3688),r(94384),"undefined"===typeof i)var i=n.jsbn.BigInteger;var s=n.util.isNodejs?r(17111):null,o=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],l={name:"PrivateKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",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:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},h={name:"RSAPrivateKey",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},d={name:"RSAPublicKey",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},f=n.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",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:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:o.Class.UNIVERSAL,type:o.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:o.Class.UNIVERSAL,type:o.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=o.oidToDer(t).getBytes(),i=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[]),s=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[]);s.value.push(o.create(o.Class.UNIVERSAL,o.Type.OID,!1,n)),s.value.push(o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,""));var a=o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,e.digest().getBytes());return i.value.push(s),i.value.push(a),o.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 s;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{s=new i(n.util.bytesToHex(n.random.getBytes(t.n.bitLength()/8)),16)}while(s.compareTo(t.n)>=0||!s.gcd(t.n).equals(i.ONE));for(var o=(e=e.multiply(s.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);o.compareTo(a)<0;)o=o.add(t.p);var c=o.subtract(a).multiply(t.qInv).mod(t.p).multiply(t.q).add(a);return c=c.multiply(s.modInverse(t.n)).mod(t.n)};function g(e,t,r){var i=n.util.createBuffer(),s=Math.ceil(t.n.bitLength()/8);if(e.length>s-11){var o=new Error("Message is too long for PKCS#1 v1.5 padding.");throw o.length=e.length,o.max=s-11,o}i.putByte(0),i.putByte(r);var a,c=s-3-e.length;if(0===r||1===r){a=0===r?0:255;for(var u=0;u<c;++u)i.putByte(a)}else for(;c>0;){var l=0,h=n.random.getBytes(c);for(u=0;u<c;++u)0===(a=h.charCodeAt(u))?++l:i.putByte(a);c=l}return i.putByte(0),i.putBytes(e),i}function m(e,t,r,i){var s=Math.ceil(t.n.bitLength()/8),o=n.util.createBuffer(e),a=o.getByte(),c=o.getByte();if(0!==a||r&&0!==c&&1!==c||!r&&2!=c||r&&0===c&&"undefined"===typeof i)throw new Error("Encryption block is invalid.");var u=0;if(0===c){u=s-3-i;for(var l=0;l<u;++l)if(0!==o.getByte())throw new Error("Encryption block is invalid.")}else if(1===c)for(u=0;o.length()>1;){if(255!==o.getByte()){--o.read;break}++u}else if(2===c)for(u=0;o.length()>1;){if(0===o.getByte()){--o.read;break}++u}if(0!==o.getByte()||u!==s-3-o.length())throw new Error("Encryption block is invalid.");return o.getBytes()}function v(e,t,r){"function"===typeof t&&(r=t,t={});var s={algorithm:{name:(t=t||{}).algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};function o(){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,s,t)}function u(t,n){if(t)return r(t);if(e.q=n,e.p.compareTo(e.q)<0){var s=e.p;e.p=e.q,e.q=s}if(0!==e.p.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.p=null,void o();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 o();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void a(e.qBits,u);var l=e.e.modInverse(e.phi);e.keys={privateKey:c.rsa.setPrivateKey(e.n,e.e,l,e.p,e.q,l.mod(e.p1),l.mod(e.q1),e.q.modInverse(e.p)),publicKey:c.rsa.setPublicKey(e.n,e.e)},r(null,e.keys)}"prng"in t&&(s.prng=t.prng),o()}function b(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 s[e]}function S(e){return"undefined"!==typeof a.globalScope&&"object"===typeof a.globalScope.crypto&&"object"===typeof a.globalScope.crypto.subtle&&"function"===typeof a.globalScope.crypto.subtle[e]}function _(e){return"undefined"!==typeof a.globalScope&&"object"===typeof a.globalScope.msCrypto&&"object"===typeof a.globalScope.msCrypto.subtle&&"function"===typeof a.globalScope.msCrypto.subtle[e]}function I(e){for(var t=n.util.hexToBytes(e.toString(16)),r=new Uint8Array(t.length),i=0;i<t.length;++i)r[i]=t.charCodeAt(i);return r}c.rsa.encrypt=function(e,t,r){var s,o=r,a=Math.ceil(t.n.bitLength()/8);!1!==r&&!0!==r?(o=2===r,s=g(e,t,r)):(s=n.util.createBuffer()).putBytes(e);for(var c=new i(s.toHex(),16),u=y(c,t,o).toString(16),l=n.util.createBuffer(),h=a-Math.ceil(u.length/2);h>0;)l.putByte(0),--h;return l.putBytes(n.util.hexToBytes(u)),l.getBytes()},c.rsa.decrypt=function(e,t,r,s){var o=Math.ceil(t.n.bitLength()/8);if(e.length!==o){var a=new Error("Encrypted message length is invalid.");throw a.length=e.length,a.expected=o,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),l=n.util.createBuffer(),h=o-Math.ceil(u.length/2);h>0;)l.putByte(0),--h;return l.putBytes(n.util.hexToBytes(u)),!1!==s?m(l.getBytes(),t,r):l.getBytes()},c.rsa.createKeyPairGenerationState=function(e,t,r){"string"===typeof e&&(e=parseInt(e,10)),e=e||2048;var s,o=(r=r||{}).prng||n.random,a={nextBytes:function(e){for(var t=o.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}},c=r.algorithm||"PRIMEINC";if("PRIMEINC"!==c)throw new Error("Invalid key generation algorithm: "+c);return(s={algorithm:c,state:0,bits:e,rng:a,eInt:t||65537,e:new i(null),p:null,q:null,qBits:e>>1,pBits:e-(e>>1),pqState:0,num:null,keys:null}).e.fromInt(s.eInt),s},c.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var r=new i(null);r.fromInt(30);for(var n,s=0,o=function(e,t){return e|t},a=+new Date,l=0;null===e.keys&&(t<=0||l<t);){if(0===e.state){var h=null===e.p?e.pBits:e.qBits,d=h-1;0===e.pqState?(e.num=new i(h,e.rng),e.num.testBit(d)||e.num.bitwiseTo(i.ONE.shiftLeft(d),o,e.num),e.num.dAddOffset(31-e.num.mod(r).byteValue(),0),s=0,++e.pqState):1===e.pqState?e.num.bitLength()>h?e.pqState=0:e.num.isProbablePrime(w(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(u[s++%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 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)}}l+=(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 s.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(S("generateKey")&&S("exportKey"))return a.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:I(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(o.fromDer(n.util.createBuffer(e)));i(null,{privateKey:t,publicKey:c.setRsaPublicKey(t.n,t.e)})}}));if(_("generateKey")&&_("exportKey")){var u=a.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:I(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(o.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 l=s.generateKeyPairSync("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:c.privateKeyFromPem(l.privateKey),publicKey:c.publicKeyFromPem(l.publicKey)}}var h=c.rsa.createKeyPairGenerationState(e,t,r);if(!i)return c.rsa.stepKeyPairGenerationState(h,0),h.keys;v(h,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 s=t.encode(e,r,!0);return c.rsa.encrypt(s,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=m(t,r,!0),e===o.fromDer(t).value[1].value}}:"NONE"!==n&&"NULL"!==n&&null!==n||(n={verify:function(e,t){return e===(t=m(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,s,o,a,u){var l={n:e,e:t,d:r,p:i,q:s,dP:o,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,l,!1,!1);if("RSAES-PKCS1-V1_5"===t)t={decode:m};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,l,!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,l.n.bitLength());return c.rsa.encrypt(n,l,r)}};return l},c.wrapRsaPrivateKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,o.integerToDer(0).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(c.oids.rsaEncryption).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]),o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,o.toDer(e).getBytes())])},c.privateKeyFromAsn1=function(e){var t,r,s,a,u,d,f,p,y={},g=[];if(o.validate(e,l,y,g)&&(e=o.fromDer(n.util.createBuffer(y.privateKey))),y={},g=[],!o.validate(e,h,y,g)){var m=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw m.errors=g,m}return t=n.util.createBuffer(y.privateKeyModulus).toHex(),r=n.util.createBuffer(y.privateKeyPublicExponent).toHex(),s=n.util.createBuffer(y.privateKeyPrivateExponent).toHex(),a=n.util.createBuffer(y.privateKeyPrime1).toHex(),u=n.util.createBuffer(y.privateKeyPrime2).toHex(),d=n.util.createBuffer(y.privateKeyExponent1).toHex(),f=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(s,16),new i(a,16),new i(u,16),new i(d,16),new i(f,16),new i(p,16))},c.privateKeyToAsn1=c.privateKeyToRSAPrivateKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,o.integerToDer(0).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(e.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(e.e)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(e.d)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(e.p)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(e.q)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(e.dP)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(e.dQ)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(e.qInv))])},c.publicKeyFromAsn1=function(e){var t={},r=[];if(o.validate(e,f,t,r)){var s,a=o.derToOid(t.publicKeyOid);if(a!==c.oids.rsaEncryption)throw(s=new Error("Cannot read public key. Unknown OID.")).oid=a,s;e=t.rsaPublicKey}if(r=[],!o.validate(e,d,t,r))throw(s=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=r,s;var u=n.util.createBuffer(t.publicKeyModulus).toHex(),l=n.util.createBuffer(t.publicKeyExponent).toHex();return c.setRsaPublicKey(new i(u,16),new i(l,16))},c.publicKeyToAsn1=c.publicKeyToSubjectPublicKeyInfo=function(e){return 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(c.oids.rsaEncryption).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]),o.create(o.Class.UNIVERSAL,o.Type.BITSTRING,!1,[c.publicKeyToRSAPublicKey(e)])])},c.publicKeyToRSAPublicKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(e.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(e.e))])}},6437:(e,t,r)=>{var n=r(98942);r(73547),r(94384);var i=e.exports=n.sha1=n.sha1||{};n.md.sha1=n.md.algorithms.sha1=i,i.create=function(){o||(s=String.fromCharCode(128),s+=n.util.fillString(String.fromCharCode(0),64),o=!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,s=0;s<r;++s)i.fullMessageLength.push(0);return t=n.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},i}};return i.start(),i.update=function(s,o){"utf8"===o&&(s=n.util.encodeUtf8(s));var c=s.length;i.messageLength+=c,c=[c/4294967296>>>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(s),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var o=n.util.createBuffer();o.putBytes(t.bytes());var c,u=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;o.putBytes(s.substr(0,i.blockLength-u));for(var l=8*i.fullMessageLength[0],h=0;h<i.fullMessageLength.length-1;++h)l+=(c=8*i.fullMessageLength[h+1])/4294967296>>>0,o.putInt32(l>>>0),l=c>>>0;o.putInt32(l);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};a(d,r,o);var f=n.util.createBuffer();return f.putInt32(d.h0),f.putInt32(d.h1),f.putInt32(d.h2),f.putInt32(d.h3),f.putInt32(d.h4),f},i};var s=null,o=!1;function a(e,t,r){for(var n,i,s,o,a,c,u,l=r.length();l>=64;){for(i=e.h0,s=e.h1,o=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^s&(o^a))+c+1518500249+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=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^s&(o^a))+c+1518500249+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=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)+(s^o^a)+c+1859775393+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=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)+(s^o^a)+c+1859775393+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=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)+(s&o|a&(s^o))+c+2400959708+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=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)+(s^o^a)+c+3395469782+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;e.h0=e.h0+i|0,e.h1=e.h1+s|0,e.h2=e.h2+o|0,e.h3=e.h3+a|0,e.h4=e.h4+c|0,l-=64}}},46932:(e,t,r)=>{var n=r(98942);r(73547),r(94384);var i=e.exports=n.sha256=n.sha256||{};n.md.sha256=n.md.algorithms.sha256=i,i.create=function(){o||(s=String.fromCharCode(128),s+=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],o=!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,s=0;s<r;++s)i.fullMessageLength.push(0);return t=n.util.createBuffer(),e={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},i}};return i.start(),i.update=function(s,o){"utf8"===o&&(s=n.util.encodeUtf8(s));var a=s.length;i.messageLength+=a,a=[a/4294967296>>>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(s),c(e,r,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var o=n.util.createBuffer();o.putBytes(t.bytes());var a,u=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;o.putBytes(s.substr(0,i.blockLength-u));for(var l=8*i.fullMessageLength[0],h=0;h<i.fullMessageLength.length-1;++h)l+=(a=8*i.fullMessageLength[h+1])/4294967296>>>0,o.putInt32(l>>>0),l=a>>>0;o.putInt32(l);var d={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(d,r,o);var f=n.util.createBuffer();return f.putInt32(d.h0),f.putInt32(d.h1),f.putInt32(d.h2),f.putInt32(d.h3),f.putInt32(d.h4),f.putInt32(d.h5),f.putInt32(d.h6),f.putInt32(d.h7),f},i};var s=null,o=!1,a=null;function c(e,t,r){for(var n,i,s,o,c,u,l,h,d,f,p,y,g,m=r.length();m>=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,l=e.h1,h=e.h2,d=e.h3,f=e.h4,p=e.h5,y=e.h6,g=e.h7,c=0;c<64;++c)s=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),o=u&l|h&(u^l),n=g+((f>>>6|f<<26)^(f>>>11|f<<21)^(f>>>25|f<<7))+(y^f&(p^y))+a[c]+t[c],g=y,y=p,p=f,f=d+n>>>0,d=h,h=l,l=u,u=n+(i=s+o)>>>0;e.h0=e.h0+u|0,e.h1=e.h1+l|0,e.h2=e.h2+h|0,e.h3=e.h3+d|0,e.h4=e.h4+f|0,e.h5=e.h5+p|0,e.h6=e.h6+y|0,e.h7=e.h7+g|0,m-=64}}},56345:(e,t,r)=>{var n=r(98942);r(73547),r(94384);var i=e.exports=n.sha512=n.sha512||{};n.md.sha512=n.md.algorithms.sha512=i;var s=n.sha384=n.sha512.sha384=n.sha512.sha384||{};s.create=function(){return i.create("SHA-384")},n.md.sha384=n.md.algorithms.sha384=s,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||(o=String.fromCharCode(128),o+=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),"undefined"===typeof 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(),s=new Array(80),h=0;h<80;++h)s[h]=new Array(2);var d=64;switch(e){case"SHA-384":d=48;break;case"SHA-512/256":d=32;break;case"SHA-512/224":d=28}var f={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:d,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){f.messageLength=0,f.fullMessageLength=f.messageLength128=[];for(var e=f.messageLengthSize/4,s=0;s<e;++s)f.fullMessageLength.push(0);i=n.util.createBuffer(),r=new Array(t.length);for(s=0;s<t.length;++s)r[s]=t[s].slice(0);return f}};return f.start(),f.update=function(e,t){"utf8"===t&&(e=n.util.encodeUtf8(e));var o=e.length;f.messageLength+=o,o=[o/4294967296>>>0,o>>>0];for(var a=f.fullMessageLength.length-1;a>=0;--a)f.fullMessageLength[a]+=o[1],o[1]=o[0]+(f.fullMessageLength[a]/4294967296>>>0),f.fullMessageLength[a]=f.fullMessageLength[a]>>>0,o[0]=o[1]/4294967296>>>0;return i.putBytes(e),l(r,s,i),(i.read>2048||0===i.length())&&i.compact(),f},f.digest=function(){var t=n.util.createBuffer();t.putBytes(i.bytes());var a,c=f.fullMessageLength[f.fullMessageLength.length-1]+f.messageLengthSize&f.blockLength-1;t.putBytes(o.substr(0,f.blockLength-c));for(var u=8*f.fullMessageLength[0],h=0;h<f.fullMessageLength.length-1;++h)u+=(a=8*f.fullMessageLength[h+1])/4294967296>>>0,t.putInt32(u>>>0),u=a>>>0;t.putInt32(u);var d=new Array(r.length);for(h=0;h<r.length;++h)d[h]=r[h].slice(0);l(d,s,t);var p,y=n.util.createBuffer();p="SHA-512"===e?d.length:"SHA-384"===e?d.length-2:d.length-4;for(h=0;h<p;++h)y.putInt32(d[h][0]),h===p-1&&"SHA-512/224"===e||y.putInt32(d[h][1]);return y},f};var o=null,a=!1,c=null,u=null;function l(e,t,r){for(var n,i,s,o,a,u,l,h,d,f,p,y,g,m,v,b,w,E,S,_,I,T,A,C,R,P,k,O,B,N,D,L,x,M=r.length();M>=128;){for(k=0;k<16;++k)t[k][0]=r.getInt32()>>>0,t[k][1]=r.getInt32()>>>0;for(;k<80;++k)n=(((O=(N=t[k-2])[0])>>>19|(B=N[1])<<13)^(B>>>29|O<<3)^O>>>6)>>>0,i=((O<<13|B>>>19)^(B<<3|O>>>29)^(O<<26|B>>>6))>>>0,s=(((O=(L=t[k-15])[0])>>>1|(B=L[1])<<31)^(O>>>8|B<<24)^O>>>7)>>>0,o=((O<<31|B>>>1)^(O<<24|B>>>8)^(O<<25|B>>>7))>>>0,D=t[k-7],x=t[k-16],B=i+D[1]+o+x[1],t[k][0]=n+D[0]+s+x[0]+(B/4294967296>>>0)>>>0,t[k][1]=B>>>0;for(p=e[0][0],y=e[0][1],g=e[1][0],m=e[1][1],v=e[2][0],b=e[2][1],w=e[3][0],E=e[3][1],S=e[4][0],_=e[4][1],I=e[5][0],T=e[5][1],A=e[6][0],C=e[6][1],R=e[7][0],P=e[7][1],k=0;k<80;++k)l=((S>>>14|_<<18)^(S>>>18|_<<14)^(_>>>9|S<<23))>>>0,h=(A^S&(I^A))>>>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,d=(p&g|v&(p^g))>>>0,f=(y&m|b&(y^m))>>>0,B=P+(((S<<18|_>>>14)^(S<<14|_>>>18)^(_<<23|S>>>9))>>>0)+((C^_&(T^C))>>>0)+c[k][1]+t[k][1],n=R+l+h+c[k][0]+t[k][0]+(B/4294967296>>>0)>>>0,i=B>>>0,s=a+d+((B=u+f)/4294967296>>>0)>>>0,o=B>>>0,R=A,P=C,A=I,C=T,I=S,T=_,S=w+n+((B=E+i)/4294967296>>>0)>>>0,_=B>>>0,w=v,E=b,v=g,b=m,g=p,m=y,p=n+s+((B=i+o)/4294967296>>>0)>>>0,y=B>>>0;B=e[0][1]+y,e[0][0]=e[0][0]+p+(B/4294967296>>>0)>>>0,e[0][1]=B>>>0,B=e[1][1]+m,e[1][0]=e[1][0]+g+(B/4294967296>>>0)>>>0,e[1][1]=B>>>0,B=e[2][1]+b,e[2][0]=e[2][0]+v+(B/4294967296>>>0)>>>0,e[2][1]=B>>>0,B=e[3][1]+E,e[3][0]=e[3][0]+w+(B/4294967296>>>0)>>>0,e[3][1]=B>>>0,B=e[4][1]+_,e[4][0]=e[4][0]+S+(B/4294967296>>>0)>>>0,e[4][1]=B>>>0,B=e[5][1]+T,e[5][0]=e[5][0]+I+(B/4294967296>>>0)>>>0,e[5][1]=B>>>0,B=e[6][1]+C,e[6][0]=e[6][0]+A+(B/4294967296>>>0)>>>0,e[6][1]=B>>>0,B=e[7][1]+P,e[7][0]=e[7][0]+R+(B/4294967296>>>0)>>>0,e[7][1]=B>>>0,M-=128}}},94384:(e,t,r)=>{var n=r(21964),i=r(82161).Buffer,s=r(98942),o=r(91559),a=e.exports=s.util=s.util||{};function c(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function u(e){if(this.data="",this.read=0,"string"===typeof e)this.data=e;else if(a.isArrayBuffer(e)||a.isArrayBufferView(e))if("undefined"!==typeof i&&e instanceof i)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(n){for(var r=0;r<t.length;++r)this.putByte(t[r])}}else(e instanceof u||"object"===typeof e&&"string"===typeof e.data&&"number"===typeof e.read)&&(this.data=e.data,this.read=e.read);this._constructedStringLength=0}!function(){if("undefined"!==typeof n&&n.nextTick&&!n.browser)return a.nextTick=n.nextTick,void("function"===typeof setImmediate?a.setImmediate=setImmediate:a.setImmediate=a.nextTick);if("function"===typeof setImmediate)return a.setImmediate=function(){return setImmediate.apply(void 0,arguments)},void(a.nextTick=function(e){return setImmediate(e)});if(a.setImmediate=function(e){setTimeout(e,0)},"undefined"!==typeof window&&"function"===typeof window.postMessage){var e="forge.setImmediate",t=[];a.setImmediate=function(r){t.push(r),1===t.length&&window.postMessage(e,"*")},window.addEventListener("message",(function(r){if(r.source===window&&r.data===e){r.stopPropagation();var n=t.slice();t.length=0,n.forEach((function(e){e()}))}}),!0)}if("undefined"!==typeof MutationObserver){var r=Date.now(),i=!0,s=document.createElement("div");t=[];new MutationObserver((function(){var e=t.slice();t.length=0,e.forEach((function(e){e()}))})).observe(s,{attributes:!0});var o=a.setImmediate;a.setImmediate=function(e){Date.now()-r>15?(r=Date.now(),o(e)):(t.push(e),1===t.length&&s.setAttribute("a",i=!i))}}a.nextTick=a.setImmediate}(),a.isNodejs="undefined"!==typeof n&&n.versions&&n.versions.node,a.globalScope=a.isNodejs?r.g:"undefined"===typeof self?window:self,a.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},a.isArrayBuffer=function(e){return"undefined"!==typeof ArrayBuffer&&e instanceof ArrayBuffer},a.isArrayBufferView=function(e){return e&&a.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},a.ByteBuffer=u,a.ByteStringBuffer=u;a.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},a.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},a.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},a.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},a.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},a.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},a.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(a.encodeUtf8(e))},a.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},a.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},a.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))},a.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},a.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},a.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))},a.ByteStringBuffer.prototype.putInt=function(e,t){c(t);var r="";do{t-=8,r+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(r)},a.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<<t-1),this.putInt(e,t)},a.ByteStringBuffer.prototype.putBuffer=function(e){return this.putBytes(e.getBytes())},a.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},a.ByteStringBuffer.prototype.getInt16=function(){var e=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,e},a.ByteStringBuffer.prototype.getInt24=function(){var e=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,e},a.ByteStringBuffer.prototype.getInt32=function(){var e=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,e},a.ByteStringBuffer.prototype.getInt16Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,e},a.ByteStringBuffer.prototype.getInt24Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,e},a.ByteStringBuffer.prototype.getInt32Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,e},a.ByteStringBuffer.prototype.getInt=function(e){c(e);var t=0;do{t=(t<<8)+this.data.charCodeAt(this.read++),e-=8}while(e>0);return t},a.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},a.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},a.ByteStringBuffer.prototype.bytes=function(e){return"undefined"===typeof e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},a.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},a.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},a.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},a.ByteStringBuffer.prototype.copy=function(){var e=a.createBuffer(this.data);return e.read=this.read,e},a.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},a.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},a.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},a.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.length;++t){var r=this.data.charCodeAt(t);r<16&&(e+="0"),e+=r.toString(16)}return e},a.ByteStringBuffer.prototype.toString=function(){return a.decodeUtf8(this.bytes())},a.DataBuffer=function(e,t){t=t||{},this.read=t.readOffset||0,this.growSize=t.growSize||1024;var r=a.isArrayBuffer(e),n=a.isArrayBufferView(e);if(r||n)return this.data=r?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength),void(this.write="writeOffset"in t?t.writeOffset:this.data.byteLength);this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!==e&&void 0!==e&&this.putBytes(e),"writeOffset"in t&&(this.write=t.writeOffset)},a.DataBuffer.prototype.length=function(){return this.write-this.read},a.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},a.DataBuffer.prototype.accommodate=function(e,t){if(this.length()>=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},a.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},a.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r<t;++r)this.data.setUint8(e);return this},a.DataBuffer.prototype.putBytes=function(e,t){if(a.isArrayBufferView(e)){var r=(n=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)).byteLength-n.byteOffset;return this.accommodate(r),new Uint8Array(this.data.buffer,this.write).set(n),this.write+=r,this}if(a.isArrayBuffer(e)){var n=new Uint8Array(e);return this.accommodate(n.byteLength),new Uint8Array(this.data.buffer).set(n,this.write),this.write+=n.byteLength,this}if(e instanceof a.DataBuffer||"object"===typeof e&&"number"===typeof e.read&&"number"===typeof e.write&&a.isArrayBufferView(e.data)){n=new Uint8Array(e.data.byteLength,e.read,e.length());return this.accommodate(n.byteLength),new Uint8Array(e.data.byteLength,this.write).set(n),this.write+=n.byteLength,this}if(e instanceof a.ByteStringBuffer&&(e=e.data,t="binary"),t=t||"binary","string"===typeof e){var i;if("hex"===t)return this.accommodate(Math.ceil(e.length/2)),i=new Uint8Array(this.data.buffer,this.write),this.write+=a.binary.hex.decode(e,i,this.write),this;if("base64"===t)return this.accommodate(3*Math.ceil(e.length/4)),i=new Uint8Array(this.data.buffer,this.write),this.write+=a.binary.base64.decode(e,i,this.write),this;if("utf8"===t&&(e=a.encodeUtf8(e),t="binary"),"binary"===t||"raw"===t)return this.accommodate(e.length),i=new Uint8Array(this.data.buffer,this.write),this.write+=a.binary.raw.decode(i),this;if("utf16"===t)return this.accommodate(2*e.length),i=new Uint16Array(this.data.buffer,this.write),this.write+=a.text.utf16.encode(i),this;throw new Error("Invalid encoding: "+t)}throw Error("Invalid parameter: "+e)},a.DataBuffer.prototype.putBuffer=function(e){return this.putBytes(e),e.clear(),this},a.DataBuffer.prototype.putString=function(e){return this.putBytes(e,"utf16")},a.DataBuffer.prototype.putInt16=function(e){return this.accommodate(2),this.data.setInt16(this.write,e),this.write+=2,this},a.DataBuffer.prototype.putInt24=function(e){return this.accommodate(3),this.data.setInt16(this.write,e>>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},a.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},a.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},a.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},a.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},a.DataBuffer.prototype.putInt=function(e,t){c(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},a.DataBuffer.prototype.putSignedInt=function(e,t){return c(t),this.accommodate(t/8),e<0&&(e+=2<<t-1),this.putInt(e,t)},a.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},a.DataBuffer.prototype.getInt16=function(){var e=this.data.getInt16(this.read);return this.read+=2,e},a.DataBuffer.prototype.getInt24=function(){var e=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,e},a.DataBuffer.prototype.getInt32=function(){var e=this.data.getInt32(this.read);return this.read+=4,e},a.DataBuffer.prototype.getInt16Le=function(){var e=this.data.getInt16(this.read,!0);return this.read+=2,e},a.DataBuffer.prototype.getInt24Le=function(){var e=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,e},a.DataBuffer.prototype.getInt32Le=function(){var e=this.data.getInt32(this.read,!0);return this.read+=4,e},a.DataBuffer.prototype.getInt=function(e){c(e);var t=0;do{t=(t<<8)+this.data.getInt8(this.read++),e-=8}while(e>0);return t},a.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},a.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},a.DataBuffer.prototype.bytes=function(e){return"undefined"===typeof e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},a.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},a.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},a.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},a.DataBuffer.prototype.copy=function(){return new a.DataBuffer(this)},a.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},a.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},a.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},a.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.byteLength;++t){var r=this.data.getUint8(t);r<16&&(e+="0"),e+=r.toString(16)}return e},a.DataBuffer.prototype.toString=function(e){var t=new Uint8Array(this.data,this.read,this.length());if("binary"===(e=e||"utf8")||"raw"===e)return a.binary.raw.encode(t);if("hex"===e)return a.binary.hex.encode(t);if("base64"===e)return a.binary.base64.encode(t);if("utf8"===e)return a.text.utf8.decode(t);if("utf16"===e)return a.text.utf16.decode(t);throw new Error("Invalid encoding: "+e)},a.createBuffer=function(e,t){return t=t||"raw",void 0!==e&&"utf8"===t&&(e=a.encodeUtf8(e)),new a.ByteBuffer(e)},a.fillString=function(e,t){for(var r="";t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return r},a.xorBytes=function(e,t,r){for(var n="",i="",s="",o=0,a=0;r>0;--r,++o)i=e.charCodeAt(o)^t.charCodeAt(o),a>=10&&(n+=s,s="",a=0),s+=String.fromCharCode(i),++a;return n+=s},a.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r<e.length;r+=2)t+=String.fromCharCode(parseInt(e.substr(r,2),16));return t},a.bytesToHex=function(e){return a.createBuffer(e).toHex()},a.int32ToBytes=function(e){return String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",h=[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],d="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";a.encode64=function(e,t){for(var r,n,i,s="",o="",a=0;a<e.length;)r=e.charCodeAt(a++),n=e.charCodeAt(a++),i=e.charCodeAt(a++),s+=l.charAt(r>>2),s+=l.charAt((3&r)<<4|n>>4),isNaN(n)?s+="==":(s+=l.charAt((15&n)<<2|i>>6),s+=isNaN(i)?"=":l.charAt(63&i)),t&&s.length>t&&(o+=s.substr(0,t)+"\r\n",s=s.substr(t));return o+=s},a.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,n,i,s="",o=0;o<e.length;)t=h[e.charCodeAt(o++)-43],r=h[e.charCodeAt(o++)-43],n=h[e.charCodeAt(o++)-43],i=h[e.charCodeAt(o++)-43],s+=String.fromCharCode(t<<2|r>>4),64!==n&&(s+=String.fromCharCode((15&r)<<4|n>>2),64!==i&&(s+=String.fromCharCode((3&n)<<6|i)));return s},a.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},a.decodeUtf8=function(e){return decodeURIComponent(escape(e))},a.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:o.encode,decode:o.decode}},a.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},a.binary.raw.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length));for(var i=r=r||0,s=0;s<e.length;++s)n[i++]=e.charCodeAt(s);return t?i-r:n},a.binary.hex.encode=a.bytesToHex,a.binary.hex.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(Math.ceil(e.length/2)));var i=0,s=r=r||0;for(1&e.length&&(i=1,n[s++]=parseInt(e[0],16));i<e.length;i+=2)n[s++]=parseInt(e.substr(i,2),16);return t?s-r:n},a.binary.base64.encode=function(e,t){for(var r,n,i,s="",o="",a=0;a<e.byteLength;)r=e[a++],n=e[a++],i=e[a++],s+=l.charAt(r>>2),s+=l.charAt((3&r)<<4|n>>4),isNaN(n)?s+="==":(s+=l.charAt((15&n)<<2|i>>6),s+=isNaN(i)?"=":l.charAt(63&i)),t&&s.length>t&&(o+=s.substr(0,t)+"\r\n",s=s.substr(t));return o+=s},a.binary.base64.decode=function(e,t,r){var n,i,s,o,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<e.length;)n=h[e.charCodeAt(c++)-43],i=h[e.charCodeAt(c++)-43],s=h[e.charCodeAt(c++)-43],o=h[e.charCodeAt(c++)-43],a[u++]=n<<2|i>>4,64!==s&&(a[u++]=(15&i)<<4|s>>2,64!==o&&(a[u++]=(3&s)<<6|o));return t?u-r:a.subarray(0,u)},a.binary.base58.encode=function(e,t){return a.binary.baseN.encode(e,d,t)},a.binary.base58.decode=function(e,t){return a.binary.baseN.decode(e,d,t)},a.text={utf8:{},utf16:{}},a.text.utf8.encode=function(e,t,r){e=a.encodeUtf8(e);var n=t;n||(n=new Uint8Array(e.length));for(var i=r=r||0,s=0;s<e.length;++s)n[i++]=e.charCodeAt(s);return t?i-r:n},a.text.utf8.decode=function(e){return a.decodeUtf8(String.fromCharCode.apply(null,e))},a.text.utf16.encode=function(e,t,r){var n=t;n||(n=new Uint8Array(2*e.length));for(var i=new Uint16Array(n.buffer),s=r=r||0,o=r,a=0;a<e.length;++a)i[o++]=e.charCodeAt(a),s+=2;return t?s-r:n},a.text.utf16.decode=function(e){return String.fromCharCode.apply(null,new Uint16Array(e.buffer))},a.deflate=function(e,t,r){if(t=a.decode64(e.deflate(a.encode64(t)).rval),r){var n=2;32&t.charCodeAt(1)&&(n=6),t=t.substring(n,t.length-4)}return t},a.inflate=function(e,t,r){var n=e.inflate(a.encode64(t)).rval;return null===n?null:a.decode64(n)};var f=function(e,t,r){if(!e)throw new Error("WebStorage not available.");var n;if(null===r?n=e.removeItem(t):(r=a.encode64(JSON.stringify(r)),n=e.setItem(t,r)),"undefined"!==typeof n&&!0!==n.rval){var i=new Error(n.error.message);throw i.id=n.error.id,i.name=n.error.name,i}},p=function(e,t){if(!e)throw new Error("WebStorage not available.");var r=e.getItem(t);if(e.init)if(null===r.rval){if(r.error){var n=new Error(r.error.message);throw n.id=r.error.id,n.name=r.error.name,n}r=null}else r=r.rval;return null!==r&&(r=JSON.parse(a.decode64(r))),r},y=function(e,t,r,n){var i=p(e,t);null===i&&(i={}),i[r]=n,f(e,t,i)},g=function(e,t,r){var n=p(e,t);return null!==n&&(n=r in n?n[r]:null),n},m=function(e,t,r){var n=p(e,t);if(null!==n&&r in n){delete n[r];var i=!0;for(var s in n){i=!1;break}i&&(n=null),f(e,t,n)}},v=function(e,t){f(e,t,null)},b=function(e,t,r){var n,i=null;"undefined"===typeof r&&(r=["web","flash"]);var s=!1,o=null;for(var a in r){n=r[a];try{if("flash"===n||"both"===n){if(null===t[0])throw new Error("Flash local storage not available.");i=e.apply(this,t),s="flash"===n}"web"!==n&&"both"!==n||(t[0]=localStorage,i=e.apply(this,t),s=!0)}catch(c){o=c}if(s)break}if(!s)throw o;return i};a.setItem=function(e,t,r,n,i){b(y,arguments,i)},a.getItem=function(e,t,r,n){return b(g,arguments,n)},a.removeItem=function(e,t,r,n){b(m,arguments,n)},a.clearItems=function(e,t,r){b(v,arguments,r)},a.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},a.format=function(e){for(var t,r,n=/%./g,i=0,s=[],o=0;t=n.exec(e);){(r=e.substring(o,n.lastIndex-2)).length>0&&s.push(r),o=n.lastIndex;var a=t[0][1];switch(a){case"s":case"o":i<arguments.length?s.push(arguments[1+i++]):s.push("<?>");break;case"%":s.push("%");break;default:s.push("<%"+a+"?>")}}return s.push(e.substring(o)),s.join("")},a.formatNumber=function(e,t,r,n){var i=e,s=isNaN(t=Math.abs(t))?2:t,o=void 0===r?",":r,a=void 0===n?".":n,c=i<0?"-":"",u=parseInt(i=Math.abs(+i||0).toFixed(s),10)+"",l=u.length>3?u.length%3:0;return c+(l?u.substr(0,l)+a:"")+u.substr(l).replace(/(\d{3})(?=\d)/g,"$1"+a)+(s?o+Math.abs(i-u).toFixed(s).slice(2):"")},a.formatSize=function(e){return e=e>=1073741824?a.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?a.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?a.formatNumber(e/1024,0)+" KiB":a.formatNumber(e,0)+" bytes"},a.bytesFromIP=function(e){return-1!==e.indexOf(".")?a.bytesFromIPv4(e):-1!==e.indexOf(":")?a.bytesFromIPv6(e):null},a.bytesFromIPv4=function(e){if(4!==(e=e.split(".")).length)return null;for(var t=a.createBuffer(),r=0;r<e.length;++r){var n=parseInt(e[r],10);if(isNaN(n))return null;t.putByte(n)}return t.getBytes()},a.bytesFromIPv6=function(e){for(var t=0,r=2*(8-(e=e.split(":").filter((function(e){return 0===e.length&&++t,!0}))).length+t),n=a.createBuffer(),i=0;i<8;++i)if(e[i]&&0!==e[i].length){var s=a.hexToBytes(e[i]);s.length<2&&n.putByte(0),n.putBytes(s)}else n.fillWithByte(0,r),r=0;return n.getBytes()},a.bytesToIP=function(e){return 4===e.length?a.bytesToIPv4(e):16===e.length?a.bytesToIPv6(e):null},a.bytesToIPv4=function(e){if(4!==e.length)return null;for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t.join(".")},a.bytesToIPv6=function(e){if(16!==e.length)return null;for(var t=[],r=[],n=0,i=0;i<e.length;i+=2){for(var s=a.bytesToHex(e[i]+e[i+1]);"0"===s[0]&&"0"!==s;)s=s.substr(1);if("0"===s){var o=r[r.length-1],c=t.length;o&&c===o.end+1?(o.end=c,o.end-o.start>r[n].end-r[n].start&&(n=r.length-1)):r.push({start:c,end:c})}t.push(s)}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(":")},a.estimateCores=function(e,t){if("function"===typeof e&&(t=e,e={}),e=e||{},"cores"in a&&!e.update)return t(null,a.cores);if("undefined"!==typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return a.cores=navigator.hardwareConcurrency,t(null,a.cores);if("undefined"===typeof Worker)return a.cores=1,t(null,a.cores);if("undefined"===typeof Blob)return a.cores=2,t(null,a.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",(function(e){for(var t=Date.now(),r=t+4;Date.now()<r;);self.postMessage({st:t,et:r})}))}.toString(),")()"],{type:"application/javascript"}));!function e(n,i,s){if(0===i){var o=Math.floor(n.reduce((function(e,t){return e+t}),0)/n.length);return a.cores=Math.max(1,o),URL.revokeObjectURL(r),t(null,a.cores)}!function(e,t){for(var n=[],i=[],s=0;s<e;++s){var o=new Worker(r);o.addEventListener("message",(function(r){if(i.push(r.data),i.length===e){for(var s=0;s<e;++s)n[s].terminate();t(null,i)}})),n.push(o)}for(s=0;s<e;++s)n[s].postMessage(s)}(s,(function(t,r){n.push(function(e,t){for(var r=[],n=0;n<e;++n)for(var i=t[n],s=r[n]=[],o=0;o<e;++o)if(n!==o){var a=t[o];(i.st>a.st&&i.st<a.et||a.st>i.st&&a.st<i.et)&&s.push(o)}return r.reduce((function(e,t){return Math.max(e,t.length)}),0)}(s,r)),e(n,i-1,s)}))}([],5,16)}},16982:(e,t,r)=>{"use strict";const n=r(67963),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=>{let[t,r]=e;return"".concat(t," (").concat(r,")")})).join(" / ");throw n(new Error("Invalid key length ".concat(e.length," bytes. Must be ").concat(t)),"ERR_INVALID_KEY_LENGTH")}return t}},37075:(e,t,r)=>{"use strict";r(40110);const n=r(98942),{toString:i}=r(82051),{fromString:s}=r(46765);e.exports={createCipheriv:(e,t,r)=>{const o=n.cipher.createCipher("AES-CTR",i(t,"ascii"));return o.start({iv:i(r,"ascii")}),{update:e=>(o.update(n.util.createBuffer(i(e,"ascii"))),s(o.output.getBytes(),"ascii"))}},createDecipheriv:(e,t,r)=>{const o=n.cipher.createDecipher("AES-CTR",i(t,"ascii"));return o.start({iv:i(r,"ascii")}),{update:e=>(o.update(n.util.createBuffer(i(e,"ascii"))),s(o.output.getBytes(),"ascii"))}}}},94421:(e,t,r)=>{"use strict";const n=r(37075),i=r(16982);t.create=async function(e,t){const r=i(e),s=n.createCipheriv(r,e,t),o=n.createDecipheriv(r,e,t);return{encrypt:async e=>s.update(e),decrypt:async e=>o.update(e)}}},88279:(e,t,r)=>{"use strict";const{concat:n}=r(62110),{fromString:i}=r(46765),s=r(35288);e.exports={create:function(){let{algorithm:e="AES-GCM",nonceLength:t=12,keyLength:r=16,digest:o="SHA-256",saltLength:a=16,iterations:c=32767}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const u=s.get();async function l(s,l){const h=u.getRandomValues(new Uint8Array(a)),d=u.getRandomValues(new Uint8Array(t)),f={name:e,iv:d},p={name:"PBKDF2",salt:h,iterations:c,hash:{name:o}},y=await u.subtle.importKey("raw",i(l),{name:"PBKDF2"},!1,["deriveKey","deriveBits"]),g=await u.subtle.deriveKey(p,y,{name:e,length:r},!0,["encrypt"]),m=await u.subtle.encrypt(f,g,s);return n([h,f.iv,new Uint8Array(m)])}async function h(n,s){const l=n.slice(0,a),h=n.slice(a,a+t),d=n.slice(a+t),f={name:e,iv:h},p={name:"PBKDF2",salt:l,iterations:c,hash:{name:o}},y=await u.subtle.importKey("raw",i(s),{name:"PBKDF2"},!1,["deriveKey","deriveBits"]),g=await u.subtle.deriveKey(p,y,{name:e,length:r},!0,["decrypt"]),m=await u.subtle.decrypt(f,g,d);return new Uint8Array(m)}return r*=8,{encrypt:l,decrypt:h}}}},59938:(e,t,r)=>{"use strict";const n=r(35288),i=r(42830),s={SHA1:"SHA-1",SHA256:"SHA-256",SHA512:"SHA-512"};t.create=async function(e,t){const r=s[e],o=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)})(o,e),length:i[e]}}},42830:e=>{"use strict";e.exports={SHA1:20,SHA256:32,SHA512:64}},25504:(e,t,r)=>{"use strict";const n=r(59938),i=r(94421),s=r(36552);t.aes=i,t.hmac=n,t.keys=s,t.randomBytes=r(31158),t.pbkdf2=r(68037)},77129:(e,t,r)=>{"use strict";const n=r(67963),i=r(35288),{base64urlToBuffer:s}=r(12545),o=r(59846),{toString:a}=r(82051),{concat:c}=r(62110),{equals:u}=r(98779),l={"P-256":256,"P-384":384,"P-521":521};t.generateEphmeralKeyPair=async function(e){o(Object.keys(l),e);const t=await i.get().subtle.generateKey({name:"ECDH",namedCurve:e},!0,["deriveBits"]);return{key:d(await i.get().subtle.exportKey("jwk",t.publicKey)),genSharedKey:async(r,n)=>{let s;s=n?await i.get().subtle.importKey("jwk",p(e,n),{name:"ECDH",namedCurve:e},!1,["deriveBits"]):t.privateKey;const o=[await i.get().subtle.importKey("jwk",f(e,r),{name:"ECDH",namedCurve:e},!1,[]),s],a=await i.get().subtle.deriveBits({name:"ECDH",namedCurve:e,public:o[0]},o[1],l[e]);return new Uint8Array(a,a.byteOffset,a.byteLength)}}};const h={"P-256":32,"P-384":48,"P-521":66};function d(e){const t=h[e.crv];return c([Uint8Array.from([4]),s(e.x,t),s(e.y,t)],1+2*t)}function f(e,t){const r=h[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)=>({...f(e,t.public),d:a(t.private,"base64url")})},61492:(e,t,r)=>{"use strict";const n=r(67963),{equals:i}=r(98779),{sha256:s}=r(19400),{base58btc:o}=r(86898),{identity:a}=r(60173),c=r(66556),u=r(67796),l=r(43437);class h{constructor(e){this._key=f(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 s.digest(this.bytes);return e}}class d{constructor(e,t){this._key=f(e,c.privateKeyLength),this._publicKey=f(t,c.publicKeyLength)}async sign(e){return c.hashAndSign(this._key,e)}get public(){return new h(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 s.digest(this.bytes);return e}async id(){const e=await a.digest(this.public.bytes);return o.encode(e.bytes).substring(1)}async export(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"libp2p-key";if("libp2p-key"===t)return l.export(this.bytes,e);throw n(new Error("export format '".concat(t,"' is not supported")),"ERR_INVALID_EXPORT_FORMAT")}}function f(e,t){if((e=Uint8Array.from(e||[])).length!==t)throw n(new Error("Key must be a Uint8Array of length ".concat(t,", got ").concat(e.length)),"ERR_INVALID_KEY_TYPE");return e}e.exports={Ed25519PublicKey:h,Ed25519PrivateKey:d,unmarshalEd25519PrivateKey:function(e){if(e.length>c.privateKeyLength){const t=(e=f(e,c.privateKeyLength+c.publicKeyLength)).slice(0,c.privateKeyLength),r=e.slice(c.privateKeyLength,e.length);return new d(t,r)}const t=(e=f(e,c.privateKeyLength)).slice(0,c.privateKeyLength),r=e.slice(c.publicKeyLength);return new d(t,r)},unmarshalEd25519PublicKey:function(e){return e=f(e,c.publicKeyLength),new h(e)},generateKeyPair:async function(){const{privateKey:e,publicKey:t}=await c.generateKey();return new d(e,t)},generateKeyPairFromSeed:async function(e){const{privateKey:t,publicKey:r}=await c.generateKeyFromSeed(e);return new d(t,r)}}},66556:(e,t,r)=>{"use strict";const n=r(47835);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)}},89097:(e,t,r)=>{"use strict";const n=r(77129);e.exports=async e=>n.generateEphmeralKeyPair(e)},43437:(e,t,r)=>{"use strict";const{base64:n}=r(24426),i=r(88279);e.exports={export:async function(e,t){const r=i.create(),s=await r.encrypt(e,t);return n.encode(s)}}},47975:(e,t,r)=>{"use strict";const{base64:n}=r(24426),i=r(88279);e.exports={import:async function(e,t){const r=n.decode(e),s=i.create();return await s.decrypt(r,t)}}},36552:(e,t,r)=>{"use strict";const n=r(67796);r(20759),r(37202);const i=r(98942),s=r(67963),{fromString:o}=r(46765),a=r(47975),c={rsa:r(14188),ed25519:r(61492),secp256k1:r(93154)(n,r(31158))},u="secp256k1 support requires libp2p-crypto-secp256k1 package",l="ERR_MISSING_PACKAGE";function h(e){const t=c[e.toLowerCase()];if(!t){const t=Object.keys(c).join(" / ");throw s(new Error("invalid or unsupported key type ".concat(e,". Must be ").concat(t)),"ERR_UNSUPPORTED_KEY_TYPE")}return t}const d=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 s(new Error(u),l);default:h(t.Type)}};e.exports={supportedKeys:c,keysPBM:n,keyStretcher:r(52936),generateEphemeralKeyPair:r(89097),generateKeyPair:async(e,t)=>h(e).generateKeyPair(t),generateKeyPairFromSeed:async(e,t,r)=>{const n=h(e);if("ed25519"!==e.toLowerCase())throw s(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 s(new Error(u),l);default:h(t.Type)}},marshalPublicKey:(e,t)=>(h(t=(t||"rsa").toLowerCase()),e.bytes),unmarshalPrivateKey:d,marshalPrivateKey:(e,t)=>(h(t=(t||"rsa").toLowerCase()),e.bytes),import:async(e,t)=>{try{const r=await a.import(e,t);return d(r)}catch(u){}const r=i.pki.decryptRsaPrivateKey(e,t);if(null===r)throw s(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=o(n.getBytes(),"ascii"),c.rsa.unmarshalRsaPrivateKey(n)}}},15025:(e,t,r)=>{"use strict";r(46712);const n=r(98942),{base64urlToBigInteger:i}=r(12545);function s(e,t){return t.map((t=>i(e[t])))}e.exports={jwk2pub:function(e){return n.pki.setRsaPublicKey(...s(e,["n","e"]))},jwk2priv:function(e){return n.pki.setRsaPrivateKey(...s(e,["n","e","d","p","q","dp","dq","qi"]))}}},52936:(e,t,r)=>{"use strict";const n=r(67963),{concat:i}=r(62110),{fromString:s}=r(46765),o=r(59938),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 '".concat(e,"'. Must be ").concat(t)),"ERR_INVALID_CIPHER_TYPE")}if(!t)throw n(new Error("missing hash type"),"ERR_MISSING_HASH_TYPE");const u=c.keySize,l=c.ivSize,h=s("key expansion"),d=2*(l+u+20),f=await o.create(t,r);let p=await f.digest(h);const y=[];let g=0;for(;g<d;){const e=await f.digest(i([p,h]));let t=e.length;g+t>d&&(t=d-g),y.push(e),g+=t,p=await f.digest(p)}const m=d/2,v=i(y),b=v.slice(0,m),w=v.slice(m,d),E=e=>({iv:e.slice(0,l),cipherKey:e.slice(l,l+u),macKey:e.slice(l+u)});return{k1:E(b),k2:E(w)}}},67796:(e,t,r)=>{"use strict";var n=r(80886),i=n.Reader,s=n.Writer,o=n.util,a=n.roots["libp2p-crypto-keys"]||(n.roots["libp2p-crypto-keys"]={});a.KeyType=function(){var e={},t=Object.create(e);return t[e[0]="RSA"]=0,t[e[1]="Ed25519"]=1,t[e[2]="Secp256k1"]=2,t}(),a.PublicKey=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.Type=0,e.prototype.Data=o.newBuffer([]),e.encode=function(e,t){return t||(t=s.create()),t.uint32(8).int32(e.Type),t.uint32(18).bytes(e.Data),t},e.decode=function(e,t){e instanceof i||(e=i.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new a.PublicKey;e.pos<r;){var s=e.uint32();switch(s>>>3){case 1:n.Type=e.int32();break;case 2:n.Data=e.bytes();break;default:e.skipType(7&s)}}if(!n.hasOwnProperty("Type"))throw o.ProtocolError("missing required 'Type'",{instance:n});if(!n.hasOwnProperty("Data"))throw o.ProtocolError("missing required 'Data'",{instance:n});return n},e.fromObject=function(e){if(e instanceof a.PublicKey)return e;var t=new a.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?o.base64.decode(e.Data,t.Data=o.newBuffer(o.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=o.newBuffer(r.Data)))),null!=e.Type&&e.hasOwnProperty("Type")&&(r.Type=t.enums===String?a.KeyType[e.Type]:e.Type),null!=e.Data&&e.hasOwnProperty("Data")&&(r.Data=t.bytes===String?o.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,n.util.toJSONOptions)},e}(),a.PrivateKey=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.Type=0,e.prototype.Data=o.newBuffer([]),e.encode=function(e,t){return t||(t=s.create()),t.uint32(8).int32(e.Type),t.uint32(18).bytes(e.Data),t},e.decode=function(e,t){e instanceof i||(e=i.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new a.PrivateKey;e.pos<r;){var s=e.uint32();switch(s>>>3){case 1:n.Type=e.int32();break;case 2:n.Data=e.bytes();break;default:e.skipType(7&s)}}if(!n.hasOwnProperty("Type"))throw o.ProtocolError("missing required 'Type'",{instance:n});if(!n.hasOwnProperty("Data"))throw o.ProtocolError("missing required 'Data'",{instance:n});return n},e.fromObject=function(e){if(e instanceof a.PrivateKey)return e;var t=new a.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?o.base64.decode(e.Data,t.Data=o.newBuffer(o.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=o.newBuffer(r.Data)))),null!=e.Type&&e.hasOwnProperty("Type")&&(r.Type=t.enums===String?a.KeyType[e.Type]:e.Type),null!=e.Data&&e.hasOwnProperty("Data")&&(r.Data=t.bytes===String?o.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,n.util.toJSONOptions)},e}(),e.exports=a},73545:(e,t,r)=>{"use strict";const n=r(35288),i=r(31158),{toString:s}=r(82051),{fromString:o}=r(46765);function a(e){return Promise.all([n.get().subtle.exportKey("jwk",e.privateKey),n.get().subtle.exportKey("jwk",e.publicKey)])}t.utils=r(27367),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(15025);function l(e,t,r,n){const i=t?c(e):u(e),a=n(s(Uint8Array.from(r),"ascii"),i);return o(a,"ascii")}t.encrypt=function(e,t){return l(e,!0,t,((e,t)=>t.encrypt(e)))},t.decrypt=function(e,t){return l(e,!1,t,((e,t)=>t.decrypt(e)))}},14188:(e,t,r)=>{"use strict";const{sha256:n}=r(19400),i=r(67963),{equals:s}=r(98779),{toString:o}=r(82051);r(56345);const a=r(98942),c=r(73545),u=r(67796),l=r(43437);class h{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 s(this.bytes,e.bytes)}async hash(){const{bytes:e}=await n.digest(this.bytes);return e}}class d{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 h(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 s(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 o(e,"base58btc")}async export(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"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 l.export(this.bytes,e);throw i(new Error("export format '".concat(t,"' is not supported")),"ERR_INVALID_EXPORT_FORMAT")}}e.exports={RsaPublicKey:h,RsaPrivateKey:d,unmarshalRsaPublicKey:function(e){const t=c.utils.pkixToJwk(e);return new h(t)},unmarshalRsaPrivateKey:async function(e){const t=c.utils.pkcs1ToJwk(e),r=await c.unmarshalPrivateKey(t);return new d(r.privateKey,r.publicKey)},generateKeyPair:async function(e){const t=await c.generateKey(e);return new d(t.privateKey,t.publicKey)},fromJwk:async function(e){const t=await c.unmarshalPrivateKey(e);return new d(t.privateKey,t.publicKey)}}},27367:(e,t,r)=>{"use strict";r(20759),r(46712);const n=r(98942),{bigIntegerToUintBase64url:i,base64urlToBigInteger:s}=r(12545),{fromString:o}=r(46765),{toString:a}=r(82051);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:s(e.n),e:s(e.e),d:s(e.d),p:s(e.p),q:s(e.q),dP:s(e.dp),dQ:s(e.dq),qInv:s(e.qi)});return o(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:s(e.n),e:s(e.e)});return o(n.asn1.toDer(t).getBytes(),"ascii")}},93154:(e,t,r)=>{"use strict";const{sha256:n}=r(19400),i=r(67963),{equals:s}=r(98779),{toString:o}=r(82051),a=r(43437);e.exports=(e,t,c)=>{c=c||r(96932)();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 s(this.bytes,e.bytes)}async hash(){const{bytes:e}=await n.digest(this.bytes);return e}}class l{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 s(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 o(e,"base58btc")}async export(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"libp2p-key";if("libp2p-key"===t)return a.export(this.bytes,e);throw i(new Error("export format '".concat(t,"' is not supported")),"ERR_INVALID_EXPORT_FORMAT")}}return{Secp256k1PublicKey:u,Secp256k1PrivateKey:l,unmarshalSecp256k1PrivateKey:function(e){return new l(e)},unmarshalSecp256k1PublicKey:function(e){return new u(e)},generateKeyPair:async function(){const e=await c.generateKey();return new l(e)}}}},96932:(e,t,r)=>{"use strict";const n=r(67963),i=r(53845),{sha256:s}=r(19400);e.exports=()=>({generateKey:function(){return i.utils.randomPrivateKey()},privateKeyLength:32,hashAndSign:async function(e,t){const{digest:r}=await s.digest(t);try{return await i.sign(r,e)}catch(o){throw n(o,"ERR_INVALID_INPUT")}},hashAndVerify:async function(e,t,r){try{const{digest:n}=await s.digest(r);return i.verify(t,n,e)}catch(o){throw n(o,"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(t){throw n(t,"ERR_INVALID_PRIVATE_KEY")}},validatePublicKey:function(e){try{i.Point.fromHex(e)}catch(t){throw n(t,"ERR_INVALID_PUBLIC_KEY")}},computePublicKey:function(e){try{return i.getPublicKey(e,!0)}catch(t){throw n(t,"ERR_INVALID_PRIVATE_KEY")}}})},59846:(e,t,r)=>{"use strict";const n=r(67963);e.exports=function(e,t){if(!e.includes(t)){const r=e.join(" / ");throw n(new Error("Unknown curve: ".concat(t,". Must be ").concat(r)),"ERR_INVALID_CURVE")}}},68037:(e,t,r)=>{"use strict";const n=r(27033),i=r(94384),s=r(67963),o={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};e.exports=function(e,t,r,a,c){const u=o[c];if(!u){const e=Object.keys(o).join(" / ");throw s(new Error("Hash '".concat(c,"' is unknown or not supported. Must be ").concat(e)),"ERR_UNSUPPORTED_HASH_TYPE")}const l=n(e,t,r,a,u);return i.encode64(l)}},31158:(e,t,r)=>{"use strict";const n=r(25410),i=r(67963);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)}},12545:(e,t,r)=>{"use strict";r(94384),r(70217);const n=r(98942),{fromString:i}=r(46765),{toString:s}=r(82051),{concat:o}=r(62110);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=o([new Uint8Array(t-r.length),r])}return s(r,"base64url")},t.base64urlToBigInteger=e=>{const r=t.base64urlToBuffer(e);return new n.jsbn.BigInteger(s(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=o([new Uint8Array(t-r.length),r])}return r}},35288:(e,t)=>{"use strict";t.get=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]: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}},66759:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ACCEPT_FROM_WHITELIST_DURATION_MS=t.ACCEPT_FROM_WHITELIST_MAX_MESSAGES=t.ACCEPT_FROM_WHITELIST_THRESHOLD_SCORE=t.ERR_TOPIC_VALIDATOR_IGNORE=t.ERR_TOPIC_VALIDATOR_REJECT=t.TimeCacheDuration=t.GossipsubSeenTTL=t.GossipsubIWantFollowupTime=t.GossipsubMaxIHaveMessages=t.GossipsubMaxIHaveLength=t.GossipsubGraftFloodThreshold=t.GossipsubOpportunisticGraftPeers=t.GossipsubOpportunisticGraftTicks=t.GossipsubDirectConnectInitialDelay=t.GossipsubDirectConnectTicks=t.GossipsubConnectionTimeout=t.GossipsubMaxPendingConnections=t.GossipsubConnectors=t.GossipsubPruneBackoffTicks=t.GossipsubPruneBackoff=t.GossipsubPrunePeers=t.GossipsubFanoutTTL=t.GossipsubHeartbeatInterval=t.GossipsubHeartbeatInitialDelay=t.GossipsubGossipRetransmission=t.GossipsubGossipFactor=t.GossipsubDlazy=t.GossipsubHistoryGossip=t.GossipsubHistoryLength=t.GossipsubDout=t.GossipsubDscore=t.GossipsubDhi=t.GossipsubDlo=t.GossipsubD=t.GossipsubIDv11=t.GossipsubIDv10=t.FloodsubID=t.minute=t.second=void 0,t.second=1e3,t.minute=60*t.second,t.FloodsubID="/floodsub/1.0.0",t.GossipsubIDv10="/meshsub/1.0.0",t.GossipsubIDv11="/meshsub/1.1.0",t.GossipsubD=6,t.GossipsubDlo=4,t.GossipsubDhi=12,t.GossipsubDscore=4,t.GossipsubDout=2,t.GossipsubHistoryLength=5,t.GossipsubHistoryGossip=3,t.GossipsubDlazy=6,t.GossipsubGossipFactor=.25,t.GossipsubGossipRetransmission=3,t.GossipsubHeartbeatInitialDelay=100,t.GossipsubHeartbeatInterval=t.second,t.GossipsubFanoutTTL=t.minute,t.GossipsubPrunePeers=16,t.GossipsubPruneBackoff=t.minute,t.GossipsubPruneBackoffTicks=15,t.GossipsubConnectors=8,t.GossipsubMaxPendingConnections=128,t.GossipsubConnectionTimeout=30*t.second,t.GossipsubDirectConnectTicks=300,t.GossipsubDirectConnectInitialDelay=t.second,t.GossipsubOpportunisticGraftTicks=60,t.GossipsubOpportunisticGraftPeers=2,t.GossipsubGraftFloodThreshold=10*t.second,t.GossipsubMaxIHaveLength=5e3,t.GossipsubMaxIHaveMessages=10,t.GossipsubIWantFollowupTime=3*t.second,t.GossipsubSeenTTL=30*t.second,t.TimeCacheDuration=12e4,t.ERR_TOPIC_VALIDATOR_REJECT="ERR_TOPIC_VALIDATOR_REJECT",t.ERR_TOPIC_VALIDATOR_IGNORE="ERR_TOPIC_VALIDATOR_IGNORE",t.ACCEPT_FROM_WHITELIST_THRESHOLD_SCORE=0,t.ACCEPT_FROM_WHITELIST_MAX_MESSAGES=128,t.ACCEPT_FROM_WHITELIST_DURATION_MS=1e3},60622:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getGossipPeers=void 0;const n=r(53357);t.getGossipPeers=function(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:()=>!0;const s=e.topics.get(t);if(!s)return new Set;let o=[];return s.forEach((t=>{const r=e.peers.get(t);r&&n.hasGossipProtocol(r.protocol)&&i(t)&&o.push(t)})),o=n.shuffle(o),r>0&&o.length>r&&(o=o.slice(0,r)),new Set(o)}},93234: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}),s=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.Heartbeat=void 0;const o=s(r(66759)),a=r(60622),c=r(53357);t.Heartbeat=class{constructor(e){this.gossipsub=e}start(){if(this._heartbeatTimer)return;const e=this._heartbeat.bind(this),t=setTimeout((()=>{e(),this._heartbeatTimer.runPeriodically(e,this.gossipsub._options.heartbeatInterval)}),o.GossipsubHeartbeatInitialDelay);this._heartbeatTimer={_intervalId:void 0,runPeriodically:(e,t)=>{this._heartbeatTimer._intervalId=setInterval(e,t)},cancel:()=>{clearTimeout(t),clearInterval(this._heartbeatTimer._intervalId)}}}stop(){this._heartbeatTimer&&(this._heartbeatTimer.cancel(),this._heartbeatTimer=null)}_heartbeat(){const{D:e,Dlo:t,Dhi:r,Dscore:n,Dout:i,fanoutTTL:s}=this.gossipsub._options;this.gossipsub.heartbeatTicks++;const u=new Map,l=e=>{let t=u.get(e);return void 0===t&&(t=this.gossipsub.score.score(e),u.set(e,t)),t},h=new Map,d=new Map,f=new Map;this.gossipsub._clearBackoff(),this.gossipsub.peerhave.clear(),this.gossipsub.iasked.clear(),this.gossipsub._applyIwantPenalties(),this.gossipsub._directConnect(),this.gossipsub.mesh.forEach(((s,u)=>{const p=e=>{this.gossipsub.log("HEARTBEAT: Remove mesh link to %s in %s",e,u),this.gossipsub.score.prune(e,u),this.gossipsub._addBackoff(e,u),s.delete(e);const t=d.get(e);t?t.push(u):d.set(e,[u])},y=e=>{this.gossipsub.log("HEARTBEAT: Add mesh link to %s in %s",e,u),this.gossipsub.score.graft(e,u),s.add(e);const t=h.get(e);t?t.push(u):h.set(e,[u])};if(s.forEach((e=>{const t=l(e);t<0&&(this.gossipsub.log("HEARTBEAT: Prune peer %s with negative score: score=%d, topic=%s",e,t,u),p(e),f.set(e,!0))})),s.size<t){const t=this.gossipsub.backoff.get(u),r=e-s.size;a.getGossipPeers(this.gossipsub,u,r,(e=>!s.has(e)&&!this.gossipsub.direct.has(e)&&(!t||!t.has(e))&&l(e)>=0)).forEach(y)}if(s.size>r){let t=Array.from(s);t.sort(((e,t)=>l(t)-l(e))),t=t.slice(0,n).concat(c.shuffle(t.slice(n)));let r=0;if(t.slice(0,e).forEach((e=>{this.gossipsub.outbound.get(e)&&r++})),r<i){const n=e=>{const r=t[e];for(let n=e;n>0;n--)t[n]=t[n-1];t[0]=r};if(r>0){let i=r;for(let r=1;r<e&&i>0;r++)this.gossipsub.outbound.get(t[r])&&(n(r),i--)}let i=e-r;for(let r=e;r<t.length&&i>0;r++)this.gossipsub.outbound.get(t[r])&&(n(r),i--)}t.slice(e).forEach(p)}if(s.size>=t){let e=0;if(s.forEach((t=>{this.gossipsub.outbound.get(t)&&e++})),e<i){const t=i-e,r=this.gossipsub.backoff.get(u);a.getGossipPeers(this.gossipsub,u,t,(e=>!s.has(e)&&!this.gossipsub.direct.has(e)&&(!r||!r.has(e))&&l(e)>=0)).forEach(y)}}if(this.gossipsub.heartbeatTicks%o.GossipsubOpportunisticGraftTicks===0&&s.size>1){const e=Array.from(s).sort(((e,t)=>l(e)-l(t))),t=Math.floor(s.size/2),r=l(e[t]);if(r<this.gossipsub._options.scoreThresholds.opportunisticGraftThreshold){const e=this.gossipsub.backoff.get(u);a.getGossipPeers(this.gossipsub,u,o.GossipsubOpportunisticGraftPeers,(t=>s.has(t)&&!this.gossipsub.direct.has(t)&&(!e||!e.has(t))&&l(t)>r)).forEach((e=>{this.gossipsub.log("HEARTBEAT: Opportunistically graft peer %s on topic %s",e,u),y(e)}))}}this.gossipsub._emitGossip(u,s)}));const p=this.gossipsub._now();this.gossipsub.lastpub.forEach(((e,t)=>{e+s<p&&(this.gossipsub.fanout.delete(t),this.gossipsub.lastpub.delete(t))})),this.gossipsub.fanout.forEach(((t,r)=>{const n=this.gossipsub.topics.get(r);if(t.forEach((e=>{(!n.has(e)||l(e)<this.gossipsub._options.scoreThresholds.publishThreshold)&&t.delete(e)})),t.size<e){const n=e-t.size;a.getGossipPeers(this.gossipsub,r,n,(e=>!t.has(e)&&!this.gossipsub.direct.has(e)&&l(e)>=this.gossipsub._options.scoreThresholds.publishThreshold)).forEach((e=>{t.add(e)}))}this.gossipsub._emitGossip(r,t)})),this.gossipsub._sendGraftPrune(h,d,f),this.gossipsub._flush(),this.gossipsub.messageCache.shift(),this.gossipsub.emit("gossipsub:heartbeat")}}},37976: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}),s=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},o=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function o(e){try{c(n.next(e))}catch(t){s(t)}}function a(e){try{c(n.throw(e))}catch(t){s(t)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))};const a=s(r(4782)),c=r(45075),u=r(83519),l=s(r(66759)),h=r(93234),d=r(60622),f=r(53357),p=r(63789),y=r(61390),g=r(46561),m=r(90190),v=r(76869),b=r(66759);class w extends a.default{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var r;const n=[l.GossipsubIDv11,l.GossipsubIDv10],i=Object.assign(Object.assign({gossipIncoming:!0,fallbackToFloodsub:!0,floodPublish:!0,doPX:!1,directPeers:[],D:l.GossipsubD,Dlo:l.GossipsubDlo,Dhi:l.GossipsubDhi,Dscore:l.GossipsubDscore,Dout:l.GossipsubDout,Dlazy:l.GossipsubDlazy,heartbeatInterval:l.GossipsubHeartbeatInterval,fanoutTTL:l.GossipsubFanoutTTL,mcacheLength:l.GossipsubHistoryLength,mcacheGossip:l.GossipsubHistoryGossip,seenTTL:l.GossipsubSeenTTL},t),{scoreParams:p.createPeerScoreParams(t.scoreParams),scoreThresholds:p.createPeerScoreThresholds(t.scoreThresholds)});i.fallbackToFloodsub&&n.push(l.FloodsubID),super(Object.assign({debugName:"libp2p:gossipsub",multicodecs:n,libp2p:e},i)),this._options=i,this.direct=new Set(i.directPeers.map((e=>e.id.toB58String()))),this.acceptFromWhitelist=new Map,i.directPeers.forEach((t=>{e.peerStore.addressBook.add(t.id,t.addrs)})),this.seenCache=new g.SimpleTimeCache({validityMs:i.seenTTL}),this.mesh=new Map,this.fanout=new Map,this.lastpub=new Map,this.gossip=new Map,this.control=new Map,this.peerhave=new Map,this.iasked=new Map,this.backoff=new Map,this.outbound=new Map,this.messageCache=t.messageCache||new c.MessageCache(i.mcacheGossip,i.mcacheLength),this.getFastMsgIdStr=null!==(r=t.fastMsgIdFn)&&void 0!==r?r:void 0,this.fastMsgIdCache=t.fastMsgIdFn?new g.SimpleTimeCache({validityMs:i.seenTTL}):void 0,this.heartbeat=new h.Heartbeat(this),this.heartbeatTicks=0,this.gossipTracer=new y.IWantTracer,this._libp2p=e,this.score=new p.PeerScore(this._options.scoreParams,e.connectionManager)}_decodeRpc(e){return u.RPC.decode(e)}_encodeRpc(e){return u.RPC.encode(e).finish()}_addPeer(e,t){const r=super._addPeer(e,t);this.score.addPeer(e.toB58String());let n=!1;for(const i of this._libp2p.connectionManager.getAll(e))if("outbound"===i.stat.direction&&Array.from(i.registry.values()).some((e=>t===e.protocol))){n=!0;break}return this.outbound.set(r.id.toB58String(),n),r}_removePeer(e){const t=super._removePeer(e),r=e.toB58String();for(const n of this.mesh.values())n.delete(r);for(const n of this.fanout.values())n.delete(r);return this.gossip.delete(r),this.control.delete(r),this.outbound.delete(r),this.score.removePeer(r),this.acceptFromWhitelist.delete(r),t}_processRpc(e,t,r){const n=Object.create(null,{_processRpc:{get:()=>super._processRpc}});return o(this,void 0,void 0,(function*(){return!!(yield n._processRpc.call(this,e,t,r))&&(r.control&&(yield this._processRpcControlMessage(e,r.control)),!0)}))}_processRpcControlMessage(e,t){return o(this,void 0,void 0,(function*(){if(!t)return;const r=t.ihave?this._handleIHave(e,t.ihave):[],n=t.iwant?this._handleIWant(e,t.iwant):[],i=t.graft?yield this._handleGraft(e,t.graft):[];if(t.prune&&this._handlePrune(e,t.prune),!r.length&&!n.length&&!i.length)return;const s=f.createGossipRpc(n,{iwant:r,prune:i});this._sendRpc(e,s)}))}_processRpcMessage(e){const t=Object.create(null,{_processRpcMessage:{get:()=>super._processRpcMessage}});return o(this,void 0,void 0,(function*(){let r;if(this.getFastMsgIdStr&&this.fastMsgIdCache){const t=yield this.getFastMsgIdStr(e);if(r=this.fastMsgIdCache.get(t),void 0!==r)return void this.score.duplicateMessage(e,r);r=f.messageIdToString(yield this.getMsgId(e)),this.fastMsgIdCache.put(t,r)}else if(r=f.messageIdToString(yield this.getMsgId(e)),this.seenCache.has(r))return void this.score.duplicateMessage(e,r);this.seenCache.put(r),yield this.score.validateMessage(r),yield t._processRpcMessage.call(this,e)}))}_acceptFrom(e){if(this.direct.has(e))return!0;const t=Date.now(),r=this.acceptFromWhitelist.get(e);if(r&&r.messagesAccepted<b.ACCEPT_FROM_WHITELIST_MAX_MESSAGES&&r.acceptUntil>=t)return r.messagesAccepted+=1,!0;const n=this.score.score(e);return n>=b.ACCEPT_FROM_WHITELIST_THRESHOLD_SCORE?this.acceptFromWhitelist.set(e,{messagesAccepted:0,acceptUntil:t+b.ACCEPT_FROM_WHITELIST_DURATION_MS}):this.acceptFromWhitelist.delete(e),n>=this._options.scoreThresholds.graylistThreshold}validate(e){const t=Object.create(null,{validate:{get:()=>super.validate}});return o(this,void 0,void 0,(function*(){try{yield t.validate.call(this,e)}catch(r){const t=yield this.getCanonicalMsgIdStr(e);throw this.score.rejectMessage(e,t,r.code),this.gossipTracer.rejectMessage(t,r.code),r}}))}_handleIHave(e,t){if(!t.length)return[];const r=this.score.score(e);if(r<this._options.scoreThresholds.gossipThreshold)return this.log("IHAVE: ignoring peer %s with score below threshold [ score = %d ]",e,r),[];const n=(this.peerhave.get(e)||0)+1;if(this.peerhave.set(e,n),n>l.GossipsubMaxIHaveMessages)return this.log("IHAVE: peer %s has advertised too many times (%d) within this heartbeat interval; ignoring",e,n),[];const i=this.iasked.get(e)||0;if(i>=l.GossipsubMaxIHaveLength)return this.log("IHAVE: peer %s has already advertised too many messages (%d); ignoring",e,i),[];const s=new Map;if(t.forEach((e=>{let{topicID:t,messageIDs:r}=e;t&&r&&this.mesh.has(t)&&r.forEach((e=>{const t=f.messageIdToString(e);this.seenCache.has(t)||s.set(t,e)}))})),!s.size)return[];let o=s.size;o+i>l.GossipsubMaxIHaveLength&&(o=l.GossipsubMaxIHaveLength-i),this.log("IHAVE: Asking for %d out of %d messages from %s",o,s.size,e);let a=Array.from(s.values());return f.shuffle(a),a=a.slice(0,o),this.iasked.set(e,i+o),this.gossipTracer.addPromise(e,a),[{messageIDs:a}]}_handleIWant(e,t){if(!t.length)return[];const r=this.score.score(e);if(r<this._options.scoreThresholds.gossipThreshold)return this.log("IWANT: ignoring peer %s with score below threshold [score = %d]",e,r),[];const n=new Map;return t.forEach((t=>{let{messageIDs:r}=t;r&&r.forEach((t=>{const r=f.messageIdToString(t),[i,s]=this.messageCache.getForPeer(r,e);i&&(s>l.GossipsubGossipRetransmission?this.log("IWANT: Peer %s has asked for message %s too many times: ignoring request",e,t):n.set(r,i))}))})),n.size?(this.log("IWANT: Sending %d messages to %s",n.size,e),Array.from(n.values()).map(a.utils.normalizeOutRpcMessage)):[]}_handleGraft(e,t){return o(this,void 0,void 0,(function*(){const r=[],n=this.score.score(e),i=this._now();let s=this._options.doPX;return t.forEach((t=>{let{topicID:o}=t;var a;if(!o)return;const c=this.mesh.get(o);if(!c)return void(s=!1);if(c.has(e))return;if(this.direct.has(e))return this.log("GRAFT: ignoring request from direct peer %s",e),r.push(o),void(s=!1);const u=null===(a=this.backoff.get(o))||void 0===a?void 0:a.get(e);if("number"===typeof u&&i<u){this.log("GRAFT: ignoring backed off peer %s",e),this.score.addPenalty(e,1),s=!1;const t=u+l.GossipsubGraftFloodThreshold-l.GossipsubPruneBackoff;return i<t&&this.score.addPenalty(e,1),this._addBackoff(e,o),void r.push(o)}return n<0?(this.log("GRAFT: ignoring peer %s with negative score: score=%d, topic=%s",e,n,o),r.push(o),s=!1,void this._addBackoff(e,o)):c.size>=this._options.Dhi&&!this.outbound.get(e)?(r.push(o),void this._addBackoff(e,o)):(this.log("GRAFT: Add mesh link from %s in %s",e,o),this.score.graft(e,o),void c.add(e))})),r.length?Promise.all(r.map((t=>this._makePrune(e,t,s)))):[]}))}_handlePrune(e,t){const r=this.score.score(e);t.forEach((t=>{let{topicID:n,backoff:i,peers:s}=t;if(!n)return;const o=this.mesh.get(n);if(o&&(this.log("PRUNE: Remove mesh link to %s in %s",e,n),this.score.prune(e,n),o.delete(e),"number"===typeof i&&i>0?this._doAddBackoff(e,n,1e3*i):this._addBackoff(e,n),s&&s.length)){if(r<this._options.scoreThresholds.acceptPXThreshold)return void this.log("PRUNE: ignoring PX from peer %s with insufficient score [score = %d, topic = %s]",e,r,n);this._pxConnect(s)}}))}_addBackoff(e,t){this._doAddBackoff(e,t,l.GossipsubPruneBackoff)}_doAddBackoff(e,t,r){let n=this.backoff.get(t);n||(n=new Map,this.backoff.set(t,n));const i=this._now()+r;(n.get(e)||0)<i&&n.set(e,i)}_applyIwantPenalties(){this.gossipTracer.getBrokenPromises().forEach(((e,t)=>{this.log("peer %s didn't follow up in %d IWANT requests; adding penalty",t,e),this.score.addPenalty(t,e)}))}_clearBackoff(){if(this.heartbeatTicks%l.GossipsubPruneBackoffTicks!==0)return;const e=this._now();this.backoff.forEach(((t,r)=>{t.forEach(((r,n)=>{r<e&&t.delete(n)})),0===t.size&&this.backoff.delete(r)}))}_directConnect(){if(this.heartbeatTicks%l.GossipsubDirectConnectTicks!==0)return;const e=[];this.direct.forEach((t=>{const r=this.peers.get(t);r&&r.isWritable||e.push(t)})),e.length&&e.forEach((e=>{this._connect(e)}))}_pxConnect(e){return o(this,void 0,void 0,(function*(){e.length>l.GossipsubPrunePeers&&(f.shuffle(e),e=e.slice(0,l.GossipsubPrunePeers));const t=[];yield Promise.all(e.map((e=>o(this,void 0,void 0,(function*(){if(!e.peerID)return;const r=m.createFromBytes(e.peerID).toB58String();if(!this.peers.has(r))if(e.signedPeerRecord)try{const n=yield v.openAndCertify(e.signedPeerRecord,"libp2p-peer-record"),i=n.peerId.toB58String();if(r!==i)return void this.log("bogus peer record obtained through px: peer ID %s doesn't match expected peer %s",i,r);if(!this._libp2p.peerStore.addressBook.consumePeerRecord(n))return void this.log("bogus peer record obtained through px: could not add peer record to address book");t.push(r)}catch(n){this.log("bogus peer record obtained through px: invalid signature or not a peer record")}else t.push(r)}))))),t.length&&t.forEach((e=>this._connect(e)))}))}start(){const e=Object.create(null,{start:{get:()=>super.start}});return o(this,void 0,void 0,(function*(){yield e.start.call(this),this.heartbeat.start(),this.score.start(),this._directPeerInitial=setTimeout((()=>{this.direct.forEach((e=>{this._connect(e)}))}),l.GossipsubDirectConnectInitialDelay)}))}stop(){const e=Object.create(null,{stop:{get:()=>super.stop}});return o(this,void 0,void 0,(function*(){yield e.stop.call(this),this.heartbeat.stop(),this.score.stop(),this.mesh=new Map,this.fanout=new Map,this.lastpub=new Map,this.gossip=new Map,this.control=new Map,this.peerhave=new Map,this.iasked=new Map,this.backoff=new Map,this.outbound=new Map,this.gossipTracer.clear(),this.seenCache.clear(),this.fastMsgIdCache&&this.fastMsgIdCache.clear(),clearTimeout(this._directPeerInitial)}))}_connect(e){this.log("Initiating connection with %s",e),this._libp2p.dialProtocol(m.createFromB58String(e),this.multicodecs)}subscribe(e){super.subscribe(e),this.join(e)}unsubscribe(e){super.unsubscribe(e),this.leave(e)}join(e){if(!this.started)throw new Error("Gossipsub has not started");this.log("JOIN %s",e);const t=this.fanout.get(e);if(t)t.forEach((e=>{this.score.score(e)<0&&t.delete(e)})),t.size<this._options.D&&d.getGossipPeers(this,e,this._options.D-t.size,(e=>!t.has(e)&&!this.direct.has(e)&&this.score.score(e)>=0)).forEach((e=>t.add(e))),this.mesh.set(e,t),this.fanout.delete(e),this.lastpub.delete(e);else{const t=d.getGossipPeers(this,e,this._options.D,(e=>!this.direct.has(e)&&this.score.score(e)>=0));this.mesh.set(e,t)}this.mesh.get(e).forEach((t=>{this.log("JOIN: Add mesh link to %s in %s",t,e),this._sendGraft(t,e)}))}leave(e){if(!this.started)throw new Error("Gossipsub has not started");this.log("LEAVE %s",e);const t=this.mesh.get(e);t&&(t.forEach((t=>{this.log("LEAVE: Remove mesh link to %s in %s",t,e),this._sendPrune(t,e)})),this.mesh.delete(e))}getCanonicalMsgIdStr(e){var t,r;return o(this,void 0,void 0,(function*(){return this.fastMsgIdCache&&this.getFastMsgIdStr&&null!==(r=null!==(t=this.getCachedMsgIdStr(e))&&void 0!==t?t:this.fastMsgIdCache.get(this.getFastMsgIdStr(e)))&&void 0!==r?r:f.messageIdToString(yield this.getMsgId(e))}))}getCachedMsgIdStr(e){}_publish(e){return o(this,void 0,void 0,(function*(){const t=yield this.getCanonicalMsgIdStr(e);e.receivedFrom!==this.peerId.toB58String()&&(this.score.deliverMessage(e,t),this.gossipTracer.deliverMessage(t)),this.seenCache.put(t),this.messageCache.put(e,t);const r=new Set;e.topicIDs.forEach((t=>{const n=this.topics.get(t);if(n)if(this._options.floodPublish&&e.from===this.peerId.toB58String())n.forEach((e=>{(this.direct.has(e)||this.score.score(e)>=this._options.scoreThresholds.publishThreshold)&&r.add(e)}));else{this.direct.forEach((e=>{r.add(e)})),n.forEach((e=>{const t=this.score.score(e),n=this.peers.get(e);n&&n.protocol===l.FloodsubID&&t>=this._options.scoreThresholds.publishThreshold&&r.add(e)}));let e=this.mesh.get(t);if(!e||!e.size){if(e=this.fanout.get(t),!e){const r=d.getGossipPeers(this,t,this._options.D,(e=>this.score.score(e)>=this._options.scoreThresholds.publishThreshold));r.size>0?(e=r,this.fanout.set(t,r)):e=new Set}this.lastpub.set(t,this._now())}e.forEach((e=>{r.add(e)}))}}));const n=f.createGossipRpc([a.utils.normalizeOutRpcMessage(e)]);r.forEach((t=>{t!==e.from&&this._sendRpc(t,n)}))}))}_sendGraft(e,t){const r=[{topicID:t}],n=f.createGossipRpc([],{graft:r});this._sendRpc(e,n)}_sendPrune(e,t){return o(this,void 0,void 0,(function*(){const r=[yield this._makePrune(e,t,this._options.doPX)],n=f.createGossipRpc([],{prune:r});this._sendRpc(e,n)}))}_sendRpc(e,t){const r=this.peers.get(e);if(!r||!r.isWritable)return;const n=this.control.get(e);n&&(this._piggybackControl(e,t,n),this.control.delete(e));const i=this.gossip.get(e);i&&(this._piggybackGossip(e,t,i),this.gossip.delete(e)),r.write(u.RPC.encode(t).finish())}_piggybackControl(e,t,r){const n=(r.graft||[]).filter((t=>{let{topicID:r}=t;return(r&&this.mesh.get(r)||new Set).has(e)})),i=(r.prune||[]).filter((t=>{let{topicID:r}=t;return!(r&&this.mesh.get(r)||new Set).has(e)}));(n.length||i.length)&&(t.control?(t.control.graft=t.control.graft&&t.control.graft.concat(n),t.control.prune=t.control.prune&&t.control.prune.concat(i)):t.control={ihave:[],iwant:[],graft:n,prune:i})}_piggybackGossip(e,t,r){t.control||(t.control={ihave:[],iwant:[],graft:[],prune:[]}),t.control.ihave=r}_sendGraftPrune(e,t,r){return o(this,void 0,void 0,(function*(){const n=this._options.doPX;for(const[i,s]of e){const e=s.map((e=>({topicID:e})));let o=[];const a=t.get(i);a&&(o=yield Promise.all(a.map((e=>this._makePrune(i,e,n&&!r.get(i))))),t.delete(i));const c=f.createGossipRpc([],{graft:e,prune:o});this._sendRpc(i,c)}for(const[e,i]of t){const t=yield Promise.all(i.map((t=>this._makePrune(e,t,n&&!r.get(e))))),s=f.createGossipRpc([],{prune:t});this._sendRpc(e,s)}}))}_emitGossip(e,t){const r=this.messageCache.getGossipIDs(e);if(!r.length)return;f.shuffle(r),r.length>l.GossipsubMaxIHaveLength&&this.log("too many messages for gossip; will truncate IHAVE list (%d messages)",r.length);const n=[],i=this.topics.get(e);if(!i)return;i.forEach((e=>{const r=this.peers.get(e);r&&!t.has(e)&&!this.direct.has(e)&&f.hasGossipProtocol(r.protocol)&&this.score.score(e)>=this._options.scoreThresholds.gossipThreshold&&n.push(e)}));let s=this._options.Dlazy;const o=l.GossipsubGossipFactor*n.length;o>s&&(s=o),s>n.length?s=n.length:f.shuffle(n),n.slice(0,s).forEach((t=>{let n=r;r.length>l.GossipsubMaxIHaveLength&&(n=f.shuffle(n.slice()).slice(0,l.GossipsubMaxIHaveLength)),this._pushGossip(t,{topicID:e,messageIDs:n})}))}_flush(){for(const[e,t]of this.gossip.entries()){this.gossip.delete(e);const r=f.createGossipRpc([],{ihave:t});this._sendRpc(e,r)}for(const[e,t]of this.control.entries()){this.control.delete(e);const r=f.createGossipRpc([],{graft:t.graft,prune:t.prune});this._sendRpc(e,r)}}_pushGossip(e,t){this.log("Add gossip to %s",e);const r=this.gossip.get(e)||[];this.gossip.set(e,r.concat(t))}_now(){return Date.now()}_makePrune(e,t,r){return o(this,void 0,void 0,(function*(){if(this.peers.get(e).protocol===l.GossipsubIDv10)return{topicID:t,peers:[]};const n=l.GossipsubPruneBackoff/1e3;if(!r)return{topicID:t,peers:[],backoff:n};const i=d.getGossipPeers(this,t,l.GossipsubPrunePeers,(t=>t!==e&&this.score.score(t)>=0)),s=yield Promise.all(Array.from(i).map((e=>o(this,void 0,void 0,(function*(){const t=m.createFromB58String(e);return{peerID:t.toBytes(),signedPeerRecord:yield this._libp2p.peerStore.addressBook.getRawEnvelope(t)}})))));return{topicID:t,peers:s,backoff:n}}))}}w.multicodec=l.GossipsubIDv11,e.exports=w},45075:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function o(e){try{c(n.next(e))}catch(t){s(t)}}function a(e){try{c(n.throw(e))}catch(t){s(t)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.MessageCache=void 0;const i=r(53357);t.MessageCache=class{constructor(e,t){this.msgs=new Map,this.peertx=new Map,this.history=[];for(let r=0;r<t;r++)this.history[r]=[];this.gossip=e}put(e,t){return n(this,void 0,void 0,(function*(){this.msgs.set(t,e);const r=i.messageIdFromString(t);this.history[0].push({msgId:r,topics:e.topicIDs})}))}get(e){return this.msgs.get(i.messageIdToString(e))}getForPeer(e,t){const r=this.msgs.get(e);if(!r)return[void 0,0];let n=this.peertx.get(e);n||(n=new Map,this.peertx.set(e,n));const i=(n.get(t)||0)+1;return n.set(t,i),[r,i]}getGossipIDs(e){const t=[];for(let r=0;r<this.gossip;r++)this.history[r].forEach((r=>{for(const n of r.topics)if(n===e){t.push(r.msgId);break}}));return t}shift(){this.history[this.history.length-1].forEach((e=>{const t=i.messageIdToString(e.msgId);this.msgs.delete(t),this.peertx.delete(t)})),this.history.pop(),this.history.unshift([])}}},83519:function(e,t,r){var n,i,s;i=[r(80886)],void 0===(s="function"===typeof(n=function(e){"use strict";var t=e.Reader,r=e.Writer,n=e.util,i=e.roots.default||(e.roots.default={});return i.RPC=function(){function s(e){if(this.subscriptions=[],this.msgs=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}var o;return s.prototype.subscriptions=n.emptyArray,s.prototype.msgs=n.emptyArray,s.prototype.control=null,Object.defineProperty(s.prototype,"_control",{get:n.oneOfGetter(o=["control"]),set:n.oneOfSetter(o)}),s.encode=function(e,t){if(t||(t=r.create()),null!=e.subscriptions&&e.subscriptions.length)for(var n=0;n<e.subscriptions.length;++n)i.RPC.SubOpts.encode(e.subscriptions[n],t.uint32(10).fork()).ldelim();if(null!=e.msgs&&e.msgs.length)for(n=0;n<e.msgs.length;++n)i.RPC.Message.encode(e.msgs[n],t.uint32(18).fork()).ldelim();return null!=e.control&&Object.hasOwnProperty.call(e,"control")&&i.RPC.ControlMessage.encode(e.control,t.uint32(26).fork()).ldelim(),t},s.decode=function(e,r){e instanceof t||(e=t.create(e));for(var n=void 0===r?e.len:e.pos+r,s=new i.RPC;e.pos<n;){var o=e.uint32();switch(o>>>3){case 1:s.subscriptions&&s.subscriptions.length||(s.subscriptions=[]),s.subscriptions.push(i.RPC.SubOpts.decode(e,e.uint32()));break;case 2:s.msgs&&s.msgs.length||(s.msgs=[]),s.msgs.push(i.RPC.Message.decode(e,e.uint32()));break;case 3:s.control=i.RPC.ControlMessage.decode(e,e.uint32());break;default:e.skipType(7&o)}}return s},s.fromObject=function(e){if(e instanceof i.RPC)return e;var t=new i.RPC;if(e.subscriptions){if(!Array.isArray(e.subscriptions))throw TypeError(".RPC.subscriptions: array expected");t.subscriptions=[];for(var r=0;r<e.subscriptions.length;++r){if("object"!==typeof e.subscriptions[r])throw TypeError(".RPC.subscriptions: object expected");t.subscriptions[r]=i.RPC.SubOpts.fromObject(e.subscriptions[r])}}if(e.msgs){if(!Array.isArray(e.msgs))throw TypeError(".RPC.msgs: array expected");for(t.msgs=[],r=0;r<e.msgs.length;++r){if("object"!==typeof e.msgs[r])throw TypeError(".RPC.msgs: object expected");t.msgs[r]=i.RPC.Message.fromObject(e.msgs[r])}}if(null!=e.control){if("object"!==typeof e.control)throw TypeError(".RPC.control: object expected");t.control=i.RPC.ControlMessage.fromObject(e.control)}return t},s.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.subscriptions=[],r.msgs=[]),e.subscriptions&&e.subscriptions.length){r.subscriptions=[];for(var n=0;n<e.subscriptions.length;++n)r.subscriptions[n]=i.RPC.SubOpts.toObject(e.subscriptions[n],t)}if(e.msgs&&e.msgs.length)for(r.msgs=[],n=0;n<e.msgs.length;++n)r.msgs[n]=i.RPC.Message.toObject(e.msgs[n],t);return null!=e.control&&e.hasOwnProperty("control")&&(r.control=i.RPC.ControlMessage.toObject(e.control,t),t.oneofs&&(r._control="control")),r},s.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},s.SubOpts=function(){function s(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}var o;return s.prototype.subscribe=null,s.prototype.topicID=null,Object.defineProperty(s.prototype,"_subscribe",{get:n.oneOfGetter(o=["subscribe"]),set:n.oneOfSetter(o)}),Object.defineProperty(s.prototype,"_topicID",{get:n.oneOfGetter(o=["topicID"]),set:n.oneOfSetter(o)}),s.encode=function(e,t){return t||(t=r.create()),null!=e.subscribe&&Object.hasOwnProperty.call(e,"subscribe")&&t.uint32(8).bool(e.subscribe),null!=e.topicID&&Object.hasOwnProperty.call(e,"topicID")&&t.uint32(18).string(e.topicID),t},s.decode=function(e,r){e instanceof t||(e=t.create(e));for(var n=void 0===r?e.len:e.pos+r,s=new i.RPC.SubOpts;e.pos<n;){var o=e.uint32();switch(o>>>3){case 1:s.subscribe=e.bool();break;case 2:s.topicID=e.string();break;default:e.skipType(7&o)}}return s},s.fromObject=function(e){if(e instanceof i.RPC.SubOpts)return e;var t=new i.RPC.SubOpts;return null!=e.subscribe&&(t.subscribe=Boolean(e.subscribe)),null!=e.topicID&&(t.topicID=String(e.topicID)),t},s.toObject=function(e,t){t||(t={});var r={};return null!=e.subscribe&&e.hasOwnProperty("subscribe")&&(r.subscribe=e.subscribe,t.oneofs&&(r._subscribe="subscribe")),null!=e.topicID&&e.hasOwnProperty("topicID")&&(r.topicID=e.topicID,t.oneofs&&(r._topicID="topicID")),r},s.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},s}(),s.Message=function(){function s(e){if(this.topicIDs=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}var o;return s.prototype.from=null,s.prototype.data=null,s.prototype.seqno=null,s.prototype.topicIDs=n.emptyArray,s.prototype.signature=null,s.prototype.key=null,Object.defineProperty(s.prototype,"_from",{get:n.oneOfGetter(o=["from"]),set:n.oneOfSetter(o)}),Object.defineProperty(s.prototype,"_data",{get:n.oneOfGetter(o=["data"]),set:n.oneOfSetter(o)}),Object.defineProperty(s.prototype,"_seqno",{get:n.oneOfGetter(o=["seqno"]),set:n.oneOfSetter(o)}),Object.defineProperty(s.prototype,"_signature",{get:n.oneOfGetter(o=["signature"]),set:n.oneOfSetter(o)}),Object.defineProperty(s.prototype,"_key",{get:n.oneOfGetter(o=["key"]),set:n.oneOfSetter(o)}),s.encode=function(e,t){if(t||(t=r.create()),null!=e.from&&Object.hasOwnProperty.call(e,"from")&&t.uint32(10).bytes(e.from),null!=e.data&&Object.hasOwnProperty.call(e,"data")&&t.uint32(18).bytes(e.data),null!=e.seqno&&Object.hasOwnProperty.call(e,"seqno")&&t.uint32(26).bytes(e.seqno),null!=e.topicIDs&&e.topicIDs.length)for(var n=0;n<e.topicIDs.length;++n)t.uint32(34).string(e.topicIDs[n]);return null!=e.signature&&Object.hasOwnProperty.call(e,"signature")&&t.uint32(42).bytes(e.signature),null!=e.key&&Object.hasOwnProperty.call(e,"key")&&t.uint32(50).bytes(e.key),t},s.decode=function(e,r){e instanceof t||(e=t.create(e));for(var n=void 0===r?e.len:e.pos+r,s=new i.RPC.Message;e.pos<n;){var o=e.uint32();switch(o>>>3){case 1:s.from=e.bytes();break;case 2:s.data=e.bytes();break;case 3:s.seqno=e.bytes();break;case 4:s.topicIDs&&s.topicIDs.length||(s.topicIDs=[]),s.topicIDs.push(e.string());break;case 5:s.signature=e.bytes();break;case 6:s.key=e.bytes();break;default:e.skipType(7&o)}}return s},s.fromObject=function(e){if(e instanceof i.RPC.Message)return e;var t=new i.RPC.Message;if(null!=e.from&&("string"===typeof e.from?n.base64.decode(e.from,t.from=n.newBuffer(n.base64.length(e.from)),0):e.from.length&&(t.from=e.from)),null!=e.data&&("string"===typeof e.data?n.base64.decode(e.data,t.data=n.newBuffer(n.base64.length(e.data)),0):e.data.length&&(t.data=e.data)),null!=e.seqno&&("string"===typeof e.seqno?n.base64.decode(e.seqno,t.seqno=n.newBuffer(n.base64.length(e.seqno)),0):e.seqno.length&&(t.seqno=e.seqno)),e.topicIDs){if(!Array.isArray(e.topicIDs))throw TypeError(".RPC.Message.topicIDs: array expected");t.topicIDs=[];for(var r=0;r<e.topicIDs.length;++r)t.topicIDs[r]=String(e.topicIDs[r])}return null!=e.signature&&("string"===typeof e.signature?n.base64.decode(e.signature,t.signature=n.newBuffer(n.base64.length(e.signature)),0):e.signature.length&&(t.signature=e.signature)),null!=e.key&&("string"===typeof e.key?n.base64.decode(e.key,t.key=n.newBuffer(n.base64.length(e.key)),0):e.key.length&&(t.key=e.key)),t},s.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.topicIDs=[]),null!=e.from&&e.hasOwnProperty("from")&&(r.from=t.bytes===String?n.base64.encode(e.from,0,e.from.length):t.bytes===Array?Array.prototype.slice.call(e.from):e.from,t.oneofs&&(r._from="from")),null!=e.data&&e.hasOwnProperty("data")&&(r.data=t.bytes===String?n.base64.encode(e.data,0,e.data.length):t.bytes===Array?Array.prototype.slice.call(e.data):e.data,t.oneofs&&(r._data="data")),null!=e.seqno&&e.hasOwnProperty("seqno")&&(r.seqno=t.bytes===String?n.base64.encode(e.seqno,0,e.seqno.length):t.bytes===Array?Array.prototype.slice.call(e.seqno):e.seqno,t.oneofs&&(r._seqno="seqno")),e.topicIDs&&e.topicIDs.length){r.topicIDs=[];for(var i=0;i<e.topicIDs.length;++i)r.topicIDs[i]=e.topicIDs[i]}return null!=e.signature&&e.hasOwnProperty("signature")&&(r.signature=t.bytes===String?n.base64.encode(e.signature,0,e.signature.length):t.bytes===Array?Array.prototype.slice.call(e.signature):e.signature,t.oneofs&&(r._signature="signature")),null!=e.key&&e.hasOwnProperty("key")&&(r.key=t.bytes===String?n.base64.encode(e.key,0,e.key.length):t.bytes===Array?Array.prototype.slice.call(e.key):e.key,t.oneofs&&(r._key="key")),r},s.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},s}(),s.ControlMessage=function(){function s(e){if(this.ihave=[],this.iwant=[],this.graft=[],this.prune=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return s.prototype.ihave=n.emptyArray,s.prototype.iwant=n.emptyArray,s.prototype.graft=n.emptyArray,s.prototype.prune=n.emptyArray,s.encode=function(e,t){if(t||(t=r.create()),null!=e.ihave&&e.ihave.length)for(var n=0;n<e.ihave.length;++n)i.RPC.ControlIHave.encode(e.ihave[n],t.uint32(10).fork()).ldelim();if(null!=e.iwant&&e.iwant.length)for(n=0;n<e.iwant.length;++n)i.RPC.ControlIWant.encode(e.iwant[n],t.uint32(18).fork()).ldelim();if(null!=e.graft&&e.graft.length)for(n=0;n<e.graft.length;++n)i.RPC.ControlGraft.encode(e.graft[n],t.uint32(26).fork()).ldelim();if(null!=e.prune&&e.prune.length)for(n=0;n<e.prune.length;++n)i.RPC.ControlPrune.encode(e.prune[n],t.uint32(34).fork()).ldelim();return t},s.decode=function(e,r){e instanceof t||(e=t.create(e));for(var n=void 0===r?e.len:e.pos+r,s=new i.RPC.ControlMessage;e.pos<n;){var o=e.uint32();switch(o>>>3){case 1:s.ihave&&s.ihave.length||(s.ihave=[]),s.ihave.push(i.RPC.ControlIHave.decode(e,e.uint32()));break;case 2:s.iwant&&s.iwant.length||(s.iwant=[]),s.iwant.push(i.RPC.ControlIWant.decode(e,e.uint32()));break;case 3:s.graft&&s.graft.length||(s.graft=[]),s.graft.push(i.RPC.ControlGraft.decode(e,e.uint32()));break;case 4:s.prune&&s.prune.length||(s.prune=[]),s.prune.push(i.RPC.ControlPrune.decode(e,e.uint32()));break;default:e.skipType(7&o)}}return s},s.fromObject=function(e){if(e instanceof i.RPC.ControlMessage)return e;var t=new i.RPC.ControlMessage;if(e.ihave){if(!Array.isArray(e.ihave))throw TypeError(".RPC.ControlMessage.ihave: array expected");t.ihave=[];for(var r=0;r<e.ihave.length;++r){if("object"!==typeof e.ihave[r])throw TypeError(".RPC.ControlMessage.ihave: object expected");t.ihave[r]=i.RPC.ControlIHave.fromObject(e.ihave[r])}}if(e.iwant){if(!Array.isArray(e.iwant))throw TypeError(".RPC.ControlMessage.iwant: array expected");for(t.iwant=[],r=0;r<e.iwant.length;++r){if("object"!==typeof e.iwant[r])throw TypeError(".RPC.ControlMessage.iwant: object expected");t.iwant[r]=i.RPC.ControlIWant.fromObject(e.iwant[r])}}if(e.graft){if(!Array.isArray(e.graft))throw TypeError(".RPC.ControlMessage.graft: array expected");for(t.graft=[],r=0;r<e.graft.length;++r){if("object"!==typeof e.graft[r])throw TypeError(".RPC.ControlMessage.graft: object expected");t.graft[r]=i.RPC.ControlGraft.fromObject(e.graft[r])}}if(e.prune){if(!Array.isArray(e.prune))throw TypeError(".RPC.ControlMessage.prune: array expected");for(t.prune=[],r=0;r<e.prune.length;++r){if("object"!==typeof e.prune[r])throw TypeError(".RPC.ControlMessage.prune: object expected");t.prune[r]=i.RPC.ControlPrune.fromObject(e.prune[r])}}return t},s.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.ihave=[],r.iwant=[],r.graft=[],r.prune=[]),e.ihave&&e.ihave.length){r.ihave=[];for(var n=0;n<e.ihave.length;++n)r.ihave[n]=i.RPC.ControlIHave.toObject(e.ihave[n],t)}if(e.iwant&&e.iwant.length)for(r.iwant=[],n=0;n<e.iwant.length;++n)r.iwant[n]=i.RPC.ControlIWant.toObject(e.iwant[n],t);if(e.graft&&e.graft.length)for(r.graft=[],n=0;n<e.graft.length;++n)r.graft[n]=i.RPC.ControlGraft.toObject(e.graft[n],t);if(e.prune&&e.prune.length)for(r.prune=[],n=0;n<e.prune.length;++n)r.prune[n]=i.RPC.ControlPrune.toObject(e.prune[n],t);return r},s.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},s}(),s.ControlIHave=function(){function s(e){if(this.messageIDs=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}var o;return s.prototype.topicID=null,s.prototype.messageIDs=n.emptyArray,Object.defineProperty(s.prototype,"_topicID",{get:n.oneOfGetter(o=["topicID"]),set:n.oneOfSetter(o)}),s.encode=function(e,t){if(t||(t=r.create()),null!=e.topicID&&Object.hasOwnProperty.call(e,"topicID")&&t.uint32(10).string(e.topicID),null!=e.messageIDs&&e.messageIDs.length)for(var n=0;n<e.messageIDs.length;++n)t.uint32(18).bytes(e.messageIDs[n]);return t},s.decode=function(e,r){e instanceof t||(e=t.create(e));for(var n=void 0===r?e.len:e.pos+r,s=new i.RPC.ControlIHave;e.pos<n;){var o=e.uint32();switch(o>>>3){case 1:s.topicID=e.string();break;case 2:s.messageIDs&&s.messageIDs.length||(s.messageIDs=[]),s.messageIDs.push(e.bytes());break;default:e.skipType(7&o)}}return s},s.fromObject=function(e){if(e instanceof i.RPC.ControlIHave)return e;var t=new i.RPC.ControlIHave;if(null!=e.topicID&&(t.topicID=String(e.topicID)),e.messageIDs){if(!Array.isArray(e.messageIDs))throw TypeError(".RPC.ControlIHave.messageIDs: array expected");t.messageIDs=[];for(var r=0;r<e.messageIDs.length;++r)"string"===typeof e.messageIDs[r]?n.base64.decode(e.messageIDs[r],t.messageIDs[r]=n.newBuffer(n.base64.length(e.messageIDs[r])),0):e.messageIDs[r].length&&(t.messageIDs[r]=e.messageIDs[r])}return t},s.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.messageIDs=[]),null!=e.topicID&&e.hasOwnProperty("topicID")&&(r.topicID=e.topicID,t.oneofs&&(r._topicID="topicID")),e.messageIDs&&e.messageIDs.length){r.messageIDs=[];for(var i=0;i<e.messageIDs.length;++i)r.messageIDs[i]=t.bytes===String?n.base64.encode(e.messageIDs[i],0,e.messageIDs[i].length):t.bytes===Array?Array.prototype.slice.call(e.messageIDs[i]):e.messageIDs[i]}return r},s.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},s}(),s.ControlIWant=function(){function s(e){if(this.messageIDs=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return s.prototype.messageIDs=n.emptyArray,s.encode=function(e,t){if(t||(t=r.create()),null!=e.messageIDs&&e.messageIDs.length)for(var n=0;n<e.messageIDs.length;++n)t.uint32(10).bytes(e.messageIDs[n]);return t},s.decode=function(e,r){e instanceof t||(e=t.create(e));for(var n=void 0===r?e.len:e.pos+r,s=new i.RPC.ControlIWant;e.pos<n;){var o=e.uint32();o>>>3===1?(s.messageIDs&&s.messageIDs.length||(s.messageIDs=[]),s.messageIDs.push(e.bytes())):e.skipType(7&o)}return s},s.fromObject=function(e){if(e instanceof i.RPC.ControlIWant)return e;var t=new i.RPC.ControlIWant;if(e.messageIDs){if(!Array.isArray(e.messageIDs))throw TypeError(".RPC.ControlIWant.messageIDs: array expected");t.messageIDs=[];for(var r=0;r<e.messageIDs.length;++r)"string"===typeof e.messageIDs[r]?n.base64.decode(e.messageIDs[r],t.messageIDs[r]=n.newBuffer(n.base64.length(e.messageIDs[r])),0):e.messageIDs[r].length&&(t.messageIDs[r]=e.messageIDs[r])}return t},s.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.messageIDs=[]),e.messageIDs&&e.messageIDs.length){r.messageIDs=[];for(var i=0;i<e.messageIDs.length;++i)r.messageIDs[i]=t.bytes===String?n.base64.encode(e.messageIDs[i],0,e.messageIDs[i].length):t.bytes===Array?Array.prototype.slice.call(e.messageIDs[i]):e.messageIDs[i]}return r},s.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},s}(),s.ControlGraft=function(){function s(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}var o;return s.prototype.topicID=null,Object.defineProperty(s.prototype,"_topicID",{get:n.oneOfGetter(o=["topicID"]),set:n.oneOfSetter(o)}),s.encode=function(e,t){return t||(t=r.create()),null!=e.topicID&&Object.hasOwnProperty.call(e,"topicID")&&t.uint32(10).string(e.topicID),t},s.decode=function(e,r){e instanceof t||(e=t.create(e));for(var n=void 0===r?e.len:e.pos+r,s=new i.RPC.ControlGraft;e.pos<n;){var o=e.uint32();o>>>3===1?s.topicID=e.string():e.skipType(7&o)}return s},s.fromObject=function(e){if(e instanceof i.RPC.ControlGraft)return e;var t=new i.RPC.ControlGraft;return null!=e.topicID&&(t.topicID=String(e.topicID)),t},s.toObject=function(e,t){t||(t={});var r={};return null!=e.topicID&&e.hasOwnProperty("topicID")&&(r.topicID=e.topicID,t.oneofs&&(r._topicID="topicID")),r},s.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},s}(),s.ControlPrune=function(){function s(e){if(this.peers=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}var o;return s.prototype.topicID=null,s.prototype.peers=n.emptyArray,s.prototype.backoff=null,Object.defineProperty(s.prototype,"_topicID",{get:n.oneOfGetter(o=["topicID"]),set:n.oneOfSetter(o)}),Object.defineProperty(s.prototype,"_backoff",{get:n.oneOfGetter(o=["backoff"]),set:n.oneOfSetter(o)}),s.encode=function(e,t){if(t||(t=r.create()),null!=e.topicID&&Object.hasOwnProperty.call(e,"topicID")&&t.uint32(10).string(e.topicID),null!=e.peers&&e.peers.length)for(var n=0;n<e.peers.length;++n)i.RPC.PeerInfo.encode(e.peers[n],t.uint32(18).fork()).ldelim();return null!=e.backoff&&Object.hasOwnProperty.call(e,"backoff")&&t.uint32(24).uint64(e.backoff),t},s.decode=function(e,r){e instanceof t||(e=t.create(e));for(var n=void 0===r?e.len:e.pos+r,s=new i.RPC.ControlPrune;e.pos<n;){var o=e.uint32();switch(o>>>3){case 1:s.topicID=e.string();break;case 2:s.peers&&s.peers.length||(s.peers=[]),s.peers.push(i.RPC.PeerInfo.decode(e,e.uint32()));break;case 3:s.backoff=e.uint64();break;default:e.skipType(7&o)}}return s},s.fromObject=function(e){if(e instanceof i.RPC.ControlPrune)return e;var t=new i.RPC.ControlPrune;if(null!=e.topicID&&(t.topicID=String(e.topicID)),e.peers){if(!Array.isArray(e.peers))throw TypeError(".RPC.ControlPrune.peers: array expected");t.peers=[];for(var r=0;r<e.peers.length;++r){if("object"!==typeof e.peers[r])throw TypeError(".RPC.ControlPrune.peers: object expected");t.peers[r]=i.RPC.PeerInfo.fromObject(e.peers[r])}}return null!=e.backoff&&(n.Long?(t.backoff=n.Long.fromValue(e.backoff)).unsigned=!0:"string"===typeof e.backoff?t.backoff=parseInt(e.backoff,10):"number"===typeof e.backoff?t.backoff=e.backoff:"object"===typeof e.backoff&&(t.backoff=new n.LongBits(e.backoff.low>>>0,e.backoff.high>>>0).toNumber(!0))),t},s.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.peers=[]),null!=e.topicID&&e.hasOwnProperty("topicID")&&(r.topicID=e.topicID,t.oneofs&&(r._topicID="topicID")),e.peers&&e.peers.length){r.peers=[];for(var s=0;s<e.peers.length;++s)r.peers[s]=i.RPC.PeerInfo.toObject(e.peers[s],t)}return null!=e.backoff&&e.hasOwnProperty("backoff")&&("number"===typeof e.backoff?r.backoff=t.longs===String?String(e.backoff):e.backoff:r.backoff=t.longs===String?n.Long.prototype.toString.call(e.backoff):t.longs===Number?new n.LongBits(e.backoff.low>>>0,e.backoff.high>>>0).toNumber(!0):e.backoff,t.oneofs&&(r._backoff="backoff")),r},s.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},s}(),s.PeerInfo=function(){function s(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}var o;return s.prototype.peerID=null,s.prototype.signedPeerRecord=null,Object.defineProperty(s.prototype,"_peerID",{get:n.oneOfGetter(o=["peerID"]),set:n.oneOfSetter(o)}),Object.defineProperty(s.prototype,"_signedPeerRecord",{get:n.oneOfGetter(o=["signedPeerRecord"]),set:n.oneOfSetter(o)}),s.encode=function(e,t){return t||(t=r.create()),null!=e.peerID&&Object.hasOwnProperty.call(e,"peerID")&&t.uint32(10).bytes(e.peerID),null!=e.signedPeerRecord&&Object.hasOwnProperty.call(e,"signedPeerRecord")&&t.uint32(18).bytes(e.signedPeerRecord),t},s.decode=function(e,r){e instanceof t||(e=t.create(e));for(var n=void 0===r?e.len:e.pos+r,s=new i.RPC.PeerInfo;e.pos<n;){var o=e.uint32();switch(o>>>3){case 1:s.peerID=e.bytes();break;case 2:s.signedPeerRecord=e.bytes();break;default:e.skipType(7&o)}}return s},s.fromObject=function(e){if(e instanceof i.RPC.PeerInfo)return e;var t=new i.RPC.PeerInfo;return null!=e.peerID&&("string"===typeof e.peerID?n.base64.decode(e.peerID,t.peerID=n.newBuffer(n.base64.length(e.peerID)),0):e.peerID.length&&(t.peerID=e.peerID)),null!=e.signedPeerRecord&&("string"===typeof e.signedPeerRecord?n.base64.decode(e.signedPeerRecord,t.signedPeerRecord=n.newBuffer(n.base64.length(e.signedPeerRecord)),0):e.signedPeerRecord.length&&(t.signedPeerRecord=e.signedPeerRecord)),t},s.toObject=function(e,t){t||(t={});var r={};return null!=e.peerID&&e.hasOwnProperty("peerID")&&(r.peerID=t.bytes===String?n.base64.encode(e.peerID,0,e.peerID.length):t.bytes===Array?Array.prototype.slice.call(e.peerID):e.peerID,t.oneofs&&(r._peerID="peerID")),null!=e.signedPeerRecord&&e.hasOwnProperty("signedPeerRecord")&&(r.signedPeerRecord=t.bytes===String?n.base64.encode(e.signedPeerRecord,0,e.signedPeerRecord.length):t.bytes===Array?Array.prototype.slice.call(e.signedPeerRecord):e.signedPeerRecord,t.oneofs&&(r._signedPeerRecord="signedPeerRecord")),r},s.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},s}(),s}(),i})?n.apply(t,i):n)||(e.exports=s)},51338:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.computeScore=void 0,t.computeScore=function(e,t,r,n){let i=0;Object.entries(t.topics).forEach((e=>{let[t,n]=e;const s=r.topics[t];if(!s)return;let o=0;if(n.inMesh){let e=n.meshTime/s.timeInMeshQuantum;e>s.timeInMeshCap&&(e=s.timeInMeshCap),o+=e*s.timeInMeshWeight}if(o+=n.firstMessageDeliveries*s.firstMessageDeliveriesWeight,n.meshMessageDeliveriesActive&&n.meshMessageDeliveries<s.meshMessageDeliveriesThreshold){const e=s.meshMessageDeliveriesThreshold-n.meshMessageDeliveries;o+=e*e*s.meshMessageDeliveriesWeight}o+=n.meshFailurePenalty*s.meshFailurePenaltyWeight;o+=n.invalidMessageDeliveries*n.invalidMessageDeliveries*s.invalidMessageDeliveriesWeight,i+=o*s.topicWeight})),r.topicScoreCap>0&&i>r.topicScoreCap&&(i=r.topicScoreCap);const s=r.appSpecificScore(e);i+=s*r.appSpecificWeight,t.ips.forEach((e=>{if(r.IPColocationFactorWhitelist.has(e))return;const t=n.get(e),s=t?t.size:0;if(s>r.IPColocationFactorThreshold){const e=s-r.IPColocationFactorThreshold;i+=e*e*r.IPColocationFactorWeight}}));const o=t.behaviourPenalty*t.behaviourPenalty;return i+=o*r.behaviourPenaltyWeight,i}},54442:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ERR_INVALID_PEER_SCORE_THRESHOLDS=t.ERR_INVALID_PEER_SCORE_PARAMS=void 0,t.ERR_INVALID_PEER_SCORE_PARAMS="ERR_INVALID_PEER_SCORE_PARAMS",t.ERR_INVALID_PEER_SCORE_THRESHOLDS="ERR_INVALID_PEER_SCORE_THRESHOLDS"},63789: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}),i(r(7507),t),i(r(50922),t),i(r(32723),t)},41838: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.MessageDeliveries=t.DeliveryRecordStatus=void 0;const i=r(66759),s=n(r(68718));var o;!function(e){e[e.unknown=0]="unknown",e[e.valid=1]="valid",e[e.invalid=2]="invalid",e[e.ignored=3]="ignored"}(o=t.DeliveryRecordStatus||(t.DeliveryRecordStatus={}));t.MessageDeliveries=class{constructor(){this.records=new Map,this.queue=new s.default}ensureRecord(e){let t=this.records.get(e);if(t)return t;t={status:o.unknown,firstSeen:Date.now(),validated:0,peers:new Set},this.records.set(e,t);const r={msgId:e,expire:Date.now()+i.TimeCacheDuration};return this.queue.push(r),t}gc(){const e=Date.now();let t=this.queue.peekFront();for(;t&&t.expire<e;)this.records.delete(t.msgId),this.queue.shift(),t=this.queue.peekFront()}clear(){this.records.clear(),this.queue.clear()}}},7507:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateTopicScoreParams=t.validatePeerScoreParams=t.createTopicScoreParams=t.createPeerScoreParams=t.defaultTopicScoreParams=t.defaultPeerScoreParams=void 0;const n=r(54442),i=r(67963);function s(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.assign(Object.assign({},t.defaultTopicScoreParams),e)}function o(e){if(e.topicWeight<0)throw i(new Error("invalid topic weight; must be >= 0"),n.ERR_INVALID_PEER_SCORE_PARAMS);if(0===e.timeInMeshQuantum)throw i(new Error("invalid TimeInMeshQuantum; must be non zero"),n.ERR_INVALID_PEER_SCORE_PARAMS);if(e.timeInMeshWeight<0)throw i(new Error("invalid TimeInMeshWeight; must be positive (or 0 to disable)"),n.ERR_INVALID_PEER_SCORE_PARAMS);if(0!==e.timeInMeshWeight&&e.timeInMeshQuantum<=0)throw i(new Error("invalid TimeInMeshQuantum; must be positive"),n.ERR_INVALID_PEER_SCORE_PARAMS);if(0!==e.timeInMeshWeight&&e.timeInMeshCap<=0)throw i(new Error("invalid TimeInMeshCap; must be positive"),n.ERR_INVALID_PEER_SCORE_PARAMS);if(e.firstMessageDeliveriesWeight<0)throw i(new Error("invallid FirstMessageDeliveriesWeight; must be positive (or 0 to disable)"),n.ERR_INVALID_PEER_SCORE_PARAMS);if(0!==e.firstMessageDeliveriesWeight&&(e.firstMessageDeliveriesDecay<=0||e.firstMessageDeliveriesDecay>=1))throw i(new Error("invalid FirstMessageDeliveriesDecay; must be between 0 and 1"),n.ERR_INVALID_PEER_SCORE_PARAMS);if(0!==e.firstMessageDeliveriesWeight&&e.firstMessageDeliveriesCap<=0)throw i(new Error("invalid FirstMessageDeliveriesCap; must be positive"),n.ERR_INVALID_PEER_SCORE_PARAMS);if(e.meshMessageDeliveriesWeight>0)throw i(new Error("invalid MeshMessageDeliveriesWeight; must be negative (or 0 to disable)"),n.ERR_INVALID_PEER_SCORE_PARAMS);if(0!==e.meshMessageDeliveriesWeight&&(e.meshMessageDeliveriesDecay<=0||e.meshMessageDeliveriesDecay>=1))throw i(new Error("invalid MeshMessageDeliveriesDecay; must be between 0 and 1"),n.ERR_INVALID_PEER_SCORE_PARAMS);if(0!==e.meshMessageDeliveriesWeight&&e.meshMessageDeliveriesCap<=0)throw i(new Error("invalid MeshMessageDeliveriesCap; must be positive"),n.ERR_INVALID_PEER_SCORE_PARAMS);if(0!==e.meshMessageDeliveriesWeight&&e.meshMessageDeliveriesThreshold<=0)throw i(new Error("invalid MeshMessageDeliveriesThreshold; must be positive"),n.ERR_INVALID_PEER_SCORE_PARAMS);if(e.meshMessageDeliveriesWindow<0)throw i(new Error("invalid MeshMessageDeliveriesWindow; must be non-negative"),n.ERR_INVALID_PEER_SCORE_PARAMS);if(0!==e.meshMessageDeliveriesWeight&&e.meshMessageDeliveriesActivation<1e3)throw i(new Error("invalid MeshMessageDeliveriesActivation; must be at least 1s"),n.ERR_INVALID_PEER_SCORE_PARAMS);if(e.meshFailurePenaltyWeight>0)throw i(new Error("invalid MeshFailurePenaltyWeight; must be negative (or 0 to disable)"),n.ERR_INVALID_PEER_SCORE_PARAMS);if(0!==e.meshFailurePenaltyWeight&&(e.meshFailurePenaltyDecay<=0||e.meshFailurePenaltyDecay>=1))throw i(new Error("invalid MeshFailurePenaltyDecay; must be between 0 and 1"),n.ERR_INVALID_PEER_SCORE_PARAMS);if(e.invalidMessageDeliveriesWeight>0)throw i(new Error("invalid InvalidMessageDeliveriesWeight; must be negative (or 0 to disable)"),n.ERR_INVALID_PEER_SCORE_PARAMS);if(e.invalidMessageDeliveriesDecay<=0||e.invalidMessageDeliveriesDecay>=1)throw i(new Error("invalid InvalidMessageDeliveriesDecay; must be between 0 and 1"),n.ERR_INVALID_PEER_SCORE_PARAMS)}t.defaultPeerScoreParams={topics:{},topicScoreCap:10,appSpecificScore:()=>0,appSpecificWeight:10,IPColocationFactorWeight:-5,IPColocationFactorThreshold:10,IPColocationFactorWhitelist:new Set,behaviourPenaltyWeight:-10,behaviourPenaltyDecay:.2,decayInterval:1e3,decayToZero:.1,retainScore:36e5},t.defaultTopicScoreParams={topicWeight:.5,timeInMeshWeight:1,timeInMeshQuantum:1,timeInMeshCap:3600,firstMessageDeliveriesWeight:1,firstMessageDeliveriesDecay:.5,firstMessageDeliveriesCap:2e3,meshMessageDeliveriesWeight:-1,meshMessageDeliveriesDecay:.5,meshMessageDeliveriesCap:100,meshMessageDeliveriesThreshold:20,meshMessageDeliveriesWindow:10,meshMessageDeliveriesActivation:5e3,meshFailurePenaltyWeight:-1,meshFailurePenaltyDecay:.5,invalidMessageDeliveriesWeight:-1,invalidMessageDeliveriesDecay:.3},t.createPeerScoreParams=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.assign(Object.assign(Object.assign({},t.defaultPeerScoreParams),e),{topics:e.topics?Object.entries(e.topics).reduce(((e,t)=>{let[r,n]=t;return e[r]=s(n),e}),{}):{}})},t.createTopicScoreParams=s,t.validatePeerScoreParams=function(e){for(const[r,s]of Object.entries(e.topics))try{o(s)}catch(t){throw i(new Error("invalid score parameters for topic ".concat(r,": ").concat(t.message)),n.ERR_INVALID_PEER_SCORE_PARAMS)}if(e.topicScoreCap<0)throw i(new Error("invalid topic score cap; must be positive (or 0 for no cap)"),n.ERR_INVALID_PEER_SCORE_PARAMS);if(null===e.appSpecificScore||void 0===e.appSpecificScore)throw i(new Error("missing application specific score function"),n.ERR_INVALID_PEER_SCORE_PARAMS);if(e.IPColocationFactorWeight>0)throw i(new Error("invalid IPColocationFactorWeight; must be negative (or 0 to disable)"),n.ERR_INVALID_PEER_SCORE_PARAMS);if(0!==e.IPColocationFactorWeight&&e.IPColocationFactorThreshold<1)throw i(new Error("invalid IPColocationFactorThreshold; must be at least 1"),n.ERR_INVALID_PEER_SCORE_PARAMS);if(e.behaviourPenaltyWeight>0)throw i(new Error("invalid BehaviourPenaltyWeight; must be negative (or 0 to disable)"),n.ERR_INVALID_PEER_SCORE_PARAMS);if(0!==e.behaviourPenaltyWeight&&(e.behaviourPenaltyDecay<=0||e.behaviourPenaltyDecay>=1))throw i(new Error("invalid BehaviourPenaltyDecay; must be between 0 and 1"),n.ERR_INVALID_PEER_SCORE_PARAMS);if(e.decayInterval<1e3)throw i(new Error("invalid DecayInterval; must be at least 1s"),n.ERR_INVALID_PEER_SCORE_PARAMS);if(e.decayToZero<=0||e.decayToZero>=1)throw i(new Error("invalid DecayToZero; must be between 0 and 1"),n.ERR_INVALID_PEER_SCORE_PARAMS)},t.validateTopicScoreParams=o},50922:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validatePeerScoreThresholds=t.createPeerScoreThresholds=t.defaultPeerScoreThresholds=void 0;const n=r(54442),i=r(67963);t.defaultPeerScoreThresholds={gossipThreshold:-10,publishThreshold:-50,graylistThreshold:-80,acceptPXThreshold:10,opportunisticGraftThreshold:20},t.createPeerScoreThresholds=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.assign(Object.assign({},t.defaultPeerScoreThresholds),e)},t.validatePeerScoreThresholds=function(e){if(e.gossipThreshold>0)throw i(new Error("invalid gossip threshold; it must be <= 0"),n.ERR_INVALID_PEER_SCORE_THRESHOLDS);if(e.publishThreshold>0||e.publishThreshold>e.gossipThreshold)throw i(new Error("invalid publish threshold; it must be <= 0 and <= gossip threshold"),n.ERR_INVALID_PEER_SCORE_THRESHOLDS);if(e.graylistThreshold>0||e.graylistThreshold>e.publishThreshold)throw i(new Error("invalid graylist threshold; it must be <= 0 and <= publish threshold"),n.ERR_INVALID_PEER_SCORE_THRESHOLDS);if(e.acceptPXThreshold<0)throw i(new Error("invalid accept PX threshold; it must be >= 0"),n.ERR_INVALID_PEER_SCORE_THRESHOLDS);if(e.opportunisticGraftThreshold<0)throw i(new Error("invalid opportunistic grafting threshold; it must be >= 0"),n.ERR_INVALID_PEER_SCORE_THRESHOLDS)}},32723:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function o(e){try{c(n.next(e))}catch(t){s(t)}}function a(e){try{c(n.throw(e))}catch(t){s(t)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,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.PeerScore=void 0;const s=r(7507),o=r(88338),a=r(51338),c=r(41838),u=r(66759),l=i(r(90190)),h=r(18392),d=r(40963),{ERR_INVALID_SIGNATURE:f,ERR_MISSING_SIGNATURE:p}=d.codes,y=h("libp2p:gossipsub:score");t.PeerScore=class{constructor(e,t){s.validatePeerScoreParams(e),this.params=e,this._connectionManager=t,this.peerStats=new Map,this.peerIPs=new Map,this.scoreCache=new Map,this.deliveryRecords=new c.MessageDeliveries}start(){this._backgroundInterval?y("Peer score already running"):(this._backgroundInterval=setInterval((()=>this.background()),this.params.decayInterval),y("started"))}stop(){this._backgroundInterval?(clearInterval(this._backgroundInterval),delete this._backgroundInterval,this.peerIPs.clear(),this.peerStats.clear(),this.deliveryRecords.clear(),y("stopped")):y("Peer score already stopped")}background(){this._refreshScores(),this._updateIPs(),this.deliveryRecords.gc()}_refreshScores(){const e=Date.now(),t=this.params.decayToZero;this.peerStats.forEach(((r,n)=>{r.connected?(Object.entries(r.topics).forEach((r=>{let[n,i]=r;const s=this.params.topics[n];s&&(i.firstMessageDeliveries*=s.firstMessageDeliveriesDecay,i.firstMessageDeliveries<t&&(i.firstMessageDeliveries=0),i.meshMessageDeliveries*=s.meshMessageDeliveriesDecay,i.meshMessageDeliveries<t&&(i.meshMessageDeliveries=0),i.meshFailurePenalty*=s.meshFailurePenaltyDecay,i.meshFailurePenalty<t&&(i.meshFailurePenalty=0),i.invalidMessageDeliveries*=s.invalidMessageDeliveriesDecay,i.invalidMessageDeliveries<t&&(i.invalidMessageDeliveries=0),i.inMesh&&(i.meshTime=e-i.graftTime,i.meshTime>s.meshMessageDeliveriesActivation&&(i.meshMessageDeliveriesActive=!0)))})),r.behaviourPenalty*=this.params.behaviourPenaltyDecay,r.behaviourPenalty<t&&(r.behaviourPenalty=0),this.scoreCache.set(n,{score:null,cacheUntil:0})):e>r.expire&&(this._removeIPs(n,r.ips),this.peerStats.delete(n))}))}score(e){const t=this.peerStats.get(e);if(!t)return 0;const r=Date.now();let n=this.scoreCache.get(e);void 0===n&&(n={score:null,cacheUntil:0},this.scoreCache.set(e,n));const{score:i,cacheUntil:s}=n;return s>r&&null!==i?i:(n.score=a.computeScore(e,t,this.params,this.peerIPs),n.cacheUntil=r+this.params.decayInterval,n.score)}addPenalty(e,t){const r=this.peerStats.get(e);r&&(r.behaviourPenalty+=t,this.scoreCache.set(e,{score:null,cacheUntil:0}))}addPeer(e){const t=o.createPeerStats({connected:!0});this.peerStats.set(e,t);const r=this._getIPs(e);this._setIPs(e,r,t.ips),t.ips=r}removePeer(e){const t=this.peerStats.get(e);if(t){if(this.score(e)>0)return this._removeIPs(e,t.ips),void this.peerStats.delete(e);this.scoreCache.delete(e),Object.entries(t.topics).forEach((e=>{let[t,r]=e;r.firstMessageDeliveries=0;const n=this.params.topics[t].meshMessageDeliveriesThreshold;if(r.inMesh&&r.meshMessageDeliveriesActive&&r.meshMessageDeliveries<n){const e=n-r.meshMessageDeliveries;r.meshFailurePenalty+=e*e}r.inMesh=!1})),t.connected=!1,t.expire=Date.now()+this.params.retainScore}}graft(e,t){const r=this.peerStats.get(e);if(!r)return;const n=o.ensureTopicStats(t,r,this.params);n&&(n.inMesh=!0,n.graftTime=Date.now(),n.meshTime=0,n.meshMessageDeliveriesActive=!1,this.scoreCache.set(e,{score:null,cacheUntil:0}))}prune(e,t){const r=this.peerStats.get(e);if(!r)return;const n=o.ensureTopicStats(t,r,this.params);if(!n)return;const i=this.params.topics[t].meshMessageDeliveriesThreshold;if(n.meshMessageDeliveriesActive&&n.meshMessageDeliveries<i){const e=i-n.meshMessageDeliveries;n.meshFailurePenalty+=e*e}n.inMesh=!1,this.scoreCache.set(e,{score:null,cacheUntil:0})}validateMessage(e){return n(this,void 0,void 0,(function*(){this.deliveryRecords.ensureRecord(e)}))}deliverMessage(e,t){return n(this,void 0,void 0,(function*(){const r=e.receivedFrom;this._markFirstMessageDelivery(r,e);const n=this.deliveryRecords.ensureRecord(t),i=Date.now();n.status===c.DeliveryRecordStatus.unknown?(n.status=c.DeliveryRecordStatus.valid,n.validated=i,n.peers.forEach((t=>{t!==r&&this._markDuplicateMessageDelivery(t,e)}))):y("unexpected delivery: message from %s was first seen %s ago and has delivery status %d",r,i-n.firstSeen,c.DeliveryRecordStatus[n.status])}))}rejectMessage(e,t,r){return n(this,void 0,void 0,(function*(){const n=e.receivedFrom;switch(r){case p:case f:return void this._markInvalidMessageDelivery(n,e)}const i=this.deliveryRecords.ensureRecord(t);i.status===c.DeliveryRecordStatus.unknown?r!==u.ERR_TOPIC_VALIDATOR_IGNORE?(i.status=c.DeliveryRecordStatus.invalid,this._markInvalidMessageDelivery(n,e),i.peers.forEach((t=>{this._markInvalidMessageDelivery(t,e)}))):i.status=c.DeliveryRecordStatus.ignored:y("unexpected rejection: message from %s was first seen %s ago and has delivery status %d",n,Date.now()-i.firstSeen,c.DeliveryRecordStatus[i.status])}))}duplicateMessage(e,t){return n(this,void 0,void 0,(function*(){const r=e.receivedFrom,n=this.deliveryRecords.ensureRecord(t);if(!n.peers.has(r))switch(n.status){case c.DeliveryRecordStatus.unknown:n.peers.add(r);break;case c.DeliveryRecordStatus.valid:n.peers.add(r),this._markDuplicateMessageDelivery(r,e,n.validated);break;case c.DeliveryRecordStatus.invalid:this._markInvalidMessageDelivery(r,e)}}))}_markInvalidMessageDelivery(e,t){const r=this.peerStats.get(e);r&&(t.topicIDs.forEach((e=>{const t=o.ensureTopicStats(e,r,this.params);t&&(t.invalidMessageDeliveries+=1)})),this.scoreCache.set(e,{score:null,cacheUntil:0}))}_markFirstMessageDelivery(e,t){const r=this.peerStats.get(e);r&&(t.topicIDs.forEach((e=>{const t=o.ensureTopicStats(e,r,this.params);if(!t)return;let n=this.params.topics[e].firstMessageDeliveriesCap;t.firstMessageDeliveries+=1,t.firstMessageDeliveries>n&&(t.firstMessageDeliveries=n),t.inMesh&&(n=this.params.topics[e].meshMessageDeliveriesCap,t.meshMessageDeliveries+=1,t.meshMessageDeliveries>n&&(t.meshMessageDeliveries=n))})),this.scoreCache.set(e,{score:null,cacheUntil:0}))}_markDuplicateMessageDelivery(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const n=this.peerStats.get(e);if(!n)return;const i=r?Date.now():0;t.topicIDs.forEach((e=>{const t=o.ensureTopicStats(e,n,this.params);if(!t)return;if(!t.inMesh)return;const s=this.params.topics[e];if(r&&i>r+s.meshMessageDeliveriesWindow)return;const a=s.meshMessageDeliveriesCap;t.meshMessageDeliveries+=1,t.meshMessageDeliveries>a&&(t.meshMessageDeliveries=a)})),this.scoreCache.set(e,{score:null,cacheUntil:0})}_getIPs(e){return this._connectionManager.getAll(l.default.createFromB58String(e)).map((e=>e.remoteAddr.toOptions().host))}_setIPs(e,t,r){e:for(const n of t){for(const e of r)if(n===e)continue e;let t=this.peerIPs.get(n);t||(t=new Set,this.peerIPs.set(n,t)),t.add(e)}e:for(const n of r){for(const e of t)if(n===e)continue e;const r=this.peerIPs.get(n);r&&(r.delete(e),r.size||this.peerIPs.delete(n))}this.scoreCache.set(e,{score:null,cacheUntil:0})}_removeIPs(e,t){t.forEach((t=>{const r=this.peerIPs.get(t);r&&(r.delete(e),r.size||this.peerIPs.delete(t))})),this.scoreCache.set(e,{score:null,cacheUntil:0})}_updateIPs(){this.peerStats.forEach(((e,t)=>{const r=this._getIPs(t);this._setIPs(t,r,e.ips),e.ips=r,this.scoreCache.set(t,{score:null,cacheUntil:0})}))}}},88338:(e,t)=>{"use strict";function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.assign({inMesh:!1,graftTime:0,meshTime:0,firstMessageDeliveries:0,meshMessageDeliveries:0,meshMessageDeliveriesActive:!1,meshFailurePenalty:0,invalidMessageDeliveries:0},e)}Object.defineProperty(t,"__esModule",{value:!0}),t.ensureTopicStats=t.createTopicStats=t.createPeerStats=void 0,t.createPeerStats=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.assign(Object.assign({connected:!1,expire:0,ips:[],behaviourPenalty:0},e),{topics:e.topics?Object.entries(e.topics).reduce(((e,t)=>{let[n,i]=t;return e[n]=r(i),e}),{}):{}})},t.createTopicStats=r,t.ensureTopicStats=function(e,t,n){let i=t.topics[e];return i||(n.topics[e]?(t.topics[e]=i=r(),i):void 0)}},61390:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,s){function o(e){try{c(n.next(e))}catch(t){s(t)}}function a(e){try{c(n.throw(e))}catch(t){s(t)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.IWantTracer=void 0;const i=r(66759),s=r(53357),o=r(40963),{ERR_INVALID_SIGNATURE:a,ERR_MISSING_SIGNATURE:c}=o.codes;t.IWantTracer=class{constructor(){this.promises=new Map}addPromise(e,t){const r=t[Math.floor(Math.random()*t.length)],n=s.messageIdToString(r);let o=this.promises.get(n);o||(o=new Map,this.promises.set(n,o)),o.has(e)||o.set(e,Date.now()+i.GossipsubIWantFollowupTime)}getBrokenPromises(){const e=Date.now(),t=new Map;return this.promises.forEach(((r,n)=>{r.forEach(((n,i)=>{n<e&&(t.set(i,(t.get(i)||0)+1),r.delete(i))})),r.size||this.promises.delete(n)})),t}deliverMessage(e){return n(this,void 0,void 0,(function*(){this.promises.delete(e)}))}rejectMessage(e,t){return n(this,void 0,void 0,(function*(){switch(t){case a:case c:return}this.promises.delete(e)}))}clear(){this.promises.clear()}}},37222:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createGossipRpc=void 0,t.createGossipRpc=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return{subscriptions:[],msgs:e,control:Object.assign({ihave:[],iwant:[],graft:[],prune:[]},t)}}},56714:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.hasGossipProtocol=void 0;const n=r(66759);t.hasGossipProtocol=function(e){return e===n.GossipsubIDv10||e===n.GossipsubIDv11}},53357: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}),i(r(37222),t),i(r(92506),t),i(r(56714),t),i(r(79059),t)},79059:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.messageIdFromString=t.messageIdToString=void 0;const n=r(46765),i=r(82051);t.messageIdToString=function(e){return i.toString(e,"base64")},t.messageIdFromString=function(e){return n.fromString(e,"base64")}},92506:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.shuffle=void 0,t.shuffle=function(e){if(e.length<=1)return e;for(let t=0;t<e.length;t++){const r=Math.floor(Math.random()*Math.floor(e.length)),n=e[t];e[t]=e[r],e[r]=n}return e}},46561:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SimpleTimeCache=void 0;t.SimpleTimeCache=class{constructor(e){this.lastPruneTime=0,this.entries=new Map,this.validityMs=e.validityMs}put(e,t){this.entries.set(e,{value:t,validUntilMs:Date.now()+this.validityMs}),this.prune()}prune(){const e=Date.now();if(!(e-this.lastPruneTime<200)){this.lastPruneTime=e;for(const[t,r]of this.entries.entries()){if(!(r.validUntilMs<e))break;this.entries.delete(t)}}}has(e){return this.entries.has(e)}get(e){const t=this.entries.get(e);return t&&t.validUntilMs>=Date.now()?t.value:void 0}clear(){this.entries=new Map,this.lastPruneTime=0}}},56044:(e,t,r)=>{"use strict";const n=r(90190),{Multiaddr:i}=r(98719),s=r(67963),{OPEN:o,CLOSING:a,CLOSED:c}=r(55310),u=Symbol.for("@libp2p/interface-connection/connection");class l{constructor(e){let{localAddr:t,remoteAddr:r,localPeer:a,remotePeer:c,newStream:u,close:l,getStreams:h,stat:d}=e;!function(e,t,r,o,a,c,u){if(e&&!i.isMultiaddr(e))throw s(new Error("localAddr must be an instance of multiaddr"),"ERR_INVALID_PARAMETERS");if(!n.isPeerId(t))throw s(new Error("localPeer must be an instance of peer-id"),"ERR_INVALID_PARAMETERS");if(!n.isPeerId(r))throw s(new Error("remotePeer must be an instance of peer-id"),"ERR_INVALID_PARAMETERS");if("function"!==typeof o)throw s(new Error("new stream must be a function"),"ERR_INVALID_PARAMETERS");if("function"!==typeof a)throw s(new Error("close must be a function"),"ERR_INVALID_PARAMETERS");if("function"!==typeof c)throw s(new Error("getStreams must be a function"),"ERR_INVALID_PARAMETERS");if(!u)throw s(new Error("connection metadata object must be provided"),"ERR_INVALID_PARAMETERS");if("inbound"!==u.direction&&"outbound"!==u.direction)throw s(new Error('direction must be "inbound" or "outbound"'),"ERR_INVALID_PARAMETERS");if(!u.timeline)throw s(new Error("connection timeline object must be provided in the stat object"),"ERR_INVALID_PARAMETERS");if(!u.timeline.open)throw s(new Error("connection open timestamp must be provided"),"ERR_INVALID_PARAMETERS");if(!u.timeline.upgraded)throw s(new Error("connection upgraded timestamp must be provided"),"ERR_INVALID_PARAMETERS")}(t,a,c,u,l,h,d),this.id=parseInt(String(1e9*Math.random())).toString(36)+Date.now(),this.localAddr=t,this.remoteAddr=r,this.localPeer=a,this.remotePeer=c,this._stat={...d,status:o},this._newStream=u,this._close=l,this._getStreams=h,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 s(new Error("the connection is being closed"),"ERR_CONNECTION_BEING_CLOSED");if(this.stat.status===c)throw s(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,t){let{protocol:r,metadata:n={}}=t;this.registry.set(e.id,{protocol:r,...n})}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=l},4438:(e,t,r)=>{"use strict";t.Connection=r(56044)},55310:e=>{"use strict";e.exports={OPEN:"open",CLOSING:"closing",CLOSED:"closed"}},40963:(e,t)=>{"use strict";t.codes={ERR_INVALID_SIGNATURE_POLICY:"ERR_INVALID_SIGNATURE_POLICY",ERR_UNHANDLED_SIGNATURE_POLICY:"ERR_UNHANDLED_SIGNATURE_POLICY",ERR_MISSING_SIGNATURE:"ERR_MISSING_SIGNATURE",ERR_MISSING_SEQNO:"ERR_MISSING_SEQNO",ERR_INVALID_SIGNATURE:"ERR_INVALID_SIGNATURE",ERR_UNEXPECTED_FROM:"ERR_UNEXPECTED_FROM",ERR_UNEXPECTED_SIGNATURE:"ERR_UNEXPECTED_SIGNATURE",ERR_UNEXPECTED_KEY:"ERR_UNEXPECTED_KEY",ERR_UNEXPECTED_SEQNO:"ERR_UNEXPECTED_SEQNO"}},4782:(e,t,r)=>{"use strict";const n=r(18392),{EventEmitter:i}=r(47465),s=r(67963),{pipe:o}=r(79023),{default:a}=r(12906),c=r(471),{codes:u}=r(40963),{RPC:l}=r(23928),h=r(75776),{SignaturePolicy:d}=r(83983),f=r(36698),{signMessage:p,verifySignature:y}=r(97800);class g extends i{constructor(e){let{debugName:t,multicodecs:r,libp2p:i,globalSignaturePolicy:o=d.StrictSign,canRelayMessage:c=!1,emitSelf:l=!1,messageProcessingConcurrency:h=10}=e;if("string"!==typeof t)throw new Error("a debugname `string` is required");if(!r)throw new Error("multicodecs are required");if(!i)throw new Error("libp2p is required");if(super(),this.log=Object.assign(n(t),{err:n("".concat(t,":error"))}),this.multicodecs=f.ensureArray(r),this._libp2p=i,this.registrar=i.registrar,this.peerId=i.peerId,this.started=!1,this.topics=new Map,this.subscriptions=new Set,this.peers=new Map,!d[o])throw s(new Error("Invalid global signature policy"),u.ERR_INVALID_SIGNATURE_POLICY);this.globalSignaturePolicy=o,this.canRelayMessage=c,this.emitSelf=l,this.topicValidators=new Map,this.queue=new a({concurrency:h}),this._registrarId=void 0,this._onIncomingStream=this._onIncomingStream.bind(this),this._onPeerConnected=this._onPeerConnected.bind(this),this._onPeerDisconnected=this._onPeerDisconnected.bind(this)}async start(){if(this.started)return;this.log("starting"),this.registrar.handle(this.multicodecs,this._onIncomingStream);const e=new c({multicodecs:this.multicodecs,handlers:{onConnect:this._onPeerConnected,onDisconnect:this._onPeerDisconnected}});this._registrarId=await this.registrar.register(e),this.log("started"),this.started=!0}async stop(){this.started&&(this.registrar.unregister(this._registrarId),this.log("stopping"),this.peers.forEach((e=>e.close())),this.peers=new Map,this.subscriptions=new Set,this.started=!1,this.log("stopped"))}_onIncomingStream(e){let{protocol:t,stream:r,connection:n}=e;const i=n.remotePeer,s=i.toB58String(),o=this._addPeer(i,t),a=o.attachInboundStream(r);this._processMessages(s,a,o)}async _onPeerConnected(e,t){const r=e.toB58String();this.log("connected",r);try{const{stream:r,protocol:n}=await t.newStream(this.multicodecs),i=this._addPeer(e,n);await i.attachOutboundStream(r)}catch(n){this.log.err(n)}this._sendSubscriptions(r,Array.from(this.subscriptions),!0)}_onPeerDisconnected(e,t){const r=e.toB58String();this.log("connection ended",r,t?t.message:""),this._removePeer(e)}_addPeer(e,t){const r=e.toB58String(),n=this.peers.get(r);if(n)return n;this.log("new peer",r);const i=new h({id:e,protocol:t});return this.peers.set(r,i),i.once("close",(()=>this._removePeer(e))),i}_removePeer(e){if(!e)return;const t=e.toB58String(),r=this.peers.get(t);if(r){r.removeAllListeners(),r.close(),this.log("delete peer",t),this.peers.delete(t);for(const e of this.topics.values())e.delete(t);return r}}async _processMessages(e,t,r){try{await o(t,(async t=>{for await(const n of t){const t=n instanceof Uint8Array?n:n.slice(),i=this._decodeRpc(t);(async()=>{try{await this._processRpc(e,r,i)}catch(t){this.log.err(t)}})()}}))}catch(n){this._onPeerDisconnected(r.id,n)}}async _processRpc(e,t,r){this.log("rpc from",e);const n=r.subscriptions,i=r.msgs;return n.length&&(n.forEach((t=>{this._processRpcSubOpt(e,t)})),this.emit("pubsub:subscription-change",t.id,n)),this._acceptFrom(e)?(i.length&&this.queue.addAll(i.map((t=>async()=>{if(this.canRelayMessage||t.topicIDs&&t.topicIDs.some((e=>this.subscriptions.has(e))))try{const r=f.normalizeInRpcMessage(t,e);await this._processRpcMessage(r)}catch(r){this.log.err(r)}else this.log("received message we didn't subscribe to. Dropping.")}))),!0):(this.log("received message from unacceptable peer %s",e),!1)}_processRpcSubOpt(e,t){const r=t.topicID;if(!r)return;let n=this.topics.get(r);n||(n=new Set,this.topics.set(r,n)),t.subscribe?n.add(e):n.delete(e)}async _processRpcMessage(e){if(this.peerId.toB58String()!==e.from||this.emitSelf){try{await this.validate(e)}catch(t){return void this.log("Message is invalid, dropping it. %O",t)}return this._emitMessage(e),this._publish(f.normalizeOutRpcMessage(e))}}_emitMessage(e){e.topicIDs.forEach((t=>{this.subscriptions.has(t)&&this.emit(t,e)}))}getMsgId(e){const t=this.globalSignaturePolicy;switch(t){case d.StrictSign:return f.msgId(e.from,e.seqno);case d.StrictNoSign:return f.noSignMsgId(e.data);default:throw s(new Error("Cannot get message id: unhandled signature policy: "+t),u.ERR_UNHANDLED_SIGNATURE_POLICY)}}_acceptFrom(e){return!0}_decodeRpc(e){return l.decode(e)}_encodeRpc(e){return l.encode(e).finish()}_sendRpc(e,t){const r=this.peers.get(e);if(r&&r.isWritable)r.write(this._encodeRpc(t));else{const t="Cannot send RPC to ".concat(e," as there is no open stream to it available");this.log.err(t)}}_sendSubscriptions(e,t,r){return this._sendRpc(e,{subscriptions:t.map((e=>({topicID:e,subscribe:r})))})}async validate(e){const t=this.globalSignaturePolicy;switch(t){case d.StrictNoSign:if(e.from)throw s(new Error("StrictNoSigning: from should not be present"),u.ERR_UNEXPECTED_FROM);if(e.signature)throw s(new Error("StrictNoSigning: signature should not be present"),u.ERR_UNEXPECTED_SIGNATURE);if(e.key)throw s(new Error("StrictNoSigning: key should not be present"),u.ERR_UNEXPECTED_KEY);if(e.seqno)throw s(new Error("StrictNoSigning: seqno should not be present"),u.ERR_UNEXPECTED_SEQNO);break;case d.StrictSign:if(!e.signature)throw s(new Error("StrictSigning: Signing required and no signature was present"),u.ERR_MISSING_SIGNATURE);if(!e.seqno)throw s(new Error("StrictSigning: Signing required and no seqno was present"),u.ERR_MISSING_SEQNO);if(!await y(e))throw s(new Error("StrictSigning: Invalid message signature"),u.ERR_INVALID_SIGNATURE);break;default:throw s(new Error("Cannot validate message: unhandled signature policy: "+t),u.ERR_UNHANDLED_SIGNATURE_POLICY)}for(const r of e.topicIDs){const t=this.topicValidators.get(r);t&&await t(r,e)}}_buildMessage(e){const t=this.globalSignaturePolicy;switch(t){case d.StrictSign:return e.from=this.peerId.toB58String(),e.seqno=f.randomSeqno(),p(this.peerId,e);case d.StrictNoSign:return Promise.resolve(e);default:throw s(new Error("Cannot build message: unhandled signature policy: "+t),u.ERR_UNHANDLED_SIGNATURE_POLICY)}}getSubscribers(e){if(!this.started)throw s(new Error("not started yet"),"ERR_NOT_STARTED_YET");if(!e||"string"!==typeof e)throw s(new Error("a string topic must be provided"),"ERR_NOT_VALID_TOPIC");const t=this.topics.get(e);return t?Array.from(t):[]}async publish(e,t){if(!this.started)throw new Error("Pubsub has not started");this.log("publish",e,t);const r={receivedFrom:this.peerId.toB58String(),data:t,topicIDs:[e]},n=await this._buildMessage(r),i=f.normalizeInRpcMessage(n);this.emitSelf&&this._emitMessage(i),await this._publish(i)}_publish(e){throw s(new Error("publish must be implemented by the subclass"),"ERR_NOT_IMPLEMENTED")}subscribe(e){if(!this.started)throw new Error("Pubsub has not started");this.subscriptions.has(e)||(this.subscriptions.add(e),this.peers.forEach(((t,r)=>this._sendSubscriptions(r,[e],!0))))}unsubscribe(e){if(!this.started)throw new Error("Pubsub is not started");this.subscriptions.has(e)&&0===this.listenerCount(e)&&(this.subscriptions.delete(e),this.peers.forEach(((t,r)=>this._sendSubscriptions(r,[e],!1))))}getTopics(){if(!this.started)throw new Error("Pubsub is not started");return Array.from(this.subscriptions)}}g.utils=f,g.SignaturePolicy=d,e.exports=g},23928:(e,t,r)=>{"use strict";var n=r(80886),i=n.Reader,s=n.Writer,o=n.util,a=n.roots["libp2p-pubsub-rpc"]||(n.roots["libp2p-pubsub-rpc"]={});a.RPC=function(){function e(e){if(this.subscriptions=[],this.msgs=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.subscriptions=o.emptyArray,e.prototype.msgs=o.emptyArray,e.encode=function(e,t){if(t||(t=s.create()),null!=e.subscriptions&&e.subscriptions.length)for(var r=0;r<e.subscriptions.length;++r)a.RPC.SubOpts.encode(e.subscriptions[r],t.uint32(10).fork()).ldelim();if(null!=e.msgs&&e.msgs.length)for(r=0;r<e.msgs.length;++r)a.RPC.Message.encode(e.msgs[r],t.uint32(18).fork()).ldelim();return t},e.decode=function(e,t){e instanceof i||(e=i.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new a.RPC;e.pos<r;){var s=e.uint32();switch(s>>>3){case 1:n.subscriptions&&n.subscriptions.length||(n.subscriptions=[]),n.subscriptions.push(a.RPC.SubOpts.decode(e,e.uint32()));break;case 2:n.msgs&&n.msgs.length||(n.msgs=[]),n.msgs.push(a.RPC.Message.decode(e,e.uint32()));break;default:e.skipType(7&s)}}return n},e.fromObject=function(e){if(e instanceof a.RPC)return e;var t=new a.RPC;if(e.subscriptions){if(!Array.isArray(e.subscriptions))throw TypeError(".RPC.subscriptions: array expected");t.subscriptions=[];for(var r=0;r<e.subscriptions.length;++r){if("object"!==typeof e.subscriptions[r])throw TypeError(".RPC.subscriptions: object expected");t.subscriptions[r]=a.RPC.SubOpts.fromObject(e.subscriptions[r])}}if(e.msgs){if(!Array.isArray(e.msgs))throw TypeError(".RPC.msgs: array expected");t.msgs=[];for(r=0;r<e.msgs.length;++r){if("object"!==typeof e.msgs[r])throw TypeError(".RPC.msgs: object expected");t.msgs[r]=a.RPC.Message.fromObject(e.msgs[r])}}return t},e.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.subscriptions=[],r.msgs=[]),e.subscriptions&&e.subscriptions.length){r.subscriptions=[];for(var n=0;n<e.subscriptions.length;++n)r.subscriptions[n]=a.RPC.SubOpts.toObject(e.subscriptions[n],t)}if(e.msgs&&e.msgs.length){r.msgs=[];for(n=0;n<e.msgs.length;++n)r.msgs[n]=a.RPC.Message.toObject(e.msgs[n],t)}return r},e.prototype.toJSON=function(){return this.constructor.toObject(this,n.util.toJSONOptions)},e.SubOpts=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}var t;return e.prototype.subscribe=null,e.prototype.topicID=null,Object.defineProperty(e.prototype,"_subscribe",{get:o.oneOfGetter(t=["subscribe"]),set:o.oneOfSetter(t)}),Object.defineProperty(e.prototype,"_topicID",{get:o.oneOfGetter(t=["topicID"]),set:o.oneOfSetter(t)}),e.encode=function(e,t){return t||(t=s.create()),null!=e.subscribe&&Object.hasOwnProperty.call(e,"subscribe")&&t.uint32(8).bool(e.subscribe),null!=e.topicID&&Object.hasOwnProperty.call(e,"topicID")&&t.uint32(18).string(e.topicID),t},e.decode=function(e,t){e instanceof i||(e=i.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new a.RPC.SubOpts;e.pos<r;){var s=e.uint32();switch(s>>>3){case 1:n.subscribe=e.bool();break;case 2:n.topicID=e.string();break;default:e.skipType(7&s)}}return n},e.fromObject=function(e){if(e instanceof a.RPC.SubOpts)return e;var t=new a.RPC.SubOpts;return null!=e.subscribe&&(t.subscribe=Boolean(e.subscribe)),null!=e.topicID&&(t.topicID=String(e.topicID)),t},e.toObject=function(e,t){t||(t={});var r={};return null!=e.subscribe&&e.hasOwnProperty("subscribe")&&(r.subscribe=e.subscribe,t.oneofs&&(r._subscribe="subscribe")),null!=e.topicID&&e.hasOwnProperty("topicID")&&(r.topicID=e.topicID,t.oneofs&&(r._topicID="topicID")),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,n.util.toJSONOptions)},e}(),e.Message=function(){function e(e){if(this.topicIDs=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}var t;return e.prototype.from=null,e.prototype.data=null,e.prototype.seqno=null,e.prototype.topicIDs=o.emptyArray,e.prototype.signature=null,e.prototype.key=null,Object.defineProperty(e.prototype,"_from",{get:o.oneOfGetter(t=["from"]),set:o.oneOfSetter(t)}),Object.defineProperty(e.prototype,"_data",{get:o.oneOfGetter(t=["data"]),set:o.oneOfSetter(t)}),Object.defineProperty(e.prototype,"_seqno",{get:o.oneOfGetter(t=["seqno"]),set:o.oneOfSetter(t)}),Object.defineProperty(e.prototype,"_signature",{get:o.oneOfGetter(t=["signature"]),set:o.oneOfSetter(t)}),Object.defineProperty(e.prototype,"_key",{get:o.oneOfGetter(t=["key"]),set:o.oneOfSetter(t)}),e.encode=function(e,t){if(t||(t=s.create()),null!=e.from&&Object.hasOwnProperty.call(e,"from")&&t.uint32(10).bytes(e.from),null!=e.data&&Object.hasOwnProperty.call(e,"data")&&t.uint32(18).bytes(e.data),null!=e.seqno&&Object.hasOwnProperty.call(e,"seqno")&&t.uint32(26).bytes(e.seqno),null!=e.topicIDs&&e.topicIDs.length)for(var r=0;r<e.topicIDs.length;++r)t.uint32(34).string(e.topicIDs[r]);return null!=e.signature&&Object.hasOwnProperty.call(e,"signature")&&t.uint32(42).bytes(e.signature),null!=e.key&&Object.hasOwnProperty.call(e,"key")&&t.uint32(50).bytes(e.key),t},e.decode=function(e,t){e instanceof i||(e=i.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new a.RPC.Message;e.pos<r;){var s=e.uint32();switch(s>>>3){case 1:n.from=e.bytes();break;case 2:n.data=e.bytes();break;case 3:n.seqno=e.bytes();break;case 4:n.topicIDs&&n.topicIDs.length||(n.topicIDs=[]),n.topicIDs.push(e.string());break;case 5:n.signature=e.bytes();break;case 6:n.key=e.bytes();break;default:e.skipType(7&s)}}return n},e.fromObject=function(e){if(e instanceof a.RPC.Message)return e;var t=new a.RPC.Message;if(null!=e.from&&("string"===typeof e.from?o.base64.decode(e.from,t.from=o.newBuffer(o.base64.length(e.from)),0):e.from.length&&(t.from=e.from)),null!=e.data&&("string"===typeof e.data?o.base64.decode(e.data,t.data=o.newBuffer(o.base64.length(e.data)),0):e.data.length&&(t.data=e.data)),null!=e.seqno&&("string"===typeof e.seqno?o.base64.decode(e.seqno,t.seqno=o.newBuffer(o.base64.length(e.seqno)),0):e.seqno.length&&(t.seqno=e.seqno)),e.topicIDs){if(!Array.isArray(e.topicIDs))throw TypeError(".RPC.Message.topicIDs: array expected");t.topicIDs=[];for(var r=0;r<e.topicIDs.length;++r)t.topicIDs[r]=String(e.topicIDs[r])}return null!=e.signature&&("string"===typeof e.signature?o.base64.decode(e.signature,t.signature=o.newBuffer(o.base64.length(e.signature)),0):e.signature.length&&(t.signature=e.signature)),null!=e.key&&("string"===typeof e.key?o.base64.decode(e.key,t.key=o.newBuffer(o.base64.length(e.key)),0):e.key.length&&(t.key=e.key)),t},e.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.topicIDs=[]),null!=e.from&&e.hasOwnProperty("from")&&(r.from=t.bytes===String?o.base64.encode(e.from,0,e.from.length):t.bytes===Array?Array.prototype.slice.call(e.from):e.from,t.oneofs&&(r._from="from")),null!=e.data&&e.hasOwnProperty("data")&&(r.data=t.bytes===String?o.base64.encode(e.data,0,e.data.length):t.bytes===Array?Array.prototype.slice.call(e.data):e.data,t.oneofs&&(r._data="data")),null!=e.seqno&&e.hasOwnProperty("seqno")&&(r.seqno=t.bytes===String?o.base64.encode(e.seqno,0,e.seqno.length):t.bytes===Array?Array.prototype.slice.call(e.seqno):e.seqno,t.oneofs&&(r._seqno="seqno")),e.topicIDs&&e.topicIDs.length){r.topicIDs=[];for(var n=0;n<e.topicIDs.length;++n)r.topicIDs[n]=e.topicIDs[n]}return null!=e.signature&&e.hasOwnProperty("signature")&&(r.signature=t.bytes===String?o.base64.encode(e.signature,0,e.signature.length):t.bytes===Array?Array.prototype.slice.call(e.signature):e.signature,t.oneofs&&(r._signature="signature")),null!=e.key&&e.hasOwnProperty("key")&&(r.key=t.bytes===String?o.base64.encode(e.key,0,e.key.length):t.bytes===Array?Array.prototype.slice.call(e.key):e.key,t.oneofs&&(r._key="key")),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,n.util.toJSONOptions)},e}(),e}(),e.exports=a},97800:(e,t,r)=>{"use strict";const n=r(90190),{RPC:i}=r(23928),{concat:s}=r(62110),{fromString:o}=r(46765),a=o("libp2p-pubsub:"),{normalizeOutRpcMessage:c}=r(36698);async function u(e){if(!e.from)throw new Error("Could not get the public key from the originator id");const t=n.createFromB58String(e.from);if(e.key){const r=await n.createFromPubKey(e.key);if(r.equals(t))return r.pubKey;throw new Error("Public Key does not match the originator")}if(t.pubKey)return t.pubKey;throw new Error("Could not get the public key from the originator id")}e.exports={messagePublicKey:u,signMessage:async function(e,t){const r=s([a,i.Message.encode(c(t)).finish()]),n=await e.privKey.sign(r);return{...t,signature:n,key:e.pubKey.bytes}},SignPrefix:a,verifySignature:async function(e){if(!e.signature)throw new Error("Message must contain a signature to be verified");if(!e.from)throw new Error("Message must contain a from property to be verified");const t=s([a,i.Message.encode({...e,from:n.createFromB58String(e.from).toBytes(),signature:void 0,key:void 0}).finish()]);return(await u(e)).verify(t,e.signature)}}},75776:(e,t,r)=>{"use strict";const n=r(18392),i=Object.assign(n("libp2p-pubsub:peer-streams"),{error:n("libp2p-pubsub:peer-streams:err")}),{EventEmitter:s}=r(47465),o=r(44709),a=r(77674),{pipe:c}=r(79023),{source:u}=r(64183);e.exports=class extends s{constructor(e){let{id:t,protocol:r}=e;super(),this.id=t,this.protocol=r,this._rawOutboundStream=null,this._rawInboundStream=null,this._inboundAbortController=new AbortController,this.outboundStream=null,this.inboundStream=null}get isReadable(){return Boolean(this.inboundStream)}get isWritable(){return Boolean(this.outboundStream)}write(e){if(!this.outboundStream){const e=this.id.toB58String();throw new Error("No writable connection to "+e)}this.outboundStream.push(e)}attachInboundStream(e){return this._rawInboundStream=e,this.inboundStream=u(c(this._rawInboundStream,o.decode()),this._inboundAbortController.signal,{returnOnAbort:!0}),this.emit("stream:inbound"),this.inboundStream}async attachOutboundStream(e){const t=this.outboundStream;this.outboundStream&&await this.outboundStream.end(),this._rawOutboundStream=e,this.outboundStream=a({onEnd:e=>{this._rawOutboundStream&&this._rawOutboundStream.reset&&this._rawOutboundStream.reset(),this._rawOutboundStream=null,this.outboundStream=null,e&&this.emit("close")}}),c(this.outboundStream,o.encode(),this._rawOutboundStream).catch((e=>{i.error(e)})),t||this.emit("stream:outbound")}close(){this.outboundStream&&this.outboundStream.end(),this.inboundStream&&this._inboundAbortController.abort(),this._rawOutboundStream=null,this.outboundStream=null,this._rawInboundStream=null,this.inboundStream=null,this.emit("close")}}},83983:(e,t)=>{"use strict";t.SignaturePolicy={StrictSign:"StrictSign",StrictNoSign:"StrictNoSign"}},36698:(e,t,r)=>{"use strict";const n=r(31158),{toString:i}=r(82051),{fromString:s}=r(46765),o=r(90190),{sha256:a}=r(19400);e.exports={randomSeqno:()=>n(8),msgId:(e,t)=>{let r;r=e instanceof Uint8Array?o.createFromBytes(e).id:o.parse(e).id;const n=new Uint8Array(r.length+t.length);return n.set(r,0),n.set(t,r.length),n},noSignMsgId:e=>a.encode(e),anyMatch:(e,t)=>{let r;r=Array.isArray(t)?e=>t.indexOf(e)>-1:e=>t.has(e);for(const n of e)if(r(n))return!0;return!1},ensureArray:e=>Array.isArray(e)?e:[e],normalizeInRpcMessage:(e,t)=>{const r=Object.assign({},e);return e.from instanceof Uint8Array&&(r.from=i(e.from,"base58btc")),t&&(r.receivedFrom=t),r},normalizeOutRpcMessage:e=>{const t=Object.assign({},e);return"string"===typeof e.from&&(t.from=s(e.from,"base58btc")),"string"===typeof e.data&&(t.data=s(e.data)),t}}},59617:e=>{"use strict";const t=()=>{},r=Symbol.for("@libp2p/js-interfaces/topology");class n{constructor(e){let{min:r=0,max:n=1/0,handlers:i={}}=e;this.min=r,this.max=n,this._onConnect=i.onConnect||t,this._onDisconnect=i.onDisconnect||t,this.peers=new Set}get[Symbol.toStringTag](){return"Topology"}get[r](){return!0}static isTopology(e){return Boolean(e&&e[r])}async setRegistrar(e){this._registrar=e}disconnect(e){this._onDisconnect(e)}}e.exports=n},471:(e,t,r)=>{"use strict";const n=r(59617),i=Symbol.for("@libp2p/js-interfaces/topology/multicodec-topology"),s=r(18392),o=Object.assign(s("libp2p:topology:multicodec-topology"),{error:s("libp2p:topology:multicodec-topology:error")});class a extends n{constructor(e){let{min:t,max:r,multicodecs:n,handlers:i}=e;if(super({min:t,max:r,handlers:i}),!n)throw new Error("one or more multicodec should be provided");if(!i)throw new Error("the handlers should be provided");if("function"!==typeof i.onConnect)throw new Error("the 'onConnect' handler must be provided");if("function"!==typeof i.onDisconnect)throw new Error("the 'onDisconnect' handler must be provided");this.multicodecs=Array.isArray(n)?n:[n],this._registrar=void 0,this._onProtocolChange=this._onProtocolChange.bind(this),this._onPeerConnect=this._onPeerConnect.bind(this)}get[Symbol.toStringTag](){return"Topology"}get[i](){return!0}static isMulticodecTopology(e){return Boolean(e&&e[i])}async setRegistrar(e){this._registrar=e,this._registrar.peerStore.on("change:protocols",this._onProtocolChange),this._registrar.connectionManager.on("peer:connect",this._onPeerConnect),await this._updatePeers(this._registrar.peerStore.getPeers())}async _updatePeers(e){for await(const{id:t,protocols:r}of e)if(this.multicodecs.filter((e=>r.includes(e))).length){this.peers.add(t.toB58String());const e=this._registrar.getConnection(t);e&&this._onConnect(t,e)}else this.peers.delete(t.toB58String())}async _onProtocolChange(e){let{peerId:t,protocols:r}=e;try{const e=this.peers.has(t.toB58String()),n=r.filter((e=>this.multicodecs.includes(e)));e&&0===n.length&&this._onDisconnect(t);for(const i of r)if(this.multicodecs.includes(i)){const e=await this._registrar.peerStore.get(t);return void await this._updatePeers([e])}}catch(n){o.error(n)}}async _onPeerConnect(e){try{const t=e.remotePeer,r=await this._registrar.peerStore.protoBook.get(t);if(!r)return;this.multicodecs.find((e=>r.includes(e)))&&(this.peers.add(t.toB58String()),this._onConnect(t,e))}catch(t){o.error(t)}}}e.exports=a},56243:(e,t,r)=>{"use strict";const n=r(74561),i=r(41976);e.exports=e=>async function*(){const t=new s;for await(const r of e){const e=t.write(r);e.length&&(yield e)}}();class s{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(;this._buffer.length;){if(!this._headerInfo)try{this._headerInfo=this._decodeHeader(this._bufferProxy)}catch(r){break}const{id:e,type:n,length:i,offset:s}=this._headerInfo;if(this._buffer.length-s<i)break;t.push({id:e,type:n,data:this._buffer.shallowSlice(s,s+i)}),this._buffer.consume(s+i),this._headerInfo=null}return t}_decodeHeader(e){const t=n.decode(e);let r=n.decode.bytes;const i=n.decode(e,r);return r+=n.decode.bytes,{id:t>>3,type:7&t,offset:r,length:i}}}},68536:(e,t,r)=>{"use strict";const n=r(74561),i=r(41976),s=10240;const o=new class{constructor(){this._pool=new Uint8Array(s),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 s-r<100?(this._pool=new Uint8Array(s),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=>o.write(e)))):yield new i(o.write(t))}()},82540:(e,t,r)=>{"use strict";t.encode=r(68536),t.decode=r(56243)},34875:(e,t,r)=>{"use strict";e.exports=r(98187)},3678:(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)),{}))},98187:(e,t,r)=>{"use strict";const n=r(79023),i=r(77674),s=r(18392)("libp2p:mplex"),o=r(64183),a=r(82540),c=r(2233),{MessageTypes:u,MessageTypeNames:l}=r(3678),h=r(78840);class d{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(e){let{id:t,name:r}=e;const n=this._streams.receivers;return this._newStream({id:t,name:r,type:"receiver",registry:n})}_newStream(e){let{id:t,name:r,type:n,registry:i}=e;if(i.has(t))throw new Error("".concat(n," stream ").concat(t," already exists!"));s("new %s stream %s %s",n,t,r);const o=h({id:t,name:r,send:e=>(s.enabled&&s("%s stream %s %s send",n,t,r,{...e,type:l[e.type],data:e.data&&e.data.slice()}),this.source.push(e)),type:n,onEnd:()=>{s("%s stream %s %s ended",n,t,r),i.delete(t),this.onStreamEnd&&this.onStreamEnd(o)},maxMsgSize:this._options.maxMsgSize});return i.set(t,o),o}_createSink(){return async e=>{this._options.signal&&(e=o(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(t){return s("error in sink",t),this.source.end(t)}this.source.end()}}_createSource(){const e=i({onEnd:e=>{const{initiators:t,receivers:r}=this._streams;for(const n of t.values())n.abort(e);for(const n of r.values())n.abort(e)},writev:!0});return Object.assign(a.encode(e),{push:e.push,end:e.end,return:e.return})}_handleIncoming(e){let{id:t,type:r,data:n}=e;if(s.enabled&&s("incoming message",{id:t,type:l[r],data:n.slice()}),r===u.NEW_STREAM&&this.onStream){const e=this._newReceiverStream({id:t,name:n.toString()});return this.onStream(e)}const i=(1&r?this._streams.initiators:this._streams.receivers).get(t);if(!i)return s("missing stream %s",t);switch(r){case u.MESSAGE_INITIATOR:case u.MESSAGE_RECEIVER:i.source.push(n);break;case u.CLOSE_INITIATOR:case u.CLOSE_RECEIVER:i.close();break;case u.RESET_INITIATOR:case u.RESET_RECEIVER:i.reset();break;default:s("unknown message type %s",r)}}}d.multicodec="/mplex/6.7.0",e.exports=d},2233: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},78840:(e,t,r)=>{"use strict";const n=r(64183),i=r(18392)("libp2p:mplex:stream"),s=r(77674),o=r(41976),a=r(67963),{MAX_MSG_SIZE:c}=r(2233),{InitiatorMessageTypes:u,ReceiverMessageTypes:l}=r(3678),h="ERR_MPLEX_STREAM_RESET";e.exports=e=>{let{id:t,name:r,send:d,onEnd:f=(()=>{}),type:p="initiator",maxMsgSize:y=c}=e;const g=new AbortController,m=new AbortController,v="initiator"===p?u:l,b="initiator"===p?"i".concat(t):"r".concat(t);r=String(null==r?t:r);let w,E=!1,S=!1;const _=e=>{S||(S=!0,i("%s stream %s sink end",p,r,e),e&&!w&&(w=e),E&&(I.timeline.close=Date.now(),f(w)))},I={close:()=>I.source.end(),abort:e=>{i("%s stream %s abort",p,r,e),I.source.end(e),g.abort(),_(e)},reset:()=>{const e=a(new Error("stream reset"),h);m.abort(),I.source.end(e),_(e)},sink:async e=>{e=n(e,[{signal:g.signal,options:{abortMessage:"stream aborted",abortCode:"ERR_MPLEX_STREAM_ABORT"}},{signal:m.signal,options:{abortMessage:"stream reset",abortCode:h}}]),"initiator"===p&&d({id:t,type:v.NEW_STREAM,data:r});try{for await(let r of e)for(;r.length;){if(r.length<=y){d({id:t,type:v.MESSAGE,data:r});break}r=o.isBufferList(r)?r:new o(r),d({id:t,type:v.MESSAGE,data:r.shallowSlice(0,y)}),r.consume(y)}}catch(s){return s.code===h?i("%s stream %s reset",p,r):(i("%s stream %s error",p,r,s),d({id:t,type:v.RESET})),I.source.end(s),_(s)}d({id:t,type:v.CLOSE}),_()},source:s((e=>{E||(E=!0,i("%s stream %s source end",p,r,e),e&&!w&&(w=e),S&&(I.timeline.close=Date.now(),f(w)))})),timeline:{open:Date.now(),close:null},id:b};return I}},27780:(e,t,r)=>{"use strict";const n=r(85510);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)}},80710:e=>{"use strict";e.exports=function(e,t){return e.length===t.length&&t.sort()&&e.sort().every(((e,r)=>t[r].equals(e)))}},24578:(e,t,r)=>{"use strict";const n=r(18392),i=Object.assign(n("libp2p:ip-port-to-multiaddr"),{error:n("libp2p:ip-port-to-multiaddr:err")}),{Multiaddr:s}=r(98719),o=r(67963),{Address4:a,Address6:c}=r(96831),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 o(new Error("invalid ip provided: ".concat(e)),u.ERR_INVALID_IP_PARAMETER);if("string"===typeof t&&(t=parseInt(t)),isNaN(t))throw o(new Error("invalid port provided: ".concat(t)),u.ERR_INVALID_PORT_PARAMETER);try{return new a(e),new s("/ip4/".concat(e,"/tcp/").concat(t))}catch{}try{const r=new c(e);return r.is4()?new s("/ip4/".concat(r.to4().correctForm(),"/tcp/").concat(t)):new s("/ip6/".concat(e,"/tcp/").concat(t))}catch(r){const n="invalid ip:port for creating a multiaddr: ".concat(e,":").concat(t);throw i.error(n),o(new Error(n),u.ERR_INVALID_IP)}},e.exports.Errors=u},57349:(e,t,r)=>{"use strict";const n=r(56209);e.exports=function(e){const{address:t}=e.nodeAddress();return n(t)}},85510:(e,t,r)=>{"use strict";const n=r(83931);e.exports=function(e){const{address:t}=e.nodeAddress();return n(t)}},68308:(e,t,r)=>{"use strict";const{source:n}=r(64183),i=r(18392)("libp2p:stream:converter");e.exports=function(e){let{stream:t,remoteAddr:r,localAddr:s}=e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{sink:a,source:c}=t,u={async sink(e){o.signal&&(e=n(e,o.signal));try{await a(e)}catch(t){"aborted"!==t.type&&i(t)}l()},source:o.signal?n(c,o.signal):c,conn:t,localAddr:s,remoteAddr:r,timeline:{open:Date.now(),close:void 0},close:()=>(a(new Uint8Array(0)),l())};function l(){return u.timeline.close||(u.timeline.close=Date.now()),Promise.resolve()}return u}},45001:(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},44169:(e,t,r)=>{"use strict";const n=r(18322),{CODE_CIRCUIT:i,CODE_P2P:s,CODE_TCP:o,CODE_WS:a,CODE_WSS:c}=r(45001);e.exports={all:e=>e.filter((e=>{if(e.protoCodes().includes(i))return!1;const t=e.decapsulateCode(s);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(s);return n.WebSocketsSecure.matches(t)&&n.DNS.matches(t.decapsulateCode(o).decapsulateCode(c))})),dnsWsOrWss:e=>e.filter((e=>{if(e.protoCodes().includes(i))return!1;const t=e.decapsulateCode(s);return n.WebSockets.matches(t)?n.DNS.matches(t.decapsulateCode(o).decapsulateCode(a)):n.WebSocketsSecure.matches(t)&&n.DNS.matches(t.decapsulateCode(o).decapsulateCode(c))}))}},3300:(e,t,r)=>{"use strict";const n=r(88042),i=r(83708),s=r(94655),{AbortError:o}=r(64183),a=r(70121),c=r(18392),u=c("libp2p:websockets");u.error=c("libp2p:websockets:error");const l=r(96927),h=r(91227),d=r(75247),f=r(44169);e.exports=i(class{constructor(e){let{upgrader:t,filter:r}=e;if(!t)throw new Error("An upgrader must be provided. See https://github.com/libp2p/interface-transport#upgrader.");this._upgrader=t,this._filter=r}async dial(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};u("dialing %s",e);const r=await this._connect(e,t),n=d(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){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.signal&&t.signal.aborted)throw new o;const r=e.toOptions();u("dialing %s:%s",r.host,r.port);const i=a(),c=e=>{const t="connection error: ".concat(e.message);u.error(t),i.reject(e)},l=n(s(e),Object.assign({binary:!0},t));if(l.socket.on?l.socket.on("error",c):l.socket.onerror=c,!t.signal)return await Promise.race([l.connected(),i.promise]),u("connected %s",e),l;let h;const d=new Promise(((e,r)=>{if(h=()=>{r(new o),setTimeout((()=>{l.close()}))},t.signal.aborted)return h();t.signal.addEventListener("abort",h)}));try{await Promise.race([d,i.promise,l.connected()])}finally{t.signal.removeEventListener("abort",h)}return u("connected %s",e),l}createListener(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return"function"===typeof e&&(t=e,e={}),h({handler:t,upgrader:this._upgrader},e)}filter(e){return e=Array.isArray(e)?e:[e],this._filter?this._filter(e):l.isBrowser||l.isWebWorker?f.dnsWss(e):f.all(e)}},{className:"WebSockets",symbolName:"@libp2p/js-libp2p-websockets/websockets"})},91227:e=>{"use strict";e.exports=function(){throw new Error("WebSocket Servers can not be created in the browser!")}},75247:(e,t,r)=>{"use strict";const n=r(64183),{CLOSE_TIMEOUT:i}=r(45001),s=r(24578),o=r(23807),a=r(18392),c=a("libp2p:websockets:socket");c.error=a("libp2p:websockets:socket:error"),e.exports=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};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(i){"aborted"!==i.type&&c.error(i)}},source:t.signal?n(e.source,t.signal):e.source,conn:e,localAddr:t.localAddr||(e.localAddress&&e.localPort?s(e.localAddress,e.localPort):void 0),remoteAddr:t.remoteAddr||s(e.remoteAddress,e.remotePort),timeline:{open:Date.now()},async close(){const t=Date.now();try{await o(e.close(),i)}catch(n){const{host:i,port:s}=r.remoteAddr.toOptions();c("timeout closing stream to %s:%s after %dms, destroying it manually",i,s,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}},28085:(e,t,r)=>{var n=r(37934);function i(e,t){n.cipher.registerAlgorithm(e,(function(){return new n.aes.Algorithm(e,t)}))}r(36876),r(98219),r(31330),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){l||h();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return f(r._w,e,t,!1)},decrypt:function(e,t){return f(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<t.length;++i)r.putByte(t[i])}}else r=n.util.createBuffer(r);if(!n.util.isArray(r)){t=r,r=[];var s=t.length();if(16===s||24===s||32===s){s>>>=2;for(i=0;i<s;++i)r.push(t.getInt32())}}if(!n.util.isArray(r)||4!==r.length&&6!==r.length&&8!==r.length)throw new Error("Invalid key parameter.");var o=this.mode.name,a=-1!==["CFB","OFB","CTR","GCM"].indexOf(o);this._w=d(r,e.decrypt&&!a),this._init=!0}},n.aes._expandKey=function(e,t){return l||h(),d(e,t)},n.aes._updateBlock=f,i("AES-ECB",n.cipher.modes.ecb),i("AES-CBC",n.cipher.modes.cbc),i("AES-CFB",n.cipher.modes.cfb),i("AES-OFB",n.cipher.modes.ofb),i("AES-CTR",n.cipher.modes.ctr),i("AES-GCM",n.cipher.modes.gcm);var s,o,a,c,u,l=!1;function h(){l=!0,a=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),t=0;t<128;++t)e[t]=t<<1,e[t+128]=t+128<<1^283;s=new Array(256),o=new Array(256),c=new Array(4),u=new Array(4);for(t=0;t<4;++t)c[t]=new Array(256),u[t]=new Array(256);var r,n,i,h,d,f,p,y=0,g=0;for(t=0;t<256;++t){h=(h=g^g<<1^g<<2^g<<3^g<<4)>>8^255&h^99,s[y]=h,o[h]=y,f=(d=e[h])<<24^h<<16^h<<8^h^d,p=((r=e[y])^(n=e[r])^(i=e[n]))<<24^(y^i)<<16^(y^n^i)<<8^y^r^i;for(var m=0;m<4;++m)c[m][y]=f,u[m][h]=p,f=f<<24|f>>>8,p=p<<24|p>>>8;0===y?y=g=1:(y=r^e[e[e[r^i]]],g^=e[e[g]])}}function d(e,t){for(var r,n=e.slice(0),i=1,o=n.length,c=4*(o+6+1),l=o;l<c;++l)r=n[l-1],l%o===0?(r=s[r>>>16&255]<<24^s[r>>>8&255]<<16^s[255&r]<<8^s[r>>>24]^a[i]<<24,i++):o>6&&l%o===4&&(r=s[r>>>24]<<24^s[r>>>16&255]<<16^s[r>>>8&255]<<8^s[255&r]),n[l]=n[l-o]^r;if(t){for(var h,d=u[0],f=u[1],p=u[2],y=u[3],g=n.slice(0),m=(l=0,(c=n.length)-4);l<c;l+=4,m-=4)if(0===l||l===c-4)g[l]=n[m],g[l+1]=n[m+3],g[l+2]=n[m+2],g[l+3]=n[m+1];else for(var v=0;v<4;++v)h=n[m+v],g[l+(3&-v)]=d[s[h>>>24]]^f[s[h>>>16&255]]^p[s[h>>>8&255]]^y[s[255&h]];n=g}return n}function f(e,t,r,n){var i,a,l,h,d,f,p,y,g,m,v,b,w=e.length/4-1;n?(i=u[0],a=u[1],l=u[2],h=u[3],d=o):(i=c[0],a=c[1],l=c[2],h=c[3],d=s),f=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,S=1;S<w;++S)m=i[f>>>24]^a[p>>>16&255]^l[y>>>8&255]^h[255&g]^e[++E],v=i[p>>>24]^a[y>>>16&255]^l[g>>>8&255]^h[255&f]^e[++E],b=i[y>>>24]^a[g>>>16&255]^l[f>>>8&255]^h[255&p]^e[++E],g=i[g>>>24]^a[f>>>16&255]^l[p>>>8&255]^h[255&y]^e[++E],f=m,p=v,y=b;r[0]=d[f>>>24]<<24^d[p>>>16&255]<<16^d[y>>>8&255]<<8^d[255&g]^e[++E],r[n?3:1]=d[p>>>24]<<24^d[y>>>16&255]<<16^d[g>>>8&255]<<8^d[255&f]^e[++E],r[2]=d[y>>>24]<<24^d[g>>>16&255]<<16^d[f>>>8&255]<<8^d[255&p]^e[++E],r[n?1:3]=d[g>>>24]<<24^d[f>>>16&255]<<16^d[p>>>8&255]<<8^d[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 s=null;r instanceof n.util.ByteBuffer&&(s=r,r={}),(r=r||{}).output=s,r.iv=e,i.call(t,r)},t}},10853:(e,t,r)=>{var n=r(37934);r(31330),r(56661);var i=e.exports=n.asn1=n.asn1||{};function s(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}}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,s,o){if(n.util.isArray(s)){for(var a=[],c=0;c<s.length;++c)void 0!==s[c]&&a.push(s[c]);s=a}var u={tagClass:e,type:t,constructed:r,composed:r||n.util.isArray(s),value:s};return o&&"bitStringContents"in o&&(u.bitStringContents=o.bitStringContents,u.original=i.copy(u)),u},i.copy=function(e,t){var r;if(n.util.isArray(e)){r=[];for(var s=0;s<e.length;++s)r.push(i.copy(e[s],t));return r}return"string"===typeof e?e:(r={tagClass:e.tagClass,type:e.type,constructed:e.constructed,composed:e.composed,value:i.copy(e.value,t)},t&&!t.excludeBitStringContents&&(r.bitStringContents=e.bitStringContents),r)},i.equals=function(e,t,r){if(n.util.isArray(e)){if(!n.util.isArray(t))return!1;if(e.length!==t.length)return!1;for(var s=0;s<e.length;++s)if(!i.equals(e[s],t[s]))return!1;return!0}if(typeof e!==typeof t)return!1;if("string"===typeof e)return e===t;var o=e.tagClass===t.tagClass&&e.type===t.type&&e.constructed===t.constructed&&e.composed===t.composed&&i.equals(e.value,t.value);return r&&r.includeBitStringContents&&(o=o&&e.bitStringContents===t.bitStringContents),o},i.getBerValueLength=function(e){var t=e.getByte();if(128!==t)return 128&t?e.getInt((127&t)<<3):t};function o(e,t,r,n){var a;s(e,t,2);var c=e.getByte();t--;var u=192&c,l=31&c;a=e.length();var h,d,f=function(e,t){var r=e.getByte();if(t--,128!==r){var n;if(128&r){var i=127&r;s(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!==f&&f>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=f,p}f=t}var y=32===(32&c);if(y)if(h=[],void 0===f)for(;;){if(s(e,t,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),t-=2;break}a=e.length(),h.push(o(e,t,r+1,n)),t-=a-e.length()}else for(;f>0;)a=e.length(),h.push(o(e,f,r+1,n)),t-=a-e.length(),f-=a-e.length();if(void 0===h&&u===i.Class.UNIVERSAL&&l===i.Type.BITSTRING&&(d=e.bytes(f)),void 0===h&&n.decodeBitStrings&&u===i.Class.UNIVERSAL&&l===i.Type.BITSTRING&&f>1){var g=e.read,m=t,v=0;if(l===i.Type.BITSTRING&&(s(e,t,1),v=e.getByte(),t--),0===v)try{a=e.length();var b=o(e,t,r+1,{verbose:n.verbose,strict:!0,decodeBitStrings:!0}),w=a-e.length();t-=w,l==i.Type.BITSTRING&&w++;var E=b.tagClass;w!==f||E!==i.Class.UNIVERSAL&&E!==i.Class.CONTEXT_SPECIFIC||(h=[b])}catch(_){}void 0===h&&(e.read=g,t=m)}if(void 0===h){if(void 0===f){if(n.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");f=t}if(l===i.Type.BMPSTRING)for(h="";f>0;f-=2)s(e,t,2),h+=String.fromCharCode(e.getInt16()),t-=2;else h=e.getBytes(f)}var S=void 0===d?null:{bitStringContents:d};return i.create(u,l,y,h,S)}i.fromDer=function(e,t){return void 0===t&&(t={strict:!0,decodeBitStrings:!0}),"boolean"===typeof t&&(t={strict:t,decodeBitStrings:!0}),"strict"in t||(t.strict=!0),"decodeBitStrings"in t||(t.decodeBitStrings=!0),"string"===typeof e&&(e=n.util.createBuffer(e)),o(e,e.length(),0,t)},i.toDer=function(e){var t=n.util.createBuffer(),r=e.tagClass|e.type,s=n.util.createBuffer(),o=!1;if("bitStringContents"in e&&(o=!0,e.original&&(o=i.equals(e,e.original))),o)s.putBytes(e.bitStringContents);else if(e.composed){e.constructed?r|=32:s.putByte(0);for(var a=0;a<e.value.length;++a)void 0!==e.value[a]&&s.putBuffer(i.toDer(e.value[a]))}else if(e.type===i.Type.BMPSTRING)for(a=0;a<e.value.length;++a)s.putInt16(e.value.charCodeAt(a));else e.type===i.Type.INTEGER&&e.value.length>1&&(0===e.value.charCodeAt(0)&&0===(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128===(128&e.value.charCodeAt(1)))?s.putBytes(e.value.substr(1)):s.putBytes(e.value);if(t.putByte(r),s.length()<=127)t.putByte(127&s.length());else{var c=s.length(),u="";do{u+=String.fromCharCode(255&c),c>>>=8}while(c>0);t.putByte(128|u.length);for(a=u.length-1;a>=0;--a)t.putByte(u.charCodeAt(a))}return t.putBuffer(s),t},i.oidToDer=function(e){var t,r,i,s,o=e.split("."),a=n.util.createBuffer();a.putByte(40*parseInt(o[0],10)+parseInt(o[1],10));for(var c=2;c<o.length;++c){t=!0,r=[],i=parseInt(o[c],10);do{s=127&i,i>>>=7,t||(s|=128),r.push(s),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),s=parseInt(e.substr(6,2),10),o=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(s,o,a,0),u&&("+"===(c=e.charAt(u))||"-"===c)){var l=60*parseInt(e.substr(u+1,2),10)+parseInt(e.substr(u+4,2),10);l*=6e4,"+"===c?t.setTime(+t-l):t.setTime(+t+l)}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),s=parseInt(e.substr(8,2),10),o=parseInt(e.substr(10,2),10),a=parseInt(e.substr(12,2),10),c=0,u=0,l=!1;"Z"===e.charAt(e.length-1)&&(l=!0);var h=e.length-5,d=e.charAt(h);"+"!==d&&"-"!==d||(u=60*parseInt(e.substr(h+1,2),10)+parseInt(e.substr(h+4,2),10),u*=6e4,"+"===d&&(u*=-1),l=!0);return"."===e.charAt(14)&&(c=1e3*parseFloat(e.substr(14),10)),l?(t.setUTCFullYear(r,n,i),t.setUTCHours(s,o,a,c),t.setTime(+t+u)):(t.setFullYear(r,n,i),t.setHours(s,o,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<r.length;++n)r[n].length<2&&(t+="0"),t+=r[n];return t+="Z"},i.dateToGeneralizedTime=function(e){if("string"===typeof e)return e;var t="",r=[];r.push(""+e.getUTCFullYear()),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<r.length;++n)r[n].length<2&&(t+="0"),t+=r[n];return t+="Z"},i.integerToDer=function(e){var t=n.util.createBuffer();if(e>=-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,s){var o=!1;if(e.tagClass!==t.tagClass&&"undefined"!==typeof t.tagClass||e.type!==t.type&&"undefined"!==typeof t.type)s&&(e.tagClass!==t.tagClass&&s.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&s.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||"undefined"===typeof t.constructed){if(o=!0,t.value&&n.util.isArray(t.value))for(var a=0,c=0;o&&c<t.value.length;++c)o=t.value[c].optional||!1,e.value[a]&&((o=i.validate(e.value[a],t.value[c],r,s))?++a:t.value[c].optional&&(o=!0)),!o&&s&&s.push("["+t.name+'] Tag class "'+t.tagClass+'", type "'+t.type+'" expected value length "'+t.value.length+'", got "'+e.value.length+'"');if(o&&r)if(t.capture&&(r[t.capture]=e.value),t.captureAsn1&&(r[t.captureAsn1]=e),t.captureBitStringContents&&"bitStringContents"in e&&(r[t.captureBitStringContents]=e.bitStringContents),t.captureBitStringValue&&"bitStringContents"in e)if(e.bitStringContents.length<2)r[t.captureBitStringValue]="";else{if(0!==e.bitStringContents.charCodeAt(0))throw new Error("captureBitStringValue only supported for zero unused bits");r[t.captureBitStringValue]=e.bitStringContents.slice(1)}}else s&&s.push("["+t.name+'] Expected constructed "'+t.constructed+'", got "'+e.constructed+'"');return o};var a=/[^\\u0000-\\u00ff]/;i.prettyPrint=function(e,t,r){var s="";r=r||2,(t=t||0)>0&&(s+="\n");for(var o="",c=0;c<t*r;++c)o+=" ";switch(s+=o+"Tag: ",e.tagClass){case i.Class.UNIVERSAL:s+="Universal:";break;case i.Class.APPLICATION:s+="Application:";break;case i.Class.CONTEXT_SPECIFIC:s+="Context-Specific:";break;case i.Class.PRIVATE:s+="Private:"}if(e.tagClass===i.Class.UNIVERSAL)switch(s+=e.type,e.type){case i.Type.NONE:s+=" (None)";break;case i.Type.BOOLEAN:s+=" (Boolean)";break;case i.Type.INTEGER:s+=" (Integer)";break;case i.Type.BITSTRING:s+=" (Bit string)";break;case i.Type.OCTETSTRING:s+=" (Octet string)";break;case i.Type.NULL:s+=" (Null)";break;case i.Type.OID:s+=" (Object Identifier)";break;case i.Type.ODESC:s+=" (Object Descriptor)";break;case i.Type.EXTERNAL:s+=" (External or Instance of)";break;case i.Type.REAL:s+=" (Real)";break;case i.Type.ENUMERATED:s+=" (Enumerated)";break;case i.Type.EMBEDDED:s+=" (Embedded PDV)";break;case i.Type.UTF8:s+=" (UTF8)";break;case i.Type.ROID:s+=" (Relative Object Identifier)";break;case i.Type.SEQUENCE:s+=" (Sequence)";break;case i.Type.SET:s+=" (Set)";break;case i.Type.PRINTABLESTRING:s+=" (Printable String)";break;case i.Type.IA5String:s+=" (IA5String (ASCII))";break;case i.Type.UTCTIME:s+=" (UTC time)";break;case i.Type.GENERALIZEDTIME:s+=" (Generalized time)";break;case i.Type.BMPSTRING:s+=" (BMP String)"}else s+=e.type;if(s+="\n",s+=o+"Constructed: "+e.constructed+"\n",e.composed){var u=0,l="";for(c=0;c<e.value.length;++c)void 0!==e.value[c]&&(u+=1,l+=i.prettyPrint(e.value[c],t+1,r),c+1<e.value.length&&(l+=","));s+=o+"Sub values: "+u+l}else{if(s+=o+"Value: ",e.type===i.Type.OID){var h=i.derToOid(e.value);s+=h,n.pki&&n.pki.oids&&h in n.pki.oids&&(s+=" ("+n.pki.oids[h]+") ")}if(e.type===i.Type.INTEGER)try{s+=i.derToInteger(e.value)}catch(f){s+="0x"+n.util.bytesToHex(e.value)}else if(e.type===i.Type.BITSTRING){if(e.value.length>1?s+="0x"+n.util.bytesToHex(e.value.slice(1)):s+="(none)",e.value.length>0){var d=e.value.charCodeAt(0);1==d?s+=" (1 unused bit shown)":d>1&&(s+=" ("+d+" unused bits shown)")}}else e.type===i.Type.OCTETSTRING?(a.test(e.value)||(s+="("+e.value+") "),s+="0x"+n.util.bytesToHex(e.value)):e.type===i.Type.UTF8?s+=n.util.decodeUtf8(e.value):e.type===i.Type.PRINTABLESTRING||e.type===i.Type.IA5String?s+=e.value:a.test(e.value)?s+="0x"+n.util.bytesToHex(e.value):0===e.value.length?s+="[null]":s+=e.value}return s}},47271:(e,t,r)=>{var n=r(30285).Buffer,i={};e.exports=i;var s={};i.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,s=t.length,o=t.charAt(0),a=[0];for(i=0;i<e.length;++i){for(var c=0,u=e[i];c<a.length;++c)u+=a[c]<<8,a[c]=u%s,u=u/s|0;for(;u>0;)a.push(u%s),u=u/s|0}for(i=0;0===e[i]&&i<e.length-1;++i)n+=o;for(i=a.length-1;i>=0;--i)n+=t[a[i]]}else n=function(e,t){var r=0,n=t.length,i=t.charAt(0),s=[0];for(r=0;r<e.length();++r){for(var o=0,a=e.at(r);o<s.length;++o)a+=s[o]<<8,s[o]=a%n,a=a/n|0;for(;a>0;)s.push(a%n),a=a/n|0}var c="";for(r=0;0===e.at(r)&&r<e.length()-1;++r)c+=i;for(r=s.length-1;r>=0;--r)c+=t[s[r]];return c}(e,t);if(r){var l=new RegExp(".{1,"+r+"}","g");n=n.match(l).join("\r\n")}return n},i.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 r=s[t];if(!r){r=s[t]=[];for(var i=0;i<t.length;++i)r[t.charCodeAt(i)]=i}e=e.replace(/\s/g,"");var o=t.length,a=t.charAt(0),c=[0];for(i=0;i<e.length;i++){var u=r[e.charCodeAt(i)];if(void 0===u)return;for(var l=0,h=u;l<c.length;++l)h+=c[l]*o,c[l]=255&h,h>>=8;for(;h>0;)c.push(255&h),h>>=8}for(var d=0;e[d]===a&&d<e.length-1;++d)c.push(0);return"undefined"!==typeof n?n.from(c.reverse()):new Uint8Array(c.reverse())}},36876:(e,t,r)=>{var n=r(37934);r(31330),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)))}},98219:(e,t,r)=>{var n=r(37934);r(31330),n.cipher=n.cipher||{};var i=e.exports=n.cipher.modes=n.cipher.modes||{};function s(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;i<r.length;++i)e.putByte(r[i])}if(e.length()<t)throw new Error("Invalid IV length; got "+e.length()+" bytes and expected "+t+" bytes.");if(!n.util.isArray(e)){var s=[],o=t/4;for(i=0;i<o;++i)s.push(e.getInt32());e=s}return e}function o(e){e[e.length-1]=e[e.length-1]+1&4294967295}function a(e){return[e/4294967296|0,4294967295&e]}i.ecb=function(e){e=e||{},this.name="ECB",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.ecb.prototype.start=function(e){},i.ecb.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(n=0;n<this._ints;++n)t.putInt32(this._outBlock[n])},i.ecb.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(n=0;n<this._ints;++n)t.putInt32(this._outBlock[n])},i.ecb.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},i.ecb.prototype.unpad=function(e,t){if(t.overflow>0)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=s(e.iv,this.blockSize),this._prev=this._iv.slice(0)}},i.cbc.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=this._prev[n]^e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(n=0;n<this._ints;++n)t.putInt32(this._outBlock[n]);this._prev=this._outBlock},i.cbc.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(n=0;n<this._ints;++n)t.putInt32(this._prev[n]^this._outBlock[n]);this._prev=this._inBlock.slice(0)},i.cbc.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0},i.cbc.prototype.unpad=function(e,t){if(t.overflow>0)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=s(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;i<this._ints;++i)this._inBlock[i]=e.getInt32()^this._outBlock[i],t.putInt32(this._inBlock[i]);else{var s=(this.blockSize-n)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialBlock[i]=e.getInt32()^this._outBlock[i],this._partialOutput.putInt32(this._partialBlock[i]);if(s>0)e.read-=this.blockSize;else for(i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!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;i<this._ints;++i)this._inBlock[i]=e.getInt32(),t.putInt32(this._inBlock[i]^this._outBlock[i]);else{var s=(this.blockSize-n)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialBlock[i]=e.getInt32(),this._partialOutput.putInt32(this._partialBlock[i]^this._outBlock[i]);if(s>0)e.read-=this.blockSize;else for(i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!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=s(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;i<this._ints;++i)t.putInt32(e.getInt32()^this._outBlock[i]),this._inBlock[i]=this._outBlock[i];else{var s=(this.blockSize-n)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(s>0)e.read-=this.blockSize;else for(i=0;i<this._ints;++i)this._inBlock[i]=this._outBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!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=s(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;i<this._ints;++i)t.putInt32(e.getInt32()^this._outBlock[i]);else{var s=(this.blockSize-n)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(s>0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}o(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),o(this._inBlock),this._partialBytes=0,t=n.util.createBuffer(t),this._aDataLength=a(8*t.length());var s=t.length()%this.blockSize;for(s&&t.fillWithByte(0,this.blockSize-s),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;i<this._ints;++i)t.putInt32(this._outBlock[i]^=e.getInt32());this._cipherLength+=this.blockSize}else{var s=(this.blockSize-n)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(s<=0||r){if(r){var a=n%this.blockSize;this._cipherLength+=a,this._partialOutput.truncate(this.blockSize-a)}else this._cipherLength+=this.blockSize;for(i=0;i<this._ints;++i)this._outBlock[i]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),o(this._inBlock)},i.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n<this.blockSize&&!(r&&n>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),o(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;i<this._ints;++i)t.putInt32(this._outBlock[i]^this._hashBlock[i]);n<this.blockSize?this._cipherLength+=n%this.blockSize:this._cipherLength+=this.blockSize},i.gcm.prototype.afterFinish=function(e,t){var r=!0;t.decrypt&&t.overflow&&e.truncate(this.blockSize-t.overflow),this.tag=n.util.createBuffer();var i=this._aDataLength.concat(a(8*this._cipherLength));this._s=this.ghash(this._hashSubkey,this._s,i);var s=[];this.cipher.encrypt(this._j0,s);for(var o=0;o<this._ints;++o)this.tag.putInt32(this._s[o]^s[o]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),t.decrypt&&this.tag.bytes()!==this._tag&&(r=!1),r},i.gcm.prototype.multiply=function(e,t){for(var r=[0,0,0,0],n=t.slice(0),i=0;i<128;++i){e[i/32|0]&1<<31-i%32&&(r[0]^=n[0],r[1]^=n[1],r[2]^=n[2],r[3]^=n[3]),this.pow(n,n)}return r},i.gcm.prototype.pow=function(e,t){for(var r=1&e[3],n=3;n>0;--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,s=new Array(i),o=0;o<i;++o){var a=[0,0,0,0],c=(n-1-o%n)*t;a[o/n|0]=1<<t-1<<c,s[o]=this.generateSubHashTable(this.multiply(a,e),t)}return s},i.gcm.prototype.generateSubHashTable=function(e,t){var r=1<<t,n=r>>>1,i=new Array(r);i[n]=e.slice(0);for(var s=n>>>1;s>0;)this.pow(i[2*s],i[s]=[]),s>>=1;for(s=2;s<n;){for(var o=1;o<s;++o){var a=i[s],c=i[o];i[s+o]=[a[0]^c[0],a[1]^c[1],a[2]^c[2],a[3]^c[3]]}s*=2}for(i[0]=[0,0,0,0],s=n+1;s<r;++s){var u=i[s^n];i[s]=[e[0]^u[0],e[1]^u[1],e[2]^u[2],e[3]^u[3]]}return i}},96052:(e,t,r)=>{var n=r(37934);function i(e,t){n.cipher.registerAlgorithm(e,(function(){return new n.des.Algorithm(e,t)}))}r(36876),r(98219),r(31330),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 f(r._keys,e,t,!1)},decrypt:function(e,t){return f(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],s=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],o=[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],l=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],h=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],d=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],f=[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,m=[],v=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],b=0,w=0;w<g;w++){var E=e.getInt32(),S=e.getInt32();E^=(t=252645135&(E>>>4^S))<<4,E^=t=65535&((S^=t)>>>-16^E),E^=(t=858993459&(E>>>2^(S^=t<<-16)))<<2,E^=t=65535&((S^=t)>>>-16^E),E^=(t=1431655765&(E>>>1^(S^=t<<-16)))<<1,E^=t=16711935&((S^=t)>>>8^E),t=(E^=(t=1431655765&(E>>>1^(S^=t<<8)))<<1)<<8|(S^=t)>>>20&240,E=S<<24|S<<8&16711680|S>>>8&65280|S>>>24&240,S=t;for(var _=0;_<v.length;++_){v[_]?(E=E<<2|E>>>26,S=S<<2|S>>>26):(E=E<<1|E>>>27,S=S<<1|S>>>27),S&=-15;var I=r[(E&=-15)>>>28]|n[E>>>24&15]|i[E>>>20&15]|s[E>>>16&15]|o[E>>>12&15]|a[E>>>8&15]|c[E>>>4&15],T=u[S>>>28]|l[S>>>24&15]|h[S>>>20&15]|d[S>>>16&15]|f[S>>>12&15]|p[S>>>8&15]|y[S>>>4&15];t=65535&(T>>>16^I),m[b++]=I^t,m[b++]=T^t<<16}}return m}(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 s=[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],o=[-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],l=[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],h=[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],d=[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 f(e,t,r,n){var i,f,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^=(f=252645135&(y>>>4^g))<<4,y^=(f=65535&(y>>>16^(g^=f)))<<16,y^=f=858993459&((g^=f)>>>2^y),y^=f=16711935&((g^=f<<2)>>>8^y),y=(y^=(f=1431655765&(y>>>1^(g^=f<<8)))<<1)<<1|y>>>31,g=(g^=f)<<1|g>>>31;for(var m=0;m<p;m+=3){for(var v=i[m+1],b=i[m+2],w=i[m];w!=v;w+=b){var E=g^e[w],S=(g>>>4|g<<28)^e[w+1];f=y,y=g,g=f^(o[E>>>24&63]|c[E>>>16&63]|l[E>>>8&63]|d[63&E]|s[S>>>24&63]|a[S>>>16&63]|u[S>>>8&63]|h[63&S])}f=y,y=g,g=f}g=g>>>1|g<<31,g^=f=1431655765&((y=y>>>1|y<<31)>>>1^g),g^=(f=16711935&(g>>>8^(y^=f<<1)))<<8,g^=(f=858993459&(g>>>2^(y^=f)))<<2,g^=f=65535&((y^=f)>>>16^g),g^=f=252645135&((y^=f<<16)>>>4^g),y^=f<<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 s=null;r instanceof n.util.ByteBuffer&&(s=r,r={}),(r=r||{}).output=s,r.iv=e,i.call(t,r)},t}},37934:e=>{e.exports={options:{usePureJavaScript:!1}}},43156:(e,t,r)=>{var n=r(37934);r(84630),r(31330),(e.exports=n.hmac=n.hmac||{}).create=function(){var e=null,t=null,r=null,i=null,s={start:function(s,o){if(null!==s)if("string"===typeof s){if(!((s=s.toLowerCase())in n.md.algorithms))throw new Error('Unknown hash algorithm "'+s+'"');t=n.md.algorithms[s].create()}else t=s;if(null===o)o=e;else{if("string"===typeof o)o=n.util.createBuffer(o);else if(n.util.isArray(o)){var a=o;o=n.util.createBuffer();for(var c=0;c<a.length;++c)o.putByte(a[c])}var u=o.length();u>t.blockLength&&(t.start(),t.update(o.bytes()),o=t.digest()),r=n.util.createBuffer(),i=n.util.createBuffer(),u=o.length();for(c=0;c<u;++c){a=o.at(c);r.putByte(54^a),i.putByte(92^a)}if(u<t.blockLength)for(a=t.blockLength-u,c=0;c<a;++c)r.putByte(54),i.putByte(92);e=o,r=r.bytes(),i=i.bytes()}t.start(),t.update(r)},update:function(e){t.update(e)},getMac:function(){var e=t.digest().bytes();return t.start(),t.update(i),t.update(e),t.digest()}};return s.digest=s.getMac,s}},78808:(e,t,r)=>{var n,i=r(37934);e.exports=i.jsbn=i.jsbn||{};function s(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 o(){return new s(null)}function a(e,t,r,n,i,s){for(var o=16383&t,a=t>>14;--s>=0;){var c=16383&this.data[e],u=this.data[e++]>>14,l=a*c+u*o;i=((c=o*c+((16383&l)<<14)+r.data[n]+i)>>28)+(l>>14)+a*u,r.data[n++]=268435455&c}return i}i.jsbn.BigInteger=s,"undefined"===typeof navigator?(s.prototype.am=a,n=28):"Microsoft Internet Explorer"==navigator.appName?(s.prototype.am=function(e,t,r,n,i,s){for(var o=32767&t,a=t>>15;--s>=0;){var c=32767&this.data[e],u=this.data[e++]>>15,l=a*c+u*o;i=((c=o*c+((32767&l)<<15)+r.data[n]+(1073741823&i))>>>30)+(l>>>15)+a*u+(i>>>30),r.data[n++]=1073741823&c}return i},n=30):"Netscape"!=navigator.appName?(s.prototype.am=function(e,t,r,n,i,s){for(;--s>=0;){var o=t*this.data[e++]+r.data[n]+i;i=Math.floor(o/67108864),r.data[n++]=67108863&o}return i},n=26):(s.prototype.am=a,n=28),s.prototype.DB=n,s.prototype.DM=(1<<n)-1,s.prototype.DV=1<<n;s.prototype.FV=Math.pow(2,52),s.prototype.F1=52-n,s.prototype.F2=2*n-52;var c,u,l=new Array;for(c="0".charCodeAt(0),u=0;u<=9;++u)l[c++]=u;for(c="a".charCodeAt(0),u=10;u<36;++u)l[c++]=u;for(c="A".charCodeAt(0),u=10;u<36;++u)l[c++]=u;function h(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function d(e,t){var r=l[e.charCodeAt(t)];return null==r?-1:r}function f(e){var t=o();return t.fromInt(e),t}function p(e){var t,r=1;return 0!=(t=e>>>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<<e.DB-15)-1,this.mt2=2*e.t}function m(e,t){return e&t}function v(e,t){return e|t}function b(e,t){return e^t}function w(e,t){return e&~t}function E(e){if(0==e)return-1;var t=0;return 0==(65535&e)&&(e>>=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 S(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function _(){}function I(e){return e}function T(e){this.r2=o(),this.q3=o(),s.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=o();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(s.ZERO)>0&&this.m.subTo(t,t),t},g.prototype.revert=function(e){var t=o();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<this.m.t;++t){var r=32767&e.data[t],n=r*this.mpl+((r*this.mph+(e.data[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)},s.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},s.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},s.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,o=0;--n>=0;){var a=8==r?255&e[n]:d(e,n);a<0?"-"==e.charAt(n)&&(i=!0):(i=!1,0==o?this.data[this.t++]=a:o+r>this.DB?(this.data[this.t-1]|=(a&(1<<this.DB-o)-1)<<o,this.data[this.t++]=a>>this.DB-o):this.data[this.t-1]|=a<<o,(o+=r)>=this.DB&&(o-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,o>0&&(this.data[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),i&&s.ZERO.subTo(this,this)},s.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this.data[this.t-1]==e;)--this.t},s.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},s.prototype.drShiftTo=function(e,t){for(var r=e;r<this.t;++r)t.data[r-e]=this.data[r];t.t=Math.max(this.t-e,0),t.s=this.s},s.prototype.lShiftTo=function(e,t){var r,n=e%this.DB,i=this.DB-n,s=(1<<i)-1,o=Math.floor(e/this.DB),a=this.s<<n&this.DM;for(r=this.t-1;r>=0;--r)t.data[r+o+1]=this.data[r]>>i|a,a=(this.data[r]&s)<<n;for(r=o-1;r>=0;--r)t.data[r]=0;t.data[o]=a,t.t=this.t+o+1,t.s=this.s,t.clamp()},s.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,s=(1<<n)-1;t.data[0]=this.data[r]>>n;for(var o=r+1;o<this.t;++o)t.data[o-r-1]|=(this.data[o]&s)<<i,t.data[o-r]=this.data[o]>>n;n>0&&(t.data[this.t-r-1]|=(this.s&s)<<i),t.t=this.t-r,t.clamp()}},s.prototype.subTo=function(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this.data[r]-e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n-=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n-=e.data[r],t.data[r++]=n&this.DM,n>>=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()},s.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<n.t;++i)t.data[i+r.t]=r.am(0,n.data[i],t,i,0,r.t);t.s=0,t.clamp(),this.s!=e.s&&s.ZERO.subTo(t,t)},s.prototype.squareTo=function(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e.data[r]=0;for(r=0;r<t.t-1;++r){var n=t.am(r,t.data[r],e,2*r,0,1);(e.data[r+t.t]+=t.am(r+1,2*t.data[r],e,2*r+1,n,t.t-r-1))>=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()},s.prototype.divRemTo=function(e,t,r){var n=e.abs();if(!(n.t<=0)){var i=this.abs();if(i.t<n.t)return null!=t&&t.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=o());var a=o(),c=this.s,u=e.s,l=this.DB-p(n.data[n.t-1]);l>0?(n.lShiftTo(l,a),i.lShiftTo(l,r)):(n.copyTo(a),i.copyTo(r));var h=a.t,d=a.data[h-1];if(0!=d){var f=d*(1<<this.F1)+(h>1?a.data[h-2]>>this.F2:0),y=this.FV/f,g=(1<<this.F1)/f,m=1<<this.F2,v=r.t,b=v-h,w=null==t?o():t;for(a.dlShiftTo(b,w),r.compareTo(w)>=0&&(r.data[r.t++]=1,r.subTo(w,r)),s.ONE.dlShiftTo(h,w),w.subTo(a,a);a.t<h;)a.data[a.t++]=0;for(;--b>=0;){var E=r.data[--v]==d?this.DM:Math.floor(r.data[v]*y+(r.data[v-1]+m)*g);if((r.data[v]+=a.am(0,E,r,b,0,h))<E)for(a.dlShiftTo(b,w),r.subTo(w,r);r.data[v]<--E;)r.subTo(w,r)}null!=t&&(r.drShiftTo(h,t),c!=u&&s.ZERO.subTo(t,t)),r.t=h,r.clamp(),l>0&&r.rShiftTo(l,r),c<0&&s.ZERO.subTo(r,r)}}},s.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},s.prototype.isEven=function(){return 0==(this.t>0?1&this.data[0]:this.s)},s.prototype.exp=function(e,t){if(e>4294967295||e<1)return s.ONE;var r=o(),n=o(),i=t.convert(this),a=p(e)-1;for(i.copyTo(r);--a>=0;)if(t.sqrTo(r,n),(e&1<<a)>0)t.mulTo(n,i,r);else{var c=r;r=n,n=c}return t.revert(r)},s.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<<t)-1,i=!1,s="",o=this.t,a=this.DB-o*this.DB%t;if(o-- >0)for(a<this.DB&&(r=this.data[o]>>a)>0&&(i=!0,s=h(r));o>=0;)a<t?(r=(this.data[o]&(1<<a)-1)<<t-a,r|=this.data[--o]>>(a+=this.DB-t)):(r=this.data[o]>>(a-=t)&n,a<=0&&(a+=this.DB,--o)),r>0&&(i=!0),i&&(s+=h(r));return i?s:"0"},s.prototype.negate=function(){var e=o();return s.ZERO.subTo(this,e),e},s.prototype.abs=function(){return this.s<0?this.negate():this},s.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},s.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+p(this.data[this.t-1]^this.s&this.DM)},s.prototype.mod=function(e){var t=o();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(s.ZERO)>0&&e.subTo(t,t),t},s.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new y(t):new g(t),this.exp(e,r)},s.ZERO=f(0),s.ONE=f(1),_.prototype.convert=I,_.prototype.revert=I,_.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},_.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=o();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 A=[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)/A[A.length-1];s.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},s.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=f(r),i=o(),s=o(),a="";for(this.divRemTo(n,i,s);i.signum()>0;)a=(r+s.intValue()).toString(e).substr(1)+a,i.divRemTo(n,i,s);return s.intValue().toString(e)+a},s.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,o=0,a=0,c=0;c<e.length;++c){var u=d(e,c);u<0?"-"==e.charAt(c)&&0==this.signum()&&(i=!0):(a=t*a+u,++o>=r&&(this.dMultiply(n),this.dAddOffset(a,0),o=0,a=0))}o>0&&(this.dMultiply(Math.pow(t,o)),this.dAddOffset(a,0)),i&&s.ZERO.subTo(this,this)},s.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(s.ONE.shiftLeft(e-1),v,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(s.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<<i)-1:n[0]=0,this.fromString(n,256)}},s.prototype.bitwiseTo=function(e,t,r){var n,i,s=Math.min(e.t,this.t);for(n=0;n<s;++n)r.data[n]=t(this.data[n],e.data[n]);if(e.t<this.t){for(i=e.s&this.DM,n=s;n<this.t;++n)r.data[n]=t(this.data[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=s;n<e.t;++n)r.data[n]=t(i,e.data[n]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()},s.prototype.changeBit=function(e,t){var r=s.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r},s.prototype.addTo=function(e,t){for(var r=0,n=0,i=Math.min(e.t,this.t);r<i;)n+=this.data[r]+e.data[r],t.data[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n+=e.s;r<this.t;)n+=this.data[r],t.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n+=e.data[r],t.data[r++]=n&this.DM,n>>=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()},s.prototype.dMultiply=function(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},s.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]}},s.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<n;++i)r.data[i+this.t]=this.am(0,e.data[i],r,i,0,this.t);for(n=Math.min(e.t,t);i<n;++i)this.am(0,e.data[i],r,i,0,t-i);r.clamp()},s.prototype.multiplyUpperTo=function(e,t,r){--t;var n=r.t=this.t+e.t-t;for(r.s=0;--n>=0;)r.data[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)r.data[this.t+n-t]=this.am(t-n,e.data[n],r,0,0,this.t+n-t);r.clamp(),r.drShiftTo(1,r)},s.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)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},s.prototype.millerRabin=function(e){var t=this.subtract(s.ONE),r=t.getLowestSetBit();if(r<=0)return!1;for(var n,i=t.shiftRight(r),o={nextBytes:function(e){for(var t=0;t<e.length;++t)e[t]=Math.floor(256*Math.random())}},a=0;a<e;++a){do{n=new s(this.bitLength(),o)}while(n.compareTo(s.ONE)<=0||n.compareTo(t)>=0);var c=n.modPow(i,this);if(0!=c.compareTo(s.ONE)&&0!=c.compareTo(t)){for(var u=1;u++<r&&0!=c.compareTo(t);)if(0==(c=c.modPowInt(2,this)).compareTo(s.ONE))return!1;if(0!=c.compareTo(t))return!1}}return!0},s.prototype.clone=function(){var e=o();return this.copyTo(e),e},s.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]},s.prototype.byteValue=function(){return 0==this.t?this.s:this.data[0]<<24>>24},s.prototype.shortValue=function(){return 0==this.t?this.s:this.data[0]<<16>>16},s.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1},s.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<this.DB&&(r=this.data[e]>>n)!=(this.s&this.DM)>>n&&(t[i++]=r|this.s<<this.DB-n);e>=0;)n<8?(r=(this.data[e]&(1<<n)-1)<<8-n,r|=this.data[--e]>>(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},s.prototype.equals=function(e){return 0==this.compareTo(e)},s.prototype.min=function(e){return this.compareTo(e)<0?this:e},s.prototype.max=function(e){return this.compareTo(e)>0?this:e},s.prototype.and=function(e){var t=o();return this.bitwiseTo(e,m,t),t},s.prototype.or=function(e){var t=o();return this.bitwiseTo(e,v,t),t},s.prototype.xor=function(e){var t=o();return this.bitwiseTo(e,b,t),t},s.prototype.andNot=function(e){var t=o();return this.bitwiseTo(e,w,t),t},s.prototype.not=function(){for(var e=o(),t=0;t<this.t;++t)e.data[t]=this.DM&~this.data[t];return e.t=this.t,e.s=~this.s,e},s.prototype.shiftLeft=function(e){var t=o();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},s.prototype.shiftRight=function(e){var t=o();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},s.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this.data[e])return e*this.DB+E(this.data[e]);return this.s<0?this.t*this.DB:-1},s.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=S(this.data[r]^t);return e},s.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:0!=(this.data[t]&1<<e%this.DB)},s.prototype.setBit=function(e){return this.changeBit(e,v)},s.prototype.clearBit=function(e){return this.changeBit(e,w)},s.prototype.flipBit=function(e){return this.changeBit(e,b)},s.prototype.add=function(e){var t=o();return this.addTo(e,t),t},s.prototype.subtract=function(e){var t=o();return this.subTo(e,t),t},s.prototype.multiply=function(e){var t=o();return this.multiplyTo(e,t),t},s.prototype.divide=function(e){var t=o();return this.divRemTo(e,t,null),t},s.prototype.remainder=function(e){var t=o();return this.divRemTo(e,null,t),t},s.prototype.divideAndRemainder=function(e){var t=o(),r=o();return this.divRemTo(e,t,r),new Array(t,r)},s.prototype.modPow=function(e,t){var r,n,i=e.bitLength(),s=f(1);if(i<=0)return s;r=i<18?1:i<48?3:i<144?4:i<768?5:6,n=i<8?new y(t):t.isEven()?new T(t):new g(t);var a=new Array,c=3,u=r-1,l=(1<<r)-1;if(a[1]=n.convert(this),r>1){var h=o();for(n.sqrTo(a[1],h);c<=l;)a[c]=o(),n.mulTo(h,a[c-2],a[c]),c+=2}var d,m,v=e.t-1,b=!0,w=o();for(i=p(e.data[v])-1;v>=0;){for(i>=u?d=e.data[v]>>i-u&l:(d=(e.data[v]&(1<<i+1)-1)<<u-i,v>0&&(d|=e.data[v-1]>>this.DB+i-u)),c=r;0==(1&d);)d>>=1,--c;if((i-=c)<0&&(i+=this.DB,--v),b)a[d].copyTo(s),b=!1;else{for(;c>1;)n.sqrTo(s,w),n.sqrTo(w,s),c-=2;c>0?n.sqrTo(s,w):(m=s,s=w,w=m),n.mulTo(w,a[d],s)}for(;v>=0&&0==(e.data[v]&1<<i);)n.sqrTo(s,w),m=s,s=w,w=m,--i<0&&(i=this.DB-1,--v)}return n.revert(s)},s.prototype.modInverse=function(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return s.ZERO;for(var r=e.clone(),n=this.clone(),i=f(1),o=f(0),a=f(0),c=f(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),t?(i.isEven()&&o.isEven()||(i.addTo(this,i),o.subTo(e,o)),i.rShiftTo(1,i)):o.isEven()||o.subTo(e,o),o.rShiftTo(1,o);for(;n.isEven();)n.rShiftTo(1,n),t?(a.isEven()&&c.isEven()||(a.addTo(this,a),c.subTo(e,c)),a.rShiftTo(1,a)):c.isEven()||c.subTo(e,c),c.rShiftTo(1,c);r.compareTo(n)>=0?(r.subTo(n,r),t&&i.subTo(a,i),o.subTo(c,o)):(n.subTo(r,n),t&&a.subTo(i,a),c.subTo(o,c))}return 0!=n.compareTo(s.ONE)?s.ZERO:c.compareTo(e)>=0?c.subtract(e):c.signum()<0?(c.addTo(e,c),c.signum()<0?c.add(e):c):c},s.prototype.pow=function(e){return this.exp(e,new _)},s.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(),s=r.getLowestSetBit();if(s<0)return t;for(i<s&&(s=i),s>0&&(t.rShiftTo(s,t),r.rShiftTo(s,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 s>0&&r.lShiftTo(s,r),r},s.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r.data[0]<=A[A.length-1]){for(t=0;t<A.length;++t)if(r.data[0]==A[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<A.length;){for(var n=A[t],i=t+1;i<A.length&&n<C;)n*=A[i++];for(n=r.modInt(n);t<i;)if(n%A[t++]==0)return!1}return r.millerRabin(e)}},84630:(e,t,r)=>{var n=r(37934);e.exports=n.md=n.md||{},n.md.algorithms=n.md.algorithms||{}},66513:(e,t,r)=>{var n=r(37934);r(1225),e.exports=n.mgf=n.mgf||{},n.mgf.mgf1=n.mgf1},1225:(e,t,r)=>{var n=r(37934);r(31330),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,s=Math.ceil(r/e.digestLength),o=0;o<s;o++){var a=new n.util.ByteBuffer;a.putInt32(o),e.start(),e.update(t+a.getBytes()),i.putBuffer(e.digest())}return i.truncate(i.length()-r),i.getBytes()}}}},56661:(e,t,r)=>{var n=r(37934);n.pki=n.pki||{};var i=e.exports=n.pki.oids=n.oids=n.oids||{};function s(e,t){i[e]=t,i[t]=e}function o(e,t){i[e]=t}s("1.2.840.113549.1.1.1","rsaEncryption"),s("1.2.840.113549.1.1.4","md5WithRSAEncryption"),s("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),s("1.2.840.113549.1.1.7","RSAES-OAEP"),s("1.2.840.113549.1.1.8","mgf1"),s("1.2.840.113549.1.1.9","pSpecified"),s("1.2.840.113549.1.1.10","RSASSA-PSS"),s("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),s("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),s("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),s("1.3.101.112","EdDSA25519"),s("1.2.840.10040.4.3","dsa-with-sha1"),s("1.3.14.3.2.7","desCBC"),s("1.3.14.3.2.26","sha1"),s("1.3.14.3.2.29","sha1WithRSASignature"),s("2.16.840.1.101.3.4.2.1","sha256"),s("2.16.840.1.101.3.4.2.2","sha384"),s("2.16.840.1.101.3.4.2.3","sha512"),s("1.2.840.113549.2.5","md5"),s("1.2.840.113549.1.7.1","data"),s("1.2.840.113549.1.7.2","signedData"),s("1.2.840.113549.1.7.3","envelopedData"),s("1.2.840.113549.1.7.4","signedAndEnvelopedData"),s("1.2.840.113549.1.7.5","digestedData"),s("1.2.840.113549.1.7.6","encryptedData"),s("1.2.840.113549.1.9.1","emailAddress"),s("1.2.840.113549.1.9.2","unstructuredName"),s("1.2.840.113549.1.9.3","contentType"),s("1.2.840.113549.1.9.4","messageDigest"),s("1.2.840.113549.1.9.5","signingTime"),s("1.2.840.113549.1.9.6","counterSignature"),s("1.2.840.113549.1.9.7","challengePassword"),s("1.2.840.113549.1.9.8","unstructuredAddress"),s("1.2.840.113549.1.9.14","extensionRequest"),s("1.2.840.113549.1.9.20","friendlyName"),s("1.2.840.113549.1.9.21","localKeyId"),s("1.2.840.113549.1.9.22.1","x509Certificate"),s("1.2.840.113549.1.12.10.1.1","keyBag"),s("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),s("1.2.840.113549.1.12.10.1.3","certBag"),s("1.2.840.113549.1.12.10.1.4","crlBag"),s("1.2.840.113549.1.12.10.1.5","secretBag"),s("1.2.840.113549.1.12.10.1.6","safeContentsBag"),s("1.2.840.113549.1.5.13","pkcs5PBES2"),s("1.2.840.113549.1.5.12","pkcs5PBKDF2"),s("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),s("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),s("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),s("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),s("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),s("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),s("1.2.840.113549.2.7","hmacWithSHA1"),s("1.2.840.113549.2.8","hmacWithSHA224"),s("1.2.840.113549.2.9","hmacWithSHA256"),s("1.2.840.113549.2.10","hmacWithSHA384"),s("1.2.840.113549.2.11","hmacWithSHA512"),s("1.2.840.113549.3.7","des-EDE3-CBC"),s("2.16.840.1.101.3.4.1.2","aes128-CBC"),s("2.16.840.1.101.3.4.1.22","aes192-CBC"),s("2.16.840.1.101.3.4.1.42","aes256-CBC"),s("2.5.4.3","commonName"),s("2.5.4.4","surname"),s("2.5.4.5","serialNumber"),s("2.5.4.6","countryName"),s("2.5.4.7","localityName"),s("2.5.4.8","stateOrProvinceName"),s("2.5.4.9","streetAddress"),s("2.5.4.10","organizationName"),s("2.5.4.11","organizationalUnitName"),s("2.5.4.12","title"),s("2.5.4.13","description"),s("2.5.4.15","businessCategory"),s("2.5.4.17","postalCode"),s("2.5.4.42","givenName"),s("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),s("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),s("2.16.840.1.113730.1.1","nsCertType"),s("2.16.840.1.113730.1.13","nsComment"),o("2.5.29.1","authorityKeyIdentifier"),o("2.5.29.2","keyAttributes"),o("2.5.29.3","certificatePolicies"),o("2.5.29.4","keyUsageRestriction"),o("2.5.29.5","policyMapping"),o("2.5.29.6","subtreesConstraint"),o("2.5.29.7","subjectAltName"),o("2.5.29.8","issuerAltName"),o("2.5.29.9","subjectDirectoryAttributes"),o("2.5.29.10","basicConstraints"),o("2.5.29.11","nameConstraints"),o("2.5.29.12","policyConstraints"),o("2.5.29.13","basicConstraints"),s("2.5.29.14","subjectKeyIdentifier"),s("2.5.29.15","keyUsage"),o("2.5.29.16","privateKeyUsagePeriod"),s("2.5.29.17","subjectAltName"),s("2.5.29.18","issuerAltName"),s("2.5.29.19","basicConstraints"),o("2.5.29.20","cRLNumber"),o("2.5.29.21","cRLReason"),o("2.5.29.22","expirationDate"),o("2.5.29.23","instructionCode"),o("2.5.29.24","invalidityDate"),o("2.5.29.25","cRLDistributionPoints"),o("2.5.29.26","issuingDistributionPoint"),o("2.5.29.27","deltaCRLIndicator"),o("2.5.29.28","issuingDistributionPoint"),o("2.5.29.29","certificateIssuer"),o("2.5.29.30","nameConstraints"),s("2.5.29.31","cRLDistributionPoints"),s("2.5.29.32","certificatePolicies"),o("2.5.29.33","policyMappings"),o("2.5.29.34","policyConstraints"),s("2.5.29.35","authorityKeyIdentifier"),o("2.5.29.36","policyConstraints"),s("2.5.29.37","extKeyUsage"),o("2.5.29.46","freshestCRL"),o("2.5.29.54","inhibitAnyPolicy"),s("1.3.6.1.4.1.11129.2.4.2","timestampList"),s("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),s("1.3.6.1.5.5.7.3.1","serverAuth"),s("1.3.6.1.5.5.7.3.2","clientAuth"),s("1.3.6.1.5.5.7.3.3","codeSigning"),s("1.3.6.1.5.5.7.3.4","emailProtection"),s("1.3.6.1.5.5.7.3.8","timeStamping")},14458:(e,t,r)=>{var n=r(37934);if(r(28085),r(10853),r(96052),r(84630),r(56661),r(4723),r(82232),r(90770),r(73038),r(95791),r(31330),"undefined"===typeof i)var i=n.jsbn.BigInteger;var s=n.asn1,o=n.pki=n.pki||{};e.exports=o.pbe=n.pbe=n.pbe||{};var a=o.oids,c={name:"EncryptedPrivateKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",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:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},u={name:"PBES2Algorithms",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},l={name:"pkcs-12PbeParams",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"iterations"}]};function h(e,t){return e.start().update(t).digest().getBytes()}function d(e){var t;if(e){if(!(t=o.oids[s.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 f(t)}function f(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()}o.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,l=n.random.getBytesSync(r.saltSize),h=r.count,d=s.integerToDer(h);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(S=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,S}var m="hmacWith"+r.prfAlgorithm.toUpperCase(),v=f(m),b=n.pkcs5.pbkdf2(t,l,h,i,v),w=n.random.getBytesSync(p);(_=g(b)).start(w),_.update(s.toDer(e)),_.finish(),u=_.output.getBytes();var E=function(e,t,r,i){var a=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,e),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,t.getBytes())]);"hmacWithSHA1"!==i&&a.value.push(s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,n.util.hexToBytes(r.toString(16))),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(o.oids[i]).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,"")]));return a}(l,d,i,m);c=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(a.pkcs5PBES2).getBytes()),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(a.pkcs5PBKDF2).getBytes()),E]),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(y).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,w)])])])}else{var S;if("3des"!==r.algorithm)throw(S=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,S;i=24;var _,I=new n.util.ByteBuffer(l);b=o.pbe.generatePkcs12Key(t,I,1,h,i),w=o.pbe.generatePkcs12Key(t,I,2,h,i);(_=n.des.createEncryptionCipher(b)).start(w),_.update(s.toDer(e)),_.finish(),u=_.output.getBytes(),c=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(a["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,l),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,d.getBytes())])])}return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[c,s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,u)])},o.decryptPrivateKeyInfo=function(e,t){var r=null,i={},a=[];if(!s.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 l=s.derToOid(i.encryptionOid),h=o.pbe.getCipher(l,i.encryptionParams,t),d=n.util.createBuffer(i.encryptedData);return h.update(d),h.finish()&&(r=s.fromDer(h.output)),r},o.encryptedPrivateKeyToPem=function(e,t){var r={type:"ENCRYPTED PRIVATE KEY",body:s.toDer(e).getBytes()};return n.pem.encode(r,{maxline:t})},o.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 s.fromDer(t.body)},o.encryptRsaPrivateKey=function(e,t,r){if(!(r=r||{}).legacy){var i=o.wrapRsaPrivateKey(o.privateKeyToAsn1(e));return i=o.encryptPrivateKeyInfo(i,t,r),o.encryptedPrivateKeyToPem(i)}var a,c,u,l;switch(r.algorithm){case"aes128":a="AES-128-CBC",u=16,c=n.random.getBytesSync(16),l=n.aes.createEncryptionCipher;break;case"aes192":a="AES-192-CBC",u=24,c=n.random.getBytesSync(16),l=n.aes.createEncryptionCipher;break;case"aes256":a="AES-256-CBC",u=32,c=n.random.getBytesSync(16),l=n.aes.createEncryptionCipher;break;case"3des":a="DES-EDE3-CBC",u=24,c=n.random.getBytesSync(8),l=n.des.createEncryptionCipher;break;case"des":a="DES-CBC",u=8,c=n.random.getBytesSync(8),l=n.des.createEncryptionCipher;break;default:var h=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+r.algorithm+'".');throw h.algorithm=r.algorithm,h}var d=l(n.pbe.opensslDeriveBytes(t,c.substr(0,8),u));d.start(c),d.update(s.toDer(o.privateKeyToAsn1(e))),d.finish();var f={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:a,parameters:n.util.bytesToHex(c).toUpperCase()},body:d.output.getBytes()};return n.pem.encode(f)},o.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 l=n.util.hexToBytes(i.dekInfo.parameters),h=c(n.pbe.opensslDeriveBytes(t,l.substr(0,8),a));if(h.start(l),h.update(n.util.createBuffer(i.body)),!h.finish())return r;r=h.output.getBytes()}else r=i.body;return null!==(r="ENCRYPTED PRIVATE KEY"===i.type?o.decryptPrivateKeyInfo(s.fromDer(r),t):s.fromDer(r))&&(r=o.privateKeyFromAsn1(r)),r},o.pbe.generatePkcs12Key=function(e,t,r,i,s,o){var a,c;if("undefined"===typeof o||null===o){if(!("sha1"in n.md))throw new Error('"sha1" hash algorithm unavailable.');o=n.md.sha1.create()}var u=o.digestLength,l=o.blockLength,h=new n.util.ByteBuffer,d=new n.util.ByteBuffer;if(null!==e&&void 0!==e){for(c=0;c<e.length;c++)d.putInt16(e.charCodeAt(c));d.putInt16(0)}var f=d.length(),p=t.length(),y=new n.util.ByteBuffer;y.fillWithByte(r,l);var g=l*Math.ceil(p/l),m=new n.util.ByteBuffer;for(c=0;c<g;c++)m.putByte(t.at(c%p));var v=l*Math.ceil(f/l),b=new n.util.ByteBuffer;for(c=0;c<v;c++)b.putByte(d.at(c%f));var w=m;w.putBuffer(b);for(var E=Math.ceil(s/u),S=1;S<=E;S++){var _=new n.util.ByteBuffer;_.putBytes(y.bytes()),_.putBytes(w.bytes());for(var I=0;I<i;I++)o.start(),o.update(_.getBytes()),_=o.digest();var T=new n.util.ByteBuffer;for(c=0;c<l;c++)T.putByte(_.at(c%u));var A=Math.ceil(p/l)+Math.ceil(f/l),C=new n.util.ByteBuffer;for(a=0;a<A;a++){var R=new n.util.ByteBuffer(w.getBytes(l)),P=511;for(c=T.length()-1;c>=0;c--)P>>=8,P+=T.at(c)+R.at(c),R.setAt(c,255&P);C.putBuffer(R)}w=C,h.putBuffer(_)}return h.truncate(h.length()-s),h},o.pbe.getCipher=function(e,t,r){switch(e){case o.oids.pkcs5PBES2:return o.pbe.getCipherForPBES2(e,t,r);case o.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case o.oids["pbewithSHAAnd40BitRC2-CBC"]:return o.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}},o.pbe.getCipherForPBES2=function(e,t,r){var i,a={},c=[];if(!s.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=s.derToOid(a.kdfOid))!==o.oids.pkcs5PBKDF2)throw(i=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.")).oid=e,i.supportedOids=["pkcs5PBKDF2"],i;if((e=s.derToOid(a.encOid))!==o.oids["aes128-CBC"]&&e!==o.oids["aes192-CBC"]&&e!==o.oids["aes256-CBC"]&&e!==o.oids["des-EDE3-CBC"]&&e!==o.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 l,h,f=a.kdfSalt,p=n.util.createBuffer(a.kdfIterationCount);switch(p=p.getInt(p.length()<<3),o.oids[e]){case"aes128-CBC":l=16,h=n.aes.createDecryptionCipher;break;case"aes192-CBC":l=24,h=n.aes.createDecryptionCipher;break;case"aes256-CBC":l=32,h=n.aes.createDecryptionCipher;break;case"des-EDE3-CBC":l=24,h=n.des.createDecryptionCipher;break;case"desCBC":l=8,h=n.des.createDecryptionCipher}var y=d(a.prfOid),g=n.pkcs5.pbkdf2(r,f,p,l,y),m=a.encIv,v=h(g);return v.start(m),v},o.pbe.getCipherForPKCS12PBE=function(e,t,r){var i={},a=[];if(!s.validate(t,l,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,h,f=n.util.createBuffer(i.salt),p=n.util.createBuffer(i.iterations);switch(p=p.getInt(p.length()<<3),e){case o.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:c=24,u=8,h=n.des.startDecrypting;break;case o.oids["pbewithSHAAnd40BitRC2-CBC"]:c=5,u=8,h=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=d(i.prfOid),m=o.pbe.generatePkcs12Key(r,f,1,p,c,g);return g.start(),h(m,o.pbe.generatePkcs12Key(r,f,2,p,u,g))},o.pbe.opensslDeriveBytes=function(e,t,r,i){if("undefined"===typeof i||null===i){if(!("md5"in n.md))throw new Error('"md5" hash algorithm unavailable.');i=n.md.md5.create()}null===t&&(t="");for(var s=[h(i,e+t)],o=16,a=1;o<r;++a,o+=16)s.push(h(i,s[a-1]+e+t));return s.join("").substr(0,r)}},4723:(e,t,r)=>{var n=r(30285).Buffer,i=r(37934);r(43156),r(84630),r(31330);var s,o=i.pkcs5=i.pkcs5||{};i.util.isNodejs&&!i.options.usePureJavaScript&&(s=r(71381)),e.exports=i.pbkdf2=o.pbkdf2=function(e,t,r,o,a,c){if("function"===typeof a&&(c=a,a=null),i.util.isNodejs&&!i.options.usePureJavaScript&&s.pbkdf2&&(null===a||"object"!==typeof a)&&(s.pbkdf2Sync.length>4||!a||"sha1"===a))return"string"!==typeof a&&(a="sha1"),e=n.from(e,"binary"),t=n.from(t,"binary"),c?4===s.pbkdf2Sync.length?s.pbkdf2(e,t,r,o,(function(e,t){if(e)return c(e);c(null,t.toString("binary"))})):s.pbkdf2(e,t,r,o,a,(function(e,t){if(e)return c(e);c(null,t.toString("binary"))})):4===s.pbkdf2Sync.length?s.pbkdf2Sync(e,t,r,o).toString("binary"):s.pbkdf2Sync(e,t,r,o,a).toString("binary");if("undefined"!==typeof a&&null!==a||(a="sha1"),"string"===typeof a){if(!(a in i.md.algorithms))throw new Error("Unknown hash algorithm: "+a);a=i.md[a].create()}var u=a.digestLength;if(o>4294967295*u){var l=new Error("Derived key is too long.");if(c)return c(l);throw l}var h=Math.ceil(o/u),d=o-(h-1)*u,f=i.hmac.create();f.start(a,e);var p,y,g,m="";if(!c){for(var v=1;v<=h;++v){f.start(null,null),f.update(t),f.update(i.util.int32ToBytes(v)),p=g=f.digest().getBytes();for(var b=2;b<=r;++b)f.start(null,null),f.update(g),y=f.digest().getBytes(),p=i.util.xorBytes(p,y,u),g=y;m+=v<h?p:p.substr(0,d)}return m}v=1;function w(){if(v>h)return c(null,m);f.start(null,null),f.update(t),f.update(i.util.int32ToBytes(v)),p=g=f.digest().getBytes(),b=2,E()}function E(){if(b<=r)return f.start(null,null),f.update(g),y=f.digest().getBytes(),p=i.util.xorBytes(p,y,u),g=y,++b,i.util.setImmediate(E);m+=v<h?p:p.substr(0,d),++v,w()}w()}},82232:(e,t,r)=>{var n=r(37934);r(31330);var i=e.exports=n.pem=n.pem||{};function s(e){for(var t=e.name+": ",r=[],n=function(e,t){return" "+t},i=0;i<e.values.length;++i)r.push(e.values[i].replace(/^(\S+\r\n)/,n));t+=r.join(",")+"\r\n";var s=0,o=-1;for(i=0;i<t.length;++i,++s)if(s>65&&-1!==o){var a=t[o];","===a?(++o,t=t.substr(0,o)+"\r\n "+t.substr(o)):t=t.substr(0,o)+"\r\n"+a+t.substr(o+1),s=i-o-1,o=-1,++i}else" "!==t[i]&&"\t"!==t[i]&&","!==t[i]||(o=i);return t}function o(e){return e.replace(/^\s+/,"")}i.encode=function(e,t){t=t||{};var r,i="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(i+=s(r={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]})),e.contentDomain&&(i+=s(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+=s(r)),e.headers)for(var o=0;o<e.headers.length;++o)i+=s(e.headers[o]);return e.procType&&(i+="\r\n"),i+=n.util.encode64(e.body,t.maxline||64)+"\r\n",i+="-----END "+e.type+"-----\r\n"},i.decode=function(e){for(var t,r=[],i=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,s=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,a=/\r?\n/;t=i.exec(e);){var c=t[1];"NEW CERTIFICATE REQUEST"===c&&(c="CERTIFICATE REQUEST");var u={type:c,procType:null,contentDomain:null,dekInfo:null,headers:[],body:n.util.decode64(t[3])};if(r.push(u),t[2]){for(var l=t[2].split(a),h=0;t&&h<l.length;){for(var d=l[h].replace(/\s+$/,""),f=h+1;f<l.length;++f){var p=l[f];if(!/\s/.test(p[0]))break;d+=p,h=f}if(t=d.match(s)){for(var y={name:t[1],values:[]},g=t[2].split(","),m=0;m<g.length;++m)y.values.push(o(g[m]));if(u.procType)if(u.contentDomain||"Content-Domain"!==y.name)if(u.dekInfo||"DEK-Info"!==y.name)u.headers.push(y);else{if(0===y.values.length)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');u.dekInfo={algorithm:g[0],parameters:g[1]||null}}else u.contentDomain=g[0]||"";else{if("Proc-Type"!==y.name)throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==y.values.length)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');u.procType={version:g[0],type:g[1]}}}++h}if("ENCRYPTED"===u.procType&&!u.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(0===r.length)throw new Error("Invalid PEM formatted message.");return r}},38844:(e,t,r)=>{var n=r(37934);r(31330),r(90770),r(11715);var i=e.exports=n.pkcs1=n.pkcs1||{};function s(e,t,r){r||(r=n.md.sha1.create());for(var i="",s=Math.ceil(t/r.digestLength),o=0;o<s;++o){var a=String.fromCharCode(o>>24&255,o>>16&255,o>>8&255,255&o);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,o,a,c;"string"===typeof r?(i=r,o=arguments[3]||void 0,a=arguments[4]||void 0):r&&(i=r.label||void 0,o=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),l=u-2*a.digestLength-2;if(t.length>l)throw(g=new Error("RSAES-OAEP input message length is too long.")).length=t.length,g.maxLength=l,g;i||(i=""),a.update(i,"raw");for(var h=a.digest(),d="",f=l-t.length,p=0;p<f;p++)d+="\0";var y=h.getBytes()+d+"\x01"+t;if(o){if(o.length!==a.digestLength){var g;throw(g=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.")).seedLength=o.length,g.digestLength=a.digestLength,g}}else o=n.random.getBytes(a.digestLength);var m=s(o,u-a.digestLength-1,c),v=n.util.xorBytes(y,m,y.length),b=s(v,a.digestLength,c),w=n.util.xorBytes(o,b,o.length);return"\0"+w+v},i.decode_rsa_oaep=function(e,t,r){var i,o,a;"string"===typeof r?(i=r,o=arguments[3]||void 0):r&&(i=r.label||void 0,o=r.md||void 0,r.mgf1&&r.mgf1.md&&(a=r.mgf1.md));var c=Math.ceil(e.n.bitLength()/8);if(t.length!==c)throw(v=new Error("RSAES-OAEP encoded message length is invalid.")).length=t.length,v.expectedLength=c,v;if(void 0===o?o=n.md.sha1.create():o.start(),a||(a=o),c<2*o.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");i||(i=""),o.update(i,"raw");for(var u=o.digest().getBytes(),l=t.charAt(0),h=t.substring(1,o.digestLength+1),d=t.substring(1+o.digestLength),f=s(d,o.digestLength,a),p=n.util.xorBytes(h,f,h.length),y=s(p,c-o.digestLength-1,a),g=n.util.xorBytes(d,y,d.length),m=g.substring(0,o.digestLength),v="\0"!==l,b=0;b<o.digestLength;++b)v|=u.charAt(b)!==m.charAt(b);for(var w=1,E=o.digestLength,S=o.digestLength;S<g.length;S++){var _=g.charCodeAt(S),I=1&_^1,T=w?65534:0;v|=_&T,E+=w&=I}if(v||1!==g.charCodeAt(E))throw new Error("Invalid RSAES-OAEP padding.");return g.substring(E+1)}},60322:(e,t,r)=>{var n=r(37934);r(28085),r(10853),r(96052),r(56661),r(82232),r(15758),r(90770),r(31330),r(87141);var i=n.asn1,s=e.exports=n.pkcs7=n.pkcs7||{};function o(e){var t={},r=[];if(!i.validate(e,s.asn1.recipientInfoValidator,t,r)){var o=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw o.errors=r,o}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?t.encParameter.value:void 0,content:t.encKey}}}function a(e){for(var t,r=[],s=0;s<e.length;++s)r.push((t=e[s],i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(t.version).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[n.pki.distinguishedNameToAsn1({attributes:t.issuer}),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,n.util.hexToBytes(t.serialNumber))]),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.encryptedContent.algorithm).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")]),i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,t.encryptedContent.content)])));return r}function c(e){var t=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[n.pki.distinguishedNameToAsn1({attributes:e.issuer}),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,n.util.hexToBytes(e.serialNumber))]),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.digestAlgorithm).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")])]);if(e.authenticatedAttributesAsn1&&t.value.push(e.authenticatedAttributesAsn1),t.value.push(i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.signatureAlgorithm).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")])),t.value.push(i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,e.signature)),e.unauthenticatedAttributes.length>0){for(var r=i.create(i.Class.CONTEXT_SPECIFIC,1,!0,[]),s=0;s<e.unauthenticatedAttributes.length;++s){var o=e.unauthenticatedAttributes[s];r.values.push(u(o))}t.value.push(r)}return t}function u(e){var t;if(e.type===n.pki.oids.contentType)t=i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.value).getBytes());else if(e.type===n.pki.oids.messageDigest)t=i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,e.value.bytes());else if(e.type===n.pki.oids.signingTime){var r=new Date("1950-01-01T00:00:00Z"),s=new Date("2050-01-01T00:00:00Z"),o=e.value;if("string"===typeof o){var a=Date.parse(o);o=isNaN(a)?13===o.length?i.utcTimeToDate(o):i.generalizedTimeToDate(o):new Date(a)}t=o>=r&&o<s?i.create(i.Class.UNIVERSAL,i.Type.UTCTIME,!1,i.dateToUtcTime(o)):i.create(i.Class.UNIVERSAL,i.Type.GENERALIZEDTIME,!1,i.dateToGeneralizedTime(o))}return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.type).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SET,!0,[t])])}function l(e,t,r){var s={};if(!i.validate(t,r,s,[])){var o=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw o.errors=o,o}if(i.derToOid(s.contentType)!==n.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(s.encryptedContent){var a="";if(n.util.isArray(s.encryptedContent))for(var c=0;c<s.encryptedContent.length;++c){if(s.encryptedContent[c].type!==i.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");a+=s.encryptedContent[c].value}else a=s.encryptedContent;e.encryptedContent={algorithm:i.derToOid(s.encAlgorithm),parameter:n.util.createBuffer(s.encParameter.value),content:n.util.createBuffer(a)}}if(s.content){a="";if(n.util.isArray(s.content))for(c=0;c<s.content.length;++c){if(s.content[c].type!==i.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");a+=s.content[c].value}else a=s.content;e.content=n.util.createBuffer(a)}return e.version=s.version.charCodeAt(0),e.rawCapture=s,s}function h(e){if(void 0===e.encryptedContent.key)throw new Error("Symmetric key not available.");if(void 0===e.content){var t;switch(e.encryptedContent.algorithm){case n.pki.oids["aes128-CBC"]:case n.pki.oids["aes192-CBC"]:case n.pki.oids["aes256-CBC"]:t=n.aes.createDecryptionCipher(e.encryptedContent.key);break;case n.pki.oids.desCBC:case n.pki.oids["des-EDE3-CBC"]:t=n.des.createDecryptionCipher(e.encryptedContent.key);break;default:throw new Error("Unsupported symmetric cipher, OID "+e.encryptedContent.algorithm)}if(t.start(e.encryptedContent.parameter),t.update(e.encryptedContent.content),!t.finish())throw new Error("Symmetric decryption failed.");e.content=t.output}}s.messageFromPem=function(e){var t=n.pem.decode(e)[0];if("PKCS7"!==t.type){var r=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var o=i.fromDer(t.body);return s.messageFromAsn1(o)},s.messageToPem=function(e,t){var r={type:"PKCS7",body:i.toDer(e.toAsn1()).getBytes()};return n.pem.encode(r,{maxline:t})},s.messageFromAsn1=function(e){var t={},r=[];if(!i.validate(e,s.asn1.contentInfoValidator,t,r)){var o=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw o.errors=r,o}var a,c=i.derToOid(t.contentType);switch(c){case n.pki.oids.envelopedData:a=s.createEnvelopedData();break;case n.pki.oids.encryptedData:a=s.createEncryptedData();break;case n.pki.oids.signedData:a=s.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+c+" is not (yet) supported.")}return a.fromAsn1(t.content.value[0]),a},s.createSignedData=function(){var e=null;return e={type:n.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(t){if(l(e,t,s.asn1.signedDataValidator),e.certificates=[],e.crls=[],e.digestAlgorithmIdentifiers=[],e.contentInfo=null,e.signerInfos=[],e.rawCapture.certificates)for(var r=e.rawCapture.certificates.value,i=0;i<r.length;++i)e.certificates.push(n.pki.certificateFromAsn1(r[i]))},toAsn1:function(){e.contentInfo||e.sign();for(var t=[],r=0;r<e.certificates.length;++r)t.push(n.pki.certificateToAsn1(e.certificates[r]));var s=[],o=i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SET,!0,e.digestAlgorithmIdentifiers),e.contentInfo])]);return t.length>0&&o.value[0].value.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,t)),s.length>0&&o.value[0].value.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,s)),o.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()),o])},addSigner:function(t){var r=t.issuer,i=t.serialNumber;if(t.certificate){var s=t.certificate;"string"===typeof s&&(s=n.pki.certificateFromPem(s)),r=s.issuer.attributes,i=s.serialNumber}var o=t.key;if(!o)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"===typeof o&&(o=n.pki.privateKeyFromPem(o));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,l=!1,h=0;h<c.length;++h){var d=c[h];if(u||d.type!==n.pki.oids.contentType){if(l||d.type!==n.pki.oids.messageDigest);else if(l=!0,u)break}else if(u=!0,l)break}if(!u||!l)throw new Error("Invalid signer.authenticatedAttributes. If signer.authenticatedAttributes is specified, then it must contain at least two attributes, PKCS #9 content-type and PKCS #9 message-digest.")}e.signers.push({key:o,version:1,issuer:r,serialNumber:i,digestAlgorithm:a,signatureAlgorithm:n.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:c,unauthenticatedAttributes:[]})},sign:function(t){var r;(t=t||{},"object"!==typeof e.content||null===e.contentInfo)&&(e.contentInfo=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(n.pki.oids.data).getBytes())]),"content"in e&&(e.content instanceof n.util.ByteBuffer?r=e.content.bytes():"string"===typeof e.content&&(r=n.util.encodeUtf8(e.content)),t.detached?e.detachedContent=i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,r):e.contentInfo.value.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,r)]))));0!==e.signers.length&&function(t){var r;r=e.detachedContent?e.detachedContent:(r=e.contentInfo.value[1]).value[0];if(!r)throw new Error("Could not sign PKCS#7 message; there is no content to sign.");var s=i.derToOid(e.contentInfo.value[0].value),o=i.toDer(r);for(var a in o.getByte(),i.getBerValueLength(o),o=o.getBytes(),t)t[a].start().update(o);for(var l=new Date,h=0;h<e.signers.length;++h){var d=e.signers[h];if(0===d.authenticatedAttributes.length){if(s!==n.pki.oids.data)throw new Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{d.authenticatedAttributesAsn1=i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var f=i.create(i.Class.UNIVERSAL,i.Type.SET,!0,[]),p=0;p<d.authenticatedAttributes.length;++p){var y=d.authenticatedAttributes[p];y.type===n.pki.oids.messageDigest?y.value=t[d.digestAlgorithm].digest():y.type===n.pki.oids.signingTime&&(y.value||(y.value=l)),f.value.push(u(y)),d.authenticatedAttributesAsn1.value.push(u(y))}o=i.toDer(f).getBytes(),d.md.start().update(o)}d.signature=d.key.sign(d.md,"RSASSA-PKCS1-V1_5")}e.signerInfos=function(e){for(var t=[],r=0;r<e.length;++r)t.push(c(e[r]));return t}(e.signers)}(function(){for(var t={},r=0;r<e.signers.length;++r){var s=e.signers[r];(o=s.digestAlgorithm)in t||(t[o]=n.md[n.pki.oids[o]].create()),0===s.authenticatedAttributes.length?s.md=t[o]:s.md=n.md[n.pki.oids[o]].create()}for(var o in e.digestAlgorithmIdentifiers=[],t)e.digestAlgorithmIdentifiers.push(i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(o).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")]));return t}())},verify:function(){throw new Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(t){"string"===typeof t&&(t=n.pki.certificateFromPem(t)),e.certificates.push(t)},addCertificateRevokationList:function(e){throw new Error("PKCS#7 CRL support not yet implemented.")}}},s.createEncryptedData=function(){var e=null;return e={type:n.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:n.pki.oids["aes256-CBC"]},fromAsn1:function(t){l(e,t,s.asn1.encryptedDataValidator)},decrypt:function(t){void 0!==t&&(e.encryptedContent.key=t),h(e)}}},s.createEnvelopedData=function(){var e=null;return e={type:n.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:n.pki.oids["aes256-CBC"]},fromAsn1:function(t){var r=l(e,t,s.asn1.envelopedDataValidator);e.recipients=function(e){for(var t=[],r=0;r<e.length;++r)t.push(o(e[r]));return t}(r.recipientInfos.value)},toAsn1:function(){return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.type).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SET,!0,a(e.recipients)),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,(t=e.encryptedContent,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(n.pki.oids.data).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.algorithm).getBytes()),t.parameter?i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,t.parameter.getBytes()):void 0]),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,t.content.getBytes())])]))])])]);var t},findRecipient:function(t){for(var r=t.issuer.attributes,n=0;n<e.recipients.length;++n){var i=e.recipients[n],s=i.issuer;if(i.serialNumber===t.serialNumber&&s.length===r.length){for(var o=!0,a=0;a<r.length;++a)if(s[a].type!==r[a].type||s[a].value!==r[a].value){o=!1;break}if(o)return i}}return null},decrypt:function(t,r){if(void 0===e.encryptedContent.key&&void 0!==t&&void 0!==r)switch(t.encryptedContent.algorithm){case n.pki.oids.rsaEncryption:case n.pki.oids.desCBC:var i=r.decrypt(t.encryptedContent.content);e.encryptedContent.key=n.util.createBuffer(i);break;default:throw new Error("Unsupported asymmetric cipher, OID "+t.encryptedContent.algorithm)}h(e)},addRecipient:function(t){e.recipients.push({version:0,issuer:t.issuer.attributes,serialNumber:t.serialNumber,encryptedContent:{algorithm:n.pki.oids.rsaEncryption,key:t.publicKey}})},encrypt:function(t,r){if(void 0===e.encryptedContent.content){var i,s,o;switch(r=r||e.encryptedContent.algorithm,t=t||e.encryptedContent.key,r){case n.pki.oids["aes128-CBC"]:i=16,s=16,o=n.aes.createEncryptionCipher;break;case n.pki.oids["aes192-CBC"]:i=24,s=16,o=n.aes.createEncryptionCipher;break;case n.pki.oids["aes256-CBC"]:i=32,s=16,o=n.aes.createEncryptionCipher;break;case n.pki.oids["des-EDE3-CBC"]:i=24,s=8,o=n.des.createEncryptionCipher;break;default:throw new Error("Unsupported symmetric cipher, OID "+r)}if(void 0===t)t=n.util.createBuffer(n.random.getBytes(i));else if(t.length()!=i)throw new Error("Symmetric key has wrong length; got "+t.length()+" bytes, expected "+i+".");e.encryptedContent.algorithm=r,e.encryptedContent.key=t,e.encryptedContent.parameter=n.util.createBuffer(n.random.getBytes(s));var a=o(t);if(a.start(e.encryptedContent.parameter.copy()),a.update(e.content),!a.finish())throw new Error("Symmetric encryption failed.");e.encryptedContent.content=a.output}for(var c=0;c<e.recipients.length;++c){var u=e.recipients[c];if(void 0===u.encryptedContent.content){if(u.encryptedContent.algorithm!==n.pki.oids.rsaEncryption)throw new Error("Unsupported asymmetric cipher, OID "+u.encryptedContent.algorithm);u.encryptedContent.content=u.encryptedContent.key.encrypt(e.encryptedContent.key.data)}}}}}},15758:(e,t,r)=>{var n=r(37934);r(10853),r(31330);var i=n.asn1,s=e.exports=n.pkcs7asn1=n.pkcs7asn1||{};n.pkcs7=n.pkcs7||{},n.pkcs7.asn1=s;var o={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"}]};s.contentInfoValidator=o;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"}]};s.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)},s.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"}]};s.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"},o,{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]}]},s.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",optional:!0}]},{name:"RecipientInfo.encryptedKey",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}},6779:(e,t,r)=>{var n=r(37934);r(31330),r(78808),r(90770),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],s=new r(null);s.fromInt(30);var o=function(e,t){return e|t};t.generateProbablePrime=function(e,t,i){"function"===typeof t&&(i=t,t={});var s=(t=t||{}).algorithm||"PRIMEINC";"string"===typeof s&&(s={name:s}),s.options=s.options||{};var o=t.prng||n.random,c={nextBytes:function(e){for(var t=o.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}};if("PRIMEINC"===s.name)return function(e,t,i,s){if("workers"in i)return function(e,t,i,s){if("undefined"===typeof Worker)return a(e,t,i,s);var o=u(e,t),c=i.workers,l=i.workLoad||100,h=30*l/8,d=i.workerScript||"forge/prime.worker.js";if(-1===c)return n.util.estimateCores((function(e,t){e&&(t=2),c=t-1,f()}));function f(){c=Math.max(1,c);for(var n=[],i=0;i<c;++i)n[i]=new Worker(d);for(i=0;i<c;++i)n[i].addEventListener("message",f);var a=!1;function f(i){if(!a){0;var c=i.data;if(c.found){for(var d=0;d<n.length;++d)n[d].terminate();return a=!0,s(null,new r(c.prime,16))}o.bitLength()>e&&(o=u(e,t));var f=o.toString(16);i.target.postMessage({hex:f,workLoad:l}),o.dAddOffset(h,0)}}}f()}(e,t,i,s);return a(e,t,i,s)}(e,c,s.options,i);throw new Error("Invalid prime generation algorithm: "+s.name)}}function a(e,t,r,n){var i=u(e,t),s=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&&(s=r.millerRabinTests);var o=10;"maxBlockTime"in r&&(o=r.maxBlockTime),c(i,e,t,0,s,o,n)}function c(e,t,r,s,o,a,l){var h=+new Date;do{if(e.bitLength()>t&&(e=u(t,r)),e.isProbablePrime(o))return l(null,e);e.dAddOffset(i[s++%8],0)}while(a<0||+new Date-h<a);n.util.setImmediate((function(){c(e,t,r,s,o,a,l)}))}function u(e,t){var n=new r(e,t),i=e-1;return n.testBit(i)||n.bitwiseTo(r.ONE.shiftLeft(i),o,n),n.dAddOffset(31-n.mod(s).byteValue(),0),n}}()},20784:(e,t,r)=>{var n=r(21964),i=r(37934);r(31330);var s=null;!i.util.isNodejs||i.options.usePureJavaScript||n.versions["node-webkit"]||(s=r(71381)),(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),o=0;o<32;++o)n[o]=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 s=i.util.createBuffer();if(t)for(;s.length()<e;){var o=Math.max(1,Math.min(e-s.length(),65536)/4),a=new Uint32Array(Math.floor(o));try{t(a);for(var c=0;c<a.length;++c)s.putInt32(a[c])}catch(f){if(!("undefined"!==typeof QuotaExceededError&&f instanceof QuotaExceededError))throw f}}if(s.length()<e)for(var u,l,h,d=Math.floor(65536*Math.random());s.length()<e;){l=16807*(65535&d),l+=(32767&(u=16807*(d>>16)))<<16,d=4294967295&(l=(2147483647&(l+=u>>15))+(l>>31));for(c=0;c<3;++c)h=d>>>(c<<3),h^=Math.floor(256*Math.random()),s.putByte(255&h)}return s.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,s=t.plugin.increment,o=t.plugin.formatKey,a=t.plugin.formatSeed,u=i.util.createBuffer();t.key=null,function l(h){if(h)return r(h);if(u.length()>=e)return r(null,u.getBytes(e));t.generated>1048575&&(t.key=null);if(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()}))}(l)}));var d=n(t.key,t.seed);t.generated+=d.length,u.putBytes(d),t.key=o(n(t.key,s(t.seed))),t.seed=a(n(t.key,t.seed)),i.util.setImmediate(l)}()},t.generateSync=function(e){var r=t.plugin.cipher,n=t.plugin.increment,s=t.plugin.formatKey,o=t.plugin.formatSeed;t.key=null;for(var c=i.util.createBuffer();c.length()<e;){t.generated>1048575&&(t.key=null),null===t.key&&a();var u=r(t.key,t.seed);t.generated+=u.length,c.putBytes(u),t.key=s(r(t.key,n(t.seed))),t.seed=o(r(t.key,t.seed))}return c.getBytes(e)},s?(t.seedFile=function(e,t){s.randomBytes(e,(function(e,r){if(e)return t(e);t(null,r.toString())}))},t.seedFileSync=function(e){return s.randomBytes(e).toString()}):(t.seedFile=function(e,t){try{t(null,u(e))}catch(r){t(r)}},t.seedFileSync=u),t.collect=function(e){for(var r=e.length,n=0;n<r;++n)t.pools[t.pool].update(e.substr(n,1)),t.pool=31===t.pool?0:t.pool+1},t.collectInt=function(e,r){for(var n="",i=0;i<r;i+=8)n+=String.fromCharCode(e>>i&255);t.collect(n)},t.registerWorker=function(e){if(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}}})};else{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}},95884:(e,t,r)=>{var n=r(37934);r(90770),r(31330),(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,s=r.digestLength,o=e.salt||null;if("string"===typeof o&&(o=n.util.createBuffer(o)),"saltLength"in e)t=e.saltLength;else{if(null===o)throw new Error("Salt length not specified or specific salt not given.");t=o.length()}if(null!==o&&o.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,l,h=c-1,d=Math.ceil(h/8),f=e.digest().getBytes();if(d<s+t+2)throw new Error("Message is too long to encrypt.");l=null===o?a.getBytesSync(t):o.bytes();var p=new n.util.ByteBuffer;p.fillWithByte(0,8),p.putBytes(f),p.putBytes(l),r.start(),r.update(p.getBytes());var y=r.digest().getBytes(),g=new n.util.ByteBuffer;g.fillWithByte(0,d-t-s-2),g.putByte(1),g.putBytes(l);var m=g.getBytes(),v=d-s-1,b=i.generate(y,v),w="";for(u=0;u<v;u++)w+=String.fromCharCode(m.charCodeAt(u)^b.charCodeAt(u));var E=65280>>8*d-h&255;return(w=String.fromCharCode(w.charCodeAt(0)&~E)+w.substr(1))+y+String.fromCharCode(188)},verify:function(e,o,a){var c,u=a-1,l=Math.ceil(u/8);if(o=o.substr(-l),l<s+t+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(188!==o.charCodeAt(l-1))throw new Error("Encoded message does not end in 0xBC.");var h=l-s-1,d=o.substr(0,h),f=o.substr(h,s),p=65280>>8*l-u&255;if(0!==(d.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var y=i.generate(f,h),g="";for(c=0;c<h;c++)g+=String.fromCharCode(d.charCodeAt(c)^y.charCodeAt(c));g=String.fromCharCode(g.charCodeAt(0)&~p)+g.substr(1);var m=l-s-t-2;for(c=0;c<m;c++)if(0!==g.charCodeAt(c))throw new Error("Leftmost octets not zero as expected");if(1!==g.charCodeAt(m))throw new Error("Inconsistent PSS signature, 0x01 marker not found");var v=g.substr(-t),b=new n.util.ByteBuffer;return b.fillWithByte(0,8),b.putBytes(e),b.putBytes(v),r.start(),r.update(b.getBytes()),f===r.digest().getBytes()}};return c}},90770:(e,t,r)=>{var n=r(37934);r(28085),r(25455),r(20784),r(31330),n.random&&n.random.getBytes?e.exports=n.random:function(t){var r={},i=new Array(4),s=n.util.createBuffer();function o(){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),s.putInt32(i[0]),s.putInt32(i[1]),s.putInt32(i[2]),s.putInt32(i[3]),s.getBytes()},r.increment=function(e){return++e[3],e},r.md=n.md.sha256;var a=o(),c=null,u=n.util.globalScope,l=u.crypto||u.msCrypto;if(l&&l.getRandomValues&&(c=function(e){return l.getRandomValues(e)}),n.options.usePureJavaScript||!n.util.isNodejs&&!c){if("undefined"===typeof window||window.document,a.collectInt(+new Date,32),"undefined"!==typeof navigator){var h="";for(var d in navigator)try{"string"==typeof navigator[d]&&(h+=navigator[d])}catch(f){}a.collect(h),h=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 d in a)n.random[d]=a[d];else n.random=a;n.random.createInstance=o,e.exports=n.random}("undefined"!==typeof jQuery?jQuery:null)},73038:(e,t,r)=>{var n=r(37934);r(31330);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],s=[1,2,3,5],o=function(e,t){return e<<t&65535|(65535&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,s=e,o=e.length(),a=t,c=Math.ceil(a/8),u=255>>(7&a);for(r=o;r<128;r++)s.putByte(i[s.at(r-1)+s.at(r-o)&255]);for(s.setAt(128-c,i[s.at(128-c)&u]),r=127-c;r>=0;r--)s.setAt(r,i[s.at(r+1)^s.at(r+c)]);return s};var c=function(e,t,r){var i,c,u,l,h=!1,d=null,f=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[l]+(e[(u+3)%4]&e[(u+2)%4])+(~e[(u+3)%4]&e[(u+1)%4]),e[u]=o(e[u],s[u]),l++},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],s[u]),e[u]-=y[l]+(e[(u+3)%4]&e[(u+2)%4])+(~e[(u+3)%4]&e[(u+1)%4]),l--},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=d.getInt16Le();null!==p&&(r?n^=p.getInt16Le():p.putInt16Le(n)),t.push(65535&n)}l=r?0:63;for(var i=0;i<e.length;i++)for(var s=0;s<e[i][0];s++)e[i][1](t);for(u=0;u<4;u++)null!==p&&(r?p.putInt16Le(t[u]):t[u]^=p.getInt16Le()),f.putInt16Le(t[u])},m=null;return m={start:function(e,t){e&&"string"===typeof e&&(e=n.util.createBuffer(e)),h=!1,d=n.util.createBuffer(),f=t||new n.util.createBuffer,p=e,m.output=f},update:function(e){for(h||d.putBuffer(e);d.length()>=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,d,!r);else{var n=8===d.length()?8:8-d.length();d.fillWithByte(n,n)}if(t&&(h=!0,m.update()),!r&&(t=0===d.length()))if(e)t=e(8,f,!r);else{var i=f.length(),s=f.at(i-1);s>i?t=!1:f.truncate(s)}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)}},95791:(e,t,r)=>{var n=r(37934);if(r(10853),r(78808),r(56661),r(38844),r(6779),r(90770),r(31330),"undefined"===typeof i)var i=n.jsbn.BigInteger;var s=n.util.isNodejs?r(71381):null,o=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],l={name:"PrivateKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",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:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},h={name:"RSAPrivateKey",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},d={name:"RSAPublicKey",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},f=n.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",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:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:o.Class.UNIVERSAL,type:o.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:o.Class.UNIVERSAL,type:o.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=o.oidToDer(t).getBytes(),i=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[]),s=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[]);s.value.push(o.create(o.Class.UNIVERSAL,o.Type.OID,!1,n)),s.value.push(o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,""));var a=o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,e.digest().getBytes());return i.value.push(s),i.value.push(a),o.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 s;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{s=new i(n.util.bytesToHex(n.random.getBytes(t.n.bitLength()/8)),16)}while(s.compareTo(t.n)>=0||!s.gcd(t.n).equals(i.ONE));for(var o=(e=e.multiply(s.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);o.compareTo(a)<0;)o=o.add(t.p);var c=o.subtract(a).multiply(t.qInv).mod(t.p).multiply(t.q).add(a);return c=c.multiply(s.modInverse(t.n)).mod(t.n)};function g(e,t,r){var i=n.util.createBuffer(),s=Math.ceil(t.n.bitLength()/8);if(e.length>s-11){var o=new Error("Message is too long for PKCS#1 v1.5 padding.");throw o.length=e.length,o.max=s-11,o}i.putByte(0),i.putByte(r);var a,c=s-3-e.length;if(0===r||1===r){a=0===r?0:255;for(var u=0;u<c;++u)i.putByte(a)}else for(;c>0;){var l=0,h=n.random.getBytes(c);for(u=0;u<c;++u)0===(a=h.charCodeAt(u))?++l:i.putByte(a);c=l}return i.putByte(0),i.putBytes(e),i}function m(e,t,r,i){var s=Math.ceil(t.n.bitLength()/8),o=n.util.createBuffer(e),a=o.getByte(),c=o.getByte();if(0!==a||r&&0!==c&&1!==c||!r&&2!=c||r&&0===c&&"undefined"===typeof i)throw new Error("Encryption block is invalid.");var u=0;if(0===c){u=s-3-i;for(var l=0;l<u;++l)if(0!==o.getByte())throw new Error("Encryption block is invalid.")}else if(1===c)for(u=0;o.length()>1;){if(255!==o.getByte()){--o.read;break}++u}else if(2===c)for(u=0;o.length()>1;){if(0===o.getByte()){--o.read;break}++u}if(0!==o.getByte()||u!==s-3-o.length())throw new Error("Encryption block is invalid.");return o.getBytes()}function v(e,t,r){"function"===typeof t&&(r=t,t={});var s={algorithm:{name:(t=t||{}).algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};function o(){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,s,t)}function u(t,n){if(t)return r(t);if(e.q=n,e.p.compareTo(e.q)<0){var s=e.p;e.p=e.q,e.q=s}if(0!==e.p.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.p=null,void o();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 o();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void a(e.qBits,u);var l=e.e.modInverse(e.phi);e.keys={privateKey:c.rsa.setPrivateKey(e.n,e.e,l,e.p,e.q,l.mod(e.p1),l.mod(e.q1),e.q.modInverse(e.p)),publicKey:c.rsa.setPublicKey(e.n,e.e)},r(null,e.keys)}"prng"in t&&(s.prng=t.prng),o()}function b(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 s[e]}function S(e){return"undefined"!==typeof a.globalScope&&"object"===typeof a.globalScope.crypto&&"object"===typeof a.globalScope.crypto.subtle&&"function"===typeof a.globalScope.crypto.subtle[e]}function _(e){return"undefined"!==typeof a.globalScope&&"object"===typeof a.globalScope.msCrypto&&"object"===typeof a.globalScope.msCrypto.subtle&&"function"===typeof a.globalScope.msCrypto.subtle[e]}function I(e){for(var t=n.util.hexToBytes(e.toString(16)),r=new Uint8Array(t.length),i=0;i<t.length;++i)r[i]=t.charCodeAt(i);return r}c.rsa.encrypt=function(e,t,r){var s,o=r,a=Math.ceil(t.n.bitLength()/8);!1!==r&&!0!==r?(o=2===r,s=g(e,t,r)):(s=n.util.createBuffer()).putBytes(e);for(var c=new i(s.toHex(),16),u=y(c,t,o).toString(16),l=n.util.createBuffer(),h=a-Math.ceil(u.length/2);h>0;)l.putByte(0),--h;return l.putBytes(n.util.hexToBytes(u)),l.getBytes()},c.rsa.decrypt=function(e,t,r,s){var o=Math.ceil(t.n.bitLength()/8);if(e.length!==o){var a=new Error("Encrypted message length is invalid.");throw a.length=e.length,a.expected=o,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),l=n.util.createBuffer(),h=o-Math.ceil(u.length/2);h>0;)l.putByte(0),--h;return l.putBytes(n.util.hexToBytes(u)),!1!==s?m(l.getBytes(),t,r):l.getBytes()},c.rsa.createKeyPairGenerationState=function(e,t,r){"string"===typeof e&&(e=parseInt(e,10)),e=e||2048;var s,o=(r=r||{}).prng||n.random,a={nextBytes:function(e){for(var t=o.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}},c=r.algorithm||"PRIMEINC";if("PRIMEINC"!==c)throw new Error("Invalid key generation algorithm: "+c);return(s={algorithm:c,state:0,bits:e,rng:a,eInt:t||65537,e:new i(null),p:null,q:null,qBits:e>>1,pBits:e-(e>>1),pqState:0,num:null,keys:null}).e.fromInt(s.eInt),s},c.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var r=new i(null);r.fromInt(30);for(var n,s=0,o=function(e,t){return e|t},a=+new Date,l=0;null===e.keys&&(t<=0||l<t);){if(0===e.state){var h=null===e.p?e.pBits:e.qBits,d=h-1;0===e.pqState?(e.num=new i(h,e.rng),e.num.testBit(d)||e.num.bitwiseTo(i.ONE.shiftLeft(d),o,e.num),e.num.dAddOffset(31-e.num.mod(r).byteValue(),0),s=0,++e.pqState):1===e.pqState?e.num.bitLength()>h?e.pqState=0:e.num.isProbablePrime(w(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(u[s++%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 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)}}l+=(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 s.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(S("generateKey")&&S("exportKey"))return a.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:I(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(o.fromDer(n.util.createBuffer(e)));i(null,{privateKey:t,publicKey:c.setRsaPublicKey(t.n,t.e)})}}));if(_("generateKey")&&_("exportKey")){var u=a.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:I(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(o.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 l=s.generateKeyPairSync("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:c.privateKeyFromPem(l.privateKey),publicKey:c.publicKeyFromPem(l.publicKey)}}var h=c.rsa.createKeyPairGenerationState(e,t,r);if(!i)return c.rsa.stepKeyPairGenerationState(h,0),h.keys;v(h,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 s=t.encode(e,r,!0);return c.rsa.encrypt(s,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=m(t,r,!0),e===o.fromDer(t).value[1].value}}:"NONE"!==n&&"NULL"!==n&&null!==n||(n={verify:function(e,t){return e===(t=m(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,s,o,a,u){var l={n:e,e:t,d:r,p:i,q:s,dP:o,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,l,!1,!1);if("RSAES-PKCS1-V1_5"===t)t={decode:m};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,l,!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,l.n.bitLength());return c.rsa.encrypt(n,l,r)}};return l},c.wrapRsaPrivateKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,o.integerToDer(0).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(c.oids.rsaEncryption).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]),o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,o.toDer(e).getBytes())])},c.privateKeyFromAsn1=function(e){var t,r,s,a,u,d,f,p,y={},g=[];if(o.validate(e,l,y,g)&&(e=o.fromDer(n.util.createBuffer(y.privateKey))),y={},g=[],!o.validate(e,h,y,g)){var m=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw m.errors=g,m}return t=n.util.createBuffer(y.privateKeyModulus).toHex(),r=n.util.createBuffer(y.privateKeyPublicExponent).toHex(),s=n.util.createBuffer(y.privateKeyPrivateExponent).toHex(),a=n.util.createBuffer(y.privateKeyPrime1).toHex(),u=n.util.createBuffer(y.privateKeyPrime2).toHex(),d=n.util.createBuffer(y.privateKeyExponent1).toHex(),f=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(s,16),new i(a,16),new i(u,16),new i(d,16),new i(f,16),new i(p,16))},c.privateKeyToAsn1=c.privateKeyToRSAPrivateKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,o.integerToDer(0).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(e.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(e.e)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(e.d)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(e.p)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(e.q)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(e.dP)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(e.dQ)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(e.qInv))])},c.publicKeyFromAsn1=function(e){var t={},r=[];if(o.validate(e,f,t,r)){var s,a=o.derToOid(t.publicKeyOid);if(a!==c.oids.rsaEncryption)throw(s=new Error("Cannot read public key. Unknown OID.")).oid=a,s;e=t.rsaPublicKey}if(r=[],!o.validate(e,d,t,r))throw(s=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=r,s;var u=n.util.createBuffer(t.publicKeyModulus).toHex(),l=n.util.createBuffer(t.publicKeyExponent).toHex();return c.setRsaPublicKey(new i(u,16),new i(l,16))},c.publicKeyToAsn1=c.publicKeyToSubjectPublicKeyInfo=function(e){return 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(c.oids.rsaEncryption).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]),o.create(o.Class.UNIVERSAL,o.Type.BITSTRING,!1,[c.publicKeyToRSAPublicKey(e)])])},c.publicKeyToRSAPublicKey=function(e){return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(e.n)),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,b(e.e))])}},11715:(e,t,r)=>{var n=r(37934);r(84630),r(31330);var i=e.exports=n.sha1=n.sha1||{};n.md.sha1=n.md.algorithms.sha1=i,i.create=function(){o||(s=String.fromCharCode(128),s+=n.util.fillString(String.fromCharCode(0),64),o=!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,s=0;s<r;++s)i.fullMessageLength.push(0);return t=n.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},i}};return i.start(),i.update=function(s,o){"utf8"===o&&(s=n.util.encodeUtf8(s));var c=s.length;i.messageLength+=c,c=[c/4294967296>>>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(s),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var o=n.util.createBuffer();o.putBytes(t.bytes());var c,u=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;o.putBytes(s.substr(0,i.blockLength-u));for(var l=8*i.fullMessageLength[0],h=0;h<i.fullMessageLength.length-1;++h)l+=(c=8*i.fullMessageLength[h+1])/4294967296>>>0,o.putInt32(l>>>0),l=c>>>0;o.putInt32(l);var d={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};a(d,r,o);var f=n.util.createBuffer();return f.putInt32(d.h0),f.putInt32(d.h1),f.putInt32(d.h2),f.putInt32(d.h3),f.putInt32(d.h4),f},i};var s=null,o=!1;function a(e,t,r){for(var n,i,s,o,a,c,u,l=r.length();l>=64;){for(i=e.h0,s=e.h1,o=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^s&(o^a))+c+1518500249+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=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^s&(o^a))+c+1518500249+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=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)+(s^o^a)+c+1859775393+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=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)+(s^o^a)+c+1859775393+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=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)+(s&o|a&(s^o))+c+2400959708+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=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)+(s^o^a)+c+3395469782+n,c=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;e.h0=e.h0+i|0,e.h1=e.h1+s|0,e.h2=e.h2+o|0,e.h3=e.h3+a|0,e.h4=e.h4+c|0,l-=64}}},25455:(e,t,r)=>{var n=r(37934);r(84630),r(31330);var i=e.exports=n.sha256=n.sha256||{};n.md.sha256=n.md.algorithms.sha256=i,i.create=function(){o||(s=String.fromCharCode(128),s+=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],o=!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,s=0;s<r;++s)i.fullMessageLength.push(0);return t=n.util.createBuffer(),e={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},i}};return i.start(),i.update=function(s,o){"utf8"===o&&(s=n.util.encodeUtf8(s));var a=s.length;i.messageLength+=a,a=[a/4294967296>>>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(s),c(e,r,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var o=n.util.createBuffer();o.putBytes(t.bytes());var a,u=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;o.putBytes(s.substr(0,i.blockLength-u));for(var l=8*i.fullMessageLength[0],h=0;h<i.fullMessageLength.length-1;++h)l+=(a=8*i.fullMessageLength[h+1])/4294967296>>>0,o.putInt32(l>>>0),l=a>>>0;o.putInt32(l);var d={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(d,r,o);var f=n.util.createBuffer();return f.putInt32(d.h0),f.putInt32(d.h1),f.putInt32(d.h2),f.putInt32(d.h3),f.putInt32(d.h4),f.putInt32(d.h5),f.putInt32(d.h6),f.putInt32(d.h7),f},i};var s=null,o=!1,a=null;function c(e,t,r){for(var n,i,s,o,c,u,l,h,d,f,p,y,g,m=r.length();m>=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,l=e.h1,h=e.h2,d=e.h3,f=e.h4,p=e.h5,y=e.h6,g=e.h7,c=0;c<64;++c)s=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),o=u&l|h&(u^l),n=g+((f>>>6|f<<26)^(f>>>11|f<<21)^(f>>>25|f<<7))+(y^f&(p^y))+a[c]+t[c],g=y,y=p,p=f,f=d+n>>>0,d=h,h=l,l=u,u=n+(i=s+o)>>>0;e.h0=e.h0+u|0,e.h1=e.h1+l|0,e.h2=e.h2+h|0,e.h3=e.h3+d|0,e.h4=e.h4+f|0,e.h5=e.h5+p|0,e.h6=e.h6+y|0,e.h7=e.h7+g|0,m-=64}}},62025:(e,t,r)=>{var n=r(37934);r(84630),r(31330);var i=e.exports=n.sha512=n.sha512||{};n.md.sha512=n.md.algorithms.sha512=i;var s=n.sha384=n.sha512.sha384=n.sha512.sha384||{};s.create=function(){return i.create("SHA-384")},n.md.sha384=n.md.algorithms.sha384=s,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||(o=String.fromCharCode(128),o+=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),"undefined"===typeof 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(),s=new Array(80),h=0;h<80;++h)s[h]=new Array(2);var d=64;switch(e){case"SHA-384":d=48;break;case"SHA-512/256":d=32;break;case"SHA-512/224":d=28}var f={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:d,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){f.messageLength=0,f.fullMessageLength=f.messageLength128=[];for(var e=f.messageLengthSize/4,s=0;s<e;++s)f.fullMessageLength.push(0);i=n.util.createBuffer(),r=new Array(t.length);for(s=0;s<t.length;++s)r[s]=t[s].slice(0);return f}};return f.start(),f.update=function(e,t){"utf8"===t&&(e=n.util.encodeUtf8(e));var o=e.length;f.messageLength+=o,o=[o/4294967296>>>0,o>>>0];for(var a=f.fullMessageLength.length-1;a>=0;--a)f.fullMessageLength[a]+=o[1],o[1]=o[0]+(f.fullMessageLength[a]/4294967296>>>0),f.fullMessageLength[a]=f.fullMessageLength[a]>>>0,o[0]=o[1]/4294967296>>>0;return i.putBytes(e),l(r,s,i),(i.read>2048||0===i.length())&&i.compact(),f},f.digest=function(){var t=n.util.createBuffer();t.putBytes(i.bytes());var a,c=f.fullMessageLength[f.fullMessageLength.length-1]+f.messageLengthSize&f.blockLength-1;t.putBytes(o.substr(0,f.blockLength-c));for(var u=8*f.fullMessageLength[0],h=0;h<f.fullMessageLength.length-1;++h)u+=(a=8*f.fullMessageLength[h+1])/4294967296>>>0,t.putInt32(u>>>0),u=a>>>0;t.putInt32(u);var d=new Array(r.length);for(h=0;h<r.length;++h)d[h]=r[h].slice(0);l(d,s,t);var p,y=n.util.createBuffer();p="SHA-512"===e?d.length:"SHA-384"===e?d.length-2:d.length-4;for(h=0;h<p;++h)y.putInt32(d[h][0]),h===p-1&&"SHA-512/224"===e||y.putInt32(d[h][1]);return y},f};var o=null,a=!1,c=null,u=null;function l(e,t,r){for(var n,i,s,o,a,u,l,h,d,f,p,y,g,m,v,b,w,E,S,_,I,T,A,C,R,P,k,O,B,N,D,L,x,M=r.length();M>=128;){for(k=0;k<16;++k)t[k][0]=r.getInt32()>>>0,t[k][1]=r.getInt32()>>>0;for(;k<80;++k)n=(((O=(N=t[k-2])[0])>>>19|(B=N[1])<<13)^(B>>>29|O<<3)^O>>>6)>>>0,i=((O<<13|B>>>19)^(B<<3|O>>>29)^(O<<26|B>>>6))>>>0,s=(((O=(L=t[k-15])[0])>>>1|(B=L[1])<<31)^(O>>>8|B<<24)^O>>>7)>>>0,o=((O<<31|B>>>1)^(O<<24|B>>>8)^(O<<25|B>>>7))>>>0,D=t[k-7],x=t[k-16],B=i+D[1]+o+x[1],t[k][0]=n+D[0]+s+x[0]+(B/4294967296>>>0)>>>0,t[k][1]=B>>>0;for(p=e[0][0],y=e[0][1],g=e[1][0],m=e[1][1],v=e[2][0],b=e[2][1],w=e[3][0],E=e[3][1],S=e[4][0],_=e[4][1],I=e[5][0],T=e[5][1],A=e[6][0],C=e[6][1],R=e[7][0],P=e[7][1],k=0;k<80;++k)l=((S>>>14|_<<18)^(S>>>18|_<<14)^(_>>>9|S<<23))>>>0,h=(A^S&(I^A))>>>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,d=(p&g|v&(p^g))>>>0,f=(y&m|b&(y^m))>>>0,B=P+(((S<<18|_>>>14)^(S<<14|_>>>18)^(_<<23|S>>>9))>>>0)+((C^_&(T^C))>>>0)+c[k][1]+t[k][1],n=R+l+h+c[k][0]+t[k][0]+(B/4294967296>>>0)>>>0,i=B>>>0,s=a+d+((B=u+f)/4294967296>>>0)>>>0,o=B>>>0,R=A,P=C,A=I,C=T,I=S,T=_,S=w+n+((B=E+i)/4294967296>>>0)>>>0,_=B>>>0,w=v,E=b,v=g,b=m,g=p,m=y,p=n+s+((B=i+o)/4294967296>>>0)>>>0,y=B>>>0;B=e[0][1]+y,e[0][0]=e[0][0]+p+(B/4294967296>>>0)>>>0,e[0][1]=B>>>0,B=e[1][1]+m,e[1][0]=e[1][0]+g+(B/4294967296>>>0)>>>0,e[1][1]=B>>>0,B=e[2][1]+b,e[2][0]=e[2][0]+v+(B/4294967296>>>0)>>>0,e[2][1]=B>>>0,B=e[3][1]+E,e[3][0]=e[3][0]+w+(B/4294967296>>>0)>>>0,e[3][1]=B>>>0,B=e[4][1]+_,e[4][0]=e[4][0]+S+(B/4294967296>>>0)>>>0,e[4][1]=B>>>0,B=e[5][1]+T,e[5][0]=e[5][0]+I+(B/4294967296>>>0)>>>0,e[5][1]=B>>>0,B=e[6][1]+C,e[6][0]=e[6][0]+A+(B/4294967296>>>0)>>>0,e[6][1]=B>>>0,B=e[7][1]+P,e[7][0]=e[7][0]+R+(B/4294967296>>>0)>>>0,e[7][1]=B>>>0,M-=128}}},31330:(e,t,r)=>{var n=r(21964),i=r(30285).Buffer,s=r(37934),o=r(47271),a=e.exports=s.util=s.util||{};function c(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function u(e){if(this.data="",this.read=0,"string"===typeof e)this.data=e;else if(a.isArrayBuffer(e)||a.isArrayBufferView(e))if("undefined"!==typeof i&&e instanceof i)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(n){for(var r=0;r<t.length;++r)this.putByte(t[r])}}else(e instanceof u||"object"===typeof e&&"string"===typeof e.data&&"number"===typeof e.read)&&(this.data=e.data,this.read=e.read);this._constructedStringLength=0}!function(){if("undefined"!==typeof n&&n.nextTick&&!n.browser)return a.nextTick=n.nextTick,void("function"===typeof setImmediate?a.setImmediate=setImmediate:a.setImmediate=a.nextTick);if("function"===typeof setImmediate)return a.setImmediate=function(){return setImmediate.apply(void 0,arguments)},void(a.nextTick=function(e){return setImmediate(e)});if(a.setImmediate=function(e){setTimeout(e,0)},"undefined"!==typeof window&&"function"===typeof window.postMessage){var e="forge.setImmediate",t=[];a.setImmediate=function(r){t.push(r),1===t.length&&window.postMessage(e,"*")},window.addEventListener("message",(function(r){if(r.source===window&&r.data===e){r.stopPropagation();var n=t.slice();t.length=0,n.forEach((function(e){e()}))}}),!0)}if("undefined"!==typeof MutationObserver){var r=Date.now(),i=!0,s=document.createElement("div");t=[];new MutationObserver((function(){var e=t.slice();t.length=0,e.forEach((function(e){e()}))})).observe(s,{attributes:!0});var o=a.setImmediate;a.setImmediate=function(e){Date.now()-r>15?(r=Date.now(),o(e)):(t.push(e),1===t.length&&s.setAttribute("a",i=!i))}}a.nextTick=a.setImmediate}(),a.isNodejs="undefined"!==typeof n&&n.versions&&n.versions.node,a.globalScope=a.isNodejs?r.g:"undefined"===typeof self?window:self,a.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},a.isArrayBuffer=function(e){return"undefined"!==typeof ArrayBuffer&&e instanceof ArrayBuffer},a.isArrayBufferView=function(e){return e&&a.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},a.ByteBuffer=u,a.ByteStringBuffer=u;a.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},a.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},a.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},a.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},a.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},a.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},a.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(a.encodeUtf8(e))},a.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},a.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},a.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))},a.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},a.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},a.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))},a.ByteStringBuffer.prototype.putInt=function(e,t){c(t);var r="";do{t-=8,r+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(r)},a.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<<t-1),this.putInt(e,t)},a.ByteStringBuffer.prototype.putBuffer=function(e){return this.putBytes(e.getBytes())},a.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},a.ByteStringBuffer.prototype.getInt16=function(){var e=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,e},a.ByteStringBuffer.prototype.getInt24=function(){var e=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,e},a.ByteStringBuffer.prototype.getInt32=function(){var e=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,e},a.ByteStringBuffer.prototype.getInt16Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,e},a.ByteStringBuffer.prototype.getInt24Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,e},a.ByteStringBuffer.prototype.getInt32Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,e},a.ByteStringBuffer.prototype.getInt=function(e){c(e);var t=0;do{t=(t<<8)+this.data.charCodeAt(this.read++),e-=8}while(e>0);return t},a.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},a.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},a.ByteStringBuffer.prototype.bytes=function(e){return"undefined"===typeof e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},a.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},a.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},a.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},a.ByteStringBuffer.prototype.copy=function(){var e=a.createBuffer(this.data);return e.read=this.read,e},a.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},a.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},a.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},a.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.length;++t){var r=this.data.charCodeAt(t);r<16&&(e+="0"),e+=r.toString(16)}return e},a.ByteStringBuffer.prototype.toString=function(){return a.decodeUtf8(this.bytes())},a.DataBuffer=function(e,t){t=t||{},this.read=t.readOffset||0,this.growSize=t.growSize||1024;var r=a.isArrayBuffer(e),n=a.isArrayBufferView(e);if(r||n)return this.data=r?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength),void(this.write="writeOffset"in t?t.writeOffset:this.data.byteLength);this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!==e&&void 0!==e&&this.putBytes(e),"writeOffset"in t&&(this.write=t.writeOffset)},a.DataBuffer.prototype.length=function(){return this.write-this.read},a.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},a.DataBuffer.prototype.accommodate=function(e,t){if(this.length()>=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},a.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},a.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r<t;++r)this.data.setUint8(e);return this},a.DataBuffer.prototype.putBytes=function(e,t){if(a.isArrayBufferView(e)){var r=(n=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)).byteLength-n.byteOffset;return this.accommodate(r),new Uint8Array(this.data.buffer,this.write).set(n),this.write+=r,this}if(a.isArrayBuffer(e)){var n=new Uint8Array(e);return this.accommodate(n.byteLength),new Uint8Array(this.data.buffer).set(n,this.write),this.write+=n.byteLength,this}if(e instanceof a.DataBuffer||"object"===typeof e&&"number"===typeof e.read&&"number"===typeof e.write&&a.isArrayBufferView(e.data)){n=new Uint8Array(e.data.byteLength,e.read,e.length());return this.accommodate(n.byteLength),new Uint8Array(e.data.byteLength,this.write).set(n),this.write+=n.byteLength,this}if(e instanceof a.ByteStringBuffer&&(e=e.data,t="binary"),t=t||"binary","string"===typeof e){var i;if("hex"===t)return this.accommodate(Math.ceil(e.length/2)),i=new Uint8Array(this.data.buffer,this.write),this.write+=a.binary.hex.decode(e,i,this.write),this;if("base64"===t)return this.accommodate(3*Math.ceil(e.length/4)),i=new Uint8Array(this.data.buffer,this.write),this.write+=a.binary.base64.decode(e,i,this.write),this;if("utf8"===t&&(e=a.encodeUtf8(e),t="binary"),"binary"===t||"raw"===t)return this.accommodate(e.length),i=new Uint8Array(this.data.buffer,this.write),this.write+=a.binary.raw.decode(i),this;if("utf16"===t)return this.accommodate(2*e.length),i=new Uint16Array(this.data.buffer,this.write),this.write+=a.text.utf16.encode(i),this;throw new Error("Invalid encoding: "+t)}throw Error("Invalid parameter: "+e)},a.DataBuffer.prototype.putBuffer=function(e){return this.putBytes(e),e.clear(),this},a.DataBuffer.prototype.putString=function(e){return this.putBytes(e,"utf16")},a.DataBuffer.prototype.putInt16=function(e){return this.accommodate(2),this.data.setInt16(this.write,e),this.write+=2,this},a.DataBuffer.prototype.putInt24=function(e){return this.accommodate(3),this.data.setInt16(this.write,e>>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},a.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},a.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},a.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},a.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},a.DataBuffer.prototype.putInt=function(e,t){c(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},a.DataBuffer.prototype.putSignedInt=function(e,t){return c(t),this.accommodate(t/8),e<0&&(e+=2<<t-1),this.putInt(e,t)},a.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},a.DataBuffer.prototype.getInt16=function(){var e=this.data.getInt16(this.read);return this.read+=2,e},a.DataBuffer.prototype.getInt24=function(){var e=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,e},a.DataBuffer.prototype.getInt32=function(){var e=this.data.getInt32(this.read);return this.read+=4,e},a.DataBuffer.prototype.getInt16Le=function(){var e=this.data.getInt16(this.read,!0);return this.read+=2,e},a.DataBuffer.prototype.getInt24Le=function(){var e=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,e},a.DataBuffer.prototype.getInt32Le=function(){var e=this.data.getInt32(this.read,!0);return this.read+=4,e},a.DataBuffer.prototype.getInt=function(e){c(e);var t=0;do{t=(t<<8)+this.data.getInt8(this.read++),e-=8}while(e>0);return t},a.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},a.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},a.DataBuffer.prototype.bytes=function(e){return"undefined"===typeof e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},a.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},a.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},a.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},a.DataBuffer.prototype.copy=function(){return new a.DataBuffer(this)},a.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},a.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},a.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},a.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.byteLength;++t){var r=this.data.getUint8(t);r<16&&(e+="0"),e+=r.toString(16)}return e},a.DataBuffer.prototype.toString=function(e){var t=new Uint8Array(this.data,this.read,this.length());if("binary"===(e=e||"utf8")||"raw"===e)return a.binary.raw.encode(t);if("hex"===e)return a.binary.hex.encode(t);if("base64"===e)return a.binary.base64.encode(t);if("utf8"===e)return a.text.utf8.decode(t);if("utf16"===e)return a.text.utf16.decode(t);throw new Error("Invalid encoding: "+e)},a.createBuffer=function(e,t){return t=t||"raw",void 0!==e&&"utf8"===t&&(e=a.encodeUtf8(e)),new a.ByteBuffer(e)},a.fillString=function(e,t){for(var r="";t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return r},a.xorBytes=function(e,t,r){for(var n="",i="",s="",o=0,a=0;r>0;--r,++o)i=e.charCodeAt(o)^t.charCodeAt(o),a>=10&&(n+=s,s="",a=0),s+=String.fromCharCode(i),++a;return n+=s},a.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r<e.length;r+=2)t+=String.fromCharCode(parseInt(e.substr(r,2),16));return t},a.bytesToHex=function(e){return a.createBuffer(e).toHex()},a.int32ToBytes=function(e){return String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",h=[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],d="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";a.encode64=function(e,t){for(var r,n,i,s="",o="",a=0;a<e.length;)r=e.charCodeAt(a++),n=e.charCodeAt(a++),i=e.charCodeAt(a++),s+=l.charAt(r>>2),s+=l.charAt((3&r)<<4|n>>4),isNaN(n)?s+="==":(s+=l.charAt((15&n)<<2|i>>6),s+=isNaN(i)?"=":l.charAt(63&i)),t&&s.length>t&&(o+=s.substr(0,t)+"\r\n",s=s.substr(t));return o+=s},a.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,n,i,s="",o=0;o<e.length;)t=h[e.charCodeAt(o++)-43],r=h[e.charCodeAt(o++)-43],n=h[e.charCodeAt(o++)-43],i=h[e.charCodeAt(o++)-43],s+=String.fromCharCode(t<<2|r>>4),64!==n&&(s+=String.fromCharCode((15&r)<<4|n>>2),64!==i&&(s+=String.fromCharCode((3&n)<<6|i)));return s},a.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},a.decodeUtf8=function(e){return decodeURIComponent(escape(e))},a.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:o.encode,decode:o.decode}},a.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},a.binary.raw.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length));for(var i=r=r||0,s=0;s<e.length;++s)n[i++]=e.charCodeAt(s);return t?i-r:n},a.binary.hex.encode=a.bytesToHex,a.binary.hex.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(Math.ceil(e.length/2)));var i=0,s=r=r||0;for(1&e.length&&(i=1,n[s++]=parseInt(e[0],16));i<e.length;i+=2)n[s++]=parseInt(e.substr(i,2),16);return t?s-r:n},a.binary.base64.encode=function(e,t){for(var r,n,i,s="",o="",a=0;a<e.byteLength;)r=e[a++],n=e[a++],i=e[a++],s+=l.charAt(r>>2),s+=l.charAt((3&r)<<4|n>>4),isNaN(n)?s+="==":(s+=l.charAt((15&n)<<2|i>>6),s+=isNaN(i)?"=":l.charAt(63&i)),t&&s.length>t&&(o+=s.substr(0,t)+"\r\n",s=s.substr(t));return o+=s},a.binary.base64.decode=function(e,t,r){var n,i,s,o,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<e.length;)n=h[e.charCodeAt(c++)-43],i=h[e.charCodeAt(c++)-43],s=h[e.charCodeAt(c++)-43],o=h[e.charCodeAt(c++)-43],a[u++]=n<<2|i>>4,64!==s&&(a[u++]=(15&i)<<4|s>>2,64!==o&&(a[u++]=(3&s)<<6|o));return t?u-r:a.subarray(0,u)},a.binary.base58.encode=function(e,t){return a.binary.baseN.encode(e,d,t)},a.binary.base58.decode=function(e,t){return a.binary.baseN.decode(e,d,t)},a.text={utf8:{},utf16:{}},a.text.utf8.encode=function(e,t,r){e=a.encodeUtf8(e);var n=t;n||(n=new Uint8Array(e.length));for(var i=r=r||0,s=0;s<e.length;++s)n[i++]=e.charCodeAt(s);return t?i-r:n},a.text.utf8.decode=function(e){return a.decodeUtf8(String.fromCharCode.apply(null,e))},a.text.utf16.encode=function(e,t,r){var n=t;n||(n=new Uint8Array(2*e.length));for(var i=new Uint16Array(n.buffer),s=r=r||0,o=r,a=0;a<e.length;++a)i[o++]=e.charCodeAt(a),s+=2;return t?s-r:n},a.text.utf16.decode=function(e){return String.fromCharCode.apply(null,new Uint16Array(e.buffer))},a.deflate=function(e,t,r){if(t=a.decode64(e.deflate(a.encode64(t)).rval),r){var n=2;32&t.charCodeAt(1)&&(n=6),t=t.substring(n,t.length-4)}return t},a.inflate=function(e,t,r){var n=e.inflate(a.encode64(t)).rval;return null===n?null:a.decode64(n)};var f=function(e,t,r){if(!e)throw new Error("WebStorage not available.");var n;if(null===r?n=e.removeItem(t):(r=a.encode64(JSON.stringify(r)),n=e.setItem(t,r)),"undefined"!==typeof n&&!0!==n.rval){var i=new Error(n.error.message);throw i.id=n.error.id,i.name=n.error.name,i}},p=function(e,t){if(!e)throw new Error("WebStorage not available.");var r=e.getItem(t);if(e.init)if(null===r.rval){if(r.error){var n=new Error(r.error.message);throw n.id=r.error.id,n.name=r.error.name,n}r=null}else r=r.rval;return null!==r&&(r=JSON.parse(a.decode64(r))),r},y=function(e,t,r,n){var i=p(e,t);null===i&&(i={}),i[r]=n,f(e,t,i)},g=function(e,t,r){var n=p(e,t);return null!==n&&(n=r in n?n[r]:null),n},m=function(e,t,r){var n=p(e,t);if(null!==n&&r in n){delete n[r];var i=!0;for(var s in n){i=!1;break}i&&(n=null),f(e,t,n)}},v=function(e,t){f(e,t,null)},b=function(e,t,r){var n,i=null;"undefined"===typeof r&&(r=["web","flash"]);var s=!1,o=null;for(var a in r){n=r[a];try{if("flash"===n||"both"===n){if(null===t[0])throw new Error("Flash local storage not available.");i=e.apply(this,t),s="flash"===n}"web"!==n&&"both"!==n||(t[0]=localStorage,i=e.apply(this,t),s=!0)}catch(c){o=c}if(s)break}if(!s)throw o;return i};a.setItem=function(e,t,r,n,i){b(y,arguments,i)},a.getItem=function(e,t,r,n){return b(g,arguments,n)},a.removeItem=function(e,t,r,n){b(m,arguments,n)},a.clearItems=function(e,t,r){b(v,arguments,r)},a.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},a.format=function(e){for(var t,r,n=/%./g,i=0,s=[],o=0;t=n.exec(e);){(r=e.substring(o,n.lastIndex-2)).length>0&&s.push(r),o=n.lastIndex;var a=t[0][1];switch(a){case"s":case"o":i<arguments.length?s.push(arguments[1+i++]):s.push("<?>");break;case"%":s.push("%");break;default:s.push("<%"+a+"?>")}}return s.push(e.substring(o)),s.join("")},a.formatNumber=function(e,t,r,n){var i=e,s=isNaN(t=Math.abs(t))?2:t,o=void 0===r?",":r,a=void 0===n?".":n,c=i<0?"-":"",u=parseInt(i=Math.abs(+i||0).toFixed(s),10)+"",l=u.length>3?u.length%3:0;return c+(l?u.substr(0,l)+a:"")+u.substr(l).replace(/(\d{3})(?=\d)/g,"$1"+a)+(s?o+Math.abs(i-u).toFixed(s).slice(2):"")},a.formatSize=function(e){return e=e>=1073741824?a.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?a.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?a.formatNumber(e/1024,0)+" KiB":a.formatNumber(e,0)+" bytes"},a.bytesFromIP=function(e){return-1!==e.indexOf(".")?a.bytesFromIPv4(e):-1!==e.indexOf(":")?a.bytesFromIPv6(e):null},a.bytesFromIPv4=function(e){if(4!==(e=e.split(".")).length)return null;for(var t=a.createBuffer(),r=0;r<e.length;++r){var n=parseInt(e[r],10);if(isNaN(n))return null;t.putByte(n)}return t.getBytes()},a.bytesFromIPv6=function(e){for(var t=0,r=2*(8-(e=e.split(":").filter((function(e){return 0===e.length&&++t,!0}))).length+t),n=a.createBuffer(),i=0;i<8;++i)if(e[i]&&0!==e[i].length){var s=a.hexToBytes(e[i]);s.length<2&&n.putByte(0),n.putBytes(s)}else n.fillWithByte(0,r),r=0;return n.getBytes()},a.bytesToIP=function(e){return 4===e.length?a.bytesToIPv4(e):16===e.length?a.bytesToIPv6(e):null},a.bytesToIPv4=function(e){if(4!==e.length)return null;for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t.join(".")},a.bytesToIPv6=function(e){if(16!==e.length)return null;for(var t=[],r=[],n=0,i=0;i<e.length;i+=2){for(var s=a.bytesToHex(e[i]+e[i+1]);"0"===s[0]&&"0"!==s;)s=s.substr(1);if("0"===s){var o=r[r.length-1],c=t.length;o&&c===o.end+1?(o.end=c,o.end-o.start>r[n].end-r[n].start&&(n=r.length-1)):r.push({start:c,end:c})}t.push(s)}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(":")},a.estimateCores=function(e,t){if("function"===typeof e&&(t=e,e={}),e=e||{},"cores"in a&&!e.update)return t(null,a.cores);if("undefined"!==typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return a.cores=navigator.hardwareConcurrency,t(null,a.cores);if("undefined"===typeof Worker)return a.cores=1,t(null,a.cores);if("undefined"===typeof Blob)return a.cores=2,t(null,a.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",(function(e){for(var t=Date.now(),r=t+4;Date.now()<r;);self.postMessage({st:t,et:r})}))}.toString(),")()"],{type:"application/javascript"}));!function e(n,i,s){if(0===i){var o=Math.floor(n.reduce((function(e,t){return e+t}),0)/n.length);return a.cores=Math.max(1,o),URL.revokeObjectURL(r),t(null,a.cores)}!function(e,t){for(var n=[],i=[],s=0;s<e;++s){var o=new Worker(r);o.addEventListener("message",(function(r){if(i.push(r.data),i.length===e){for(var s=0;s<e;++s)n[s].terminate();t(null,i)}})),n.push(o)}for(s=0;s<e;++s)n[s].postMessage(s)}(s,(function(t,r){n.push(function(e,t){for(var r=[],n=0;n<e;++n)for(var i=t[n],s=r[n]=[],o=0;o<e;++o)if(n!==o){var a=t[o];(i.st>a.st&&i.st<a.et||a.st>i.st&&a.st<i.et)&&s.push(o)}return r.reduce((function(e,t){return Math.max(e,t.length)}),0)}(s,r)),e(n,i-1,s)}))}([],5,16)}},87141:(e,t,r)=>{var n=r(37934);r(28085),r(10853),r(96052),r(84630),r(66513),r(56661),r(82232),r(95884),r(95791),r(31330);var i=n.asn1,s=e.exports=n.pki=n.pki||{},o=s.oids,a={};a.CN=o.commonName,a.commonName="CN",a.C=o.countryName,a.countryName="C",a.L=o.localityName,a.localityName="L",a.ST=o.stateOrProvinceName,a.stateOrProvinceName="ST",a.O=o.organizationName,a.organizationName="O",a.OU=o.organizationalUnitName,a.organizationalUnitName="OU",a.E=o.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"}]},l={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"}]}]},h={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}]}]}]},d={name:"CertificationRequest",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[h,{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 f(e,t){"string"===typeof t&&(t={shortName:t});for(var r,n=null,i=0;null===n&&i<e.attributes.length;++i)r=e.attributes[i],(t.type&&t.type===r.type||t.name&&t.name===r.name||t.shortName&&t.shortName===r.shortName)&&(n=r);return n}s.RDNAttributesAsArray=function(e,t){for(var r,n,s,c=[],u=0;u<e.value.length;++u){r=e.value[u];for(var l=0;l<r.value.length;++l)s={},n=r.value[l],s.type=i.derToOid(n.value[0].value),s.value=n.value[1].value,s.valueTagClass=n.value[1].type,s.type in o&&(s.name=o[s.type],s.name in a&&(s.shortName=a[s.name])),t&&(t.update(s.type),t.update(s.value)),c.push(s)}return c},s.CRIAttributesAsArray=function(e){for(var t=[],r=0;r<e.length;++r)for(var n=e[r],c=i.derToOid(n.value[0].value),u=n.value[1].value,l=0;l<u.length;++l){var h={};if(h.type=c,h.value=u[l].value,h.valueTagClass=u[l].type,h.type in o&&(h.name=o[h.type],h.name in a&&(h.shortName=a[h.name])),h.type===o.extensionRequest){h.extensions=[];for(var d=0;d<h.value.length;++d)h.extensions.push(s.certificateExtensionFromAsn1(h.value[d]))}t.push(h)}return t};var p=function(e,t,r){var n={};if(e!==o["RSASSA-PSS"])return n;r&&(n={hash:{algorithmOid:o.sha1},mgf:{algorithmOid:o.mgf1,hash:{algorithmOid:o.sha1}},saltLength:20});var s={},a=[];if(!i.validate(t,l,s,a)){var c=new Error("Cannot read RSASSA-PSS parameter block.");throw c.errors=a,c}return void 0!==s.hashOid&&(n.hash=n.hash||{},n.hash.algorithmOid=i.derToOid(s.hashOid)),void 0!==s.maskGenOid&&(n.mgf=n.mgf||{},n.mgf.algorithmOid=i.derToOid(s.maskGenOid),n.mgf.hash=n.mgf.hash||{},n.mgf.hash.algorithmOid=i.derToOid(s.maskGenHashOid)),void 0!==s.saltLength&&(n.saltLength=s.saltLength.charCodeAt(0)),n},y=function(e){switch(o[e.signatureOid]){case"sha1WithRSAEncryption":case"sha1WithRSASignature":return n.md.sha1.create();case"md5WithRSAEncryption":return n.md.md5.create();case"sha256WithRSAEncryption":case"RSASSA-PSS":return n.md.sha256.create();case"sha384WithRSAEncryption":return n.md.sha384.create();case"sha512WithRSAEncryption":return n.md.sha512.create();default:var t=new Error("Could not compute "+e.type+" digest. Unknown signature OID.");throw t.signatureOid=e.signatureOid,t}},g=function(e){var t,r=e.certificate;switch(r.signatureOid){case o.sha1WithRSAEncryption:case o.sha1WithRSASignature:break;case o["RSASSA-PSS"]:var i,s,a;if(void 0===(i=o[r.signatureParameters.mgf.hash.algorithmOid])||void 0===n.md[i])throw(a=new Error("Unsupported MGF hash function.")).oid=r.signatureParameters.mgf.hash.algorithmOid,a.name=i,a;if(void 0===(s=o[r.signatureParameters.mgf.algorithmOid])||void 0===n.mgf[s])throw(a=new Error("Unsupported MGF function.")).oid=r.signatureParameters.mgf.algorithmOid,a.name=s,a;if(s=n.mgf[s].create(n.md[i].create()),void 0===(i=o[r.signatureParameters.hash.algorithmOid])||void 0===n.md[i])throw(a=new Error("Unsupported RSASSA-PSS hash function.")).oid=r.signatureParameters.hash.algorithmOid,a.name=i,a;t=n.pss.create(n.md[i].create(),s,r.signatureParameters.saltLength)}return r.publicKey.verify(e.md.digest().getBytes(),e.signature,t)};function m(e){for(var t,r,s=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),o=e.attributes,a=0;a<o.length;++a){var c=(t=o[a]).value,u=i.Type.PRINTABLESTRING;"valueTagClass"in t&&(u=t.valueTagClass)===i.Type.UTF8&&(c=n.util.encodeUtf8(c)),r=i.create(i.Class.UNIVERSAL,i.Type.SET,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.type).getBytes()),i.create(i.Class.UNIVERSAL,u,!1,c)])]),s.value.push(r)}return s}function v(e){for(var t,r=0;r<e.length;++r){if("undefined"===typeof(t=e[r]).name&&(t.type&&t.type in s.oids?t.name=s.oids[t.type]:t.shortName&&t.shortName in a&&(t.name=s.oids[a[t.shortName]])),"undefined"===typeof t.type){if(!t.name||!(t.name in s.oids))throw(c=new Error("Attribute type not specified.")).attribute=t,c;t.type=s.oids[t.name]}if("undefined"===typeof t.shortName&&t.name&&t.name in a&&(t.shortName=a[t.name]),t.type===o.extensionRequest&&(t.valueConstructed=!0,t.valueTagClass=i.Type.SEQUENCE,!t.value&&t.extensions)){t.value=[];for(var n=0;n<t.extensions.length;++n)t.value.push(s.certificateExtensionToAsn1(b(t.extensions[n])))}var c;if("undefined"===typeof t.value)throw(c=new Error("Attribute value not specified.")).attribute=t,c}}function b(e,t){if(t=t||{},"undefined"===typeof e.name&&e.id&&e.id in s.oids&&(e.name=s.oids[e.id]),"undefined"===typeof e.id){if(!e.name||!(e.name in s.oids))throw(E=new Error("Extension ID not specified.")).extension=e,E;e.id=s.oids[e.name]}if("undefined"!==typeof e.value)return e;if("keyUsage"===e.name){var r=0,a=0,c=0;e.digitalSignature&&(a|=128,r=7),e.nonRepudiation&&(a|=64,r=6),e.keyEncipherment&&(a|=32,r=5),e.dataEncipherment&&(a|=16,r=4),e.keyAgreement&&(a|=8,r=3),e.keyCertSign&&(a|=4,r=2),e.cRLSign&&(a|=2,r=1),e.encipherOnly&&(a|=1,r=0),e.decipherOnly&&(c|=128,r=7);var u=String.fromCharCode(r);0!==c?u+=String.fromCharCode(a)+String.fromCharCode(c):0!==a&&(u+=String.fromCharCode(a)),e.value=i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,u)}else if("basicConstraints"===e.name)e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),e.cA&&e.value.value.push(i.create(i.Class.UNIVERSAL,i.Type.BOOLEAN,!1,String.fromCharCode(255))),"pathLenConstraint"in e&&e.value.value.push(i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.pathLenConstraint).getBytes()));else if("extKeyUsage"===e.name){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);var l=e.value.value;for(var h in e)!0===e[h]&&(h in o?l.push(i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(o[h]).getBytes())):-1!==h.indexOf(".")&&l.push(i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(h).getBytes())))}else if("nsCertType"===e.name){r=0,a=0;e.client&&(a|=128,r=7),e.server&&(a|=64,r=6),e.email&&(a|=32,r=5),e.objsign&&(a|=16,r=4),e.reserved&&(a|=8,r=3),e.sslCA&&(a|=4,r=2),e.emailCA&&(a|=2,r=1),e.objCA&&(a|=1,r=0);u=String.fromCharCode(r);0!==a&&(u+=String.fromCharCode(a)),e.value=i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,u)}else if("subjectAltName"===e.name||"issuerAltName"===e.name){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);for(var d=0;d<e.altNames.length;++d){u=(v=e.altNames[d]).value;if(7===v.type&&v.ip){if(null===(u=n.util.bytesFromIP(v.ip)))throw(E=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=e,E}else 8===v.type&&(u=v.oid?i.oidToDer(i.oidToDer(v.oid)):i.oidToDer(u));e.value.value.push(i.create(i.Class.CONTEXT_SPECIFIC,v.type,!1,u))}}else if("nsComment"===e.name&&t.cert){if(!/^[\x00-\x7F]*$/.test(e.comment)||e.comment.length<1||e.comment.length>128)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 f=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=f.toHex(),e.value=i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,f.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);l=e.value.value;if(e.keyIdentifier){var p=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;l.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!1,p))}if(e.authorityCertIssuer){var y=[i.create(i.Class.CONTEXT_SPECIFIC,4,!0,[m(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];l.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,y))}if(e.serialNumber){var g=n.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);l.push(i.create(i.Class.CONTEXT_SPECIFIC,2,!1,g))}}else if("cRLDistributionPoints"===e.name){e.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);l=e.value.value;var v,b=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),w=i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[]);for(d=0;d<e.altNames.length;++d){u=(v=e.altNames[d]).value;if(7===v.type&&v.ip){if(null===(u=n.util.bytesFromIP(v.ip)))throw(E=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=e,E}else 8===v.type&&(u=v.oid?i.oidToDer(i.oidToDer(v.oid)):i.oidToDer(u));w.value.push(i.create(i.Class.CONTEXT_SPECIFIC,v.type,!1,u))}b.value.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[w])),l.push(b)}var E;if("undefined"===typeof e.value)throw(E=new Error("Extension value not specified.")).extension=e,E;return e}function w(e,t){if(e===o["RSASSA-PSS"]){var r=[];return void 0!==t.hash.algorithmOid&&r.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.hash.algorithmOid).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")])])),void 0!==t.mgf.algorithmOid&&r.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.mgf.algorithmOid).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.mgf.hash.algorithmOid).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")])])])),void 0!==t.saltLength&&r.push(i.create(i.Class.CONTEXT_SPECIFIC,2,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(t.saltLength).getBytes())])),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,r)}return i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")}function E(e){var t=i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[]);if(0===e.attributes.length)return t;for(var r=e.attributes,s=0;s<r.length;++s){var o=r[s],a=o.value,c=i.Type.UTF8;"valueTagClass"in o&&(c=o.valueTagClass),c===i.Type.UTF8&&(a=n.util.encodeUtf8(a));var u=!1;"valueConstructed"in o&&(u=o.valueConstructed);var l=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(o.type).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SET,!0,[i.create(i.Class.UNIVERSAL,c,u,a)])]);t.value.push(l)}return t}s.certificateFromPem=function(e,t,r){var o=n.pem.decode(e)[0];if("CERTIFICATE"!==o.type&&"X509 CERTIFICATE"!==o.type&&"TRUSTED CERTIFICATE"!==o.type){var a=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw a.headerType=o.type,a}if(o.procType&&"ENCRYPTED"===o.procType.type)throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var c=i.fromDer(o.body,r);return s.certificateFromAsn1(c,t)},s.certificateToPem=function(e,t){var r={type:"CERTIFICATE",body:i.toDer(s.certificateToAsn1(e)).getBytes()};return n.pem.encode(r,{maxline:t})},s.publicKeyFromPem=function(e){var t=n.pem.decode(e)[0];if("PUBLIC KEY"!==t.type&&"RSA PUBLIC KEY"!==t.type){var r=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert public key from PEM; PEM is encrypted.");var o=i.fromDer(t.body);return s.publicKeyFromAsn1(o)},s.publicKeyToPem=function(e,t){var r={type:"PUBLIC KEY",body:i.toDer(s.publicKeyToAsn1(e)).getBytes()};return n.pem.encode(r,{maxline:t})},s.publicKeyToRSAPublicKeyPem=function(e,t){var r={type:"RSA PUBLIC KEY",body:i.toDer(s.publicKeyToRSAPublicKey(e)).getBytes()};return n.pem.encode(r,{maxline:t})},s.getPublicKeyFingerprint=function(e,t){var r,o=(t=t||{}).md||n.md.sha1.create();switch(t.type||"RSAPublicKey"){case"RSAPublicKey":r=i.toDer(s.publicKeyToRSAPublicKey(e)).getBytes();break;case"SubjectPublicKeyInfo":r=i.toDer(s.publicKeyToAsn1(e)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+t.type+'".')}o.start(),o.update(r);var a=o.digest();if("hex"===t.encoding){var c=a.toHex();return t.delimiter?c.match(/.{2}/g).join(t.delimiter):c}if("binary"===t.encoding)return a.getBytes();if(t.encoding)throw new Error('Unknown encoding "'+t.encoding+'".');return a},s.certificationRequestFromPem=function(e,t,r){var o=n.pem.decode(e)[0];if("CERTIFICATE REQUEST"!==o.type){var a=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw a.headerType=o.type,a}if(o.procType&&"ENCRYPTED"===o.procType.type)throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var c=i.fromDer(o.body,r);return s.certificationRequestFromAsn1(c,t)},s.certificationRequestToPem=function(e,t){var r={type:"CERTIFICATE REQUEST",body:i.toDer(s.certificationRequestToAsn1(e)).getBytes()};return n.pem.encode(r,{maxline:t})},s.createCertificate=function(){var e={version:2,serialNumber:"00",signatureOid:null,signature:null,siginfo:{}};return e.siginfo.algorithmOid=null,e.validity={},e.validity.notBefore=new Date,e.validity.notAfter=new Date,e.issuer={},e.issuer.getField=function(t){return f(e.issuer,t)},e.issuer.addField=function(t){v([t]),e.issuer.attributes.push(t)},e.issuer.attributes=[],e.issuer.hash=null,e.subject={},e.subject.getField=function(t){return f(e.subject,t)},e.subject.addField=function(t){v([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.extensions=[],e.publicKey=null,e.md=null,e.setSubject=function(t,r){v(t),e.subject.attributes=t,delete e.subject.uniqueId,r&&(e.subject.uniqueId=r),e.subject.hash=null},e.setIssuer=function(t,r){v(t),e.issuer.attributes=t,delete e.issuer.uniqueId,r&&(e.issuer.uniqueId=r),e.issuer.hash=null},e.setExtensions=function(t){for(var r=0;r<t.length;++r)b(t[r],{cert:e});e.extensions=t},e.getExtension=function(t){"string"===typeof t&&(t={name:t});for(var r,n=null,i=0;null===n&&i<e.extensions.length;++i)r=e.extensions[i],(t.id&&r.id===t.id||t.name&&r.name===t.name)&&(n=r);return n},e.sign=function(t,r){e.md=r||n.md.sha1.create();var a=o[e.md.algorithm+"WithRSAEncryption"];if(!a){var c=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw c.algorithm=e.md.algorithm,c}e.signatureOid=e.siginfo.algorithmOid=a,e.tbsCertificate=s.getTBSCertificate(e);var u=i.toDer(e.tbsCertificate);e.md.update(u.getBytes()),e.signature=t.sign(e.md)},e.verify=function(t){var r=!1;if(!e.issued(t)){var n=t.issuer,o=e.subject,a=new Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.");throw a.expectedIssuer=o.attributes,a.actualIssuer=n.attributes,a}var c=t.md;if(null===c){c=y({signatureOid:t.signatureOid,type:"certificate"});var u=t.tbsCertificate||s.getTBSCertificate(t),l=i.toDer(u);c.update(l.getBytes())}return null!==c&&(r=g({certificate:e,md:c,signature:t.signature})),r},e.isIssuer=function(t){var r=!1,n=e.issuer,i=t.subject;if(n.hash&&i.hash)r=n.hash===i.hash;else if(n.attributes.length===i.attributes.length){var s,o;r=!0;for(var a=0;r&&a<n.attributes.length;++a)s=n.attributes[a],o=i.attributes[a],s.type===o.type&&s.value===o.value||(r=!1)}return r},e.issued=function(t){return t.isIssuer(e)},e.generateSubjectKeyIdentifier=function(){return s.getPublicKeyFingerprint(e.publicKey,{type:"RSAPublicKey"})},e.verifySubjectKeyIdentifier=function(){for(var t=o.subjectKeyIdentifier,r=0;r<e.extensions.length;++r){var i=e.extensions[r];if(i.id===t){var s=e.generateSubjectKeyIdentifier().getBytes();return n.util.hexToBytes(i.subjectKeyIdentifier)===s}}return!1},e},s.certificateFromAsn1=function(e,t){var r={},o=[];if(!i.validate(e,u,r,o)){var a=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw a.errors=o,a}if(i.derToOid(r.publicKeyOid)!==s.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var c=s.createCertificate();c.version=r.certVersion?r.certVersion.charCodeAt(0):0;var l=n.util.createBuffer(r.certSerialNumber);c.serialNumber=l.toHex(),c.signatureOid=n.asn1.derToOid(r.certSignatureOid),c.signatureParameters=p(c.signatureOid,r.certSignatureParams,!0),c.siginfo.algorithmOid=n.asn1.derToOid(r.certinfoSignatureOid),c.siginfo.parameters=p(c.siginfo.algorithmOid,r.certinfoSignatureParams,!1),c.signature=r.certSignature;var h=[];if(void 0!==r.certValidity1UTCTime&&h.push(i.utcTimeToDate(r.certValidity1UTCTime)),void 0!==r.certValidity2GeneralizedTime&&h.push(i.generalizedTimeToDate(r.certValidity2GeneralizedTime)),void 0!==r.certValidity3UTCTime&&h.push(i.utcTimeToDate(r.certValidity3UTCTime)),void 0!==r.certValidity4GeneralizedTime&&h.push(i.generalizedTimeToDate(r.certValidity4GeneralizedTime)),h.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(h.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(c.validity.notBefore=h[0],c.validity.notAfter=h[1],c.tbsCertificate=r.tbsCertificate,t){c.md=y({signatureOid:c.signatureOid,type:"certificate"});var d=i.toDer(c.tbsCertificate);c.md.update(d.getBytes())}var g=n.md.sha1.create(),m=i.toDer(r.certIssuer);g.update(m.getBytes()),c.issuer.getField=function(e){return f(c.issuer,e)},c.issuer.addField=function(e){v([e]),c.issuer.attributes.push(e)},c.issuer.attributes=s.RDNAttributesAsArray(r.certIssuer),r.certIssuerUniqueId&&(c.issuer.uniqueId=r.certIssuerUniqueId),c.issuer.hash=g.digest().toHex();var b=n.md.sha1.create(),w=i.toDer(r.certSubject);return b.update(w.getBytes()),c.subject.getField=function(e){return f(c.subject,e)},c.subject.addField=function(e){v([e]),c.subject.attributes.push(e)},c.subject.attributes=s.RDNAttributesAsArray(r.certSubject),r.certSubjectUniqueId&&(c.subject.uniqueId=r.certSubjectUniqueId),c.subject.hash=b.digest().toHex(),r.certExtensions?c.extensions=s.certificateExtensionsFromAsn1(r.certExtensions):c.extensions=[],c.publicKey=s.publicKeyFromAsn1(r.subjectPublicKeyInfo),c},s.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r<e.value.length;++r)for(var n=e.value[r],i=0;i<n.value.length;++i)t.push(s.certificateExtensionFromAsn1(n.value[i]));return t},s.certificateExtensionFromAsn1=function(e){var t={};if(t.id=i.derToOid(e.value[0].value),t.critical=!1,e.value[1].type===i.Type.BOOLEAN?(t.critical=0!==e.value[1].value.charCodeAt(0),t.value=e.value[2].value):t.value=e.value[1].value,t.id in o)if(t.name=o[t.id],"keyUsage"===t.name){var r=0,s=0;(c=i.fromDer(t.value)).value.length>1&&(r=c.value.charCodeAt(1),s=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&s)}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;u<c.value.length;++u){var l=i.derToOid(c.value[u].value);l in o?t[o[l]]=!0:t[l]=!0}else if("nsCertType"===t.name){r=0;(c=i.fromDer(t.value)).value.length>1&&(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 h;t.altNames=[];c=i.fromDer(t.value);for(var d=0;d<c.value.length;++d){var f={type:(h=c.value[d]).type,value:h.value};switch(t.altNames.push(f),h.type){case 1:case 2:case 6:break;case 7:f.ip=n.util.bytesToIP(h.value);break;case 8:f.oid=i.derToOid(h.value)}}}else if("subjectKeyIdentifier"===t.name){c=i.fromDer(t.value);t.subjectKeyIdentifier=n.util.bytesToHex(c.value)}return t},s.certificationRequestFromAsn1=function(e,t){var r={},o=[];if(!i.validate(e,d,r,o)){var a=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw a.errors=o,a}if(i.derToOid(r.publicKeyOid)!==s.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var c=s.createCertificationRequest();if(c.version=r.csrVersion?r.csrVersion.charCodeAt(0):0,c.signatureOid=n.asn1.derToOid(r.csrSignatureOid),c.signatureParameters=p(c.signatureOid,r.csrSignatureParams,!0),c.siginfo.algorithmOid=n.asn1.derToOid(r.csrSignatureOid),c.siginfo.parameters=p(c.siginfo.algorithmOid,r.csrSignatureParams,!1),c.signature=r.csrSignature,c.certificationRequestInfo=r.certificationRequestInfo,t){c.md=y({signatureOid:c.signatureOid,type:"certification request"});var u=i.toDer(c.certificationRequestInfo);c.md.update(u.getBytes())}var l=n.md.sha1.create();return c.subject.getField=function(e){return f(c.subject,e)},c.subject.addField=function(e){v([e]),c.subject.attributes.push(e)},c.subject.attributes=s.RDNAttributesAsArray(r.certificationRequestInfoSubject,l),c.subject.hash=l.digest().toHex(),c.publicKey=s.publicKeyFromAsn1(r.subjectPublicKeyInfo),c.getAttribute=function(e){return f(c,e)},c.addAttribute=function(e){v([e]),c.attributes.push(e)},c.attributes=s.CRIAttributesAsArray(r.certificationRequestInfoAttributes||[]),c},s.createCertificationRequest=function(){var e={version:0,signatureOid:null,signature:null,siginfo:{}};return e.siginfo.algorithmOid=null,e.subject={},e.subject.getField=function(t){return f(e.subject,t)},e.subject.addField=function(t){v([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.publicKey=null,e.attributes=[],e.getAttribute=function(t){return f(e,t)},e.addAttribute=function(t){v([t]),e.attributes.push(t)},e.md=null,e.setSubject=function(t){v(t),e.subject.attributes=t,e.subject.hash=null},e.setAttributes=function(t){v(t),e.attributes=t},e.sign=function(t,r){e.md=r||n.md.sha1.create();var a=o[e.md.algorithm+"WithRSAEncryption"];if(!a){var c=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw c.algorithm=e.md.algorithm,c}e.signatureOid=e.siginfo.algorithmOid=a,e.certificationRequestInfo=s.getCertificationRequestInfo(e);var u=i.toDer(e.certificationRequestInfo);e.md.update(u.getBytes()),e.signature=t.sign(e.md)},e.verify=function(){var t=!1,r=e.md;if(null===r){r=y({signatureOid:e.signatureOid,type:"certification request"});var n=e.certificationRequestInfo||s.getCertificationRequestInfo(e),o=i.toDer(n);r.update(o.getBytes())}return null!==r&&(t=g({certificate:e,md:r,signature:e.signature})),t},e};var S=new Date("1950-01-01T00:00:00Z"),_=new Date("2050-01-01T00:00:00Z");function I(e){return e>=S&&e<_?i.create(i.Class.UNIVERSAL,i.Type.UTCTIME,!1,i.dateToUtcTime(e)):i.create(i.Class.UNIVERSAL,i.Type.GENERALIZEDTIME,!1,i.dateToGeneralizedTime(e))}s.getTBSCertificate=function(e){var t=I(e.validity.notBefore),r=I(e.validity.notAfter),o=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes())]),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,n.util.hexToBytes(e.serialNumber)),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.siginfo.algorithmOid).getBytes()),w(e.siginfo.algorithmOid,e.siginfo.parameters)]),m(e.issuer),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[t,r]),m(e.subject),s.publicKeyToAsn1(e.publicKey)]);return e.issuer.uniqueId&&o.value.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,[i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.issuer.uniqueId)])),e.subject.uniqueId&&o.value.push(i.create(i.Class.CONTEXT_SPECIFIC,2,!0,[i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.subject.uniqueId)])),e.extensions.length>0&&o.value.push(s.certificateExtensionsToAsn1(e.extensions)),o},s.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()),m(e.subject),s.publicKeyToAsn1(e.publicKey),E(e)])},s.distinguishedNameToAsn1=function(e){return m(e)},s.certificateToAsn1=function(e){var t=e.tbsCertificate||s.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()),w(e.signatureOid,e.signatureParameters)]),i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},s.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;n<e.length;++n)r.value.push(s.certificateExtensionToAsn1(e[n]));return t},s.certificateExtensionToAsn1=function(e){var t=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);t.value.push(i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.id).getBytes())),e.critical&&t.value.push(i.create(i.Class.UNIVERSAL,i.Type.BOOLEAN,!1,String.fromCharCode(255)));var r=e.value;return"string"!==typeof e.value&&(r=i.toDer(r).getBytes()),t.value.push(i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,r)),t},s.certificationRequestToAsn1=function(e){var t=e.certificationRequestInfo||s.getCertificationRequestInfo(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()),w(e.signatureOid,e.signatureParameters)]),i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},s.createCaStore=function(e){var t={certs:{}};function r(e){return o(e),t.certs[e.hash]||null}function o(e){if(!e.hash){var t=n.md.sha1.create();e.attributes=s.RDNAttributesAsArray(m(e),t),e.hash=t.digest().toHex()}}if(t.getIssuer=function(e){return r(e.issuer)},t.addCertificate=function(e){if("string"===typeof e&&(e=n.pki.certificateFromPem(e)),o(e.subject),!t.hasCertificate(e))if(e.subject.hash in t.certs){var r=t.certs[e.subject.hash];n.util.isArray(r)||(r=[r]),r.push(e),t.certs[e.subject.hash]=r}else t.certs[e.subject.hash]=e},t.hasCertificate=function(e){"string"===typeof e&&(e=n.pki.certificateFromPem(e));var t=r(e.subject);if(!t)return!1;n.util.isArray(t)||(t=[t]);for(var o=i.toDer(s.certificateToAsn1(e)).getBytes(),a=0;a<t.length;++a){if(o===i.toDer(s.certificateToAsn1(t[a])).getBytes())return!0}return!1},t.listAllCertificates=function(){var e=[];for(var r in t.certs)if(t.certs.hasOwnProperty(r)){var i=t.certs[r];if(n.util.isArray(i))for(var s=0;s<i.length;++s)e.push(i[s]);else e.push(i)}return e},t.removeCertificate=function(e){var a;if("string"===typeof e&&(e=n.pki.certificateFromPem(e)),o(e.subject),!t.hasCertificate(e))return null;var c=r(e.subject);if(!n.util.isArray(c))return a=t.certs[e.subject.hash],delete t.certs[e.subject.hash],a;for(var u=i.toDer(s.certificateToAsn1(e)).getBytes(),l=0;l<c.length;++l){u===i.toDer(s.certificateToAsn1(c[l])).getBytes()&&(a=c[l],c.splice(l,1))}return 0===c.length&&delete t.certs[e.subject.hash],a},e)for(var a=0;a<e.length;++a){var c=e[a];t.addCertificate(c)}return t},s.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"},s.verifyCertificateChain=function(e,t,r){"function"===typeof r&&(r={verify:r}),r=r||{};var i=(t=t.slice(0)).slice(0),o=r.validityCheckDate;"undefined"===typeof o&&(o=new Date);var a=!0,c=null,u=0;do{var l=t.shift(),h=null,d=!1;if(o&&(o<l.validity.notBefore||o>l.validity.notAfter)&&(c={message:"Certificate is not valid yet or has expired.",error:s.certificateError.certificate_expired,notBefore:l.validity.notBefore,notAfter:l.validity.notAfter,now:o}),null===c){if(null===(h=t[0]||e.getIssuer(l))&&l.isIssuer(l)&&(d=!0,h=l),h){var f=h;n.util.isArray(f)||(f=[f]);for(var p=!1;!p&&f.length>0;){h=f.shift();try{p=h.verify(l)}catch(S){}}p||(c={message:"Certificate signature is invalid.",error:s.certificateError.bad_certificate})}null!==c||h&&!d||e.hasCertificate(l)||(c={message:"Certificate is not trusted.",error:s.certificateError.unknown_ca})}if(null===c&&h&&!l.isIssuer(h)&&(c={message:"Certificate issuer is invalid.",error:s.certificateError.bad_certificate}),null===c)for(var y={keyUsage:!0,basicConstraints:!0},g=0;null===c&&g<l.extensions.length;++g){var m=l.extensions[g];m.critical&&!(m.name in y)&&(c={message:"Certificate has an unsupported critical extension.",error:s.certificateError.unsupported_certificate})}if(null===c&&(!a||0===t.length&&(!h||d))){var v=l.getExtension("basicConstraints"),b=l.getExtension("keyUsage");if(null!==b&&(b.keyCertSign&&null!==v||(c={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:s.certificateError.bad_certificate})),null!==c||null===v||v.cA||(c={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:s.certificateError.bad_certificate}),null===c&&null!==b&&"pathLenConstraint"in v)u-1>v.pathLenConstraint&&(c={message:"Certificate basicConstraints pathLenConstraint violated.",error:s.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:s.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}},61995:(e,t,r)=>{"use strict";const{EventEmitter:n}=r(47465),{Multiaddr:i}=r(98719),s=r(90190);e.exports=class extends n{constructor(e){let{listen:t=[],announce:r=[]}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};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();if(r){s.createFromB58String(r).equals(this.peerId)&&(t=t.decapsulate(new i("/p2p/".concat(this.peerId))))}const n=t.toString();this.observed.has(n)||(this.observed.add(n),this.emit("change:addresses"))}}},26604:(e,t,r)=>{"use strict";const n=r(18392),i=Object.assign(n("libp2p:auto-relay"),{error:n("libp2p:auto-relay:err")}),{fromString:s}=r(46765),{toString:o}=r(82051),{Multiaddr:a}=r(98719),c=r(50464),{relay:u}=r(16074),{canHop:l}=r(4364),{namespaceToCid:h}=r(7958),{CIRCUIT_PROTO_CODE:d,HOP_METADATA_KEY:f,HOP_METADATA_VALUE:p,RELAY_RENDEZVOUS_NS:y}=r(3369);e.exports=class{constructor(e){let{libp2p:t,maxListeners:r=1,onError:n}=e;this._libp2p=t,this._peerId=t.peerId,this._peerStore=t.peerStore,this._connectionManager=t.connectionManager,this._transportManager=t.transportManager,this._addressSorter=t.dialer.addressSorter,this.maxListeners=r,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),n&&n(e,t)}}async _onProtocolChange(e){let{peerId:t,protocols:r}=e;const n=t.toB58String(),o=r.find((e=>e===u));if(o||!this._listenRelays.has(n)){if(o&&!this._listenRelays.has(n))try{const e=this._connectionManager.get(t);if(!e)return;if(e.remoteAddr.protoCodes().includes(d))return void i("relayed connection to ".concat(n," will not be used to hop on"));await l({connection:e})&&(await this._peerStore.metadataBook.setValue(t,f,s(p)),await this._addListenRelay(e,n))}catch(a){this._onError(a)}}else await this._removeListenRelay(n)}_onPeerDisconnected(e){const t=e.remotePeer.toB58String();this._listenRelays.has(t)&&this._removeListenRelay(t).catch((e=>{i.error(e)}))}async _addListenRelay(e,t){try{if(this._listenRelays.size>=this.maxListeners)return;const r=await this._peerStore.addressBook.getMultiaddrsForPeer(e.remotePeer,this._addressSorter);(await Promise.all(r.map((async e=>{try{return await this._transportManager.listen([new a("".concat(e.toString(),"/p2p-circuit"))]),!0}catch(t){this._onError(t)}return!1})))).includes(!0)&&this._listenRelays.add(t)}catch(r){this._onError(r),this._listenRelays.delete(t)}}async _removeListenRelay(e){this._listenRelays.delete(e)&&await this._listenOnAvailableHopRelays([e])}async _listenOnAvailableHopRelays(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(this._listenRelays.size>=this.maxListeners)return;const t=[],r=await c(this._peerStore.getPeers());for await(const{id:i,metadata:s}of r){const r=i.toB58String();if(this._listenRelays.has(r))continue;if(e.includes(r))continue;const n=s.get(f);if(!n||o(n)!==p)continue;const a=this._connectionManager.get(i);if(a){if(await this._addListenRelay(a,r),this._listenRelays.size>=this.maxListeners)return}else t.push(i)}for(const i of t)if(await this._tryToListenOnRelay(i),this._listenRelays.size>=this.maxListeners)return;try{const e=await h(y);for await(const t of this._libp2p.contentRouting.findProviders(e)){if(!t.multiaddrs.length)continue;const e=t.id;if(await this._peerStore.addressBook.add(e,t.multiaddrs),await this._tryToListenOnRelay(e),this._listenRelays.size>=this.maxListeners)return}}catch(n){this._onError(n)}}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 ".concat(e.toB58String()))}}}},4364:(e,t,r)=>{"use strict";const n=r(18392),i=Object.assign(n("libp2p:circuit:hop"),{error:n("libp2p:circuit:hop:err")}),s=r(67963),o=r(90190),{validateAddrs:a}=r(55341),c=r(67903),{CircuitRelay:u}=r(91267),{pipe:l}=r(79023),{codes:h}=r(59087),{stop:d}=r(90807),f=r(16074);e.exports={handleHop:async function(e){let{connection:t,request:r,streamHandler:n,circuit:s}=e;if(!s._options.hop.enabled)return i("HOP request received but we are not acting as a relay"),n.end({type:u.Type.STATUS,code:u.Status.HOP_CANT_SPEAK_RELAY});try{a(r,n)}catch(g){return i.error("invalid hop request via peer %s",t.remotePeer.toB58String(),g)}if(!r.dstPeer)return void i("HOP request received but we do not receive a dstPeer");const c=new o(r.dstPeer.id),h=s._connectionManager.get(c);if(!h&&!s._options.hop.active)return i("HOP request received but we are not connected to the destination peer"),n.end({type:u.Type.STATUS,code:u.Status.HOP_NO_CONN_TO_DST});if(!h)return;const f={type:u.Type.STOP,dstPeer:r.dstPeer,srcPeer:r.srcPeer};let p;try{p=await d({connection:h,request:f})}catch(g){return i.error(g)}i("hop request from %s is valid",t.remotePeer.toB58String()),n.write({type:u.Type.STATUS,code:u.Status.SUCCESS});const y=n.rest();return l(y,p,y)},hop:async function(e){let{connection:t,request:r}=e;const{stream:n}=await t.newStream([f.relay]),o=new c({stream:n});o.write(r);const a=await o.read();if(!a)throw s(new Error("HOP request had no response"),h.ERR_HOP_REQUEST_FAILED);if(a.code===u.Status.SUCCESS)return i("hop request was successful"),o.rest();throw i("hop request failed with code %d, closing stream",a.code),o.close(),s(new Error("HOP request failed with code ".concat(a.code)),h.ERR_HOP_REQUEST_FAILED)},canHop:async function(e){let{connection:t}=e;const{stream:r}=await t.newStream([f.relay]),n=new c({stream:r});n.write({type:u.Type.CAN_HOP});const i=await n.read();return await n.close(),!(!i||i.code!==u.Status.SUCCESS)},handleCanHop:function(e){let{connection:t,streamHandler:r,circuit:n}=e;const s=n._options.hop.enabled;i("can hop (%s) request from %s",s,t.remotePeer.toB58String()),r.end({type:u.Type.STATUS,code:s?u.Status.SUCCESS:u.Status.HOP_CANT_SPEAK_RELAY})}}},90807:(e,t,r)=>{"use strict";const n=r(18392),i=Object.assign(n("libp2p:circuit:stop"),{error:n("libp2p:circuit:stop:err")}),{CircuitRelay:s}=r(91267),o=r(16074),a=r(67903),{validateAddrs:c}=r(55341);e.exports.handleStop=function(e){let{connection:t,request:r,streamHandler:n}=e;try{c(r,n)}catch(o){return i.error("invalid stop request via peer %s",t.remotePeer.toB58String(),o)}return i("stop request is valid"),n.write({type:s.Type.STATUS,code:s.Status.SUCCESS}),n.rest()},e.exports.stop=async function(e){let{connection:t,request:r}=e;const{stream:n}=await t.newStream([o.relay]);i("starting stop request to %s",t.remotePeer.toB58String());const c=new a({stream:n});c.write(r);const u=await c.read();return u?u.code===s.Status.SUCCESS?(i("stop request to %s was successful",t.remotePeer.toB58String()),c.rest()):(i("stop request failed with code %d",u.code),void c.close()):c.close()}},67903:(e,t,r)=>{"use strict";const n=r(18392),i=Object.assign(n("libp2p:circuit:stream-handler"),{error:n("libp2p:circuit:stream-handler:err")}),s=r(44709),o=r(39610),{CircuitRelay:a}=r(91267);e.exports=class{constructor(e){let{stream:t,maxLength:r=4096}=e;this.stream=t,this.shake=o(this.stream),this.decoder=s.decode.fromReader(this.shake.reader,{maxDataLength:r})}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(s.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([])}}},55341:(e,t,r)=>{"use strict";const{Multiaddr:n}=r(98719),{CircuitRelay:i}=r(91267);function s(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 s(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 s(t,e.type===i.Type.HOP?i.Status.HOP_SRC_MULTIADDR_INVALID:i.Status.STOP_SRC_MULTIADDR_INVALID),r}}}},3369: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"}},90432:(e,t,r)=>{"use strict";const n=r(18392),i=Object.assign(n("libp2p:relay"),{error:n("libp2p:relay:err")}),{codes:s}=r(59087),{setDelayedInterval:o,clearDelayedInterval:a}=r(18928),c=r(26604),{namespaceToCid:u}=r(7958),{RELAY_RENDEZVOUS_NS:l}=r(3369);e.exports=class{constructor(e){this._libp2p=e,this._options={...e._config.relay},this._autoRelay=this._options.autoRelay.enabled&&new c({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(){a(this._timeout)}async _advertiseService(){try{const e=await u(l);await this._libp2p.contentRouting.provide(e)}catch(e){e.code===s.ERR_NO_ROUTERS_AVAILABLE?(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)}}}},95031:(e,t,r)=>{"use strict";const{EventEmitter:n}=r(47465),{Multiaddr:i}=r(98719);e.exports=e=>{const t=new Map;const r=Object.assign(new n,{close:()=>Promise.resolve(),listen:async function(n){const s=String(n).split("/p2p-circuit").find((e=>""!==e)),o=await e.dial(new i(s)),a=o.remoteAddr.encapsulate("/p2p-circuit");t.set(o.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}},16074:e=>{"use strict";e.exports={relay:"/libp2p/circuit/relay/0.1.0"}},91267:(e,t,r)=>{"use strict";var n=r(80886),i=n.Reader,s=n.Writer,o=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<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.type=1,e.prototype.srcPeer=null,e.prototype.dstPeer=null,e.prototype.code=100,e.encode=function(e,t){return t||(t=s.create()),null!=e.type&&Object.hasOwnProperty.call(e,"type")&&t.uint32(8).int32(e.type),null!=e.srcPeer&&Object.hasOwnProperty.call(e,"srcPeer")&&a.CircuitRelay.Peer.encode(e.srcPeer,t.uint32(18).fork()).ldelim(),null!=e.dstPeer&&Object.hasOwnProperty.call(e,"dstPeer")&&a.CircuitRelay.Peer.encode(e.dstPeer,t.uint32(26).fork()).ldelim(),null!=e.code&&Object.hasOwnProperty.call(e,"code")&&t.uint32(32).int32(e.code),t},e.decode=function(e,t){e instanceof i||(e=i.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new a.CircuitRelay;e.pos<r;){var s=e.uint32();switch(s>>>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&s)}}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=function(){var e={},t=Object.create(e);return t[e[100]="SUCCESS"]=100,t[e[220]="HOP_SRC_ADDR_TOO_LONG"]=220,t[e[221]="HOP_DST_ADDR_TOO_LONG"]=221,t[e[250]="HOP_SRC_MULTIADDR_INVALID"]=250,t[e[251]="HOP_DST_MULTIADDR_INVALID"]=251,t[e[260]="HOP_NO_CONN_TO_DST"]=260,t[e[261]="HOP_CANT_DIAL_DST"]=261,t[e[262]="HOP_CANT_OPEN_DST_STREAM"]=262,t[e[270]="HOP_CANT_SPEAK_RELAY"]=270,t[e[280]="HOP_CANT_RELAY_TO_SELF"]=280,t[e[320]="STOP_SRC_ADDR_TOO_LONG"]=320,t[e[321]="STOP_DST_ADDR_TOO_LONG"]=321,t[e[350]="STOP_SRC_MULTIADDR_INVALID"]=350,t[e[351]="STOP_DST_MULTIADDR_INVALID"]=351,t[e[390]="STOP_RELAY_REFUSED"]=390,t[e[400]="MALFORMED_MESSAGE"]=400,t}(),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<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.id=o.newBuffer([]),e.prototype.addrs=o.emptyArray,e.encode=function(e,t){if(t||(t=s.create()),t.uint32(10).bytes(e.id),null!=e.addrs&&e.addrs.length)for(var r=0;r<e.addrs.length;++r)t.uint32(18).bytes(e.addrs[r]);return t},e.decode=function(e,t){e instanceof i||(e=i.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new a.CircuitRelay.Peer;e.pos<r;){var s=e.uint32();switch(s>>>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&s)}}if(!n.hasOwnProperty("id"))throw o.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?o.base64.decode(e.id,t.id=o.newBuffer(o.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<e.addrs.length;++r)"string"===typeof e.addrs[r]?o.base64.decode(e.addrs[r],t.addrs[r]=o.newBuffer(o.base64.length(e.addrs[r])),0):e.addrs[r].length&&(t.addrs[r]=e.addrs[r])}return t},e.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.addrs=[]),t.defaults&&(t.bytes===String?r.id="":(r.id=[],t.bytes!==Array&&(r.id=o.newBuffer(r.id)))),null!=e.id&&e.hasOwnProperty("id")&&(r.id=t.bytes===String?o.base64.encode(e.id,0,e.id.length):t.bytes===Array?Array.prototype.slice.call(e.id):e.id),e.addrs&&e.addrs.length){r.addrs=[];for(var n=0;n<e.addrs.length;++n)r.addrs[n]=t.bytes===String?o.base64.encode(e.addrs[n],0,e.addrs[n].length):t.bytes===Array?Array.prototype.slice.call(e.addrs[n]):e.addrs[n]}return r},e.prototype.toJSON=function(){return this.constructor.toObject(this,n.util.toJSONOptions)},e}(),e}(),e.exports=a},46162:(e,t,r)=>{"use strict";const n=r(18392),i=Object.assign(n("libp2p:circuit"),{error:n("libp2p:circuit:err")}),s=r(67963),o=r(18322),{Multiaddr:a}=r(98719),c=r(90190),{CircuitRelay:u}=r(91267),{codes:l}=r(59087),h=r(68308),{relay:d}=r(16074),f=r(95031),{handleCanHop:p,handleHop:y,hop:g}=r(4364),{handleStop:m}=r(90807),v=r(67903),b=Symbol.for("@libp2p/js-libp2p-circuit/circuit");class w{constructor(e){let{libp2p:t,upgrader:r}=e;this._dialer=t.dialer,this._registrar=t.registrar,this._connectionManager=t.connectionManager,this._upgrader=r,this._options=t._config.relay,this._libp2p=t,this.peerId=t.peerId,this._registrar.handle(d,this._onProtocol.bind(this))}async _onProtocol(e){let{connection:t,stream:r}=e;const n=new v({stream:r}),s=await n.read();if(!s)return;const o=this;let c;switch(s.type){case u.Type.CAN_HOP:i("received CAN_HOP request from %s",t.remotePeer.toB58String()),await p({circuit:o,connection:t,streamHandler:n});break;case u.Type.HOP:i("received HOP request from %s",t.remotePeer.toB58String()),c=await y({connection:t,request:s,streamHandler:n,circuit:o});break;case u.Type.STOP:i("received STOP request from %s",t.remotePeer.toB58String()),c=await m({connection:t,request:s,streamHandler:n});break;default:i("Request of type %s not supported",s.type)}if(c){const e=new a(s.dstPeer.addrs[0]),t=new a(s.srcPeer.addrs[0]),r=h({stream:c,remoteAddr:e,localAddr:t}),n=s.type===u.Type.HOP?"relay":"inbound";i("new %s connection %s",n,r.remoteAddr);const o=await this._upgrader.upgradeInbound(r);i("%s connection %s upgraded",n,r.remoteAddr),this.handler&&this.handler(o)}}async dial(e,t){const r=e.toString().split("/p2p-circuit"),n=new a(r[0]),o=new a(r[r.length-1]),d=n.getPeerId(),f=o.getPeerId();if(!d||!f){const e="Circuit relay dial failed as addresses did not have peer id";throw i.error(e),s(new Error(e),l.ERR_RELAYED_DIAL)}const p=c.createFromB58String(d),y=c.createFromB58String(f);let m=!1,v=this._connectionManager.get(p);v||(v=await this._dialer.connectToPeer(n,t),m=!0);try{const t=await g({connection:v,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(o).bytes]}}}),r=n.encapsulate("/p2p-circuit/p2p/".concat(this.peerId.toB58String())),s=h({stream:t,remoteAddr:e,localAddr:r});return i("new outbound connection %s",s.remoteAddr),this._upgrader.upgradeOutbound(s)}catch(b){throw i.error("Circuit relay dial failed",b),m&&await v.close(),b}}createListener(e,t){return"function"===typeof e&&(t=e,e={}),this.handler=t,f(this._libp2p)}filter(e){return(e=Array.isArray(e)?e:[e]).filter((e=>o.Circuit.matches(e)))}get[Symbol.toStringTag](){return"Circuit"}static isTransport(e){return Boolean(e&&e[b])}}e.exports=w},7958:(e,t,r)=>{"use strict";const{CID:n}=r(16629),{sha256:i}=r(19400);e.exports.namespaceToCid=async e=>{const t=(new TextEncoder).encode(e),r=await i.digest(t);return n.createV0(r)}},7037:(e,t,r)=>{"use strict";const n=r(89842),{dnsaddrResolver:i}=r(44689),s=r(70127),{AGENT_VERSION:o}=r(43367),a=r(3369),{publicAddressesFirst:c}=r(27780),{FaultTolerance:u}=r(48350),l={addresses:{listen:[],announce:[],noAnnounce:[],announceFilter:e=>e},connectionManager:{minConnections:25},connectionGater:{},transportManager:{faultTolerance:u.FATAL_ALL},dialer:{maxParallelDials:s.MAX_PARALLEL_DIALS,maxDialsPerPeer:s.MAX_PER_PEER_DIALS,dialTimeout:s.DIAL_TIMEOUT,resolvers:{dnsaddr:i},addressSorter:c},host:{agentVersion:o},metrics:{enabled:!1},peerStore:{persistence:!1,threshold:5},peerRouting:{refreshManager:{enabled:!0,interval:6e5,bootDelay:1e4}},config:{protocolPrefix:"ipfs",dht:{enabled:!1,kBucketSize:20},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(l,e);if(t.modules.transport.length<1)throw new Error("'options.modules.transport' must contain at least 1 transport");return t}},75570:(e,t,r)=>{"use strict";const n=r(18392),i=r(89842),s=r(31779),o=r(50464),{pipe:a}=r(79023),c=r(12393),u=r(22035),l=Object.assign(n("libp2p:connection-manager:auto-dialler"),{error:n("libp2p:connection-manager:auto-dialler:err")}),h={enabled:!0,minConnections:0,autoDialInterval:1e4};e.exports=class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this._options=i.call({ignoreUndefined:!0},h,t),this._libp2p=e,this._running=!1,this._autoDialTimeout=null,this._autoDial=this._autoDial.bind(this),l("options: %j",this._options)}async start(){this._options.enabled?(this._running=!0,this._autoDial().catch((e=>{l.error("could start autodial",e)})),l("started")):l("not enabled")}async stop(){this._options.enabled?(this._running=!1,this._autoDialTimeout&&this._autoDialTimeout.clear(),l("stopped")):l("not enabled")}async _autoDial(){const e=this._options.minConnections;if(this._libp2p.connections.size>=e)return void(this._autoDialTimeout=s(this._autoDial,this._options.autoDialInterval));const t=await a(this._libp2p.peerStore.getPeers(),(e=>c(e,(e=>!e.id.equals(this._libp2p.peerId)))),(e=>u(e,((e,t)=>!t.protocols||!t.protocols.length||e.protocols&&e.protocols.length?t.id.pubKey&&!e.id.pubKey?1:-1:1))),(e=>o(e)));for(let n=0;this._running&&n<t.length&&this._libp2p.connections.size<e;n++){const e=t[n];if(!this._libp2p.connectionManager.get(e.id)){l("connecting to a peerStore stored peer %s",e.id.toB58String());try{await this._libp2p.dialer.connectToPeer(e.id)}catch(r){l.error("could not connect to peerStore stored peer",r)}}}this._running&&(this._autoDialTimeout=s(this._autoDial,this._options.autoDialInterval))}}},71997:(e,t,r)=>{"use strict";const n=r(18392),i=Object.assign(n("libp2p:connection-manager"),{error:n("libp2p:connection-manager:err")}),s=r(67963),o=r(89842),a=r(382),c=r(31779),{EventEmitter:u}=r(47465),l=r(3342),h=r(90190),{codes:{ERR_INVALID_PARAMETERS:d}}=r(59087),f={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},p="connection-manager";e.exports=class extends u{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(super(),this._libp2p=e,this._peerId=e.peerId.toB58String(),this._options=o.call({ignoreUndefined:!0},f,t),this._options.maxConnections<this._options.minConnections)throw s(new Error("Connection Manager maxConnections must be greater than minConnections"),d);i("options: %j",this._options),this._peerValues=l({component:p,metric:"peer-values",metrics:this._libp2p.metrics}),this.connections=l({component:p,metric:"peer-connections",metrics:this._libp2p.metrics}),this._started=!1,this._timer=null,this._checkMetrics=this._checkMetrics.bind(this),this._latencyMonitor=new a({latencyCheckIntervalMs:this._options.pollInterval,dataEmitIntervalMs:this._options.pollInterval}),this.setMaxListeners(1/0)}get size(){return Array.from(this.connections.values()).reduce(((e,t)=>e+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")}async stop(){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)}async _checkMetrics(){if(this._libp2p.metrics)try{const e=this._libp2p.metrics.global.movingAverages,t=e.dataReceived[this._options.movingAverageInterval].movingAverage();await this._checkMaxLimit("maxReceivedData",t);const r=e.dataSent[this._options.movingAverageInterval].movingAverage();await this._checkMaxLimit("maxSentData",r);const n=t+r;await this._checkMaxLimit("maxData",n),i("metrics update",n)}finally{this._timer=c(this._checkMetrics,this._options.pollInterval)}}async onConnect(e){if(!this._started)return void await e.close();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]),await this._libp2p.peerStore.keyBook.set(t,t.pubKey),this._peerValues.has(r)||this._peerValues.set(r,this._options.defaultPeerValue),await this._checkMaxLimit("maxConnections",this.size)}onDisconnect(e){if(!this._started)return;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),this._libp2p.metrics&&this._libp2p.metrics.onPeerDisconnected(e.remotePeer))}get(e){const t=this.getAll(e);return t.length?t[0]:null}getAll(e){if(!h.isPeerId(e))throw s(new Error("peerId must be an instance of peer-id"),d);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).catch((e=>{i.error(e)}))}async _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),await this._maybeDisconnectOne())}async _maybeDisconnectOne(){if(this._options.minConnections<this.connections.size){const e=Array.from(new Map([...this._peerValues.entries()].sort(((e,t)=>e[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().catch((e=>{i.error(e)})),this.onDisconnect(t[0]);break}}}}}},382:(e,t,r)=>{"use strict";const{EventEmitter:n}=r(47465),i=r(19021),s=r(18392)("latency-monitor:LatencyMonitor");e.exports=class extends n{constructor(){let{latencyCheckIntervalMs:e,dataEmitIntervalMs:t,asyncTestFn:r,latencyRandomPercentage:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};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,s("latencyCheckIntervalMs: %s dataEmitIntervalMs: %s",i.latencyCheckIntervalMs,i.dataEmitIntervalMs),i.dataEmitIntervalMs?s("Expecting ~%s events per summary",i.latencyCheckIntervalMs/i.dataEmitIntervalMs):s("Not emitting summaries"),i.asyncTestFn=r}start(){globalThis.process&&globalThis.process.hrtime?(s("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?(s("Using performance.now for timing"),this.now=window.performance.now.bind(window.performance),this.getDeltaMS=e=>Math.round(this.now()-e)):(s("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(),s("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,s("MS: %s Data: %O",t,e._latencyData)};s("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}}}},19021:(e,t,r)=>{"use strict";const{EventEmitter:n}=r(47465),i=r(18392)("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;"undefined"!==typeof document.hidden?(e="hidden",t="visibilitychange"):"undefined"!==typeof document.mozHidden?(e="mozHidden",t="mozvisibilitychange"):"undefined"!==typeof document.msHidden?(e="msHidden",t="msvisibilitychange"):"undefined"!==typeof document.webkitHidden&&(e="webkitHidden",t="webkitvisibilitychange"),this._hidden=e,this._visibilityChange=t}_addVisibilityChangeListener(){"undefined"===typeof document.addEventListener||"undefined"===typeof 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)}}},70127: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}}},78909:(e,t,r)=>{"use strict";const n=r(67963),{messages:i,codes:s}=r(59087),{storeAddresses:o,uniquePeers:a,requirePeers:c,maybeLimitSource:u}=r(31935),l=r(79272),h=r(96155),{pipe:d}=r(79023),{DHTContentRouting:f}=r(9336);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(new f(this.dht))}async*findProviders(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.routers.length)throw n(new Error("No content this.routers available"),s.ERR_NO_ROUTERS_AVAILABLE);yield*d(h(...this.routers.map((r=>r.findProviders(e,t)))),(e=>o(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"),s.ERR_NO_ROUTERS_AVAILABLE);await Promise.all(this.routers.map((t=>t.provide(e))))}async put(e,t,r){if(!this.libp2p.isStarted()||!this.dht.isStarted)throw n(new Error(i.NOT_STARTED_YET),s.DHT_NOT_STARTED);await l(this.dht.put(e,t,r))}async get(e,t){if(!this.libp2p.isStarted()||!this.dht.isStarted)throw n(new Error(i.NOT_STARTED_YET),s.DHT_NOT_STARTED);for await(const r of this.dht.get(e,t))if("VALUE"===r.name)return{from:r.peerId,val:r.value};throw n(new Error(i.NOT_FOUND),s.ERR_NOT_FOUND)}async*getMany(e,t,r){if(!this.libp2p.isStarted()||!this.dht.isStarted)throw n(new Error(i.NOT_STARTED_YET),s.DHT_NOT_STARTED);if(!t)return;let o=0;for await(const n of this.dht.get(e,r))if("VALUE"===n.name&&(yield{from:n.peerId,val:n.value},o++,o===t))break;if(0===o)throw n(new Error(i.NOT_FOUND),s.ERR_NOT_FOUND)}}},31935:(e,t,r)=>{"use strict";const n=r(67963),i=r(12393),s=r(27889),o=r(35959);e.exports={storeAddresses:async function*(e,t){yield*s(e,(async e=>(await 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){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=0;for await(const n of e)r++,yield n;if(r<t)throw n(new Error("not found"),"NOT_FOUND")},maybeLimitSource:function(e,t){return t?o(e,t):e}}},9336:(e,t,r)=>{"use strict";const n=r(79272);e.exports={DHTContentRouting:class{constructor(e){this._dht=e}async provide(e){await n(this._dht.provide(e))}async*findProviders(e,t){for await(const r of this._dht.findProviders(e,t))"PROVIDER"===r.name&&(yield*r.providers)}}}},39862:(e,t,r)=>{"use strict";const n=r(67963),{messages:i,codes:s}=r(59087);e.exports={DHTPeerRouting:class{constructor(e){this._dht=e}async findPeer(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for await(const r of this._dht.findPeer(e,t))if("FINAL_PEER"===r.name)return r.peer;throw n(new Error(i.NOT_FOUND),s.ERR_NOT_FOUND)}async*getClosestPeers(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for await(const r of this._dht.getClosestPeers(e,t))"PEER_RESPONSE"===r.name&&(yield*r.closer)}}}},12141:(e,t,r)=>{"use strict";const n=r(67963),{anySignal:i}=r(66622),s=r(49879),o=r(61552),{setMaxListeners:a}=r(47465),{codes:c}=r(59087);e.exports=class{constructor(e){let{addrs:t,dialAction:r,dialer:n}=e;this.addrs=t,this.dialer=n,this.dialAction=r}async run(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=this.dialer.getTokens(this.addrs.length);if(t.length<1)throw n(new Error("No dial tokens available"),c.ERR_NO_DIAL_TOKENS);const r=new s;t.forEach((e=>r.push(e)));const u=this.addrs.map((()=>{const e=new AbortController;try{a&&a(1/0,e.signal)}catch{}return e}));let l=0;try{return await o(this.addrs.map((async(n,s)=>{const o=await r.shift();let a;try{const c=u[s].signal;a=await this.dialAction(n,{...e,signal:e.signal?i([c,e.signal]):c}),u.splice(s,1)}finally{l++,this.addrs.length-l>=t.length?r.push(o):this.dialer.releaseToken(t.splice(t.indexOf(o),1)[0])}return a})))}finally{u.map((e=>e.abort())),t.forEach((e=>this.dialer.releaseToken(e)))}}}},50453:(e,t,r)=>{"use strict";const n=r(18392),i=r(50464),s=r(12393),{pipe:o}=r(79023),a=Object.assign(n("libp2p:dialer"),{error:n("libp2p:dialer:err")}),c=r(67963),{Multiaddr:u}=r(98719),{TimeoutController:l}=r(87683),{AbortError:h}=r(64183),{anySignal:d}=r(66622),{setMaxListeners:f}=r(47465),p=r(12141),{publicAddressesFirst:y}=r(27780),g=r(85012),m=r(3342),{codes:v}=r(59087),{DIAL_TIMEOUT:b,MAX_PARALLEL_DIALS:w,MAX_PER_PEER_DIALS:E,MAX_ADDRS_TO_DIAL:S}=r(70127),_="dialler";e.exports=class{constructor(e){let{transportManager:t,peerStore:r,connectionGater:n,addressSorter:i=y,maxParallelDials:s=w,maxAddrsToDial:o=S,dialTimeout:a=b,maxDialsPerPeer:c=E,resolvers:l={},metrics:h}=e;this.connectionGater=n,this.transportManager=t,this.peerStore=r,this.addressSorter=i,this.maxParallelDials=s,this.maxAddrsToDial=o,this.timeout=a,this.maxDialsPerPeer=c,this.tokens=[...new Array(s)].map(((e,t)=>t)),this._pendingDials=m({component:_,metric:"pending-dials",metrics:h}),this._pendingDialTargets=m({component:_,metric:"pending-dial-targets",metrics:h});for(const[d,f]of Object.entries(l))u.resolvers.set(d,f)}destroy(){for(const t of this._pendingDials.values())try{t.controller.abort()}catch(e){a.error(e)}this._pendingDials.clear();for(const t of this._pendingDialTargets.values())t.reject(new h("Dialer was destroyed"));this._pendingDialTargets.clear()}async connectToPeer(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{id:r}=g(e);if(await this.connectionGater.denyDialPeer(r))throw c(new Error("The dial request is blocked by gater.allowDialPeer"),v.ERR_PEER_DIAL_INTERCEPTED);const n=await this._createCancellableDialTarget(e);if(!n.addrs.length)throw c(new Error("The dial request has no valid addresses"),v.ERR_NO_VALID_ADDRESSES);const i=this._pendingDials.get(n.id)||this._createPendingDial(n,t);try{const e=await i.promise;return a("dial succeeded to %s",n.id),e}catch(s){throw i.controller.signal.aborted&&(s.code=v.ERR_TIMEOUT),a.error(s),s}finally{i.destroy()}}async _createCancellableDialTarget(e){const t="".concat(parseInt(String(1e9*Math.random()),10).toString()+Date.now()),r=new Promise(((e,r)=>{this._pendingDialTargets.set(t,{resolve:e,reject:r})}));try{return await Promise.race([this._createDialTarget(e),r])}finally{this._pendingDialTargets.delete(t)}}async _createDialTarget(e){const{id:t,multiaddrs:r}=g(e);r&&await this.peerStore.addressBook.add(t,r);let n=await o(await this.peerStore.addressBook.getMultiaddrsForPeer(t,this.addressSorter),(e=>s(e,(async e=>!await this.connectionGater.denyDialMultiaddr(t,e)))),(e=>i(e)));u.isMultiaddr(e)&&(n=n.filter((t=>!e.equals(t))),n.unshift(e));const a=[];for(const i of n){(await this._resolve(i)).forEach((e=>a.push(e)))}const l=a.filter((e=>this.transportManager.transportForMultiaddr(e)));if(l.length>this.maxAddrsToDial)throw await this.peerStore.delete(t),c(new Error("dial with more addresses than allowed"),v.ERR_TOO_MANY_ADDRESSES);return{id:t.toB58String(),addrs:l}}_createPendingDial(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=new p({addrs:e.addrs,dialAction:(e,t)=>{if(t.signal.aborted)throw c(new Error("already aborted"),v.ERR_ALREADY_ABORTED);return this.transportManager.dial(e,t)},dialer:this}),n=new l(this.timeout),i=[n.signal];t.signal&&i.push(t.signal);const s=d(i);try{f&&f(1/0,s)}catch{}const o={dialRequest:r,controller:n,promise:r.run({...t,signal:s}),destroy:()=>{n.clear(),this._pendingDials.delete(e.id)}};return this._pendingDials.set(e.id,o),o}getTokens(e){const t=Math.min(e,this.maxDialsPerPeer,this.tokens.length),r=this.tokens.splice(0,t);return a("%d tokens request, returning %d, %d remaining",e,t,this.tokens.length),r}releaseToken(e){this.tokens.indexOf(e)>-1||(a("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{e=new u(e.toString());return await e.resolve()}catch(t){return a.error("multiaddr ".concat(e," could not be resolved")),[]}}}},59087:(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",NOT_FOUND:"Not found"},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_PEER_DIAL_INTERCEPTED:"ERR_PEER_DIAL_INTERCEPTED",ERR_CONNECTION_INTERCEPTED:"ERR_CONNECTION_INTERCEPTED",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_NOT_FOUND:"ERR_NOT_FOUND",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",ERR_FIND_SELF:"ERR_FIND_SELF",ERR_NO_ROUTERS_AVAILABLE:"ERR_NO_ROUTERS_AVAILABLE",ERR_CONNECTION_NOT_MULTIPLEXED:"ERR_CONNECTION_NOT_MULTIPLEXED",ERR_NO_DIAL_TOKENS:"ERR_NO_DIAL_TOKENS",ERR_KEYCHAIN_REQUIRED:"ERR_KEYCHAIN_REQUIRED",ERR_INVALID_CMS:"ERR_INVALID_CMS",ERR_MISSING_KEYS:"ERR_MISSING_KEYS",ERR_NO_KEY:"ERR_NO_KEY",ERR_INVALID_KEY_NAME:"ERR_INVALID_KEY_NAME",ERR_INVALID_KEY_TYPE:"ERR_INVALID_KEY_TYPE",ERR_KEY_ALREADY_EXISTS:"ERR_KEY_ALREADY_EXISTS",ERR_INVALID_KEY_SIZE:"ERR_INVALID_KEY_SIZE",ERR_KEY_NOT_FOUND:"ERR_KEY_NOT_FOUND",ERR_OLD_KEY_NAME_INVALID:"ERR_OLD_KEY_NAME_INVALID",ERR_NEW_KEY_NAME_INVALID:"ERR_NEW_KEY_NAME_INVALID",ERR_PASSWORD_REQUIRED:"ERR_PASSWORD_REQUIRED",ERR_PEM_REQUIRED:"ERR_PEM_REQUIRED",ERR_CANNOT_READ_KEY:"ERR_CANNOT_READ_KEY",ERR_MISSING_PRIVATE_KEY:"ERR_MISSING_PRIVATE_KEY",ERR_INVALID_OLD_PASS_TYPE:"ERR_INVALID_OLD_PASS_TYPE",ERR_INVALID_NEW_PASS_TYPE:"ERR_INVALID_NEW_PASS_TYPE",ERR_INVALID_PASS_LENGTH:"ERR_INVALID_PASS_LENGTH",ERR_NOT_IMPLEMENTED:"ERR_NOT_IMPLEMENTED",ERR_WRONG_PING_ACK:"ERR_WRONG_PING_ACK"}},11002:e=>{"use strict";e.exports={PROTOCOL:"/libp2p/fetch/0.0.1"}},85889:(e,t,r)=>{"use strict";const n=r(18392),i=Object.assign(n("libp2p:fetch"),{error:n("libp2p:fetch:err")}),s=r(67963),{codes:o}=r(59087),a=r(44709),{FetchRequest:c,FetchResponse:u}=r(83201),l=r(39610),{PROTOCOL:h}=r(11002);class d{constructor(e){this._lookupFunctions=new Map,this._libp2p=e,this.handleMessage=this.handleMessage.bind(this)}async fetch(e,t){i("dialing %s to %s",this._protocol,e.toB58String?e.toB58String():e);const r=await this._libp2p.dial(e),{stream:n}=await r.newStream(d.PROTOCOL),h=l(n),f=new c({identifier:t});h.write(a.encode.single(c.encode(f).finish()));const p=u.decode((await a.decode.fromReader(h.reader).next()).value.slice());switch(p.status){case u.StatusCode.OK:return p.data;case u.StatusCode.NOT_FOUND:return null;case u.StatusCode.ERROR:{const e=(new TextDecoder).decode(p.data);throw s(new Error("Error in fetch protocol response: "+e),o.ERR_INVALID_PARAMETERS)}default:throw s(new Error("Unknown response status"),o.ERR_INVALID_MESSAGE)}}async handleMessage(e){const{stream:t}=e,r=l(t),n=c.decode((await a.decode.fromReader(r.reader).next()).value.slice());let i;const s=this._getLookupFunction(n.identifier);if(s){const e=await s(n.identifier);i=new u(e?{status:u.StatusCode.OK,data:e}:{status:u.StatusCode.NOT_FOUND})}else{const e=(new TextEncoder).encode("No lookup function registered for key: "+n.identifier);i=new u({status:u.StatusCode.ERROR,data:e})}r.write(a.encode.single(u.encode(i).finish()))}_getLookupFunction(e){for(const t of this._lookupFunctions.keys())if(e.startsWith(t))return this._lookupFunctions.get(t);return null}registerLookupFunction(e,t){if(this._lookupFunctions.has(e))throw s(new Error("Fetch protocol handler for key prefix '"+e+"' already registered"),o.ERR_KEY_ALREADY_EXISTS);this._lookupFunctions.set(e,t)}unregisterLookupFunction(e,t){if(null!=t){if(this._lookupFunctions.get(e)!==t)return}this._lookupFunctions.delete(e)}}d.PROTOCOL=h,e.exports=d},83201:(e,t,r)=>{"use strict";var n=r(80886),i=n.Reader,s=n.Writer,o=n.util,a=n.roots["libp2p-fetch"]||(n.roots["libp2p-fetch"]={});a.FetchRequest=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.identifier="",e.encode=function(e,t){return t||(t=s.create()),null!=e.identifier&&Object.hasOwnProperty.call(e,"identifier")&&t.uint32(10).string(e.identifier),t},e.decode=function(e,t){e instanceof i||(e=i.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new a.FetchRequest;e.pos<r;){var s=e.uint32();if(s>>>3===1)n.identifier=e.string();else e.skipType(7&s)}return n},e.fromObject=function(e){if(e instanceof a.FetchRequest)return e;var t=new a.FetchRequest;return null!=e.identifier&&(t.identifier=String(e.identifier)),t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(r.identifier=""),null!=e.identifier&&e.hasOwnProperty("identifier")&&(r.identifier=e.identifier),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,n.util.toJSONOptions)},e}(),a.FetchResponse=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.status=0,e.prototype.data=o.newBuffer([]),e.encode=function(e,t){return t||(t=s.create()),null!=e.status&&Object.hasOwnProperty.call(e,"status")&&t.uint32(8).int32(e.status),null!=e.data&&Object.hasOwnProperty.call(e,"data")&&t.uint32(18).bytes(e.data),t},e.decode=function(e,t){e instanceof i||(e=i.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new a.FetchResponse;e.pos<r;){var s=e.uint32();switch(s>>>3){case 1:n.status=e.int32();break;case 2:n.data=e.bytes();break;default:e.skipType(7&s)}}return n},e.fromObject=function(e){if(e instanceof a.FetchResponse)return e;var t=new a.FetchResponse;switch(e.status){case"OK":case 0:t.status=0;break;case"NOT_FOUND":case 1:t.status=1;break;case"ERROR":case 2:t.status=2}return null!=e.data&&("string"===typeof e.data?o.base64.decode(e.data,t.data=o.newBuffer(o.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.status=t.enums===String?"OK":0,t.bytes===String?r.data="":(r.data=[],t.bytes!==Array&&(r.data=o.newBuffer(r.data)))),null!=e.status&&e.hasOwnProperty("status")&&(r.status=t.enums===String?a.FetchResponse.StatusCode[e.status]:e.status),null!=e.data&&e.hasOwnProperty("data")&&(r.data=t.bytes===String?o.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,n.util.toJSONOptions)},e.StatusCode=function(){var e={},t=Object.create(e);return t[e[0]="OK"]=0,t[e[1]="NOT_FOUND"]=1,t[e[2]="ERROR"]=2,t}(),e}(),e.exports=a},85012:(e,t,r)=>{"use strict";const n=r(90190),{Multiaddr:i}=r(98719),s=r(67963),{codes:o}=r(59087);e.exports=function(e){let t;if("string"===typeof e&&(e=new i(e)),i.isMultiaddr(e)){t=e;const i=e.getPeerId();if(!i)throw s(new Error("".concat(e," does not have a valid peer type")),o.ERR_INVALID_MULTIADDR);try{e=n.createFromB58String(i)}catch(r){throw s(new Error("".concat(e," is not a valid peer type")),o.ERR_INVALID_MULTIADDR)}}return{id:e,multiaddrs:t?[t]:void 0}}},43367:(e,t,r)=>{"use strict";const n=r(28362).version;e.exports.PROTOCOL_VERSION="ipfs/0.1.0",e.exports.AGENT_VERSION="js-libp2p/".concat(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"},6215:(e,t,r)=>{"use strict";const n=r(18392),i=Object.assign(n("libp2p:identify"),{error:n("libp2p:identify:err")}),s=r(67963),o=r(44709),{pipe:a}=r(79023),{collect:c,take:u,consume:l}=r(79755),{fromString:h}=r(46765),d=r(90190),{Multiaddr:f}=r(98719),{toBuffer:p}=r(90351),y=r(32912),g=r(76869),m=r(73374),{MULTICODEC_IDENTIFY:v,MULTICODEC_IDENTIFY_PUSH:b,IDENTIFY_PROTOCOL_VERSION:w,MULTICODEC_IDENTIFY_PROTOCOL_NAME:E,MULTICODEC_IDENTIFY_PUSH_PROTOCOL_NAME:S,MULTICODEC_IDENTIFY_PROTOCOL_VERSION:_,MULTICODEC_IDENTIFY_PUSH_PROTOCOL_VERSION:I}=r(43367),{codes:T}=r(59087);class A{static getProtocolStr(e){return{identifyProtocolStr:"/".concat(e._config.protocolPrefix,"/").concat(E,"/").concat(_),identifyPushProtocolStr:"/".concat(e._config.protocolPrefix,"/").concat(S,"/").concat(I)}}constructor(e){let{libp2p:t}=e;this._libp2p=t,this.peerStore=t.peerStore,this.addressManager=t.addressManager,this.connectionManager=t.connectionManager,this.peerId=t.peerId,this.handleMessage=this.handleMessage.bind(this);const r=A.getProtocolStr(t);this.identifyProtocolStr=r.identifyProtocolStr,this.identifyPushProtocolStr=r.identifyPushProtocolStr,this._host={protocolVersion:"".concat(t._config.protocolPrefix,"/").concat(w),...t._options.host},this.connectionManager.on("peer:connect",(e=>{this.identify(e).catch(i.error)})),this.peerStore.on("change:multiaddrs",(e=>{let{peerId:t}=e;t.toString()===this.peerId.toString()&&this.pushToPeerStore().catch((e=>i.error(e)))})),this.peerStore.on("change:protocols",(e=>{let{peerId:t}=e;t.toString()===this.peerId.toString()&&this.pushToPeerStore().catch((e=>i.error(e)))}))}async start(){await this.peerStore.metadataBook.setValue(this.peerId,"AgentVersion",h(this._host.agentVersion)),await this.peerStore.metadataBook.setValue(this.peerId,"ProtocolVersion",h(this._host.protocolVersion))}async stop(){}async push(e){const t=await this.peerStore.addressBook.getRawEnvelope(this.peerId),r=this._libp2p.multiaddrs.map((e=>e.bytes)),n=await this.peerStore.protoBook.get(this.peerId),s=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()],o.encode(),i,l)}catch(s){i.error("could not push identify update to peer",s)}}));return Promise.all(s)}async pushToPeerStore(){if(!this._libp2p.isStarted())return;const e=[];let t;for await(const r of this.peerStore.getPeers())r.protocols.includes(this.identifyPushProtocolStr)&&(t=this.connectionManager.get(r.id))&&e.push(t);await this.push(e)}async identify(e){const{stream:t}=await e.newStream(this.identifyProtocolStr),[r]=await a([],t,o.decode(),u(1),p,c);if(!r)throw s(new Error("No data could be retrieved"),T.ERR_CONNECTION_ENDED);let n;try{n=y.Identify.decode(r)}catch(I){throw s(I,T.ERR_INVALID_MESSAGE)}const{publicKey:l,listenAddrs:v,protocols:b,observedAddr:w,signedPeerRecord:E}=n,S=await d.createFromPubKey(l);if(e.remotePeer.toB58String()!==S.toB58String())throw s(new Error("identified peer does not match the expected peer"),T.ERR_INVALID_PEER);const _=A.getCleanMultiaddr(w);try{const e=await g.openAndCertify(E,m.DOMAIN);if(await this.peerStore.addressBook.consumePeerRecord(e))return await this.peerStore.protoBook.set(S,b),await this.peerStore.metadataBook.setValue(S,"AgentVersion",h(n.agentVersion)),void await this.peerStore.metadataBook.setValue(S,"ProtocolVersion",h(n.protocolVersion))}catch(I){i("received invalid envelope, discard it and fallback to listenAddrs is available",I)}try{await this.peerStore.addressBook.set(S,v.map((e=>new f(e))))}catch(I){i.error("received invalid addrs",I)}await this.peerStore.protoBook.set(S,b),await this.peerStore.metadataBook.setValue(S,"AgentVersion",h(n.agentVersion)),await this.peerStore.metadataBook.setValue(S,"ProtocolVersion",h(n.protocolVersion)),i("received observed address of %s",_)}handleMessage(e){let{connection:t,stream:r,protocol:n}=e;switch(n){case this.identifyProtocolStr:return this._handleIdentify({connection:t,stream:r});case this.identifyPushProtocolStr:return this._handlePush({connection:t,stream:r});default:i.error("cannot handle unknown protocol %s",n)}}async _handleIdentify(e){let{connection:t,stream:r}=e;try{let e=new Uint8Array(0);this.peerId.pubKey&&(e=this.peerId.pubKey.bytes);const n=await this.peerStore.addressBook.getRawEnvelope(this.peerId),i=await this.peerStore.protoBook.get(this.peerId),s=y.Identify.encode({protocolVersion:this._host.protocolVersion,agentVersion:this._host.agentVersion,publicKey:e,listenAddrs:this._libp2p.multiaddrs.map((e=>e.bytes)),signedPeerRecord:n,observedAddr:t.remoteAddr.bytes,protocols:i}).finish();await a([s],o.encode(),r,l)}catch(n){i.error("could not respond to identify request",n)}}async _handlePush(e){let t,{connection:r,stream:n}=e;try{const[e]=await a([],n,o.decode(),u(1),p,c);t=y.Identify.decode(e)}catch(l){return i.error("received invalid message",l)}const s=r.remotePeer;try{const e=await g.openAndCertify(t.signedPeerRecord,m.DOMAIN);if(await this.peerStore.addressBook.consumePeerRecord(e))return void await this.peerStore.protoBook.set(s,t.protocols)}catch(l){i("received invalid envelope, discard it and fallback to listenAddrs is available",l)}try{await this.peerStore.addressBook.set(s,t.listenAddrs.map((e=>new f(e))))}catch(l){i.error("received invalid addrs",l)}try{await this.peerStore.protoBook.set(s,t.protocols)}catch(l){i.error("received invalid protocols",l)}}static getCleanMultiaddr(e){if(e&&e.length>0)try{return new f(e)}catch(t){return null}return null}}const C={IDENTIFY:v,IDENTIFY_PUSH:b};A.multicodecs=C,A.Messsage=y,e.exports=A},32912:(e,t,r)=>{"use strict";var n=r(80886),i=n.Reader,s=n.Writer,o=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<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.protocolVersion="",e.prototype.agentVersion="",e.prototype.publicKey=o.newBuffer([]),e.prototype.listenAddrs=o.emptyArray,e.prototype.observedAddr=o.newBuffer([]),e.prototype.protocols=o.emptyArray,e.prototype.signedPeerRecord=o.newBuffer([]),e.encode=function(e,t){if(t||(t=s.create()),null!=e.publicKey&&Object.hasOwnProperty.call(e,"publicKey")&&t.uint32(10).bytes(e.publicKey),null!=e.listenAddrs&&e.listenAddrs.length)for(var r=0;r<e.listenAddrs.length;++r)t.uint32(18).bytes(e.listenAddrs[r]);if(null!=e.protocols&&e.protocols.length)for(r=0;r<e.protocols.length;++r)t.uint32(26).string(e.protocols[r]);return null!=e.observedAddr&&Object.hasOwnProperty.call(e,"observedAddr")&&t.uint32(34).bytes(e.observedAddr),null!=e.protocolVersion&&Object.hasOwnProperty.call(e,"protocolVersion")&&t.uint32(42).string(e.protocolVersion),null!=e.agentVersion&&Object.hasOwnProperty.call(e,"agentVersion")&&t.uint32(50).string(e.agentVersion),null!=e.signedPeerRecord&&Object.hasOwnProperty.call(e,"signedPeerRecord")&&t.uint32(66).bytes(e.signedPeerRecord),t},e.decode=function(e,t){e instanceof i||(e=i.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new a.Identify;e.pos<r;){var s=e.uint32();switch(s>>>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&s)}}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?o.base64.decode(e.publicKey,t.publicKey=o.newBuffer(o.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<e.listenAddrs.length;++r)"string"===typeof e.listenAddrs[r]?o.base64.decode(e.listenAddrs[r],t.listenAddrs[r]=o.newBuffer(o.base64.length(e.listenAddrs[r])),0):e.listenAddrs[r].length&&(t.listenAddrs[r]=e.listenAddrs[r])}if(null!=e.observedAddr&&("string"===typeof e.observedAddr?o.base64.decode(e.observedAddr,t.observedAddr=o.newBuffer(o.base64.length(e.observedAddr)),0):e.observedAddr.length&&(t.observedAddr=e.observedAddr)),e.protocols){if(!Array.isArray(e.protocols))throw TypeError(".Identify.protocols: array expected");t.protocols=[];for(r=0;r<e.protocols.length;++r)t.protocols[r]=String(e.protocols[r])}return null!=e.signedPeerRecord&&("string"===typeof e.signedPeerRecord?o.base64.decode(e.signedPeerRecord,t.signedPeerRecord=o.newBuffer(o.base64.length(e.signedPeerRecord)),0):e.signedPeerRecord.length&&(t.signedPeerRecord=e.signedPeerRecord)),t},e.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.listenAddrs=[],r.protocols=[]),t.defaults&&(t.bytes===String?r.publicKey="":(r.publicKey=[],t.bytes!==Array&&(r.publicKey=o.newBuffer(r.publicKey))),t.bytes===String?r.observedAddr="":(r.observedAddr=[],t.bytes!==Array&&(r.observedAddr=o.newBuffer(r.observedAddr))),r.protocolVersion="",r.agentVersion="",t.bytes===String?r.signedPeerRecord="":(r.signedPeerRecord=[],t.bytes!==Array&&(r.signedPeerRecord=o.newBuffer(r.signedPeerRecord)))),null!=e.publicKey&&e.hasOwnProperty("publicKey")&&(r.publicKey=t.bytes===String?o.base64.encode(e.publicKey,0,e.publicKey.length):t.bytes===Array?Array.prototype.slice.call(e.publicKey):e.publicKey),e.listenAddrs&&e.listenAddrs.length){r.listenAddrs=[];for(var n=0;n<e.listenAddrs.length;++n)r.listenAddrs[n]=t.bytes===String?o.base64.encode(e.listenAddrs[n],0,e.listenAddrs[n].length):t.bytes===Array?Array.prototype.slice.call(e.listenAddrs[n]):e.listenAddrs[n]}if(e.protocols&&e.protocols.length){r.protocols=[];for(n=0;n<e.protocols.length;++n)r.protocols[n]=e.protocols[n]}return null!=e.observedAddr&&e.hasOwnProperty("observedAddr")&&(r.observedAddr=t.bytes===String?o.base64.encode(e.observedAddr,0,e.observedAddr.length):t.bytes===Array?Array.prototype.slice.call(e.observedAddr):e.observedAddr),null!=e.protocolVersion&&e.hasOwnProperty("protocolVersion")&&(r.protocolVersion=e.protocolVersion),null!=e.agentVersion&&e.hasOwnProperty("agentVersion")&&(r.agentVersion=e.agentVersion),null!=e.signedPeerRecord&&e.hasOwnProperty("signedPeerRecord")&&(r.signedPeerRecord=t.bytes===String?o.base64.encode(e.signedPeerRecord,0,e.signedPeerRecord.length):t.bytes===Array?Array.prototype.slice.call(e.signedPeerRecord):e.signedPeerRecord),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,n.util.toJSONOptions)},e}(),e.exports=a},6197:(e,t,r)=>{"use strict";const n=r(18392),i=Object.assign(n("libp2p"),{error:n("libp2p:err")}),{EventEmitter:s}=r(47465),o=r(67963),a=r(90190),{Multiaddr:c}=r(98719),{MemoryDatastore:u}=r(78932),l=r(28109),h=r(78909),d=r(85012),{validate:f}=r(7037),{codes:p,messages:y}=r(59087),g=r(61995),m=r(71997),v=r(75570),b=r(46162),w=r(90432),E=r(50453),S=r(69566),_=r(70030),I=r(48350),T=r(59324),A=r(47299),C=r(88694),R=r(9828),P=r(6215),k=r(85889),O=r(66321),B=r(45020),{updateSelfPeerRecord:N}=r(17335);class D extends s{static async create(e){if(e.peerId)return new D(e);const t=await a.create();return e.peerId=t,new D(e)}constructor(e){if(super(),this._options=f(e),this.peerId=this._options.peerId,this.datastore=this._options.datastore,this._options.metrics.enabled){const e=new _({...this._options.metrics});this.metrics=e}if(this.connectionGater={denyDialPeer:async()=>Promise.resolve(!1),denyDialMultiaddr:async()=>Promise.resolve(!1),denyInboundConnection:async()=>Promise.resolve(!1),denyOutboundConnection:async()=>Promise.resolve(!1),denyInboundEncryptedConnection:async()=>Promise.resolve(!1),denyOutboundEncryptedConnection:async()=>Promise.resolve(!1),denyInboundUpgradedConnection:async()=>Promise.resolve(!1),denyOutboundUpgradedConnection:async()=>Promise.resolve(!1),filterMultiaddrForPeer:async()=>Promise.resolve(!0),...this._options.connectionGater},this.peerStore=new A({peerId:this.peerId,datastore:this.datastore&&this._options.peerStore.persistence?this.datastore:new u,addressFilter:this.connectionGater.filterMultiaddrForPeer}),this.addresses=this._options.addresses,this.addressManager=new g(this.peerId,this._options.addresses),this.addressManager.on("change:addresses",(()=>{N(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 m(this,{...this._options.connectionManager}),this._autodialler=new v(this,{enabled:this._config.peerDiscovery.autoDial,minConnections:this._options.connectionManager.minConnections,autoDialInterval:this._options.connectionManager.autoDialInterval}),this._options.keychain&&this._options.keychain.datastore){i("creating keychain");const e=S.generateOptions();this.keychain=new S(this._options.keychain.datastore,{...e,...this._options.keychain}),i("keychain constructed")}if(this.upgrader=new T({connectionGater:this.connectionGater,localPeer:this.peerId,metrics:this.metrics,onConnection:e=>this.connectionManager.onConnect(e),onConnectionEnd:e=>this.connectionManager.onDisconnect(e)}),this.transportManager=new I({libp2p:this,upgrader:this.upgrader,faultTolerance:this._options.transportManager.faultTolerance}),this.natManager=new B({peerId:this.peerId,addressManager:this.addressManager,transportManager:this.transportManager,...this._options.config.nat}),this.registrar=new R({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 o(new Error(y.CONN_ENCRYPTION_REQUIRED),p.CONN_ENCRYPTION_REQUIRED);if(this._modules.connEncryption.forEach((e=>{this.upgrader.cryptos.set(e.protocol,e)})),this.dialer=new E({transportManager:this.transportManager,connectionGater:this.connectionGater,peerStore:this.peerStore,metrics:this.metrics,...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 w(this)),this._modules.streamMuxer){this._modules.streamMuxer.forEach((e=>{this.upgrader.muxers.set(e.multicodec,e)})),this.identifyService=new P({libp2p:this})}if(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=e.create({libp2p:this,...this._config.dht})}if(this._modules.pubsub){const e=this._modules.pubsub;this.pubsub=C(e,this,this._config.pubsub)}this.peerRouting=new l(this),this.contentRouting=new h(this),this._onDiscoveryPeer=this._onDiscoveryPeer.bind(this),this.fetchService=new k(this),this.pingService=new O(this)}emit(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return"error"!==e||this._events.error?super.emit(e,...r):(i.error(r),!1)}async start(){i("libp2p is starting"),this.identifyService&&await this.handle(Object.values(P.getProtocolStr(this)),this.identifyService.handleMessage),this.fetchService&&await this.handle(k.PROTOCOL,this.fetchService.handleMessage),this.pingService&&await this.handle(O.getProtocolStr(this),this.pingService.handleMessage);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.identifyService&&await this.identifyService.stop(),this.relay&&this.relay.stop(),this.peerRouting.stop(),await this._autodialler.stop(),await(this._dht&&this._dht.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.connectionManager.stop(),await Promise.all([this.pubsub&&this.pubsub.stop(),this.metrics&&this.metrics.stop()]),await this.natManager.stop(),await this.transportManager.close(),await this.unhandle(k.PROTOCOL),await this.unhandle(O.getProtocolStr(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 o(new Error("no protocols were provided to open a stream"),p.ERR_INVALID_PROTOCOLS_FOR_STREAM);return(await this._dial(e,r)).newStream(t)}async _dial(e,t){const{id:r,multiaddrs:n}=d(e);if(r.equals(this.peerId))throw o(new Error("Cannot dial self"),p.ERR_DIALED_SELF);let i=this.connectionManager.get(r);return i?n&&await 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}=d(e),r=this.connectionManager.connections.get(t.toB58String());r&&await Promise.all(r.map((e=>e.close())))}fetch(e,t){return this.fetchService.fetch(e,t)}ping(e){const{id:t,multiaddrs:r}=d(e);return r?this.pingService.ping(r[0]):this.pingService.ping(t)}async handle(e,t){(e=Array.isArray(e)?e:[e]).forEach((e=>{this.upgrader.protocols.set(e,t)})),await this.peerStore.protoBook.add(this.peerId,e)}async unhandle(e){(e=Array.isArray(e)?e:[e]).forEach((e=>{this.upgrader.protocols.delete(e)})),await this.peerStore.protoBook.remove(this.peerId,e)}async _onStarting(){const e=this.addressManager.getListenAddrs();await this.transportManager.listen(e),this.natManager.start(),this._config.pubsub.enabled&&this.pubsub&&await this.pubsub.start(),this._config.dht.enabled&&(this._dht&&await this._dht.start(),this._dht.on("peer",this._onDiscoveryPeer)),this.metrics&&this.metrics.start(),this.identifyService&&await this.identifyService.start()}async _onDidStart(){this._isStarted=!0,this.peerStore.on("peer",(e=>{this.emit("peer:discovery",e),this._maybeConnect(e).catch((e=>{i.error(e)}))}));for await(const e of this.peerStore.getPeers())this.emit("peer:discovery",e.id);this.connectionManager.start(),await this._autodialler.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).catch((e=>i.error(e))),e.protocols&&this.peerStore.protoBook.set(e.id,e.protocols).catch((e=>i.error(e)))):i.error(new Error(p.ERR_DISCOVERED_SELF))}async _maybeConnect(e){if(!0===this._config.peerDiscovery.autoDial&&!this.connectionManager.get(e)){if((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 ".concat(e.toB58String()," with ").concat(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=D},37929:(e,t,r)=>{"use strict";r(60322),r(14458);const n=r(37934),{certificateForKey:i,findAsync:s}=r(2730),o=r(67963),{fromString:a}=r(46765),{toString:c}=r(82051),{codes:u}=r(59087),l=new WeakMap;e.exports=class{constructor(e,t){if(!e)throw o(new Error("keychain is required"),u.ERR_KEYCHAIN_REQUIRED);this.keychain=e,l.set(this,{dek:t})}async encrypt(e,t){if(!(t instanceof Uint8Array))throw o(new Error("Plain data must be a Uint8Array"),u.ERR_INVALID_PARAMETERS);const r=await this.keychain.findKeyByName(e),s=await this.keychain._getPrivateKey(e),c=l.get(this).dek,h=n.pki.decryptRsaPrivateKey(s,c),d=await i(r,h),f=n.pkcs7.createEnvelopedData();f.addRecipient(d),f.content=n.util.createBuffer(t),f.encrypt();const p=n.asn1.toDer(f.toAsn1()).getBytes();return a(p,"ascii")}async decrypt(e){if(!(e instanceof Uint8Array))throw o(new Error("CMS data is required"),u.ERR_INVALID_PARAMETERS);let t;try{const r=n.util.createBuffer(c(e,"ascii")),i=n.asn1.fromDer(r);t=n.pkcs7.messageFromAsn1(i)}catch(y){throw o(new Error("Invalid CMS: "+y.message),u.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 s(r,(async e=>{try{if(await this.keychain.findKeyById(e.keyId))return!0}catch(y){return!1}return!1}));if(!i){const e=r.map((e=>e.keyId));throw o(new Error("Decryption needs one of the key(s): "+e.join(", ")),u.ERR_MISSING_KEYS,{missingKeys:e})}const h=await this.keychain.findKeyById(i.keyId);if(!h)throw o(new Error("No key available to decrypto"),u.ERR_NO_KEY);const d=await this.keychain._getPrivateKey(h.name),f=l.get(this).dek,p=n.pki.decryptRsaPrivateKey(d,f);return t.decrypt(i.recipient,p),a(t.content.getBytes(),"ascii")}}},69566:(e,t,r)=>{"use strict";const n=r(18392),i=Object.assign(n("libp2p:keychain"),{error:n("libp2p:keychain:err")}),s=r(6327),o=r(89842),a=r(25504),{Key:c}=r(3450),u=r(37929),l=r(67963),{codes:h}=r(59087),{toString:d}=r(82051),{fromString:f}=r(46765);r(62025);const p="/info/",y=new WeakMap,g=14,m=16,v=1e3,b={dek:{keyLength:64,iterationCount:1e4,salt:"you should override this value with a crypto secure random number",hash:"sha2-512"}};function w(e){return!!e&&("string"===typeof e&&e===s(e.trim()))}async function E(e){const t=800*Math.random()+200;throw await new Promise((e=>setTimeout(e,t))),e}function S(e){return new c("/pkcs8/"+e)}function _(e){return new c(p+e)}e.exports=class{constructor(e,t){if(!e)throw new Error("store is required");if(this.store=e,this.opts=o(b,t),this.opts.pass&&this.opts.pass.length<20)throw new Error("pass must be least 20 characters");if(this.opts.dek.keyLength<g)throw new Error("dek.keyLength must be least ".concat(g," bytes"));if(this.opts.dek.salt.length<m)throw new Error("dek.saltLength must be least ".concat(m," bytes"));if(this.opts.dek.iterationCount<v)throw new Error("dek.iterationCount must be least ".concat(v));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):"";y.set(this,{dek:r})}get cms(){return new u(this,y.get(this).dek)}static generateOptions(){const e=Object.assign({},b),t=3*Math.ceil(m/3);return e.dek.salt=d(a.randomBytes(t),"base64"),e}static get options(){return b}async createKey(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2048;const n=this;if(!w(e)||"self"===e)return E(l(new Error("Invalid key name '".concat(e,"'")),h.ERR_INVALID_KEY_NAME));if("string"!==typeof t)return E(l(new Error("Invalid key type '".concat(t,"'")),h.ERR_INVALID_KEY_TYPE));const i=S(e);if(await n.store.has(i))return E(l(new Error("Key '".concat(e,"' already exists")),h.ERR_KEY_ALREADY_EXISTS));if("rsa"===t.toLowerCase())if(!Number.isSafeInteger(r)||r<2048)return E(l(new Error("Invalid RSA key size ".concat(r)),h.ERR_INVALID_KEY_SIZE));let s;try{const o=await a.keys.generateKeyPair(t,r),c=await o.id(),u=y.get(this).dek,l=await o.export(u);s={name:e,id:c};const h=n.store.batch();h.put(i,f(l)),h.put(_(e),f(JSON.stringify(s))),await h.commit()}catch(o){return E(o)}return s}async listKeys(){const e=this,t={prefix:p},r=[];for await(const n of e.store.query(t))r.push(JSON.parse(d(n.value)));return r}async findKeyById(e){try{return(await this.listKeys()).find((t=>t.id===e))}catch(t){return E(t)}}async findKeyByName(e){if(!w(e))return E(l(new Error("Invalid key name '".concat(e,"'")),h.ERR_INVALID_KEY_NAME));const t=_(e);try{const e=await this.store.get(t);return JSON.parse(d(e))}catch(r){return E(l(new Error("Key '".concat(e,"' does not exist. ").concat(r.message)),h.ERR_KEY_NOT_FOUND))}}async removeKey(e){if(!w(e)||"self"===e)return E(l(new Error("Invalid key name '".concat(e,"'")),h.ERR_INVALID_KEY_NAME));const t=S(e),r=await this.findKeyByName(e),n=this.store.batch();return n.delete(t),n.delete(_(e)),await n.commit(),r}async renameKey(e,t){const r=this;if(!w(e)||"self"===e)return E(l(new Error("Invalid old key name '".concat(e,"'")),h.ERR_OLD_KEY_NAME_INVALID));if(!w(t)||"self"===t)return E(l(new Error("Invalid new key name '".concat(t,"'")),h.ERR_NEW_KEY_NAME_INVALID));const n=S(e),i=S(t),s=_(e),o=_(t);if(await r.store.has(i))return E(l(new Error("Key '".concat(t,"' already exists")),h.ERR_KEY_ALREADY_EXISTS));try{const e=await r.store.get(n),a=await r.store.get(s),c=JSON.parse(d(a));c.name=t;const u=r.store.batch();return u.put(i,e),u.put(o,f(JSON.stringify(c))),u.delete(n),u.delete(s),await u.commit(),c}catch(a){return E(a)}}async exportKey(e,t){if(!w(e))return E(l(new Error("Invalid key name '".concat(e,"'")),h.ERR_INVALID_KEY_NAME));if(!t)return E(l(new Error("Password is required"),h.ERR_PASSWORD_REQUIRED));const r=S(e);try{const e=await this.store.get(r),n=d(e),i=y.get(this).dek;return(await a.keys.import(n,i)).export(t)}catch(n){return E(n)}}async importKey(e,t,r){if(!w(e)||"self"===e)return E(l(new Error("Invalid key name '".concat(e,"'")),h.ERR_INVALID_KEY_NAME));if(!t)return E(l(new Error("PEM encoded key is required"),h.ERR_PEM_REQUIRED));const n=S(e);if(await this.store.has(n))return E(l(new Error("Key '".concat(e,"' already exists")),h.ERR_KEY_ALREADY_EXISTS));let i,s;try{i=await a.keys.import(t,r)}catch(u){return E(l(new Error("Cannot read the key, most likely the password is wrong"),h.ERR_CANNOT_READ_KEY))}try{s=await i.id();const e=y.get(this).dek;t=await i.export(e)}catch(u){return E(u)}const o={name:e,id:s},c=this.store.batch();return c.put(n,f(t)),c.put(_(e),f(JSON.stringify(o))),await c.commit(),o}async importPeer(e,t){const r=this;if(!w(e))return E(l(new Error("Invalid key name '".concat(e,"'")),h.ERR_INVALID_KEY_NAME));if(!t||!t.privKey)return E(l(new Error("Peer.privKey is required"),h.ERR_MISSING_PRIVATE_KEY));const n=t.privKey,i=S(e);if(await r.store.has(i))return E(l(new Error("Key '".concat(e,"' already exists")),h.ERR_KEY_ALREADY_EXISTS));try{const t=await n.id(),s=y.get(this).dek,o=await n.export(s),a={name:e,id:t},c=r.store.batch();return c.put(i,f(o)),c.put(_(e),f(JSON.stringify(a))),await c.commit(),a}catch(s){return E(s)}}async _getPrivateKey(e){if(!w(e))return E(l(new Error("Invalid key name '".concat(e,"'")),h.ERR_INVALID_KEY_NAME));try{const t=S(e),r=await this.store.get(t);return d(r)}catch(t){return E(l(new Error("Key '".concat(e,"' does not exist. ").concat(t.message)),h.ERR_KEY_NOT_FOUND))}}async rotateKeychainPass(e,t){if("string"!==typeof e)return E(l(new Error("Invalid old pass type '".concat(typeof e,"'")),h.ERR_INVALID_OLD_PASS_TYPE));if("string"!==typeof t)return E(l(new Error("Invalid new pass type '".concat(typeof t,"'")),h.ERR_INVALID_NEW_PASS_TYPE));if(t.length<20)return E(l(new Error("Invalid pass length ".concat(t.length)),h.ERR_INVALID_PASS_LENGTH));i("recreating keychain");const r=y.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):"";y.set(this,{dek:n});const s=await this.listKeys();for(const i of s){const e=await this.store.get(S(i.name)),t=d(e),s=await a.keys.import(t,r),o=n.toString(),c=await s.export(o),u=this.store.batch(),l={name:i.name,id:i.id};u.put(S(i.name),f(c)),u.put(_(i.name),f(JSON.stringify(l))),await u.commit()}i("keychain reconstructed")}}},2730:(e,t,r)=>{"use strict";r(87141);const n=r(37934).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 s=[{name:"organizationName",value:"ipfs"},{shortName:"OU",value:"keystore"},{name:"commonName",value:e.id}];return i.setSubject(s),i.setIssuer(s),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))]}}},70030:(e,t,r)=>{"use strict";const n=r(89842),{pipe:i}=r(79023),{tap:s}=r(79755),o=r(40579),{METRICS:a}=r(70127),c=r(59112),u=["dataReceived","dataSent"],l={in:"dataReceived",out:"dataSent"};class h{constructor(e){this._options=n(a,e),this._globalStats=new c(u,this._options),this._peerStats=new Map,this._protocolStats=new Map,this._oldPeers=o(this._options.maxOldPeersRetention),this._running=!1,this._onMessage=this._onMessage.bind(this),this._systems=new Map}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())}getComponentMetrics(){return this._systems}updateComponentMetric(e){let{system:t="libp2p",component:r,metric:n,value:i}=e;this._systems.has(t)||this._systems.set(t,new Map);const s=this._systems.get(t);s.has(r)||s.set(r,new Map);s.get(r).set(n,i)}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(e){let{remotePeer:t,protocol:r,direction:n,dataLength:i}=e;if(!this._running)return;const s=l[n];let o=this.forPeer(t);if(o||(o=new c(u,this._options),this._peerStats.set(t.toB58String(),o)),o.push(s,i),this._globalStats.push(s,i),r){let e=this.forProtocol(r);e||(e=new c(u,this._options),this._protocolStats.set(r,e)),e.push(s,i)}}updatePlaceholder(e,t){if(!this._running)return;const r=this.forPeer(e),n=t.toB58String(),i=this.forPeer(t);let s=r;i&&(s=h.mergeStats(i,s),this._oldPeers.delete(n)),this._peerStats.delete(e.toB58String()),this._peerStats.set(n,s),s.start()}trackStream(e){let{stream:t,remotePeer:r,protocol:n}=e;const o=this,a=t.source;t.source=s((e=>o._onMessage({remotePeer:r,protocol:n,direction:"in",dataLength:e.length})))(a);const c=t.sink;return t.sink=e=>i(e,s((e=>o._onMessage({remotePeer:r,protocol:n,direction:"out",dataLength:e.length}))),c),t}static mergeStats(e,t){return e.stop(),t.stop(),e._queue=[...e._queue,...t._queue],e}}e.exports=h},40579:(e,t,r)=>{"use strict";const n=r(34737);e.exports=e=>{const t=n(e);return t.delete=t.remove,t}},59112:(e,t,r)=>{"use strict";const{EventEmitter:n}=r(47465),{BigNumber:i}=r(17144),s=r(56755),o=r(31779);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 n=0;n<e.length;n++){const t=e[n];this._stats[t]=i(0),this._movingAverages[t]={};for(let e=0;e<r.length;e++){const n=r[e];(this._movingAverages[t][n]=s(n)).push(this._frequencyLastTime,0)}}}start(){this._queue.length&&this._resetComputeTimeout()}stop(){this._timeout&&(this._timeout.clear(),this._timeout=null)}get snapshot(){return Object.assign({},this._stats)}get movingAverages(){return Object.assign({},this._movingAverages)}toJSON(){const e=this.snapshot,t=this.movingAverages,r={dataReceived:e.dataReceived.toString(),dataSent:e.dataSent.toString(),movingAverages:{}},n=Object.keys(t);for(const i of n){r.movingAverages[i]={};for(const e of Object.keys(t[i]))r.movingAverages[i][e]=t[i][e].movingAverage()}return r}push(e,t){this._queue.push([e,t,Date.now()]),this._resetComputeTimeout()}_resetComputeTimeout(){this._timeout=o(this._update,this._nextTimeout())}_nextTimeout(){const e=this._queue.length/this._options.computeThrottleMaxQueueSize;return Math.max(this._options.computeThrottleTimeout*(1-e),0)}_update(){if(this._timeout=null,this._queue.length){let e;for(e of this._queue)this._applyOp(e);this._queue=[],this._updateFrequency(e[2]),this.emit("update",this._stats)}}_updateFrequency(e){const t=e-this._frequencyLastTime;Object.keys(this._stats).forEach((r=>{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 o=this._movingAverages[e];o||(o=this._movingAverages[e]={});const a=this._options.movingAverageIntervals;for(let c=0;c<a.length;c++){const e=a[c];let t=o[e];t||(t=o[e]=s(e)),t.push(r,i)}}_applyOp(e){const t=e[0],r=e[1];if("number"!==typeof r)throw new Error("invalid increment number: ".concat(r));let n;n=Object.prototype.hasOwnProperty.call(this._stats,t)?this._stats[t]:this._stats[t]=i(0),this._stats[t]=n.plus(r),this._frequencyAccumulators[t]||(this._frequencyAccumulators[t]=0),this._frequencyAccumulators[t]+=r}}},3342:e=>{"use strict";class t extends Map{constructor(e){super();const{system:t,component:r,metric:n,metrics:i}=e;this._system=t,this._component=r,this._metric=n,this._metrics=i,this._metrics.updateComponentMetric({system:this._system,component:this._component,metric:this._metric,value:this.size})}set(e,t){return super.set(e,t),this._metrics.updateComponentMetric({system:this._system,component:this._component,metric:this._metric,value:this.size}),this}delete(e){const t=super.delete(e);return this._metrics.updateComponentMetric({system:this._system,component:this._component,metric:this._metric,value:this.size}),t}clear(){super.clear(),this._metrics.updateComponentMetric({system:this._system,component:this._component,metric:this._metric,value:this.size})}}e.exports=e=>{let r,{system:n="libp2p",component:i,metric:s,metrics:o}=e;return r=o?new t({system:n,component:i,metric:s,metrics:o}):new Map,r}},45020:(e,t,r)=>{"use strict";const n=r(47956),i=r(18392),{promisify:s}=r(51590),{Multiaddr:o}=r(98719),a=Object.assign(i("libp2p:nat"),{error:i("libp2p:nat:err")}),{isBrowser:c}=r(3227),u=r(51545),l=r(83931),h=r(28362),d=r(67963),{codes:{ERR_INVALID_PARAMETERS:f}}=r(59087),p=r(57349),y=7200;function g(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1024,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:65535;return Math.floor(Math.random()*(t-e+1)+e)}e.exports=class{constructor(e){let{peerId:t,addressManager:r,transportManager:n,...i}=e;if(this._peerId=t,this._addressManager=r,this._transportManager=n,this._enabled=i.enabled,this._externalIp=i.externalIp,this._options={description:i.description||"".concat(h.name,"@").concat(h.version," ").concat(this._peerId),ttl:i.ttl||y,autoUpdate:i.keepAlive||!0,gateway:i.gateway,enablePMP:Boolean(i.pmp&&i.pmp.enabled)},this._options.ttl<y)throw d(new Error("NatManager ttl should be at least ".concat(y," seconds")),f)}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 s=this._getClient(),c=this._externalIp||await s.externalIp();if(l(c))throw new Error("".concat(c," is private - please set config.nat.externalIp to an externally routable IP or ensure you are not behind a double NAT"));const u=g();a("opening uPnP connection from ".concat(c,":").concat(u," to ").concat(r,":").concat(n)),await s.map({publicPort:u,privatePort:n,protocol:i.toUpperCase()}),this._addressManager.addObservedAddr(o.fromNodeAddress({family:4,address:c,port:u},i))}}_getClient(){if(this._client)return this._client;const e=new n(this._options),t=s(e.map.bind(e)),r=s(e.destroy.bind(e)),i=s(e.externalIp.bind(e));return this._client={map:function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return u((()=>t(...r)),{onFailedAttempt:a.error,unref:!0})},destroy:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return u((()=>r(...t)),{onFailedAttempt:a.error,unref:!0})},externalIp:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return u((()=>i(...t)),{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)}}}},28109:(e,t,r)=>{"use strict";const n=r(18392),i=Object.assign(n("libp2p:peer-routing"),{error:n("libp2p:peer-routing:err")}),s=r(67963),o=r(59087),{storeAddresses:a,uniquePeers:c,requirePeers:u}=r(31935),{TimeoutController:l}=r(87683),h=r(96155),{pipe:d}=r(79023),f=r(84744),p=r(79272),y=r(12393),{setDelayedInterval:g,clearDelayedInterval:m}=r(18928),{DHTPeerRouting:v}=r(39862),{setMaxListeners:b}=r(47465);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(new v(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=g(this._findClosestPeersTask,this._refreshManagerOptions.interval,this._refreshManagerOptions.bootDelay))}async _findClosestPeersTask(){try{await p(this.getClosestPeers(this._peerId.id,{timeout:this._refreshManagerOptions.timeout||1e4}))}catch(e){i.error(e)}}stop(){m(this._timeoutId)}async findPeer(e,t){if(!this._routers.length)throw s(new Error("No peer routers available"),o.codes.ERR_NO_ROUTERS_AVAILABLE);if(e.toB58String()===this._peerId.toB58String())throw s(new Error("Should not try to find self"),o.codes.ERR_FIND_SELF);const r=await d(h(...this._routers.map((r=>async function*(){try{yield await r.findPeer(e,t)}catch(n){i.error(n)}}()))),(e=>y(e,Boolean)),(e=>a(e,this._peerStore)),(e=>f(e)));if(r)return r;throw s(new Error(o.messages.NOT_FOUND),o.codes.ERR_NOT_FOUND)}async*getClosestPeers(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{timeout:3e4};if(!this._routers.length)throw s(new Error("No peer routers available"),o.codes.ERR_NO_ROUTERS_AVAILABLE);if(t.timeout){const e=new l(t.timeout);try{b&&b(1/0,e.signal)}catch{}t.signal=e.signal}yield*d(h(...this._routers.map((r=>r.getClosestPeers(e,t)))),(e=>a(e,this._peerStore)),(e=>c(e)),(e=>u(e)))}}},2674:(e,t,r)=>{"use strict";const n=r(18392),i=r(67963),{Multiaddr:s}=r(98719),o=r(90190),{codes:a}=r(59087),c=r(73374),u=r(76869),{pipe:l}=r(79023),h=r(50464),d=r(12393),f=r(27889),p=r(61309),y=Object.assign(n("libp2p:peer-store:address-book"),{error:n("libp2p:peer-store:address-book:err")}),g="change:multiaddrs";function m(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return l(t,(e=>p(e,(e=>{if(!s.isMultiaddr(e))throw y.error("multiaddr must be an instance of Multiaddr"),i(new Error("multiaddr must be an instance of Multiaddr"),a.ERR_INVALID_PARAMETERS)}))),(t=>d(t,(t=>r(e,t)))),(e=>f(e,(e=>({multiaddr:new s(e.toString()),isCertified:n})))),(e=>h(e)))}e.exports=class{constructor(e,t,r){this._emit=e,this._store=t,this._addressFilter=r}async consumePeerRecord(e){y("consumePeerRecord await write lock");const t=await this._store.lock.writeLock();let r,n;y("consumePeerRecord got write lock");try{let s;try{s=c.createFromProtobuf(e.payload)}catch(i){return y.error("invalid peer record received"),!1}r=s.peerId;const o=s.multiaddrs;if(!r.equals(e.peerId))return y("signing key does not match PeerId in the PeerRecord"),!1;if(!o||!o.length)return!1;if(await this._store.has(r)){const e=await this._store.load(r);if(e.peerRecordEnvelope){const t=await u.createFromProtobuf(e.peerRecordEnvelope);if(c.createFromProtobuf(t.payload).seqNumber>=s.seqNumber)return!1}}n=await this._store.patchOrCreate(r,{addresses:await m(r,o,this._addressFilter,!0),peerRecordEnvelope:e.marshal()}),y("stored provided peer record for ".concat(s.peerId.toB58String()))}finally{y("consumePeerRecord release write lock"),t()}return this._emit(g,{peerId:r,multiaddrs:n.addresses.map((e=>{let{multiaddr:t}=e;return t}))}),!0}async getRawEnvelope(e){y("getRawEnvelope await read lock");const t=await this._store.lock.readLock();y("getRawEnvelope got read lock");try{return(await this._store.load(e)).peerRecordEnvelope}catch(r){if(r.code!==a.ERR_NOT_FOUND)throw r}finally{y("getRawEnvelope release read lock"),t()}}async getPeerRecord(e){const t=await this.getRawEnvelope(e);if(t)return u.createFromProtobuf(t)}async get(e){if(!o.isPeerId(e))throw y.error("peerId must be an instance of peer-id to store data"),i(new Error("peerId must be an instance of peer-id"),a.ERR_INVALID_PARAMETERS);y("get wait for read lock");const t=await this._store.lock.readLock();y("get got read lock");try{return(await this._store.load(e)).addresses}catch(r){if(r.code!==a.ERR_NOT_FOUND)throw r}finally{y("get release read lock"),t()}return[]}async set(e,t){if(!o.isPeerId(e))throw y.error("peerId must be an instance of peer-id to store data"),i(new Error("peerId must be an instance of peer-id"),a.ERR_INVALID_PARAMETERS);if(!Array.isArray(t))throw y.error("multiaddrs must be an array of Multiaddrs"),i(new Error("multiaddrs must be an array of Multiaddrs"),a.ERR_INVALID_PARAMETERS);y("set await write lock");const r=await this._store.lock.writeLock();y("set got write lock");let n,s=!1;try{const i=await m(e,t,this._addressFilter);if(!i.length)return;try{const t=await this._store.load(e);if(s=!0,new Set([...i.map((e=>{let{multiaddr:t}=e;return t.toString()})),...t.addresses.map((e=>{let{multiaddr:t}=e;return t.toString()}))]).size===t.addresses.length&&i.length===t.addresses.length)return}catch(c){if(c.code!==a.ERR_NOT_FOUND)throw c}n=await this._store.patchOrCreate(e,{addresses:i}),y("set multiaddrs for ".concat(e.toB58String()))}finally{y("set release write lock"),r()}this._emit(g,{peerId:e,multiaddrs:n.addresses.map((e=>e.multiaddr))}),s||this._emit("peer",e)}async add(e,t){if(!o.isPeerId(e))throw y.error("peerId must be an instance of peer-id to store data"),i(new Error("peerId must be an instance of peer-id"),a.ERR_INVALID_PARAMETERS);if(!Array.isArray(t))throw y.error("multiaddrs must be an array of Multiaddrs"),i(new Error("multiaddrs must be an array of Multiaddrs"),a.ERR_INVALID_PARAMETERS);y("add await write lock");const r=await this._store.lock.writeLock();let n,s;y("add got write lock");try{const i=await m(e,t,this._addressFilter);if(!i.length)return;try{const t=await this._store.load(e);if(n=!0,new Set([...i.map((e=>{let{multiaddr:t}=e;return t.toString()})),...t.addresses.map((e=>{let{multiaddr:t}=e;return t.toString()}))]).size===t.addresses.length)return}catch(c){if(c.code!==a.ERR_NOT_FOUND)throw c}s=await this._store.mergeOrCreate(e,{addresses:i}),y("added multiaddrs for ".concat(e.toB58String()))}finally{y("set release write lock"),r()}this._emit(g,{peerId:e,multiaddrs:s.addresses.map((e=>e.multiaddr))}),n||this._emit("peer",e)}async delete(e){if(!o.isPeerId(e))throw y.error("peerId must be an instance of peer-id to store data"),i(new Error("peerId must be an instance of peer-id"),a.ERR_INVALID_PARAMETERS);y("delete await write lock");const t=await this._store.lock.writeLock();let r;y("delete got write lock");try{r=await this._store.has(e),await this._store.patchOrCreate(e,{addresses:[]})}finally{y("delete release write lock"),t()}r&&this._emit(g,{peerId:e,multiaddrs:[]})}async getMultiaddrsForPeer(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:e=>e)(await this.get(e)).map((t=>{const r=t.multiaddr,n=r.getPeerId();return n&&n===e.toB58String()?r:r.encapsulate("/p2p/".concat(e.toB58String()))}))}}},47299:(e,t,r)=>{"use strict";const n=r(18392),{EventEmitter:i}=r(47465),s=r(2674),o=r(60761),a=r(50684),c=r(18383),u=r(50774),l=Object.assign(n("libp2p:peer-store"),{error:n("libp2p:peer-store:err")});e.exports=class extends i{constructor(e){let{peerId:t,datastore:r,addressFilter:n}=e;super(),this._peerId=t,this._store=new u(r),this.addressBook=new s(this.emit.bind(this),this._store,n),this.keyBook=new o(this.emit.bind(this),this._store),this.metadataBook=new a(this.emit.bind(this),this._store),this.protoBook=new c(this.emit.bind(this),this._store)}async*getPeers(){l("getPeers await read lock");const e=await this._store.lock.readLock();l("getPeers got read lock");try{for await(const e of this._store.all())e.id.toB58String()!==this._peerId.toB58String()&&(yield e)}finally{l("getPeers release read lock"),e()}}async delete(e){l("delete await write lock");const t=await this._store.lock.writeLock();l("delete got write lock");try{await this._store.delete(e)}finally{l("delete release write lock"),t()}}async get(e){l("get await read lock");const t=await this._store.lock.readLock();l("get got read lock");try{return this._store.load(e)}finally{l("get release read lock"),t()}}async has(e){l("has await read lock");const t=await this._store.lock.readLock();l("has got read lock");try{return this._store.has(e)}finally{l("has release read lock"),t()}}}},60761:(e,t,r)=>{"use strict";const n=r(18392),i=r(67963),{codes:s}=r(59087),o=r(90190),{equals:a}=r(98779),c=Object.assign(n("libp2p:peer-store:key-book"),{error:n("libp2p:peer-store:key-book:err")}),u="change:pubkey";e.exports=class{constructor(e,t){this._emit=e,this._store=t}async set(e,t){if(!o.isPeerId(e))throw c.error("peerId must be an instance of peer-id to store data"),i(new Error("peerId must be an instance of peer-id"),s.ERR_INVALID_PARAMETERS);if(!t)throw c.error("publicKey must be an instance of PublicKey to store data"),i(new Error("publicKey must be an instance of PublicKey"),s.ERR_INVALID_PARAMETERS);c("set await write lock");const r=await this._store.lock.writeLock();c("set got write lock");let n=!1;try{try{const r=await this._store.load(e);if(r.pubKey&&a(r.pubKey.bytes,t.bytes))return}catch(l){if(l.code!==s.ERR_NOT_FOUND)throw l}await this._store.patchOrCreate(e,{pubKey:t}),n=!0}finally{c("set release write lock"),r()}n&&this._emit(u,{peerId:e,pubKey:t})}async get(e){if(!o.isPeerId(e))throw c.error("peerId must be an instance of peer-id to store data"),i(new Error("peerId must be an instance of peer-id"),s.ERR_INVALID_PARAMETERS);c("get await write lock");const t=await this._store.lock.readLock();c("get got write lock");try{return(await this._store.load(e)).pubKey}catch(r){if(r.code!==s.ERR_NOT_FOUND)throw r}finally{c("get release write lock"),t()}}async delete(e){if(!o.isPeerId(e))throw c.error("peerId must be an instance of peer-id to store data"),i(new Error("peerId must be an instance of peer-id"),s.ERR_INVALID_PARAMETERS);c("delete await write lock");const t=await this._store.lock.writeLock();c("delete got write lock");try{await this._store.patchOrCreate(e,{pubKey:void 0})}finally{c("delete release write lock"),t()}this._emit(u,{peerId:e,pubKey:void 0})}}},50684:(e,t,r)=>{"use strict";const n=r(18392),i=r(67963),{codes:s}=r(59087),o=r(90190),{equals:a}=r(98779),c=Object.assign(n("libp2p:peer-store:metadata-book"),{error:n("libp2p:peer-store:metadata-book:err")}),u="change:metadata";e.exports=class{constructor(e,t){this._emit=e,this._store=t}async get(e){if(!o.isPeerId(e))throw c.error("peerId must be an instance of peer-id to store data"),i(new Error("peerId must be an instance of peer-id"),s.ERR_INVALID_PARAMETERS);c("get await read lock");const t=await this._store.lock.readLock();c("get got read lock");try{return(await this._store.load(e)).metadata}catch(r){if(r.code!==s.ERR_NOT_FOUND)throw r}finally{c("get release read lock"),t()}return new Map}async getValue(e,t){if(!o.isPeerId(e))throw c.error("peerId must be an instance of peer-id to store data"),i(new Error("peerId must be an instance of peer-id"),s.ERR_INVALID_PARAMETERS);c("getValue await read lock");const r=await this._store.lock.readLock();c("getValue got read lock");try{return(await this._store.load(e)).metadata.get(t)}catch(n){if(n.code!==s.ERR_NOT_FOUND)throw n}finally{c("getValue release write lock"),r()}}async set(e,t){if(!o.isPeerId(e))throw c.error("peerId must be an instance of peer-id to store data"),i(new Error("peerId must be an instance of peer-id"),s.ERR_INVALID_PARAMETERS);if(!t||!(t instanceof Map))throw c.error("valid metadata must be provided to store data"),i(new Error("valid metadata must be provided"),s.ERR_INVALID_PARAMETERS);c("set await write lock");const r=await this._store.lock.writeLock();c("set got write lock");try{await this._store.mergeOrCreate(e,{metadata:t})}finally{c("set release write lock"),r()}this._emit(u,{peerId:e,metadata:t})}async setValue(e,t,r){if(!o.isPeerId(e))throw c.error("peerId must be an instance of peer-id to store data"),i(new Error("peerId must be an instance of peer-id"),s.ERR_INVALID_PARAMETERS);if("string"!==typeof t||!(r instanceof Uint8Array))throw c.error("valid key and value must be provided to store data"),i(new Error("valid key and value must be provided"),s.ERR_INVALID_PARAMETERS);c("setValue await write lock");const n=await this._store.lock.writeLock();let l;c("setValue got write lock");try{try{const n=(await this._store.load(e)).metadata.get(t);if(null!=n&&a(r,n))return}catch(h){if(h.code!==s.ERR_NOT_FOUND)throw h}l=await this._store.mergeOrCreate(e,{metadata:new Map([[t,r]])})}finally{c("setValue release write lock"),n()}this._emit(u,{peerId:e,metadata:l.metadata})}async delete(e){if(!o.isPeerId(e))throw c.error("peerId must be an instance of peer-id to store data"),i(new Error("peerId must be an instance of peer-id"),s.ERR_INVALID_PARAMETERS);c("delete await write lock");const t=await this._store.lock.writeLock();let r;c("delete got write lock");try{r=await this._store.has(e),r&&await this._store.patch(e,{metadata:new Map})}finally{c("delete release write lock"),t()}r&&this._emit(u,{peerId:e,metadata:new Map})}async deleteValue(e,t){if(!o.isPeerId(e))throw c.error("peerId must be an instance of peer-id to store data"),i(new Error("peerId must be an instance of peer-id"),s.ERR_INVALID_PARAMETERS);c("deleteValue await write lock");const r=await this._store.lock.writeLock();let n;c("deleteValue got write lock");try{n=(await this._store.load(e)).metadata,n.delete(t),await this._store.patch(e,{metadata:n})}catch(a){if(a.code!==s.ERR_NOT_FOUND)throw a}finally{c("deleteValue release write lock"),r()}n&&this._emit(u,{peerId:e,metadata:n})}}},6716:(e,t,r)=>{"use strict";var n=r(80886),i=n.Reader,s=n.Writer,o=n.util,a=n.roots["libp2p-peer"]||(n.roots["libp2p-peer"]={});a.Peer=function(){function e(e){if(this.addresses=[],this.protocols=[],this.metadata=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}var t;return e.prototype.addresses=o.emptyArray,e.prototype.protocols=o.emptyArray,e.prototype.metadata=o.emptyArray,e.prototype.pubKey=null,e.prototype.peerRecordEnvelope=null,Object.defineProperty(e.prototype,"_pubKey",{get:o.oneOfGetter(t=["pubKey"]),set:o.oneOfSetter(t)}),Object.defineProperty(e.prototype,"_peerRecordEnvelope",{get:o.oneOfGetter(t=["peerRecordEnvelope"]),set:o.oneOfSetter(t)}),e.encode=function(e,t){if(t||(t=s.create()),null!=e.addresses&&e.addresses.length)for(var r=0;r<e.addresses.length;++r)a.Address.encode(e.addresses[r],t.uint32(10).fork()).ldelim();if(null!=e.protocols&&e.protocols.length)for(r=0;r<e.protocols.length;++r)t.uint32(18).string(e.protocols[r]);if(null!=e.metadata&&e.metadata.length)for(r=0;r<e.metadata.length;++r)a.Metadata.encode(e.metadata[r],t.uint32(26).fork()).ldelim();return null!=e.pubKey&&Object.hasOwnProperty.call(e,"pubKey")&&t.uint32(34).bytes(e.pubKey),null!=e.peerRecordEnvelope&&Object.hasOwnProperty.call(e,"peerRecordEnvelope")&&t.uint32(42).bytes(e.peerRecordEnvelope),t},e.decode=function(e,t){e instanceof i||(e=i.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new a.Peer;e.pos<r;){var s=e.uint32();switch(s>>>3){case 1:n.addresses&&n.addresses.length||(n.addresses=[]),n.addresses.push(a.Address.decode(e,e.uint32()));break;case 2:n.protocols&&n.protocols.length||(n.protocols=[]),n.protocols.push(e.string());break;case 3:n.metadata&&n.metadata.length||(n.metadata=[]),n.metadata.push(a.Metadata.decode(e,e.uint32()));break;case 4:n.pubKey=e.bytes();break;case 5:n.peerRecordEnvelope=e.bytes();break;default:e.skipType(7&s)}}return n},e.fromObject=function(e){if(e instanceof a.Peer)return e;var t=new a.Peer;if(e.addresses){if(!Array.isArray(e.addresses))throw TypeError(".Peer.addresses: array expected");t.addresses=[];for(var r=0;r<e.addresses.length;++r){if("object"!==typeof e.addresses[r])throw TypeError(".Peer.addresses: object expected");t.addresses[r]=a.Address.fromObject(e.addresses[r])}}if(e.protocols){if(!Array.isArray(e.protocols))throw TypeError(".Peer.protocols: array expected");t.protocols=[];for(r=0;r<e.protocols.length;++r)t.protocols[r]=String(e.protocols[r])}if(e.metadata){if(!Array.isArray(e.metadata))throw TypeError(".Peer.metadata: array expected");t.metadata=[];for(r=0;r<e.metadata.length;++r){if("object"!==typeof e.metadata[r])throw TypeError(".Peer.metadata: object expected");t.metadata[r]=a.Metadata.fromObject(e.metadata[r])}}return null!=e.pubKey&&("string"===typeof e.pubKey?o.base64.decode(e.pubKey,t.pubKey=o.newBuffer(o.base64.length(e.pubKey)),0):e.pubKey.length&&(t.pubKey=e.pubKey)),null!=e.peerRecordEnvelope&&("string"===typeof e.peerRecordEnvelope?o.base64.decode(e.peerRecordEnvelope,t.peerRecordEnvelope=o.newBuffer(o.base64.length(e.peerRecordEnvelope)),0):e.peerRecordEnvelope.length&&(t.peerRecordEnvelope=e.peerRecordEnvelope)),t},e.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.addresses=[],r.protocols=[],r.metadata=[]),e.addresses&&e.addresses.length){r.addresses=[];for(var n=0;n<e.addresses.length;++n)r.addresses[n]=a.Address.toObject(e.addresses[n],t)}if(e.protocols&&e.protocols.length){r.protocols=[];for(n=0;n<e.protocols.length;++n)r.protocols[n]=e.protocols[n]}if(e.metadata&&e.metadata.length){r.metadata=[];for(n=0;n<e.metadata.length;++n)r.metadata[n]=a.Metadata.toObject(e.metadata[n],t)}return null!=e.pubKey&&e.hasOwnProperty("pubKey")&&(r.pubKey=t.bytes===String?o.base64.encode(e.pubKey,0,e.pubKey.length):t.bytes===Array?Array.prototype.slice.call(e.pubKey):e.pubKey,t.oneofs&&(r._pubKey="pubKey")),null!=e.peerRecordEnvelope&&e.hasOwnProperty("peerRecordEnvelope")&&(r.peerRecordEnvelope=t.bytes===String?o.base64.encode(e.peerRecordEnvelope,0,e.peerRecordEnvelope.length):t.bytes===Array?Array.prototype.slice.call(e.peerRecordEnvelope):e.peerRecordEnvelope,t.oneofs&&(r._peerRecordEnvelope="peerRecordEnvelope")),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,n.util.toJSONOptions)},e}(),a.Address=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}var t;return e.prototype.multiaddr=o.newBuffer([]),e.prototype.isCertified=null,Object.defineProperty(e.prototype,"_isCertified",{get:o.oneOfGetter(t=["isCertified"]),set:o.oneOfSetter(t)}),e.encode=function(e,t){return t||(t=s.create()),null!=e.multiaddr&&Object.hasOwnProperty.call(e,"multiaddr")&&t.uint32(10).bytes(e.multiaddr),null!=e.isCertified&&Object.hasOwnProperty.call(e,"isCertified")&&t.uint32(16).bool(e.isCertified),t},e.decode=function(e,t){e instanceof i||(e=i.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new a.Address;e.pos<r;){var s=e.uint32();switch(s>>>3){case 1:n.multiaddr=e.bytes();break;case 2:n.isCertified=e.bool();break;default:e.skipType(7&s)}}return n},e.fromObject=function(e){if(e instanceof a.Address)return e;var t=new a.Address;return null!=e.multiaddr&&("string"===typeof e.multiaddr?o.base64.decode(e.multiaddr,t.multiaddr=o.newBuffer(o.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=o.newBuffer(r.multiaddr)))),null!=e.multiaddr&&e.hasOwnProperty("multiaddr")&&(r.multiaddr=t.bytes===String?o.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,t.oneofs&&(r._isCertified="isCertified")),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,n.util.toJSONOptions)},e}(),a.Metadata=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.key="",e.prototype.value=o.newBuffer([]),e.encode=function(e,t){return t||(t=s.create()),null!=e.key&&Object.hasOwnProperty.call(e,"key")&&t.uint32(10).string(e.key),null!=e.value&&Object.hasOwnProperty.call(e,"value")&&t.uint32(18).bytes(e.value),t},e.decode=function(e,t){e instanceof i||(e=i.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new a.Metadata;e.pos<r;){var s=e.uint32();switch(s>>>3){case 1:n.key=e.string();break;case 2:n.value=e.bytes();break;default:e.skipType(7&s)}}return n},e.fromObject=function(e){if(e instanceof a.Metadata)return e;var t=new a.Metadata;return null!=e.key&&(t.key=String(e.key)),null!=e.value&&("string"===typeof e.value?o.base64.decode(e.value,t.value=o.newBuffer(o.base64.length(e.value)),0):e.value.length&&(t.value=e.value)),t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(r.key="",t.bytes===String?r.value="":(r.value=[],t.bytes!==Array&&(r.value=o.newBuffer(r.value)))),null!=e.key&&e.hasOwnProperty("key")&&(r.key=e.key),null!=e.value&&e.hasOwnProperty("value")&&(r.value=t.bytes===String?o.base64.encode(e.value,0,e.value.length):t.bytes===Array?Array.prototype.slice.call(e.value):e.value),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,n.util.toJSONOptions)},e}(),e.exports=a},18383:(e,t,r)=>{"use strict";const n=r(18392),i=r(67963),{codes:s}=r(59087),o=r(90190),a=Object.assign(n("libp2p:peer-store:proto-book"),{error:n("libp2p:peer-store:proto-book:err")}),c="change:protocols";e.exports=class{constructor(e,t){this._emit=e,this._store=t}async get(e){a("get wait for read lock");const t=await this._store.lock.readLock();a("get got read lock");try{return(await this._store.load(e)).protocols}catch(r){if(r.code!==s.ERR_NOT_FOUND)throw r}finally{a("get release read lock"),t()}return[]}async set(e,t){if(!o.isPeerId(e))throw a.error("peerId must be an instance of peer-id to store data"),i(new Error("peerId must be an instance of peer-id"),s.ERR_INVALID_PARAMETERS);if(!Array.isArray(t))throw a.error("protocols must be provided to store data"),i(new Error("protocols must be provided"),s.ERR_INVALID_PARAMETERS);a("set await write lock");const r=await this._store.lock.writeLock();let n;a("set got write lock");try{try{const r=await this._store.load(e);if(new Set([...t]).size===r.protocols.length)return}catch(u){if(u.code!==s.ERR_NOT_FOUND)throw u}n=await this._store.patchOrCreate(e,{protocols:t}),a("stored provided protocols for ".concat(e.toB58String()))}finally{a("set release write lock"),r()}this._emit(c,{peerId:e,protocols:n.protocols})}async add(e,t){if(!o.isPeerId(e))throw a.error("peerId must be an instance of peer-id to store data"),i(new Error("peerId must be an instance of peer-id"),s.ERR_INVALID_PARAMETERS);if(!Array.isArray(t))throw a.error("protocols must be provided to store data"),i(new Error("protocols must be provided"),s.ERR_INVALID_PARAMETERS);a("add await write lock");const r=await this._store.lock.writeLock();let n;a("add got write lock");try{try{const r=await this._store.load(e);if(new Set([...r.protocols,...t]).size===r.protocols.length)return}catch(u){if(u.code!==s.ERR_NOT_FOUND)throw u}n=await this._store.mergeOrCreate(e,{protocols:t}),a("added provided protocols for ".concat(e.toB58String()))}finally{a("add release write lock"),r()}this._emit(c,{peerId:e,protocols:n.protocols})}async remove(e,t){if(!o.isPeerId(e))throw a.error("peerId must be an instance of peer-id to store data"),i(new Error("peerId must be an instance of peer-id"),s.ERR_INVALID_PARAMETERS);if(!Array.isArray(t))throw a.error("protocols must be provided to store data"),i(new Error("protocols must be provided"),s.ERR_INVALID_PARAMETERS);a("remove await write lock");const r=await this._store.lock.writeLock();let n;a("remove got write lock");try{try{const r=await this._store.load(e),n=new Set(r.protocols);for(const e of t)n.delete(e);if(r.protocols.length===n.size)return;t=Array.from(n)}catch(u){if(u.code!==s.ERR_NOT_FOUND)throw u}n=await this._store.patchOrCreate(e,{protocols:t})}finally{a("remove release write lock"),r()}this._emit(c,{peerId:e,protocols:n.protocols})}async delete(e){a("delete await write lock");const t=await this._store.lock.writeLock();let r;a("delete got write lock");try{r=await this._store.has(e),await this._store.patchOrCreate(e,{protocols:[]})}catch(n){if(n.code!==s.ERR_NOT_FOUND)throw n}finally{a("delete release write lock"),t()}r&&this._emit(c,{peerId:e,protocols:[]})}}},50774:(e,t,r)=>{"use strict";const n=r(18392),i=r(90190),s=r(67963),{codes:o}=r(59087),{Key:a}=r(3450),{base32:c}=r(71128),{keys:{unmarshalPublicKey:u,marshalPublicKey:l}}=r(25504),{Multiaddr:h}=r(98719),{Peer:d}=r(6716),f=r(31127),{equals:p}=r(98779),y=Object.assign(n("libp2p:peer-store:store"),{error:n("libp2p:peer-store:store:err")}),g="/peers/";e.exports=class{constructor(e){this._datastore=e,this.lock=f("peer-store",{singleProcess:!0})}_peerIdToDatastoreKey(e){if(!i.isPeerId(e))throw y.error("peerId must be an instance of peer-id to store data"),s(new Error("peerId must be an instance of peer-id"),o.ERR_INVALID_PARAMETERS);const t=e.toString();return new a("".concat(g).concat(t))}async has(e){return this._datastore.has(this._peerIdToDatastoreKey(e))}async delete(e){await this._datastore.delete(this._peerIdToDatastoreKey(e))}async load(e){const t=await this._datastore.get(this._peerIdToDatastoreKey(e)),r=d.decode(t),n=r.pubKey?u(r.pubKey):e.pubKey,i=new Map;for(const s of r.metadata)i.set(s.key,s.value);return{...r,id:e,pubKey:n,addresses:r.addresses.map((e=>{let{multiaddr:t,isCertified:r}=e;return{multiaddr:new h(t),isCertified:r||!1}})),metadata:i,peerRecordEnvelope:r.peerRecordEnvelope||void 0}}async save(e){if(null!=e.pubKey&&null!=e.id.pubKey&&!p(e.pubKey.bytes,e.id.pubKey.bytes))throw y.error("peer publicKey bytes do not match peer id publicKey bytes"),s(new Error("publicKey bytes do not match peer id publicKey bytes"),o.ERR_INVALID_PARAMETERS);const t=new Set,r=d.encode({addresses:e.addresses.filter((e=>!t.has(e.multiaddr.toString())&&(t.add(e.multiaddr.toString()),!0))).sort(((e,t)=>e.multiaddr.toString().localeCompare(t.multiaddr.toString()))).map((e=>{let{multiaddr:t,isCertified:r}=e;return{multiaddr:t.bytes,isCertified:r}})),protocols:e.protocols.sort(),pubKey:e.pubKey?l(e.pubKey):void 0,metadata:[...e.metadata.keys()].sort().map((t=>({key:t,value:e.metadata.get(t)}))),peerRecordEnvelope:e.peerRecordEnvelope}).finish();return await this._datastore.put(this._peerIdToDatastoreKey(e.id),r),this.load(e.id)}async patch(e,t){const r=await this.load(e);return await this._patch(e,t,r)}async patchOrCreate(e,t){let r;try{r=await this.load(e)}catch(n){if(n.code!==o.ERR_NOT_FOUND)throw n;r={id:e,addresses:[],protocols:[],metadata:new Map}}return await this._patch(e,t,r)}async _patch(e,t,r){return await this.save({...r,...t,id:e})}async merge(e,t){const r=await this.load(e);return this._merge(e,t,r)}async mergeOrCreate(e,t){let r;try{r=await this.load(e)}catch(n){if(n.code!==o.ERR_NOT_FOUND)throw n;r={id:e,addresses:[],protocols:[],metadata:new Map}}return await this._merge(e,t,r)}async _merge(e,t,r){const n=new Map;return(t.addresses||[]).forEach((e=>{n.set(e.multiaddr.toString(),e.isCertified)})),r.addresses.forEach((e=>{let{multiaddr:t,isCertified:r}=e;const i=t.toString();n.set(i,Boolean(n.get(i)||r))})),await this.save({id:e,addresses:Array.from(n.entries()).map((e=>{let[t,r]=e;return{multiaddr:new h(t),isCertified:r}})),protocols:Array.from(new Set([...r.protocols||[],...t.protocols||[]])),metadata:new Map([...r.metadata?r.metadata.entries():[],...t.metadata?t.metadata.entries():[]]),pubKey:t.pubKey||(null!=r?r.pubKey:void 0),peerRecordEnvelope:t.peerRecordEnvelope||(null!=r?r.peerRecordEnvelope:void 0)})}async*all(){for await(const e of this._datastore.queryKeys({prefix:g})){const t=e.toString().split("/")[2],r=c.decode(t);yield this.load(i.createFromBytes(r))}}}},66350:e=>{"use strict";e.exports={PROTOCOL:"/ipfs/ping/1.0.0",PING_LENGTH:32,PROTOCOL_VERSION:"1.0.0",PROTOCOL_NAME:"ping"}},66321:(e,t,r)=>{"use strict";const n=r(18392),i=Object.assign(n("libp2p:ping"),{error:n("libp2p:ping:err")}),s=r(67963),{codes:o}=r(59087),a=r(25504),{pipe:c}=r(79023),{toBuffer:u}=r(90351),{collect:l,take:h}=r(79755),{equals:d}=r(98779),{PROTOCOL_NAME:f,PING_LENGTH:p,PROTOCOL_VERSION:y}=r(66350);e.exports=class{static getProtocolStr(e){return"/".concat(e._config.protocolPrefix,"/").concat(f,"/").concat(y)}constructor(e){this._libp2p=e}handleMessage(e){let{stream:t}=e;return c(t,t)}async ping(e){const t="/".concat(this._libp2p._config.protocolPrefix,"/").concat(f,"/").concat(y);i("dialing %s to %s",t,e.toB58String?e.toB58String():e);const r=await this._libp2p.dial(e),{stream:n}=await r.newStream(t),g=Date.now(),m=a.randomBytes(p),[v]=await c([m],n,(e=>h(1,e)),u,l),b=Date.now();if(!d(m,v))throw s(new Error("Received wrong ping ack"),o.ERR_WRONG_PING_ACK);return b-g}}},88694: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}},91282:(e,t,r)=>{"use strict";var n=r(80886),i=n.Reader,s=n.Writer,o=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<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.publicKey=o.newBuffer([]),e.prototype.payloadType=o.newBuffer([]),e.prototype.payload=o.newBuffer([]),e.prototype.signature=o.newBuffer([]),e.encode=function(e,t){return t||(t=s.create()),null!=e.publicKey&&Object.hasOwnProperty.call(e,"publicKey")&&t.uint32(10).bytes(e.publicKey),null!=e.payloadType&&Object.hasOwnProperty.call(e,"payloadType")&&t.uint32(18).bytes(e.payloadType),null!=e.payload&&Object.hasOwnProperty.call(e,"payload")&&t.uint32(26).bytes(e.payload),null!=e.signature&&Object.hasOwnProperty.call(e,"signature")&&t.uint32(42).bytes(e.signature),t},e.decode=function(e,t){e instanceof i||(e=i.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new a.Envelope;e.pos<r;){var s=e.uint32();switch(s>>>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&s)}}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?o.base64.decode(e.publicKey,t.publicKey=o.newBuffer(o.base64.length(e.publicKey)),0):e.publicKey.length&&(t.publicKey=e.publicKey)),null!=e.payloadType&&("string"===typeof e.payloadType?o.base64.decode(e.payloadType,t.payloadType=o.newBuffer(o.base64.length(e.payloadType)),0):e.payloadType.length&&(t.payloadType=e.payloadType)),null!=e.payload&&("string"===typeof e.payload?o.base64.decode(e.payload,t.payload=o.newBuffer(o.base64.length(e.payload)),0):e.payload.length&&(t.payload=e.payload)),null!=e.signature&&("string"===typeof e.signature?o.base64.decode(e.signature,t.signature=o.newBuffer(o.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=o.newBuffer(r.publicKey))),t.bytes===String?r.payloadType="":(r.payloadType=[],t.bytes!==Array&&(r.payloadType=o.newBuffer(r.payloadType))),t.bytes===String?r.payload="":(r.payload=[],t.bytes!==Array&&(r.payload=o.newBuffer(r.payload))),t.bytes===String?r.signature="":(r.signature=[],t.bytes!==Array&&(r.signature=o.newBuffer(r.signature)))),null!=e.publicKey&&e.hasOwnProperty("publicKey")&&(r.publicKey=t.bytes===String?o.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?o.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?o.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?o.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},76869:(e,t,r)=>{"use strict";const n=r(67963),{concat:i}=r(62110),{fromString:s}=r(46765),o=r(36552),a=r(90190),c=r(74561),{equals:u}=r(98779),{codes:l}=r(59087),{Envelope:h}=r(91282);class d{constructor(e){let{peerId:t,payloadType:r,payload:n,signature:i}=e;this.peerId=t,this.payloadType=r,this.payload=n,this.signature=i,this._marshal=void 0}marshal(){if(this._marshal)return this._marshal;const e=o.marshalPublicKey(this.peerId.pubKey);return this._marshal=h.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=f(e,this.payloadType,this.payload);return this.peerId.pubKey.verify(t,this.signature)}}const f=(e,t,r)=>{const n=s(e),o=c.encode(n.byteLength),a=c.encode(t.length),u=c.encode(r.length);return i([new Uint8Array(o),n,new Uint8Array(a),t,new Uint8Array(u),r])};d.createFromProtobuf=async e=>{const t=h.decode(e),r=await a.createFromPubKey(t.publicKey);return new d({peerId:r,payloadType:t.payloadType,payload:t.payload,signature:t.signature})},d.seal=async(e,t)=>{const r=e.domain,n=e.codec,i=e.marshal(),s=f(r,n,i),o=await t.privKey.sign(s);return new d({peerId:t,payloadType:n,payload:i,signature:o})},d.openAndCertify=async(e,t)=>{const r=await d.createFromProtobuf(e);if(!await r.validate(t))throw n(new Error("envelope signature is not valid for the given domain"),l.ERR_SIGNATURE_NOT_VALID);return r},e.exports=d},6173:e=>{"use strict";const t=Uint8Array.from([3,1]);e.exports={ENVELOPE_DOMAIN_PEER_RECORD:"libp2p-peer-record",ENVELOPE_PAYLOAD_TYPE_PEER_RECORD:t}},73374:(e,t,r)=>{"use strict";const{Multiaddr:n}=r(98719),i=r(90190),s=r(80710),{PeerRecord:o}=r(73077),{ENVELOPE_DOMAIN_PEER_RECORD:a,ENVELOPE_PAYLOAD_TYPE_PEER_RECORD:c}=r(6173);class u{constructor(e){let{peerId:t,multiaddrs:r=[],seqNumber:n=Date.now()}=e;this.domain=a,this.codec=c,this.peerId=t,this.multiaddrs=r,this.seqNumber=n,this._marshal=void 0}marshal(){return this._marshal||(this._marshal=o.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&&!!s(this.multiaddrs,e.multiaddrs)))}}u.createFromProtobuf=e=>{const t=o.decode(e),r=i.createFromBytes(t.peerId),s=(t.addresses||[]).map((e=>new n(e.multiaddr))),a=Number(t.seq);return new u({peerId:r,multiaddrs:s,seqNumber:a})},u.DOMAIN=a,e.exports=u},73077:(e,t,r)=>{"use strict";var n=r(80886),i=n.Reader,s=n.Writer,o=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<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.peerId=o.newBuffer([]),e.prototype.seq=o.Long?o.Long.fromBits(0,0,!0):0,e.prototype.addresses=o.emptyArray,e.encode=function(e,t){if(t||(t=s.create()),null!=e.peerId&&Object.hasOwnProperty.call(e,"peerId")&&t.uint32(10).bytes(e.peerId),null!=e.seq&&Object.hasOwnProperty.call(e,"seq")&&t.uint32(16).uint64(e.seq),null!=e.addresses&&e.addresses.length)for(var r=0;r<e.addresses.length;++r)a.PeerRecord.AddressInfo.encode(e.addresses[r],t.uint32(26).fork()).ldelim();return t},e.decode=function(e,t){e instanceof i||(e=i.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new a.PeerRecord;e.pos<r;){var s=e.uint32();switch(s>>>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&s)}}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?o.base64.decode(e.peerId,t.peerId=o.newBuffer(o.base64.length(e.peerId)),0):e.peerId.length&&(t.peerId=e.peerId)),null!=e.seq&&(o.Long?(t.seq=o.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 o.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<e.addresses.length;++r){if("object"!==typeof e.addresses[r])throw TypeError(".PeerRecord.addresses: object expected");t.addresses[r]=a.PeerRecord.AddressInfo.fromObject(e.addresses[r])}}return t},e.toObject=function(e,t){t||(t={});var r={};if((t.arrays||t.defaults)&&(r.addresses=[]),t.defaults)if(t.bytes===String?r.peerId="":(r.peerId=[],t.bytes!==Array&&(r.peerId=o.newBuffer(r.peerId))),o.Long){var n=new o.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;if(null!=e.peerId&&e.hasOwnProperty("peerId")&&(r.peerId=t.bytes===String?o.base64.encode(e.peerId,0,e.peerId.length):t.bytes===Array?Array.prototype.slice.call(e.peerId):e.peerId),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?o.Long.prototype.toString.call(e.seq):t.longs===Number?new o.LongBits(e.seq.low>>>0,e.seq.high>>>0).toNumber(!0):e.seq),e.addresses&&e.addresses.length){r.addresses=[];for(var i=0;i<e.addresses.length;++i)r.addresses[i]=a.PeerRecord.AddressInfo.toObject(e.addresses[i],t)}return r},e.prototype.toJSON=function(){return this.constructor.toObject(this,n.util.toJSONOptions)},e.AddressInfo=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.multiaddr=o.newBuffer([]),e.encode=function(e,t){return t||(t=s.create()),null!=e.multiaddr&&Object.hasOwnProperty.call(e,"multiaddr")&&t.uint32(10).bytes(e.multiaddr),t},e.decode=function(e,t){e instanceof i||(e=i.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new a.PeerRecord.AddressInfo;e.pos<r;){var s=e.uint32();if(s>>>3===1)n.multiaddr=e.bytes();else e.skipType(7&s)}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?o.base64.decode(e.multiaddr,t.multiaddr=o.newBuffer(o.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=o.newBuffer(r.multiaddr)))),null!=e.multiaddr&&e.hasOwnProperty("multiaddr")&&(r.multiaddr=t.bytes===String?o.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},17335:(e,t,r)=>{"use strict";const n=r(76869),i=r(73374);e.exports.updateSelfPeerRecord=async function(e){const t=new i({peerId:e.peerId,multiaddrs:e.multiaddrs}),r=await n.seal(t,e.peerId);await e.peerStore.addressBook.consumePeerRecord(r)}},9828:(e,t,r)=>{"use strict";const n=r(18392),i=Object.assign(n("libp2p:registrar"),{error:n("libp2p:registrar:err")}),s=r(67963),{codes:{ERR_INVALID_PARAMETERS:o}}=r(59087),a=r(59617);e.exports=class{constructor(e){let{peerStore:t,connectionManager:r}=e;this.peerStore=t,this.connectionManager=r,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)}async register(e){if(!a.isTopology(e))throw i.error("topology must be an instance of interfaces/topology"),s(new Error("topology must be an instance of interfaces/topology"),o);const t=(1e9*Math.random()).toString(36)+Date.now();return this.topologies.set(t,e),await e.setRegistrar(this),t}unregister(e){return this.topologies.delete(e)}_onDisconnect(e){for(const[,t]of this.topologies)t.disconnect(e.remotePeer)}}},48350:(e,t,r)=>{"use strict";const n=r(18392),i=Object.assign(n("libp2p:transports"),{error:n("libp2p:transports:err")}),s=r(3781),{codes:o}=r(59087),a=r(67963),{updateSelfPeerRecord:c}=r(17335);class u{constructor(e){let{libp2p:t,upgrader:r,faultTolerance:n=l.FATAL_ALL}=e;this.libp2p=t,this.upgrader=r,this._transports=new Map,this._listeners=new Map,this._listenerOptions=new Map,this.faultTolerance=n}add(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(i("adding %s",e),!e)throw a(new Error("Transport must have a valid key, was given '".concat(e,"'")),o.ERR_INVALID_KEY);if(this._transports.has(e))throw a(new Error("There is already a transport with this key"),o.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 t of this._listeners.keys())this._listeners.set(t,[])}async dial(e,t){const r=this.transportForMultiaddr(e);if(!r)throw a(new Error("No transport available for address ".concat(String(e))),o.ERR_TRANSPORT_UNAVAILABLE);try{return await r.dial(e,t)}catch(n){throw n.code||(n.code=o.ERR_TRANSPORT_DIAL_FAILED),n}}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),h=[];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))),h.push(t.listen(e))}if(0===h.length){t.push(r);continue}if(!(await s(h)).find((e=>!0===e.isFulfilled))&&this.faultTolerance!==l.NO_FATAL)throw a(new Error("Transport (".concat(r,") could not listen on any available address")),o.ERR_NO_VALID_ADDRESSES)}if(t.length===this._transports.size){const e="no valid addresses were provided for transports [".concat(t,"]");if(this.faultTolerance===l.FATAL_ALL)throw a(new Error(e),o.ERR_NO_VALID_ADDRESSES);i("libp2p in dial mode only: ".concat(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 l={FATAL_ALL:0,NO_FATAL:1};u.FaultTolerance=l,e.exports=u},59324:(e,t,r)=>{"use strict";const n=r(18392),i=Object.assign(n("libp2p:upgrader"),{error:n("libp2p:upgrader:err")}),s=r(67963),o=r(5889),{Connection:a}=r(4438),c=r(90190),{pipe:u}=r(79023),l=r(486),{codes:h}=r(59087);e.exports=class{constructor(e){let{localPeer:t,metrics:r,connectionGater:n,cryptos:i=new Map,muxers:s=new Map,onConnectionEnd:o=(()=>{}),onConnection:a=(()=>{})}=e;this.connectionGater=n,this.localPeer=t,this.metrics=r,this.cryptos=i,this.muxers=s,this.protector=null,this.protocols=new Map,this.onConnection=a,this.onConnectionEnd=o}async upgradeInbound(e){let t,r,n,o,a,c,u;if(await this.connectionGater.denyInboundConnection(e))throw s(new Error("The multiaddr connection is blocked by gater.acceptConnection"),h.ERR_CONNECTION_INTERCEPTED);if(this.metrics){({setTarget:c,proxy:u}=l());const t=(1e9*Math.random()).toString(36)+Date.now();c({toB58String:()=>t}),e=this.metrics.trackStream({stream:e,remotePeer:u})}i("Starting the inbound connection upgrade");let d=e;this.protector&&(d=await this.protector.protect(e));try{if(({conn:t,remotePeer:r,protocol:a}=await this._encryptInbound(this.localPeer,d,this.cryptos)),await this.connectionGater.denyInboundEncryptedConnection(r,t))throw s(new Error("The multiaddr connection is blocked by gater.acceptEncryptedConnection"),h.ERR_CONNECTION_INTERCEPTED);this.muxers.size?({stream:n,Muxer:o}=await this._multiplexInbound(t,this.muxers)):n=t}catch(f){throw i.error("Failed to upgrade inbound connection",f),await e.close(f),f}if(await this.connectionGater.denyInboundUpgradedConnection(r,t))throw s(new Error("The multiaddr connection is blocked by gater.acceptEncryptedConnection"),h.ERR_CONNECTION_INTERCEPTED);return this.metrics&&(this.metrics.updatePlaceholder(u,r),c(r)),i("Successfully upgraded inbound connection"),this._createConnection({cryptoProtocol:a,direction:"inbound",maConn:e,upgradedConn:n,Muxer:o,remotePeer:r})}async upgradeOutbound(e){const t=e.remoteAddr.getPeerId();if(!t)throw s(new Error("outbound connection must have a peer id"),h.ERR_INVALID_MULTIADDR);const r=c.createFromB58String(t);if(await this.connectionGater.denyOutboundConnection(r,e))throw s(new Error("The multiaddr connection is blocked by connectionGater.denyOutboundConnection"),h.ERR_CONNECTION_INTERCEPTED);let n,o,a,u,d,f,p;if(this.metrics){({setTarget:f,proxy:p}=l());const t=(1e9*Math.random()).toString(36)+Date.now();f({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{if(({conn:n,remotePeer:o,protocol:u}=await this._encryptOutbound(this.localPeer,y,r,this.cryptos)),await this.connectionGater.denyOutboundEncryptedConnection(o,n))throw s(new Error("The multiaddr connection is blocked by gater.acceptEncryptedConnection"),h.ERR_CONNECTION_INTERCEPTED);this.muxers.size?({stream:a,Muxer:d}=await this._multiplexOutbound(n,this.muxers)):a=n}catch(g){throw i.error("Failed to upgrade outbound connection",g),await e.close(g),g}if(await this.connectionGater.denyOutboundUpgradedConnection(o,n))throw s(new Error("The multiaddr connection is blocked by gater.acceptEncryptedConnection"),h.ERR_CONNECTION_INTERCEPTED);return this.metrics&&(this.metrics.updatePlaceholder(p,o),f(o)),i("Successfully upgraded outbound connection"),this._createConnection({cryptoProtocol:u,direction:"outbound",maConn:e,upgradedConn:a,Muxer:d,remotePeer:o})}_createConnection(e){var t=this;let r,n,c,{cryptoProtocol:l,direction:d,maConn:f,upgradedConn:p,Muxer:y,remotePeer:g}=e;y&&(r=new y({onStream:async e=>{if(!c)return;const t=new o.Listener(e);try{const{stream:r,protocol:n}=await t.handle(Array.from(this.protocols.keys()));i("%s: incoming stream opened on %s",d,n),this.metrics&&this.metrics.trackStream({stream:r,remotePeer:g,protocol:n}),c.addStream(e,{protocol:n}),this._onStream({connection:c,stream:{...e,...r},protocol:n})}catch(r){i.error(r)}},onStreamEnd:e=>{c.removeStream(e.id)}}),n=async e=>{i("%s: starting new stream on %s",d,e);const t=r.newStream(),n=new o.Dialer(t);try{const{stream:r,protocol:i}=await n.select(e);return this.metrics&&this.metrics.trackStream({stream:r,remotePeer:g,protocol:i}),{stream:{...t,...r},protocol:i}}catch(a){throw i.error("could not create new stream",a),s(a,h.ERR_UNSUPPORTED_PROTOCOL)}},u(p,r,p).catch(i.error));const m=f.timeline;f.timeline=new Proxy(m,{set:function(){return c&&"close"===(arguments.length<=1?void 0:arguments[1])&&(arguments.length<=2?void 0:arguments[2])&&!m.close&&(async()=>{try{"open"===c.stat.status&&await c.close()}catch(e){i.error(e)}finally{t.onConnectionEnd(c)}})().catch((e=>{i.error(e)})),Reflect.set(...arguments)}}),f.timeline.upgraded=Date.now();const v=()=>{throw s(new Error("connection is not multiplexed"),h.ERR_CONNECTION_NOT_MULTIPLEXED)};return c=new a({localAddr:f.localAddr,remoteAddr:f.remoteAddr,localPeer:this.localPeer,remotePeer:g,stat:{direction:d,timeline:f.timeline,multiplexer:y&&y.multicodec,encryption:l},newStream:n||v,getStreams:()=>r?r.streams:v(),close:async()=>{await f.close(),r&&r.streams.map((e=>e.abort()))}}),this.onConnection(c),c}_onStream(e){let{connection:t,stream:r,protocol:n}=e;this.protocols.get(n)({connection:t,stream:r,protocol:n})}async _encryptInbound(e,t,r){const n=new o.Listener(t),a=Array.from(r.keys());i("handling inbound crypto protocol selection",a);try{const{stream:t,protocol:s}=await n.handle(a),o=r.get(s);if(i("encrypting inbound connection..."),!o)throw new Error("no crypto module found for ".concat(s));return{...await o.secureInbound(e,t),protocol:s}}catch(c){throw s(c,h.ERR_ENCRYPTION_FAILED)}}async _encryptOutbound(e,t,r,n){const a=new o.Dialer(t),c=Array.from(n.keys());i("selecting outbound crypto protocol",c);try{const{stream:t,protocol:s}=await a.select(c),o=n.get(s);if(i("encrypting outbound connection to %j",r),!o)throw new Error("no crypto module found for ".concat(s));return{...await o.secureOutbound(e,t,r),protocol:s}}catch(u){throw s(u,h.ERR_ENCRYPTION_FAILED)}}async _multiplexOutbound(e,t){const r=new o.Dialer(e),n=Array.from(t.keys());i("outbound selecting muxer %s",n);try{const{stream:e,protocol:s}=await r.select(n);i("%s selected as muxer protocol",s);return{stream:e,Muxer:t.get(s)}}catch(a){throw s(a,h.ERR_MUXER_UNAVAILABLE)}}async _multiplexInbound(e,t){const r=new o.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(a){throw s(a,h.ERR_MUXER_UNAVAILABLE)}}}},18987:e=>{e.exports=r;var t=null;try{t=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(T){}function r(e,t,r){this.low=0|e,this.high=0|t,this.unsigned=!!r}function n(e){return!0===(e&&e.__isLong__)}r.prototype.__isLong__,Object.defineProperty(r.prototype,"__isLong__",{value:!0}),r.isLong=n;var i={},s={};function o(e,t){var r,n,o;return t?(o=0<=(e>>>=0)&&e<256)&&(n=s[e])?n:(r=c(e,(0|e)<0?-1:0,!0),o&&(s[e]=r),r):(o=-128<=(e|=0)&&e<128)&&(n=i[e])?n:(r=c(e,e<0?-1:0,!1),o&&(i[e]=r),r)}function a(e,t){if(isNaN(e))return t?m:g;if(t){if(e<0)return m;if(e>=f)return S}else{if(e<=-p)return _;if(e+1>=p)return E}return e<0?a(-e,t).neg():c(e%d|0,e/d|0,t)}function c(e,t,n){return new r(e,t,n)}r.fromInt=o,r.fromNumber=a,r.fromBits=c;var u=Math.pow;function l(e,t,r){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return g;if("number"===typeof t?(r=t,t=!1):t=!!t,(r=r||10)<2||36<r)throw RangeError("radix");var n;if((n=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===n)return l(e.substring(1),t,r).neg();for(var i=a(u(r,8)),s=g,o=0;o<e.length;o+=8){var c=Math.min(8,e.length-o),h=parseInt(e.substring(o,o+c),r);if(c<8){var d=a(u(r,c));s=s.mul(d).add(a(h))}else s=(s=s.mul(i)).add(a(h))}return s.unsigned=t,s}function h(e,t){return"number"===typeof e?a(e,t):"string"===typeof e?l(e,t):c(e.low,e.high,"boolean"===typeof t?t:e.unsigned)}r.fromString=l,r.fromValue=h;var d=4294967296,f=d*d,p=f/2,y=o(1<<24),g=o(0);r.ZERO=g;var m=o(0,!0);r.UZERO=m;var v=o(1);r.ONE=v;var b=o(1,!0);r.UONE=b;var w=o(-1);r.NEG_ONE=w;var E=c(-1,2147483647,!1);r.MAX_VALUE=E;var S=c(-1,-1,!0);r.MAX_UNSIGNED_VALUE=S;var _=c(0,-2147483648,!1);r.MIN_VALUE=_;var I=r.prototype;I.toInt=function(){return this.unsigned?this.low>>>0:this.low},I.toNumber=function(){return this.unsigned?(this.high>>>0)*d+(this.low>>>0):this.high*d+(this.low>>>0)},I.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(_)){var t=a(e),r=this.div(t),n=r.mul(t).sub(this);return r.toString(e)+n.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var i=a(u(e,6),this.unsigned),s=this,o="";;){var c=s.div(i),l=(s.sub(c.mul(i)).toInt()>>>0).toString(e);if((s=c).isZero())return l+o;for(;l.length<6;)l="0"+l;o=""+l+o}},I.getHighBits=function(){return this.high},I.getHighBitsUnsigned=function(){return this.high>>>0},I.getLowBits=function(){return this.low},I.getLowBitsUnsigned=function(){return this.low>>>0},I.getNumBitsAbs=function(){if(this.isNegative())return this.eq(_)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<<t);t--);return 0!=this.high?t+33:t+1},I.isZero=function(){return 0===this.high&&0===this.low},I.eqz=I.isZero,I.isNegative=function(){return!this.unsigned&&this.high<0},I.isPositive=function(){return this.unsigned||this.high>=0},I.isOdd=function(){return 1===(1&this.low)},I.isEven=function(){return 0===(1&this.low)},I.equals=function(e){return n(e)||(e=h(e)),(this.unsigned===e.unsigned||this.high>>>31!==1||e.high>>>31!==1)&&(this.high===e.high&&this.low===e.low)},I.eq=I.equals,I.notEquals=function(e){return!this.eq(e)},I.neq=I.notEquals,I.ne=I.notEquals,I.lessThan=function(e){return this.comp(e)<0},I.lt=I.lessThan,I.lessThanOrEqual=function(e){return this.comp(e)<=0},I.lte=I.lessThanOrEqual,I.le=I.lessThanOrEqual,I.greaterThan=function(e){return this.comp(e)>0},I.gt=I.greaterThan,I.greaterThanOrEqual=function(e){return this.comp(e)>=0},I.gte=I.greaterThanOrEqual,I.ge=I.greaterThanOrEqual,I.compare=function(e){if(n(e)||(e=h(e)),this.eq(e))return 0;var t=this.isNegative(),r=e.isNegative();return t&&!r?-1:!t&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},I.comp=I.compare,I.negate=function(){return!this.unsigned&&this.eq(_)?_:this.not().add(v)},I.neg=I.negate,I.add=function(e){n(e)||(e=h(e));var t=this.high>>>16,r=65535&this.high,i=this.low>>>16,s=65535&this.low,o=e.high>>>16,a=65535&e.high,u=e.low>>>16,l=0,d=0,f=0,p=0;return f+=(p+=s+(65535&e.low))>>>16,d+=(f+=i+u)>>>16,l+=(d+=r+a)>>>16,l+=t+o,c((f&=65535)<<16|(p&=65535),(l&=65535)<<16|(d&=65535),this.unsigned)},I.subtract=function(e){return n(e)||(e=h(e)),this.add(e.neg())},I.sub=I.subtract,I.multiply=function(e){if(this.isZero())return g;if(n(e)||(e=h(e)),t)return c(t.mul(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned);if(e.isZero())return g;if(this.eq(_))return e.isOdd()?_:g;if(e.eq(_))return this.isOdd()?_:g;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(y)&&e.lt(y))return a(this.toNumber()*e.toNumber(),this.unsigned);var r=this.high>>>16,i=65535&this.high,s=this.low>>>16,o=65535&this.low,u=e.high>>>16,l=65535&e.high,d=e.low>>>16,f=65535&e.low,p=0,m=0,v=0,b=0;return v+=(b+=o*f)>>>16,m+=(v+=s*f)>>>16,v&=65535,m+=(v+=o*d)>>>16,p+=(m+=i*f)>>>16,m&=65535,p+=(m+=s*d)>>>16,m&=65535,p+=(m+=o*l)>>>16,p+=r*f+i*d+s*l+o*u,c((v&=65535)<<16|(b&=65535),(p&=65535)<<16|(m&=65535),this.unsigned)},I.mul=I.multiply,I.divide=function(e){if(n(e)||(e=h(e)),e.isZero())throw Error("division by zero");var r,i,s;if(t)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?c((this.unsigned?t.div_u:t.div_s)(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?m:g;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return m;if(e.gt(this.shru(1)))return b;s=m}else{if(this.eq(_))return e.eq(v)||e.eq(w)?_:e.eq(_)?v:(r=this.shr(1).div(e).shl(1)).eq(g)?e.isNegative()?v:w:(i=this.sub(e.mul(r)),s=r.add(i.div(e)));if(e.eq(_))return this.unsigned?m:g;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();s=g}for(i=this;i.gte(e);){r=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var o=Math.ceil(Math.log(r)/Math.LN2),l=o<=48?1:u(2,o-48),d=a(r),f=d.mul(e);f.isNegative()||f.gt(i);)f=(d=a(r-=l,this.unsigned)).mul(e);d.isZero()&&(d=v),s=s.add(d),i=i.sub(f)}return s},I.div=I.divide,I.modulo=function(e){return n(e)||(e=h(e)),t?c((this.unsigned?t.rem_u:t.rem_s)(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},I.mod=I.modulo,I.rem=I.modulo,I.not=function(){return c(~this.low,~this.high,this.unsigned)},I.and=function(e){return n(e)||(e=h(e)),c(this.low&e.low,this.high&e.high,this.unsigned)},I.or=function(e){return n(e)||(e=h(e)),c(this.low|e.low,this.high|e.high,this.unsigned)},I.xor=function(e){return n(e)||(e=h(e)),c(this.low^e.low,this.high^e.high,this.unsigned)},I.shiftLeft=function(e){return n(e)&&(e=e.toInt()),0===(e&=63)?this:e<32?c(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):c(0,this.low<<e-32,this.unsigned)},I.shl=I.shiftLeft,I.shiftRight=function(e){return n(e)&&(e=e.toInt()),0===(e&=63)?this:e<32?c(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):c(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},I.shr=I.shiftRight,I.shiftRightUnsigned=function(e){if(n(e)&&(e=e.toInt()),0===(e&=63))return this;var t=this.high;return e<32?c(this.low>>>e|t<<32-e,t>>>e,this.unsigned):c(32===e?t:t>>>e-32,0,this.unsigned)},I.shru=I.shiftRightUnsigned,I.shr_u=I.shiftRightUnsigned,I.toSigned=function(){return this.unsigned?c(this.low,this.high,!1):this},I.toUnsigned=function(){return this.unsigned?this:c(this.low,this.high,!0)},I.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},I.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},I.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},r.fromBytes=function(e,t,n){return n?r.fromBytesLE(e,t):r.fromBytesBE(e,t)},r.fromBytesLE=function(e,t){return new r(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},r.fromBytesBE=function(e,t){return new r(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)}},18322:(e,t,r)=>{"use strict";const{Multiaddr:n}=r(98719),i=k("dns4"),s=k("dns6"),o=k("dnsaddr"),a=P(k("dns"),o,i,s),c=P(k("ip4"),k("ip6")),u=P(R(c,k("tcp")),R(a,k("tcp"))),l=R(c,k("udp")),h=R(l,k("utp")),d=R(l,k("quic")),f=P(R(u,k("ws")),R(a,k("ws"))),p=P(R(u,k("wss")),R(a,k("wss"))),y=P(R(u,k("http")),R(c,k("http")),R(a,k("http"))),g=P(R(u,k("https")),R(c,k("https")),R(a,k("https"))),m=P(R(f,k("p2p-webrtc-star"),k("p2p")),R(p,k("p2p-webrtc-star"),k("p2p")),R(f,k("p2p-webrtc-star")),R(p,k("p2p-webrtc-star"))),v=P(R(f,k("p2p-websocket-star"),k("p2p")),R(p,k("p2p-websocket-star"),k("p2p")),R(f,k("p2p-websocket-star")),R(p,k("p2p-websocket-star"))),b=P(R(y,k("p2p-webrtc-direct"),k("p2p")),R(g,k("p2p-webrtc-direct"),k("p2p")),R(y,k("p2p-webrtc-direct")),R(g,k("p2p-webrtc-direct"))),w=P(f,p,y,g,m,b,u,h,d,a),E=P(R(w,k("p2p-stardust"),k("p2p")),R(w,k("p2p-stardust"))),S=P(R(w,k("p2p")),m,b,k("p2p")),_=P(R(S,k("p2p-circuit"),S),R(S,k("p2p-circuit")),R(k("p2p-circuit"),S),R(w,k("p2p-circuit")),R(k("p2p-circuit"),w),k("p2p-circuit")),I=()=>P(R(_,I),_),T=I(),A=P(R(T,S,T),R(S,T),R(T,S),T,S);function C(e){return function(t){if(!n.isMultiaddr(t))try{t=new n(t)}catch(i){return!1}const r=e(t.protoNames());return null!==r&&(!0===r||!1===r?r:0===r.length)}}function R(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];function n(e){if(e.length<t.length)return null;let r=e;return t.some((t=>(r="function"===typeof t?t().partialMatch(e):t.partialMatch(e),Array.isArray(r)&&(e=r),null===r))),r}return{toString:function(){return"{ "+t.join(" ")+" }"},input:t,matches:C(n),partialMatch:n}}function P(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];function n(e){let r=null;return t.some((t=>{const n="function"===typeof t?t().partialMatch(e):t.partialMatch(e);return!!n&&(r=n,!0)})),r}const i={toString:function(){return"{ "+t.join(" ")+" }"},input:t,matches:C(n),partialMatch:n};return i}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(s){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:s,DNSADDR:o,IP:c,TCP:u,UDP:l,QUIC:d,UTP:h,HTTP:y,HTTPS:g,WebSockets:f,WebSocketsSecure:p,WebSocketStar:v,WebRTCStar:m,WebRTCDirect:b,Reliable:w,Stardust:E,Circuit:T,P2P:A,IPFS:A}},89842:function(e,t,r){"use strict";const n=r(43440),{hasOwnProperty:i}=Object.prototype,{propertyIsEnumerable:s}=Object,o=(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)s.call(e,n)&&t.push(n)}return t};function l(e){return Array.isArray(e)?function(e){const t=e.slice(0,0);return u(e).forEach((r=>{o(t,r,l(e[r]))})),t}(e):n(e)?function(e){const t=null===Object.getPrototypeOf(e)?Object.create(null):{};return u(e).forEach((r=>{o(t,r,l(e[r]))})),t}(e):e}const h=(e,t,r,n)=>(r.forEach((r=>{"undefined"===typeof t[r]&&n.ignoreUndefined||(r in e&&e[r]!==Object.getPrototypeOf(e)?o(e,r,d(e[r],t[r],n)):o(e,r,l(t[r])))})),e);function d(e,t,r){return r.concatArrays&&Array.isArray(e)&&Array.isArray(t)?((e,t,r)=>{let n=e.slice(0,0),s=0;return[e,t].forEach((t=>{const a=[];for(let r=0;r<t.length;r++)i.call(t,r)&&(a.push(String(r)),o(n,s++,t===e?t[r]:l(t[r])));n=h(n,t,u(t).filter((e=>!a.includes(e))),r)})),n})(e,t,r):n(t)&&n(e)?h(e,t,u(t),r):l(t)}e.exports=function(){const e=d(l(c),this!==a&&this||{},c);let t={_:{}};for(var r=arguments.length,i=new Array(r),s=0;s<r;s++)i[s]=arguments[s];for(const o of i)if(void 0!==o){if(!n(o))throw new TypeError("`"+o+"` is not an Option Object");t=d(t,{_:o},e)}return t._}},43440: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}},80842:(e,t,r)=>{const n=r(47465).EventEmitter,{nanoid:i}=r(75926),{WORKER_REQUEST_READ_LOCK:s,WORKER_RELEASE_READ_LOCK:o,MASTER_GRANT_READ_LOCK:a,WORKER_REQUEST_WRITE_LOCK:c,WORKER_RELEASE_WRITE_LOCK:u,MASTER_GRANT_WRITE_LOCK:l}=r(20185),h=r(85913),d=(e,t,r,n,i)=>(s,o)=>{if(!o||!o.data||o.data.type!==r)return;const a={type:o.data.type,name:o.data.name,identifier:o.data.identifier};e.emit(t,a.name,(()=>(s.postMessage({type:i,name:a.name,identifier:a.identifier}),new Promise((e=>{const t=r=>{if(!r||!r.data)return;const i={type:r.data.type,name:r.data.name,identifier:r.data.identifier};i&&i.type===n&&i.identifier===a.identifier&&(s.removeEventListener("message",t),e())};s.addEventListener("message",t)})))))},f=(e,t,r,n)=>()=>{const s=i();return globalThis.postMessage({type:t,identifier:s,name:e}),new Promise((t=>{const i=o=>{if(!o||!o.data)return;const a={type:o.data.type,identifier:o.data.identifier};a&&a.type===r&&a.identifier===s&&(globalThis.removeEventListener("message",i),t((()=>{globalThis.postMessage({type:n,identifier:s,name:e})})))};globalThis.addEventListener("message",i)}))},p={singleProcess:!1};e.exports=e=>{e=Object.assign({},p,e);if(!!globalThis.document||e.singleProcess){const e=new n;return h.addEventListener("message",d(e,"requestReadLock",s,o,a)),h.addEventListener("message",d(e,"requestWriteLock",c,u,l)),e}return{isWorker:!0,readLock:e=>f(e,s,a,o),writeLock:e=>f(e,c,l,u)}}},20185:e=>{e.exports={WORKER_REQUEST_READ_LOCK:"lock:worker:request-read",WORKER_RELEASE_READ_LOCK:"lock:worker:release-read",MASTER_GRANT_READ_LOCK:"lock:master:grant-read",WORKER_REQUEST_WRITE_LOCK:"lock:worker:request-write",WORKER_RELEASE_WRITE_LOCK:"lock:worker:release-write",MASTER_GRANT_WRITE_LOCK:"lock:master:grant-write"}},31127:(e,t,r)=>{const n=r(1801),i=r(80842),{default:s}=r(12906),{timeout:o}=r(58541),a=r(85913),c={};let u;function l(e,t){let r;const n=new Promise((e=>{r=e}));return e.add((()=>o(new Promise((e=>{r((()=>{e()}))})),t.timeout))),n}const h={concurrency:1/0,timeout:846e5,global:r.g,singleProcess:!1};e.exports=(e,t)=>(t||(t={}),"object"===typeof e&&(t=e,e="lock"),e||(e="lock"),t=Object.assign({},h,t),u||(u=n(t)||i(t),u.isWorker||(u.on("requestReadLock",((e,t)=>{c[e]&&c[e].readLock().then((e=>t().finally((()=>e()))))})),u.on("requestWriteLock",(async(e,t)=>{c[e]&&c[e].writeLock().then((e=>t().finally((()=>e()))))})))),c[e]||(c[e]=((e,t)=>{if(u.isWorker)return{readLock:u.readLock(e,t),writeLock:u.writeLock(e,t)};const r=new s({concurrency:1});let n=null;return{readLock:()=>{if(n)return l(n,t);n=new s({concurrency:t.concurrency,autoStart:!1});const e=n,i=l(n,t);return r.add((()=>(e.start(),e.onIdle().then((()=>{n===e&&(n=null)}))))),i},writeLock:()=>(n=null,l(r,t))}})(e,t)),c[e]),e.exports.Worker=function(e,t){let n;t=t||r.g.Worker;try{n=new t(e)}catch(i){i.message.includes("not a constructor")&&(n=t(e))}if(!n)throw new Error("Could not create Worker from",t);return a(n),n}},1801:(e,t,r)=>{var n=r(21964);const i=r(47465).EventEmitter,{nanoid:s}=r(75926),{WORKER_REQUEST_READ_LOCK:o,WORKER_RELEASE_READ_LOCK:a,MASTER_GRANT_READ_LOCK:c,WORKER_REQUEST_WRITE_LOCK:u,WORKER_RELEASE_WRITE_LOCK:l,MASTER_GRANT_WRITE_LOCK:h}=r(20185);let d;const f=(e,t,r,n,i)=>(s,o)=>{o&&o.type===r&&e.emit(t,o.name,(()=>(s.send({type:i,name:o.name,identifier:o.identifier}),new Promise((e=>{const t=r=>{r&&r.type===n&&r.identifier===o.identifier&&(s.removeListener("message",t),e())};s.on("message",t)})))))},p=(e,t,r,i)=>()=>{const o=s();return n.send({type:t,identifier:o,name:e}),new Promise((t=>{const s=a=>{a&&a.type===r&&a.identifier===o&&(n.removeListener("message",s),t((()=>{n.send({type:i,identifier:o,name:e})})))};n.on("message",s)}))};e.exports=e=>{try{if(d=r(21724),!Object.keys(d).length)return}catch(t){return}if(d.isMaster||e.singleProcess){const e=new i;return d.on("message",f(e,"requestReadLock",o,a,c)),d.on("message",f(e,"requestWriteLock",u,l,h)),e}return{isWorker:!0,readLock:e=>p(e,o,c,a),writeLock:e=>p(e,u,h,l)}}},78193:e=>{var t=1e3,r=60*t,n=60*r,i=24*n,s=7*i,o=365.25*i;function a(e,t,r,n){var i=t>=1.5*r;return Math.round(e/r)+" "+n+(i?"s":"")}e.exports=function(e,c){c=c||{};var u=typeof e;if("string"===u&&e.length>0)return function(e){if((e=String(e)).length>100)return;var a=/^(-?(?:\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(!a)return;var c=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*s;case"days":case"day":case"d":return c*i;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;case"minutes":case"minute":case"mins":case"min":case"m":return c*r;case"seconds":case"second":case"secs":case"sec":case"s":return c*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(e);if("number"===u&&isFinite(e))return c.long?function(e){var s=Math.abs(e);if(s>=i)return a(e,s,i,"day");if(s>=n)return a(e,s,n,"hour");if(s>=r)return a(e,s,r,"minute");if(s>=t)return a(e,s,t,"second");return e+" ms"}(e):function(e){var s=Math.abs(e);if(s>=i)return Math.round(e/i)+"d";if(s>=n)return Math.round(e/n)+"h";if(s>=r)return Math.round(e/r)+"m";if(s>=t)return Math.round(e/t)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},94655:(e,t,r)=>{const{Multiaddr:n}=r(98719),i=(e,t)=>t,s={ip4:i,ip6:(e,t,r,n)=>1===n.length&&"ip6"===n[0].protocol?t:"[".concat(t,"]"),tcp:(e,t,r,n,i)=>n.some((e=>["http","https","ws","wss"].includes(e.protocol)))?"".concat(e,":").concat(t):((e,t,r,n)=>{if(n&&!1===n.assumeHttp)return"tcp://".concat(e,":").concat(t);let i="tcp",s=":".concat(t);return"tcp"===r[r.length-1].protocol&&(i="443"===t?"https":"http",s="443"===t||"80"===t?"":s),"".concat(i,"://").concat(e).concat(s)})(e,t,n,i),udp:(e,t)=>"udp://".concat(e,":").concat(t),dnsaddr:i,dns4:i,dns6:i,ipfs:(e,t)=>"".concat(e,"/ipfs/").concat(t),p2p:(e,t)=>"".concat(e,"/p2p/").concat(t),http:e=>"http://".concat(e),https:e=>"https://".concat(e),ws:e=>"ws://".concat(e),wss:e=>"wss://".concat(e),"p2p-websocket-star":e=>"".concat(e,"/p2p-websocket-star"),"p2p-webrtc-star":e=>"".concat(e,"/p2p-webrtc-star"),"p2p-webrtc-direct":e=>"".concat(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 o=s[r.protocol];if(!o)throw new Error("Unsupported protocol ".concat(r.protocol));return o(e,r.content,n,i,t)}),"")}},63058:(e,t,r)=>{"use strict";const n=r(93516),i=r(70023),s=r(74561),{concat:o}=r(62110),{toString:a}=r(82051);function c(e){const t=[],r=e.split("/").slice(1);if(1===r.length&&""===r[0])return[];for(let n=0;n<r.length;n++){const s=r[n],o=i(s);if(0!==o.size){if(n++,n>=r.length)throw b("invalid address: "+e);if(o.path){t.push([s,v(r.slice(n).join("/"))]);break}t.push([s,r[n]])}else t.push([s])}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})),v(t.join("/"))}function l(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 h(e){return e.map((e=>{const t=w(e);return e[1]?[t.code,n.toString(t.code,e[1])]:[t.code]}))}function d(e){return g(o(e.map((e=>{const t=w(e);let r=Uint8Array.from(s.encode(t.code));return e.length>1&&(r=o([r,e[1]])),r}))))}function f(e,t){if(e.size>0)return e.size/8;if(0===e.size)return 0;return s.decode(t)+s.decode.bytes}function p(e){const t=[];let r=0;for(;r<e.length;){const n=s.decode(e,r),o=s.decode.bytes,c=f(i(n),e.slice(r+o));if(0===c){t.push([n]),r+=o;continue}const u=e.slice(r+o,r+o+c);if(r+=c+o,r>e.length)throw b("Invalid address Uint8Array: "+a(e,"base16"));t.push([n,u])}return t}function y(e){return d(l(c(e=v(e))))}function g(e){const t=m(e);if(t)throw t;return Uint8Array.from(e)}function m(e){try{p(e)}catch(t){return t}}function v(e){return"/"+e.trim().split("/").filter((e=>e)).join("/")}function b(e){return new Error("Error parsing address: "+e)}function w(e){return i(e[0])}e.exports={stringToStringTuples:c,stringTuplesToString:u,tuplesToStringTuples:h,stringTuplesToTuples:l,bytesToTuples:p,tuplesToBytes:d,bytesToString:function(e){const t=p(e);return u(h(t))},stringToBytes:y,fromString:function(e){return y(e)},fromBytes:g,validateBytes:m,isValidBytes:function(e){return void 0===m(e)},cleanPath:v,ParseError:b,protoFromTuple:w,sizeForAddr:f}},93516:(e,t,r)=>{"use strict";const n=r(99745),i=r(70023),{CID:s}=r(16629),{base32:o}=r(71128),{base58btc:a}=r(86898),c=r(8315),u=r(74561),{toString:l}=r(82051),{fromString:h}=r(46765),{concat:d}=r(62110);function f(e,t){return t instanceof Uint8Array?f.toString(e,t):f.toBytes(e,t)}function p(e){if(!n.isIP(e))throw new Error("invalid ip address");return n.toBytes(e)}function y(e){const t=new ArrayBuffer(2);return new DataView(t).setUint16(0,e),new Uint8Array(t)}function g(e){return new DataView(e.buffer).getUint16(e.byteOffset)}function m(e){const t=e.slice(0,e.length-2),r=e.slice(e.length-2);return l(t,"base32")+":"+g(r)}e.exports=f,f.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 g(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 l(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 l(r,"base58btc")}(t);case 444:case 445:return m(t);default:return l(t,"base16")}},f.toBytes=function(e,t){switch(i(e).code){case 4:case 41:return p(t);case 6:case 273:case 33:case 132:return y(parseInt(t,10));case 53:case 54:case 55:case 56:case 400:case 777:return function(e){const t=h(e),r=Uint8Array.from(u.encode(t.length));return d([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".concat(e))).bytes:s.parse(e).multihash.bytes;const r=Uint8Array.from(u.encode(t.length));return d([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=o.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=y(n);return d([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=o.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=y(n);return d([r,i],r.length+i.length)}(t);default:return h(t,"base16")}}},98719:(e,t,r)=>{"use strict";const n=r(63058),i=r(70023),s=r(74561),{CID:o}=r(16629),{base58btc:a}=r(86898),c=r(67963),u=Symbol.for("nodejs.util.inspect.custom"),{toString:l}=r(82051),{equals:h}=r(98779),d=new Map,f=Symbol.for("@multiformats/js-multiaddr/multiaddr");class p{constructor(e){if(null==e&&(e=""),Object.defineProperty(this,f,{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 "'.concat(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(;r<t.length;){const o=s.decode(t,r),a=s.decode.bytes,c=i(o);r+=n.sizeForAddr(c,t.slice(r+a))+a,e.push(o)}return e}protoNames(){return this.protos().map((e=>e.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]?l(a.decode("z".concat(e)),"base58btc"):l(o.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 h(this.bytes,e.bytes)}async resolve(){const e=this.protos().find((e=>e.resolvable));if(!e)return[this];const t=d.get(e.name);if(!t)throw c(new Error("no available resolver for ".concat(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: \"'".concat(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: \"'".concat(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 '".concat(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[f])}[u](){return"<Multiaddr "+l(this.bytes,"base16")+" - "+n.bytesToString(this.bytes)+">"}inspect(){return"<Multiaddr "+l(this.bytes,"base16")+" - "+n.bytesToString(this.bytes)+">"}}p.protocols=i,p.resolvers=d,e.exports={Multiaddr:p,multiaddr:function(e){return new p(e)},protocols:i,resolvers:d}},99745:(e,t,r)=>{"use strict";const n=r(62795),{toString:i}=r(82051),s=n,o=n.v4,a=n.v6,c=function(e,t,r){let n;if(r=~~r,o(e))n=t||new Uint8Array(r+4),e.split(/\./g).map((function(e){n[r++]=255&parseInt(e,10)}));else if(a(e)){const s=e.split(":",8);let a;for(a=0;a<s.length;a++){let e;o(s[a])&&(e=c(s[a]),s[a]=i(e.slice(0,2),"base16")),e&&++a<8&&s.splice(a,0,i(e.slice(2,4),"base16"))}if(""===s[0])for(;s.length<8;)s.unshift("0");else if(""===s[s.length-1])for(;s.length<8;)s.push("0");else if(s.length<8){for(a=0;a<s.length&&""!==s[a];a++);const e=[a,"1"];for(a=9-s.length;a>0;a--)e.push("0");s.splice.apply(s,e)}for(n=t||new Uint8Array(r+16),a=0;a<s.length;a++){const e=parseInt(s[a],16);n[r++]=e>>8&255,n[r++]=255&e}}if(!n)throw Error("Invalid ip address: "+e);return n};e.exports={isIP:s,isV4:o,isV6:a,toBytes:c,toString:function(e,t,r){t=~~t,r=r||e.length-t;const n=[];let i;const s=new DataView(e.buffer);if(4===r){for(let i=0;i<r;i++)n.push(e[t+i]);i=n.join(".")}else if(16===r){for(let e=0;e<r;e+=2)n.push(s.getUint16(t+e).toString(16));i=n.join(":"),i=i.replace(/(^|:)0(:0)*:0(:|$)/,"$1::$3"),i=i.replace(/:{3,4}/,"::")}return i}}},70023:e=>{"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},34669:(e,t,r)=>{"use strict";const n=r(18259);e.exports=n},44689:(e,t,r)=>{"use strict";const n=r(70023),{code:i}=n("dnsaddr");e.exports={dnsaddrResolver:async function(e){const t=new(r(34669)),n=e.getPeerId(),[,s]=e.stringTuples().find((e=>{let[t]=e;return t===i}))||[];let o=(await t.resolveTxt("_dnsaddr.".concat(s))).flat().map((e=>e.split("=")[1]));return n&&(o=o.filter((e=>e.includes(n)))),o}}},96940:(e,t)=>{"use strict";t.PROTOCOL_ID="/multistream/1.0.0"},99848:(e,t,r)=>{"use strict";const n=r(18392),i=r(41976),s=r(90504),o=r(39610),{PROTOCOL_ID:a}=r(96940),c=Object.assign(n("mss:handle"),{error:n("mss:handle:error")});e.exports=async function(e,t,r){t=Array.isArray(t)?t:[t];const{writer:n,reader:u,rest:l,stream:h}=o(e);for(;;){const e=(await s.read(u,r)).toString();if(c('read "%s"',e),e!==a){if(t.includes(e))return s.write(n,e),c('respond with "%s" for "%s"',e,e),l(),{stream:h,protocol:e};"ls"!==e?(s.write(n,"na"),c('respond with "na" for "%s"',e)):(s.write(n,new i(t.map((e=>s.encode(e))))),c('respond with "%s" for %s',t,e))}else c('respond with "%s" for "%s"',a,e),s.write(n,a)}}},5889:(e,t,r)=>{"use strict";const n=r(40995),i=r(99848),s=r(46995),{PROTOCOL_ID:o}=r(96940);t.PROTOCOL_ID=o;class a{constructor(e){this._stream=e,this._shaken=!1}async _handshake(e){if(this._shaken)return;const{stream:t}=await n(this._stream,o,void 0,e);this._stream=t,this._shaken=!0}}t.Dialer=class extends a{select(e,t){return n(this._stream,e,this._shaken?void 0:o,t)}async ls(e){await this._handshake(e);const t=await s(this._stream,e),{stream:r,protocols:n}=t;return this._stream=r,n}};t.Listener=class extends a{handle(e,t){return i(this._stream,e,t)}}},46995:(e,t,r)=>{"use strict";const n=r(55502),i=r(18392),s=r(90504),o=r(39610),a=r(44709),{pipe:c}=r(79023),u=Object.assign(i("mss:ls"),{error:i("mss:ls:error")});e.exports=async function(e,t){const{reader:r,writer:i,rest:l,stream:h}=o(e);u('write "ls"'),s.write(i,"ls"),l();const d=await s.read(r,t),f=n([d]),p=[];await c(f,a.decode(),(async e=>{for await(const t of e)p.push(t.shallowSlice(0,-1).toString())}));return{stream:h,protocols:p}}},90504:(e,t,r)=>{"use strict";const n=r(41976),i=r(44709),{pipe:s}=r(79023),o=r(67963),{fromString:a}=r(46765),c=r(84744),{source:u}=r(64183),l=a("\n");function h(e){return i.encode.single(new n([e,l]))}e.exports={encode:h,write:function(e,t){e.push(h(t))},writeAll:async function(e,t){e.push(t.reduce(((e,t)=>e.append(h(t))),new n))},read:async function(e,t){let r=1;const n={[Symbol.asyncIterator](){return this},next:()=>e.next(r)};let a=n;t&&t.signal&&(a=u(n,t.signal));const h=await s(a,i.decode({onLength:e=>{r=e}}),c);if(h.get(h.length-1)!==l[0])throw o(new Error("missing newline"),"ERR_INVALID_MULTISTREAM_SELECT_MESSAGE");return h.shallowSlice(0,-1)}}},40995:(e,t,r)=>{"use strict";const n=r(18392),i=r(67963),s=r(90504),o=r(39610),a=Object.assign(n("mss:select"),{error:n("mss:select:error")});e.exports=async function(e,t,r,n){t=Array.isArray(t)?[...t]:[t];const{reader:c,writer:u,rest:l,stream:h}=o(e),d=t.shift();if(!d)throw new Error("At least one protocol must be specified");r?(a('select: write ["%s", "%s"]',r,d),s.writeAll(u,[r,d])):(a('select: write "%s"',d),s.write(u,d));let f=(await s.read(c,n)).toString();if(a('select: read "%s"',f),f===r&&(f=(await s.read(c,n)).toString(),a('select: read "%s"',f)),f===d)return l(),{stream:h,protocol:d};for(const i of t){a('select: write "%s"',i),s.write(u,i);const e=(await s.read(c,n)).toString();if(a('select: read "%s" for "%s"',e,i),e===i)return l(),{stream:h,protocol:i}}throw l(),i(new Error("protocol selection failed"),"ERR_UNSUPPORTED_PROTOCOL")}},486:e=>{"use strict";function t(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}e.exports=function(e){var r=void 0,n=void 0;function i(e){if(!(e instanceof Object))throw new Error('Target "'+e+'" is not an object');n=e}function s(e){Object.keys(e).forEach((function(t){var r=e[t];if("function"!==typeof r)throw new Error('Trap "'+t+": "+r+'" is not a function');if(!Reflect[t])throw new Error('Trap "'+t+": "+r+'" is not a valid trap')})),r=e}i((function(){})),e&&i(e),s(Reflect);var o=new Proxy({},{get:function(e,i){return function(){for(var e=arguments.length,s=Array(e),o=0;o<e;o++)s[o]=arguments[o];return r[i].apply(null,[n].concat(t(s.slice(1))))}}});return{setTarget:i,setHandler:s,getTarget:function(){return n},getHandler:function(){return r},proxy:new Proxy(n,o)}}},1900:(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(45359).default,Headers:r(45359).Headers,Request:r(45359).Request,Response:r(45359).Response}},27922:function(e,t){(function(){var e,r,n,i,s,o,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,s,o,a;for(t=[],i=s=0;s<=3&&0!==e.length;i=++s){if(i>0){if("."!==e[0])throw new Error("Invalid IP");e=e.substring(1)}o=(a=r(e))[0],n=a[1],e=e.substring(n),t.push(o)}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"),o=n("a"),s=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<e.length;){if("0"<=e[a]&&e[a]<=r)c=c*t+(n(e[a])-i)>>>0;else{if(16!==t)break;if("a"<=e[a]&&e[a]<="f")c=c*t+(10+n(e[a])-o)>>>0;else{if(!("A"<=e[a]&&e[a]<="F"))break;c=c*t+(10+n(e[a])-s)>>>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(s){throw s,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(s){throw s,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)},45359:(e,t)=>{"use strict";var r=function(){if("undefined"!==typeof self)return self;if("undefined"!==typeof window)return window;if("undefined"!==typeof 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},85913:e=>{const t={},r=e=>{e.addEventListener("message",(t=>{r.dispatchEvent("message",e,t)})),e.port&&e.port.addEventListener("message",(t=>{r.dispatchEvent("message",e,t)}))};r.addEventListener=(e,r)=>{t[e]||(t[e]=[]),t[e].push(r)},r.removeEventListener=(e,r)=>{t[e]&&(t[e]=t[e].filter((e=>e===r)))},r.dispatchEvent=function(){const e=Array.prototype.slice.call(arguments),r=e.shift();t[r]&&t[r].forEach((t=>t.apply(null,e)))},e.exports=r},61552:(e,t,r)=>{"use strict";const n=r(22514),i=r(28055);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},28055: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 function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return new r(((t,r,i)=>{n.push(i),e(...n).then(t,r)}))}}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(r){return void this._reject(r)}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},70121:e=>{"use strict";e.exports=()=>{const e={};return e.promise=new Promise(((t,r)=>{e.resolve=t,e.reject=r})),e}},49879:(e,t,r)=>{const n=r(75125),i=r(70121);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()}}},49674:e=>{"use strict";e.exports=(e,t)=>(t=t||(()=>{}),e.then((e=>new Promise((e=>{e(t())})).then((()=>e))),(e=>new Promise((e=>{e(t())})).then((()=>{throw e})))))},12906:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(97143),i=r(39744),s=r(95152),o=()=>{},a=new i.TimeoutError;t.default=class extends n{constructor(e){var t,r,n,i;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=o,this._resolveIdle=o,!("number"===typeof(e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:s.default},e)).intervalCap&&e.intervalCap>=1))throw new TypeError("Expected `intervalCap` to be a number from 1 and up, got `".concat(null!==(r=null===(t=e.intervalCap)||void 0===t?void 0:t.toString())&&void 0!==r?r:"","` (").concat(typeof e.intervalCap,")"));if(void 0===e.interval||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError("Expected `interval` to be a finite number >= 0, got `".concat(null!==(i=null===(n=e.interval)||void 0===n?void 0:n.toString())&&void 0!==i?i:"","` (").concat(typeof e.interval,")"));this._carryoverConcurrencyCount=e.carryoverConcurrencyCount,this._isIntervalIgnored=e.intervalCap===1/0||0===e.interval,this._intervalCap=e.intervalCap,this._interval=e.interval,this._queue=new e.queueClass,this._queueClass=e.queueClass,this.concurrency=e.concurrency,this._timeout=e.timeout,this._throwOnTimeout=!0===e.throwOnTimeout,this._isPaused=!1===e.autoStart}get _doesIntervalAllowAnother(){return this._isIntervalIgnored||this._intervalCount<this._intervalCap}get _doesConcurrentAllowAnother(){return this._pendingCount<this._concurrency}_next(){this._pendingCount--,this._tryToStartAnother(),this.emit("next")}_resolvePromises(){this._resolveEmpty(),this._resolveEmpty=o,0===this._pendingCount&&(this._resolveIdle(),this._resolveIdle=o,this.emit("idle"))}_onResumeInterval(){this._onInterval(),this._initializeIntervalIfNeeded(),this._timeoutId=void 0}_isIntervalPaused(){const e=Date.now();if(void 0===this._intervalId){const t=this._intervalEnd-e;if(!(t<0))return void 0===this._timeoutId&&(this._timeoutId=setTimeout((()=>{this._onResumeInterval()}),t)),!0;this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0}return!1}_tryToStartAnother(){if(0===this._queue.size)return this._intervalId&&clearInterval(this._intervalId),this._intervalId=void 0,this._resolvePromises(),!1;if(!this._isPaused){const e=!this._isIntervalPaused();if(this._doesIntervalAllowAnother&&this._doesConcurrentAllowAnother){const t=this._queue.dequeue();return!!t&&(this.emit("active"),t(),e&&this._initializeIntervalIfNeeded(),!0)}}return!1}_initializeIntervalIfNeeded(){this._isIntervalIgnored||void 0!==this._intervalId||(this._intervalId=setInterval((()=>{this._onInterval()}),this._interval),this._intervalEnd=Date.now()+this._interval)}_onInterval(){0===this._intervalCount&&0===this._pendingCount&&this._intervalId&&(clearInterval(this._intervalId),this._intervalId=void 0),this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0,this._processQueue()}_processQueue(){for(;this._tryToStartAnother(););}get concurrency(){return this._concurrency}set concurrency(e){if(!("number"===typeof e&&e>=1))throw new TypeError("Expected `concurrency` to be a number from 1 and up, got `".concat(e,"` (").concat(typeof e,")"));this._concurrency=e,this._processQueue()}async add(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((r,n)=>{this._queue.enqueue((async()=>{this._pendingCount++,this._intervalCount++;try{const s=void 0===this._timeout&&void 0===t.timeout?e():i.default(Promise.resolve(e()),void 0===t.timeout?this._timeout:t.timeout,(()=>{(void 0===t.throwOnTimeout?this._throwOnTimeout:t.throwOnTimeout)&&n(a)}));r(await s)}catch(s){n(s)}this._next()}),t),this._tryToStartAnother(),this.emit("add")}))}async addAll(e,t){return Promise.all(e.map((async e=>this.add(e,t))))}start(){return this._isPaused?(this._isPaused=!1,this._processQueue(),this):this}pause(){this._isPaused=!0}clear(){this._queue=new this._queueClass}async onEmpty(){if(0!==this._queue.size)return new Promise((e=>{const t=this._resolveEmpty;this._resolveEmpty=()=>{t(),e()}}))}async onIdle(){if(0!==this._pendingCount||0!==this._queue.size)return new Promise((e=>{const t=this._resolveIdle;this._resolveIdle=()=>{t(),e()}}))}get size(){return this._queue.size}sizeBy(e){return this._queue.filter(e).length}get pending(){return this._pendingCount}get isPaused(){return this._isPaused}get timeout(){return this._timeout}set timeout(e){this._timeout=e}}},57009:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r){let n=0,i=e.length;for(;i>0;){const s=i/2|0;let o=n+s;r(e[o],t)<=0?(n=++o,i-=s+1):i=s}return n}},95152:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(57009);t.default=class{constructor(){this._queue=[]}enqueue(e,t){const r={priority:(t=Object.assign({priority:0},t)).priority,run:e};if(this.size&&this._queue[this.size-1].priority>=t.priority)return void this._queue.push(r);const i=n.default(this._queue,r,((e,t)=>t.priority-e.priority));this._queue.splice(i,0,r)}dequeue(){const e=this._queue.shift();return null===e||void 0===e?void 0:e.run}filter(e){return this._queue.filter((t=>t.priority===e.priority)).map((e=>e.run))}get size(){return this._queue.length}}},39744:(e,t,r)=>{"use strict";const n=r(49674);class i extends Error{constructor(e){super(e),this.name="TimeoutError"}}const s=(e,t,r)=>new Promise(((s,o)=>{if("number"!==typeof t||t<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(t===1/0)return void s(e);const a=setTimeout((()=>{if("function"===typeof r){try{s(r())}catch(c){o(c)}return}const n="string"===typeof r?r:"Promise timed out after ".concat(t," milliseconds"),a=r instanceof Error?r:new i(n);"function"===typeof e.cancel&&e.cancel(),o(a)}),t);n(e.then(s,o),(()=>{clearTimeout(a)}))}));e.exports=s,e.exports.default=s,e.exports.TimeoutError=i},92963:e=>{"use strict";const t=async e=>{try{return{isFulfilled:!0,isRejected:!1,value:await e}}catch(t){return{isFulfilled:!1,isRejected:!0,reason:t}}};e.exports=t,e.exports.default=t},51545:(e,t,r)=>{"use strict";const n=r(99158),i=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"];class s 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 o=(e,t)=>new Promise(((r,o)=>{t={onFailedAttempt:()=>{},retries:10,...t};const a=n.operation(t);a.attempt((async n=>{try{r(await e(n))}catch(u){if(!(u instanceof Error))return void o(new TypeError('Non-error was thrown: "'.concat(u,'". You should only throw errors.')));if(u instanceof s)a.stop(),o(u.originalError);else if(u instanceof TypeError&&(c=u.message,!i.includes(c)))a.stop(),o(u);else{((e,t,r)=>{const n=r.retries-(t-1);e.attemptNumber=t,e.retriesLeft=n})(u,n,t);try{await t.onFailedAttempt(u)}catch(u){return void o(u)}a.retry(u)||o(a.mainError())}}var c}))}));e.exports=o,e.exports.default=o,e.exports.AbortError=s},3781:(e,t,r)=>{"use strict";const n=r(92963),i=r(56266);e.exports=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{concurrency:r=1/0}=t,s=i(r);return Promise.all(e.map((e=>e&&"function"===typeof e.then?n(e):n("function"===typeof e?s((()=>e())):Promise.resolve(e)))))}},56266:(e,t,r)=>{"use strict";const n=r(23731),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()()},s=function(e,t){r++;for(var s=arguments.length,o=new Array(s>2?s-2:0),a=2;a<s;a++)o[a-2]=arguments[a];const c=n(e,...o);t(c),c.then(i,i)},o=function(n,i){for(var o=arguments.length,a=new Array(o>2?o-2:0),c=2;c<o;c++)a[c-2]=arguments[c];r<e?s(n,i,...a):t.push(s.bind(null,n,i,...a))},a=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return new Promise((t=>o(e,t,...r)))};return Object.defineProperties(a,{activeCount:{get:()=>r},pendingCount:{get:()=>t.length},clearQueue:{value:()=>{t.length=0}}}),a};e.exports=i,e.exports.default=i},22514:(e,t,r)=>{"use strict";const n=r(64928),i=r(28055);class s extends Error{}e.exports=(e,t)=>new i(((r,i,o)=>{const{count:a,filter:c=(()=>!0)}=t;if(!Number.isFinite(a))return void i(new TypeError("Expected a finite number, got ".concat(typeof t.count)));const u=[],l=[];let h=0,d=!1;const f=new Set,p=()=>{for(const t of e)f.has(t)||"function"!==typeof t.cancel||t.cancel()};o(p);for(const t of e)h++,(async()=>{try{const e=await t;if(d)return;if(!c(e))throw new s("Value does not satisfy filter");u.push(e)}catch(e){l.push(e)}finally{f.add(t),!d&&(u.length===a&&(r(u),d=!0),h-l.length<a&&(i(new n(l)),d=!0),d)&&p()}})();a>h&&(i(new RangeError("Expected input to contain at least ".concat(t.count," items, but contains ").concat(h," items"))),p())})),e.exports.AggregateError=n,e.exports.FilterError=s},23807:e=>{"use strict";class t extends Error{constructor(e){super(e),this.name="TimeoutError"}}const r=(e,r,n,i)=>{let s;const o=new Promise(((o,a)=>{if("number"!==typeof r||r<0)throw new TypeError("Expected `milliseconds` to be a positive number");r!==1/0?(i={customTimers:{setTimeout:setTimeout,clearTimeout:clearTimeout},...i},s=i.customTimers.setTimeout.call(void 0,(()=>{if("function"===typeof n){try{o(n())}catch(c){a(c)}return}const i="string"===typeof n?n:"Promise timed out after ".concat(r," milliseconds"),s=n instanceof Error?n:new t(i);"function"===typeof e.cancel&&e.cancel(),a(s)}),r),(async()=>{try{o(await e)}catch(t){a(t)}finally{i.customTimers.clearTimeout.call(void 0,s)}})()):o(e)}));return o.clear=()=>{clearTimeout(s),s=void 0},o};e.exports=r,e.exports.default=r,e.exports.TimeoutError=t},23731:e=>{"use strict";const t=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return new Promise((t=>{t(e(...r))}))};e.exports=t,e.exports.default=t},90190:(e,t,r)=>{"use strict";const{CID:n}=r(16629),i=r(71128),s=r(45645),o=r(86898),a=r(24426),{base58btc:c}=r(86898),{base32:u}=r(71128),{base16:l}=r(24031),h=r(8315),d=r(36552),f=r(83708),{PeerIdProto:p}=r(48956),{equals:y}=r(98779),{fromString:g}=r(46765),{toString:m}=r(82051),{identity:v}=r(60173),b={...i,...s,...o,...a},w=Object.keys(b).reduce(((e,t)=>e.or(b[t])),u.decoder);const E=f(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=h.decode(this.id);e.code===v.code&&(this._pubKey=d.unmarshalPublicKey(e.digest))}catch(e){}return this._pubKey}set pubKey(e){this._pubKey=e}marshalPubKey(){if(this.pubKey)return d.marshalPublicKey(this.pubKey)}marshalPrivKey(){if(this.privKey)return d.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<t&&(t=e.length),"<peer.ID "+e.substr(0,t)+">"}toJSON(){return{id:this.toB58String(),privKey:T(this.marshalPrivKey()),pubKey:T(this.marshalPubKey())}}toHexString(){return l.encode(this.id).substring(1)}toBytes(){return this.id}toB58String(){return this._idB58String}toString(){if(!this._idCIDString){const e=n.createV1(114,h.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(h.decode(this.id).code===v.code)return!0}catch(e){}return!1}},{className:"PeerId",symbolName:"@libp2p/js-peer-id/PeerId"});t=e.exports=E;const S=e=>e.bytes.length<=42?h.create(v.code,e.bytes).bytes:e.hash(),_=async(e,t)=>{const r=await S(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 d.generateKeyPair(e.keyType,e.bits);return _(t,t.public)},t.createFromHexString=e=>new E(l.decode("f"+e)),t.createFromBytes=e=>{try{const r=n.decode(e);if(!I(r))throw new Error("Supplied PeerID CID is invalid");return t.createFromCID(r)}catch{if(h.decode(e).code!==v.code)throw new Error("Supplied PeerID CID is invalid");return new E(e)}},t.createFromB58String=e=>t.createFromBytes(c.decode("z"+e));const I=e=>114===e.code||112===e.code;function T(e){if(e)return m(e,"base64pad")}t.createFromCID=e=>{if(!(e=n.asCID(e))||!I(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 d.unmarshalPublicKey(t);return _(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 d.unmarshalPrivateKey(e);return _(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 d.unmarshalPublicKey(n);if(!r)return new E(t,void 0,i);const s=await d.unmarshalPrivateKey(r),o=await S(s.public);let a;if(i&&(a=await S(i)),i&&!y(o,a))throw new Error("Public and private key do not match");if(t&&!y(o,t))throw new Error("Id and private key do not match");return new E(t,s,i)},t.createFromProtobuf=async e=>{"string"===typeof e&&(e=g(e,"base16"));let t,r,{id:n,privKey:i,pubKey:s}=p.decode(e);if(i=!!i&&await d.unmarshalPrivateKey(i),s=!!s&&await d.unmarshalPublicKey(s),i&&(r=await S(i.public)),s&&(t=await S(s)),i){if(s&&!y(r,t))throw new Error("Public and private key do not match");return new E(r,i,i.public)}if(s)return new E(t,void 0,s);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".concat(e)),t.createFromBytes(w.decode(e))),t.isPeerId=e=>Boolean("object"===typeof e&&e._id&&e._idB58String)},48956:(e,t,r)=>{"use strict";var n=r(80886),i=n.Reader,s=n.Writer,o=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<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.id=o.newBuffer([]),e.prototype.pubKey=o.newBuffer([]),e.prototype.privKey=o.newBuffer([]),e.encode=function(e,t){return t||(t=s.create()),t.uint32(10).bytes(e.id),null!=e.pubKey&&Object.hasOwnProperty.call(e,"pubKey")&&t.uint32(18).bytes(e.pubKey),null!=e.privKey&&Object.hasOwnProperty.call(e,"privKey")&&t.uint32(26).bytes(e.privKey),t},e.decode=function(e,t){e instanceof i||(e=i.create(e));for(var r=void 0===t?e.len:e.pos+t,n=new a.PeerIdProto;e.pos<r;){var s=e.uint32();switch(s>>>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&s)}}if(!n.hasOwnProperty("id"))throw o.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?o.base64.decode(e.id,t.id=o.newBuffer(o.base64.length(e.id)),0):e.id.length&&(t.id=e.id)),null!=e.pubKey&&("string"===typeof e.pubKey?o.base64.decode(e.pubKey,t.pubKey=o.newBuffer(o.base64.length(e.pubKey)),0):e.pubKey.length&&(t.pubKey=e.pubKey)),null!=e.privKey&&("string"===typeof e.privKey?o.base64.decode(e.privKey,t.privKey=o.newBuffer(o.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=o.newBuffer(r.id))),t.bytes===String?r.pubKey="":(r.pubKey=[],t.bytes!==Array&&(r.pubKey=o.newBuffer(r.pubKey))),t.bytes===String?r.privKey="":(r.privKey=[],t.bytes!==Array&&(r.privKey=o.newBuffer(r.privKey)))),null!=e.id&&e.hasOwnProperty("id")&&(r.id=t.bytes===String?o.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?o.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?o.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},83931:(e,t,r)=>{"use strict";e.exports=r(53794).default},53794: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(27922),s=n(r(28974)),o=n(r(62795)),a=r(87201),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(o.default(e)&&s.default.v6().test(e))return u(e)}},58541:e=>{"use strict";var t;e.exports.timeout=function(e,r){var n,i=new t;return Promise.race([e,new Promise((function(e,t){n=setTimeout((function(){t(i)}),r)}))]).then((function(e){return clearTimeout(n),e}),(function(e){throw clearTimeout(n),e}))};(t=e.exports.TimeoutError=function(){Error.call(this),this.stack=Error().stack,this.message="Timeout"}).prototype=Object.create(Error.prototype),t.prototype.name="TimeoutError"},75368:(e,t,r)=>{"use strict";e.exports=r(8154)},80886:(e,t,r)=>{"use strict";e.exports=r(94722)},11427:e=>{"use strict";e.exports=n;var t,r=/\/|\./;function n(e,t){r.test(e)||(e="google/protobuf/"+e+".proto",t={nested:{google:{nested:{protobuf:{nested:t}}}}}),n[e]=t}n("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}}),n("duration",{Duration:t={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}),n("timestamp",{Timestamp:t}),n("empty",{Empty:{fields:{}}}),n("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}}),n("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}}),n("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}}),n.get=function(e){return n[e]||null}},77276:(e,t,r)=>{"use strict";var n=t,i=r(90222),s=r(52440);function o(e,t,r,n){if(t.resolvedType)if(t.resolvedType instanceof i){e("switch(d%s){",n);for(var s=t.resolvedType.values,o=Object.keys(s),a=0;a<o.length;++a)t.repeated&&s[o[a]]===t.typeDefault&&e("default:"),e("case%j:",o[a])("case %i:",s[o[a]])("m%s=%j",n,s[o[a]])("break");e("}")}else e('if(typeof d%s!=="object")',n)("throw TypeError(%j)",t.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",n,r,n);else{var c=!1;switch(t.type){case"double":case"float":e("m%s=Number(d%s)",n,n);break;case"uint32":case"fixed32":e("m%s=d%s>>>0",n,n);break;case"int32":case"sint32":case"sfixed32":e("m%s=d%s|0",n,n);break;case"uint64":c=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",n,n,c)('else if(typeof d%s==="string")',n)("m%s=parseInt(d%s,10)",n,n)('else if(typeof d%s==="number")',n)("m%s=d%s",n,n)('else if(typeof d%s==="object")',n)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",n,n,n,c?"true":"");break;case"bytes":e('if(typeof d%s==="string")',n)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",n,n,n)("else if(d%s.length)",n)("m%s=d%s",n,n);break;case"string":e("m%s=String(d%s)",n,n);break;case"bool":e("m%s=Boolean(d%s)",n,n)}}return e}function a(e,t,r,n){if(t.resolvedType)t.resolvedType instanceof i?e("d%s=o.enums===String?types[%i].values[m%s]:m%s",n,r,n,n):e("d%s=types[%i].toObject(m%s,o)",n,r,n);else{var s=!1;switch(t.type){case"double":case"float":e("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",n,n,n,n);break;case"uint64":s=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e('if(typeof m%s==="number")',n)("d%s=o.longs===String?String(m%s):m%s",n,n,n)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",n,n,n,n,s?"true":"",n);break;case"bytes":e("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",n,n,n,n,n);break;default:e("d%s=m%s",n,n)}}return e}n.fromObject=function(e){var t=e.fieldsArray,r=s.codegen(["d"],e.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!t.length)return r("return new this.ctor");r("var m=new this.ctor");for(var n=0;n<t.length;++n){var a=t[n].resolve(),c=s.safeProp(a.name);a.map?(r("if(d%s){",c)('if(typeof d%s!=="object")',c)("throw TypeError(%j)",a.fullName+": object expected")("m%s={}",c)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",c),o(r,a,n,c+"[ks[i]]")("}")("}")):a.repeated?(r("if(d%s){",c)("if(!Array.isArray(d%s))",c)("throw TypeError(%j)",a.fullName+": array expected")("m%s=[]",c)("for(var i=0;i<d%s.length;++i){",c),o(r,a,n,c+"[i]")("}")("}")):(a.resolvedType instanceof i||r("if(d%s!=null){",c),o(r,a,n,c),a.resolvedType instanceof i||r("}"))}return r("return m")},n.toObject=function(e){var t=e.fieldsArray.slice().sort(s.compareFieldsById);if(!t.length)return s.codegen()("return {}");for(var r=s.codegen(["m","o"],e.name+"$toObject")("if(!o)")("o={}")("var d={}"),n=[],o=[],c=[],u=0;u<t.length;++u)t[u].partOf||(t[u].resolve().repeated?n:t[u].map?o:c).push(t[u]);if(n.length){for(r("if(o.arrays||o.defaults){"),u=0;u<n.length;++u)r("d%s=[]",s.safeProp(n[u].name));r("}")}if(o.length){for(r("if(o.objects||o.defaults){"),u=0;u<o.length;++u)r("d%s={}",s.safeProp(o[u].name));r("}")}if(c.length){for(r("if(o.defaults){"),u=0;u<c.length;++u){var l=c[u],h=s.safeProp(l.name);if(l.resolvedType instanceof i)r("d%s=o.enums===String?%j:%j",h,l.resolvedType.valuesById[l.typeDefault],l.typeDefault);else if(l.long)r("if(util.Long){")("var n=new util.Long(%i,%i,%j)",l.typeDefault.low,l.typeDefault.high,l.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",h)("}else")("d%s=o.longs===String?%j:%i",h,l.typeDefault.toString(),l.typeDefault.toNumber());else if(l.bytes){var d="["+Array.prototype.slice.call(l.typeDefault).join(",")+"]";r("if(o.bytes===String)d%s=%j",h,String.fromCharCode.apply(String,l.typeDefault))("else{")("d%s=%s",h,d)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",h,h)("}")}else r("d%s=%j",h,l.typeDefault)}r("}")}var f=!1;for(u=0;u<t.length;++u){l=t[u];var p=e._fieldsArray.indexOf(l);h=s.safeProp(l.name);l.map?(f||(f=!0,r("var ks2")),r("if(m%s&&(ks2=Object.keys(m%s)).length){",h,h)("d%s={}",h)("for(var j=0;j<ks2.length;++j){"),a(r,l,p,h+"[ks2[j]]")("}")):l.repeated?(r("if(m%s&&m%s.length){",h,h)("d%s=[]",h)("for(var j=0;j<m%s.length;++j){",h),a(r,l,p,h+"[j]")("}")):(r("if(m%s!=null&&m.hasOwnProperty(%j)){",h,l.name),a(r,l,p,h),l.partOf&&r("if(o.oneofs)")("d%s=%j",s.safeProp(l.partOf.name),l.name)),r("}")}return r("return d")}},92715:(e,t,r)=>{"use strict";e.exports=function(e){var t=s.codegen(["r","l"],e.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(e.fieldsArray.filter((function(e){return e.map})).length?",k,value":""))("while(r.pos<c){")("var t=r.uint32()");e.group&&t("if((t&7)===4)")("break");t("switch(t>>>3){");for(var r=0;r<e.fieldsArray.length;++r){var a=e._fieldsArray[r].resolve(),c=a.resolvedType instanceof n?"int32":a.type,u="m"+s.safeProp(a.name);t("case %i:",a.id),a.map?(t("if(%s===util.emptyObject)",u)("%s={}",u)("var c2 = r.uint32()+r.pos"),void 0!==i.defaults[a.keyType]?t("k=%j",i.defaults[a.keyType]):t("k=null"),void 0!==i.defaults[c]?t("value=%j",i.defaults[c]):t("value=null"),t("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",a.keyType)("case 2:"),void 0===i.basic[c]?t("value=types[%i].decode(r,r.uint32())",r):t("value=r.%s()",c),t("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),void 0!==i.long[a.keyType]?t('%s[typeof k==="object"?util.longToHash(k):k]=value',u):t("%s[k]=value",u)):a.repeated?(t("if(!(%s&&%s.length))",u,u)("%s=[]",u),void 0!==i.packed[c]&&t("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",u,c)("}else"),void 0===i.basic[c]?t(a.resolvedType.group?"%s.push(types[%i].decode(r))":"%s.push(types[%i].decode(r,r.uint32()))",u,r):t("%s.push(r.%s())",u,c)):void 0===i.basic[c]?t(a.resolvedType.group?"%s=types[%i].decode(r)":"%s=types[%i].decode(r,r.uint32())",u,r):t("%s=r.%s()",u,c),t("break")}for(t("default:")("r.skipType(t&7)")("break")("}")("}"),r=0;r<e._fieldsArray.length;++r){var l=e._fieldsArray[r];l.required&&t("if(!m.hasOwnProperty(%j))",l.name)("throw util.ProtocolError(%j,{instance:m})",o(l))}return t("return m")};var n=r(90222),i=r(28517),s=r(52440);function o(e){return"missing required '"+e.name+"'"}},56886:(e,t,r)=>{"use strict";e.exports=function(e){for(var t,r=s.codegen(["m","w"],e.name+"$encode")("if(!w)")("w=Writer.create()"),a=e.fieldsArray.slice().sort(s.compareFieldsById),c=0;c<a.length;++c){var u=a[c].resolve(),l=e._fieldsArray.indexOf(u),h=u.resolvedType instanceof n?"int32":u.type,d=i.basic[h];t="m"+s.safeProp(u.name),u.map?(r("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",t,u.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",t)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(u.id<<3|2)>>>0,8|i.mapKey[u.keyType],u.keyType),void 0===d?r("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",l,t):r(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|d,h,t),r("}")("}")):u.repeated?(r("if(%s!=null&&%s.length){",t,t),u.packed&&void 0!==i.packed[h]?r("w.uint32(%i).fork()",(u.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",t)("w.%s(%s[i])",h,t)("w.ldelim()"):(r("for(var i=0;i<%s.length;++i)",t),void 0===d?o(r,u,l,t+"[i]"):r("w.uint32(%i).%s(%s[i])",(u.id<<3|d)>>>0,h,t)),r("}")):(u.optional&&r("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",t,u.name),void 0===d?o(r,u,l,t):r("w.uint32(%i).%s(%s)",(u.id<<3|d)>>>0,h,t))}return r("return w")};var n=r(90222),i=r(28517),s=r(52440);function o(e,t,r,n){return t.resolvedType.group?e("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",r,n,(t.id<<3|3)>>>0,(t.id<<3|4)>>>0):e("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",r,n,(t.id<<3|2)>>>0)}},90222:(e,t,r)=>{"use strict";e.exports=o;var n=r(65154);((o.prototype=Object.create(n.prototype)).constructor=o).className="Enum";var i=r(73452),s=r(52440);function o(e,t,r,i,s){if(n.call(this,e,r),t&&"object"!==typeof t)throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=i,this.comments=s||{},this.reserved=void 0,t)for(var o=Object.keys(t),a=0;a<o.length;++a)"number"===typeof t[o[a]]&&(this.valuesById[this.values[o[a]]=t[o[a]]]=o[a])}o.fromJSON=function(e,t){var r=new o(e,t.values,t.options,t.comment,t.comments);return r.reserved=t.reserved,r},o.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return s.toObject(["options",this.options,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"comment",t?this.comment:void 0,"comments",t?this.comments:void 0])},o.prototype.add=function(e,t,r){if(!s.isString(e))throw TypeError("name must be a string");if(!s.isInteger(t))throw TypeError("id must be an integer");if(void 0!==this.values[e])throw Error("duplicate name '"+e+"' in "+this);if(this.isReservedId(t))throw Error("id "+t+" is reserved in "+this);if(this.isReservedName(e))throw Error("name '"+e+"' is reserved in "+this);if(void 0!==this.valuesById[t]){if(!this.options||!this.options.allow_alias)throw Error("duplicate id "+t+" in "+this);this.values[e]=t}else this.valuesById[this.values[e]=t]=e;return this.comments[e]=r||null,this},o.prototype.remove=function(e){if(!s.isString(e))throw TypeError("name must be a string");var t=this.values[e];if(null==t)throw Error("name '"+e+"' does not exist in "+this);return delete this.valuesById[t],delete this.values[e],delete this.comments[e],this},o.prototype.isReservedId=function(e){return i.isReservedId(this.reserved,e)},o.prototype.isReservedName=function(e){return i.isReservedName(this.reserved,e)}},16734:(e,t,r)=>{"use strict";e.exports=u;var n=r(65154);((u.prototype=Object.create(n.prototype)).constructor=u).className="Field";var i,s=r(90222),o=r(28517),a=r(52440),c=/^required|optional|repeated$/;function u(e,t,r,i,s,u,l){if(a.isObject(i)?(l=s,u=i,i=s=void 0):a.isObject(s)&&(l=u,u=s,s=void 0),n.call(this,e,u),!a.isInteger(t)||t<0)throw TypeError("id must be a non-negative integer");if(!a.isString(r))throw TypeError("type must be a string");if(void 0!==i&&!c.test(i=i.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(void 0!==s&&!a.isString(s))throw TypeError("extend must be a string");"proto3_optional"===i&&(i="optional"),this.rule=i&&"optional"!==i?i:void 0,this.type=r,this.id=t,this.extend=s||void 0,this.required="required"===i,this.optional=!this.required,this.repeated="repeated"===i,this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=!!a.Long&&void 0!==o.long[r],this.bytes="bytes"===r,this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=l}u.fromJSON=function(e,t){return new u(e,t.id,t.type,t.rule,t.extend,t.options,t.comment)},Object.defineProperty(u.prototype,"packed",{get:function(){return null===this._packed&&(this._packed=!1!==this.getOption("packed")),this._packed}}),u.prototype.setOption=function(e,t,r){return"packed"===e&&(this._packed=null),n.prototype.setOption.call(this,e,t,r)},u.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return a.toObject(["rule","optional"!==this.rule&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},u.prototype.resolve=function(){if(this.resolved)return this;if(void 0===(this.typeDefault=o.defaults[this.type])&&(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof i?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]),this.options&&null!=this.options.default&&(this.typeDefault=this.options.default,this.resolvedType instanceof s&&"string"===typeof this.typeDefault&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(!0!==this.options.packed&&(void 0===this.options.packed||!this.resolvedType||this.resolvedType instanceof s)||delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long)this.typeDefault=a.Long.fromNumber(this.typeDefault,"u"===this.type.charAt(0)),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&"string"===typeof this.typeDefault){var e;a.base64.test(this.typeDefault)?a.base64.decode(this.typeDefault,e=a.newBuffer(a.base64.length(this.typeDefault)),0):a.utf8.write(this.typeDefault,e=a.newBuffer(a.utf8.length(this.typeDefault)),0),this.typeDefault=e}return this.map?this.defaultValue=a.emptyObject:this.repeated?this.defaultValue=a.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof i&&(this.parent.ctor.prototype[this.name]=this.defaultValue),n.prototype.resolve.call(this)},u.d=function(e,t,r,n){return"function"===typeof t?t=a.decorateType(t).name:t&&"object"===typeof t&&(t=a.decorateEnum(t).name),function(i,s){a.decorateType(i.constructor).add(new u(s,e,t,r,{default:n}))}},u._configure=function(e){i=e}},64582:(e,t,r)=>{"use strict";var n=e.exports=r(94722);n.build="light",n.load=function(e,t,r){return"function"===typeof t?(r=t,t=new n.Root):t||(t=new n.Root),t.load(e,r)},n.loadSync=function(e,t){return t||(t=new n.Root),t.loadSync(e)},n.encoder=r(56886),n.decoder=r(92715),n.verifier=r(90709),n.converter=r(77276),n.ReflectionObject=r(65154),n.Namespace=r(73452),n.Root=r(68622),n.Enum=r(90222),n.Type=r(58716),n.Field=r(16734),n.OneOf=r(79794),n.MapField=r(34479),n.Service=r(74173),n.Method=r(24865),n.Message=r(54486),n.wrappers=r(19025),n.types=r(28517),n.util=r(52440),n.ReflectionObject._configure(n.Root),n.Namespace._configure(n.Type,n.Service,n.Enum),n.Root._configure(n.Type),n.Field._configure(n.Type)},94722:(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(77063),n.BufferWriter=r(72815),n.Reader=r(36216),n.BufferReader=r(33557),n.util=r(3097),n.rpc=r(79994),n.roots=r(77907),n.configure=i,i()},8154:(e,t,r)=>{"use strict";var n=e.exports=r(64582);n.build="full",n.tokenize=r(43077),n.parse=r(97781),n.common=r(11427),n.Root._configure(n.Type,n.parse,n.common)},34479:(e,t,r)=>{"use strict";e.exports=o;var n=r(16734);((o.prototype=Object.create(n.prototype)).constructor=o).className="MapField";var i=r(28517),s=r(52440);function o(e,t,r,i,o,a){if(n.call(this,e,t,i,void 0,void 0,o,a),!s.isString(r))throw TypeError("keyType must be a string");this.keyType=r,this.resolvedKeyType=null,this.map=!0}o.fromJSON=function(e,t){return new o(e,t.id,t.keyType,t.type,t.options,t.comment)},o.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return s.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},o.prototype.resolve=function(){if(this.resolved)return this;if(void 0===i.mapKey[this.keyType])throw Error("invalid key type: "+this.keyType);return n.prototype.resolve.call(this)},o.d=function(e,t,r){return"function"===typeof r?r=s.decorateType(r).name:r&&"object"===typeof r&&(r=s.decorateEnum(r).name),function(n,i){s.decorateType(n.constructor).add(new o(i,e,t,r))}}},54486:(e,t,r)=>{"use strict";e.exports=i;var n=r(3097);function i(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)this[t[r]]=e[t[r]]}i.create=function(e){return this.$type.create(e)},i.encode=function(e,t){return this.$type.encode(e,t)},i.encodeDelimited=function(e,t){return this.$type.encodeDelimited(e,t)},i.decode=function(e){return this.$type.decode(e)},i.decodeDelimited=function(e){return this.$type.decodeDelimited(e)},i.verify=function(e){return this.$type.verify(e)},i.fromObject=function(e){return this.$type.fromObject(e)},i.toObject=function(e,t){return this.$type.toObject(e,t)},i.prototype.toJSON=function(){return this.$type.toObject(this,n.toJSONOptions)}},24865:(e,t,r)=>{"use strict";e.exports=s;var n=r(65154);((s.prototype=Object.create(n.prototype)).constructor=s).className="Method";var i=r(52440);function s(e,t,r,s,o,a,c,u,l){if(i.isObject(o)?(c=o,o=a=void 0):i.isObject(a)&&(c=a,a=void 0),void 0!==t&&!i.isString(t))throw TypeError("type must be a string");if(!i.isString(r))throw TypeError("requestType must be a string");if(!i.isString(s))throw TypeError("responseType must be a string");n.call(this,e,c),this.type=t||"rpc",this.requestType=r,this.requestStream=!!o||void 0,this.responseType=s,this.responseStream=!!a||void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=u,this.parsedOptions=l}s.fromJSON=function(e,t){return new s(e,t.type,t.requestType,t.responseType,t.requestStream,t.responseStream,t.options,t.comment,t.parsedOptions)},s.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return i.toObject(["type","rpc"!==this.type&&this.type||void 0,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",t?this.comment:void 0,"parsedOptions",this.parsedOptions])},s.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),n.prototype.resolve.call(this))}},73452:(e,t,r)=>{"use strict";e.exports=h;var n=r(65154);((h.prototype=Object.create(n.prototype)).constructor=h).className="Namespace";var i,s,o,a=r(16734),c=r(79794),u=r(52440);function l(e,t){if(e&&e.length){for(var r={},n=0;n<e.length;++n)r[e[n].name]=e[n].toJSON(t);return r}}function h(e,t){n.call(this,e,t),this.nested=void 0,this._nestedArray=null}function d(e){return e._nestedArray=null,e}h.fromJSON=function(e,t){return new h(e,t.options).addJSON(t.nested)},h.arrayToJSON=l,h.isReservedId=function(e,t){if(e)for(var r=0;r<e.length;++r)if("string"!==typeof e[r]&&e[r][0]<=t&&e[r][1]>t)return!0;return!1},h.isReservedName=function(e,t){if(e)for(var r=0;r<e.length;++r)if(e[r]===t)return!0;return!1},Object.defineProperty(h.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=u.toArray(this.nested))}}),h.prototype.toJSON=function(e){return u.toObject(["options",this.options,"nested",l(this.nestedArray,e)])},h.prototype.addJSON=function(e){if(e)for(var t,r=Object.keys(e),n=0;n<r.length;++n)t=e[r[n]],this.add((void 0!==t.fields?i.fromJSON:void 0!==t.values?o.fromJSON:void 0!==t.methods?s.fromJSON:void 0!==t.id?a.fromJSON:h.fromJSON)(r[n],t));return this},h.prototype.get=function(e){return this.nested&&this.nested[e]||null},h.prototype.getEnum=function(e){if(this.nested&&this.nested[e]instanceof o)return this.nested[e].values;throw Error("no such enum: "+e)},h.prototype.add=function(e){if(!(e instanceof a&&void 0!==e.extend||e instanceof i||e instanceof o||e instanceof s||e instanceof h||e instanceof c))throw TypeError("object must be a valid nested object");if(this.nested){var t=this.get(e.name);if(t){if(!(t instanceof h&&e instanceof h)||t instanceof i||t instanceof s)throw Error("duplicate name '"+e.name+"' in "+this);for(var r=t.nestedArray,n=0;n<r.length;++n)e.add(r[n]);this.remove(t),this.nested||(this.nested={}),e.setOptions(t.options,!0)}}else this.nested={};return this.nested[e.name]=e,e.onAdd(this),d(this)},h.prototype.remove=function(e){if(!(e instanceof n))throw TypeError("object must be a ReflectionObject");if(e.parent!==this)throw Error(e+" is not a member of "+this);return delete this.nested[e.name],Object.keys(this.nested).length||(this.nested=void 0),e.onRemove(this),d(this)},h.prototype.define=function(e,t){if(u.isString(e))e=e.split(".");else if(!Array.isArray(e))throw TypeError("illegal path");if(e&&e.length&&""===e[0])throw Error("path must be relative");for(var r=this;e.length>0;){var n=e.shift();if(r.nested&&r.nested[n]){if(!((r=r.nested[n])instanceof h))throw Error("path conflicts with non-namespace objects")}else r.add(r=new h(n))}return t&&r.addJSON(t),r},h.prototype.resolveAll=function(){for(var e=this.nestedArray,t=0;t<e.length;)e[t]instanceof h?e[t++].resolveAll():e[t++].resolve();return this.resolve()},h.prototype.lookup=function(e,t,r){if("boolean"===typeof t?(r=t,t=void 0):t&&!Array.isArray(t)&&(t=[t]),u.isString(e)&&e.length){if("."===e)return this.root;e=e.split(".")}else if(!e.length)return this;if(""===e[0])return this.root.lookup(e.slice(1),t);var n=this.get(e[0]);if(n){if(1===e.length){if(!t||t.indexOf(n.constructor)>-1)return n}else if(n instanceof h&&(n=n.lookup(e.slice(1),t,!0)))return n}else for(var i=0;i<this.nestedArray.length;++i)if(this._nestedArray[i]instanceof h&&(n=this._nestedArray[i].lookup(e,t,!0)))return n;return null===this.parent||r?null:this.parent.lookup(e,t)},h.prototype.lookupType=function(e){var t=this.lookup(e,[i]);if(!t)throw Error("no such type: "+e);return t},h.prototype.lookupEnum=function(e){var t=this.lookup(e,[o]);if(!t)throw Error("no such Enum '"+e+"' in "+this);return t},h.prototype.lookupTypeOrEnum=function(e){var t=this.lookup(e,[i,o]);if(!t)throw Error("no such Type or Enum '"+e+"' in "+this);return t},h.prototype.lookupService=function(e){var t=this.lookup(e,[s]);if(!t)throw Error("no such Service '"+e+"' in "+this);return t},h._configure=function(e,t,r){i=e,s=t,o=r}},65154:(e,t,r)=>{"use strict";e.exports=s,s.className="ReflectionObject";var n,i=r(52440);function s(e,t){if(!i.isString(e))throw TypeError("name must be a string");if(t&&!i.isObject(t))throw TypeError("options must be an object");this.options=t,this.parsedOptions=null,this.name=e,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(s.prototype,{root:{get:function(){for(var e=this;null!==e.parent;)e=e.parent;return e}},fullName:{get:function(){for(var e=[this.name],t=this.parent;t;)e.unshift(t.name),t=t.parent;return e.join(".")}}}),s.prototype.toJSON=function(){throw Error()},s.prototype.onAdd=function(e){this.parent&&this.parent!==e&&this.parent.remove(this),this.parent=e,this.resolved=!1;var t=e.root;t instanceof n&&t._handleAdd(this)},s.prototype.onRemove=function(e){var t=e.root;t instanceof n&&t._handleRemove(this),this.parent=null,this.resolved=!1},s.prototype.resolve=function(){return this.resolved||this.root instanceof n&&(this.resolved=!0),this},s.prototype.getOption=function(e){if(this.options)return this.options[e]},s.prototype.setOption=function(e,t,r){return r&&this.options&&void 0!==this.options[e]||((this.options||(this.options={}))[e]=t),this},s.prototype.setParsedOption=function(e,t,r){this.parsedOptions||(this.parsedOptions=[]);var n=this.parsedOptions;if(r){var s=n.find((function(t){return Object.prototype.hasOwnProperty.call(t,e)}));if(s){var o=s[e];i.setProperty(o,r,t)}else(s={})[e]=i.setProperty({},r,t),n.push(s)}else{var a={};a[e]=t,n.push(a)}return this},s.prototype.setOptions=function(e,t){if(e)for(var r=Object.keys(e),n=0;n<r.length;++n)this.setOption(r[n],e[r[n]],t);return this},s.prototype.toString=function(){var e=this.constructor.className,t=this.fullName;return t.length?e+" "+t:e},s._configure=function(e){n=e}},79794:(e,t,r)=>{"use strict";e.exports=o;var n=r(65154);((o.prototype=Object.create(n.prototype)).constructor=o).className="OneOf";var i=r(16734),s=r(52440);function o(e,t,r,i){if(Array.isArray(t)||(r=t,t=void 0),n.call(this,e,r),void 0!==t&&!Array.isArray(t))throw TypeError("fieldNames must be an Array");this.oneof=t||[],this.fieldsArray=[],this.comment=i}function a(e){if(e.parent)for(var t=0;t<e.fieldsArray.length;++t)e.fieldsArray[t].parent||e.parent.add(e.fieldsArray[t])}o.fromJSON=function(e,t){return new o(e,t.oneof,t.options,t.comment)},o.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return s.toObject(["options",this.options,"oneof",this.oneof,"comment",t?this.comment:void 0])},o.prototype.add=function(e){if(!(e instanceof i))throw TypeError("field must be a Field");return e.parent&&e.parent!==this.parent&&e.parent.remove(e),this.oneof.push(e.name),this.fieldsArray.push(e),e.partOf=this,a(this),this},o.prototype.remove=function(e){if(!(e instanceof i))throw TypeError("field must be a Field");var t=this.fieldsArray.indexOf(e);if(t<0)throw Error(e+" is not a member of "+this);return this.fieldsArray.splice(t,1),(t=this.oneof.indexOf(e.name))>-1&&this.oneof.splice(t,1),e.partOf=null,this},o.prototype.onAdd=function(e){n.prototype.onAdd.call(this,e);for(var t=0;t<this.oneof.length;++t){var r=e.get(this.oneof[t]);r&&!r.partOf&&(r.partOf=this,this.fieldsArray.push(r))}a(this)},o.prototype.onRemove=function(e){for(var t,r=0;r<this.fieldsArray.length;++r)(t=this.fieldsArray[r]).parent&&t.parent.remove(t);n.prototype.onRemove.call(this,e)},o.d=function(){for(var e=new Array(arguments.length),t=0;t<arguments.length;)e[t]=arguments[t++];return function(t,r){s.decorateType(t.constructor).add(new o(r,e)),Object.defineProperty(t,r,{get:s.oneOfGetter(e),set:s.oneOfSetter(e)})}}},97781:(e,t,r)=>{"use strict";e.exports=I,I.filename=null,I.defaults={keepCase:!1};var n=r(43077),i=r(68622),s=r(58716),o=r(16734),a=r(34479),c=r(79794),u=r(90222),l=r(74173),h=r(24865),d=r(28517),f=r(52440),p=/^[1-9][0-9]*$/,y=/^-?[1-9][0-9]*$/,g=/^0[x][0-9a-fA-F]+$/,m=/^-?0[x][0-9a-fA-F]+$/,v=/^0[0-7]+$/,b=/^-?0[0-7]+$/,w=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,E=/^[a-zA-Z_][a-zA-Z_0-9]*$/,S=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,_=/^(?:\.[a-zA-Z_][a-zA-Z_0-9]*)+$/;function I(e,t,r){t instanceof i||(r=t,t=new i),r||(r=I.defaults);var T,A,C,R,P,k=r.preferTrailingComment||!1,O=n(e,r.alternateCommentMode||!1),B=O.next,N=O.push,D=O.peek,L=O.skip,x=O.cmnt,M=!0,U=!1,K=t,j=r.keepCase?function(e){return e}:f.camelCase;function F(e,t,r){var n=I.filename;return r||(I.filename=null),Error("illegal "+(t||"token")+" '"+e+"' ("+(n?n+", ":"")+"line "+O.line+")")}function V(){var e,t=[];do{if('"'!==(e=B())&&"'"!==e)throw F(e);t.push(B()),L(e),e=D()}while('"'===e||"'"===e);return t.join("")}function q(e){var t=B();switch(t){case"'":case'"':return N(t),V();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return function(e,t){var r=1;"-"===e.charAt(0)&&(r=-1,e=e.substring(1));switch(e){case"inf":case"INF":case"Inf":return r*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(p.test(e))return r*parseInt(e,10);if(g.test(e))return r*parseInt(e,16);if(v.test(e))return r*parseInt(e,8);if(w.test(e))return r*parseFloat(e);throw F(e,"number",t)}(t,!0)}catch(r){if(e&&S.test(t))return t;throw F(t,"value")}}function z(e,t){var r,n;do{!t||'"'!==(r=D())&&"'"!==r?e.push([n=H(B()),L("to",!0)?H(B()):n]):e.push(V())}while(L(",",!0));L(";")}function H(e,t){switch(e){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!t&&"-"===e.charAt(0))throw F(e,"id");if(y.test(e))return parseInt(e,10);if(m.test(e))return parseInt(e,16);if(b.test(e))return parseInt(e,8);throw F(e,"id")}function G(){if(void 0!==T)throw F("package");if(T=B(),!S.test(T))throw F(T,"name");K=K.define(T),L(";")}function W(){var e,t=D();switch(t){case"weak":e=C||(C=[]),B();break;case"public":B();default:e=A||(A=[])}t=V(),L(";"),e.push(t)}function Y(){if(L("="),R=V(),!(U="proto3"===R)&&"proto2"!==R)throw F(R,"syntax");L(";")}function Q(e,t){switch(t){case"option":return $(e,t),L(";"),!0;case"message":return function(e,t){if(!E.test(t=B()))throw F(t,"type name");var r=new s(t);J(r,(function(e){if(!Q(r,e))switch(e){case"map":!function(e){L("<");var t=B();if(void 0===d.mapKey[t])throw F(t,"type");L(",");var r=B();if(!S.test(r))throw F(r,"type");L(">");var n=B();if(!E.test(n))throw F(n,"name");L("=");var i=new a(j(n),H(B()),t,r);J(i,(function(e){if("option"!==e)throw F(e);$(i,e),L(";")}),(function(){te(i)})),e.add(i)}(r);break;case"required":case"repeated":X(r,e);break;case"optional":X(r,U?"proto3_optional":"optional");break;case"oneof":!function(e,t){if(!E.test(t=B()))throw F(t,"name");var r=new c(j(t));J(r,(function(e){"option"===e?($(r,e),L(";")):(N(e),X(r,"optional"))})),e.add(r)}(r,e);break;case"extensions":z(r.extensions||(r.extensions=[]));break;case"reserved":z(r.reserved||(r.reserved=[]),!0);break;default:if(!U||!S.test(e))throw F(e);N(e),X(r,"optional")}})),e.add(r)}(e,t),!0;case"enum":return function(e,t){if(!E.test(t=B()))throw F(t,"name");var r=new u(t);J(r,(function(e){switch(e){case"option":$(r,e),L(";");break;case"reserved":z(r.reserved||(r.reserved=[]),!0);break;default:!function(e,t){if(!E.test(t))throw F(t,"name");L("=");var r=H(B(),!0),n={};J(n,(function(e){if("option"!==e)throw F(e);$(n,e),L(";")}),(function(){te(n)})),e.add(t,r,n.comment)}(r,e)}})),e.add(r)}(e,t),!0;case"service":return function(e,t){if(!E.test(t=B()))throw F(t,"service name");var r=new l(t);J(r,(function(e){if(!Q(r,e)){if("rpc"!==e)throw F(e);!function(e,t){var r=x(),n=t;if(!E.test(t=B()))throw F(t,"name");var i,s,o,a,c=t;L("("),L("stream",!0)&&(s=!0);if(!S.test(t=B()))throw F(t);i=t,L(")"),L("returns"),L("("),L("stream",!0)&&(a=!0);if(!S.test(t=B()))throw F(t);o=t,L(")");var u=new h(c,n,i,o,s,a);u.comment=r,J(u,(function(e){if("option"!==e)throw F(e);$(u,e),L(";")})),e.add(u)}(r,e)}})),e.add(r)}(e,t),!0;case"extend":return function(e,t){if(!S.test(t=B()))throw F(t,"reference");var r=t;J(null,(function(t){switch(t){case"required":case"repeated":X(e,t,r);break;case"optional":X(e,U?"proto3_optional":"optional",r);break;default:if(!U||!S.test(t))throw F(t);N(t),X(e,"optional",r)}}))}(e,t),!0}return!1}function J(e,t,r){var n=O.line;if(e&&("string"!==typeof e.comment&&(e.comment=x()),e.filename=I.filename),L("{",!0)){for(var i;"}"!==(i=B());)t(i);L(";",!0)}else r&&r(),L(";"),e&&("string"!==typeof e.comment||k)&&(e.comment=x(n)||e.comment)}function X(e,t,r){var n=B();if("group"!==n){if(!S.test(n))throw F(n,"type");var i=B();if(!E.test(i))throw F(i,"name");i=j(i),L("=");var a=new o(i,H(B()),n,t,r);if(J(a,(function(e){if("option"!==e)throw F(e);$(a,e),L(";")}),(function(){te(a)})),"proto3_optional"===t){var u=new c("_"+i);a.setOption("proto3_optional",!0),u.add(a),e.add(u)}else e.add(a);U||!a.repeated||void 0===d.packed[n]&&void 0!==d.basic[n]||a.setOption("packed",!1,!0)}else!function(e,t){var r=B();if(!E.test(r))throw F(r,"name");var n=f.lcFirst(r);r===n&&(r=f.ucFirst(r));L("=");var i=H(B()),a=new s(r);a.group=!0;var c=new o(n,i,r,t);c.filename=I.filename,J(a,(function(e){switch(e){case"option":$(a,e),L(";");break;case"required":case"repeated":X(a,e);break;case"optional":X(a,U?"proto3_optional":"optional");break;default:throw F(e)}})),e.add(a).add(c)}(e,t)}function $(e,t){var r=L("(",!0);if(!S.test(t=B()))throw F(t,"name");var n,i=t,s=i;r&&(L(")"),s=i="("+i+")",t=D(),_.test(t)&&(n=t.substr(1),i+=t,B())),L("="),function(e,t,r,n){e.setParsedOption&&e.setParsedOption(t,r,n)}(e,s,Z(e,i),n)}function Z(e,t){if(L("{",!0)){for(var r={};!L("}",!0);){if(!E.test(P=B()))throw F(P,"name");var n,i=P;"{"===D()?n=Z(e,t+"."+P):(L(":"),"{"===D()?n=Z(e,t+"."+P):(n=q(!0),ee(e,t+"."+P,n)));var s=r[i];s&&(n=[].concat(s).concat(n)),r[i]=n,L(",",!0)}return r}var o=q(!0);return ee(e,t,o),o}function ee(e,t,r){e.setOption&&e.setOption(t,r)}function te(e){if(L("[",!0)){do{$(e,"option")}while(L(",",!0));L("]")}return e}for(;null!==(P=B());)switch(P){case"package":if(!M)throw F(P);G();break;case"import":if(!M)throw F(P);W();break;case"syntax":if(!M)throw F(P);Y();break;case"option":$(K,P),L(";");break;default:if(Q(K,P)){M=!1;continue}throw F(P)}return I.filename=null,{package:T,imports:A,weakImports:C,syntax:R,root:t}}},36216:(e,t,r)=>{"use strict";e.exports=c;var n,i=r(3097),s=i.LongBits,o=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="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):u(e)})(e)}:u};function h(){var e=new s(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 f(){if(this.pos+8>this.len)throw a(this,8);return new s(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=function(){var e=4294967295;return function(){if(e=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return e;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return e}}(),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 o.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 f.call(this)[t](!0)},sfixed64:function(){return f.call(this)[t](!1)}})}},33557:(e,t,r)=>{"use strict";e.exports=s;var n=r(36216);(s.prototype=Object.create(n.prototype)).constructor=s;var i=r(3097);function s(e){n.call(this,e)}s._configure=function(){i.Buffer&&(s.prototype._slice=i.Buffer.prototype.slice)},s.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))},s._configure()},68622:(e,t,r)=>{"use strict";e.exports=h;var n=r(73452);((h.prototype=Object.create(n.prototype)).constructor=h).className="Root";var i,s,o,a=r(16734),c=r(90222),u=r(79794),l=r(52440);function h(e){n.call(this,"",e),this.deferred=[],this.files=[]}function d(){}h.fromJSON=function(e,t){return t||(t=new h),e.options&&t.setOptions(e.options),t.addJSON(e.nested)},h.prototype.resolvePath=l.path.resolve,h.prototype.fetch=l.fetch,h.prototype.load=function e(t,r,n){"function"===typeof r&&(n=r,r=void 0);var i=this;if(!n)return l.asPromise(e,i,t,r);var a=n===d;function c(e,t){if(n){var r=n;if(n=null,a)throw e;r(e,t)}}function u(e){var t=e.lastIndexOf("google/protobuf/");if(t>-1){var r=e.substring(t);if(r in o)return r}return null}function h(e,t){try{if(l.isString(t)&&"{"===t.charAt(0)&&(t=JSON.parse(t)),l.isString(t)){s.filename=e;var n,o=s(t,i,r),h=0;if(o.imports)for(;h<o.imports.length;++h)(n=u(o.imports[h])||i.resolvePath(e,o.imports[h]))&&f(n);if(o.weakImports)for(h=0;h<o.weakImports.length;++h)(n=u(o.weakImports[h])||i.resolvePath(e,o.weakImports[h]))&&f(n,!0)}else i.setOptions(t.options).addJSON(t.nested)}catch(d){c(d)}a||p||c(null,i)}function f(e,t){if(!(i.files.indexOf(e)>-1))if(i.files.push(e),e in o)a?h(e,o[e]):(++p,setTimeout((function(){--p,h(e,o[e])})));else if(a){var r;try{r=l.fs.readFileSync(e).toString("utf8")}catch(s){return void(t||c(s))}h(e,r)}else++p,i.fetch(e,(function(r,s){--p,n&&(r?t?p||c(null,i):c(r):h(e,s))}))}var p=0;l.isString(t)&&(t=[t]);for(var y,g=0;g<t.length;++g)(y=i.resolvePath("",t[g]))&&f(y);if(a)return i;p||c(null,i)},h.prototype.loadSync=function(e,t){if(!l.isNode)throw Error("not supported");return this.load(e,t,d)},h.prototype.resolveAll=function(){if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map((function(e){return"'extend "+e.extend+"' in "+e.parent.fullName})).join(", "));return n.prototype.resolveAll.call(this)};var f=/^[A-Z]/;function p(e,t){var r=t.parent.lookup(t.extend);if(r){var n=new a(t.fullName,t.id,t.type,t.rule,void 0,t.options);return n.declaringField=t,t.extensionField=n,r.add(n),!0}return!1}h.prototype._handleAdd=function(e){if(e instanceof a)void 0===e.extend||e.extensionField||p(0,e)||this.deferred.push(e);else if(e instanceof c)f.test(e.name)&&(e.parent[e.name]=e.values);else if(!(e instanceof u)){if(e instanceof i)for(var t=0;t<this.deferred.length;)p(0,this.deferred[t])?this.deferred.splice(t,1):++t;for(var r=0;r<e.nestedArray.length;++r)this._handleAdd(e._nestedArray[r]);f.test(e.name)&&(e.parent[e.name]=e)}},h.prototype._handleRemove=function(e){if(e instanceof a){if(void 0!==e.extend)if(e.extensionField)e.extensionField.parent.remove(e.extensionField),e.extensionField=null;else{var t=this.deferred.indexOf(e);t>-1&&this.deferred.splice(t,1)}}else if(e instanceof c)f.test(e.name)&&delete e.parent[e.name];else if(e instanceof n){for(var r=0;r<e.nestedArray.length;++r)this._handleRemove(e._nestedArray[r]);f.test(e.name)&&delete e.parent[e.name]}},h._configure=function(e,t,r){i=e,s=t,o=r}},77907:e=>{"use strict";e.exports={}},79994:(e,t,r)=>{"use strict";t.Service=r(64281)},64281:(e,t,r)=>{"use strict";e.exports=i;var n=r(3097);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,s,o){if(!s)throw TypeError("request must be specified");var a=this;if(!o)return n.asPromise(e,a,t,r,i,s);if(a.rpcImpl)try{return a.rpcImpl(t,r[a.requestDelimited?"encodeDelimited":"encode"](s).finish(),(function(e,r){if(e)return a.emit("error",e,t),o(e);if(null!==r){if(!(r instanceof i))try{r=i[a.responseDelimited?"decodeDelimited":"decode"](r)}catch(e){return a.emit("error",e,t),o(e)}return a.emit("data",r,t),o(null,r)}a.end(!0)}))}catch(c){return a.emit("error",c,t),void setTimeout((function(){o(c)}),0)}else setTimeout((function(){o(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}},74173:(e,t,r)=>{"use strict";e.exports=a;var n=r(73452);((a.prototype=Object.create(n.prototype)).constructor=a).className="Service";var i=r(24865),s=r(52440),o=r(79994);function a(e,t){n.call(this,e,t),this.methods={},this._methodsArray=null}function c(e){return e._methodsArray=null,e}a.fromJSON=function(e,t){var r=new a(e,t.options);if(t.methods)for(var n=Object.keys(t.methods),s=0;s<n.length;++s)r.add(i.fromJSON(n[s],t.methods[n[s]]));return t.nested&&r.addJSON(t.nested),r.comment=t.comment,r},a.prototype.toJSON=function(e){var t=n.prototype.toJSON.call(this,e),r=!!e&&Boolean(e.keepComments);return s.toObject(["options",t&&t.options||void 0,"methods",n.arrayToJSON(this.methodsArray,e)||{},"nested",t&&t.nested||void 0,"comment",r?this.comment:void 0])},Object.defineProperty(a.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=s.toArray(this.methods))}}),a.prototype.get=function(e){return this.methods[e]||n.prototype.get.call(this,e)},a.prototype.resolveAll=function(){for(var e=this.methodsArray,t=0;t<e.length;++t)e[t].resolve();return n.prototype.resolve.call(this)},a.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);return e instanceof i?(this.methods[e.name]=e,e.parent=this,c(this)):n.prototype.add.call(this,e)},a.prototype.remove=function(e){if(e instanceof i){if(this.methods[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.methods[e.name],e.parent=null,c(this)}return n.prototype.remove.call(this,e)},a.prototype.create=function(e,t,r){for(var n,i=new o.Service(e,t,r),a=0;a<this.methodsArray.length;++a){var c=s.lcFirst((n=this._methodsArray[a]).resolve().name).replace(/[^$\w_]/g,"");i[c]=s.codegen(["r","c"],s.isReserved(c)?c+"_":c)("return this.rpcCall(m,q,s,r,c)")({m:n,q:n.resolvedRequestType.ctor,s:n.resolvedResponseType.ctor})}return i}},43077:e=>{"use strict";e.exports=h;var t=/[\s{}=;:[\],'"()<>]/g,r=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,n=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,i=/^ *[*/]+ */,s=/^\s*\*?\/*/,o=/\n/g,a=/\s/,c=/\\(.?)/g,u={0:"\0",r:"\r",n:"\n",t:"\t"};function l(e){return e.replace(c,(function(e,t){switch(t){case"\\":case"":return t;default:return u[t]||""}}))}function h(e,c){e=e.toString();var u=0,h=e.length,d=1,f=null,p=null,y=0,g=!1,m=!1,v=[],b=null;function w(e){return Error("illegal "+e+" (line "+d+")")}function E(t){return e.charAt(t)}function S(t,r,n){f=e.charAt(t++),y=d,g=!1,m=n;var a,u=t-(c?2:3);do{if(--u<0||"\n"===(a=e.charAt(u))){g=!0;break}}while(" "===a||"\t"===a);for(var l=e.substring(t,r).split(o),h=0;h<l.length;++h)l[h]=l[h].replace(c?s:i,"").trim();p=l.join("\n").trim()}function _(t){var r=I(t),n=e.substring(t,r);return/^\s*\/{1,2}/.test(n)}function I(e){for(var t=e;t<h&&"\n"!==E(t);)t++;return t}function T(){if(v.length>0)return v.shift();if(b)return function(){var t="'"===b?n:r;t.lastIndex=u-1;var i=t.exec(e);if(!i)throw w("string");return u=t.lastIndex,A(b),b=null,l(i[1])}();var i,s,o,f,p,y=0===u;do{if(u===h)return null;for(i=!1;a.test(o=E(u));)if("\n"===o&&(y=!0,++d),++u===h)return null;if("/"===E(u)){if(++u===h)throw w("comment");if("/"===E(u))if(c){if(f=u,p=!1,_(u)){p=!0;do{if((u=I(u))===h)break;u++}while(_(u))}else u=Math.min(h,I(u)+1);p&&S(f,u,y),d++,i=!0}else{for(p="/"===E(f=u+1);"\n"!==E(++u);)if(u===h)return null;++u,p&&S(f,u-1,y),++d,i=!0}else{if("*"!==(o=E(u)))return"/";f=u+1,p=c||"*"===E(f);do{if("\n"===o&&++d,++u===h)throw w("comment");s=o,o=E(u)}while("*"!==s||"/"!==o);++u,p&&S(f,u-2,y),i=!0}}}while(i);var g=u;if(t.lastIndex=0,!t.test(E(g++)))for(;g<h&&!t.test(E(g));)++g;var m=e.substring(u,u=g);return'"'!==m&&"'"!==m||(b=m),m}function A(e){v.push(e)}function C(){if(!v.length){var e=T();if(null===e)return null;A(e)}return v[0]}return Object.defineProperty({next:T,peek:C,push:A,skip:function(e,t){var r=C();if(r===e)return T(),!0;if(!t)throw w("token '"+r+"', '"+e+"' expected");return!1},cmnt:function(e){var t=null;return void 0===e?y===d-1&&(c||"*"===f||g)&&(t=m?p:null):(y<e&&C(),y!==e||g||!c&&"/"!==f||(t=m?null:p)),t}},"line",{get:function(){return d}})}h.unescape=l},58716:(e,t,r)=>{"use strict";e.exports=v;var n=r(73452);((v.prototype=Object.create(n.prototype)).constructor=v).className="Type";var i=r(90222),s=r(79794),o=r(16734),a=r(34479),c=r(74173),u=r(54486),l=r(36216),h=r(77063),d=r(52440),f=r(56886),p=r(92715),y=r(90709),g=r(77276),m=r(19025);function v(e,t){n.call(this,e,t),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}function b(e){return e._fieldsById=e._fieldsArray=e._oneofsArray=null,delete e.encode,delete e.decode,delete e.verify,e}Object.defineProperties(v.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var e=Object.keys(this.fields),t=0;t<e.length;++t){var r=this.fields[e[t]],n=r.id;if(this._fieldsById[n])throw Error("duplicate id "+n+" in "+this);this._fieldsById[n]=r}return this._fieldsById}},fieldsArray:{get:function(){return this._fieldsArray||(this._fieldsArray=d.toArray(this.fields))}},oneofsArray:{get:function(){return this._oneofsArray||(this._oneofsArray=d.toArray(this.oneofs))}},ctor:{get:function(){return this._ctor||(this.ctor=v.generateConstructor(this)())},set:function(e){var t=e.prototype;t instanceof u||((e.prototype=new u).constructor=e,d.merge(e.prototype,t)),e.$type=e.prototype.$type=this,d.merge(e,u,!0),this._ctor=e;for(var r=0;r<this.fieldsArray.length;++r)this._fieldsArray[r].resolve();var n={};for(r=0;r<this.oneofsArray.length;++r)n[this._oneofsArray[r].resolve().name]={get:d.oneOfGetter(this._oneofsArray[r].oneof),set:d.oneOfSetter(this._oneofsArray[r].oneof)};r&&Object.defineProperties(e.prototype,n)}}}),v.generateConstructor=function(e){for(var t,r=d.codegen(["p"],e.name),n=0;n<e.fieldsArray.length;++n)(t=e._fieldsArray[n]).map?r("this%s={}",d.safeProp(t.name)):t.repeated&&r("this%s=[]",d.safeProp(t.name));return r("if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)")("this[ks[i]]=p[ks[i]]")},v.fromJSON=function(e,t){var r=new v(e,t.options);r.extensions=t.extensions,r.reserved=t.reserved;for(var u=Object.keys(t.fields),l=0;l<u.length;++l)r.add(("undefined"!==typeof t.fields[u[l]].keyType?a.fromJSON:o.fromJSON)(u[l],t.fields[u[l]]));if(t.oneofs)for(u=Object.keys(t.oneofs),l=0;l<u.length;++l)r.add(s.fromJSON(u[l],t.oneofs[u[l]]));if(t.nested)for(u=Object.keys(t.nested),l=0;l<u.length;++l){var h=t.nested[u[l]];r.add((void 0!==h.id?o.fromJSON:void 0!==h.fields?v.fromJSON:void 0!==h.values?i.fromJSON:void 0!==h.methods?c.fromJSON:n.fromJSON)(u[l],h))}return t.extensions&&t.extensions.length&&(r.extensions=t.extensions),t.reserved&&t.reserved.length&&(r.reserved=t.reserved),t.group&&(r.group=!0),t.comment&&(r.comment=t.comment),r},v.prototype.toJSON=function(e){var t=n.prototype.toJSON.call(this,e),r=!!e&&Boolean(e.keepComments);return d.toObject(["options",t&&t.options||void 0,"oneofs",n.arrayToJSON(this.oneofsArray,e),"fields",n.arrayToJSON(this.fieldsArray.filter((function(e){return!e.declaringField})),e)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:void 0,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"group",this.group||void 0,"nested",t&&t.nested||void 0,"comment",r?this.comment:void 0])},v.prototype.resolveAll=function(){for(var e=this.fieldsArray,t=0;t<e.length;)e[t++].resolve();var r=this.oneofsArray;for(t=0;t<r.length;)r[t++].resolve();return n.prototype.resolveAll.call(this)},v.prototype.get=function(e){return this.fields[e]||this.oneofs&&this.oneofs[e]||this.nested&&this.nested[e]||null},v.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);if(e instanceof o&&void 0===e.extend){if(this._fieldsById?this._fieldsById[e.id]:this.fieldsById[e.id])throw Error("duplicate id "+e.id+" in "+this);if(this.isReservedId(e.id))throw Error("id "+e.id+" is reserved in "+this);if(this.isReservedName(e.name))throw Error("name '"+e.name+"' is reserved in "+this);return e.parent&&e.parent.remove(e),this.fields[e.name]=e,e.message=this,e.onAdd(this),b(this)}return e instanceof s?(this.oneofs||(this.oneofs={}),this.oneofs[e.name]=e,e.onAdd(this),b(this)):n.prototype.add.call(this,e)},v.prototype.remove=function(e){if(e instanceof o&&void 0===e.extend){if(!this.fields||this.fields[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.fields[e.name],e.parent=null,e.onRemove(this),b(this)}if(e instanceof s){if(!this.oneofs||this.oneofs[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.oneofs[e.name],e.parent=null,e.onRemove(this),b(this)}return n.prototype.remove.call(this,e)},v.prototype.isReservedId=function(e){return n.isReservedId(this.reserved,e)},v.prototype.isReservedName=function(e){return n.isReservedName(this.reserved,e)},v.prototype.create=function(e){return new this.ctor(e)},v.prototype.setup=function(){for(var e=this.fullName,t=[],r=0;r<this.fieldsArray.length;++r)t.push(this._fieldsArray[r].resolve().resolvedType);this.encode=f(this)({Writer:h,types:t,util:d}),this.decode=p(this)({Reader:l,types:t,util:d}),this.verify=y(this)({types:t,util:d}),this.fromObject=g.fromObject(this)({types:t,util:d}),this.toObject=g.toObject(this)({types:t,util:d});var n=m[e];if(n){var i=Object.create(this);i.fromObject=this.fromObject,this.fromObject=n.fromObject.bind(i),i.toObject=this.toObject,this.toObject=n.toObject.bind(i)}return this},v.prototype.encode=function(e,t){return this.setup().encode(e,t)},v.prototype.encodeDelimited=function(e,t){return this.encode(e,t&&t.len?t.fork():t).ldelim()},v.prototype.decode=function(e,t){return this.setup().decode(e,t)},v.prototype.decodeDelimited=function(e){return e instanceof l||(e=l.create(e)),this.decode(e,e.uint32())},v.prototype.verify=function(e){return this.setup().verify(e)},v.prototype.fromObject=function(e){return this.setup().fromObject(e)},v.prototype.toObject=function(e,t){return this.setup().toObject(e,t)},v.d=function(e){return function(t){d.decorateType(t,e)}}},28517:(e,t,r)=>{"use strict";var n=t,i=r(52440),s=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function o(e,t){var r=0,n={};for(t|=0;r<e.length;)n[s[r+t]]=e[r++];return n}n.basic=o([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),n.defaults=o([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",i.emptyArray,null]),n.long=o([0,0,0,1,1],7),n.mapKey=o([0,0,0,5,5,0,0,0,1,1,0,2],2),n.packed=o([1,5,0,0,0,5,5,0,0,0,1,1,0])},52440:(e,t,r)=>{"use strict";var n,i,s=e.exports=r(3097),o=r(77907);s.codegen=r(33297),s.fetch=r(37635),s.path=r(77468),s.fs=s.inquire("fs"),s.toArray=function(e){if(e){for(var t=Object.keys(e),r=new Array(t.length),n=0;n<t.length;)r[n]=e[t[n++]];return r}return[]},s.toObject=function(e){for(var t={},r=0;r<e.length;){var n=e[r++],i=e[r++];void 0!==i&&(t[n]=i)}return t};var a=/\\/g,c=/"/g;s.isReserved=function(e){return/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(e)},s.safeProp=function(e){return!/^[$\w_]+$/.test(e)||s.isReserved(e)?'["'+e.replace(a,"\\\\").replace(c,'\\"')+'"]':"."+e},s.ucFirst=function(e){return e.charAt(0).toUpperCase()+e.substring(1)};var u=/_([a-z])/g;s.camelCase=function(e){return e.substring(0,1)+e.substring(1).replace(u,(function(e,t){return t.toUpperCase()}))},s.compareFieldsById=function(e,t){return e.id-t.id},s.decorateType=function(e,t){if(e.$type)return t&&e.$type.name!==t&&(s.decorateRoot.remove(e.$type),e.$type.name=t,s.decorateRoot.add(e.$type)),e.$type;n||(n=r(58716));var i=new n(t||e.name);return s.decorateRoot.add(i),i.ctor=e,Object.defineProperty(e,"$type",{value:i,enumerable:!1}),Object.defineProperty(e.prototype,"$type",{value:i,enumerable:!1}),i};var l=0;s.decorateEnum=function(e){if(e.$type)return e.$type;i||(i=r(90222));var t=new i("Enum"+l++,e);return s.decorateRoot.add(t),Object.defineProperty(e,"$type",{value:t,enumerable:!1}),t},s.setProperty=function(e,t,r){if("object"!==typeof e)throw TypeError("dst must be an object");if(!t)throw TypeError("path must be specified");return function e(t,r,n){var i=r.shift();if(r.length>0)t[i]=e(t[i]||{},r,n);else{var s=t[i];s&&(n=[].concat(s).concat(n)),t[i]=n}return t}(e,t=t.split("."),r)},Object.defineProperty(s,"decorateRoot",{get:function(){return o.decorated||(o.decorated=new(r(68622)))}})},69351:(e,t,r)=>{"use strict";e.exports=i;var n=r(3097);function i(e,t){this.lo=e>>>0,this.hi=t>>>0}var s=i.zero=new i(0,0);s.toNumber=function(){return 0},s.zzEncode=s.zzDecode=function(){return this},s.length=function(){return 1};var o=i.zeroHash="\0\0\0\0\0\0\0\0";i.fromNumber=function(e){if(0===e)return s;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):s},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===o?s: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}},3097:function(e,t,r){"use strict";var n=t;function i(e,t,r){for(var n=Object.keys(t),i=0;i<n.length;++i)void 0!==e[n[i]]&&r||(e[n[i]]=t[n[i]]);return e}function s(e){function t(e,r){if(!(this instanceof t))return new t(e,r);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),r&&i(this,r)}return(t.prototype=Object.create(Error.prototype)).constructor=t,Object.defineProperty(t.prototype,"name",{get:function(){return e}}),t.prototype.toString=function(){return this.name+": "+this.message},t}n.asPromise=r(17206),n.base64=r(70001),n.EventEmitter=r(27111),n.float=r(30802),n.inquire=r(77172),n.utf8=r(93861),n.pool=r(58236),n.LongBits=r(69351),n.isNode=Boolean("undefined"!==typeof r.g&&r.g&&r.g.process&&r.g.process.versions&&r.g.process.versions.node),n.global=n.isNode&&r.g||"undefined"!==typeof window&&window||"undefined"!==typeof self&&self||this,n.emptyArray=Object.freeze?Object.freeze([]):[],n.emptyObject=Object.freeze?Object.freeze({}):{},n.isInteger=Number.isInteger||function(e){return"number"===typeof e&&isFinite(e)&&Math.floor(e)===e},n.isString=function(e){return"string"===typeof e||e instanceof String},n.isObject=function(e){return e&&"object"===typeof e},n.isset=n.isSet=function(e,t){var r=e[t];return!(null==r||!e.hasOwnProperty(t))&&("object"!==typeof r||(Array.isArray(r)?r.length:Object.keys(r).length)>0)},n.Buffer=function(){try{var e=n.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(t){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=s,n.ProtocolError=s("ProtocolError"),n.oneOfGetter=function(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=1;return function(){for(var e=Object.keys(this),r=e.length-1;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<e.length;++r)e[r]!==t&&delete this[e[r]]}},n.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},n._configure=function(){var e=n.Buffer;e?(n._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,r){return new e(t,r)},n._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):n._Buffer_from=n._Buffer_allocUnsafe=null}},90709:(e,t,r)=>{"use strict";e.exports=function(e){var t=i.codegen(["m"],e.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),r=e.oneofsArray,n={};r.length&&t("var p={}");for(var c=0;c<e.fieldsArray.length;++c){var u=e._fieldsArray[c].resolve(),l="m"+i.safeProp(u.name);if(u.optional&&t("if(%s!=null&&m.hasOwnProperty(%j)){",l,u.name),u.map)t("if(!util.isObject(%s))",l)("return%j",s(u,"object"))("var k=Object.keys(%s)",l)("for(var i=0;i<k.length;++i){"),a(t,u,"k[i]"),o(t,u,c,l+"[k[i]]")("}");else if(u.repeated)t("if(!Array.isArray(%s))",l)("return%j",s(u,"array"))("for(var i=0;i<%s.length;++i){",l),o(t,u,c,l+"[i]")("}");else{if(u.partOf){var h=i.safeProp(u.partOf.name);1===n[u.partOf.name]&&t("if(p%s===1)",h)("return%j",u.partOf.name+": multiple values"),n[u.partOf.name]=1,t("p%s=1",h)}o(t,u,c,l)}u.optional&&t("}")}return t("return null")};var n=r(90222),i=r(52440);function s(e,t){return e.name+": "+t+(e.repeated&&"array"!==t?"[]":e.map&&"object"!==t?"{k:"+e.keyType+"}":"")+" expected"}function o(e,t,r,i){if(t.resolvedType)if(t.resolvedType instanceof n){e("switch(%s){",i)("default:")("return%j",s(t,"enum value"));for(var o=Object.keys(t.resolvedType.values),a=0;a<o.length;++a)e("case %i:",t.resolvedType.values[o[a]]);e("break")("}")}else e("{")("var e=types[%i].verify(%s);",r,i)("if(e)")("return%j+e",t.name+".")("}");else switch(t.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!util.isInteger(%s))",i)("return%j",s(t,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",i,i,i,i)("return%j",s(t,"integer|Long"));break;case"float":case"double":e('if(typeof %s!=="number")',i)("return%j",s(t,"number"));break;case"bool":e('if(typeof %s!=="boolean")',i)("return%j",s(t,"boolean"));break;case"string":e("if(!util.isString(%s))",i)("return%j",s(t,"string"));break;case"bytes":e('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',i,i,i)("return%j",s(t,"buffer"))}return e}function a(e,t,r){switch(t.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!util.key32Re.test(%s))",r)("return%j",s(t,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!util.key64Re.test(%s))",r)("return%j",s(t,"integer|Long key"));break;case"bool":e("if(!util.key2Re.test(%s))",r)("return%j",s(t,"boolean key"))}return e}},19025:(e,t,r)=>{"use strict";var n=t,i=r(54486);n[".google.protobuf.Any"]={fromObject:function(e){if(e&&e["@type"]){var t=e["@type"].substring(e["@type"].lastIndexOf("/")+1),r=this.lookup(t);if(r){var n="."===e["@type"].charAt(0)?e["@type"].substr(1):e["@type"];return-1===n.indexOf("/")&&(n="/"+n),this.create({type_url:n,value:r.encode(r.fromObject(e)).finish()})}}return this.fromObject(e)},toObject:function(e,t){var r="",n="";if(t&&t.json&&e.type_url&&e.value){n=e.type_url.substring(e.type_url.lastIndexOf("/")+1),r=e.type_url.substring(0,e.type_url.lastIndexOf("/")+1);var s=this.lookup(n);s&&(e=s.decode(e.value))}if(!(e instanceof this.ctor)&&e instanceof i){var o=e.$type.toObject(e,t);return""===r&&(r="type.googleapis.com/"),n=r+("."===e.$type.fullName[0]?e.$type.fullName.substr(1):e.$type.fullName),o["@type"]=n,o}return this.toObject(e,t)}}},77063:(e,t,r)=>{"use strict";e.exports=h;var n,i=r(3097),s=i.LongBits,o=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 l(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function h(){this.len=0,this.head=new c(u,0,0),this.tail=this.head,this.states=null}var d=function(){return i.Buffer?function(){return(h.create=function(){return new n})()}:function(){return new h}};function f(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}h.create=d(),h.alloc=function(e){return new i.Array(e)},i.Array!==Array&&(h.alloc=i.pool(h.alloc,i.Array.prototype.subarray)),h.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},h.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},h.prototype.int32=function(e){return e<0?this._push(y,10,s.fromNumber(e)):this.uint32(e)},h.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},h.prototype.uint64=function(e){var t=s.from(e);return this._push(y,t.length(),t)},h.prototype.int64=h.prototype.uint64,h.prototype.sint64=function(e){var t=s.from(e).zzEncode();return this._push(y,t.length(),t)},h.prototype.bool=function(e){return this._push(f,1,e?1:0)},h.prototype.fixed32=function(e){return this._push(g,4,e>>>0)},h.prototype.sfixed32=h.prototype.fixed32,h.prototype.fixed64=function(e){var t=s.from(e);return this._push(g,4,t.lo)._push(g,4,t.hi)},h.prototype.sfixed64=h.prototype.fixed64,h.prototype.float=function(e){return this._push(i.float.writeFloatLE,4,e)},h.prototype.double=function(e){return this._push(i.float.writeDoubleLE,8,e)};var m=i.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n<e.length;++n)t[r+n]=e[n]};h.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(f,1,0);if(i.isString(e)){var r=h.alloc(t=o.length(e));o.decode(e,r,0),e=r}return this.uint32(t)._push(m,t,e)},h.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(f,1,0)},h.prototype.fork=function(){return this.states=new l(this),this.head=this.tail=new c(u,0,0),this.len=0,this},h.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},h.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},h.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},h._configure=function(e){n=e,h.create=d(),n._configure()}},72815:(e,t,r)=>{"use strict";e.exports=s;var n=r(77063);(s.prototype=Object.create(n.prototype)).constructor=s;var i=r(3097);function s(){n.call(this)}function o(e,t,r){e.length<40?i.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}s._configure=function(){s.alloc=i._Buffer_allocUnsafe,s.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<e.length;)t[r++]=e[n++]}},s.prototype.bytes=function(e){i.isString(e)&&(e=i._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(s.writeBytesBuffer,t,e),this},s.prototype.string=function(e){var t=i.Buffer.byteLength(e);return this.uint32(t),t&&this._push(o,t,e),this},s._configure()},34463:(e,t,r)=>{"use strict";var n=r(72791),i=r(45296);function s(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var o=new Set,a={};function c(e,t){u(e,t),u(e+"Capture",t)}function u(e,t){for(a[e]=t,e=0;e<t.length;e++)o.add(t[e])}var l=!("undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement),h=Object.prototype.hasOwnProperty,d=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,f={},p={};function y(e,t,r,n,i,s,o){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=n,this.attributeNamespace=i,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=o}var g={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach((function(e){g[e]=new y(e,0,!1,e,null,!1,!1)})),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach((function(e){var t=e[0];g[t]=new y(t,1,!1,e[1],null,!1,!1)})),["contentEditable","draggable","spellCheck","value"].forEach((function(e){g[e]=new y(e,2,!1,e.toLowerCase(),null,!1,!1)})),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach((function(e){g[e]=new y(e,2,!1,e,null,!1,!1)})),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach((function(e){g[e]=new y(e,3,!1,e.toLowerCase(),null,!1,!1)})),["checked","multiple","muted","selected"].forEach((function(e){g[e]=new y(e,3,!0,e,null,!1,!1)})),["capture","download"].forEach((function(e){g[e]=new y(e,4,!1,e,null,!1,!1)})),["cols","rows","size","span"].forEach((function(e){g[e]=new y(e,6,!1,e,null,!1,!1)})),["rowSpan","start"].forEach((function(e){g[e]=new y(e,5,!1,e.toLowerCase(),null,!1,!1)}));var m=/[\-:]([a-z])/g;function v(e){return e[1].toUpperCase()}function b(e,t,r,n){var i=g.hasOwnProperty(t)?g[t]:null;(null!==i?0!==i.type:n||!(2<t.length)||"o"!==t[0]&&"O"!==t[0]||"n"!==t[1]&&"N"!==t[1])&&(function(e,t,r,n){if(null===t||"undefined"===typeof t||function(e,t,r,n){if(null!==r&&0===r.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!n&&(null!==r?!r.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,t,r,n))return!0;if(n)return!1;if(null!==r)switch(r.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}(t,r,i,n)&&(r=null),n||null===i?function(e){return!!h.call(p,e)||!h.call(f,e)&&(d.test(e)?p[e]=!0:(f[e]=!0,!1))}(t)&&(null===r?e.removeAttribute(t):e.setAttribute(t,""+r)):i.mustUseProperty?e[i.propertyName]=null===r?3!==i.type&&"":r:(t=i.attributeName,n=i.attributeNamespace,null===r?e.removeAttribute(t):(r=3===(i=i.type)||4===i&&!0===r?"":""+r,n?e.setAttributeNS(n,t,r):e.setAttribute(t,r))))}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach((function(e){var t=e.replace(m,v);g[t]=new y(t,1,!1,e,null,!1,!1)})),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach((function(e){var t=e.replace(m,v);g[t]=new y(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)})),["xml:base","xml:lang","xml:space"].forEach((function(e){var t=e.replace(m,v);g[t]=new y(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)})),["tabIndex","crossOrigin"].forEach((function(e){g[e]=new y(e,1,!1,e.toLowerCase(),null,!1,!1)})),g.xlinkHref=new y("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach((function(e){g[e]=new y(e,1,!1,e.toLowerCase(),null,!0,!0)}));var w=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,E=Symbol.for("react.element"),S=Symbol.for("react.portal"),_=Symbol.for("react.fragment"),I=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),A=Symbol.for("react.provider"),C=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),k=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),B=Symbol.for("react.lazy");Symbol.for("react.scope"),Symbol.for("react.debug_trace_mode");var N=Symbol.for("react.offscreen");Symbol.for("react.legacy_hidden"),Symbol.for("react.cache"),Symbol.for("react.tracing_marker");var D=Symbol.iterator;function L(e){return null===e||"object"!==typeof e?null:"function"===typeof(e=D&&e[D]||e["@@iterator"])?e:null}var x,M=Object.assign;function U(e){if(void 0===x)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);x=t&&t[1]||""}return"\n"+x+e}var K=!1;function j(e,t){if(!e||K)return"";K=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),"object"===typeof Reflect&&Reflect.construct){try{Reflect.construct(t,[])}catch(u){var n=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){n=u}e.call(t.prototype)}else{try{throw Error()}catch(u){n=u}e()}}catch(u){if(u&&n&&"string"===typeof u.stack){for(var i=u.stack.split("\n"),s=n.stack.split("\n"),o=i.length-1,a=s.length-1;1<=o&&0<=a&&i[o]!==s[a];)a--;for(;1<=o&&0<=a;o--,a--)if(i[o]!==s[a]){if(1!==o||1!==a)do{if(o--,0>--a||i[o]!==s[a]){var c="\n"+i[o].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}}while(1<=o&&0<=a);break}}}finally{K=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?U(e):""}function F(e){switch(e.tag){case 5:return U(e.type);case 16:return U("Lazy");case 13:return U("Suspense");case 19:return U("SuspenseList");case 0:case 2:case 15:return e=j(e.type,!1);case 11:return e=j(e.type.render,!1);case 1:return e=j(e.type,!0);default:return""}}function V(e){if(null==e)return null;if("function"===typeof e)return e.displayName||e.name||null;if("string"===typeof e)return e;switch(e){case _:return"Fragment";case S:return"Portal";case T:return"Profiler";case I:return"StrictMode";case P:return"Suspense";case k:return"SuspenseList"}if("object"===typeof e)switch(e.$$typeof){case C:return(e.displayName||"Context")+".Consumer";case A:return(e._context.displayName||"Context")+".Provider";case R:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case O:return null!==(t=e.displayName||null)?t:V(e.type)||"Memo";case B:t=e._payload,e=e._init;try{return V(e(t))}catch(r){}}return null}function q(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=(e=t.render).displayName||e.name||"",t.displayName||(""!==e?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return V(t);case 8:return t===I?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if("function"===typeof t)return t.displayName||t.name||null;if("string"===typeof t)return t}return null}function z(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function H(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function G(e){e._valueTracker||(e._valueTracker=function(e){var t=H(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&"undefined"!==typeof r&&"function"===typeof r.get&&"function"===typeof r.set){var i=r.get,s=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=""+e,s.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function W(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=H(e)?e.checked?"true":"false":e.value),(e=n)!==r&&(t.setValue(e),!0)}function Y(e){if("undefined"===typeof(e=e||("undefined"!==typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}function Q(e,t){var r=t.checked;return M({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=r?r:e._wrapperState.initialChecked})}function J(e,t){var r=null==t.defaultValue?"":t.defaultValue,n=null!=t.checked?t.checked:t.defaultChecked;r=z(null!=t.value?t.value:r),e._wrapperState={initialChecked:n,initialValue:r,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function X(e,t){null!=(t=t.checked)&&b(e,"checked",t,!1)}function $(e,t){X(e,t);var r=z(t.value),n=t.type;if(null!=r)"number"===n?(0===r&&""===e.value||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if("submit"===n||"reset"===n)return void e.removeAttribute("value");t.hasOwnProperty("value")?ee(e,t.type,r):t.hasOwnProperty("defaultValue")&&ee(e,t.type,z(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function Z(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!("submit"!==n&&"reset"!==n||void 0!==t.value&&null!==t.value))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}""!==(r=e.name)&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,""!==r&&(e.name=r)}function ee(e,t,r){"number"===t&&Y(e.ownerDocument)===e||(null==r?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var te=Array.isArray;function re(e,t,r,n){if(e=e.options,t){t={};for(var i=0;i<r.length;i++)t["$"+r[i]]=!0;for(r=0;r<e.length;r++)i=t.hasOwnProperty("$"+e[r].value),e[r].selected!==i&&(e[r].selected=i),i&&n&&(e[r].defaultSelected=!0)}else{for(r=""+z(r),t=null,i=0;i<e.length;i++){if(e[i].value===r)return e[i].selected=!0,void(n&&(e[i].defaultSelected=!0));null!==t||e[i].disabled||(t=e[i])}null!==t&&(t.selected=!0)}}function ne(e,t){if(null!=t.dangerouslySetInnerHTML)throw Error(s(91));return M({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function ie(e,t){var r=t.value;if(null==r){if(r=t.children,t=t.defaultValue,null!=r){if(null!=t)throw Error(s(92));if(te(r)){if(1<r.length)throw Error(s(93));r=r[0]}t=r}null==t&&(t=""),r=t}e._wrapperState={initialValue:z(r)}}function se(e,t){var r=z(t.value),n=z(t.defaultValue);null!=r&&((r=""+r)!==e.value&&(e.value=r),null==t.defaultValue&&e.defaultValue!==r&&(e.defaultValue=r)),null!=n&&(e.defaultValue=""+n)}function oe(e){var t=e.textContent;t===e._wrapperState.initialValue&&""!==t&&null!==t&&(e.value=t)}function ae(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function ce(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?ae(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var ue,le,he=(le=function(e,t){if("http://www.w3.org/2000/svg"!==e.namespaceURI||"innerHTML"in e)e.innerHTML=t;else{for((ue=ue||document.createElement("div")).innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=ue.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}},"undefined"!==typeof MSApp&&MSApp.execUnsafeLocalFunction?function(e,t,r,n){MSApp.execUnsafeLocalFunction((function(){return le(e,t)}))}:le);function de(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&3===r.nodeType)return void(r.nodeValue=t)}e.textContent=t}var fe={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},pe=["Webkit","ms","Moz","O"];function ye(e,t,r){return null==t||"boolean"===typeof t||""===t?"":r||"number"!==typeof t||0===t||fe.hasOwnProperty(e)&&fe[e]?(""+t).trim():t+"px"}function ge(e,t){for(var r in e=e.style,t)if(t.hasOwnProperty(r)){var n=0===r.indexOf("--"),i=ye(r,t[r],n);"float"===r&&(r="cssFloat"),n?e.setProperty(r,i):e[r]=i}}Object.keys(fe).forEach((function(e){pe.forEach((function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),fe[t]=fe[e]}))}));var me=M({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ve(e,t){if(t){if(me[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML))throw Error(s(137,e));if(null!=t.dangerouslySetInnerHTML){if(null!=t.children)throw Error(s(60));if("object"!==typeof t.dangerouslySetInnerHTML||!("__html"in t.dangerouslySetInnerHTML))throw Error(s(61))}if(null!=t.style&&"object"!==typeof t.style)throw Error(s(62))}}function be(e,t){if(-1===e.indexOf("-"))return"string"===typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var we=null;function Ee(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var Se=null,_e=null,Ie=null;function Te(e){if(e=bi(e)){if("function"!==typeof Se)throw Error(s(280));var t=e.stateNode;t&&(t=Ei(t),Se(e.stateNode,e.type,t))}}function Ae(e){_e?Ie?Ie.push(e):Ie=[e]:_e=e}function Ce(){if(_e){var e=_e,t=Ie;if(Ie=_e=null,Te(e),t)for(e=0;e<t.length;e++)Te(t[e])}}function Re(e,t){return e(t)}function Pe(){}var ke=!1;function Oe(e,t,r){if(ke)return e(t,r);ke=!0;try{return Re(e,t,r)}finally{ke=!1,(null!==_e||null!==Ie)&&(Pe(),Ce())}}function Be(e,t){var r=e.stateNode;if(null===r)return null;var n=Ei(r);if(null===n)return null;r=n[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(n=!n.disabled)||(n=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!n;break e;default:e=!1}if(e)return null;if(r&&"function"!==typeof r)throw Error(s(231,t,typeof r));return r}var Ne=!1;if(l)try{var De={};Object.defineProperty(De,"passive",{get:function(){Ne=!0}}),window.addEventListener("test",De,De),window.removeEventListener("test",De,De)}catch(le){Ne=!1}function Le(e,t,r,n,i,s,o,a,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(r,u)}catch(l){this.onError(l)}}var xe=!1,Me=null,Ue=!1,Ke=null,je={onError:function(e){xe=!0,Me=e}};function Fe(e,t,r,n,i,s,o,a,c){xe=!1,Me=null,Le.apply(je,arguments)}function Ve(e){var t=e,r=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{0!==(4098&(t=e).flags)&&(r=t.return),e=t.return}while(e)}return 3===t.tag?r:null}function qe(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&(null!==(e=e.alternate)&&(t=e.memoizedState)),null!==t)return t.dehydrated}return null}function ze(e){if(Ve(e)!==e)throw Error(s(188))}function He(e){return null!==(e=function(e){var t=e.alternate;if(!t){if(null===(t=Ve(e)))throw Error(s(188));return t!==e?null:e}for(var r=e,n=t;;){var i=r.return;if(null===i)break;var o=i.alternate;if(null===o){if(null!==(n=i.return)){r=n;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===r)return ze(i),e;if(o===n)return ze(i),t;o=o.sibling}throw Error(s(188))}if(r.return!==n.return)r=i,n=o;else{for(var a=!1,c=i.child;c;){if(c===r){a=!0,r=i,n=o;break}if(c===n){a=!0,n=i,r=o;break}c=c.sibling}if(!a){for(c=o.child;c;){if(c===r){a=!0,r=o,n=i;break}if(c===n){a=!0,n=o,r=i;break}c=c.sibling}if(!a)throw Error(s(189))}}if(r.alternate!==n)throw Error(s(190))}if(3!==r.tag)throw Error(s(188));return r.stateNode.current===r?e:t}(e))?Ge(e):null}function Ge(e){if(5===e.tag||6===e.tag)return e;for(e=e.child;null!==e;){var t=Ge(e);if(null!==t)return t;e=e.sibling}return null}var We=i.unstable_scheduleCallback,Ye=i.unstable_cancelCallback,Qe=i.unstable_shouldYield,Je=i.unstable_requestPaint,Xe=i.unstable_now,$e=i.unstable_getCurrentPriorityLevel,Ze=i.unstable_ImmediatePriority,et=i.unstable_UserBlockingPriority,tt=i.unstable_NormalPriority,rt=i.unstable_LowPriority,nt=i.unstable_IdlePriority,it=null,st=null;var ot=Math.clz32?Math.clz32:function(e){return 0===(e>>>=0)?32:31-(at(e)/ct|0)|0},at=Math.log,ct=Math.LN2;var ut=64,lt=4194304;function ht(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return 4194240&e;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return 130023424&e;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function dt(e,t){var r=e.pendingLanes;if(0===r)return 0;var n=0,i=e.suspendedLanes,s=e.pingedLanes,o=268435455&r;if(0!==o){var a=o&~i;0!==a?n=ht(a):0!==(s&=o)&&(n=ht(s))}else 0!==(o=r&~i)?n=ht(o):0!==s&&(n=ht(s));if(0===n)return 0;if(0!==t&&t!==n&&0===(t&i)&&((i=n&-n)>=(s=t&-t)||16===i&&0!==(4194240&s)))return t;if(0!==(4&n)&&(n|=16&r),0!==(t=e.entangledLanes))for(e=e.entanglements,t&=n;0<t;)i=1<<(r=31-ot(t)),n|=e[r],t&=~i;return n}function ft(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;default:return-1}}function pt(e){return 0!==(e=-1073741825&e.pendingLanes)?e:1073741824&e?1073741824:0}function yt(){var e=ut;return 0===(4194240&(ut<<=1))&&(ut=64),e}function gt(e){for(var t=[],r=0;31>r;r++)t.push(e);return t}function mt(e,t,r){e.pendingLanes|=t,536870912!==t&&(e.suspendedLanes=0,e.pingedLanes=0),(e=e.eventTimes)[t=31-ot(t)]=r}function vt(e,t){var r=e.entangledLanes|=t;for(e=e.entanglements;r;){var n=31-ot(r),i=1<<n;i&t|e[n]&t&&(e[n]|=t),r&=~i}}var bt=0;function wt(e){return 1<(e&=-e)?4<e?0!==(268435455&e)?16:536870912:4:1}var Et,St,_t,It,Tt,At=!1,Ct=[],Rt=null,Pt=null,kt=null,Ot=new Map,Bt=new Map,Nt=[],Dt="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Lt(e,t){switch(e){case"focusin":case"focusout":Rt=null;break;case"dragenter":case"dragleave":Pt=null;break;case"mouseover":case"mouseout":kt=null;break;case"pointerover":case"pointerout":Ot.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Bt.delete(t.pointerId)}}function xt(e,t,r,n,i,s){return null===e||e.nativeEvent!==s?(e={blockedOn:t,domEventName:r,eventSystemFlags:n,nativeEvent:s,targetContainers:[i]},null!==t&&(null!==(t=bi(t))&&St(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,null!==i&&-1===t.indexOf(i)&&t.push(i),e)}function Mt(e){var t=vi(e.target);if(null!==t){var r=Ve(t);if(null!==r)if(13===(t=r.tag)){if(null!==(t=qe(r)))return e.blockedOn=t,void Tt(e.priority,(function(){_t(r)}))}else if(3===t&&r.stateNode.current.memoizedState.isDehydrated)return void(e.blockedOn=3===r.tag?r.stateNode.containerInfo:null)}e.blockedOn=null}function Ut(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var r=Qt(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(null!==r)return null!==(t=bi(r))&&St(t),e.blockedOn=r,!1;var n=new(r=e.nativeEvent).constructor(r.type,r);we=n,r.target.dispatchEvent(n),we=null,t.shift()}return!0}function Kt(e,t,r){Ut(e)&&r.delete(t)}function jt(){At=!1,null!==Rt&&Ut(Rt)&&(Rt=null),null!==Pt&&Ut(Pt)&&(Pt=null),null!==kt&&Ut(kt)&&(kt=null),Ot.forEach(Kt),Bt.forEach(Kt)}function Ft(e,t){e.blockedOn===t&&(e.blockedOn=null,At||(At=!0,i.unstable_scheduleCallback(i.unstable_NormalPriority,jt)))}function Vt(e){function t(t){return Ft(t,e)}if(0<Ct.length){Ft(Ct[0],e);for(var r=1;r<Ct.length;r++){var n=Ct[r];n.blockedOn===e&&(n.blockedOn=null)}}for(null!==Rt&&Ft(Rt,e),null!==Pt&&Ft(Pt,e),null!==kt&&Ft(kt,e),Ot.forEach(t),Bt.forEach(t),r=0;r<Nt.length;r++)(n=Nt[r]).blockedOn===e&&(n.blockedOn=null);for(;0<Nt.length&&null===(r=Nt[0]).blockedOn;)Mt(r),null===r.blockedOn&&Nt.shift()}var qt=w.ReactCurrentBatchConfig,zt=!0;function Ht(e,t,r,n){var i=bt,s=qt.transition;qt.transition=null;try{bt=1,Wt(e,t,r,n)}finally{bt=i,qt.transition=s}}function Gt(e,t,r,n){var i=bt,s=qt.transition;qt.transition=null;try{bt=4,Wt(e,t,r,n)}finally{bt=i,qt.transition=s}}function Wt(e,t,r,n){if(zt){var i=Qt(e,t,r,n);if(null===i)zn(e,t,n,Yt,r),Lt(e,n);else if(function(e,t,r,n,i){switch(t){case"focusin":return Rt=xt(Rt,e,t,r,n,i),!0;case"dragenter":return Pt=xt(Pt,e,t,r,n,i),!0;case"mouseover":return kt=xt(kt,e,t,r,n,i),!0;case"pointerover":var s=i.pointerId;return Ot.set(s,xt(Ot.get(s)||null,e,t,r,n,i)),!0;case"gotpointercapture":return s=i.pointerId,Bt.set(s,xt(Bt.get(s)||null,e,t,r,n,i)),!0}return!1}(i,e,t,r,n))n.stopPropagation();else if(Lt(e,n),4&t&&-1<Dt.indexOf(e)){for(;null!==i;){var s=bi(i);if(null!==s&&Et(s),null===(s=Qt(e,t,r,n))&&zn(e,t,n,Yt,r),s===i)break;i=s}null!==i&&n.stopPropagation()}else zn(e,t,n,null,r)}}var Yt=null;function Qt(e,t,r,n){if(Yt=null,null!==(e=vi(e=Ee(n))))if(null===(t=Ve(e)))e=null;else if(13===(r=t.tag)){if(null!==(e=qe(t)))return e;e=null}else if(3===r){if(t.stateNode.current.memoizedState.isDehydrated)return 3===t.tag?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Yt=e,null}function Jt(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch($e()){case Ze:return 1;case et:return 4;case tt:case rt:return 16;case nt:return 536870912;default:return 16}default:return 16}}var Xt=null,$t=null,Zt=null;function er(){if(Zt)return Zt;var e,t,r=$t,n=r.length,i="value"in Xt?Xt.value:Xt.textContent,s=i.length;for(e=0;e<n&&r[e]===i[e];e++);var o=n-e;for(t=1;t<=o&&r[n-t]===i[s-t];t++);return Zt=i.slice(e,1<t?1-t:void 0)}function tr(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,10===e&&(e=13),32<=e||13===e?e:0}function rr(){return!0}function nr(){return!1}function ir(e){function t(t,r,n,i,s){for(var o in this._reactName=t,this._targetInst=n,this.type=r,this.nativeEvent=i,this.target=s,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(null!=i.defaultPrevented?i.defaultPrevented:!1===i.returnValue)?rr:nr,this.isPropagationStopped=nr,this}return M(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!==typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=rr)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!==typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=rr)},persist:function(){},isPersistent:rr}),t}var sr,or,ar,cr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ur=ir(cr),lr=M({},cr,{view:0,detail:0}),hr=ir(lr),dr=M({},lr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ir,button:0,buttons:0,relatedTarget:function(e){return void 0===e.relatedTarget?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==ar&&(ar&&"mousemove"===e.type?(sr=e.screenX-ar.screenX,or=e.screenY-ar.screenY):or=sr=0,ar=e),sr)},movementY:function(e){return"movementY"in e?e.movementY:or}}),fr=ir(dr),pr=ir(M({},dr,{dataTransfer:0})),yr=ir(M({},lr,{relatedTarget:0})),gr=ir(M({},cr,{animationName:0,elapsedTime:0,pseudoElement:0})),mr=M({},cr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),vr=ir(mr),br=ir(M({},cr,{data:0})),wr={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Er={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Sr={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function _r(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=Sr[e])&&!!t[e]}function Ir(){return _r}var Tr=M({},lr,{key:function(e){if(e.key){var t=wr[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=tr(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?Er[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ir,charCode:function(e){return"keypress"===e.type?tr(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?tr(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}}),Ar=ir(Tr),Cr=ir(M({},dr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Rr=ir(M({},lr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ir})),Pr=ir(M({},cr,{propertyName:0,elapsedTime:0,pseudoElement:0})),kr=M({},dr,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Or=ir(kr),Br=[9,13,27,32],Nr=l&&"CompositionEvent"in window,Dr=null;l&&"documentMode"in document&&(Dr=document.documentMode);var Lr=l&&"TextEvent"in window&&!Dr,xr=l&&(!Nr||Dr&&8<Dr&&11>=Dr),Mr=String.fromCharCode(32),Ur=!1;function Kr(e,t){switch(e){case"keyup":return-1!==Br.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function jr(e){return"object"===typeof(e=e.detail)&&"data"in e?e.data:null}var Fr=!1;var Vr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function qr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!Vr[e.type]:"textarea"===t}function zr(e,t,r,n){Ae(n),0<(t=Gn(t,"onChange")).length&&(r=new ur("onChange","change",null,r,n),e.push({event:r,listeners:t}))}var Hr=null,Gr=null;function Wr(e){Un(e,0)}function Yr(e){if(W(wi(e)))return e}function Qr(e,t){if("change"===e)return t}var Jr=!1;if(l){var Xr;if(l){var $r="oninput"in document;if(!$r){var Zr=document.createElement("div");Zr.setAttribute("oninput","return;"),$r="function"===typeof Zr.oninput}Xr=$r}else Xr=!1;Jr=Xr&&(!document.documentMode||9<document.documentMode)}function en(){Hr&&(Hr.detachEvent("onpropertychange",tn),Gr=Hr=null)}function tn(e){if("value"===e.propertyName&&Yr(Gr)){var t=[];zr(t,Gr,e,Ee(e)),Oe(Wr,t)}}function rn(e,t,r){"focusin"===e?(en(),Gr=r,(Hr=t).attachEvent("onpropertychange",tn)):"focusout"===e&&en()}function nn(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return Yr(Gr)}function sn(e,t){if("click"===e)return Yr(t)}function on(e,t){if("input"===e||"change"===e)return Yr(t)}var an="function"===typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e===1/t)||e!==e&&t!==t};function cn(e,t){if(an(e,t))return!0;if("object"!==typeof e||null===e||"object"!==typeof t||null===t)return!1;var r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(n=0;n<r.length;n++){var i=r[n];if(!h.call(t,i)||!an(e[i],t[i]))return!1}return!0}function un(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function ln(e,t){var r,n=un(e);for(e=0;n;){if(3===n.nodeType){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=un(n)}}function hn(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?hn(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function dn(){for(var e=window,t=Y();t instanceof e.HTMLIFrameElement;){try{var r="string"===typeof t.contentWindow.location.href}catch(n){r=!1}if(!r)break;t=Y((e=t.contentWindow).document)}return t}function fn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}function pn(e){var t=dn(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&hn(r.ownerDocument.documentElement,r)){if(null!==n&&fn(r))if(t=n.start,void 0===(e=n.end)&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if((e=(t=r.ownerDocument||document)&&t.defaultView||window).getSelection){e=e.getSelection();var i=r.textContent.length,s=Math.min(n.start,i);n=void 0===n.end?s:Math.min(n.end,i),!e.extend&&s>n&&(i=n,n=s,s=i),i=ln(r,s);var o=ln(r,n);i&&o&&(1!==e.rangeCount||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&((t=t.createRange()).setStart(i.node,i.offset),e.removeAllRanges(),s>n?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}for(t=[],e=r;e=e.parentNode;)1===e.nodeType&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for("function"===typeof r.focus&&r.focus(),r=0;r<t.length;r++)(e=t[r]).element.scrollLeft=e.left,e.element.scrollTop=e.top}}var yn=l&&"documentMode"in document&&11>=document.documentMode,gn=null,mn=null,vn=null,bn=!1;function wn(e,t,r){var n=r.window===r?r.document:9===r.nodeType?r:r.ownerDocument;bn||null==gn||gn!==Y(n)||("selectionStart"in(n=gn)&&fn(n)?n={start:n.selectionStart,end:n.selectionEnd}:n={anchorNode:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset},vn&&cn(vn,n)||(vn=n,0<(n=Gn(mn,"onSelect")).length&&(t=new ur("onSelect","select",null,t,r),e.push({event:t,listeners:n}),t.target=gn)))}function En(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r}var Sn={animationend:En("Animation","AnimationEnd"),animationiteration:En("Animation","AnimationIteration"),animationstart:En("Animation","AnimationStart"),transitionend:En("Transition","TransitionEnd")},_n={},In={};function Tn(e){if(_n[e])return _n[e];if(!Sn[e])return e;var t,r=Sn[e];for(t in r)if(r.hasOwnProperty(t)&&t in In)return _n[e]=r[t];return e}l&&(In=document.createElement("div").style,"AnimationEvent"in window||(delete Sn.animationend.animation,delete Sn.animationiteration.animation,delete Sn.animationstart.animation),"TransitionEvent"in window||delete Sn.transitionend.transition);var An=Tn("animationend"),Cn=Tn("animationiteration"),Rn=Tn("animationstart"),Pn=Tn("transitionend"),kn=new Map,On="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Bn(e,t){kn.set(e,t),c(t,[e])}for(var Nn=0;Nn<On.length;Nn++){var Dn=On[Nn];Bn(Dn.toLowerCase(),"on"+(Dn[0].toUpperCase()+Dn.slice(1)))}Bn(An,"onAnimationEnd"),Bn(Cn,"onAnimationIteration"),Bn(Rn,"onAnimationStart"),Bn("dblclick","onDoubleClick"),Bn("focusin","onFocus"),Bn("focusout","onBlur"),Bn(Pn,"onTransitionEnd"),u("onMouseEnter",["mouseout","mouseover"]),u("onMouseLeave",["mouseout","mouseover"]),u("onPointerEnter",["pointerout","pointerover"]),u("onPointerLeave",["pointerout","pointerover"]),c("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),c("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),c("onBeforeInput",["compositionend","keypress","textInput","paste"]),c("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ln="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),xn=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ln));function Mn(e,t,r){var n=e.type||"unknown-event";e.currentTarget=r,function(e,t,r,n,i,o,a,c,u){if(Fe.apply(this,arguments),xe){if(!xe)throw Error(s(198));var l=Me;xe=!1,Me=null,Ue||(Ue=!0,Ke=l)}}(n,t,void 0,e),e.currentTarget=null}function Un(e,t){t=0!==(4&t);for(var r=0;r<e.length;r++){var n=e[r],i=n.event;n=n.listeners;e:{var s=void 0;if(t)for(var o=n.length-1;0<=o;o--){var a=n[o],c=a.instance,u=a.currentTarget;if(a=a.listener,c!==s&&i.isPropagationStopped())break e;Mn(i,a,u),s=c}else for(o=0;o<n.length;o++){if(c=(a=n[o]).instance,u=a.currentTarget,a=a.listener,c!==s&&i.isPropagationStopped())break e;Mn(i,a,u),s=c}}}if(Ue)throw e=Ke,Ue=!1,Ke=null,e}function Kn(e,t){var r=t[yi];void 0===r&&(r=t[yi]=new Set);var n=e+"__bubble";r.has(n)||(qn(t,e,2,!1),r.add(n))}function jn(e,t,r){var n=0;t&&(n|=4),qn(r,e,n,t)}var Fn="_reactListening"+Math.random().toString(36).slice(2);function Vn(e){if(!e[Fn]){e[Fn]=!0,o.forEach((function(t){"selectionchange"!==t&&(xn.has(t)||jn(t,!1,e),jn(t,!0,e))}));var t=9===e.nodeType?e:e.ownerDocument;null===t||t[Fn]||(t[Fn]=!0,jn("selectionchange",!1,t))}}function qn(e,t,r,n){switch(Jt(t)){case 1:var i=Ht;break;case 4:i=Gt;break;default:i=Wt}r=i.bind(null,t,r,e),i=void 0,!Ne||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(i=!0),n?void 0!==i?e.addEventListener(t,r,{capture:!0,passive:i}):e.addEventListener(t,r,!0):void 0!==i?e.addEventListener(t,r,{passive:i}):e.addEventListener(t,r,!1)}function zn(e,t,r,n,i){var s=n;if(0===(1&t)&&0===(2&t)&&null!==n)e:for(;;){if(null===n)return;var o=n.tag;if(3===o||4===o){var a=n.stateNode.containerInfo;if(a===i||8===a.nodeType&&a.parentNode===i)break;if(4===o)for(o=n.return;null!==o;){var c=o.tag;if((3===c||4===c)&&((c=o.stateNode.containerInfo)===i||8===c.nodeType&&c.parentNode===i))return;o=o.return}for(;null!==a;){if(null===(o=vi(a)))return;if(5===(c=o.tag)||6===c){n=s=o;continue e}a=a.parentNode}}n=n.return}Oe((function(){var n=s,i=Ee(r),o=[];e:{var a=kn.get(e);if(void 0!==a){var c=ur,u=e;switch(e){case"keypress":if(0===tr(r))break e;case"keydown":case"keyup":c=Ar;break;case"focusin":u="focus",c=yr;break;case"focusout":u="blur",c=yr;break;case"beforeblur":case"afterblur":c=yr;break;case"click":if(2===r.button)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":c=fr;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":c=pr;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":c=Rr;break;case An:case Cn:case Rn:c=gr;break;case Pn:c=Pr;break;case"scroll":c=hr;break;case"wheel":c=Or;break;case"copy":case"cut":case"paste":c=vr;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":c=Cr}var l=0!==(4&t),h=!l&&"scroll"===e,d=l?null!==a?a+"Capture":null:a;l=[];for(var f,p=n;null!==p;){var y=(f=p).stateNode;if(5===f.tag&&null!==y&&(f=y,null!==d&&(null!=(y=Be(p,d))&&l.push(Hn(p,y,f)))),h)break;p=p.return}0<l.length&&(a=new c(a,u,null,r,i),o.push({event:a,listeners:l}))}}if(0===(7&t)){if(c="mouseout"===e||"pointerout"===e,(!(a="mouseover"===e||"pointerover"===e)||r===we||!(u=r.relatedTarget||r.fromElement)||!vi(u)&&!u[pi])&&(c||a)&&(a=i.window===i?i:(a=i.ownerDocument)?a.defaultView||a.parentWindow:window,c?(c=n,null!==(u=(u=r.relatedTarget||r.toElement)?vi(u):null)&&(u!==(h=Ve(u))||5!==u.tag&&6!==u.tag)&&(u=null)):(c=null,u=n),c!==u)){if(l=fr,y="onMouseLeave",d="onMouseEnter",p="mouse","pointerout"!==e&&"pointerover"!==e||(l=Cr,y="onPointerLeave",d="onPointerEnter",p="pointer"),h=null==c?a:wi(c),f=null==u?a:wi(u),(a=new l(y,p+"leave",c,r,i)).target=h,a.relatedTarget=f,y=null,vi(i)===n&&((l=new l(d,p+"enter",u,r,i)).target=f,l.relatedTarget=h,y=l),h=y,c&&u)e:{for(d=u,p=0,f=l=c;f;f=Wn(f))p++;for(f=0,y=d;y;y=Wn(y))f++;for(;0<p-f;)l=Wn(l),p--;for(;0<f-p;)d=Wn(d),f--;for(;p--;){if(l===d||null!==d&&l===d.alternate)break e;l=Wn(l),d=Wn(d)}l=null}else l=null;null!==c&&Yn(o,a,c,l,!1),null!==u&&null!==h&&Yn(o,h,u,l,!0)}if("select"===(c=(a=n?wi(n):window).nodeName&&a.nodeName.toLowerCase())||"input"===c&&"file"===a.type)var g=Qr;else if(qr(a))if(Jr)g=on;else{g=nn;var m=rn}else(c=a.nodeName)&&"input"===c.toLowerCase()&&("checkbox"===a.type||"radio"===a.type)&&(g=sn);switch(g&&(g=g(e,n))?zr(o,g,r,i):(m&&m(e,a,n),"focusout"===e&&(m=a._wrapperState)&&m.controlled&&"number"===a.type&&ee(a,"number",a.value)),m=n?wi(n):window,e){case"focusin":(qr(m)||"true"===m.contentEditable)&&(gn=m,mn=n,vn=null);break;case"focusout":vn=mn=gn=null;break;case"mousedown":bn=!0;break;case"contextmenu":case"mouseup":case"dragend":bn=!1,wn(o,r,i);break;case"selectionchange":if(yn)break;case"keydown":case"keyup":wn(o,r,i)}var v;if(Nr)e:{switch(e){case"compositionstart":var b="onCompositionStart";break e;case"compositionend":b="onCompositionEnd";break e;case"compositionupdate":b="onCompositionUpdate";break e}b=void 0}else Fr?Kr(e,r)&&(b="onCompositionEnd"):"keydown"===e&&229===r.keyCode&&(b="onCompositionStart");b&&(xr&&"ko"!==r.locale&&(Fr||"onCompositionStart"!==b?"onCompositionEnd"===b&&Fr&&(v=er()):($t="value"in(Xt=i)?Xt.value:Xt.textContent,Fr=!0)),0<(m=Gn(n,b)).length&&(b=new br(b,e,null,r,i),o.push({event:b,listeners:m}),v?b.data=v:null!==(v=jr(r))&&(b.data=v))),(v=Lr?function(e,t){switch(e){case"compositionend":return jr(t);case"keypress":return 32!==t.which?null:(Ur=!0,Mr);case"textInput":return(e=t.data)===Mr&&Ur?null:e;default:return null}}(e,r):function(e,t){if(Fr)return"compositionend"===e||!Nr&&Kr(e,t)?(e=er(),Zt=$t=Xt=null,Fr=!1,e):null;switch(e){case"paste":default:return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return xr&&"ko"!==t.locale?null:t.data}}(e,r))&&(0<(n=Gn(n,"onBeforeInput")).length&&(i=new br("onBeforeInput","beforeinput",null,r,i),o.push({event:i,listeners:n}),i.data=v))}Un(o,t)}))}function Hn(e,t,r){return{instance:e,listener:t,currentTarget:r}}function Gn(e,t){for(var r=t+"Capture",n=[];null!==e;){var i=e,s=i.stateNode;5===i.tag&&null!==s&&(i=s,null!=(s=Be(e,r))&&n.unshift(Hn(e,s,i)),null!=(s=Be(e,t))&&n.push(Hn(e,s,i))),e=e.return}return n}function Wn(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag);return e||null}function Yn(e,t,r,n,i){for(var s=t._reactName,o=[];null!==r&&r!==n;){var a=r,c=a.alternate,u=a.stateNode;if(null!==c&&c===n)break;5===a.tag&&null!==u&&(a=u,i?null!=(c=Be(r,s))&&o.unshift(Hn(r,c,a)):i||null!=(c=Be(r,s))&&o.push(Hn(r,c,a))),r=r.return}0!==o.length&&e.push({event:t,listeners:o})}var Qn=/\r\n?/g,Jn=/\u0000|\uFFFD/g;function Xn(e){return("string"===typeof e?e:""+e).replace(Qn,"\n").replace(Jn,"")}function $n(e,t,r){if(t=Xn(t),Xn(e)!==t&&r)throw Error(s(425))}function Zn(){}var ei=null,ti=null;function ri(e,t){return"textarea"===e||"noscript"===e||"string"===typeof t.children||"number"===typeof t.children||"object"===typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var ni="function"===typeof setTimeout?setTimeout:void 0,ii="function"===typeof clearTimeout?clearTimeout:void 0,si="function"===typeof Promise?Promise:void 0,oi="function"===typeof queueMicrotask?queueMicrotask:"undefined"!==typeof si?function(e){return si.resolve(null).then(e).catch(ai)}:ni;function ai(e){setTimeout((function(){throw e}))}function ci(e,t){var r=t,n=0;do{var i=r.nextSibling;if(e.removeChild(r),i&&8===i.nodeType)if("/$"===(r=i.data)){if(0===n)return e.removeChild(i),void Vt(t);n--}else"$"!==r&&"$?"!==r&&"$!"!==r||n++;r=i}while(r);Vt(t)}function ui(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break;if(8===t){if("$"===(t=e.data)||"$!"===t||"$?"===t)break;if("/$"===t)return null}}return e}function li(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var r=e.data;if("$"===r||"$!"===r||"$?"===r){if(0===t)return e;t--}else"/$"===r&&t++}e=e.previousSibling}return null}var hi=Math.random().toString(36).slice(2),di="__reactFiber$"+hi,fi="__reactProps$"+hi,pi="__reactContainer$"+hi,yi="__reactEvents$"+hi,gi="__reactListeners$"+hi,mi="__reactHandles$"+hi;function vi(e){var t=e[di];if(t)return t;for(var r=e.parentNode;r;){if(t=r[pi]||r[di]){if(r=t.alternate,null!==t.child||null!==r&&null!==r.child)for(e=li(e);null!==e;){if(r=e[di])return r;e=li(e)}return t}r=(e=r).parentNode}return null}function bi(e){return!(e=e[di]||e[pi])||5!==e.tag&&6!==e.tag&&13!==e.tag&&3!==e.tag?null:e}function wi(e){if(5===e.tag||6===e.tag)return e.stateNode;throw Error(s(33))}function Ei(e){return e[fi]||null}var Si=[],_i=-1;function Ii(e){return{current:e}}function Ti(e){0>_i||(e.current=Si[_i],Si[_i]=null,_i--)}function Ai(e,t){_i++,Si[_i]=e.current,e.current=t}var Ci={},Ri=Ii(Ci),Pi=Ii(!1),ki=Ci;function Oi(e,t){var r=e.type.contextTypes;if(!r)return Ci;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var i,s={};for(i in r)s[i]=t[i];return n&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function Bi(e){return null!==(e=e.childContextTypes)&&void 0!==e}function Ni(){Ti(Pi),Ti(Ri)}function Di(e,t,r){if(Ri.current!==Ci)throw Error(s(168));Ai(Ri,t),Ai(Pi,r)}function Li(e,t,r){var n=e.stateNode;if(t=t.childContextTypes,"function"!==typeof n.getChildContext)return r;for(var i in n=n.getChildContext())if(!(i in t))throw Error(s(108,q(e)||"Unknown",i));return M({},r,n)}function xi(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ci,ki=Ri.current,Ai(Ri,e),Ai(Pi,Pi.current),!0}function Mi(e,t,r){var n=e.stateNode;if(!n)throw Error(s(169));r?(e=Li(e,t,ki),n.__reactInternalMemoizedMergedChildContext=e,Ti(Pi),Ti(Ri),Ai(Ri,e)):Ti(Pi),Ai(Pi,r)}var Ui=null,Ki=!1,ji=!1;function Fi(e){null===Ui?Ui=[e]:Ui.push(e)}function Vi(){if(!ji&&null!==Ui){ji=!0;var e=0,t=bt;try{var r=Ui;for(bt=1;e<r.length;e++){var n=r[e];do{n=n(!0)}while(null!==n)}Ui=null,Ki=!1}catch(i){throw null!==Ui&&(Ui=Ui.slice(e+1)),We(Ze,Vi),i}finally{bt=t,ji=!1}}return null}var qi=w.ReactCurrentBatchConfig;function zi(e,t){if(e&&e.defaultProps){for(var r in t=M({},t),e=e.defaultProps)void 0===t[r]&&(t[r]=e[r]);return t}return t}var Hi=Ii(null),Gi=null,Wi=null,Yi=null;function Qi(){Yi=Wi=Gi=null}function Ji(e){var t=Hi.current;Ti(Hi),e._currentValue=t}function Xi(e,t,r){for(;null!==e;){var n=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,null!==n&&(n.childLanes|=t)):null!==n&&(n.childLanes&t)!==t&&(n.childLanes|=t),e===r)break;e=e.return}}function $i(e,t){Gi=e,Yi=Wi=null,null!==(e=e.dependencies)&&null!==e.firstContext&&(0!==(e.lanes&t)&&(Ea=!0),e.firstContext=null)}function Zi(e){var t=e._currentValue;if(Yi!==e)if(e={context:e,memoizedValue:t,next:null},null===Wi){if(null===Gi)throw Error(s(308));Wi=e,Gi.dependencies={lanes:0,firstContext:e}}else Wi=Wi.next=e;return t}var es=null,ts=!1;function rs(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ns(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function is(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ss(e,t){var r=e.updateQueue;null!==r&&(r=r.shared,tu(e)?(null===(e=r.interleaved)?(t.next=t,null===es?es=[r]:es.push(r)):(t.next=e.next,e.next=t),r.interleaved=t):(null===(e=r.pending)?t.next=t:(t.next=e.next,e.next=t),r.pending=t))}function os(e,t,r){if(null!==(t=t.updateQueue)&&(t=t.shared,0!==(4194240&r))){var n=t.lanes;r|=n&=e.pendingLanes,t.lanes=r,vt(e,r)}}function as(e,t){var r=e.updateQueue,n=e.alternate;if(null!==n&&r===(n=n.updateQueue)){var i=null,s=null;if(null!==(r=r.firstBaseUpdate)){do{var o={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};null===s?i=s=o:s=s.next=o,r=r.next}while(null!==r);null===s?i=s=t:s=s.next=t}else i=s=t;return r={baseState:n.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:n.shared,effects:n.effects},void(e.updateQueue=r)}null===(e=r.lastBaseUpdate)?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function cs(e,t,r,n){var i=e.updateQueue;ts=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,a=i.shared.pending;if(null!==a){i.shared.pending=null;var c=a,u=c.next;c.next=null,null===o?s=u:o.next=u,o=c;var l=e.alternate;null!==l&&((a=(l=l.updateQueue).lastBaseUpdate)!==o&&(null===a?l.firstBaseUpdate=u:a.next=u,l.lastBaseUpdate=c))}if(null!==s){var h=i.baseState;for(o=0,l=u=c=null,a=s;;){var d=a.lane,f=a.eventTime;if((n&d)===d){null!==l&&(l=l.next={eventTime:f,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var p=e,y=a;switch(d=t,f=r,y.tag){case 1:if("function"===typeof(p=y.payload)){h=p.call(f,h,d);break e}h=p;break e;case 3:p.flags=-65537&p.flags|128;case 0:if(null===(d="function"===typeof(p=y.payload)?p.call(f,h,d):p)||void 0===d)break e;h=M({},h,d);break e;case 2:ts=!0}}null!==a.callback&&0!==a.lane&&(e.flags|=64,null===(d=i.effects)?i.effects=[a]:d.push(a))}else f={eventTime:f,lane:d,tag:a.tag,payload:a.payload,callback:a.callback,next:null},null===l?(u=l=f,c=h):l=l.next=f,o|=d;if(null===(a=a.next)){if(null===(a=i.shared.pending))break;a=(d=a).next,d.next=null,i.lastBaseUpdate=d,i.shared.pending=null}}if(null===l&&(c=h),i.baseState=c,i.firstBaseUpdate=u,i.lastBaseUpdate=l,null!==(t=i.shared.interleaved)){i=t;do{o|=i.lane,i=i.next}while(i!==t)}else null===s&&(i.shared.lanes=0);Nc|=o,e.lanes=o,e.memoizedState=h}}function us(e,t,r){if(e=t.effects,t.effects=null,null!==e)for(t=0;t<e.length;t++){var n=e[t],i=n.callback;if(null!==i){if(n.callback=null,n=r,"function"!==typeof i)throw Error(s(191,i));i.call(n)}}}var ls=(new n.Component).refs;function hs(e,t,r,n){r=null===(r=r(n,t=e.memoizedState))||void 0===r?t:M({},t,r),e.memoizedState=r,0===e.lanes&&(e.updateQueue.baseState=r)}var ds={isMounted:function(e){return!!(e=e._reactInternals)&&Ve(e)===e},enqueueSetState:function(e,t,r){e=e._reactInternals;var n=Xc(),i=$c(e),s=is(n,i);s.payload=t,void 0!==r&&null!==r&&(s.callback=r),ss(e,s),null!==(t=Zc(e,i,n))&&os(t,e,i)},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var n=Xc(),i=$c(e),s=is(n,i);s.tag=1,s.payload=t,void 0!==r&&null!==r&&(s.callback=r),ss(e,s),null!==(t=Zc(e,i,n))&&os(t,e,i)},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=Xc(),n=$c(e),i=is(r,n);i.tag=2,void 0!==t&&null!==t&&(i.callback=t),ss(e,i),null!==(t=Zc(e,n,r))&&os(t,e,n)}};function fs(e,t,r,n,i,s,o){return"function"===typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(n,s,o):!t.prototype||!t.prototype.isPureReactComponent||(!cn(r,n)||!cn(i,s))}function ps(e,t,r){var n=!1,i=Ci,s=t.contextType;return"object"===typeof s&&null!==s?s=Zi(s):(i=Bi(t)?ki:Ri.current,s=(n=null!==(n=t.contextTypes)&&void 0!==n)?Oi(e,i):Ci),t=new t(r,s),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=ds,e.stateNode=t,t._reactInternals=e,n&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=s),t}function ys(e,t,r,n){e=t.state,"function"===typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(r,n),"function"===typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(r,n),t.state!==e&&ds.enqueueReplaceState(t,t.state,null)}function gs(e,t,r,n){var i=e.stateNode;i.props=r,i.state=e.memoizedState,i.refs=ls,rs(e);var s=t.contextType;"object"===typeof s&&null!==s?i.context=Zi(s):(s=Bi(t)?ki:Ri.current,i.context=Oi(e,s)),i.state=e.memoizedState,"function"===typeof(s=t.getDerivedStateFromProps)&&(hs(e,t,s,r),i.state=e.memoizedState),"function"===typeof t.getDerivedStateFromProps||"function"===typeof i.getSnapshotBeforeUpdate||"function"!==typeof i.UNSAFE_componentWillMount&&"function"!==typeof i.componentWillMount||(t=i.state,"function"===typeof i.componentWillMount&&i.componentWillMount(),"function"===typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount(),t!==i.state&&ds.enqueueReplaceState(i,i.state,null),cs(e,r,i,n),i.state=e.memoizedState),"function"===typeof i.componentDidMount&&(e.flags|=4194308)}var ms=[],vs=0,bs=null,ws=0,Es=[],Ss=0,_s=null,Is=1,Ts="";function As(e,t){ms[vs++]=ws,ms[vs++]=bs,bs=e,ws=t}function Cs(e,t,r){Es[Ss++]=Is,Es[Ss++]=Ts,Es[Ss++]=_s,_s=e;var n=Is;e=Ts;var i=32-ot(n)-1;n&=~(1<<i),r+=1;var s=32-ot(t)+i;if(30<s){var o=i-i%5;s=(n&(1<<o)-1).toString(32),n>>=o,i-=o,Is=1<<32-ot(t)+i|r<<i|n,Ts=s+e}else Is=1<<s|r<<i|n,Ts=e}function Rs(e){null!==e.return&&(As(e,1),Cs(e,1,0))}function Ps(e){for(;e===bs;)bs=ms[--vs],ms[vs]=null,ws=ms[--vs],ms[vs]=null;for(;e===_s;)_s=Es[--Ss],Es[Ss]=null,Ts=Es[--Ss],Es[Ss]=null,Is=Es[--Ss],Es[Ss]=null}var ks=null,Os=null,Bs=!1,Ns=null;function Ds(e,t){var r=ku(5,null,null,0);r.elementType="DELETED",r.stateNode=t,r.return=e,null===(t=e.deletions)?(e.deletions=[r],e.flags|=16):t.push(r)}function Ls(e,t){switch(e.tag){case 5:var r=e.type;return null!==(t=1!==t.nodeType||r.toLowerCase()!==t.nodeName.toLowerCase()?null:t)&&(e.stateNode=t,ks=e,Os=ui(t.firstChild),!0);case 6:return null!==(t=""===e.pendingProps||3!==t.nodeType?null:t)&&(e.stateNode=t,ks=e,Os=null,!0);case 13:return null!==(t=8!==t.nodeType?null:t)&&(r=null!==_s?{id:Is,overflow:Ts}:null,e.memoizedState={dehydrated:t,treeContext:r,retryLane:1073741824},(r=ku(18,null,null,0)).stateNode=t,r.return=e,e.child=r,ks=e,Os=null,!0);default:return!1}}function xs(e){return 0!==(1&e.mode)&&0===(128&e.flags)}function Ms(e){if(Bs){var t=Os;if(t){var r=t;if(!Ls(e,t)){if(xs(e))throw Error(s(418));t=ui(r.nextSibling);var n=ks;t&&Ls(e,t)?Ds(n,r):(e.flags=-4097&e.flags|2,Bs=!1,ks=e)}}else{if(xs(e))throw Error(s(418));e.flags=-4097&e.flags|2,Bs=!1,ks=e}}}function Us(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;ks=e}function Ks(e){if(e!==ks)return!1;if(!Bs)return Us(e),Bs=!0,!1;var t;if((t=3!==e.tag)&&!(t=5!==e.tag)&&(t="head"!==(t=e.type)&&"body"!==t&&!ri(e.type,e.memoizedProps)),t&&(t=Os)){if(xs(e)){for(e=Os;e;)e=ui(e.nextSibling);throw Error(s(418))}for(;t;)Ds(e,t),t=ui(t.nextSibling)}if(Us(e),13===e.tag){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(s(317));e:{for(e=e.nextSibling,t=0;e;){if(8===e.nodeType){var r=e.data;if("/$"===r){if(0===t){Os=ui(e.nextSibling);break e}t--}else"$"!==r&&"$!"!==r&&"$?"!==r||t++}e=e.nextSibling}Os=null}}else Os=ks?ui(e.stateNode.nextSibling):null;return!0}function js(){Os=ks=null,Bs=!1}function Fs(e){null===Ns?Ns=[e]:Ns.push(e)}function Vs(e,t,r){if(null!==(e=r.ref)&&"function"!==typeof e&&"object"!==typeof e){if(r._owner){if(r=r._owner){if(1!==r.tag)throw Error(s(309));var n=r.stateNode}if(!n)throw Error(s(147,e));var i=n,o=""+e;return null!==t&&null!==t.ref&&"function"===typeof t.ref&&t.ref._stringRef===o?t.ref:(t=function(e){var t=i.refs;t===ls&&(t=i.refs={}),null===e?delete t[o]:t[o]=e},t._stringRef=o,t)}if("string"!==typeof e)throw Error(s(284));if(!r._owner)throw Error(s(290,e))}return e}function qs(e,t){throw e=Object.prototype.toString.call(t),Error(s(31,"[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function zs(e){return(0,e._init)(e._payload)}function Hs(e){function t(t,r){if(e){var n=t.deletions;null===n?(t.deletions=[r],t.flags|=16):n.push(r)}}function r(r,n){if(!e)return null;for(;null!==n;)t(r,n),n=n.sibling;return null}function n(e,t){for(e=new Map;null!==t;)null!==t.key?e.set(t.key,t):e.set(t.index,t),t=t.sibling;return e}function i(e,t){return(e=Bu(e,t)).index=0,e.sibling=null,e}function o(t,r,n){return t.index=n,e?null!==(n=t.alternate)?(n=n.index)<r?(t.flags|=2,r):n:(t.flags|=2,r):(t.flags|=1048576,r)}function a(t){return e&&null===t.alternate&&(t.flags|=2),t}function c(e,t,r,n){return null===t||6!==t.tag?((t=xu(r,e.mode,n)).return=e,t):((t=i(t,r)).return=e,t)}function u(e,t,r,n){var s=r.type;return s===_?h(e,t,r.props.children,n,r.key):null!==t&&(t.elementType===s||"object"===typeof s&&null!==s&&s.$$typeof===B&&zs(s)===t.type)?((n=i(t,r.props)).ref=Vs(e,t,r),n.return=e,n):((n=Nu(r.type,r.key,r.props,null,e.mode,n)).ref=Vs(e,t,r),n.return=e,n)}function l(e,t,r,n){return null===t||4!==t.tag||t.stateNode.containerInfo!==r.containerInfo||t.stateNode.implementation!==r.implementation?((t=Mu(r,e.mode,n)).return=e,t):((t=i(t,r.children||[])).return=e,t)}function h(e,t,r,n,s){return null===t||7!==t.tag?((t=Du(r,e.mode,n,s)).return=e,t):((t=i(t,r)).return=e,t)}function d(e,t,r){if("string"===typeof t&&""!==t||"number"===typeof t)return(t=xu(""+t,e.mode,r)).return=e,t;if("object"===typeof t&&null!==t){switch(t.$$typeof){case E:return(r=Nu(t.type,t.key,t.props,null,e.mode,r)).ref=Vs(e,null,t),r.return=e,r;case S:return(t=Mu(t,e.mode,r)).return=e,t;case B:return d(e,(0,t._init)(t._payload),r)}if(te(t)||L(t))return(t=Du(t,e.mode,r,null)).return=e,t;qs(e,t)}return null}function f(e,t,r,n){var i=null!==t?t.key:null;if("string"===typeof r&&""!==r||"number"===typeof r)return null!==i?null:c(e,t,""+r,n);if("object"===typeof r&&null!==r){switch(r.$$typeof){case E:return r.key===i?u(e,t,r,n):null;case S:return r.key===i?l(e,t,r,n):null;case B:return f(e,t,(i=r._init)(r._payload),n)}if(te(r)||L(r))return null!==i?null:h(e,t,r,n,null);qs(e,r)}return null}function p(e,t,r,n,i){if("string"===typeof n&&""!==n||"number"===typeof n)return c(t,e=e.get(r)||null,""+n,i);if("object"===typeof n&&null!==n){switch(n.$$typeof){case E:return u(t,e=e.get(null===n.key?r:n.key)||null,n,i);case S:return l(t,e=e.get(null===n.key?r:n.key)||null,n,i);case B:return p(e,t,r,(0,n._init)(n._payload),i)}if(te(n)||L(n))return h(t,e=e.get(r)||null,n,i,null);qs(t,n)}return null}function y(i,s,a,c){for(var u=null,l=null,h=s,y=s=0,g=null;null!==h&&y<a.length;y++){h.index>y?(g=h,h=null):g=h.sibling;var m=f(i,h,a[y],c);if(null===m){null===h&&(h=g);break}e&&h&&null===m.alternate&&t(i,h),s=o(m,s,y),null===l?u=m:l.sibling=m,l=m,h=g}if(y===a.length)return r(i,h),Bs&&As(i,y),u;if(null===h){for(;y<a.length;y++)null!==(h=d(i,a[y],c))&&(s=o(h,s,y),null===l?u=h:l.sibling=h,l=h);return Bs&&As(i,y),u}for(h=n(i,h);y<a.length;y++)null!==(g=p(h,i,y,a[y],c))&&(e&&null!==g.alternate&&h.delete(null===g.key?y:g.key),s=o(g,s,y),null===l?u=g:l.sibling=g,l=g);return e&&h.forEach((function(e){return t(i,e)})),Bs&&As(i,y),u}function g(i,a,c,u){var l=L(c);if("function"!==typeof l)throw Error(s(150));if(null==(c=l.call(c)))throw Error(s(151));for(var h=l=null,y=a,g=a=0,m=null,v=c.next();null!==y&&!v.done;g++,v=c.next()){y.index>g?(m=y,y=null):m=y.sibling;var b=f(i,y,v.value,u);if(null===b){null===y&&(y=m);break}e&&y&&null===b.alternate&&t(i,y),a=o(b,a,g),null===h?l=b:h.sibling=b,h=b,y=m}if(v.done)return r(i,y),Bs&&As(i,g),l;if(null===y){for(;!v.done;g++,v=c.next())null!==(v=d(i,v.value,u))&&(a=o(v,a,g),null===h?l=v:h.sibling=v,h=v);return Bs&&As(i,g),l}for(y=n(i,y);!v.done;g++,v=c.next())null!==(v=p(y,i,g,v.value,u))&&(e&&null!==v.alternate&&y.delete(null===v.key?g:v.key),a=o(v,a,g),null===h?l=v:h.sibling=v,h=v);return e&&y.forEach((function(e){return t(i,e)})),Bs&&As(i,g),l}return function e(n,s,o,c){if("object"===typeof o&&null!==o&&o.type===_&&null===o.key&&(o=o.props.children),"object"===typeof o&&null!==o){switch(o.$$typeof){case E:e:{for(var u=o.key,l=s;null!==l;){if(l.key===u){if((u=o.type)===_){if(7===l.tag){r(n,l.sibling),(s=i(l,o.props.children)).return=n,n=s;break e}}else if(l.elementType===u||"object"===typeof u&&null!==u&&u.$$typeof===B&&zs(u)===l.type){r(n,l.sibling),(s=i(l,o.props)).ref=Vs(n,l,o),s.return=n,n=s;break e}r(n,l);break}t(n,l),l=l.sibling}o.type===_?((s=Du(o.props.children,n.mode,c,o.key)).return=n,n=s):((c=Nu(o.type,o.key,o.props,null,n.mode,c)).ref=Vs(n,s,o),c.return=n,n=c)}return a(n);case S:e:{for(l=o.key;null!==s;){if(s.key===l){if(4===s.tag&&s.stateNode.containerInfo===o.containerInfo&&s.stateNode.implementation===o.implementation){r(n,s.sibling),(s=i(s,o.children||[])).return=n,n=s;break e}r(n,s);break}t(n,s),s=s.sibling}(s=Mu(o,n.mode,c)).return=n,n=s}return a(n);case B:return e(n,s,(l=o._init)(o._payload),c)}if(te(o))return y(n,s,o,c);if(L(o))return g(n,s,o,c);qs(n,o)}return"string"===typeof o&&""!==o||"number"===typeof o?(o=""+o,null!==s&&6===s.tag?(r(n,s.sibling),(s=i(s,o)).return=n,n=s):(r(n,s),(s=xu(o,n.mode,c)).return=n,n=s),a(n)):r(n,s)}}var Gs=Hs(!0),Ws=Hs(!1),Ys={},Qs=Ii(Ys),Js=Ii(Ys),Xs=Ii(Ys);function $s(e){if(e===Ys)throw Error(s(174));return e}function Zs(e,t){switch(Ai(Xs,t),Ai(Js,e),Ai(Qs,Ys),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:ce(null,"");break;default:t=ce(t=(e=8===e?t.parentNode:t).namespaceURI||null,e=e.tagName)}Ti(Qs),Ai(Qs,t)}function eo(){Ti(Qs),Ti(Js),Ti(Xs)}function to(e){$s(Xs.current);var t=$s(Qs.current),r=ce(t,e.type);t!==r&&(Ai(Js,e),Ai(Qs,r))}function ro(e){Js.current===e&&(Ti(Qs),Ti(Js))}var no=Ii(0);function io(e){for(var t=e;null!==t;){if(13===t.tag){var r=t.memoizedState;if(null!==r&&(null===(r=r.dehydrated)||"$?"===r.data||"$!"===r.data))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!==(128&t.flags))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var so=[];function oo(){for(var e=0;e<so.length;e++)so[e]._workInProgressVersionPrimary=null;so.length=0}var ao=w.ReactCurrentDispatcher,co=w.ReactCurrentBatchConfig,uo=0,lo=null,ho=null,fo=null,po=!1,yo=!1,go=0,mo=0;function vo(){throw Error(s(321))}function bo(e,t){if(null===t)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!an(e[r],t[r]))return!1;return!0}function wo(e,t,r,n,i,o){if(uo=o,lo=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,ao.current=null===e||null===e.memoizedState?na:ia,e=r(n,i),yo){o=0;do{if(yo=!1,go=0,25<=o)throw Error(s(301));o+=1,fo=ho=null,t.updateQueue=null,ao.current=sa,e=r(n,i)}while(yo)}if(ao.current=ra,t=null!==ho&&null!==ho.next,uo=0,fo=ho=lo=null,po=!1,t)throw Error(s(300));return e}function Eo(){var e=0!==go;return go=0,e}function So(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===fo?lo.memoizedState=fo=e:fo=fo.next=e,fo}function _o(){if(null===ho){var e=lo.alternate;e=null!==e?e.memoizedState:null}else e=ho.next;var t=null===fo?lo.memoizedState:fo.next;if(null!==t)fo=t,ho=e;else{if(null===e)throw Error(s(310));e={memoizedState:(ho=e).memoizedState,baseState:ho.baseState,baseQueue:ho.baseQueue,queue:ho.queue,next:null},null===fo?lo.memoizedState=fo=e:fo=fo.next=e}return fo}function Io(e,t){return"function"===typeof t?t(e):t}function To(e){var t=_o(),r=t.queue;if(null===r)throw Error(s(311));r.lastRenderedReducer=e;var n=ho,i=n.baseQueue,o=r.pending;if(null!==o){if(null!==i){var a=i.next;i.next=o.next,o.next=a}n.baseQueue=i=o,r.pending=null}if(null!==i){o=i.next,n=n.baseState;var c=a=null,u=null,l=o;do{var h=l.lane;if((uo&h)===h)null!==u&&(u=u.next={lane:0,action:l.action,hasEagerState:l.hasEagerState,eagerState:l.eagerState,next:null}),n=l.hasEagerState?l.eagerState:e(n,l.action);else{var d={lane:h,action:l.action,hasEagerState:l.hasEagerState,eagerState:l.eagerState,next:null};null===u?(c=u=d,a=n):u=u.next=d,lo.lanes|=h,Nc|=h}l=l.next}while(null!==l&&l!==o);null===u?a=n:u.next=c,an(n,t.memoizedState)||(Ea=!0),t.memoizedState=n,t.baseState=a,t.baseQueue=u,r.lastRenderedState=n}if(null!==(e=r.interleaved)){i=e;do{o=i.lane,lo.lanes|=o,Nc|=o,i=i.next}while(i!==e)}else null===i&&(r.lanes=0);return[t.memoizedState,r.dispatch]}function Ao(e){var t=_o(),r=t.queue;if(null===r)throw Error(s(311));r.lastRenderedReducer=e;var n=r.dispatch,i=r.pending,o=t.memoizedState;if(null!==i){r.pending=null;var a=i=i.next;do{o=e(o,a.action),a=a.next}while(a!==i);an(o,t.memoizedState)||(Ea=!0),t.memoizedState=o,null===t.baseQueue&&(t.baseState=o),r.lastRenderedState=o}return[o,n]}function Co(){}function Ro(e,t){var r=lo,n=_o(),i=t(),o=!an(n.memoizedState,i);if(o&&(n.memoizedState=i,Ea=!0),n=n.queue,Ko(Oo.bind(null,r,n,e),[e]),n.getSnapshot!==t||o||null!==fo&&1&fo.memoizedState.tag){if(r.flags|=2048,Do(9,ko.bind(null,r,n,i,t),void 0,null),null===Ac)throw Error(s(349));0!==(30&uo)||Po(r,t,i)}return i}function Po(e,t,r){e.flags|=16384,e={getSnapshot:t,value:r},null===(t=lo.updateQueue)?(t={lastEffect:null,stores:null},lo.updateQueue=t,t.stores=[e]):null===(r=t.stores)?t.stores=[e]:r.push(e)}function ko(e,t,r,n){t.value=r,t.getSnapshot=n,Bo(t)&&Zc(e,1,-1)}function Oo(e,t,r){return r((function(){Bo(t)&&Zc(e,1,-1)}))}function Bo(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!an(e,r)}catch(n){return!0}}function No(e){var t=So();return"function"===typeof e&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Io,lastRenderedState:e},t.queue=e,e=e.dispatch=Xo.bind(null,lo,e),[t.memoizedState,e]}function Do(e,t,r,n){return e={tag:e,create:t,destroy:r,deps:n,next:null},null===(t=lo.updateQueue)?(t={lastEffect:null,stores:null},lo.updateQueue=t,t.lastEffect=e.next=e):null===(r=t.lastEffect)?t.lastEffect=e.next=e:(n=r.next,r.next=e,e.next=n,t.lastEffect=e),e}function Lo(){return _o().memoizedState}function xo(e,t,r,n){var i=So();lo.flags|=e,i.memoizedState=Do(1|t,r,void 0,void 0===n?null:n)}function Mo(e,t,r,n){var i=_o();n=void 0===n?null:n;var s=void 0;if(null!==ho){var o=ho.memoizedState;if(s=o.destroy,null!==n&&bo(n,o.deps))return void(i.memoizedState=Do(t,r,s,n))}lo.flags|=e,i.memoizedState=Do(1|t,r,s,n)}function Uo(e,t){return xo(8390656,8,e,t)}function Ko(e,t){return Mo(2048,8,e,t)}function jo(e,t){return Mo(4,2,e,t)}function Fo(e,t){return Mo(4,4,e,t)}function Vo(e,t){return"function"===typeof t?(e=e(),t(e),function(){t(null)}):null!==t&&void 0!==t?(e=e(),t.current=e,function(){t.current=null}):void 0}function qo(e,t,r){return r=null!==r&&void 0!==r?r.concat([e]):null,Mo(4,4,Vo.bind(null,t,e),r)}function zo(){}function Ho(e,t){var r=_o();t=void 0===t?null:t;var n=r.memoizedState;return null!==n&&null!==t&&bo(t,n[1])?n[0]:(r.memoizedState=[e,t],e)}function Go(e,t){var r=_o();t=void 0===t?null:t;var n=r.memoizedState;return null!==n&&null!==t&&bo(t,n[1])?n[0]:(e=e(),r.memoizedState=[e,t],e)}function Wo(e,t,r){return 0===(21&uo)?(e.baseState&&(e.baseState=!1,Ea=!0),e.memoizedState=r):(an(r,t)||(r=yt(),lo.lanes|=r,Nc|=r,e.baseState=!0),t)}function Yo(e,t){var r=bt;bt=0!==r&&4>r?r:4,e(!0);var n=co.transition;co.transition={};try{e(!1),t()}finally{bt=r,co.transition=n}}function Qo(){return _o().memoizedState}function Jo(e,t,r){var n=$c(e);r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},$o(e)?Zo(t,r):(ea(e,t,r),null!==(e=Zc(e,n,r=Xc()))&&ta(e,t,n))}function Xo(e,t,r){var n=$c(e),i={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if($o(e))Zo(t,i);else{ea(e,t,i);var s=e.alternate;if(0===e.lanes&&(null===s||0===s.lanes)&&null!==(s=t.lastRenderedReducer))try{var o=t.lastRenderedState,a=s(o,r);if(i.hasEagerState=!0,i.eagerState=a,an(a,o))return}catch(c){}null!==(e=Zc(e,n,r=Xc()))&&ta(e,t,n)}}function $o(e){var t=e.alternate;return e===lo||null!==t&&t===lo}function Zo(e,t){yo=po=!0;var r=e.pending;null===r?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function ea(e,t,r){tu(e)?(null===(e=t.interleaved)?(r.next=r,null===es?es=[t]:es.push(t)):(r.next=e.next,e.next=r),t.interleaved=r):(null===(e=t.pending)?r.next=r:(r.next=e.next,e.next=r),t.pending=r)}function ta(e,t,r){if(0!==(4194240&r)){var n=t.lanes;r|=n&=e.pendingLanes,t.lanes=r,vt(e,r)}}var ra={readContext:Zi,useCallback:vo,useContext:vo,useEffect:vo,useImperativeHandle:vo,useInsertionEffect:vo,useLayoutEffect:vo,useMemo:vo,useReducer:vo,useRef:vo,useState:vo,useDebugValue:vo,useDeferredValue:vo,useTransition:vo,useMutableSource:vo,useSyncExternalStore:vo,useId:vo,unstable_isNewReconciler:!1},na={readContext:Zi,useCallback:function(e,t){return So().memoizedState=[e,void 0===t?null:t],e},useContext:Zi,useEffect:Uo,useImperativeHandle:function(e,t,r){return r=null!==r&&void 0!==r?r.concat([e]):null,xo(4194308,4,Vo.bind(null,t,e),r)},useLayoutEffect:function(e,t){return xo(4194308,4,e,t)},useInsertionEffect:function(e,t){return xo(4,2,e,t)},useMemo:function(e,t){var r=So();return t=void 0===t?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=So();return t=void 0!==r?r(t):t,n.memoizedState=n.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},n.queue=e,e=e.dispatch=Jo.bind(null,lo,e),[n.memoizedState,e]},useRef:function(e){return e={current:e},So().memoizedState=e},useState:No,useDebugValue:zo,useDeferredValue:function(e){return So().memoizedState=e},useTransition:function(){var e=No(!1),t=e[0];return e=Yo.bind(null,e[1]),So().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=lo,i=So();if(Bs){if(void 0===r)throw Error(s(407));r=r()}else{if(r=t(),null===Ac)throw Error(s(349));0!==(30&uo)||Po(n,t,r)}i.memoizedState=r;var o={value:r,getSnapshot:t};return i.queue=o,Uo(Oo.bind(null,n,o,e),[e]),n.flags|=2048,Do(9,ko.bind(null,n,o,r,t),void 0,null),r},useId:function(){var e=So(),t=Ac.identifierPrefix;if(Bs){var r=Ts;t=":"+t+"R"+(r=(Is&~(1<<32-ot(Is)-1)).toString(32)+r),0<(r=go++)&&(t+="H"+r.toString(32)),t+=":"}else t=":"+t+"r"+(r=mo++).toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},ia={readContext:Zi,useCallback:Ho,useContext:Zi,useEffect:Ko,useImperativeHandle:qo,useInsertionEffect:jo,useLayoutEffect:Fo,useMemo:Go,useReducer:To,useRef:Lo,useState:function(){return To(Io)},useDebugValue:zo,useDeferredValue:function(e){return Wo(_o(),ho.memoizedState,e)},useTransition:function(){return[To(Io)[0],_o().memoizedState]},useMutableSource:Co,useSyncExternalStore:Ro,useId:Qo,unstable_isNewReconciler:!1},sa={readContext:Zi,useCallback:Ho,useContext:Zi,useEffect:Ko,useImperativeHandle:qo,useInsertionEffect:jo,useLayoutEffect:Fo,useMemo:Go,useReducer:Ao,useRef:Lo,useState:function(){return Ao(Io)},useDebugValue:zo,useDeferredValue:function(e){var t=_o();return null===ho?t.memoizedState=e:Wo(t,ho.memoizedState,e)},useTransition:function(){return[Ao(Io)[0],_o().memoizedState]},useMutableSource:Co,useSyncExternalStore:Ro,useId:Qo,unstable_isNewReconciler:!1};function oa(e,t){try{var r="",n=t;do{r+=F(n),n=n.return}while(n);var i=r}catch(s){i="\nError generating stack: "+s.message+"\n"+s.stack}return{value:e,source:t,stack:i}}function aa(e,t){try{console.error(t.value)}catch(r){setTimeout((function(){throw r}))}}var ca,ua,la,ha="function"===typeof WeakMap?WeakMap:Map;function da(e,t,r){(r=is(-1,r)).tag=3,r.payload={element:null};var n=t.value;return r.callback=function(){Fc||(Fc=!0,Vc=n),aa(0,t)},r}function fa(e,t,r){(r=is(-1,r)).tag=3;var n=e.type.getDerivedStateFromError;if("function"===typeof n){var i=t.value;r.payload=function(){return n(i)},r.callback=function(){aa(0,t)}}var s=e.stateNode;return null!==s&&"function"===typeof s.componentDidCatch&&(r.callback=function(){aa(0,t),"function"!==typeof n&&(null===qc?qc=new Set([this]):qc.add(this));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),r}function pa(e,t,r){var n=e.pingCache;if(null===n){n=e.pingCache=new ha;var i=new Set;n.set(t,i)}else void 0===(i=n.get(t))&&(i=new Set,n.set(t,i));i.has(r)||(i.add(r),e=Iu.bind(null,e,t,r),t.then(e,e))}function ya(e){do{var t;if((t=13===e.tag)&&(t=null===(t=e.memoizedState)||null!==t.dehydrated),t)return e;e=e.return}while(null!==e);return null}function ga(e,t,r,n,i){return 0===(1&e.mode)?(e===t?e.flags|=65536:(e.flags|=128,r.flags|=131072,r.flags&=-52805,1===r.tag&&(null===r.alternate?r.tag=17:((t=is(-1,1)).tag=2,ss(r,t))),r.lanes|=1),e):(e.flags|=65536,e.lanes=i,e)}function ma(e,t){if(!Bs)switch(e.tailMode){case"hidden":t=e.tail;for(var r=null;null!==t;)null!==t.alternate&&(r=t),t=t.sibling;null===r?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var n=null;null!==r;)null!==r.alternate&&(n=r),r=r.sibling;null===n?t||null===e.tail?e.tail=null:e.tail.sibling=null:n.sibling=null}}function va(e){var t=null!==e.alternate&&e.alternate.child===e.child,r=0,n=0;if(t)for(var i=e.child;null!==i;)r|=i.lanes|i.childLanes,n|=14680064&i.subtreeFlags,n|=14680064&i.flags,i.return=e,i=i.sibling;else for(i=e.child;null!==i;)r|=i.lanes|i.childLanes,n|=i.subtreeFlags,n|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=n,e.childLanes=r,t}function ba(e,t,r){var n=t.pendingProps;switch(Ps(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return va(t),null;case 1:case 17:return Bi(t.type)&&Ni(),va(t),null;case 3:return n=t.stateNode,eo(),Ti(Pi),Ti(Ri),oo(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),null!==e&&null!==e.child||(Ks(t)?t.flags|=4:null===e||e.memoizedState.isDehydrated&&0===(256&t.flags)||(t.flags|=1024,null!==Ns&&(su(Ns),Ns=null))),va(t),null;case 5:ro(t);var i=$s(Xs.current);if(r=t.type,null!==e&&null!=t.stateNode)ua(e,t,r,n),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!n){if(null===t.stateNode)throw Error(s(166));return va(t),null}if(e=$s(Qs.current),Ks(t)){n=t.stateNode,r=t.type;var o=t.memoizedProps;switch(n[di]=t,n[fi]=o,e=0!==(1&t.mode),r){case"dialog":Kn("cancel",n),Kn("close",n);break;case"iframe":case"object":case"embed":Kn("load",n);break;case"video":case"audio":for(i=0;i<Ln.length;i++)Kn(Ln[i],n);break;case"source":Kn("error",n);break;case"img":case"image":case"link":Kn("error",n),Kn("load",n);break;case"details":Kn("toggle",n);break;case"input":J(n,o),Kn("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!o.multiple},Kn("invalid",n);break;case"textarea":ie(n,o),Kn("invalid",n)}for(var c in ve(r,o),i=null,o)if(o.hasOwnProperty(c)){var u=o[c];"children"===c?"string"===typeof u?n.textContent!==u&&(!0!==o.suppressHydrationWarning&&$n(n.textContent,u,e),i=["children",u]):"number"===typeof u&&n.textContent!==""+u&&(!0!==o.suppressHydrationWarning&&$n(n.textContent,u,e),i=["children",""+u]):a.hasOwnProperty(c)&&null!=u&&"onScroll"===c&&Kn("scroll",n)}switch(r){case"input":G(n),Z(n,o,!0);break;case"textarea":G(n),oe(n);break;case"select":case"option":break;default:"function"===typeof o.onClick&&(n.onclick=Zn)}n=i,t.updateQueue=n,null!==n&&(t.flags|=4)}else{c=9===i.nodeType?i:i.ownerDocument,"http://www.w3.org/1999/xhtml"===e&&(e=ae(r)),"http://www.w3.org/1999/xhtml"===e?"script"===r?((e=c.createElement("div")).innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):"string"===typeof n.is?e=c.createElement(r,{is:n.is}):(e=c.createElement(r),"select"===r&&(c=e,n.multiple?c.multiple=!0:n.size&&(c.size=n.size))):e=c.createElementNS(e,r),e[di]=t,e[fi]=n,ca(e,t),t.stateNode=e;e:{switch(c=be(r,n),r){case"dialog":Kn("cancel",e),Kn("close",e),i=n;break;case"iframe":case"object":case"embed":Kn("load",e),i=n;break;case"video":case"audio":for(i=0;i<Ln.length;i++)Kn(Ln[i],e);i=n;break;case"source":Kn("error",e),i=n;break;case"img":case"image":case"link":Kn("error",e),Kn("load",e),i=n;break;case"details":Kn("toggle",e),i=n;break;case"input":J(e,n),i=Q(e,n),Kn("invalid",e);break;case"option":default:i=n;break;case"select":e._wrapperState={wasMultiple:!!n.multiple},i=M({},n,{value:void 0}),Kn("invalid",e);break;case"textarea":ie(e,n),i=ne(e,n),Kn("invalid",e)}for(o in ve(r,i),u=i)if(u.hasOwnProperty(o)){var l=u[o];"style"===o?ge(e,l):"dangerouslySetInnerHTML"===o?null!=(l=l?l.__html:void 0)&&he(e,l):"children"===o?"string"===typeof l?("textarea"!==r||""!==l)&&de(e,l):"number"===typeof l&&de(e,""+l):"suppressContentEditableWarning"!==o&&"suppressHydrationWarning"!==o&&"autoFocus"!==o&&(a.hasOwnProperty(o)?null!=l&&"onScroll"===o&&Kn("scroll",e):null!=l&&b(e,o,l,c))}switch(r){case"input":G(e),Z(e,n,!1);break;case"textarea":G(e),oe(e);break;case"option":null!=n.value&&e.setAttribute("value",""+z(n.value));break;case"select":e.multiple=!!n.multiple,null!=(o=n.value)?re(e,!!n.multiple,o,!1):null!=n.defaultValue&&re(e,!!n.multiple,n.defaultValue,!0);break;default:"function"===typeof i.onClick&&(e.onclick=Zn)}switch(r){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}}n&&(t.flags|=4)}null!==t.ref&&(t.flags|=512,t.flags|=2097152)}return va(t),null;case 6:if(e&&null!=t.stateNode)la(0,t,e.memoizedProps,n);else{if("string"!==typeof n&&null===t.stateNode)throw Error(s(166));if(r=$s(Xs.current),$s(Qs.current),Ks(t)){if(n=t.stateNode,r=t.memoizedProps,n[di]=t,(o=n.nodeValue!==r)&&null!==(e=ks))switch(e.tag){case 3:$n(n.nodeValue,r,0!==(1&e.mode));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&$n(n.nodeValue,r,0!==(1&e.mode))}o&&(t.flags|=4)}else(n=(9===r.nodeType?r:r.ownerDocument).createTextNode(n))[di]=t,t.stateNode=n}return va(t),null;case 13:if(Ti(no),n=t.memoizedState,Bs&&null!==Os&&0!==(1&t.mode)&&0===(128&t.flags)){for(n=Os;n;)n=ui(n.nextSibling);return js(),t.flags|=98560,t}if(null!==n&&null!==n.dehydrated){if(n=Ks(t),null===e){if(!n)throw Error(s(318));if(!(n=null!==(n=t.memoizedState)?n.dehydrated:null))throw Error(s(317));n[di]=t}else js(),0===(128&t.flags)&&(t.memoizedState=null),t.flags|=4;return va(t),null}return null!==Ns&&(su(Ns),Ns=null),0!==(128&t.flags)?(t.lanes=r,t):(n=null!==n,r=!1,null===e?Ks(t):r=null!==e.memoizedState,n!==r&&n&&(t.child.flags|=8192,0!==(1&t.mode)&&(null===e||0!==(1&no.current)?0===Oc&&(Oc=3):pu())),null!==t.updateQueue&&(t.flags|=4),va(t),null);case 4:return eo(),null===e&&Vn(t.stateNode.containerInfo),va(t),null;case 10:return Ji(t.type._context),va(t),null;case 19:if(Ti(no),null===(o=t.memoizedState))return va(t),null;if(n=0!==(128&t.flags),null===(c=o.rendering))if(n)ma(o,!1);else{if(0!==Oc||null!==e&&0!==(128&e.flags))for(e=t.child;null!==e;){if(null!==(c=io(e))){for(t.flags|=128,ma(o,!1),null!==(n=c.updateQueue)&&(t.updateQueue=n,t.flags|=4),t.subtreeFlags=0,n=r,r=t.child;null!==r;)e=n,(o=r).flags&=14680066,null===(c=o.alternate)?(o.childLanes=0,o.lanes=e,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=c.childLanes,o.lanes=c.lanes,o.child=c.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=c.memoizedProps,o.memoizedState=c.memoizedState,o.updateQueue=c.updateQueue,o.type=c.type,e=c.dependencies,o.dependencies=null===e?null:{lanes:e.lanes,firstContext:e.firstContext}),r=r.sibling;return Ai(no,1&no.current|2),t.child}e=e.sibling}null!==o.tail&&Xe()>Kc&&(t.flags|=128,n=!0,ma(o,!1),t.lanes=4194304)}else{if(!n)if(null!==(e=io(c))){if(t.flags|=128,n=!0,null!==(r=e.updateQueue)&&(t.updateQueue=r,t.flags|=4),ma(o,!0),null===o.tail&&"hidden"===o.tailMode&&!c.alternate&&!Bs)return va(t),null}else 2*Xe()-o.renderingStartTime>Kc&&1073741824!==r&&(t.flags|=128,n=!0,ma(o,!1),t.lanes=4194304);o.isBackwards?(c.sibling=t.child,t.child=c):(null!==(r=o.last)?r.sibling=c:t.child=c,o.last=c)}return null!==o.tail?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Xe(),t.sibling=null,r=no.current,Ai(no,n?1&r|2:1&r),t):(va(t),null);case 22:case 23:return lu(),n=null!==t.memoizedState,null!==e&&null!==e.memoizedState!==n&&(t.flags|=8192),n&&0!==(1&t.mode)?0!==(1073741824&Pc)&&(va(t),6&t.subtreeFlags&&(t.flags|=8192)):va(t),null;case 24:case 25:return null}throw Error(s(156,t.tag))}ca=function(e,t){for(var r=t.child;null!==r;){if(5===r.tag||6===r.tag)e.appendChild(r.stateNode);else if(4!==r.tag&&null!==r.child){r.child.return=r,r=r.child;continue}if(r===t)break;for(;null===r.sibling;){if(null===r.return||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}},ua=function(e,t,r,n){var i=e.memoizedProps;if(i!==n){e=t.stateNode,$s(Qs.current);var s,o=null;switch(r){case"input":i=Q(e,i),n=Q(e,n),o=[];break;case"select":i=M({},i,{value:void 0}),n=M({},n,{value:void 0}),o=[];break;case"textarea":i=ne(e,i),n=ne(e,n),o=[];break;default:"function"!==typeof i.onClick&&"function"===typeof n.onClick&&(e.onclick=Zn)}for(l in ve(r,n),r=null,i)if(!n.hasOwnProperty(l)&&i.hasOwnProperty(l)&&null!=i[l])if("style"===l){var c=i[l];for(s in c)c.hasOwnProperty(s)&&(r||(r={}),r[s]="")}else"dangerouslySetInnerHTML"!==l&&"children"!==l&&"suppressContentEditableWarning"!==l&&"suppressHydrationWarning"!==l&&"autoFocus"!==l&&(a.hasOwnProperty(l)?o||(o=[]):(o=o||[]).push(l,null));for(l in n){var u=n[l];if(c=null!=i?i[l]:void 0,n.hasOwnProperty(l)&&u!==c&&(null!=u||null!=c))if("style"===l)if(c){for(s in c)!c.hasOwnProperty(s)||u&&u.hasOwnProperty(s)||(r||(r={}),r[s]="");for(s in u)u.hasOwnProperty(s)&&c[s]!==u[s]&&(r||(r={}),r[s]=u[s])}else r||(o||(o=[]),o.push(l,r)),r=u;else"dangerouslySetInnerHTML"===l?(u=u?u.__html:void 0,c=c?c.__html:void 0,null!=u&&c!==u&&(o=o||[]).push(l,u)):"children"===l?"string"!==typeof u&&"number"!==typeof u||(o=o||[]).push(l,""+u):"suppressContentEditableWarning"!==l&&"suppressHydrationWarning"!==l&&(a.hasOwnProperty(l)?(null!=u&&"onScroll"===l&&Kn("scroll",e),o||c===u||(o=[])):(o=o||[]).push(l,u))}r&&(o=o||[]).push("style",r);var l=o;(t.updateQueue=l)&&(t.flags|=4)}},la=function(e,t,r,n){r!==n&&(t.flags|=4)};var wa=w.ReactCurrentOwner,Ea=!1;function Sa(e,t,r,n){t.child=null===e?Ws(t,null,r,n):Gs(t,e.child,r,n)}function _a(e,t,r,n,i){r=r.render;var s=t.ref;return $i(t,i),n=wo(e,t,r,n,s,i),r=Eo(),null===e||Ea?(Bs&&r&&Rs(t),t.flags|=1,Sa(e,t,n,i),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,za(e,t,i))}function Ia(e,t,r,n,i){if(null===e){var s=r.type;return"function"!==typeof s||Ou(s)||void 0!==s.defaultProps||null!==r.compare||void 0!==r.defaultProps?((e=Nu(r.type,null,n,t,t.mode,i)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=s,Ta(e,t,s,n,i))}if(s=e.child,0===(e.lanes&i)){var o=s.memoizedProps;if((r=null!==(r=r.compare)?r:cn)(o,n)&&e.ref===t.ref)return za(e,t,i)}return t.flags|=1,(e=Bu(s,n)).ref=t.ref,e.return=t,t.child=e}function Ta(e,t,r,n,i){if(null!==e){var s=e.memoizedProps;if(cn(s,n)&&e.ref===t.ref){if(Ea=!1,t.pendingProps=n=s,0===(e.lanes&i))return t.lanes=e.lanes,za(e,t,i);0!==(131072&e.flags)&&(Ea=!0)}}return Ra(e,t,r,n,i)}function Aa(e,t,r){var n=t.pendingProps,i=n.children,s=null!==e?e.memoizedState:null;if("hidden"===n.mode)if(0===(1&t.mode))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ai(kc,Pc),Pc|=r;else{if(0===(1073741824&r))return e=null!==s?s.baseLanes|r:r,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Ai(kc,Pc),Pc|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=null!==s?s.baseLanes:r,Ai(kc,Pc),Pc|=n}else null!==s?(n=s.baseLanes|r,t.memoizedState=null):n=r,Ai(kc,Pc),Pc|=n;return Sa(e,t,i,r),t.child}function Ca(e,t){var r=t.ref;(null===e&&null!==r||null!==e&&e.ref!==r)&&(t.flags|=512,t.flags|=2097152)}function Ra(e,t,r,n,i){var s=Bi(r)?ki:Ri.current;return s=Oi(t,s),$i(t,i),r=wo(e,t,r,n,s,i),n=Eo(),null===e||Ea?(Bs&&n&&Rs(t),t.flags|=1,Sa(e,t,r,i),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,za(e,t,i))}function Pa(e,t,r,n,i){if(Bi(r)){var s=!0;xi(t)}else s=!1;if($i(t,i),null===t.stateNode)null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),ps(t,r,n),gs(t,r,n,i),n=!0;else if(null===e){var o=t.stateNode,a=t.memoizedProps;o.props=a;var c=o.context,u=r.contextType;"object"===typeof u&&null!==u?u=Zi(u):u=Oi(t,u=Bi(r)?ki:Ri.current);var l=r.getDerivedStateFromProps,h="function"===typeof l||"function"===typeof o.getSnapshotBeforeUpdate;h||"function"!==typeof o.UNSAFE_componentWillReceiveProps&&"function"!==typeof o.componentWillReceiveProps||(a!==n||c!==u)&&ys(t,o,n,u),ts=!1;var d=t.memoizedState;o.state=d,cs(t,n,o,i),c=t.memoizedState,a!==n||d!==c||Pi.current||ts?("function"===typeof l&&(hs(t,r,l,n),c=t.memoizedState),(a=ts||fs(t,r,a,n,d,c,u))?(h||"function"!==typeof o.UNSAFE_componentWillMount&&"function"!==typeof o.componentWillMount||("function"===typeof o.componentWillMount&&o.componentWillMount(),"function"===typeof o.UNSAFE_componentWillMount&&o.UNSAFE_componentWillMount()),"function"===typeof o.componentDidMount&&(t.flags|=4194308)):("function"===typeof o.componentDidMount&&(t.flags|=4194308),t.memoizedProps=n,t.memoizedState=c),o.props=n,o.state=c,o.context=u,n=a):("function"===typeof o.componentDidMount&&(t.flags|=4194308),n=!1)}else{o=t.stateNode,ns(e,t),a=t.memoizedProps,u=t.type===t.elementType?a:zi(t.type,a),o.props=u,h=t.pendingProps,d=o.context,"object"===typeof(c=r.contextType)&&null!==c?c=Zi(c):c=Oi(t,c=Bi(r)?ki:Ri.current);var f=r.getDerivedStateFromProps;(l="function"===typeof f||"function"===typeof o.getSnapshotBeforeUpdate)||"function"!==typeof o.UNSAFE_componentWillReceiveProps&&"function"!==typeof o.componentWillReceiveProps||(a!==h||d!==c)&&ys(t,o,n,c),ts=!1,d=t.memoizedState,o.state=d,cs(t,n,o,i);var p=t.memoizedState;a!==h||d!==p||Pi.current||ts?("function"===typeof f&&(hs(t,r,f,n),p=t.memoizedState),(u=ts||fs(t,r,u,n,d,p,c)||!1)?(l||"function"!==typeof o.UNSAFE_componentWillUpdate&&"function"!==typeof o.componentWillUpdate||("function"===typeof o.componentWillUpdate&&o.componentWillUpdate(n,p,c),"function"===typeof o.UNSAFE_componentWillUpdate&&o.UNSAFE_componentWillUpdate(n,p,c)),"function"===typeof o.componentDidUpdate&&(t.flags|=4),"function"===typeof o.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!==typeof o.componentDidUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),"function"!==typeof o.getSnapshotBeforeUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=p),o.props=n,o.state=p,o.context=c,n=u):("function"!==typeof o.componentDidUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),"function"!==typeof o.getSnapshotBeforeUpdate||a===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),n=!1)}return ka(e,t,r,n,s,i)}function ka(e,t,r,n,i,s){Ca(e,t);var o=0!==(128&t.flags);if(!n&&!o)return i&&Mi(t,r,!1),za(e,t,s);n=t.stateNode,wa.current=t;var a=o&&"function"!==typeof r.getDerivedStateFromError?null:n.render();return t.flags|=1,null!==e&&o?(t.child=Gs(t,e.child,null,s),t.child=Gs(t,null,a,s)):Sa(e,t,a,s),t.memoizedState=n.state,i&&Mi(t,r,!0),t.child}function Oa(e){var t=e.stateNode;t.pendingContext?Di(0,t.pendingContext,t.pendingContext!==t.context):t.context&&Di(0,t.context,!1),Zs(e,t.containerInfo)}function Ba(e,t,r,n,i){return js(),Fs(i),t.flags|=256,Sa(e,t,r,n),t.child}var Na={dehydrated:null,treeContext:null,retryLane:0};function Da(e){return{baseLanes:e,cachePool:null,transitions:null}}function La(e,t){return{baseLanes:e.baseLanes|t,cachePool:null,transitions:e.transitions}}function xa(e,t,r){var n,i=t.pendingProps,o=no.current,a=!1,c=0!==(128&t.flags);if((n=c)||(n=(null===e||null!==e.memoizedState)&&0!==(2&o)),n?(a=!0,t.flags&=-129):null!==e&&null===e.memoizedState||(o|=1),Ai(no,1&o),null===e)return Ms(t),null!==(e=t.memoizedState)&&null!==(e=e.dehydrated)?(0===(1&t.mode)?t.lanes=1:"$!"===e.data?t.lanes=8:t.lanes=1073741824,null):(o=i.children,e=i.fallback,a?(i=t.mode,a=t.child,o={mode:"hidden",children:o},0===(1&i)&&null!==a?(a.childLanes=0,a.pendingProps=o):a=Lu(o,i,0,null),e=Du(e,i,r,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=Da(r),t.memoizedState=Na,e):Ma(t,o));if(null!==(o=e.memoizedState)){if(null!==(n=o.dehydrated)){if(c)return 256&t.flags?(t.flags&=-257,ja(e,t,r,Error(s(422)))):null!==t.memoizedState?(t.child=e.child,t.flags|=128,null):(a=i.fallback,o=t.mode,i=Lu({mode:"visible",children:i.children},o,0,null),(a=Du(a,o,r,null)).flags|=2,i.return=t,a.return=t,i.sibling=a,t.child=i,0!==(1&t.mode)&&Gs(t,e.child,null,r),t.child.memoizedState=Da(r),t.memoizedState=Na,a);if(0===(1&t.mode))t=ja(e,t,r,null);else if("$!"===n.data)t=ja(e,t,r,Error(s(419)));else if(i=0!==(r&e.childLanes),Ea||i){if(null!==(i=Ac)){switch(r&-r){case 4:a=2;break;case 16:a=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:a=32;break;case 536870912:a=268435456;break;default:a=0}0!==(i=0!==(a&(i.suspendedLanes|r))?0:a)&&i!==o.retryLane&&(o.retryLane=i,Zc(e,i,-1))}pu(),t=ja(e,t,r,Error(s(421)))}else"$?"===n.data?(t.flags|=128,t.child=e.child,t=Au.bind(null,e),n._reactRetry=t,t=null):(r=o.treeContext,Os=ui(n.nextSibling),ks=t,Bs=!0,Ns=null,null!==r&&(Es[Ss++]=Is,Es[Ss++]=Ts,Es[Ss++]=_s,Is=r.id,Ts=r.overflow,_s=t),(t=Ma(t,t.pendingProps.children)).flags|=4096);return t}return a?(i=Ka(e,t,i.children,i.fallback,r),a=t.child,o=e.child.memoizedState,a.memoizedState=null===o?Da(r):La(o,r),a.childLanes=e.childLanes&~r,t.memoizedState=Na,i):(r=Ua(e,t,i.children,r),t.memoizedState=null,r)}return a?(i=Ka(e,t,i.children,i.fallback,r),a=t.child,o=e.child.memoizedState,a.memoizedState=null===o?Da(r):La(o,r),a.childLanes=e.childLanes&~r,t.memoizedState=Na,i):(r=Ua(e,t,i.children,r),t.memoizedState=null,r)}function Ma(e,t){return(t=Lu({mode:"visible",children:t},e.mode,0,null)).return=e,e.child=t}function Ua(e,t,r,n){var i=e.child;return e=i.sibling,r=Bu(i,{mode:"visible",children:r}),0===(1&t.mode)&&(r.lanes=n),r.return=t,r.sibling=null,null!==e&&(null===(n=t.deletions)?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r}function Ka(e,t,r,n,i){var s=t.mode,o=(e=e.child).sibling,a={mode:"hidden",children:r};return 0===(1&s)&&t.child!==e?((r=t.child).childLanes=0,r.pendingProps=a,t.deletions=null):(r=Bu(e,a)).subtreeFlags=14680064&e.subtreeFlags,null!==o?n=Bu(o,n):(n=Du(n,s,i,null)).flags|=2,n.return=t,r.return=t,r.sibling=n,t.child=r,n}function ja(e,t,r,n){return null!==n&&Fs(n),Gs(t,e.child,null,r),(e=Ma(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function Fa(e,t,r){e.lanes|=t;var n=e.alternate;null!==n&&(n.lanes|=t),Xi(e.return,t,r)}function Va(e,t,r,n,i){var s=e.memoizedState;null===s?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:i}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=n,s.tail=r,s.tailMode=i)}function qa(e,t,r){var n=t.pendingProps,i=n.revealOrder,s=n.tail;if(Sa(e,t,n.children,r),0!==(2&(n=no.current)))n=1&n|2,t.flags|=128;else{if(null!==e&&0!==(128&e.flags))e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&Fa(e,r,t);else if(19===e.tag)Fa(e,r,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}n&=1}if(Ai(no,n),0===(1&t.mode))t.memoizedState=null;else switch(i){case"forwards":for(r=t.child,i=null;null!==r;)null!==(e=r.alternate)&&null===io(e)&&(i=r),r=r.sibling;null===(r=i)?(i=t.child,t.child=null):(i=r.sibling,r.sibling=null),Va(t,!1,i,r,s);break;case"backwards":for(r=null,i=t.child,t.child=null;null!==i;){if(null!==(e=i.alternate)&&null===io(e)){t.child=i;break}e=i.sibling,i.sibling=r,r=i,i=e}Va(t,!0,r,null,s);break;case"together":Va(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function za(e,t,r){if(null!==e&&(t.dependencies=e.dependencies),Nc|=t.lanes,0===(r&t.childLanes))return null;if(null!==e&&t.child!==e.child)throw Error(s(153));if(null!==t.child){for(r=Bu(e=t.child,e.pendingProps),t.child=r,r.return=t;null!==e.sibling;)e=e.sibling,(r=r.sibling=Bu(e,e.pendingProps)).return=t;r.sibling=null}return t.child}function Ha(e,t){switch(Ps(t),t.tag){case 1:return Bi(t.type)&&Ni(),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return eo(),Ti(Pi),Ti(Ri),oo(),0!==(65536&(e=t.flags))&&0===(128&e)?(t.flags=-65537&e|128,t):null;case 5:return ro(t),null;case 13:if(Ti(no),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(s(340));js()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return Ti(no),null;case 4:return eo(),null;case 10:return Ji(t.type._context),null;case 22:case 23:return lu(),null;default:return null}}var Ga=!1,Wa=!1,Ya="function"===typeof WeakSet?WeakSet:Set,Qa=null;function Ja(e,t){var r=e.ref;if(null!==r)if("function"===typeof r)try{r(null)}catch(n){_u(e,t,n)}else r.current=null}function Xa(e,t,r){try{r()}catch(n){_u(e,t,n)}}var $a=!1;function Za(e,t,r){var n=t.updateQueue;if(null!==(n=null!==n?n.lastEffect:null)){var i=n=n.next;do{if((i.tag&e)===e){var s=i.destroy;i.destroy=void 0,void 0!==s&&Xa(t,r,s)}i=i.next}while(i!==n)}}function ec(e,t){if(null!==(t=null!==(t=t.updateQueue)?t.lastEffect:null)){var r=t=t.next;do{if((r.tag&e)===e){var n=r.create;r.destroy=n()}r=r.next}while(r!==t)}}function tc(e){var t=e.ref;if(null!==t){var r=e.stateNode;e.tag,e=r,"function"===typeof t?t(e):t.current=e}}function rc(e){var t=e.alternate;null!==t&&(e.alternate=null,rc(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&(null!==(t=e.stateNode)&&(delete t[di],delete t[fi],delete t[yi],delete t[gi],delete t[mi])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function nc(e){return 5===e.tag||3===e.tag||4===e.tag}function ic(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||nc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(2&e.flags)continue e;if(null===e.child||4===e.tag)continue e;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function sc(e,t,r){var n=e.tag;if(5===n||6===n)e=e.stateNode,t?8===r.nodeType?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(8===r.nodeType?(t=r.parentNode).insertBefore(e,r):(t=r).appendChild(e),null!==(r=r._reactRootContainer)&&void 0!==r||null!==t.onclick||(t.onclick=Zn));else if(4!==n&&null!==(e=e.child))for(sc(e,t,r),e=e.sibling;null!==e;)sc(e,t,r),e=e.sibling}function oc(e,t,r){var n=e.tag;if(5===n||6===n)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(4!==n&&null!==(e=e.child))for(oc(e,t,r),e=e.sibling;null!==e;)oc(e,t,r),e=e.sibling}var ac=null,cc=!1;function uc(e,t,r){for(r=r.child;null!==r;)lc(e,t,r),r=r.sibling}function lc(e,t,r){if(st&&"function"===typeof st.onCommitFiberUnmount)try{st.onCommitFiberUnmount(it,r)}catch(a){}switch(r.tag){case 5:Wa||Ja(r,t);case 6:var n=ac,i=cc;ac=null,uc(e,t,r),cc=i,null!==(ac=n)&&(cc?(e=ac,r=r.stateNode,8===e.nodeType?e.parentNode.removeChild(r):e.removeChild(r)):ac.removeChild(r.stateNode));break;case 18:null!==ac&&(cc?(e=ac,r=r.stateNode,8===e.nodeType?ci(e.parentNode,r):1===e.nodeType&&ci(e,r),Vt(e)):ci(ac,r.stateNode));break;case 4:n=ac,i=cc,ac=r.stateNode.containerInfo,cc=!0,uc(e,t,r),ac=n,cc=i;break;case 0:case 11:case 14:case 15:if(!Wa&&(null!==(n=r.updateQueue)&&null!==(n=n.lastEffect))){i=n=n.next;do{var s=i,o=s.destroy;s=s.tag,void 0!==o&&(0!==(2&s)||0!==(4&s))&&Xa(r,t,o),i=i.next}while(i!==n)}uc(e,t,r);break;case 1:if(!Wa&&(Ja(r,t),"function"===typeof(n=r.stateNode).componentWillUnmount))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(a){_u(r,t,a)}uc(e,t,r);break;case 21:uc(e,t,r);break;case 22:1&r.mode?(Wa=(n=Wa)||null!==r.memoizedState,uc(e,t,r),Wa=n):uc(e,t,r);break;default:uc(e,t,r)}}function hc(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var r=e.stateNode;null===r&&(r=e.stateNode=new Ya),t.forEach((function(t){var n=Cu.bind(null,e,t);r.has(t)||(r.add(t),t.then(n,n))}))}}function dc(e,t){var r=t.deletions;if(null!==r)for(var n=0;n<r.length;n++){var i=r[n];try{var o=e,a=t,c=a;e:for(;null!==c;){switch(c.tag){case 5:ac=c.stateNode,cc=!1;break e;case 3:case 4:ac=c.stateNode.containerInfo,cc=!0;break e}c=c.return}if(null===ac)throw Error(s(160));lc(o,a,i),ac=null,cc=!1;var u=i.alternate;null!==u&&(u.return=null),i.return=null}catch(l){_u(i,t,l)}}if(12854&t.subtreeFlags)for(t=t.child;null!==t;)fc(t,e),t=t.sibling}function fc(e,t){var r=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(dc(t,e),pc(e),4&n){try{Za(3,e,e.return),ec(3,e)}catch(y){_u(e,e.return,y)}try{Za(5,e,e.return)}catch(y){_u(e,e.return,y)}}break;case 1:dc(t,e),pc(e),512&n&&null!==r&&Ja(r,r.return);break;case 5:if(dc(t,e),pc(e),512&n&&null!==r&&Ja(r,r.return),32&e.flags){var i=e.stateNode;try{de(i,"")}catch(y){_u(e,e.return,y)}}if(4&n&&null!=(i=e.stateNode)){var o=e.memoizedProps,a=null!==r?r.memoizedProps:o,c=e.type,u=e.updateQueue;if(e.updateQueue=null,null!==u)try{"input"===c&&"radio"===o.type&&null!=o.name&&X(i,o),be(c,a);var l=be(c,o);for(a=0;a<u.length;a+=2){var h=u[a],d=u[a+1];"style"===h?ge(i,d):"dangerouslySetInnerHTML"===h?he(i,d):"children"===h?de(i,d):b(i,h,d,l)}switch(c){case"input":$(i,o);break;case"textarea":se(i,o);break;case"select":var f=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!o.multiple;var p=o.value;null!=p?re(i,!!o.multiple,p,!1):f!==!!o.multiple&&(null!=o.defaultValue?re(i,!!o.multiple,o.defaultValue,!0):re(i,!!o.multiple,o.multiple?[]:"",!1))}i[fi]=o}catch(y){_u(e,e.return,y)}}break;case 6:if(dc(t,e),pc(e),4&n){if(null===e.stateNode)throw Error(s(162));l=e.stateNode,h=e.memoizedProps;try{l.nodeValue=h}catch(y){_u(e,e.return,y)}}break;case 3:if(dc(t,e),pc(e),4&n&&null!==r&&r.memoizedState.isDehydrated)try{Vt(t.containerInfo)}catch(y){_u(e,e.return,y)}break;case 4:default:dc(t,e),pc(e);break;case 13:dc(t,e),pc(e),8192&(l=e.child).flags&&null!==l.memoizedState&&(null===l.alternate||null===l.alternate.memoizedState)&&(Uc=Xe()),4&n&&hc(e);break;case 22:if(l=null!==r&&null!==r.memoizedState,1&e.mode?(Wa=(h=Wa)||l,dc(t,e),Wa=h):dc(t,e),pc(e),8192&n){h=null!==e.memoizedState;e:for(d=null,f=e;;){if(5===f.tag){if(null===d){d=f;try{i=f.stateNode,h?"function"===typeof(o=i.style).setProperty?o.setProperty("display","none","important"):o.display="none":(c=f.stateNode,a=void 0!==(u=f.memoizedProps.style)&&null!==u&&u.hasOwnProperty("display")?u.display:null,c.style.display=ye("display",a))}catch(y){_u(e,e.return,y)}}}else if(6===f.tag){if(null===d)try{f.stateNode.nodeValue=h?"":f.memoizedProps}catch(y){_u(e,e.return,y)}}else if((22!==f.tag&&23!==f.tag||null===f.memoizedState||f===e)&&null!==f.child){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;null===f.sibling;){if(null===f.return||f.return===e)break e;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}if(h&&!l&&0!==(1&e.mode))for(Qa=e,e=e.child;null!==e;){for(l=Qa=e;null!==Qa;){switch(d=(h=Qa).child,h.tag){case 0:case 11:case 14:case 15:Za(4,h,h.return);break;case 1:if(Ja(h,h.return),"function"===typeof(o=h.stateNode).componentWillUnmount){f=h,p=h.return;try{i=f,o.props=i.memoizedProps,o.state=i.memoizedState,o.componentWillUnmount()}catch(y){_u(f,p,y)}}break;case 5:Ja(h,h.return);break;case 22:if(null!==h.memoizedState){vc(l);continue}}null!==d?(d.return=h,Qa=d):vc(l)}e=e.sibling}}break;case 19:dc(t,e),pc(e),4&n&&hc(e);case 21:}}function pc(e){var t=e.flags;if(2&t){try{e:{for(var r=e.return;null!==r;){if(nc(r)){var n=r;break e}r=r.return}throw Error(s(160))}switch(n.tag){case 5:var i=n.stateNode;32&n.flags&&(de(i,""),n.flags&=-33),oc(e,ic(e),i);break;case 3:case 4:var o=n.stateNode.containerInfo;sc(e,ic(e),o);break;default:throw Error(s(161))}}catch(a){_u(e,e.return,a)}e.flags&=-3}4096&t&&(e.flags&=-4097)}function yc(e,t,r){Qa=e,gc(e,t,r)}function gc(e,t,r){for(var n=0!==(1&e.mode);null!==Qa;){var i=Qa,s=i.child;if(22===i.tag&&n){var o=null!==i.memoizedState||Ga;if(!o){var a=i.alternate,c=null!==a&&null!==a.memoizedState||Wa;a=Ga;var u=Wa;if(Ga=o,(Wa=c)&&!u)for(Qa=i;null!==Qa;)c=(o=Qa).child,22===o.tag&&null!==o.memoizedState?bc(i):null!==c?(c.return=o,Qa=c):bc(i);for(;null!==s;)Qa=s,gc(s,t,r),s=s.sibling;Qa=i,Ga=a,Wa=u}mc(e)}else 0!==(8772&i.subtreeFlags)&&null!==s?(s.return=i,Qa=s):mc(e)}}function mc(e){for(;null!==Qa;){var t=Qa;if(0!==(8772&t.flags)){var r=t.alternate;try{if(0!==(8772&t.flags))switch(t.tag){case 0:case 11:case 15:Wa||ec(5,t);break;case 1:var n=t.stateNode;if(4&t.flags&&!Wa)if(null===r)n.componentDidMount();else{var i=t.elementType===t.type?r.memoizedProps:zi(t.type,r.memoizedProps);n.componentDidUpdate(i,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;null!==o&&us(t,o,n);break;case 3:var a=t.updateQueue;if(null!==a){if(r=null,null!==t.child)switch(t.child.tag){case 5:case 1:r=t.child.stateNode}us(t,a,r)}break;case 5:var c=t.stateNode;if(null===r&&4&t.flags){r=c;var u=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":u.autoFocus&&r.focus();break;case"img":u.src&&(r.src=u.src)}}break;case 6:case 4:case 12:case 19:case 17:case 21:case 22:case 23:break;case 13:if(null===t.memoizedState){var l=t.alternate;if(null!==l){var h=l.memoizedState;if(null!==h){var d=h.dehydrated;null!==d&&Vt(d)}}}break;default:throw Error(s(163))}Wa||512&t.flags&&tc(t)}catch(f){_u(t,t.return,f)}}if(t===e){Qa=null;break}if(null!==(r=t.sibling)){r.return=t.return,Qa=r;break}Qa=t.return}}function vc(e){for(;null!==Qa;){var t=Qa;if(t===e){Qa=null;break}var r=t.sibling;if(null!==r){r.return=t.return,Qa=r;break}Qa=t.return}}function bc(e){for(;null!==Qa;){var t=Qa;try{switch(t.tag){case 0:case 11:case 15:var r=t.return;try{ec(4,t)}catch(c){_u(t,r,c)}break;case 1:var n=t.stateNode;if("function"===typeof n.componentDidMount){var i=t.return;try{n.componentDidMount()}catch(c){_u(t,i,c)}}var s=t.return;try{tc(t)}catch(c){_u(t,s,c)}break;case 5:var o=t.return;try{tc(t)}catch(c){_u(t,o,c)}}}catch(c){_u(t,t.return,c)}if(t===e){Qa=null;break}var a=t.sibling;if(null!==a){a.return=t.return,Qa=a;break}Qa=t.return}}var wc,Ec=Math.ceil,Sc=w.ReactCurrentDispatcher,_c=w.ReactCurrentOwner,Ic=w.ReactCurrentBatchConfig,Tc=0,Ac=null,Cc=null,Rc=0,Pc=0,kc=Ii(0),Oc=0,Bc=null,Nc=0,Dc=0,Lc=0,xc=null,Mc=null,Uc=0,Kc=1/0,jc=null,Fc=!1,Vc=null,qc=null,zc=!1,Hc=null,Gc=0,Wc=0,Yc=null,Qc=-1,Jc=0;function Xc(){return 0!==(6&Tc)?Xe():-1!==Qc?Qc:Qc=Xe()}function $c(e){return 0===(1&e.mode)?1:0!==(2&Tc)&&0!==Rc?Rc&-Rc:null!==qi.transition?(0===Jc&&(Jc=yt()),Jc):0!==(e=bt)?e:e=void 0===(e=window.event)?16:Jt(e.type)}function Zc(e,t,r){if(50<Wc)throw Wc=0,Yc=null,Error(s(185));var n=eu(e,t);return null===n?null:(mt(n,t,r),0!==(2&Tc)&&n===Ac||(n===Ac&&(0===(2&Tc)&&(Dc|=t),4===Oc&&ou(n,Rc)),ru(n,r),1===t&&0===Tc&&0===(1&e.mode)&&(Kc=Xe()+500,Ki&&Vi())),n)}function eu(e,t){e.lanes|=t;var r=e.alternate;for(null!==r&&(r.lanes|=t),r=e,e=e.return;null!==e;)e.childLanes|=t,null!==(r=e.alternate)&&(r.childLanes|=t),r=e,e=e.return;return 3===r.tag?r.stateNode:null}function tu(e){return(null!==Ac||null!==es)&&0!==(1&e.mode)&&0===(2&Tc)}function ru(e,t){var r=e.callbackNode;!function(e,t){for(var r=e.suspendedLanes,n=e.pingedLanes,i=e.expirationTimes,s=e.pendingLanes;0<s;){var o=31-ot(s),a=1<<o,c=i[o];-1===c?0!==(a&r)&&0===(a&n)||(i[o]=ft(a,t)):c<=t&&(e.expiredLanes|=a),s&=~a}}(e,t);var n=dt(e,e===Ac?Rc:0);if(0===n)null!==r&&Ye(r),e.callbackNode=null,e.callbackPriority=0;else if(t=n&-n,e.callbackPriority!==t){if(null!=r&&Ye(r),1===t)0===e.tag?function(e){Ki=!0,Fi(e)}(au.bind(null,e)):Fi(au.bind(null,e)),oi((function(){0===Tc&&Vi()})),r=null;else{switch(wt(n)){case 1:r=Ze;break;case 4:r=et;break;case 16:default:r=tt;break;case 536870912:r=nt}r=Ru(r,nu.bind(null,e))}e.callbackPriority=t,e.callbackNode=r}}function nu(e,t){if(Qc=-1,Jc=0,0!==(6&Tc))throw Error(s(327));var r=e.callbackNode;if(Eu()&&e.callbackNode!==r)return null;var n=dt(e,e===Ac?Rc:0);if(0===n)return null;if(0!==(30&n)||0!==(n&e.expiredLanes)||t)t=yu(e,n);else{t=n;var i=Tc;Tc|=2;var o=fu();for(Ac===e&&Rc===t||(jc=null,Kc=Xe()+500,hu(e,t));;)try{mu();break}catch(c){du(e,c)}Qi(),Sc.current=o,Tc=i,null!==Cc?t=0:(Ac=null,Rc=0,t=Oc)}if(0!==t){if(2===t&&(0!==(i=pt(e))&&(n=i,t=iu(e,i))),1===t)throw r=Bc,hu(e,0),ou(e,n),ru(e,Xe()),r;if(6===t)ou(e,n);else{if(i=e.current.alternate,0===(30&n)&&!function(e){for(var t=e;;){if(16384&t.flags){var r=t.updateQueue;if(null!==r&&null!==(r=r.stores))for(var n=0;n<r.length;n++){var i=r[n],s=i.getSnapshot;i=i.value;try{if(!an(s(),i))return!1}catch(a){return!1}}}if(r=t.child,16384&t.subtreeFlags&&null!==r)r.return=t,t=r;else{if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}(i)&&(2===(t=yu(e,n))&&(0!==(o=pt(e))&&(n=o,t=iu(e,o))),1===t))throw r=Bc,hu(e,0),ou(e,n),ru(e,Xe()),r;switch(e.finishedWork=i,e.finishedLanes=n,t){case 0:case 1:throw Error(s(345));case 2:case 5:wu(e,Mc,jc);break;case 3:if(ou(e,n),(130023424&n)===n&&10<(t=Uc+500-Xe())){if(0!==dt(e,0))break;if(((i=e.suspendedLanes)&n)!==n){Xc(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=ni(wu.bind(null,e,Mc,jc),t);break}wu(e,Mc,jc);break;case 4:if(ou(e,n),(4194240&n)===n)break;for(t=e.eventTimes,i=-1;0<n;){var a=31-ot(n);o=1<<a,(a=t[a])>i&&(i=a),n&=~o}if(n=i,10<(n=(120>(n=Xe()-n)?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*Ec(n/1960))-n)){e.timeoutHandle=ni(wu.bind(null,e,Mc,jc),n);break}wu(e,Mc,jc);break;default:throw Error(s(329))}}}return ru(e,Xe()),e.callbackNode===r?nu.bind(null,e):null}function iu(e,t){var r=xc;return e.current.memoizedState.isDehydrated&&(hu(e,t).flags|=256),2!==(e=yu(e,t))&&(t=Mc,Mc=r,null!==t&&su(t)),e}function su(e){null===Mc?Mc=e:Mc.push.apply(Mc,e)}function ou(e,t){for(t&=~Lc,t&=~Dc,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var r=31-ot(t),n=1<<r;e[r]=-1,t&=~n}}function au(e){if(0!==(6&Tc))throw Error(s(327));Eu();var t=dt(e,0);if(0===(1&t))return ru(e,Xe()),null;var r=yu(e,t);if(0!==e.tag&&2===r){var n=pt(e);0!==n&&(t=n,r=iu(e,n))}if(1===r)throw r=Bc,hu(e,0),ou(e,t),ru(e,Xe()),r;if(6===r)throw Error(s(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,wu(e,Mc,jc),ru(e,Xe()),null}function cu(e,t){var r=Tc;Tc|=1;try{return e(t)}finally{0===(Tc=r)&&(Kc=Xe()+500,Ki&&Vi())}}function uu(e){null!==Hc&&0===Hc.tag&&0===(6&Tc)&&Eu();var t=Tc;Tc|=1;var r=Ic.transition,n=bt;try{if(Ic.transition=null,bt=1,e)return e()}finally{bt=n,Ic.transition=r,0===(6&(Tc=t))&&Vi()}}function lu(){Pc=kc.current,Ti(kc)}function hu(e,t){e.finishedWork=null,e.finishedLanes=0;var r=e.timeoutHandle;if(-1!==r&&(e.timeoutHandle=-1,ii(r)),null!==Cc)for(r=Cc.return;null!==r;){var n=r;switch(Ps(n),n.tag){case 1:null!==(n=n.type.childContextTypes)&&void 0!==n&&Ni();break;case 3:eo(),Ti(Pi),Ti(Ri),oo();break;case 5:ro(n);break;case 4:eo();break;case 13:case 19:Ti(no);break;case 10:Ji(n.type._context);break;case 22:case 23:lu()}r=r.return}if(Ac=e,Cc=e=Bu(e.current,null),Rc=Pc=t,Oc=0,Bc=null,Lc=Dc=Nc=0,Mc=xc=null,null!==es){for(t=0;t<es.length;t++)if(null!==(n=(r=es[t]).interleaved)){r.interleaved=null;var i=n.next,s=r.pending;if(null!==s){var o=s.next;s.next=i,n.next=o}r.pending=n}es=null}return e}function du(e,t){for(;;){var r=Cc;try{if(Qi(),ao.current=ra,po){for(var n=lo.memoizedState;null!==n;){var i=n.queue;null!==i&&(i.pending=null),n=n.next}po=!1}if(uo=0,fo=ho=lo=null,yo=!1,go=0,_c.current=null,null===r||null===r.return){Oc=1,Bc=t,Cc=null;break}e:{var o=e,a=r.return,c=r,u=t;if(t=Rc,c.flags|=32768,null!==u&&"object"===typeof u&&"function"===typeof u.then){var l=u,h=c,d=h.tag;if(0===(1&h.mode)&&(0===d||11===d||15===d)){var f=h.alternate;f?(h.updateQueue=f.updateQueue,h.memoizedState=f.memoizedState,h.lanes=f.lanes):(h.updateQueue=null,h.memoizedState=null)}var p=ya(a);if(null!==p){p.flags&=-257,ga(p,a,c,0,t),1&p.mode&&pa(o,l,t),u=l;var y=(t=p).updateQueue;if(null===y){var g=new Set;g.add(u),t.updateQueue=g}else y.add(u);break e}if(0===(1&t)){pa(o,l,t),pu();break e}u=Error(s(426))}else if(Bs&&1&c.mode){var m=ya(a);if(null!==m){0===(65536&m.flags)&&(m.flags|=256),ga(m,a,c,0,t),Fs(u);break e}}o=u,4!==Oc&&(Oc=2),null===xc?xc=[o]:xc.push(o),u=oa(u,c),c=a;do{switch(c.tag){case 3:c.flags|=65536,t&=-t,c.lanes|=t,as(c,da(0,u,t));break e;case 1:o=u;var v=c.type,b=c.stateNode;if(0===(128&c.flags)&&("function"===typeof v.getDerivedStateFromError||null!==b&&"function"===typeof b.componentDidCatch&&(null===qc||!qc.has(b)))){c.flags|=65536,t&=-t,c.lanes|=t,as(c,fa(c,o,t));break e}}c=c.return}while(null!==c)}bu(r)}catch(w){t=w,Cc===r&&null!==r&&(Cc=r=r.return);continue}break}}function fu(){var e=Sc.current;return Sc.current=ra,null===e?ra:e}function pu(){0!==Oc&&3!==Oc&&2!==Oc||(Oc=4),null===Ac||0===(268435455&Nc)&&0===(268435455&Dc)||ou(Ac,Rc)}function yu(e,t){var r=Tc;Tc|=2;var n=fu();for(Ac===e&&Rc===t||(jc=null,hu(e,t));;)try{gu();break}catch(i){du(e,i)}if(Qi(),Tc=r,Sc.current=n,null!==Cc)throw Error(s(261));return Ac=null,Rc=0,Oc}function gu(){for(;null!==Cc;)vu(Cc)}function mu(){for(;null!==Cc&&!Qe();)vu(Cc)}function vu(e){var t=wc(e.alternate,e,Pc);e.memoizedProps=e.pendingProps,null===t?bu(e):Cc=t,_c.current=null}function bu(e){var t=e;do{var r=t.alternate;if(e=t.return,0===(32768&t.flags)){if(null!==(r=ba(r,t,Pc)))return void(Cc=r)}else{if(null!==(r=Ha(r,t)))return r.flags&=32767,void(Cc=r);if(null===e)return Oc=6,void(Cc=null);e.flags|=32768,e.subtreeFlags=0,e.deletions=null}if(null!==(t=t.sibling))return void(Cc=t);Cc=t=e}while(null!==t);0===Oc&&(Oc=5)}function wu(e,t,r){var n=bt,i=Ic.transition;try{Ic.transition=null,bt=1,function(e,t,r,n){do{Eu()}while(null!==Hc);if(0!==(6&Tc))throw Error(s(327));r=e.finishedWork;var i=e.finishedLanes;if(null===r)return null;if(e.finishedWork=null,e.finishedLanes=0,r===e.current)throw Error(s(177));e.callbackNode=null,e.callbackPriority=0;var o=r.lanes|r.childLanes;if(function(e,t){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var n=e.eventTimes;for(e=e.expirationTimes;0<r;){var i=31-ot(r),s=1<<i;t[i]=0,n[i]=-1,e[i]=-1,r&=~s}}(e,o),e===Ac&&(Cc=Ac=null,Rc=0),0===(2064&r.subtreeFlags)&&0===(2064&r.flags)||zc||(zc=!0,Ru(tt,(function(){return Eu(),null}))),o=0!==(15990&r.flags),0!==(15990&r.subtreeFlags)||o){o=Ic.transition,Ic.transition=null;var a=bt;bt=1;var c=Tc;Tc|=4,_c.current=null,function(e,t){if(ei=zt,fn(e=dn())){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{var n=(r=(r=e.ownerDocument)&&r.defaultView||window).getSelection&&r.getSelection();if(n&&0!==n.rangeCount){r=n.anchorNode;var i=n.anchorOffset,o=n.focusNode;n=n.focusOffset;try{r.nodeType,o.nodeType}catch(S){r=null;break e}var a=0,c=-1,u=-1,l=0,h=0,d=e,f=null;t:for(;;){for(var p;d!==r||0!==i&&3!==d.nodeType||(c=a+i),d!==o||0!==n&&3!==d.nodeType||(u=a+n),3===d.nodeType&&(a+=d.nodeValue.length),null!==(p=d.firstChild);)f=d,d=p;for(;;){if(d===e)break t;if(f===r&&++l===i&&(c=a),f===o&&++h===n&&(u=a),null!==(p=d.nextSibling))break;f=(d=f).parentNode}d=p}r=-1===c||-1===u?null:{start:c,end:u}}else r=null}r=r||{start:0,end:0}}else r=null;for(ti={focusedElem:e,selectionRange:r},zt=!1,Qa=t;null!==Qa;)if(e=(t=Qa).child,0!==(1028&t.subtreeFlags)&&null!==e)e.return=t,Qa=e;else for(;null!==Qa;){t=Qa;try{var y=t.alternate;if(0!==(1024&t.flags))switch(t.tag){case 0:case 11:case 15:case 5:case 6:case 4:case 17:break;case 1:if(null!==y){var g=y.memoizedProps,m=y.memoizedState,v=t.stateNode,b=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:zi(t.type,g),m);v.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var w=t.stateNode.containerInfo;if(1===w.nodeType)w.textContent="";else if(9===w.nodeType){var E=w.body;null!=E&&(E.textContent="")}break;default:throw Error(s(163))}}catch(S){_u(t,t.return,S)}if(null!==(e=t.sibling)){e.return=t.return,Qa=e;break}Qa=t.return}y=$a,$a=!1}(e,r),fc(r,e),pn(ti),zt=!!ei,ti=ei=null,e.current=r,yc(r,e,i),Je(),Tc=c,bt=a,Ic.transition=o}else e.current=r;if(zc&&(zc=!1,Hc=e,Gc=i),0===(o=e.pendingLanes)&&(qc=null),function(e){if(st&&"function"===typeof st.onCommitFiberRoot)try{st.onCommitFiberRoot(it,e,void 0,128===(128&e.current.flags))}catch(t){}}(r.stateNode),ru(e,Xe()),null!==t)for(n=e.onRecoverableError,r=0;r<t.length;r++)n(t[r]);if(Fc)throw Fc=!1,e=Vc,Vc=null,e;0!==(1&Gc)&&0!==e.tag&&Eu(),0!==(1&(o=e.pendingLanes))?e===Yc?Wc++:(Wc=0,Yc=e):Wc=0,Vi()}(e,t,r,n)}finally{Ic.transition=i,bt=n}return null}function Eu(){if(null!==Hc){var e=wt(Gc),t=Ic.transition,r=bt;try{if(Ic.transition=null,bt=16>e?16:e,null===Hc)var n=!1;else{if(e=Hc,Hc=null,Gc=0,0!==(6&Tc))throw Error(s(331));var i=Tc;for(Tc|=4,Qa=e.current;null!==Qa;){var o=Qa,a=o.child;if(0!==(16&Qa.flags)){var c=o.deletions;if(null!==c){for(var u=0;u<c.length;u++){var l=c[u];for(Qa=l;null!==Qa;){var h=Qa;switch(h.tag){case 0:case 11:case 15:Za(8,h,o)}var d=h.child;if(null!==d)d.return=h,Qa=d;else for(;null!==Qa;){var f=(h=Qa).sibling,p=h.return;if(rc(h),h===l){Qa=null;break}if(null!==f){f.return=p,Qa=f;break}Qa=p}}}var y=o.alternate;if(null!==y){var g=y.child;if(null!==g){y.child=null;do{var m=g.sibling;g.sibling=null,g=m}while(null!==g)}}Qa=o}}if(0!==(2064&o.subtreeFlags)&&null!==a)a.return=o,Qa=a;else e:for(;null!==Qa;){if(0!==(2048&(o=Qa).flags))switch(o.tag){case 0:case 11:case 15:Za(9,o,o.return)}var v=o.sibling;if(null!==v){v.return=o.return,Qa=v;break e}Qa=o.return}}var b=e.current;for(Qa=b;null!==Qa;){var w=(a=Qa).child;if(0!==(2064&a.subtreeFlags)&&null!==w)w.return=a,Qa=w;else e:for(a=b;null!==Qa;){if(0!==(2048&(c=Qa).flags))try{switch(c.tag){case 0:case 11:case 15:ec(9,c)}}catch(S){_u(c,c.return,S)}if(c===a){Qa=null;break e}var E=c.sibling;if(null!==E){E.return=c.return,Qa=E;break e}Qa=c.return}}if(Tc=i,Vi(),st&&"function"===typeof st.onPostCommitFiberRoot)try{st.onPostCommitFiberRoot(it,e)}catch(S){}n=!0}return n}finally{bt=r,Ic.transition=t}}return!1}function Su(e,t,r){ss(e,t=da(0,t=oa(r,t),1)),t=Xc(),null!==(e=eu(e,1))&&(mt(e,1,t),ru(e,t))}function _u(e,t,r){if(3===e.tag)Su(e,e,r);else for(;null!==t;){if(3===t.tag){Su(t,e,r);break}if(1===t.tag){var n=t.stateNode;if("function"===typeof t.type.getDerivedStateFromError||"function"===typeof n.componentDidCatch&&(null===qc||!qc.has(n))){ss(t,e=fa(t,e=oa(r,e),1)),e=Xc(),null!==(t=eu(t,1))&&(mt(t,1,e),ru(t,e));break}}t=t.return}}function Iu(e,t,r){var n=e.pingCache;null!==n&&n.delete(t),t=Xc(),e.pingedLanes|=e.suspendedLanes&r,Ac===e&&(Rc&r)===r&&(4===Oc||3===Oc&&(130023424&Rc)===Rc&&500>Xe()-Uc?hu(e,0):Lc|=r),ru(e,t)}function Tu(e,t){0===t&&(0===(1&e.mode)?t=1:(t=lt,0===(130023424&(lt<<=1))&&(lt=4194304)));var r=Xc();null!==(e=eu(e,t))&&(mt(e,t,r),ru(e,r))}function Au(e){var t=e.memoizedState,r=0;null!==t&&(r=t.retryLane),Tu(e,r)}function Cu(e,t){var r=0;switch(e.tag){case 13:var n=e.stateNode,i=e.memoizedState;null!==i&&(r=i.retryLane);break;case 19:n=e.stateNode;break;default:throw Error(s(314))}null!==n&&n.delete(t),Tu(e,r)}function Ru(e,t){return We(e,t)}function Pu(e,t,r,n){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ku(e,t,r,n){return new Pu(e,t,r,n)}function Ou(e){return!(!(e=e.prototype)||!e.isReactComponent)}function Bu(e,t){var r=e.alternate;return null===r?((r=ku(e.tag,t,e.key,e.mode)).elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=14680064&e.flags,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function Nu(e,t,r,n,i,o){var a=2;if(n=e,"function"===typeof e)Ou(e)&&(a=1);else if("string"===typeof e)a=5;else e:switch(e){case _:return Du(r.children,i,o,t);case I:a=8,i|=8;break;case T:return(e=ku(12,r,t,2|i)).elementType=T,e.lanes=o,e;case P:return(e=ku(13,r,t,i)).elementType=P,e.lanes=o,e;case k:return(e=ku(19,r,t,i)).elementType=k,e.lanes=o,e;case N:return Lu(r,i,o,t);default:if("object"===typeof e&&null!==e)switch(e.$$typeof){case A:a=10;break e;case C:a=9;break e;case R:a=11;break e;case O:a=14;break e;case B:a=16,n=null;break e}throw Error(s(130,null==e?e:typeof e,""))}return(t=ku(a,r,t,i)).elementType=e,t.type=n,t.lanes=o,t}function Du(e,t,r,n){return(e=ku(7,e,n,t)).lanes=r,e}function Lu(e,t,r,n){return(e=ku(22,e,n,t)).elementType=N,e.lanes=r,e.stateNode={},e}function xu(e,t,r){return(e=ku(6,e,null,t)).lanes=r,e}function Mu(e,t,r){return(t=ku(4,null!==e.children?e.children:[],e.key,t)).lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Uu(e,t,r,n,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=gt(0),this.expirationTimes=gt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gt(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Ku(e,t,r,n,i,s,o,a,c){return e=new Uu(e,t,r,a,c),1===t?(t=1,!0===s&&(t|=8)):t=0,s=ku(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},rs(s),e}function ju(e,t,r){var n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:S,key:null==n?null:""+n,children:e,containerInfo:t,implementation:r}}function Fu(e){if(!e)return Ci;e:{if(Ve(e=e._reactInternals)!==e||1!==e.tag)throw Error(s(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Bi(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(null!==t);throw Error(s(171))}if(1===e.tag){var r=e.type;if(Bi(r))return Li(e,r,t)}return t}function Vu(e,t,r,n,i,s,o,a,c){return(e=Ku(r,n,!0,e,0,s,0,a,c)).context=Fu(null),r=e.current,(s=is(n=Xc(),i=$c(r))).callback=void 0!==t&&null!==t?t:null,ss(r,s),e.current.lanes=i,mt(e,i,n),ru(e,n),e}function qu(e,t,r,n){var i=t.current,s=Xc(),o=$c(i);return r=Fu(r),null===t.context?t.context=r:t.pendingContext=r,(t=is(s,o)).payload={element:e},null!==(n=void 0===n?null:n)&&(t.callback=n),ss(i,t),null!==(e=Zc(i,o,s))&&os(e,i,o),o}function zu(e){return(e=e.current).child?(e.child.tag,e.child.stateNode):null}function Hu(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var r=e.retryLane;e.retryLane=0!==r&&r<t?r:t}}function Gu(e,t){Hu(e,t),(e=e.alternate)&&Hu(e,t)}wc=function(e,t,r){if(null!==e)if(e.memoizedProps!==t.pendingProps||Pi.current)Ea=!0;else{if(0===(e.lanes&r)&&0===(128&t.flags))return Ea=!1,function(e,t,r){switch(t.tag){case 3:Oa(t),js();break;case 5:to(t);break;case 1:Bi(t.type)&&xi(t);break;case 4:Zs(t,t.stateNode.containerInfo);break;case 10:var n=t.type._context,i=t.memoizedProps.value;Ai(Hi,n._currentValue),n._currentValue=i;break;case 13:if(null!==(n=t.memoizedState))return null!==n.dehydrated?(Ai(no,1&no.current),t.flags|=128,null):0!==(r&t.child.childLanes)?xa(e,t,r):(Ai(no,1&no.current),null!==(e=za(e,t,r))?e.sibling:null);Ai(no,1&no.current);break;case 19:if(n=0!==(r&t.childLanes),0!==(128&e.flags)){if(n)return qa(e,t,r);t.flags|=128}if(null!==(i=t.memoizedState)&&(i.rendering=null,i.tail=null,i.lastEffect=null),Ai(no,no.current),n)break;return null;case 22:case 23:return t.lanes=0,Aa(e,t,r)}return za(e,t,r)}(e,t,r);Ea=0!==(131072&e.flags)}else Ea=!1,Bs&&0!==(1048576&t.flags)&&Cs(t,ws,t.index);switch(t.lanes=0,t.tag){case 2:var n=t.type;null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),e=t.pendingProps;var i=Oi(t,Ri.current);$i(t,r),i=wo(null,t,n,e,i,r);var o=Eo();return t.flags|=1,"object"===typeof i&&null!==i&&"function"===typeof i.render&&void 0===i.$$typeof?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Bi(n)?(o=!0,xi(t)):o=!1,t.memoizedState=null!==i.state&&void 0!==i.state?i.state:null,rs(t),i.updater=ds,t.stateNode=i,i._reactInternals=t,gs(t,n,e,r),t=ka(null,t,n,!0,o,r)):(t.tag=0,Bs&&o&&Rs(t),Sa(null,t,i,r),t=t.child),t;case 16:n=t.elementType;e:{switch(null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),e=t.pendingProps,n=(i=n._init)(n._payload),t.type=n,i=t.tag=function(e){if("function"===typeof e)return Ou(e)?1:0;if(void 0!==e&&null!==e){if((e=e.$$typeof)===R)return 11;if(e===O)return 14}return 2}(n),e=zi(n,e),i){case 0:t=Ra(null,t,n,e,r);break e;case 1:t=Pa(null,t,n,e,r);break e;case 11:t=_a(null,t,n,e,r);break e;case 14:t=Ia(null,t,n,zi(n.type,e),r);break e}throw Error(s(306,n,""))}return t;case 0:return n=t.type,i=t.pendingProps,Ra(e,t,n,i=t.elementType===n?i:zi(n,i),r);case 1:return n=t.type,i=t.pendingProps,Pa(e,t,n,i=t.elementType===n?i:zi(n,i),r);case 3:e:{if(Oa(t),null===e)throw Error(s(387));n=t.pendingProps,i=(o=t.memoizedState).element,ns(e,t),cs(t,n,null,r);var a=t.memoizedState;if(n=a.element,o.isDehydrated){if(o={element:n,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=o,t.memoizedState=o,256&t.flags){t=Ba(e,t,n,r,i=Error(s(423)));break e}if(n!==i){t=Ba(e,t,n,r,i=Error(s(424)));break e}for(Os=ui(t.stateNode.containerInfo.firstChild),ks=t,Bs=!0,Ns=null,r=Ws(t,null,n,r),t.child=r;r;)r.flags=-3&r.flags|4096,r=r.sibling}else{if(js(),n===i){t=za(e,t,r);break e}Sa(e,t,n,r)}t=t.child}return t;case 5:return to(t),null===e&&Ms(t),n=t.type,i=t.pendingProps,o=null!==e?e.memoizedProps:null,a=i.children,ri(n,i)?a=null:null!==o&&ri(n,o)&&(t.flags|=32),Ca(e,t),Sa(e,t,a,r),t.child;case 6:return null===e&&Ms(t),null;case 13:return xa(e,t,r);case 4:return Zs(t,t.stateNode.containerInfo),n=t.pendingProps,null===e?t.child=Gs(t,null,n,r):Sa(e,t,n,r),t.child;case 11:return n=t.type,i=t.pendingProps,_a(e,t,n,i=t.elementType===n?i:zi(n,i),r);case 7:return Sa(e,t,t.pendingProps,r),t.child;case 8:case 12:return Sa(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(n=t.type._context,i=t.pendingProps,o=t.memoizedProps,a=i.value,Ai(Hi,n._currentValue),n._currentValue=a,null!==o)if(an(o.value,a)){if(o.children===i.children&&!Pi.current){t=za(e,t,r);break e}}else for(null!==(o=t.child)&&(o.return=t);null!==o;){var c=o.dependencies;if(null!==c){a=o.child;for(var u=c.firstContext;null!==u;){if(u.context===n){if(1===o.tag){(u=is(-1,r&-r)).tag=2;var l=o.updateQueue;if(null!==l){var h=(l=l.shared).pending;null===h?u.next=u:(u.next=h.next,h.next=u),l.pending=u}}o.lanes|=r,null!==(u=o.alternate)&&(u.lanes|=r),Xi(o.return,r,t),c.lanes|=r;break}u=u.next}}else if(10===o.tag)a=o.type===t.type?null:o.child;else if(18===o.tag){if(null===(a=o.return))throw Error(s(341));a.lanes|=r,null!==(c=a.alternate)&&(c.lanes|=r),Xi(a,r,t),a=o.sibling}else a=o.child;if(null!==a)a.return=o;else for(a=o;null!==a;){if(a===t){a=null;break}if(null!==(o=a.sibling)){o.return=a.return,a=o;break}a=a.return}o=a}Sa(e,t,i.children,r),t=t.child}return t;case 9:return i=t.type,n=t.pendingProps.children,$i(t,r),n=n(i=Zi(i)),t.flags|=1,Sa(e,t,n,r),t.child;case 14:return i=zi(n=t.type,t.pendingProps),Ia(e,t,n,i=zi(n.type,i),r);case 15:return Ta(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:zi(n,i),null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),t.tag=1,Bi(n)?(e=!0,xi(t)):e=!1,$i(t,r),ps(t,n,i),gs(t,n,i,r),ka(null,t,n,!0,e,r);case 19:return qa(e,t,r);case 22:return Aa(e,t,r)}throw Error(s(156,t.tag))};var Wu="function"===typeof reportError?reportError:function(e){console.error(e)};function Yu(e){this._internalRoot=e}function Qu(e){this._internalRoot=e}function Ju(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType)}function Xu(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType&&(8!==e.nodeType||" react-mount-point-unstable "!==e.nodeValue))}function $u(){}function Zu(e,t,r,n,i){var s=r._reactRootContainer;if(s){var o=s;if("function"===typeof i){var a=i;i=function(){var e=zu(o);a.call(e)}}qu(t,o,e,i)}else o=function(e,t,r,n,i){if(i){if("function"===typeof n){var s=n;n=function(){var e=zu(o);s.call(e)}}var o=Vu(t,n,e,0,null,!1,0,"",$u);return e._reactRootContainer=o,e[pi]=o.current,Vn(8===e.nodeType?e.parentNode:e),uu(),o}for(;i=e.lastChild;)e.removeChild(i);if("function"===typeof n){var a=n;n=function(){var e=zu(c);a.call(e)}}var c=Ku(e,0,!1,null,0,!1,0,"",$u);return e._reactRootContainer=c,e[pi]=c.current,Vn(8===e.nodeType?e.parentNode:e),uu((function(){qu(t,c,r,n)})),c}(r,t,e,i,n);return zu(o)}Qu.prototype.render=Yu.prototype.render=function(e){var t=this._internalRoot;if(null===t)throw Error(s(409));qu(e,t,null,null)},Qu.prototype.unmount=Yu.prototype.unmount=function(){var e=this._internalRoot;if(null!==e){this._internalRoot=null;var t=e.containerInfo;uu((function(){qu(null,e,null,null)})),t[pi]=null}},Qu.prototype.unstable_scheduleHydration=function(e){if(e){var t=It();e={blockedOn:null,target:e,priority:t};for(var r=0;r<Nt.length&&0!==t&&t<Nt[r].priority;r++);Nt.splice(r,0,e),0===r&&Mt(e)}},Et=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var r=ht(t.pendingLanes);0!==r&&(vt(t,1|r),ru(t,Xe()),0===(6&Tc)&&(Kc=Xe()+500,Vi()))}break;case 13:var n=Xc();uu((function(){return Zc(e,1,n)})),Gu(e,1)}},St=function(e){13===e.tag&&(Zc(e,134217728,Xc()),Gu(e,134217728))},_t=function(e){if(13===e.tag){var t=Xc(),r=$c(e);Zc(e,r,t),Gu(e,r)}},It=function(){return bt},Tt=function(e,t){var r=bt;try{return bt=e,t()}finally{bt=r}},Se=function(e,t,r){switch(t){case"input":if($(e,r),t=r.name,"radio"===r.type&&null!=t){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<r.length;t++){var n=r[t];if(n!==e&&n.form===e.form){var i=Ei(n);if(!i)throw Error(s(90));W(n),$(n,i)}}}break;case"textarea":se(e,r);break;case"select":null!=(t=r.value)&&re(e,!!r.multiple,t,!1)}},Re=cu,Pe=uu;var el={usingClientEntryPoint:!1,Events:[bi,wi,Ei,Ae,Ce,cu]},tl={findFiberByHostInstance:vi,bundleType:0,version:"18.1.0",rendererPackageName:"react-dom"},rl={bundleType:tl.bundleType,version:tl.version,rendererPackageName:tl.rendererPackageName,rendererConfig:tl.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:w.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return null===(e=He(e))?null:e.stateNode},findFiberByHostInstance:tl.findFiberByHostInstance||function(){return null},findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.1.0-next-22edb9f77-20220426"};if("undefined"!==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var nl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!nl.isDisabled&&nl.supportsFiber)try{it=nl.inject(rl),st=nl}catch(le){}}t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=el,t.createPortal=function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!Ju(t))throw Error(s(200));return ju(e,t,null,r)},t.createRoot=function(e,t){if(!Ju(e))throw Error(s(299));var r=!1,n="",i=Wu;return null!==t&&void 0!==t&&(!0===t.unstable_strictMode&&(r=!0),void 0!==t.identifierPrefix&&(n=t.identifierPrefix),void 0!==t.onRecoverableError&&(i=t.onRecoverableError)),t=Ku(e,1,!1,null,0,r,0,n,i),e[pi]=t.current,Vn(8===e.nodeType?e.parentNode:e),new Yu(t)},t.findDOMNode=function(e){if(null==e)return null;if(1===e.nodeType)return e;var t=e._reactInternals;if(void 0===t){if("function"===typeof e.render)throw Error(s(188));throw e=Object.keys(e).join(","),Error(s(268,e))}return e=null===(e=He(t))?null:e.stateNode},t.flushSync=function(e){return uu(e)},t.hydrate=function(e,t,r){if(!Xu(t))throw Error(s(200));return Zu(null,e,t,!0,r)},t.hydrateRoot=function(e,t,r){if(!Ju(e))throw Error(s(405));var n=null!=r&&r.hydratedSources||null,i=!1,o="",a=Wu;if(null!==r&&void 0!==r&&(!0===r.unstable_strictMode&&(i=!0),void 0!==r.identifierPrefix&&(o=r.identifierPrefix),void 0!==r.onRecoverableError&&(a=r.onRecoverableError)),t=Vu(t,null,e,1,null!=r?r:null,i,0,o,a),e[pi]=t.current,Vn(e),n)for(e=0;e<n.length;e++)i=(i=(r=n[e])._getVersion)(r._source),null==t.mutableSourceEagerHydrationData?t.mutableSourceEagerHydrationData=[r,i]:t.mutableSourceEagerHydrationData.push(r,i);return new Qu(t)},t.render=function(e,t,r){if(!Xu(t))throw Error(s(200));return Zu(null,e,t,!1,r)},t.unmountComponentAtNode=function(e){if(!Xu(e))throw Error(s(40));return!!e._reactRootContainer&&(uu((function(){Zu(null,null,e,!1,(function(){e._reactRootContainer=null,e[pi]=null}))})),!0)},t.unstable_batchedUpdates=cu,t.unstable_renderSubtreeIntoContainer=function(e,t,r,n){if(!Xu(r))throw Error(s(200));if(null==e||void 0===e._reactInternals)throw Error(s(38));return Zu(e,t,r,!1,n)},t.version="18.1.0-next-22edb9f77-20220426"},54164:(e,t,r)=>{"use strict";!function e(){if("undefined"!==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"===typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}(),e.exports=r(34463)},66374:(e,t,r)=>{"use strict";var n=r(72791),i=Symbol.for("react.element"),s=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,a=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function u(e,t,r){var n,s={},u=null,l=null;for(n in void 0!==r&&(u=""+r),void 0!==t.key&&(u=""+t.key),void 0!==t.ref&&(l=t.ref),t)o.call(t,n)&&!c.hasOwnProperty(n)&&(s[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps)void 0===s[n]&&(s[n]=t[n]);return{$$typeof:i,type:e,key:u,ref:l,props:s,_owner:a.current}}t.jsx=u,t.jsxs=u},59117:(e,t)=>{"use strict";var r=Symbol.for("react.element"),n=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),f=Symbol.iterator;var p={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y=Object.assign,g={};function m(e,t,r){this.props=e,this.context=t,this.refs=g,this.updater=r||p}function v(){}function b(e,t,r){this.props=e,this.context=t,this.refs=g,this.updater=r||p}m.prototype.isReactComponent={},m.prototype.setState=function(e,t){if("object"!==typeof e&&"function"!==typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},m.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},v.prototype=m.prototype;var w=b.prototype=new v;w.constructor=b,y(w,m.prototype),w.isPureReactComponent=!0;var E=Array.isArray,S=Object.prototype.hasOwnProperty,_={current:null},I={key:!0,ref:!0,__self:!0,__source:!0};function T(e,t,n){var i,s={},o=null,a=null;if(null!=t)for(i in void 0!==t.ref&&(a=t.ref),void 0!==t.key&&(o=""+t.key),t)S.call(t,i)&&!I.hasOwnProperty(i)&&(s[i]=t[i]);var c=arguments.length-2;if(1===c)s.children=n;else if(1<c){for(var u=Array(c),l=0;l<c;l++)u[l]=arguments[l+2];s.children=u}if(e&&e.defaultProps)for(i in c=e.defaultProps)void 0===s[i]&&(s[i]=c[i]);return{$$typeof:r,type:e,key:o,ref:a,props:s,_owner:_.current}}function A(e){return"object"===typeof e&&null!==e&&e.$$typeof===r}var C=/\/+/g;function R(e,t){return"object"===typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,(function(e){return t[e]}))}(""+e.key):t.toString(36)}function P(e,t,i,s,o){var a=typeof e;"undefined"!==a&&"boolean"!==a||(e=null);var c=!1;if(null===e)c=!0;else switch(a){case"string":case"number":c=!0;break;case"object":switch(e.$$typeof){case r:case n:c=!0}}if(c)return o=o(c=e),e=""===s?"."+R(c,0):s,E(o)?(i="",null!=e&&(i=e.replace(C,"$&/")+"/"),P(o,t,i,"",(function(e){return e}))):null!=o&&(A(o)&&(o=function(e,t){return{$$typeof:r,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(o,i+(!o.key||c&&c.key===o.key?"":(""+o.key).replace(C,"$&/")+"/")+e)),t.push(o)),1;if(c=0,s=""===s?".":s+":",E(e))for(var u=0;u<e.length;u++){var l=s+R(a=e[u],u);c+=P(a,t,i,l,o)}else if(l=function(e){return null===e||"object"!==typeof e?null:"function"===typeof(e=f&&e[f]||e["@@iterator"])?e:null}(e),"function"===typeof l)for(e=l.call(e),u=0;!(a=e.next()).done;)c+=P(a=a.value,t,i,l=s+R(a,u++),o);else if("object"===a)throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return c}function k(e,t,r){if(null==e)return e;var n=[],i=0;return P(e,n,"","",(function(e){return t.call(r,e,i++)})),n}function O(e){if(-1===e._status){var t=e._result;(t=t()).then((function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)}),(function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)})),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var B={current:null},N={transition:null},D={ReactCurrentDispatcher:B,ReactCurrentBatchConfig:N,ReactCurrentOwner:_};t.Children={map:k,forEach:function(e,t,r){k(e,(function(){t.apply(this,arguments)}),r)},count:function(e){var t=0;return k(e,(function(){t++})),t},toArray:function(e){return k(e,(function(e){return e}))||[]},only:function(e){if(!A(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},t.Component=m,t.Fragment=i,t.Profiler=o,t.PureComponent=b,t.StrictMode=s,t.Suspense=l,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=D,t.cloneElement=function(e,t,n){if(null===e||void 0===e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var i=y({},e.props),s=e.key,o=e.ref,a=e._owner;if(null!=t){if(void 0!==t.ref&&(o=t.ref,a=_.current),void 0!==t.key&&(s=""+t.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(u in t)S.call(t,u)&&!I.hasOwnProperty(u)&&(i[u]=void 0===t[u]&&void 0!==c?c[u]:t[u])}var u=arguments.length-2;if(1===u)i.children=n;else if(1<u){c=Array(u);for(var l=0;l<u;l++)c[l]=arguments[l+2];i.children=c}return{$$typeof:r,type:e.type,key:s,ref:o,props:i,_owner:a}},t.createContext=function(e){return(e={$$typeof:c,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:a,_context:e},e.Consumer=e},t.createElement=T,t.createFactory=function(e){var t=T.bind(null,e);return t.type=e,t},t.createRef=function(){return{current:null}},t.forwardRef=function(e){return{$$typeof:u,render:e}},t.isValidElement=A,t.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:O}},t.memo=function(e,t){return{$$typeof:h,type:e,compare:void 0===t?null:t}},t.startTransition=function(e){var t=N.transition;N.transition={};try{e()}finally{N.transition=t}},t.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")},t.useCallback=function(e,t){return B.current.useCallback(e,t)},t.useContext=function(e){return B.current.useContext(e)},t.useDebugValue=function(){},t.useDeferredValue=function(e){return B.current.useDeferredValue(e)},t.useEffect=function(e,t){return B.current.useEffect(e,t)},t.useId=function(){return B.current.useId()},t.useImperativeHandle=function(e,t,r){return B.current.useImperativeHandle(e,t,r)},t.useInsertionEffect=function(e,t){return B.current.useInsertionEffect(e,t)},t.useLayoutEffect=function(e,t){return B.current.useLayoutEffect(e,t)},t.useMemo=function(e,t){return B.current.useMemo(e,t)},t.useReducer=function(e,t,r){return B.current.useReducer(e,t,r)},t.useRef=function(e){return B.current.useRef(e)},t.useState=function(e){return B.current.useState(e)},t.useSyncExternalStore=function(e,t,r){return B.current.useSyncExternalStore(e,t,r)},t.useTransition=function(){return B.current.useTransition()},t.version="18.1.0"},72791:(e,t,r)=>{"use strict";e.exports=r(59117)},80184:(e,t,r)=>{"use strict";e.exports=r(66374)},449:(e,t,r)=>{"use strict";e.exports=o;var n=r(78193),i=o.prototype,s=new Date%1e9;function o(e){e=e||{},this.id=e.id||(1e9*Math.random()>>>0)+s++,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}}},31779:(e,t,r)=>{"use strict";const n=r(36222);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<e.length;t++)e[t]=arguments[t+2]}return new i(arguments[0],arguments[1],e)}},36222:e=>{"use strict";e.exports=function(){return Date.now()}},99158:(e,t,r)=>{e.exports=r(95509)},95509:(e,t,r)=>{var n=r(1500);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<t.retries;i++)n.push(this.createTimeout(i,t));return e&&e.forever&&!n.length&&n.push(this.createTimeout(i,t)),n.sort((function(e,t){return e-t})),n},t.createTimeout=function(e,t){var r=t.randomize?Math.random()+1:1,n=Math.round(r*Math.max(t.minTimeout,1)*Math.pow(t.factor,e));return n=Math.min(n,t.maxTimeout)},t.wrap=function(e,r,n){if(r instanceof Array&&(n=r,r=null),!n)for(var i in n=[],e)"function"===typeof e[i]&&n.push(i);for(var s=0;s<n.length;s++){var o=n[s],a=e[o];e[o]=function(n){var i=t.operation(r),s=Array.prototype.slice.call(arguments,1),o=s.pop();s.push((function(e){i.retry(e)||(e&&(arguments[0]=i.mainError()),o.apply(this,arguments))})),i.attempt((function(){n.apply(e,s)}))}.bind(e,a),e[o].options=r}}},1500:e=>{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<this._errors.length;n++){var i=this._errors[n],s=i.message,o=(e[s]||0)+1;e[s]=o,o>=r&&(t=i,r=o)}return t}},6327:(e,t,r)=>{"use strict";var n=r(60206),i=/[\/\?<>\\:\*\|"]/g,s=/[\x00-\x1f\x80-\x9f]/g,o=/^\.+$/,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(s,t).replace(o,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,"")}},36813:(e,t)=>{"use strict";function r(e,t){var r=e.length;e.push(t);e:for(;0<r;){var n=r-1>>>1,i=e[n];if(!(0<s(i,t)))break e;e[n]=t,e[r]=i,r=n}}function n(e){return 0===e.length?null:e[0]}function i(e){if(0===e.length)return null;var t=e[0],r=e.pop();if(r!==t){e[0]=r;e:for(var n=0,i=e.length,o=i>>>1;n<o;){var a=2*(n+1)-1,c=e[a],u=a+1,l=e[u];if(0>s(c,r))u<i&&0>s(l,c)?(e[n]=l,e[u]=r,n=u):(e[n]=c,e[a]=r,n=a);else{if(!(u<i&&0>s(l,r)))break e;e[n]=l,e[u]=r,n=u}}}return t}function s(e,t){var r=e.sortIndex-t.sortIndex;return 0!==r?r:e.id-t.id}if("object"===typeof performance&&"function"===typeof performance.now){var o=performance;t.unstable_now=function(){return o.now()}}else{var a=Date,c=a.now();t.unstable_now=function(){return a.now()-c}}var u=[],l=[],h=1,d=null,f=3,p=!1,y=!1,g=!1,m="function"===typeof setTimeout?setTimeout:null,v="function"===typeof clearTimeout?clearTimeout:null,b="undefined"!==typeof setImmediate?setImmediate:null;function w(e){for(var t=n(l);null!==t;){if(null===t.callback)i(l);else{if(!(t.startTime<=e))break;i(l),t.sortIndex=t.expirationTime,r(u,t)}t=n(l)}}function E(e){if(g=!1,w(e),!y)if(null!==n(u))y=!0,N(S);else{var t=n(l);null!==t&&D(E,t.startTime-e)}}function S(e,r){y=!1,g&&(g=!1,v(A),A=-1),p=!0;var s=f;try{for(w(r),d=n(u);null!==d&&(!(d.expirationTime>r)||e&&!P());){var o=d.callback;if("function"===typeof o){d.callback=null,f=d.priorityLevel;var a=o(d.expirationTime<=r);r=t.unstable_now(),"function"===typeof a?d.callback=a:d===n(u)&&i(u),w(r)}else i(u);d=n(u)}if(null!==d)var c=!0;else{var h=n(l);null!==h&&D(E,h.startTime-r),c=!1}return c}finally{d=null,f=s,p=!1}}"undefined"!==typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var _,I=!1,T=null,A=-1,C=5,R=-1;function P(){return!(t.unstable_now()-R<C)}function k(){if(null!==T){var e=t.unstable_now();R=e;var r=!0;try{r=T(!0,e)}finally{r?_():(I=!1,T=null)}}else I=!1}if("function"===typeof b)_=function(){b(k)};else if("undefined"!==typeof MessageChannel){var O=new MessageChannel,B=O.port2;O.port1.onmessage=k,_=function(){B.postMessage(null)}}else _=function(){m(k,0)};function N(e){T=e,I||(I=!0,_())}function D(e,r){A=m((function(){e(t.unstable_now())}),r)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){y||p||(y=!0,N(S))},t.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):C=0<e?Math.floor(1e3/e):5},t.unstable_getCurrentPriorityLevel=function(){return f},t.unstable_getFirstCallbackNode=function(){return n(u)},t.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var r=f;f=t;try{return e()}finally{f=r}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var r=f;f=e;try{return t()}finally{f=r}},t.unstable_scheduleCallback=function(e,i,s){var o=t.unstable_now();switch("object"===typeof s&&null!==s?s="number"===typeof(s=s.delay)&&0<s?o+s:o:s=o,e){case 1:var a=-1;break;case 2:a=250;break;case 5:a=1073741823;break;case 4:a=1e4;break;default:a=5e3}return e={id:h++,callback:i,priorityLevel:e,startTime:s,expirationTime:a=s+a,sortIndex:-1},s>o?(e.sortIndex=s,r(l,e),null===n(u)&&e===n(l)&&(g?(v(A),A=-1):g=!0,D(E,s-o))):(e.sortIndex=a,r(u,e),y||p||(y=!0,N(S))),e},t.unstable_shouldYield=P,t.unstable_wrapCallback=function(e){var t=f;return function(){var r=f;f=t;try{return e.apply(this,arguments)}finally{f=r}}}},45296:(e,t,r)=>{"use strict";e.exports=r(36813)},18928:e=>{"use strict";const t=new Map;e.exports={setDelayedInterval:function(e,r,n){n=n||r;const i="".concat(Date.now(),":").concat(Math.floor(1e6*Math.random())),s=setTimeout((()=>{!async function(e,r,n){for(;t.get(n);){try{await e()}catch(i){setTimeout((()=>{throw i}),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,s),i},clearDelayedInterval:function(e){const r=t.get(e);r&&(clearTimeout(r),t.delete(e))}}},79755:function(e,t,r){var n=r(21964);!function(e){"use strict";async function*t(e,t){let r=[];for await(const n of t)r.push(n),r.length===e&&(yield r,r=[]);r.length>0&&(yield r)}function*r(e,t){let r=[];for(const n of t)r.push(n),r.length===e&&(yield r,r=[]);r.length>0&&(yield r)}function i(e,n){return void 0===n?t=>i(e,t):n[Symbol.asyncIterator]?t(e,n):r(e,n)}const s=Symbol("TIMEOUT"),o=e=>{let t;return[new Promise((r=>{t=setTimeout((()=>r(s)),e)})),()=>{clearTimeout(t)}]};async function*a(e,t,r){const n=r[Symbol.asyncIterator]();let i,a,c,u=[];const l=()=>{h(),[a,c]=o(t)},h=()=>{c&&c(),a=void 0};for(i=n.next();;){const t=await(a?Promise.race([i,a]):i);if(t===s||t.done){if(u.length&&(yield u,u=[]),h(),t!==s)break}else i=n.next(),u.push(t.value),1===u.length&&l(),u.length!==e||(yield u,u=[],h())}}function c(e,t,r){return void 0===r?r=>c(e,t,r):r[Symbol.asyncIterator]&&t!==1/0?a(e,t,r):i(e,r)}function u(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 l(){let e,t;return{promise:new Promise(((r,n)=>{t=r,e=n})),reject:e,resolve:t}}function h(e,t){const r=u(t),n=[],i=[];let s=!1,o=!1;function a(){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&&o;){const{resolve:e}=i.shift();e({done:!0,value:void 0})}}async function c(){if(!o&&!s&&!(n.length>=e)){s=!0;try{const{done:e,value:t}=await r.next();e?o=!0:n.push({value:t})}catch(t){o=!0,n.push({error:t})}a(),s=!1,c()}}async function h(){if(n.length>0){const{error:e,value:t}=n.shift();if(e)throw e;return c(),{done:!1,value:t}}if(o)return{done:!0,value:void 0};const e=l();return i.push(e),c(),e.promise}const d={next:h,[Symbol.asyncIterator]:()=>d};return d}function*d(e,t){const r=[];let n;try{for(const n of t)r.push(n),r.length<=e||(yield r.shift())}catch(i){n=i}for(const s of r)yield s;if(n)throw n}function f(e,t){return void 0===t?t=>f(e,t):0===e?t:t[Symbol.asyncIterator]?h(e,t):d(e,t)}async function p(e){const t=[];for await(const r of e)t.push(r);return t}function y(e){return e[Symbol.asyncIterator]?p(e):Array.from(e)}async function*g(e){for await(const t of e)yield*t}function*m(e){for(const t of e)yield*t}function v(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.find((e=>void 0!==e[Symbol.asyncIterator]))?g(t):m(t)}async function b(e){for await(const t of e);}function w(e){if(e[Symbol.asyncIterator])return b(e);for(const t of e);}async function*E(e,t){for await(const r of t)await e(r)&&(yield r)}function S(e,t){return void 0===t?t=>E(e,t):E(e,t)}async function*_(e){for await(const t of e)t&&"string"!==typeof t&&(t[Symbol.iterator]||t[Symbol.asyncIterator])?yield*_(t):yield t}async function*I(e,t){for await(const r of t)yield await e(r)}function T(e,t){return void 0===t?t=>I(e,t):I(e,t)}function A(e,t){return void 0===t?t=>A(e,t):S((e=>void 0!==e&&null!==e),_(T(e,t)))}function C(e,t,r){const n=u(r),i=[],s=[];let o=!1,a=!1,c=0,h=null;function d(){for(;s.length>0&&i.length>0;){const{resolve:e}=s.shift();e({done:!1,value:i.shift()})}for(;s.length>0&&0===c&&o;){const{resolve:e,reject:t}=s.shift();h?(t(h),h=null):e({done:!0,value:void 0})}}async function f(){if(o)d();else if(!a&&!(c+i.length>=e)){a=!0,c++;try{const{done:e,value:t}=await n.next();e?(o=!0,c--,d()):p(t)}catch(t){o=!0,c--,h=t,d()}a=!1,f()}}async function p(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(r){o=!0,h=r}c--,d(),f()}async function y(){if(0===i.length){const e=l();return s.push(e),f(),e.promise}const e=i.shift();return f(),{done:!1,value:e}}const g={next:y,[Symbol.asyncIterator]:()=>g};return g}function R(e,t,r){return void 0===t?(t,r)=>r?R(e,t,r):R(e,t):void 0===r?r=>R(e,t,r):S((e=>void 0!==e&&null!==e),_(C(e,t,r)))}async function P(e){return new Promise((t=>{e.once("readable",(()=>{t()}))}))}async function*k(e){for(;;){const t=e.read();if(null===t){if(e._readableState.ended)break;await P(e)}else yield t}}function O(e){return"function"===typeof e[Symbol.asyncIterator]?e:k(e)}async function*B(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const n=new Set(t.map(u));for(;n.size>0;)for(const e of n){const t=await e.next();t.done?n.delete(e):yield t.value}}function N(e){let t=e();for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];for(const s of n)t=s(t);return t}async function*D(e,t,r){let n=null;const i=e=>({value:t(e)}),s=async function*(e){for await(const t of e){if(n)return;yield t}},o=u(N((()=>r),f(1),s,T(i),f(e-1)));for(;;){const{value:e,done:t}=await o.next();if(t)break;try{const t=await e.value;n||(yield t)}catch(a){n=a}}if(n)throw n}function L(e,t,r){return void 0===t?(t,r)=>L(e,t,r):void 0===r?r=>L(e,t,r):1===e?T(t,r):D(e,t,r)}function x(e,t,r){return void 0===t?(t,r)=>r?x(e,t,r):x(e,t):void 0===r?r=>x(e,t,r):S((e=>void 0!==e&&null!==e),_(L(e,t,r)))}async function*M(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const n=t.map(u),i=new Set,s=new Map;let o=null,a=null,c=null;const l=e=>{o=e,a&&a(e)},h=e=>{c&&c(e)},d=()=>new Promise(((e,t)=>{if(o&&t(o),s.size>0)return e();c=e,a=t})),f=e=>{const t=Promise.resolve(e.next()).then((async r=>{let{done:n,value:o}=r;n||s.set(e,o),i.delete(t)}));i.add(t),t.then(h,l)};for(const u of n)f(u);for(;;){if(0===i.size&&0===s.size)return;await d();for(const[e,t]of s)s.delete(e),yield t,f(e)}}async function U(e,t,r){let n=t;for await(const i of r)n=await e(n,i);return n}function K(e,t,r){return void 0===t?(t,r)=>r?U(e,t,r):K(e,t):void 0===r?r=>K(e,t,r):U(e,t,r)}async function*j(e,t){let r=0;for await(const n of t)if(yield await n,r++,r>=e)break}function*F(e,t){let r=0;for(const n of t)if(yield n,r++,r>=e)break}function V(e,t){return void 0===t?t=>V(e,t):t[Symbol.asyncIterator]?j(e,t):F(e,t)}async function*q(e,t){for await(const r of t)await e(r),yield r}function z(e,t){return void 0===t?t=>q(e,t):q(e,t)}const H=e=>new Promise((t=>setTimeout(t,e)));function G(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 s of r){if(i<e){"undefined"===typeof n&&(n=Date.now()),i++,yield s;continue}const r=Date.now()-n,o=t-r;o>0&&await H(o),n=Date.now(),i=1,yield s}}()}function W(e,t,r){return void 0===r?r=>G(e,t,r):G(e,t,r)}function Y(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]}async function*Q(e,t){const r=t[Symbol.asyncIterator]();let i=[0,0];for(;;){const t=n.hrtime(),{value:s,done:o}=await r.next(),a=n.hrtime(t);if(i=Y(i,a),e.progress&&e.progress(a,i),o)return e.total&&e.total(i),s;yield s}}function*J(e,t){const r=t[Symbol.iterator]();let i=[0,0];for(;;){const t=n.hrtime(),{value:s,done:o}=r.next(),a=n.hrtime(t);if(i=Y(i,a),e.progress&&e.progress(a,i),o)return e.total&&e.total(i),s;yield s}}function X(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return void 0===t?t=>X(e,t):void 0!==t[Symbol.asyncIterator]?Q(e,t):J(e,t)}function $(e,t,r){const n=u(r),i=[],s=[];let o=!1,a=!1,c=0,h=null;function d(){for(;s.length>0&&i.length>0;){const{resolve:e}=s.shift();e({done:!1,value:i.shift()})}for(;s.length>0&&0===c&&o;){const{resolve:e,reject:t}=s.shift();h?(t(h),h=null):e({done:!0,value:void 0})}}async function f(){if(o)d();else if(!a&&!(c+i.length>=e)){a=!0,c++;try{const{done:e,value:t}=await n.next();e?(o=!0,c--,d()):p(t)}catch(t){o=!0,c--,h=t,d()}a=!1,f()}}async function p(e){try{const r=await t(e);i.push(r)}catch(r){o=!0,h=r}c--,d(),f()}async function y(){if(0===i.length){const e=l();return s.push(e),f(),e.promise}const e=i.shift();return f(),{done:!1,value:e}}const g={next:y,[Symbol.asyncIterator]:()=>g};return g}function Z(e,t,r){return void 0===t?(t,r)=>r?Z(e,t,r):Z(e,t):void 0===r?r=>Z(e,t,r):$(e,t,r)}async function ee(e,t){let r=null,n=null,i=null;const s=e=>{r=e,n&&n(e)},o=()=>{i&&i()},a=()=>{e.removeListener("error",s),e.removeListener("drain",o)};e.once("error",s);const c=()=>new Promise(((t,s)=>{if(r)return s(r);e.once("drain",o),i=t,n=s}));for await(const u of t)if(!1===e.write(u)&&await c(),r)break;if(a(),r)throw r}function te(e,t){return void 0===t?t=>ee(e,t):ee(e,t)}e.batch=i,e.batchWithTimeout=c,e.buffer=f,e.collect=y,e.concat=v,e.consume=w,e.filter=S,e.flatMap=A,e.flatTransform=R,e.flatten=_,e.fromStream=O,e.getIterator=u,e.map=T,e.merge=B,e.parallelFlatMap=x,e.parallelMap=L,e.parallelMerge=M,e.pipeline=N,e.reduce=K,e.take=V,e.tap=z,e.throttle=W,e.time=X,e.transform=Z,e.writeToStream=te,Object.defineProperty(e,"__esModule",{value:!0})}(t)},87683:(e,t,r)=>{"use strict";const{AbortController:n}=globalThis,i=r(31779);class s extends n{constructor(e){super(),this._ms=e,this._timer=i((()=>this.abort()),e),Object.setPrototypeOf(this,s.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={TimeoutController:s}},60206:(e,t,r)=>{"use strict";var n=r(49022),i=r(34847);e.exports=n.bind(null,i)},49022: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 s,o,a=n.length,c=0,u=0;u<a;u+=1){if(s=n.charCodeAt(u),o=n[u],t(s)&&r(n.charCodeAt(u+1))&&(o+=n[u+=1]),(c+=e(o))===i)return n.slice(0,u+1);if(c>i)return n.slice(0,u-o.length+1)}return n}},34847: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,s=null,o=null,a=0;a<n;a++)r(s=e.charCodeAt(a))?null!=o&&t(o)?i+=1:i+=3:s<=127?i+=1:s>=128&&s<=2047?i+=2:s>=2048&&s<=65535&&(i+=3),o=s;return i}},75658:(e,t,r)=>{"use strict";var n;r.r(t),r.d(t,{NIL:()=>B,parse:()=>g,stringify:()=>l,v1:()=>y,v3:()=>A,v4:()=>C,v5:()=>O,validate:()=>a,version:()=>N});var i=new Uint8Array(16);function s(){if(!n&&!(n="undefined"!==typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!==typeof msCrypto&&"function"===typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return n(i)}const o=/^(?:[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;const a=function(e){return"string"===typeof e&&o.test(e)};for(var c=[],u=0;u<256;++u)c.push((u+256).toString(16).substr(1));const l=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 h,d,f=0,p=0;const y=function(e,t,r){var n=t&&r||0,i=t||new Array(16),o=(e=e||{}).node||h,a=void 0!==e.clockseq?e.clockseq:d;if(null==o||null==a){var c=e.random||(e.rng||s)();null==o&&(o=h=[1|c[0],c[1],c[2],c[3],c[4],c[5]]),null==a&&(a=d=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-f+(y-p)/1e4;if(g<0&&void 0===e.clockseq&&(a=a+1&16383),(g<0||u>f)&&void 0===e.nsecs&&(y=0),y>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");f=u,p=y,d=a;var m=(1e4*(268435455&(u+=122192928e5))+y)%4294967296;i[n++]=m>>>24&255,i[n++]=m>>>16&255,i[n++]=m>>>8&255,i[n++]=255&m;var v=u/4294967296*1e4&268435455;i[n++]=v>>>8&255,i[n++]=255&v,i[n++]=v>>>24&15|16,i[n++]=v>>>16&255,i[n++]=a>>>8|128,i[n++]=255&a;for(var b=0;b<6;++b)i[n+b]=o[b];return t||l(i)};const 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 m(e,t,r){function n(e,n,i,s){if("string"===typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t}(e)),"string"===typeof n&&(n=g(n)),16!==n.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var o=new Uint8Array(16+e.length);if(o.set(n),o.set(e,n.length),(o=r(o))[6]=15&o[6]|t,o[8]=63&o[8]|128,i){s=s||0;for(var a=0;a<16;++a)i[s+a]=o[a];return i}return l(o)}try{n.name=e}catch(i){}return n.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",n.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",n}function v(e){return 14+(e+64>>>9<<4)+1}function b(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,s){return b((o=b(b(t,e),b(n,s)))<<(a=i)|o>>>32-a,r);var o,a}function E(e,t,r,n,i,s,o){return w(t&r|~t&n,e,t,i,s,o)}function S(e,t,r,n,i,s,o){return w(t&n|r&~n,e,t,i,s,o)}function _(e,t,r,n,i,s,o){return w(t^r^n,e,t,i,s,o)}function I(e,t,r,n,i,s,o){return w(r^(t|~n),e,t,i,s,o)}const T=function(e){if("string"===typeof e){var t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(var r=0;r<t.length;++r)e[r]=t.charCodeAt(r)}return function(e){for(var t=[],r=32*e.length,n="0123456789abcdef",i=0;i<r;i+=8){var s=e[i>>5]>>>i%32&255,o=parseInt(n.charAt(s>>>4&15)+n.charAt(15&s),16);t.push(o)}return t}(function(e,t){e[t>>5]|=128<<t%32,e[v(t)-1]=t;for(var r=1732584193,n=-271733879,i=-1732584194,s=271733878,o=0;o<e.length;o+=16){var a=r,c=n,u=i,l=s;r=E(r,n,i,s,e[o],7,-680876936),s=E(s,r,n,i,e[o+1],12,-389564586),i=E(i,s,r,n,e[o+2],17,606105819),n=E(n,i,s,r,e[o+3],22,-1044525330),r=E(r,n,i,s,e[o+4],7,-176418897),s=E(s,r,n,i,e[o+5],12,1200080426),i=E(i,s,r,n,e[o+6],17,-1473231341),n=E(n,i,s,r,e[o+7],22,-45705983),r=E(r,n,i,s,e[o+8],7,1770035416),s=E(s,r,n,i,e[o+9],12,-1958414417),i=E(i,s,r,n,e[o+10],17,-42063),n=E(n,i,s,r,e[o+11],22,-1990404162),r=E(r,n,i,s,e[o+12],7,1804603682),s=E(s,r,n,i,e[o+13],12,-40341101),i=E(i,s,r,n,e[o+14],17,-1502002290),r=S(r,n=E(n,i,s,r,e[o+15],22,1236535329),i,s,e[o+1],5,-165796510),s=S(s,r,n,i,e[o+6],9,-1069501632),i=S(i,s,r,n,e[o+11],14,643717713),n=S(n,i,s,r,e[o],20,-373897302),r=S(r,n,i,s,e[o+5],5,-701558691),s=S(s,r,n,i,e[o+10],9,38016083),i=S(i,s,r,n,e[o+15],14,-660478335),n=S(n,i,s,r,e[o+4],20,-405537848),r=S(r,n,i,s,e[o+9],5,568446438),s=S(s,r,n,i,e[o+14],9,-1019803690),i=S(i,s,r,n,e[o+3],14,-187363961),n=S(n,i,s,r,e[o+8],20,1163531501),r=S(r,n,i,s,e[o+13],5,-1444681467),s=S(s,r,n,i,e[o+2],9,-51403784),i=S(i,s,r,n,e[o+7],14,1735328473),r=_(r,n=S(n,i,s,r,e[o+12],20,-1926607734),i,s,e[o+5],4,-378558),s=_(s,r,n,i,e[o+8],11,-2022574463),i=_(i,s,r,n,e[o+11],16,1839030562),n=_(n,i,s,r,e[o+14],23,-35309556),r=_(r,n,i,s,e[o+1],4,-1530992060),s=_(s,r,n,i,e[o+4],11,1272893353),i=_(i,s,r,n,e[o+7],16,-155497632),n=_(n,i,s,r,e[o+10],23,-1094730640),r=_(r,n,i,s,e[o+13],4,681279174),s=_(s,r,n,i,e[o],11,-358537222),i=_(i,s,r,n,e[o+3],16,-722521979),n=_(n,i,s,r,e[o+6],23,76029189),r=_(r,n,i,s,e[o+9],4,-640364487),s=_(s,r,n,i,e[o+12],11,-421815835),i=_(i,s,r,n,e[o+15],16,530742520),r=I(r,n=_(n,i,s,r,e[o+2],23,-995338651),i,s,e[o],6,-198630844),s=I(s,r,n,i,e[o+7],10,1126891415),i=I(i,s,r,n,e[o+14],15,-1416354905),n=I(n,i,s,r,e[o+5],21,-57434055),r=I(r,n,i,s,e[o+12],6,1700485571),s=I(s,r,n,i,e[o+3],10,-1894986606),i=I(i,s,r,n,e[o+10],15,-1051523),n=I(n,i,s,r,e[o+1],21,-2054922799),r=I(r,n,i,s,e[o+8],6,1873313359),s=I(s,r,n,i,e[o+15],10,-30611744),i=I(i,s,r,n,e[o+6],15,-1560198380),n=I(n,i,s,r,e[o+13],21,1309151649),r=I(r,n,i,s,e[o+4],6,-145523070),s=I(s,r,n,i,e[o+11],10,-1120210379),i=I(i,s,r,n,e[o+2],15,718787259),n=I(n,i,s,r,e[o+9],21,-343485551),r=b(r,a),n=b(n,c),i=b(i,u),s=b(s,l)}return[r,n,i,s]}(function(e){if(0===e.length)return[];for(var t=8*e.length,r=new Uint32Array(v(t)),n=0;n<t;n+=8)r[n>>5]|=(255&e[n/8])<<n%32;return r}(e),8*e.length))};const A=m("v3",48,T);const C=function(e,t,r){var n=(e=e||{}).random||(e.rng||s)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var i=0;i<16;++i)t[r+i]=n[i];return t}return l(n)};function R(e,t,r,n){switch(e){case 0:return t&r^~t&n;case 1:case 3:return t^r^n;case 2:return t&r^t&n^r&n}}function P(e,t){return e<<t|e>>>32-t}const k=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<n.length;++i)e.push(n.charCodeAt(i))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);for(var s=e.length/4+2,o=Math.ceil(s/16),a=new Array(o),c=0;c<o;++c){for(var u=new Uint32Array(16),l=0;l<16;++l)u[l]=e[64*c+4*l]<<24|e[64*c+4*l+1]<<16|e[64*c+4*l+2]<<8|e[64*c+4*l+3];a[c]=u}a[o-1][14]=8*(e.length-1)/Math.pow(2,32),a[o-1][14]=Math.floor(a[o-1][14]),a[o-1][15]=8*(e.length-1)&4294967295;for(var h=0;h<o;++h){for(var d=new Uint32Array(80),f=0;f<16;++f)d[f]=a[h][f];for(var p=16;p<80;++p)d[p]=P(d[p-3]^d[p-8]^d[p-14]^d[p-16],1);for(var y=r[0],g=r[1],m=r[2],v=r[3],b=r[4],w=0;w<80;++w){var E=Math.floor(w/20),S=P(y,5)+R(E,g,m,v)+b+t[E]+d[w]>>>0;b=v,v=m,m=P(g,30)>>>0,g=y,y=S}r[0]=r[0]+y>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+m>>>0,r[3]=r[3]+v>>>0,r[4]=r[4]+b>>>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]]};const O=m("v5",80,k),B="00000000-0000-0000-0000-000000000000";const N=function(e){if(!a(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)}},23522:e=>{e.exports=function e(t,r){var n,i=0,s=0,o=r=r||0,a=t.length;do{if(o>=a||s>49)throw e.bytes=0,new RangeError("Could not decode varint");n=t[o++],i+=s<28?(127&n)<<s:(127&n)*Math.pow(2,s),s+=7}while(n>=128);return e.bytes=o-r,i}},26993: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||[];var s=i=i||0;for(;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-s+1,n};var t=Math.pow(2,31)},74561:(e,t,r)=>{e.exports={encode:r(26993),decode:r(23522),encodingLength:r(12570)}},12570:e=>{var t=Math.pow(2,7),r=Math.pow(2,14),n=Math.pow(2,21),i=Math.pow(2,28),s=Math.pow(2,35),o=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<t?1:e<r?2:e<n?3:e<i?4:e<s?5:e<o?6:e<a?7:e<c?8:e<u?9:10}},3227:(e,t,r)=>{"use strict";var n=r(21964);const i=r(82193),s="object"===typeof window&&"object"===typeof document&&9===document.nodeType,o=i(),a=s&&!o,c=o&&!s,u=o&&s,l="undefined"!==typeof n&&"undefined"!==typeof n.release&&"node"===n.release.name&&!o,h="function"===typeof importScripts&&"undefined"!==typeof self&&"undefined"!==typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,d="undefined"!==typeof n&&!1;e.exports={isTest:d,isElectron:o,isElectronMain:c,isElectronRenderer:u,isNode:l,isBrowser:a,isWebWorker:h,isEnvWithDom:s}},21964:e=>{var t,r,n=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function o(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:s}catch(e){r=s}}();var a,c=[],u=!1,l=-1;function h(){u&&a&&(u=!1,a.length?c=a.concat(c):l=-1,c.length&&d())}function d(){if(!u){var e=o(h);u=!0;for(var t=c.length;t;){for(a=c,c=[];++l<t;)a&&a[l].run();l=-1,t=c.length}a=null,u=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function p(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new f(e,t)),1!==c.length||u||o(d)},f.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=p,n.addListener=p,n.once=p,n.off=p,n.removeListener=p,n.removeAllListeners=p,n.emit=p,n.prependListener=p,n.prependOnceListener=p,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},43094:()=>{},69159:()=>{},35883:()=>{},5696:()=>{},89408:()=>{},28339:()=>{},82161:()=>{},17111:()=>{},30285:()=>{},71381:()=>{},47956:()=>{},21724:()=>{},78932:(e,t,r)=>{"use strict";r.r(t),r.d(t,{MemoryDatastore:()=>l});var n=r(50464);const i=(e,t)=>async function*(){const r=await n(e);yield*r.sort(t)}();var s=r(79272),o=r(12393),a=r(35959);var c=r(3450),u=r(67963);class l extends class{open(){return Promise.reject(new Error(".open is not implemented"))}close(){return Promise.reject(new Error(".close is not implemented"))}put(e,t,r){return Promise.reject(new Error(".put is not implemented"))}get(e,t){return Promise.reject(new Error(".get is not implemented"))}has(e,t){return Promise.reject(new Error(".has is not implemented"))}delete(e,t){return Promise.reject(new Error(".delete is not implemented"))}async*putMany(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for await(const{key:r,value:n}of e)await this.put(r,n,t),yield{key:r,value:n}}async*getMany(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for await(const r of e)yield this.get(r,t)}async*deleteMany(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for await(const r of e)await this.delete(r,t),yield r}batch(){let e=[],t=[];return{put(t,r){e.push({key:t,value:r})},delete(e){t.push(e)},commit:async r=>{await s(this.putMany(e,r)),e=[],await s(this.deleteMany(t,r)),t=[]}}}async*_all(e,t){throw new Error("._all is not implemented")}async*_allKeys(e,t){throw new Error("._allKeys is not implemented")}query(e,t){let r=this._all(e,t);if(null!=e.prefix&&(r=o(r,(t=>t.key.toString().startsWith(e.prefix)))),Array.isArray(e.filters)&&(r=e.filters.reduce(((e,t)=>o(e,t)),r)),Array.isArray(e.orders)&&(r=e.orders.reduce(((e,t)=>i(e,t)),r)),null!=e.offset){let t=0;r=o(r,(()=>t++>=e.offset))}return null!=e.limit&&(r=a(r,e.limit)),r}queryKeys(e,t){let r=this._allKeys(e,t);if(null!=e.prefix&&(r=o(r,(t=>t.toString().startsWith(e.prefix)))),Array.isArray(e.filters)&&(r=e.filters.reduce(((e,t)=>o(e,t)),r)),Array.isArray(e.orders)&&(r=e.orders.reduce(((e,t)=>i(e,t)),r)),null!=e.offset){let t=0;r=o(r,(()=>t++>=e.offset))}return null!=e.limit&&(r=a(r,e.limit)),r}}{constructor(){super(),this.data={}}open(){return Promise.resolve()}close(){return Promise.resolve()}async put(e,t){this.data[e.toString()]=t}async get(e){if(!await this.has(e))throw t=t||new Error("Not Found"),u(t,"ERR_NOT_FOUND");var t;return this.data[e.toString()]}async has(e){return void 0!==this.data[e.toString()]}async delete(e){delete this.data[e.toString()]}async*_all(){yield*Object.entries(this.data).map((e=>{let[t,r]=e;return{key:new c.Key(t),value:r}}))}async*_allKeys(){yield*Object.entries(this.data).map((e=>{let[t]=e;return new c.Key(t)}))}}},3450:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Key:()=>u});var n=r(75926),i=r(82051),s=r(46765);const o="/",a=(new TextEncoder).encode(o),c=a[0];class u{constructor(e,t){if("string"===typeof e)this._buf=(0,s.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]!==c)throw new Error("Invalid key")}toString(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"utf8";return(0,i.toString)(this._buf,e)}uint8Array(){return this._buf}get[Symbol.toStringTag](){return"Key(".concat(this.toString(),")")}static withNamespaces(e){return new u(e.join(o))}static random(){return new u((0,n.nanoid)().replace(/-/g,""))}static asKey(e){return e instanceof Uint8Array||"string"===typeof e?new u(e):e.uint8Array?new u(e.uint8Array()):null}clean(){if(this._buf&&0!==this._buf.byteLength||(this._buf=a),this._buf[0]!==c){const e=new Uint8Array(this._buf.byteLength+1);e.fill(c,0,1),e.set(this._buf,1),this._buf=e}for(;this._buf.byteLength>1&&this._buf[this._buf.byteLength-1]===c;)this._buf=this._buf.subarray(0,-1)}less(e){const t=this.list(),r=e.list();for(let n=0;n<t.length;n++){if(r.length<n+1)return!1;const e=t[n],i=r[n];if(e<i)return!0;if(e>i)return!1}return t.length<r.length}reverse(){return u.withNamespaces(this.list().slice().reverse())}namespaces(){return this.list()}baseNamespace(){const e=this.namespaces();return e[e.length-1]}list(){return this.toString().split(o).slice(1)}type(){return function(e){const t=e.split(":");if(t.length<2)return"";return t.slice(0,-1).join(":")}(this.baseNamespace())}name(){return function(e){const t=e.split(":");return t[t.length-1]}(this.baseNamespace())}instance(e){return new u(this.toString()+":"+e)}path(){let e=this.parent().toString();return e.endsWith(o)||(e+=o),e+=this.type(),new u(e)}parent(){const e=this.list();return 1===e.length?new u(o):new u(e.slice(0,-1).join(o))}child(e){return this.toString()===o?e:e.toString()===o?this:new u(this.toString()+e.toString(),!1)}isAncestorOf(e){return e.toString()!==this.toString()&&e.toString().startsWith(this.toString())}isDecendantOf(e){return e.toString()!==this.toString()&&this.toString().startsWith(e.toString())}isTopLevel(){return 1===this.list().length}concat(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return u.withNamespaces([...this.namespaces(),...(n=t.map((e=>e.namespaces())),[].concat(...n))]);var n}}},52087:(e,t,r)=>{"use strict";r.d(t,{kU:()=>h,Dp:()=>l,ET:()=>d});const n=function(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var s=e.charAt(i),o=s.charCodeAt(0);if(255!==r[o])throw new TypeError(s+" is ambiguous");r[o]=i}var a=e.length,c=e.charAt(0),u=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function h(e){if("string"!==typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[t]){for(var n=0,i=0;e[t]===c;)n++,t++;for(var s=(e.length-t)*u+1>>>0,o=new Uint8Array(s);e[t];){var l=r[e.charCodeAt(t)];if(255===l)return;for(var h=0,d=s-1;(0!==l||h<i)&&-1!==d;d--,h++)l+=a*o[d]>>>0,o[d]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=h,t++}if(" "!==e[t]){for(var f=s-i;f!==s&&0===o[f];)f++;for(var p=new Uint8Array(n+(s-f)),y=n;f!==s;)p[y++]=o[f++];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,s=t.length;i!==s&&0===t[i];)i++,r++;for(var o=(s-i)*l+1>>>0,u=new Uint8Array(o);i!==s;){for(var h=t[i],d=0,f=o-1;(0!==h||d<n)&&-1!==f;f--,d++)h+=256*u[f]>>>0,u[f]=h%a>>>0,h=h/a>>>0;if(0!==h)throw new Error("Non-zero carry");n=d,i++}for(var p=o-n;p!==o&&0===u[p];)p++;for(var y=c.repeat(r);p<o;++p)y+=e.charAt(u[p]);return y},decodeUnsafe:h,decode:function(e){var r=h(e);if(r)return r;throw new Error("Non-".concat(t," character"))}}};var i=r(71250);class s{constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return"".concat(this.prefix).concat(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 ".concat(JSON.stringify(e),", ").concat(this.name," decoder only supports inputs prefixed with ").concat(this.prefix))}throw Error("Can only multibase decode strings")}or(e){return c(this,e)}}class a{constructor(e){this.decoders=e}or(e){return c(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 ".concat(JSON.stringify(e),", only inputs prefixed with ").concat(Object.keys(this.decoders)," are supported"))}}const c=(e,t)=>new a({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class u{constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new s(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 l=e=>{let{name:t,prefix:r,encode:n,decode:i}=e;return new u(t,r,n,i)},h=e=>{let{prefix:t,name:r,alphabet:s}=e;const{encode:o,decode:a}=n(s,r);return l({prefix:t,name:r,encode:o,decode:e=>(0,i.oQ)(a(e))})},d=e=>{let{name:t,prefix:r,bitsPerChar:n,alphabet:i}=e;return l({prefix:r,name:t,encode:e=>((e,t,r)=>{const n="="===t[t.length-1],i=(1<<r)-1;let s="",o=0,a=0;for(let c=0;c<e.length;++c)for(a=a<<8|e[c],o+=8;o>r;)o-=r,s+=t[i&a>>o];if(o&&(s+=t[i&a<<r-o]),n)for(;s.length*r&7;)s+="=";return s})(e,i,n),decode:e=>((e,t,r,n)=>{const i={};for(let l=0;l<t.length;++l)i[t[l]]=l;let s=e.length;for(;"="===e[s-1];)--s;const o=new Uint8Array(s*r/8|0);let a=0,c=0,u=0;for(let l=0;l<s;++l){const t=i[e[l]];if(void 0===t)throw new SyntaxError("Non-".concat(n," character"));c=c<<r|t,a+=r,a>=8&&(a-=8,o[u++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o})(e,i,n,t)})}},24031:(e,t,r)=>{"use strict";r.r(t),r.d(t,{base16:()=>i,base16upper:()=>s});var n=r(52087);const i=(0,n.ET)({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),s=(0,n.ET)({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})},71128:(e,t,r)=>{"use strict";r.r(t),r.d(t,{base32:()=>i,base32upper:()=>s,base32pad:()=>o,base32padupper:()=>a,base32hex:()=>c,base32hexupper:()=>u,base32hexpad:()=>l,base32hexpadupper:()=>h,base32z:()=>d});var n=r(52087);const i=(0,n.ET)({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),s=(0,n.ET)({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),o=(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}),l=(0,n.ET)({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),h=(0,n.ET)({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),d=(0,n.ET)({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})},45645:(e,t,r)=>{"use strict";r.r(t),r.d(t,{base36:()=>i,base36upper:()=>s});var n=r(52087);const i=(0,n.kU)({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),s=(0,n.kU)({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})},86898:(e,t,r)=>{"use strict";r.r(t),r.d(t,{base58btc:()=>i,base58flickr:()=>s});var n=r(52087);const i=(0,n.kU)({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),s=(0,n.kU)({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})},24426:(e,t,r)=>{"use strict";r.r(t),r.d(t,{base64:()=>i,base64pad:()=>s,base64url:()=>o,base64urlpad:()=>a});var n=r(52087);const i=(0,n.ET)({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),s=(0,n.ET)({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),o=(0,n.ET)({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),a=(0,n.ET)({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})},71250:(e,t,r)=>{"use strict";r.d(t,{fS:()=>n,oQ:()=>i,mL:()=>s,BB:()=>o});new Uint8Array(0);const n=(e,t)=>{if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0},i=e=>{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")},s=e=>(new TextEncoder).encode(e),o=e=>(new TextDecoder).decode(e)},16629:(e,t,r)=>{"use strict";r.r(t),r.d(t,{CID:()=>c});var n=r(65136),i=r(8315),s=r(86898),o=r(71128),a=r(71250);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:m,byteLength:m,code:g,version:g,multihash:g,bytes:g,_baseCache:m,asCID:m})}toV0(){if(0===this.version)return this;{const{code:e,multihash:t}=this;if(e!==d)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==f)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 ".concat(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?l(t,n,e||s.base58btc.encoder):h(t,n,e||o.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 v(/^0\.0/,b),!(!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,s=i.decode(r);return c.create(t,n,s)}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!==d)throw new Error("Version 0 CID must use dag-pb (code: ".concat(d,") 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,d,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 s=n.subarray(t.multihashSize-t.digestSize),o=new i.Digest(t.multihashCode,t.digestSize,s,n);return[0===t.version?c.createV0(o):c.createV1(t.codec,o),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(),s=d;if(18===i?(i=0,t=0):1===i&&(s=r()),0!==i&&1!==i)throw new RangeError("Invalid CID version ".concat(i));const o=t,a=r(),c=r(),u=t+c;return{version:i,codec:s,multihashCode:a,digestSize:c,multihashSize:u-o,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||s.base58btc;return[s.base58btc.prefix,r.decode("".concat(s.base58btc.prefix).concat(e))]}case s.base58btc.prefix:{const r=t||s.base58btc;return[s.base58btc.prefix,r.decode(e)]}case o.base32.prefix:{const r=t||o.base32;return[o.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)]}},l=(e,t,r)=>{const{prefix:n}=r;if(n!==s.base58btc.prefix)throw Error("Cannot string encode V0 in ".concat(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},h=(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},d=112,f=18,p=(e,t,r)=>{const i=n.P$(e),s=i+n.P$(t),o=new Uint8Array(s+r.byteLength);return n.mL(e,o,0),n.mL(t,o,i),o.set(r,s),o},y=Symbol.for("@ipld/js-cid/CID"),g={writable:!1,configurable:!1,enumerable:!0},m={writable:!1,enumerable:!1,configurable:!1},v=(e,t)=>{if(!e.test("0.0.0-dev"))throw new Error(t);console.warn(t)},b="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"},8315:(e,t,r)=>{"use strict";r.r(t),r.d(t,{create:()=>s,decode:()=>o,equals:()=>a,Digest:()=>c});var n=r(71250),i=r(65136);const s=(e,t)=>{const r=t.byteLength,n=i.P$(e),s=n+i.P$(r),o=new Uint8Array(s+r);return i.mL(e,o,0),i.mL(r,o,n),o.set(t,s),new c(e,r,t,o)},o=e=>{const t=(0,n.oQ)(e),[r,s]=i.Jx(t),[o,a]=i.Jx(t.subarray(s)),u=t.subarray(s+a);if(u.byteLength!==o)throw new Error("Incorrect length");return new c(r,o,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}}},42231:(e,t,r)=>{"use strict";r.d(t,{D:()=>i});var n=r(8315);const i=e=>{let{name:t,code:r,encode:n}=e;return new s(t,r,n)};class s{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")}}},60173:(e,t,r)=>{"use strict";r.r(t),r.d(t,{identity:()=>o});var n=r(71250),i=r(8315);const s=n.oQ,o={code:0,name:"identity",encode:s,digest:e=>i.create(0,s(e))}},19400:(e,t,r)=>{"use strict";r.r(t),r.d(t,{sha256:()=>s,sha512:()=>o});var n=r(42231);const i=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),s=(0,n.D)({name:"sha2-256",code:18,encode:i("SHA-256")}),o=(0,n.D)({name:"sha2-512",code:19,encode:i("SHA-512")})},65136:(e,t,r)=>{"use strict";r.d(t,{Jx:()=>g,mL:()=>m,P$:()=>v});var n=function e(t,r,n){r=r||[];var s=n=n||0;for(;t>=i;)r[n++]=255&t|128,t/=128;for(;-128&t;)r[n++]=255&t|128,t>>>=7;return r[n]=0|t,e.bytes=n-s+1,r},i=Math.pow(2,31);var s=function e(t,r){var n,i=0,s=0,o=r=r||0,a=t.length;do{if(o>=a)throw e.bytes=0,new RangeError("Could not decode varint");n=t[o++],i+=s<28?(127&n)<<s:(127&n)*Math.pow(2,s),s+=7}while(n>=128);return e.bytes=o-r,i};var o=Math.pow(2,7),a=Math.pow(2,14),c=Math.pow(2,21),u=Math.pow(2,28),l=Math.pow(2,35),h=Math.pow(2,42),d=Math.pow(2,49),f=Math.pow(2,56),p=Math.pow(2,63);const y={encode:n,decode:s,encodingLength:function(e){return e<o?1:e<a?2:e<c?3:e<u?4:e<l?5:e<h?6:e<d?7:e<f?8:e<p?9:10}},g=e=>[y.decode(e),y.decode.bytes],m=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return y.encode(e,t,r),t},v=e=>y.encodingLength(e)},75926:(e,t,r)=>{"use strict";r.r(t),r.d(t,{customAlphabet:()=>o,customRandom:()=>s,nanoid:()=>a,random:()=>i,urlAlphabet:()=>n});let n="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let i=e=>crypto.getRandomValues(new Uint8Array(e)),s=(e,t,r)=>{let n=(2<<Math.log(e.length-1)/Math.LN2)-1,i=-~(1.6*n*t/e.length);return()=>{let s="";for(;;){let o=r(i),a=i;for(;a--;)if(s+=e[o[a]&n]||"",s.length===t)return s}}},o=(e,t)=>s(e,t,i),a=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:21,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}},62110:(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 i of e)r.set(i,n),n+=i.length;return r}r.r(t),r.d(t,{concat:()=>n})},98779:(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;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}r.r(t),r.d(t,{equals:()=>n})},46765:(e,t,r)=>{"use strict";r.r(t),r.d(t,{fromString:()=>i});var n=r(65341);function i(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf8";const r=n.Z[t];if(!r)throw new Error('Unsupported encoding "'.concat(t,'"'));return r.decoder.decode("".concat(r.prefix).concat(e))}},79421:(e,t,r)=>{"use strict";function n(e,t){for(let r=0;r<e.byteLength;r++){if(e[r]<t[r])return-1;if(e[r]>t[r])return 1}return e.byteLength>t.byteLength?1:e.byteLength<t.byteLength?-1:0}r.r(t),r.d(t,{compare:()=>n,concat:()=>i.concat,equals:()=>s.equals,fromString:()=>o.fromString,toString:()=>a.toString,xor:()=>c});var i=r(62110),s=r(98779),o=r(46765),a=r(82051);function c(e,t){if(e.length!==t.length)throw new Error("Inputs should have the same length");const r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e[n]^t[n];return r}},82051:(e,t,r)=>{"use strict";r.r(t),r.d(t,{toString:()=>i});var n=r(65341);function i(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf8";const r=n.Z[t];if(!r)throw new Error('Unsupported encoding "'.concat(t,'"'));return r.encoder.encode(e).substring(1)}},65341:(e,t,r)=>{"use strict";r.d(t,{Z:()=>x});var n={};r.r(n),r.d(n,{identity:()=>h});var i={};r.r(i),r.d(i,{base2:()=>d});var s={};r.r(s),r.d(s,{base8:()=>f});var o={};r.r(o),r.d(o,{base10:()=>p});var a={};r.r(a),r.d(a,{code:()=>_,decode:()=>T,encode:()=>I,name:()=>S});var c={};r.r(c),r.d(c,{code:()=>P,decode:()=>O,encode:()=>k,name:()=>R});var u=r(52087),l=r(71250);const h=(0,u.Dp)({prefix:"\0",name:"identity",encode:e=>(0,l.BB)(e),decode:e=>(0,l.mL)(e)}),d=(0,u.ET)({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),f=(0,u.ET)({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),p=(0,u.kU)({prefix:"9",name:"base10",alphabet:"0123456789"});var y=r(24031),g=r(71128),m=r(45645),v=r(86898),b=r(24426),w=r(19400),E=r(60173);const S="raw",_=85,I=e=>(0,l.oQ)(e),T=e=>(0,l.oQ)(e),A=new TextEncoder,C=new TextDecoder,R="json",P=512,k=e=>A.encode(JSON.stringify(e)),O=e=>JSON.parse(C.decode(e));r(16629),r(65136),r(42231),r(8315);const B={...n,...i,...s,...o,...y,...g,...m,...v,...b};function N(e,t,r,n){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:n}}}const D=N("utf8","u",(e=>"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),L=N("ascii","a",(e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t}),(e=>{e=e.substring(1);const t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t})),x={utf8:D,"utf-8":D,hex:B.base16,latin1:L,ascii:L,binary:L,...B}},35438:e=>{"use strict";e.exports=JSON.parse('{"cloudflare":{"host":"cloudflare-dns.com","docs":"https://developers.cloudflare.com/1.1.1.1/dns-over-https","cors":true},"cloudflareFamily":{"host":"family.cloudflare-dns.com","docs":"https://developers.cloudflare.com/1.1.1.1/1.1.1.1-for-families/setup-instructions/dns-over-https","cors":true,"filter":true},"cloudflareSecurity":{"host":"security.cloudflare-dns.com","docs":"https://developers.cloudflare.com/1.1.1.1/1.1.1.1-for-families/setup-instructions/dns-over-https","cors":true,"filter":true},"cloudflareEth":{"host":"eth.resolver.cloudflare-eth.com","docs":"https://www.cloudflare.com/distributed-web-gateway/#ethereum-gateway","cors":true,"filter":true},"aAndA":{"host":"dns.aa.net.uk","docs":"https://www.aa.net.uk/legal/dohdot-disclaimer/","filter":true},"usablePrivacy":{"host":"adfree.usableprivacy.net","docs":"https://docs.usableprivacy.com","filter":true},"adguard":{"host":"dns.adguard.com","docs":"https://adguard.com/en/adguard-dns/overview.html","filter":true},"adguardFamily":{"host":"dns-family.adguard.com","docs":"https://adguard.com/en/adguard-dns/overview.html","filter":true},"adguardUnfiltered":{"host":"dns-unfiltered.adguard.com","docs":"https://adguard.com/en/adguard-dns/overview.html"},"ahadnsIn":{"host":"doh.in.ahadns.net","docs":"https://ahadns.com/dns-over-https/","cors":true,"filter":true,"location":"India"},"ahadnsIt":{"host":"doh.it.ahadns.net","docs":"https://ahadns.com/dns-over-https/","cors":true,"filter":true,"location":"Italy"},"ahadnsEs":{"host":"doh.es.ahadns.net","docs":"https://ahadns.com/dns-over-https/","cors":true,"filter":true,"location":"Spain"},"ahadnsNo":{"host":"doh.no.ahadns.net","docs":"https://ahadns.com/dns-over-https/","cors":true,"filter":true,"location":"Norway"},"ahadnsNl":{"host":"doh.nl.ahadns.net","docs":"https://ahadns.com/dns-over-https/","cors":true,"filter":true,"location":"Netherlands"},"ahadnsPl":{"host":"doh.pl.ahadns.net","docs":"https://ahadns.com/dns-over-https/","cors":true,"filter":true,"location":"Poland"},"ahadnsNy":{"host":"doh.ny.ahadns.net","docs":"https://ahadns.com/dns-over-https/","cors":true,"filter":true,"location":"New York"},"ahadnsChi":{"host":"doh.chi.ahadns.net","docs":"https://ahadns.com/dns-over-https/","cors":true,"filter":true,"location":"Chicago"},"ahadnsAu":{"host":"doh.au.ahadns.net","docs":"https://ahadns.com/dns-over-https/","cors":true,"filter":true,"location":"Australia"},"ahadnsLa":{"host":"doh.la.ahadns.net","docs":"https://ahadns.com/dns-over-https/","cors":true,"filter":true,"location":"Los Angeles"},"alidns":{"host":"dns.alidns.com","docs":"https://alidns.com/knowledge?type=SETTING_DOCS#umpt6","cors":true,"filter":true,"location":"China"},"amsNl":{"host":"dnsnl.alekberg.net","docs":"https://alekberg.net/doh","location":"Amsterdam"},"amsSe":{"host":"dnsse.alekberg.net","docs":"https://alekberg.net/doh","location":"Sweden"},"amsEs":{"host":"dnses.alekberg.net","docs":"https://alekberg.net/doh","location":"Spain"},"arapurayil":{"host":"dns.arapurayil.com","docs":"https://www.dns.arapurayil.com/","filter":true},"digitaleGesellschaft":{"host":"dns.digitale-gesellschaft.ch","docs":"https://www.digitale-gesellschaft.ch/dns","cors":true,"location":"Switzerland"},"dnsForFamily":{"host":"dns-doh.dnsforfamily.com","docs":"https://dnsforfamily.com/","filter":true},"dnsHome":{"host":"dns.dnshome.de","docs":"https://www.dnshome.de/doh-dot-public-resolver.php","location":"Germany"},"blahDnsCh":{"host":"doh-ch.blahdns.com","docs":"https://blahdns.com/","cors":true,"filter":true,"location":"Switzerland"},"blahDnsJp":{"host":"doh-jp.blahdns.com","docs":"https://blahdns.com/","cors":true,"filter":true,"location":"Japan"},"blahDnsDe":{"host":"doh-de.blahdns.com","docs":"https://blahdns.com/","cors":true,"filter":true,"location":"Germany"},"blahDnsFi":{"host":"doh-fi.blahdns.com","docs":"https://blahdns.com/","cors":true,"filter":true,"location":"Finland"},"cleanBrowsingSecurity":{"host":"doh.cleanbrowsing.org","docs":"https://cleanbrowsing.org/guides/dnsoverhttps","path":"/doh/security-filter/","cors":true,"filter":true},"cleanBrowsingFamily":{"host":"doh.cleanbrowsing.org","docs":"https://cleanbrowsing.org/guides/dnsoverhttps","path":"/doh/family-filter/","cors":true,"filter":true},"cleanBrowsingAdult":{"host":"doh.cleanbrowsing.org","docs":"https://cleanbrowsing.org/guides/dnsoverhttps","path":"/doh/adult-filter/","cors":true,"filter":true},"appliedPrivacy":{"host":"doh.applied-privacy.net","docs":"https://applied-privacy.net/services/dns/","path":"/query","location":"Austria"},"ffmuc":{"host":"doh.ffmuc.net","docs":"https://ffmuc.net/wiki/doku.php?id=knb:dohdot","location":"Germany"},"tiarap":{"host":"doh.tiar.app","docs":"https://tiarap.org/","filter":true},"tiarapJp":{"host":"jp.tiar.app","docs":"https://jp.tiar.app/","filter":true,"location":"Japan"},"google":{"host":"dns.google","docs":"https://developers.google.com/speed/public-dns/docs/doh/","cors":true},"he":{"host":"ordns.he.net","docs":"https://dns.he.net/","log":true},"iij":{"host":"public.dns.iij.jp","docs":"https://public.dns.iij.jp/","filter":true,"log":true,"location":"Japan"},"libredns":{"host":"doh.libredns.gr","docs":"https://libredns.gr/","location":"Germany"},"librednsAds":{"host":"doh.libredns.gr","docs":"https://libredns.gr/","path":"/ads","filter":true,"location":"Germany"},"njalla":{"host":"dns.njal.la","docs":"https://dns.njal.la/","location":"Sweden"},"opendns":{"host":"doh.opendns.com","docs":"https://support.opendns.com/hc/en-us/articles/360038086532-Using-DNS-over-HTTPS-DoH-with-OpenDNS"},"opendnsFamily":{"host":"doh.familyshield.opendns.com","docs":"https://support.opendns.com/hc/en-us/articles/360038086532-Using-DNS-over-HTTPS-DoH-with-OpenDNS","filter":true},"sebyVultr":{"host":"doh.seby.io","docs":"https://dns.seby.io/","port":8443,"cors":true,"filter":true,"location":"Sydney"},"sebyOVH":{"host":"doh-2.seby.io","docs":"https://dns.seby.io/","cors":true,"filter":true,"location":"Sydney"},"quad9":{"host":"dns10.quad9.net","docs":"https://quad9.net/service/service-addresses-and-features"},"quad9Ads":{"host":"dns.quad9.net","docs":"https://quad9.net/service/service-addresses-and-features","filter":true},"switchCh":{"host":"dns.switch.ch","docs":"https://www.switch.ch/security/info/public-dns/","filter":true,"location":"Switzerland"},"yepdns":{"host":"sg.yepdns.com","docs":"https://get.yepdns.com/","filter":true,"location":"Singapore"},"lavaDnsEU1":{"host":"eu1.dns.lavate.ch","docs":"https://dns.lavate.ch/","location":"Helsinki"},"controlId":{"host":"freedns.controld.com","docs":"https://controld.com/","path":"/p0"},"controlIdMw":{"host":"freedns.controld.com","docs":"https://controld.com/","path":"/p1","filter":true},"controlIdAds":{"host":"freedns.controld.com","docs":"https://controld.com/","path":"/p2","filter":true},"controlIdSoc":{"host":"freedns.controld.com","docs":"https://controld.com/","path":"/p3","filter":true},"uncensoredAny":{"host":"anycast.censurfridns.dk","docs":"https://blog.uncensoreddns.org/"},"uncensoredUni":{"host":"unicast.censurfridns.dk","docs":"https://blog.uncensoreddns.org/","location":"Copenhagen"},"dnssbGlobal":{"host":"doh.dns.sb","docs":"https://dns.sb/doh/","cors":true},"dbssbDeDus":{"host":"de-dus.doh.sb","docs":"https://dns.sb/doh/","cors":true,"location":"D\xfcsseldorf"},"dnssbDeFra":{"host":"de-fra.doh.sb","docs":"https://dns.sb/doh/","cors":true,"location":"Frankfurt"},"dnssbNlAms":{"host":"nl-ams.doh.sb","docs":"https://dns.sb/doh/","cors":true,"location":"Amsterdam"},"dnssbNlAms2":{"host":"nl-ams2.doh.sb","docs":"https://dns.sb/doh/","cors":true,"location":"Amsterdam"},"dnssbEeTll":{"host":"ee-tll.doh.sb","docs":"https://dns.sb/doh/","cors":true,"location":"Tallinn"},"dnssbJpKix":{"host":"jp-kix.doh.sb","docs":"https://dns.sb/doh/","cors":true,"location":"Osaka"},"dnssbHkHkg":{"host":"hk-hkg.doh.sb","docs":"https://dns.sb/doh/","cors":true,"location":"Hong Kong"},"dnssbAuSyd":{"host":"au-syd.doh.sb","docs":"https://dns.sb/doh/","cors":true,"location":"Sydney"},"dnssbUsChi":{"host":"us-chi.doh.sb","docs":"https://dns.sb/doh/","cors":true,"location":"Chicago"},"dnssbInBlr":{"host":"in-blr.doh.sb","docs":"https://dns.sb/doh/","cors":true,"location":"Bengaluru"},"dnssbSgSin":{"host":"sg-sin.doh.sb","docs":"https://dns.sb/doh/","cors":true,"location":"Singapore"},"dnssbKrSel":{"host":"kr-sel.doh.sb","docs":"https://dns.sb/doh/","cors":true,"location":"Seoul"},"dnssbRuMow":{"host":"ru-mow.doh.sb","docs":"https://dns.sb/doh/","cors":true,"location":"Moscow"},"ethlink":{"host":"eth.link","docs":"https://eth.link/","cors":true},"handshake":{"host":"query.hdns.io","docs":"https://docs.namebase.io/guides-1/resolving-handshake-1/hdns.io#dns-over-https-doh","cors":true}}')},28362:e=>{"use strict";e.exports=JSON.parse('{"name":"libp2p","version":"0.36.2","description":"JavaScript implementation of libp2p, a modular peer to peer network stack","leadMaintainer":"Jacob Heun <jacobheun@gmail.com>","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:fetch && 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 && 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:fetch":"pbjs -t static-module -w commonjs -r libp2p-fetch --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/fetch/proto.js ./src/fetch/proto.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:peer":"pbjs -t static-module -w commonjs -r libp2p-peer --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/peer-store/pb/peer.js ./src/peer-store/pb/peer.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:fetch && 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 && 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:fetch":"pbts -o src/fetch/proto.d.ts src/fetch/proto.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:peer":"pbts -o src/peer-store/pb/peer.d.ts src/peer-store/pb/peer.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","test:interop":"LIBP2P_JS=$PWD npx aegir test -t node -f ./node_modules/libp2p-interop/test/*","prepare":"npm run build","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":">=15.0.0"},"browser":{"nat-api":false},"eslintConfig":{"extends":"ipfs","ignorePatterns":["!.aegir.js","test/ts-use","*.d.ts"]},"dependencies":{"@vascosantos/moving-average":"^1.1.0","abortable-iterator":"^3.0.0","aggregate-error":"^3.1.0","any-signal":"^3.0.0","bignumber.js":"^9.0.1","class-is":"^1.1.0","datastore-core":"^7.0.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-foreach":"^0.1.1","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-sort":"^1.0.1","it-take":"^1.0.0","libp2p-crypto":"^0.21.2","libp2p-interfaces":"^4.0.0","libp2p-utils":"^0.4.0","mafmt":"^10.0.0","merge-options":"^3.0.4","mortice":"^2.0.1","multiaddr":"^10.0.0","multiformats":"^9.0.0","multistream-select":"^3.0.0","mutable-proxy":"^1.0.0","nat-api":"^0.3.1","node-forge":"^1.2.1","p-any":"^3.0.0","p-fifo":"^1.0.0","p-retry":"^4.4.0","p-settle":"^4.1.1","peer-id":"^0.16.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":"^3.0.0","uint8arrays":"^3.0.0","varint":"^6.0.0","wherearewe":"^1.0.0","xsalsa20":"^1.1.0"},"devDependencies":{"@chainsafe/libp2p-noise":"^5.0.0","@nodeutils/defaults-deep":"^1.1.0","@types/es6-promisify":"^6.0.0","@types/node":"^16.0.1","@types/node-forge":"^1.0.0","@types/varint":"^6.0.0","aegir":"^36.0.0","buffer":"^6.0.3","delay":"^5.0.0","into-stream":"^6.0.0","ipfs-http-client":"^54.0.2","it-concat":"^2.0.0","it-pair":"^1.0.0","it-pushable":"^1.4.0","libp2p":".","libp2p-bootstrap":"^0.14.0","libp2p-delegated-content-routing":"^0.11.0","libp2p-delegated-peer-routing":"^0.11.1","libp2p-interfaces-compliance-tests":"^4.0.8","libp2p-interop":"^0.7.1","libp2p-kad-dht":"^0.28.6","libp2p-mdns":"^0.18.0","libp2p-mplex":"^0.10.4","libp2p-tcp":"^0.17.0","libp2p-webrtc-star":"^0.25.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":"^12.0.1","util":"^0.12.3"},"contributors":["Vasco Santos <vasco.santos@moxy.studio>","David Dias <daviddias.p@gmail.com>","Jacob Heun <jacobheun@gmail.com>","Alex Potsides <alex@achingbrain.net>","Alan Shaw <alan@tableflip.io>","Cayman <caymannava@gmail.com>","Pedro Teixeira <i@pgte.me>","Friedel Ziegelmayer <dignifiedquire@gmail.com>","Maciej Kr\xfcger <mkg20001@gmail.com>","Hugo Dias <mail@hugodias.me>","dirkmc <dirkmdev@gmail.com>","Volker Mische <volker.mische@gmail.com>","Chris Dostert <chrisdostert@users.noreply.github.com>","zeim839 <50573884+zeim839@users.noreply.github.com>","Robert Kiel <robert.kiel@hoprnet.org>","Richard Littauer <richard.littauer@gmail.com>","a1300 <matthias-knopp@gmx.net>","Ryan Bell <ryan@piing.net>","\u1d20\u026a\u1d04\u1d1b\u1d0f\u0280 \u0299\u1d0a\u1d07\u029f\u1d0b\u029c\u1d0f\u029f\u1d0d <victorbjelkholm@gmail.com>","Andrew Nesbitt <andrewnez@gmail.com>","Franck Royer <franck@royer.one>","Thomas Eizinger <thomas@eizinger.io>","V\xedt Habada <vithabada93@gmail.com>","Giovanni T. Parra <fiatjaf@gmail.com>","acolytec3 <17355484+acolytec3@users.noreply.github.com>","Alan Smithee <ggnore.alan.smithee@gmail.com>","Elven <mon.samuel@qq.com>","Samlior <samlior@foxmail.com>","Didrik Nordstr\xf6m <didrik.nordstrom@gmail.com>","Aditya Bose <13054902+adbose@users.noreply.github.com>","TJKoury <TJKoury@gmail.com>","TheStarBoys <41286328+TheStarBoys@users.noreply.github.com>","Tiago Alves <alvesjtiago@gmail.com>","Tim Daubensch\xfctz <tim@daubenschuetz.de>","XiaoZhang <zxinmyth@gmail.com>","Yusef Napora <yusef@napora.org>","Zane Starr <zcstarr@gmail.com>","ebinks <elizabethjbinks@gmail.com>","greenSnot <greenSnot@users.noreply.github.com>","isan_rivkin <isanrivkin@gmail.com>","mayerwin <mayerwin@users.noreply.github.com>","mcclure <andi.m.mcclure@gmail.com>","patrickwoodhead <91056047+patrickwoodhead@users.noreply.github.com>","phillmac <phillmac@users.noreply.github.com>","robertkiel <robert.kiel@validitylabs.org>","shresthagrawal <34920931+shresthagrawal@users.noreply.github.com>","swedneck <40505480+swedneck@users.noreply.github.com>","tuyennhv <vutuyen2636@gmail.com>","S\xf6nke Hahn <soenkehahn@gmail.com>","Aleksei <vozhdb@gmail.com>","Bernd Strehl <bernd.strehl@gmail.com>","Chris Bratlien <chrisbratlien@gmail.com>","Cindy Wu <ciindy.wu@gmail.com>","Daijiro Wachi <daijiro.wachi@gmail.com>","Diogo Silva <fsdiogo@gmail.com>","Dmitriy Ryajov <dryajov@gmail.com>","Ethan Lam <elmemphis2000@gmail.com>","Fei Liu <liu.feiwood@gmail.com>","Felipe Martins <felipebrasil93@gmail.com>","Florian-Merle <florian.david.merle@gmail.com>","Francis Gulotta <wizard@roborooter.com>","Guy Sviry <32539816+guysv@users.noreply.github.com>","Henrique Dias <hacdias@gmail.com>","Irakli Gozalishvili <rfobic@gmail.com>","Joel Gustafson <joelg@mit.edu>","John Rees <johnrees@users.noreply.github.com>","Jo\xe3o Santos <joaosantos15@users.noreply.github.com>","Julien Bouquillon <contact@revolunet.com>","Kevin Kwok <antimatter15@gmail.com>","Kevin Lacker <lacker@gmail.com>","Lars Gierth <lgierth@users.noreply.github.com>","Leask Wong <i@leaskh.com>","Marcin Tojek <mtojek@users.noreply.github.com>","Marston Connell <34043723+TheMarstonConnell@users.noreply.github.com>","Michael Burns <5170+mburns@users.noreply.github.com>","Miguel Mota <miguelmota2@gmail.com>","Nuno Nogueira <nunofmn@gmail.com>","Philipp Muens <raute1337@gmx.de>","RasmusErik Voel Jensen <github@solsort.com>","Smite Chow <xiaopengyou@live.com>","Soeren <nikorpoulsen@gmail.com>"]}')}},__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]={exports:{}};return __webpack_modules__[e].call(r.exports,r,r.exports,__webpack_require__),r.exports}__webpack_require__.amdO={},__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})};var __webpack_exports__={};(()=>{"use strict";var e=__webpack_require__(72791),t=__webpack_require__(54164),r=__webpack_require__(12738),n=__webpack_require__(75368),i=__webpack_require__.n(n),s=__webpack_require__(80184);const o="/relay-reactjs-chat/1/chat/proto",a=new(i().Type)("SimpleChatMessage").add(new(i().Field)("timestamp",1,"uint64")).add(new(i().Field)("text",2,"string"));const c=function(){const[t,n]=e.useState(void 0),[i,c]=e.useState("None"),[u,l]=e.useState(0),[h,d]=e.useState([]);e.useEffect((()=>{t||"None"===i&&(c("Starting"),r.Waku.create({bootstrap:{default:!0}}).then((e=>{n(e),c("Connecting"),e.waitForRemotePeer().then((()=>{c("Ready")}))})))}),[t,i]);const f=e.useCallback((e=>{if(!e.payload)return;const{text:t,timestamp:r}=a.decode(e.payload),n=new Date;n.setTime(r);const i={text:t,timestamp:n};d((e=>[i].concat(e)))}),[]);return e.useEffect((()=>{if(t)return t.relay.addObserver(f,[o]),function(){t.relay.deleteObserver(f,[o])}}),[t,i,f]),(0,s.jsx)("div",{className:"App",children:(0,s.jsxs)("header",{className:"App-header",children:[(0,s.jsx)("p",{children:i}),(0,s.jsx)("button",{onClick:()=>{"Ready"===i&&(function(e,t,n){const i=n.getTime(),s=a.create({timestamp:i,text:e}),c=a.encode(s).finish();return r.WakuMessage.fromBytes(c,o).then((e=>t.relay.send(e)))}("Here is message #".concat(u),t,new Date).then((()=>console.log("Message sent"))),l(u+1))},disabled:"Ready"!==i,children:"Send Message"}),(0,s.jsx)("ul",{children:h.map((e=>(0,s.jsx)("li",{children:(0,s.jsxs)("p",{children:[e.timestamp.toString(),": ",e.text]})},e.timestamp.valueOf())))})]})})};t.render((0,s.jsx)(e.StrictMode,{children:(0,s.jsx)(c,{})}),document.getElementById("root"))})()})();
//# sourceMappingURL=main.9a7bb4e0.js.map