@orbs-network/spot-react 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { B as p, g as m, s as w, d as k, i as b, l as L, a as O, c as E, b as x, e as R, H as y, f as M } from "./index-DiYJ6g0r.js";
1
+ import { B as p, g as m, s as w, d as k, i as b, l as L, a as O, c as E, b as x, e as R, H as y, f as M } from "./index-DW_y7KaJ.js";
2
2
  class S extends p {
3
3
  constructor({ callbackSelector: r, cause: a, data: n, extraData: i, sender: f, urls: t }) {
4
4
  var o;
@@ -56,7 +56,7 @@ const bh = (e) => {
56
56
  }
57
57
  });
58
58
  }
59
- })), J2 = "0.0.8", ew = {
59
+ })), J2 = "0.0.9", ew = {
60
60
  version: J2
61
61
  };
62
62
  var io = class {
@@ -8234,7 +8234,7 @@ async function su(e, t) {
8234
8234
  });
8235
8235
  return oe === "0x" ? { data: void 0 } : { data: oe };
8236
8236
  } catch (O) {
8237
- const B = R3(O), { offchainLookup: R, offchainLookupSignature: z } = await import("./ccip-DYVRalTt.js");
8237
+ const B = R3(O), { offchainLookup: R, offchainLookupSignature: z } = await import("./ccip-MUETncvQ.js");
8238
8238
  if (e.ccipRead !== !1 && (B == null ? void 0 : B.slice(0, 10)) === z && C)
8239
8239
  return { data: await R(e, { data: B, to: C }) };
8240
8240
  throw A && (B == null ? void 0 : B.slice(0, 10)) === "0x101bb98d" ? new p8({ factory: p }) : Rp(O, {
@@ -1,6 +1,6 @@
1
1
  declare const _default: {
2
2
  "name": "@orbs-network/spot-react",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "description": "Spot React Components - React components for Spot SDK",
5
5
  "type": "module",
6
6
  "main": "./dist/spot-react.umd.cjs",
@@ -1,6 +1,6 @@
1
1
  import "react";
2
2
  import { Configs as r, DISCLAIMER_URL as t, Module as l, ORBS_LOGO as i, ORBS_WEBSITE_URL as n, OrderStatus as o, OrderType as u, Partners as P, eqIgnoreCase as T, isNativeAddress as p } from "@orbs-network/spot-ui";
3
- import { C as m, D as O, I as S, P as c, S as E, E as I, F as R, J as D, U as g, K as y, N as C, _, Q as L, R as N, T as k, X as x, O as A, L as U, V as v, W as M, M as f, G as B, Z as w, Y as F, z as W, v as b, p as h, j as G, k as j, A as q, x as z, w as H, m as J, n as K, r as Q, o as V, t as X, y as Y, h as Z, q as $, u as ee } from "./index-DiYJ6g0r.js";
3
+ import { C as m, D as O, I as S, P as c, S as E, E as I, F as R, J as D, U as g, K as y, N as C, _, Q as L, R as N, T as k, X as x, O as A, L as U, V as v, W as M, M as f, G as B, Z as w, Y as F, z as W, v as b, p as h, j as G, k as j, A as q, x as z, w as H, m as J, n as K, r as Q, o as V, t as X, y as Y, h as Z, q as $, u as ee } from "./index-DW_y7KaJ.js";
4
4
  export {
5
5
  m as Components,
6
6
  r as Configs,
@@ -1,4 +1,4 @@
1
- (function(Z,F){typeof exports=="object"&&typeof module<"u"?F(exports,require("react"),require("@orbs-network/spot-ui"),require("react/jsx-runtime"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","@orbs-network/spot-ui","react/jsx-runtime","react-dom"],F):(Z=typeof globalThis<"u"?globalThis:Z||self,F(Z.SpotReact={},Z.React,Z.SpotSDK,Z.jsxRuntime,Z.ReactDOM))})(this,(function(Z,F,R,B,Pu){"use strict";var r2=Z=>{throw TypeError(Z)};var R0=(Z,F,R)=>F.has(Z)||r2("Cannot "+R);var N=(Z,F,R)=>(R0(Z,F,"read from private field"),R?R.call(Z):F.get(Z)),le=(Z,F,R)=>F.has(Z)?r2("Cannot add the same private member more than once"):F instanceof WeakSet?F.add(Z):F.set(Z,R),ee=(Z,F,R,B)=>(R0(Z,F,"write to private field"),B?B.call(Z,R):F.set(Z,R),R),Ae=(Z,F,R)=>(R0(Z,F,"access private method"),R);var Su=(Z,F,R,B)=>({set _(Pu){ee(Z,F,Pu,R)},get _(){return N(Z,F,B)}});var rn,Xs,Lx,Qs,os,eo,Rx,to,is,ro,Hx,Js,$x,ea,no,vr,ta,St,rc,ra,Rr,Nn,Gx,Zt,_e,nc,Lt,na,so,Mn,cs,sc,ao,oo,sa,aa,ls,io,Ve,ic,H0,$0,G0,j0,V0,W0,q0,n2,jx,ac,nn,Rt,oa,sn,hs,Vx,_n,Hr,oc,Wx,Un,us,Xt,Dn,Fn,Au,Y0,qx,an,Yx,ut,ds,fs,co,lo,ps,uo,fo,Kx;function s2(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const mt=s2(F),X0=e=>{let t;const r=new Set,n=(l,u)=>{const d=typeof l=="function"?l(t):l;if(!Object.is(d,t)){const p=t;t=u??(typeof d!="object"||d===null)?d:Object.assign({},t,d),r.forEach(h=>h(t,p))}},s=()=>t,i={setState:n,getState:s,getInitialState:()=>c,subscribe:l=>(r.add(l),()=>r.delete(l))},c=t=e(n,s,i);return i},a2=(e=>e?X0(e):X0),o2=e=>e;function i2(e,t=o2){const r=F.useSyncExternalStore(e.subscribe,F.useCallback(()=>t(e.getState()),[e,t]),F.useCallback(()=>t(e.getInitialState()),[e,t]));return F.useDebugValue(r),r}const Q0=e=>{const t=a2(e),r=n=>i2(t,n);return Object.assign(r,t),r},c2=(e=>e?Q0(e):Q0),J0={disclaimerAccepted:!0,currentTime:Date.now(),swapExecution:{}},K=c2((e,t)=>({state:J0,updateState:r=>e(n=>({state:{...n.state,...r}})),updateSwapExecution:r=>e(n=>({state:{...n.state,swapExecution:{...n.state.swapExecution,...r}}})),resetState:()=>{e({state:{...J0,currentTime:Date.now(),swapExecution:t().state.swapExecution,isMarketOrder:t().state.isMarketOrder}})}})),l2={version:"0.0.8"};var ca=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},u2={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},d2=(Lx=class{constructor(){le(this,rn,u2);le(this,Xs,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&N(this,Xs)&&e!==N(this,rn)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:N(this,rn),provider:e}),ee(this,rn,e),process.env.NODE_ENV!=="production"&&ee(this,Xs,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&ee(this,Xs,!0),N(this,rn).setTimeout(e,t)}clearTimeout(e){N(this,rn).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&ee(this,Xs,!0),N(this,rn).setInterval(e,t)}clearInterval(e){N(this,rn).clearInterval(e)}},rn=new WeakMap,Xs=new WeakMap,Lx),ms=new d2;function f2(e){setTimeout(e,0)}var bs=typeof window>"u"||"Deno"in globalThis;function Ft(){}function p2(e,t){return typeof e=="function"?e(t):e}function Iu(e){return typeof e=="number"&&e>=0&&e!==1/0}function eh(e,t){return Math.max(e+(t||0)-Date.now(),0)}function zn(e,t){return typeof e=="function"?e(t):e}function ur(e,t){return typeof e=="function"?e(t):e}function th(e,t){const{type:r="all",exact:n,fetchStatus:s,predicate:a,queryKey:o,stale:i}=e;if(o){if(n){if(t.queryHash!==Ou(o,t.options))return!1}else if(!ho(t.queryKey,o))return!1}if(r!=="all"){const c=t.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof i=="boolean"&&t.isStale()!==i||s&&s!==t.state.fetchStatus||a&&!a(t))}function rh(e,t){const{exact:r,status:n,predicate:s,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(r){if(ys(t.options.mutationKey)!==ys(a))return!1}else if(!ho(t.options.mutationKey,a))return!1}return!(n&&t.state.status!==n||s&&!s(t))}function Ou(e,t){return((t==null?void 0:t.queryKeyHashFn)||ys)(e)}function ys(e){return JSON.stringify(e,(t,r)=>Mu(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function ho(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>ho(e[r],t[r])):!1}var h2=Object.prototype.hasOwnProperty;function Bu(e,t){if(e===t)return e;const r=nh(e)&&nh(t);if(!r&&!(Mu(e)&&Mu(t)))return t;const s=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,i=r?new Array(o):{};let c=0;for(let l=0;l<o;l++){const u=r?l:a[l],d=e[u],p=t[u];if(d===p){i[u]=d,(r?l<s:h2.call(e,u))&&c++;continue}if(d===null||p===null||typeof d!="object"||typeof p!="object"){i[u]=p;continue}const h=Bu(d,p);i[u]=h,h===d&&c++}return s===o&&c===s?e:i}function cc(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function nh(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Mu(e){if(!sh(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!sh(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function sh(e){return Object.prototype.toString.call(e)==="[object Object]"}function m2(e){return new Promise(t=>{ms.setTimeout(t,e)})}function _u(e,t,r){if(typeof r.structuralSharing=="function")return r.structuralSharing(e,t);if(r.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return Bu(e,t)}catch(n){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${n}`),n}return Bu(e,t)}return t}function b2(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function y2(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var lc=Symbol();function ah(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===lc&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===lc?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function oh(e,t){return typeof e=="function"?e(...t):!!e}var g2=(Rx=class extends ca{constructor(){super();le(this,Qs);le(this,os);le(this,eo);ee(this,eo,t=>{if(!bs&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){N(this,os)||this.setEventListener(N(this,eo))}onUnsubscribe(){var t;this.hasListeners()||((t=N(this,os))==null||t.call(this),ee(this,os,void 0))}setEventListener(t){var r;ee(this,eo,t),(r=N(this,os))==null||r.call(this),ee(this,os,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){N(this,Qs)!==t&&(ee(this,Qs,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof N(this,Qs)=="boolean"?N(this,Qs):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Qs=new WeakMap,os=new WeakMap,eo=new WeakMap,Rx),Uu=new g2;function Du(){let e,t;const r=new Promise((s,a)=>{e=s,t=a});r.status="pending",r.catch(()=>{});function n(s){Object.assign(r,s),delete r.resolve,delete r.reject}return r.resolve=s=>{n({status:"fulfilled",value:s}),e(s)},r.reject=s=>{n({status:"rejected",reason:s}),t(s)},r}var x2=f2;function w2(){let e=[],t=0,r=i=>{i()},n=i=>{i()},s=x2;const a=i=>{t?e.push(i):s(()=>{r(i)})},o=()=>{const i=e;e=[],i.length&&s(()=>{n(()=>{i.forEach(c=>{r(c)})})})};return{batch:i=>{let c;t++;try{c=i()}finally{t--,t||o()}return c},batchCalls:i=>(...c)=>{a(()=>{i(...c)})},schedule:a,setNotifyFunction:i=>{r=i},setBatchNotifyFunction:i=>{n=i},setScheduler:i=>{s=i}}}var gt=w2(),v2=(Hx=class extends ca{constructor(){super();le(this,to,!0);le(this,is);le(this,ro);ee(this,ro,t=>{if(!bs&&window.addEventListener){const r=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n)}}})}onSubscribe(){N(this,is)||this.setEventListener(N(this,ro))}onUnsubscribe(){var t;this.hasListeners()||((t=N(this,is))==null||t.call(this),ee(this,is,void 0))}setEventListener(t){var r;ee(this,ro,t),(r=N(this,is))==null||r.call(this),ee(this,is,t(this.setOnline.bind(this)))}setOnline(t){N(this,to)!==t&&(ee(this,to,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return N(this,to)}},to=new WeakMap,is=new WeakMap,ro=new WeakMap,Hx),uc=new v2;function k2(e){return Math.min(1e3*2**e,3e4)}function ih(e){return(e??"online")==="online"?uc.isOnline():!0}var Fu=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function ch(e){let t=!1,r=0,n;const s=Du(),a=()=>s.status!=="pending",o=g=>{var k;if(!a()){const v=new Fu(g);p(v),(k=e.onCancel)==null||k.call(e,v)}},i=()=>{t=!0},c=()=>{t=!1},l=()=>Uu.isFocused()&&(e.networkMode==="always"||uc.isOnline())&&e.canRun(),u=()=>ih(e.networkMode)&&e.canRun(),d=g=>{a()||(n==null||n(),s.resolve(g))},p=g=>{a()||(n==null||n(),s.reject(g))},h=()=>new Promise(g=>{var k;n=v=>{(a()||l())&&g(v)},(k=e.onPause)==null||k.call(e)}).then(()=>{var g;n=void 0,a()||(g=e.onContinue)==null||g.call(e)}),y=()=>{if(a())return;let g;const k=r===0?e.initialPromise:void 0;try{g=k??e.fn()}catch(v){g=Promise.reject(v)}Promise.resolve(g).then(d).catch(v=>{var z;if(a())return;const w=e.retry??(bs?0:3),S=e.retryDelay??k2,C=typeof S=="function"?S(r,v):S,U=w===!0||typeof w=="number"&&r<w||typeof w=="function"&&w(r,v);if(t||!U){p(v);return}r++,(z=e.onFail)==null||z.call(e,r,v),m2(C).then(()=>l()?void 0:h()).then(()=>{t?p(v):y()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(n==null||n(),s),cancelRetry:i,continueRetry:c,canStart:u,start:()=>(u()?y():h().then(y),s)}}var lh=($x=class{constructor(){le(this,Js)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Iu(this.gcTime)&&ee(this,Js,ms.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(bs?1/0:300*1e3))}clearGcTimeout(){N(this,Js)&&(ms.clearTimeout(N(this,Js)),ee(this,Js,void 0))}},Js=new WeakMap,$x),E2=(Gx=class extends lh{constructor(t){super();le(this,Rr);le(this,ea);le(this,no);le(this,vr);le(this,ta);le(this,St);le(this,rc);le(this,ra);ee(this,ra,!1),ee(this,rc,t.defaultOptions),this.setOptions(t.options),this.observers=[],ee(this,ta,t.client),ee(this,vr,N(this,ta).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,ee(this,ea,fh(this.options)),this.state=t.state??N(this,ea),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=N(this,St))==null?void 0:t.promise}setOptions(t){if(this.options={...N(this,rc),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=fh(this.options);r.data!==void 0&&(this.setState(dh(r.data,r.dataUpdatedAt)),ee(this,ea,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&N(this,vr).remove(this)}setData(t,r){const n=_u(this.state.data,t,this.options);return Ae(this,Rr,Nn).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(t,r){Ae(this,Rr,Nn).call(this,{type:"setState",state:t,setStateOptions:r})}cancel(t){var n,s;const r=(n=N(this,St))==null?void 0:n.promise;return(s=N(this,St))==null||s.cancel(t),r?r.then(Ft).catch(Ft):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(N(this,ea))}isActive(){return this.observers.some(t=>ur(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===lc||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>zn(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!eh(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=N(this,St))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=N(this,St))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),N(this,vr).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(N(this,St)&&(N(this,ra)?N(this,St).cancel({revert:!0}):N(this,St).cancelRetry()),this.scheduleGc()),N(this,vr).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ae(this,Rr,Nn).call(this,{type:"invalidate"})}async fetch(t,r){var c,l,u,d,p,h,y,g,k,v,w,S;if(this.state.fetchStatus!=="idle"&&((c=N(this,St))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(N(this,St))return N(this,St).continueRetry(),N(this,St).promise}if(t&&this.setOptions(t),!this.options.queryFn){const C=this.observers.find(U=>U.options.queryFn);C&&this.setOptions(C.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const n=new AbortController,s=C=>{Object.defineProperty(C,"signal",{enumerable:!0,get:()=>(ee(this,ra,!0),n.signal)})},a=()=>{const C=ah(this.options,r),z=(()=>{const T={client:N(this,ta),queryKey:this.queryKey,meta:this.meta};return s(T),T})();return ee(this,ra,!1),this.options.persister?this.options.persister(C,z,this):C(z)},i=(()=>{const C={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:N(this,ta),state:this.state,fetchFn:a};return s(C),C})();(l=this.options.behavior)==null||l.onFetch(i,this),ee(this,no,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=i.fetchOptions)==null?void 0:u.meta))&&Ae(this,Rr,Nn).call(this,{type:"fetch",meta:(d=i.fetchOptions)==null?void 0:d.meta}),ee(this,St,ch({initialPromise:r==null?void 0:r.initialPromise,fn:i.fetchFn,onCancel:C=>{C instanceof Fu&&C.revert&&this.setState({...N(this,no),fetchStatus:"idle"}),n.abort()},onFail:(C,U)=>{Ae(this,Rr,Nn).call(this,{type:"failed",failureCount:C,error:U})},onPause:()=>{Ae(this,Rr,Nn).call(this,{type:"pause"})},onContinue:()=>{Ae(this,Rr,Nn).call(this,{type:"continue"})},retry:i.options.retry,retryDelay:i.options.retryDelay,networkMode:i.options.networkMode,canRun:()=>!0}));try{const C=await N(this,St).start();if(C===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(C),(h=(p=N(this,vr).config).onSuccess)==null||h.call(p,C,this),(g=(y=N(this,vr).config).onSettled)==null||g.call(y,C,this.state.error,this),C}catch(C){if(C instanceof Fu){if(C.silent)return N(this,St).promise;if(C.revert){if(this.state.data===void 0)throw C;return this.state.data}}throw Ae(this,Rr,Nn).call(this,{type:"error",error:C}),(v=(k=N(this,vr).config).onError)==null||v.call(k,C,this),(S=(w=N(this,vr).config).onSettled)==null||S.call(w,this.state.data,C,this),C}finally{this.scheduleGc()}}},ea=new WeakMap,no=new WeakMap,vr=new WeakMap,ta=new WeakMap,St=new WeakMap,rc=new WeakMap,ra=new WeakMap,Rr=new WeakSet,Nn=function(t){const r=n=>{switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...uh(n.data,this.options),fetchMeta:t.meta??null};case"success":const s={...n,...dh(t.data,t.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return ee(this,no,t.manual?s:void 0),s;case"error":const a=t.error;return{...n,error:a,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=r(this.state),gt.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),N(this,vr).notify({query:this,type:"updated",action:t})})},Gx);function uh(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ih(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function dh(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function fh(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,n=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var C2=(jx=class extends ca{constructor(t,r){super();le(this,Ve);le(this,Zt);le(this,_e);le(this,nc);le(this,Lt);le(this,na);le(this,so);le(this,Mn);le(this,cs);le(this,sc);le(this,ao);le(this,oo);le(this,sa);le(this,aa);le(this,ls);le(this,io,new Set);this.options=r,ee(this,Zt,t),ee(this,cs,null),ee(this,Mn,Du()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(N(this,_e).addObserver(this),ph(N(this,_e),this.options)?Ae(this,Ve,ic).call(this):this.updateResult(),Ae(this,Ve,j0).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Nu(N(this,_e),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Nu(N(this,_e),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ae(this,Ve,V0).call(this),Ae(this,Ve,W0).call(this),N(this,_e).removeObserver(this)}setOptions(t){const r=this.options,n=N(this,_e);if(this.options=N(this,Zt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ur(this.options.enabled,N(this,_e))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ae(this,Ve,q0).call(this),N(this,_e).setOptions(this.options),r._defaulted&&!cc(this.options,r)&&N(this,Zt).getQueryCache().notify({type:"observerOptionsUpdated",query:N(this,_e),observer:this});const s=this.hasListeners();s&&hh(N(this,_e),n,this.options,r)&&Ae(this,Ve,ic).call(this),this.updateResult(),s&&(N(this,_e)!==n||ur(this.options.enabled,N(this,_e))!==ur(r.enabled,N(this,_e))||zn(this.options.staleTime,N(this,_e))!==zn(r.staleTime,N(this,_e)))&&Ae(this,Ve,H0).call(this);const a=Ae(this,Ve,$0).call(this);s&&(N(this,_e)!==n||ur(this.options.enabled,N(this,_e))!==ur(r.enabled,N(this,_e))||a!==N(this,ls))&&Ae(this,Ve,G0).call(this,a)}getOptimisticResult(t){const r=N(this,Zt).getQueryCache().build(N(this,Zt),t),n=this.createResult(r,t);return S2(this,n)&&(ee(this,Lt,n),ee(this,so,this.options),ee(this,na,N(this,_e).state)),n}getCurrentResult(){return N(this,Lt)}trackResult(t,r){return new Proxy(t,{get:(n,s)=>(this.trackProp(s),r==null||r(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&N(this,Mn).status==="pending"&&N(this,Mn).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,s))})}trackProp(t){N(this,io).add(t)}getCurrentQuery(){return N(this,_e)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=N(this,Zt).defaultQueryOptions(t),n=N(this,Zt).getQueryCache().build(N(this,Zt),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(t){return Ae(this,Ve,ic).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),N(this,Lt)))}createResult(t,r){var b;const n=N(this,_e),s=this.options,a=N(this,Lt),o=N(this,na),i=N(this,so),l=t!==n?t.state:N(this,nc),{state:u}=t;let d={...u},p=!1,h;if(r._optimisticResults){const x=this.hasListeners(),A=!x&&ph(t,r),I=x&&hh(t,n,r,s);(A||I)&&(d={...d,...uh(u.data,t.options)}),r._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:y,errorUpdatedAt:g,status:k}=d;h=d.data;let v=!1;if(r.placeholderData!==void 0&&h===void 0&&k==="pending"){let x;a!=null&&a.isPlaceholderData&&r.placeholderData===(i==null?void 0:i.placeholderData)?(x=a.data,v=!0):x=typeof r.placeholderData=="function"?r.placeholderData((b=N(this,oo))==null?void 0:b.state.data,N(this,oo)):r.placeholderData,x!==void 0&&(k="success",h=_u(a==null?void 0:a.data,x,r),p=!0)}if(r.select&&h!==void 0&&!v)if(a&&h===(o==null?void 0:o.data)&&r.select===N(this,sc))h=N(this,ao);else try{ee(this,sc,r.select),h=r.select(h),h=_u(a==null?void 0:a.data,h,r),ee(this,ao,h),ee(this,cs,null)}catch(x){ee(this,cs,x)}N(this,cs)&&(y=N(this,cs),h=N(this,ao),g=Date.now(),k="error");const w=d.fetchStatus==="fetching",S=k==="pending",C=k==="error",U=S&&w,z=h!==void 0,m={status:k,fetchStatus:d.fetchStatus,isPending:S,isSuccess:k==="success",isError:C,isInitialLoading:U,isLoading:U,data:h,dataUpdatedAt:d.dataUpdatedAt,error:y,errorUpdatedAt:g,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>l.dataUpdateCount||d.errorUpdateCount>l.errorUpdateCount,isFetching:w,isRefetching:w&&!S,isLoadingError:C&&!z,isPaused:d.fetchStatus==="paused",isPlaceholderData:p,isRefetchError:C&&z,isStale:zu(t,r),refetch:this.refetch,promise:N(this,Mn),isEnabled:ur(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const x=O=>{m.status==="error"?O.reject(m.error):m.data!==void 0&&O.resolve(m.data)},A=()=>{const O=ee(this,Mn,m.promise=Du());x(O)},I=N(this,Mn);switch(I.status){case"pending":t.queryHash===n.queryHash&&x(I);break;case"fulfilled":(m.status==="error"||m.data!==I.value)&&A();break;case"rejected":(m.status!=="error"||m.error!==I.reason)&&A();break}}return m}updateResult(){const t=N(this,Lt),r=this.createResult(N(this,_e),this.options);if(ee(this,na,N(this,_e).state),ee(this,so,this.options),N(this,na).data!==void 0&&ee(this,oo,N(this,_e)),cc(r,t))return;ee(this,Lt,r);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!N(this,io).size)return!0;const o=new Set(a??N(this,io));return this.options.throwOnError&&o.add("error"),Object.keys(N(this,Lt)).some(i=>{const c=i;return N(this,Lt)[c]!==t[c]&&o.has(c)})};Ae(this,Ve,n2).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ae(this,Ve,j0).call(this)}},Zt=new WeakMap,_e=new WeakMap,nc=new WeakMap,Lt=new WeakMap,na=new WeakMap,so=new WeakMap,Mn=new WeakMap,cs=new WeakMap,sc=new WeakMap,ao=new WeakMap,oo=new WeakMap,sa=new WeakMap,aa=new WeakMap,ls=new WeakMap,io=new WeakMap,Ve=new WeakSet,ic=function(t){Ae(this,Ve,q0).call(this);let r=N(this,_e).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(Ft)),r},H0=function(){Ae(this,Ve,V0).call(this);const t=zn(this.options.staleTime,N(this,_e));if(bs||N(this,Lt).isStale||!Iu(t))return;const n=eh(N(this,Lt).dataUpdatedAt,t)+1;ee(this,sa,ms.setTimeout(()=>{N(this,Lt).isStale||this.updateResult()},n))},$0=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(N(this,_e)):this.options.refetchInterval)??!1},G0=function(t){Ae(this,Ve,W0).call(this),ee(this,ls,t),!(bs||ur(this.options.enabled,N(this,_e))===!1||!Iu(N(this,ls))||N(this,ls)===0)&&ee(this,aa,ms.setInterval(()=>{(this.options.refetchIntervalInBackground||Uu.isFocused())&&Ae(this,Ve,ic).call(this)},N(this,ls)))},j0=function(){Ae(this,Ve,H0).call(this),Ae(this,Ve,G0).call(this,Ae(this,Ve,$0).call(this))},V0=function(){N(this,sa)&&(ms.clearTimeout(N(this,sa)),ee(this,sa,void 0))},W0=function(){N(this,aa)&&(ms.clearInterval(N(this,aa)),ee(this,aa,void 0))},q0=function(){const t=N(this,Zt).getQueryCache().build(N(this,Zt),this.options);if(t===N(this,_e))return;const r=N(this,_e);ee(this,_e,t),ee(this,nc,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},n2=function(t){gt.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(N(this,Lt))}),N(this,Zt).getQueryCache().notify({query:N(this,_e),type:"observerResultsUpdated"})})},jx);function T2(e,t){return ur(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function ph(e,t){return T2(e,t)||e.state.data!==void 0&&Nu(e,t,t.refetchOnMount)}function Nu(e,t,r){if(ur(t.enabled,e)!==!1&&zn(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&zu(e,t)}return!1}function hh(e,t,r,n){return(e!==t||ur(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&zu(e,r)}function zu(e,t){return ur(t.enabled,e)!==!1&&e.isStaleByTime(zn(t.staleTime,e))}function S2(e,t){return!cc(e.getCurrentResult(),t)}function mh(e){return{onFetch:(t,r)=>{var u,d,p,h,y;const n=t.options,s=(p=(d=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:d.fetchMore)==null?void 0:p.direction,a=((h=t.state.data)==null?void 0:h.pages)||[],o=((y=t.state.data)==null?void 0:y.pageParams)||[];let i={pages:[],pageParams:[]},c=0;const l=async()=>{let g=!1;const k=S=>{Object.defineProperty(S,"signal",{enumerable:!0,get:()=>(t.signal.aborted?g=!0:t.signal.addEventListener("abort",()=>{g=!0}),t.signal)})},v=ah(t.options,t.fetchOptions),w=async(S,C,U)=>{if(g)return Promise.reject();if(C==null&&S.pages.length)return Promise.resolve(S);const T=(()=>{const A={client:t.client,queryKey:t.queryKey,pageParam:C,direction:U?"backward":"forward",meta:t.options.meta};return k(A),A})(),m=await v(T),{maxPages:b}=t.options,x=U?y2:b2;return{pages:x(S.pages,m,b),pageParams:x(S.pageParams,C,b)}};if(s&&a.length){const S=s==="backward",C=S?A2:bh,U={pages:a,pageParams:o},z=C(n,U);i=await w(U,z,S)}else{const S=e??a.length;do{const C=c===0?o[0]??n.initialPageParam:bh(n,i);if(c>0&&C==null)break;i=await w(i,C),c++}while(c<S)}return i};t.options.persister?t.fetchFn=()=>{var g,k;return(k=(g=t.options).persister)==null?void 0:k.call(g,l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=l}}}function bh(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function A2(e,{pages:t,pageParams:r}){var n;return t.length>0?(n=e.getPreviousPageParam)==null?void 0:n.call(e,t[0],t,r[0],r):void 0}var P2=(Vx=class extends lh{constructor(t){super();le(this,sn);le(this,ac);le(this,nn);le(this,Rt);le(this,oa);ee(this,ac,t.client),this.mutationId=t.mutationId,ee(this,Rt,t.mutationCache),ee(this,nn,[]),this.state=t.state||yh(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){N(this,nn).includes(t)||(N(this,nn).push(t),this.clearGcTimeout(),N(this,Rt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){ee(this,nn,N(this,nn).filter(r=>r!==t)),this.scheduleGc(),N(this,Rt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){N(this,nn).length||(this.state.status==="pending"?this.scheduleGc():N(this,Rt).remove(this))}continue(){var t;return((t=N(this,oa))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,i,c,l,u,d,p,h,y,g,k,v,w,S,C,U,z,T,m,b;const r=()=>{Ae(this,sn,hs).call(this,{type:"continue"})},n={client:N(this,ac),meta:this.options.meta,mutationKey:this.options.mutationKey};ee(this,oa,ch({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:(x,A)=>{Ae(this,sn,hs).call(this,{type:"failed",failureCount:x,error:A})},onPause:()=>{Ae(this,sn,hs).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>N(this,Rt).canRun(this)}));const s=this.state.status==="pending",a=!N(this,oa).canStart();try{if(s)r();else{Ae(this,sn,hs).call(this,{type:"pending",variables:t,isPaused:a}),await((i=(o=N(this,Rt).config).onMutate)==null?void 0:i.call(o,t,this,n));const A=await((l=(c=this.options).onMutate)==null?void 0:l.call(c,t,n));A!==this.state.context&&Ae(this,sn,hs).call(this,{type:"pending",context:A,variables:t,isPaused:a})}const x=await N(this,oa).start();return await((d=(u=N(this,Rt).config).onSuccess)==null?void 0:d.call(u,x,t,this.state.context,this,n)),await((h=(p=this.options).onSuccess)==null?void 0:h.call(p,x,t,this.state.context,n)),await((g=(y=N(this,Rt).config).onSettled)==null?void 0:g.call(y,x,null,this.state.variables,this.state.context,this,n)),await((v=(k=this.options).onSettled)==null?void 0:v.call(k,x,null,t,this.state.context,n)),Ae(this,sn,hs).call(this,{type:"success",data:x}),x}catch(x){try{throw await((S=(w=N(this,Rt).config).onError)==null?void 0:S.call(w,x,t,this.state.context,this,n)),await((U=(C=this.options).onError)==null?void 0:U.call(C,x,t,this.state.context,n)),await((T=(z=N(this,Rt).config).onSettled)==null?void 0:T.call(z,void 0,x,this.state.variables,this.state.context,this,n)),await((b=(m=this.options).onSettled)==null?void 0:b.call(m,void 0,x,t,this.state.context,n)),x}finally{Ae(this,sn,hs).call(this,{type:"error",error:x})}}finally{N(this,Rt).runNext(this)}}},ac=new WeakMap,nn=new WeakMap,Rt=new WeakMap,oa=new WeakMap,sn=new WeakSet,hs=function(t){const r=n=>{switch(t.type){case"failed":return{...n,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...n,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:t.error,failureCount:n.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=r(this.state),gt.batch(()=>{N(this,nn).forEach(n=>{n.onMutationUpdate(t)}),N(this,Rt).notify({mutation:this,type:"updated",action:t})})},Vx);function yh(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var I2=(Wx=class extends ca{constructor(t={}){super();le(this,_n);le(this,Hr);le(this,oc);this.config=t,ee(this,_n,new Set),ee(this,Hr,new Map),ee(this,oc,0)}build(t,r,n){const s=new P2({client:t,mutationCache:this,mutationId:++Su(this,oc)._,options:t.defaultMutationOptions(r),state:n});return this.add(s),s}add(t){N(this,_n).add(t);const r=dc(t);if(typeof r=="string"){const n=N(this,Hr).get(r);n?n.push(t):N(this,Hr).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(N(this,_n).delete(t)){const r=dc(t);if(typeof r=="string"){const n=N(this,Hr).get(r);if(n)if(n.length>1){const s=n.indexOf(t);s!==-1&&n.splice(s,1)}else n[0]===t&&N(this,Hr).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=dc(t);if(typeof r=="string"){const n=N(this,Hr).get(r),s=n==null?void 0:n.find(a=>a.state.status==="pending");return!s||s===t}else return!0}runNext(t){var n;const r=dc(t);if(typeof r=="string"){const s=(n=N(this,Hr).get(r))==null?void 0:n.find(a=>a!==t&&a.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){gt.batch(()=>{N(this,_n).forEach(t=>{this.notify({type:"removed",mutation:t})}),N(this,_n).clear(),N(this,Hr).clear()})}getAll(){return Array.from(N(this,_n))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>rh(r,n))}findAll(t={}){return this.getAll().filter(r=>rh(t,r))}notify(t){gt.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return gt.batch(()=>Promise.all(t.map(r=>r.continue().catch(Ft))))}},_n=new WeakMap,Hr=new WeakMap,oc=new WeakMap,Wx);function dc(e){var t;return(t=e.options.scope)==null?void 0:t.id}var O2=(qx=class extends ca{constructor(t,r){super();le(this,Fn);le(this,Un);le(this,us);le(this,Xt);le(this,Dn);ee(this,Un,t),this.setOptions(r),this.bindMethods(),Ae(this,Fn,Au).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var n;const r=this.options;this.options=N(this,Un).defaultMutationOptions(t),cc(this.options,r)||N(this,Un).getMutationCache().notify({type:"observerOptionsUpdated",mutation:N(this,Xt),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&ys(r.mutationKey)!==ys(this.options.mutationKey)?this.reset():((n=N(this,Xt))==null?void 0:n.state.status)==="pending"&&N(this,Xt).setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=N(this,Xt))==null||t.removeObserver(this)}onMutationUpdate(t){Ae(this,Fn,Au).call(this),Ae(this,Fn,Y0).call(this,t)}getCurrentResult(){return N(this,us)}reset(){var t;(t=N(this,Xt))==null||t.removeObserver(this),ee(this,Xt,void 0),Ae(this,Fn,Au).call(this),Ae(this,Fn,Y0).call(this)}mutate(t,r){var n;return ee(this,Dn,r),(n=N(this,Xt))==null||n.removeObserver(this),ee(this,Xt,N(this,Un).getMutationCache().build(N(this,Un),this.options)),N(this,Xt).addObserver(this),N(this,Xt).execute(t)}},Un=new WeakMap,us=new WeakMap,Xt=new WeakMap,Dn=new WeakMap,Fn=new WeakSet,Au=function(){var r;const t=((r=N(this,Xt))==null?void 0:r.state)??yh();ee(this,us,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},Y0=function(t){gt.batch(()=>{var r,n,s,a,o,i,c,l;if(N(this,Dn)&&this.hasListeners()){const u=N(this,us).variables,d=N(this,us).context,p={client:N(this,Un),meta:this.options.meta,mutationKey:this.options.mutationKey};(t==null?void 0:t.type)==="success"?((n=(r=N(this,Dn)).onSuccess)==null||n.call(r,t.data,u,d,p),(a=(s=N(this,Dn)).onSettled)==null||a.call(s,t.data,null,u,d,p)):(t==null?void 0:t.type)==="error"&&((i=(o=N(this,Dn)).onError)==null||i.call(o,t.error,u,d,p),(l=(c=N(this,Dn)).onSettled)==null||l.call(c,void 0,t.error,u,d,p))}this.listeners.forEach(u=>{u(N(this,us))})})},qx),B2=(Yx=class extends ca{constructor(t={}){super();le(this,an);this.config=t,ee(this,an,new Map)}build(t,r,n){const s=r.queryKey,a=r.queryHash??Ou(s,r);let o=this.get(a);return o||(o=new E2({client:t,queryKey:s,queryHash:a,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){N(this,an).has(t.queryHash)||(N(this,an).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=N(this,an).get(t.queryHash);r&&(t.destroy(),r===t&&N(this,an).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){gt.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return N(this,an).get(t)}getAll(){return[...N(this,an).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(n=>th(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>th(t,n)):r}notify(t){gt.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){gt.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){gt.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},an=new WeakMap,Yx),M2=(Kx=class{constructor(e={}){le(this,ut);le(this,ds);le(this,fs);le(this,co);le(this,lo);le(this,ps);le(this,uo);le(this,fo);ee(this,ut,e.queryCache||new B2),ee(this,ds,e.mutationCache||new I2),ee(this,fs,e.defaultOptions||{}),ee(this,co,new Map),ee(this,lo,new Map),ee(this,ps,0)}mount(){Su(this,ps)._++,N(this,ps)===1&&(ee(this,uo,Uu.subscribe(async e=>{e&&(await this.resumePausedMutations(),N(this,ut).onFocus())})),ee(this,fo,uc.subscribe(async e=>{e&&(await this.resumePausedMutations(),N(this,ut).onOnline())})))}unmount(){var e,t;Su(this,ps)._--,N(this,ps)===0&&((e=N(this,uo))==null||e.call(this),ee(this,uo,void 0),(t=N(this,fo))==null||t.call(this),ee(this,fo,void 0))}isFetching(e){return N(this,ut).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return N(this,ds).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=N(this,ut).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=N(this,ut).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(zn(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return N(this,ut).findAll(e).map(({queryKey:t,state:r})=>{const n=r.data;return[t,n]})}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),s=N(this,ut).get(n.queryHash),a=s==null?void 0:s.state.data,o=p2(t,a);if(o!==void 0)return N(this,ut).build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return gt.batch(()=>N(this,ut).findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=N(this,ut).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=N(this,ut);gt.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=N(this,ut);return gt.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=gt.batch(()=>N(this,ut).findAll(e).map(s=>s.cancel(r)));return Promise.all(n).then(Ft).catch(Ft)}invalidateQueries(e,t={}){return gt.batch(()=>(N(this,ut).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},n=gt.batch(()=>N(this,ut).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let a=s.fetch(void 0,r);return r.throwOnError||(a=a.catch(Ft)),s.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(n).then(Ft)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=N(this,ut).build(this,t);return r.isStaleByTime(zn(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ft).catch(Ft)}fetchInfiniteQuery(e){return e.behavior=mh(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ft).catch(Ft)}ensureInfiniteQueryData(e){return e.behavior=mh(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return uc.isOnline()?N(this,ds).resumePausedMutations():Promise.resolve()}getQueryCache(){return N(this,ut)}getMutationCache(){return N(this,ds)}getDefaultOptions(){return N(this,fs)}setDefaultOptions(e){ee(this,fs,e)}setQueryDefaults(e,t){N(this,co).set(ys(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...N(this,co).values()],r={};return t.forEach(n=>{ho(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){N(this,lo).set(ys(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...N(this,lo).values()],r={};return t.forEach(n=>{ho(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...N(this,fs).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Ou(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===lc&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...N(this,fs).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){N(this,ut).clear(),N(this,ds).clear()}},ut=new WeakMap,ds=new WeakMap,fs=new WeakMap,co=new WeakMap,lo=new WeakMap,ps=new WeakMap,uo=new WeakMap,fo=new WeakMap,Kx),gh=mt.createContext(void 0),mo=e=>{const t=mt.useContext(gh);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},_2=({client:e,children:t})=>(mt.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),B.jsx(gh.Provider,{value:e,children:t})),xh=mt.createContext(!1),U2=()=>mt.useContext(xh);xh.Provider;function D2(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var F2=mt.createContext(D2()),N2=()=>mt.useContext(F2),z2=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},L2=e=>{mt.useEffect(()=>{e.clearReset()},[e])},R2=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(s&&e.data===void 0||oh(r,[e.error,n])),H2=e=>{if(e.suspense){const r=s=>s==="static"?s:Math.max(s??1e3,1e3),n=e.staleTime;e.staleTime=typeof n=="function"?(...s)=>r(n(...s)):r(n),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},$2=(e,t)=>e.isLoading&&e.isFetching&&!t,G2=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,wh=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function j2(e,t,r){var d,p,h,y,g;if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const n=U2(),s=N2(),a=mo(),o=a.defaultQueryOptions(e);(p=(d=a.getDefaultOptions().queries)==null?void 0:d._experimental_beforeQuery)==null||p.call(d,o),process.env.NODE_ENV!=="production"&&(o.queryFn||console.error(`[${o.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),o._optimisticResults=n?"isRestoring":"optimistic",H2(o),z2(o,s),L2(s);const i=!a.getQueryCache().get(o.queryHash),[c]=mt.useState(()=>new t(a,o)),l=c.getOptimisticResult(o),u=!n&&e.subscribed!==!1;if(mt.useSyncExternalStore(mt.useCallback(k=>{const v=u?c.subscribe(gt.batchCalls(k)):Ft;return c.updateResult(),v},[c,u]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),mt.useEffect(()=>{c.setOptions(o)},[o,c]),G2(o,l))throw wh(o,c,s);if(R2({result:l,errorResetBoundary:s,throwOnError:o.throwOnError,query:a.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw l.error;if((y=(h=a.getDefaultOptions().queries)==null?void 0:h._experimental_afterQuery)==null||y.call(h,o,l),o.experimental_prefetchInRender&&!bs&&$2(l,n)){const k=i?wh(o,c,s):(g=a.getQueryCache().get(o.queryHash))==null?void 0:g.promise;k==null||k.catch(Ft).finally(()=>{c.updateResult()})}return o.notifyOnChangeProps?l:c.trackResult(l)}function V2(e,t){return j2(e,C2)}function on(e,t){const r=mo(),[n]=mt.useState(()=>new O2(r,e));mt.useEffect(()=>{n.setOptions(e)},[n,e]);const s=mt.useSyncExternalStore(mt.useCallback(o=>n.subscribe(gt.batchCalls(o)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),a=mt.useCallback((o,i)=>{n.mutate(o,i).catch(Ft)},[n]);if(s.error&&oh(n.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:a,mutateAsync:s.mutate}}const W2="1.2.3";let Ht=class K0 extends Error{constructor(t,r={}){var o;const n=r.cause instanceof K0?r.cause.details:(o=r.cause)!=null&&o.message?r.cause.message:r.details,s=r.cause instanceof K0&&r.cause.docsPath||r.docsPath,a=[t||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...s?[`Docs: https://abitype.dev${s}`]:[],...n?[`Details: ${n}`]:[],`Version: abitype@${W2}`].join(`
1
+ (function(Z,F){typeof exports=="object"&&typeof module<"u"?F(exports,require("react"),require("@orbs-network/spot-ui"),require("react/jsx-runtime"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","@orbs-network/spot-ui","react/jsx-runtime","react-dom"],F):(Z=typeof globalThis<"u"?globalThis:Z||self,F(Z.SpotReact={},Z.React,Z.SpotSDK,Z.jsxRuntime,Z.ReactDOM))})(this,(function(Z,F,R,B,Pu){"use strict";var r2=Z=>{throw TypeError(Z)};var R0=(Z,F,R)=>F.has(Z)||r2("Cannot "+R);var N=(Z,F,R)=>(R0(Z,F,"read from private field"),R?R.call(Z):F.get(Z)),le=(Z,F,R)=>F.has(Z)?r2("Cannot add the same private member more than once"):F instanceof WeakSet?F.add(Z):F.set(Z,R),ee=(Z,F,R,B)=>(R0(Z,F,"write to private field"),B?B.call(Z,R):F.set(Z,R),R),Ae=(Z,F,R)=>(R0(Z,F,"access private method"),R);var Su=(Z,F,R,B)=>({set _(Pu){ee(Z,F,Pu,R)},get _(){return N(Z,F,B)}});var rn,Xs,Lx,Qs,os,eo,Rx,to,is,ro,Hx,Js,$x,ea,no,vr,ta,St,rc,ra,Rr,Nn,Gx,Zt,_e,nc,Lt,na,so,Mn,cs,sc,ao,oo,sa,aa,ls,io,Ve,ic,H0,$0,G0,j0,V0,W0,q0,n2,jx,ac,nn,Rt,oa,sn,hs,Vx,_n,Hr,oc,Wx,Un,us,Xt,Dn,Fn,Au,Y0,qx,an,Yx,ut,ds,fs,co,lo,ps,uo,fo,Kx;function s2(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const mt=s2(F),X0=e=>{let t;const r=new Set,n=(l,u)=>{const d=typeof l=="function"?l(t):l;if(!Object.is(d,t)){const p=t;t=u??(typeof d!="object"||d===null)?d:Object.assign({},t,d),r.forEach(h=>h(t,p))}},s=()=>t,i={setState:n,getState:s,getInitialState:()=>c,subscribe:l=>(r.add(l),()=>r.delete(l))},c=t=e(n,s,i);return i},a2=(e=>e?X0(e):X0),o2=e=>e;function i2(e,t=o2){const r=F.useSyncExternalStore(e.subscribe,F.useCallback(()=>t(e.getState()),[e,t]),F.useCallback(()=>t(e.getInitialState()),[e,t]));return F.useDebugValue(r),r}const Q0=e=>{const t=a2(e),r=n=>i2(t,n);return Object.assign(r,t),r},c2=(e=>e?Q0(e):Q0),J0={disclaimerAccepted:!0,currentTime:Date.now(),swapExecution:{}},K=c2((e,t)=>({state:J0,updateState:r=>e(n=>({state:{...n.state,...r}})),updateSwapExecution:r=>e(n=>({state:{...n.state,swapExecution:{...n.state.swapExecution,...r}}})),resetState:()=>{e({state:{...J0,currentTime:Date.now(),swapExecution:t().state.swapExecution,isMarketOrder:t().state.isMarketOrder}})}})),l2={version:"0.0.9"};var ca=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},u2={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},d2=(Lx=class{constructor(){le(this,rn,u2);le(this,Xs,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&N(this,Xs)&&e!==N(this,rn)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:N(this,rn),provider:e}),ee(this,rn,e),process.env.NODE_ENV!=="production"&&ee(this,Xs,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&ee(this,Xs,!0),N(this,rn).setTimeout(e,t)}clearTimeout(e){N(this,rn).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&ee(this,Xs,!0),N(this,rn).setInterval(e,t)}clearInterval(e){N(this,rn).clearInterval(e)}},rn=new WeakMap,Xs=new WeakMap,Lx),ms=new d2;function f2(e){setTimeout(e,0)}var bs=typeof window>"u"||"Deno"in globalThis;function Ft(){}function p2(e,t){return typeof e=="function"?e(t):e}function Iu(e){return typeof e=="number"&&e>=0&&e!==1/0}function eh(e,t){return Math.max(e+(t||0)-Date.now(),0)}function zn(e,t){return typeof e=="function"?e(t):e}function ur(e,t){return typeof e=="function"?e(t):e}function th(e,t){const{type:r="all",exact:n,fetchStatus:s,predicate:a,queryKey:o,stale:i}=e;if(o){if(n){if(t.queryHash!==Ou(o,t.options))return!1}else if(!ho(t.queryKey,o))return!1}if(r!=="all"){const c=t.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof i=="boolean"&&t.isStale()!==i||s&&s!==t.state.fetchStatus||a&&!a(t))}function rh(e,t){const{exact:r,status:n,predicate:s,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(r){if(ys(t.options.mutationKey)!==ys(a))return!1}else if(!ho(t.options.mutationKey,a))return!1}return!(n&&t.state.status!==n||s&&!s(t))}function Ou(e,t){return((t==null?void 0:t.queryKeyHashFn)||ys)(e)}function ys(e){return JSON.stringify(e,(t,r)=>Mu(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function ho(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>ho(e[r],t[r])):!1}var h2=Object.prototype.hasOwnProperty;function Bu(e,t){if(e===t)return e;const r=nh(e)&&nh(t);if(!r&&!(Mu(e)&&Mu(t)))return t;const s=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,i=r?new Array(o):{};let c=0;for(let l=0;l<o;l++){const u=r?l:a[l],d=e[u],p=t[u];if(d===p){i[u]=d,(r?l<s:h2.call(e,u))&&c++;continue}if(d===null||p===null||typeof d!="object"||typeof p!="object"){i[u]=p;continue}const h=Bu(d,p);i[u]=h,h===d&&c++}return s===o&&c===s?e:i}function cc(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function nh(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Mu(e){if(!sh(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!sh(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function sh(e){return Object.prototype.toString.call(e)==="[object Object]"}function m2(e){return new Promise(t=>{ms.setTimeout(t,e)})}function _u(e,t,r){if(typeof r.structuralSharing=="function")return r.structuralSharing(e,t);if(r.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return Bu(e,t)}catch(n){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${n}`),n}return Bu(e,t)}return t}function b2(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function y2(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var lc=Symbol();function ah(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===lc&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===lc?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function oh(e,t){return typeof e=="function"?e(...t):!!e}var g2=(Rx=class extends ca{constructor(){super();le(this,Qs);le(this,os);le(this,eo);ee(this,eo,t=>{if(!bs&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){N(this,os)||this.setEventListener(N(this,eo))}onUnsubscribe(){var t;this.hasListeners()||((t=N(this,os))==null||t.call(this),ee(this,os,void 0))}setEventListener(t){var r;ee(this,eo,t),(r=N(this,os))==null||r.call(this),ee(this,os,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){N(this,Qs)!==t&&(ee(this,Qs,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof N(this,Qs)=="boolean"?N(this,Qs):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Qs=new WeakMap,os=new WeakMap,eo=new WeakMap,Rx),Uu=new g2;function Du(){let e,t;const r=new Promise((s,a)=>{e=s,t=a});r.status="pending",r.catch(()=>{});function n(s){Object.assign(r,s),delete r.resolve,delete r.reject}return r.resolve=s=>{n({status:"fulfilled",value:s}),e(s)},r.reject=s=>{n({status:"rejected",reason:s}),t(s)},r}var x2=f2;function w2(){let e=[],t=0,r=i=>{i()},n=i=>{i()},s=x2;const a=i=>{t?e.push(i):s(()=>{r(i)})},o=()=>{const i=e;e=[],i.length&&s(()=>{n(()=>{i.forEach(c=>{r(c)})})})};return{batch:i=>{let c;t++;try{c=i()}finally{t--,t||o()}return c},batchCalls:i=>(...c)=>{a(()=>{i(...c)})},schedule:a,setNotifyFunction:i=>{r=i},setBatchNotifyFunction:i=>{n=i},setScheduler:i=>{s=i}}}var gt=w2(),v2=(Hx=class extends ca{constructor(){super();le(this,to,!0);le(this,is);le(this,ro);ee(this,ro,t=>{if(!bs&&window.addEventListener){const r=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n)}}})}onSubscribe(){N(this,is)||this.setEventListener(N(this,ro))}onUnsubscribe(){var t;this.hasListeners()||((t=N(this,is))==null||t.call(this),ee(this,is,void 0))}setEventListener(t){var r;ee(this,ro,t),(r=N(this,is))==null||r.call(this),ee(this,is,t(this.setOnline.bind(this)))}setOnline(t){N(this,to)!==t&&(ee(this,to,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return N(this,to)}},to=new WeakMap,is=new WeakMap,ro=new WeakMap,Hx),uc=new v2;function k2(e){return Math.min(1e3*2**e,3e4)}function ih(e){return(e??"online")==="online"?uc.isOnline():!0}var Fu=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function ch(e){let t=!1,r=0,n;const s=Du(),a=()=>s.status!=="pending",o=g=>{var k;if(!a()){const v=new Fu(g);p(v),(k=e.onCancel)==null||k.call(e,v)}},i=()=>{t=!0},c=()=>{t=!1},l=()=>Uu.isFocused()&&(e.networkMode==="always"||uc.isOnline())&&e.canRun(),u=()=>ih(e.networkMode)&&e.canRun(),d=g=>{a()||(n==null||n(),s.resolve(g))},p=g=>{a()||(n==null||n(),s.reject(g))},h=()=>new Promise(g=>{var k;n=v=>{(a()||l())&&g(v)},(k=e.onPause)==null||k.call(e)}).then(()=>{var g;n=void 0,a()||(g=e.onContinue)==null||g.call(e)}),y=()=>{if(a())return;let g;const k=r===0?e.initialPromise:void 0;try{g=k??e.fn()}catch(v){g=Promise.reject(v)}Promise.resolve(g).then(d).catch(v=>{var z;if(a())return;const w=e.retry??(bs?0:3),S=e.retryDelay??k2,C=typeof S=="function"?S(r,v):S,U=w===!0||typeof w=="number"&&r<w||typeof w=="function"&&w(r,v);if(t||!U){p(v);return}r++,(z=e.onFail)==null||z.call(e,r,v),m2(C).then(()=>l()?void 0:h()).then(()=>{t?p(v):y()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(n==null||n(),s),cancelRetry:i,continueRetry:c,canStart:u,start:()=>(u()?y():h().then(y),s)}}var lh=($x=class{constructor(){le(this,Js)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Iu(this.gcTime)&&ee(this,Js,ms.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(bs?1/0:300*1e3))}clearGcTimeout(){N(this,Js)&&(ms.clearTimeout(N(this,Js)),ee(this,Js,void 0))}},Js=new WeakMap,$x),E2=(Gx=class extends lh{constructor(t){super();le(this,Rr);le(this,ea);le(this,no);le(this,vr);le(this,ta);le(this,St);le(this,rc);le(this,ra);ee(this,ra,!1),ee(this,rc,t.defaultOptions),this.setOptions(t.options),this.observers=[],ee(this,ta,t.client),ee(this,vr,N(this,ta).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,ee(this,ea,fh(this.options)),this.state=t.state??N(this,ea),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=N(this,St))==null?void 0:t.promise}setOptions(t){if(this.options={...N(this,rc),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=fh(this.options);r.data!==void 0&&(this.setState(dh(r.data,r.dataUpdatedAt)),ee(this,ea,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&N(this,vr).remove(this)}setData(t,r){const n=_u(this.state.data,t,this.options);return Ae(this,Rr,Nn).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(t,r){Ae(this,Rr,Nn).call(this,{type:"setState",state:t,setStateOptions:r})}cancel(t){var n,s;const r=(n=N(this,St))==null?void 0:n.promise;return(s=N(this,St))==null||s.cancel(t),r?r.then(Ft).catch(Ft):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(N(this,ea))}isActive(){return this.observers.some(t=>ur(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===lc||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>zn(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!eh(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=N(this,St))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=N(this,St))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),N(this,vr).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(N(this,St)&&(N(this,ra)?N(this,St).cancel({revert:!0}):N(this,St).cancelRetry()),this.scheduleGc()),N(this,vr).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ae(this,Rr,Nn).call(this,{type:"invalidate"})}async fetch(t,r){var c,l,u,d,p,h,y,g,k,v,w,S;if(this.state.fetchStatus!=="idle"&&((c=N(this,St))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(N(this,St))return N(this,St).continueRetry(),N(this,St).promise}if(t&&this.setOptions(t),!this.options.queryFn){const C=this.observers.find(U=>U.options.queryFn);C&&this.setOptions(C.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const n=new AbortController,s=C=>{Object.defineProperty(C,"signal",{enumerable:!0,get:()=>(ee(this,ra,!0),n.signal)})},a=()=>{const C=ah(this.options,r),z=(()=>{const T={client:N(this,ta),queryKey:this.queryKey,meta:this.meta};return s(T),T})();return ee(this,ra,!1),this.options.persister?this.options.persister(C,z,this):C(z)},i=(()=>{const C={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:N(this,ta),state:this.state,fetchFn:a};return s(C),C})();(l=this.options.behavior)==null||l.onFetch(i,this),ee(this,no,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=i.fetchOptions)==null?void 0:u.meta))&&Ae(this,Rr,Nn).call(this,{type:"fetch",meta:(d=i.fetchOptions)==null?void 0:d.meta}),ee(this,St,ch({initialPromise:r==null?void 0:r.initialPromise,fn:i.fetchFn,onCancel:C=>{C instanceof Fu&&C.revert&&this.setState({...N(this,no),fetchStatus:"idle"}),n.abort()},onFail:(C,U)=>{Ae(this,Rr,Nn).call(this,{type:"failed",failureCount:C,error:U})},onPause:()=>{Ae(this,Rr,Nn).call(this,{type:"pause"})},onContinue:()=>{Ae(this,Rr,Nn).call(this,{type:"continue"})},retry:i.options.retry,retryDelay:i.options.retryDelay,networkMode:i.options.networkMode,canRun:()=>!0}));try{const C=await N(this,St).start();if(C===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(C),(h=(p=N(this,vr).config).onSuccess)==null||h.call(p,C,this),(g=(y=N(this,vr).config).onSettled)==null||g.call(y,C,this.state.error,this),C}catch(C){if(C instanceof Fu){if(C.silent)return N(this,St).promise;if(C.revert){if(this.state.data===void 0)throw C;return this.state.data}}throw Ae(this,Rr,Nn).call(this,{type:"error",error:C}),(v=(k=N(this,vr).config).onError)==null||v.call(k,C,this),(S=(w=N(this,vr).config).onSettled)==null||S.call(w,this.state.data,C,this),C}finally{this.scheduleGc()}}},ea=new WeakMap,no=new WeakMap,vr=new WeakMap,ta=new WeakMap,St=new WeakMap,rc=new WeakMap,ra=new WeakMap,Rr=new WeakSet,Nn=function(t){const r=n=>{switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...uh(n.data,this.options),fetchMeta:t.meta??null};case"success":const s={...n,...dh(t.data,t.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return ee(this,no,t.manual?s:void 0),s;case"error":const a=t.error;return{...n,error:a,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=r(this.state),gt.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),N(this,vr).notify({query:this,type:"updated",action:t})})},Gx);function uh(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ih(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function dh(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function fh(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,n=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var C2=(jx=class extends ca{constructor(t,r){super();le(this,Ve);le(this,Zt);le(this,_e);le(this,nc);le(this,Lt);le(this,na);le(this,so);le(this,Mn);le(this,cs);le(this,sc);le(this,ao);le(this,oo);le(this,sa);le(this,aa);le(this,ls);le(this,io,new Set);this.options=r,ee(this,Zt,t),ee(this,cs,null),ee(this,Mn,Du()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(N(this,_e).addObserver(this),ph(N(this,_e),this.options)?Ae(this,Ve,ic).call(this):this.updateResult(),Ae(this,Ve,j0).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Nu(N(this,_e),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Nu(N(this,_e),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ae(this,Ve,V0).call(this),Ae(this,Ve,W0).call(this),N(this,_e).removeObserver(this)}setOptions(t){const r=this.options,n=N(this,_e);if(this.options=N(this,Zt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ur(this.options.enabled,N(this,_e))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ae(this,Ve,q0).call(this),N(this,_e).setOptions(this.options),r._defaulted&&!cc(this.options,r)&&N(this,Zt).getQueryCache().notify({type:"observerOptionsUpdated",query:N(this,_e),observer:this});const s=this.hasListeners();s&&hh(N(this,_e),n,this.options,r)&&Ae(this,Ve,ic).call(this),this.updateResult(),s&&(N(this,_e)!==n||ur(this.options.enabled,N(this,_e))!==ur(r.enabled,N(this,_e))||zn(this.options.staleTime,N(this,_e))!==zn(r.staleTime,N(this,_e)))&&Ae(this,Ve,H0).call(this);const a=Ae(this,Ve,$0).call(this);s&&(N(this,_e)!==n||ur(this.options.enabled,N(this,_e))!==ur(r.enabled,N(this,_e))||a!==N(this,ls))&&Ae(this,Ve,G0).call(this,a)}getOptimisticResult(t){const r=N(this,Zt).getQueryCache().build(N(this,Zt),t),n=this.createResult(r,t);return S2(this,n)&&(ee(this,Lt,n),ee(this,so,this.options),ee(this,na,N(this,_e).state)),n}getCurrentResult(){return N(this,Lt)}trackResult(t,r){return new Proxy(t,{get:(n,s)=>(this.trackProp(s),r==null||r(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&N(this,Mn).status==="pending"&&N(this,Mn).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,s))})}trackProp(t){N(this,io).add(t)}getCurrentQuery(){return N(this,_e)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=N(this,Zt).defaultQueryOptions(t),n=N(this,Zt).getQueryCache().build(N(this,Zt),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(t){return Ae(this,Ve,ic).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),N(this,Lt)))}createResult(t,r){var b;const n=N(this,_e),s=this.options,a=N(this,Lt),o=N(this,na),i=N(this,so),l=t!==n?t.state:N(this,nc),{state:u}=t;let d={...u},p=!1,h;if(r._optimisticResults){const x=this.hasListeners(),A=!x&&ph(t,r),I=x&&hh(t,n,r,s);(A||I)&&(d={...d,...uh(u.data,t.options)}),r._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:y,errorUpdatedAt:g,status:k}=d;h=d.data;let v=!1;if(r.placeholderData!==void 0&&h===void 0&&k==="pending"){let x;a!=null&&a.isPlaceholderData&&r.placeholderData===(i==null?void 0:i.placeholderData)?(x=a.data,v=!0):x=typeof r.placeholderData=="function"?r.placeholderData((b=N(this,oo))==null?void 0:b.state.data,N(this,oo)):r.placeholderData,x!==void 0&&(k="success",h=_u(a==null?void 0:a.data,x,r),p=!0)}if(r.select&&h!==void 0&&!v)if(a&&h===(o==null?void 0:o.data)&&r.select===N(this,sc))h=N(this,ao);else try{ee(this,sc,r.select),h=r.select(h),h=_u(a==null?void 0:a.data,h,r),ee(this,ao,h),ee(this,cs,null)}catch(x){ee(this,cs,x)}N(this,cs)&&(y=N(this,cs),h=N(this,ao),g=Date.now(),k="error");const w=d.fetchStatus==="fetching",S=k==="pending",C=k==="error",U=S&&w,z=h!==void 0,m={status:k,fetchStatus:d.fetchStatus,isPending:S,isSuccess:k==="success",isError:C,isInitialLoading:U,isLoading:U,data:h,dataUpdatedAt:d.dataUpdatedAt,error:y,errorUpdatedAt:g,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>l.dataUpdateCount||d.errorUpdateCount>l.errorUpdateCount,isFetching:w,isRefetching:w&&!S,isLoadingError:C&&!z,isPaused:d.fetchStatus==="paused",isPlaceholderData:p,isRefetchError:C&&z,isStale:zu(t,r),refetch:this.refetch,promise:N(this,Mn),isEnabled:ur(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const x=O=>{m.status==="error"?O.reject(m.error):m.data!==void 0&&O.resolve(m.data)},A=()=>{const O=ee(this,Mn,m.promise=Du());x(O)},I=N(this,Mn);switch(I.status){case"pending":t.queryHash===n.queryHash&&x(I);break;case"fulfilled":(m.status==="error"||m.data!==I.value)&&A();break;case"rejected":(m.status!=="error"||m.error!==I.reason)&&A();break}}return m}updateResult(){const t=N(this,Lt),r=this.createResult(N(this,_e),this.options);if(ee(this,na,N(this,_e).state),ee(this,so,this.options),N(this,na).data!==void 0&&ee(this,oo,N(this,_e)),cc(r,t))return;ee(this,Lt,r);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!N(this,io).size)return!0;const o=new Set(a??N(this,io));return this.options.throwOnError&&o.add("error"),Object.keys(N(this,Lt)).some(i=>{const c=i;return N(this,Lt)[c]!==t[c]&&o.has(c)})};Ae(this,Ve,n2).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ae(this,Ve,j0).call(this)}},Zt=new WeakMap,_e=new WeakMap,nc=new WeakMap,Lt=new WeakMap,na=new WeakMap,so=new WeakMap,Mn=new WeakMap,cs=new WeakMap,sc=new WeakMap,ao=new WeakMap,oo=new WeakMap,sa=new WeakMap,aa=new WeakMap,ls=new WeakMap,io=new WeakMap,Ve=new WeakSet,ic=function(t){Ae(this,Ve,q0).call(this);let r=N(this,_e).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(Ft)),r},H0=function(){Ae(this,Ve,V0).call(this);const t=zn(this.options.staleTime,N(this,_e));if(bs||N(this,Lt).isStale||!Iu(t))return;const n=eh(N(this,Lt).dataUpdatedAt,t)+1;ee(this,sa,ms.setTimeout(()=>{N(this,Lt).isStale||this.updateResult()},n))},$0=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(N(this,_e)):this.options.refetchInterval)??!1},G0=function(t){Ae(this,Ve,W0).call(this),ee(this,ls,t),!(bs||ur(this.options.enabled,N(this,_e))===!1||!Iu(N(this,ls))||N(this,ls)===0)&&ee(this,aa,ms.setInterval(()=>{(this.options.refetchIntervalInBackground||Uu.isFocused())&&Ae(this,Ve,ic).call(this)},N(this,ls)))},j0=function(){Ae(this,Ve,H0).call(this),Ae(this,Ve,G0).call(this,Ae(this,Ve,$0).call(this))},V0=function(){N(this,sa)&&(ms.clearTimeout(N(this,sa)),ee(this,sa,void 0))},W0=function(){N(this,aa)&&(ms.clearInterval(N(this,aa)),ee(this,aa,void 0))},q0=function(){const t=N(this,Zt).getQueryCache().build(N(this,Zt),this.options);if(t===N(this,_e))return;const r=N(this,_e);ee(this,_e,t),ee(this,nc,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},n2=function(t){gt.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(N(this,Lt))}),N(this,Zt).getQueryCache().notify({query:N(this,_e),type:"observerResultsUpdated"})})},jx);function T2(e,t){return ur(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function ph(e,t){return T2(e,t)||e.state.data!==void 0&&Nu(e,t,t.refetchOnMount)}function Nu(e,t,r){if(ur(t.enabled,e)!==!1&&zn(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&zu(e,t)}return!1}function hh(e,t,r,n){return(e!==t||ur(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&zu(e,r)}function zu(e,t){return ur(t.enabled,e)!==!1&&e.isStaleByTime(zn(t.staleTime,e))}function S2(e,t){return!cc(e.getCurrentResult(),t)}function mh(e){return{onFetch:(t,r)=>{var u,d,p,h,y;const n=t.options,s=(p=(d=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:d.fetchMore)==null?void 0:p.direction,a=((h=t.state.data)==null?void 0:h.pages)||[],o=((y=t.state.data)==null?void 0:y.pageParams)||[];let i={pages:[],pageParams:[]},c=0;const l=async()=>{let g=!1;const k=S=>{Object.defineProperty(S,"signal",{enumerable:!0,get:()=>(t.signal.aborted?g=!0:t.signal.addEventListener("abort",()=>{g=!0}),t.signal)})},v=ah(t.options,t.fetchOptions),w=async(S,C,U)=>{if(g)return Promise.reject();if(C==null&&S.pages.length)return Promise.resolve(S);const T=(()=>{const A={client:t.client,queryKey:t.queryKey,pageParam:C,direction:U?"backward":"forward",meta:t.options.meta};return k(A),A})(),m=await v(T),{maxPages:b}=t.options,x=U?y2:b2;return{pages:x(S.pages,m,b),pageParams:x(S.pageParams,C,b)}};if(s&&a.length){const S=s==="backward",C=S?A2:bh,U={pages:a,pageParams:o},z=C(n,U);i=await w(U,z,S)}else{const S=e??a.length;do{const C=c===0?o[0]??n.initialPageParam:bh(n,i);if(c>0&&C==null)break;i=await w(i,C),c++}while(c<S)}return i};t.options.persister?t.fetchFn=()=>{var g,k;return(k=(g=t.options).persister)==null?void 0:k.call(g,l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=l}}}function bh(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function A2(e,{pages:t,pageParams:r}){var n;return t.length>0?(n=e.getPreviousPageParam)==null?void 0:n.call(e,t[0],t,r[0],r):void 0}var P2=(Vx=class extends lh{constructor(t){super();le(this,sn);le(this,ac);le(this,nn);le(this,Rt);le(this,oa);ee(this,ac,t.client),this.mutationId=t.mutationId,ee(this,Rt,t.mutationCache),ee(this,nn,[]),this.state=t.state||yh(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){N(this,nn).includes(t)||(N(this,nn).push(t),this.clearGcTimeout(),N(this,Rt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){ee(this,nn,N(this,nn).filter(r=>r!==t)),this.scheduleGc(),N(this,Rt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){N(this,nn).length||(this.state.status==="pending"?this.scheduleGc():N(this,Rt).remove(this))}continue(){var t;return((t=N(this,oa))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,i,c,l,u,d,p,h,y,g,k,v,w,S,C,U,z,T,m,b;const r=()=>{Ae(this,sn,hs).call(this,{type:"continue"})},n={client:N(this,ac),meta:this.options.meta,mutationKey:this.options.mutationKey};ee(this,oa,ch({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:(x,A)=>{Ae(this,sn,hs).call(this,{type:"failed",failureCount:x,error:A})},onPause:()=>{Ae(this,sn,hs).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>N(this,Rt).canRun(this)}));const s=this.state.status==="pending",a=!N(this,oa).canStart();try{if(s)r();else{Ae(this,sn,hs).call(this,{type:"pending",variables:t,isPaused:a}),await((i=(o=N(this,Rt).config).onMutate)==null?void 0:i.call(o,t,this,n));const A=await((l=(c=this.options).onMutate)==null?void 0:l.call(c,t,n));A!==this.state.context&&Ae(this,sn,hs).call(this,{type:"pending",context:A,variables:t,isPaused:a})}const x=await N(this,oa).start();return await((d=(u=N(this,Rt).config).onSuccess)==null?void 0:d.call(u,x,t,this.state.context,this,n)),await((h=(p=this.options).onSuccess)==null?void 0:h.call(p,x,t,this.state.context,n)),await((g=(y=N(this,Rt).config).onSettled)==null?void 0:g.call(y,x,null,this.state.variables,this.state.context,this,n)),await((v=(k=this.options).onSettled)==null?void 0:v.call(k,x,null,t,this.state.context,n)),Ae(this,sn,hs).call(this,{type:"success",data:x}),x}catch(x){try{throw await((S=(w=N(this,Rt).config).onError)==null?void 0:S.call(w,x,t,this.state.context,this,n)),await((U=(C=this.options).onError)==null?void 0:U.call(C,x,t,this.state.context,n)),await((T=(z=N(this,Rt).config).onSettled)==null?void 0:T.call(z,void 0,x,this.state.variables,this.state.context,this,n)),await((b=(m=this.options).onSettled)==null?void 0:b.call(m,void 0,x,t,this.state.context,n)),x}finally{Ae(this,sn,hs).call(this,{type:"error",error:x})}}finally{N(this,Rt).runNext(this)}}},ac=new WeakMap,nn=new WeakMap,Rt=new WeakMap,oa=new WeakMap,sn=new WeakSet,hs=function(t){const r=n=>{switch(t.type){case"failed":return{...n,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...n,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:t.error,failureCount:n.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=r(this.state),gt.batch(()=>{N(this,nn).forEach(n=>{n.onMutationUpdate(t)}),N(this,Rt).notify({mutation:this,type:"updated",action:t})})},Vx);function yh(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var I2=(Wx=class extends ca{constructor(t={}){super();le(this,_n);le(this,Hr);le(this,oc);this.config=t,ee(this,_n,new Set),ee(this,Hr,new Map),ee(this,oc,0)}build(t,r,n){const s=new P2({client:t,mutationCache:this,mutationId:++Su(this,oc)._,options:t.defaultMutationOptions(r),state:n});return this.add(s),s}add(t){N(this,_n).add(t);const r=dc(t);if(typeof r=="string"){const n=N(this,Hr).get(r);n?n.push(t):N(this,Hr).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(N(this,_n).delete(t)){const r=dc(t);if(typeof r=="string"){const n=N(this,Hr).get(r);if(n)if(n.length>1){const s=n.indexOf(t);s!==-1&&n.splice(s,1)}else n[0]===t&&N(this,Hr).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=dc(t);if(typeof r=="string"){const n=N(this,Hr).get(r),s=n==null?void 0:n.find(a=>a.state.status==="pending");return!s||s===t}else return!0}runNext(t){var n;const r=dc(t);if(typeof r=="string"){const s=(n=N(this,Hr).get(r))==null?void 0:n.find(a=>a!==t&&a.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){gt.batch(()=>{N(this,_n).forEach(t=>{this.notify({type:"removed",mutation:t})}),N(this,_n).clear(),N(this,Hr).clear()})}getAll(){return Array.from(N(this,_n))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>rh(r,n))}findAll(t={}){return this.getAll().filter(r=>rh(t,r))}notify(t){gt.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return gt.batch(()=>Promise.all(t.map(r=>r.continue().catch(Ft))))}},_n=new WeakMap,Hr=new WeakMap,oc=new WeakMap,Wx);function dc(e){var t;return(t=e.options.scope)==null?void 0:t.id}var O2=(qx=class extends ca{constructor(t,r){super();le(this,Fn);le(this,Un);le(this,us);le(this,Xt);le(this,Dn);ee(this,Un,t),this.setOptions(r),this.bindMethods(),Ae(this,Fn,Au).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var n;const r=this.options;this.options=N(this,Un).defaultMutationOptions(t),cc(this.options,r)||N(this,Un).getMutationCache().notify({type:"observerOptionsUpdated",mutation:N(this,Xt),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&ys(r.mutationKey)!==ys(this.options.mutationKey)?this.reset():((n=N(this,Xt))==null?void 0:n.state.status)==="pending"&&N(this,Xt).setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=N(this,Xt))==null||t.removeObserver(this)}onMutationUpdate(t){Ae(this,Fn,Au).call(this),Ae(this,Fn,Y0).call(this,t)}getCurrentResult(){return N(this,us)}reset(){var t;(t=N(this,Xt))==null||t.removeObserver(this),ee(this,Xt,void 0),Ae(this,Fn,Au).call(this),Ae(this,Fn,Y0).call(this)}mutate(t,r){var n;return ee(this,Dn,r),(n=N(this,Xt))==null||n.removeObserver(this),ee(this,Xt,N(this,Un).getMutationCache().build(N(this,Un),this.options)),N(this,Xt).addObserver(this),N(this,Xt).execute(t)}},Un=new WeakMap,us=new WeakMap,Xt=new WeakMap,Dn=new WeakMap,Fn=new WeakSet,Au=function(){var r;const t=((r=N(this,Xt))==null?void 0:r.state)??yh();ee(this,us,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},Y0=function(t){gt.batch(()=>{var r,n,s,a,o,i,c,l;if(N(this,Dn)&&this.hasListeners()){const u=N(this,us).variables,d=N(this,us).context,p={client:N(this,Un),meta:this.options.meta,mutationKey:this.options.mutationKey};(t==null?void 0:t.type)==="success"?((n=(r=N(this,Dn)).onSuccess)==null||n.call(r,t.data,u,d,p),(a=(s=N(this,Dn)).onSettled)==null||a.call(s,t.data,null,u,d,p)):(t==null?void 0:t.type)==="error"&&((i=(o=N(this,Dn)).onError)==null||i.call(o,t.error,u,d,p),(l=(c=N(this,Dn)).onSettled)==null||l.call(c,void 0,t.error,u,d,p))}this.listeners.forEach(u=>{u(N(this,us))})})},qx),B2=(Yx=class extends ca{constructor(t={}){super();le(this,an);this.config=t,ee(this,an,new Map)}build(t,r,n){const s=r.queryKey,a=r.queryHash??Ou(s,r);let o=this.get(a);return o||(o=new E2({client:t,queryKey:s,queryHash:a,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){N(this,an).has(t.queryHash)||(N(this,an).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=N(this,an).get(t.queryHash);r&&(t.destroy(),r===t&&N(this,an).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){gt.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return N(this,an).get(t)}getAll(){return[...N(this,an).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(n=>th(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>th(t,n)):r}notify(t){gt.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){gt.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){gt.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},an=new WeakMap,Yx),M2=(Kx=class{constructor(e={}){le(this,ut);le(this,ds);le(this,fs);le(this,co);le(this,lo);le(this,ps);le(this,uo);le(this,fo);ee(this,ut,e.queryCache||new B2),ee(this,ds,e.mutationCache||new I2),ee(this,fs,e.defaultOptions||{}),ee(this,co,new Map),ee(this,lo,new Map),ee(this,ps,0)}mount(){Su(this,ps)._++,N(this,ps)===1&&(ee(this,uo,Uu.subscribe(async e=>{e&&(await this.resumePausedMutations(),N(this,ut).onFocus())})),ee(this,fo,uc.subscribe(async e=>{e&&(await this.resumePausedMutations(),N(this,ut).onOnline())})))}unmount(){var e,t;Su(this,ps)._--,N(this,ps)===0&&((e=N(this,uo))==null||e.call(this),ee(this,uo,void 0),(t=N(this,fo))==null||t.call(this),ee(this,fo,void 0))}isFetching(e){return N(this,ut).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return N(this,ds).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=N(this,ut).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=N(this,ut).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(zn(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return N(this,ut).findAll(e).map(({queryKey:t,state:r})=>{const n=r.data;return[t,n]})}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),s=N(this,ut).get(n.queryHash),a=s==null?void 0:s.state.data,o=p2(t,a);if(o!==void 0)return N(this,ut).build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return gt.batch(()=>N(this,ut).findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=N(this,ut).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=N(this,ut);gt.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=N(this,ut);return gt.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=gt.batch(()=>N(this,ut).findAll(e).map(s=>s.cancel(r)));return Promise.all(n).then(Ft).catch(Ft)}invalidateQueries(e,t={}){return gt.batch(()=>(N(this,ut).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},n=gt.batch(()=>N(this,ut).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let a=s.fetch(void 0,r);return r.throwOnError||(a=a.catch(Ft)),s.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(n).then(Ft)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=N(this,ut).build(this,t);return r.isStaleByTime(zn(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ft).catch(Ft)}fetchInfiniteQuery(e){return e.behavior=mh(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ft).catch(Ft)}ensureInfiniteQueryData(e){return e.behavior=mh(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return uc.isOnline()?N(this,ds).resumePausedMutations():Promise.resolve()}getQueryCache(){return N(this,ut)}getMutationCache(){return N(this,ds)}getDefaultOptions(){return N(this,fs)}setDefaultOptions(e){ee(this,fs,e)}setQueryDefaults(e,t){N(this,co).set(ys(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...N(this,co).values()],r={};return t.forEach(n=>{ho(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){N(this,lo).set(ys(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...N(this,lo).values()],r={};return t.forEach(n=>{ho(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...N(this,fs).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Ou(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===lc&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...N(this,fs).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){N(this,ut).clear(),N(this,ds).clear()}},ut=new WeakMap,ds=new WeakMap,fs=new WeakMap,co=new WeakMap,lo=new WeakMap,ps=new WeakMap,uo=new WeakMap,fo=new WeakMap,Kx),gh=mt.createContext(void 0),mo=e=>{const t=mt.useContext(gh);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},_2=({client:e,children:t})=>(mt.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),B.jsx(gh.Provider,{value:e,children:t})),xh=mt.createContext(!1),U2=()=>mt.useContext(xh);xh.Provider;function D2(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var F2=mt.createContext(D2()),N2=()=>mt.useContext(F2),z2=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},L2=e=>{mt.useEffect(()=>{e.clearReset()},[e])},R2=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(s&&e.data===void 0||oh(r,[e.error,n])),H2=e=>{if(e.suspense){const r=s=>s==="static"?s:Math.max(s??1e3,1e3),n=e.staleTime;e.staleTime=typeof n=="function"?(...s)=>r(n(...s)):r(n),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},$2=(e,t)=>e.isLoading&&e.isFetching&&!t,G2=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,wh=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function j2(e,t,r){var d,p,h,y,g;if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const n=U2(),s=N2(),a=mo(),o=a.defaultQueryOptions(e);(p=(d=a.getDefaultOptions().queries)==null?void 0:d._experimental_beforeQuery)==null||p.call(d,o),process.env.NODE_ENV!=="production"&&(o.queryFn||console.error(`[${o.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),o._optimisticResults=n?"isRestoring":"optimistic",H2(o),z2(o,s),L2(s);const i=!a.getQueryCache().get(o.queryHash),[c]=mt.useState(()=>new t(a,o)),l=c.getOptimisticResult(o),u=!n&&e.subscribed!==!1;if(mt.useSyncExternalStore(mt.useCallback(k=>{const v=u?c.subscribe(gt.batchCalls(k)):Ft;return c.updateResult(),v},[c,u]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),mt.useEffect(()=>{c.setOptions(o)},[o,c]),G2(o,l))throw wh(o,c,s);if(R2({result:l,errorResetBoundary:s,throwOnError:o.throwOnError,query:a.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw l.error;if((y=(h=a.getDefaultOptions().queries)==null?void 0:h._experimental_afterQuery)==null||y.call(h,o,l),o.experimental_prefetchInRender&&!bs&&$2(l,n)){const k=i?wh(o,c,s):(g=a.getQueryCache().get(o.queryHash))==null?void 0:g.promise;k==null||k.catch(Ft).finally(()=>{c.updateResult()})}return o.notifyOnChangeProps?l:c.trackResult(l)}function V2(e,t){return j2(e,C2)}function on(e,t){const r=mo(),[n]=mt.useState(()=>new O2(r,e));mt.useEffect(()=>{n.setOptions(e)},[n,e]);const s=mt.useSyncExternalStore(mt.useCallback(o=>n.subscribe(gt.batchCalls(o)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),a=mt.useCallback((o,i)=>{n.mutate(o,i).catch(Ft)},[n]);if(s.error&&oh(n.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:a,mutateAsync:s.mutate}}const W2="1.2.3";let Ht=class K0 extends Error{constructor(t,r={}){var o;const n=r.cause instanceof K0?r.cause.details:(o=r.cause)!=null&&o.message?r.cause.message:r.details,s=r.cause instanceof K0&&r.cause.docsPath||r.docsPath,a=[t||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...s?[`Docs: https://abitype.dev${s}`]:[],...n?[`Details: ${n}`]:[],`Version: abitype@${W2}`].join(`
2
2
  `);super(a),Object.defineProperty(this,"details",{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,"metaMessages",{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,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),r.cause&&(this.cause=r.cause),this.details=n,this.docsPath=s,this.metaMessages=r.metaMessages,this.shortMessage=t}};function cn(e,t){const r=e.exec(t);return r==null?void 0:r.groups}const vh=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,kh=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,Eh=/^\(.+?\).*?$/,Ch=/^tuple(?<array>(\[(\d*)\])*)$/;function Lu(e){let t=e.type;if(Ch.test(e.type)&&"components"in e){t="(";const r=e.components.length;for(let s=0;s<r;s++){const a=e.components[s];t+=Lu(a),s<r-1&&(t+=", ")}const n=cn(Ch,e.type);return t+=`)${(n==null?void 0:n.array)||""}`,Lu({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function la(e){let t="";const r=e.length;for(let n=0;n<r;n++){const s=e[n];t+=Lu(s),n!==r-1&&(t+=", ")}return t}function fc(e){var t;return e.type==="function"?`function ${e.name}(${la(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${(t=e.outputs)!=null&&t.length?` returns (${la(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${la(e.inputs)})`:e.type==="error"?`error ${e.name}(${la(e.inputs)})`:e.type==="constructor"?`constructor(${la(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const Th=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function q2(e){return Th.test(e)}function Y2(e){return cn(Th,e)}const Sh=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function K2(e){return Sh.test(e)}function Z2(e){return cn(Sh,e)}const Ah=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function X2(e){return Ah.test(e)}function Q2(e){return cn(Ah,e)}const Ph=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function pc(e){return Ph.test(e)}function J2(e){return cn(Ph,e)}const Ih=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function ew(e){return Ih.test(e)}function tw(e){return cn(Ih,e)}const Oh=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function rw(e){return Oh.test(e)}function nw(e){return cn(Oh,e)}const sw=/^receive\(\) external payable$/;function aw(e){return sw.test(e)}const Bh=new Set(["memory","indexed","storage","calldata"]),ow=new Set(["indexed"]),Ru=new Set(["calldata","memory","storage"]);class iw extends Ht{constructor({signature:t}){super("Failed to parse ABI item.",{details:`parseAbiItem(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiitem-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiItemError"})}}class cw extends Ht{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class lw extends Ht{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class uw extends Ht{constructor({params:t}){super("Failed to parse ABI parameters.",{details:`parseAbiParameters(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiparameters-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParametersError"})}}class dw extends Ht{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class fw extends Ht{constructor({param:t,name:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`"${r}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class pw extends Ht{constructor({param:t,type:r,modifier:n}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${n}" not allowed${r?` in "${r}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class hw extends Ht{constructor({param:t,type:r,modifier:n}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${n}" not allowed${r?` in "${r}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${n}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class mw extends Ht{constructor({abiParameter:t}){super("Invalid ABI parameter.",{details:JSON.stringify(t,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class ua extends Ht{constructor({signature:t,type:r}){super(`Invalid ${r} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class bw extends Ht{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class yw extends Ht{constructor({signature:t}){super("Invalid struct signature.",{details:t,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class gw extends Ht{constructor({type:t}){super("Circular reference detected.",{metaMessages:[`Struct "${t}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class xw extends Ht{constructor({current:t,depth:r}){super("Unbalanced parentheses.",{metaMessages:[`"${t.trim()}" has too many ${r>0?"opening":"closing"} parentheses.`],details:`Depth "${r}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function ww(e,t,r){let n="";if(r)for(const s of Object.entries(r)){if(!s)continue;let a="";for(const o of s[1])a+=`[${o.type}${o.name?`:${o.name}`:""}]`;n+=`(${s[0]}{${a}})`}return t?`${t}:${e}${n}`:`${e}${n}`}const Hu=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);function $u(e,t={}){if(X2(e))return vw(e,t);if(K2(e))return kw(e,t);if(q2(e))return Ew(e,t);if(ew(e))return Cw(e,t);if(rw(e))return Tw(e);if(aw(e))return{type:"receive",stateMutability:"payable"};throw new bw({signature:e})}function vw(e,t={}){const r=Q2(e);if(!r)throw new ua({signature:e,type:"function"});const n=Qt(r.parameters),s=[],a=n.length;for(let i=0;i<a;i++)s.push(ln(n[i],{modifiers:Ru,structs:t,type:"function"}));const o=[];if(r.returns){const i=Qt(r.returns),c=i.length;for(let l=0;l<c;l++)o.push(ln(i[l],{modifiers:Ru,structs:t,type:"function"}))}return{name:r.name,type:"function",stateMutability:r.stateMutability??"nonpayable",inputs:s,outputs:o}}function kw(e,t={}){const r=Z2(e);if(!r)throw new ua({signature:e,type:"event"});const n=Qt(r.parameters),s=[],a=n.length;for(let o=0;o<a;o++)s.push(ln(n[o],{modifiers:ow,structs:t,type:"event"}));return{name:r.name,type:"event",inputs:s}}function Ew(e,t={}){const r=Y2(e);if(!r)throw new ua({signature:e,type:"error"});const n=Qt(r.parameters),s=[],a=n.length;for(let o=0;o<a;o++)s.push(ln(n[o],{structs:t,type:"error"}));return{name:r.name,type:"error",inputs:s}}function Cw(e,t={}){const r=tw(e);if(!r)throw new ua({signature:e,type:"constructor"});const n=Qt(r.parameters),s=[],a=n.length;for(let o=0;o<a;o++)s.push(ln(n[o],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:r.stateMutability??"nonpayable",inputs:s}}function Tw(e){const t=nw(e);if(!t)throw new ua({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const Sw=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*(?:\spayable)?)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,Aw=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,Pw=/^u?int$/;function ln(e,t){var d,p;const r=ww(e,t==null?void 0:t.type,t==null?void 0:t.structs);if(Hu.has(r))return Hu.get(r);const n=Eh.test(e),s=cn(n?Aw:Sw,e);if(!s)throw new dw({param:e});if(s.name&&Ow(s.name))throw new fw({param:e,name:s.name});const a=s.name?{name:s.name}:{},o=s.modifier==="indexed"?{indexed:!0}:{},i=(t==null?void 0:t.structs)??{};let c,l={};if(n){c="tuple";const h=Qt(s.type),y=[],g=h.length;for(let k=0;k<g;k++)y.push(ln(h[k],{structs:i}));l={components:y}}else if(s.type in i)c="tuple",l={components:i[s.type]};else if(Pw.test(s.type))c=`${s.type}256`;else if(s.type==="address payable")c="address";else if(c=s.type,(t==null?void 0:t.type)!=="struct"&&!Mh(c))throw new lw({type:c});if(s.modifier){if(!((p=(d=t==null?void 0:t.modifiers)==null?void 0:d.has)!=null&&p.call(d,s.modifier)))throw new pw({param:e,type:t==null?void 0:t.type,modifier:s.modifier});if(Ru.has(s.modifier)&&!Bw(c,!!s.array))throw new hw({param:e,type:t==null?void 0:t.type,modifier:s.modifier})}const u={type:`${c}${s.array??""}`,...a,...o,...l};return Hu.set(r,u),u}function Qt(e,t=[],r="",n=0){const s=e.trim().length;for(let a=0;a<s;a++){const o=e[a],i=e.slice(a+1);switch(o){case",":return n===0?Qt(i,[...t,r.trim()]):Qt(i,t,`${r}${o}`,n);case"(":return Qt(i,t,`${r}${o}`,n+1);case")":return Qt(i,t,`${r}${o}`,n-1);default:return Qt(i,t,`${r}${o}`,n)}}if(r==="")return t;if(n!==0)throw new xw({current:r,depth:n});return t.push(r.trim()),t}function Mh(e){return e==="address"||e==="bool"||e==="function"||e==="string"||vh.test(e)||kh.test(e)}const Iw=/^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;function Ow(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||vh.test(e)||kh.test(e)||Iw.test(e)}function Bw(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function Gu(e){const t={},r=e.length;for(let o=0;o<r;o++){const i=e[o];if(!pc(i))continue;const c=J2(i);if(!c)throw new ua({signature:i,type:"struct"});const l=c.properties.split(";"),u=[],d=l.length;for(let p=0;p<d;p++){const y=l[p].trim();if(!y)continue;const g=ln(y,{type:"struct"});u.push(g)}if(!u.length)throw new yw({signature:i});t[c.name]=u}const n={},s=Object.entries(t),a=s.length;for(let o=0;o<a;o++){const[i,c]=s[o];n[i]=_h(c,t)}return n}const Mw=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function _h(e=[],t={},r=new Set){const n=[],s=e.length;for(let a=0;a<s;a++){const o=e[a];if(Eh.test(o.type))n.push(o);else{const c=cn(Mw,o.type);if(!(c!=null&&c.type))throw new mw({abiParameter:o});const{array:l,type:u}=c;if(u in t){if(r.has(u))throw new gw({type:u});n.push({...o,type:`tuple${l??""}`,components:_h(t[u],t,new Set([...r,u]))})}else if(Mh(u))n.push(o);else throw new cw({type:u})}}return n}function Uh(e){const t=Gu(e),r=[],n=e.length;for(let s=0;s<n;s++){const a=e[s];pc(a)||r.push($u(a,t))}return r}function Dh(e){let t;if(typeof e=="string")t=$u(e);else{const r=Gu(e),n=e.length;for(let s=0;s<n;s++){const a=e[s];if(!pc(a)){t=$u(a,r);break}}}if(!t)throw new iw({signature:e});return t}function Fh(e){const t=[];if(typeof e=="string"){const r=Qt(e),n=r.length;for(let s=0;s<n;s++)t.push(ln(r[s],{modifiers:Bh}))}else{const r=Gu(e),n=e.length;for(let s=0;s<n;s++){const a=e[s];if(pc(a))continue;const o=Qt(a),i=o.length;for(let c=0;c<i;c++)t.push(ln(o[c],{modifiers:Bh,structs:r}))}}if(t.length===0)throw new uw({params:e});return t}function ne(e,t,r){const n=e[t.name];if(typeof n=="function")return n;const s=e[r];return typeof s=="function"?s:a=>t(e,a)}function Er(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new Ww(e.type);return`${e.name}(${hc(e.inputs,{includeName:t})})`}function hc(e,{includeName:t=!1}={}){return e?e.map(r=>_w(r,{includeName:t})).join(t?", ":","):""}function _w(e,{includeName:t}){return e.type.startsWith("tuple")?`(${hc(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function Cr(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function it(e){return Cr(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const Nh="2.43.3";let bo={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,version:`viem@${Nh}`},$=class Z0 extends Error{constructor(t,r={}){var i;const n=(()=>{var c;return r.cause instanceof Z0?r.cause.details:(c=r.cause)!=null&&c.message?r.cause.message:r.details})(),s=r.cause instanceof Z0&&r.cause.docsPath||r.docsPath,a=(i=bo.getDocsUrl)==null?void 0:i.call(bo,{...r,docsPath:s}),o=[t||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...a?[`Docs: ${a}`]:[],...n?[`Details: ${n}`]:[],...bo.version?[`Version: ${bo.version}`]:[]].join(`
3
3
  `);super(o,r.cause?{cause:r.cause}:void 0),Object.defineProperty(this,"details",{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,"metaMessages",{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,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=n,this.docsPath=s,this.metaMessages=r.metaMessages,this.name=r.name??this.name,this.shortMessage=t,this.version=Nh}walk(t){return zh(this,t)}};function zh(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?zh(e.cause,t):t?null:e}class Uw extends ${constructor({docsPath:t}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(`
4
4
  `),{docsPath:t,name:"AbiConstructorNotFoundError"})}}class Lh extends ${constructor({docsPath:t}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orbs-network/spot-react",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "description": "Spot React Components - React components for Spot SDK",
5
5
  "type": "module",
6
6
  "main": "./dist/spot-react.umd.cjs",
@@ -39,7 +39,7 @@
39
39
  "react-virtuoso": "^4.17.0",
40
40
  "viem": "^2.43.3",
41
41
  "zustand": "^5.0.9",
42
- "@orbs-network/spot-ui": "0.0.6"
42
+ "@orbs-network/spot-ui": "0.0.7"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/react": "^19.0.2",