import{A as P,I as me,P as S,K as ge,J as _e}from"./index-F5308wi0.js";var H=function(e,t,r){if(r||arguments.length===2)for(var i=0,s=t.length,o;i<s;i++)(o||!(i in t))&&(o||(o=Array.prototype.slice.call(t,0,i)),o[i]=t[i]);return e.concat(o||Array.prototype.slice.call(t))},Ee=function(){function e(t,r,i){this.name=t,this.version=r,this.os=i,this.type="browser"}return e}(),Oe=function(){function e(t){this.version=t,this.type="node",this.name="node",this.os=P.platform}return e}(),Re=function(){function e(t,r,i,s){this.name=t,this.version=r,this.os=i,this.bot=s,this.type="bot-device"}return e}(),Se=function(){function e(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return e}(),Pe=function(){function e(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return e}(),Ae=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,Be=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,q=3,Te=[["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",Ae]],V=[["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 jt(e){return e?k(e):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new Pe:typeof navigator<"u"?k(navigator.userAgent):je()}function xe(e){return e!==""&&Te.reduce(function(t,r){var i=r[0],s=r[1];if(t)return t;var o=s.exec(e);return!!o&&[i,o]},!1)}function k(e){var t=xe(e);if(!t)return null;var r=t[0],i=t[1];if(r==="searchbot")return new Se;var s=i[1]&&i[1].split(".").join("_").split("_").slice(0,3);s?s.length<q&&(s=H(H([],s,!0),Me(q-s.length),!0)):s=[];var o=s.join("."),u=Ie(e),c=Be.exec(e);return c&&c[1]?new Re(r,o,u,c[1]):new Ee(r,o,u)}function Ie(e){for(var t=0,r=V.length;t<r;t++){var i=V[t],s=i[0],o=i[1],u=o.exec(e);if(u)return s}return null}function je(){var e=typeof P<"u"&&P.version;return e?new Oe(P.version.slice(1)):null}function Me(e){for(var t=[],r=0;r<e;r++)t.push("0");return t}const De=e=>JSON.stringify(e,(t,r)=>typeof r=="bigint"?r.toString()+"n":r),Ne=e=>{const t=/([\[:])?(\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,r=e.replace(t,'$1"$2n"$3');return JSON.parse(r,(i,s)=>typeof s=="string"&&s.match(/^\d+n$/)?BigInt(s.substring(0,s.length-1)):s)};function Ce(e){if(typeof e!="string")throw new Error(`Cannot safe json parse value of type ${typeof e}`);try{return Ne(e)}catch{return e}}function J(e){return typeof e=="string"?e:De(e)||""}const Ue="PARSE_ERROR",We="INVALID_REQUEST",Le="METHOD_NOT_FOUND",Fe="INVALID_PARAMS",oe="INTERNAL_ERROR",W="SERVER_ERROR",$e=[-32700,-32600,-32601,-32602,-32603],T={[Ue]:{code:-32700,message:"Parse error"},[We]:{code:-32600,message:"Invalid Request"},[Le]:{code:-32601,message:"Method not found"},[Fe]:{code:-32602,message:"Invalid params"},[oe]:{code:-32603,message:"Internal error"},[W]:{code:-32e3,message:"Server error"}},ie=W;function He(e){return $e.includes(e)}function G(e){return Object.keys(T).includes(e)?T[e]:T[ie]}function qe(e){const t=Object.values(T).find(r=>r.code===e);return t||T[ie]}function Ve(e,t,r){return e.message.includes("getaddrinfo ENOTFOUND")||e.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${t}`):e}var ke={};/*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */var D=function(e,t){return D=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)i.hasOwnProperty(s)&&(r[s]=i[s])},D(e,t)};function Je(e,t){D(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}var N=function(){return N=Object.assign||function(t){for(var r,i=1,s=arguments.length;i<s;i++){r=arguments[i];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o])}return t},N.apply(this,arguments)};function Ge(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,i=Object.getOwnPropertySymbols(e);s<i.length;s++)t.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(e,i[s])&&(r[i[s]]=e[i[s]]);return r}function Xe(e,t,r,i){var s=arguments.length,o=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,r):i,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,r,i);else for(var c=e.length-1;c>=0;c--)(u=e[c])&&(o=(s<3?u(o):s>3?u(t,r,o):u(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}function ze(e,t){return function(r,i){t(r,i,e)}}function Ke(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)}function Qe(e,t,r,i){function s(o){return o instanceof r?o:new r(function(u){u(o)})}return new(r||(r=Promise))(function(o,u){function c(v){try{f(i.next(v))}catch(w){u(w)}}function m(v){try{f(i.throw(v))}catch(w){u(w)}}function f(v){v.done?o(v.value):s(v.value).then(c,m)}f((i=i.apply(e,t||[])).next())})}function Ye(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i,s,o,u;return u={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function c(f){return function(v){return m([f,v])}}function m(f){if(i)throw new TypeError("Generator is already executing.");for(;r;)try{if(i=1,s&&(o=f[0]&2?s.return:f[0]?s.throw||((o=s.return)&&o.call(s),0):s.next)&&!(o=o.call(s,f[1])).done)return o;switch(s=0,o&&(f=[f[0]&2,o.value]),f[0]){case 0:case 1:o=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,s=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!o||f[1]>o[0]&&f[1]<o[3])){r.label=f[1];break}if(f[0]===6&&r.label<o[1]){r.label=o[1],o=f;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(f);break}o[2]&&r.ops.pop(),r.trys.pop();continue}f=t.call(e,r)}catch(v){f=[6,v],s=0}finally{i=o=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function Ze(e,t,r,i){i===void 0&&(i=r),e[i]=t[r]}function et(e,t){for(var r in e)r!=="default"&&!t.hasOwnProperty(r)&&(t[r]=e[r])}function C(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function se(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var i=r.call(e),s,o=[],u;try{for(;(t===void 0||t-- >0)&&!(s=i.next()).done;)o.push(s.value)}catch(c){u={error:c}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(u)throw u.error}}return o}function tt(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(se(arguments[t]));return e}function rt(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var i=Array(e),s=0,t=0;t<r;t++)for(var o=arguments[t],u=0,c=o.length;u<c;u++,s++)i[s]=o[u];return i}function x(e){return this instanceof x?(this.v=e,this):new x(e)}function nt(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=r.apply(e,t||[]),s,o=[];return s={},u("next"),u("throw"),u("return"),s[Symbol.asyncIterator]=function(){return this},s;function u(p){i[p]&&(s[p]=function(g){return new Promise(function(d,A){o.push([p,g,d,A])>1||c(p,g)})})}function c(p,g){try{m(i[p](g))}catch(d){w(o[0][3],d)}}function m(p){p.value instanceof x?Promise.resolve(p.value.v).then(f,v):w(o[0][2],p)}function f(p){c("next",p)}function v(p){c("throw",p)}function w(p,g){p(g),o.shift(),o.length&&c(o[0][0],o[0][1])}}function ot(e){var t,r;return t={},i("next"),i("throw",function(s){throw s}),i("return"),t[Symbol.iterator]=function(){return this},t;function i(s,o){t[s]=e[s]?function(u){return(r=!r)?{value:x(e[s](u)),done:s==="return"}:o?o(u):u}:o}}function it(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof C=="function"?C(e):e[Symbol.iterator](),r={},i("next"),i("throw"),i("return"),r[Symbol.asyncIterator]=function(){return this},r);function i(o){r[o]=e[o]&&function(u){return new Promise(function(c,m){u=e[o](u),s(c,m,u.done,u.value)})}}function s(o,u,c,m){Promise.resolve(m).then(function(f){o({value:f,done:c})},u)}}function st(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function at(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function ut(e){return e&&e.__esModule?e:{default:e}}function ct(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}function ft(e,t,r){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,r),r}const lt=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return N},__asyncDelegator:ot,__asyncGenerator:nt,__asyncValues:it,__await:x,__awaiter:Qe,__classPrivateFieldGet:ct,__classPrivateFieldSet:ft,__createBinding:Ze,__decorate:Xe,__exportStar:et,__extends:Je,__generator:Ye,__importDefault:ut,__importStar:at,__makeTemplateObject:st,__metadata:Ke,__param:ze,__read:se,__rest:Ge,__spread:tt,__spreadArrays:rt,__values:C},Symbol.toStringTag,{value:"Module"})),ht=me(lt);var E={},X;function dt(){if(X)return E;X=1,Object.defineProperty(E,"__esModule",{value:!0}),E.isBrowserCryptoAvailable=E.getSubtleCrypto=E.getBrowerCrypto=void 0;function e(){return(S===null||S===void 0?void 0:S.crypto)||(S===null||S===void 0?void 0:S.msCrypto)||{}}E.getBrowerCrypto=e;function t(){const i=e();return i.subtle||i.webkitSubtle}E.getSubtleCrypto=t;function r(){return!!e()&&!!t()}return E.isBrowserCryptoAvailable=r,E}var O={},z;function pt(){if(z)return O;z=1,Object.defineProperty(O,"__esModule",{value:!0}),O.isBrowser=O.isNode=O.isReactNative=void 0;function e(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}O.isReactNative=e;function t(){return typeof P<"u"&&typeof P.versions<"u"&&typeof P.versions.node<"u"}O.isNode=t;function r(){return!e()&&!t()}return O.isBrowser=r,O}(function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=ht;t.__exportStar(dt(),e),t.__exportStar(pt(),e)})(ke);function ae(e=3){const t=Date.now()*Math.pow(10,e),r=Math.floor(Math.random()*Math.pow(10,e));return t+r}function Mt(e=6){return BigInt(ae(e))}function Dt(e,t,r){return{id:r||ae(),jsonrpc:"2.0",method:e,params:t}}function Nt(e,t){return{id:e,jsonrpc:"2.0",result:t}}function yt(e,t,r){return{id:e,jsonrpc:"2.0",error:bt(t,r)}}function bt(e,t){return typeof e>"u"?G(oe):(typeof e=="string"&&(e=Object.assign(Object.assign({},G(W)),{message:e})),typeof t<"u"&&(e.data=t),He(e.code)&&(e=qe(e.code)),e)}class ue{}let Ct=class extends ue{constructor(t){super()}};class vt extends ue{constructor(){super()}}class Wt extends vt{constructor(t){super()}}const wt="^https?:",mt="^wss?:";function gt(e){const t=e.match(new RegExp(/^\w+:/,"gi"));if(!(!t||!t.length))return t[0]}function ce(e,t){const r=gt(e);return typeof r>"u"?!1:new RegExp(t).test(r)}function K(e){return ce(e,wt)}function Lt(e){return ce(e,mt)}function Ft(e){return new RegExp("wss?://localhost(:d{2,5})?").test(e)}function fe(e){return typeof e=="object"&&"id"in e&&"jsonrpc"in e&&e.jsonrpc==="2.0"}function $t(e){return fe(e)&&"method"in e}function Ht(e){return fe(e)&&(_t(e)||Et(e))}function _t(e){return"result"in e}function Et(e){return"error"in e}var U={exports:{}};(function(e,t){var r=typeof self<"u"?self:S,i=function(){function o(){this.fetch=!1,this.DOMException=r.DOMException}return o.prototype=r,new o}();(function(o){(function(u){var c={searchParams:"URLSearchParams"in o,iterable:"Symbol"in o&&"iterator"in Symbol,blob:"FileReader"in o&&"Blob"in o&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in o,arrayBuffer:"ArrayBuffer"in o};function m(n){return n&&DataView.prototype.isPrototypeOf(n)}if(c.arrayBuffer)var f=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],v=ArrayBuffer.isView||function(n){return n&&f.indexOf(Object.prototype.toString.call(n))>-1};function w(n){if(typeof n!="string"&&(n=String(n)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(n))throw new TypeError("Invalid character in header field name");return n.toLowerCase()}function p(n){return typeof n!="string"&&(n=String(n)),n}function g(n){var a={next:function(){var l=n.shift();return{done:l===void 0,value:l}}};return c.iterable&&(a[Symbol.iterator]=function(){return a}),a}function d(n){this.map={},n instanceof d?n.forEach(function(a,l){this.append(l,a)},this):Array.isArray(n)?n.forEach(function(a){this.append(a[0],a[1])},this):n&&Object.getOwnPropertyNames(n).forEach(function(a){this.append(a,n[a])},this)}d.prototype.append=function(n,a){n=w(n),a=p(a);var l=this.map[n];this.map[n]=l?l+", "+a:a},d.prototype.delete=function(n){delete this.map[w(n)]},d.prototype.get=function(n){return n=w(n),this.has(n)?this.map[n]:null},d.prototype.has=function(n){return this.map.hasOwnProperty(w(n))},d.prototype.set=function(n,a){this.map[w(n)]=p(a)},d.prototype.forEach=function(n,a){for(var l in this.map)this.map.hasOwnProperty(l)&&n.call(a,this.map[l],l,this)},d.prototype.keys=function(){var n=[];return this.forEach(function(a,l){n.push(l)}),g(n)},d.prototype.values=function(){var n=[];return this.forEach(function(a){n.push(a)}),g(n)},d.prototype.entries=function(){var n=[];return this.forEach(function(a,l){n.push([l,a])}),g(n)},c.iterable&&(d.prototype[Symbol.iterator]=d.prototype.entries);function A(n){if(n.bodyUsed)return Promise.reject(new TypeError("Already read"));n.bodyUsed=!0}function L(n){return new Promise(function(a,l){n.onload=function(){a(n.result)},n.onerror=function(){l(n.error)}})}function le(n){var a=new FileReader,l=L(a);return a.readAsArrayBuffer(n),l}function he(n){var a=new FileReader,l=L(a);return a.readAsText(n),l}function de(n){for(var a=new Uint8Array(n),l=new Array(a.length),b=0;b<a.length;b++)l[b]=String.fromCharCode(a[b]);return l.join("")}function F(n){if(n.slice)return n.slice(0);var a=new Uint8Array(n.byteLength);return a.set(new Uint8Array(n)),a.buffer}function $(){return this.bodyUsed=!1,this._initBody=function(n){this._bodyInit=n,n?typeof n=="string"?this._bodyText=n:c.blob&&Blob.prototype.isPrototypeOf(n)?this._bodyBlob=n:c.formData&&FormData.prototype.isPrototypeOf(n)?this._bodyFormData=n:c.searchParams&&URLSearchParams.prototype.isPrototypeOf(n)?this._bodyText=n.toString():c.arrayBuffer&&c.blob&&m(n)?(this._bodyArrayBuffer=F(n.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):c.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(n)||v(n))?this._bodyArrayBuffer=F(n):this._bodyText=n=Object.prototype.toString.call(n):this._bodyText="",this.headers.get("content-type")||(typeof n=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):c.searchParams&&URLSearchParams.prototype.isPrototypeOf(n)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},c.blob&&(this.blob=function(){var n=A(this);if(n)return n;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?A(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(le)}),this.text=function(){var n=A(this);if(n)return n;if(this._bodyBlob)return he(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(de(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},c.formData&&(this.formData=function(){return this.text().then(be)}),this.json=function(){return this.text().then(JSON.parse)},this}var pe=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function ye(n){var a=n.toUpperCase();return pe.indexOf(a)>-1?a:n}function R(n,a){a=a||{};var l=a.body;if(n instanceof R){if(n.bodyUsed)throw new TypeError("Already read");this.url=n.url,this.credentials=n.credentials,a.headers||(this.headers=new d(n.headers)),this.method=n.method,this.mode=n.mode,this.signal=n.signal,!l&&n._bodyInit!=null&&(l=n._bodyInit,n.bodyUsed=!0)}else this.url=String(n);if(this.credentials=a.credentials||this.credentials||"same-origin",(a.headers||!this.headers)&&(this.headers=new d(a.headers)),this.method=ye(a.method||this.method||"GET"),this.mode=a.mode||this.mode||null,this.signal=a.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&l)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(l)}R.prototype.clone=function(){return new R(this,{body:this._bodyInit})};function be(n){var a=new FormData;return n.trim().split("&").forEach(function(l){if(l){var b=l.split("="),y=b.shift().replace(/\+/g," "),h=b.join("=").replace(/\+/g," ");a.append(decodeURIComponent(y),decodeURIComponent(h))}}),a}function ve(n){var a=new d,l=n.replace(/\r?\n[\t ]+/g," ");return l.split(/\r?\n/).forEach(function(b){var y=b.split(":"),h=y.shift().trim();if(h){var I=y.join(":").trim();a.append(h,I)}}),a}$.call(R.prototype);function _(n,a){a||(a={}),this.type="default",this.status=a.status===void 0?200:a.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in a?a.statusText:"OK",this.headers=new d(a.headers),this.url=a.url||"",this._initBody(n)}$.call(_.prototype),_.prototype.clone=function(){return new _(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new d(this.headers),url:this.url})},_.error=function(){var n=new _(null,{status:0,statusText:""});return n.type="error",n};var we=[301,302,303,307,308];_.redirect=function(n,a){if(we.indexOf(a)===-1)throw new RangeError("Invalid status code");return new _(null,{status:a,headers:{location:n}})},u.DOMException=o.DOMException;try{new u.DOMException}catch{u.DOMException=function(a,l){this.message=a,this.name=l;var b=Error(a);this.stack=b.stack},u.DOMException.prototype=Object.create(Error.prototype),u.DOMException.prototype.constructor=u.DOMException}function j(n,a){return new Promise(function(l,b){var y=new R(n,a);if(y.signal&&y.signal.aborted)return b(new u.DOMException("Aborted","AbortError"));var h=new XMLHttpRequest;function I(){h.abort()}h.onload=function(){var B={status:h.status,statusText:h.statusText,headers:ve(h.getAllResponseHeaders()||"")};B.url="responseURL"in h?h.responseURL:B.headers.get("X-Request-URL");var M="response"in h?h.response:h.responseText;l(new _(M,B))},h.onerror=function(){b(new TypeError("Network request failed"))},h.ontimeout=function(){b(new TypeError("Network request failed"))},h.onabort=function(){b(new u.DOMException("Aborted","AbortError"))},h.open(y.method,y.url,!0),y.credentials==="include"?h.withCredentials=!0:y.credentials==="omit"&&(h.withCredentials=!1),"responseType"in h&&c.blob&&(h.responseType="blob"),y.headers.forEach(function(B,M){h.setRequestHeader(M,B)}),y.signal&&(y.signal.addEventListener("abort",I),h.onreadystatechange=function(){h.readyState===4&&y.signal.removeEventListener("abort",I)}),h.send(typeof y._bodyInit>"u"?null:y._bodyInit)})}return j.polyfill=!0,o.fetch||(o.fetch=j,o.Headers=d,o.Request=R,o.Response=_),u.Headers=d,u.Request=R,u.Response=_,u.fetch=j,Object.defineProperty(u,"__esModule",{value:!0}),u})({})})(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var s=i;t=s.fetch,t.default=s.fetch,t.fetch=s.fetch,t.Headers=s.Headers,t.Request=s.Request,t.Response=s.Response,e.exports=t})(U,U.exports);var Ot=U.exports;const Q=ge(Ot);var Rt=Object.defineProperty,St=Object.defineProperties,Pt=Object.getOwnPropertyDescriptors,Y=Object.getOwnPropertySymbols,At=Object.prototype.hasOwnProperty,Bt=Object.prototype.propertyIsEnumerable,Z=(e,t,r)=>t in e?Rt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ee=(e,t)=>{for(var r in t||(t={}))At.call(t,r)&&Z(e,r,t[r]);if(Y)for(var r of Y(t))Bt.call(t,r)&&Z(e,r,t[r]);return e},te=(e,t)=>St(e,Pt(t));const Tt={Accept:"application/json","Content-Type":"application/json"},xt="POST",re={headers:Tt,method:xt},ne=10;class qt{constructor(t,r=!1){if(this.url=t,this.disableProviderPing=r,this.events=new _e.EventEmitter,this.isAvailable=!1,this.registering=!1,!K(t))throw new Error(`Provided URL is not compatible with HTTP connection: ${t}`);this.url=t,this.disableProviderPing=r}get connected(){return this.isAvailable}get connecting(){return this.registering}on(t,r){this.events.on(t,r)}once(t,r){this.events.once(t,r)}off(t,r){this.events.off(t,r)}removeListener(t,r){this.events.removeListener(t,r)}async open(t=this.url){await this.register(t)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(t){this.isAvailable||await this.register();try{const r=J(t),i=await(await Q(this.url,te(ee({},re),{body:r}))).json();this.onPayload({data:i})}catch(r){this.onError(t.id,r)}}async register(t=this.url){if(!K(t))throw new Error(`Provided URL is not compatible with HTTP connection: ${t}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((i,s)=>{this.events.once("register_error",o=>{this.resetMaxListeners(),s(o)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return s(new Error("HTTP connection is missing or invalid"));i()})})}this.url=t,this.registering=!0;try{if(!this.disableProviderPing){const r=J({id:1,jsonrpc:"2.0",method:"test",params:[]});await Q(t,te(ee({},re),{body:r}))}this.onOpen()}catch(r){const i=this.parseError(r);throw this.events.emit("register_error",i),this.onClose(),i}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(t){if(typeof t.data>"u")return;const r=typeof t.data=="string"?Ce(t.data):t.data;this.events.emit("payload",r)}onError(t,r){const i=this.parseError(r),s=i.message||i.toString(),o=yt(t,s);this.events.emit("payload",o)}parseError(t,r=this.url){return Ve(t,r,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>ne&&this.events.setMaxListeners(ne)}}export{Ce as a,Ht as b,Lt as c,jt as d,ke as e,Dt as f,Mt as g,Ft as h,Et as i,yt as j,$t as k,Nt as l,_t as m,ae as n,qt as o,Ve as p,Ct as q,Wt as r,J as s};