mirror of
https://github.com/waku-org/js-waku.git
synced 2025-01-17 16:00:59 +00:00
3 lines
1.2 MiB
3 lines
1.2 MiB
/*! For license information please see main.e8560a6b.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/store-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 o=e.encrypt(r.slice(t,i),e.session);yield o}}},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:o,valid:s}=await e.decrypt(r.slice(t,i),e.session);if(!s)throw new Error("Failed to validate decrypted chunk");yield o}}}},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)),o=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,o.concat)([e.ne,e.ciphertext],e.ne.length+e.ciphertext.length)},t.encode1=function(e){return(0,o.concat)([e.ne,e.ns,e.ciphertext],e.ne.length+e.ns.length+e.ciphertext.length)},t.encode2=function(e){return(0,o.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),o=r(83605),s=r(88919),a=r(46400);t.IKHandshake=class{constructor(e,t,r,i,o,s,a,c){this.isInitiator=e,this.payload=t,this.prologue=r,this.staticKeypair=i,this.connection=o,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,s),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 s=await(0,o.decodePayload)(r);this.remotePeer=this.remotePeer||await(0,o.getPeerIdFromPayload)(s),await(0,o.verifySignedPayload)(this.session.hs.rs,s,this.remotePeer),this.setRemoteEarlyData(s.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 s.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,o.decodePayload)(n);this.remotePeer=this.remotePeer||await(0,o.getPeerIdFromPayload)(e),await(0,o.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 s.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),o=r(46400),s=r(75698);class a extends n.XXHandshake{constructor(e,t,r,n,i,o,s,a,c){super(e,t,r,n,i,s,c),a&&(this.ephemeralKeys=a),this.initialMsg=o}async propose(){if(this.isInitiator)this.xx.sendMessage(this.session,new Uint8Array(0),this.ephemeralKeys),(0,o.logger)("XX Fallback Stage 0 - Initialized state as the first message was sent by initiator."),(0,o.logLocalEphemeralKeys)(this.session.hs.e);else{(0,o.logger)("XX Fallback Stage 0 - Responder decoding initial msg from IK.");const e=(0,s.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,o.logger)("XX Fallback Stage 0 - Responder used received message from IK."),(0,o.logRemoteEphemeralKey)(this.session.hs.re)}}async exchange(){if(this.isInitiator){const t=(0,s.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,o.logger)("XX Fallback Stage 1 - Initiator used received message from IK."),(0,o.logRemoteEphemeralKey)(this.session.hs.re),(0,o.logRemoteStaticKey)(this.session.hs.rs),(0,o.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,o.logger)("All good with the signature!")}else(0,o.logger)("XX Fallback Stage 1 - Responder start"),await super.exchange(),(0,o.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),o=r(46400),s=r(75698);t.XXHandshake=class{constructor(e,t,r,i,o,s,a){this.isInitiator=e,this.payload=t,this.prologue=r,this.staticKeypair=i,this.connection=o,s&&(this.remotePeer=s),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,o.logLocalStaticKeys)(this.session.hs.s),this.isInitiator){(0,o.logger)("Stage 0 - Initiator starting to send first message.");const e=this.xx.sendMessage(this.session,new Uint8Array(0));this.connection.writeLP((0,s.encode0)(e)),(0,o.logger)("Stage 0 - Initiator finished sending first message."),(0,o.logLocalEphemeralKeys)(this.session.hs.e)}else{(0,o.logger)("Stage 0 - Responder waiting to receive first message...");const e=(0,s.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,o.logger)("Stage 0 - Responder received first message."),(0,o.logRemoteEphemeralKey)(this.session.hs.re)}}async exchange(){if(this.isInitiator){(0,o.logger)("Stage 1 - Initiator waiting to receive first message from responder...");const t=(0,s.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,o.logger)("Stage 1 - Initiator received the message."),(0,o.logRemoteEphemeralKey)(this.session.hs.re),(0,o.logRemoteStaticKey)(this.session.hs.rs),(0,o.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)(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,o.logger)("All good with the signature!")}else{(0,o.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,s.encode1)(e)),(0,o.logger)("Stage 1 - Responder sent the second handshake message with signed payload."),(0,o.logLocalEphemeralKeys)(this.session.hs.e)}}async finish(){if(this.isInitiator){(0,o.logger)("Stage 2 - Initiator sending third handshake message.");const e=this.xx.sendMessage(this.session,this.payload);this.connection.writeLP((0,s.encode2)(e)),(0,o.logger)("Stage 2 - Initiator sent message with signed payload.")}else{(0,o.logger)("Stage 2 - Responder waiting for third handshake message...");const t=(0,s.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,o.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,o.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}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.AbstractHandshake=t.MAX_NONCE=t.MIN_NONCE=void 0;const s=o(r(52029)),a=o(r(24888)),c=r(53642),u=r(98779),l=r(62110),d=r(79421),h=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 o=this.nonceToBytes(r);return new c.ChaCha20Poly1305(e).seal(o,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 o=this.nonceToBytes(r),s=new c.ChaCha20Poly1305(e).open(o,i,n);return s?{plaintext:s,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=s.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,h.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,d.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,h.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 o extends i.AbstractHandshake{initSession(e,t,r,n){const i=this.createEmptyKey();let o;return o=e?this.initializeInitiator(t,r,n,i):this.initializeResponder(t,r,n,i),{hs:o,i:e,mc:0}}sendMessage(e,t){let r;if(0===e.mc)r=this.writeMessageA(e.hs,t);else if(1===e.mc){const{messageBuffer:n,h:i,cs1:o,cs2:s}=this.writeMessageB(e.hs,t);r=n,e.h=i,e.cs1=o,e.cs2=s}else{if(!(e.mc>1))throw new Error("Session invalid.");if(e.i){if(!e.cs1)throw new Error("CS1 (cipher state) is not defined");r=this.writeMessageRegular(e.cs1,t)}else{if(!e.cs2)throw new Error("CS2 (cipher state) is not defined");r=this.writeMessageRegular(e.cs2,t)}}return e.mc++,r}recvMessage(e,t){let r=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:o,h:s,cs1:a,cs2:c}=this.readMessageB(e.hs,t);r=i,n=o,e.h=s,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,o=this.encryptAndHash(e.ss,i);this.mixKey(e.ss,this.dh(e.s.privateKey,e.rs));return{ne:r,ns:o,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),o={ne:r,ns:this.createEmptyKey(),ciphertext:i},{cs1:s,cs2:a}=this.split(e.ss);return{messageBuffer:o,cs1:s,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:o,valid:s}=this.decryptAndHash(e.ss,t.ciphertext);return{plaintext:o,valid:i&&s}}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:o,cs2:s}=this.split(e.ss);return{h:e.ss.h,valid:i,plaintext:r,cs1:o,cs2:s}}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=o},22757:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XX=void 0;const n=r(83605),i=r(68006);class o 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 o=e.e.publicKey;this.mixHash(e.ss,o);return{ne:o,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,o=this.encryptAndHash(e.ss,i);this.mixKey(e.ss,this.dh(e.s.privateKey,e.re));return{ne:r,ns:o,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),o={ne:this.createEmptyKey(),ns:n,ciphertext:i},{cs1:s,cs2:a}=this.split(e.ss);return{h:e.ss.h,messageBuffer:o,cs1:s,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:o,valid:s}=this.decryptAndHash(e.ss,t.ciphertext);return{plaintext:o,valid:i&&s}}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:o,valid:s}=this.decryptAndHash(e.ss,t.ciphertext),{cs1:a,cs2:c}=this.split(e.ss);return{h:e.ss.h,plaintext:o,valid:i&&s,cs1:a,cs2:c}}initSession(e,t,r){const n=this.createEmptyKey(),i=new Uint8Array(32);let o;return o=e?this.initializeInitiator(t,r,i,n):this.initializeResponder(t,r,i,n),{hs:o,i:e,mc:0}}sendMessage(e,t,r){let n;if(0===e.mc)n=this.writeMessageA(e.hs,t,r);else if(1===e.mc)n=this.writeMessageB(e.hs,t);else if(2===e.mc){const{h:r,messageBuffer:i,cs1:o,cs2:s}=this.writeMessageC(e.hs,t);n=i,e.h=r,e.cs1=o,e.cs2=s}else{if(!(e.mc>2))throw new Error("Session invalid.");if(e.i){if(!e.cs1)throw new Error("CS1 (cipher state) is not defined");n=this.writeMessageRegular(e.cs1,t)}else{if(!e.cs2)throw new Error("CS2 (cipher state) is not defined");n=this.writeMessageRegular(e.cs2,t)}}return e.mc++,n}recvMessage(e,t){let r=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:o,valid:s,cs1:a,cs2:c}=this.readMessageC(e.hs,t);r=o,n=s,e.h=i,e.cs1=a,e.cs2=c}return e.mc++,{plaintext:r,valid:n}}}t.XX=o},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 o=r(97806);i(r(97806),t),t.NOISE=new o.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)),o=r(77788),s=r(82051);let a;t.logger=(0,i.default)("libp2p:noise"),a=o.DUMP_SESSION_KEYS?t.logger:()=>{},t.logLocalStaticKeys=function(e){a("LOCAL_STATIC_PUBLIC_KEY ".concat((0,s.toString)(e.publicKey,"hex"))),a("LOCAL_STATIC_PRIVATE_KEY ".concat((0,s.toString)(e.privateKey,"hex")))},t.logLocalEphemeralKeys=function(e){e?(a("LOCAL_PUBLIC_EPHEMERAL_KEY ".concat((0,s.toString)(e.publicKey,"hex"))),a("LOCAL_PRIVATE_EPHEMERAL_KEY ".concat((0,s.toString)(e.privateKey,"hex")))):a("Missing local ephemeral keys.")},t.logRemoteStaticKey=function(e){a("REMOTE_STATIC_PUBLIC_KEY ".concat((0,s.toString)(e,"hex")))},t.logRemoteEphemeralKey=function(e){a("REMOTE_EPHEMERAL_PUBLIC_KEY ".concat((0,s.toString)(e,"hex")))},t.logCipherState=function(e){e.cs1&&e.cs2?(a("CIPHER_STATE_1 ".concat(e.cs1.n," ").concat((0,s.toString)(e.cs1.k,"hex"))),a("CIPHER_STATE_2 ".concat(e.cs2.n," ").concat((0,s.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}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.Noise=void 0;const a=o(r(52029)),c=s(r(85551)),u=s(r(85907)),l=s(r(90351)),d=s(r(79023)),h=r(44709),f=r(8382),p=r(77827),y=r(7548),g=r(83605),m=r(75698),b=r(87477),v=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===v.KeyCache.load(e.remotePeer)&&(n=!1),!n)return await this.performXXHandshake(e,r);{const{remotePeer:n,connection:o,isInitiator:s}=e,a=new p.IKHandshake(s,r,this.prologue,this.staticKeys,o,null!==(t=v.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:o,connection:s}=e,a=new y.XXFallbackHandshake(i,t,this.prologue,this.staticKeys,s,r,o,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,o=new f.XXHandshake(r,t,this.prologue,this.staticKeys,i,n);try{await o.propose(),await o.exchange(),await o.finish(),this.useNoisePipes&&o.remotePeer&&v.KeyCache.store(o.remotePeer,o.getRemoteStaticKey())}catch(s){throw new Error("Error occurred during XX handshake: ".concat(s.message))}return o}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,d.default)(r,l.default,(0,b.encryptStream)(t),(0,h.encode)({lengthEncoder:m.uint16BEEncode}),i,(0,h.decode)({lengthDecoder:m.uint16BEDecode}),l.default,(0,b.decryptStream)(t),r),n}}},14660:function(e,t,r){"use strict";var n,i,o;i=[r(80886)],void 0===(o="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 o={};return o.NoiseHandshakePayload=function(){function o(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 o.prototype.identityKey=n.newBuffer([]),o.prototype.identitySig=n.newBuffer([]),o.prototype.data=n.newBuffer([]),o.create=function(e){return new o(e)},o.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},o.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},o.decode=function(e,r){e instanceof t||(e=t.create(e));for(var n=void 0===r?e.len:e.pos+r,o=new i.pb.NoiseHandshakePayload;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:o.identityKey=e.bytes();break;case 2:o.identitySig=e.bytes();break;case 3:o.data=e.bytes();break;default:e.skipType(7&s)}}return o},o.decodeDelimited=function(e){return e instanceof t||(e=new t(e)),this.decode(e,e.uint32())},o.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},o.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},o.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},o.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},o}(),o}(),i})?n.apply(t,i):n)||(e.exports=o)},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}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.isValidPublicKey=t.getHkdf=t.verifySignedPayload=t.getHandshakePayload=t.decodePayload=t.getPeerIdFromPayload=t.signPayload=t.createHandshakePayload=t.getPayload=t.generateKeypair=void 0;const a=r(52497),c=r(24888),u=o(r(52029)),l=s(r(90190)),d=r(14660),h=r(98779),f=r(46765),p=r(62110),y=d.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 b(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,b(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=b,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,h.equals)(r.id,e)}(r.id,n))throw new Error("Peer ID doesn't match libp2p public key.");const i=b(e),o=await l.default.createFromPubKey(n);if(!t.identitySig||!await o.pubKey.verify(i,t.identitySig))throw new Error("Static key doesn't match to peer that signed payload!");return o},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:()=>T});let n=!1,i=!1;const o={debug:1,default:2,info:2,warning:3,error:4,off:5};let s=o.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 d="0123456789abcdef";class h{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==o[r]&&this.throwArgumentError("invalid log level name","logLevel",e),s>o[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(h.levels.DEBUG,t)}info(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this._log(h.levels.INFO,t)}warn(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this._log(h.levels.WARNING,t)}makeError(e,t,r){if(i)return this.makeError("censored error",t,{});t||(t=h.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+=d[t[e]>>4],r+=d[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 o=e;let s="";switch(t){case l.NUMERIC_FAULT:{s="NUMERIC_FAULT";const t=e;switch(t){case"overflow":case"underflow":case"division-by-zero":s+="-"+t;break;case"negative-power":case"negative-width":s+="-unsupported";break;case"unbound-bitwise-result":s+="-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:s=t}s&&(e+=" [ See: https://links.ethers.org/v5-errors-"+s+" ]"),n.length&&(e+=" ("+n.join(", ")+")");const a=new Error(e);return a.reason=o,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,h.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",h.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,h.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,h.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,r){r=r?": "+r:"",e<t&&this.throwError("missing argument"+r,h.errors.MISSING_ARGUMENT,{count:e,expectedCount:t}),e>t&&this.throwError("too many arguments"+r,h.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){e!==Object&&null!=e||this.throwError("missing new",h.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",h.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):e!==Object&&null!=e||this.throwError("missing new",h.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return a||(a=new h("logger/5.6.0")),a}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",h.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),n){if(!e)return;this.globalLogger().throwError("error censorship permanent",h.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}i=!!e,n=!!t}static setLogLevel(e){const t=o[e.toLowerCase()];null!=t?s=t:h.globalLogger().warn("invalid log level - "+e)}static from(e){return new h(e)}}h.errors=l,h.levels=u;const f=new h("bytes/5.6.1");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)||b(e)}function m(e){return"number"===typeof e&&e==e&&e%1===0}function b(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 v(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="0"+r:"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 b(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 _(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(b(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 S=new h("rlp/5.6.0");function I(e){const t=[];for(;e;)t.unshift(255&e),e>>=8;return t}function A(e,t,r){let n=0;for(let i=0;i<r;i++)n=256*n+e[t+i];return n}function R(e){if(Array.isArray(e)){let t=[];if(e.forEach((function(e){t=t.concat(R(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)||S.throwArgumentError("RLP object must be BytesLike","object",e);const t=Array.prototype.slice.call(v(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 T(e){return _(R(e))}function C(e,t,r,n){const i=[];for(;r<t+1+n;){const o=P(e,r);i.push(o.result),(r+=o.consumed)>t+1+n&&S.throwError("child data too short",h.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:i}}function P(e,t){if(0===e.length&&S.throwError("data too short",h.errors.BUFFER_OVERRUN,{}),e[t]>=248){const r=e[t]-247;t+1+r>e.length&&S.throwError("data short segment too short",h.errors.BUFFER_OVERRUN,{});const n=A(e,t+1,r);return t+1+r+n>e.length&&S.throwError("data long segment too short",h.errors.BUFFER_OVERRUN,{}),C(e,t,t+1+r,r+n)}if(e[t]>=192){const r=e[t]-192;return t+1+r>e.length&&S.throwError("data array too short",h.errors.BUFFER_OVERRUN,{}),C(e,t,t+1,r)}if(e[t]>=184){const r=e[t]-183;t+1+r>e.length&&S.throwError("data array too short",h.errors.BUFFER_OVERRUN,{});const n=A(e,t+1,r);t+1+r+n>e.length&&S.throwError("data array too short",h.errors.BUFFER_OVERRUN,{});return{consumed:1+r+n,result:_(e.slice(t+1+r,t+1+r+n))}}if(e[t]>=128){const r=e[t]-128;t+1+r>e.length&&S.throwError("data too short",h.errors.BUFFER_OVERRUN,{});return{consumed:1+r,result:_(e.slice(t+1,t+1+r))}}return{consumed:1,result:_(e[t])}}function k(e){const t=v(e),r=P(t,0);return r.consumed!==t.length&&S.throwArgumentError("invalid rlp data","data",e),r.result}},19814:e=>{"use strict";e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var n=0;n<e.length;n++){var i=e.charAt(n),o=i.charCodeAt(0);if(255!==t[o])throw new TypeError(i+" is ambiguous");t[o]=n}var s=e.length,a=e.charAt(0),c=Math.log(s)/Math.log(256),u=Math.log(256)/Math.log(s);function l(e){if("string"!==typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;var r=0;if(" "!==e[r]){for(var n=0,i=0;e[r]===a;)n++,r++;for(var o=(e.length-r)*c+1>>>0,u=new Uint8Array(o);e[r];){var l=t[e.charCodeAt(r)];if(255===l)return;for(var d=0,h=o-1;(0!==l||d<i)&&-1!==h;h--,d++)l+=s*u[h]>>>0,u[h]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=d,r++}if(" "!==e[r]){for(var f=o-i;f!==o&&0===u[f];)f++;for(var p=new Uint8Array(n+(o-f)),y=n;f!==o;)p[y++]=u[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,o=t.length;i!==o&&0===t[i];)i++,r++;for(var c=(o-i)*u+1>>>0,l=new Uint8Array(c);i!==o;){for(var d=t[i],h=0,f=c-1;(0!==d||h<n)&&-1!==f;f--,h++)d+=256*l[f]>>>0,l[f]=d%s>>>0,d=d/s>>>0;if(0!==d)throw new Error("Non-zero carry");n=h,i++}for(var p=c-n;p!==c&&0===l[p];)p++;for(var y=a.repeat(r);p<c;++p)y+=e.charAt(l[p]);return y},decodeUnsafe:l,decode:function(e){var t=l(e);if(t)return t;throw new Error("Non-base"+s+" character")}}}},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)),o=BigInt(0),s=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 d=a**BigInt(256),h=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 S))throw new TypeError("ExtendedPoint#fromAffine: expected Point");return e.equals(S.ZERO)?m.ZERO:new m(e.x,e.y,s,B(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=x(e.reduce(((e,n,i)=>n===o?e:(r[i]=e,B(e*n,t))),s),t);return e.reduceRight(((e,n,i)=>n===o?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 this.toAffineBatch(e).map(this.fromAffine)}equals(e){b(e);const{x:t,y:r,z:n}=this,{x:i,y:o,z:s}=e,a=B(t*s),c=B(i*n),u=B(r*s),l=B(o*n);return a===c&&u===l}negate(){return new m(B(-this.x),this.y,this.z,B(-this.t))}double(){const{x:e,y:t,z:r}=this,{a:n}=l,i=B(e**a),o=B(t**a),s=B(a*B(r**a)),c=B(n*i),u=B(B((e+t)**a)-i-o),d=c+o,h=d-s,f=c-o,p=B(u*h),y=B(d*f),g=B(u*f),b=B(h*d);return new m(p,y,b,g)}add(e){b(e);const{x:t,y:r,z:n,t:i}=this,{x:s,y:c,z:u,t:l}=e,d=B((r-t)*(c+s)),h=B((r+t)*(c-s)),f=B(h-d);if(f===o)return this.double();const p=B(n*a*l),y=B(i*a*u),g=y+p,v=h+d,w=y-p,E=B(g*f),_=B(v*w),S=B(g*w),I=B(f*v);return new m(E,_,I,S)}subtract(e){return this.add(e.negate())}precomputeWindow(e){const t=1+256/e,r=[];let n=this,i=n;for(let o=0;o<t;o++){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=S.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&&_.get(t);n||(n=this.precomputeWindow(r),t&&1!==r&&(n=m.normalizeZ(n),_.set(t,n)));let i=m.ZERO,o=m.ZERO;const a=1+256/r,c=2**(r-1),u=BigInt(2**r-1),l=2**r,d=BigInt(r);for(let h=0;h<a;h++){const t=h*c;let r=Number(e&u);if(e>>=d,r>c&&(r-=l,e+=s),0===r){let e=n[t];h%2&&(e=e.negate()),o=o.add(e)}else{let e=n[t+Math.abs(r)-1];r<0&&(e=e.negate()),i=i.add(e)}}return m.normalizeZ([i,o])[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===o)return n;if(this.equals(n)||t===s)return this;if(this.equals(r))return this.wNAF(t);let i=n,a=this;for(;t>o;)t&s&&(i=i.add(a)),a=a.double(),t>>=s;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]:x(this.z);const{x:t,y:r,z:n}=this,i=B(t*e),o=B(r*e);if(B(n*e)!==s)throw new Error("invZ was invalid");return new S(i,o)}fromRistrettoBytes(){w()}toRistrettoBytes(){w()}fromRistrettoHash(){w()}}function b(e){if(!(e instanceof m))throw new TypeError("ExtendedPoint expected")}function v(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,s,B(l.Gx*l.Gy)),m.ZERO=new m(o,s,s,o);class E{constructor(e){this.ep=e}static calcElligatorRistrettoMap(e){const{d:t}=l,r=B(h*e*e),n=B((r+s)*y);let i=BigInt(-1);const o=B((i-t*r)*B(r+t));let{isValid:a,value:c}=U(n,o),u=B(c*e);O(u)||(u=B(-u)),a||(c=u),a||(i=r);const d=B(i*(r-s)*g-o),p=c*c,b=B((c+c)*o),v=B(d*f),w=B(s-p),E=B(s+p);return new m(B(b*E),B(w*v),B(v*E),B(b*w))}static hashToCurve(e){const t=D((e=F(e,64)).slice(0,32)),r=this.calcElligatorRistrettoMap(t),n=D(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=D(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=B(i*i),c=B(s+t*a),u=B(s-t*a),d=B(c*c),h=B(u*u),f=B(t*r*d-h),{isValid:p,value:y}=j(B(f*h)),g=B(y*u),b=B(y*g*f);let v=B((i+i)*g);O(v)&&(v=B(-v));const w=B(c*b),_=B(v*w);if(!p||O(_)||w===o)throw new Error(n);return new E(new m(v,w,s,_))}toRawBytes(){let{x:e,y:t,z:r,t:n}=this.ep;const i=B(B(r+t)*B(r-t)),o=B(e*t),{value:s}=j(B(i*o**a)),c=B(s*i),u=B(s*o),l=B(c*u*n);let d;if(O(n*l)){let r=B(t*h),n=B(e*h);e=r,t=n,d=B(c*p)}else d=u;O(e*l)&&(t=B(-t));let f=B((r-t)*d);return O(f)&&(f=B(-f)),k(f)}toHex(){return T(this.toRawBytes())}toString(){return this.toHex()}equals(e){v(e);const t=this.ep,r=e.ep,n=B(t.x*r.y)===B(t.y*r.x),i=B(t.y*r.y)===B(t.x*r.x);return n||i}add(e){return v(e),new E(this.ep.add(e.ep))}subtract(e){return v(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 _=new WeakMap;class S{constructor(e,t){this.x=e,this.y=t}_setWindowSize(e){this._WINDOW_SIZE=e,_.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 o=N(i);if(t&&o>=n)throw new Error("Expected 0 < hex < P");if(!t&&o>=d)throw new Error("Expected 0 < hex < 2**256");const a=B(o*o),c=B(a-s),u=B(r*a+s);let{isValid:h,value:f}=U(c,u);if(!h)throw new Error("Point.fromHex: invalid y coordinate");const p=(f&s)===s;return 0!==(128&e[31])!==p&&(f=B(-f)),new S(f,o)}static async fromPrivateKey(e){return(await H(e)).point}toRawBytes(){const e=k(this.y);return e[31]|=this.x&s?128:0,e}toHex(){return T(this.toRawBytes())}toX25519(){const{y:e}=this;return k(B((s+e)*x(s-e)))}isTorsionFree(){return m.fromAffine(this).isTorsionFree()}equals(e){return this.x===e.x&&this.y===e.y}negate(){return new S(B(-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=S,S.BASE=new S(l.Gx,l.Gy),S.ZERO=new S(o,s);class I{constructor(e,t){this.r=e,this.s=t,this.assertValidity()}static fromHex(e){const t=F(e,64),r=S.fromHex(t.slice(0,32),!1),n=N(t.slice(32,64));return new I(r,n)}assertValidity(){const{r:e,s:t}=this;if(!(e instanceof S))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 T(this.toRawBytes())}}function A(){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 o=0,s=0;o<t.length;o++){const e=t[o];i.set(e,s),s+=e.length}return i}t.Signature=I;const R=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function T(e){if(!(e instanceof Uint8Array))throw new Error("Uint8Array expected");let t="";for(let r=0;r<e.length;r++)t+=R[e[r]];return t}function C(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),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");t[r]=o}return t}function P(e){return C(e.toString(16).padStart(64,"0"))}function k(e){return P(e).reverse()}function O(e){return(B(e)&s)===s}function N(e){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");return BigInt("0x"+T(Uint8Array.from(e).reverse()))}function D(e){return B(N(e)&a**c-s)}function B(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l.P;const r=e%t;return r>=o?r:t+r}function x(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l.P;if(e===o||t<=o)throw new Error("invert: expected positive integers, got n=".concat(e," mod=").concat(t));let r=B(e,t),n=t,i=o,a=s,c=s,u=o;for(;r!==o;){const e=n/r,t=n%r,o=i-c*e,s=a-u*e;n=r,r=t,i=c,a=u,c=o,u=s}const d=n;if(d!==s)throw new Error("invert: does not exist");return B(i,t)}function L(e,t){const{P:r}=l;let n=e;for(;t-- >o;)n*=n,n%=r;return n}function M(e){const{P:t}=l,r=BigInt(5),n=BigInt(10),i=BigInt(20),o=BigInt(40),c=BigInt(80),u=e*e%t*e%t,d=L(u,a)*u%t,h=L(d,s)*e%t,f=L(h,r)*h%t,p=L(f,n)*f%t,y=L(p,i)*p%t,g=L(y,o)*y%t,m=L(g,c)*g%t,b=L(m,c)*g%t,v=L(b,n)*f%t;return{pow_p_5_8:L(v,a)*e%t,b2:u}}function U(e,t){const r=B(t*t*t),n=B(r*r*t);let i=B(e*r*M(e*n).pow_p_5_8);const o=B(t*i*i),s=i,a=B(i*h),c=o===e,u=o===B(-e),l=o===B(-e*h);return c&&(i=s),(u||l)&&(i=a),O(i)&&(i=B(-i)),{isValid:c||u,value:i}}function j(e){return U(s,e)}async function K(){const e=await t.utils.sha512(A(...arguments)),r=N(e);return B(r,l.l)}function F(e,t){const r=e instanceof Uint8Array?Uint8Array.from(e):C(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(o<e)return e}else if(o<=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 H(e){if(32!==(e="bigint"===typeof e||"number"===typeof e?P(V(e,d)):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),o=B(N(n),l.l),s=S.BASE.multiply(o),a=s.toRawBytes();return{head:n,prefix:i,scalar:o,point:s,pointBytes:a}}function z(e,t,r){const n=B(e*(t-r));return[t=B(t-n),r=B(r+n)]}t.getPublicKey=async function(e){return(await H(e)).pointBytes},t.sign=async function(e,t){e=F(e);const{prefix:r,scalar:n,pointBytes:i}=await H(t),o=await K(r,e),s=S.BASE.multiply(o),a=B(o+await K(s.toRawBytes(),i,e)*n,l.l);return new I(s,a).toRawBytes()},t.verify=async function(e,t,r){t=F(t),r instanceof S||(r=S.fromHex(r,!1));const{r:n,s:i}=e instanceof I?e.assertValidity():I.fromHex(e),o=m.BASE.multiplyUnsafe(i),s=await K(n.toRawBytes(),r.toRawBytes(),t),a=m.fromAffine(r).multiplyUnsafe(s);return m.fromAffine(n).add(a).subtract(o).multiplyUnsafe(l.h).equals(m.ZERO)},t.getSharedSecret=async function(e,r){const{head:n}=await H(e),i=S.fromHex(r).toX25519();return t.curve25519.scalarMult(n,i)},S.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 d,h=s,f=o,p=n,y=s,g=o;for(let l=BigInt(254);l>=o;l--){const e=i>>l&s;g^=e,d=z(g,h,p),h=d[0],p=d[1],d=z(g,f,y),f=d[0],y=d[1],g=e;const t=h+f,r=B(t*t),n=h-f,o=B(n*n),m=r-o,b=p+y,v=B((p-y)*t),w=B(b*n);p=B((v+w)**a),y=B(u*(v-w)**a),h=B(r*o),f=B(m*(r+B(c*m)))}d=z(g,h,p),h=d[0],p=d[1],d=z(g,f,y),f=d[0],y=d[1];const{pow_p_5_8:m,b2:b}=M(f),v=B(L(m,BigInt(3))*b);return B(h*v)}(function(e){const t=F(e,32);return t[31]&=127,N(t)}(t),N(q(F(e,32))));if(r===o)throw new Error("Invalid private or public key received");return function(e){return k(B(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:T,getExtendedPublicKey:H,mod:B,invert:x,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=B(N(e),l.l);if(t===o||t===s)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]:S.BASE;const r=t.equals(S.BASE)?t:new S(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)),o=BigInt(0),s=BigInt(1),a=BigInt(2),c=BigInt(3),u=BigInt(8),l=a**BigInt(256),d={a:o,b:BigInt(7),P:l-a**BigInt(32)-BigInt(977),n:l-BigInt("432420386565659656852420866394968145599"),h:s,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee")};function h(e){const{a:t,b:r}=d,n=N(e*e),i=N(n*e);return N(i+t*e+r)}t.CURVE=d;const f=d.a===o;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,s)}static toAffineBatch(e){const t=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d.P;const r=new Array(e.length),n=B(e.reduce(((e,n,i)=>n===o?e:(r[i]=e,N(e*n,t))),s),t);return e.reduceRight(((e,n,i)=>n===o?e:(r[i]=N(e*r[i],t),N(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:o,z:s}=e,c=N(n**a),u=N(s**a),l=N(t*u),d=N(i*c),h=N(N(r*s)*u),f=N(N(o*n)*c);return l===d&&h===f}negate(){return new p(this.x,N(-this.y),this.z)}double(){const{x:e,y:t,z:r}=this,n=N(e**a),i=N(t**a),o=N(i**a),s=N(a*(N((e+i)**a)-n-o)),l=N(c*n),d=N(l**a),h=N(d-a*s),f=N(l*(s-h)-u*o),y=N(a*t*r);return new p(h,f,y)}add(e){if(!(e instanceof p))throw new TypeError("JacobianPoint expected");const{x:t,y:r,z:n}=this,{x:i,y:s,z:c}=e;if(i===o||s===o)return this;if(t===o||r===o)return e;const u=N(n**a),l=N(c**a),d=N(t*l),h=N(i*u),f=N(N(r*c)*l),y=N(N(s*n)*u),g=N(h-d),m=N(y-f);if(g===o)return m===o?this.double():p.ZERO;const b=N(g**a),v=N(g*b),w=N(d*b),E=N(m**a-v-a*w),_=N(m*(w-E)-f*v),S=N(n*c*g);return new p(E,_,S)}subtract(e){return this.add(e.negate())}multiplyUnsafe(e){let t=O(e);p.BASE;const r=p.ZERO;if(t===o)return r;if(t===s)return this;if(!f){let e=r,n=this;for(;t>o;)t&s&&(e=e.add(n)),n=n.double(),t>>=s;return e}let{k1neg:n,k1:i,k2neg:a,k2:c}=M(t),u=r,l=r,h=this;for(;i>o||c>o;)i&s&&(u=u.add(h)),c&s&&(l=l.add(h)),h=h.double(),i>>=s,c>>=s;return n&&(u=u.negate()),a&&(l=l.negate()),l=new p(N(l.x*d.beta),l.y,l.z),u.add(l)}precomputeWindow(e){const t=f?128/e+1:256/e+1,r=[];let n=this,i=n;for(let o=0;o<t;o++){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,o=p.ZERO;const a=1+(f?128/r:256/r),c=2**(r-1),u=BigInt(2**r-1),l=2**r,d=BigInt(r);for(let h=0;h<a;h++){const t=h*c;let r=Number(e&u);if(e>>=d,r>c&&(r-=l,e+=s),0===r){let e=n[t];h%2&&(e=e.negate()),o=o.add(e)}else{let e=n[t+Math.abs(r)-1];r<0&&(e=e.negate()),i=i.add(e)}}return{p:i,f:o}}multiply(e,t){let r,n,i=O(e);if(f){const{k1neg:e,k1:o,k2neg:s,k2:a}=M(i);let{p:c,f:u}=this.wNAF(o,t),{p:l,f:h}=this.wNAF(a,t);e&&(c=c.negate()),s&&(l=l.negate()),l=new p(N(l.x*d.beta),l.y,l.z),r=c.add(l),n=u.add(h)}else{const{p:e,f:o}=this.wNAF(i,t);r=e,n=o}return p.normalizeZ([r,n])[0]}toAffine(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:B(this.z);const{x:t,y:r,z:n}=this,i=e,o=N(i*i),a=N(o*i),c=N(t*o),u=N(r*a);if(N(n*i)!==s)throw new Error("invZ was invalid");return new g(c,u)}}p.BASE=new p(d.Gx,d.Gy,s),p.ZERO=new p(o,s,o);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.subarray(1));if(!F(r))throw new Error("Point is not on curve");let n=function(e){const{P:t}=d,r=BigInt(6),n=BigInt(11),i=BigInt(22),o=BigInt(23),s=BigInt(44),u=BigInt(88),l=e*e*e%t,h=l*l*e%t,f=D(h,c)*h%t,p=D(f,c)*h%t,y=D(p,a)*l%t,g=D(y,n)*y%t,m=D(g,i)*g%t,b=D(m,s)*m%t,v=D(b,u)*b%t,w=D(v,s)*m%t,E=D(w,c)*h%t,_=D(E,o)*g%t,S=D(_,r)*l%t;return D(S,a)}(h(r));const i=(n&s)===s;if(t)i&&(n=N(-n));else{1===(1&e[0])!==i&&(n=N(-n))}const o=new g(r,n);return o.assertValidity(),o}static fromUncompressedHex(e){const t=P(e.subarray(1,33)),r=P(e.subarray(33,65)),n=new g(t,r);return n.assertValidity(),n}static fromHex(e){const t=k(e),r=t.length,n=t[0];if(32===r||33===r&&(2===n||3===n))return this.fromCompressedHex(t);if(65===r&&4===n)return this.fromUncompressedHex(t);throw new Error("Point.fromHex: received invalid point. Expected 32-33 compressed bytes or 65 uncompressed bytes, not ".concat(r))}static fromPrivateKey(e){return g.BASE.multiply(q(e))}static fromSignature(e,t,r){const n=U(e=k(e)),{r:i,s:s}=z(t);if(0!==r&&1!==r)throw new Error("Cannot recover signature: invalid recovery bit");if(n===o)throw new Error("Cannot recover signature: msgHash cannot be 0");const a=1&r?"03":"02",c=g.fromHex(a+I(i)),{n:u}=d,l=B(i,u),h=N(-n*l,u),f=N(s*l,u),p=g.BASE.multiplyAndAddUnsafe(c,h,f);if(!p)throw new Error("Cannot recover signature: point at infinify");return p.assertValidity(),p}toRawBytes(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return C(this.toHex(e))}toHex(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=I(this.x);if(e){const e=this.y&s?"03":"02";return"".concat(e).concat(t)}return"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=N(r*r);if(N(n-h(t))!==o)throw new Error(e)}equals(e){return this.x===e.x&&this.y===e.y}negate(){return new g(this.x,N(-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()}multiplyAndAddUnsafe(e,t,r){const n=p.fromAffine(this).multiply(t),i=p.fromAffine(e).multiplyUnsafe(r),o=n.add(i);return o.equals(p.ZERO)?void 0:o.toAffine()}}function m(e){return Number.parseInt(e[0],16)>=8?"00"+e:e}function b(e){if(e.length<2||2!==e[0])throw new Error("Invalid signature integer tag: ".concat(S(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(d.Gx,d.Gy),g.ZERO=new g(o,o);class v{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?S(e):e;if(128!==n.length)throw new Error("".concat(r,": Expected 64-byte hex"));return new v(T(n.slice(0,64)),T(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(S(e)));if(e[1]!==e.length-2)throw new Error("Invalid signature: incorrect length");const{data:t,left:r}=b(e.subarray(2)),{data:n,left:i}=b(r);if(i.length)throw new Error("Invalid signature: left bytes after parsing: ".concat(S(i)));return{r:t,s:n}}(t?e:C(e));return new v(r,n)}static fromHex(e){return this.fromDER(e)}assertValidity(){const{r:e,s:t}=this;if(!K(e))throw new Error("Invalid Signature: r must be 0 < r < n");if(!K(t))throw new Error("Invalid Signature: s must be 0 < s < n")}hasHighS(){const e=d.n>>s;return this.s>e}normalizeS(){return this.hasHighS()?new v(this.r,d.n-this.s):this}toDERRawBytes(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return C(this.toDERHex(e))}toDERHex(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=m(R(this.s));if(e)return t;const r=m(R(this.r)),n=R(r.length/2),i=R(t.length/2),o=R(r.length/2+t.length/2+4);return"30".concat(o,"02").concat(n).concat(r,"02").concat(i).concat(t)}toRawBytes(){return this.toDERRawBytes()}toHex(){return this.toDERHex()}toCompactRawBytes(){return C(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 o=0,s=0;o<t.length;o++){const e=t[o];i.set(e,s),s+=e.length}return i}function E(e){return e instanceof Uint8Array}t.Signature=v;const _=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function S(e){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");let t="";for(let r=0;r<e.length;r++)t+=_[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 A(e){return C(I(e))}function R(e){const t=e.toString(16);return 1&t.length?"0".concat(t):t}function T(e){if("string"!==typeof e)throw new TypeError("hexToNumber: expected string, got "+typeof e);return BigInt("0x".concat(e))}function C(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),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");t[r]=o}return t}function P(e){return T(S(e))}function k(e){return e instanceof Uint8Array?Uint8Array.from(e):C(e)}function O(e){if("number"===typeof e&&Number.isSafeInteger(e)&&e>0)return BigInt(e);if("bigint"===typeof e&&K(e))return e;throw new TypeError("Expected valid private scalar: 0 < scalar < curve.n")}function N(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d.P;const r=e%t;return r>=o?r:t+r}function D(e,t){const{P:r}=d;let n=e;for(;t-- >o;)n*=n,n%=r;return n}function B(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d.P;if(e===o||t<=o)throw new Error("invert: expected positive integers, got n=".concat(e," mod=").concat(t));let r=N(e,t),n=t,i=o,a=s,c=s,u=o;for(;r!==o;){const e=n/r,t=n%r,o=i-c*e,s=a-u*e;n=r,r=t,i=c,a=u,c=o,u=s}const l=n;if(l!==s)throw new Error("invert: does not exist");return N(i,t)}const x=(e,t)=>(e+t/a)/t,L=a**BigInt(128);function M(e){const{n:t}=d,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-s*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=r,a=x(o*e,t),c=x(-n*e,t);let u=N(e-a*r-c*i,t),l=N(-a*n-c*o,t);const h=u>L,f=l>L;if(h&&(u=t-u),f&&(l=t-l),u>L||l>L)throw new Error("splitScalarEndo: Endomorphism failed, k="+e);return{k1neg:h,k1:u,k2neg:f,k2:l}}function U(e){const{n:t}=d,r=8*e.length-256;let n=P(e);return r>0&&(n>>=BigInt(r)),n>=t&&(n-=t),n}class j{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 K(e){return o<e&&e<d.n}function F(e){return o<e&&e<d.P}function V(e,t,r){const n=P(e);if(!K(n))return;const{n:i}=d,a=g.BASE.multiply(n),c=N(a.x,i);if(c===o)return;const u=N(B(n,i)*N(t+r*c,i),i);if(u===o)return;const l=new v(c,u);return{sig:l,recovery:(a.x===l.r?0:2)|Number(a.y&s)}}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=T(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(!K(t))throw new Error("Expected private key: 0 < key < n");return t}function H(e){return e instanceof g?(e.assertValidity(),e):g.fromHex(e)}function z(e){if(e instanceof v)return e.assertValidity(),e;try{return v.fromDER(e)}catch(t){return v.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=N(t,d.n);return Q(r<o?t:r)}function Q(e){if("bigint"!==typeof e)throw new Error("Expected bigint");return C(I(e))}function X(e,r,n){if(null==e)throw new Error('sign: expected valid message hash, not "'.concat(e,'"'));const i=k(e),o=q(r),s=[Q(o),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");s.push(e)}return{seed:w(...s),m:W(i),d:o}}function J(e,t){let{sig:r,recovery:n}=e;const{canonical:i,der:o,recovered:s}=Object.assign({canonical:!0,der:!0},t);i&&r.hasHighS()&&(r=r.normalizeS(),n^=1);const a=o?r.toDERRawBytes():r.toCompactRawBytes();return s?[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){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return g.fromSignature(e,t,r).toRawBytes(n)},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=H(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:o}=X(e,t,r.extraEntropy);let s;const a=new j;for(await a.reseed(n);!(s=V(await a.generate(),i,o));)await a.reseed();return J(s,r)},t.signSync=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{seed:n,m:i,d:o}=X(e,t,r.extraEntropy);let s;const a=new j;for(a.reseedSync(n);!(s=V(a.generateSync(),i,o));)a.reseedSync();return J(s,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,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];const a=await t.utils.sha256(w(n,n,...o));return P(a)}async function ee(e,t,r){const n=A(e);return N(await Z("BIP0340/challenge",n,t.toRawX(),r),d.n)}function te(e){return(e.y&s)===o}t.verify=function(e,t,r){let n,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:$;try{n=z(e),t=k(t)}catch(b){return!1}const{r:s,s:a}=n;if(i.strict&&n.hasHighS())return!1;const c=U(t);if(c===o)return!1;let u;try{u=H(r)}catch(b){return!1}const{n:l}=d,h=B(a,l),f=N(c*h,l),p=N(s*h,l),y=g.BASE.multiplyAndAddUnsafe(u,f,p);if(!y)return!1;const m=N(y.x,l);return m===s};class re{constructor(e,t){this.r=e,this.s=t,this.assertValidity()}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.subarray(0,32)),n=P(t.subarray(32,64));return new re(r,n)}assertValidity(){const{r:e,s:t}=this;if(!F(e)||!K(t))throw new Error("Invalid signature")}toHex(){return I(this.r)+I(this.s)}toRawBytes(){return C(this.toHex())}}async function ne(e,t,r){const n=e instanceof re;let i;try{i=n?e:re.fromHex(e),n&&i.assertValidity()}catch(h){return!1}const{r:o,s:s}=i,a=k(t);let c;try{c=H(r)}catch(h){return!1}const u=await ee(o,c,a),l=g.BASE.multiplyAndAddUnsafe(c,q(s),N(-u,d.n));return!(!l||!te(l)||l.x!==o)}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}=d,s=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,h=await Z("BIP0340/aux",c),f=l^h,p=await Z("BIP0340/nonce",A(f),u.toRawX(),s),y=N(p,i);if(y===o)throw new Error("sign: Creation of signature failed. k is zero");const m=g.fromPrivateKey(y),b=te(m)?y:i-y,v=await ee(m.x,u,s),w=new re(m.x,N(b+v*l,i)).toRawBytes(),E=await ne(w,s,u.toRawX());if(!E)throw new Error("sign: Invalid signature produced");return w},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=N(P(e),d.n);if(t===o||t===s)throw new Error("Invalid private key");return A(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:S,mod:N,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,o=!0;for(;i<arguments.length;)r[n++]=arguments[i++];return new Promise((function(i,s){r[n]=function(e){if(o)if(o=!1,e)s(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){o&&(o=!1,s(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),o=0;o<64;)i[n[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;r.encode=function(e,t,r){for(var i,o=null,s=[],a=0,c=0;t<r;){var u=e[t++];switch(c){case 0:s[a++]=n[u>>2],i=(3&u)<<4,c=1;break;case 1:s[a++]=n[i|u>>4],i=(15&u)<<2,c=2;break;case 2:s[a++]=n[i|u>>6],s[a++]=n[63&u],c=0}a>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,s)),a=0)}return c&&(s[a++]=n[i],s[a++]=61,1===c&&(s[a++]=61)),o?(a&&o.push(String.fromCharCode.apply(String,s.slice(0,a))),o.join("")):String.fromCharCode.apply(String,s.slice(0,a))};var s="invalid encoding";r.decode=function(e,t,r){for(var n,o=r,a=0,c=0;c<e.length;){var u=e.charCodeAt(c++);if(61===u&&a>1)break;if(void 0===(u=i[u]))throw Error(s);switch(a){case 0:n=u,a=1;break;case 1:t[r++]=n<<2|(48&u)>>4,n=u,a=2;break;case 2:t[r++]=(15&n)<<4|(60&u)>>2,n=u,a=3;break;case 3:t[r++]=(3&n)<<6|u,a=0}}if(1===a)throw Error(s);return r-o},r.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},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}},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 o(e,n,i){t[0]=e,n[i]=r[3],n[i+1]=r[2],n[i+2]=r[1],n[i+3]=r[0]}function s(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],t[0]}function a(e,n){return r[3]=e[n],r[2]=e[n+1],r[1]=e[n+2],r[0]=e[n+3],t[0]}e.writeFloatLE=n?i:o,e.writeFloatBE=n?o:i,e.readFloatLE=n?s:a,e.readFloatBE=n?a:s}():function(){function t(e,t,r,n){var i=t<0?1:0;if(i&&(t=-t),0===t)e(1/t>0?0:2147483648,r,n);else if(isNaN(t))e(2143289344,r,n);else if(t>34028234663852886e22)e((i<<31|2139095040)>>>0,r,n);else if(t<11754943508222875e-54)e((i<<31|Math.round(t/1401298464324817e-60))>>>0,r,n);else{var o=Math.floor(Math.log(t)/Math.LN2);e((i<<31|o+127<<23|8388607&Math.round(t*Math.pow(2,-o)*8388608))>>>0,r,n)}}function s(e,t,r){var n=e(t,r),i=2*(n>>31)+1,o=n>>>23&255,s=8388607&n;return 255===o?s?NaN:i*(1/0):0===o?1401298464324817e-60*i*s:i*Math.pow(2,o-150)*(s+8388608)}e.writeFloatLE=t.bind(null,r),e.writeFloatBE=t.bind(null,n),e.readFloatLE=s.bind(null,i),e.readFloatBE=s.bind(null,o)}(),"undefined"!==typeof Float64Array?function(){var t=new Float64Array([-0]),r=new Uint8Array(t.buffer),n=128===r[7];function i(e,n,i){t[0]=e,n[i]=r[0],n[i+1]=r[1],n[i+2]=r[2],n[i+3]=r[3],n[i+4]=r[4],n[i+5]=r[5],n[i+6]=r[6],n[i+7]=r[7]}function o(e,n,i){t[0]=e,n[i]=r[7],n[i+1]=r[6],n[i+2]=r[5],n[i+3]=r[4],n[i+4]=r[3],n[i+5]=r[2],n[i+6]=r[1],n[i+7]=r[0]}function s(e,n){return r[0]=e[n],r[1]=e[n+1],r[2]=e[n+2],r[3]=e[n+3],r[4]=e[n+4],r[5]=e[n+5],r[6]=e[n+6],r[7]=e[n+7],t[0]}function a(e,n){return r[7]=e[n],r[6]=e[n+1],r[5]=e[n+2],r[4]=e[n+3],r[3]=e[n+4],r[2]=e[n+5],r[1]=e[n+6],r[0]=e[n+7],t[0]}e.writeDoubleLE=n?i:o,e.writeDoubleBE=n?o:i,e.readDoubleLE=n?s:a,e.readDoubleBE=n?a:s}():function(){function t(e,t,r,n,i,o){var s=n<0?1:0;if(s&&(n=-n),0===n)e(0,i,o+t),e(1/n>0?0:2147483648,i,o+r);else if(isNaN(n))e(0,i,o+t),e(2146959360,i,o+r);else if(n>17976931348623157e292)e(0,i,o+t),e((s<<31|2146435072)>>>0,i,o+r);else{var a;if(n<22250738585072014e-324)e((a=n/5e-324)>>>0,i,o+t),e((s<<31|a/4294967296)>>>0,i,o+r);else{var c=Math.floor(Math.log(n)/Math.LN2);1024===c&&(c=1023),e(4503599627370496*(a=n*Math.pow(2,-c))>>>0,i,o+t),e((s<<31|c+1023<<20|1048576*a&1048575)>>>0,i,o+r)}}}function s(e,t,r,n,i){var o=e(n,i+t),s=e(n,i+r),a=2*(s>>31)+1,c=s>>>20&2047,u=4294967296*(1048575&s)+o;return 2047===c?u?NaN:a*(1/0):0===c?5e-324*a*u:a*Math.pow(2,c-1075)*(u+4503599627370496)}e.writeDoubleLE=t.bind(null,r,0,4),e.writeDoubleBE=t.bind(null,n,4,0),e.readDoubleLE=s.bind(null,i,0,4),e.readDoubleBE=s.bind(null,o,4,0)}(),e}function r(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}function n(e,t,r){t[r]=e>>>24,t[r+1]=e>>>16&255,t[r+2]=e>>>8&255,t[r+3]=255&e}function i(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function o(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}e.exports=t(t)},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},58236:e=>{"use strict";e.exports=function(e,t,r){var n=r||8192,i=n>>>1,o=null,s=n;return function(r){if(r<1||r>i)return e(r);s+r>n&&(o=e(n),s=0);var a=t.call(o,s,s+=r);return 7&s&&(s=1+(7|s)),a}}},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,o=[],s=0;t<r;)(n=e[t++])<128?o[s++]=n:n>191&&n<224?o[s++]=(31&n)<<6|63&e[t++]:n>239&&n<365?(n=((7&n)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,o[s++]=55296+(n>>10),o[s++]=56320+(1023&n)):o[s++]=(15&n)<<12|(63&e[t++])<<6|63&e[t++],s>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,o)),s=0);return i?(s&&i.push(String.fromCharCode.apply(String,o.slice(0,s))),i.join("")):String.fromCharCode.apply(String,o.slice(0,s))},r.write=function(e,t,r){for(var n,i,o=r,s=0;s<e.length;++s)(n=e.charCodeAt(s))<128?t[r++]=n:n<2048?(t[r++]=n>>6|192,t[r++]=63&n|128):55296===(64512&n)&&56320===(64512&(i=e.charCodeAt(s+1)))?(n=65536+((1023&n)<<10)+(1023&i),++s,t[r++]=n>>18|240,t[r++]=n>>12&63|128,t[r++]=n>>6&63|128,t[r++]=63&n|128):(t[r++]=n>>12|224,t[r++]=n>>6&63|128,t[r++]=63&n|128);return r-o}},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 o(e,t,r){return void 0===t&&(t=new Uint8Array(2)),void 0===r&&(r=0),t[r+0]=e>>>0,t[r+1]=e>>>8,t}function s(e,t){return void 0===t&&(t=0),e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function a(e,t){return void 0===t&&(t=0),(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function c(e,t){return void 0===t&&(t=0),e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]}function u(e,t){return void 0===t&&(t=0),(e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t])>>>0}function 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 d(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),t[r+0]=e>>>0,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24,t}function h(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),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),d(e>>>0,t,r),d(e/4294967296>>>0,t,r+4),t}t.readInt16BE=function(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])<<16>>16},t.readUint16BE=function(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])>>>0},t.readInt16LE=function(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])<<16>>16},t.readUint16LE=function(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])>>>0},t.writeUint16BE=i,t.writeInt16BE=i,t.writeUint16LE=o,t.writeInt16LE=o,t.readInt32BE=s,t.readUint32BE=a,t.readInt32LE=c,t.readUint32LE=u,t.writeUint32BE=l,t.writeInt32BE=l,t.writeUint32LE=d,t.writeInt32LE=d,t.readInt64BE=function(e,t){void 0===t&&(t=0);var r=s(e,t),n=s(e,t+4);return 4294967296*r+n-4294967296*(n>>31)},t.readUint64BE=function(e,t){return void 0===t&&(t=0),4294967296*a(e,t)+a(e,t+4)},t.readInt64LE=function(e,t){void 0===t&&(t=0);var r=c(e,t);return 4294967296*c(e,t+4)+r-4294967296*(r>>31)},t.readUint64LE=function(e,t){void 0===t&&(t=0);var r=u(e,t);return 4294967296*u(e,t+4)+r},t.writeUint64BE=h,t.writeInt64BE=h,t.writeUint64LE=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,o=e/8+r-1;o>=r;o--)n+=t[o]*i,i*=256;return n},t.readUintLE=function(e,t,r){if(void 0===r&&(r=0),e%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(e/8>t.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,o=r;o<r+e/8;o++)n+=t[o]*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 o=1,s=e/8+i-1;s>=i;s--)r[s]=t/o&255,o*=256;return r},t.writeUintLE=function(e,t,r,i){if(void 0===r&&(r=new Uint8Array(e/8)),void 0===i&&(i=0),e%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!n.isSafeInteger(t))throw new Error("writeUintLE value must be an integer");for(var o=1,s=i;s<i+e/8;s++)r[s]=t/o&255,o*=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 o(e,t,r){for(var i=1634760805,o=857760878,s=2036477234,a=1797285236,c=r[3]<<24|r[2]<<16|r[1]<<8|r[0],u=r[7]<<24|r[6]<<16|r[5]<<8|r[4],l=r[11]<<24|r[10]<<16|r[9]<<8|r[8],d=r[15]<<24|r[14]<<16|r[13]<<8|r[12],h=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],b=t[11]<<24|t[10]<<16|t[9]<<8|t[8],v=t[15]<<24|t[14]<<16|t[13]<<8|t[12],w=i,E=o,_=s,S=a,I=c,A=u,R=l,T=d,C=h,P=f,k=p,O=y,N=g,D=m,B=b,x=v,L=0;L<20;L+=2)I=(I^=C=C+(N=(N^=w=w+I|0)>>>16|N<<16)|0)>>>20|I<<12,A=(A^=P=P+(D=(D^=E=E+A|0)>>>16|D<<16)|0)>>>20|A<<12,R=(R^=k=k+(B=(B^=_=_+R|0)>>>16|B<<16)|0)>>>20|R<<12,T=(T^=O=O+(x=(x^=S=S+T|0)>>>16|x<<16)|0)>>>20|T<<12,R=(R^=k=k+(B=(B^=_=_+R|0)>>>24|B<<8)|0)>>>25|R<<7,T=(T^=O=O+(x=(x^=S=S+T|0)>>>24|x<<8)|0)>>>25|T<<7,A=(A^=P=P+(D=(D^=E=E+A|0)>>>24|D<<8)|0)>>>25|A<<7,I=(I^=C=C+(N=(N^=w=w+I|0)>>>24|N<<8)|0)>>>25|I<<7,A=(A^=k=k+(x=(x^=w=w+A|0)>>>16|x<<16)|0)>>>20|A<<12,R=(R^=O=O+(N=(N^=E=E+R|0)>>>16|N<<16)|0)>>>20|R<<12,T=(T^=C=C+(D=(D^=_=_+T|0)>>>16|D<<16)|0)>>>20|T<<12,I=(I^=P=P+(B=(B^=S=S+I|0)>>>16|B<<16)|0)>>>20|I<<12,T=(T^=C=C+(D=(D^=_=_+T|0)>>>24|D<<8)|0)>>>25|T<<7,I=(I^=P=P+(B=(B^=S=S+I|0)>>>24|B<<8)|0)>>>25|I<<7,R=(R^=O=O+(N=(N^=E=E+R|0)>>>24|N<<8)|0)>>>25|R<<7,A=(A^=k=k+(x=(x^=w=w+A|0)>>>24|x<<8)|0)>>>25|A<<7;n.writeUint32LE(w+i|0,e,0),n.writeUint32LE(E+o|0,e,4),n.writeUint32LE(_+s|0,e,8),n.writeUint32LE(S+a|0,e,12),n.writeUint32LE(I+c|0,e,16),n.writeUint32LE(A+u|0,e,20),n.writeUint32LE(R+l|0,e,24),n.writeUint32LE(T+d|0,e,28),n.writeUint32LE(C+h|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(N+g|0,e,48),n.writeUint32LE(D+m|0,e,52),n.writeUint32LE(B+b|0,e,56),n.writeUint32LE(x+v|0,e,60)}function s(e,t,r,n,s){if(void 0===s&&(s=0),32!==e.length)throw new Error("ChaCha: key size must be 32 bytes");if(n.length<r.length)throw new Error("ChaCha: destination is shorter than source");var c,u;if(0===s){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=s}for(var l=new Uint8Array(64),d=0;d<r.length;d+=64){o(l,c,e);for(var h=d;h<d+64&&h<r.length;h++)n[h]=r[h]^l[h-d];a(c,0,u)}return i.wipe(l),0===s&&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=s,t.stream=function(e,t,r,n){return void 0===n&&(n=0),i.wipe(r),s(e,t,r,r,n)}},53642:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(78284),i=r(75629),o=r(9116),s=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 s=new Uint8Array(16);s.set(e,s.length-e.length);var a=new Uint8Array(32);n.stream(this._key,s,a,4);var c,u=t.length+this.tagLength;if(i){if(i.length!==u)throw new Error("ChaCha20Poly1305: incorrect destination length");c=i}else c=new Uint8Array(u);return n.streamXOR(this._key,s,t,c,4),this._authenticate(c.subarray(c.length-this.tagLength,c.length),a,c.subarray(0,c.length-this.tagLength),r),o.wipe(s),c},e.prototype.open=function(e,t,r,i){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(t.length<this.tagLength)return null;var s=new Uint8Array(16);s.set(e,s.length-e.length);var c=new Uint8Array(32);n.stream(this._key,s,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,d=t.length-this.tagLength;if(i){if(i.length!==d)throw new Error("ChaCha20Poly1305: incorrect destination length");l=i}else l=new Uint8Array(d);return n.streamXOR(this._key,s,t.subarray(0,t.length-this.tagLength),l,4),o.wipe(s),l},e.prototype.clean=function(){return o.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&&s.writeUint64LE(n.length,u),a.update(u),s.writeUint64LE(r.length,u),a.update(u);for(var l=a.digest(),d=0;d<l.length;d++)e[d]=l[d];a.clean(),o.wipe(l),o.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),o=function(){function e(e,t,r,i){void 0===r&&(r=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=i;var o=n.hmac(this._hash,r,t);this._hmac=new n.HMAC(e,o),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return e.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(0===e)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},e.prototype.expand=function(e){for(var t=new Uint8Array(e),r=0;r<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=o},5499:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(41412),i=r(68770),o=r(9116),s=function(){function e(e,t){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var r=new Uint8Array(this.blockSize);t.length>this.blockSize?this._inner.update(t).finish(r).clean():r.set(t);for(var i=0;i<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()),o.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=s,t.hmac=function(e,t,r){var n=new s(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 o=function(){function e(e){this.digestLength=t.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var r=e[0]|e[1]<<8;this._r[0]=8191&r;var n=e[2]|e[3]<<8;this._r[1]=8191&(r>>>13|n<<3);var i=e[4]|e[5]<<8;this._r[2]=7939&(n>>>10|i<<6);var o=e[6]|e[7]<<8;this._r[3]=8191&(i>>>7|o<<9);var s=e[8]|e[9]<<8;this._r[4]=255&(o>>>4|s<<12),this._r[5]=s>>>1&8190;var a=e[10]|e[11]<<8;this._r[6]=8191&(s>>>14|a<<2);var c=e[12]|e[13]<<8;this._r[7]=8065&(a>>>11|c<<5);var u=e[14]|e[15]<<8;this._r[8]=8191&(c>>>8|u<<8),this._r[9]=u>>>5&127,this._pad[0]=e[16]|e[17]<<8,this._pad[1]=e[18]|e[19]<<8,this._pad[2]=e[20]|e[21]<<8,this._pad[3]=e[22]|e[23]<<8,this._pad[4]=e[24]|e[25]<<8,this._pad[5]=e[26]|e[27]<<8,this._pad[6]=e[28]|e[29]<<8,this._pad[7]=e[30]|e[31]<<8}return e.prototype._blocks=function(e,t,r){for(var n=this._fin?0:2048,i=this._h[0],o=this._h[1],s=this._h[2],a=this._h[3],c=this._h[4],u=this._h[5],l=this._h[6],d=this._h[7],h=this._h[8],f=this._h[9],p=this._r[0],y=this._r[1],g=this._r[2],m=this._r[3],b=this._r[4],v=this._r[5],w=this._r[6],E=this._r[7],_=this._r[8],S=this._r[9];r>=16;){var I=e[t+0]|e[t+1]<<8;i+=8191&I;var A=e[t+2]|e[t+3]<<8;o+=8191&(I>>>13|A<<3);var R=e[t+4]|e[t+5]<<8;s+=8191&(A>>>10|R<<6);var T=e[t+6]|e[t+7]<<8;a+=8191&(R>>>7|T<<9);var C=e[t+8]|e[t+9]<<8;c+=8191&(T>>>4|C<<12),u+=C>>>1&8191;var P=e[t+10]|e[t+11]<<8;l+=8191&(C>>>14|P<<2);var k=e[t+12]|e[t+13]<<8;d+=8191&(P>>>11|k<<5);var O=e[t+14]|e[t+15]<<8,N=0,D=N;D+=i*p,D+=o*(5*S),D+=s*(5*_),D+=a*(5*E),N=(D+=c*(5*w))>>>13,D&=8191,D+=u*(5*v),D+=l*(5*b),D+=d*(5*m),D+=(h+=8191&(k>>>8|O<<8))*(5*g);var B=N+=(D+=(f+=O>>>5|n)*(5*y))>>>13;B+=i*y,B+=o*p,B+=s*(5*S),B+=a*(5*_),N=(B+=c*(5*E))>>>13,B&=8191,B+=u*(5*w),B+=l*(5*v),B+=d*(5*b),B+=h*(5*m),N+=(B+=f*(5*g))>>>13,B&=8191;var x=N;x+=i*g,x+=o*y,x+=s*p,x+=a*(5*S),N=(x+=c*(5*_))>>>13,x&=8191,x+=u*(5*E),x+=l*(5*w),x+=d*(5*v),x+=h*(5*b);var L=N+=(x+=f*(5*m))>>>13;L+=i*m,L+=o*g,L+=s*y,L+=a*p,N=(L+=c*(5*S))>>>13,L&=8191,L+=u*(5*_),L+=l*(5*E),L+=d*(5*w),L+=h*(5*v);var M=N+=(L+=f*(5*b))>>>13;M+=i*b,M+=o*m,M+=s*g,M+=a*y,N=(M+=c*p)>>>13,M&=8191,M+=u*(5*S),M+=l*(5*_),M+=d*(5*E),M+=h*(5*w);var U=N+=(M+=f*(5*v))>>>13;U+=i*v,U+=o*b,U+=s*m,U+=a*g,N=(U+=c*y)>>>13,U&=8191,U+=u*p,U+=l*(5*S),U+=d*(5*_),U+=h*(5*E);var j=N+=(U+=f*(5*w))>>>13;j+=i*w,j+=o*v,j+=s*b,j+=a*m,N=(j+=c*g)>>>13,j&=8191,j+=u*y,j+=l*p,j+=d*(5*S),j+=h*(5*_);var K=N+=(j+=f*(5*E))>>>13;K+=i*E,K+=o*w,K+=s*v,K+=a*b,N=(K+=c*m)>>>13,K&=8191,K+=u*g,K+=l*y,K+=d*p,K+=h*(5*S);var F=N+=(K+=f*(5*_))>>>13;F+=i*_,F+=o*E,F+=s*w,F+=a*v,N=(F+=c*b)>>>13,F&=8191,F+=u*m,F+=l*g,F+=d*y,F+=h*p;var V=N+=(F+=f*(5*S))>>>13;V+=i*S,V+=o*_,V+=s*E,V+=a*w,N=(V+=c*v)>>>13,V&=8191,V+=u*b,V+=l*m,V+=d*g,V+=h*y,i=D=8191&(N=(N=((N+=(V+=f*p)>>>13)<<2)+N|0)+(D&=8191)|0),o=B+=N>>>=13,s=x&=8191,a=L&=8191,c=M&=8191,u=U&=8191,l=j&=8191,d=K&=8191,h=F&=8191,f=V&=8191,t+=16,r-=16}this._h[0]=i,this._h[1]=o,this._h[2]=s,this._h[3]=a,this._h[4]=c,this._h[5]=u,this._h[6]=l,this._h[7]=d,this._h[8]=h,this._h[9]=f},e.prototype.finish=function(e,t){void 0===t&&(t=0);var r,n,i,o,s=new Uint16Array(10);if(this._leftover){for(o=this._leftover,this._buffer[o++]=1;o<16;o++)this._buffer[o]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(r=this._h[1]>>>13,this._h[1]&=8191,o=2;o<10;o++)this._h[o]+=r,r=this._h[o]>>>13,this._h[o]&=8191;for(this._h[0]+=5*r,r=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=r,r=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=r,s[0]=this._h[0]+5,r=s[0]>>>13,s[0]&=8191,o=1;o<10;o++)s[o]=this._h[o]+r,r=s[o]>>>13,s[o]&=8191;for(s[9]-=8192,n=(1^r)-1,o=0;o<10;o++)s[o]&=n;for(n=~n,o=0;o<10;o++)this._h[o]=this._h[o]&n|s[o];for(this._h[0]=65535&(this._h[0]|this._h[1]<<13),this._h[1]=65535&(this._h[1]>>>3|this._h[2]<<10),this._h[2]=65535&(this._h[2]>>>6|this._h[3]<<7),this._h[3]=65535&(this._h[3]>>>9|this._h[4]<<4),this._h[4]=65535&(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14),this._h[5]=65535&(this._h[6]>>>2|this._h[7]<<11),this._h[6]=65535&(this._h[7]>>>5|this._h[8]<<8),this._h[7]=65535&(this._h[8]>>>8|this._h[9]<<5),i=this._h[0]+this._pad[0],this._h[0]=65535&i,o=1;o<8;o++)i=(this._h[o]+this._pad[o]|0)+(i>>>16)|0,this._h[o]=65535&i;return e[t+0]=this._h[0]>>>0,e[t+1]=this._h[0]>>>8,e[t+2]=this._h[1]>>>0,e[t+3]=this._h[1]>>>8,e[t+4]=this._h[2]>>>0,e[t+5]=this._h[2]>>>8,e[t+6]=this._h[3]>>>0,e[t+7]=this._h[3]>>>8,e[t+8]=this._h[4]>>>0,e[t+9]=this._h[4]>>>8,e[t+10]=this._h[5]>>>0,e[t+11]=this._h[5]>>>8,e[t+12]=this._h[6]>>>0,e[t+13]=this._h[6]>>>8,e[t+14]=this._h[7]>>>0,e[t+15]=this._h[7]>>>8,this._finished=!0,this},e.prototype.update=function(e){var t,r=0,n=e.length;if(this._leftover){(t=16-this._leftover)>n&&(t=n);for(var i=0;i<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=o,t.oneTimeAuth=function(e,t){var r=new o(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),o=r(9116);function s(e,r){return void 0===r&&(r=t.defaultRandomSource),r.randomBytes(e)}t.defaultRandomSource=new n.SystemRandomSource,t.randomBytes=s,t.randomUint32=function(e){void 0===e&&(e=t.defaultRandomSource);var r=s(4,e),n=i.readUint32LE(r);return o.wipe(r),n};var a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function c(e,r,n){if(void 0===r&&(r=a),void 0===n&&(n=t.defaultRandomSource),r.length<2)throw new Error("randomString charset is too short");if(r.length>256)throw new Error("randomString charset is too long");for(var i="",c=r.length,u=256-256%c;e>0;){for(var l=s(Math.ceil(256*e/u),n),d=0;d<l.length&&e>0;d++){var h=l[d];h<u&&(i+=r.charAt(h%c),e--)}o.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),o=function(){function e(){return this.isAvailable=!1,this.name="",this._source=new n.BrowserRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Browser")):(this._source=new i.NodeRandomSource,this._source.isAvailable?(this.isAvailable=!0,void(this.name="Node")):void 0)}return e.prototype.randomBytes=function(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)},e}();t.SystemRandomSource=o},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 o=function(){function e(){this.digestLength=t.DIGEST_LENGTH,this.blockSize=t.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return e.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},e.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},e.prototype.clean=function(){i.wipe(this._buffer),i.wipe(this._temp),this.reset()},e.prototype.update=function(e,t){if(void 0===t&&(t=e.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var r=0;if(this._bytesHashed+=t,this._bufferLength>0){for(;this._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,o=t<<3,s=t%64<56?64:128;this._buffer[r]=128;for(var c=r+1;c<s-8;c++)this._buffer[c]=0;n.writeUint32BE(i,this._buffer,s-8),n.writeUint32BE(o,this._buffer,s-4),a(this._temp,this._state,this._buffer,0,s),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=o;var s=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function a(e,t,r,i,o){for(;o>=64;){for(var a=t[0],c=t[1],u=t[2],l=t[3],d=t[4],h=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],b=(m>>>17|m<<15)^(m>>>19|m<<13)^m>>>10,v=((m=e[y-15])>>>7|m<<25)^(m>>>18|m<<14)^m>>>3;e[y]=(b+e[y-7]|0)+(v+e[y-16]|0)}for(y=0;y<64;y++){b=(((d>>>6|d<<26)^(d>>>11|d<<21)^(d>>>25|d<<7))+(d&h^~d&f)|0)+(p+(s[y]+e[y]|0)|0)|0,v=((a>>>2|a<<30)^(a>>>13|a<<19)^(a>>>22|a<<10))+(a&c^a&u^c&u)|0;p=f,f=h,h=d,d=l+b|0,l=u,u=c,c=a,a=b+v|0}t[0]+=a,t[1]+=c,t[2]+=u,t[3]+=l,t[4]+=d,t[5]+=h,t[6]+=f,t[7]+=p,i+=64,o-=64}return i}t.hash=function(e){var t=new o;t.update(e);var r=t.digest();return t.clean(),r}},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 o(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 s=new Uint8Array(32);s[0]=9;var a=o([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 o=n&(e[i]^t[i]);e[i]^=o,t[i]^=o}}function l(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]+r[n]}function d(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]-r[n]}function h(e,t,r){var n,i,o=0,s=0,a=0,c=0,u=0,l=0,d=0,h=0,f=0,p=0,y=0,g=0,m=0,b=0,v=0,w=0,E=0,_=0,S=0,I=0,A=0,R=0,T=0,C=0,P=0,k=0,O=0,N=0,D=0,B=0,x=0,L=r[0],M=r[1],U=r[2],j=r[3],K=r[4],F=r[5],V=r[6],q=r[7],H=r[8],z=r[9],G=r[10],W=r[11],Y=r[12],Q=r[13],X=r[14],J=r[15];o+=(n=t[0])*L,s+=n*M,a+=n*U,c+=n*j,u+=n*K,l+=n*F,d+=n*V,h+=n*q,f+=n*H,p+=n*z,y+=n*G,g+=n*W,m+=n*Y,b+=n*Q,v+=n*X,w+=n*J,s+=(n=t[1])*L,a+=n*M,c+=n*U,u+=n*j,l+=n*K,d+=n*F,h+=n*V,f+=n*q,p+=n*H,y+=n*z,g+=n*G,m+=n*W,b+=n*Y,v+=n*Q,w+=n*X,E+=n*J,a+=(n=t[2])*L,c+=n*M,u+=n*U,l+=n*j,d+=n*K,h+=n*F,f+=n*V,p+=n*q,y+=n*H,g+=n*z,m+=n*G,b+=n*W,v+=n*Y,w+=n*Q,E+=n*X,_+=n*J,c+=(n=t[3])*L,u+=n*M,l+=n*U,d+=n*j,h+=n*K,f+=n*F,p+=n*V,y+=n*q,g+=n*H,m+=n*z,b+=n*G,v+=n*W,w+=n*Y,E+=n*Q,_+=n*X,S+=n*J,u+=(n=t[4])*L,l+=n*M,d+=n*U,h+=n*j,f+=n*K,p+=n*F,y+=n*V,g+=n*q,m+=n*H,b+=n*z,v+=n*G,w+=n*W,E+=n*Y,_+=n*Q,S+=n*X,I+=n*J,l+=(n=t[5])*L,d+=n*M,h+=n*U,f+=n*j,p+=n*K,y+=n*F,g+=n*V,m+=n*q,b+=n*H,v+=n*z,w+=n*G,E+=n*W,_+=n*Y,S+=n*Q,I+=n*X,A+=n*J,d+=(n=t[6])*L,h+=n*M,f+=n*U,p+=n*j,y+=n*K,g+=n*F,m+=n*V,b+=n*q,v+=n*H,w+=n*z,E+=n*G,_+=n*W,S+=n*Y,I+=n*Q,A+=n*X,R+=n*J,h+=(n=t[7])*L,f+=n*M,p+=n*U,y+=n*j,g+=n*K,m+=n*F,b+=n*V,v+=n*q,w+=n*H,E+=n*z,_+=n*G,S+=n*W,I+=n*Y,A+=n*Q,R+=n*X,T+=n*J,f+=(n=t[8])*L,p+=n*M,y+=n*U,g+=n*j,m+=n*K,b+=n*F,v+=n*V,w+=n*q,E+=n*H,_+=n*z,S+=n*G,I+=n*W,A+=n*Y,R+=n*Q,T+=n*X,C+=n*J,p+=(n=t[9])*L,y+=n*M,g+=n*U,m+=n*j,b+=n*K,v+=n*F,w+=n*V,E+=n*q,_+=n*H,S+=n*z,I+=n*G,A+=n*W,R+=n*Y,T+=n*Q,C+=n*X,P+=n*J,y+=(n=t[10])*L,g+=n*M,m+=n*U,b+=n*j,v+=n*K,w+=n*F,E+=n*V,_+=n*q,S+=n*H,I+=n*z,A+=n*G,R+=n*W,T+=n*Y,C+=n*Q,P+=n*X,k+=n*J,g+=(n=t[11])*L,m+=n*M,b+=n*U,v+=n*j,w+=n*K,E+=n*F,_+=n*V,S+=n*q,I+=n*H,A+=n*z,R+=n*G,T+=n*W,C+=n*Y,P+=n*Q,k+=n*X,O+=n*J,m+=(n=t[12])*L,b+=n*M,v+=n*U,w+=n*j,E+=n*K,_+=n*F,S+=n*V,I+=n*q,A+=n*H,R+=n*z,T+=n*G,C+=n*W,P+=n*Y,k+=n*Q,O+=n*X,N+=n*J,b+=(n=t[13])*L,v+=n*M,w+=n*U,E+=n*j,_+=n*K,S+=n*F,I+=n*V,A+=n*q,R+=n*H,T+=n*z,C+=n*G,P+=n*W,k+=n*Y,O+=n*Q,N+=n*X,D+=n*J,v+=(n=t[14])*L,w+=n*M,E+=n*U,_+=n*j,S+=n*K,I+=n*F,A+=n*V,R+=n*q,T+=n*H,C+=n*z,P+=n*G,k+=n*W,O+=n*Y,N+=n*Q,D+=n*X,B+=n*J,w+=(n=t[15])*L,s+=38*(_+=n*U),a+=38*(S+=n*j),c+=38*(I+=n*K),u+=38*(A+=n*F),l+=38*(R+=n*V),d+=38*(T+=n*q),h+=38*(C+=n*H),f+=38*(P+=n*z),p+=38*(k+=n*G),y+=38*(O+=n*W),g+=38*(N+=n*Y),m+=38*(D+=n*Q),b+=38*(B+=n*X),v+=38*(x+=n*J),o=(n=(o+=38*(E+=n*M))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+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)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+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)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),w=(n=w+i+65535)-65536*(i=Math.floor(n/65536)),o=(n=(o+=i-1+37*(i-1))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+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)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+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)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),w=(n=w+i+65535)-65536*(i=Math.floor(n/65536)),o+=i-1+37*(i-1),e[0]=o,e[1]=s,e[2]=a,e[3]=c,e[4]=u,e[5]=l,e[6]=d,e[7]=h,e[8]=f,e[9]=p,e[10]=y,e[11]=g,e[12]=m,e[13]=b,e[14]=v,e[15]=w}function f(e,t){h(e,t,t)}function p(e,t){for(var r=new Uint8Array(32),n=new Float64Array(80),i=o(),s=o(),p=o(),y=o(),g=o(),m=o(),b=0;b<31;b++)r[b]=e[b];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(b=0;b<16;b++)s[b]=n[b];i[0]=y[0]=1;for(b=254;b>=0;--b){var v=r[b>>>3]>>>(7&b)&1;u(i,s,v),u(p,y,v),l(g,i,p),d(i,i,p),l(p,s,y),d(s,s,y),f(y,g),f(m,i),h(i,p,i),h(p,s,g),l(g,i,p),d(i,i,p),f(s,i),d(p,y,m),h(i,p,a),l(i,i,y),h(p,p,i),h(i,y,m),h(y,s,n),f(s,g),u(i,s,v),u(p,y,v)}for(b=0;b<16;b++)n[b+16]=i[b],n[b+32]=p[b],n[b+48]=s[b],n[b+64]=y[b];var w=n.subarray(32),E=n.subarray(16);!function(e,t){for(var r=o(),n=0;n<16;n++)r[n]=t[n];for(n=253;n>=0;n--)f(r,r),2!==n&&4!==n&&h(r,r,t);for(n=0;n<16;n++)e[n]=r[n]}(w,w),h(E,E,w);var _=new Uint8Array(32);return function(e,t){for(var r=o(),n=o(),i=0;i<16;i++)n[i]=t[i];c(n),c(n),c(n);for(var s=0;s<2;s++){for(r[0]=n[0]-65517,i=1;i<15;i++)r[i]=n[i]-65535-(r[i-1]>>16&1),r[i-1]&=65535;r[15]=n[15]-32767-(r[14]>>16&1);var a=r[15]>>16&1;r[14]&=65535,u(n,r,1-a)}for(i=0;i<16;i++)e[2*i]=255&n[i],e[2*i+1]=n[i]>>8}(_,E),_}function y(e){return p(e,s)}function g(e){if(e.length!==t.SECRET_KEY_LENGTH)throw new Error("x25519: seed must be "+t.SECRET_KEY_LENGTH+" bytes");var r=new Uint8Array(e);return{publicKey:y(r),secretKey:r}}t.scalarMult=p,t.scalarMultBase=y,t.generateKeyPairFromSeed=g,t.generateKeyPair=function(e){var t=n.randomBytes(32,e),r=g(t);return i.wipe(t),r},t.sharedKey=function(e,r,n){if(void 0===n&&(n=!1),e.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(r.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");var i=p(e,r);if(n){for(var o=0,s=0;s<i.length;s++)o|=i[s];if(0===o)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,o=0,s=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)),o=Math.sqrt(i),s=t+u*l}else t=c;n=a},a.movingAverage=function(){return t},a.variance=function(){return i},a.deviation=function(){return o},a.forecast=function(){return s},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),o=(e,t,r)=>s(e,Array.isArray(t)?t:[{signal:t,options:r}]),s=(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 s;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:o}=e;n(new i(r,o))}}));s=await Promise.race([n,e.next()]),r=null}catch(o){for(const{signal:e}of t)e.removeEventListener("abort",n);const r=t.find((e=>{let{signal:t}=e;return t.aborted})),i="aborted"===o.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(o){null!=r.options.onReturnError&&r.options.onReturnError(o)}if(i&&r.options.returnOnAbort)return;throw o}if(s.done)break;yield s.value}for(const{signal:e}of t)e.removeEventListener("abort",n)}()),a=(e,t,r)=>c(e,Array.isArray(t)?t:[{signal:t,options:r}]),c=(e,t)=>r=>e(s(r,t)),u=(e,t)=>({sink:c(e.sink,t),source:s(e.source,t)});e.exports=o,e.exports.AbortError=i,e.exports.source=o,e.exports.sink=a,e.exports.transform=a,e.exports.duplex=(e,t,r)=>u(e,Array.isArray(t)?t:[{signal:t,options:r}])},64928:(e,t,r)=>{"use strict";const n=r(67263),i=r(75235);class o 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=o},66622:e=>{function t(e){const t=new globalThis.AbortController;function r(){t.abort();for(const t of e)t&&t.removeEventListener&&t.removeEventListener("abort",r)}for(const n of e)if(n&&n.addEventListener){if(n.aborted){r();break}n.addEventListener("abort",r)}return t.signal}e.exports=t,e.exports.anySignal=t},88093:(e,t,r)=>{"use strict";var n=r(21964);function i(e){return i="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}var o,s,a=r(53372).codes,c=a.ERR_AMBIGUOUS_ARGUMENT,u=a.ERR_INVALID_ARG_TYPE,l=a.ERR_INVALID_ARG_VALUE,d=a.ERR_INVALID_RETURN_VALUE,h=a.ERR_MISSING_ARGS,f=r(24945),p=r(49639).inspect,y=r(49639).types,g=y.isPromise,m=y.isRegExp,b=Object.assign?Object.assign:r(50887).assign,v=Object.is?Object.is:r(33454);new Map;function w(){var e=r(46912);o=e.isDeepEqual,s=e.isDeepStrictEqual}var E=!1,_=e.exports=R,S={};function I(e){if(e.message instanceof Error)throw e.message;throw new f(e)}function A(e,t,r,n){if(!r){var i=!1;if(0===t)i=!0,n="No value argument passed to `assert.ok()`";else if(n instanceof Error)throw n;var o=new f({actual:r,expected:!0,message:n,operator:"==",stackStartFn:e});throw o.generatedMessage=i,o}}function R(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];A.apply(void 0,[R,t.length].concat(t))}_.fail=function e(t,r,i,o,s){var a,c=arguments.length;if(0===c)a="Failed";else if(1===c)i=t,t=void 0;else{if(!1===E){E=!0;var u=n.emitWarning?n.emitWarning:console.warn.bind(console);u("assert.fail() with more than one argument is deprecated. Please use assert.strictEqual() instead or only pass a message.","DeprecationWarning","DEP0094")}2===c&&(o="!=")}if(i instanceof Error)throw i;var l={actual:t,expected:r,operator:void 0===o?"fail":o,stackStartFn:s||e};void 0!==i&&(l.message=i);var d=new f(l);throw a&&(d.message=a,d.generatedMessage=!0),d},_.AssertionError=f,_.ok=R,_.equal=function e(t,r,n){if(arguments.length<2)throw new h("actual","expected");t!=r&&I({actual:t,expected:r,message:n,operator:"==",stackStartFn:e})},_.notEqual=function e(t,r,n){if(arguments.length<2)throw new h("actual","expected");t==r&&I({actual:t,expected:r,message:n,operator:"!=",stackStartFn:e})},_.deepEqual=function e(t,r,n){if(arguments.length<2)throw new h("actual","expected");void 0===o&&w(),o(t,r)||I({actual:t,expected:r,message:n,operator:"deepEqual",stackStartFn:e})},_.notDeepEqual=function e(t,r,n){if(arguments.length<2)throw new h("actual","expected");void 0===o&&w(),o(t,r)&&I({actual:t,expected:r,message:n,operator:"notDeepEqual",stackStartFn:e})},_.deepStrictEqual=function e(t,r,n){if(arguments.length<2)throw new h("actual","expected");void 0===o&&w(),s(t,r)||I({actual:t,expected:r,message:n,operator:"deepStrictEqual",stackStartFn:e})},_.notDeepStrictEqual=function e(t,r,n){if(arguments.length<2)throw new h("actual","expected");void 0===o&&w();s(t,r)&&I({actual:t,expected:r,message:n,operator:"notDeepStrictEqual",stackStartFn:e})},_.strictEqual=function e(t,r,n){if(arguments.length<2)throw new h("actual","expected");v(t,r)||I({actual:t,expected:r,message:n,operator:"strictEqual",stackStartFn:e})},_.notStrictEqual=function e(t,r,n){if(arguments.length<2)throw new h("actual","expected");v(t,r)&&I({actual:t,expected:r,message:n,operator:"notStrictEqual",stackStartFn:e})};var T=function e(t,r,n){var i=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),r.forEach((function(e){e in t&&(void 0!==n&&"string"===typeof n[e]&&m(t[e])&&t[e].test(n[e])?i[e]=n[e]:i[e]=t[e])}))};function C(e,t,r,n,i,o){if(!(r in e)||!s(e[r],t[r])){if(!n){var a=new T(e,i),c=new T(t,i,e),u=new f({actual:a,expected:c,operator:"deepStrictEqual",stackStartFn:o});throw u.actual=e,u.expected=t,u.operator=o.name,u}I({actual:e,expected:t,message:n,operator:o.name,stackStartFn:o})}}function P(e,t,r,n){if("function"!==typeof t){if(m(t))return t.test(e);if(2===arguments.length)throw new u("expected",["Function","RegExp"],t);if("object"!==i(e)||null===e){var s=new f({actual:e,expected:t,message:r,operator:"deepStrictEqual",stackStartFn:n});throw s.operator=n.name,s}var a=Object.keys(t);if(t instanceof Error)a.push("name","message");else if(0===a.length)throw new l("error",t,"may not be an empty object");return void 0===o&&w(),a.forEach((function(i){"string"===typeof e[i]&&m(t[i])&&t[i].test(e[i])||C(e,t,i,r,a,n)})),!0}return void 0!==t.prototype&&e instanceof t||!Error.isPrototypeOf(t)&&!0===t.call({},e)}function k(e){if("function"!==typeof e)throw new u("fn","Function",e);try{e()}catch(t){return t}return S}function O(e){return g(e)||null!==e&&"object"===i(e)&&"function"===typeof e.then&&"function"===typeof e.catch}function N(e){return Promise.resolve().then((function(){var t;if("function"===typeof e){if(!O(t=e()))throw new d("instance of Promise","promiseFn",t)}else{if(!O(e))throw new u("promiseFn",["Function","Promise"],e);t=e}return Promise.resolve().then((function(){return t})).then((function(){return S})).catch((function(e){return e}))}))}function D(e,t,r,n){if("string"===typeof r){if(4===arguments.length)throw new u("error",["Object","Error","Function","RegExp"],r);if("object"===i(t)&&null!==t){if(t.message===r)throw new c("error/message",'The error message "'.concat(t.message,'" is identical to the message.'))}else if(t===r)throw new c("error/message",'The error "'.concat(t,'" is identical to the message.'));n=r,r=void 0}else if(null!=r&&"object"!==i(r)&&"function"!==typeof r)throw new u("error",["Object","Error","Function","RegExp"],r);if(t===S){var o="";r&&r.name&&(o+=" (".concat(r.name,")")),o+=n?": ".concat(n):".";var s="rejects"===e.name?"rejection":"exception";I({actual:void 0,expected:r,operator:e.name,message:"Missing expected ".concat(s).concat(o),stackStartFn:e})}if(r&&!P(t,r,n,e))throw t}function B(e,t,r,n){if(t!==S){if("string"===typeof r&&(n=r,r=void 0),!r||P(t,r)){var i=n?": ".concat(n):".",o="doesNotReject"===e.name?"rejection":"exception";I({actual:t,expected:r,operator:e.name,message:"Got unwanted ".concat(o).concat(i,"\n")+'Actual message: "'.concat(t&&t.message,'"'),stackStartFn:e})}throw t}}function x(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];A.apply(void 0,[x,t.length].concat(t))}_.throws=function e(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];D.apply(void 0,[e,k(t)].concat(n))},_.rejects=function e(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return N(t).then((function(t){return D.apply(void 0,[e,t].concat(n))}))},_.doesNotThrow=function e(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];B.apply(void 0,[e,k(t)].concat(n))},_.doesNotReject=function e(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return N(t).then((function(t){return B.apply(void 0,[e,t].concat(n))}))},_.ifError=function e(t){if(null!==t&&void 0!==t){var r="ifError got unwanted exception: ";"object"===i(t)&&"string"===typeof t.message?0===t.message.length&&t.constructor?r+=t.constructor.name:r+=t.message:r+=p(t);var n=new f({actual:t,expected:null,operator:"ifError",message:r,stackStartFn:e}),o=t.stack;if("string"===typeof o){var s=o.split("\n");s.shift();for(var a=n.stack.split("\n"),c=0;c<s.length;c++){var u=a.indexOf(s[c]);if(-1!==u){a=a.slice(0,u);break}}n.stack="".concat(a.join("\n"),"\n").concat(s.join("\n"))}throw n}},_.strict=b(x,_,{equal:_.strictEqual,deepEqual:_.deepStrictEqual,notEqual:_.notStrictEqual,notDeepEqual:_.notDeepStrictEqual}),_.strict.strict=_.strict},24945:(e,t,r)=>{"use strict";var n=r(21964);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function s(e,t){return!t||"object"!==f(t)&&"function"!==typeof t?a(e):t}function a(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function c(e){var t="function"===typeof Map?new Map:void 0;return c=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!==typeof e)throw new TypeError("Super expression must either be null or a function");if("undefined"!==typeof t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return l(e,arguments,h(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),d(n,e)},c(e)}function u(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function l(e,t,r){return l=u()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&d(i,r.prototype),i},l.apply(null,arguments)}function d(e,t){return d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},d(e,t)}function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},h(e)}function f(e){return f="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f(e)}var p=r(49639).inspect,y=r(53372).codes.ERR_INVALID_ARG_TYPE;function g(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}var m="",b="",v="",w="",E={deepStrictEqual:"Expected values to be strictly deep-equal:",strictEqual:"Expected values to be strictly equal:",strictEqualObject:'Expected "actual" to be reference-equal to "expected":',deepEqual:"Expected values to be loosely deep-equal:",equal:"Expected values to be loosely equal:",notDeepStrictEqual:'Expected "actual" not to be strictly deep-equal to:',notStrictEqual:'Expected "actual" to be strictly unequal to:',notStrictEqualObject:'Expected "actual" not to be reference-equal to "expected":',notDeepEqual:'Expected "actual" not to be loosely deep-equal to:',notEqual:'Expected "actual" to be loosely unequal to:',notIdentical:"Values identical but not reference-equal:"};function _(e){var t=Object.keys(e),r=Object.create(Object.getPrototypeOf(e));return t.forEach((function(t){r[t]=e[t]})),Object.defineProperty(r,"message",{value:e.message}),r}function S(e){return p(e,{compact:!1,customInspect:!1,depth:1e3,maxArrayLength:1/0,showHidden:!1,breakLength:1/0,showProxy:!1,sorted:!0,getters:!0})}function I(e,t,r){var i="",o="",s=0,a="",c=!1,u=S(e),l=u.split("\n"),d=S(t).split("\n"),h=0,p="";if("strictEqual"===r&&"object"===f(e)&&"object"===f(t)&&null!==e&&null!==t&&(r="strictEqualObject"),1===l.length&&1===d.length&&l[0]!==d[0]){var y=l[0].length+d[0].length;if(y<=10){if(("object"!==f(e)||null===e)&&("object"!==f(t)||null===t)&&(0!==e||0!==t))return"".concat(E[r],"\n\n")+"".concat(l[0]," !== ").concat(d[0],"\n")}else if("strictEqualObject"!==r){if(y<(n.stderr&&n.stderr.isTTY?n.stderr.columns:80)){for(;l[0][h]===d[0][h];)h++;h>2&&(p="\n ".concat(function(e,t){if(t=Math.floor(t),0==e.length||0==t)return"";var r=e.length*t;for(t=Math.floor(Math.log(t)/Math.log(2));t;)e+=e,t--;return e+e.substring(0,r-e.length)}(" ",h),"^"),h=0)}}}for(var _=l[l.length-1],I=d[d.length-1];_===I&&(h++<2?a="\n ".concat(_).concat(a):i=_,l.pop(),d.pop(),0!==l.length&&0!==d.length);)_=l[l.length-1],I=d[d.length-1];var A=Math.max(l.length,d.length);if(0===A){var R=u.split("\n");if(R.length>30)for(R[26]="".concat(m,"...").concat(w);R.length>27;)R.pop();return"".concat(E.notIdentical,"\n\n").concat(R.join("\n"),"\n")}h>3&&(a="\n".concat(m,"...").concat(w).concat(a),c=!0),""!==i&&(a="\n ".concat(i).concat(a),i="");var T=0,C=E[r]+"\n".concat(b,"+ actual").concat(w," ").concat(v,"- expected").concat(w),P=" ".concat(m,"...").concat(w," Lines skipped");for(h=0;h<A;h++){var k=h-s;if(l.length<h+1)k>1&&h>2&&(k>4?(o+="\n".concat(m,"...").concat(w),c=!0):k>3&&(o+="\n ".concat(d[h-2]),T++),o+="\n ".concat(d[h-1]),T++),s=h,i+="\n".concat(v,"-").concat(w," ").concat(d[h]),T++;else if(d.length<h+1)k>1&&h>2&&(k>4?(o+="\n".concat(m,"...").concat(w),c=!0):k>3&&(o+="\n ".concat(l[h-2]),T++),o+="\n ".concat(l[h-1]),T++),s=h,o+="\n".concat(b,"+").concat(w," ").concat(l[h]),T++;else{var O=d[h],N=l[h],D=N!==O&&(!g(N,",")||N.slice(0,-1)!==O);D&&g(O,",")&&O.slice(0,-1)===N&&(D=!1,N+=","),D?(k>1&&h>2&&(k>4?(o+="\n".concat(m,"...").concat(w),c=!0):k>3&&(o+="\n ".concat(l[h-2]),T++),o+="\n ".concat(l[h-1]),T++),s=h,o+="\n".concat(b,"+").concat(w," ").concat(N),i+="\n".concat(v,"-").concat(w," ").concat(O),T+=2):(o+=i,i="",1!==k&&0!==h||(o+="\n ".concat(N),T++))}if(T>20&&h<A-2)return"".concat(C).concat(P,"\n").concat(o,"\n").concat(m,"...").concat(w).concat(i,"\n")+"".concat(m,"...").concat(w)}return"".concat(C).concat(c?P:"","\n").concat(o).concat(i).concat(a).concat(p)}var A=function(e){function t(e){var r;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),"object"!==f(e)||null===e)throw new y("options","Object",e);var i=e.message,o=e.operator,c=e.stackStartFn,u=e.actual,l=e.expected,d=Error.stackTraceLimit;if(Error.stackTraceLimit=0,null!=i)r=s(this,h(t).call(this,String(i)));else if(n.stderr&&n.stderr.isTTY&&(n.stderr&&n.stderr.getColorDepth&&1!==n.stderr.getColorDepth()?(m="\x1b[34m",b="\x1b[32m",w="\x1b[39m",v="\x1b[31m"):(m="",b="",w="",v="")),"object"===f(u)&&null!==u&&"object"===f(l)&&null!==l&&"stack"in u&&u instanceof Error&&"stack"in l&&l instanceof Error&&(u=_(u),l=_(l)),"deepStrictEqual"===o||"strictEqual"===o)r=s(this,h(t).call(this,I(u,l,o)));else if("notDeepStrictEqual"===o||"notStrictEqual"===o){var p=E[o],g=S(u).split("\n");if("notStrictEqual"===o&&"object"===f(u)&&null!==u&&(p=E.notStrictEqualObject),g.length>30)for(g[26]="".concat(m,"...").concat(w);g.length>27;)g.pop();r=1===g.length?s(this,h(t).call(this,"".concat(p," ").concat(g[0]))):s(this,h(t).call(this,"".concat(p,"\n\n").concat(g.join("\n"),"\n")))}else{var A=S(u),R="",T=E[o];"notDeepEqual"===o||"notEqual"===o?(A="".concat(E[o],"\n\n").concat(A)).length>1024&&(A="".concat(A.slice(0,1021),"...")):(R="".concat(S(l)),A.length>512&&(A="".concat(A.slice(0,509),"...")),R.length>512&&(R="".concat(R.slice(0,509),"...")),"deepEqual"===o||"equal"===o?A="".concat(T,"\n\n").concat(A,"\n\nshould equal\n\n"):R=" ".concat(o," ").concat(R)),r=s(this,h(t).call(this,"".concat(A).concat(R)))}return Error.stackTraceLimit=d,r.generatedMessage=!i,Object.defineProperty(a(r),"name",{value:"AssertionError [ERR_ASSERTION]",enumerable:!1,writable:!0,configurable:!0}),r.code="ERR_ASSERTION",r.actual=u,r.expected=l,r.operator=o,Error.captureStackTrace&&Error.captureStackTrace(a(r),c),r.stack,r.name="AssertionError",s(r)}var r,c,u;return function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&d(e,t)}(t,e),r=t,c=[{key:"toString",value:function(){return"".concat(this.name," [").concat(this.code,"]: ").concat(this.message)}},{key:p.custom,value:function(e,t){return p(this,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"===typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),n.forEach((function(t){i(e,t,r[t])}))}return e}({},t,{customInspect:!1,depth:0}))}}],c&&o(r.prototype,c),u&&o(r,u),t}(c(Error));e.exports=A},53372:(e,t,r)=>{"use strict";function n(e){return n="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function i(e,t){return!t||"object"!==n(t)&&"function"!==typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function o(e){return o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},o(e)}function s(e,t){return s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},s(e,t)}var a,c,u={};function l(e,t,r){r||(r=Error);var n=function(r){function n(r,s,a){var c;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),c=i(this,o(n).call(this,function(e,r,n){return"string"===typeof t?t:t(e,r,n)}(r,s,a))),c.code=e,c}return function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&s(e,t)}(n,r),n}(r);u[e]=n}function d(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}l("ERR_AMBIGUOUS_ARGUMENT",'The "%s" argument is ambiguous. %s',TypeError),l("ERR_INVALID_ARG_TYPE",(function(e,t,i){var o,s,c,u;if(void 0===a&&(a=r(88093)),a("string"===typeof e,"'name' must be a string"),"string"===typeof t&&(s="not ",t.substr(!c||c<0?0:+c,s.length)===s)?(o="must not be",t=t.replace(/^not /,"")):o="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))u="The ".concat(e," ").concat(o," ").concat(d(t,"type"));else{var l=function(e,t,r){return"number"!==typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}(e,".")?"property":"argument";u='The "'.concat(e,'" ').concat(l," ").concat(o," ").concat(d(t,"type"))}return u+=". Received type ".concat(n(i))}),TypeError),l("ERR_INVALID_ARG_VALUE",(function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"is invalid";void 0===c&&(c=r(49639));var i=c.inspect(t);return i.length>128&&(i="".concat(i.slice(0,128),"...")),"The argument '".concat(e,"' ").concat(n,". Received ").concat(i)}),TypeError,RangeError),l("ERR_INVALID_RETURN_VALUE",(function(e,t,r){var i;return i=r&&r.constructor&&r.constructor.name?"instance of ".concat(r.constructor.name):"type ".concat(n(r)),"Expected ".concat(e,' to be returned from the "').concat(t,'"')+" function but got ".concat(i,".")}),TypeError),l("ERR_MISSING_ARGS",(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];void 0===a&&(a=r(88093)),a(t.length>0,"At least one arg needs to be specified");var i="The ",o=t.length;switch(t=t.map((function(e){return'"'.concat(e,'"')})),o){case 1:i+="".concat(t[0]," argument");break;case 2:i+="".concat(t[0]," and ").concat(t[1]," arguments");break;default:i+=t.slice(0,o-1).join(", "),i+=", and ".concat(t[o-1]," arguments")}return"".concat(i," must be specified")}),TypeError),e.exports.codes=u},46912:(e,t,r)=>{"use strict";function n(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(c){i=!0,o=c}finally{try{n||null==a.return||a.return()}finally{if(i)throw o}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function i(e){return i="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}var o=void 0!==/a/g.flags,s=function(e){var t=[];return e.forEach((function(e){return t.push(e)})),t},a=function(e){var t=[];return e.forEach((function(e,r){return t.push([r,e])})),t},c=Object.is?Object.is:r(33454),u=Object.getOwnPropertySymbols?Object.getOwnPropertySymbols:function(){return[]},l=Number.isNaN?Number.isNaN:r(6188);function d(e){return e.call.bind(e)}var h=d(Object.prototype.hasOwnProperty),f=d(Object.prototype.propertyIsEnumerable),p=d(Object.prototype.toString),y=r(49639).types,g=y.isAnyArrayBuffer,m=y.isArrayBufferView,b=y.isDate,v=y.isMap,w=y.isRegExp,E=y.isSet,_=y.isNativeError,S=y.isBoxedPrimitive,I=y.isNumberObject,A=y.isStringObject,R=y.isBooleanObject,T=y.isBigIntObject,C=y.isSymbolObject,P=y.isFloat32Array,k=y.isFloat64Array;function O(e){if(0===e.length||e.length>10)return!0;for(var t=0;t<e.length;t++){var r=e.charCodeAt(t);if(r<48||r>57)return!0}return 10===e.length&&e>=Math.pow(2,32)}function N(e){return Object.keys(e).filter(O).concat(u(e).filter(Object.prototype.propertyIsEnumerable.bind(e)))}function D(e,t){if(e===t)return 0;for(var r=e.length,n=t.length,i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0}function B(e,t,r,n){if(e===t)return 0!==e||(!r||c(e,t));if(r){if("object"!==i(e))return"number"===typeof e&&l(e)&&l(t);if("object"!==i(t)||null===e||null===t)return!1;if(Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1}else{if(null===e||"object"!==i(e))return(null===t||"object"!==i(t))&&e==t;if(null===t||"object"!==i(t))return!1}var s,a,u,d,h=p(e);if(h!==p(t))return!1;if(Array.isArray(e)){if(e.length!==t.length)return!1;var f=N(e),y=N(t);return f.length===y.length&&L(e,t,r,n,1,f)}if("[object Object]"===h&&(!v(e)&&v(t)||!E(e)&&E(t)))return!1;if(b(e)){if(!b(t)||Date.prototype.getTime.call(e)!==Date.prototype.getTime.call(t))return!1}else if(w(e)){if(!w(t)||(u=e,d=t,!(o?u.source===d.source&&u.flags===d.flags:RegExp.prototype.toString.call(u)===RegExp.prototype.toString.call(d))))return!1}else if(_(e)||e instanceof Error){if(e.message!==t.message||e.name!==t.name)return!1}else{if(m(e)){if(r||!P(e)&&!k(e)){if(!function(e,t){return e.byteLength===t.byteLength&&0===D(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}(e,t))return!1}else if(!function(e,t){if(e.byteLength!==t.byteLength)return!1;for(var r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}(e,t))return!1;var O=N(e),B=N(t);return O.length===B.length&&L(e,t,r,n,0,O)}if(E(e))return!(!E(t)||e.size!==t.size)&&L(e,t,r,n,2);if(v(e))return!(!v(t)||e.size!==t.size)&&L(e,t,r,n,3);if(g(e)){if(a=t,(s=e).byteLength!==a.byteLength||0!==D(new Uint8Array(s),new Uint8Array(a)))return!1}else if(S(e)&&!function(e,t){return I(e)?I(t)&&c(Number.prototype.valueOf.call(e),Number.prototype.valueOf.call(t)):A(e)?A(t)&&String.prototype.valueOf.call(e)===String.prototype.valueOf.call(t):R(e)?R(t)&&Boolean.prototype.valueOf.call(e)===Boolean.prototype.valueOf.call(t):T(e)?T(t)&&BigInt.prototype.valueOf.call(e)===BigInt.prototype.valueOf.call(t):C(t)&&Symbol.prototype.valueOf.call(e)===Symbol.prototype.valueOf.call(t)}(e,t))return!1}return L(e,t,r,n,0)}function x(e,t){return t.filter((function(t){return f(e,t)}))}function L(e,t,r,n,i,o){if(5===arguments.length){o=Object.keys(e);var s=Object.keys(t);if(o.length!==s.length)return!1}for(var a=0;a<o.length;a++)if(!h(t,o[a]))return!1;if(r&&5===arguments.length){var c=u(e);if(0!==c.length){var l=0;for(a=0;a<c.length;a++){var d=c[a];if(f(e,d)){if(!f(t,d))return!1;o.push(d),l++}else if(f(t,d))return!1}var p=u(t);if(c.length!==p.length&&x(t,p).length!==l)return!1}else{var y=u(t);if(0!==y.length&&0!==x(t,y).length)return!1}}if(0===o.length&&(0===i||1===i&&0===e.length||0===e.size))return!0;if(void 0===n)n={val1:new Map,val2:new Map,position:0};else{var g=n.val1.get(e);if(void 0!==g){var m=n.val2.get(t);if(void 0!==m)return g===m}n.position++}n.val1.set(e,n.position),n.val2.set(t,n.position);var b=V(e,t,r,o,n,i);return n.val1.delete(e),n.val2.delete(t),b}function M(e,t,r,n){for(var i=s(e),o=0;o<i.length;o++){var a=i[o];if(B(t,a,r,n))return e.delete(a),!0}return!1}function U(e){switch(i(e)){case"undefined":return null;case"object":return;case"symbol":return!1;case"string":e=+e;case"number":if(l(e))return!1}return!0}function j(e,t,r){var n=U(r);return null!=n?n:t.has(n)&&!e.has(n)}function K(e,t,r,n,i){var o=U(r);if(null!=o)return o;var s=t.get(o);return!(void 0===s&&!t.has(o)||!B(n,s,!1,i))&&(!e.has(o)&&B(n,s,!1,i))}function F(e,t,r,n,i,o){for(var a=s(e),c=0;c<a.length;c++){var u=a[c];if(B(r,u,i,o)&&B(n,t.get(u),i,o))return e.delete(u),!0}return!1}function V(e,t,r,o,c,u){var l=0;if(2===u){if(!function(e,t,r,n){for(var o=null,a=s(e),c=0;c<a.length;c++){var u=a[c];if("object"===i(u)&&null!==u)null===o&&(o=new Set),o.add(u);else if(!t.has(u)){if(r)return!1;if(!j(e,t,u))return!1;null===o&&(o=new Set),o.add(u)}}if(null!==o){for(var l=s(t),d=0;d<l.length;d++){var h=l[d];if("object"===i(h)&&null!==h){if(!M(o,h,r,n))return!1}else if(!r&&!e.has(h)&&!M(o,h,r,n))return!1}return 0===o.size}return!0}(e,t,r,c))return!1}else if(3===u){if(!function(e,t,r,o){for(var s=null,c=a(e),u=0;u<c.length;u++){var l=n(c[u],2),d=l[0],h=l[1];if("object"===i(d)&&null!==d)null===s&&(s=new Set),s.add(d);else{var f=t.get(d);if(void 0===f&&!t.has(d)||!B(h,f,r,o)){if(r)return!1;if(!K(e,t,d,h,o))return!1;null===s&&(s=new Set),s.add(d)}}}if(null!==s){for(var p=a(t),y=0;y<p.length;y++){var g=n(p[y],2),m=(d=g[0],g[1]);if("object"===i(d)&&null!==d){if(!F(s,e,d,m,r,o))return!1}else if(!r&&(!e.has(d)||!B(e.get(d),m,!1,o))&&!F(s,e,d,m,!1,o))return!1}return 0===s.size}return!0}(e,t,r,c))return!1}else if(1===u)for(;l<e.length;l++){if(!h(e,l)){if(h(t,l))return!1;for(var d=Object.keys(e);l<d.length;l++){var f=d[l];if(!h(t,f)||!B(e[f],t[f],r,c))return!1}return d.length===Object.keys(t).length}if(!h(t,l)||!B(e[l],t[l],r,c))return!1}for(l=0;l<o.length;l++){var p=o[l];if(!B(e[p],t[p],r,c))return!1}return!0}e.exports={isDeepEqual:function(e,t){return B(e,t,false)},isDeepStrictEqual:function(e,t){return B(e,t,true)}}},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,o=c(e),s=o[0],a=o[1],u=new i(function(e,t,r){return 3*(t+r)/4-r}(0,s,a)),l=0,d=a>0?s-4:s;for(r=0;r<d;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,o=[],s=16383,a=0,c=n-i;a<c;a+=s)o.push(u(e,a,a+s>c?c:a+s));1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return o.join("")};for(var r=[],n=[],i="undefined"!==typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,a=o.length;s<a;++s)r[s]=o[s],n[o.charCodeAt(s)]=s;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,o,s=[],a=t;a<n;a+=3)i=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(r[(o=i)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},17144:function(e,t,r){var n;!function(i){"use strict";var o,s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,c=Math.floor,u="[BigNumber Error] ",l=u+"Number primitive has more than 15 significant digits: ",d=1e14,h=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 b(e){for(var t,r,n=1,i=e.length,o=e[0]+"";n<i;){for(t=e[n++]+"",r=h-t.length;r--;t="0"+t);o+=t}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function v(e,t){var r,n,i=e.c,o=t.c,s=e.s,a=t.s,c=e.e,u=t.e;if(!s||!a)return null;if(r=i&&!i[0],n=o&&!o[0],r||n)return r?n?0:-a:s;if(s!=a)return s;if(r=s<0,n=c==u,!i||!o)return n?0:!i^r?1:-1;if(!n)return c>u^r?1:-1;for(a=(c=i.length)<(u=o.length)?c:u,s=0;s<a;s++)if(i[s]!=o[s])return i[s]>o[s]^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/h)==t&&e.c[t]%2!=0}function _(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function S(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(++t>(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}o=function e(t){var r,n,i,o=M.prototype={constructor:M,toString:null,valueOf:null},I=new M(1),A=20,R=4,T=-7,C=21,P=-1e7,k=1e7,O=!1,N=1,D=0,B={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xa0",suffix:""},x="0123456789abcdefghijklmnopqrstuvwxyz",L=!0;function M(e,t){var r,o,a,u,d,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,d=e;d>=10;d/=10,u++);return void(u>k?m.c=m.e=null:(m.e=u,m.c=[e]))}g=String(e)}else{if(!s.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(".","")),(d=g.search(/e/i))>0?(u<0&&(u=d),u+=+g.slice(d+1),g=g.substring(0,d)):u<0&&(u=g.length)}else{if(w(t,2,x.length,"Base"),10==t&&L)return F(m=new M(e),A+m.e+1,R);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=x.slice(0,t),u=d=0,y=g.length;d<y;d++)if(r.indexOf(o=g.charAt(d))<0){if("."==o){if(d>u){u=y;continue}}else if(!a&&(g==g.toUpperCase()&&(g=g.toLowerCase())||g==g.toLowerCase()&&(g=g.toUpperCase()))){a=!0,d=-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(d=0;48===g.charCodeAt(d);d++);for(y=g.length;48===g.charCodeAt(--y););if(g=g.slice(d,++y)){if(y-=d,p&&M.DEBUG&&y>15&&(e>f||e!==c(e)))throw Error(l+m.s*e);if((u=u-d-1)>k)m.c=m.e=null;else if(u<P)m.c=[m.e=0];else{if(m.e=u,m.c=[],d=(u+1)%h,u<0&&(d+=h),d<y){for(d&&m.c.push(+g.slice(0,d)),y-=h;d<y;)m.c.push(+g.slice(d,d+=h));d=h-(g=g.slice(d)).length}else d-=y;for(;d--;g+="0");m.c.push(+g)}}else m.c=[m.e=0]}function U(e,t,r,n){var i,o,s,a,c;if(null==r?r=R:w(r,0,8),!e.c)return e.toString();if(i=e.c[0],s=e.e,null==t)c=b(e.c),c=1==n||2==n&&(s<=T||s>=C)?_(c,s):S(c,s,"0");else if(o=(e=F(new M(e),t,r)).e,a=(c=b(e.c)).length,1==n||2==n&&(t<=o||o<=T)){for(;a<t;c+="0",a++);c=_(c,o)}else if(t-=s,c=S(c,o,"0"),o+1>a){if(--t>0)for(c+=".";t--;c+="0");}else if((t+=o-a)>0)for(o+1==a&&(c+=".");t--;c+="0");return e.s<0&&i?"-"+c:c}function j(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 K(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*h-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,o,s,u,l,f,y,g=e.c,m=p;if(g){e:{for(i=1,u=g[0];u>=10;u/=10,i++);if((o=t-i)<0)o+=h,s=t,y=(l=g[f=0])/m[i-s-1]%10|0;else if((f=a((o+1)/h))>=g.length){if(!n)break e;for(;g.length<=f;g.push(0));l=y=0,i=1,s=(o%=h)-h+1}else{for(l=u=g[f],i=1;u>=10;u/=10,i++);y=(s=(o%=h)-h+i)<0?0:l/m[i-s-1]%10|0}if(n=n||t<0||null!=g[f+1]||(s<0?l:l%m[i-s-1]),n=r<4?(y||n)&&(0==r||r==(e.s<0?3:2)):y>5||5==y&&(4==r||n||6==r&&(o>0?s>0?l/m[i-s]: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[(h-t%h)%h],e.e=-t||0):g[0]=e.e=0,e;if(0==o?(g.length=f,u=1,f--):(g.length=f+1,u=m[h-o],g[f]=s>0?c(l/m[i-s]%m[s])*u:0),n)for(;;){if(0==f){for(o=1,s=g[0];s>=10;s/=10,o++);for(s=g[0]+=u,u=1;s>=10;s/=10,u++);o!=u&&(e.e++,g[0]==d&&(g[0]=1));break}if(g[f]+=u,g[f]!=d)break;g[f--]=0,u=1}for(o=g.length;0===g[--o];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=b(e.c),t=r<=T||r>=C?_(t,r):S(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),A=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(w(r=e[t],0,8,t),R=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(w(r[0],-g,0,t),w(r[1],0,g,t),T=r[0],C=r[1]):(w(r,-g,g,t),T=-(C=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),N=r),e.hasOwnProperty(t="POW_PRECISION")&&(w(r=e[t],0,g,t),D=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(u+t+" not an object: "+r);B=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(u+t+" invalid: "+r);L="0123456789"==r.slice(0,10),x=r}}return{DECIMAL_PLACES:A,ROUNDING_MODE:R,EXPONENTIAL_AT:[T,C],RANGE:[P,k],CRYPTO:O,MODULO_MODE:N,POW_PRECISION:D,FORMAT:B,ALPHABET:x}},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,o=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===o||-1===o)&&i>=-g&&i<=g&&i===c(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break e}if((t=(i+1)%h)<1&&(t+=h),String(n[0]).length==t){for(t=0;t<n.length;t++)if((r=n[t])<0||r>=d||r!==c(r))break e;if(0!==r)return!0}}}else if(null===n&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(u+"Invalid BigNumber: "+e)},M.maximum=M.max=function(){return j(arguments,o.lt)},M.minimum=M.min=function(){return j(arguments,o.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,o,s,l=0,d=[],f=new M(I);if(null==e?e=A:w(e,0,g),o=a(e/h),O)if(crypto.getRandomValues){for(r=crypto.getRandomValues(new Uint32Array(o*=2));l<o;)(s=131072*r[l]+(r[l+1]>>>11))>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),r[l]=n[0],r[l+1]=n[1]):(d.push(s%1e14),l+=2);l=o/2}else{if(!crypto.randomBytes)throw O=!1,Error(u+"crypto unavailable");for(r=crypto.randomBytes(o*=7);l<o;)(s=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):(d.push(s%1e14),l+=7);l=o/7}if(!O)for(;l<o;)(s=t())<9e15&&(d[l++]=s%1e14);for(o=d[--l],e%=h,o&&e&&(s=p[h-e],d[l]=c(o/s)*s);0===d[l];d.pop(),l--);if(l<0)d=[i=0];else{for(i=-1;0===d[0];d.splice(0,1),i-=h);for(l=1,s=d[0];s>=10;s/=10,l++);l<h&&(i-=h-l)}return f.e=i,f.c=d,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,o,s=[0],a=0,c=e.length;a<c;){for(o=s.length;o--;s[o]*=t);for(s[0]+=n.indexOf(e.charAt(a++)),i=0;i<s.length;i++)s[i]>r-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/r|0,s[i]%=r)}return s.reverse()}return function(n,i,o,s,a){var c,u,l,d,h,f,p,y,g=n.indexOf("."),m=A,v=R;for(g>=0&&(d=D,D=0,n=n.replace(".",""),f=(y=new M(i)).pow(n.length-g),D=d,y.c=t(S(b(f.c),f.e,"0"),10,o,e),y.e=y.c.length),l=d=(p=t(n,i,o,a?(c=x,e):(c=e,x))).length;0==p[--d];p.pop());if(!p[0])return c.charAt(0);if(g<0?--l:(f.c=p,f.e=l,f.s=s,p=(f=r(f,y,m,v,o)).c,h=f.r,l=f.e),g=p[u=l+m+1],d=o/2,h=h||u<0||null!=p[u+1],h=v<4?(null!=g||h)&&(0==v||v==(f.s<0?3:2)):g>d||g==d&&(4==v||h||6==v&&1&p[u-1]||v==(f.s<0?8:7)),u<1||!p[0])n=h?S(c.charAt(1),-m,c.charAt(0)):c.charAt(0);else{if(p.length=u,h)for(--o;++p[--u]>o;)p[u]=0,u||(++l,p=[1].concat(p));for(d=p.length;!p[--d];);for(g=0,n="";g<=d;n+=c.charAt(p[g++]));n=S(n,l,c.charAt(0))}return n}}(),r=function(){function e(e,t,r){var n,i,o,s,a=0,c=e.length,u=t%y,l=t/y|0;for(e=e.slice();c--;)a=((i=u*(o=e[c]%y)+(n=l*o+(s=e[c]/y|0)*u)%y*y+a)/r|0)+(n/y|0)+l*s,e[c]=i%r;return a&&(e=[a].concat(e)),e}function t(e,t,r,n){var i,o;if(r!=n)o=r>n?1:-1;else for(i=o=0;i<r;i++)if(e[i]!=t[i]){o=e[i]>t[i]?1:-1;break}return o}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,o,s,a){var u,l,f,p,y,g,b,v,w,E,_,S,I,A,R,T,C,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=(v=new M(P)).c=[],P=o+(l=n.e-i.e)+1,a||(a=d,l=m(n.e/h)-m(i.e/h),P=P/h|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(A=k.length,T=O.length,f=0,P+=2,(y=c(a/(O[0]+1)))>1&&(O=e(O,y,a),k=e(k,y,a),T=O.length,A=k.length),I=T,_=(E=k.slice(0,T)).length;_<T;E[_++]=0);C=O.slice(),C=[0].concat(C),R=O[0],O[1]>=a/2&&R++;do{if(y=0,(u=t(O,E,T,_))<0){if(S=E[0],T!=_&&(S=S*a+(E[1]||0)),(y=c(S/R))>1)for(y>=a&&(y=a-1),b=(g=e(O,y,a)).length,_=E.length;1==t(g,E,b,_);)y--,r(g,T<b?C:O,b,a),b=g.length,u=1;else 0==y&&(u=y=1),b=(g=O.slice()).length;if(b<_&&(g=[0].concat(g)),r(E,g,_,a),_=E.length,-1==u)for(;t(O,E,T,_)<1;)y++,r(E,T<_?C:O,_,a),_=E.length}else 0===u&&(y++,E=[0]);w[f++]=y,E[0]?E[_++]=k[I]||0:(E=[k[I]],_=1)}while((I++<A||null!=E[0])&&P--);p=null!=E[0],w[0]||w.splice(0,1)}if(a==d){for(f=1,P=w[0];P>=10;P/=10,f++);F(v,o+(v.e=f+l*h-1)+1,s,p)}else v.e=l,v.r=+p;return v}}(),i=function(){var e=/^(-?)0([xbo])(?=\w[\w.]*$)/i,t=/^([^.]+)\.$/,r=/^\.([^.]+)$/,n=/^-?(Infinity|NaN)$/,i=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(o,s,a,c){var l,d=a?s:s.replace(i,"");if(n.test(d))o.s=isNaN(d)?null:d<0?-1:1;else{if(!a&&(d=d.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,d=d.replace(t,"$1").replace(r,"0.$1")),s!=d))return new M(d,l);if(M.DEBUG)throw Error(u+"Not a"+(c?" base "+c:"")+" number: "+s);o.s=null}o.c=o.e=null}}(),o.absoluteValue=o.abs=function(){var e=new M(this);return e.s<0&&(e.s=1),e},o.comparedTo=function(e,t){return v(this,new M(e,t))},o.decimalPlaces=o.dp=function(e,t){var r,n,i,o=this;if(null!=e)return w(e,0,g),null==t?t=R:w(t,0,8),F(new M(o),e+o.e+1,t);if(!(r=o.c))return null;if(n=((i=r.length-1)-m(this.e/h))*h,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},o.dividedBy=o.div=function(e,t){return r(this,new M(e,t),A,R)},o.dividedToIntegerBy=o.idiv=function(e,t){return r(this,new M(e,t),0,1)},o.exponentiatedBy=o.pow=function(e,t){var r,n,i,o,s,l,d,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)),s=e.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!e.c||!e.c[0])return f=new M(Math.pow(+V(p),s?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||s&&p.c[1]>=24e7:p.c[0]<8e13||s&&p.c[0]<=9999975e7)))return o=p.s<0&&E(e)?-0:0,p.e>-1&&(o=1/o),new M(l?1/o:o);D&&(o=a(D/h+2))}for(s?(r=new M(.5),l&&(e.s=1),d=E(e)):d=(i=Math.abs(+V(e)))%2,f=new M(I);;){if(d){if(!(f=f.times(p)).c)break;o?f.c.length>o&&(f.c.length=o):n&&(f=f.mod(t))}if(i){if(0===(i=c(i/2)))break;d=i%2}else if(F(e=e.times(r),e.e+1,1),e.e>14)d=E(e);else{if(0===(i=+V(e)))break;d=i%2}p=p.times(p),o?p.c&&p.c.length>o&&(p.c.length=o):n&&(p=p.mod(t))}return n?f:(l&&(f=I.div(f)),t?f.mod(t):o?F(f,D,R,undefined):f)},o.integerValue=function(e){var t=new M(this);return null==e?e=R:w(e,0,8),F(t,t.e+1,e)},o.isEqualTo=o.eq=function(e,t){return 0===v(this,new M(e,t))},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(e,t){return v(this,new M(e,t))>0},o.isGreaterThanOrEqualTo=o.gte=function(e,t){return 1===(t=v(this,new M(e,t)))||0===t},o.isInteger=function(){return!!this.c&&m(this.e/h)>this.c.length-2},o.isLessThan=o.lt=function(e,t){return v(this,new M(e,t))<0},o.isLessThanOrEqualTo=o.lte=function(e,t){return-1===(t=v(this,new M(e,t)))||0===t},o.isNaN=function(){return!this.s},o.isNegative=function(){return this.s<0},o.isPositive=function(){return this.s>0},o.isZero=function(){return!!this.c&&0==this.c[0]},o.minus=function(e,t){var r,n,i,o,s=this,a=s.s;if(t=(e=new M(e,t)).s,!a||!t)return new M(NaN);if(a!=t)return e.s=-t,s.plus(e);var c=s.e/h,u=e.e/h,l=s.c,f=e.c;if(!c||!u){if(!l||!f)return l?(e.s=-t,e):new M(f?s:NaN);if(!l[0]||!f[0])return f[0]?(e.s=-t,e):new M(l[0]?s:3==R?-0:0)}if(c=m(c),u=m(u),l=l.slice(),a=c-u){for((o=a<0)?(a=-a,i=l):(u=c,i=f),i.reverse(),t=a;t--;i.push(0));i.reverse()}else for(n=(o=(a=l.length)<(t=f.length))?a:t,a=t=0;t<n;t++)if(l[t]!=f[t]){o=l[t]<f[t];break}if(o&&(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=d-1;n>a;){if(l[--n]<f[n]){for(r=n;r&&!l[--r];l[r]=t);--l[r],l[n]+=d}l[n]-=f[n]}for(;0==l[0];l.splice(0,1),--u);return l[0]?K(e,l,u):(e.s=3==R?-1:1,e.c=[e.e=0],e)},o.modulo=o.mod=function(e,t){var n,i,o=this;return e=new M(e,t),!o.c||!e.s||e.c&&!e.c[0]?new M(NaN):!e.c||o.c&&!o.c[0]?new M(o):(9==N?(i=e.s,e.s=1,n=r(o,e,0,3),e.s=i,n.s*=i):n=r(o,e,0,N),(e=o.minus(n.times(e))).c[0]||1!=N||(e.s=o.s),e)},o.multipliedBy=o.times=function(e,t){var r,n,i,o,s,a,c,u,l,f,p,g,b,v,w,E=this,_=E.c,S=(e=new M(e,t)).c;if(!_||!S||!_[0]||!S[0])return!E.s||!e.s||_&&!_[0]&&!S||S&&!S[0]&&!_?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/h)+m(e.e/h),e.s*=E.s,(c=_.length)<(f=S.length)&&(b=_,_=S,S=b,i=c,c=f,f=i),i=c+f,b=[];i--;b.push(0));for(v=d,w=y,i=f;--i>=0;){for(r=0,p=S[i]%w,g=S[i]/w|0,o=i+(s=c);o>i;)r=((u=p*(u=_[--s]%w)+(a=g*u+(l=_[s]/w|0)*p)%w*w+b[o]+r)/v|0)+(a/w|0)+g*l,b[o--]=u%v;b[o]=r}return r?++n:b.splice(0,1),K(e,b,n)},o.negated=function(){var e=new M(this);return e.s=-e.s||null,e},o.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 o=n.e/h,s=e.e/h,a=n.c,c=e.c;if(!o||!s){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(o=m(o),s=m(s),a=a.slice(),i=o-s){for(i>0?(s=o,r=c):(i=-i,r=a),r.reverse();i--;r.push(0));r.reverse()}for((i=a.length)-(t=c.length)<0&&(r=c,c=a,a=r,t=i),i=0;t;)i=(a[--t]=a[t]+c[t]+i)/d|0,a[t]=d===a[t]?0:a[t]%d;return i&&(a=[i].concat(a),++s),K(e,a,s)},o.precision=o.sd=function(e,t){var r,n,i,o=this;if(null!=e&&e!==!!e)return w(e,1,g),null==t?t=R:w(t,0,8),F(new M(o),e,t);if(!(r=o.c))return null;if(n=(i=r.length-1)*h+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&o.e+1>n&&(n=o.e+1),n},o.shiftedBy=function(e){return w(e,-9007199254740991,f),this.times("1e"+e)},o.squareRoot=o.sqrt=function(){var e,t,n,i,o,s=this,a=s.c,c=s.s,u=s.e,l=A+4,d=new M("0.5");if(1!==c||!a||!a[0])return new M(!c||c<0&&(!a||a[0])?NaN:a?s:1/0);if(0==(c=Math.sqrt(+V(s)))||c==1/0?(((t=b(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(o=n,n=d.times(o.plus(r(s,o,l,1))),b(o.c).slice(0,c)===(t=b(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+A+2,1),e=!n.times(n).eq(s));break}if(!i&&(F(o,o.e+A+2,0),o.times(o).eq(s))){n=o;break}l+=4,c+=4,i=1}return F(n,n.e+A+1,R,e)},o.toExponential=function(e,t){return null!=e&&(w(e,0,g),e++),U(this,e,t,1)},o.toFixed=function(e,t){return null!=e&&(w(e,0,g),e=e+this.e+1),U(this,e,t)},o.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=B;else if("object"!=typeof r)throw Error(u+"Argument not an object: "+r);if(n=i.toFixed(e,t),i.c){var o,s=n.split("."),a=+r.groupSize,c=+r.secondaryGroupSize,l=r.groupSeparator||"",d=s[0],h=s[1],f=i.s<0,p=f?d.slice(1):d,y=p.length;if(c&&(o=a,a=c,c=o,y-=o),a>0&&y>0){for(o=y%a||a,d=p.substr(0,o);o<y;o+=a)d+=l+p.substr(o,a);c>0&&(d+=l+p.slice(o)),f&&(d="-"+d)}n=h?d+(r.decimalSeparator||"")+((c=+r.fractionGroupSize)?h.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):h):d}return(r.prefix||"")+n+(r.suffix||"")},o.toFraction=function(e){var t,n,i,o,s,a,c,l,d,f,y,g,m=this,v=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(!v)return new M(m);for(t=new M(I),d=n=new M(I),i=l=new M(I),g=b(v),s=t.e=g.length-m.e-1,t.c[0]=p[(a=s%h)<0?h+a:a],e=!e||c.comparedTo(t)>0?s>0?t:d:c,a=k,k=1/0,c=new M(g),l.c[0]=0;f=r(c,t,0,1),1!=(o=n.plus(f.times(i))).comparedTo(e);)n=i,i=o,d=l.plus(f.times(o=d)),l=o,t=c.minus(f.times(o=t)),c=o;return o=r(e.minus(n),i,0,1),l=l.plus(o.times(d)),n=n.plus(o.times(i)),l.s=d.s=m.s,y=r(d,i,s*=2,R).minus(m).abs().comparedTo(r(l,n,s,R).minus(m).abs())<1?[d,i]:[l,n],k=a,y},o.toNumber=function(){return+V(this)},o.toPrecision=function(e,t){return null!=e&&w(e,1,g),U(this,e,t,2)},o.toString=function(e){var t,r=this,i=r.s,o=r.e;return null===o?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(null==e?t=o<=T||o>=C?_(b(r.c),o):S(b(r.c),o,"0"):10===e&&L?t=S(b((r=F(new M(r),A+o+1,R)).c),r.e,"0"):(w(e,2,x.length,"Base"),t=n(S(b(r.c),o,"0"),10,e,i,!0)),i<0&&r.c[0]&&(t="-"+t)),t},o.valueOf=o.toJSON=function(){return V(this)},o._isBigNumber=!0,null!=t&&M.set(t),M}(),o.default=o.BigNumber=o,void 0===(n=function(){return o}.call(t,r,t,e))||(e.exports=n)}()},41976:(e,t,r)=>{"use strict";const{Buffer:n}=r(19778),i=Symbol.for("BufferList");function o(e){if(!(this instanceof o))return new o(e);o._init.call(this,e)}o._init=function(e){Object.defineProperty(this,i,{value:!0}),this._bufs=[],this.length=0,e&&this.append(e)},o.prototype._new=function(e){return new o(e)},o.prototype._offset=function(e){if(0===e)return[0,0];let t=0;for(let r=0;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}},o.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},o.prototype.get=function(e){if(e>this.length||e<0)return;const t=this._offset(e);return this._bufs[t[0]][t[1]]},o.prototype.slice=function(e,t){return"number"===typeof e&&e<0&&(e+=this.length),"number"===typeof t&&t<0&&(t+=this.length),this.copy(null,0,e,t)},o.prototype.copy=function(e,t,r,i){if(("number"!==typeof r||r<0)&&(r=0),("number"!==typeof i||i>this.length)&&(i=this.length),r>=this.length)return e||n.alloc(0);if(i<=0)return e||n.alloc(0);const o=!!e,s=this._offset(r),a=i-r;let c=a,u=o&&t||0,l=s[1];if(0===r&&i===this.length){if(!o)return 1===this._bufs.length?this._bufs[0]:n.concat(this._bufs,this.length);for(let t=0;t<this._bufs.length;t++)this._bufs[t].copy(e,u),u+=this._bufs[t].length;return e}if(c<=this._bufs[s[0]].length-l)return o?this._bufs[s[0]].copy(e,t,l,l+c):this._bufs[s[0]].slice(l,l+c);o||(e=n.allocUnsafe(a));for(let n=s[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},o.prototype.shallowSlice=function(e,t){if(e=e||0,t="number"!==typeof t?this.length:t,e<0&&(e+=this.length),t<0&&(t+=this.length),e===t)return this._new();const r=this._offset(e),n=this._offset(t),i=this._bufs.slice(r[0],n[0]+1);return 0===n[1]?i.pop():i[i.length-1]=i[i.length-1].slice(0,n[1]),0!==r[1]&&(i[0]=i[0].slice(r[1])),this._new(i)},o.prototype.toString=function(e,t,r){return this.slice(t,r).toString(e)},o.prototype.consume=function(e){if(e=Math.trunc(e),Number.isNaN(e)||e<=0)return this;for(;this._bufs.length;){if(!(e>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},o.prototype.duplicate=function(){const e=this._new();for(let t=0;t<this._bufs.length;t++)e.append(this._bufs[t]);return e},o.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},o.prototype._appendBuffer=function(e){this._bufs.push(e),this.length+=e.length},o.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 o=i[0],s=i[1];for(;o<this._bufs.length;o++){const t=this._bufs[o];for(;s<t.length;){if(t.length-s>=e.length){const r=t.indexOf(e,s);if(-1!==r)return this._reverseOffset([o,r]);s=t.length-e.length+1}else{const t=this._reverseOffset([o,s]);if(this._match(t,e))return t;s++}}s=0}return-1},o.prototype._match=function(e,t){if(this.length-e<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){o.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)}(),o.prototype._isBufferList=function(e){return e instanceof o||o.isBufferList(e)},o.isBufferList=function(e){return null!=e&&e[i]},e.exports=o},19778:(e,t,r)=>{"use strict";const n=r(2009),i=r(84038),o="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 s=2147483647;function a(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,r){if("number"===typeof e){if("string"===typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(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 h(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(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||X(e.length)?a(0):h(e);if("Buffer"===e.type&&Array.isArray(e.data))return h(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 d(e){return l(e),a(e<0?0:0|p(e))}function h(e){const t=e.length<0?0:0|p(e.length),r=a(t);for(let n=0;n<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>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function y(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||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 R(this,t,r);case"ascii":return C(this,t,r);case"latin1":case"binary":return P(this,t,r);case"base64":return A(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 b(e,t,r,n,i){if(0===e.length)return-1;if("string"===typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),X(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"===typeof t&&(t=c.from(t,n)),c.isBuffer(t))return 0===t.length?-1:v(e,t,r,n,i);if("number"===typeof t)return t&=255,"function"===typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):v(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,r,n,i){let o,s=1,a=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){let n=-1;for(o=r;o<a;o++)if(u(e,o)===u(t,-1===n?0:o-n)){if(-1===n&&(n=o),o-n+1===c)return n*s}else-1!==n&&(o-=o-n),n=-1}else for(r+c>a&&(r=a-c),o=r;o>=0;o--){let r=!0;for(let n=0;n<c;n++)if(u(e,o+n)!==u(t,n)){r=!1;break}if(r)return o}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 o=t.length;let s;for(n>o/2&&(n=o/2),s=0;s<n;++s){const n=parseInt(t.substr(2*s,2),16);if(X(n))return s;e[r+s]=n}return s}function E(e,t,r,n){return Y(G(t,e.length-r),e,r,n)}function _(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 S(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 o=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function A(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function R(e,t,r){r=Math.min(e.length,r);const n=[];let i=t;for(;i<r;){const t=e[i];let o=null,s=t>239?4:t>223?3:t>191?2:1;if(i+s<=r){let r,n,a,c;switch(s){case 1:t<128&&(o=t);break;case 2:r=e[i+1],128===(192&r)&&(c=(31&t)<<6|63&r,c>127&&(o=c));break;case 3:r=e[i+1],n=e[i+2],128===(192&r)&&128===(192&n)&&(c=(15&t)<<12|(63&r)<<6|63&n,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:r=e[i+1],n=e[i+2],a=e[i+3],128===(192&r)&&128===(192&n)&&128===(192&a)&&(c=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&a,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return function(e){const t=e.length;if(t<=T)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=T));return r}(n)}t.kMaxLength=s,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 d(e)},c.allocUnsafeSlow=function(e){return d(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,o=Math.min(r,n);i<o;++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?R(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+">"},o&&(c.prototype[o]=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 o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0);const a=Math.min(o,s),u=this.slice(n,i),l=e.slice(t,r);for(let c=0;c<a;++c)if(u[c]!==l[c]){o=u[c],s=l[c];break}return o<s?-1:s<o?1:0},c.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},c.prototype.indexOf=function(e,t,r){return b(this,e,t,r,!0)},c.prototype.lastIndexOf=function(e,t,r){return b(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 o=!1;for(;;)switch(n){case"hex":return w(this,e,t,r);case"utf8":case"utf-8":return E(this,e,t,r);case"ascii":case"latin1":case"binary":return _(this,e,t,r);case"base64":return S(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const T=4096;function C(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 o=t;o<r;++o)i+=J[e[o]];return i}function O(e,t,r){const n=e.slice(t,r);let i="";for(let o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function N(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 D(e,t,r,n,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function B(e,t,r,n,i){V(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,r}function x(e,t,r,n,i){V(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o>>=8,e[r+6]=o,o>>=8,e[r+5]=o,o>>=8,e[r+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=s,s>>=8,e[r+2]=s,s>>=8,e[r+1]=s,s>>=8,e[r]=s,r+8}function L(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function M(e,t,r,n,o){return t=+t,r>>>=0,o||L(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function U(e,t,r,n,o){return t=+t,r>>>=0,o||L(e,0,r,8),i.write(e,t,r,n,52,8),r+8}c.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<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||N(e,t,this.length);let n=this[e],i=1,o=0;for(;++o<t&&(i*=256);)n+=this[e+o]*i;return n},c.prototype.readUintBE=c.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||N(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||N(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||N(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||N(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||N(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||N(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||H(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(n)+(BigInt(i)<<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||H(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)})),c.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||N(e,t,this.length);let n=this[e],i=1,o=0;for(;++o<t&&(i*=256);)n+=this[e+o]*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||N(e,t,this.length);let n=t,i=1,o=this[e+--n];for(;n>0&&(i*=256);)o+=this[e+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return e>>>=0,t||N(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||N(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||N(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||N(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||N(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||H(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||H(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||N(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||N(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||N(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||N(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){D(this,e,t,r,Math.pow(2,8*r)-1,0)}let i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=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){D(this,e,t,r,Math.pow(2,8*r)-1,0)}let i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||D(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||D(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||D(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||D(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||D(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 B(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 x(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);D(this,e,t,r,n-1,-n)}let i=0,o=1,s=0;for(this[t]=255&e;++i<r&&(o*=256);)e<0&&0===s&&0!==this[t+i-1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},c.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);D(this,e,t,r,n-1,-n)}let i=r-1,o=1,s=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},c.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||D(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||D(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||D(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||D(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||D(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 B(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 x(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 o=c.isBuffer(e)?e:c.from(e,n),s=o.length;if(0===s)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=o[i%s]}return this};const j={};function K(e,t,r){j[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,o){if(e>r||e<t){const n="bigint"===typeof t?"n":"";let i;throw i=o>3?0===t||t===BigInt(0)?">= 0".concat(n," and < 2").concat(n," ** ").concat(8*(o+1)).concat(n):">= -(2".concat(n," ** ").concat(8*(o+1)-1).concat(n,") and < 2 ** ")+"".concat(8*(o+1)-1).concat(n):">= ".concat(t).concat(n," and <= ").concat(r).concat(n),new j.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,r){q(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||H(t,e.length-(r+1))}(n,i,o)}function q(e,t){if("number"!==typeof e)throw new j.ERR_INVALID_ARG_TYPE(t,"number",e)}function H(e,t,r){if(Math.floor(e)!==e)throw q(e,r),new j.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new j.ERR_BUFFER_OUT_OF_BOUNDS;throw new j.ERR_OUT_OF_RANGE(r||"offset",">= ".concat(r?1:0," and <= ").concat(t),e)}K("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?"".concat(e," is outside of buffer bounds"):"Attempt to access memory outside buffer bounds"}),RangeError),K("ERR_INVALID_ARG_TYPE",(function(e,t){return'The "'.concat(e,'" argument must be of type number. Received type ').concat(typeof t)}),TypeError),K("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 z=/[^+/0-9A-Za-z-_]/g;function G(e,t){let r;t=t||1/0;const n=e.length;let i=null;const o=[];for(let s=0;s<n;++s){if(r=e.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function W(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(z,"")).length<2)return"";for(;e.length%4!==0;)e+="=";return e}(e))}function 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 X(e){return e!==e}const J=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")}},44037:(e,t,r)=>{"use strict";var n=r(52506),i=r(19722),o=i(n("String.prototype.indexOf"));e.exports=function(e,t){var r=n(e,!!t);return"function"===typeof r&&o(e,".prototype.")>-1?i(r):r}},19722:(e,t,r)=>{"use strict";var n=r(33350),i=r(52506),o=i("%Function.prototype.apply%"),s=i("%Function.prototype.call%"),a=i("%Reflect.apply%",!0)||n.call(s,o),c=i("%Object.getOwnPropertyDescriptor%",!0),u=i("%Object.defineProperty%",!0),l=i("%Math.max%");if(u)try{u({},"a",{value:1})}catch(h){u=null}e.exports=function(e){var t=a(n,s,arguments);if(c&&u){var r=c(t,"length");r.configurable&&u(t,"length",{value:1+l(0,e.length-(arguments.length-1))})}return t};var d=function(){return a(n,o,arguments)};u?u(e.exports,"apply",{value:d}):e.exports.apply=d},83708:e=>{"use strict";e.exports=function(e,t){let{className:r,symbolName:n}=t;const i=Symbol.for(n),o={[r]:class extends e{constructor(){super(...arguments),Object.defineProperty(this,i,{value:!0})}get[Symbol.toStringTag](){return r}}}[r];return o["is".concat(r)]=e=>!(!e||!e[i]),o},e.exports.proto=function(e,t){let{className:r,symbolName:n,withoutNew:i}=t;const o=Symbol.for(n),s={[r]:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];if(i&&!(this instanceof s))return new s(...r);const a=e.call(this,...r)||this;return a&&!a[o]&&Object.defineProperty(a,o,{value:!0}),a}}[r];return s.prototype=Object.create(e.prototype),s.prototype.constructor=s,Object.defineProperty(s.prototype,Symbol.toStringTag,{get:()=>r}),s["is".concat(r)]=e=>!(!e||!e[o]),s}},75235:(e,t,r)=>{"use strict";const n=r(5696),i=/\s+at.*(?:\(|\s)(.*)\)?/,o=/^(?:(?:(?:node|(?:internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)\.js:\d+:\d+)|native)/,s="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")&&!o.test(r)})).filter((e=>""!==e.trim())).map((e=>t.pretty?e.replace(i,((e,t)=>e.replace(t,t.replace(s,"~")))):e)).join("\n"))},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/store-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,o,s=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 o=a,s=Number(new Date),c=s-(r||s);o.diff=c,o.prev=r,o.curr=s,r=s,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(o,t),n.splice(u,1),u--}return e})),t.formatArgs.call(o,n);const l=o.log||t.log;l.apply(o,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!==s?s:(i!==t.namespaces&&(i=t.namespaces,o=t.enabled(e)),o),set:e=>{s=e}}),"function"===typeof t.init&&t.init(a),a}function n(e,r){const n=t(this.namespace+("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.slice(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}},9396:(e,t,r)=>{"use strict";var n=r(24892),i="function"===typeof Symbol&&"symbol"===typeof Symbol("foo"),o=Object.prototype.toString,s=Array.prototype.concat,a=Object.defineProperty,c=r(84510)(),u=a&&c,l=function(e,t,r,n){var i;(!(t in e)||"function"===typeof(i=n)&&"[object Function]"===o.call(i)&&n())&&(u?a(e,t,{configurable:!0,enumerable:!1,value:r,writable:!0}):e[t]=r)},d=function(e,t){var r=arguments.length>2?arguments[2]:{},o=n(t);i&&(o=s.call(o,Object.getOwnPropertySymbols(t)));for(var a=0;a<o.length;a+=1)l(e,o[a],t[o[a]],r[o[a]])};d.supportsDescriptors=!!u,e.exports=d},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,o=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 o}}},t.prototype.remove=function(e,t){var r,n=e,i=t;if(n===(0|n)&&this._head!==this._tail){var o=this.size(),s=this._list.length;if(!(n>=o||n<-o||t<1)){if(n<0&&(n+=o),1===t||!t)return(r=new Array(1))[0]=this.removeOne(n),r;if(0===n&&n+t>=o)return r=this.toArray(),this.clear(),r;var a;for(n+t>o&&(t=o-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===o){for(this._tail=this._tail-t+s&this._capacityMask,a=t;a>0;a--)this._list[n=n+1+s&this._capacityMask]=void 0;return r}if(0===e){for(this._head=this._head+t+s&this._capacityMask,a=t-1;a>0;a--)this._list[n=n+1+s&this._capacityMask]=void 0;return r}if(n<o/2){for(this._head=this._head+e+t+s&this._capacityMask,a=e;a>0;a--)this.unshift(this._list[n=n-1+s&this._capacityMask]);for(n=this._head-1+s&this._capacityMask;i>0;)this._list[n=n-1+s&this._capacityMask]=void 0,i--;e<0&&(this._tail=n)}else{for(this._tail=n,n=n+t+s&this._capacityMask,a=o-(t+e);a>0;a--)this.push(this._list[n++]);for(n=this._tail;i>0;)this._list[n=n+1+s&this._capacityMask]=void 0,i--}return this._head<2&&this._tail>1e4&&this._tail<=s>>>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,o,s,a=arguments.length,c=this._list.length,u=2;if(!n||r<n/2){for(o=new Array(r),i=0;i<r;i++)o[i]=this._list[this._head+i&this._capacityMask];for(0===t?(s=[],r>0&&(this._head=this._head+r+c&this._capacityMask)):(s=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(o[i-1])}else{var l=(o=new Array(n-(r+t))).length;for(i=0;i<l;i++)o[i]=this._list[this._head+r+t+i&this._capacityMask];for(0===t?(s=[],r!=n&&(this._tail=this._head+r+c&this._capacityMask)):(s=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(o[i])}return s}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 o=r(449),s=r(20827);class a{constructor(){let{maxCache:e=100}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._cache=new o({max:e}),this._servers=["https://cloudflare-dns.com/dns-query","https://dns.google/resolve"]}getServers(){return this._servers}_getShuffledServers(){const e=[].concat(this._servers);for(let t=e.length-1;t>0;t--){const r=Math.floor(Math.random()*t),n=e[t];e[t]=e[r],e[r]=n}return e}setServers(e){this._servers=e}resolve(e){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(s.getCacheKey(e,t));if(r)return r;for(const o of this._getShuffledServers())try{const r=await s.fetch(s.buildResource({serverResolver:o,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(s.getCacheKey(e,t),i,{ttl:a}),i}catch(n){i.error("".concat(o," 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(s.getCacheKey(e,t));if(r)return r;for(const o of this._getShuffledServers())try{const r=await s.fetch(s.buildResource({serverResolver:o,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(s.getCacheKey(e,t),i,{ttl:a}),i}catch(n){i.error("".concat(o," 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(s.getCacheKey(e,t));if(r)return r;for(const o of this._getShuffledServers())try{const r=await s.fetch(s.buildResource({serverResolver:o,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(s.getCacheKey(e,t),i,{ttl:a}),i}catch(n){i.error("".concat(o," 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)}}},7404:(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}},78957:(e,t,r)=>{"use strict";const n=r(19778).Buffer,i=r(61551),o=r(38641),s=r(21418),a=r(7404),c=r(14201),u=r(23673),l=32768,d=t.name={};d.encode=function(e,t,r){t||(t=n.alloc(d.encodingLength(e))),r||(r=0);const i=r,o=e.replace(/^\.|\.$/gm,"");if(o.length){const e=o.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,d.encode.bytes=r-i,t},d.encode.bytes=0,d.decode=function(e,t){t||(t=0);const r=[];let n=t,i=0,o=0,s=!1;for(;;){if(t>=e.length)throw new Error("Cannot decode name (buffer overflow)");const a=e[t++];if(o+=s?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,o+=s?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,o+=s?0:1,s=!0}}}return d.decode.bytes=o,0===r.length?".":r.join(".")},d.decode.bytes=0,d.encodingLength=function(e){return"."===e||".."===e?1:n.byteLength(e.replace(/^\.|\.$/gm,""))+2};const h={encode:function(e,t,r){t||(t=n.alloc(h.encodingLength(e))),r||(r=0);const i=t.write(e,r+1);return t[r]=i,h.encode.bytes=i+1,t}};h.encode.bytes=0,h.decode=function(e,t){t||(t=0);const r=e[t],n=e.toString("utf-8",t+1,t+1+r);return h.decode.bytes=r+1,n},h.decode.bytes=0,h.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:s.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:o.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),d.encode(e,t,r+2),t.writeUInt16BE(d.encode.bytes,r),y.encode.bytes=d.encode.bytes+2,t},y.encode.bytes=0,y.decode=function(e,t){t||(t=0);const r=e.readUInt16BE(t),n=d.decode(e,t+2);return y.decode.bytes=r+2,n},y.decode.bytes=0,y.encodingLength=function(e){return d.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,d.encode(e.mname,t,r),r+=d.encode.bytes,d.encode(e.rname,t,r),r+=d.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=d.decode(e,t),t+=d.decode.bytes,n.rname=d.decode(e,t),t+=d.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+d.encodingLength(e.mname)+d.encodingLength(e.rname)};const m=t.txt={};m.encode=function(e,t,r){Array.isArray(e)||(e=[e]);for(let o=0;o<e.length;o++)if("string"===typeof e[o]&&(e[o]=n.from(e[o])),!n.isBuffer(e[o]))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 b=t.null={};b.encode=function(e,t,r){t||(t=n.alloc(b.encodingLength(e))),r||(r=0),"string"===typeof e&&(e=n.from(e)),e||(e=n.alloc(0));const i=r;r+=2;const o=e.length;return e.copy(t,r,0,o),r+=o,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=e.readUInt16BE(t);t+=2;const i=e.slice(t,t+n);return t+=n,b.decode.bytes=t-r,i},b.decode.bytes=0,b.encodingLength=function(e){return e?(n.isBuffer(e)?e.length:n.byteLength(e))+2:2};const v=t.hinfo={};v.encode=function(e,t,r){t||(t=n.alloc(v.encodingLength(e))),r||(r=0);const i=r;return r+=2,h.encode(e.cpu,t,r),r+=h.encode.bytes,h.encode(e.os,t,r),r+=h.encode.bytes,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={};return t+=2,n.cpu=h.decode(e,t),t+=h.decode.bytes,n.os=h.decode(e,t),t+=h.decode.bytes,v.decode.bytes=t-r,n},v.decode.bytes=0,v.encodingLength=function(e){return h.encodingLength(e.cpu)+h.encodingLength(e.os)+2};const w=t.ptr={},E=t.cname=w,_=t.dname=w;w.encode=function(e,t,r){return t||(t=n.alloc(w.encodingLength(e))),r||(r=0),d.encode(e,t,r+2),t.writeUInt16BE(d.encode.bytes,r),w.encode.bytes=d.encode.bytes+2,t},w.encode.bytes=0,w.decode=function(e,t){t||(t=0);const r=d.decode(e,t+2);return w.decode.bytes=d.decode.bytes+2,r},w.decode.bytes=0,w.encodingLength=function(e){return d.encodingLength(e)+2};const S=t.srv={};S.encode=function(e,t,r){t||(t=n.alloc(S.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),d.encode(e.target,t,r+8);const i=d.encode.bytes+6;return t.writeUInt16BE(i,r),S.encode.bytes=i+2,t},S.encode.bytes=0,S.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=d.decode(e,t+8),S.decode.bytes=r+2,n},S.decode.bytes=0,S.encodingLength=function(e){return 8+d.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,h.encode(e.tag,t,r),r+=h.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=h.decode(e,t),t+=h.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 h.encodingLength(e.tag)+h.encodingLength(e.value)+2};const A=t.mx={};A.encode=function(e,t,r){t||(t=n.alloc(A.encodingLength(e))),r||(r=0);const i=r;return r+=2,t.writeUInt16BE(e.preference||0,r),r+=2,d.encode(e.exchange,t,r),r+=d.encode.bytes,t.writeUInt16BE(r-i-2,i),A.encode.bytes=r-i,t},A.encode.bytes=0,A.decode=function(e,t){t||(t=0);const r=t,n={};return t+=2,n.preference=e.readUInt16BE(t),t+=2,n.exchange=d.decode(e,t),t+=d.decode.bytes,A.decode.bytes=t-r,n},A.encodingLength=function(e){return 4+d.encodingLength(e.exchange)};const R=t.a={};R.encode=function(e,t,r){return t||(t=n.alloc(R.encodingLength(e))),r||(r=0),t.writeUInt16BE(4,r),r+=2,u.v4.encode(e,t,r),R.encode.bytes=6,t},R.encode.bytes=0,R.decode=function(e,t){t||(t=0),t+=2;const r=u.v4.decode(e,t);return R.decode.bytes=6,r},R.decode.bytes=0,R.encodingLength=function(){return 6};const T=t.aaaa={};T.encode=function(e,t,r){return t||(t=n.alloc(T.encodingLength(e))),r||(r=0),t.writeUInt16BE(16,r),r+=2,u.v6.encode(e,t,r),T.encode.bytes=18,t},T.encode.bytes=0,T.decode=function(e,t){t||(t=0),t+=2;const r=u.v6.decode(e,t);return T.decode.bytes=18,r},T.decode.bytes=0,T.encodingLength=function(){return 18};const C=t.option={};C.encode=function(e,t,r){t||(t=n.alloc(C.encodingLength(e))),r||(r=0);const i=r,o=c.toCode(e.code);if(t.writeUInt16BE(o,r),r+=2,e.data)t.writeUInt16BE(e.data.length,r),r+=2,e.data.copy(t,r),r+=e.data.length;else switch(o){case 8:const i=e.sourcePrefixLength||0,o=e.family||u.familyOf(e.ip),s=u.encode(e.ip,n.alloc),a=Math.ceil(i/8);t.writeUInt16BE(a+4,r),r+=2,t.writeUInt16BE(o,r),r+=2,t.writeUInt8(i,r++),t.writeUInt8(e.scopePrefixLength||0,r++),s.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 C.encode.bytes=r-i,t},C.encode.bytes=0,C.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 o=n.alloc(1===r.family?4:16);e.copy(o,0,t,t+i-4),r.ip=u.decode(o);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 C.decode.bytes=i+4,r},C.decode.bytes=0,C.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,o=K(e,C);return t.writeUInt16BE(o,r),r=F(e,C,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 o=0;for(;i>0;)n[o++]=C.decode(e,t),t+=C.decode.bytes,i-=C.decode.bytes;return P.decode.bytes=t-r,n},P.decode.bytes=0,P.encodingLength=function(e){return 2+K(e||[],C)};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,o=e.key;if(!n.isBuffer(o))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,o.copy(t,r,0,o.length),r+=o.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 o=r,s=e.signature;if(!n.isBuffer(s))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,d.encode(e.signersName,t,r),r+=d.encode.bytes,s.copy(t,r,0,s.length),r+=s.length,O.encode.bytes=r-o,t.writeUInt16BE(O.encode.bytes-2,o),t},O.encode.bytes=0,O.decode=function(e,t){t||(t=0);const r=t;var n={},o=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=d.decode(e,t),t+=d.decode.bytes,n.signature=e.slice(t,r+o+2),t+=n.signature.length,O.decode.bytes=t-r,n},O.decode.bytes=0,O.encodingLength=function(e){return 20+d.encodingLength(e.signersName)+n.byteLength(e.signature)};const N=t.rp={};N.encode=function(e,t,r){t||(t=n.alloc(N.encodingLength(e))),r||(r=0);const i=r;return r+=2,d.encode(e.mbox||".",t,r),r+=d.encode.bytes,d.encode(e.txt||".",t,r),r+=d.encode.bytes,N.encode.bytes=r-i,t.writeUInt16BE(N.encode.bytes-2,i),t},N.encode.bytes=0,N.decode=function(e,t){t||(t=0);const r=t,n={};return t+=2,n.mbox=d.decode(e,t)||".",t+=d.decode.bytes,n.txt=d.decode(e,t)||".",t+=d.decode.bytes,N.decode.bytes=t-r,n},N.decode.bytes=0,N.encodingLength=function(e){return 2+d.encodingLength(e.mbox||".")+d.encodingLength(e.txt||".")};const D={encode:function(e,t,r){t||(t=n.alloc(D.encodingLength(e))),r||(r=0);const o=r;for(var s=[],a=0;a<e.length;a++){var c=i.toType(e[a]);void 0===s[c>>8]&&(s[c>>8]=[]),s[c>>8][c>>3&31]|=1<<7-(7&c)}for(a=0;a<s.length;a++)if(void 0!==s[a]){var u=n.from(s[a]);t.writeUInt8(a,r),r+=1,t.writeUInt8(u.length,r),r+=1,u.copy(t,r),r+=u.length}return D.encode.bytes=r-o,t}};D.encode.bytes=0,D.decode=function(e,t,r){t||(t=0);const n=t;for(var o=[];t-n<r;){var s=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 d=i.toString(s<<8|c<<3|l);o.push(d)}t+=a}return D.decode.bytes=t-n,o},D.decode.bytes=0,D.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 o=0;for(r=0;r<t.length;r++)void 0!==t[r]&&(o+=2+Math.ceil((t[r]+1)/8));return o};const B=t.nsec={};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.nextDomain,t,r),r+=d.encode.bytes,D.encode(e.rrtypes,t,r),r+=D.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;var n={},i=e.readUInt16BE(t);return t+=2,n.nextDomain=d.decode(e,t),t+=d.decode.bytes,n.rrtypes=D.decode(e,t,i-(t-r)),t+=D.decode.bytes,B.decode.bytes=t-r,n},B.decode.bytes=0,B.encodingLength=function(e){return 2+d.encodingLength(e.nextDomain)+D.encodingLength(e.rrtypes)};const x=t.nsec3={};x.encode=function(e,t,r){t||(t=n.alloc(x.encodingLength(e))),r||(r=0);const i=r,o=e.salt;if(!n.isBuffer(o))throw new Error("salt must be a Buffer");const s=e.nextDomain;if(!n.isBuffer(s))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(o.length,r),r+=1,o.copy(t,r,0,o.length),r+=o.length,t.writeUInt8(s.length,r),r+=1,s.copy(t,r,0,s.length),r+=s.length,D.encode(e.rrtypes,t,r),r+=D.encode.bytes,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);t+=2,n.algorithm=e.readUInt8(t),t+=1,n.flags=e.readUInt8(t),t+=1,n.iterations=e.readUInt16BE(t),t+=2;const o=e.readUInt8(t);t+=1,n.salt=e.slice(t,t+o),t+=o;const s=e.readUInt8(t);return t+=1,n.nextDomain=e.slice(t,t+s),t+=s,n.rrtypes=D.decode(e,t,i-(t-r)),t+=D.decode.bytes,x.decode.bytes=t-r,n},x.decode.bytes=0,x.encodingLength=function(e){return 8+e.salt.length+e.nextDomain.length+D.encodingLength(e.rrtypes)};const L=t.ds={};L.encode=function(e,t,r){t||(t=n.alloc(L.encodingLength(e))),r||(r=0);const i=r,o=e.digest;if(!n.isBuffer(o))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,o.copy(t,r,0,o.length),r+=o.length,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);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,L.decode.bytes=t-r,n},L.decode.bytes=0,L.encodingLength=function(e){return 6+n.byteLength(e.digest)};const M=t.record=function(e){switch(e.toUpperCase()){case"A":return R;case"PTR":return w;case"CNAME":return E;case"DNAME":return _;case"TXT":return m;case"NULL":return b;case"AAAA":return T;case"SRV":return S;case"HINFO":return v;case"CAA":return I;case"NS":return y;case"SOA":return g;case"MX":return A;case"OPT":return P;case"DNSKEY":return k;case"RRSIG":return O;case"RP":return N;case"NSEC":return B;case"NSEC3":return x;case"DS":return L}return p},U=t.answer={};U.encode=function(e,t,r){t||(t=n.alloc(U.encodingLength(e))),r||(r=0);const o=r;if(d.encode(e.name,t,r),r+=d.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-o,t},U.encode.bytes=0,U.decode=function(e,t){t||(t=0);const r={},n=t;if(r.name=d.decode(e,t),t+=d.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 d.encodingLength(e.name)+8+M(e.type).encodingLength(t)};const j=t.question={};function K(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}j.encode=function(e,t,r){t||(t=n.alloc(j.encodingLength(e))),r||(r=0);const o=r;return d.encode(e.name,t,r),r+=d.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,j.encode.bytes=r-o,e},j.encode.bytes=0,j.decode=function(e,t){t||(t=0);const r=t,n={};n.name=d.decode(e,t),t+=d.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),j.decode.bytes=t-r,n},j.decode.bytes=0,j.encodingLength=function(e){return d.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 o=!r;o&&(r=n.alloc(t.encodingLength(e))),i||(i=0);const s=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,j,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-s,o&&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,j,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)+K(e.questions||[],j)+K(e.answers||[],U)+K(e.authorities||[],U)+K(e.additionals||[],U)},t.streamEncode=function(e){const r=t.encode(e),i=n.alloc(2);i.writeUInt16BE(r.byteLength);const o=n.concat([i,r]);return t.streamEncode.bytes=o.byteLength,o},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},21418:(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}},14201:(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}},38641:(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}},61551:(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}},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 o(e,t,r){Error.captureStackTrace(this,o),this.message="status="+t+" while requesting "+e+" ["+r+"]",this.uri=e,this.status=t,this.method=r}function s(e,t){Error.captureStackTrace(this,s),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(o,Error),o.prototype.code="HTTP_STATUS",o.prototype.name="StatusError",n(s,Error),s.prototype.code="RESPONSE_ERR",s.prototype.name="ResponseError",n(a,Error),a.prototype.code="ETIMEOUT",a.prototype.name="TimeoutError";const u=r(35438),l={};for(const d in u)l[d]=new c(u[d]);e.exports={endpoints:l,AbortError:i,HTTPStatusError:o,ResponseError:s,TimeoutError:a,Endpoint:c}},54535:(e,t,r)=>{"use strict";const n=r(78957),i=r(11313),o=r(82010),s=o.AbortError,a=o.ResponseError,c=o.Endpoint,u=o.endpoints,l=/^((\d{1,3}\.){3,3}\d{1,3})(:(\d{2,5}))?$/,d=/^((::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?)(:(\d{2,5}))?$/i;function h(e,t,r,o){return o&&o.aborted?Promise.reject(new s):"udp4:"===e.protocol||"udp6:"===e.protocol?i.queryDns(e,t,r,o):function(e,t,r,o){const s=e.protocol||"https:";return new Promise((function(c,u){i.request(s,e.host,e.port?parseInt(e.port,10):"https:"===s?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,o,(function(t,r,i){let o;if(null===t)if(0===r.length)t=new a("Empty.");else try{o=n.decode(r)}catch(s){t=new a("Invalid packet (cause="+s.message+")",s)}null!==t?u(Object.assign(t,{response:i,endpoint:e})):(o.endpoint=e,o.response=i,c(o))}))}))}(e,t,r,o)}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 h(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:",o=1;const s=d.exec(t[3]);if(s){const e=l.exec(t[3]);e?(r=e[1],e[4]&&(n=parseInt(e[4]))):(o=2,r=s[1],s[9]&&(n=parseInt(s[10])))}else{const e=/^([^:]*)(:(.*))?$/.exec(t[3]);r=e[1],e[3]&&(n=parseInt(e[3]))}return"udp:"===i&&(i=2===o?"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:s,ResponseError:a,TimeoutError:o.TimeoutError,HTTPStatusError:o.HTTPStatusError,Endpoint:c}},11313:(e,t,r)=>{"use strict";const n=r(19778).Buffer,i=r(82010),o=i.AbortError,s=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,d,h,f,p){const y=e+"//"+t+":"+r+i+("GET"===u?"?dns="+d.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=h,g.ontimeout=function(){m(new a(h));try{g.abort()}catch(e){}},g.onreadystatechange=function(){if(g.readyState>1&&200!==g.status&&0!==g.status){m(new s(y,g.status,u));try{g.abort()}catch(e){}}},g.onerror=function(){m(200===g.status?new Error("Inexplicable XHR Error"):new s(y,g.status,u))},g.onload=function(){200!==g.status?m(new s(y,g.status,u)):m(null,n.from(g.response))},"GET"===u?g.send():g.send(d),f&&f.addEventListener("abort",b);let m=function(e,t){m=l,f&&f.removeEventListener("abort",b),p(e,t,g)};function b(){m(new o);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')}}},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)}}},50887:e=>{"use strict";function t(e,t){if(void 0===e||null===e)throw new TypeError("Cannot convert first argument to object");for(var r=Object(e),n=1;n<arguments.length;n++){var i=arguments[n];if(void 0!==i&&null!==i)for(var o=Object.keys(Object(i)),s=0,a=o.length;s<a;s++){var c=o[s],u=Object.getOwnPropertyDescriptor(i,c);void 0!==u&&u.enumerable&&(r[c]=i[c])}}return r}e.exports={assign:t,polyfill:function(){Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:t})}}},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,o=Array(i),s=0;s<i;s++)o[s]=arguments[s];return new n((function(n,i){o.push((function(e){if(e)return i(e);for(var r=arguments.length,o=Array(1<r?r-1:0),s=1;s<r;s++)o[s-1]=arguments[s];if(1===o.length||!t)return n(o[0]);var a={};o.forEach((function(e,r){var n=t[r];n&&(a[n]=e)})),n(a)})),e.apply(r,o)}))}}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 o(e,t,n,o,s){if("function"!==typeof n)throw new TypeError("The listener must be a function");var a=new i(n,o||e,s),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 s(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,o=n.length,s=new Array(o);i<o;i++)s[i]=n[i].fn;return s},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,o,s){var a=r?r+e:e;if(!this._events[a])return!1;var c,u,l=this._events[a],d=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),d){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,o),!0;case 6:return l.fn.call(l.context,t,n,i,o,s),!0}for(u=1,c=new Array(d-1);u<d;u++)c[u-1]=arguments[u];l.fn.apply(l.context,c)}else{var h,f=l.length;for(u=0;u<f;u++)switch(l[u].once&&this.removeListener(e,l[u].fn,void 0,!0),d){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(h=1,c=new Array(d-1);h<d;h++)c[h-1]=arguments[h];l[u].fn.apply(l[u].context,c)}}return!0},a.prototype.on=function(e,t,r){return o(this,e,t,r,!1)},a.prototype.once=function(e,t,r){return o(this,e,t,r,!0)},a.prototype.removeListener=function(e,t,n,i){var o=r?r+e:e;if(!this._events[o])return this;if(!t)return s(this,o),this;var a=this._events[o];if(a.fn)a.fn!==t||i&&!a.once||n&&a.context!==n||s(this,o);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[o]=1===u.length?u[0]:u:s(this,o)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&s(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 o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r)}function o(){"function"===typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}y(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"===typeof e.on&&y(e,"error",t,r)}(e,i,{once:!0})}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function a(e){if("function"!==typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function u(e,t,r,n){var i,o,s,u;if(a(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),s=o[t]),void 0===s)s=o[t]=r,++e._eventsCount;else if("function"===typeof s?s=o[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=c(e))>0&&s.length>i&&!s.warned){s.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=s.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 d(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 h(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"===typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;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(o){n.once&&e.removeEventListener(t,i),r(o)}))}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return s},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+".");s=e}}),o.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},o.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},o.prototype.getMaxListeners=function(){return c(this)},o.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,o=this._events;if(void 0!==o)i=i&&void 0===o.error;else if(!i)return!1;if(i){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=o[e];if(void 0===c)return!1;if("function"===typeof c)n(c,this,t);else{var u=c.length,l=p(c,u);for(r=0;r<u;++r)n(l[r],this,t)}return!0},o.prototype.addListener=function(e,t){return u(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return u(this,e,t,!0)},o.prototype.once=function(e,t){return a(t),this.on(e,d(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,d(this,e,t)),this},o.prototype.removeListener=function(e,t){var r,n,i,o,s;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,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){s=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<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,s||t)}return this},o.prototype.off=o.prototype.removeListener,o.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,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[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},o.prototype.listeners=function(e){return h(this,e,!0)},o.prototype.rawListeners=function(e){return h(this,e,!1)},o.listenerCount=function(e,t){return"function"===typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},o.prototype.listenerCount=f,o.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()}}},27910:e=>{var t=Object.prototype.hasOwnProperty,r=Object.prototype.toString;e.exports=function(e,n,i){if("[object Function]"!==r.call(n))throw new TypeError("iterator must be a function");var o=e.length;if(o===+o)for(var s=0;s<o;s++)n.call(i,e[s],s,e);else for(var a in e)t.call(e,a)&&n.call(i,e[a],a,e)}},30222:e=>{"use strict";var t="Function.prototype.bind called on incompatible ",r=Array.prototype.slice,n=Object.prototype.toString,i="[object Function]";e.exports=function(e){var o=this;if("function"!==typeof o||n.call(o)!==i)throw new TypeError(t+o);for(var s,a=r.call(arguments,1),c=function(){if(this instanceof s){var t=o.apply(this,a.concat(r.call(arguments)));return Object(t)===t?t:this}return o.apply(e,a.concat(r.call(arguments)))},u=Math.max(0,o.length-a.length),l=[],d=0;d<u;d++)l.push("$"+d);if(s=Function("binder","return function ("+l.join(",")+"){ return binder.apply(this,arguments); }")(c),o.prototype){var h=function(){};h.prototype=o.prototype,s.prototype=new h,h.prototype=null}return s}},33350:(e,t,r)=>{"use strict";var n=r(30222);e.exports=Function.prototype.bind||n},52506:(e,t,r)=>{"use strict";var n,i=SyntaxError,o=Function,s=TypeError,a=function(e){try{return o('"use strict"; return ('+e+").constructor;")()}catch(t){}},c=Object.getOwnPropertyDescriptor;if(c)try{c({},"")}catch(C){c=null}var u=function(){throw new s},l=c?function(){try{return u}catch(e){try{return c(arguments,"callee").get}catch(t){return u}}}():u,d=r(80697)(),h=Object.getPrototypeOf||function(e){return e.__proto__},f={},p="undefined"===typeof Uint8Array?n:h(Uint8Array),y={"%AggregateError%":"undefined"===typeof AggregateError?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"===typeof ArrayBuffer?n:ArrayBuffer,"%ArrayIteratorPrototype%":d?h([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":f,"%AsyncGenerator%":f,"%AsyncGeneratorFunction%":f,"%AsyncIteratorPrototype%":f,"%Atomics%":"undefined"===typeof Atomics?n:Atomics,"%BigInt%":"undefined"===typeof BigInt?n:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"===typeof DataView?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"===typeof Float32Array?n:Float32Array,"%Float64Array%":"undefined"===typeof Float64Array?n:Float64Array,"%FinalizationRegistry%":"undefined"===typeof FinalizationRegistry?n:FinalizationRegistry,"%Function%":o,"%GeneratorFunction%":f,"%Int8Array%":"undefined"===typeof Int8Array?n:Int8Array,"%Int16Array%":"undefined"===typeof Int16Array?n:Int16Array,"%Int32Array%":"undefined"===typeof Int32Array?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":d?h(h([][Symbol.iterator]())):n,"%JSON%":"object"===typeof JSON?JSON:n,"%Map%":"undefined"===typeof Map?n:Map,"%MapIteratorPrototype%":"undefined"!==typeof Map&&d?h((new Map)[Symbol.iterator]()):n,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"===typeof Promise?n:Promise,"%Proxy%":"undefined"===typeof Proxy?n:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"===typeof Reflect?n:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"===typeof Set?n:Set,"%SetIteratorPrototype%":"undefined"!==typeof Set&&d?h((new Set)[Symbol.iterator]()):n,"%SharedArrayBuffer%":"undefined"===typeof SharedArrayBuffer?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":d?h(""[Symbol.iterator]()):n,"%Symbol%":d?Symbol:n,"%SyntaxError%":i,"%ThrowTypeError%":l,"%TypedArray%":p,"%TypeError%":s,"%Uint8Array%":"undefined"===typeof Uint8Array?n:Uint8Array,"%Uint8ClampedArray%":"undefined"===typeof Uint8ClampedArray?n:Uint8ClampedArray,"%Uint16Array%":"undefined"===typeof Uint16Array?n:Uint16Array,"%Uint32Array%":"undefined"===typeof Uint32Array?n:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"===typeof WeakMap?n:WeakMap,"%WeakRef%":"undefined"===typeof WeakRef?n:WeakRef,"%WeakSet%":"undefined"===typeof WeakSet?n:WeakSet},g=function e(t){var r;if("%AsyncFunction%"===t)r=a("async function () {}");else if("%GeneratorFunction%"===t)r=a("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=a("async function* () {}");else if("%AsyncGenerator%"===t){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if("%AsyncIteratorPrototype%"===t){var i=e("%AsyncGenerator%");i&&(r=h(i.prototype))}return y[t]=r,r},m={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},b=r(33350),v=r(58316),w=b.call(Function.call,Array.prototype.concat),E=b.call(Function.apply,Array.prototype.splice),_=b.call(Function.call,String.prototype.replace),S=b.call(Function.call,String.prototype.slice),I=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,A=/\\(\\)?/g,R=function(e){var t=S(e,0,1),r=S(e,-1);if("%"===t&&"%"!==r)throw new i("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new i("invalid intrinsic syntax, expected opening `%`");var n=[];return _(e,I,(function(e,t,r,i){n[n.length]=r?_(i,A,"$1"):t||e})),n},T=function(e,t){var r,n=e;if(v(m,n)&&(n="%"+(r=m[n])[0]+"%"),v(y,n)){var o=y[n];if(o===f&&(o=g(n)),"undefined"===typeof o&&!t)throw new s("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:r,name:n,value:o}}throw new i("intrinsic "+e+" does not exist!")};e.exports=function(e,t){if("string"!==typeof e||0===e.length)throw new s("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!==typeof t)throw new s('"allowMissing" argument must be a boolean');var r=R(e),n=r.length>0?r[0]:"",o=T("%"+n+"%",t),a=o.name,u=o.value,l=!1,d=o.alias;d&&(n=d[0],E(r,w([0,1],d)));for(var h=1,f=!0;h<r.length;h+=1){var p=r[h],g=S(p,0,1),m=S(p,-1);if(('"'===g||"'"===g||"`"===g||'"'===m||"'"===m||"`"===m)&&g!==m)throw new i("property names with quotes must have matching quotes");if("constructor"!==p&&f||(l=!0),v(y,a="%"+(n+="."+p)+"%"))u=y[a];else if(null!=u){if(!(p in u)){if(!t)throw new s("base intrinsic for "+e+" exists, but the property is not available.");return}if(c&&h+1>=r.length){var b=c(u,p);u=(f=!!b)&&"get"in b&&!("originalValue"in b.get)?b.get:u[p]}else f=v(u,p),u=u[p];f&&!l&&(y[a]=u)}}return u}},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")}},84510:(e,t,r)=>{"use strict";var n=r(52506)("%Object.defineProperty%",!0),i=function(){if(n)try{return n({},"a",{value:1}),!0}catch(e){return!1}return!1};i.hasArrayLengthDefineBug=function(){if(!i())return null;try{return 1!==n([],"length",{value:1}).length}catch(e){return!0}},e.exports=i},80697:(e,t,r)=>{"use strict";var n="undefined"!==typeof Symbol&&Symbol,i=r(63297);e.exports=function(){return"function"===typeof n&&("function"===typeof Symbol&&("symbol"===typeof n("foo")&&("symbol"===typeof Symbol("bar")&&i())))}},63297:e=>{"use strict";e.exports=function(){if("function"!==typeof Symbol||"function"!==typeof Object.getOwnPropertySymbols)return!1;if("symbol"===typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),r=Object(t);if("string"===typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(r))return!1;for(t in e[t]=42,e)return!1;if("function"===typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"===typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var n=Object.getOwnPropertySymbols(e);if(1!==n.length||n[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"===typeof Object.getOwnPropertyDescriptor){var i=Object.getOwnPropertyDescriptor(e,t);if(42!==i.value||!0!==i.enumerable)return!1}return!0}},4707:(e,t,r)=>{"use strict";var n=r(63297);e.exports=function(){return n()&&!!Symbol.toStringTag}},58316:(e,t,r)=>{"use strict";var n=r(33350);e.exports=n.call(Function.call,Object.prototype.hasOwnProperty)},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,o){r[i]=o,++t>=e&&(t=0,n=r,r=Object.create(null))}return{has:function(e){return void 0!==r[e]||void 0!==n[e]},remove:function(e){void 0!==r[e]&&(r[e]=void 0),void 0!==n[e]&&(n[e]=void 0)},get:function(e){var t=r[e];return void 0!==t?t:void 0!==(t=n[e])?(i(e,t),t):void 0},set:function(e,t){void 0!==r[e]?r[e]=t:i(e,t)},clear:function(){r=Object.create(null),n=Object.create(null)}}}},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 o=!t.HI_BASE32_NO_COMMON_JS&&e.exports,s=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},d=function(e){if(""===e)return[];if(!/^[A-Z2-7=]+$/.test(e))throw new Error("Invalid base32 characters");for(var t,r,n,i,o,s,a,u,l=[],d=0,h=(e=e.replace(/=/g,"")).length,f=0,p=h>>3<<3;f<p;)t=c[e.charAt(f++)],r=c[e.charAt(f++)],n=c[e.charAt(f++)],i=c[e.charAt(f++)],o=c[e.charAt(f++)],s=c[e.charAt(f++)],a=c[e.charAt(f++)],u=c[e.charAt(f++)],l[d++]=255&(t<<3|r>>>2),l[d++]=255&(r<<6|n<<1|i>>>4),l[d++]=255&(i<<4|o>>>1),l[d++]=255&(o<<7|s<<2|a>>>3),l[d++]=255&(a<<5|u);var y=h-p;return 2===y?(t=c[e.charAt(f++)],r=c[e.charAt(f++)],l[d++]=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[d++]=255&(t<<3|r>>>2),l[d++]=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++)],o=c[e.charAt(f++)],l[d++]=255&(t<<3|r>>>2),l[d++]=255&(r<<6|n<<1|i>>>4),l[d++]=255&(i<<4|o>>>1)):7===y&&(t=c[e.charAt(f++)],r=c[e.charAt(f++)],n=c[e.charAt(f++)],i=c[e.charAt(f++)],o=c[e.charAt(f++)],s=c[e.charAt(f++)],a=c[e.charAt(f++)],l[d++]=255&(t<<3|r>>>2),l[d++]=255&(r<<6|n<<1|i>>>4),l[d++]=255&(i<<4|o>>>1),l[d++]=255&(o<<7|s<<2|a>>>3)),l},h=function(e,t){if(!t)return function(e){for(var t,r,n="",i=e.length,o=0,s=0;o<i;)if((t=e[o++])<=127)n+=String.fromCharCode(t);else{t>191&&t<=223?(r=31&t,s=1):t<=239?(r=15&t,s=2):t<=247?(r=7&t,s=3):l(o,n);for(var a=0;a<s;++a)((t=e[o++])<128||t>191)&&l(o,n),r<<=6,r+=63&t;r>=55296&&r<=57343&&l(o,n),r>1114111&&l(o,n),r<=65535?n+=String.fromCharCode(r):(r-=65536,n+=String.fromCharCode(55296+(r>>10)),n+=String.fromCharCode(56320+(1023&r)))}return n}(d(e));if(""===e)return"";if(!/^[A-Z2-7=]+$/.test(e))throw new Error("Invalid base32 characters");var r,n,i,o,s,a,u,h,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++)],o=c[e.charAt(y++)],s=c[e.charAt(y++)],a=c[e.charAt(y++)],u=c[e.charAt(y++)],h=c[e.charAt(y++)],f+=String.fromCharCode(255&(r<<3|n>>>2))+String.fromCharCode(255&(n<<6|i<<1|o>>>4))+String.fromCharCode(255&(o<<4|s>>>1))+String.fromCharCode(255&(s<<7|a<<2|u>>>3))+String.fromCharCode(255&(u<<5|h));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++)],o=c[e.charAt(y++)],f+=String.fromCharCode(255&(r<<3|n>>>2))+String.fromCharCode(255&(n<<6|i<<1|o>>>4))):5===m?(r=c[e.charAt(y++)],n=c[e.charAt(y++)],i=c[e.charAt(y++)],o=c[e.charAt(y++)],s=c[e.charAt(y++)],f+=String.fromCharCode(255&(r<<3|n>>>2))+String.fromCharCode(255&(n<<6|i<<1|o>>>4))+String.fromCharCode(255&(o<<4|s>>>1))):7===m&&(r=c[e.charAt(y++)],n=c[e.charAt(y++)],i=c[e.charAt(y++)],o=c[e.charAt(y++)],s=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|o>>>4))+String.fromCharCode(255&(o<<4|s>>>1))+String.fromCharCode(255&(s<<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,o,s="",c=e.length,u=0,l=5*parseInt(c/5);u<l;)t=e[u++],r=e[u++],n=e[u++],i=e[u++],o=e[u++],s+=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|o>>>5)]+a[31&o];var d=c-l;return 1===d?(t=e[u],s+=a[t>>>3]+a[t<<2&31]+"======"):2===d?(t=e[u++],r=e[u],s+=a[t>>>3]+a[31&(t<<2|r>>>6)]+a[r>>>1&31]+a[r<<4&31]+"===="):3===d?(t=e[u++],r=e[u++],n=e[u],s+=a[t>>>3]+a[31&(t<<2|r>>>6)]+a[r>>>1&31]+a[31&(r<<4|n>>>4)]+a[n<<1&31]+"==="):4===d&&(t=e[u++],r=e[u++],n=e[u++],i=e[u],s+=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]+"="),s}(e):t?function(e){for(var t,r,n,i,o,s="",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++),o=e.charCodeAt(u++),s+=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|o>>>5)]+a[31&o];var d=c-l;return 1===d?(t=e.charCodeAt(u),s+=a[t>>>3]+a[t<<2&31]+"======"):2===d?(t=e.charCodeAt(u++),r=e.charCodeAt(u),s+=a[t>>>3]+a[31&(t<<2|r>>>6)]+a[r>>>1&31]+a[r<<4&31]+"===="):3===d?(t=e.charCodeAt(u++),r=e.charCodeAt(u++),n=e.charCodeAt(u),s+=a[t>>>3]+a[31&(t<<2|r>>>6)]+a[r>>>1&31]+a[31&(r<<4|n>>>4)]+a[n<<1&31]+"==="):4===d&&(t=e.charCodeAt(u++),r=e.charCodeAt(u++),n=e.charCodeAt(u++),i=e.charCodeAt(u),s+=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]+"="),s}(e):function(e){var t,r,n,i,o,s,c,l=!1,d="",h=0,f=0,p=e.length;if(""===e)return d;do{for(u[0]=u[5],u[1]=u[6],u[2]=u[7],c=f;h<p&&c<5;++h)(s=e.charCodeAt(h))<128?u[c++]=s:s<2048?(u[c++]=192|s>>6,u[c++]=128|63&s):s<55296||s>=57344?(u[c++]=224|s>>12,u[c++]=128|s>>6&63,u[c++]=128|63&s):(s=65536+((1023&s)<<10|1023&e.charCodeAt(++h)),u[c++]=240|s>>18,u[c++]=128|s>>12&63,u[c++]=128|s>>6&63,u[c++]=128|63&s);f=c-5,h===p&&++h,h>p&&c<6&&(l=!0),t=u[0],c>4?(r=u[1],n=u[2],i=u[3],o=u[4],d+=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|o>>>5)]+a[31&o]):1===c?d+=a[t>>>3]+a[t<<2&31]+"======":2===c?(r=u[1],d+=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],d+=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],d+=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 d}(e)},decode:h};h.asBytes=d,o?e.exports=f:(t.base32=f,s&&(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 o,s,a=8*i-n-1,c=(1<<a)-1,u=c>>1,l=-7,d=r?i-1:0,h=r?-1:1,f=e[t+d];for(d+=h,o=f&(1<<-l)-1,f>>=-l,l+=a;l>0;o=256*o+e[t+d],d+=h,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=n;l>0;s=256*s+e[t+d],d+=h,l-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,n),o-=u}return(f?-1:1)*s*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var s,a,c,u=8*o-i-1,l=(1<<u)-1,d=l>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,p=n?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+d>=1?h/c:h*Math.pow(2,1-d))*c>=2&&(s++,c/=2),s+d>=l?(a=0,s=l):s+d>=1?(a=(t*c-1)*Math.pow(2,i),s+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,i),s=0));i>=8;e[r+f]=255&a,f+=p,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;e[r+f]=255&s,f+=p,s/=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))}},12534:e=>{"function"===typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},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}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.v6=t.AddressError=t.Address6=t.Address4=void 0;var s=r(84595);Object.defineProperty(t,"Address4",{enumerable:!0,get:function(){return s.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=o(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}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Address4=void 0;var s=o(r(44201)),a=o(r(81765)),c=r(5383),u=r(87018),l=r(49372),d=function(){function e(e){this.groups=a.GROUPS,this.parsedAddress=[],this.parsedSubnet="",this.subnet="/32",this.subnetMask=32,this.v4=!0,this.isCorrect=s.isCorrect(a.BITS),this.isInSubnet=s.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 o=n.slice(r,r+2);i.push(parseInt(o,16))}return new e(i.join("."))},e.fromInteger=function(t){return e.fromHex(t.toString(16))},e.fromArpa=function(t){return new e(t.replace(/(\.in-addr\.arpa)?\.$/,"").split(".").reverse().join("."))},e.prototype.toHex=function(){return this.parsedAddress.map((function(e){return 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=d},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}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t},s=this&&this.__spreadArray||function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.Address6=void 0;var a=o(r(44201)),c=o(r(81765)),u=o(r(69511)),l=o(r(15011)),d=r(84595),h=r(92703),f=r(5383),p=r(87018),y=r(49372);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 b(e){return y.sprintf("%04x",parseInt(e,16))}function v(e){return 255&e}var w=function(){function e(e,t){this.addressMinusSuffix="",this.parsedSubnet="",this.subnet="/128",this.subnetMask=128,this.v4=!1,this.zone="",this.isInSubnet=a.isInSubnet,this.isCorrect=a.isCorrect(u.BITS),this.groups=void 0===t?u.GROUPS:t,this.address=e;var r=u.RE_SUBNET_STRING.exec(e);if(r){if(this.parsedSubnet=r[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet="/"+this.subnetMask,Number.isNaN(this.subnetMask)||this.subnetMask<0||this.subnetMask>u.BITS)throw new 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 d.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 o=4*i;n.splice(o,0,":")}return new e(r=n.join(""))},e.prototype.microsoftTranscription=function(){return y.sprintf("%s.ipv6-literal.net",this.correctForm().replace(/:/g,"-"))},e.prototype.mask=function(e){return void 0===e&&(e=this.subnetMask),this.getBitsBase2(0,e)},e.prototype.possibleSubnets=function(e){void 0===e&&(e=128);var t=u.BITS-this.subnetMask-Math.abs(e-u.BITS);return t<0?"0":function(e){for(var t=/(\d+)(\d{3})/;t.test(e);)e=e.replace(t,"$1,$2");return e}(new p.BigInteger("2",10).pow(t).toString(10))},e.prototype._startAddress=function(){return new p.BigInteger(this.mask()+"0".repeat(u.BITS-this.subnetMask),2)},e.prototype.startAddress=function(){return e.fromBigInteger(this._startAddress())},e.prototype.startAddressExclusive=function(){var t=new p.BigInteger("1");return e.fromBigInteger(this._startAddress().add(t))},e.prototype._endAddress=function(){return new p.BigInteger(this.mask()+"1".repeat(u.BITS-this.subnetMask),2)},e.prototype.endAddress=function(){return e.fromBigInteger(this._endAddress())},e.prototype.endAddressExclusive=function(){var t=new p.BigInteger("1");return e.fromBigInteger(this._endAddress().subtract(t))},e.prototype.getScope=function(){var e=u.SCOPES[this.getBits(12,16).intValue()];return"Global unicast"===this.getType()&&"Link local"!==e&&(e="Global"),e||"Unknown"},e.prototype.getType=function(){for(var t=0,r=Object.keys(u.TYPES);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 o=n.map((function(e){return e[1]-e[0]+1}));if(n.length>0){var s=o.indexOf(Math.max.apply(Math,o));t=function(e,t){var r,n=[],i=[];for(r=0;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[s])}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 d.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 o=i[0].split(":"),s=i[1].split(":");1===o.length&&""===o[0]&&(o=[]),1===s.length&&""===s[0]&&(s=[]);var a=this.groups-(o.length+s.length);if(!a)throw new f.AddressError("Error parsing groups");this.elidedGroups=a,this.elisionBegin=o.length,this.elisionEnd=o.length+this.elidedGroups,n=n.concat(o);for(var c=0;c<a;c++)n.push("0");n=n.concat(s)}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(b).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(b).join(""),16)},e.prototype.to4=function(){var e=this.binaryZeroPad().split("");return d.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=d.Address4.fromHex(this.getBitsBase16(32,64)),n=d.Address4.fromHex(this.getBits(96,128).xor(new p.BigInteger("ffffffff",16)).toString(16)),i=this.getBits(64,80),o=this.getBitsBase2(64,80),s=i.testBit(15),a=i.testBit(14),c=i.testBit(8),u=i.testBit(9),l=new p.BigInteger(o.slice(2,6)+o.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:o,coneNat:s,microsoft:{reserved:a,universalLocal:u,groupIndividual:c,nonce:l},udpPort:t}},e.prototype.inspect6to4=function(){var e=this.getBitsBase16(0,16),t=d.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(v)},e.fromByteArray=function(e){return this.fromUnsignedByteArray(e.map(v))},e.fromUnsignedByteArray=function(t){for(var r=new p.BigInteger("256",10),n=new p.BigInteger("0",10),i=new p.BigInteger("1",10),o=t.length-1;o>=0;o--)n=n.add(i.multiply(new p.BigInteger(t[o].toString(10),10))),i=i.multiply(r);return e.fromBigInteger(n)},e.prototype.isCanonical=function(){return this.addressMinusSuffix===this.canonicalForm()},e.prototype.isLinkLocal=function(){return"1111111010000000000000000000000000000000000000000000000000000000"===this.getBitsBase2(0,64)},e.prototype.isMulticast=function(){return"Multicast"===this.getType()},e.prototype.is4=function(){return this.v4},e.prototype.isTeredo=function(){return this.isInSubnet(new e("2001::/32"))},e.prototype.is6to4=function(){return this.isInSubnet(new e("2002::/16"))},e.prototype.isLoopback=function(){return"Loopback"===this.getType()},e.prototype.href=function(e){return e=void 0===e?"":y.sprintf(":%s",e),y.sprintf("http://[%s]%s/",this.correctForm(),e)},e.prototype.link=function(e){e||(e={}),void 0===e.className&&(e.className=""),void 0===e.prefix&&(e.prefix="/#address="),void 0===e.v4&&(e.v4=!1);var t=this.correctForm;return e.v4&&(t=this.to4in6),e.className?y.sprintf('<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"],o=this.elisionBegin;o<this.elisionBegin+this.elidedGroups;o++)i.push(y.sprintf("group-%d",o));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 d.Address4),e.pop(),e.push(this.address4.groupForV6())),e.join(":")},e.prototype.regularExpressionString=function(t){void 0===t&&(t=!1);var r=[],n=new e(this.correctForm());if(0===n.elidedGroups)r.push(h.simpleRegularExpression(n.parsedAddress));else if(n.elidedGroups===u.GROUPS)r.push(h.possibleElisions(u.GROUPS));else{var i=n.address.split("::");i[0].length&&r.push(h.simpleRegularExpression(i[0].split(":"))),g("number"===typeof n.elidedGroups),r.push(h.possibleElisions(n.elidedGroups,0!==i[0].length,0!==i[1].length)),i[1].length&&r.push(h.simpleRegularExpression(i[1].split(":"))),r=[r.join(":")]}return t||(r=s(s(["(?=^|",h.ADDRESS_BOUNDARY,"|[^\\w\\:])("],r),[")(?=[^\\w\\:]|",h.ADDRESS_BOUNDARY,"|$)"])),r.join("")},e.prototype.regularExpression=function(e){return void 0===e&&(e=!1),new RegExp(this.regularExpressionString(e),"i")},e}();t.Address6=w},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(49372);function i(e){return e.replace(/(0+)/g,'<span class="zero">$1</span>')}function o(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 o(e)})).join(":")},t.simpleGroup=function(e,t){return void 0===t&&(t=0),e.split(":").map((function(e,r){return/group-v4/.test(e)?e:n.sprintf('<span class="hover-group group-%d">%s</span>',r+t,o(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}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.possibleElisions=t.simpleRegularExpression=t.ADDRESS_BOUNDARY=t.padGroup=t.groupPossibilities=void 0;var s=o(r(69511)),a=r(49372);function c(e){return a.sprintf("(%s)",e.join("|"))}function u(e){return e.length<4?a.sprintf("0{0,%d}%s",4-e.length,e):e}t.groupPossibilities=c,t.padGroup=u,t.ADDRESS_BOUNDARY="[^A-Fa-f0-9:]",t.simpleRegularExpression=function(e){var t=[];e.forEach((function(e,r){0===parseInt(e,16)&&t.push(r)}));var r=t.map((function(t){return e.map((function(e,r){if(r===t){var n=0===r||r===s.GROUPS-1?":":"";return c([u(e),n])}return u(e)})).join(":")}));return r.push(e.map(u).join(":")),c(r)},t.possibleElisions=function(e,t,r){var n=t?"":":",i=r?"":":",o=[];t||r||o.push("::"),t&&r&&o.push(""),(r&&!t||!r&&t)&&o.push(":"),o.push(a.sprintf("%s(:0{1,4}){1,%d}",n,e-1)),o.push(a.sprintf("(0{1,4}:){1,%d}%s",e-1,i)),o.push(a.sprintf("(0{1,4}:){%d}0{1,4}",e-1));for(var s=1;s<e-1;s++)for(var u=1;u<e-s;u++)o.push(a.sprintf("(0{1,4}:){%d}:(0{1,4}:){%d}0{1,4}",u,e-u-s-1));return c(o)}},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}",o="\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(),s=new RegExp("(?:^".concat(n,"$)|(?:^").concat(o,"$)")),a=new RegExp("^".concat(n,"$")),c=new RegExp("^".concat(o,"$")),u=e=>e&&e.exact?s:new RegExp("(?:".concat(r(e)).concat(n).concat(r(e),")|(?:").concat(r(e)).concat(o).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(o).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"),o=new RegExp("^0x[a-f0-9]+$","i"),s="%[0-9a-z]{1,}",a="(?:[0-9a-f]+::?)+",c={zoneIndex:new RegExp(s,"i"),native:new RegExp("^(::)?(".concat(a,")?([0-9a-f]+)?(::)?(").concat(s,")?$"),"i"),deprecatedTransitional:new RegExp("^(?:::)(".concat(r,"\\.").concat(r,"\\.").concat(r,"\\.").concat(r,"(").concat(s,")?)$"),"i"),transitional:new RegExp("^((?:".concat(a,")|(?:::)(?:").concat(a,")?)").concat(r,"\\.").concat(r,"\\.").concat(r,"\\.").concat(r,"(").concat(s,")?$"),"i")};function u(e,t){if(e.indexOf("::")!==e.lastIndexOf("::"))return null;let r,n,i=0,o=-1,s=(e.match(c.zoneIndex)||[])[0];for(s&&(s=s.substring(1),e=e.replace(/%.+$/,""));(o=e.indexOf(":",o+1))>=0;)i++;if("::"===e.substr(0,2)&&i--,"::"===e.substr(-2,2)&&i--,i>t)return null;for(n=t-i,r=":";n--;)r+="0:";return":"===(e=e.replace("::",r))[0]&&(e=e.slice(1)),":"===e[e.length-1]&&(e=e.slice(0,-1)),{parts:t=function(){const t=e.split(":"),r=[];for(let e=0;e<t.length;e++)r.push(parseInt(t[e],16));return r}(),zoneId:s}}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,o=0;for(;n>0;){if(i=r-n,i<0&&(i=0),e[o]>>i!==t[o]>>i)return!1;n-=r,o+=1}return!0}function d(e){if(o.test(e))return parseInt(e,16);if("0"===e[0]&&!isNaN(parseInt(e[1],10))){if(i.test(e))return parseInt(e,8);throw new Error("ipaddr: cannot parse ".concat(e," as octal"))}return parseInt(e,10)}function h(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,o;for(n=3;n>=0;n-=1){if(i=this.octets[n],!(i in r))return null;if(o=r[i],t&&0!==o)return null;8!==o&&(t=!0),e+=o}return 32-e},e.prototype.range=function(){return 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 o=0;for(;o<4;)i.push(parseInt(r[o],10)|255^parseInt(n[o],10)),o++;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,o;try{for(t=this.parseCIDR(e),n=t[0].toByteArray(),o=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],r=0;r<4;)i.push(parseInt(n[r],10)&parseInt(o[r],10)),r++;return new this(i)}catch(s){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(d(r));return n}();if(t=e.match(n.longValue)){if(i=d(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=d(e[1]),i>16777215||i<0)throw new Error("ipaddr: address outside defined range");return r.push(d(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=d(e[2]),i>65535||i<0)throw new Error("ipaddr: address outside defined range");return r.push(d(e[0])),r.push(d(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 o=7;o>=0;o-=1){if(n=this.parts[o],!(n in r))return null;if(i=r[n],t&&0!==i)return null;16!==i&&(t=!0),e+=i}return 128-e},e.prototype.range=function(){return 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(h(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 o=0;for(;o<16;)i.push(parseInt(r[o],10)|255^parseInt(n[o],10)),o++;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,o;try{for(t=this.parseCIDR(e),n=t[0].toByteArray(),o=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],r=0;r<16;)i.push(parseInt(n[r],10)&parseInt(o[r],10)),r++;return new this(i)}catch(s){throw new Error("ipaddr: the address does not have IPv6 CIDR format (".concat(s,")"))}},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,o,s;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))&&(s=n[6]||"",t=u(n[1].slice(0,-1)+s,6),t.parts)){for(o=[parseInt(n[2]),parseInt(n[3]),parseInt(n[4]),parseInt(n[5])],r=0;r<o.length;r++)if(i=o[r],!(0<=i&&i<=255))return null;return t.parts.push(o[0]<<8|o[1]),t.parts.push(o[2]<<8|o[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,o,s;for(i in void 0!==r&&null!==r||(r="unicast"),t)if(Object.prototype.hasOwnProperty.call(t,i))for(o=t[i],!o[0]||o[0]instanceof Array||(o=[o]),n=0;n<o.length;n++)if(s=o[n],e.kind()===s[0].kind()&&e.match.apply(e,s))return i;return r},e.exports?e.exports=f:t.ipaddr=f}(this)},96927:(e,t,r)=>{"use strict";const n=r(82193),i="object"===typeof window&&"object"===typeof document&&9===document.nodeType,o=n(),s=i&&!o,a=o&&!i,c=o&&i,u="undefined"!==typeof globalThis.process&&"undefined"!==typeof globalThis.process.release&&"node"===globalThis.process.release.name&&!o,l="function"===typeof importScripts&&"undefined"!==typeof self&&"undefined"!==typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,d="undefined"!==typeof globalThis.process&&"undefined"!==typeof globalThis.process.env&&"test"===globalThis.process.env.NODE_ENV,h="undefined"!==typeof navigator&&"ReactNative"===navigator.product;e.exports={isTest:d,isElectron:o,isElectronMain:a,isElectronRenderer:c,isNode:u,isBrowser:s,isWebWorker:l,isEnvWithDom:i,isReactNative:h}},65450:(e,t,r)=>{"use strict";var n=r(4707)(),i=r(44037)("Object.prototype.toString"),o=function(e){return!(n&&e&&"object"===typeof e&&Symbol.toStringTag in e)&&"[object Arguments]"===i(e)},s=function(e){return!!o(e)||null!==e&&"object"===typeof e&&"number"===typeof e.length&&e.length>=0&&"[object Array]"!==i(e)&&"[object Function]"===i(e.callee)},a=function(){return o(arguments)}();o.isLegacyArguments=s,e.exports=a?o:s},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)}},85718:(e,t,r)=>{"use strict";var n,i=Object.prototype.toString,o=Function.prototype.toString,s=/^\s*(?:function)?\*/,a=r(4707)(),c=Object.getPrototypeOf;e.exports=function(e){if("function"!==typeof e)return!1;if(s.test(o.call(e)))return!0;if(!a)return"[object GeneratorFunction]"===i.call(e);if(!c)return!1;if("undefined"===typeof n){var t=function(){if(!a)return!1;try{return Function("return function*() {}")()}catch(e){}}();n=!!t&&c(t)}return c(e)===n}},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)}},6510:e=>{"use strict";e.exports=function(e){return e!==e}},6188:(e,t,r)=>{"use strict";var n=r(19722),i=r(9396),o=r(6510),s=r(64951),a=r(6034),c=n(s(),Number);i(c,{getPolyfill:s,implementation:o,shim:a}),e.exports=c},64951:(e,t,r)=>{"use strict";var n=r(6510);e.exports=function(){return Number.isNaN&&Number.isNaN(NaN)&&!Number.isNaN("a")?Number.isNaN:n}},6034:(e,t,r)=>{"use strict";var n=r(9396),i=r(64951);e.exports=function(){var e=i();return n(Number,{isNaN:e},{isNaN:function(){return Number.isNaN!==e}}),e}},41288: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}},66218:(e,t,r)=>{"use strict";var n=r(27910),i=r(30306),o=r(44037),s=o("Object.prototype.toString"),a=r(4707)(),c="undefined"===typeof globalThis?r.g:globalThis,u=i(),l=o("Array.prototype.indexOf",!0)||function(e,t){for(var r=0;r<e.length;r+=1)if(e[r]===t)return r;return-1},d=o("String.prototype.slice"),h={},f=r(40636),p=Object.getPrototypeOf;a&&f&&p&&n(u,(function(e){var t=new c[e];if(Symbol.toStringTag in t){var r=p(t),n=f(r,Symbol.toStringTag);if(!n){var i=p(r);n=f(i,Symbol.toStringTag)}h[e]=n.get}}));e.exports=function(e){if(!e||"object"!==typeof e)return!1;if(!a||!(Symbol.toStringTag in e)){var t=d(s(e),8,-1);return l(u,t)>-1}return!!f&&function(e){var t=!1;return n(h,(function(r,n){if(!t)try{t=r.call(e)===n}catch(i){}})),t}(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:o,defaultBase:s}=r(85732),a=r(89640);e.exports={URL:n,URLSearchParams:o,format:i,relative:a,defaultBase:s}},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]:{},o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=arguments.length>3?arguments[3]:void 0,a=r.protocol?r.protocol.replace(":",""):"http";a=(o[a]||s||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+"//":"",o=e.host||"",s=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(o||s+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 o of e)r||(n=t.type||("string"===typeof o?"string":"buffer"),r=i[n]()),"string"===n?r+=o:r.append(o);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),o=r(70121);e.exports=e=>{const t=i(),r=n(e.source),s=o();let a;const c=e.sink(async function*(){yield*t;const e=await s.promise;yield*e}());c.catch((e=>{a=e}));return{reader:r,writer:t,stream:{sink:e=>a?Promise.reject(a):(s.resolve(e),c),source:r},rest:()=>t.end(),write:t.push,read:async()=>(await r.next()).value}}},96596:(e,t,r)=>{"use strict";const{Buffer:n}=r(19778),i=r(41976),o=r(17104),s=4194304,a=n.alloc(0),c="readLength",u="readData",l={[c]:(e,t,r,n)=>{let o;t=t.append(e);try{o=n.lengthDecoder(t)}catch(s){if(t.length>n.maxLengthLength)throw Object.assign(s,{message:"message length too long",code:"ERR_MSG_LENGTH_TOO_LONG"});if(s instanceof RangeError)return{mode:c,buffer:t,chunk:void 0,state:void 0,data:void 0};throw s}if(o>n.maxDataLength)throw Object.assign(new Error("message data too long"),{code:"ERR_MSG_DATA_TOO_LONG"});return e=t.shallowSlice(n.lengthDecoder.bytes),t=new i,n.onLength&&n.onLength(o),o<=0?(n.onData&&n.onData(a),{mode:c,chunk:e,buffer:t,data:a}):{mode:u,chunk:e,buffer:t,state:{dataLength:o},data:void 0}},[u]:(e,t,r,n)=>{if(t=t.append(e),!r)throw new Error("state is required");if(t.length<r.dataLength)return{mode:u,buffer:t,state:r,chunk:void 0,data:void 0};const{dataLength:o}=r,s=t.shallowSlice(0,o),a=t.length>o?t.shallowSlice(o):void 0;return t=new i,n.onData&&n.onData(s),{mode:c,chunk:a,buffer:t,state:void 0,data:s}}};function d(e){const t={lengthDecoder:(e=e||{}).lengthDecoder||o,maxLengthLength:e.maxLengthLength||8,maxDataLength:e.maxDataLength||s,onLength:e.onLength,onData:e.onData};return async function*(e){let r,n=new i,o=c;for await(const i of e){let e=i;for(;e;){const i=l[o](e,n,r,t);o=i.mode,e=i.chunk,n=i.buffer,r=i.state,i.data&&(yield i.data)}}if(n.length)throw Object.assign(new Error("unexpected end of input"),{code:"ERR_UNEXPECTED_EOF"})}}d.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 d({...t||{},onLength:e=>{r=e}})(n)},e.exports=d,e.exports.MAX_LENGTH_LENGTH=8,e.exports.MAX_DATA_LENGTH=s},82986:(e,t,r)=>{"use strict";const{Buffer:n}=r(19778),i=r(41976),o=r(28859);function s(e){e=e||{};const t=Math.max(e.poolSize||10240,e.minPoolSize||8),r=e.lengthEncoder||o;return async function*(e){let o=n.alloc(t),s=0;for await(const a of e){r(a.length,o,s);const e=o.slice(s,s+r.bytes);s+=r.bytes,o.length-s<8&&(o=n.alloc(t),s=0),yield(new i).append(e).append(a)}}}s.single=(e,t)=>{const r=(t=t||{}).lengthEncoder||o;return new i([r(e.length),e.slice()])},e.exports=s,e.exports.MIN_POOL_SIZE=8,e.exports.DEFAULT_POOL_SIZE=10240},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),o=e=>{const t=n.decode(i.isBuffer(e)?e:(r=e,new Proxy({},{get:(e,t)=>"l"===t[0]?r[t]:r.get(parseInt(t))})));var r;return o.bytes=n.decode.bytes,t};e.exports=o},28859:(e,t,r)=>{"use strict";const n=r(74561),{Buffer:i}=r(19778),o=(e,t,r)=>{const s=n.encode(e,t,r);return o.bytes=n.encode.bytes,t||i.from(s)};e.exports=o},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),o=i.decode.fromReader(r.reader,t);let s=!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(s=n,!t)throw new Error("Value is null");return t},readLP:async()=>{const{value:e,done:t}=await o.next();if(s=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),o=function(){for(var e=arguments.length,o=new Array(e),s=0;s<e;s++)o[s]=arguments[s];if(n(o[0])){const e=o[0];o[0]=()=>e.source}else if(r(o[0])){const e=o[0];o[0]=()=>e}if(o.length>1&&n(o[o.length-1])&&(o[o.length-1]=o[o.length-1].sink),o.length>2)for(let t=1;t<o.length-1;t++)n(o[t])&&(o[t]=i(o[t]));return t(...o)};e.exports=o,e.exports.pipe=o,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,o,s=new n;const a=e=>i?i(e):(s.push(e),r),c=e=>o?r:a({done:!1,value:e}),u=e=>o?r:(o=!0,e?(e=>(s=new n,i?i({error:e}):(s.push({error:e}),r)))(e):a({done:!0}));if(r={[Symbol.asyncIterator](){return this},next:()=>{if(!s.isEmpty()){if(e.writev){let e;const t=[];for(;!s.isEmpty();){if(e=s.shift(),e.error)throw e.error;t.push(e.value)}return{done:e.done,value:t}}const t=s.shift();if(t.error)throw t.error;return t}return o?{done:!0}:new Promise(((t,n)=>{i=o=>(i=null,o.error?n(o.error):e.writev&&!o.done?t({done:o.done,value:[o.value]}):t(o),r)}))},return:()=>(s=new n,u(),{done:!0}),throw:e=>(u(e),{done:!0}),push:c,end:u},!t)return r;const 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),o=r(40142);e.exports=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r="undefined"===typeof window?{}:window.location,s=o(e,r),a=new n(s,t.websocket),c=i(a,t);return c.remoteAddress=s,c.close=()=>new Promise(((e,t)=>{a.addEventListener("close",e),a.close()})),c.destroy=()=>{a.terminate?a.terminate():a.close()},c.socket=a,c},e.exports.connect=e.exports},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",o),n.call(e,"error",s))}function o(){i(),t()}function s(e){i(),r(e)}e.addEventListener("open",o),e.addEventListener("error",s)}))}},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:o}=r;return e.addEventListener("message",n),e.addEventListener("error",o),e.addEventListener("close",i),()=>{t.call(e,"message",n),t.call(e,"error",o),t.call(e,"close",i)}}),{highWaterMark:1/0});for await(const{data:e}of r)yield(o=e,o instanceof ArrayBuffer||null!=o&&null!=o.constructor&&"ArrayBuffer"===o.constructor.name&&"number"===typeof o.byteLength?n.from(e):e);var o}();let o,s=1===e.readyState;return e.addEventListener("open",(()=>{s=!0,o=null})),e.addEventListener("close",(()=>{s=!1,o=null})),e.addEventListener("error",(e=>{s||(o=e)})),r.connected=()=>new Promise(((r,n)=>{if(s)return r();if(o)return n(o);const i=r=>{t.call(e,"open",a),t.call(e,"error",c),r()},a=()=>i(r),c=e=>i((()=>n(e)));e.addEventListener("open",a),e.addEventListener("error",c)})),r}},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 o="input is invalid type",s="object"===typeof window,a=s?window:{};a.JS_SHA3_NO_WINDOW&&(s=!1);var c=!s&&"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,d=!a.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!==typeof ArrayBuffer,h="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],b=["hex","buffer","arrayBuffer","array","digest"],v={128:168,256:136};!a.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!d||!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 x(e,t,e).update(n)[r]()}},E=function(e,t,r){return function(n,i){return new x(e,t,i).update(n)[r]()}},_=function(e,t,r){return function(t,n,i,o){return T["cshake"+e].update(t,n,i,o)[r]()}},S=function(e,t,r){return function(t,n,i,o){return T["kmac"+e].update(t,n,i,o)[r]()}},I=function(e,t,r,n){for(var i=0;i<b.length;++i){var o=b[i];e[o]=t(r,n,o)}return e},A=function(e,t){var r=w(e,t,"hex");return r.create=function(){return new x(e,t,e)},r.update=function(e){return r.create().update(e)},I(r,w,e,t)},R=[{name:"keccak",padding:[1,256,65536,16777216],bits:g,createMethod:A},{name:"sha3",padding:[6,1536,393216,100663296],bits:g,createMethod:A},{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 x(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=v[e],n=_(e,0,"hex");return n.create=function(n,i,o){return i||o?new x(e,t,n).bytepad([i,o],r):T["shake"+e].create(n)},n.update=function(e,t,r,i){return n.create(t,r,i).update(e)},I(n,_,e,t)}},{name:"kmac",padding:f,bits:m,createMethod:function(e,t){var r=v[e],n=S(e,0,"hex");return n.create=function(n,i,o){return new L(e,t,i).bytepad(["KMAC",o],r).bytepad([n],r)},n.update=function(e,t,r,i){return n.create(e,r,i).update(t)},I(n,S,e,t)}}],T={},C=[],P=0;P<R.length;++P)for(var k=R[P],O=k.bits,N=0;N<O.length;++N){var D=k.name+"_"+O[N];if(C.push(D),T[D]=k.createMethod(O[N],k.padding),"sha3"!==k.name){var B=k.name+O[N];C.push(B),T[B]=T[D]}}function x(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 L(e,t,r){x.call(this,e,t,r)}x.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(o);if(null===e)throw new Error(o);if(d&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!Array.isArray(e)&&(!d||!ArrayBuffer.isView(e)))throw new Error(o);t=!0}for(var n,i,s=this.blocks,a=this.byteCount,c=e.length,u=this.blockCount,l=0,h=this.s;l<c;){if(this.reset)for(this.reset=!1,s[0]=this.block,n=1;n<u+1;++n)s[n]=0;if(t)for(n=this.start;l<c&&n<a;++l)s[n>>2]|=e[l]<<p[3&n++];else for(n=this.start;l<c&&n<a;++l)(i=e.charCodeAt(l))<128?s[n>>2]|=i<<p[3&n++]:i<2048?(s[n>>2]|=(192|i>>6)<<p[3&n++],s[n>>2]|=(128|63&i)<<p[3&n++]):i<55296||i>=57344?(s[n>>2]|=(224|i>>12)<<p[3&n++],s[n>>2]|=(128|i>>6&63)<<p[3&n++],s[n>>2]|=(128|63&i)<<p[3&n++]):(i=65536+((1023&i)<<10|1023&e.charCodeAt(++l)),s[n>>2]|=(240|i>>18)<<p[3&n++],s[n>>2]|=(128|i>>12&63)<<p[3&n++],s[n>>2]|=(128|i>>6&63)<<p[3&n++],s[n>>2]|=(128|63&i)<<p[3&n++]);if(this.lastByteIndex=n,n>=a){for(this.start=n-a,this.block=s[u],n=0;n<u;++n)h[n]^=s[n];M(h),this.reset=!0}else this.start=n}return this},x.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},x.prototype.encodeString=function(e){var t,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(o);if(null===e)throw new Error(o);if(d&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!Array.isArray(e)&&(!d||!ArrayBuffer.isView(e)))throw new Error(o);t=!0}var n=0,i=e.length;if(t)n=i;else for(var s=0;s<e.length;++s){var a=e.charCodeAt(s);a<128?n+=1:a<2048?n+=2:a<55296||a>=57344?n+=3:(a=65536+((1023&a)<<10|1023&e.charCodeAt(++s)),n+=4)}return n+=this.encode(8*n),this.update(e),n},x.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,o=[];return o.length=i,this.update(o),this},x.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)}},x.prototype.toString=x.prototype.hex=function(){this.finalize();for(var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,s=0,a="";s<n;){for(o=0;o<t&&s<n;++o,++s)e=r[o],a+=h[e>>4&15]+h[15&e]+h[e>>12&15]+h[e>>8&15]+h[e>>20&15]+h[e>>16&15]+h[e>>28&15]+h[e>>24&15];s%t===0&&(M(r),o=0)}return i&&(e=r[o],a+=h[e>>4&15]+h[15&e],i>1&&(a+=h[e>>12&15]+h[e>>8&15]),i>2&&(a+=h[e>>20&15]+h[e>>16&15])),a},x.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,s=0,a=this.outputBits>>3;e=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(a);for(var c=new Uint32Array(e);s<n;){for(o=0;o<t&&s<n;++o,++s)c[s]=r[o];s%t===0&&M(r)}return i&&(c[o]=r[o],e=e.slice(0,a)),e},x.prototype.buffer=x.prototype.arrayBuffer,x.prototype.digest=x.prototype.array=function(){this.finalize();for(var e,t,r=this.blockCount,n=this.s,i=this.outputBlocks,o=this.extraBytes,s=0,a=0,c=[];a<i;){for(s=0;s<r&&a<i;++s,++a)e=a<<2,t=n[s],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 o&&(e=a<<2,t=n[s],c[e]=255&t,o>1&&(c[e+1]=t>>8&255),o>2&&(c[e+2]=t>>16&255)),c},L.prototype=new x,L.prototype.finalize=function(){return this.encode(this.outputBits,!0),x.prototype.finalize.call(this)};var M=function(e){var t,r,n,i,o,s,a,c,u,l,d,h,f,p,g,m,b,v,w,E,_,S,I,A,R,T,C,P,k,O,N,D,B,x,L,M,U,j,K,F,V,q,H,z,G,W,Y,Q,X,J,$,Z,ee,te,re,ne,ie,oe,se,ae,ce,ue,le;for(n=0;n<48;n+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],s=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],d=e[7]^e[17]^e[27]^e[37]^e[47],t=(h=e[8]^e[18]^e[28]^e[38]^e[48])^(s<<1|a>>>31),r=(f=e[9]^e[19]^e[29]^e[39]^e[49])^(a<<1|s>>>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=o^(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=s^(l<<1|d>>>31),r=a^(d<<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^(h<<1|f>>>31),r=u^(f<<1|h>>>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|o>>>31),r=d^(o<<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,H=e[41]<<18|e[40]>>>14,x=e[2]<<1|e[3]>>>31,L=e[3]<<1|e[2]>>>31,m=e[13]<<12|e[12]>>>20,b=e[12]<<12|e[13]>>>20,Q=e[22]<<10|e[23]>>>22,X=e[23]<<10|e[22]>>>22,O=e[33]<<13|e[32]>>>19,N=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,v=e[25]<<11|e[24]>>>21,w=e[24]<<11|e[25]>>>21,J=e[34]<<15|e[35]>>>17,$=e[35]<<15|e[34]>>>17,D=e[45]<<29|e[44]>>>3,B=e[44]<<29|e[45]>>>3,A=e[6]<<28|e[7]>>>4,R=e[7]<<28|e[6]>>>4,ne=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,j=e[26]<<25|e[27]>>>7,K=e[27]<<25|e[26]>>>7,E=e[36]<<21|e[37]>>>11,_=e[37]<<21|e[36]>>>11,Z=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,z=e[8]<<27|e[9]>>>5,G=e[9]<<27|e[8]>>>5,T=e[18]<<20|e[19]>>>12,C=e[19]<<20|e[18]>>>12,oe=e[29]<<7|e[28]>>>25,se=e[28]<<7|e[29]>>>25,F=e[38]<<8|e[39]>>>24,V=e[39]<<8|e[38]>>>24,S=e[48]<<14|e[49]>>>18,I=e[49]<<14|e[48]>>>18,e[0]=p^~m&v,e[1]=g^~b&w,e[10]=A^~T&P,e[11]=R^~C&k,e[20]=x^~M&j,e[21]=L^~U&K,e[30]=z^~W&Q,e[31]=G^~Y&X,e[40]=te^~ne&oe,e[41]=re^~ie&se,e[2]=m^~v&E,e[3]=b^~w&_,e[12]=T^~P&O,e[13]=C^~k&N,e[22]=M^~j&F,e[23]=U^~K&V,e[32]=W^~Q&J,e[33]=Y^~X&$,e[42]=ne^~oe&ae,e[43]=ie^~se&ce,e[4]=v^~E&S,e[5]=w^~_&I,e[14]=P^~O&D,e[15]=k^~N&B,e[24]=j^~F&q,e[25]=K^~V&H,e[34]=Q^~J&Z,e[35]=X^~$&ee,e[44]=oe^~ae&ue,e[45]=se^~ce&le,e[6]=E^~S&p,e[7]=_^~I&g,e[16]=O^~D&A,e[17]=N^~B&R,e[26]=F^~q&x,e[27]=V^~H&L,e[36]=J^~Z&z,e[37]=$^~ee&G,e[46]=ae^~ue&te,e[47]=ce^~le&re,e[8]=S^~p&m,e[9]=I^~g&b,e[18]=D^~A&T,e[19]=B^~R&C,e[28]=q^~x&M,e[29]=H^~L&U,e[38]=Z^~z&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=T;else{for(P=0;P<C.length;++P)a[C[P]]=T[C[P]];l&&(void 0===(n=function(){return T}.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}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.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.getPublicKey=t.generateSymmetricKey=t.generatePrivateKey=t.WakuMessage=t.waku_message=t.Protocols=t.DefaultPubSubTopic=t.Waku=t.waku=t.utils=t.enr=t.discovery=t.getPredefinedBootstrapNodes=void 0;var s=r(93656);Object.defineProperty(t,"getPredefinedBootstrapNodes",{enumerable:!0,get:function(){return s.getPredefinedBootstrapNodes}}),t.discovery=o(r(93656)),t.enr=o(r(58420)),t.utils=o(r(58928)),t.waku=o(r(5151));var a=r(5151);Object.defineProperty(t,"Waku",{enumerable:!0,get:function(){return a.Waku}}),Object.defineProperty(t,"DefaultPubSubTopic",{enumerable:!0,get:function(){return a.DefaultPubSubTopic}}),Object.defineProperty(t,"Protocols",{enumerable:!0,get:function(){return a.Protocols}}),t.waku_message=o(r(31195));var c=r(31195);Object.defineProperty(t,"WakuMessage",{enumerable:!0,get:function(){return c.WakuMessage}});var u=r(57834);Object.defineProperty(t,"generatePrivateKey",{enumerable:!0,get:function(){return u.generatePrivateKey}}),Object.defineProperty(t,"generateSymmetricKey",{enumerable:!0,get:function(){return u.generateSymmetricKey}}),Object.defineProperty(t,"getPublicKey",{enumerable:!0,get:function(){return u.getPublicKey}}),t.waku_light_push=o(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=o(r(45549));var d=r(45549);Object.defineProperty(t,"WakuRelay",{enumerable:!0,get:function(){return d.WakuRelay}}),Object.defineProperty(t,"RelayCodecs",{enumerable:!0,get:function(){return d.RelayCodecs}}),t.waku_store=o(r(93539));var h=r(93539);Object.defineProperty(t,"PageDirection",{enumerable:!0,get:function(){return h.PageDirection}}),Object.defineProperty(t,"WakuStore",{enumerable:!0,get:function(){return h.WakuStore}}),Object.defineProperty(t,"StoreCodecs",{enumerable:!0,get:function(){return h.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}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.sha256=t.randomBytes=t.getSubtle=void 0;const a=s(r(28339)),c=o(r(53845)),u={node:a.default,web:"object"===typeof self&&"crypto"in self?self.crypto:void 0};t.getSubtle=function(){if(u.web)return u.web.subtle;if(u.node)return u.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},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)),o=r(98719),s=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 o.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 o.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=s.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=n(r(88093)),o=r(18392),s=r(58420),a=r(42132),c=r(52039),u=n(r(81930)),l=(0,o.debug)("waku:discovery:dns");class d{constructor(e){this._errorTolerance=10,this._DNSTreeCache={},this.dns=e}static dnsOverHttp(e){const t=new a.DnsOverHttps(e);return new d(t)}async getPeers(e,t){const r=Math.floor(Math.random()*e.length),{publicKey:n,domain:i}=c.ENRTree.parseTree(e[r]),o={domain:i,publicKey:n,visits:{}},s=await(0,u.default)(t,this._errorTolerance,(()=>this._search(i,o)));return l("retrieved peers: ",s),s}async _search(e,t){try{const n=await this._getTXTRecord(e,t);let i,o;t.visits[e]=!0;const a=function(e){return e.startsWith(c.ENRTree.ROOT_PREFIX)?c.ENRTree.ROOT_PREFIX:e.startsWith(c.ENRTree.BRANCH_PREFIX)?c.ENRTree.BRANCH_PREFIX:e.startsWith(c.ENRTree.RECORD_PREFIX)?c.ENRTree.RECORD_PREFIX:""}(n);try{switch(a){case c.ENRTree.ROOT_PREFIX:return i=c.ENRTree.parseAndVerifyRoot(n,t.publicKey),await this._search(i,t);case c.ENRTree.BRANCH_PREFIX:return o=c.ENRTree.parseBranch(n),i=function(e,t){const r={};for(const[i,o]of e.entries())t.visits[o]&&(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 c.ENRTree.RECORD_PREFIX:return s.ENR.decodeTxt(n);default:return null}}catch(r){return l("Failed to search DNS tree ".concat(a," at subdomain ").concat(e,": ").concat(r)),null}}catch(r){return l("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);(0,i.default)(n.length,"Received empty result array while fetching TXT record"),(0,i.default)(n[0].length,"Received empty TXT record");const o=n.join("");return this._DNSTreeCache[e]=o,o}}t.DnsNodeDiscovery=d},42132:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DnsOverHttps=void 0;const n=r(54535),i=r(58928),{cloudflare:o,google:s,opendns:a}=n.endpoints;t.DnsOverHttps=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[o,s,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}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ENRTree=void 0;const a=s(r(88093)),c=o(r(53845)),u=o(r(49437)),l=r(46765),d=r(58420),h=r(58928);class f{static parseAndVerifyRoot(e,t){(0,a.default)(e.startsWith(this.ROOT_PREFIX),"ENRTree root entry must start with '".concat(this.ROOT_PREFIX,"'"));const r=f.parseRootValues(e),n=u.decode.asBytes(t),i=e.split(" sig")[0],o=(0,h.utf8ToBytes)(i),s=(0,l.fromString)(r.signature,"base64url").slice(0,64);let d;try{const e=c.Signature.fromCompact(s.slice(0,64));d=c.verify(e,(0,h.keccak256Buf)(o),new Uint8Array(n))}catch{d=!1}return(0,a.default)(d,"Unable to verify ENRTree root signature"),r.eRoot}static parseRootValues(e){const t=e.match(/^enrtree-root:v1 e=([^ ]+) l=([^ ]+) seq=(\d+) sig=([^ ]+)$/);a.default.ok(Array.isArray(t),"Could not parse ENRTree root entry"),t.shift();const[r,n,i,o]=t;return a.default.ok(r,"Could not parse 'e' value from ENRTree root entry"),a.default.ok(n,"Could not parse 'l' value from ENRTree root entry"),a.default.ok(i,"Could not parse 'seq' value from ENRTree root entry"),a.default.ok(o,"Could not parse 'sig' value from ENRTree root entry"),{eRoot:r,lRoot:n,seq:Number(i),signature:o}}static parseTree(e){(0,a.default)(e.startsWith(this.TREE_PREFIX),"ENRTree tree entry must start with '".concat(this.TREE_PREFIX,"'"));const t=e.match(/^enrtree:\/\/([^@]+)@(.+)$/);a.default.ok(Array.isArray(t),"Could not parse ENRTree tree entry"),t.shift();const[r,n]=t;return a.default.ok(r,"Could not parse public key from ENRTree tree entry"),a.default.ok(n,"Could not parse domain from ENRTree tree entry"),{publicKey:r,domain:n}}static parseBranch(e){return(0,a.default)(e.startsWith(this.BRANCH_PREFIX),"ENRTree branch entry must start with '".concat(this.BRANCH_PREFIX,"'")),e.split(this.BRANCH_PREFIX)[1].split(",")}}t.ENRTree=f,f.RECORD_PREFIX=d.ENR.RECORD_PREFIX,f.TREE_PREFIX="enrtree:",f.BRANCH_PREFIX="enrtree-branch:",f.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 o(e,t){if(!e.nodeId)return!1;for(const r of t)if(e.nodeId===r.nodeId)return!1;return!0}function s(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,d;const h={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!==(d=e.lightPush)&&void 0!==d?d:0},f=h.relay+h.store+h.filter+h.lightPush,p={relay:0,store:0,filter:0,lightPush:0};let y=0;const g=[];for(;!i(h,p)&&y<f+t;){const e=await r();e&&o(e,g)&&(e.waku2&&a(e.waku2,h,p)&&(s(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}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getPseudoRandomSubset=t.ENRTree=t.DnsOverHttps=t.dns=t.Bootstrap=t.predefined=t.getPredefinedBootstrapNodes=void 0;const s=r(53357);var a=r(21370);Object.defineProperty(t,"getPredefinedBootstrapNodes",{enumerable:!0,get:function(){return a.getPredefinedBootstrapNodes}}),t.predefined=o(r(21370));var c=r(55007);Object.defineProperty(t,"Bootstrap",{enumerable:!0,get:function(){return c.Bootstrap}}),t.dns=o(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,s.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 o;t.DefaultWantedNumber=1,function(e){e.Prod="prod",e.Test="test"}(o=t.Fleet||(t.Fleet={})),t.getPredefinedBootstrapNodes=function(){let e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:o.Prod,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.DefaultWantedNumber;if(s<=0)return[];switch(r){case o.Prod:e=t.fleets.fleets["wakuv2.prod"]["waku-websocket"];break;case o.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,s)},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},94341:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createNodeId=void 0;const n=r(58928);t.createNodeId=function(e){if(32!==e.length)throw new Error("NodeId must be 32 bytes in length");return(0,n.bytesToHex)(e)}},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}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ENR=void 0;const a=o(r(67845)),c=s(r(18392)),u=r(98719),l=s(r(93516)),d=r(46765),h=r(82051),f=r(74561),p=r(58928),y=r(74029),g=r(3063),m=r(47159),b=o(r(71734)),v=r(71734),w=r(97342),E=(0,c.default)("waku:enr");class _ 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 createV4(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return 33!==e.length&&(e=(0,v.compressPublicKey)(e)),new _({...t,id:(0,p.utf8ToBytes)("v4"),secp256k1:e})}static createFromPeerId(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=(0,g.createKeypairFromPeerId)(e);if(r.type===g.KeypairType.secp256k1)return _.createV4(r.publicKey,t);throw new Error}static 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,p.bytesToUtf8)(n[a])]=n[a+1]}catch(u){E("Failed to decode ENR key to UTF-8, skipping it",n[a],u)}const o="0x"+(r.length?(0,p.bytesToHex)(r):"00"),s=new _(i,BigInt(o),t),c=(0,p.hexToBytes)(a.encode([r,...n]));if(!s.verify(c,t))throw new Error("Unable to verify ENR signature");return s}static decode(e){const t=a.decode(e).map(p.hexToBytes);return _.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 _.decode((0,d.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,p.bytesToUtf8)(e)}get keypairType(){if("v4"===this.id)return g.KeypairType.secp256k1;throw new Error(y.ERR_INVALID_ID)}get publicKey(){if("v4"===this.id)return this.get("secp256k1");throw new Error(y.ERR_INVALID_ID)}get keypair(){if(this.publicKey){const e=this.publicKey;return(0,g.createKeypair)(this.keypairType,void 0,e)}}get peerId(){return this.keypair?(0,g.createPeerIdFromKeypair)(this.keypair):void 0}get nodeId(){if("v4"===this.id)return this.publicKey?b.nodeId(this.publicKey):void 0;throw new Error(y.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,m.decodeMultiaddrs)(e)}set multiaddrs(e){if(void 0===e)this.delete("multiaddrs");else{const t=(0,m.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 o,s;if(n)o="udp",s=t?this.get("udp6"):this.get("udp");else{if(!i)return;o="tcp",s=t?this.get("tcp6"):this.get("tcp")}if(!s)return;const a=u.protocols.names[t?"ip6":"ip4"],c=a.size/8,l=u.protocols.names[o],d=(0,f.encode)(l.code),h=new Uint8Array(3+c+d.length);return h[0]=a.code,h.set(r,1),h.set(d,1+c),h.set(s,1+c+d.length),new u.Multiaddr(h)}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(y.ERR_INVALID_ID);if(!this.publicKey)throw new Error("Failed to verify ENR: No public key");return b.verify(this.publicKey,e,t)}async sign(e,t){if("v4"!==this.id)throw new Error(y.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,p.utf8ToBytes)(t),r]})).flat();if(t.unshift(new Uint8Array([Number(this.seq)])),e)t.unshift(await this.sign((0,p.hexToBytes)(a.encode(t)),e));else{if(!this.signature)throw new Error(y.ERR_NO_SIGNATURE);t.unshift(this.signature)}return t}async encode(e){const t=(0,p.hexToBytes)(a.encode(await this.encodeToValues(e)));if(t.length>=y.MAX_RECORD_SIZE)throw new Error("ENR must be less than 300 bytes");return t}async encodeTxt(e){return _.RECORD_PREFIX+(0,h.toString)(await this.encode(e),"base64url")}}t.ENR=_,_.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}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t},s=this&&this.__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=o(r(71734));t.v4=a,s(r(74029),t),s(r(81326),t),s(r(59477),t),s(r(94341),t),s(r(3063),t),s(r(97342),t)},52445:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ERR_INVALID_KEYPAIR_TYPE=t.ERR_TYPE_NOT_IMPLEMENTED=void 0,t.ERR_TYPE_NOT_IMPLEMENTED="Keypair type not implemented",t.ERR_INVALID_KEYPAIR_TYPE="Invalid keypair type"},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)},o=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=void 0;const s=r(25504),a=o(r(53765)),c=o(r(90190)),{keysPBM:u,supportedKeys:l}=s.keys,d=r(52445),h=r(31981),f=r(71288);function p(e,t,r){if(e===f.KeypairType.secp256k1)return new h.Secp256k1Keypair(t,r);throw new Error(d.ERR_TYPE_NOT_IMPLEMENTED)}i(r(71288),t),i(r(31981),t),t.generateKeypair=async function(e){if(e===f.KeypairType.secp256k1)return await h.Secp256k1Keypair.generate();throw new Error(d.ERR_TYPE_NOT_IMPLEMENTED)},t.createKeypair=p,t.createPeerIdFromKeypair=function(e){if(e.type===f.KeypairType.secp256k1){const t=e.hasPrivateKey()?new l.secp256k1.Secp256k1PrivateKey(e.privateKey,e.publicKey):void 0,r=new l.secp256k1.Secp256k1PublicKey(e.publicKey),n=a.default.encode(r.bytes,"identity");return new c.default(n,t,r)}throw new Error(d.ERR_TYPE_NOT_IMPLEMENTED)},t.createKeypairFromPeerId=function(e){const t=u.PublicKey.decode(e.pubKey.bytes);return p(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}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Secp256k1Keypair=t.secp256k1PublicKeyToRaw=t.secp256k1PublicKeyToFull=t.secp256k1PublicKeyToCompressed=void 0;const s=o(r(53845)),a=r(62110),c=r(5602),u=r(71288);function l(e){64===e.length&&(e=(0,a.concat)([[4],e],65));return s.Point.fromHex(e).toRawBytes(!0)}t.secp256k1PublicKeyToCompressed=l,t.secp256k1PublicKeyToFull=function(e){return 64===e.length&&(e=(0,a.concat)([[4],e],65)),s.Point.fromHex(e).toRawBytes(!1)},t.secp256k1PublicKeyToRaw=function(e){return s.Point.fromHex(e).toRawBytes(!1).slice(1)};const d=class e extends u.AbstractKeypair{constructor(e,t){let r=t;r&&(r=l(r)),super(e,r),this.type=u.KeypairType.secp256k1}static async generate(){const t=(0,c.randomBytes)(32),r=s.getPublicKey(t);return new e(t,r)}privateKeyVerify(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._privateKey;return!e||s.utils.isValidPrivateKey(e)}publicKeyVerify(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._publicKey;if(e)try{return s.Point.fromHex(e),!0}catch{return!1}return!0}async sign(e){const[t,r]=await s.sign(e,this.privateKey,{recovered:!0,der:!1});return(0,a.concat)([t,[r]],t.length+1)}verify(e,t){try{const r=s.Signature.fromCompact(t.slice(0,64));return s.verify(r,e,this.publicKey)}catch{return!1}}};t.Secp256k1Keypair=d},71288:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AbstractKeypair=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={}));t.AbstractKeypair=class{constructor(e,t){if((this._privateKey=e)&&!this.privateKeyVerify())throw new Error("Invalid private key");if((this._publicKey=t)&&!this.publicKeyVerify())throw new Error("Invalid public key")}get privateKey(){if(!this._privateKey)throw new Error;return this._privateKey}get publicKey(){if(!this._publicKey)throw new Error;return this._publicKey}privateKeyVerify(){return!0}publicKeyVerify(){return!0}hasPrivateKey(){return Boolean(this._privateKey)}}},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 o=new DataView(e.buffer,r,i.MULTIADDR_LENGTH_SIZE).getUint16(0);r+=i.MULTIADDR_LENGTH_SIZE;const s=e.slice(r,r+o);r+=o;const a=new n.Multiaddr(s);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 o=0;return e.forEach((e=>{if(e.getPeerId())throw new Error("`multiaddr` field MUST not contain peer id");n.setUint16(o,e.bytes.length),o+=i.MULTIADDR_LENGTH_SIZE,r.set(e.bytes,o),o+=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}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ENRKeyPair=t.nodeId=t.verify=t.sign=t.compressPublicKey=t.publicKey=t.createPrivateKey=t.hash=void 0;const s=o(r(53845)),a=r(27898),c=r(5602),u=r(58928),l=r(94341);function d(e){return new Uint8Array(a.keccak256.arrayBuffer(e))}function h(){return(0,c.randomBytes)(32)}function f(e){return s.getPublicKey(e,!0)}async function p(e,t){return s.sign(d(t),e,{der:!1})}function y(e,t,r){try{const n=s.Signature.fromCompact(r.slice(0,64));return s.verify(n,d(t),e)}catch{return!1}}function g(e){const t=s.Point.fromHex(e).toRawBytes(!1);return(0,l.createNodeId)(d(t.slice(1)))}t.hash=d,t.createPrivateKey=h,t.publicKey=f,t.compressPublicKey=function(e){return s.Point.fromHex((0,u.bytesToHex)(e)).toRawBytes(!0)},t.sign=p,t.verify=y,t.nodeId=g;class m{constructor(e,t,r){this.nodeId=e,this.privateKey=t,this.publicKey=r}static create(e){if(e&&!s.utils.isValidPrivateKey(e))throw new Error("Invalid private key");const t=e||h(),r=f(t),n=g(r);return new m(n,t,r)}async sign(e){return p(this.privateKey,e)}verify(e,t){return y(this.publicKey,e,t)}}t.ENRKeyPair=m},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.keccak256Buf=t.bytesToHex=t.hexToBytes=void 0;const n=r(27898),i=r(46765),o=r(82051);t.hexToBytes=function(e){if("string"===typeof e){const t=e.replace(/^0x/i,"");return(0,i.fromString)(t,"base16")}return e};t.bytesToHex=e=>(0,o.toString)(e,"base16"),t.keccak256Buf=function(e){return new Uint8Array(n.keccak256.arrayBuffer(e))};t.bytesToUtf8=e=>(0,o.toString)(e,"utf8");t.utf8ToBytes=e=>(0,i.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),o=n(r(18392)),s=n(r(6197)),a=n(r(44786)),c=n(r(34875)),u=n(r(3300)),l=n(r(44169)),d=n(r(66321)),h=r(98719),f=n(r(90190)),p=r(93656),y=r(50510),g=r(31195),m=r(45549),b=r(21923),v=r(93539),w=u.default.prototype[Symbol.toStringTag];t.DefaultPingKeepAliveValueSecs=0,t.DefaultRelayKeepAliveValueSecs=300,t.DefaultPubSubTopic="/waku/2/default-waku/proto";const E=(0,o.default)("waku:waku");var _;!function(e){e.Relay="relay",e.Store="store",e.LightPush="lightpush"}(_=t.Protocols||(t.Protocols={}));class S{constructor(e,r,n,i){var o;this.libp2p=r,this.relay=r.pubsub,this.store=n,this.lightPush=i,this.pingKeepAliveTimers={},this.relayKeepAliveTimers={};const s=e.pingKeepAlive||t.DefaultPingKeepAliveValueSecs,a=e.relayKeepAlive||t.DefaultRelayKeepAliveValueSecs;r.connectionManager.on("peer:connect",(e=>{this.startKeepAlive(e.remotePeer,s,a)})),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 o=Object.assign({},null===e||void 0===e?void 0:e.libp2p);if(o.config=Object.assign({transport:{[w]:{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&&(o.config.pubsub=Object.assign({pubSubTopic:e.pubSubTopic},o.config.pubsub)),o.modules=Object.assign({},null===e||void 0===e||null===(r=e.libp2p)||void 0===r?void 0:r.modules),o.modules=Object.assign({transport:[u.default]},null===e||void 0===e||null===(n=e.libp2p)||void 0===n?void 0:n.modules),o.modules=Object.assign(o.modules,{streamMuxer:[c.default],connEncryption:[new i.Noise(null===e||void 0===e?void 0:e.staticNoiseKey)],pubsub:m.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();o.modules=Object.assign(o.modules,{peerDiscovery:[a.default]}),o.config.peerDiscovery={[a.default.tag]:{list:e,enabled:!0}}}catch(g){E("Failed to retrieve bootstrap nodes",g)}}const d=await s.default.create(o),h=new v.WakuStore(d,{pubSubTopic:null===e||void 0===e?void 0:e.pubSubTopic}),f=new y.WakuLightPush(d);return await d.start(),new S(e||{},d,h,f)}async dial(e,t){const r=null!==t&&void 0!==t?t:[_.Relay],n=[];if(r.includes(_.Relay)&&m.RelayCodecs.forEach((e=>n.push(e))),r.includes(_.Store))for(const i of Object.values(v.StoreCodecs))n.push(i);return r.includes(_.LightPush)&&n.push(y.LightPushCodec),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,h.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)}deleteDecryptionKey(e){this.relay.deleteDecryptionKey(e),this.store.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){const t=null!==e&&void 0!==e?e:[_.Relay,_.Store],r=[];if(t.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)}))}));r.push(e)}}if(t.includes(_.Store)){let e=!1;for await(const t of this.store.peers){e=!0;break}if(!e){const e=new Promise((e=>{this.libp2p.peerStore.on("change:protocols",(t=>{let{protocols:r}=t;for(const n of Object.values(v.StoreCodecs))r.includes(n)&&(E("Resolving for",n,r),e())}))}));r.push(e)}}if(t.includes(_.LightPush)){let e=!1;for await(const t of this.lightPush.peers){e=!0;break}if(!e){const e=new Promise((e=>{this.libp2p.peerStore.on("change:protocols",(t=>{let{protocols:r}=t;r.includes(y.LightPushCodec)&&(E("Resolving for",y.LightPushCodec,r),e())}))}));r.push(e)}}await Promise.all(r)}startKeepAlive(e,t,r){this.stopKeepAlive(e);const n=e.toB58String();if(0!==t){const r=new d.default(this.libp2p);this.pingKeepAliveTimers[n]=setInterval((()=>{r.ping(e).catch((e=>{E("Ping failed (".concat(n,")"),e)}))}),1e3*t)}0!==r&&(this.relayKeepAliveTimers[n]=setInterval((()=>{g.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=S},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)),o=n(r(44709)),s=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,s.pipe)([n.encode()],o.default.encode(),c,o.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}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.PushRPC=void 0;const s=r(80886),a=r(75658),c=o(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(s.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}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.decrypt=t.encrypt=void 0;const s=o(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]),o=(0,a.concat)([t,e],t.length+e.length),s=(0,c.sha256)(o);i=i.then((e=>s.then((t=>{const r=new Uint8Array(t);return(0,a.concat)([e,r],e.length+r.length)})))),n+=32,r+=1}return i}function d(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=s.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 d(r,e),i=await l(n,32),o=(0,c.randomBytes)(16),u=i.slice(0,16),h=await(f=o,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)([o,h],o.length+h.length),m=await(0,c.sha256)(i.slice(16)),b=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),v=s.getPublicKey(r,!1);return(0,a.concat)([v,g,b],v.length+g.length+b.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 o=t.slice(0,65),s=t.length-113,a=t.slice(65,81),u=t.slice(65,81+s),h=u.slice(16),f=t.slice(81+s),p=d(e,o),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=h,(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}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.WakuMessage=t.DecryptionMethod=void 0;const a=s(r(18392)),c=s(r(18987)),u=r(80886),l=o(r(52494)),d=r(58928),h=o(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,d.utf8ToBytes)(e);return y.fromBytes(n,t,r)}static async fromBytes(e,t,r){var n,i;const{timestamp:o,encPublicKey:s,symKey:a,sigPrivKey:u}=Object.assign({timestamp:new Date},r||{});let l,d=e,f=0;if(s&&a)throw"Pass either `encPublicKey` or `symKey`, not both.";if(s){const e=await h.clearEncode(d,u);d=await h.encryptAsymmetric(e.payload,s),l=e.sig,f=1}else if(a){const e=await h.clearEncode(d,u);d=await h.encryptSymmetric(e.payload,a),l=e.sig,f=1}return new y({payload:d,timestampDeprecated:o.valueOf()/1e3,timestamp:c.default.fromNumber(o.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 o,s;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:o}=t;if(!o||e.contentTopic&&o.includes(e.contentTopic))switch(i){case p.Asymmetric:try{return await h.decryptAsymmetric(r,n)}catch(s){return void f("Failed to decrypt message using asymmetric encryption despite decryption method being specified",s)}case p.Symmetric:try{return await h.decryptSymmetric(r,n)}catch(s){return void f("Failed to decrypt message using asymmetric encryption despite decryption method being specified",s)}default:try{return await h.decryptSymmetric(r,n)}catch(s){f("Failed to decrypt message using symmetric encryption",s);try{return await h.decryptAsymmetric(r,n)}catch(s){return void f("Failed to decrypt message using asymmetric encryption",s)}}}})))).filter(a);if(0===c.length)return void f("Failed to decrypt payload.");const u=c[0],l=await h.clearDecode(u);if(!l)return void f("Failed to decode payload.");Object.assign(e,{payload:l.payload}),n=null===(o=l.sig)||void 0===o?void 0:o.publicKey,i=null===(s=l.sig)||void 0===s?void 0:s.signature}return new y(e,n,i)}encode(){return l.WakuMessage.encode(this.proto).finish()}get payloadAsUtf8(){if(!this.payload)return"";try{return(0,d.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";var n=r(19778).Buffer;Object.defineProperty(t,"__esModule",{value:!0}),t.generateIv=t.decrypt=t.encrypt=t.TagSize=t.IvSize=t.KeySize=void 0;const i=r(5602);t.KeySize=32,t.IvSize=12,t.TagSize=16;const o={name:"AES-GCM",length:128};t.encrypt=async function(e,t,r){return(0,i.getSubtle)().importKey("raw",t,o,!1,["encrypt"]).then((t=>(0,i.getSubtle)().encrypt({iv:e,...o},t,r))).then(n.from)},t.decrypt=async function(e,t,r){return(0,i.getSubtle)().importKey("raw",t,o,!1,["decrypt"]).then((t=>(0,i.getSubtle)().decrypt({iv:e,...o},t,r))).then(n.from)},t.generateIv=function(){return(0,i.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}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getPublicKey=t.generateSymmetricKey=t.generatePrivateKey=t.decryptSymmetric=t.encryptSymmetric=t.decryptAsymmetric=t.encryptAsymmetric=t.clearDecode=t.clearEncode=t.PrivateKeySize=void 0;const s=r(19778),a=o(r(53845)),c=r(27898),u=r(5602),l=r(58928),d=o(r(28799)),h=o(r(52620));function f(e){return a.getPublicKey(e,!1)}function p(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=s.Buffer.from([0]);r=function(e,t){const r=p(t);let n=s.Buffer.alloc(4);return n.writeUInt32LE(t.length,0),n=n.slice(0,r),(e=s.Buffer.concat([e,n]))[0]|=r,e}(r,e),r=s.Buffer.concat([r,s.Buffer.from(e)]);let n=1+p(e)+e.length;t&&(n+=65);const i=256-n%256,o=s.Buffer.from((0,u.randomBytes)(i));if(!function(e,t){if(e.length!==t)return!1;return!(t>3&&s.Buffer.from(e).equals(s.Buffer.alloc(e.length)))}(o,i))throw new Error("failed to generate random padding of size "+i);let d;if(r=s.Buffer.concat([r,o]),t){r[0]|=4;const e=(0,c.keccak256)(r),[n,i]=await a.sign(e,t,{recovered:!0,der:!1});r=s.Buffer.concat([r,(0,l.hexToBytes)(n),s.Buffer.from([i])]),d={signature:s.Buffer.from(n),publicKey:f(t)}}return{payload:r,sig:d}},t.clearDecode=function(e){const t=s.Buffer.from(e);let r,n=1;const i=3&t.readUIntLE(0,1);if(0===i)return;const o=t.readUIntLE(n,i);n+=i;const u=t.slice(n,n+o),d=4==(4&t.readUIntLE(0,1));if(d){const e=function(e){return e.slice(e.length-65,e.length)}(t),n=function(e,t){if(t)return(0,c.keccak256)(e.slice(0,e.length-65));return(0,c.keccak256)(e)}(t,d),i=function(e,t){const r=t.slice(64).readIntBE(0,1),n=a.Signature.fromCompact(t.slice(0,64));return a.recoverPublicKey((0,l.hexToBytes)(e),n,r,!1)}(n,e);r={signature:e,publicKey:i}}return{payload:u,sig:r}},t.encryptAsymmetric=async function(e,t){return d.encrypt(s.Buffer.from((0,l.hexToBytes)(t)),s.Buffer.from(e))},t.decryptAsymmetric=async function(e,t){return d.decrypt(s.Buffer.from(t),s.Buffer.from(e))},t.encryptSymmetric=async function(e,t){const r=h.generateIv(),n=await h.encrypt(r,s.Buffer.from((0,l.hexToBytes)(t)),s.Buffer.from(e));return s.Buffer.concat([n,s.Buffer.from(r)])},t.decryptSymmetric=async function(e,t){const r=s.Buffer.from(e),n=r.length-h.IvSize,i=r.slice(0,n),o=r.slice(n);return h.decrypt(o,s.Buffer.from((0,l.hexToBytes)(t)),i)},t.generatePrivateKey=function(){return(0,u.randomBytes)(t.PrivateKeySize)},t.generateSymmetricKey=function(){return(0,u.randomBytes)(h.KeySize)},t.getPublicKey=f},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 o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:()=>!0;const s=e.topics.get(t);if(!s)return new Set;let a=[];return s.forEach((t=>{const r=e.peers.get(t);r&&i.RelayCodecs.includes(r.protocol)&&o(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}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.WakuRelay=t.RelayCodecs=void 0;const a=s(r(18392)),c=s(r(37976)),u=r(53357),l=r(83983),d=s(r(90190)),h=r(58928),f=r(5151),p=r(31195),y=o(r(21923)),g=r(21923);Object.defineProperty(t,"RelayCodecs",{enumerable:!0,get:function(){return g.RelayCodecs}});const m=r(65346),b=r(23274),v=(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 b.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,h.hexToBytes)(e),null!==t&&void 0!==t?t:{})}deleteDecryptionKey(e){this.decryptionKeys.delete((0,h.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}}));v("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)}))):v("Failed to decode Waku Message")})).catch((e=>{v("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)]);v("Relay message to ".concat(r.size," peers")),r.forEach((t=>{t!==e.from&&(v("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 o=this._options.Dlazy;const s=y.RelayGossipFactor*n.length;s>o&&(o=s),o>n.length?o=n.length:(0,u.shuffle)(n),n.slice(0,o).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=d.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}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.RelayHeartbeat=void 0;const s=r(93234),a=r(53357),c=o(r(21923)),u=r(65346);class l extends s.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 o=new Map,s=e=>{let t=o.get(e);return void 0===t&&(t=this.gossipsub.score.score(e),o.set(e,t)),t},l=new Map,d=new Map,h=new Map;this.gossipsub._clearBackoff(),this.gossipsub.peerhave.clear(),this.gossipsub.iasked.clear(),this.gossipsub._applyIwantPenalties(),this.gossipsub._directConnect(),this.gossipsub.mesh.forEach(((o,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),o.delete(e);const t=d.get(e);t?t.push(f):d.set(e,[f])},y=e=>{this.gossipsub.log("HEARTBEAT: Add mesh link to %s in %s",e,f),this.gossipsub.score.graft(e,f),o.add(e);const t=l.get(e);t?t.push(f):l.set(e,[f])};if(o.forEach((e=>{const t=s(e);t<0&&(this.gossipsub.log("HEARTBEAT: Prune peer %s with negative score: score=%d, topic=%s",e,t,f),p(e),h.set(e,!0))})),o.size<t){const t=this.gossipsub.backoff.get(f),r=e-o.size;(0,u.getRelayPeers)(this.gossipsub,f,r,(e=>!o.has(e)&&!this.gossipsub.direct.has(e)&&(!t||!t.has(e))&&s(e)>=0)).forEach(y)}if(o.size>r){let t=Array.from(o);t.sort(((e,t)=>s(t)-s(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(o.size>=t){let e=0;if(o.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=>!o.has(e)&&!this.gossipsub.direct.has(e)&&(!r||!r.has(e))&&s(e)>=0)).forEach(y)}}if(this.gossipsub.heartbeatTicks%c.RelayOpportunisticGraftTicks===0&&o.size>1){const e=Array.from(o).sort(((e,t)=>s(e)-s(t))),t=Math.floor(o.size/2),r=s(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=>o.has(t)&&!this.gossipsub.direct.has(t)&&(!e||!e.has(t))&&s(t)>r)).forEach((e=>{this.gossipsub.log("HEARTBEAT: Opportunistically graft peer %s on topic %s",e,f),y(e)}))}}this.gossipsub._emitGossip(f,o)}));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)||s(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)&&s(e)>=this.gossipsub._options.scoreThresholds.publishThreshold)).forEach((e=>{t.add(e)}))}this.gossipsub._emitGossip(r,t)})),this.gossipsub._sendGraftPrune(l,d,h),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}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.HistoryRPC=t.PageDirection=void 0;const a=s(r(18987)),c=r(80886),u=r(75658),l=o(r(63953)),d=o(r(39938)),h=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 h.StoreCodecs.V2Beta3:this.protoCodec=l;break;case h.StoreCodecs.V2Beta4:this.protoCodec=d;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:h.StoreCodecs.V2Beta4,n=e.contentTopics.map((e=>({contentTopic:e}))),i=function(e){switch(e){case f.BACKWARD:return d.PagingInfo_Direction.DIRECTION_BACKWARD_UNSPECIFIED;case f.FORWARD:return d.PagingInfo_Direction.DIRECTION_FORWARD;default:return d.PagingInfo_Direction.DIRECTION_BACKWARD_UNSPECIFIED}}(e.pageDirection);switch(r){case h.StoreCodecs.V2Beta3:return(()=>{const t={pageSize:a.default.fromNumber(e.pageSize),cursor:e.cursor,direction:i};let o,s;return e.startTime&&(o=e.startTime.valueOf()/1e3),e.endTime&&(s=e.endTime.valueOf()/1e3),new p({requestId:(0,u.v4)(),query:{pubSubTopic:e.pubSubTopic,contentFilters:n,pagingInfo:t,startTime:o,endTime:s},response:void 0},r)})();case h.StoreCodecs.V2Beta4:return(()=>{const t={pageSize:a.default.fromNumber(e.pageSize),cursor:e.cursor,direction:i};let o,s;return e.startTime&&(o=a.default.fromNumber(e.startTime.valueOf()).mul(1e6)),e.endTime&&(s=a.default.fromNumber(e.endTime.valueOf()).mul(1e6)),new p({requestId:(0,u.v4)(),query:{pubSubTopic:e.pubSubTopic,contentFilters:n,pagingInfo:t,startTime:o,endTime:s},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)),o=n(r(72934)),s=n(r(44709)),a=r(79023),c=r(19370),u=r(58928),l=r(5151),d=r(31195),h=r(47954);Object.defineProperty(t,"PageDirection",{enumerable:!0,get:function(){return h.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:h.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 b=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=>{b.push({key:(0,u.hexToBytes)(t),contentTopics:e.length?e:void 0,method:void 0})}));const v=[];let w;for(;;){var E,_,S,I;const{stream:e}=await m.newStream(g),t=Object.assign(l,{cursor:w}),r=h.HistoryRPC.createQuery(t);f("Querying store peer",m.remoteAddr.toString());const n=await(0,a.pipe)([r.encode()],s.default.encode(),e,s.default.decode(),o.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"),v;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 d.WakuMessage.decodeProto(e,b);t&&(v.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===(_=r.query)||void 0===_||null===(S=_.pagingInfo)||void 0===S?void 0:S.pageSize;if(u||p&&y&&p<y)return v;if(w=null===(I=i.pagingInfo)||void 0===I?void 0:I.cursor,void 0===w)return console.log("No cursor returned by peer."),v}}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)}}},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)),o=n(r(80886)),s=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]:o.default.Writer.create();return""!==e.pubSubTopic&&t.uint32(10).string(e.pubSubTopic),void 0!==e.message&&s.WakuMessage.encode(e.message,t.uint32(18).fork()).ldelim(),t},decode(e,t){const r=e instanceof o.default.Reader?e:new o.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=s.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)?s.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?s.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?s.WakuMessage.fromPartial(e.message):void 0,r}},t.PushResponse={encode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.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 o.default.Reader?e:new o.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]:o.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 o.default.Reader?e:new o.default.Reader(e);let i=void 0===r?n.len:n.pos+r;const s={requestId:"",request:void 0,response:void 0};for(;n.pos<i;){const e=n.uint32();switch(e>>>3){case 1:s.requestId=n.string();break;case 2:s.request=t.PushRequest.decode(n,n.uint32());break;case 3:s.response=t.PushResponse.decode(n,n.uint32());break;default:n.skipType(7&e)}}return s},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}},o.default.util.Long!==i.default&&(o.default.util.Long=i.default,o.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)),o=n(r(80886));t.protobufPackage="waku.v2",t.WakuMessage={encode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.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 o.default.Reader?e:new o.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,o;const s={payload:void 0,contentTopic:void 0,version:void 0,timestampDeprecated:void 0,timestamp:void 0};return s.payload=null!==(t=e.payload)&&void 0!==t?t:void 0,s.contentTopic=null!==(r=e.contentTopic)&&void 0!==r?r:void 0,s.version=null!==(n=e.version)&&void 0!==n?n:void 0,s.timestampDeprecated=null!==(o=e.timestampDeprecated)&&void 0!==o?o:void 0,s.timestamp=void 0!==e.timestamp&&null!==e.timestamp?i.default.fromValue(e.timestamp):void 0,s}};var s=(()=>{if("undefined"!==typeof s)return s;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=s.atob||(e=>s.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=s.btoa||(e=>s.Buffer.from(e,"binary").toString("base64"));function l(e){return null!==e&&void 0!==e}o.default.util.Long!==i.default&&(o.default.util.Long=i.default,o.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)),o=n(r(80886)),s=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 d(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 h(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=d,t.historyResponse_ErrorToJSON=h,t.Index={encode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.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 o.default.Reader?e:new o.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:v(e.digest)?m(e.digest):new Uint8Array,receivedTime:v(e.receivedTime)?Number(e.receivedTime):0,senderTime:v(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 b(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]:o.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 o.default.Reader?e:new o.default.Reader(e);let i=void 0===r?n.len:n.pos+r;const s=p();for(;n.pos<i;){const e=n.uint32();switch(e>>>3){case 1:s.pageSize=n.uint64();break;case 2:s.cursor=t.Index.decode(n,n.uint32());break;case 3:s.direction=n.int32();break;default:n.skipType(7&e)}}return s},fromJSON:e=>({pageSize:v(e.pageSize)?i.default.fromString(e.pageSize):i.default.UZERO,cursor:v(e.cursor)?t.Index.fromJSON(e.cursor):void 0,direction:v(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]:o.default.Writer.create();return""!==e.contentTopic&&t.uint32(10).string(e.contentTopic),t},decode(e,t){const r=e instanceof o.default.Reader?e:new o.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:v(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]:o.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 o.default.Reader?e:new o.default.Reader(e);let i=void 0===r?n.len:n.pos+r;const s={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:s.pubSubTopic=n.string();break;case 3:s.contentFilters.push(t.ContentFilter.decode(n,n.uint32()));break;case 4:s.pagingInfo=t.PagingInfo.decode(n,n.uint32());break;case 5:s.startTime=n.double();break;case 6:s.endTime=n.double();break;default:n.skipType(7&e)}}return s},fromJSON:e=>({pubSubTopic:v(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:v(e.pagingInfo)?t.PagingInfo.fromJSON(e.pagingInfo):void 0,startTime:v(e.startTime)?Number(e.startTime):void 0,endTime:v(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,o;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=null!==(i=e.startTime)&&void 0!==i?i:void 0,s.endTime=null!==(o=e.endTime)&&void 0!==o?o:void 0,s}},t.HistoryResponse={encode(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.default.Writer.create();for(const t of e.messages)s.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 o.default.Reader?e:new o.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(s.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=>s.WakuMessage.fromJSON(e))):[],pagingInfo:v(e.pagingInfo)?t.PagingInfo.fromJSON(e.pagingInfo):void 0,error:v(e.error)?d(e.error):0}),toJSON(e){const r={};return e.messages?r.messages=e.messages.map((e=>e?s.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=h(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=>s.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]:o.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 o.default.Reader?e:new o.default.Reader(e);let i=void 0===r?n.len:n.pos+r;const s={requestId:"",query:void 0,response:void 0};for(;n.pos<i;){const e=n.uint32();switch(e>>>3){case 1:s.requestId=n.string();break;case 2:s.query=t.HistoryQuery.decode(n,n.uint32());break;case 3:s.response=t.HistoryResponse.decode(n,n.uint32());break;default:n.skipType(7&e)}}return s},fromJSON:e=>({requestId:v(e.requestId)?String(e.requestId):"",query:v(e.query)?t.HistoryQuery.fromJSON(e.query):void 0,response:v(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 b=y.btoa||(e=>y.Buffer.from(e,"binary").toString("base64"));function v(e){return null!==e&&void 0!==e}o.default.util.Long!==i.default&&(o.default.util.Long=i.default,o.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)),o=n(r(80886)),s=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 d(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 h(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=d,t.historyResponse_ErrorToJSON=h,t.Index={encode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.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 o.default.Reader?e:new o.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:v(e.digest)?m(e.digest):new Uint8Array,receivedTime:v(e.receivedTime)?i.default.fromString(e.receivedTime):i.default.ZERO,senderTime:v(e.senderTime)?i.default.fromString(e.senderTime):i.default.ZERO,pubsubTopic:v(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 b(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]:o.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 o.default.Reader?e:new o.default.Reader(e);let i=void 0===r?n.len:n.pos+r;const s=p();for(;n.pos<i;){const e=n.uint32();switch(e>>>3){case 1:s.pageSize=n.uint64();break;case 2:s.cursor=t.Index.decode(n,n.uint32());break;case 3:s.direction=n.int32();break;default:n.skipType(7&e)}}return s},fromJSON:e=>({pageSize:v(e.pageSize)?i.default.fromString(e.pageSize):i.default.UZERO,cursor:v(e.cursor)?t.Index.fromJSON(e.cursor):void 0,direction:v(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]:o.default.Writer.create();return""!==e.contentTopic&&t.uint32(10).string(e.contentTopic),t},decode(e,t){const r=e instanceof o.default.Reader?e:new o.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:v(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]:o.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 o.default.Reader?e:new o.default.Reader(e);let i=void 0===r?n.len:n.pos+r;const s={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:s.pubSubTopic=n.string();break;case 3:s.contentFilters.push(t.ContentFilter.decode(n,n.uint32()));break;case 4:s.pagingInfo=t.PagingInfo.decode(n,n.uint32());break;case 5:s.startTime=n.sint64();break;case 6:s.endTime=n.sint64();break;default:n.skipType(7&e)}}return s},fromJSON:e=>({pubSubTopic:v(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:v(e.pagingInfo)?t.PagingInfo.fromJSON(e.pagingInfo):void 0,startTime:v(e.startTime)?i.default.fromString(e.startTime):void 0,endTime:v(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 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=void 0!==e.startTime&&null!==e.startTime?i.default.fromValue(e.startTime):void 0,o.endTime=void 0!==e.endTime&&null!==e.endTime?i.default.fromValue(e.endTime):void 0,o}},t.HistoryResponse={encode(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.default.Writer.create();for(const t of e.messages)s.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 o.default.Reader?e:new o.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(s.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=>s.WakuMessage.fromJSON(e))):[],pagingInfo:v(e.pagingInfo)?t.PagingInfo.fromJSON(e.pagingInfo):void 0,error:v(e.error)?d(e.error):0}),toJSON(e){const r={};return e.messages?r.messages=e.messages.map((e=>e?s.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=h(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=>s.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]:o.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 o.default.Reader?e:new o.default.Reader(e);let i=void 0===r?n.len:n.pos+r;const s={requestId:"",query:void 0,response:void 0};for(;n.pos<i;){const e=n.uint32();switch(e>>>3){case 1:s.requestId=n.string();break;case 2:s.query=t.HistoryQuery.decode(n,n.uint32());break;case 3:s.response=t.HistoryResponse.decode(n,n.uint32());break;default:n.skipType(7&e)}}return s},fromJSON:e=>({requestId:v(e.requestId)?String(e.requestId):"",query:v(e.query)?t.HistoryQuery.fromJSON(e.query):void 0,response:v(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 b=y.btoa||(e=>y.Buffer.from(e,"binary").toString("base64"));function v(e){return null!==e&&void 0!==e}o.default.util.Long!==i.default&&(o.default.util.Long=i.default,o.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,o){for(var s=32767&t,a=t>>15;--o>=0;){var c=32767&this[e],u=this[e++]>>15,l=a*c+u*s;i=((c=s*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,o){for(;--o>=0;){var s=t*this[e++]+r[n]+i;i=Math.floor(s/67108864),r[n++]=67108863&s}return i},t=26):(r.prototype.am=function(e,t,r,n,i,o){for(var s=16383&t,a=t>>14;--o>=0;){var c=16383&this[e],u=this[e++]>>14,l=a*c+u*s;i=((c=s*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 o,s,a=new Array;for(o="0".charCodeAt(0),s=0;s<=9;++s)a[o++]=s;for(o="a".charCodeAt(0),s=10;s<36;++s)a[o++]=s;for(o="A".charCodeAt(0),s=10;s<36;++s)a[o++]=s;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 d(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 h(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 b(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 v(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function w(){}function E(e){return e}function _(e){this.r2=n(),this.q3=n(),r.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}h.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},h.prototype.revert=function(e){return e},h.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},h.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},h.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},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,o=!1,s=0;--i>=0;){var a=8==n?255&e[i]:u(e,i);a<0?"-"==e.charAt(i)&&(o=!0):(o=!1,0==s?this[this.t++]=a:s+n>this.DB?(this[this.t-1]|=(a&(1<<this.DB-s)-1)<<s,this[this.t++]=a>>this.DB-s):this[this.t-1]|=a<<s,(s+=n)>=this.DB&&(s-=this.DB))}8==n&&0!=(128&e[0])&&(this.s=-1,s>0&&(this[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),o&&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,o=(1<<i)-1,s=Math.floor(e/this.DB),a=this.s<<n&this.DM;for(r=this.t-1;r>=0;--r)t[r+s+1]=this[r]>>i|a,a=(this[r]&o)<<n;for(r=s-1;r>=0;--r)t[r]=0;t[s]=a,t.t=this.t+s+1,t.s=this.s,t.clamp()},r.prototype.rShiftTo=function(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var n=e%this.DB,i=this.DB-n,o=(1<<n)-1;t[0]=this[r]>>n;for(var s=r+1;s<this.t;++s)t[s-r-1]|=(this[s]&o)<<i,t[s-r]=this[s]>>n;n>0&&(t[this.t-r-1]|=(this.s&o)<<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(),o=n.t;for(t.t=o+i.t;--o>=0;)t[o]=0;for(o=0;o<i.t;++o)t[o+n.t]=n.am(0,i[o],t,o,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 o=e.abs();if(!(o.t<=0)){var s=this.abs();if(s.t<o.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-d(o[o.t-1]);l>0?(o.lShiftTo(l,a),s.lShiftTo(l,i)):(o.copyTo(a),s.copyTo(i));var h=a.t,f=a[h-1];if(0!=f){var p=f*(1<<this.F1)+(h>1?a[h-2]>>this.F2:0),y=this.FV/p,g=(1<<this.F1)/p,m=1<<this.F2,b=i.t,v=b-h,w=null==t?n():t;for(a.dlShiftTo(v,w),i.compareTo(w)>=0&&(i[i.t++]=1,i.subTo(w,i)),r.ONE.dlShiftTo(h,w),w.subTo(a,a);a.t<h;)a[a.t++]=0;for(;--v>=0;){var E=i[--b]==f?this.DM:Math.floor(i[b]*y+(i[b-1]+m)*g);if((i[b]+=a.am(0,E,i,v,0,h))<E)for(a.dlShiftTo(v,w),i.subTo(w,i);i[b]<--E;)i.subTo(w,i)}null!=t&&(i.drShiftTo(h,t),c!=u&&r.ZERO.subTo(t,t)),i.t=h,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(),o=n(),s=t.convert(this),a=d(e)-1;for(s.copyTo(i);--a>=0;)if(t.sqrTo(i,o),(e&1<<a)>0)t.mulTo(o,s,i);else{var c=i;i=o,o=c}return t.revert(i)},r.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<<t)-1,i=!1,o="",s=this.t,a=this.DB-s*this.DB%t;if(s-- >0)for(a<this.DB&&(r=this[s]>>a)>0&&(i=!0,o=c(r));s>=0;)a<t?(r=(this[s]&(1<<a)-1)<<t-a,r|=this[--s]>>(a+=this.DB-t)):(r=this[s]>>(a-=t)&n,a<=0&&(a+=this.DB,--s)),r>0&&(i=!0),i&&(o+=c(r));return i?o:"0"},r.prototype.negate=function(){var e=n();return r.ZERO.subTo(this,e),e},r.prototype.abs=function(){return this.s<0?this.negate():this},r.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this[r]-e[r]))return t;return 0},r.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+d(this[this.t-1]^this.s&this.DM)},r.prototype.mod=function(e){var t=n();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(r.ZERO)>0&&e.subTo(t,t),t},r.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new h(t):new 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)},_.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=n();return e.copyTo(t),this.reduce(t),t},_.prototype.revert=function(e){return e},_.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},_.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},_.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var S,I,A,R=[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],T=(1<<26)/R[R.length-1];function C(){var e;e=(new Date).getTime(),I[A++]^=255&e,I[A++]^=e>>8&255,I[A++]^=e>>16&255,I[A++]^=e>>24&255,A>=x&&(A-=x)}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),o=n(),s=n(),a="";for(this.divRemTo(i,o,s);o.signum()>0;)a=(r+s.intValue()).toString(e).substr(1)+a,o.divRemTo(i,o,s);return s.intValue().toString(e)+a},r.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var n=this.chunkSize(t),i=Math.pow(t,n),o=!1,s=0,a=0,c=0;c<e.length;++c){var l=u(e,c);l<0?"-"==e.charAt(c)&&0==this.signum()&&(o=!0):(a=t*a+l,++s>=n&&(this.dMultiply(i),this.dAddOffset(a,0),s=0,a=0))}s>0&&(this.dMultiply(Math.pow(t,s)),this.dAddOffset(a,0)),o&&r.ZERO.subTo(this,this)},r.prototype.fromNumber=function(e,t,n){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,n),this.testBit(e-1)||this.bitwiseTo(r.ONE.shiftLeft(e-1),y,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(r.ONE.shiftLeft(e-1),this);else{var i=new Array,o=7&e;i.length=1+(e>>3),t.nextBytes(i),o>0?i[0]&=(1<<o)-1:i[0]=0,this.fromString(i,256)}},r.prototype.bitwiseTo=function(e,t,r){var n,i,o=Math.min(e.t,this.t);for(n=0;n<o;++n)r[n]=t(this[n],e[n]);if(e.t<this.t){for(i=e.s&this.DM,n=o;n<this.t;++n)r[n]=t(this[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=o;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 o=t.shiftRight(i);(e=e+1>>1)>R.length&&(e=R.length);for(var s=n(),a=0;a<e;++a){s.fromInt(R[Math.floor(Math.random()*R.length)]);var c=s.modPow(o,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+b(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+=v(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,o=e.bitLength(),s=l(1);if(o<=0)return s;r=o<18?1:o<48?3:o<144?4:o<768?5:6,i=o<8?new h(t):t.isEven()?new _(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,b=e.t-1,v=!0,w=n();for(o=d(e[b])-1;b>=0;){for(o>=u?g=e[b]>>o-u&p:(g=(e[b]&(1<<o+1)-1)<<u-o,b>0&&(g|=e[b-1]>>this.DB+o-u)),c=r;0==(1&g);)g>>=1,--c;if((o-=c)<0&&(o+=this.DB,--b),v)a[g].copyTo(s),v=!1;else{for(;c>1;)i.sqrTo(s,w),i.sqrTo(w,s),c-=2;c>0?i.sqrTo(s,w):(m=s,s=w,w=m),i.mulTo(w,a[g],s)}for(;b>=0&&0==(e[b]&1<<o);)i.sqrTo(s,w),m=s,s=w,w=m,--o<0&&(o=this.DB-1,--b)}return i.revert(s)},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(),o=l(1),s=l(0),a=l(0),c=l(1);0!=n.signum();){for(;n.isEven();)n.rShiftTo(1,n),t?(o.isEven()&&s.isEven()||(o.addTo(this,o),s.subTo(e,s)),o.rShiftTo(1,o)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);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&&o.subTo(a,o),s.subTo(c,s)):(i.subTo(n,i),t&&a.subTo(o,a),c.subTo(s,c))}return 0!=i.compareTo(r.ONE)?r.ZERO:c.compareTo(e)>=0?c.subtract(e):c.signum()<0?(c.addTo(e,c),c.signum()<0?c.add(e):c):c},r.prototype.pow=function(e){return this.exp(e,new w)},r.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var i=t.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return t;for(i<o&&(o=i),o>0&&(t.rShiftTo(o,t),r.rShiftTo(o,r));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r},r.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r[0]<=R[R.length-1]){for(t=0;t<R.length;++t)if(r[0]==R[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<R.length;){for(var n=R[t],i=t+1;i<R.length&&n<T;)n*=R[i++];for(n=r.modInt(n);t<i;)if(n%R[t++]==0)return!1}return r.millerRabin(e)},r.prototype.square=function(){var e=n();return this.squareTo(e),e},r.prototype.Barrett=_,null==I){var P;if(I=new Array,A=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[A++]=k[P]}else if("Netscape"==navigator.appName&&navigator.appVersion<"5"){var O=window.crypto.random(32);for(P=0;P<O.length;++P)I[A++]=255&O.charCodeAt(P)}for(;A<x;)P=Math.floor(65536*Math.random()),I[A++]=P>>>8,I[A++]=255&P;A=0,C()}function N(){if(null==S){for(C(),(S=new B).init(I),A=0;A<I.length;++A)I[A]=0;A=0}return S.next()}function D(){}function B(){this.i=0,this.j=0,this.S=new Array}D.prototype.nextBytes=function(e){var t;for(t=0;t<e.length;++t)e[t]=N()},B.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},B.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 x=256;e.exports={default:r,BigInteger:r,SecureRandom:D}}).call(this)},44786:(e,t,r)=>{"use strict";const n=r(90190),{Multiaddr:i}=r(98719),o=r(18322),{EventEmitter:s}=r(47465),a=r(18392),c=Object.assign(a("libp2p:bootstrap"),{error:a("libp2p:bootstrap:error")});(e.exports=class extends s{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(!o.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 s=n.createFromB58String(r);try{this.emit("peer",{id:s,multiaddrs:[t]})}catch(a){c.error("Invalid bootstrap peer id",a)}}))}stop(){this._timer&&clearInterval(this._timer),this._timer=null}}).tag="bootstrap"},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(18605);const n=r(60392),{toString:i}=r(82051),{fromString:o}=r(46765);e.exports={createCipheriv:(e,t,r)=>{const s=n.cipher.createCipher("AES-CTR",i(t,"ascii"));return s.start({iv:i(r,"ascii")}),{update:e=>(s.update(n.util.createBuffer(i(e,"ascii"))),o(s.output.getBytes(),"ascii"))}},createDecipheriv:(e,t,r)=>{const s=n.cipher.createDecipher("AES-CTR",i(t,"ascii"));return s.start({iv:i(r,"ascii")}),{update:e=>(s.update(n.util.createBuffer(i(e,"ascii"))),o(s.output.getBytes(),"ascii"))}}}},94421:(e,t,r)=>{"use strict";const n=r(37075),i=r(16982);t.create=async function(e,t){const r=i(e),o=n.createCipheriv(r,e,t),s=n.createDecipheriv(r,e,t);return{encrypt:async e=>o.update(e),decrypt:async e=>s.update(e)}}},88279:(e,t,r)=>{"use strict";const{concat:n}=r(62110),{fromString:i}=r(46765),o=r(35288);e.exports={create:function(){let{algorithm:e="AES-GCM",nonceLength:t=12,keyLength:r=16,digest:s="SHA-256",saltLength:a=16,iterations:c=32767}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const u=o.get();async function l(o,l){const d=u.getRandomValues(new Uint8Array(a)),h=u.getRandomValues(new Uint8Array(t)),f={name:e,iv:h},p={name:"PBKDF2",salt:d,iterations:c,hash:{name:s}},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,o);return n([d,f.iv,new Uint8Array(m)])}async function d(n,o){const l=n.slice(0,a),d=n.slice(a,a+t),h=n.slice(a+t),f={name:e,iv:d},p={name:"PBKDF2",salt:l,iterations:c,hash:{name:s}},y=await u.subtle.importKey("raw",i(o),{name:"PBKDF2"},!1,["deriveKey","deriveBits"]),g=await u.subtle.deriveKey(p,y,{name:e,length:r},!0,["decrypt"]),m=await u.subtle.decrypt(f,g,h);return new Uint8Array(m)}return r*=8,{encrypt:l,decrypt:d}}}},59938:(e,t,r)=>{"use strict";const n=r(35288),i=r(42830),o={SHA1:"SHA-1",SHA256:"SHA-256",SHA512:"SHA-512"};t.create=async function(e,t){const r=o[e],s=await n.get().subtle.importKey("raw",t,{name:"HMAC",hash:{name:r}},!1,["sign"]);return{digest:async e=>(async(e,t)=>{const r=await n.get().subtle.sign({name:"HMAC"},e,t);return new Uint8Array(r,r.byteOffset,r.byteLength)})(s,e),length:i[e]}}},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),o=r(36552);t.aes=i,t.hmac=n,t.keys=o,t.randomBytes=r(31158),t.pbkdf2=r(68037)},77129:(e,t,r)=>{"use strict";const n=r(67963),i=r(35288),{base64urlToBuffer:o}=r(12545),s=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){s(Object.keys(l),e);const t=await i.get().subtle.generateKey({name:"ECDH",namedCurve:e},!0,["deriveBits"]);return{key:h(await i.get().subtle.exportKey("jwk",t.publicKey)),genSharedKey:async(r,n)=>{let o;o=n?await i.get().subtle.importKey("jwk",p(e,n),{name:"ECDH",namedCurve:e},!1,["deriveBits"]):t.privateKey;const s=[await i.get().subtle.importKey("jwk",f(e,r),{name:"ECDH",namedCurve:e},!1,[]),o],a=await i.get().subtle.deriveBits({name:"ECDH",namedCurve:e,public:s[0]},s[1],l[e]);return new Uint8Array(a,a.byteOffset,a.byteLength)}}};const d={"P-256":32,"P-384":48,"P-521":66};function h(e){const t=d[e.crv];return c([Uint8Array.from([4]),o(e.x,t),o(e.y,t)],1+2*t)}function f(e,t){const r=d[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:o}=r(19400),{base58btc:s}=r(86898),{identity:a}=r(60173),c=r(66556),u=r(67796),l=r(43437);class d{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 o.digest(this.bytes);return e}}class h{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 d(this._publicKey)}marshal(){return this._key}get bytes(){return u.PrivateKey.encode({Type:u.KeyType.Ed25519,Data:this.marshal()}).finish()}equals(e){return i(this.bytes,e.bytes)}async hash(){const{bytes:e}=await o.digest(this.bytes);return e}async id(){const e=await a.digest(this.public.bytes);return s.encode(e.bytes).substring(1)}async export(e){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:d,Ed25519PrivateKey:h,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 h(t,r)}const t=(e=f(e,c.privateKeyLength)).slice(0,c.privateKeyLength),r=e.slice(c.publicKeyLength);return new h(t,r)},unmarshalEd25519PublicKey:function(e){return e=f(e,c.publicKeyLength),new d(e)},generateKeyPair:async function(){const{privateKey:e,publicKey:t}=await c.generateKey();return new h(e,t)},generateKeyPairFromSeed:async function(e){const{privateKey:t,publicKey:r}=await c.generateKeyFromSeed(e);return new h(t,r)}}},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(),o=await r.encrypt(e,t);return n.encode(o)}}},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),o=i.create();return await o.decrypt(r,t)}}},36552:(e,t,r)=>{"use strict";const n=r(67796);r(85049),r(29835);const i=r(60392),o=r(67963),{fromString:s}=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 d(e){const t=c[e.toLowerCase()];if(!t){const t=Object.keys(c).join(" / ");throw o(new Error("invalid or unsupported key type ".concat(e,". Must be ").concat(t)),"ERR_UNSUPPORTED_KEY_TYPE")}return t}const h=async e=>{const t=n.PrivateKey.decode(e),r=t.Data;switch(t.Type){case n.KeyType.RSA:return c.rsa.unmarshalRsaPrivateKey(r);case n.KeyType.Ed25519:return c.ed25519.unmarshalEd25519PrivateKey(r);case n.KeyType.Secp256k1:if(c.secp256k1)return c.secp256k1.unmarshalSecp256k1PrivateKey(r);throw o(new Error(u),l);default:d(t.Type)}};e.exports={supportedKeys:c,keysPBM:n,keyStretcher:r(52936),generateEphemeralKeyPair:r(89097),generateKeyPair:async(e,t)=>d(e).generateKeyPair(t),generateKeyPairFromSeed:async(e,t,r)=>{const n=d(e);if("ed25519"!==e.toLowerCase())throw o(new Error("Seed key derivation is unimplemented for RSA or secp256k1"),"ERR_UNSUPPORTED_KEY_DERIVATION_TYPE");return n.generateKeyPairFromSeed(t,r)},unmarshalPublicKey:e=>{const t=n.PublicKey.decode(e),r=t.Data;switch(t.Type){case n.KeyType.RSA:return c.rsa.unmarshalRsaPublicKey(r);case n.KeyType.Ed25519:return c.ed25519.unmarshalEd25519PublicKey(r);case n.KeyType.Secp256k1:if(c.secp256k1)return c.secp256k1.unmarshalSecp256k1PublicKey(r);throw o(new Error(u),l);default:d(t.Type)}},marshalPublicKey:(e,t)=>(d(t=(t||"rsa").toLowerCase()),e.bytes),unmarshalPrivateKey:h,marshalPrivateKey:(e,t)=>(d(t=(t||"rsa").toLowerCase()),e.bytes),import:async(e,t)=>{try{const r=await a.import(e,t);return h(r)}catch(u){}const r=i.pki.decryptRsaPrivateKey(e,t);if(null===r)throw o(new Error("Cannot read the key, most likely the password is wrong or not a RSA key"),"ERR_CANNOT_DECRYPT_PEM");let n=i.asn1.toDer(i.pki.privateKeyToAsn1(r));return n=s(n.getBytes(),"ascii"),c.rsa.unmarshalRsaPrivateKey(n)}}},15025:(e,t,r)=>{"use strict";r(25493);const n=r(60392),{base64urlToBigInteger:i}=r(12545);function o(e,t){return t.map((t=>i(e[t])))}e.exports={jwk2pub:function(e){return n.pki.setRsaPublicKey(...o(e,["n","e"]))},jwk2priv:function(e){return n.pki.setRsaPrivateKey(...o(e,["n","e","d","p","q","dp","dq","qi"]))}}},52936:(e,t,r)=>{"use strict";const n=r(67963),{concat:i}=r(62110),{fromString:o}=r(46765),s=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,d=o("key expansion"),h=2*(l+u+20),f=await s.create(t,r);let p=await f.digest(d);const y=[];let g=0;for(;g<h;){const e=await f.digest(i([p,d]));let t=e.length;g+t>h&&(t=h-g),y.push(e),g+=t,p=await f.digest(p)}const m=h/2,b=i(y),v=b.slice(0,m),w=b.slice(m,h),E=e=>({iv:e.slice(0,l),cipherKey:e.slice(l,l+u),macKey:e.slice(l+u)});return{k1:E(v),k2:E(w)}}},67796:(e,t,r)=>{"use strict";var n=r(80886),i=n.Reader,o=n.Writer,s=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=s.newBuffer([]),e.encode=function(e,t){return t||(t=o.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 o=e.uint32();switch(o>>>3){case 1:n.Type=e.int32();break;case 2:n.Data=e.bytes();break;default:e.skipType(7&o)}}if(!n.hasOwnProperty("Type"))throw s.ProtocolError("missing required 'Type'",{instance:n});if(!n.hasOwnProperty("Data"))throw s.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?s.base64.decode(e.Data,t.Data=s.newBuffer(s.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=s.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?s.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=s.newBuffer([]),e.encode=function(e,t){return t||(t=o.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 o=e.uint32();switch(o>>>3){case 1:n.Type=e.int32();break;case 2:n.Data=e.bytes();break;default:e.skipType(7&o)}}if(!n.hasOwnProperty("Type"))throw s.ProtocolError("missing required 'Type'",{instance:n});if(!n.hasOwnProperty("Data"))throw s.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?s.base64.decode(e.Data,t.Data=s.newBuffer(s.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=s.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?s.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:o}=r(82051),{fromString:s}=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(o(Uint8Array.from(r),"ascii"),i);return s(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:o}=r(98779),{toString:s}=r(82051);r(34770);const a=r(60392),c=r(73545),u=r(67796),l=r(43437);class d{constructor(e){this._key=e}async verify(e,t){return c.hashAndVerify(this._key,t,e)}marshal(){return c.utils.jwkToPkix(this._key)}get bytes(){return u.PublicKey.encode({Type:u.KeyType.RSA,Data:this.marshal()}).finish()}encrypt(e){return c.encrypt(this._key,e)}equals(e){return o(this.bytes,e.bytes)}async hash(){const{bytes:e}=await n.digest(this.bytes);return e}}class h{constructor(e,t){this._key=e,this._publicKey=t}genSecret(){return c.getRandomValues(16)}async sign(e){return c.hashAndSign(this._key,e)}get public(){if(!this._publicKey)throw i(new Error("public key not provided"),"ERR_PUBKEY_NOT_PROVIDED");return new d(this._publicKey)}decrypt(e){return c.decrypt(this._key,e)}marshal(){return c.utils.jwkToPkcs1(this._key)}get bytes(){return u.PrivateKey.encode({Type:u.KeyType.RSA,Data:this.marshal()}).finish()}equals(e){return o(this.bytes,e.bytes)}async hash(){const{bytes:e}=await n.digest(this.bytes);return e}async id(){const e=await this.public.hash();return s(e,"base58btc")}async export(e){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:d,RsaPrivateKey:h,unmarshalRsaPublicKey:function(e){const t=c.utils.pkixToJwk(e);return new d(t)},unmarshalRsaPrivateKey:async function(e){const t=c.utils.pkcs1ToJwk(e),r=await c.unmarshalPrivateKey(t);return new h(r.privateKey,r.publicKey)},generateKeyPair:async function(e){const t=await c.generateKey(e);return new h(t.privateKey,t.publicKey)},fromJwk:async function(e){const t=await c.unmarshalPrivateKey(e);return new h(t.privateKey,t.publicKey)}}},27367:(e,t,r)=>{"use strict";r(85049),r(25493);const n=r(60392),{bigIntegerToUintBase64url:i,base64urlToBigInteger:o}=r(12545),{fromString:s}=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:o(e.n),e:o(e.e),d:o(e.d),p:o(e.p),q:o(e.q),dP:o(e.dp),dQ:o(e.dq),qInv:o(e.qi)});return s(n.asn1.toDer(t).getBytes(),"ascii")},t.pkixToJwk=function(e){const t=n.asn1.fromDer(a(e,"ascii")),r=n.pki.publicKeyFromAsn1(t);return{kty:"RSA",n:i(r.n),e:i(r.e),alg:"RS256",kid:"2011-04-29"}},t.jwkToPkix=function(e){const t=n.pki.publicKeyToAsn1({n:o(e.n),e:o(e.e)});return s(n.asn1.toDer(t).getBytes(),"ascii")}},93154:(e,t,r)=>{"use strict";const{sha256:n}=r(19400),i=r(67963),{equals:o}=r(98779),{toString:s}=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 o(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 o(this.bytes,e.bytes)}async hash(){const{bytes:e}=await n.digest(this.bytes);return e}async id(){const e=await this.public.hash();return s(e,"base58btc")}async export(e){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:o}=r(19400);e.exports=()=>({generateKey:function(){return i.utils.randomPrivateKey()},privateKeyLength:32,hashAndSign:async function(e,t){const{digest:r}=await o.digest(t);try{return await i.sign(r,e)}catch(s){throw n(s,"ERR_INVALID_INPUT")}},hashAndVerify:async function(e,t,r){try{const{digest:n}=await o.digest(r);return i.verify(t,n,e)}catch(s){throw n(s,"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(16019),i=r(63877),o=r(67963),s={sha1:"sha1","sha2-256":"sha256","sha2-512":"sha512"};e.exports=function(e,t,r,a,c){const u=s[c];if(!u){const e=Object.keys(s).join(" / ");throw o(new Error("Hash '".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(63877),r(3055);const n=r(60392),{fromString:i}=r(46765),{toString:o}=r(82051),{concat:s}=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=s([new Uint8Array(t-r.length),r])}return o(r,"base64url")},t.base64urlToBigInteger=e=>{const r=t.base64urlToBuffer(e);return new n.jsbn.BigInteger(o(r,"base16"),16)},t.base64urlToBuffer=(e,t)=>{let r=i(e,"base64urlpad");if(null!=t){if(r.length>t)throw new Error("byte array longer than desired length");r=s([new Uint8Array(t-r.length),r])}return r}},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 o=e.topics.get(t);if(!o)return new Set;let s=[];return o.forEach((t=>{const r=e.peers.get(t);r&&n.hasGossipProtocol(r.protocol)&&i(t)&&s.push(t)})),s=n.shuffle(s),r>0&&s.length>r&&(s=s.slice(0,r)),new Set(s)}},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}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Heartbeat=void 0;const s=o(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)}),s.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:o}=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},d=new Map,h=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(((o,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),o.delete(e);const t=h.get(e);t?t.push(u):h.set(e,[u])},y=e=>{this.gossipsub.log("HEARTBEAT: Add mesh link to %s in %s",e,u),this.gossipsub.score.graft(e,u),o.add(e);const t=d.get(e);t?t.push(u):d.set(e,[u])};if(o.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))})),o.size<t){const t=this.gossipsub.backoff.get(u),r=e-o.size;a.getGossipPeers(this.gossipsub,u,r,(e=>!o.has(e)&&!this.gossipsub.direct.has(e)&&(!t||!t.has(e))&&l(e)>=0)).forEach(y)}if(o.size>r){let t=Array.from(o);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(o.size>=t){let e=0;if(o.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=>!o.has(e)&&!this.gossipsub.direct.has(e)&&(!r||!r.has(e))&&l(e)>=0)).forEach(y)}}if(this.gossipsub.heartbeatTicks%s.GossipsubOpportunisticGraftTicks===0&&o.size>1){const e=Array.from(o).sort(((e,t)=>l(e)-l(t))),t=Math.floor(o.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,s.GossipsubOpportunisticGraftPeers,(t=>o.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,o)}));const p=this.gossipsub._now();this.gossipsub.lastpub.forEach(((e,t)=>{e+o<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(d,h,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}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t},s=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(t){o(t)}}function a(e){try{c(n.throw(e))}catch(t){o(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(s,a)}c((n=n.apply(e,t||[])).next())}))};const a=o(r(4782)),c=r(45075),u=r(83519),l=o(r(66759)),d=r(93234),h=r(60622),f=r(53357),p=r(63789),y=r(61390),g=r(46561),m=r(90190),b=r(76869),v=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 d.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 s(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 s(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 o=f.createGossipRpc(n,{iwant:r,prune:i});this._sendRpc(e,o)}))}_processRpcMessage(e){const t=Object.create(null,{_processRpcMessage:{get:()=>super._processRpcMessage}});return s(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<v.ACCEPT_FROM_WHITELIST_MAX_MESSAGES&&r.acceptUntil>=t)return r.messagesAccepted+=1,!0;const n=this.score.score(e);return n>=v.ACCEPT_FROM_WHITELIST_THRESHOLD_SCORE?this.acceptFromWhitelist.set(e,{messagesAccepted:0,acceptUntil:t+v.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 s(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 o=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)||o.set(t,e)}))})),!o.size)return[];let s=o.size;s+i>l.GossipsubMaxIHaveLength&&(s=l.GossipsubMaxIHaveLength-i),this.log("IHAVE: Asking for %d out of %d messages from %s",s,o.size,e);let a=Array.from(o.values());return f.shuffle(a),a=a.slice(0,s),this.iasked.set(e,i+s),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,o]=this.messageCache.getForPeer(r,e);i&&(o>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 s(this,void 0,void 0,(function*(){const r=[],n=this.score.score(e),i=this._now();let o=this._options.doPX;return t.forEach((t=>{let{topicID:s}=t;var a;if(!s)return;const c=this.mesh.get(s);if(!c)return void(o=!1);if(c.has(e))return;if(this.direct.has(e))return this.log("GRAFT: ignoring request from direct peer %s",e),r.push(s),void(o=!1);const u=null===(a=this.backoff.get(s))||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),o=!1;const t=u+l.GossipsubGraftFloodThreshold-l.GossipsubPruneBackoff;return i<t&&this.score.addPenalty(e,1),this._addBackoff(e,s),void r.push(s)}return n<0?(this.log("GRAFT: ignoring peer %s with negative score: score=%d, topic=%s",e,n,s),r.push(s),o=!1,void this._addBackoff(e,s)):c.size>=this._options.Dhi&&!this.outbound.get(e)?(r.push(s),void this._addBackoff(e,s)):(this.log("GRAFT: Add mesh link from %s in %s",e,s),this.score.graft(e,s),void c.add(e))})),r.length?Promise.all(r.map((t=>this._makePrune(e,t,o)))):[]}))}_handlePrune(e,t){const r=this.score.score(e);t.forEach((t=>{let{topicID:n,backoff:i,peers:o}=t;if(!n)return;const s=this.mesh.get(n);if(s&&(this.log("PRUNE: Remove mesh link to %s in %s",e,n),this.score.prune(e,n),s.delete(e),"number"===typeof i&&i>0?this._doAddBackoff(e,n,1e3*i):this._addBackoff(e,n),o&&o.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(o)}}))}_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 s(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=>s(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 b.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 s(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 s(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&&h.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=h.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 s(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 s(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=h.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 s(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 s(this,void 0,void 0,(function*(){const n=this._options.doPX;for(const[i,o]of e){const e=o.map((e=>({topicID:e})));let s=[];const a=t.get(i);a&&(s=yield Promise.all(a.map((e=>this._makePrune(i,e,n&&!r.get(i))))),t.delete(i));const c=f.createGossipRpc([],{graft:e,prune:s});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))))),o=f.createGossipRpc([],{prune:t});this._sendRpc(e,o)}}))}_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 o=this._options.Dlazy;const s=l.GossipsubGossipFactor*n.length;s>o&&(o=s),o>n.length?o=n.length:f.shuffle(n),n.slice(0,o).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 s(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=h.getGossipPeers(this,t,l.GossipsubPrunePeers,(t=>t!==e&&this.score.score(t)>=0)),o=yield Promise.all(Array.from(i).map((e=>s(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:o,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,o){function s(e){try{c(n.next(e))}catch(t){o(t)}}function a(e){try{c(n.throw(e))}catch(t){o(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(s,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,o;i=[r(80886)],void 0===(o="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 o(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 s;return o.prototype.subscriptions=n.emptyArray,o.prototype.msgs=n.emptyArray,o.prototype.control=null,Object.defineProperty(o.prototype,"_control",{get:n.oneOfGetter(s=["control"]),set:n.oneOfSetter(s)}),o.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},o.decode=function(e,r){e instanceof t||(e=t.create(e));for(var n=void 0===r?e.len:e.pos+r,o=new i.RPC;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:o.subscriptions&&o.subscriptions.length||(o.subscriptions=[]),o.subscriptions.push(i.RPC.SubOpts.decode(e,e.uint32()));break;case 2:o.msgs&&o.msgs.length||(o.msgs=[]),o.msgs.push(i.RPC.Message.decode(e,e.uint32()));break;case 3:o.control=i.RPC.ControlMessage.decode(e,e.uint32());break;default:e.skipType(7&s)}}return o},o.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},o.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},o.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},o.SubOpts=function(){function o(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 s;return o.prototype.subscribe=null,o.prototype.topicID=null,Object.defineProperty(o.prototype,"_subscribe",{get:n.oneOfGetter(s=["subscribe"]),set:n.oneOfSetter(s)}),Object.defineProperty(o.prototype,"_topicID",{get:n.oneOfGetter(s=["topicID"]),set:n.oneOfSetter(s)}),o.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},o.decode=function(e,r){e instanceof t||(e=t.create(e));for(var n=void 0===r?e.len:e.pos+r,o=new i.RPC.SubOpts;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:o.subscribe=e.bool();break;case 2:o.topicID=e.string();break;default:e.skipType(7&s)}}return o},o.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},o.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},o.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},o}(),o.Message=function(){function o(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 s;return o.prototype.from=null,o.prototype.data=null,o.prototype.seqno=null,o.prototype.topicIDs=n.emptyArray,o.prototype.signature=null,o.prototype.key=null,Object.defineProperty(o.prototype,"_from",{get:n.oneOfGetter(s=["from"]),set:n.oneOfSetter(s)}),Object.defineProperty(o.prototype,"_data",{get:n.oneOfGetter(s=["data"]),set:n.oneOfSetter(s)}),Object.defineProperty(o.prototype,"_seqno",{get:n.oneOfGetter(s=["seqno"]),set:n.oneOfSetter(s)}),Object.defineProperty(o.prototype,"_signature",{get:n.oneOfGetter(s=["signature"]),set:n.oneOfSetter(s)}),Object.defineProperty(o.prototype,"_key",{get:n.oneOfGetter(s=["key"]),set:n.oneOfSetter(s)}),o.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},o.decode=function(e,r){e instanceof t||(e=t.create(e));for(var n=void 0===r?e.len:e.pos+r,o=new i.RPC.Message;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:o.from=e.bytes();break;case 2:o.data=e.bytes();break;case 3:o.seqno=e.bytes();break;case 4:o.topicIDs&&o.topicIDs.length||(o.topicIDs=[]),o.topicIDs.push(e.string());break;case 5:o.signature=e.bytes();break;case 6:o.key=e.bytes();break;default:e.skipType(7&s)}}return o},o.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},o.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},o.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},o}(),o.ControlMessage=function(){function o(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 o.prototype.ihave=n.emptyArray,o.prototype.iwant=n.emptyArray,o.prototype.graft=n.emptyArray,o.prototype.prune=n.emptyArray,o.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},o.decode=function(e,r){e instanceof t||(e=t.create(e));for(var n=void 0===r?e.len:e.pos+r,o=new i.RPC.ControlMessage;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:o.ihave&&o.ihave.length||(o.ihave=[]),o.ihave.push(i.RPC.ControlIHave.decode(e,e.uint32()));break;case 2:o.iwant&&o.iwant.length||(o.iwant=[]),o.iwant.push(i.RPC.ControlIWant.decode(e,e.uint32()));break;case 3:o.graft&&o.graft.length||(o.graft=[]),o.graft.push(i.RPC.ControlGraft.decode(e,e.uint32()));break;case 4:o.prune&&o.prune.length||(o.prune=[]),o.prune.push(i.RPC.ControlPrune.decode(e,e.uint32()));break;default:e.skipType(7&s)}}return o},o.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},o.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},o.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},o}(),o.ControlIHave=function(){function o(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 s;return o.prototype.topicID=null,o.prototype.messageIDs=n.emptyArray,Object.defineProperty(o.prototype,"_topicID",{get:n.oneOfGetter(s=["topicID"]),set:n.oneOfSetter(s)}),o.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},o.decode=function(e,r){e instanceof t||(e=t.create(e));for(var n=void 0===r?e.len:e.pos+r,o=new i.RPC.ControlIHave;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:o.topicID=e.string();break;case 2:o.messageIDs&&o.messageIDs.length||(o.messageIDs=[]),o.messageIDs.push(e.bytes());break;default:e.skipType(7&s)}}return o},o.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},o.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},o.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},o}(),o.ControlIWant=function(){function o(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 o.prototype.messageIDs=n.emptyArray,o.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},o.decode=function(e,r){e instanceof t||(e=t.create(e));for(var n=void 0===r?e.len:e.pos+r,o=new i.RPC.ControlIWant;e.pos<n;){var s=e.uint32();s>>>3===1?(o.messageIDs&&o.messageIDs.length||(o.messageIDs=[]),o.messageIDs.push(e.bytes())):e.skipType(7&s)}return o},o.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},o.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},o.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},o}(),o.ControlGraft=function(){function o(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 s;return o.prototype.topicID=null,Object.defineProperty(o.prototype,"_topicID",{get:n.oneOfGetter(s=["topicID"]),set:n.oneOfSetter(s)}),o.encode=function(e,t){return t||(t=r.create()),null!=e.topicID&&Object.hasOwnProperty.call(e,"topicID")&&t.uint32(10).string(e.topicID),t},o.decode=function(e,r){e instanceof t||(e=t.create(e));for(var n=void 0===r?e.len:e.pos+r,o=new i.RPC.ControlGraft;e.pos<n;){var s=e.uint32();s>>>3===1?o.topicID=e.string():e.skipType(7&s)}return o},o.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},o.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},o.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},o}(),o.ControlPrune=function(){function o(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 s;return o.prototype.topicID=null,o.prototype.peers=n.emptyArray,o.prototype.backoff=null,Object.defineProperty(o.prototype,"_topicID",{get:n.oneOfGetter(s=["topicID"]),set:n.oneOfSetter(s)}),Object.defineProperty(o.prototype,"_backoff",{get:n.oneOfGetter(s=["backoff"]),set:n.oneOfSetter(s)}),o.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},o.decode=function(e,r){e instanceof t||(e=t.create(e));for(var n=void 0===r?e.len:e.pos+r,o=new i.RPC.ControlPrune;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:o.topicID=e.string();break;case 2:o.peers&&o.peers.length||(o.peers=[]),o.peers.push(i.RPC.PeerInfo.decode(e,e.uint32()));break;case 3:o.backoff=e.uint64();break;default:e.skipType(7&s)}}return o},o.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},o.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 o=0;o<e.peers.length;++o)r.peers[o]=i.RPC.PeerInfo.toObject(e.peers[o],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},o.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},o}(),o.PeerInfo=function(){function o(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 s;return o.prototype.peerID=null,o.prototype.signedPeerRecord=null,Object.defineProperty(o.prototype,"_peerID",{get:n.oneOfGetter(s=["peerID"]),set:n.oneOfSetter(s)}),Object.defineProperty(o.prototype,"_signedPeerRecord",{get:n.oneOfGetter(s=["signedPeerRecord"]),set:n.oneOfSetter(s)}),o.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},o.decode=function(e,r){e instanceof t||(e=t.create(e));for(var n=void 0===r?e.len:e.pos+r,o=new i.RPC.PeerInfo;e.pos<n;){var s=e.uint32();switch(s>>>3){case 1:o.peerID=e.bytes();break;case 2:o.signedPeerRecord=e.bytes();break;default:e.skipType(7&s)}}return o},o.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},o.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},o.prototype.toJSON=function(){return this.constructor.toObject(this,e.util.toJSONOptions)},o}(),o}(),i})?n.apply(t,i):n)||(e.exports=o)},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 o=r.topics[t];if(!o)return;let s=0;if(n.inMesh){let e=n.meshTime/o.timeInMeshQuantum;e>o.timeInMeshCap&&(e=o.timeInMeshCap),s+=e*o.timeInMeshWeight}if(s+=n.firstMessageDeliveries*o.firstMessageDeliveriesWeight,n.meshMessageDeliveriesActive&&n.meshMessageDeliveries<o.meshMessageDeliveriesThreshold){const e=o.meshMessageDeliveriesThreshold-n.meshMessageDeliveries;s+=e*e*o.meshMessageDeliveriesWeight}s+=n.meshFailurePenalty*o.meshFailurePenaltyWeight;s+=n.invalidMessageDeliveries*n.invalidMessageDeliveries*o.invalidMessageDeliveriesWeight,i+=s*o.topicWeight})),r.topicScoreCap>0&&i>r.topicScoreCap&&(i=r.topicScoreCap);const o=r.appSpecificScore(e);i+=o*r.appSpecificWeight,t.ips.forEach((e=>{if(r.IPColocationFactorWhitelist.has(e))return;const t=n.get(e),o=t?t.size:0;if(o>r.IPColocationFactorThreshold){const e=o-r.IPColocationFactorThreshold;i+=e*e*r.IPColocationFactorWeight}}));const s=t.behaviourPenalty*t.behaviourPenalty;return i+=s*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),o=n(r(68718));var s;!function(e){e[e.unknown=0]="unknown",e[e.valid=1]="valid",e[e.invalid=2]="invalid",e[e.ignored=3]="ignored"}(s=t.DeliveryRecordStatus||(t.DeliveryRecordStatus={}));t.MessageDeliveries=class{constructor(){this.records=new Map,this.queue=new o.default}ensureRecord(e){let t=this.records.get(e);if(t)return t;t={status:s.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 o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.assign(Object.assign({},t.defaultTopicScoreParams),e)}function s(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]=o(n),e}),{}):{}})},t.createTopicScoreParams=o,t.validatePeerScoreParams=function(e){for(const[r,o]of Object.entries(e.topics))try{s(o)}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=s},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,o){function s(e){try{c(n.next(e))}catch(t){o(t)}}function a(e){try{c(n.throw(e))}catch(t){o(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(s,a)}c((n=n.apply(e,t||[])).next())}))},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.PeerScore=void 0;const o=r(7507),s=r(88338),a=r(51338),c=r(41838),u=r(66759),l=i(r(90190)),d=r(18392),h=r(40963),{ERR_INVALID_SIGNATURE:f,ERR_MISSING_SIGNATURE:p}=h.codes,y=d("libp2p:gossipsub:score");t.PeerScore=class{constructor(e,t){o.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 o=this.params.topics[n];o&&(i.firstMessageDeliveries*=o.firstMessageDeliveriesDecay,i.firstMessageDeliveries<t&&(i.firstMessageDeliveries=0),i.meshMessageDeliveries*=o.meshMessageDeliveriesDecay,i.meshMessageDeliveries<t&&(i.meshMessageDeliveries=0),i.meshFailurePenalty*=o.meshFailurePenaltyDecay,i.meshFailurePenalty<t&&(i.meshFailurePenalty=0),i.invalidMessageDeliveries*=o.invalidMessageDeliveriesDecay,i.invalidMessageDeliveries<t&&(i.invalidMessageDeliveries=0),i.inMesh&&(i.meshTime=e-i.graftTime,i.meshTime>o.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:o}=n;return o>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=s.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=s.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=s.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=s.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=s.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=s.ensureTopicStats(e,n,this.params);if(!t)return;if(!t.inMesh)return;const o=this.params.topics[e];if(r&&i>r+o.meshMessageDeliveriesWindow)return;const a=o.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,o){function s(e){try{c(n.next(e))}catch(t){o(t)}}function a(e){try{c(n.throw(e))}catch(t){o(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(s,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.IWantTracer=void 0;const i=r(66759),o=r(53357),s=r(40963),{ERR_INVALID_SIGNATURE:a,ERR_MISSING_SIGNATURE:c}=s.codes;t.IWantTracer=class{constructor(){this.promises=new Map}addPromise(e,t){const r=t[Math.floor(Math.random()*t.length)],n=o.messageIdToString(r);let s=this.promises.get(n);s||(s=new Map,this.promises.set(n,s)),s.has(e)||s.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),o=r(67963),{OPEN:s,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:d,stat:h}=e;!function(e,t,r,s,a,c,u){if(e&&!i.isMultiaddr(e))throw o(new Error("localAddr must be an instance of multiaddr"),"ERR_INVALID_PARAMETERS");if(!n.isPeerId(t))throw o(new Error("localPeer must be an instance of peer-id"),"ERR_INVALID_PARAMETERS");if(!n.isPeerId(r))throw o(new Error("remotePeer must be an instance of peer-id"),"ERR_INVALID_PARAMETERS");if("function"!==typeof s)throw o(new Error("new stream must be a function"),"ERR_INVALID_PARAMETERS");if("function"!==typeof a)throw o(new Error("close must be a function"),"ERR_INVALID_PARAMETERS");if("function"!==typeof c)throw o(new Error("getStreams must be a function"),"ERR_INVALID_PARAMETERS");if(!u)throw o(new Error("connection metadata object must be provided"),"ERR_INVALID_PARAMETERS");if("inbound"!==u.direction&&"outbound"!==u.direction)throw o(new Error('direction must be "inbound" or "outbound"'),"ERR_INVALID_PARAMETERS");if(!u.timeline)throw o(new Error("connection timeline object must be provided in the stat object"),"ERR_INVALID_PARAMETERS");if(!u.timeline.open)throw o(new Error("connection open timestamp must be provided"),"ERR_INVALID_PARAMETERS");if(!u.timeline.upgraded)throw o(new Error("connection upgraded timestamp must be provided"),"ERR_INVALID_PARAMETERS")}(t,a,c,u,l,d,h),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={...h,status:s},this._newStream=u,this._close=l,this._getStreams=d,this.registry=new Map,this.tags=[]}get[Symbol.toStringTag](){return"Connection"}get[u](){return!0}static isConnection(e){return Boolean(e&&e[u])}get stat(){return this._stat}get streams(){return this._getStreams()}async newStream(e){if(this.stat.status===a)throw o(new Error("the connection is being closed"),"ERR_CONNECTION_BEING_CLOSED");if(this.stat.status===c)throw o(new Error("the connection is closed"),"ERR_CONNECTION_CLOSED");Array.isArray(e)||(e=[e]);const{stream:t,protocol:r}=await this._newStream(e);return this.addStream(t,{protocol:r}),{stream:t,protocol:r}}addStream(e,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),o=r(67963),{pipe:s}=r(79023),{default:a}=r(12906),c=r(471),{codes:u}=r(40963),{RPC:l}=r(23928),d=r(75776),{SignaturePolicy:h}=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:s=h.StrictSign,canRelayMessage:c=!1,emitSelf:l=!1,messageProcessingConcurrency:d=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,!h[s])throw o(new Error("Invalid global signature policy"),u.ERR_INVALID_SIGNATURE_POLICY);this.globalSignaturePolicy=s,this.canRelayMessage=c,this.emitSelf=l,this.topicValidators=new Map,this.queue=new a({concurrency:d}),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,o=i.toB58String(),s=this._addPeer(i,t),a=s.attachInboundStream(r);this._processMessages(o,a,s)}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 d({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 s(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 h.StrictSign:return f.msgId(e.from,e.seqno);case h.StrictNoSign:return f.noSignMsgId(e.data);default:throw o(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 h.StrictNoSign:if(e.from)throw o(new Error("StrictNoSigning: from should not be present"),u.ERR_UNEXPECTED_FROM);if(e.signature)throw o(new Error("StrictNoSigning: signature should not be present"),u.ERR_UNEXPECTED_SIGNATURE);if(e.key)throw o(new Error("StrictNoSigning: key should not be present"),u.ERR_UNEXPECTED_KEY);if(e.seqno)throw o(new Error("StrictNoSigning: seqno should not be present"),u.ERR_UNEXPECTED_SEQNO);break;case h.StrictSign:if(!e.signature)throw o(new Error("StrictSigning: Signing required and no signature was present"),u.ERR_MISSING_SIGNATURE);if(!e.seqno)throw o(new Error("StrictSigning: Signing required and no seqno was present"),u.ERR_MISSING_SEQNO);if(!await y(e))throw o(new Error("StrictSigning: Invalid message signature"),u.ERR_INVALID_SIGNATURE);break;default:throw o(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 h.StrictSign:return e.from=this.peerId.toB58String(),e.seqno=f.randomSeqno(),p(this.peerId,e);case h.StrictNoSign:return Promise.resolve(e);default:throw o(new Error("Cannot build message: unhandled signature policy: "+t),u.ERR_UNHANDLED_SIGNATURE_POLICY)}}getSubscribers(e){if(!this.started)throw o(new Error("not started yet"),"ERR_NOT_STARTED_YET");if(!e||"string"!==typeof e)throw o(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 o(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=h,e.exports=g},23928:(e,t,r)=>{"use strict";var n=r(80886),i=n.Reader,o=n.Writer,s=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=s.emptyArray,e.prototype.msgs=s.emptyArray,e.encode=function(e,t){if(t||(t=o.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 o=e.uint32();switch(o>>>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&o)}}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:s.oneOfGetter(t=["subscribe"]),set:s.oneOfSetter(t)}),Object.defineProperty(e.prototype,"_topicID",{get:s.oneOfGetter(t=["topicID"]),set:s.oneOfSetter(t)}),e.encode=function(e,t){return t||(t=o.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 o=e.uint32();switch(o>>>3){case 1:n.subscribe=e.bool();break;case 2:n.topicID=e.string();break;default:e.skipType(7&o)}}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=s.emptyArray,e.prototype.signature=null,e.prototype.key=null,Object.defineProperty(e.prototype,"_from",{get:s.oneOfGetter(t=["from"]),set:s.oneOfSetter(t)}),Object.defineProperty(e.prototype,"_data",{get:s.oneOfGetter(t=["data"]),set:s.oneOfSetter(t)}),Object.defineProperty(e.prototype,"_seqno",{get:s.oneOfGetter(t=["seqno"]),set:s.oneOfSetter(t)}),Object.defineProperty(e.prototype,"_signature",{get:s.oneOfGetter(t=["signature"]),set:s.oneOfSetter(t)}),Object.defineProperty(e.prototype,"_key",{get:s.oneOfGetter(t=["key"]),set:s.oneOfSetter(t)}),e.encode=function(e,t){if(t||(t=o.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 o=e.uint32();switch(o>>>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&o)}}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?s.base64.decode(e.from,t.from=s.newBuffer(s.base64.length(e.from)),0):e.from.length&&(t.from=e.from)),null!=e.data&&("string"===typeof e.data?s.base64.decode(e.data,t.data=s.newBuffer(s.base64.length(e.data)),0):e.data.length&&(t.data=e.data)),null!=e.seqno&&("string"===typeof e.seqno?s.base64.decode(e.seqno,t.seqno=s.newBuffer(s.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?s.base64.decode(e.signature,t.signature=s.newBuffer(s.base64.length(e.signature)),0):e.signature.length&&(t.signature=e.signature)),null!=e.key&&("string"===typeof e.key?s.base64.decode(e.key,t.key=s.newBuffer(s.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?s.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?s.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?s.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?s.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?s.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:o}=r(62110),{fromString:s}=r(46765),a=s("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=o([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=o([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:o}=r(47465),s=r(44709),a=r(77674),{pipe:c}=r(79023),{source:u}=r(64183);e.exports=class extends o{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,s.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,s.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:o}=r(46765),s=r(90190),{sha256:a}=r(19400);e.exports={randomSeqno:()=>n(8),msgId:(e,t)=>{let r;r=e instanceof Uint8Array?s.createFromBytes(e).id:s.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=o(e.from,"base58btc")),"string"===typeof e.data&&(t.data=o(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"),o=r(18392),s=Object.assign(o("libp2p:topology:multicodec-topology"),{error:o("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){s.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){s.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 o;for await(const r of e){const e=t.write(r);e.length&&(yield e)}}();class o{constructor(){this._buffer=new i,this._bufferProxy=new Proxy({},{get:(e,t)=>"l"===t[0]?this._buffer[t]:this._buffer.get(parseInt(t))}),this._headerInfo=null}write(e){if(!e||!e.length)return[];this._buffer.append(e);const t=[];for(;this._buffer.length;){if(!this._headerInfo)try{this._headerInfo=this._decodeHeader(this._bufferProxy)}catch(r){break}const{id:e,type:n,length:i,offset:o}=this._headerInfo;if(this._buffer.length-o<i)break;t.push({id:e,type:n,data:this._buffer.shallowSlice(o,o+i)}),this._buffer.consume(o+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),o=10240;const s=new class{constructor(){this._pool=new Uint8Array(o),this._poolOffset=0}write(e){const t=this._pool;let r=this._poolOffset;n.encode(e.id<<3|e.type,t,r),r+=n.encode.bytes,n.encode(e.data?e.data.length:0,t,r),r+=n.encode.bytes;const i=t.subarray(this._poolOffset,r);return o-r<100?(this._pool=new Uint8Array(o),this._poolOffset=0):this._poolOffset=r,e.data?[i,e.data]:i}};e.exports=e=>async function*(){for await(const t of e)Array.isArray(t)?yield new i(t.map((e=>s.write(e)))):yield new i(s.write(t))}()},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),o=r(18392)("libp2p:mplex"),s=r(64183),a=r(82540),c=r(2233),{MessageTypes:u,MessageTypeNames:l}=r(3678),d=r(78840);class h{constructor(e){e="function"===typeof(e=e||{})?{onStream:e}:e,this._streamId=0,this._streams={initiators:new Map,receivers:new Map},this._options=e,this.sink=this._createSink(),this.source=this._createSource(),this.onStream=e.onStream,this.onStreamEnd=e.onStreamEnd}get streams(){const e=[];return this._streams.initiators.forEach((t=>{e.push(t)})),this._streams.receivers.forEach((t=>{e.push(t)})),e}newStream(e){const t=this._streamId++;e=null==e?t.toString():String(e);const r=this._streams.initiators;return this._newStream({id:t,name:e,type:"initiator",registry:r})}_newReceiverStream(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!"));o("new %s stream %s %s",n,t,r);const s=d({id:t,name:r,send:e=>(o.enabled&&o("%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:()=>{o("%s stream %s %s ended",n,t,r),i.delete(t),this.onStreamEnd&&this.onStreamEnd(s)},maxMsgSize:this._options.maxMsgSize});return i.set(t,s),s}_createSink(){return async e=>{this._options.signal&&(e=s(e,this._options.signal));try{await n(e,a.decode,c(this._options.maxMsgSize),(async e=>{for await(const t of e)for(const e of t)this._handleIncoming(e)}))}catch(t){return o("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(o.enabled&&o("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 o("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:o("unknown message type %s",r)}}}h.multicodec="/mplex/6.7.0",e.exports=h},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"),o=r(77674),s=r(41976),a=r(67963),{MAX_MSG_SIZE:c}=r(2233),{InitiatorMessageTypes:u,ReceiverMessageTypes:l}=r(3678),d="ERR_MPLEX_STREAM_RESET";e.exports=e=>{let{id:t,name:r,send:h,onEnd:f=(()=>{}),type:p="initiator",maxMsgSize:y=c}=e;const g=new AbortController,m=new AbortController,b="initiator"===p?u:l,v="initiator"===p?"i".concat(t):"r".concat(t);r=String(null==r?t:r);let w,E=!1,_=!1;const S=e=>{_||(_=!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(),S(e)},reset:()=>{const e=a(new Error("stream reset"),d);m.abort(),I.source.end(e),S(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:d}}]),"initiator"===p&&h({id:t,type:b.NEW_STREAM,data:r});try{for await(let r of e)for(;r.length;){if(r.length<=y){h({id:t,type:b.MESSAGE,data:r});break}r=s.isBufferList(r)?r:new s(r),h({id:t,type:b.MESSAGE,data:r.shallowSlice(0,y)}),r.consume(y)}}catch(o){return o.code===d?i("%s stream %s reset",p,r):(i("%s stream %s error",p,r,o),h({id:t,type:b.RESET})),I.source.end(o),S(o)}h({id:t,type:b.CLOSE}),S()},source:o((e=>{E||(E=!0,i("%s stream %s source end",p,r,e),e&&!w&&(w=e),_&&(I.timeline.close=Date.now(),f(w)))})),timeline:{open:Date.now(),close:null},id:v};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:o}=r(98719),s=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 s(new Error("invalid ip provided: ".concat(e)),u.ERR_INVALID_IP_PARAMETER);if("string"===typeof t&&(t=parseInt(t)),isNaN(t))throw s(new Error("invalid port provided: ".concat(t)),u.ERR_INVALID_PORT_PARAMETER);try{return new a(e),new o("/ip4/".concat(e,"/tcp/").concat(t))}catch{}try{const r=new c(e);return r.is4()?new o("/ip4/".concat(r.to4().correctForm(),"/tcp/").concat(t)):new o("/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),s(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:o}=e,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{sink:a,source:c}=t,u={async sink(e){s.signal&&(e=n(e,s.signal));try{await a(e)}catch(t){"aborted"!==t.type&&i(t)}l()},source:s.signal?n(c,s.signal):c,conn:t,localAddr:o,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:o,CODE_TCP:s,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(o);return n.WebSockets.matches(t)||n.WebSocketsSecure.matches(t)})),dnsWss:e=>e.filter((e=>{if(e.protoCodes().includes(i))return!1;const t=e.decapsulateCode(o);return n.WebSocketsSecure.matches(t)&&n.DNS.matches(t.decapsulateCode(s).decapsulateCode(c))})),dnsWsOrWss:e=>e.filter((e=>{if(e.protoCodes().includes(i))return!1;const t=e.decapsulateCode(o);return n.WebSockets.matches(t)?n.DNS.matches(t.decapsulateCode(s).decapsulateCode(a)):n.WebSocketsSecure.matches(t)&&n.DNS.matches(t.decapsulateCode(s).decapsulateCode(c))}))}},3300:(e,t,r)=>{"use strict";const n=r(88042),i=r(83708),o=r(94655),{AbortError:s}=r(64183),a=r(70121),c=r(18392),u=c("libp2p:websockets");u.error=c("libp2p:websockets:error");const l=r(96927),d=r(91227),h=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=h(r,{remoteAddr:e,signal:t.signal});u("new outbound connection %s",n.remoteAddr);const i=await this._upgrader.upgradeOutbound(n);return u("outbound connection %s upgraded",n.remoteAddr),i}async _connect(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.signal&&t.signal.aborted)throw new s;const r=e.toOptions();u("dialing %s:%s",r.host,r.port);const i=a(),c=e=>{const t="connection error: ".concat(e.message);u.error(t),i.reject(e)},l=n(o(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 d;const h=new Promise(((e,r)=>{if(d=()=>{r(new s),setTimeout((()=>{l.close()}))},t.signal.aborted)return d();t.signal.addEventListener("abort",d)}));try{await Promise.race([h,i.promise,l.connected()])}finally{t.signal.removeEventListener("abort",d)}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={}),d({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),o=r(24578),s=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?o(e.localAddress,e.localPort):void 0),remoteAddr:t.remoteAddr||o(e.remoteAddress,e.remotePort),timeline:{open:Date.now()},async close(){const t=Date.now();try{await s(e.close(),i)}catch(n){const{host:i,port:o}=r.remoteAddr.toOptions();c("timeout closing stream to %s:%s after %dms, destroying it manually",i,o,Date.now()-t),e.destroy()}finally{r.timeline.close=Date.now()}}};return e.socket.once&&e.socket.once("close",(()=>{r.timeline.close||(r.timeline.close=Date.now())})),r}},61995:(e,t,r)=>{"use strict";const{EventEmitter:n}=r(47465),{Multiaddr:i}=r(98719),o=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){o.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:o}=r(46765),{toString:s}=r(82051),{Multiaddr:a}=r(98719),c=r(50464),{relay:u}=r(16074),{canHop:l}=r(4364),{namespaceToCid:d}=r(7958),{CIRCUIT_PROTO_CODE:h,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(),s=r.find((e=>e===u));if(s||!this._listenRelays.has(n)){if(s&&!this._listenRelays.has(n))try{const e=this._connectionManager.get(t);if(!e)return;if(e.remoteAddr.protoCodes().includes(h))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,o(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:o}of r){const r=i.toB58String();if(this._listenRelays.has(r))continue;if(e.includes(r))continue;const n=o.get(f);if(!n||s(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 d(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")}),o=r(67963),s=r(90190),{validateAddrs:a}=r(55341),c=r(67903),{CircuitRelay:u}=r(91267),{pipe:l}=r(79023),{codes:d}=r(59087),{stop:h}=r(90807),f=r(16074);e.exports={handleHop:async function(e){let{connection:t,request:r,streamHandler:n,circuit:o}=e;if(!o._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 s(r.dstPeer.id),d=o._connectionManager.get(c);if(!d&&!o._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(!d)return;const f={type:u.Type.STOP,dstPeer:r.dstPeer,srcPeer:r.srcPeer};let p;try{p=await h({connection:d,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]),s=new c({stream:n});s.write(r);const a=await s.read();if(!a)throw o(new Error("HOP request had no response"),d.ERR_HOP_REQUEST_FAILED);if(a.code===u.Status.SUCCESS)return i("hop request was successful"),s.rest();throw i("hop request failed with code %d, closing stream",a.code),s.close(),o(new Error("HOP request failed with code ".concat(a.code)),d.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 o=n._options.hop.enabled;i("can hop (%s) request from %s",o,t.remotePeer.toB58String()),r.end({type:u.Type.STATUS,code:o?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:o}=r(91267),s=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(s){return i.error("invalid stop request via peer %s",t.remotePeer.toB58String(),s)}return i("stop request is valid"),n.write({type:o.Type.STATUS,code:o.Status.SUCCESS}),n.rest()},e.exports.stop=async function(e){let{connection:t,request:r}=e;const{stream:n}=await t.newStream([s.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===o.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")}),o=r(44709),s=r(39610),{CircuitRelay:a}=r(91267);e.exports=class{constructor(e){let{stream:t,maxLength:r=4096}=e;this.stream=t,this.shake=s(this.stream),this.decoder=o.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(o.encode.single(a.encode(e).finish()))}rest(){return this.shake.rest(),this.shake.stream}end(e){this.write(e),this.close()}close(){i("closing the stream"),this.rest().sink([])}}},55341:(e,t,r)=>{"use strict";const{Multiaddr:n}=r(98719),{CircuitRelay:i}=r(91267);function o(e,t){e.write({type:i.Type.STATUS,code:t})}e.exports={validateAddrs:function(e,t){try{e.dstPeer&&e.dstPeer.addrs&&e.dstPeer.addrs.forEach((e=>new n(e)))}catch(r){throw o(t,e.type===i.Type.HOP?i.Status.HOP_DST_MULTIADDR_INVALID:i.Status.STOP_DST_MULTIADDR_INVALID),r}try{e.srcPeer&&e.srcPeer.addrs&&e.srcPeer.addrs.forEach((e=>new n(e)))}catch(r){throw o(t,e.type===i.Type.HOP?i.Status.HOP_SRC_MULTIADDR_INVALID:i.Status.STOP_SRC_MULTIADDR_INVALID),r}}}},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:o}=r(59087),{setDelayedInterval:s,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=s(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===o.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 o=String(n).split("/p2p-circuit").find((e=>""!==e)),s=await e.dial(new i(o)),a=s.remoteAddr.encapsulate("/p2p-circuit");t.set(s.remotePeer.toB58String(),a),r.emit("listening")},getAddrs:function(){const e=[];for(const r of t.values())e.push(r);return e}});return e.connectionManager.on("peer:disconnect",(e=>{t.delete(e.remotePeer.toB58String())&&r.emit("close")})),r}},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,o=n.Writer,s=n.util,a=n.roots["libp2p-circuit"]||(n.roots["libp2p-circuit"]={});a.CircuitRelay=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<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=o.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 o=e.uint32();switch(o>>>3){case 1:n.type=e.int32();break;case 2:n.srcPeer=a.CircuitRelay.Peer.decode(e,e.uint32());break;case 3:n.dstPeer=a.CircuitRelay.Peer.decode(e,e.uint32());break;case 4:n.code=e.int32();break;default:e.skipType(7&o)}}return n},e.fromObject=function(e){if(e instanceof a.CircuitRelay)return e;var t=new a.CircuitRelay;switch(e.type){case"HOP":case 1:t.type=1;break;case"STOP":case 2:t.type=2;break;case"STATUS":case 3:t.type=3;break;case"CAN_HOP":case 4:t.type=4}if(null!=e.srcPeer){if("object"!==typeof e.srcPeer)throw TypeError(".CircuitRelay.srcPeer: object expected");t.srcPeer=a.CircuitRelay.Peer.fromObject(e.srcPeer)}if(null!=e.dstPeer){if("object"!==typeof e.dstPeer)throw TypeError(".CircuitRelay.dstPeer: object expected");t.dstPeer=a.CircuitRelay.Peer.fromObject(e.dstPeer)}switch(e.code){case"SUCCESS":case 100:t.code=100;break;case"HOP_SRC_ADDR_TOO_LONG":case 220:t.code=220;break;case"HOP_DST_ADDR_TOO_LONG":case 221:t.code=221;break;case"HOP_SRC_MULTIADDR_INVALID":case 250:t.code=250;break;case"HOP_DST_MULTIADDR_INVALID":case 251:t.code=251;break;case"HOP_NO_CONN_TO_DST":case 260:t.code=260;break;case"HOP_CANT_DIAL_DST":case 261:t.code=261;break;case"HOP_CANT_OPEN_DST_STREAM":case 262:t.code=262;break;case"HOP_CANT_SPEAK_RELAY":case 270:t.code=270;break;case"HOP_CANT_RELAY_TO_SELF":case 280:t.code=280;break;case"STOP_SRC_ADDR_TOO_LONG":case 320:t.code=320;break;case"STOP_DST_ADDR_TOO_LONG":case 321:t.code=321;break;case"STOP_SRC_MULTIADDR_INVALID":case 350:t.code=350;break;case"STOP_DST_MULTIADDR_INVALID":case 351:t.code=351;break;case"STOP_RELAY_REFUSED":case 390:t.code=390;break;case"MALFORMED_MESSAGE":case 400:t.code=400}return t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(r.type=t.enums===String?"HOP":1,r.srcPeer=null,r.dstPeer=null,r.code=t.enums===String?"SUCCESS":100),null!=e.type&&e.hasOwnProperty("type")&&(r.type=t.enums===String?a.CircuitRelay.Type[e.type]:e.type),null!=e.srcPeer&&e.hasOwnProperty("srcPeer")&&(r.srcPeer=a.CircuitRelay.Peer.toObject(e.srcPeer,t)),null!=e.dstPeer&&e.hasOwnProperty("dstPeer")&&(r.dstPeer=a.CircuitRelay.Peer.toObject(e.dstPeer,t)),null!=e.code&&e.hasOwnProperty("code")&&(r.code=t.enums===String?a.CircuitRelay.Status[e.code]:e.code),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,n.util.toJSONOptions)},e.Status=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=s.newBuffer([]),e.prototype.addrs=s.emptyArray,e.encode=function(e,t){if(t||(t=o.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 o=e.uint32();switch(o>>>3){case 1:n.id=e.bytes();break;case 2:n.addrs&&n.addrs.length||(n.addrs=[]),n.addrs.push(e.bytes());break;default:e.skipType(7&o)}}if(!n.hasOwnProperty("id"))throw s.ProtocolError("missing required 'id'",{instance:n});return n},e.fromObject=function(e){if(e instanceof a.CircuitRelay.Peer)return e;var t=new a.CircuitRelay.Peer;if(null!=e.id&&("string"===typeof e.id?s.base64.decode(e.id,t.id=s.newBuffer(s.base64.length(e.id)),0):e.id.length&&(t.id=e.id)),e.addrs){if(!Array.isArray(e.addrs))throw TypeError(".CircuitRelay.Peer.addrs: array expected");t.addrs=[];for(var r=0;r<e.addrs.length;++r)"string"===typeof e.addrs[r]?s.base64.decode(e.addrs[r],t.addrs[r]=s.newBuffer(s.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=s.newBuffer(r.id)))),null!=e.id&&e.hasOwnProperty("id")&&(r.id=t.bytes===String?s.base64.encode(e.id,0,e.id.length):t.bytes===Array?Array.prototype.slice.call(e.id):e.id),e.addrs&&e.addrs.length){r.addrs=[];for(var n=0;n<e.addrs.length;++n)r.addrs[n]=t.bytes===String?s.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")}),o=r(67963),s=r(18322),{Multiaddr:a}=r(98719),c=r(90190),{CircuitRelay:u}=r(91267),{codes:l}=r(59087),d=r(68308),{relay:h}=r(16074),f=r(95031),{handleCanHop:p,handleHop:y,hop:g}=r(4364),{handleStop:m}=r(90807),b=r(67903),v=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(h,this._onProtocol.bind(this))}async _onProtocol(e){let{connection:t,stream:r}=e;const n=new b({stream:r}),o=await n.read();if(!o)return;const s=this;let c;switch(o.type){case u.Type.CAN_HOP:i("received CAN_HOP request from %s",t.remotePeer.toB58String()),await p({circuit:s,connection:t,streamHandler:n});break;case u.Type.HOP:i("received HOP request from %s",t.remotePeer.toB58String()),c=await y({connection:t,request:o,streamHandler:n,circuit:s});break;case u.Type.STOP:i("received STOP request from %s",t.remotePeer.toB58String()),c=await m({connection:t,request:o,streamHandler:n});break;default:i("Request of type %s not supported",o.type)}if(c){const e=new a(o.dstPeer.addrs[0]),t=new a(o.srcPeer.addrs[0]),r=d({stream:c,remoteAddr:e,localAddr:t}),n=o.type===u.Type.HOP?"relay":"inbound";i("new %s connection %s",n,r.remoteAddr);const s=await this._upgrader.upgradeInbound(r);i("%s connection %s upgraded",n,r.remoteAddr),this.handler&&this.handler(s)}}async dial(e,t){const r=e.toString().split("/p2p-circuit"),n=new a(r[0]),s=new a(r[r.length-1]),h=n.getPeerId(),f=s.getPeerId();if(!h||!f){const e="Circuit relay dial failed as addresses did not have peer id";throw i.error(e),o(new Error(e),l.ERR_RELAYED_DIAL)}const p=c.createFromB58String(h),y=c.createFromB58String(f);let m=!1,b=this._connectionManager.get(p);b||(b=await this._dialer.connectToPeer(n,t),m=!0);try{const t=await g({connection:b,request:{type:u.Type.HOP,srcPeer:{id:this.peerId.toBytes(),addrs:this._libp2p.multiaddrs.map((e=>e.bytes))},dstPeer:{id:y.toBytes(),addrs:[new a(s).bytes]}}}),r=n.encapsulate("/p2p-circuit/p2p/".concat(this.peerId.toB58String())),o=d({stream:t,remoteAddr:e,localAddr:r});return i("new outbound connection %s",o.remoteAddr),this._upgrader.upgradeOutbound(o)}catch(v){throw i.error("Circuit relay dial failed",v),m&&await b.close(),v}}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=>s.Circuit.matches(e)))}get[Symbol.toStringTag](){return"Circuit"}static isTransport(e){return Boolean(e&&e[v])}}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),o=r(70127),{AGENT_VERSION:s}=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:o.MAX_PARALLEL_DIALS,maxDialsPerPeer:o.MAX_PER_PEER_DIALS,dialTimeout:o.DIAL_TIMEOUT,resolvers:{dnsaddr:i},addressSorter:c},host:{agentVersion:s},metrics:{enabled:!1},peerStore:{persistence:!1,threshold:5},peerRouting:{refreshManager:{enabled:!0,interval:6e5,bootDelay:1e4}},config:{protocolPrefix:"ipfs",dht:{enabled:!1,kBucketSize:20},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),o=r(31779),s=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")}),d={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},d,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=o(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=>s(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=o(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")}),o=r(67963),s=r(89842),a=r(382),c=r(31779),{EventEmitter:u}=r(47465),l=r(3342),d=r(90190),{codes:{ERR_INVALID_PARAMETERS:h}}=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=s.call({ignoreUndefined:!0},f,t),this._options.maxConnections<this._options.minConnections)throw o(new Error("Connection Manager maxConnections must be greater than minConnections"),h);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(!d.isPeerId(e))throw o(new Error("peerId must be an instance of peer-id"),h);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),o=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,o("latencyCheckIntervalMs: %s dataEmitIntervalMs: %s",i.latencyCheckIntervalMs,i.dataEmitIntervalMs),i.dataEmitIntervalMs?o("Expecting ~%s events per summary",i.latencyCheckIntervalMs/i.dataEmitIntervalMs):o("Not emitting summaries"),i.asyncTestFn=r}start(){globalThis.process&&globalThis.process.hrtime?(o("Using process.hrtime for timing"),this.now=globalThis.process.hrtime,this.getDeltaMS=e=>{const t=this.now(e);return 1e3*t[0]+t[1]/1e6}):"undefined"!==typeof window&&window.performance&&window.performance.now?(o("Using performance.now for timing"),this.now=window.performance.now.bind(window.performance),this.getDeltaMS=e=>Math.round(this.now()-e)):(o("Using Date.now for timing"),this.now=Date.now,this.getDeltaMS=e=>this.now()-e),this._latencyData=this._initLatencyData(),"undefined"!==typeof window&&(this._visibilityChangeEmitter=new i,this._visibilityChangeEmitter.on("visibilityChange",(e=>{e?this._startTimers():(this._emitSummary(),this._stopTimers())}))),this._visibilityChangeEmitter&&!this._visibilityChangeEmitter.isVisible()||this._startTimers()}stop(){this._stopTimers()}_startTimers(){this._checkLatencyID||(this._checkLatency(),this.dataEmitIntervalMs&&(this._emitIntervalID=setInterval((()=>this._emitSummary()),this.dataEmitIntervalMs),"function"===typeof this._emitIntervalID.unref&&this._emitIntervalID.unref()))}_stopTimers(){this._checkLatencyID&&(clearTimeout(this._checkLatencyID),this._checkLatencyID=void 0),this._emitIntervalID&&(clearInterval(this._emitIntervalID),this._emitIntervalID=void 0)}_emitSummary(){const e=this.getSummary();e.events>0&&this.emit("data",e)}getSummary(){const e={events:this._latencyData.events,minMs:this._latencyData.minMs,maxMs:this._latencyData.maxMs,avgMs:this._latencyData.events?this._latencyData.totalMs/this._latencyData.events:Number.POSITIVE_INFINITY,lengthMs:this.getDeltaMS(this._latencyData.startTime)};return this._latencyData=this._initLatencyData(),o("Summary: %O",e),e}_checkLatency(){const e=this,t=Math.random()*e._latecyCheckMultiply-e._latecyCheckSubtract,r={deltaOffset:Math.ceil(e.latencyCheckIntervalMs+t),startTime:e.now()},n=()=>{if(!this._checkLatencyID)return;const t=e.getDeltaMS(r.startTime)-r.deltaOffset;e._checkLatency(),e._latencyData.events++,e._latencyData.minMs=Math.min(e._latencyData.minMs,t),e._latencyData.maxMs=Math.max(e._latencyData.maxMs,t),e._latencyData.totalMs+=t,o("MS: %s Data: %O",t,e._latencyData)};o("localData: %O",r),this._checkLatencyID=setTimeout((()=>{e.asyncTestFn?(r.deltaOffset=0,r.startTime=e.now(),e.asyncTestFn(n)):(r.deltaOffset-=1,n())}),r.deltaOffset),"function"===typeof this._checkLatencyID.unref&&this._checkLatencyID.unref()}_initLatencyData(){return{startTime:this.now(),minMs:Number.POSITIVE_INFINITY,maxMs:Number.NEGATIVE_INFINITY,events:0,totalMs:0}}}},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:o}=r(59087),{storeAddresses:s,uniquePeers:a,requirePeers:c,maybeLimitSource:u}=r(31935),l=r(79272),d=r(96155),{pipe:h}=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"),o.ERR_NO_ROUTERS_AVAILABLE);yield*h(d(...this.routers.map((r=>r.findProviders(e,t)))),(e=>s(e,this.libp2p.peerStore)),(e=>a(e)),(e=>u(e,t.maxNumProviders)),(e=>c(e)))}async provide(e){if(!this.routers.length)throw n(new Error("No content routers available"),o.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),o.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),o.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),o.ERR_NOT_FOUND)}async*getMany(e,t,r){if(!this.libp2p.isStarted()||!this.dht.isStarted)throw n(new Error(i.NOT_STARTED_YET),o.DHT_NOT_STARTED);if(!t)return;let s=0;for await(const n of this.dht.get(e,r))if("VALUE"===n.name&&(yield{from:n.peerId,val:n.value},s++,s===t))break;if(0===s)throw n(new Error(i.NOT_FOUND),o.ERR_NOT_FOUND)}}},31935:(e,t,r)=>{"use strict";const n=r(67963),i=r(12393),o=r(27889),s=r(35959);e.exports={storeAddresses:async function*(e,t){yield*o(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?s(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:o}=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),o.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),o=r(49879),s=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 o;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 s(this.addrs.map((async(n,o)=>{const s=await r.shift();let a;try{const c=u[o].signal;a=await this.dialAction(n,{...e,signal:e.signal?i([c,e.signal]):c}),u.splice(o,1)}finally{l++,this.addrs.length-l>=t.length?r.push(s):this.dialer.releaseToken(t.splice(t.indexOf(s),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),o=r(12393),{pipe:s}=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:d}=r(64183),{anySignal:h}=r(66622),{setMaxListeners:f}=r(47465),p=r(12141),{publicAddressesFirst:y}=r(27780),g=r(85012),m=r(3342),{codes:b}=r(59087),{DIAL_TIMEOUT:v,MAX_PARALLEL_DIALS:w,MAX_PER_PEER_DIALS:E,MAX_ADDRS_TO_DIAL:_}=r(70127),S="dialler";e.exports=class{constructor(e){let{transportManager:t,peerStore:r,connectionGater:n,addressSorter:i=y,maxParallelDials:o=w,maxAddrsToDial:s=_,dialTimeout:a=v,maxDialsPerPeer:c=E,resolvers:l={},metrics:d}=e;this.connectionGater=n,this.transportManager=t,this.peerStore=r,this.addressSorter=i,this.maxParallelDials=o,this.maxAddrsToDial=s,this.timeout=a,this.maxDialsPerPeer=c,this.tokens=[...new Array(o)].map(((e,t)=>t)),this._pendingDials=m({component:S,metric:"pending-dials",metrics:d}),this._pendingDialTargets=m({component:S,metric:"pending-dial-targets",metrics:d});for(const[h,f]of Object.entries(l))u.resolvers.set(h,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 d("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"),b.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"),b.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(o){throw i.controller.signal.aborted&&(o.code=b.ERR_TIMEOUT),a.error(o),o}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 s(await this.peerStore.addressBook.getMultiaddrsForPeer(t,this.addressSorter),(e=>o(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"),b.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"),b.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 o=h(i);try{f&&f(1/0,o)}catch{}const s={dialRequest:r,controller:n,promise:r.run({...t,signal:o}),destroy:()=>{n.clear(),this._pendingDials.delete(e.id)}};return this._pendingDials.set(e.id,s),s}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")}),o=r(67963),{codes:s}=r(59087),a=r(44709),{FetchRequest:c,FetchResponse:u}=r(83201),l=r(39610),{PROTOCOL:d}=r(11002);class h{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(h.PROTOCOL),d=l(n),f=new c({identifier:t});d.write(a.encode.single(c.encode(f).finish()));const p=u.decode((await a.decode.fromReader(d.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 o(new Error("Error in fetch protocol response: "+e),s.ERR_INVALID_PARAMETERS)}default:throw o(new Error("Unknown response status"),s.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 o=this._getLookupFunction(n.identifier);if(o){const e=await o(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 o(new Error("Fetch protocol handler for key prefix '"+e+"' already registered"),s.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)}}h.PROTOCOL=d,e.exports=h},83201:(e,t,r)=>{"use strict";var n=r(80886),i=n.Reader,o=n.Writer,s=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=o.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 o=e.uint32();if(o>>>3===1)n.identifier=e.string();else e.skipType(7&o)}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=s.newBuffer([]),e.encode=function(e,t){return t||(t=o.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 o=e.uint32();switch(o>>>3){case 1:n.status=e.int32();break;case 2:n.data=e.bytes();break;default:e.skipType(7&o)}}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?s.base64.decode(e.data,t.data=s.newBuffer(s.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=s.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?s.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),o=r(67963),{codes:s}=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 o(new Error("".concat(e," does not have a valid peer type")),s.ERR_INVALID_MULTIADDR);try{e=n.createFromB58String(i)}catch(r){throw o(new Error("".concat(e," is not a valid peer type")),s.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")}),o=r(67963),s=r(44709),{pipe:a}=r(79023),{collect:c,take:u,consume:l}=r(79755),{fromString:d}=r(46765),h=r(90190),{Multiaddr:f}=r(98719),{toBuffer:p}=r(90351),y=r(32912),g=r(76869),m=r(73374),{MULTICODEC_IDENTIFY:b,MULTICODEC_IDENTIFY_PUSH:v,IDENTIFY_PROTOCOL_VERSION:w,MULTICODEC_IDENTIFY_PROTOCOL_NAME:E,MULTICODEC_IDENTIFY_PUSH_PROTOCOL_NAME:_,MULTICODEC_IDENTIFY_PROTOCOL_VERSION:S,MULTICODEC_IDENTIFY_PUSH_PROTOCOL_VERSION:I}=r(43367),{codes:A}=r(59087);class R{static getProtocolStr(e){return{identifyProtocolStr:"/".concat(e._config.protocolPrefix,"/").concat(E,"/").concat(S),identifyPushProtocolStr:"/".concat(e._config.protocolPrefix,"/").concat(_,"/").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=R.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",d(this._host.agentVersion)),await this.peerStore.metadataBook.setValue(this.peerId,"ProtocolVersion",d(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),o=e.map((async e=>{try{const{stream:i}=await e.newStream(this.identifyPushProtocolStr);await a([y.Identify.encode({listenAddrs:r,signedPeerRecord:t,protocols:n}).finish()],s.encode(),i,l)}catch(o){i.error("could not push identify update to peer",o)}}));return Promise.all(o)}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,s.decode(),u(1),p,c);if(!r)throw o(new Error("No data could be retrieved"),A.ERR_CONNECTION_ENDED);let n;try{n=y.Identify.decode(r)}catch(I){throw o(I,A.ERR_INVALID_MESSAGE)}const{publicKey:l,listenAddrs:b,protocols:v,observedAddr:w,signedPeerRecord:E}=n,_=await h.createFromPubKey(l);if(e.remotePeer.toB58String()!==_.toB58String())throw o(new Error("identified peer does not match the expected peer"),A.ERR_INVALID_PEER);const S=R.getCleanMultiaddr(w);try{const e=await g.openAndCertify(E,m.DOMAIN);if(await this.peerStore.addressBook.consumePeerRecord(e))return await this.peerStore.protoBook.set(_,v),await this.peerStore.metadataBook.setValue(_,"AgentVersion",d(n.agentVersion)),void await this.peerStore.metadataBook.setValue(_,"ProtocolVersion",d(n.protocolVersion))}catch(I){i("received invalid envelope, discard it and fallback to listenAddrs is available",I)}try{await this.peerStore.addressBook.set(_,b.map((e=>new f(e))))}catch(I){i.error("received invalid addrs",I)}await this.peerStore.protoBook.set(_,v),await this.peerStore.metadataBook.setValue(_,"AgentVersion",d(n.agentVersion)),await this.peerStore.metadataBook.setValue(_,"ProtocolVersion",d(n.protocolVersion)),i("received observed address of %s",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),o=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([o],s.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,s.decode(),u(1),p,c);t=y.Identify.decode(e)}catch(l){return i.error("received invalid message",l)}const o=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(o,t.protocols)}catch(l){i("received invalid envelope, discard it and fallback to listenAddrs is available",l)}try{await this.peerStore.addressBook.set(o,t.listenAddrs.map((e=>new f(e))))}catch(l){i.error("received invalid addrs",l)}try{await this.peerStore.protoBook.set(o,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 T={IDENTIFY:b,IDENTIFY_PUSH:v};R.multicodecs=T,R.Messsage=y,e.exports=R},32912:(e,t,r)=>{"use strict";var n=r(80886),i=n.Reader,o=n.Writer,s=n.util,a=n.roots["libp2p-identify"]||(n.roots["libp2p-identify"]={});a.Identify=function(){function e(e){if(this.listenAddrs=[],this.protocols=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.protocolVersion="",e.prototype.agentVersion="",e.prototype.publicKey=s.newBuffer([]),e.prototype.listenAddrs=s.emptyArray,e.prototype.observedAddr=s.newBuffer([]),e.prototype.protocols=s.emptyArray,e.prototype.signedPeerRecord=s.newBuffer([]),e.encode=function(e,t){if(t||(t=o.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 o=e.uint32();switch(o>>>3){case 5:n.protocolVersion=e.string();break;case 6:n.agentVersion=e.string();break;case 1:n.publicKey=e.bytes();break;case 2:n.listenAddrs&&n.listenAddrs.length||(n.listenAddrs=[]),n.listenAddrs.push(e.bytes());break;case 4:n.observedAddr=e.bytes();break;case 3:n.protocols&&n.protocols.length||(n.protocols=[]),n.protocols.push(e.string());break;case 8:n.signedPeerRecord=e.bytes();break;default:e.skipType(7&o)}}return n},e.fromObject=function(e){if(e instanceof a.Identify)return e;var t=new a.Identify;if(null!=e.protocolVersion&&(t.protocolVersion=String(e.protocolVersion)),null!=e.agentVersion&&(t.agentVersion=String(e.agentVersion)),null!=e.publicKey&&("string"===typeof e.publicKey?s.base64.decode(e.publicKey,t.publicKey=s.newBuffer(s.base64.length(e.publicKey)),0):e.publicKey.length&&(t.publicKey=e.publicKey)),e.listenAddrs){if(!Array.isArray(e.listenAddrs))throw TypeError(".Identify.listenAddrs: array expected");t.listenAddrs=[];for(var r=0;r<e.listenAddrs.length;++r)"string"===typeof e.listenAddrs[r]?s.base64.decode(e.listenAddrs[r],t.listenAddrs[r]=s.newBuffer(s.base64.length(e.listenAddrs[r])),0):e.listenAddrs[r].length&&(t.listenAddrs[r]=e.listenAddrs[r])}if(null!=e.observedAddr&&("string"===typeof e.observedAddr?s.base64.decode(e.observedAddr,t.observedAddr=s.newBuffer(s.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?s.base64.decode(e.signedPeerRecord,t.signedPeerRecord=s.newBuffer(s.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=s.newBuffer(r.publicKey))),t.bytes===String?r.observedAddr="":(r.observedAddr=[],t.bytes!==Array&&(r.observedAddr=s.newBuffer(r.observedAddr))),r.protocolVersion="",r.agentVersion="",t.bytes===String?r.signedPeerRecord="":(r.signedPeerRecord=[],t.bytes!==Array&&(r.signedPeerRecord=s.newBuffer(r.signedPeerRecord)))),null!=e.publicKey&&e.hasOwnProperty("publicKey")&&(r.publicKey=t.bytes===String?s.base64.encode(e.publicKey,0,e.publicKey.length):t.bytes===Array?Array.prototype.slice.call(e.publicKey):e.publicKey),e.listenAddrs&&e.listenAddrs.length){r.listenAddrs=[];for(var n=0;n<e.listenAddrs.length;++n)r.listenAddrs[n]=t.bytes===String?s.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?s.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?s.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:o}=r(47465),s=r(67963),a=r(90190),{Multiaddr:c}=r(98719),{MemoryDatastore:u}=r(78932),l=r(28109),d=r(78909),h=r(85012),{validate:f}=r(7037),{codes:p,messages:y}=r(59087),g=r(61995),m=r(71997),b=r(75570),v=r(46162),w=r(90432),E=r(50453),_=r(69566),S=r(70030),I=r(48350),A=r(59324),R=r(47299),T=r(88694),C=r(9828),P=r(6215),k=r(85889),O=r(66321),N=r(45020),{updateSelfPeerRecord:D}=r(17335);class B extends o{static async create(e){if(e.peerId)return new B(e);const t=await a.create();return e.peerId=t,new B(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 S({...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 R({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",(()=>{D(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 b(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=_.generateOptions();this.keychain=new _(this._options.keychain.datastore,{...e,...this._options.keychain}),i("keychain constructed")}if(this.upgrader=new A({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 N({peerId:this.peerId,addressManager:this.addressManager,transportManager:this.transportManager,...this._options.config.nat}),this.registrar=new C({peerStore:this.peerStore,connectionManager:this.connectionManager}),this.handle=this.handle.bind(this),this.registrar.handle=this.handle,!this._modules.connEncryption||!this._modules.connEncryption.length)throw s(new Error(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(v.prototype[Symbol.toStringTag],v),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=T(e,this,this._config.pubsub)}this.peerRouting=new l(this),this.contentRouting=new d(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 s(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}=h(e);if(r.equals(this.peerId))throw s(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}=h(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}=h(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=B},37929:(e,t,r)=>{"use strict";r(34660),r(29835);const n=r(60392),{certificateForKey:i,findAsync:o}=r(2730),s=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 s(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 s(new Error("Plain data must be a Uint8Array"),u.ERR_INVALID_PARAMETERS);const r=await this.keychain.findKeyByName(e),o=await this.keychain._getPrivateKey(e),c=l.get(this).dek,d=n.pki.decryptRsaPrivateKey(o,c),h=await i(r,d),f=n.pkcs7.createEnvelopedData();f.addRecipient(h),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 s(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 s(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 o(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 s(new Error("Decryption needs one of the key(s): "+e.join(", ")),u.ERR_MISSING_KEYS,{missingKeys:e})}const d=await this.keychain.findKeyById(i.keyId);if(!d)throw s(new Error("No key available to decrypto"),u.ERR_NO_KEY);const h=await this.keychain._getPrivateKey(d.name),f=l.get(this).dek,p=n.pki.decryptRsaPrivateKey(h,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")}),o=r(6327),s=r(89842),a=r(25504),{Key:c}=r(3450),u=r(37929),l=r(67963),{codes:d}=r(59087),{toString:h}=r(82051),{fromString:f}=r(46765);r(34770);const p="/info/",y=new WeakMap,g=14,m=16,b=1e3,v={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===o(e.trim()))}async function E(e){const t=800*Math.random()+200;throw await new Promise((e=>setTimeout(e,t))),e}function _(e){return new c("/pkcs8/"+e)}function S(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=s(v,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<b)throw new Error("dek.iterationCount must be least ".concat(b));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({},v),t=3*Math.ceil(m/3);return e.dek.salt=h(a.randomBytes(t),"base64"),e}static get options(){return v}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,"'")),d.ERR_INVALID_KEY_NAME));if("string"!==typeof t)return E(l(new Error("Invalid key type '".concat(t,"'")),d.ERR_INVALID_KEY_TYPE));const i=_(e);if(await n.store.has(i))return E(l(new Error("Key '".concat(e,"' already exists")),d.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)),d.ERR_INVALID_KEY_SIZE));let o;try{const s=await a.keys.generateKeyPair(t,r),c=await s.id(),u=y.get(this).dek,l=await s.export(u);o={name:e,id:c};const d=n.store.batch();d.put(i,f(l)),d.put(S(e),f(JSON.stringify(o))),await d.commit()}catch(s){return E(s)}return o}async listKeys(){const e=this,t={prefix:p},r=[];for await(const n of e.store.query(t))r.push(JSON.parse(h(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,"'")),d.ERR_INVALID_KEY_NAME));const t=S(e);try{const e=await this.store.get(t);return JSON.parse(h(e))}catch(r){return E(l(new Error("Key '".concat(e,"' does not exist. ").concat(r.message)),d.ERR_KEY_NOT_FOUND))}}async removeKey(e){if(!w(e)||"self"===e)return E(l(new Error("Invalid key name '".concat(e,"'")),d.ERR_INVALID_KEY_NAME));const t=_(e),r=await this.findKeyByName(e),n=this.store.batch();return n.delete(t),n.delete(S(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,"'")),d.ERR_OLD_KEY_NAME_INVALID));if(!w(t)||"self"===t)return E(l(new Error("Invalid new key name '".concat(t,"'")),d.ERR_NEW_KEY_NAME_INVALID));const n=_(e),i=_(t),o=S(e),s=S(t);if(await r.store.has(i))return E(l(new Error("Key '".concat(t,"' already exists")),d.ERR_KEY_ALREADY_EXISTS));try{const e=await r.store.get(n),a=await r.store.get(o),c=JSON.parse(h(a));c.name=t;const u=r.store.batch();return u.put(i,e),u.put(s,f(JSON.stringify(c))),u.delete(n),u.delete(o),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,"'")),d.ERR_INVALID_KEY_NAME));if(!t)return E(l(new Error("Password is required"),d.ERR_PASSWORD_REQUIRED));const r=_(e);try{const e=await this.store.get(r),n=h(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,"'")),d.ERR_INVALID_KEY_NAME));if(!t)return E(l(new Error("PEM encoded key is required"),d.ERR_PEM_REQUIRED));const n=_(e);if(await this.store.has(n))return E(l(new Error("Key '".concat(e,"' already exists")),d.ERR_KEY_ALREADY_EXISTS));let i,o;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"),d.ERR_CANNOT_READ_KEY))}try{o=await i.id();const e=y.get(this).dek;t=await i.export(e)}catch(u){return E(u)}const s={name:e,id:o},c=this.store.batch();return c.put(n,f(t)),c.put(S(e),f(JSON.stringify(s))),await c.commit(),s}async importPeer(e,t){const r=this;if(!w(e))return E(l(new Error("Invalid key name '".concat(e,"'")),d.ERR_INVALID_KEY_NAME));if(!t||!t.privKey)return E(l(new Error("Peer.privKey is required"),d.ERR_MISSING_PRIVATE_KEY));const n=t.privKey,i=_(e);if(await r.store.has(i))return E(l(new Error("Key '".concat(e,"' already exists")),d.ERR_KEY_ALREADY_EXISTS));try{const t=await n.id(),o=y.get(this).dek,s=await n.export(o),a={name:e,id:t},c=r.store.batch();return c.put(i,f(s)),c.put(S(e),f(JSON.stringify(a))),await c.commit(),a}catch(o){return E(o)}}async _getPrivateKey(e){if(!w(e))return E(l(new Error("Invalid key name '".concat(e,"'")),d.ERR_INVALID_KEY_NAME));try{const t=_(e),r=await this.store.get(t);return h(r)}catch(t){return E(l(new Error("Key '".concat(e,"' does not exist. ").concat(t.message)),d.ERR_KEY_NOT_FOUND))}}async rotateKeychainPass(e,t){if("string"!==typeof e)return E(l(new Error("Invalid old pass type '".concat(typeof e,"'")),d.ERR_INVALID_OLD_PASS_TYPE));if("string"!==typeof t)return E(l(new Error("Invalid new pass type '".concat(typeof t,"'")),d.ERR_INVALID_NEW_PASS_TYPE));if(t.length<20)return E(l(new Error("Invalid pass length ".concat(t.length)),d.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 o=await this.listKeys();for(const i of o){const e=await this.store.get(_(i.name)),t=h(e),o=await a.keys.import(t,r),s=n.toString(),c=await o.export(s),u=this.store.batch(),l={name:i.name,id:i.id};u.put(_(i.name),f(c)),u.put(S(i.name),f(JSON.stringify(l))),await u.commit()}i("keychain reconstructed")}}},2730:(e,t,r)=>{"use strict";r(3391);const n=r(60392).pki;e.exports={certificateForKey:(e,t)=>{const r=n.setRsaPublicKey(t.n,t.e),i=n.createCertificate();i.publicKey=r,i.serialNumber="01",i.validity.notBefore=new Date,i.validity.notAfter=new Date,i.validity.notAfter.setFullYear(i.validity.notBefore.getFullYear()+10);const o=[{name:"organizationName",value:"ipfs"},{shortName:"OU",value:"keystore"},{name:"commonName",value:e.id}];return i.setSubject(o),i.setIssuer(o),i.setExtensions([{name:"basicConstraints",cA:!0},{name:"keyUsage",keyCertSign:!0,digitalSignature:!0,nonRepudiation:!0,keyEncipherment:!0,dataEncipherment:!0},{name:"extKeyUsage",serverAuth:!0,clientAuth:!0,codeSigning:!0,emailProtection:!0,timeStamping:!0},{name:"nsCertType",client:!0,server:!0,email:!0,objsign:!0,sslCA:!0,emailCA:!0,objCA:!0}]),i.sign(t),i},findAsync:async function(e,t){const r=e.map(t);return e[(await Promise.all(r)).findIndex((e=>e))]}}},70030:(e,t,r)=>{"use strict";const n=r(89842),{pipe:i}=r(79023),{tap:o}=r(79755),s=r(40579),{METRICS:a}=r(70127),c=r(59112),u=["dataReceived","dataSent"],l={in:"dataReceived",out:"dataSent"};class d{constructor(e){this._options=n(a,e),this._globalStats=new c(u,this._options),this._peerStats=new Map,this._protocolStats=new Map,this._oldPeers=s(this._options.maxOldPeersRetention),this._running=!1,this._onMessage=this._onMessage.bind(this),this._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 o=this._systems.get(t);o.has(r)||o.set(r,new Map);o.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 o=l[n];let s=this.forPeer(t);if(s||(s=new c(u,this._options),this._peerStats.set(t.toB58String(),s)),s.push(o,i),this._globalStats.push(o,i),r){let e=this.forProtocol(r);e||(e=new c(u,this._options),this._protocolStats.set(r,e)),e.push(o,i)}}updatePlaceholder(e,t){if(!this._running)return;const r=this.forPeer(e),n=t.toB58String(),i=this.forPeer(t);let o=r;i&&(o=d.mergeStats(i,o),this._oldPeers.delete(n)),this._peerStats.delete(e.toB58String()),this._peerStats.set(n,o),o.start()}trackStream(e){let{stream:t,remotePeer:r,protocol:n}=e;const s=this,a=t.source;t.source=o((e=>s._onMessage({remotePeer:r,protocol:n,direction:"in",dataLength:e.length})))(a);const c=t.sink;return t.sink=e=>i(e,o((e=>s._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=d},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),o=r(56755),s=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]=o(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=s(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 s=this._movingAverages[e];s||(s=this._movingAverages[e]={});const a=this._options.movingAverageIntervals;for(let c=0;c<a.length;c++){const e=a[c];let t=s[e];t||(t=s[e]=o(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:o,metrics:s}=e;return r=s?new t({system:n,component:i,metric:o,metrics:s}):new Map,r}},45020:(e,t,r)=>{"use strict";const n=r(47956),i=r(18392),{promisify:o}=r(51590),{Multiaddr:s}=r(98719),a=Object.assign(i("libp2p:nat"),{error:i("libp2p:nat:err")}),{isBrowser:c}=r(3227),u=r(51545),l=r(83931),d=r(28362),h=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(d.name,"@").concat(d.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 h(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 o=this._getClient(),c=this._externalIp||await o.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 o.map({publicPort:u,privatePort:n,protocol:i.toUpperCase()}),this._addressManager.addObservedAddr(s.fromNodeAddress({family:4,address:c,port:u},i))}}_getClient(){if(this._client)return this._client;const e=new n(this._options),t=o(e.map.bind(e)),r=o(e.destroy.bind(e)),i=o(e.externalIp.bind(e));return this._client={map: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")}),o=r(67963),s=r(59087),{storeAddresses:a,uniquePeers:c,requirePeers:u}=r(31935),{TimeoutController:l}=r(87683),d=r(96155),{pipe:h}=r(79023),f=r(84744),p=r(79272),y=r(12393),{setDelayedInterval:g,clearDelayedInterval:m}=r(18928),{DHTPeerRouting:b}=r(39862),{setMaxListeners:v}=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 b(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 o(new Error("No peer routers available"),s.codes.ERR_NO_ROUTERS_AVAILABLE);if(e.toB58String()===this._peerId.toB58String())throw o(new Error("Should not try to find self"),s.codes.ERR_FIND_SELF);const r=await h(d(...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 o(new Error(s.messages.NOT_FOUND),s.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 o(new Error("No peer routers available"),s.codes.ERR_NO_ROUTERS_AVAILABLE);if(t.timeout){const e=new l(t.timeout);try{v&&v(1/0,e.signal)}catch{}t.signal=e.signal}yield*h(d(...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:o}=r(98719),s=r(90190),{codes:a}=r(59087),c=r(73374),u=r(76869),{pipe:l}=r(79023),d=r(50464),h=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(!o.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=>h(t,(t=>r(e,t)))),(e=>f(e,(e=>({multiaddr:new o(e.toString()),isCertified:n})))),(e=>d(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 o;try{o=c.createFromProtobuf(e.payload)}catch(i){return y.error("invalid peer record received"),!1}r=o.peerId;const s=o.multiaddrs;if(!r.equals(e.peerId))return y("signing key does not match PeerId in the PeerRecord"),!1;if(!s||!s.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>=o.seqNumber)return!1}}n=await this._store.patchOrCreate(r,{addresses:await m(r,s,this._addressFilter,!0),peerRecordEnvelope:e.marshal()}),y("stored provided peer record for ".concat(o.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(!s.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(!s.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,o=!1;try{const i=await m(e,t,this._addressFilter);if(!i.length)return;try{const t=await this._store.load(e);if(o=!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))}),o||this._emit("peer",e)}async add(e,t){if(!s.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,o;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}o=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:o.addresses.map((e=>e.multiaddr))}),n||this._emit("peer",e)}async delete(e){if(!s.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),o=r(2674),s=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 o(this.emit.bind(this),this._store,n),this.keyBook=new s(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:o}=r(59087),s=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(!s.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"),o.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"),o.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!==o.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(!s.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"),o.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!==o.ERR_NOT_FOUND)throw r}finally{c("get release write lock"),t()}}async delete(e){if(!s.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"),o.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:o}=r(59087),s=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(!s.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"),o.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!==o.ERR_NOT_FOUND)throw r}finally{c("get release read lock"),t()}return new Map}async getValue(e,t){if(!s.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"),o.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!==o.ERR_NOT_FOUND)throw n}finally{c("getValue release write lock"),r()}}async set(e,t){if(!s.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"),o.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"),o.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(!s.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"),o.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"),o.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(d){if(d.code!==o.ERR_NOT_FOUND)throw d}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(!s.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"),o.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(!s.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"),o.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!==o.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,o=n.Writer,s=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=s.emptyArray,e.prototype.protocols=s.emptyArray,e.prototype.metadata=s.emptyArray,e.prototype.pubKey=null,e.prototype.peerRecordEnvelope=null,Object.defineProperty(e.prototype,"_pubKey",{get:s.oneOfGetter(t=["pubKey"]),set:s.oneOfSetter(t)}),Object.defineProperty(e.prototype,"_peerRecordEnvelope",{get:s.oneOfGetter(t=["peerRecordEnvelope"]),set:s.oneOfSetter(t)}),e.encode=function(e,t){if(t||(t=o.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 o=e.uint32();switch(o>>>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&o)}}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?s.base64.decode(e.pubKey,t.pubKey=s.newBuffer(s.base64.length(e.pubKey)),0):e.pubKey.length&&(t.pubKey=e.pubKey)),null!=e.peerRecordEnvelope&&("string"===typeof e.peerRecordEnvelope?s.base64.decode(e.peerRecordEnvelope,t.peerRecordEnvelope=s.newBuffer(s.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?s.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?s.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=s.newBuffer([]),e.prototype.isCertified=null,Object.defineProperty(e.prototype,"_isCertified",{get:s.oneOfGetter(t=["isCertified"]),set:s.oneOfSetter(t)}),e.encode=function(e,t){return t||(t=o.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 o=e.uint32();switch(o>>>3){case 1:n.multiaddr=e.bytes();break;case 2:n.isCertified=e.bool();break;default:e.skipType(7&o)}}return n},e.fromObject=function(e){if(e instanceof a.Address)return e;var t=new a.Address;return null!=e.multiaddr&&("string"===typeof e.multiaddr?s.base64.decode(e.multiaddr,t.multiaddr=s.newBuffer(s.base64.length(e.multiaddr)),0):e.multiaddr.length&&(t.multiaddr=e.multiaddr)),null!=e.isCertified&&(t.isCertified=Boolean(e.isCertified)),t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(t.bytes===String?r.multiaddr="":(r.multiaddr=[],t.bytes!==Array&&(r.multiaddr=s.newBuffer(r.multiaddr)))),null!=e.multiaddr&&e.hasOwnProperty("multiaddr")&&(r.multiaddr=t.bytes===String?s.base64.encode(e.multiaddr,0,e.multiaddr.length):t.bytes===Array?Array.prototype.slice.call(e.multiaddr):e.multiaddr),null!=e.isCertified&&e.hasOwnProperty("isCertified")&&(r.isCertified=e.isCertified,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=s.newBuffer([]),e.encode=function(e,t){return t||(t=o.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 o=e.uint32();switch(o>>>3){case 1:n.key=e.string();break;case 2:n.value=e.bytes();break;default:e.skipType(7&o)}}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?s.base64.decode(e.value,t.value=s.newBuffer(s.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=s.newBuffer(r.value)))),null!=e.key&&e.hasOwnProperty("key")&&(r.key=e.key),null!=e.value&&e.hasOwnProperty("value")&&(r.value=t.bytes===String?s.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:o}=r(59087),s=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!==o.ERR_NOT_FOUND)throw r}finally{a("get release read lock"),t()}return[]}async set(e,t){if(!s.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"),o.ERR_INVALID_PARAMETERS);if(!Array.isArray(t))throw a.error("protocols must be provided to store data"),i(new Error("protocols must be provided"),o.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!==o.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(!s.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"),o.ERR_INVALID_PARAMETERS);if(!Array.isArray(t))throw a.error("protocols must be provided to store data"),i(new Error("protocols must be provided"),o.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!==o.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(!s.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"),o.ERR_INVALID_PARAMETERS);if(!Array.isArray(t))throw a.error("protocols must be provided to store data"),i(new Error("protocols must be provided"),o.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!==o.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!==o.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),o=r(67963),{codes:s}=r(59087),{Key:a}=r(3450),{base32:c}=r(71128),{keys:{unmarshalPublicKey:u,marshalPublicKey:l}}=r(25504),{Multiaddr:d}=r(98719),{Peer:h}=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"),o(new Error("peerId must be an instance of peer-id"),s.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=h.decode(t),n=r.pubKey?u(r.pubKey):e.pubKey,i=new Map;for(const o of r.metadata)i.set(o.key,o.value);return{...r,id:e,pubKey:n,addresses:r.addresses.map((e=>{let{multiaddr:t,isCertified:r}=e;return{multiaddr:new d(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"),o(new Error("publicKey bytes do not match peer id publicKey bytes"),s.ERR_INVALID_PARAMETERS);const t=new Set,r=h.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!==s.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!==s.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 d(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")}),o=r(67963),{codes:s}=r(59087),a=r(25504),{pipe:c}=r(79023),{toBuffer:u}=r(90351),{collect:l,take:d}=r(79755),{equals:h}=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),[b]=await c([m],n,(e=>d(1,e)),u,l),v=Date.now();if(!h(m,b))throw o(new Error("Received wrong ping ack"),s.ERR_WRONG_PING_ACK);return v-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,o=n.Writer,s=n.util,a=n.roots["libp2p-envelope"]||(n.roots["libp2p-envelope"]={});a.Envelope=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.publicKey=s.newBuffer([]),e.prototype.payloadType=s.newBuffer([]),e.prototype.payload=s.newBuffer([]),e.prototype.signature=s.newBuffer([]),e.encode=function(e,t){return t||(t=o.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 o=e.uint32();switch(o>>>3){case 1:n.publicKey=e.bytes();break;case 2:n.payloadType=e.bytes();break;case 3:n.payload=e.bytes();break;case 5:n.signature=e.bytes();break;default:e.skipType(7&o)}}return n},e.fromObject=function(e){if(e instanceof a.Envelope)return e;var t=new a.Envelope;return null!=e.publicKey&&("string"===typeof e.publicKey?s.base64.decode(e.publicKey,t.publicKey=s.newBuffer(s.base64.length(e.publicKey)),0):e.publicKey.length&&(t.publicKey=e.publicKey)),null!=e.payloadType&&("string"===typeof e.payloadType?s.base64.decode(e.payloadType,t.payloadType=s.newBuffer(s.base64.length(e.payloadType)),0):e.payloadType.length&&(t.payloadType=e.payloadType)),null!=e.payload&&("string"===typeof e.payload?s.base64.decode(e.payload,t.payload=s.newBuffer(s.base64.length(e.payload)),0):e.payload.length&&(t.payload=e.payload)),null!=e.signature&&("string"===typeof e.signature?s.base64.decode(e.signature,t.signature=s.newBuffer(s.base64.length(e.signature)),0):e.signature.length&&(t.signature=e.signature)),t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(t.bytes===String?r.publicKey="":(r.publicKey=[],t.bytes!==Array&&(r.publicKey=s.newBuffer(r.publicKey))),t.bytes===String?r.payloadType="":(r.payloadType=[],t.bytes!==Array&&(r.payloadType=s.newBuffer(r.payloadType))),t.bytes===String?r.payload="":(r.payload=[],t.bytes!==Array&&(r.payload=s.newBuffer(r.payload))),t.bytes===String?r.signature="":(r.signature=[],t.bytes!==Array&&(r.signature=s.newBuffer(r.signature)))),null!=e.publicKey&&e.hasOwnProperty("publicKey")&&(r.publicKey=t.bytes===String?s.base64.encode(e.publicKey,0,e.publicKey.length):t.bytes===Array?Array.prototype.slice.call(e.publicKey):e.publicKey),null!=e.payloadType&&e.hasOwnProperty("payloadType")&&(r.payloadType=t.bytes===String?s.base64.encode(e.payloadType,0,e.payloadType.length):t.bytes===Array?Array.prototype.slice.call(e.payloadType):e.payloadType),null!=e.payload&&e.hasOwnProperty("payload")&&(r.payload=t.bytes===String?s.base64.encode(e.payload,0,e.payload.length):t.bytes===Array?Array.prototype.slice.call(e.payload):e.payload),null!=e.signature&&e.hasOwnProperty("signature")&&(r.signature=t.bytes===String?s.base64.encode(e.signature,0,e.signature.length):t.bytes===Array?Array.prototype.slice.call(e.signature):e.signature),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,n.util.toJSONOptions)},e}(),e.exports=a},76869:(e,t,r)=>{"use strict";const n=r(67963),{concat:i}=r(62110),{fromString:o}=r(46765),s=r(36552),a=r(90190),c=r(74561),{equals:u}=r(98779),{codes:l}=r(59087),{Envelope:d}=r(91282);class h{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=s.marshalPublicKey(this.peerId.pubKey);return this._marshal=d.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=o(e),s=c.encode(n.byteLength),a=c.encode(t.length),u=c.encode(r.length);return i([new Uint8Array(s),n,new Uint8Array(a),t,new Uint8Array(u),r])};h.createFromProtobuf=async e=>{const t=d.decode(e),r=await a.createFromPubKey(t.publicKey);return new h({peerId:r,payloadType:t.payloadType,payload:t.payload,signature:t.signature})},h.seal=async(e,t)=>{const r=e.domain,n=e.codec,i=e.marshal(),o=f(r,n,i),s=await t.privKey.sign(o);return new h({peerId:t,payloadType:n,payload:i,signature:s})},h.openAndCertify=async(e,t)=>{const r=await h.createFromProtobuf(e);if(!await r.validate(t))throw n(new Error("envelope signature is not valid for the given domain"),l.ERR_SIGNATURE_NOT_VALID);return r},e.exports=h},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),o=r(80710),{PeerRecord:s}=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=s.encode({peerId:this.peerId.toBytes(),seq:this.seqNumber,addresses:this.multiaddrs.map((e=>({multiaddr:e.bytes})))}).finish()),this._marshal}equals(e){return e instanceof u&&(!!this.peerId.equals(e.peerId)&&(this.seqNumber===e.seqNumber&&!!o(this.multiaddrs,e.multiaddrs)))}}u.createFromProtobuf=e=>{const t=s.decode(e),r=i.createFromBytes(t.peerId),o=(t.addresses||[]).map((e=>new n(e.multiaddr))),a=Number(t.seq);return new u({peerId:r,multiaddrs:o,seqNumber:a})},u.DOMAIN=a,e.exports=u},73077:(e,t,r)=>{"use strict";var n=r(80886),i=n.Reader,o=n.Writer,s=n.util,a=n.roots["libp2p-peer-record"]||(n.roots["libp2p-peer-record"]={});a.PeerRecord=function(){function e(e){if(this.addresses=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.peerId=s.newBuffer([]),e.prototype.seq=s.Long?s.Long.fromBits(0,0,!0):0,e.prototype.addresses=s.emptyArray,e.encode=function(e,t){if(t||(t=o.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 o=e.uint32();switch(o>>>3){case 1:n.peerId=e.bytes();break;case 2:n.seq=e.uint64();break;case 3:n.addresses&&n.addresses.length||(n.addresses=[]),n.addresses.push(a.PeerRecord.AddressInfo.decode(e,e.uint32()));break;default:e.skipType(7&o)}}return n},e.fromObject=function(e){if(e instanceof a.PeerRecord)return e;var t=new a.PeerRecord;if(null!=e.peerId&&("string"===typeof e.peerId?s.base64.decode(e.peerId,t.peerId=s.newBuffer(s.base64.length(e.peerId)),0):e.peerId.length&&(t.peerId=e.peerId)),null!=e.seq&&(s.Long?(t.seq=s.Long.fromValue(e.seq)).unsigned=!0:"string"===typeof e.seq?t.seq=parseInt(e.seq,10):"number"===typeof e.seq?t.seq=e.seq:"object"===typeof e.seq&&(t.seq=new s.LongBits(e.seq.low>>>0,e.seq.high>>>0).toNumber(!0))),e.addresses){if(!Array.isArray(e.addresses))throw TypeError(".PeerRecord.addresses: array expected");t.addresses=[];for(var r=0;r<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=s.newBuffer(r.peerId))),s.Long){var n=new s.Long(0,0,!0);r.seq=t.longs===String?n.toString():t.longs===Number?n.toNumber():n}else r.seq=t.longs===String?"0":0;if(null!=e.peerId&&e.hasOwnProperty("peerId")&&(r.peerId=t.bytes===String?s.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?s.Long.prototype.toString.call(e.seq):t.longs===Number?new s.LongBits(e.seq.low>>>0,e.seq.high>>>0).toNumber(!0):e.seq),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=s.newBuffer([]),e.encode=function(e,t){return t||(t=o.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 o=e.uint32();if(o>>>3===1)n.multiaddr=e.bytes();else e.skipType(7&o)}return n},e.fromObject=function(e){if(e instanceof a.PeerRecord.AddressInfo)return e;var t=new a.PeerRecord.AddressInfo;return null!=e.multiaddr&&("string"===typeof e.multiaddr?s.base64.decode(e.multiaddr,t.multiaddr=s.newBuffer(s.base64.length(e.multiaddr)),0):e.multiaddr.length&&(t.multiaddr=e.multiaddr)),t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(t.bytes===String?r.multiaddr="":(r.multiaddr=[],t.bytes!==Array&&(r.multiaddr=s.newBuffer(r.multiaddr)))),null!=e.multiaddr&&e.hasOwnProperty("multiaddr")&&(r.multiaddr=t.bytes===String?s.base64.encode(e.multiaddr,0,e.multiaddr.length):t.bytes===Array?Array.prototype.slice.call(e.multiaddr):e.multiaddr),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,n.util.toJSONOptions)},e}(),e}(),e.exports=a},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")}),o=r(67963),{codes:{ERR_INVALID_PARAMETERS:s}}=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"),o(new Error("topology must be an instance of interfaces/topology"),s);const t=(1e9*Math.random()).toString(36)+Date.now();return this.topologies.set(t,e),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")}),o=r(3781),{codes:s}=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,"'")),s.ERR_INVALID_KEY);if(this._transports.has(e))throw a(new Error("There is already a transport with this key"),s.ERR_DUPLICATE_TRANSPORT);const n=new t({...r,libp2p:this.libp2p,upgrader:this.upgrader});this._transports.set(e,n),this._listenerOptions.set(e,r.listenerOptions||{}),this._listeners.has(e)||this._listeners.set(e,[])}async close(){const e=[];for(const[t,r]of this._listeners)for(i("closing listeners for %s",t);r.length;){const t=r.pop();t.removeAllListeners("listening"),t.removeAllListeners("close"),e.push(t.close())}await Promise.all(e),i("all listeners closed");for(const 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))),s.ERR_TRANSPORT_UNAVAILABLE);try{return await r.dial(e,t)}catch(n){throw n.code||(n.code=s.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),d=[];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))),d.push(t.listen(e))}if(0===d.length){t.push(r);continue}if(!(await o(d)).find((e=>!0===e.isFulfilled))&&this.faultTolerance!==l.NO_FATAL)throw a(new Error("Transport (".concat(r,") could not listen on any available address")),s.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),s.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")}),o=r(67963),s=r(5889),{Connection:a}=r(4438),c=r(90190),{pipe:u}=r(79023),l=r(486),{codes:d}=r(59087);e.exports=class{constructor(e){let{localPeer:t,metrics:r,connectionGater:n,cryptos:i=new Map,muxers:o=new Map,onConnectionEnd:s=(()=>{}),onConnection:a=(()=>{})}=e;this.connectionGater=n,this.localPeer=t,this.metrics=r,this.cryptos=i,this.muxers=o,this.protector=null,this.protocols=new Map,this.onConnection=a,this.onConnectionEnd=s}async upgradeInbound(e){let t,r,n,s,a,c,u;if(await this.connectionGater.denyInboundConnection(e))throw o(new Error("The multiaddr connection is blocked by gater.acceptConnection"),d.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 h=e;this.protector&&(h=await this.protector.protect(e));try{if(({conn:t,remotePeer:r,protocol:a}=await this._encryptInbound(this.localPeer,h,this.cryptos)),await this.connectionGater.denyInboundEncryptedConnection(r,t))throw o(new Error("The multiaddr connection is blocked by gater.acceptEncryptedConnection"),d.ERR_CONNECTION_INTERCEPTED);this.muxers.size?({stream:n,Muxer:s}=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 o(new Error("The multiaddr connection is blocked by gater.acceptEncryptedConnection"),d.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:s,remotePeer:r})}async upgradeOutbound(e){const t=e.remoteAddr.getPeerId();if(!t)throw o(new Error("outbound connection must have a peer id"),d.ERR_INVALID_MULTIADDR);const r=c.createFromB58String(t);if(await this.connectionGater.denyOutboundConnection(r,e))throw o(new Error("The multiaddr connection is blocked by connectionGater.denyOutboundConnection"),d.ERR_CONNECTION_INTERCEPTED);let n,s,a,u,h,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:s,protocol:u}=await this._encryptOutbound(this.localPeer,y,r,this.cryptos)),await this.connectionGater.denyOutboundEncryptedConnection(s,n))throw o(new Error("The multiaddr connection is blocked by gater.acceptEncryptedConnection"),d.ERR_CONNECTION_INTERCEPTED);this.muxers.size?({stream:a,Muxer:h}=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(s,n))throw o(new Error("The multiaddr connection is blocked by gater.acceptEncryptedConnection"),d.ERR_CONNECTION_INTERCEPTED);return this.metrics&&(this.metrics.updatePlaceholder(p,s),f(s)),i("Successfully upgraded outbound connection"),this._createConnection({cryptoProtocol:u,direction:"outbound",maConn:e,upgradedConn:a,Muxer:h,remotePeer:s})}_createConnection(e){var t=this;let r,n,c,{cryptoProtocol:l,direction:h,maConn:f,upgradedConn:p,Muxer:y,remotePeer:g}=e;y&&(r=new y({onStream:async e=>{if(!c)return;const t=new s.Listener(e);try{const{stream:r,protocol:n}=await t.handle(Array.from(this.protocols.keys()));i("%s: incoming stream opened on %s",h,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",h,e);const t=r.newStream(),n=new s.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),o(a,d.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 b=()=>{throw o(new Error("connection is not multiplexed"),d.ERR_CONNECTION_NOT_MULTIPLEXED)};return c=new a({localAddr:f.localAddr,remoteAddr:f.remoteAddr,localPeer:this.localPeer,remotePeer:g,stat:{direction:h,timeline:f.timeline,multiplexer:y&&y.multicodec,encryption:l},newStream:n||b,getStreams:()=>r?r.streams:b(),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 s.Listener(t),a=Array.from(r.keys());i("handling inbound crypto protocol selection",a);try{const{stream:t,protocol:o}=await n.handle(a),s=r.get(o);if(i("encrypting inbound connection..."),!s)throw new Error("no crypto module found for ".concat(o));return{...await s.secureInbound(e,t),protocol:o}}catch(c){throw o(c,d.ERR_ENCRYPTION_FAILED)}}async _encryptOutbound(e,t,r,n){const a=new s.Dialer(t),c=Array.from(n.keys());i("selecting outbound crypto protocol",c);try{const{stream:t,protocol:o}=await a.select(c),s=n.get(o);if(i("encrypting outbound connection to %j",r),!s)throw new Error("no crypto module found for ".concat(o));return{...await s.secureOutbound(e,t,r),protocol:o}}catch(u){throw o(u,d.ERR_ENCRYPTION_FAILED)}}async _multiplexOutbound(e,t){const r=new s.Dialer(e),n=Array.from(t.keys());i("outbound selecting muxer %s",n);try{const{stream:e,protocol:o}=await r.select(n);i("%s selected as muxer protocol",o);return{stream:e,Muxer:t.get(o)}}catch(a){throw o(a,d.ERR_MUXER_UNAVAILABLE)}}async _multiplexInbound(e,t){const r=new s.Listener(e),n=Array.from(t.keys());i("inbound handling muxers %s",n);try{const{stream:e,protocol:i}=await r.handle(n);return{stream:e,Muxer:t.get(i)}}catch(a){throw o(a,d.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(A){}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={},o={};function s(e,t){var r,n,s;return t?(s=0<=(e>>>=0)&&e<256)&&(n=o[e])?n:(r=c(e,(0|e)<0?-1:0,!0),s&&(o[e]=r),r):(s=-128<=(e|=0)&&e<128)&&(n=i[e])?n:(r=c(e,e<0?-1:0,!1),s&&(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 _}else{if(e<=-p)return S;if(e+1>=p)return E}return e<0?a(-e,t).neg():c(e%h|0,e/h|0,t)}function c(e,t,n){return new r(e,t,n)}r.fromInt=s,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)),o=g,s=0;s<e.length;s+=8){var c=Math.min(8,e.length-s),d=parseInt(e.substring(s,s+c),r);if(c<8){var h=a(u(r,c));o=o.mul(h).add(a(d))}else o=(o=o.mul(i)).add(a(d))}return o.unsigned=t,o}function d(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=d;var h=4294967296,f=h*h,p=f/2,y=s(1<<24),g=s(0);r.ZERO=g;var m=s(0,!0);r.UZERO=m;var b=s(1);r.ONE=b;var v=s(1,!0);r.UONE=v;var w=s(-1);r.NEG_ONE=w;var E=c(-1,2147483647,!1);r.MAX_VALUE=E;var _=c(-1,-1,!0);r.MAX_UNSIGNED_VALUE=_;var S=c(0,-2147483648,!1);r.MIN_VALUE=S;var I=r.prototype;I.toInt=function(){return this.unsigned?this.low>>>0:this.low},I.toNumber=function(){return this.unsigned?(this.high>>>0)*h+(this.low>>>0):this.high*h+(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(S)){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),o=this,s="";;){var c=o.div(i),l=(o.sub(c.mul(i)).toInt()>>>0).toString(e);if((o=c).isZero())return l+s;for(;l.length<6;)l="0"+l;s=""+l+s}},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(S)?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=d(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=d(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(S)?S:this.not().add(b)},I.neg=I.negate,I.add=function(e){n(e)||(e=d(e));var t=this.high>>>16,r=65535&this.high,i=this.low>>>16,o=65535&this.low,s=e.high>>>16,a=65535&e.high,u=e.low>>>16,l=0,h=0,f=0,p=0;return f+=(p+=o+(65535&e.low))>>>16,h+=(f+=i+u)>>>16,l+=(h+=r+a)>>>16,l+=t+s,c((f&=65535)<<16|(p&=65535),(l&=65535)<<16|(h&=65535),this.unsigned)},I.subtract=function(e){return n(e)||(e=d(e)),this.add(e.neg())},I.sub=I.subtract,I.multiply=function(e){if(this.isZero())return g;if(n(e)||(e=d(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(S))return e.isOdd()?S:g;if(e.eq(S))return this.isOdd()?S: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,o=this.low>>>16,s=65535&this.low,u=e.high>>>16,l=65535&e.high,h=e.low>>>16,f=65535&e.low,p=0,m=0,b=0,v=0;return b+=(v+=s*f)>>>16,m+=(b+=o*f)>>>16,b&=65535,m+=(b+=s*h)>>>16,p+=(m+=i*f)>>>16,m&=65535,p+=(m+=o*h)>>>16,m&=65535,p+=(m+=s*l)>>>16,p+=r*f+i*h+o*l+s*u,c((b&=65535)<<16|(v&=65535),(p&=65535)<<16|(m&=65535),this.unsigned)},I.mul=I.multiply,I.divide=function(e){if(n(e)||(e=d(e)),e.isZero())throw Error("division by zero");var r,i,o;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 v;o=m}else{if(this.eq(S))return e.eq(b)||e.eq(w)?S:e.eq(S)?b:(r=this.shr(1).div(e).shl(1)).eq(g)?e.isNegative()?b:w:(i=this.sub(e.mul(r)),o=r.add(i.div(e)));if(e.eq(S))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();o=g}for(i=this;i.gte(e);){r=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var s=Math.ceil(Math.log(r)/Math.LN2),l=s<=48?1:u(2,s-48),h=a(r),f=h.mul(e);f.isNegative()||f.gt(i);)f=(h=a(r-=l,this.unsigned)).mul(e);h.isZero()&&(h=b),o=o.add(h),i=i.sub(f)}return o},I.div=I.divide,I.modulo=function(e){return n(e)||(e=d(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=d(e)),c(this.low&e.low,this.high&e.high,this.unsigned)},I.or=function(e){return n(e)||(e=d(e)),c(this.low|e.low,this.high|e.high,this.unsigned)},I.xor=function(e){return n(e)||(e=d(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"),o=k("dns6"),s=k("dnsaddr"),a=P(k("dns"),s,i,o),c=P(k("ip4"),k("ip6")),u=P(C(c,k("tcp")),C(a,k("tcp"))),l=C(c,k("udp")),d=C(l,k("utp")),h=C(l,k("quic")),f=P(C(u,k("ws")),C(a,k("ws"))),p=P(C(u,k("wss")),C(a,k("wss"))),y=P(C(u,k("http")),C(c,k("http")),C(a,k("http"))),g=P(C(u,k("https")),C(c,k("https")),C(a,k("https"))),m=P(C(f,k("p2p-webrtc-star"),k("p2p")),C(p,k("p2p-webrtc-star"),k("p2p")),C(f,k("p2p-webrtc-star")),C(p,k("p2p-webrtc-star"))),b=P(C(f,k("p2p-websocket-star"),k("p2p")),C(p,k("p2p-websocket-star"),k("p2p")),C(f,k("p2p-websocket-star")),C(p,k("p2p-websocket-star"))),v=P(C(y,k("p2p-webrtc-direct"),k("p2p")),C(g,k("p2p-webrtc-direct"),k("p2p")),C(y,k("p2p-webrtc-direct")),C(g,k("p2p-webrtc-direct"))),w=P(f,p,y,g,m,v,u,d,h,a),E=P(C(w,k("p2p-stardust"),k("p2p")),C(w,k("p2p-stardust"))),_=P(C(w,k("p2p")),m,v,k("p2p")),S=P(C(_,k("p2p-circuit"),_),C(_,k("p2p-circuit")),C(k("p2p-circuit"),_),C(w,k("p2p-circuit")),C(k("p2p-circuit"),w),k("p2p-circuit")),I=()=>P(C(S,I),S),A=I(),R=P(C(A,_,A),C(_,A),C(A,_),A,_);function T(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 C(){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:T(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:T(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(o){return!1}else r=e;const i=r.protoNames();return 1===i.length&&i[0]===t},partialMatch:function(e){return 0===e.length?null:e[0]===t?e.slice(1):null}}}e.exports={DNS:a,DNS4:i,DNS6:o,DNSADDR:s,IP:c,TCP:u,UDP:l,QUIC:h,UTP:d,HTTP:y,HTTPS:g,WebSockets:f,WebSocketsSecure:p,WebSocketStar:b,WebRTCStar:m,WebRTCDirect:v,Reliable:w,Stardust:E,Circuit:A,P2P:R,IPFS:R}},89842:function(e,t,r){"use strict";const n=r(41288),{hasOwnProperty:i}=Object.prototype,{propertyIsEnumerable:o}=Object,s=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0}),a=this,c={concatArrays:!1,ignoreUndefined:!1},u=e=>{const t=[];for(const r in e)i.call(e,r)&&t.push(r);if(Object.getOwnPropertySymbols){const r=Object.getOwnPropertySymbols(e);for(const n of r)o.call(e,n)&&t.push(n)}return t};function l(e){return Array.isArray(e)?function(e){const t=e.slice(0,0);return u(e).forEach((r=>{s(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=>{s(t,r,l(e[r]))})),t}(e):e}const d=(e,t,r,n)=>(r.forEach((r=>{"undefined"===typeof t[r]&&n.ignoreUndefined||(r in e&&e[r]!==Object.getPrototypeOf(e)?s(e,r,h(e[r],t[r],n)):s(e,r,l(t[r])))})),e);function h(e,t,r){return r.concatArrays&&Array.isArray(e)&&Array.isArray(t)?((e,t,r)=>{let n=e.slice(0,0),o=0;return[e,t].forEach((t=>{const a=[];for(let r=0;r<t.length;r++)i.call(t,r)&&(a.push(String(r)),s(n,o++,t===e?t[r]:l(t[r])));n=d(n,t,u(t).filter((e=>!a.includes(e))),r)})),n})(e,t,r):n(t)&&n(e)?d(e,t,u(t),r):l(t)}e.exports=function(){const e=h(l(c),this!==a&&this||{},c);let t={_:{}};for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];for(const s of i)if(void 0!==s){if(!n(s))throw new TypeError("`"+s+"` is not an Option Object");t=h(t,{_:s},e)}return t._}},80842:(e,t,r)=>{const n=r(47465).EventEmitter,{nanoid:i}=r(422),{WORKER_REQUEST_READ_LOCK:o,WORKER_RELEASE_READ_LOCK:s,MASTER_GRANT_READ_LOCK:a,WORKER_REQUEST_WRITE_LOCK:c,WORKER_RELEASE_WRITE_LOCK:u,MASTER_GRANT_WRITE_LOCK:l}=r(20185),d=r(85913),h=(e,t,r,n,i)=>(o,s)=>{if(!s||!s.data||s.data.type!==r)return;const a={type:s.data.type,name:s.data.name,identifier:s.data.identifier};e.emit(t,a.name,(()=>(o.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&&(o.removeEventListener("message",t),e())};o.addEventListener("message",t)})))))},f=(e,t,r,n)=>()=>{const o=i();return globalThis.postMessage({type:t,identifier:o,name:e}),new Promise((t=>{const i=s=>{if(!s||!s.data)return;const a={type:s.data.type,identifier:s.data.identifier};a&&a.type===r&&a.identifier===o&&(globalThis.removeEventListener("message",i),t((()=>{globalThis.postMessage({type:n,identifier:o,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 d.addEventListener("message",h(e,"requestReadLock",o,s,a)),d.addEventListener("message",h(e,"requestWriteLock",c,u,l)),e}return{isWorker:!0,readLock:e=>f(e,o,a,s),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:o}=r(12906),{timeout:s}=r(58541),a=r(85913),c={};let u;function l(e,t){let r;const n=new Promise((e=>{r=e}));return e.add((()=>s(new Promise((e=>{r((()=>{e()}))})),t.timeout))),n}const d={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({},d,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 o({concurrency:1});let n=null;return{readLock:()=>{if(n)return l(n,t);n=new o({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:o}=r(422),{WORKER_REQUEST_READ_LOCK:s,WORKER_RELEASE_READ_LOCK:a,MASTER_GRANT_READ_LOCK:c,WORKER_REQUEST_WRITE_LOCK:u,WORKER_RELEASE_WRITE_LOCK:l,MASTER_GRANT_WRITE_LOCK:d}=r(20185);let h;const f=(e,t,r,n,i)=>(o,s)=>{s&&s.type===r&&e.emit(t,s.name,(()=>(o.send({type:i,name:s.name,identifier:s.identifier}),new Promise((e=>{const t=r=>{r&&r.type===n&&r.identifier===s.identifier&&(o.removeListener("message",t),e())};o.on("message",t)})))))},p=(e,t,r,i)=>()=>{const s=o();return n.send({type:t,identifier:s,name:e}),new Promise((t=>{const o=a=>{a&&a.type===r&&a.identifier===s&&(n.removeListener("message",o),t((()=>{n.send({type:i,identifier:s,name:e})})))};n.on("message",o)}))};e.exports=e=>{try{if(h=r(21724),!Object.keys(h).length)return}catch(t){return}if(h.isMaster||e.singleProcess){const e=new i;return h.on("message",f(e,"requestReadLock",s,a,c)),h.on("message",f(e,"requestWriteLock",u,l,d)),e}return{isWorker:!0,readLock:e=>p(e,s,c,a),writeLock:e=>p(e,u,d,l)}}},78193:e=>{var t=1e3,r=60*t,n=60*r,i=24*n,o=7*i,s=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*s;case"weeks":case"week":case"w":return c*o;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 o=Math.abs(e);if(o>=i)return a(e,o,i,"day");if(o>=n)return a(e,o,n,"hour");if(o>=r)return a(e,o,r,"minute");if(o>=t)return a(e,o,t,"second");return e+" ms"}(e):function(e){var o=Math.abs(e);if(o>=i)return Math.round(e/i)+"d";if(o>=n)return Math.round(e/n)+"h";if(o>=r)return Math.round(e/r)+"m";if(o>=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,o={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",o=":".concat(t);return"tcp"===r[r.length-1].protocol&&(i="443"===t?"https":"http",o="443"===t||"80"===t?"":o),"".concat(i,"://").concat(e).concat(o)})(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 s=o[r.protocol];if(!s)throw new Error("Unsupported protocol ".concat(r.protocol));return s(e,r.content,n,i,t)}),"")}},63058:(e,t,r)=>{"use strict";const n=r(93516),i=r(70023),o=r(74561),{concat:s}=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 o=r[n],s=i(o);if(0!==s.size){if(n++,n>=r.length)throw v("invalid address: "+e);if(s.path){t.push([o,b(r.slice(n).join("/"))]);break}t.push([o,r[n]])}else t.push([o])}return t}function u(e){const t=[];return e.map((e=>{const r=w(e);return t.push(r.name),e.length>1&&t.push(e[1]),null})),b(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 d(e){return e.map((e=>{const t=w(e);return e[1]?[t.code,n.toString(t.code,e[1])]:[t.code]}))}function h(e){return g(s(e.map((e=>{const t=w(e);let r=Uint8Array.from(o.encode(t.code));return e.length>1&&(r=s([r,e[1]])),r}))))}function f(e,t){if(e.size>0)return e.size/8;if(0===e.size)return 0;return o.decode(t)+o.decode.bytes}function p(e){const t=[];let r=0;for(;r<e.length;){const n=o.decode(e,r),s=o.decode.bytes,c=f(i(n),e.slice(r+s));if(0===c){t.push([n]),r+=s;continue}const u=e.slice(r+s,r+s+c);if(r+=c+s,r>e.length)throw v("Invalid address Uint8Array: "+a(e,"base16"));t.push([n,u])}return t}function y(e){return h(l(c(e=b(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 b(e){return"/"+e.trim().split("/").filter((e=>e)).join("/")}function v(e){return new Error("Error parsing address: "+e)}function w(e){return i(e[0])}e.exports={stringToStringTuples:c,stringTuplesToString:u,tuplesToStringTuples:d,stringTuplesToTuples:l,bytesToTuples:p,tuplesToBytes:h,bytesToString:function(e){const t=p(e);return u(d(t))},stringToBytes:y,fromString:function(e){return y(e)},fromBytes:g,validateBytes:m,isValidBytes:function(e){return void 0===m(e)},cleanPath:b,ParseError:v,protoFromTuple:w,sizeForAddr:f}},93516:(e,t,r)=>{"use strict";const n=r(99745),i=r(70023),{CID:o}=r(16629),{base32:s}=r(71128),{base58btc:a}=r(86898),c=r(8315),u=r(74561),{toString:l}=r(82051),{fromString:d}=r(46765),{concat:h}=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=d(e),r=Uint8Array.from(u.encode(t.length));return h([r,t],r.length+t.length)}(t);case 421:return function(e){let t;t="Q"===e[0]||"1"===e[0]?c.decode(a.decode("z".concat(e))).bytes:o.parse(e).multihash.bytes;const r=Uint8Array.from(u.encode(t.length));return h([r,t],r.length+t.length)}(t);case 444:return function(e){const t=e.split(":");if(2!==t.length)throw new Error("failed to parse onion addr: "+t+" does not contain a port number");if(16!==t[0].length)throw new Error("failed to parse onion addr: "+t[0]+" not a Tor onion address.");const r=s.decode("b"+t[0]),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");const i=y(n);return h([r,i],r.length+i.length)}(t);case 445:return function(e){const t=e.split(":");if(2!==t.length)throw new Error("failed to parse onion addr: "+t+" does not contain a port number");if(56!==t[0].length)throw new Error("failed to parse onion addr: "+t[0]+" not a Tor onion3 address.");const r=s.decode("b"+t[0]),n=parseInt(t[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");const i=y(n);return h([r,i],r.length+i.length)}(t);default:return d(t,"base16")}}},98719:(e,t,r)=>{"use strict";const n=r(63058),i=r(70023),o=r(74561),{CID:s}=r(16629),{base58btc:a}=r(86898),c=r(67963),u=Symbol.for("nodejs.util.inspect.custom"),{toString:l}=r(82051),{equals:d}=r(98779),h=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 s=o.decode(t,r),a=o.decode.bytes,c=i(s);r+=n.sizeForAddr(c,t.slice(r+a))+a,e.push(s)}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(s.parse(e).multihash.bytes,"base58btc")}return null}catch(e){return null}}getPath(){let e=null;try{e=this.stringTuples().filter((e=>!!i(e[0]).path))[0][1],e||(e=null)}catch(t){e=null}return e}equals(e){return d(this.bytes,e.bytes)}async resolve(){const e=this.protos().find((e=>e.resolvable));if(!e)return[this];const t=h.get(e.name);if(!t)throw c(new Error("no available resolver for ".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=h,e.exports={Multiaddr:p,multiaddr:function(e){return new p(e)},protocols:i,resolvers:h}},99745:(e,t,r)=>{"use strict";const n=r(62795),{toString:i}=r(82051),o=n,s=n.v4,a=n.v6,c=function(e,t,r){let n;if(r=~~r,s(e))n=t||new Uint8Array(r+4),e.split(/\./g).map((function(e){n[r++]=255&parseInt(e,10)}));else if(a(e)){const o=e.split(":",8);let a;for(a=0;a<o.length;a++){let e;s(o[a])&&(e=c(o[a]),o[a]=i(e.slice(0,2),"base16")),e&&++a<8&&o.splice(a,0,i(e.slice(2,4),"base16"))}if(""===o[0])for(;o.length<8;)o.unshift("0");else if(""===o[o.length-1])for(;o.length<8;)o.push("0");else if(o.length<8){for(a=0;a<o.length&&""!==o[a];a++);const e=[a,"1"];for(a=9-o.length;a>0;a--)e.push("0");o.splice.apply(o,e)}for(n=t||new Uint8Array(r+16),a=0;a<o.length;a++){const e=parseInt(o[a],16);n[r++]=e>>8&255,n[r++]=255&e}}if(!n)throw Error("Invalid ip address: "+e);return n};e.exports={isIP:o,isV4:s,isV6:a,toBytes:c,toString:function(e,t,r){t=~~t,r=r||e.length-t;const n=[];let i;const o=new DataView(e.buffer);if(4===r){for(let i=0;i<r;i++)n.push(e[t+i]);i=n.join(".")}else if(16===r){for(let e=0;e<r;e+=2)n.push(o.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(),[,o]=e.stringTuples().find((e=>{let[t]=e;return t===i}))||[];let s=(await t.resolveTxt("_dnsaddr.".concat(o))).flat().map((e=>e.split("=")[1]));return n&&(s=s.filter((e=>e.includes(n)))),s}}},33543:(e,t,r)=>{"use strict";const{encodeText:n}=r(61348);e.exports=class{constructor(e,t,r,i){this.name=e,this.code=t,this.codeBuf=n(this.code),this.alphabet=i,this.codec=r(i)}encode(e){return this.codec.encode(e)}decode(e){for(const t of e)if(this.alphabet&&this.alphabet.indexOf(t)<0)throw new Error("invalid character '".concat(t,"' in '").concat(e,"'"));return this.codec.decode(e)}}},39213:(e,t,r)=>{"use strict";const n=r(19814),i=r(33543),{rfc4648:o}=r(31186),{decodeText:s,encodeText:a}=r(61348),c=[["identity","\0",()=>({encode:s,decode:a}),""],["base2","0",o(1),"01"],["base8","7",o(3),"01234567"],["base10","9",n,"0123456789"],["base16","f",o(4),"0123456789abcdef"],["base16upper","F",o(4),"0123456789ABCDEF"],["base32hex","v",o(5),"0123456789abcdefghijklmnopqrstuv"],["base32hexupper","V",o(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV"],["base32hexpad","t",o(5),"0123456789abcdefghijklmnopqrstuv="],["base32hexpadupper","T",o(5),"0123456789ABCDEFGHIJKLMNOPQRSTUV="],["base32","b",o(5),"abcdefghijklmnopqrstuvwxyz234567"],["base32upper","B",o(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"],["base32pad","c",o(5),"abcdefghijklmnopqrstuvwxyz234567="],["base32padupper","C",o(5),"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567="],["base32z","h",o(5),"ybndrfg8ejkmcpqxot1uwisza345h769"],["base36","k",n,"0123456789abcdefghijklmnopqrstuvwxyz"],["base36upper","K",n,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"],["base58btc","z",n,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],["base58flickr","Z",n,"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"],["base64","m",o(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],["base64pad","M",o(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],["base64url","u",o(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"],["base64urlpad","U",o(6),"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="]],u=c.reduce(((e,t)=>(e[t[0]]=new i(t[0],t[1],t[2],t[3]),e)),{}),l=c.reduce(((e,t)=>(e[t[1]]=u[t[0]],e)),{});e.exports={names:u,codes:l}},80141:(e,t,r)=>{"use strict";const n=r(39213),{encodeText:i,decodeText:o,concat:s}=r(61348);function a(e){if(Object.prototype.hasOwnProperty.call(n.names,e))return n.names[e];if(Object.prototype.hasOwnProperty.call(n.codes,e))return n.codes[e];throw new Error("Unsupported encoding: ".concat(e))}(t=e.exports=function(e,t){if(!t)throw new Error("requires an encoded Uint8Array");const{name:r,codeBuf:n}=a(e);return function(e,t){a(e).decode(o(t))}(r,t),s([n,t],n.length+t.length)}).encode=function(e,t){const r=a(e),n=i(r.encode(t));return s([r.codeBuf,n],r.codeBuf.length+n.length)},t.decode=function(e){e instanceof Uint8Array&&(e=o(e));const t=e[0];return["f","F","v","V","t","T","b","B","c","C","h","k","K"].includes(t)&&(e=e.toLowerCase()),a(e[0]).decode(e.substring(1))},t.isEncoded=function(e){if(e instanceof Uint8Array&&(e=o(e)),"[object String]"!==Object.prototype.toString.call(e))return!1;try{return a(e[0]).name}catch(t){return!1}},t.encoding=a,t.encodingFromData=function(e){return e instanceof Uint8Array&&(e=o(e)),a(e[0])};const c=Object.freeze(n.names),u=Object.freeze(n.codes);t.names=c,t.codes=u},31186:e=>{"use strict";e.exports={rfc4648:e=>t=>({encode:r=>((e,t,r)=>{const n="="===t[t.length-1],i=(1<<r)-1;let o="",s=0,a=0;for(let c=0;c<e.length;++c)for(a=a<<8|e[c],s+=8;s>r;)s-=r,o+=t[i&a>>s];if(s&&(o+=t[i&a<<r-s]),n)for(;o.length*r&7;)o+="=";return o})(r,t,e),decode:r=>((e,t,r)=>{const n={};for(let u=0;u<t.length;++u)n[t[u]]=u;let i=e.length;for(;"="===e[i-1];)--i;const o=new Uint8Array(i*r/8|0);let s=0,a=0,c=0;for(let u=0;u<i;++u){const t=n[e[u]];if(void 0===t)throw new SyntaxError("Invalid character "+e[u]);a=a<<r|t,s+=r,s>=8&&(s-=8,o[c++]=255&a>>s)}if(s>=r||255&a<<8-s)throw new SyntaxError("Unexpected end of data");return o})(r,t,e)})}},61348:e=>{"use strict";const t=new TextDecoder,r=new TextEncoder;e.exports={decodeText:e=>t.decode(e),encodeText:e=>r.encode(e),concat:function(e,t){const r=new Uint8Array(t);let n=0;for(const i of e)r.set(i,n),n+=i.length;return r}}},2044:e=>{e.exports=function e(t,r){var n,i=0,o=0,s=r=r||0,a=t.length;do{if(s>=a)throw e.bytes=0,new RangeError("Could not decode varint");n=t[s++],i+=o<28?(127&n)<<o:(127&n)*Math.pow(2,o),o+=7}while(n>=128);return e.bytes=s-r,i}},36076:e=>{e.exports=function e(r,n,i){n=n||[];var o=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-o+1,n};var t=Math.pow(2,31)},36414:(e,t,r)=>{e.exports={encode:r(36076),decode:r(2044),encodingLength:r(5592)}},5592:e=>{var t=Math.pow(2,7),r=Math.pow(2,14),n=Math.pow(2,21),i=Math.pow(2,28),o=Math.pow(2,35),s=Math.pow(2,42),a=Math.pow(2,49),c=Math.pow(2,56),u=Math.pow(2,63);e.exports=function(e){return e<t?1:e<r?2:e<n?3:e<i?4:e<o?5:e<s?6:e<a?7:e<c?8:e<u?9:10}},58280:e=>{"use strict";const t=Object.freeze({identity:0,sha1:17,"sha2-256":18,"sha2-512":19,"sha3-512":20,"sha3-384":21,"sha3-256":22,"sha3-224":23,"shake-128":24,"shake-256":25,"keccak-224":26,"keccak-256":27,"keccak-384":28,"keccak-512":29,blake3:30,"murmur3-128":34,"murmur3-32":35,"dbl-sha2-256":86,md4:212,md5:213,bmt:214,"sha2-256-trunc254-padded":4114,"ripemd-128":4178,"ripemd-160":4179,"ripemd-256":4180,"ripemd-320":4181,x11:4352,kangarootwelve:7425,"sm3-256":21325,"blake2b-8":45569,"blake2b-16":45570,"blake2b-24":45571,"blake2b-32":45572,"blake2b-40":45573,"blake2b-48":45574,"blake2b-56":45575,"blake2b-64":45576,"blake2b-72":45577,"blake2b-80":45578,"blake2b-88":45579,"blake2b-96":45580,"blake2b-104":45581,"blake2b-112":45582,"blake2b-120":45583,"blake2b-128":45584,"blake2b-136":45585,"blake2b-144":45586,"blake2b-152":45587,"blake2b-160":45588,"blake2b-168":45589,"blake2b-176":45590,"blake2b-184":45591,"blake2b-192":45592,"blake2b-200":45593,"blake2b-208":45594,"blake2b-216":45595,"blake2b-224":45596,"blake2b-232":45597,"blake2b-240":45598,"blake2b-248":45599,"blake2b-256":45600,"blake2b-264":45601,"blake2b-272":45602,"blake2b-280":45603,"blake2b-288":45604,"blake2b-296":45605,"blake2b-304":45606,"blake2b-312":45607,"blake2b-320":45608,"blake2b-328":45609,"blake2b-336":45610,"blake2b-344":45611,"blake2b-352":45612,"blake2b-360":45613,"blake2b-368":45614,"blake2b-376":45615,"blake2b-384":45616,"blake2b-392":45617,"blake2b-400":45618,"blake2b-408":45619,"blake2b-416":45620,"blake2b-424":45621,"blake2b-432":45622,"blake2b-440":45623,"blake2b-448":45624,"blake2b-456":45625,"blake2b-464":45626,"blake2b-472":45627,"blake2b-480":45628,"blake2b-488":45629,"blake2b-496":45630,"blake2b-504":45631,"blake2b-512":45632,"blake2s-8":45633,"blake2s-16":45634,"blake2s-24":45635,"blake2s-32":45636,"blake2s-40":45637,"blake2s-48":45638,"blake2s-56":45639,"blake2s-64":45640,"blake2s-72":45641,"blake2s-80":45642,"blake2s-88":45643,"blake2s-96":45644,"blake2s-104":45645,"blake2s-112":45646,"blake2s-120":45647,"blake2s-128":45648,"blake2s-136":45649,"blake2s-144":45650,"blake2s-152":45651,"blake2s-160":45652,"blake2s-168":45653,"blake2s-176":45654,"blake2s-184":45655,"blake2s-192":45656,"blake2s-200":45657,"blake2s-208":45658,"blake2s-216":45659,"blake2s-224":45660,"blake2s-232":45661,"blake2s-240":45662,"blake2s-248":45663,"blake2s-256":45664,"skein256-8":45825,"skein256-16":45826,"skein256-24":45827,"skein256-32":45828,"skein256-40":45829,"skein256-48":45830,"skein256-56":45831,"skein256-64":45832,"skein256-72":45833,"skein256-80":45834,"skein256-88":45835,"skein256-96":45836,"skein256-104":45837,"skein256-112":45838,"skein256-120":45839,"skein256-128":45840,"skein256-136":45841,"skein256-144":45842,"skein256-152":45843,"skein256-160":45844,"skein256-168":45845,"skein256-176":45846,"skein256-184":45847,"skein256-192":45848,"skein256-200":45849,"skein256-208":45850,"skein256-216":45851,"skein256-224":45852,"skein256-232":45853,"skein256-240":45854,"skein256-248":45855,"skein256-256":45856,"skein512-8":45857,"skein512-16":45858,"skein512-24":45859,"skein512-32":45860,"skein512-40":45861,"skein512-48":45862,"skein512-56":45863,"skein512-64":45864,"skein512-72":45865,"skein512-80":45866,"skein512-88":45867,"skein512-96":45868,"skein512-104":45869,"skein512-112":45870,"skein512-120":45871,"skein512-128":45872,"skein512-136":45873,"skein512-144":45874,"skein512-152":45875,"skein512-160":45876,"skein512-168":45877,"skein512-176":45878,"skein512-184":45879,"skein512-192":45880,"skein512-200":45881,"skein512-208":45882,"skein512-216":45883,"skein512-224":45884,"skein512-232":45885,"skein512-240":45886,"skein512-248":45887,"skein512-256":45888,"skein512-264":45889,"skein512-272":45890,"skein512-280":45891,"skein512-288":45892,"skein512-296":45893,"skein512-304":45894,"skein512-312":45895,"skein512-320":45896,"skein512-328":45897,"skein512-336":45898,"skein512-344":45899,"skein512-352":45900,"skein512-360":45901,"skein512-368":45902,"skein512-376":45903,"skein512-384":45904,"skein512-392":45905,"skein512-400":45906,"skein512-408":45907,"skein512-416":45908,"skein512-424":45909,"skein512-432":45910,"skein512-440":45911,"skein512-448":45912,"skein512-456":45913,"skein512-464":45914,"skein512-472":45915,"skein512-480":45916,"skein512-488":45917,"skein512-496":45918,"skein512-504":45919,"skein512-512":45920,"skein1024-8":45921,"skein1024-16":45922,"skein1024-24":45923,"skein1024-32":45924,"skein1024-40":45925,"skein1024-48":45926,"skein1024-56":45927,"skein1024-64":45928,"skein1024-72":45929,"skein1024-80":45930,"skein1024-88":45931,"skein1024-96":45932,"skein1024-104":45933,"skein1024-112":45934,"skein1024-120":45935,"skein1024-128":45936,"skein1024-136":45937,"skein1024-144":45938,"skein1024-152":45939,"skein1024-160":45940,"skein1024-168":45941,"skein1024-176":45942,"skein1024-184":45943,"skein1024-192":45944,"skein1024-200":45945,"skein1024-208":45946,"skein1024-216":45947,"skein1024-224":45948,"skein1024-232":45949,"skein1024-240":45950,"skein1024-248":45951,"skein1024-256":45952,"skein1024-264":45953,"skein1024-272":45954,"skein1024-280":45955,"skein1024-288":45956,"skein1024-296":45957,"skein1024-304":45958,"skein1024-312":45959,"skein1024-320":45960,"skein1024-328":45961,"skein1024-336":45962,"skein1024-344":45963,"skein1024-352":45964,"skein1024-360":45965,"skein1024-368":45966,"skein1024-376":45967,"skein1024-384":45968,"skein1024-392":45969,"skein1024-400":45970,"skein1024-408":45971,"skein1024-416":45972,"skein1024-424":45973,"skein1024-432":45974,"skein1024-440":45975,"skein1024-448":45976,"skein1024-456":45977,"skein1024-464":45978,"skein1024-472":45979,"skein1024-480":45980,"skein1024-488":45981,"skein1024-496":45982,"skein1024-504":45983,"skein1024-512":45984,"skein1024-520":45985,"skein1024-528":45986,"skein1024-536":45987,"skein1024-544":45988,"skein1024-552":45989,"skein1024-560":45990,"skein1024-568":45991,"skein1024-576":45992,"skein1024-584":45993,"skein1024-592":45994,"skein1024-600":45995,"skein1024-608":45996,"skein1024-616":45997,"skein1024-624":45998,"skein1024-632":45999,"skein1024-640":46e3,"skein1024-648":46001,"skein1024-656":46002,"skein1024-664":46003,"skein1024-672":46004,"skein1024-680":46005,"skein1024-688":46006,"skein1024-696":46007,"skein1024-704":46008,"skein1024-712":46009,"skein1024-720":46010,"skein1024-728":46011,"skein1024-736":46012,"skein1024-744":46013,"skein1024-752":46014,"skein1024-760":46015,"skein1024-768":46016,"skein1024-776":46017,"skein1024-784":46018,"skein1024-792":46019,"skein1024-800":46020,"skein1024-808":46021,"skein1024-816":46022,"skein1024-824":46023,"skein1024-832":46024,"skein1024-840":46025,"skein1024-848":46026,"skein1024-856":46027,"skein1024-864":46028,"skein1024-872":46029,"skein1024-880":46030,"skein1024-888":46031,"skein1024-896":46032,"skein1024-904":46033,"skein1024-912":46034,"skein1024-920":46035,"skein1024-928":46036,"skein1024-936":46037,"skein1024-944":46038,"skein1024-952":46039,"skein1024-960":46040,"skein1024-968":46041,"skein1024-976":46042,"skein1024-984":46043,"skein1024-992":46044,"skein1024-1000":46045,"skein1024-1008":46046,"skein1024-1016":46047,"skein1024-1024":46048,"poseidon-bls12_381-a2-fc1":46081,"poseidon-bls12_381-a2-fc1-sc":46082});e.exports={names:t}},53765:(e,t,r)=>{"use strict";const n=r(80141),i=r(36414),{names:o}=r(58280),{toString:s}=r(82051),{fromString:a}=r(46765),{concat:c}=r(62110),u={};for(const y in o){const e=y;u[o[e]]=e}function l(e){if(!(e instanceof Uint8Array))throw new Error("multihash must be a Uint8Array");if(e.length<2)throw new Error("multihash too short. must be > 2 bytes.");const t=i.decode(e);if(!f(t))throw new Error("multihash unknown function code: 0x".concat(t.toString(16)));e=e.slice(i.decode.bytes);const r=i.decode(e);if(r<0)throw new Error("multihash invalid length: ".concat(r));if((e=e.slice(i.decode.bytes)).length!==r)throw new Error("multihash length inconsistent: 0x".concat(s(e,"base16")));return{code:t,name:u[t],length:r,digest:e}}function d(e){let t=e;if("string"===typeof e){if(void 0===o[e])throw new Error("Unrecognized hash function named: ".concat(e));t=o[e]}if("number"!==typeof t)throw new Error("Hash function code should be a number. Got: ".concat(t));if(void 0===u[t]&&!h(t))throw new Error("Unrecognized function code: ".concat(t));return t}function h(e){return e>0&&e<16}function f(e){return!!h(e)||!!u[e]}function p(e){l(e)}Object.freeze(u),e.exports={names:o,codes:u,toHexString:function(e){if(!(e instanceof Uint8Array))throw new Error("must be passed a Uint8Array");return s(e,"base16")},fromHexString:function(e){return a(e,"base16")},toB58String:function(e){if(!(e instanceof Uint8Array))throw new Error("must be passed a Uint8Array");return s(n.encode("base58btc",e)).slice(1)},fromB58String:function(e){const t=e instanceof Uint8Array?s(e):e;return n.decode("z"+t)},decode:l,encode:function(e,t,r){if(!e||void 0===t)throw new Error("multihash encode requires at least two args: digest, code");const n=d(t);if(!(e instanceof Uint8Array))throw new Error("digest should be a Uint8Array");if(null==r&&(r=e.length),r&&e.length!==r)throw new Error("digest length should be equal to specified length.");const o=i.encode(n),s=i.encode(r);return c([o,s,e],o.length+s.length+e.length)},coerceCode:d,isAppCode:h,validate:p,prefix:function(e){return p(e),e.subarray(0,2)},isValidCode:f}},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),o=r(90504),s=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:d}=s(e);for(;;){const e=(await o.read(u,r)).toString();if(c('read "%s"',e),e!==a){if(t.includes(e))return o.write(n,e),c('respond with "%s" for "%s"',e,e),l(),{stream:d,protocol:e};"ls"!==e?(o.write(n,"na"),c('respond with "na" for "%s"',e)):(o.write(n,new i(t.map((e=>o.encode(e))))),c('respond with "%s" for %s',t,e))}else c('respond with "%s" for "%s"',a,e),o.write(n,a)}}},5889:(e,t,r)=>{"use strict";const n=r(40995),i=r(99848),o=r(46995),{PROTOCOL_ID:s}=r(96940);t.PROTOCOL_ID=s;class a{constructor(e){this._stream=e,this._shaken=!1}async _handshake(e){if(this._shaken)return;const{stream:t}=await n(this._stream,s,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:s,t)}async ls(e){await this._handshake(e);const t=await o(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),o=r(90504),s=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:d}=s(e);u('write "ls"'),o.write(i,"ls"),l();const h=await o.read(r,t),f=n([h]),p=[];await c(f,a.decode(),(async e=>{for await(const t of e)p.push(t.shallowSlice(0,-1).toString())}));return{stream:d,protocols:p}}},90504:(e,t,r)=>{"use strict";const n=r(41976),i=r(44709),{pipe:o}=r(79023),s=r(67963),{fromString:a}=r(46765),c=r(84744),{source:u}=r(64183),l=a("\n");function d(e){return i.encode.single(new n([e,l]))}e.exports={encode:d,write:function(e,t){e.push(d(t))},writeAll:async function(e,t){e.push(t.reduce(((e,t)=>e.append(d(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 d=await o(a,i.decode({onLength:e=>{r=e}}),c);if(d.get(d.length-1)!==l[0])throw s(new Error("missing newline"),"ERR_INVALID_MULTISTREAM_SELECT_MESSAGE");return d.shallowSlice(0,-1)}}},40995:(e,t,r)=>{"use strict";const n=r(18392),i=r(67963),o=r(90504),s=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:d}=s(e),h=t.shift();if(!h)throw new Error("At least one protocol must be specified");r?(a('select: write ["%s", "%s"]',r,h),o.writeAll(u,[r,h])):(a('select: write "%s"',h),o.write(u,h));let f=(await o.read(c,n)).toString();if(a('select: read "%s"',f),f===r&&(f=(await o.read(c,n)).toString(),a('select: read "%s"',f)),f===h)return l(),{stream:d,protocol:h};for(const i of t){a('select: write "%s"',i),o.write(u,i);const e=(await o.read(c,n)).toString();if(a('select: read "%s" for "%s"',e,i),e===i)return l(),{stream:d,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 o(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),o(Reflect);var s=new Proxy({},{get:function(e,i){return function(){for(var e=arguments.length,o=Array(e),s=0;s<e;s++)o[s]=arguments[s];return r[i].apply(null,[n].concat(t(o.slice(1))))}}});return{setTarget:i,setHandler:o,getTarget:function(){return n},getHandler:function(){return r},proxy:new Proxy(n,s)}}},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,o,s,a,c;c=function(e){return[(e&255<<24)>>>24,(e&255<<16)>>>16,(65280&e)>>>8,255&e].join(".")},a=function(e){var t,n,i,o,s,a;for(t=[],i=o=0;o<=3&&0!==e.length;i=++o){if(i>0){if("."!==e[0])throw new Error("Invalid IP");e=e.substring(1)}s=(a=r(e))[0],n=a[1],e=e.substring(n),t.push(s)}if(0!==e.length)throw new Error("Invalid IP");switch(t.length){case 1:if(t[0]>4294967295)throw new Error("Invalid IP");return t[0]>>>0;case 2:if(t[0]>255||t[1]>16777215)throw new Error("Invalid IP");return(t[0]<<24|t[1])>>>0;case 3:if(t[0]>255||t[1]>255||t[2]>65535)throw new Error("Invalid IP");return(t[0]<<24|t[1]<<16|t[2])>>>0;case 4:if(t[0]>255||t[1]>255||t[2]>255||t[3]>255)throw new Error("Invalid IP");return(t[0]<<24|t[1]<<16|t[2]<<8|t[3])>>>0;default:throw new Error("Invalid IP")}},i=(n=function(e){return e.charCodeAt(0)})("0"),s=n("a"),o=n("A"),r=function(e){var t,r,a,c,u;for(c=0,t=10,r="9",a=0,e.length>1&&"0"===e[a]&&("x"===e[a+1]||"X"===e[a+1]?(a+=2,t=16):"0"<=e[a+1]&&e[a+1]<="9"&&(a++,t=8,r="7")),u=a;a<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])-s)>>>0;else{if(!("A"<=e[a]&&e[a]<="F"))break;c=c*t+(10+n(e[a])-o)>>>0}}if(c>4294967295)throw new Error("too large");a++}if(a===u)throw new Error("empty octet");return[c,a]},e=function(){function e(e,t){var r,n,i;if("string"!==typeof e)throw new Error("Missing `net' parameter");if(t||(i=e.split("/",2),e=i[0],t=i[1]),t||(t=32),"string"===typeof t&&t.indexOf(".")>-1){try{this.maskLong=a(t)}catch(o){throw o,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(o){throw o,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},18605:(e,t,r)=>{var n=r(60392);function i(e,t){n.cipher.registerAlgorithm(e,(function(){return new n.aes.Algorithm(e,t)}))}r(33397),r(14533),r(63877),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||d();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 o=t.length();if(16===o||24===o||32===o){o>>>=2;for(i=0;i<o;++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 s=this.mode.name,a=-1!==["CFB","OFB","CTR","GCM"].indexOf(s);this._w=h(r,e.decrypt&&!a),this._init=!0}},n.aes._expandKey=function(e,t){return l||d(),h(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 o,s,a,c,u,l=!1;function d(){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;o=new Array(256),s=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,d,h,f,p,y=0,g=0;for(t=0;t<256;++t){d=(d=g^g<<1^g<<2^g<<3^g<<4)>>8^255&d^99,o[y]=d,s[d]=y,f=(h=e[d])<<24^d<<16^d<<8^d^h,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][d]=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 h(e,t){for(var r,n=e.slice(0),i=1,s=n.length,c=4*(s+6+1),l=s;l<c;++l)r=n[l-1],l%s===0?(r=o[r>>>16&255]<<24^o[r>>>8&255]<<16^o[255&r]<<8^o[r>>>24]^a[i]<<24,i++):s>6&&l%s===4&&(r=o[r>>>24]<<24^o[r>>>16&255]<<16^o[r>>>8&255]<<8^o[255&r]),n[l]=n[l-s]^r;if(t){for(var d,h=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 b=0;b<4;++b)d=n[m+b],g[l+(3&-b)]=h[o[d>>>24]]^f[o[d>>>16&255]]^p[o[d>>>8&255]]^y[o[255&d]];n=g}return n}function f(e,t,r,n){var i,a,l,d,h,f,p,y,g,m,b,v,w=e.length/4-1;n?(i=u[0],a=u[1],l=u[2],d=u[3],h=s):(i=c[0],a=c[1],l=c[2],d=c[3],h=o),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,_=1;_<w;++_)m=i[f>>>24]^a[p>>>16&255]^l[y>>>8&255]^d[255&g]^e[++E],b=i[p>>>24]^a[y>>>16&255]^l[g>>>8&255]^d[255&f]^e[++E],v=i[y>>>24]^a[g>>>16&255]^l[f>>>8&255]^d[255&p]^e[++E],g=i[g>>>24]^a[f>>>16&255]^l[p>>>8&255]^d[255&y]^e[++E],f=m,p=b,y=v;r[0]=h[f>>>24]<<24^h[p>>>16&255]<<16^h[y>>>8&255]<<8^h[255&g]^e[++E],r[n?3:1]=h[p>>>24]<<24^h[y>>>16&255]<<16^h[g>>>8&255]<<8^h[255&f]^e[++E],r[2]=h[y>>>24]<<24^h[g>>>16&255]<<16^h[f>>>8&255]<<8^h[255&p]^e[++E],r[n?1:3]=h[g>>>24]<<24^h[f>>>16&255]<<16^h[p>>>8&255]<<8^h[255&y]^e[++E]}function p(e){var t,r="AES-"+((e=e||{}).mode||"CBC").toUpperCase(),i=(t=e.decrypt?n.cipher.createDecipher(r,e.key):n.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var o=null;r instanceof n.util.ByteBuffer&&(o=r,r={}),(r=r||{}).output=o,r.iv=e,i.call(t,r)},t}},85049:(e,t,r)=>{var n=r(60392);r(63877),r(72886);var i=e.exports=n.asn1=n.asn1||{};function o(e,t,r){if(r>t){var n=new Error("Too few bytes to parse DER.");throw n.available=e.length(),n.remaining=t,n.requested=r,n}}i.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},i.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},i.create=function(e,t,r,o,s){if(n.util.isArray(o)){for(var a=[],c=0;c<o.length;++c)void 0!==o[c]&&a.push(o[c]);o=a}var u={tagClass:e,type:t,constructed:r,composed:r||n.util.isArray(o),value:o};return s&&"bitStringContents"in s&&(u.bitStringContents=s.bitStringContents,u.original=i.copy(u)),u},i.copy=function(e,t){var r;if(n.util.isArray(e)){r=[];for(var o=0;o<e.length;++o)r.push(i.copy(e[o],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 o=0;o<e.length;++o)if(!i.equals(e[o],t[o]))return!1;return!0}if(typeof e!==typeof t)return!1;if("string"===typeof e)return e===t;var s=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&&(s=s&&e.bitStringContents===t.bitStringContents),s},i.getBerValueLength=function(e){var t=e.getByte();if(128!==t)return 128&t?e.getInt((127&t)<<3):t};function s(e,t,r,n){var a;o(e,t,2);var c=e.getByte();t--;var u=192&c,l=31&c;a=e.length();var d,h,f=function(e,t){var r=e.getByte();if(t--,128!==r){var n;if(128&r){var i=127&r;o(e,t,i),n=e.getInt(i<<3)}else n=r;if(n<0)throw new Error("Negative length: "+n);return n}}(e,t);if(t-=a-e.length(),void 0!==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(d=[],void 0===f)for(;;){if(o(e,t,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),t-=2;break}a=e.length(),d.push(s(e,t,r+1,n)),t-=a-e.length()}else for(;f>0;)a=e.length(),d.push(s(e,f,r+1,n)),t-=a-e.length(),f-=a-e.length();if(void 0===d&&u===i.Class.UNIVERSAL&&l===i.Type.BITSTRING&&(h=e.bytes(f)),void 0===d&&n.decodeBitStrings&&u===i.Class.UNIVERSAL&&l===i.Type.BITSTRING&&f>1){var g=e.read,m=t,b=0;if(l===i.Type.BITSTRING&&(o(e,t,1),b=e.getByte(),t--),0===b)try{a=e.length();var v=s(e,t,r+1,{strict:!0,decodeBitStrings:!0}),w=a-e.length();t-=w,l==i.Type.BITSTRING&&w++;var E=v.tagClass;w!==f||E!==i.Class.UNIVERSAL&&E!==i.Class.CONTEXT_SPECIFIC||(d=[v])}catch(S){}void 0===d&&(e.read=g,t=m)}if(void 0===d){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(d="";f>0;f-=2)o(e,t,2),d+=String.fromCharCode(e.getInt16()),t-=2;else d=e.getBytes(f),t-=f}var _=void 0===h?null:{bitStringContents:h};return i.create(u,l,y,d,_)}i.fromDer=function(e,t){void 0===t&&(t={strict:!0,parseAllBytes:!0,decodeBitStrings:!0}),"boolean"===typeof t&&(t={strict:t,parseAllBytes:!0,decodeBitStrings:!0}),"strict"in t||(t.strict=!0),"parseAllBytes"in t||(t.parseAllBytes=!0),"decodeBitStrings"in t||(t.decodeBitStrings=!0),"string"===typeof e&&(e=n.util.createBuffer(e));var r=e.length(),i=s(e,e.length(),0,t);if(t.parseAllBytes&&0!==e.length()){var o=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw o.byteCount=r,o.remaining=e.length(),o}return i},i.toDer=function(e){var t=n.util.createBuffer(),r=e.tagClass|e.type,o=n.util.createBuffer(),s=!1;if("bitStringContents"in e&&(s=!0,e.original&&(s=i.equals(e,e.original))),s)o.putBytes(e.bitStringContents);else if(e.composed){e.constructed?r|=32:o.putByte(0);for(var a=0;a<e.value.length;++a)void 0!==e.value[a]&&o.putBuffer(i.toDer(e.value[a]))}else if(e.type===i.Type.BMPSTRING)for(a=0;a<e.value.length;++a)o.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)))?o.putBytes(e.value.substr(1)):o.putBytes(e.value);if(t.putByte(r),o.length()<=127)t.putByte(127&o.length());else{var c=o.length(),u="";do{u+=String.fromCharCode(255&c),c>>>=8}while(c>0);t.putByte(128|u.length);for(a=u.length-1;a>=0;--a)t.putByte(u.charCodeAt(a))}return t.putBuffer(o),t},i.oidToDer=function(e){var t,r,i,o,s=e.split("."),a=n.util.createBuffer();a.putByte(40*parseInt(s[0],10)+parseInt(s[1],10));for(var c=2;c<s.length;++c){t=!0,r=[],i=parseInt(s[c],10);do{o=127&i,i>>>=7,t||(o|=128),r.push(o),t=!1}while(i>0);for(var u=r.length-1;u>=0;--u)a.putByte(r[u])}return a},i.derToOid=function(e){var t;"string"===typeof e&&(e=n.util.createBuffer(e));var r=e.getByte();t=Math.floor(r/40)+"."+r%40;for(var i=0;e.length()>0;)i<<=7,128&(r=e.getByte())?i+=127&r:(t+="."+(i+r),i=0);return t},i.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(e.substr(2,2),10)-1,i=parseInt(e.substr(4,2),10),o=parseInt(e.substr(6,2),10),s=parseInt(e.substr(8,2),10),a=0;if(e.length>11){var c=e.charAt(10),u=10;"+"!==c&&"-"!==c&&(a=parseInt(e.substr(10,2),10),u+=2)}if(t.setUTCFullYear(r,n,i),t.setUTCHours(o,s,a,0),u&&("+"===(c=e.charAt(u))||"-"===c)){var 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),o=parseInt(e.substr(8,2),10),s=parseInt(e.substr(10,2),10),a=parseInt(e.substr(12,2),10),c=0,u=0,l=!1;"Z"===e.charAt(e.length-1)&&(l=!0);var d=e.length-5,h=e.charAt(d);"+"!==h&&"-"!==h||(u=60*parseInt(e.substr(d+1,2),10)+parseInt(e.substr(d+4,2),10),u*=6e4,"+"===h&&(u*=-1),l=!0);return"."===e.charAt(14)&&(c=1e3*parseFloat(e.substr(14),10)),l?(t.setUTCFullYear(r,n,i),t.setUTCHours(o,s,a,c),t.setTime(+t+u)):(t.setFullYear(r,n,i),t.setHours(o,s,a,c)),t},i.dateToUtcTime=function(e){if("string"===typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n<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,o){var s=!1;if(e.tagClass!==t.tagClass&&"undefined"!==typeof t.tagClass||e.type!==t.type&&"undefined"!==typeof t.type)o&&(e.tagClass!==t.tagClass&&o.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&o.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||"undefined"===typeof t.constructed){if(s=!0,t.value&&n.util.isArray(t.value))for(var a=0,c=0;s&&c<t.value.length;++c)s=t.value[c].optional||!1,e.value[a]&&((s=i.validate(e.value[a],t.value[c],r,o))?++a:t.value[c].optional&&(s=!0)),!s&&o&&o.push("["+t.name+'] Tag class "'+t.tagClass+'", type "'+t.type+'" expected value length "'+t.value.length+'", got "'+e.value.length+'"');if(s&&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 o&&o.push("["+t.name+'] Expected constructed "'+t.constructed+'", got "'+e.constructed+'"');return s};var a=/[^\\u0000-\\u00ff]/;i.prettyPrint=function(e,t,r){var o="";r=r||2,(t=t||0)>0&&(o+="\n");for(var s="",c=0;c<t*r;++c)s+=" ";switch(o+=s+"Tag: ",e.tagClass){case i.Class.UNIVERSAL:o+="Universal:";break;case i.Class.APPLICATION:o+="Application:";break;case i.Class.CONTEXT_SPECIFIC:o+="Context-Specific:";break;case i.Class.PRIVATE:o+="Private:"}if(e.tagClass===i.Class.UNIVERSAL)switch(o+=e.type,e.type){case i.Type.NONE:o+=" (None)";break;case i.Type.BOOLEAN:o+=" (Boolean)";break;case i.Type.INTEGER:o+=" (Integer)";break;case i.Type.BITSTRING:o+=" (Bit string)";break;case i.Type.OCTETSTRING:o+=" (Octet string)";break;case i.Type.NULL:o+=" (Null)";break;case i.Type.OID:o+=" (Object Identifier)";break;case i.Type.ODESC:o+=" (Object Descriptor)";break;case i.Type.EXTERNAL:o+=" (External or Instance of)";break;case i.Type.REAL:o+=" (Real)";break;case i.Type.ENUMERATED:o+=" (Enumerated)";break;case i.Type.EMBEDDED:o+=" (Embedded PDV)";break;case i.Type.UTF8:o+=" (UTF8)";break;case i.Type.ROID:o+=" (Relative Object Identifier)";break;case i.Type.SEQUENCE:o+=" (Sequence)";break;case i.Type.SET:o+=" (Set)";break;case i.Type.PRINTABLESTRING:o+=" (Printable String)";break;case i.Type.IA5String:o+=" (IA5String (ASCII))";break;case i.Type.UTCTIME:o+=" (UTC time)";break;case i.Type.GENERALIZEDTIME:o+=" (Generalized time)";break;case i.Type.BMPSTRING:o+=" (BMP String)"}else o+=e.type;if(o+="\n",o+=s+"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+=","));o+=s+"Sub values: "+u+l}else{if(o+=s+"Value: ",e.type===i.Type.OID){var d=i.derToOid(e.value);o+=d,n.pki&&n.pki.oids&&d in n.pki.oids&&(o+=" ("+n.pki.oids[d]+") ")}if(e.type===i.Type.INTEGER)try{o+=i.derToInteger(e.value)}catch(f){o+="0x"+n.util.bytesToHex(e.value)}else if(e.type===i.Type.BITSTRING){if(e.value.length>1?o+="0x"+n.util.bytesToHex(e.value.slice(1)):o+="(none)",e.value.length>0){var h=e.value.charCodeAt(0);1==h?o+=" (1 unused bit shown)":h>1&&(o+=" ("+h+" unused bits shown)")}}else if(e.type===i.Type.OCTETSTRING)a.test(e.value)||(o+="("+e.value+") "),o+="0x"+n.util.bytesToHex(e.value);else if(e.type===i.Type.UTF8)try{o+=n.util.decodeUtf8(e.value)}catch(p){if("URI malformed"!==p.message)throw p;o+="0x"+n.util.bytesToHex(e.value)+" (malformed UTF8)"}else e.type===i.Type.PRINTABLESTRING||e.type===i.Type.IA5String?o+=e.value:a.test(e.value)?o+="0x"+n.util.bytesToHex(e.value):0===e.value.length?o+="[null]":o+=e.value}return o}},65754:(e,t,r)=>{var n=r(62678).Buffer,i={};e.exports=i;var o={};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,o=t.length,s=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%o,u=u/o|0;for(;u>0;)a.push(u%o),u=u/o|0}for(i=0;0===e[i]&&i<e.length-1;++i)n+=s;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),o=[0];for(r=0;r<e.length();++r){for(var s=0,a=e.at(r);s<o.length;++s)a+=o[s]<<8,o[s]=a%n,a=a/n|0;for(;a>0;)o.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=o.length-1;r>=0;--r)c+=t[o[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=o[t];if(!r){r=o[t]=[];for(var i=0;i<t.length;++i)r[t.charCodeAt(i)]=i}e=e.replace(/\s/g,"");var s=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,d=u;l<c.length;++l)d+=c[l]*s,c[l]=255&d,d>>=8;for(;d>0;)c.push(255&d),d>>=8}for(var h=0;e[h]===a&&h<e.length-1;++h)c.push(0);return"undefined"!==typeof n?n.from(c.reverse()):new Uint8Array(c.reverse())}},33397:(e,t,r)=>{var n=r(60392);r(63877),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)))}},14533:(e,t,r)=>{var n=r(60392);r(63877),n.cipher=n.cipher||{};var i=e.exports=n.cipher.modes=n.cipher.modes||{};function o(e,t){if("string"===typeof e&&(e=n.util.createBuffer(e)),n.util.isArray(e)&&e.length>4){var r=e;e=n.util.createBuffer();for(var i=0;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 o=[],s=t/4;for(i=0;i<s;++i)o.push(e.getInt32());e=o}return e}function s(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=o(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=o(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)this._inBlock[i]=e.getInt32()^this._outBlock[i],t.putInt32(this._inBlock[i]);else{var o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),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(o>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),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)this._inBlock[i]=e.getInt32(),t.putInt32(this._inBlock[i]^this._outBlock[i]);else{var o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),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(o>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),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)t.putInt32(e.getInt32()^this._outBlock[i]),this._inBlock[i]=this._outBlock[i];else{var o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(o>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),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.ofb.prototype.decrypt=i.ofb.prototype.encrypt,i.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=o(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)t.putInt32(e.getInt32()^this._outBlock[i]);else{var o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(o>0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),o>0&&!r)return t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}s(this._inBlock)},i.ctr.prototype.decrypt=i.ctr.prototype.encrypt,i.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0,this._R=3774873600},i.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t,r=n.util.createBuffer(e.iv);if(this._cipherLength=0,t="additionalData"in e?n.util.createBuffer(e.additionalData):n.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=n.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var i=r.length();if(12===i)this._j0=[r.getInt32(),r.getInt32(),r.getInt32(),1];else{for(this._j0=[0,0,0,0];r.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(a(8*i)))}this._inBlock=this._j0.slice(0),s(this._inBlock),this._partialBytes=0,t=n.util.createBuffer(t),this._aDataLength=a(8*t.length());var o=t.length()%this.blockSize;for(o&&t.fillWithByte(0,this.blockSize-o),this._s=[0,0,0,0];t.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()])},i.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i<this._ints;++i)t.putInt32(this._outBlock[i]^=e.getInt32());this._cipherLength+=this.blockSize}else{var o=(this.blockSize-n)%this.blockSize;o>0&&(o=this.blockSize-o),this._partialOutput.clear();for(i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(o<=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),o>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(o-this._partialBytes)),this._partialBytes=o,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),s(this._inBlock)},i.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n<this.blockSize&&!(r&&n>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),s(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;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 o=[];this.cipher.encrypt(this._j0,o);for(var s=0;s<this._ints;++s)this.tag.putInt32(this._s[s]^o[s]);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,o=new Array(i),s=0;s<i;++s){var a=[0,0,0,0],c=(n-1-s%n)*t;a[s/n|0]=1<<t-1<<c,o[s]=this.generateSubHashTable(this.multiply(a,e),t)}return o},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 o=n>>>1;o>0;)this.pow(i[2*o],i[o]=[]),o>>=1;for(o=2;o<n;){for(var s=1;s<o;++s){var a=i[o],c=i[s];i[o+s]=[a[0]^c[0],a[1]^c[1],a[2]^c[2],a[3]^c[3]]}o*=2}for(i[0]=[0,0,0,0],o=n+1;o<r;++o){var u=i[o^n];i[o]=[e[0]^u[0],e[1]^u[1],e[2]^u[2],e[3]^u[3]]}return i}},71400:(e,t,r)=>{var n=r(60392);function i(e,t){n.cipher.registerAlgorithm(e,(function(){return new n.des.Algorithm(e,t)}))}r(33397),r(14533),r(63877),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],o=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],s=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],a=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],c=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],u=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],l=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],d=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],h=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],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=[],b=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],v=0,w=0;w<g;w++){var E=e.getInt32(),_=e.getInt32();E^=(t=252645135&(E>>>4^_))<<4,E^=t=65535&((_^=t)>>>-16^E),E^=(t=858993459&(E>>>2^(_^=t<<-16)))<<2,E^=t=65535&((_^=t)>>>-16^E),E^=(t=1431655765&(E>>>1^(_^=t<<-16)))<<1,E^=t=16711935&((_^=t)>>>8^E),t=(E^=(t=1431655765&(E>>>1^(_^=t<<8)))<<1)<<8|(_^=t)>>>20&240,E=_<<24|_<<8&16711680|_>>>8&65280|_>>>24&240,_=t;for(var S=0;S<b.length;++S){b[S]?(E=E<<2|E>>>26,_=_<<2|_>>>26):(E=E<<1|E>>>27,_=_<<1|_>>>27),_&=-15;var I=r[(E&=-15)>>>28]|n[E>>>24&15]|i[E>>>20&15]|o[E>>>16&15]|s[E>>>12&15]|a[E>>>8&15]|c[E>>>4&15],A=u[_>>>28]|l[_>>>24&15]|d[_>>>20&15]|h[_>>>16&15]|f[_>>>12&15]|p[_>>>8&15]|y[_>>>4&15];t=65535&(A>>>16^I),m[v++]=I^t,m[v++]=A^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 o=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],s=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],a=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],c=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],u=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],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],d=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],h=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function 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 b=i[m+1],v=i[m+2],w=i[m];w!=b;w+=v){var E=g^e[w],_=(g>>>4|g<<28)^e[w+1];f=y,y=g,g=f^(s[E>>>24&63]|c[E>>>16&63]|l[E>>>8&63]|h[63&E]|o[_>>>24&63]|a[_>>>16&63]|u[_>>>8&63]|d[63&_])}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 o=null;r instanceof n.util.ByteBuffer&&(o=r,r={}),(r=r||{}).output=o,r.iv=e,i.call(t,r)},t}},60392:e=>{e.exports={options:{usePureJavaScript:!1}}},70878:(e,t,r)=>{var n=r(60392);r(10029),r(63877),(e.exports=n.hmac=n.hmac||{}).create=function(){var e=null,t=null,r=null,i=null,o={start:function(o,s){if(null!==o)if("string"===typeof o){if(!((o=o.toLowerCase())in n.md.algorithms))throw new Error('Unknown hash algorithm "'+o+'"');t=n.md.algorithms[o].create()}else t=o;if(null===s)s=e;else{if("string"===typeof s)s=n.util.createBuffer(s);else if(n.util.isArray(s)){var a=s;s=n.util.createBuffer();for(var c=0;c<a.length;++c)s.putByte(a[c])}var u=s.length();u>t.blockLength&&(t.start(),t.update(s.bytes()),s=t.digest()),r=n.util.createBuffer(),i=n.util.createBuffer(),u=s.length();for(c=0;c<u;++c){a=s.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=s,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 o.digest=o.getMac,o}},3055:(e,t,r)=>{var n,i=r(60392);e.exports=i.jsbn=i.jsbn||{};function o(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function s(){return new o(null)}function a(e,t,r,n,i,o){for(var s=16383&t,a=t>>14;--o>=0;){var c=16383&this.data[e],u=this.data[e++]>>14,l=a*c+u*s;i=((c=s*c+((16383&l)<<14)+r.data[n]+i)>>28)+(l>>14)+a*u,r.data[n++]=268435455&c}return i}i.jsbn.BigInteger=o,"undefined"===typeof navigator?(o.prototype.am=a,n=28):"Microsoft Internet Explorer"==navigator.appName?(o.prototype.am=function(e,t,r,n,i,o){for(var s=32767&t,a=t>>15;--o>=0;){var c=32767&this.data[e],u=this.data[e++]>>15,l=a*c+u*s;i=((c=s*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?(o.prototype.am=function(e,t,r,n,i,o){for(;--o>=0;){var s=t*this.data[e++]+r.data[n]+i;i=Math.floor(s/67108864),r.data[n++]=67108863&s}return i},n=26):(o.prototype.am=a,n=28),o.prototype.DB=n,o.prototype.DM=(1<<n)-1,o.prototype.DV=1<<n;o.prototype.FV=Math.pow(2,52),o.prototype.F1=52-n,o.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 d(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function h(e,t){var r=l[e.charCodeAt(t)];return null==r?-1:r}function f(e){var t=s();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 b(e,t){return e|t}function v(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 _(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function S(){}function I(e){return e}function A(e){this.r2=s(),this.q3=s(),o.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}y.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},y.prototype.revert=function(e){return e},y.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},y.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},y.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},g.prototype.convert=function(e){var t=s();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(o.ZERO)>0&&this.m.subTo(t,t),t},g.prototype.revert=function(e){var t=s();return e.copyTo(t),this.reduce(t),t},g.prototype.reduce=function(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t<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)},o.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s},o.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0},o.prototype.fromString=function(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var n=e.length,i=!1,s=0;--n>=0;){var a=8==r?255&e[n]:h(e,n);a<0?"-"==e.charAt(n)&&(i=!0):(i=!1,0==s?this.data[this.t++]=a:s+r>this.DB?(this.data[this.t-1]|=(a&(1<<this.DB-s)-1)<<s,this.data[this.t++]=a>>this.DB-s):this.data[this.t-1]|=a<<s,(s+=r)>=this.DB&&(s-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,s>0&&(this.data[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),i&&o.ZERO.subTo(this,this)},o.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this.data[this.t-1]==e;)--this.t},o.prototype.dlShiftTo=function(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s},o.prototype.drShiftTo=function(e,t){for(var r=e;r<this.t;++r)t.data[r-e]=this.data[r];t.t=Math.max(this.t-e,0),t.s=this.s},o.prototype.lShiftTo=function(e,t){var r,n=e%this.DB,i=this.DB-n,o=(1<<i)-1,s=Math.floor(e/this.DB),a=this.s<<n&this.DM;for(r=this.t-1;r>=0;--r)t.data[r+s+1]=this.data[r]>>i|a,a=(this.data[r]&o)<<n;for(r=s-1;r>=0;--r)t.data[r]=0;t.data[s]=a,t.t=this.t+s+1,t.s=this.s,t.clamp()},o.prototype.rShiftTo=function(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var n=e%this.DB,i=this.DB-n,o=(1<<n)-1;t.data[0]=this.data[r]>>n;for(var s=r+1;s<this.t;++s)t.data[s-r-1]|=(this.data[s]&o)<<i,t.data[s-r]=this.data[s]>>n;n>0&&(t.data[this.t-r-1]|=(this.s&o)<<i),t.t=this.t-r,t.clamp()}},o.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()},o.prototype.multiplyTo=function(e,t){var r=this.abs(),n=e.abs(),i=r.t;for(t.t=i+n.t;--i>=0;)t.data[i]=0;for(i=0;i<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&&o.ZERO.subTo(t,t)},o.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()},o.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=s());var a=s(),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 d=a.t,h=a.data[d-1];if(0!=h){var f=h*(1<<this.F1)+(d>1?a.data[d-2]>>this.F2:0),y=this.FV/f,g=(1<<this.F1)/f,m=1<<this.F2,b=r.t,v=b-d,w=null==t?s():t;for(a.dlShiftTo(v,w),r.compareTo(w)>=0&&(r.data[r.t++]=1,r.subTo(w,r)),o.ONE.dlShiftTo(d,w),w.subTo(a,a);a.t<d;)a.data[a.t++]=0;for(;--v>=0;){var E=r.data[--b]==h?this.DM:Math.floor(r.data[b]*y+(r.data[b-1]+m)*g);if((r.data[b]+=a.am(0,E,r,v,0,d))<E)for(a.dlShiftTo(v,w),r.subTo(w,r);r.data[b]<--E;)r.subTo(w,r)}null!=t&&(r.drShiftTo(d,t),c!=u&&o.ZERO.subTo(t,t)),r.t=d,r.clamp(),l>0&&r.rShiftTo(l,r),c<0&&o.ZERO.subTo(r,r)}}},o.prototype.invDigit=function(){if(this.t<1)return 0;var e=this.data[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},o.prototype.isEven=function(){return 0==(this.t>0?1&this.data[0]:this.s)},o.prototype.exp=function(e,t){if(e>4294967295||e<1)return o.ONE;var r=s(),n=s(),i=t.convert(this),a=p(e)-1;for(i.copyTo(r);--a>=0;)if(t.sqrTo(r,n),(e&1<<a)>0)t.mulTo(n,i,r);else{var c=r;r=n,n=c}return t.revert(r)},o.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<<t)-1,i=!1,o="",s=this.t,a=this.DB-s*this.DB%t;if(s-- >0)for(a<this.DB&&(r=this.data[s]>>a)>0&&(i=!0,o=d(r));s>=0;)a<t?(r=(this.data[s]&(1<<a)-1)<<t-a,r|=this.data[--s]>>(a+=this.DB-t)):(r=this.data[s]>>(a-=t)&n,a<=0&&(a+=this.DB,--s)),r>0&&(i=!0),i&&(o+=d(r));return i?o:"0"},o.prototype.negate=function(){var e=s();return o.ZERO.subTo(this,e),e},o.prototype.abs=function(){return this.s<0?this.negate():this},o.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0},o.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+p(this.data[this.t-1]^this.s&this.DM)},o.prototype.mod=function(e){var t=s();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(o.ZERO)>0&&e.subTo(t,t),t},o.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new y(t):new g(t),this.exp(e,r)},o.ZERO=f(0),o.ONE=f(1),S.prototype.convert=I,S.prototype.revert=I,S.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},S.prototype.sqrTo=function(e,t){e.squareTo(t)},A.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=s();return e.copyTo(t),this.reduce(t),t},A.prototype.revert=function(e){return e},A.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)},A.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},A.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var R=[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],T=(1<<26)/R[R.length-1];o.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},o.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=f(r),i=s(),o=s(),a="";for(this.divRemTo(n,i,o);i.signum()>0;)a=(r+o.intValue()).toString(e).substr(1)+a,i.divRemTo(n,i,o);return o.intValue().toString(e)+a},o.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),i=!1,s=0,a=0,c=0;c<e.length;++c){var u=h(e,c);u<0?"-"==e.charAt(c)&&0==this.signum()&&(i=!0):(a=t*a+u,++s>=r&&(this.dMultiply(n),this.dAddOffset(a,0),s=0,a=0))}s>0&&(this.dMultiply(Math.pow(t,s)),this.dAddOffset(a,0)),i&&o.ZERO.subTo(this,this)},o.prototype.fromNumber=function(e,t,r){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(o.ONE.shiftLeft(e-1),b,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(o.ONE.shiftLeft(e-1),this);else{var n=new Array,i=7&e;n.length=1+(e>>3),t.nextBytes(n),i>0?n[0]&=(1<<i)-1:n[0]=0,this.fromString(n,256)}},o.prototype.bitwiseTo=function(e,t,r){var n,i,o=Math.min(e.t,this.t);for(n=0;n<o;++n)r.data[n]=t(this.data[n],e.data[n]);if(e.t<this.t){for(i=e.s&this.DM,n=o;n<this.t;++n)r.data[n]=t(this.data[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=o;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()},o.prototype.changeBit=function(e,t){var r=o.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r},o.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()},o.prototype.dMultiply=function(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},o.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}},o.prototype.multiplyLowerTo=function(e,t,r){var n,i=Math.min(this.t+e.t,t);for(r.s=0,r.t=i;i>0;)r.data[--i]=0;for(n=r.t-this.t;i<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()},o.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)},o.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},o.prototype.millerRabin=function(e){var t=this.subtract(o.ONE),r=t.getLowestSetBit();if(r<=0)return!1;for(var n,i=t.shiftRight(r),s={nextBytes:function(e){for(var t=0;t<e.length;++t)e[t]=Math.floor(256*Math.random())}},a=0;a<e;++a){do{n=new o(this.bitLength(),s)}while(n.compareTo(o.ONE)<=0||n.compareTo(t)>=0);var c=n.modPow(i,this);if(0!=c.compareTo(o.ONE)&&0!=c.compareTo(t)){for(var u=1;u++<r&&0!=c.compareTo(t);)if(0==(c=c.modPowInt(2,this)).compareTo(o.ONE))return!1;if(0!=c.compareTo(t))return!1}}return!0},o.prototype.clone=function(){var e=s();return this.copyTo(e),e},o.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]},o.prototype.byteValue=function(){return 0==this.t?this.s:this.data[0]<<24>>24},o.prototype.shortValue=function(){return 0==this.t?this.s:this.data[0]<<16>>16},o.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1},o.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var r,n=this.DB-e*this.DB%8,i=0;if(e-- >0)for(n<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},o.prototype.equals=function(e){return 0==this.compareTo(e)},o.prototype.min=function(e){return this.compareTo(e)<0?this:e},o.prototype.max=function(e){return this.compareTo(e)>0?this:e},o.prototype.and=function(e){var t=s();return this.bitwiseTo(e,m,t),t},o.prototype.or=function(e){var t=s();return this.bitwiseTo(e,b,t),t},o.prototype.xor=function(e){var t=s();return this.bitwiseTo(e,v,t),t},o.prototype.andNot=function(e){var t=s();return this.bitwiseTo(e,w,t),t},o.prototype.not=function(){for(var e=s(),t=0;t<this.t;++t)e.data[t]=this.DM&~this.data[t];return e.t=this.t,e.s=~this.s,e},o.prototype.shiftLeft=function(e){var t=s();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},o.prototype.shiftRight=function(e){var t=s();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},o.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},o.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=_(this.data[r]^t);return e},o.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)},o.prototype.setBit=function(e){return this.changeBit(e,b)},o.prototype.clearBit=function(e){return this.changeBit(e,w)},o.prototype.flipBit=function(e){return this.changeBit(e,v)},o.prototype.add=function(e){var t=s();return this.addTo(e,t),t},o.prototype.subtract=function(e){var t=s();return this.subTo(e,t),t},o.prototype.multiply=function(e){var t=s();return this.multiplyTo(e,t),t},o.prototype.divide=function(e){var t=s();return this.divRemTo(e,t,null),t},o.prototype.remainder=function(e){var t=s();return this.divRemTo(e,null,t),t},o.prototype.divideAndRemainder=function(e){var t=s(),r=s();return this.divRemTo(e,t,r),new Array(t,r)},o.prototype.modPow=function(e,t){var r,n,i=e.bitLength(),o=f(1);if(i<=0)return o;r=i<18?1:i<48?3:i<144?4:i<768?5:6,n=i<8?new y(t):t.isEven()?new A(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 d=s();for(n.sqrTo(a[1],d);c<=l;)a[c]=s(),n.mulTo(d,a[c-2],a[c]),c+=2}var h,m,b=e.t-1,v=!0,w=s();for(i=p(e.data[b])-1;b>=0;){for(i>=u?h=e.data[b]>>i-u&l:(h=(e.data[b]&(1<<i+1)-1)<<u-i,b>0&&(h|=e.data[b-1]>>this.DB+i-u)),c=r;0==(1&h);)h>>=1,--c;if((i-=c)<0&&(i+=this.DB,--b),v)a[h].copyTo(o),v=!1;else{for(;c>1;)n.sqrTo(o,w),n.sqrTo(w,o),c-=2;c>0?n.sqrTo(o,w):(m=o,o=w,w=m),n.mulTo(w,a[h],o)}for(;b>=0&&0==(e.data[b]&1<<i);)n.sqrTo(o,w),m=o,o=w,w=m,--i<0&&(i=this.DB-1,--b)}return n.revert(o)},o.prototype.modInverse=function(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return o.ZERO;for(var r=e.clone(),n=this.clone(),i=f(1),s=f(0),a=f(0),c=f(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),t?(i.isEven()&&s.isEven()||(i.addTo(this,i),s.subTo(e,s)),i.rShiftTo(1,i)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);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),s.subTo(c,s)):(n.subTo(r,n),t&&a.subTo(i,a),c.subTo(s,c))}return 0!=n.compareTo(o.ONE)?o.ZERO:c.compareTo(e)>=0?c.subtract(e):c.signum()<0?(c.addTo(e,c),c.signum()<0?c.add(e):c):c},o.prototype.pow=function(e){return this.exp(e,new S)},o.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var i=t.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return t;for(i<o&&(o=i),o>0&&(t.rShiftTo(o,t),r.rShiftTo(o,r));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r},o.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r.data[0]<=R[R.length-1]){for(t=0;t<R.length;++t)if(r.data[0]==R[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<R.length;){for(var n=R[t],i=t+1;i<R.length&&n<T;)n*=R[i++];for(n=r.modInt(n);t<i;)if(n%R[t++]==0)return!1}return r.millerRabin(e)}},10029:(e,t,r)=>{var n=r(60392);e.exports=n.md=n.md||{},n.md.algorithms=n.md.algorithms||{}},71746:(e,t,r)=>{var n=r(60392);r(37263),e.exports=n.mgf=n.mgf||{},n.mgf.mgf1=n.mgf1},37263:(e,t,r)=>{var n=r(60392);r(63877),n.mgf=n.mgf||{},(e.exports=n.mgf.mgf1=n.mgf1=n.mgf1||{}).create=function(e){return{generate:function(t,r){for(var i=new n.util.ByteBuffer,o=Math.ceil(r/e.digestLength),s=0;s<o;s++){var a=new n.util.ByteBuffer;a.putInt32(s),e.start(),e.update(t+a.getBytes()),i.putBuffer(e.digest())}return i.truncate(i.length()-r),i.getBytes()}}}},72886:(e,t,r)=>{var n=r(60392);n.pki=n.pki||{};var i=e.exports=n.pki.oids=n.oids=n.oids||{};function o(e,t){i[e]=t,i[t]=e}function s(e,t){i[e]=t}o("1.2.840.113549.1.1.1","rsaEncryption"),o("1.2.840.113549.1.1.4","md5WithRSAEncryption"),o("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),o("1.2.840.113549.1.1.7","RSAES-OAEP"),o("1.2.840.113549.1.1.8","mgf1"),o("1.2.840.113549.1.1.9","pSpecified"),o("1.2.840.113549.1.1.10","RSASSA-PSS"),o("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),o("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),o("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),o("1.3.101.112","EdDSA25519"),o("1.2.840.10040.4.3","dsa-with-sha1"),o("1.3.14.3.2.7","desCBC"),o("1.3.14.3.2.26","sha1"),o("1.3.14.3.2.29","sha1WithRSASignature"),o("2.16.840.1.101.3.4.2.1","sha256"),o("2.16.840.1.101.3.4.2.2","sha384"),o("2.16.840.1.101.3.4.2.3","sha512"),o("2.16.840.1.101.3.4.2.4","sha224"),o("2.16.840.1.101.3.4.2.5","sha512-224"),o("2.16.840.1.101.3.4.2.6","sha512-256"),o("1.2.840.113549.2.2","md2"),o("1.2.840.113549.2.5","md5"),o("1.2.840.113549.1.7.1","data"),o("1.2.840.113549.1.7.2","signedData"),o("1.2.840.113549.1.7.3","envelopedData"),o("1.2.840.113549.1.7.4","signedAndEnvelopedData"),o("1.2.840.113549.1.7.5","digestedData"),o("1.2.840.113549.1.7.6","encryptedData"),o("1.2.840.113549.1.9.1","emailAddress"),o("1.2.840.113549.1.9.2","unstructuredName"),o("1.2.840.113549.1.9.3","contentType"),o("1.2.840.113549.1.9.4","messageDigest"),o("1.2.840.113549.1.9.5","signingTime"),o("1.2.840.113549.1.9.6","counterSignature"),o("1.2.840.113549.1.9.7","challengePassword"),o("1.2.840.113549.1.9.8","unstructuredAddress"),o("1.2.840.113549.1.9.14","extensionRequest"),o("1.2.840.113549.1.9.20","friendlyName"),o("1.2.840.113549.1.9.21","localKeyId"),o("1.2.840.113549.1.9.22.1","x509Certificate"),o("1.2.840.113549.1.12.10.1.1","keyBag"),o("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),o("1.2.840.113549.1.12.10.1.3","certBag"),o("1.2.840.113549.1.12.10.1.4","crlBag"),o("1.2.840.113549.1.12.10.1.5","secretBag"),o("1.2.840.113549.1.12.10.1.6","safeContentsBag"),o("1.2.840.113549.1.5.13","pkcs5PBES2"),o("1.2.840.113549.1.5.12","pkcs5PBKDF2"),o("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),o("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),o("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),o("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),o("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),o("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),o("1.2.840.113549.2.7","hmacWithSHA1"),o("1.2.840.113549.2.8","hmacWithSHA224"),o("1.2.840.113549.2.9","hmacWithSHA256"),o("1.2.840.113549.2.10","hmacWithSHA384"),o("1.2.840.113549.2.11","hmacWithSHA512"),o("1.2.840.113549.3.7","des-EDE3-CBC"),o("2.16.840.1.101.3.4.1.2","aes128-CBC"),o("2.16.840.1.101.3.4.1.22","aes192-CBC"),o("2.16.840.1.101.3.4.1.42","aes256-CBC"),o("2.5.4.3","commonName"),o("2.5.4.4","surname"),o("2.5.4.5","serialNumber"),o("2.5.4.6","countryName"),o("2.5.4.7","localityName"),o("2.5.4.8","stateOrProvinceName"),o("2.5.4.9","streetAddress"),o("2.5.4.10","organizationName"),o("2.5.4.11","organizationalUnitName"),o("2.5.4.12","title"),o("2.5.4.13","description"),o("2.5.4.15","businessCategory"),o("2.5.4.17","postalCode"),o("2.5.4.42","givenName"),o("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),o("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),o("2.16.840.1.113730.1.1","nsCertType"),o("2.16.840.1.113730.1.13","nsComment"),s("2.5.29.1","authorityKeyIdentifier"),s("2.5.29.2","keyAttributes"),s("2.5.29.3","certificatePolicies"),s("2.5.29.4","keyUsageRestriction"),s("2.5.29.5","policyMapping"),s("2.5.29.6","subtreesConstraint"),s("2.5.29.7","subjectAltName"),s("2.5.29.8","issuerAltName"),s("2.5.29.9","subjectDirectoryAttributes"),s("2.5.29.10","basicConstraints"),s("2.5.29.11","nameConstraints"),s("2.5.29.12","policyConstraints"),s("2.5.29.13","basicConstraints"),o("2.5.29.14","subjectKeyIdentifier"),o("2.5.29.15","keyUsage"),s("2.5.29.16","privateKeyUsagePeriod"),o("2.5.29.17","subjectAltName"),o("2.5.29.18","issuerAltName"),o("2.5.29.19","basicConstraints"),s("2.5.29.20","cRLNumber"),s("2.5.29.21","cRLReason"),s("2.5.29.22","expirationDate"),s("2.5.29.23","instructionCode"),s("2.5.29.24","invalidityDate"),s("2.5.29.25","cRLDistributionPoints"),s("2.5.29.26","issuingDistributionPoint"),s("2.5.29.27","deltaCRLIndicator"),s("2.5.29.28","issuingDistributionPoint"),s("2.5.29.29","certificateIssuer"),s("2.5.29.30","nameConstraints"),o("2.5.29.31","cRLDistributionPoints"),o("2.5.29.32","certificatePolicies"),s("2.5.29.33","policyMappings"),s("2.5.29.34","policyConstraints"),o("2.5.29.35","authorityKeyIdentifier"),s("2.5.29.36","policyConstraints"),o("2.5.29.37","extKeyUsage"),s("2.5.29.46","freshestCRL"),s("2.5.29.54","inhibitAnyPolicy"),o("1.3.6.1.4.1.11129.2.4.2","timestampList"),o("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),o("1.3.6.1.5.5.7.3.1","serverAuth"),o("1.3.6.1.5.5.7.3.2","clientAuth"),o("1.3.6.1.5.5.7.3.3","codeSigning"),o("1.3.6.1.5.5.7.3.4","emailProtection"),o("1.3.6.1.5.5.7.3.8","timeStamping")},29835:(e,t,r)=>{var n=r(60392);if(r(18605),r(85049),r(71400),r(10029),r(72886),r(16019),r(16193),r(33860),r(50654),r(25493),r(63877),"undefined"===typeof i)var i=n.jsbn.BigInteger;var o=n.asn1,s=n.pki=n.pki||{};e.exports=s.pbe=n.pbe=n.pbe||{};var a=s.oids,c={name:"EncryptedPrivateKeyInfo",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},u={name:"PBES2Algorithms",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:o.Class.UNIVERSAL,type:o.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},l={name:"pkcs-12PbeParams",tagClass:o.Class.UNIVERSAL,type:o.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:o.Class.UNIVERSAL,type:o.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:o.Class.UNIVERSAL,type:o.Type.INTEGER,constructed:!1,capture:"iterations"}]};function d(e,t){return e.start().update(t).digest().getBytes()}function h(e){var t;if(e){if(!(t=s.oids[o.derToOid(e)])){var r=new Error("Unsupported PRF OID.");throw r.oid=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}}else t="hmacWithSHA1";return 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()}s.encryptPrivateKeyInfo=function(e,t,r){(r=r||{}).saltSize=r.saltSize||8,r.count=r.count||2048,r.algorithm=r.algorithm||"aes128",r.prfAlgorithm=r.prfAlgorithm||"sha1";var i,c,u,l=n.random.getBytesSync(r.saltSize),d=r.count,h=o.integerToDer(d);if(0===r.algorithm.indexOf("aes")||"des"===r.algorithm){var p,y,g;switch(r.algorithm){case"aes128":i=16,p=16,y=a["aes128-CBC"],g=n.aes.createEncryptionCipher;break;case"aes192":i=24,p=16,y=a["aes192-CBC"],g=n.aes.createEncryptionCipher;break;case"aes256":i=32,p=16,y=a["aes256-CBC"],g=n.aes.createEncryptionCipher;break;case"des":i=8,p=8,y=a.desCBC,g=n.des.createEncryptionCipher;break;default:throw(_=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,_}var m="hmacWith"+r.prfAlgorithm.toUpperCase(),b=f(m),v=n.pkcs5.pbkdf2(t,l,d,i,b),w=n.random.getBytesSync(p);(S=g(v)).start(w),S.update(o.toDer(e)),S.finish(),u=S.output.getBytes();var E=function(e,t,r,i){var a=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,e),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,t.getBytes())]);"hmacWithSHA1"!==i&&a.value.push(o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,n.util.hexToBytes(r.toString(16))),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(s.oids[i]).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.NULL,!1,"")]));return a}(l,h,i,m);c=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a.pkcs5PBES2).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a.pkcs5PBKDF2).getBytes()),E]),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(y).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,w)])])])}else{var _;if("3des"!==r.algorithm)throw(_=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,_;i=24;var S,I=new n.util.ByteBuffer(l);v=s.pbe.generatePkcs12Key(t,I,1,d,i),w=s.pbe.generatePkcs12Key(t,I,2,d,i);(S=n.des.createEncryptionCipher(v)).start(w),S.update(o.toDer(e)),S.finish(),u=S.output.getBytes(),c=o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OID,!1,o.oidToDer(a["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,l),o.create(o.Class.UNIVERSAL,o.Type.INTEGER,!1,h.getBytes())])])}return o.create(o.Class.UNIVERSAL,o.Type.SEQUENCE,!0,[c,o.create(o.Class.UNIVERSAL,o.Type.OCTETSTRING,!1,u)])},s.decryptPrivateKeyInfo=function(e,t){var r=null,i={},a=[];if(!o.validate(e,c,i,a)){var u=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw u.errors=a,u}var l=o.derToOid(i.encryptionOid),d=s.pbe.getCipher(l,i.encryptionParams,t),h=n.util.createBuffer(i.encryptedData);return d.update(h),d.finish()&&(r=o.fromDer(d.output)),r},s.encryptedPrivateKeyToPem=function(e,t){var r={type:"ENCRYPTED PRIVATE KEY",body:o.toDer(e).getBytes()};return n.pem.encode(r,{maxline:t})},s.encryptedPrivateKeyFromPem=function(e){var t=n.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==t.type){var r=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw r.headerType=t.type,r}if(t.procType&&"ENCRYPTED"===t.procType.type)throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return o.fromDer(t.body)},s.encryptRsaPrivateKey=function(e,t,r){if(!(r=r||{}).legacy){var i=s.wrapRsaPrivateKey(s.privateKeyToAsn1(e));return i=s.encryptPrivateKeyInfo(i,t,r),s.encryptedPrivateKeyToPem(i)}var a,c,u,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 d=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+r.algorithm+'".');throw d.algorithm=r.algorithm,d}var h=l(n.pbe.opensslDeriveBytes(t,c.substr(0,8),u));h.start(c),h.update(o.toDer(s.privateKeyToAsn1(e))),h.finish();var f={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:a,parameters:n.util.bytesToHex(c).toUpperCase()},body:h.output.getBytes()};return n.pem.encode(f)},s.decryptRsaPrivateKey=function(e,t){var r=null,i=n.pem.decode(e)[0];if("ENCRYPTED PRIVATE KEY"!==i.type&&"PRIVATE KEY"!==i.type&&"RSA PRIVATE KEY"!==i.type)throw(u=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".')).headerType=u,u;if(i.procType&&"ENCRYPTED"===i.procType.type){var a,c;switch(i.dekInfo.algorithm){case"DES-CBC":a=8,c=n.des.createDecryptionCipher;break;case"DES-EDE3-CBC":a=24,c=n.des.createDecryptionCipher;break;case"AES-128-CBC":a=16,c=n.aes.createDecryptionCipher;break;case"AES-192-CBC":a=24,c=n.aes.createDecryptionCipher;break;case"AES-256-CBC":a=32,c=n.aes.createDecryptionCipher;break;case"RC2-40-CBC":a=5,c=function(e){return n.rc2.createDecryptionCipher(e,40)};break;case"RC2-64-CBC":a=8,c=function(e){return n.rc2.createDecryptionCipher(e,64)};break;case"RC2-128-CBC":a=16,c=function(e){return n.rc2.createDecryptionCipher(e,128)};break;default:var u;throw(u=new Error('Could not decrypt private key; unsupported encryption algorithm "'+i.dekInfo.algorithm+'".')).algorithm=i.dekInfo.algorithm,u}var l=n.util.hexToBytes(i.dekInfo.parameters),d=c(n.pbe.opensslDeriveBytes(t,l.substr(0,8),a));if(d.start(l),d.update(n.util.createBuffer(i.body)),!d.finish())return r;r=d.output.getBytes()}else r=i.body;return null!==(r="ENCRYPTED PRIVATE KEY"===i.type?s.decryptPrivateKeyInfo(o.fromDer(r),t):o.fromDer(r))&&(r=s.privateKeyFromAsn1(r)),r},s.pbe.generatePkcs12Key=function(e,t,r,i,o,s){var a,c;if("undefined"===typeof s||null===s){if(!("sha1"in n.md))throw new Error('"sha1" hash algorithm unavailable.');s=n.md.sha1.create()}var u=s.digestLength,l=s.blockLength,d=new n.util.ByteBuffer,h=new n.util.ByteBuffer;if(null!==e&&void 0!==e){for(c=0;c<e.length;c++)h.putInt16(e.charCodeAt(c));h.putInt16(0)}var f=h.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 b=l*Math.ceil(f/l),v=new n.util.ByteBuffer;for(c=0;c<b;c++)v.putByte(h.at(c%f));var w=m;w.putBuffer(v);for(var E=Math.ceil(o/u),_=1;_<=E;_++){var S=new n.util.ByteBuffer;S.putBytes(y.bytes()),S.putBytes(w.bytes());for(var I=0;I<i;I++)s.start(),s.update(S.getBytes()),S=s.digest();var A=new n.util.ByteBuffer;for(c=0;c<l;c++)A.putByte(S.at(c%u));var R=Math.ceil(p/l)+Math.ceil(f/l),T=new n.util.ByteBuffer;for(a=0;a<R;a++){var C=new n.util.ByteBuffer(w.getBytes(l)),P=511;for(c=A.length()-1;c>=0;c--)P>>=8,P+=A.at(c)+C.at(c),C.setAt(c,255&P);T.putBuffer(C)}w=T,d.putBuffer(S)}return d.truncate(d.length()-o),d},s.pbe.getCipher=function(e,t,r){switch(e){case s.oids.pkcs5PBES2:return s.pbe.getCipherForPBES2(e,t,r);case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case s.oids["pbewithSHAAnd40BitRC2-CBC"]:return s.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},s.pbe.getCipherForPBES2=function(e,t,r){var i,a={},c=[];if(!o.validate(t,u,a,c))throw(i=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=c,i;if((e=o.derToOid(a.kdfOid))!==s.oids.pkcs5PBKDF2)throw(i=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.")).oid=e,i.supportedOids=["pkcs5PBKDF2"],i;if((e=o.derToOid(a.encOid))!==s.oids["aes128-CBC"]&&e!==s.oids["aes192-CBC"]&&e!==s.oids["aes256-CBC"]&&e!==s.oids["des-EDE3-CBC"]&&e!==s.oids.desCBC)throw(i=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.")).oid=e,i.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],i;var l,d,f=a.kdfSalt,p=n.util.createBuffer(a.kdfIterationCount);switch(p=p.getInt(p.length()<<3),s.oids[e]){case"aes128-CBC":l=16,d=n.aes.createDecryptionCipher;break;case"aes192-CBC":l=24,d=n.aes.createDecryptionCipher;break;case"aes256-CBC":l=32,d=n.aes.createDecryptionCipher;break;case"des-EDE3-CBC":l=24,d=n.des.createDecryptionCipher;break;case"desCBC":l=8,d=n.des.createDecryptionCipher}var y=h(a.prfOid),g=n.pkcs5.pbkdf2(r,f,p,l,y),m=a.encIv,b=d(g);return b.start(m),b},s.pbe.getCipherForPKCS12PBE=function(e,t,r){var i={},a=[];if(!o.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,d,f=n.util.createBuffer(i.salt),p=n.util.createBuffer(i.iterations);switch(p=p.getInt(p.length()<<3),e){case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:c=24,u=8,d=n.des.startDecrypting;break;case s.oids["pbewithSHAAnd40BitRC2-CBC"]:c=5,u=8,d=function(e,t){var r=n.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var y;throw(y=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.")).oid=e,y}var g=h(i.prfOid),m=s.pbe.generatePkcs12Key(r,f,1,p,c,g);return g.start(),d(m,s.pbe.generatePkcs12Key(r,f,2,p,u,g))},s.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 o=[d(i,e+t)],s=16,a=1;s<r;++a,s+=16)o.push(d(i,o[a-1]+e+t));return o.join("").substr(0,r)}},16019:(e,t,r)=>{var n=r(62678).Buffer,i=r(60392);r(70878),r(10029),r(63877);var o,s=i.pkcs5=i.pkcs5||{};i.util.isNodejs&&!i.options.usePureJavaScript&&(o=r(25819)),e.exports=i.pbkdf2=s.pbkdf2=function(e,t,r,s,a,c){if("function"===typeof a&&(c=a,a=null),i.util.isNodejs&&!i.options.usePureJavaScript&&o.pbkdf2&&(null===a||"object"!==typeof a)&&(o.pbkdf2Sync.length>4||!a||"sha1"===a))return"string"!==typeof a&&(a="sha1"),e=n.from(e,"binary"),t=n.from(t,"binary"),c?4===o.pbkdf2Sync.length?o.pbkdf2(e,t,r,s,(function(e,t){if(e)return c(e);c(null,t.toString("binary"))})):o.pbkdf2(e,t,r,s,a,(function(e,t){if(e)return c(e);c(null,t.toString("binary"))})):4===o.pbkdf2Sync.length?o.pbkdf2Sync(e,t,r,s).toString("binary"):o.pbkdf2Sync(e,t,r,s,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(s>4294967295*u){var l=new Error("Derived key is too long.");if(c)return c(l);throw l}var d=Math.ceil(s/u),h=s-(d-1)*u,f=i.hmac.create();f.start(a,e);var p,y,g,m="";if(!c){for(var b=1;b<=d;++b){f.start(null,null),f.update(t),f.update(i.util.int32ToBytes(b)),p=g=f.digest().getBytes();for(var v=2;v<=r;++v)f.start(null,null),f.update(g),y=f.digest().getBytes(),p=i.util.xorBytes(p,y,u),g=y;m+=b<d?p:p.substr(0,h)}return m}b=1;function w(){if(b>d)return c(null,m);f.start(null,null),f.update(t),f.update(i.util.int32ToBytes(b)),p=g=f.digest().getBytes(),v=2,E()}function E(){if(v<=r)return f.start(null,null),f.update(g),y=f.digest().getBytes(),p=i.util.xorBytes(p,y,u),g=y,++v,i.util.setImmediate(E);m+=b<d?p:p.substr(0,h),++b,w()}w()}},16193:(e,t,r)=>{var n=r(60392);r(63877);var i=e.exports=n.pem=n.pem||{};function o(e){for(var t=e.name+": ",r=[],n=function(e,t){return" "+t},i=0;i<e.values.length;++i)r.push(e.values[i].replace(/^(\S+\r\n)/,n));t+=r.join(",")+"\r\n";var o=0,s=-1;for(i=0;i<t.length;++i,++o)if(o>65&&-1!==s){var a=t[s];","===a?(++s,t=t.substr(0,s)+"\r\n "+t.substr(s)):t=t.substr(0,s)+"\r\n"+a+t.substr(s+1),o=i-s-1,s=-1,++i}else" "!==t[i]&&"\t"!==t[i]&&","!==t[i]||(s=i);return t}function s(e){return e.replace(/^\s+/,"")}i.encode=function(e,t){t=t||{};var r,i="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(i+=o(r={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]})),e.contentDomain&&(i+=o(r={name:"Content-Domain",values:[e.contentDomain]})),e.dekInfo&&(r={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&r.values.push(e.dekInfo.parameters),i+=o(r)),e.headers)for(var s=0;s<e.headers.length;++s)i+=o(e.headers[s]);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,o=/([\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),d=0;t&&d<l.length;){for(var h=l[d].replace(/\s+$/,""),f=d+1;f<l.length;++f){var p=l[f];if(!/\s/.test(p[0]))break;h+=p,d=f}if(t=h.match(o)){for(var y={name:t[1],values:[]},g=t[2].split(","),m=0;m<g.length;++m)y.values.push(s(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]}}}++d}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}},22627:(e,t,r)=>{var n=r(60392);r(63877),r(33860),r(50928);var i=e.exports=n.pkcs1=n.pkcs1||{};function o(e,t,r){r||(r=n.md.sha1.create());for(var i="",o=Math.ceil(t/r.digestLength),s=0;s<o;++s){var a=String.fromCharCode(s>>24&255,s>>16&255,s>>8&255,255&s);r.start(),r.update(e+a),i+=r.digest().getBytes()}return i.substring(0,t)}i.encode_rsa_oaep=function(e,t,r){var i,s,a,c;"string"===typeof r?(i=r,s=arguments[3]||void 0,a=arguments[4]||void 0):r&&(i=r.label||void 0,s=r.seed||void 0,a=r.md||void 0,r.mgf1&&r.mgf1.md&&(c=r.mgf1.md)),a?a.start():a=n.md.sha1.create(),c||(c=a);var u=Math.ceil(e.n.bitLength()/8),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 d=a.digest(),h="",f=l-t.length,p=0;p<f;p++)h+="\0";var y=d.getBytes()+h+"\x01"+t;if(s){if(s.length!==a.digestLength){var g;throw(g=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.")).seedLength=s.length,g.digestLength=a.digestLength,g}}else s=n.random.getBytes(a.digestLength);var m=o(s,u-a.digestLength-1,c),b=n.util.xorBytes(y,m,y.length),v=o(b,a.digestLength,c),w=n.util.xorBytes(s,v,s.length);return"\0"+w+b},i.decode_rsa_oaep=function(e,t,r){var i,s,a;"string"===typeof r?(i=r,s=arguments[3]||void 0):r&&(i=r.label||void 0,s=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(b=new Error("RSAES-OAEP encoded message length is invalid.")).length=t.length,b.expectedLength=c,b;if(void 0===s?s=n.md.sha1.create():s.start(),a||(a=s),c<2*s.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");i||(i=""),s.update(i,"raw");for(var u=s.digest().getBytes(),l=t.charAt(0),d=t.substring(1,s.digestLength+1),h=t.substring(1+s.digestLength),f=o(h,s.digestLength,a),p=n.util.xorBytes(d,f,d.length),y=o(p,c-s.digestLength-1,a),g=n.util.xorBytes(h,y,h.length),m=g.substring(0,s.digestLength),b="\0"!==l,v=0;v<s.digestLength;++v)b|=u.charAt(v)!==m.charAt(v);for(var w=1,E=s.digestLength,_=s.digestLength;_<g.length;_++){var S=g.charCodeAt(_),I=1&S^1,A=w?65534:0;b|=S&A,E+=w&=I}if(b||1!==g.charCodeAt(E))throw new Error("Invalid RSAES-OAEP padding.");return g.substring(E+1)}},34660:(e,t,r)=>{var n=r(60392);r(18605),r(85049),r(71400),r(72886),r(16193),r(14922),r(33860),r(63877),r(3391);var i=n.asn1,o=e.exports=n.pkcs7=n.pkcs7||{};function s(e){var t={},r=[];if(!i.validate(e,o.asn1.recipientInfoValidator,t,r)){var s=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw s.errors=r,s}return{version:t.version.charCodeAt(0),issuer:n.pki.RDNAttributesAsArray(t.issuer),serialNumber:n.util.createBuffer(t.serial).toHex(),encryptedContent:{algorithm:i.derToOid(t.encAlgorithm),parameter:t.encParameter?t.encParameter.value:void 0,content:t.encKey}}}function a(e){for(var t,r=[],o=0;o<e.length;++o)r.push((t=e[o],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,[]),o=0;o<e.unauthenticatedAttributes.length;++o){var s=e.unauthenticatedAttributes[o];r.values.push(u(s))}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"),o=new Date("2050-01-01T00:00:00Z"),s=e.value;if("string"===typeof s){var a=Date.parse(s);s=isNaN(a)?13===s.length?i.utcTimeToDate(s):i.generalizedTimeToDate(s):new Date(a)}t=s>=r&&s<o?i.create(i.Class.UNIVERSAL,i.Type.UTCTIME,!1,i.dateToUtcTime(s)):i.create(i.Class.UNIVERSAL,i.Type.GENERALIZEDTIME,!1,i.dateToGeneralizedTime(s))}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 o={};if(!i.validate(t,r,o,[])){var s=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw s.errors=s,s}if(i.derToOid(o.contentType)!==n.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(o.encryptedContent){var a="";if(n.util.isArray(o.encryptedContent))for(var c=0;c<o.encryptedContent.length;++c){if(o.encryptedContent[c].type!==i.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");a+=o.encryptedContent[c].value}else a=o.encryptedContent;e.encryptedContent={algorithm:i.derToOid(o.encAlgorithm),parameter:n.util.createBuffer(o.encParameter.value),content:n.util.createBuffer(a)}}if(o.content){a="";if(n.util.isArray(o.content))for(c=0;c<o.content.length;++c){if(o.content[c].type!==i.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");a+=o.content[c].value}else a=o.content;e.content=n.util.createBuffer(a)}return e.version=o.version.charCodeAt(0),e.rawCapture=o,o}function d(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}}o.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 s=i.fromDer(t.body);return o.messageFromAsn1(s)},o.messageToPem=function(e,t){var r={type:"PKCS7",body:i.toDer(e.toAsn1()).getBytes()};return n.pem.encode(r,{maxline:t})},o.messageFromAsn1=function(e){var t={},r=[];if(!i.validate(e,o.asn1.contentInfoValidator,t,r)){var s=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw s.errors=r,s}var a,c=i.derToOid(t.contentType);switch(c){case n.pki.oids.envelopedData:a=o.createEnvelopedData();break;case n.pki.oids.encryptedData:a=o.createEncryptedData();break;case n.pki.oids.signedData:a=o.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},o.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,o.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 o=[],s=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&&s.value[0].value.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,t)),o.length>0&&s.value[0].value.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,o)),s.value[0].value.push(i.create(i.Class.UNIVERSAL,i.Type.SET,!0,e.signerInfos)),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.type).getBytes()),s])},addSigner:function(t){var r=t.issuer,i=t.serialNumber;if(t.certificate){var o=t.certificate;"string"===typeof o&&(o=n.pki.certificateFromPem(o)),r=o.issuer.attributes,i=o.serialNumber}var s=t.key;if(!s)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"===typeof s&&(s=n.pki.privateKeyFromPem(s));var a=t.digestAlgorithm||n.pki.oids.sha1;switch(a){case n.pki.oids.sha1:case n.pki.oids.sha256:case n.pki.oids.sha384:case n.pki.oids.sha512:case n.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+a)}var c=t.authenticatedAttributes||[];if(c.length>0){for(var u=!1,l=!1,d=0;d<c.length;++d){var h=c[d];if(u||h.type!==n.pki.oids.contentType){if(l||h.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:s,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 o=i.derToOid(e.contentInfo.value[0].value),s=i.toDer(r);for(var a in s.getByte(),i.getBerValueLength(s),s=s.getBytes(),t)t[a].start().update(s);for(var l=new Date,d=0;d<e.signers.length;++d){var h=e.signers[d];if(0===h.authenticatedAttributes.length){if(o!==n.pki.oids.data)throw new Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{h.authenticatedAttributesAsn1=i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var f=i.create(i.Class.UNIVERSAL,i.Type.SET,!0,[]),p=0;p<h.authenticatedAttributes.length;++p){var y=h.authenticatedAttributes[p];y.type===n.pki.oids.messageDigest?y.value=t[h.digestAlgorithm].digest():y.type===n.pki.oids.signingTime&&(y.value||(y.value=l)),f.value.push(u(y)),h.authenticatedAttributesAsn1.value.push(u(y))}s=i.toDer(f).getBytes(),h.md.start().update(s)}h.signature=h.key.sign(h.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 o=e.signers[r];(s=o.digestAlgorithm)in t||(t[s]=n.md[n.pki.oids[s]].create()),0===o.authenticatedAttributes.length?o.md=t[s]:o.md=n.md[n.pki.oids[s]].create()}for(var s 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(s).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.")}}},o.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,o.asn1.encryptedDataValidator)},decrypt:function(t){void 0!==t&&(e.encryptedContent.key=t),d(e)}}},o.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,o.asn1.envelopedDataValidator);e.recipients=function(e){for(var t=[],r=0;r<e.length;++r)t.push(s(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],o=i.issuer;if(i.serialNumber===t.serialNumber&&o.length===r.length){for(var s=!0,a=0;a<r.length;++a)if(o[a].type!==r[a].type||o[a].value!==r[a].value){s=!1;break}if(s)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)}d(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,o,s;switch(r=r||e.encryptedContent.algorithm,t=t||e.encryptedContent.key,r){case n.pki.oids["aes128-CBC"]:i=16,o=16,s=n.aes.createEncryptionCipher;break;case n.pki.oids["aes192-CBC"]:i=24,o=16,s=n.aes.createEncryptionCipher;break;case n.pki.oids["aes256-CBC"]:i=32,o=16,s=n.aes.createEncryptionCipher;break;case n.pki.oids["des-EDE3-CBC"]:i=24,o=8,s=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(o));var a=s(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)}}}}}},14922:(e,t,r)=>{var n=r(60392);r(85049),r(63877);var i=n.asn1,o=e.exports=n.pkcs7asn1=n.pkcs7asn1||{};n.pkcs7=n.pkcs7||{},n.pkcs7.asn1=o;var s={name:"ContentInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};o.contentInfoValidator=s;var a={name:"EncryptedContentInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};o.envelopedDataValidator={name:"EnvelopedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(a)},o.encryptedDataValidator={name:"EncryptedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"}].concat(a)};var c={name:"SignerInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};o.signedDataValidator={name:"SignedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},s,{name:"SignedData.Certificates",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,capture:"signerInfos",optional:!0,value:[c]}]},o.recipientInfoValidator={name:"RecipientInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter",optional:!0}]},{name:"RecipientInfo.encryptedKey",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}},5132:(e,t,r)=>{var n=r(60392);r(63877),r(3055),r(33860),function(){if(n.prime)e.exports=n.prime;else{var t=e.exports=n.prime=n.prime||{},r=n.jsbn.BigInteger,i=[6,4,2,4,2,4,6,2],o=new r(null);o.fromInt(30);var s=function(e,t){return e|t};t.generateProbablePrime=function(e,t,i){"function"===typeof t&&(i=t,t={});var o=(t=t||{}).algorithm||"PRIMEINC";"string"===typeof o&&(o={name:o}),o.options=o.options||{};var s=t.prng||n.random,c={nextBytes:function(e){for(var t=s.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}};if("PRIMEINC"===o.name)return function(e,t,i,o){if("workers"in i)return function(e,t,i,o){if("undefined"===typeof Worker)return a(e,t,i,o);var s=u(e,t),c=i.workers,l=i.workLoad||100,d=30*l/8,h=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(h);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 h=0;h<n.length;++h)n[h].terminate();return a=!0,o(null,new r(c.prime,16))}s.bitLength()>e&&(s=u(e,t));var f=s.toString(16);i.target.postMessage({hex:f,workLoad:l}),s.dAddOffset(d,0)}}}f()}(e,t,i,o);return a(e,t,i,o)}(e,c,o.options,i);throw new Error("Invalid prime generation algorithm: "+o.name)}}function a(e,t,r,n){var i=u(e,t),o=function(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}(i.bitLength());"millerRabinTests"in r&&(o=r.millerRabinTests);var s=10;"maxBlockTime"in r&&(s=r.maxBlockTime),c(i,e,t,0,o,s,n)}function c(e,t,r,o,s,a,l){var d=+new Date;do{if(e.bitLength()>t&&(e=u(t,r)),e.isProbablePrime(s))return l(null,e);e.dAddOffset(i[o++%8],0)}while(a<0||+new Date-d<a);n.util.setImmediate((function(){c(e,t,r,o,s,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),s,n),n.dAddOffset(31-n.mod(o).byteValue(),0),n}}()},6140:(e,t,r)=>{var n=r(21964),i=r(60392);r(63877);var o=null;!i.util.isNodejs||i.options.usePureJavaScript||n.versions["node-webkit"]||(o=r(25819)),(e.exports=i.prng=i.prng||{}).create=function(e){for(var t={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},r=e.md,n=new Array(32),s=0;s<32;++s)n[s]=r.create();function a(){if(t.pools[0].messageLength>=32)return c();var e=32-t.pools[0].messageLength<<5;t.collect(t.seedFileSync(e)),c()}function c(){t.reseeds=4294967295===t.reseeds?0:t.reseeds+1;var e=t.plugin.md.create();e.update(t.keyBytes);for(var r=1,n=0;n<32;++n)t.reseeds%r===0&&(e.update(t.pools[n].digest().getBytes()),t.pools[n].start()),r<<=1;t.keyBytes=e.digest().getBytes(),e.start(),e.update(t.keyBytes);var i=e.digest().getBytes();t.key=t.plugin.formatKey(t.keyBytes),t.seed=t.plugin.formatSeed(i),t.generated=0}function u(e){var t=null,r=i.util.globalScope,n=r.crypto||r.msCrypto;n&&n.getRandomValues&&(t=function(e){return n.getRandomValues(e)});var o=i.util.createBuffer();if(t)for(;o.length()<e;){var s=Math.max(1,Math.min(e-o.length(),65536)/4),a=new Uint32Array(Math.floor(s));try{t(a);for(var c=0;c<a.length;++c)o.putInt32(a[c])}catch(f){if(!("undefined"!==typeof QuotaExceededError&&f instanceof QuotaExceededError))throw f}}if(o.length()<e)for(var u,l,d,h=Math.floor(65536*Math.random());o.length()<e;){l=16807*(65535&h),l+=(32767&(u=16807*(h>>16)))<<16,h=4294967295&(l=(2147483647&(l+=u>>15))+(l>>31));for(c=0;c<3;++c)d=h>>>(c<<3),d^=Math.floor(256*Math.random()),o.putByte(255&d)}return o.getBytes(e)}return t.pools=n,t.pool=0,t.generate=function(e,r){if(!r)return t.generateSync(e);var n=t.plugin.cipher,o=t.plugin.increment,s=t.plugin.formatKey,a=t.plugin.formatSeed,u=i.util.createBuffer();t.key=null,function l(d){if(d)return r(d);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 h=n(t.key,t.seed);t.generated+=h.length,u.putBytes(h),t.key=s(n(t.key,o(t.seed))),t.seed=a(n(t.key,t.seed)),i.util.setImmediate(l)}()},t.generateSync=function(e){var r=t.plugin.cipher,n=t.plugin.increment,o=t.plugin.formatKey,s=t.plugin.formatSeed;t.key=null;for(var c=i.util.createBuffer();c.length()<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=o(r(t.key,n(t.seed))),t.seed=s(r(t.key,t.seed))}return c.getBytes(e)},o?(t.seedFile=function(e,t){o.randomBytes(e,(function(e,r){if(e)return t(e);t(null,r.toString())}))},t.seedFileSync=function(e){return o.randomBytes(e).toString()}):(t.seedFile=function(e,t){try{t(null,u(e))}catch(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}},30325:(e,t,r)=>{var n=r(60392);r(33860),r(63877),(e.exports=n.pss=n.pss||{}).create=function(e){3===arguments.length&&(e={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var t,r=e.md,i=e.mgf,o=r.digestLength,s=e.salt||null;if("string"===typeof s&&(s=n.util.createBuffer(s)),"saltLength"in e)t=e.saltLength;else{if(null===s)throw new Error("Salt length not specified or specific salt not given.");t=s.length()}if(null!==s&&s.length()!==t)throw new Error("Given salt length does not match length of given salt.");var a=e.prng||n.random,c={encode:function(e,c){var u,l,d=c-1,h=Math.ceil(d/8),f=e.digest().getBytes();if(h<o+t+2)throw new Error("Message is too long to encrypt.");l=null===s?a.getBytesSync(t):s.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,h-t-o-2),g.putByte(1),g.putBytes(l);var m=g.getBytes(),b=h-o-1,v=i.generate(y,b),w="";for(u=0;u<b;u++)w+=String.fromCharCode(m.charCodeAt(u)^v.charCodeAt(u));var E=65280>>8*h-d&255;return(w=String.fromCharCode(w.charCodeAt(0)&~E)+w.substr(1))+y+String.fromCharCode(188)},verify:function(e,s,a){var c,u=a-1,l=Math.ceil(u/8);if(s=s.substr(-l),l<o+t+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(188!==s.charCodeAt(l-1))throw new Error("Encoded message does not end in 0xBC.");var d=l-o-1,h=s.substr(0,d),f=s.substr(d,o),p=65280>>8*l-u&255;if(0!==(h.charCodeAt(0)&p))throw new Error("Bits beyond keysize not zero as expected.");var y=i.generate(f,d),g="";for(c=0;c<d;c++)g+=String.fromCharCode(h.charCodeAt(c)^y.charCodeAt(c));g=String.fromCharCode(g.charCodeAt(0)&~p)+g.substr(1);var m=l-o-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 b=g.substr(-t),v=new n.util.ByteBuffer;return v.fillWithByte(0,8),v.putBytes(e),v.putBytes(b),r.start(),r.update(v.getBytes()),f===r.digest().getBytes()}};return c}},33860:(e,t,r)=>{var n=r(60392);r(18605),r(77404),r(6140),r(63877),n.random&&n.random.getBytes?e.exports=n.random:function(t){var r={},i=new Array(4),o=n.util.createBuffer();function s(){var e=n.prng.create(r);return e.getBytes=function(t,r){return e.generate(t,r)},e.getBytesSync=function(t){return e.generate(t)},e}r.formatKey=function(e){var t=n.util.createBuffer(e);return(e=new Array(4))[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),n.aes._expandKey(e,!1)},r.formatSeed=function(e){var t=n.util.createBuffer(e);return(e=new Array(4))[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),e},r.cipher=function(e,t){return n.aes._updateBlock(e,t,i,!1),o.putInt32(i[0]),o.putInt32(i[1]),o.putInt32(i[2]),o.putInt32(i[3]),o.getBytes()},r.increment=function(e){return++e[3],e},r.md=n.md.sha256;var a=s(),c=null,u=n.util.globalScope,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 d="";for(var h in navigator)try{"string"==typeof navigator[h]&&(d+=navigator[h])}catch(f){}a.collect(d),d=null}t&&(t().mousemove((function(e){a.collectInt(e.clientX,16),a.collectInt(e.clientY,16)})),t().keypress((function(e){a.collectInt(e.charCode,8)})))}if(n.random)for(var h in a)n.random[h]=a[h];else n.random=a;n.random.createInstance=s,e.exports=n.random}("undefined"!==typeof jQuery?jQuery:null)},50654:(e,t,r)=>{var n=r(60392);r(63877);var i=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],o=[1,2,3,5],s=function(e,t){return e<<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,o=e,s=e.length(),a=t,c=Math.ceil(a/8),u=255>>(7&a);for(r=s;r<128;r++)o.putByte(i[o.at(r-1)+o.at(r-s)&255]);for(o.setAt(128-c,i[o.at(128-c)&u]),r=127-c;r>=0;r--)o.setAt(r,i[o.at(r+1)^o.at(r+c)]);return o};var c=function(e,t,r){var i,c,u,l,d=!1,h=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]=s(e[u],o[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],o[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=h.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 o=0;o<e[i][0];o++)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)),d=!1,h=n.util.createBuffer(),f=t||new n.util.createBuffer,p=e,m.output=f},update:function(e){for(d||h.putBuffer(e);h.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,h,!r);else{var n=8===h.length()?8:8-h.length();h.fillWithByte(n,n)}if(t&&(d=!0,m.update()),!r&&(t=0===h.length()))if(e)t=e(8,f,!r);else{var i=f.length(),o=f.at(i-1);o>i?t=!1:f.truncate(o)}return t}}};n.rc2.startEncrypting=function(e,t,r){var i=n.rc2.createEncryptionCipher(e,128);return i.start(t,r),i},n.rc2.createEncryptionCipher=function(e,t){return c(e,t,!0)},n.rc2.startDecrypting=function(e,t,r){var i=n.rc2.createDecryptionCipher(e,128);return i.start(t,r),i},n.rc2.createDecryptionCipher=function(e,t){return c(e,t,!1)}},25493:(e,t,r)=>{var n=r(60392);if(r(85049),r(3055),r(72886),r(22627),r(5132),r(33860),r(63877),"undefined"===typeof i)var i=n.jsbn.BigInteger;var o=n.util.isNodejs?r(25819):null,s=n.asn1,a=n.util;n.pki=n.pki||{},e.exports=n.pki.rsa=n.rsa=n.rsa||{};var c=n.pki,u=[6,4,2,4,2,4,6,2],l={name:"PrivateKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},d={name:"RSAPrivateKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},h={name:"RSAPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},f=n.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},p={name:"DigestInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:s.Class.UNIVERSAL,type:s.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},y=function(e){var t;if(!(e.algorithm in c.oids)){var r=new Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r}t=c.oids[e.algorithm];var n=s.oidToDer(t).getBytes(),i=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[]),o=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[]);o.value.push(s.create(s.Class.UNIVERSAL,s.Type.OID,!1,n)),o.value.push(s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,""));var a=s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,e.digest().getBytes());return i.value.push(o),i.value.push(a),s.toDer(i).getBytes()},g=function(e,t,r){if(r)return e.modPow(t.e,t.n);if(!t.p||!t.q)return e.modPow(t.d,t.n);var o;t.dP||(t.dP=t.d.mod(t.p.subtract(i.ONE))),t.dQ||(t.dQ=t.d.mod(t.q.subtract(i.ONE))),t.qInv||(t.qInv=t.q.modInverse(t.p));do{o=new i(n.util.bytesToHex(n.random.getBytes(t.n.bitLength()/8)),16)}while(o.compareTo(t.n)>=0||!o.gcd(t.n).equals(i.ONE));for(var s=(e=e.multiply(o.modPow(t.e,t.n)).mod(t.n)).mod(t.p).modPow(t.dP,t.p),a=e.mod(t.q).modPow(t.dQ,t.q);s.compareTo(a)<0;)s=s.add(t.p);var c=s.subtract(a).multiply(t.qInv).mod(t.p).multiply(t.q).add(a);return c=c.multiply(o.modInverse(t.n)).mod(t.n)};function m(e,t,r){var i=n.util.createBuffer(),o=Math.ceil(t.n.bitLength()/8);if(e.length>o-11){var s=new Error("Message is too long for PKCS#1 v1.5 padding.");throw s.length=e.length,s.max=o-11,s}i.putByte(0),i.putByte(r);var a,c=o-3-e.length;if(0===r||1===r){a=0===r?0:255;for(var u=0;u<c;++u)i.putByte(a)}else for(;c>0;){var l=0,d=n.random.getBytes(c);for(u=0;u<c;++u)0===(a=d.charCodeAt(u))?++l:i.putByte(a);c=l}return i.putByte(0),i.putBytes(e),i}function b(e,t,r,i){var o=Math.ceil(t.n.bitLength()/8),s=n.util.createBuffer(e),a=s.getByte(),c=s.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=o-3-i;for(var l=0;l<u;++l)if(0!==s.getByte())throw new Error("Encryption block is invalid.")}else if(1===c)for(u=0;s.length()>1;){if(255!==s.getByte()){--s.read;break}++u}else if(2===c)for(u=0;s.length()>1;){if(0===s.getByte()){--s.read;break}++u}if(0!==s.getByte()||u!==o-3-s.length())throw new Error("Encryption block is invalid.");return s.getBytes()}function v(e,t,r){"function"===typeof t&&(r=t,t={});var o={algorithm:{name:(t=t||{}).algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};function s(){a(e.pBits,(function(t,n){return t?r(t):(e.p=n,null!==e.q?u(t,e.q):void a(e.qBits,u))}))}function a(e,t){n.prime.generateProbablePrime(e,o,t)}function u(t,n){if(t)return r(t);if(e.q=n,e.p.compareTo(e.q)<0){var o=e.p;e.p=e.q,e.q=o}if(0!==e.p.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.p=null,void s();if(0!==e.q.subtract(i.ONE).gcd(e.e).compareTo(i.ONE))return e.q=null,void a(e.qBits,u);if(e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),0!==e.phi.gcd(e.e).compareTo(i.ONE))return e.p=e.q=null,void s();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void a(e.qBits,u);var 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&&(o.prng=t.prng),s()}function w(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 E(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){return n.util.isNodejs&&"function"===typeof o[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 I(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 A(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 o,s=r,a=Math.ceil(t.n.bitLength()/8);!1!==r&&!0!==r?(s=2===r,o=m(e,t,r)):(o=n.util.createBuffer()).putBytes(e);for(var c=new i(o.toHex(),16),u=g(c,t,s).toString(16),l=n.util.createBuffer(),d=a-Math.ceil(u.length/2);d>0;)l.putByte(0),--d;return l.putBytes(n.util.hexToBytes(u)),l.getBytes()},c.rsa.decrypt=function(e,t,r,o){var s=Math.ceil(t.n.bitLength()/8);if(e.length!==s){var a=new Error("Encrypted message length is invalid.");throw a.length=e.length,a.expected=s,a}var c=new i(n.util.createBuffer(e).toHex(),16);if(c.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var u=g(c,t,r).toString(16),l=n.util.createBuffer(),d=s-Math.ceil(u.length/2);d>0;)l.putByte(0),--d;return l.putBytes(n.util.hexToBytes(u)),!1!==o?b(l.getBytes(),t,r):l.getBytes()},c.rsa.createKeyPairGenerationState=function(e,t,r){"string"===typeof e&&(e=parseInt(e,10)),e=e||2048;var o,s=(r=r||{}).prng||n.random,a={nextBytes:function(e){for(var t=s.getBytesSync(e.length),r=0;r<e.length;++r)e[r]=t.charCodeAt(r)}},c=r.algorithm||"PRIMEINC";if("PRIMEINC"!==c)throw new Error("Invalid key generation algorithm: "+c);return(o={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(o.eInt),o},c.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var r=new i(null);r.fromInt(30);for(var n,o=0,s=function(e,t){return e|t},a=+new Date,l=0;null===e.keys&&(t<=0||l<t);){if(0===e.state){var d=null===e.p?e.pBits:e.qBits,h=d-1;0===e.pqState?(e.num=new i(d,e.rng),e.num.testBit(h)||e.num.bitwiseTo(i.ONE.shiftLeft(h),s,e.num),e.num.dAddOffset(31-e.num.mod(r).byteValue(),0),o=0,++e.pqState):1===e.pqState?e.num.bitLength()>d?e.pqState=0:e.num.isProbablePrime(E(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(u[o++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(i.ONE).gcd(e.e).compareTo(i.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(i.ONE),e.q1=e.q.subtract(i.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(i.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var 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(_("generateKeyPair"))return o.generateKeyPair("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},(function(e,t,r){if(e)return i(e);i(null,{privateKey:c.privateKeyFromPem(r),publicKey:c.publicKeyFromPem(t)})}));if(S("generateKey")&&S("exportKey"))return a.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:A(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then((function(e){return a.globalScope.crypto.subtle.exportKey("pkcs8",e.privateKey)})).then(void 0,(function(e){i(e)})).then((function(e){if(e){var t=c.privateKeyFromAsn1(s.fromDer(n.util.createBuffer(e)));i(null,{privateKey:t,publicKey:c.setRsaPublicKey(t.n,t.e)})}}));if(I("generateKey")&&I("exportKey")){var u=a.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:A(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);return u.oncomplete=function(e){var t=e.target.result,r=a.globalScope.msCrypto.subtle.exportKey("pkcs8",t.privateKey);r.oncomplete=function(e){var t=e.target.result,r=c.privateKeyFromAsn1(s.fromDer(n.util.createBuffer(t)));i(null,{privateKey:r,publicKey:c.setRsaPublicKey(r.n,r.e)})},r.onerror=function(e){i(e)}},void(u.onerror=function(e){i(e)})}}else if(_("generateKeyPairSync")){var l=o.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 d=c.rsa.createKeyPairGenerationState(e,t,r);if(!i)return c.rsa.stepKeyPairGenerationState(d,0),d.keys;v(d,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 m(e,t,2).getBytes()}};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={encode:function(e,t){return n.pkcs1.encode_rsa_oaep(t,e,i)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(t))t={encode:function(e){return e}};else if("string"===typeof t)throw new Error('Unsupported encryption scheme: "'+t+'".');var o=t.encode(e,r,!0);return c.rsa.encrypt(o,r,!0)},verify:function(e,t,i,o){"string"===typeof i?i=i.toUpperCase():void 0===i&&(i="RSASSA-PKCS1-V1_5"),void 0===o&&(o={_parseAllDigestBytes:!0}),"_parseAllDigestBytes"in o||(o._parseAllDigestBytes=!0),"RSASSA-PKCS1-V1_5"===i?i={verify:function(e,t){t=b(t,r,!0);var i=s.fromDer(t,{parseAllBytes:o._parseAllDigestBytes}),a={},c=[];if(!s.validate(i,p,a,c))throw(u=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.")).errors=c,u;var u,l=s.derToOid(a.algorithmIdentifier);if(l!==n.oids.md2&&l!==n.oids.md5&&l!==n.oids.sha1&&l!==n.oids.sha224&&l!==n.oids.sha256&&l!==n.oids.sha384&&l!==n.oids.sha512&&l!==n.oids["sha512-224"]&&l!==n.oids["sha512-256"])throw(u=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.")).oid=l,u;if((l===n.oids.md2||l===n.oids.md5)&&!("parameters"in a))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifer NULL parameters.");return e===a.digest}}:"NONE"!==i&&"NULL"!==i&&null!==i||(i={verify:function(e,t){return e===(t=b(t,r,!0))}});var a=c.rsa.decrypt(t,r,!0,!1);return i.verify(e,a,r.n.bitLength())}};return r},c.setRsaPrivateKey=c.rsa.setPrivateKey=function(e,t,r,i,o,s,a,u){var l={n:e,e:t,d:r,p:i,q:o,dP:s,dQ:a,qInv:u,decrypt:function(e,t,r){"string"===typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5");var i=c.rsa.decrypt(e,l,!1,!1);if("RSAES-PKCS1-V1_5"===t)t={decode:b};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={decode:function(e,t){return n.pkcs1.decode_rsa_oaep(t,e,r)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(t))throw new Error('Unsupported encryption scheme: "'+t+'".');t={decode:function(e){return e}}}return t.decode(i,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:y},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 s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,s.integerToDer(0).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(c.oids.rsaEncryption).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,"")]),s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,s.toDer(e).getBytes())])},c.privateKeyFromAsn1=function(e){var t,r,o,a,u,h,f,p,y={},g=[];if(s.validate(e,l,y,g)&&(e=s.fromDer(n.util.createBuffer(y.privateKey))),y={},g=[],!s.validate(e,d,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(),o=n.util.createBuffer(y.privateKeyPrivateExponent).toHex(),a=n.util.createBuffer(y.privateKeyPrime1).toHex(),u=n.util.createBuffer(y.privateKeyPrime2).toHex(),h=n.util.createBuffer(y.privateKeyExponent1).toHex(),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(o,16),new i(a,16),new i(u,16),new i(h,16),new i(f,16),new i(p,16))},c.privateKeyToAsn1=c.privateKeyToRSAPrivateKey=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,s.integerToDer(0).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,w(e.n)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,w(e.e)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,w(e.d)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,w(e.p)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,w(e.q)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,w(e.dP)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,w(e.dQ)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,w(e.qInv))])},c.publicKeyFromAsn1=function(e){var t={},r=[];if(s.validate(e,f,t,r)){var o,a=s.derToOid(t.publicKeyOid);if(a!==c.oids.rsaEncryption)throw(o=new Error("Cannot read public key. Unknown OID.")).oid=a,o;e=t.rsaPublicKey}if(r=[],!s.validate(e,h,t,r))throw(o=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=r,o;var u=n.util.createBuffer(t.publicKeyModulus).toHex(),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 s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(c.oids.rsaEncryption).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,"")]),s.create(s.Class.UNIVERSAL,s.Type.BITSTRING,!1,[c.publicKeyToRSAPublicKey(e)])])},c.publicKeyToRSAPublicKey=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,w(e.n)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,w(e.e))])}},50928:(e,t,r)=>{var n=r(60392);r(10029),r(63877);var i=e.exports=n.sha1=n.sha1||{};n.md.sha1=n.md.algorithms.sha1=i,i.create=function(){s||(o=String.fromCharCode(128),o+=n.util.fillString(String.fromCharCode(0),64),s=!0);var e=null,t=n.util.createBuffer(),r=new Array(80),i={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var r=i.messageLengthSize/4,o=0;o<r;++o)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(o,s){"utf8"===s&&(o=n.util.encodeUtf8(o));var c=o.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(o),a(e,r,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var s=n.util.createBuffer();s.putBytes(t.bytes());var c,u=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;s.putBytes(o.substr(0,i.blockLength-u));for(var l=8*i.fullMessageLength[0],d=0;d<i.fullMessageLength.length-1;++d)l+=(c=8*i.fullMessageLength[d+1])/4294967296>>>0,s.putInt32(l>>>0),l=c>>>0;s.putInt32(l);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};a(h,r,s);var f=n.util.createBuffer();return f.putInt32(h.h0),f.putInt32(h.h1),f.putInt32(h.h2),f.putInt32(h.h3),f.putInt32(h.h4),f},i};var o=null,s=!1;function a(e,t,r){for(var n,i,o,s,a,c,u,l=r.length();l>=64;){for(i=e.h0,o=e.h1,s=e.h2,a=e.h3,c=e.h4,u=0;u<16;++u)n=r.getInt32(),t[u]=n,n=(i<<5|i>>>27)+(a^o&(s^a))+c+1518500249+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;u<20;++u)n=(n=t[u-3]^t[u-8]^t[u-14]^t[u-16])<<1|n>>>31,t[u]=n,n=(i<<5|i>>>27)+(a^o&(s^a))+c+1518500249+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;u<32;++u)n=(n=t[u-3]^t[u-8]^t[u-14]^t[u-16])<<1|n>>>31,t[u]=n,n=(i<<5|i>>>27)+(o^s^a)+c+1859775393+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;u<40;++u)n=(n=t[u-6]^t[u-16]^t[u-28]^t[u-32])<<2|n>>>30,t[u]=n,n=(i<<5|i>>>27)+(o^s^a)+c+1859775393+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;u<60;++u)n=(n=t[u-6]^t[u-16]^t[u-28]^t[u-32])<<2|n>>>30,t[u]=n,n=(i<<5|i>>>27)+(o&s|a&(o^s))+c+2400959708+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;for(;u<80;++u)n=(n=t[u-6]^t[u-16]^t[u-28]^t[u-32])<<2|n>>>30,t[u]=n,n=(i<<5|i>>>27)+(o^s^a)+c+3395469782+n,c=a,a=s,s=(o<<30|o>>>2)>>>0,o=i,i=n;e.h0=e.h0+i|0,e.h1=e.h1+o|0,e.h2=e.h2+s|0,e.h3=e.h3+a|0,e.h4=e.h4+c|0,l-=64}}},77404:(e,t,r)=>{var n=r(60392);r(10029),r(63877);var i=e.exports=n.sha256=n.sha256||{};n.md.sha256=n.md.algorithms.sha256=i,i.create=function(){s||(o=String.fromCharCode(128),o+=n.util.fillString(String.fromCharCode(0),64),a=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],s=!0);var e=null,t=n.util.createBuffer(),r=new Array(64),i={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var r=i.messageLengthSize/4,o=0;o<r;++o)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(o,s){"utf8"===s&&(o=n.util.encodeUtf8(o));var a=o.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(o),c(e,r,t),(t.read>2048||0===t.length())&&t.compact(),i},i.digest=function(){var s=n.util.createBuffer();s.putBytes(t.bytes());var a,u=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;s.putBytes(o.substr(0,i.blockLength-u));for(var l=8*i.fullMessageLength[0],d=0;d<i.fullMessageLength.length-1;++d)l+=(a=8*i.fullMessageLength[d+1])/4294967296>>>0,s.putInt32(l>>>0),l=a>>>0;s.putInt32(l);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};c(h,r,s);var f=n.util.createBuffer();return f.putInt32(h.h0),f.putInt32(h.h1),f.putInt32(h.h2),f.putInt32(h.h3),f.putInt32(h.h4),f.putInt32(h.h5),f.putInt32(h.h6),f.putInt32(h.h7),f},i};var o=null,s=!1,a=null;function c(e,t,r){for(var n,i,o,s,c,u,l,d,h,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,d=e.h2,h=e.h3,f=e.h4,p=e.h5,y=e.h6,g=e.h7,c=0;c<64;++c)o=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),s=u&l|d&(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=h+n>>>0,h=d,d=l,l=u,u=n+(i=o+s)>>>0;e.h0=e.h0+u|0,e.h1=e.h1+l|0,e.h2=e.h2+d|0,e.h3=e.h3+h|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}}},34770:(e,t,r)=>{var n=r(60392);r(10029),r(63877);var i=e.exports=n.sha512=n.sha512||{};n.md.sha512=n.md.algorithms.sha512=i;var o=n.sha384=n.sha512.sha384=n.sha512.sha384||{};o.create=function(){return i.create("SHA-384")},n.md.sha384=n.md.algorithms.sha384=o,n.sha512.sha256=n.sha512.sha256||{create:function(){return i.create("SHA-512/256")}},n.md["sha512/256"]=n.md.algorithms["sha512/256"]=n.sha512.sha256,n.sha512.sha224=n.sha512.sha224||{create:function(){return i.create("SHA-512/224")}},n.md["sha512/224"]=n.md.algorithms["sha512/224"]=n.sha512.sha224,i.create=function(e){if(a||(s=String.fromCharCode(128),s+=n.util.fillString(String.fromCharCode(0),128),c=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],(u={})["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],u["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],u["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],u["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],a=!0),"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(),o=new Array(80),d=0;d<80;++d)o[d]=new Array(2);var h=64;switch(e){case"SHA-384":h=48;break;case"SHA-512/256":h=32;break;case"SHA-512/224":h=28}var f={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:h,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){f.messageLength=0,f.fullMessageLength=f.messageLength128=[];for(var e=f.messageLengthSize/4,o=0;o<e;++o)f.fullMessageLength.push(0);i=n.util.createBuffer(),r=new Array(t.length);for(o=0;o<t.length;++o)r[o]=t[o].slice(0);return f}};return f.start(),f.update=function(e,t){"utf8"===t&&(e=n.util.encodeUtf8(e));var s=e.length;f.messageLength+=s,s=[s/4294967296>>>0,s>>>0];for(var a=f.fullMessageLength.length-1;a>=0;--a)f.fullMessageLength[a]+=s[1],s[1]=s[0]+(f.fullMessageLength[a]/4294967296>>>0),f.fullMessageLength[a]=f.fullMessageLength[a]>>>0,s[0]=s[1]/4294967296>>>0;return i.putBytes(e),l(r,o,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(s.substr(0,f.blockLength-c));for(var u=8*f.fullMessageLength[0],d=0;d<f.fullMessageLength.length-1;++d)u+=(a=8*f.fullMessageLength[d+1])/4294967296>>>0,t.putInt32(u>>>0),u=a>>>0;t.putInt32(u);var h=new Array(r.length);for(d=0;d<r.length;++d)h[d]=r[d].slice(0);l(h,o,t);var p,y=n.util.createBuffer();p="SHA-512"===e?h.length:"SHA-384"===e?h.length-2:h.length-4;for(d=0;d<p;++d)y.putInt32(h[d][0]),d===p-1&&"SHA-512/224"===e||y.putInt32(h[d][1]);return y},f};var s=null,a=!1,c=null,u=null;function l(e,t,r){for(var n,i,o,s,a,u,l,d,h,f,p,y,g,m,b,v,w,E,_,S,I,A,R,T,C,P,k,O,N,D,B,x,L,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=(D=t[k-2])[0])>>>19|(N=D[1])<<13)^(N>>>29|O<<3)^O>>>6)>>>0,i=((O<<13|N>>>19)^(N<<3|O>>>29)^(O<<26|N>>>6))>>>0,o=(((O=(x=t[k-15])[0])>>>1|(N=x[1])<<31)^(O>>>8|N<<24)^O>>>7)>>>0,s=((O<<31|N>>>1)^(O<<24|N>>>8)^(O<<25|N>>>7))>>>0,B=t[k-7],L=t[k-16],N=i+B[1]+s+L[1],t[k][0]=n+B[0]+o+L[0]+(N/4294967296>>>0)>>>0,t[k][1]=N>>>0;for(p=e[0][0],y=e[0][1],g=e[1][0],m=e[1][1],b=e[2][0],v=e[2][1],w=e[3][0],E=e[3][1],_=e[4][0],S=e[4][1],I=e[5][0],A=e[5][1],R=e[6][0],T=e[6][1],C=e[7][0],P=e[7][1],k=0;k<80;++k)l=((_>>>14|S<<18)^(_>>>18|S<<14)^(S>>>9|_<<23))>>>0,d=(R^_&(I^R))>>>0,a=((p>>>28|y<<4)^(y>>>2|p<<30)^(y>>>7|p<<25))>>>0,u=((p<<4|y>>>28)^(y<<30|p>>>2)^(y<<25|p>>>7))>>>0,h=(p&g|b&(p^g))>>>0,f=(y&m|v&(y^m))>>>0,N=P+(((_<<18|S>>>14)^(_<<14|S>>>18)^(S<<23|_>>>9))>>>0)+((T^S&(A^T))>>>0)+c[k][1]+t[k][1],n=C+l+d+c[k][0]+t[k][0]+(N/4294967296>>>0)>>>0,i=N>>>0,o=a+h+((N=u+f)/4294967296>>>0)>>>0,s=N>>>0,C=R,P=T,R=I,T=A,I=_,A=S,_=w+n+((N=E+i)/4294967296>>>0)>>>0,S=N>>>0,w=b,E=v,b=g,v=m,g=p,m=y,p=n+o+((N=i+s)/4294967296>>>0)>>>0,y=N>>>0;N=e[0][1]+y,e[0][0]=e[0][0]+p+(N/4294967296>>>0)>>>0,e[0][1]=N>>>0,N=e[1][1]+m,e[1][0]=e[1][0]+g+(N/4294967296>>>0)>>>0,e[1][1]=N>>>0,N=e[2][1]+v,e[2][0]=e[2][0]+b+(N/4294967296>>>0)>>>0,e[2][1]=N>>>0,N=e[3][1]+E,e[3][0]=e[3][0]+w+(N/4294967296>>>0)>>>0,e[3][1]=N>>>0,N=e[4][1]+S,e[4][0]=e[4][0]+_+(N/4294967296>>>0)>>>0,e[4][1]=N>>>0,N=e[5][1]+A,e[5][0]=e[5][0]+I+(N/4294967296>>>0)>>>0,e[5][1]=N>>>0,N=e[6][1]+T,e[6][0]=e[6][0]+R+(N/4294967296>>>0)>>>0,e[6][1]=N>>>0,N=e[7][1]+P,e[7][0]=e[7][0]+C+(N/4294967296>>>0)>>>0,e[7][1]=N>>>0,M-=128}}},63877:(e,t,r)=>{var n=r(21964),i=r(62678).Buffer,o=r(60392),s=r(65754),a=e.exports=o.util=o.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,o=document.createElement("div");t=[];new MutationObserver((function(){var e=t.slice();t.length=0,e.forEach((function(e){e()}))})).observe(o,{attributes:!0});var s=a.setImmediate;a.setImmediate=function(e){Date.now()-r>15?(r=Date.now(),s(e)):(t.push(e),1===t.length&&o.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="",o="",s=0,a=0;r>0;--r,++s)i=e.charCodeAt(s)^t.charCodeAt(s),a>=10&&(n+=o,o="",a=0),o+=String.fromCharCode(i),++a;return n+=o},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+/=",d=[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],h="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";a.encode64=function(e,t){for(var r,n,i,o="",s="",a=0;a<e.length;)r=e.charCodeAt(a++),n=e.charCodeAt(a++),i=e.charCodeAt(a++),o+=l.charAt(r>>2),o+=l.charAt((3&r)<<4|n>>4),isNaN(n)?o+="==":(o+=l.charAt((15&n)<<2|i>>6),o+=isNaN(i)?"=":l.charAt(63&i)),t&&o.length>t&&(s+=o.substr(0,t)+"\r\n",o=o.substr(t));return s+=o},a.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,n,i,o="",s=0;s<e.length;)t=d[e.charCodeAt(s++)-43],r=d[e.charCodeAt(s++)-43],n=d[e.charCodeAt(s++)-43],i=d[e.charCodeAt(s++)-43],o+=String.fromCharCode(t<<2|r>>4),64!==n&&(o+=String.fromCharCode((15&r)<<4|n>>2),64!==i&&(o+=String.fromCharCode((3&n)<<6|i)));return o},a.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},a.decodeUtf8=function(e){return decodeURIComponent(escape(e))},a.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:s.encode,decode:s.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,o=0;o<e.length;++o)n[i++]=e.charCodeAt(o);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,o=r=r||0;for(1&e.length&&(i=1,n[o++]=parseInt(e[0],16));i<e.length;i+=2)n[o++]=parseInt(e.substr(i,2),16);return t?o-r:n},a.binary.base64.encode=function(e,t){for(var r,n,i,o="",s="",a=0;a<e.byteLength;)r=e[a++],n=e[a++],i=e[a++],o+=l.charAt(r>>2),o+=l.charAt((3&r)<<4|n>>4),isNaN(n)?o+="==":(o+=l.charAt((15&n)<<2|i>>6),o+=isNaN(i)?"=":l.charAt(63&i)),t&&o.length>t&&(s+=o.substr(0,t)+"\r\n",o=o.substr(t));return s+=o},a.binary.base64.decode=function(e,t,r){var n,i,o,s,a=t;a||(a=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var c=0,u=r=r||0;c<e.length;)n=d[e.charCodeAt(c++)-43],i=d[e.charCodeAt(c++)-43],o=d[e.charCodeAt(c++)-43],s=d[e.charCodeAt(c++)-43],a[u++]=n<<2|i>>4,64!==o&&(a[u++]=(15&i)<<4|o>>2,64!==s&&(a[u++]=(3&o)<<6|s));return t?u-r:a.subarray(0,u)},a.binary.base58.encode=function(e,t){return a.binary.baseN.encode(e,h,t)},a.binary.base58.decode=function(e,t){return a.binary.baseN.decode(e,h,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,o=0;o<e.length;++o)n[i++]=e.charCodeAt(o);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),o=r=r||0,s=r,a=0;a<e.length;++a)i[s++]=e.charCodeAt(a),o+=2;return t?o-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 o in n){i=!1;break}i&&(n=null),f(e,t,n)}},b=function(e,t){f(e,t,null)},v=function(e,t,r){var n,i=null;"undefined"===typeof r&&(r=["web","flash"]);var o=!1,s=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),o="flash"===n}"web"!==n&&"both"!==n||(t[0]=localStorage,i=e.apply(this,t),o=!0)}catch(c){s=c}if(o)break}if(!o)throw s;return i};a.setItem=function(e,t,r,n,i){v(y,arguments,i)},a.getItem=function(e,t,r,n){return v(g,arguments,n)},a.removeItem=function(e,t,r,n){v(m,arguments,n)},a.clearItems=function(e,t,r){v(b,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,o=[],s=0;t=n.exec(e);){(r=e.substring(s,n.lastIndex-2)).length>0&&o.push(r),s=n.lastIndex;var a=t[0][1];switch(a){case"s":case"o":i<arguments.length?o.push(arguments[1+i++]):o.push("<?>");break;case"%":o.push("%");break;default:o.push("<%"+a+"?>")}}return o.push(e.substring(s)),o.join("")},a.formatNumber=function(e,t,r,n){var i=e,o=isNaN(t=Math.abs(t))?2:t,s=void 0===r?",":r,a=void 0===n?".":n,c=i<0?"-":"",u=parseInt(i=Math.abs(+i||0).toFixed(o),10)+"",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)+(o?s+Math.abs(i-u).toFixed(o).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 o=a.hexToBytes(e[i]);o.length<2&&n.putByte(0),n.putBytes(o)}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 o=a.bytesToHex(e[i]+e[i+1]);"0"===o[0]&&"0"!==o;)o=o.substr(1);if("0"===o){var s=r[r.length-1],c=t.length;s&&c===s.end+1?(s.end=c,s.end-s.start>r[n].end-r[n].start&&(n=r.length-1)):r.push({start:c,end:c})}t.push(o)}if(r.length>0){var u=r[n];u.end-u.start>0&&(t.splice(u.start,u.end-u.start+1,""),0===u.start&&t.unshift(""),7===u.end&&t.push(""))}return t.join(":")},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,o){if(0===i){var s=Math.floor(n.reduce((function(e,t){return e+t}),0)/n.length);return a.cores=Math.max(1,s),URL.revokeObjectURL(r),t(null,a.cores)}!function(e,t){for(var n=[],i=[],o=0;o<e;++o){var s=new Worker(r);s.addEventListener("message",(function(r){if(i.push(r.data),i.length===e){for(var o=0;o<e;++o)n[o].terminate();t(null,i)}})),n.push(s)}for(o=0;o<e;++o)n[o].postMessage(o)}(o,(function(t,r){n.push(function(e,t){for(var r=[],n=0;n<e;++n)for(var i=t[n],o=r[n]=[],s=0;s<e;++s)if(n!==s){var a=t[s];(i.st>a.st&&i.st<a.et||a.st>i.st&&a.st<i.et)&&o.push(s)}return r.reduce((function(e,t){return Math.max(e,t.length)}),0)}(o,r)),e(n,i-1,o)}))}([],5,16)}},3391:(e,t,r)=>{var n=r(60392);r(18605),r(85049),r(71400),r(10029),r(71746),r(72886),r(16193),r(30325),r(25493),r(63877);var i=n.asn1,o=e.exports=n.pki=n.pki||{},s=o.oids,a={};a.CN=s.commonName,a.commonName="CN",a.C=s.countryName,a.countryName="C",a.L=s.localityName,a.localityName="L",a.ST=s.stateOrProvinceName,a.stateOrProvinceName="ST",a.O=s.organizationName,a.organizationName="O",a.OU=s.organizationalUnitName,a.organizationalUnitName="OU",a.E=s.emailAddress,a.emailAddress="E";var c=n.pki.rsa.publicKeyValidator,u={name:"Certificate",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:i.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:i.Class.UNIVERSAL,type:i.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:i.Class.UNIVERSAL,type:i.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:i.Class.UNIVERSAL,type:i.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:i.Class.UNIVERSAL,type:i.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},c,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:i.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:i.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:i.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},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"}]}]},d={name:"CertificationRequestInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},c,{name:"CertificationRequestInfo.attributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0}]}]}]},h={name:"CertificationRequest",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[d,{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}o.RDNAttributesAsArray=function(e,t){for(var r,n,o,c=[],u=0;u<e.value.length;++u){r=e.value[u];for(var l=0;l<r.value.length;++l)o={},n=r.value[l],o.type=i.derToOid(n.value[0].value),o.value=n.value[1].value,o.valueTagClass=n.value[1].type,o.type in s&&(o.name=s[o.type],o.name in a&&(o.shortName=a[o.name])),t&&(t.update(o.type),t.update(o.value)),c.push(o)}return c},o.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 d={};if(d.type=c,d.value=u[l].value,d.valueTagClass=u[l].type,d.type in s&&(d.name=s[d.type],d.name in a&&(d.shortName=a[d.name])),d.type===s.extensionRequest){d.extensions=[];for(var h=0;h<d.value.length;++h)d.extensions.push(o.certificateExtensionFromAsn1(d.value[h]))}t.push(d)}return t};var p=function(e,t,r){var n={};if(e!==s["RSASSA-PSS"])return n;r&&(n={hash:{algorithmOid:s.sha1},mgf:{algorithmOid:s.mgf1,hash:{algorithmOid:s.sha1}},saltLength:20});var o={},a=[];if(!i.validate(t,l,o,a)){var c=new Error("Cannot read RSASSA-PSS parameter block.");throw c.errors=a,c}return void 0!==o.hashOid&&(n.hash=n.hash||{},n.hash.algorithmOid=i.derToOid(o.hashOid)),void 0!==o.maskGenOid&&(n.mgf=n.mgf||{},n.mgf.algorithmOid=i.derToOid(o.maskGenOid),n.mgf.hash=n.mgf.hash||{},n.mgf.hash.algorithmOid=i.derToOid(o.maskGenHashOid)),void 0!==o.saltLength&&(n.saltLength=o.saltLength.charCodeAt(0)),n},y=function(e){switch(s[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 s.sha1WithRSAEncryption:case s.sha1WithRSASignature:break;case s["RSASSA-PSS"]:var i,o,a;if(void 0===(i=s[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===(o=s[r.signatureParameters.mgf.algorithmOid])||void 0===n.mgf[o])throw(a=new Error("Unsupported MGF function.")).oid=r.signatureParameters.mgf.algorithmOid,a.name=o,a;if(o=n.mgf[o].create(n.md[i].create()),void 0===(i=s[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(),o,r.signatureParameters.saltLength)}return r.publicKey.verify(e.md.digest().getBytes(),e.signature,t)};function m(e){for(var t,r,o=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),s=e.attributes,a=0;a<s.length;++a){var c=(t=s[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)])]),o.value.push(r)}return o}function b(e){for(var t,r=0;r<e.length;++r){if("undefined"===typeof(t=e[r]).name&&(t.type&&t.type in o.oids?t.name=o.oids[t.type]:t.shortName&&t.shortName in a&&(t.name=o.oids[a[t.shortName]])),"undefined"===typeof t.type){if(!t.name||!(t.name in o.oids))throw(c=new Error("Attribute type not specified.")).attribute=t,c;t.type=o.oids[t.name]}if("undefined"===typeof t.shortName&&t.name&&t.name in a&&(t.shortName=a[t.name]),t.type===s.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(o.certificateExtensionToAsn1(v(t.extensions[n])))}var c;if("undefined"===typeof t.value)throw(c=new Error("Attribute value not specified.")).attribute=t,c}}function v(e,t){if(t=t||{},"undefined"===typeof e.name&&e.id&&e.id in o.oids&&(e.name=o.oids[e.id]),"undefined"===typeof e.id){if(!e.name||!(e.name in o.oids))throw(E=new Error("Extension ID not specified.")).extension=e,E;e.id=o.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 d in e)!0===e[d]&&(d in s?l.push(i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(s[d]).getBytes())):-1!==d.indexOf(".")&&l.push(i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(d).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 h=0;h<e.altNames.length;++h){u=(b=e.altNames[h]).value;if(7===b.type&&b.ip){if(null===(u=n.util.bytesFromIP(b.ip)))throw(E=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=e,E}else 8===b.type&&(u=b.oid?i.oidToDer(i.oidToDer(b.oid)):i.oidToDer(u));e.value.value.push(i.create(i.Class.CONTEXT_SPECIFIC,b.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 b,v=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),w=i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[]);for(h=0;h<e.altNames.length;++h){u=(b=e.altNames[h]).value;if(7===b.type&&b.ip){if(null===(u=n.util.bytesFromIP(b.ip)))throw(E=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=e,E}else 8===b.type&&(u=b.oid?i.oidToDer(i.oidToDer(b.oid)):i.oidToDer(u));w.value.push(i.create(i.Class.CONTEXT_SPECIFIC,b.type,!1,u))}v.value.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[w])),l.push(v)}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===s["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,o=0;o<r.length;++o){var s=r[o],a=s.value,c=i.Type.UTF8;"valueTagClass"in s&&(c=s.valueTagClass),c===i.Type.UTF8&&(a=n.util.encodeUtf8(a));var u=!1;"valueConstructed"in s&&(u=s.valueConstructed);var l=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(s.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}o.certificateFromPem=function(e,t,r){var s=n.pem.decode(e)[0];if("CERTIFICATE"!==s.type&&"X509 CERTIFICATE"!==s.type&&"TRUSTED CERTIFICATE"!==s.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=s.type,a}if(s.procType&&"ENCRYPTED"===s.procType.type)throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var c=i.fromDer(s.body,r);return o.certificateFromAsn1(c,t)},o.certificateToPem=function(e,t){var r={type:"CERTIFICATE",body:i.toDer(o.certificateToAsn1(e)).getBytes()};return n.pem.encode(r,{maxline:t})},o.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 s=i.fromDer(t.body);return o.publicKeyFromAsn1(s)},o.publicKeyToPem=function(e,t){var r={type:"PUBLIC KEY",body:i.toDer(o.publicKeyToAsn1(e)).getBytes()};return n.pem.encode(r,{maxline:t})},o.publicKeyToRSAPublicKeyPem=function(e,t){var r={type:"RSA PUBLIC KEY",body:i.toDer(o.publicKeyToRSAPublicKey(e)).getBytes()};return n.pem.encode(r,{maxline:t})},o.getPublicKeyFingerprint=function(e,t){var r,s=(t=t||{}).md||n.md.sha1.create();switch(t.type||"RSAPublicKey"){case"RSAPublicKey":r=i.toDer(o.publicKeyToRSAPublicKey(e)).getBytes();break;case"SubjectPublicKeyInfo":r=i.toDer(o.publicKeyToAsn1(e)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+t.type+'".')}s.start(),s.update(r);var a=s.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},o.certificationRequestFromPem=function(e,t,r){var s=n.pem.decode(e)[0];if("CERTIFICATE REQUEST"!==s.type){var a=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw a.headerType=s.type,a}if(s.procType&&"ENCRYPTED"===s.procType.type)throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var c=i.fromDer(s.body,r);return o.certificationRequestFromAsn1(c,t)},o.certificationRequestToPem=function(e,t){var r={type:"CERTIFICATE REQUEST",body:i.toDer(o.certificationRequestToAsn1(e)).getBytes()};return n.pem.encode(r,{maxline:t})},o.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){b([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){b([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){b(t),e.subject.attributes=t,delete e.subject.uniqueId,r&&(e.subject.uniqueId=r),e.subject.hash=null},e.setIssuer=function(t,r){b(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)v(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=s[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=o.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,s=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=s.attributes,a.actualIssuer=n.attributes,a}var c=t.md;if(null===c){c=y({signatureOid:t.signatureOid,type:"certificate"});var u=t.tbsCertificate||o.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 o,s;r=!0;for(var a=0;r&&a<n.attributes.length;++a)o=n.attributes[a],s=i.attributes[a],o.type===s.type&&o.value===s.value||(r=!1)}return r},e.issued=function(t){return t.isIssuer(e)},e.generateSubjectKeyIdentifier=function(){return o.getPublicKeyFingerprint(e.publicKey,{type:"RSAPublicKey"})},e.verifySubjectKeyIdentifier=function(){for(var t=s.subjectKeyIdentifier,r=0;r<e.extensions.length;++r){var i=e.extensions[r];if(i.id===t){var o=e.generateSubjectKeyIdentifier().getBytes();return n.util.hexToBytes(i.subjectKeyIdentifier)===o}}return!1},e},o.certificateFromAsn1=function(e,t){var r={},s=[];if(!i.validate(e,u,r,s)){var a=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw a.errors=s,a}if(i.derToOid(r.publicKeyOid)!==o.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var c=o.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 d=[];if(void 0!==r.certValidity1UTCTime&&d.push(i.utcTimeToDate(r.certValidity1UTCTime)),void 0!==r.certValidity2GeneralizedTime&&d.push(i.generalizedTimeToDate(r.certValidity2GeneralizedTime)),void 0!==r.certValidity3UTCTime&&d.push(i.utcTimeToDate(r.certValidity3UTCTime)),void 0!==r.certValidity4GeneralizedTime&&d.push(i.generalizedTimeToDate(r.certValidity4GeneralizedTime)),d.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(d.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(c.validity.notBefore=d[0],c.validity.notAfter=d[1],c.tbsCertificate=r.tbsCertificate,t){c.md=y({signatureOid:c.signatureOid,type:"certificate"});var h=i.toDer(c.tbsCertificate);c.md.update(h.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){b([e]),c.issuer.attributes.push(e)},c.issuer.attributes=o.RDNAttributesAsArray(r.certIssuer),r.certIssuerUniqueId&&(c.issuer.uniqueId=r.certIssuerUniqueId),c.issuer.hash=g.digest().toHex();var v=n.md.sha1.create(),w=i.toDer(r.certSubject);return v.update(w.getBytes()),c.subject.getField=function(e){return f(c.subject,e)},c.subject.addField=function(e){b([e]),c.subject.attributes.push(e)},c.subject.attributes=o.RDNAttributesAsArray(r.certSubject),r.certSubjectUniqueId&&(c.subject.uniqueId=r.certSubjectUniqueId),c.subject.hash=v.digest().toHex(),r.certExtensions?c.extensions=o.certificateExtensionsFromAsn1(r.certExtensions):c.extensions=[],c.publicKey=o.publicKeyFromAsn1(r.subjectPublicKeyInfo),c},o.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r<e.value.length;++r)for(var n=e.value[r],i=0;i<n.value.length;++i)t.push(o.certificateExtensionFromAsn1(n.value[i]));return t},o.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 s)if(t.name=s[t.id],"keyUsage"===t.name){var r=0,o=0;(c=i.fromDer(t.value)).value.length>1&&(r=c.value.charCodeAt(1),o=c.value.length>2?c.value.charCodeAt(2):0),t.digitalSignature=128===(128&r),t.nonRepudiation=64===(64&r),t.keyEncipherment=32===(32&r),t.dataEncipherment=16===(16&r),t.keyAgreement=8===(8&r),t.keyCertSign=4===(4&r),t.cRLSign=2===(2&r),t.encipherOnly=1===(1&r),t.decipherOnly=128===(128&o)}else if("basicConstraints"===t.name){(c=i.fromDer(t.value)).value.length>0&&c.value[0].type===i.Type.BOOLEAN?t.cA=0!==c.value[0].value.charCodeAt(0):t.cA=!1;var a=null;c.value.length>0&&c.value[0].type===i.Type.INTEGER?a=c.value[0].value:c.value.length>1&&(a=c.value[1].value),null!==a&&(t.pathLenConstraint=i.derToInteger(a))}else if("extKeyUsage"===t.name)for(var c=i.fromDer(t.value),u=0;u<c.value.length;++u){var l=i.derToOid(c.value[u].value);l in s?t[s[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 d;t.altNames=[];c=i.fromDer(t.value);for(var h=0;h<c.value.length;++h){var f={type:(d=c.value[h]).type,value:d.value};switch(t.altNames.push(f),d.type){case 1:case 2:case 6:break;case 7:f.ip=n.util.bytesToIP(d.value);break;case 8:f.oid=i.derToOid(d.value)}}}else if("subjectKeyIdentifier"===t.name){c=i.fromDer(t.value);t.subjectKeyIdentifier=n.util.bytesToHex(c.value)}return t},o.certificationRequestFromAsn1=function(e,t){var r={},s=[];if(!i.validate(e,h,r,s)){var a=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw a.errors=s,a}if(i.derToOid(r.publicKeyOid)!==o.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var c=o.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){b([e]),c.subject.attributes.push(e)},c.subject.attributes=o.RDNAttributesAsArray(r.certificationRequestInfoSubject,l),c.subject.hash=l.digest().toHex(),c.publicKey=o.publicKeyFromAsn1(r.subjectPublicKeyInfo),c.getAttribute=function(e){return f(c,e)},c.addAttribute=function(e){b([e]),c.attributes.push(e)},c.attributes=o.CRIAttributesAsArray(r.certificationRequestInfoAttributes||[]),c},o.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){b([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){b([t]),e.attributes.push(t)},e.md=null,e.setSubject=function(t){b(t),e.subject.attributes=t,e.subject.hash=null},e.setAttributes=function(t){b(t),e.attributes=t},e.sign=function(t,r){e.md=r||n.md.sha1.create();var a=s[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=o.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||o.getCertificationRequestInfo(e),s=i.toDer(n);r.update(s.getBytes())}return null!==r&&(t=g({certificate:e,md:r,signature:e.signature})),t},e};var _=new Date("1950-01-01T00:00:00Z"),S=new Date("2050-01-01T00:00:00Z");function I(e){return e>=_&&e<S?i.create(i.Class.UNIVERSAL,i.Type.UTCTIME,!1,i.dateToUtcTime(e)):i.create(i.Class.UNIVERSAL,i.Type.GENERALIZEDTIME,!1,i.dateToGeneralizedTime(e))}o.getTBSCertificate=function(e){var t=I(e.validity.notBefore),r=I(e.validity.notAfter),s=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),o.publicKeyToAsn1(e.publicKey)]);return e.issuer.uniqueId&&s.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&&s.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&&s.value.push(o.certificateExtensionsToAsn1(e.extensions)),s},o.getCertificationRequestInfo=function(e){return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes()),m(e.subject),o.publicKeyToAsn1(e.publicKey),E(e)])},o.distinguishedNameToAsn1=function(e){return m(e)},o.certificateToAsn1=function(e){var t=e.tbsCertificate||o.getTBSCertificate(e);return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[t,i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.signatureOid).getBytes()),w(e.signatureOid,e.signatureParameters)]),i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},o.certificateExtensionsToAsn1=function(e){var t=i.create(i.Class.CONTEXT_SPECIFIC,3,!0,[]),r=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;n<e.length;++n)r.value.push(o.certificateExtensionToAsn1(e[n]));return t},o.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},o.certificationRequestToAsn1=function(e){var t=e.certificationRequestInfo||o.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)])},o.createCaStore=function(e){var t={certs:{}};function r(e){return s(e),t.certs[e.hash]||null}function s(e){if(!e.hash){var t=n.md.sha1.create();e.attributes=o.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)),s(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 s=i.toDer(o.certificateToAsn1(e)).getBytes(),a=0;a<t.length;++a){if(s===i.toDer(o.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 o=0;o<i.length;++o)e.push(i[o]);else e.push(i)}return e},t.removeCertificate=function(e){var a;if("string"===typeof e&&(e=n.pki.certificateFromPem(e)),s(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(o.certificateToAsn1(e)).getBytes(),l=0;l<c.length;++l){u===i.toDer(o.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},o.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"},o.verifyCertificateChain=function(e,t,r){"function"===typeof r&&(r={verify:r}),r=r||{};var i=(t=t.slice(0)).slice(0),s=r.validityCheckDate;"undefined"===typeof s&&(s=new Date);var a=!0,c=null,u=0;do{var l=t.shift(),d=null,h=!1;if(s&&(s<l.validity.notBefore||s>l.validity.notAfter)&&(c={message:"Certificate is not valid yet or has expired.",error:o.certificateError.certificate_expired,notBefore:l.validity.notBefore,notAfter:l.validity.notAfter,now:s}),null===c){if(null===(d=t[0]||e.getIssuer(l))&&l.isIssuer(l)&&(h=!0,d=l),d){var f=d;n.util.isArray(f)||(f=[f]);for(var p=!1;!p&&f.length>0;){d=f.shift();try{p=d.verify(l)}catch(_){}}p||(c={message:"Certificate signature is invalid.",error:o.certificateError.bad_certificate})}null!==c||d&&!h||e.hasCertificate(l)||(c={message:"Certificate is not trusted.",error:o.certificateError.unknown_ca})}if(null===c&&d&&!l.isIssuer(d)&&(c={message:"Certificate issuer is invalid.",error:o.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:o.certificateError.unsupported_certificate})}if(null===c&&(!a||0===t.length&&(!d||h))){var b=l.getExtension("basicConstraints"),v=l.getExtension("keyUsage");if(null!==v&&(v.keyCertSign&&null!==b||(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:o.certificateError.bad_certificate})),null!==c||null===b||b.cA||(c={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:o.certificateError.bad_certificate}),null===c&&null!==v&&"pathLenConstraint"in b)u-1>b.pathLenConstraint&&(c={message:"Certificate basicConstraints pathLenConstraint violated.",error:o.certificateError.bad_certificate})}var w=null===c||c.error,E=r.verify?r.verify(w,u,i):w;if(!0!==E)throw!0===w&&(c={message:"The application rejected the certificate.",error:o.certificateError.bad_certificate}),(E||0===E)&&("object"!==typeof E||n.util.isArray(E)?"string"===typeof E&&(c.error=E):(E.message&&(c.message=E.message),E.error&&(c.error=E.error))),c;c=null,a=!1,++u}while(t.length>0);return!0}},22592:e=>{"use strict";var t=function(e){return e!==e};e.exports=function(e,r){return 0===e&&0===r?1/e===1/r:e===r||!(!t(e)||!t(r))}},33454:(e,t,r)=>{"use strict";var n=r(9396),i=r(19722),o=r(22592),s=r(83355),a=r(13118),c=i(s(),Object);n(c,{getPolyfill:s,implementation:o,shim:a}),e.exports=c},83355:(e,t,r)=>{"use strict";var n=r(22592);e.exports=function(){return"function"===typeof Object.is?Object.is:n}},13118:(e,t,r)=>{"use strict";var n=r(83355),i=r(9396);e.exports=function(){var e=n();return i(Object,{is:e},{is:function(){return Object.is!==e}}),e}},41949:(e,t,r)=>{"use strict";var n;if(!Object.keys){var i=Object.prototype.hasOwnProperty,o=Object.prototype.toString,s=r(27635),a=Object.prototype.propertyIsEnumerable,c=!a.call({toString:null},"toString"),u=a.call((function(){}),"prototype"),l=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],d=function(e){var t=e.constructor;return t&&t.prototype===e},h={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},f=function(){if("undefined"===typeof window)return!1;for(var e in window)try{if(!h["$"+e]&&i.call(window,e)&&null!==window[e]&&"object"===typeof window[e])try{d(window[e])}catch(t){return!0}}catch(t){return!0}return!1}();n=function(e){var t=null!==e&&"object"===typeof e,r="[object Function]"===o.call(e),n=s(e),a=t&&"[object String]"===o.call(e),h=[];if(!t&&!r&&!n)throw new TypeError("Object.keys called on a non-object");var p=u&&r;if(a&&e.length>0&&!i.call(e,0))for(var y=0;y<e.length;++y)h.push(String(y));if(n&&e.length>0)for(var g=0;g<e.length;++g)h.push(String(g));else for(var m in e)p&&"prototype"===m||!i.call(e,m)||h.push(String(m));if(c)for(var b=function(e){if("undefined"===typeof window||!f)return d(e);try{return d(e)}catch(t){return!1}}(e),v=0;v<l.length;++v)b&&"constructor"===l[v]||!i.call(e,l[v])||h.push(l[v]);return h}}e.exports=n},24892:(e,t,r)=>{"use strict";var n=Array.prototype.slice,i=r(27635),o=Object.keys,s=o?function(e){return o(e)}:r(41949),a=Object.keys;s.shim=function(){if(Object.keys){var e=function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2);e||(Object.keys=function(e){return i(e)?a(n.call(e)):a(e)})}else Object.keys=s;return Object.keys||s},e.exports=s},27635:e=>{"use strict";var t=Object.prototype.toString;e.exports=function(e){var r=t.call(e),n="[object Arguments]"===r;return n||(n="[object Array]"!==r&&null!==e&&"object"===typeof e&&"number"===typeof e.length&&e.length>=0&&"[object Function]"===t.call(e.callee)),n}},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})))))},35789:(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()()},o=function(e,t){r++;for(var o=arguments.length,s=new Array(o>2?o-2:0),a=2;a<o;a++)s[a-2]=arguments[a];const c=n(e,...s);t(c),c.then(i,i)},s=function(n,i){for(var s=arguments.length,a=new Array(s>2?s-2:0),c=2;c<s;c++)a[c-2]=arguments[c];r<e?o(n,i,...a):t.push(o.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=>s(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},12906:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(97143),i=r(39744),o=r(95152),s=()=>{},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=s,this._resolveIdle=s,!("number"===typeof(e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:o.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=s,0===this._pendingCount&&(this._resolveIdle(),this._resolveIdle=s,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 o=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 o)}catch(o){n(o)}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 o=i/2|0;let s=n+o;r(e[s],t)<=0?(n=++s,i-=o+1):i=o}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 o=(e,t,r)=>new Promise(((o,s)=>{if("number"!==typeof t||t<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(t===1/0)return void o(e);const a=setTimeout((()=>{if("function"===typeof r){try{o(r())}catch(c){s(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(),s(a)}),t);n(e.then(o,s),(()=>{clearTimeout(a)}))}));e.exports=o,e.exports.default=o,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 o extends Error{constructor(e){super(),e instanceof Error?(this.originalError=e,({message:e}=e)):(this.originalError=new Error(e),this.originalError.stack=this.stack),this.name="AbortError",this.message=e}}const s=(e,t)=>new Promise(((r,s)=>{t={onFailedAttempt:()=>{},retries:10,...t};const a=n.operation(t);a.attempt((async n=>{try{r(await e(n))}catch(u){if(!(u instanceof Error))return void s(new TypeError('Non-error was thrown: "'.concat(u,'". You should only throw errors.')));if(u instanceof o)a.stop(),s(u.originalError);else if(u instanceof TypeError&&(c=u.message,!i.includes(c)))a.stop(),s(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 s(u)}a.retry(u)||s(a.mainError())}}var c}))}));e.exports=s,e.exports.default=s,e.exports.AbortError=o},3781:(e,t,r)=>{"use strict";const n=r(92963),i=r(35789);e.exports=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{concurrency:r=1/0}=t,o=i(r);return Promise.all(e.map((e=>e&&"function"===typeof e.then?n(e):n("function"===typeof e?o((()=>e())):Promise.resolve(e)))))}},22514:(e,t,r)=>{"use strict";const n=r(64928),i=r(28055);class o extends Error{}e.exports=(e,t)=>new i(((r,i,s)=>{const{count:a,filter:c=(()=>!0)}=t;if(!Number.isFinite(a))return void i(new TypeError("Expected a finite number, got ".concat(typeof t.count)));const u=[],l=[];let d=0,h=!1;const f=new Set,p=()=>{for(const t of e)f.has(t)||"function"!==typeof t.cancel||t.cancel()};s(p);for(const t of e)d++,(async()=>{try{const e=await t;if(h)return;if(!c(e))throw new o("Value does not satisfy filter");u.push(e)}catch(e){l.push(e)}finally{f.add(t),!h&&(u.length===a&&(r(u),h=!0),d-l.length<a&&(i(new n(l)),h=!0),h)&&p()}})();a>d&&(i(new RangeError("Expected input to contain at least ".concat(t.count," items, but contains ").concat(d," items"))),p())})),e.exports.AggregateError=n,e.exports.FilterError=o},23807:e=>{"use strict";class t extends Error{constructor(e){super(e),this.name="TimeoutError"}}const r=(e,r,n,i)=>{let o;const s=new Promise(((s,a)=>{if("number"!==typeof r||r<0)throw new TypeError("Expected `milliseconds` to be a positive number");r!==1/0?(i={customTimers:{setTimeout:setTimeout,clearTimeout:clearTimeout},...i},o=i.customTimers.setTimeout.call(void 0,(()=>{if("function"===typeof n){try{s(n())}catch(c){a(c)}return}const i="string"===typeof n?n:"Promise timed out after ".concat(r," milliseconds"),o=n instanceof Error?n:new t(i);"function"===typeof e.cancel&&e.cancel(),a(o)}),r),(async()=>{try{s(await e)}catch(t){a(t)}finally{i.customTimers.clearTimeout.call(void 0,o)}})()):s(e)}));return s.clear=()=>{clearTimeout(o),o=void 0},s};e.exports=r,e.exports.default=r,e.exports.TimeoutError=t},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),o=r(45645),s=r(86898),a=r(24426),{base58btc:c}=r(86898),{base32:u}=r(71128),{base16:l}=r(24031),d=r(8315),h=r(36552),f=r(83708),{PeerIdProto:p}=r(48956),{equals:y}=r(98779),{fromString:g}=r(46765),{toString:m}=r(82051),{identity:b}=r(60173),v={...i,...o,...s,...a},w=Object.keys(v).reduce(((e,t)=>e.or(v[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=d.decode(this.id);e.code===b.code&&(this._pubKey=h.unmarshalPublicKey(e.digest))}catch(e){}return this._pubKey}set pubKey(e){this._pubKey=e}marshalPubKey(){if(this.pubKey)return h.marshalPublicKey(this.pubKey)}marshalPrivKey(){if(this.privKey)return h.marshalPrivateKey(this.privKey)}marshal(e){return p.encode({id:this.toBytes(),pubKey:this.marshalPubKey(),privKey:e?null:this.marshalPrivKey()}).finish()}toPrint(){let e=this.toB58String();e.startsWith("Qm")&&(e=e.slice(2));let t=6;return e.length<t&&(t=e.length),"<peer.ID "+e.substr(0,t)+">"}toJSON(){return{id:this.toB58String(),privKey:A(this.marshalPrivKey()),pubKey:A(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,d.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(d.decode(this.id).code===b.code)return!0}catch(e){}return!1}},{className:"PeerId",symbolName:"@libp2p/js-peer-id/PeerId"});t=e.exports=E;const _=e=>e.bytes.length<=42?d.create(b.code,e.bytes).bytes:e.hash(),S=async(e,t)=>{const r=await _(t);return new E(r,e,t)};t.create=async e=>{(e=e||{}).bits=e.bits||2048,e.keyType=e.keyType||"RSA";const t=await h.generateKeyPair(e.keyType,e.bits);return S(t,t.public)},t.createFromHexString=e=>new E(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(d.decode(e).code!==b.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 A(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 h.unmarshalPublicKey(t);return S(void 0,r)},t.createFromPrivKey=async e=>{if("string"===typeof e&&(e=g(e,"base64pad")),!(e instanceof Uint8Array))throw new Error("Supplied key is neither a base64 string nor a Uint8Array");const t=await h.unmarshalPrivateKey(e);return S(t,t.public)},t.createFromJSON=async e=>{const t=c.decode("z"+e.id),r=e.privKey&&g(e.privKey,"base64pad"),n=e.pubKey&&g(e.pubKey,"base64pad"),i=n&&await h.unmarshalPublicKey(n);if(!r)return new E(t,void 0,i);const o=await h.unmarshalPrivateKey(r),s=await _(o.public);let a;if(i&&(a=await _(i)),i&&!y(s,a))throw new Error("Public and private key do not match");if(t&&!y(s,t))throw new Error("Id and private key do not match");return new E(t,o,i)},t.createFromProtobuf=async e=>{"string"===typeof e&&(e=g(e,"base16"));let t,r,{id:n,privKey:i,pubKey:o}=p.decode(e);if(i=!!i&&await h.unmarshalPrivateKey(i),o=!!o&&await h.unmarshalPublicKey(o),i&&(r=await _(i.public)),o&&(t=await _(o)),i){if(o&&!y(r,t))throw new Error("Public and private key do not match");return new E(r,i,i.public)}if(o)return new E(t,void 0,o);if(n)return new E(n);throw new Error("Protobuf did not contain any usable key material")},t.parse=e=>("1"!==e.charAt(0)&&"Q"!==e.charAt(0)||(e="z".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,o=n.Writer,s=n.util,a=n.roots["libp2p-peer-id"]||(n.roots["libp2p-peer-id"]={});a.PeerIdProto=function(){function e(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return e.prototype.id=s.newBuffer([]),e.prototype.pubKey=s.newBuffer([]),e.prototype.privKey=s.newBuffer([]),e.encode=function(e,t){return t||(t=o.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 o=e.uint32();switch(o>>>3){case 1:n.id=e.bytes();break;case 2:n.pubKey=e.bytes();break;case 3:n.privKey=e.bytes();break;default:e.skipType(7&o)}}if(!n.hasOwnProperty("id"))throw s.ProtocolError("missing required 'id'",{instance:n});return n},e.fromObject=function(e){if(e instanceof a.PeerIdProto)return e;var t=new a.PeerIdProto;return null!=e.id&&("string"===typeof e.id?s.base64.decode(e.id,t.id=s.newBuffer(s.base64.length(e.id)),0):e.id.length&&(t.id=e.id)),null!=e.pubKey&&("string"===typeof e.pubKey?s.base64.decode(e.pubKey,t.pubKey=s.newBuffer(s.base64.length(e.pubKey)),0):e.pubKey.length&&(t.pubKey=e.pubKey)),null!=e.privKey&&("string"===typeof e.privKey?s.base64.decode(e.privKey,t.privKey=s.newBuffer(s.base64.length(e.privKey)),0):e.privKey.length&&(t.privKey=e.privKey)),t},e.toObject=function(e,t){t||(t={});var r={};return t.defaults&&(t.bytes===String?r.id="":(r.id=[],t.bytes!==Array&&(r.id=s.newBuffer(r.id))),t.bytes===String?r.pubKey="":(r.pubKey=[],t.bytes!==Array&&(r.pubKey=s.newBuffer(r.pubKey))),t.bytes===String?r.privKey="":(r.privKey=[],t.bytes!==Array&&(r.privKey=s.newBuffer(r.privKey)))),null!=e.id&&e.hasOwnProperty("id")&&(r.id=t.bytes===String?s.base64.encode(e.id,0,e.id.length):t.bytes===Array?Array.prototype.slice.call(e.id):e.id),null!=e.pubKey&&e.hasOwnProperty("pubKey")&&(r.pubKey=t.bytes===String?s.base64.encode(e.pubKey,0,e.pubKey.length):t.bytes===Array?Array.prototype.slice.call(e.pubKey):e.pubKey),null!=e.privKey&&e.hasOwnProperty("privKey")&&(r.privKey=t.bytes===String?s.base64.encode(e.privKey,0,e.privKey.length):t.bytes===Array?Array.prototype.slice.call(e.privKey):e.privKey),r},e.prototype.toJSON=function(){return this.constructor.toObject(this,n.util.toJSONOptions)},e}(),e.exports=a},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),o=n(r(28974)),s=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(s.default(e)&&o.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"},80886:(e,t,r)=>{"use strict";e.exports=r(94722)},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()},36216:(e,t,r)=>{"use strict";e.exports=c;var n,i=r(3097),o=i.LongBits,s=i.utf8;function a(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function c(e){this.buf=e,this.pos=0,this.len=e.length}var u="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 d(){var e=new o(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function h(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 o(h(this.buf,this.pos+=4),h(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 h(this.buf,this.pos+=4)},c.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return 0|h(this.buf,this.pos+=4)},c.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var e=i.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},c.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var e=i.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},c.prototype.bytes=function(){var e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?new this.buf.constructor(0):this._slice.call(this.buf,t,r)},c.prototype.string=function(){var e=this.bytes();return s.read(e,0,e.length)},c.prototype.skip=function(e){if("number"===typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},c.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!==(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},c._configure=function(e){n=e,c.create=l(),n._configure();var t=i.Long?"toLong":"toNumber";i.merge(c.prototype,{int64:function(){return d.call(this)[t](!1)},uint64:function(){return d.call(this)[t](!0)},sint64:function(){return d.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=o;var n=r(36216);(o.prototype=Object.create(n.prototype)).constructor=o;var i=r(3097);function o(e){n.call(this,e)}o._configure=function(){i.Buffer&&(o.prototype._slice=i.Buffer.prototype.slice)},o.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},o._configure()},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,o,s){if(!o)throw TypeError("request must be specified");var a=this;if(!s)return n.asPromise(e,a,t,r,i,o);if(a.rpcImpl)try{return a.rpcImpl(t,r[a.requestDelimited?"encodeDelimited":"encode"](o).finish(),(function(e,r){if(e)return a.emit("error",e,t),s(e);if(null!==r){if(!(r instanceof i))try{r=i[a.responseDelimited?"decodeDelimited":"decode"](r)}catch(e){return a.emit("error",e,t),s(e)}return a.emit("data",r,t),s(null,r)}a.end(!0)}))}catch(c){return a.emit("error",c,t),void setTimeout((function(){s(c)}),0)}else setTimeout((function(){s(Error("already ended"))}),0)},i.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},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 o=i.zero=new i(0,0);o.toNumber=function(){return 0},o.zzEncode=o.zzDecode=function(){return this},o.length=function(){return 1};var s=i.zeroHash="\0\0\0\0\0\0\0\0";i.fromNumber=function(e){if(0===e)return o;var t=e<0;t&&(e=-e);var r=e>>>0,n=(e-r)/4294967296>>>0;return t&&(n=~n>>>0,r=~r>>>0,++r>4294967295&&(r=0,++n>4294967295&&(n=0))),new i(r,n)},i.from=function(e){if("number"===typeof e)return i.fromNumber(e);if(n.isString(e)){if(!n.Long)return i.fromNumber(parseInt(e,10));e=n.Long.fromString(e)}return e.low||e.high?new i(e.low>>>0,e.high>>>0):o},i.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(e){return n.Long?new n.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var a=String.prototype.charCodeAt;i.fromHash=function(e){return e===s?o:new i((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},i.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},i.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},i.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},i.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}},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 o(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=o,n.ProtocolError=o("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}},77063:(e,t,r)=>{"use strict";e.exports=d;var n,i=r(3097),o=i.LongBits,s=i.base64,a=i.utf8;function c(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function u(){}function l(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function d(){this.len=0,this.head=new c(u,0,0),this.tail=this.head,this.states=null}var h=function(){return i.Buffer?function(){return(d.create=function(){return new n})()}:function(){return new d}};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}d.create=h(),d.alloc=function(e){return new i.Array(e)},i.Array!==Array&&(d.alloc=i.pool(d.alloc,i.Array.prototype.subarray)),d.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},d.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},d.prototype.int32=function(e){return e<0?this._push(y,10,o.fromNumber(e)):this.uint32(e)},d.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},d.prototype.uint64=function(e){var t=o.from(e);return this._push(y,t.length(),t)},d.prototype.int64=d.prototype.uint64,d.prototype.sint64=function(e){var t=o.from(e).zzEncode();return this._push(y,t.length(),t)},d.prototype.bool=function(e){return this._push(f,1,e?1:0)},d.prototype.fixed32=function(e){return this._push(g,4,e>>>0)},d.prototype.sfixed32=d.prototype.fixed32,d.prototype.fixed64=function(e){var t=o.from(e);return this._push(g,4,t.lo)._push(g,4,t.hi)},d.prototype.sfixed64=d.prototype.fixed64,d.prototype.float=function(e){return this._push(i.float.writeFloatLE,4,e)},d.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]};d.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(f,1,0);if(i.isString(e)){var r=d.alloc(t=s.length(e));s.decode(e,r,0),e=r}return this.uint32(t)._push(m,t,e)},d.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(f,1,0)},d.prototype.fork=function(){return this.states=new l(this),this.head=this.tail=new c(u,0,0),this.len=0,this},d.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},d.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},d.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},d._configure=function(e){n=e,d.create=h(),n._configure()}},72815:(e,t,r)=>{"use strict";e.exports=o;var n=r(77063);(o.prototype=Object.create(n.prototype)).constructor=o;var i=r(3097);function o(){n.call(this)}function s(e,t,r){e.length<40?i.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}o._configure=function(){o.alloc=i._Buffer_allocUnsafe,o.writeBytesBuffer=i.Buffer&&i.Buffer.prototype instanceof Uint8Array&&"set"===i.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var n=0;n<e.length;)t[r++]=e[n++]}},o.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(o.writeBytesBuffer,t,e),this},o.prototype.string=function(e){var t=i.Buffer.byteLength(e);return this.uint32(t),t&&this._push(s,t,e),this},o._configure()},57874:(e,t,r)=>{var n=r(96650),i=r(5586);e.exports=n,e.exports.parse=n,e.exports.stringify=i},96650:(e,t,r)=>{var n=r(29729),i=["int32","int64","uint32","uint64","sint32","sint64","bool","fixed64","sfixed64","double","fixed32","sfixed32","float"],o=function(e){var t=e.shift();if("{"!==t)return t;t={};for(var r="";e.length;)switch(e[0]){case"}":return e.shift(),t;case":":e.shift(),t[r]=o(e);break;default:r=e.shift()}},s=function(e){for(var t={};e.length;)switch(e[0]){case"[":case",":e.shift();var r=e.shift();"("===r&&(r=e.shift(),e.shift());var n=[];if("."===e[0][0]&&(n=e[0].substr(1).split("."),e.shift()),"="!==e[0])throw new Error("Unexpected token in field options: "+e[0]);if(e.shift(),"]"===e[0])throw new Error("Unexpected ] in field option");var i=[r].concat(n),s=i.pop();i.reduce((function(e,t,r){return null==e[t]&&(e[t]={}),e[t]}),t)[s]=o(e);break;case"]":return e.shift(),t;default:throw new Error("Unexpected token in field options: "+e[0])}throw new Error("No closing tag for field options")},a=function(e){for(var t={name:null,type:null,tag:-1,map:null,oneof:null,required:!1,repeated:!1,options:{}};e.length;)switch(e[0]){case"=":e.shift(),t.tag=Number(e.shift());break;case"map":if(t.type="map",t.map={from:null,to:null},e.shift(),"<"!==e[0])throw new Error("Unexpected token in map type: "+e[0]);if(e.shift(),t.map.from=e.shift(),","!==e[0])throw new Error("Unexpected token in map type: "+e[0]);if(e.shift(),t.map.to=e.shift(),">"!==e[0])throw new Error("Unexpected token in map type: "+e[0]);e.shift(),t.name=e.shift();break;case"repeated":case"required":case"optional":var r=e.shift();t.required="required"===r,t.repeated="repeated"===r,t.type=e.shift(),t.name=e.shift();break;case"[":t.options=s(e);break;case";":if(null===t.name)throw new Error("Missing field name");if(null===t.type)throw new Error("Missing type in message field: "+t.name);if(-1===t.tag)throw new Error("Missing tag number in message field: "+t.name);return e.shift(),t;default:throw new Error("Unexpected token in message field: "+e[0])}throw new Error("No ; found for message field")},c=function(e){for(var t={enums:[],options:{},messages:[],fields:[],extends:[],extensions:null};e.length;)switch(e[0]){case"map":case"repeated":case"optional":case"required":t.fields.push(a(e));break;case"enum":t.enums.push(y(e));break;case"message":t.messages.push(d(e));break;case"extensions":t.extensions=l(e);break;case"oneof":e.shift();var r=e.shift();if("{"!==e[0])throw new Error("Unexpected token in oneof: "+e[0]);for(e.shift();"}"!==e[0];){e.unshift("optional");var n=a(e);n.oneof=r,t.fields.push(n)}e.shift();break;case"extend":t.extends.push(u(e));break;case";":e.shift();break;case"reserved":for(e.shift();";"!==e[0];)e.shift();break;case"option":var i=g(e);if(void 0!==t.options[i.name])throw new Error("Duplicate option "+i.name);t.options[i.name]=i.value;break;default:e.unshift("optional"),t.fields.push(a(e))}return t},u=function(e){return{name:e[1],message:d(e)}},l=function(e){e.shift();var t=Number(e.shift());if(isNaN(t))throw new Error("Invalid from in extensions definition");if("to"!==e.shift())throw new Error("Expected keyword 'to' in extensions definition");var r=e.shift();if("max"===r&&(r=536870911),r=Number(r),isNaN(r))throw new Error("Invalid to in extensions definition");if(";"!==e.shift())throw new Error("Missing ; in extensions definition");return{from:t,to:r}},d=function(e){e.shift();var t=1,r=[],n={name:e.shift(),options:{},enums:[],extends:[],messages:[],fields:[]};if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("{"===e[0]?t++:"}"===e[0]&&t--,!t)return e.shift(),r=c(r),n.enums=r.enums,n.messages=r.messages,n.fields=r.fields,n.extends=r.extends,n.extensions=r.extensions,n.options=r.options,n;r.push(e.shift())}if(t)throw new Error("No closing tag for message")},h=function(e){e.shift();var t=e.shift();if(";"!==e[0])throw new Error("Expected ; but found "+e[0]);return e.shift(),t},f=function(e){if(e.shift(),"="!==e[0])throw new Error("Expected = but found "+e[0]);e.shift();var t=e.shift();switch(t){case'"proto2"':t=2;break;case'"proto3"':t=3;break;default:throw new Error("Expected protobuf syntax version but found "+t)}if(";"!==e[0])throw new Error("Expected ; but found "+e[0]);return e.shift(),t},p=function(e){if(e.length<4)throw new Error("Invalid enum value: "+e.slice(0,3).join(" "));if("reserved"===e[0]){for(e.shift();";"!==e[0];)e.shift();return e.shift(),null}if("="!==e[1])throw new Error("Expected = but found "+e[1]);if(";"!==e[3]&&"["!==e[3])throw new Error("Expected ; or [ but found "+e[1]);var t=e.shift();e.shift();var r={value:null,options:{}};return r.value=Number(e.shift()),"["===e[0]&&(r.options=s(e)),e.shift(),{name:t,val:r}},y=function(e){e.shift();var t={},r={name:e.shift(),values:{},options:{}};if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("}"===e[0])return e.shift(),";"===e[0]&&e.shift(),r;if("option"!==e[0]){var n=p(e);null!==n&&(r.values[n.name]=n.val)}else t=g(e),r.options[t.name]=t.value}throw new Error("No closing tag for enum")},g=function(e){for(var t=null,r=null,n=function(e){return"true"===e||"false"!==e&&e.replace(/^"+|"+$/gm,"")};e.length;){if(";"===e[0])return e.shift(),{name:t,value:r};switch(e[0]){case"option":e.shift();var i="("===e[0];if(i&&e.shift(),t=e.shift(),i){if(")"!==e[0])throw new Error("Expected ) but found "+e[0]);e.shift()}"."===e[0][0]&&(t+=e.shift());break;case"=":if(e.shift(),null===t)throw new Error("Expected key for option with value: "+e[0]);if(r=n(e.shift()),"optimize_for"===t&&!/^(SPEED|CODE_SIZE|LITE_RUNTIME)$/.test(r))throw new Error("Unexpected value for option optimize_for: "+r);"{"===r&&(r=m(e));break;default:throw new Error("Unexpected token in option: "+e[0])}}},m=function(e){for(var t=function(e){return"true"===e||"false"!==e&&e.replace(/^"+|"+$/gm,"")},r={};e.length;){if("}"===e[0])return e.shift(),r;var n="("===e[0];n&&e.shift();var i=e.shift();if(n){if(")"!==e[0])throw new Error("Expected ) but found "+e[0]);e.shift()}var o=null;switch(e[0]){case":":if(void 0!==r[i])throw new Error("Duplicate option map key "+i);e.shift(),"{"===(o=t(e.shift()))&&(o=m(e)),r[i]=o,";"===e[0]&&e.shift();break;case"{":if(e.shift(),o=m(e),void 0===r[i]&&(r[i]=[]),!Array.isArray(r[i]))throw new Error("Duplicate option map key "+i);r[i].push(o);break;default:throw new Error("Unexpected token in option map: "+e[0])}}throw new Error("No closing tag for option map")},b=function(e){e.shift();var t=e.shift().replace(/^"+|"+$/gm,"");if(";"!==e[0])throw new Error("Unexpected token: "+e[0]+'. Expected ";"');return e.shift(),t},v=function(e){e.shift();var t={name:e.shift(),methods:[],options:{}};if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("}"===e[0])return e.shift(),";"===e[0]&&e.shift(),t;switch(e[0]){case"option":var r=g(e);if(void 0!==t.options[r.name])throw new Error("Duplicate option "+r.name);t.options[r.name]=r.value;break;case"rpc":t.methods.push(w(e));break;default:throw new Error("Unexpected token in service: "+e[0])}}throw new Error("No closing tag for service")},w=function(e){e.shift();var t={name:e.shift(),input_type:null,output_type:null,client_streaming:!1,server_streaming:!1,options:{}};if("("!==e[0])throw new Error("Expected ( but found "+e[0]);if(e.shift(),"stream"===e[0]&&(e.shift(),t.client_streaming=!0),t.input_type=e.shift(),")"!==e[0])throw new Error("Expected ) but found "+e[0]);if(e.shift(),"returns"!==e[0])throw new Error("Expected returns but found "+e[0]);if(e.shift(),"("!==e[0])throw new Error("Expected ( but found "+e[0]);if(e.shift(),"stream"===e[0]&&(e.shift(),t.server_streaming=!0),t.output_type=e.shift(),")"!==e[0])throw new Error("Expected ) but found "+e[0]);if(e.shift(),";"===e[0])return e.shift(),t;if("{"!==e[0])throw new Error("Expected { but found "+e[0]);for(e.shift();e.length;){if("}"===e[0])return e.shift(),";"===e[0]&&e.shift(),t;if("option"!==e[0])throw new Error("Unexpected token in rpc options: "+e[0]);var r=g(e);if(void 0!==t.options[r.name])throw new Error("Duplicate option "+r.name);t.options[r.name]=r.value}throw new Error("No closing tag for rpc")};e.exports=function(e){for(var t=n(e.toString()),r=0;r<t.length;r++){var o;if(/^("|')([^'"]*)$/.test(t[r]))for(o=1===t[r].length?r+1:r;o<t.length;o++)if(/^[^'"\\]*(?:\\.[^'"\\]*)*("|')$/.test(t[o])){t=t.slice(0,r).concat(t.slice(r,o+1).join("")).concat(t.slice(o+1));break}}for(var s={syntax:3,package:null,imports:[],enums:[],messages:[],options:{},extends:[]},a=!0;t.length;){switch(t[0]){case"package":s.package=h(t);break;case"syntax":if(!a)throw new Error("Protobuf syntax version should be first thing in file");s.syntax=f(t);break;case"message":s.messages.push(d(t));break;case"enum":s.enums.push(y(t));break;case"option":var c=g(t);if(s.options[c.name])throw new Error("Duplicate option "+c.name);s.options[c.name]=c.value;break;case"import":s.imports.push(b(t));break;case"extend":s.extends.push(u(t));break;case"service":s.services||(s.services=[]),s.services.push(v(t));break;default:throw new Error("Unexpected token: "+t[0])}a=!1}return s.extends.forEach((function(e){s.messages.forEach((function(t){t.name===e.name&&e.message.fields.forEach((function(e){if(!t.extensions||e.tag<t.extensions.from||e.tag>t.extensions.to)throw new Error(t.name+" does not declare "+e.tag+" as an extension number");t.fields.push(e)}))}))})),s.messages.forEach((function(e){e.fields.forEach((function(t){var r,n,o,a;if(t.options&&"true"===t.options.packed&&-1===i.indexOf(t.type)){if(-1===t.type.indexOf(".")){if(e.enums&&e.enums.some((function(e){return e.name===t.type})))return}else{if((r=t.type.split(".")).length>2)throw new Error("what is this?");if(n=r[0],o=r[1],s.messages.some((function(e){if(e.name===n)return a=e,e})),a&&a.enums&&a.enums.some((function(e){return e.name===o})))return}throw new Error("Fields of type "+t.type+' cannot be declared [packed=true]. Only repeated fields of primitive numeric types (types which use the varint, 32-bit, or 64-bit wire types) can be declared "packed". See https://developers.google.com/protocol-buffers/docs/encoding#optional')}}))})),s}},5586:e=>{var t=function(e,t){var r=e.repeated?"repeated":e.required?"required":"optional";"map"===e.type&&(r="map<"+e.map.from+","+e.map.to+">"),e.oneof&&(r="");var n=Object.keys(e.options||{}).map((function(t){return t+" = "+e.options[t]})).join(",");return n&&(n=" ["+n+"]"),t.push((r?r+" ":"")+("map"===e.map?"":e.type+" ")+e.name+" = "+e.tag+n+";"),t},r=function(e,i){i.push("message "+e.name+" {"),e.options||(e.options={}),o(e.options,i),e.enums||(e.enums=[]),e.enums.forEach((function(e){i.push(n(e,[]))})),e.messages||(e.messages=[]),e.messages.forEach((function(e){i.push(r(e,[]))}));var s={};return e.fields||(e.fields=[]),e.fields.forEach((function(e){e.oneof?(s[e.oneof]||(s[e.oneof]=[]),s[e.oneof].push(t(e,[]))):i.push(t(e,[]))})),Object.keys(s).forEach((function(e){s[e].unshift("oneof "+e+" {"),s[e].push("}"),i.push(s[e])})),i.push("}",""),i},n=function(e,t){t.push("enum "+e.name+" {"),e.options||(e.options={});var r=o(e.options,[]);return r.length>1&&t.push(r.slice(0,-1)),Object.keys(e.values).map((function(r){var n=i(e.values[r]);t.push([r+" = "+n+";"])})),t.push("}",""),t},i=function(e,t){var r=Object.keys(e.options||{}).map((function(t){return t+" = "+e.options[t]})).join(",");return r&&(r=" ["+r+"]"),e.value+r},o=function(e,t){var r=Object.keys(e);return r.forEach((function(r){var n=e[r];~r.indexOf(".")&&(r="("+r+")");var i=typeof n;"object"===i?(n=s(n,[])).length&&t.push("option "+r+" = {",n,"};"):("string"===i&&"optimize_for"!==r&&(n='"'+n+'"'),t.push("option "+r+" = "+n+";"))})),r.length>0&&t.push(""),t},s=function(e,t){return Object.keys(e).forEach((function(r){var n=e[r],i=typeof n;"object"===i?Array.isArray(n)?n.forEach((function(e){(e=s(e,[])).length&&t.push(r+" {",e,"}")})):(n=s(n,[])).length&&t.push(r+" {",n,"}"):("string"===i&&(n='"'+n+'"'),t.push(r+": "+n))})),t},a=function(e,t){var r="rpc "+e.name+"(";e.client_streaming&&(r+="stream "),r+=e.input_type+") returns (",e.server_streaming&&(r+="stream "),r+=e.output_type+")",e.options||(e.options={});var n=o(e.options,[]);return n.length>1?t.push(r+" {",n.slice(0,-1),"}"):t.push(r+";"),t},c=function(e){return function(t){return Array.isArray(t)?t.map(c(e+" ")).join("\n"):e+t}};e.exports=function(e){var t=[];return t.push('syntax = "proto'+e.syntax+'";',""),e.package&&t.push("package "+e.package+";",""),e.imports&&e.imports.forEach((function(e){!function(e,t){t.push('import "'+e+'";',"")}(e,t)})),e.options||(e.options={}),o(e.options,t),e.enums||(e.enums=[]),e.enums.forEach((function(e){n(e,t)})),e.messages||(e.messages=[]),e.messages.forEach((function(e){r(e,t)})),e.services&&e.services.forEach((function(e){!function(e,t){t.push("service "+e.name+" {"),e.options||(e.options={}),o(e.options,t),e.methods||(e.methods=[]),e.methods.forEach((function(e){t.push(a(e,[]))})),t.push("}","")}(e,t)})),t.map(c("")).join("\n")}},29729:e=>{e.exports=function(e){var t,r=function(e){return e.trim()},n=[];return e.replace(/"(\\"|[^"\n])*?"|'(\\'|[^'\n])*?'/gm,(t=n,function(e){var r="$"+t.length+"$";return t.push(e),r})).replace(/([;,{}()=:[\]<>]|\/\*|\*\/)/g," $1 ").split(/\n/).map(r).filter(Boolean).map((function(e){var t=e.indexOf("//");return t>-1?e.slice(0,t):e})).map(r).filter(Boolean).join("\n").split(/\s+|\n+/gm).filter(function(){var e=!1;return function(t){return"/*"===t?(e=!0,!1):"*/"===t?(e=!1,!1):!e}}()).map(function(e){var t=/^\$(\d+)\$$/;return function(r){var n=r.match(t);return n?e[+n[1]]:r}}(n))}},47027:e=>{e.exports=function e(t,r){var n,i=0,o=0,s=r=r||0,a=t.length;do{if(s>=a)throw e.bytes=0,new RangeError("Could not decode varint");n=t[s++],i+=o<28?(127&n)<<o:(127&n)*Math.pow(2,o),o+=7}while(n>=128);return e.bytes=s-r,i}},15223:e=>{e.exports=function e(r,n,i){n=n||[];var o=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-o+1,n};var t=Math.pow(2,31)},99863:(e,t,r)=>{e.exports={encode:r(15223),decode:r(47027),encodingLength:r(38234)}},38234:e=>{var t=Math.pow(2,7),r=Math.pow(2,14),n=Math.pow(2,21),i=Math.pow(2,28),o=Math.pow(2,35),s=Math.pow(2,42),a=Math.pow(2,49),c=Math.pow(2,56),u=Math.pow(2,63);e.exports=function(e){return e<t?1:e<r?2:e<n?3:e<i?4:e<o?5:e<s?6:e<a?7:e<c?8:e<u?9:10}},85942:(e,t,r)=>{"use strict";const n=r(99863),i=r(7626).r;function o(e){return"".concat(e.substring(0,1).toUpperCase()).concat(e.substring(1))}function s(e,t,r,n){if(Object.prototype.hasOwnProperty.call(e,t))return;const i=o(t);Object.defineProperties(e,{[t]:{enumerable:!0,configurable:!0,set:e=>{r=e},get:()=>void 0===r?n:r},["has".concat(i)]:{configurable:!0,value:()=>void 0!==r},["set".concat(i)]:{configurable:!0,value:e=>{r=e}},["get".concat(i)]:{configurable:!0,value:()=>r},["clear".concat(i)]:{configurable:!0,value:()=>{r=void 0,e[t]=void 0}}})}var a=function(e,t,r,i){switch(e){case 0:return n.decode(t,i),i+n.decode.bytes;case 1:return i+8;case 2:var o=n.decode(t,i);return i+n.decode.bytes+o;case 3:case 4:throw new Error("Groups are not supported");case 5:return i+4;default:throw new Error("Unknown wire type: "+e)}},c=function(e){if(e.map)return{};if(e.repeated)return[];switch(e.type){case"string":return"";case"bool":return!1;case"float":case"double":case"sfixed32":case"fixed32":case"varint":case"enum":case"uint64":case"uint32":case"int64":case"int32":case"sint64":case"sint32":return 0;default:return null}},u=function(e,t){if(void 0===t)return t;switch(e.type){case"bool":return"true"===t;case"float":case"double":case"sfixed32":case"fixed32":case"varint":case"enum":case"uint64":case"uint32":case"int64":case"int32":case"sint64":case"sint32":return parseInt(t,10);default:return t}};e.exports=function(e,t,r){const l=[],d={},h=[],f=[];for(var p=0;p<r.length;p++){const r=e.fields[p];d[r.tag]=p;const n=r.options&&r.options.default,i=t(r.type,e.id,!1);f[p]=[n,i&&i.values],e.fields[p].packed=r.repeated&&r.options&&r.options.packed&&"false"!==r.options.packed,r.required&&l.push(r.name),r.oneof&&h.push(r.name)}function y(e,t,r,i,a,c,u){const l=t.name;if(t.oneof){const e=Object.keys(r);for(var d=0;d<e.length;d++)if(h.indexOf(e[d])>-1){const t=o(e[d]);delete r["has".concat(t)],delete r["get".concat(t)],delete r["set".concat(t)],delete r["clear".concat(t)],delete r[e[d]]}}let f;if(e.message){const o=n.decode(i,c);c+=n.decode.bytes;const s=e.decode(i,a,c,c+o);t.map?(f=r[l]||{},f[s.key]=s.value):t.repeated?(f=r[l]||[],f.push(s)):f=s}else t.repeated?(f=r[l]||[],f.push(e.decode(i,a,c))):f=e.decode(i,a,c);return s(r,l,f),c+=e.decode.bytes}return function t(o,p,g,m){if(null==g&&(g=0),null==m&&(m=o.length),!(m<=o.length&&g<=o.length))throw new Error("Decoded message is not valid");p||(p=new DataView(o.buffer,o.byteOffset,o.byteLength));for(var b,v=g,w={};;){if(m<=g){var E,_,S="",I=0;for(I=0;I<l.length;I++)if(S=l[I],!i(w[S]))throw new Error("Decoded message is not valid, missing required field: "+S);for(I=0;I<r.length;I++){let t;if(b=e.fields[I],_=f[I][0],E=f[I][1],S=b.name,!Object.prototype.hasOwnProperty.call(w,S)){var A=!1;if(b.oneof)for(var R=Object.keys(w),T=0;T<R.length;T++)if(h.indexOf(R[T])>-1){A=!0;break}A||(E?b.repeated?_=[]:(_=_&&E[_]?E[_].value:E[Object.keys(E)[0]].value,_=parseInt(_||0,10)):(t=c(b),_=u(b,_)),s(w,S,_,t))}}return t.bytes=g-v,w}var C=n.decode(o,g);g+=n.decode.bytes;var P=d[C>>3];if(null!=P){var k=r[P];if((b=e.fields[P]).packed){var O=n.decode(o,g);for(O+=g+=n.decode.bytes;g<O;)g=y(k,b,w,o,p,g)}else g=y(k,b,w,o,p,g)}else g=a(7&C,o,p,g)}}}},17837:(e,t,r)=>{"use strict";var n=r(7626).r,i=r(99863);e.exports=function(e,t,r,o,s){const a=Object.keys(o),c=r.length,u={};for(let n=0;n<c;n++){u[n]={p:i.encode(e.fields[n].tag<<3|2),h:i.encode(e.fields[n].tag<<3|r[n].type)};const t=e.fields[n];e.fields[n].packed=t.repeated&&t.options&&t.options.packed&&"false"!==t.options.packed}function l(e,t,r,n,o,s,a){let c=0;if(!s)for(c=0;c<n.length;c++)e[r++]=n[c];return o.message&&(i.encode(o.encodingLength(a),e,r),r+=i.encode.bytes),o.encode(a,e,t,r),r+o.encode.bytes}return function t(d,h,f){let p=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;null==h&&(h=new Uint8Array(s(d))),null==f&&(f=new DataView(h.buffer,h.byteOffset,h.byteLength));const y=p,g=Object.keys(d);let m=0,b=!1;for(m=0;m<a.length;m++){const e=a[m],t=o[m];if(g.indexOf(t)>-1){if(b)throw new Error("only one of the properties defined in oneof "+e+" can be set");b=!0}}for(m=0;m<c;m++){const t=r[m],o=e.fields[m];let s=d[o.name],a=0;if(!n(s)){if(o.required)throw new Error(o.name+" is required");continue}const c=u[m].p,y=u[m].h,g=o.packed;if(o.map){const e=Object.keys(s);for(a=0;a<e.length;a++)e[a]={key:e[a],value:s[e[a]]};s=e}if(g){let e=0;for(a=0;a<s.length;a++)Object.prototype.hasOwnProperty.call(s,a)&&(e+=t.encodingLength(s[a]));if(e){for(a=0;a<y.length;a++)h[p++]=c[a];i.encode(e,h,p),p+=i.encode.bytes}}if(o.repeated){let e;for(a=0;a<s.length;a++)e=s[a],n(e)&&(p=l(h,f,p,y,t,g,e))}else p=l(h,f,p,y,t,g,s)}return t.bytes=p-y,h}}},87172:(e,t,r)=>{"use strict";var n=r(7626).r,i=r(99863);e.exports=function(e,t,r){const o=Object.keys(r),s=t.length,a=new Array(s);for(let n=0;n<e.fields.length;n++){a[n]=i.encodingLength(e.fields[n].tag<<3|t[n].type);const r=e.fields[n];e.fields[n].packed=r.repeated&&r.options&&r.options.packed&&"false"!==r.options.packed}return function(c){let u=0,l=0,d=0;for(l=0;l<o.length;l++){const e=o[l],t=r[e];let i=!1;for(d=0;d<t.length;d++)if(n(c[t[d]])){if(i)throw new Error("only one of the properties defined in oneof "+e+" can be set");i=!0}}for(l=0;l<s;l++){const r=t[l],o=e.fields[l];let s=c[o.name];const h=a[l];let f;if(n(s)){if(o.map){const e=Object.keys(s);for(d=0;d<e.length;d++)e[d]={key:e[d],value:s[e[d]]};s=e}if(o.packed){let e=0;for(d=0;d<s.length;d++)n(s[d])&&(f=r.encodingLength(s[d]),e+=f,r.message&&(e+=i.encodingLength(f)));e&&(u+=h+e+i.encodingLength(e))}else if(o.repeated)for(d=0;d<s.length;d++)n(s[d])&&(f=r.encodingLength(s[d]),u+=h+f+(r.message?i.encodingLength(f):0));else f=r.encodingLength(s),u+=h+f+(r.message?i.encodingLength(f):0)}else if(o.required)throw new Error(o.name+" is required")}return u}}},12161:(e,t,r)=>{"use strict";const n=r(56457);e.exports=n(0,(function e(t,r,n,i){r[i]=t?1:0,e.bytes=1}),(function e(t,r,n){const i=t[n]>0;return e.bytes=1,i}),(function(){return 1}))},56183:(e,t,r)=>{"use strict";const n=r(99863),i=r(56457);function o(e){return e.byteLength}e.exports=i(2,(function e(t,r,i,s){const a=s,c=o(t);n.encode(c,r,s),s+=n.encode.bytes,r.set(t,s),e.bytes=(s+=c)-a}),(function e(t,r,i){const o=i,s=n.decode(t,i);i+=n.decode.bytes;const a=t.slice(i,i+s);return i+=a.length,e.bytes=i-o,a}),(function(e){const t=o(e);return n.encodingLength(t)+t}))},80379:(e,t,r)=>{"use strict";const n=r(56457);e.exports=n(1,(function e(t,r,n,i){n.setFloat64(i,t,!0),e.bytes=8}),(function e(t,r,n){const i=r.getFloat64(n,!0);return e.bytes=8,i}),(function(){return 8}))},56457:e=>{"use strict";e.exports=function(e,t,r,n){return t.bytes=r.bytes=0,{type:e,encode:t,decode:r,encodingLength:n}}},59992:(e,t,r)=>{"use strict";const n=r(56457);e.exports=n(5,(function e(t,r,n,i){n.setUint32(i,t,!0),e.bytes=4}),(function e(t,r,n){const i=r.getUint32(n,!0);return e.bytes=4,i}),(function(e){return 4}))},57907:(e,t,r)=>{"use strict";const n=r(56457);e.exports=n(1,(function e(t,r,n,i){for(const o of t)r[i]=o,i++;e.bytes=8}),(function e(t,r,n){const i=t.slice(n,n+8);return e.bytes=8,i}),(function(){return 8}))},68849:(e,t,r)=>{"use strict";const n=r(56457);e.exports=n(5,(function e(t,r,n,i){n.setFloat32(i,t,!0),e.bytes=4}),(function e(t,r,n){const i=r.getFloat32(n,!0);return e.bytes=4,i}),(function(){return 4}))},31321:(e,t,r)=>{"use strict";t.make=r(56457),t.bytes=r(56183),t.string=r(19480),t.bool=r(12161),t.int32=r(7089),t.int64=r(50877),t.sint32=t.sint64=r(62149),t.uint32=t.uint64=t.enum=t.varint=r(3868),t.fixed64=t.sfixed64=r(57907),t.double=r(80379),t.fixed32=r(59992),t.sfixed32=r(11341),t.float=r(68849)},7089:(e,t,r)=>{"use strict";const n=r(99863),i=r(56457);e.exports=i(0,(function e(t,r,i,o){n.encode(t<0?t+4294967296:t,r,o),e.bytes=n.encode.bytes}),(function e(t,r,i){const o=n.decode(t,i);return e.bytes=n.decode.bytes,o>2147483647?o-4294967296:o}),(function(e){return n.encodingLength(e<0?e+4294967296:e)}))},50877:(e,t,r)=>{"use strict";const n=r(99863),i=r(56457);e.exports=i(0,(function e(t,r,i,o){if(t<0){const i=o+9;for(n.encode(-1*t,r,o),r[o+=n.encode.bytes-1]=128|r[o];o<i-1;)r[++o]=255;r[i]=1,e.bytes=10}else n.encode(t,r,o),e.bytes=n.encode.bytes}),(function e(t,r,i){let o=n.decode(t,i);if(o>=Math.pow(2,63)){let r=9;for(;255===t[i+r-1];)r--;r=r||9;const s=t.subarray(i,i+r);s[r-1]=127&s[r-1],o=-1*n.decode(s,0),e.bytes=10}else e.bytes=n.decode.bytes;return o}),(function(e){return e<0?10:n.encodingLength(e)}))},11341:(e,t,r)=>{"use strict";const n=r(56457);e.exports=n(5,(function e(t,r,n,i){n.setInt32(i,t,!0),e.bytes=4}),(function e(t,r,n){const i=r.getInt32(n,!0);return e.bytes=4,i}),(function(e){return 4}))},62149:(e,t,r)=>{"use strict";const n=r(16872),i=r(56457);e.exports=i(0,(function e(t,r,i,o){n.encode(t,r,o),e.bytes=n.encode.bytes}),(function e(t,r,i){const o=n.decode(t,i);return e.bytes=n.decode.bytes,o}),n.encodingLength)},19480:(e,t,r)=>{"use strict";const n=r(99863),{fromString:i}=r(46765),{toString:o}=r(82051),s=r(56457);e.exports=s(2,(function e(t,r,o,s){const a=s,c=i(t).byteLength;n.encode(c,r,s,"utf-8"),s+=n.encode.bytes;const u=i(t);r.set(u,s),s+=u.length,e.bytes=s-a}),(function e(t,r,i){const s=i,a=n.decode(t,i);i+=n.decode.bytes;const c=o(t.subarray(i,i+a));return e.bytes=(i+=a)-s,c}),(function(e){const t=i(e).byteLength;return n.encodingLength(t)+t}))},3868:(e,t,r)=>{"use strict";const n=r(99863),i=r(56457);e.exports=i(0,(function e(t,r,i,o){n.encode(t,r,o),e.bytes=n.encode.bytes}),(function e(t,r,i){const o=n.decode(t,i);return e.bytes=n.decode.bytes,o}),n.encodingLength)},45538:(e,t,r)=>{"use strict";const n=r(31321),i=r(85942),o=r(17837),s=r(87172),a=r(99863);e.exports=function(e,t){const r={},c={},u={},l=function(e,t){e.enums&&e.enums.forEach((function(e){e.id=t+(t?".":"")+e.name,c[e.id]=e,l(e,e.id)})),e.messages&&e.messages.forEach((function(n){n.id=t+(t?".":"")+n.name,r[n.id]=n,n.fields.forEach((function(n){if(!n.map)return;const i="Map_"+n.map.from+"_"+n.map.to,o={name:i,enums:[],messages:[],fields:[{name:"key",type:n.map.from,tag:1,repeated:!1,required:!0},{name:"value",type:n.map.to,tag:2,repeated:!1,required:!1}],extensions:null,id:t+(t?".":"")+i};r[o.id]||(r[o.id]=o,e.messages.push(o)),n.type=i,n.repeated=!0})),l(n,n.id)}))};l(e,"");const d=function(e,t){e.messages.forEach((function(r){t[r.name]=h(r.name,e.id)})),e.enums.forEach((function(e){t[e.name]=function(e){if(!e)return null;const t={};return Object.keys(e).forEach((function(r){t[r]=e[r].value})),t}(e.values)})),t.type=2,t.message=!0,t.name=e.name;const r={};e.fields.forEach((function(e){e.oneof&&(r[e.oneof]||(r[e.oneof]=[]),r[e.oneof].push(e.name))}));const n=e.fields.map((function(t){return h(t.type,e.id)})),a=s(e,n,r),c=o(e,h,n,r,a),u=i(e,h,n);return c.bytes=u.bytes=0,t.buffer=!0,t.encode=c,t.decode=u,t.encodingLength=a,t},h=function(e,i,o){if(t&&t[e])return t[e];if(n[e])return n[e];const s=(i?i+"."+e:e).split(".").map((function(t,r,n){return n.slice(0,r).concat(e).join(".")})).reverse().reduce((function(e,t){return e||r[t]||c[t]}),null);if(!1===o)return s;if(!s)throw new Error("Could not resolve "+e);if(s.values)return function(e){const t=Object.keys(e.values||[]).map((function(t){return parseInt(e.values[t].value,10)}));return n.make(0,(function e(r,n,i,o){if(!t.length||-1===t.indexOf(r))throw new Error("Invalid enum value: "+r);return a.encode(r,n,o),e.bytes=a.encode.bytes,n}),(function e(r,n,i){var o=a.decode(r,i);if(!t.length||-1===t.indexOf(o))throw new Error("Invalid enum value: "+o);return e.bytes=a.decode.bytes,o}),a.encodingLength)}(s);return u[s.id]||d(s,u[s.id]={})};return(e.enums||[]).concat((e.messages||[]).map((function(e){return h(e.id)})))}},7626:(e,t)=>{"use strict";t.r=function(e){return null!==e&&void 0!==e&&("number"!==typeof e||!isNaN(e))}},69145:(e,t,r)=>{"use strict";var n=r(57874),i=r(45538);e.exports=function(e,t){if(t||(t={}),!e)throw new Error("Pass in a .proto string or a protobuf-schema parsed object");var r="object"!==typeof e||e instanceof Uint8Array?n.parse(e):e,o=function(){var e=this;i(r,t.encodings||{}).forEach((function(t){e[t.name]=function(e){if(!e)return null;var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].value})),t}(t.values)||t}))};return o.prototype.toString=function(){return n.stringify(r)},o.prototype.toJSON=function(){return r},new o}},34463:(e,t,r)=>{"use strict";var n=r(72791),i=r(45296);function o(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 s=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++)s.add(t[e])}var l=!("undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement),d=Object.prototype.hasOwnProperty,h=/^[: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,o,s){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=o,this.removeEmptyString=s}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 b(e){return e[1].toUpperCase()}function v(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!!d.call(p,e)||!d.call(f,e)&&(h.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,b);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,b);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,b);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"),_=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),I=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),R=Symbol.for("react.provider"),T=Symbol.for("react.context"),C=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),k=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),N=Symbol.for("react.lazy");Symbol.for("react.scope"),Symbol.for("react.debug_trace_mode");var D=Symbol.for("react.offscreen");Symbol.for("react.legacy_hidden"),Symbol.for("react.cache"),Symbol.for("react.tracing_marker");var B=Symbol.iterator;function x(e){return null===e||"object"!==typeof e?null:"function"===typeof(e=B&&e[B]||e["@@iterator"])?e:null}var L,M=Object.assign;function U(e){if(void 0===L)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);L=t&&t[1]||""}return"\n"+L+e}var j=!1;function K(e,t){if(!e||j)return"";j=!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"),o=n.stack.split("\n"),s=i.length-1,a=o.length-1;1<=s&&0<=a&&i[s]!==o[a];)a--;for(;1<=s&&0<=a;s--,a--)if(i[s]!==o[a]){if(1!==s||1!==a)do{if(s--,0>--a||i[s]!==o[a]){var c="\n"+i[s].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}}while(1<=s&&0<=a);break}}}finally{j=!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=K(e.type,!1);case 11:return e=K(e.type.render,!1);case 1:return e=K(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 S:return"Fragment";case _:return"Portal";case A:return"Profiler";case I:return"StrictMode";case P:return"Suspense";case k:return"SuspenseList"}if("object"===typeof e)switch(e.$$typeof){case T:return(e.displayName||"Context")+".Consumer";case R:return(e._context.displayName||"Context")+".Provider";case C: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 N: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 H(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function z(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=z(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,o=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=""+e,o.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=z(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 X(e,t){var r=null==t.defaultValue?"":t.defaultValue,n=null!=t.checked?t.checked:t.defaultChecked;r=H(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 J(e,t){null!=(t=t.checked)&&v(e,"checked",t,!1)}function $(e,t){J(e,t);var r=H(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,H(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=""+H(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(o(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(o(92));if(te(r)){if(1<r.length)throw Error(o(93));r=r[0]}t=r}null==t&&(t=""),r=t}e._wrapperState={initialValue:H(r)}}function oe(e,t){var r=H(t.value),n=H(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 se(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,de=(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 he(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 be(e,t){if(t){if(me[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML))throw Error(o(137,e));if(null!=t.dangerouslySetInnerHTML){if(null!=t.children)throw Error(o(60));if("object"!==typeof t.dangerouslySetInnerHTML||!("__html"in t.dangerouslySetInnerHTML))throw Error(o(61))}if(null!=t.style&&"object"!==typeof t.style)throw Error(o(62))}}function ve(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 _e=null,Se=null,Ie=null;function Ae(e){if(e=vi(e)){if("function"!==typeof _e)throw Error(o(280));var t=e.stateNode;t&&(t=Ei(t),_e(e.stateNode,e.type,t))}}function Re(e){Se?Ie?Ie.push(e):Ie=[e]:Se=e}function Te(){if(Se){var e=Se,t=Ie;if(Ie=Se=null,Ae(e),t)for(e=0;e<t.length;e++)Ae(t[e])}}function Ce(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 Ce(e,t,r)}finally{ke=!1,(null!==Se||null!==Ie)&&(Pe(),Te())}}function Ne(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(o(231,t,typeof r));return r}var De=!1;if(l)try{var Be={};Object.defineProperty(Be,"passive",{get:function(){De=!0}}),window.addEventListener("test",Be,Be),window.removeEventListener("test",Be,Be)}catch(le){De=!1}function xe(e,t,r,n,i,o,s,a,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(r,u)}catch(l){this.onError(l)}}var Le=!1,Me=null,Ue=!1,je=null,Ke={onError:function(e){Le=!0,Me=e}};function Fe(e,t,r,n,i,o,s,a,c){Le=!1,Me=null,xe.apply(Ke,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 He(e){if(Ve(e)!==e)throw Error(o(188))}function ze(e){return null!==(e=function(e){var t=e.alternate;if(!t){if(null===(t=Ve(e)))throw Error(o(188));return t!==e?null:e}for(var r=e,n=t;;){var i=r.return;if(null===i)break;var s=i.alternate;if(null===s){if(null!==(n=i.return)){r=n;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===r)return He(i),e;if(s===n)return He(i),t;s=s.sibling}throw Error(o(188))}if(r.return!==n.return)r=i,n=s;else{for(var a=!1,c=i.child;c;){if(c===r){a=!0,r=i,n=s;break}if(c===n){a=!0,n=i,r=s;break}c=c.sibling}if(!a){for(c=s.child;c;){if(c===r){a=!0,r=s,n=i;break}if(c===n){a=!0,n=s,r=i;break}c=c.sibling}if(!a)throw Error(o(189))}}if(r.alternate!==n)throw Error(o(190))}if(3!==r.tag)throw Error(o(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,Xe=i.unstable_requestPaint,Je=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,ot=null;var st=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 dt(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 ht(e,t){var r=e.pendingLanes;if(0===r)return 0;var n=0,i=e.suspendedLanes,o=e.pingedLanes,s=268435455&r;if(0!==s){var a=s&~i;0!==a?n=dt(a):0!==(o&=s)&&(n=dt(o))}else 0!==(s=r&~i)?n=dt(s):0!==o&&(n=dt(o));if(0===n)return 0;if(0!==t&&t!==n&&0===(t&i)&&((i=n&-n)>=(o=t&-t)||16===i&&0!==(4194240&o)))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-st(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-st(t)]=r}function bt(e,t){var r=e.entangledLanes|=t;for(e=e.entanglements;r;){var n=31-st(r),i=1<<n;i&t|e[n]&t&&(e[n]|=t),r&=~i}}var vt=0;function wt(e){return 1<(e&=-e)?4<e?0!==(268435455&e)?16:536870912:4:1}var Et,_t,St,It,At,Rt=!1,Tt=[],Ct=null,Pt=null,kt=null,Ot=new Map,Nt=new Map,Dt=[],Bt="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 xt(e,t){switch(e){case"focusin":case"focusout":Ct=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":Nt.delete(t.pointerId)}}function Lt(e,t,r,n,i,o){return null===e||e.nativeEvent!==o?(e={blockedOn:t,domEventName:r,eventSystemFlags:n,nativeEvent:o,targetContainers:[i]},null!==t&&(null!==(t=vi(t))&&_t(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,null!==i&&-1===t.indexOf(i)&&t.push(i),e)}function Mt(e){var t=bi(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 At(e.priority,(function(){St(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=vi(r))&&_t(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 jt(e,t,r){Ut(e)&&r.delete(t)}function Kt(){Rt=!1,null!==Ct&&Ut(Ct)&&(Ct=null),null!==Pt&&Ut(Pt)&&(Pt=null),null!==kt&&Ut(kt)&&(kt=null),Ot.forEach(jt),Nt.forEach(jt)}function Ft(e,t){e.blockedOn===t&&(e.blockedOn=null,Rt||(Rt=!0,i.unstable_scheduleCallback(i.unstable_NormalPriority,Kt)))}function Vt(e){function t(t){return Ft(t,e)}if(0<Tt.length){Ft(Tt[0],e);for(var r=1;r<Tt.length;r++){var n=Tt[r];n.blockedOn===e&&(n.blockedOn=null)}}for(null!==Ct&&Ft(Ct,e),null!==Pt&&Ft(Pt,e),null!==kt&&Ft(kt,e),Ot.forEach(t),Nt.forEach(t),r=0;r<Dt.length;r++)(n=Dt[r]).blockedOn===e&&(n.blockedOn=null);for(;0<Dt.length&&null===(r=Dt[0]).blockedOn;)Mt(r),null===r.blockedOn&&Dt.shift()}var qt=w.ReactCurrentBatchConfig,Ht=!0;function zt(e,t,r,n){var i=vt,o=qt.transition;qt.transition=null;try{vt=1,Wt(e,t,r,n)}finally{vt=i,qt.transition=o}}function Gt(e,t,r,n){var i=vt,o=qt.transition;qt.transition=null;try{vt=4,Wt(e,t,r,n)}finally{vt=i,qt.transition=o}}function Wt(e,t,r,n){if(Ht){var i=Qt(e,t,r,n);if(null===i)Hn(e,t,n,Yt,r),xt(e,n);else if(function(e,t,r,n,i){switch(t){case"focusin":return Ct=Lt(Ct,e,t,r,n,i),!0;case"dragenter":return Pt=Lt(Pt,e,t,r,n,i),!0;case"mouseover":return kt=Lt(kt,e,t,r,n,i),!0;case"pointerover":var o=i.pointerId;return Ot.set(o,Lt(Ot.get(o)||null,e,t,r,n,i)),!0;case"gotpointercapture":return o=i.pointerId,Nt.set(o,Lt(Nt.get(o)||null,e,t,r,n,i)),!0}return!1}(i,e,t,r,n))n.stopPropagation();else if(xt(e,n),4&t&&-1<Bt.indexOf(e)){for(;null!==i;){var o=vi(i);if(null!==o&&Et(o),null===(o=Qt(e,t,r,n))&&Hn(e,t,n,Yt,r),o===i)break;i=o}null!==i&&n.stopPropagation()}else Hn(e,t,n,null,r)}}var Yt=null;function Qt(e,t,r,n){if(Yt=null,null!==(e=bi(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 Xt(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 Jt=null,$t=null,Zt=null;function er(){if(Zt)return Zt;var e,t,r=$t,n=r.length,i="value"in Jt?Jt.value:Jt.textContent,o=i.length;for(e=0;e<n&&r[e]===i[e];e++);var s=n-e;for(t=1;t<=s&&r[n-t]===i[o-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,o){for(var s in this._reactName=t,this._targetInst=n,this.type=r,this.nativeEvent=i,this.target=o,this.currentTarget=null,e)e.hasOwnProperty(s)&&(t=e[s],this[s]=t?t(i):i[s]);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 or,sr,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}),dr=ir(lr),hr=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?(or=e.screenX-ar.screenX,sr=e.screenY-ar.screenY):sr=or=0,ar=e),or)},movementY:function(e){return"movementY"in e?e.movementY:sr}}),fr=ir(hr),pr=ir(M({},hr,{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}}),br=ir(mr),vr=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"},_r={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Sr(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=_r[e])&&!!t[e]}function Ir(){return Sr}var Ar=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}}),Rr=ir(Ar),Tr=ir(M({},hr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Cr=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({},hr,{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),Nr=[9,13,27,32],Dr=l&&"CompositionEvent"in window,Br=null;l&&"documentMode"in document&&(Br=document.documentMode);var xr=l&&"TextEvent"in window&&!Br,Lr=l&&(!Dr||Br&&8<Br&&11>=Br),Mr=String.fromCharCode(32),Ur=!1;function jr(e,t){switch(e){case"keyup":return-1!==Nr.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Kr(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 Hr(e,t,r,n){Re(n),0<(t=Gn(t,"onChange")).length&&(r=new ur("onChange","change",null,r,n),e.push({event:r,listeners:t}))}var zr=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 Xr=!1;if(l){var Jr;if(l){var $r="oninput"in document;if(!$r){var Zr=document.createElement("div");Zr.setAttribute("oninput","return;"),$r="function"===typeof Zr.oninput}Jr=$r}else Jr=!1;Xr=Jr&&(!document.documentMode||9<document.documentMode)}function en(){zr&&(zr.detachEvent("onpropertychange",tn),Gr=zr=null)}function tn(e){if("value"===e.propertyName&&Yr(Gr)){var t=[];Hr(t,Gr,e,Ee(e)),Oe(Wr,t)}}function rn(e,t,r){"focusin"===e?(en(),Gr=r,(zr=t).attachEvent("onpropertychange",tn)):"focusout"===e&&en()}function nn(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return Yr(Gr)}function on(e,t){if("click"===e)return Yr(t)}function sn(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(!d.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 dn(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?dn(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function hn(){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=hn(),r=e.focusedElem,n=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&dn(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,o=Math.min(n.start,i);n=void 0===n.end?o:Math.min(n.end,i),!e.extend&&o>n&&(i=n,n=o,o=i),i=ln(r,o);var s=ln(r,n);i&&s&&(1!==e.rangeCount||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&((t=t.createRange()).setStart(i.node,i.offset),e.removeAllRanges(),o>n?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.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,bn=null,vn=!1;function wn(e,t,r){var n=r.window===r?r.document:9===r.nodeType?r:r.ownerDocument;vn||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},bn&&cn(bn,n)||(bn=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 _n={animationend:En("Animation","AnimationEnd"),animationiteration:En("Animation","AnimationIteration"),animationstart:En("Animation","AnimationStart"),transitionend:En("Transition","TransitionEnd")},Sn={},In={};function An(e){if(Sn[e])return Sn[e];if(!_n[e])return e;var t,r=_n[e];for(t in r)if(r.hasOwnProperty(t)&&t in In)return Sn[e]=r[t];return e}l&&(In=document.createElement("div").style,"AnimationEvent"in window||(delete _n.animationend.animation,delete _n.animationiteration.animation,delete _n.animationstart.animation),"TransitionEvent"in window||delete _n.transitionend.transition);var Rn=An("animationend"),Tn=An("animationiteration"),Cn=An("animationstart"),Pn=An("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 Nn(e,t){kn.set(e,t),c(t,[e])}for(var Dn=0;Dn<On.length;Dn++){var Bn=On[Dn];Nn(Bn.toLowerCase(),"on"+(Bn[0].toUpperCase()+Bn.slice(1)))}Nn(Rn,"onAnimationEnd"),Nn(Tn,"onAnimationIteration"),Nn(Cn,"onAnimationStart"),Nn("dblclick","onDoubleClick"),Nn("focusin","onFocus"),Nn("focusout","onBlur"),Nn(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 xn="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(" "),Ln=new Set("cancel close invalid load scroll toggle".split(" ").concat(xn));function Mn(e,t,r){var n=e.type||"unknown-event";e.currentTarget=r,function(e,t,r,n,i,s,a,c,u){if(Fe.apply(this,arguments),Le){if(!Le)throw Error(o(198));var l=Me;Le=!1,Me=null,Ue||(Ue=!0,je=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 o=void 0;if(t)for(var s=n.length-1;0<=s;s--){var a=n[s],c=a.instance,u=a.currentTarget;if(a=a.listener,c!==o&&i.isPropagationStopped())break e;Mn(i,a,u),o=c}else for(s=0;s<n.length;s++){if(c=(a=n[s]).instance,u=a.currentTarget,a=a.listener,c!==o&&i.isPropagationStopped())break e;Mn(i,a,u),o=c}}}if(Ue)throw e=je,Ue=!1,je=null,e}function jn(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 Kn(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,s.forEach((function(t){"selectionchange"!==t&&(Ln.has(t)||Kn(t,!1,e),Kn(t,!0,e))}));var t=9===e.nodeType?e:e.ownerDocument;null===t||t[Fn]||(t[Fn]=!0,Kn("selectionchange",!1,t))}}function qn(e,t,r,n){switch(Xt(t)){case 1:var i=zt;break;case 4:i=Gt;break;default:i=Wt}r=i.bind(null,t,r,e),i=void 0,!De||"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 Hn(e,t,r,n,i){var o=n;if(0===(1&t)&&0===(2&t)&&null!==n)e:for(;;){if(null===n)return;var s=n.tag;if(3===s||4===s){var a=n.stateNode.containerInfo;if(a===i||8===a.nodeType&&a.parentNode===i)break;if(4===s)for(s=n.return;null!==s;){var c=s.tag;if((3===c||4===c)&&((c=s.stateNode.containerInfo)===i||8===c.nodeType&&c.parentNode===i))return;s=s.return}for(;null!==a;){if(null===(s=bi(a)))return;if(5===(c=s.tag)||6===c){n=o=s;continue e}a=a.parentNode}}n=n.return}Oe((function(){var n=o,i=Ee(r),s=[];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=Rr;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=Cr;break;case Rn:case Tn:case Cn:c=gr;break;case Pn:c=Pr;break;case"scroll":c=dr;break;case"wheel":c=Or;break;case"copy":case"cut":case"paste":c=br;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":c=Tr}var l=0!==(4&t),d=!l&&"scroll"===e,h=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!==h&&(null!=(y=Ne(p,h))&&l.push(zn(p,y,f)))),d)break;p=p.return}0<l.length&&(a=new c(a,u,null,r,i),s.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)||!bi(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)?bi(u):null)&&(u!==(d=Ve(u))||5!==u.tag&&6!==u.tag)&&(u=null)):(c=null,u=n),c!==u)){if(l=fr,y="onMouseLeave",h="onMouseEnter",p="mouse","pointerout"!==e&&"pointerover"!==e||(l=Tr,y="onPointerLeave",h="onPointerEnter",p="pointer"),d=null==c?a:wi(c),f=null==u?a:wi(u),(a=new l(y,p+"leave",c,r,i)).target=d,a.relatedTarget=f,y=null,bi(i)===n&&((l=new l(h,p+"enter",u,r,i)).target=f,l.relatedTarget=d,y=l),d=y,c&&u)e:{for(h=u,p=0,f=l=c;f;f=Wn(f))p++;for(f=0,y=h;y;y=Wn(y))f++;for(;0<p-f;)l=Wn(l),p--;for(;0<f-p;)h=Wn(h),f--;for(;p--;){if(l===h||null!==h&&l===h.alternate)break e;l=Wn(l),h=Wn(h)}l=null}else l=null;null!==c&&Yn(s,a,c,l,!1),null!==u&&null!==d&&Yn(s,d,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(Xr)g=sn;else{g=nn;var m=rn}else(c=a.nodeName)&&"input"===c.toLowerCase()&&("checkbox"===a.type||"radio"===a.type)&&(g=on);switch(g&&(g=g(e,n))?Hr(s,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,bn=null);break;case"focusout":bn=mn=gn=null;break;case"mousedown":vn=!0;break;case"contextmenu":case"mouseup":case"dragend":vn=!1,wn(s,r,i);break;case"selectionchange":if(yn)break;case"keydown":case"keyup":wn(s,r,i)}var b;if(Dr)e:{switch(e){case"compositionstart":var v="onCompositionStart";break e;case"compositionend":v="onCompositionEnd";break e;case"compositionupdate":v="onCompositionUpdate";break e}v=void 0}else Fr?jr(e,r)&&(v="onCompositionEnd"):"keydown"===e&&229===r.keyCode&&(v="onCompositionStart");v&&(Lr&&"ko"!==r.locale&&(Fr||"onCompositionStart"!==v?"onCompositionEnd"===v&&Fr&&(b=er()):($t="value"in(Jt=i)?Jt.value:Jt.textContent,Fr=!0)),0<(m=Gn(n,v)).length&&(v=new vr(v,e,null,r,i),s.push({event:v,listeners:m}),b?v.data=b:null!==(b=Kr(r))&&(v.data=b))),(b=xr?function(e,t){switch(e){case"compositionend":return Kr(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||!Dr&&jr(e,t)?(e=er(),Zt=$t=Jt=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 Lr&&"ko"!==t.locale?null:t.data}}(e,r))&&(0<(n=Gn(n,"onBeforeInput")).length&&(i=new vr("onBeforeInput","beforeinput",null,r,i),s.push({event:i,listeners:n}),i.data=b))}Un(s,t)}))}function zn(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,o=i.stateNode;5===i.tag&&null!==o&&(i=o,null!=(o=Ne(e,r))&&n.unshift(zn(e,o,i)),null!=(o=Ne(e,t))&&n.push(zn(e,o,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 o=t._reactName,s=[];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=Ne(r,o))&&s.unshift(zn(r,c,a)):i||null!=(c=Ne(r,o))&&s.push(zn(r,c,a))),r=r.return}0!==s.length&&e.push({event:t,listeners:s})}var Qn=/\r\n?/g,Xn=/\u0000|\uFFFD/g;function Jn(e){return("string"===typeof e?e:""+e).replace(Qn,"\n").replace(Xn,"")}function $n(e,t,r){if(t=Jn(t),Jn(e)!==t&&r)throw Error(o(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,oi="function"===typeof Promise?Promise:void 0,si="function"===typeof queueMicrotask?queueMicrotask:"undefined"!==typeof oi?function(e){return oi.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 di=Math.random().toString(36).slice(2),hi="__reactFiber$"+di,fi="__reactProps$"+di,pi="__reactContainer$"+di,yi="__reactEvents$"+di,gi="__reactListeners$"+di,mi="__reactHandles$"+di;function bi(e){var t=e[hi];if(t)return t;for(var r=e.parentNode;r;){if(t=r[pi]||r[hi]){if(r=t.alternate,null!==t.child||null!==r&&null!==r.child)for(e=li(e);null!==e;){if(r=e[hi])return r;e=li(e)}return t}r=(e=r).parentNode}return null}function vi(e){return!(e=e[hi]||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(o(33))}function Ei(e){return e[fi]||null}var _i=[],Si=-1;function Ii(e){return{current:e}}function Ai(e){0>Si||(e.current=_i[Si],_i[Si]=null,Si--)}function Ri(e,t){Si++,_i[Si]=e.current,e.current=t}var Ti={},Ci=Ii(Ti),Pi=Ii(!1),ki=Ti;function Oi(e,t){var r=e.type.contextTypes;if(!r)return Ti;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var i,o={};for(i in r)o[i]=t[i];return n&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function Ni(e){return null!==(e=e.childContextTypes)&&void 0!==e}function Di(){Ai(Pi),Ai(Ci)}function Bi(e,t,r){if(Ci.current!==Ti)throw Error(o(168));Ri(Ci,t),Ri(Pi,r)}function xi(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(o(108,q(e)||"Unknown",i));return M({},r,n)}function Li(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ti,ki=Ci.current,Ri(Ci,e),Ri(Pi,Pi.current),!0}function Mi(e,t,r){var n=e.stateNode;if(!n)throw Error(o(169));r?(e=xi(e,t,ki),n.__reactInternalMemoizedMergedChildContext=e,Ai(Pi),Ai(Ci),Ri(Ci,e)):Ai(Pi),Ri(Pi,r)}var Ui=null,ji=!1,Ki=!1;function Fi(e){null===Ui?Ui=[e]:Ui.push(e)}function Vi(){if(!Ki&&null!==Ui){Ki=!0;var e=0,t=vt;try{var r=Ui;for(vt=1;e<r.length;e++){var n=r[e];do{n=n(!0)}while(null!==n)}Ui=null,ji=!1}catch(i){throw null!==Ui&&(Ui=Ui.slice(e+1)),We(Ze,Vi),i}finally{vt=t,Ki=!1}}return null}var qi=w.ReactCurrentBatchConfig;function Hi(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 zi=Ii(null),Gi=null,Wi=null,Yi=null;function Qi(){Yi=Wi=Gi=null}function Xi(e){var t=zi.current;Ai(zi),e._currentValue=t}function Ji(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(o(308));Wi=e,Gi.dependencies={lanes:0,firstContext:e}}else Wi=Wi.next=e;return t}var eo=null,to=!1;function ro(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function no(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 io(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function oo(e,t){var r=e.updateQueue;null!==r&&(r=r.shared,tu(e)?(null===(e=r.interleaved)?(t.next=t,null===eo?eo=[r]:eo.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 so(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,bt(e,r)}}function ao(e,t){var r=e.updateQueue,n=e.alternate;if(null!==n&&r===(n=n.updateQueue)){var i=null,o=null;if(null!==(r=r.firstBaseUpdate)){do{var s={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};null===o?i=o=s:o=o.next=s,r=r.next}while(null!==r);null===o?i=o=t:o=o.next=t}else i=o=t;return r={baseState:n.baseState,firstBaseUpdate:i,lastBaseUpdate:o,shared:n.shared,effects:n.effects},void(e.updateQueue=r)}null===(e=r.lastBaseUpdate)?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function co(e,t,r,n){var i=e.updateQueue;to=!1;var o=i.firstBaseUpdate,s=i.lastBaseUpdate,a=i.shared.pending;if(null!==a){i.shared.pending=null;var c=a,u=c.next;c.next=null,null===s?o=u:s.next=u,s=c;var l=e.alternate;null!==l&&((a=(l=l.updateQueue).lastBaseUpdate)!==s&&(null===a?l.firstBaseUpdate=u:a.next=u,l.lastBaseUpdate=c))}if(null!==o){var d=i.baseState;for(s=0,l=u=c=null,a=o;;){var h=a.lane,f=a.eventTime;if((n&h)===h){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(h=t,f=r,y.tag){case 1:if("function"===typeof(p=y.payload)){d=p.call(f,d,h);break e}d=p;break e;case 3:p.flags=-65537&p.flags|128;case 0:if(null===(h="function"===typeof(p=y.payload)?p.call(f,d,h):p)||void 0===h)break e;d=M({},d,h);break e;case 2:to=!0}}null!==a.callback&&0!==a.lane&&(e.flags|=64,null===(h=i.effects)?i.effects=[a]:h.push(a))}else f={eventTime:f,lane:h,tag:a.tag,payload:a.payload,callback:a.callback,next:null},null===l?(u=l=f,c=d):l=l.next=f,s|=h;if(null===(a=a.next)){if(null===(a=i.shared.pending))break;a=(h=a).next,h.next=null,i.lastBaseUpdate=h,i.shared.pending=null}}if(null===l&&(c=d),i.baseState=c,i.firstBaseUpdate=u,i.lastBaseUpdate=l,null!==(t=i.shared.interleaved)){i=t;do{s|=i.lane,i=i.next}while(i!==t)}else null===o&&(i.shared.lanes=0);Dc|=s,e.lanes=s,e.memoizedState=d}}function uo(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(o(191,i));i.call(n)}}}var lo=(new n.Component).refs;function ho(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 fo={isMounted:function(e){return!!(e=e._reactInternals)&&Ve(e)===e},enqueueSetState:function(e,t,r){e=e._reactInternals;var n=Jc(),i=$c(e),o=io(n,i);o.payload=t,void 0!==r&&null!==r&&(o.callback=r),oo(e,o),null!==(t=Zc(e,i,n))&&so(t,e,i)},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var n=Jc(),i=$c(e),o=io(n,i);o.tag=1,o.payload=t,void 0!==r&&null!==r&&(o.callback=r),oo(e,o),null!==(t=Zc(e,i,n))&&so(t,e,i)},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=Jc(),n=$c(e),i=io(r,n);i.tag=2,void 0!==t&&null!==t&&(i.callback=t),oo(e,i),null!==(t=Zc(e,n,r))&&so(t,e,n)}};function po(e,t,r,n,i,o,s){return"function"===typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(n,o,s):!t.prototype||!t.prototype.isPureReactComponent||(!cn(r,n)||!cn(i,o))}function yo(e,t,r){var n=!1,i=Ti,o=t.contextType;return"object"===typeof o&&null!==o?o=Zi(o):(i=Ni(t)?ki:Ci.current,o=(n=null!==(n=t.contextTypes)&&void 0!==n)?Oi(e,i):Ti),t=new t(r,o),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=fo,e.stateNode=t,t._reactInternals=e,n&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=o),t}function go(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&&fo.enqueueReplaceState(t,t.state,null)}function mo(e,t,r,n){var i=e.stateNode;i.props=r,i.state=e.memoizedState,i.refs=lo,ro(e);var o=t.contextType;"object"===typeof o&&null!==o?i.context=Zi(o):(o=Ni(t)?ki:Ci.current,i.context=Oi(e,o)),i.state=e.memoizedState,"function"===typeof(o=t.getDerivedStateFromProps)&&(ho(e,t,o,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&&fo.enqueueReplaceState(i,i.state,null),co(e,r,i,n),i.state=e.memoizedState),"function"===typeof i.componentDidMount&&(e.flags|=4194308)}var bo=[],vo=0,wo=null,Eo=0,_o=[],So=0,Io=null,Ao=1,Ro="";function To(e,t){bo[vo++]=Eo,bo[vo++]=wo,wo=e,Eo=t}function Co(e,t,r){_o[So++]=Ao,_o[So++]=Ro,_o[So++]=Io,Io=e;var n=Ao;e=Ro;var i=32-st(n)-1;n&=~(1<<i),r+=1;var o=32-st(t)+i;if(30<o){var s=i-i%5;o=(n&(1<<s)-1).toString(32),n>>=s,i-=s,Ao=1<<32-st(t)+i|r<<i|n,Ro=o+e}else Ao=1<<o|r<<i|n,Ro=e}function Po(e){null!==e.return&&(To(e,1),Co(e,1,0))}function ko(e){for(;e===wo;)wo=bo[--vo],bo[vo]=null,Eo=bo[--vo],bo[vo]=null;for(;e===Io;)Io=_o[--So],_o[So]=null,Ro=_o[--So],_o[So]=null,Ao=_o[--So],_o[So]=null}var Oo=null,No=null,Do=!1,Bo=null;function xo(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 Lo(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,Oo=e,No=ui(t.firstChild),!0);case 6:return null!==(t=""===e.pendingProps||3!==t.nodeType?null:t)&&(e.stateNode=t,Oo=e,No=null,!0);case 13:return null!==(t=8!==t.nodeType?null:t)&&(r=null!==Io?{id:Ao,overflow:Ro}:null,e.memoizedState={dehydrated:t,treeContext:r,retryLane:1073741824},(r=ku(18,null,null,0)).stateNode=t,r.return=e,e.child=r,Oo=e,No=null,!0);default:return!1}}function Mo(e){return 0!==(1&e.mode)&&0===(128&e.flags)}function Uo(e){if(Do){var t=No;if(t){var r=t;if(!Lo(e,t)){if(Mo(e))throw Error(o(418));t=ui(r.nextSibling);var n=Oo;t&&Lo(e,t)?xo(n,r):(e.flags=-4097&e.flags|2,Do=!1,Oo=e)}}else{if(Mo(e))throw Error(o(418));e.flags=-4097&e.flags|2,Do=!1,Oo=e}}}function jo(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;Oo=e}function Ko(e){if(e!==Oo)return!1;if(!Do)return jo(e),Do=!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=No)){if(Mo(e)){for(e=No;e;)e=ui(e.nextSibling);throw Error(o(418))}for(;t;)xo(e,t),t=ui(t.nextSibling)}if(jo(e),13===e.tag){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(o(317));e:{for(e=e.nextSibling,t=0;e;){if(8===e.nodeType){var r=e.data;if("/$"===r){if(0===t){No=ui(e.nextSibling);break e}t--}else"$"!==r&&"$!"!==r&&"$?"!==r||t++}e=e.nextSibling}No=null}}else No=Oo?ui(e.stateNode.nextSibling):null;return!0}function Fo(){No=Oo=null,Do=!1}function Vo(e){null===Bo?Bo=[e]:Bo.push(e)}function qo(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(o(309));var n=r.stateNode}if(!n)throw Error(o(147,e));var i=n,s=""+e;return null!==t&&null!==t.ref&&"function"===typeof t.ref&&t.ref._stringRef===s?t.ref:(t=function(e){var t=i.refs;t===lo&&(t=i.refs={}),null===e?delete t[s]:t[s]=e},t._stringRef=s,t)}if("string"!==typeof e)throw Error(o(284));if(!r._owner)throw Error(o(290,e))}return e}function Ho(e,t){throw e=Object.prototype.toString.call(t),Error(o(31,"[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function zo(e){return(0,e._init)(e._payload)}function Go(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=Nu(e,t)).index=0,e.sibling=null,e}function s(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=Lu(r,e.mode,n)).return=e,t):((t=i(t,r)).return=e,t)}function u(e,t,r,n){var o=r.type;return o===S?d(e,t,r.props.children,n,r.key):null!==t&&(t.elementType===o||"object"===typeof o&&null!==o&&o.$$typeof===N&&zo(o)===t.type)?((n=i(t,r.props)).ref=qo(e,t,r),n.return=e,n):((n=Du(r.type,r.key,r.props,null,e.mode,n)).ref=qo(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 d(e,t,r,n,o){return null===t||7!==t.tag?((t=Bu(r,e.mode,n,o)).return=e,t):((t=i(t,r)).return=e,t)}function h(e,t,r){if("string"===typeof t&&""!==t||"number"===typeof t)return(t=Lu(""+t,e.mode,r)).return=e,t;if("object"===typeof t&&null!==t){switch(t.$$typeof){case E:return(r=Du(t.type,t.key,t.props,null,e.mode,r)).ref=qo(e,null,t),r.return=e,r;case _:return(t=Mu(t,e.mode,r)).return=e,t;case N:return h(e,(0,t._init)(t._payload),r)}if(te(t)||x(t))return(t=Bu(t,e.mode,r,null)).return=e,t;Ho(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 _:return r.key===i?l(e,t,r,n):null;case N:return f(e,t,(i=r._init)(r._payload),n)}if(te(r)||x(r))return null!==i?null:d(e,t,r,n,null);Ho(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 _:return l(t,e=e.get(null===n.key?r:n.key)||null,n,i);case N:return p(e,t,r,(0,n._init)(n._payload),i)}if(te(n)||x(n))return d(t,e=e.get(r)||null,n,i,null);Ho(t,n)}return null}function y(i,o,a,c){for(var u=null,l=null,d=o,y=o=0,g=null;null!==d&&y<a.length;y++){d.index>y?(g=d,d=null):g=d.sibling;var m=f(i,d,a[y],c);if(null===m){null===d&&(d=g);break}e&&d&&null===m.alternate&&t(i,d),o=s(m,o,y),null===l?u=m:l.sibling=m,l=m,d=g}if(y===a.length)return r(i,d),Do&&To(i,y),u;if(null===d){for(;y<a.length;y++)null!==(d=h(i,a[y],c))&&(o=s(d,o,y),null===l?u=d:l.sibling=d,l=d);return Do&&To(i,y),u}for(d=n(i,d);y<a.length;y++)null!==(g=p(d,i,y,a[y],c))&&(e&&null!==g.alternate&&d.delete(null===g.key?y:g.key),o=s(g,o,y),null===l?u=g:l.sibling=g,l=g);return e&&d.forEach((function(e){return t(i,e)})),Do&&To(i,y),u}function g(i,a,c,u){var l=x(c);if("function"!==typeof l)throw Error(o(150));if(null==(c=l.call(c)))throw Error(o(151));for(var d=l=null,y=a,g=a=0,m=null,b=c.next();null!==y&&!b.done;g++,b=c.next()){y.index>g?(m=y,y=null):m=y.sibling;var v=f(i,y,b.value,u);if(null===v){null===y&&(y=m);break}e&&y&&null===v.alternate&&t(i,y),a=s(v,a,g),null===d?l=v:d.sibling=v,d=v,y=m}if(b.done)return r(i,y),Do&&To(i,g),l;if(null===y){for(;!b.done;g++,b=c.next())null!==(b=h(i,b.value,u))&&(a=s(b,a,g),null===d?l=b:d.sibling=b,d=b);return Do&&To(i,g),l}for(y=n(i,y);!b.done;g++,b=c.next())null!==(b=p(y,i,g,b.value,u))&&(e&&null!==b.alternate&&y.delete(null===b.key?g:b.key),a=s(b,a,g),null===d?l=b:d.sibling=b,d=b);return e&&y.forEach((function(e){return t(i,e)})),Do&&To(i,g),l}return function e(n,o,s,c){if("object"===typeof s&&null!==s&&s.type===S&&null===s.key&&(s=s.props.children),"object"===typeof s&&null!==s){switch(s.$$typeof){case E:e:{for(var u=s.key,l=o;null!==l;){if(l.key===u){if((u=s.type)===S){if(7===l.tag){r(n,l.sibling),(o=i(l,s.props.children)).return=n,n=o;break e}}else if(l.elementType===u||"object"===typeof u&&null!==u&&u.$$typeof===N&&zo(u)===l.type){r(n,l.sibling),(o=i(l,s.props)).ref=qo(n,l,s),o.return=n,n=o;break e}r(n,l);break}t(n,l),l=l.sibling}s.type===S?((o=Bu(s.props.children,n.mode,c,s.key)).return=n,n=o):((c=Du(s.type,s.key,s.props,null,n.mode,c)).ref=qo(n,o,s),c.return=n,n=c)}return a(n);case _:e:{for(l=s.key;null!==o;){if(o.key===l){if(4===o.tag&&o.stateNode.containerInfo===s.containerInfo&&o.stateNode.implementation===s.implementation){r(n,o.sibling),(o=i(o,s.children||[])).return=n,n=o;break e}r(n,o);break}t(n,o),o=o.sibling}(o=Mu(s,n.mode,c)).return=n,n=o}return a(n);case N:return e(n,o,(l=s._init)(s._payload),c)}if(te(s))return y(n,o,s,c);if(x(s))return g(n,o,s,c);Ho(n,s)}return"string"===typeof s&&""!==s||"number"===typeof s?(s=""+s,null!==o&&6===o.tag?(r(n,o.sibling),(o=i(o,s)).return=n,n=o):(r(n,o),(o=Lu(s,n.mode,c)).return=n,n=o),a(n)):r(n,o)}}var Wo=Go(!0),Yo=Go(!1),Qo={},Xo=Ii(Qo),Jo=Ii(Qo),$o=Ii(Qo);function Zo(e){if(e===Qo)throw Error(o(174));return e}function es(e,t){switch(Ri($o,t),Ri(Jo,e),Ri(Xo,Qo),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)}Ai(Xo),Ri(Xo,t)}function ts(){Ai(Xo),Ai(Jo),Ai($o)}function rs(e){Zo($o.current);var t=Zo(Xo.current),r=ce(t,e.type);t!==r&&(Ri(Jo,e),Ri(Xo,r))}function ns(e){Jo.current===e&&(Ai(Xo),Ai(Jo))}var is=Ii(0);function os(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 ss=[];function as(){for(var e=0;e<ss.length;e++)ss[e]._workInProgressVersionPrimary=null;ss.length=0}var cs=w.ReactCurrentDispatcher,us=w.ReactCurrentBatchConfig,ls=0,ds=null,hs=null,fs=null,ps=!1,ys=!1,gs=0,ms=0;function bs(){throw Error(o(321))}function vs(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 ws(e,t,r,n,i,s){if(ls=s,ds=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,cs.current=null===e||null===e.memoizedState?na:ia,e=r(n,i),ys){s=0;do{if(ys=!1,gs=0,25<=s)throw Error(o(301));s+=1,fs=hs=null,t.updateQueue=null,cs.current=oa,e=r(n,i)}while(ys)}if(cs.current=ra,t=null!==hs&&null!==hs.next,ls=0,fs=hs=ds=null,ps=!1,t)throw Error(o(300));return e}function Es(){var e=0!==gs;return gs=0,e}function _s(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===fs?ds.memoizedState=fs=e:fs=fs.next=e,fs}function Ss(){if(null===hs){var e=ds.alternate;e=null!==e?e.memoizedState:null}else e=hs.next;var t=null===fs?ds.memoizedState:fs.next;if(null!==t)fs=t,hs=e;else{if(null===e)throw Error(o(310));e={memoizedState:(hs=e).memoizedState,baseState:hs.baseState,baseQueue:hs.baseQueue,queue:hs.queue,next:null},null===fs?ds.memoizedState=fs=e:fs=fs.next=e}return fs}function Is(e,t){return"function"===typeof t?t(e):t}function As(e){var t=Ss(),r=t.queue;if(null===r)throw Error(o(311));r.lastRenderedReducer=e;var n=hs,i=n.baseQueue,s=r.pending;if(null!==s){if(null!==i){var a=i.next;i.next=s.next,s.next=a}n.baseQueue=i=s,r.pending=null}if(null!==i){s=i.next,n=n.baseState;var c=a=null,u=null,l=s;do{var d=l.lane;if((ls&d)===d)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 h={lane:d,action:l.action,hasEagerState:l.hasEagerState,eagerState:l.eagerState,next:null};null===u?(c=u=h,a=n):u=u.next=h,ds.lanes|=d,Dc|=d}l=l.next}while(null!==l&&l!==s);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{s=i.lane,ds.lanes|=s,Dc|=s,i=i.next}while(i!==e)}else null===i&&(r.lanes=0);return[t.memoizedState,r.dispatch]}function Rs(e){var t=Ss(),r=t.queue;if(null===r)throw Error(o(311));r.lastRenderedReducer=e;var n=r.dispatch,i=r.pending,s=t.memoizedState;if(null!==i){r.pending=null;var a=i=i.next;do{s=e(s,a.action),a=a.next}while(a!==i);an(s,t.memoizedState)||(Ea=!0),t.memoizedState=s,null===t.baseQueue&&(t.baseState=s),r.lastRenderedState=s}return[s,n]}function Ts(){}function Cs(e,t){var r=ds,n=Ss(),i=t(),s=!an(n.memoizedState,i);if(s&&(n.memoizedState=i,Ea=!0),n=n.queue,js(Os.bind(null,r,n,e),[e]),n.getSnapshot!==t||s||null!==fs&&1&fs.memoizedState.tag){if(r.flags|=2048,Bs(9,ks.bind(null,r,n,i,t),void 0,null),null===Rc)throw Error(o(349));0!==(30&ls)||Ps(r,t,i)}return i}function Ps(e,t,r){e.flags|=16384,e={getSnapshot:t,value:r},null===(t=ds.updateQueue)?(t={lastEffect:null,stores:null},ds.updateQueue=t,t.stores=[e]):null===(r=t.stores)?t.stores=[e]:r.push(e)}function ks(e,t,r,n){t.value=r,t.getSnapshot=n,Ns(t)&&Zc(e,1,-1)}function Os(e,t,r){return r((function(){Ns(t)&&Zc(e,1,-1)}))}function Ns(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!an(e,r)}catch(n){return!0}}function Ds(e){var t=_s();return"function"===typeof e&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Is,lastRenderedState:e},t.queue=e,e=e.dispatch=Js.bind(null,ds,e),[t.memoizedState,e]}function Bs(e,t,r,n){return e={tag:e,create:t,destroy:r,deps:n,next:null},null===(t=ds.updateQueue)?(t={lastEffect:null,stores:null},ds.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 xs(){return Ss().memoizedState}function Ls(e,t,r,n){var i=_s();ds.flags|=e,i.memoizedState=Bs(1|t,r,void 0,void 0===n?null:n)}function Ms(e,t,r,n){var i=Ss();n=void 0===n?null:n;var o=void 0;if(null!==hs){var s=hs.memoizedState;if(o=s.destroy,null!==n&&vs(n,s.deps))return void(i.memoizedState=Bs(t,r,o,n))}ds.flags|=e,i.memoizedState=Bs(1|t,r,o,n)}function Us(e,t){return Ls(8390656,8,e,t)}function js(e,t){return Ms(2048,8,e,t)}function Ks(e,t){return Ms(4,2,e,t)}function Fs(e,t){return Ms(4,4,e,t)}function Vs(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 qs(e,t,r){return r=null!==r&&void 0!==r?r.concat([e]):null,Ms(4,4,Vs.bind(null,t,e),r)}function Hs(){}function zs(e,t){var r=Ss();t=void 0===t?null:t;var n=r.memoizedState;return null!==n&&null!==t&&vs(t,n[1])?n[0]:(r.memoizedState=[e,t],e)}function Gs(e,t){var r=Ss();t=void 0===t?null:t;var n=r.memoizedState;return null!==n&&null!==t&&vs(t,n[1])?n[0]:(e=e(),r.memoizedState=[e,t],e)}function Ws(e,t,r){return 0===(21&ls)?(e.baseState&&(e.baseState=!1,Ea=!0),e.memoizedState=r):(an(r,t)||(r=yt(),ds.lanes|=r,Dc|=r,e.baseState=!0),t)}function Ys(e,t){var r=vt;vt=0!==r&&4>r?r:4,e(!0);var n=us.transition;us.transition={};try{e(!1),t()}finally{vt=r,us.transition=n}}function Qs(){return Ss().memoizedState}function Xs(e,t,r){var n=$c(e);r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},$s(e)?Zs(t,r):(ea(e,t,r),null!==(e=Zc(e,n,r=Jc()))&&ta(e,t,n))}function Js(e,t,r){var n=$c(e),i={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if($s(e))Zs(t,i);else{ea(e,t,i);var o=e.alternate;if(0===e.lanes&&(null===o||0===o.lanes)&&null!==(o=t.lastRenderedReducer))try{var s=t.lastRenderedState,a=o(s,r);if(i.hasEagerState=!0,i.eagerState=a,an(a,s))return}catch(c){}null!==(e=Zc(e,n,r=Jc()))&&ta(e,t,n)}}function $s(e){var t=e.alternate;return e===ds||null!==t&&t===ds}function Zs(e,t){ys=ps=!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===eo?eo=[t]:eo.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,bt(e,r)}}var ra={readContext:Zi,useCallback:bs,useContext:bs,useEffect:bs,useImperativeHandle:bs,useInsertionEffect:bs,useLayoutEffect:bs,useMemo:bs,useReducer:bs,useRef:bs,useState:bs,useDebugValue:bs,useDeferredValue:bs,useTransition:bs,useMutableSource:bs,useSyncExternalStore:bs,useId:bs,unstable_isNewReconciler:!1},na={readContext:Zi,useCallback:function(e,t){return _s().memoizedState=[e,void 0===t?null:t],e},useContext:Zi,useEffect:Us,useImperativeHandle:function(e,t,r){return r=null!==r&&void 0!==r?r.concat([e]):null,Ls(4194308,4,Vs.bind(null,t,e),r)},useLayoutEffect:function(e,t){return Ls(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ls(4,2,e,t)},useMemo:function(e,t){var r=_s();return t=void 0===t?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=_s();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=Xs.bind(null,ds,e),[n.memoizedState,e]},useRef:function(e){return e={current:e},_s().memoizedState=e},useState:Ds,useDebugValue:Hs,useDeferredValue:function(e){return _s().memoizedState=e},useTransition:function(){var e=Ds(!1),t=e[0];return e=Ys.bind(null,e[1]),_s().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var n=ds,i=_s();if(Do){if(void 0===r)throw Error(o(407));r=r()}else{if(r=t(),null===Rc)throw Error(o(349));0!==(30&ls)||Ps(n,t,r)}i.memoizedState=r;var s={value:r,getSnapshot:t};return i.queue=s,Us(Os.bind(null,n,s,e),[e]),n.flags|=2048,Bs(9,ks.bind(null,n,s,r,t),void 0,null),r},useId:function(){var e=_s(),t=Rc.identifierPrefix;if(Do){var r=Ro;t=":"+t+"R"+(r=(Ao&~(1<<32-st(Ao)-1)).toString(32)+r),0<(r=gs++)&&(t+="H"+r.toString(32)),t+=":"}else t=":"+t+"r"+(r=ms++).toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},ia={readContext:Zi,useCallback:zs,useContext:Zi,useEffect:js,useImperativeHandle:qs,useInsertionEffect:Ks,useLayoutEffect:Fs,useMemo:Gs,useReducer:As,useRef:xs,useState:function(){return As(Is)},useDebugValue:Hs,useDeferredValue:function(e){return Ws(Ss(),hs.memoizedState,e)},useTransition:function(){return[As(Is)[0],Ss().memoizedState]},useMutableSource:Ts,useSyncExternalStore:Cs,useId:Qs,unstable_isNewReconciler:!1},oa={readContext:Zi,useCallback:zs,useContext:Zi,useEffect:js,useImperativeHandle:qs,useInsertionEffect:Ks,useLayoutEffect:Fs,useMemo:Gs,useReducer:Rs,useRef:xs,useState:function(){return Rs(Is)},useDebugValue:Hs,useDeferredValue:function(e){var t=Ss();return null===hs?t.memoizedState=e:Ws(t,hs.memoizedState,e)},useTransition:function(){return[Rs(Is)[0],Ss().memoizedState]},useMutableSource:Ts,useSyncExternalStore:Cs,useId:Qs,unstable_isNewReconciler:!1};function sa(e,t){try{var r="",n=t;do{r+=F(n),n=n.return}while(n);var i=r}catch(o){i="\nError generating stack: "+o.message+"\n"+o.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,da="function"===typeof WeakMap?WeakMap:Map;function ha(e,t,r){(r=io(-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=io(-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 o=e.stateNode;return null!==o&&"function"===typeof o.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 da;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=io(-1,1)).tag=2,oo(r,t))),r.lanes|=1),e):(e.flags|=65536,e.lanes=i,e)}function ma(e,t){if(!Do)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 ba(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 va(e,t,r){var n=t.pendingProps;switch(ko(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ba(t),null;case 1:case 17:return Ni(t.type)&&Di(),ba(t),null;case 3:return n=t.stateNode,ts(),Ai(Pi),Ai(Ci),as(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),null!==e&&null!==e.child||(Ko(t)?t.flags|=4:null===e||e.memoizedState.isDehydrated&&0===(256&t.flags)||(t.flags|=1024,null!==Bo&&(ou(Bo),Bo=null))),ba(t),null;case 5:ns(t);var i=Zo($o.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(o(166));return ba(t),null}if(e=Zo(Xo.current),Ko(t)){n=t.stateNode,r=t.type;var s=t.memoizedProps;switch(n[hi]=t,n[fi]=s,e=0!==(1&t.mode),r){case"dialog":jn("cancel",n),jn("close",n);break;case"iframe":case"object":case"embed":jn("load",n);break;case"video":case"audio":for(i=0;i<xn.length;i++)jn(xn[i],n);break;case"source":jn("error",n);break;case"img":case"image":case"link":jn("error",n),jn("load",n);break;case"details":jn("toggle",n);break;case"input":X(n,s),jn("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!s.multiple},jn("invalid",n);break;case"textarea":ie(n,s),jn("invalid",n)}for(var c in be(r,s),i=null,s)if(s.hasOwnProperty(c)){var u=s[c];"children"===c?"string"===typeof u?n.textContent!==u&&(!0!==s.suppressHydrationWarning&&$n(n.textContent,u,e),i=["children",u]):"number"===typeof u&&n.textContent!==""+u&&(!0!==s.suppressHydrationWarning&&$n(n.textContent,u,e),i=["children",""+u]):a.hasOwnProperty(c)&&null!=u&&"onScroll"===c&&jn("scroll",n)}switch(r){case"input":G(n),Z(n,s,!0);break;case"textarea":G(n),se(n);break;case"select":case"option":break;default:"function"===typeof s.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[hi]=t,e[fi]=n,ca(e,t),t.stateNode=e;e:{switch(c=ve(r,n),r){case"dialog":jn("cancel",e),jn("close",e),i=n;break;case"iframe":case"object":case"embed":jn("load",e),i=n;break;case"video":case"audio":for(i=0;i<xn.length;i++)jn(xn[i],e);i=n;break;case"source":jn("error",e),i=n;break;case"img":case"image":case"link":jn("error",e),jn("load",e),i=n;break;case"details":jn("toggle",e),i=n;break;case"input":X(e,n),i=Q(e,n),jn("invalid",e);break;case"option":default:i=n;break;case"select":e._wrapperState={wasMultiple:!!n.multiple},i=M({},n,{value:void 0}),jn("invalid",e);break;case"textarea":ie(e,n),i=ne(e,n),jn("invalid",e)}for(s in be(r,i),u=i)if(u.hasOwnProperty(s)){var l=u[s];"style"===s?ge(e,l):"dangerouslySetInnerHTML"===s?null!=(l=l?l.__html:void 0)&&de(e,l):"children"===s?"string"===typeof l?("textarea"!==r||""!==l)&&he(e,l):"number"===typeof l&&he(e,""+l):"suppressContentEditableWarning"!==s&&"suppressHydrationWarning"!==s&&"autoFocus"!==s&&(a.hasOwnProperty(s)?null!=l&&"onScroll"===s&&jn("scroll",e):null!=l&&v(e,s,l,c))}switch(r){case"input":G(e),Z(e,n,!1);break;case"textarea":G(e),se(e);break;case"option":null!=n.value&&e.setAttribute("value",""+H(n.value));break;case"select":e.multiple=!!n.multiple,null!=(s=n.value)?re(e,!!n.multiple,s,!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 ba(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(o(166));if(r=Zo($o.current),Zo(Xo.current),Ko(t)){if(n=t.stateNode,r=t.memoizedProps,n[hi]=t,(s=n.nodeValue!==r)&&null!==(e=Oo))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))}s&&(t.flags|=4)}else(n=(9===r.nodeType?r:r.ownerDocument).createTextNode(n))[hi]=t,t.stateNode=n}return ba(t),null;case 13:if(Ai(is),n=t.memoizedState,Do&&null!==No&&0!==(1&t.mode)&&0===(128&t.flags)){for(n=No;n;)n=ui(n.nextSibling);return Fo(),t.flags|=98560,t}if(null!==n&&null!==n.dehydrated){if(n=Ko(t),null===e){if(!n)throw Error(o(318));if(!(n=null!==(n=t.memoizedState)?n.dehydrated:null))throw Error(o(317));n[hi]=t}else Fo(),0===(128&t.flags)&&(t.memoizedState=null),t.flags|=4;return ba(t),null}return null!==Bo&&(ou(Bo),Bo=null),0!==(128&t.flags)?(t.lanes=r,t):(n=null!==n,r=!1,null===e?Ko(t):r=null!==e.memoizedState,n!==r&&n&&(t.child.flags|=8192,0!==(1&t.mode)&&(null===e||0!==(1&is.current)?0===Oc&&(Oc=3):pu())),null!==t.updateQueue&&(t.flags|=4),ba(t),null);case 4:return ts(),null===e&&Vn(t.stateNode.containerInfo),ba(t),null;case 10:return Xi(t.type._context),ba(t),null;case 19:if(Ai(is),null===(s=t.memoizedState))return ba(t),null;if(n=0!==(128&t.flags),null===(c=s.rendering))if(n)ma(s,!1);else{if(0!==Oc||null!==e&&0!==(128&e.flags))for(e=t.child;null!==e;){if(null!==(c=os(e))){for(t.flags|=128,ma(s,!1),null!==(n=c.updateQueue)&&(t.updateQueue=n,t.flags|=4),t.subtreeFlags=0,n=r,r=t.child;null!==r;)e=n,(s=r).flags&=14680066,null===(c=s.alternate)?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,e=c.dependencies,s.dependencies=null===e?null:{lanes:e.lanes,firstContext:e.firstContext}),r=r.sibling;return Ri(is,1&is.current|2),t.child}e=e.sibling}null!==s.tail&&Je()>jc&&(t.flags|=128,n=!0,ma(s,!1),t.lanes=4194304)}else{if(!n)if(null!==(e=os(c))){if(t.flags|=128,n=!0,null!==(r=e.updateQueue)&&(t.updateQueue=r,t.flags|=4),ma(s,!0),null===s.tail&&"hidden"===s.tailMode&&!c.alternate&&!Do)return ba(t),null}else 2*Je()-s.renderingStartTime>jc&&1073741824!==r&&(t.flags|=128,n=!0,ma(s,!1),t.lanes=4194304);s.isBackwards?(c.sibling=t.child,t.child=c):(null!==(r=s.last)?r.sibling=c:t.child=c,s.last=c)}return null!==s.tail?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=Je(),t.sibling=null,r=is.current,Ri(is,n?1&r|2:1&r),t):(ba(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)&&(ba(t),6&t.subtreeFlags&&(t.flags|=8192)):ba(t),null;case 24:case 25:return null}throw Error(o(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,Zo(Xo.current);var o,s=null;switch(r){case"input":i=Q(e,i),n=Q(e,n),s=[];break;case"select":i=M({},i,{value:void 0}),n=M({},n,{value:void 0}),s=[];break;case"textarea":i=ne(e,i),n=ne(e,n),s=[];break;default:"function"!==typeof i.onClick&&"function"===typeof n.onClick&&(e.onclick=Zn)}for(l in be(r,n),r=null,i)if(!n.hasOwnProperty(l)&&i.hasOwnProperty(l)&&null!=i[l])if("style"===l){var c=i[l];for(o in c)c.hasOwnProperty(o)&&(r||(r={}),r[o]="")}else"dangerouslySetInnerHTML"!==l&&"children"!==l&&"suppressContentEditableWarning"!==l&&"suppressHydrationWarning"!==l&&"autoFocus"!==l&&(a.hasOwnProperty(l)?s||(s=[]):(s=s||[]).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(o in c)!c.hasOwnProperty(o)||u&&u.hasOwnProperty(o)||(r||(r={}),r[o]="");for(o in u)u.hasOwnProperty(o)&&c[o]!==u[o]&&(r||(r={}),r[o]=u[o])}else r||(s||(s=[]),s.push(l,r)),r=u;else"dangerouslySetInnerHTML"===l?(u=u?u.__html:void 0,c=c?c.__html:void 0,null!=u&&c!==u&&(s=s||[]).push(l,u)):"children"===l?"string"!==typeof u&&"number"!==typeof u||(s=s||[]).push(l,""+u):"suppressContentEditableWarning"!==l&&"suppressHydrationWarning"!==l&&(a.hasOwnProperty(l)?(null!=u&&"onScroll"===l&&jn("scroll",e),s||c===u||(s=[])):(s=s||[]).push(l,u))}r&&(s=s||[]).push("style",r);var l=s;(t.updateQueue=l)&&(t.flags|=4)}},la=function(e,t,r,n){r!==n&&(t.flags|=4)};var wa=w.ReactCurrentOwner,Ea=!1;function _a(e,t,r,n){t.child=null===e?Yo(t,null,r,n):Wo(t,e.child,r,n)}function Sa(e,t,r,n,i){r=r.render;var o=t.ref;return $i(t,i),n=ws(e,t,r,n,o,i),r=Es(),null===e||Ea?(Do&&r&&Po(t),t.flags|=1,_a(e,t,n,i),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Ha(e,t,i))}function Ia(e,t,r,n,i){if(null===e){var o=r.type;return"function"!==typeof o||Ou(o)||void 0!==o.defaultProps||null!==r.compare||void 0!==r.defaultProps?((e=Du(r.type,null,n,t,t.mode,i)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=o,Aa(e,t,o,n,i))}if(o=e.child,0===(e.lanes&i)){var s=o.memoizedProps;if((r=null!==(r=r.compare)?r:cn)(s,n)&&e.ref===t.ref)return Ha(e,t,i)}return t.flags|=1,(e=Nu(o,n)).ref=t.ref,e.return=t,t.child=e}function Aa(e,t,r,n,i){if(null!==e){var o=e.memoizedProps;if(cn(o,n)&&e.ref===t.ref){if(Ea=!1,t.pendingProps=n=o,0===(e.lanes&i))return t.lanes=e.lanes,Ha(e,t,i);0!==(131072&e.flags)&&(Ea=!0)}}return Ca(e,t,r,n,i)}function Ra(e,t,r){var n=t.pendingProps,i=n.children,o=null!==e?e.memoizedState:null;if("hidden"===n.mode)if(0===(1&t.mode))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ri(kc,Pc),Pc|=r;else{if(0===(1073741824&r))return e=null!==o?o.baseLanes|r:r,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Ri(kc,Pc),Pc|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=null!==o?o.baseLanes:r,Ri(kc,Pc),Pc|=n}else null!==o?(n=o.baseLanes|r,t.memoizedState=null):n=r,Ri(kc,Pc),Pc|=n;return _a(e,t,i,r),t.child}function Ta(e,t){var r=t.ref;(null===e&&null!==r||null!==e&&e.ref!==r)&&(t.flags|=512,t.flags|=2097152)}function Ca(e,t,r,n,i){var o=Ni(r)?ki:Ci.current;return o=Oi(t,o),$i(t,i),r=ws(e,t,r,n,o,i),n=Es(),null===e||Ea?(Do&&n&&Po(t),t.flags|=1,_a(e,t,r,i),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Ha(e,t,i))}function Pa(e,t,r,n,i){if(Ni(r)){var o=!0;Li(t)}else o=!1;if($i(t,i),null===t.stateNode)null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),yo(t,r,n),mo(t,r,n,i),n=!0;else if(null===e){var s=t.stateNode,a=t.memoizedProps;s.props=a;var c=s.context,u=r.contextType;"object"===typeof u&&null!==u?u=Zi(u):u=Oi(t,u=Ni(r)?ki:Ci.current);var l=r.getDerivedStateFromProps,d="function"===typeof l||"function"===typeof s.getSnapshotBeforeUpdate;d||"function"!==typeof s.UNSAFE_componentWillReceiveProps&&"function"!==typeof s.componentWillReceiveProps||(a!==n||c!==u)&&go(t,s,n,u),to=!1;var h=t.memoizedState;s.state=h,co(t,n,s,i),c=t.memoizedState,a!==n||h!==c||Pi.current||to?("function"===typeof l&&(ho(t,r,l,n),c=t.memoizedState),(a=to||po(t,r,a,n,h,c,u))?(d||"function"!==typeof s.UNSAFE_componentWillMount&&"function"!==typeof s.componentWillMount||("function"===typeof s.componentWillMount&&s.componentWillMount(),"function"===typeof s.UNSAFE_componentWillMount&&s.UNSAFE_componentWillMount()),"function"===typeof s.componentDidMount&&(t.flags|=4194308)):("function"===typeof s.componentDidMount&&(t.flags|=4194308),t.memoizedProps=n,t.memoizedState=c),s.props=n,s.state=c,s.context=u,n=a):("function"===typeof s.componentDidMount&&(t.flags|=4194308),n=!1)}else{s=t.stateNode,no(e,t),a=t.memoizedProps,u=t.type===t.elementType?a:Hi(t.type,a),s.props=u,d=t.pendingProps,h=s.context,"object"===typeof(c=r.contextType)&&null!==c?c=Zi(c):c=Oi(t,c=Ni(r)?ki:Ci.current);var f=r.getDerivedStateFromProps;(l="function"===typeof f||"function"===typeof s.getSnapshotBeforeUpdate)||"function"!==typeof s.UNSAFE_componentWillReceiveProps&&"function"!==typeof s.componentWillReceiveProps||(a!==d||h!==c)&&go(t,s,n,c),to=!1,h=t.memoizedState,s.state=h,co(t,n,s,i);var p=t.memoizedState;a!==d||h!==p||Pi.current||to?("function"===typeof f&&(ho(t,r,f,n),p=t.memoizedState),(u=to||po(t,r,u,n,h,p,c)||!1)?(l||"function"!==typeof s.UNSAFE_componentWillUpdate&&"function"!==typeof s.componentWillUpdate||("function"===typeof s.componentWillUpdate&&s.componentWillUpdate(n,p,c),"function"===typeof s.UNSAFE_componentWillUpdate&&s.UNSAFE_componentWillUpdate(n,p,c)),"function"===typeof s.componentDidUpdate&&(t.flags|=4),"function"===typeof s.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!==typeof s.componentDidUpdate||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),"function"!==typeof s.getSnapshotBeforeUpdate||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=n,t.memoizedState=p),s.props=n,s.state=p,s.context=c,n=u):("function"!==typeof s.componentDidUpdate||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),"function"!==typeof s.getSnapshotBeforeUpdate||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),n=!1)}return ka(e,t,r,n,o,i)}function ka(e,t,r,n,i,o){Ta(e,t);var s=0!==(128&t.flags);if(!n&&!s)return i&&Mi(t,r,!1),Ha(e,t,o);n=t.stateNode,wa.current=t;var a=s&&"function"!==typeof r.getDerivedStateFromError?null:n.render();return t.flags|=1,null!==e&&s?(t.child=Wo(t,e.child,null,o),t.child=Wo(t,null,a,o)):_a(e,t,a,o),t.memoizedState=n.state,i&&Mi(t,r,!0),t.child}function Oa(e){var t=e.stateNode;t.pendingContext?Bi(0,t.pendingContext,t.pendingContext!==t.context):t.context&&Bi(0,t.context,!1),es(e,t.containerInfo)}function Na(e,t,r,n,i){return Fo(),Vo(i),t.flags|=256,_a(e,t,r,n),t.child}var Da={dehydrated:null,treeContext:null,retryLane:0};function Ba(e){return{baseLanes:e,cachePool:null,transitions:null}}function xa(e,t){return{baseLanes:e.baseLanes|t,cachePool:null,transitions:e.transitions}}function La(e,t,r){var n,i=t.pendingProps,s=is.current,a=!1,c=0!==(128&t.flags);if((n=c)||(n=(null===e||null!==e.memoizedState)&&0!==(2&s)),n?(a=!0,t.flags&=-129):null!==e&&null===e.memoizedState||(s|=1),Ri(is,1&s),null===e)return Uo(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):(s=i.children,e=i.fallback,a?(i=t.mode,a=t.child,s={mode:"hidden",children:s},0===(1&i)&&null!==a?(a.childLanes=0,a.pendingProps=s):a=xu(s,i,0,null),e=Bu(e,i,r,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=Ba(r),t.memoizedState=Da,e):Ma(t,s));if(null!==(s=e.memoizedState)){if(null!==(n=s.dehydrated)){if(c)return 256&t.flags?(t.flags&=-257,Ka(e,t,r,Error(o(422)))):null!==t.memoizedState?(t.child=e.child,t.flags|=128,null):(a=i.fallback,s=t.mode,i=xu({mode:"visible",children:i.children},s,0,null),(a=Bu(a,s,r,null)).flags|=2,i.return=t,a.return=t,i.sibling=a,t.child=i,0!==(1&t.mode)&&Wo(t,e.child,null,r),t.child.memoizedState=Ba(r),t.memoizedState=Da,a);if(0===(1&t.mode))t=Ka(e,t,r,null);else if("$!"===n.data)t=Ka(e,t,r,Error(o(419)));else if(i=0!==(r&e.childLanes),Ea||i){if(null!==(i=Rc)){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!==s.retryLane&&(s.retryLane=i,Zc(e,i,-1))}pu(),t=Ka(e,t,r,Error(o(421)))}else"$?"===n.data?(t.flags|=128,t.child=e.child,t=Ru.bind(null,e),n._reactRetry=t,t=null):(r=s.treeContext,No=ui(n.nextSibling),Oo=t,Do=!0,Bo=null,null!==r&&(_o[So++]=Ao,_o[So++]=Ro,_o[So++]=Io,Ao=r.id,Ro=r.overflow,Io=t),(t=Ma(t,t.pendingProps.children)).flags|=4096);return t}return a?(i=ja(e,t,i.children,i.fallback,r),a=t.child,s=e.child.memoizedState,a.memoizedState=null===s?Ba(r):xa(s,r),a.childLanes=e.childLanes&~r,t.memoizedState=Da,i):(r=Ua(e,t,i.children,r),t.memoizedState=null,r)}return a?(i=ja(e,t,i.children,i.fallback,r),a=t.child,s=e.child.memoizedState,a.memoizedState=null===s?Ba(r):xa(s,r),a.childLanes=e.childLanes&~r,t.memoizedState=Da,i):(r=Ua(e,t,i.children,r),t.memoizedState=null,r)}function Ma(e,t){return(t=xu({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=Nu(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 ja(e,t,r,n,i){var o=t.mode,s=(e=e.child).sibling,a={mode:"hidden",children:r};return 0===(1&o)&&t.child!==e?((r=t.child).childLanes=0,r.pendingProps=a,t.deletions=null):(r=Nu(e,a)).subtreeFlags=14680064&e.subtreeFlags,null!==s?n=Nu(s,n):(n=Bu(n,o,i,null)).flags|=2,n.return=t,r.return=t,r.sibling=n,t.child=r,n}function Ka(e,t,r,n){return null!==n&&Vo(n),Wo(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),Ji(e.return,t,r)}function Va(e,t,r,n,i){var o=e.memoizedState;null===o?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:i}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=n,o.tail=r,o.tailMode=i)}function qa(e,t,r){var n=t.pendingProps,i=n.revealOrder,o=n.tail;if(_a(e,t,n.children,r),0!==(2&(n=is.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(Ri(is,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===os(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,o);break;case"backwards":for(r=null,i=t.child,t.child=null;null!==i;){if(null!==(e=i.alternate)&&null===os(e)){t.child=i;break}e=i.sibling,i.sibling=r,r=i,i=e}Va(t,!0,r,null,o);break;case"together":Va(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Ha(e,t,r){if(null!==e&&(t.dependencies=e.dependencies),Dc|=t.lanes,0===(r&t.childLanes))return null;if(null!==e&&t.child!==e.child)throw Error(o(153));if(null!==t.child){for(r=Nu(e=t.child,e.pendingProps),t.child=r,r.return=t;null!==e.sibling;)e=e.sibling,(r=r.sibling=Nu(e,e.pendingProps)).return=t;r.sibling=null}return t.child}function za(e,t){switch(ko(t),t.tag){case 1:return Ni(t.type)&&Di(),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return ts(),Ai(Pi),Ai(Ci),as(),0!==(65536&(e=t.flags))&&0===(128&e)?(t.flags=-65537&e|128,t):null;case 5:return ns(t),null;case 13:if(Ai(is),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(o(340));Fo()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return Ai(is),null;case 4:return ts(),null;case 10:return Xi(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 Xa(e,t){var r=e.ref;if(null!==r)if("function"===typeof r)try{r(null)}catch(n){Su(e,t,n)}else r.current=null}function Ja(e,t,r){try{r()}catch(n){Su(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 o=i.destroy;i.destroy=void 0,void 0!==o&&Ja(t,r,o)}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[hi],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 oc(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(oc(e,t,r),e=e.sibling;null!==e;)oc(e,t,r),e=e.sibling}function sc(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(sc(e,t,r),e=e.sibling;null!==e;)sc(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(ot&&"function"===typeof ot.onCommitFiberUnmount)try{ot.onCommitFiberUnmount(it,r)}catch(a){}switch(r.tag){case 5:Wa||Xa(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 o=i,s=o.destroy;o=o.tag,void 0!==s&&(0!==(2&o)||0!==(4&o))&&Ja(r,t,s),i=i.next}while(i!==n)}uc(e,t,r);break;case 1:if(!Wa&&(Xa(r,t),"function"===typeof(n=r.stateNode).componentWillUnmount))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(a){Su(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 dc(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=Tu.bind(null,e,t);r.has(t)||(r.add(t),t.then(n,n))}))}}function hc(e,t){var r=t.deletions;if(null!==r)for(var n=0;n<r.length;n++){var i=r[n];try{var s=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(o(160));lc(s,a,i),ac=null,cc=!1;var u=i.alternate;null!==u&&(u.return=null),i.return=null}catch(l){Su(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(hc(t,e),pc(e),4&n){try{Za(3,e,e.return),ec(3,e)}catch(y){Su(e,e.return,y)}try{Za(5,e,e.return)}catch(y){Su(e,e.return,y)}}break;case 1:hc(t,e),pc(e),512&n&&null!==r&&Xa(r,r.return);break;case 5:if(hc(t,e),pc(e),512&n&&null!==r&&Xa(r,r.return),32&e.flags){var i=e.stateNode;try{he(i,"")}catch(y){Su(e,e.return,y)}}if(4&n&&null!=(i=e.stateNode)){var s=e.memoizedProps,a=null!==r?r.memoizedProps:s,c=e.type,u=e.updateQueue;if(e.updateQueue=null,null!==u)try{"input"===c&&"radio"===s.type&&null!=s.name&&J(i,s),ve(c,a);var l=ve(c,s);for(a=0;a<u.length;a+=2){var d=u[a],h=u[a+1];"style"===d?ge(i,h):"dangerouslySetInnerHTML"===d?de(i,h):"children"===d?he(i,h):v(i,d,h,l)}switch(c){case"input":$(i,s);break;case"textarea":oe(i,s);break;case"select":var f=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!s.multiple;var p=s.value;null!=p?re(i,!!s.multiple,p,!1):f!==!!s.multiple&&(null!=s.defaultValue?re(i,!!s.multiple,s.defaultValue,!0):re(i,!!s.multiple,s.multiple?[]:"",!1))}i[fi]=s}catch(y){Su(e,e.return,y)}}break;case 6:if(hc(t,e),pc(e),4&n){if(null===e.stateNode)throw Error(o(162));l=e.stateNode,d=e.memoizedProps;try{l.nodeValue=d}catch(y){Su(e,e.return,y)}}break;case 3:if(hc(t,e),pc(e),4&n&&null!==r&&r.memoizedState.isDehydrated)try{Vt(t.containerInfo)}catch(y){Su(e,e.return,y)}break;case 4:default:hc(t,e),pc(e);break;case 13:hc(t,e),pc(e),8192&(l=e.child).flags&&null!==l.memoizedState&&(null===l.alternate||null===l.alternate.memoizedState)&&(Uc=Je()),4&n&&dc(e);break;case 22:if(l=null!==r&&null!==r.memoizedState,1&e.mode?(Wa=(d=Wa)||l,hc(t,e),Wa=d):hc(t,e),pc(e),8192&n){d=null!==e.memoizedState;e:for(h=null,f=e;;){if(5===f.tag){if(null===h){h=f;try{i=f.stateNode,d?"function"===typeof(s=i.style).setProperty?s.setProperty("display","none","important"):s.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){Su(e,e.return,y)}}}else if(6===f.tag){if(null===h)try{f.stateNode.nodeValue=d?"":f.memoizedProps}catch(y){Su(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;h===f&&(h=null),f=f.return}h===f&&(h=null),f.sibling.return=f.return,f=f.sibling}if(d&&!l&&0!==(1&e.mode))for(Qa=e,e=e.child;null!==e;){for(l=Qa=e;null!==Qa;){switch(h=(d=Qa).child,d.tag){case 0:case 11:case 14:case 15:Za(4,d,d.return);break;case 1:if(Xa(d,d.return),"function"===typeof(s=d.stateNode).componentWillUnmount){f=d,p=d.return;try{i=f,s.props=i.memoizedProps,s.state=i.memoizedState,s.componentWillUnmount()}catch(y){Su(f,p,y)}}break;case 5:Xa(d,d.return);break;case 22:if(null!==d.memoizedState){bc(l);continue}}null!==h?(h.return=d,Qa=h):bc(l)}e=e.sibling}}break;case 19:hc(t,e),pc(e),4&n&&dc(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(o(160))}switch(n.tag){case 5:var i=n.stateNode;32&n.flags&&(he(i,""),n.flags&=-33),sc(e,ic(e),i);break;case 3:case 4:var s=n.stateNode.containerInfo;oc(e,ic(e),s);break;default:throw Error(o(161))}}catch(a){Su(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,o=i.child;if(22===i.tag&&n){var s=null!==i.memoizedState||Ga;if(!s){var a=i.alternate,c=null!==a&&null!==a.memoizedState||Wa;a=Ga;var u=Wa;if(Ga=s,(Wa=c)&&!u)for(Qa=i;null!==Qa;)c=(s=Qa).child,22===s.tag&&null!==s.memoizedState?vc(i):null!==c?(c.return=s,Qa=c):vc(i);for(;null!==o;)Qa=o,gc(o,t,r),o=o.sibling;Qa=i,Ga=a,Wa=u}mc(e)}else 0!==(8772&i.subtreeFlags)&&null!==o?(o.return=i,Qa=o):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:Hi(t.type,r.memoizedProps);n.componentDidUpdate(i,r.memoizedState,n.__reactInternalSnapshotBeforeUpdate)}var s=t.updateQueue;null!==s&&uo(t,s,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}uo(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 d=l.memoizedState;if(null!==d){var h=d.dehydrated;null!==h&&Vt(h)}}}break;default:throw Error(o(163))}Wa||512&t.flags&&tc(t)}catch(f){Su(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 bc(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 vc(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){Su(t,r,c)}break;case 1:var n=t.stateNode;if("function"===typeof n.componentDidMount){var i=t.return;try{n.componentDidMount()}catch(c){Su(t,i,c)}}var o=t.return;try{tc(t)}catch(c){Su(t,o,c)}break;case 5:var s=t.return;try{tc(t)}catch(c){Su(t,s,c)}}}catch(c){Su(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,_c=w.ReactCurrentDispatcher,Sc=w.ReactCurrentOwner,Ic=w.ReactCurrentBatchConfig,Ac=0,Rc=null,Tc=null,Cc=0,Pc=0,kc=Ii(0),Oc=0,Nc=null,Dc=0,Bc=0,xc=0,Lc=null,Mc=null,Uc=0,jc=1/0,Kc=null,Fc=!1,Vc=null,qc=null,Hc=!1,zc=null,Gc=0,Wc=0,Yc=null,Qc=-1,Xc=0;function Jc(){return 0!==(6&Ac)?Je():-1!==Qc?Qc:Qc=Je()}function $c(e){return 0===(1&e.mode)?1:0!==(2&Ac)&&0!==Cc?Cc&-Cc:null!==qi.transition?(0===Xc&&(Xc=yt()),Xc):0!==(e=vt)?e:e=void 0===(e=window.event)?16:Xt(e.type)}function Zc(e,t,r){if(50<Wc)throw Wc=0,Yc=null,Error(o(185));var n=eu(e,t);return null===n?null:(mt(n,t,r),0!==(2&Ac)&&n===Rc||(n===Rc&&(0===(2&Ac)&&(Bc|=t),4===Oc&&su(n,Cc)),ru(n,r),1===t&&0===Ac&&0===(1&e.mode)&&(jc=Je()+500,ji&&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!==Rc||null!==eo)&&0!==(1&e.mode)&&0===(2&Ac)}function ru(e,t){var r=e.callbackNode;!function(e,t){for(var r=e.suspendedLanes,n=e.pingedLanes,i=e.expirationTimes,o=e.pendingLanes;0<o;){var s=31-st(o),a=1<<s,c=i[s];-1===c?0!==(a&r)&&0===(a&n)||(i[s]=ft(a,t)):c<=t&&(e.expiredLanes|=a),o&=~a}}(e,t);var n=ht(e,e===Rc?Cc: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){ji=!0,Fi(e)}(au.bind(null,e)):Fi(au.bind(null,e)),si((function(){0===Ac&&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=Cu(r,nu.bind(null,e))}e.callbackPriority=t,e.callbackNode=r}}function nu(e,t){if(Qc=-1,Xc=0,0!==(6&Ac))throw Error(o(327));var r=e.callbackNode;if(Eu()&&e.callbackNode!==r)return null;var n=ht(e,e===Rc?Cc:0);if(0===n)return null;if(0!==(30&n)||0!==(n&e.expiredLanes)||t)t=yu(e,n);else{t=n;var i=Ac;Ac|=2;var s=fu();for(Rc===e&&Cc===t||(Kc=null,jc=Je()+500,du(e,t));;)try{mu();break}catch(c){hu(e,c)}Qi(),_c.current=s,Ac=i,null!==Tc?t=0:(Rc=null,Cc=0,t=Oc)}if(0!==t){if(2===t&&(0!==(i=pt(e))&&(n=i,t=iu(e,i))),1===t)throw r=Nc,du(e,0),su(e,n),ru(e,Je()),r;if(6===t)su(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],o=i.getSnapshot;i=i.value;try{if(!an(o(),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!==(s=pt(e))&&(n=s,t=iu(e,s))),1===t))throw r=Nc,du(e,0),su(e,n),ru(e,Je()),r;switch(e.finishedWork=i,e.finishedLanes=n,t){case 0:case 1:throw Error(o(345));case 2:case 5:wu(e,Mc,Kc);break;case 3:if(su(e,n),(130023424&n)===n&&10<(t=Uc+500-Je())){if(0!==ht(e,0))break;if(((i=e.suspendedLanes)&n)!==n){Jc(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=ni(wu.bind(null,e,Mc,Kc),t);break}wu(e,Mc,Kc);break;case 4:if(su(e,n),(4194240&n)===n)break;for(t=e.eventTimes,i=-1;0<n;){var a=31-st(n);s=1<<a,(a=t[a])>i&&(i=a),n&=~s}if(n=i,10<(n=(120>(n=Je()-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,Kc),n);break}wu(e,Mc,Kc);break;default:throw Error(o(329))}}}return ru(e,Je()),e.callbackNode===r?nu.bind(null,e):null}function iu(e,t){var r=Lc;return e.current.memoizedState.isDehydrated&&(du(e,t).flags|=256),2!==(e=yu(e,t))&&(t=Mc,Mc=r,null!==t&&ou(t)),e}function ou(e){null===Mc?Mc=e:Mc.push.apply(Mc,e)}function su(e,t){for(t&=~xc,t&=~Bc,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var r=31-st(t),n=1<<r;e[r]=-1,t&=~n}}function au(e){if(0!==(6&Ac))throw Error(o(327));Eu();var t=ht(e,0);if(0===(1&t))return ru(e,Je()),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=Nc,du(e,0),su(e,t),ru(e,Je()),r;if(6===r)throw Error(o(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,wu(e,Mc,Kc),ru(e,Je()),null}function cu(e,t){var r=Ac;Ac|=1;try{return e(t)}finally{0===(Ac=r)&&(jc=Je()+500,ji&&Vi())}}function uu(e){null!==zc&&0===zc.tag&&0===(6&Ac)&&Eu();var t=Ac;Ac|=1;var r=Ic.transition,n=vt;try{if(Ic.transition=null,vt=1,e)return e()}finally{vt=n,Ic.transition=r,0===(6&(Ac=t))&&Vi()}}function lu(){Pc=kc.current,Ai(kc)}function du(e,t){e.finishedWork=null,e.finishedLanes=0;var r=e.timeoutHandle;if(-1!==r&&(e.timeoutHandle=-1,ii(r)),null!==Tc)for(r=Tc.return;null!==r;){var n=r;switch(ko(n),n.tag){case 1:null!==(n=n.type.childContextTypes)&&void 0!==n&&Di();break;case 3:ts(),Ai(Pi),Ai(Ci),as();break;case 5:ns(n);break;case 4:ts();break;case 13:case 19:Ai(is);break;case 10:Xi(n.type._context);break;case 22:case 23:lu()}r=r.return}if(Rc=e,Tc=e=Nu(e.current,null),Cc=Pc=t,Oc=0,Nc=null,xc=Bc=Dc=0,Mc=Lc=null,null!==eo){for(t=0;t<eo.length;t++)if(null!==(n=(r=eo[t]).interleaved)){r.interleaved=null;var i=n.next,o=r.pending;if(null!==o){var s=o.next;o.next=i,n.next=s}r.pending=n}eo=null}return e}function hu(e,t){for(;;){var r=Tc;try{if(Qi(),cs.current=ra,ps){for(var n=ds.memoizedState;null!==n;){var i=n.queue;null!==i&&(i.pending=null),n=n.next}ps=!1}if(ls=0,fs=hs=ds=null,ys=!1,gs=0,Sc.current=null,null===r||null===r.return){Oc=1,Nc=t,Tc=null;break}e:{var s=e,a=r.return,c=r,u=t;if(t=Cc,c.flags|=32768,null!==u&&"object"===typeof u&&"function"===typeof u.then){var l=u,d=c,h=d.tag;if(0===(1&d.mode)&&(0===h||11===h||15===h)){var f=d.alternate;f?(d.updateQueue=f.updateQueue,d.memoizedState=f.memoizedState,d.lanes=f.lanes):(d.updateQueue=null,d.memoizedState=null)}var p=ya(a);if(null!==p){p.flags&=-257,ga(p,a,c,0,t),1&p.mode&&pa(s,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(s,l,t),pu();break e}u=Error(o(426))}else if(Do&&1&c.mode){var m=ya(a);if(null!==m){0===(65536&m.flags)&&(m.flags|=256),ga(m,a,c,0,t),Vo(u);break e}}s=u,4!==Oc&&(Oc=2),null===Lc?Lc=[s]:Lc.push(s),u=sa(u,c),c=a;do{switch(c.tag){case 3:c.flags|=65536,t&=-t,c.lanes|=t,ao(c,ha(0,u,t));break e;case 1:s=u;var b=c.type,v=c.stateNode;if(0===(128&c.flags)&&("function"===typeof b.getDerivedStateFromError||null!==v&&"function"===typeof v.componentDidCatch&&(null===qc||!qc.has(v)))){c.flags|=65536,t&=-t,c.lanes|=t,ao(c,fa(c,s,t));break e}}c=c.return}while(null!==c)}vu(r)}catch(w){t=w,Tc===r&&null!==r&&(Tc=r=r.return);continue}break}}function fu(){var e=_c.current;return _c.current=ra,null===e?ra:e}function pu(){0!==Oc&&3!==Oc&&2!==Oc||(Oc=4),null===Rc||0===(268435455&Dc)&&0===(268435455&Bc)||su(Rc,Cc)}function yu(e,t){var r=Ac;Ac|=2;var n=fu();for(Rc===e&&Cc===t||(Kc=null,du(e,t));;)try{gu();break}catch(i){hu(e,i)}if(Qi(),Ac=r,_c.current=n,null!==Tc)throw Error(o(261));return Rc=null,Cc=0,Oc}function gu(){for(;null!==Tc;)bu(Tc)}function mu(){for(;null!==Tc&&!Qe();)bu(Tc)}function bu(e){var t=wc(e.alternate,e,Pc);e.memoizedProps=e.pendingProps,null===t?vu(e):Tc=t,Sc.current=null}function vu(e){var t=e;do{var r=t.alternate;if(e=t.return,0===(32768&t.flags)){if(null!==(r=va(r,t,Pc)))return void(Tc=r)}else{if(null!==(r=za(r,t)))return r.flags&=32767,void(Tc=r);if(null===e)return Oc=6,void(Tc=null);e.flags|=32768,e.subtreeFlags=0,e.deletions=null}if(null!==(t=t.sibling))return void(Tc=t);Tc=t=e}while(null!==t);0===Oc&&(Oc=5)}function wu(e,t,r){var n=vt,i=Ic.transition;try{Ic.transition=null,vt=1,function(e,t,r,n){do{Eu()}while(null!==zc);if(0!==(6&Ac))throw Error(o(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(o(177));e.callbackNode=null,e.callbackPriority=0;var s=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-st(r),o=1<<i;t[i]=0,n[i]=-1,e[i]=-1,r&=~o}}(e,s),e===Rc&&(Tc=Rc=null,Cc=0),0===(2064&r.subtreeFlags)&&0===(2064&r.flags)||Hc||(Hc=!0,Cu(tt,(function(){return Eu(),null}))),s=0!==(15990&r.flags),0!==(15990&r.subtreeFlags)||s){s=Ic.transition,Ic.transition=null;var a=vt;vt=1;var c=Ac;Ac|=4,Sc.current=null,function(e,t){if(ei=Ht,fn(e=hn())){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,s=n.focusNode;n=n.focusOffset;try{r.nodeType,s.nodeType}catch(_){r=null;break e}var a=0,c=-1,u=-1,l=0,d=0,h=e,f=null;t:for(;;){for(var p;h!==r||0!==i&&3!==h.nodeType||(c=a+i),h!==s||0!==n&&3!==h.nodeType||(u=a+n),3===h.nodeType&&(a+=h.nodeValue.length),null!==(p=h.firstChild);)f=h,h=p;for(;;){if(h===e)break t;if(f===r&&++l===i&&(c=a),f===s&&++d===n&&(u=a),null!==(p=h.nextSibling))break;f=(h=f).parentNode}h=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},Ht=!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,b=t.stateNode,v=b.getSnapshotBeforeUpdate(t.elementType===t.type?g:Hi(t.type,g),m);b.__reactInternalSnapshotBeforeUpdate=v}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(o(163))}}catch(_){Su(t,t.return,_)}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),Ht=!!ei,ti=ei=null,e.current=r,yc(r,e,i),Xe(),Ac=c,vt=a,Ic.transition=s}else e.current=r;if(Hc&&(Hc=!1,zc=e,Gc=i),0===(s=e.pendingLanes)&&(qc=null),function(e){if(ot&&"function"===typeof ot.onCommitFiberRoot)try{ot.onCommitFiberRoot(it,e,void 0,128===(128&e.current.flags))}catch(t){}}(r.stateNode),ru(e,Je()),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&(s=e.pendingLanes))?e===Yc?Wc++:(Wc=0,Yc=e):Wc=0,Vi()}(e,t,r,n)}finally{Ic.transition=i,vt=n}return null}function Eu(){if(null!==zc){var e=wt(Gc),t=Ic.transition,r=vt;try{if(Ic.transition=null,vt=16>e?16:e,null===zc)var n=!1;else{if(e=zc,zc=null,Gc=0,0!==(6&Ac))throw Error(o(331));var i=Ac;for(Ac|=4,Qa=e.current;null!==Qa;){var s=Qa,a=s.child;if(0!==(16&Qa.flags)){var c=s.deletions;if(null!==c){for(var u=0;u<c.length;u++){var l=c[u];for(Qa=l;null!==Qa;){var d=Qa;switch(d.tag){case 0:case 11:case 15:Za(8,d,s)}var h=d.child;if(null!==h)h.return=d,Qa=h;else for(;null!==Qa;){var f=(d=Qa).sibling,p=d.return;if(rc(d),d===l){Qa=null;break}if(null!==f){f.return=p,Qa=f;break}Qa=p}}}var y=s.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=s}}if(0!==(2064&s.subtreeFlags)&&null!==a)a.return=s,Qa=a;else e:for(;null!==Qa;){if(0!==(2048&(s=Qa).flags))switch(s.tag){case 0:case 11:case 15:Za(9,s,s.return)}var b=s.sibling;if(null!==b){b.return=s.return,Qa=b;break e}Qa=s.return}}var v=e.current;for(Qa=v;null!==Qa;){var w=(a=Qa).child;if(0!==(2064&a.subtreeFlags)&&null!==w)w.return=a,Qa=w;else e:for(a=v;null!==Qa;){if(0!==(2048&(c=Qa).flags))try{switch(c.tag){case 0:case 11:case 15:ec(9,c)}}catch(_){Su(c,c.return,_)}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(Ac=i,Vi(),ot&&"function"===typeof ot.onPostCommitFiberRoot)try{ot.onPostCommitFiberRoot(it,e)}catch(_){}n=!0}return n}finally{vt=r,Ic.transition=t}}return!1}function _u(e,t,r){oo(e,t=ha(0,t=sa(r,t),1)),t=Jc(),null!==(e=eu(e,1))&&(mt(e,1,t),ru(e,t))}function Su(e,t,r){if(3===e.tag)_u(e,e,r);else for(;null!==t;){if(3===t.tag){_u(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))){oo(t,e=fa(t,e=sa(r,e),1)),e=Jc(),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=Jc(),e.pingedLanes|=e.suspendedLanes&r,Rc===e&&(Cc&r)===r&&(4===Oc||3===Oc&&(130023424&Cc)===Cc&&500>Je()-Uc?du(e,0):xc|=r),ru(e,t)}function Au(e,t){0===t&&(0===(1&e.mode)?t=1:(t=lt,0===(130023424&(lt<<=1))&&(lt=4194304)));var r=Jc();null!==(e=eu(e,t))&&(mt(e,t,r),ru(e,r))}function Ru(e){var t=e.memoizedState,r=0;null!==t&&(r=t.retryLane),Au(e,r)}function Tu(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(o(314))}null!==n&&n.delete(t),Au(e,r)}function Cu(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 Nu(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 Du(e,t,r,n,i,s){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 S:return Bu(r.children,i,s,t);case I:a=8,i|=8;break;case A:return(e=ku(12,r,t,2|i)).elementType=A,e.lanes=s,e;case P:return(e=ku(13,r,t,i)).elementType=P,e.lanes=s,e;case k:return(e=ku(19,r,t,i)).elementType=k,e.lanes=s,e;case D:return xu(r,i,s,t);default:if("object"===typeof e&&null!==e)switch(e.$$typeof){case R:a=10;break e;case T:a=9;break e;case C:a=11;break e;case O:a=14;break e;case N:a=16,n=null;break e}throw Error(o(130,null==e?e:typeof e,""))}return(t=ku(a,r,t,i)).elementType=e,t.type=n,t.lanes=s,t}function Bu(e,t,r,n){return(e=ku(7,e,n,t)).lanes=r,e}function xu(e,t,r,n){return(e=ku(22,e,n,t)).elementType=D,e.lanes=r,e.stateNode={},e}function Lu(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 ju(e,t,r,n,i,o,s,a,c){return e=new Uu(e,t,r,a,c),1===t?(t=1,!0===o&&(t|=8)):t=0,o=ku(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},ro(o),e}function Ku(e,t,r){var n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:_,key:null==n?null:""+n,children:e,containerInfo:t,implementation:r}}function Fu(e){if(!e)return Ti;e:{if(Ve(e=e._reactInternals)!==e||1!==e.tag)throw Error(o(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Ni(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(null!==t);throw Error(o(171))}if(1===e.tag){var r=e.type;if(Ni(r))return xi(e,r,t)}return t}function Vu(e,t,r,n,i,o,s,a,c){return(e=ju(r,n,!0,e,0,o,0,a,c)).context=Fu(null),r=e.current,(o=io(n=Jc(),i=$c(r))).callback=void 0!==t&&null!==t?t:null,oo(r,o),e.current.lanes=i,mt(e,i,n),ru(e,n),e}function qu(e,t,r,n){var i=t.current,o=Jc(),s=$c(i);return r=Fu(r),null===t.context?t.context=r:t.pendingContext=r,(t=io(o,s)).payload={element:e},null!==(n=void 0===n?null:n)&&(t.callback=n),oo(i,t),null!==(e=Zc(i,s,o))&&so(e,i,s),s}function Hu(e){return(e=e.current).child?(e.child.tag,e.child.stateNode):null}function zu(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){zu(e,t),(e=e.alternate)&&zu(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),Fo();break;case 5:rs(t);break;case 1:Ni(t.type)&&Li(t);break;case 4:es(t,t.stateNode.containerInfo);break;case 10:var n=t.type._context,i=t.memoizedProps.value;Ri(zi,n._currentValue),n._currentValue=i;break;case 13:if(null!==(n=t.memoizedState))return null!==n.dehydrated?(Ri(is,1&is.current),t.flags|=128,null):0!==(r&t.child.childLanes)?La(e,t,r):(Ri(is,1&is.current),null!==(e=Ha(e,t,r))?e.sibling:null);Ri(is,1&is.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),Ri(is,is.current),n)break;return null;case 22:case 23:return t.lanes=0,Ra(e,t,r)}return Ha(e,t,r)}(e,t,r);Ea=0!==(131072&e.flags)}else Ea=!1,Do&&0!==(1048576&t.flags)&&Co(t,Eo,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,Ci.current);$i(t,r),i=ws(null,t,n,e,i,r);var s=Es();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,Ni(n)?(s=!0,Li(t)):s=!1,t.memoizedState=null!==i.state&&void 0!==i.state?i.state:null,ro(t),i.updater=fo,t.stateNode=i,i._reactInternals=t,mo(t,n,e,r),t=ka(null,t,n,!0,s,r)):(t.tag=0,Do&&s&&Po(t),_a(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)===C)return 11;if(e===O)return 14}return 2}(n),e=Hi(n,e),i){case 0:t=Ca(null,t,n,e,r);break e;case 1:t=Pa(null,t,n,e,r);break e;case 11:t=Sa(null,t,n,e,r);break e;case 14:t=Ia(null,t,n,Hi(n.type,e),r);break e}throw Error(o(306,n,""))}return t;case 0:return n=t.type,i=t.pendingProps,Ca(e,t,n,i=t.elementType===n?i:Hi(n,i),r);case 1:return n=t.type,i=t.pendingProps,Pa(e,t,n,i=t.elementType===n?i:Hi(n,i),r);case 3:e:{if(Oa(t),null===e)throw Error(o(387));n=t.pendingProps,i=(s=t.memoizedState).element,no(e,t),co(t,n,null,r);var a=t.memoizedState;if(n=a.element,s.isDehydrated){if(s={element:n,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=s,t.memoizedState=s,256&t.flags){t=Na(e,t,n,r,i=Error(o(423)));break e}if(n!==i){t=Na(e,t,n,r,i=Error(o(424)));break e}for(No=ui(t.stateNode.containerInfo.firstChild),Oo=t,Do=!0,Bo=null,r=Yo(t,null,n,r),t.child=r;r;)r.flags=-3&r.flags|4096,r=r.sibling}else{if(Fo(),n===i){t=Ha(e,t,r);break e}_a(e,t,n,r)}t=t.child}return t;case 5:return rs(t),null===e&&Uo(t),n=t.type,i=t.pendingProps,s=null!==e?e.memoizedProps:null,a=i.children,ri(n,i)?a=null:null!==s&&ri(n,s)&&(t.flags|=32),Ta(e,t),_a(e,t,a,r),t.child;case 6:return null===e&&Uo(t),null;case 13:return La(e,t,r);case 4:return es(t,t.stateNode.containerInfo),n=t.pendingProps,null===e?t.child=Wo(t,null,n,r):_a(e,t,n,r),t.child;case 11:return n=t.type,i=t.pendingProps,Sa(e,t,n,i=t.elementType===n?i:Hi(n,i),r);case 7:return _a(e,t,t.pendingProps,r),t.child;case 8:case 12:return _a(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(n=t.type._context,i=t.pendingProps,s=t.memoizedProps,a=i.value,Ri(zi,n._currentValue),n._currentValue=a,null!==s)if(an(s.value,a)){if(s.children===i.children&&!Pi.current){t=Ha(e,t,r);break e}}else for(null!==(s=t.child)&&(s.return=t);null!==s;){var c=s.dependencies;if(null!==c){a=s.child;for(var u=c.firstContext;null!==u;){if(u.context===n){if(1===s.tag){(u=io(-1,r&-r)).tag=2;var l=s.updateQueue;if(null!==l){var d=(l=l.shared).pending;null===d?u.next=u:(u.next=d.next,d.next=u),l.pending=u}}s.lanes|=r,null!==(u=s.alternate)&&(u.lanes|=r),Ji(s.return,r,t),c.lanes|=r;break}u=u.next}}else if(10===s.tag)a=s.type===t.type?null:s.child;else if(18===s.tag){if(null===(a=s.return))throw Error(o(341));a.lanes|=r,null!==(c=a.alternate)&&(c.lanes|=r),Ji(a,r,t),a=s.sibling}else a=s.child;if(null!==a)a.return=s;else for(a=s;null!==a;){if(a===t){a=null;break}if(null!==(s=a.sibling)){s.return=a.return,a=s;break}a=a.return}s=a}_a(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,_a(e,t,n,r),t.child;case 14:return i=Hi(n=t.type,t.pendingProps),Ia(e,t,n,i=Hi(n.type,i),r);case 15:return Aa(e,t,t.type,t.pendingProps,r);case 17:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Hi(n,i),null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),t.tag=1,Ni(n)?(e=!0,Li(t)):e=!1,$i(t,r),yo(t,n,i),mo(t,n,i,r),ka(null,t,n,!0,e,r);case 19:return qa(e,t,r);case 22:return Ra(e,t,r)}throw Error(o(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 Xu(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType)}function Ju(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 o=r._reactRootContainer;if(o){var s=o;if("function"===typeof i){var a=i;i=function(){var e=Hu(s);a.call(e)}}qu(t,s,e,i)}else s=function(e,t,r,n,i){if(i){if("function"===typeof n){var o=n;n=function(){var e=Hu(s);o.call(e)}}var s=Vu(t,n,e,0,null,!1,0,"",$u);return e._reactRootContainer=s,e[pi]=s.current,Vn(8===e.nodeType?e.parentNode:e),uu(),s}for(;i=e.lastChild;)e.removeChild(i);if("function"===typeof n){var a=n;n=function(){var e=Hu(c);a.call(e)}}var c=ju(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 Hu(s)}Qu.prototype.render=Yu.prototype.render=function(e){var t=this._internalRoot;if(null===t)throw Error(o(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<Dt.length&&0!==t&&t<Dt[r].priority;r++);Dt.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=dt(t.pendingLanes);0!==r&&(bt(t,1|r),ru(t,Je()),0===(6&Ac)&&(jc=Je()+500,Vi()))}break;case 13:var n=Jc();uu((function(){return Zc(e,1,n)})),Gu(e,1)}},_t=function(e){13===e.tag&&(Zc(e,134217728,Jc()),Gu(e,134217728))},St=function(e){if(13===e.tag){var t=Jc(),r=$c(e);Zc(e,r,t),Gu(e,r)}},It=function(){return vt},At=function(e,t){var r=vt;try{return vt=e,t()}finally{vt=r}},_e=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(o(90));W(n),$(n,i)}}}break;case"textarea":oe(e,r);break;case"select":null!=(t=r.value)&&re(e,!!r.multiple,t,!1)}},Ce=cu,Pe=uu;var el={usingClientEntryPoint:!1,Events:[vi,wi,Ei,Re,Te,cu]},tl={findFiberByHostInstance:bi,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=ze(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),ot=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(!Xu(t))throw Error(o(200));return Ku(e,t,null,r)},t.createRoot=function(e,t){if(!Xu(e))throw Error(o(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=ju(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(o(188));throw e=Object.keys(e).join(","),Error(o(268,e))}return e=null===(e=ze(t))?null:e.stateNode},t.flushSync=function(e){return uu(e)},t.hydrate=function(e,t,r){if(!Ju(t))throw Error(o(200));return Zu(null,e,t,!0,r)},t.hydrateRoot=function(e,t,r){if(!Xu(e))throw Error(o(405));var n=null!=r&&r.hydratedSources||null,i=!1,s="",a=Wu;if(null!==r&&void 0!==r&&(!0===r.unstable_strictMode&&(i=!0),void 0!==r.identifierPrefix&&(s=r.identifierPrefix),void 0!==r.onRecoverableError&&(a=r.onRecoverableError)),t=Vu(t,null,e,1,null!=r?r:null,i,0,s,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(!Ju(t))throw Error(o(200));return Zu(null,e,t,!1,r)},t.unmountComponentAtNode=function(e){if(!Ju(e))throw Error(o(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(!Ju(r))throw Error(o(200));if(null==e||void 0===e._reactInternals)throw Error(o(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"),o=Symbol.for("react.fragment"),s=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,o={},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)s.call(t,n)&&!c.hasOwnProperty(n)&&(o[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps)void 0===o[n]&&(o[n]=t[n]);return{$$typeof:i,type:e,key:u,ref:l,props:o,_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"),o=Symbol.for("react.strict_mode"),s=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"),d=Symbol.for("react.memo"),h=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 b(){}function v(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")},b.prototype=m.prototype;var w=v.prototype=new b;w.constructor=v,y(w,m.prototype),w.isPureReactComponent=!0;var E=Array.isArray,_=Object.prototype.hasOwnProperty,S={current:null},I={key:!0,ref:!0,__self:!0,__source:!0};function A(e,t,n){var i,o={},s=null,a=null;if(null!=t)for(i in void 0!==t.ref&&(a=t.ref),void 0!==t.key&&(s=""+t.key),t)_.call(t,i)&&!I.hasOwnProperty(i)&&(o[i]=t[i]);var c=arguments.length-2;if(1===c)o.children=n;else if(1<c){for(var u=Array(c),l=0;l<c;l++)u[l]=arguments[l+2];o.children=u}if(e&&e.defaultProps)for(i in c=e.defaultProps)void 0===o[i]&&(o[i]=c[i]);return{$$typeof:r,type:e,key:s,ref:a,props:o,_owner:S.current}}function R(e){return"object"===typeof e&&null!==e&&e.$$typeof===r}var T=/\/+/g;function C(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,o,s){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 s=s(c=e),e=""===o?"."+C(c,0):o,E(s)?(i="",null!=e&&(i=e.replace(T,"$&/")+"/"),P(s,t,i,"",(function(e){return e}))):null!=s&&(R(s)&&(s=function(e,t){return{$$typeof:r,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(s,i+(!s.key||c&&c.key===s.key?"":(""+s.key).replace(T,"$&/")+"/")+e)),t.push(s)),1;if(c=0,o=""===o?".":o+":",E(e))for(var u=0;u<e.length;u++){var l=o+C(a=e[u],u);c+=P(a,t,i,l,s)}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=o+C(a,u++),s);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 N={current:null},D={transition:null},B={ReactCurrentDispatcher:N,ReactCurrentBatchConfig:D,ReactCurrentOwner:S};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(!R(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},t.Component=m,t.Fragment=i,t.Profiler=s,t.PureComponent=v,t.StrictMode=o,t.Suspense=l,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=B,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),o=e.key,s=e.ref,a=e._owner;if(null!=t){if(void 0!==t.ref&&(s=t.ref,a=S.current),void 0!==t.key&&(o=""+t.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(u in t)_.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:o,ref:s,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=A,t.createFactory=function(e){var t=A.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=R,t.lazy=function(e){return{$$typeof:h,_payload:{_status:-1,_result:e},_init:O}},t.memo=function(e,t){return{$$typeof:d,type:e,compare:void 0===t?null:t}},t.startTransition=function(e){var t=D.transition;D.transition={};try{e()}finally{D.transition=t}},t.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")},t.useCallback=function(e,t){return N.current.useCallback(e,t)},t.useContext=function(e){return N.current.useContext(e)},t.useDebugValue=function(){},t.useDeferredValue=function(e){return N.current.useDeferredValue(e)},t.useEffect=function(e,t){return N.current.useEffect(e,t)},t.useId=function(){return N.current.useId()},t.useImperativeHandle=function(e,t,r){return N.current.useImperativeHandle(e,t,r)},t.useInsertionEffect=function(e,t){return N.current.useInsertionEffect(e,t)},t.useLayoutEffect=function(e,t){return N.current.useLayoutEffect(e,t)},t.useMemo=function(e,t){return N.current.useMemo(e,t)},t.useReducer=function(e,t,r){return N.current.useReducer(e,t,r)},t.useRef=function(e){return N.current.useRef(e)},t.useState=function(e){return N.current.useState(e)},t.useSyncExternalStore=function(e,t,r){return N.current.useSyncExternalStore(e,t,r)},t.useTransition=function(){return N.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=s;var n=r(78193),i=s.prototype,o=new Date%1e9;function s(e){e=e||{},this.id=e.id||(1e9*Math.random()>>>0)+o++,this.max=e.max||1/0,this.items=e.items||[],this._lookup={},this.size=this.items.length,this.lastModified=new Date(e.lastModified||new Date);for(var t,r,n=this.items.length;n--;)t=this.items[n],r=new Date(t.expires)-new Date,this._lookup[t.key]=t,r>0?this.expire(t.key,r):r<=0&&this.delete(t.key)}i.has=function(e){return e in this._lookup},i.get=function(e){if(!this.has(e))return null;var t=this._lookup[e];return t.refresh&&this.expire(e,t.refresh),this.items.splice(this.items.indexOf(t),1),this.items.push(t),t.value},i.meta=function(e){if(!this.has(e))return null;var t=this._lookup[e];return"meta"in t?t.meta:null},i.set=function(e,t,r){var n=this._lookup[e],i=this._lookup[e]={key:e,value:t};return this.lastModified=new Date,n?(clearTimeout(n.timeout),this.items.splice(this.items.indexOf(n),1,i)):(this.size>=this.max&&this.delete(this.items[0].key),this.items.push(i),this.size++),r&&("ttl"in r&&this.expire(e,r.ttl),"meta"in r&&(i.meta=r.meta),r.refresh&&(i.refresh=r.ttl)),this},i.delete=function(e){var t=this._lookup[e];return!!t&&(this.lastModified=new Date,this.items.splice(this.items.indexOf(t),1),clearTimeout(t.timeout),delete this._lookup[e],this.size--,this)},i.expire=function(e,t){var r=t||0,i=this._lookup[e];if(!i)return this;if("string"===typeof r&&(r=n(t)),"number"!==typeof r)throw new TypeError("Expiration time must be a string or number.");return clearTimeout(i.timeout),i.timeout=setTimeout(this.delete.bind(this,i.key),r),i.expires=Number(new Date)+r,this},i.clear=function(){for(var e=this.items.length;e--;)this.delete(this.items[e].key);return this},i.toJSON=function(){for(var e,t=new Array(this.items.length),r=t.length;r--;)e=this.items[r],t[r]={key:e.key,meta:e.meta,value:e.value,expires:e.expires,refresh:e.refresh};return{id:this.id,max:isFinite(this.max)?this.max:void 0,lastModified:this.lastModified,items:t}}},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 o=0;o<n.length;o++){var s=n[o],a=e[s];e[s]=function(n){var i=t.operation(r),o=Array.prototype.slice.call(arguments,1),s=o.pop();o.push((function(e){i.retry(e)||(e&&(arguments[0]=i.mainError()),s.apply(this,arguments))})),i.attempt((function(){n.apply(e,o)}))}.bind(e,a),e[s].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],o=i.message,s=(e[o]||0)+1;e[o]=s,s>=r&&(t=i,r=s)}return t}},6327:(e,t,r)=>{"use strict";var n=r(60206),i=/[\/\?<>\\:\*\|"]/g,o=/[\x00-\x1f\x80-\x9f]/g,s=/^\.+$/,a=/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i,c=/[\. ]+$/;function u(e,t){if("string"!==typeof e)throw new Error("Input must be string");var r=e.replace(i,t).replace(o,t).replace(s,t).replace(a,t).replace(c,t);return n(r,255)}e.exports=function(e,t){var r=t&&t.replacement||"",n=u(e,r);return""===r?n:u(n,"")}},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<o(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,s=i>>>1;n<s;){var a=2*(n+1)-1,c=e[a],u=a+1,l=e[u];if(0>o(c,r))u<i&&0>o(l,c)?(e[n]=l,e[u]=r,n=u):(e[n]=c,e[a]=r,n=a);else{if(!(u<i&&0>o(l,r)))break e;e[n]=l,e[u]=r,n=u}}}return t}function o(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 s=performance;t.unstable_now=function(){return s.now()}}else{var a=Date,c=a.now();t.unstable_now=function(){return a.now()-c}}var u=[],l=[],d=1,h=null,f=3,p=!1,y=!1,g=!1,m="function"===typeof setTimeout?setTimeout:null,b="function"===typeof clearTimeout?clearTimeout:null,v="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,D(_);else{var t=n(l);null!==t&&B(E,t.startTime-e)}}function _(e,r){y=!1,g&&(g=!1,b(R),R=-1),p=!0;var o=f;try{for(w(r),h=n(u);null!==h&&(!(h.expirationTime>r)||e&&!P());){var s=h.callback;if("function"===typeof s){h.callback=null,f=h.priorityLevel;var a=s(h.expirationTime<=r);r=t.unstable_now(),"function"===typeof a?h.callback=a:h===n(u)&&i(u),w(r)}else i(u);h=n(u)}if(null!==h)var c=!0;else{var d=n(l);null!==d&&B(E,d.startTime-r),c=!1}return c}finally{h=null,f=o,p=!1}}"undefined"!==typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var S,I=!1,A=null,R=-1,T=5,C=-1;function P(){return!(t.unstable_now()-C<T)}function k(){if(null!==A){var e=t.unstable_now();C=e;var r=!0;try{r=A(!0,e)}finally{r?S():(I=!1,A=null)}}else I=!1}if("function"===typeof v)S=function(){v(k)};else if("undefined"!==typeof MessageChannel){var O=new MessageChannel,N=O.port2;O.port1.onmessage=k,S=function(){N.postMessage(null)}}else S=function(){m(k,0)};function D(e){A=e,I||(I=!0,S())}function B(e,r){R=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,D(_))},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"):T=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,o){var s=t.unstable_now();switch("object"===typeof o&&null!==o?o="number"===typeof(o=o.delay)&&0<o?s+o:s:o=s,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:d++,callback:i,priorityLevel:e,startTime:o,expirationTime:a=o+a,sortIndex:-1},o>s?(e.sortIndex=o,r(l,e),null===n(u)&&e===n(l)&&(g?(b(R),R=-1):g=!0,B(E,o-s))):(e.sortIndex=a,r(u,e),y||p||(y=!0,D(_))),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())),o=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,o),i},clearDelayedInterval:function(e){const r=t.get(e);r&&(clearTimeout(r),t.delete(e))}}},16872:(e,t,r)=>{var n=r(62175);t.encode=function e(t,r,i){t=t>=0?2*t:-2*t-1;var o=n.encode(t,r,i);return e.bytes=n.encode.bytes,o},t.decode=function e(t,r){var i=n.decode(t,r);return e.bytes=n.decode.bytes,1&i?(i+1)/-2:i/2},t.encodingLength=function(e){return n.encodingLength(e>=0?2*e:-2*e-1)}},14987:e=>{e.exports=function e(t,r){var n,i=0,o=0,s=r=r||0,a=t.length;do{if(s>=a)throw e.bytes=0,new RangeError("Could not decode varint");n=t[s++],i+=o<28?(127&n)<<o:(127&n)*Math.pow(2,o),o+=7}while(n>=128);return e.bytes=s-r,i}},8684:e=>{e.exports=function e(r,n,i){n=n||[];var o=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-o+1,n};var t=Math.pow(2,31)},62175:(e,t,r)=>{e.exports={encode:r(8684),decode:r(14987),encodingLength:r(92614)}},92614:e=>{var t=Math.pow(2,7),r=Math.pow(2,14),n=Math.pow(2,21),i=Math.pow(2,28),o=Math.pow(2,35),s=Math.pow(2,42),a=Math.pow(2,49),c=Math.pow(2,56),u=Math.pow(2,63);e.exports=function(e){return e<t?1:e<r?2:e<n?3:e<i?4:e<o?5:e<s?6:e<a?7:e<c?8:e<u?9:10}},49372:(e,t,r)=>{var n;!function(){"use strict";var i={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function o(e){return a(u(e),arguments)}function s(e,t){return o.apply(null,[e].concat(t||[]))}function a(e,t){var r,n,s,a,c,u,l,d,h,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],s=0;s<a.keys.length;s++){if(void 0==r)throw new Error(o('[sprintf] Cannot access property "%s" of undefined value "%s"',a.keys[s],a.keys[s-1]));r=r[a.keys[s]]}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(o("[sprintf] expecting number but found %T",r));switch(i.number.test(a.type)&&(d=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)||d&&!a.sign?h="":(h=d?"+":"-",r=r.toString().replace(i.sign,"")),u=a.pad_char?"0"===a.pad_char?"0":a.pad_char.charAt(1):" ",l=a.width-(h+r).length,c=a.width&&l>0?u.repeat(l):"",y+=a.align?h+r+c:"0"===u?h+c+r:c+h+r)}return y}var c=Object.create(null);function u(e){if(c[e])return c[e];for(var t,r=e,n=[],o=0;r;){if(null!==(t=i.text.exec(r)))n.push(t[0]);else if(null!==(t=i.modulo.exec(r)))n.push("%");else{if(null===(t=i.placeholder.exec(r)))throw new SyntaxError("[sprintf] unexpected placeholder");if(t[2]){o|=1;var s=[],a=t[2],u=[];if(null===(u=i.key.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(s.push(u[1]);""!==(a=a.substring(u[0].length));)if(null!==(u=i.key_access.exec(a)))s.push(u[1]);else{if(null===(u=i.index_access.exec(a)))throw new SyntaxError("[sprintf] failed to parse named argument key");s.push(u[1])}t[2]=s}else o|=2;if(3===o)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n.push({placeholder:t[0],param_no:t[1],keys:t[2],sign:t[3],pad_char:t[4],align:t[5],width:t[6],precision:t[7],type:t[8]})}r=r.substring(t[0].length)}return c[e]=n}t.sprintf=o,t.vsprintf=s,"undefined"!==typeof window&&(window.sprintf=o,window.vsprintf=s,void 0===(n=function(){return{sprintf:o,vsprintf:s}}.call(t,r,t,e))||(e.exports=n))}()},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 o=Symbol("TIMEOUT"),s=e=>{let t;return[new Promise((r=>{t=setTimeout((()=>r(o)),e)})),()=>{clearTimeout(t)}]};async function*a(e,t,r){const n=r[Symbol.asyncIterator]();let i,a,c,u=[];const l=()=>{d(),[a,c]=s(t)},d=()=>{c&&c(),a=void 0};for(i=n.next();;){const t=await(a?Promise.race([i,a]):i);if(t===o||t.done){if(u.length&&(yield u,u=[]),d(),t!==o)break}else i=n.next(),u.push(t.value),1===u.length&&l(),u.length!==e||(yield u,u=[],d())}}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 d(e,t){const r=u(t),n=[],i=[];let o=!1,s=!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&&s;){const{resolve:e}=i.shift();e({done:!0,value:void 0})}}async function c(){if(!s&&!o&&!(n.length>=e)){o=!0;try{const{done:e,value:t}=await r.next();e?s=!0:n.push({value:t})}catch(t){s=!0,n.push({error:t})}a(),o=!1,c()}}async function d(){if(n.length>0){const{error:e,value:t}=n.shift();if(e)throw e;return c(),{done:!1,value:t}}if(s)return{done:!0,value:void 0};const e=l();return i.push(e),c(),e.promise}const h={next:d,[Symbol.asyncIterator]:()=>h};return h}function*h(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 o of r)yield o;if(n)throw n}function f(e,t){return void 0===t?t=>f(e,t):0===e?t:t[Symbol.asyncIterator]?d(e,t):h(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 b(){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 v(e){for await(const t of e);}function w(e){if(e[Symbol.asyncIterator])return v(e);for(const t of e);}async function*E(e,t){for await(const r of t)await e(r)&&(yield r)}function _(e,t){return void 0===t?t=>E(e,t):E(e,t)}async function*S(e){for await(const t of e)t&&"string"!==typeof t&&(t[Symbol.iterator]||t[Symbol.asyncIterator])?yield*S(t):yield t}async function*I(e,t){for await(const r of t)yield await e(r)}function A(e,t){return void 0===t?t=>I(e,t):I(e,t)}function R(e,t){return void 0===t?t=>R(e,t):_((e=>void 0!==e&&null!==e),S(A(e,t)))}function T(e,t,r){const n=u(r),i=[],o=[];let s=!1,a=!1,c=0,d=null;function h(){for(;o.length>0&&i.length>0;){const{resolve:e}=o.shift();e({done:!1,value:i.shift()})}for(;o.length>0&&0===c&&s;){const{resolve:e,reject:t}=o.shift();d?(t(d),d=null):e({done:!0,value:void 0})}}async function f(){if(s)h();else if(!a&&!(c+i.length>=e)){a=!0,c++;try{const{done:e,value:t}=await n.next();e?(s=!0,c--,h()):p(t)}catch(t){s=!0,c--,d=t,h()}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){s=!0,d=r}c--,h(),f()}async function y(){if(0===i.length){const e=l();return o.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 C(e,t,r){return void 0===t?(t,r)=>r?C(e,t,r):C(e,t):void 0===r?r=>C(e,t,r):_((e=>void 0!==e&&null!==e),S(T(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*N(){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 D(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 o of n)t=o(t);return t}async function*B(e,t,r){let n=null;const i=e=>({value:t(e)}),o=async function*(e){for await(const t of e){if(n)return;yield t}},s=u(D((()=>r),f(1),o,A(i),f(e-1)));for(;;){const{value:e,done:t}=await s.next();if(t)break;try{const t=await e.value;n||(yield t)}catch(a){n=a}}if(n)throw n}function x(e,t,r){return void 0===t?(t,r)=>x(e,t,r):void 0===r?r=>x(e,t,r):1===e?A(t,r):B(e,t,r)}function L(e,t,r){return void 0===t?(t,r)=>r?L(e,t,r):L(e,t):void 0===r?r=>L(e,t,r):_((e=>void 0!==e&&null!==e),S(x(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,o=new Map;let s=null,a=null,c=null;const l=e=>{s=e,a&&a(e)},d=e=>{c&&c(e)},h=()=>new Promise(((e,t)=>{if(s&&t(s),o.size>0)return e();c=e,a=t})),f=e=>{const t=Promise.resolve(e.next()).then((async r=>{let{done:n,value:s}=r;n||o.set(e,s),i.delete(t)}));i.add(t),t.then(d,l)};for(const u of n)f(u);for(;;){if(0===i.size&&0===o.size)return;await h();for(const[e,t]of o)o.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 j(e,t,r){return void 0===t?(t,r)=>r?U(e,t,r):j(e,t):void 0===r?r=>j(e,t,r):U(e,t,r)}async function*K(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]?K(e,t):F(e,t)}async function*q(e,t){for await(const r of t)await e(r),yield r}function H(e,t){return void 0===t?t=>q(e,t):q(e,t)}const z=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 o of r){if(i<e){"undefined"===typeof n&&(n=Date.now()),i++,yield o;continue}const r=Date.now()-n,s=t-r;s>0&&await z(s),n=Date.now(),i=1,yield o}}()}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:o,done:s}=await r.next(),a=n.hrtime(t);if(i=Y(i,a),e.progress&&e.progress(a,i),s)return e.total&&e.total(i),o;yield o}}function*X(e,t){const r=t[Symbol.iterator]();let i=[0,0];for(;;){const t=n.hrtime(),{value:o,done:s}=r.next(),a=n.hrtime(t);if(i=Y(i,a),e.progress&&e.progress(a,i),s)return e.total&&e.total(i),o;yield o}}function J(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return void 0===t?t=>J(e,t):void 0!==t[Symbol.asyncIterator]?Q(e,t):X(e,t)}function $(e,t,r){const n=u(r),i=[],o=[];let s=!1,a=!1,c=0,d=null;function h(){for(;o.length>0&&i.length>0;){const{resolve:e}=o.shift();e({done:!1,value:i.shift()})}for(;o.length>0&&0===c&&s;){const{resolve:e,reject:t}=o.shift();d?(t(d),d=null):e({done:!0,value:void 0})}}async function f(){if(s)h();else if(!a&&!(c+i.length>=e)){a=!0,c++;try{const{done:e,value:t}=await n.next();e?(s=!0,c--,h()):p(t)}catch(t){s=!0,c--,d=t,h()}a=!1,f()}}async function p(e){try{const r=await t(e);i.push(r)}catch(r){s=!0,d=r}c--,h(),f()}async function y(){if(0===i.length){const e=l();return o.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 o=e=>{r=e,n&&n(e)},s=()=>{i&&i()},a=()=>{e.removeListener("error",o),e.removeListener("drain",s)};e.once("error",o);const c=()=>new Promise(((t,o)=>{if(r)return o(r);e.once("drain",s),i=t,n=o}));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=b,e.consume=w,e.filter=_,e.flatMap=R,e.flatTransform=C,e.flatten=S,e.fromStream=O,e.getIterator=u,e.map=A,e.merge=N,e.parallelFlatMap=L,e.parallelMap=x,e.parallelMerge=M,e.pipeline=D,e.reduce=j,e.take=V,e.tap=H,e.throttle=W,e.time=J,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 o extends n{constructor(e){super(),this._ms=e,this._timer=i((()=>this.abort()),e),Object.setPrototypeOf(this,o.prototype)}abort(){return this._timer.clear(),super.abort()}clear(){this._timer.clear()}reset(){this._timer.clear(),this._timer=i((()=>this.abort()),this._ms)}}e.exports={TimeoutController:o}},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 o,s,a=n.length,c=0,u=0;u<a;u+=1){if(o=n.charCodeAt(u),s=n[u],t(o)&&r(n.charCodeAt(u+1))&&(s+=n[u+=1]),(c+=e(s))===i)return n.slice(0,u+1);if(c>i)return n.slice(0,u-s.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,o=null,s=null,a=0;a<n;a++)r(o=e.charCodeAt(a))?null!=s&&t(s)?i+=1:i+=3:o<=127?i+=1:o>=128&&o<=2047?i+=2:o>=2048&&o<=65535&&(i+=3),s=o;return i}},6794:e=>{e.exports=function(e){return e&&"object"===typeof e&&"function"===typeof e.copy&&"function"===typeof e.fill&&"function"===typeof e.readUInt8}},87374:(e,t,r)=>{"use strict";var n=r(65450),i=r(85718),o=r(58264),s=r(66218);function a(e){return e.call.bind(e)}var c="undefined"!==typeof BigInt,u="undefined"!==typeof Symbol,l=a(Object.prototype.toString),d=a(Number.prototype.valueOf),h=a(String.prototype.valueOf),f=a(Boolean.prototype.valueOf);if(c)var p=a(BigInt.prototype.valueOf);if(u)var y=a(Symbol.prototype.valueOf);function g(e,t){if("object"!==typeof e)return!1;try{return t(e),!0}catch(r){return!1}}function m(e){return"[object Map]"===l(e)}function b(e){return"[object Set]"===l(e)}function v(e){return"[object WeakMap]"===l(e)}function w(e){return"[object WeakSet]"===l(e)}function E(e){return"[object ArrayBuffer]"===l(e)}function _(e){return"undefined"!==typeof ArrayBuffer&&(E.working?E(e):e instanceof ArrayBuffer)}function S(e){return"[object DataView]"===l(e)}function I(e){return"undefined"!==typeof DataView&&(S.working?S(e):e instanceof DataView)}t.isArgumentsObject=n,t.isGeneratorFunction=i,t.isTypedArray=s,t.isPromise=function(e){return"undefined"!==typeof Promise&&e instanceof Promise||null!==e&&"object"===typeof e&&"function"===typeof e.then&&"function"===typeof e.catch},t.isArrayBufferView=function(e){return"undefined"!==typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):s(e)||I(e)},t.isUint8Array=function(e){return"Uint8Array"===o(e)},t.isUint8ClampedArray=function(e){return"Uint8ClampedArray"===o(e)},t.isUint16Array=function(e){return"Uint16Array"===o(e)},t.isUint32Array=function(e){return"Uint32Array"===o(e)},t.isInt8Array=function(e){return"Int8Array"===o(e)},t.isInt16Array=function(e){return"Int16Array"===o(e)},t.isInt32Array=function(e){return"Int32Array"===o(e)},t.isFloat32Array=function(e){return"Float32Array"===o(e)},t.isFloat64Array=function(e){return"Float64Array"===o(e)},t.isBigInt64Array=function(e){return"BigInt64Array"===o(e)},t.isBigUint64Array=function(e){return"BigUint64Array"===o(e)},m.working="undefined"!==typeof Map&&m(new Map),t.isMap=function(e){return"undefined"!==typeof Map&&(m.working?m(e):e instanceof Map)},b.working="undefined"!==typeof Set&&b(new Set),t.isSet=function(e){return"undefined"!==typeof Set&&(b.working?b(e):e instanceof Set)},v.working="undefined"!==typeof WeakMap&&v(new WeakMap),t.isWeakMap=function(e){return"undefined"!==typeof WeakMap&&(v.working?v(e):e instanceof WeakMap)},w.working="undefined"!==typeof WeakSet&&w(new WeakSet),t.isWeakSet=function(e){return w(e)},E.working="undefined"!==typeof ArrayBuffer&&E(new ArrayBuffer),t.isArrayBuffer=_,S.working="undefined"!==typeof ArrayBuffer&&"undefined"!==typeof DataView&&S(new DataView(new ArrayBuffer(1),0,1)),t.isDataView=I;var A="undefined"!==typeof SharedArrayBuffer?SharedArrayBuffer:void 0;function R(e){return"[object SharedArrayBuffer]"===l(e)}function T(e){return"undefined"!==typeof A&&("undefined"===typeof R.working&&(R.working=R(new A)),R.working?R(e):e instanceof A)}function C(e){return g(e,d)}function P(e){return g(e,h)}function k(e){return g(e,f)}function O(e){return c&&g(e,p)}function N(e){return u&&g(e,y)}t.isSharedArrayBuffer=T,t.isAsyncFunction=function(e){return"[object AsyncFunction]"===l(e)},t.isMapIterator=function(e){return"[object Map Iterator]"===l(e)},t.isSetIterator=function(e){return"[object Set Iterator]"===l(e)},t.isGeneratorObject=function(e){return"[object Generator]"===l(e)},t.isWebAssemblyCompiledModule=function(e){return"[object WebAssembly.Module]"===l(e)},t.isNumberObject=C,t.isStringObject=P,t.isBooleanObject=k,t.isBigIntObject=O,t.isSymbolObject=N,t.isBoxedPrimitive=function(e){return C(e)||P(e)||k(e)||O(e)||N(e)},t.isAnyArrayBuffer=function(e){return"undefined"!==typeof Uint8Array&&(_(e)||T(e))},["isProxy","isExternal","isModuleNamespaceObject"].forEach((function(e){Object.defineProperty(t,e,{enumerable:!1,value:function(){throw new Error(e+" is not supported in userland")}})}))},49639:(e,t,r)=>{var n=r(21964),i=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),r={},n=0;n<t.length;n++)r[t[n]]=Object.getOwnPropertyDescriptor(e,t[n]);return r},o=/%[sdj%]/g;t.format=function(e){if(!v(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(u(arguments[r]));return t.join(" ")}r=1;for(var n=arguments,i=n.length,s=String(e).replace(o,(function(e){if("%%"===e)return"%";if(r>=i)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return e}})),a=n[r];r<i;a=n[++r])m(a)||!_(a)?s+=" "+a:s+=" "+u(a);return s},t.deprecate=function(e,r){if("undefined"!==typeof n&&!0===n.noDeprecation)return e;if("undefined"===typeof n)return function(){return t.deprecate(e,r).apply(this,arguments)};var i=!1;return function(){if(!i){if(n.throwDeprecation)throw new Error(r);n.traceDeprecation?console.trace(r):console.error(r),i=!0}return e.apply(this,arguments)}};var s={},a=/^$/;if({NODE_ENV:"production",PUBLIC_URL:"/examples/store-reactjs-chat",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0}.NODE_DEBUG){var c={NODE_ENV:"production",PUBLIC_URL:"/examples/store-reactjs-chat",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0}.NODE_DEBUG;c=c.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),a=new RegExp("^"+c+"$","i")}function u(e,r){var n={seen:[],stylize:d};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),g(r)?n.showHidden=r:r&&t._extend(n,r),w(n.showHidden)&&(n.showHidden=!1),w(n.depth)&&(n.depth=2),w(n.colors)&&(n.colors=!1),w(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=l),h(n,e,n.depth)}function l(e,t){var r=u.styles[t];return r?"\x1b["+u.colors[r][0]+"m"+e+"\x1b["+u.colors[r][1]+"m":e}function d(e,t){return e}function h(e,r,n){if(e.customInspect&&r&&A(r.inspect)&&r.inspect!==t.inspect&&(!r.constructor||r.constructor.prototype!==r)){var i=r.inspect(n,e);return v(i)||(i=h(e,i,n)),i}var o=function(e,t){if(w(t))return e.stylize("undefined","undefined");if(v(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(b(t))return e.stylize(""+t,"number");if(g(t))return e.stylize(""+t,"boolean");if(m(t))return e.stylize("null","null")}(e,r);if(o)return o;var s=Object.keys(r),a=function(e){var t={};return e.forEach((function(e,r){t[e]=!0})),t}(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(r)),I(r)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return f(r);if(0===s.length){if(A(r)){var c=r.name?": "+r.name:"";return e.stylize("[Function"+c+"]","special")}if(E(r))return e.stylize(RegExp.prototype.toString.call(r),"regexp");if(S(r))return e.stylize(Date.prototype.toString.call(r),"date");if(I(r))return f(r)}var u,l="",d=!1,_=["{","}"];(y(r)&&(d=!0,_=["[","]"]),A(r))&&(l=" [Function"+(r.name?": "+r.name:"")+"]");return E(r)&&(l=" "+RegExp.prototype.toString.call(r)),S(r)&&(l=" "+Date.prototype.toUTCString.call(r)),I(r)&&(l=" "+f(r)),0!==s.length||d&&0!=r.length?n<0?E(r)?e.stylize(RegExp.prototype.toString.call(r),"regexp"):e.stylize("[Object]","special"):(e.seen.push(r),u=d?function(e,t,r,n,i){for(var o=[],s=0,a=t.length;s<a;++s)k(t,String(s))?o.push(p(e,t,r,n,String(s),!0)):o.push("");return i.forEach((function(i){i.match(/^\d+$/)||o.push(p(e,t,r,n,i,!0))})),o}(e,r,n,a,s):s.map((function(t){return p(e,r,n,a,t,d)})),e.seen.pop(),function(e,t,r){if(e.reduce((function(e,t){return t.indexOf("\n")>=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1];return r[0]+t+" "+e.join(", ")+" "+r[1]}(u,l,_)):_[0]+l+_[1]}function f(e){return"["+Error.prototype.toString.call(e)+"]"}function p(e,t,r,n,i,o){var s,a,c;if((c=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?a=c.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):c.set&&(a=e.stylize("[Setter]","special")),k(n,i)||(s="["+i+"]"),a||(e.seen.indexOf(c.value)<0?(a=m(r)?h(e,c.value,null):h(e,c.value,r-1)).indexOf("\n")>-1&&(a=o?a.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+a.split("\n").map((function(e){return" "+e})).join("\n")):a=e.stylize("[Circular]","special")),w(s)){if(o&&i.match(/^\d+$/))return a;(s=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function y(e){return Array.isArray(e)}function g(e){return"boolean"===typeof e}function m(e){return null===e}function b(e){return"number"===typeof e}function v(e){return"string"===typeof e}function w(e){return void 0===e}function E(e){return _(e)&&"[object RegExp]"===R(e)}function _(e){return"object"===typeof e&&null!==e}function S(e){return _(e)&&"[object Date]"===R(e)}function I(e){return _(e)&&("[object Error]"===R(e)||e instanceof Error)}function A(e){return"function"===typeof e}function R(e){return Object.prototype.toString.call(e)}function T(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(e){if(e=e.toUpperCase(),!s[e])if(a.test(e)){var r=n.pid;s[e]=function(){var n=t.format.apply(t,arguments);console.error("%s %d: %s",e,r,n)}}else s[e]=function(){};return s[e]},t.inspect=u,u.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},u.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.types=r(87374),t.isArray=y,t.isBoolean=g,t.isNull=m,t.isNullOrUndefined=function(e){return null==e},t.isNumber=b,t.isString=v,t.isSymbol=function(e){return"symbol"===typeof e},t.isUndefined=w,t.isRegExp=E,t.types.isRegExp=E,t.isObject=_,t.isDate=S,t.types.isDate=S,t.isError=I,t.types.isNativeError=I,t.isFunction=A,t.isPrimitive=function(e){return null===e||"boolean"===typeof e||"number"===typeof e||"string"===typeof e||"symbol"===typeof e||"undefined"===typeof e},t.isBuffer=r(6794);var C=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function P(){var e=new Date,t=[T(e.getHours()),T(e.getMinutes()),T(e.getSeconds())].join(":");return[e.getDate(),C[e.getMonth()],t].join(" ")}function k(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",P(),t.format.apply(t,arguments))},t.inherits=r(12534),t._extend=function(e,t){if(!t||!_(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e};var O="undefined"!==typeof Symbol?Symbol("util.promisify.custom"):void 0;function N(e,t){if(!e){var r=new Error("Promise was rejected with a falsy value");r.reason=e,e=r}return t(e)}t.promisify=function(e){if("function"!==typeof e)throw new TypeError('The "original" argument must be of type Function');if(O&&e[O]){var t;if("function"!==typeof(t=e[O]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,O,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,r,n=new Promise((function(e,n){t=e,r=n})),i=[],o=0;o<arguments.length;o++)i.push(arguments[o]);i.push((function(e,n){e?r(e):t(n)}));try{e.apply(this,i)}catch(s){r(s)}return n}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),O&&Object.defineProperty(t,O,{value:t,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(t,i(e))},t.promisify.custom=O,t.callbackify=function(e){if("function"!==typeof e)throw new TypeError('The "original" argument must be of type Function');function t(){for(var t=[],r=0;r<arguments.length;r++)t.push(arguments[r]);var i=t.pop();if("function"!==typeof i)throw new TypeError("The last argument must be of type Function");var o=this,s=function(){return i.apply(o,arguments)};e.apply(this,t).then((function(e){n.nextTick(s.bind(null,null,e))}),(function(e){n.nextTick(N.bind(null,e,s))}))}return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),Object.defineProperties(t,i(e)),t}},75658:(e,t,r)=>{"use strict";var n;r.r(t),r.d(t,{NIL:()=>N,parse:()=>g,stringify:()=>l,v1:()=>y,v3:()=>R,v4:()=>T,v5:()=>O,validate:()=>a,version:()=>D});var i=new Uint8Array(16);function o(){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 s=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const a=function(e){return"string"===typeof e&&s.test(e)};for(var c=[],u=0;u<256;++u)c.push((u+256).toString(16).substr(1));const 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 d,h,f=0,p=0;const y=function(e,t,r){var n=t&&r||0,i=t||new Array(16),s=(e=e||{}).node||d,a=void 0!==e.clockseq?e.clockseq:h;if(null==s||null==a){var c=e.random||(e.rng||o)();null==s&&(s=d=[1|c[0],c[1],c[2],c[3],c[4],c[5]]),null==a&&(a=h=16383&(c[6]<<8|c[7]))}var u=void 0!==e.msecs?e.msecs:Date.now(),y=void 0!==e.nsecs?e.nsecs:p+1,g=u-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,h=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 b=u/4294967296*1e4&268435455;i[n++]=b>>>8&255,i[n++]=255&b,i[n++]=b>>>24&15|16,i[n++]=b>>>16&255,i[n++]=a>>>8|128,i[n++]=255&a;for(var v=0;v<6;++v)i[n+v]=s[v];return t||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,o){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 s=new Uint8Array(16+e.length);if(s.set(n),s.set(e,n.length),(s=r(s))[6]=15&s[6]|t,s[8]=63&s[8]|128,i){o=o||0;for(var a=0;a<16;++a)i[o+a]=s[a];return i}return l(s)}try{n.name=e}catch(i){}return n.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",n.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",n}function b(e){return 14+(e+64>>>9<<4)+1}function v(e,t){var r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function w(e,t,r,n,i,o){return v((s=v(v(t,e),v(n,o)))<<(a=i)|s>>>32-a,r);var s,a}function E(e,t,r,n,i,o,s){return w(t&r|~t&n,e,t,i,o,s)}function _(e,t,r,n,i,o,s){return w(t&n|r&~n,e,t,i,o,s)}function S(e,t,r,n,i,o,s){return w(t^r^n,e,t,i,o,s)}function I(e,t,r,n,i,o,s){return w(r^(t|~n),e,t,i,o,s)}const A=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 o=e[i>>5]>>>i%32&255,s=parseInt(n.charAt(o>>>4&15)+n.charAt(15&o),16);t.push(s)}return t}(function(e,t){e[t>>5]|=128<<t%32,e[b(t)-1]=t;for(var r=1732584193,n=-271733879,i=-1732584194,o=271733878,s=0;s<e.length;s+=16){var a=r,c=n,u=i,l=o;r=E(r,n,i,o,e[s],7,-680876936),o=E(o,r,n,i,e[s+1],12,-389564586),i=E(i,o,r,n,e[s+2],17,606105819),n=E(n,i,o,r,e[s+3],22,-1044525330),r=E(r,n,i,o,e[s+4],7,-176418897),o=E(o,r,n,i,e[s+5],12,1200080426),i=E(i,o,r,n,e[s+6],17,-1473231341),n=E(n,i,o,r,e[s+7],22,-45705983),r=E(r,n,i,o,e[s+8],7,1770035416),o=E(o,r,n,i,e[s+9],12,-1958414417),i=E(i,o,r,n,e[s+10],17,-42063),n=E(n,i,o,r,e[s+11],22,-1990404162),r=E(r,n,i,o,e[s+12],7,1804603682),o=E(o,r,n,i,e[s+13],12,-40341101),i=E(i,o,r,n,e[s+14],17,-1502002290),r=_(r,n=E(n,i,o,r,e[s+15],22,1236535329),i,o,e[s+1],5,-165796510),o=_(o,r,n,i,e[s+6],9,-1069501632),i=_(i,o,r,n,e[s+11],14,643717713),n=_(n,i,o,r,e[s],20,-373897302),r=_(r,n,i,o,e[s+5],5,-701558691),o=_(o,r,n,i,e[s+10],9,38016083),i=_(i,o,r,n,e[s+15],14,-660478335),n=_(n,i,o,r,e[s+4],20,-405537848),r=_(r,n,i,o,e[s+9],5,568446438),o=_(o,r,n,i,e[s+14],9,-1019803690),i=_(i,o,r,n,e[s+3],14,-187363961),n=_(n,i,o,r,e[s+8],20,1163531501),r=_(r,n,i,o,e[s+13],5,-1444681467),o=_(o,r,n,i,e[s+2],9,-51403784),i=_(i,o,r,n,e[s+7],14,1735328473),r=S(r,n=_(n,i,o,r,e[s+12],20,-1926607734),i,o,e[s+5],4,-378558),o=S(o,r,n,i,e[s+8],11,-2022574463),i=S(i,o,r,n,e[s+11],16,1839030562),n=S(n,i,o,r,e[s+14],23,-35309556),r=S(r,n,i,o,e[s+1],4,-1530992060),o=S(o,r,n,i,e[s+4],11,1272893353),i=S(i,o,r,n,e[s+7],16,-155497632),n=S(n,i,o,r,e[s+10],23,-1094730640),r=S(r,n,i,o,e[s+13],4,681279174),o=S(o,r,n,i,e[s],11,-358537222),i=S(i,o,r,n,e[s+3],16,-722521979),n=S(n,i,o,r,e[s+6],23,76029189),r=S(r,n,i,o,e[s+9],4,-640364487),o=S(o,r,n,i,e[s+12],11,-421815835),i=S(i,o,r,n,e[s+15],16,530742520),r=I(r,n=S(n,i,o,r,e[s+2],23,-995338651),i,o,e[s],6,-198630844),o=I(o,r,n,i,e[s+7],10,1126891415),i=I(i,o,r,n,e[s+14],15,-1416354905),n=I(n,i,o,r,e[s+5],21,-57434055),r=I(r,n,i,o,e[s+12],6,1700485571),o=I(o,r,n,i,e[s+3],10,-1894986606),i=I(i,o,r,n,e[s+10],15,-1051523),n=I(n,i,o,r,e[s+1],21,-2054922799),r=I(r,n,i,o,e[s+8],6,1873313359),o=I(o,r,n,i,e[s+15],10,-30611744),i=I(i,o,r,n,e[s+6],15,-1560198380),n=I(n,i,o,r,e[s+13],21,1309151649),r=I(r,n,i,o,e[s+4],6,-145523070),o=I(o,r,n,i,e[s+11],10,-1120210379),i=I(i,o,r,n,e[s+2],15,718787259),n=I(n,i,o,r,e[s+9],21,-343485551),r=v(r,a),n=v(n,c),i=v(i,u),o=v(o,l)}return[r,n,i,o]}(function(e){if(0===e.length)return[];for(var t=8*e.length,r=new Uint32Array(b(t)),n=0;n<t;n+=8)r[n>>5]|=(255&e[n/8])<<n%32;return r}(e),8*e.length))};const R=m("v3",48,A);const T=function(e,t,r){var n=(e=e||{}).random||(e.rng||o)();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 C(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 o=e.length/4+2,s=Math.ceil(o/16),a=new Array(s),c=0;c<s;++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[s-1][14]=8*(e.length-1)/Math.pow(2,32),a[s-1][14]=Math.floor(a[s-1][14]),a[s-1][15]=8*(e.length-1)&4294967295;for(var d=0;d<s;++d){for(var h=new Uint32Array(80),f=0;f<16;++f)h[f]=a[d][f];for(var p=16;p<80;++p)h[p]=P(h[p-3]^h[p-8]^h[p-14]^h[p-16],1);for(var y=r[0],g=r[1],m=r[2],b=r[3],v=r[4],w=0;w<80;++w){var E=Math.floor(w/20),_=P(y,5)+C(E,g,m,b)+v+t[E]+h[w]>>>0;v=b,b=m,m=P(g,30)>>>0,g=y,y=_}r[0]=r[0]+y>>>0,r[1]=r[1]+g>>>0,r[2]=r[2]+m>>>0,r[3]=r[3]+b>>>0,r[4]=r[4]+v>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,255&r[0],r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,255&r[1],r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,255&r[2],r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,255&r[3],r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,255&r[4]]};const O=m("v5",80,k),N="00000000-0000-0000-0000-000000000000";const D=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,o=0,s=r=r||0,a=t.length;do{if(s>=a||o>49)throw e.bytes=0,new RangeError("Could not decode varint");n=t[s++],i+=o<28?(127&n)<<o:(127&n)*Math.pow(2,o),o+=7}while(n>=128);return e.bytes=s-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 o=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-o+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),o=Math.pow(2,35),s=Math.pow(2,42),a=Math.pow(2,49),c=Math.pow(2,56),u=Math.pow(2,63);e.exports=function(e){return e<t?1:e<r?2:e<n?3:e<i?4:e<o?5:e<s?6:e<a?7:e<c?8:e<u?9:10}},3227:(e,t,r)=>{"use strict";const n=r(82193),i="object"===typeof window&&"object"===typeof document&&9===document.nodeType,o=n(),s=i&&!o,a=o&&!i,c=o&&i,u="undefined"!==typeof globalThis.process&&"undefined"!==typeof globalThis.process.release&&"node"===globalThis.process.release.name&&!o,l="function"===typeof importScripts&&"undefined"!==typeof self&&"undefined"!==typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,d="undefined"!==typeof globalThis.process&&"undefined"!==typeof globalThis.process.env&&"test"===globalThis.process.env.NODE_ENV,h="undefined"!==typeof navigator&&"ReactNative"===navigator.product;e.exports={isTest:d,isElectron:o,isElectronMain:a,isElectronRenderer:c,isNode:u,isBrowser:s,isWebWorker:l,isEnvWithDom:i,isReactNative:h}},58264:(e,t,r)=>{"use strict";var n=r(27910),i=r(30306),o=r(44037),s=o("Object.prototype.toString"),a=r(4707)(),c="undefined"===typeof globalThis?r.g:globalThis,u=i(),l=o("String.prototype.slice"),d={},h=r(40636),f=Object.getPrototypeOf;a&&h&&f&&n(u,(function(e){if("function"===typeof c[e]){var t=new c[e];if(Symbol.toStringTag in t){var r=f(t),n=h(r,Symbol.toStringTag);if(!n){var i=f(r);n=h(i,Symbol.toStringTag)}d[e]=n.get}}}));var p=r(66218);e.exports=function(e){return!!p(e)&&(a&&Symbol.toStringTag in e?function(e){var t=!1;return n(d,(function(r,n){if(!t)try{var i=r.call(e);i===n&&(t=i)}catch(o){}})),t}(e):l(s(e),8,-1))}},21964:e=>{var t,r,n=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"===typeof setTimeout?setTimeout:i}catch(e){t=i}try{r="function"===typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var a,c=[],u=!1,l=-1;function d(){u&&a&&(u=!1,a.length?c=a.concat(c):l=-1,c.length&&h())}function h(){if(!u){var e=s(d);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===o||!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||s(h)},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}},23673:(e,t,r)=>{"use strict";e.exports=r.p+"static/media/index.b082ffde64e037c1b5cd.cjs"},43094:()=>{},69159:()=>{},35883:()=>{},5696:()=>{},89408:()=>{},28339:()=>{},47956:()=>{},21724:()=>{},62678:()=>{},25819:()=>{},30306:(e,t,r)=>{"use strict";var n=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],i="undefined"===typeof globalThis?r.g:globalThis;e.exports=function(){for(var e=[],t=0;t<n.length;t++)"function"===typeof i[n[t]]&&(e[e.length]=n[t]);return e}},40636:(e,t,r)=>{"use strict";var n=r(52506)("%Object.getOwnPropertyDescriptor%",!0);if(n)try{n([],"length")}catch(i){n=null}e.exports=n},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 o=r(79272),s=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 o(this.putMany(e,r)),e=[],await o(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=s(r,(t=>t.key.toString().startsWith(e.prefix)))),Array.isArray(e.filters)&&(r=e.filters.reduce(((e,t)=>s(e,t)),r)),Array.isArray(e.orders)&&(r=e.orders.reduce(((e,t)=>i(e,t)),r)),null!=e.offset){let t=0;r=s(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=s(r,(t=>t.toString().startsWith(e.prefix)))),Array.isArray(e.filters)&&(r=e.filters.reduce(((e,t)=>s(e,t)),r)),Array.isArray(e.orders)&&(r=e.orders.reduce(((e,t)=>i(e,t)),r)),null!=e.offset){let t=0;r=s(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(422),i=r(82051),o=r(46765);const s="/",a=(new TextEncoder).encode(s),c=a[0];class u{constructor(e,t){if("string"===typeof e)this._buf=(0,o.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(s))}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(s).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(s)||(e+=s),e+=this.type(),new u(e)}parent(){const e=this.list();return 1===e.length?new u(s):new u(e.slice(0,-1).join(s))}child(e){return this.toString()===s?e:e.toString()===s?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:()=>d,Dp:()=>l,ET:()=>h});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 o=e.charAt(i),s=o.charCodeAt(0);if(255!==r[s])throw new TypeError(o+" is ambiguous");r[s]=i}var a=e.length,c=e.charAt(0),u=Math.log(a)/Math.log(256),l=Math.log(256)/Math.log(a);function d(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 o=(e.length-t)*u+1>>>0,s=new Uint8Array(o);e[t];){var l=r[e.charCodeAt(t)];if(255===l)return;for(var d=0,h=o-1;(0!==l||d<i)&&-1!==h;h--,d++)l+=a*s[h]>>>0,s[h]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=d,t++}if(" "!==e[t]){for(var f=o-i;f!==o&&0===s[f];)f++;for(var p=new Uint8Array(n+(o-f)),y=n;f!==o;)p[y++]=s[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,o=t.length;i!==o&&0===t[i];)i++,r++;for(var s=(o-i)*l+1>>>0,u=new Uint8Array(s);i!==o;){for(var d=t[i],h=0,f=s-1;(0!==d||h<n)&&-1!==f;f--,h++)d+=256*u[f]>>>0,u[f]=d%a>>>0,d=d/a>>>0;if(0!==d)throw new Error("Non-zero carry");n=h,i++}for(var p=s-n;p!==s&&0===u[p];)p++;for(var y=c.repeat(r);p<s;++p)y+=e.charAt(u[p]);return y},decodeUnsafe:d,decode:function(e){var r=d(e);if(r)return r;throw new Error("Non-".concat(t," character"))}}};var i=r(71250);class o{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 s{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 o(e,t,r),this.decoder=new s(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)},d=e=>{let{prefix:t,name:r,alphabet:o}=e;const{encode:s,decode:a}=n(o,r);return l({prefix:t,name:r,encode:s,decode:e=>(0,i.oQ)(a(e))})},h=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 o="",s=0,a=0;for(let c=0;c<e.length;++c)for(a=a<<8|e[c],s+=8;s>r;)s-=r,o+=t[i&a>>s];if(s&&(o+=t[i&a<<r-s]),n)for(;o.length*r&7;)o+="=";return o})(e,i,n),decode:e=>((e,t,r,n)=>{const i={};for(let l=0;l<t.length;++l)i[t[l]]=l;let o=e.length;for(;"="===e[o-1];)--o;const s=new Uint8Array(o*r/8|0);let a=0,c=0,u=0;for(let l=0;l<o;++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,s[u++]=255&c>>a)}if(a>=r||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return s})(e,i,n,t)})}},24031:(e,t,r)=>{"use strict";r.r(t),r.d(t,{base16:()=>i,base16upper:()=>o});var n=r(52087);const i=(0,n.ET)({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),o=(0,n.ET)({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})},71128:(e,t,r)=>{"use strict";r.r(t),r.d(t,{base32:()=>i,base32hex:()=>c,base32hexpad:()=>l,base32hexpadupper:()=>d,base32hexupper:()=>u,base32pad:()=>s,base32padupper:()=>a,base32upper:()=>o,base32z:()=>h});var n=r(52087);const i=(0,n.ET)({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),o=(0,n.ET)({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),s=(0,n.ET)({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),a=(0,n.ET)({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),c=(0,n.ET)({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),u=(0,n.ET)({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),l=(0,n.ET)({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),d=(0,n.ET)({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),h=(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:()=>o});var n=r(52087);const i=(0,n.kU)({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),o=(0,n.kU)({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})},86898:(e,t,r)=>{"use strict";r.r(t),r.d(t,{base58btc:()=>i,base58flickr:()=>o});var n=r(52087);const i=(0,n.kU)({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),o=(0,n.kU)({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})},24426:(e,t,r)=>{"use strict";r.r(t),r.d(t,{base64:()=>i,base64pad:()=>o,base64url:()=>s,base64urlpad:()=>a});var n=r(52087);const i=(0,n.ET)({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),o=(0,n.ET)({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),s=(0,n.ET)({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),a=(0,n.ET)({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})},71250:(e,t,r)=>{"use strict";r.d(t,{BB:()=>s,fS:()=>n,mL:()=>o,oQ:()=>i});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")},o=e=>(new TextEncoder).encode(e),s=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),o=r(86898),s=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!==h)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||o.base58btc.encoder):d(t,n,e||s.base32.encoder)}toJSON(){return{code:this.code,version:this.version,hash:this.multihash.bytes}}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return"CID("+this.toString()+")"}static isCID(e){return b(/^0\.0/,v),!(!e||!e[y]&&e.asCID!==e)}get toBaseEncodedString(){throw new Error("Deprecated, use .toString()")}get codec(){throw new Error('"codec" property is deprecated, use integer "code" property instead')}get buffer(){throw new Error("Deprecated .buffer property, use .bytes to get Uint8Array instead")}get multibaseName(){throw new Error('"multibaseName" property is deprecated')}get prefix(){throw new Error('"prefix" property is deprecated')}static asCID(e){if(e instanceof c)return e;if(null!=e&&e.asCID===e){const{version:t,code:r,multihash:n,bytes:i}=e;return new c(t,r,n,i||p(t,r,n.bytes))}if(null!=e&&!0===e[y]){const{version:t,multihash:r,code:n}=e,o=i.decode(r);return c.create(t,n,o)}return null}static create(e,t,r){if("number"!==typeof t)throw new Error("String codecs are no longer supported");switch(e){case 0:if(t!==h)throw new Error("Version 0 CID must use dag-pb (code: ".concat(h,") block encoding"));return new c(e,t,r,r.bytes);case 1:{const n=p(e,t,r.bytes);return new c(e,t,r,n)}default:throw new Error("Invalid version")}}static createV0(e){return c.create(0,h,e)}static createV1(e,t){return c.create(1,e,t)}static decode(e){const[t,r]=c.decodeFirst(e);if(r.length)throw new Error("Incorrect length");return t}static decodeFirst(e){const t=c.inspectBytes(e),r=t.size-t.multihashSize,n=(0,a.oQ)(e.subarray(r,r+t.multihashSize));if(n.byteLength!==t.multihashSize)throw new Error("Incorrect length");const o=n.subarray(t.multihashSize-t.digestSize),s=new i.Digest(t.multihashCode,t.digestSize,o,n);return[0===t.version?c.createV0(s):c.createV1(t.codec,s),e.subarray(t.size)]}static inspectBytes(e){let t=0;const r=()=>{const[r,i]=n.Jx(e.subarray(t));return t+=i,r};let i=r(),o=h;if(18===i?(i=0,t=0):1===i&&(o=r()),0!==i&&1!==i)throw new RangeError("Invalid CID version ".concat(i));const s=t,a=r(),c=r(),u=t+c;return{version:i,codec:o,multihashCode:a,digestSize:c,multihashSize:u-s,size:u}}static parse(e,t){const[r,n]=u(e,t),i=c.decode(n);return i._baseCache.set(r,e),i}}const u=(e,t)=>{switch(e[0]){case"Q":{const r=t||o.base58btc;return[o.base58btc.prefix,r.decode("".concat(o.base58btc.prefix).concat(e))]}case o.base58btc.prefix:{const r=t||o.base58btc;return[o.base58btc.prefix,r.decode(e)]}case s.base32.prefix:{const r=t||s.base32;return[s.base32.prefix,r.decode(e)]}default:if(null==t)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}},l=(e,t,r)=>{const{prefix:n}=r;if(n!==o.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},d=(e,t,r)=>{const{prefix:n}=r,i=t.get(n);if(null==i){const i=r.encode(e);return t.set(n,i),i}return i},h=112,f=18,p=(e,t,r)=>{const i=n.P$(e),o=i+n.P$(t),s=new Uint8Array(o+r.byteLength);return n.mL(e,s,0),n.mL(t,s,i),s.set(r,o),s},y=Symbol.for("@ipld/js-cid/CID"),g={writable:!1,configurable:!1,enumerable:!0},m={writable:!1,enumerable:!1,configurable:!1},b=(e,t)=>{if(!e.test("0.0.0-dev"))throw new Error(t);console.warn(t)},v="CID.isCID(v) is deprecated and will be removed in the next major release.\nFollowing code pattern:\n\nif (CID.isCID(value)) {\n doSomethingWithCID(value)\n}\n\nIs replaced with:\n\nconst cid = CID.asCID(value)\nif (cid) {\n // Make sure to use cid instead of value\n doSomethingWithCID(cid)\n}\n"},8315:(e,t,r)=>{"use strict";r.r(t),r.d(t,{Digest:()=>c,create:()=>o,decode:()=>s,equals:()=>a});var n=r(71250),i=r(65136);const o=(e,t)=>{const r=t.byteLength,n=i.P$(e),o=n+i.P$(r),s=new Uint8Array(o+r);return i.mL(e,s,0),i.mL(r,s,n),s.set(t,o),new c(e,r,t,s)},s=e=>{const t=(0,n.oQ)(e),[r,o]=i.Jx(t),[s,a]=i.Jx(t.subarray(o)),u=t.subarray(o+a);if(u.byteLength!==s)throw new Error("Incorrect length");return new c(r,s,u,t)},a=(e,t)=>e===t||e.code===t.code&&e.size===t.size&&(0,n.fS)(e.bytes,t.bytes);class c{constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}}},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 o(t,r,n)};class o{constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?n.create(this.code,t):t.then((e=>n.create(this.code,e)))}throw Error("Unknown type, must be binary type")}}},60173:(e,t,r)=>{"use strict";r.r(t),r.d(t,{identity:()=>s});var n=r(71250),i=r(8315);const o=n.oQ,s={code:0,name:"identity",encode:o,digest:e=>i.create(0,o(e))}},19400:(e,t,r)=>{"use strict";r.r(t),r.d(t,{sha256:()=>o,sha512:()=>s});var n=r(42231);const i=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),o=(0,n.D)({name:"sha2-256",code:18,encode:i("SHA-256")}),s=(0,n.D)({name:"sha2-512",code:19,encode:i("SHA-512")})},65136:(e,t,r)=>{"use strict";r.d(t,{Jx:()=>g,mL:()=>m,P$:()=>b});var n=function e(t,r,n){r=r||[];var o=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-o+1,r},i=Math.pow(2,31);var o=function e(t,r){var n,i=0,o=0,s=r=r||0,a=t.length;do{if(s>=a)throw e.bytes=0,new RangeError("Could not decode varint");n=t[s++],i+=o<28?(127&n)<<o:(127&n)*Math.pow(2,o),o+=7}while(n>=128);return e.bytes=s-r,i};var s=Math.pow(2,7),a=Math.pow(2,14),c=Math.pow(2,21),u=Math.pow(2,28),l=Math.pow(2,35),d=Math.pow(2,42),h=Math.pow(2,49),f=Math.pow(2,56),p=Math.pow(2,63);const y={encode:n,decode:o,encodingLength:function(e){return e<s?1:e<a?2:e<c?3:e<u?4:e<l?5:e<d?6:e<h?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},b=e=>y.encodingLength(e)},422:(e,t,r)=>{"use strict";r.r(t),r.d(t,{customAlphabet:()=>s,customRandom:()=>o,nanoid:()=>a,random:()=>i,urlAlphabet:()=>n});let n="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",i=e=>crypto.getRandomValues(new Uint8Array(e)),o=(e,t,r)=>{let n=(2<<Math.log(e.length-1)/Math.LN2)-1,i=-~(1.6*n*t/e.length);return function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t,s="";for(;;){let t=r(i),a=i;for(;a--;)if(s+=e[t[a]&n]||"",s.length===o)return s}}},s=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:21;return o(e,t,i)},a=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:21;return crypto.getRandomValues(new Uint8Array(e)).reduce(((e,t)=>e+=(t&=63)<36?t.toString(36):t<62?(t-26).toString(36).toUpperCase():t>62?"-":"_"),"")}},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:()=>o.equals,fromString:()=>s.fromString,toString:()=>a.toString,xor:()=>c});var i=r(62110),o=r(98779),s=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:()=>L});var n={};r.r(n),r.d(n,{identity:()=>d});var i={};r.r(i),r.d(i,{base2:()=>h});var o={};r.r(o),r.d(o,{base8:()=>f});var s={};r.r(s),r.d(s,{base10:()=>p});var a={};r.r(a),r.d(a,{code:()=>S,decode:()=>A,encode:()=>I,name:()=>_});var c={};r.r(c),r.d(c,{code:()=>P,decode:()=>O,encode:()=>k,name:()=>C});var u=r(52087),l=r(71250);const d=(0,u.Dp)({prefix:"\0",name:"identity",encode:e=>(0,l.BB)(e),decode:e=>(0,l.mL)(e)}),h=(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),b=r(86898),v=r(24426),w=r(19400),E=r(60173);const _="raw",S=85,I=e=>(0,l.oQ)(e),A=e=>(0,l.oQ)(e),R=new TextEncoder,T=new TextDecoder,C="json",P=512,k=e=>R.encode(JSON.stringify(e)),O=e=>JSON.parse(T.decode(e));r(16629),r(65136),r(42231),r(8315);const N={...n,...i,...o,...s,...y,...g,...m,...b,...v};function D(e,t,r,n){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:n}}}const B=D("utf8","u",(e=>"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),x=D("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})),L={utf8:B,"utf-8":B,hex:N.base16,latin1:x,ascii:x,binary:x,...N}},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})},__webpack_require__.p="/examples/store-reactjs-chat/";var __webpack_exports__={};(()=>{"use strict";var e=__webpack_require__(72791),t=__webpack_require__(54164),r=__webpack_require__(12738),n=__webpack_require__(69145),i=__webpack_require__.n(n),o=__webpack_require__(80184),s=__webpack_require__(19778).Buffer;const a=i()("\nmessage ChatMessage {\n uint64 timestamp = 1;\n string nick = 2;\n bytes text = 3;\n}\n");const c=function(){const[t,n]=e.useState(void 0),[i,s]=e.useState("None"),[a,c]=e.useState([]);return e.useEffect((()=>{"None"===i&&(s("Starting"),r.Waku.create({bootstrap:{default:!0}}).then((e=>{n(e),s("Connecting")})))}),[t,i]),e.useEffect((()=>{t&&"Connected"!==i&&t.waitForRemotePeer().then((()=>{s("Connected")}))}),[t,i]),e.useEffect((()=>{if("Connected"!==i)return;const e=new Date;e.setTime(e.getTime()-6048e5),t.store.queryHistory(["/toy-chat/2/huilong/proto"],{callback:e=>{const t=e.map(u).filter(Boolean);c((e=>e.concat(t.reverse())))},timeFilter:{startTime:e,endTime:new Date}}).catch((e=>{console.log("Failed to retrieve messages",e)}))}),[t,i]),(0,o.jsx)("div",{className:"App",children:(0,o.jsxs)("header",{className:"App-header",children:[(0,o.jsx)("h2",{children:i}),(0,o.jsx)("h3",{children:"Messages"}),(0,o.jsx)("ul",{children:(0,o.jsx)(l,{messages:a})})]})})};function u(e){if(!e.payload)return;const{timestamp:t,nick:r,text:n}=a.ChatMessage.decode(e.payload);if(!t||!n||!r)return;const i=new Date;i.setTime(t);return{text:s.from(n).toString("utf-8"),timestamp:i,nick:r}}function l(e){return e.messages.map((e=>{let{text:t,timestamp:r,nick:n}=e;return(0,o.jsxs)("li",{children:["(",d(r),") ",n,": ",t]})}))}function d(e){return e.toLocaleString([],{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit",hour12:!1})}t.render((0,o.jsx)(e.StrictMode,{children:(0,o.jsx)(c,{})}),document.getElementById("root"))})()})();
|
|
//# sourceMappingURL=main.e8560a6b.js.map |