/*! For license information please see main.89e32884.js.LICENSE.txt */
(()=>{var e={2367:function(e){e.exports=function(){return e={418:function(e,t){!function(e,t){for(var n in t)e[n]=t[n]}(t,function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),i=function(){function e(e,t){void 0===e&&(e={}),void 0===t&&(t={splitValues:!1});var n,i=this;this.headersMap={},e&&("undefined"!=typeof Headers&&e instanceof Headers?r.getHeaderKeys(e).forEach((function(n){r.getHeaderValues(e,n).forEach((function(e){t.splitValues?i.append(n,r.splitHeaderValue(e)):i.append(n,e)}))})):"object"==typeof(n=e)&&"object"==typeof n.headersMap&&"function"==typeof n.forEach?e.forEach((function(e,t){i.append(e,t)})):"undefined"!=typeof Map&&e instanceof Map?e.forEach((function(e,t){i.append(t,e)})):"string"==typeof e?this.appendFromString(e):"object"==typeof e&&Object.getOwnPropertyNames(e).forEach((function(t){var n=e[t];Array.isArray(n)?n.forEach((function(e){i.append(t,e)})):i.append(t,n)})))}return e.prototype.appendFromString=function(e){for(var t=e.split("\r\n"),n=0;n<t.length;n++){var r=t[n],i=r.indexOf(":");if(i>0){var o=r.substring(0,i).trim(),s=r.substring(i+1).trim();this.append(o,s)}}},e.prototype.delete=function(e,t){var n=r.normalizeName(e);if(void 0===t)delete this.headersMap[n];else{var i=this.headersMap[n];if(i){var o=i.indexOf(t);o>=0&&i.splice(o,1),0===i.length&&delete this.headersMap[n]}}},e.prototype.append=function(e,t){var n=this,i=r.normalizeName(e);Array.isArray(this.headersMap[i])||(this.headersMap[i]=[]),Array.isArray(t)?t.forEach((function(e){n.headersMap[i].push(r.normalizeValue(e))})):this.headersMap[i].push(r.normalizeValue(t))},e.prototype.set=function(e,t){var n=r.normalizeName(e);if(Array.isArray(t)){var i=[];t.forEach((function(e){i.push(r.normalizeValue(e))})),this.headersMap[n]=i}else this.headersMap[n]=[r.normalizeValue(t)]},e.prototype.has=function(e,t){var n=this.headersMap[r.normalizeName(e)];if(!Array.isArray(n))return!1;if(void 0!==t){var i=r.normalizeValue(t);return n.indexOf(i)>=0}return!0},e.prototype.get=function(e){var t=this.headersMap[r.normalizeName(e)];return void 0!==t?t.concat():[]},e.prototype.forEach=function(e){var t=this;Object.getOwnPropertyNames(this.headersMap).forEach((function(n){e(n,t.headersMap[n])}),this)},e.prototype.toHeaders=function(){if("undefined"!=typeof Headers){var e=new Headers;return this.forEach((function(t,n){n.forEach((function(n){e.append(t,n)}))})),e}throw new Error("Headers class is not defined")},e}();t.BrowserHeaders=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0);t.BrowserHeaders=r.BrowserHeaders},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.iterateHeaders=function(e,t){for(var n=e[Symbol.iterator](),r=n.next();!r.done;)t(r.value[0]),r=n.next()},t.iterateHeadersKeys=function(e,t){for(var n=e.keys(),r=n.next();!r.done;)t(r.value),r=n.next()}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2);t.normalizeName=function(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()},t.normalizeValue=function(e){return"string"!=typeof e&&(e=String(e)),e},t.getHeaderValues=function(e,t){var n=e;if(n instanceof Headers&&n.getAll)return n.getAll(t);var r=n.get(t);return r&&"string"==typeof r?[r]:r},t.getHeaderKeys=function(e){var t=e,n={},i=[];return t.keys?r.iterateHeadersKeys(t,(function(e){n[e]||(n[e]=!0,i.push(e))})):t.forEach?t.forEach((function(e,t){n[t]||(n[t]=!0,i.push(t))})):r.iterateHeaders(t,(function(e){var t=e[0];n[t]||(n[t]=!0,i.push(t))})),i},t.splitHeaderValue=function(e){var t=[];return e.split(", ").forEach((function(e){e.split(",").forEach((function(e){t.push(e)}))})),t}}]))},617:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChunkParser=t.ChunkType=t.encodeASCII=t.decodeASCII=void 0;var r,i=n(65);function o(e){return 9===(t=e)||10===t||13===t||e>=32&&e<=126;var t}function s(e){for(var t=0;t!==e.length;++t)if(!o(e[t]))throw new Error("Metadata is not valid (printable) ASCII");return String.fromCharCode.apply(String,Array.prototype.slice.call(e))}function a(e){return 128==(128&e.getUint8(0))}function c(e){return e.getUint32(1,!1)}function l(e,t,n){return e.byteLength-t>=n}function u(e,t,n){if(e.slice)return e.slice(t,n);var r=e.length;void 0!==n&&(r=n);for(var i=new Uint8Array(r-t),o=0,s=t;s<r;s++)i[o++]=e[s];return i}t.decodeASCII=s,t.encodeASCII=function(e){for(var t=new Uint8Array(e.length),n=0;n!==e.length;++n){var r=e.charCodeAt(n);if(!o(r))throw new Error("Metadata contains invalid ASCII");t[n]=r}return t},function(e){e[e.MESSAGE=1]="MESSAGE",e[e.TRAILERS=2]="TRAILERS"}(r=t.ChunkType||(t.ChunkType={}));var d=function(){function e(){this.buffer=null,this.position=0}return e.prototype.parse=function(e,t){if(0===e.length&&t)return[];var n,o=[];if(null==this.buffer)this.buffer=e,this.position=0;else if(this.position===this.buffer.byteLength)this.buffer=e,this.position=0;else{var d=this.buffer.byteLength-this.position,f=new Uint8Array(d+e.byteLength),h=u(this.buffer,this.position);f.set(h,0);var p=new Uint8Array(e);f.set(p,d),this.buffer=f,this.position=0}for(;;){if(!l(this.buffer,this.position,5))return o;var g=u(this.buffer,this.position,this.position+5),y=new DataView(g.buffer,g.byteOffset,g.byteLength),m=c(y);if(!l(this.buffer,this.position,5+m))return o;var v=u(this.buffer,this.position+5,this.position+5+m);if(this.position+=5+m,a(y))return o.push({chunkType:r.TRAILERS,trailers:(n=v,new i.Metadata(s(n)))}),o;o.push({chunkType:r.MESSAGE,data:v})}},e}();t.ChunkParser=d},8:function(e,t){"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.httpStatusToCode=t.Code=void 0,function(e){e[e.OK=0]="OK",e[e.Canceled=1]="Canceled",e[e.Unknown=2]="Unknown",e[e.InvalidArgument=3]="InvalidArgument",e[e.DeadlineExceeded=4]="DeadlineExceeded",e[e.NotFound=5]="NotFound",e[e.AlreadyExists=6]="AlreadyExists",e[e.PermissionDenied=7]="PermissionDenied",e[e.ResourceExhausted=8]="ResourceExhausted",e[e.FailedPrecondition=9]="FailedPrecondition",e[e.Aborted=10]="Aborted",e[e.OutOfRange=11]="OutOfRange",e[e.Unimplemented=12]="Unimplemented",e[e.Internal=13]="Internal",e[e.Unavailable=14]="Unavailable",e[e.DataLoss=15]="DataLoss",e[e.Unauthenticated=16]="Unauthenticated"}(n=t.Code||(t.Code={})),t.httpStatusToCode=function(e){switch(e){case 0:return n.Internal;case 200:return n.OK;case 400:return n.InvalidArgument;case 401:return n.Unauthenticated;case 403:return n.PermissionDenied;case 404:return n.NotFound;case 409:return n.Aborted;case 412:return n.FailedPrecondition;case 429:return n.ResourceExhausted;case 499:return n.Canceled;case 500:default:return n.Unknown;case 501:return n.Unimplemented;case 503:return n.Unavailable;case 504:return n.DeadlineExceeded}}},934:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.client=void 0;var r=n(65),i=n(617),o=n(8),s=n(346),a=n(57),c=n(882);t.client=function(e,t){return new l(e,t)};var l=function(){function e(e,t){this.started=!1,this.sentFirstMessage=!1,this.completed=!1,this.closed=!1,this.finishedSending=!1,this.onHeadersCallbacks=[],this.onMessageCallbacks=[],this.onEndCallbacks=[],this.parser=new i.ChunkParser,this.methodDefinition=e,this.props=t,this.createTransport()}return e.prototype.createTransport=function(){var e=this.props.host+"/"+this.methodDefinition.service.serviceName+"/"+this.methodDefinition.methodName,t={methodDefinition:this.methodDefinition,debug:this.props.debug||!1,url:e,onHeaders:this.onTransportHeaders.bind(this),onChunk:this.onTransportChunk.bind(this),onEnd:this.onTransportEnd.bind(this)};this.props.transport?this.transport=this.props.transport(t):this.transport=a.makeDefaultTransport(t)},e.prototype.onTransportHeaders=function(e,t){if(this.props.debug&&s.debug("onHeaders",e,t),this.closed)this.props.debug&&s.debug("grpc.onHeaders received after request was closed - ignoring");else if(0===t);else{this.responseHeaders=e,this.props.debug&&s.debug("onHeaders.responseHeaders",JSON.stringify(this.responseHeaders,null,2));var n=u(e);this.props.debug&&s.debug("onHeaders.gRPCStatus",n);var r=n&&n>=0?n:o.httpStatusToCode(t);this.props.debug&&s.debug("onHeaders.code",r);var i=e.get("grpc-message")||[];if(this.props.debug&&s.debug("onHeaders.gRPCMessage",i),this.rawOnHeaders(e),r!==o.Code.OK){var a=this.decodeGRPCStatus(i[0]);this.rawOnError(r,a,e)}}},e.prototype.onTransportChunk=function(e){var t=this;if(this.closed)this.props.debug&&s.debug("grpc.onChunk received after request was closed - ignoring");else{var n=[];try{n=this.parser.parse(e)}catch(e){return this.props.debug&&s.debug("onChunk.parsing error",e,e.message),void this.rawOnError(o.Code.Internal,"parsing error: "+e.message)}n.forEach((function(e){if(e.chunkType===i.ChunkType.MESSAGE){var n=t.methodDefinition.responseType.deserializeBinary(e.data);t.rawOnMessage(n)}else e.chunkType===i.ChunkType.TRAILERS&&(t.responseHeaders?(t.responseTrailers=new r.Metadata(e.trailers),t.props.debug&&s.debug("onChunk.trailers",t.responseTrailers)):(t.responseHeaders=new r.Metadata(e.trailers),t.rawOnHeaders(t.responseHeaders)))}))}},e.prototype.onTransportEnd=function(){if(this.props.debug&&s.debug("grpc.onEnd"),this.closed)this.props.debug&&s.debug("grpc.onEnd received after request was closed - ignoring");else if(void 0!==this.responseTrailers){var e=u(this.responseTrailers);if(null!==e){var t=this.responseTrailers.get("grpc-message"),n=this.decodeGRPCStatus(t[0]);this.rawOnEnd(e,n,this.responseTrailers)}else this.rawOnError(o.Code.Internal,"Response closed without grpc-status (Trailers provided)")}else{if(void 0===this.responseHeaders)return void this.rawOnError(o.Code.Unknown,"Response closed without headers");var r=u(this.responseHeaders),i=this.responseHeaders.get("grpc-message");if(this.props.debug&&s.debug("grpc.headers only response ",r,i),null===r)return void this.rawOnEnd(o.Code.Unknown,"Response closed without grpc-status (Headers only)",this.responseHeaders);var a=this.decodeGRPCStatus(i[0]);this.rawOnEnd(r,a,this.responseHeaders)}},e.prototype.decodeGRPCStatus=function(e){if(!e)return"";try{return decodeURIComponent(e)}catch(t){return e}},e.prototype.rawOnEnd=function(e,t,n){var r=this;this.props.debug&&s.debug("rawOnEnd",e,t,n),this.completed||(this.completed=!0,this.onEndCallbacks.forEach((function(i){if(!r.closed)try{i(e,t,n)}catch(e){setTimeout((function(){throw e}),0)}})))},e.prototype.rawOnHeaders=function(e){this.props.debug&&s.debug("rawOnHeaders",e),this.completed||this.onHeadersCallbacks.forEach((function(t){try{t(e)}catch(e){setTimeout((function(){throw e}),0)}}))},e.prototype.rawOnError=function(e,t,n){var i=this;void 0===n&&(n=new r.Metadata),this.props.debug&&s.debug("rawOnError",e,t),this.completed||(this.completed=!0,this.onEndCallbacks.forEach((function(r){if(!i.closed)try{r(e,t,n)}catch(e){setTimeout((function(){throw e}),0)}})))},e.prototype.rawOnMessage=function(e){var t=this;this.props.debug&&s.debug("rawOnMessage",e.toObject()),this.completed||this.closed||this.onMessageCallbacks.forEach((function(n){if(!t.closed)try{n(e)}catch(e){setTimeout((function(){throw e}),0)}}))},e.prototype.onHeaders=function(e){this.onHeadersCallbacks.push(e)},e.prototype.onMessage=function(e){this.onMessageCallbacks.push(e)},e.prototype.onEnd=function(e){this.onEndCallbacks.push(e)},e.prototype.start=function(e){if(this.started)throw new Error("Client already started - cannot .start()");this.started=!0;var t=new r.Metadata(e||{});t.set("content-type","application/grpc-web+proto"),t.set("x-grpc-web","1"),this.transport.start(t)},e.prototype.send=function(e){if(!this.started)throw new Error("Client not started - .start() must be called before .send()");if(this.closed)throw new Error("Client already closed - cannot .send()");if(this.finishedSending)throw new Error("Client already finished sending - cannot .send()");if(!this.methodDefinition.requestStream&&this.sentFirstMessage)throw new Error("Message already sent for non-client-streaming method - cannot .send()");this.sentFirstMessage=!0;var t=c.frameRequest(e);this.transport.sendMessage(t)},e.prototype.finishSend=function(){if(!this.started)throw new Error("Client not started - .finishSend() must be called before .close()");if(this.closed)throw new Error("Client already closed - cannot .send()");if(this.finishedSending)throw new Error("Client already finished sending - cannot .finishSend()");this.finishedSending=!0,this.transport.finishSend()},e.prototype.close=function(){if(!this.started)throw new Error("Client not started - .start() must be called before .close()");if(this.closed)throw new Error("Client already closed - cannot .close()");this.closed=!0,this.props.debug&&s.debug("request.abort aborting request"),this.transport.cancel()},e}();function u(e){var t=e.get("grpc-status")||[];if(t.length>0)try{var n=t[0];return parseInt(n,10)}catch(e){return null}return null}},346:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.debug=void 0,t.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.debug?console.debug.apply(null,e):console.log.apply(null,e)}},607:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.grpc=void 0;var r,i=n(418),o=n(57),s=n(229),a=n(540),c=n(210),l=n(859),u=n(8),d=n(938),f=n(35),h=n(934);(r=t.grpc||(t.grpc={})).setDefaultTransport=o.setDefaultTransportFactory,r.CrossBrowserHttpTransport=l.CrossBrowserHttpTransport,r.FetchReadableStreamTransport=s.FetchReadableStreamTransport,r.XhrTransport=c.XhrTransport,r.WebsocketTransport=a.WebsocketTransport,r.Code=u.Code,r.Metadata=i.BrowserHeaders,r.client=function(e,t){return h.client(e,t)},r.invoke=d.invoke,r.unary=f.unary},938:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.invoke=void 0;var r=n(934);t.invoke=function(e,t){if(e.requestStream)throw new Error(".invoke cannot be used with client-streaming methods. Use .client instead.");var n=r.client(e,{host:t.host,transport:t.transport,debug:t.debug});return t.onHeaders&&n.onHeaders(t.onHeaders),t.onMessage&&n.onMessage(t.onMessage),t.onEnd&&n.onEnd(t.onEnd),n.start(t.metadata),n.send(t.request),n.finishSend(),{close:function(){n.close()}}}},65:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Metadata=void 0;var r=n(418);Object.defineProperty(t,"Metadata",{enumerable:!0,get:function(){return r.BrowserHeaders}})},57:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.makeDefaultTransport=t.setDefaultTransportFactory=void 0;var r=n(859),i=function(e){return r.CrossBrowserHttpTransport({withCredentials:!1})(e)};t.setDefaultTransportFactory=function(e){i=e},t.makeDefaultTransport=function(e){return i(e)}},229:function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.detectFetchSupport=t.FetchReadableStreamTransport=void 0;var i=n(65),o=n(346);t.FetchReadableStreamTransport=function(e){return function(t){return function(e,t){return e.debug&&o.debug("fetchRequest",e),new s(e,t)}(t,e)}};var s=function(){function e(e,t){this.cancelled=!1,this.controller=self.AbortController&&new AbortController,this.options=e,this.init=t}return e.prototype.pump=function(e,t){var n=this;if(this.reader=e,this.cancelled)return this.options.debug&&o.debug("Fetch.pump.cancel at first pump"),void this.reader.cancel().catch((function(e){n.options.debug&&o.debug("Fetch.pump.reader.cancel exception",e)}));this.reader.read().then((function(e){if(e.done)return n.options.onEnd(),t;n.options.onChunk(e.value),n.pump(n.reader,t)})).catch((function(e){n.cancelled?n.options.debug&&o.debug("Fetch.catch - request cancelled"):(n.cancelled=!0,n.options.debug&&o.debug("Fetch.catch",e.message),n.options.onEnd(e))}))},e.prototype.send=function(e){var t=this;fetch(this.options.url,r(r({},this.init),{headers:this.metadata.toHeaders(),method:"POST",body:e,signal:this.controller&&this.controller.signal})).then((function(e){if(t.options.debug&&o.debug("Fetch.response",e),t.options.onHeaders(new i.Metadata(e.headers),e.status),!e.body)return e;t.pump(e.body.getReader(),e)})).catch((function(e){t.cancelled?t.options.debug&&o.debug("Fetch.catch - request cancelled"):(t.cancelled=!0,t.options.debug&&o.debug("Fetch.catch",e.message),t.options.onEnd(e))}))},e.prototype.sendMessage=function(e){this.send(e)},e.prototype.finishSend=function(){},e.prototype.start=function(e){this.metadata=e},e.prototype.cancel=function(){var e=this;this.cancelled?this.options.debug&&o.debug("Fetch.cancel already cancelled"):(this.cancelled=!0,this.controller?(this.options.debug&&o.debug("Fetch.cancel.controller.abort"),this.controller.abort()):this.options.debug&&o.debug("Fetch.cancel.missing abort controller"),this.reader?(this.options.debug&&o.debug("Fetch.cancel.reader.cancel"),this.reader.cancel().catch((function(t){e.options.debug&&o.debug("Fetch.cancel.reader.cancel exception",t)}))):this.options.debug&&o.debug("Fetch.cancel before reader"))},e}();t.detectFetchSupport=function(){return"undefined"!=typeof Response&&Response.prototype.hasOwnProperty("body")&&"function"==typeof Headers}},859:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CrossBrowserHttpTransport=void 0;var r=n(229),i=n(210);t.CrossBrowserHttpTransport=function(e){if(r.detectFetchSupport()){var t={credentials:e.withCredentials?"include":"same-origin"};return r.FetchReadableStreamTransport(t)}return i.XhrTransport({withCredentials:e.withCredentials})}},210:function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.stringToArrayBuffer=t.MozChunkedArrayBufferXHR=t.XHR=t.XhrTransport=void 0;var o=n(65),s=n(346),a=n(849);t.XhrTransport=function(e){return function(t){if(a.detectMozXHRSupport())return new l(t,e);if(a.detectXHROverrideMimeTypeSupport())return new c(t,e);throw new Error("This environment's XHR implementation cannot support binary transfer.")}};var c=function(){function e(e,t){this.options=e,this.init=t}return e.prototype.onProgressEvent=function(){this.options.debug&&s.debug("XHR.onProgressEvent.length: ",this.xhr.response.length);var e=this.xhr.response.substr(this.index);this.index=this.xhr.response.length;var t=d(e);this.options.onChunk(t)},e.prototype.onLoadEvent=function(){this.options.debug&&s.debug("XHR.onLoadEvent"),this.options.onEnd()},e.prototype.onStateChange=function(){this.options.debug&&s.debug("XHR.onStateChange",this.xhr.readyState),this.xhr.readyState===XMLHttpRequest.HEADERS_RECEIVED&&this.options.onHeaders(new o.Metadata(this.xhr.getAllResponseHeaders()),this.xhr.status)},e.prototype.sendMessage=function(e){this.xhr.send(e)},e.prototype.finishSend=function(){},e.prototype.start=function(e){var t=this;this.metadata=e;var n=new XMLHttpRequest;this.xhr=n,n.open("POST",this.options.url),this.configureXhr(),this.metadata.forEach((function(e,t){n.setRequestHeader(e,t.join(", "))})),n.withCredentials=Boolean(this.init.withCredentials),n.addEventListener("readystatechange",this.onStateChange.bind(this)),n.addEventListener("progress",this.onProgressEvent.bind(this)),n.addEventListener("loadend",this.onLoadEvent.bind(this)),n.addEventListener("error",(function(e){t.options.debug&&s.debug("XHR.error",e),t.options.onEnd(e.error)}))},e.prototype.configureXhr=function(){this.xhr.responseType="text",this.xhr.overrideMimeType("text/plain; charset=x-user-defined")},e.prototype.cancel=function(){this.options.debug&&s.debug("XHR.abort"),this.xhr.abort()},e}();t.XHR=c;var l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.configureXhr=function(){this.options.debug&&s.debug("MozXHR.configureXhr: setting responseType to 'moz-chunked-arraybuffer'"),this.xhr.responseType="moz-chunked-arraybuffer"},t.prototype.onProgressEvent=function(){var e=this.xhr.response;this.options.debug&&s.debug("MozXHR.onProgressEvent: ",new Uint8Array(e)),this.options.onChunk(new Uint8Array(e))},t}(c);function u(e,t){var n=e.charCodeAt(t);if(n>=55296&&n<=56319){var r=e.charCodeAt(t+1);r>=56320&&r<=57343&&(n=65536+(n-55296<<10)+(r-56320))}return n}function d(e){for(var t=new Uint8Array(e.length),n=0,r=0;r<e.length;r++){var i=String.prototype.codePointAt?e.codePointAt(r):u(e,r);t[n++]=255&i}return t}t.MozChunkedArrayBufferXHR=l,t.stringToArrayBuffer=d},849:function(e,t){"use strict";var n;function r(){if(void 0!==n)return n;if(XMLHttpRequest){n=new XMLHttpRequest;try{n.open("GET","https://localhost")}catch(e){}}return n}function i(e){var t=r();if(!t)return!1;try{return t.responseType=e,t.responseType===e}catch(e){}return!1}Object.defineProperty(t,"__esModule",{value:!0}),t.detectXHROverrideMimeTypeSupport=t.detectMozXHRSupport=t.xhrSupportsResponseType=void 0,t.xhrSupportsResponseType=i,t.detectMozXHRSupport=function(){return"undefined"!=typeof XMLHttpRequest&&i("moz-chunked-arraybuffer")},t.detectXHROverrideMimeTypeSupport=function(){return"undefined"!=typeof XMLHttpRequest&&XMLHttpRequest.prototype.hasOwnProperty("overrideMimeType")}},540:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WebsocketTransport=void 0;var r,i=n(346),o=n(617);!function(e){e[e.FINISH_SEND=1]="FINISH_SEND"}(r||(r={}));var s=new Uint8Array([1]);t.WebsocketTransport=function(){return function(e){return function(e){e.debug&&i.debug("websocketRequest",e);var t,n=function(e){if("https://"===e.substr(0,8))return"wss://"+e.substr(8);if("http://"===e.substr(0,7))return"ws://"+e.substr(7);throw new Error("Websocket transport constructed with non-https:// or http:// host.")}(e.url),a=[];function c(e){if(e===r.FINISH_SEND)t.send(s);else{var n=e,i=new Int8Array(n.byteLength+1);i.set(new Uint8Array([0])),i.set(n,1),t.send(i)}}return{sendMessage:function(e){t&&t.readyState!==t.CONNECTING?c(e):a.push(e)},finishSend:function(){t&&t.readyState!==t.CONNECTING?c(r.FINISH_SEND):a.push(r.FINISH_SEND)},start:function(r){(t=new WebSocket(n,["grpc-websockets"])).binaryType="arraybuffer",t.onopen=function(){var n;e.debug&&i.debug("websocketRequest.onopen"),t.send((n="",r.forEach((function(e,t){n+=e+": "+t.join(", ")+"\r\n"})),o.encodeASCII(n))),a.forEach((function(e){c(e)}))},t.onclose=function(t){e.debug&&i.debug("websocketRequest.onclose",t),e.onEnd()},t.onerror=function(t){e.debug&&i.debug("websocketRequest.onerror",t)},t.onmessage=function(t){e.onChunk(new Uint8Array(t.data))}},cancel:function(){e.debug&&i.debug("websocket.abort"),t.close()}}}(e)}}},35:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.unary=void 0;var r=n(65),i=n(934);t.unary=function(e,t){if(e.responseStream)throw new Error(".unary cannot be used with server-streaming methods. Use .invoke or .client instead.");if(e.requestStream)throw new Error(".unary cannot be used with client-streaming methods. Use .client instead.");var n=null,o=null,s=i.client(e,{host:t.host,transport:t.transport,debug:t.debug});return s.onHeaders((function(e){n=e})),s.onMessage((function(e){o=e})),s.onEnd((function(e,i,s){t.onEnd({status:e,statusMessage:i,headers:n||new r.Metadata,message:o,trailers:s})})),s.start(t.metadata),s.send(t.request),s.finishSend(),{close:function(){s.close()}}}},882:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.frameRequest=void 0,t.frameRequest=function(e){var t=e.serializeBinary(),n=new ArrayBuffer(t.byteLength+5);return new DataView(n,1,4).setUint32(0,t.length,!1),new Uint8Array(n,5).set(t),new Uint8Array(n)}}},t={},function n(r){if(t[r])return t[r].exports;var i=t[r]={exports:{}};return e[r].call(i.exports,i,i.exports,n),i.exports}(607);var e,t}()},4183:(e,t,n)=>{"use strict";function r(){return(null===n.g||void 0===n.g?void 0:n.g.crypto)||(null===n.g||void 0===n.g?void 0:n.g.msCrypto)||{}}function i(){const e=r();return e.subtle||e.webkitSubtle}Object.defineProperty(t,"__esModule",{value:!0}),t.isBrowserCryptoAvailable=t.getSubtleCrypto=t.getBrowerCrypto=void 0,t.getBrowerCrypto=r,t.getSubtleCrypto=i,t.isBrowserCryptoAvailable=function(){return!!r()&&!!i()}},4803:(e,t)=>{"use strict";function n(){return"undefined"===typeof document&&"undefined"!==typeof navigator&&"ReactNative"===navigator.product}function r(){return"undefined"!==typeof process&&"undefined"!==typeof process.versions&&"undefined"!==typeof process.versions.node}Object.defineProperty(t,"__esModule",{value:!0}),t.isBrowser=t.isNode=t.isReactNative=void 0,t.isReactNative=n,t.isNode=r,t.isBrowser=function(){return!n()&&!r()}},6360:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(980);r.__exportStar(n(4183),t),r.__exportStar(n(4803),t)},980:(e,t,n)=>{"use strict";n.r(t),n.d(t,{__assign:()=>o,__asyncDelegator:()=>w,__asyncGenerator:()=>b,__asyncValues:()=>E,__await:()=>v,__awaiter:()=>u,__classPrivateFieldGet:()=>I,__classPrivateFieldSet:()=>O,__createBinding:()=>f,__decorate:()=>a,__exportStar:()=>h,__extends:()=>i,__generator:()=>d,__importDefault:()=>x,__importStar:()=>S,__makeTemplateObject:()=>_,__metadata:()=>l,__param:()=>c,__read:()=>g,__rest:()=>s,__spread:()=>y,__spreadArrays:()=>m,__values:()=>p});var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},r(e,t)};function i(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var o=function(){return o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},o.apply(this,arguments)};function s(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function a(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}function c(e,t){return function(n,r){t(n,r,e)}}function l(e,t){if("object"===typeof Reflect&&"function"===typeof Reflect.metadata)return Reflect.metadata(e,t)}function u(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(t){o(t)}}function a(e){try{c(r.throw(e))}catch(t){o(t)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}function d(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"===typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(a){o=[6,a],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}function f(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}function h(e,t){for(var n in e)"default"===n||t.hasOwnProperty(n)||(t[n]=e[n])}function p(e){var t="function"===typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"===typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function g(e,t){var n="function"===typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(a){i={error:a}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function y(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(g(arguments[t]));return e}function m(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r}function v(e){return this instanceof v?(this.v=e,this):new v(e)}function b(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),o=[];return r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r;function s(e){i[e]&&(r[e]=function(t){return new Promise((function(n,r){o.push([e,t,n,r])>1||a(e,t)}))})}function a(e,t){try{!function(e){e.value instanceof v?Promise.resolve(e.value.v).then(c,l):u(o[0][2],e)}(i[e](t))}catch(n){u(o[0][3],n)}}function c(e){a("next",e)}function l(e){a("throw",e)}function u(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}function w(e){var t,n;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:v(e[r](t)),done:"return"===r}:i?i(t):t}:i}}function E(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=p(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,i){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,i,(t=e[n](t)).done,t.value)}))}}}function _(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function S(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function x(e){return e&&e.__esModule?e:{default:e}}function I(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function O(e,t,n){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,n),n}},6330:e=>{"use strict";e.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},3968:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(7558);r.__exportStar(n(7706),t),r.__exportStar(n(3187),t)},7706:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_THOUSAND=t.ONE_HUNDRED=void 0,t.ONE_HUNDRED=100,t.ONE_THOUSAND=1e3},3187:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_YEAR=t.FOUR_WEEKS=t.THREE_WEEKS=t.TWO_WEEKS=t.ONE_WEEK=t.THIRTY_DAYS=t.SEVEN_DAYS=t.FIVE_DAYS=t.THREE_DAYS=t.ONE_DAY=t.TWENTY_FOUR_HOURS=t.TWELVE_HOURS=t.SIX_HOURS=t.THREE_HOURS=t.ONE_HOUR=t.SIXTY_MINUTES=t.THIRTY_MINUTES=t.TEN_MINUTES=t.FIVE_MINUTES=t.ONE_MINUTE=t.SIXTY_SECONDS=t.THIRTY_SECONDS=t.TEN_SECONDS=t.FIVE_SECONDS=t.ONE_SECOND=void 0,t.ONE_SECOND=1,t.FIVE_SECONDS=5,t.TEN_SECONDS=10,t.THIRTY_SECONDS=30,t.SIXTY_SECONDS=60,t.ONE_MINUTE=t.SIXTY_SECONDS,t.FIVE_MINUTES=5*t.ONE_MINUTE,t.TEN_MINUTES=10*t.ONE_MINUTE,t.THIRTY_MINUTES=30*t.ONE_MINUTE,t.SIXTY_MINUTES=60*t.ONE_MINUTE,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=3*t.ONE_HOUR,t.SIX_HOURS=6*t.ONE_HOUR,t.TWELVE_HOURS=12*t.ONE_HOUR,t.TWENTY_FOUR_HOURS=24*t.ONE_HOUR,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=3*t.ONE_DAY,t.FIVE_DAYS=5*t.ONE_DAY,t.SEVEN_DAYS=7*t.ONE_DAY,t.THIRTY_DAYS=30*t.ONE_DAY,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=2*t.ONE_WEEK,t.THREE_WEEKS=3*t.ONE_WEEK,t.FOUR_WEEKS=4*t.ONE_WEEK,t.ONE_YEAR=365*t.ONE_DAY},230:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(7558);r.__exportStar(n(8624),t),r.__exportStar(n(761),t),r.__exportStar(n(4756),t),r.__exportStar(n(3968),t)},4756:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});n(7558).__exportStar(n(6315),t)},6315:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IWatch=void 0;t.IWatch=class{}},5495:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fromMiliseconds=t.toMiliseconds=void 0;const r=n(3968);t.toMiliseconds=function(e){return e*r.ONE_THOUSAND},t.fromMiliseconds=function(e){return Math.floor(e/r.ONE_THOUSAND)}},119:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.delay=void 0,t.delay=function(e){return new Promise((t=>{setTimeout((()=>{t(!0)}),e)}))}},8624:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(7558);r.__exportStar(n(119),t),r.__exportStar(n(5495),t)},761:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Watch=void 0;class n{constructor(){this.timestamps=new Map}start(e){if(this.timestamps.has(e))throw new Error("Watch already started for label: ".concat(e));this.timestamps.set(e,{started:Date.now()})}stop(e){const t=this.get(e);if("undefined"!==typeof t.elapsed)throw new Error("Watch already stopped for label: ".concat(e));const n=Date.now()-t.started;this.timestamps.set(e,{started:t.started,elapsed:n})}get(e){const t=this.timestamps.get(e);if("undefined"===typeof t)throw new Error("No timestamp found for label: ".concat(e));return t}elapsed(e){const t=this.get(e);return t.elapsed||Date.now()-t.started}}t.Watch=n,t.default=n},7558:(e,t,n)=>{"use strict";n.r(t),n.d(t,{__assign:()=>o,__asyncDelegator:()=>w,__asyncGenerator:()=>b,__asyncValues:()=>E,__await:()=>v,__awaiter:()=>u,__classPrivateFieldGet:()=>I,__classPrivateFieldSet:()=>O,__createBinding:()=>f,__decorate:()=>a,__exportStar:()=>h,__extends:()=>i,__generator:()=>d,__importDefault:()=>x,__importStar:()=>S,__makeTemplateObject:()=>_,__metadata:()=>l,__param:()=>c,__read:()=>g,__rest:()=>s,__spread:()=>y,__spreadArrays:()=>m,__values:()=>p});var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},r(e,t)};function i(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var o=function(){return o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},o.apply(this,arguments)};function s(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function a(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}function c(e,t){return function(n,r){t(n,r,e)}}function l(e,t){if("object"===typeof Reflect&&"function"===typeof Reflect.metadata)return Reflect.metadata(e,t)}function u(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(t){o(t)}}function a(e){try{c(r.throw(e))}catch(t){o(t)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}function d(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"===typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=(i=s.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(a){o=[6,a],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}function f(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}function h(e,t){for(var n in e)"default"===n||t.hasOwnProperty(n)||(t[n]=e[n])}function p(e){var t="function"===typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"===typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function g(e,t){var n="function"===typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(a){i={error:a}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function y(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(g(arguments[t]));return e}function m(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r}function v(e){return this instanceof v?(this.v=e,this):new v(e)}function b(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),o=[];return r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r;function s(e){i[e]&&(r[e]=function(t){return new Promise((function(n,r){o.push([e,t,n,r])>1||a(e,t)}))})}function a(e,t){try{!function(e){e.value instanceof v?Promise.resolve(e.value.v).then(c,l):u(o[0][2],e)}(i[e](t))}catch(n){u(o[0][3],n)}}function c(e){a("next",e)}function l(e){a("throw",e)}function u(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}}function w(e){var t,n;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:v(e[r](t)),done:"return"===r}:i?i(t):t}:i}}function E(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=p(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,i){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,i,(t=e[n](t)).done,t.value)}))}}}function _(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function S(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function x(e){return e&&e.__esModule?e:{default:e}}function I(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function O(e,t,n){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,n),n}},8938:(e,t)=>{"use strict";function n(e){let t;return"undefined"!==typeof window&&"undefined"!==typeof window[e]&&(t=window[e]),t}function r(e){const t=n(e);if(!t)throw new Error("".concat(e," is not defined in Window"));return t}Object.defineProperty(t,"__esModule",{value:!0}),t.getLocalStorage=t.getLocalStorageOrThrow=t.getCrypto=t.getCryptoOrThrow=t.getLocation=t.getLocationOrThrow=t.getNavigator=t.getNavigatorOrThrow=t.getDocument=t.getDocumentOrThrow=t.getFromWindowOrThrow=t.getFromWindow=void 0,t.getFromWindow=n,t.getFromWindowOrThrow=r,t.getDocumentOrThrow=function(){return r("document")},t.getDocument=function(){return n("document")},t.getNavigatorOrThrow=function(){return r("navigator")},t.getNavigator=function(){return n("navigator")},t.getLocationOrThrow=function(){return r("location")},t.getLocation=function(){return n("location")},t.getCryptoOrThrow=function(){return r("crypto")},t.getCrypto=function(){return n("crypto")},t.getLocalStorageOrThrow=function(){return r("localStorage")},t.getLocalStorage=function(){return n("localStorage")}},2829:(e,t,n)=>{"use strict";t.g=void 0;const r=n(8938);t.g=function(){let e,t;try{e=r.getDocumentOrThrow(),t=r.getLocationOrThrow()}catch(o){return null}function n(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const i=e.getElementsByTagName("meta");for(let e=0;e<i.length;e++){const t=i[e],r=["itemprop","property","name"].map((e=>t.getAttribute(e))).filter((e=>!!e&&n.includes(e)));if(r.length&&r){const e=t.getAttribute("content");if(e)return e}}return""}const i=function(){let t=n("name","og:site_name","og:title","twitter:title");return t||(t=e.title),t}();return{description:n("description","og:description","twitter:description","keywords"),url:t.origin,icons:function(){const n=e.getElementsByTagName("link"),r=[];for(let e=0;e<n.length;e++){const i=n[e],o=i.getAttribute("rel");if(o&&o.toLowerCase().indexOf("icon")>-1){const e=i.getAttribute("href");if(e)if(-1===e.toLowerCase().indexOf("https:")&&-1===e.toLowerCase().indexOf("http:")&&0!==e.indexOf("//")){let n=t.protocol+"//"+t.host;if(0===e.indexOf("/"))n+=e;else{const r=t.pathname.split("/");r.pop();n+=r.join("/")+"/"+e}r.push(n)}else if(0===e.indexOf("//")){const n=t.protocol+e;r.push(n)}else r.push(e)}}return r}(),name:i}}},9118:e=>{"use strict";const{AbortController:t,AbortSignal:n}="undefined"!==typeof self?self:"undefined"!==typeof window?window:void 0;e.exports=t,e.exports.AbortSignal=n,e.exports.default=t},956:(e,t)=>{"use strict";t.byteLength=function(e){var t=a(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,o=a(e),s=o[0],c=o[1],l=new i(function(e,t,n){return 3*(t+n)/4-n}(0,s,c)),u=0,d=c>0?s-4:s;for(n=0;n<d;n+=4)t=r[e.charCodeAt(n)]<<18|r[e.charCodeAt(n+1)]<<12|r[e.charCodeAt(n+2)]<<6|r[e.charCodeAt(n+3)],l[u++]=t>>16&255,l[u++]=t>>8&255,l[u++]=255&t;2===c&&(t=r[e.charCodeAt(n)]<<2|r[e.charCodeAt(n+1)]>>4,l[u++]=255&t);1===c&&(t=r[e.charCodeAt(n)]<<10|r[e.charCodeAt(n+1)]<<4|r[e.charCodeAt(n+2)]>>2,l[u++]=t>>8&255,l[u++]=255&t);return l},t.fromByteArray=function(e){for(var t,r=e.length,i=r%3,o=[],s=16383,a=0,l=r-i;a<l;a+=s)o.push(c(e,a,a+s>l?l:a+s));1===i?(t=e[r-1],o.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],o.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return o.join("")};for(var n=[],r=[],i="undefined"!==typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0;s<64;++s)n[s]=o[s],r[o.charCodeAt(s)]=s;function a(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function c(e,t,r){for(var i,o,s=[],a=t;a<r;a+=3)i=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return s.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},9258:(e,t,n)=>{const r=n(4932);function i(e,t,n){const r=e[t]+e[n];let i=e[t+1]+e[n+1];r>=4294967296&&i++,e[t]=r,e[t+1]=i}function o(e,t,n,r){let i=e[t]+n;n<0&&(i+=4294967296);let o=e[t+1]+r;i>=4294967296&&o++,e[t]=i,e[t+1]=o}function s(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function a(e,t,n,r,s,a){const c=d[s],l=d[s+1],f=d[a],h=d[a+1];i(u,e,t),o(u,e,c,l);let p=u[r]^u[e],g=u[r+1]^u[e+1];u[r]=g,u[r+1]=p,i(u,n,r),p=u[t]^u[n],g=u[t+1]^u[n+1],u[t]=p>>>24^g<<8,u[t+1]=g>>>24^p<<8,i(u,e,t),o(u,e,f,h),p=u[r]^u[e],g=u[r+1]^u[e+1],u[r]=p>>>16^g<<16,u[r+1]=g>>>16^p<<16,i(u,n,r),p=u[t]^u[n],g=u[t+1]^u[n+1],u[t]=g>>>31^p<<1,u[t+1]=p>>>31^g<<1}const c=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),l=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3].map((function(e){return 2*e}))),u=new Uint32Array(32),d=new Uint32Array(32);function f(e,t){let n=0;for(n=0;n<16;n++)u[n]=e.h[n],u[n+16]=c[n];for(u[24]=u[24]^e.t,u[25]=u[25]^e.t/4294967296,t&&(u[28]=~u[28],u[29]=~u[29]),n=0;n<32;n++)d[n]=s(e.b,4*n);for(n=0;n<12;n++)a(0,8,16,24,l[16*n+0],l[16*n+1]),a(2,10,18,26,l[16*n+2],l[16*n+3]),a(4,12,20,28,l[16*n+4],l[16*n+5]),a(6,14,22,30,l[16*n+6],l[16*n+7]),a(0,10,20,30,l[16*n+8],l[16*n+9]),a(2,12,22,24,l[16*n+10],l[16*n+11]),a(4,14,16,26,l[16*n+12],l[16*n+13]),a(6,8,18,28,l[16*n+14],l[16*n+15]);for(n=0;n<16;n++)e.h[n]=e.h[n]^u[n]^u[n+16]}const h=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function p(e,t,n,r){if(0===e||e>64)throw new Error("Illegal output length, expected 0 < length <= 64");if(t&&t.length>64)throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");if(n&&16!==n.length)throw new Error("Illegal salt, expected Uint8Array with length is 16");if(r&&16!==r.length)throw new Error("Illegal personal, expected Uint8Array with length is 16");const i={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:e};h.fill(0),h[0]=e,t&&(h[1]=t.length),h[2]=1,h[3]=1,n&&h.set(n,32),r&&h.set(r,48);for(let o=0;o<16;o++)i.h[o]=c[o]^s(h,4*o);return t&&(g(i,t),i.c=128),i}function g(e,t){for(let n=0;n<t.length;n++)128===e.c&&(e.t+=e.c,f(e,!1),e.c=0),e.b[e.c++]=t[n]}function y(e){for(e.t+=e.c;e.c<128;)e.b[e.c++]=0;f(e,!0);const t=new Uint8Array(e.outlen);for(let n=0;n<e.outlen;n++)t[n]=e.h[n>>2]>>8*(3&n);return t}function m(e,t,n,i,o){n=n||64,e=r.normalizeInput(e),i&&(i=r.normalizeInput(i)),o&&(o=r.normalizeInput(o));const s=p(n,t,i,o);return g(s,e),y(s)}e.exports={blake2b:m,blake2bHex:function(e,t,n,i,o){const s=m(e,t,n,i,o);return r.toHex(s)},blake2bInit:p,blake2bUpdate:g,blake2bFinal:y}},249:(e,t,n)=>{const r=n(4932);function i(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function o(e,t,n,r,i,o){l[e]=l[e]+l[t]+i,l[r]=s(l[r]^l[e],16),l[n]=l[n]+l[r],l[t]=s(l[t]^l[n],12),l[e]=l[e]+l[t]+o,l[r]=s(l[r]^l[e],8),l[n]=l[n]+l[r],l[t]=s(l[t]^l[n],7)}function s(e,t){return e>>>t^e<<32-t}const a=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),c=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),l=new Uint32Array(16),u=new Uint32Array(16);function d(e,t){let n=0;for(n=0;n<8;n++)l[n]=e.h[n],l[n+8]=a[n];for(l[12]^=e.t,l[13]^=e.t/4294967296,t&&(l[14]=~l[14]),n=0;n<16;n++)u[n]=i(e.b,4*n);for(n=0;n<10;n++)o(0,4,8,12,u[c[16*n+0]],u[c[16*n+1]]),o(1,5,9,13,u[c[16*n+2]],u[c[16*n+3]]),o(2,6,10,14,u[c[16*n+4]],u[c[16*n+5]]),o(3,7,11,15,u[c[16*n+6]],u[c[16*n+7]]),o(0,5,10,15,u[c[16*n+8]],u[c[16*n+9]]),o(1,6,11,12,u[c[16*n+10]],u[c[16*n+11]]),o(2,7,8,13,u[c[16*n+12]],u[c[16*n+13]]),o(3,4,9,14,u[c[16*n+14]],u[c[16*n+15]]);for(n=0;n<8;n++)e.h[n]^=l[n]^l[n+8]}function f(e,t){if(!(e>0&&e<=32))throw new Error("Incorrect output length, should be in [1, 32]");const n=t?t.length:0;if(t&&!(n>0&&n<=32))throw new Error("Incorrect key length, should be in [1, 32]");const r={h:new Uint32Array(a),b:new Uint8Array(64),c:0,t:0,outlen:e};return r.h[0]^=16842752^n<<8^e,n>0&&(h(r,t),r.c=64),r}function h(e,t){for(let n=0;n<t.length;n++)64===e.c&&(e.t+=e.c,d(e,!1),e.c=0),e.b[e.c++]=t[n]}function p(e){for(e.t+=e.c;e.c<64;)e.b[e.c++]=0;d(e,!0);const t=new Uint8Array(e.outlen);for(let n=0;n<e.outlen;n++)t[n]=e.h[n>>2]>>8*(3&n)&255;return t}function g(e,t,n){n=n||32,e=r.normalizeInput(e);const i=f(n,t);return h(i,e),p(i)}e.exports={blake2s:g,blake2sHex:function(e,t,n){const i=g(e,t,n);return r.toHex(i)},blake2sInit:f,blake2sUpdate:h,blake2sFinal:p}},6823:(e,t,n)=>{const r=n(9258),i=n(249);e.exports={blake2b:r.blake2b,blake2bHex:r.blake2bHex,blake2bInit:r.blake2bInit,blake2bUpdate:r.blake2bUpdate,blake2bFinal:r.blake2bFinal,blake2s:i.blake2s,blake2sHex:i.blake2sHex,blake2sInit:i.blake2sInit,blake2sUpdate:i.blake2sUpdate,blake2sFinal:i.blake2sFinal}},4932:e=>{function t(e){return(4294967296+e).toString(16).substring(1)}e.exports={normalizeInput:function(e){let t;if(e instanceof Uint8Array)t=e;else{if("string"!==typeof e)throw new Error("Input must be an string, Buffer or Uint8Array");t=(new TextEncoder).encode(e)}return t},toHex:function(e){return Array.prototype.map.call(e,(function(e){return(e<16?"0":"")+e.toString(16)})).join("")},debugPrint:function(e,n,r){let i="\n"+e+" = ";for(let o=0;o<n.length;o+=2){if(32===r)i+=t(n[o]).toUpperCase(),i+=" ",i+=t(n[o+1]).toUpperCase();else{if(64!==r)throw new Error("Invalid size "+r);i+=t(n[o+1]).toUpperCase(),i+=t(n[o]).toUpperCase()}o%6===4?i+="\n"+new Array(e.length+4).join(" "):o<n.length-2&&(i+=" ")}console.log(i)},testSpeed:function(e,t,n){let r=(new Date).getTime();const i=new Uint8Array(t);for(let s=0;s<t;s++)i[s]=s%256;const o=(new Date).getTime();console.log("Generated random input in "+(o-r)+"ms"),r=o;for(let s=0;s<n;s++){const n=e(i),o=(new Date).getTime(),s=o-r;r=o,console.log("Hashed in "+s+"ms: "+n.substring(0,20)+"..."),console.log(Math.round(t/(1<<20)/(s/1e3)*100)/100+" MB PER SECOND")}}}},5701:(e,t,n)=>{"use strict";const r=n(956),i=n(4153),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,n){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 l(e,t,n)}function l(e,t,n){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 n=0|g(e,t);let r=a(n);const i=r.write(e,t);i!==n&&(r=r.slice(0,i));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(Z(e,Uint8Array)){const t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return f(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(Z(e,ArrayBuffer)||e&&Z(e.buffer,ArrayBuffer))return h(e,t,n);if("undefined"!==typeof SharedArrayBuffer&&(Z(e,SharedArrayBuffer)||e&&Z(e.buffer,SharedArrayBuffer)))return h(e,t,n);if("number"===typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return c.from(r,t,n);const i=function(e){if(c.isBuffer(e)){const t=0|p(e.length),n=a(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!==typeof e.length||X(e.length)?a(0):f(e);if("Buffer"===e.type&&Array.isArray(e.data))return f(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,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(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 u(e),a(e<0?0:0|p(e))}function f(e){const t=e.length<0?0:0|p(e.length),n=a(t);for(let r=0;r<t;r+=1)n[r]=255&e[r];return n}function h(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,c.prototype),r}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 g(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Z(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 n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return W(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return G(e).length;default:if(i)return r?-1:W(e).length;t=(""+t).toLowerCase(),i=!0}}function y(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return k(this,t,n);case"utf8":case"utf-8":return O(this,t,n);case"ascii":return T(this,t,n);case"latin1":case"binary":return R(this,t,n);case"base64":return I(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function m(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function v(e,t,n,r,i){if(0===e.length)return-1;if("string"===typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),X(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"===typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:b(e,t,n,r,i);if("number"===typeof t)return t&=255,"function"===typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):b(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function b(e,t,n,r,i){let o,s=1,a=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,n/=2}function l(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){let r=-1;for(o=n;o<a;o++)if(l(e,o)===l(t,-1===r?0:o-r)){if(-1===r&&(r=o),o-r+1===c)return r*s}else-1!==r&&(o-=o-r),r=-1}else for(n+c>a&&(n=a-c),o=n;o>=0;o--){let n=!0;for(let r=0;r<c;r++)if(l(e,o+r)!==l(t,r)){n=!1;break}if(n)return o}return-1}function w(e,t,n,r){n=Number(n)||0;const i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;const o=t.length;let s;for(r>o/2&&(r=o/2),s=0;s<r;++s){const r=parseInt(t.substr(2*s,2),16);if(X(r))return s;e[n+s]=r}return s}function E(e,t,n,r){return Y(W(t,e.length-n),e,n,r)}function _(e,t,n,r){return Y(function(e){const t=[];for(let n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function S(e,t,n,r){return Y(G(t),e,n,r)}function x(e,t,n,r){return Y(function(e,t){let n,r,i;const o=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)n=e.charCodeAt(s),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function I(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function O(e,t,n){n=Math.min(e.length,n);const r=[];let i=t;for(;i<n;){const t=e[i];let o=null,s=t>239?4:t>223?3:t>191?2:1;if(i+s<=n){let n,r,a,c;switch(s){case 1:t<128&&(o=t);break;case 2:n=e[i+1],128===(192&n)&&(c=(31&t)<<6|63&n,c>127&&(o=c));break;case 3:n=e[i+1],r=e[i+2],128===(192&n)&&128===(192&r)&&(c=(15&t)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:n=e[i+1],r=e[i+2],a=e[i+3],128===(192&n)&&128===(192&r)&&128===(192&a)&&(c=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&a,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=s}return function(e){const t=e.length;if(t<=A)return String.fromCharCode.apply(String,e);let n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=A));return n}(r)}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,n){return l(e,t,n)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(e,t,n){return function(e,t,n){return u(e),e<=0?a(e):void 0!==t?"string"===typeof n?a(e).fill(t,n):a(e).fill(t):a(e)}(e,t,n)},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(Z(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),Z(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 n=e.length,r=t.length;for(let i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?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 n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;const r=c.allocUnsafe(t);let i=0;for(n=0;n<e.length;++n){let t=e[n];if(Z(t,Uint8Array))i+t.length>r.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,i)}i+=t.length}return r},c.byteLength=g,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?O(this,0,e):y.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 n=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(e+=" ... "),"<Buffer "+e+">"},o&&(c.prototype[o]=c.prototype.inspect),c.prototype.compare=function(e,t,n,r,i){if(Z(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===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;let o=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0);const a=Math.min(o,s),l=this.slice(r,i),u=e.slice(t,n);for(let c=0;c<a;++c)if(l[c]!==u[c]){o=l[c],s=u[c];break}return o<s?-1:s<o?1:0},c.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},c.prototype.indexOf=function(e,t,n){return v(this,e,t,n,!0)},c.prototype.lastIndexOf=function(e,t,n){return v(this,e,t,n,!1)},c.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"===typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return w(this,e,t,n);case"utf8":case"utf-8":return E(this,e,t,n);case"ascii":case"latin1":case"binary":return _(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const A=4096;function T(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function R(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function k(e,t,n){const r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i="";for(let o=t;o<n;++o)i+=Q[e[o]];return i}function P(e,t,n){const r=e.slice(t,n);let i="";for(let o=0;o<r.length-1;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function C(e,t,n){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,n,r,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(n+r>e.length)throw new RangeError("Index out of range")}function U(e,t,n,r,i){q(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,n}function B(e,t,n,r,i){q(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n+7]=o,o>>=8,e[n+6]=o,o>>=8,e[n+5]=o,o>>=8,e[n+4]=o;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=s,s>>=8,e[n+2]=s,s>>=8,e[n+1]=s,s>>=8,e[n]=s,n+8}function L(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function D(e,t,n,r,o){return t=+t,n>>>=0,o||L(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function j(e,t,n,r,o){return t=+t,n>>>=0,o||L(e,0,n,8),i.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);const r=this.subarray(e,t);return Object.setPrototypeOf(r,c.prototype),r},c.prototype.readUintLE=c.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||C(e,t,this.length);let r=this[e],i=1,o=0;for(;++o<t&&(i*=256);)r+=this[e+o]*i;return r},c.prototype.readUintBE=c.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||C(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||C(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||C(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||C(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||C(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||C(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=J((function(e){H(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||V(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))})),c.prototype.readBigUInt64BE=J((function(e){H(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||V(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<<BigInt(32))+BigInt(i)})),c.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||C(e,t,this.length);let r=this[e],i=1,o=0;for(;++o<t&&(i*=256);)r+=this[e+o]*i;return i*=128,r>=i&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||C(e,t,this.length);let r=t,i=1,o=this[e+--r];for(;r>0&&(i*=256);)o+=this[e+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return e>>>=0,t||C(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||C(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){e>>>=0,t||C(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||C(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||C(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=J((function(e){H(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||V(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),c.prototype.readBigInt64BE=J((function(e){H(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||V(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+n)})),c.prototype.readFloatLE=function(e,t){return e>>>=0,t||C(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||C(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||C(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||C(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){N(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=1,o=0;for(this[t]=255&e;++o<n&&(i*=256);)this[t+o]=e/i&255;return t+n},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){N(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=J((function(e){return U(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=J((function(e){return B(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);N(this,e,t,n,r-1,-r)}let i=0,o=1,s=0;for(this[t]=255&e;++i<n&&(o*=256);)e<0&&0===s&&0!==this[t+i-1]&&(s=1),this[t+i]=(e/o|0)-s&255;return t+n},c.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);N(this,e,t,n,r-1,-r)}let i=n-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+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=J((function(e){return U(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=J((function(e){return B(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(e,t,n){return D(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return D(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return j(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return j(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);const i=r-n;return this===e&&"function"===typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},c.prototype.fill=function(e,t,n,r){if("string"===typeof e){if("string"===typeof t?(r=t,t=0,n=this.length):"string"===typeof n&&(r=n,n=this.length),void 0!==r&&"string"!==typeof r)throw new TypeError("encoding must be a string");if("string"===typeof r&&!c.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===e.length){const t=e.charCodeAt(0);("utf8"===r&&t<128||"latin1"===r)&&(e=t)}}else"number"===typeof e?e&=255:"boolean"===typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;let i;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"===typeof e)for(i=t;i<n;++i)this[i]=e;else{const o=c.isBuffer(e)?e:c.from(e,r),s=o.length;if(0===s)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<n-t;++i)this[i+t]=o[i%s]}return this};const M={};function F(e,t,n){M[e]=class extends n{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 z(e){let t="",n=e.length;const r="-"===e[0]?1:0;for(;n>=r+4;n-=3)t="_".concat(e.slice(n-3,n)).concat(t);return"".concat(e.slice(0,n)).concat(t)}function q(e,t,n,r,i,o){if(e>n||e<t){const r="bigint"===typeof t?"n":"";let i;throw i=o>3?0===t||t===BigInt(0)?">= 0".concat(r," and < 2").concat(r," ** ").concat(8*(o+1)).concat(r):">= -(2".concat(r," ** ").concat(8*(o+1)-1).concat(r,") and < 2 ** ")+"".concat(8*(o+1)-1).concat(r):">= ".concat(t).concat(r," and <= ").concat(n).concat(r),new M.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,n){H(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||V(t,e.length-(n+1))}(r,i,o)}function H(e,t){if("number"!==typeof e)throw new M.ERR_INVALID_ARG_TYPE(t,"number",e)}function V(e,t,n){if(Math.floor(e)!==e)throw H(e,n),new M.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new M.ERR_BUFFER_OUT_OF_BOUNDS;throw new M.ERR_OUT_OF_RANGE(n||"offset",">= ".concat(n?1:0," and <= ").concat(t),e)}F("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?"".concat(e," is outside of buffer bounds"):"Attempt to access memory outside buffer bounds"}),RangeError),F("ERR_INVALID_ARG_TYPE",(function(e,t){return'The "'.concat(e,'" argument must be of type number. Received type ').concat(typeof t)}),TypeError),F("ERR_OUT_OF_RANGE",(function(e,t,n){let r='The value of "'.concat(e,'" is out of range.'),i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=z(String(n)):"bigint"===typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=z(i)),i+="n"),r+=" It must be ".concat(t,". Received ").concat(i),r}),RangeError);const K=/[^+/0-9A-Za-z-_]/g;function W(e,t){let n;t=t||1/0;const r=e.length;let i=null;const o=[];for(let s=0;s<r;++s){if(n=e.charCodeAt(s),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function G(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(K,"")).length<2)return"";for(;e.length%4!==0;)e+="=";return e}(e))}function Y(e,t,n,r){let i;for(i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function Z(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function X(e){return e!==e}const Q=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t}();function J(e){return"undefined"===typeof BigInt?$:e}function $(){throw new Error("BigInt not supported")}},1871:function(e,t){var n="undefined"!==typeof self?self:this,r=function(){function e(){this.fetch=!1,this.DOMException=n.DOMException}return e.prototype=n,new e}();!function(e){!function(t){var n="URLSearchParams"in e,r="Symbol"in e&&"iterator"in Symbol,i="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),o="FormData"in e,s="ArrayBuffer"in e;if(s)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(e){return e&&a.indexOf(Object.prototype.toString.call(e))>-1};function l(e){if("string"!==typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function u(e){return"string"!==typeof e&&(e=String(e)),e}function d(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r&&(t[Symbol.iterator]=function(){return t}),t}function f(e){this.map={},e instanceof f?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function h(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function p(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function g(e){var t=new FileReader,n=p(t);return t.readAsArrayBuffer(e),n}function y(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function m(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"===typeof e?this._bodyText=e:i&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:o&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:n&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():s&&i&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=y(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(e)||c(e))?this._bodyArrayBuffer=y(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"===typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var e=h(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?h(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(g)}),this.text=function(){var e=h(this);if(e)return e;if(this._bodyBlob)return function(e){var t=new FileReader,n=p(t);return t.readAsText(e),n}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r<t.length;r++)n[r]=String.fromCharCode(t[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o&&(this.formData=function(){return this.text().then(w)}),this.json=function(){return this.text().then(JSON.parse)},this}f.prototype.append=function(e,t){e=l(e),t=u(t);var n=this.map[e];this.map[e]=n?n+", "+t:t},f.prototype.delete=function(e){delete this.map[l(e)]},f.prototype.get=function(e){return e=l(e),this.has(e)?this.map[e]:null},f.prototype.has=function(e){return this.map.hasOwnProperty(l(e))},f.prototype.set=function(e,t){this.map[l(e)]=u(t)},f.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},f.prototype.keys=function(){var e=[];return this.forEach((function(t,n){e.push(n)})),d(e)},f.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),d(e)},f.prototype.entries=function(){var e=[];return this.forEach((function(t,n){e.push([n,t])})),d(e)},r&&(f.prototype[Symbol.iterator]=f.prototype.entries);var v=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function b(e,t){var n=(t=t||{}).body;if(e instanceof b){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new f(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,n||null==e._bodyInit||(n=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new f(t.headers)),this.method=function(e){var t=e.toUpperCase();return v.indexOf(t)>-1?t:e}(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function w(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(i))}})),t}function E(e){var t=new f;return e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var n=e.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();t.append(r,i)}})),t}function _(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new f(t.headers),this.url=t.url||"",this._initBody(e)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},m.call(b.prototype),m.call(_.prototype),_.prototype.clone=function(){return new _(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},_.error=function(){var e=new _(null,{status:0,statusText:""});return e.type="error",e};var S=[301,302,303,307,308];_.redirect=function(e,t){if(-1===S.indexOf(t))throw new RangeError("Invalid status code");return new _(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(I){t.DOMException=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function x(e,n){return new Promise((function(r,o){var s=new b(e,n);if(s.signal&&s.signal.aborted)return o(new t.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function c(){a.abort()}a.onload=function(){var e={status:a.status,statusText:a.statusText,headers:E(a.getAllResponseHeaders()||"")};e.url="responseURL"in a?a.responseURL:e.headers.get("X-Request-URL");var t="response"in a?a.response:a.responseText;r(new _(t,e))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.onabort=function(){o(new t.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&i&&(a.responseType="blob"),s.headers.forEach((function(e,t){a.setRequestHeader(t,e)})),s.signal&&(s.signal.addEventListener("abort",c),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",c)}),a.send("undefined"===typeof s._bodyInit?null:s._bodyInit)}))}x.polyfill=!0,e.fetch||(e.fetch=x,e.Headers=f,e.Request=b,e.Response=_),t.Headers=f,t.Request=b,t.Response=_,t.fetch=x,Object.defineProperty(t,"__esModule",{value:!0})}({})}(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;(t=i.fetch).default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t},6973:e=>{"use strict";var t,n="object"===typeof Reflect?Reflect:null,r=n&&"function"===typeof n.apply?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};t=n&&"function"===typeof n.ownKeys?n.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(n,r){function i(n){e.removeListener(t,o),r(n)}function o(){"function"===typeof e.removeListener&&e.removeListener("error",i),n([].slice.call(arguments))}g(e,t,o,{once:!0}),"error"!==t&&function(e,t,n){"function"===typeof e.on&&g(e,"error",t,n)}(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 l(e,t,n,r){var i,o,s,l;if(a(n),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),s=o[t]),void 0===s)s=o[t]=n,++e._eventsCount;else if("function"===typeof s?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),(i=c(e))>0&&s.length>i&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=s.length,l=u,console&&console.warn&&console.warn(l)}return e}function u(){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,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=u.bind(r);return i.listener=n,r.wrapFn=i,i}function f(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"===typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(i):p(i,i.length)}function h(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"===typeof n)return 1;if(void 0!==n)return n.length}return 0}function p(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function g(e,t,n,r){if("function"===typeof e.on)r.once?e.once(t,n):e.on(t,n);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){r.once&&e.removeEventListener(t,i),n(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=[],n=1;n<arguments.length;n++)t.push(arguments[n]);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)r(c,this,t);else{var l=c.length,u=p(c,l);for(n=0;n<l;++n)r(u[n],this,t)}return!0},o.prototype.addListener=function(e,t){return l(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return l(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 n,r,i,o,s;if(a(t),void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0===--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!==typeof n){for(i=-1,o=n.length-1;o>=0;o--)if(n[o]===t||n[o].listener===t){s=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,i),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,s||t)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0===--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var i,o=Object.keys(n);for(r=0;r<o.length;++r)"removeListener"!==(i=o[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"===typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},o.prototype.listeners=function(e){return f(this,e,!0)},o.prototype.rawListeners=function(e){return f(this,e,!1)},o.listenerCount=function(e,t){return"function"===typeof e.listenerCount?e.listenerCount(t):h.call(e,t)},o.prototype.listenerCount=h,o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},4153:(e,t)=>{t.read=function(e,t,n,r,i){var o,s,a=8*i-r-1,c=(1<<a)-1,l=c>>1,u=-7,d=n?i-1:0,f=n?-1:1,h=e[t+d];for(d+=f,o=h&(1<<-u)-1,h>>=-u,u+=a;u>0;o=256*o+e[t+d],d+=f,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=r;u>0;s=256*s+e[t+d],d+=f,u-=8);if(0===o)o=1-l;else{if(o===c)return s?NaN:1/0*(h?-1:1);s+=Math.pow(2,r),o-=l}return(h?-1:1)*s*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var s,a,c,l=8*o-i-1,u=(1<<l)-1,d=u>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:o-1,p=r?1:-1,g=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=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+d>=1?f/c:f*Math.pow(2,1-d))*c>=2&&(s++,c/=2),s+d>=u?(a=0,s=u):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[n+h]=255&a,h+=p,a/=256,i-=8);for(s=s<<i|a,l+=i;l>0;e[n+h]=255&s,h+=p,s/=256,l-=8);e[n+h-p]|=128*g}},5165:e=>{"use strict";e.exports=function(e,t,n,r,i,o,s,a){if(!e){var c;if(void 0===t)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[n,r,i,o,s,a],u=0;(c=new Error(t.replace(/%s/g,(function(){return l[u++]})))).name="Invariant Violation"}throw c.framesToPop=1,c}}},3384:(e,t,n)=>{"use strict";var r=n(9711);function i(){}function o(){}o.resetWarningCache=i,e.exports=function(){function e(e,t,n,i,o,s){if(s!==r){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:o,resetWarningCache:i};return n.PropTypes=n,n}},5982:(e,t,n)=>{e.exports=n(3384)()},9711:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},3969:(e,t,n)=>{"use strict";var r=n(1462),i=n(6756);function o(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);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){l(e,t),l(e+"Capture",t)}function l(e,t){for(a[e]=t,e=0;e<t.length;e++)s.add(t[e])}var u=!("undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement),d=Object.prototype.hasOwnProperty,f=/^[: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]*$/,h={},p={};function g(e,t,n,r,i,o,s){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=s}var y={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach((function(e){y[e]=new g(e,0,!1,e,null,!1,!1)})),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach((function(e){var t=e[0];y[t]=new g(t,1,!1,e[1],null,!1,!1)})),["contentEditable","draggable","spellCheck","value"].forEach((function(e){y[e]=new g(e,2,!1,e.toLowerCase(),null,!1,!1)})),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach((function(e){y[e]=new g(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){y[e]=new g(e,3,!1,e.toLowerCase(),null,!1,!1)})),["checked","multiple","muted","selected"].forEach((function(e){y[e]=new g(e,3,!0,e,null,!1,!1)})),["capture","download"].forEach((function(e){y[e]=new g(e,4,!1,e,null,!1,!1)})),["cols","rows","size","span"].forEach((function(e){y[e]=new g(e,6,!1,e,null,!1,!1)})),["rowSpan","start"].forEach((function(e){y[e]=new g(e,5,!1,e.toLowerCase(),null,!1,!1)}));var m=/[\-:]([a-z])/g;function v(e){return e[1].toUpperCase()}function b(e,t,n,r){var i=y.hasOwnProperty(t)?y[t]:null;(null!==i?0!==i.type:r||!(2<t.length)||"o"!==t[0]&&"O"!==t[0]||"n"!==t[1]&&"N"!==t[1])&&(function(e,t,n,r){if(null===t||"undefined"===typeof t||function(e,t,n,r){if(null!==n&&0===n.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!r&&(null!==n?!n.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,t,n,r))return!0;if(r)return!1;if(null!==n)switch(n.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,n,i,r)&&(n=null),r||null===i?function(e){return!!d.call(p,e)||!d.call(h,e)&&(f.test(e)?p[e]=!0:(h[e]=!0,!1))}(t)&&(null===n?e.removeAttribute(t):e.setAttribute(t,""+n)):i.mustUseProperty?e[i.propertyName]=null===n?3!==i.type&&"":n:(t=i.attributeName,r=i.attributeNamespace,null===n?e.removeAttribute(t):(n=3===(i=i.type)||4===i&&!0===n?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach((function(e){var t=e.replace(m,v);y[t]=new g(t,1,!1,e,null,!1,!1)})),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach((function(e){var t=e.replace(m,v);y[t]=new g(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)})),["xml:base","xml:lang","xml:space"].forEach((function(e){var t=e.replace(m,v);y[t]=new g(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)})),["tabIndex","crossOrigin"].forEach((function(e){y[e]=new g(e,1,!1,e.toLowerCase(),null,!1,!1)})),y.xlinkHref=new g("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach((function(e){y[e]=new g(e,1,!1,e.toLowerCase(),null,!0,!0)}));var w=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,E=Symbol.for("react.element"),_=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),x=Symbol.for("react.strict_mode"),I=Symbol.for("react.profiler"),O=Symbol.for("react.provider"),A=Symbol.for("react.context"),T=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),k=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),C=Symbol.for("react.lazy");Symbol.for("react.scope"),Symbol.for("react.debug_trace_mode");var N=Symbol.for("react.offscreen");Symbol.for("react.legacy_hidden"),Symbol.for("react.cache"),Symbol.for("react.tracing_marker");var U=Symbol.iterator;function B(e){return null===e||"object"!==typeof e?null:"function"===typeof(e=U&&e[U]||e["@@iterator"])?e:null}var L,D=Object.assign;function j(e){if(void 0===L)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);L=t&&t[1]||""}return"\n"+L+e}var M=!1;function F(e,t){if(!e||M)return"";M=!0;var n=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(l){var r=l}Reflect.construct(e,[],t)}else{try{t.call()}catch(l){r=l}e.call(t.prototype)}else{try{throw Error()}catch(l){r=l}e()}}catch(l){if(l&&r&&"string"===typeof l.stack){for(var i=l.stack.split("\n"),o=r.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{M=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?j(e):""}function z(e){switch(e.tag){case 5:return j(e.type);case 16:return j("Lazy");case 13:return j("Suspense");case 19:return j("SuspenseList");case 0:case 2:case 15:return e=F(e.type,!1);case 11:return e=F(e.type.render,!1);case 1:return e=F(e.type,!0);default:return""}}function q(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 I:return"Profiler";case x:return"StrictMode";case R:return"Suspense";case k:return"SuspenseList"}if("object"===typeof e)switch(e.$$typeof){case A:return(e.displayName||"Context")+".Consumer";case O:return(e._context.displayName||"Context")+".Provider";case T:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case P:return null!==(t=e.displayName||null)?t:q(e.type)||"Memo";case C:t=e._payload,e=e._init;try{return q(e(t))}catch(n){}}return null}function H(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 q(t);case 8:return t===x?"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 V(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function K(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function W(e){e._valueTracker||(e._valueTracker=function(e){var t=K(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&"undefined"!==typeof n&&"function"===typeof n.get&&"function"===typeof n.set){var i=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=""+e,o.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function G(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=K(e)?e.checked?"true":"false":e.value),(e=r)!==n&&(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 Z(e,t){var n=t.checked;return D({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=n?n:e._wrapperState.initialChecked})}function X(e,t){var n=null==t.defaultValue?"":t.defaultValue,r=null!=t.checked?t.checked:t.defaultChecked;n=V(null!=t.value?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function Q(e,t){null!=(t=t.checked)&&b(e,"checked",t,!1)}function J(e,t){Q(e,t);var n=V(t.value),r=t.type;if(null!=n)"number"===r?(0===n&&""===e.value||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if("submit"===r||"reset"===r)return void e.removeAttribute("value");t.hasOwnProperty("value")?ee(e,t.type,n):t.hasOwnProperty("defaultValue")&&ee(e,t.type,V(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function $(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!("submit"!==r&&"reset"!==r||void 0!==t.value&&null!==t.value))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}""!==(n=e.name)&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,""!==n&&(e.name=n)}function ee(e,t,n){"number"===t&&Y(e.ownerDocument)===e||(null==n?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var te=Array.isArray;function ne(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t["$"+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty("$"+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=""+V(n),t=null,i=0;i<e.length;i++){if(e[i].value===n)return e[i].selected=!0,void(r&&(e[i].defaultSelected=!0));null!==t||e[i].disabled||(t=e[i])}null!==t&&(t.selected=!0)}}function re(e,t){if(null!=t.dangerouslySetInnerHTML)throw Error(o(91));return D({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function ie(e,t){var n=t.value;if(null==n){if(n=t.children,t=t.defaultValue,null!=n){if(null!=t)throw Error(o(92));if(te(n)){if(1<n.length)throw Error(o(93));n=n[0]}t=n}null==t&&(t=""),n=t}e._wrapperState={initialValue:V(n)}}function oe(e,t){var n=V(t.value),r=V(t.defaultValue);null!=n&&((n=""+n)!==e.value&&(e.value=n),null==t.defaultValue&&e.defaultValue!==n&&(e.defaultValue=n)),null!=r&&(e.defaultValue=""+r)}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 le,ue,de=(ue=function(e,t){if("http://www.w3.org/2000/svg"!==e.namespaceURI||"innerHTML"in e)e.innerHTML=t;else{for((le=le||document.createElement("div")).innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=le.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}},"undefined"!==typeof MSApp&&MSApp.execUnsafeLocalFunction?function(e,t,n,r){MSApp.execUnsafeLocalFunction((function(){return ue(e,t)}))}:ue);function fe(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}var he={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 ge(e,t,n){return null==t||"boolean"===typeof t||""===t?"":n||"number"!==typeof t||0===t||he.hasOwnProperty(e)&&he[e]?(""+t).trim():t+"px"}function ye(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=0===n.indexOf("--"),i=ge(n,t[n],r);"float"===n&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}Object.keys(he).forEach((function(e){pe.forEach((function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),he[t]=he[e]}))}));var me=D({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ve(e,t){if(t){if(me[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML))throw Error(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 be(e,t){if(-1===e.indexOf("-"))return"string"===typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var we=null;function Ee(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var _e=null,Se=null,xe=null;function Ie(e){if(e=bi(e)){if("function"!==typeof _e)throw Error(o(280));var t=e.stateNode;t&&(t=Ei(t),_e(e.stateNode,e.type,t))}}function Oe(e){Se?xe?xe.push(e):xe=[e]:Se=e}function Ae(){if(Se){var e=Se,t=xe;if(xe=Se=null,Ie(e),t)for(e=0;e<t.length;e++)Ie(t[e])}}function Te(e,t){return e(t)}function Re(){}var ke=!1;function Pe(e,t,n){if(ke)return e(t,n);ke=!0;try{return Te(e,t,n)}finally{ke=!1,(null!==Se||null!==xe)&&(Re(),Ae())}}function Ce(e,t){var n=e.stateNode;if(null===n)return null;var r=Ei(n);if(null===r)return null;n=r[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":(r=!r.disabled)||(r=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!r;break e;default:e=!1}if(e)return null;if(n&&"function"!==typeof n)throw Error(o(231,t,typeof n));return n}var Ne=!1;if(u)try{var Ue={};Object.defineProperty(Ue,"passive",{get:function(){Ne=!0}}),window.addEventListener("test",Ue,Ue),window.removeEventListener("test",Ue,Ue)}catch(ue){Ne=!1}function Be(e,t,n,r,i,o,s,a,c){var l=Array.prototype.slice.call(arguments,3);try{t.apply(n,l)}catch(u){this.onError(u)}}var Le=!1,De=null,je=!1,Me=null,Fe={onError:function(e){Le=!0,De=e}};function ze(e,t,n,r,i,o,s,a,c){Le=!1,De=null,Be.apply(Fe,arguments)}function qe(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{0!==(4098&(t=e).flags)&&(n=t.return),e=t.return}while(e)}return 3===t.tag?n:null}function He(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 Ve(e){if(qe(e)!==e)throw Error(o(188))}function Ke(e){return null!==(e=function(e){var t=e.alternate;if(!t){if(null===(t=qe(e)))throw Error(o(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(null===i)break;var s=i.alternate;if(null===s){if(null!==(r=i.return)){n=r;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===n)return Ve(i),e;if(s===r)return Ve(i),t;s=s.sibling}throw Error(o(188))}if(n.return!==r.return)n=i,r=s;else{for(var a=!1,c=i.child;c;){if(c===n){a=!0,n=i,r=s;break}if(c===r){a=!0,r=i,n=s;break}c=c.sibling}if(!a){for(c=s.child;c;){if(c===n){a=!0,n=s,r=i;break}if(c===r){a=!0,r=s,n=i;break}c=c.sibling}if(!a)throw Error(o(189))}}if(n.alternate!==r)throw Error(o(190))}if(3!==n.tag)throw Error(o(188));return n.stateNode.current===n?e:t}(e))?We(e):null}function We(e){if(5===e.tag||6===e.tag)return e;for(e=e.child;null!==e;){var t=We(e);if(null!==t)return t;e=e.sibling}return null}var Ge=i.unstable_scheduleCallback,Ye=i.unstable_cancelCallback,Ze=i.unstable_shouldYield,Xe=i.unstable_requestPaint,Qe=i.unstable_now,Je=i.unstable_getCurrentPriorityLevel,$e=i.unstable_ImmediatePriority,et=i.unstable_UserBlockingPriority,tt=i.unstable_NormalPriority,nt=i.unstable_LowPriority,rt=i.unstable_IdlePriority,it=null,ot=null;var st=Math.clz32?Math.clz32:function(e){return e>>>=0,0===e?32:31-(at(e)/ct|0)|0},at=Math.log,ct=Math.LN2;var lt=64,ut=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 ft(e,t){var n=e.pendingLanes;if(0===n)return 0;var r=0,i=e.suspendedLanes,o=e.pingedLanes,s=268435455&n;if(0!==s){var a=s&~i;0!==a?r=dt(a):0!==(o&=s)&&(r=dt(o))}else 0!==(s=n&~i)?r=dt(s):0!==o&&(r=dt(o));if(0===r)return 0;if(0!==t&&t!==r&&0===(t&i)&&((i=r&-r)>=(o=t&-t)||16===i&&0!==(4194240&o)))return t;if(0!==(4&r)&&(r|=16&n),0!==(t=e.entangledLanes))for(e=e.entanglements,t&=r;0<t;)i=1<<(n=31-st(t)),r|=e[n],t&=~i;return r}function ht(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 gt(){var e=lt;return 0===(4194240&(lt<<=1))&&(lt=64),e}function yt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function mt(e,t,n){e.pendingLanes|=t,536870912!==t&&(e.suspendedLanes=0,e.pingedLanes=0),(e=e.eventTimes)[t=31-st(t)]=n}function vt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-st(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var bt=0;function wt(e){return 1<(e&=-e)?4<e?0!==(268435455&e)?16:536870912:4:1}var Et,_t,St,xt,It,Ot=!1,At=[],Tt=null,Rt=null,kt=null,Pt=new Map,Ct=new Map,Nt=[],Ut="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 Bt(e,t){switch(e){case"focusin":case"focusout":Tt=null;break;case"dragenter":case"dragleave":Rt=null;break;case"mouseover":case"mouseout":kt=null;break;case"pointerover":case"pointerout":Pt.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ct.delete(t.pointerId)}}function Lt(e,t,n,r,i,o){return null===e||e.nativeEvent!==o?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:o,targetContainers:[i]},null!==t&&(null!==(t=bi(t))&&_t(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,null!==i&&-1===t.indexOf(i)&&t.push(i),e)}function Dt(e){var t=vi(e.target);if(null!==t){var n=qe(t);if(null!==n)if(13===(t=n.tag)){if(null!==(t=He(n)))return e.blockedOn=t,void It(e.priority,(function(){St(n)}))}else if(3===t&&n.stateNode.current.memoizedState.isDehydrated)return void(e.blockedOn=3===n.tag?n.stateNode.containerInfo:null)}e.blockedOn=null}function jt(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var n=Zt(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(null!==n)return null!==(t=bi(n))&&_t(t),e.blockedOn=n,!1;var r=new(n=e.nativeEvent).constructor(n.type,n);we=r,n.target.dispatchEvent(r),we=null,t.shift()}return!0}function Mt(e,t,n){jt(e)&&n.delete(t)}function Ft(){Ot=!1,null!==Tt&&jt(Tt)&&(Tt=null),null!==Rt&&jt(Rt)&&(Rt=null),null!==kt&&jt(kt)&&(kt=null),Pt.forEach(Mt),Ct.forEach(Mt)}function zt(e,t){e.blockedOn===t&&(e.blockedOn=null,Ot||(Ot=!0,i.unstable_scheduleCallback(i.unstable_NormalPriority,Ft)))}function qt(e){function t(t){return zt(t,e)}if(0<At.length){zt(At[0],e);for(var n=1;n<At.length;n++){var r=At[n];r.blockedOn===e&&(r.blockedOn=null)}}for(null!==Tt&&zt(Tt,e),null!==Rt&&zt(Rt,e),null!==kt&&zt(kt,e),Pt.forEach(t),Ct.forEach(t),n=0;n<Nt.length;n++)(r=Nt[n]).blockedOn===e&&(r.blockedOn=null);for(;0<Nt.length&&null===(n=Nt[0]).blockedOn;)Dt(n),null===n.blockedOn&&Nt.shift()}var Ht=w.ReactCurrentBatchConfig,Vt=!0;function Kt(e,t,n,r){var i=bt,o=Ht.transition;Ht.transition=null;try{bt=1,Gt(e,t,n,r)}finally{bt=i,Ht.transition=o}}function Wt(e,t,n,r){var i=bt,o=Ht.transition;Ht.transition=null;try{bt=4,Gt(e,t,n,r)}finally{bt=i,Ht.transition=o}}function Gt(e,t,n,r){if(Vt){var i=Zt(e,t,n,r);if(null===i)Vr(e,t,r,Yt,n),Bt(e,r);else if(function(e,t,n,r,i){switch(t){case"focusin":return Tt=Lt(Tt,e,t,n,r,i),!0;case"dragenter":return Rt=Lt(Rt,e,t,n,r,i),!0;case"mouseover":return kt=Lt(kt,e,t,n,r,i),!0;case"pointerover":var o=i.pointerId;return Pt.set(o,Lt(Pt.get(o)||null,e,t,n,r,i)),!0;case"gotpointercapture":return o=i.pointerId,Ct.set(o,Lt(Ct.get(o)||null,e,t,n,r,i)),!0}return!1}(i,e,t,n,r))r.stopPropagation();else if(Bt(e,r),4&t&&-1<Ut.indexOf(e)){for(;null!==i;){var o=bi(i);if(null!==o&&Et(o),null===(o=Zt(e,t,n,r))&&Vr(e,t,r,Yt,n),o===i)break;i=o}null!==i&&r.stopPropagation()}else Vr(e,t,r,null,n)}}var Yt=null;function Zt(e,t,n,r){if(Yt=null,null!==(e=vi(e=Ee(r))))if(null===(t=qe(e)))e=null;else if(13===(n=t.tag)){if(null!==(e=He(t)))return e;e=null}else if(3===n){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(Je()){case $e:return 1;case et:return 4;case tt:case nt:return 16;case rt:return 536870912;default:return 16}default:return 16}}var Qt=null,Jt=null,$t=null;function en(){if($t)return $t;var e,t,n=Jt,r=n.length,i="value"in Qt?Qt.value:Qt.textContent,o=i.length;for(e=0;e<r&&n[e]===i[e];e++);var s=r-e;for(t=1;t<=s&&n[r-t]===i[o-t];t++);return $t=i.slice(e,1<t?1-t:void 0)}function tn(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 nn(){return!0}function rn(){return!1}function on(e){function t(t,n,r,i,o){for(var s in this._reactName=t,this._targetInst=r,this.type=n,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)?nn:rn,this.isPropagationStopped=rn,this}return D(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=nn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!==typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=nn)},persist:function(){},isPersistent:nn}),t}var sn,an,cn,ln={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},un=on(ln),dn=D({},ln,{view:0,detail:0}),fn=on(dn),hn=D({},dn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:In,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!==cn&&(cn&&"mousemove"===e.type?(sn=e.screenX-cn.screenX,an=e.screenY-cn.screenY):an=sn=0,cn=e),sn)},movementY:function(e){return"movementY"in e?e.movementY:an}}),pn=on(hn),gn=on(D({},hn,{dataTransfer:0})),yn=on(D({},dn,{relatedTarget:0})),mn=on(D({},ln,{animationName:0,elapsedTime:0,pseudoElement:0})),vn=D({},ln,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),bn=on(vn),wn=on(D({},ln,{data:0})),En={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},_n={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"},Sn={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function xn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=Sn[e])&&!!t[e]}function In(){return xn}var On=D({},dn,{key:function(e){if(e.key){var t=En[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=tn(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?_n[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:In,charCode:function(e){return"keypress"===e.type?tn(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?tn(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}}),An=on(On),Tn=on(D({},hn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Rn=on(D({},dn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:In})),kn=on(D({},ln,{propertyName:0,elapsedTime:0,pseudoElement:0})),Pn=D({},hn,{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}),Cn=on(Pn),Nn=[9,13,27,32],Un=u&&"CompositionEvent"in window,Bn=null;u&&"documentMode"in document&&(Bn=document.documentMode);var Ln=u&&"TextEvent"in window&&!Bn,Dn=u&&(!Un||Bn&&8<Bn&&11>=Bn),jn=String.fromCharCode(32),Mn=!1;function Fn(e,t){switch(e){case"keyup":return-1!==Nn.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function zn(e){return"object"===typeof(e=e.detail)&&"data"in e?e.data:null}var qn=!1;var Hn={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 Vn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!Hn[e.type]:"textarea"===t}function Kn(e,t,n,r){Oe(r),0<(t=Wr(t,"onChange")).length&&(n=new un("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Wn=null,Gn=null;function Yn(e){jr(e,0)}function Zn(e){if(G(wi(e)))return e}function Xn(e,t){if("change"===e)return t}var Qn=!1;if(u){var Jn;if(u){var $n="oninput"in document;if(!$n){var er=document.createElement("div");er.setAttribute("oninput","return;"),$n="function"===typeof er.oninput}Jn=$n}else Jn=!1;Qn=Jn&&(!document.documentMode||9<document.documentMode)}function tr(){Wn&&(Wn.detachEvent("onpropertychange",nr),Gn=Wn=null)}function nr(e){if("value"===e.propertyName&&Zn(Gn)){var t=[];Kn(t,Gn,e,Ee(e)),Pe(Yn,t)}}function rr(e,t,n){"focusin"===e?(tr(),Gn=n,(Wn=t).attachEvent("onpropertychange",nr)):"focusout"===e&&tr()}function ir(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return Zn(Gn)}function or(e,t){if("click"===e)return Zn(t)}function sr(e,t){if("input"===e||"change"===e)return Zn(t)}var ar="function"===typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e===1/t)||e!==e&&t!==t};function cr(e,t){if(ar(e,t))return!0;if("object"!==typeof e||null===e||"object"!==typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!d.call(t,i)||!ar(e[i],t[i]))return!1}return!0}function lr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function ur(e,t){var n,r=lr(e);for(e=0;r;){if(3===r.nodeType){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=lr(r)}}function dr(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?dr(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function fr(){for(var e=window,t=Y();t instanceof e.HTMLIFrameElement;){try{var n="string"===typeof t.contentWindow.location.href}catch(r){n=!1}if(!n)break;t=Y((e=t.contentWindow).document)}return t}function hr(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 pr(e){var t=fr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&dr(n.ownerDocument.documentElement,n)){if(null!==r&&hr(n))if(t=r.start,void 0===(e=r.end)&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if((e=(t=n.ownerDocument||document)&&t.defaultView||window).getSelection){e=e.getSelection();var i=n.textContent.length,o=Math.min(r.start,i);r=void 0===r.end?o:Math.min(r.end,i),!e.extend&&o>r&&(i=r,r=o,o=i),i=ur(n,o);var s=ur(n,r);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>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}for(t=[],e=n;e=e.parentNode;)1===e.nodeType&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for("function"===typeof n.focus&&n.focus(),n=0;n<t.length;n++)(e=t[n]).element.scrollLeft=e.left,e.element.scrollTop=e.top}}var gr=u&&"documentMode"in document&&11>=document.documentMode,yr=null,mr=null,vr=null,br=!1;function wr(e,t,n){var r=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;br||null==yr||yr!==Y(r)||("selectionStart"in(r=yr)&&hr(r)?r={start:r.selectionStart,end:r.selectionEnd}:r={anchorNode:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset},vr&&cr(vr,r)||(vr=r,0<(r=Wr(mr,"onSelect")).length&&(t=new un("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=yr)))}function Er(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var _r={animationend:Er("Animation","AnimationEnd"),animationiteration:Er("Animation","AnimationIteration"),animationstart:Er("Animation","AnimationStart"),transitionend:Er("Transition","TransitionEnd")},Sr={},xr={};function Ir(e){if(Sr[e])return Sr[e];if(!_r[e])return e;var t,n=_r[e];for(t in n)if(n.hasOwnProperty(t)&&t in xr)return Sr[e]=n[t];return e}u&&(xr=document.createElement("div").style,"AnimationEvent"in window||(delete _r.animationend.animation,delete _r.animationiteration.animation,delete _r.animationstart.animation),"TransitionEvent"in window||delete _r.transitionend.transition);var Or=Ir("animationend"),Ar=Ir("animationiteration"),Tr=Ir("animationstart"),Rr=Ir("transitionend"),kr=new Map,Pr="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 Cr(e,t){kr.set(e,t),c(t,[e])}for(var Nr=0;Nr<Pr.length;Nr++){var Ur=Pr[Nr];Cr(Ur.toLowerCase(),"on"+(Ur[0].toUpperCase()+Ur.slice(1)))}Cr(Or,"onAnimationEnd"),Cr(Ar,"onAnimationIteration"),Cr(Tr,"onAnimationStart"),Cr("dblclick","onDoubleClick"),Cr("focusin","onFocus"),Cr("focusout","onBlur"),Cr(Rr,"onTransitionEnd"),l("onMouseEnter",["mouseout","mouseover"]),l("onMouseLeave",["mouseout","mouseover"]),l("onPointerEnter",["pointerout","pointerover"]),l("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 Br="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(" "),Lr=new Set("cancel close invalid load scroll toggle".split(" ").concat(Br));function Dr(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,function(e,t,n,r,i,s,a,c,l){if(ze.apply(this,arguments),Le){if(!Le)throw Error(o(198));var u=De;Le=!1,De=null,je||(je=!0,Me=u)}}(r,t,void 0,e),e.currentTarget=null}function jr(e,t){t=0!==(4&t);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;e:{var o=void 0;if(t)for(var s=r.length-1;0<=s;s--){var a=r[s],c=a.instance,l=a.currentTarget;if(a=a.listener,c!==o&&i.isPropagationStopped())break e;Dr(i,a,l),o=c}else for(s=0;s<r.length;s++){if(c=(a=r[s]).instance,l=a.currentTarget,a=a.listener,c!==o&&i.isPropagationStopped())break e;Dr(i,a,l),o=c}}}if(je)throw e=Me,je=!1,Me=null,e}function Mr(e,t){var n=t[gi];void 0===n&&(n=t[gi]=new Set);var r=e+"__bubble";n.has(r)||(Hr(t,e,2,!1),n.add(r))}function Fr(e,t,n){var r=0;t&&(r|=4),Hr(n,e,r,t)}var zr="_reactListening"+Math.random().toString(36).slice(2);function qr(e){if(!e[zr]){e[zr]=!0,s.forEach((function(t){"selectionchange"!==t&&(Lr.has(t)||Fr(t,!1,e),Fr(t,!0,e))}));var t=9===e.nodeType?e:e.ownerDocument;null===t||t[zr]||(t[zr]=!0,Fr("selectionchange",!1,t))}}function Hr(e,t,n,r){switch(Xt(t)){case 1:var i=Kt;break;case 4:i=Wt;break;default:i=Gt}n=i.bind(null,t,n,e),i=void 0,!Ne||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(i=!0),r?void 0!==i?e.addEventListener(t,n,{capture:!0,passive:i}):e.addEventListener(t,n,!0):void 0!==i?e.addEventListener(t,n,{passive:i}):e.addEventListener(t,n,!1)}function Vr(e,t,n,r,i){var o=r;if(0===(1&t)&&0===(2&t)&&null!==r)e:for(;;){if(null===r)return;var s=r.tag;if(3===s||4===s){var a=r.stateNode.containerInfo;if(a===i||8===a.nodeType&&a.parentNode===i)break;if(4===s)for(s=r.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=vi(a)))return;if(5===(c=s.tag)||6===c){r=o=s;continue e}a=a.parentNode}}r=r.return}Pe((function(){var r=o,i=Ee(n),s=[];e:{var a=kr.get(e);if(void 0!==a){var c=un,l=e;switch(e){case"keypress":if(0===tn(n))break e;case"keydown":case"keyup":c=An;break;case"focusin":l="focus",c=yn;break;case"focusout":l="blur",c=yn;break;case"beforeblur":case"afterblur":c=yn;break;case"click":if(2===n.button)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":c=pn;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":c=gn;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":c=Rn;break;case Or:case Ar:case Tr:c=mn;break;case Rr:c=kn;break;case"scroll":c=fn;break;case"wheel":c=Cn;break;case"copy":case"cut":case"paste":c=bn;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":c=Tn}var u=0!==(4&t),d=!u&&"scroll"===e,f=u?null!==a?a+"Capture":null:a;u=[];for(var h,p=r;null!==p;){var g=(h=p).stateNode;if(5===h.tag&&null!==g&&(h=g,null!==f&&(null!=(g=Ce(p,f))&&u.push(Kr(p,g,h)))),d)break;p=p.return}0<u.length&&(a=new c(a,l,null,n,i),s.push({event:a,listeners:u}))}}if(0===(7&t)){if(c="mouseout"===e||"pointerout"===e,(!(a="mouseover"===e||"pointerover"===e)||n===we||!(l=n.relatedTarget||n.fromElement)||!vi(l)&&!l[pi])&&(c||a)&&(a=i.window===i?i:(a=i.ownerDocument)?a.defaultView||a.parentWindow:window,c?(c=r,null!==(l=(l=n.relatedTarget||n.toElement)?vi(l):null)&&(l!==(d=qe(l))||5!==l.tag&&6!==l.tag)&&(l=null)):(c=null,l=r),c!==l)){if(u=pn,g="onMouseLeave",f="onMouseEnter",p="mouse","pointerout"!==e&&"pointerover"!==e||(u=Tn,g="onPointerLeave",f="onPointerEnter",p="pointer"),d=null==c?a:wi(c),h=null==l?a:wi(l),(a=new u(g,p+"leave",c,n,i)).target=d,a.relatedTarget=h,g=null,vi(i)===r&&((u=new u(f,p+"enter",l,n,i)).target=h,u.relatedTarget=d,g=u),d=g,c&&l)e:{for(f=l,p=0,h=u=c;h;h=Gr(h))p++;for(h=0,g=f;g;g=Gr(g))h++;for(;0<p-h;)u=Gr(u),p--;for(;0<h-p;)f=Gr(f),h--;for(;p--;){if(u===f||null!==f&&u===f.alternate)break e;u=Gr(u),f=Gr(f)}u=null}else u=null;null!==c&&Yr(s,a,c,u,!1),null!==l&&null!==d&&Yr(s,d,l,u,!0)}if("select"===(c=(a=r?wi(r):window).nodeName&&a.nodeName.toLowerCase())||"input"===c&&"file"===a.type)var y=Xn;else if(Vn(a))if(Qn)y=sr;else{y=ir;var m=rr}else(c=a.nodeName)&&"input"===c.toLowerCase()&&("checkbox"===a.type||"radio"===a.type)&&(y=or);switch(y&&(y=y(e,r))?Kn(s,y,n,i):(m&&m(e,a,r),"focusout"===e&&(m=a._wrapperState)&&m.controlled&&"number"===a.type&&ee(a,"number",a.value)),m=r?wi(r):window,e){case"focusin":(Vn(m)||"true"===m.contentEditable)&&(yr=m,mr=r,vr=null);break;case"focusout":vr=mr=yr=null;break;case"mousedown":br=!0;break;case"contextmenu":case"mouseup":case"dragend":br=!1,wr(s,n,i);break;case"selectionchange":if(gr)break;case"keydown":case"keyup":wr(s,n,i)}var v;if(Un)e:{switch(e){case"compositionstart":var b="onCompositionStart";break e;case"compositionend":b="onCompositionEnd";break e;case"compositionupdate":b="onCompositionUpdate";break e}b=void 0}else qn?Fn(e,n)&&(b="onCompositionEnd"):"keydown"===e&&229===n.keyCode&&(b="onCompositionStart");b&&(Dn&&"ko"!==n.locale&&(qn||"onCompositionStart"!==b?"onCompositionEnd"===b&&qn&&(v=en()):(Jt="value"in(Qt=i)?Qt.value:Qt.textContent,qn=!0)),0<(m=Wr(r,b)).length&&(b=new wn(b,e,null,n,i),s.push({event:b,listeners:m}),v?b.data=v:null!==(v=zn(n))&&(b.data=v))),(v=Ln?function(e,t){switch(e){case"compositionend":return zn(t);case"keypress":return 32!==t.which?null:(Mn=!0,jn);case"textInput":return(e=t.data)===jn&&Mn?null:e;default:return null}}(e,n):function(e,t){if(qn)return"compositionend"===e||!Un&&Fn(e,t)?(e=en(),$t=Jt=Qt=null,qn=!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 Dn&&"ko"!==t.locale?null:t.data}}(e,n))&&(0<(r=Wr(r,"onBeforeInput")).length&&(i=new wn("onBeforeInput","beforeinput",null,n,i),s.push({event:i,listeners:r}),i.data=v))}jr(s,t)}))}function Kr(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Wr(e,t){for(var n=t+"Capture",r=[];null!==e;){var i=e,o=i.stateNode;5===i.tag&&null!==o&&(i=o,null!=(o=Ce(e,n))&&r.unshift(Kr(e,o,i)),null!=(o=Ce(e,t))&&r.push(Kr(e,o,i))),e=e.return}return r}function Gr(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag);return e||null}function Yr(e,t,n,r,i){for(var o=t._reactName,s=[];null!==n&&n!==r;){var a=n,c=a.alternate,l=a.stateNode;if(null!==c&&c===r)break;5===a.tag&&null!==l&&(a=l,i?null!=(c=Ce(n,o))&&s.unshift(Kr(n,c,a)):i||null!=(c=Ce(n,o))&&s.push(Kr(n,c,a))),n=n.return}0!==s.length&&e.push({event:t,listeners:s})}var Zr=/\r\n?/g,Xr=/\u0000|\uFFFD/g;function Qr(e){return("string"===typeof e?e:""+e).replace(Zr,"\n").replace(Xr,"")}function Jr(e,t,n){if(t=Qr(t),Qr(e)!==t&&n)throw Error(o(425))}function $r(){}var ei=null,ti=null;function ni(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 ri="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)}:ri;function ai(e){setTimeout((function(){throw e}))}function ci(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&8===i.nodeType)if("/$"===(n=i.data)){if(0===r)return e.removeChild(i),void qt(t);r--}else"$"!==n&&"$?"!==n&&"$!"!==n||r++;n=i}while(n);qt(t)}function li(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 ui(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var n=e.data;if("$"===n||"$!"===n||"$?"===n){if(0===t)return e;t--}else"/$"===n&&t++}e=e.previousSibling}return null}var di=Math.random().toString(36).slice(2),fi="__reactFiber$"+di,hi="__reactProps$"+di,pi="__reactContainer$"+di,gi="__reactEvents$"+di,yi="__reactListeners$"+di,mi="__reactHandles$"+di;function vi(e){var t=e[fi];if(t)return t;for(var n=e.parentNode;n;){if(t=n[pi]||n[fi]){if(n=t.alternate,null!==t.child||null!==n&&null!==n.child)for(e=ui(e);null!==e;){if(n=e[fi])return n;e=ui(e)}return t}n=(e=n).parentNode}return null}function bi(e){return!(e=e[fi]||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[hi]||null}var _i=[],Si=-1;function xi(e){return{current:e}}function Ii(e){0>Si||(e.current=_i[Si],_i[Si]=null,Si--)}function Oi(e,t){Si++,_i[Si]=e.current,e.current=t}var Ai={},Ti=xi(Ai),Ri=xi(!1),ki=Ai;function Pi(e,t){var n=e.type.contextTypes;if(!n)return Ai;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i,o={};for(i in n)o[i]=t[i];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function Ci(e){return null!==(e=e.childContextTypes)&&void 0!==e}function Ni(){Ii(Ri),Ii(Ti)}function Ui(e,t,n){if(Ti.current!==Ai)throw Error(o(168));Oi(Ti,t),Oi(Ri,n)}function Bi(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,"function"!==typeof r.getChildContext)return n;for(var i in r=r.getChildContext())if(!(i in t))throw Error(o(108,H(e)||"Unknown",i));return D({},n,r)}function Li(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ai,ki=Ti.current,Oi(Ti,e),Oi(Ri,Ri.current),!0}function Di(e,t,n){var r=e.stateNode;if(!r)throw Error(o(169));n?(e=Bi(e,t,ki),r.__reactInternalMemoizedMergedChildContext=e,Ii(Ri),Ii(Ti),Oi(Ti,e)):Ii(Ri),Oi(Ri,n)}var ji=null,Mi=!1,Fi=!1;function zi(e){null===ji?ji=[e]:ji.push(e)}function qi(){if(!Fi&&null!==ji){Fi=!0;var e=0,t=bt;try{var n=ji;for(bt=1;e<n.length;e++){var r=n[e];do{r=r(!0)}while(null!==r)}ji=null,Mi=!1}catch(i){throw null!==ji&&(ji=ji.slice(e+1)),Ge($e,qi),i}finally{bt=t,Fi=!1}}return null}var Hi=[],Vi=0,Ki=null,Wi=0,Gi=[],Yi=0,Zi=null,Xi=1,Qi="";function Ji(e,t){Hi[Vi++]=Wi,Hi[Vi++]=Ki,Ki=e,Wi=t}function $i(e,t,n){Gi[Yi++]=Xi,Gi[Yi++]=Qi,Gi[Yi++]=Zi,Zi=e;var r=Xi;e=Qi;var i=32-st(r)-1;r&=~(1<<i),n+=1;var o=32-st(t)+i;if(30<o){var s=i-i%5;o=(r&(1<<s)-1).toString(32),r>>=s,i-=s,Xi=1<<32-st(t)+i|n<<i|r,Qi=o+e}else Xi=1<<o|n<<i|r,Qi=e}function eo(e){null!==e.return&&(Ji(e,1),$i(e,1,0))}function to(e){for(;e===Ki;)Ki=Hi[--Vi],Hi[Vi]=null,Wi=Hi[--Vi],Hi[Vi]=null;for(;e===Zi;)Zi=Gi[--Yi],Gi[Yi]=null,Qi=Gi[--Yi],Gi[Yi]=null,Xi=Gi[--Yi],Gi[Yi]=null}var no=null,ro=null,io=!1,oo=null;function so(e,t){var n=Pl(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,null===(t=e.deletions)?(e.deletions=[n],e.flags|=16):t.push(n)}function ao(e,t){switch(e.tag){case 5:var n=e.type;return null!==(t=1!==t.nodeType||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t)&&(e.stateNode=t,no=e,ro=li(t.firstChild),!0);case 6:return null!==(t=""===e.pendingProps||3!==t.nodeType?null:t)&&(e.stateNode=t,no=e,ro=null,!0);case 13:return null!==(t=8!==t.nodeType?null:t)&&(n=null!==Zi?{id:Xi,overflow:Qi}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},(n=Pl(18,null,null,0)).stateNode=t,n.return=e,e.child=n,no=e,ro=null,!0);default:return!1}}function co(e){return 0!==(1&e.mode)&&0===(128&e.flags)}function lo(e){if(io){var t=ro;if(t){var n=t;if(!ao(e,t)){if(co(e))throw Error(o(418));t=li(n.nextSibling);var r=no;t&&ao(e,t)?so(r,n):(e.flags=-4097&e.flags|2,io=!1,no=e)}}else{if(co(e))throw Error(o(418));e.flags=-4097&e.flags|2,io=!1,no=e}}}function uo(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;no=e}function fo(e){if(e!==no)return!1;if(!io)return uo(e),io=!0,!1;var t;if((t=3!==e.tag)&&!(t=5!==e.tag)&&(t="head"!==(t=e.type)&&"body"!==t&&!ni(e.type,e.memoizedProps)),t&&(t=ro)){if(co(e))throw ho(),Error(o(418));for(;t;)so(e,t),t=li(t.nextSibling)}if(uo(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 n=e.data;if("/$"===n){if(0===t){ro=li(e.nextSibling);break e}t--}else"$"!==n&&"$!"!==n&&"$?"!==n||t++}e=e.nextSibling}ro=null}}else ro=no?li(e.stateNode.nextSibling):null;return!0}function ho(){for(var e=ro;e;)e=li(e.nextSibling)}function po(){ro=no=null,io=!1}function go(e){null===oo?oo=[e]:oo.push(e)}var yo=w.ReactCurrentBatchConfig;function mo(e,t,n){if(null!==(e=n.ref)&&"function"!==typeof e&&"object"!==typeof e){if(n._owner){if(n=n._owner){if(1!==n.tag)throw Error(o(309));var r=n.stateNode}if(!r)throw Error(o(147,e));var i=r,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;null===e?delete t[s]:t[s]=e},t._stringRef=s,t)}if("string"!==typeof e)throw Error(o(284));if(!n._owner)throw Error(o(290,e))}return e}function vo(e,t){throw e=Object.prototype.toString.call(t),Error(o(31,"[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function bo(e){return(0,e._init)(e._payload)}function wo(e){function t(t,n){if(e){var r=t.deletions;null===r?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;null!==r;)t(n,r),r=r.sibling;return null}function r(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=Nl(e,t)).index=0,e.sibling=null,e}function s(t,n,r){return t.index=r,e?null!==(r=t.alternate)?(r=r.index)<n?(t.flags|=2,n):r:(t.flags|=2,n):(t.flags|=1048576,n)}function a(t){return e&&null===t.alternate&&(t.flags|=2),t}function c(e,t,n,r){return null===t||6!==t.tag?((t=Dl(n,e.mode,r)).return=e,t):((t=i(t,n)).return=e,t)}function l(e,t,n,r){var o=n.type;return o===S?d(e,t,n.props.children,r,n.key):null!==t&&(t.elementType===o||"object"===typeof o&&null!==o&&o.$$typeof===C&&bo(o)===t.type)?((r=i(t,n.props)).ref=mo(e,t,n),r.return=e,r):((r=Ul(n.type,n.key,n.props,null,e.mode,r)).ref=mo(e,t,n),r.return=e,r)}function u(e,t,n,r){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?((t=jl(n,e.mode,r)).return=e,t):((t=i(t,n.children||[])).return=e,t)}function d(e,t,n,r,o){return null===t||7!==t.tag?((t=Bl(n,e.mode,r,o)).return=e,t):((t=i(t,n)).return=e,t)}function f(e,t,n){if("string"===typeof t&&""!==t||"number"===typeof t)return(t=Dl(""+t,e.mode,n)).return=e,t;if("object"===typeof t&&null!==t){switch(t.$$typeof){case E:return(n=Ul(t.type,t.key,t.props,null,e.mode,n)).ref=mo(e,null,t),n.return=e,n;case _:return(t=jl(t,e.mode,n)).return=e,t;case C:return f(e,(0,t._init)(t._payload),n)}if(te(t)||B(t))return(t=Bl(t,e.mode,n,null)).return=e,t;vo(e,t)}return null}function h(e,t,n,r){var i=null!==t?t.key:null;if("string"===typeof n&&""!==n||"number"===typeof n)return null!==i?null:c(e,t,""+n,r);if("object"===typeof n&&null!==n){switch(n.$$typeof){case E:return n.key===i?l(e,t,n,r):null;case _:return n.key===i?u(e,t,n,r):null;case C:return h(e,t,(i=n._init)(n._payload),r)}if(te(n)||B(n))return null!==i?null:d(e,t,n,r,null);vo(e,n)}return null}function p(e,t,n,r,i){if("string"===typeof r&&""!==r||"number"===typeof r)return c(t,e=e.get(n)||null,""+r,i);if("object"===typeof r&&null!==r){switch(r.$$typeof){case E:return l(t,e=e.get(null===r.key?n:r.key)||null,r,i);case _:return u(t,e=e.get(null===r.key?n:r.key)||null,r,i);case C:return p(e,t,n,(0,r._init)(r._payload),i)}if(te(r)||B(r))return d(t,e=e.get(n)||null,r,i,null);vo(t,r)}return null}function g(i,o,a,c){for(var l=null,u=null,d=o,g=o=0,y=null;null!==d&&g<a.length;g++){d.index>g?(y=d,d=null):y=d.sibling;var m=h(i,d,a[g],c);if(null===m){null===d&&(d=y);break}e&&d&&null===m.alternate&&t(i,d),o=s(m,o,g),null===u?l=m:u.sibling=m,u=m,d=y}if(g===a.length)return n(i,d),io&&Ji(i,g),l;if(null===d){for(;g<a.length;g++)null!==(d=f(i,a[g],c))&&(o=s(d,o,g),null===u?l=d:u.sibling=d,u=d);return io&&Ji(i,g),l}for(d=r(i,d);g<a.length;g++)null!==(y=p(d,i,g,a[g],c))&&(e&&null!==y.alternate&&d.delete(null===y.key?g:y.key),o=s(y,o,g),null===u?l=y:u.sibling=y,u=y);return e&&d.forEach((function(e){return t(i,e)})),io&&Ji(i,g),l}function y(i,a,c,l){var u=B(c);if("function"!==typeof u)throw Error(o(150));if(null==(c=u.call(c)))throw Error(o(151));for(var d=u=null,g=a,y=a=0,m=null,v=c.next();null!==g&&!v.done;y++,v=c.next()){g.index>y?(m=g,g=null):m=g.sibling;var b=h(i,g,v.value,l);if(null===b){null===g&&(g=m);break}e&&g&&null===b.alternate&&t(i,g),a=s(b,a,y),null===d?u=b:d.sibling=b,d=b,g=m}if(v.done)return n(i,g),io&&Ji(i,y),u;if(null===g){for(;!v.done;y++,v=c.next())null!==(v=f(i,v.value,l))&&(a=s(v,a,y),null===d?u=v:d.sibling=v,d=v);return io&&Ji(i,y),u}for(g=r(i,g);!v.done;y++,v=c.next())null!==(v=p(g,i,y,v.value,l))&&(e&&null!==v.alternate&&g.delete(null===v.key?y:v.key),a=s(v,a,y),null===d?u=v:d.sibling=v,d=v);return e&&g.forEach((function(e){return t(i,e)})),io&&Ji(i,y),u}return function e(r,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 l=s.key,u=o;null!==u;){if(u.key===l){if((l=s.type)===S){if(7===u.tag){n(r,u.sibling),(o=i(u,s.props.children)).return=r,r=o;break e}}else if(u.elementType===l||"object"===typeof l&&null!==l&&l.$$typeof===C&&bo(l)===u.type){n(r,u.sibling),(o=i(u,s.props)).ref=mo(r,u,s),o.return=r,r=o;break e}n(r,u);break}t(r,u),u=u.sibling}s.type===S?((o=Bl(s.props.children,r.mode,c,s.key)).return=r,r=o):((c=Ul(s.type,s.key,s.props,null,r.mode,c)).ref=mo(r,o,s),c.return=r,r=c)}return a(r);case _:e:{for(u=s.key;null!==o;){if(o.key===u){if(4===o.tag&&o.stateNode.containerInfo===s.containerInfo&&o.stateNode.implementation===s.implementation){n(r,o.sibling),(o=i(o,s.children||[])).return=r,r=o;break e}n(r,o);break}t(r,o),o=o.sibling}(o=jl(s,r.mode,c)).return=r,r=o}return a(r);case C:return e(r,o,(u=s._init)(s._payload),c)}if(te(s))return g(r,o,s,c);if(B(s))return y(r,o,s,c);vo(r,s)}return"string"===typeof s&&""!==s||"number"===typeof s?(s=""+s,null!==o&&6===o.tag?(n(r,o.sibling),(o=i(o,s)).return=r,r=o):(n(r,o),(o=Dl(s,r.mode,c)).return=r,r=o),a(r)):n(r,o)}}var Eo=wo(!0),_o=wo(!1),So=xi(null),xo=null,Io=null,Oo=null;function Ao(){Oo=Io=xo=null}function To(e){var t=So.current;Ii(So),e._currentValue=t}function Ro(e,t,n){for(;null!==e;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,null!==r&&(r.childLanes|=t)):null!==r&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function ko(e,t){xo=e,Oo=Io=null,null!==(e=e.dependencies)&&null!==e.firstContext&&(0!==(e.lanes&t)&&(ba=!0),e.firstContext=null)}function Po(e){var t=e._currentValue;if(Oo!==e)if(e={context:e,memoizedValue:t,next:null},null===Io){if(null===xo)throw Error(o(308));Io=e,xo.dependencies={lanes:0,firstContext:e}}else Io=Io.next=e;return t}var Co=null;function No(e){null===Co?Co=[e]:Co.push(e)}function Uo(e,t,n,r){var i=t.interleaved;return null===i?(n.next=n,No(t)):(n.next=i.next,i.next=n),t.interleaved=n,Bo(e,r)}function Bo(e,t){e.lanes|=t;var n=e.alternate;for(null!==n&&(n.lanes|=t),n=e,e=e.return;null!==e;)e.childLanes|=t,null!==(n=e.alternate)&&(n.childLanes|=t),n=e,e=e.return;return 3===n.tag?n.stateNode:null}var Lo=!1;function Do(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function jo(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 Mo(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Fo(e,t,n){var r=e.updateQueue;if(null===r)return null;if(r=r.shared,0!==(2&Tc)){var i=r.pending;return null===i?t.next=t:(t.next=i.next,i.next=t),r.pending=t,Bo(e,n)}return null===(i=r.interleaved)?(t.next=t,No(r)):(t.next=i.next,i.next=t),r.interleaved=t,Bo(e,n)}function zo(e,t,n){if(null!==(t=t.updateQueue)&&(t=t.shared,0!==(4194240&n))){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,vt(e,n)}}function qo(e,t){var n=e.updateQueue,r=e.alternate;if(null!==r&&n===(r=r.updateQueue)){var i=null,o=null;if(null!==(n=n.firstBaseUpdate)){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};null===o?i=o=s:o=o.next=s,n=n.next}while(null!==n);null===o?i=o=t:o=o.next=t}else i=o=t;return n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:o,shared:r.shared,effects:r.effects},void(e.updateQueue=n)}null===(e=n.lastBaseUpdate)?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Ho(e,t,n,r){var i=e.updateQueue;Lo=!1;var o=i.firstBaseUpdate,s=i.lastBaseUpdate,a=i.shared.pending;if(null!==a){i.shared.pending=null;var c=a,l=c.next;c.next=null,null===s?o=l:s.next=l,s=c;var u=e.alternate;null!==u&&((a=(u=u.updateQueue).lastBaseUpdate)!==s&&(null===a?u.firstBaseUpdate=l:a.next=l,u.lastBaseUpdate=c))}if(null!==o){var d=i.baseState;for(s=0,u=l=c=null,a=o;;){var f=a.lane,h=a.eventTime;if((r&f)===f){null!==u&&(u=u.next={eventTime:h,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var p=e,g=a;switch(f=t,h=n,g.tag){case 1:if("function"===typeof(p=g.payload)){d=p.call(h,d,f);break e}d=p;break e;case 3:p.flags=-65537&p.flags|128;case 0:if(null===(f="function"===typeof(p=g.payload)?p.call(h,d,f):p)||void 0===f)break e;d=D({},d,f);break e;case 2:Lo=!0}}null!==a.callback&&0!==a.lane&&(e.flags|=64,null===(f=i.effects)?i.effects=[a]:f.push(a))}else h={eventTime:h,lane:f,tag:a.tag,payload:a.payload,callback:a.callback,next:null},null===u?(l=u=h,c=d):u=u.next=h,s|=f;if(null===(a=a.next)){if(null===(a=i.shared.pending))break;a=(f=a).next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}if(null===u&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,null!==(t=i.shared.interleaved)){i=t;do{s|=i.lane,i=i.next}while(i!==t)}else null===o&&(i.shared.lanes=0);Lc|=s,e.lanes=s,e.memoizedState=d}}function Vo(e,t,n){if(e=t.effects,t.effects=null,null!==e)for(t=0;t<e.length;t++){var r=e[t],i=r.callback;if(null!==i){if(r.callback=null,r=n,"function"!==typeof i)throw Error(o(191,i));i.call(r)}}}var Ko={},Wo=xi(Ko),Go=xi(Ko),Yo=xi(Ko);function Zo(e){if(e===Ko)throw Error(o(174));return e}function Xo(e,t){switch(Oi(Yo,t),Oi(Go,e),Oi(Wo,Ko),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)}Ii(Wo),Oi(Wo,t)}function Qo(){Ii(Wo),Ii(Go),Ii(Yo)}function Jo(e){Zo(Yo.current);var t=Zo(Wo.current),n=ce(t,e.type);t!==n&&(Oi(Go,e),Oi(Wo,n))}function $o(e){Go.current===e&&(Ii(Wo),Ii(Go))}var es=xi(0);function ts(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||"$?"===n.data||"$!"===n.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 ns=[];function rs(){for(var e=0;e<ns.length;e++)ns[e]._workInProgressVersionPrimary=null;ns.length=0}var is=w.ReactCurrentDispatcher,os=w.ReactCurrentBatchConfig,ss=0,as=null,cs=null,ls=null,us=!1,ds=!1,fs=0,hs=0;function ps(){throw Error(o(321))}function gs(e,t){if(null===t)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!ar(e[n],t[n]))return!1;return!0}function ys(e,t,n,r,i,s){if(ss=s,as=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,is.current=null===e||null===e.memoizedState?$s:ea,e=n(r,i),ds){s=0;do{if(ds=!1,fs=0,25<=s)throw Error(o(301));s+=1,ls=cs=null,t.updateQueue=null,is.current=ta,e=n(r,i)}while(ds)}if(is.current=Js,t=null!==cs&&null!==cs.next,ss=0,ls=cs=as=null,us=!1,t)throw Error(o(300));return e}function ms(){var e=0!==fs;return fs=0,e}function vs(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===ls?as.memoizedState=ls=e:ls=ls.next=e,ls}function bs(){if(null===cs){var e=as.alternate;e=null!==e?e.memoizedState:null}else e=cs.next;var t=null===ls?as.memoizedState:ls.next;if(null!==t)ls=t,cs=e;else{if(null===e)throw Error(o(310));e={memoizedState:(cs=e).memoizedState,baseState:cs.baseState,baseQueue:cs.baseQueue,queue:cs.queue,next:null},null===ls?as.memoizedState=ls=e:ls=ls.next=e}return ls}function ws(e,t){return"function"===typeof t?t(e):t}function Es(e){var t=bs(),n=t.queue;if(null===n)throw Error(o(311));n.lastRenderedReducer=e;var r=cs,i=r.baseQueue,s=n.pending;if(null!==s){if(null!==i){var a=i.next;i.next=s.next,s.next=a}r.baseQueue=i=s,n.pending=null}if(null!==i){s=i.next,r=r.baseState;var c=a=null,l=null,u=s;do{var d=u.lane;if((ss&d)===d)null!==l&&(l=l.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};null===l?(c=l=f,a=r):l=l.next=f,as.lanes|=d,Lc|=d}u=u.next}while(null!==u&&u!==s);null===l?a=r:l.next=c,ar(r,t.memoizedState)||(ba=!0),t.memoizedState=r,t.baseState=a,t.baseQueue=l,n.lastRenderedState=r}if(null!==(e=n.interleaved)){i=e;do{s=i.lane,as.lanes|=s,Lc|=s,i=i.next}while(i!==e)}else null===i&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function _s(e){var t=bs(),n=t.queue;if(null===n)throw Error(o(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,s=t.memoizedState;if(null!==i){n.pending=null;var a=i=i.next;do{s=e(s,a.action),a=a.next}while(a!==i);ar(s,t.memoizedState)||(ba=!0),t.memoizedState=s,null===t.baseQueue&&(t.baseState=s),n.lastRenderedState=s}return[s,r]}function Ss(){}function xs(e,t){var n=as,r=bs(),i=t(),s=!ar(r.memoizedState,i);if(s&&(r.memoizedState=i,ba=!0),r=r.queue,Ls(As.bind(null,n,r,e),[e]),r.getSnapshot!==t||s||null!==ls&&1&ls.memoizedState.tag){if(n.flags|=2048,Ps(9,Os.bind(null,n,r,i,t),void 0,null),null===Rc)throw Error(o(349));0!==(30&ss)||Is(n,t,i)}return i}function Is(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},null===(t=as.updateQueue)?(t={lastEffect:null,stores:null},as.updateQueue=t,t.stores=[e]):null===(n=t.stores)?t.stores=[e]:n.push(e)}function Os(e,t,n,r){t.value=n,t.getSnapshot=r,Ts(t)&&Rs(e)}function As(e,t,n){return n((function(){Ts(t)&&Rs(e)}))}function Ts(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!ar(e,n)}catch(r){return!0}}function Rs(e){var t=Bo(e,1);null!==t&&nl(t,e,1,-1)}function ks(e){var t=vs();return"function"===typeof e&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ws,lastRenderedState:e},t.queue=e,e=e.dispatch=Ys.bind(null,as,e),[t.memoizedState,e]}function Ps(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},null===(t=as.updateQueue)?(t={lastEffect:null,stores:null},as.updateQueue=t,t.lastEffect=e.next=e):null===(n=t.lastEffect)?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function Cs(){return bs().memoizedState}function Ns(e,t,n,r){var i=vs();as.flags|=e,i.memoizedState=Ps(1|t,n,void 0,void 0===r?null:r)}function Us(e,t,n,r){var i=bs();r=void 0===r?null:r;var o=void 0;if(null!==cs){var s=cs.memoizedState;if(o=s.destroy,null!==r&&gs(r,s.deps))return void(i.memoizedState=Ps(t,n,o,r))}as.flags|=e,i.memoizedState=Ps(1|t,n,o,r)}function Bs(e,t){return Ns(8390656,8,e,t)}function Ls(e,t){return Us(2048,8,e,t)}function Ds(e,t){return Us(4,2,e,t)}function js(e,t){return Us(4,4,e,t)}function Ms(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 Fs(e,t,n){return n=null!==n&&void 0!==n?n.concat([e]):null,Us(4,4,Ms.bind(null,t,e),n)}function zs(){}function qs(e,t){var n=bs();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&gs(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Hs(e,t){var n=bs();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&gs(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Vs(e,t,n){return 0===(21&ss)?(e.baseState&&(e.baseState=!1,ba=!0),e.memoizedState=n):(ar(n,t)||(n=gt(),as.lanes|=n,Lc|=n,e.baseState=!0),t)}function Ks(e,t){var n=bt;bt=0!==n&&4>n?n:4,e(!0);var r=os.transition;os.transition={};try{e(!1),t()}finally{bt=n,os.transition=r}}function Ws(){return bs().memoizedState}function Gs(e,t,n){var r=tl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Zs(e))Xs(t,n);else if(null!==(n=Uo(e,t,n,r))){nl(n,e,r,el()),Qs(n,t,r)}}function Ys(e,t,n){var r=tl(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Zs(e))Xs(t,i);else{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,n);if(i.hasEagerState=!0,i.eagerState=a,ar(a,s)){var c=t.interleaved;return null===c?(i.next=i,No(t)):(i.next=c.next,c.next=i),void(t.interleaved=i)}}catch(l){}null!==(n=Uo(e,t,i,r))&&(nl(n,e,r,i=el()),Qs(n,t,r))}}function Zs(e){var t=e.alternate;return e===as||null!==t&&t===as}function Xs(e,t){ds=us=!0;var n=e.pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Qs(e,t,n){if(0!==(4194240&n)){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,vt(e,n)}}var Js={readContext:Po,useCallback:ps,useContext:ps,useEffect:ps,useImperativeHandle:ps,useInsertionEffect:ps,useLayoutEffect:ps,useMemo:ps,useReducer:ps,useRef:ps,useState:ps,useDebugValue:ps,useDeferredValue:ps,useTransition:ps,useMutableSource:ps,useSyncExternalStore:ps,useId:ps,unstable_isNewReconciler:!1},$s={readContext:Po,useCallback:function(e,t){return vs().memoizedState=[e,void 0===t?null:t],e},useContext:Po,useEffect:Bs,useImperativeHandle:function(e,t,n){return n=null!==n&&void 0!==n?n.concat([e]):null,Ns(4194308,4,Ms.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ns(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ns(4,2,e,t)},useMemo:function(e,t){var n=vs();return t=void 0===t?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=vs();return t=void 0!==n?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Gs.bind(null,as,e),[r.memoizedState,e]},useRef:function(e){return e={current:e},vs().memoizedState=e},useState:ks,useDebugValue:zs,useDeferredValue:function(e){return vs().memoizedState=e},useTransition:function(){var e=ks(!1),t=e[0];return e=Ks.bind(null,e[1]),vs().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=as,i=vs();if(io){if(void 0===n)throw Error(o(407));n=n()}else{if(n=t(),null===Rc)throw Error(o(349));0!==(30&ss)||Is(r,t,n)}i.memoizedState=n;var s={value:n,getSnapshot:t};return i.queue=s,Bs(As.bind(null,r,s,e),[e]),r.flags|=2048,Ps(9,Os.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=vs(),t=Rc.identifierPrefix;if(io){var n=Qi;t=":"+t+"R"+(n=(Xi&~(1<<32-st(Xi)-1)).toString(32)+n),0<(n=fs++)&&(t+="H"+n.toString(32)),t+=":"}else t=":"+t+"r"+(n=hs++).toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},ea={readContext:Po,useCallback:qs,useContext:Po,useEffect:Ls,useImperativeHandle:Fs,useInsertionEffect:Ds,useLayoutEffect:js,useMemo:Hs,useReducer:Es,useRef:Cs,useState:function(){return Es(ws)},useDebugValue:zs,useDeferredValue:function(e){return Vs(bs(),cs.memoizedState,e)},useTransition:function(){return[Es(ws)[0],bs().memoizedState]},useMutableSource:Ss,useSyncExternalStore:xs,useId:Ws,unstable_isNewReconciler:!1},ta={readContext:Po,useCallback:qs,useContext:Po,useEffect:Ls,useImperativeHandle:Fs,useInsertionEffect:Ds,useLayoutEffect:js,useMemo:Hs,useReducer:_s,useRef:Cs,useState:function(){return _s(ws)},useDebugValue:zs,useDeferredValue:function(e){var t=bs();return null===cs?t.memoizedState=e:Vs(t,cs.memoizedState,e)},useTransition:function(){return[_s(ws)[0],bs().memoizedState]},useMutableSource:Ss,useSyncExternalStore:xs,useId:Ws,unstable_isNewReconciler:!1};function na(e,t){if(e&&e.defaultProps){for(var n in t=D({},t),e=e.defaultProps)void 0===t[n]&&(t[n]=e[n]);return t}return t}function ra(e,t,n,r){n=null===(n=n(r,t=e.memoizedState))||void 0===n?t:D({},t,n),e.memoizedState=n,0===e.lanes&&(e.updateQueue.baseState=n)}var ia={isMounted:function(e){return!!(e=e._reactInternals)&&qe(e)===e},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=el(),i=tl(e),o=Mo(r,i);o.payload=t,void 0!==n&&null!==n&&(o.callback=n),null!==(t=Fo(e,o,i))&&(nl(t,e,i,r),zo(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=el(),i=tl(e),o=Mo(r,i);o.tag=1,o.payload=t,void 0!==n&&null!==n&&(o.callback=n),null!==(t=Fo(e,o,i))&&(nl(t,e,i,r),zo(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=el(),r=tl(e),i=Mo(n,r);i.tag=2,void 0!==t&&null!==t&&(i.callback=t),null!==(t=Fo(e,i,r))&&(nl(t,e,r,n),zo(t,e,r))}};function oa(e,t,n,r,i,o,s){return"function"===typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,o,s):!t.prototype||!t.prototype.isPureReactComponent||(!cr(n,r)||!cr(i,o))}function sa(e,t,n){var r=!1,i=Ai,o=t.contextType;return"object"===typeof o&&null!==o?o=Po(o):(i=Ci(t)?ki:Ti.current,o=(r=null!==(r=t.contextTypes)&&void 0!==r)?Pi(e,i):Ai),t=new t(n,o),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=ia,e.stateNode=t,t._reactInternals=e,r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=o),t}function aa(e,t,n,r){e=t.state,"function"===typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,r),"function"===typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&ia.enqueueReplaceState(t,t.state,null)}function ca(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},Do(e);var o=t.contextType;"object"===typeof o&&null!==o?i.context=Po(o):(o=Ci(t)?ki:Ti.current,i.context=Pi(e,o)),i.state=e.memoizedState,"function"===typeof(o=t.getDerivedStateFromProps)&&(ra(e,t,o,n),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&&ia.enqueueReplaceState(i,i.state,null),Ho(e,n,i,r),i.state=e.memoizedState),"function"===typeof i.componentDidMount&&(e.flags|=4194308)}function la(e,t){try{var n="",r=t;do{n+=z(r),r=r.return}while(r);var i=n}catch(o){i="\nError generating stack: "+o.message+"\n"+o.stack}return{value:e,source:t,stack:i,digest:null}}function ua(e,t,n){return{value:e,source:null,stack:null!=n?n:null,digest:null!=t?t:null}}function da(e,t){try{console.error(t.value)}catch(n){setTimeout((function(){throw n}))}}var fa="function"===typeof WeakMap?WeakMap:Map;function ha(e,t,n){(n=Mo(-1,n)).tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Vc||(Vc=!0,Kc=r),da(0,t)},n}function pa(e,t,n){(n=Mo(-1,n)).tag=3;var r=e.type.getDerivedStateFromError;if("function"===typeof r){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){da(0,t)}}var o=e.stateNode;return null!==o&&"function"===typeof o.componentDidCatch&&(n.callback=function(){da(0,t),"function"!==typeof r&&(null===Wc?Wc=new Set([this]):Wc.add(this));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),n}function ga(e,t,n){var r=e.pingCache;if(null===r){r=e.pingCache=new fa;var i=new Set;r.set(t,i)}else void 0===(i=r.get(t))&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=Il.bind(null,e,t,n),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 ma(e,t,n,r,i){return 0===(1&e.mode)?(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,1===n.tag&&(null===n.alternate?n.tag=17:((t=Mo(-1,1)).tag=2,Fo(n,t,1))),n.lanes|=1),e):(e.flags|=65536,e.lanes=i,e)}var va=w.ReactCurrentOwner,ba=!1;function wa(e,t,n,r){t.child=null===e?_o(t,null,n,r):Eo(t,e.child,n,r)}function Ea(e,t,n,r,i){n=n.render;var o=t.ref;return ko(t,i),r=ys(e,t,n,r,o,i),n=ms(),null===e||ba?(io&&n&&eo(t),t.flags|=1,wa(e,t,r,i),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Va(e,t,i))}function _a(e,t,n,r,i){if(null===e){var o=n.type;return"function"!==typeof o||Cl(o)||void 0!==o.defaultProps||null!==n.compare||void 0!==n.defaultProps?((e=Ul(n.type,null,r,t,t.mode,i)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=o,Sa(e,t,o,r,i))}if(o=e.child,0===(e.lanes&i)){var s=o.memoizedProps;if((n=null!==(n=n.compare)?n:cr)(s,r)&&e.ref===t.ref)return Va(e,t,i)}return t.flags|=1,(e=Nl(o,r)).ref=t.ref,e.return=t,t.child=e}function Sa(e,t,n,r,i){if(null!==e){var o=e.memoizedProps;if(cr(o,r)&&e.ref===t.ref){if(ba=!1,t.pendingProps=r=o,0===(e.lanes&i))return t.lanes=e.lanes,Va(e,t,i);0!==(131072&e.flags)&&(ba=!0)}}return Oa(e,t,n,r,i)}function xa(e,t,n){var r=t.pendingProps,i=r.children,o=null!==e?e.memoizedState:null;if("hidden"===r.mode)if(0===(1&t.mode))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Oi(Nc,Cc),Cc|=n;else{if(0===(1073741824&n))return e=null!==o?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Oi(Nc,Cc),Cc|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=null!==o?o.baseLanes:n,Oi(Nc,Cc),Cc|=r}else null!==o?(r=o.baseLanes|n,t.memoizedState=null):r=n,Oi(Nc,Cc),Cc|=r;return wa(e,t,i,n),t.child}function Ia(e,t){var n=t.ref;(null===e&&null!==n||null!==e&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Oa(e,t,n,r,i){var o=Ci(n)?ki:Ti.current;return o=Pi(t,o),ko(t,i),n=ys(e,t,n,r,o,i),r=ms(),null===e||ba?(io&&r&&eo(t),t.flags|=1,wa(e,t,n,i),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Va(e,t,i))}function Aa(e,t,n,r,i){if(Ci(n)){var o=!0;Li(t)}else o=!1;if(ko(t,i),null===t.stateNode)Ha(e,t),sa(t,n,r),ca(t,n,r,i),r=!0;else if(null===e){var s=t.stateNode,a=t.memoizedProps;s.props=a;var c=s.context,l=n.contextType;"object"===typeof l&&null!==l?l=Po(l):l=Pi(t,l=Ci(n)?ki:Ti.current);var u=n.getDerivedStateFromProps,d="function"===typeof u||"function"===typeof s.getSnapshotBeforeUpdate;d||"function"!==typeof s.UNSAFE_componentWillReceiveProps&&"function"!==typeof s.componentWillReceiveProps||(a!==r||c!==l)&&aa(t,s,r,l),Lo=!1;var f=t.memoizedState;s.state=f,Ho(t,r,s,i),c=t.memoizedState,a!==r||f!==c||Ri.current||Lo?("function"===typeof u&&(ra(t,n,u,r),c=t.memoizedState),(a=Lo||oa(t,n,a,r,f,c,l))?(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=r,t.memoizedState=c),s.props=r,s.state=c,s.context=l,r=a):("function"===typeof s.componentDidMount&&(t.flags|=4194308),r=!1)}else{s=t.stateNode,jo(e,t),a=t.memoizedProps,l=t.type===t.elementType?a:na(t.type,a),s.props=l,d=t.pendingProps,f=s.context,"object"===typeof(c=n.contextType)&&null!==c?c=Po(c):c=Pi(t,c=Ci(n)?ki:Ti.current);var h=n.getDerivedStateFromProps;(u="function"===typeof h||"function"===typeof s.getSnapshotBeforeUpdate)||"function"!==typeof s.UNSAFE_componentWillReceiveProps&&"function"!==typeof s.componentWillReceiveProps||(a!==d||f!==c)&&aa(t,s,r,c),Lo=!1,f=t.memoizedState,s.state=f,Ho(t,r,s,i);var p=t.memoizedState;a!==d||f!==p||Ri.current||Lo?("function"===typeof h&&(ra(t,n,h,r),p=t.memoizedState),(l=Lo||oa(t,n,l,r,f,p,c)||!1)?(u||"function"!==typeof s.UNSAFE_componentWillUpdate&&"function"!==typeof s.componentWillUpdate||("function"===typeof s.componentWillUpdate&&s.componentWillUpdate(r,p,c),"function"===typeof s.UNSAFE_componentWillUpdate&&s.UNSAFE_componentWillUpdate(r,p,c)),"function"===typeof s.componentDidUpdate&&(t.flags|=4),"function"===typeof s.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!==typeof s.componentDidUpdate||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),"function"!==typeof s.getSnapshotBeforeUpdate||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),s.props=r,s.state=p,s.context=c,r=l):("function"!==typeof s.componentDidUpdate||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),"function"!==typeof s.getSnapshotBeforeUpdate||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return Ta(e,t,n,r,o,i)}function Ta(e,t,n,r,i,o){Ia(e,t);var s=0!==(128&t.flags);if(!r&&!s)return i&&Di(t,n,!1),Va(e,t,o);r=t.stateNode,va.current=t;var a=s&&"function"!==typeof n.getDerivedStateFromError?null:r.render();return t.flags|=1,null!==e&&s?(t.child=Eo(t,e.child,null,o),t.child=Eo(t,null,a,o)):wa(e,t,a,o),t.memoizedState=r.state,i&&Di(t,n,!0),t.child}function Ra(e){var t=e.stateNode;t.pendingContext?Ui(0,t.pendingContext,t.pendingContext!==t.context):t.context&&Ui(0,t.context,!1),Xo(e,t.containerInfo)}function ka(e,t,n,r,i){return po(),go(i),t.flags|=256,wa(e,t,n,r),t.child}var Pa,Ca,Na,Ua,Ba={dehydrated:null,treeContext:null,retryLane:0};function La(e){return{baseLanes:e,cachePool:null,transitions:null}}function Da(e,t,n){var r,i=t.pendingProps,s=es.current,a=!1,c=0!==(128&t.flags);if((r=c)||(r=(null===e||null!==e.memoizedState)&&0!==(2&s)),r?(a=!0,t.flags&=-129):null!==e&&null===e.memoizedState||(s|=1),Oi(es,1&s),null===e)return lo(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):(c=i.children,e=i.fallback,a?(i=t.mode,a=t.child,c={mode:"hidden",children:c},0===(1&i)&&null!==a?(a.childLanes=0,a.pendingProps=c):a=Ll(c,i,0,null),e=Bl(e,i,n,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=La(n),t.memoizedState=Ba,e):ja(t,c));if(null!==(s=e.memoizedState)&&null!==(r=s.dehydrated))return function(e,t,n,r,i,s,a){if(n)return 256&t.flags?(t.flags&=-257,Ma(e,t,a,r=ua(Error(o(422))))):null!==t.memoizedState?(t.child=e.child,t.flags|=128,null):(s=r.fallback,i=t.mode,r=Ll({mode:"visible",children:r.children},i,0,null),(s=Bl(s,i,a,null)).flags|=2,r.return=t,s.return=t,r.sibling=s,t.child=r,0!==(1&t.mode)&&Eo(t,e.child,null,a),t.child.memoizedState=La(a),t.memoizedState=Ba,s);if(0===(1&t.mode))return Ma(e,t,a,null);if("$!"===i.data){if(r=i.nextSibling&&i.nextSibling.dataset)var c=r.dgst;return r=c,Ma(e,t,a,r=ua(s=Error(o(419)),r,void 0))}if(c=0!==(a&e.childLanes),ba||c){if(null!==(r=Rc)){switch(a&-a){case 4:i=2;break;case 16:i=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:i=32;break;case 536870912:i=268435456;break;default:i=0}0!==(i=0!==(i&(r.suspendedLanes|a))?0:i)&&i!==s.retryLane&&(s.retryLane=i,Bo(e,i),nl(r,e,i,-1))}return gl(),Ma(e,t,a,r=ua(Error(o(421))))}return"$?"===i.data?(t.flags|=128,t.child=e.child,t=Al.bind(null,e),i._reactRetry=t,null):(e=s.treeContext,ro=li(i.nextSibling),no=t,io=!0,oo=null,null!==e&&(Gi[Yi++]=Xi,Gi[Yi++]=Qi,Gi[Yi++]=Zi,Xi=e.id,Qi=e.overflow,Zi=t),t=ja(t,r.children),t.flags|=4096,t)}(e,t,c,i,r,s,n);if(a){a=i.fallback,c=t.mode,r=(s=e.child).sibling;var l={mode:"hidden",children:i.children};return 0===(1&c)&&t.child!==s?((i=t.child).childLanes=0,i.pendingProps=l,t.deletions=null):(i=Nl(s,l)).subtreeFlags=14680064&s.subtreeFlags,null!==r?a=Nl(r,a):(a=Bl(a,c,n,null)).flags|=2,a.return=t,i.return=t,i.sibling=a,t.child=i,i=a,a=t.child,c=null===(c=e.child.memoizedState)?La(n):{baseLanes:c.baseLanes|n,cachePool:null,transitions:c.transitions},a.memoizedState=c,a.childLanes=e.childLanes&~n,t.memoizedState=Ba,i}return e=(a=e.child).sibling,i=Nl(a,{mode:"visible",children:i.children}),0===(1&t.mode)&&(i.lanes=n),i.return=t,i.sibling=null,null!==e&&(null===(n=t.deletions)?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=i,t.memoizedState=null,i}function ja(e,t){return(t=Ll({mode:"visible",children:t},e.mode,0,null)).return=e,e.child=t}function Ma(e,t,n,r){return null!==r&&go(r),Eo(t,e.child,null,n),(e=ja(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function Fa(e,t,n){e.lanes|=t;var r=e.alternate;null!==r&&(r.lanes|=t),Ro(e.return,t,n)}function za(e,t,n,r,i){var o=e.memoizedState;null===o?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i)}function qa(e,t,n){var r=t.pendingProps,i=r.revealOrder,o=r.tail;if(wa(e,t,r.children,n),0!==(2&(r=es.current)))r=1&r|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,n,t);else if(19===e.tag)Fa(e,n,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}r&=1}if(Oi(es,r),0===(1&t.mode))t.memoizedState=null;else switch(i){case"forwards":for(n=t.child,i=null;null!==n;)null!==(e=n.alternate)&&null===ts(e)&&(i=n),n=n.sibling;null===(n=i)?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),za(t,!1,i,n,o);break;case"backwards":for(n=null,i=t.child,t.child=null;null!==i;){if(null!==(e=i.alternate)&&null===ts(e)){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}za(t,!0,n,null,o);break;case"together":za(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Ha(e,t){0===(1&t.mode)&&null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Va(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),Lc|=t.lanes,0===(n&t.childLanes))return null;if(null!==e&&t.child!==e.child)throw Error(o(153));if(null!==t.child){for(n=Nl(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=Nl(e,e.pendingProps)).return=t;n.sibling=null}return t.child}function Ka(e,t){if(!io)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Wa(e){var t=null!==e.alternate&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;null!==i;)n|=i.lanes|i.childLanes,r|=14680064&i.subtreeFlags,r|=14680064&i.flags,i.return=e,i=i.sibling;else for(i=e.child;null!==i;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Ga(e,t,n){var r=t.pendingProps;switch(to(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Wa(t),null;case 1:case 17:return Ci(t.type)&&Ni(),Wa(t),null;case 3:return r=t.stateNode,Qo(),Ii(Ri),Ii(Ti),rs(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),null!==e&&null!==e.child||(fo(t)?t.flags|=4:null===e||e.memoizedState.isDehydrated&&0===(256&t.flags)||(t.flags|=1024,null!==oo&&(sl(oo),oo=null))),Ca(e,t),Wa(t),null;case 5:$o(t);var i=Zo(Yo.current);if(n=t.type,null!==e&&null!=t.stateNode)Na(e,t,n,r,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(null===t.stateNode)throw Error(o(166));return Wa(t),null}if(e=Zo(Wo.current),fo(t)){r=t.stateNode,n=t.type;var s=t.memoizedProps;switch(r[fi]=t,r[hi]=s,e=0!==(1&t.mode),n){case"dialog":Mr("cancel",r),Mr("close",r);break;case"iframe":case"object":case"embed":Mr("load",r);break;case"video":case"audio":for(i=0;i<Br.length;i++)Mr(Br[i],r);break;case"source":Mr("error",r);break;case"img":case"image":case"link":Mr("error",r),Mr("load",r);break;case"details":Mr("toggle",r);break;case"input":X(r,s),Mr("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!s.multiple},Mr("invalid",r);break;case"textarea":ie(r,s),Mr("invalid",r)}for(var c in ve(n,s),i=null,s)if(s.hasOwnProperty(c)){var l=s[c];"children"===c?"string"===typeof l?r.textContent!==l&&(!0!==s.suppressHydrationWarning&&Jr(r.textContent,l,e),i=["children",l]):"number"===typeof l&&r.textContent!==""+l&&(!0!==s.suppressHydrationWarning&&Jr(r.textContent,l,e),i=["children",""+l]):a.hasOwnProperty(c)&&null!=l&&"onScroll"===c&&Mr("scroll",r)}switch(n){case"input":W(r),$(r,s,!0);break;case"textarea":W(r),se(r);break;case"select":case"option":break;default:"function"===typeof s.onClick&&(r.onclick=$r)}r=i,t.updateQueue=r,null!==r&&(t.flags|=4)}else{c=9===i.nodeType?i:i.ownerDocument,"http://www.w3.org/1999/xhtml"===e&&(e=ae(n)),"http://www.w3.org/1999/xhtml"===e?"script"===n?((e=c.createElement("div")).innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):"string"===typeof r.is?e=c.createElement(n,{is:r.is}):(e=c.createElement(n),"select"===n&&(c=e,r.multiple?c.multiple=!0:r.size&&(c.size=r.size))):e=c.createElementNS(e,n),e[fi]=t,e[hi]=r,Pa(e,t,!1,!1),t.stateNode=e;e:{switch(c=be(n,r),n){case"dialog":Mr("cancel",e),Mr("close",e),i=r;break;case"iframe":case"object":case"embed":Mr("load",e),i=r;break;case"video":case"audio":for(i=0;i<Br.length;i++)Mr(Br[i],e);i=r;break;case"source":Mr("error",e),i=r;break;case"img":case"image":case"link":Mr("error",e),Mr("load",e),i=r;break;case"details":Mr("toggle",e),i=r;break;case"input":X(e,r),i=Z(e,r),Mr("invalid",e);break;case"option":default:i=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},i=D({},r,{value:void 0}),Mr("invalid",e);break;case"textarea":ie(e,r),i=re(e,r),Mr("invalid",e)}for(s in ve(n,i),l=i)if(l.hasOwnProperty(s)){var u=l[s];"style"===s?ye(e,u):"dangerouslySetInnerHTML"===s?null!=(u=u?u.__html:void 0)&&de(e,u):"children"===s?"string"===typeof u?("textarea"!==n||""!==u)&&fe(e,u):"number"===typeof u&&fe(e,""+u):"suppressContentEditableWarning"!==s&&"suppressHydrationWarning"!==s&&"autoFocus"!==s&&(a.hasOwnProperty(s)?null!=u&&"onScroll"===s&&Mr("scroll",e):null!=u&&b(e,s,u,c))}switch(n){case"input":W(e),$(e,r,!1);break;case"textarea":W(e),se(e);break;case"option":null!=r.value&&e.setAttribute("value",""+V(r.value));break;case"select":e.multiple=!!r.multiple,null!=(s=r.value)?ne(e,!!r.multiple,s,!1):null!=r.defaultValue&&ne(e,!!r.multiple,r.defaultValue,!0);break;default:"function"===typeof i.onClick&&(e.onclick=$r)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}null!==t.ref&&(t.flags|=512,t.flags|=2097152)}return Wa(t),null;case 6:if(e&&null!=t.stateNode)Ua(e,t,e.memoizedProps,r);else{if("string"!==typeof r&&null===t.stateNode)throw Error(o(166));if(n=Zo(Yo.current),Zo(Wo.current),fo(t)){if(r=t.stateNode,n=t.memoizedProps,r[fi]=t,(s=r.nodeValue!==n)&&null!==(e=no))switch(e.tag){case 3:Jr(r.nodeValue,n,0!==(1&e.mode));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&Jr(r.nodeValue,n,0!==(1&e.mode))}s&&(t.flags|=4)}else(r=(9===n.nodeType?n:n.ownerDocument).createTextNode(r))[fi]=t,t.stateNode=r}return Wa(t),null;case 13:if(Ii(es),r=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(io&&null!==ro&&0!==(1&t.mode)&&0===(128&t.flags))ho(),po(),t.flags|=98560,s=!1;else if(s=fo(t),null!==r&&null!==r.dehydrated){if(null===e){if(!s)throw Error(o(318));if(!(s=null!==(s=t.memoizedState)?s.dehydrated:null))throw Error(o(317));s[fi]=t}else po(),0===(128&t.flags)&&(t.memoizedState=null),t.flags|=4;Wa(t),s=!1}else null!==oo&&(sl(oo),oo=null),s=!0;if(!s)return 65536&t.flags?t:null}return 0!==(128&t.flags)?(t.lanes=n,t):((r=null!==r)!==(null!==e&&null!==e.memoizedState)&&r&&(t.child.flags|=8192,0!==(1&t.mode)&&(null===e||0!==(1&es.current)?0===Uc&&(Uc=3):gl())),null!==t.updateQueue&&(t.flags|=4),Wa(t),null);case 4:return Qo(),Ca(e,t),null===e&&qr(t.stateNode.containerInfo),Wa(t),null;case 10:return To(t.type._context),Wa(t),null;case 19:if(Ii(es),null===(s=t.memoizedState))return Wa(t),null;if(r=0!==(128&t.flags),null===(c=s.rendering))if(r)Ka(s,!1);else{if(0!==Uc||null!==e&&0!==(128&e.flags))for(e=t.child;null!==e;){if(null!==(c=ts(e))){for(t.flags|=128,Ka(s,!1),null!==(r=c.updateQueue)&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;null!==n;)e=r,(s=n).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}),n=n.sibling;return Oi(es,1&es.current|2),t.child}e=e.sibling}null!==s.tail&&Qe()>qc&&(t.flags|=128,r=!0,Ka(s,!1),t.lanes=4194304)}else{if(!r)if(null!==(e=ts(c))){if(t.flags|=128,r=!0,null!==(n=e.updateQueue)&&(t.updateQueue=n,t.flags|=4),Ka(s,!0),null===s.tail&&"hidden"===s.tailMode&&!c.alternate&&!io)return Wa(t),null}else 2*Qe()-s.renderingStartTime>qc&&1073741824!==n&&(t.flags|=128,r=!0,Ka(s,!1),t.lanes=4194304);s.isBackwards?(c.sibling=t.child,t.child=c):(null!==(n=s.last)?n.sibling=c:t.child=c,s.last=c)}return null!==s.tail?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=Qe(),t.sibling=null,n=es.current,Oi(es,r?1&n|2:1&n),t):(Wa(t),null);case 22:case 23:return dl(),r=null!==t.memoizedState,null!==e&&null!==e.memoizedState!==r&&(t.flags|=8192),r&&0!==(1&t.mode)?0!==(1073741824&Cc)&&(Wa(t),6&t.subtreeFlags&&(t.flags|=8192)):Wa(t),null;case 24:case 25:return null}throw Error(o(156,t.tag))}function Ya(e,t){switch(to(t),t.tag){case 1:return Ci(t.type)&&Ni(),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return Qo(),Ii(Ri),Ii(Ti),rs(),0!==(65536&(e=t.flags))&&0===(128&e)?(t.flags=-65537&e|128,t):null;case 5:return $o(t),null;case 13:if(Ii(es),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(o(340));po()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return Ii(es),null;case 4:return Qo(),null;case 10:return To(t.type._context),null;case 22:case 23:return dl(),null;default:return null}}Pa=function(e,t){for(var n=t.child;null!==n;){if(5===n.tag||6===n.tag)e.appendChild(n.stateNode);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},Ca=function(){},Na=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,Zo(Wo.current);var o,s=null;switch(n){case"input":i=Z(e,i),r=Z(e,r),s=[];break;case"select":i=D({},i,{value:void 0}),r=D({},r,{value:void 0}),s=[];break;case"textarea":i=re(e,i),r=re(e,r),s=[];break;default:"function"!==typeof i.onClick&&"function"===typeof r.onClick&&(e.onclick=$r)}for(u in ve(n,r),n=null,i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&null!=i[u])if("style"===u){var c=i[u];for(o in c)c.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else"dangerouslySetInnerHTML"!==u&&"children"!==u&&"suppressContentEditableWarning"!==u&&"suppressHydrationWarning"!==u&&"autoFocus"!==u&&(a.hasOwnProperty(u)?s||(s=[]):(s=s||[]).push(u,null));for(u in r){var l=r[u];if(c=null!=i?i[u]:void 0,r.hasOwnProperty(u)&&l!==c&&(null!=l||null!=c))if("style"===u)if(c){for(o in c)!c.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in l)l.hasOwnProperty(o)&&c[o]!==l[o]&&(n||(n={}),n[o]=l[o])}else n||(s||(s=[]),s.push(u,n)),n=l;else"dangerouslySetInnerHTML"===u?(l=l?l.__html:void 0,c=c?c.__html:void 0,null!=l&&c!==l&&(s=s||[]).push(u,l)):"children"===u?"string"!==typeof l&&"number"!==typeof l||(s=s||[]).push(u,""+l):"suppressContentEditableWarning"!==u&&"suppressHydrationWarning"!==u&&(a.hasOwnProperty(u)?(null!=l&&"onScroll"===u&&Mr("scroll",e),s||c===l||(s=[])):(s=s||[]).push(u,l))}n&&(s=s||[]).push("style",n);var u=s;(t.updateQueue=u)&&(t.flags|=4)}},Ua=function(e,t,n,r){n!==r&&(t.flags|=4)};var Za=!1,Xa=!1,Qa="function"===typeof WeakSet?WeakSet:Set,Ja=null;function $a(e,t){var n=e.ref;if(null!==n)if("function"===typeof n)try{n(null)}catch(r){xl(e,t,r)}else n.current=null}function ec(e,t,n){try{n()}catch(r){xl(e,t,r)}}var tc=!1;function nc(e,t,n){var r=t.updateQueue;if(null!==(r=null!==r?r.lastEffect:null)){var i=r=r.next;do{if((i.tag&e)===e){var o=i.destroy;i.destroy=void 0,void 0!==o&&ec(t,n,o)}i=i.next}while(i!==r)}}function rc(e,t){if(null!==(t=null!==(t=t.updateQueue)?t.lastEffect:null)){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function ic(e){var t=e.ref;if(null!==t){var n=e.stateNode;e.tag,e=n,"function"===typeof t?t(e):t.current=e}}function oc(e){var t=e.alternate;null!==t&&(e.alternate=null,oc(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&(null!==(t=e.stateNode)&&(delete t[fi],delete t[hi],delete t[gi],delete t[yi],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 sc(e){return 5===e.tag||3===e.tag||4===e.tag}function ac(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||sc(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 cc(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?8===n.nodeType?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(8===n.nodeType?(t=n.parentNode).insertBefore(e,n):(t=n).appendChild(e),null!==(n=n._reactRootContainer)&&void 0!==n||null!==t.onclick||(t.onclick=$r));else if(4!==r&&null!==(e=e.child))for(cc(e,t,n),e=e.sibling;null!==e;)cc(e,t,n),e=e.sibling}function lc(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(4!==r&&null!==(e=e.child))for(lc(e,t,n),e=e.sibling;null!==e;)lc(e,t,n),e=e.sibling}var uc=null,dc=!1;function fc(e,t,n){for(n=n.child;null!==n;)hc(e,t,n),n=n.sibling}function hc(e,t,n){if(ot&&"function"===typeof ot.onCommitFiberUnmount)try{ot.onCommitFiberUnmount(it,n)}catch(a){}switch(n.tag){case 5:Xa||$a(n,t);case 6:var r=uc,i=dc;uc=null,fc(e,t,n),dc=i,null!==(uc=r)&&(dc?(e=uc,n=n.stateNode,8===e.nodeType?e.parentNode.removeChild(n):e.removeChild(n)):uc.removeChild(n.stateNode));break;case 18:null!==uc&&(dc?(e=uc,n=n.stateNode,8===e.nodeType?ci(e.parentNode,n):1===e.nodeType&&ci(e,n),qt(e)):ci(uc,n.stateNode));break;case 4:r=uc,i=dc,uc=n.stateNode.containerInfo,dc=!0,fc(e,t,n),uc=r,dc=i;break;case 0:case 11:case 14:case 15:if(!Xa&&(null!==(r=n.updateQueue)&&null!==(r=r.lastEffect))){i=r=r.next;do{var o=i,s=o.destroy;o=o.tag,void 0!==s&&(0!==(2&o)||0!==(4&o))&&ec(n,t,s),i=i.next}while(i!==r)}fc(e,t,n);break;case 1:if(!Xa&&($a(n,t),"function"===typeof(r=n.stateNode).componentWillUnmount))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){xl(n,t,a)}fc(e,t,n);break;case 21:fc(e,t,n);break;case 22:1&n.mode?(Xa=(r=Xa)||null!==n.memoizedState,fc(e,t,n),Xa=r):fc(e,t,n);break;default:fc(e,t,n)}}function pc(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var n=e.stateNode;null===n&&(n=e.stateNode=new Qa),t.forEach((function(t){var r=Tl.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))}))}}function gc(e,t){var n=t.deletions;if(null!==n)for(var r=0;r<n.length;r++){var i=n[r];try{var s=e,a=t,c=a;e:for(;null!==c;){switch(c.tag){case 5:uc=c.stateNode,dc=!1;break e;case 3:case 4:uc=c.stateNode.containerInfo,dc=!0;break e}c=c.return}if(null===uc)throw Error(o(160));hc(s,a,i),uc=null,dc=!1;var l=i.alternate;null!==l&&(l.return=null),i.return=null}catch(u){xl(i,t,u)}}if(12854&t.subtreeFlags)for(t=t.child;null!==t;)yc(t,e),t=t.sibling}function yc(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(gc(t,e),mc(e),4&r){try{nc(3,e,e.return),rc(3,e)}catch(y){xl(e,e.return,y)}try{nc(5,e,e.return)}catch(y){xl(e,e.return,y)}}break;case 1:gc(t,e),mc(e),512&r&&null!==n&&$a(n,n.return);break;case 5:if(gc(t,e),mc(e),512&r&&null!==n&&$a(n,n.return),32&e.flags){var i=e.stateNode;try{fe(i,"")}catch(y){xl(e,e.return,y)}}if(4&r&&null!=(i=e.stateNode)){var s=e.memoizedProps,a=null!==n?n.memoizedProps:s,c=e.type,l=e.updateQueue;if(e.updateQueue=null,null!==l)try{"input"===c&&"radio"===s.type&&null!=s.name&&Q(i,s),be(c,a);var u=be(c,s);for(a=0;a<l.length;a+=2){var d=l[a],f=l[a+1];"style"===d?ye(i,f):"dangerouslySetInnerHTML"===d?de(i,f):"children"===d?fe(i,f):b(i,d,f,u)}switch(c){case"input":J(i,s);break;case"textarea":oe(i,s);break;case"select":var h=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!s.multiple;var p=s.value;null!=p?ne(i,!!s.multiple,p,!1):h!==!!s.multiple&&(null!=s.defaultValue?ne(i,!!s.multiple,s.defaultValue,!0):ne(i,!!s.multiple,s.multiple?[]:"",!1))}i[hi]=s}catch(y){xl(e,e.return,y)}}break;case 6:if(gc(t,e),mc(e),4&r){if(null===e.stateNode)throw Error(o(162));i=e.stateNode,s=e.memoizedProps;try{i.nodeValue=s}catch(y){xl(e,e.return,y)}}break;case 3:if(gc(t,e),mc(e),4&r&&null!==n&&n.memoizedState.isDehydrated)try{qt(t.containerInfo)}catch(y){xl(e,e.return,y)}break;case 4:default:gc(t,e),mc(e);break;case 13:gc(t,e),mc(e),8192&(i=e.child).flags&&(s=null!==i.memoizedState,i.stateNode.isHidden=s,!s||null!==i.alternate&&null!==i.alternate.memoizedState||(zc=Qe())),4&r&&pc(e);break;case 22:if(d=null!==n&&null!==n.memoizedState,1&e.mode?(Xa=(u=Xa)||d,gc(t,e),Xa=u):gc(t,e),mc(e),8192&r){if(u=null!==e.memoizedState,(e.stateNode.isHidden=u)&&!d&&0!==(1&e.mode))for(Ja=e,d=e.child;null!==d;){for(f=Ja=d;null!==Ja;){switch(p=(h=Ja).child,h.tag){case 0:case 11:case 14:case 15:nc(4,h,h.return);break;case 1:$a(h,h.return);var g=h.stateNode;if("function"===typeof g.componentWillUnmount){r=h,n=h.return;try{t=r,g.props=t.memoizedProps,g.state=t.memoizedState,g.componentWillUnmount()}catch(y){xl(r,n,y)}}break;case 5:$a(h,h.return);break;case 22:if(null!==h.memoizedState){Ec(f);continue}}null!==p?(p.return=h,Ja=p):Ec(f)}d=d.sibling}e:for(d=null,f=e;;){if(5===f.tag){if(null===d){d=f;try{i=f.stateNode,u?"function"===typeof(s=i.style).setProperty?s.setProperty("display","none","important"):s.display="none":(c=f.stateNode,a=void 0!==(l=f.memoizedProps.style)&&null!==l&&l.hasOwnProperty("display")?l.display:null,c.style.display=ge("display",a))}catch(y){xl(e,e.return,y)}}}else if(6===f.tag){if(null===d)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(y){xl(e,e.return,y)}}else if((22!==f.tag&&23!==f.tag||null===f.memoizedState||f===e)&&null!==f.child){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;null===f.sibling;){if(null===f.return||f.return===e)break e;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:gc(t,e),mc(e),4&r&&pc(e);case 21:}}function mc(e){var t=e.flags;if(2&t){try{e:{for(var n=e.return;null!==n;){if(sc(n)){var r=n;break e}n=n.return}throw Error(o(160))}switch(r.tag){case 5:var i=r.stateNode;32&r.flags&&(fe(i,""),r.flags&=-33),lc(e,ac(e),i);break;case 3:case 4:var s=r.stateNode.containerInfo;cc(e,ac(e),s);break;default:throw Error(o(161))}}catch(a){xl(e,e.return,a)}e.flags&=-3}4096&t&&(e.flags&=-4097)}function vc(e,t,n){Ja=e,bc(e,t,n)}function bc(e,t,n){for(var r=0!==(1&e.mode);null!==Ja;){var i=Ja,o=i.child;if(22===i.tag&&r){var s=null!==i.memoizedState||Za;if(!s){var a=i.alternate,c=null!==a&&null!==a.memoizedState||Xa;a=Za;var l=Xa;if(Za=s,(Xa=c)&&!l)for(Ja=i;null!==Ja;)c=(s=Ja).child,22===s.tag&&null!==s.memoizedState?_c(i):null!==c?(c.return=s,Ja=c):_c(i);for(;null!==o;)Ja=o,bc(o,t,n),o=o.sibling;Ja=i,Za=a,Xa=l}wc(e)}else 0!==(8772&i.subtreeFlags)&&null!==o?(o.return=i,Ja=o):wc(e)}}function wc(e){for(;null!==Ja;){var t=Ja;if(0!==(8772&t.flags)){var n=t.alternate;try{if(0!==(8772&t.flags))switch(t.tag){case 0:case 11:case 15:Xa||rc(5,t);break;case 1:var r=t.stateNode;if(4&t.flags&&!Xa)if(null===n)r.componentDidMount();else{var i=t.elementType===t.type?n.memoizedProps:na(t.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var s=t.updateQueue;null!==s&&Vo(t,s,r);break;case 3:var a=t.updateQueue;if(null!==a){if(n=null,null!==t.child)switch(t.child.tag){case 5:case 1:n=t.child.stateNode}Vo(t,a,n)}break;case 5:var c=t.stateNode;if(null===n&&4&t.flags){n=c;var l=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break;case"img":l.src&&(n.src=l.src)}}break;case 6:case 4:case 12:case 19:case 17:case 21:case 22:case 23:case 25:break;case 13:if(null===t.memoizedState){var u=t.alternate;if(null!==u){var d=u.memoizedState;if(null!==d){var f=d.dehydrated;null!==f&&qt(f)}}}break;default:throw Error(o(163))}Xa||512&t.flags&&ic(t)}catch(h){xl(t,t.return,h)}}if(t===e){Ja=null;break}if(null!==(n=t.sibling)){n.return=t.return,Ja=n;break}Ja=t.return}}function Ec(e){for(;null!==Ja;){var t=Ja;if(t===e){Ja=null;break}var n=t.sibling;if(null!==n){n.return=t.return,Ja=n;break}Ja=t.return}}function _c(e){for(;null!==Ja;){var t=Ja;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{rc(4,t)}catch(c){xl(t,n,c)}break;case 1:var r=t.stateNode;if("function"===typeof r.componentDidMount){var i=t.return;try{r.componentDidMount()}catch(c){xl(t,i,c)}}var o=t.return;try{ic(t)}catch(c){xl(t,o,c)}break;case 5:var s=t.return;try{ic(t)}catch(c){xl(t,s,c)}}}catch(c){xl(t,t.return,c)}if(t===e){Ja=null;break}var a=t.sibling;if(null!==a){a.return=t.return,Ja=a;break}Ja=t.return}}var Sc,xc=Math.ceil,Ic=w.ReactCurrentDispatcher,Oc=w.ReactCurrentOwner,Ac=w.ReactCurrentBatchConfig,Tc=0,Rc=null,kc=null,Pc=0,Cc=0,Nc=xi(0),Uc=0,Bc=null,Lc=0,Dc=0,jc=0,Mc=null,Fc=null,zc=0,qc=1/0,Hc=null,Vc=!1,Kc=null,Wc=null,Gc=!1,Yc=null,Zc=0,Xc=0,Qc=null,Jc=-1,$c=0;function el(){return 0!==(6&Tc)?Qe():-1!==Jc?Jc:Jc=Qe()}function tl(e){return 0===(1&e.mode)?1:0!==(2&Tc)&&0!==Pc?Pc&-Pc:null!==yo.transition?(0===$c&&($c=gt()),$c):0!==(e=bt)?e:e=void 0===(e=window.event)?16:Xt(e.type)}function nl(e,t,n,r){if(50<Xc)throw Xc=0,Qc=null,Error(o(185));mt(e,n,r),0!==(2&Tc)&&e===Rc||(e===Rc&&(0===(2&Tc)&&(Dc|=n),4===Uc&&al(e,Pc)),rl(e,r),1===n&&0===Tc&&0===(1&t.mode)&&(qc=Qe()+500,Mi&&qi()))}function rl(e,t){var n=e.callbackNode;!function(e,t){for(var n=e.suspendedLanes,r=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&n)&&0===(a&r)||(i[s]=ht(a,t)):c<=t&&(e.expiredLanes|=a),o&=~a}}(e,t);var r=ft(e,e===Rc?Pc:0);if(0===r)null!==n&&Ye(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(null!=n&&Ye(n),1===t)0===e.tag?function(e){Mi=!0,zi(e)}(cl.bind(null,e)):zi(cl.bind(null,e)),si((function(){0===(6&Tc)&&qi()})),n=null;else{switch(wt(r)){case 1:n=$e;break;case 4:n=et;break;case 16:default:n=tt;break;case 536870912:n=rt}n=Rl(n,il.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function il(e,t){if(Jc=-1,$c=0,0!==(6&Tc))throw Error(o(327));var n=e.callbackNode;if(_l()&&e.callbackNode!==n)return null;var r=ft(e,e===Rc?Pc:0);if(0===r)return null;if(0!==(30&r)||0!==(r&e.expiredLanes)||t)t=yl(e,r);else{t=r;var i=Tc;Tc|=2;var s=pl();for(Rc===e&&Pc===t||(Hc=null,qc=Qe()+500,fl(e,t));;)try{vl();break}catch(c){hl(e,c)}Ao(),Ic.current=s,Tc=i,null!==kc?t=0:(Rc=null,Pc=0,t=Uc)}if(0!==t){if(2===t&&(0!==(i=pt(e))&&(r=i,t=ol(e,i))),1===t)throw n=Bc,fl(e,0),al(e,r),rl(e,Qe()),n;if(6===t)al(e,r);else{if(i=e.current.alternate,0===(30&r)&&!function(e){for(var t=e;;){if(16384&t.flags){var n=t.updateQueue;if(null!==n&&null!==(n=n.stores))for(var r=0;r<n.length;r++){var i=n[r],o=i.getSnapshot;i=i.value;try{if(!ar(o(),i))return!1}catch(a){return!1}}}if(n=t.child,16384&t.subtreeFlags&&null!==n)n.return=t,t=n;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=yl(e,r))&&(0!==(s=pt(e))&&(r=s,t=ol(e,s))),1===t))throw n=Bc,fl(e,0),al(e,r),rl(e,Qe()),n;switch(e.finishedWork=i,e.finishedLanes=r,t){case 0:case 1:throw Error(o(345));case 2:case 5:El(e,Fc,Hc);break;case 3:if(al(e,r),(130023424&r)===r&&10<(t=zc+500-Qe())){if(0!==ft(e,0))break;if(((i=e.suspendedLanes)&r)!==r){el(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=ri(El.bind(null,e,Fc,Hc),t);break}El(e,Fc,Hc);break;case 4:if(al(e,r),(4194240&r)===r)break;for(t=e.eventTimes,i=-1;0<r;){var a=31-st(r);s=1<<a,(a=t[a])>i&&(i=a),r&=~s}if(r=i,10<(r=(120>(r=Qe()-r)?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*xc(r/1960))-r)){e.timeoutHandle=ri(El.bind(null,e,Fc,Hc),r);break}El(e,Fc,Hc);break;default:throw Error(o(329))}}}return rl(e,Qe()),e.callbackNode===n?il.bind(null,e):null}function ol(e,t){var n=Mc;return e.current.memoizedState.isDehydrated&&(fl(e,t).flags|=256),2!==(e=yl(e,t))&&(t=Fc,Fc=n,null!==t&&sl(t)),e}function sl(e){null===Fc?Fc=e:Fc.push.apply(Fc,e)}function al(e,t){for(t&=~jc,t&=~Dc,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-st(t),r=1<<n;e[n]=-1,t&=~r}}function cl(e){if(0!==(6&Tc))throw Error(o(327));_l();var t=ft(e,0);if(0===(1&t))return rl(e,Qe()),null;var n=yl(e,t);if(0!==e.tag&&2===n){var r=pt(e);0!==r&&(t=r,n=ol(e,r))}if(1===n)throw n=Bc,fl(e,0),al(e,t),rl(e,Qe()),n;if(6===n)throw Error(o(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,El(e,Fc,Hc),rl(e,Qe()),null}function ll(e,t){var n=Tc;Tc|=1;try{return e(t)}finally{0===(Tc=n)&&(qc=Qe()+500,Mi&&qi())}}function ul(e){null!==Yc&&0===Yc.tag&&0===(6&Tc)&&_l();var t=Tc;Tc|=1;var n=Ac.transition,r=bt;try{if(Ac.transition=null,bt=1,e)return e()}finally{bt=r,Ac.transition=n,0===(6&(Tc=t))&&qi()}}function dl(){Cc=Nc.current,Ii(Nc)}function fl(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(-1!==n&&(e.timeoutHandle=-1,ii(n)),null!==kc)for(n=kc.return;null!==n;){var r=n;switch(to(r),r.tag){case 1:null!==(r=r.type.childContextTypes)&&void 0!==r&&Ni();break;case 3:Qo(),Ii(Ri),Ii(Ti),rs();break;case 5:$o(r);break;case 4:Qo();break;case 13:case 19:Ii(es);break;case 10:To(r.type._context);break;case 22:case 23:dl()}n=n.return}if(Rc=e,kc=e=Nl(e.current,null),Pc=Cc=t,Uc=0,Bc=null,jc=Dc=Lc=0,Fc=Mc=null,null!==Co){for(t=0;t<Co.length;t++)if(null!==(r=(n=Co[t]).interleaved)){n.interleaved=null;var i=r.next,o=n.pending;if(null!==o){var s=o.next;o.next=i,r.next=s}n.pending=r}Co=null}return e}function hl(e,t){for(;;){var n=kc;try{if(Ao(),is.current=Js,us){for(var r=as.memoizedState;null!==r;){var i=r.queue;null!==i&&(i.pending=null),r=r.next}us=!1}if(ss=0,ls=cs=as=null,ds=!1,fs=0,Oc.current=null,null===n||null===n.return){Uc=1,Bc=t,kc=null;break}e:{var s=e,a=n.return,c=n,l=t;if(t=Pc,c.flags|=32768,null!==l&&"object"===typeof l&&"function"===typeof l.then){var u=l,d=c,f=d.tag;if(0===(1&d.mode)&&(0===f||11===f||15===f)){var h=d.alternate;h?(d.updateQueue=h.updateQueue,d.memoizedState=h.memoizedState,d.lanes=h.lanes):(d.updateQueue=null,d.memoizedState=null)}var p=ya(a);if(null!==p){p.flags&=-257,ma(p,a,c,0,t),1&p.mode&&ga(s,u,t),l=u;var g=(t=p).updateQueue;if(null===g){var y=new Set;y.add(l),t.updateQueue=y}else g.add(l);break e}if(0===(1&t)){ga(s,u,t),gl();break e}l=Error(o(426))}else if(io&&1&c.mode){var m=ya(a);if(null!==m){0===(65536&m.flags)&&(m.flags|=256),ma(m,a,c,0,t),go(la(l,c));break e}}s=l=la(l,c),4!==Uc&&(Uc=2),null===Mc?Mc=[s]:Mc.push(s),s=a;do{switch(s.tag){case 3:s.flags|=65536,t&=-t,s.lanes|=t,qo(s,ha(0,l,t));break e;case 1:c=l;var v=s.type,b=s.stateNode;if(0===(128&s.flags)&&("function"===typeof v.getDerivedStateFromError||null!==b&&"function"===typeof b.componentDidCatch&&(null===Wc||!Wc.has(b)))){s.flags|=65536,t&=-t,s.lanes|=t,qo(s,pa(s,c,t));break e}}s=s.return}while(null!==s)}wl(n)}catch(w){t=w,kc===n&&null!==n&&(kc=n=n.return);continue}break}}function pl(){var e=Ic.current;return Ic.current=Js,null===e?Js:e}function gl(){0!==Uc&&3!==Uc&&2!==Uc||(Uc=4),null===Rc||0===(268435455&Lc)&&0===(268435455&Dc)||al(Rc,Pc)}function yl(e,t){var n=Tc;Tc|=2;var r=pl();for(Rc===e&&Pc===t||(Hc=null,fl(e,t));;)try{ml();break}catch(i){hl(e,i)}if(Ao(),Tc=n,Ic.current=r,null!==kc)throw Error(o(261));return Rc=null,Pc=0,Uc}function ml(){for(;null!==kc;)bl(kc)}function vl(){for(;null!==kc&&!Ze();)bl(kc)}function bl(e){var t=Sc(e.alternate,e,Cc);e.memoizedProps=e.pendingProps,null===t?wl(e):kc=t,Oc.current=null}function wl(e){var t=e;do{var n=t.alternate;if(e=t.return,0===(32768&t.flags)){if(null!==(n=Ga(n,t,Cc)))return void(kc=n)}else{if(null!==(n=Ya(n,t)))return n.flags&=32767,void(kc=n);if(null===e)return Uc=6,void(kc=null);e.flags|=32768,e.subtreeFlags=0,e.deletions=null}if(null!==(t=t.sibling))return void(kc=t);kc=t=e}while(null!==t);0===Uc&&(Uc=5)}function El(e,t,n){var r=bt,i=Ac.transition;try{Ac.transition=null,bt=1,function(e,t,n,r){do{_l()}while(null!==Yc);if(0!==(6&Tc))throw Error(o(327));n=e.finishedWork;var i=e.finishedLanes;if(null===n)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(o(177));e.callbackNode=null,e.callbackPriority=0;var s=n.lanes|n.childLanes;if(function(e,t){var n=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 r=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-st(n),o=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~o}}(e,s),e===Rc&&(kc=Rc=null,Pc=0),0===(2064&n.subtreeFlags)&&0===(2064&n.flags)||Gc||(Gc=!0,Rl(tt,(function(){return _l(),null}))),s=0!==(15990&n.flags),0!==(15990&n.subtreeFlags)||s){s=Ac.transition,Ac.transition=null;var a=bt;bt=1;var c=Tc;Tc|=4,Oc.current=null,function(e,t){if(ei=Vt,hr(e=fr())){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{var r=(n=(n=e.ownerDocument)&&n.defaultView||window).getSelection&&n.getSelection();if(r&&0!==r.rangeCount){n=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch(E){n=null;break e}var a=0,c=-1,l=-1,u=0,d=0,f=e,h=null;t:for(;;){for(var p;f!==n||0!==i&&3!==f.nodeType||(c=a+i),f!==s||0!==r&&3!==f.nodeType||(l=a+r),3===f.nodeType&&(a+=f.nodeValue.length),null!==(p=f.firstChild);)h=f,f=p;for(;;){if(f===e)break t;if(h===n&&++u===i&&(c=a),h===s&&++d===r&&(l=a),null!==(p=f.nextSibling))break;h=(f=h).parentNode}f=p}n=-1===c||-1===l?null:{start:c,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(ti={focusedElem:e,selectionRange:n},Vt=!1,Ja=t;null!==Ja;)if(e=(t=Ja).child,0!==(1028&t.subtreeFlags)&&null!==e)e.return=t,Ja=e;else for(;null!==Ja;){t=Ja;try{var g=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!==g){var y=g.memoizedProps,m=g.memoizedState,v=t.stateNode,b=v.getSnapshotBeforeUpdate(t.elementType===t.type?y:na(t.type,y),m);v.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var w=t.stateNode.containerInfo;1===w.nodeType?w.textContent="":9===w.nodeType&&w.documentElement&&w.removeChild(w.documentElement);break;default:throw Error(o(163))}}catch(E){xl(t,t.return,E)}if(null!==(e=t.sibling)){e.return=t.return,Ja=e;break}Ja=t.return}g=tc,tc=!1}(e,n),yc(n,e),pr(ti),Vt=!!ei,ti=ei=null,e.current=n,vc(n,e,i),Xe(),Tc=c,bt=a,Ac.transition=s}else e.current=n;if(Gc&&(Gc=!1,Yc=e,Zc=i),s=e.pendingLanes,0===s&&(Wc=null),function(e){if(ot&&"function"===typeof ot.onCommitFiberRoot)try{ot.onCommitFiberRoot(it,e,void 0,128===(128&e.current.flags))}catch(t){}}(n.stateNode),rl(e,Qe()),null!==t)for(r=e.onRecoverableError,n=0;n<t.length;n++)i=t[n],r(i.value,{componentStack:i.stack,digest:i.digest});if(Vc)throw Vc=!1,e=Kc,Kc=null,e;0!==(1&Zc)&&0!==e.tag&&_l(),s=e.pendingLanes,0!==(1&s)?e===Qc?Xc++:(Xc=0,Qc=e):Xc=0,qi()}(e,t,n,r)}finally{Ac.transition=i,bt=r}return null}function _l(){if(null!==Yc){var e=wt(Zc),t=Ac.transition,n=bt;try{if(Ac.transition=null,bt=16>e?16:e,null===Yc)var r=!1;else{if(e=Yc,Yc=null,Zc=0,0!==(6&Tc))throw Error(o(331));var i=Tc;for(Tc|=4,Ja=e.current;null!==Ja;){var s=Ja,a=s.child;if(0!==(16&Ja.flags)){var c=s.deletions;if(null!==c){for(var l=0;l<c.length;l++){var u=c[l];for(Ja=u;null!==Ja;){var d=Ja;switch(d.tag){case 0:case 11:case 15:nc(8,d,s)}var f=d.child;if(null!==f)f.return=d,Ja=f;else for(;null!==Ja;){var h=(d=Ja).sibling,p=d.return;if(oc(d),d===u){Ja=null;break}if(null!==h){h.return=p,Ja=h;break}Ja=p}}}var g=s.alternate;if(null!==g){var y=g.child;if(null!==y){g.child=null;do{var m=y.sibling;y.sibling=null,y=m}while(null!==y)}}Ja=s}}if(0!==(2064&s.subtreeFlags)&&null!==a)a.return=s,Ja=a;else e:for(;null!==Ja;){if(0!==(2048&(s=Ja).flags))switch(s.tag){case 0:case 11:case 15:nc(9,s,s.return)}var v=s.sibling;if(null!==v){v.return=s.return,Ja=v;break e}Ja=s.return}}var b=e.current;for(Ja=b;null!==Ja;){var w=(a=Ja).child;if(0!==(2064&a.subtreeFlags)&&null!==w)w.return=a,Ja=w;else e:for(a=b;null!==Ja;){if(0!==(2048&(c=Ja).flags))try{switch(c.tag){case 0:case 11:case 15:rc(9,c)}}catch(_){xl(c,c.return,_)}if(c===a){Ja=null;break e}var E=c.sibling;if(null!==E){E.return=c.return,Ja=E;break e}Ja=c.return}}if(Tc=i,qi(),ot&&"function"===typeof ot.onPostCommitFiberRoot)try{ot.onPostCommitFiberRoot(it,e)}catch(_){}r=!0}return r}finally{bt=n,Ac.transition=t}}return!1}function Sl(e,t,n){e=Fo(e,t=ha(0,t=la(n,t),1),1),t=el(),null!==e&&(mt(e,1,t),rl(e,t))}function xl(e,t,n){if(3===e.tag)Sl(e,e,n);else for(;null!==t;){if(3===t.tag){Sl(t,e,n);break}if(1===t.tag){var r=t.stateNode;if("function"===typeof t.type.getDerivedStateFromError||"function"===typeof r.componentDidCatch&&(null===Wc||!Wc.has(r))){t=Fo(t,e=pa(t,e=la(n,e),1),1),e=el(),null!==t&&(mt(t,1,e),rl(t,e));break}}t=t.return}}function Il(e,t,n){var r=e.pingCache;null!==r&&r.delete(t),t=el(),e.pingedLanes|=e.suspendedLanes&n,Rc===e&&(Pc&n)===n&&(4===Uc||3===Uc&&(130023424&Pc)===Pc&&500>Qe()-zc?fl(e,0):jc|=n),rl(e,t)}function Ol(e,t){0===t&&(0===(1&e.mode)?t=1:(t=ut,0===(130023424&(ut<<=1))&&(ut=4194304)));var n=el();null!==(e=Bo(e,t))&&(mt(e,t,n),rl(e,n))}function Al(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),Ol(e,n)}function Tl(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;null!==i&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(o(314))}null!==r&&r.delete(t),Ol(e,n)}function Rl(e,t){return Ge(e,t)}function kl(e,t,n,r){this.tag=e,this.key=n,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=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Pl(e,t,n,r){return new kl(e,t,n,r)}function Cl(e){return!(!(e=e.prototype)||!e.isReactComponent)}function Nl(e,t){var n=e.alternate;return null===n?((n=Pl(e.tag,t,e.key,e.mode)).elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=14680064&e.flags,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Ul(e,t,n,r,i,s){var a=2;if(r=e,"function"===typeof e)Cl(e)&&(a=1);else if("string"===typeof e)a=5;else e:switch(e){case S:return Bl(n.children,i,s,t);case x:a=8,i|=8;break;case I:return(e=Pl(12,n,t,2|i)).elementType=I,e.lanes=s,e;case R:return(e=Pl(13,n,t,i)).elementType=R,e.lanes=s,e;case k:return(e=Pl(19,n,t,i)).elementType=k,e.lanes=s,e;case N:return Ll(n,i,s,t);default:if("object"===typeof e&&null!==e)switch(e.$$typeof){case O:a=10;break e;case A:a=9;break e;case T:a=11;break e;case P:a=14;break e;case C:a=16,r=null;break e}throw Error(o(130,null==e?e:typeof e,""))}return(t=Pl(a,n,t,i)).elementType=e,t.type=r,t.lanes=s,t}function Bl(e,t,n,r){return(e=Pl(7,e,r,t)).lanes=n,e}function Ll(e,t,n,r){return(e=Pl(22,e,r,t)).elementType=N,e.lanes=n,e.stateNode={isHidden:!1},e}function Dl(e,t,n){return(e=Pl(6,e,null,t)).lanes=n,e}function jl(e,t,n){return(t=Pl(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Ml(e,t,n,r,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=yt(0),this.expirationTimes=yt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=yt(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Fl(e,t,n,r,i,o,s,a,c){return e=new Ml(e,t,n,a,c),1===t?(t=1,!0===o&&(t|=8)):t=0,o=Pl(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Do(o),e}function zl(e){if(!e)return Ai;e:{if(qe(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(Ci(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(null!==t);throw Error(o(171))}if(1===e.tag){var n=e.type;if(Ci(n))return Bi(e,n,t)}return t}function ql(e,t,n,r,i,o,s,a,c){return(e=Fl(n,r,!0,e,0,o,0,a,c)).context=zl(null),n=e.current,(o=Mo(r=el(),i=tl(n))).callback=void 0!==t&&null!==t?t:null,Fo(n,o,i),e.current.lanes=i,mt(e,i,r),rl(e,r),e}function Hl(e,t,n,r){var i=t.current,o=el(),s=tl(i);return n=zl(n),null===t.context?t.context=n:t.pendingContext=n,(t=Mo(o,s)).payload={element:e},null!==(r=void 0===r?null:r)&&(t.callback=r),null!==(e=Fo(i,t,s))&&(nl(e,i,s,o),zo(e,i,s)),s}function Vl(e){return(e=e.current).child?(e.child.tag,e.child.stateNode):null}function Kl(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n<t?n:t}}function Wl(e,t){Kl(e,t),(e=e.alternate)&&Kl(e,t)}Sc=function(e,t,n){if(null!==e)if(e.memoizedProps!==t.pendingProps||Ri.current)ba=!0;else{if(0===(e.lanes&n)&&0===(128&t.flags))return ba=!1,function(e,t,n){switch(t.tag){case 3:Ra(t),po();break;case 5:Jo(t);break;case 1:Ci(t.type)&&Li(t);break;case 4:Xo(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;Oi(So,r._currentValue),r._currentValue=i;break;case 13:if(null!==(r=t.memoizedState))return null!==r.dehydrated?(Oi(es,1&es.current),t.flags|=128,null):0!==(n&t.child.childLanes)?Da(e,t,n):(Oi(es,1&es.current),null!==(e=Va(e,t,n))?e.sibling:null);Oi(es,1&es.current);break;case 19:if(r=0!==(n&t.childLanes),0!==(128&e.flags)){if(r)return qa(e,t,n);t.flags|=128}if(null!==(i=t.memoizedState)&&(i.rendering=null,i.tail=null,i.lastEffect=null),Oi(es,es.current),r)break;return null;case 22:case 23:return t.lanes=0,xa(e,t,n)}return Va(e,t,n)}(e,t,n);ba=0!==(131072&e.flags)}else ba=!1,io&&0!==(1048576&t.flags)&&$i(t,Wi,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Ha(e,t),e=t.pendingProps;var i=Pi(t,Ti.current);ko(t,n),i=ys(null,t,r,e,i,n);var s=ms();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,Ci(r)?(s=!0,Li(t)):s=!1,t.memoizedState=null!==i.state&&void 0!==i.state?i.state:null,Do(t),i.updater=ia,t.stateNode=i,i._reactInternals=t,ca(t,r,e,n),t=Ta(null,t,r,!0,s,n)):(t.tag=0,io&&s&&eo(t),wa(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Ha(e,t),e=t.pendingProps,r=(i=r._init)(r._payload),t.type=r,i=t.tag=function(e){if("function"===typeof e)return Cl(e)?1:0;if(void 0!==e&&null!==e){if((e=e.$$typeof)===T)return 11;if(e===P)return 14}return 2}(r),e=na(r,e),i){case 0:t=Oa(null,t,r,e,n);break e;case 1:t=Aa(null,t,r,e,n);break e;case 11:t=Ea(null,t,r,e,n);break e;case 14:t=_a(null,t,r,na(r.type,e),n);break e}throw Error(o(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,Oa(e,t,r,i=t.elementType===r?i:na(r,i),n);case 1:return r=t.type,i=t.pendingProps,Aa(e,t,r,i=t.elementType===r?i:na(r,i),n);case 3:e:{if(Ra(t),null===e)throw Error(o(387));r=t.pendingProps,i=(s=t.memoizedState).element,jo(e,t),Ho(t,r,null,n);var a=t.memoizedState;if(r=a.element,s.isDehydrated){if(s={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=s,t.memoizedState=s,256&t.flags){t=ka(e,t,r,n,i=la(Error(o(423)),t));break e}if(r!==i){t=ka(e,t,r,n,i=la(Error(o(424)),t));break e}for(ro=li(t.stateNode.containerInfo.firstChild),no=t,io=!0,oo=null,n=_o(t,null,r,n),t.child=n;n;)n.flags=-3&n.flags|4096,n=n.sibling}else{if(po(),r===i){t=Va(e,t,n);break e}wa(e,t,r,n)}t=t.child}return t;case 5:return Jo(t),null===e&&lo(t),r=t.type,i=t.pendingProps,s=null!==e?e.memoizedProps:null,a=i.children,ni(r,i)?a=null:null!==s&&ni(r,s)&&(t.flags|=32),Ia(e,t),wa(e,t,a,n),t.child;case 6:return null===e&&lo(t),null;case 13:return Da(e,t,n);case 4:return Xo(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=Eo(t,null,r,n):wa(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,Ea(e,t,r,i=t.elementType===r?i:na(r,i),n);case 7:return wa(e,t,t.pendingProps,n),t.child;case 8:case 12:return wa(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,s=t.memoizedProps,a=i.value,Oi(So,r._currentValue),r._currentValue=a,null!==s)if(ar(s.value,a)){if(s.children===i.children&&!Ri.current){t=Va(e,t,n);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 l=c.firstContext;null!==l;){if(l.context===r){if(1===s.tag){(l=Mo(-1,n&-n)).tag=2;var u=s.updateQueue;if(null!==u){var d=(u=u.shared).pending;null===d?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}s.lanes|=n,null!==(l=s.alternate)&&(l.lanes|=n),Ro(s.return,n,t),c.lanes|=n;break}l=l.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|=n,null!==(c=a.alternate)&&(c.lanes|=n),Ro(a,n,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}wa(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,ko(t,n),r=r(i=Po(i)),t.flags|=1,wa(e,t,r,n),t.child;case 14:return i=na(r=t.type,t.pendingProps),_a(e,t,r,i=na(r.type,i),n);case 15:return Sa(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:na(r,i),Ha(e,t),t.tag=1,Ci(r)?(e=!0,Li(t)):e=!1,ko(t,n),sa(t,r,i),ca(t,r,i,n),Ta(null,t,r,!0,e,n);case 19:return qa(e,t,n);case 22:return xa(e,t,n)}throw Error(o(156,t.tag))};var Gl="function"===typeof reportError?reportError:function(e){console.error(e)};function Yl(e){this._internalRoot=e}function Zl(e){this._internalRoot=e}function Xl(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType)}function Ql(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType&&(8!==e.nodeType||" react-mount-point-unstable "!==e.nodeValue))}function Jl(){}function $l(e,t,n,r,i){var o=n._reactRootContainer;if(o){var s=o;if("function"===typeof i){var a=i;i=function(){var e=Vl(s);a.call(e)}}Hl(t,s,e,i)}else s=function(e,t,n,r,i){if(i){if("function"===typeof r){var o=r;r=function(){var e=Vl(s);o.call(e)}}var s=ql(t,r,e,0,null,!1,0,"",Jl);return e._reactRootContainer=s,e[pi]=s.current,qr(8===e.nodeType?e.parentNode:e),ul(),s}for(;i=e.lastChild;)e.removeChild(i);if("function"===typeof r){var a=r;r=function(){var e=Vl(c);a.call(e)}}var c=Fl(e,0,!1,null,0,!1,0,"",Jl);return e._reactRootContainer=c,e[pi]=c.current,qr(8===e.nodeType?e.parentNode:e),ul((function(){Hl(t,c,n,r)})),c}(n,t,e,i,r);return Vl(s)}Zl.prototype.render=Yl.prototype.render=function(e){var t=this._internalRoot;if(null===t)throw Error(o(409));Hl(e,t,null,null)},Zl.prototype.unmount=Yl.prototype.unmount=function(){var e=this._internalRoot;if(null!==e){this._internalRoot=null;var t=e.containerInfo;ul((function(){Hl(null,e,null,null)})),t[pi]=null}},Zl.prototype.unstable_scheduleHydration=function(e){if(e){var t=xt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Nt.length&&0!==t&&t<Nt[n].priority;n++);Nt.splice(n,0,e),0===n&&Dt(e)}},Et=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=dt(t.pendingLanes);0!==n&&(vt(t,1|n),rl(t,Qe()),0===(6&Tc)&&(qc=Qe()+500,qi()))}break;case 13:ul((function(){var t=Bo(e,1);if(null!==t){var n=el();nl(t,e,1,n)}})),Wl(e,1)}},_t=function(e){if(13===e.tag){var t=Bo(e,134217728);if(null!==t)nl(t,e,134217728,el());Wl(e,134217728)}},St=function(e){if(13===e.tag){var t=tl(e),n=Bo(e,t);if(null!==n)nl(n,e,t,el());Wl(e,t)}},xt=function(){return bt},It=function(e,t){var n=bt;try{return bt=e,t()}finally{bt=n}},_e=function(e,t,n){switch(t){case"input":if(J(e,n),t=n.name,"radio"===n.type&&null!=t){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=Ei(r);if(!i)throw Error(o(90));G(r),J(r,i)}}}break;case"textarea":oe(e,n);break;case"select":null!=(t=n.value)&&ne(e,!!n.multiple,t,!1)}},Te=ll,Re=ul;var eu={usingClientEntryPoint:!1,Events:[bi,wi,Ei,Oe,Ae,ll]},tu={findFiberByHostInstance:vi,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},nu={bundleType:tu.bundleType,version:tu.version,rendererPackageName:tu.rendererPackageName,rendererConfig:tu.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=Ke(e))?null:e.stateNode},findFiberByHostInstance:tu.findFiberByHostInstance||function(){return null},findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if("undefined"!==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var ru=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ru.isDisabled&&ru.supportsFiber)try{it=ru.inject(nu),ot=ru}catch(ue){}}t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=eu,t.createPortal=function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!Xl(t))throw Error(o(200));return function(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:_,key:null==r?null:""+r,children:e,containerInfo:t,implementation:n}}(e,t,null,n)},t.createRoot=function(e,t){if(!Xl(e))throw Error(o(299));var n=!1,r="",i=Gl;return null!==t&&void 0!==t&&(!0===t.unstable_strictMode&&(n=!0),void 0!==t.identifierPrefix&&(r=t.identifierPrefix),void 0!==t.onRecoverableError&&(i=t.onRecoverableError)),t=Fl(e,1,!1,null,0,n,0,r,i),e[pi]=t.current,qr(8===e.nodeType?e.parentNode:e),new Yl(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=Ke(t))?null:e.stateNode},t.flushSync=function(e){return ul(e)},t.hydrate=function(e,t,n){if(!Ql(t))throw Error(o(200));return $l(null,e,t,!0,n)},t.hydrateRoot=function(e,t,n){if(!Xl(e))throw Error(o(405));var r=null!=n&&n.hydratedSources||null,i=!1,s="",a=Gl;if(null!==n&&void 0!==n&&(!0===n.unstable_strictMode&&(i=!0),void 0!==n.identifierPrefix&&(s=n.identifierPrefix),void 0!==n.onRecoverableError&&(a=n.onRecoverableError)),t=ql(t,null,e,1,null!=n?n:null,i,0,s,a),e[pi]=t.current,qr(e),r)for(e=0;e<r.length;e++)i=(i=(n=r[e])._getVersion)(n._source),null==t.mutableSourceEagerHydrationData?t.mutableSourceEagerHydrationData=[n,i]:t.mutableSourceEagerHydrationData.push(n,i);return new Zl(t)},t.render=function(e,t,n){if(!Ql(t))throw Error(o(200));return $l(null,e,t,!1,n)},t.unmountComponentAtNode=function(e){if(!Ql(e))throw Error(o(40));return!!e._reactRootContainer&&(ul((function(){$l(null,null,e,!1,(function(){e._reactRootContainer=null,e[pi]=null}))})),!0)},t.unstable_batchedUpdates=ll,t.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Ql(n))throw Error(o(200));if(null==e||void 0===e._reactInternals)throw Error(o(38));return $l(e,t,n,!1,r)},t.version="18.3.1-next-f1338f8080-20240426"},5808:(e,t,n)=>{"use strict";var r=n(2551);t.H=r.createRoot,r.hydrateRoot},2551:(e,t,n)=>{"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=n(3969)},5175:e=>{var t="undefined"!==typeof Element,n="function"===typeof Map,r="function"===typeof Set,i="function"===typeof ArrayBuffer&&!!ArrayBuffer.isView;function o(e,s){if(e===s)return!0;if(e&&s&&"object"==typeof e&&"object"==typeof s){if(e.constructor!==s.constructor)return!1;var a,c,l,u;if(Array.isArray(e)){if((a=e.length)!=s.length)return!1;for(c=a;0!==c--;)if(!o(e[c],s[c]))return!1;return!0}if(n&&e instanceof Map&&s instanceof Map){if(e.size!==s.size)return!1;for(u=e.entries();!(c=u.next()).done;)if(!s.has(c.value[0]))return!1;for(u=e.entries();!(c=u.next()).done;)if(!o(c.value[1],s.get(c.value[0])))return!1;return!0}if(r&&e instanceof Set&&s instanceof Set){if(e.size!==s.size)return!1;for(u=e.entries();!(c=u.next()).done;)if(!s.has(c.value[0]))return!1;return!0}if(i&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(s)){if((a=e.length)!=s.length)return!1;for(c=a;0!==c--;)if(e[c]!==s[c])return!1;return!0}if(e.constructor===RegExp)return e.source===s.source&&e.flags===s.flags;if(e.valueOf!==Object.prototype.valueOf&&"function"===typeof e.valueOf&&"function"===typeof s.valueOf)return e.valueOf()===s.valueOf();if(e.toString!==Object.prototype.toString&&"function"===typeof e.toString&&"function"===typeof s.toString)return e.toString()===s.toString();if((a=(l=Object.keys(e)).length)!==Object.keys(s).length)return!1;for(c=a;0!==c--;)if(!Object.prototype.hasOwnProperty.call(s,l[c]))return!1;if(t&&e instanceof Element)return!1;for(c=a;0!==c--;)if(("_owner"!==l[c]&&"__v"!==l[c]&&"__o"!==l[c]||!e.$$typeof)&&!o(e[l[c]],s[l[c]]))return!1;return!0}return e!==e&&s!==s}e.exports=function(e,t){try{return o(e,t)}catch(n){if((n.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw n}}},5878:(e,t,n)=>{"use strict";var r=n(1462),i=Symbol.for("react.element"),o=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,a=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function l(e,t,n){var r,o={},l=null,u=null;for(r in void 0!==n&&(l=""+n),void 0!==t.key&&(l=""+t.key),void 0!==t.ref&&(u=t.ref),t)s.call(t,r)&&!c.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===o[r]&&(o[r]=t[r]);return{$$typeof:i,type:e,key:l,ref:u,props:o,_owner:a.current}}t.Fragment=o,t.jsx=l,t.jsxs=l},2825:(e,t)=>{"use strict";var n=Symbol.for("react.element"),r=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"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),h=Symbol.iterator;var p={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,y={};function m(e,t,n){this.props=e,this.context=t,this.refs=y,this.updater=n||p}function v(){}function b(e,t,n){this.props=e,this.context=t,this.refs=y,this.updater=n||p}m.prototype.isReactComponent={},m.prototype.setState=function(e,t){if("object"!==typeof e&&"function"!==typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},m.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},v.prototype=m.prototype;var w=b.prototype=new v;w.constructor=b,g(w,m.prototype),w.isPureReactComponent=!0;var E=Array.isArray,_=Object.prototype.hasOwnProperty,S={current:null},x={key:!0,ref:!0,__self:!0,__source:!0};function I(e,t,r){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)&&!x.hasOwnProperty(i)&&(o[i]=t[i]);var c=arguments.length-2;if(1===c)o.children=r;else if(1<c){for(var l=Array(c),u=0;u<c;u++)l[u]=arguments[u+2];o.children=l}if(e&&e.defaultProps)for(i in c=e.defaultProps)void 0===o[i]&&(o[i]=c[i]);return{$$typeof:n,type:e,key:s,ref:a,props:o,_owner:S.current}}function O(e){return"object"===typeof e&&null!==e&&e.$$typeof===n}var A=/\/+/g;function T(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 R(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 n:case r:c=!0}}if(c)return s=s(c=e),e=""===o?"."+T(c,0):o,E(s)?(i="",null!=e&&(i=e.replace(A,"$&/")+"/"),R(s,t,i,"",(function(e){return e}))):null!=s&&(O(s)&&(s=function(e,t){return{$$typeof:n,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(A,"$&/")+"/")+e)),t.push(s)),1;if(c=0,o=""===o?".":o+":",E(e))for(var l=0;l<e.length;l++){var u=o+T(a=e[l],l);c+=R(a,t,i,u,s)}else if(u=function(e){return null===e||"object"!==typeof e?null:"function"===typeof(e=h&&e[h]||e["@@iterator"])?e:null}(e),"function"===typeof u)for(e=u.call(e),l=0;!(a=e.next()).done;)c+=R(a=a.value,t,i,u=o+T(a,l++),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,n){if(null==e)return e;var r=[],i=0;return R(e,r,"","",(function(e){return t.call(n,e,i++)})),r}function P(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 C={current:null},N={transition:null},U={ReactCurrentDispatcher:C,ReactCurrentBatchConfig:N,ReactCurrentOwner:S};function B(){throw Error("act(...) is not supported in production builds of React.")}t.Children={map:k,forEach:function(e,t,n){k(e,(function(){t.apply(this,arguments)}),n)},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(!O(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=b,t.StrictMode=o,t.Suspense=u,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=U,t.act=B,t.cloneElement=function(e,t,r){if(null===e||void 0===e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var i=g({},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(l in t)_.call(t,l)&&!x.hasOwnProperty(l)&&(i[l]=void 0===t[l]&&void 0!==c?c[l]:t[l])}var l=arguments.length-2;if(1===l)i.children=r;else if(1<l){c=Array(l);for(var u=0;u<l;u++)c[u]=arguments[u+2];i.children=c}return{$$typeof:n,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=I,t.createFactory=function(e){var t=I.bind(null,e);return t.type=e,t},t.createRef=function(){return{current:null}},t.forwardRef=function(e){return{$$typeof:l,render:e}},t.isValidElement=O,t.lazy=function(e){return{$$typeof:f,_payload:{_status:-1,_result:e},_init:P}},t.memo=function(e,t){return{$$typeof:d,type:e,compare:void 0===t?null:t}},t.startTransition=function(e){var t=N.transition;N.transition={};try{e()}finally{N.transition=t}},t.unstable_act=B,t.useCallback=function(e,t){return C.current.useCallback(e,t)},t.useContext=function(e){return C.current.useContext(e)},t.useDebugValue=function(){},t.useDeferredValue=function(e){return C.current.useDeferredValue(e)},t.useEffect=function(e,t){return C.current.useEffect(e,t)},t.useId=function(){return C.current.useId()},t.useImperativeHandle=function(e,t,n){return C.current.useImperativeHandle(e,t,n)},t.useInsertionEffect=function(e,t){return C.current.useInsertionEffect(e,t)},t.useLayoutEffect=function(e,t){return C.current.useLayoutEffect(e,t)},t.useMemo=function(e,t){return C.current.useMemo(e,t)},t.useReducer=function(e,t,n){return C.current.useReducer(e,t,n)},t.useRef=function(e){return C.current.useRef(e)},t.useState=function(e){return C.current.useState(e)},t.useSyncExternalStore=function(e,t,n){return C.current.useSyncExternalStore(e,t,n)},t.useTransition=function(){return C.current.useTransition()},t.version="18.3.1"},1462:(e,t,n)=>{"use strict";e.exports=n(2825)},9334:(e,t,n)=>{"use strict";e.exports=n(5878)},3017:(e,t)=>{"use strict";function n(e,t){var n=e.length;e.push(t);e:for(;0<n;){var r=n-1>>>1,i=e[r];if(!(0<o(i,t)))break e;e[r]=t,e[n]=i,n=r}}function r(e){return 0===e.length?null:e[0]}function i(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,i=e.length,s=i>>>1;r<s;){var a=2*(r+1)-1,c=e[a],l=a+1,u=e[l];if(0>o(c,n))l<i&&0>o(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[a]=n,r=a);else{if(!(l<i&&0>o(u,n)))break e;e[r]=u,e[l]=n,r=l}}}return t}function o(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n: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 l=[],u=[],d=1,f=null,h=3,p=!1,g=!1,y=!1,m="function"===typeof setTimeout?setTimeout:null,v="function"===typeof clearTimeout?clearTimeout:null,b="undefined"!==typeof setImmediate?setImmediate:null;function w(e){for(var t=r(u);null!==t;){if(null===t.callback)i(u);else{if(!(t.startTime<=e))break;i(u),t.sortIndex=t.expirationTime,n(l,t)}t=r(u)}}function E(e){if(y=!1,w(e),!g)if(null!==r(l))g=!0,N(_);else{var t=r(u);null!==t&&U(E,t.startTime-e)}}function _(e,n){g=!1,y&&(y=!1,v(O),O=-1),p=!0;var o=h;try{for(w(n),f=r(l);null!==f&&(!(f.expirationTime>n)||e&&!R());){var s=f.callback;if("function"===typeof s){f.callback=null,h=f.priorityLevel;var a=s(f.expirationTime<=n);n=t.unstable_now(),"function"===typeof a?f.callback=a:f===r(l)&&i(l),w(n)}else i(l);f=r(l)}if(null!==f)var c=!0;else{var d=r(u);null!==d&&U(E,d.startTime-n),c=!1}return c}finally{f=null,h=o,p=!1}}"undefined"!==typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var S,x=!1,I=null,O=-1,A=5,T=-1;function R(){return!(t.unstable_now()-T<A)}function k(){if(null!==I){var e=t.unstable_now();T=e;var n=!0;try{n=I(!0,e)}finally{n?S():(x=!1,I=null)}}else x=!1}if("function"===typeof b)S=function(){b(k)};else if("undefined"!==typeof MessageChannel){var P=new MessageChannel,C=P.port2;P.port1.onmessage=k,S=function(){C.postMessage(null)}}else S=function(){m(k,0)};function N(e){I=e,x||(x=!0,S())}function U(e,n){O=m((function(){e(t.unstable_now())}),n)}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(){g||p||(g=!0,N(_))},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"):A=0<e?Math.floor(1e3/e):5},t.unstable_getCurrentPriorityLevel=function(){return h},t.unstable_getFirstCallbackNode=function(){return r(l)},t.unstable_next=function(e){switch(h){case 1:case 2:case 3:var t=3;break;default:t=h}var n=h;h=t;try{return e()}finally{h=n}},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 n=h;h=e;try{return t()}finally{h=n}},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,n(u,e),null===r(l)&&e===r(u)&&(y?(v(O),O=-1):y=!0,U(E,o-s))):(e.sortIndex=a,n(l,e),g||p||(g=!0,N(_))),e},t.unstable_shouldYield=R,t.unstable_wrapCallback=function(e){var t=h;return function(){var n=h;h=t;try{return e.apply(this,arguments)}finally{h=n}}}},6756:(e,t,n)=>{"use strict";e.exports=n(3017)},884:(e,t,n)=>{"use strict";t.KN=void 0;var r,i=n(5701),o=(r=n(4143))&&r.__esModule?r:{default:r};var s=function(e){var t=e.allowedSizes,n=e.defaultSize,r=e.padding;return function e(){var s=this,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n;if(!this||this.constructor!==e)return new e(a);if(t&&!t.includes(a))throw new Error("Unsupported hash length");var c=new o.default({capacity:a});return this.update=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf8";if(i.Buffer.isBuffer(e))return c.absorb(e),s;if("string"===typeof e)return s.update(i.Buffer.from(e,t));throw new TypeError("Not a string or buffer")},this.digest=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"binary",t="string"===typeof e?{format:e}:e,n=c.squeeze({buffer:t.buffer,padding:t.padding||r});return t.format&&"binary"!==t.format?n.toString(t.format):n},this.reset=function(){return c.reset(),s},this}},a=s({allowedSizes:[224,256,384,512],defaultSize:512,padding:1});var c=s({allowedSizes:[224,256,384,512],defaultSize:512,padding:6});t.KN=c,s({allowedSizes:[128,256],defaultSize:256,padding:31});var l=a;c.SHA3Hash=l},4143:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,i=n(5701),o=(r=n(3614))&&r.__esModule?r:{default:r};var s=function(e,t){for(var n=0;n<e.length;n+=8){var r=n/4;t[r]^=e[n+7]<<24|e[n+6]<<16|e[n+5]<<8|e[n+4],t[r+1]^=e[n+3]<<24|e[n+2]<<16|e[n+1]<<8|e[n]}return t},a=function(e,t){for(var n=0;n<t.length;n+=8){var r=n/4;t[n]=e[r+1],t[n+1]=e[r+1]>>>8,t[n+2]=e[r+1]>>>16,t[n+3]=e[r+1]>>>24,t[n+4]=e[r],t[n+5]=e[r]>>>8,t[n+6]=e[r]>>>16,t[n+7]=e[r]>>>24}return t},c=function(e){var t=this,n=e.capacity,r=e.padding,c=(0,o.default)(),l=n/8,u=200-n/4,d=0,f=new Uint32Array(50),h=i.Buffer.allocUnsafe(u);return this.absorb=function(e){for(var n=0;n<e.length;n++)h[d]=e[n],(d+=1)>=u&&(s(h,f),c(f),d=0);return t},this.squeeze=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={buffer:e.buffer||i.Buffer.allocUnsafe(l),padding:e.padding||r,queue:i.Buffer.allocUnsafe(h.length),state:new Uint32Array(f.length)};h.copy(t.queue);for(var n=0;n<f.length;n++)t.state[n]=f[n];t.queue.fill(0,d),t.queue[d]|=t.padding,t.queue[u-1]|=128,s(t.queue,t.state);for(var o=0;o<t.buffer.length;o+=u)c(t.state),a(t.state,t.buffer.slice(o,o+u));return t.buffer},this.reset=function(){return h.fill(0),f.fill(0),d=0,t},this};t.default=c},4443:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,i=(r=n(2162))&&r.__esModule?r:{default:r};var o=function(e){for(var t=e.A,n=e.C,r=0;r<25;r+=5){for(var o=0;o<5;o++)(0,i.default)(t,r+o)(n,o);for(var s=0;s<5;s++){var a=2*(r+s),c=(s+1)%5*2,l=(s+2)%5*2;t[a]^=~n[c]&n[l],t[a+1]^=~n[c+1]&n[l+1]}}};t.default=o},2162:e=>{"use strict";e.exports=function(e,t){return function(n,r){var i=2*r,o=2*t;n[i]=e[o],n[i+1]=e[o+1]}}},3614:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=a(n(4443)),i=a(n(2184)),o=a(n(8090)),s=a(n(9841));function a(e){return e&&e.__esModule?e:{default:e}}var c=function(){var e=new Uint32Array(10),t=new Uint32Array(10),n=new Uint32Array(2);return function(a){for(var c=0;c<24;c++)(0,s.default)({A:a,C:e,D:t,W:n}),(0,o.default)({A:a,C:e,W:n}),(0,r.default)({A:a,C:e}),(0,i.default)({A:a,roundIndex:c});e.fill(0),t.fill(0),n.fill(0)}};t.default=c},2184:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,i=(r=n(3775))&&r.__esModule?r:{default:r};var o=function(e){var t=e.A,n=2*e.roundIndex;t[0]^=i.default[n],t[1]^=i.default[n+1]};t.default=o},3775:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=new Uint32Array([0,1,0,32898,2147483648,32906,2147483648,2147516416,0,32907,0,2147483649,2147483648,2147516545,2147483648,32777,0,138,0,136,0,2147516425,0,2147483658,0,2147516555,2147483648,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,0,32778,2147483648,2147483658,2147483648,2147516545,2147483648,32896,0,2147483649,2147483648,2147516424]);t.default=n},8090:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=s(n(7369)),i=s(n(991)),o=s(n(2162));function s(e){return e&&e.__esModule?e:{default:e}}var a=function(e){var t=e.A,n=e.C,s=e.W;(0,o.default)(t,1)(s,0);for(var a=0,c=0,l=0,u=32,d=0;d<24;d++){var f=r.default[d],h=i.default[d];(0,o.default)(t,f)(n,0),a=s[0],c=s[1],u=32-h,s[l=h<32?0:1]=a<<h|c>>>u,s[(l+1)%2]=c<<h|a>>>u,(0,o.default)(s,0)(t,f),(0,o.default)(n,0)(s,0)}};t.default=a},7369:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=[10,7,11,17,18,3,5,16,8,21,24,4,15,23,19,13,12,2,20,14,22,9,6,1];t.default=n},991:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=[1,3,6,10,15,21,28,36,45,55,2,14,27,41,56,8,25,43,62,18,39,61,20,44];t.default=n},9841:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r,i=(r=n(2162))&&r.__esModule?r:{default:r};var o=function(e){for(var t=e.A,n=e.C,r=e.D,o=e.W,s=0,a=0,c=0;c<5;c++){var l=2*c,u=2*(c+5),d=2*(c+10),f=2*(c+15),h=2*(c+20);n[l]=t[l]^t[u]^t[d]^t[f]^t[h],n[l+1]=t[l+1]^t[u+1]^t[d+1]^t[f+1]^t[h+1]}for(var p=0;p<5;p++){(0,i.default)(n,(p+1)%5)(o,0),s=o[0],a=o[1],o[0]=s<<1|a>>>31,o[1]=a<<1|s>>>31,r[2*p]=n[(p+4)%5*2]^o[0],r[2*p+1]=n[(p+4)%5*2+1]^o[1];for(var g=0;g<25;g+=5)t[2*(g+p)]^=r[2*p],t[2*(g+p)+1]^=r[2*p+1]}};t.default=o},8043:e=>{e.exports=function(e,t,n,r){var i=n?n.call(r,e,t):void 0;if(void 0!==i)return!!i;if(e===t)return!0;if("object"!==typeof e||!e||"object"!==typeof t||!t)return!1;var o=Object.keys(e),s=Object.keys(t);if(o.length!==s.length)return!1;for(var a=Object.prototype.hasOwnProperty.bind(t),c=0;c<o.length;c++){var l=o[c];if(!a(l))return!1;var u=e[l],d=t[l];if(!1===(i=n?n.call(r,u,d,l):void 0)||void 0===i&&u!==d)return!1}return!0}},2590:(e,t,n)=>{var r="undefined"!==typeof globalThis&&globalThis||"undefined"!==typeof self&&self||"undefined"!==typeof n.g&&n.g,i=function(){function e(){this.fetch=!1,this.DOMException=r.DOMException}return e.prototype=r,new e}();!function(e){!function(t){var r="undefined"!==typeof e&&e||"undefined"!==typeof self&&self||"undefined"!==typeof n.g&&n.g||{},i="URLSearchParams"in r,o="Symbol"in r&&"iterator"in Symbol,s="FileReader"in r&&"Blob"in r&&function(){try{return new Blob,!0}catch(e){return!1}}(),a="FormData"in r,c="ArrayBuffer"in r;if(c)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(e){return e&&l.indexOf(Object.prototype.toString.call(e))>-1};function d(e){if("string"!==typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw new TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function f(e){return"string"!==typeof e&&(e=String(e)),e}function h(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return o&&(t[Symbol.iterator]=function(){return t}),t}function p(e){this.map={},e instanceof p?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){if(2!=e.length)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+e.length);this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function g(e){if(!e._noBody)return e.bodyUsed?Promise.reject(new TypeError("Already read")):void(e.bodyUsed=!0)}function y(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function m(e){var t=new FileReader,n=y(t);return t.readAsArrayBuffer(e),n}function v(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(e){var t;this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?"string"===typeof e?this._bodyText=e:s&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:a&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:i&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():c&&s&&((t=e)&&DataView.prototype.isPrototypeOf(t))?(this._bodyArrayBuffer=v(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):c&&(ArrayBuffer.prototype.isPrototypeOf(e)||u(e))?this._bodyArrayBuffer=v(e):this._bodyText=e=Object.prototype.toString.call(e):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||("string"===typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):i&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},s&&(this.blob=function(){var e=g(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var e=g(this);return e||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}if(s)return this.blob().then(m);throw new Error("could not read as ArrayBuffer")},this.text=function(){var e=g(this);if(e)return e;if(this._bodyBlob)return function(e){var t=new FileReader,n=y(t),r=/charset=([A-Za-z0-9_-]+)/.exec(e.type),i=r?r[1]:"utf-8";return t.readAsText(e,i),n}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r<t.length;r++)n[r]=String.fromCharCode(t[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},a&&(this.formData=function(){return this.text().then(_)}),this.json=function(){return this.text().then(JSON.parse)},this}p.prototype.append=function(e,t){e=d(e),t=f(t);var n=this.map[e];this.map[e]=n?n+", "+t:t},p.prototype.delete=function(e){delete this.map[d(e)]},p.prototype.get=function(e){return e=d(e),this.has(e)?this.map[e]:null},p.prototype.has=function(e){return this.map.hasOwnProperty(d(e))},p.prototype.set=function(e,t){this.map[d(e)]=f(t)},p.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},p.prototype.keys=function(){var e=[];return this.forEach((function(t,n){e.push(n)})),h(e)},p.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),h(e)},p.prototype.entries=function(){var e=[];return this.forEach((function(t,n){e.push([n,t])})),h(e)},o&&(p.prototype[Symbol.iterator]=p.prototype.entries);var w=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function E(e,t){if(!(this instanceof E))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var n=(t=t||{}).body;if(e instanceof E){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new p(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,n||null==e._bodyInit||(n=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new p(t.headers)),this.method=function(e){var t=e.toUpperCase();return w.indexOf(t)>-1?t:e}(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal||function(){if("AbortController"in r)return(new AbortController).signal}(),this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(n),("GET"===this.method||"HEAD"===this.method)&&("no-store"===t.cache||"no-cache"===t.cache)){var i=/([?&])_=[^&]*/;if(i.test(this.url))this.url=this.url.replace(i,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function _(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(i))}})),t}function S(e){var t=new p;return e.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(e){return 0===e.indexOf("\n")?e.substr(1,e.length):e})).forEach((function(e){var n=e.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();try{t.append(r,i)}catch(o){console.warn("Response "+o.message)}}})),t}function x(e,t){if(!(this instanceof x))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=void 0===t.statusText?"":""+t.statusText,this.headers=new p(t.headers),this.url=t.url||"",this._initBody(e)}E.prototype.clone=function(){return new E(this,{body:this._bodyInit})},b.call(E.prototype),b.call(x.prototype),x.prototype.clone=function(){return new x(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},x.error=function(){var e=new x(null,{status:200,statusText:""});return e.ok=!1,e.status=0,e.type="error",e};var I=[301,302,303,307,308];x.redirect=function(e,t){if(-1===I.indexOf(t))throw new RangeError("Invalid status code");return new x(null,{status:t,headers:{location:e}})},t.DOMException=r.DOMException;try{new t.DOMException}catch(A){t.DOMException=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function O(e,n){return new Promise((function(i,o){var a=new E(e,n);if(a.signal&&a.signal.aborted)return o(new t.DOMException("Aborted","AbortError"));var l=new XMLHttpRequest;function u(){l.abort()}if(l.onload=function(){var e={statusText:l.statusText,headers:S(l.getAllResponseHeaders()||"")};0===a.url.indexOf("file://")&&(l.status<200||l.status>599)?e.status=200:e.status=l.status,e.url="responseURL"in l?l.responseURL:e.headers.get("X-Request-URL");var t="response"in l?l.response:l.responseText;setTimeout((function(){i(new x(t,e))}),0)},l.onerror=function(){setTimeout((function(){o(new TypeError("Network request failed"))}),0)},l.ontimeout=function(){setTimeout((function(){o(new TypeError("Network request timed out"))}),0)},l.onabort=function(){setTimeout((function(){o(new t.DOMException("Aborted","AbortError"))}),0)},l.open(a.method,function(e){try{return""===e&&r.location.href?r.location.href:e}catch(t){return e}}(a.url),!0),"include"===a.credentials?l.withCredentials=!0:"omit"===a.credentials&&(l.withCredentials=!1),"responseType"in l&&(s?l.responseType="blob":c&&(l.responseType="arraybuffer")),n&&"object"===typeof n.headers&&!(n.headers instanceof p||r.Headers&&n.headers instanceof r.Headers)){var h=[];Object.getOwnPropertyNames(n.headers).forEach((function(e){h.push(d(e)),l.setRequestHeader(e,f(n.headers[e]))})),a.headers.forEach((function(e,t){-1===h.indexOf(t)&&l.setRequestHeader(t,e)}))}else a.headers.forEach((function(e,t){l.setRequestHeader(t,e)}));a.signal&&(a.signal.addEventListener("abort",u),l.onreadystatechange=function(){4===l.readyState&&a.signal.removeEventListener("abort",u)}),l.send("undefined"===typeof a._bodyInit?null:a._bodyInit)}))}O.polyfill=!0,r.fetch||(r.fetch=O,r.Headers=p,r.Request=E,r.Response=x),t.Headers=p,t.Request=E,t.Response=x,t.fetch=O}({})}(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var o=r.fetch?r:i;(t=o.fetch).default=o.fetch,t.fetch=o.fetch,t.Headers=o.Headers,t.Request=o.Request,t.Response=o.Response,e.exports=t}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r].call(o.exports,o,o.exports,n),o.exports}n.m=e,n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},(()=>{var e,t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__;n.t=function(r,i){if(1&i&&(r=this(r)),8&i)return r;if("object"===typeof r&&r){if(4&i&&r.__esModule)return r;if(16&i&&"function"===typeof r.then)return r}var o=Object.create(null);n.r(o);var s={};e=e||[null,t({}),t([]),t(t)];for(var a=2&i&&r;"object"==typeof a&&!~e.indexOf(a);a=t(a))Object.getOwnPropertyNames(a).forEach((e=>s[e]=()=>r[e]));return s.default=()=>r,n.d(o,s),o}})(),n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce(((t,r)=>(n.f[r](e,t),t)),[])),n.u=e=>"static/js/"+e+"."+{634:"0ed98abb",777:"642c676e"}[e]+".chunk.js",n.miniCssF=e=>{},n.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"===typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={},t="web:";n.l=(r,i,o,s)=>{if(e[r])e[r].push(i);else{var a,c;if(void 0!==o)for(var l=document.getElementsByTagName("script"),u=0;u<l.length;u++){var d=l[u];if(d.getAttribute("src")==r||d.getAttribute("data-webpack")==t+o){a=d;break}}a||(c=!0,(a=document.createElement("script")).charset="utf-8",a.timeout=120,n.nc&&a.setAttribute("nonce",n.nc),a.setAttribute("data-webpack",t+o),a.src=r),e[r]=[i];var f=(t,n)=>{a.onerror=a.onload=null,clearTimeout(h);var i=e[r];if(delete e[r],a.parentNode&&a.parentNode.removeChild(a),i&&i.forEach((e=>e(n))),t)return t(n)},h=setTimeout(f.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=f.bind(null,a.onerror),a.onload=f.bind(null,a.onload),c&&document.head.appendChild(a)}}})(),n.r=e=>{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.p="/",(()=>{var e={792:0};n.f.j=(t,r)=>{var i=n.o(e,t)?e[t]:void 0;if(0!==i)if(i)r.push(i[2]);else{var o=new Promise(((n,r)=>i=e[t]=[n,r]));r.push(i[2]=o);var s=n.p+n.u(t),a=new Error;n.l(s,(r=>{if(n.o(e,t)&&(0!==(i=e[t])&&(e[t]=void 0),i)){var o=r&&("load"===r.type?"missing":r.type),s=r&&r.target&&r.target.src;a.message="Loading chunk "+t+" failed.\n("+o+": "+s+")",a.name="ChunkLoadError",a.type=o,a.request=s,i[1](a)}}),"chunk-"+t,t)}};var t=(t,r)=>{var i,o,s=r[0],a=r[1],c=r[2],l=0;if(s.some((t=>0!==e[t]))){for(i in a)n.o(a,i)&&(n.m[i]=a[i]);if(c)c(n)}for(t&&t(r);l<s.length;l++)o=s[l],n.o(e,o)&&e[o]&&e[o][0](),e[o]=0},r=self.webpackChunkweb=self.webpackChunkweb||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})(),(()=>{"use strict";var e={};n.r(e),n.d(e,{Address:()=>Li,Array:()=>Fi,Bool:()=>Bi,Character:()=>Ui,Dictionary:()=>zi,Enum:()=>Ki,Event:()=>qi,Fix128:()=>Ci,Fix64:()=>ki,Identity:()=>ai,InclusiveRange:()=>Gi,Int:()=>li,Int128:()=>bi,Int16:()=>hi,Int256:()=>Ei,Int32:()=>gi,Int64:()=>mi,Int8:()=>di,Optional:()=>ji,Path:()=>Wi,Reference:()=>Mi,Resource:()=>Hi,String:()=>Ni,Struct:()=>Vi,UFix128:()=>Pi,UFix64:()=>Ri,UInt:()=>ci,UInt128:()=>vi,UInt16:()=>fi,UInt256:()=>wi,UInt32:()=>pi,UInt64:()=>yi,UInt8:()=>ui,Void:()=>Di,Word128:()=>Oi,Word16:()=>Si,Word256:()=>Ai,Word32:()=>xi,Word64:()=>Ii,Word8:()=>_i,_Array:()=>Fi});var t={};n.r(t),n.d(t,{identity:()=>E_});var r={};n.r(r),n.d(r,{base2:()=>__});var i={};n.r(i),n.d(i,{base8:()=>S_});var o={};n.r(o),n.d(o,{base10:()=>x_});var s={};n.r(s),n.d(s,{base16:()=>I_,base16upper:()=>O_});var a={};n.r(a),n.d(a,{base32:()=>A_,base32hex:()=>P_,base32hexpad:()=>N_,base32hexpadupper:()=>U_,base32hexupper:()=>C_,base32pad:()=>R_,base32padupper:()=>k_,base32upper:()=>T_,base32z:()=>B_});var c={};n.r(c),n.d(c,{base36:()=>L_,base36upper:()=>D_});var l={};n.r(l),n.d(l,{base58btc:()=>j_,base58flickr:()=>M_});var u={};n.r(u),n.d(u,{base64:()=>F_,base64pad:()=>z_,base64url:()=>q_,base64urlpad:()=>H_});var d={};n.r(d),n.d(d,{base256emoji:()=>G_});var f={};n.r(f),n.d(f,{sha256:()=>vS,sha512:()=>bS});var h={};n.r(h),n.d(h,{identity:()=>ES});var p={};n.r(p),n.d(p,{code:()=>SS,decode:()=>IS,encode:()=>xS,name:()=>_S});var g={};n.r(g),n.d(g,{code:()=>RS,decode:()=>PS,encode:()=>kS,name:()=>TS});var y,m=n(1462),v=n.t(m,2),b=n(5808),w=n(2551),E=n.t(w,2);function _(){return _=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_.apply(this,arguments)}!function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"}(y||(y={}));const S="popstate";function x(e,t){if(!1===e||null===e||"undefined"===typeof e)throw new Error(t)}function I(e,t){if(!e){"undefined"!==typeof console&&console.warn(t);try{throw new Error(t)}catch(n){}}}function O(e,t){return{usr:e.state,key:e.key,idx:t}}function A(e,t,n,r){return void 0===n&&(n=null),_({pathname:"string"===typeof e?e:e.pathname,search:"",hash:""},"string"===typeof t?R(t):t,{state:n,key:t&&t.key||r||Math.random().toString(36).substr(2,8)})}function T(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&"?"!==n&&(t+="?"===n.charAt(0)?n:"?"+n),r&&"#"!==r&&(t+="#"===r.charAt(0)?r:"#"+r),t}function R(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function k(e,t,n,r){void 0===r&&(r={});let{window:i=document.defaultView,v5Compat:o=!1}=r,s=i.history,a=y.Pop,c=null,l=u();function u(){return(s.state||{idx:null}).idx}function d(){a=y.Pop;let e=u(),t=null==e?null:e-l;l=e,c&&c({action:a,location:h.location,delta:t})}function f(e){let t="null"!==i.location.origin?i.location.origin:i.location.href,n="string"===typeof e?e:T(e);return n=n.replace(/ $/,"%20"),x(t,"No window.location.(origin|href) available to create URL for href: "+n),new URL(n,t)}null==l&&(l=0,s.replaceState(_({},s.state,{idx:l}),""));let h={get action(){return a},get location(){return e(i,s)},listen(e){if(c)throw new Error("A history only accepts one active listener");return i.addEventListener(S,d),c=e,()=>{i.removeEventListener(S,d),c=null}},createHref:e=>t(i,e),createURL:f,encodeLocation(e){let t=f(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:function(e,t){a=y.Push;let r=A(h.location,e,t);n&&n(r,e),l=u()+1;let d=O(r,l),f=h.createHref(r);try{s.pushState(d,"",f)}catch(p){if(p instanceof DOMException&&"DataCloneError"===p.name)throw p;i.location.assign(f)}o&&c&&c({action:a,location:h.location,delta:1})},replace:function(e,t){a=y.Replace;let r=A(h.location,e,t);n&&n(r,e),l=u();let i=O(r,l),d=h.createHref(r);s.replaceState(i,"",d),o&&c&&c({action:a,location:h.location,delta:0})},go:e=>s.go(e)};return h}var P;!function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"}(P||(P={}));new Set(["lazy","caseSensitive","path","id","index","children"]);function C(e,t,n){return void 0===n&&(n="/"),N(e,t,n,!1)}function N(e,t,n,r){let i=G(("string"===typeof t?R(t):t).pathname||"/",n);if(null==i)return null;let o=U(e);!function(e){e.sort(((e,t)=>e.score!==t.score?t.score-e.score:function(e,t){let n=e.length===t.length&&e.slice(0,-1).every(((e,n)=>e===t[n]));return n?e[e.length-1]-t[t.length-1]:0}(e.routesMeta.map((e=>e.childrenIndex)),t.routesMeta.map((e=>e.childrenIndex)))))}(o);let s=null;for(let a=0;null==s&&a<o.length;++a){let e=W(i);s=V(o[a],e,r)}return s}function U(e,t,n,r){void 0===t&&(t=[]),void 0===n&&(n=[]),void 0===r&&(r="");let i=(e,i,o)=>{let s={relativePath:void 0===o?e.path||"":o,caseSensitive:!0===e.caseSensitive,childrenIndex:i,route:e};s.relativePath.startsWith("/")&&(x(s.relativePath.startsWith(r),'Absolute route path "'+s.relativePath+'" nested under path "'+r+'" is not valid. An absolute child route path must start with the combined path of all its parent routes.'),s.relativePath=s.relativePath.slice(r.length));let a=J([r,s.relativePath]),c=n.concat(s);e.children&&e.children.length>0&&(x(!0!==e.index,'Index routes must not have child routes. Please remove all child routes from route path "'+a+'".'),U(e.children,t,c,a)),(null!=e.path||e.index)&&t.push({path:a,score:H(a,e.index),routesMeta:c})};return e.forEach(((e,t)=>{var n;if(""!==e.path&&null!=(n=e.path)&&n.includes("?"))for(let r of B(e.path))i(e,t,r);else i(e,t)})),t}function B(e){let t=e.split("/");if(0===t.length)return[];let[n,...r]=t,i=n.endsWith("?"),o=n.replace(/\?$/,"");if(0===r.length)return i?[o,""]:[o];let s=B(r.join("/")),a=[];return a.push(...s.map((e=>""===e?o:[o,e].join("/")))),i&&a.push(...s),a.map((t=>e.startsWith("/")&&""===t?"/":t))}const L=/^:[\w-]+$/,D=3,j=2,M=1,F=10,z=-2,q=e=>"*"===e;function H(e,t){let n=e.split("/"),r=n.length;return n.some(q)&&(r+=z),t&&(r+=j),n.filter((e=>!q(e))).reduce(((e,t)=>e+(L.test(t)?D:""===t?M:F)),r)}function V(e,t,n){void 0===n&&(n=!1);let{routesMeta:r}=e,i={},o="/",s=[];for(let a=0;a<r.length;++a){let e=r[a],c=a===r.length-1,l="/"===o?t:t.slice(o.length)||"/",u=K({path:e.relativePath,caseSensitive:e.caseSensitive,end:c},l),d=e.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=K({path:e.relativePath,caseSensitive:e.caseSensitive,end:!1},l)),!u)return null;Object.assign(i,u.params),s.push({params:i,pathname:J([o,u.pathname]),pathnameBase:$(J([o,u.pathnameBase])),route:d}),"/"!==u.pathnameBase&&(o=J([o,u.pathnameBase]))}return s}function K(e,t){"string"===typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=function(e,t,n){void 0===t&&(t=!1);void 0===n&&(n=!0);I("*"===e||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were "'+e.replace(/\*$/,"/*")+'" because the `*` character must always follow a `/` in the pattern. To get rid of this warning, please change the route path to "'+e.replace(/\*$/,"/*")+'".');let r=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,((e,t,n)=>(r.push({paramName:t,isOptional:null!=n}),n?"/?([^\\/]+)?":"/([^\\/]+)")));e.endsWith("*")?(r.push({paramName:"*"}),i+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":""!==e&&"/"!==e&&(i+="(?:(?=\\/|$))");let o=new RegExp(i,t?void 0:"i");return[o,r]}(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let o=i[0],s=o.replace(/(.)\/+$/,"$1"),a=i.slice(1),c=r.reduce(((e,t,n)=>{let{paramName:r,isOptional:i}=t;if("*"===r){let e=a[n]||"";s=o.slice(0,o.length-e.length).replace(/(.)\/+$/,"$1")}const c=a[n];return e[r]=i&&!c?void 0:(c||"").replace(/%2F/g,"/"),e}),{});return{params:c,pathname:o,pathnameBase:s,pattern:e}}function W(e){try{return e.split("/").map((e=>decodeURIComponent(e).replace(/\//g,"%2F"))).join("/")}catch(t){return I(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent encoding ('+t+")."),e}}function G(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&"/"!==r?null:e.slice(n)||"/"}function Y(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified `to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the `to."+n+'` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.'}function Z(e){return e.filter(((e,t)=>0===t||e.route.path&&e.route.path.length>0))}function X(e,t){let n=Z(e);return t?n.map(((e,t)=>t===n.length-1?e.pathname:e.pathnameBase)):n.map((e=>e.pathnameBase))}function Q(e,t,n,r){let i;void 0===r&&(r=!1),"string"===typeof e?i=R(e):(i=_({},e),x(!i.pathname||!i.pathname.includes("?"),Y("?","pathname","search",i)),x(!i.pathname||!i.pathname.includes("#"),Y("#","pathname","hash",i)),x(!i.search||!i.search.includes("#"),Y("#","search","hash",i)));let o,s=""===e||""===i.pathname,a=s?"/":i.pathname;if(null==a)o=n;else{let e=t.length-1;if(!r&&a.startsWith("..")){let t=a.split("/");for(;".."===t[0];)t.shift(),e-=1;i.pathname=t.join("/")}o=e>=0?t[e]:"/"}let c=function(e,t){void 0===t&&(t="/");let{pathname:n,search:r="",hash:i=""}="string"===typeof e?R(e):e,o=n?n.startsWith("/")?n:function(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach((e=>{".."===e?n.length>1&&n.pop():"."!==e&&n.push(e)})),n.length>1?n.join("/"):"/"}(n,t):t;return{pathname:o,search:ee(r),hash:te(i)}}(i,o),l=a&&"/"!==a&&a.endsWith("/"),u=(s||"."===a)&&n.endsWith("/");return c.pathname.endsWith("/")||!l&&!u||(c.pathname+="/"),c}const J=e=>e.join("/").replace(/\/\/+/g,"/"),$=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),ee=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",te=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"";Error;function ne(e){return null!=e&&"number"===typeof e.status&&"string"===typeof e.statusText&&"boolean"===typeof e.internal&&"data"in e}const re=["post","put","patch","delete"],ie=(new Set(re),["get",...re]);new Set(ie),new Set([301,302,303,307,308]),new Set([307,308]);Symbol("deferred");function oe(){return oe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},oe.apply(this,arguments)}const se=m.createContext(null);const ae=m.createContext(null);const ce=m.createContext(null);const le=m.createContext(null);const ue=m.createContext({outlet:null,matches:[],isDataRoute:!1});const de=m.createContext(null);function fe(){return null!=m.useContext(le)}function he(){return fe()||x(!1),m.useContext(le).location}function pe(e){m.useContext(ce).static||m.useLayoutEffect(e)}function ge(){let{isDataRoute:e}=m.useContext(ue);return e?function(){let{router:e}=xe(_e.UseNavigateStable),t=Oe(Se.UseNavigateStable),n=m.useRef(!1);pe((()=>{n.current=!0}));let r=m.useCallback((function(r,i){void 0===i&&(i={}),n.current&&("number"===typeof r?e.navigate(r):e.navigate(r,oe({fromRouteId:t},i)))}),[e,t]);return r}():function(){fe()||x(!1);let e=m.useContext(se),{basename:t,future:n,navigator:r}=m.useContext(ce),{matches:i}=m.useContext(ue),{pathname:o}=he(),s=JSON.stringify(X(i,n.v7_relativeSplatPath)),a=m.useRef(!1);pe((()=>{a.current=!0}));let c=m.useCallback((function(n,i){if(void 0===i&&(i={}),!a.current)return;if("number"===typeof n)return void r.go(n);let c=Q(n,JSON.parse(s),o,"path"===i.relative);null==e&&"/"!==t&&(c.pathname="/"===c.pathname?t:J([t,c.pathname])),(i.replace?r.replace:r.push)(c,i.state,i)}),[t,r,s,o,e]);return c}()}function ye(e,t,n,r){fe()||x(!1);let{navigator:i}=m.useContext(ce),{matches:o}=m.useContext(ue),s=o[o.length-1],a=s?s.params:{},c=(s&&s.pathname,s?s.pathnameBase:"/");s&&s.route;let l,u=he();if(t){var d;let e="string"===typeof t?R(t):t;"/"===c||(null==(d=e.pathname)?void 0:d.startsWith(c))||x(!1),l=e}else l=u;let f=l.pathname||"/",h=f;if("/"!==c){let e=c.replace(/^\//,"").split("/");h="/"+f.replace(/^\//,"").split("/").slice(e.length).join("/")}let p=C(e,{pathname:h});let g=Ee(p&&p.map((e=>Object.assign({},e,{params:Object.assign({},a,e.params),pathname:J([c,i.encodeLocation?i.encodeLocation(e.pathname).pathname:e.pathname]),pathnameBase:"/"===e.pathnameBase?c:J([c,i.encodeLocation?i.encodeLocation(e.pathnameBase).pathname:e.pathnameBase])}))),o,n,r);return t&&g?m.createElement(le.Provider,{value:{location:oe({pathname:"/",search:"",hash:"",state:null,key:"default"},l),navigationType:y.Pop}},g):g}function me(){let e=function(){var e;let t=m.useContext(de),n=Ie(Se.UseRouteError),r=Oe(Se.UseRouteError);if(void 0!==t)return t;return null==(e=n.errors)?void 0:e[r]}(),t=ne(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:r};return m.createElement(m.Fragment,null,m.createElement("h2",null,"Unexpected Application Error!"),m.createElement("h3",{style:{fontStyle:"italic"}},t),n?m.createElement("pre",{style:i},n):null,null)}const ve=m.createElement(me,null);class be extends m.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||"idle"!==t.revalidation&&"idle"===e.revalidation?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:void 0!==e.error?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error("React Router caught the following error during render",e,t)}render(){return void 0!==this.state.error?m.createElement(ue.Provider,{value:this.props.routeContext},m.createElement(de.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function we(e){let{routeContext:t,match:n,children:r}=e,i=m.useContext(se);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),m.createElement(ue.Provider,{value:t},r)}function Ee(e,t,n,r){var i;if(void 0===t&&(t=[]),void 0===n&&(n=null),void 0===r&&(r=null),null==e){var o;if(null==(o=n)||!o.errors)return null;e=n.matches}let s=e,a=null==(i=n)?void 0:i.errors;if(null!=a){let e=s.findIndex((e=>e.route.id&&void 0!==(null==a?void 0:a[e.route.id])));e>=0||x(!1),s=s.slice(0,Math.min(s.length,e+1))}let c=!1,l=-1;if(n&&r&&r.v7_partialHydration)for(let u=0;u<s.length;u++){let e=s[u];if((e.route.HydrateFallback||e.route.hydrateFallbackElement)&&(l=u),e.route.id){let{loaderData:t,errors:r}=n,i=e.route.loader&&void 0===t[e.route.id]&&(!r||void 0===r[e.route.id]);if(e.route.lazy||i){c=!0,s=l>=0?s.slice(0,l+1):[s[0]];break}}}return s.reduceRight(((e,r,i)=>{let o,u=!1,d=null,f=null;var h;n&&(o=a&&r.route.id?a[r.route.id]:void 0,d=r.route.errorElement||ve,c&&(l<0&&0===i?(h="route-fallback",!1||Ae[h]||(Ae[h]=!0),u=!0,f=null):l===i&&(u=!0,f=r.route.hydrateFallbackElement||null)));let p=t.concat(s.slice(0,i+1)),g=()=>{let t;return t=o?d:u?f:r.route.Component?m.createElement(r.route.Component,null):r.route.element?r.route.element:e,m.createElement(we,{match:r,routeContext:{outlet:e,matches:p,isDataRoute:null!=n},children:t})};return n&&(r.route.ErrorBoundary||r.route.errorElement||0===i)?m.createElement(be,{location:n.location,revalidation:n.revalidation,component:d,error:o,children:g(),routeContext:{outlet:null,matches:p,isDataRoute:!0}}):g()}),null)}var _e=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(_e||{}),Se=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(Se||{});function xe(e){let t=m.useContext(se);return t||x(!1),t}function Ie(e){let t=m.useContext(ae);return t||x(!1),t}function Oe(e){let t=function(e){let t=m.useContext(ue);return t||x(!1),t}(),n=t.matches[t.matches.length-1];return n.route.id||x(!1),n.route.id}const Ae={};v.startTransition;function Te(e){let{to:t,replace:n,state:r,relative:i}=e;fe()||x(!1);let{future:o,static:s}=m.useContext(ce),{matches:a}=m.useContext(ue),{pathname:c}=he(),l=ge(),u=Q(t,X(a,o.v7_relativeSplatPath),c,"path"===i),d=JSON.stringify(u);return m.useEffect((()=>l(JSON.parse(d),{replace:n,state:r,relative:i})),[l,d,i,n,r]),null}function Re(e){x(!1)}function ke(e){let{basename:t="/",children:n=null,location:r,navigationType:i=y.Pop,navigator:o,static:s=!1,future:a}=e;fe()&&x(!1);let c=t.replace(/^\/*/,"/"),l=m.useMemo((()=>({basename:c,navigator:o,static:s,future:oe({v7_relativeSplatPath:!1},a)})),[c,a,o,s]);"string"===typeof r&&(r=R(r));let{pathname:u="/",search:d="",hash:f="",state:h=null,key:p="default"}=r,g=m.useMemo((()=>{let e=G(u,c);return null==e?null:{location:{pathname:e,search:d,hash:f,state:h,key:p},navigationType:i}}),[c,u,d,f,h,p,i]);return null==g?null:m.createElement(ce.Provider,{value:l},m.createElement(le.Provider,{children:n,value:g}))}function Pe(e){let{children:t,location:n}=e;return ye(Ce(t),n)}new Promise((()=>{}));m.Component;function Ce(e,t){void 0===t&&(t=[]);let n=[];return m.Children.forEach(e,((e,r)=>{if(!m.isValidElement(e))return;let i=[...t,r];if(e.type===m.Fragment)return void n.push.apply(n,Ce(e.props.children,i));e.type!==Re&&x(!1),e.props.index&&e.props.children&&x(!1);let o={id:e.props.id||i.join("-"),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,loader:e.props.loader,action:e.props.action,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:null!=e.props.ErrorBoundary||null!=e.props.errorElement,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(o.children=Ce(e.props.children,i)),n.push(o)})),n}new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);try{window.__reactRouterVersion="6"}catch(Mz){}new Map;const Ne=v.startTransition;E.flushSync,v.useId;function Ue(e){let{basename:t,children:n,future:r,window:i}=e,o=m.useRef();var s;null==o.current&&(o.current=(void 0===(s={window:i,v5Compat:!0})&&(s={}),k((function(e,t){let{pathname:n,search:r,hash:i}=e.location;return A("",{pathname:n,search:r,hash:i},t.state&&t.state.usr||null,t.state&&t.state.key||"default")}),(function(e,t){return"string"===typeof t?t:T(t)}),null,s)));let a=o.current,[c,l]=m.useState({action:a.action,location:a.location}),{v7_startTransition:u}=r||{},d=m.useCallback((e=>{u&&Ne?Ne((()=>l(e))):l(e)}),[l,u]);return m.useLayoutEffect((()=>a.listen(d)),[a,d]),m.createElement(ke,{basename:t,children:n,location:c.location,navigationType:c.action,navigator:a,future:r})}"undefined"!==typeof window&&"undefined"!==typeof window.document&&window.document.createElement;var Be,Le;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Be||(Be={})),function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"}(Le||(Le={}));var De=n(5982),je=n.n(De),Me=n(5175),Fe=n.n(Me),ze=n(5165),qe=n.n(ze),He=n(8043),Ve=n.n(He);function Ke(){return Ke=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ke.apply(this,arguments)}function We(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Ge(e,t)}function Ge(e,t){return Ge=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Ge(e,t)}function Ye(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)t.indexOf(n=o[r])>=0||(i[n]=e[n]);return i}var Ze={BASE:"base",BODY:"body",HEAD:"head",HTML:"html",LINK:"link",META:"meta",NOSCRIPT:"noscript",SCRIPT:"script",STYLE:"style",TITLE:"title",FRAGMENT:"Symbol(react.fragment)"},Xe={rel:["amphtml","canonical","alternate"]},Qe={type:["application/ld+json"]},Je={charset:"",name:["robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]},$e=Object.keys(Ze).map((function(e){return Ze[e]})),et={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},tt=Object.keys(et).reduce((function(e,t){return e[et[t]]=t,e}),{}),nt=function(e,t){for(var n=e.length-1;n>=0;n-=1){var r=e[n];if(Object.prototype.hasOwnProperty.call(r,t))return r[t]}return null},rt=function(e){var t=nt(e,Ze.TITLE),n=nt(e,"titleTemplate");if(Array.isArray(t)&&(t=t.join("")),n&&t)return n.replace(/%s/g,(function(){return t}));var r=nt(e,"defaultTitle");return t||r||void 0},it=function(e){return nt(e,"onChangeClientState")||function(){}},ot=function(e,t){return t.filter((function(t){return void 0!==t[e]})).map((function(t){return t[e]})).reduce((function(e,t){return Ke({},e,t)}),{})},st=function(e,t){return t.filter((function(e){return void 0!==e[Ze.BASE]})).map((function(e){return e[Ze.BASE]})).reverse().reduce((function(t,n){if(!t.length)for(var r=Object.keys(n),i=0;i<r.length;i+=1){var o=r[i].toLowerCase();if(-1!==e.indexOf(o)&&n[o])return t.concat(n)}return t}),[])},at=function(e,t,n){var r={};return n.filter((function(t){return!!Array.isArray(t[e])||(void 0!==t[e]&&console&&"function"==typeof console.warn&&console.warn("Helmet: "+e+' should be of type "Array". Instead found type "'+typeof t[e]+'"'),!1)})).map((function(t){return t[e]})).reverse().reduce((function(e,n){var i={};n.filter((function(e){for(var n,o=Object.keys(e),s=0;s<o.length;s+=1){var a=o[s],c=a.toLowerCase();-1===t.indexOf(c)||"rel"===n&&"canonical"===e[n].toLowerCase()||"rel"===c&&"stylesheet"===e[c].toLowerCase()||(n=c),-1===t.indexOf(a)||"innerHTML"!==a&&"cssText"!==a&&"itemprop"!==a||(n=a)}if(!n||!e[n])return!1;var l=e[n].toLowerCase();return r[n]||(r[n]={}),i[n]||(i[n]={}),!r[n][l]&&(i[n][l]=!0,!0)})).reverse().forEach((function(t){return e.push(t)}));for(var o=Object.keys(i),s=0;s<o.length;s+=1){var a=o[s],c=Ke({},r[a],i[a]);r[a]=c}return e}),[]).reverse()},ct=function(e,t){if(Array.isArray(e)&&e.length)for(var n=0;n<e.length;n+=1)if(e[n][t])return!0;return!1},lt=function(e){return Array.isArray(e)?e.join(""):e},ut=function(e,t){return Array.isArray(e)?e.reduce((function(e,n){return function(e,t){for(var n=Object.keys(e),r=0;r<n.length;r+=1)if(t[n[r]]&&t[n[r]].includes(e[n[r]]))return!0;return!1}(n,t)?e.priority.push(n):e.default.push(n),e}),{priority:[],default:[]}):{default:e}},dt=function(e,t){var n;return Ke({},e,((n={})[t]=void 0,n))},ft=[Ze.NOSCRIPT,Ze.SCRIPT,Ze.STYLE],ht=function(e,t){return void 0===t&&(t=!0),!1===t?String(e):String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")},pt=function(e){return Object.keys(e).reduce((function(t,n){var r=void 0!==e[n]?n+'="'+e[n]+'"':""+n;return t?t+" "+r:r}),"")},gt=function(e,t){return void 0===t&&(t={}),Object.keys(e).reduce((function(t,n){return t[et[n]||n]=e[n],t}),t)},yt=function(e,t){return t.map((function(t,n){var r,i=((r={key:n})["data-rh"]=!0,r);return Object.keys(t).forEach((function(e){var n=et[e]||e;"innerHTML"===n||"cssText"===n?i.dangerouslySetInnerHTML={__html:t.innerHTML||t.cssText}:i[n]=t[e]})),m.createElement(e,i)}))},mt=function(e,t,n){switch(e){case Ze.TITLE:return{toComponent:function(){return n=t.titleAttributes,(r={key:e=t.title})["data-rh"]=!0,i=gt(n,r),[m.createElement(Ze.TITLE,i,e)];var e,n,r,i},toString:function(){return function(e,t,n,r){var i=pt(n),o=lt(t);return i?"<"+e+' data-rh="true" '+i+">"+ht(o,r)+"</"+e+">":"<"+e+' data-rh="true">'+ht(o,r)+"</"+e+">"}(e,t.title,t.titleAttributes,n)}};case"bodyAttributes":case"htmlAttributes":return{toComponent:function(){return gt(t)},toString:function(){return pt(t)}};default:return{toComponent:function(){return yt(e,t)},toString:function(){return function(e,t,n){return t.reduce((function(t,r){var i=Object.keys(r).filter((function(e){return!("innerHTML"===e||"cssText"===e)})).reduce((function(e,t){var i=void 0===r[t]?t:t+'="'+ht(r[t],n)+'"';return e?e+" "+i:i}),""),o=r.innerHTML||r.cssText||"",s=-1===ft.indexOf(e);return t+"<"+e+' data-rh="true" '+i+(s?"/>":">"+o+"</"+e+">")}),"")}(e,t,n)}}}},vt=function(e){var t=e.baseTag,n=e.bodyAttributes,r=e.encode,i=e.htmlAttributes,o=e.noscriptTags,s=e.styleTags,a=e.title,c=void 0===a?"":a,l=e.titleAttributes,u=e.linkTags,d=e.metaTags,f=e.scriptTags,h={toComponent:function(){},toString:function(){return""}};if(e.prioritizeSeoTags){var p=function(e){var t=e.linkTags,n=e.scriptTags,r=e.encode,i=ut(e.metaTags,Je),o=ut(t,Xe),s=ut(n,Qe);return{priorityMethods:{toComponent:function(){return[].concat(yt(Ze.META,i.priority),yt(Ze.LINK,o.priority),yt(Ze.SCRIPT,s.priority))},toString:function(){return mt(Ze.META,i.priority,r)+" "+mt(Ze.LINK,o.priority,r)+" "+mt(Ze.SCRIPT,s.priority,r)}},metaTags:i.default,linkTags:o.default,scriptTags:s.default}}(e);h=p.priorityMethods,u=p.linkTags,d=p.metaTags,f=p.scriptTags}return{priority:h,base:mt(Ze.BASE,t,r),bodyAttributes:mt("bodyAttributes",n,r),htmlAttributes:mt("htmlAttributes",i,r),link:mt(Ze.LINK,u,r),meta:mt(Ze.META,d,r),noscript:mt(Ze.NOSCRIPT,o,r),script:mt(Ze.SCRIPT,f,r),style:mt(Ze.STYLE,s,r),title:mt(Ze.TITLE,{title:c,titleAttributes:l},r)}},bt=[],wt=function(e,t){var n=this;void 0===t&&(t="undefined"!=typeof document),this.instances=[],this.value={setHelmet:function(e){n.context.helmet=e},helmetInstances:{get:function(){return n.canUseDOM?bt:n.instances},add:function(e){(n.canUseDOM?bt:n.instances).push(e)},remove:function(e){var t=(n.canUseDOM?bt:n.instances).indexOf(e);(n.canUseDOM?bt:n.instances).splice(t,1)}}},this.context=e,this.canUseDOM=t,t||(e.helmet=vt({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))},Et=m.createContext({}),_t=je().shape({setHelmet:je().func,helmetInstances:je().shape({get:je().func,add:je().func,remove:je().func})}),St="undefined"!=typeof document,xt=function(e){function t(n){var r;return(r=e.call(this,n)||this).helmetData=new wt(r.props.context,t.canUseDOM),r}return We(t,e),t.prototype.render=function(){return m.createElement(Et.Provider,{value:this.helmetData.value},this.props.children)},t}(m.Component);xt.canUseDOM=St,xt.propTypes={context:je().shape({helmet:je().shape()}),children:je().node.isRequired},xt.defaultProps={context:{}},xt.displayName="HelmetProvider";var It=function(e,t){var n,r=document.head||document.querySelector(Ze.HEAD),i=r.querySelectorAll(e+"[data-rh]"),o=[].slice.call(i),s=[];return t&&t.length&&t.forEach((function(t){var r=document.createElement(e);for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&("innerHTML"===i?r.innerHTML=t.innerHTML:"cssText"===i?r.styleSheet?r.styleSheet.cssText=t.cssText:r.appendChild(document.createTextNode(t.cssText)):r.setAttribute(i,void 0===t[i]?"":t[i]));r.setAttribute("data-rh","true"),o.some((function(e,t){return n=t,r.isEqualNode(e)}))?o.splice(n,1):s.push(r)})),o.forEach((function(e){return e.parentNode.removeChild(e)})),s.forEach((function(e){return r.appendChild(e)})),{oldTags:o,newTags:s}},Ot=function(e,t){var n=document.getElementsByTagName(e)[0];if(n){for(var r=n.getAttribute("data-rh"),i=r?r.split(","):[],o=[].concat(i),s=Object.keys(t),a=0;a<s.length;a+=1){var c=s[a],l=t[c]||"";n.getAttribute(c)!==l&&n.setAttribute(c,l),-1===i.indexOf(c)&&i.push(c);var u=o.indexOf(c);-1!==u&&o.splice(u,1)}for(var d=o.length-1;d>=0;d-=1)n.removeAttribute(o[d]);i.length===o.length?n.removeAttribute("data-rh"):n.getAttribute("data-rh")!==s.join(",")&&n.setAttribute("data-rh",s.join(","))}},At=function(e,t){var n=e.baseTag,r=e.htmlAttributes,i=e.linkTags,o=e.metaTags,s=e.noscriptTags,a=e.onChangeClientState,c=e.scriptTags,l=e.styleTags,u=e.title,d=e.titleAttributes;Ot(Ze.BODY,e.bodyAttributes),Ot(Ze.HTML,r),function(e,t){void 0!==e&&document.title!==e&&(document.title=lt(e)),Ot(Ze.TITLE,t)}(u,d);var f={baseTag:It(Ze.BASE,n),linkTags:It(Ze.LINK,i),metaTags:It(Ze.META,o),noscriptTags:It(Ze.NOSCRIPT,s),scriptTags:It(Ze.SCRIPT,c),styleTags:It(Ze.STYLE,l)},h={},p={};Object.keys(f).forEach((function(e){var t=f[e],n=t.newTags,r=t.oldTags;n.length&&(h[e]=n),r.length&&(p[e]=f[e].oldTags)})),t&&t(),a(e,h,p)},Tt=null,Rt=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).rendered=!1,t}We(t,e);var n=t.prototype;return n.shouldComponentUpdate=function(e){return!Ve()(e,this.props)},n.componentDidUpdate=function(){this.emitChange()},n.componentWillUnmount=function(){this.props.context.helmetInstances.remove(this),this.emitChange()},n.emitChange=function(){var e,t,n=this.props.context,r=n.setHelmet,i=null,o=(e=n.helmetInstances.get().map((function(e){var t=Ke({},e.props);return delete t.context,t})),{baseTag:st(["href"],e),bodyAttributes:ot("bodyAttributes",e),defer:nt(e,"defer"),encode:nt(e,"encodeSpecialCharacters"),htmlAttributes:ot("htmlAttributes",e),linkTags:at(Ze.LINK,["rel","href"],e),metaTags:at(Ze.META,["name","charset","http-equiv","property","itemprop"],e),noscriptTags:at(Ze.NOSCRIPT,["innerHTML"],e),onChangeClientState:it(e),scriptTags:at(Ze.SCRIPT,["src","innerHTML"],e),styleTags:at(Ze.STYLE,["cssText"],e),title:rt(e),titleAttributes:ot("titleAttributes",e),prioritizeSeoTags:ct(e,"prioritizeSeoTags")});xt.canUseDOM?(t=o,Tt&&cancelAnimationFrame(Tt),t.defer?Tt=requestAnimationFrame((function(){At(t,(function(){Tt=null}))})):(At(t),Tt=null)):vt&&(i=vt(o)),r(i)},n.init=function(){this.rendered||(this.rendered=!0,this.props.context.helmetInstances.add(this),this.emitChange())},n.render=function(){return this.init(),null},t}(m.Component);Rt.propTypes={context:_t.isRequired},Rt.displayName="HelmetDispatcher";var kt=["children"],Pt=["children"],Ct=function(e){function t(){return e.apply(this,arguments)||this}We(t,e);var n=t.prototype;return n.shouldComponentUpdate=function(e){return!Fe()(dt(this.props,"helmetData"),dt(e,"helmetData"))},n.mapNestedChildrenToProps=function(e,t){if(!t)return null;switch(e.type){case Ze.SCRIPT:case Ze.NOSCRIPT:return{innerHTML:t};case Ze.STYLE:return{cssText:t};default:throw new Error("<"+e.type+" /> elements are self-closing and can not contain children. Refer to our API for more information.")}},n.flattenArrayTypeChildren=function(e){var t,n=e.child,r=e.arrayTypeChildren;return Ke({},r,((t={})[n.type]=[].concat(r[n.type]||[],[Ke({},e.newChildProps,this.mapNestedChildrenToProps(n,e.nestedChildren))]),t))},n.mapObjectTypeChildren=function(e){var t,n,r=e.child,i=e.newProps,o=e.newChildProps,s=e.nestedChildren;switch(r.type){case Ze.TITLE:return Ke({},i,((t={})[r.type]=s,t.titleAttributes=Ke({},o),t));case Ze.BODY:return Ke({},i,{bodyAttributes:Ke({},o)});case Ze.HTML:return Ke({},i,{htmlAttributes:Ke({},o)});default:return Ke({},i,((n={})[r.type]=Ke({},o),n))}},n.mapArrayTypeChildrenToProps=function(e,t){var n=Ke({},t);return Object.keys(e).forEach((function(t){var r;n=Ke({},n,((r={})[t]=e[t],r))})),n},n.warnOnInvalidChildren=function(e,t){return qe()($e.some((function(t){return e.type===t})),"function"==typeof e.type?"You may be attempting to nest <Helmet> components within each other, which is not allowed. Refer to our API for more information.":"Only elements types "+$e.join(", ")+" are allowed. Helmet does not support rendering <"+e.type+"> elements. Refer to our API for more information."),qe()(!t||"string"==typeof t||Array.isArray(t)&&!t.some((function(e){return"string"!=typeof e})),"Helmet expects a string as a child of <"+e.type+">. Did you forget to wrap your children in braces? ( <"+e.type+">{``}</"+e.type+"> ) Refer to our API for more information."),!0},n.mapChildrenToProps=function(e,t){var n=this,r={};return m.Children.forEach(e,(function(e){if(e&&e.props){var i=e.props,o=i.children,s=Ye(i,kt),a=Object.keys(s).reduce((function(e,t){return e[tt[t]||t]=s[t],e}),{}),c=e.type;switch("symbol"==typeof c?c=c.toString():n.warnOnInvalidChildren(e,o),c){case Ze.FRAGMENT:t=n.mapChildrenToProps(o,t);break;case Ze.LINK:case Ze.META:case Ze.NOSCRIPT:case Ze.SCRIPT:case Ze.STYLE:r=n.flattenArrayTypeChildren({child:e,arrayTypeChildren:r,newChildProps:a,nestedChildren:o});break;default:t=n.mapObjectTypeChildren({child:e,newProps:t,newChildProps:a,nestedChildren:o})}}})),this.mapArrayTypeChildrenToProps(r,t)},n.render=function(){var e=this.props,t=e.children,n=Ye(e,Pt),r=Ke({},n),i=n.helmetData;return t&&(r=this.mapChildrenToProps(t,r)),!i||i instanceof wt||(i=new wt(i.context,i.instances)),i?m.createElement(Rt,Ke({},r,{context:i.value,helmetData:void 0})):m.createElement(Et.Consumer,null,(function(e){return m.createElement(Rt,Ke({},r,{context:e}))}))},t}(m.Component);Ct.propTypes={base:je().object,bodyAttributes:je().object,children:je().oneOfType([je().arrayOf(je().node),je().node]),defaultTitle:je().string,defer:je().bool,encodeSpecialCharacters:je().bool,htmlAttributes:je().object,link:je().arrayOf(je().object),meta:je().arrayOf(je().object),noscript:je().arrayOf(je().object),onChangeClientState:je().func,script:je().arrayOf(je().object),style:je().arrayOf(je().object),title:je().string,titleAttributes:je().object,titleTemplate:je().string,prioritizeSeoTags:je().bool,helmetData:je().object},Ct.defaultProps={defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1},Ct.displayName="Helmet";let Nt=null;let Ut=function(e){return e[e.debug=5]="debug",e[e.info=4]="info",e[e.log=3]="log",e[e.warn=2]="warn",e[e.error=1]="error",e}({});const Bt=async e=>{var t,n;const{title:r,message:i,level:o,always:s}=e,a=null!==(t=await(null===(n=Nt)||void 0===n||null===(n=n())||void 0===n?void 0:n.get("logger.level")))&&void 0!==t?t:Ut.warn;if(!s&&a<o)return;const c=(e=>{const{title:t,message:n}=e;return["\n %c".concat(t,"\n ============================\n\n ").concat(n,"\n\n ============================\n ").replace(/\n[^\S\r\n]+/g,"\n").trim(),"font-weight:bold;font-family:monospace;"]})({title:r,message:i});switch(o){case Ut.debug:console.debug(...c);break;case Ut.info:console.info(...c);break;case Ut.warn:console.warn(...c);break;case Ut.error:console.error(...c);break;default:console.log(...c)}};function Lt(e,t){if(!e){var n;const e=new Error("INVARIANT ".concat(t));e.stack=null===(n=e.stack)||void 0===n||null===(n=n.split("\n"))||void 0===n||null===(n=n.filter((e=>!/at invariant/.test(e))))||void 0===n?void 0:n.join("\n");for(var r=arguments.length,i=new Array(r>2?r-2:0),o=2;o<r;o++)i[o-2]=arguments[o];throw console.error("\n\n---\n\n",e,"\n\n",...i,"\n\n---\n\n"),e}}Bt.deprecate=e=>{const{pkg:t,subject:n,transition:r,level:i=Ut.warn,message:o="",callback:s=null}=e,a=e=>e.charAt(0).toUpperCase()+e.slice(1),c=()=>Bt({title:"".concat(t?t+" ":"","Deprecation Notice"),message:"\n ".concat(n?"".concat(a(n)," is deprecated and will cease to work in future releases").concat(t?" of "+t:"","."):"").concat(o?"\n"+o:"").concat(r?"\nYou can learn more (including a guide on common transition paths) here: ".concat(r):"","\n ").trim(),level:i});return"function"===typeof s?async function(){return await c(),await s(...arguments)}:c()};const Dt={randomUUID:"undefined"!==typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let jt;const Mt=new Uint8Array(16);function Ft(){if(!jt&&(jt="undefined"!==typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!jt))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return jt(Mt)}const zt=[];for(let n=0;n<256;++n)zt.push((n+256).toString(16).slice(1));function qt(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return zt[e[t+0]]+zt[e[t+1]]+zt[e[t+2]]+zt[e[t+3]]+"-"+zt[e[t+4]]+zt[e[t+5]]+"-"+zt[e[t+6]]+zt[e[t+7]]+"-"+zt[e[t+8]]+zt[e[t+9]]+"-"+zt[e[t+10]]+zt[e[t+11]]+zt[e[t+12]]+zt[e[t+13]]+zt[e[t+14]]+zt[e[t+15]]}const Ht=function(e,t,n){if(Dt.randomUUID&&!t&&!e)return Dt.randomUUID();const r=(e=e||{}).random||(e.rng||Ft)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(let e=0;e<16;++e)t[n+e]=r[e];return t}return qt(r)};var Vt=function(e){return e.UNKNOWN="UNKNOWN",e.SCRIPT="SCRIPT",e.TRANSACTION="TRANSACTION",e.GET_TRANSACTION_STATUS="GET_TRANSACTION_STATUS",e.GET_ACCOUNT="GET_ACCOUNT",e.GET_EVENTS="GET_EVENTS",e.PING="PING",e.GET_TRANSACTION="GET_TRANSACTION",e.GET_BLOCK="GET_BLOCK",e.GET_BLOCK_HEADER="GET_BLOCK_HEADER",e.GET_COLLECTION="GET_COLLECTION",e.GET_NETWORK_PARAMETERS="GET_NETWORK_PARAMETERS",e.SUBSCRIBE_EVENTS="SUBSCRIBE_EVENTS",e.GET_NODE_VERSION_INFO="GET_NODE_VERSION_INFO",e}({}),Kt=function(e){return e.BAD="BAD",e.OK="OK",e}({}),Wt=function(e){return e.AUTHORIZER="authorizer",e.PAYER="payer",e.PROPOSER="proposer",e}({}),Gt=function(e){return e.ARGUMENT="ARGUMENT",e.ACCOUNT="ACCOUNT",e}({}),Yt=function(e){return e[e.UNKNOWN_ERROR=-1]="UNKNOWN_ERROR",e[e.TX_VALIDATION_ERROR=1e3]="TX_VALIDATION_ERROR",e[e.INVALID_TX_BYTE_SIZE_ERROR=1001]="INVALID_TX_BYTE_SIZE_ERROR",e[e.INVALID_REFERENCE_BLOCK_ERROR=1002]="INVALID_REFERENCE_BLOCK_ERROR",e[e.EXPIRED_TRANSACTION_ERROR=1003]="EXPIRED_TRANSACTION_ERROR",e[e.INVALID_SCRIPT_ERROR=1004]="INVALID_SCRIPT_ERROR",e[e.INVALID_GAS_LIMIT_ERROR=1005]="INVALID_GAS_LIMIT_ERROR",e[e.INVALID_PROPOSAL_SIGNATURE_ERROR=1006]="INVALID_PROPOSAL_SIGNATURE_ERROR",e[e.INVALID_PROPOSAL_SEQ_NUMBER_ERROR=1007]="INVALID_PROPOSAL_SEQ_NUMBER_ERROR",e[e.INVALID_PAYLOAD_SIGNATURE_ERROR=1008]="INVALID_PAYLOAD_SIGNATURE_ERROR",e[e.INVALID_ENVELOPE_SIGNATURE_ERROR=1009]="INVALID_ENVELOPE_SIGNATURE_ERROR",e[e.FVM_INTERNAL_ERROR=1050]="FVM_INTERNAL_ERROR",e[e.VALUE_ERROR=1051]="VALUE_ERROR",e[e.INVALID_ARGUMENT_ERROR=1052]="INVALID_ARGUMENT_ERROR",e[e.INVALID_ADDRESS_ERROR=1053]="INVALID_ADDRESS_ERROR",e[e.INVALID_LOCATION_ERROR=1054]="INVALID_LOCATION_ERROR",e[e.ACCOUNT_AUTHORIZATION_ERROR=1055]="ACCOUNT_AUTHORIZATION_ERROR",e[e.OPERATION_AUTHORIZATION_ERROR=1056]="OPERATION_AUTHORIZATION_ERROR",e[e.OPERATION_NOT_SUPPORTED_ERROR=1057]="OPERATION_NOT_SUPPORTED_ERROR",e[e.BLOCK_HEIGHT_OUT_OF_RANGE_ERROR=1058]="BLOCK_HEIGHT_OUT_OF_RANGE_ERROR",e[e.EXECUTION_ERROR=1100]="EXECUTION_ERROR",e[e.CADENCE_RUNTIME_ERROR=1101]="CADENCE_RUNTIME_ERROR",e[e.ENCODING_UNSUPPORTED_VALUE=1102]="ENCODING_UNSUPPORTED_VALUE",e[e.STORAGE_CAPACITY_EXCEEDED=1103]="STORAGE_CAPACITY_EXCEEDED",e[e.GAS_LIMIT_EXCEEDED_ERROR=1104]="GAS_LIMIT_EXCEEDED_ERROR",e[e.EVENT_LIMIT_EXCEEDED_ERROR=1105]="EVENT_LIMIT_EXCEEDED_ERROR",e[e.LEDGER_INTERACTION_LIMIT_EXCEEDED_ERROR=1106]="LEDGER_INTERACTION_LIMIT_EXCEEDED_ERROR",e[e.STATE_KEY_SIZE_LIMIT_ERROR=1107]="STATE_KEY_SIZE_LIMIT_ERROR",e[e.STATE_VALUE_SIZE_LIMIT_ERROR=1108]="STATE_VALUE_SIZE_LIMIT_ERROR",e[e.TRANSACTION_FEE_DEDUCTION_FAILED_ERROR=1109]="TRANSACTION_FEE_DEDUCTION_FAILED_ERROR",e[e.COMPUTATION_LIMIT_EXCEEDED_ERROR=1110]="COMPUTATION_LIMIT_EXCEEDED_ERROR",e[e.MEMORY_LIMIT_EXCEEDED_ERROR=1111]="MEMORY_LIMIT_EXCEEDED_ERROR",e[e.COULD_NOT_DECODE_EXECUTION_PARAMETER_FROM_STATE=1112]="COULD_NOT_DECODE_EXECUTION_PARAMETER_FROM_STATE",e[e.SCRIPT_EXECUTION_TIMED_OUT_ERROR=1113]="SCRIPT_EXECUTION_TIMED_OUT_ERROR",e[e.SCRIPT_EXECUTION_CANCELLED_ERROR=1114]="SCRIPT_EXECUTION_CANCELLED_ERROR",e[e.EVENT_ENCODING_ERROR=1115]="EVENT_ENCODING_ERROR",e[e.INVALID_INTERNAL_STATE_ACCESS_ERROR=1116]="INVALID_INTERNAL_STATE_ACCESS_ERROR",e[e.INSUFFICIENT_PAYER_BALANCE=1118]="INSUFFICIENT_PAYER_BALANCE",e[e.ACCOUNT_ERROR=1200]="ACCOUNT_ERROR",e[e.ACCOUNT_NOT_FOUND_ERROR=1201]="ACCOUNT_NOT_FOUND_ERROR",e[e.ACCOUNT_PUBLIC_KEY_NOT_FOUND_ERROR=1202]="ACCOUNT_PUBLIC_KEY_NOT_FOUND_ERROR",e[e.ACCOUNT_ALREADY_EXISTS_ERROR=1203]="ACCOUNT_ALREADY_EXISTS_ERROR",e[e.FROZEN_ACCOUNT_ERROR=1204]="FROZEN_ACCOUNT_ERROR",e[e.ACCOUNT_STORAGE_NOT_INITIALIZED_ERROR=1205]="ACCOUNT_STORAGE_NOT_INITIALIZED_ERROR",e[e.ACCOUNT_PUBLIC_KEY_LIMIT_ERROR=1206]="ACCOUNT_PUBLIC_KEY_LIMIT_ERROR",e[e.CONTRACT_ERROR=1250]="CONTRACT_ERROR",e[e.CONTRACT_NOT_FOUND_ERROR=1251]="CONTRACT_NOT_FOUND_ERROR",e[e.CONTRACT_NAMES_NOT_FOUND_ERROR=1252]="CONTRACT_NAMES_NOT_FOUND_ERROR",e[e.EVM_EXECUTION_ERROR=1300]="EVM_EXECUTION_ERROR",e}({}),Zt=function(e){return e.BLOCKS="blocks",e.BLOCK_HEADERS="block_headers",e.BLOCK_DIGESTS="block_digests",e.ACCOUNT_STATUSES="account_statuses",e.TRANSACTION_STATUSES="transaction_statuses",e.EVENTS="events",e}({}),Xt=function(e){return e[e.UNKNOWN=0]="UNKNOWN",e[e.PENDING=1]="PENDING",e[e.FINALIZED=2]="FINALIZED",e[e.EXECUTED=3]="EXECUTED",e[e.SEALED=4]="SEALED",e[e.EXPIRED=5]="EXPIRED",e}({});const Qt=()=>{const e=[];let t;return{async deliver(n){e.push(n),t&&(t(e.shift()),t=void 0)},receive:()=>new Promise((function(n){const r=e.shift();if(r)return n(r);t=n}))}};let Jt;const $t="INIT",en="SUBSCRIBE",tn="UNSUBSCRIBE",nn="UPDATED",rn="SNAPSHOT",on="EXIT",sn="TERMINATE",an="object"===typeof self&&self.self===self&&self||"object"===typeof n.g&&n.g.global===n.g&&n.g||"object"===typeof window&&window.window===window&&window||{FCL_REGISTRY:null};an.FCL_REGISTRY=null==an.FCL_REGISTRY?{}:an.FCL_REGISTRY;const cn=an.FCL_REGISTRY;let ln=0;const un=5e3;function dn(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{expectReply:!1};return new Promise(((i,o)=>{const s=r.expectReply||!1,a=null!=r.timeout?r.timeout:un;s&&a&&setTimeout((()=>o(new Error("Timeout: ".concat(a,"ms passed without a response.")))),a);const c={to:e,from:r.from,tag:t,data:n,timeout:a,reply:i,reject:o};try{cn[e]&&cn[e].mailbox.deliver(c),s||i(!0)}catch(l){console.error("FCL.Actor -- Could Not Deliver Message",c,cn[e],l),o(l)}}))}const fn=function(e){const t=(e=>{if(null==e){for(;cn[String(ln)];)ln++;return String(ln)}return String(e)})(arguments.length>1&&void 0!==arguments[1]?arguments[1]:null);if(null!=cn[t])return t;cn[t]={addr:t,mailbox:Qt(),subs:new Set,kvs:{},error:null};const n=hn(t);let r;var i,o;return"object"===typeof e?(i=e,r=async e=>{"function"===typeof i[$t]&&await i[$t](e);e:for(;;){const r=await e.receive();try{var t;if(r.tag===on){"function"===typeof i[sn]&&await i[sn](e,r,r.data||{});break e}await(null===(t=i[r.tag])||void 0===t?void 0:t.call(i,e,r,r.data||{}))}catch(n){console.error("".concat(e.self()," Error"),r,n)}finally{continue e}}}):r=e,o=async()=>{await r(n),(e=>{delete cn[e]})(t)},(Jt||(Jt=Promise.resolve())).then(o).catch((e=>setTimeout((()=>{throw e}),0))),t},hn=e=>({self:()=>e,receive:()=>cn[e].mailbox.receive(),send:function(t,n,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(null!=t)return i.from=e,dn(t,n,r,i)},sendSelf:function(t,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};cn[e]&&dn(e,t,n,r)},broadcast:function(t,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};r.from=e;for(const i of cn[e].subs)dn(i,t,n,r)},subscribe:t=>null!=t&&cn[e].subs.add(t),unsubscribe:t=>null!=t&&cn[e].subs.delete(t),subscriberCount:()=>cn[e].subs.size,hasSubs:()=>!!cn[e].subs.size,put:(t,n)=>{null!=t&&(cn[e].kvs[t]=n)},get:function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;const r=cn[e].kvs[t];return null==r?n:r},delete:t=>{delete cn[e].kvs[t]},update:(t,n)=>{null!=t&&(cn[e].kvs[t]=n(cn[e].kvs[t]))},keys:()=>Object.keys(cn[e].kvs),all:()=>cn[e].kvs,where:t=>Object.keys(cn[e].kvs).reduce(((n,r)=>t.test(r)?{...n,[r]:cn[e].kvs[r]}:n),{}),merge:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Object.keys(t).forEach((n=>cn[e].kvs[n]=t[n]))},fatalError:t=>{cn[e].error=t;for(const n of cn[e].subs)dn(n,nn)}});function pn(e,t,n){t(e);const r=fn((async t=>{for(t.send(e,en);;){const r=await t.receive(),i=cn[e].error;if(r.tag===on)return void t.send(e,tn);if(i)return n(null,i),void t.send(e,tn);n(r.data,null)}}));return()=>dn(r,on)}function gn(e,t){return t(e),dn(e,rn,null,{expectReply:!0,timeout:0})}const yn=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return e=>t.reduce(((e,t)=>t(e)),e)},mn=e=>e&&"object"===typeof e&&!Array.isArray(e),vn=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if(!n.length)return e;const i=n.shift();if(mn(e)&&mn(i))for(const o in i)mn(i[o])?(e[o]||Object.assign(e,{[o]:{}}),vn(e[o],i[o])):Object.assign(e,{[o]:i[o]});return vn(e,...n)},bn=e=>e.contracts?e.contracts:{},wn=e=>e.dependencies?e.dependencies:{},En=e=>Object.entries(e).reduce(((e,t)=>{let[n,r]=t;return null!==r&&void 0!==r&&r.canonical&&(e["".concat(n,".canonical")]=r.canonical),e}),{}),_n=e=>Object.entries(e).reduce(((e,t)=>{let[n,r]=t;return null!==r&&void 0!==r&&r.canonical&&(e["".concat(n,".canonical")]=r.canonical),e}),{}),Sn=(e,t)=>{var n;const r=(i=e,Array.isArray(i)?vn({},...i):i);var i;const o=null===(n=r.networks)||void 0===n?void 0:n[t],s=o&&"object"===typeof o&&"fork"in o?o.fork:void 0;return function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return e=>t.reduce(((t,n)=>({...t,...n(e)})),{})}((e=>t=>{let{deployments:n={},accounts:r={}}=t;const i=null===n||void 0===n?void 0:n[e];return i?Object.entries(i).reduce(((e,t)=>{var n;let[i,o]=t;const s=null===(n=r[i])||void 0===n?void 0:n.address;return s?o.reduce(((e,t)=>({...e,[t]:s})),e):e}),{}):{}})(t),yn(bn,((e,t)=>n=>Object.entries(n).reduce(((n,r)=>{var i,o;let[s,a]=r;const c=(null===a||void 0===a||null===(i=a.aliases)||void 0===i?void 0:i[e])||t&&(null===a||void 0===a||null===(o=a.aliases)||void 0===o?void 0:o[t]);return c&&(n[s]=c),n}),{}))(t,s)),yn(wn,((e,t)=>n=>Object.entries(n).reduce(((n,r)=>{var i,o;let[s,a]=r;const c=(null===a||void 0===a||null===(i=a.aliases)||void 0===i?void 0:i[e])||t&&(null===a||void 0===a||null===(o=a.aliases)||void 0===o?void 0:o[t]);return c&&(n[s]=c),n}),{}))(t,s)),yn(bn,En),yn(wn,_n))(r)},xn=e=>{var t;return Object.entries(null!==(t=null===e||void 0===e?void 0:e.accounts)&&void 0!==t?t:[]).reduce(((e,t)=>{let[,n]=t;return!!e||n&&Object.prototype.hasOwnProperty.call(n,"key")&&(e=>"string"===typeof e&&/^[0-9A-Fa-f]+$/.test(e))(null===n||void 0===n?void 0:n.key)}),!1)},In=e=>Array.isArray(e)?e.some(xn):xn(e),On=e=>"local"===(null===e||void 0===e?void 0:e.toLowerCase())?"emulator":null===e||void 0===e?void 0:e.toLowerCase();Nt=Yn;const An="config",Tn="PUT_CONFIG",Rn="GET_CONFIG",kn="GET_ALL_CONFIG",Pn="UPDATE_CONFIG",Cn="DELETE_CONFIG",Nn="CLEAR_CONFIG",Un="WHERE_CONFIG",Bn="CONFIG/UPDATED",Ln=e=>e,Dn={[Tn]:(e,t,n)=>{let{key:r,value:i}=n;if(null==r)throw new Error("Missing 'key' for config/put.");e.put(r,i),e.broadcast(Bn,{...e.all()})},[Rn]:(e,t,n)=>{let{key:r,fallback:i}=n;if(null==r)throw new Error("Missing 'key' for config/get");t.reply(e.get(r,i))},[kn]:(e,t)=>{t.reply({...e.all()})},[Pn]:(e,t,n)=>{let{key:r,fn:i}=n;if(null==r)throw new Error("Missing 'key' for config/update");e.update(r,i||Ln),e.broadcast(Bn,{...e.all()})},[Cn]:(e,t,n)=>{let{key:r}=n;if(null==r)throw new Error("Missing 'key' for config/delete");e.delete(r),e.broadcast(Bn,{...e.all()})},[Nn]:e=>{const t=Object.keys(e.all());for(const n of t)e.delete(n);e.broadcast(Bn,{...e.all()})},[Un]:(e,t,n)=>{let{pattern:r}=n;if(null==r)throw new Error("Missing 'pattern' for config/where");t.reply(e.where(r))},[en]:(e,t)=>{e.subscribe(t.from),e.send(t.from,Bn,{...e.all()})},[tn]:(e,t)=>{e.unsubscribe(t.from)}};function jn(e,t){return dn(An,Tn,{key:e,value:t}),Yn()}function Mn(e,t){return dn(An,Rn,{key:e,fallback:t},{expectReply:!0,timeout:10})}async function Fn(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0;if(!e.length)return t;const[n,...r]=e,i=await Mn(n);return null==i?Fn(r,t):i}function zn(){return dn(An,kn,null,{expectReply:!0,timeout:10})}function qn(e){return dn(An,Pn,{key:e,fn:arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ln}),Yn()}function Hn(e){return dn(An,Cn,{key:e}),Yn()}function Vn(e){return dn(An,Un,{pattern:e},{expectReply:!0,timeout:10})}function Kn(e){return pn(An,(()=>fn(Dn,An)),e)}async function Wn(e){return async function(){await dn(An,Nn)}().then((()=>Yn(e)))}async function Gn(e){let{ignoreConflicts:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=await Mn("flow.network"),r=On(n),{flowJSON:i}=e;if(Lt(Boolean(i),"config.load -- 'flowJSON' must be defined"),Lt(!!r,'Flow Network Required -- In order for FCL to load your contracts please define "flow.network" to "emulator", "local", "testnet", or "mainnet" in your config. See more here: https://developers.flow.com/tools/fcl-js/reference/configure-fcl'),In(i)){const e="emulator"===r;Bt({title:"Private Keys Detected",message:"Private keys should be stored in a separate flow.json file for security. See more here: https://developers.flow.com/tools/flow-cli/security",level:e?Ut.warn:Ut.error}),Lt(e,"Private keys should be stored in a separate flow.json file for security. See more here: https://developers.flow.com/tools/flow-cli/security")}for(const[o,s]of Object.entries(Sn(i,r))){const e="0x".concat(o),n=await Mn(e);n&&n!==s&&!t?Bt({title:"Contract Placeholder Conflict Detected",message:"A generated contract placeholder from config.load conflicts with a placeholder you've set manually in config have the same name.",level:Ut.warn}):jn(e,s);const r="system.contracts.".concat(o),i=await Mn(r);i&&i!==s&&!t?Bt({title:"Contract Placeholder Conflict Detected",message:"A generated contract placeholder from config.load conflicts with a placeholder you've set manually in config have the same name.",level:Ut.warn}):jn(r,s)}}function Yn(e){return null!=e&&"object"===typeof e&&Object.keys(e).map((t=>jn(t,e[t]))),{put:jn,get:Mn,all:zn,first:Fn,update:qn,delete:Hn,where:Vn,subscribe:Kn,overload:Zn,load:Gn}}async function Zn(e,t){const n=await zn();try{Yn(e);return await t(await zn())}finally{await Wn(n)}}fn(Dn,An),Yn.put=jn,Yn.get=Mn,Yn.all=zn,Yn.first=Fn,Yn.update=qn,Yn.delete=Hn,Yn.where=Vn,Yn.subscribe=Kn,Yn.overload=Zn,Yn.load=Gn;var Xn=n(5701);function Qn(e){if(Array.isArray(e)){const t=[];for(let r=0;r<e.length;r++)t.push(Qn(e[r]));const n=Xn.Buffer.concat(t);return Xn.Buffer.concat([Jn(n.length,192),n])}{const t=tr(e);return 1===t.length&&t[0]<128?t:Xn.Buffer.concat([Jn(t.length,128),t])}}function Jn(e,t){if(e<56)return Xn.Buffer.from([e+t]);{const n=er(e),r=er(t+55+n.length/2);return Xn.Buffer.from(r+n,"hex")}}function $n(e){return"0x"===e.slice(0,2)}function er(e){if(e<0)throw new Error("Invalid integer as argument, must be unsigned!");const t=e.toString(16);return t.length%2?"0"+t:t}function tr(e){if(!Xn.Buffer.isBuffer(e)){if("string"===typeof e)return $n(e)?Xn.Buffer.from(function(e){return e.length%2?"0"+e:e}(function(e){return"string"!==typeof e?e:$n(e)?e.slice(2):e}(e)),"hex"):Xn.Buffer.from(e);if("number"===typeof e)return e?function(e){const t=er(e);return Xn.Buffer.from(t,"hex")}(e):Xn.Buffer.from([]);if(null===e||void 0===e)return Xn.Buffer.from([]);if(e instanceof Uint8Array)return Xn.Buffer.from(e);throw new Error("invalid type")}return e}function nr(e){return null==e?null:e.replace(/^0x/,"").replace(/^Fx/,"")}function rr(e){return null==e?null:"0x"+nr(e)}var ir=n(6973),or=n.n(ir);function sr(e){return sr="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},sr(e)}function ar(e){var t=function(e,t){if("object"!=sr(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=sr(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==sr(t)?t:t+""}function cr(e,t,n){return(t=ar(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var lr=n(2590),ur=n.n(lr),dr=null;"undefined"!==typeof WebSocket?dr=WebSocket:"undefined"!==typeof MozWebSocket?dr=MozWebSocket:"undefined"!==typeof n.g?dr=n.g.WebSocket||n.g.MozWebSocket:"undefined"!==typeof window?dr=window.WebSocket||window.MozWebSocket:"undefined"!==typeof self&&(dr=self.WebSocket||self.MozWebSocket);const fr=dr;function hr(e){try{return JSON.parse(e)}catch{return null}}function pr(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}const gr=globalThis.AbortController||n(9118);class yr extends Error{constructor(e){let{error:t,hostname:n,path:r,method:i,requestBody:o,responseBody:s,responseStatusText:a,statusCode:c}=e;super("\n HTTP Request Error: An error occurred when interacting with the Access API.\n ".concat(t?"error=".concat(t):"","\n ").concat(n?"hostname=".concat(n):"","\n ").concat(r?"path=".concat(r):"","\n ").concat(i?"method=".concat(i):"","\n ").concat(o?"requestBody=".concat(o):"","\n ").concat(s?"responseBody=".concat(s):"","\n ").concat(a?"responseStatusText=".concat(a):"","\n ").concat(c?"statusCode=".concat(c):"","\n ")),this.name="HTTP Request Error",this.statusCode=c,this.errorMessage=t}}async function mr(e){let{hostname:t,path:n,method:r,body:i,headers:o,retryLimit:s=5,retryIntervalMs:a=1e3,timeoutLimit:c=3e4,enableRequestLogging:l=!0}=e;const u=i?JSON.stringify(i):null;return await async function e(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;try{const e=await function(){const e=new gr,i=setTimeout((()=>{e.abort()}),c);return ur()(pr(t,n).toString(),{method:r,body:u,headers:o,signal:e.signal}).then((async e=>{if(e.ok)return e.json();const i=await e.text().catch((()=>null)),o=hr(i);throw new yr({error:null===o||void 0===o?void 0:o.message,hostname:t,path:n,method:r,requestBody:u,responseBody:i,responseStatusText:e.statusText,statusCode:e.status})})).catch((async e=>{if(e instanceof yr)throw e;if("AbortError"===e.name)throw e;throw l&&await Bt({title:"Access Node Error",message:"The provided access node ".concat(t," does not appear to be a valid REST/HTTP access node.\n Please verify that you are not unintentionally using a GRPC access node.\n See more here: https://docs.onflow.org/fcl/reference/sdk-guidelines/#connect"),level:Ut.error}),new yr({error:null===e||void 0===e?void 0:e.message,hostname:t,path:n,method:r,requestBody:u})})).finally((()=>{clearTimeout(i)}))}();return e}catch(d){const t=[408,429,500,502,503,504];if("AbortError"===d.name||t.includes(d.statusCode))return await new Promise(((t,n)=>{i<s?(l&&console.warn("Access node unavailable, retrying in ".concat(a," ms...")),setTimeout((()=>{t(e(i+1))}),a)):n(d)}));throw d}}()}function vr(e,t,n){let r=t.response();return r.tag=e.tag,r.encodedData=JSON.parse(t.Buffer.from(n,"base64").toString()),r}async function br(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Lt(n.node,"SDK Send Execute Script Error: opts.node must be defined."),Lt(t.response,"SDK Send Execute Script Error: context.response must be defined."),Lt(t.Buffer,"SDK Send Execute Script Error: context.Buffer must be defined."),(e=await e).block.id?await async function(e,t,n){const r=n.httpRequest||mr,i=await r({hostname:n.node,path:"/v1/scripts?block_id=".concat(e.block.id),method:"POST",body:{script:t.Buffer.from(e.message.cadence).toString("base64"),arguments:e.message.arguments.map((n=>t.Buffer.from(JSON.stringify(e.arguments[n].asArgument)).toString("base64")))}});return vr(e,t,i)}(e,t,n):e.block.height?await async function(e,t,n){const r=n.httpRequest||mr,i=await r({hostname:n.node,path:"/v1/scripts?block_height=".concat(e.block.height),method:"POST",body:{script:t.Buffer.from(e.message.cadence).toString("base64"),arguments:e.message.arguments.map((n=>t.Buffer.from(JSON.stringify(e.arguments[n].asArgument)).toString("base64")))}});return vr(e,t,i)}(e,t,n):await async function(e,t,n){const r=n.httpRequest||mr,i=await r({hostname:n.node,path:"/v1/scripts?block_height=".concat(e.block.isSealed?"sealed":"final"),method:"POST",body:{script:t.Buffer.from(e.message.cadence).toString("base64"),arguments:e.message.arguments.map((n=>t.Buffer.from(JSON.stringify(e.arguments[n].asArgument)).toString("base64")))}});return vr(e,t,i)}(e,t,n)}const wr={SHA2_256:1,SHA2_384:2,SHA3_256:3,SHA3_384:4,KMAC128_BLS_BLS12_381:5},Er={ECDSA_P256:1,ECDSA_secp256k1:2,BLS_BLS12_381:3};function _r(e,t,n){var r,i;let o=t.response();o.tag=e.tag;return o.account={address:n.address,balance:Number(n.balance),code:"",contracts:(e=>{const n={};if(!e)return n;for(let r of Object.keys(e))n[r]=t.Buffer.from(e[r],"base64").toString();return n})(n.contracts),keys:null!==(r=null===(i=n.keys)||void 0===i?void 0:i.map((e=>({index:Number(e.index),publicKey:e.public_key.replace(/^0x/,""),signAlgo:Er[e.signing_algorithm],signAlgoString:e.signing_algorithm,hashAlgo:wr[e.hashing_algorithm],hashAlgoString:e.hashing_algorithm,sequenceNumber:Number(e.sequence_number),weight:Number(e.weight),revoked:e.revoked}))))&&void 0!==r?r:[]},o}async function Sr(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Lt(n.node,"SDK Send Get Account Error: opts.node must be defined."),Lt(t.response,"SDK Send Get Account Error: context.response must be defined."),Lt(t.Buffer,"SDK Send Get Account Error: context.Buffer must be defined."),null!==(e=await e).block.height?await async function(e,t,n){const r=n.httpRequest||mr;return _r(e,t,await r({hostname:n.node,path:"/v1/accounts/".concat(e.account.addr,"?block_height=").concat(e.block.height,"&expand=contracts,keys"),method:"GET",body:null}))}(e,t,n):await async function(e,t,n){const r=n.httpRequest||mr;return _r(e,t,await r({hostname:n.node,path:"/v1/accounts/".concat(e.account.addr,"?block_height=").concat(e.block.isSealed?"sealed":"final","&expand=contracts,keys"),method:"GET",body:null}))}(e,t,n)}function xr(e,t,n){const r=n.length?n[0]:null,i=t.response();return i.tag=e.tag,i.blockHeader={id:r.header.id,parentId:r.header.parent_id,height:Number(r.header.height),timestamp:r.header.timestamp},i}async function Ir(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Lt(n.node,"SDK Send Get Block Header Error: opts.node must be defined."),Lt(t.response,"SDK Send Get Block Header Error: context.response must be defined.");const r=null!==(e=await e).block.id,i=null!==e.block.height;return r?await async function(e,t,n){const r=n.httpRequest||mr;return xr(e,t,await r({hostname:n.node,path:"/v1/blocks/".concat(e.block.id),method:"GET",body:null}))}(e,t,n):i?await async function(e,t,n){const r=n.httpRequest||mr;return xr(e,t,await r({hostname:n.node,path:"/v1/blocks?height=".concat(e.block.height),method:"GET",body:null}))}(e,t,n):await async function(e,t,n){var r;const i=n.httpRequest||mr,o=null!==(r=e.block)&&void 0!==r&&r.isSealed?"sealed":"final";return xr(e,t,await i({hostname:n.node,path:"/v1/blocks?height=".concat(o),method:"GET",body:null}))}(e,t,n)}function Or(e,t,n){const r=n.length?n[0]:null,i=t.response();return i.tag=e.tag,i.block={id:r.header.id,parentId:r.header.parent_id,height:Number(r.header.height),timestamp:r.header.timestamp,parentVoterSignature:r.header.parent_voter_signature,collectionGuarantees:r.payload.collection_guarantees.map((e=>({collectionId:e.collection_id,signerIds:e.signer_ids}))),blockSeals:r.payload.block_seals.map((e=>({blockId:e.block_id,executionReceiptId:e.result_id})))},i}async function Ar(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Lt(n.node,"SDK Send Get Block Error: opts.node must be defined."),Lt(t.response,"SDK Send Get Block Error: context.response must be defined.");const r=null!==(e=await e).block.id,i=null!==e.block.height;return r?await async function(e,t,n){const r=n.httpRequest||mr;return Or(e,t,await r({hostname:n.node,path:"/v1/blocks/".concat(e.block.id,"?expand=payload"),method:"GET",body:null}))}(e,t,n):i?await async function(e,t,n){const r=n.httpRequest||mr;return Or(e,t,await r({hostname:n.node,path:"/v1/blocks?height=".concat(e.block.height,"&expand=payload"),method:"GET",body:null}))}(e,t,n):await async function(e,t,n){var r;const i=n.httpRequest||mr,o=null!==(r=e.block)&&void 0!==r&&r.isSealed?"sealed":"final";return Or(e,t,await i({hostname:n.node,path:"/v1/blocks?height=".concat(o,"&expand=payload"),method:"GET",body:null}))}(e,t,n)}function Tr(e,t,n){let r=t.response();return r.tag=e.tag,r.events=[],n.forEach((e=>e.events?e.events.forEach((n=>r.events.push({blockId:e.block_id,blockHeight:Number(e.block_height),blockTimestamp:e.block_timestamp,type:n.type,transactionId:n.transaction_id,transactionIndex:Number(n.transaction_index),eventIndex:Number(n.event_index),payload:JSON.parse(t.Buffer.from(n.payload,"base64").toString())}))):null)),r}async function Rr(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Lt(n.node,"SDK Send Get Events Error: opts.node must be defined."),Lt(t.response,"SDK Send Get Events Error: context.response must be defined."),Lt(t.Buffer,"SDK Send Get Events Error: context.Buffer must be defined.");const r=null!==(e=await e).events.start,i=Array.isArray(e.events.blockIds)&&e.events.blockIds.length>0;return Lt(r||i,"SendGetEventsError: Unable to determine which get events request to send. Either a block height range, or block IDs must be specified."),r?await async function(e,t,n){const r=n.httpRequest||mr;return Tr(e,t,await r({hostname:n.node,path:"/v1/events?type=".concat(e.events.eventType,"&start_height=").concat(e.events.start,"&end_height=").concat(e.events.end),method:"GET",body:null}))}(e,t,n):await async function(e,t,n){const r=n.httpRequest||mr,i=await r({hostname:n.node,path:"/v1/events?type=".concat(e.events.eventType,"&block_ids=").concat(e.events.blockIds.join(",")),method:"GET",body:null});return Tr(e,t,i)}(e,t,n)}const kr={UNKNOWN:0,PENDING:1,FINALIZED:2,EXECUTED:3,SEALED:4,EXPIRED:5};const Pr=e=>"".concat(withPrefix(e.addr),"-").concat(e.keyId);const Cr=fr;class Nr extends Error{constructor(e){let{code:t,reason:n,message:r,wasClean:i}=e;super("\n connectWs: connection closed with error".concat(r?": ".concat(r):"","\n ").concat(t?"code: ".concat(t):"","\n ").concat(n?"reason: ".concat(n):"","\n ").concat(i?"wasClean: ".concat(i):"","\n ")),this.name="WebsocketError",this.code=t,this.reason=n,this.wasClean=!1}}function Ur(e){let{hostname:t,path:n,params:r,getParams:i,retryLimit:o=5,retryIntervalMs:s=1e3}=e;if(i&&r)throw new Error("connectWs: cannot specify both params and getParams");let a=new ir.EventEmitter,c=0;const l=i||(()=>r);let u=()=>{};return function e(){let r=!1,i=!1;const d=function(e,t,n){const r=new URL(t||"",e);"https:"===r.protocol?r.protocol="wss:":"http:"===r.protocol&&(r.protocol="ws:");return Object.entries(n||{}).forEach((e=>{let[t,n]=e;if(n){let e;e=Array.isArray(n)?n.join(","):n.toString(),r.searchParams.append(t,e)}})),r.toString()}(t,n,l()),f=new Cr(d);f.onmessage=function(e){const t=hr(e.data);t?a.emit("data",t):(a.emit("error",new Nr({message:"invalid JSON data"})),this.close())},f.onclose=function(t){if(r)return a.emit("close"),void a.removeAllListeners();i?setTimeout(e,s):c<o?(c++,setTimeout(e,s)):(a.emit("error",new Nr({wasClean:t.wasClean,code:t.code,reason:t.reason,message:"failed to connect"})),setTimeout((()=>{a.emit("close"),a.removeAllListeners()})))},f.onopen=function(){i=!0,c=0},u=()=>{r=!0,f.close()}}(),{on(e,t){return a.on(e,t),this},off(e,t){return a.off(e,t),this},close(){u()}}}async function Br(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Lt(n.node,"SDK Send Get Events Error: opts.node must be defined."),Lt(t.response,"SDK Send Get Events Error: context.response must be defined."),Lt(t.Buffer,"SDK Send Get Events Error: context.Buffer must be defined.");const r=await e,i=n.connectWs||Ur,o=new ir.EventEmitter;let s=null;const a=i({hostname:n.node,path:"/v1/subscribe_events",getParams:()=>{var e,t,n,i;const o={event_types:null===(e=r.subscribeEvents)||void 0===e?void 0:e.eventTypes,addresses:null===(t=r.subscribeEvents)||void 0===t?void 0:t.addresses,contracts:null===(n=r.subscribeEvents)||void 0===n?void 0:n.contracts,heartbeat_interval:null===(i=r.subscribeEvents)||void 0===i?void 0:i.heartbeatInterval};var a,c;s?o.start_height=s+1:(o.start_block_id=null===(a=r.subscribeEvents)||void 0===a?void 0:a.startBlockId,o.start_height=null===(c=r.subscribeEvents)||void 0===c?void 0:c.startHeight);return o}});a.on("data",(e=>{const n=function(e,t,n){var r;const i=t.response();return i.tag=e.tag,i.events=(null===(r=n.Events)||void 0===r?void 0:r.length)>0?n.Events.map((e=>({blockId:n.BlockID,blockHeight:Number(n.Height),blockTimestamp:n.BlockTimestamp,type:e.Type,transactionId:e.TransactionID,transactionIndex:Number(e.TransactionIndex),eventIndex:Number(e.EventIndex),payload:JSON.parse(t.Buffer.from(e.Payload,"base64").toString())}))):null,i.heartbeat={blockId:n.BlockID,blockHeight:Number(n.Height),blockTimestamp:n.BlockTimestamp},i}(r,t,e);s=n.heartbeat.blockHeight,o.emit("data",n)})),a.on("error",(e=>{o.emit("error",e)})),a.on("close",(()=>{o.emit("close")}));return function(e,t,n){const r=t.response();return r.tag=e.tag,r.streamConnection=n,r}(r,t,{on(e,t){return o.on(e,t),this},off(e,t){return o.off(e,t),this},close(){a.close()}})}let Lr=function(e){return e.LIST_SUBSCRIPTIONS="list_subscriptions",e.SUBSCRIBE="subscribe",e.UNSUBSCRIBE="unsubscribe",e}({});class Dr extends Error{constructor(e,t){super(t),this.name="SocketError",this.code=e}static fromMessage(e){return new Dr(e.code,e.message)}}class jr{constructor(e,t){cr(this,"counter",0),cr(this,"socket",null),cr(this,"subscriptions",[]),cr(this,"reconnectAttempts",0),cr(this,"connectPromise",null),cr(this,"closeConnection",null),this.config={...t,reconnectOptions:{initialReconnectDelay:500,reconnectAttempts:5,maxReconnectDelay:5e3,...t.reconnectOptions}},this.handlers=e}subscribe(e){const t=this._subscribe(e);return{unsubscribe:()=>{t.then((e=>e&&this.unsubscribe(e)))}}}async _subscribe(e){const t=this.getHandler(e.topic).createSubscriber(e.args,e.onData,e.onError);let n=null;try{await this.connect(),n={id:String(this.counter++),topic:e.topic,subscriber:t},this.subscriptions.push(n);const r=await this.sendSubscribe(n);if(r.error)throw new Error("Failed to subscribe to topic ".concat(n.topic),{cause:Dr.fromMessage(r.error)})}catch(Mz){return t.onError(Mz instanceof Error?Mz:new Error(String(Mz))),n&&this.unsubscribe(n.id),null}return n.id}unsubscribe(e){const t=this.subscriptions.find((t=>t.id===e));var n;t&&(this.subscriptions=this.subscriptions.filter((t=>t.id!==e)),0!==this.subscriptions.length?this.sendUnsubscribe(t).catch((e=>{console.error("Error while unsubscribing from topic: ".concat(e))})):null===(n=this.closeConnection)||void 0===n||n.call(this))}async connect(){return this.connectPromise||(this.connectPromise=new Promise(((e,t)=>{var n;if(1===(null===(n=this.socket)||void 0===n?void 0:n.readyState))return void e();this.socket=new Cr(this.config.node);const r=e=>{const t=JSON.parse(e.data);if("action"in t&&t.error){const e=this.subscriptions.find((e=>e.id===t.subscription_id));return void(e&&(e.subscriber.onError(new Error("Failed to subscribe to topic ".concat(e.topic,": ").concat(t.error.message))),this.subscriptions=this.subscriptions.filter((e=>e.id!==t.subscription_id))))}const n=this.subscriptions.find((e=>e.id===t.subscription_id));n&&("action"in t||t.subscription_id!==n.id||n.subscriber.onData(t.payload))},i=()=>{this.handleSocketError(new Error("WebSocket closed")).then((()=>{e()})).catch((e=>{t(e)}))},o=()=>{e()};this.socket.addEventListener("message",r),this.socket.addEventListener("close",i),this.socket.addEventListener("open",o),this.closeConnection=()=>{var e,t,n,s;null===(e=this.socket)||void 0===e||e.removeEventListener("message",r),null===(t=this.socket)||void 0===t||t.removeEventListener("close",i),null===(n=this.socket)||void 0===n||n.removeEventListener("open",o),null===(s=this.socket)||void 0===s||s.close(),this.socket=null,this.closeConnection=null,this.connectPromise=null}}))),this.connectPromise}async handleSocketError(e){var t;if(null===(t=this.closeConnection)||void 0===t||t.call(this),++this.reconnectAttempts>=this.config.reconnectOptions.reconnectAttempts)throw Bt({level:Ut.error,title:"WebSocket Error",message:"Failed to reconnect to the server after ".concat(this.reconnectAttempts+1," attempts: ").concat(e)}),this.subscriptions.forEach((t=>{t.subscriber.onError(new Error("Failed to reconnect to the server after ".concat(this.reconnectAttempts+1," attempts: ").concat(e)))})),this.subscriptions=[],this.reconnectAttempts=0,e;Bt({level:Ut.warn,title:"WebSocket Error",message:"WebSocket error, reconnecting in ".concat(this.backoffInterval,"ms: ").concat(e)}),await new Promise((e=>setTimeout(e,this.backoffInterval))),await this.connect(),await Promise.all(this.subscriptions.map((async e=>{await this.sendSubscribe(e).catch((t=>{e.subscriber.onError(new Error("Failed to restore subscription: ".concat(t))),this.subscriptions=this.subscriptions.filter((t=>t.id!==e.id))}))}))),this.reconnectAttempts=0}async sendSubscribe(e){const t={action:Lr.SUBSCRIBE,topic:e.topic,arguments:e.subscriber.getConnectionArgs(),subscription_id:String(e.id)},n=await this.request(t);if(n.error)throw new Error("Failed to subscribe to topic ".concat(e.topic),{cause:Dr.fromMessage(n.error)});return n}async sendUnsubscribe(e){var t;const n={action:Lr.UNSUBSCRIBE,subscription_id:e.id};null===(t=this.socket)||void 0===t||t.send(JSON.stringify(n));const r=await this.request(n);if(r.error)throw new Error("Failed to unsubscribe from topic ".concat(e.topic),{cause:Dr.fromMessage(r.error)});return r}async request(e){let t=()=>{};return await new Promise(((n,r)=>{function i(e){r(new Error("WebSocket error: ".concat(e)))}function o(){r(new Error("WebSocket closed"))}function s(t){const r=JSON.parse(t.data);r.subscription_id===e.subscription_id&&n(r)}this.socket?(t=()=>{var e,t,n;null===(e=this.socket)||void 0===e||e.removeEventListener("error",i),null===(t=this.socket)||void 0===t||t.removeEventListener("message",s),null===(n=this.socket)||void 0===n||n.removeEventListener("close",o)},this.socket.addEventListener("error",i),this.socket.addEventListener("message",s),this.socket.addEventListener("close",o),this.socket.send(JSON.stringify(e))):r(new Error("WebSocket is not connected"))})).finally((()=>{t()}))}getHandler(e){const t=this.handlers.find((t=>t.topic===e));if(!t)throw new Error("No handler found for topic ".concat(e));return t}get backoffInterval(){return Math.min(this.config.reconnectOptions.maxReconnectDelay,this.config.reconnectOptions.initialReconnectDelay*2**this.reconnectAttempts)}}const Mr={topic:Zt.BLOCKS,createSubscriber:(e,t,n)=>{let r={...e};return{onData(e){const n={block:{id:e.header.id,parentId:e.header.parent_id,height:Number(e.header.height),timestamp:e.header.timestamp,parentVoterSignature:e.header.parent_voter_signature,collectionGuarantees:e.payload.collection_guarantees.map((e=>({collectionId:e.collection_id,signerIds:e.signer_indices}))),blockSeals:e.payload.block_seals.map((e=>({blockId:e.block_id,executionReceiptId:e.result_id})))}};r={blockStatus:r.blockStatus,startBlockHeight:Number(BigInt(e.header.height)+BigInt(1))},t(n)},onError(e){n(e)},getConnectionArgs(){let e={block_status:r.blockStatus};return"startBlockHeight"in r&&r.startBlockHeight?{...e,start_block_height:String(r.startBlockHeight)}:"startBlockId"in r&&r.startBlockId?{...e,start_block_id:r.startBlockId}:e}}}},Fr={topic:Zt.BLOCK_HEADERS,createSubscriber:(e,t,n)=>{let r={...e};return{onData(e){const n={blockHeader:{id:e.id,parentId:e.parent_id,height:Number(e.height),timestamp:e.timestamp,parentVoterSignature:e.parent_voter_signature}};r={blockStatus:r.blockStatus,startBlockHeight:Number(BigInt(e.height)+BigInt(1))},t(n)},onError(e){n(e)},getConnectionArgs(){let e={block_status:r.blockStatus};return"startBlockHeight"in r&&r.startBlockHeight?{...e,start_block_height:r.startBlockHeight}:"startBlockId"in r&&r.startBlockId?{...e,start_block_id:r.startBlockId}:e}}}},zr={topic:Zt.BLOCK_DIGESTS,createSubscriber:(e,t,n)=>{let r={...e};return{onData(e){const n={blockDigest:{id:e.block_id,height:Number(e.height),timestamp:e.timestamp}};r={blockStatus:r.blockStatus,startBlockId:String(BigInt(e.height)+BigInt(1))},t(n)},onError(e){n(e)},getConnectionArgs(){let e={block_status:r.blockStatus};return"startBlockHeight"in r&&r.startBlockHeight?{...e,start_block_height:r.startBlockHeight}:"startBlockId"in r&&r.startBlockId?{...e,start_block_id:r.startBlockId}:e}}}},qr={topic:Zt.ACCOUNT_STATUSES,createSubscriber:(e,t,n)=>{let r={...e};return{onData(e){if(e.account_events){const n=[];for(const[t,r]of Object.entries(e.account_events))for(const i of r){const r={accountStatusEvent:{accountAddress:t,blockId:e.block_id,blockHeight:Number(e.height),type:i.type,transactionId:i.transaction_id,transactionIndex:Number(i.transaction_index),eventIndex:Number(i.event_index),payload:JSON.parse(Buffer.from(i.payload,"base64").toString())}};n.push(r)}n.sort(((e,t)=>{const n=e.accountStatusEvent.transactionIndex-t.accountStatusEvent.transactionIndex;return 0!==n?n:e.accountStatusEvent.eventIndex-t.accountStatusEvent.eventIndex}));for(const e of n)t(e)}r={...r,startBlockHeight:Number(BigInt(e.height)+BigInt(1)),startBlockId:void 0}},onError(e){n(e)},getConnectionArgs(){let e={event_types:r.eventTypes,addresses:r.addresses,account_addresses:r.accountAddresses};return"startBlockHeight"in r&&r.startBlockHeight?{...e,start_block_height:r.startBlockHeight}:"startBlockId"in r&&r.startBlockId?{...e,start_block_id:r.startBlockId}:e}}}},Hr={UNKNOWN:0,PENDING:1,FINALIZED:2,EXECUTED:3,SEALED:4,EXPIRED:5},Vr=[Mr,Fr,zr,qr,{topic:Zt.TRANSACTION_STATUSES,createSubscriber:(e,t,n)=>{let r={...e};return{onData(e){const n={transactionStatus:{blockId:e.transaction_result.block_id,status:Hr[e.transaction_result.status.toUpperCase()],statusString:e.transaction_result.status.toUpperCase(),statusCode:e.transaction_result.status_code,errorMessage:e.transaction_result.error_message,events:e.transaction_result.events.map((e=>({type:e.type,transactionId:e.transaction_id,transactionIndex:Number(e.transaction_index),eventIndex:Number(e.event_index),payload:JSON.parse(Xn.Buffer.from(e.payload,"base64").toString())})))}};t(n)},onError(e){n(e)},getConnectionArgs:()=>({tx_id:r.transactionId})}}},{topic:Zt.EVENTS,createSubscriber:(e,t,n)=>{let r={...e};return"startHeight"in r&&r.startHeight&&(r.startBlockHeight=r.startHeight,delete r.startHeight),{onData(e){if(e.events&&Array.isArray(e.events))for(const n of e.events){const r={event:{blockId:e.block_id,blockHeight:Number(e.block_height),blockTimestamp:e.block_timestamp,type:n.type,transactionId:n.transaction_id,transactionIndex:Number(n.transaction_index),eventIndex:Number(n.event_index),payload:JSON.parse(Buffer.from(n.payload,"base64").toString())}};t(r)}r={...r,startBlockHeight:Number(BigInt(e.block_height)+BigInt(1)),startBlockId:void 0}},onError(e){n(e)},getConnectionArgs(){let e={event_types:r.eventTypes,addresses:r.addresses,contracts:r.contracts};return"startBlockHeight"in r&&r.startBlockHeight?{...e,start_block_height:String(r.startBlockHeight)}:"startBlockId"in r&&r.startBlockId?{...e,start_block_id:String(r.startBlockId)}:e}}}}];let Kr=new Map;const Wr={send:async function(e,t){var n,r,i,o;let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};switch(Lt(Boolean(null===s||void 0===s?void 0:s.node),'SDK Send Error: Either opts.node or "accessNode.api" in config must be defined.'),Lt(Boolean(t.ix),"SDK Send Error: context.ix must be defined."),e=await e,!0){case t.ix.isTransaction(e):return s.sendTransaction?s.sendTransaction(e,t,s):async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Lt(n.node,"SDK Send Transaction Error: opts.node must be defined."),Lt(t.response,"SDK Send Transaction Error: context.response must be defined."),Lt(t.Buffer,"SDK Send Transaction Error: context.Buffer must be defined.");const r=n.httpRequest||mr;e=await e;let i=[];for(let d of Object.values(e.accounts))try{if(!d.role.payer&&null!=d.signature){const e={address:nr(d.addr),key_index:String(d.keyId),signature:t.Buffer.from(d.signature,"hex").toString("base64")};if(null!=d.extensionData){const n=t.Buffer.from(d.extensionData,"hex").toString("base64");null!=n&&(e.extension_data=n)}i.find((t=>t.address===e.address&&t.key_index===e.key_index&&t.signature===e.signature))||i.push(e)}}catch(u){throw console.error("SDK HTTP Send Error: Trouble applying payload signature",{acct:d,ix:e}),u}let o={};for(let d of Object.values(e.accounts))try{if(d.role.payer&&null!=d.signature){let e=d.tempId||Pr(d);if(o[e]=o[e]||{address:nr(d.addr),key_index:String(d.keyId),signature:t.Buffer.from(d.signature,"hex").toString("base64")},null!=d.extensionData){const n=t.Buffer.from(d.extensionData,"hex").toString("base64");null!=n&&(o[e].extension_data=n)}}}catch(u){throw console.error("SDK HTTP Send Error: Trouble applying envelope signature",{acct:d,ix:e}),u}o=Object.values(o);var s=Date.now();const a=await r({hostname:n.node,path:"/v1/transactions",method:"POST",body:{script:t.Buffer.from(e.message.cadence).toString("base64"),arguments:[...e.message.arguments.map((n=>t.Buffer.from(JSON.stringify(e.arguments[n].asArgument)).toString("base64")))],reference_block_id:e.message.refBlock?e.message.refBlock:null,gas_limit:String(e.message.computeLimit),payer:nr(e.accounts[Array.isArray(e.payer)?e.payer[0]:e.payer].addr),proposal_key:{address:nr(e.accounts[e.proposer].addr),key_index:String(e.accounts[e.proposer].keyId),sequence_number:String(e.accounts[e.proposer].sequenceNum)},authorizers:e.authorizations.map((t=>e.accounts[t].addr)).reduce(((e,t)=>e.find((e=>e===t))?e:[...e,t]),[]).map(nr),payload_signatures:i,envelope_signatures:o}});var c=Date.now();let l=t.response();return l.tag=e.tag,l.transactionId=a.id,"undefined"!==typeof window&&"undefined"!==typeof CustomEvent&&window.dispatchEvent(new CustomEvent("FLOW::TX",{detail:{txId:l.transactionId,delta:c-s}})),l}(e,t,s);case t.ix.isGetTransactionStatus(e):return s.sendGetTransactionStatus?s.sendGetTransactionStatus(e,t,s):async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Lt(n.node,"SDK Send Get Transaction Status Error: opts.node must be defined."),Lt(t.response,"SDK Send Get Transaction Status Error: context.response must be defined."),Lt(t.Buffer,"SDK Send Get Transaction Status Error: context.Buffer must be defined.");const r=n.httpRequest||mr,i=(e=await e)&&e.block&&e.block.id,o=i?"/v1/transaction_results/".concat(e.transaction.id,"?block_id=").concat(encodeURIComponent(i)):"/v1/transaction_results/".concat(e.transaction.id),s=await r({hostname:n.node,path:o,method:"GET",body:null});let a=t.response();return a.tag=e.tag,a.transactionStatus={blockId:s.block_id,status:kr[s.status.toUpperCase()]||"",statusString:s.status.toUpperCase(),statusCode:s.status_code,errorMessage:s.error_message,events:s.events.map((e=>({type:e.type,transactionId:e.transaction_id,transactionIndex:Number(e.transaction_index),eventIndex:Number(e.event_index),payload:JSON.parse(t.Buffer.from(e.payload,"base64").toString())})))},a}(e,t,s);case t.ix.isGetTransaction(e):return s.sendGetTransaction?s.sendGetTransaction(e,t,s):async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Lt(n.node,"SDK Send Get Transaction Error: opts.node must be defined."),Lt(t.response,"SDK Send Get Transaction Error: context.response must be defined."),Lt(t.Buffer,"SDK Send Get Transaction Error: context.Buffer must be defined.");const r=n.httpRequest||mr;e=await e;const i=await r({hostname:n.node,path:"/v1/transactions/".concat(e.transaction.id),method:"GET",body:null}),o=e=>({address:e.address,keyId:Number(e.key_index),signature:e.signature,...e.extension_data?{extensionData:t.Buffer.from(e.extension_data,"base64").toString("hex")}:{}});let s=t.response();var a;return s.tag=e.tag,s.transaction={script:t.Buffer.from(i.script,"base64").toString(),args:[...i.arguments.map((e=>JSON.parse(t.Buffer.from(e,"base64").toString())))],referenceBlockId:i.reference_block_id,gasLimit:Number(i.gas_limit),payer:i.payer,proposalKey:i.proposal_key?(a=i.proposal_key,{address:a.address,keyId:Number(a.key_index),sequenceNumber:Number(a.sequence_number)}):i.proposal_key,authorizers:i.authorizers,payloadSignatures:[...i.payload_signatures.map(o)],envelopeSignatures:[...i.envelope_signatures.map(o)]},s}(e,t,s);case t.ix.isScript(e):return s.sendExecuteScript?s.sendExecuteScript(e,t,s):br(e,t,s);case t.ix.isGetAccount(e):return s.sendGetAccount?s.sendGetAccount(e,t,s):Sr(e,t,s);case t.ix.isGetEvents(e):return s.sendGetEvents?s.sendGetEvents(e,t,s):Rr(e,t,s);case null===(n=(r=t.ix).isSubscribeEvents)||void 0===n?void 0:n.call(r,e):return s.connectSubscribeEvents?s.connectSubscribeEvents(e,t,s):Br(e,t,s);case t.ix.isGetBlock(e):return s.sendGetBlock?s.sendGetBlock(e,t,s):Ar(e,t,s);case t.ix.isGetBlockHeader(e):return s.sendGetBlockHeader?s.sendGetBlockHeader(e,t,s):Ir(e,t,s);case t.ix.isGetCollection(e):return s.sendGetCollection?s.sendGetCollection(e,t,s):async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Lt(n.node,"SDK Send Get Collection Error: opts.node must be defined."),Lt(t.response,"SDK Send Get Collection Error: context.response must be defined.");const r=n.httpRequest||mr,i=await r({hostname:n.node,path:"/v1/collections/".concat(e.collection.id,"?expand=transactions"),method:"GET",body:null}),o=t.response();return o.tag=e.tag,o.collection={id:i.id,transactionIds:i.transactions.map((e=>e.id))},o}(e,t,s);case t.ix.isPing(e):return s.sendPing?s.sendPing(e,t,s):async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Lt(Boolean(n.node),"SDK Send Ping Error: opts.node must be defined."),Lt(Boolean(t.response),"SDK Send Ping Error: context.response must be defined.");const r=n.httpRequest||mr;await r({hostname:n.node,path:"/v1/blocks?height=sealed",method:"GET",body:null});let i="function"===typeof(null===t||void 0===t?void 0:t.response)?t.response():{};return i.tag=e.tag,i}(e,t,s);case t.ix.isGetNetworkParameters(e):return s.sendGetNetworkParameters?s.sendGetNetworkParameters(e,t,s):async function(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Lt(r.node,"SDK Send Get Network Parameters Error: opts.node must be defined."),Lt(n.response,"SDK Send Get Network Parameters Error: context.response must be defined.");const i=r.httpRequest||mr;e=await e;const o=await i({hostname:r.node,path:"/v1/network/parameters",method:"GET",body:null,enableRequestLogging:null===(t=r.enableRequestLogging)||void 0===t||t});let s=n.response();return s.tag=e.tag,s.networkParameters={chainId:o.chain_id},s}(e,t,s);case null===(i=(o=t.ix).isGetNodeVersionInfo)||void 0===i?void 0:i.call(o,e):return s.sendGetNodeVersionInfo?s.sendGetNodeVersionInfo(e,t,s):async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Lt(n.node,"SDK Send Get Node Version Info Error: opts.node must be defined."),Lt(t.response,"SDK Send Get Node Verison Info Error: context.response must be defined.");const r=n.httpRequest||mr;e=await e;const i=await r({hostname:n.node,path:"/v1/node_version_info",method:"GET"});let o=t.response();return o.tag=e.tag,o.nodeVersionInfo={semver:i.semver,commit:i.commit,sporkId:i.spork_id,protocolVersion:parseInt(i.protocol_version),sporkRootBlockHeight:parseInt(i.spork_root_block_height),nodeRootBlockHeight:parseInt(i.node_root_block_height)},o}(e,t,s);default:return e}},subscribe:function(e,t){let{topic:n,args:r,onData:i,onError:o}=e;const s=function(e){const t=new URL(pr(e,"/v1/ws"));"https:"===t.protocol?t.protocol="wss:":"http:"===t.protocol&&(t.protocol="ws:");return t.toString()}(t.node),a=Kr.get(s)||new jr(Vr,{node:s});return Kr.set(s,a),a.subscribe({topic:n,args:r,onData:i,onError:o})}};var Gr=n(884);function Yr(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!e.length&&!t.length)return n;if(!e.length)return n;if(!t.length)return n.push(...e),n;const[r,...i]=e,[o,...s]=t;return void 0!==r&&n.push(r),void 0!==o&&n.push(o),Yr(i,s,n)}function Zr(e){return function(t){return"function"===typeof t?(Bt.deprecate({pkg:"FCL/SDK",subject:"Interopolation of functions into template literals",transition:"https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0001-deprecate-params"}),Zr(e)(t(e))):String(t)}}function Xr(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return"string"===typeof e?()=>e:"function"===typeof e?e:t=>Yr([...e],n.map(Zr(t))).join("").trim()}const Qr=(e,t,n)=>({label:e,asArgument:t,asInjection:t=>(Bt.deprecate({pkg:"@onflow/types",subject:"Passing in ".concat(e," as value for ").concat(e),message:"Going forward, use ".concat(e," as value for ").concat(e,".")}),n(t))}),Jr=e=>Array.isArray(e),$r=e=>"object"===typeof e,ei=e=>null==e,ti=e=>"number"===typeof e,ni=e=>Number.isInteger(e),ri=e=>"string"===typeof e,ii=e=>{throw new Error("Type Error: "+e)},oi=e=>{Bt.deprecate({pkg:"@onflow/types",subject:"Passing in Number as value for ".concat(e),message:"Going forward, use String as value for ".concat(e,"."),transition:"https://github.com/onflow/flow-js-sdk/blob/master/packages/types/WARNINGS.md#0002-[U]Int*-and-Word*-as-Number"})};let si=!1;const ai={label:"Identity",asArgument:e=>(si||(Bt.deprecate({pkg:"@onflow/types",subject:"Identity",message:"Identity type is deprecated and will be removed in v2.0.0. Please remove it from your code."}),si=!0),e),asInjection:e=>e},ci=Qr("UInt",(e=>ti(e)&&ni(e)?(oi("UInt"),{type:"UInt",value:e.toString()}):ri(e)?{type:"UInt",value:e}:ii("Expected Positive Integer for type Unsigned Int")),(e=>e)),li=Qr("Int",(e=>ti(e)&&ni(e)?(oi("Int"),{type:"Int",value:e.toString()}):ri(e)?{type:"Int",value:e}:ii("Expected Integer for type Int")),(e=>e)),ui=Qr("UInt8",(e=>ti(e)&&ni(e)?(oi("UInt8"),{type:"UInt8",value:e.toString()}):ri(e)?{type:"UInt8",value:e}:ii("Expected integer for UInt8")),(e=>e)),di=Qr("Int8",(e=>ti(e)&&ni(e)?(oi("Int8"),{type:"Int8",value:e.toString()}):ri(e)?{type:"Int8",value:e}:ii("Expected positive integer for Int8")),(e=>e)),fi=Qr("UInt16",(e=>ti(e)&&ni(e)?(oi("UInt16"),{type:"UInt16",value:e.toString()}):ri(e)?{type:"UInt16",value:e}:ii("Expected integer for UInt16")),(e=>e)),hi=Qr("Int16",(e=>ti(e)&&ni(e)?(oi("Int16"),{type:"Int16",value:e.toString()}):ri(e)?{type:"Int16",value:e}:ii("Expected positive integer for Int16")),(e=>e)),pi=Qr("UInt32",(e=>ti(e)&&ni(e)?(oi("UInt32"),{type:"UInt32",value:e.toString()}):ri(e)?{type:"UInt32",value:e}:ii("Expected integer for UInt32")),(e=>e)),gi=Qr("Int32",(e=>ti(e)&&ni(e)?(oi("Int32"),{type:"Int32",value:e.toString()}):ri(e)?{type:"Int32",value:e}:ii("Expected positive integer for Int32")),(e=>e)),yi=Qr("UInt64",(e=>ti(e)&&ni(e)?(oi("UInt64"),{type:"UInt64",value:e.toString()}):ri(e)?{type:"UInt64",value:e}:ii("Expected integer for UInt64")),(e=>e)),mi=Qr("Int64",(e=>ti(e)&&ni(e)?(oi("Int64"),{type:"Int64",value:e.toString()}):ri(e)?{type:"Int64",value:e}:ii("Expected positive integer for Int64")),(e=>e)),vi=Qr("UInt128",(e=>ti(e)&&ni(e)?(oi("UInt128"),{type:"UInt128",value:e.toString()}):ri(e)?{type:"UInt128",value:e}:ii("Expected integer for UInt128")),(e=>e)),bi=Qr("Int128",(e=>ti(e)&&ni(e)?(oi("Int128"),{type:"Int128",value:e.toString()}):ri(e)?{type:"Int128",value:e}:ii("Expected positive integer for Int128")),(e=>e)),wi=Qr("UInt256",(e=>ti(e)&&ni(e)?(oi("UInt256"),{type:"UInt256",value:e.toString()}):ri(e)?{type:"UInt256",value:e}:ii("Expected integer for UInt256")),(e=>e)),Ei=Qr("Int256",(e=>ti(e)&&ni(e)?(oi("Int256"),{type:"Int256",value:e.toString()}):ri(e)?{type:"Int256",value:e}:ii("Expected integer for Int256")),(e=>e)),_i=Qr("Word8",(e=>ti(e)&&ni(e)?(oi("Word8"),{type:"Word8",value:e.toString()}):ri(e)?{type:"Word8",value:e}:ii("Expected positive number for Word8")),(e=>e)),Si=Qr("Word16",(e=>ti(e)&&ni(e)?(oi("Word16"),{type:"Word16",value:e.toString()}):ri(e)?{type:"Word16",value:e}:ii("Expected positive number for Word16")),(e=>e)),xi=Qr("Word32",(e=>ti(e)&&ni(e)?(oi("Word32"),{type:"Word32",value:e.toString()}):ri(e)?{type:"Word32",value:e}:ii("Expected positive number for Word32")),(e=>e)),Ii=Qr("Word64",(e=>ti(e)&&ni(e)?(oi("Word64"),{type:"Word64",value:e.toString()}):ri(e)?{type:"Word64",value:e}:ii("Expected positive number for Word64")),(e=>e)),Oi=Qr("Word128",(e=>ti(e)&&ni(e)?(oi("Word128"),{type:"Word128",value:e.toString()}):ri(e)?{type:"Word128",value:e}:ii("Expected positive number for Word128")),(e=>e)),Ai=Qr("Word256",(e=>ti(e)&&ni(e)?(oi("Word256"),{type:"Word256",value:e.toString()}):ri(e)?{type:"Word256",value:e}:ii("Expected positive number for Word256")),(e=>e)),Ti=()=>{Bt.deprecate({subject:"Passing in Numbers as values for Fix64 and UFix64 types",pkg:"@onflow/types",transition:"https://github.com/onflow/flow-js-sdk/blob/master/packages/types/WARNINGS.md#0001-[U]Fix64-as-Number"})},Ri=Qr("UFix64",(e=>{if(ri(e)){const t=e.split(".");return 2!==t.length?ii("Expected one decimal but found ".concat(t.length," in the [U]Fix64 value. Find out more about [U]Fix64 types here: https://docs.onflow.org/cadence/json-cadence-spec/#fixed-point-numbers")):0==t[1].length||t[1].length>8?ii("Expected at least one digit, and at most 8 digits following the decimal of the [U]Fix64 value but found ".concat(t[1].length," digits. Find out more about [U]Fix64 types here: https://docs.onflow.org/cadence/json-cadence-spec/#fixed-point-numbers")):(t[1]=t[1].padEnd(8,"0"),{type:"UFix64",value:e=t.join(".")})}return ti(e)?(Ti(),{type:"UFix64",value:e.toString()}):ii("Expected String for UFix64")}),(e=>e)),ki=Qr("Fix64",(e=>{if(ri(e)){const t=e.split(".");return 2!==t.length?ii("Expected one decimal but found ".concat(t.length," in the [U]Fix64 value. Find out more about [U]Fix64 types here: https://docs.onflow.org/cadence/json-cadence-spec/#fixed-point-numbers")):0==t[1].length||t[1].length>8?ii("Expected at least one digit, and at most 8 digits following the decimal of the [U]Fix64 value but found ".concat(t[1].length," digits. Find out more about [U]Fix64 types here: https://docs.onflow.org/cadence/json-cadence-spec/#fixed-point-numbers")):(t[1]=t[1].padEnd(8,"0"),{type:"Fix64",value:e=t.join(".")})}return ti(e)?(Ti(),{type:"Fix64",value:e.toString()}):ii("Expected String for Fix64")}),(e=>e)),Pi=Qr("UFix128",(e=>{if(ri(e)){const t=e.split(".");return 2!==t.length?ii("Expected one decimal but found ".concat(t.length," in the [U]Fix128 value. Find out more about [U]Fix128 types here: https://cadencelanguage.com/docs/language/values-and-types/fixed-point-nums-ints")):0==t[1].length||t[1].length>24?ii("Expected at least one digit, and at most 24 digits following the decimal of the [U]Fix128 value but found ".concat(t[1].length," digits. Find out more about [U]Fix128 types here: https://cadencelanguage.com/docs/language/values-and-types/fixed-point-nums-ints")):(t[1]=t[1].padEnd(24,"0"),{type:"UFix128",value:e=t.join(".")})}return ti(e)?(Ti(),{type:"UFix128",value:e.toString()}):ii("Expected String for UFix128")}),(e=>e)),Ci=Qr("Fix128",(e=>{if(ri(e)){const t=e.split(".");return 2!==t.length?ii("Expected one decimal but found ".concat(t.length," in the [U]Fix128 value. Find out more about [U]Fix128 types here: https://cadencelanguage.com/docs/language/values-and-types/fixed-point-nums-ints")):0==t[1].length||t[1].length>24?ii("Expected at least one digit, and at most 24 digits following the decimal of the [U]Fix128 value but found ".concat(t[1].length," digits. Find out more about [U]Fix128 types here: https://cadencelanguage.com/docs/language/values-and-types/fixed-point-nums-ints")):(t[1]=t[1].padEnd(24,"0"),{type:"Fix128",value:e=t.join(".")})}return ti(e)?(Ti(),{type:"Fix128",value:e.toString()}):ii("Expected String for Fix128")}),(e=>e)),Ni=Qr("String",(e=>ri(e)?{type:"String",value:e}:ii("Expected String for type String")),(e=>e)),Ui=Qr("Character",(e=>ri(e)?{type:"Character",value:e}:ii("Expected Character for type Character")),(e=>e)),Bi=Qr("Bool",(e=>(e=>"boolean"===typeof e)(e)?{type:"Bool",value:e}:ii("Expected Boolean for type Bool")),(e=>e)),Li=Qr("Address",(e=>ri(e)?{type:"Address",value:e}:ii("Expected Address for type Address")),(e=>e)),Di=Qr("Void",(e=>!e||ei(e)?{type:"Void",value:null}:ii("Expected Void for type Void")),(e=>e)),ji=e=>Qr("Optional",(t=>({type:"Optional",value:ei(t)?null:e.asArgument(t)})),(e=>e)),Mi=Qr("Reference",(e=>$r(e)?{type:"Reference",value:e}:ii("Expected Object for type Reference")),(e=>e)),Fi=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Qr("Array",(t=>({type:"Array",value:Jr(e)?e.map(((e,n)=>e.asArgument(t[n]))):t.map((t=>e.asArgument(t)))})),(e=>e))},zi=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Qr("Dictionary",(t=>{const n=Jr(t),r=Jr(e);return $r(t)?{type:"Dictionary",value:r&&n?e.map(((e,n)=>({key:e.key.asArgument(t[n].key),value:e.value.asArgument(t[n].value)}))):n&&!r?t.map((t=>({key:e.key.asArgument(t.key),value:e.value.asArgument(t.value)}))):n||r?ii("Invalid arguments for Dictionary."):[{key:e.key.asArgument(t.key),value:e.value.asArgument(t.value)}]}:ii("Expected Object for type Dictionary")}),(e=>e))},qi=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Qr("Event",(n=>$r(n)?{type:"Event",value:{id:e,fields:Jr(t)?t.map(((e,t)=>({name:n.fields[t].name,value:e.value.asArgument(n.fields[t].value)}))):n.fields.map((e=>({name:e.name,value:t.value.asArgument(e.value)})))}}:ii("Expected Object for type Event")),(e=>e))},Hi=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Qr("Resource",(n=>$r(n)?{type:"Resource",value:{id:e,fields:Jr(t)?t.map(((e,t)=>({name:n.fields[t].name,value:e.value.asArgument(n.fields[t].value)}))):n.fields.map((e=>({name:e.name,value:t.value.asArgument(e.value)})))}}:ii("Expected Object for type Resource")),(e=>e))},Vi=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Qr("Struct",(n=>$r(n)?{type:"Struct",value:{id:e,fields:Jr(t)?t.map(((e,t)=>({name:n.fields[t].name,value:e.value.asArgument(n.fields[t].value)}))):n.fields.map((e=>({name:e.name,value:t.value.asArgument(e.value)})))}}:ii("Expected Object for type Struct")),(e=>e))},Ki=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return Qr("Enum",(n=>$r(n)?{type:"Enum",value:{id:e,fields:Jr(t)?t.map(((e,t)=>({name:n.fields[t].name,value:e.value.asArgument(n.fields[t].value)}))):n.fields.map((e=>({name:e.name,value:t.value.asArgument(e.value)})))}}:ii("Expected Object for type Enum")),(e=>e))},Wi=Qr("Path",(e=>$r(e)?ri(e.domain)?"storage"!==e.domain&&"private"!==e.domain&&"public"!==e.domain?ii('Expected either "storage", "private" or "public" as the Path domain but found '.concat(e.domain,". Find out more about the Path type here: https://docs.onflow.org/cadence/json-cadence-spec/#path")):ri(e.identifier)?{type:"Path",value:{domain:e.domain,identifier:e.identifier}}:ii("Expected a string for the Path identifier but found ".concat(e.identifier,". Find out more about the Path type here: https://docs.onflow.org/cadence/json-cadence-spec/#path")):ii("Expected a string for the Path domain but found ".concat(e.domain,". Find out more about the Path type here: https://docs.onflow.org/cadence/json-cadence-spec/#path")):ii("Expected Object for type Path")),(e=>e)),Gi=e=>Qr("InclusiveRange",(t=>{if($r(t)){const{start:n,end:r,step:i}=t;return{type:"InclusiveRange",value:{start:e.asArgument(n),end:e.asArgument(r),step:e.asArgument(i)}}}return ii("Expected Object for type InclusiveRange")}),(e=>e)),Yi='{\n "kind":"'.concat(Gt.ACCOUNT,'",\n "tempId":null,\n "addr":null,\n "keyId":null,\n "sequenceNum":null,\n "signature":null,\n "signingFunction":null,\n "resolve":null,\n "role": {\n "proposer":false,\n "authorizer":false,\n "payer":false,\n "param":false\n }\n}'),Zi='{\n "kind":"'.concat(Gt.ARGUMENT,'",\n "tempId":null,\n "value":null,\n "asArgument":null,\n "xform":null,\n "resolve": null,\n "resolveArgument": null\n}'),Xi='{\n "tag":"'.concat(Vt.UNKNOWN,'",\n "assigns":{},\n "status":"').concat(Kt.OK,'",\n "reason":null,\n "accounts":{},\n "params":{},\n "arguments":{},\n "message": {\n "cadence":null,\n "refBlock":null,\n "computeLimit":null,\n "proposer":null,\n "payer":null,\n "authorizations":[],\n "params":[],\n "arguments":[]\n },\n "proposer":null,\n "authorizations":[],\n "payer":[],\n "events": {\n "eventType":null,\n "start":null,\n "end":null,\n "blockIds":[]\n },\n "subscribeEvents": {\n "startBlockId":null,\n "startHeight":null,\n "eventTypes":null,\n "addresses":null,\n "contracts":null,\n "heartbeatInterval":null\n },\n "transaction": {\n "id":null\n },\n "block": {\n "id":null,\n "height":null,\n "isSealed":null\n },\n "account": {\n "addr":null\n },\n "collection": {\n "id":null\n }\n}'),Qi=new Set(Object.keys(JSON.parse(Xi))),Ji=()=>JSON.parse(Xi),$i=()=>(Bt.deprecate({pkg:"FCL/SDK",message:"The interaction been deprecated from the Flow JS-SDK/FCL. use initInteraction instead",transition:"https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0010-deprecate-interaction",level:Ut.warn}),Ji()),eo=e=>"number"===typeof e,to=e=>Array.isArray(e),no=e=>null!==e&&"object"===typeof e,ro=e=>null==e,io=e=>"function"===typeof e,oo=e=>{if(!no(e)||ro(e)||eo(e))return!1;for(let t of Qi)if(!e.hasOwnProperty(t))return!1;return!0},so=e=>(e.status=Kt.OK,e),ao=(e,t)=>(e.status=Kt.BAD,e.reason=t,e),co=e=>t=>(t.tag=e,so(t)),lo=e=>null==e.keyId?e:(Lt(!isNaN(parseInt(e.keyId.toString())),"account.keyId must be an integer"),{...e,keyId:parseInt(e.keyId.toString())}),uo=()=>JSON.parse(Yi),fo=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return n=>{Lt("function"===typeof e||"object"===typeof e,"prepAccount must be passed an authorization function or an account object"),Lt(null!=t.role,"Account must have a role");const r=uo(),i=t.role,o=Ht();let s={...e};e.authorization&&io(e.authorization)&&(s={resolve:e.authorization}),!e.authorization&&io(e)&&(s={resolve:e});const a=s.resolve;return a&&(s.resolve=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return[a,lo].reduce((async(e,t)=>t(await e,...n)),e)}),s=lo(s),n.accounts[o]={...r,tempId:o,...s,role:{...r.role,..."object"===typeof e.role?e.role:{},...i?{[i]:!0}:{}}},i===Wt.AUTHORIZER?n.authorizations.push(o):i===Wt.PAYER?n.payer.push(o):i&&(n[i]=o),n}},ho=e=>t=>{let n=Ht();return t.message.arguments.push(n),t.arguments[n]=JSON.parse(Zi),t.arguments[n].tempId=n,t.arguments[n].value=e.value,t.arguments[n].asArgument=e.asArgument,t.arguments[n].xform=e.xform,t.arguments[n].resolve=e.resolve,t.arguments[n].resolveArgument=io(e.resolveArgument)?e.resolveArgument.bind(e):e.resolveArgument,so(t)},po=co(Vt.UNKNOWN),go=co(Vt.SCRIPT),yo=co(Vt.TRANSACTION),mo=co(Vt.GET_TRANSACTION_STATUS),vo=co(Vt.GET_TRANSACTION),bo=co(Vt.GET_ACCOUNT),wo=co(Vt.GET_EVENTS),Eo=co(Vt.PING),_o=co(Vt.GET_BLOCK),So=co(Vt.GET_BLOCK_HEADER),xo=co(Vt.GET_COLLECTION),Io=co(Vt.GET_NETWORK_PARAMETERS),Oo=co(Vt.SUBSCRIBE_EVENTS),Ao=co(Vt.GET_NODE_VERSION_INFO),To=e=>t=>t.tag===e,Ro=To(Vt.UNKNOWN),ko=To(Vt.SCRIPT),Po=To(Vt.TRANSACTION),Co=To(Vt.GET_TRANSACTION_STATUS),No=To(Vt.GET_TRANSACTION),Uo=To(Vt.GET_ACCOUNT),Bo=To(Vt.GET_EVENTS),Lo=To(Vt.PING),Do=To(Vt.GET_BLOCK),jo=To(Vt.GET_BLOCK_HEADER),Mo=To(Vt.GET_COLLECTION),Fo=To(Vt.GET_NETWORK_PARAMETERS),zo=To(Vt.GET_NODE_VERSION_INFO),qo=To(Vt.SUBSCRIBE_EVENTS),Ho=e=>e.status===Kt.BAD,Vo=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];try{if(e=(e=>{for(let t of Object.keys(e))if(!Qi.has(t))throw new Error('"'.concat(t,'" is an invalid root level Interaction property.'));return e})(await e),Ho(e))throw new Error("Interaction Error: ".concat(e.reason));if(!t.length)return e;const[n,...r]=t,i=await n;if(io(i))return Vo(i(e),r);if(ro(i)||!i)return Vo(e,r);if(oo(i))return Vo(i,r);throw new Error("Invalid Interaction Composition")}catch(Mz){throw Mz}};function Ko(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];const[r,i]=t;if(to(r))return e=>Ko(e,r);return Vo(r,i)}const Wo=function(e){return e},Go=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;return null==e.assigns[t]?n:e.assigns[t]},Yo=(e,t)=>n=>(n.assigns[e]=t,so(n)),Zo=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Wo;return n=>(n.assigns[e]=t(n.assigns[e],n),so(n))};var Xo=Object.freeze({__proto__:null,Bad:ao,Ok:so,destroy:e=>t=>(delete t.assigns[e],so(t)),get:Go,initAccount:uo,initInteraction:Ji,interaction:$i,isAccount:e=>e.kind===Gt.ACCOUNT,isArgument:e=>e.kind===Gt.ARGUMENT,isArray:to,isBad:Ho,isFn:io,isGetAccount:Uo,isGetBlock:Do,isGetBlockHeader:jo,isGetCollection:Mo,isGetEvents:Bo,isGetNetworkParameters:Fo,isGetNodeVersionInfo:zo,isGetTransaction:No,isGetTransactionStatus:Co,isInteraction:oo,isNull:ro,isNumber:eo,isObj:no,isOk:e=>e.status===Kt.OK,isPing:Lo,isScript:ko,isSubscribeEvents:qo,isTransaction:Po,isUnknown:Ro,makeArgument:ho,makeGetAccount:bo,makeGetBlock:_o,makeGetBlockHeader:So,makeGetCollection:xo,makeGetEvents:wo,makeGetNetworkParameters:Io,makeGetNodeVerionInfo:Ao,makeGetTransaction:vo,makeGetTransactionStatus:mo,makePing:Eo,makeScript:go,makeSubscribeEvents:Oo,makeTransaction:yo,makeUnknown:po,pipe:Ko,prepAccount:fo,put:Yo,update:Zo,why:e=>e.reason});function Qo(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Ko(Ji(),e)}const Jo={tag:null,transaction:null,transactionStatus:null,transactionId:null,encodedData:null,events:null,event:null,accountStatusEvent:null,account:null,block:null,blockHeader:null,blockDigest:null,latestBlock:null,collection:null,networkParameters:null,streamConnection:null,heartbeat:null,nodeVersionInfo:null},$o=()=>({...Jo});function es(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return Ko([_o,t=>(t.block.isSealed=e,so(t))])}function ts(e){return Ko([bo,t=>(t.account.addr=nr(e),so(t))])}const ns=(e,t,n)=>{const r=new(or());let i=function(){let e=[],t=!1;async function n(){if(!t){for(t=!0;e.length>0;){const t=e.shift();await(null===t||void 0===t?void 0:t())}t=!1}}return{push:t=>{e.push(t),n()}}}();function o(t){e.on(t,(e=>{i.push((async()=>{r.emit(t,e)}))}))}return e.on("data",(async e=>{const o=Object.keys(e).filter((t=>null!=e[t]&&"tag"!==t));let s=Promise.all(o.map((async r=>{const i={[r]:e[r]};return{channel:r,message:await t(i,n)}})));i.push((async()=>{(await s).forEach((e=>{let{channel:t,message:n}=e;r.emit(t,n)}))}))})),o("close"),o("error"),{on(e,t){return r.on(e,t),this},off(e,t){return r.off(e,t),this},close:()=>{e.close()}}};const rs=async e=>e,is=async(e,t,n)=>{const r=await e.fields.reduce((async(e,r)=>((e=await e)[r.name]=await as(r.value,t,[...n,r.name]),e)),Promise.resolve({})),i=e.id&&ss(t,e.id);return i?await i(r):r},os={UInt:rs,Int:rs,UInt8:rs,Int8:rs,UInt16:rs,Int16:rs,UInt32:rs,Int32:rs,UInt64:rs,Int64:rs,UInt128:rs,Int128:rs,UInt256:rs,Int256:rs,Word8:rs,Word16:rs,Word32:rs,Word64:rs,Word128:rs,Word256:rs,UFix64:rs,Fix64:rs,UFix128:rs,Fix128:rs,String:rs,Character:rs,Bool:rs,Address:rs,Void:async()=>null,Optional:async(e,t,n)=>e?await as(e,t,n):null,Reference:rs,Array:async(e,t,n)=>await Promise.all(e.map((e=>new Promise((async r=>r(await as(e,t,[...n,e.type]))))))),Dictionary:async(e,t,n)=>await e.reduce((async(e,r)=>((e=await e)[await as(r.key,t,[...n,r.key])]=await as(r.value,t,[...n,r.key]),e)),Promise.resolve({})),Event:is,Resource:is,Struct:is,Enum:is,Type:async e=>e.staticType,Path:rs,Capability:rs,InclusiveRange:async(e,t,n)=>{const r=["start","end","step"];return await Object.keys(e).reduce((async(i,o)=>(i=await i,r.includes(o)&&(i[o]=await as(e[o],t,[...n,o])),i)),Promise.resolve({}))}},ss=(e,t)=>{const n=Object.keys(e).find((e=>{if(/^\/.*\/$/.test(e)){return new RegExp(e.substring(1,e.length-1)).test(t)}return e===t}));return t&&n&&e[n]},as=async(e,t,n)=>{let r=ss(t,e.type);if(!r)throw new Error("Undefined Decoder Error: ".concat(e.type,"@").concat(n.join(".")));return await r(e.value,t,n)},cs=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];const r=Object.keys(os).filter((e=>!Object.keys(t).find((t=>new RegExp(t).test(e))))).reduce(((e,t)=>(e[t]=os[t],e)),t),i={...r,...t};return as(e,i,n)},ls=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e.encodedData)return cs(e.encodedData,t);if(e.transactionStatus)return{...e.transactionStatus,events:await Promise.all(e.transactionStatus.events.map((async function(e){return{type:e.type,transactionId:e.transactionId,transactionIndex:e.transactionIndex,eventIndex:e.eventIndex,data:await cs(e.payload,t)}})))};if(e.transaction)return e.transaction;if(e.events)return await Promise.all(e.events.map((async function(e){return{blockId:e.blockId,blockHeight:e.blockHeight,blockTimestamp:e.blockTimestamp,type:e.type,transactionId:e.transactionId,transactionIndex:e.transactionIndex,eventIndex:e.eventIndex,data:await cs(e.payload,t)}})));if(e.event){const{payload:n,...r}=e.event;return{...r,data:await cs(n,t)}}if(e.accountStatusEvent){const{payload:n,...r}=e.accountStatusEvent;return{...r,data:await cs(n,t)}}if(e.account)return e.account;if(e.block)return e.block;if(e.blockHeader)return e.blockHeader;if(e.blockDigest)return e.blockDigest;if(e.latestBlock)return Bt.deprecate({pkg:"@onflow/decode",subject:"Operating upon data of the latestBlock field of the response object",transition:"https://github.com/onflow/flow-js-sdk/blob/master/packages/decode/WARNINGS.md#0001-Deprecating-latestBlock-field"}),e.latestBlock;if(e.transactionId)return e.transactionId;if(e.collection)return e.collection;if(e.networkParameters){const t=/^flow-/,n=e.networkParameters.chainId;let r;return r="flow-emulator"===n?"local":t.test(n)?n.replace(t,""):n,{chainId:r}}return e.streamConnection?ns(e.streamConnection,ls,t):e.heartbeat?e.heartbeat:e.nodeVersionInfo?e.nodeVersionInfo:null};class us extends Error{constructor(){super("The current transport does not support subscriptions. If you have provided a custom transport (e.g. via `sdk.transport` configuration), ensure that it implements the subscribe method."),this.name="SubscriptionsNotSupportedError"}}function ds(e){const t=e["sdk.transport"]||e["sdk.send"]||Wr;return void 0===(n=t).send||void 0===n.subscribe||"function"!==typeof n.send||"function"!==typeof n.subscribe?{send:t,subscribe:()=>{throw new us}}:t;var n}const fs=10;let hs;async function ps(){const e=await Yn().all();return{get transport(){return ds(e)},get accessNodeUrl(){const t=e["accessNode.api"];return Lt(!!t,'Either opts.node or "accessNode.api" in config must be defined.'),t},get computeLimit(){const t=e["fcl.limit"];return t||(Bt.deprecate({pkg:"FCL/SDK",subject:"The built-in default compute limit (DEFAULT_COMPUTE_LIMIT=10)",transition:"https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0009-deprecate-default-compute-limit"}),fs)},get customResolver(){return e["sdk.resolve"]},get customDecoders(){return Object.fromEntries(Object.entries(e).filter((e=>{let[t]=e;return t.startsWith("decoder.")})))},get contracts(){return Object.fromEntries(Object.entries(e).filter((e=>{let[t]=e;return t.startsWith("system.contracts.")})).map((e=>{let[t,n]=e;return[t.replace("system.contracts.",""),n]})))},get debug(){return Object.fromEntries(Object.entries(e).filter((e=>{let[t]=e;return t.startsWith("debug.")})))},get legacyContractIdentifiers(){return Object.fromEntries(Object.entries(e).filter((e=>{let[t]=e;return t.startsWith("0x")})))}}}async function gs(){return hs||(Yn().subscribe((()=>{hs=ps()})),hs=ps()),hs}function ys(e){return async function(){const t=await gs();return e(t)(...arguments)}}const ms=e=>"function"===typeof e,vs=e=>"string"===typeof e,bs=()=>/\b(0x\w+)\b/g;function ws(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=e.matchAll(bs());for(const r of n){if(t[r[0]])return!0}return!1}const Es=()=>/import\s+"(\w+)"/g;function _s(e){return Es().test(e)}function Ss(e){return async function(t){if(!Po(t)&&!ko(t))return t;var n=Go(t,"ix.cadence");if(Lt(ms(n)||vs(n),"Cadence needs to be a function or a string."),ms(n)&&(n=await n({})),Lt(vs(n),"Cadence needs to be a string at this point."),Lt(!ws(n,e.legacyContractIdentifiers)||!_s(n),"Both account identifier and contract identifier syntax not simultaneously supported."),ws(n,e.legacyContractIdentifiers)&&(n=Object.entries(e.legacyContractIdentifiers||{}).reduce(((e,t)=>{let[n,r]=t;const i=new RegExp("(\\b"+n+"\\b)","g");return e.replace(i,r)}),n)),_s(n))for(const[r,i]of function(e){return e.matchAll(Es())}(n)){const t=e.contracts[i]||null;if(t){const o=e.contracts[i+".canonical"]||null,s=o?"import ".concat(o," as ").concat(i," from ").concat(rr(t)):"import ".concat(i," from ").concat(rr(t));n=n.replace(r,s)}else Bt({title:"Contract Placeholder not found",message:"Cannot find a value for contract placeholder ".concat(i,". Please add to your flow.json or explicitly add it to the config 'contracts.*' namespace."),level:Ut.warn})}return t.message.cadence=n,t}}const xs=e=>"function"===typeof e;function Is(e){return Lt(null!=typeof e.xform,"No type specified for argument: ".concat(e.value)),xs(e.xform)?e.xform(e.value):xs(e.xform.asArgument)?e.xform.asArgument(e.value):void Lt(!1,"Invalid Argument",e)}async function Os(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;if(Lt(t>0,"Argument Resolve Recursion Limit Exceeded for Arg: ".concat(e.tempId)),xs(e.resolveArgument)){return Os(await e.resolveArgument(),t-1)}return e}async function As(e){if(Po(e)||ko(e))for(let[t,n]of Object.entries(e.arguments)){const r=await Os(n);e.arguments[t].asArgument=Is(r)}return e}const Ts=e=>Cs(Ms(Fs(e))),Rs=e=>Cs(Ms(zs(e))),ks=(e,t)=>Xn.Buffer.from(e.padStart(2*t,"0"),"hex"),Ps=((e,t)=>Xn.Buffer.from(e.padEnd(2*t,"0"),"hex"))(Xn.Buffer.from("FLOW-V0.0-transaction").toString("hex"),32).toString("hex"),Cs=e=>Ps+e,Ns=e=>ks(e,8),Us=e=>ks(e,32),Bs=e=>Xn.Buffer.from(JSON.stringify(e),"utf8"),Ls=e=>Xn.Buffer.from(e,"utf8"),Ds=e=>Xn.Buffer.from(e,"hex"),js=e=>{if(null!=e)return Xn.Buffer.from(e,"hex")},Ms=e=>Qn(e).toString("hex"),Fs=e=>(Vs(e),[Ls(e.cadence||""),e.arguments.map(Bs),Us(e.refBlock||""),e.computeLimit,Ns(nr(e.proposalKey.address||"")),e.proposalKey.keyId,e.proposalKey.sequenceNum,Ns(nr(e.payer)),e.authorizers.map((e=>Ns(nr(e))))]),zs=e=>(Ks(e),[Fs(e),qs(e)]),qs=e=>{var t;const n=Hs(e);return null===(t=e.payloadSigs)||void 0===t?void 0:t.map((e=>({signerIndex:n.get(nr(e.address))||"",keyId:e.keyId,sig:e.sig,sigExt:js(e.extensionData)}))).sort(((e,t)=>e.signerIndex>t.signerIndex?1:e.signerIndex<t.signerIndex?-1:e.keyId>t.keyId?1:e.keyId<t.keyId?-1:0)).map((e=>{const t=[e.signerIndex,e.keyId,Ds(e.sig)];return null!=e.sigExt&&t.push(e.sigExt),t}))},Hs=e=>{const t=new Map;let n=0;const r=e=>{t.has(e)||(t.set(e,n),n++)};return e.proposalKey.address&&r(e.proposalKey.address),r(e.payer),e.authorizers.forEach(r),t},Vs=e=>{Xs.forEach((t=>ea(e,t))),Qs.forEach((t=>ea(e.proposalKey,t,"proposalKey")))},Ks=e=>{var t;Js.forEach((t=>ea(e,t))),null===(t=e.payloadSigs)||void 0===t||t.forEach(((e,t)=>{$s.forEach((n=>ea(e,n,"payloadSigs",t)))}))},Ws=e=>"number"===typeof e,Gs=e=>"string"===typeof e,Ys=e=>null!==e&&"object"===typeof e,Zs=e=>Ys(e)&&e instanceof Array,Xs=[{name:"cadence",check:Gs},{name:"arguments",check:Zs},{name:"refBlock",check:Gs,defaultVal:"0"},{name:"computeLimit",check:Ws},{name:"proposalKey",check:Ys},{name:"payer",check:Gs},{name:"authorizers",check:Zs}],Qs=[{name:"address",check:Gs},{name:"keyId",check:Ws},{name:"sequenceNum",check:Ws}],Js=[{name:"payloadSigs",check:Zs}],$s=[{name:"address",check:Gs},{name:"keyId",check:Ws},{name:"sig",check:Gs}],ea=(e,t,n,r)=>{const{name:i,check:o,defaultVal:s}=t;if(null==e[i]&&null!=s&&(e[i]=s),null==e[i])throw na(i,n,r);if(!o(e[i]))throw ra(i,n,r)},ta=(e,t,n)=>t?null==n?"".concat(t,".").concat(e):"".concat(t,".").concat(n,".").concat(e):e,na=(e,t,n)=>new Error("Missing field ".concat(ta(e,t,n))),ra=(e,t,n)=>new Error("Invalid field ".concat(ta(e,t,n)));function ia(e){let t=new Set(e.authorizations);return e.proposer&&t.add(e.proposer),Array.isArray(e.payer)?e.payer.forEach((e=>t.delete(e))):t.delete(e.payer),Array.from(t)}function oa(e){let t=new Set(Array.isArray(e.payer)?e.payer:[e.payer]);return Array.from(t)}const sa=e=>{const t=e.proposer?{address:rr(e.accounts[e.proposer].addr),keyId:e.accounts[e.proposer].keyId,sequenceNum:e.accounts[e.proposer].sequenceNum}:{};return{cadence:e.message.cadence,refBlock:e.message.refBlock||null,computeLimit:e.message.computeLimit,arguments:e.message.arguments.map((t=>e.arguments[t].asArgument)),proposalKey:t,payer:rr(e.accounts[Array.isArray(e.payer)?e.payer[0]:e.payer].addr),authorizers:e.authorizations.map((t=>rr(e.accounts[t].addr))).reduce(((e,t)=>e.find((e=>e===t))?e:[...e,t]),[]),payloadSigs:ia(e).map((t=>{const n={address:rr(e.accounts[t].addr),keyId:e.accounts[t].keyId,sig:e.accounts[t].signature},r=e.accounts[t].extensionData;return null!=r&&(n.extensionData=r),n})),envelopeSigs:oa(e).map((t=>{const n={address:rr(e.accounts[t].addr),keyId:e.accounts[t].keyId,sig:e.accounts[t].signature},r=e.accounts[t].extensionData;return null!=r&&(n.extensionData=r),n}))}},aa=5,ca=e=>"".concat(rr(e.addr),"-").concat(e.keyId),la=e=>e&&("[object Function]"===Object.prototype.toString.call(e)||"function"===typeof e||e instanceof Function),ua=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.join("-")};var da=function(e){return e.PAYER="payer",e.PROPOSER="proposer",e.AUTHORIZATIONS="authorizations",e}(da||{});function fa(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;return t<=0?e:Array.isArray(e)?fa(e.flatMap((e=>e)),t-1):e}function ha(e,t){"string"!==typeof t.addr||"number"!==typeof t.keyId&&"string"!==typeof t.keyId?t.tempId=t.tempId||Ht():t.tempId=ca(t);const n=e.accounts[t.tempId]||t;return e.accounts[t.tempId]||(e.accounts[t.tempId]=t),e.accounts[t.tempId].role.proposer=n.role.proposer||t.role.proposer,e.accounts[t.tempId].role.payer=n.role.payer||t.role.payer,e.accounts[t.tempId].role.authorizer=n.role.authorizer||t.role.authorizer,e.accounts[t.tempId]}function pa(e){const t=fa(e),n=new Set,r=t.map((e=>{const t=ua(e.tempId,e.role.payer,e.role.proposer,e.role.authorizer,e.role.param);return n.has(t)?null:(n.add(t),e)})).filter((e=>null!==e));return r}async function ga(e,t){var n;let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:aa,{debugLogger:i}=arguments.length>3?arguments[3]:void 0;if(r<=0)throw new Error("recurseResolveAccount Error: Depth limit (".concat(aa,") reached. Ensure your authorization functions resolve to an account after ").concat(aa," resolves."));let o=e.accounts[t];if(!o)return[[],!1];if(i("account: ".concat(o.tempId),Math.max(aa-r,0)),null!==(n=o)&&void 0!==n&&n.resolve){var s;if(la(null===(s=o)||void 0===s?void 0:s.resolve)){i("account: ".concat(o.tempId," -- cache MISS"),Math.max(aa-r,0));const{resolve:t,...n}=o;let s=await t(n,function(e,t){try{return{f_type:"PreSignable",f_vsn:"1.0.1",roles:e.role,cadence:t.message.cadence,args:t.message.arguments.map((e=>t.arguments[e].asArgument)),data:{},interaction:t,voucher:sa(t)}}catch(n){throw console.error("buildPreSignable",n),n}}(n,e));s=Array.isArray(s)?s:[s];let a=fa(s);return a=a.map((t=>ha(e,t))),o.resolve=a.map((e=>e.tempId)),o=ha(e,o),[a.map((e=>e.tempId)),!0]}return i("account: ".concat(o.tempId," -- cache HIT"),Math.max(aa-r,0)),[o.resolve,!1]}return[o.tempId?[o.tempId]:[],!1]}const ya=e=>null===e?[]:Array.isArray(e)?e:[e];async function ma(e,t,n){for(let o of Object.values(da))if(o===da.AUTHORIZATIONS||o===da.PAYER)e[o]=ya(e[o]).reduce(((e,r)=>r===t?e.concat(...n.filter((e=>o===da.PAYER&&e.role.payer||o===da.AUTHORIZATIONS&&e.role.authorizer)).map((e=>e.tempId))):e.concat(r)),[]);else if(o===da.PROPOSER){var r,i;const t=n.filter((e=>e.role.proposer));if(t.length>1)throw new Error("replaceRoles Error: Multiple proposer keys were resolved, but only one is allowed");e[o]=null!==(r=null===(i=t[0])||void 0===i?void 0:i.tempId)&&void 0!==r?r:e[o]}}async function va(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:aa,{debugLogger:r}=arguments.length>3?arguments[3]:void 0;Lt(e&&"object"===typeof e,"resolveAccountType Error: ix not defined");let i,o=new Set;for(let s of t){let t=e.accounts[s];Lt(Boolean(t),"resolveAccountType Error: account not found");const[i,a]=await ga(e,s,n,{debugLogger:r});if(a){const t=pa(i.map((t=>e.accounts[t])));t.forEach((e=>o.add(e.tempId))),ma(e,s,t)}}for(const s of e[da.PAYER]){let t=e.accounts[s];if(i){if(i!==t.addr)throw new Error("resolveAccountType Error: payers from different accounts detected")}else i=t.addr}return o}async function ba(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(Po(e)){Array.isArray(e.payer)||Bt.deprecate({pkg:"FCL",subject:'"ix.payer" must be an array. Support for ix.payer as a singular',message:"See changelog for more info."});let[r,i]=function(){const e=[];return[function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;e.push(Array(4*n).fill(" ").join("-")+t)},function(){return e.reduce(((e,t)=>e+"\n"+t))}]}();try{let n=aa,o=new Set([...ya(e[da.PAYER]),...ya(e[da.PROPOSER]),...ya(e[da.AUTHORIZATIONS])]);for(;o.size>0;){if(n<=0)throw new Error("resolveAccounts Error: Depth limit (".concat(aa,") reached. Ensure your authorization functions resolve to an account after ").concat(aa," resolves."));o=await va(e,o,n,{debugLogger:r}),n--}await async function(e,t){const n=Array.isArray(e.payer)?e.payer:[e.payer],r=Array.isArray(e.authorizations)?e.authorizations:[e.authorizations],i=null===e.proposer?[]:Array.isArray(e.proposer)?e.proposer:[e.proposer],o=Object.keys(e.accounts),s=[...new Set(n.concat(r,i))];for(const a of o)s.find((e=>e===a))||delete e.accounts[a]}(e);for(const t of Object.values(da))Lt(ya(e[t]).length>0||t===da.AUTHORIZATIONS,'resolveAccountType Error: no accounts for role "'.concat(t,'" found'));t.enableDebug&&console.debug(i())}catch(n){throw console.error("=== SAD PANDA ===\n\n",n,"\n\n=== SAD PANDA ==="),n}}return e}async function wa(e){if(Po(e))try{let t=ia(e);const n=Ts(_a(e));await Promise.all(t.map(Ea(e,n)));let r=oa(e);const i=Rs({..._a(e),payloadSigs:t.map((t=>{const n={address:e.accounts[t].addr||"",keyId:e.accounts[t].keyId||0,sig:e.accounts[t].signature||""},r=e.accounts[t].extensionData;return null!=r&&(n.extensionData=r),n}))});await Promise.all(r.map(Ea(e,i)))}catch(t){throw console.error("Signatures",t,{ix:e}),t}return e}function Ea(e,t){return async function(n){const r=e.accounts[n];if(null!=r.signature&&void 0!==r.signature)return;const{signature:i,extensionData:o}=await r.signingFunction(function(e,t,n){try{return{f_type:"Signable",f_vsn:"1.0.1",message:t,addr:nr(e.addr),keyId:e.keyId,roles:e.role,cadence:n.message.cadence,args:n.message.arguments.map((e=>n.arguments[e].asArgument)),data:{},interaction:n,voucher:sa(n)}}catch(r){throw console.error("buildSignable",r),r}}(r,t,e));e.accounts[n].signature=i,null!=o&&(e.accounts[n].extensionData=o)}}function _a(e){const t=nr((Array.isArray(e.payer)?e.accounts[e.payer[0]]:e.accounts[e.payer]).addr||""),n=e.proposer?{address:nr(e.accounts[e.proposer].addr)||"",keyId:e.accounts[e.proposer].keyId||0,sequenceNum:e.accounts[e.proposer].sequenceNum||0}:{};return{cadence:e.message.cadence,refBlock:e.message.refBlock,computeLimit:e.message.computeLimit,arguments:e.message.arguments.map((t=>e.arguments[t].asArgument)),proposalKey:n,payer:t,authorizers:e.authorizations.map((t=>nr(e.accounts[t].addr)||"")).reduce(((e,t)=>e.find((e=>e===t))?e:[...e,t]),[])}}async function Sa(e){return Ko(e,Go(e,"ix.validators",[]).map((e=>t=>e(t,{Ok:so,Bad:ao}))))}async function xa(e){for(let t of Object.keys(e.accounts))e.accounts[t].addr=nr(e.accounts[t].addr);return e}async function Ia(e){const t=Go(e,"ix.voucher-intercept");return io(t)&&await t(sa(e)),e}function Oa(e){return async function(t){return Po(t)&&(t.message.computeLimit=t.message.computeLimit||e.computeLimit),t}}const Aa=e=>e,Ta=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Aa;return async n=>(await Yn.get("debug.".concat(e))&&await t(n,(function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];console.log("debug[".concat(e,"] ---\n"),...n,"\n\n\n---")}),(e=>["\nAccounts:",{proposer:e.proposer,authorizations:e.authorizations,payer:e.payer},"\n\nDetails:",e.accounts].filter(Boolean))),n)};function Ra(e){return async t=>Ko([Ss(e),Ta("cadence",((e,t)=>t(e.message.cadence))),Oa(e),Ta("compute limit",((e,t)=>t(e.message.computeLimit))),As,Ta("arguments",((e,t)=>t(e.message.arguments,e.message))),ba,Ta("accounts",((e,t,n)=>t(...n(e)))),Pa(e),Ca(e),wa,Ta("signatures",((e,t,n)=>t(...n(e)))),xa,Sa,Ia,Ta("resolved",((e,t)=>t(e)))])(t)}const ka=ys(Ra);function Pa(e){return async function(t){if(Po(t)&&null==t.message.refBlock){const n=e.transport.send;t.message.refBlock=(await n(Qo([es()]),{response:$o,Buffer:Xn.Buffer,ix:Xo},{get node(){return e.accessNodeUrl}}).then(ls)).id}return t}}function Ca(e){return async function(t){if(Po(t)){var n=Object.values(t.accounts).find((e=>e.role.proposer));if(Lt(void 0!==n,"Transactions require a proposer"),n&&null==n.sequenceNum){const r=e.transport.send;t.accounts[n.tempId].sequenceNum=await r(await Qo([ts(n.addr)]),{response:$o,Buffer:Xn.Buffer,ix:Xo},{get node(){return e.accessNodeUrl}}).then(ls).then((e=>e.keys)).then((e=>e.find((e=>e.index===n.keyId)))).then((e=>e.sequenceNumber))}}return t}}function Na(e){return async function(){var t,n;let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const o=i.transport||e.transport,s=null===(t=o.send)||void 0===t||null===(n=t.bind)||void 0===n?void 0:n.call(t,o);Lt(!!s,"Required value for sdk.transport is not defined in config. See: ".concat("https://github.com/onflow/fcl-js/blob/master/packages/sdk/CHANGELOG.md#0057-alpha1----2022-01-21"));const a=i.resolve||e.customResolver||Ra(e);return i.node=i.node||e.accessNodeUrl,Array.isArray(r)&&(r=Ko(Ji(),r)),s(await a(r),{response:$o,ix:Xo,Buffer:Xn.Buffer},i)}}const Ua=ys(Na);function Ba(e){return function(t){let{topic:n,args:r,onData:i,onError:o}=t,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=async function(){try{const t=await e,a=s.transport||t.transport,c=s.node||t.accessNodeUrl;return Lt(!!c,'SDK Send Error: Either opts.node or "accessNode.api" in config must be defined.'),a.subscribe({topic:n,args:r,onData:i,onError:o},{node:c,...s})}catch(Mz){return void o(Mz instanceof Error?Mz:new Error(String(Mz)))}}();return{unsubscribe:()=>{a.then((e=>{var t;return null===e||void 0===e||null===(t=e.unsubscribe)||void 0===t?void 0:t.call(e)}))}}}}function La(e){let{topic:t,args:n,onData:r,onError:i}=e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Ba(gs())({topic:t,args:n,onData:r,onError:i},o)}function Da(e){let{topic:t,args:n,onData:r,onError:i}=e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=Ba(gs())({topic:t,args:n,onData:e=>{ls(e).then(r).catch((e=>{var t;i(new Error("Failed to decode response: ".concat(e.message))),null===s||void 0===s||null===(t=s.unsubscribe)||void 0===t||t.call(s)}))},onError:i},o);return s}function ja(e){return async function(t){return ls(t,e.customDecoders)}}const Ma=ys(ja);Error;function Fa(e){return Zo("ix.validators",(t=>Array.isArray(t)?[...t,e]:[e]))}function za(e){return Ko([t=>(t.block.height=e,t),Fa((e=>{if("boolean"===typeof e.block.isSealed)throw new Error("Unable to specify both block height and isSealed.");if(e.block.id)throw new Error("Unable to specify both block height and block id.");return e}))])}function qa(e){return Ko([t=>(t.block.id=e,so(t)),Fa(((e,t)=>{let{Ok:n,Bad:r}=t;return Uo(e)?r(e,"Unable to specify a block id with a Get Account interaction."):"boolean"===typeof e.block.isSealed?r(e,"Unable to specify both block id and isSealed."):e.block.height?r(e,"Unable to specify both block id and block height."):n(e)}))])}function Ha(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return Ko([t=>(t.block.isSealed=e,t),Fa((e=>{if(e.block.id)throw new Error("Unable to specify both block finality and block id.");if(e.block.height)throw new Error("Unable to specify both block finality and block height.");return e}))])}function Va(e){return async function(t){let{height:n,id:r,isSealed:i}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2?arguments[2]:void 0;return Lt(!(r&&n||r&&i||n&&i),"Method: account -- Only one of the following parameters can be provided: id, height, isSealed"),r?await Na(e)([ts(t),qa(r)],o).then(ls):n?await Na(e)([ts(t),za(n)],o).then(ls):await Na(e)([ts(t),Ha(null!==i&&void 0!==i&&i)],o).then(ls)}}const Ka=ys(Va);function Wa(e){return async function(){let{sealed:t=!1,id:n,height:r}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Lt(!(t&&n||t&&r),'Method: block -- Cannot pass "sealed" with "id" or "height"'),Lt(!(n&&r),'Method: block -- Cannot pass "id" and "height" simultaneously'),n?await Na(e)([es(),qa(n)],i).then(ls):r?await Na(e)([es(),za(r)],i).then(ls):await Na(e)([es(t)],i).then(ls)}}const Ga=ys(Wa);function Ya(){return Ko((arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).map((e=>fo(e,{role:Wt.AUTHORIZER}))))}function Za(e){return Ko([mo,t=>(t.transaction.id=e,so(t))])}function Xa(e){return t=>(t.message.computeLimit=e,t)}function Qa(e){return Ko(e.map(ho))}function Ja(e,t){return{value:e,xform:t}}function $a(e){return fo(e,{role:Wt.PROPOSER})}function ec(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Array.isArray(e)||(e=[e]),Ko(e.map((e=>fo(e,{role:Wt.PAYER}))))}function tc(){return Ko([go,Yo("ix.cadence",Xr(...arguments))])}const nc=[];function rc(){return Ko([yo,Yo("ix.cadence",Xr(...arguments)),e=>(e.message.refBlock=e.message.refBlock||null,e.authorizations=e.authorizations||nc,so(e))])}function ic(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(t.length>1){const[e,n]=t;return ic(((t,r)=>{let{Ok:i,Bad:o}=r;return e?i(t):o(t,n)}))}const[r]=t;return e=>r(e,{Ok:so,Bad:ao})}var oc=n(2367),sc=/^[0-9]+$/,ac=function(e,t){var n=sc.test(e),r=sc.test(t);return n&&r&&(e=+e,t=+t),e===t?0:n&&!r?-1:r&&!n?1:e<t?-1:1},cc=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,lc=function(e,t){if("string"!==typeof e||"string"!==typeof t)throw new Error("Invalid input");var n=e.match(cc),r=t.match(cc);if(!n||!r)throw new Error("Invalid input");for(var i=1;i<=3;i++){if(parseInt(n[i])>parseInt(r[i]))return 1;if(parseInt(n[i])<parseInt(r[i]))return-1}if(n[4]&&r[4])for(var o=(n[4]||"").split("."),s=(r[4]||"").split("."),a=0;a<Math.max(o.length,s.length);a++){if(void 0===o[a])return-1;if(void 0===s[a])return 1;var c=ac(o[a],s[a]);if(0!==c)return c}return 0};const uc="1.30.1",dc=e=>t=>typeof t===e,fc=e=>null!=e,hc=dc("object"),pc=dc("string"),gc=dc("function"),yc=dc("number");function mc(t){return gc(t)?t(Ja,e):[]}async function vc(e,t,n){Lt(fc(n),"".concat(t,"(opts) -- opts is required")),Lt(hc(n),"".concat(t,"(opts) -- opts must be an object")),Lt(!(n.cadence&&n.template),"".concat(t,"({ template, cadence }) -- cannot pass both cadence and template")),Lt(fc(n.cadence||(null===n||void 0===n?void 0:n.template)),"".concat(t,"({ cadence }) -- cadence is required")),Lt(pc(n.cadence)||(null===n||void 0===n?void 0:n.template),"".concat(t,"({ cadence }) -- cadence must be a string")),Lt(await e.config.get("accessNode.api"),"".concat(t,'(opts) -- Required value for "accessNode.api" not defined in config. See: ',"https://github.com/onflow/flow-js-sdk/blob/master/packages/fcl/src/exec/query.md#configuration"))}async function bc(e){let t,{url:n}=e;Lt("undefined"!==typeof n,"retrieve({ url }) -- url must be defined");try{t=await ur()(n)}catch(Mz){throw new Error("httpDocumentResolver Error: Failed to retrieve document.")}return t.ok?await t.json():null}const wc=new Map([["http",bc],["https",bc]]);async function Ec(e){var t,n,r,i;let{network:o,template:s}=e;Lt("1.1.0"===s.f_version,"deriveCadenceByNetwork110({ template }) -- template must be version 1.1.0");const a={};return null===s||void 0===s||null===(t=s.data)||void 0===t||t.dependencies.forEach((e=>{e.contracts.forEach((e=>{const t=e.contract;e.networks.forEach((e=>{e.network===o&&(a[t]=e.address)})),Lt(void 0!==a[t],"deriveCadenceByNetwork110 -- Could not find contracts Network Address: ".concat(o," ").concat(t))}))})),Lt(Object.keys(a).length===(null===s||void 0===s||null===(n=s.data)||void 0===n?void 0:n.dependencies.length),"deriveCadenceByNetwork110 -- Could not find contracts for import dependencies: ".concat(a)),Lt(Object.keys(a).length===Object.values(a).length,"deriveCadenceByNetwork110 -- Could not find all addresses for network ".concat(o," dependencies: ").concat(a)),Lt(!(null===s||void 0===s||null===(r=s.data)||void 0===r||null===(r=r.cadence)||void 0===r||!r.body),"no cadence found -- Could not replace import dependencies: ".concat(a)),function(e){let{cadence:t,networkDependencies:n}=e;return Object.keys(n).reduce(((e,t)=>{const r=n[t],i=new RegExp('import "\\b'.concat(t,'\\b"'),"g");return e.replace(i,"import ".concat(t," from ").concat(r))}),t)}({cadence:null===s||void 0===s||null===(i=s.data)||void 0===i||null===(i=i.cadence)||void 0===i?void 0:i.body,networkDependencies:a})}async function _c(e){let{network:t,template:n}=e;switch(Lt(void 0!=t,"deriveCadenceByNetwork({ network }) -- network must be defined"),Lt("string"===typeof t,"deriveCadenceByNetwork({ network }) -- network must be a string"),Lt(void 0!=n,"deriveCadenceByNetwork({ template }) -- template must be defined"),Lt("object"===typeof n,"deriveCadenceByNetwork({ template }) -- template must be an object"),Lt("InteractionTemplate"===n.f_type,"deriveCadenceByNetwork({ template }) -- template must be an InteractionTemplate"),n.f_version){case"1.1.0":return await Ec({network:t,template:n});case"1.0.0":return await async function(e){var t;let{network:n,template:r}=e;return Lt("1.0.0"===r.f_version,"deriveCadenceByNetwork100({ template }) -- template must be version 1.0.0"),Object.keys(null===r||void 0===r||null===(t=r.data)||void 0===t?void 0:t.dependencies).map((e=>{var t;const i=Object.values(null===r||void 0===r||null===(t=r.data)||void 0===t||null===(t=t.dependencies)||void 0===t?void 0:t[e]);Lt(void 0!==i,"deriveCadenceByNetwork100 -- Could not find contracts for dependency placeholder: ".concat(e)),Lt(i.length>0,"deriveCadenceByNetwork100 -- Could not find contracts for dependency placeholder: ".concat(e));const o=i[0],s=null===o||void 0===o?void 0:o[n];return Lt(s,"deriveCadenceByNetwork100 -- Could not find ".concat(n," network information for dependency: ").concat(e)),[e,null===s||void 0===s?void 0:s.address]})).reduce(((e,t)=>{let[n,r]=t;const i=new RegExp("(\\b"+n+"\\b)","g");return e.replace(i,r)}),r.data.cadence)}({network:t,template:n});default:throw new Error("deriveCadenceByNetwork Error: Unsupported template version")}}function Sc(){return{config:Yn(),sdk:{send:Ua,decode:Ma,subscribe:Da,subscribeRaw:La,account:Ka,block:Ga,resolve:ka}}}let xc={},Ic=!1;function Oc(e){return async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=await e.config.get("flow.network"),r=await e.config.get("env");r&&!Ic&&(Bt.deprecate({pkg:"FCL",subject:'Using the "env" configuration key for specifying the flow network',message:"Configuring to specify flow network is no longer required",transition:"https://github.com/onflow/flow-js-sdk/blob/master/packages/fcl/TRANSITIONS.md#0001-deprecate-env-config-key"}),Ic=!0);const i=t.node||await e.config.get("accessNode.api");if(!i){if(n)return n;if(r)return r;throw new Error('Either the "accessNode.api" config key or opts.node must be set')}if(xc[i])try{return await xc[i]}catch{}xc[i]||(xc[i]=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(await e.sdk.send([Ko([Io,e=>so(e)])],t).then(e.sdk.decode)).chainId}(e,t).catch((e=>{throw xc[i]=null,e})));try{return await xc[i]}catch(Mz){if(n)return n;if(r)return r;throw new Error("Error getting chainId from access node - are you using the correct access node endpoint. If running locally, is your emulator up-to-date? ".concat(Mz.message))}}}const Ac=Oc(Sc());async function Tc(e,t){pc(null===t||void 0===t?void 0:t.template)&&(t.template=await async function(e,t){let{url:n}=t;Lt("undefined"!==typeof n,"retrieve({ url }) -- url must be defined"),Lt("string"===typeof n,"retrieve({ url }) -- url must be a string");const r=await e.config.where(/^document\.resolver\./);Object.keys(r).map((e=>{const t=r[e],n=e.replace(/^document\.resolver\./,"");wc.set(n,t)}));const i=/^(.*):\/\/([A-Za-z0-9\-\.]+)(:[0-9]+)?(.*)$/.exec(n);Lt(i,"Failed to parse URL");const o=i[1];Lt(i,"Failed to parse URL protocol");const s=wc.get(o);return Lt(s,"No resolver found for protcol=".concat(o)),await s({url:n})}(e,{url:null===t||void 0===t?void 0:t.template}));const n=t.cadence||await _c({template:t.template,network:await Oc(e)(t)});return t.cadence=n,t}function Rc(e){return async function(){var t;let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return await async function(e,t){return vc(e,"query",t)}(e,n),n=await Tc(e,n),e.sdk.send([tc(n.cadence),Qa(mc(n.args||[])),Ha(null!==(t=n.isSealed)&&void 0!==t&&t),n.limit&&"number"===typeof n.limit&&Xa(n.limit)])}}Sc();function kc(e){return async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Rc(e)(t).then(e.sdk.decode)}}Sc();const Pc={"HTTP/RPC":"HTTP/RPC","HTTP/POST":"HTTP/POST","IFRAME/RPC":"IFRAME/RPC","POP/RPC":"POP/RPC","TAB/RPC":"TAB/RPC","EXT/RPC":"EXT/RPC","DEEPLINK/RPC":"DEEPLINK/RPC"},Cc={f_type:"Service",f_vsn:"1.0.0"},Nc={f_type:"Identity",f_vsn:"1.0.0"},Uc={f_type:"USER",f_vsn:"1.0.0"},Bc={f_type:"PollingResponse",f_vsn:"1.0.0"},Lc={f_type:"CompositeSignature",f_vsn:"1.0.0"};const Dc=e=>((e,t)=>Xn.Buffer.from(e.padStart(2*t,"0"),"hex"))(e,8),jc=e=>Xn.Buffer.from(e,"hex"),Mc=function(e){let{address:t,nonce:n,appIdentifier:r}=e,i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Lt(!!t,"Encode Message For Provable Authn Error: address must be defined"),Lt(!!n,"Encode Message For Provable Authn Error: nonce must be defined"),Lt(!!r,"Encode Message For Provable Authn Error: appIdentifier must be defined"),Lt(n.length>=64,"Encode Message For Provable Authn Error: nonce must be minimum of 32 bytes");const o=((e,t)=>Xn.Buffer.from(e.padEnd(2*t,"0"),"hex"))(Xn.Buffer.from("FCL-ACCOUNT-PROOF-V0.0").toString("hex"),32);return i?Xn.Buffer.concat([o,Qn([r,Dc(nr(t)),jc(n)])]).toString("hex"):Qn([r,Dc(nr(t)),jc(n)]).toString("hex")};const Fc="USER_SIGNATURE",zc=e=>{if(e.appIdentifier){const{appIdentifier:t,address:n,nonce:r,signatures:i}=e;return Lt(pc(t),"verifyAccountProof({ appIdentifier }) -- appIdentifier must be a string"),Lt(pc(n)&&16===nr(n).length,"verifyAccountProof({ address }) -- address must be a valid address"),Lt(/^[0-9a-f]+$/i.test(r),"nonce must be a hex string"),Lt(Array.isArray(i)&&i.every(((e,t,n)=>"CompositeSignature"===e.f_type)),"Must include an Array of CompositeSignatures to verify"),Lt(i.map((e=>e.addr)).every(((e,t,n)=>e===n[0])),"User signatures to be verified must be from a single account address"),!0}{const{message:t,address:n,compSigs:r}=e;return Lt(/^[0-9a-f]+$/i.test(t),"Signed message must be a hex string"),Lt(pc(n)&&16===nr(n).length,"verifyUserSignatures({ address }) -- address must be a valid address"),Lt(Array.isArray(r)&&r.every(((e,t,n)=>"CompositeSignature"===e.f_type)),"Must include an Array of CompositeSignatures to verify"),Lt(r.map((e=>e.addr)).every(((e,t,n)=>e===n[0])),"User signatures to be verified must be from a single account address"),!0}},qc=async(e,t,n)=>{const r="ACCOUNT_PROOF"===t?"verifyAccountProofSignatures":"verifyUserSignatures",i=await Oc(e)(n),o=n.fclCryptoContract||{testnet:"0x74daa6f9c7ef24b1",mainnet:"0xb4b82a1c9d21d284",previewnet:"0x40b5b8b2ce81ea4a"}[i];return Lt(o,"".concat(r,"({ fclCryptoContract }) -- FCLCrypto contract address is unknown for network: ").concat(i,". Please manually specify the FCLCrypto contract address.")),"\n import FCLCrypto from ".concat(o,"\n\n access(all) fun main(\n address: Address, \n message: String, \n keyIndices: [Int], \n signatures: [String]\n ): Bool {\n return FCLCrypto.").concat(r,"(address: address, message: message, keyIndices: keyIndices, signatures: signatures)\n }\n ")};function Hc(e){return async function(t,n){let{address:r,nonce:i,signatures:o}=n,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};zc({appIdentifier:t,address:r,nonce:i,signatures:o});const a=Mc({address:r,nonce:i,appIdentifier:t},!1),c=[],l=[];for(const e of o)c.push(e.signature),l.push(e.keyId.toString());return kc(e)({cadence:await qc(e,"ACCOUNT_PROOF",s),args:(e,t)=>[e(rr(r),t.Address),e(a,t.String),e(l,t.Array(t.Int)),e(c,t.Array(t.String))]})}}function Vc(e){return async function(t,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=rr(n[0].addr);zc({message:t,address:i,compSigs:n});const o=[],s=[];for(const e of n)o.push(e.signature),s.push(e.keyId.toString());return kc(e)({cadence:await qc(e,Fc,r),args:(e,n)=>[e(i,n.Address),e(t,n.String),e(s,n.Array(n.Int)),e(o,n.Array(n.String))]})}}Sc();const Kc=Vc(Sc());Bt.deprecate({pkg:"FCL",subject:"fcl.verifyUserSignatures()",message:"Please use fcl.AppUtils.verifyUserSignatures()",callback:function(e,t){return Kc(e,t)}});function Wc(e){return async function(t){const n=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).resolve||e.sdk.resolve;return Array.isArray(t)&&await Ko($i(),t),JSON.stringify(sa(await n(t)),null,2)}}Sc();const Gc=/\[Error Code: (\d+)\]/;class Yc extends Error{constructor(e,t){super(e),this.code=t,this.type=Yt[t]}static fromErrorMessage(e){const t=e.match(Gc),n=t?parseInt(t[1],10):void 0;return new Yc(e,n||Yt.UNKNOWN_ERROR)}}async function Zc(e,t){return Object.fromEntries(Object.entries(await e.config.where(t)).map((e=>{let[n,r]=e;return[n.replace(t,""),r]})))}const Xc=e=>5===e.status,Qc=e=>e.status>=4,Jc=e=>e.status>=3,$c=e=>e.status>=2,el=e=>e.status>=1,tl=(e,t)=>{if(e===t)return!0;if("object"!==typeof e||"object"!==typeof t)return!1;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(!tl(e[n],t[n]))return!1;return!0},nl=(e,t)=>!tl(e,t),rl=e=>{if("object"===typeof e&&(e=e.transactionId),null==e)throw new Error("transactionId required");return e},il=/^[0-9a-fA-F]{64}$/,ol="POLL",sl="TIMEOUT";const al=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{[$t]:async t=>{setTimeout((()=>t.sendSelf(sl)),e.txNotFoundTimeout),t.sendSelf(ol)},[en]:(e,t)=>{e.subscribe(t.from),e.send(t.from,nn,e.all())},[tn]:(e,t)=>{e.unsubscribe(t.from)},[rn]:async(e,t)=>{t.reply(e.all())},[sl]:async t=>{0===Object.keys(t.all()).length&&t.fatalError(new Error("TX status polling failed: no transaction was found within timeout interval (".concat(e.txNotFoundTimeout,"ms)")))},[ol]:async t=>{const n=()=>setTimeout((()=>t.sendSelf(ol)),e.pollRate);let r;const i=t.all();try{r=await(async e=>Ua([Za(e)]).then(Ma))(t.self())}catch(Mz){const r=Mz instanceof yr&&404===Mz.statusCode,i=Mz.code===oc.grpc.Code.NotFound;return r||i?n():t.fatalError(Mz)}Qc(r)||n(),nl(i,r)&&t.broadcast(nn,r),t.merge(r)}}},cl=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t=>fn(al(e),rl(t))};function ll(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{txNotFoundTimeout:12500,pollRate:1e3};const n=rl(e),r=il.test(n),i=/^\d+$/.test(o=n)&&64!==o.length;var o;if(!r&&!i)throw new Error("Invalid transactionId");function s(n){return pn(rl(e),cl(t),n)}function a(e){return function(){const t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).suppress||!1;return new Promise(((n,r)=>{const i=s(((o,s)=>{if(!s&&!o.statusCode||t)e(o)&&(n(o),i());else if(null!=s)r(s),i();else if(1===o.statusCode){const e=Yc.fromErrorMessage(o.errorMessage);r(e),i()}}))}))}}return{snapshot:function(){return gn(e,cl(t))},subscribe:s,onceFinalized:a($c),onceExecuted:a(Jc),onceSealed:a(Qc)}}ll.isUnknown=e=>e.status>=0,ll.isPending=el,ll.isFinalized=$c,ll.isExecuted=Jc,ll.isSealed=Qc,ll.isExpired=Xc;const ul="local",dl=new Map;function fl(e){return/^\d+$/.test(e)&&64!==e.length}function hl(e){function t(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{txNotFoundTimeout:12500,pollRate:1e3};const r=rl(t),i=il.test(r),o=fl(r);if(!i&&!o)throw new Error("Invalid transactionId");function s(){let r=dl.get(t);return r||(function(e,t,n){const r=new Set;let i={blockId:"",status:Xt.UNKNOWN,statusCode:0,errorMessage:"",events:[],statusString:""};async function o(){if(fl(rl(t)))return void a();await Oc(e)()===ul?(console.warn("Events are not supported on the Flow emulator, falling back to legacy polling."),a()):s()}function s(){const n=e.sdk.subscribe({topic:Zt.TRANSACTION_STATUSES,args:{transactionId:t},onData:e=>{nl(i,e)&&c(e),Qc(e)&&new Promise((e=>setTimeout(e,0))).then((()=>{Qc(e)&&n.unsubscribe()}))},onError:e=>{e instanceof us?(console.warn("Failed to subscribe to transaction status updates using real-time streaming (are you using the deprecated GRPC transport?), falling back to polling."),a()):l(e)}})}function a(){const e=ll(t,n).subscribe(((t,n)=>{n?l(n):t&&nl(i,t)&&(c(t),Qc(t)&&new Promise((e=>setTimeout(e,0))).then((()=>{e()})))}))}function c(e){for(const t of r)try{t.onData(e)}catch(l){console.error("Error in transaction observer",l)}}function l(e){for(const t of r)try{t.onError(e)}catch(l){console.error("Error in transaction observer",l)}}return o().catch(l),{subscribe(e,t){const n={onData:e,onError:t||(()=>{})};return r.add(n),e(i),{unsubscribe:()=>r.delete(n)}},get value(){return i}}}(e,t,n),dl.set(t,r)),r}function a(e,t){const n=s(),{unsubscribe:r}=n.subscribe(e,t);return()=>r()}function c(e){return function(){const t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{suppress:!1}).suppress||!1;return new Promise(((n,r)=>{const i=a((t=>{if(1===t.statusCode){const e=Yc.fromErrorMessage(t.errorMessage);r(e),i()}else e(t)&&(n(t),i())}),(e=>{t||(r(e),i())}))}))}}return{snapshot:function(){return Promise.resolve(s().value)},subscribe:a,onceFinalized:c($c),onceExecuted:c(Jc),onceSealed:c(Qc)}}return t.isUnknown=Ro,t.isPending=el,t.isFinalized=$c,t.isExecuted=Jc,t.isSealed=Qc,t.isExpired=Xc,t}Sc();const pl="TICK",gl="hwm",yl=async(e,t)=>setTimeout((()=>t.sendSelf(pl)),await e.config.get("fcl.eventPollRate",1e4));const ml=(e,t)=>fn(function(e){const t={[pl]:async t=>{if(!t.hasSubs())return;let n=t.get(gl);if(null==n)t.put(gl,await e.sdk.block()),t.put(pl,await yl(e,t));else{let s=await e.sdk.block();if(t.put(gl,s),n.height<s.height){const a=await e.sdk.send([(r=t.self(),i=n.height+1,o=s.height,Ko([wo,e=>(e.events.eventType=r,e.events.start=i,e.events.end=o,so(e))]))]).then(e.sdk.decode);for(let e of a)t.broadcast("UPDATED",e)}t.put(pl,await yl(e,t))}var r,i,o},[en]:async(t,n)=>{t.hasSubs()||t.put(pl,await yl(e,t)),t.subscribe(n.from)},[tn]:(e,t)=>{e.unsubscribe(t.from),e.hasSubs()||(clearTimeout(e.get(pl)),e.delete(pl),e.delete(gl))}};return t}(e),t);const vl="local";function bl(e){return function(t){let n;return{subscribe:function(r){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e=>{console.error("Unhandled error in event subscription:",e)},o=()=>{},s=()=>{};function a(){if("string"!==typeof t)throw new Error("Legacy fcl.events fallback only supports string filters (single event type)");(function(e){return function(t){return{subscribe:n=>pn(t,(t=>ml(e,t)),n)}}})(e)(t).subscribe(((e,t)=>{t?i(t):e&&r(e)}))}const c=async function(){await Oc(e)()===vl?(console.warn("Events are not supported on the Flow emulator, falling back to legacy polling."),a()):function(){const{unsubscribe:t}=e.sdk.subscribe({topic:Zt.EVENTS,args:n,onData:e=>{r(e)},onError:e=>{e instanceof us?(console.warn("Failed to subscribe to events using real-time streaming (are you using the deprecated GRPC transport?), falling back to legacy polling."),a()):i(e)}});t}()}().catch((e=>{i(e)}));return()=>{c.finally((()=>{o(),s()}))}}}}}Sc();const wl=()=>{throw new Error("Platform specific Core Strategies are not initialized")},El={[Pc["EXT/RPC"]]:wl,[Pc["HTTP/POST"]]:wl,[Pc["IFRAME/RPC"]]:wl,[Pc["POP/RPC"]]:wl,[Pc["TAB/RPC"]]:wl,[Pc["EXT/RPC"]]:wl},_l=["ServicePlugin"],Sl=["discovery-service"],xl=e=>{let{coreStrategies:t}=e,n=new Set,r=new Map(Object.entries(t));const i=e=>n=new Set([...e]);return Object.freeze({add:e=>{if(Lt(Sl.includes(e.type),"Service Plugin type ".concat(e.type," is not supported")),"discovery-service"===e.type){const{discoveryServices:t,serviceStrategy:n}=(e=>{const{services:t=[],serviceStrategy:n}=e;Lt(Array.isArray(t),"Services must be an array");for(const r of t)Lt(fc(r.f_type)&&"Service"===r.f_type,"Service is required"),Lt(fc(r.type)&&"authn"===r.type,"Service must be type authn. Received ".concat(r.type)),Lt(r.method in Pc||n.method===r.method,"Service method ".concat(r.method," is not supported"));return Lt(fc(n),"Service strategy is required"),Lt(fc(n.method)&&pc(n.method),"Service strategy method is required"),Lt(fc(n.exec)&&gc(n.exec),"Service strategy exec function is required"),{discoveryServices:t,serviceStrategy:n}})(e);i(t),r.has(n.method)?Bt({title:"Add Service Plugin",message:"Service strategy for ".concat(n.method," already exists"),level:Ut.warn}):r.set(n.method,n.exec)}},getServices:()=>[...n],getStrategy:e=>r.get(e),getStrategies:()=>[...r.keys()]})};let Il;const Ol=()=>"undefined"!==typeof Il,Al=e=>{let{coreStrategies:t}=e;if(Ol())return Il;const n=xl({coreStrategies:t});return Il=n,n},Tl=()=>Ol()?Il:(console.warn("Registry is not initialized, it will be initialized with stub core strategies"),Al({coreStrategies:El})),Rl=(()=>{const e=new Map;return Object.freeze({add:t=>{const n=(e=>{let t;Lt(!!e,"No plugins supplied"),t=Array.isArray(e)?[...e]:[e];for(const n of t)Lt(fc(n.name),"Plugin name is required"),Lt(fc(n.f_type),"Plugin f_type is required"),Lt(_l.includes(n.f_type),"Plugin type ".concat(n.f_type," is not supported"));return t})(t);for(const r of n)e.set(r.name,r),"ServicePlugin"===r.f_type&&Il.add(r)},getPlugins:()=>e})})(),kl=async()=>{var e;return[...(null===(e=window)||void 0===e?void 0:e.fcl_extensions)||[],...Tl().getServices()]};let Pl=!1;const Cl=globalThis.URL;let Nl=class extends Cl{constructor(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];super(e,t,...r),Pl&&this._url&&!e.toString().endsWith("/")&&this._url.endsWith("/")&&(this._url=this._url.slice(0,-1))}};const Ul="authn",Bl="SNAPSHOT",Ll="UPDATED",Dl="UPDATE_RESULTS",jl=async e=>{try{const t=await async function(e){var t;let{context:n,types:r}=e;const i=await n.config.get("discovery.authn.endpoint");Lt(Boolean(i),'"discovery.authn.endpoint" in config must be defined.');const o=await n.config.get("discovery.authn.include",[]),s=await n.config.get("discovery.authn.exclude",[]),a=new Nl(i);return fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:r,fclVersion:uc,include:o,exclude:s,features:{suggested:await n.config.get("discovery.features.suggested",[])},clientServices:await kl(),supportedStrategies:Tl().getStrategies(),userAgent:null===(t=window)||void 0===t||null===(t=t.navigator)||void 0===t?void 0:t.userAgent,network:await Ac()})}).then((e=>e.json()))}({context:e,types:[Ul]});dn(Ul,Dl,{results:t})}catch(t){Bt({title:"".concat(t.name," Error fetching Discovery API services."),message:t.message,level:Ut.error})}};function Ml(e){return{[$t]:async t=>{var n,r;n="undefined"===typeof window,r='"fcl.discovery" is only available in the browser.',n&&console.warn("\n %cFCL Warning\n ============================\n ".concat(r,"\n For more info, please see the docs: https://docs.onflow.org/fcl/\n ============================\n "),"font-weight:bold;font-family:monospace;"),"complete"===document.readyState?jl(e):window.addEventListener("load",(()=>{jl(e)}))},[Dl]:(e,t,n)=>{e.merge(n),e.broadcast(Ll,{...e.all()})},[en]:(e,t)=>{e.subscribe(t.from),e.send(t.from,Ll,{...e.all()})},[tn]:(e,t)=>e.unsubscribe(t.from),[Bl]:async(e,t)=>t.reply({...e.all()})}}const Fl=e=>fn(Ml(e),Ul);function zl(e){return{subscribe:t=>pn(Ul,(()=>Fl(e)),t),snapshot:()=>gn(Ul,(()=>Fl(e))),update:()=>{"complete"===document.readyState&&jl(e)}}}const ql={authn:zl(Sc())};function Hl(e){const t=new Gr.KN(256);return t.update(Xn.Buffer.from(e,"utf8")),t.digest("hex")}function Vl(e){let{contractName:t,address:n}=e;return{contractName:t,address:n,contract:""}}function Kl(e){const t=[],n=e.match(/import ((\w|,| )+)* from 0x\w+/g)||[];for(const r of n){const e=/import ((\w+|, |)*) from (0x\w+)/g.exec(r),n=/((?:\w+)+),?/g,i=(null===e||void 0===e?void 0:e[1].match(n))||[];for(const r of i)t.push(Vl({address:null===e||void 0===e?void 0:e[3],contractName:r.replace(/,/g,"")}))}return t}function Wl(e){return async function(t){let{address:n,contractName:r}=t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ic(void 0!=n,"generateDependencyPin({ address }) -- address must be defined"),ic(void 0!=r,"generateDependencyPin({ contractName }) -- contractName must be defined"),ic("string"===typeof n,"generateDependencyPin({ address }) -- address must be a string"),ic("string"===typeof r,"generateDependencyPin({ contractName }) -- contractName must be a string");const o=[Vl({contractName:r,address:n})];for(const c of o){var s;const t=await e.sdk.send([ts(await e.config.get(c.address,c.address))],i).then(e.sdk.decode);if(c.contract=null===t.contracts||void 0===s?void 0:s[c.contractName],!c.contract)throw console.error("Did not find expected contract",c,t),new Error("Did not find expected contract");const n=Kl(c.contract);o.push(...n)}const a=o.map((e=>Hl(e.contract)));return Hl((await Promise.all(a)).join(""))}}Sc();async function Gl(e,t,n){const r=[];for(const i of n){const n=[Hl(i.network)],{address:o,dependency_pin_block_height:s}=i;if(i.dependency_pin){const r=await Wl(e)({address:o,contractName:t,blockHeight:s});n.push(Hl(r))}r.push(n)}return r}async function Yl(e,t){const n=[];for(let r=0;r<t.length;r++){const i=t[r],o=[];for(let t=0;t<(null===i||void 0===i?void 0:i.contracts.length);t++){const n=null===i||void 0===i?void 0:i.contracts[t],r=null===n||void 0===n?void 0:n.contract;o.push(Hl(r));const s=await Gl(e,r,null===n||void 0===n?void 0:n.networks);o.push(s)}n.push(o)}return n}function Zl(e){return async function(t){var n;let{template:r}=t;Lt(!!r,"generateTemplateId({ template }) -- template must be defined"),Lt("object"===typeof r,"generateTemplateId({ template }) -- template must be an object"),Lt("InteractionTemplate"===r.f_type,"generateTemplateId({ template }) -- template object must be an InteractionTemplate"),Lt("1.1.0"===r.f_version,"generateTemplateId({ template }) -- template object must be an version 1.1.0");const i=r.data,o=await Promise.all(i.messages.map((async e=>[Hl(e.key),await Promise.all(e.i18n.map((async e=>[Hl(e.tag),Hl(e.translation)])))]))),s=await Promise.all(null===i||void 0===i?void 0:i.parameters.sort(((e,t)=>e.index-t.index)).map((async e=>[Hl(e.label),[Hl(String(e.index)),Hl(e.type),await Promise.all(e.messages.map((async e=>[Hl(e.key),await Promise.all(e.i18n.map((async e=>[Hl(e.tag),Hl(e.translation)])))])))]]))),a=[await Yl(e,null===i||void 0===i?void 0:i.dependencies)],c=Qn([Hl(null===r||void 0===r?void 0:r.f_type),Hl(null===r||void 0===r?void 0:r.f_version),Hl(null===i||void 0===i?void 0:i.type),Hl(null===i||void 0===i?void 0:i.interface),o,Hl(null===i||void 0===i||null===i.cadence||void 0===n?void 0:n.body),[a],s]).toString("hex");return Hl(c)}}Sc();function Xl(e){return async function(t){let{address:n,contractName:r}=t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ic(void 0!=n,"generateDependencyPin({ address }) -- address must be defined"),ic(void 0!=r,"generateDependencyPin({ contractName }) -- contractName must be defined"),ic("string"===typeof n,"generateDependencyPin({ address }) -- address must be a string"),ic("string"===typeof r,"generateDependencyPin({ contractName }) -- contractName must be a string");const o=[Vl({contractName:r,address:n})];for(const c of o){var s;const t=await e.sdk.send([ts(await e.config.get(c.address,c.address))],i).then(e.sdk.decode);if(c.contract=null===t.contracts||void 0===s?void 0:s[c.contractName],!c.contract)throw console.error("Did not find expected contract",c,t),new Error("Did not find expected contract");const n=Kl(c.contract);o.push(...n)}const a=o.map((e=>Hl(e.contract)));return Hl(a.join(""))}}Sc();const Ql=e=>async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{await async function(e,t){return vc(e,"mutate",t)}(e,t),t=await Tc(e,t);const n=await e.config.get("fcl.authz",e.currentUser.authorization);return e.sdk.send([rc(t.cadence),Qa(mc(t.args||[])),t.limit&&yc(t.limit)&&Xa(t.limit),$a(t.proposer||t.authz||n),ec(t.payer||t.authz||n),Ya(t.authorizations||[t.authz||n])]).then(e.sdk.decode)}catch(n){throw n}};function Jl(e){return null==e?null:e.f_vsn?"1.0.0"===e.f_vsn?e:null:{...Lc,addr:nr(e.addr||e.address),signature:e.signature||e.sig,keyId:e.keyId,...e.extensionData?{extensionData:e.extensionData}:{}}}function $l(e){return null==e?null:e.f_vsn?"1.0.0"===e.f_vsn?e:null:{old:e,...Cc,type:"frame",endpoint:e.endpoint,params:e.params||{},data:e.data||{}}}function eu(e){return null==e?null:e.f_vsn?"1.0.0"===e.f_vsn?e:null:{...Cc,type:"back-channel-rpc",endpoint:e.endpoint,method:e.method,params:e.params||{},data:e.data||{}}}function tu(e){return null==e?null:(null==e.method&&(e={...e,type:"local-view",method:"VIEW/IFRAME"}),e.f_vsn?"1.0.0"===e.f_vsn?e:null:{...Cc,type:e.type||"local-view",method:e.method,endpoint:e.endpoint,data:e.data||{},params:e.params||{}})}function nu(e,t){return e.map((e=>function(e,t){try{return ru[e.type](e,t)}catch(n){return console.error("Unrecognized FCL Service Type [".concat(e.type,"]"),e,n),e}}(e,t))).filter(Boolean)}const ru={"back-channel-rpc":eu,"pre-authz":function(e){return null==e?null:e.f_vsn?"1.0.0"===e.f_vsn?e:null:{...Cc,type:e.type,uid:e.id,endpoint:e.endpoint,method:e.method,identity:{...Nc,address:rr(e.addr),keyId:e.keyId},params:e.params,data:e.data}},authz:function(e){return null==e?null:e.f_vsn?"1.0.0"===e.f_vsn?e:null:{...Cc,type:e.type,uid:e.id,endpoint:e.endpoint,method:e.method,identity:{...Nc,address:rr(e.addr),keyId:e.keyId},params:e.params,data:e.data}},authn:function(e){return null==e?null:e.f_vsn?"1.0.0"===e.f_vsn?e:null:{...Cc,type:e.type,uid:e.id,endpoint:e.authn,id:e.pid,provider:{address:rr(e.addr),name:e.name,icon:e.icon}}},frame:$l,"open-id":function(e){return null==e?null:"1.0.0"===e.f_vsn?e:null},"user-signature":function(e){if(null==e)return null;if(!e.f_vsn)throw new Error("Invalid user-signature service");return"1.0.0"===e.f_vsn?e:null},"local-view":tu,"account-proof":function(e){if(null==e)return null;if(!e.f_vsn)throw new Error("FCL Normalizer Error: Invalid account-proof service");return"1.0.0"===e.f_vsn?e:null},"authn-refresh":function(e){if(null==e)return null;if(!e.f_vsn)throw new Error("Invalid authn-refresh service");return"1.0.0"===e.f_vsn?e:null}};function iu(){let e=arguments.length>1?arguments[1]:void 0;return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).reduce(((t,n)=>n.type===e&&(!t||lc(n.f_vsn,t.f_vsn)>0)?n:t),null)}function ou(e){var t,n;return Qn([(null===(t=e.provider)||void 0===t?void 0:t.address)||(null===(n=e.provider)||void 0===n?void 0:n.name)||"UNSPECIFIED",e.id]).toString("hex")}async function su(e){var t=nu(function(){return[...arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],...arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]]}((e=function(e){return e.addr=e.addr?rr(e.addr):null,e.paddr=e.paddr?rr(e.paddr):null,e}(e)).services||[],await async function(e,t){if(null==e||null==t)return[];const n=new Nl(e);n.searchParams.append("code",t);const r=await fetch(n,{method:"GET",headers:{"Content-Type":"application/json"}}).then((e=>e.json()));if(Array.isArray(r))return r;const i=[];if(Array.isArray(r.authorizations))for(let o of r.authorizations)i.push({type:"authz",keyId:r.keyId,...o});return null!=r.provider&&i.push({type:"authn",id:"wallet-provider#authn",...r.provider}),i}(e.hks,e.code)));const n=iu(t,"authn");return{...Uc,addr:rr(e.addr),cid:ou(n),loggedIn:!0,services:t,expiresAt:e.expires}}const au="WC/RPC",cu="undefined"===typeof window;const lu=globalThis.AbortController||n(9118),uu=async e=>{let{service:t,body:n,config:r,abortSignal:i,customRpc:o,user:s,opts:a}=e;return Tl().getStrategy(t.method)({service:t,body:n,config:r,abortSignal:i,customRpc:o,opts:a,user:s})};async function du(e,t){var n,r;let{service:i,msg:o={},config:s={},opts:a={},platform:c,abortSignal:l=(new lu).signal,execStrategy:u,user:d}=t;!function(){if(cu)return;Tl().getStrategies().includes(au)||Bt({title:"FCL WalletConnect Service Plugin",level:Ut.error,message:"All dApps are expected to register for a WalletConnect projectId & add this to their FCL configuration. If you do not do so, users will be unable to use certain wallets to interact with your dApp. See https://developers.flow.com/tools/clients/fcl-js/configure-fcl for more information."})}(),o.data=i.data;const f={services:await Zc(e,/^service\./),app:await Zc(e,/^app\.detail\./),client:{...s.client,platform:c,fclVersion:uc,fclLibrary:"https://github.com/onflow/fcl-js",hostname:null!==(n=null===(r=window)||void 0===r||null===(r=r.location)||void 0===r?void 0:r.hostname)&&void 0!==n?n:null,network:await Oc(e)(a)}};try{const t=await(u||uu)({service:i,body:o,config:f,opts:a,user:d,abortSignal:l});return"REDIRECT"===t.status?(Lt(i.type===t.data.type,"Cannot shift recursive service type in execService"),await du(e,{service:t.data,msg:o,config:f,opts:a,abortSignal:l,platform:c,user:d})):t}catch(h){throw Bt({title:"Error on execService ".concat(null===i||void 0===i?void 0:i.type),message:h,level:Ut.error}),h}}const fu="CURRENT_USER",hu="CURRENT_USER/UPDATED",pu="SNAPSHOT",gu="SET_CURRENT_USER",yu="DEL_CURRENT_USER",mu='{\n "f_type": "User",\n "f_vsn": "1.0.0",\n "addr":null,\n "cid":null,\n "loggedIn":null,\n "expiresAt":null,\n "services":[]\n}',vu=e=>{const t=async()=>e.getStorageProvider?await e.getStorageProvider():await e.config.first(["fcl.storage","fcl.storage.default"],void 0);return{[$t]:async e=>{"undefined"===typeof window&&console.warn('\n %cFCL Warning\n ============================\n "currentUser" is only available in the browser.\n For more info, please see the docs: https://docs.onflow.org/fcl/\n ============================\n ',"font-weight:bold;font-family:monospace;"),e.merge(JSON.parse(mu));const n=await t();if(n.can){const t=await(async e=>{const t=JSON.parse(mu),n=await e.get(fu);return null!=n&&t.f_vsn!==n.f_vsn?(e.removeItem(fu),t):n||t})(n);(function(e){return null==e.expiresAt||0===e.expiresAt||e.expiresAt>Date.now()})(t)&&e.merge(t)}},[en]:(e,t)=>{e.subscribe(t.from),e.send(t.from,hu,{...e.all()})},[tn]:(e,t)=>{e.unsubscribe(t.from)},[pu]:async(e,t)=>{t.reply({...e.all()})},[gu]:async(e,n,r)=>{e.merge(r);const i=await t();i.can&&i.put(fu,e.all()),e.broadcast(hu,{...e.all()})},[yu]:async(e,n)=>{e.merge(JSON.parse(mu));const r=await t();r.can&&r.put(fu,e.all()),e.broadcast(hu,{...e.all()})}}},bu=e=>{fn(vu(e),e.actorName)};const wu=async e=>{let{discoveryAuthnInclude:t,discoveryAuthnExclude:n,discoveryFeaturesSuggested:r}=e;return{client:{discoveryAuthnInclude:t,discoveryAuthnExclude:n,discoveryFeaturesSuggested:r,clientServices:await kl(),supportedStrategies:Tl().getStrategies()}}},Eu=e=>async function(){var t,n;let{service:r,redir:i=!1,forceReauth:o=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!r||null!==r&&void 0!==r&&null!==(t=r.provider)&&void 0!==t&&t.is_installed||null===r||void 0===r||null===(n=r.provider)||void 0===n||!n.requires_install)return new Promise((async(t,n)=>{bu(e);const s={redir:i},a=await Iu(e)(),c=iu(a.services,"authn-refresh");let l;if(a.loggedIn&&!o){if(!c)return t(a);try{const t=await du(e,{service:c,msg:l,opts:s,platform:e.platform,user:a});dn(e.actorName,gu,await su(t))}catch(d){Bt({title:"".concat(d.name," Could not refresh wallet authentication."),message:d.message,level:Ut.error})}finally{return t(await Iu(e)())}}try{l=await async function(e){var t;let n=await e.config.get("fcl.accountProof.resolver");if(null==n)return;if(!(e=>"function"===typeof e)(n))return void Bt({title:"Account Proof Data Resolver must be a function",message:"Check fcl.accountProof.resolver configuration.\n Expected: fcl.accountProof.resolver: async () => { ... }\n Received: fcl.accountProof.resolver: ".concat(typeof n,"\n "),level:Ut.warn});const r={...await n()},i=null===(t=window)||void 0===t||null===(t=t.location)||void 0===t?void 0:t.origin;return r.appIdentifier?i&&(Bt.deprecate({pkg:"FCL",subject:"appIdentifier in fcl.accountProof.resolver",message:"Manually set app identifiers in the account proof resolver function are now deprecated. These are now automatically set to the application origin URL by FCL",transition:"https://github.com/onflow/flow-js-sdk/blob/master/packages/fcl/TRANSITIONS.md#0002-deprecate-appIdentifier-field-in-account-proof-resolver"}),Lt("string"===typeof r.appIdentifier,"appIdentifier must be a string")):(Lt(i,"The appIdentifier (origin) could not be inferred from the window.location.origin. Please set the appIdentifier manually in the fcl.accountProof.resolver function."),r.appIdentifier=i),Lt(/^[0-9a-f]+$/i.test(r.nonce),"Nonce must be a hex string"),r}(e)}catch(d){return Bt({title:"".concat(d.name," On Authentication: Could not resolve account proof data."),message:d.message,level:Ut.error}),n(d)}try{var u;const t=await async function(e,t){var n;const r=await e.config.get("discovery.authn.include",[]),i=await e.config.get("discovery.authn.exclude",[]),o=await e.config.get("discovery.features.suggested",[]),s=await e.config.first(["discovery.wallet.method","discovery.wallet.method.default"],void 0),a=null!==t&&void 0!==t&&t.method?t.method:s,c=null!==(n=null===t||void 0===t?void 0:t.endpoint)&&void 0!==n?n:await e.config.first(["discovery.wallet","challenge.handshake"],void 0);return Lt(c,'\n If no service is passed to "authenticate," then "discovery.wallet" must be defined in fcl config.\n See: "https://docs.onflow.org/fcl/reference/api/#setting-configuration-values"\n '),{...t,type:"authn",endpoint:c,method:a,discoveryAuthnInclude:r,discoveryAuthnExclude:i,discoveryFeaturesSuggested:o}}(e,r),n=await du(e,{service:t,msg:l,config:await wu(t),opts:s,platform:e.platform,execStrategy:null===(u=e.discovery)||void 0===u?void 0:u.execStrategy,user:a});dn(e.actorName,gu,await su(n))}catch(d){Bt({title:"".concat(d," On Authentication"),message:d,level:Ut.error})}finally{t(await Iu(e)())}}));var s;window.location.href=null===r||void 0===r||null===(s=r.provider)||void 0===s?void 0:s.install_link};function _u(e){return function(){bu(e),dn(e.actorName,yu)}}const Su=e=>async t=>(bu(e),{...t,tempId:"CURRENT_USER",async resolve(t,n){const r=await Eu(e)({redir:!0}),i=iu(r.services,"authz"),o=iu(r.services,"pre-authz");if(o)return(e=>(t,n)=>{let{user:r}=n;const i=(e=>({f_type:"PreAuthzResponse",f_vsn:"1.0.0",proposer:(e||{}).proposer,payer:(e||{}).payer||[],authorization:(e||{}).authorization||[]}))(t),o=[];null!=i.proposer&&o.push(["PROPOSER",i.proposer]);for(let e of i.payer||[])o.push(["PAYER",e]);for(let e of i.authorization||[])o.push(["AUTHORIZER",e]);return o.map((t=>{let[n,i]=t;return{tempId:[i.identity.address,i.identity.keyId].join("|"),addr:i.identity.address,keyId:i.identity.keyId,signingFunction:t=>du(e,{service:i,msg:t,platform:e.platform,user:r}),role:{proposer:"PROPOSER"===n,payer:"PAYER"===n,authorizer:"AUTHORIZER"===n}}}))})(e)(await du(e,{service:o,msg:n,platform:e.platform,user:r}),{user:r});if(i)return{...t,tempId:"CURRENT_USER",resolve:null,addr:nr(i.identity.address),keyId:i.identity.keyId,sequenceNum:null,signature:null,signingFunction:async t=>Jl(await du(e,{service:i,msg:t,opts:{includeOlderJsonRpcCall:!0},platform:e.platform,user:r}))};throw new Error("No Authz or PreAuthz Service configured for CURRENT_USER")}});function xu(e){return function(t){bu(e);const n="@EXIT",r=fn((async r=>{for(r.send(e.actorName,en);;){const i=await r.receive();if(i.tag===n)return void r.send(e.actorName,tn);t(i.data)}}));return()=>dn(r,n)}}function Iu(e){return function(){return bu(e),dn(e.actorName,pu,null,{expectReply:!0,timeout:0})}}const Ou=e=>async()=>{const{addr:t}=await Eu(e)();return Ja(rr(t),Li)},Au=e=>(Lt(/^[0-9a-f]+$/i.test(e),"Message must be a hex string"),{message:e}),Tu=e=>async t=>{bu(e);const n=await Eu(e)({redir:!0}),r=iu(n.services,"user-signature");Lt(r,"Current user must have authorized a signing service.");try{const i=await du(e,{service:r,msg:Au(t),platform:e.platform,user:n});return Array.isArray(i)?i.map((e=>Jl(e))):[Jl(i)]}catch(i){return i}},Ru=e=>{const t={authenticate:Eu(e),unauthenticate:_u(e),authorization:Su(e),signUserMessage:Tu(e),subscribe:xu(e),snapshot:Iu(e),resolveArgument:Ou(e)};return Object.assign((()=>({...t})),{...t})};function ku(e){var t;const n=new Nl(e.endpoint);if(null!==(t=window)&&void 0!==t&&null!==(t=t.location)&&void 0!==t&&t.origin&&n.searchParams.append("l6n",window.location.origin),null!=e.params)for(let[r,i]of Object.entries(e.params||{}))n.searchParams.append(r,i);return n}function Pu(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=t.method||"POST",r="GET"===n?void 0:JSON.stringify(t.data||e.data||{});return fetch(ku(e),{method:n,headers:{...e.headers||{},...t.headers||{},"Content-Type":"application/json"},body:r}).then((e=>e.json()))}function Cu(e){return null==e?null:e.f_vsn?"1.0.0"===e.f_vsn?e:null:{...Bc,status:null!==(t=e.status)&&void 0!==t?t:"APPROVED",reason:null!==(n=e.reason)&&void 0!==n?n:null,data:e.compositeSignature||e.data||{...e}||{},updates:eu(e.authorizationUpdates),local:$l((e.local||[])[0])};var t,n}const Nu={"HTTP/GET":"GET","HTTP/POST":"POST"},Uu=e=>(Lt(Nu[e.method],"Invalid Service Method for type back-channel-rpc",{service:e}),Nu[e.method]);async function Bu(e){var t,n;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>!0;Lt(e,"Missing Polling Service",{service:e});if(!r())throw new Error("Externally Halted");let i;try{if("undefined"!==typeof document&&"hidden"===document.visibilityState)return await new Promise((e=>setTimeout(e,500))),Bu(e,r);i=await Pu(e,{method:Uu(e)}).then(Cu)}catch(o){throw o}switch(null===(t=i)||void 0===t?void 0:t.status){case"APPROVED":return i.data;case"DECLINED":throw new Error("Declined: ".concat(i.reason||"No reason supplied."));default:return await new Promise((e=>setTimeout(e,500))),Bu(null===(n=i)||void 0===n?void 0:n.updates,r)}}const Lu=e=>async t=>{let{service:n,body:r,config:i,opts:o}=t;const s=await Pu(n,{data:{fclVersion:uc,service:{params:n.params,data:n.data,type:n.type},config:i,...r}}).then(Cu);if("APPROVED"===(null===s||void 0===s?void 0:s.status))return s.data;if("DECLINED"===(null===s||void 0===s?void 0:s.status))throw new Error("Declined: ".concat(s.reason||"No reason supplied."));if("REDIRECT"===(null===s||void 0===s?void 0:s.status))return s;if("PENDING"===(null===s||void 0===s?void 0:s.status)){let t=!0,n=!0;const[r,i]=await e(tu(s.local),{serviceEndpoint:ku,onClose:()=>n=!1}),o=()=>{try{i(),n=!1}catch(e){console.error("Frame Close Error",e)}},a=()=>{const e=t;return t=n,e};return Bu(s.updates,a).then((e=>(o(),e))).catch((e=>{throw console.error(e),o(),e}))}throw console.error("Auto Decline: Invalid Response",{service:n,resp:s}),new Error("Auto Decline: Invalid Response")},Du="FCL:VIEW:CLOSE",ju="FCL:VIEW:READY",Mu="FCL:VIEW:RESPONSE",Fu=e=>"string"===typeof e&&e.toLowerCase(),zu=new Set(["monetizationstart","monetizationpending","monetizationprogress","monetizationstop"]),qu=(e,t)=>console.warn("DEPRECATION NOTICE","Received ".concat(e,", please use ").concat(t," for this and future versions of FCL")),Hu=e=>{let t,{close:n,send:r,onReady:i,onResponse:o,onMessage:s,onCustomRpc:a,getSource:c}=e;return e=>{try{t=(null===c||void 0===c?void 0:c())||t}catch(Tt){t=null}try{if("object"!==typeof e.data)return;if(zu.has(e.data.type))return;if(null!=t&&e.source!==t)return;Fu(e.data.type)===Fu(Du)&&n(),Fu(e.data.type)===Fu(ju)&&(i(e,{send:r,close:n}),t||(t=e.source)),Fu(e.data.type)===Fu(Mu)&&o(e,{send:r,close:n}),Fu(e.data.type)===Fu("FCL:VIEW:CUSTOM_RPC")&&a(e.data.payload,{send:r,close:n}),s(e,{send:r,close:n}),Fu(e.data.type)===Fu("FCL:FRAME:READY")&&(qu(e.data.type,ju),i(e,{send:r,close:n}),t||(t=e.source)),Fu(e.data.type)===Fu("FCL:FRAME:RESPONSE")&&(qu(e.data.type,Mu),o(e,{send:r,close:n})),Fu(e.data.type)===Fu("FCL:FRAME:CLOSE")&&(qu(e.data.type,Du),n()),Fu(e.data.type)===Fu("FCL::CHALLENGE::RESPONSE")&&(qu(e.data.type,Mu),o(e,{send:r,close:n})),Fu(e.data.type)===Fu("FCL::AUTHZ_READY")&&(qu(e.data.type,ju),i(e,{send:r,close:n}),t||(t=e.source)),Fu(e.data.type)===Fu("FCL::CHALLENGE::CANCEL")&&(qu(e.data.type,Du),n()),Fu(e.data.type)===Fu("FCL::CANCEL")&&(qu(e.data.type,Du),n())}catch(l){console.error("Frame Callback Error",l),n()}}};var Vu;Vu||(Vu=Sc()),Vu.config.subscribe((()=>{Oc(Vu)({enableRequestLogging:!1}).catch((()=>{}))}));const Ku="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",Wu=Ku.length;function Gu(){let e="",t=32;for(;t--;)e+=Ku[Math.random()*Wu|0];return e}var Yu,Zu,Xu,Qu,Ju,$u,ed,td,nd,rd,id,od={},sd=[],ad=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,cd=Array.isArray;function ld(e,t){for(var n in t)e[n]=t[n];return e}function ud(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function dd(e,t,n,r,i){var o={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==i?++Xu:i,__i:-1,__u:0};return null==i&&null!=Zu.vnode&&Zu.vnode(o),o}function fd(e){return e.children}function hd(e,t){this.props=e,this.context=t}function pd(e,t){if(null==t)return e.__?pd(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?pd(e):null}function gd(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return gd(e)}}function yd(e){(!e.__d&&(e.__d=!0)&&Qu.push(e)&&!md.__r++||Ju!=Zu.debounceRendering)&&((Ju=Zu.debounceRendering)||$u)(md)}function md(){for(var e,t,n,r,i,o,s,a=1;Qu.length;)Qu.length>a&&Qu.sort(ed),e=Qu.shift(),a=Qu.length,e.__d&&(n=void 0,r=void 0,i=(r=(t=e).__v).__e,o=[],s=[],t.__P&&((n=ld({},r)).__v=r.__v+1,Zu.vnode&&Zu.vnode(n),xd(t.__P,n,r,t.__n,t.__P.namespaceURI,32&r.__u?[i]:null,o,null==i?pd(r):i,!!(32&r.__u),s),n.__v=r.__v,n.__.__k[n.__i]=n,Od(o,n,s),r.__e=r.__=null,n.__e!=i&&gd(n)));md.__r=0}function vd(e,t,n,r,i,o,s,a,c,l,u){var d,f,h,p,g,y,m,v=r&&r.__k||sd,b=t.length;for(c=function(e,t,n,r,i){var o,s,a,c,l,u=n.length,d=u,f=0;for(e.__k=new Array(i),o=0;o<i;o++)null!=(s=t[o])&&"boolean"!=typeof s&&"function"!=typeof s?("string"==typeof s||"number"==typeof s||"bigint"==typeof s||s.constructor==String?s=e.__k[o]=dd(null,s,null,null,null):cd(s)?s=e.__k[o]=dd(fd,{children:s},null,null,null):void 0===s.constructor&&s.__b>0?s=e.__k[o]=dd(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[o]=s,c=o+f,s.__=e,s.__b=e.__b+1,a=null,-1!=(l=s.__i=wd(s,n,c,d))&&(d--,(a=n[l])&&(a.__u|=2)),null==a||null==a.__v?(-1==l&&(i>u?f--:i<u&&f++),"function"!=typeof s.type&&(s.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,s.__u|=4))):e.__k[o]=null;if(d)for(o=0;o<u;o++)null!=(a=n[o])&&0==(2&a.__u)&&(a.__e==r&&(r=pd(a)),kd(a,a));return r}(n,t,v,c,b),d=0;d<b;d++)null!=(h=n.__k[d])&&(f=-1==h.__i?od:v[h.__i]||od,h.__i=d,y=xd(e,h,f,i,o,s,a,c,l,u),p=h.__e,h.ref&&f.ref!=h.ref&&(f.ref&&Rd(f.ref,null,h),u.push(h.ref,h.__c||p,h)),null==g&&null!=p&&(g=p),(m=!!(4&h.__u))||f.__k===h.__k?c=bd(h,c,e,m):"function"==typeof h.type&&void 0!==y?c=y:p&&(c=p.nextSibling),h.__u&=-7);return n.__e=g,c}function bd(e,t,n,r){var i,o;if("function"==typeof e.type){for(i=e.__k,o=0;i&&o<i.length;o++)i[o]&&(i[o].__=e,t=bd(i[o],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=pd(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function wd(e,t,n,r){var i,o,s,a=e.key,c=e.type,l=t[n],u=null!=l&&0==(2&l.__u);if(null===l&&null==a||u&&a==l.key&&c==l.type)return n;if(r>(u?1:0))for(i=n-1,o=n+1;i>=0||o<t.length;)if(null!=(l=t[s=i>=0?i--:o++])&&0==(2&l.__u)&&a==l.key&&c==l.type)return s;return-1}function Ed(e,t,n){"-"==t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||ad.test(t)?n:n+"px"}function _d(e,t,n,r,i){var o,s;e:if("style"==t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||Ed(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||Ed(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])o=t!=(t=t.replace(td,"$1")),s=t.toLowerCase(),t=s in e||"onFocusOut"==t||"onFocusIn"==t?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?r?n.u=r.u:(n.u=nd,e.addEventListener(t,o?id:rd,o)):e.removeEventListener(t,o?id:rd,o);else{if("http://www.w3.org/2000/svg"==i)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==n?"":n))}}function Sd(e){return function(t){if(this.l){var n=this.l[t.type+e];if(null==t.t)t.t=nd++;else if(t.t<n.u)return;return n(Zu.event?Zu.event(t):t)}}}function xd(e,t,n,r,i,o,s,a,c,l){var u,d,f,h,p,g,y,m,v,b,w,E,_,S,x,I,O,A=t.type;if(void 0!==t.constructor)return null;128&n.__u&&(c=!!(32&n.__u),o=[a=t.__e=n.__e]),(u=Zu.__b)&&u(t);e:if("function"==typeof A)try{if(m=t.props,v="prototype"in A&&A.prototype.render,b=(u=A.contextType)&&r[u.__c],w=u?b?b.props.value:u.__:r,n.__c?y=(d=t.__c=n.__c).__=d.__E:(v?t.__c=d=new A(m,w):(t.__c=d=new hd(m,w),d.constructor=A,d.render=Pd),b&&b.sub(d),d.state||(d.state={}),d.__n=r,f=d.__d=!0,d.__h=[],d._sb=[]),v&&null==d.__s&&(d.__s=d.state),v&&null!=A.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=ld({},d.__s)),ld(d.__s,A.getDerivedStateFromProps(m,d.__s))),h=d.props,p=d.state,d.__v=t,f)v&&null==A.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),v&&null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(v&&null==A.getDerivedStateFromProps&&m!==h&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(m,w),t.__v==n.__v||!d.__e&&null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(m,d.__s,w)){for(t.__v!=n.__v&&(d.props=m,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some((function(e){e&&(e.__=t)})),E=0;E<d._sb.length;E++)d.__h.push(d._sb[E]);d._sb=[],d.__h.length&&s.push(d);break e}null!=d.componentWillUpdate&&d.componentWillUpdate(m,d.__s,w),v&&null!=d.componentDidUpdate&&d.__h.push((function(){d.componentDidUpdate(h,p,g)}))}if(d.context=w,d.props=m,d.__P=e,d.__e=!1,_=Zu.__r,S=0,v){for(d.state=d.__s,d.__d=!1,_&&_(t),u=d.render(d.props,d.state,d.context),x=0;x<d._sb.length;x++)d.__h.push(d._sb[x]);d._sb=[]}else do{d.__d=!1,_&&_(t),u=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&++S<25);d.state=d.__s,null!=d.getChildContext&&(r=ld(ld({},r),d.getChildContext())),v&&!f&&null!=d.getSnapshotBeforeUpdate&&(g=d.getSnapshotBeforeUpdate(h,p)),I=u,null!=u&&u.type===fd&&null==u.key&&(I=Ad(u.props.children)),a=vd(e,cd(I)?I:[I],t,n,r,i,o,s,a,c,l),d.base=t.__e,t.__u&=-161,d.__h.length&&s.push(d),y&&(d.__E=d.__=null)}catch(e){if(t.__v=null,c||null!=o)if(e.then){for(t.__u|=c?160:128;a&&8==a.nodeType&&a.nextSibling;)a=a.nextSibling;o[o.indexOf(a)]=null,t.__e=a}else{for(O=o.length;O--;)ud(o[O]);Id(t)}else t.__e=n.__e,t.__k=n.__k,e.then||Id(t);Zu.__e(e,t,n)}else null==o&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):a=t.__e=Td(n.__e,t,n,r,i,o,s,c,l);return(u=Zu.diffed)&&u(t),128&t.__u?void 0:a}function Id(e){e&&e.__c&&(e.__c.__e=!0),e&&e.__k&&e.__k.forEach(Id)}function Od(e,t,n){for(var r=0;r<n.length;r++)Rd(n[r],n[++r],n[++r]);Zu.__c&&Zu.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){Zu.__e(e,t.__v)}}))}function Ad(e){return"object"!=typeof e||null==e||e.__b&&e.__b>0?e:cd(e)?e.map(Ad):ld({},e)}function Td(e,t,n,r,i,o,s,a,c){var l,u,d,f,h,p,g,y=n.props||od,m=t.props,v=t.type;if("svg"==v?i="http://www.w3.org/2000/svg":"math"==v?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),null!=o)for(l=0;l<o.length;l++)if((h=o[l])&&"setAttribute"in h==!!v&&(v?h.localName==v:3==h.nodeType)){e=h,o[l]=null;break}if(null==e){if(null==v)return document.createTextNode(m);e=document.createElementNS(i,v,m.is&&m),a&&(Zu.__m&&Zu.__m(t,o),a=!1),o=null}if(null==v)y===m||a&&e.data==m||(e.data=m);else{if(o=o&&Yu.call(e.childNodes),!a&&null!=o)for(y={},l=0;l<e.attributes.length;l++)y[(h=e.attributes[l]).name]=h.value;for(l in y)if(h=y[l],"children"==l);else if("dangerouslySetInnerHTML"==l)d=h;else if(!(l in m)){if("value"==l&&"defaultValue"in m||"checked"==l&&"defaultChecked"in m)continue;_d(e,l,null,h,i)}for(l in m)h=m[l],"children"==l?f=h:"dangerouslySetInnerHTML"==l?u=h:"value"==l?p=h:"checked"==l?g=h:a&&"function"!=typeof h||y[l]===h||_d(e,l,h,y[l],i);if(u)a||d&&(u.__html==d.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(d&&(e.innerHTML=""),vd("template"==t.type?e.content:e,cd(f)?f:[f],t,n,r,"foreignObject"==v?"http://www.w3.org/1999/xhtml":i,o,s,o?o[0]:n.__k&&pd(n,0),a,c),null!=o)for(l=o.length;l--;)ud(o[l]);a||(l="value","progress"==v&&null==p?e.removeAttribute("value"):null!=p&&(p!==e[l]||"progress"==v&&!p||"option"==v&&p!=y[l])&&_d(e,l,p,y[l],i),l="checked",null!=g&&g!=e[l]&&_d(e,l,g,y[l],i))}return e}function Rd(e,t,n){try{if("function"==typeof e){var r="function"==typeof e.__u;r&&e.__u(),r&&null==t||(e.__u=e(t))}else e.current=t}catch(e){Zu.__e(e,n)}}function kd(e,t,n){var r,i;if(Zu.unmount&&Zu.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||Rd(r,null,t)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){Zu.__e(e,t)}r.base=r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&kd(r[i],t,n||"function"!=typeof e.type);n||ud(e.__e),e.__c=e.__=e.__e=void 0}function Pd(e,t,n){return this.constructor(e,n)}function Cd(e,t,n){var r,i,o,s;t==document&&(t=document.documentElement),Zu.__&&Zu.__(e,t),i=(r="function"==typeof n)?null:n&&n.__k||t.__k,o=[],s=[],xd(t,e=(!r&&n||t).__k=function(e,t,n){var r,i,o,s={};for(o in t)"key"==o?r=t[o]:"ref"==o?i=t[o]:s[o]=t[o];if(arguments.length>2&&(s.children=arguments.length>3?Yu.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(o in e.defaultProps)void 0===s[o]&&(s[o]=e.defaultProps[o]);return dd(e,s,r,i,null)}(fd,null,[e]),i||od,od,t.namespaceURI,!r&&n?[n]:i?null:t.firstChild?Yu.call(t.childNodes):null,o,!r&&n?n:i?i.__e:t.firstChild,r,s),Od(o,e,s)}Yu=sd.slice,Zu={__e:function(e,t,n,r){for(var i,o,s;t=t.__;)if((i=t.__c)&&!i.__)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(e)),s=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(e,r||{}),s=i.__d),s)return i.__E=i}catch(t){e=t}throw e}},Xu=0,hd.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=ld({},this.state),"function"==typeof e&&(e=e(ld({},n),this.props)),e&&ld(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),yd(this))},hd.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),yd(this))},hd.prototype.render=fd,Qu=[],$u="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ed=function(e,t){return e.__v.__b-t.__v.__b},md.__r=0,td=/(PointerCapture)$|Capture$/i,nd=0,rd=Sd(!1),id=Sd(!0);var Nd=0;Array.isArray;function Ud(e,t,n,r,i,o){t||(t={});var s,a,c=t;if("ref"in c)for(a in c={},t)"ref"==a?s=t[a]:c[a]=t[a];var l={type:e,props:c,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Nd,__i:-1,__u:0,__source:i,__self:o};if("function"==typeof e&&(s=e.defaultProps))for(a in s)void 0===c[a]&&(c[a]=s[a]);return Zu.vnode&&Zu.vnode(l),l}var Bd=n(230);class Ld{}class Dd extends Ld{constructor(e){super()}}const jd=Bd.FIVE_SECONDS,Md="heartbeat_pulse";class Fd extends Dd{constructor(e){super(e),this.events=new ir.EventEmitter,this.interval=jd,this.interval=(null===e||void 0===e?void 0:e.interval)||jd}static async init(e){const t=new Fd(e);return await t.init(),t}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async initialize(){this.intervalRef=setInterval((()=>this.pulse()),(0,Bd.toMiliseconds)(this.interval))}pulse(){this.events.emit(Md)}}const zd=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,qd=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,Hd=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function Vd(e,t){if(!("__proto__"===e||"constructor"===e&&t&&"object"===typeof t&&"prototype"in t))return t;!function(e){console.warn('[destr] Dropping "'.concat(e,'" key to prevent prototype pollution.'))}(e)}function Kd(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"!==typeof e)return e;const n=e.trim();if('"'===e[0]&&e.endsWith('"')&&!e.includes("\\"))return n.slice(1,-1);if(n.length<=9){const e=n.toLowerCase();if("true"===e)return!0;if("false"===e)return!1;if("undefined"===e)return;if("null"===e)return null;if("nan"===e)return Number.NaN;if("infinity"===e)return Number.POSITIVE_INFINITY;if("-infinity"===e)return Number.NEGATIVE_INFINITY}if(!Hd.test(e)){if(t.strict)throw new SyntaxError("[destr] Invalid JSON");return e}try{if(zd.test(e)||qd.test(e)){if(t.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(e,Vd)}return JSON.parse(e)}catch(r){if(t.strict)throw r;return e}}function Wd(e){try{for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return(i=e(...n))&&"function"===typeof i.then?i:Promise.resolve(i)}catch(o){return Promise.reject(o)}var i}function Gd(e){if(function(e){const t=typeof e;return null===e||"object"!==t&&"function"!==t}(e))return String(e);if(function(e){const t=Object.getPrototypeOf(e);return!t||t.isPrototypeOf(Object)}(e)||Array.isArray(e))return JSON.stringify(e);if("function"===typeof e.toJSON)return Gd(e.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function Yd(){if(void 0===typeof Buffer)throw new TypeError("[unstorage] Buffer is not supported!")}const Zd="base64:";function Xd(e){return e?e.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function Qd(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Xd(t.join(":"))}function Jd(e){return(e=Xd(e))?e+":":""}const $d=()=>{const e=new Map;return{name:"memory",options:{},hasItem:t=>e.has(t),getItem(t){var n;return null!==(n=e.get(t))&&void 0!==n?n:null},getItemRaw(t){var n;return null!==(n=e.get(t))&&void 0!==n?n:null},setItem(t,n){e.set(t,n)},setItemRaw(t,n){e.set(t,n)},removeItem(t){e.delete(t)},getKeys:()=>Array.from(e.keys()),clear(){e.clear()},dispose(){e.clear()}}};function ef(){const e={mounts:{"":(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).driver||$d()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},t=t=>{for(const n of e.mountpoints)if(t.startsWith(n))return{base:n,relativeKey:t.slice(n.length),driver:e.mounts[n]};return{base:"",relativeKey:t,driver:e.mounts[""]}},n=(t,n)=>e.mountpoints.filter((e=>e.startsWith(t)||n&&t.startsWith(e))).map((n=>({relativeBase:t.length>n.length?t.slice(n.length):void 0,mountpoint:n,driver:e.mounts[n]}))),r=(t,n)=>{if(e.watching){n=Xd(n);for(const r of e.watchListeners)r(t,n)}},i=async()=>{if(e.watching){for(const t in e.unwatch)await e.unwatch[t]();e.unwatch={},e.watching=!1}},o=(e,n,r)=>{const i=new Map,o=e=>{let t=i.get(e.base);return t||(t={driver:e.driver,base:e.base,items:[]},i.set(e.base,t)),t};for(const s of e){const e="string"===typeof s,r=Xd(e?s:s.key),i=e?void 0:s.value,a=e||!s.options?n:{...n,...s.options},c=t(r);o(c).items.push({key:r,value:i,relativeKey:c.relativeKey,options:a})}return Promise.all([...i.values()].map((e=>r(e)))).then((e=>e.flat()))},s={hasItem(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e=Xd(e);const{relativeKey:r,driver:i}=t(e);return Wd(i.hasItem,r,n)},getItem(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e=Xd(e);const{relativeKey:r,driver:i}=t(e);return Wd(i.getItem,r,n).then((e=>Kd(e)))},getItems:(e,t)=>o(e,t,(e=>e.driver.getItems?Wd(e.driver.getItems,e.items.map((e=>({key:e.relativeKey,options:e.options}))),t).then((t=>t.map((t=>({key:Qd(e.base,t.key),value:Kd(t.value)}))))):Promise.all(e.items.map((t=>Wd(e.driver.getItem,t.relativeKey,t.options).then((e=>({key:t.key,value:Kd(e)})))))))),getItemRaw(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e=Xd(e);const{relativeKey:r,driver:i}=t(e);return i.getItemRaw?Wd(i.getItemRaw,r,n):Wd(i.getItem,r,n).then((e=>function(e){return"string"!==typeof e?e:e.startsWith(Zd)?(Yd(),Buffer.from(e.slice(Zd.length),"base64")):e}(e)))},async setItem(e,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(void 0===n)return s.removeItem(e);e=Xd(e);const{relativeKey:o,driver:a}=t(e);a.setItem&&(await Wd(a.setItem,o,Gd(n),i),a.watch||r("update",e))},async setItems(e,t){await o(e,t,(async e=>{if(e.driver.setItems)return Wd(e.driver.setItems,e.items.map((e=>({key:e.relativeKey,value:Gd(e.value),options:e.options}))),t);e.driver.setItem&&await Promise.all(e.items.map((t=>Wd(e.driver.setItem,t.relativeKey,Gd(t.value),t.options))))}))},async setItemRaw(e,n){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(void 0===n)return s.removeItem(e,i);e=Xd(e);const{relativeKey:o,driver:a}=t(e);if(a.setItemRaw)await Wd(a.setItemRaw,o,n,i);else{if(!a.setItem)return;await Wd(a.setItem,o,function(e){if("string"===typeof e)return e;Yd();const t=Buffer.from(e).toString("base64");return Zd+t}(n),i)}a.watch||r("update",e)},async removeItem(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"===typeof n&&(n={removeMeta:n}),e=Xd(e);const{relativeKey:i,driver:o}=t(e);o.removeItem&&(await Wd(o.removeItem,i,n),(n.removeMeta||n.removeMata)&&await Wd(o.removeItem,i+"$",n),o.watch||r("remove",e))},async getMeta(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"===typeof n&&(n={nativeOnly:n}),e=Xd(e);const{relativeKey:r,driver:i}=t(e),o=Object.create(null);if(i.getMeta&&Object.assign(o,await Wd(i.getMeta,r,n)),!n.nativeOnly){const e=await Wd(i.getItem,r+"$",n).then((e=>Kd(e)));e&&"object"===typeof e&&("string"===typeof e.atime&&(e.atime=new Date(e.atime)),"string"===typeof e.mtime&&(e.mtime=new Date(e.mtime)),Object.assign(o,e))}return o},setMeta(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.setItem(e+"$",t,n)},removeMeta(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.removeItem(e+"$",t)},async getKeys(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e=Jd(e);const r=n(e,!0);let i=[];const o=[];for(const n of r){const e=(await Wd(n.driver.getKeys,n.relativeBase,t)).map((e=>n.mountpoint+Xd(e))).filter((e=>!i.some((t=>e.startsWith(t)))));o.push(...e),i=[n.mountpoint,...i.filter((e=>!e.startsWith(n.mountpoint)))]}return e?o.filter((t=>t.startsWith(e)&&!t.endsWith("$"))):o.filter((e=>!e.endsWith("$")))},async clear(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e=Jd(e),await Promise.all(n(e,!1).map((async e=>{if(e.driver.clear)return Wd(e.driver.clear,e.relativeBase,t);if(e.driver.removeItem){const n=await e.driver.getKeys(e.relativeBase||"",t);return Promise.all(n.map((n=>e.driver.removeItem(n,t))))}})))},async dispose(){await Promise.all(Object.values(e.mounts).map((e=>nf(e))))},watch:async t=>(await(async()=>{if(!e.watching){e.watching=!0;for(const t in e.mounts)e.unwatch[t]=await tf(e.mounts[t],r,t)}})(),e.watchListeners.push(t),async()=>{e.watchListeners=e.watchListeners.filter((e=>e!==t)),0===e.watchListeners.length&&await i()}),async unwatch(){e.watchListeners=[],await i()},mount(t,n){if((t=Jd(t))&&e.mounts[t])throw new Error("already mounted at ".concat(t));return t&&(e.mountpoints.push(t),e.mountpoints.sort(((e,t)=>t.length-e.length))),e.mounts[t]=n,e.watching&&Promise.resolve(tf(n,r,t)).then((n=>{e.unwatch[t]=n})).catch(console.error),s},async unmount(t){let n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];(t=Jd(t))&&e.mounts[t]&&(e.watching&&t in e.unwatch&&(e.unwatch[t](),delete e.unwatch[t]),n&&await nf(e.mounts[t]),e.mountpoints=e.mountpoints.filter((e=>e!==t)),delete e.mounts[t])},getMount(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";e=Xd(e)+":";const n=t(e);return{driver:n.driver,base:n.base}},getMounts(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e=Xd(e);return n(e,t.parents).map((e=>({driver:e.driver,base:e.mountpoint})))}};return s}function tf(e,t,n){return e.watch?e.watch(((e,r)=>t(e,n+r))):()=>{}}async function nf(e){"function"===typeof e.dispose&&await Wd(e.dispose)}function rf(e){return new Promise(((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)}))}function of(e,t){const n=indexedDB.open(e);n.onupgradeneeded=()=>n.result.createObjectStore(t);const r=rf(n);return(e,n)=>r.then((r=>n(r.transaction(t,e).objectStore(t))))}let sf;function af(){return sf||(sf=of("keyval-store","keyval")),sf}function cf(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:af())("readonly",(t=>rf(t.get(e))))}function lf(e,t){return e.openCursor().onsuccess=function(){this.result&&(t(this.result),this.result.continue())},rf(e.transaction)}const uf=e=>JSON.stringify(e,((e,t)=>"bigint"===typeof t?t.toString()+"n":t)),df=e=>{const t=e.replace(/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,'$1"$2n"$3');return JSON.parse(t,((e,t)=>"string"===typeof t&&t.match(/^\d+n$/)?BigInt(t.substring(0,t.length-1)):t))};function ff(e){if("string"!==typeof e)throw new Error("Cannot safe json parse value of type ".concat(typeof e));try{return df(e)}catch(XR){return e}}function hf(e){return"string"===typeof e?e:uf(e)||""}var pf=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=e.base&&e.base.length>0?"".concat(e.base,":"):"",n=e=>t+e;let r;return e.dbName&&e.storeName&&(r=of(e.dbName,e.storeName)),{name:"idb-keyval",options:e,hasItem:async e=>!(typeof await cf(n(e),r)>"u"),async getItem(e){var t;return null!==(t=await cf(n(e),r))&&void 0!==t?t:null},setItem:(e,t)=>function(e,t){return(arguments.length>2&&void 0!==arguments[2]?arguments[2]:af())("readwrite",(n=>(n.put(t,e),rf(n.transaction))))}(n(e),t,r),removeItem:e=>function(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:af())("readwrite",(t=>(t.delete(e),rf(t.transaction))))}(n(e),r),getKeys:()=>function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:af())("readonly",(e=>{if(e.getAllKeys)return rf(e.getAllKeys());const t=[];return lf(e,(e=>t.push(e.key))).then((()=>t))}))}(r),clear:()=>function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:af())("readwrite",(e=>(e.clear(),rf(e.transaction))))}(r)}};class gf{constructor(){this.indexedDb=ef({driver:pf({dbName:"WALLET_CONNECT_V2_INDEXED_DB",storeName:"keyvaluestorage"})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map((e=>[e.key,e.value]))}async getItem(e){const t=await this.indexedDb.getItem(e);if(null!==t)return t}async setItem(e,t){await this.indexedDb.setItem(e,hf(t))}async removeItem(e){await this.indexedDb.removeItem(e)}}var yf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof n.g<"u"?n.g:typeof self<"u"?self:{},mf={exports:{}};function vf(e){var t;return[e[0],ff(null!=(t=e[1])?t:"")]}!function(){let e;function t(){}e=t,e.prototype.getItem=function(e){return this.hasOwnProperty(e)?String(this[e]):null},e.prototype.setItem=function(e,t){this[e]=String(t)},e.prototype.removeItem=function(e){delete this[e]},e.prototype.clear=function(){const e=this;Object.keys(e).forEach((function(t){e[t]=void 0,delete e[t]}))},e.prototype.key=function(e){return e=e||0,Object.keys(this)[e]},e.prototype.__defineGetter__("length",(function(){return Object.keys(this).length})),typeof yf<"u"&&yf.localStorage?mf.exports=yf.localStorage:typeof window<"u"&&window.localStorage?mf.exports=window.localStorage:mf.exports=new t}();class bf{constructor(){this.localStorage=mf.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(vf)}async getItem(e){const t=this.localStorage.getItem(e);if(null!==t)return ff(t)}async setItem(e,t){this.localStorage.setItem(e,hf(t))}async removeItem(e){this.localStorage.removeItem(e)}}const wf=async(e,t)=>{t.length&&t.forEach((async t=>{await e.removeItem(t)}))};class Ef{constructor(){this.initialized=!1,this.setInitialized=e=>{this.storage=e,this.initialized=!0};const e=new bf;this.storage=e;try{(async(e,t,n)=>{const r="wc_storage_version",i=await t.getItem(r);if(i&&i>=1)return void n(t);const o=await e.getKeys();if(!o.length)return void n(t);const s=[];for(;o.length;){const n=o.shift();if(!n)continue;const r=n.toLowerCase();if(r.includes("wc@")||r.includes("walletconnect")||r.includes("wc_")||r.includes("wallet_connect")){const r=await e.getItem(n);await t.setItem(n,r),s.push(n)}}await t.setItem(r,1),n(t),wf(e,s)})(e,new gf,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,t){return await this.initialize(),this.storage.setItem(e,t)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise((e=>{const t=setInterval((()=>{this.initialized&&(clearInterval(t),e())}),20)}))}}var _f={exports:{}};function Sf(e){try{return JSON.stringify(e)}catch{return'"[Circular]"'}}var xf=function(e,t,n){var r=n&&n.stringify||Sf;if("object"==typeof e&&null!==e){var i=t.length+1;if(1===i)return e;var o=new Array(i);o[0]=r(e);for(var s=1;s<i;s++)o[s]=r(t[s]);return o.join(" ")}if("string"!=typeof e)return e;var a=t.length;if(0===a)return e;for(var c="",l=0,u=-1,d=e&&e.length||0,f=0;f<d;){if(37===e.charCodeAt(f)&&f+1<d){switch(u=u>-1?u:0,e.charCodeAt(f+1)){case 100:case 102:if(l>=a||null==t[l])break;u<f&&(c+=e.slice(u,f)),c+=Number(t[l]),u=f+2,f++;break;case 105:if(l>=a||null==t[l])break;u<f&&(c+=e.slice(u,f)),c+=Math.floor(Number(t[l])),u=f+2,f++;break;case 79:case 111:case 106:if(l>=a||void 0===t[l])break;u<f&&(c+=e.slice(u,f));var h=typeof t[l];if("string"===h){c+="'"+t[l]+"'",u=f+2,f++;break}if("function"===h){c+=t[l].name||"<anonymous>",u=f+2,f++;break}c+=r(t[l]),u=f+2,f++;break;case 115:if(l>=a)break;u<f&&(c+=e.slice(u,f)),c+=String(t[l]),u=f+2,f++;break;case 37:u<f&&(c+=e.slice(u,f)),c+="%",u=f+2,f++,l--}++l}++f}return-1===u?e:(u<d&&(c+=e.slice(u)),c)};const If=xf;_f.exports=Nf;const Of=function(){function e(e){return typeof e<"u"&&e}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return e(self)||e(window)||e(this)||{}}}().console||{},Af={mapHttpRequest:Mf,mapHttpResponse:Mf,wrapRequestSerializer:Ff,wrapResponseSerializer:Ff,wrapErrorSerializer:Ff,req:Mf,res:Mf,err:Df,errWithCause:Df};function Tf(e,t){return"silent"===e?1/0:t.levels.values[e]}const Rf=Symbol("pino.logFuncs"),kf=Symbol("pino.hierarchy"),Pf={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function Cf(e,t){const n={logger:t,parent:e[kf]};t[kf]=n}function Nf(e){(e=e||{}).browser=e.browser||{};const t=e.browser.transmit;if(t&&"function"!=typeof t.send)throw Error("pino: transmit option must have a send function");const n=e.browser.write||Of;e.browser.write&&(e.browser.asObject=!0);const r=e.serializers||{},i=function(e,t){return Array.isArray(e)?e.filter((function(e){return"!stdSerializers.err"!==e})):!0===e&&Object.keys(t)}(e.browser.serialize,r);let o=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(o=!1);const s=Object.keys(e.customLevels||{}),a=["error","fatal","warn","info","debug","trace"].concat(s);"function"==typeof n&&a.forEach((function(e){n[e]=n})),(!1===e.enabled||e.browser.disabled)&&(e.level="silent");const c=e.level||"info",l=Object.create(n);l.log||(l.log=zf),function(e,t,n){const r={};t.forEach((e=>{r[e]=n[e]?n[e]:Of[e]||Of[Pf[e]||"log"]||zf})),e[Rf]=r}(l,a,n),Cf({},l),Object.defineProperty(l,"levelVal",{get:function(){return Tf(this.level,this)}}),Object.defineProperty(l,"level",{get:function(){return this._level},set:function(e){if("silent"!==e&&!this.levels.values[e])throw Error("unknown level "+e);this._level=e,Uf(this,u,l,"error"),Uf(this,u,l,"fatal"),Uf(this,u,l,"warn"),Uf(this,u,l,"info"),Uf(this,u,l,"debug"),Uf(this,u,l,"trace"),s.forEach((e=>{Uf(this,u,l,e)}))}});const u={transmit:t,serialize:i,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,levels:a,timestamp:jf(e),messageKey:e.messageKey||"msg",onChild:e.onChild||zf};function d(n,o,s){if(!o)throw new Error("missing bindings for child Pino");s=s||{},i&&o.serializers&&(s.serializers=o.serializers);const a=s.serializers;if(i&&a){var c=Object.assign({},r,a),l=!0===e.browser.serialize?Object.keys(c):i;delete o.serializers,Bf([o],l,c,this._stdErrSerialize)}function u(e){this._childLevel=1+(0|e._childLevel),this.bindings=o,c&&(this.serializers=c,this._serialize=l),t&&(this._logEvent=Lf([].concat(e._logEvent.bindings,o)))}u.prototype=this;const f=new u(this);return Cf(this,f),f.child=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return d.call(this,n,...t)},f.level=s.level||this.level,n.onChild(f),f}return l.levels=function(e){const t=e.customLevels||{},n=Object.assign({},Nf.levels.values,t),r=Object.assign({},Nf.levels.labels,function(e){const t={};return Object.keys(e).forEach((function(n){t[e[n]]=n})),t}(t));return{values:n,labels:r}}(e),l.level=c,l.isLevelEnabled=function(e){return!!this.levels.values[e]&&this.levels.values[e]>=this.levels.values[this.level]},l.setMaxListeners=l.getMaxListeners=l.emit=l.addListener=l.on=l.prependListener=l.once=l.prependOnceListener=l.removeListener=l.removeAllListeners=l.listeners=l.listenerCount=l.eventNames=l.write=l.flush=zf,l.serializers=r,l._serialize=i,l._stdErrSerialize=o,l.child=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return d.call(this,u,...t)},t&&(l._logEvent=Lf()),l}function Uf(e,t,n,r){if(Object.defineProperty(e,r,{value:Tf(e.level,n)>Tf(r,n)?zf:n[Rf][r],writable:!0,enumerable:!0,configurable:!0}),e[r]===zf){if(!t.transmit)return;const i=Tf(t.transmit.level||e.level,n);if(Tf(r,n)<i)return}e[r]=function(e,t,n,r){return function(i){return function(){const o=t.timestamp(),s=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Of?Of:this;for(var c=0;c<s.length;c++)s[c]=arguments[c];var l=!1;if(t.serialize&&(Bf(s,this._serialize,this.serializers,this._stdErrSerialize),l=!0),t.asObject||t.formatters?i.call(a,...function(e,t,n,r,i){const{level:o,log:s=e=>e}=i.formatters||{},a=n.slice();let c=a[0];const l={};let u=1+(0|e._childLevel);if(u<1&&(u=1),r&&(l.time=r),o){const n=o(t,e.levels.values[t]);Object.assign(l,n)}else l.level=e.levels.values[t];if(i.asObjectBindingsOnly){if(null!==c&&"object"==typeof c)for(;u--&&"object"==typeof a[0];)Object.assign(l,a.shift());return[s(l),...a]}if(null!==c&&"object"==typeof c){for(;u--&&"object"==typeof a[0];)Object.assign(l,a.shift());c=a.length?If(a.shift(),a):void 0}else"string"==typeof c&&(c=If(a.shift(),a));return void 0!==c&&(l[i.messageKey]=c),[s(l)]}(this,r,s,o,t)):i.apply(a,s),t.transmit){const i=t.transmit.level||e._level,a=Tf(i,n),c=Tf(r,n);if(c<a)return;!function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const i=t.send,o=t.ts,s=t.methodLevel,a=t.methodValue,c=t.val,l=e._logEvent.bindings;r||Bf(n,e._serialize||Object.keys(e.serializers),e.serializers,void 0===e._stdErrSerialize||e._stdErrSerialize),e._logEvent.ts=o,e._logEvent.messages=n.filter((function(e){return-1===l.indexOf(e)})),e._logEvent.level.label=s,e._logEvent.level.value=a,i(s,e._logEvent,c),e._logEvent=Lf(l)}(this,{ts:o,methodLevel:r,methodValue:c,transmitLevel:i,transmitValue:n.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:Tf(e._level,n)},s,l)}}}(e[Rf][r])}(e,t,n,r);const i=function(e){const t=[];e.bindings&&t.push(e.bindings);let n=e[kf];for(;n.parent;)n=n.parent,n.logger.bindings&&t.push(n.logger.bindings);return t.reverse()}(e);0!==i.length&&(e[r]=function(e,t){return function(){return t.apply(this,[...e,...arguments])}}(i,e[r]))}function Bf(e,t,n,r){for(const i in e)if(r&&e[i]instanceof Error)e[i]=Nf.stdSerializers.err(e[i]);else if("object"==typeof e[i]&&!Array.isArray(e[i])&&t)for(const r in e[i])t.indexOf(r)>-1&&r in n&&(e[i][r]=n[r](e[i][r]))}function Lf(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function Df(e){const t={type:e.constructor.name,msg:e.message,stack:e.stack};for(const n in e)void 0===t[n]&&(t[n]=e[n]);return t}function jf(e){return"function"==typeof e.timestamp?e.timestamp:!1===e.timestamp?qf:Hf}function Mf(){return{}}function Ff(e){return e}function zf(){}function qf(){return!1}function Hf(){return Date.now()}Nf.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},Nf.stdSerializers=Af,Nf.stdTimeFunctions=Object.assign({},{nullTime:qf,epochTime:Hf,unixTime:function(){return Math.round(Date.now()/1e3)},isoTime:function(){return new Date(Date.now()).toISOString()}}),_f.exports.default=Nf;_f.exports.pino=Nf;const Vf="info",Kf="custom_context",Wf=1024e3;var Gf=Object.defineProperty,Yf=(e,t,n)=>((e,t,n)=>t in e?Gf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);class Zf{constructor(e){Yf(this,"nodeValue"),Yf(this,"sizeInBytes"),Yf(this,"next"),this.nodeValue=e,this.sizeInBytes=(new TextEncoder).encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}}class Xf{constructor(e){Yf(this,"lengthInNodes"),Yf(this,"sizeInBytes"),Yf(this,"head"),Yf(this,"tail"),Yf(this,"maxSizeInBytes"),this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){const t=new Zf(e);if(t.size>this.maxSizeInBytes)throw new Error("[LinkedList] Value too big to insert into list: ".concat(e," with size ").concat(t.size));for(;this.size+t.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=t),this.tail=t):(this.head=t,this.tail=t),this.lengthInNodes++,this.sizeInBytes+=t.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let t=this.head;for(;null!==t;)e.push(t.value),t=t.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const t=e.value;return e=e.next,{done:!1,value:t}}}}}function Qf(e){return"string"==typeof e?e:(e=>JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString()+"n":t)))(e)||""}var Jf=Object.defineProperty,$f=(e,t,n)=>((e,t,n)=>t in e?Jf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);class eh{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Wf;$f(this,"logs"),$f(this,"level"),$f(this,"levelValue"),$f(this,"MAX_LOG_SIZE_IN_BYTES"),this.level=null!==e&&void 0!==e?e:"error",this.levelValue=_f.exports.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=t,this.logs=new Xf(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,t){t===_f.exports.levels.values.error?console.error(e):t===_f.exports.levels.values.warn?console.warn(e):t===_f.exports.levels.values.debug?console.debug(e):t===_f.exports.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(Qf({timestamp:(new Date).toISOString(),log:e}));const t="string"==typeof e?JSON.parse(e).level:e.level;t>=this.levelValue&&this.forwardToConsole(e,t)}getLogs(){return this.logs}clearLogs(){this.logs=new Xf(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const t=this.getLogArray();return t.push(Qf({extraMetadata:e})),new Blob(t,{type:"application/json"})}}var th=Object.defineProperty,nh=(e,t,n)=>((e,t,n)=>t in e?th(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);class rh{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Wf;nh(this,"baseChunkLogger"),this.baseChunkLogger=new eh(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const t=URL.createObjectURL(this.logsToBlob(e)),n=document.createElement("a");n.href=t,n.download="walletconnect-logs-".concat((new Date).toISOString(),".txt"),document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)}}var ih=Object.defineProperty,oh=(e,t,n)=>((e,t,n)=>t in e?ih(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);class sh{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Wf;oh(this,"baseChunkLogger"),this.baseChunkLogger=new eh(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}}var ah=Object.defineProperty,ch=Object.defineProperties,lh=Object.getOwnPropertyDescriptors,uh=Object.getOwnPropertySymbols,dh=Object.prototype.hasOwnProperty,fh=Object.prototype.propertyIsEnumerable,hh=(e,t,n)=>t in e?ah(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ph=(e,t)=>{for(var n in t||(t={}))dh.call(t,n)&&hh(e,n,t[n]);if(uh)for(var n of uh(t))fh.call(t,n)&&hh(e,n,t[n]);return e},gh=(e,t)=>ch(e,lh(t));function yh(e){return e[arguments.length>1&&void 0!==arguments[1]?arguments[1]:Kf]||""}function mh(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Kf;const r=function(e,t){const n=yh(e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:Kf);return n.trim()?"".concat(n,"/").concat(t):t}(e,t,n);return function(e,t){return e[arguments.length>2&&void 0!==arguments[2]?arguments[2]:Kf]=t,e}(e.child({context:r}),r,n)}function vh(e){var t;if(typeof e.loggerOverride<"u"&&"string"!=typeof e.loggerOverride)return{logger:e.loggerOverride,chunkLoggerController:null};const n=gh(ph({},e.opts),{level:"string"==typeof e.loggerOverride?e.loggerOverride:null==(t=e.opts)?void 0:t.level});return typeof window<"u"?function(e){var t,n;const r=new rh(null==(t=e.opts)?void 0:t.level,e.maxSizeInBytes);return{logger:_f.exports(gh(ph({},e.opts),{level:"trace",browser:gh(ph({},null==(n=e.opts)?void 0:n.browser),{write:e=>r.write(e)})})),chunkLoggerController:r}}(gh(ph({},e),{opts:n})):function(e){var t,n;const r=new sh(null==(t=e.opts)?void 0:t.level,e.maxSizeInBytes);return{logger:_f.exports(gh(ph({},e.opts),{level:"trace",browser:gh(ph({},null==(n=e.opts)?void 0:n.browser),{write:e=>r.write(e)})}),r),chunkLoggerController:r}}(gh(ph({},e),{opts:n}))}var bh=Object.defineProperty,wh=(e,t,n)=>((e,t,n)=>t in e?bh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);class Eh extends Ld{constructor(e){super(),this.opts=e,wh(this,"protocol","wc"),wh(this,"version",2)}}var _h=Object.defineProperty,Sh=(e,t,n)=>((e,t,n)=>t in e?_h(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);class xh extends Ld{constructor(e,t){super(),this.core=e,this.logger=t,Sh(this,"records",new Map)}}class Ih{constructor(e,t){this.logger=e,this.core=t}}class Oh extends Ld{constructor(e,t){super(),this.relayer=e,this.logger=t}}class Ah extends Ld{constructor(e){super()}}class Th{constructor(e,t,n,r){this.core=e,this.logger=t,this.name=n}}Object.defineProperty;class Rh extends Ld{constructor(e,t){super(),this.relayer=e,this.logger=t}}class kh extends Ld{constructor(e,t){super(),this.core=e,this.logger=t}}class Ph{constructor(e,t,n){this.core=e,this.logger=t,this.store=n}}class Ch{constructor(e,t){this.projectId=e,this.logger=t}}class Nh{constructor(e,t,n){this.core=e,this.logger=t,this.telemetryEnabled=n}}var Uh=Object.defineProperty,Bh=(e,t,n)=>((e,t,n)=>t in e?Uh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);or();class Lh{constructor(e){this.opts=e,Bh(this,"protocol","wc"),Bh(this,"version",2)}}ir.EventEmitter;class Dh{constructor(e){this.client=e}}function jh(e){if(!function(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}(e))throw new Error("Uint8Array expected");for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if(n.length>0&&!n.includes(e.length))throw new Error("Uint8Array expected of length "+n+", got length="+e.length)}function Mh(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}const Fh="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,zh=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);function qh(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}(e)),jh(e),e}class Hh{clone(){return this._cloneInto()}}function Vh(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:32;if(Fh&&"function"==typeof Fh.getRandomValues)return Fh.getRandomValues(new Uint8Array(e));if(Fh&&"function"==typeof Fh.randomBytes)return Fh.randomBytes(e);throw new Error("crypto.getRandomValues must be defined")}class Kh extends Hh{constructor(e,t,n,r){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=zh(this.buffer)}update(e){Mh(this);const{view:t,buffer:n,blockLen:r}=this,i=(e=qh(e)).length;for(let o=0;o<i;){const s=Math.min(r-this.pos,i-o);if(s!==r)n.set(e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===r&&(this.process(t,0),this.pos=0);else{const t=zh(e);for(;r<=i-o;o+=r)this.process(t,o)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){Mh(this),function(e,t){jh(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}(e,this),this.finished=!0;const{buffer:t,view:n,blockLen:r,isLE:i}=this;let{pos:o}=this;t[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>r-o&&(this.process(n,0),o=0);for(let u=o;u<r;u++)t[u]=0;(function(e,t,n,r){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,n,r);const i=BigInt(32),o=BigInt(4294967295),s=Number(n>>i&o),a=Number(n&o),c=r?4:0,l=r?0:4;e.setUint32(t+c,s,r),e.setUint32(t+l,a,r)})(n,r-8,BigInt(8*this.length),i),this.process(n,0);const s=zh(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=a/4,l=this.get();if(c>l.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<c;u++)s.setUint32(4*u,l[u],i)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:n,length:r,finished:i,destroyed:o,pos:s}=this;return e.length=r,e.pos=s,e.finished=i,e.destroyed=o,r%t&&e.buffer.set(n),e}}const Wh=BigInt(2**32-1),Gh=BigInt(32);function Yh(e){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?{h:Number(e&Wh),l:Number(e>>Gh&Wh)}:{h:0|Number(e>>Gh&Wh),l:0|Number(e&Wh)}}const Zh={fromBig:Yh,split:function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let i=0;i<e.length;i++){const{h:o,l:s}=Yh(e[i],t);[n[i],r[i]]=[o,s]}return[n,r]},toBig:(e,t)=>BigInt(e>>>0)<<Gh|BigInt(t>>>0),shrSH:(e,t,n)=>e>>>n,shrSL:(e,t,n)=>e<<32-n|t>>>n,rotrSH:(e,t,n)=>e>>>n|t<<32-n,rotrSL:(e,t,n)=>e<<32-n|t>>>n,rotrBH:(e,t,n)=>e<<64-n|t>>>n-32,rotrBL:(e,t,n)=>e>>>n-32|t<<64-n,rotr32H:(e,t)=>t,rotr32L:(e,t)=>e,rotlSH:(e,t,n)=>e<<n|t>>>32-n,rotlSL:(e,t,n)=>t<<n|e>>>32-n,rotlBH:(e,t,n)=>t<<n-32|e>>>64-n,rotlBL:(e,t,n)=>e<<n-32|t>>>64-n,add:function(e,t,n,r){const i=(t>>>0)+(r>>>0);return{h:e+n+(i/2**32|0)|0,l:0|i}},add3L:(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),add3H:(e,t,n,r)=>t+n+r+(e/2**32|0)|0,add4L:(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),add4H:(e,t,n,r,i)=>t+n+r+i+(e/2**32|0)|0,add5H:(e,t,n,r,i,o)=>t+n+r+i+o+(e/2**32|0)|0,add5L:(e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0)},[Xh,Qh]=Zh.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((e=>BigInt(e)))),Jh=new Uint32Array(80),$h=new Uint32Array(80);class ep extends Kh{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:t,Bh:n,Bl:r,Ch:i,Cl:o,Dh:s,Dl:a,Eh:c,El:l,Fh:u,Fl:d,Gh:f,Gl:h,Hh:p,Hl:g}=this;return[e,t,n,r,i,o,s,a,c,l,u,d,f,h,p,g]}set(e,t,n,r,i,o,s,a,c,l,u,d,f,h,p,g){this.Ah=0|e,this.Al=0|t,this.Bh=0|n,this.Bl=0|r,this.Ch=0|i,this.Cl=0|o,this.Dh=0|s,this.Dl=0|a,this.Eh=0|c,this.El=0|l,this.Fh=0|u,this.Fl=0|d,this.Gh=0|f,this.Gl=0|h,this.Hh=0|p,this.Hl=0|g}process(e,t){for(let v=0;v<16;v++,t+=4)Jh[v]=e.getUint32(t),$h[v]=e.getUint32(t+=4);for(let v=16;v<80;v++){const e=0|Jh[v-15],t=0|$h[v-15],n=Zh.rotrSH(e,t,1)^Zh.rotrSH(e,t,8)^Zh.shrSH(e,t,7),r=Zh.rotrSL(e,t,1)^Zh.rotrSL(e,t,8)^Zh.shrSL(e,t,7),i=0|Jh[v-2],o=0|$h[v-2],s=Zh.rotrSH(i,o,19)^Zh.rotrBH(i,o,61)^Zh.shrSH(i,o,6),a=Zh.rotrSL(i,o,19)^Zh.rotrBL(i,o,61)^Zh.shrSL(i,o,6),c=Zh.add4L(r,a,$h[v-7],$h[v-16]),l=Zh.add4H(c,n,s,Jh[v-7],Jh[v-16]);Jh[v]=0|l,$h[v]=0|c}let{Ah:n,Al:r,Bh:i,Bl:o,Ch:s,Cl:a,Dh:c,Dl:l,Eh:u,El:d,Fh:f,Fl:h,Gh:p,Gl:g,Hh:y,Hl:m}=this;for(let v=0;v<80;v++){const e=Zh.rotrSH(u,d,14)^Zh.rotrSH(u,d,18)^Zh.rotrBH(u,d,41),t=Zh.rotrSL(u,d,14)^Zh.rotrSL(u,d,18)^Zh.rotrBL(u,d,41),b=u&f^~u&p,w=d&h^~d&g,E=Zh.add5L(m,t,w,Qh[v],$h[v]),_=Zh.add5H(E,y,e,b,Xh[v],Jh[v]),S=0|E,x=Zh.rotrSH(n,r,28)^Zh.rotrBH(n,r,34)^Zh.rotrBH(n,r,39),I=Zh.rotrSL(n,r,28)^Zh.rotrBL(n,r,34)^Zh.rotrBL(n,r,39),O=n&i^n&s^i&s,A=r&o^r&a^o&a;y=0|p,m=0|g,p=0|f,g=0|h,f=0|u,h=0|d,({h:u,l:d}=Zh.add(0|c,0|l,0|_,0|S)),c=0|s,l=0|a,s=0|i,a=0|o,i=0|n,o=0|r;const T=Zh.add3L(S,I,A);n=Zh.add3H(T,_,x,O),r=0|T}({h:n,l:r}=Zh.add(0|this.Ah,0|this.Al,0|n,0|r)),({h:i,l:o}=Zh.add(0|this.Bh,0|this.Bl,0|i,0|o)),({h:s,l:a}=Zh.add(0|this.Ch,0|this.Cl,0|s,0|a)),({h:c,l:l}=Zh.add(0|this.Dh,0|this.Dl,0|c,0|l)),({h:u,l:d}=Zh.add(0|this.Eh,0|this.El,0|u,0|d)),({h:f,l:h}=Zh.add(0|this.Fh,0|this.Fl,0|f,0|h)),({h:p,l:g}=Zh.add(0|this.Gh,0|this.Gl,0|p,0|g)),({h:y,l:m}=Zh.add(0|this.Hh,0|this.Hl,0|y,0|m)),this.set(n,r,i,o,s,a,c,l,u,d,f,h,p,g,y,m)}roundClean(){Jh.fill(0),$h.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const tp=function(e){const t=t=>e().update(qh(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}((()=>new ep)),np=BigInt(0),rp=BigInt(1),ip=BigInt(2);function op(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function sp(e){if(!op(e))throw new Error("Uint8Array expected")}function ap(e,t){if("boolean"!=typeof t)throw new Error(e+" boolean expected, got "+t)}const cp=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function lp(e){sp(e);let t="";for(let n=0;n<e.length;n++)t+=cp[e[n]];return t}function up(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);return""===e?np:BigInt("0x"+e)}const dp={_0:48,_9:57,A:65,F:70,a:97,f:102};function fp(e){return e>=dp._0&&e<=dp._9?e-dp._0:e>=dp.A&&e<=dp.F?e-(dp.A-10):e>=dp.a&&e<=dp.f?e-(dp.a-10):void 0}function hp(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let i=0,o=0;i<n;i++,o+=2){const t=fp(e.charCodeAt(o)),n=fp(e.charCodeAt(o+1));if(void 0===t||void 0===n){const t=e[o]+e[o+1];throw new Error('hex string expected, got non-hex character "'+t+'" at index '+o)}r[i]=16*t+n}return r}function pp(e){return sp(e),up(lp(Uint8Array.from(e).reverse()))}function gp(e,t){return hp(e.toString(16).padStart(2*t,"0"))}function yp(e,t){return gp(e,t).reverse()}function mp(e,t,n){let r;if("string"==typeof t)try{r=hp(t)}catch(We){throw new Error(e+" must be hex string or Uint8Array, cause: "+We)}else{if(!op(t))throw new Error(e+" must be hex string or Uint8Array");r=Uint8Array.from(t)}const i=r.length;if("number"==typeof n&&i!==n)throw new Error(e+" of length "+n+" expected, got "+i);return r}function vp(){let e=0;for(let n=0;n<arguments.length;n++){const t=n<0||arguments.length<=n?void 0:arguments[n];sp(t),e+=t.length}const t=new Uint8Array(e);for(let n=0,r=0;n<arguments.length;n++){const e=n<0||arguments.length<=n?void 0:arguments[n];t.set(e,r),r+=e.length}return t}const bp=e=>"bigint"==typeof e&&np<=e;function wp(e,t,n,r){if(!function(e,t,n){return bp(e)&&bp(t)&&bp(n)&&t<=e&&e<n}(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}const Ep=e=>(ip<<BigInt(e-1))-rp,_p={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||op(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};function Sp(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=(t,n,r)=>{const i=_p[n];if("function"!=typeof i)throw new Error("invalid validator function");const o=e[t];if((!r||void 0!==o)&&!i(o,e))throw new Error("param "+String(t)+" is invalid. Expected "+n+", got "+o)};for(const[i,o]of Object.entries(t))r(i,o,!1);for(const[i,o]of Object.entries(n))r(i,o,!0);return e}function xp(e){const t=new WeakMap;return function(n){const r=t.get(n);if(void 0!==r)return 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=e(n,...o);return t.set(n,a),a}}const Ip=BigInt(0),Op=BigInt(1),Ap=BigInt(2),Tp=BigInt(3),Rp=BigInt(4),kp=BigInt(5),Pp=BigInt(8);function Cp(e,t){const n=e%t;return n>=Ip?n:t+n}function Np(e,t,n){if(t<Ip)throw new Error("invalid exponent, negatives unsupported");if(n<=Ip)throw new Error("invalid modulus");if(n===Op)return Ip;let r=Op;for(;t>Ip;)t&Op&&(r=r*e%n),e=e*e%n,t>>=Op;return r}function Up(e,t,n){let r=e;for(;t-- >Ip;)r*=r,r%=n;return r}function Bp(e,t){if(e===Ip)throw new Error("invert: expected non-zero number");if(t<=Ip)throw new Error("invert: expected positive modulus, got "+t);let n=Cp(e,t),r=t,i=Ip,o=Op;for(;n!==Ip;){const e=r%n,t=i-o*(r/n);r=n,n=e,i=o,o=t}if(r!==Op)throw new Error("invert: does not exist");return Cp(i,t)}function Lp(e){if(e%Rp===Tp){const t=(e+Op)/Rp;return function(e,n){const r=e.pow(n,t);if(!e.eql(e.sqr(r),n))throw new Error("Cannot find square root");return r}}if(e%Pp===kp){const t=(e-kp)/Pp;return function(e,n){const r=e.mul(n,Ap),i=e.pow(r,t),o=e.mul(n,i),s=e.mul(e.mul(o,Ap),i),a=e.mul(o,e.sub(s,e.ONE));if(!e.eql(e.sqr(a),n))throw new Error("Cannot find square root");return a}}return function(e){const t=(e-Op)/Ap;let n,r,i;for(n=e-Op,r=0;n%Ap===Ip;n/=Ap,r++);for(i=Ap;i<e&&Np(i,t,e)!==e-Op;i++)if(i>1e3)throw new Error("Cannot find square root: likely non-prime P");if(1===r){const t=(e+Op)/Rp;return function(e,n){const r=e.pow(n,t);if(!e.eql(e.sqr(r),n))throw new Error("Cannot find square root");return r}}const o=(n+Op)/Ap;return function(e,s){if(e.pow(s,t)===e.neg(e.ONE))throw new Error("Cannot find square root");let a=r,c=e.pow(e.mul(e.ONE,i),n),l=e.pow(s,o),u=e.pow(s,n);for(;!e.eql(u,e.ONE);){if(e.eql(u,e.ZERO))return e.ZERO;let t=1;for(let r=e.sqr(u);t<a&&!e.eql(r,e.ONE);t++)r=e.sqr(r);const n=e.pow(c,Op<<BigInt(a-t-1));c=e.sqr(n),l=e.mul(l,n),u=e.mul(u,c),a=t}return l}}(e)}const Dp=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function jp(e,t){const n=void 0!==t?t:e.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function Mp(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(e<=Ip)throw new Error("invalid field: expected ORDER > 0, got "+e);const{nBitLength:i,nByteLength:o}=jp(e,t);if(o>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let s;const a=Object.freeze({ORDER:e,isLE:n,BITS:i,BYTES:o,MASK:Ep(i),ZERO:Ip,ONE:Op,create:t=>Cp(t,e),isValid:t=>{if("bigint"!=typeof t)throw new Error("invalid field element: expected bigint, got "+typeof t);return Ip<=t&&t<e},is0:e=>e===Ip,isOdd:e=>(e&Op)===Op,neg:t=>Cp(-t,e),eql:(e,t)=>e===t,sqr:t=>Cp(t*t,e),add:(t,n)=>Cp(t+n,e),sub:(t,n)=>Cp(t-n,e),mul:(t,n)=>Cp(t*n,e),pow:(e,t)=>function(e,t,n){if(n<Ip)throw new Error("invalid exponent, negatives unsupported");if(n===Ip)return e.ONE;if(n===Op)return t;let r=e.ONE,i=t;for(;n>Ip;)n&Op&&(r=e.mul(r,i)),i=e.sqr(i),n>>=Op;return r}(a,e,t),div:(t,n)=>Cp(t*Bp(n,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>Bp(t,e),sqrt:r.sqrt||(t=>(s||(s=Lp(e)),s(a,t))),invertBatch:e=>function(e,t){const n=new Array(t.length),r=t.reduce(((t,r,i)=>e.is0(r)?t:(n[i]=t,e.mul(t,r))),e.ONE),i=e.inv(r);return t.reduceRight(((t,r,i)=>e.is0(r)?t:(n[i]=e.mul(t,n[i]),e.mul(t,r))),i),n}(a,e),cmov:(e,t,n)=>n?t:e,toBytes:e=>n?yp(e,o):gp(e,o),fromBytes:e=>{if(e.length!==o)throw new Error("Field.fromBytes: expected "+o+" bytes, got "+e.length);return n?pp(e):function(e){return up(lp(e))}(e)}});return Object.freeze(a)}const Fp=BigInt(0),zp=BigInt(1);function qp(e,t){const n=t.negate();return e?n:t}function Hp(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function Vp(e,t){Hp(e,t);return{windows:Math.ceil(t/e)+1,windowSize:2**(e-1)}}const Kp=new WeakMap,Wp=new WeakMap;function Gp(e){return Wp.get(e)||1}function Yp(e,t,n,r){if(function(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach(((e,n)=>{if(!(e instanceof t))throw new Error("invalid point at index "+n)}))}(n,e),function(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach(((e,n)=>{if(!t.isValid(e))throw new Error("invalid scalar at index "+n)}))}(r,t),n.length!==r.length)throw new Error("arrays of points and scalars must have equal length");const i=e.ZERO,o=function(e){let t;for(t=0;e>np;e>>=rp,t+=1);return t}(BigInt(n.length)),s=o>12?o-3:o>4?o-2:o?2:1,a=(1<<s)-1,c=new Array(a+1).fill(i);let l=i;for(let u=Math.floor((t.BITS-1)/s)*s;u>=0;u-=s){c.fill(i);for(let t=0;t<r.length;t++){const e=r[t],i=Number(e>>BigInt(u)&BigInt(a));c[i]=c[i].add(n[t])}let e=i;for(let t=c.length-1,n=i;t>0;t--)n=n.add(c[t]),e=e.add(n);if(l=l.add(e),0!==u)for(let t=0;t<s;t++)l=l.double()}return l}function Zp(e){return function(e){const t=Dp.reduce(((e,t)=>(e[t]="function",e)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"});Sp(e,t)}(e.Fp),Sp(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...jp(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}const Xp=BigInt(0),Qp=BigInt(1),Jp=BigInt(2),$p=BigInt(8),eg={zip215:!0};function tg(e){const t=function(e){const t=Zp(e);return Sp(e,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}(e),{Fp:n,n:r,prehash:i,hash:o,randomBytes:s,nByteLength:a,h:c}=t,l=Jp<<BigInt(8*a)-Qp,u=n.create,d=Mp(t.n,t.nBitLength),f=t.uvRatio||((e,t)=>{try{return{isValid:!0,value:n.sqrt(e*n.inv(t))}}catch{return{isValid:!1,value:Xp}}}),h=t.adjustScalarBytes||(e=>e),p=t.domain||((e,t,n)=>{if(ap("phflag",n),t.length||n)throw new Error("Contexts/pre-hash are not supported");return e});function g(e,t){wp("coordinate "+e,t,Xp,l)}function y(e){if(!(e instanceof b))throw new Error("ExtendedPoint expected")}const m=xp(((e,t)=>{const{ex:r,ey:i,ez:o}=e,s=e.is0();null==t&&(t=s?$p:n.inv(o));const a=u(r*t),c=u(i*t),l=u(o*t);if(s)return{x:Xp,y:Qp};if(l!==Qp)throw new Error("invZ was invalid");return{x:a,y:c}})),v=xp((e=>{const{a:n,d:r}=t;if(e.is0())throw new Error("bad point: ZERO");const{ex:i,ey:o,ez:s,et:a}=e,c=u(i*i),l=u(o*o),d=u(s*s),f=u(d*d),h=u(c*n);if(u(d*u(h+l))!==u(f+u(r*u(c*l))))throw new Error("bad point: equation left != right (1)");if(u(i*o)!==u(s*a))throw new Error("bad point: equation left != right (2)");return!0}));class b{constructor(e,t,n,r){this.ex=e,this.ey=t,this.ez=n,this.et=r,g("x",e),g("y",t),g("z",n),g("t",r),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(e){if(e instanceof b)throw new Error("extended point not allowed");const{x:t,y:n}=e||{};return g("x",t),g("y",n),new b(t,n,Qp,u(t*n))}static normalizeZ(e){const t=n.invertBatch(e.map((e=>e.ez)));return e.map(((e,n)=>e.toAffine(t[n]))).map(b.fromAffine)}static msm(e,t){return Yp(b,d,e,t)}_setWindowSize(e){_.setWindowSize(this,e)}assertValidity(){v(this)}equals(e){y(e);const{ex:t,ey:n,ez:r}=this,{ex:i,ey:o,ez:s}=e,a=u(t*s),c=u(i*r),l=u(n*s),d=u(o*r);return a===c&&l===d}is0(){return this.equals(b.ZERO)}negate(){return new b(u(-this.ex),this.ey,this.ez,u(-this.et))}double(){const{a:e}=t,{ex:n,ey:r,ez:i}=this,o=u(n*n),s=u(r*r),a=u(Jp*u(i*i)),c=u(e*o),l=n+r,d=u(u(l*l)-o-s),f=c+s,h=f-a,p=c-s,g=u(d*h),y=u(f*p),m=u(d*p),v=u(h*f);return new b(g,y,v,m)}add(e){y(e);const{a:n,d:r}=t,{ex:i,ey:o,ez:s,et:a}=this,{ex:c,ey:l,ez:d,et:f}=e;if(n===BigInt(-1)){const e=u((o-i)*(l+c)),t=u((o+i)*(l-c)),n=u(t-e);if(n===Xp)return this.double();const r=u(s*Jp*f),h=u(a*Jp*d),p=h+r,g=t+e,y=h-r,m=u(p*n),v=u(g*y),w=u(p*y),E=u(n*g);return new b(m,v,E,w)}const h=u(i*c),p=u(o*l),g=u(a*r*f),m=u(s*d),v=u((i+o)*(c+l)-h-p),w=m-g,E=m+g,_=u(p-n*h),S=u(v*w),x=u(E*_),I=u(v*_),O=u(w*E);return new b(S,x,O,I)}subtract(e){return this.add(e.negate())}wNAF(e){return _.wNAFCached(this,e,b.normalizeZ)}multiply(e){const t=e;wp("scalar",t,Qp,r);const{p:n,f:i}=this.wNAF(t);return b.normalizeZ([n,i])[0]}multiplyUnsafe(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:b.ZERO;const n=e;return wp("scalar",n,Xp,r),n===Xp?E:this.is0()||n===Qp?this:_.wNAFCachedUnsafe(this,n,b.normalizeZ,t)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return _.unsafeLadder(this,r).is0()}toAffine(e){return m(this,e)}clearCofactor(){const{h:e}=t;return e===Qp?this:this.multiplyUnsafe(e)}static fromHex(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{d:i,a:o}=t,s=n.BYTES;e=mp("pointHex",e,s),ap("zip215",r);const a=e.slice(),c=e[s-1];a[s-1]=-129&c;const d=pp(a),h=r?l:n.ORDER;wp("pointHex.y",d,Xp,h);const p=u(d*d),g=u(p-Qp),y=u(i*p-o);let{isValid:m,value:v}=f(g,y);if(!m)throw new Error("Point.fromHex: invalid y coordinate");const w=(v&Qp)===Qp,E=0!==(128&c);if(!r&&v===Xp&&E)throw new Error("Point.fromHex: x=0 and x_0=1");return E!==w&&(v=u(-v)),b.fromAffine({x:v,y:d})}static fromPrivateKey(e){return I(e).point}toRawBytes(){const{x:e,y:t}=this.toAffine(),r=yp(t,n.BYTES);return r[r.length-1]|=e&Qp?128:0,r}toHex(){return lp(this.toRawBytes())}}b.BASE=new b(t.Gx,t.Gy,Qp,u(t.Gx*t.Gy)),b.ZERO=new b(Xp,Qp,Qp,Xp);const{BASE:w,ZERO:E}=b,_=function(e,t){return{constTimeNegate:qp,hasPrecomputes:e=>1!==Gp(e),unsafeLadder(t,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.ZERO,i=t;for(;n>Fp;)n&zp&&(r=r.add(i)),i=i.double(),n>>=zp;return r},precomputeWindow(e,n){const{windows:r,windowSize:i}=Vp(n,t),o=[];let s=e,a=s;for(let t=0;t<r;t++){a=s,o.push(a);for(let e=1;e<i;e++)a=a.add(s),o.push(a);s=a.double()}return o},wNAF(n,r,i){const{windows:o,windowSize:s}=Vp(n,t);let a=e.ZERO,c=e.BASE;const l=BigInt(2**n-1),u=2**n,d=BigInt(n);for(let e=0;e<o;e++){const t=e*s;let n=Number(i&l);i>>=d,n>s&&(n-=u,i+=zp);const o=t,f=t+Math.abs(n)-1,h=e%2!==0,p=n<0;0===n?c=c.add(qp(h,r[o])):a=a.add(qp(p,r[f]))}return{p:a,f:c}},wNAFUnsafe(n,r,i){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.ZERO;const{windows:s,windowSize:a}=Vp(n,t),c=BigInt(2**n-1),l=2**n,u=BigInt(n);for(let e=0;e<s;e++){const t=e*a;if(i===Fp)break;let n=Number(i&c);if(i>>=u,n>a&&(n-=l,i+=zp),0===n)continue;let s=r[t+Math.abs(n)-1];n<0&&(s=s.negate()),o=o.add(s)}return o},getPrecomputes(e,t,n){let r=Kp.get(t);return r||(r=this.precomputeWindow(t,e),1!==e&&Kp.set(t,n(r))),r},wNAFCached(e,t,n){const r=Gp(e);return this.wNAF(r,this.getPrecomputes(r,e,n),t)},wNAFCachedUnsafe(e,t,n,r){const i=Gp(e);return 1===i?this.unsafeLadder(e,t,r):this.wNAFUnsafe(i,this.getPrecomputes(i,e,n),t,r)},setWindowSize(e,n){Hp(n,t),Wp.set(e,n),Kp.delete(e)}}}(b,8*a);function S(e){return Cp(e,r)}function x(e){return S(pp(e))}function I(e){const t=n.BYTES;e=mp("private key",e,t);const r=mp("hashed private key",o(e),2*t),i=h(r.slice(0,t)),s=r.slice(t,2*t),a=x(i),c=w.multiply(a),l=c.toRawBytes();return{head:i,prefix:s,scalar:a,point:c,pointBytes:l}}function O(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Uint8Array;for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];const s=vp(...n);return x(o(p(s,mp("context",e),!!i)))}const A=eg;return w._setWindowSize(8),{CURVE:t,getPublicKey:function(e){return I(e).pointBytes},sign:function(e,t){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};e=mp("message",e),i&&(e=i(e));const{prefix:s,scalar:a,pointBytes:c}=I(t),l=O(o.context,s,e),u=w.multiply(l).toRawBytes(),d=S(l+O(o.context,u,c,e)*a);return wp("signature.s",d,Xp,r),mp("result",vp(u,yp(d,n.BYTES)),2*n.BYTES)},verify:function(e,t,r){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:A;const{context:s,zip215:a}=o,c=n.BYTES;e=mp("signature",e,2*c),t=mp("message",t),r=mp("publicKey",r,c),void 0!==a&&ap("zip215",a),i&&(t=i(t));const l=pp(e.slice(c,2*c));let u,d,f;try{u=b.fromHex(r,a),d=b.fromHex(e.slice(0,c),a),f=w.multiplyUnsafe(l)}catch{return!1}if(!a&&u.isSmallOrder())return!1;const h=O(s,d.toRawBytes(),u.toRawBytes(),t);return d.add(u.multiplyUnsafe(h)).subtract(f).clearCofactor().equals(b.ZERO)},ExtendedPoint:b,utils:{getExtendedPublicKey:I,randomPrivateKey:()=>s(n.BYTES),precompute(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:8,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:b.BASE;return t._setWindowSize(e),t.multiply(BigInt(3)),t}}}}BigInt(0),BigInt(1);const ng=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),rg=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);const ig=BigInt(1),og=BigInt(2);BigInt(3);const sg=BigInt(5),ag=BigInt(8);function cg(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}function lg(e,t){const n=ng,r=Cp(t*t*t,n),i=function(e){const t=BigInt(10),n=BigInt(20),r=BigInt(40),i=BigInt(80),o=ng,s=e*e%o*e%o,a=Up(s,og,o)*s%o,c=Up(a,ig,o)*e%o,l=Up(c,sg,o)*c%o,u=Up(l,t,o)*l%o,d=Up(u,n,o)*u%o,f=Up(d,r,o)*d%o,h=Up(f,i,o)*f%o,p=Up(h,i,o)*f%o,g=Up(p,t,o)*l%o;return{pow_p_5_8:Up(g,og,o)*e%o,b2:s}}(e*Cp(r*r*t,n)).pow_p_5_8;let o=Cp(e*r*i,n);const s=Cp(t*o*o,n),a=o,c=Cp(o*rg,n),l=s===e,u=s===Cp(-e,n),d=s===Cp(-e*rg,n);return l&&(o=a),(u||d)&&(o=c),((e,t)=>(Cp(e,t)&Op)===Op)(o,n)&&(o=Cp(-o,n)),{isValid:l||u,value:o}}const ug=Mp(ng,void 0,!0),dg=tg({a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:ug,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:ag,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:tp,randomBytes:Vh,adjustScalarBytes:cg,uvRatio:lg}),fg="EdDSA",hg=".",pg="base64url",gg="utf8",yg="utf8",mg=":",vg="did",bg="key",wg="base58btc",Eg="z",_g="K36";function Sg(e){return null!=globalThis.Buffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}function xg(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?Sg(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}function Ig(e,t){t||(t=e.reduce(((e,t)=>e+t.length),0));const n=xg(t);let r=0;for(const i of e)n.set(i,r),r+=i.length;return Sg(n)}var Og=function(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),r=0;r<n.length;r++)n[r]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),s=o.charCodeAt(0);if(255!==n[s])throw new TypeError(o+" is ambiguous");n[s]=i}var a=e.length,c=e.charAt(0),l=Math.log(a)/Math.log(256),u=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 r=0,i=0;e[t]===c;)r++,t++;for(var o=(e.length-t)*l+1>>>0,s=new Uint8Array(o);e[t];){var u=n[e.charCodeAt(t)];if(255===u)return;for(var d=0,f=o-1;(0!==u||d<i)&&-1!==f;f--,d++)u+=a*s[f]>>>0,s[f]=u%256>>>0,u=u/256>>>0;if(0!==u)throw new Error("Non-zero carry");i=d,t++}if(" "!==e[t]){for(var h=o-i;h!==o&&0===s[h];)h++;for(var p=new Uint8Array(r+(o-h)),g=r;h!==o;)p[g++]=s[h++];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 n=0,r=0,i=0,o=t.length;i!==o&&0===t[i];)i++,n++;for(var s=(o-i)*u+1>>>0,l=new Uint8Array(s);i!==o;){for(var d=t[i],f=0,h=s-1;(0!==d||f<r)&&-1!==h;h--,f++)d+=256*l[h]>>>0,l[h]=d%a>>>0,d=d/a>>>0;if(0!==d)throw new Error("Non-zero carry");r=f,i++}for(var p=s-r;p!==s&&0===l[p];)p++;for(var g=c.repeat(n);p<s;++p)g+=e.charAt(l[p]);return g},decodeUnsafe:d,decode:function(e){var n=d(e);if(n)return n;throw new Error("Non-".concat(t," character"))}}},Ag=Og;const Tg=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")};class Rg{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return"".concat(this.prefix).concat(this.baseEncode(e));throw Error("Unknown type, must be binary type")}}class kg{constructor(e,t,n){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if("string"==typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error("Unable to decode multibase string ".concat(JSON.stringify(e),", ").concat(this.name," decoder only supports inputs prefixed with ").concat(this.prefix));return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return Cg(this,e)}}class Pg{constructor(e){this.decoders=e}or(e){return Cg(this,e)}decode(e){const t=e[0],n=this.decoders[t];if(n)return n.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 Cg=(e,t)=>new Pg({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class Ng{constructor(e,t,n,r){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=r,this.encoder=new Rg(e,t,n),this.decoder=new kg(e,t,r)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Ug=e=>{let{name:t,prefix:n,encode:r,decode:i}=e;return new Ng(t,n,r,i)},Bg=e=>{let{prefix:t,name:n,alphabet:r}=e;const{encode:i,decode:o}=Ag(r,n);return Ug({prefix:t,name:n,encode:i,decode:e=>Tg(o(e))})},Lg=e=>{let{name:t,prefix:n,bitsPerChar:r,alphabet:i}=e;return Ug({prefix:n,name:t,encode:e=>((e,t,n)=>{const r="="===t[t.length-1],i=(1<<n)-1;let o="",s=0,a=0;for(let c=0;c<e.length;++c)for(a=a<<8|e[c],s+=8;s>n;)s-=n,o+=t[i&a>>s];if(s&&(o+=t[i&a<<n-s]),r)for(;o.length*n&7;)o+="=";return o})(e,i,r),decode:e=>((e,t,n,r)=>{const i={};for(let u=0;u<t.length;++u)i[t[u]]=u;let o=e.length;for(;"="===e[o-1];)--o;const s=new Uint8Array(o*n/8|0);let a=0,c=0,l=0;for(let u=0;u<o;++u){const t=i[e[u]];if(void 0===t)throw new SyntaxError("Non-".concat(r," character"));c=c<<n|t,a+=n,a>=8&&(a-=8,s[l++]=255&c>>a)}if(a>=n||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return s})(e,i,r,t)})},Dg=Ug({prefix:"\0",name:"identity",encode:e=>(e=>(new TextDecoder).decode(e))(e),decode:e=>(e=>(new TextEncoder).encode(e))(e)});var jg=Object.freeze({__proto__:null,identity:Dg});const Mg=Lg({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Fg=Object.freeze({__proto__:null,base2:Mg});const zg=Lg({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var qg=Object.freeze({__proto__:null,base8:zg});const Hg=Bg({prefix:"9",name:"base10",alphabet:"0123456789"});var Vg=Object.freeze({__proto__:null,base10:Hg});const Kg=Lg({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Wg=Lg({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Gg=Object.freeze({__proto__:null,base16:Kg,base16upper:Wg});const Yg=Lg({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Zg=Lg({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Xg=Lg({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Qg=Lg({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Jg=Lg({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),$g=Lg({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),ey=Lg({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),ty=Lg({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),ny=Lg({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var ry=Object.freeze({__proto__:null,base32:Yg,base32upper:Zg,base32pad:Xg,base32padupper:Qg,base32hex:Jg,base32hexupper:$g,base32hexpad:ey,base32hexpadupper:ty,base32z:ny});const iy=Bg({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),oy=Bg({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var sy=Object.freeze({__proto__:null,base36:iy,base36upper:oy});const ay=Bg({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),cy=Bg({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var ly=Object.freeze({__proto__:null,base58btc:ay,base58flickr:cy});const uy=Lg({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),dy=Lg({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),fy=Lg({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),hy=Lg({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var py=Object.freeze({__proto__:null,base64:uy,base64pad:dy,base64url:fy,base64urlpad:hy});const gy=Array.from("\ud83d\ude80\ud83e\ude90\u2604\ud83d\udef0\ud83c\udf0c\ud83c\udf11\ud83c\udf12\ud83c\udf13\ud83c\udf14\ud83c\udf15\ud83c\udf16\ud83c\udf17\ud83c\udf18\ud83c\udf0d\ud83c\udf0f\ud83c\udf0e\ud83d\udc09\u2600\ud83d\udcbb\ud83d\udda5\ud83d\udcbe\ud83d\udcbf\ud83d\ude02\u2764\ud83d\ude0d\ud83e\udd23\ud83d\ude0a\ud83d\ude4f\ud83d\udc95\ud83d\ude2d\ud83d\ude18\ud83d\udc4d\ud83d\ude05\ud83d\udc4f\ud83d\ude01\ud83d\udd25\ud83e\udd70\ud83d\udc94\ud83d\udc96\ud83d\udc99\ud83d\ude22\ud83e\udd14\ud83d\ude06\ud83d\ude44\ud83d\udcaa\ud83d\ude09\u263a\ud83d\udc4c\ud83e\udd17\ud83d\udc9c\ud83d\ude14\ud83d\ude0e\ud83d\ude07\ud83c\udf39\ud83e\udd26\ud83c\udf89\ud83d\udc9e\u270c\u2728\ud83e\udd37\ud83d\ude31\ud83d\ude0c\ud83c\udf38\ud83d\ude4c\ud83d\ude0b\ud83d\udc97\ud83d\udc9a\ud83d\ude0f\ud83d\udc9b\ud83d\ude42\ud83d\udc93\ud83e\udd29\ud83d\ude04\ud83d\ude00\ud83d\udda4\ud83d\ude03\ud83d\udcaf\ud83d\ude48\ud83d\udc47\ud83c\udfb6\ud83d\ude12\ud83e\udd2d\u2763\ud83d\ude1c\ud83d\udc8b\ud83d\udc40\ud83d\ude2a\ud83d\ude11\ud83d\udca5\ud83d\ude4b\ud83d\ude1e\ud83d\ude29\ud83d\ude21\ud83e\udd2a\ud83d\udc4a\ud83e\udd73\ud83d\ude25\ud83e\udd24\ud83d\udc49\ud83d\udc83\ud83d\ude33\u270b\ud83d\ude1a\ud83d\ude1d\ud83d\ude34\ud83c\udf1f\ud83d\ude2c\ud83d\ude43\ud83c\udf40\ud83c\udf37\ud83d\ude3b\ud83d\ude13\u2b50\u2705\ud83e\udd7a\ud83c\udf08\ud83d\ude08\ud83e\udd18\ud83d\udca6\u2714\ud83d\ude23\ud83c\udfc3\ud83d\udc90\u2639\ud83c\udf8a\ud83d\udc98\ud83d\ude20\u261d\ud83d\ude15\ud83c\udf3a\ud83c\udf82\ud83c\udf3b\ud83d\ude10\ud83d\udd95\ud83d\udc9d\ud83d\ude4a\ud83d\ude39\ud83d\udde3\ud83d\udcab\ud83d\udc80\ud83d\udc51\ud83c\udfb5\ud83e\udd1e\ud83d\ude1b\ud83d\udd34\ud83d\ude24\ud83c\udf3c\ud83d\ude2b\u26bd\ud83e\udd19\u2615\ud83c\udfc6\ud83e\udd2b\ud83d\udc48\ud83d\ude2e\ud83d\ude46\ud83c\udf7b\ud83c\udf43\ud83d\udc36\ud83d\udc81\ud83d\ude32\ud83c\udf3f\ud83e\udde1\ud83c\udf81\u26a1\ud83c\udf1e\ud83c\udf88\u274c\u270a\ud83d\udc4b\ud83d\ude30\ud83e\udd28\ud83d\ude36\ud83e\udd1d\ud83d\udeb6\ud83d\udcb0\ud83c\udf53\ud83d\udca2\ud83e\udd1f\ud83d\ude41\ud83d\udea8\ud83d\udca8\ud83e\udd2c\u2708\ud83c\udf80\ud83c\udf7a\ud83e\udd13\ud83d\ude19\ud83d\udc9f\ud83c\udf31\ud83d\ude16\ud83d\udc76\ud83e\udd74\u25b6\u27a1\u2753\ud83d\udc8e\ud83d\udcb8\u2b07\ud83d\ude28\ud83c\udf1a\ud83e\udd8b\ud83d\ude37\ud83d\udd7a\u26a0\ud83d\ude45\ud83d\ude1f\ud83d\ude35\ud83d\udc4e\ud83e\udd32\ud83e\udd20\ud83e\udd27\ud83d\udccc\ud83d\udd35\ud83d\udc85\ud83e\uddd0\ud83d\udc3e\ud83c\udf52\ud83d\ude17\ud83e\udd11\ud83c\udf0a\ud83e\udd2f\ud83d\udc37\u260e\ud83d\udca7\ud83d\ude2f\ud83d\udc86\ud83d\udc46\ud83c\udfa4\ud83d\ude47\ud83c\udf51\u2744\ud83c\udf34\ud83d\udca3\ud83d\udc38\ud83d\udc8c\ud83d\udccd\ud83e\udd40\ud83e\udd22\ud83d\udc45\ud83d\udca1\ud83d\udca9\ud83d\udc50\ud83d\udcf8\ud83d\udc7b\ud83e\udd10\ud83e\udd2e\ud83c\udfbc\ud83e\udd75\ud83d\udea9\ud83c\udf4e\ud83c\udf4a\ud83d\udc7c\ud83d\udc8d\ud83d\udce3\ud83e\udd42"),yy=gy.reduce(((e,t,n)=>(e[n]=t,e)),[]),my=gy.reduce(((e,t,n)=>(e[t.codePointAt(0)]=n,e)),[]);const vy=Ug({prefix:"\ud83d\ude80",name:"base256emoji",encode:function(e){return e.reduce(((e,t)=>e+=yy[t]),"")},decode:function(e){const t=[];for(const n of e){const e=my[n.codePointAt(0)];if(void 0===e)throw new Error("Non-base256emoji character: ".concat(n));t.push(e)}return new Uint8Array(t)}});var by=Object.freeze({__proto__:null,base256emoji:vy}),wy=function e(t,n,r){n=n||[];for(var i=r=r||0;t>=Sy;)n[r++]=255&t|Ey,t/=128;for(;t&_y;)n[r++]=255&t|Ey,t>>>=7;return n[r]=0|t,e.bytes=r-i+1,n},Ey=128,_y=-128,Sy=Math.pow(2,31);var xy=function e(t,n){var r,i=0,o=0,s=n=n||0,a=t.length;do{if(s>=a)throw e.bytes=0,new RangeError("Could not decode varint");r=t[s++],i+=o<28?(r&Oy)<<o:(r&Oy)*Math.pow(2,o),o+=7}while(r>=Iy);return e.bytes=s-n,i},Iy=128,Oy=127;var Ay=Math.pow(2,7),Ty=Math.pow(2,14),Ry=Math.pow(2,21),ky=Math.pow(2,28),Py=Math.pow(2,35),Cy=Math.pow(2,42),Ny=Math.pow(2,49),Uy=Math.pow(2,56),By=Math.pow(2,63),Ly={encode:wy,decode:xy,encodingLength:function(e){return e<Ay?1:e<Ty?2:e<Ry?3:e<ky?4:e<Py?5:e<Cy?6:e<Ny?7:e<Uy?8:e<By?9:10}},Dy=Ly;const jy=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Dy.encode(e,t,n),t},My=e=>Dy.encodingLength(e),Fy=(e,t)=>{const n=t.byteLength,r=My(e),i=r+My(n),o=new Uint8Array(i+n);return jy(e,o,0),jy(n,o,r),o.set(t,i),new zy(e,n,t,o)};class zy{constructor(e,t,n,r){this.code=e,this.size=t,this.digest=n,this.bytes=r}}const qy=e=>{let{name:t,code:n,encode:r}=e;return new Hy(t,n,r)};class Hy{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?Fy(this.code,t):t.then((e=>Fy(this.code,e)))}throw Error("Unknown type, must be binary type")}}const Vy=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),Ky=qy({name:"sha2-256",code:18,encode:Vy("SHA-256")}),Wy=qy({name:"sha2-512",code:19,encode:Vy("SHA-512")});Object.freeze({__proto__:null,sha256:Ky,sha512:Wy});const Gy=Tg,Yy={code:0,name:"identity",encode:Gy,digest:e=>Fy(0,Gy(e))};Object.freeze({__proto__:null,identity:Yy});new TextEncoder,new TextDecoder;const Zy={...jg,...Fg,...qg,...Vg,...Gg,...ry,...sy,...ly,...py,...by};function Xy(e,t,n,r){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:n},decoder:{decode:r}}}const Qy=Xy("utf8","u",(e=>"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),Jy=Xy("ascii","a",(e=>{let t="a";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t}),(e=>{const t=xg((e=e.substring(1)).length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t})),$y={utf8:Qy,"utf-8":Qy,hex:Zy.base16,latin1:Jy,ascii:Jy,binary:Jy,...Zy};function em(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf8";const n=$y[t];if(!n)throw new Error('Unsupported encoding "'.concat(t,'"'));return"utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?n.encoder.encode(e).substring(1):globalThis.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("utf8")}function tm(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf8";const n=$y[t];if(!n)throw new Error('Unsupported encoding "'.concat(t,'"'));return"utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?n.decoder.decode("".concat(n.prefix).concat(e)):Sg(globalThis.Buffer.from(e,"utf-8"))}function nm(e){return ff(em(tm(e,pg),gg))}function rm(e){return em(tm(hf(e),gg),pg)}function im(e){const t=tm(_g,wg),n=Eg+em(Ig([t,e]),wg);return[vg,bg,n].join(mg)}function om(e){return em(e,pg)}function sm(e){const t=e.split(hg),n=nm(t[0]),r=nm(t[1]),i=function(e){return tm(e,pg)}(t[2]);return{header:n,payload:r,signature:i,data:tm(t.slice(0,2).join(hg),yg)}}function am(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Vh(32);const t=dg.getPublicKey(e);return{secretKey:Ig([e,t]),publicKey:t}}async function cm(e,t,n,r){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:(0,Bd.fromMiliseconds)(Date.now());const o={alg:fg,typ:"JWT"},s={iss:im(r.publicKey),sub:e,aud:t,iat:i,exp:i+n},a=function(e){return tm([rm(e.header),rm(e.payload)].join(hg),yg)}({header:o,payload:s});return function(e){return[rm(e.header),rm(e.payload),om(e.signature)].join(hg)}({header:o,payload:s,signature:dg.sign(a,r.secretKey.slice(0,32))})}var lm=function(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))},um=function(e,t,n){this.name=e,this.version=t,this.os=n,this.type="browser"},dm=function(e){this.version=e,this.type="node",this.name="node",this.os=process.platform},fm=function(e,t,n,r){this.name=e,this.version=t,this.os=n,this.bot=r,this.type="bot-device"},hm=function(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null},pm=function(){this.type="react-native",this.name="react-native",this.version=null,this.os=null},gm=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,ym=3,mm=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["pie",/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],["pie",/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],["netfront",/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/]],vm=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Windows CE",/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function bm(e){return e?Em(e):"undefined"===typeof document&&"undefined"!==typeof navigator&&"ReactNative"===navigator.product?new pm:"undefined"!==typeof navigator?Em(navigator.userAgent):"undefined"!==typeof process&&process.version?new dm(process.version.slice(1)):null}function wm(e){return""!==e&&mm.reduce((function(t,n){var r=n[0],i=n[1];if(t)return t;var o=i.exec(e);return!!o&&[r,o]}),!1)}function Em(e){var t=wm(e);if(!t)return null;var n=t[0],r=t[1];if("searchbot"===n)return new hm;var i=r[1]&&r[1].split(".").join("_").split("_").slice(0,3);i?i.length<ym&&(i=lm(lm([],i,!0),function(e){for(var t=[],n=0;n<e;n++)t.push("0");return t}(ym-i.length),!0)):i=[];var o=i.join("."),s=function(e){for(var t=0,n=vm.length;t<n;t++){var r=vm[t],i=r[0];if(r[1].exec(e))return i}return null}(e),a=gm.exec(e);return a&&a[1]?new fm(n,o,s,a[1]):new um(n,o,s)}var _m=n(8938),Sm=n(2829);class xm extends Error{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=(e=>{if(t.cause instanceof xm){if(t.cause.details)return t.cause.details;if(t.cause.shortMessage)return t.cause.shortMessage}return t.cause&&"details"in t.cause&&"string"===typeof t.cause.details?t.cause.details:null!==(e=t.cause)&&void 0!==e&&e.message?t.cause.message:t.details})(),r=t.cause instanceof xm&&t.cause.docsPath||t.docsPath,i="".concat("https://oxlib.sh").concat(null!==r&&void 0!==r?r:""),o=[e||"An error occurred.",...t.metaMessages?["",...t.metaMessages]:[],...n||r?["",n?"Details: ".concat(n):void 0,r?"See: ".concat(i):void 0]:[]].filter((e=>"string"===typeof e)).join("\n");super(o,t.cause?{cause:t.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:"ox@".concat("0.1.1")}),this.cause=t.cause,this.details=n,this.docs=i,this.docsPath=r,this.shortMessage=e}walk(e){return Im(this,e)}}function Im(e,t){return null!==t&&void 0!==t&&t(e)?e:e&&"object"===typeof e&&"cause"in e&&e.cause?Im(e.cause,t):t?null:e}function Om(e,t){if(Dm(e)>t)throw new qm({givenSize:Dm(e),maxSize:t})}function Am(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{dir:n,size:r=32}=t;if(0===r)return e;const i=e.replace("0x","");if(i.length>2*r)throw new Vm({size:Math.ceil(i.length/2),targetSize:r,type:"Hex"});return"0x".concat(i["right"===n?"padEnd":"padStart"](2*r,"0"))}const Tm="#__bigint";function Rm(e,t,n){return JSON.stringify(e,((e,n)=>"function"===typeof t?t(e,n):"bigint"===typeof n?n.toString()+Tm:n),n)}const km=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function Pm(e){return e instanceof Uint8Array?Cm(e):Array.isArray(e)?Cm(new Uint8Array(e)):e}function Cm(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n="";for(let i=0;i<e.length;i++)n+=km[e[i]];const r="0x".concat(n);return"number"===typeof t.size?(Om(r,t.size),Bm(r,t.size)):r}function Nm(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{signed:n,size:r}=t,i=BigInt(e);let o;r?o=n?(1n<<8n*BigInt(r)-1n)-1n:2n**(8n*BigInt(r))-1n:"number"===typeof e&&(o=BigInt(Number.MAX_SAFE_INTEGER));const s="bigint"===typeof o&&n?-o-1n:0;if(o&&i>o||i<s){const t="bigint"===typeof e?"n":"";throw new Mm({max:o?"".concat(o).concat(t):void 0,min:"".concat(s).concat(t),signed:n,size:r,value:"".concat(e).concat(t)})}const a=(n&&i<0?(1n<<BigInt(8*r))+BigInt(i):i).toString(16),c="0x".concat(a);return r?Um(c,r):c}function Um(e,t){return Am(e,{dir:"left",size:t})}function Bm(e,t){return Am(e,{dir:"right",size:t})}function Lm(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const{strict:i}=r;!function(e,t){if("number"===typeof t&&t>0&&t>Dm(e)-1)throw new Hm({offset:t,position:"start",size:Dm(e)})}(e,t);const o="0x".concat(e.replace("0x","").slice(2*(null!==t&&void 0!==t?t:0),2*(null!==n&&void 0!==n?n:e.length)));return i&&function(e,t,n){if("number"===typeof t&&"number"===typeof n&&Dm(e)!==n-t)throw new Hm({offset:n,position:"end",size:Dm(e)})}(o,t,n),o}function Dm(e){return Math.ceil((e.length-2)/2)}function jm(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{strict:n=!1}=t;try{return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{strict:n=!1}=t;if(!e)throw new Fm(e);if("string"!==typeof e)throw new Fm(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new zm(e);if(!e.startsWith("0x"))throw new zm(e)}(e,{strict:n}),!0}catch{return!1}}class Mm extends xm{constructor(e){let{max:t,min:n,signed:r,size:i,value:o}=e;super("Number `".concat(o,"` is not in safe").concat(i?" ".concat(8*i,"-bit"):"").concat(r?" signed":" unsigned"," integer range ").concat(t?"(`".concat(n,"` to `").concat(t,"`)"):"(above `".concat(n,"`)"))),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}}class Fm extends xm{constructor(e){super("Value `".concat("object"===typeof e?Rm(e):e,"` of type `").concat(typeof e,"` is an invalid hex type."),{metaMessages:['Hex types must be represented as `"0x${string}"`.']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexTypeError"})}}class zm extends xm{constructor(e){super("Value `".concat(e,"` is an invalid hex value."),{metaMessages:['Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexValueError"})}}class qm extends xm{constructor(e){let{givenSize:t,maxSize:n}=e;super("Size cannot exceed `".concat(n,"` bytes. Given size: `").concat(t,"` bytes.")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeOverflowError"})}}class Hm extends xm{constructor(e){let{offset:t,position:n,size:r}=e;super("Slice ".concat("start"===n?"starting":"ending"," at offset `").concat(t,"` is out-of-bounds (size: `").concat(r,"`).")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SliceOffsetOutOfBoundsError"})}}class Vm extends xm{constructor(e){let{size:t,targetSize:n,type:r}=e;super("".concat(r.charAt(0).toUpperCase()).concat(r.slice(1).toLowerCase()," size (`").concat(t,"`) exceeds padding size (`").concat(n,"`).")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}}function Km(e){if(130!==e.length&&132!==e.length)throw new Gm({signature:e});const t=BigInt(Lm(e,0,32)),n=BigInt(Lm(e,32,64)),r=(()=>{const t=Number("0x".concat(e.slice(130)));if(!Number.isNaN(t))try{return Wm(t)}catch{throw new Ym({value:t})}})();return"undefined"===typeof r?{r:t,s:n}:{r:t,s:n,yParity:r}}function Wm(e){if(0===e||27===e)return 0;if(1===e||28===e)return 1;if(e>=35)return e%2===0?1:0;throw new Zm({value:e})}class Gm extends xm{constructor(e){let{signature:t}=e;super("Value `".concat(t,"` is an invalid signature size."),{metaMessages:["Expected: 64 bytes or 65 bytes.","Received ".concat(Dm(Pm(t))," bytes.")]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSerializedSizeError"})}}class Ym extends xm{constructor(e){let{value:t}=e;super("Value `".concat(t,"` is an invalid y-parity value. Y-parity must be 0 or 1.")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidYParityError"})}}class Zm extends xm{constructor(e){let{value:t}=e;super("Value `".concat(t,"` is an invalid v value. v must be 27, 28 or >=35.")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidVError"})}}const Xm="object"===typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;function Qm(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Jm(e){if(!function(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}(e))throw new Error("Uint8Array expected");for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if(n.length>0&&!n.includes(e.length))throw new Error("Uint8Array expected of length "+n+", got length="+e.length)}function $m(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function ev(e,t){Jm(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function tv(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];for(let r=0;r<t.length;r++)t[r].fill(0)}function nv(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function rv(e,t){return e<<32-t|e>>>t}const iv=(()=>68===new Uint8Array(new Uint32Array([287454020]).buffer)[0])();function ov(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}const sv=iv?e=>e:function(e){for(let t=0;t<e.length;t++)e[t]=ov(e[t]);return e};function av(e){if("string"!==typeof e)throw new Error("string expected");return new Uint8Array((new TextEncoder).encode(e))}function cv(e){return"string"===typeof e&&(e=av(e)),Jm(e),e}class lv{}function uv(e){const t=t=>e().update(cv(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function dv(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:32;if(Xm&&"function"===typeof Xm.getRandomValues)return Xm.getRandomValues(new Uint8Array(e));if(Xm&&"function"===typeof Xm.randomBytes)return Uint8Array.from(Xm.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}function fv(e,t,n){return e&t^~e&n}function hv(e,t,n){return e&t^e&n^t&n}class pv extends lv{constructor(e,t,n,r){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.buffer=new Uint8Array(e),this.view=nv(this.buffer)}update(e){$m(this),Jm(e=cv(e));const{view:t,buffer:n,blockLen:r}=this,i=e.length;for(let o=0;o<i;){const s=Math.min(r-this.pos,i-o);if(s!==r)n.set(e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===r&&(this.process(t,0),this.pos=0);else{const t=nv(e);for(;r<=i-o;o+=r)this.process(t,o)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){$m(this),ev(e,this),this.finished=!0;const{buffer:t,view:n,blockLen:r,isLE:i}=this;let{pos:o}=this;t[o++]=128,tv(this.buffer.subarray(o)),this.padOffset>r-o&&(this.process(n,0),o=0);for(let u=o;u<r;u++)t[u]=0;!function(e,t,n,r){if("function"===typeof e.setBigUint64)return e.setBigUint64(t,n,r);const i=BigInt(32),o=BigInt(4294967295),s=Number(n>>i&o),a=Number(n&o),c=r?4:0,l=r?0:4;e.setUint32(t+c,s,r),e.setUint32(t+l,a,r)}(n,r-8,BigInt(8*this.length),i),this.process(n,0);const s=nv(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=a/4,l=this.get();if(c>l.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<c;u++)s.setUint32(4*u,l[u],i)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:n,length:r,finished:i,destroyed:o,pos:s}=this;return e.destroyed=o,e.finished=i,e.length=r,e.pos=s,r%t&&e.buffer.set(n),e}clone(){return this._cloneInto()}}const gv=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),yv=BigInt(2**32-1),mv=BigInt(32);function vv(e){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?{h:Number(e&yv),l:Number(e>>mv&yv)}:{h:0|Number(e>>mv&yv),l:0|Number(e&yv)}}function bv(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=e.length;let r=new Uint32Array(n),i=new Uint32Array(n);for(let o=0;o<n;o++){const{h:n,l:s}=vv(e[o],t);[r[o],i[o]]=[n,s]}return[r,i]}const wv=(e,t,n)=>e<<n|t>>>32-n,Ev=(e,t,n)=>t<<n|e>>>32-n,_v=(e,t,n)=>t<<n-32|e>>>64-n,Sv=(e,t,n)=>e<<n-32|t>>>64-n;const xv=Uint32Array.from([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]),Iv=new Uint32Array(64);class Ov extends pv{constructor(){super(64,arguments.length>0&&void 0!==arguments[0]?arguments[0]:32,8,!1),this.A=0|gv[0],this.B=0|gv[1],this.C=0|gv[2],this.D=0|gv[3],this.E=0|gv[4],this.F=0|gv[5],this.G=0|gv[6],this.H=0|gv[7]}get(){const{A:e,B:t,C:n,D:r,E:i,F:o,G:s,H:a}=this;return[e,t,n,r,i,o,s,a]}set(e,t,n,r,i,o,s,a){this.A=0|e,this.B=0|t,this.C=0|n,this.D=0|r,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(e,t){for(let u=0;u<16;u++,t+=4)Iv[u]=e.getUint32(t,!1);for(let u=16;u<64;u++){const e=Iv[u-15],t=Iv[u-2],n=rv(e,7)^rv(e,18)^e>>>3,r=rv(t,17)^rv(t,19)^t>>>10;Iv[u]=r+Iv[u-7]+n+Iv[u-16]|0}let{A:n,B:r,C:i,D:o,E:s,F:a,G:c,H:l}=this;for(let u=0;u<64;u++){const e=l+(rv(s,6)^rv(s,11)^rv(s,25))+fv(s,a,c)+xv[u]+Iv[u]|0,t=(rv(n,2)^rv(n,13)^rv(n,22))+hv(n,r,i)|0;l=c,c=a,a=s,s=o+e|0,o=i,i=r,r=n,n=e+t|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(n,r,i,o,s,a,c,l)}roundClean(){tv(Iv)}destroy(){this.set(0,0,0,0,0,0,0,0),tv(this.buffer)}}const Av=uv((()=>new Ov));class Tv extends lv{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,function(e){if("function"!==typeof e||"function"!==typeof e.create)throw new Error("Hash should be wrapped by utils.createHasher");Qm(e.outputLen),Qm(e.blockLen)}(e);const n=cv(t);if(this.iHash=e.create(),"function"!==typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,i=new Uint8Array(r);i.set(n.length>r?e.create().update(n).digest():n);for(let o=0;o<i.length;o++)i[o]^=54;this.iHash.update(i),this.oHash=e.create();for(let o=0;o<i.length;o++)i[o]^=106;this.oHash.update(i),tv(i)}update(e){return $m(this),this.iHash.update(e),this}digestInto(e){$m(this),Jm(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:n,finished:r,destroyed:i,blockLen:o,outputLen:s}=this;return e.finished=r,e.destroyed=i,e.blockLen=o,e.outputLen=s,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const Rv=(e,t,n)=>new Tv(e,t).update(n).digest();Rv.create=(e,t)=>new Tv(e,t);const kv=BigInt(0),Pv=BigInt(1);function Cv(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function Nv(e){if(!Cv(e))throw new Error("Uint8Array expected")}function Uv(e,t){if("boolean"!==typeof t)throw new Error(e+" boolean expected, got "+t)}function Bv(e){const t=e.toString(16);return 1&t.length?"0"+t:t}function Lv(e){if("string"!==typeof e)throw new Error("hex string expected, got "+typeof e);return""===e?kv:BigInt("0x"+e)}const Dv="function"===typeof Uint8Array.from([]).toHex&&"function"===typeof Uint8Array.fromHex,jv=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function Mv(e){if(Nv(e),Dv)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=jv[e[n]];return t}const Fv={_0:48,_9:57,A:65,F:70,a:97,f:102};function zv(e){return e>=Fv._0&&e<=Fv._9?e-Fv._0:e>=Fv.A&&e<=Fv.F?e-(Fv.A-10):e>=Fv.a&&e<=Fv.f?e-(Fv.a-10):void 0}function qv(e){if("string"!==typeof e)throw new Error("hex string expected, got "+typeof e);if(Dv)return Uint8Array.fromHex(e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let i=0,o=0;i<n;i++,o+=2){const t=zv(e.charCodeAt(o)),n=zv(e.charCodeAt(o+1));if(void 0===t||void 0===n){const t=e[o]+e[o+1];throw new Error('hex string expected, got non-hex character "'+t+'" at index '+o)}r[i]=16*t+n}return r}function Hv(e){return Lv(Mv(e))}function Vv(e){return Nv(e),Lv(Mv(Uint8Array.from(e).reverse()))}function Kv(e,t){return qv(e.toString(16).padStart(2*t,"0"))}function Wv(e,t){return Kv(e,t).reverse()}function Gv(e,t,n){let r;if("string"===typeof t)try{r=qv(t)}catch(Mz){throw new Error(e+" must be hex string or Uint8Array, cause: "+Mz)}else{if(!Cv(t))throw new Error(e+" must be hex string or Uint8Array");r=Uint8Array.from(t)}const i=r.length;if("number"===typeof n&&i!==n)throw new Error(e+" of length "+n+" expected, got "+i);return r}function Yv(){let e=0;for(let n=0;n<arguments.length;n++){const t=n<0||arguments.length<=n?void 0:arguments[n];Nv(t),e+=t.length}const t=new Uint8Array(e);for(let n=0,r=0;n<arguments.length;n++){const e=n<0||arguments.length<=n?void 0:arguments[n];t.set(e,r),r+=e.length}return t}const Zv=e=>"bigint"===typeof e&&kv<=e;function Xv(e,t,n){return Zv(e)&&Zv(t)&&Zv(n)&&t<=e&&e<n}function Qv(e,t,n,r){if(!Xv(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}const Jv=e=>(Pv<<BigInt(e))-Pv,$v=e=>new Uint8Array(e),eb=e=>Uint8Array.from(e);const tb={bigint:e=>"bigint"===typeof e,function:e=>"function"===typeof e,boolean:e=>"boolean"===typeof e,string:e=>"string"===typeof e,stringOrUint8Array:e=>"string"===typeof e||Cv(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"===typeof e&&Number.isSafeInteger(e.outputLen)};function nb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=(t,n,r)=>{const i=tb[n];if("function"!==typeof i)throw new Error("invalid validator function");const o=e[t];if((!r||void 0!==o)&&!i(o,e))throw new Error("param "+String(t)+" is invalid. Expected "+n+", got "+o)};for(const[i,o]of Object.entries(t))r(i,o,!1);for(const[i,o]of Object.entries(n))r(i,o,!0);return e}function rb(e){const t=new WeakMap;return function(n){const r=t.get(n);if(void 0!==r)return 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=e(n,...o);return t.set(n,a),a}}const ib=BigInt(0),ob=BigInt(1),sb=BigInt(2),ab=BigInt(3),cb=BigInt(4),lb=BigInt(5),ub=BigInt(8);function db(e,t){const n=e%t;return n>=ib?n:t+n}function fb(e,t,n){let r=e;for(;t-- >ib;)r*=r,r%=n;return r}function hb(e,t){if(e===ib)throw new Error("invert: expected non-zero number");if(t<=ib)throw new Error("invert: expected positive modulus, got "+t);let n=db(e,t),r=t,i=ib,o=ob,s=ob,a=ib;for(;n!==ib;){const e=r/n,t=r%n,c=i-s*e,l=o-a*e;r=n,n=t,i=s,o=a,s=c,a=l}if(r!==ob)throw new Error("invert: does not exist");return db(i,t)}function pb(e,t){const n=(e.ORDER+ob)/cb,r=e.pow(t,n);if(!e.eql(e.sqr(r),t))throw new Error("Cannot find square root");return r}function gb(e,t){const n=(e.ORDER-lb)/ub,r=e.mul(t,sb),i=e.pow(r,n),o=e.mul(t,i),s=e.mul(e.mul(o,sb),i),a=e.mul(o,e.sub(s,e.ONE));if(!e.eql(e.sqr(a),t))throw new Error("Cannot find square root");return a}function yb(e){return e%cb===ab?pb:e%ub===lb?gb:function(e){if(e<BigInt(3))throw new Error("sqrt is not defined for small field");let t=e-ob,n=0;for(;t%sb===ib;)t/=sb,n++;let r=sb;const i=_b(e);for(;1===wb(i,r);)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(1===n)return pb;let o=i.pow(r,t);const s=(t+ob)/sb;return function(e,r){if(e.is0(r))return r;if(1!==wb(e,r))throw new Error("Cannot find square root");let i=n,a=e.mul(e.ONE,o),c=e.pow(r,t),l=e.pow(r,s);for(;!e.eql(c,e.ONE);){if(e.is0(c))return e.ZERO;let t=1,n=e.sqr(c);for(;!e.eql(n,e.ONE);)if(t++,n=e.sqr(n),t===i)throw new Error("Cannot find square root");const r=ob<<BigInt(i-t-1),o=e.pow(a,r);i=t,a=e.sqr(o),c=e.mul(c,a),l=e.mul(l,o)}return l}}(e)}const mb=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function vb(e,t,n){if(n<ib)throw new Error("invalid exponent, negatives unsupported");if(n===ib)return e.ONE;if(n===ob)return t;let r=e.ONE,i=t;for(;n>ib;)n&ob&&(r=e.mul(r,i)),i=e.sqr(i),n>>=ob;return r}function bb(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=new Array(t.length).fill(n?e.ZERO:void 0),i=t.reduce(((t,n,i)=>e.is0(n)?t:(r[i]=t,e.mul(t,n))),e.ONE),o=e.inv(i);return t.reduceRight(((t,n,i)=>e.is0(n)?t:(r[i]=e.mul(t,r[i]),e.mul(t,n))),o),r}function wb(e,t){const n=(e.ORDER-ob)/sb,r=e.pow(t,n),i=e.eql(r,e.ONE),o=e.eql(r,e.ZERO),s=e.eql(r,e.neg(e.ONE));if(!i&&!o&&!s)throw new Error("invalid Legendre symbol result");return i?1:o?0:-1}function Eb(e,t){void 0!==t&&Qm(t);const n=void 0!==t?t:e.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function _b(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(e<=ib)throw new Error("invalid field: expected ORDER > 0, got "+e);const{nBitLength:i,nByteLength:o}=Eb(e,t);if(o>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let s;const a=Object.freeze({ORDER:e,isLE:n,BITS:i,BYTES:o,MASK:Jv(i),ZERO:ib,ONE:ob,create:t=>db(t,e),isValid:t=>{if("bigint"!==typeof t)throw new Error("invalid field element: expected bigint, got "+typeof t);return ib<=t&&t<e},is0:e=>e===ib,isOdd:e=>(e&ob)===ob,neg:t=>db(-t,e),eql:(e,t)=>e===t,sqr:t=>db(t*t,e),add:(t,n)=>db(t+n,e),sub:(t,n)=>db(t-n,e),mul:(t,n)=>db(t*n,e),pow:(e,t)=>vb(a,e,t),div:(t,n)=>db(t*hb(n,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>hb(t,e),sqrt:r.sqrt||(t=>(s||(s=yb(e)),s(a,t))),toBytes:e=>n?Wv(e,o):Kv(e,o),fromBytes:e=>{if(e.length!==o)throw new Error("Field.fromBytes: expected "+o+" bytes, got "+e.length);return n?Vv(e):Hv(e)},invertBatch:e=>bb(a,e),cmov:(e,t,n)=>n?t:e});return Object.freeze(a)}function Sb(e){if("bigint"!==typeof e)throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function xb(e){const t=Sb(e);return t+Math.ceil(t/2)}const Ib=BigInt(0),Ob=BigInt(1);function Ab(e,t){const n=t.negate();return e?n:t}function Tb(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function Rb(e,t){Tb(e,t);const n=2**e;return{windows:Math.ceil(t/e)+1,windowSize:2**(e-1),mask:Jv(e),maxNumber:n,shiftBy:BigInt(e)}}function kb(e,t,n){const{windowSize:r,mask:i,maxNumber:o,shiftBy:s}=n;let a=Number(e&i),c=e>>s;a>r&&(a-=o,c+=Ob);const l=t*r;return{nextN:c,offset:l+Math.abs(a)-1,isZero:0===a,isNeg:a<0,isNegF:t%2!==0,offsetF:l}}function Pb(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach(((e,n)=>{if(!(e instanceof t))throw new Error("invalid point at index "+n)}))}function Cb(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach(((e,n)=>{if(!t.isValid(e))throw new Error("invalid scalar at index "+n)}))}const Nb=new WeakMap,Ub=new WeakMap;function Bb(e){return Ub.get(e)||1}function Lb(e,t,n,r){Pb(n,e),Cb(r,t);const i=n.length,o=r.length;if(i!==o)throw new Error("arrays of points and scalars must have equal length");const s=e.ZERO,a=function(e){let t;for(t=0;e>kv;e>>=Pv,t+=1);return t}(BigInt(i));let c=1;a>12?c=a-3:a>4?c=a-2:a>0&&(c=2);const l=Jv(c),u=new Array(Number(l)+1).fill(s);let d=s;for(let f=Math.floor((t.BITS-1)/c)*c;f>=0;f-=c){u.fill(s);for(let t=0;t<o;t++){const e=r[t],i=Number(e>>BigInt(f)&l);u[i]=u[i].add(n[t])}let e=s;for(let t=u.length-1,n=s;t>0;t--)n=n.add(u[t]),e=e.add(n);if(d=d.add(e),0!==f)for(let t=0;t<c;t++)d=d.double()}return d}function Db(e){return nb(e.Fp,mb.reduce(((e,t)=>(e[t]="function",e)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),nb(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Eb(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}function jb(e){void 0!==e.lowS&&Uv("lowS",e.lowS),void 0!==e.prehash&&Uv("prehash",e.prehash)}class Mb extends Error{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")}}const Fb={Err:Mb,_tlv:{encode:(e,t)=>{const{Err:n}=Fb;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(1&t.length)throw new n("tlv.encode: unpadded data");const r=t.length/2,i=Bv(r);if(i.length/2&128)throw new n("tlv.encode: long form length too big");const o=r>127?Bv(i.length/2|128):"";return Bv(e)+o+i+t},decode(e,t){const{Err:n}=Fb;let r=0;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new n("tlv.decode: wrong tlv");const i=t[r++];let o=0;if(!!(128&i)){const e=127&i;if(!e)throw new n("tlv.decode(long): indefinite length not supported");if(e>4)throw new n("tlv.decode(long): byte length is too big");const s=t.subarray(r,r+e);if(s.length!==e)throw new n("tlv.decode: length bytes not complete");if(0===s[0])throw new n("tlv.decode(long): zero leftmost byte");for(const t of s)o=o<<8|t;if(r+=e,o<128)throw new n("tlv.decode(long): not minimal encoding")}else o=i;const s=t.subarray(r,r+o);if(s.length!==o)throw new n("tlv.decode: wrong value length");return{v:s,l:t.subarray(r+o)}}},_int:{encode(e){const{Err:t}=Fb;if(e<qb)throw new t("integer: negative integers are not allowed");let n=Bv(e);if(8&Number.parseInt(n[0],16)&&(n="00"+n),1&n.length)throw new t("unexpected DER parsing assertion: unpadded hex");return n},decode(e){const{Err:t}=Fb;if(128&e[0])throw new t("invalid signature integer: negative");if(0===e[0]&&!(128&e[1]))throw new t("invalid signature integer: unnecessary leading zero");return Hv(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=Fb,i=Gv("signature",e),{v:o,l:s}=r.decode(48,i);if(s.length)throw new t("invalid signature: left bytes after parsing");const{v:a,l:c}=r.decode(2,o),{v:l,l:u}=r.decode(2,c);if(u.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(a),s:n.decode(l)}},hexFromSig(e){const{_tlv:t,_int:n}=Fb,r=t.encode(2,n.encode(e.r))+t.encode(2,n.encode(e.s));return t.encode(48,r)}};function zb(e,t){return Mv(Kv(e,t))}const qb=BigInt(0),Hb=BigInt(1),Vb=(BigInt(2),BigInt(3)),Kb=BigInt(4);function Wb(e){const t=function(e){const t=Db(e);nb(t,{a:"field",b:"field"},{allowInfinityPoint:"boolean",allowedPrivateKeyLengths:"array",clearCofactor:"function",fromBytes:"function",isTorsionFree:"function",toBytes:"function",wrapPrivateKey:"boolean"});const{endo:n,Fp:r,a:i}=t;if(n){if(!r.eql(i,r.ZERO))throw new Error("invalid endo: CURVE.a must be 0");if("object"!==typeof n||"bigint"!==typeof n.beta||"function"!==typeof n.splitScalar)throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function')}return Object.freeze({...t})}(e),{Fp:n}=t,r=_b(t.n,t.nBitLength),i=t.toBytes||((e,t,r)=>{const i=t.toAffine();return Yv(Uint8Array.from([4]),n.toBytes(i.x),n.toBytes(i.y))}),o=t.fromBytes||(e=>{const t=e.subarray(1);return{x:n.fromBytes(t.subarray(0,n.BYTES)),y:n.fromBytes(t.subarray(n.BYTES,2*n.BYTES))}});function s(e){const{a:r,b:i}=t,o=n.sqr(e),s=n.mul(o,e);return n.add(n.add(s,n.mul(e,r)),i)}function a(e,t){const r=n.sqr(t),i=s(e);return n.eql(r,i)}if(!a(t.Gx,t.Gy))throw new Error("bad curve params: generator point");const c=n.mul(n.pow(t.a,Vb),Kb),l=n.mul(n.sqr(t.b),BigInt(27));if(n.is0(n.add(c,l)))throw new Error("bad curve params: a or b");function u(e){const{allowedPrivateKeyLengths:n,nByteLength:r,wrapPrivateKey:i,n:o}=t;if(n&&"bigint"!==typeof e){if(Cv(e)&&(e=Mv(e)),"string"!==typeof e||!n.includes(e.length))throw new Error("invalid private key");e=e.padStart(2*r,"0")}let s;try{s="bigint"===typeof e?e:Hv(Gv("private key",e,r))}catch(a){throw new Error("invalid private key, expected hex or "+r+" bytes, got "+typeof e)}return i&&(s=db(s,o)),Qv("private key",s,Hb,o),s}function d(e){if(!(e instanceof p))throw new Error("ProjectivePoint expected")}const f=rb(((e,t)=>{const{px:r,py:i,pz:o}=e;if(n.eql(o,n.ONE))return{x:r,y:i};const s=e.is0();null==t&&(t=s?n.ONE:n.inv(o));const a=n.mul(r,t),c=n.mul(i,t),l=n.mul(o,t);if(s)return{x:n.ZERO,y:n.ZERO};if(!n.eql(l,n.ONE))throw new Error("invZ was invalid");return{x:a,y:c}})),h=rb((e=>{if(e.is0()){if(t.allowInfinityPoint&&!n.is0(e.py))return;throw new Error("bad point: ZERO")}const{x:r,y:i}=e.toAffine();if(!n.isValid(r)||!n.isValid(i))throw new Error("bad point: x or y not FE");if(!a(r,i))throw new Error("bad point: equation left != right");if(!e.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0}));class p{constructor(e,t,r){if(null==e||!n.isValid(e))throw new Error("x required");if(null==t||!n.isValid(t)||n.is0(t))throw new Error("y required");if(null==r||!n.isValid(r))throw new Error("z required");this.px=e,this.py=t,this.pz=r,Object.freeze(this)}static fromAffine(e){const{x:t,y:r}=e||{};if(!e||!n.isValid(t)||!n.isValid(r))throw new Error("invalid affine point");if(e instanceof p)throw new Error("projective point not allowed");const i=e=>n.eql(e,n.ZERO);return i(t)&&i(r)?p.ZERO:new p(t,r,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(e){const t=bb(n,e.map((e=>e.pz)));return e.map(((e,n)=>e.toAffine(t[n]))).map(p.fromAffine)}static fromHex(e){const t=p.fromAffine(o(Gv("pointHex",e)));return t.assertValidity(),t}static fromPrivateKey(e){return p.BASE.multiply(u(e))}static msm(e,t){return Lb(p,r,e,t)}_setWindowSize(e){m.setWindowSize(this,e)}assertValidity(){h(this)}hasEvenY(){const{y:e}=this.toAffine();if(n.isOdd)return!n.isOdd(e);throw new Error("Field doesn't support isOdd")}equals(e){d(e);const{px:t,py:r,pz:i}=this,{px:o,py:s,pz:a}=e,c=n.eql(n.mul(t,a),n.mul(o,i)),l=n.eql(n.mul(r,a),n.mul(s,i));return c&&l}negate(){return new p(this.px,n.neg(this.py),this.pz)}double(){const{a:e,b:r}=t,i=n.mul(r,Vb),{px:o,py:s,pz:a}=this;let c=n.ZERO,l=n.ZERO,u=n.ZERO,d=n.mul(o,o),f=n.mul(s,s),h=n.mul(a,a),g=n.mul(o,s);return g=n.add(g,g),u=n.mul(o,a),u=n.add(u,u),c=n.mul(e,u),l=n.mul(i,h),l=n.add(c,l),c=n.sub(f,l),l=n.add(f,l),l=n.mul(c,l),c=n.mul(g,c),u=n.mul(i,u),h=n.mul(e,h),g=n.sub(d,h),g=n.mul(e,g),g=n.add(g,u),u=n.add(d,d),d=n.add(u,d),d=n.add(d,h),d=n.mul(d,g),l=n.add(l,d),h=n.mul(s,a),h=n.add(h,h),d=n.mul(h,g),c=n.sub(c,d),u=n.mul(h,f),u=n.add(u,u),u=n.add(u,u),new p(c,l,u)}add(e){d(e);const{px:r,py:i,pz:o}=this,{px:s,py:a,pz:c}=e;let l=n.ZERO,u=n.ZERO,f=n.ZERO;const h=t.a,g=n.mul(t.b,Vb);let y=n.mul(r,s),m=n.mul(i,a),v=n.mul(o,c),b=n.add(r,i),w=n.add(s,a);b=n.mul(b,w),w=n.add(y,m),b=n.sub(b,w),w=n.add(r,o);let E=n.add(s,c);return w=n.mul(w,E),E=n.add(y,v),w=n.sub(w,E),E=n.add(i,o),l=n.add(a,c),E=n.mul(E,l),l=n.add(m,v),E=n.sub(E,l),f=n.mul(h,w),l=n.mul(g,v),f=n.add(l,f),l=n.sub(m,f),f=n.add(m,f),u=n.mul(l,f),m=n.add(y,y),m=n.add(m,y),v=n.mul(h,v),w=n.mul(g,w),m=n.add(m,v),v=n.sub(y,v),v=n.mul(h,v),w=n.add(w,v),y=n.mul(m,w),u=n.add(u,y),y=n.mul(E,w),l=n.mul(b,l),l=n.sub(l,y),y=n.mul(b,m),f=n.mul(E,f),f=n.add(f,y),new p(l,u,f)}subtract(e){return this.add(e.negate())}is0(){return this.equals(p.ZERO)}wNAF(e){return m.wNAFCached(this,e,p.normalizeZ)}multiplyUnsafe(e){const{endo:r,n:i}=t;Qv("scalar",e,qb,i);const o=p.ZERO;if(e===qb)return o;if(this.is0()||e===Hb)return this;if(!r||m.hasPrecomputes(this))return m.wNAFCachedUnsafe(this,e,p.normalizeZ);let{k1neg:s,k1:a,k2neg:c,k2:l}=r.splitScalar(e),u=o,d=o,f=this;for(;a>qb||l>qb;)a&Hb&&(u=u.add(f)),l&Hb&&(d=d.add(f)),f=f.double(),a>>=Hb,l>>=Hb;return s&&(u=u.negate()),c&&(d=d.negate()),d=new p(n.mul(d.px,r.beta),d.py,d.pz),u.add(d)}multiply(e){const{endo:r,n:i}=t;let o,s;if(Qv("scalar",e,Hb,i),r){const{k1neg:t,k1:i,k2neg:a,k2:c}=r.splitScalar(e);let{p:l,f:u}=this.wNAF(i),{p:d,f:f}=this.wNAF(c);l=m.constTimeNegate(t,l),d=m.constTimeNegate(a,d),d=new p(n.mul(d.px,r.beta),d.py,d.pz),o=l.add(d),s=u.add(f)}else{const{p:t,f:n}=this.wNAF(e);o=t,s=n}return p.normalizeZ([o,s])[0]}multiplyAndAddUnsafe(e,t,n){const r=p.BASE,i=(e,t)=>t!==qb&&t!==Hb&&e.equals(r)?e.multiply(t):e.multiplyUnsafe(t),o=i(this,t).add(i(e,n));return o.is0()?void 0:o}toAffine(e){return f(this,e)}isTorsionFree(){const{h:e,isTorsionFree:n}=t;if(e===Hb)return!0;if(n)return n(p,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:e,clearCofactor:n}=t;return e===Hb?this:n?n(p,this):this.multiplyUnsafe(t.h)}toRawBytes(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return Uv("isCompressed",e),this.assertValidity(),i(p,this,e)}toHex(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return Uv("isCompressed",e),Mv(this.toRawBytes(e))}}p.BASE=new p(t.Gx,t.Gy,n.ONE),p.ZERO=new p(n.ZERO,n.ONE,n.ZERO);const{endo:g,nBitLength:y}=t,m=function(e,t){return{constTimeNegate:Ab,hasPrecomputes:e=>1!==Bb(e),unsafeLadder(t,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.ZERO,i=t;for(;n>Ib;)n&Ob&&(r=r.add(i)),i=i.double(),n>>=Ob;return r},precomputeWindow(e,n){const{windows:r,windowSize:i}=Rb(n,t),o=[];let s=e,a=s;for(let t=0;t<r;t++){a=s,o.push(a);for(let e=1;e<i;e++)a=a.add(s),o.push(a);s=a.double()}return o},wNAF(n,r,i){let o=e.ZERO,s=e.BASE;const a=Rb(n,t);for(let e=0;e<a.windows;e++){const{nextN:t,offset:n,isZero:c,isNeg:l,isNegF:u,offsetF:d}=kb(i,e,a);i=t,c?s=s.add(Ab(u,r[d])):o=o.add(Ab(l,r[n]))}return{p:o,f:s}},wNAFUnsafe(n,r,i){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.ZERO;const s=Rb(n,t);for(let e=0;e<s.windows&&i!==Ib;e++){const{nextN:t,offset:n,isZero:a,isNeg:c}=kb(i,e,s);if(i=t,!a){const e=r[n];o=o.add(c?e.negate():e)}}return o},getPrecomputes(e,t,n){let r=Nb.get(t);return r||(r=this.precomputeWindow(t,e),1!==e&&Nb.set(t,n(r))),r},wNAFCached(e,t,n){const r=Bb(e);return this.wNAF(r,this.getPrecomputes(r,e,n),t)},wNAFCachedUnsafe(e,t,n,r){const i=Bb(e);return 1===i?this.unsafeLadder(e,t,r):this.wNAFUnsafe(i,this.getPrecomputes(i,e,n),t,r)},setWindowSize(e,n){Tb(n,t),Ub.set(e,n),Nb.delete(e)}}}(p,g?Math.ceil(y/2):y);return{CURVE:t,ProjectivePoint:p,normPrivateKeyToScalar:u,weierstrassEquation:s,isWithinCurveOrder:function(e){return Xv(e,Hb,t.n)}}}function Gb(e){const t=function(e){const t=Db(e);return nb(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}(e),{Fp:n,n:r,nByteLength:i,nBitLength:o}=t,s=n.BYTES+1,a=2*n.BYTES+1;function c(e){return db(e,r)}function l(e){return hb(e,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:d,weierstrassEquation:f,isWithinCurveOrder:h}=Wb({...t,toBytes(e,t,r){const i=t.toAffine(),o=n.toBytes(i.x),s=Yv;return Uv("isCompressed",r),r?s(Uint8Array.from([t.hasEvenY()?2:3]),o):s(Uint8Array.from([4]),o,n.toBytes(i.y))},fromBytes(e){const t=e.length,r=e[0],i=e.subarray(1);if(t!==s||2!==r&&3!==r){if(t===a&&4===r){return{x:n.fromBytes(i.subarray(0,n.BYTES)),y:n.fromBytes(i.subarray(n.BYTES,2*n.BYTES))}}throw new Error("invalid Point, expected length of "+s+", or uncompressed "+a+", got "+t)}{const e=Hv(i);if(!Xv(e,Hb,n.ORDER))throw new Error("Point is not on curve");const t=f(e);let s;try{s=n.sqrt(t)}catch(o){const e=o instanceof Error?": "+o.message:"";throw new Error("Point is not on curve"+e)}return 1===(1&r)!==((s&Hb)===Hb)&&(s=n.neg(s)),{x:e,y:s}}}});function p(e){return e>r>>Hb}const g=(e,t,n)=>Hv(e.slice(t,n));class y{constructor(e,t,n){Qv("r",e,Hb,r),Qv("s",t,Hb,r),this.r=e,this.s=t,null!=n&&(this.recovery=n),Object.freeze(this)}static fromCompact(e){const t=i;return e=Gv("compactSignature",e,2*t),new y(g(e,0,t),g(e,t,2*t))}static fromDER(e){const{r:t,s:n}=Fb.toSig(Gv("DER",e));return new y(t,n)}assertValidity(){}addRecoveryBit(e){return new y(this.r,this.s,e)}recoverPublicKey(e){const{r:r,s:i,recovery:o}=this,s=w(Gv("msgHash",e));if(null==o||![0,1,2,3].includes(o))throw new Error("recovery id invalid");const a=2===o||3===o?r+t.n:r;if(a>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const d=0===(1&o)?"02":"03",f=u.fromHex(d+zb(a,n.BYTES)),h=l(a),p=c(-s*h),g=c(i*h),y=u.BASE.multiplyAndAddUnsafe(f,p,g);if(!y)throw new Error("point at infinify");return y.assertValidity(),y}hasHighS(){return p(this.s)}normalizeS(){return this.hasHighS()?new y(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return qv(this.toDERHex())}toDERHex(){return Fb.hexFromSig(this)}toCompactRawBytes(){return qv(this.toCompactHex())}toCompactHex(){const e=i;return zb(this.r,e)+zb(this.s,e)}}const m={isValidPrivateKey(e){try{return d(e),!0}catch(t){return!1}},normPrivateKeyToScalar:d,randomPrivateKey:()=>{const e=xb(t.n);return function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=e.length,i=Sb(t),o=xb(t);if(r<16||r<o||r>1024)throw new Error("expected "+o+"-1024 bytes of input, got "+r);const s=db(n?Vv(e):Hv(e),t-ob)+ob;return n?Wv(s,i):Kv(s,i)}(t.randomBytes(e),t.n)},precompute(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:8,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:u.BASE;return t._setWindowSize(e),t.multiply(BigInt(3)),t}};function v(e){if("bigint"===typeof e)return!1;if(e instanceof u)return!0;const r=Gv("key",e).length,o=n.BYTES,s=o+1,a=2*o+1;return t.allowedPrivateKeyLengths||i===s?void 0:r===s||r===a}const b=t.bits2int||function(e){if(e.length>8192)throw new Error("input is too large");const t=Hv(e),n=8*e.length-o;return n>0?t>>BigInt(n):t},w=t.bits2int_modN||function(e){return c(b(e))},E=Jv(o);function _(e){return Qv("num < 2^"+o,e,qb,E),Kv(e,i)}function S(e,r){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:x;if(["recovered","canonical"].some((e=>e in i)))throw new Error("sign() legacy options not supported");const{hash:o,randomBytes:s}=t;let{lowS:a,prehash:f,extraEntropy:g}=i;null==a&&(a=!0),e=Gv("msgHash",e),jb(i),f&&(e=Gv("prehashed msgHash",o(e)));const m=w(e),v=d(r),E=[_(v),_(m)];if(null!=g&&!1!==g){const e=!0===g?s(n.BYTES):g;E.push(Gv("extraEntropy",e))}const S=Yv(...E),I=m;return{seed:S,k2sig:function(e){const t=b(e);if(!h(t))return;const n=l(t),r=u.BASE.multiply(t).toAffine(),i=c(r.x);if(i===qb)return;const o=c(n*c(I+i*v));if(o===qb)return;let s=(r.x===i?0:2)|Number(r.y&Hb),d=o;return a&&p(o)&&(d=function(e){return p(e)?c(-e):e}(o),s^=1),new y(i,d,s)}}}const x={lowS:t.lowS,prehash:!1},I={lowS:t.lowS,prehash:!1};return u.BASE._setWindowSize(8),{CURVE:t,getPublicKey:function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return u.fromPrivateKey(e).toRawBytes(t)},getSharedSecret:function(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!0===v(e))throw new Error("first arg must be private key");if(!1===v(t))throw new Error("second arg must be public key");return u.fromHex(t).multiply(d(e)).toRawBytes(n)},sign:function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:x;const{seed:i,k2sig:o}=S(e,n,r),s=t,a=function(e,t,n){if("number"!==typeof e||e<2)throw new Error("hashLen must be a number");if("number"!==typeof t||t<2)throw new Error("qByteLen must be a number");if("function"!==typeof n)throw new Error("hmacFn must be a function");let r=$v(e),i=$v(e),o=0;const s=()=>{r.fill(1),i.fill(0),o=0},a=function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return n(i,r,...t)},c=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:$v(0);i=a(eb([0]),e),r=a(),0!==e.length&&(i=a(eb([1]),e),r=a())},l=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let e=0;const n=[];for(;e<t;){r=a();const t=r.slice();n.push(t),e+=r.length}return Yv(...n)};return(e,t)=>{let n;for(s(),c(e);!(n=t(l()));)c();return s(),n}}(s.hash.outputLen,s.nByteLength,s.hmac);return a(i,o)},verify:function(e,n,r){var i;let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:I;const s=e;n=Gv("msgHash",n),r=Gv("publicKey",r);const{lowS:a,prehash:d,format:f}=o;if(jb(o),"strict"in o)throw new Error("options.strict was renamed to lowS");if(void 0!==f&&"compact"!==f&&"der"!==f)throw new Error("format must be compact or der");const h="string"===typeof s||Cv(s),p=!h&&!f&&"object"===typeof s&&null!==s&&"bigint"===typeof s.r&&"bigint"===typeof s.s;if(!h&&!p)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let g,m;try{if(p&&(g=new y(s.r,s.s)),h){try{"compact"!==f&&(g=y.fromDER(s))}catch(A){if(!(A instanceof Fb.Err))throw A}g||"der"===f||(g=y.fromCompact(s))}m=u.fromHex(r)}catch(T){return!1}if(!g)return!1;if(a&&g.hasHighS())return!1;d&&(n=t.hash(n));const{r:v,s:b}=g,E=w(n),_=l(b),S=c(E*_),x=c(v*_),O=null===(i=u.BASE.multiplyAndAddUnsafe(m,S,x))||void 0===i?void 0:i.toAffine();return!!O&&c(O.x)===v},ProjectivePoint:u,Signature:y,utils:m}}function Yb(e){return{hash:e,hmac:function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return Rv(e,t,function(){let e=0;for(let n=0;n<arguments.length;n++){const t=n<0||arguments.length<=n?void 0:arguments[n];Jm(t),e+=t.length}const t=new Uint8Array(e);for(let n=0,r=0;n<arguments.length;n++){const e=n<0||arguments.length<=n?void 0:arguments[n];t.set(e,r),r+=e.length}return t}(...r))},randomBytes:dv}}const Zb=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Xb=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Qb=BigInt(0),Jb=BigInt(1),$b=BigInt(2),ew=(e,t)=>(e+t/$b)/t;function tw(e){const t=Zb,n=BigInt(3),r=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),a=BigInt(44),c=BigInt(88),l=e*e*e%t,u=l*l*e%t,d=fb(u,n,t)*u%t,f=fb(d,n,t)*u%t,h=fb(f,$b,t)*l%t,p=fb(h,i,t)*h%t,g=fb(p,o,t)*p%t,y=fb(g,a,t)*g%t,m=fb(y,c,t)*y%t,v=fb(m,a,t)*g%t,b=fb(v,n,t)*u%t,w=fb(b,s,t)*p%t,E=fb(w,r,t)*l%t,_=fb(E,$b,t);if(!nw.eql(nw.sqr(_),e))throw new Error("Cannot find square root");return _}const nw=_b(Zb,void 0,void 0,{sqrt:tw}),rw=function(e,t){const n=t=>Gb({...e,...Yb(t)});return{...n(t),create:n}}({a:Qb,b:BigInt(7),Fp:nw,n:Xb,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=Xb,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Jb*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=n,s=BigInt("0x100000000000000000000000000000000"),a=ew(o*e,t),c=ew(-r*e,t);let l=db(e-a*n-c*i,t),u=db(-a*r-c*o,t);const d=l>s,f=u>s;if(d&&(l=t-l),f&&(u=t-u),l>s||u>s)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:d,k1:l,k2neg:f,k2:u}}}},Av);const iw={zero:48,nine:57,A:65,F:70,a:97,f:102};function ow(e){return e>=iw.zero&&e<=iw.nine?e-iw.zero:e>=iw.A&&e<=iw.F?e-(iw.A-10):e>=iw.a&&e<=iw.f?e-(iw.a-10):void 0}const sw=new TextEncoder;function aw(e){return e instanceof Uint8Array?e:"string"===typeof e?cw(e):function(e){return e instanceof Uint8Array?e:new Uint8Array(e)}(e)}function cw(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{size:n}=t;let r=e;n&&(Om(e,n),r=Bm(e,n));let i=r.slice(2);i.length%2&&(i="0".concat(i));const o=i.length/2,s=new Uint8Array(o);for(let a=0,c=0;a<o;a++){const e=ow(i.charCodeAt(c++)),t=ow(i.charCodeAt(c++));if(void 0===e||void 0===t)throw new xm('Invalid byte sequence ("'.concat(i[c-2]).concat(i[c-1],'" in "').concat(i,'").'));s[a]=16*e+t}return s}function lw(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{size:n}=t,r=sw.encode(e);return"number"===typeof n?(function(e,t){if(uw(e)>t)throw new hw({givenSize:uw(e),maxSize:t})}(r,n),function(e,t){return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{dir:n,size:r=32}=t;if(0===r)return e;if(e.length>r)throw new pw({size:e.length,targetSize:r,type:"Bytes"});const i=new Uint8Array(r);for(let o=0;o<r;o++){const t="right"===n;i[t?o:r-o-1]=e[t?o:e.length-o-1]}return i}(e,{dir:"right",size:t})}(r,n)):r}function uw(e){return e.length}function dw(e){try{return function(e){if(!(e instanceof Uint8Array)){if(!e)throw new fw(e);if("object"!==typeof e)throw new fw(e);if(!("BYTES_PER_ELEMENT"in e))throw new fw(e);if(1!==e.BYTES_PER_ELEMENT||"Uint8Array"!==e.constructor.name)throw new fw(e)}}(e),!0}catch{return!1}}class fw extends xm{constructor(e){super("Value `".concat("object"===typeof e?Rm(e):e,"` of type `").concat(typeof e,"` is an invalid Bytes value."),{metaMessages:["Bytes values must be of type `Bytes`."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesTypeError"})}}class hw extends xm{constructor(e){let{givenSize:t,maxSize:n}=e;super("Size cannot exceed `".concat(n,"` bytes. Given size: `").concat(t,"` bytes.")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeOverflowError"})}}class pw extends xm{constructor(e){let{size:t,targetSize:n,type:r}=e;super("".concat(r.charAt(0).toUpperCase()).concat(r.slice(1).toLowerCase()," size (`").concat(t,"`) exceeds padding size (`").concat(n,"`).")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeExceedsPaddingSizeError"})}}class gw extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const t=super.get(e);return super.has(e)&&void 0!==t&&(this.delete(e),super.set(e,t)),t}set(e,t){if(super.set(e,t),this.maxSize&&this.size>this.maxSize){const e=this.keys().next().value;e&&this.delete(e)}return this}}const yw={checksum:new gw(8192)},mw=yw.checksum;const vw=BigInt(0),bw=BigInt(1),ww=BigInt(2),Ew=BigInt(7),_w=BigInt(256),Sw=BigInt(113),xw=[],Iw=[],Ow=[];for(let n=0,Fz=bw,zz=1,qz=0;n<24;n++){[zz,qz]=[qz,(2*zz+3*qz)%5],xw.push(2*(5*qz+zz)),Iw.push((n+1)*(n+2)/2%64);let e=vw;for(let t=0;t<7;t++)Fz=(Fz<<bw^(Fz>>Ew)*Sw)%_w,Fz&ww&&(e^=bw<<(bw<<BigInt(t))-bw);Ow.push(e)}const Aw=bv(Ow,!0),Tw=Aw[0],Rw=Aw[1],kw=(e,t,n)=>n>32?_v(e,t,n):wv(e,t,n),Pw=(e,t,n)=>n>32?Sv(e,t,n):Ev(e,t,n);class Cw extends lv{constructor(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:24;if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=t,this.outputLen=n,this.enableXOF=r,this.rounds=i,Qm(n),!(0<e&&e<200))throw new Error("only keccak-f1600 function is supported");var o;this.state=new Uint8Array(200),this.state32=(o=this.state,new Uint32Array(o.buffer,o.byteOffset,Math.floor(o.byteLength/4)))}clone(){return this._cloneInto()}keccak(){sv(this.state32),function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:24;const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let r=0;r<10;r++)n[r]=e[r]^e[r+10]^e[r+20]^e[r+30]^e[r+40];for(let r=0;r<10;r+=2){const t=(r+8)%10,i=(r+2)%10,o=n[i],s=n[i+1],a=kw(o,s,1)^n[t],c=Pw(o,s,1)^n[t+1];for(let n=0;n<50;n+=10)e[r+n]^=a,e[r+n+1]^=c}let t=e[2],i=e[3];for(let n=0;n<24;n++){const r=Iw[n],o=kw(t,i,r),s=Pw(t,i,r),a=xw[n];t=e[a],i=e[a+1],e[a]=o,e[a+1]=s}for(let r=0;r<50;r+=10){for(let t=0;t<10;t++)n[t]=e[r+t];for(let t=0;t<10;t++)e[r+t]^=~n[(t+2)%10]&n[(t+4)%10]}e[0]^=Tw[r],e[1]^=Rw[r]}tv(n)}(this.state32,this.rounds),sv(this.state32),this.posOut=0,this.pos=0}update(e){$m(this),Jm(e=cv(e));const{blockLen:t,state:n}=this,r=e.length;for(let i=0;i<r;){const o=Math.min(t-this.pos,r-i);for(let t=0;t<o;t++)n[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:t,pos:n,blockLen:r}=this;e[n]^=t,0!==(128&t)&&n===r-1&&this.keccak(),e[r-1]^=128,this.keccak()}writeInto(e){$m(this,!1),Jm(e),this.finish();const t=this.state,{blockLen:n}=this;for(let r=0,i=e.length;r<i;){this.posOut>=n&&this.keccak();const o=Math.min(n-this.posOut,i-r);e.set(t.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return Qm(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(ev(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,tv(this.state)}_cloneInto(e){const{blockLen:t,suffix:n,outputLen:r,rounds:i,enableXOF:o}=this;return e||(e=new Cw(t,n,r,o,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=n,e.outputLen=r,e.enableXOF=o,e.destroyed=this.destroyed,e}}const Nw=(e,t,n)=>uv((()=>new Cw(t,e,n))),Uw=(()=>Nw(1,136,32))();function Bw(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{as:n=("string"===typeof e?"Hex":"Bytes")}=t,r=Uw(aw(e));return"Bytes"===n?r:Cm(r)}function Lw(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{compressed:n}=t,{prefix:r,x:i,y:o}=e;if(!1===n||"bigint"===typeof i&&"bigint"===typeof o){if(4!==r)throw new zw({prefix:r,cause:new Hw})}else{if(!0!==n&&("bigint"!==typeof i||"undefined"!==typeof o))throw new Fw({publicKey:e});if(3!==r&&2!==r)throw new zw({prefix:r,cause:new qw})}}function Dw(e){const t=(()=>{if(jm(e))return jw(e);if(dw(e))return function(e){return jw(Cm(e))}(e);const{prefix:t,x:n,y:r}=e;return"bigint"===typeof n&&"bigint"===typeof r?{prefix:null!==t&&void 0!==t?t:4,x:n,y:r}:{prefix:t,x:n}})();return Lw(t),t}function jw(e){if(132!==e.length&&130!==e.length&&68!==e.length)throw new Vw({publicKey:e});if(130===e.length){return{prefix:4,x:BigInt(Lm(e,0,32)),y:BigInt(Lm(e,32,64))}}if(132===e.length){return{prefix:Number(Lm(e,0,1)),x:BigInt(Lm(e,1,33)),y:BigInt(Lm(e,33,65))}}return{prefix:Number(Lm(e,0,1)),x:BigInt(Lm(e,1,33))}}function Mw(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Lw(e);const{prefix:n,x:r,y:i}=e,{includePrefix:o=!0}=t,s=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return"0x".concat(t.reduce(((e,t)=>e+t.replace("0x","")),""))}(o?Nm(n,{size:1}):"0x",Nm(r,{size:32}),"bigint"===typeof i?Nm(i,{size:32}):"0x");return s}class Fw extends xm{constructor(e){let{publicKey:t}=e;super("Value `".concat(Rm(t),"` is not a valid public key."),{metaMessages:["Public key must contain:","- an `x` and `prefix` value (compressed)","- an `x`, `y`, and `prefix` value (uncompressed)"]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidError"})}}class zw extends xm{constructor(e){let{prefix:t,cause:n}=e;super('Prefix "'.concat(t,'" is invalid.'),{cause:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidPrefixError"})}}class qw extends xm{constructor(){super("Prefix must be 2 or 3 for compressed public keys."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidCompressedPrefixError"})}}class Hw extends xm{constructor(){super("Prefix must be 4 for uncompressed public keys."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidUncompressedPrefixError"})}}class Vw extends xm{constructor(e){let{publicKey:t}=e;super("Value `".concat(t,"` is an invalid public key size."),{metaMessages:["Expected: 33 bytes (compressed + prefix), 64 bytes (uncompressed) or 65 bytes (uncompressed + prefix).","Received ".concat(Dm(Pm(t))," bytes.")]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidSerializedSizeError"})}}const Kw=/^0x[a-fA-F0-9]{40}$/;function Ww(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{strict:n=!0}=t;if(!Kw.test(e))throw new Zw({address:e,cause:new Xw});if(n){if(e.toLowerCase()===e)return;if(Gw(e)!==e)throw new Zw({address:e,cause:new Qw})}}function Gw(e){if(mw.has(e))return mw.get(e);Ww(e,{strict:!1});const t=e.substring(2).toLowerCase(),n=Bw(lw(t),{as:"Bytes"}),r=t.split("");for(let o=0;o<40;o+=2)n[o>>1]>>4>=8&&r[o]&&(r[o]=r[o].toUpperCase()),(15&n[o>>1])>=8&&r[o+1]&&(r[o+1]=r[o+1].toUpperCase());const i="0x".concat(r.join(""));return mw.set(e,i),i}function Yw(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=Bw("0x".concat(Mw(e).slice(4))).substring(26);return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{checksum:n=!1}=t;return Ww(e),n?Gw(e):e}("0x".concat(n),t)}class Zw extends xm{constructor(e){let{address:t,cause:n}=e;super('Address "'.concat(t,'" is invalid.'),{cause:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidAddressError"})}}class Xw extends xm{constructor(){super("Address is not a 20 byte (40 hexadecimal character) value."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidInputError"})}}class Qw extends xm{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}function Jw(e){return Yw(function(e){const{payload:t,signature:n}=e,{r:r,s:i,yParity:o}=n,s=new rw.Signature(BigInt(r),BigInt(i)).addRecoveryBit(o);return Dw(s.recoverPublicKey(Pm(t).substring(2)))}(e))}const $w=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");const t=new Uint8Array(256);for(let a=0;a<t.length;a++)t[a]=255;for(let a=0;a<e.length;a++){const n=e.charAt(a),r=n.charCodeAt(0);if(255!==t[r])throw new TypeError(n+" is ambiguous");t[r]=a}const n=e.length,r=e.charAt(0),i=Math.log(n)/Math.log(256),o=Math.log(256)/Math.log(n);function s(e){if("string"!==typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;let o=0,s=0,a=0;for(;e[o]===r;)s++,o++;const c=(e.length-o)*i+1>>>0,l=new Uint8Array(c);for(;o<e.length;){const r=e.charCodeAt(o);if(r>255)return;let i=t[r];if(255===i)return;let s=0;for(let e=c-1;(0!==i||s<a)&&-1!==e;e--,s++)i+=n*l[e]>>>0,l[e]=i%256>>>0,i=i/256>>>0;if(0!==i)throw new Error("Non-zero carry");a=s,o++}let u=c-a;for(;u!==c&&0===l[u];)u++;const d=new Uint8Array(s+(c-u));let f=s;for(;u!==c;)d[f++]=l[u++];return d}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"";let i=0,s=0,a=0;const c=t.length;for(;a!==c&&0===t[a];)a++,i++;const l=(c-a)*o+1>>>0,u=new Uint8Array(l);for(;a!==c;){let e=t[a],r=0;for(let t=l-1;(0!==e||r<s)&&-1!==t;t--,r++)e+=256*u[t]>>>0,u[t]=e%n>>>0,e=e/n>>>0;if(0!==e)throw new Error("Non-zero carry");s=r,a++}let d=l-s;for(;d!==l&&0===u[d];)d++;let f=r.repeat(i);for(;d<l;++d)f+=e.charAt(u[d]);return f},decodeUnsafe:s,decode:function(e){const t=s(e);if(t)return t;throw new Error("Non-base"+n+" character")}}};const eE=$w("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");function tE(e){return"".concat(e<0?"-":"","0x").concat(Math.abs(e).toString(16).padStart(2,"0"))}class nE{constructor(e,t){cr(this,"type",void 0),cr(this,"data",void 0),this.type=e,this.data=t}}class rE extends Error{constructor(e){super(e);const t=Object.create(rE.prototype);Object.setPrototypeOf(this,t),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:rE.name})}}const iE=4294967295;function oE(e,t,n){const r=Math.floor(n/4294967296),i=n;e.setUint32(t,r),e.setUint32(t+4,i)}function sE(e,t){return 4294967296*e.getInt32(t)+e.getUint32(t+4)}const aE=4294967295,cE=17179869183;const lE={type:-1,encode:function(e){if(e instanceof Date){return function(e){let{sec:t,nsec:n}=e;if(t>=0&&n>=0&&t<=cE){if(0===n&&t<=aE){const e=new Uint8Array(4);return new DataView(e.buffer).setUint32(0,t),e}{const e=t/4294967296,r=4294967295&t,i=new Uint8Array(8),o=new DataView(i.buffer);return o.setUint32(0,n<<2|3&e),o.setUint32(4,r),i}}{const e=new Uint8Array(12),r=new DataView(e.buffer);return r.setUint32(0,n),oE(r,4,t),e}}(function(e){const t=e.getTime(),n=Math.floor(t/1e3),r=1e6*(t-1e3*n),i=Math.floor(r/1e9);return{sec:n+i,nsec:r-1e9*i}}(e))}return null},decode:function(e){const t=function(e){const t=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e.byteLength){case 4:return{sec:t.getUint32(0),nsec:0};case 8:{const e=t.getUint32(0);return{sec:4294967296*(3&e)+t.getUint32(4),nsec:e>>>2}}case 12:return{sec:sE(t,4),nsec:t.getUint32(0)};default:throw new rE("Unrecognized data size for timestamp (expected 4, 8, or 12): ".concat(e.length))}}(e);return new Date(1e3*t.sec+t.nsec/1e6)}};class uE{constructor(){cr(this,"__brand",void 0),cr(this,"builtInEncoders",[]),cr(this,"builtInDecoders",[]),cr(this,"encoders",[]),cr(this,"decoders",[]),this.register(lE)}register(e){let{type:t,encode:n,decode:r}=e;if(t>=0)this.encoders[t]=n,this.decoders[t]=r;else{const e=-1-t;this.builtInEncoders[e]=n,this.builtInDecoders[e]=r}}tryToEncode(e,t){for(let n=0;n<this.builtInEncoders.length;n++){const r=this.builtInEncoders[n];if(null!=r){const i=r(e,t);if(null!=i){return new nE(-1-n,i)}}}for(let n=0;n<this.encoders.length;n++){const r=this.encoders[n];if(null!=r){const i=r(e,t);if(null!=i){return new nE(n,i)}}}return e instanceof nE?e:null}decode(e,t,n){const r=t<0?this.builtInDecoders[-1-t]:this.decoders[t];return r?r(e,t,n):new nE(t,e)}}cr(uE,"defaultCodec",new uE);const dE=new TextEncoder;function fE(e,t,n){e.length>50?function(e,t,n){dE.encodeInto(e,t.subarray(n))}(e,t,n):function(e,t,n){const r=e.length;let i=n,o=0;for(;o<r;){let n=e.charCodeAt(o++);if(0!==(4294967168&n)){if(0===(4294965248&n))t[i++]=n>>6&31|192;else{if(n>=55296&&n<=56319&&o<r){const t=e.charCodeAt(o);56320===(64512&t)&&(++o,n=((1023&n)<<10)+(1023&t)+65536)}0===(4294901760&n)?(t[i++]=n>>12&15|224,t[i++]=n>>6&63|128):(t[i++]=n>>18&7|240,t[i++]=n>>12&63|128,t[i++]=n>>6&63|128)}t[i++]=63&n|128}else t[i++]=n}}(e,t,n)}const hE=4096;function pE(e,t,n){let r=t;const i=r+n,o=[];let s="";for(;r<i;){const t=e[r++];if(0===(128&t))o.push(t);else if(192===(224&t)){const n=63&e[r++];o.push((31&t)<<6|n)}else if(224===(240&t)){const n=63&e[r++],i=63&e[r++];o.push((31&t)<<12|n<<6|i)}else if(240===(248&t)){let n=(7&t)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++];n>65535&&(n-=65536,o.push(n>>>10&1023|55296),n=56320|1023&n),o.push(n)}else o.push(t);o.length>=hE&&(s+=String.fromCharCode(...o),o.length=0)}return o.length>0&&(s+=String.fromCharCode(...o)),s}const gE=new TextDecoder;function yE(e,t,n){return n>200?function(e,t,n){const r=e.subarray(t,t+n);return gE.decode(r)}(e,t,n):pE(e,t,n)}function mE(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):function(e){return e instanceof ArrayBuffer||"undefined"!==typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer}(e)?new Uint8Array(e):Uint8Array.from(e)}const vE="array",bE="map_key",wE="map_value",EE=e=>{if("string"===typeof e||"number"===typeof e)return e;throw new rE("The type of key must be string or number but "+typeof e)};class _E{constructor(){cr(this,"stack",[]),cr(this,"stackHeadPosition",-1)}get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(e){const t=this.getUninitializedStateFromPool();t.type=vE,t.position=0,t.size=e,t.array=new Array(e)}pushMapState(e){const t=this.getUninitializedStateFromPool();t.type=bE,t.readCount=0,t.size=e,t.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){const e={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(e)}return this.stack[this.stackHeadPosition]}release(e){if(this.stack[this.stackHeadPosition]!==e)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(e.type===vE){const t=e;t.size=0,t.array=void 0,t.position=0,t.type=void 0}if(e.type===bE||e.type===wE){const t=e;t.size=0,t.map=void 0,t.readCount=0,t.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}}const SE=new DataView(new ArrayBuffer(0)),xE=new Uint8Array(SE.buffer);try{SE.getInt8(0)}catch(Mz){if(!(Mz instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}const IE=new RangeError("Insufficient data"),OE=new class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:16,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16;cr(this,"hit",0),cr(this,"miss",0),cr(this,"caches",void 0),cr(this,"maxKeyLength",void 0),cr(this,"maxLengthPerKey",void 0),this.maxKeyLength=e,this.maxLengthPerKey=t,this.caches=[];for(let n=0;n<this.maxKeyLength;n++)this.caches.push([])}canBeCached(e){return e>0&&e<=this.maxKeyLength}find(e,t,n){const r=this.caches[n-1];e:for(const i of r){const r=i.bytes;for(let i=0;i<n;i++)if(r[i]!==e[t+i])continue e;return i.str}return null}store(e,t){const n=this.caches[e.length-1],r={bytes:e,str:t};n.length>=this.maxLengthPerKey?n[Math.random()*n.length|0]=r:n.push(r)}decode(e,t,n){const r=this.find(e,t,n);if(null!=r)return this.hit++,r;this.miss++;const i=pE(e,t,n),o=Uint8Array.prototype.slice.call(e,t,t+n);return this.store(o,i),i}};class AE{constructor(e){var t,n,r,i,o,s,a,c,l;cr(this,"extensionCodec",void 0),cr(this,"context",void 0),cr(this,"useBigInt64",void 0),cr(this,"rawStrings",void 0),cr(this,"maxStrLength",void 0),cr(this,"maxBinLength",void 0),cr(this,"maxArrayLength",void 0),cr(this,"maxMapLength",void 0),cr(this,"maxExtLength",void 0),cr(this,"keyDecoder",void 0),cr(this,"mapKeyConverter",void 0),cr(this,"totalPos",0),cr(this,"pos",0),cr(this,"view",SE),cr(this,"bytes",xE),cr(this,"headByte",-1),cr(this,"stack",new _E),cr(this,"entered",!1),this.extensionCodec=null!==(t=null===e||void 0===e?void 0:e.extensionCodec)&&void 0!==t?t:uE.defaultCodec,this.context=null===e||void 0===e?void 0:e.context,this.useBigInt64=null!==(n=null===e||void 0===e?void 0:e.useBigInt64)&&void 0!==n&&n,this.rawStrings=null!==(r=null===e||void 0===e?void 0:e.rawStrings)&&void 0!==r&&r,this.maxStrLength=null!==(i=null===e||void 0===e?void 0:e.maxStrLength)&&void 0!==i?i:iE,this.maxBinLength=null!==(o=null===e||void 0===e?void 0:e.maxBinLength)&&void 0!==o?o:iE,this.maxArrayLength=null!==(s=null===e||void 0===e?void 0:e.maxArrayLength)&&void 0!==s?s:iE,this.maxMapLength=null!==(a=null===e||void 0===e?void 0:e.maxMapLength)&&void 0!==a?a:iE,this.maxExtLength=null!==(c=null===e||void 0===e?void 0:e.maxExtLength)&&void 0!==c?c:iE,this.keyDecoder=void 0!==(null===e||void 0===e?void 0:e.keyDecoder)?e.keyDecoder:OE,this.mapKeyConverter=null!==(l=null===e||void 0===e?void 0:e.mapKeyConverter)&&void 0!==l?l:EE}clone(){return new AE({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=-1,this.stack.reset()}setBuffer(e){const t=mE(e);this.bytes=t,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength),this.pos=0}appendBuffer(e){if(-1!==this.headByte||this.hasRemaining(1)){const t=this.bytes.subarray(this.pos),n=mE(e),r=new Uint8Array(t.length+n.length);r.set(t),r.set(n,t.length),this.setBuffer(r)}else this.setBuffer(e)}hasRemaining(e){return this.view.byteLength-this.pos>=e}createExtraByteError(e){const{view:t,pos:n}=this;return new RangeError("Extra ".concat(t.byteLength-n," of ").concat(t.byteLength," byte(s) found at buffer[").concat(e,"]"))}decode(e){if(this.entered){return this.clone().decode(e)}try{this.entered=!0,this.reinitializeState(),this.setBuffer(e);const t=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return t}finally{this.entered=!1}}*decodeMulti(e){if(this.entered){const t=this.clone();yield*t.decodeMulti(e)}else try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(e);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(e){if(this.entered){return this.clone().decodeAsync(e)}try{this.entered=!0;let t,n=!1;for await(const s of e){if(n)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(s);try{t=this.doDecodeSync(),n=!0}catch(Mz){if(!(Mz instanceof RangeError))throw Mz}this.totalPos+=this.pos}if(n){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return t}const{headByte:r,pos:i,totalPos:o}=this;throw new RangeError("Insufficient data in parsing ".concat(tE(r)," at ").concat(o," (").concat(i," in the current buffer)"))}finally{this.entered=!1}}decodeArrayStream(e){return this.decodeMultiAsync(e,!0)}decodeStream(e){return this.decodeMultiAsync(e,!1)}async*decodeMultiAsync(e,t){if(this.entered){const n=this.clone();yield*n.decodeMultiAsync(e,t)}else try{this.entered=!0;let n=t,r=-1;for await(const i of e){if(t&&0===r)throw this.createExtraByteError(this.totalPos);this.appendBuffer(i),n&&(r=this.readArraySize(),n=!1,this.complete());try{for(;yield this.doDecodeSync(),0!==--r;);}catch(Mz){if(!(Mz instanceof RangeError))throw Mz}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){e:for(;;){const e=this.readHeadByte();let t;if(e>=224)t=e-256;else if(e<192)if(e<128)t=e;else if(e<144){const n=e-128;if(0!==n){this.pushMapState(n),this.complete();continue e}t={}}else if(e<160){const n=e-144;if(0!==n){this.pushArrayState(n),this.complete();continue e}t=[]}else{const n=e-160;t=this.decodeString(n,0)}else if(192===e)t=null;else if(194===e)t=!1;else if(195===e)t=!0;else if(202===e)t=this.readF32();else if(203===e)t=this.readF64();else if(204===e)t=this.readU8();else if(205===e)t=this.readU16();else if(206===e)t=this.readU32();else if(207===e)t=this.useBigInt64?this.readU64AsBigInt():this.readU64();else if(208===e)t=this.readI8();else if(209===e)t=this.readI16();else if(210===e)t=this.readI32();else if(211===e)t=this.useBigInt64?this.readI64AsBigInt():this.readI64();else if(217===e){const e=this.lookU8();t=this.decodeString(e,1)}else if(218===e){const e=this.lookU16();t=this.decodeString(e,2)}else if(219===e){const e=this.lookU32();t=this.decodeString(e,4)}else if(220===e){const e=this.readU16();if(0!==e){this.pushArrayState(e),this.complete();continue e}t=[]}else if(221===e){const e=this.readU32();if(0!==e){this.pushArrayState(e),this.complete();continue e}t=[]}else if(222===e){const e=this.readU16();if(0!==e){this.pushMapState(e),this.complete();continue e}t={}}else if(223===e){const e=this.readU32();if(0!==e){this.pushMapState(e),this.complete();continue e}t={}}else if(196===e){const e=this.lookU8();t=this.decodeBinary(e,1)}else if(197===e){const e=this.lookU16();t=this.decodeBinary(e,2)}else if(198===e){const e=this.lookU32();t=this.decodeBinary(e,4)}else if(212===e)t=this.decodeExtension(1,0);else if(213===e)t=this.decodeExtension(2,0);else if(214===e)t=this.decodeExtension(4,0);else if(215===e)t=this.decodeExtension(8,0);else if(216===e)t=this.decodeExtension(16,0);else if(199===e){const e=this.lookU8();t=this.decodeExtension(e,1)}else if(200===e){const e=this.lookU16();t=this.decodeExtension(e,2)}else{if(201!==e)throw new rE("Unrecognized type byte: ".concat(tE(e)));{const e=this.lookU32();t=this.decodeExtension(e,4)}}this.complete();const n=this.stack;for(;n.length>0;){const e=n.top();if(e.type===vE){if(e.array[e.position]=t,e.position++,e.position!==e.size)continue e;t=e.array,n.release(e)}else{if(e.type===bE){if("__proto__"===t)throw new rE("The key __proto__ is not allowed");e.key=this.mapKeyConverter(t),e.type=wE;continue e}if(e.map[e.key]=t,e.readCount++,e.readCount!==e.size){e.key=null,e.type=bE;continue e}t=e.map,n.release(e)}}return t}}readHeadByte(){return-1===this.headByte&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=-1}readArraySize(){const e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:if(e<160)return e-144;throw new rE("Unrecognized array type byte: ".concat(tE(e)))}}pushMapState(e){if(e>this.maxMapLength)throw new rE("Max length exceeded: map length (".concat(e,") > maxMapLengthLength (").concat(this.maxMapLength,")"));this.stack.pushMapState(e)}pushArrayState(e){if(e>this.maxArrayLength)throw new rE("Max length exceeded: array length (".concat(e,") > maxArrayLength (").concat(this.maxArrayLength,")"));this.stack.pushArrayState(e)}decodeString(e,t){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(e,t):this.decodeBinary(e,t)}decodeUtf8String(e,t){var n;if(e>this.maxStrLength)throw new rE("Max length exceeded: UTF-8 byte length (".concat(e,") > maxStrLength (").concat(this.maxStrLength,")"));if(this.bytes.byteLength<this.pos+t+e)throw IE;const r=this.pos+t;let i;return i=this.stateIsMapKey()&&null!==(n=this.keyDecoder)&&void 0!==n&&n.canBeCached(e)?this.keyDecoder.decode(this.bytes,r,e):yE(this.bytes,r,e),this.pos+=t+e,i}stateIsMapKey(){if(this.stack.length>0){return this.stack.top().type===bE}return!1}decodeBinary(e,t){if(e>this.maxBinLength)throw new rE("Max length exceeded: bin length (".concat(e,") > maxBinLength (").concat(this.maxBinLength,")"));if(!this.hasRemaining(e+t))throw IE;const n=this.pos+t,r=this.bytes.subarray(n,n+e);return this.pos+=t+e,r}decodeExtension(e,t){if(e>this.maxExtLength)throw new rE("Max length exceeded: ext length (".concat(e,") > maxExtLength (").concat(this.maxExtLength,")"));const n=this.view.getInt8(this.pos+t),r=this.decodeBinary(e,t+1);return this.extensionCodec.decode(r,n,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){const e=this.view.getUint8(this.pos);return this.pos++,e}readI8(){const e=this.view.getInt8(this.pos);return this.pos++,e}readU16(){const e=this.view.getUint16(this.pos);return this.pos+=2,e}readI16(){const e=this.view.getInt16(this.pos);return this.pos+=2,e}readU32(){const e=this.view.getUint32(this.pos);return this.pos+=4,e}readI32(){const e=this.view.getInt32(this.pos);return this.pos+=4,e}readU64(){const e=(t=this.view,n=this.pos,4294967296*t.getUint32(n)+t.getUint32(n+4));var t,n;return this.pos+=8,e}readI64(){const e=sE(this.view,this.pos);return this.pos+=8,e}readU64AsBigInt(){const e=this.view.getBigUint64(this.pos);return this.pos+=8,e}readI64AsBigInt(){const e=this.view.getBigInt64(this.pos);return this.pos+=8,e}readF32(){const e=this.view.getFloat32(this.pos);return this.pos+=4,e}readF64(){const e=this.view.getFloat64(this.pos);return this.pos+=8,e}}class TE{constructor(e){var t,n,r,i,o,s,a,c;cr(this,"extensionCodec",void 0),cr(this,"context",void 0),cr(this,"useBigInt64",void 0),cr(this,"maxDepth",void 0),cr(this,"initialBufferSize",void 0),cr(this,"sortKeys",void 0),cr(this,"forceFloat32",void 0),cr(this,"ignoreUndefined",void 0),cr(this,"forceIntegerToFloat",void 0),cr(this,"pos",void 0),cr(this,"view",void 0),cr(this,"bytes",void 0),cr(this,"entered",!1),this.extensionCodec=null!==(t=null===e||void 0===e?void 0:e.extensionCodec)&&void 0!==t?t:uE.defaultCodec,this.context=null===e||void 0===e?void 0:e.context,this.useBigInt64=null!==(n=null===e||void 0===e?void 0:e.useBigInt64)&&void 0!==n&&n,this.maxDepth=null!==(r=null===e||void 0===e?void 0:e.maxDepth)&&void 0!==r?r:100,this.initialBufferSize=null!==(i=null===e||void 0===e?void 0:e.initialBufferSize)&&void 0!==i?i:2048,this.sortKeys=null!==(o=null===e||void 0===e?void 0:e.sortKeys)&&void 0!==o&&o,this.forceFloat32=null!==(s=null===e||void 0===e?void 0:e.forceFloat32)&&void 0!==s&&s,this.ignoreUndefined=null!==(a=null===e||void 0===e?void 0:e.ignoreUndefined)&&void 0!==a&&a,this.forceIntegerToFloat=null!==(c=null===e||void 0===e?void 0:e.forceIntegerToFloat)&&void 0!==c&&c,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new TE({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}encodeSharedRef(e){if(this.entered){return this.clone().encodeSharedRef(e)}try{return this.entered=!0,this.reinitializeState(),this.doEncode(e,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(e){if(this.entered){return this.clone().encode(e)}try{return this.entered=!0,this.reinitializeState(),this.doEncode(e,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(e,t){if(t>this.maxDepth)throw new Error("Too deep objects in depth ".concat(t));null==e?this.encodeNil():"boolean"===typeof e?this.encodeBoolean(e):"number"===typeof e?this.forceIntegerToFloat?this.encodeNumberAsFloat(e):this.encodeNumber(e):"string"===typeof e?this.encodeString(e):this.useBigInt64&&"bigint"===typeof e?this.encodeBigInt64(e):this.encodeObject(e,t)}ensureBufferSizeToWrite(e){const t=this.pos+e;this.view.byteLength<t&&this.resizeBuffer(2*t)}resizeBuffer(e){const t=new ArrayBuffer(e),n=new Uint8Array(t),r=new DataView(t);n.set(this.bytes),this.view=r,this.bytes=n}encodeNil(){this.writeU8(192)}encodeBoolean(e){!1===e?this.writeU8(194):this.writeU8(195)}encodeNumber(e){!this.forceIntegerToFloat&&Number.isSafeInteger(e)?e>=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(211),this.writeI64(e)):this.encodeNumberAsFloat(e)}encodeNumberAsFloat(e){this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))}encodeBigInt64(e){e>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(e)):(this.writeU8(211),this.writeBigInt64(e))}writeStringHeader(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else{if(!(e<4294967296))throw new Error("Too long string: ".concat(e," bytes in UTF-8"));this.writeU8(219),this.writeU32(e)}}encodeString(e){const t=function(e){const t=e.length;let n=0,r=0;for(;r<t;){let i=e.charCodeAt(r++);if(0!==(4294967168&i))if(0===(4294965248&i))n+=2;else{if(i>=55296&&i<=56319&&r<t){const t=e.charCodeAt(r);56320===(64512&t)&&(++r,i=((1023&i)<<10)+(1023&t)+65536)}n+=0===(4294901760&i)?3:4}else n++}return n}(e);this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),fE(e,this.bytes,this.pos),this.pos+=t}encodeObject(e,t){const n=this.extensionCodec.tryToEncode(e,this.context);if(null!=n)this.encodeExtension(n);else if(Array.isArray(e))this.encodeArray(e,t);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else{if("object"!==typeof e)throw new Error("Unrecognized object: ".concat(Object.prototype.toString.apply(e)));this.encodeMap(e,t)}}encodeBinary(e){const t=e.byteLength;if(t<256)this.writeU8(196),this.writeU8(t);else if(t<65536)this.writeU8(197),this.writeU16(t);else{if(!(t<4294967296))throw new Error("Too large binary: ".concat(t));this.writeU8(198),this.writeU32(t)}const n=mE(e);this.writeU8a(n)}encodeArray(e,t){const n=e.length;if(n<16)this.writeU8(144+n);else if(n<65536)this.writeU8(220),this.writeU16(n);else{if(!(n<4294967296))throw new Error("Too large array: ".concat(n));this.writeU8(221),this.writeU32(n)}for(const r of e)this.doEncode(r,t+1)}countWithoutUndefined(e,t){let n=0;for(const r of t)void 0!==e[r]&&n++;return n}encodeMap(e,t){const n=Object.keys(e);this.sortKeys&&n.sort();const r=this.ignoreUndefined?this.countWithoutUndefined(e,n):n.length;if(r<16)this.writeU8(128+r);else if(r<65536)this.writeU8(222),this.writeU16(r);else{if(!(r<4294967296))throw new Error("Too large map object: ".concat(r));this.writeU8(223),this.writeU32(r)}for(const i of n){const n=e[i];this.ignoreUndefined&&void 0===n||(this.encodeString(i),this.doEncode(n,t+1))}}encodeExtension(e){if("function"===typeof e.data){const t=e.data(this.pos+6),n=t.length;if(n>=4294967296)throw new Error("Too large extension object: ".concat(n));return this.writeU8(201),this.writeU32(n),this.writeI8(e.type),void this.writeU8a(t)}const t=e.data.length;if(1===t)this.writeU8(212);else if(2===t)this.writeU8(213);else if(4===t)this.writeU8(214);else if(8===t)this.writeU8(215);else if(16===t)this.writeU8(216);else if(t<256)this.writeU8(199),this.writeU8(t);else if(t<65536)this.writeU8(200),this.writeU16(t);else{if(!(t<4294967296))throw new Error("Too large extension object: ".concat(t));this.writeU8(201),this.writeU32(t)}this.writeI8(e.type),this.writeU8a(e.data)}writeU8(e){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,e),this.pos++}writeU8a(e){const t=e.length;this.ensureBufferSizeToWrite(t),this.bytes.set(e,this.pos),this.pos+=t}writeI8(e){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,e),this.pos++}writeU16(e){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,e),this.pos+=2}writeI16(e){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,e),this.pos+=2}writeU32(e){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,e),this.pos+=4}writeI32(e){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,e),this.pos+=4}writeF32(e){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,e),this.pos+=4}writeF64(e){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,e),this.pos+=8}writeU64(e){this.ensureBufferSizeToWrite(8),function(e,t,n){const r=n/4294967296,i=n;e.setUint32(t,r),e.setUint32(t+4,i)}(this.view,this.pos,e),this.pos+=8}writeI64(e){this.ensureBufferSizeToWrite(8),oE(this.view,this.pos,e),this.pos+=8}writeBigUint64(e){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,e),this.pos+=8}writeBigInt64(e){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,e),this.pos+=8}}function RE(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function kE(e){if(!RE(e))throw new Error("Uint8Array expected");for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if(n.length>0&&!n.includes(e.length))throw new Error("Uint8Array expected of length "+n+", got length="+e.length)}function PE(e,t){return!!Array.isArray(t)&&(0===t.length||(e?t.every((e=>"string"===typeof e)):t.every((e=>Number.isSafeInteger(e)))))}function CE(e){if("function"!==typeof e)throw new Error("function expected");return!0}function NE(e,t){if("string"!==typeof t)throw new Error("".concat(e,": string expected"));return!0}function UE(e){if(!Number.isSafeInteger(e))throw new Error("invalid integer: ".concat(e))}function BE(e){if(!Array.isArray(e))throw new Error("array expected")}function LE(e,t){if(!PE(!0,t))throw new Error("".concat(e,": array of strings expected"))}function DE(e,t){if(!PE(!1,t))throw new Error("".concat(e,": array of numbers expected"))}function jE(){const e=e=>e,t=(e,t)=>n=>e(t(n));for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];const o=r.map((e=>e.encode)).reduceRight(t,e),s=r.map((e=>e.decode)).reduce(t,e);return{encode:o,decode:s}}function ME(e){const t="string"===typeof e?e.split(""):e,n=t.length;LE("alphabet",t);const r=new Map(t.map(((e,t)=>[e,t])));return{encode:r=>(BE(r),r.map((r=>{if(!Number.isSafeInteger(r)||r<0||r>=n)throw new Error('alphabet.encode: digit index outside alphabet "'.concat(r,'". Allowed: ').concat(e));return t[r]}))),decode:t=>(BE(t),t.map((t=>{NE("alphabet.decode",t);const n=r.get(t);if(void 0===n)throw new Error('Unknown letter: "'.concat(t,'". Allowed: ').concat(e));return n})))}}function FE(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return NE("join",e),{encode:t=>(LE("join.decode",t),t.join(e)),decode:t=>(NE("join.decode",t),t.split(e))}}function zE(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"=";return UE(e),NE("padding",t),{encode(n){for(LE("padding.encode",n);n.length*e%8;)n.push(t);return n},decode(n){LE("padding.decode",n);let r=n.length;if(r*e%8)throw new Error("padding: invalid, string should have whole number of bytes");for(;r>0&&n[r-1]===t;r--){if((r-1)*e%8===0)throw new Error("padding: invalid, string has too much padding")}return n.slice(0,r)}}}function qE(e){return CE(e),{encode:e=>e,decode:t=>e(t)}}function HE(e,t,n){if(t<2)throw new Error("convertRadix: invalid from=".concat(t,", base cannot be less than 2"));if(n<2)throw new Error("convertRadix: invalid to=".concat(n,", base cannot be less than 2"));if(BE(e),!e.length)return[];let r=0;const i=[],o=Array.from(e,(e=>{if(UE(e),e<0||e>=t)throw new Error("invalid integer: ".concat(e));return e})),s=o.length;for(;;){let e=0,a=!0;for(let i=r;i<s;i++){const s=o[i],c=t*e,l=c+s;if(!Number.isSafeInteger(l)||c/t!==e||l-s!==c)throw new Error("convertRadix: carry overflow");const u=l/n;e=l%n;const d=Math.floor(u);if(o[i]=d,!Number.isSafeInteger(d)||d*n+e!==l)throw new Error("convertRadix: carry overflow");a&&(d?a=!1:r=i)}if(i.push(e),a)break}for(let a=0;a<e.length-1&&0===e[a];a++)i.push(0);return i.reverse()}const VE=(e,t)=>0===t?e:VE(t,e%t),KE=(e,t)=>e+(t-VE(e,t)),WE=(()=>{let e=[];for(let t=0;t<40;t++)e.push(2**t);return e})();function GE(e,t,n,r){if(BE(e),t<=0||t>32)throw new Error("convertRadix2: wrong from=".concat(t));if(n<=0||n>32)throw new Error("convertRadix2: wrong to=".concat(n));if(KE(t,n)>32)throw new Error("convertRadix2: carry overflow from=".concat(t," to=").concat(n," carryBits=").concat(KE(t,n)));let i=0,o=0;const s=WE[t],a=WE[n]-1,c=[];for(const l of e){if(UE(l),l>=s)throw new Error("convertRadix2: invalid data word=".concat(l," from=").concat(t));if(i=i<<t|l,o+t>32)throw new Error("convertRadix2: carry overflow pos=".concat(o," from=").concat(t));for(o+=t;o>=n;o-=n)c.push((i>>o-n&a)>>>0);const e=WE[o];if(void 0===e)throw new Error("invalid carry");i&=e-1}if(i=i<<n-o&a,!r&&o>=t)throw new Error("Excess padding");if(!r&&i>0)throw new Error("Non-zero padding: ".concat(i));return r&&o>0&&c.push(i>>>0),c}function YE(e){UE(e);return{encode:t=>{if(!RE(t))throw new Error("radix.encode input should be Uint8Array");return HE(Array.from(t),256,e)},decode:t=>(DE("radix.decode",t),Uint8Array.from(HE(t,e,256)))}}function ZE(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(UE(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(KE(8,e)>32||KE(e,8)>32)throw new Error("radix2: carry overflow");return{encode:n=>{if(!RE(n))throw new Error("radix2.encode input should be Uint8Array");return GE(Array.from(n),8,e,!t)},decode:n=>(DE("radix2.decode",n),Uint8Array.from(GE(n,e,8,t)))}}function XE(e){return CE(e),function(){try{for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.apply(null,n)}catch(Mz){}}}jE(ZE(4),ME("0123456789ABCDEF"),FE(""));const QE=jE(ZE(5),ME("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),zE(5),FE("")),JE=(jE(ZE(5),ME("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),FE("")),jE(ZE(5),ME("0123456789ABCDEFGHIJKLMNOPQRSTUV"),zE(5),FE("")),jE(ZE(5),ME("0123456789ABCDEFGHIJKLMNOPQRSTUV"),FE("")),jE(ZE(5),ME("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),FE(""),qE((e=>e.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")))),(()=>"function"===typeof Uint8Array.from([]).toBase64&&"function"===typeof Uint8Array.fromBase64)()),$E=(e,t)=>{NE("base64",e);const n=t?/^[A-Za-z0-9=_-]+$/:/^[A-Za-z0-9=+/]+$/,r=t?"base64url":"base64";if(e.length>0&&!n.test(e))throw new Error("invalid base64");return Uint8Array.fromBase64(e,{alphabet:r,lastChunkHandling:"strict"})},e_=(JE||jE(ZE(6),ME("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),zE(6),FE("")),jE(ZE(6),ME("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),FE("")),JE||jE(ZE(6),ME("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),zE(6),FE("")),jE(ZE(6),ME("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),FE("")),e=>jE(YE(58),ME(e),FE(""))),t_=(e_("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),e_("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),e_("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"),jE(ME("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),FE(""))),n_=[996825010,642813549,513874426,1027748829,705979059];function r_(e){const t=e>>25;let n=(33554431&e)<<5;for(let r=0;r<n_.length;r++)1===(t>>r&1)&&(n^=n_[r]);return n}function i_(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;const r=e.length;let i=1;for(let o=0;o<r;o++){const t=e.charCodeAt(o);if(t<33||t>126)throw new Error("Invalid prefix (".concat(e,")"));i=r_(i)^t>>5}i=r_(i);for(let o=0;o<r;o++)i=r_(i)^31&e.charCodeAt(o);for(let o of t)i=r_(i)^o;for(let o=0;o<6;o++)i=r_(i);return i^=n,t_.encode(GE([i%WE[30]],30,5,!1))}function o_(e){const t="bech32"===e?1:734539939,n=ZE(5),r=n.decode,i=n.encode,o=XE(r);function s(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:90;NE("bech32.encode prefix",e),RE(n)&&(n=Array.from(n)),DE("bech32.encode",n);const i=e.length;if(0===i)throw new TypeError("Invalid prefix length ".concat(i));const o=i+7+n.length;if(!1!==r&&o>r)throw new TypeError("Length ".concat(o," exceeds limit ").concat(r));const s=e.toLowerCase(),a=i_(s,n,t);return"".concat(s,"1").concat(t_.encode(n)).concat(a)}function a(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:90;NE("bech32.decode input",e);const r=e.length;if(r<8||!1!==n&&r>n)throw new TypeError("invalid string length: ".concat(r," (").concat(e,"). Expected (8..").concat(n,")"));const i=e.toLowerCase();if(e!==i&&e!==e.toUpperCase())throw new Error("String must be lowercase or uppercase");const o=i.lastIndexOf("1");if(0===o||-1===o)throw new Error('Letter "1" must be present between prefix and data only');const s=i.slice(0,o),a=i.slice(o+1);if(a.length<6)throw new Error("Data must be at least 6 characters long");const c=t_.decode(a).slice(0,-6),l=i_(s,c,t);if(!a.endsWith(l))throw new Error("Invalid checksum in ".concat(e,': expected "').concat(l,'"'));return{prefix:s,words:c}}return{encode:s,decode:a,encodeFromBytes:function(e,t){return s(e,i(t))},decodeToBytes:function(e){const{prefix:t,words:n}=a(e,!1);return{prefix:t,words:n,bytes:r(n)}},decodeUnsafe:XE(a),fromWords:r,fromWordsUnsafe:o,toWords:i}}o_("bech32"),o_("bech32m");const s_={encode:e=>(kE(e),e.toHex()),decode:e=>(NE("hex",e),Uint8Array.fromHex(e))};(()=>"function"===typeof Uint8Array.from([]).toHex&&"function"===typeof Uint8Array.fromHex)()||jE(ZE(4),ME("0123456789abcdef"),FE(""),qE((e=>{if("string"!==typeof e||e.length%2!==0)throw new TypeError("hex.decode: expected string, got ".concat(typeof e," with length ").concat(e.length));return e.toLowerCase()})));function a_(e){return null!=globalThis.Buffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}function c_(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?a_(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}function l_(e,t){t||(t=e.reduce(((e,t)=>e+t.length),0));const n=c_(t);let r=0;for(const i of e)n.set(i,r),r+=i.length;return a_(n)}var u_=function(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),r=0;r<n.length;r++)n[r]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),s=o.charCodeAt(0);if(255!==n[s])throw new TypeError(o+" is ambiguous");n[s]=i}var a=e.length,c=e.charAt(0),l=Math.log(a)/Math.log(256),u=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 r=0,i=0;e[t]===c;)r++,t++;for(var o=(e.length-t)*l+1>>>0,s=new Uint8Array(o);e[t];){var u=n[e.charCodeAt(t)];if(255===u)return;for(var d=0,f=o-1;(0!==u||d<i)&&-1!==f;f--,d++)u+=a*s[f]>>>0,s[f]=u%256>>>0,u=u/256>>>0;if(0!==u)throw new Error("Non-zero carry");i=d,t++}if(" "!==e[t]){for(var h=o-i;h!==o&&0===s[h];)h++;for(var p=new Uint8Array(r+(o-h)),g=r;h!==o;)p[g++]=s[h++];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 n=0,r=0,i=0,o=t.length;i!==o&&0===t[i];)i++,n++;for(var s=(o-i)*u+1>>>0,l=new Uint8Array(s);i!==o;){for(var d=t[i],f=0,h=s-1;(0!==d||f<r)&&-1!==h;h--,f++)d+=256*l[h]>>>0,l[h]=d%a>>>0,d=d/a>>>0;if(0!==d)throw new Error("Non-zero carry");r=f,i++}for(var p=s-r;p!==s&&0===l[p];)p++;for(var g=c.repeat(n);p<s;++p)g+=e.charAt(l[p]);return g},decodeUnsafe:d,decode:function(e){var n=d(e);if(n)return n;throw new Error("Non-".concat(t," character"))}}};const d_=u_,f_=(new Uint8Array(0),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")});class h_{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return"".concat(this.prefix).concat(this.baseEncode(e));throw Error("Unknown type, must be binary type")}}class p_{constructor(e,t,n){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if("string"===typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error("Unable to decode multibase string ".concat(JSON.stringify(e),", ").concat(this.name," decoder only supports inputs prefixed with ").concat(this.prefix));return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return y_(this,e)}}class g_{constructor(e){this.decoders=e}or(e){return y_(this,e)}decode(e){const t=e[0],n=this.decoders[t];if(n)return n.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 y_=(e,t)=>new g_({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class m_{constructor(e,t,n,r){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=r,this.encoder=new h_(e,t,n),this.decoder=new p_(e,t,r)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const v_=e=>{let{name:t,prefix:n,encode:r,decode:i}=e;return new m_(t,n,r,i)},b_=e=>{let{prefix:t,name:n,alphabet:r}=e;const{encode:i,decode:o}=d_(r,n);return v_({prefix:t,name:n,encode:i,decode:e=>f_(o(e))})},w_=e=>{let{name:t,prefix:n,bitsPerChar:r,alphabet:i}=e;return v_({prefix:n,name:t,encode:e=>((e,t,n)=>{const r="="===t[t.length-1],i=(1<<n)-1;let o="",s=0,a=0;for(let c=0;c<e.length;++c)for(a=a<<8|e[c],s+=8;s>n;)s-=n,o+=t[i&a>>s];if(s&&(o+=t[i&a<<n-s]),r)for(;o.length*n&7;)o+="=";return o})(e,i,r),decode:e=>((e,t,n,r)=>{const i={};for(let u=0;u<t.length;++u)i[t[u]]=u;let o=e.length;for(;"="===e[o-1];)--o;const s=new Uint8Array(o*n/8|0);let a=0,c=0,l=0;for(let u=0;u<o;++u){const t=i[e[u]];if(void 0===t)throw new SyntaxError("Non-".concat(r," character"));c=c<<n|t,a+=n,a>=8&&(a-=8,s[l++]=255&c>>a)}if(a>=n||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return s})(e,i,r,t)})},E_=v_({prefix:"\0",name:"identity",encode:e=>(e=>(new TextDecoder).decode(e))(e),decode:e=>(e=>(new TextEncoder).encode(e))(e)}),__=w_({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),S_=w_({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),x_=b_({prefix:"9",name:"base10",alphabet:"0123456789"}),I_=w_({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),O_=w_({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),A_=w_({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),T_=w_({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),R_=w_({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),k_=w_({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),P_=w_({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),C_=w_({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),N_=w_({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),U_=w_({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),B_=w_({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),L_=b_({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),D_=b_({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),j_=b_({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),M_=b_({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),F_=w_({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),z_=w_({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),q_=w_({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),H_=w_({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),V_=Array.from("\ud83d\ude80\ud83e\ude90\u2604\ud83d\udef0\ud83c\udf0c\ud83c\udf11\ud83c\udf12\ud83c\udf13\ud83c\udf14\ud83c\udf15\ud83c\udf16\ud83c\udf17\ud83c\udf18\ud83c\udf0d\ud83c\udf0f\ud83c\udf0e\ud83d\udc09\u2600\ud83d\udcbb\ud83d\udda5\ud83d\udcbe\ud83d\udcbf\ud83d\ude02\u2764\ud83d\ude0d\ud83e\udd23\ud83d\ude0a\ud83d\ude4f\ud83d\udc95\ud83d\ude2d\ud83d\ude18\ud83d\udc4d\ud83d\ude05\ud83d\udc4f\ud83d\ude01\ud83d\udd25\ud83e\udd70\ud83d\udc94\ud83d\udc96\ud83d\udc99\ud83d\ude22\ud83e\udd14\ud83d\ude06\ud83d\ude44\ud83d\udcaa\ud83d\ude09\u263a\ud83d\udc4c\ud83e\udd17\ud83d\udc9c\ud83d\ude14\ud83d\ude0e\ud83d\ude07\ud83c\udf39\ud83e\udd26\ud83c\udf89\ud83d\udc9e\u270c\u2728\ud83e\udd37\ud83d\ude31\ud83d\ude0c\ud83c\udf38\ud83d\ude4c\ud83d\ude0b\ud83d\udc97\ud83d\udc9a\ud83d\ude0f\ud83d\udc9b\ud83d\ude42\ud83d\udc93\ud83e\udd29\ud83d\ude04\ud83d\ude00\ud83d\udda4\ud83d\ude03\ud83d\udcaf\ud83d\ude48\ud83d\udc47\ud83c\udfb6\ud83d\ude12\ud83e\udd2d\u2763\ud83d\ude1c\ud83d\udc8b\ud83d\udc40\ud83d\ude2a\ud83d\ude11\ud83d\udca5\ud83d\ude4b\ud83d\ude1e\ud83d\ude29\ud83d\ude21\ud83e\udd2a\ud83d\udc4a\ud83e\udd73\ud83d\ude25\ud83e\udd24\ud83d\udc49\ud83d\udc83\ud83d\ude33\u270b\ud83d\ude1a\ud83d\ude1d\ud83d\ude34\ud83c\udf1f\ud83d\ude2c\ud83d\ude43\ud83c\udf40\ud83c\udf37\ud83d\ude3b\ud83d\ude13\u2b50\u2705\ud83e\udd7a\ud83c\udf08\ud83d\ude08\ud83e\udd18\ud83d\udca6\u2714\ud83d\ude23\ud83c\udfc3\ud83d\udc90\u2639\ud83c\udf8a\ud83d\udc98\ud83d\ude20\u261d\ud83d\ude15\ud83c\udf3a\ud83c\udf82\ud83c\udf3b\ud83d\ude10\ud83d\udd95\ud83d\udc9d\ud83d\ude4a\ud83d\ude39\ud83d\udde3\ud83d\udcab\ud83d\udc80\ud83d\udc51\ud83c\udfb5\ud83e\udd1e\ud83d\ude1b\ud83d\udd34\ud83d\ude24\ud83c\udf3c\ud83d\ude2b\u26bd\ud83e\udd19\u2615\ud83c\udfc6\ud83e\udd2b\ud83d\udc48\ud83d\ude2e\ud83d\ude46\ud83c\udf7b\ud83c\udf43\ud83d\udc36\ud83d\udc81\ud83d\ude32\ud83c\udf3f\ud83e\udde1\ud83c\udf81\u26a1\ud83c\udf1e\ud83c\udf88\u274c\u270a\ud83d\udc4b\ud83d\ude30\ud83e\udd28\ud83d\ude36\ud83e\udd1d\ud83d\udeb6\ud83d\udcb0\ud83c\udf53\ud83d\udca2\ud83e\udd1f\ud83d\ude41\ud83d\udea8\ud83d\udca8\ud83e\udd2c\u2708\ud83c\udf80\ud83c\udf7a\ud83e\udd13\ud83d\ude19\ud83d\udc9f\ud83c\udf31\ud83d\ude16\ud83d\udc76\ud83e\udd74\u25b6\u27a1\u2753\ud83d\udc8e\ud83d\udcb8\u2b07\ud83d\ude28\ud83c\udf1a\ud83e\udd8b\ud83d\ude37\ud83d\udd7a\u26a0\ud83d\ude45\ud83d\ude1f\ud83d\ude35\ud83d\udc4e\ud83e\udd32\ud83e\udd20\ud83e\udd27\ud83d\udccc\ud83d\udd35\ud83d\udc85\ud83e\uddd0\ud83d\udc3e\ud83c\udf52\ud83d\ude17\ud83e\udd11\ud83c\udf0a\ud83e\udd2f\ud83d\udc37\u260e\ud83d\udca7\ud83d\ude2f\ud83d\udc86\ud83d\udc46\ud83c\udfa4\ud83d\ude47\ud83c\udf51\u2744\ud83c\udf34\ud83d\udca3\ud83d\udc38\ud83d\udc8c\ud83d\udccd\ud83e\udd40\ud83e\udd22\ud83d\udc45\ud83d\udca1\ud83d\udca9\ud83d\udc50\ud83d\udcf8\ud83d\udc7b\ud83e\udd10\ud83e\udd2e\ud83c\udfbc\ud83e\udd75\ud83d\udea9\ud83c\udf4e\ud83c\udf4a\ud83d\udc7c\ud83d\udc8d\ud83d\udce3\ud83e\udd42"),K_=V_.reduce(((e,t,n)=>(e[n]=t,e)),[]),W_=V_.reduce(((e,t,n)=>(e[t.codePointAt(0)]=n,e)),[]);const G_=v_({prefix:"\ud83d\ude80",name:"base256emoji",encode:function(e){return e.reduce(((e,t)=>e+=K_[t]),"")},decode:function(e){const t=[];for(const n of e){const e=W_[n.codePointAt(0)];if(void 0===e)throw new Error("Non-base256emoji character: ".concat(n));t.push(e)}return new Uint8Array(t)}});var Y_=function e(t,n,r){n=n||[];var i=r=r||0;for(;t>=Q_;)n[r++]=255&t|Z_,t/=128;for(;t&X_;)n[r++]=255&t|Z_,t>>>=7;return n[r]=0|t,e.bytes=r-i+1,n},Z_=128,X_=-128,Q_=Math.pow(2,31);var J_=function e(t,n){var r,i=0,o=0,s=n=n||0,a=t.length;do{if(s>=a)throw e.bytes=0,new RangeError("Could not decode varint");r=t[s++],i+=o<28?(r&eS)<<o:(r&eS)*Math.pow(2,o),o+=7}while(r>=$_);return e.bytes=s-n,i},$_=128,eS=127;var tS=Math.pow(2,7),nS=Math.pow(2,14),rS=Math.pow(2,21),iS=Math.pow(2,28),oS=Math.pow(2,35),sS=Math.pow(2,42),aS=Math.pow(2,49),cS=Math.pow(2,56),lS=Math.pow(2,63);const uS={encode:Y_,decode:J_,encodingLength:function(e){return e<tS?1:e<nS?2:e<rS?3:e<iS?4:e<oS?5:e<sS?6:e<aS?7:e<cS?8:e<lS?9:10}},dS=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return uS.encode(e,t,n),t},fS=e=>uS.encodingLength(e),hS=(e,t)=>{const n=t.byteLength,r=fS(e),i=r+fS(n),o=new Uint8Array(i+n);return dS(e,o,0),dS(n,o,r),o.set(t,i),new pS(e,n,t,o)};class pS{constructor(e,t,n,r){this.code=e,this.size=t,this.digest=n,this.bytes=r}}const gS=e=>{let{name:t,code:n,encode:r}=e;return new yS(t,n,r)};class yS{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?hS(this.code,t):t.then((e=>hS(this.code,e)))}throw Error("Unknown type, must be binary type")}}const mS=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),vS=gS({name:"sha2-256",code:18,encode:mS("SHA-256")}),bS=gS({name:"sha2-512",code:19,encode:mS("SHA-512")}),wS=f_,ES={code:0,name:"identity",encode:wS,digest:e=>hS(0,wS(e))},_S="raw",SS=85,xS=e=>f_(e),IS=e=>f_(e),OS=new TextEncoder,AS=new TextDecoder,TS="json",RS=512,kS=e=>OS.encode(JSON.stringify(e)),PS=e=>JSON.parse(AS.decode(e));Symbol.toStringTag,Symbol.for("nodejs.util.inspect.custom");Symbol.for("@ipld/js-cid/CID");const CS={...t,...r,...i,...o,...s,...a,...c,...l,...u,...d};function NS(e,t,n,r){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:n},decoder:{decode:r}}}const US=NS("utf8","u",(e=>"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),BS=NS("ascii","a",(e=>{let t="a";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t}),(e=>{const t=c_((e=e.substring(1)).length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t})),LS={utf8:US,"utf-8":US,hex:CS.base16,latin1:BS,ascii:BS,binary:BS,...CS};function DS(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf8";const n=LS[t];if(!n)throw new Error('Unsupported encoding "'.concat(t,'"'));return"utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?n.decoder.decode("".concat(n.prefix).concat(e)):a_(globalThis.Buffer.from(e,"utf-8"))}function jS(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf8";const n=LS[t];if(!n)throw new Error('Unsupported encoding "'.concat(t,'"'));return"utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?n.encoder.encode(e).substring(1):globalThis.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("utf8")}const MS={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}};var FS=n(6823);const zS=":";function qS(e){const[t,n]=e.split(zS);return{namespace:t,reference:n}}function HS(e,t){return e.includes(":")?[e]:t.chains||[]}var VS=Object.defineProperty,KS=Object.defineProperties,WS=Object.getOwnPropertyDescriptors,GS=Object.getOwnPropertySymbols,YS=Object.prototype.hasOwnProperty,ZS=Object.prototype.propertyIsEnumerable,XS=(e,t,n)=>t in e?VS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,QS=(e,t)=>{for(var n in t||(t={}))YS.call(t,n)&&XS(e,n,t[n]);if(GS)for(var n of GS(t))ZS.call(t,n)&&XS(e,n,t[n]);return e},JS=(e,t,n)=>XS(e,"symbol"!=typeof t?t+"":t,n);const $S="ReactNative",ex={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},tx="js";function nx(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function rx(){return!(0,_m.getDocument)()&&!!(0,_m.getNavigator)()&&navigator.product===$S}function ix(){return!nx()&&!!(0,_m.getNavigator)()&&!!(0,_m.getDocument)()}function ox(){return rx()?ex.reactNative:nx()?ex.node:ix()?ex.browser:ex.unknown}function sx(){var e;try{return rx()&&typeof global<"u"&&typeof(null==global?void 0:global.Application)<"u"?null==(e=global.Application)?void 0:e.applicationId:void 0}catch{return}}function ax(e){var t,n;const r=cx();try{return null!=e&&e.url&&r.url&&new URL(e.url).host!==new URL(r.url).host&&(console.warn("The configured WalletConnect 'metadata.url':".concat(e.url," differs from the actual page url:").concat(r.url,". This is probably unintended and can lead to issues.")),e.url=r.url),null!=(t=null===e||void 0===e?void 0:e.icons)&&t.length&&e.icons.length>0&&(e.icons=e.icons.filter((e=>""!==e))),((e,t)=>KS(e,WS(t)))(QS(QS({},r),e),{url:(null===e||void 0===e?void 0:e.url)||r.url,name:(null===e||void 0===e?void 0:e.name)||r.name,description:(null===e||void 0===e?void 0:e.description)||r.description,icons:null!=(n=null===e||void 0===e?void 0:e.icons)&&n.length&&e.icons.length>0?e.icons:r.icons})}catch(Ju){return console.warn("Error populating app metadata",Ju),e||r}}function cx(){return(0,Sm.g)()||{name:"",description:"",url:"",icons:[""]}}function lx(e,t,n){const r=function(){if(ox()===ex.reactNative&&typeof global<"u"&&typeof(null==global?void 0:global.Platform)<"u"){const{OS:e,Version:t}=global.Platform;return[e,t].join("-")}const e=bm();if(null===e)return"unknown";const t=e.os?e.os.replace(" ","").toLowerCase():"unknown";return"browser"===e.type?[t,e.name,e.version].join("-"):[t,e.version].join("-")}(),i=function(){var e;const t=ox();return t===ex.browser?[t,(null==(e=(0,_m.getLocation)())?void 0:e.host)||"unknown"].join(":"):t}();return[[e,t].join("-"),[tx,n].join("-"),r,i].join("/")}function ux(e){let{protocol:t,version:n,relayUrl:r,sdkVersion:i,auth:o,projectId:s,useOnCloseEvent:a,bundleId:c,packageName:l}=e;const u=r.split("?"),d={auth:o,ua:lx(t,n,i),projectId:s,useOnCloseEvent:a||void 0,packageName:l||void 0,bundleId:c||void 0},f=function(e,t){const n=new URLSearchParams(e);return Object.entries(t).sort(((e,t)=>{let[n]=e,[r]=t;return n.localeCompare(r)})).forEach((e=>{let[t,r]=e;null!=r&&n.set(t,String(r))})),n.toString()}(u[1]||"",d);return u[0]+"?"+f}function dx(e,t){return e.filter((e=>t.includes(e))).length===e.length}function fx(e){return Object.fromEntries(e.entries())}function hx(e){return new Map(Object.entries(e))}function px(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Bd.FIVE_MINUTES,t=arguments.length>1?arguments[1]:void 0;const n=(0,Bd.toMiliseconds)(e||Bd.FIVE_MINUTES);let r,i,o,s;return{resolve:e=>{o&&r&&(clearTimeout(o),r(e),s=Promise.resolve(e))},reject:e=>{o&&i&&(clearTimeout(o),i(e))},done:()=>new Promise(((e,a)=>{if(s)return e(s);o=setTimeout((()=>{const e=new Error(t);s=Promise.reject(e),a(e)}),n),r=e,i=a}))}}function gx(e,t,n){return new Promise((async(r,i)=>{const o=setTimeout((()=>i(new Error(n))),t);try{r(await e)}catch(Qu){i(Qu)}clearTimeout(o)}))}function yx(e,t){if("string"==typeof t&&t.startsWith("".concat(e,":")))return t;if("topic"===e.toLowerCase()){if("string"!=typeof t)throw new Error('Value must be "string" for expirer target type: topic');return"topic:".concat(t)}if("id"===e.toLowerCase()){if("number"!=typeof t)throw new Error('Value must be "number" for expirer target type: id');return"id:".concat(t)}throw new Error("Unknown expirer target type: ".concat(e))}function mx(e){const[t,n]=e.split(":"),r={id:void 0,topic:void 0};if("topic"===t&&"string"==typeof n)r.topic=n;else{if("id"!==t||!Number.isInteger(Number(n)))throw new Error("Invalid target, expected id:number or topic:string, got ".concat(t,":").concat(n));r.id=Number(n)}return r}function vx(e,t){return(0,Bd.fromMiliseconds)((t||Date.now())+(0,Bd.toMiliseconds)(e))}function bx(e){return Date.now()>=(0,Bd.toMiliseconds)(e)}function wx(e,t){return"".concat(e).concat(t?":".concat(t):"")}function Ex(){return[...new Set([...arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],...arguments.length>1&&void 0!==arguments[1]?arguments[1]:[]])]}async function _x(e){let{id:t,topic:n,wcDeepLink:r}=e;var i;try{if(!r)return;const e="string"==typeof r?JSON.parse(r):r,o=null===e||void 0===e?void 0:e.href;if("string"!=typeof o)return;const s=function(e,t,n){const r="requestId=".concat(t,"&sessionTopic=").concat(n);e.endsWith("/")&&(e=e.slice(0,-1));let i="".concat(e);if(e.startsWith("https://t.me")){const t=e.includes("?")?"&startapp=":"?startapp=";i="".concat(i).concat(t).concat(function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=Buffer.from(e).toString("base64");return t?n.replace(/[=]/g,""):n}(r,!0))}else i="".concat(i,"/wc?").concat(r);return i}(o,t,n),a=ox();if(a===ex.browser){if(null==(i=(0,_m.getDocument)())||!i.hasFocus())return void console.warn("Document does not have focus, skipping deeplink.");!function(e){let t="_self";!function(){try{return window.self!==window.top}catch{return!1}}()?(typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)||e.startsWith("https://")||e.startsWith("http://"))&&(t="_blank"):t="_top",window.open(e,t,"noreferrer noopener")}(s)}else a===ex.reactNative&&typeof(null==global?void 0:global.Linking)<"u"&&await global.Linking.openURL(s)}catch(Ju){console.error(Ju)}}function Sx(e,t){if(!e.includes(t))return null;const n=e.split(/([&,?,=])/),r=n.indexOf(t);return n[r+2]}function xx(){return typeof crypto<"u"&&null!=crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,(e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}function Ix(){return typeof process<"u"&&"true"==={NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0,REACT_APP_FUNC_SYNC_BLOCK_FOR_EVENT_URL:"https://us-central1-flowty-test.cloudfunctions.net/httpSyncBlockForEvent",REACT_APP_NFT_CATALOG:"0x324c34e1c517e4db",REACT_APP_FIREBASE_MESSAGING_SENDER_ID:"464683970830",REACT_APP_ADDRESS_EXAMPLE_NFT_CONTRACT:"",REACT_APP_NFT_COLLECTION_VERSUS:"versusArtCollection",REACT_APP_ADDRESS_NON_FUNGIBLE_TOKEN_CONTRACT:"0x631e88ae7f1d7c20",REACT_APP_ADDRESS_FUSD_CONTRACT:"",REACT_APP_STAGE:"test",REACT_APP_NFT_COLLECTION:"",REACT_APP_ADDRESS_FLOWTYV2_CONTRACT:"0xb051bdaddb672a33",REACT_APP_STRAPI_URL:"https://confident-crystal-513bf384d1.strapiapp.com",REACT_APP_ALCHEMY_API_KEY:"",REACT_APP_CREATOR_HUB_ENABLED:"true",REACT_APP_WALLET_CONNECT_PROJECT_ID:"083ff1d46c8f7cb2f936a31b614ececa",REACT_APP_FIREBASE_MEASUREMENT_ID:"G-9869SGBB4D",REACT_APP_FIREBASE_STORAGE_BUCKET:"flowty-test.appspot.com",REACT_APP_FIREBASE_AUTH_DOMAIN:"flowty-test.firebaseapp.com",REACT_APP_NFT_COLLECTION_TOP_SHOT:"MomentCollection",REACT_APP_STOREFRONT_COLLECTION:"",REACT_APP_BASE_URL:"https://us-central1-flowty-test.cloudfunctions.net",REACT_APP_WALLET_DISCOVERY_V2:"https://fcl-discovery.onflow.org/testnet/authn",REACT_APP_CRESCENDO:"true",REACT_APP_WALLET_DISCOVERY_ENDPOINT_V2:"https://fcl-discovery.onflow.org/api/testnet/authn",REACT_APP_FIREBASE_PROJECT_ID:"flowty-test",REACT_APP_BLOCTO_WALLET_DISCOVERY:"https://flow-wallet-testnet.blocto.app/api/flow/authn",REACT_APP_WALLET_DISCOVERY:"https://fcl-discovery.onflow.org/testnet/authn",REACT_APP_FIREBASE_APP_ID:"1:464683970830:web:456c2eeed727f324e4275f",REACT_APP_ADDRESS_FUNGIBLE_TOKEN_CONTRACT:"0x9a0766d93b6608b7",REACT_APP_ADDRESS_TOPSHOT_CONTRACT:"0x877931736ee77cff",REACT_APP_ADDRESS_FLOWTY_CONTRACT:"0xe1d43e0cfc237807",REACT_APP_ACCESS_API:"https://testnet.onflow.org",REACT_APP_FIREBASE_API_KEY:"AIzaSyAcAiy7t5OQAHQSCP9ibHsKVSboKfGb-AU",REACT_APP_ADDRESS_PROFILE_CONTRACT:"",REACT_APP_API_URL:"https://api2.testnet.flowty.io",REACT_APP_FUNC_CREATE_TOKEN_URL:"https://us-central1-flowty-test.cloudfunctions.net/httpCreateCustomToken"}.IS_VITEST}function Ox(e){return Buffer.from(e,"base64").toString("utf-8")}class Ax{constructor(e){let{limit:t}=e;JS(this,"limit"),JS(this,"set"),this.limit=t,this.set=new Set}add(e){if(!this.set.has(e)){if(this.set.size>=this.limit){const e=this.set.values().next().value;e&&this.set.delete(e)}this.set.add(e)}}has(e){return this.set.has(e)}}const Tx=BigInt(2**32-1),Rx=BigInt(32);function kx(e){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?{h:Number(e&Tx),l:Number(e>>Rx&Tx)}:{h:0|Number(e>>Rx&Tx),l:0|Number(e&Tx)}}function Px(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=e.length;let r=new Uint32Array(n),i=new Uint32Array(n);for(let o=0;o<n;o++){const{h:n,l:s}=kx(e[o],t);[r[o],i[o]]=[n,s]}return[r,i]}const Cx=(e,t,n)=>e>>>n,Nx=(e,t,n)=>e<<32-n|t>>>n,Ux=(e,t,n)=>e>>>n|t<<32-n,Bx=(e,t,n)=>e<<32-n|t>>>n,Lx=(e,t,n)=>e<<64-n|t>>>n-32,Dx=(e,t,n)=>e>>>n-32|t<<64-n,jx=(e,t)=>t,Mx=(e,t)=>e;function Fx(e,t,n,r){const i=(t>>>0)+(r>>>0);return{h:e+n+(i/2**32|0)|0,l:0|i}}const zx=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),qx=(e,t,n,r)=>t+n+r+(e/2**32|0)|0,Hx=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),Vx=(e,t,n,r,i)=>t+n+r+i+(e/2**32|0)|0,Kx=(e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0),Wx=(e,t,n,r,i,o)=>t+n+r+i+o+(e/2**32|0)|0,Gx="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;function Yx(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function Zx(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Xx(e){if(!Yx(e))throw new Error("Uint8Array expected");for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if(n.length>0&&!n.includes(e.length))throw new Error("Uint8Array expected of length "+n+", got length="+e.length)}function Qx(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.createHasher");Zx(e.outputLen),Zx(e.blockLen)}function Jx(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function $x(e,t){Xx(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function eI(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function tI(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];for(let r=0;r<t.length;r++)t[r].fill(0)}function nI(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function rI(e,t){return e<<32-t|e>>>t}const iI=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0];function oI(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}const sI=iI?e=>e:e=>oI(e);const aI=iI?e=>e:function(e){for(let t=0;t<e.length;t++)e[t]=oI(e[t]);return e},cI="function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex,lI=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function uI(e){if(Xx(e),cI)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=lI[e[n]];return t}const dI={_0:48,_9:57,A:65,F:70,a:97,f:102};function fI(e){return e>=dI._0&&e<=dI._9?e-dI._0:e>=dI.A&&e<=dI.F?e-(dI.A-10):e>=dI.a&&e<=dI.f?e-(dI.a-10):void 0}function hI(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);if(cI)return Uint8Array.fromHex(e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let i=0,o=0;i<n;i++,o+=2){const t=fI(e.charCodeAt(o)),n=fI(e.charCodeAt(o+1));if(void 0===t||void 0===n){const t=e[o]+e[o+1];throw new Error('hex string expected, got non-hex character "'+t+'" at index '+o)}r[i]=16*t+n}return r}function pI(e){if("string"!=typeof e)throw new Error("string expected");return new Uint8Array((new TextEncoder).encode(e))}function gI(e){return"string"==typeof e&&(e=pI(e)),Xx(e),e}function yI(){let e=0;for(let n=0;n<arguments.length;n++){const t=n<0||arguments.length<=n?void 0:arguments[n];Xx(t),e+=t.length}const t=new Uint8Array(e);for(let n=0,r=0;n<arguments.length;n++){const e=n<0||arguments.length<=n?void 0:arguments[n];t.set(e,r),r+=e.length}return t}class mI{}function vI(e){const t=t=>e().update(gI(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function bI(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:32;if(Gx&&"function"==typeof Gx.getRandomValues)return Gx.getRandomValues(new Uint8Array(e));if(Gx&&"function"==typeof Gx.randomBytes)return Uint8Array.from(Gx.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}const wI=BigInt(0),EI=BigInt(1),_I=BigInt(2),SI=BigInt(7),xI=BigInt(256),II=BigInt(113),OI=[],AI=[],TI=[];for(let n=0,Fz=EI,zz=1,qz=0;n<24;n++){[zz,qz]=[qz,(2*zz+3*qz)%5],OI.push(2*(5*qz+zz)),AI.push((n+1)*(n+2)/2%64);let e=wI;for(let t=0;t<7;t++)Fz=(Fz<<EI^(Fz>>SI)*II)%xI,Fz&_I&&(e^=EI<<(EI<<BigInt(t))-EI);TI.push(e)}const RI=Px(TI,!0),kI=RI[0],PI=RI[1],CI=(e,t,n)=>n>32?((e,t,n)=>t<<n-32|e>>>64-n)(e,t,n):((e,t,n)=>e<<n|t>>>32-n)(e,t,n),NI=(e,t,n)=>n>32?((e,t,n)=>e<<n-32|t>>>64-n)(e,t,n):((e,t,n)=>t<<n|e>>>32-n)(e,t,n);class UI extends mI{constructor(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:24;if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=t,this.outputLen=n,this.enableXOF=r,this.rounds=i,Zx(n),!(0<e&&e<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=eI(this.state)}clone(){return this._cloneInto()}keccak(){aI(this.state32),function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:24;const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let r=0;r<10;r++)n[r]=e[r]^e[r+10]^e[r+20]^e[r+30]^e[r+40];for(let r=0;r<10;r+=2){const t=(r+8)%10,i=(r+2)%10,o=n[i],s=n[i+1],a=CI(o,s,1)^n[t],c=NI(o,s,1)^n[t+1];for(let n=0;n<50;n+=10)e[r+n]^=a,e[r+n+1]^=c}let t=e[2],i=e[3];for(let n=0;n<24;n++){const r=AI[n],o=CI(t,i,r),s=NI(t,i,r),a=OI[n];t=e[a],i=e[a+1],e[a]=o,e[a+1]=s}for(let r=0;r<50;r+=10){for(let t=0;t<10;t++)n[t]=e[r+t];for(let t=0;t<10;t++)e[r+t]^=~n[(t+2)%10]&n[(t+4)%10]}e[0]^=kI[r],e[1]^=PI[r]}tI(n)}(this.state32,this.rounds),aI(this.state32),this.posOut=0,this.pos=0}update(e){Jx(this),Xx(e=gI(e));const{blockLen:t,state:n}=this,r=e.length;for(let i=0;i<r;){const o=Math.min(t-this.pos,r-i);for(let t=0;t<o;t++)n[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:t,pos:n,blockLen:r}=this;e[n]^=t,0!==(128&t)&&n===r-1&&this.keccak(),e[r-1]^=128,this.keccak()}writeInto(e){Jx(this,!1),Xx(e),this.finish();const t=this.state,{blockLen:n}=this;for(let r=0,i=e.length;r<i;){this.posOut>=n&&this.keccak();const o=Math.min(n-this.posOut,i-r);e.set(t.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return Zx(e),this.xofInto(new Uint8Array(e))}digestInto(e){if($x(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,tI(this.state)}_cloneInto(e){const{blockLen:t,suffix:n,outputLen:r,rounds:i,enableXOF:o}=this;return e||(e=new UI(t,n,r,o,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=n,e.outputLen=r,e.enableXOF=o,e.destroyed=this.destroyed,e}}const BI=((e,t,n)=>vI((()=>new UI(t,e,n))))(1,136,32);function LI(e,t,n){return e&t^~e&n}function DI(e,t,n){return e&t^e&n^t&n}class jI extends mI{constructor(e,t,n,r){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.buffer=new Uint8Array(e),this.view=nI(this.buffer)}update(e){Jx(this),Xx(e=gI(e));const{view:t,buffer:n,blockLen:r}=this,i=e.length;for(let o=0;o<i;){const s=Math.min(r-this.pos,i-o);if(s!==r)n.set(e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===r&&(this.process(t,0),this.pos=0);else{const t=nI(e);for(;r<=i-o;o+=r)this.process(t,o)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){Jx(this),$x(e,this),this.finished=!0;const{buffer:t,view:n,blockLen:r,isLE:i}=this;let{pos:o}=this;t[o++]=128,tI(this.buffer.subarray(o)),this.padOffset>r-o&&(this.process(n,0),o=0);for(let u=o;u<r;u++)t[u]=0;(function(e,t,n,r){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,n,r);const i=BigInt(32),o=BigInt(4294967295),s=Number(n>>i&o),a=Number(n&o),c=r?4:0,l=r?0:4;e.setUint32(t+c,s,r),e.setUint32(t+l,a,r)})(n,r-8,BigInt(8*this.length),i),this.process(n,0);const s=nI(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=a/4,l=this.get();if(c>l.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<c;u++)s.setUint32(4*u,l[u],i)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:n,length:r,finished:i,destroyed:o,pos:s}=this;return e.destroyed=o,e.finished=i,e.length=r,e.pos=s,r%t&&e.buffer.set(n),e}clone(){return this._cloneInto()}}const MI=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),FI=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),zI=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),qI=Uint32Array.from([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]),HI=new Uint32Array(64);class VI extends jI{constructor(){super(64,arguments.length>0&&void 0!==arguments[0]?arguments[0]:32,8,!1),this.A=0|MI[0],this.B=0|MI[1],this.C=0|MI[2],this.D=0|MI[3],this.E=0|MI[4],this.F=0|MI[5],this.G=0|MI[6],this.H=0|MI[7]}get(){const{A:e,B:t,C:n,D:r,E:i,F:o,G:s,H:a}=this;return[e,t,n,r,i,o,s,a]}set(e,t,n,r,i,o,s,a){this.A=0|e,this.B=0|t,this.C=0|n,this.D=0|r,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|a}process(e,t){for(let u=0;u<16;u++,t+=4)HI[u]=e.getUint32(t,!1);for(let u=16;u<64;u++){const e=HI[u-15],t=HI[u-2],n=rI(e,7)^rI(e,18)^e>>>3,r=rI(t,17)^rI(t,19)^t>>>10;HI[u]=r+HI[u-7]+n+HI[u-16]|0}let{A:n,B:r,C:i,D:o,E:s,F:a,G:c,H:l}=this;for(let u=0;u<64;u++){const e=l+(rI(s,6)^rI(s,11)^rI(s,25))+LI(s,a,c)+qI[u]+HI[u]|0,t=(rI(n,2)^rI(n,13)^rI(n,22))+DI(n,r,i)|0;l=c,c=a,a=s,s=o+e|0,o=i,i=r,r=n,n=e+t|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(n,r,i,o,s,a,c,l)}roundClean(){tI(HI)}destroy(){this.set(0,0,0,0,0,0,0,0),tI(this.buffer)}}const KI=Px(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((e=>BigInt(e)))),WI=KI[0],GI=KI[1],YI=new Uint32Array(80),ZI=new Uint32Array(80);class XI extends jI{constructor(){super(128,arguments.length>0&&void 0!==arguments[0]?arguments[0]:64,16,!1),this.Ah=0|zI[0],this.Al=0|zI[1],this.Bh=0|zI[2],this.Bl=0|zI[3],this.Ch=0|zI[4],this.Cl=0|zI[5],this.Dh=0|zI[6],this.Dl=0|zI[7],this.Eh=0|zI[8],this.El=0|zI[9],this.Fh=0|zI[10],this.Fl=0|zI[11],this.Gh=0|zI[12],this.Gl=0|zI[13],this.Hh=0|zI[14],this.Hl=0|zI[15]}get(){const{Ah:e,Al:t,Bh:n,Bl:r,Ch:i,Cl:o,Dh:s,Dl:a,Eh:c,El:l,Fh:u,Fl:d,Gh:f,Gl:h,Hh:p,Hl:g}=this;return[e,t,n,r,i,o,s,a,c,l,u,d,f,h,p,g]}set(e,t,n,r,i,o,s,a,c,l,u,d,f,h,p,g){this.Ah=0|e,this.Al=0|t,this.Bh=0|n,this.Bl=0|r,this.Ch=0|i,this.Cl=0|o,this.Dh=0|s,this.Dl=0|a,this.Eh=0|c,this.El=0|l,this.Fh=0|u,this.Fl=0|d,this.Gh=0|f,this.Gl=0|h,this.Hh=0|p,this.Hl=0|g}process(e,t){for(let v=0;v<16;v++,t+=4)YI[v]=e.getUint32(t),ZI[v]=e.getUint32(t+=4);for(let v=16;v<80;v++){const e=0|YI[v-15],t=0|ZI[v-15],n=Ux(e,t,1)^Ux(e,t,8)^Cx(e,0,7),r=Bx(e,t,1)^Bx(e,t,8)^Nx(e,t,7),i=0|YI[v-2],o=0|ZI[v-2],s=Ux(i,o,19)^Lx(i,o,61)^Cx(i,0,6),a=Bx(i,o,19)^Dx(i,o,61)^Nx(i,o,6),c=Hx(r,a,ZI[v-7],ZI[v-16]),l=Vx(c,n,s,YI[v-7],YI[v-16]);YI[v]=0|l,ZI[v]=0|c}let{Ah:n,Al:r,Bh:i,Bl:o,Ch:s,Cl:a,Dh:c,Dl:l,Eh:u,El:d,Fh:f,Fl:h,Gh:p,Gl:g,Hh:y,Hl:m}=this;for(let v=0;v<80;v++){const e=Ux(u,d,14)^Ux(u,d,18)^Lx(u,d,41),t=Bx(u,d,14)^Bx(u,d,18)^Dx(u,d,41),b=u&f^~u&p,w=Kx(m,t,d&h^~d&g,GI[v],ZI[v]),E=Wx(w,y,e,b,WI[v],YI[v]),_=0|w,S=Ux(n,r,28)^Lx(n,r,34)^Lx(n,r,39),x=Bx(n,r,28)^Dx(n,r,34)^Dx(n,r,39),I=n&i^n&s^i&s,O=r&o^r&a^o&a;y=0|p,m=0|g,p=0|f,g=0|h,f=0|u,h=0|d,({h:u,l:d}=Fx(0|c,0|l,0|E,0|_)),c=0|s,l=0|a,s=0|i,a=0|o,i=0|n,o=0|r;const A=zx(_,x,O);n=qx(A,E,S,I),r=0|A}({h:n,l:r}=Fx(0|this.Ah,0|this.Al,0|n,0|r)),({h:i,l:o}=Fx(0|this.Bh,0|this.Bl,0|i,0|o)),({h:s,l:a}=Fx(0|this.Ch,0|this.Cl,0|s,0|a)),({h:c,l:l}=Fx(0|this.Dh,0|this.Dl,0|c,0|l)),({h:u,l:d}=Fx(0|this.Eh,0|this.El,0|u,0|d)),({h:f,l:h}=Fx(0|this.Fh,0|this.Fl,0|f,0|h)),({h:p,l:g}=Fx(0|this.Gh,0|this.Gl,0|p,0|g)),({h:y,l:m}=Fx(0|this.Hh,0|this.Hl,0|y,0|m)),this.set(n,r,i,o,s,a,c,l,u,d,f,h,p,g,y,m)}roundClean(){tI(YI,ZI)}destroy(){tI(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class QI extends XI{constructor(){super(48),this.Ah=0|FI[0],this.Al=0|FI[1],this.Bh=0|FI[2],this.Bl=0|FI[3],this.Ch=0|FI[4],this.Cl=0|FI[5],this.Dh=0|FI[6],this.Dl=0|FI[7],this.Eh=0|FI[8],this.El=0|FI[9],this.Fh=0|FI[10],this.Fl=0|FI[11],this.Gh=0|FI[12],this.Gl=0|FI[13],this.Hh=0|FI[14],this.Hl=0|FI[15]}}const JI=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class $I extends XI{constructor(){super(32),this.Ah=0|JI[0],this.Al=0|JI[1],this.Bh=0|JI[2],this.Bl=0|JI[3],this.Ch=0|JI[4],this.Cl=0|JI[5],this.Dh=0|JI[6],this.Dl=0|JI[7],this.Eh=0|JI[8],this.El=0|JI[9],this.Fh=0|JI[10],this.Fl=0|JI[11],this.Gh=0|JI[12],this.Gl=0|JI[13],this.Hh=0|JI[14],this.Hl=0|JI[15]}}const eO=vI((()=>new VI)),tO=vI((()=>new XI)),nO=vI((()=>new QI)),rO=vI((()=>new $I)),iO=Uint8Array.from([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9]),oO=Uint32Array.from([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),sO=new Uint32Array(32);function aO(e,t,n,r,i,o){const s=i[o],a=i[o+1];let c=sO[2*e],l=sO[2*e+1],u=sO[2*t],d=sO[2*t+1],f=sO[2*n],h=sO[2*n+1],p=sO[2*r],g=sO[2*r+1],y=zx(c,u,s);l=qx(y,l,d,a),c=0|y,({Dh:g,Dl:p}={Dh:g^l,Dl:p^c}),({Dh:g,Dl:p}={Dh:jx(0,p),Dl:Mx(g)}),({h:h,l:f}=Fx(h,f,g,p)),({Bh:d,Bl:u}={Bh:d^h,Bl:u^f}),({Bh:d,Bl:u}={Bh:Ux(d,u,24),Bl:Bx(d,u,24)}),sO[2*e]=c,sO[2*e+1]=l,sO[2*t]=u,sO[2*t+1]=d,sO[2*n]=f,sO[2*n+1]=h,sO[2*r]=p,sO[2*r+1]=g}function cO(e,t,n,r,i,o){const s=i[o],a=i[o+1];let c=sO[2*e],l=sO[2*e+1],u=sO[2*t],d=sO[2*t+1],f=sO[2*n],h=sO[2*n+1],p=sO[2*r],g=sO[2*r+1],y=zx(c,u,s);l=qx(y,l,d,a),c=0|y,({Dh:g,Dl:p}={Dh:g^l,Dl:p^c}),({Dh:g,Dl:p}={Dh:Ux(g,p,16),Dl:Bx(g,p,16)}),({h:h,l:f}=Fx(h,f,g,p)),({Bh:d,Bl:u}={Bh:d^h,Bl:u^f}),({Bh:d,Bl:u}={Bh:Lx(d,u,63),Bl:Dx(d,u,63)}),sO[2*e]=c,sO[2*e+1]=l,sO[2*t]=u,sO[2*t+1]=d,sO[2*n]=f,sO[2*n+1]=h,sO[2*r]=p,sO[2*r+1]=g}class lO extends mI{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,this.length=0,this.pos=0,Zx(e),Zx(t),this.blockLen=e,this.outputLen=t,this.buffer=new Uint8Array(e),this.buffer32=eI(this.buffer)}update(e){Jx(this),Xx(e=gI(e));const{blockLen:t,buffer:n,buffer32:r}=this,i=e.length,o=e.byteOffset,s=e.buffer;for(let a=0;a<i;){this.pos===t&&(aI(r),this.compress(r,0,!1),aI(r),this.pos=0);const c=Math.min(t-this.pos,i-a),l=o+a;if(c!==t||l%4||!(a+c<i))n.set(e.subarray(a,a+c),this.pos),this.pos+=c,this.length+=c,a+=c;else{const e=new Uint32Array(s,l,Math.floor((i-a)/4));aI(e);for(let n=0;a+t<i;n+=r.length,a+=t)this.length+=t,this.compress(e,n,!1);aI(e)}}return this}digestInto(e){Jx(this),$x(e,this);const{pos:t,buffer32:n}=this;this.finished=!0,tI(this.buffer.subarray(t)),aI(n),this.compress(n,0,!0),aI(n);const r=eI(e);this.get().forEach(((e,t)=>r[t]=sI(e)))}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){const{buffer:t,length:n,finished:r,destroyed:i,outputLen:o,pos:s}=this;return e||(e=new this.constructor({dkLen:o})),e.set(...this.get()),e.buffer.set(t),e.destroyed=i,e.finished=r,e.length=n,e.pos=s,e.outputLen=o,e}clone(){return this._cloneInto()}}class uO extends lO{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=void 0===e.dkLen?64:e.dkLen;super(128,t),this.v0l=0|oO[0],this.v0h=0|oO[1],this.v1l=0|oO[2],this.v1h=0|oO[3],this.v2l=0|oO[4],this.v2h=0|oO[5],this.v3l=0|oO[6],this.v3h=0|oO[7],this.v4l=0|oO[8],this.v4h=0|oO[9],this.v5l=0|oO[10],this.v5h=0|oO[11],this.v6l=0|oO[12],this.v6h=0|oO[13],this.v7l=0|oO[14],this.v7h=0|oO[15],function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0;if(Zx(n),e<0||e>n)throw new Error("outputLen bigger than keyLen");const{key:o,salt:s,personalization:a}=t;if(void 0!==o&&(o.length<1||o.length>n))throw new Error("key length must be undefined or 1.."+n);if(void 0!==s&&s.length!==r)throw new Error("salt must be undefined or "+r);if(void 0!==a&&a.length!==i)throw new Error("personalization must be undefined or "+i)}(t,e,64,16,16);let{key:n,personalization:r,salt:i}=e,o=0;if(void 0!==n&&(n=gI(n),o=n.length),this.v0l^=this.outputLen|o<<8|65536|1<<24,void 0!==i){i=gI(i);const e=eI(i);this.v4l^=sI(e[0]),this.v4h^=sI(e[1]),this.v5l^=sI(e[2]),this.v5h^=sI(e[3])}if(void 0!==r){r=gI(r);const e=eI(r);this.v6l^=sI(e[0]),this.v6h^=sI(e[1]),this.v7l^=sI(e[2]),this.v7h^=sI(e[3])}if(void 0!==n){const e=new Uint8Array(this.blockLen);e.set(n),this.update(e)}}get(){let{v0l:e,v0h:t,v1l:n,v1h:r,v2l:i,v2h:o,v3l:s,v3h:a,v4l:c,v4h:l,v5l:u,v5h:d,v6l:f,v6h:h,v7l:p,v7h:g}=this;return[e,t,n,r,i,o,s,a,c,l,u,d,f,h,p,g]}set(e,t,n,r,i,o,s,a,c,l,u,d,f,h,p,g){this.v0l=0|e,this.v0h=0|t,this.v1l=0|n,this.v1h=0|r,this.v2l=0|i,this.v2h=0|o,this.v3l=0|s,this.v3h=0|a,this.v4l=0|c,this.v4h=0|l,this.v5l=0|u,this.v5h=0|d,this.v6l=0|f,this.v6h=0|h,this.v7l=0|p,this.v7h=0|g}compress(e,t,n){this.get().forEach(((e,t)=>sO[t]=e)),sO.set(oO,16);let{h:r,l:i}=kx(BigInt(this.length));sO[24]=oO[8]^i,sO[25]=oO[9]^r,n&&(sO[28]=~sO[28],sO[29]=~sO[29]);let o=0;const s=iO;for(let a=0;a<12;a++)aO(0,4,8,12,e,t+2*s[o++]),cO(0,4,8,12,e,t+2*s[o++]),aO(1,5,9,13,e,t+2*s[o++]),cO(1,5,9,13,e,t+2*s[o++]),aO(2,6,10,14,e,t+2*s[o++]),cO(2,6,10,14,e,t+2*s[o++]),aO(3,7,11,15,e,t+2*s[o++]),cO(3,7,11,15,e,t+2*s[o++]),aO(0,5,10,15,e,t+2*s[o++]),cO(0,5,10,15,e,t+2*s[o++]),aO(1,6,11,12,e,t+2*s[o++]),cO(1,6,11,12,e,t+2*s[o++]),aO(2,7,8,13,e,t+2*s[o++]),cO(2,7,8,13,e,t+2*s[o++]),aO(3,4,9,14,e,t+2*s[o++]),cO(3,4,9,14,e,t+2*s[o++]);this.v0l^=sO[0]^sO[16],this.v0h^=sO[1]^sO[17],this.v1l^=sO[2]^sO[18],this.v1h^=sO[3]^sO[19],this.v2l^=sO[4]^sO[20],this.v2h^=sO[5]^sO[21],this.v3l^=sO[6]^sO[22],this.v3h^=sO[7]^sO[23],this.v4l^=sO[8]^sO[24],this.v4h^=sO[9]^sO[25],this.v5l^=sO[10]^sO[26],this.v5h^=sO[11]^sO[27],this.v6l^=sO[12]^sO[28],this.v6h^=sO[13]^sO[29],this.v7l^=sO[14]^sO[30],this.v7h^=sO[15]^sO[31],tI(sO)}destroy(){this.destroyed=!0,tI(this.buffer32),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const dO=function(e){const t=(t,n)=>e(n).update(gI(t)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t}((e=>new uO(e))),fO="https://rpc.walletconnect.org/v1";function hO(e){const t="\x19Ethereum Signed Message:\n".concat(e.length),n=(new TextEncoder).encode(t+e);return"0x"+Buffer.from(BI(n)).toString("hex")}async function pO(e,t,n,r,i,o){switch(n.t){case"eip191":return await function(e,t,n){const r=Km(n);return Jw({payload:hO(t),signature:r}).toLowerCase()===e.toLowerCase()}(e,t,n.s);case"eip1271":return await async function(e,t,n,r,i,o){const s=qS(r);if(!s.namespace||!s.reference)throw new Error("isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ".concat(r));try{const s="0x1626ba7e",a="0000000000000000000000000000000000000000000000000000000000000040",c=n.substring(2),l=(c.length/2).toString(16).padStart(64,"0"),u=s+(t.startsWith("0x")?t:hO(t)).substring(2)+a+l+c,d=await fetch("".concat(o||fO,"/?chainId=").concat(r,"&projectId=").concat(i),{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify({id:gO(),jsonrpc:"2.0",method:"eth_call",params:[{to:e,data:u},"latest"]})}),{result:f}=await d.json();return!!f&&f.slice(0,s.length).toLowerCase()===s.toLowerCase()}catch(Ge){return console.error("isValidEip1271Signature: ",Ge),!1}}(e,t,n.s,r,i,o);default:throw new Error("verifySignature failed: Attempted to verify CacaoSignature with unknown type: ".concat(n.t))}}function gO(){return Date.now()+Math.floor(1e3*Math.random())}function yO(e){const t=new Uint8Array(Buffer.from(e,"base64")),n=Array.from("TransactionData::").map((e=>e.charCodeAt(0))),r=new Uint8Array(n.length+t.length);r.set(n),r.set(t,n.length);const i=dO(r,{dkLen:32});return eE.encode(i)}function mO(e){const t=new Uint8Array(eO(function(e){if(e instanceof Uint8Array)return e;if(Array.isArray(e))return new Uint8Array(e);if("object"==typeof e&&null!=e&&e.data)return new Uint8Array(Object.values(e.data));if("object"==typeof e&&e)return new Uint8Array(Object.values(e));throw new Error("getNearUint8ArrayFromBytes: Unexpected result type from bytes array")}(e)));return eE.encode(t)}function vO(e){const t=function(e,t){return new AE(t).decode(e)}(Buffer.from(e,"base64")).txn;if(!t)throw new Error("Invalid signed transaction: missing 'txn' field");const n=(s=t,new TE(a).encodeSharedRef(s)),r=Buffer.from("TX"),i=Buffer.concat([r,Buffer.from(n)]),o=rO(i);var s,a;return QE.encode(o).replace(/=+$/,"")}function bO(e){const t=[];let n=BigInt(e);for(;n>=BigInt(128);)t.push(Number(n&BigInt(127)|BigInt(128))),n>>=BigInt(7);return t.push(Number(n)),Buffer.from(t)}function wO(e){const t=Buffer.from(e.signed.bodyBytes,"base64"),n=Buffer.from(e.signed.authInfoBytes,"base64"),r=Buffer.from(e.signature.signature,"base64"),i=[];i.push(Buffer.from([10])),i.push(bO(t.length)),i.push(t),i.push(Buffer.from([18])),i.push(bO(n.length)),i.push(n),i.push(Buffer.from([26])),i.push(bO(r.length)),i.push(r);const o=Buffer.concat(i),s=eO(o);return Buffer.from(s).toString("hex").toUpperCase()}var EO=Object.defineProperty,_O=Object.defineProperties,SO=Object.getOwnPropertyDescriptors,xO=Object.getOwnPropertySymbols,IO=Object.prototype.hasOwnProperty,OO=Object.prototype.propertyIsEnumerable,AO=(e,t,n)=>t in e?EO(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,TO=(e,t)=>{for(var n in t||(t={}))IO.call(t,n)&&AO(e,n,t[n]);if(xO)for(var n of xO(t))OO.call(t,n)&&AO(e,n,t[n]);return e},RO=(e,t)=>_O(e,SO(t));const kO="did:pkh:",PO={eip155:"Ethereum",solana:"Solana",bip122:"Bitcoin"},CO=e=>null===e||void 0===e?void 0:e.split(":"),NO=e=>{const t=e&&CO(e);if(t)return t[2]+":"+t[3]},UO=e=>{const t=e&&CO(e);if(t)return t.pop()};async function BO(e){const{cacao:t,projectId:n}=e,{s:r,p:i}=t,o=LO(i,i.iss),s=UO(i.iss);return await pO(s,o,r,NO(i.iss),n)}const LO=(e,t)=>{const n=(e=>{const t=e&&CO(e);if(t)return e.includes(kO)?t[2]:t[0]})(t);if(!n)throw new Error("Invalid issuer: "+t);const r="".concat(e.domain," wants you to sign in with your ").concat((e=>e?PO[e]||e:"")(n)," account:"),i=UO(t);if(!e.aud&&!e.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let o=e.statement||void 0;const s="URI: ".concat(e.aud||e.uri),a="Version: ".concat(e.version),c="Chain ID: ".concat((e=>{const t=e&&CO(e);if(t)return e.includes(kO)?t[3]:t[1]})(t)),l="Nonce: ".concat(e.nonce),u="Issued At: ".concat(e.iat),d=e.exp?"Expiration Time: ".concat(e.exp):void 0,f=e.nbf?"Not Before: ".concat(e.nbf):void 0,h=e.requestId?"Request ID: ".concat(e.requestId):void 0,p=e.resources?"Resources:".concat(e.resources.map((e=>"\n- ".concat(e))).join("")):void 0,g=GO(e.resources);if(g){o=VO(o,FO(g))}return[r,i,"",o,"",s,a,c,l,u,d,f,h,p].filter((e=>null!=e)).join("\n")};function DO(e){if(!e)throw new Error("No recap provided, value is undefined");if(!e.att)throw new Error("No `att` property found");const t=Object.keys(e.att);if(null==t||!t.length)throw new Error("No resources found in `att` property");t.forEach((t=>{const n=e.att[t];if(Array.isArray(n))throw new Error("Resource must be an object: ".concat(t));if("object"!=typeof n)throw new Error("Resource must be an object: ".concat(t));if(!Object.keys(n).length)throw new Error("Resource object is empty: ".concat(t));Object.keys(n).forEach((e=>{const t=n[e];if(!Array.isArray(t))throw new Error("Ability limits ".concat(e," must be an array of objects, found: ").concat(t));if(!t.length)throw new Error("Value of ".concat(e," is empty array, must be an array with objects"));t.forEach((t=>{if("object"!=typeof t)throw new Error("Ability limits (".concat(e,") must be an array of objects, found: ").concat(t))}))}))}))}function jO(e,t){var n;let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t=null===(n=t)||void 0===n?void 0:n.sort(((e,t)=>e.localeCompare(t)));const i=t.map((t=>({["".concat(e,"/").concat(t)]:[r]})));return Object.assign({},...i)}function MO(e){return DO(e),"urn:recap:".concat(function(e){return Buffer.from(JSON.stringify(e)).toString("base64")}(e).replace(/=/g,""))}function FO(e){const t=function(e){return JSON.parse(Buffer.from(e,"base64").toString("utf-8"))}(e.replace("urn:recap:",""));return DO(t),t}function zO(e,t,n){const r=function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return null!==n&&void 0!==n&&n.sort(((e,t)=>e.localeCompare(t))),{att:{[e]:jO(t,n,r)}}}(e,t,n);return MO(r)}function qO(e){return e&&e.includes("urn:recap:")}function HO(e,t){const n=function(e,t){DO(e),DO(t);const n=Object.keys(e.att).concat(Object.keys(t.att)).sort(((e,t)=>e.localeCompare(t))),r={att:{}};return n.forEach((n=>{var i,o;Object.keys((null==(i=e.att)?void 0:i[n])||{}).concat(Object.keys((null==(o=t.att)?void 0:o[n])||{})).sort(((e,t)=>e.localeCompare(t))).forEach((i=>{var o,s;r.att[n]=RO(TO({},r.att[n]),{[i]:(null==(o=e.att[n])?void 0:o[i])||(null==(s=t.att[n])?void 0:s[i])})}))})),r}(FO(e),FO(t));return MO(n)}function VO(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;DO(t);const n="I further authorize the stated URI to perform the following actions on my behalf: ";if(e.includes(n))return e;const r=[];let i=0;Object.keys(t.att).forEach((e=>{const n=Object.keys(t.att[e]).map((e=>({ability:e.split("/")[0],action:e.split("/")[1]})));n.sort(((e,t)=>e.action.localeCompare(t.action)));const o={};n.forEach((e=>{o[e.ability]||(o[e.ability]=[]),o[e.ability].push(e.action)}));const s=Object.keys(o).map((t=>(i++,"(".concat(i,") '").concat(t,"': '").concat(o[t].join("', '"),"' for '").concat(e,"'."))));r.push(s.join(", ").replace(".,","."))}));const o=r.join(" "),s="".concat(n).concat(o);return"".concat(e?e+" ":"").concat(s)}function KO(e){var t;const n=FO(e);DO(n);const r=null==(t=n.att)?void 0:t.eip155;return r?Object.keys(r).map((e=>e.split("/")[1])):[]}function WO(e){const t=FO(e);DO(t);const n=[];return Object.values(t.att).forEach((e=>{Object.values(e).forEach((e=>{var t;null!=(t=null===e||void 0===e?void 0:e[0])&&t.chains&&n.push(e[0].chains)}))})),[...new Set(n.flat())]}function GO(e){if(!e)return;const t=null===e||void 0===e?void 0:e[e.length-1];return qO(t)?t:void 0}function YO(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function ZO(e){if("boolean"!=typeof e)throw new Error("boolean expected, not ".concat(e))}function XO(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function QO(e){if(!YO(e))throw new Error("Uint8Array expected");for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if(n.length>0&&!n.includes(e.length))throw new Error("Uint8Array expected of length "+n+", got length="+e.length)}function JO(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function $O(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function eA(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];for(let r=0;r<t.length;r++)t[r].fill(0)}const tA=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0];function nA(e){if("string"==typeof e)e=function(e){if("string"!=typeof e)throw new Error("string expected");return new Uint8Array((new TextEncoder).encode(e))}(e);else{if(!YO(e))throw new Error("Uint8Array expected, got "+typeof e);e=sA(e)}return e}function rA(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(void 0===t)return new Uint8Array(e);if(t.length!==e)throw new Error("invalid output length, expected "+e+", got: "+t.length);if(n&&!function(e){return e.byteOffset%4===0}(t))throw new Error("invalid output, must be aligned");return t}function iA(e,t,n,r){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,n,r);const i=BigInt(32),o=BigInt(4294967295),s=Number(n>>i&o),a=Number(n&o),c=r?4:0,l=r?0:4;e.setUint32(t+c,s,r),e.setUint32(t+l,a,r)}function oA(e,t,n){ZO(n);const r=new Uint8Array(16),i=function(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}(r);return iA(i,0,BigInt(t),n),iA(i,8,BigInt(e),n),r}function sA(e){return Uint8Array.from(e)}const aA=e=>Uint8Array.from(e.split("").map((e=>e.charCodeAt(0)))),cA=aA("expand 16-byte k"),lA=aA("expand 32-byte k"),uA=$O(cA),dA=$O(lA);function fA(e,t){return e<<t|e>>>32-t}function hA(e){return e.byteOffset%4===0}const pA=64,gA=16,yA=2**32-1,mA=new Uint32Array;const vA=(e,t)=>255&e[t++]|(255&e[t++])<<8;class bA{constructor(e){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,QO(e=nA(e),32);const t=vA(e,0),n=vA(e,2),r=vA(e,4),i=vA(e,6),o=vA(e,8),s=vA(e,10),a=vA(e,12),c=vA(e,14);this.r[0]=8191&t,this.r[1]=8191&(t>>>13|n<<3),this.r[2]=7939&(n>>>10|r<<6),this.r[3]=8191&(r>>>7|i<<9),this.r[4]=255&(i>>>4|o<<12),this.r[5]=o>>>1&8190,this.r[6]=8191&(o>>>14|s<<2),this.r[7]=8065&(s>>>11|a<<5),this.r[8]=8191&(a>>>8|c<<8),this.r[9]=c>>>5&127;for(let l=0;l<8;l++)this.pad[l]=vA(e,16+2*l)}process(e,t){const n=arguments.length>2&&void 0!==arguments[2]&&arguments[2]?0:2048,{h:r,r:i}=this,o=i[0],s=i[1],a=i[2],c=i[3],l=i[4],u=i[5],d=i[6],f=i[7],h=i[8],p=i[9],g=vA(e,t+0),y=vA(e,t+2),m=vA(e,t+4),v=vA(e,t+6),b=vA(e,t+8),w=vA(e,t+10),E=vA(e,t+12),_=vA(e,t+14);let S=r[0]+(8191&g),x=r[1]+(8191&(g>>>13|y<<3)),I=r[2]+(8191&(y>>>10|m<<6)),O=r[3]+(8191&(m>>>7|v<<9)),A=r[4]+(8191&(v>>>4|b<<12)),T=r[5]+(b>>>1&8191),R=r[6]+(8191&(b>>>14|w<<2)),k=r[7]+(8191&(w>>>11|E<<5)),P=r[8]+(8191&(E>>>8|_<<8)),C=r[9]+(_>>>5|n),N=0,U=N+S*o+x*(5*p)+I*(5*h)+O*(5*f)+A*(5*d);N=U>>>13,U&=8191,U+=T*(5*u)+R*(5*l)+k*(5*c)+P*(5*a)+C*(5*s),N+=U>>>13,U&=8191;let B=N+S*s+x*o+I*(5*p)+O*(5*h)+A*(5*f);N=B>>>13,B&=8191,B+=T*(5*d)+R*(5*u)+k*(5*l)+P*(5*c)+C*(5*a),N+=B>>>13,B&=8191;let L=N+S*a+x*s+I*o+O*(5*p)+A*(5*h);N=L>>>13,L&=8191,L+=T*(5*f)+R*(5*d)+k*(5*u)+P*(5*l)+C*(5*c),N+=L>>>13,L&=8191;let D=N+S*c+x*a+I*s+O*o+A*(5*p);N=D>>>13,D&=8191,D+=T*(5*h)+R*(5*f)+k*(5*d)+P*(5*u)+C*(5*l),N+=D>>>13,D&=8191;let j=N+S*l+x*c+I*a+O*s+A*o;N=j>>>13,j&=8191,j+=T*(5*p)+R*(5*h)+k*(5*f)+P*(5*d)+C*(5*u),N+=j>>>13,j&=8191;let M=N+S*u+x*l+I*c+O*a+A*s;N=M>>>13,M&=8191,M+=T*o+R*(5*p)+k*(5*h)+P*(5*f)+C*(5*d),N+=M>>>13,M&=8191;let F=N+S*d+x*u+I*l+O*c+A*a;N=F>>>13,F&=8191,F+=T*s+R*o+k*(5*p)+P*(5*h)+C*(5*f),N+=F>>>13,F&=8191;let z=N+S*f+x*d+I*u+O*l+A*c;N=z>>>13,z&=8191,z+=T*a+R*s+k*o+P*(5*p)+C*(5*h),N+=z>>>13,z&=8191;let q=N+S*h+x*f+I*d+O*u+A*l;N=q>>>13,q&=8191,q+=T*c+R*a+k*s+P*o+C*(5*p),N+=q>>>13,q&=8191;let H=N+S*p+x*h+I*f+O*d+A*u;N=H>>>13,H&=8191,H+=T*l+R*c+k*a+P*s+C*o,N+=H>>>13,H&=8191,N=(N<<2)+N|0,N=N+U|0,U=8191&N,N>>>=13,B+=N,r[0]=U,r[1]=B,r[2]=L,r[3]=D,r[4]=j,r[5]=M,r[6]=F,r[7]=z,r[8]=q,r[9]=H}finalize(){const{h:e,pad:t}=this,n=new Uint16Array(10);let r=e[1]>>>13;e[1]&=8191;for(let s=2;s<10;s++)e[s]+=r,r=e[s]>>>13,e[s]&=8191;e[0]+=5*r,r=e[0]>>>13,e[0]&=8191,e[1]+=r,r=e[1]>>>13,e[1]&=8191,e[2]+=r,n[0]=e[0]+5,r=n[0]>>>13,n[0]&=8191;for(let s=1;s<10;s++)n[s]=e[s]+r,r=n[s]>>>13,n[s]&=8191;n[9]-=8192;let i=(1^r)-1;for(let s=0;s<10;s++)n[s]&=i;i=~i;for(let s=0;s<10;s++)e[s]=e[s]&i|n[s];e[0]=65535&(e[0]|e[1]<<13),e[1]=65535&(e[1]>>>3|e[2]<<10),e[2]=65535&(e[2]>>>6|e[3]<<7),e[3]=65535&(e[3]>>>9|e[4]<<4),e[4]=65535&(e[4]>>>12|e[5]<<1|e[6]<<14),e[5]=65535&(e[6]>>>2|e[7]<<11),e[6]=65535&(e[7]>>>5|e[8]<<8),e[7]=65535&(e[8]>>>8|e[9]<<5);let o=e[0]+t[0];e[0]=65535&o;for(let s=1;s<8;s++)o=(e[s]+t[s]|0)+(o>>>16)|0,e[s]=65535&o;eA(n)}update(e){JO(this),QO(e=nA(e));const{buffer:t,blockLen:n}=this,r=e.length;for(let i=0;i<r;){const o=Math.min(n-this.pos,r-i);if(o!==n)t.set(e.subarray(i,i+o),this.pos),this.pos+=o,i+=o,this.pos===n&&(this.process(t,0,!1),this.pos=0);else for(;n<=r-i;i+=n)this.process(e,i)}return this}destroy(){eA(this.h,this.r,this.buffer,this.pad)}digestInto(e){JO(this),function(e,t){QO(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}(e,this),this.finished=!0;const{buffer:t,h:n}=this;let{pos:r}=this;if(r){for(t[r++]=1;r<16;r++)t[r]=0;this.process(t,0,!0)}this.finalize();let i=0;for(let o=0;o<8;o++)e[i++]=n[o]>>>0,e[i++]=n[o]>>>8;return e}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const n=e.slice(0,t);return this.destroy(),n}}const wA=function(e){const t=(t,n)=>e(n).update(nA(t)).digest(),n=e(new Uint8Array(32));return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t}((e=>new bA(e)));const EA=function(e,t){const{allowShortKeys:n,extendNonceFn:r,counterLength:i,counterRight:o,rounds:s}=function(e,t){if(null==t||"object"!=typeof t)throw new Error("options must be defined");return Object.assign(e,t)}({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if("function"!=typeof e)throw new Error("core must be a function");return XO(i),XO(s),ZO(o),ZO(n),function(t,a,c,l){let u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;QO(t),QO(a),QO(c);const d=c.length;if(void 0===l&&(l=new Uint8Array(d)),QO(l),XO(u),u<0||u>=yA)throw new Error("arx: counter overflow");if(l.length<d)throw new Error("arx: output (".concat(l.length,") is shorter than data (").concat(d,")"));const f=[];let h,p,g=t.length;if(32===g)f.push(h=sA(t)),p=dA;else{if(16!==g||!n)throw new Error("arx: invalid 32-byte key, got length=".concat(g));h=new Uint8Array(32),h.set(t),h.set(t,16),p=uA,f.push(h)}hA(a)||f.push(a=sA(a));const y=$O(h);if(r){if(24!==a.length)throw new Error("arx: extended nonce must be 24 bytes");r(p,y,$O(a.subarray(0,16)),y),a=a.subarray(16)}const m=16-i;if(m!==a.length)throw new Error("arx: nonce must be ".concat(m," or 16 bytes"));if(12!==m){const e=new Uint8Array(12);e.set(a,o?0:12-a.length),a=e,f.push(a)}const v=$O(a);return function(e,t,n,r,i,o,s,a){const c=i.length,l=new Uint8Array(pA),u=$O(l),d=hA(i)&&hA(o),f=d?$O(i):mA,h=d?$O(o):mA;for(let p=0;p<c;s++){if(e(t,n,r,u,s,a),s>=yA)throw new Error("arx: counter overflow");const g=Math.min(pA,c-p);if(d&&g===pA){const e=p/4;if(p%4!==0)throw new Error("arx: invalid block position");for(let t,n=0;n<gA;n++)t=e+n,h[t]=f[t]^u[n];p+=pA}else{for(let e,t=0;t<g;t++)e=p+t,o[e]=i[e]^l[t];p+=g}}}(e,p,y,v,c,l,u,s),eA(...f),l}}((function(e,t,n,r,i){let o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:20,s=e[0],a=e[1],c=e[2],l=e[3],u=t[0],d=t[1],f=t[2],h=t[3],p=t[4],g=t[5],y=t[6],m=t[7],v=i,b=n[0],w=n[1],E=n[2],_=s,S=a,x=c,I=l,O=u,A=d,T=f,R=h,k=p,P=g,C=y,N=m,U=v,B=b,L=w,D=E;for(let M=0;M<o;M+=2)_=_+O|0,U=fA(U^_,16),k=k+U|0,O=fA(O^k,12),_=_+O|0,U=fA(U^_,8),k=k+U|0,O=fA(O^k,7),S=S+A|0,B=fA(B^S,16),P=P+B|0,A=fA(A^P,12),S=S+A|0,B=fA(B^S,8),P=P+B|0,A=fA(A^P,7),x=x+T|0,L=fA(L^x,16),C=C+L|0,T=fA(T^C,12),x=x+T|0,L=fA(L^x,8),C=C+L|0,T=fA(T^C,7),I=I+R|0,D=fA(D^I,16),N=N+D|0,R=fA(R^N,12),I=I+R|0,D=fA(D^I,8),N=N+D|0,R=fA(R^N,7),_=_+A|0,D=fA(D^_,16),C=C+D|0,A=fA(A^C,12),_=_+A|0,D=fA(D^_,8),C=C+D|0,A=fA(A^C,7),S=S+T|0,U=fA(U^S,16),N=N+U|0,T=fA(T^N,12),S=S+T|0,U=fA(U^S,8),N=N+U|0,T=fA(T^N,7),x=x+R|0,B=fA(B^x,16),k=k+B|0,R=fA(R^k,12),x=x+R|0,B=fA(B^x,8),k=k+B|0,R=fA(R^k,7),I=I+O|0,L=fA(L^I,16),P=P+L|0,O=fA(O^P,12),I=I+O|0,L=fA(L^I,8),P=P+L|0,O=fA(O^P,7);let j=0;r[j++]=s+_|0,r[j++]=a+S|0,r[j++]=c+x|0,r[j++]=l+I|0,r[j++]=u+O|0,r[j++]=d+A|0,r[j++]=f+T|0,r[j++]=h+R|0,r[j++]=p+k|0,r[j++]=g+P|0,r[j++]=y+C|0,r[j++]=m+N|0,r[j++]=v+U|0,r[j++]=b+B|0,r[j++]=w+L|0,r[j++]=E+D|0}),{counterRight:!1,counterLength:4,allowShortKeys:!1}),_A=new Uint8Array(16),SA=(e,t)=>{e.update(t);const n=t.length%16;n&&e.update(_A.subarray(n))},xA=new Uint8Array(32);function IA(e,t,n,r,i){const o=e(t,n,xA),s=wA.create(o);i&&SA(s,i),SA(s,r);const a=oA(r.length,i?i.length:0,!0);s.update(a);const c=s.digest();return eA(o,a),c}const OA=((e,t)=>{function n(n){if(QO(n),!tA)throw new Error("Non little-endian hardware is not yet supported");for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];if(void 0!==e.nonceLength){const t=i[0];if(!t)throw new Error("nonce / iv required");e.varSizeNonce?QO(t):QO(t,e.nonceLength)}const s=e.tagLength;s&&void 0!==i[1]&&QO(i[1]);const a=t(n,...i),c=(e,t)=>{if(void 0!==t){if(2!==e)throw new Error("cipher output not supported");QO(t)}};let l=!1;return{encrypt(e,t){if(l)throw new Error("cannot encrypt() twice with same key + nonce");return l=!0,QO(e),c(a.encrypt.length,t),a.encrypt(e,t)},decrypt(e,t){if(QO(e),s&&e.length<s)throw new Error("invalid ciphertext length: smaller than tagLength="+s);return c(a.decrypt.length,t),a.decrypt(e,t)}}}return Object.assign(n,e),n})({blockSize:64,nonceLength:12,tagLength:16},(e=>(t,n,r)=>({encrypt(i,o){const s=i.length;(o=rA(s+16,o,!1)).set(i);const a=o.subarray(0,-16);e(t,n,a,a,1);const c=IA(e,t,n,a,r);return o.set(c,s),eA(c),o},decrypt(i,o){o=rA(i.length-16,o,!1);const s=i.subarray(0,-16),a=i.subarray(-16),c=IA(e,t,n,s,r);if(!function(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return 0===n}(a,c))throw new Error("invalid tag");return o.set(i.subarray(0,-16)),e(t,n,o,o,1),eA(c),o}}))(EA));class AA extends mI{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,Qx(e);const n=gI(t);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,i=new Uint8Array(r);i.set(n.length>r?e.create().update(n).digest():n);for(let o=0;o<i.length;o++)i[o]^=54;this.iHash.update(i),this.oHash=e.create();for(let o=0;o<i.length;o++)i[o]^=106;this.oHash.update(i),tI(i)}update(e){return Jx(this),this.iHash.update(e),this}digestInto(e){Jx(this),Xx(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:n,finished:r,destroyed:i,blockLen:o,outputLen:s}=this;return e.finished=r,e.destroyed=i,e.blockLen=o,e.outputLen=s,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const TA=(e,t,n)=>new AA(e,t).update(n).digest();TA.create=(e,t)=>new AA(e,t);const RA=Uint8Array.from([0]),kA=Uint8Array.of();const PA=(e,t,n,r,i)=>function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:32;Qx(e),Zx(r);const i=e.outputLen;if(r>255*i)throw new Error("Length should be <= 255*HashLen");const o=Math.ceil(r/i);void 0===n&&(n=kA);const s=new Uint8Array(o*i),a=TA.create(e,t),c=a._cloneInto(),l=new Uint8Array(a.outputLen);for(let u=0;u<o;u++)RA[0]=u+1,c.update(0===u?kA:l).update(n).update(RA).digestInto(l),s.set(l,i*u),a._cloneInto(c);return a.destroy(),c.destroy(),tI(l,RA),s.slice(0,r)}(e,function(e,t,n){return Qx(e),void 0===n&&(n=new Uint8Array(e.outputLen)),TA(e,gI(n),gI(t))}(e,t,n),r,i),CA=eO,NA=BigInt(0),UA=BigInt(1);function BA(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if("boolean"!=typeof e){const n=t&&'"'.concat(t,'"');throw new Error(n+"expected boolean, got type="+typeof e)}return e}function LA(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";const r=Yx(e),i=null===e||void 0===e?void 0:e.length,o=void 0!==t;if(!r||o&&i!==t){const s=n&&'"'.concat(n,'" '),a=o?" of length ".concat(t):"",c=r?"length=".concat(i):"type=".concat(typeof e);throw new Error(s+"expected Uint8Array"+a+", got "+c)}return e}function DA(e){const t=e.toString(16);return 1&t.length?"0"+t:t}function jA(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);return""===e?NA:BigInt("0x"+e)}function MA(e){return jA(uI(e))}function FA(e){return Xx(e),jA(uI(Uint8Array.from(e).reverse()))}function zA(e,t){return hI(e.toString(16).padStart(2*t,"0"))}function qA(e,t){return zA(e,t).reverse()}function HA(e,t,n){let r;if("string"==typeof t)try{r=hI(t)}catch(We){throw new Error(e+" must be hex string or Uint8Array, cause: "+We)}else{if(!Yx(t))throw new Error(e+" must be hex string or Uint8Array");r=Uint8Array.from(t)}const i=r.length;if("number"==typeof n&&i!==n)throw new Error(e+" of length "+n+" expected, got "+i);return r}const VA=e=>"bigint"==typeof e&&NA<=e;function KA(e,t,n,r){if(!function(e,t,n){return VA(e)&&VA(t)&&VA(n)&&t<=e&&e<n}(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function WA(e){let t;for(t=0;e>NA;e>>=UA,t+=1);return t}const GA=e=>(UA<<BigInt(e))-UA;function YA(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!e||"object"!=typeof e)throw new Error("expected valid options object");function r(t,n,r){const i=e[t];if(r&&void 0===i)return;const o=typeof i;if(o!==n||null===i)throw new Error('param "'.concat(t,'" is invalid: expected ').concat(n,", got ").concat(o))}Object.entries(t).forEach((e=>{let[t,n]=e;return r(t,n,!1)})),Object.entries(n).forEach((e=>{let[t,n]=e;return r(t,n,!0)}))}function ZA(e){const t=new WeakMap;return function(n){const r=t.get(n);if(void 0!==r)return 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=e(n,...o);return t.set(n,a),a}}const XA=BigInt(0),QA=BigInt(1),JA=BigInt(2),$A=BigInt(3),eT=BigInt(4),tT=BigInt(5),nT=BigInt(7),rT=BigInt(8),iT=BigInt(9),oT=BigInt(16);function sT(e,t){const n=e%t;return n>=XA?n:t+n}function aT(e,t,n){let r=e;for(;t-- >XA;)r*=r,r%=n;return r}function cT(e,t){if(e===XA)throw new Error("invert: expected non-zero number");if(t<=XA)throw new Error("invert: expected positive modulus, got "+t);let n=sT(e,t),r=t,i=XA,o=QA;for(;n!==XA;){const e=r%n,t=i-o*(r/n);r=n,n=e,i=o,o=t}if(r!==QA)throw new Error("invert: does not exist");return sT(i,t)}function lT(e,t,n){if(!e.eql(e.sqr(t),n))throw new Error("Cannot find square root")}function uT(e,t){const n=(e.ORDER+QA)/eT,r=e.pow(t,n);return lT(e,r,t),r}function dT(e,t){const n=(e.ORDER-tT)/rT,r=e.mul(t,JA),i=e.pow(r,n),o=e.mul(t,i),s=e.mul(e.mul(o,JA),i),a=e.mul(o,e.sub(s,e.ONE));return lT(e,a,t),a}function fT(e){if(e<$A)throw new Error("sqrt is not defined for small field");let t=e-QA,n=0;for(;t%JA===XA;)t/=JA,n++;let r=JA;const i=vT(e);for(;1===yT(i,r);)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(1===n)return uT;let o=i.pow(r,t);const s=(t+QA)/JA;return function(e,r){if(e.is0(r))return r;if(1!==yT(e,r))throw new Error("Cannot find square root");let i=n,a=e.mul(e.ONE,o),c=e.pow(r,t),l=e.pow(r,s);for(;!e.eql(c,e.ONE);){if(e.is0(c))return e.ZERO;let t=1,n=e.sqr(c);for(;!e.eql(n,e.ONE);)if(t++,n=e.sqr(n),t===i)throw new Error("Cannot find square root");const r=QA<<BigInt(i-t-1),o=e.pow(a,r);i=t,a=e.sqr(o),c=e.mul(c,a),l=e.mul(l,o)}return l}}function hT(e){return e%eT===$A?uT:e%rT===tT?dT:e%oT===iT?function(e){const t=vT(e),n=fT(e),r=n(t,t.neg(t.ONE)),i=n(t,r),o=n(t,t.neg(r)),s=(e+nT)/oT;return(e,t)=>{let n=e.pow(t,s),a=e.mul(n,r);const c=e.mul(n,i),l=e.mul(n,o),u=e.eql(e.sqr(a),t),d=e.eql(e.sqr(c),t);n=e.cmov(n,a,u),a=e.cmov(l,c,d);const f=e.eql(e.sqr(a),t),h=e.cmov(n,a,f);return lT(e,h,t),h}}(e):fT(e)}const pT=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function gT(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=new Array(t.length).fill(n?e.ZERO:void 0),i=t.reduce(((t,n,i)=>e.is0(n)?t:(r[i]=t,e.mul(t,n))),e.ONE),o=e.inv(i);return t.reduceRight(((t,n,i)=>e.is0(n)?t:(r[i]=e.mul(t,r[i]),e.mul(t,n))),o),r}function yT(e,t){const n=(e.ORDER-QA)/JA,r=e.pow(t,n),i=e.eql(r,e.ONE),o=e.eql(r,e.ZERO),s=e.eql(r,e.neg(e.ONE));if(!i&&!o&&!s)throw new Error("invalid Legendre symbol result");return i?1:o?0:-1}function mT(e,t){void 0!==t&&Zx(t);const n=void 0!==t?t:e.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function vT(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(e<=XA)throw new Error("invalid field: expected ORDER > 0, got "+e);let i,o,s,a=!1;if("object"==typeof t&&null!=t){if(r.sqrt||n)throw new Error("cannot specify opts in two arguments");const e=t;e.BITS&&(i=e.BITS),e.sqrt&&(o=e.sqrt),"boolean"==typeof e.isLE&&(n=e.isLE),"boolean"==typeof e.modFromBytes&&(a=e.modFromBytes),s=e.allowedLengths}else"number"==typeof t&&(i=t),r.sqrt&&(o=r.sqrt);const{nBitLength:c,nByteLength:l}=mT(e,i);if(l>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let u;const d=Object.freeze({ORDER:e,isLE:n,BITS:c,BYTES:l,MASK:GA(c),ZERO:XA,ONE:QA,allowedLengths:s,create:t=>sT(t,e),isValid:t=>{if("bigint"!=typeof t)throw new Error("invalid field element: expected bigint, got "+typeof t);return XA<=t&&t<e},is0:e=>e===XA,isValidNot0:e=>!d.is0(e)&&d.isValid(e),isOdd:e=>(e&QA)===QA,neg:t=>sT(-t,e),eql:(e,t)=>e===t,sqr:t=>sT(t*t,e),add:(t,n)=>sT(t+n,e),sub:(t,n)=>sT(t-n,e),mul:(t,n)=>sT(t*n,e),pow:(e,t)=>function(e,t,n){if(n<XA)throw new Error("invalid exponent, negatives unsupported");if(n===XA)return e.ONE;if(n===QA)return t;let r=e.ONE,i=t;for(;n>XA;)n&QA&&(r=e.mul(r,i)),i=e.sqr(i),n>>=QA;return r}(d,e,t),div:(t,n)=>sT(t*cT(n,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>cT(t,e),sqrt:o||(t=>(u||(u=hT(e)),u(d,t))),toBytes:e=>n?qA(e,l):zA(e,l),fromBytes:function(t){let r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(s){if(!s.includes(t.length)||t.length>l)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+t.length);const e=new Uint8Array(l);e.set(t,n?0:e.length-t.length),t=e}if(t.length!==l)throw new Error("Field.fromBytes: expected "+l+" bytes, got "+t.length);let i=n?FA(t):MA(t);if(a&&(i=sT(i,e)),!r&&!d.isValid(i))throw new Error("invalid field element: outside of range 0..ORDER");return i},invertBatch:e=>gT(d,e),cmov:(e,t,n)=>n?t:e});return Object.freeze(d)}function bT(e){if("bigint"!=typeof e)throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function wT(e){const t=bT(e);return t+Math.ceil(t/2)}const ET=BigInt(0),_T=BigInt(1);function ST(e,t){const n=t.negate();return e?n:t}function xT(e,t){const n=gT(e.Fp,t.map((e=>e.Z)));return t.map(((t,r)=>e.fromAffine(t.toAffine(n[r]))))}function IT(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function OT(e,t){IT(e,t);const n=2**e;return{windows:Math.ceil(t/e)+1,windowSize:2**(e-1),mask:GA(e),maxNumber:n,shiftBy:BigInt(e)}}function AT(e,t,n){const{windowSize:r,mask:i,maxNumber:o,shiftBy:s}=n;let a=Number(e&i),c=e>>s;a>r&&(a-=o,c+=_T);const l=t*r;return{nextN:c,offset:l+Math.abs(a)-1,isZero:0===a,isNeg:a<0,isNegF:t%2!==0,offsetF:l}}const TT=new WeakMap,RT=new WeakMap;function kT(e){return RT.get(e)||1}function PT(e){if(e!==ET)throw new Error("invalid wNAF")}class CT{constructor(e,t){this.BASE=e.BASE,this.ZERO=e.ZERO,this.Fn=e.Fn,this.bits=t}_unsafeLadder(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.ZERO,r=e;for(;t>ET;)t&_T&&(n=n.add(r)),r=r.double(),t>>=_T;return n}precomputeWindow(e,t){const{windows:n,windowSize:r}=OT(t,this.bits),i=[];let o=e,s=o;for(let a=0;a<n;a++){s=o,i.push(s);for(let e=1;e<r;e++)s=s.add(o),i.push(s);o=s.double()}return i}wNAF(e,t,n){if(!this.Fn.isValid(n))throw new Error("invalid scalar");let r=this.ZERO,i=this.BASE;const o=OT(e,this.bits);for(let s=0;s<o.windows;s++){const{nextN:e,offset:a,isZero:c,isNeg:l,isNegF:u,offsetF:d}=AT(n,s,o);n=e,c?i=i.add(ST(u,t[d])):r=r.add(ST(l,t[a]))}return PT(n),{p:r,f:i}}wNAFUnsafe(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this.ZERO;const i=OT(e,this.bits);for(let o=0;o<i.windows&&n!==ET;o++){const{nextN:e,offset:s,isZero:a,isNeg:c}=AT(n,o,i);if(n=e,!a){const e=t[s];r=r.add(c?e.negate():e)}}return PT(n),r}getPrecomputes(e,t,n){let r=TT.get(t);return r||(r=this.precomputeWindow(t,e),1!==e&&("function"==typeof n&&(r=n(r)),TT.set(t,r))),r}cached(e,t,n){const r=kT(e);return this.wNAF(r,this.getPrecomputes(r,e,n),t)}unsafe(e,t,n,r){const i=kT(e);return 1===i?this._unsafeLadder(e,t,r):this.wNAFUnsafe(i,this.getPrecomputes(i,e,n),t,r)}createCache(e,t){IT(t,this.bits),RT.set(e,t),TT.delete(e)}hasCache(e){return 1!==kT(e)}}function NT(e,t,n,r){(function(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach(((e,n)=>{if(!(e instanceof t))throw new Error("invalid point at index "+n)}))})(n,e),function(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach(((e,n)=>{if(!t.isValid(e))throw new Error("invalid scalar at index "+n)}))}(r,t);const i=n.length,o=r.length;if(i!==o)throw new Error("arrays of points and scalars must have equal length");const s=e.ZERO,a=WA(BigInt(i));let c=1;a>12?c=a-3:a>4?c=a-2:a>0&&(c=2);const l=GA(c),u=new Array(Number(l)+1).fill(s);let d=s;for(let f=Math.floor((t.BITS-1)/c)*c;f>=0;f-=c){u.fill(s);for(let t=0;t<o;t++){const e=r[t],i=Number(e>>BigInt(f)&l);u[i]=u[i].add(n[t])}let e=s;for(let t=u.length-1,n=s;t>0;t--)n=n.add(u[t]),e=e.add(n);if(d=d.add(e),0!==f)for(let t=0;t<c;t++)d=d.double()}return d}function UT(e,t,n){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return function(e){const t=pT.reduce(((e,t)=>(e[t]="function",e)),{ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"});YA(e,t)}(t),t}return vT(e,{isLE:n})}BigInt(0),BigInt(1),BigInt(2),BigInt(8),pI("HashToScalar-");const BT=BigInt(0),LT=BigInt(1),DT=BigInt(2);function jT(e){const t=function(e){return YA(e,{adjustScalarBytes:"function",powPminus2:"function"}),Object.freeze({...e})}(e),{P:n,type:r,adjustScalarBytes:i,powPminus2:o,randomBytes:s}=t,a="x25519"===r;if(!a&&"x448"!==r)throw new Error("invalid type");const c=s||bI,l=a?255:448,u=a?32:56,d=BigInt(a?9:5),f=BigInt(a?121665:39081),h=a?DT**BigInt(254):DT**BigInt(447),p=a?BigInt(8)*DT**BigInt(251)-LT:BigInt(4)*DT**BigInt(445)-LT,g=h+p+LT,y=e=>sT(e,n),m=v(d);function v(e){return qA(y(e),u)}function b(e,t){const r=function(e,t){KA("u",e,BT,n),KA("scalar",t,h,g);const r=t,i=e;let s=LT,a=BT,c=e,u=LT,d=BT;for(let n=BigInt(l-1);n>=BT;n--){const e=r>>n<d^=e,({x_2:s,x_3:c}=E(d,s,c)),({x_2:a,x_3:u}=E(d,a,u)),d=e;const t=s+a,o=y(t*t),l=s-a,h=y(l*l),p=o-h,g=c+u,m=y((c-u)*t),v=y(g*l),b=m+v,w=m-v;c=y(b*b),u=y(i*y(w*w)),s=y(o*h),a=y(p*(o+y(f*p)))}({x_2:s,x_3:c}=E(d,s,c)),({x_2:a,x_3:u}=E(d,a,u));const p=o(a);return y(s*p)}(function(e){const t=HA("u coordinate",e,u);return a&&(t[31]&=127),y(FA(t))}(t),function(e){return FA(i(HA("scalar",e,u)))}(e));if(r===BT)throw new Error("invalid private or public key received");return v(r)}function w(e){return b(e,m)}function E(e,t,n){const r=y(e*(t-n));return{x_2:t=y(t-r),x_3:n=y(n+r)}}const _={secretKey:u,publicKey:u,seed:u},S=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c(u);return Xx(e,_.seed),e};return{keygen:function(e){const t=S(e);return{secretKey:t,publicKey:w(t)}},getSharedSecret:(e,t)=>b(e,t),getPublicKey:e=>w(e),scalarMult:b,scalarMultBase:w,utils:{randomSecretKey:S,randomPrivateKey:S},GuBytes:m.slice(),lengths:_}}const MT=BigInt(1),FT=BigInt(2),zT=BigInt(3),qT=BigInt(5),HT=BigInt(8),VT=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed");function KT(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}const WT=vT({p:VT,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:HT,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")}.p,{isLE:!0}),GT=(()=>{const e=WT.ORDER;return jT({P:e,type:"x25519",powPminus2:t=>{const{pow_p_5_8:n,b2:r}=function(e){const t=BigInt(10),n=BigInt(20),r=BigInt(40),i=BigInt(80),o=VT,s=e*e%o*e%o,a=aT(s,FT,o)*s%o,c=aT(a,MT,o)*e%o,l=aT(c,qT,o)*c%o,u=aT(l,t,o)*l%o,d=aT(u,n,o)*u%o,f=aT(d,r,o)*d%o,h=aT(f,i,o)*f%o,p=aT(h,i,o)*f%o,g=aT(p,t,o)*l%o;return{pow_p_5_8:aT(g,FT,o)*e%o,b2:s}}(t);return sT(aT(n,zT,e)*r,e)},adjustScalarBytes:KT})})(),YT=(e,t)=>(e+(e>=0?t:-t)/tR)/t;function ZT(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function XT(e,t){const n={};for(let r of Object.keys(t))n[r]=void 0===e[r]?t[r]:e[r];return BA(n.lowS,"lowS"),BA(n.prehash,"prehash"),void 0!==n.format&&ZT(n.format),n}class QT extends Error{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")}}const JT={Err:QT,_tlv:{encode:(e,t)=>{const{Err:n}=JT;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(1&t.length)throw new n("tlv.encode: unpadded data");const r=t.length/2,i=DA(r);if(i.length/2&128)throw new n("tlv.encode: long form length too big");const o=r>127?DA(i.length/2|128):"";return DA(e)+o+i+t},decode(e,t){const{Err:n}=JT;let r=0;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new n("tlv.decode: wrong tlv");const i=t[r++];let o=0;if(!!(128&i)){const e=127&i;if(!e)throw new n("tlv.decode(long): indefinite length not supported");if(e>4)throw new n("tlv.decode(long): byte length is too big");const s=t.subarray(r,r+e);if(s.length!==e)throw new n("tlv.decode: length bytes not complete");if(0===s[0])throw new n("tlv.decode(long): zero leftmost byte");for(const t of s)o=o<<8|t;if(r+=e,o<128)throw new n("tlv.decode(long): not minimal encoding")}else o=i;const s=t.subarray(r,r+o);if(s.length!==o)throw new n("tlv.decode: wrong value length");return{v:s,l:t.subarray(r+o)}}},_int:{encode(e){const{Err:t}=JT;if(e<$T)throw new t("integer: negative integers are not allowed");let n=DA(e);if(8&Number.parseInt(n[0],16)&&(n="00"+n),1&n.length)throw new t("unexpected DER parsing assertion: unpadded hex");return n},decode(e){const{Err:t}=JT;if(128&e[0])throw new t("invalid signature integer: negative");if(0===e[0]&&!(128&e[1]))throw new t("invalid signature integer: unnecessary leading zero");return MA(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=JT,i=HA("signature",e),{v:o,l:s}=r.decode(48,i);if(s.length)throw new t("invalid signature: left bytes after parsing");const{v:a,l:c}=r.decode(2,o),{v:l,l:u}=r.decode(2,c);if(u.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(a),s:n.decode(l)}},hexFromSig(e){const{_tlv:t,_int:n}=JT,r=t.encode(2,n.encode(e.r))+t.encode(2,n.encode(e.s));return t.encode(48,r)}},$T=BigInt(0),eR=BigInt(1),tR=BigInt(2),nR=BigInt(3),rR=BigInt(4);function iR(e,t){const{BYTES:n}=e;let r;if("bigint"==typeof t)r=t;else{let i=HA("private key",t);try{r=e.fromBytes(i)}catch{throw new Error("invalid private key: expected ui8a of size ".concat(n,", got ").concat(typeof t))}}if(!e.isValidNot0(r))throw new Error("invalid private key: out of range [1..N-1]");return r}function oR(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0;if(void 0===r&&(r="edwards"===e),!t||"object"!=typeof t)throw new Error("expected valid ".concat(e," CURVE object"));for(const a of["p","n","h"]){const e=t[a];if(!("bigint"==typeof e&&e>ET))throw new Error("CURVE.".concat(a," must be positive bigint"))}const i=UT(t.p,n.Fp,r),o=UT(t.n,n.Fn,r),s=["Gx","Gy","a","weierstrass"===e?"b":"d"];for(const a of s)if(!i.isValid(t[a]))throw new Error("CURVE.".concat(a," must be valid field element of CURVE.Fp"));return{CURVE:t=Object.freeze(Object.assign({},t)),Fp:i,Fn:o}}("weierstrass",e,t),{Fp:r,Fn:i}=n;let o=n.CURVE;const{h:s,n:a}=o;YA(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:c}=t;if(c&&(!r.is0(o.a)||"bigint"!=typeof c.beta||!Array.isArray(c.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const l=aR(r,i);function u(){if(!r.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}const d=t.toBytes||function(e,t,n){const{x:i,y:o}=t.toAffine(),s=r.toBytes(i);if(BA(n,"isCompressed"),n){u();return yI(sR(!r.isOdd(o)),s)}return yI(Uint8Array.of(4),s,r.toBytes(o))},f=t.fromBytes||function(e){LA(e,void 0,"Point");const{publicKey:t,publicKeyUncompressed:n}=l,i=e.length,o=e[0],s=e.subarray(1);if(i!==t||2!==o&&3!==o){if(i===n&&4===o){const e=r.BYTES,t=r.fromBytes(s.subarray(0,e)),n=r.fromBytes(s.subarray(e,2*e));if(!p(t,n))throw new Error("bad point: is not on curve");return{x:t,y:n}}throw new Error("bad point: got length ".concat(i,", expected compressed=").concat(t," or uncompressed=").concat(n))}{const e=r.fromBytes(s);if(!r.isValid(e))throw new Error("bad point: is not on curve, wrong x");const t=h(e);let n;try{n=r.sqrt(t)}catch(_t){const t=_t instanceof Error?": "+_t.message:"";throw new Error("bad point: is not on curve, sqrt error"+t)}u();return 1===(1&o)!==r.isOdd(n)&&(n=r.neg(n)),{x:e,y:n}}};function h(e){const t=r.sqr(e),n=r.mul(t,e);return r.add(r.add(n,r.mul(e,o.a)),o.b)}function p(e,t){const n=r.sqr(t),i=h(e);return r.eql(n,i)}if(!p(o.Gx,o.Gy))throw new Error("bad curve params: generator point");const g=r.mul(r.pow(o.a,nR),rR),y=r.mul(r.sqr(o.b),BigInt(27));if(r.is0(r.add(g,y)))throw new Error("bad curve params: a or b");function m(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!r.isValid(t)||n&&r.is0(t))throw new Error("bad point coordinate ".concat(e));return t}function v(e){if(!(e instanceof S))throw new Error("ProjectivePoint expected")}function b(e){if(!c||!c.basises)throw new Error("no endo");return function(e,t,n){const[[r,i],[o,s]]=t,a=YT(s*e,n),c=YT(-i*e,n);let l=e-a*r-c*o,u=-a*i-c*s;const d=l<$T,f=u<$T;d&&(l=-l),f&&(u=-u);const h=GA(Math.ceil(WA(n)/2))+eR;if(l<$T||l>=h||u<$T||u>=h)throw new Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:d,k1:l,k2neg:f,k2:u}}(e,c.basises,i.ORDER)}const w=ZA(((e,t)=>{const{X:n,Y:i,Z:o}=e;if(r.eql(o,r.ONE))return{x:n,y:i};const s=e.is0();null==t&&(t=s?r.ONE:r.inv(o));const a=r.mul(n,t),c=r.mul(i,t),l=r.mul(o,t);if(s)return{x:r.ZERO,y:r.ZERO};if(!r.eql(l,r.ONE))throw new Error("invZ was invalid");return{x:a,y:c}})),E=ZA((e=>{if(e.is0()){if(t.allowInfinityPoint&&!r.is0(e.Y))return;throw new Error("bad point: ZERO")}const{x:n,y:i}=e.toAffine();if(!r.isValid(n)||!r.isValid(i))throw new Error("bad point: x or y not field elements");if(!p(n,i))throw new Error("bad point: equation left != right");if(!e.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0}));function _(e,t,n,i,o){return n=new S(r.mul(n.X,e),n.Y,n.Z),t=ST(i,t),n=ST(o,n),t.add(n)}class S{constructor(e,t,n){this.X=m("x",e),this.Y=m("y",t,!0),this.Z=m("z",n),Object.freeze(this)}static CURVE(){return o}static fromAffine(e){const{x:t,y:n}=e||{};if(!e||!r.isValid(t)||!r.isValid(n))throw new Error("invalid affine point");if(e instanceof S)throw new Error("projective point not allowed");return r.is0(t)&&r.is0(n)?S.ZERO:new S(t,n,r.ONE)}static fromBytes(e){const t=S.fromAffine(f(LA(e,void 0,"point")));return t.assertValidity(),t}static fromHex(e){return S.fromBytes(HA("pointHex",e))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:8,t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return I.createCache(this,e),t||this.multiply(nR),this}assertValidity(){E(this)}hasEvenY(){const{y:e}=this.toAffine();if(!r.isOdd)throw new Error("Field doesn't support isOdd");return!r.isOdd(e)}equals(e){v(e);const{X:t,Y:n,Z:i}=this,{X:o,Y:s,Z:a}=e,c=r.eql(r.mul(t,a),r.mul(o,i)),l=r.eql(r.mul(n,a),r.mul(s,i));return c&&l}negate(){return new S(this.X,r.neg(this.Y),this.Z)}double(){const{a:e,b:t}=o,n=r.mul(t,nR),{X:i,Y:s,Z:a}=this;let c=r.ZERO,l=r.ZERO,u=r.ZERO,d=r.mul(i,i),f=r.mul(s,s),h=r.mul(a,a),p=r.mul(i,s);return p=r.add(p,p),u=r.mul(i,a),u=r.add(u,u),c=r.mul(e,u),l=r.mul(n,h),l=r.add(c,l),c=r.sub(f,l),l=r.add(f,l),l=r.mul(c,l),c=r.mul(p,c),u=r.mul(n,u),h=r.mul(e,h),p=r.sub(d,h),p=r.mul(e,p),p=r.add(p,u),u=r.add(d,d),d=r.add(u,d),d=r.add(d,h),d=r.mul(d,p),l=r.add(l,d),h=r.mul(s,a),h=r.add(h,h),d=r.mul(h,p),c=r.sub(c,d),u=r.mul(h,f),u=r.add(u,u),u=r.add(u,u),new S(c,l,u)}add(e){v(e);const{X:t,Y:n,Z:i}=this,{X:s,Y:a,Z:c}=e;let l=r.ZERO,u=r.ZERO,d=r.ZERO;const f=o.a,h=r.mul(o.b,nR);let p=r.mul(t,s),g=r.mul(n,a),y=r.mul(i,c),m=r.add(t,n),b=r.add(s,a);m=r.mul(m,b),b=r.add(p,g),m=r.sub(m,b),b=r.add(t,i);let w=r.add(s,c);return b=r.mul(b,w),w=r.add(p,y),b=r.sub(b,w),w=r.add(n,i),l=r.add(a,c),w=r.mul(w,l),l=r.add(g,y),w=r.sub(w,l),d=r.mul(f,b),l=r.mul(h,y),d=r.add(l,d),l=r.sub(g,d),d=r.add(g,d),u=r.mul(l,d),g=r.add(p,p),g=r.add(g,p),y=r.mul(f,y),b=r.mul(h,b),g=r.add(g,y),y=r.sub(p,y),y=r.mul(f,y),b=r.add(b,y),p=r.mul(g,b),u=r.add(u,p),p=r.mul(w,b),l=r.mul(m,l),l=r.sub(l,p),p=r.mul(m,g),d=r.mul(w,d),d=r.add(d,p),new S(l,u,d)}subtract(e){return this.add(e.negate())}is0(){return this.equals(S.ZERO)}multiply(e){const{endo:n}=t;if(!i.isValidNot0(e))throw new Error("invalid scalar: out of range");let r,o;const s=e=>I.cached(this,e,(e=>xT(S,e)));if(n){const{k1neg:t,k1:i,k2neg:a,k2:c}=b(e),{p:l,f:u}=s(i),{p:d,f:f}=s(c);o=u.add(f),r=_(n.beta,l,d,t,a)}else{const{p:t,f:n}=s(e);r=t,o=n}return xT(S,[r,o])[0]}multiplyUnsafe(e){const{endo:n}=t,r=this;if(!i.isValid(e))throw new Error("invalid scalar: out of range");if(e===$T||r.is0())return S.ZERO;if(e===eR)return r;if(I.hasCache(this))return this.multiply(e);if(n){const{k1neg:t,k1:i,k2neg:o,k2:s}=b(e),{p1:a,p2:c}=function(e,t,n,r){let i=t,o=e.ZERO,s=e.ZERO;for(;n>ET||r>ET;)n&_T&&(o=o.add(i)),r&_T&&(s=s.add(i)),i=i.double(),n>>=_T,r>>=_T;return{p1:o,p2:s}}(S,r,i,s);return _(n.beta,a,c,t,o)}return I.unsafe(r,e)}multiplyAndAddUnsafe(e,t,n){const r=this.multiplyUnsafe(t).add(e.multiplyUnsafe(n));return r.is0()?void 0:r}toAffine(e){return w(this,e)}isTorsionFree(){const{isTorsionFree:e}=t;return s===eR||(e?e(S,this):I.unsafe(this,a).is0())}clearCofactor(){const{clearCofactor:e}=t;return s===eR?this:e?e(S,this):this.multiplyUnsafe(s)}isSmallOrder(){return this.multiplyUnsafe(s).is0()}toBytes(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return BA(e,"isCompressed"),this.assertValidity(),d(S,this,e)}toHex(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return uI(this.toBytes(e))}toString(){return"<Point ".concat(this.is0()?"ZERO":this.toHex(),">")}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.toBytes(e)}_setWindowSize(e){this.precompute(e)}static normalizeZ(e){return xT(S,e)}static msm(e,t){return NT(S,i,e,t)}static fromPrivateKey(e){return S.BASE.multiply(iR(i,e))}}S.BASE=new S(o.Gx,o.Gy,r.ONE),S.ZERO=new S(r.ZERO,r.ONE,r.ZERO),S.Fp=r,S.Fn=i;const x=i.BITS,I=new CT(S,t.endo?Math.ceil(x/2):x);return S.BASE.precompute(8),S}function sR(e){return Uint8Array.of(e?2:3)}function aR(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function cR(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{Fn:n}=e,r=t.randomBytes||bI,i=Object.assign(aR(e.Fp,n),{seed:wT(n.ORDER)});function o(e){try{return!!iR(n,e)}catch{return!1}}function s(){return function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=e.length,i=bT(t),o=wT(t);if(r<16||r<o||r>1024)throw new Error("expected "+o+"-1024 bytes of input, got "+r);const s=sT(n?FA(e):MA(e),t-QA)+QA;return n?qA(s,i):zA(s,i)}(LA(arguments.length>0&&void 0!==arguments[0]?arguments[0]:r(i.seed),i.seed,"seed"),n.ORDER)}function a(t){let r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return e.BASE.multiply(iR(n,t)).toBytes(r)}function c(t){if("bigint"==typeof t)return!1;if(t instanceof e)return!0;const{secretKey:r,publicKey:o,publicKeyUncompressed:s}=i;if(n.allowedLengths||r===o)return;const a=HA("key",t).length;return a===o||a===s}return Object.freeze({getPublicKey:a,getSharedSecret:function(t,r){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!0===c(t))throw new Error("first arg must be private key");if(!1===c(r))throw new Error("second arg must be public key");const o=iR(n,t);return e.fromHex(r).multiply(o).toBytes(i)},keygen:function(e){const t=s(e);return{secretKey:t,publicKey:a(t)}},Point:e,utils:{isValidSecretKey:o,isValidPublicKey:function(t,n){const{publicKey:r,publicKeyUncompressed:o}=i;try{const i=t.length;return!(!0===n&&i!==r||!1===n&&i!==o)&&!!e.fromBytes(t)}catch{return!1}},randomSecretKey:s,isValidPrivateKey:o,randomPrivateKey:s,normPrivateKeyToScalar:e=>iR(n,e),precompute(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:8;return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.BASE).precompute(t,!1)}},lengths:i})}function lR(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Qx(t),YA(n,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const r=n.randomBytes||bI,i=n.hmac||function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return TA(t,e,yI(...r))},{Fp:o,Fn:s}=e,{ORDER:a,BITS:c}=s,{keygen:l,getPublicKey:u,getSharedSecret:d,utils:f,lengths:h}=cR(e,n),p={prehash:!1,lowS:"boolean"==typeof n.lowS&&n.lowS,format:void 0,extraEntropy:!1},g="compact";function y(e){return e>a>>eR}function m(e,t){if(!s.isValidNot0(t))throw new Error("invalid signature ".concat(e,": out of range 1..Point.Fn.ORDER"));return t}class v{constructor(e,t,n){this.r=m("r",e),this.s=m("s",t),null!=n&&(this.recovery=n),Object.freeze(this)}static fromBytes(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g;if(function(e,t){ZT(t);const n=h.signature;LA(e,"compact"===t?n:"recovered"===t?n+1:void 0,"".concat(t," signature"))}(e,n),"der"===n){const{r:t,s:n}=JT.toSig(LA(e));return new v(t,n)}"recovered"===n&&(t=e[0],n="compact",e=e.subarray(1));const r=s.BYTES,i=e.subarray(0,r),o=e.subarray(r,2*r);return new v(s.fromBytes(i),s.fromBytes(o),t)}static fromHex(e,t){return this.fromBytes(hI(e),t)}addRecoveryBit(e){return new v(this.r,this.s,e)}recoverPublicKey(t){const n=o.ORDER,{r:r,s:i,recovery:c}=this;if(null==c||![0,1,2,3].includes(c))throw new Error("recovery id invalid");if(a*tR<n&&c>1)throw new Error("recovery id is ambiguous for h>1 curve");const l=2===c||3===c?r+a:r;if(!o.isValid(l))throw new Error("recovery id 2 or 3 invalid");const u=o.toBytes(l),d=e.fromBytes(yI(sR(0===(1&c)),u)),f=s.inv(l),h=w(HA("msgHash",t)),p=s.create(-h*f),g=s.create(i*f),y=e.BASE.multiplyUnsafe(p).add(d.multiplyUnsafe(g));if(y.is0())throw new Error("point at infinify");return y.assertValidity(),y}hasHighS(){return y(this.s)}toBytes(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:g;if(ZT(e),"der"===e)return hI(JT.hexFromSig(this));const t=s.toBytes(this.r),n=s.toBytes(this.s);if("recovered"===e){if(null==this.recovery)throw new Error("recovery bit must be present");return yI(Uint8Array.of(this.recovery),t,n)}return yI(t,n)}toHex(e){return uI(this.toBytes(e))}assertValidity(){}static fromCompact(e){return v.fromBytes(HA("sig",e),"compact")}static fromDER(e){return v.fromBytes(HA("sig",e),"der")}normalizeS(){return this.hasHighS()?new v(this.r,s.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return uI(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return uI(this.toBytes("compact"))}}const b=n.bits2int||function(e){if(e.length>8192)throw new Error("input is too large");const t=MA(e),n=8*e.length-c;return n>0?t>>BigInt(n):t},w=n.bits2int_modN||function(e){return s.create(b(e))},E=GA(c);function _(e){return KA("num < 2^"+c,e,$T,E),s.toBytes(e)}function S(e,n){return LA(e,void 0,"message"),n?LA(t(e),void 0,"prehashed message"):e}return Object.freeze({keygen:l,getPublicKey:u,getSharedSecret:d,utils:f,lengths:h,Point:e,sign:function(n,o){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};n=HA("message",n);const{seed:c,k2sig:l}=function(t,n,i){if(["recovered","canonical"].some((e=>e in i)))throw new Error("sign() legacy options not supported");const{lowS:o,prehash:a,extraEntropy:c}=XT(i,p);t=S(t,a);const l=w(t),u=iR(s,n),d=[_(u),_(l)];if(null!=c&&!1!==c){const e=!0===c?r(h.secretKey):c;d.push(HA("extraEntropy",e))}const f=yI(...d),g=l;return{seed:f,k2sig:function(t){const n=b(t);if(!s.isValidNot0(n))return;const r=s.inv(n),i=e.BASE.multiply(n).toAffine(),a=s.create(i.x);if(a===$T)return;const c=s.create(r*s.create(g+a*u));if(c===$T)return;let l=(i.x===a?0:2)|Number(i.y&eR),d=c;return o&&y(c)&&(d=s.neg(c),l^=1),new v(a,d,l)}}}(n,o,a);return function(e,t,n){if("number"!=typeof e||e<2)throw new Error("hashLen must be a number");if("number"!=typeof t||t<2)throw new Error("qByteLen must be a number");if("function"!=typeof n)throw new Error("hmacFn must be a function");const r=e=>new Uint8Array(e),i=e=>Uint8Array.of(e);let o=r(e),s=r(e),a=0;const c=()=>{o.fill(1),s.fill(0),a=0},l=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return n(s,o,...t)},u=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r(0);s=l(i(0),e),o=l(),0!==e.length&&(s=l(i(1),e),o=l())},d=()=>{if(a++>=1e3)throw new Error("drbg: tried 1000 values");let e=0;const n=[];for(;e<t;){o=l();const t=o.slice();n.push(t),e+=o.length}return yI(...n)};return(e,t)=>{let n;for(c(),u(e);!(n=t(d()));)u();return c(),n}}(t.outputLen,s.BYTES,i)(c,l)},verify:function(t,n,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const{lowS:o,prehash:a,format:c}=XT(i,p);if(r=HA("publicKey",r),n=S(HA("message",n),a),"strict"in i)throw new Error("options.strict was renamed to lowS");const l=void 0===c?function(e){let t;const n="string"==typeof e||Yx(e),r=!n&&null!==e&&"object"==typeof e&&"bigint"==typeof e.r&&"bigint"==typeof e.s;if(!n&&!r)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(r)t=new v(e.r,e.s);else if(n){try{t=v.fromBytes(HA("sig",e),"der")}catch(o){if(!(o instanceof JT.Err))throw o}if(!t)try{t=v.fromBytes(HA("sig",e),"compact")}catch{return!1}}return t||!1}(t):v.fromBytes(HA("sig",t),c);if(!1===l)return!1;try{const t=e.fromBytes(r);if(o&&l.hasHighS())return!1;const{r:i,s:a}=l,c=w(n),u=s.inv(a),d=s.create(c*u),f=s.create(i*u),h=e.BASE.multiplyUnsafe(d).add(t.multiplyUnsafe(f));return!h.is0()&&s.create(h.x)===i}catch{return!1}},recoverPublicKey:function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{prehash:r}=XT(n,p);return t=S(t,r),v.fromBytes(e,"recovered").recoverPublicKey(t).toBytes()},Signature:v,hash:t})}function uR(e){const{CURVE:t,curveOpts:n}=function(e){const t={a:e.a,b:e.b,p:e.Fp.ORDER,n:e.n,h:e.h,Gx:e.Gx,Gy:e.Gy},n=e.Fp;let r=e.allowedPrivateKeyLengths?Array.from(new Set(e.allowedPrivateKeyLengths.map((e=>Math.ceil(e/2))))):void 0;return{CURVE:t,curveOpts:{Fp:n,Fn:vT(t.n,{BITS:e.nBitLength,allowedLengths:r,modFromBytes:e.wrapPrivateKey}),allowInfinityPoint:e.allowInfinityPoint,endo:e.endo,isTorsionFree:e.isTorsionFree,clearCofactor:e.clearCofactor,fromBytes:e.fromBytes,toBytes:e.toBytes}}}(e),r={hmac:e.hmac,randomBytes:e.randomBytes,lowS:e.lowS,bits2int:e.bits2int,bits2int_modN:e.bits2int_modN};return{CURVE:t,curveOpts:n,hash:e.hash,ecdsaOpts:r}}function dR(e){const{CURVE:t,curveOpts:n,hash:r,ecdsaOpts:i}=uR(e);return function(e,t){const n=t.Point;return Object.assign({},t,{ProjectivePoint:n,CURVE:Object.assign({},e,mT(n.Fn.ORDER,n.Fn.BITS))})}(e,lR(oR(t,n),r,i))}function fR(e,t){const n=t=>dR({...e,hash:t});return{...n(t),create:n}}const hR={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")},pR={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff"),n:BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973"),h:BigInt(1),a:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc"),b:BigInt("0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef"),Gx:BigInt("0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7"),Gy:BigInt("0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f")},gR={p:BigInt("0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),n:BigInt("0x01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409"),h:BigInt(1),a:BigInt("0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc"),b:BigInt("0x0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00"),Gx:BigInt("0x00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66"),Gy:BigInt("0x011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650")},yR=vT(hR.p),mR=vT(pR.p),vR=vT(gR.p),bR=fR({...hR,Fp:yR,lowS:!1},eO);fR({...pR,Fp:mR,lowS:!1},nO),fR({...gR,Fp:vR,lowS:!1,allowedPrivateKeyLengths:[130,131,132]},tO);const wR=bR,ER="base10",_R="base16",SR="base64pad",xR="base64url",IR="utf8",OR=0,AR=1,TR=2,RR=0,kR=1,PR=12,CR=32;function NR(){return jS(bI(CR),_R)}function UR(e){return jS(CA(DS(e,_R)),_R)}function BR(e){return jS(CA(DS(e,IR)),_R)}function LR(e){return DS("".concat(e),ER)}function DR(e){return Number(jS(e,ER))}function jR(e){return e.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function MR(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=(4-t.length%4)%4;return t+"=".repeat(n)}function FR(e){if(DR(e.type)===TR)return jS(l_([e.type,e.sealed]),SR);if(DR(e.type)===AR){if(typeof e.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return jS(l_([e.type,e.senderPublicKey,e.iv,e.sealed]),SR)}return jS(l_([e.type,e.iv,e.sealed]),SR)}function zR(e){const t=DS((e.encoding||SR)===xR?MR(e.encoded):e.encoded,SR),n=t.slice(RR,kR),r=kR;if(DR(n)===AR){const e=r+CR,i=e+PR,o=t.slice(r,e),s=t.slice(e,i);return{type:n,sealed:t.slice(i),iv:s,senderPublicKey:o}}if(DR(n)===TR){return{type:n,sealed:t.slice(r),iv:bI(PR)}}const i=r+PR,o=t.slice(r,i);return{type:n,sealed:t.slice(i),iv:o}}function qR(e){const t=(null===e||void 0===e?void 0:e.type)||OR;if(t===AR){if(typeof(null===e||void 0===e?void 0:e.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(null===e||void 0===e?void 0:e.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:t,senderPublicKey:null===e||void 0===e?void 0:e.senderPublicKey,receiverPublicKey:null===e||void 0===e?void 0:e.receiverPublicKey}}function HR(e){return e.type===AR&&"string"==typeof e.senderPublicKey&&"string"==typeof e.receiverPublicKey}function VR(e){return e.type===TR}function KR(e,t){const[n,r,i]=e.split("."),o=Buffer.from(MR(i),"base64");if(64!==o.length)throw new Error("Invalid signature length");const s=o.slice(0,32),a=o.slice(32,64),c="".concat(n,".").concat(r),l=CA(c),u=function(e){const t=Buffer.from(e.x,"base64"),n=Buffer.from(e.y,"base64");return l_([new Uint8Array([4]),t,n])}(t);if(!wR.verify(l_([s,a]),l,u))throw new Error("Invalid signature");return sm(e).payload}function WR(e){return(null===e||void 0===e?void 0:e.relay)||{protocol:"irn"}}function GR(e){const t=MS[e];if(typeof t>"u")throw new Error("Relay Protocol not supported: ".concat(e));return t}var YR=Object.defineProperty,ZR=Object.defineProperties,XR=Object.getOwnPropertyDescriptors,QR=Object.getOwnPropertySymbols,JR=Object.prototype.hasOwnProperty,$R=Object.prototype.propertyIsEnumerable,ek=(e,t,n)=>t in e?YR(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,tk=(e,t)=>{for(var n in t||(t={}))JR.call(t,n)&&ek(e,n,t[n]);if(QR)for(var n of QR(t))$R.call(t,n)&&ek(e,n,t[n]);return e};function nk(e){const t={},n="relay"+(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-");return Object.keys(e).forEach((r=>{if(r.startsWith(n)){const i=r.replace(n,""),o=e[r];t[i]=o}})),t}function rk(e){if(!e.includes("wc:")){const t=Ox(e);null!=t&&t.includes("wc:")&&(e=t)}const t=(e=(e=e.includes("wc://")?e.replace("wc://",""):e).includes("wc:")?e.replace("wc:",""):e).indexOf(":"),n=-1!==e.indexOf("?")?e.indexOf("?"):void 0,r=e.substring(0,t),i=e.substring(t+1,n).split("@"),o=typeof n<"u"?e.substring(n):"",s=new URLSearchParams(o),a=Object.fromEntries(s.entries()),c="string"==typeof a.methods?a.methods.split(","):void 0;return{protocol:r,topic:ik(i[0]),version:parseInt(i[1],10),symKey:a.symKey,relay:nk(a),methods:c,expiryTimestamp:a.expiryTimestamp?parseInt(a.expiryTimestamp,10):void 0}}function ik(e){return e.startsWith("//")?e.substring(2):e}function ok(e){const t=new URLSearchParams,n=tk(tk(((e,t)=>ZR(e,XR(t)))(tk({},function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-";const n={};return Object.keys(e).forEach((r=>{const i=r,o="relay"+t+i;e[i]&&(n[o]=e[i])})),n}(e.relay)),{symKey:e.symKey}),e.expiryTimestamp&&{expiryTimestamp:e.expiryTimestamp.toString()}),e.methods&&{methods:e.methods.join(",")});return Object.entries(n).sort(((e,t)=>{let[n]=e,[r]=t;return n.localeCompare(r)})).forEach((e=>{let[n,r]=e;void 0!==r&&t.append(n,String(r))})),"".concat(e.protocol,":").concat(e.topic,"@").concat(e.version,"?").concat(t)}function sk(e,t,n){return"".concat(e,"?wc_ev=").concat(n,"&topic=").concat(t)}var ak=Object.defineProperty,ck=Object.defineProperties,lk=Object.getOwnPropertyDescriptors,uk=Object.getOwnPropertySymbols,dk=Object.prototype.hasOwnProperty,fk=Object.prototype.propertyIsEnumerable,hk=(e,t,n)=>t in e?ak(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pk=(e,t)=>{for(var n in t||(t={}))dk.call(t,n)&&hk(e,n,t[n]);if(uk)for(var n of uk(t))fk.call(t,n)&&hk(e,n,t[n]);return e},gk=(e,t)=>ck(e,lk(t));function yk(e){const t=[];return e.forEach((e=>{const[n,r]=e.split(":");t.push("".concat(n,":").concat(r))})),t}function mk(e){const t=[];return Object.values(e).forEach((e=>{t.push(...yk(e.accounts))})),[...new Set(t)]}function vk(e){return e.includes(":")}function bk(e){return vk(e)?e.split(":")[0]:e}function wk(e){var t,n,r;const i={};if(!Ak(e))return i;for(const[o,s]of Object.entries(e)){const e=vk(o)?[o]:s.chains,a=s.methods||[],c=s.events||[],l=bk(o);i[l]=gk(pk({},i[l]),{chains:Ex(e,null==(t=i[l])?void 0:t.chains),methods:Ex(a,null==(n=i[l])?void 0:n.methods),events:Ex(c,null==(r=i[l])?void 0:r.events)})}return i}function Ek(e,t){const n=function(e){const t={};return null!==e&&void 0!==e&&e.forEach((e=>{var n;const[r,i]=e.split(":");t[r]||(t[r]={accounts:[],chains:[],events:[],methods:[]}),t[r].accounts.push(e),null==(n=t[r].chains)||n.push("".concat(r,":").concat(i))})),t}(t=t.map((e=>e.replace("did:pkh:",""))));for(const[r,i]of Object.entries(n))i.methods?i.methods=Ex(i.methods,e):i.methods=e,i.events=["chainChanged","accountsChanged"];return n}const _k={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},Sk={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function xk(e,t){const{message:n,code:r}=Sk[e];return{message:t?"".concat(n," ").concat(t):n,code:r}}function Ik(e,t){const{message:n,code:r}=_k[e];return{message:t?"".concat(n," ").concat(t):n,code:r}}function Ok(e,t){return!!Array.isArray(e)&&(!(typeof t<"u"&&e.length)||e.every(t))}function Ak(e){return Object.getPrototypeOf(e)===Object.prototype&&Object.keys(e).length}function Tk(e){return typeof e>"u"}function Rk(e,t){return!(!t||!Tk(e))||"string"==typeof e&&!!e.trim().length}function kk(e,t){return!(!t||!Tk(e))||"number"==typeof e&&!isNaN(e)}function Pk(e){return!(!Rk(e,!1)||!e.includes(":"))&&2===e.split(":").length}function Ck(e){let t=!0;return Ok(e)?e.length&&(t=e.every((e=>Rk(e,!1)))):t=!1,t}function Nk(e,t,n){let r=null;return Object.entries(e).forEach((e=>{let[i,o]=e;if(r)return;const s=function(e,t,n){let r=null;return Ok(t)&&t.length?t.forEach((e=>{r||Pk(e)||(r=Ik("UNSUPPORTED_CHAINS","".concat(n,", chain ").concat(e,' should be a string and conform to "namespace:chainId" format')))})):Pk(e)||(r=Ik("UNSUPPORTED_CHAINS","".concat(n,', chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }'))),r}(i,HS(i,o),"".concat(t," ").concat(n));s&&(r=s)})),r}function Uk(e,t){let n=null;return Ok(e)?e.forEach((e=>{n||function(e){if(Rk(e,!1)&&e.includes(":")){const t=e.split(":");if(3===t.length){const e=t[0]+":"+t[1];return!!t[2]&&Pk(e)}}return!1}(e)||(n=Ik("UNSUPPORTED_ACCOUNTS","".concat(t,", account ").concat(e,' should be a string and conform to "namespace:chainId:address" format')))})):n=Ik("UNSUPPORTED_ACCOUNTS","".concat(t,', accounts should be an array of strings conforming to "namespace:chainId:address" format')),n}function Bk(e,t){let n=null;return Object.values(e).forEach((e=>{if(n)return;const r=function(e,t){let n=null;return Ck(null===e||void 0===e?void 0:e.methods)?Ck(null===e||void 0===e?void 0:e.events)||(n=Ik("UNSUPPORTED_EVENTS","".concat(t,", events should be an array of strings or empty array for no events"))):n=Ik("UNSUPPORTED_METHODS","".concat(t,", methods should be an array of strings or empty array for no methods")),n}(e,"".concat(t,", namespace"));r&&(n=r)})),n}function Lk(e,t){let n=null;if(e&&Ak(e)){const r=Bk(e,t);r&&(n=r);const i=function(e,t){let n=null;return Object.values(e).forEach((e=>{if(n)return;const r=Uk(null===e||void 0===e?void 0:e.accounts,"".concat(t," namespace"));r&&(n=r)})),n}(e,t);i&&(n=i)}else n=xk("MISSING_OR_INVALID","".concat(t,", namespaces should be an object with data"));return n}function Dk(e){return Rk(e.protocol,!0)}function jk(e){return typeof e<"u"&&null!==typeof e}function Mk(e,t){return!(!Pk(t)||!mk(e).includes(t))}function Fk(e,t,n){return!!Rk(n,!1)&&function(e,t){const n=[];return Object.values(e).forEach((e=>{yk(e.accounts).includes(t)&&n.push(...e.methods)})),n}(e,t).includes(n)}function zk(e,t,n){return!!Rk(n,!1)&&function(e,t){const n=[];return Object.values(e).forEach((e=>{yk(e.accounts).includes(t)&&n.push(...e.events)})),n}(e,t).includes(n)}function qk(e,t,n){let r=null;const i=function(e){const t={};return Object.keys(e).forEach((n=>{var r;n.includes(":")?t[n]=e[n]:null==(r=e[n].chains)||r.forEach((r=>{t[r]={methods:e[n].methods,events:e[n].events}}))})),t}(e),o=function(e){const t={};return Object.keys(e).forEach((n=>{if(n.includes(":"))t[n]=e[n];else{const r=yk(e[n].accounts);null===r||void 0===r||r.forEach((r=>{t[r]={accounts:e[n].accounts.filter((e=>e.includes("".concat(r,":")))),methods:e[n].methods,events:e[n].events}}))}})),t}(t),s=Object.keys(i),a=Object.keys(o),c=Hk(Object.keys(e)),l=Hk(Object.keys(t)),u=c.filter((e=>!l.includes(e)));return u.length&&(r=xk("NON_CONFORMING_NAMESPACES","".concat(n," namespaces keys don't satisfy requiredNamespaces.\n Required: ").concat(u.toString(),"\n Received: ").concat(Object.keys(t).toString()))),dx(s,a)||(r=xk("NON_CONFORMING_NAMESPACES","".concat(n," namespaces chains don't satisfy required namespaces.\n Required: ").concat(s.toString(),"\n Approved: ").concat(a.toString()))),Object.keys(t).forEach((e=>{if(!e.includes(":")||r)return;const i=yk(t[e].accounts);i.includes(e)||(r=xk("NON_CONFORMING_NAMESPACES","".concat(n," namespaces accounts don't satisfy namespace accounts for ").concat(e,"\n Required: ").concat(e,"\n Approved: ").concat(i.toString())))})),s.forEach((e=>{r||(dx(i[e].methods,o[e].methods)?dx(i[e].events,o[e].events)||(r=xk("NON_CONFORMING_NAMESPACES","".concat(n," namespaces events don't satisfy namespace events for ").concat(e))):r=xk("NON_CONFORMING_NAMESPACES","".concat(n," namespaces methods don't satisfy namespace methods for ").concat(e)))})),r}function Hk(e){return[...new Set(e.map((e=>e.includes(":")?e.split(":")[0]:e)))]}function Vk(){const e=ox();return new Promise((t=>{switch(e){case ex.browser:t(function(){var e;return ix()&&(null===(e=navigator)||void 0===e?void 0:e.onLine)}());break;case ex.reactNative:t(async function(){if(rx()&&typeof global<"u"&&null!=global&&global.NetInfo){const e=await(null==global?void 0:global.NetInfo.fetch());return null===e||void 0===e?void 0:e.isConnected}return!0}());break;case ex.node:default:t(!0)}}))}function Kk(e){switch(ox()){case ex.browser:!function(e){!rx()&&ix()&&(window.addEventListener("online",(()=>e(!0))),window.addEventListener("offline",(()=>e(!1))))}(e);break;case ex.reactNative:!function(e){var t;rx()&&typeof global<"u"&&null!=global&&global.NetInfo&&(null===(t=global)||void 0===t||t.NetInfo.addEventListener((t=>e(null===t||void 0===t?void 0:t.isConnected))))}(e);case ex.node:}}const Wk={};class Gk{static get(e){return Wk[e]}static set(e,t){Wk[e]=t}static delete(e){delete Wk[e]}}function Yk(e){let{publicKey:t,signature:n,payload:r}=e;var i;const o=Zk(r.method),s=128|parseInt((null==(i=r.version)?void 0:i.toString())||"4"),a=function(e){const t=eE.decode(e)[0];return 42===t?0:60===t?2:1}(r.address),c="00"===r.era?new Uint8Array([0]):Zk(r.era);if(1!==c.length&&2!==c.length)throw new Error("Invalid era length");const l=parseInt(r.nonce,16),u=new Uint8Array([255&l,l>>8&255]),d=BigInt("0x".concat(function(e){return e.startsWith("0x")?e.slice(2):e}(r.tip))),f=function(e){if(e<BigInt(1)<<BigInt(6))return new Uint8Array([Number(e<<BigInt(2))]);if(e<BigInt(1)<<BigInt(14)){const t=e<<BigInt(2)|BigInt(1);return new Uint8Array([Number(t&BigInt(255)),Number(t>>BigInt(8)&BigInt(255))])}if(e<BigInt(1)<<BigInt(30)){const t=e<<BigInt(2)|BigInt(2);return new Uint8Array([Number(t&BigInt(255)),Number(t>>BigInt(8)&BigInt(255)),Number(t>>BigInt(16)&BigInt(255)),Number(t>>BigInt(24)&BigInt(255))])}throw new Error("BigInt compact encoding not supported > 2^30")}(d),h=new Uint8Array([0,...t,a,...n,...c,...u,...f,...o]),p=function(e){if(e<64)return new Uint8Array([e<<2]);if(e<16384){const t=e<<2|1;return new Uint8Array([255&t,t>>8&255])}if(e<1<<30){const t=e<<2|2;return new Uint8Array([255&t,t>>8&255,t>>16&255,t>>24&255])}throw new Error("Compact encoding > 2^30 not supported")}(h.length+1);return new Uint8Array([...p,s,...h])}function Zk(e){return new Uint8Array(e.replace(/^0x/,"").match(/.{1,2}/g).map((e=>parseInt(e,16))))}function Xk(e){const t=Uint8Array.from(Buffer.from(e.signature,"hex")),n=function(e){const t=eE.decode(e);if(t.length<33)throw new Error("Too short to contain a public key");return t.slice(1,33)}(e.transaction.address),r=Yk({publicKey:n,signature:t,payload:e.transaction});return function(e){const t=Zk(e),n=(0,FS.blake2b)(t,void 0,32);return"0x"+Buffer.from(n).toString("hex")}(Buffer.from(r).toString("hex"))}function Qk(e){let{logger:t,name:n}=e;const r="string"==typeof t?vh({opts:{level:t,name:n}}).logger:t;return r.level="string"==typeof t?t:t.level,r}const Jk="PARSE_ERROR",$k="INVALID_REQUEST",eP="METHOD_NOT_FOUND",tP="INVALID_PARAMS",nP="INTERNAL_ERROR",rP="SERVER_ERROR",iP=[-32700,-32600,-32601,-32602,-32603],oP={[Jk]:{code:-32700,message:"Parse error"},[$k]:{code:-32600,message:"Invalid Request"},[eP]:{code:-32601,message:"Method not found"},[tP]:{code:-32602,message:"Invalid params"},[nP]:{code:-32603,message:"Internal error"},[rP]:{code:-32e3,message:"Server error"}},sP=rP;function aP(e){return iP.includes(e)}function cP(e){return Object.keys(oP).includes(e)?oP[e]:oP[sP]}function lP(e){const t=Object.values(oP).find((t=>t.code===e));return t||oP[sP]}function uP(e,t,n){return e.message.includes("getaddrinfo ENOTFOUND")||e.message.includes("connect ECONNREFUSED")?new Error("Unavailable ".concat(n," RPC url at ").concat(t)):e}var dP=n(6360);function fP(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3;return Date.now()*Math.pow(10,e)+Math.floor(Math.random()*Math.pow(10,e))}function hP(){return BigInt(fP(arguments.length>0&&void 0!==arguments[0]?arguments[0]:6))}function pP(e,t,n){return{id:n||fP(),jsonrpc:"2.0",method:e,params:t}}function gP(e,t){return{id:e,jsonrpc:"2.0",result:t}}function yP(e,t,n){return{id:e,jsonrpc:"2.0",error:mP(t,n)}}function mP(e,t){return"undefined"===typeof e?cP(nP):("string"===typeof e&&(e=Object.assign(Object.assign({},cP(rP)),{message:e})),"undefined"!==typeof t&&(e.data=t),aP(e.code)&&(e=lP(e.code)),e)}class vP{}class bP extends vP{constructor(){super()}}class wP extends bP{constructor(e){super()}}function EP(e,t){const n=function(e){const t=e.match(new RegExp(/^\w+:/,"gi"));if(t&&t.length)return t[0]}(e);return"undefined"!==typeof n&&new RegExp(t).test(n)}function _P(e){return EP(e,"^https?:")}function SP(e){return EP(e,"^wss?:")}function xP(e){return"object"===typeof e&&"id"in e&&"jsonrpc"in e&&"2.0"===e.jsonrpc}function IP(e){return xP(e)&&"method"in e}function OP(e){return xP(e)&&(AP(e)||TP(e))}function AP(e){return"result"in e}function TP(e){return"error"in e}class RP extends wP{constructor(e){super(e),this.events=new ir.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.connection;await this.open(e)}async disconnect(){await this.close()}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async request(e,t){return this.requestStrict(pP(e.method,e.params||[],e.id||hP().toString()),t)}async requestStrict(e,t){return new Promise((async(n,r)=>{if(!this.connection.connected)try{await this.open()}catch(Yu){r(Yu)}this.events.on("".concat(e.id),(e=>{TP(e)?r(e.error):n(e.result)}));try{await this.connection.send(e,t)}catch(Yu){r(Yu)}}))}setConnection(){return arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.connection}onPayload(e){this.events.emit("payload",e),OP(e)?this.events.emit("".concat(e.id),e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&3e3===e.code&&this.events.emit("error",new Error("WebSocket connection closed abnormally with code: ".concat(e.code," ").concat(e.reason?"(".concat(e.reason,")"):""))),this.events.emit("disconnect")}async open(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.connection;this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),"string"==typeof e&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",(e=>this.onPayload(e))),this.connection.on("close",(e=>this.onClose(e))),this.connection.on("error",(e=>this.events.emit("error",e))),this.connection.on("register_error",(e=>this.onClose())),this.hasRegisteredEventListeners=!0)}}const kP=e=>e.split("?")[0],PP=typeof WebSocket<"u"?WebSocket:typeof n.g<"u"&&typeof n.g.WebSocket<"u"?n.g.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:n(6330);class CP{constructor(e){if(this.url=e,this.events=new ir.EventEmitter,this.registering=!1,!SP(e))throw new Error("Provided URL is not compatible with WebSocket connection: ".concat(e));this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.url;await this.register(e)}async close(){return new Promise(((e,t)=>{typeof this.socket>"u"?t(new Error("Connection already closed")):(this.socket.onclose=t=>{this.onClose(t),e()},this.socket.close())}))}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(hf(e))}catch(t){this.onError(e.id,t)}}register(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.url;if(!SP(e))throw new Error("Provided URL is not compatible with WebSocket connection: ".concat(e));if(this.registering){const e=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=e||this.events.listenerCount("open")>=e)&&this.events.setMaxListeners(e+1),new Promise(((e,t)=>{this.events.once("register_error",(e=>{this.resetMaxListeners(),t(e)})),this.events.once("open",(()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return t(new Error("WebSocket connection is missing or invalid"));e(this.socket)}))}))}return this.url=e,this.registering=!0,new Promise(((t,r)=>{const i=(0,dP.isReactNative)()?void 0:{rejectUnauthorized:(s=e,!new RegExp("wss?://localhost(:d{2,5})?").test(s))},o=new PP(e,[],i);var s;typeof WebSocket<"u"||typeof n.g<"u"&&typeof n.g.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u"?o.onerror=e=>{const t=e;r(this.emitError(t.error))}:o.on("error",(e=>{r(this.emitError(e))})),o.onopen=()=>{this.onOpen(o),t(o)}}))}onOpen(e){e.onmessage=e=>this.onPayload(e),e.onclose=e=>this.onClose(e),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const t="string"==typeof e.data?ff(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const n=this.parseError(t),r=yP(e,n.message||n.toString());this.events.emit("payload",r)}parseError(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.url;return uP(e,kP(t),"WS")}resetMaxListeners(){this.events.getMaxListeners()>10&&this.events.setMaxListeners(10)}emitError(e){const t=this.parseError(new Error((null===e||void 0===e?void 0:e.message)||"WebSocket connection failed for host: ".concat(kP(this.url))));return this.events.emit("register_error",t),t}}const NP="core",UP="".concat("wc","@2:").concat(NP,":"),BP="error",LP={database:":memory:"},DP="client_ed25519_seed",jP=Bd.ONE_DAY,MP=Bd.SIX_HOURS,FP="wss://relay.walletconnect.org",zP="relayer_message",qP="relayer_message_ack",HP="relayer_connect",VP="relayer_disconnect",KP="relayer_error",WP="relayer_connection_stalled",GP="relayer_publish",YP="payload",ZP="connect",XP="disconnect",QP="error",JP="2.23.4",$P={link_mode:"link_mode",relay:"relay"},eC="inbound",tC="outbound",nC="WALLETCONNECT_LINK_MODE_APPS",rC="subscription_created",iC="subscription_deleted",oC="subscription_sync",sC="subscription_resubscribed",aC=(Bd.FIVE_SECONDS,{wc_pairingDelete:{req:{ttl:Bd.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:Bd.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:Bd.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:Bd.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:Bd.ONE_DAY,prompt:!1,tag:0},res:{ttl:Bd.ONE_DAY,prompt:!1,tag:0}}}),cC="pairing_create",lC="pairing_expire",uC="pairing_delete",dC="pairing_ping",fC="history_created",hC="history_updated",pC="history_deleted",gC="history_sync",yC="expirer_created",mC="expirer_deleted",vC="expirer_expired",bC="expirer_sync",wC="https://verify.walletconnect.org",EC=wC,_C="".concat(EC,"/v3"),SC=["https://verify.walletconnect.com",wC],xC="pairing_started",IC="pairing_uri_validation_success",OC="pairing_uri_not_expired",AC="store_new_pairing",TC="subscribing_pairing_topic",RC="subscribe_pairing_topic_success",kC="existing_pairing",PC="pairing_not_expired",CC="emit_inactive_pairing",NC="emit_session_proposal",UC="no_internet_connection",BC="malformed_pairing_uri",LC="active_pairing_already_exists",DC="subscribe_pairing_topic_failure",jC="pairing_expired",MC="proposal_listener_not_found",FC="session_approve_started",zC="session_namespaces_validation_success",qC="subscribing_session_topic",HC="subscribe_session_topic_success",VC="session_approve_publish_success",KC="store_session",WC="session_request_response_started",GC="session_request_response_validation_success",YC="session_request_response_publish_started",ZC="no_internet_connection",XC="proposal_expired",QC="subscribe_session_topic_failure",JC="session_approve_namespace_validation_failure",$C="proposal_not_found",eN="session_request_response_validation_failure",tN="session_request_response_publish_failure",nN="authenticated_session_approve_started",rN="create_authenticated_session_topic",iN="cacaos_verified",oN="store_authenticated_session",sN="subscribing_authenticated_session_topic",aN="subscribe_authenticated_session_topic_success",cN="publishing_authenticated_session_approve",lN="no_internet_connection",uN="invalid_cacao",dN="subscribe_authenticated_session_topic_failure",fN="authenticated_session_approve_publish_failure",hN="authenticated_session_pending_request_not_found";var pN=function(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),r=0;r<n.length;r++)n[r]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),s=o.charCodeAt(0);if(255!==n[s])throw new TypeError(o+" is ambiguous");n[s]=i}var a=e.length,c=e.charAt(0),l=Math.log(a)/Math.log(256),u=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 r=0,i=0;e[t]===c;)r++,t++;for(var o=(e.length-t)*l+1>>>0,s=new Uint8Array(o);e[t];){var u=n[e.charCodeAt(t)];if(255===u)return;for(var d=0,f=o-1;(0!==u||d<i)&&-1!==f;f--,d++)u+=a*s[f]>>>0,s[f]=u%256>>>0,u=u/256>>>0;if(0!==u)throw new Error("Non-zero carry");i=d,t++}if(" "!==e[t]){for(var h=o-i;h!==o&&0===s[h];)h++;for(var p=new Uint8Array(r+(o-h)),g=r;h!==o;)p[g++]=s[h++];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 n=0,r=0,i=0,o=t.length;i!==o&&0===t[i];)i++,n++;for(var s=(o-i)*u+1>>>0,l=new Uint8Array(s);i!==o;){for(var d=t[i],f=0,h=s-1;(0!==d||f<r)&&-1!==h;h--,f++)d+=256*l[h]>>>0,l[h]=d%a>>>0,d=d/a>>>0;if(0!==d)throw new Error("Non-zero carry");r=f,i++}for(var p=s-r;p!==s&&0===l[p];)p++;for(var g=c.repeat(n);p<s;++p)g+=e.charAt(l[p]);return g},decodeUnsafe:d,decode:function(e){var n=d(e);if(n)return n;throw new Error("Non-".concat(t," character"))}}},gN=pN;const yN=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")};class mN{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return"".concat(this.prefix).concat(this.baseEncode(e));throw Error("Unknown type, must be binary type")}}class vN{constructor(e,t,n){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if("string"==typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error("Unable to decode multibase string ".concat(JSON.stringify(e),", ").concat(this.name," decoder only supports inputs prefixed with ").concat(this.prefix));return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return wN(this,e)}}class bN{constructor(e){this.decoders=e}or(e){return wN(this,e)}decode(e){const t=e[0],n=this.decoders[t];if(n)return n.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 wN=(e,t)=>new bN({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class EN{constructor(e,t,n,r){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=r,this.encoder=new mN(e,t,n),this.decoder=new vN(e,t,r)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const _N=e=>{let{name:t,prefix:n,encode:r,decode:i}=e;return new EN(t,n,r,i)},SN=e=>{let{prefix:t,name:n,alphabet:r}=e;const{encode:i,decode:o}=gN(r,n);return _N({prefix:t,name:n,encode:i,decode:e=>yN(o(e))})},xN=e=>{let{name:t,prefix:n,bitsPerChar:r,alphabet:i}=e;return _N({prefix:n,name:t,encode:e=>((e,t,n)=>{const r="="===t[t.length-1],i=(1<<n)-1;let o="",s=0,a=0;for(let c=0;c<e.length;++c)for(a=a<<8|e[c],s+=8;s>n;)s-=n,o+=t[i&a>>s];if(s&&(o+=t[i&a<<n-s]),r)for(;o.length*n&7;)o+="=";return o})(e,i,r),decode:e=>((e,t,n,r)=>{const i={};for(let u=0;u<t.length;++u)i[t[u]]=u;let o=e.length;for(;"="===e[o-1];)--o;const s=new Uint8Array(o*n/8|0);let a=0,c=0,l=0;for(let u=0;u<o;++u){const t=i[e[u]];if(void 0===t)throw new SyntaxError("Non-".concat(r," character"));c=c<<n|t,a+=n,a>=8&&(a-=8,s[l++]=255&c>>a)}if(a>=n||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return s})(e,i,r,t)})},IN=_N({prefix:"\0",name:"identity",encode:e=>(e=>(new TextDecoder).decode(e))(e),decode:e=>(e=>(new TextEncoder).encode(e))(e)});var ON=Object.freeze({__proto__:null,identity:IN});const AN=xN({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var TN=Object.freeze({__proto__:null,base2:AN});const RN=xN({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var kN=Object.freeze({__proto__:null,base8:RN});const PN=SN({prefix:"9",name:"base10",alphabet:"0123456789"});var CN=Object.freeze({__proto__:null,base10:PN});const NN=xN({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),UN=xN({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var BN=Object.freeze({__proto__:null,base16:NN,base16upper:UN});const LN=xN({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),DN=xN({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),jN=xN({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),MN=xN({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),FN=xN({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),zN=xN({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),qN=xN({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),HN=xN({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),VN=xN({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var KN=Object.freeze({__proto__:null,base32:LN,base32upper:DN,base32pad:jN,base32padupper:MN,base32hex:FN,base32hexupper:zN,base32hexpad:qN,base32hexpadupper:HN,base32z:VN});const WN=SN({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),GN=SN({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var YN=Object.freeze({__proto__:null,base36:WN,base36upper:GN});const ZN=SN({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),XN=SN({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var QN=Object.freeze({__proto__:null,base58btc:ZN,base58flickr:XN});const JN=xN({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),$N=xN({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),eU=xN({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),tU=xN({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var nU=Object.freeze({__proto__:null,base64:JN,base64pad:$N,base64url:eU,base64urlpad:tU});const rU=Array.from("\ud83d\ude80\ud83e\ude90\u2604\ud83d\udef0\ud83c\udf0c\ud83c\udf11\ud83c\udf12\ud83c\udf13\ud83c\udf14\ud83c\udf15\ud83c\udf16\ud83c\udf17\ud83c\udf18\ud83c\udf0d\ud83c\udf0f\ud83c\udf0e\ud83d\udc09\u2600\ud83d\udcbb\ud83d\udda5\ud83d\udcbe\ud83d\udcbf\ud83d\ude02\u2764\ud83d\ude0d\ud83e\udd23\ud83d\ude0a\ud83d\ude4f\ud83d\udc95\ud83d\ude2d\ud83d\ude18\ud83d\udc4d\ud83d\ude05\ud83d\udc4f\ud83d\ude01\ud83d\udd25\ud83e\udd70\ud83d\udc94\ud83d\udc96\ud83d\udc99\ud83d\ude22\ud83e\udd14\ud83d\ude06\ud83d\ude44\ud83d\udcaa\ud83d\ude09\u263a\ud83d\udc4c\ud83e\udd17\ud83d\udc9c\ud83d\ude14\ud83d\ude0e\ud83d\ude07\ud83c\udf39\ud83e\udd26\ud83c\udf89\ud83d\udc9e\u270c\u2728\ud83e\udd37\ud83d\ude31\ud83d\ude0c\ud83c\udf38\ud83d\ude4c\ud83d\ude0b\ud83d\udc97\ud83d\udc9a\ud83d\ude0f\ud83d\udc9b\ud83d\ude42\ud83d\udc93\ud83e\udd29\ud83d\ude04\ud83d\ude00\ud83d\udda4\ud83d\ude03\ud83d\udcaf\ud83d\ude48\ud83d\udc47\ud83c\udfb6\ud83d\ude12\ud83e\udd2d\u2763\ud83d\ude1c\ud83d\udc8b\ud83d\udc40\ud83d\ude2a\ud83d\ude11\ud83d\udca5\ud83d\ude4b\ud83d\ude1e\ud83d\ude29\ud83d\ude21\ud83e\udd2a\ud83d\udc4a\ud83e\udd73\ud83d\ude25\ud83e\udd24\ud83d\udc49\ud83d\udc83\ud83d\ude33\u270b\ud83d\ude1a\ud83d\ude1d\ud83d\ude34\ud83c\udf1f\ud83d\ude2c\ud83d\ude43\ud83c\udf40\ud83c\udf37\ud83d\ude3b\ud83d\ude13\u2b50\u2705\ud83e\udd7a\ud83c\udf08\ud83d\ude08\ud83e\udd18\ud83d\udca6\u2714\ud83d\ude23\ud83c\udfc3\ud83d\udc90\u2639\ud83c\udf8a\ud83d\udc98\ud83d\ude20\u261d\ud83d\ude15\ud83c\udf3a\ud83c\udf82\ud83c\udf3b\ud83d\ude10\ud83d\udd95\ud83d\udc9d\ud83d\ude4a\ud83d\ude39\ud83d\udde3\ud83d\udcab\ud83d\udc80\ud83d\udc51\ud83c\udfb5\ud83e\udd1e\ud83d\ude1b\ud83d\udd34\ud83d\ude24\ud83c\udf3c\ud83d\ude2b\u26bd\ud83e\udd19\u2615\ud83c\udfc6\ud83e\udd2b\ud83d\udc48\ud83d\ude2e\ud83d\ude46\ud83c\udf7b\ud83c\udf43\ud83d\udc36\ud83d\udc81\ud83d\ude32\ud83c\udf3f\ud83e\udde1\ud83c\udf81\u26a1\ud83c\udf1e\ud83c\udf88\u274c\u270a\ud83d\udc4b\ud83d\ude30\ud83e\udd28\ud83d\ude36\ud83e\udd1d\ud83d\udeb6\ud83d\udcb0\ud83c\udf53\ud83d\udca2\ud83e\udd1f\ud83d\ude41\ud83d\udea8\ud83d\udca8\ud83e\udd2c\u2708\ud83c\udf80\ud83c\udf7a\ud83e\udd13\ud83d\ude19\ud83d\udc9f\ud83c\udf31\ud83d\ude16\ud83d\udc76\ud83e\udd74\u25b6\u27a1\u2753\ud83d\udc8e\ud83d\udcb8\u2b07\ud83d\ude28\ud83c\udf1a\ud83e\udd8b\ud83d\ude37\ud83d\udd7a\u26a0\ud83d\ude45\ud83d\ude1f\ud83d\ude35\ud83d\udc4e\ud83e\udd32\ud83e\udd20\ud83e\udd27\ud83d\udccc\ud83d\udd35\ud83d\udc85\ud83e\uddd0\ud83d\udc3e\ud83c\udf52\ud83d\ude17\ud83e\udd11\ud83c\udf0a\ud83e\udd2f\ud83d\udc37\u260e\ud83d\udca7\ud83d\ude2f\ud83d\udc86\ud83d\udc46\ud83c\udfa4\ud83d\ude47\ud83c\udf51\u2744\ud83c\udf34\ud83d\udca3\ud83d\udc38\ud83d\udc8c\ud83d\udccd\ud83e\udd40\ud83e\udd22\ud83d\udc45\ud83d\udca1\ud83d\udca9\ud83d\udc50\ud83d\udcf8\ud83d\udc7b\ud83e\udd10\ud83e\udd2e\ud83c\udfbc\ud83e\udd75\ud83d\udea9\ud83c\udf4e\ud83c\udf4a\ud83d\udc7c\ud83d\udc8d\ud83d\udce3\ud83e\udd42"),iU=rU.reduce(((e,t,n)=>(e[n]=t,e)),[]),oU=rU.reduce(((e,t,n)=>(e[t.codePointAt(0)]=n,e)),[]);const sU=_N({prefix:"\ud83d\ude80",name:"base256emoji",encode:function(e){return e.reduce(((e,t)=>e+=iU[t]),"")},decode:function(e){const t=[];for(const n of e){const e=oU[n.codePointAt(0)];if(void 0===e)throw new Error("Non-base256emoji character: ".concat(n));t.push(e)}return new Uint8Array(t)}});var aU=Object.freeze({__proto__:null,base256emoji:sU}),cU=function e(t,n,r){n=n||[];for(var i=r=r||0;t>=dU;)n[r++]=255&t|lU,t/=128;for(;t&uU;)n[r++]=255&t|lU,t>>>=7;return n[r]=0|t,e.bytes=r-i+1,n},lU=128,uU=-128,dU=Math.pow(2,31);var fU=function e(t,n){var r,i=0,o=(n=n||0,0),s=n,a=t.length;do{if(s>=a)throw e.bytes=0,new RangeError("Could not decode varint");r=t[s++],i+=o<28?(r&pU)<<o:(r&pU)*Math.pow(2,o),o+=7}while(r>=hU);return e.bytes=s-n,i},hU=128,pU=127;var gU=Math.pow(2,7),yU=Math.pow(2,14),mU=Math.pow(2,21),vU=Math.pow(2,28),bU=Math.pow(2,35),wU=Math.pow(2,42),EU=Math.pow(2,49),_U=Math.pow(2,56),SU=Math.pow(2,63),xU={encode:cU,decode:fU,encodingLength:function(e){return e<gU?1:e<yU?2:e<mU?3:e<vU?4:e<bU?5:e<wU?6:e<EU?7:e<_U?8:e<SU?9:10}};const IU=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return xU.encode(e,t,n),t},OU=e=>xU.encodingLength(e),AU=(e,t)=>{const n=t.byteLength,r=OU(e),i=r+OU(n),o=new Uint8Array(i+n);return IU(e,o,0),IU(n,o,r),o.set(t,i),new TU(e,n,t,o)};class TU{constructor(e,t,n,r){this.code=e,this.size=t,this.digest=n,this.bytes=r}}const RU=e=>{let{name:t,code:n,encode:r}=e;return new kU(t,n,r)};class kU{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?AU(this.code,t):t.then((e=>AU(this.code,e)))}throw Error("Unknown type, must be binary type")}}const PU=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),CU=RU({name:"sha2-256",code:18,encode:PU("SHA-256")}),NU=RU({name:"sha2-512",code:19,encode:PU("SHA-512")});Object.freeze({__proto__:null,sha256:CU,sha512:NU});const UU=yN,BU={code:0,name:"identity",encode:UU,digest:e=>AU(0,UU(e))};Object.freeze({__proto__:null,identity:BU});new TextEncoder,new TextDecoder;const LU={...ON,...TN,...kN,...CN,...BN,...KN,...YN,...QN,...nU,...aU};function DU(e){return null!=globalThis.Buffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}function jU(e,t,n,r){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:n},decoder:{decode:r}}}const MU=jU("utf8","u",(e=>"u"+new TextDecoder("utf8").decode(e)),(e=>(new TextEncoder).encode(e.substring(1)))),FU=jU("ascii","a",(e=>{let t="a";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t}),(e=>{const t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?DU(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}((e=e.substring(1)).length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t})),zU={utf8:MU,"utf-8":MU,hex:LU.base16,latin1:FU,ascii:FU,binary:FU,...LU};var qU=Object.defineProperty,HU=(e,t,n)=>((e,t,n)=>t in e?qU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);class VU{constructor(e,t){this.core=e,this.logger=t,HU(this,"keychain",new Map),HU(this,"name","keychain"),HU(this,"version","0.3"),HU(this,"initialized",!1),HU(this,"storagePrefix",UP),HU(this,"init",(async()=>{if(!this.initialized){const e=await this.getKeyChain();typeof e<"u"&&(this.keychain=e),this.initialized=!0}})),HU(this,"has",(e=>(this.isInitialized(),this.keychain.has(e)))),HU(this,"set",(async(e,t)=>{this.isInitialized(),this.keychain.set(e,t),await this.persist()})),HU(this,"get",(e=>{this.isInitialized();const t=this.keychain.get(e);if(typeof t>"u"){const{message:t}=xk("NO_MATCHING_KEY","".concat(this.name,": ").concat(e));throw new Error(t)}return t})),HU(this,"del",(async e=>{this.isInitialized(),this.keychain.delete(e),await this.persist()})),this.core=e,this.logger=mh(t,this.name)}get context(){return yh(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,fx(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?hx(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=xk("NOT_INITIALIZED",this.name);throw new Error(e)}}}var KU=Object.defineProperty,WU=(e,t,n)=>((e,t,n)=>t in e?KU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);class GU{constructor(e,t,n){this.core=e,this.logger=t,WU(this,"name","crypto"),WU(this,"keychain"),WU(this,"randomSessionIdentifier",NR()),WU(this,"initialized",!1),WU(this,"clientId"),WU(this,"init",(async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)})),WU(this,"hasKeys",(e=>(this.isInitialized(),this.keychain.has(e)))),WU(this,"getClientId",(async()=>{if(this.isInitialized(),this.clientId)return this.clientId;const e=im(am(await this.getClientSeed()).publicKey);return this.clientId=e,e})),WU(this,"generateKeyPair",(()=>{this.isInitialized();const e=function(){const e=GT.utils.randomPrivateKey(),t=GT.getPublicKey(e);return{privateKey:jS(e,_R),publicKey:jS(t,_R)}}();return this.setPrivateKey(e.publicKey,e.privateKey)})),WU(this,"signJWT",(async e=>{this.isInitialized();const t=am(await this.getClientSeed()),n=this.randomSessionIdentifier,r=jP;return await cm(n,e,r,t)})),WU(this,"generateSharedKey",((e,t,n)=>{this.isInitialized();const r=function(e,t){const n=GT.getSharedSecret(DS(e,_R),DS(t,_R));return jS(PA(CA,n,void 0,void 0,CR),_R)}(this.getPrivateKey(e),t);return this.setSymKey(r,n)})),WU(this,"setSymKey",(async(e,t)=>{this.isInitialized();const n=t||UR(e);return await this.keychain.set(n,e),n})),WU(this,"deleteKeyPair",(async e=>{this.isInitialized(),await this.keychain.del(e)})),WU(this,"deleteSymKey",(async e=>{this.isInitialized(),await this.keychain.del(e)})),WU(this,"encode",(async(e,t,n)=>{this.isInitialized();const r=qR(n),i=hf(t);if(VR(r))return function(e,t){const n=LR(TR),r=bI(PR),i=FR({type:n,sealed:DS(e,IR),iv:r});return t===xR?jR(i):i}(i,null===n||void 0===n?void 0:n.encoding);if(HR(r)){const t=r.senderPublicKey,n=r.receiverPublicKey;e=await this.generateSharedKey(t,n)}const o=this.getSymKey(e),{type:s,senderPublicKey:a}=r;return function(e){const t=LR(typeof e.type<"u"?e.type:OR);if(DR(t)===AR&&typeof e.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const n=typeof e.senderPublicKey<"u"?DS(e.senderPublicKey,_R):void 0,r=typeof e.iv<"u"?DS(e.iv,_R):bI(PR),i=DS(e.symKey,_R),o=FR({type:t,sealed:OA(i,r).encrypt(DS(e.message,IR)),iv:r,senderPublicKey:n});return e.encoding===xR?jR(o):o}({type:s,symKey:o,message:i,senderPublicKey:a,encoding:null===n||void 0===n?void 0:n.encoding})})),WU(this,"decode",(async(e,t,n)=>{this.isInitialized();const r=function(e,t){const n=zR({encoded:e,encoding:null===t||void 0===t?void 0:t.encoding});return qR({type:DR(n.type),senderPublicKey:typeof n.senderPublicKey<"u"?jS(n.senderPublicKey,_R):void 0,receiverPublicKey:null===t||void 0===t?void 0:t.receiverPublicKey})}(t,n);if(VR(r)){const e=function(e,t){const{sealed:n}=zR({encoded:e,encoding:t});return jS(n,IR)}(t,null===n||void 0===n?void 0:n.encoding);return ff(e)}if(HR(r)){const t=r.receiverPublicKey,n=r.senderPublicKey;e=await this.generateSharedKey(t,n)}try{const r=function(e){const t=DS(e.symKey,_R),{sealed:n,iv:r}=zR({encoded:e.encoded,encoding:e.encoding}),i=OA(t,r).decrypt(n);if(null===i)throw new Error("Failed to decrypt");return jS(i,IR)}({symKey:this.getSymKey(e),encoded:t,encoding:null===n||void 0===n?void 0:n.encoding});return ff(r)}catch(Ge){this.logger.error("Failed to decode message from topic: '".concat(e,"', clientId: '").concat(await this.getClientId(),"'")),this.logger.error(Ge)}})),WU(this,"getPayloadType",(function(e){return DR(zR({encoded:e,encoding:arguments.length>1&&void 0!==arguments[1]?arguments[1]:SR}).type)})),WU(this,"getPayloadSenderPublicKey",(function(e){const t=zR({encoded:e,encoding:arguments.length>1&&void 0!==arguments[1]?arguments[1]:SR});return t.senderPublicKey?jS(t.senderPublicKey,_R):void 0})),this.core=e,this.logger=mh(t,this.name),this.keychain=n||new VU(this.core,this.logger)}get context(){return yh(this.logger)}async setPrivateKey(e,t){return await this.keychain.set(e,t),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(DP)}catch{e=NR(),await this.keychain.set(DP,e)}return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf8";const n=zU[t];if(!n)throw new Error('Unsupported encoding "'.concat(t,'"'));return"utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?n.decoder.decode("".concat(n.prefix).concat(e)):DU(globalThis.Buffer.from(e,"utf-8"))}(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=xk("NOT_INITIALIZED",this.name);throw new Error(e)}}}var YU=Object.defineProperty,ZU=Object.defineProperties,XU=Object.getOwnPropertyDescriptors,QU=Object.getOwnPropertySymbols,JU=Object.prototype.hasOwnProperty,$U=Object.prototype.propertyIsEnumerable,eB=(e,t,n)=>t in e?YU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,tB=(e,t,n)=>eB(e,"symbol"!=typeof t?t+"":t,n);class nB extends Ih{constructor(e,t){super(e,t),this.logger=e,this.core=t,tB(this,"messages",new Map),tB(this,"messagesWithoutClientAck",new Map),tB(this,"name","messages"),tB(this,"version","0.3"),tB(this,"initialized",!1),tB(this,"storagePrefix",UP),tB(this,"init",(async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const e=await this.getRelayerMessages();typeof e<"u"&&(this.messages=e);const t=await this.getRelayerMessagesWithoutClientAck();typeof t<"u"&&(this.messagesWithoutClientAck=t),this.logger.debug("Successfully Restored records for ".concat(this.name)),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(Qu){this.logger.debug("Failed to Restore records for ".concat(this.name)),this.logger.error(Qu)}finally{this.initialized=!0}}})),tB(this,"set",(async(e,t,n)=>{this.isInitialized();const r=BR(t);let i=this.messages.get(e);if(typeof i>"u"&&(i={}),typeof i[r]<"u")return r;if(i[r]=t,this.messages.set(e,i),n===eC){const n=this.messagesWithoutClientAck.get(e)||{};this.messagesWithoutClientAck.set(e,((e,t)=>ZU(e,XU(t)))(((e,t)=>{for(var n in t||(t={}))JU.call(t,n)&&eB(e,n,t[n]);if(QU)for(var n of QU(t))$U.call(t,n)&&eB(e,n,t[n]);return e})({},n),{[r]:t}))}return await this.persist(),r})),tB(this,"get",(e=>{this.isInitialized();let t=this.messages.get(e);return typeof t>"u"&&(t={}),t})),tB(this,"getWithoutAck",(e=>{this.isInitialized();const t={};for(const n of e){const e=this.messagesWithoutClientAck.get(n)||{};t[n]=Object.values(e)}return t})),tB(this,"has",((e,t)=>{this.isInitialized();return typeof this.get(e)[BR(t)]<"u"})),tB(this,"ack",(async(e,t)=>{this.isInitialized();const n=this.messagesWithoutClientAck.get(e);if(typeof n>"u")return;delete n[BR(t)],0===Object.keys(n).length?this.messagesWithoutClientAck.delete(e):this.messagesWithoutClientAck.set(e,n),await this.persist()})),tB(this,"del",(async e=>{this.isInitialized(),this.messages.delete(e),this.messagesWithoutClientAck.delete(e),await this.persist()})),this.logger=mh(e,this.name),this.core=t}get context(){return yh(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get storageKeyWithoutClientAck(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name+"_withoutClientAck"}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,fx(e))}async setRelayerMessagesWithoutClientAck(e){await this.core.storage.setItem(this.storageKeyWithoutClientAck,fx(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?hx(e):void 0}async getRelayerMessagesWithoutClientAck(){const e=await this.core.storage.getItem(this.storageKeyWithoutClientAck);return typeof e<"u"?hx(e):void 0}async persist(){await this.setRelayerMessages(this.messages),await this.setRelayerMessagesWithoutClientAck(this.messagesWithoutClientAck)}isInitialized(){if(!this.initialized){const{message:e}=xk("NOT_INITIALIZED",this.name);throw new Error(e)}}}var rB=Object.defineProperty,iB=Object.defineProperties,oB=Object.getOwnPropertyDescriptors,sB=Object.getOwnPropertySymbols,aB=Object.prototype.hasOwnProperty,cB=Object.prototype.propertyIsEnumerable,lB=(e,t,n)=>t in e?rB(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,uB=(e,t)=>{for(var n in t||(t={}))aB.call(t,n)&&lB(e,n,t[n]);if(sB)for(var n of sB(t))cB.call(t,n)&&lB(e,n,t[n]);return e},dB=(e,t)=>iB(e,oB(t)),fB=(e,t,n)=>lB(e,"symbol"!=typeof t?t+"":t,n);class hB extends Oh{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,fB(this,"events",new ir.EventEmitter),fB(this,"name","publisher"),fB(this,"queue",new Map),fB(this,"publishTimeout",(0,Bd.toMiliseconds)(Bd.ONE_MINUTE)),fB(this,"initialPublishTimeout",(0,Bd.toMiliseconds)(15*Bd.ONE_SECOND)),fB(this,"needsTransportRestart",!1),fB(this,"publish",(async(e,t,n)=>{var r,i,o,s,a;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:e,message:t,opts:n}});const c=(null===n||void 0===n?void 0:n.ttl)||MP,l=(null===n||void 0===n?void 0:n.prompt)||!1,u=(null===n||void 0===n?void 0:n.tag)||0,d=(null===n||void 0===n?void 0:n.id)||hP().toString(),f=GR(WR().protocol),h={id:d,method:(null===n||void 0===n?void 0:n.publishMethod)||f.publish,params:uB({topic:e,message:t,ttl:c,prompt:l,tag:u,attestation:null===n||void 0===n?void 0:n.attestation},null===n||void 0===n?void 0:n.tvf)},p="Failed to publish payload, please try again. id:".concat(d," tag:").concat(u);try{Tk(null==(r=h.params)?void 0:r.prompt)&&(null==(i=h.params)||delete i.prompt),Tk(null==(o=h.params)?void 0:o.tag)&&(null==(s=h.params)||delete s.tag);const a=new Promise((async e=>{const t=n=>{let{id:r}=n;var i;(null==(i=h.id)?void 0:i.toString())===r.toString()&&(this.removeRequestFromQueue(r),this.relayer.events.removeListener(GP,t),e())};this.relayer.events.on(GP,t);const r=gx(new Promise(((e,t)=>{this.rpcPublish(h,n).then(e).catch((e=>{this.logger.warn(e,null===e||void 0===e?void 0:e.message),t(e)}))})),this.initialPublishTimeout,"Failed initial publish, retrying.... id:".concat(d," tag:").concat(u));try{await r,this.events.removeListener(GP,t)}catch(nt){this.queue.set(d,{request:h,opts:n,attempt:1}),this.logger.warn(nt,null===nt||void 0===nt?void 0:nt.message)}}));this.logger.trace({type:"method",method:"publish",params:{id:d,topic:e,message:t,opts:n}}),await gx(a,this.publishTimeout,p)}catch(ut){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(ut),null!=(a=null===n||void 0===n?void 0:n.internal)&&a.throwOnFailedPublish)throw ut}finally{this.queue.delete(d)}})),fB(this,"publishCustom",(async e=>{var t,n,r,i,o;this.logger.debug("Publishing custom payload"),this.logger.trace({type:"method",method:"publishCustom",params:e});const{payload:s,opts:a={}}=e,{attestation:c,tvf:l,publishMethod:u,prompt:d,tag:f,ttl:h=Bd.FIVE_MINUTES}=a,p=a.id||hP().toString(),g=GR(WR().protocol),y=u||g.publish,m={id:p,method:y,params:uB(dB(uB({},s),{ttl:h,prompt:d,tag:f,attestation:c}),l)},v="Failed to publish custom payload, please try again. id:".concat(p," tag:").concat(f);try{Tk(null==(t=m.params)?void 0:t.prompt)&&(null==(n=m.params)||delete n.prompt),Tk(null==(r=m.params)?void 0:r.tag)&&(null==(i=m.params)||delete i.tag);const e=new Promise((async e=>{const t=n=>{let{id:r}=n;var i;(null==(i=m.id)?void 0:i.toString())===r.toString()&&(this.removeRequestFromQueue(r),this.relayer.events.removeListener(GP,t),e())};this.relayer.events.on(GP,t);const n=gx(new Promise(((e,t)=>{this.rpcPublish(m,a).then(e).catch((e=>{this.logger.warn(e,null===e||void 0===e?void 0:e.message),t(e)}))})),this.initialPublishTimeout,"Failed initial custom payload publish, retrying.... method:".concat(y," id:").concat(p," tag:").concat(f));try{await n,this.events.removeListener(GP,t)}catch(r){this.queue.set(p,{request:m,opts:a,attempt:1}),this.logger.warn(r,null===r||void 0===r?void 0:r.message)}}));this.logger.trace({type:"method",method:"publish",params:{id:p,payload:s,opts:a}}),await gx(e,this.publishTimeout,v)}catch(nt){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(nt),null!=(o=null===a||void 0===a?void 0:a.internal)&&o.throwOnFailedPublish)throw nt}finally{this.queue.delete(p)}})),fB(this,"on",((e,t)=>{this.events.on(e,t)})),fB(this,"once",((e,t)=>{this.events.once(e,t)})),fB(this,"off",((e,t)=>{this.events.off(e,t)})),fB(this,"removeListener",((e,t)=>{this.events.removeListener(e,t)})),this.relayer=e,this.logger=mh(t,this.name),this.registerEventListeners()}get context(){return yh(this.logger)}async rpcPublish(e,t){this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:e});const n=await this.relayer.request(e);return this.relayer.events.emit(GP,uB(uB({},e),t)),this.logger.debug("Successfully Published Payload"),n}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach((async(e,t)=>{var n;const r=e.attempt+1;this.queue.set(t,dB(uB({},e),{attempt:r})),this.logger.warn({},"Publisher: queue->publishing: ".concat(e.request.id,", tag: ").concat(null==(n=e.request.params)?void 0:n.tag,", attempt: ").concat(r)),await this.rpcPublish(e.request,e.opts),this.logger.warn({},"Publisher: queue->published: ".concat(e.request.id))}))}registerEventListeners(){this.relayer.core.heartbeat.on(Md,(()=>{if(this.needsTransportRestart)return this.needsTransportRestart=!1,void this.relayer.events.emit(WP);this.checkQueue()})),this.relayer.on(qP,(e=>{this.removeRequestFromQueue(e.id.toString())}))}}var pB=Object.defineProperty,gB=(e,t,n)=>((e,t,n)=>t in e?pB(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);class yB{constructor(){gB(this,"map",new Map),gB(this,"set",((e,t)=>{const n=this.get(e);this.exists(e,t)||this.map.set(e,[...n,t])})),gB(this,"get",(e=>this.map.get(e)||[])),gB(this,"exists",((e,t)=>this.get(e).includes(t))),gB(this,"delete",((e,t)=>{if(typeof t>"u")return void this.map.delete(e);if(!this.map.has(e))return;const n=this.get(e);if(!this.exists(e,t))return;const r=n.filter((e=>e!==t));r.length?this.map.set(e,r):this.map.delete(e)})),gB(this,"clear",(()=>{this.map.clear()}))}get topics(){return Array.from(this.map.keys())}}var mB=Object.defineProperty,vB=Object.defineProperties,bB=Object.getOwnPropertyDescriptors,wB=Object.getOwnPropertySymbols,EB=Object.prototype.hasOwnProperty,_B=Object.prototype.propertyIsEnumerable,SB=(e,t,n)=>t in e?mB(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xB=(e,t)=>{for(var n in t||(t={}))EB.call(t,n)&&SB(e,n,t[n]);if(wB)for(var n of wB(t))_B.call(t,n)&&SB(e,n,t[n]);return e},IB=(e,t)=>vB(e,bB(t)),OB=(e,t,n)=>SB(e,"symbol"!=typeof t?t+"":t,n);class AB extends Rh{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,OB(this,"subscriptions",new Map),OB(this,"topicMap",new yB),OB(this,"events",new ir.EventEmitter),OB(this,"name","subscription"),OB(this,"version","0.3"),OB(this,"pending",new Map),OB(this,"cached",[]),OB(this,"initialized",!1),OB(this,"storagePrefix",UP),OB(this,"subscribeTimeout",(0,Bd.toMiliseconds)(Bd.ONE_MINUTE)),OB(this,"initialSubscribeTimeout",(0,Bd.toMiliseconds)(15*Bd.ONE_SECOND)),OB(this,"clientId"),OB(this,"batchSubscribeTopicsLimit",500),OB(this,"init",(async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),await this.restore()),this.initialized=!0})),OB(this,"subscribe",(async(e,t)=>{var n;this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:e,opts:t}});try{const r=WR(t),i={topic:e,relay:r,transportType:null===t||void 0===t?void 0:t.transportType};null!=(n=null===t||void 0===t?void 0:t.internal)&&n.skipSubscribe||this.pending.set(e,i);const o=await this.rpcSubscribe(e,r,t);return"string"==typeof o&&(this.onSubscribe(o,i),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:e,opts:t}})),o}catch(Ju){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(Ju),Ju}})),OB(this,"unsubscribe",(async(e,t)=>{this.isInitialized(),typeof(null===t||void 0===t?void 0:t.id)<"u"?await this.unsubscribeById(e,t.id,t):await this.unsubscribeByTopic(e,t)})),OB(this,"isSubscribed",(e=>new Promise((t=>{t(this.topicMap.topics.includes(e))})))),OB(this,"isKnownTopic",(e=>new Promise((t=>{t(this.topicMap.topics.includes(e)||this.pending.has(e)||this.cached.some((t=>t.topic===e)))})))),OB(this,"on",((e,t)=>{this.events.on(e,t)})),OB(this,"once",((e,t)=>{this.events.once(e,t)})),OB(this,"off",((e,t)=>{this.events.off(e,t)})),OB(this,"removeListener",((e,t)=>{this.events.removeListener(e,t)})),OB(this,"start",(async()=>{await this.onConnect()})),OB(this,"stop",(async()=>{await this.onDisconnect()})),OB(this,"restart",(async()=>{await this.restore(),await this.onRestart()})),OB(this,"checkPending",(async()=>{if(0===this.pending.size&&(!this.initialized||!this.relayer.connected))return;const e=[];this.pending.forEach((t=>{e.push(t)})),await this.batchSubscribe(e)})),OB(this,"registerEventListeners",(()=>{this.relayer.core.heartbeat.on(Md,(async()=>{await this.checkPending()})),this.events.on(rC,(async e=>{const t=rC;this.logger.info("Emitting ".concat(t)),this.logger.debug({type:"event",event:t,data:e}),await this.persist()})),this.events.on(iC,(async e=>{const t=iC;this.logger.info("Emitting ".concat(t)),this.logger.debug({type:"event",event:t,data:e}),await this.persist()}))})),this.relayer=e,this.logger=mh(t,this.name),this.clientId=""}get context(){return yh(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}get hasAnyTopics(){return this.topicMap.topics.length>0||this.pending.size>0||this.cached.length>0||this.subscriptions.size>0}hasSubscription(e,t){let n=!1;try{n=this.getSubscription(e).topic===t}catch{}return n}reset(){this.cached=[],this.initialized=!0}onDisable(){this.values.length>0&&(this.cached=this.values),this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,t){const n=this.topicMap.get(e);await Promise.all(n.map((async n=>await this.unsubscribeById(e,n,t))))}async unsubscribeById(e,t,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:n}});try{const r=WR(n);await this.restartToComplete({topic:e,id:t,relay:r}),await this.rpcUnsubscribe(e,t,r);const i=Ik("USER_DISCONNECTED","".concat(this.name,", ").concat(e));await this.onUnsubscribe(e,t,i),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:n}})}catch(We){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(We),We}}async rpcSubscribe(e,t,n){var r,i;const o=await this.getSubscriptionId(e);if(null!=(r=null===n||void 0===n?void 0:n.internal)&&r.skipSubscribe)return o;(!n||(null===n||void 0===n?void 0:n.transportType)===$P.relay)&&await this.restartToComplete({topic:e,id:e,relay:t});const s={method:GR(t.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s});const a=null==(i=null===n||void 0===n?void 0:n.internal)?void 0:i.throwOnFailedPublish;try{if((null===n||void 0===n?void 0:n.transportType)===$P.link_mode)return setTimeout((()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(s).catch((e=>this.logger.warn(e)))}),(0,Bd.toMiliseconds)(Bd.ONE_SECOND)),o;const t=new Promise((async t=>{const n=r=>{r.topic===e&&(this.events.removeListener(rC,n),t(r.id))};this.events.on(rC,n);try{const r=await gx(new Promise(((e,t)=>{this.relayer.request(s).catch((e=>{this.logger.warn(e,null===e||void 0===e?void 0:e.message),t(e)})).then(e)})),this.initialSubscribeTimeout,"Subscribing to ".concat(e," failed, please try again"));this.events.removeListener(rC,n),t(r)}catch{}})),r=await gx(t,this.subscribeTimeout,"Subscribing to ".concat(e," failed, please try again"));if(!r&&a)throw new Error("Subscribing to ".concat(e," failed, please try again"));return r?o:null}catch($e){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(WP),a)throw $e}return null}async rpcBatchSubscribe(e){if(!e.length)return;const t={method:GR(e[0].relay.protocol).batchSubscribe,params:{topics:e.map((e=>e.topic))}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:t});try{await await gx(new Promise((e=>{this.relayer.request(t).catch((e=>this.logger.warn(e))).then(e)})),this.subscribeTimeout,"rpcBatchSubscribe failed, please try again")}catch{this.relayer.events.emit(WP)}}async rpcBatchFetchMessages(e){if(!e.length)return;const t={method:GR(e[0].relay.protocol).batchFetchMessages,params:{topics:e.map((e=>e.topic))}};let n;this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:t});try{n=await await gx(new Promise(((e,n)=>{this.relayer.request(t).catch((e=>{this.logger.warn(e),n(e)})).then(e)})),this.subscribeTimeout,"rpcBatchFetchMessages failed, please try again")}catch{this.relayer.events.emit(WP)}return n}rpcUnsubscribe(e,t,n){const r={method:GR(n.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r}),this.relayer.request(r)}onSubscribe(e,t){this.setSubscription(e,IB(xB({},t),{id:e})),this.pending.delete(t.topic)}onBatchSubscribe(e){e.length&&e.forEach((e=>{this.setSubscription(e.id,xB({},e)),this.pending.delete(e.topic)}))}async onUnsubscribe(e,t,n){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,t){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:t}),this.addSubscription(e,t)}addSubscription(e,t){this.subscriptions.set(e,xB({},t)),this.topicMap.set(t.topic,e),this.events.emit(rC,t)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const t=this.subscriptions.get(e);if(!t){const{message:t}=xk("NO_MATCHING_KEY","".concat(this.name,": ").concat(e));throw new Error(t)}return t}deleteSubscription(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});const n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(iC,IB(xB({},n),{reason:t}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(oC)}async onRestart(){if(this.cached.length){const e=[...this.cached],t=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let n=0;n<t;n++){const t=e.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(t)}}this.events.emit(sC)}async restore(){try{const e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size&&!e.every((e=>{var t;return e.topic===(null==(t=this.subscriptions.get(e.id))?void 0:t.topic)}))){const{message:e}=xk("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),this.logger.error("".concat(this.name,": ").concat(JSON.stringify(this.values))),new Error(e)}this.cached=e,this.logger.debug("Successfully Restored subscriptions for ".concat(this.name)),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(Mz){this.logger.debug("Failed to Restore subscriptions for ".concat(this.name)),this.logger.error(Mz)}}async batchSubscribe(e){e.length&&(await this.rpcBatchSubscribe(e),this.onBatchSubscribe(await Promise.all(e.map((async e=>IB(xB({},e),{id:await this.getSubscriptionId(e.topic)}))))))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace("Fetching batch messages for ".concat(e.length," subscriptions"));const t=await this.rpcBatchFetchMessages(e);t&&t.messages&&(await function(e){return new Promise((t=>setTimeout(t,e)))}((0,Bd.toMiliseconds)(Bd.ONE_SECOND)),await this.relayer.handleBatchMessageEvents(t.messages))}async onConnect(){await this.restart(),this.reset()}onDisconnect(){this.onDisable()}isInitialized(){if(!this.initialized){const{message:e}=xk("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(e){!this.relayer.connected&&!this.relayer.connecting&&(this.cached.push(e),await this.relayer.transportOpen())}async getClientId(){return this.clientId||(this.clientId=await this.relayer.core.crypto.getClientId()),this.clientId}async getSubscriptionId(e){return BR(e+await this.getClientId())}}var TB=Object.defineProperty,RB=Object.getOwnPropertySymbols,kB=Object.prototype.hasOwnProperty,PB=Object.prototype.propertyIsEnumerable,CB=(e,t,n)=>t in e?TB(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,NB=(e,t)=>{for(var n in t||(t={}))kB.call(t,n)&&CB(e,n,t[n]);if(RB)for(var n of RB(t))PB.call(t,n)&&CB(e,n,t[n]);return e},UB=(e,t,n)=>CB(e,"symbol"!=typeof t?t+"":t,n);class BB extends Ah{constructor(e){var t;super(e),UB(this,"protocol","wc"),UB(this,"version",2),UB(this,"core"),UB(this,"logger"),UB(this,"events",new ir.EventEmitter),UB(this,"provider"),UB(this,"messages"),UB(this,"subscriber"),UB(this,"publisher"),UB(this,"name","relayer"),UB(this,"transportExplicitlyClosed",!1),UB(this,"initialized",!1),UB(this,"connectionAttemptInProgress",!1),UB(this,"relayUrl"),UB(this,"projectId"),UB(this,"packageName"),UB(this,"bundleId"),UB(this,"hasExperiencedNetworkDisruption",!1),UB(this,"pingTimeout"),UB(this,"heartBeatTimeout",(0,Bd.toMiliseconds)(Bd.THIRTY_SECONDS+Bd.FIVE_SECONDS)),UB(this,"reconnectTimeout"),UB(this,"connectPromise"),UB(this,"reconnectInProgress",!1),UB(this,"requestsInFlight",[]),UB(this,"connectTimeout",(0,Bd.toMiliseconds)(15*Bd.ONE_SECOND)),UB(this,"request",(async e=>{var t,n;this.logger.debug("Publishing Request Payload");const r=e.id||hP().toString();await this.toEstablishConnection();try{this.logger.trace({id:r,method:e.method,topic:null==(t=e.params)?void 0:t.topic},"relayer.request - publishing...");const i="".concat(r,":").concat((null==(n=e.params)?void 0:n.tag)||"");this.requestsInFlight.push(i);const o=await this.provider.request(e);return this.requestsInFlight=this.requestsInFlight.filter((e=>e!==i)),o}catch(Ke){throw this.logger.debug("Failed to Publish Request: ".concat(r)),Ke}})),UB(this,"resetPingTimeout",(()=>{nx()&&(clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout((()=>{var e,t,n,r;try{this.logger.debug({},"pingTimeout: Connection stalled, terminating..."),null==(r=null==(n=null==(t=null==(e=this.provider)?void 0:e.connection)?void 0:t.socket)?void 0:n.terminate)||r.call(n)}catch(Ke){this.logger.warn(Ke,null===Ke||void 0===Ke?void 0:Ke.message)}}),this.heartBeatTimeout))})),UB(this,"onPayloadHandler",(e=>{this.onProviderPayload(e),this.resetPingTimeout()})),UB(this,"onConnectHandler",(()=>{this.logger.warn({},"Relayer connected \ud83d\udedc"),this.startPingTimeout(),this.events.emit(HP)})),UB(this,"onDisconnectHandler",(()=>{this.logger.warn({},"Relayer disconnected \ud83d\uded1"),this.requestsInFlight=[],this.onProviderDisconnect()})),UB(this,"onProviderErrorHandler",(e=>{this.logger.fatal("Fatal socket error: ".concat(e.message)),this.events.emit(KP,e),this.logger.fatal("Fatal socket error received, closing transport"),this.transportExplicitlyClosed=!0,clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0,this.reconnectInProgress=!1,this.transportClose().catch((e=>this.logger.warn(e)))})),UB(this,"registerProviderListeners",(()=>{this.provider.on(YP,this.onPayloadHandler),this.provider.on(ZP,this.onConnectHandler),this.provider.on(XP,this.onDisconnectHandler),this.provider.on(QP,this.onProviderErrorHandler)})),this.core=e.core,this.logger=Qk({logger:null!=(t=e.logger)?t:"error",name:this.name}),this.messages=new nB(this.logger,e.core),this.subscriber=new AB(this,this.logger),this.publisher=new hB(this,this.logger),this.projectId=null===e||void 0===e?void 0:e.projectId,this.relayUrl=(null===e||void 0===e?void 0:e.relayUrl)||FP,rx()&&typeof global<"u"&&typeof(null==global?void 0:global.Platform)<"u"&&"android"===(null==global?void 0:global.Platform.OS)?this.packageName=sx():rx()&&typeof global<"u"&&typeof(null==global?void 0:global.Platform)<"u"&&"ios"===(null==global?void 0:global.Platform.OS)&&(this.bundleId=sx()),this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.transportOpen().catch((e=>this.logger.warn(e,null===e||void 0===e?void 0:e.message)))}get context(){return yh(this.logger)}get connected(){var e,t,n;return 1===(null==(n=null==(t=null==(e=this.provider)?void 0:e.connection)?void 0:t.socket)?void 0:n.readyState)||!1}get connecting(){var e,t,n;return 0===(null==(n=null==(t=null==(e=this.provider)?void 0:e.connection)?void 0:t.socket)?void 0:n.readyState)||void 0!==this.connectPromise||!1}async publish(e,t,n){this.isInitialized(),await this.publisher.publish(e,t,n),await this.recordMessageEvent({topic:e,message:t,publishedAt:Date.now(),transportType:$P.relay},tC)}async publishCustom(e){this.isInitialized(),await this.publisher.publishCustom(e)}async subscribe(e,t){var n,r,i;this.isInitialized(),(null==t||!t.transportType||"relay"===(null===t||void 0===t?void 0:t.transportType))&&await this.toEstablishConnection();const o=typeof(null==(n=null===t||void 0===t?void 0:t.internal)?void 0:n.throwOnFailedPublish)>"u"||(null==(r=null===t||void 0===t?void 0:t.internal)?void 0:r.throwOnFailedPublish);let s,a=(null==(i=this.subscriber.topicMap.get(e))?void 0:i[0])||"";const c=t=>{t.topic===e&&(this.subscriber.off(rC,c),s())};return await Promise.all([new Promise((e=>{s=e,this.subscriber.on(rC,c)})),new Promise((async(n,r)=>{a=await this.subscriber.subscribe(e,NB({internal:{throwOnFailedPublish:o}},t)).catch((e=>{o&&r(e)}))||a,n()}))]),a}async unsubscribe(e,t){this.isInitialized(),await this.subscriber.unsubscribe(e,t)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async transportDisconnect(){this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await gx(this.provider.disconnect(),2e3,"provider.disconnect()").catch((()=>this.onProviderDisconnect())):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0,this.reconnectInProgress=!1,await this.transportDisconnect()}async transportOpen(e){if(this.subscriber.hasAnyTopics){if(this.connectPromise?(this.logger.debug({},"Waiting for existing connection attempt to resolve..."),await this.connectPromise,this.logger.debug({},"Existing connection attempt resolved")):(this.connectPromise=new Promise((async(t,n)=>{await this.connect(e).then(t).catch(n).finally((()=>{this.connectPromise=void 0}))})),await this.connectPromise),!this.connected)throw new Error("Couldn't establish socket connection to the relay server: ".concat(this.relayUrl))}else this.logger.info("Starting WS connection skipped because the client has no topics to work with.")}async restartTransport(e){this.logger.debug({},"Restarting transport..."),!this.connectionAttemptInProgress&&(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await Vk())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if(0===(null===e||void 0===e?void 0:e.length))return void this.logger.trace("Batch message events is empty. Ignoring...");const t=e.sort(((e,t)=>e.publishedAt-t.publishedAt));this.logger.debug("Batch of ".concat(t.length," message events sorted"));for(const n of t)try{await this.onMessageEvent(n)}catch(We){this.logger.warn(We,"Error while processing batch message event: "+(null===We||void 0===We?void 0:We.message))}this.logger.trace("Batch of ".concat(t.length," message events processed"))}async onLinkMessageEvent(e,t){const{topic:n}=e;if(!t.sessionExists){const e={topic:n,expiry:vx(Bd.FIVE_MINUTES),relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(n,e)}this.events.emit(zP,e),await this.recordMessageEvent(e,eC)}async connect(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;let t=1;for(;t<6;){try{if(this.transportExplicitlyClosed)break;this.logger.debug({},"Connecting to ".concat(this.relayUrl,", attempt: ").concat(t,"...")),await this.createProvider(),await new Promise((async(e,t)=>{const n=()=>{t(new Error("Connection interrupted while trying to connect"))};this.provider.once(XP,n),await gx(new Promise(((e,t)=>{this.provider.connect().then(e).catch(t)})),this.connectTimeout,"Socket stalled when trying to connect to ".concat(this.relayUrl)).catch((e=>{t(e)})).finally((()=>{this.provider.off(XP,n),clearTimeout(this.reconnectTimeout)})),await new Promise((async(e,n)=>{const r=()=>{t(new Error("Connection interrupted while trying to subscribe"))};this.provider.once(XP,r),await this.subscriber.start().then(e).catch(n).finally((()=>{this.provider.off(XP,r)}))})),this.hasExperiencedNetworkDisruption=!1,e()}))}catch(Qu){await this.subscriber.stop();const t=Qu;this.logger.warn({},t.message),this.hasExperiencedNetworkDisruption=!0}finally{this.connectionAttemptInProgress=!1}if(this.connected){this.logger.debug({},"Connected to ".concat(this.relayUrl," successfully on attempt: ").concat(t));break}await new Promise((e=>setTimeout(e,(0,Bd.toMiliseconds)(1*t)))),t++}}startPingTimeout(){var e,t,n,r,i;if(nx())try{null!=(t=null==(e=this.provider)?void 0:e.connection)&&t.socket&&(null==(i=null==(r=null==(n=this.provider)?void 0:n.connection)?void 0:r.socket)||i.on("ping",(()=>{this.resetPingTimeout()}))),this.resetPingTimeout()}catch(Ju){this.logger.warn(Ju,null===Ju||void 0===Ju?void 0:Ju.message)}}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new RP(new CP(ux({sdkVersion:JP,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId,packageName:this.packageName}))),this.registerProviderListeners()}async recordMessageEvent(e,t){const{topic:n,message:r}=e;await this.messages.set(n,r,t)}async shouldIgnoreMessageEvent(e){const{topic:t,message:n}=e;if(!n||0===n.length)return this.logger.warn("Ignoring invalid/empty message: ".concat(n)),!0;if(!await this.subscriber.isKnownTopic(t))return this.logger.warn("Ignoring message for unknown topic ".concat(t)),!0;const r=this.messages.has(t,n);return r&&this.logger.warn("Ignoring duplicate message: ".concat(n)),r}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),IP(e)){if(!e.method.endsWith("_subscription"))return;const t=e.params,{topic:n,message:r,publishedAt:i,attestation:o}=t.data,s={topic:n,message:r,publishedAt:i,transportType:$P.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(NB({type:"event",event:t.id},s)),this.events.emit(t.id,s),await this.acknowledgePayload(e),await this.onMessageEvent(s)}else OP(e)&&this.events.emit(qP,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(await this.recordMessageEvent(e,eC),this.events.emit(zP,e))}async acknowledgePayload(e){const t=gP(e.id,!0);await this.provider.connection.send(t)}unregisterProviderListeners(){this.provider.off(YP,this.onPayloadHandler),this.provider.off(ZP,this.onConnectHandler),this.provider.off(XP,this.onDisconnectHandler),this.provider.off(QP,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await Vk();Kk((async t=>{e!==t&&(e=t,t?await this.transportOpen().catch((e=>this.logger.error(e,null===e||void 0===e?void 0:e.message))):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})),this.core.heartbeat.on(Md,(async()=>{if(!this.transportExplicitlyClosed&&!this.connected&&function(){var e;return!ix()||!(0,_m.getDocument)()||"visible"===(null==(e=(0,_m.getDocument)())?void 0:e.visibilityState)}())try{await this.confirmOnlineStateOrThrow(),await this.transportOpen()}catch(e){this.logger.warn(e,null===e||void 0===e?void 0:e.message)}}))}async onProviderDisconnect(){clearTimeout(this.pingTimeout),this.events.emit(VP),this.connectionAttemptInProgress=!1,!this.reconnectInProgress&&(this.reconnectInProgress=!0,await this.subscriber.stop(),this.subscriber.hasAnyTopics&&(this.transportExplicitlyClosed||(this.reconnectTimeout=setTimeout((async()=>{await this.transportOpen().catch((e=>this.logger.error(e,null===e||void 0===e?void 0:e.message))),this.reconnectTimeout=void 0,this.reconnectInProgress=!1}),(0,Bd.toMiliseconds)(.1)))))}isInitialized(){if(!this.initialized){const{message:e}=xk("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectPromise)return void await this.connectPromise;await this.connect()}}}function LB(e){return Object.getOwnPropertySymbols(e).filter((t=>Object.prototype.propertyIsEnumerable.call(e,t)))}function DB(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const jB="[object RegExp]",MB="[object String]",FB="[object Number]",zB="[object Boolean]",qB="[object Arguments]",HB="[object Symbol]",VB="[object Date]",KB="[object Map]",WB="[object Set]",GB="[object Array]",YB="[object Function]",ZB="[object ArrayBuffer]",XB="[object Object]",QB="[object Error]",JB="[object DataView]",$B="[object Uint8Array]",eL="[object Uint8ClampedArray]",tL="[object Uint16Array]",nL="[object Uint32Array]",rL="[object BigUint64Array]",iL="[object Int8Array]",oL="[object Int16Array]",sL="[object Int32Array]",aL="[object BigInt64Array]",cL="[object Float32Array]",lL="[object Float64Array]";function uL(e){if(!e||"object"!=typeof e)return!1;const t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&"[object Object]"===Object.prototype.toString.call(e)}function dL(e,t,n,r,i,o,s){const a=s(e,t,n,r,i,o);if(void 0!==a)return a;if(typeof e==typeof t)switch(typeof e){case"bigint":case"string":case"boolean":case"symbol":case"undefined":case"function":return e===t;case"number":return e===t||Object.is(e,t);case"object":return fL(e,t,o,s)}return fL(e,t,o,s)}function fL(e,t,n,r){var i;if(Object.is(e,t))return!0;let o=DB(e),s=DB(t);if(o===qB&&(o=XB),s===qB&&(s=XB),o!==s)return!1;switch(o){case MB:return e.toString()===t.toString();case FB:return function(e,t){return e===t||Number.isNaN(e)&&Number.isNaN(t)}(e.valueOf(),t.valueOf());case zB:case VB:case HB:return Object.is(e.valueOf(),t.valueOf());case jB:return e.source===t.source&&e.flags===t.flags;case YB:return e===t}const a=(n=null!==(i=n)&&void 0!==i?i:new Map).get(e),c=n.get(t);if(null!=a&&null!=c)return a===t;n.set(e,t),n.set(t,e);try{switch(o){case KB:if(e.size!==t.size)return!1;for(const[i,o]of e.entries())if(!t.has(i)||!dL(o,t.get(i),i,e,t,n,r))return!1;return!0;case WB:{if(e.size!==t.size)return!1;const i=Array.from(e.values()),o=Array.from(t.values());for(let s=0;s<i.length;s++){const a=i[s],c=o.findIndex((i=>dL(a,i,void 0,e,t,n,r)));if(-1===c)return!1;o.splice(c,1)}return!0}case GB:case $B:case eL:case tL:case nL:case rL:case iL:case oL:case sL:case aL:case cL:case lL:if(typeof Buffer<"u"&&Buffer.isBuffer(e)!==Buffer.isBuffer(t)||e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!dL(e[i],t[i],i,e,t,n,r))return!1;return!0;case ZB:return e.byteLength===t.byteLength&&fL(new Uint8Array(e),new Uint8Array(t),n,r);case JB:return e.byteLength===t.byteLength&&e.byteOffset===t.byteOffset&&fL(new Uint8Array(e),new Uint8Array(t),n,r);case QB:return e.name===t.name&&e.message===t.message;case XB:{if(!(fL(e.constructor,t.constructor,n,r)||uL(e)&&uL(t)))return!1;const i=[...Object.keys(e),...LB(e)],o=[...Object.keys(t),...LB(t)];if(i.length!==o.length)return!1;for(let s=0;s<i.length;s++){const o=i[s],a=e[o];if(!Object.hasOwn(t,o))return!1;if(!dL(a,t[o],o,e,t,n,r))return!1}return!0}default:return!1}}finally{n.delete(e),n.delete(t)}}function hL(){}function pL(e,t){return function(e,t,n){return dL(e,t,void 0,void 0,void 0,void 0,n)}(e,t,hL)}var gL=Object.defineProperty,yL=Object.getOwnPropertySymbols,mL=Object.prototype.hasOwnProperty,vL=Object.prototype.propertyIsEnumerable,bL=(e,t,n)=>t in e?gL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wL=(e,t)=>{for(var n in t||(t={}))mL.call(t,n)&&bL(e,n,t[n]);if(yL)for(var n of yL(t))vL.call(t,n)&&bL(e,n,t[n]);return e},EL=(e,t,n)=>bL(e,"symbol"!=typeof t?t+"":t,n);class _L extends Th{constructor(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:UP,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;super(e,t,n,r),this.core=e,this.logger=t,this.name=n,EL(this,"map",new Map),EL(this,"version","0.3"),EL(this,"cached",[]),EL(this,"initialized",!1),EL(this,"getKey"),EL(this,"storagePrefix",UP),EL(this,"recentlyDeleted",[]),EL(this,"recentlyDeletedLimit",200),EL(this,"init",(async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach((e=>{this.getKey&&null!==e&&!Tk(e)?this.map.set(this.getKey(e),e):function(e){var t;return null==(t=null===e||void 0===e?void 0:e.proposer)?void 0:t.publicKey}(e)?this.map.set(e.id,e):function(e){return null===e||void 0===e?void 0:e.topic}(e)&&this.map.set(e.topic,e)})),this.cached=[],this.initialized=!0)})),EL(this,"set",(async(e,t)=>{this.isInitialized(),this.map.has(e)?await this.update(e,t):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:e,value:t}),this.map.set(e,t),await this.persist())})),EL(this,"get",(e=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:e}),this.getData(e)))),EL(this,"getAll",(e=>(this.isInitialized(),e?this.values.filter((t=>Object.keys(e).every((n=>pL(t[n],e[n]))))):this.values))),EL(this,"update",(async(e,t)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:e,update:t});const n=wL(wL({},this.getData(e)),t);this.map.set(e,n),await this.persist()})),EL(this,"delete",(async(e,t)=>{this.isInitialized(),this.map.has(e)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:e,reason:t}),this.map.delete(e),this.addToRecentlyDeleted(e),await this.persist())})),this.logger=mh(t,this.name),this.storagePrefix=r,this.getKey=i}get context(){return yh(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const t=this.map.get(e);if(!t){if(this.recentlyDeleted.includes(e)){const{message:t}=xk("MISSING_OR_INVALID","Record was recently deleted - ".concat(this.name,": ").concat(e));throw this.logger.error(t),new Error(t)}const{message:t}=xk("NO_MATCHING_KEY","".concat(this.name,": ").concat(e));throw this.logger.error(t),new Error(t)}return t}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:e}=xk("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=e,this.logger.debug("Successfully Restored value for ".concat(this.name)),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(Mz){this.logger.debug("Failed to Restore value for ".concat(this.name)),this.logger.error(Mz)}}isInitialized(){if(!this.initialized){const{message:e}=xk("NOT_INITIALIZED",this.name);throw new Error(e)}}}var SL=Object.defineProperty,xL=(e,t,n)=>((e,t,n)=>t in e?SL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);class IL{constructor(e,t){this.core=e,this.logger=t,xL(this,"name","pairing"),xL(this,"version","0.3"),xL(this,"events",new ir),xL(this,"pairings"),xL(this,"initialized",!1),xL(this,"storagePrefix",UP),xL(this,"ignoredPayloadTypes",[AR]),xL(this,"registeredMethods",[]),xL(this,"init",(async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))})),xL(this,"register",(e=>{let{methods:t}=e;this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...t])]})),xL(this,"create",(async e=>{this.isInitialized();const t=NR(),n=await this.core.crypto.setSymKey(t),r=vx(Bd.FIVE_MINUTES),i={protocol:"irn"},o={topic:n,expiry:r,relay:i,active:!1,methods:null===e||void 0===e?void 0:e.methods},s=ok({protocol:this.core.protocol,version:this.core.version,topic:n,symKey:t,relay:i,expiryTimestamp:r,methods:null===e||void 0===e?void 0:e.methods});return this.events.emit(cC,o),this.core.expirer.set(n,r),await this.pairings.set(n,o),await this.core.relayer.subscribe(n,{transportType:null===e||void 0===e?void 0:e.transportType,internal:null===e||void 0===e?void 0:e.internal}),{topic:n,uri:s}})),xL(this,"pair",(async e=>{this.isInitialized();const t=this.core.eventClient.createEvent({properties:{topic:null===e||void 0===e?void 0:e.uri,trace:[xC]}});this.isValidPair(e,t);const{topic:n,symKey:r,relay:i,expiryTimestamp:o,methods:s}=rk(e.uri);let a;if(t.props.properties.topic=n,t.addTrace(IC),t.addTrace(OC),this.pairings.keys.includes(n)){if(a=this.pairings.get(n),t.addTrace(kC),a.active)throw t.setError(LC),new Error("Pairing already exists: ".concat(n,". Please try again with a new connection URI."));t.addTrace(PC)}const c=o||vx(Bd.FIVE_MINUTES),l={topic:n,relay:i,expiry:c,active:!1,methods:s};this.core.expirer.set(n,c),await this.pairings.set(n,l),t.addTrace(AC),e.activatePairing&&await this.activate({topic:n}),this.events.emit(cC,l),t.addTrace(CC),this.core.crypto.keychain.has(n)||await this.core.crypto.setSymKey(r,n),t.addTrace(TC);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{t.setError(UC)}try{await this.core.relayer.subscribe(n,{relay:i})}catch(Tt){throw t.setError(DC),Tt}return t.addTrace(RC),l})),xL(this,"activate",(async e=>{let{topic:t}=e;this.isInitialized();const n=vx(Bd.FIVE_MINUTES);this.core.expirer.set(t,n),await this.pairings.update(t,{active:!0,expiry:n})})),xL(this,"ping",(async e=>{this.isInitialized(),await this.isValidPing(e),this.logger.warn("ping() is deprecated and will be removed in the next major release.");const{topic:t}=e;if(this.pairings.keys.includes(t)){const e=await this.sendRequest(t,"wc_pairingPing",{}),{done:n,resolve:r,reject:i}=px();this.events.once(wx("pairing_ping",e),(e=>{let{error:t}=e;t?i(t):r()})),await n()}})),xL(this,"updateExpiry",(async e=>{let{topic:t,expiry:n}=e;this.isInitialized(),await this.pairings.update(t,{expiry:n})})),xL(this,"updateMetadata",(async e=>{let{topic:t,metadata:n}=e;this.isInitialized(),await this.pairings.update(t,{peerMetadata:n})})),xL(this,"getPairings",(()=>(this.isInitialized(),this.pairings.values))),xL(this,"disconnect",(async e=>{this.isInitialized(),await this.isValidDisconnect(e);const{topic:t}=e;this.pairings.keys.includes(t)&&(await this.sendRequest(t,"wc_pairingDelete",Ik("USER_DISCONNECTED")),await this.deletePairing(t))})),xL(this,"formatUriFromPairing",(e=>{this.isInitialized();const{topic:t,relay:n,expiry:r,methods:i}=e,o=this.core.crypto.keychain.get(t);return ok({protocol:this.core.protocol,version:this.core.version,topic:t,symKey:o,relay:n,expiryTimestamp:r,methods:i})})),xL(this,"sendRequest",(async(e,t,n)=>{const r=pP(t,n),i=await this.core.crypto.encode(e,r),o=aC[t].req;return this.core.history.set(e,r),this.core.relayer.publish(e,i,o),r.id})),xL(this,"sendResult",(async(e,t,n)=>{const r=gP(e,n),i=await this.core.crypto.encode(t,r),o=(await this.core.history.get(t,e)).request.method,s=aC[o].res;await this.core.relayer.publish(t,i,s),await this.core.history.resolve(r)})),xL(this,"sendError",(async(e,t,n)=>{const r=yP(e,n),i=await this.core.crypto.encode(t,r),o=(await this.core.history.get(t,e)).request.method,s=aC[o]?aC[o].res:aC.unregistered_method.res;await this.core.relayer.publish(t,i,s),await this.core.history.resolve(r)})),xL(this,"deletePairing",(async(e,t)=>{await this.core.relayer.unsubscribe(e),await Promise.all([this.pairings.delete(e,Ik("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(e),t?Promise.resolve():this.core.expirer.del(e)])})),xL(this,"cleanup",(async()=>{const e=this.pairings.getAll().filter((e=>bx(e.expiry)));await Promise.all(e.map((e=>this.deletePairing(e.topic))))})),xL(this,"onRelayEventRequest",(async e=>{const{topic:t,payload:n}=e;switch(n.method){case"wc_pairingPing":return await this.onPairingPingRequest(t,n);case"wc_pairingDelete":return await this.onPairingDeleteRequest(t,n);default:return await this.onUnknownRpcMethodRequest(t,n)}})),xL(this,"onRelayEventResponse",(async e=>{const{topic:t,payload:n}=e,r=(await this.core.history.get(t,n.id)).request.method;return"wc_pairingPing"===r?this.onPairingPingResponse(t,n):this.onUnknownRpcMethodResponse(r)})),xL(this,"onPairingPingRequest",(async(e,t)=>{const{id:n}=t;try{this.isValidPing({topic:e}),await this.sendResult(n,e,!0),this.events.emit(dC,{id:n,topic:e})}catch(Ju){await this.sendError(n,e,Ju),this.logger.error(Ju)}})),xL(this,"onPairingPingResponse",((e,t)=>{const{id:n}=t;setTimeout((()=>{AP(t)?this.events.emit(wx("pairing_ping",n),{}):TP(t)&&this.events.emit(wx("pairing_ping",n),{error:t.error})}),500)})),xL(this,"onPairingDeleteRequest",(async(e,t)=>{const{id:n}=t;try{this.isValidDisconnect({topic:e}),await this.deletePairing(e),this.events.emit(uC,{id:n,topic:e})}catch(Ju){await this.sendError(n,e,Ju),this.logger.error(Ju)}})),xL(this,"onUnknownRpcMethodRequest",(async(e,t)=>{const{id:n,method:r}=t;try{if(this.registeredMethods.includes(r))return;const t=Ik("WC_METHOD_UNSUPPORTED",r);await this.sendError(n,e,t),this.logger.error(t)}catch(Ke){await this.sendError(n,e,Ke),this.logger.error(Ke)}})),xL(this,"onUnknownRpcMethodResponse",(e=>{this.registeredMethods.includes(e)||this.logger.error(Ik("WC_METHOD_UNSUPPORTED",e))})),xL(this,"isValidPair",((e,t)=>{var n;if(!jk(e)){const{message:n}=xk("MISSING_OR_INVALID","pair() params: ".concat(e));throw t.setError(BC),new Error(n)}if(!function(e){function t(e){try{return typeof new URL(e)<"u"}catch{return!1}}try{if(Rk(e,!1))return!!t(e)||t(Ox(e))}catch{}return!1}(e.uri)){const{message:n}=xk("MISSING_OR_INVALID","pair() uri: ".concat(e.uri));throw t.setError(BC),new Error(n)}const r=rk(null===e||void 0===e?void 0:e.uri);if(null==(n=null===r||void 0===r?void 0:r.relay)||!n.protocol){const{message:e}=xk("MISSING_OR_INVALID","pair() uri#relay-protocol");throw t.setError(BC),new Error(e)}if(null==r||!r.symKey){const{message:e}=xk("MISSING_OR_INVALID","pair() uri#symKey");throw t.setError(BC),new Error(e)}if(null!=r&&r.expiryTimestamp&&(0,Bd.toMiliseconds)(null===r||void 0===r?void 0:r.expiryTimestamp)<Date.now()){t.setError(jC);const{message:e}=xk("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(e)}})),xL(this,"isValidPing",(async e=>{if(!jk(e)){const{message:t}=xk("MISSING_OR_INVALID","ping() params: ".concat(e));throw new Error(t)}const{topic:t}=e;await this.isValidPairingTopic(t)})),xL(this,"isValidDisconnect",(async e=>{if(!jk(e)){const{message:t}=xk("MISSING_OR_INVALID","disconnect() params: ".concat(e));throw new Error(t)}const{topic:t}=e;await this.isValidPairingTopic(t)})),xL(this,"isValidPairingTopic",(async e=>{if(!Rk(e,!1)){const{message:t}=xk("MISSING_OR_INVALID","pairing topic should be a string: ".concat(e));throw new Error(t)}if(!this.pairings.keys.includes(e)){const{message:t}=xk("NO_MATCHING_KEY","pairing topic doesn't exist: ".concat(e));throw new Error(t)}if(bx(this.pairings.get(e).expiry)){await this.deletePairing(e);const{message:t}=xk("EXPIRED","pairing topic: ".concat(e));throw new Error(t)}})),this.core=e,this.logger=mh(t,this.name),this.pairings=new _L(this.core,this.logger,this.name,this.storagePrefix)}get context(){return yh(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=xk("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(zP,(async e=>{const{topic:t,message:n,transportType:r}=e;if(this.pairings.keys.includes(t)&&r!==$P.link_mode&&!this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))try{const e=await this.core.crypto.decode(t,n);IP(e)?(this.core.history.set(t,e),await this.onRelayEventRequest({topic:t,payload:e})):OP(e)&&(await this.core.history.resolve(e),await this.onRelayEventResponse({topic:t,payload:e}),this.core.history.delete(t,e.id)),await this.core.relayer.messages.ack(t,n)}catch(Yu){this.logger.error(Yu)}}))}registerExpirerEvents(){this.core.expirer.on(vC,(async e=>{const{topic:t}=mx(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit(lC,{topic:t}))}))}}var OL=Object.defineProperty,AL=(e,t,n)=>((e,t,n)=>t in e?OL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);class TL extends xh{constructor(e,t){super(e,t),this.core=e,this.logger=t,AL(this,"records",new Map),AL(this,"events",new ir.EventEmitter),AL(this,"name","history"),AL(this,"version","0.3"),AL(this,"cached",[]),AL(this,"initialized",!1),AL(this,"storagePrefix",UP),AL(this,"init",(async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach((e=>this.records.set(e.id,e))),this.cached=[],this.registerEventListeners(),this.initialized=!0)})),AL(this,"set",((e,t,n)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:e,request:t,chainId:n}),this.records.has(t.id))return;const r={id:t.id,topic:e,request:{method:t.method,params:t.params||null},chainId:n,expiry:vx(Bd.THIRTY_DAYS)};this.records.set(r.id,r),this.persist(),this.events.emit(fC,r)})),AL(this,"resolve",(async e=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:e}),!this.records.has(e.id))return;const t=await this.getRecord(e.id);typeof t.response>"u"&&(t.response=TP(e)?{error:e.error}:{result:e.result},this.records.set(t.id,t),this.persist(),this.events.emit(hC,t))})),AL(this,"get",(async(e,t)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:e,id:t}),await this.getRecord(t)))),AL(this,"delete",((e,t)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:t}),this.values.forEach((n=>{if(n.topic===e){if(typeof t<"u"&&n.id!==t)return;this.records.delete(n.id),this.events.emit(pC,n)}})),this.persist()})),AL(this,"exists",(async(e,t)=>(this.isInitialized(),!!this.records.has(t)&&(await this.getRecord(t)).topic===e))),AL(this,"on",((e,t)=>{this.events.on(e,t)})),AL(this,"once",((e,t)=>{this.events.once(e,t)})),AL(this,"off",((e,t)=>{this.events.off(e,t)})),AL(this,"removeListener",((e,t)=>{this.events.removeListener(e,t)})),this.logger=mh(t,this.name)}get context(){return yh(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach((t=>{if(typeof t.response<"u")return;const n={topic:t.topic,request:pP(t.request.method,t.request.params,t.id),chainId:t.chainId};return e.push(n)})),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const t=this.records.get(e);if(!t){const{message:t}=xk("NO_MATCHING_KEY","".concat(this.name,": ").concat(e));throw new Error(t)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(gC)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:e}=xk("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=e,this.logger.debug("Successfully Restored records for ".concat(this.name)),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(Mz){this.logger.debug("Failed to Restore records for ".concat(this.name)),this.logger.error(Mz)}}registerEventListeners(){this.events.on(fC,(e=>{const t=fC;this.logger.info("Emitting ".concat(t)),this.logger.debug({type:"event",event:t,record:e})})),this.events.on(hC,(e=>{const t=hC;this.logger.info("Emitting ".concat(t)),this.logger.debug({type:"event",event:t,record:e})})),this.events.on(pC,(e=>{const t=pC;this.logger.info("Emitting ".concat(t)),this.logger.debug({type:"event",event:t,record:e})})),this.core.heartbeat.on(Md,(()=>{this.cleanup()}))}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach((t=>{(0,Bd.toMiliseconds)(t.expiry||0)-Date.now()<=0&&(this.logger.info("Deleting expired history log: ".concat(t.id)),this.records.delete(t.id),this.events.emit(pC,t,!1),e=!0)})),e&&this.persist()}catch(Mz){this.logger.warn(Mz)}}isInitialized(){if(!this.initialized){const{message:e}=xk("NOT_INITIALIZED",this.name);throw new Error(e)}}}var RL=Object.defineProperty,kL=(e,t,n)=>((e,t,n)=>t in e?RL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);class PL extends kh{constructor(e,t){super(e,t),this.core=e,this.logger=t,kL(this,"expirations",new Map),kL(this,"events",new ir.EventEmitter),kL(this,"name","expirer"),kL(this,"version","0.3"),kL(this,"cached",[]),kL(this,"initialized",!1),kL(this,"storagePrefix",UP),kL(this,"init",(async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach((e=>this.expirations.set(e.target,e))),this.cached=[],this.registerEventListeners(),this.initialized=!0)})),kL(this,"has",(e=>{try{const t=this.formatTarget(e);return typeof this.getExpiration(t)<"u"}catch{return!1}})),kL(this,"set",((e,t)=>{this.isInitialized();const n=this.formatTarget(e),r={target:n,expiry:t};this.expirations.set(n,r),this.checkExpiry(n,r),this.events.emit(yC,{target:n,expiration:r})})),kL(this,"get",(e=>{this.isInitialized();const t=this.formatTarget(e);return this.getExpiration(t)})),kL(this,"del",(e=>{if(this.isInitialized(),this.has(e)){const t=this.formatTarget(e),n=this.getExpiration(t);this.expirations.delete(t),this.events.emit(mC,{target:t,expiration:n})}})),kL(this,"on",((e,t)=>{this.events.on(e,t)})),kL(this,"once",((e,t)=>{this.events.once(e,t)})),kL(this,"off",((e,t)=>{this.events.off(e,t)})),kL(this,"removeListener",((e,t)=>{this.events.removeListener(e,t)})),this.logger=mh(t,this.name)}get context(){return yh(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if("string"==typeof e)return function(e){return yx("topic",e)}(e);if("number"==typeof e)return function(e){return yx("id",e)}(e);const{message:t}=xk("UNKNOWN_TYPE","Target type: ".concat(typeof e));throw new Error(t)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(bC)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:e}=xk("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=e,this.logger.debug("Successfully Restored expirations for ".concat(this.name)),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(Mz){this.logger.debug("Failed to Restore expirations for ".concat(this.name)),this.logger.error(Mz)}}getExpiration(e){const t=this.expirations.get(e);if(!t){const{message:t}=xk("NO_MATCHING_KEY","".concat(this.name,": ").concat(e));throw this.logger.warn(t),new Error(t)}return t}checkExpiry(e,t){const{expiry:n}=t;(0,Bd.toMiliseconds)(n)-Date.now()<=0&&this.expire(e,t)}expire(e,t){this.expirations.delete(e),this.events.emit(vC,{target:e,expiration:t})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach(((e,t)=>this.checkExpiry(t,e)))}registerEventListeners(){this.core.heartbeat.on(Md,(()=>this.checkExpirations())),this.events.on(yC,(e=>{const t=yC;this.logger.info("Emitting ".concat(t)),this.logger.debug({type:"event",event:t,data:e}),this.persist()})),this.events.on(vC,(e=>{const t=vC;this.logger.info("Emitting ".concat(t)),this.logger.debug({type:"event",event:t,data:e}),this.persist()})),this.events.on(mC,(e=>{const t=mC;this.logger.info("Emitting ".concat(t)),this.logger.debug({type:"event",event:t,data:e}),this.persist()}))}isInitialized(){if(!this.initialized){const{message:e}=xk("NOT_INITIALIZED",this.name);throw new Error(e)}}}var CL=Object.defineProperty,NL=(e,t,n)=>((e,t,n)=>t in e?CL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);class UL extends Ph{constructor(e,t,n){super(e,t,n),this.core=e,this.logger=t,this.store=n,NL(this,"name","verify-api"),NL(this,"abortController"),NL(this,"isDevEnv"),NL(this,"verifyUrlV3",_C),NL(this,"storagePrefix",UP),NL(this,"version",2),NL(this,"publicKey"),NL(this,"fetchPromise"),NL(this,"init",(async()=>{var e;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&(0,Bd.toMiliseconds)(null==(e=this.publicKey)?void 0:e.expiresAt)<Date.now()&&(this.logger.debug("verify v2 public key expired"),await this.removePublicKey()))})),NL(this,"register",(async e=>{if(!ix()||this.isDevEnv)return;const t=window.location.origin,{id:n,decryptedId:r}=e,i="".concat(this.verifyUrlV3,"/attestation?projectId=").concat(this.core.projectId,"&origin=").concat(t,"&id=").concat(n,"&decryptedId=").concat(r);try{const e=(0,_m.getDocument)(),t=this.startAbortTimer(5*Bd.ONE_SECOND),r=await new Promise(((r,o)=>{const s=()=>{window.removeEventListener("message",c),e.body.removeChild(a),o("attestation aborted")};this.abortController.signal.addEventListener("abort",s);const a=e.createElement("iframe");a.src=i,a.style.display="none",a.addEventListener("error",s,{signal:this.abortController.signal});const c=i=>{if(i.data&&"string"==typeof i.data)try{const o=JSON.parse(i.data);if("verify_attestation"===o.type){if(sm(o.attestation).payload.id!==n)return;clearInterval(t),e.body.removeChild(a),this.abortController.signal.removeEventListener("abort",s),window.removeEventListener("message",c),r(null===o.attestation?"":o.attestation)}}catch(ut){this.logger.warn(ut)}};e.body.appendChild(a),window.addEventListener("message",c,{signal:this.abortController.signal})}));return this.logger.debug(r,"jwt attestation"),r}catch($e){this.logger.warn($e)}return""})),NL(this,"resolve",(async e=>{if(this.isDevEnv)return"";const{attestationId:t,hash:n,encryptedId:r}=e;if(""===t)return void this.logger.debug("resolve: attestationId is empty, skipping");if(t){if(sm(t).payload.id!==r)return;const e=await this.isValidJwtAttestation(t);if(e)return e.isVerified?e:void this.logger.warn("resolve: jwt attestation: origin url not verified")}if(!n)return;const i=this.getVerifyUrl(null===e||void 0===e?void 0:e.verifyUrl);return this.fetchAttestation(n,i)})),NL(this,"fetchAttestation",(async(e,t)=>{this.logger.debug("resolving attestation: ".concat(e," from url: ").concat(t));const n=this.startAbortTimer(5*Bd.ONE_SECOND),r=await fetch("".concat(t,"/attestation/").concat(e,"?v2Supported=true"),{signal:this.abortController.signal});return clearTimeout(n),200===r.status?await r.json():void 0})),NL(this,"getVerifyUrl",(e=>{let t=e||EC;return SC.includes(t)||(this.logger.info("verify url: ".concat(t,", not included in trusted list, assigning default: ").concat(EC)),t=EC),t})),NL(this,"fetchPublicKey",(async()=>{try{this.logger.debug("fetching public key from: ".concat(this.verifyUrlV3));const e=this.startAbortTimer(Bd.FIVE_SECONDS),t=await fetch("".concat(this.verifyUrlV3,"/public-key"),{signal:this.abortController.signal});return clearTimeout(e),await t.json()}catch(We){this.logger.warn(We)}})),NL(this,"persistPublicKey",(async e=>{this.logger.debug(e,"persisting public key to local storage"),await this.store.setItem(this.storeKey,e),this.publicKey=e})),NL(this,"removePublicKey",(async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0})),NL(this,"isValidJwtAttestation",(async e=>{const t=await this.getPublicKey();try{if(t)return this.validateAttestation(e,t)}catch(Ke){this.logger.error(Ke),this.logger.warn("error validating attestation")}const n=await this.fetchAndPersistPublicKey();try{if(n)return this.validateAttestation(e,n)}catch(Ke){this.logger.error(Ke),this.logger.warn("error validating attestation")}})),NL(this,"getPublicKey",(async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey())),NL(this,"fetchAndPersistPublicKey",(async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise((async e=>{const t=await this.fetchPublicKey();t&&(await this.persistPublicKey(t),e(t))}));const e=await this.fetchPromise;return this.fetchPromise=void 0,e})),NL(this,"validateAttestation",((e,t)=>{const n=KR(e,t.publicKey),r={hasExpired:(0,Bd.toMiliseconds)(n.exp)<Date.now(),payload:n};if(r.hasExpired)throw this.logger.warn("resolve: jwt attestation expired"),new Error("JWT attestation expired");return{origin:r.payload.origin,isScam:r.payload.isScam,isVerified:r.payload.isVerified}})),this.logger=mh(t,this.name),this.abortController=new AbortController,this.isDevEnv=Ix(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}get context(){return yh(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout((()=>this.abortController.abort()),(0,Bd.toMiliseconds)(e))}}var BL=Object.defineProperty,LL=(e,t,n)=>((e,t,n)=>t in e?BL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);class DL extends Ch{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,LL(this,"context","echo"),LL(this,"registerDeviceToken",(async e=>{const{clientId:t,token:n,notificationType:r,enableEncrypted:i=!1}=e,o="".concat("https://echo.walletconnect.com","/").concat(this.projectId,"/clients");await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:t,type:r,token:n,always_raw:i})})})),this.logger=mh(t,this.context)}}var jL=Object.defineProperty,ML=Object.getOwnPropertySymbols,FL=Object.prototype.hasOwnProperty,zL=Object.prototype.propertyIsEnumerable,qL=(e,t,n)=>t in e?jL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,HL=(e,t)=>{for(var n in t||(t={}))FL.call(t,n)&&qL(e,n,t[n]);if(ML)for(var n of ML(t))zL.call(t,n)&&qL(e,n,t[n]);return e},VL=(e,t,n)=>qL(e,"symbol"!=typeof t?t+"":t,n);class KL extends Nh{constructor(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];super(e,t,n),this.core=e,this.logger=t,VL(this,"context","event-client"),VL(this,"storagePrefix",UP),VL(this,"storageVersion",.1),VL(this,"events",new Map),VL(this,"shouldPersist",!1),VL(this,"init",(async()=>{if(!Ix())try{const e={eventId:xx(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:lx(this.core.relayer.protocol,this.core.relayer.version,JP)}}};await this.sendEvent([e])}catch(We){this.logger.warn(We)}})),VL(this,"createEvent",(e=>{const{event:t="ERROR",type:n="",properties:{topic:r,trace:i}}=e,o=xx(),s=this.core.projectId||"",a=Date.now(),c=HL({eventId:o,timestamp:a,props:{event:t,type:n,properties:{topic:r,trace:i}},bundleId:s,domain:this.getAppDomain()},this.setMethods(o));return this.telemetryEnabled&&(this.events.set(o,c),this.shouldPersist=!0),c})),VL(this,"getEvent",(e=>{const{eventId:t,topic:n}=e;if(t)return this.events.get(t);const r=Array.from(this.events.values()).find((e=>e.props.properties.topic===n));return r?HL(HL({},r),this.setMethods(r.eventId)):void 0})),VL(this,"deleteEvent",(e=>{const{eventId:t}=e;this.events.delete(t),this.shouldPersist=!0})),VL(this,"setEventListeners",(()=>{this.core.heartbeat.on(Md,(async()=>{this.shouldPersist&&await this.persist(),this.events.forEach((e=>{(0,Bd.fromMiliseconds)(Date.now())-(0,Bd.fromMiliseconds)(e.timestamp)>86400&&(this.events.delete(e.eventId),this.shouldPersist=!0)}))}))})),VL(this,"setMethods",(e=>({addTrace:t=>this.addTrace(e,t),setError:t=>this.setError(e,t)}))),VL(this,"addTrace",((e,t)=>{const n=this.events.get(e);n&&(n.props.properties.trace.push(t),this.events.set(e,n),this.shouldPersist=!0)})),VL(this,"setError",((e,t)=>{const n=this.events.get(e);n&&(n.props.type=t,n.timestamp=Date.now(),this.events.set(e,n),this.shouldPersist=!0)})),VL(this,"persist",(async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1})),VL(this,"restore",(async()=>{try{const e=await this.core.storage.getItem(this.storageKey)||[];if(!e.length)return;e.forEach((e=>{this.events.set(e.eventId,HL(HL({},e),this.setMethods(e.eventId)))}))}catch(We){this.logger.warn(We)}})),VL(this,"submit",(async()=>{if(!this.telemetryEnabled||0===this.events.size)return;const e=[];for(const[t,n]of this.events)n.props.type&&e.push(n);if(0!==e.length)try{if((await this.sendEvent(e)).ok)for(const t of e)this.events.delete(t.eventId),this.shouldPersist=!0}catch(Yu){this.logger.warn(Yu)}})),VL(this,"sendEvent",(async e=>{const t=this.getAppDomain()?"":"&sp=desktop";return await fetch("".concat("https://pulse.walletconnect.org/batch","?projectId=").concat(this.core.projectId,"&st=events_sdk&sv=js-").concat(JP).concat(t),{method:"POST",body:JSON.stringify(e)})})),VL(this,"getAppDomain",(()=>cx().url)),this.logger=mh(t,this.context),this.telemetryEnabled=n,n?this.restore().then((async()=>{await this.submit(),this.setEventListeners()})):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var WL=Object.defineProperty,GL=Object.getOwnPropertySymbols,YL=Object.prototype.hasOwnProperty,ZL=Object.prototype.propertyIsEnumerable,XL=(e,t,n)=>t in e?WL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,QL=(e,t)=>{for(var n in t||(t={}))YL.call(t,n)&&XL(e,n,t[n]);if(GL)for(var n of GL(t))ZL.call(t,n)&&XL(e,n,t[n]);return e},JL=(e,t,n)=>XL(e,"symbol"!=typeof t?t+"":t,n);class $L extends Eh{constructor(e){var t;super(e),JL(this,"protocol","wc"),JL(this,"version",2),JL(this,"name",NP),JL(this,"relayUrl"),JL(this,"projectId"),JL(this,"customStoragePrefix"),JL(this,"events",new ir.EventEmitter),JL(this,"logger"),JL(this,"heartbeat"),JL(this,"relayer"),JL(this,"crypto"),JL(this,"storage"),JL(this,"history"),JL(this,"expirer"),JL(this,"pairing"),JL(this,"verify"),JL(this,"echoClient"),JL(this,"linkModeSupportedApps"),JL(this,"eventClient"),JL(this,"initialized",!1),JL(this,"logChunkController"),JL(this,"on",((e,t)=>this.events.on(e,t))),JL(this,"once",((e,t)=>this.events.once(e,t))),JL(this,"off",((e,t)=>this.events.off(e,t))),JL(this,"removeListener",((e,t)=>this.events.removeListener(e,t))),JL(this,"dispatchEnvelope",(e=>{let{topic:t,message:n,sessionExists:r}=e;if(!t||!n)return;const i={topic:t,message:n,publishedAt:Date.now(),transportType:$P.link_mode};this.relayer.onLinkMessageEvent(i,{sessionExists:r})}));const n=this.getGlobalCore(null===e||void 0===e?void 0:e.customStoragePrefix);if(n)try{return this.customStoragePrefix=n.customStoragePrefix,this.logger=n.logger,this.heartbeat=n.heartbeat,this.crypto=n.crypto,this.history=n.history,this.expirer=n.expirer,this.storage=n.storage,this.relayer=n.relayer,this.pairing=n.pairing,this.verify=n.verify,this.echoClient=n.echoClient,this.linkModeSupportedApps=n.linkModeSupportedApps,this.eventClient=n.eventClient,this.initialized=n.initialized,this.logChunkController=n.logChunkController,n}catch(Ke){console.warn("Failed to copy global core",Ke)}this.projectId=null===e||void 0===e?void 0:e.projectId,this.relayUrl=(null===e||void 0===e?void 0:e.relayUrl)||FP,this.customStoragePrefix=null!=e&&e.customStoragePrefix?":".concat(e.customStoragePrefix):"";const r=function(e){return gh(ph({},e),{level:(null===e||void 0===e?void 0:e.level)||Vf})}({level:"string"==typeof(null===e||void 0===e?void 0:e.logger)&&e.logger?e.logger:BP,name:NP}),{logger:i,chunkLoggerController:o}=vh({opts:r,maxSizeInBytes:null===e||void 0===e?void 0:e.maxLogBlobSizeInBytes,loggerOverride:null===e||void 0===e?void 0:e.logger});this.logChunkController=o,null!=(t=this.logChunkController)&&t.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var e,t;null!=(e=this.logChunkController)&&e.downloadLogsBlobInBrowser&&(null==(t=this.logChunkController)||t.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=mh(i,this.name),this.heartbeat=new Fd,this.crypto=new GU(this,this.logger,null===e||void 0===e?void 0:e.keychain),this.history=new TL(this,this.logger),this.expirer=new PL(this,this.logger),this.storage=null!=e&&e.storage?e.storage:new Ef(QL(QL({},LP),null===e||void 0===e?void 0:e.storageOptions)),this.relayer=new BB({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new IL(this,this.logger),this.verify=new UL(this,this.logger,this.storage),this.echoClient=new DL(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new KL(this,this.logger,null===e||void 0===e?void 0:e.telemetryEnabled),this.setGlobalCore(this)}static async init(e){const t=new $L(e);await t.initialize();const n=await t.crypto.getClientId();return await t.storage.setItem("WALLETCONNECT_CLIENT_ID",n),t}get context(){return yh(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return null==(e=this.logChunkController)?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(nC,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.linkModeSupportedApps=await this.storage.getItem(nC)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(Mz){throw this.logger.warn(Mz,"Core Initialization Failure at epoch ".concat(Date.now())),this.logger.error(Mz.message),Mz}}getGlobalCore(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";try{if(this.isGlobalCoreDisabled())return;const t="_walletConnectCore_".concat(e),n="".concat(t,"_count");return globalThis[n]=(globalThis[n]||0)+1,globalThis[n]>1&&console.warn("WalletConnect Core is already initialized. This is probably a mistake and can lead to unexpected behavior. Init() was called ".concat(globalThis[n]," times.")),globalThis[t]}catch(t){return void console.warn("Failed to get global WalletConnect core",t)}}setGlobalCore(e){var t;try{if(this.isGlobalCoreDisabled())return;const n="_walletConnectCore_".concat((null==(t=e.opts)?void 0:t.customStoragePrefix)||"");globalThis[n]=e}catch(Qu){console.warn("Failed to set global WalletConnect core",Qu)}}isGlobalCoreDisabled(){try{return typeof process<"u"&&"true"==={NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0,REACT_APP_FUNC_SYNC_BLOCK_FOR_EVENT_URL:"https://us-central1-flowty-test.cloudfunctions.net/httpSyncBlockForEvent",REACT_APP_NFT_CATALOG:"0x324c34e1c517e4db",REACT_APP_FIREBASE_MESSAGING_SENDER_ID:"464683970830",REACT_APP_ADDRESS_EXAMPLE_NFT_CONTRACT:"",REACT_APP_NFT_COLLECTION_VERSUS:"versusArtCollection",REACT_APP_ADDRESS_NON_FUNGIBLE_TOKEN_CONTRACT:"0x631e88ae7f1d7c20",REACT_APP_ADDRESS_FUSD_CONTRACT:"",REACT_APP_STAGE:"test",REACT_APP_NFT_COLLECTION:"",REACT_APP_ADDRESS_FLOWTYV2_CONTRACT:"0xb051bdaddb672a33",REACT_APP_STRAPI_URL:"https://confident-crystal-513bf384d1.strapiapp.com",REACT_APP_ALCHEMY_API_KEY:"",REACT_APP_CREATOR_HUB_ENABLED:"true",REACT_APP_WALLET_CONNECT_PROJECT_ID:"083ff1d46c8f7cb2f936a31b614ececa",REACT_APP_FIREBASE_MEASUREMENT_ID:"G-9869SGBB4D",REACT_APP_FIREBASE_STORAGE_BUCKET:"flowty-test.appspot.com",REACT_APP_FIREBASE_AUTH_DOMAIN:"flowty-test.firebaseapp.com",REACT_APP_NFT_COLLECTION_TOP_SHOT:"MomentCollection",REACT_APP_STOREFRONT_COLLECTION:"",REACT_APP_BASE_URL:"https://us-central1-flowty-test.cloudfunctions.net",REACT_APP_WALLET_DISCOVERY_V2:"https://fcl-discovery.onflow.org/testnet/authn",REACT_APP_CRESCENDO:"true",REACT_APP_WALLET_DISCOVERY_ENDPOINT_V2:"https://fcl-discovery.onflow.org/api/testnet/authn",REACT_APP_FIREBASE_PROJECT_ID:"flowty-test",REACT_APP_BLOCTO_WALLET_DISCOVERY:"https://flow-wallet-testnet.blocto.app/api/flow/authn",REACT_APP_WALLET_DISCOVERY:"https://fcl-discovery.onflow.org/testnet/authn",REACT_APP_FIREBASE_APP_ID:"1:464683970830:web:456c2eeed727f324e4275f",REACT_APP_ADDRESS_FUNGIBLE_TOKEN_CONTRACT:"0x9a0766d93b6608b7",REACT_APP_ADDRESS_TOPSHOT_CONTRACT:"0x877931736ee77cff",REACT_APP_ADDRESS_FLOWTY_CONTRACT:"0xe1d43e0cfc237807",REACT_APP_ACCESS_API:"https://testnet.onflow.org",REACT_APP_FIREBASE_API_KEY:"AIzaSyAcAiy7t5OQAHQSCP9ibHsKVSboKfGb-AU",REACT_APP_ADDRESS_PROFILE_CONTRACT:"",REACT_APP_API_URL:"https://api2.testnet.flowty.io",REACT_APP_FUNC_CREATE_TOKEN_URL:"https://us-central1-flowty-test.cloudfunctions.net/httpCreateCustomToken"}.DISABLE_GLOBAL_CORE}catch{return!0}}}const eD=$L,tD="client",nD="".concat("wc","@").concat(2,":").concat(tD,":"),rD=tD,iD="error",oD="WALLETCONNECT_DEEPLINK_CHOICE",sD="Proposal expired",aD=Bd.SEVEN_DAYS,cD={wc_sessionPropose:{req:{ttl:Bd.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:Bd.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:Bd.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:Bd.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:Bd.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:Bd.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:Bd.ONE_DAY,prompt:!1,tag:1104},res:{ttl:Bd.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:Bd.ONE_DAY,prompt:!1,tag:1106},res:{ttl:Bd.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:Bd.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:Bd.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:Bd.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:Bd.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:Bd.ONE_DAY,prompt:!1,tag:1112},res:{ttl:Bd.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:Bd.ONE_DAY,prompt:!1,tag:1114},res:{ttl:Bd.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:Bd.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:Bd.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:Bd.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:Bd.FIVE_MINUTES,prompt:!1,tag:1119}}},lD={min:Bd.FIVE_MINUTES,max:Bd.SEVEN_DAYS},uD="IDLE",dD="ACTIVE",fD={eth_sendTransaction:{key:""},eth_sendRawTransaction:{key:""},wallet_sendCalls:{key:""},solana_signTransaction:{key:"signature"},solana_signAllTransactions:{key:"transactions"},solana_signAndSendTransaction:{key:"signature"},sui_signAndExecuteTransaction:{key:"digest"},sui_signTransaction:{key:""},hedera_signAndExecuteTransaction:{key:"transactionId"},hedera_executeTransaction:{key:"transactionId"},near_signTransaction:{key:""},near_signTransactions:{key:""},tron_signTransaction:{key:"txID"},xrpl_signTransaction:{key:""},xrpl_signTransactionFor:{key:""},algo_signTxn:{key:""},sendTransfer:{key:"txid"},stacks_stxTransfer:{key:"txId"},polkadot_signTransaction:{key:""},cosmos_signDirect:{key:""}},hD=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],pD="".concat("wc","@",1.5,":").concat("auth",":"),gD="".concat(pD,":PUB_KEY");var yD=Object.defineProperty,mD=Object.defineProperties,vD=Object.getOwnPropertyDescriptors,bD=Object.getOwnPropertySymbols,wD=Object.prototype.hasOwnProperty,ED=Object.prototype.propertyIsEnumerable,_D=(e,t,n)=>t in e?yD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,SD=(e,t)=>{for(var n in t||(t={}))wD.call(t,n)&&_D(e,n,t[n]);if(bD)for(var n of bD(t))ED.call(t,n)&&_D(e,n,t[n]);return e},xD=(e,t)=>mD(e,vD(t)),ID=(e,t,n)=>_D(e,"symbol"!=typeof t?t+"":t,n);class OD extends Dh{constructor(e){var t;super(e),t=this,ID(this,"name","engine"),ID(this,"events",new ir),ID(this,"initialized",!1),ID(this,"requestQueue",{state:uD,queue:[]}),ID(this,"sessionRequestQueue",{state:uD,queue:[]}),ID(this,"emittedSessionRequests",new Ax({limit:500})),ID(this,"requestQueueDelay",Bd.ONE_SECOND),ID(this,"expectedPairingMethodMap",new Map),ID(this,"recentlyDeletedMap",new Map),ID(this,"recentlyDeletedLimit",200),ID(this,"relayMessageCache",[]),ID(this,"pendingSessions",new Map),ID(this,"init",(async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(cD)}),this.initialized=!0,setTimeout((async()=>{await this.processPendingMessageEvents(),this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()}),(0,Bd.toMiliseconds)(this.requestQueueDelay)))})),ID(this,"connect",(async e=>{var t;this.isInitialized(),await this.confirmOnlineStateOrThrow();const n=xD(SD({},e),{requiredNamespaces:e.requiredNamespaces||{},optionalNamespaces:e.optionalNamespaces||{}});await this.isValidConnect(n),n.optionalNamespaces=function(e,t){var n,r,i,o,s,a;const c=wk(e),l=wk(t),u={},d=Object.keys(c).concat(Object.keys(l));for(const f of d)u[f]={chains:Ex(null==(n=c[f])?void 0:n.chains,null==(r=l[f])?void 0:r.chains),methods:Ex(null==(i=c[f])?void 0:i.methods,null==(o=l[f])?void 0:o.methods),events:Ex(null==(s=c[f])?void 0:s.events,null==(a=l[f])?void 0:a.events)};return u}(n.requiredNamespaces,n.optionalNamespaces),n.requiredNamespaces={};const{pairingTopic:r,requiredNamespaces:i,optionalNamespaces:o,sessionProperties:s,scopedProperties:a,relays:c,authentication:l,walletPay:u}=n,d=(null==(t=null===l||void 0===l?void 0:l[0])?void 0:t.ttl)||cD.wc_sessionPropose.req.ttl||Bd.FIVE_MINUTES;this.validateRequestExpiry(d);let f,h=r,p=!1;try{if(h){const e=this.client.core.pairing.pairings.get(h);this.client.logger.warn("connect() with existing pairing topic is deprecated and will be removed in the next major release."),p=e.active}}catch(Et){throw this.client.logger.error("connect() -> pairing.get(".concat(h,") failed")),Et}if(!h||!p){const{topic:e,uri:t}=await this.client.core.pairing.create({internal:{skipSubscribe:!0}});h=e,f=t}if(!h){const{message:e}=xk("NO_MATCHING_KEY","connect() pairing topic: ".concat(h));throw new Error(e)}const g=await this.client.core.crypto.generateKeyPair(),y=vx(d),m=SD(xD(SD(SD({requiredNamespaces:i,optionalNamespaces:o,relays:null!==c&&void 0!==c?c:[{protocol:"irn"}],proposer:{publicKey:g,metadata:this.client.metadata},expiryTimestamp:y,pairingTopic:h},s&&{sessionProperties:s}),a&&{scopedProperties:a}),{id:fP()}),(l||u)&&{requests:{authentication:null===l||void 0===l?void 0:l.map((e=>{const{domain:t,chains:n,nonce:r,uri:i,exp:o,nbf:s,type:a,statement:c,requestId:l,resources:u,signatureTypes:d}=e;return{domain:t,chains:n,nonce:r,type:null!==a&&void 0!==a?a:"caip122",aud:i,version:"1",iat:(new Date).toISOString(),exp:o,nbf:s,statement:c,requestId:l,resources:u,signatureTypes:d}})),walletPay:u}}),v=wx("session_connect",m.id),{reject:b,resolve:w,done:E}=px(d,sD),_=e=>{let{id:t}=e;t===m.id&&(this.client.events.off("proposal_expire",_),this.pendingSessions.delete(m.id),this.events.emit(v,{error:{message:sD,code:0}}))};return this.client.events.on("proposal_expire",_),this.events.once(v,(e=>{let{error:t,session:n}=e;this.client.events.off("proposal_expire",_),t?b(t):n&&w(n)})),await this.setProposal(m.id,m),await this.sendProposeSession({proposal:m,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:{correlationId:m.id}}}).catch((e=>{throw this.deleteProposal(m.id),e})),{uri:f,approval:E}})),ID(this,"pair",(async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(e)}catch(t){throw this.client.logger.error("pair() failed"),t}})),ID(this,"approve",(async e=>{var t,n,r;const i=this.client.core.eventClient.createEvent({properties:{topic:null==(t=null===e||void 0===e?void 0:e.id)?void 0:t.toString(),trace:[FC]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(xt){throw i.setError(ZC),xt}try{await this.isValidProposalId(null===e||void 0===e?void 0:e.id)}catch(xt){throw this.client.logger.error("approve() -> proposal.get(".concat(null===e||void 0===e?void 0:e.id,") failed")),i.setError($C),xt}try{await this.isValidApprove(e)}catch(xt){throw this.client.logger.error("approve() -> isValidApprove() failed"),i.setError(JC),xt}const{id:o,relayProtocol:s,namespaces:a,sessionProperties:c,scopedProperties:l,sessionConfig:u,proposalRequestsResponses:d}=e,f=this.client.proposal.get(o);this.client.core.eventClient.deleteEvent({eventId:i.eventId});const{pairingTopic:h,proposer:p,requiredNamespaces:g,optionalNamespaces:y}=f;let m=null==(n=this.client.core.eventClient)?void 0:n.getEvent({topic:h});m||(m=null==(r=this.client.core.eventClient)?void 0:r.createEvent({type:FC,properties:{topic:h,trace:[FC,zC]}}));const v=await this.client.core.crypto.generateKeyPair(),b=p.publicKey,w=await this.client.core.crypto.generateSharedKey(v,b),E=xD(SD(SD(SD({relay:{protocol:null!==s&&void 0!==s?s:"irn"},namespaces:a,controller:{publicKey:v,metadata:this.client.metadata},expiry:vx(aD)},c&&{sessionProperties:c}),l&&{scopedProperties:l}),u&&{sessionConfig:u}),{proposalRequestsResponses:d}),_=$P.relay;m.addTrace(qC);try{await this.client.core.relayer.subscribe(w,{transportType:_,internal:{skipSubscribe:!0}})}catch(xt){throw m.setError(QC),xt}m.addTrace(HC);const S=xD(SD({},E),{topic:w,requiredNamespaces:g,optionalNamespaces:y,pairingTopic:h,acknowledged:!1,self:E.controller,peer:{publicKey:p.publicKey,metadata:p.metadata},controller:v,transportType:$P.relay,authentication:null===d||void 0===d?void 0:d.authentication,walletPayResult:null===d||void 0===d?void 0:d.walletPay});await this.client.session.set(w,S),m.addTrace(KC);try{await this.sendApproveSession({sessionTopic:w,proposal:f,pairingProposalResponse:{relay:{protocol:null!==s&&void 0!==s?s:"irn"},responderPublicKey:v},sessionSettleRequest:E,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:SD({correlationId:o},this.getTVFApproveParams(S))}}),m.addTrace(VC)}catch(xt){throw this.client.logger.error(xt),this.client.session.delete(w,Ik("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(w),xt}return this.client.core.eventClient.deleteEvent({eventId:m.eventId}),await this.client.core.pairing.updateMetadata({topic:h,metadata:p.metadata}),await this.deleteProposal(o),await this.client.core.pairing.activate({topic:h}),await this.setExpiry(w,vx(aD)),{topic:w,acknowledged:()=>Promise.resolve(this.client.session.get(w))}})),ID(this,"reject",(async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(e)}catch(i){throw this.client.logger.error("reject() -> isValidReject() failed"),i}const{id:t,reason:n}=e;let r;try{r=this.client.proposal.get(t).pairingTopic}catch(i){throw this.client.logger.error("reject() -> proposal.get(".concat(t,") failed")),i}r&&await this.sendError({id:t,topic:r,error:n,rpcOpts:cD.wc_sessionPropose.reject}),await this.deleteProposal(t)})),ID(this,"update",(async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(e)}catch(Xe){throw this.client.logger.error("update() -> isValidUpdate() failed"),Xe}const{topic:t,namespaces:n}=e,{done:r,resolve:i,reject:o}=px(Bd.FIVE_MINUTES,"Session update request expired without receiving any acknowledgement"),s=fP(),a=hP().toString(),c=this.client.session.get(t).namespaces;return this.events.once(wx("session_update",s),(e=>{let{error:t}=e;t?o(t):i()})),await this.client.session.update(t,{namespaces:n}),await this.sendRequest({topic:t,method:"wc_sessionUpdate",params:{namespaces:n},throwOnFailedPublish:!0,clientRpcId:s,relayRpcId:a}).catch((e=>{this.client.logger.error(e),this.client.session.update(t,{namespaces:c}),o(e)})),{acknowledged:r}})),ID(this,"extend",(async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(e)}catch(Ke){throw this.client.logger.error("extend() -> isValidExtend() failed"),Ke}const{topic:t}=e,n=fP(),{done:r,resolve:i,reject:o}=px(Bd.FIVE_MINUTES,"Session extend request expired without receiving any acknowledgement");return this.events.once(wx("session_extend",n),(e=>{let{error:t}=e;t?o(t):i()})),await this.setExpiry(t,vx(aD)),this.sendRequest({topic:t,method:"wc_sessionExtend",params:{},clientRpcId:n,throwOnFailedPublish:!0}).catch((e=>{o(e)})),{acknowledged:r}})),ID(this,"request",(async e=>{this.isInitialized();try{await this.isValidRequest(e)}catch(rt){throw this.client.logger.error("request() -> isValidRequest() failed"),rt}const{chainId:t,request:n,topic:r,expiry:i=cD.wc_sessionRequest.req.ttl}=e,o=this.client.session.get(r);(null===o||void 0===o?void 0:o.transportType)===$P.relay&&await this.confirmOnlineStateOrThrow();const s=fP(),a=hP().toString(),{done:c,resolve:l,reject:u}=px(i,"Request expired. Please try again.");this.events.once(wx("session_request",s),(e=>{let{error:t,result:n}=e;t?u(t):l(n)}));const d="wc_sessionRequest",f=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);if(f)return await this.sendRequest({clientRpcId:s,relayRpcId:a,topic:r,method:d,params:{request:xD(SD({},n),{expiryTimestamp:vx(i)}),chainId:t},expiry:i,throwOnFailedPublish:!0,appLink:f}).catch((e=>u(e))),this.client.events.emit("session_request_sent",{topic:r,request:n,chainId:t,id:s}),await c();const h={request:xD(SD({},n),{expiryTimestamp:vx(i)}),chainId:t};return await Promise.all([new Promise((async e=>{await this.sendRequest({clientRpcId:s,relayRpcId:a,topic:r,method:d,params:h,expiry:i,throwOnFailedPublish:!0,tvf:this.getTVFParams(s,h)}).catch((e=>u(e))),this.client.events.emit("session_request_sent",{topic:r,request:n,chainId:t,id:s}),e()})),new Promise((async e=>{var t;if(null==(t=o.sessionConfig)||!t.disableDeepLink){const e=await async function(e,t){let n="";try{if(ix()&&(n=localStorage.getItem(t),n))return n;n=await e.getItem(t)}catch(i){console.error(i)}return n}(this.client.core.storage,oD);await _x({id:s,topic:r,wcDeepLink:e})}e()})),c()]).then((e=>e[2]))})),ID(this,"respond",(async e=>{var t,n;this.isInitialized();const r=this.client.core.eventClient.createEvent({properties:{topic:(null===e||void 0===e?void 0:e.topic)||(null==(n=null==(t=null===e||void 0===e?void 0:e.response)?void 0:t.id)?void 0:n.toString()),trace:[WC]}});try{await this.isValidRespond(e)}catch(Xe){throw r.addTrace(null===Xe||void 0===Xe?void 0:Xe.message),r.setError(eN),Xe}r.addTrace(GC);const{topic:i,response:o}=e,{id:s}=o,a=this.client.session.get(i);a.transportType===$P.relay&&await this.confirmOnlineStateOrThrow();const c=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);try{r.addTrace(YC),AP(o)?await this.sendResult({id:s,topic:i,result:o.result,throwOnFailedPublish:!0,appLink:c}):TP(o)&&await this.sendError({id:s,topic:i,error:o.error,appLink:c}),this.cleanupAfterResponse(e)}catch(Xe){throw r.addTrace(null===Xe||void 0===Xe?void 0:Xe.message),r.setError(tN),Xe}})),ID(this,"ping",(async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(e)}catch(We){throw this.client.logger.error("ping() -> isValidPing() failed"),We}const{topic:t}=e;if(this.client.session.keys.includes(t)){const e=fP(),n=hP().toString(),{done:r,resolve:i,reject:o}=px(Bd.FIVE_MINUTES,"Ping request expired without receiving any acknowledgement");this.events.once(wx("session_ping",e),(e=>{let{error:t}=e;t?o(t):i()})),await Promise.all([this.sendRequest({topic:t,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:e,relayRpcId:n}),r()])}else this.client.core.pairing.pairings.keys.includes(t)&&(this.client.logger.warn("ping() on pairing topic is deprecated and will be removed in the next major release."),await this.client.core.pairing.ping({topic:t}))})),ID(this,"emit",(async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(e);const{topic:t,event:n,chainId:r}=e,i=hP().toString(),o=fP();await this.sendRequest({topic:t,method:"wc_sessionEvent",params:{event:n,chainId:r},throwOnFailedPublish:!0,relayRpcId:i,clientRpcId:o})})),ID(this,"disconnect",(async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(e);const{topic:t}=e;if(this.client.session.keys.includes(t))await this.sendRequest({topic:t,method:"wc_sessionDelete",params:Ik("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:t,emitEvent:!1});else{if(!this.client.core.pairing.pairings.keys.includes(t)){const{message:e}=xk("MISMATCHED_TOPIC","Session or pairing topic not found: ".concat(t));throw new Error(e)}await this.client.core.pairing.disconnect({topic:t})}})),ID(this,"find",(e=>(this.isInitialized(),this.client.session.getAll().filter((t=>function(e,t){const{requiredNamespaces:n}=t,r=Object.keys(e.namespaces),i=Object.keys(n);let o=!0;return!!dx(i,r)&&(r.forEach((t=>{const{accounts:r,methods:i,events:s}=e.namespaces[t],a=yk(r),c=n[t];(!dx(HS(t,c),a)||!dx(c.methods,i)||!dx(c.events,s))&&(o=!1)})),o)}(t,e)))))),ID(this,"getPendingSessionRequests",(()=>this.client.pendingRequest.getAll())),ID(this,"authenticate",(async(e,t)=>{var n,r;this.isInitialized(),this.isValidAuthenticate(e);const i=t&&this.client.core.linkModeSupportedApps.includes(t)&&(null==(r=this.client.metadata.redirect)?void 0:r.linkMode),o=i?$P.link_mode:$P.relay;o===$P.relay&&await this.confirmOnlineStateOrThrow();const{chains:s,statement:a="",uri:c,domain:l,nonce:u,type:d,exp:f,nbf:h,methods:p=[],expiry:g}=e,y=[...e.resources||[]],{topic:m,uri:v}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:m,uri:v}});const b=await this.client.core.crypto.generateKeyPair(),w=UR(b);if(await Promise.all([this.client.auth.authKeys.set(gD,{responseTopic:w,publicKey:b}),this.client.auth.pairingTopics.set(w,{topic:w,pairingTopic:m})]),await this.client.core.relayer.subscribe(w,{transportType:o}),this.client.logger.info("sending request to new pairing topic: ".concat(m)),p.length>0){const{namespace:e}=qS(s[0]);let t=zO(e,"request",p);GO(y)&&(t=HO(t,y.pop())),y.push(t)}const E=g&&g>cD.wc_sessionAuthenticate.req.ttl?g:cD.wc_sessionAuthenticate.req.ttl,_={authPayload:{type:null!==d&&void 0!==d?d:"caip122",chains:s,statement:a,aud:c,domain:l,version:"1",nonce:u,iat:(new Date).toISOString(),exp:f,nbf:h,resources:y},requester:{publicKey:b,metadata:this.client.metadata},expiryTimestamp:vx(E)},S={requiredNamespaces:{},optionalNamespaces:{eip155:{chains:s,methods:[...new Set(["personal_sign",...p])],events:["chainChanged","accountsChanged"]}},relays:[{protocol:"irn"}],pairingTopic:m,proposer:{publicKey:b,metadata:this.client.metadata},expiryTimestamp:vx(cD.wc_sessionPropose.req.ttl),id:fP()},{done:x,resolve:I,reject:O}=px(E,"Request expired"),A=fP(),T=wx("session_connect",S.id),R=wx("session_request",A),k=async e=>{let{error:t,session:n}=e;this.events.off(R,P),t?O(t):n&&I({session:n})},P=async e=>{var n,r,i;if(await this.deletePendingAuthRequest(A,{message:"fulfilled",code:0}),e.error){const t=Ik("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return e.error.code===t.code?void 0:(this.events.off(T,k),O(e.error.message))}await this.deleteProposal(S.id),this.events.off(T,k);const{cacaos:s,responder:a}=e.result,c=[],l=[];for(const t of s){await BO({cacao:t,projectId:this.client.core.projectId})||(this.client.logger.error(t,"Signature verification failed"),O(Ik("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:e}=t,n=GO(e.resources),r=[NO(e.iss)],i=UO(e.iss);if(n){const e=KO(n),t=WO(n);c.push(...e),r.push(...t)}for(const t of r)l.push("".concat(t,":").concat(i))}const u=await this.client.core.crypto.generateSharedKey(b,a.publicKey);let d;c.length>0&&(d={topic:u,acknowledged:!0,self:{publicKey:b,metadata:this.client.metadata},peer:a,controller:a.publicKey,expiry:vx(aD),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:m,namespaces:Ek([...new Set(c)],[...new Set(l)]),transportType:o},await this.client.core.relayer.subscribe(u,{transportType:o}),await this.client.session.set(u,d),m&&await this.client.core.pairing.updateMetadata({topic:m,metadata:a.metadata}),d=this.client.session.get(u)),null!=(n=this.client.metadata.redirect)&&n.linkMode&&null!=(r=a.metadata.redirect)&&r.linkMode&&null!=(i=a.metadata.redirect)&&i.universal&&t&&(this.client.core.addLinkModeSupportedApp(a.metadata.redirect.universal),this.client.session.update(u,{transportType:$P.link_mode})),I({auths:s,session:d})};let C;this.events.once(T,k),this.events.once(R,P);try{if(i){const e=pP("wc_sessionAuthenticate",_,A);this.client.core.history.set(m,e);const n=await this.client.core.crypto.encode("",e,{type:TR,encoding:xR});C=sk(t,m,n)}else await Promise.all([this.sendRequest({topic:m,method:"wc_sessionAuthenticate",params:_,expiry:e.expiry,throwOnFailedPublish:!0,clientRpcId:A}),this.sendRequest({topic:m,method:"wc_sessionPropose",params:S,expiry:cD.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:S.id})])}catch(at){throw this.events.off(T,k),this.events.off(R,P),at}return await this.setProposal(S.id,S),await this.setAuthRequest(A,{request:xD(SD({},_),{verifyContext:{}}),pairingTopic:m,transportType:o}),{uri:null!==(n=C)&&void 0!==n?n:v,response:x}})),ID(this,"approveSessionAuthenticate",(async e=>{const{id:t,auths:n}=e,r=this.client.core.eventClient.createEvent({properties:{topic:t.toString(),trace:[nN]}});try{this.isInitialized()}catch(rt){throw r.setError(lN),rt}const i=this.getPendingAuthRequest(t);if(!i)throw r.setError(hN),new Error("Could not find pending auth request with id ".concat(t));const o=i.transportType||$P.relay;o===$P.relay&&await this.confirmOnlineStateOrThrow();const s=i.requester.publicKey,a=await this.client.core.crypto.generateKeyPair(),c=UR(s),l={type:AR,receiverPublicKey:s,senderPublicKey:a},u=[],d=[];for(const p of n){if(!await BO({cacao:p,projectId:this.client.core.projectId})){r.setError(uN);const e=Ik("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:t,topic:c,error:e,encodeOpts:l}),new Error(e.message)}r.addTrace(iN);const{p:e}=p,n=GO(e.resources),i=[NO(e.iss)],o=UO(e.iss);if(n){const e=KO(n),t=WO(n);u.push(...e),i.push(...t)}for(const t of i)d.push("".concat(t,":").concat(o))}const f=await this.client.core.crypto.generateSharedKey(a,s);let h;if(r.addTrace(rN),(null===u||void 0===u?void 0:u.length)>0){h={topic:f,acknowledged:!0,self:{publicKey:a,metadata:this.client.metadata},peer:{publicKey:s,metadata:i.requester.metadata},controller:s,expiry:vx(aD),authentication:n,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:i.pairingTopic,namespaces:Ek([...new Set(u)],[...new Set(d)]),transportType:o},r.addTrace(sN);try{await this.client.core.relayer.subscribe(f,{transportType:o})}catch(rt){throw r.setError(dN),rt}r.addTrace(aN),await this.client.session.set(f,h),r.addTrace(oN),await this.client.core.pairing.updateMetadata({topic:i.pairingTopic,metadata:i.requester.metadata})}r.addTrace(cN);try{await this.sendResult({topic:c,id:t,result:{cacaos:n,responder:{publicKey:a,metadata:this.client.metadata}},encodeOpts:l,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(i.requester.metadata,o)})}catch(rt){throw r.setError(fN),rt}return await this.client.auth.requests.delete(t,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:i.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:r.eventId}),{session:h}})),ID(this,"rejectSessionAuthenticate",(async e=>{this.isInitialized();const{id:t,reason:n}=e,r=this.getPendingAuthRequest(t);if(!r)throw new Error("Could not find pending auth request with id ".concat(t));r.transportType===$P.relay&&await this.confirmOnlineStateOrThrow();const i=r.requester.publicKey,o=await this.client.core.crypto.generateKeyPair(),s=UR(i),a={type:AR,receiverPublicKey:i,senderPublicKey:o};await this.sendError({id:t,topic:s,error:n,encodeOpts:a,rpcOpts:cD.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(r.requester.metadata,r.transportType)}),await this.client.auth.requests.delete(t,{message:"rejected",code:0}),await this.deleteProposal(t)})),ID(this,"formatAuthMessage",(e=>{this.isInitialized();const{request:t,iss:n}=e;return LO(t,n)})),ID(this,"processRelayMessageCache",(()=>{setTimeout((async()=>{if(0!==this.relayMessageCache.length)for(;this.relayMessageCache.length>0;)try{const e=this.relayMessageCache.shift();e&&await this.onRelayMessage(e)}catch(Mz){this.client.logger.error(Mz)}}),50)})),ID(this,"cleanupDuplicatePairings",(async e=>{if(e.pairingTopic)try{const t=this.client.core.pairing.pairings.get(e.pairingTopic),n=this.client.core.pairing.pairings.getAll().filter((n=>{var r,i;return(null==(r=n.peerMetadata)?void 0:r.url)&&(null==(i=n.peerMetadata)?void 0:i.url)===e.peer.metadata.url&&n.topic&&n.topic!==t.topic}));if(0===n.length)return;this.client.logger.info("Cleaning up ".concat(n.length," duplicate pairing(s)")),await Promise.all(n.map((e=>this.client.core.pairing.disconnect({topic:e.topic})))),this.client.logger.info("Duplicate pairings clean up finished")}catch(t){this.client.logger.error(t)}})),ID(this,"deleteSession",(async e=>{var t;const{topic:n,expirerHasDeleted:r=!1,emitEvent:i=!0,id:o=0}=e,{self:s}=this.client.session.get(n);await this.client.core.relayer.unsubscribe(n),await this.client.session.delete(n,Ik("USER_DISCONNECTED")),this.addToRecentlyDeleted(n,"session"),this.client.core.crypto.keychain.has(s.publicKey)&&await this.client.core.crypto.deleteKeyPair(s.publicKey),this.client.core.crypto.keychain.has(n)&&await this.client.core.crypto.deleteSymKey(n),r||this.client.core.expirer.del(n),this.client.core.storage.removeItem(oD).catch((e=>this.client.logger.warn(e))),n===(null==(t=this.sessionRequestQueue.queue[0])?void 0:t.topic)&&(this.sessionRequestQueue.state=uD),await Promise.all(this.getPendingSessionRequests().filter((e=>e.topic===n)).map((e=>this.deletePendingSessionRequest(e.id,Ik("USER_DISCONNECTED"))))),i&&this.client.events.emit("session_delete",{id:o,topic:n})})),ID(this,"deleteProposal",(async(e,t)=>{if(t)try{const t=this.client.proposal.get(e),n=this.client.core.eventClient.getEvent({topic:t.pairingTopic});null===n||void 0===n||n.setError(XC)}catch{}await Promise.all([this.client.proposal.delete(e,Ik("USER_DISCONNECTED")),t?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"proposal")})),ID(this,"deletePendingSessionRequest",(async function(e,n){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];await Promise.all([t.client.pendingRequest.delete(e,n),r?Promise.resolve():t.client.core.expirer.del(e)]),t.addToRecentlyDeleted(e,"request"),t.sessionRequestQueue.queue=t.sessionRequestQueue.queue.filter((t=>t.id!==e)),r&&(t.sessionRequestQueue.state=uD,t.client.events.emit("session_request_expire",{id:e}))})),ID(this,"deletePendingAuthRequest",(async function(e,n){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];await Promise.all([t.client.auth.requests.delete(e,n),r?Promise.resolve():t.client.core.expirer.del(e)])})),ID(this,"setExpiry",(async(e,t)=>{this.client.session.keys.includes(e)&&(this.client.core.expirer.set(e,t),await this.client.session.update(e,{expiry:t}))})),ID(this,"setProposal",(async(e,t)=>{this.client.core.expirer.set(e,vx(cD.wc_sessionPropose.req.ttl)),await this.client.proposal.set(e,t)})),ID(this,"setAuthRequest",(async(e,t)=>{const{request:n,pairingTopic:r,transportType:i=$P.relay}=t;this.client.core.expirer.set(e,n.expiryTimestamp),await this.client.auth.requests.set(e,{authPayload:n.authPayload,requester:n.requester,expiryTimestamp:n.expiryTimestamp,id:e,pairingTopic:r,verifyContext:n.verifyContext,transportType:i})})),ID(this,"setPendingSessionRequest",(async e=>{const{id:t,topic:n,params:r,verifyContext:i}=e,o=r.request.expiryTimestamp||vx(cD.wc_sessionRequest.req.ttl);this.client.core.expirer.set(t,o),await this.client.pendingRequest.set(t,{id:t,topic:n,params:r,verifyContext:i})})),ID(this,"sendRequest",(async e=>{const{topic:t,method:n,params:r,expiry:i,relayRpcId:o,clientRpcId:s,throwOnFailedPublish:a,appLink:c,tvf:l,publishOpts:u={}}=e,d=pP(n,r,s);let f;const h=!!c;try{const e=h?xR:SR;f=await this.client.core.crypto.encode(t,d,{encoding:e})}catch(ot){throw await this.cleanup(),this.client.logger.error("sendRequest() -> core.crypto.encode() for topic ".concat(t," failed")),ot}let p;if(hD.includes(n)){const e=BR(JSON.stringify(d)),t=BR(f);p=await this.client.core.verify.register({id:t,decryptedId:e})}const g=SD(SD({},cD[n].req),u);if(g.attestation=p,i&&(g.ttl=i),o&&(g.id=o),this.client.core.history.set(t,d),h){const e=sk(c,t,f);await global.Linking.openURL(e,this.client.name)}else g.tvf=xD(SD({},l),{correlationId:d.id}),a?(g.internal=xD(SD({},g.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(t,f,g)):this.client.core.relayer.publish(t,f,g).catch((e=>this.client.logger.error(e)));return d.id})),ID(this,"sendProposeSession",(async e=>{const{proposal:t,publishOpts:n}=e,r=pP("wc_sessionPropose",t,t.id);this.client.core.history.set(t.pairingTopic,r);const i=await this.client.core.crypto.encode(t.pairingTopic,r,{encoding:SR}),o=BR(JSON.stringify(r)),s=BR(i),a=await this.client.core.verify.register({id:s,decryptedId:o});await this.client.core.relayer.publishCustom({payload:{pairingTopic:t.pairingTopic,sessionProposal:i},opts:xD(SD({},n),{publishMethod:"wc_proposeSession",attestation:a})})})),ID(this,"sendApproveSession",(async e=>{const{sessionTopic:t,pairingProposalResponse:n,proposal:r,sessionSettleRequest:i,publishOpts:o}=e,s=gP(r.id,n),a=await this.client.core.crypto.encode(r.pairingTopic,s,{encoding:SR}),c=pP("wc_sessionSettle",i,null===o||void 0===o?void 0:o.id),l=await this.client.core.crypto.encode(t,c,{encoding:SR});this.client.core.history.set(t,c),await this.client.core.relayer.publishCustom({payload:{sessionTopic:t,pairingTopic:r.pairingTopic,sessionProposalResponse:a,sessionSettlementRequest:l},opts:xD(SD({},o),{publishMethod:"wc_approveSession"})})})),ID(this,"sendResult",(async e=>{const{id:t,topic:n,result:r,throwOnFailedPublish:i,encodeOpts:o,appLink:s}=e,a=gP(t,r);let c;const l=s&&typeof(null==global?void 0:global.Linking)<"u";try{const e=l?xR:SR;c=await this.client.core.crypto.encode(n,a,xD(SD({},o||{}),{encoding:e}))}catch(Ye){throw await this.cleanup(),this.client.logger.error("sendResult() -> core.crypto.encode() for topic ".concat(n," failed")),Ye}let u,d;try{u=await this.client.core.history.get(n,t);const e=u.request;try{d=this.getTVFParams(t,e.params,r)}catch(ht){this.client.logger.warn("sendResult() -> getTVFParams() failed: ".concat(null===ht||void 0===ht?void 0:ht.message))}}catch(Ye){throw this.client.logger.error("sendResult() -> history.get(".concat(n,", ").concat(t,") failed")),Ye}if(l){const e=sk(s,n,c);await global.Linking.openURL(e,this.client.name)}else{const e=u.request.method,r=cD[e].res;r.tvf=xD(SD({},d),{correlationId:t}),i?(r.internal=xD(SD({},r.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,c,r)):this.client.core.relayer.publish(n,c,r).catch((e=>this.client.logger.error(e)))}await this.client.core.history.resolve(a)})),ID(this,"sendError",(async e=>{const{id:t,topic:n,error:r,encodeOpts:i,rpcOpts:o,appLink:s}=e,a=yP(t,r);let c;const l=s&&typeof(null==global?void 0:global.Linking)<"u";try{const e=l?xR:SR;c=await this.client.core.crypto.encode(n,a,xD(SD({},i||{}),{encoding:e}))}catch(Je){throw await this.cleanup(),this.client.logger.error("sendError() -> core.crypto.encode() for topic ".concat(n," failed")),Je}let u;try{u=await this.client.core.history.get(n,t)}catch(Je){throw this.client.logger.error("sendError() -> history.get(".concat(n,", ").concat(t,") failed")),Je}if(l){const e=sk(s,n,c);await global.Linking.openURL(e,this.client.name)}else{const e=u.request.method,t=o||cD[e].res;this.client.core.relayer.publish(n,c,t)}await this.client.core.history.resolve(a)})),ID(this,"cleanup",(async()=>{const e=[],t=[];this.client.session.getAll().forEach((t=>{let n=!1;bx(t.expiry)&&(n=!0),this.client.core.crypto.keychain.has(t.topic)||(n=!0),n&&e.push(t.topic)})),this.client.proposal.getAll().forEach((e=>{bx(e.expiryTimestamp)&&t.push(e.id)})),await Promise.all([...e.map((e=>this.deleteSession({topic:e}))),...t.map((e=>this.deleteProposal(e)))])})),ID(this,"onProviderMessageEvent",(async e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):await this.onRelayMessage(e)})),ID(this,"onRelayEventRequest",(async e=>{this.requestQueue.queue.push(e),await this.processRequestsQueue()})),ID(this,"processRequestsQueue",(async()=>{if(this.requestQueue.state!==dD){for(this.client.logger.info("Request queue starting with ".concat(this.requestQueue.queue.length," requests"));this.requestQueue.queue.length>0;){this.requestQueue.state=dD;const t=this.requestQueue.queue.shift();if(t)try{await this.processRequest(t)}catch(e){this.client.logger.warn(e)}}this.requestQueue.state=uD}else this.client.logger.info("Request queue already active, skipping...")})),ID(this,"processRequest",(async e=>{const{topic:t,payload:n,attestation:r,transportType:i,encryptedId:o}=e,s=n.method;if(!this.shouldIgnorePairingRequest({topic:t,requestMethod:s}))switch(s){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:t,payload:n,attestation:r,encryptedId:o});case"wc_sessionSettle":return await this.onSessionSettleRequest(t,n);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(t,n);case"wc_sessionExtend":return await this.onSessionExtendRequest(t,n);case"wc_sessionPing":return await this.onSessionPingRequest(t,n);case"wc_sessionDelete":return await this.onSessionDeleteRequest(t,n);case"wc_sessionRequest":return await this.onSessionRequest({topic:t,payload:n,attestation:r,encryptedId:o,transportType:i});case"wc_sessionEvent":return await this.onSessionEventRequest(t,n);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:t,payload:n,attestation:r,encryptedId:o,transportType:i});default:return this.client.logger.info("Unsupported request method ".concat(s))}})),ID(this,"onRelayEventResponse",(async e=>{const{topic:t,payload:n,transportType:r}=e,i=(await this.client.core.history.get(t,n.id)).request.method;switch(i){case"wc_sessionPropose":return this.onSessionProposeResponse(t,n,r);case"wc_sessionSettle":return this.onSessionSettleResponse(t,n);case"wc_sessionUpdate":return this.onSessionUpdateResponse(t,n);case"wc_sessionExtend":return this.onSessionExtendResponse(t,n);case"wc_sessionPing":return this.onSessionPingResponse(t,n);case"wc_sessionRequest":return this.onSessionRequestResponse(t,n);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(t,n);default:return this.client.logger.info("Unsupported response method ".concat(i))}})),ID(this,"onRelayEventUnknownPayload",(e=>{const{topic:t}=e,{message:n}=xk("MISSING_OR_INVALID","Decoded payload on topic ".concat(t," is not identifiable as a JSON-RPC request or a response."));throw new Error(n)})),ID(this,"shouldIgnorePairingRequest",(e=>{const{topic:t,requestMethod:n}=e,r=this.expectedPairingMethodMap.get(t);return!(!r||r.includes(n))&&!!(r.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)})),ID(this,"onSessionProposeRequest",(async e=>{const{topic:t,payload:n,attestation:r,encryptedId:i}=e,{params:o,id:s}=n;try{const e=this.client.core.eventClient.getEvent({topic:t});0===this.client.events.listenerCount("session_proposal")&&(console.warn("No listener for session_proposal event"),null!==e&&void 0!==e&&e.setError(MC)),this.isValidConnect(SD({},n.params));const a=o.expiryTimestamp||vx(cD.wc_sessionPropose.req.ttl),c=SD({id:s,pairingTopic:t,expiryTimestamp:a,attestation:r,encryptedId:i},o);await this.setProposal(s,c);const l=await this.getVerifyContext({attestationId:r,hash:BR(JSON.stringify(n)),encryptedId:i,metadata:c.proposer.metadata});null!==e&&void 0!==e&&e.addTrace(NC),this.client.events.emit("session_proposal",{id:s,params:c,verifyContext:l})}catch(Ze){await this.sendError({id:s,topic:t,error:Ze,rpcOpts:cD.wc_sessionPropose.autoReject}),this.client.logger.error(Ze)}})),ID(this,"onSessionProposeResponse",(async(e,t,n)=>{const{id:r}=t;if(AP(t)){const{result:i}=t;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:i});const o=this.client.proposal.get(r);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:o});const s=o.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:s});const a=i.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:a});const c=await this.client.core.crypto.generateSharedKey(s,a);this.pendingSessions.set(r,{sessionTopic:c,pairingTopic:e,proposalId:r,publicKey:s});const l=await this.client.core.relayer.subscribe(c,{transportType:n});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:l}),await this.client.core.pairing.activate({topic:e})}else if(TP(t)){await this.deleteProposal(r);const e=wx("session_connect",r);if(0===this.events.listenerCount(e))throw new Error("emitting ".concat(e," without any listeners, 954"));this.events.emit(e,{error:t.error})}})),ID(this,"onSessionSettleRequest",(async(e,t)=>{const{id:n,params:r}=t;try{this.isValidSessionSettleRequest(r);const{relay:n,controller:i,expiry:o,namespaces:s,sessionProperties:a,scopedProperties:c,sessionConfig:l,proposalRequestsResponses:u}=t.params,d=[...this.pendingSessions.values()].find((t=>t.sessionTopic===e));if(!d)return this.client.logger.error("Pending session not found for topic ".concat(e));const f=this.client.proposal.get(d.proposalId),h=xD(SD(SD(SD({topic:e,relay:n,expiry:o,namespaces:s,acknowledged:!0,pairingTopic:d.pairingTopic,requiredNamespaces:f.requiredNamespaces,optionalNamespaces:f.optionalNamespaces,controller:i.publicKey,self:{publicKey:d.publicKey,metadata:this.client.metadata},peer:{publicKey:i.publicKey,metadata:i.metadata}},a&&{sessionProperties:a}),c&&{scopedProperties:c}),l&&{sessionConfig:l}),{transportType:$P.relay,authentication:null===u||void 0===u?void 0:u.authentication,walletPayResult:null===u||void 0===u?void 0:u.walletPay});await this.client.session.set(h.topic,h),await this.setExpiry(h.topic,h.expiry),await this.client.core.pairing.updateMetadata({topic:d.pairingTopic,metadata:h.peer.metadata}),this.pendingSessions.delete(d.proposalId),this.deleteProposal(d.proposalId,!1),this.cleanupDuplicatePairings(h),await this.sendResult({id:t.id,topic:e,throwOnFailedPublish:!0,result:!0}),this.client.events.emit("session_connect",{session:h}),this.events.emit(wx("session_connect",d.proposalId),{session:h})}catch(i){await this.sendError({id:n,topic:e,error:i}),this.client.logger.error(i)}})),ID(this,"onSessionSettleResponse",(async(e,t)=>{const{id:n}=t;AP(t)?(await this.client.session.update(e,{acknowledged:!0}),this.events.emit(wx("session_approve",n),{})):TP(t)&&(await this.client.session.delete(e,Ik("USER_DISCONNECTED")),this.events.emit(wx("session_approve",n),{error:t.error}))})),ID(this,"onSessionUpdateRequest",(async(e,t)=>{const{params:n,id:r}=t;try{const t="".concat(e,"_session_update"),i=Gk.get(t);if(i&&this.isRequestOutOfSync(i,r))return this.client.logger.warn("Discarding out of sync request - ".concat(r)),void this.sendError({id:r,topic:e,error:Ik("INVALID_UPDATE_REQUEST")});this.isValidUpdate(SD({topic:e},n));try{Gk.set(t,r),await this.client.session.update(e,{namespaces:n.namespaces}),await this.sendResult({id:r,topic:e,result:!0})}catch(Ke){throw Gk.delete(t),Ke}this.client.events.emit("session_update",{id:r,topic:e,params:n})}catch(i){await this.sendError({id:r,topic:e,error:i}),this.client.logger.error(i)}})),ID(this,"isRequestOutOfSync",((e,t)=>t.toString().slice(0,-3)<e.toString().slice(0,-3))),ID(this,"onSessionUpdateResponse",((e,t)=>{const{id:n}=t,r=wx("session_update",n);if(0===this.events.listenerCount(r))throw new Error("emitting ".concat(r," without any listeners"));AP(t)?this.events.emit(wx("session_update",n),{}):TP(t)&&this.events.emit(wx("session_update",n),{error:t.error})})),ID(this,"onSessionExtendRequest",(async(e,t)=>{const{id:n}=t;try{this.isValidExtend({topic:e}),await this.setExpiry(e,vx(aD)),await this.sendResult({id:n,topic:e,result:!0}),this.client.events.emit("session_extend",{id:n,topic:e})}catch(Qu){await this.sendError({id:n,topic:e,error:Qu}),this.client.logger.error(Qu)}})),ID(this,"onSessionExtendResponse",((e,t)=>{const{id:n}=t,r=wx("session_extend",n);if(0===this.events.listenerCount(r))throw new Error("emitting ".concat(r," without any listeners"));AP(t)?this.events.emit(wx("session_extend",n),{}):TP(t)&&this.events.emit(wx("session_extend",n),{error:t.error})})),ID(this,"onSessionPingRequest",(async(e,t)=>{const{id:n}=t;try{this.isValidPing({topic:e}),await this.sendResult({id:n,topic:e,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:n,topic:e})}catch(Qu){await this.sendError({id:n,topic:e,error:Qu}),this.client.logger.error(Qu)}})),ID(this,"onSessionPingResponse",((e,t)=>{const{id:n}=t,r=wx("session_ping",n);setTimeout((()=>{if(0===this.events.listenerCount(r))throw new Error("emitting ".concat(r," without any listeners 2176"));AP(t)?this.events.emit(wx("session_ping",n),{}):TP(t)&&this.events.emit(wx("session_ping",n),{error:t.error})}),500)})),ID(this,"onSessionDeleteRequest",(async(e,t)=>{const{id:n}=t;try{await this.isValidDisconnect({topic:e,reason:t.params}),this.cleanupPendingSentRequestsForTopic({topic:e,error:Ik("USER_DISCONNECTED")}),await this.deleteSession({topic:e,id:n})}catch(Qu){this.client.logger.error(Qu)}})),ID(this,"onSessionRequest",(async e=>{var t,n,r;const{topic:i,payload:o,attestation:s,encryptedId:a,transportType:c}=e,{id:l,params:u}=o;try{await this.isValidRequest(SD({topic:i},u));const e=this.client.session.get(i),o={id:l,topic:i,params:u,verifyContext:await this.getVerifyContext({attestationId:s,hash:BR(JSON.stringify(pP("wc_sessionRequest",u,l))),encryptedId:a,metadata:e.peer.metadata,transportType:c})};await this.setPendingSessionRequest(o),c===$P.link_mode&&null!=(t=e.peer.metadata.redirect)&&t.universal&&this.client.core.addLinkModeSupportedApp(null==(n=e.peer.metadata.redirect)?void 0:n.universal),null!=(r=this.client.signConfig)&&r.disableRequestQueue?this.emitSessionRequest(o):(this.addSessionRequestToSessionRequestQueue(o),this.processSessionRequestQueue())}catch(Je){await this.sendError({id:l,topic:i,error:Je}),this.client.logger.error(Je)}})),ID(this,"onSessionRequestResponse",((e,t)=>{const{id:n}=t,r=wx("session_request",n);if(0===this.events.listenerCount(r))throw new Error("emitting ".concat(r," without any listeners"));AP(t)?this.events.emit(wx("session_request",n),{result:t.result}):TP(t)&&this.events.emit(wx("session_request",n),{error:t.error})})),ID(this,"onSessionEventRequest",(async(e,t)=>{const{id:n,params:r}=t;try{const t="".concat(e,"_session_event_").concat(r.event.name),i=Gk.get(t);if(i&&this.isRequestOutOfSync(i,n))return void this.client.logger.info("Discarding out of sync request - ".concat(n));this.isValidEmit(SD({topic:e},r)),this.client.events.emit("session_event",{id:n,topic:e,params:r}),Gk.set(t,n)}catch(i){await this.sendError({id:n,topic:e,error:i}),this.client.logger.error(i)}})),ID(this,"onSessionAuthenticateResponse",((e,t)=>{const{id:n}=t;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:e,payload:t}),AP(t)?this.events.emit(wx("session_request",n),{result:t.result}):TP(t)&&this.events.emit(wx("session_request",n),{error:t.error})})),ID(this,"onSessionAuthenticateRequest",(async e=>{var t;const{topic:n,payload:r,attestation:i,encryptedId:o,transportType:s}=e;try{const{requester:e,authPayload:a,expiryTimestamp:c}=r.params,l=await this.getVerifyContext({attestationId:i,hash:BR(JSON.stringify(r)),encryptedId:o,metadata:e.metadata,transportType:s}),u={requester:e,pairingTopic:n,id:r.id,authPayload:a,verifyContext:l,expiryTimestamp:c};await this.setAuthRequest(r.id,{request:u,pairingTopic:n,transportType:s}),s===$P.link_mode&&null!=(t=e.metadata.redirect)&&t.universal&&this.client.core.addLinkModeSupportedApp(e.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:n,params:r.params,id:r.id,verifyContext:l})}catch(Ze){this.client.logger.error(Ze);const t=r.params.requester.publicKey,i=await this.client.core.crypto.generateKeyPair(),o=this.getAppLinkIfEnabled(r.params.requester.metadata,s),a={type:AR,receiverPublicKey:t,senderPublicKey:i};await this.sendError({id:r.id,topic:n,error:Ze,encodeOpts:a,rpcOpts:cD.wc_sessionAuthenticate.autoReject,appLink:o})}})),ID(this,"addSessionRequestToSessionRequestQueue",(e=>{this.sessionRequestQueue.queue.push(e)})),ID(this,"cleanupAfterResponse",(e=>{this.deletePendingSessionRequest(e.response.id,{message:"fulfilled",code:0}),setTimeout((()=>{this.sessionRequestQueue.state=uD,this.processSessionRequestQueue()}),(0,Bd.toMiliseconds)(this.requestQueueDelay))})),ID(this,"cleanupPendingSentRequestsForTopic",(e=>{let{topic:t,error:n}=e;const r=this.client.core.history.pending;r.length>0&&r.filter((e=>e.topic===t&&"wc_sessionRequest"===e.request.method)).forEach((e=>{this.events.emit(wx("session_request",e.request.id),{error:n})}))})),ID(this,"processSessionRequestQueue",(()=>{if(this.sessionRequestQueue.state===dD)return void this.client.logger.info("session request queue is already active.");const e=this.sessionRequestQueue.queue[0];if(e)try{this.emitSessionRequest(e)}catch(t){this.client.logger.error(t)}else this.client.logger.info("session request queue is empty.")})),ID(this,"emitSessionRequest",(e=>{this.emittedSessionRequests.has(e.id)?this.client.logger.warn({id:e.id},"Skipping emitting `session_request` event for duplicate request. id: ".concat(e.id)):(this.sessionRequestQueue.state=dD,this.emittedSessionRequests.add(e.id),this.client.events.emit("session_request",e))})),ID(this,"onPairingCreated",(e=>{if(e.methods&&this.expectedPairingMethodMap.set(e.topic,e.methods),e.active)return;const t=this.client.proposal.getAll().find((t=>t.pairingTopic===e.topic));t&&this.onSessionProposeRequest({topic:e.topic,payload:pP("wc_sessionPropose",xD(SD({},t),{requiredNamespaces:t.requiredNamespaces,optionalNamespaces:t.optionalNamespaces,relays:t.relays,proposer:t.proposer,sessionProperties:t.sessionProperties,scopedProperties:t.scopedProperties}),t.id),attestation:t.attestation,encryptedId:t.encryptedId})})),ID(this,"isValidConnect",(async e=>{if(!jk(e)){const{message:t}=xk("MISSING_OR_INVALID","connect() params: ".concat(JSON.stringify(e)));throw new Error(t)}const{pairingTopic:t,requiredNamespaces:n,optionalNamespaces:r,sessionProperties:i,scopedProperties:o,relays:s}=e;if(Tk(t)||await this.isValidPairingTopic(t),!function(e,t){let n=!1;return t&&!e?n=!0:e&&Ok(e)&&e.length&&e.forEach((e=>{n=Dk(e)})),n}(s,!0)){const{message:e}=xk("MISSING_OR_INVALID","connect() relays: ".concat(s));throw new Error(e)}if(n&&!Tk(n)&&0!==Ak(n)){const e="requiredNamespaces are deprecated and are automatically assigned to optionalNamespaces";["fatal","error","silent"].includes(this.client.logger.level)?console.warn(e):this.client.logger.warn(e),this.validateNamespaces(n,"requiredNamespaces")}if(r&&!Tk(r)&&0!==Ak(r)&&this.validateNamespaces(r,"optionalNamespaces"),i&&!Tk(i)&&this.validateSessionProps(i,"sessionProperties"),o&&!Tk(o)){this.validateSessionProps(o,"scopedProperties");const e=Object.keys(n||{}).concat(Object.keys(r||{}));if(!Object.keys(o).every((t=>e.includes(t.split(":")[0]))))throw new Error("Scoped properties must be a subset of required/optional namespaces, received: ".concat(JSON.stringify(o),", required/optional namespaces: ").concat(JSON.stringify(e)))}})),ID(this,"validateNamespaces",((e,t)=>{const n=function(e,t,n){let r=null;if(e&&Ak(e)){const i=Bk(e,t);i&&(r=i);const o=Nk(e,t,n);o&&(r=o)}else r=xk("MISSING_OR_INVALID","".concat(t,", ").concat(n," should be an object with data"));return r}(e,"connect()",t);if(n)throw new Error(n.message)})),ID(this,"isValidApprove",(async e=>{if(!jk(e))throw new Error(xk("MISSING_OR_INVALID","approve() params: ".concat(e)).message);const{id:t,namespaces:n,relayProtocol:r,sessionProperties:i,scopedProperties:o}=e;this.checkRecentlyDeleted(t),await this.isValidProposalId(t);const s=this.client.proposal.get(t),a=Lk(n,"approve()");if(a)throw new Error(a.message);const c=qk(s.requiredNamespaces,n,"approve()");if(c)throw new Error(c.message);if(!Rk(r,!0)){const{message:e}=xk("MISSING_OR_INVALID","approve() relayProtocol: ".concat(r));throw new Error(e)}if(i&&!Tk(i)&&this.validateSessionProps(i,"sessionProperties"),o&&!Tk(o)){this.validateSessionProps(o,"scopedProperties");const e=new Set(Object.keys(n));if(!Object.keys(o).every((t=>e.has(t.split(":")[0]))))throw new Error("Scoped properties must be a subset of approved namespaces, received: ".concat(JSON.stringify(o),", approved namespaces: ").concat(Array.from(e).join(", ")))}})),ID(this,"isValidReject",(async e=>{if(!jk(e)){const{message:t}=xk("MISSING_OR_INVALID","reject() params: ".concat(e));throw new Error(t)}const{id:t,reason:n}=e;if(this.checkRecentlyDeleted(t),await this.isValidProposalId(t),!function(e){return!(!e||"object"!=typeof e||!e.code||!kk(e.code,!1)||!e.message||!Rk(e.message,!1))}(n)){const{message:e}=xk("MISSING_OR_INVALID","reject() reason: ".concat(JSON.stringify(n)));throw new Error(e)}})),ID(this,"isValidSessionSettleRequest",(e=>{if(!jk(e)){const{message:t}=xk("MISSING_OR_INVALID","onSessionSettleRequest() params: ".concat(e));throw new Error(t)}const{relay:t,controller:n,namespaces:r,expiry:i}=e;if(!Dk(t)){const{message:e}=xk("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(e)}const o=function(e,t){let n=null;return Rk(null===e||void 0===e?void 0:e.publicKey,!1)||(n=xk("MISSING_OR_INVALID","".concat(t," controller public key should be a string"))),n}(n,"onSessionSettleRequest()");if(o)throw new Error(o.message);const s=Lk(r,"onSessionSettleRequest()");if(s)throw new Error(s.message);if(bx(i)){const{message:e}=xk("EXPIRED","onSessionSettleRequest()");throw new Error(e)}})),ID(this,"isValidUpdate",(async e=>{if(!jk(e)){const{message:t}=xk("MISSING_OR_INVALID","update() params: ".concat(e));throw new Error(t)}const{topic:t,namespaces:n}=e;this.checkRecentlyDeleted(t),await this.isValidSessionTopic(t);const r=this.client.session.get(t),i=Lk(n,"update()");if(i)throw new Error(i.message);const o=qk(r.requiredNamespaces,n,"update()");if(o)throw new Error(o.message)})),ID(this,"isValidExtend",(async e=>{if(!jk(e)){const{message:t}=xk("MISSING_OR_INVALID","extend() params: ".concat(e));throw new Error(t)}const{topic:t}=e;this.checkRecentlyDeleted(t),await this.isValidSessionTopic(t)})),ID(this,"isValidRequest",(async e=>{if(!jk(e)){const{message:t}=xk("MISSING_OR_INVALID","request() params: ".concat(e));throw new Error(t)}const{topic:t,request:n,chainId:r,expiry:i}=e;this.checkRecentlyDeleted(t),await this.isValidSessionTopic(t);const{namespaces:o}=this.client.session.get(t);if(!Mk(o,r)){const{message:e}=xk("MISSING_OR_INVALID","request() chainId: ".concat(r));throw new Error(e)}if(!function(e){return!(Tk(e)||!Rk(e.method,!1))}(n)){const{message:e}=xk("MISSING_OR_INVALID","request() ".concat(JSON.stringify(n)));throw new Error(e)}if(!Fk(o,r,n.method)){const{message:e}=xk("MISSING_OR_INVALID","request() method: ".concat(n.method));throw new Error(e)}this.validateRequestExpiry(i)})),ID(this,"isValidRespond",(async e=>{var t;if(!jk(e)){const{message:t}=xk("MISSING_OR_INVALID","respond() params: ".concat(e));throw new Error(t)}const{topic:n,response:r}=e;try{await this.isValidSessionTopic(n)}catch(Yu){throw null!=(t=null===e||void 0===e?void 0:e.response)&&t.id&&this.cleanupAfterResponse(e),Yu}if(!function(e){return!(Tk(e)||Tk(e.result)&&Tk(e.error)||!kk(e.id,!1)||!Rk(e.jsonrpc,!1))}(r)){const{message:e}=xk("MISSING_OR_INVALID","respond() response: ".concat(JSON.stringify(r)));throw new Error(e)}const i=this.client.pendingRequest.get(r.id);if(i.topic!==n){const{message:e}=xk("MISMATCHED_TOPIC","Request response topic mismatch. reqId: ".concat(r.id,", expected topic: ").concat(i.topic,", received topic: ").concat(n));throw new Error(e)}})),ID(this,"isValidPing",(async e=>{if(!jk(e)){const{message:t}=xk("MISSING_OR_INVALID","ping() params: ".concat(e));throw new Error(t)}const{topic:t}=e;await this.isValidSessionOrPairingTopic(t)})),ID(this,"isValidEmit",(async e=>{if(!jk(e)){const{message:t}=xk("MISSING_OR_INVALID","emit() params: ".concat(e));throw new Error(t)}const{topic:t,event:n,chainId:r}=e;await this.isValidSessionTopic(t);const{namespaces:i}=this.client.session.get(t);if(!Mk(i,r)){const{message:e}=xk("MISSING_OR_INVALID","emit() chainId: ".concat(r));throw new Error(e)}if(!function(e){return!(Tk(e)||!Rk(e.name,!1))}(n)){const{message:e}=xk("MISSING_OR_INVALID","emit() event: ".concat(JSON.stringify(n)));throw new Error(e)}if(!zk(i,r,n.name)){const{message:e}=xk("MISSING_OR_INVALID","emit() event: ".concat(JSON.stringify(n)));throw new Error(e)}})),ID(this,"isValidDisconnect",(async e=>{if(!jk(e)){const{message:t}=xk("MISSING_OR_INVALID","disconnect() params: ".concat(e));throw new Error(t)}const{topic:t}=e;await this.isValidSessionOrPairingTopic(t)})),ID(this,"isValidAuthenticate",(e=>{const{chains:t,uri:n,domain:r,nonce:i}=e;if(!Array.isArray(t)||0===t.length)throw new Error("chains is required and must be a non-empty array");if(!Rk(n,!1))throw new Error("uri is required parameter");if(!Rk(r,!1))throw new Error("domain is required parameter");if(!Rk(i,!1))throw new Error("nonce is required parameter");if([...new Set(t.map((e=>qS(e).namespace)))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:o}=qS(t[0]);if("eip155"!==o)throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")})),ID(this,"getVerifyContext",(async e=>{const{attestationId:t,hash:n,encryptedId:r,metadata:i,transportType:o}=e,s={verified:{verifyUrl:i.verifyUrl||EC,validation:"UNKNOWN",origin:i.url||""}};try{if(o===$P.link_mode){const e=this.getAppLinkIfEnabled(i,o);return s.verified.validation=e&&new URL(e).origin===new URL(i.url).origin?"VALID":"INVALID",s}const e=await this.client.core.verify.resolve({attestationId:t,hash:n,encryptedId:r,verifyUrl:i.verifyUrl});e&&(s.verified.origin=e.origin,s.verified.isScam=e.isScam,s.verified.validation=e.origin===new URL(i.url).origin?"VALID":"INVALID")}catch(Ze){this.client.logger.warn(Ze)}return this.client.logger.debug("Verify context: ".concat(JSON.stringify(s))),s})),ID(this,"validateSessionProps",((e,t)=>{Object.values(e).forEach(((n,r)=>{if(null==n){const{message:i}=xk("MISSING_OR_INVALID","".concat(t," must contain an existing value for each key. Received: ").concat(n," for key ").concat(Object.keys(e)[r]));throw new Error(i)}}))})),ID(this,"getPendingAuthRequest",(e=>{const t=this.client.auth.requests.get(e);return"object"==typeof t?t:void 0})),ID(this,"addToRecentlyDeleted",((e,t)=>{if(this.recentlyDeletedMap.set(e,t),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let e=0;const t=this.recentlyDeletedLimit/2;for(const n of this.recentlyDeletedMap.keys()){if(e++>=t)break;this.recentlyDeletedMap.delete(n)}}})),ID(this,"checkRecentlyDeleted",(e=>{const t=this.recentlyDeletedMap.get(e);if(t){const{message:n}=xk("MISSING_OR_INVALID","Record was recently deleted - ".concat(t,": ").concat(e));throw new Error(n)}})),ID(this,"isLinkModeEnabled",((e,t)=>{var n,r,i,o,s,a,c,l,u;return!(!e||t!==$P.link_mode)&&(!0===(null==(r=null==(n=this.client.metadata)?void 0:n.redirect)?void 0:r.linkMode)&&void 0!==(null==(o=null==(i=this.client.metadata)?void 0:i.redirect)?void 0:o.universal)&&""!==(null==(a=null==(s=this.client.metadata)?void 0:s.redirect)?void 0:a.universal)&&void 0!==(null==(c=null===e||void 0===e?void 0:e.redirect)?void 0:c.universal)&&""!==(null==(l=null===e||void 0===e?void 0:e.redirect)?void 0:l.universal)&&!0===(null==(u=null===e||void 0===e?void 0:e.redirect)?void 0:u.linkMode)&&this.client.core.linkModeSupportedApps.includes(e.redirect.universal)&&typeof(null==global?void 0:global.Linking)<"u")})),ID(this,"getAppLinkIfEnabled",((e,t)=>{var n;return this.isLinkModeEnabled(e,t)?null==(n=null===e||void 0===e?void 0:e.redirect)?void 0:n.universal:void 0})),ID(this,"handleLinkModeMessage",(e=>{let{url:t}=e;if(!t||!t.includes("wc_ev")||!t.includes("topic"))return;const n=Sx(t,"topic")||"",r=decodeURIComponent(Sx(t,"wc_ev")||""),i=this.client.session.keys.includes(n);i&&this.client.session.update(n,{transportType:$P.link_mode}),this.client.core.dispatchEnvelope({topic:n,message:r,sessionExists:i})})),ID(this,"registerLinkModeListeners",(async()=>{var e;if(Ix()||rx()&&null!=(e=this.client.metadata.redirect)&&e.linkMode){const e=null==global?void 0:global.Linking;if(typeof e<"u"){e.addEventListener("url",this.handleLinkModeMessage,this.client.name);const t=await e.getInitialURL();t&&setTimeout((()=>{this.handleLinkModeMessage({url:t})}),50)}}})),ID(this,"getTVFApproveParams",(e=>{try{const t=mk(e.namespaces),n=function(e){const t=[];return Object.values(e).forEach((e=>{t.push(...e.methods)})),[...new Set(t)]}(e.namespaces),r=function(e){const t=[];return Object.values(e).forEach((e=>{t.push(...e.events)})),[...new Set(t)]}(e.namespaces),i=e.sessionProperties;return{approvedChains:t,approvedMethods:n,approvedEvents:r,sessionProperties:i,scopedProperties:e.scopedProperties}}catch(t){return this.client.logger.warn(t,"Error getting TVF approve params"),{}}})),ID(this,"getTVFParams",((e,t,n)=>{var r,i,o;if(null==(r=t.request)||!r.method)return{};const s={correlationId:e,rpcMethods:[t.request.method],chainId:t.chainId};try{const e=this.extractTxHashesFromResult(t.request,n);s.txHashes=e,s.contractAddresses=this.isValidContractData(t.request.params)?[null==(o=null==(i=t.request.params)?void 0:i[0])?void 0:o.to]:[]}catch(Ze){this.client.logger.warn(Ze,"Error getting TVF params")}return s})),ID(this,"isValidContractData",(e=>{var t;if(!e)return!1;try{const n=(null===e||void 0===e?void 0:e.data)||(null==(t=null===e||void 0===e?void 0:e[0])?void 0:t.data);if(!n.startsWith("0x"))return!1;const r=n.slice(2);return!!/^[0-9a-fA-F]*$/.test(r)&&r.length%2===0}catch{}return!1})),ID(this,"extractTxHashesFromResult",((t,n)=>{var r;try{if(!n)return[];const i=t.method,o=fD[i];if("sui_signTransaction"===i)return[yO(n.transactionBytes)];if("near_signTransaction"===i)return[mO(n)];if("near_signTransactions"===i)return n.map((e=>mO(e)));if("xrpl_signTransactionFor"===i||"xrpl_signTransaction"===i)return[null==(r=n.tx_json)?void 0:r.hash];if("polkadot_signTransaction"===i)return[Xk({transaction:t.params.transactionPayload,signature:n.signature})];if("algo_signTxn"===i)return Ok(n)?n.map((e=>vO(e))):[vO(n)];if("cosmos_signDirect"===i)return[wO(n)];if("wallet_sendCalls"===i)return function(t){var n,r;const i=[];try{if("string"==typeof t)return i.push(t),i;if("object"!=typeof t)return i;null!=t&&t.id&&i.push(t.id);const e=null==(r=null==(n=null===t||void 0===t?void 0:t.capabilities)?void 0:n.caip345)?void 0:r.transactionHashes;e&&i.push(...e)}catch(e){console.warn("getWalletSendCallsHashes failed: ",e)}return i}(n);if("string"==typeof n)return[n];const s=n[o.key];if(Ok(s))return"solana_signAllTransactions"===i?s.map((e=>function(e){const t=atob(e),n=new Uint8Array(t.length);for(let s=0;s<t.length;s++)n[s]=t.charCodeAt(s);const r=n[0];if(0===r)throw new Error("No signatures found");const i=1+64*r;if(n.length<i)throw new Error("Transaction data too short for claimed signature count");if(n.length<100)throw new Error("Transaction too short");const o=Buffer.from(e,"base64").slice(1,65);return eE.encode(o)}(e))):s;if("string"==typeof s)return[s]}catch(Qu){this.client.logger.warn(Qu,"Error extracting tx hashes from result")}return[]}))}async processPendingMessageEvents(){try{const e=this.client.session.keys,t=this.client.core.relayer.messages.getWithoutAck(e);for(const[n,r]of Object.entries(t))for(const e of r)try{await this.onProviderMessageEvent({topic:n,message:e,publishedAt:Date.now()})}catch{this.client.logger.warn("Error processing pending message event for topic: ".concat(n,", message: ").concat(e))}}catch(Ju){this.client.logger.warn(Ju,"processPendingMessageEvents failed")}}isInitialized(){if(!this.initialized){const{message:e}=xk("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(zP,(e=>{this.onProviderMessageEvent(e)}))}async onRelayMessage(e){const{topic:t,message:n,attestation:r,transportType:i}=e,{publicKey:o}=this.client.auth.authKeys.keys.includes(gD)?this.client.auth.authKeys.get(gD):{responseTopic:void 0,publicKey:void 0};try{const e=await this.client.core.crypto.decode(t,n,{receiverPublicKey:o,encoding:i===$P.link_mode?xR:SR});IP(e)?(this.client.core.history.set(t,e),await this.onRelayEventRequest({topic:t,payload:e,attestation:r,transportType:i,encryptedId:BR(n)})):OP(e)?(await this.client.core.history.resolve(e),await this.onRelayEventResponse({topic:t,payload:e,transportType:i}),this.client.core.history.delete(t,e.id)):(this.client.logger.error("onRelayMessage() -> unknown payload: ".concat(JSON.stringify(e))),await this.onRelayEventUnknownPayload({topic:t,payload:e,transportType:i})),await this.client.core.relayer.messages.ack(t,n)}catch(Yu){this.client.logger.error("onRelayMessage() -> failed to process an inbound message: ".concat(n)),this.client.logger.error(Yu)}}registerExpirerEvents(){this.client.core.expirer.on(vC,(async e=>{const{topic:t,id:n}=mx(e.target);return n&&this.client.pendingRequest.keys.includes(n)?await this.deletePendingSessionRequest(n,xk("EXPIRED"),!0):n&&this.client.auth.requests.keys.includes(n)?await this.deletePendingAuthRequest(n,xk("EXPIRED"),!0):void(t?this.client.session.keys.includes(t)&&(await this.deleteSession({topic:t,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:t})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n})))}))}registerPairingEvents(){this.client.core.pairing.events.on(cC,(e=>this.onPairingCreated(e))),this.client.core.pairing.events.on(uC,(e=>{this.addToRecentlyDeleted(e.topic,"pairing")}))}isValidPairingTopic(e){if(!Rk(e,!1)){const{message:t}=xk("MISSING_OR_INVALID","pairing topic should be a string: ".concat(e));throw new Error(t)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:t}=xk("NO_MATCHING_KEY","pairing topic doesn't exist: ".concat(e));throw new Error(t)}if(bx(this.client.core.pairing.pairings.get(e).expiry)){const{message:t}=xk("EXPIRED","pairing topic: ".concat(e));throw new Error(t)}}async isValidSessionTopic(e){if(!Rk(e,!1)){const{message:t}=xk("MISSING_OR_INVALID","session topic should be a string: ".concat(e));throw new Error(t)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:t}=xk("NO_MATCHING_KEY","session topic doesn't exist: ".concat(e));throw new Error(t)}if(bx(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:t}=xk("EXPIRED","session topic: ".concat(e));throw new Error(t)}if(!this.client.core.crypto.keychain.has(e)){const{message:t}=xk("MISSING_OR_INVALID","session topic does not exist in keychain: ".concat(e));throw await this.deleteSession({topic:e}),new Error(t)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else{if(!this.client.core.pairing.pairings.keys.includes(e)){if(Rk(e,!1)){const{message:t}=xk("NO_MATCHING_KEY","session or pairing topic doesn't exist: ".concat(e));throw new Error(t)}{const{message:t}=xk("MISSING_OR_INVALID","session or pairing topic should be a string: ".concat(e));throw new Error(t)}}this.isValidPairingTopic(e)}}async isValidProposalId(e){if(!function(e){return"number"==typeof e}(e)){const{message:t}=xk("MISSING_OR_INVALID","proposal id should be a number: ".concat(e));throw new Error(t)}if(!this.client.proposal.keys.includes(e)){const{message:t}=xk("NO_MATCHING_KEY","proposal id doesn't exist: ".concat(e));throw new Error(t)}if(bx(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:t}=xk("EXPIRED","proposal id: ".concat(e));throw new Error(t)}}validateRequestExpiry(e){if(e&&!function(e,t){return kk(e,!1)&&e<=t.max&&e>=t.min}(e,lD)){const{message:t}=xk("MISSING_OR_INVALID","request() expiry: ".concat(e,". Expiry must be a number (in seconds) between ").concat(lD.min," and ").concat(lD.max));throw new Error(t)}}}class AD extends _L{constructor(e,t){super(e,t,"proposal",nD),this.core=e,this.logger=t}}class TD extends _L{constructor(e,t){super(e,t,"session",nD),this.core=e,this.logger=t}}class RD extends _L{constructor(e,t){super(e,t,"request",nD,(e=>e.id)),this.core=e,this.logger=t}}class kD extends _L{constructor(e,t){super(e,t,"authKeys",pD,(()=>gD)),this.core=e,this.logger=t}}class PD extends _L{constructor(e,t){super(e,t,"pairingTopics",pD),this.core=e,this.logger=t}}class CD extends _L{constructor(e,t){super(e,t,"requests",pD,(e=>e.id)),this.core=e,this.logger=t}}var ND=Object.defineProperty,UD=(e,t,n)=>((e,t,n)=>t in e?ND(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);class BD{constructor(e,t){this.core=e,this.logger=t,UD(this,"authKeys"),UD(this,"pairingTopics"),UD(this,"requests"),this.authKeys=new kD(this.core,this.logger),this.pairingTopics=new PD(this.core,this.logger),this.requests=new CD(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}var LD=Object.defineProperty,DD=(e,t,n)=>((e,t,n)=>t in e?LD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);class jD extends Lh{constructor(e){super(e),DD(this,"protocol","wc"),DD(this,"version",2),DD(this,"name",rD),DD(this,"metadata"),DD(this,"core"),DD(this,"logger"),DD(this,"events",new ir.EventEmitter),DD(this,"engine"),DD(this,"session"),DD(this,"proposal"),DD(this,"pendingRequest"),DD(this,"auth"),DD(this,"signConfig"),DD(this,"on",((e,t)=>this.events.on(e,t))),DD(this,"once",((e,t)=>this.events.once(e,t))),DD(this,"off",((e,t)=>this.events.off(e,t))),DD(this,"removeListener",((e,t)=>this.events.removeListener(e,t))),DD(this,"removeAllListeners",(e=>this.events.removeAllListeners(e))),DD(this,"connect",(async e=>{try{return await this.engine.connect(e)}catch(We){throw this.logger.error(We.message),We}})),DD(this,"pair",(async e=>{try{return await this.engine.pair(e)}catch(We){throw this.logger.error(We.message),We}})),DD(this,"approve",(async e=>{try{return await this.engine.approve(e)}catch(We){throw this.logger.error(We.message),We}})),DD(this,"reject",(async e=>{try{return await this.engine.reject(e)}catch(We){throw this.logger.error(We.message),We}})),DD(this,"update",(async e=>{try{return await this.engine.update(e)}catch(We){throw this.logger.error(We.message),We}})),DD(this,"extend",(async e=>{try{return await this.engine.extend(e)}catch(We){throw this.logger.error(We.message),We}})),DD(this,"request",(async e=>{try{return await this.engine.request(e)}catch(We){throw this.logger.error(We.message),We}})),DD(this,"respond",(async e=>{try{return await this.engine.respond(e)}catch(We){throw this.logger.error(We.message),We}})),DD(this,"ping",(async e=>{try{return await this.engine.ping(e)}catch(We){throw this.logger.error(We.message),We}})),DD(this,"emit",(async e=>{try{return await this.engine.emit(e)}catch(We){throw this.logger.error(We.message),We}})),DD(this,"disconnect",(async e=>{try{return await this.engine.disconnect(e)}catch(We){throw this.logger.error(We.message),We}})),DD(this,"find",(e=>{try{return this.engine.find(e)}catch(We){throw this.logger.error(We.message),We}})),DD(this,"getPendingSessionRequests",(()=>{try{return this.engine.getPendingSessionRequests()}catch(e){throw this.logger.error(e.message),e}})),DD(this,"authenticate",(async(e,t)=>{try{return await this.engine.authenticate(e,t)}catch(Qu){throw this.logger.error(Qu.message),Qu}})),DD(this,"formatAuthMessage",(e=>{try{return this.engine.formatAuthMessage(e)}catch(We){throw this.logger.error(We.message),We}})),DD(this,"approveSessionAuthenticate",(async e=>{try{return await this.engine.approveSessionAuthenticate(e)}catch(We){throw this.logger.error(We.message),We}})),DD(this,"rejectSessionAuthenticate",(async e=>{try{return await this.engine.rejectSessionAuthenticate(e)}catch(We){throw this.logger.error(We.message),We}})),this.name=(null===e||void 0===e?void 0:e.name)||rD,this.metadata=ax(null===e||void 0===e?void 0:e.metadata),this.signConfig=null===e||void 0===e?void 0:e.signConfig;const t=Qk({logger:(null===e||void 0===e?void 0:e.logger)||iD,name:this.name});this.logger=t,this.core=(null===e||void 0===e?void 0:e.core)||new eD(e),this.session=new TD(this.core,this.logger),this.proposal=new AD(this.core,this.logger),this.pendingRequest=new RD(this.core,this.logger),this.engine=new OD(this),this.auth=new BD(this.core,this.logger)}static async init(e){const t=new jD(e);return await t.initialize(),t}get context(){return yh(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success")}catch(Ju){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(Ju.message),Ju}}}const MD=jD;var FD=n(1871),zD=n.n(FD),qD=Object.defineProperty,HD=Object.defineProperties,VD=Object.getOwnPropertyDescriptors,KD=Object.getOwnPropertySymbols,WD=Object.prototype.hasOwnProperty,GD=Object.prototype.propertyIsEnumerable,YD=(e,t,n)=>t in e?qD(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ZD=(e,t)=>{for(var n in t||(t={}))WD.call(t,n)&&YD(e,n,t[n]);if(KD)for(var n of KD(t))GD.call(t,n)&&YD(e,n,t[n]);return e},XD=(e,t)=>HD(e,VD(t));const QD={headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"};class JD{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.url=e,this.disableProviderPing=t,this.events=new ir.EventEmitter,this.isAvailable=!1,this.registering=!1,!_P(e))throw new Error("Provided URL is not compatible with HTTP connection: ".concat(e));this.url=e,this.disableProviderPing=t}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.url;await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const t=hf(e),n=await(await zD()(this.url,XD(ZD({},QD),{body:t}))).json();this.onPayload({data:n})}catch(Mz){this.onError(e.id,Mz)}}async register(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.url;if(!_P(e))throw new Error("Provided URL is not compatible with HTTP connection: ".concat(e));if(this.registering){const e=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=e||this.events.listenerCount("open")>=e)&&this.events.setMaxListeners(e+1),new Promise(((e,t)=>{this.events.once("register_error",(e=>{this.resetMaxListeners(),t(e)})),this.events.once("open",(()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return t(new Error("HTTP connection is missing or invalid"));e()}))}))}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const t=hf({id:1,jsonrpc:"2.0",method:"test",params:[]});await zD()(e,XD(ZD({},QD),{body:t}))}this.onOpen()}catch(Mz){const t=this.parseError(Mz);throw this.events.emit("register_error",t),this.onClose(),t}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const t="string"==typeof e.data?ff(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const n=this.parseError(t),r=yP(e,n.message||n.toString());this.events.emit("payload",r)}parseError(e){return uP(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.url,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>10&&this.events.setMaxListeners(10)}}function $D(e){return null!=e&&"function"!=typeof e&&function(e){return Number.isSafeInteger(e)&&e>=0}(e.length)}function ej(e){return"__proto__"===e}function tj(e){return null==e||"object"!=typeof e&&"function"!=typeof e}function nj(e){return Object.getOwnPropertySymbols(e).filter((t=>Object.prototype.propertyIsEnumerable.call(e,t)))}function rj(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const ij="[object RegExp]",oj="[object String]",sj="[object Number]",aj="[object Boolean]",cj="[object Arguments]",lj="[object Symbol]",uj="[object Date]",dj="[object Map]",fj="[object Set]",hj="[object Array]",pj="[object ArrayBuffer]",gj="[object Object]",yj="[object DataView]",mj="[object Uint8Array]",vj="[object Uint8ClampedArray]",bj="[object Uint16Array]",wj="[object Uint32Array]",Ej="[object Int8Array]",_j="[object Int16Array]",Sj="[object Int32Array]",xj="[object Float32Array]",Ij="[object Float64Array]";function Oj(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Aj(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Map,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;const o=null===i||void 0===i?void 0:i(e,t,n,r);if(void 0!==o)return o;if(tj(e))return e;if(r.has(e))return r.get(e);if(Array.isArray(e)){const t=new Array(e.length);r.set(e,t);for(let o=0;o<e.length;o++)t[o]=Aj(e[o],o,n,r,i);return Object.hasOwn(e,"index")&&(t.index=e.index),Object.hasOwn(e,"input")&&(t.input=e.input),t}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){const t=new RegExp(e.source,e.flags);return t.lastIndex=e.lastIndex,t}if(e instanceof Map){const t=new Map;r.set(e,t);for(const[o,s]of e)t.set(o,Aj(s,o,n,r,i));return t}if(e instanceof Set){const t=new Set;r.set(e,t);for(const o of e)t.add(Aj(o,void 0,n,r,i));return t}if(typeof Buffer<"u"&&Buffer.isBuffer(e))return e.subarray();if(Oj(e)){const t=new(Object.getPrototypeOf(e).constructor)(e.length);r.set(e,t);for(let o=0;o<e.length;o++)t[o]=Aj(e[o],o,n,r,i);return t}if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer)return e.slice(0);if(e instanceof DataView){const t=new DataView(e.buffer.slice(0),e.byteOffset,e.byteLength);return r.set(e,t),Tj(t,e,n,r,i),t}if(typeof File<"u"&&e instanceof File){const t=new File([e],e.name,{type:e.type});return r.set(e,t),Tj(t,e,n,r,i),t}if(typeof Blob<"u"&&e instanceof Blob){const t=new Blob([e],{type:e.type});return r.set(e,t),Tj(t,e,n,r,i),t}if(e instanceof Error){const t=new e.constructor;return r.set(e,t),t.message=e.message,t.name=e.name,t.stack=e.stack,t.cause=e.cause,Tj(t,e,n,r,i),t}if(e instanceof Boolean){const t=new Boolean(e.valueOf());return r.set(e,t),Tj(t,e,n,r,i),t}if(e instanceof Number){const t=new Number(e.valueOf());return r.set(e,t),Tj(t,e,n,r,i),t}if(e instanceof String){const t=new String(e.valueOf());return r.set(e,t),Tj(t,e,n,r,i),t}if("object"==typeof e&&function(e){switch(rj(e)){case cj:case hj:case pj:case yj:case aj:case uj:case xj:case Ij:case Ej:case _j:case Sj:case dj:case sj:case gj:case ij:case fj:case oj:case lj:case mj:case vj:case bj:case wj:return!0;default:return!1}}(e)){const t=Object.create(Object.getPrototypeOf(e));return r.set(e,t),Tj(t,e,n,r,i),t}return e}function Tj(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,r=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0;const o=[...Object.keys(t),...nj(t)];for(let s=0;s<o.length;s++){const a=o[s],c=Object.getOwnPropertyDescriptor(e,a);(null==c||c.writable)&&(e[a]=Aj(t[a],a,n,r,i))}}function Rj(e,t){return function(e,t){return Aj(e,void 0,e,new Map,t)}(e,((n,r,i,o)=>{const s=null===t||void 0===t?void 0:t(n,r,i,o);if(void 0!==s)return s;if("object"==typeof e){if(rj(e)===gj&&"function"!=typeof e.constructor){const t={};return o.set(e,t),Tj(t,e,i,o),t}switch(Object.prototype.toString.call(e)){case sj:case oj:case aj:{const t=new e.constructor(null===e||void 0===e?void 0:e.valueOf());return Tj(t,e),t}case cj:{const t={};return Tj(t,e),t.length=e.length,t[Symbol.iterator]=e[Symbol.iterator],t}default:return}}}))}function kj(e){return Rj(e)}function Pj(e){return null!==e&&"object"==typeof e&&"[object Arguments]"===rj(e)}function Cj(e){return"object"==typeof e&&null!==e}function Nj(e){return Cj(e)&&$D(e)}function Uj(){}function Bj(e){return Oj(e)}function Lj(e){if("object"!=typeof e||null==e)return!1;if(null===Object.getPrototypeOf(e))return!0;if("[object Object]"!==Object.prototype.toString.call(e)){var t;const n=e[Symbol.toStringTag];return!(null==n||null===(t=Object.getOwnPropertyDescriptor(e,Symbol.toStringTag))||void 0===t||!t.writable)&&e.toString()==="[object ".concat(n,"]")}let n=e;for(;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(e)===n}function Dj(e,t,n,r){if(tj(e)&&(e=Object(e)),null==t||"object"!=typeof t)return e;if(r.has(t))return function(e){if(tj(e))return e;if(Array.isArray(e)||Oj(e)||e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer)return e.slice(0);const t=Object.getPrototypeOf(e);if(null==t)return Object.assign(Object.create(t),e);const n=t.constructor;if(e instanceof Date||e instanceof Map||e instanceof Set)return new n(e);if(e instanceof RegExp){const t=new n(e);return t.lastIndex=e.lastIndex,t}if(e instanceof DataView)return new n(e.buffer.slice(0));if(e instanceof Error){let t;return t=e instanceof AggregateError?new n(e.errors,e.message,{cause:e.cause}):new n(e.message,{cause:e.cause}),t.stack=e.stack,Object.assign(t,e),t}if(typeof File<"u"&&e instanceof File)return new n([e],e.name,{type:e.type,lastModified:e.lastModified});if("object"==typeof e){const n=Object.create(t);return Object.assign(n,e)}return e}(r.get(t));if(r.set(t,e),Array.isArray(t)){t=t.slice();for(let e=0;e<t.length;e++){var i;t[e]=null!==(i=t[e])&&void 0!==i?i:void 0}}const o=[...Object.keys(t),...nj(t)];for(let s=0;s<o.length;s++){const i=o[s];if(ej(i))continue;let a=t[i],c=e[i];if(Pj(a)&&(a={...a}),Pj(c)&&(c={...c}),typeof Buffer<"u"&&Buffer.isBuffer(a)&&(a=kj(a)),Array.isArray(a))if(Array.isArray(c)){const e=[],t=Reflect.ownKeys(c);for(let n=0;n<t.length;n++){const r=t[n];e[r]=c[r]}c=e}else if(Nj(c)){const e=[];for(let t=0;t<c.length;t++)e[t]=c[t];c=e}else c=[];const l=n(c,a,i,e,t,r);void 0!==l?e[i]=l:Array.isArray(a)||Cj(c)&&Cj(a)&&(Lj(c)||Lj(a)||Bj(c)||Bj(a))?e[i]=Dj(c,a,n,r):null==c&&Lj(a)?e[i]=Dj({},a,n,r):null==c&&Bj(a)?e[i]=kj(a):(void 0===c||void 0!==a)&&(e[i]=a)}return e}function jj(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];const i=n.slice(0,-1),o=n[n.length-1];let s=e;for(let a=0;a<i.length;a++)s=Dj(s,i[a],o,new Map);return s}(e,...n,Uj)}const Mj="error",Fj="universal_provider",zj="".concat("wc","@2:").concat(Fj,":"),qj="https://rpc.walletconnect.org/v1/",Hj="generic",Vj="".concat(qj,"bundler"),Kj="call_status",Wj="default_chain_changed";var Gj=Object.defineProperty,Yj=Object.defineProperties,Zj=Object.getOwnPropertyDescriptors,Xj=Object.getOwnPropertySymbols,Qj=Object.prototype.hasOwnProperty,Jj=Object.prototype.propertyIsEnumerable,$j=(e,t,n)=>t in e?Gj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,eM=(e,t)=>{for(var n in t||(t={}))Qj.call(t,n)&&$j(e,n,t[n]);if(Xj)for(var n of Xj(t))Jj.call(t,n)&&$j(e,n,t[n]);return e},tM=(e,t)=>Yj(e,Zj(t));function nM(e,t,n){var r;const i=qS(e);return(null==(r=t.rpcMap)?void 0:r[i.reference])||"".concat(qj,"?chainId=").concat(i.namespace,":").concat(i.reference,"&projectId=").concat(n)}function rM(e){return e.map((e=>"".concat(e.split(":")[0],":").concat(e.split(":")[1])))}function iM(e){return Object.fromEntries(Object.entries(e).filter((e=>{let[t,n]=e;var r,i;return(null==(r=null===n||void 0===n?void 0:n.chains)?void 0:r.length)&&(null==(i=null===n||void 0===n?void 0:n.chains)?void 0:i.length)>0})))}function oM(){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return jj(iM(sM(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{})),iM(sM(e)))}function sM(e){var t,n,r,i,o;const s={};if(!Ak(e))return s;for(const[a,c]of Object.entries(e)){const e=vk(a)?[a]:c.chains,l=c.methods||[],u=c.events||[],d=c.rpcMap||{},f=bk(a);s[f]=tM(eM(eM({},s[f]),c),{chains:Ex(e,null==(t=s[f])?void 0:t.chains),methods:Ex(l,null==(n=s[f])?void 0:n.methods),events:Ex(u,null==(r=s[f])?void 0:r.events)}),(Ak(d)||Ak((null==(i=s[f])?void 0:i.rpcMap)||{}))&&(s[f].rpcMap=eM(eM({},d),null==(o=s[f])?void 0:o.rpcMap))}return s}function aM(e){return e.includes(":")?e.split(":")[2]:e}function cM(e){const t={};for(const[n,r]of Object.entries(e)){const e=r.methods||[],i=r.events||[],o=r.accounts||[],s=vk(n)?[n]:r.chains?r.chains:rM(r.accounts);t[n]={chains:s,methods:e,events:i,accounts:o}}return t}function lM(e){return"number"==typeof e?e:e.includes("0x")?parseInt(e,16):(e=e.includes(":")?e.split(":")[1]:e,isNaN(Number(e))?e:Number(e))}const uM={},dM=e=>uM[e],fM=(e,t)=>{uM[e]=t};var hM=Object.defineProperty,pM=Object.getOwnPropertySymbols,gM=Object.prototype.hasOwnProperty,yM=Object.prototype.propertyIsEnumerable,mM=(e,t,n)=>t in e?hM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vM=(e,t)=>{for(var n in t||(t={}))gM.call(t,n)&&mM(e,n,t[n]);if(pM)for(var n of pM(t))yM.call(t,n)&&mM(e,n,t[n]);return e};const bM="eip155",wM=["atomic","flow-control","paymasterService","sessionKeys","auxiliaryFunds"],EM=e=>e&&e.startsWith("0x")?BigInt(e).toString(10):e,_M=e=>e&&e.startsWith("0x")?e:"0x".concat(BigInt(e).toString(16)),SM=e=>Object.keys(e).filter((e=>wM.includes(e))).reduce(((t,n)=>(t[n]=xM(e[n]),t)),{}),xM=e=>"string"==typeof e&&function(e){try{const t=JSON.parse(e);return"object"==typeof t&&null!==t&&!Array.isArray(t)}catch{return!1}}(e)?JSON.parse(e):e;var IM=Object.defineProperty,OM=(e,t,n)=>((e,t,n)=>t in e?IM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);let AM;class TM{constructor(e){OM(this,"storage"),this.storage=e}async getItem(e){return await this.storage.getItem(e)}async setItem(e,t){return await this.storage.setItem(e,t)}async removeItem(e){return await this.storage.removeItem(e)}static getStorage(e){return AM||(AM=new TM(e)),AM}}var RM=Object.defineProperty,kM=Object.defineProperties,PM=Object.getOwnPropertyDescriptors,CM=Object.getOwnPropertySymbols,NM=Object.prototype.hasOwnProperty,UM=Object.prototype.propertyIsEnumerable,BM=(e,t,n)=>t in e?RM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;async function LM(e,t){const n=qS(e.result.capabilities.caip345.caip2),r=e.result.capabilities.caip345.transactionHashes,i=await Promise.allSettled(r.map((e=>async function(e,t,n){return await n(parseInt(e)).request(pP("eth_getTransactionReceipt",[t]))}(n.reference,e,t)))),o=i.filter((e=>"fulfilled"===e.status)).map((e=>e.value)).filter((e=>e));i.filter((e=>"rejected"===e.status)).forEach((e=>console.warn("Failed to fetch transaction receipt:",e.reason)));const s=!o.length||o.some((e=>!e)),a=o.every((e=>"0x1"===(null===e||void 0===e?void 0:e.status))),c=o.every((e=>"0x0"===(null===e||void 0===e?void 0:e.status))),l=o.some((e=>"0x0"===(null===e||void 0===e?void 0:e.status)));let u;return s?u=100:a?u=200:c?u=500:l&&(u=600),{id:e.result.id,version:e.request.version,atomic:e.request.atomicRequired,chainId:e.request.chainId,capabilities:e.result.capabilities,receipts:o,status:u}}async function DM(e){let{sendCalls:t,storage:n}=e;const r=await n.getItem(Kj);await n.setItem(Kj,((e,t)=>kM(e,PM(t)))(((e,t)=>{for(var n in t||(t={}))NM.call(t,n)&&BM(e,n,t[n]);if(CM)for(var n of CM(t))UM.call(t,n)&&BM(e,n,t[n]);return e})({},r),{[t.result.id]:{request:t.request,result:t.result,expiry:vx(86400)}}))}async function jM(e){let{resultId:t,storage:n}=e;const r=await n.getItem(Kj),i=null===r||void 0===r?void 0:r[t];if(i&&!bx(i.expiry))return i;await async function(e){let{resultId:t,storage:n}=e;const r=await n.getItem(Kj);if(r){delete r[t],await n.setItem(Kj,r);for(const e in r)bx(r[e].expiry)&&delete r[e];await n.setItem(Kj,r)}}({resultId:t,storage:n})}var MM=Object.defineProperty,FM=Object.defineProperties,zM=Object.getOwnPropertyDescriptors,qM=Object.getOwnPropertySymbols,HM=Object.prototype.hasOwnProperty,VM=Object.prototype.propertyIsEnumerable,KM=(e,t,n)=>t in e?MM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,WM=(e,t)=>{for(var n in t||(t={}))HM.call(t,n)&&KM(e,n,t[n]);if(qM)for(var n of qM(t))VM.call(t,n)&&KM(e,n,t[n]);return e},GM=(e,t)=>FM(e,zM(t)),YM=(e,t,n)=>KM(e,"symbol"!=typeof t?t+"":t,n);class ZM{constructor(e){YM(this,"name","eip155"),YM(this,"client"),YM(this,"chainId"),YM(this,"namespace"),YM(this,"httpProviders"),YM(this,"events"),YM(this,"storage"),this.namespace=e.namespace,this.events=dM("events"),this.client=dM("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain()),this.storage=TM.getStorage(this.client.core.storage)}async request(e){switch(e.request.method){case"eth_requestAccounts":case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e);case"wallet_sendCalls":return await this.sendCalls(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(parseInt(e),t);const n=this.chainId;this.chainId=parseInt(e),this.events.emit(Wj,{currentCaipChainId:"".concat(this.name,":").concat(e),previousCaipChainId:"".concat(this.name,":").concat(n)})}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,t){const n=t||nM("".concat(this.name,":").concat(e),this.namespace,this.client.core.projectId);if(!n)throw new Error("No RPC url provided for chainId: ".concat(e));return new RP(new JD(n,dM("disableProviderPing")))}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach((t=>{var n;const r=parseInt(function(e){return e.includes(":")?e.split(":")[1]:e}(t));e[r]=this.createHttpProvider(r,null==(n=this.namespace.rpcMap)?void 0:n[t])})),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}getHttpProvider(e){const t=e||this.chainId;return this.httpProviders[t]||(this.httpProviders=GM(WM({},this.httpProviders),{[t]:this.createHttpProvider(t)}),this.httpProviders[t])}async handleSwitchChain(e){var t,n;let r=e.request.params?null==(t=e.request.params[0])?void 0:t.chainId:"0x0";r=r.startsWith("0x")?r:"0x".concat(r);const i=parseInt(r,16);if(this.isChainApproved(i))this.setDefaultChain("".concat(i));else{if(!this.namespace.methods.includes("wallet_switchEthereumChain"))throw new Error("Failed to switch to chain 'eip155:".concat(i,"'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method."));await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:r}]},chainId:null==(n=this.namespace.chains)?void 0:n[0]}),this.setDefaultChain("".concat(i))}return null}isChainApproved(e){return this.namespace.chains.includes("".concat(this.name,":").concat(e))}async getCapabilities(e){var t,n,r,i,o;const s=null==(n=null==(t=e.request)?void 0:t.params)?void 0:n[0],a=(null==(i=null==(r=e.request)?void 0:r.params)?void 0:i[1])||[];if(!s)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const c=this.client.session.get(e.topic),l=(null==(o=null===c||void 0===c?void 0:c.sessionProperties)?void 0:o.capabilities)||{},u=a.length>0?a.join(","):"0x".concat(this.chainId.toString(16)),d="".concat(s).concat(u),f=null===l||void 0===l?void 0:l[d];if(f)return f;let h;try{h=((e,t,n)=>{const{sessionProperties:r={},scopedProperties:i={}}=e,o={};if(!Ak(i)&&!Ak(r))return;const s=SM(r);for(const a of n){const e=EM(a);if(!e)continue;o[_M(e)]=s;const n=null===i||void 0===i?void 0:i["".concat(bM,":").concat(e)];if(n){const r=null===n||void 0===n?void 0:n["".concat(bM,":").concat(e,":").concat(t)];o[_M(e)]=vM(vM({},o[_M(e)]),SM(r||n))}}for(const[a,c]of Object.entries(o))0===Object.keys(c).length&&delete o[a];return Object.keys(o).length>0?o:void 0})(c,s,a)}catch(xt){console.warn("Failed to extract capabilities from session",xt)}if(h)return h;const p=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:GM(WM({},c.sessionProperties||{}),{capabilities:GM(WM({},l||{}),{[d]:p})})})}catch(xt){console.warn("Failed to update session with capabilities",xt)}return p}async getCallStatus(e){var t,n,r;const i=this.client.session.get(e.topic),o=null==(t=i.sessionProperties)?void 0:t.bundler_name;if(o){const t=this.getBundlerUrl(e.chainId,o);try{return await this.getUserOperationReceipt(t,e)}catch(Ze){console.warn("Failed to fetch call status from bundler",Ze,t)}}const s=null==(n=i.sessionProperties)?void 0:n.bundler_url;if(s)try{return await this.getUserOperationReceipt(s,e)}catch(Xe){console.warn("Failed to fetch call status from custom bundler",Xe,s)}const a=await jM({resultId:null==(r=e.request.params)?void 0:r[0],storage:this.storage});if(a)try{return await LM(a,this.getHttpProvider.bind(this))}catch(Xe){console.warn("Failed to fetch call status from stored send calls",Xe,a)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,t){var n;const r=new URL(e),i=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(pP("eth_getUserOperationReceipt",[null==(n=t.request.params)?void 0:n[0]]))});if(!i.ok)throw new Error("Failed to fetch user operation receipt - ".concat(i.status));return await i.json()}getBundlerUrl(e,t){return"".concat(Vj,"?projectId=").concat(this.client.core.projectId,"&chainId=").concat(e,"&bundler=").concat(t)}async sendCalls(e){var t,n,r;const i=await this.client.request(e),o=null==(t=e.request.params)?void 0:t[0],s=null===i||void 0===i?void 0:i.id,a=(null===i||void 0===i?void 0:i.capabilities)||{},c=null==(n=null===a||void 0===a?void 0:a.caip345)?void 0:n.caip2,l=null==(r=null===a||void 0===a?void 0:a.caip345)?void 0:r.transactionHashes;return!s||!c||!(null!=l&&l.length)||await DM({sendCalls:{request:o,result:i},storage:this.storage}),i}}var XM=Object.defineProperty,QM=(e,t,n)=>((e,t,n)=>t in e?XM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);class JM{constructor(e){QM(this,"name",Hj),QM(this,"client"),QM(this,"httpProviders"),QM(this,"events"),QM(this,"namespace"),QM(this,"chainId"),this.namespace=e.namespace,this.events=dM("events"),this.client=dM("client"),this.chainId=this.getDefaultChain(),this.name=this.getNamespaceName(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t);const n=this.chainId;this.chainId=e,this.events.emit(Wj,{currentCaipChainId:"".concat(this.name,":").concat(e),previousCaipChainId:"".concat(this.name,":").concat(n)})}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getNamespaceName(){const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return qS(e).namespace}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter((e=>e.split(":")[1]===this.chainId.toString())).map((e=>e.split(":")[2])))]:[]}createHttpProviders(){var e,t;const n={};return null==(t=null==(e=this.namespace)?void 0:e.accounts)||t.forEach((e=>{var t,r;const i=qS(e),o=null==(r=null==(t=this.namespace)?void 0:t.rpcMap)?void 0:r["".concat(i.namespace,":").concat(i.reference)];n[i.reference]=this.createHttpProvider(e,o)})),n}getHttpProvider(e){const t=qS(e).reference,n=this.httpProviders[t];if(typeof n>"u")throw new Error("JSON-RPC provider for ".concat(e," not found"));return n}setHttpProvider(e,t){const n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){const n=t||nM(e,this.namespace,this.client.core.projectId);if(!n)throw new Error("No RPC url provided for chainId: ".concat(e));return new RP(new JD(n,dM("disableProviderPing")))}}var $M=Object.defineProperty,eF=Object.defineProperties,tF=Object.getOwnPropertyDescriptors,nF=Object.getOwnPropertySymbols,rF=Object.prototype.hasOwnProperty,iF=Object.prototype.propertyIsEnumerable,oF=(e,t,n)=>t in e?$M(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,sF=(e,t)=>{for(var n in t||(t={}))rF.call(t,n)&&oF(e,n,t[n]);if(nF)for(var n of nF(t))iF.call(t,n)&&oF(e,n,t[n]);return e},aF=(e,t)=>eF(e,tF(t)),cF=(e,t,n)=>oF(e,"symbol"!=typeof t?t+"":t,n);class lF{constructor(e){var t,n;cF(this,"client"),cF(this,"namespaces"),cF(this,"optionalNamespaces"),cF(this,"sessionProperties"),cF(this,"scopedProperties"),cF(this,"events",new ir),cF(this,"rpcProviders",{}),cF(this,"session"),cF(this,"providerOpts"),cF(this,"logger"),cF(this,"uri"),cF(this,"disableProviderPing",!1),cF(this,"connectParams"),this.providerOpts=e,this.logger=Qk({logger:null!=(t=e.logger)?t:Mj,name:null!=(n=this.providerOpts.name)?n:Fj}),this.disableProviderPing=(null===e||void 0===e?void 0:e.disableProviderPing)||!1}static async init(e){const t=new lF(e);return await t.initialize(),t}async request(e,t,n){const[r,i]=this.validateChain(t);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(r).request({request:sF({},e),chainId:"".concat(r,":").concat(i),topic:this.session.topic,expiry:n})}sendAsync(e,t,n,r){const i=(new Date).getTime();this.request(e,n,r).then((e=>t(null,gP(i,e)))).catch((e=>t(e,void 0)))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties,scopedProperties:this.scopedProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:null==(e=this.session)?void 0:e.topic,reason:Ik("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.connectParams=e,this.setNamespaces(e),this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,t){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:n,response:r}=await this.client.authenticate(e,t);n&&(this.uri=n,this.events.emit("display_uri",n));const i=await r();if(this.session=i.session,this.session){const e=cM(this.session.namespaces);this.namespaces=oM(this.namespaces,e),await this.persist("namespaces",this.namespaces),this.onConnect()}return i}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}removeListener(e,t){this.events.removeListener(e,t)}off(e,t){this.events.off(e,t)}get isWalletConnect(){return!0}async pair(e){var t,n;const{uri:r,approval:i}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties,scopedProperties:this.scopedProperties,authentication:null==(t=this.connectParams)?void 0:t.authentication,walletPay:null==(n=this.connectParams)?void 0:n.walletPay});r&&(this.uri=r,this.events.emit("display_uri",r));const o=await i();this.session=o;const s=cM(o.namespaces);return this.namespaces=oM(this.namespaces,s),await this.persist("namespaces",this.namespaces),await this.persist("optionalNamespaces",this.optionalNamespaces),this.onConnect(),this.session}setDefaultChain(e,t){try{if(!this.session)return;const[n,r]=this.validateChain(e);this.getProvider(n).setDefaultChain(r,t)}catch(Qu){if(!/Please call connect/.test(Qu.message))throw Qu}}async cleanupPendingPairings(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{this.logger.info("Cleaning up inactive pairings...");const t=this.client.pairing.getAll();if(!Ok(t))return;for(const n of t)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info("Inactive pairings cleared: ".concat(t.length))}catch(We){this.logger.warn(We,"Failed to cleanup pending pairings")}}abortPairingAttempt(){this.logger.warn("abortPairingAttempt is deprecated. This is now a no-op.")}async checkStorage(){this.namespaces=await this.getFromStore("namespaces")||{},this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.session&&this.createProviders()}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){var e,t;if(this.client=this.providerOpts.client||await MD.init({core:this.providerOpts.core,logger:this.providerOpts.logger||Mj,relayUrl:this.providerOpts.relayUrl||"wss://relay.walletconnect.org",projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.providerOpts.session)try{this.session=this.client.session.get(this.providerOpts.session.topic)}catch(Qu){throw this.logger.error(Qu,"Failed to get session"),new Error("The provided session: ".concat(null==(t=null==(e=this.providerOpts)?void 0:e.session)?void 0:t.topic," doesn't exist in the Sign client"))}else{const e=this.client.session.getAll();this.session=e[0]}this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map((e=>bk(e))))];fM("client",this.client),fM("events",this.events),fM("disableProviderPing",this.disableProviderPing),e.forEach((e=>{if(!this.session)return;const t=function(e,t){const n=Object.keys(t.namespaces).filter((t=>t.includes(e)));if(!n.length)return[];const r=[];return n.forEach((e=>{const n=t.namespaces[e].accounts;r.push(...n)})),r}(e,this.session);if(0===(null===t||void 0===t?void 0:t.length))return;const n=rM(t),r=oM(this.namespaces,this.optionalNamespaces),i=aF(sF({},r[e]),{accounts:t,chains:n});if("eip155"===e)this.rpcProviders[e]=new ZM({namespace:i});else this.rpcProviders[e]=new JM({namespace:i})}))}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",(e=>{var t;const{topic:n}=e;n===(null==(t=this.session)?void 0:t.topic)&&this.events.emit("session_ping",e)})),this.client.on("session_event",(e=>{var t;const{params:n,topic:r}=e;if(r!==(null==(t=this.session)?void 0:t.topic))return;const{event:i}=n;if("accountsChanged"===i.name){const e=i.data;e&&Ok(e)&&this.events.emit("accountsChanged",e.map(aM))}else if("chainChanged"===i.name){const e=n.chainId,t=n.event.data,r=bk(e),i=lM(e)!==lM(t)?"".concat(r,":").concat(lM(t)):e;this.onChainChanged({currentCaipChainId:i})}else this.events.emit(i.name,i.data);this.events.emit("session_event",e)})),this.client.on("session_update",(e=>{let{topic:t,params:n}=e;var r,i;if(t!==(null==(r=this.session)?void 0:r.topic))return;const{namespaces:o}=n,s=null==(i=this.client)?void 0:i.session.get(t);this.session=aF(sF({},s),{namespaces:o}),this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:n})})),this.client.on("session_delete",(async e=>{var t;e.topic===(null==(t=this.session)?void 0:t.topic)&&(await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",aF(sF({},Ik("USER_DISCONNECTED")),{data:e.topic})))})),this.on(Wj,(e=>{this.onChainChanged(aF(sF({},e),{internal:!0}))}))}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[Hj]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach((e=>{var t;this.getProvider(e).updateNamespace(null==(t=this.session)?void 0:t.namespaces[e])}))}setNamespaces(e){const{namespaces:t={},optionalNamespaces:n={},sessionProperties:r,scopedProperties:i}=e;this.optionalNamespaces=oM(t,n),this.sessionProperties=r,this.scopedProperties=i}validateChain(e){const[t,n]=(null===e||void 0===e?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[t,n];if(t&&!Object.keys(this.namespaces||{}).map((e=>bk(e))).includes(t))throw new Error("Namespace '".concat(t,"' is not configured. Please call connect() first with namespace config."));if(t&&n)return[t,n];const r=bk(Object.keys(this.namespaces)[0]);return[r,this.rpcProviders[r].getDefaultChain()]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}async onChainChanged(e){let{currentCaipChainId:t,previousCaipChainId:n,internal:r=!1}=e;if(!this.namespaces)return;const[i,o]=this.validateChain(t);o&&(this.updateNamespaceChain(i,o),r?(this.events.emit("chainChanged",o),this.emitAccountsChangedOnChainChange({namespace:i,currentCaipChainId:t,previousCaipChainId:n})):this.getProvider(i).setDefaultChain(o),await this.persist("namespaces",this.namespaces))}emitAccountsChangedOnChainChange(e){let{namespace:t,currentCaipChainId:n,previousCaipChainId:r}=e;var i,o;try{if(r===n)return;const e=null==(o=null==(i=this.session)?void 0:i.namespaces[t])?void 0:o.accounts;if(!e)return;const s=e.filter((e=>e.includes("".concat(n,":")))).map(aM);if(!Ok(s))return;this.events.emit("accountsChanged",s)}catch(Yu){this.logger.warn(Yu,"Failed to emit accountsChanged on chain change")}}updateNamespaceChain(e,t){if(!this.namespaces)return;const n=this.namespaces[e]?e:"".concat(e,":").concat(t),r={chains:[],methods:[],events:[],defaultChain:t};this.namespaces[n]?this.namespaces[n]&&(this.namespaces[n].defaultChain=t):this.namespaces[n]=r}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.connectParams=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,await this.deleteFromStore("namespaces"),await this.deleteFromStore("optionalNamespaces"),await this.deleteFromStore("sessionProperties"),this.session=void 0,this.cleanupPendingPairings({deletePairings:!0}),await this.cleanupStorage()}async persist(e,t){var n;const r=(null==(n=this.session)?void 0:n.topic)||"";await this.client.core.storage.setItem("".concat(zj,"/").concat(e).concat(r),t)}async getFromStore(e){var t;const n=(null==(t=this.session)?void 0:t.topic)||"";return await this.client.core.storage.getItem("".concat(zj,"/").concat(e).concat(n))}async deleteFromStore(e){var t;const n=(null==(t=this.session)?void 0:t.topic)||"";await this.client.core.storage.removeItem("".concat(zj,"/").concat(e).concat(n))}async cleanupStorage(){var e;try{if((null==(e=this.client)?void 0:e.session.length)>0)return;const t=await this.client.core.storage.getKeys();for(const e of t)e.startsWith(zj)&&await this.client.core.storage.removeItem(e)}catch(We){this.logger.warn(We,"Failed to cleanup storage")}}}const uF=lF;let dF=function(e){return e.FLOW_AUTHN="flow_authn",e.FLOW_PRE_AUTHZ="flow_pre_authz",e.FLOW_AUTHZ="flow_authz",e.FLOW_USER_SIGN="flow_user_sign",e}({}),fF=function(e){return e.SESSION_REQUEST="session_proposal",e.SIGNING_REQUEST="signing_request",e}({});const hF="fcl-plugin-service-walletconnect",pF="WC/RPC";function gF(){return"undefined"!==typeof navigator&&/iPhone|iPod/.test(navigator.userAgent)||"undefined"!==typeof navigator&&/iPad/.test(navigator.userAgent)}function yF(){return"undefined"!==typeof navigator&&/android/i.test(navigator.userAgent)||gF()}function mF(e){if(e.startsWith("http")){const t=document.createElement("a");t.href=e,t.target="_blank",t.rel="noreferrer noopener",t.click()}else window.open(e,"_blank")}async function vF(e){let{provider:t,existingPairing:n,network:r}=e;const i=r||await Ac(),o={flow:{methods:[dF.FLOW_AUTHN,dF.FLOW_PRE_AUTHZ,dF.FLOW_AUTHZ,dF.FLOW_USER_SIGN],chains:["flow:".concat(i)],events:["chainChanged","accountsChanged"]}};let s;const a=new Promise(((e,n)=>{const r=t=>{e(t)};t.on("display_uri",r),s=()=>{t.removeListener("display_uri",r),n(new Error("WalletConnect Session Request aborted"))}})),c=t.connect({pairingTopic:null===n||void 0===n?void 0:n.topic,namespaces:o}).finally((()=>{s()}));return{uri:await a,approval:()=>c}}const bF=async e=>{var t;let{method:n,body:r,session:i,provider:o,isExternal:s,abortSignal:a,disableNotifications:c}=e;const[l,u,d]=function(e){const[t,n,r]=Object.values(e.namespaces).map((e=>e.accounts)).flat().filter((e=>e.startsWith("flow:")))[0].split(":"),i="".concat(t,":").concat(n),o=r;return[i,o,r]}(i),f=JSON.stringify({...r,addr:u,address:d}),h=await Promise.race([o.client.request({request:{method:n,params:[f]},chainId:l,topic:null===(t=o.session)||void 0===t?void 0:t.topic}),new Promise(((e,t)=>{null!==a&&void 0!==a&&a.aborted&&t(new Error("WalletConnect Request aborted")),null===a||void 0===a||a.addEventListener("abort",(()=>{t(new Error("WalletConnect Request aborted"))}))}))]);if("object"===typeof h&&null!=h)switch(h.status){case"APPROVED":function b(e){return"WC/RPC"===e.method?{...e,params:{...e.params,...s?{externalProvider:i.topic}:{},...c?{disableNotifications:c}:{}}}:e}if(n===dF.FLOW_AUTHN){var p,g;const w=(null!==(p=null===h||void 0===h||null===(g=h.data)||void 0===g?void 0:g.services)&&void 0!==p?p:[]).map(b);return{...h.data?h.data:{},services:w}}var y,m,v;return n===dF.FLOW_PRE_AUTHZ?{...h.data,...null!==(y=h.data)&&void 0!==y&&y.proposer?{proposer:b(h.data.proposer)}:{},payer:[...null===(m=h.data)||void 0===m||null===(m=m.payer)||void 0===m?void 0:m.map(b)],authorization:[...null===(v=h.data)||void 0===v||null===(v=v.authorization)||void 0===v?void 0:v.map(b)]}:h.data;case"DECLINED":throw new Error("Declined: ".concat(h.reason||"No reason supplied"));case"REDIRECT":return h.data;default:throw new Error("Declined: No reason supplied")}};var wF='*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.sr-only{clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.fixed{position:fixed}.bottom-3{bottom:.75rem}.left-3{left:.75rem}.right-3{right:.75rem}.z-\\[2147483647\\]{z-index:2147483647}.mx-auto{margin-left:auto;margin-right:auto}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.mt-1{margin-top:.25rem}.flex{display:flex}.inline-flex{display:inline-flex}.h-10{height:2.5rem}.h-5{height:1.25rem}.w-10{width:2.5rem}.w-5{width:1.25rem}.max-w-sm{max-width:24rem}.grow{flex-grow:1}@keyframes slideUp{0%{transform:translateY(100%)}to{transform:translateY(0)}}.animate-slideUp{animation:slideUp .2s ease-out forwards}.self-start{align-self:flex-start}.self-center{align-self:center}.overflow-hidden{overflow:hidden}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.border{border-width:1px}.border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity,1))}.border-transparent{border-color:transparent}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.p-0{padding:0}.p-2{padding:.5rem}.p-4{padding:1rem}.text-sm{font-size:.875rem;line-height:1.25rem}.font-medium{font-weight:500}.text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}.shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.hover\\:text-gray-500:hover{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.focus\\:border-transparent:focus{border-color:transparent}.focus\\:ring-0:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.dark\\:border-gray-600:is(.dark *){--tw-border-opacity:1;border-color:rgb(75 85 99/var(--tw-border-opacity,1))}.dark\\:bg-gray-700:is(.dark *){--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.dark\\:text-gray-100:is(.dark *){--tw-text-opacity:1;color:rgb(243 244 246/var(--tw-text-opacity,1))}.dark\\:text-gray-200:is(.dark *){--tw-text-opacity:1;color:rgb(229 231 235/var(--tw-text-opacity,1))}.dark\\:text-gray-300:is(.dark *){--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity,1))}.dark\\:hover\\:text-gray-300:hover:is(.dark *){--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity,1))}@media (min-width:768px){.md\\:bottom-4{bottom:1rem}.md\\:left-auto{left:auto}.md\\:right-4{right:1rem}.md\\:self-start{align-self:flex-start}}';function EF(e){let{title:t,message:n,icon:r,onClick:i,onDismiss:o,animate:s}=e;return Ud("div",{className:"fixed bottom-3 left-3 right-3 mx-auto z-[2147483647] flex max-w-sm\n overflow-hidden rounded-lg border border-gray-200 bg-white p-4 shadow-lg\n md:bottom-4 md:left-auto md:right-4 dark:bg-gray-700 dark:border-gray-600\n ".concat(s?"animate-slideUp":""),role:"alert",onClick:e=>{i&&(e.stopPropagation(),null===i||void 0===i||i())},children:[r&&Ud("img",{className:"h-10 w-10 self-center rounded-md md:self-start",src:r,alt:t}),Ud("div",{className:"ml-3 grow",children:[Ud("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:t}),Ud("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-300",children:n})]}),Ud("button",{className:"ml-2 inline-flex rounded-full text-gray-400 hover:text-gray-500 focus:ring-0\n dark:text-gray-200 dark:hover:text-gray-300 ".concat(yF()?"self-center p-2":"self-start p-0 bg-transparent border-transparent focus:border-transparent"),onClick:e=>{e.stopPropagation(),null===o||void 0===o||o()},children:[Ud("span",{className:"sr-only",children:"Close"}),Ud("svg",{className:"h-5 w-5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:Ud("path",{fillRule:"evenodd",d:"M14.354 5.646a.5.5 0 00-.708 0L10 9.293 5.354 4.646a.5.5 0 00-.708.708L9.293 10l-4.647 4.646a.5.5 0 00.708.708L10 10.707l4.646 4.647a.5.5 0 00.708-.708L10.707 10l4.647-4.646a.5.5 0 000-.708z"})})]})]})}let _F=null,SF=0,xF=null;function IF(e){let{title:t,message:n,icon:r,onClick:i,onDismiss:o,debounceDelay:s=0}=e;_F||(_F=function(){const e=document.createElement("div"),t=e.attachShadow({mode:"open"}),n=document.createElement("div");t.appendChild(n),document.body.appendChild(e);const r=document.createElement("style");r.textContent=wF,t.appendChild(r);const i=window.matchMedia("(prefers-color-scheme: dark)"),o=()=>{n.classList.toggle("dark",i.matches)};return i.addEventListener("change",o),o(),n}());const a=!xF;function c(){_F&&Cd(null,_F)}return xF&&(clearTimeout(xF),xF=null),Cd(Ud(EF,{title:t,message:n,icon:r,onClick:i,onDismiss:()=>{null===o||void 0===o||o(),c()},animate:a},SF++),_F),{dismiss:()=>{xF=setTimeout((()=>{xF=null,c()}),s)}}}var OF="data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 384 512'%3e%3c!--!Font Awesome Free 6.7.1 by %40fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons%2c Inc.--%3e%3cpath d='M16 64C16 28.7 44.7 0 80 0L304 0c35.3 0 64 28.7 64 64l0 384c0 35.3-28.7 64-64 64L80 512c-35.3 0-64-28.7-64-64L16 64zM224 448a32 32 0 1 0 -64 0 32 32 0 1 0 64 0zM304 64L80 64l0 320 224 0 0-320z'/%3e%3c/svg%3e";let AF=function(e){const t=new Set;let n=e;return{subscribe:e=>(t.add(e),()=>{t.delete(e)}),setState:e=>{n=e,t.forEach((e=>e(n)))},getState:()=>n}}({});const TF=(e,t,n)=>async t=>{var r,i,o,s,a,c,l,u,d,f;let{service:h,body:p,opts:g,abortSignal:y,user:m,config:v}=t;!function(e){if(!e)return;(new Image).src=e}(null===(r=h.provider)||void 0===r?void 0:r.icon);const{wcRequestHook:b,pairingModalOverride:w,disableNotifications:E}=v,_=null!==(i=null===(o=h.params)||void 0===o?void 0:o.disableNotifications)&&void 0!==i?i:E,S=await async function(e){let{provider:t,externalProviderOrTopic:n}=e;if(!n){const e=await t;return e?{provider:e,isExternal:!1}:null}if("string"!==typeof n){var r;const e=null===(r=n.session)||void 0===r?void 0:r.topic;if(!e)throw new Error("Cannot resolve provider: UniversalProvider is not initialized");return AF.setState({[e]:n}),{provider:n,isExternal:!0}}const i=n;if(i){let e=AF.getState()[i];if(!e){let t,n;e=await new Promise(((e,r)=>{t=AF.subscribe((()=>{const t=AF.getState()[i];t&&e(t)})),n=setTimeout((()=>{r(new Error("Provider for external topic ".concat(i," not found after 5 seconds")))}),5e3)})).finally((()=>{clearTimeout(n),t()}))}return{provider:e,isExternal:!0}}const o=await t;return o?{provider:o,isExternal:!1}:null}({provider:e,externalProviderOrTopic:null===(s=h.params)||void 0===s?void 0:s.externalProvider});Lt(!!S,"WalletConnect is not initialized");const{provider:x,isExternal:I}=S;let O=null!==(a=x.session)&&void 0!==a?a:null;const A=h.endpoint,T=function(e){let{uid:t}=e;t&&/^(ftp|http|https):\/\/[^ "]+$/.test(t)||Bt({title:"WalletConnect Service Warning",message:"service.uid should be a valid universal link url. Found: ".concat(t),level:Ut.warn});return t}(h);if(null!==(c=O)&&void 0!==c&&c.topic&&(null===(l=O)||void 0===l?void 0:l.topic)===(null===(u=h.params)||void 0===u?void 0:u.externalProvider)&&A===dF.FLOW_AUTHN)return m;var R;(null==O&&(O=await new Promise(((e,t)=>{(function(e){return async t=>{let{service:n,onClose:r,appLink:i,provider:o,method:s,pairing:a,wcRequestHook:c,pairingModalOverride:l,abortSignal:u,network:d}=t;const f=o.providerOpts.projectId;Lt(!!f,"Cannot establish connection, WalletConnect projectId is undefined");let h=null,p=null;try{const{uri:t,approval:h}=await vF({provider:o,existingPairing:a,network:d});if(c&&c instanceof Function&&c({type:fF.SESSION_REQUEST,method:s,service:n,session:null,pairing:null!==a&&void 0!==a?a:null,uri:null!==t&&void 0!==t?t:null}),yF()){const e=new URLSearchParams({uri:t}).toString();mF(null==a?i+"?"+e:i)}else if(!a)if(l)l(t,r);else{p=new(await e)({projectId:f}),p.openModal({uri:t,onClose:r});const n=p.subscribeModal((e=>{!1===e.open&&(null===r||void 0===r||r(),n())}))}const g=await Promise.race([h(),new Promise(((e,t)=>{null!==u&&void 0!==u&&u.aborted&&t(new Error("Session request aborted")),null===u||void 0===u||u.addEventListener("abort",(()=>{t(new Error("Session request aborted"))}))}))]);if(null==g)throw new Error("Session request failed");return g}catch(y){throw y instanceof Error&&Bt({title:"".concat(y.name," Error establishing WalletConnect session"),message:"\n ".concat(y.message,"\n uri: ").concat(h,"\n "),level:Ut.error}),r(),y}finally{var g;null===(g=p)||void 0===g||g.closeModal()}}})(n)({service:h,onClose:function(){t("Declined: Externally Halted")},appLink:T,provider:x,method:A,pairing:undefined,wcRequestHook:b,pairingModalOverride:w,abortSignal:y,network:v.client.network}).then(e,t)}))),b&&b instanceof Function)&&b({type:fF.SIGNING_REQUEST,method:A,service:h,session:null!==(R=O)&&void 0!==R?R:null,pairing:null,uri:null});(function(e){var t;let{service:n,user:r}=e;return!!yF()&&n.endpoint!==dF.FLOW_AUTHN&&(n.endpoint!==dF.FLOW_AUTHZ||null===r||void 0===r||null===(t=r.services)||void 0===t||!t.find((e=>e.method===pF&&"pre-authz"===e.type)))})({service:h,user:m})&&mF(T);const k="true"===(null===(d=O)||void 0===d||null===(d=d.sessionProperties)||void 0===d?void 0:d["fclWc.disableNotificationsOnMobile"]),P=_||k?null:function(e){var t;let{service:n,user:r}=e;const i=null===r||void 0===r||null===(t=r.services)||void 0===t?void 0:t.find((e=>"authn"===e.type)),o=(null===i||void 0===i?void 0:i.provider)||n.provider;return IF({title:(null===o||void 0===o?void 0:o.name)||"Mobile Wallet",message:yF()?"Tap to view request in app":"Pending request on your mobile device",icon:(null===o||void 0===o?void 0:o.icon)||OF,onClick:yF()&&n.uid?()=>mF(n.uid):void 0,debounceDelay:"pre-authz"===n.type?500:0})}({user:m,service:h});return await bF({method:A,body:p,session:O,provider:x,abortSignal:y,isExternal:I,disableNotifications:null===(f=h.params)||void 0===f?void 0:f.disableNotifications}).finally((()=>null===P||void 0===P?void 0:P.dismiss()))};let RF=Promise.resolve(null);const kF=e=>{const{FclWcServicePlugin:t,providerPromise:n}=PF(e);return ql.authn.update(),{FclWcServicePlugin:t,providerPromise:n}},PF=e=>{if("undefined"===typeof window)throw new Error("FCL Wallet Connect Plugin can only be initialized in the browser");RF=RF.catch((()=>null)).then((t=>t||(async e=>{let{projectId:t,metadata:n}=e;Lt(null!=t,"FCL Wallet Connect Error: WalletConnect projectId is required");try{return uF.init({logger:"debug",relayUrl:"wss://relay.walletconnect.com",projectId:t,metadata:n})}catch(r){throw r instanceof Error&&Bt({title:"".concat(r.name," fcl-wc Init Client"),message:r.message,level:Ut.error}),r}})({projectId:e.projectId,metadata:e.metadata}))).catch((e=>{throw Bt({title:"WalletConnect Client Initialization Error",message:e.message?e.message:e,level:Ut.error}),e}));const t=function(e){return{name:hF,f_type:"ServicePlugin",type:"discovery-service",serviceStrategy:{method:pF,exec:TF(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n.e(777).then(n.bind(n,9777)).then((e=>e.WalletConnectModal)))},services:[]}}(RF,e);return{FclWcServicePlugin:t,providerPromise:RF}};async function CF(){return RF.then((e=>{if(!e)throw new Error("WalletConnect client not initialized");return e}))}let NF=function(e){return e[e.INVALID_REQUEST=-32600]="INVALID_REQUEST",e[e.METHOD_NOT_FOUND=-32601]="METHOD_NOT_FOUND",e[e.INVALID_PARAMS=-32602]="INVALID_PARAMS",e[e.INTERNAL_ERROR=-32603]="INTERNAL_ERROR",e[e.PARSE_ERROR=-32700]="PARSE_ERROR",e}({});class UF extends Error{constructor(e,t,n){super(t),this.code=e,this.message=t,this.data=n}}var BF=function(e){return e.HELLO="rpc_hello",e}(BF||{});class LF{constructor(e){cr(this,"id",0),cr(this,"setSend",(()=>{})),cr(this,"_send",(()=>new Promise((e=>{this.setSend=e})))()),cr(this,"peerInfo",(()=>new Promise(((e,t)=>{this.resolvePeerInfo=e,this.rejectPeerInfo=t})))()),cr(this,"enabledNotifications",[]),cr(this,"requestHandlers",{}),cr(this,"subscriptions",{}),cr(this,"messageListeners",[]);let{notifications:t}=e;this.enabledNotifications=t||[],this.on(BF.HELLO,(e=>(this.resolvePeerInfo(e),this.ownInfo())))}connect(e){let{send:t}=e;this.setSend(t),this.requestWithoutConnection(BF.HELLO,this.ownInfo()).then((e=>{this.resolvePeerInfo(e)})).catch(this.rejectPeerInfo)}ownInfo(){return{requests:Object.keys(this.requestHandlers),notifications:this.enabledNotifications}}async send(e){return(await this._send)(e)}receive(e){"2.0"===(null===e||void 0===e?void 0:e.jsonrpc)&&("method"in e&&("id"in e?this.handleRequest(e):this.handleNotification(e)),this.messageListeners.forEach((t=>t(e))))}async handleRequest(e){const t=this.requestHandlers[e.method];if(t)try{const n=await t(e.params);this.send({jsonrpc:"2.0",id:e.id,result:n})}catch(n){n instanceof UF?this.send({jsonrpc:"2.0",id:e.id,error:{code:n.code,message:n.message,data:n.data}}):this.send({jsonrpc:"2.0",id:e.id,error:{code:NF.INTERNAL_ERROR,message:null===n||void 0===n?void 0:n.message}})}else this.send({jsonrpc:"2.0",id:e.id,error:{code:NF.METHOD_NOT_FOUND,message:"Method not found: ".concat(e.method)}})}handleNotification(e){this.subscriptions[e.method]&&this.subscriptions[e.method].forEach((t=>t(e.params)))}onMessage(e){return this.messageListeners.push(e),()=>{this.messageListeners=this.messageListeners.filter((t=>t!==e))}}async notify(e,t){await this.onceConnected(),this.send({jsonrpc:"2.0",method:e,params:t})}async request(e,t){return await this.onceConnected(),this.requestWithoutConnection(e,t)}async requestWithoutConnection(e,t){const n=this.id++;let r=()=>{};const i=new Promise(((e,t)=>{r=this.onMessage((r=>{if(r.id===n&&("result"in r||"error"in r)){if(r.error){const e=new UF(r.error.code,r.error.message,r.error.data);t(e)}e(r.result)}}))})).finally(r);return this.send({jsonrpc:"2.0",method:e,params:t,id:n}),i}on(e,t){this.requestHandlers[e]=t}subscribe(e,t){this.subscriptions[e]=this.subscriptions[e]||new Set,this.subscriptions[e].add(t)}unsubscribe(e,t){var n;null===(n=this.subscriptions[e])||void 0===n||n.delete(t)}async onceConnected(){return this.peerInfo.then((()=>{}))}async getAvailableRequests(){return this.peerInfo.then((e=>e.requests))}async getAvailableNotifications(){return this.peerInfo.then((e=>e.notifications))}}const DF=globalThis.AbortController||n(9118);let jF=function(e){return e.NOTIFY_QRCODE_CONNECTING="notifyQrCodeConnecting",e.NOTIFY_QRCODE_CONNECTED="notifyQrCodeConnected",e.NOTIFY_QRCODE_ERROR="notifyQrCodeError",e}({}),MF=function(e){return e.REQUEST_WALLETCONNECT_QRCODE="requestWalletConnectQrCode",e.EXEC_SERVICE="execService",e}({});const FF="APPROVED",zF=e=>{let{onExecResult:t,execStrategyOpts:n,execStrategyArgs:r,abortSignal:i}=e;return async e=>{let{service:o}=e;try{var s;const e=await uu({...n,service:o,config:n.config,abortSignal:i},...r.slice(1));if(((null===(s=Cu(e))||void 0===s?void 0:s.status)||FF)===FF)return t(e),null;throw new Error((null===e||void 0===e?void 0:e.reason)||"Service was declined")}catch(Mz){throw new Error((null===Mz||void 0===Mz?void 0:Mz.message)||"Service execution failed")}}},qF=e=>{let{rpc:t,network:n,onExecResult:r,authnBody:i,abortSignal:o}=e;const s=function(e){let{rpc:t,authnBody:n}=e;return e=>{let{uri:r,approval:i,onExecResult:o}=e;setTimeout((async()=>{try{const e=await CF(),s=await i();t.notify(jF.NOTIFY_QRCODE_CONNECTING,{uri:r});const a=await bF({method:dF.FLOW_AUTHN,body:n,session:s,provider:e});t.notify(jF.NOTIFY_QRCODE_CONNECTED,{uri:r}),o(a)}catch(Mz){t.notify(jF.NOTIFY_QRCODE_ERROR,{uri:r,error:null===Mz||void 0===Mz?void 0:Mz.message})}}),0)}}({rpc:t,authnBody:i});return async e=>{if(o.aborted)throw new Error("Handler has been terminated");const t=await CF(),{uri:i,approval:a}=await vF({provider:t,network:n});return s({uri:i,approval:a,onExecResult:r}),{uri:i}}};const HF="authn";const VF="undefined"===typeof window,KF=e=>{const t=e.appDetailTitle,n=e.appDetailIcon,r=e.appDetailDescription,i=e.appDetailUrl;return{name:null!==t&&void 0!==t?t:document.title,description:null!==r&&void 0!==r?r:"",url:null!==i&&void 0!==i?i:window.location.origin,icons:n?[n]:[]}};let WF=null,GF=!1;function YF(e){if(VF)return;const t=e.walletConnectProjectId,n=e.walletConnectDisableNotifications,r=WF;if(WF=JSON.stringify(e,null,2),GF)return void(r!==WF&&console.warn("FCL WalletConnect Plugin has been already loaded with different configuration. It is not possible to change the configuration after the plugin has been loaded.\n\nPrevious configuration:\n".concat(r,"\n\nCurrent configuration:\n").concat(WF)));if(!!!t)return;if(Lt(!!t,"FCL Configuration value for 'walletconnect.projectId' is required"),Rl.getPlugins().has(hF))return GF||console.warn("It seems like the FCL WalletConnect plugins has been already loaded manually. This is no longer necessary, please see the documentation for more information."),void(GF=!0);GF=!0;const{providerPromise:i,FclWcServicePlugin:o}=kF({projectId:t,metadata:KF(e),disableNotifications:null!==n&&void 0!==n?n:void 0});Rl.add([o])}const ZF={execStrategy:async function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];const[r]=t,{body:i,abortSignal:o,service:s}=r;if((null===s||void 0===s?void 0:s.type)!==HF)return console.error('ERROR: Invalid service type for FCL Discovery execStrategyHook, expected "'.concat(HF,'" but got "').concat(null===s||void 0===s?void 0:s.type,'"')),uu(...t);const a=function(e){const t=new DF;return null!==e&&void 0!==e&&e.aborted&&t.abort(),null===e||void 0===e||e.addEventListener("abort",(()=>t.abort())),t}(o);let c;const l=new Promise((async(e,n)=>{const o=function(e){let{onExecResult:t,body:n,opts:r,args:i,abortSignal:o}=e;const s=new LF({notifications:[]});return s.on(MF.REQUEST_WALLETCONNECT_QRCODE,qF({network:r.config.client.network,rpc:s,onExecResult:t,authnBody:n,abortSignal:o})),s.on(MF.EXEC_SERVICE,zF({onExecResult:t,execStrategyOpts:r,execStrategyArgs:i,abortSignal:o})),{connect:s.connect.bind(s),receive:s.receive.bind(s)}}({onExecResult:e,body:i,opts:r,args:t,abortSignal:a.signal});c=async function(e){let{customRpc:t,opts:n,args:r,abortSignal:i}=e;const o={...n.config,client:{...n.config.client,discoveryRpcEnabled:!0}};return uu({...n,config:o,customRpc:t,abortSignal:i},...r.slice(1))}({customRpc:o,opts:r,args:t,abortSignal:a.signal}).then(e,n)}));return await l.catch((()=>{})),await Promise.race([new Promise((e=>setTimeout(e,1e3))),c]).catch((()=>{})),a.abort(),l}};const XF="FCL_IFRAME",QF="\n position:fixed;\n top: 0px;\n right: 0px;\n bottom: 0px;\n left: 0px;\n height: 100%;\n width: 100vw;\n display:block;\n background:rgba(0,0,0,0.25);\n z-index: 2147483647;\n box-sizing: border-box;\n color-scheme: light;\n";function JF(e){Lt(!document.getElementById(XF),"Attempt at triggering multiple Frames",{src:e});const t=document.createElement("iframe");t.src=e,t.id=XF,t.allow="usb *; hid *; clipboard-write",t.frameBorder="0",t.style.cssText=QF,document.body.append(t);return[t.contentWindow,()=>{document.getElementById(XF)&&document.getElementById(XF).remove()}]}const $F="FCL_POP";let ez=null,tz=null;function nz(e){var t;null==ez||null!==(t=ez)&&void 0!==t&&t.closed?ez=function(e,t,n,r,i){const o=n.top.outerHeight/2+n.top.screenY-i/2,s=n.top.outerWidth/2+n.top.screenX-r/2,a=n.open(e,t,"toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=".concat(r,", height=").concat(i,", top=").concat(o,", left=").concat(s));if(!a)throw new Error("Popup failed to open (was it blocked by a popup blocker?)");return a}(e,$F,window,640,770):tz!==e?(ez.location.replace(e),ez.focus()):ez.focus(),tz=e;return[ez,()=>{ez&&!ez.closed&&ez.close(),ez=null}]}let rz=null,iz=null;function oz(e){var t;if(null==rz||null!==(t=rz)&&void 0!==t&&t.closed){if(rz=window.open(e,"_blank"),!rz)throw new Error("Tab failed to open (was it blocked by the browser?)")}else iz!==e?(rz.location.replace(e),rz.focus()):rz.focus();iz=e;return[rz,()=>{rz&&!rz.closed&&rz.close(),rz=null}]}const sz=()=>{};const az="1.21.9";const cz=()=>{};const lz=()=>{};const uz=()=>{};const dz=()=>{throw new Error("Strategy util has not been implemented on this platform")},fz={"VIEW/IFRAME":JF,"VIEW/POP":nz,"VIEW/TAB":oz,"VIEW/MOBILE_BROWSER":dz,"VIEW/DEEPLINK":dz};async function hz(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{serviceEndpoint:()=>{}};const{serviceEndpoint:n}=t;try{return fz[e.method](n(e),t)}catch(r){throw console.error("execLocal({service, opts = {}})",r,{service:e,opts:t}),r}}const pz={[Pc["HTTP/RPC"]]:Lu(hz),[Pc["HTTP/POST"]]:Lu(hz),[Pc["IFRAME/RPC"]]:function(e){let{service:t,body:n,config:r,customRpc:i,abortSignal:o,opts:s}=e;return new Promise(((e,a)=>{const c=Gu(),l=s.includeOlderJsonRpcCall,{close:u}=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null==e)return{send:sz,close:sz};const n=t.onClose||sz,r=t.onMessage||sz,i=t.onReady||sz,o=t.onResponse||sz,s=t.onCustomRpc||sz;let a,c;const l=Hu({close:u,send:d,onReady:i,onResponse:o,onMessage:r,onCustomRpc:s,getSource:()=>a});return window.addEventListener("message",l),[a,c]=JF(ku(e)),{send:d,close:u};function u(){try{window.removeEventListener("message",l),c(),n()}catch(e){console.error("Frame Close Error",e)}}function d(e){try{a.postMessage(JSON.parse(JSON.stringify(e||{})),"*")}catch(t){console.error("Frame Send Error",e,t)}}}(t,{async onReady(e,o){let{send:s}=o;try{s({type:"FCL:VIEW:READY:RESPONSE",fclVersion:az,body:n,service:{params:t.params,data:t.data,type:t.type},config:r}),s({fclVersion:az,type:"FCL:FRAME:READY:RESPONSE",body:n,service:{params:t.params,data:t.data,type:t.type},config:r,deprecated:{message:"FCL:FRAME:READY:RESPONSE is deprecated and replaced with type: FCL:VIEW:READY:RESPONSE"}}),l&&s({jsonrpc:"2.0",id:c,method:"fcl:sign",params:[n,t.params],deprecated:{message:"jsonrpc is deprecated and replaced with type: FCL:VIEW:READY:RESPONSE"}}),null===i||void 0===i||i.connect({send:e=>{s({type:"FCL:VIEW:CUSTOM_RPC",payload:e})}})}catch(a){throw a}},onResponse(t,n){let{close:r}=n;try{if("object"!==typeof t.data)return;const n=Cu(t.data);switch(n.status){case"APPROVED":e(n.data),r();break;case"DECLINED":a("Declined: ".concat(n.reason||"No reason supplied")),r();break;case"REDIRECT":e(n),r();break;default:a("Declined: No reason supplied"),r()}}catch(i){throw console.error("execIframeRPC onResponse error",i),i}},onMessage(t,n){let{close:r}=n;try{if("object"!==typeof t.data)return;if("2.0"!==t.data.jsonrpc)return;if(t.data.id!==c)return;const n=Cu(t.data.result);switch(n.status){case"APPROVED":e(n.data),r();break;case"DECLINED":a("Declined: ".concat(n.reason||"No reason supplied")),r();break;case"REDIRECT":e(n),r();break;default:a("Declined: No reason supplied"),r()}}catch(i){throw console.error("execIframeRPC onMessage error",i),i}},onClose(){a("Declined: Externally Halted")},onCustomRpc(e){null===i||void 0===i||i.receive(e)}});o&&(o.aborted&&(a("Declined: Aborted"),u()),o.addEventListener("abort",(()=>{a("Declined: Aborted"),u()})))}))},[Pc["POP/RPC"]]:function(e){let{service:t,body:n,config:r,abortSignal:i,customRpc:o,opts:s}=e;return new Promise(((e,a)=>{const c=Gu(),{redir:l,includeOlderJsonRpcCall:u}=s,{close:d}=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null==e)return{send:cz,close:cz};const n=t.onClose||cz,r=t.onMessage||cz,i=t.onReady||cz,o=t.onResponse||cz,s=t.onCustomRpc||cz;let a,c;const l=Hu({close:d,send:f,onReady:i,onResponse:o,onMessage:r,onCustomRpc:s,getSource:()=>a});window.addEventListener("message",l),[a,c]=nz(ku(e));const u=setInterval((function(){a&&a.closed&&d()}),500);return{send:f,close:d};function d(){try{window.removeEventListener("message",l),clearInterval(u),c(),n()}catch(e){console.error("Popup Close Error",e)}}function f(e){try{a.postMessage(JSON.parse(JSON.stringify(e||{})),"*")}catch(t){console.error("Popup Send Error",e,t)}}}(t,{customRpc:o,async onReady(e,i){let{send:s}=i;try{s({fclVersion:az,type:"FCL:VIEW:READY:RESPONSE",body:n,service:{params:t.params,data:t.data,type:t.type},config:r}),s({fclVersion:az,type:"FCL:FRAME:READY:RESPONSE",body:n,service:{params:t.params,data:t.data,type:t.type},config:r,deprecated:{message:"FCL:FRAME:READY:RESPONSE is deprecated and replaced with type: FCL:VIEW:READY:RESPONSE"}}),u&&s({jsonrpc:"2.0",id:c,method:"fcl:sign",params:[n,t.params]}),null===o||void 0===o||o.connect({send:e=>{s({type:"FCL:VIEW:CUSTOM_RPC",payload:e})}})}catch(a){throw a}},onResponse(t,n){let{close:r}=n;try{if("object"!==typeof t.data)return;const n=Cu(t.data);switch(n.status){case"APPROVED":e(n.data),!l&&r();break;case"DECLINED":a("Declined: ".concat(n.reason||"No reason supplied")),r();break;case"REDIRECT":e(n),r();break;default:a("Declined: No reason supplied"),r()}}catch(i){throw console.error("execPopRPC onResponse error",i),i}},onMessage(t,n){let{close:r}=n;try{if("object"!==typeof t.data)return;if("2.0"!==t.data.jsonrpc)return;if(t.data.id!==c)return;const n=Cu(t.data.result);switch(n.status){case"APPROVED":e(n.data),!l&&r();break;case"DECLINED":a("Declined: ".concat(n.reason||"No reason supplied")),r();break;case"REDIRECT":e(n),r();break;default:a("Declined: No reason supplied"),r()}}catch(i){throw console.error("execPopRPC onMessage error",i),i}},onClose(){a("Declined: Externally Halted")},onCustomRpc(e){null===o||void 0===o||o.receive(e)}});i&&(i.aborted&&(a("Declined: Aborted"),d()),i.addEventListener("abort",(()=>{a("Declined: Aborted"),d()})))}))},[Pc["TAB/RPC"]]:function(e){let{service:t,body:n,config:r,abortSignal:i,customRpc:o,opts:s}=e;return new Promise(((e,a)=>{const c=Gu(),{redir:l,includeOlderJsonRpcCall:u}=s,{close:d}=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null==e)return{send:lz,close:lz};const n=t.onClose||lz,r=t.onMessage||lz,i=t.onReady||lz,o=t.onResponse||lz,s=t.onCustomRpc||lz;let a,c;const l=Hu({close:d,send:f,onReady:i,onResponse:o,onMessage:r,onCustomRpc:s,getSource:()=>a});window.addEventListener("message",l),[a,c]=oz(ku(e));const u=setInterval((function(){a&&a.closed&&d()}),500);return{send:f,close:d};function d(){try{window.removeEventListener("message",l),clearInterval(u),c(),n()}catch(e){console.error("Tab Close Error",e)}}function f(e){try{a.postMessage(JSON.parse(JSON.stringify(e||{})),"*")}catch(t){console.error("Tab Send Error",e,t)}}}(t,{customRpc:o,async onReady(e,i){let{send:s}=i;try{s({fclVersion:az,type:"FCL:VIEW:READY:RESPONSE",body:n,service:{params:t.params,data:t.data,type:t.type},config:r}),s({fclVersion:az,type:"FCL:FRAME:READY:RESPONSE",body:n,service:{params:t.params,data:t.data,type:t.type},config:r,deprecated:{message:"FCL:FRAME:READY:RESPONSE is deprecated and replaced with type: FCL:VIEW:READY:RESPONSE"}}),u&&s({jsonrpc:"2.0",id:c,method:"fcl:sign",params:[n,t.params]}),null===o||void 0===o||o.connect({send:e=>{s({type:"FCL:VIEW:CUSTOM_RPC",payload:e})}})}catch(a){throw a}},onResponse(t,n){let{close:r}=n;try{if("object"!==typeof t.data)return;const n=Cu(t.data);switch(n.status){case"APPROVED":e(n.data),!l&&r();break;case"DECLINED":a("Declined: ".concat(n.reason||"No reason supplied")),r();break;case"REDIRECT":e(n),r();break;default:a("Declined: No reason supplied"),r()}}catch(i){throw console.error("execPopRPC onResponse error",i),i}},onMessage(t,n){let{close:r}=n;try{if("object"!==typeof t.data)return;if("2.0"!==t.data.jsonrpc)return;if(t.data.id!==c)return;const n=Cu(t.data.result);switch(n.status){case"APPROVED":e(n.data),!l&&r();break;case"DECLINED":a("Declined: ".concat(n.reason||"No reason supplied")),r();break;case"REDIRECT":e(n),r();break;default:a("Declined: No reason supplied"),r()}}catch(i){throw console.error("execPopRPC onMessage error",i),i}},onClose(){a("Declined: Externally Halted")},onCustomRpc(e){null===o||void 0===o||o.receive(e)}});i&&(i.aborted&&(d(),a("Declined: Aborted")),i.addEventListener("abort",(()=>{d(),a("Declined: Aborted")})))}))},[Pc["EXT/RPC"]]:function(e){let{service:t,body:n,config:r,abortSignal:i,customRpc:o,opts:s}=e;return new Promise(((e,s)=>{const{close:a}=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null==e)return{send:uz,close:uz};const n=t.onClose||uz,r=t.onMessage||uz,i=t.onReady||uz,o=t.onResponse||uz,s=t.onCustomRpc||uz,a=Hu({close:c,send:l,onReady:i,onResponse:o,onMessage:r,onCustomRpc:s});return window.addEventListener("message",a),l({service:e}),{send:l,close:c};function c(){try{window.removeEventListener("message",a),n()}catch(e){console.error("Ext Close Error",e)}}function l(e){try{window&&window.postMessage(JSON.parse(JSON.stringify(e||{})),"*")}catch(t){console.error("Ext Send Error",e,t)}}}(t,{async onReady(e,i){let{send:s}=i;try{s({fclVersion:az,type:"FCL:VIEW:READY:RESPONSE",body:n,service:{params:t.params,data:t.data,type:t.type},config:r}),null===o||void 0===o||o.connect({send:e=>{s({type:"FCL:VIEW:CUSTOM_RPC",body:e})}})}catch(a){throw a}},onResponse(t,n){let{close:r}=n;try{if("object"!==typeof t.data)return;const n=Cu(t.data);switch(n.status){case"APPROVED":e(n.data),r();break;case"DECLINED":s("Declined: ".concat(n.reason||"No reason supplied")),r();break;case"REDIRECT":e(n),r();break;default:s("Declined: No reason supplied"),r()}}catch(i){throw console.error("execExtRPC onResponse error",i),i}},onClose(){s("Declined: Externally Halted")},onCustomRpc(e){null===o||void 0===o||o.receive(e)}});i&&(i.aborted&&(a(),s("Declined: Aborted")),i.addEventListener("abort",(()=>{a(),s("Declined: Aborted")})))}))}},gz=()=>"undefined"===typeof window,yz=e=>{if(null==e)return null;try{return JSON.parse(e)}catch(t){return null}},mz=(!gz()&&window.sessionStorage,{can:!gz()&&!!window.localStorage,get:async e=>yz(localStorage.getItem(e)),put:async(e,t)=>localStorage.setItem(e,JSON.stringify(t))}),vz=(e=>{const t=Sc();return Ru({...t,getStorageProvider:async()=>e.getStorageProvider?await e.getStorageProvider():await Yn.first(["fcl.storage","fcl.storage.default"],void 0),platform:e.platform,actorName:fu,discovery:e.discovery})})({platform:"web",discovery:ZF,getStorageProvider:async()=>await Yn.get("fcl.storage")||mz});(e=>{const t={...Sc(),currentUser:e};Ql(t)})(vz),vz().authorization;var bz,wz,Ez,_z,Sz,xz,Iz,Oz,Az,Tz;function Rz(){return Rz=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Rz.apply(null,arguments)}function kz(e,t){let{title:n,titleId:r,...i}=e;return m.createElement("svg",Rz({id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 1200 415.7",style:{enableBackground:"new 0 0 1200 415.7"},xmlSpace:"preserve",ref:t,"aria-labelledby":r},i),n?m.createElement("title",{id:r},n):null,bz||(bz=m.createElement("style",{type:"text/css"},"\n\t.st0{clip-path:url(#SVGID_2_);fill:#FFFFFF;}\n\t.st1{clip-path:url(#SVGID_2_);fill:#5BC096;}\n\t.st2{fill:#FFFFFF;}\n")),m.createElement("g",null,wz||(wz=m.createElement("defs",null,m.createElement("rect",{id:"SVGID_1_",x:23,y:40,width:1200,height:370.7}))),m.createElement("clipPath",{id:"SVGID_2_"},m.createElement("use",{xlinkHref:"#SVGID_1_",style:{overflow:"visible"}})),Ez||(Ez=m.createElement("path",{className:"st0",d:"M112.9,128.9c8-27.5,26.1-43.2,54.3-47.1h74.9l-11.7,48.6h-51.8c-3.3,0-6.5,1.2-9.4,3.5 c-2.8,2.3-4.6,5.3-5.3,8.9l-9,32.9h36.9l-11.4,48.6H143l-20.6,83H68.3L112.9,128.9z"})),_z||(_z=m.createElement("path",{className:"st0",d:"M276.5,81.8h55.1l-42.8,167.7c-0.3,2.8,0.3,5.3,2,7.5c1.8,2.2,4.2,3.3,7.2,3.3h30.1l-11.9,47h-37.6 c-15.3,0-27.4-5.8-36.4-17.4c-9-11.6-12.1-25.1-9.2-40.4L276.5,81.8z"})),Sz||(Sz=m.createElement("path",{className:"st0",d:"M382.9,293.7c-8.4-6.3-14.6-15-18.9-25.9c-9.5-23.7-7.5-50.3,6-79.7c18-32.7,47.2-49.8,87.6-51.3 c9.8-0.6,19.8-0.4,29.9,0.3c16.5,1.4,29,5.5,37.4,12.1c8.5,6.6,14.9,15.4,19.2,26.3c9.5,23.8,7.5,50.4-6,79.7 c-17.9,32.9-47.7,50.1-89.2,51.8c-8.5,0.6-18,0.4-28.7-0.5C403.7,304.3,391.3,300,382.9,293.7 M494.5,225.8 c3.5-12.7,3.6-22.4,0.3-29.1c-3.2-6.7-11.2-10.6-23.9-11.7c-16.5-1.2-30.1,1.6-40.8,8.5c-8.4,6.5-13.9,14.4-16.5,23.9 c-7.7,25.3,0.2,38.9,23.6,40.8c19.2,0.4,32.7-2.4,40.8-8.5C486.3,243.4,491.8,235.4,494.5,225.8"})),xz||(xz=m.createElement("path",{className:"st0",d:"M570.4,249.7l27.4-112.3h54.8l-27.4,112.3c-0.3,2.8,0.3,5.3,2,7.5c1.7,2.2,4.1,3.3,7.2,3.3h23.7 c0.1-3.7,0.6-7.3,1.5-10.9L687,137.4h54.8l-27.4,112.3c-0.4,2.8,0.2,5.3,2,7.5c1.7,2.2,4.1,3.3,7.2,3.3H747L776,137.4h55.8 l-41.1,169.8H741v0.2h-37.4c-21.4,0-35.9-11-43.6-32.9l-7.7,32.7h-18.7v0.2h-19c-15,0-27-5.8-35.8-17.4 C569.8,278.5,567,265.1,570.4,249.7"})),Iz||(Iz=m.createElement("path",{className:"st0",d:"M832.8,249.6l41.3-167.7h54.1c-9.1,35.8-13.9,54.2-14.2,55.5H954l-12,49.3h-39.8c-2.9,11.9-5.3,21.8-7.2,29.7 c-1.9,7.9-3.6,15-5.2,21.4c-1.6,6.4-2.5,10.4-2.8,11.9c-0.3,2.8,0.3,5.3,2,7.5c1.7,2.2,4,3.3,7,3.3h28.1l-11.4,47h-36.4 c-14.9,0-26.7-5.8-35.3-17.4C832.3,278.4,829.6,264.9,832.8,249.6"})),Oz||(Oz=m.createElement("path",{className:"st0",d:"M994.4,323.2h28.7c3,0,5.9-1.1,8.7-3.3c2.8-2.2,4.7-4.7,5.7-7.5l1.2-4.7h-39.3c-15,0-27-5.8-35.8-17.4 c-8.8-11.6-11.5-25.1-8-40.4l27.2-112.4h55l-27.2,112.4c-0.3,2.8,0.3,5.3,1.8,7.5c1.7,2.2,4.1,3.3,7.4,3.3h29.6l29.9-123.3h0.3 l0.2-0.5h55l-42.1,175.4c-4.2,15.4-13.6,28.8-28.1,40.4c-14.6,11.6-29.4,17.4-44.4,17.4h-37.6L994.4,323.2z"})),Az||(Az=m.createElement("path",{className:"st1",d:"M1179,286.9c0,16.6-13.4,30-30,30c-16.6,0-30-13.4-30-30c0-16.6,13.4-30,30-30 C1165.6,256.9,1179,270.3,1179,286.9"}))),Tz||(Tz=m.createElement("g",null,m.createElement("path",{className:"st2",d:"M1135.8,329.9h-5.1v-3.7h14.9v3.7h-5.1v12.9h-4.7V329.9z"}),m.createElement("path",{className:"st2",d:"M1162.3,342.8l0-8.8l-4.3,7.2h-2.1l-4.3-6.9v8.6h-4.3v-16.6h3.9l5.8,9.6l5.7-9.6h3.9l0,16.6H1162.3z"}))))}Yn({"discovery.wallet.method.default":"IFRAME/RPC"}),Al({coreStrategies:pz}),Yn.subscribe((async e=>{YF({walletConnectProjectId:e["walletconnect.projectId"],walletConnectDisableNotifications:e["walletconnect.disableNotifications"],appDetailTitle:e["app.detail.title"],appDetailIcon:e["app.detail.icon"],appDetailDescription:e["app.detail.description"],appDetailUrl:e["app.detail.url"]})}));const Pz=m.forwardRef(kz);n.p;var Cz=n(9334);const Nz=()=>{try{localStorage.removeItem("FCL_CURRENT_USER"),sessionStorage.clear(),vz().unauthenticate()}catch{}},Uz=()=>((0,m.useEffect)(Nz,[]),(0,Cz.jsxs)(Cz.Fragment,{children:[(0,Cz.jsxs)(Ct,{children:[(0,Cz.jsx)("title",{children:"Flowty"}),(0,Cz.jsx)("meta",{name:"description",content:"The Flowty Marketplace is no longer available."})]}),(0,Cz.jsxs)("main",{className:"min-h-screen w-full bg-darkBg flex flex-col items-center justify-center px-4 text-center",children:[(0,Cz.jsx)(Pz,{className:"w-64 sm:w-96 h-auto",role:"img","aria-label":"Flowty"}),(0,Cz.jsx)("h1",{className:"mt-12 text-3xl sm:text-4xl font-extrabold text-gray-200 tracking-tight",children:"The Flowty Marketplace is No Longer Available"}),(0,Cz.jsx)("p",{className:"mt-4 max-w-xl text-lg text-gray-400",children:"Thank you to our incredible community. We greatly appreciate your support and loyalty over the years."})]})]}));let Bz=function(e){return e.Home="/",e.Marketplace="/marketplace",e.Activity="/activity",e.AssetResource="/asset/:collectionAddress/:collectionName/:resource/:nftId",e.Asset="/asset/:collectionAddress/:collectionName/:nftId",e.UserFlow="/user/:walletAddress",e.UserSignIn="/signIn",e.UserProfileScreen="/user-profile",e.UserProfileScreenP2P="/user-profile/loans",e.UserProfileScreenRentals="/user-profile/rentals",e.UserProfileScreenStorefront="/user-profile/storefront",e.Settings="/settings",e.SettingsNotifications="/notification-settings",e.Listed="/listed",e.Loans="/loans",e.Funded="/funded",e.LoanListing="/listing/:listingResourceId",e.Terms="/tos",e.Privacy="/privacy",e.RentalListing="/rentals/:listingResourceId",e.RentalMarketplace="/rentals",e.ProfileFlowScreen="/user/profile",e.ProfileCreatorHubFlowScreen="/user/creator-hub",e.SwapListing="/swaps/:listingResourceId",e.Collection="/collection/:collectionAddress/:collectionName",e.Storefront="/storefront",e.StorefrontListing="/storefront/:listingResourceId",e.Collections="/collections",e.TwitterOauth="/_twitter-oauth",e.DiscordOauth="/_discord-oauth",e.CreatorHub="/create",e}({});const Lz=()=>(0,Cz.jsxs)(Pe,{children:[(0,Cz.jsx)(Re,{path:Bz.Home,element:(0,Cz.jsx)(Uz,{})}),(0,Cz.jsx)(Re,{path:"*",element:(0,Cz.jsx)(Te,{replace:!0,to:Bz.Home})})]}),Dz=()=>(0,Cz.jsx)(xt,{children:(0,Cz.jsx)(Lz,{})}),jz=document.getElementById("root");if(null===jz)throw new Error("Unable to find app container root");(0,b.H)(jz).render((0,Cz.jsx)(m.StrictMode,{children:(0,Cz.jsx)(Ue,{children:(0,Cz.jsx)(Dz,{})})})),"serviceWorker"in navigator&&navigator.serviceWorker.getRegistrations().then((e=>e.forEach((e=>e.unregister())))).catch((()=>{}))})()})();
//# sourceMappingURL=main.89e32884.js.map