@orbs-network/spot-react 1.1.10 → 1.1.11

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-BQK488sZ.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-0fgt5ZPv.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;
@@ -3249,7 +3249,7 @@ const Tb = async ({
3249
3249
  }) => (await Promise.all([
3250
3250
  s ? Tb({ chainId: n, signal: e, page: t, limit: r, filters: { accounts: [a], configs: s.twapConfig ? [s.twapConfig] : [] } }) : Promise.resolve([]),
3251
3251
  yb({ chainId: n, signal: e, account: a, exchange: s == null ? void 0 : s.adapter, isDev: o })
3252
- ]).then(([l, d]) => [...l, ...d])).sort((l, d) => d.createdAt - l.createdAt), Ub = "1.1.10", Ib = {
3252
+ ]).then(([l, d]) => [...l, ...d])).sort((l, d) => d.createdAt - l.createdAt), Ub = "1.1.11", Ib = {
3253
3253
  version: Ub
3254
3254
  };
3255
3255
  var us = class {
@@ -11573,7 +11573,7 @@ async function gi(e, t) {
11573
11573
  });
11574
11574
  return J === "0x" ? { data: void 0 } : { data: J };
11575
11575
  } catch (F) {
11576
- const S = kx(F), { offchainLookup: M, offchainLookupSignature: L } = await import("./ccip-CnqN8Tqy.js");
11576
+ const S = kx(F), { offchainLookup: M, offchainLookupSignature: L } = await import("./ccip-SDBBUjsE.js");
11577
11577
  if (e.ccipRead !== !1 && (S == null ? void 0 : S.slice(0, 10)) === L && k)
11578
11578
  return { data: await M(e, { data: S, to: k }) };
11579
11579
  throw v && (S == null ? void 0 : S.slice(0, 10)) === "0x101bb98d" ? new Q2({ factory: f }) : du(F, {
@@ -1,6 +1,6 @@
1
1
  declare const _default: {
2
2
  "name": "@orbs-network/spot-react",
3
- "version": "1.1.10",
3
+ "version": "1.1.11",
4
4
  "description": "Spot React Components - React components for Spot SDK",
5
5
  "type": "module",
6
6
  "main": "./dist/spot-react.umd.cjs",
@@ -6,7 +6,7 @@ export declare const useSubmitOrderPanel: () => {
6
6
  dstAmount: string;
7
7
  onSubmit: () => Promise<import('../../../spot-ui/src/index.ts').Order>;
8
8
  onSwapSuccess: () => void;
9
- onSwapFailed: (index: number) => void;
9
+ onSwapFailed: () => void;
10
10
  isLoading: boolean;
11
11
  isSuccess: boolean;
12
12
  isFailed: boolean;
@@ -1,7 +1,7 @@
1
1
  import { SwapExecution } from '../types';
2
2
  export declare const useSwapExecution: () => {
3
3
  update: (data: Partial<SwapExecution>) => void;
4
- resetSwap: (index: number) => void;
4
+ resetSwap: () => void;
5
5
  status?: import('..').SwapStatus;
6
6
  parsedError?: import('..').ParsedError;
7
7
  error?: Error;
@@ -2,7 +2,7 @@ import { State, SwapExecution } from './types';
2
2
  interface SpotStore {
3
3
  resetState: () => void;
4
4
  updateState: (value: Partial<State>) => void;
5
- resetSwapExecutionAtIndex: (index: number) => void;
5
+ resetSwapExecutionAtIndex: () => void;
6
6
  updateSwapExecutionAtIndex: (index: number, value: Partial<SwapExecution>) => void;
7
7
  state: State;
8
8
  }
@@ -1 +1 @@
1
- {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../src/store.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE/C,UAAU,SAAS;IACjB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,WAAW,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC;IAC7C,yBAAyB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,0BAA0B,EAAE,CAC1B,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,OAAO,CAAC,aAAa,CAAC,KAC1B,IAAI,CAAC;IACV,KAAK,EAAE,KAAK,CAAC;CACd;AAUD,eAAO,MAAM,YAAY,wEA+BtB,CAAC"}
1
+ {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../src/store.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE/C,UAAU,SAAS;IACjB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,WAAW,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC;IAC7C,yBAAyB,EAAE,MAAM,IAAI,CAAC;IACtC,0BAA0B,EAAE,CAC1B,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,OAAO,CAAC,aAAa,CAAC,KAC1B,IAAI,CAAC;IACV,KAAK,EAAE,KAAK,CAAC;CACd;AAUD,eAAO,MAAM,YAAY,wEA+BtB,CAAC"}
@@ -1,4 +1,4 @@
1
- import { D as e, a8 as r, af as t, ae as i, V as u, O as n, ab as o, aa as l, a9 as d, ac as O, Q as P, P as S, R as T, U as R, ag as m, a7 as p, S as g, aj as A, ai as E, ah as _, T as I, Z as D, ao as U, a2 as c, W as y, au as C, Y as L, $ as B, a3 as k, a5 as F, a4 as M, ar as b, a0 as h, X as W, a6 as w, a1 as x, an as N, ap as v, aq as f, ad as j, am as q, at as H, as as Q, _ as z, al as G, ak as V, w as J, I as K, E as X, z as Y, L as Z, J as $, A as aa, y as sa, q as ea, m as ra, h as ta, K as ia, j as ua, G as na, t as oa, r as la, k as da, M as Oa, o as Pa, v as Sa, F as Ta, x as Ra, C as ma, p as pa, N as ga, u as Aa, n as Ea } from "./index-BQK488sZ.js";
1
+ import { D as e, a8 as r, af as t, ae as i, V as u, O as n, ab as o, aa as l, a9 as d, ac as O, Q as P, P as S, R as T, U as R, ag as m, a7 as p, S as g, aj as A, ai as E, ah as _, T as I, Z as D, ao as U, a2 as c, W as y, au as C, Y as L, $ as B, a3 as k, a5 as F, a4 as M, ar as b, a0 as h, X as W, a6 as w, a1 as x, an as N, ap as v, aq as f, ad as j, am as q, at as H, as as Q, _ as z, al as G, ak as V, w as J, I as K, E as X, z as Y, L as Z, J as $, A as aa, y as sa, q as ea, m as ra, h as ta, K as ia, j as ua, G as na, t as oa, r as la, k as da, M as Oa, o as Pa, v as Sa, F as Ta, x as Ra, C as ma, p as pa, N as ga, u as Aa, n as Ea } from "./index-0fgt5ZPv.js";
2
2
  export {
3
3
  e as DEFAULT_DURATIONS,
4
4
  r as DISCLAIMER_URL,
@@ -61,7 +61,7 @@
61
61
  dollarValueOut
62
62
  }
63
63
  }
64
- `,extractResults:p=>{var f;return(((f=p.data)==null?void 0:f.orderFilleds)||[]).map(m=>({...m,timestamp:new Date(m.timestamp).getTime()}))}})};class fb extends Error{constructor(){super("No graph endpoint found"),this.name="NoGraphEndpointError"}}const mb=async({chainId:e,signal:t,page:n,limit:r,filters:s})=>{try{const a=await ub({chainId:e,signal:t,page:n,limit:r,filters:s}),[o,i]=await Promise.all([pb({chainId:e,orders:a,signal:t}),db({chainId:e,orders:a,signal:t})]),c=a.map(d=>{const p=o==null?void 0:o.filter(f=>f.TWAP_id===Number(d.Contract_id)&&qn(f.exchange,d.exchange)&&qn(f.twapAddress,d.twapAddress));return cb(d,e,p,hb(d,p||[],i))}).sort((d,p)=>p.createdAt-d.createdAt),l=new Set;return c.filter(d=>l.has(d.id)?!1:(l.add(d.id),!0))}catch{return[]}},hb=(e,t,n)=>{var i;const r=(i=n==null?void 0:n.find(c=>c.twapId===e.Contract_id.toString()&&qn(c.twapAddress,e.twapAddress)))==null?void 0:i.status,a=Ad(t).reduce((c,l)=>c.plus(l.inAmount),new R(0)).toFixed(),o=Sd(e.ask_srcAmount,a);return bb(o,e.ask_deadline*1e3,r)},Sd=(e,t)=>{if(!t||!e)return 0;const n=R(t).dividedBy(e).toNumber();return n>=.99?100:n<=0?0:Number((n*100).toFixed(2))},bb=(e,t,n)=>e===100?ze.Completed:n==="CANCELLED"?ze.Cancelled:n==="COMPLETED"?ze.Completed:t>Date.now()?ze.Open:ze.Expired,yb=async({signal:e,page:t,chainId:n,limit:r,config:s,account:a,isDev:o=!1})=>(await Promise.all([s?mb({chainId:n,signal:e,page:t,limit:r,filters:{accounts:[a],configs:s.twapConfig?[s.twapConfig]:[]}}):Promise.resolve([]),ob({chainId:n,signal:e,account:a,exchange:s==null?void 0:s.adapter,isDev:o})]).then(([l,d])=>[...l,...d])).sort((l,d)=>d.createdAt-l.createdAt),xb={version:"1.1.10"};var Fr=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(){}},gb={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},wb=(Nh=class{constructor(){Z(this,jt,gb);Z(this,gr,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&I(this,gr)&&e!==I(this,jt)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:I(this,jt),provider:e}),K(this,jt,e),process.env.NODE_ENV!=="production"&&K(this,gr,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&K(this,gr,!0),I(this,jt).setTimeout(e,t)}clearTimeout(e){I(this,jt).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&K(this,gr,!0),I(this,jt).setInterval(e,t)}clearInterval(e){I(this,jt).clearInterval(e)}},jt=new WeakMap,gr=new WeakMap,Nh),Wn=new wb;function Eb(e){setTimeout(e,0)}var Xn=typeof window>"u"||"Deno"in globalThis;function Ve(){}function kb(e,t){return typeof e=="function"?e(t):e}function ec(e){return typeof e=="number"&&e>=0&&e!==1/0}function Pd(e,t){return Math.max(e+(t||0)-Date.now(),0)}function wn(e,t){return typeof e=="function"?e(t):e}function xt(e,t){return typeof e=="function"?e(t):e}function Bd(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:a,queryKey:o,stale:i}=e;if(o){if(r){if(t.queryHash!==tc(o,t.options))return!1}else if(!Ps(t.queryKey,o))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof i=="boolean"&&t.isStale()!==i||s&&s!==t.state.fetchStatus||a&&!a(t))}function Ud(e,t){const{exact:n,status:r,predicate:s,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(Zn(t.options.mutationKey)!==Zn(a))return!1}else if(!Ps(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function tc(e,t){return((t==null?void 0:t.queryKeyHashFn)||Zn)(e)}function Zn(e){return JSON.stringify(e,(t,n)=>rc(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function Ps(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Ps(e[n],t[n])):!1}var Cb=Object.prototype.hasOwnProperty;function nc(e,t){if(e===t)return e;const n=Id(e)&&Id(t);if(!n&&!(rc(e)&&rc(t)))return t;const s=(n?e:Object.keys(e)).length,a=n?t:Object.keys(t),o=a.length,i=n?new Array(o):{};let c=0;for(let l=0;l<o;l++){const d=n?l:a[l],p=e[d],f=t[d];if(p===f){i[d]=p,(n?l<s:Cb.call(e,d))&&c++;continue}if(p===null||f===null||typeof p!="object"||typeof f!="object"){i[d]=f;continue}const m=nc(p,f);i[d]=m,m===p&&c++}return s===o&&c===s?e:i}function Ja(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function Id(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function rc(e){if(!Fd(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Fd(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Fd(e){return Object.prototype.toString.call(e)==="[object Object]"}function vb(e){return new Promise(t=>{Wn.setTimeout(t,e)})}function sc(e,t,n){if(typeof n.structuralSharing=="function")return n.structuralSharing(e,t);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return nc(e,t)}catch(r){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. [${n.queryHash}]: ${r}`),r}return nc(e,t)}return t}function Ab(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function Tb(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Ya=Symbol();function Od(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Ya&&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===Ya?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Dd(e,t){return typeof e=="function"?e(...t):!!e}var Sb=(_h=class extends Fr{constructor(){super();Z(this,wr);Z(this,Dn);Z(this,ms);K(this,ms,t=>{if(!Xn&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){I(this,Dn)||this.setEventListener(I(this,ms))}onUnsubscribe(){var t;this.hasListeners()||((t=I(this,Dn))==null||t.call(this),K(this,Dn,void 0))}setEventListener(t){var n;K(this,ms,t),(n=I(this,Dn))==null||n.call(this),K(this,Dn,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){I(this,wr)!==t&&(K(this,wr,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof I(this,wr)=="boolean"?I(this,wr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},wr=new WeakMap,Dn=new WeakMap,ms=new WeakMap,_h),ac=new Sb;function oc(){let e,t;const n=new Promise((s,a)=>{e=s,t=a});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},n.reject=s=>{r({status:"rejected",reason:s}),t(s)},n}var Pb=Eb;function Bb(){let e=[],t=0,n=i=>{i()},r=i=>{i()},s=Pb;const a=i=>{t?e.push(i):s(()=>{n(i)})},o=()=>{const i=e;e=[],i.length&&s(()=>{r(()=>{i.forEach(c=>{n(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=>{n=i},setBatchNotifyFunction:i=>{r=i},setScheduler:i=>{s=i}}}var Fe=Bb(),Ub=(zh=class extends Fr{constructor(){super();Z(this,hs,!0);Z(this,Mn);Z(this,bs);K(this,bs,t=>{if(!Xn&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){I(this,Mn)||this.setEventListener(I(this,bs))}onUnsubscribe(){var t;this.hasListeners()||((t=I(this,Mn))==null||t.call(this),K(this,Mn,void 0))}setEventListener(t){var n;K(this,bs,t),(n=I(this,Mn))==null||n.call(this),K(this,Mn,t(this.setOnline.bind(this)))}setOnline(t){I(this,hs)!==t&&(K(this,hs,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return I(this,hs)}},hs=new WeakMap,Mn=new WeakMap,bs=new WeakMap,zh),eo=new Ub;function Ib(e){return Math.min(1e3*2**e,3e4)}function Md(e){return(e??"online")==="online"?eo.isOnline():!0}var ic=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Nd(e){let t=!1,n=0,r;const s=oc(),a=()=>s.status!=="pending",o=g=>{var P;if(!a()){const B=new ic(g);f(B),(P=e.onCancel)==null||P.call(e,B)}},i=()=>{t=!0},c=()=>{t=!1},l=()=>ac.isFocused()&&(e.networkMode==="always"||eo.isOnline())&&e.canRun(),d=()=>Md(e.networkMode)&&e.canRun(),p=g=>{a()||(r==null||r(),s.resolve(g))},f=g=>{a()||(r==null||r(),s.reject(g))},m=()=>new Promise(g=>{var P;r=B=>{(a()||l())&&g(B)},(P=e.onPause)==null||P.call(e)}).then(()=>{var g;r=void 0,a()||(g=e.onContinue)==null||g.call(e)}),y=()=>{if(a())return;let g;const P=n===0?e.initialPromise:void 0;try{g=P??e.fn()}catch(B){g=Promise.reject(B)}Promise.resolve(g).then(p).catch(B=>{var _;if(a())return;const C=e.retry??(Xn?0:3),U=e.retryDelay??Ib,k=typeof U=="function"?U(n,B):U,D=C===!0||typeof C=="number"&&n<C||typeof C=="function"&&C(n,B);if(t||!D){f(B);return}n++,(_=e.onFail)==null||_.call(e,n,B),vb(k).then(()=>l()?void 0:m()).then(()=>{t?f(B):y()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(r==null||r(),s),cancelRetry:i,continueRetry:c,canStart:d,start:()=>(d()?y():m().then(y),s)}}var _d=(Rh=class{constructor(){Z(this,Er)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ec(this.gcTime)&&K(this,Er,Wn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Xn?1/0:300*1e3))}clearGcTimeout(){I(this,Er)&&(Wn.clearTimeout(I(this,Er)),K(this,Er,void 0))}},Er=new WeakMap,Rh),Fb=(Lh=class extends _d{constructor(t){super();Z(this,Dt);Z(this,kr);Z(this,ys);Z(this,kt);Z(this,Cr);Z(this,_e);Z(this,$a);Z(this,vr);K(this,vr,!1),K(this,$a,t.defaultOptions),this.setOptions(t.options),this.observers=[],K(this,Cr,t.client),K(this,kt,I(this,Cr).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,K(this,kr,Ld(this.options)),this.state=t.state??I(this,kr),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=I(this,_e))==null?void 0:t.promise}setOptions(t){if(this.options={...I(this,$a),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=Ld(this.options);n.data!==void 0&&(this.setState(Rd(n.data,n.dataUpdatedAt)),K(this,kr,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&I(this,kt).remove(this)}setData(t,n){const r=sc(this.state.data,t,this.options);return ae(this,Dt,xn).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){ae(this,Dt,xn).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,s;const n=(r=I(this,_e))==null?void 0:r.promise;return(s=I(this,_e))==null||s.cancel(t),n?n.then(Ve).catch(Ve):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(I(this,kr))}isActive(){return this.observers.some(t=>xt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ya||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>wn(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:!Pd(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=I(this,_e))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=I(this,_e))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),I(this,kt).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(I(this,_e)&&(I(this,vr)?I(this,_e).cancel({revert:!0}):I(this,_e).cancelRetry()),this.scheduleGc()),I(this,kt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ae(this,Dt,xn).call(this,{type:"invalidate"})}async fetch(t,n){var c,l,d,p,f,m,y,g,P,B,C,U;if(this.state.fetchStatus!=="idle"&&((c=I(this,_e))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(I(this,_e))return I(this,_e).continueRetry(),I(this,_e).promise}if(t&&this.setOptions(t),!this.options.queryFn){const k=this.observers.find(D=>D.options.queryFn);k&&this.setOptions(k.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 r=new AbortController,s=k=>{Object.defineProperty(k,"signal",{enumerable:!0,get:()=>(K(this,vr,!0),r.signal)})},a=()=>{const k=Od(this.options,n),_=(()=>{const N={client:I(this,Cr),queryKey:this.queryKey,meta:this.meta};return s(N),N})();return K(this,vr,!1),this.options.persister?this.options.persister(k,_,this):k(_)},i=(()=>{const k={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:I(this,Cr),state:this.state,fetchFn:a};return s(k),k})();(l=this.options.behavior)==null||l.onFetch(i,this),K(this,ys,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=i.fetchOptions)==null?void 0:d.meta))&&ae(this,Dt,xn).call(this,{type:"fetch",meta:(p=i.fetchOptions)==null?void 0:p.meta}),K(this,_e,Nd({initialPromise:n==null?void 0:n.initialPromise,fn:i.fetchFn,onCancel:k=>{k instanceof ic&&k.revert&&this.setState({...I(this,ys),fetchStatus:"idle"}),r.abort()},onFail:(k,D)=>{ae(this,Dt,xn).call(this,{type:"failed",failureCount:k,error:D})},onPause:()=>{ae(this,Dt,xn).call(this,{type:"pause"})},onContinue:()=>{ae(this,Dt,xn).call(this,{type:"continue"})},retry:i.options.retry,retryDelay:i.options.retryDelay,networkMode:i.options.networkMode,canRun:()=>!0}));try{const k=await I(this,_e).start();if(k===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(k),(m=(f=I(this,kt).config).onSuccess)==null||m.call(f,k,this),(g=(y=I(this,kt).config).onSettled)==null||g.call(y,k,this.state.error,this),k}catch(k){if(k instanceof ic){if(k.silent)return I(this,_e).promise;if(k.revert){if(this.state.data===void 0)throw k;return this.state.data}}throw ae(this,Dt,xn).call(this,{type:"error",error:k}),(B=(P=I(this,kt).config).onError)==null||B.call(P,k,this),(U=(C=I(this,kt).config).onSettled)==null||U.call(C,this.state.data,k,this),k}finally{this.scheduleGc()}}},kr=new WeakMap,ys=new WeakMap,kt=new WeakMap,Cr=new WeakMap,_e=new WeakMap,$a=new WeakMap,vr=new WeakMap,Dt=new WeakSet,xn=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...zd(r.data,this.options),fetchMeta:t.meta??null};case"success":const s={...r,...Rd(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return K(this,ys,t.manual?s:void 0),s;case"error":const a=t.error;return{...r,error:a,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Fe.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),I(this,kt).notify({query:this,type:"updated",action:t})})},Lh);function zd(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Md(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Rd(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Ld(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Ob=($h=class extends Fr{constructor(t,n){super();Z(this,me);Z(this,rt);Z(this,de);Z(this,Ha);Z(this,We);Z(this,Ar);Z(this,xs);Z(this,fn);Z(this,Nn);Z(this,Ga);Z(this,gs);Z(this,ws);Z(this,Tr);Z(this,Sr);Z(this,_n);Z(this,Es,new Set);this.options=n,K(this,rt,t),K(this,Nn,null),K(this,fn,oc()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(I(this,de).addObserver(this),$d(I(this,de),this.options)?ae(this,me,Va).call(this):this.updateResult(),ae(this,me,Zu).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return cc(I(this,de),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return cc(I(this,de),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,ae(this,me,Qu).call(this),ae(this,me,Ju).call(this),I(this,de).removeObserver(this)}setOptions(t){const n=this.options,r=I(this,de);if(this.options=I(this,rt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof xt(this.options.enabled,I(this,de))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");ae(this,me,Yu).call(this),I(this,de).setOptions(this.options),n._defaulted&&!Ja(this.options,n)&&I(this,rt).getQueryCache().notify({type:"observerOptionsUpdated",query:I(this,de),observer:this});const s=this.hasListeners();s&&Hd(I(this,de),r,this.options,n)&&ae(this,me,Va).call(this),this.updateResult(),s&&(I(this,de)!==r||xt(this.options.enabled,I(this,de))!==xt(n.enabled,I(this,de))||wn(this.options.staleTime,I(this,de))!==wn(n.staleTime,I(this,de)))&&ae(this,me,Ku).call(this);const a=ae(this,me,Wu).call(this);s&&(I(this,de)!==r||xt(this.options.enabled,I(this,de))!==xt(n.enabled,I(this,de))||a!==I(this,_n))&&ae(this,me,Xu).call(this,a)}getOptimisticResult(t){const n=I(this,rt).getQueryCache().build(I(this,rt),t),r=this.createResult(n,t);return Mb(this,r)&&(K(this,We,r),K(this,xs,this.options),K(this,Ar,I(this,de).state)),r}getCurrentResult(){return I(this,We)}trackResult(t,n){return new Proxy(t,{get:(r,s)=>(this.trackProp(s),n==null||n(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&I(this,fn).status==="pending"&&I(this,fn).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,s))})}trackProp(t){I(this,Es).add(t)}getCurrentQuery(){return I(this,de)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=I(this,rt).defaultQueryOptions(t),r=I(this,rt).getQueryCache().build(I(this,rt),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return ae(this,me,Va).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),I(this,We)))}createResult(t,n){var b;const r=I(this,de),s=this.options,a=I(this,We),o=I(this,Ar),i=I(this,xs),l=t!==r?t.state:I(this,Ha),{state:d}=t;let p={...d},f=!1,m;if(n._optimisticResults){const x=this.hasListeners(),v=!x&&$d(t,n),E=x&&Hd(t,r,n,s);(v||E)&&(p={...p,...zd(d.data,t.options)}),n._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:y,errorUpdatedAt:g,status:P}=p;m=p.data;let B=!1;if(n.placeholderData!==void 0&&m===void 0&&P==="pending"){let x;a!=null&&a.isPlaceholderData&&n.placeholderData===(i==null?void 0:i.placeholderData)?(x=a.data,B=!0):x=typeof n.placeholderData=="function"?n.placeholderData((b=I(this,ws))==null?void 0:b.state.data,I(this,ws)):n.placeholderData,x!==void 0&&(P="success",m=sc(a==null?void 0:a.data,x,n),f=!0)}if(n.select&&m!==void 0&&!B)if(a&&m===(o==null?void 0:o.data)&&n.select===I(this,Ga))m=I(this,gs);else try{K(this,Ga,n.select),m=n.select(m),m=sc(a==null?void 0:a.data,m,n),K(this,gs,m),K(this,Nn,null)}catch(x){K(this,Nn,x)}I(this,Nn)&&(y=I(this,Nn),m=I(this,gs),g=Date.now(),P="error");const C=p.fetchStatus==="fetching",U=P==="pending",k=P==="error",D=U&&C,_=m!==void 0,h={status:P,fetchStatus:p.fetchStatus,isPending:U,isSuccess:P==="success",isError:k,isInitialLoading:D,isLoading:D,data:m,dataUpdatedAt:p.dataUpdatedAt,error:y,errorUpdatedAt:g,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:p.dataUpdateCount>0||p.errorUpdateCount>0,isFetchedAfterMount:p.dataUpdateCount>l.dataUpdateCount||p.errorUpdateCount>l.errorUpdateCount,isFetching:C,isRefetching:C&&!U,isLoadingError:k&&!_,isPaused:p.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:k&&_,isStale:lc(t,n),refetch:this.refetch,promise:I(this,fn),isEnabled:xt(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const x=T=>{h.status==="error"?T.reject(h.error):h.data!==void 0&&T.resolve(h.data)},v=()=>{const T=K(this,fn,h.promise=oc());x(T)},E=I(this,fn);switch(E.status){case"pending":t.queryHash===r.queryHash&&x(E);break;case"fulfilled":(h.status==="error"||h.data!==E.value)&&v();break;case"rejected":(h.status!=="error"||h.error!==E.reason)&&v();break}}return h}updateResult(){const t=I(this,We),n=this.createResult(I(this,de),this.options);if(K(this,Ar,I(this,de).state),K(this,xs,this.options),I(this,Ar).data!==void 0&&K(this,ws,I(this,de)),Ja(n,t))return;K(this,We,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!I(this,Es).size)return!0;const o=new Set(a??I(this,Es));return this.options.throwOnError&&o.add("error"),Object.keys(I(this,We)).some(i=>{const c=i;return I(this,We)[c]!==t[c]&&o.has(c)})};ae(this,me,Wh).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&ae(this,me,Zu).call(this)}},rt=new WeakMap,de=new WeakMap,Ha=new WeakMap,We=new WeakMap,Ar=new WeakMap,xs=new WeakMap,fn=new WeakMap,Nn=new WeakMap,Ga=new WeakMap,gs=new WeakMap,ws=new WeakMap,Tr=new WeakMap,Sr=new WeakMap,_n=new WeakMap,Es=new WeakMap,me=new WeakSet,Va=function(t){ae(this,me,Yu).call(this);let n=I(this,de).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Ve)),n},Ku=function(){ae(this,me,Qu).call(this);const t=wn(this.options.staleTime,I(this,de));if(Xn||I(this,We).isStale||!ec(t))return;const r=Pd(I(this,We).dataUpdatedAt,t)+1;K(this,Tr,Wn.setTimeout(()=>{I(this,We).isStale||this.updateResult()},r))},Wu=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(I(this,de)):this.options.refetchInterval)??!1},Xu=function(t){ae(this,me,Ju).call(this),K(this,_n,t),!(Xn||xt(this.options.enabled,I(this,de))===!1||!ec(I(this,_n))||I(this,_n)===0)&&K(this,Sr,Wn.setInterval(()=>{(this.options.refetchIntervalInBackground||ac.isFocused())&&ae(this,me,Va).call(this)},I(this,_n)))},Zu=function(){ae(this,me,Ku).call(this),ae(this,me,Xu).call(this,ae(this,me,Wu).call(this))},Qu=function(){I(this,Tr)&&(Wn.clearTimeout(I(this,Tr)),K(this,Tr,void 0))},Ju=function(){I(this,Sr)&&(Wn.clearInterval(I(this,Sr)),K(this,Sr,void 0))},Yu=function(){const t=I(this,rt).getQueryCache().build(I(this,rt),this.options);if(t===I(this,de))return;const n=I(this,de);K(this,de,t),K(this,Ha,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Wh=function(t){Fe.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(I(this,We))}),I(this,rt).getQueryCache().notify({query:I(this,de),type:"observerResultsUpdated"})})},$h);function Db(e,t){return xt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function $d(e,t){return Db(e,t)||e.state.data!==void 0&&cc(e,t,t.refetchOnMount)}function cc(e,t,n){if(xt(t.enabled,e)!==!1&&wn(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&lc(e,t)}return!1}function Hd(e,t,n,r){return(e!==t||xt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&lc(e,n)}function lc(e,t){return xt(t.enabled,e)!==!1&&e.isStaleByTime(wn(t.staleTime,e))}function Mb(e,t){return!Ja(e.getCurrentResult(),t)}function Gd(e){return{onFetch:(t,n)=>{var d,p,f,m,y;const r=t.options,s=(f=(p=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:p.fetchMore)==null?void 0:f.direction,a=((m=t.state.data)==null?void 0:m.pages)||[],o=((y=t.state.data)==null?void 0:y.pageParams)||[];let i={pages:[],pageParams:[]},c=0;const l=async()=>{let g=!1;const P=U=>{Object.defineProperty(U,"signal",{enumerable:!0,get:()=>(t.signal.aborted?g=!0:t.signal.addEventListener("abort",()=>{g=!0}),t.signal)})},B=Od(t.options,t.fetchOptions),C=async(U,k,D)=>{if(g)return Promise.reject();if(k==null&&U.pages.length)return Promise.resolve(U);const N=(()=>{const v={client:t.client,queryKey:t.queryKey,pageParam:k,direction:D?"backward":"forward",meta:t.options.meta};return P(v),v})(),h=await B(N),{maxPages:b}=t.options,x=D?Tb:Ab;return{pages:x(U.pages,h,b),pageParams:x(U.pageParams,k,b)}};if(s&&a.length){const U=s==="backward",k=U?Nb:jd,D={pages:a,pageParams:o},_=k(r,D);i=await C(D,_,U)}else{const U=e??a.length;do{const k=c===0?o[0]??r.initialPageParam:jd(r,i);if(c>0&&k==null)break;i=await C(i,k),c++}while(c<U)}return i};t.options.persister?t.fetchFn=()=>{var g,P;return(P=(g=t.options).persister)==null?void 0:P.call(g,l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=l}}}function jd(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Nb(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var _b=(Hh=class extends _d{constructor(t){super();Z(this,Vt);Z(this,ja);Z(this,qt);Z(this,Xe);Z(this,Pr);K(this,ja,t.client),this.mutationId=t.mutationId,K(this,Xe,t.mutationCache),K(this,qt,[]),this.state=t.state||qd(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){I(this,qt).includes(t)||(I(this,qt).push(t),this.clearGcTimeout(),I(this,Xe).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){K(this,qt,I(this,qt).filter(n=>n!==t)),this.scheduleGc(),I(this,Xe).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){I(this,qt).length||(this.state.status==="pending"?this.scheduleGc():I(this,Xe).remove(this))}continue(){var t;return((t=I(this,Pr))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,i,c,l,d,p,f,m,y,g,P,B,C,U,k,D,_,N,h,b;const n=()=>{ae(this,Vt,Gn).call(this,{type:"continue"})},r={client:I(this,ja),meta:this.options.meta,mutationKey:this.options.mutationKey};K(this,Pr,Nd({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(x,v)=>{ae(this,Vt,Gn).call(this,{type:"failed",failureCount:x,error:v})},onPause:()=>{ae(this,Vt,Gn).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>I(this,Xe).canRun(this)}));const s=this.state.status==="pending",a=!I(this,Pr).canStart();try{if(s)n();else{ae(this,Vt,Gn).call(this,{type:"pending",variables:t,isPaused:a}),await((i=(o=I(this,Xe).config).onMutate)==null?void 0:i.call(o,t,this,r));const v=await((l=(c=this.options).onMutate)==null?void 0:l.call(c,t,r));v!==this.state.context&&ae(this,Vt,Gn).call(this,{type:"pending",context:v,variables:t,isPaused:a})}const x=await I(this,Pr).start();return await((p=(d=I(this,Xe).config).onSuccess)==null?void 0:p.call(d,x,t,this.state.context,this,r)),await((m=(f=this.options).onSuccess)==null?void 0:m.call(f,x,t,this.state.context,r)),await((g=(y=I(this,Xe).config).onSettled)==null?void 0:g.call(y,x,null,this.state.variables,this.state.context,this,r)),await((B=(P=this.options).onSettled)==null?void 0:B.call(P,x,null,t,this.state.context,r)),ae(this,Vt,Gn).call(this,{type:"success",data:x}),x}catch(x){try{throw await((U=(C=I(this,Xe).config).onError)==null?void 0:U.call(C,x,t,this.state.context,this,r)),await((D=(k=this.options).onError)==null?void 0:D.call(k,x,t,this.state.context,r)),await((N=(_=I(this,Xe).config).onSettled)==null?void 0:N.call(_,void 0,x,this.state.variables,this.state.context,this,r)),await((b=(h=this.options).onSettled)==null?void 0:b.call(h,void 0,x,t,this.state.context,r)),x}finally{ae(this,Vt,Gn).call(this,{type:"error",error:x})}}finally{I(this,Xe).runNext(this)}}},ja=new WeakMap,qt=new WeakMap,Xe=new WeakMap,Pr=new WeakMap,Vt=new WeakSet,Gn=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,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{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Fe.batch(()=>{I(this,qt).forEach(r=>{r.onMutationUpdate(t)}),I(this,Xe).notify({mutation:this,type:"updated",action:t})})},Hh);function qd(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var zb=(Gh=class extends Fr{constructor(t={}){super();Z(this,mn);Z(this,Mt);Z(this,qa);this.config=t,K(this,mn,new Set),K(this,Mt,new Map),K(this,qa,0)}build(t,n,r){const s=new _b({client:t,mutationCache:this,mutationId:++Mi(this,qa)._,options:t.defaultMutationOptions(n),state:r});return this.add(s),s}add(t){I(this,mn).add(t);const n=to(t);if(typeof n=="string"){const r=I(this,Mt).get(n);r?r.push(t):I(this,Mt).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(I(this,mn).delete(t)){const n=to(t);if(typeof n=="string"){const r=I(this,Mt).get(n);if(r)if(r.length>1){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}else r[0]===t&&I(this,Mt).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=to(t);if(typeof n=="string"){const r=I(this,Mt).get(n),s=r==null?void 0:r.find(a=>a.state.status==="pending");return!s||s===t}else return!0}runNext(t){var r;const n=to(t);if(typeof n=="string"){const s=(r=I(this,Mt).get(n))==null?void 0:r.find(a=>a!==t&&a.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Fe.batch(()=>{I(this,mn).forEach(t=>{this.notify({type:"removed",mutation:t})}),I(this,mn).clear(),I(this,Mt).clear()})}getAll(){return Array.from(I(this,mn))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Ud(n,r))}findAll(t={}){return this.getAll().filter(n=>Ud(t,n))}notify(t){Fe.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Fe.batch(()=>Promise.all(t.map(n=>n.continue().catch(Ve))))}},mn=new WeakMap,Mt=new WeakMap,qa=new WeakMap,Gh);function to(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Rb=(jh=class extends Fr{constructor(t,n){super();Z(this,yn);Z(this,hn);Z(this,zn);Z(this,st);Z(this,bn);K(this,hn,t),this.setOptions(n),this.bindMethods(),ae(this,yn,Ni).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var r;const n=this.options;this.options=I(this,hn).defaultMutationOptions(t),Ja(this.options,n)||I(this,hn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:I(this,st),observer:this}),n!=null&&n.mutationKey&&this.options.mutationKey&&Zn(n.mutationKey)!==Zn(this.options.mutationKey)?this.reset():((r=I(this,st))==null?void 0:r.state.status)==="pending"&&I(this,st).setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=I(this,st))==null||t.removeObserver(this)}onMutationUpdate(t){ae(this,yn,Ni).call(this),ae(this,yn,ed).call(this,t)}getCurrentResult(){return I(this,zn)}reset(){var t;(t=I(this,st))==null||t.removeObserver(this),K(this,st,void 0),ae(this,yn,Ni).call(this),ae(this,yn,ed).call(this)}mutate(t,n){var r;return K(this,bn,n),(r=I(this,st))==null||r.removeObserver(this),K(this,st,I(this,hn).getMutationCache().build(I(this,hn),this.options)),I(this,st).addObserver(this),I(this,st).execute(t)}},hn=new WeakMap,zn=new WeakMap,st=new WeakMap,bn=new WeakMap,yn=new WeakSet,Ni=function(){var n;const t=((n=I(this,st))==null?void 0:n.state)??qd();K(this,zn,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},ed=function(t){Fe.batch(()=>{var n,r,s,a,o,i,c,l;if(I(this,bn)&&this.hasListeners()){const d=I(this,zn).variables,p=I(this,zn).context,f={client:I(this,hn),meta:this.options.meta,mutationKey:this.options.mutationKey};(t==null?void 0:t.type)==="success"?((r=(n=I(this,bn)).onSuccess)==null||r.call(n,t.data,d,p,f),(a=(s=I(this,bn)).onSettled)==null||a.call(s,t.data,null,d,p,f)):(t==null?void 0:t.type)==="error"&&((i=(o=I(this,bn)).onError)==null||i.call(o,t.error,d,p,f),(l=(c=I(this,bn)).onSettled)==null||l.call(c,void 0,t.error,d,p,f))}this.listeners.forEach(d=>{d(I(this,zn))})})},jh),Lb=(qh=class extends Fr{constructor(t={}){super();Z(this,Kt);this.config=t,K(this,Kt,new Map)}build(t,n,r){const s=n.queryKey,a=n.queryHash??tc(s,n);let o=this.get(a);return o||(o=new Fb({client:t,queryKey:s,queryHash:a,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){I(this,Kt).has(t.queryHash)||(I(this,Kt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=I(this,Kt).get(t.queryHash);n&&(t.destroy(),n===t&&I(this,Kt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Fe.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return I(this,Kt).get(t)}getAll(){return[...I(this,Kt).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Bd(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Bd(t,r)):n}notify(t){Fe.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Fe.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Fe.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Kt=new WeakMap,qh),$b=(Vh=class{constructor(e={}){Z(this,Ce);Z(this,Rn);Z(this,Ln);Z(this,ks);Z(this,Cs);Z(this,$n);Z(this,vs);Z(this,As);K(this,Ce,e.queryCache||new Lb),K(this,Rn,e.mutationCache||new zb),K(this,Ln,e.defaultOptions||{}),K(this,ks,new Map),K(this,Cs,new Map),K(this,$n,0)}mount(){Mi(this,$n)._++,I(this,$n)===1&&(K(this,vs,ac.subscribe(async e=>{e&&(await this.resumePausedMutations(),I(this,Ce).onFocus())})),K(this,As,eo.subscribe(async e=>{e&&(await this.resumePausedMutations(),I(this,Ce).onOnline())})))}unmount(){var e,t;Mi(this,$n)._--,I(this,$n)===0&&((e=I(this,vs))==null||e.call(this),K(this,vs,void 0),(t=I(this,As))==null||t.call(this),K(this,As,void 0))}isFetching(e){return I(this,Ce).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return I(this,Rn).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=I(this,Ce).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=I(this,Ce).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(wn(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return I(this,Ce).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),s=I(this,Ce).get(r.queryHash),a=s==null?void 0:s.state.data,o=kb(t,a);if(o!==void 0)return I(this,Ce).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return Fe.batch(()=>I(this,Ce).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=I(this,Ce).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=I(this,Ce);Fe.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=I(this,Ce);return Fe.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Fe.batch(()=>I(this,Ce).findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(Ve).catch(Ve)}invalidateQueries(e,t={}){return Fe.batch(()=>(I(this,Ce).findAll(e).forEach(n=>{n.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 n={...t,cancelRefetch:t.cancelRefetch??!0},r=Fe.batch(()=>I(this,Ce).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let a=s.fetch(void 0,n);return n.throwOnError||(a=a.catch(Ve)),s.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(r).then(Ve)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=I(this,Ce).build(this,t);return n.isStaleByTime(wn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ve).catch(Ve)}fetchInfiniteQuery(e){return e.behavior=Gd(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ve).catch(Ve)}ensureInfiniteQueryData(e){return e.behavior=Gd(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return eo.isOnline()?I(this,Rn).resumePausedMutations():Promise.resolve()}getQueryCache(){return I(this,Ce)}getMutationCache(){return I(this,Rn)}getDefaultOptions(){return I(this,Ln)}setDefaultOptions(e){K(this,Ln,e)}setQueryDefaults(e,t){I(this,ks).set(Zn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...I(this,ks).values()],n={};return t.forEach(r=>{Ps(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){I(this,Cs).set(Zn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...I(this,Cs).values()],n={};return t.forEach(r=>{Ps(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...I(this,Ln).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=tc(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===Ya&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...I(this,Ln).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){I(this,Ce).clear(),I(this,Rn).clear()}},Ce=new WeakMap,Rn=new WeakMap,Ln=new WeakMap,ks=new WeakMap,Cs=new WeakMap,$n=new WeakMap,vs=new WeakMap,As=new WeakMap,Vh),Vd=Ie.createContext(void 0),uc=e=>{const t=Ie.useContext(Vd);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Hb=({client:e,children:t})=>(Ie.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),se.jsx(Vd.Provider,{value:e,children:t})),Kd=Ie.createContext(!1),Gb=()=>Ie.useContext(Kd);Kd.Provider;function jb(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var qb=Ie.createContext(jb()),Vb=()=>Ie.useContext(qb),Kb=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},Wb=e=>{Ie.useEffect(()=>{e.clearReset()},[e])},Xb=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||Dd(n,[e.error,r])),Zb=e=>{if(e.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...s)=>n(r(...s)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Qb=(e,t)=>e.isLoading&&e.isFetching&&!t,Jb=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Wd=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Yb(e,t,n){var p,f,m,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 r=Gb(),s=Vb(),a=uc(),o=a.defaultQueryOptions(e);(f=(p=a.getDefaultOptions().queries)==null?void 0:p._experimental_beforeQuery)==null||f.call(p,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=r?"isRestoring":"optimistic",Zb(o),Kb(o,s),Wb(s);const i=!a.getQueryCache().get(o.queryHash),[c]=Ie.useState(()=>new t(a,o)),l=c.getOptimisticResult(o),d=!r&&e.subscribed!==!1;if(Ie.useSyncExternalStore(Ie.useCallback(P=>{const B=d?c.subscribe(Fe.batchCalls(P)):Ve;return c.updateResult(),B},[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),Ie.useEffect(()=>{c.setOptions(o)},[o,c]),Jb(o,l))throw Wd(o,c,s);if(Xb({result:l,errorResetBoundary:s,throwOnError:o.throwOnError,query:a.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw l.error;if((y=(m=a.getDefaultOptions().queries)==null?void 0:m._experimental_afterQuery)==null||y.call(m,o,l),o.experimental_prefetchInRender&&!Xn&&Qb(l,r)){const P=i?Wd(o,c,s):(g=a.getQueryCache().get(o.queryHash))==null?void 0:g.promise;P==null||P.catch(Ve).finally(()=>{c.updateResult()})}return o.notifyOnChangeProps?l:c.trackResult(l)}function ey(e,t){return Yb(e,Ob)}function Qt(e,t){const n=uc(),[r]=Ie.useState(()=>new Rb(n,e));Ie.useEffect(()=>{r.setOptions(e)},[r,e]);const s=Ie.useSyncExternalStore(Ie.useCallback(o=>r.subscribe(Fe.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=Ie.useCallback((o,i)=>{r.mutate(o,i).catch(Ve)},[r]);if(s.error&&Dd(r.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:a,mutateAsync:s.mutate}}const ty=L.createContext(null),dc={didCatch:!1,error:null};class ny extends L.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=dc}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){const{error:t}=this.state;if(t!==null){for(var n,r,s=arguments.length,a=new Array(s),o=0;o<s;o++)a[o]=arguments[o];(n=(r=this.props).onReset)===null||n===void 0||n.call(r,{args:a,reason:"imperative-api"}),this.setState(dc)}}componentDidCatch(t,n){var r,s;(r=(s=this.props).onError)===null||r===void 0||r.call(s,t,n)}componentDidUpdate(t,n){const{didCatch:r}=this.state,{resetKeys:s}=this.props;if(r&&n.error!==null&&ry(t.resetKeys,s)){var a,o;(a=(o=this.props).onReset)===null||a===void 0||a.call(o,{next:s,prev:t.resetKeys,reason:"keys"}),this.setState(dc)}}render(){const{children:t,fallbackRender:n,FallbackComponent:r,fallback:s}=this.props,{didCatch:a,error:o}=this.state;let i=t;if(a){const c={error:o,resetErrorBoundary:this.resetErrorBoundary};if(typeof n=="function")i=n(c);else if(r)i=L.createElement(r,c);else if(s!==void 0)i=s;else throw o}return L.createElement(ty.Provider,{value:{didCatch:a,error:o,resetErrorBoundary:this.resetErrorBoundary}},i)}}function ry(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((n,r)=>!Object.is(n,t[r]))}const Xd=e=>{let t;const n=new Set,r=(l,d)=>{const p=typeof l=="function"?l(t):l;if(!Object.is(p,t)){const f=t;t=d??(typeof p!="object"||p===null)?p:Object.assign({},t,p),n.forEach(m=>m(t,f))}},s=()=>t,i={setState:r,getState:s,getInitialState:()=>c,subscribe:l=>(n.add(l),()=>n.delete(l))},c=t=e(r,s,i);return i},sy=(e=>e?Xd(e):Xd),ay=e=>e;function oy(e,t=ay){const n=L.useSyncExternalStore(e.subscribe,L.useCallback(()=>t(e.getState()),[e,t]),L.useCallback(()=>t(e.getInitialState()),[e,t]));return L.useDebugValue(n),n}const Zd=e=>{const t=sy(e),n=r=>oy(t,r);return Object.assign(n,t),n},iy=(e=>e?Zd(e):Zd),no={},Qd={currentTime:Date.now(),swapExecutions:[no],swapExecutionIndex:0},re=iy((e,t)=>({state:Qd,updateState:n=>e(r=>({state:{...r.state,...n}})),updateSwapExecutionAtIndex:(n,r)=>e(s=>{const a=[...s.state.swapExecutions];return a[n]={...a[n]??no,...r},{state:{...s.state,swapExecutions:a}}}),resetSwapExecutionAtIndex:()=>e(n=>{const r=[...n.state.swapExecutions];return r[n.state.swapExecutionIndex]=no,{state:{...n.state,swapExecutions:r}}}),resetState:()=>{const n=t().state;e({state:{...Qd,currentTime:Date.now(),isMarketOrder:n.isMarketOrder,swapExecutions:[...n.swapExecutions,no],swapExecutionIndex:n.swapExecutionIndex+1}})}})),Bs=()=>{const e=re(a=>a.state.swapExecutionIndex),t=re(a=>a.state.swapExecutions[a.state.swapExecutionIndex]??{}),n=re(a=>a.updateSwapExecutionAtIndex),r=re(a=>a.resetSwapExecutionAtIndex),s=L.useCallback(a=>n(e,a),[n,e]);return L.useMemo(()=>({...t,update:s,resetSwap:r}),[t,s,r])};var At=(e=>(e[e.LOADING=1]="LOADING",e[e.SUCCESS=2]="SUCCESS",e[e.FAILED=3]="FAILED",e))(At||{}),En=(e=>(e.WRAP="wrap",e.APPROVE="approve",e.CREATE="create",e))(En||{});const cy="1.2.3";let Qe=class td extends Error{constructor(t,n={}){var o;const r=n.cause instanceof td?n.cause.details:(o=n.cause)!=null&&o.message?n.cause.message:n.details,s=n.cause instanceof td&&n.cause.docsPath||n.docsPath,a=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: https://abitype.dev${s}`]:[],...r?[`Details: ${r}`]:[],`Version: abitype@${cy}`].join(`
64
+ `,extractResults:p=>{var f;return(((f=p.data)==null?void 0:f.orderFilleds)||[]).map(m=>({...m,timestamp:new Date(m.timestamp).getTime()}))}})};class fb extends Error{constructor(){super("No graph endpoint found"),this.name="NoGraphEndpointError"}}const mb=async({chainId:e,signal:t,page:n,limit:r,filters:s})=>{try{const a=await ub({chainId:e,signal:t,page:n,limit:r,filters:s}),[o,i]=await Promise.all([pb({chainId:e,orders:a,signal:t}),db({chainId:e,orders:a,signal:t})]),c=a.map(d=>{const p=o==null?void 0:o.filter(f=>f.TWAP_id===Number(d.Contract_id)&&qn(f.exchange,d.exchange)&&qn(f.twapAddress,d.twapAddress));return cb(d,e,p,hb(d,p||[],i))}).sort((d,p)=>p.createdAt-d.createdAt),l=new Set;return c.filter(d=>l.has(d.id)?!1:(l.add(d.id),!0))}catch{return[]}},hb=(e,t,n)=>{var i;const r=(i=n==null?void 0:n.find(c=>c.twapId===e.Contract_id.toString()&&qn(c.twapAddress,e.twapAddress)))==null?void 0:i.status,a=Ad(t).reduce((c,l)=>c.plus(l.inAmount),new R(0)).toFixed(),o=Sd(e.ask_srcAmount,a);return bb(o,e.ask_deadline*1e3,r)},Sd=(e,t)=>{if(!t||!e)return 0;const n=R(t).dividedBy(e).toNumber();return n>=.99?100:n<=0?0:Number((n*100).toFixed(2))},bb=(e,t,n)=>e===100?ze.Completed:n==="CANCELLED"?ze.Cancelled:n==="COMPLETED"?ze.Completed:t>Date.now()?ze.Open:ze.Expired,yb=async({signal:e,page:t,chainId:n,limit:r,config:s,account:a,isDev:o=!1})=>(await Promise.all([s?mb({chainId:n,signal:e,page:t,limit:r,filters:{accounts:[a],configs:s.twapConfig?[s.twapConfig]:[]}}):Promise.resolve([]),ob({chainId:n,signal:e,account:a,exchange:s==null?void 0:s.adapter,isDev:o})]).then(([l,d])=>[...l,...d])).sort((l,d)=>d.createdAt-l.createdAt),xb={version:"1.1.11"};var Fr=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(){}},gb={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},wb=(Nh=class{constructor(){Z(this,jt,gb);Z(this,gr,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&I(this,gr)&&e!==I(this,jt)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:I(this,jt),provider:e}),K(this,jt,e),process.env.NODE_ENV!=="production"&&K(this,gr,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&K(this,gr,!0),I(this,jt).setTimeout(e,t)}clearTimeout(e){I(this,jt).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&K(this,gr,!0),I(this,jt).setInterval(e,t)}clearInterval(e){I(this,jt).clearInterval(e)}},jt=new WeakMap,gr=new WeakMap,Nh),Wn=new wb;function Eb(e){setTimeout(e,0)}var Xn=typeof window>"u"||"Deno"in globalThis;function Ve(){}function kb(e,t){return typeof e=="function"?e(t):e}function ec(e){return typeof e=="number"&&e>=0&&e!==1/0}function Pd(e,t){return Math.max(e+(t||0)-Date.now(),0)}function wn(e,t){return typeof e=="function"?e(t):e}function xt(e,t){return typeof e=="function"?e(t):e}function Bd(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:a,queryKey:o,stale:i}=e;if(o){if(r){if(t.queryHash!==tc(o,t.options))return!1}else if(!Ps(t.queryKey,o))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof i=="boolean"&&t.isStale()!==i||s&&s!==t.state.fetchStatus||a&&!a(t))}function Ud(e,t){const{exact:n,status:r,predicate:s,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(Zn(t.options.mutationKey)!==Zn(a))return!1}else if(!Ps(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function tc(e,t){return((t==null?void 0:t.queryKeyHashFn)||Zn)(e)}function Zn(e){return JSON.stringify(e,(t,n)=>rc(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function Ps(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Ps(e[n],t[n])):!1}var Cb=Object.prototype.hasOwnProperty;function nc(e,t){if(e===t)return e;const n=Id(e)&&Id(t);if(!n&&!(rc(e)&&rc(t)))return t;const s=(n?e:Object.keys(e)).length,a=n?t:Object.keys(t),o=a.length,i=n?new Array(o):{};let c=0;for(let l=0;l<o;l++){const d=n?l:a[l],p=e[d],f=t[d];if(p===f){i[d]=p,(n?l<s:Cb.call(e,d))&&c++;continue}if(p===null||f===null||typeof p!="object"||typeof f!="object"){i[d]=f;continue}const m=nc(p,f);i[d]=m,m===p&&c++}return s===o&&c===s?e:i}function Ja(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function Id(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function rc(e){if(!Fd(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Fd(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Fd(e){return Object.prototype.toString.call(e)==="[object Object]"}function vb(e){return new Promise(t=>{Wn.setTimeout(t,e)})}function sc(e,t,n){if(typeof n.structuralSharing=="function")return n.structuralSharing(e,t);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return nc(e,t)}catch(r){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. [${n.queryHash}]: ${r}`),r}return nc(e,t)}return t}function Ab(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function Tb(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Ya=Symbol();function Od(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Ya&&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===Ya?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Dd(e,t){return typeof e=="function"?e(...t):!!e}var Sb=(_h=class extends Fr{constructor(){super();Z(this,wr);Z(this,Dn);Z(this,ms);K(this,ms,t=>{if(!Xn&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){I(this,Dn)||this.setEventListener(I(this,ms))}onUnsubscribe(){var t;this.hasListeners()||((t=I(this,Dn))==null||t.call(this),K(this,Dn,void 0))}setEventListener(t){var n;K(this,ms,t),(n=I(this,Dn))==null||n.call(this),K(this,Dn,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){I(this,wr)!==t&&(K(this,wr,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof I(this,wr)=="boolean"?I(this,wr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},wr=new WeakMap,Dn=new WeakMap,ms=new WeakMap,_h),ac=new Sb;function oc(){let e,t;const n=new Promise((s,a)=>{e=s,t=a});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},n.reject=s=>{r({status:"rejected",reason:s}),t(s)},n}var Pb=Eb;function Bb(){let e=[],t=0,n=i=>{i()},r=i=>{i()},s=Pb;const a=i=>{t?e.push(i):s(()=>{n(i)})},o=()=>{const i=e;e=[],i.length&&s(()=>{r(()=>{i.forEach(c=>{n(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=>{n=i},setBatchNotifyFunction:i=>{r=i},setScheduler:i=>{s=i}}}var Fe=Bb(),Ub=(zh=class extends Fr{constructor(){super();Z(this,hs,!0);Z(this,Mn);Z(this,bs);K(this,bs,t=>{if(!Xn&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){I(this,Mn)||this.setEventListener(I(this,bs))}onUnsubscribe(){var t;this.hasListeners()||((t=I(this,Mn))==null||t.call(this),K(this,Mn,void 0))}setEventListener(t){var n;K(this,bs,t),(n=I(this,Mn))==null||n.call(this),K(this,Mn,t(this.setOnline.bind(this)))}setOnline(t){I(this,hs)!==t&&(K(this,hs,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return I(this,hs)}},hs=new WeakMap,Mn=new WeakMap,bs=new WeakMap,zh),eo=new Ub;function Ib(e){return Math.min(1e3*2**e,3e4)}function Md(e){return(e??"online")==="online"?eo.isOnline():!0}var ic=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Nd(e){let t=!1,n=0,r;const s=oc(),a=()=>s.status!=="pending",o=g=>{var P;if(!a()){const B=new ic(g);f(B),(P=e.onCancel)==null||P.call(e,B)}},i=()=>{t=!0},c=()=>{t=!1},l=()=>ac.isFocused()&&(e.networkMode==="always"||eo.isOnline())&&e.canRun(),d=()=>Md(e.networkMode)&&e.canRun(),p=g=>{a()||(r==null||r(),s.resolve(g))},f=g=>{a()||(r==null||r(),s.reject(g))},m=()=>new Promise(g=>{var P;r=B=>{(a()||l())&&g(B)},(P=e.onPause)==null||P.call(e)}).then(()=>{var g;r=void 0,a()||(g=e.onContinue)==null||g.call(e)}),y=()=>{if(a())return;let g;const P=n===0?e.initialPromise:void 0;try{g=P??e.fn()}catch(B){g=Promise.reject(B)}Promise.resolve(g).then(p).catch(B=>{var _;if(a())return;const C=e.retry??(Xn?0:3),U=e.retryDelay??Ib,k=typeof U=="function"?U(n,B):U,D=C===!0||typeof C=="number"&&n<C||typeof C=="function"&&C(n,B);if(t||!D){f(B);return}n++,(_=e.onFail)==null||_.call(e,n,B),vb(k).then(()=>l()?void 0:m()).then(()=>{t?f(B):y()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(r==null||r(),s),cancelRetry:i,continueRetry:c,canStart:d,start:()=>(d()?y():m().then(y),s)}}var _d=(Rh=class{constructor(){Z(this,Er)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ec(this.gcTime)&&K(this,Er,Wn.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Xn?1/0:300*1e3))}clearGcTimeout(){I(this,Er)&&(Wn.clearTimeout(I(this,Er)),K(this,Er,void 0))}},Er=new WeakMap,Rh),Fb=(Lh=class extends _d{constructor(t){super();Z(this,Dt);Z(this,kr);Z(this,ys);Z(this,kt);Z(this,Cr);Z(this,_e);Z(this,$a);Z(this,vr);K(this,vr,!1),K(this,$a,t.defaultOptions),this.setOptions(t.options),this.observers=[],K(this,Cr,t.client),K(this,kt,I(this,Cr).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,K(this,kr,Ld(this.options)),this.state=t.state??I(this,kr),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=I(this,_e))==null?void 0:t.promise}setOptions(t){if(this.options={...I(this,$a),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=Ld(this.options);n.data!==void 0&&(this.setState(Rd(n.data,n.dataUpdatedAt)),K(this,kr,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&I(this,kt).remove(this)}setData(t,n){const r=sc(this.state.data,t,this.options);return ae(this,Dt,xn).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){ae(this,Dt,xn).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,s;const n=(r=I(this,_e))==null?void 0:r.promise;return(s=I(this,_e))==null||s.cancel(t),n?n.then(Ve).catch(Ve):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(I(this,kr))}isActive(){return this.observers.some(t=>xt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ya||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>wn(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:!Pd(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=I(this,_e))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=I(this,_e))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),I(this,kt).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(I(this,_e)&&(I(this,vr)?I(this,_e).cancel({revert:!0}):I(this,_e).cancelRetry()),this.scheduleGc()),I(this,kt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ae(this,Dt,xn).call(this,{type:"invalidate"})}async fetch(t,n){var c,l,d,p,f,m,y,g,P,B,C,U;if(this.state.fetchStatus!=="idle"&&((c=I(this,_e))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(I(this,_e))return I(this,_e).continueRetry(),I(this,_e).promise}if(t&&this.setOptions(t),!this.options.queryFn){const k=this.observers.find(D=>D.options.queryFn);k&&this.setOptions(k.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 r=new AbortController,s=k=>{Object.defineProperty(k,"signal",{enumerable:!0,get:()=>(K(this,vr,!0),r.signal)})},a=()=>{const k=Od(this.options,n),_=(()=>{const N={client:I(this,Cr),queryKey:this.queryKey,meta:this.meta};return s(N),N})();return K(this,vr,!1),this.options.persister?this.options.persister(k,_,this):k(_)},i=(()=>{const k={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:I(this,Cr),state:this.state,fetchFn:a};return s(k),k})();(l=this.options.behavior)==null||l.onFetch(i,this),K(this,ys,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=i.fetchOptions)==null?void 0:d.meta))&&ae(this,Dt,xn).call(this,{type:"fetch",meta:(p=i.fetchOptions)==null?void 0:p.meta}),K(this,_e,Nd({initialPromise:n==null?void 0:n.initialPromise,fn:i.fetchFn,onCancel:k=>{k instanceof ic&&k.revert&&this.setState({...I(this,ys),fetchStatus:"idle"}),r.abort()},onFail:(k,D)=>{ae(this,Dt,xn).call(this,{type:"failed",failureCount:k,error:D})},onPause:()=>{ae(this,Dt,xn).call(this,{type:"pause"})},onContinue:()=>{ae(this,Dt,xn).call(this,{type:"continue"})},retry:i.options.retry,retryDelay:i.options.retryDelay,networkMode:i.options.networkMode,canRun:()=>!0}));try{const k=await I(this,_e).start();if(k===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(k),(m=(f=I(this,kt).config).onSuccess)==null||m.call(f,k,this),(g=(y=I(this,kt).config).onSettled)==null||g.call(y,k,this.state.error,this),k}catch(k){if(k instanceof ic){if(k.silent)return I(this,_e).promise;if(k.revert){if(this.state.data===void 0)throw k;return this.state.data}}throw ae(this,Dt,xn).call(this,{type:"error",error:k}),(B=(P=I(this,kt).config).onError)==null||B.call(P,k,this),(U=(C=I(this,kt).config).onSettled)==null||U.call(C,this.state.data,k,this),k}finally{this.scheduleGc()}}},kr=new WeakMap,ys=new WeakMap,kt=new WeakMap,Cr=new WeakMap,_e=new WeakMap,$a=new WeakMap,vr=new WeakMap,Dt=new WeakSet,xn=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...zd(r.data,this.options),fetchMeta:t.meta??null};case"success":const s={...r,...Rd(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return K(this,ys,t.manual?s:void 0),s;case"error":const a=t.error;return{...r,error:a,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Fe.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),I(this,kt).notify({query:this,type:"updated",action:t})})},Lh);function zd(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Md(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Rd(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Ld(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Ob=($h=class extends Fr{constructor(t,n){super();Z(this,me);Z(this,rt);Z(this,de);Z(this,Ha);Z(this,We);Z(this,Ar);Z(this,xs);Z(this,fn);Z(this,Nn);Z(this,Ga);Z(this,gs);Z(this,ws);Z(this,Tr);Z(this,Sr);Z(this,_n);Z(this,Es,new Set);this.options=n,K(this,rt,t),K(this,Nn,null),K(this,fn,oc()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(I(this,de).addObserver(this),$d(I(this,de),this.options)?ae(this,me,Va).call(this):this.updateResult(),ae(this,me,Zu).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return cc(I(this,de),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return cc(I(this,de),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,ae(this,me,Qu).call(this),ae(this,me,Ju).call(this),I(this,de).removeObserver(this)}setOptions(t){const n=this.options,r=I(this,de);if(this.options=I(this,rt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof xt(this.options.enabled,I(this,de))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");ae(this,me,Yu).call(this),I(this,de).setOptions(this.options),n._defaulted&&!Ja(this.options,n)&&I(this,rt).getQueryCache().notify({type:"observerOptionsUpdated",query:I(this,de),observer:this});const s=this.hasListeners();s&&Hd(I(this,de),r,this.options,n)&&ae(this,me,Va).call(this),this.updateResult(),s&&(I(this,de)!==r||xt(this.options.enabled,I(this,de))!==xt(n.enabled,I(this,de))||wn(this.options.staleTime,I(this,de))!==wn(n.staleTime,I(this,de)))&&ae(this,me,Ku).call(this);const a=ae(this,me,Wu).call(this);s&&(I(this,de)!==r||xt(this.options.enabled,I(this,de))!==xt(n.enabled,I(this,de))||a!==I(this,_n))&&ae(this,me,Xu).call(this,a)}getOptimisticResult(t){const n=I(this,rt).getQueryCache().build(I(this,rt),t),r=this.createResult(n,t);return Mb(this,r)&&(K(this,We,r),K(this,xs,this.options),K(this,Ar,I(this,de).state)),r}getCurrentResult(){return I(this,We)}trackResult(t,n){return new Proxy(t,{get:(r,s)=>(this.trackProp(s),n==null||n(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&I(this,fn).status==="pending"&&I(this,fn).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,s))})}trackProp(t){I(this,Es).add(t)}getCurrentQuery(){return I(this,de)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=I(this,rt).defaultQueryOptions(t),r=I(this,rt).getQueryCache().build(I(this,rt),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return ae(this,me,Va).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),I(this,We)))}createResult(t,n){var b;const r=I(this,de),s=this.options,a=I(this,We),o=I(this,Ar),i=I(this,xs),l=t!==r?t.state:I(this,Ha),{state:d}=t;let p={...d},f=!1,m;if(n._optimisticResults){const x=this.hasListeners(),v=!x&&$d(t,n),E=x&&Hd(t,r,n,s);(v||E)&&(p={...p,...zd(d.data,t.options)}),n._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:y,errorUpdatedAt:g,status:P}=p;m=p.data;let B=!1;if(n.placeholderData!==void 0&&m===void 0&&P==="pending"){let x;a!=null&&a.isPlaceholderData&&n.placeholderData===(i==null?void 0:i.placeholderData)?(x=a.data,B=!0):x=typeof n.placeholderData=="function"?n.placeholderData((b=I(this,ws))==null?void 0:b.state.data,I(this,ws)):n.placeholderData,x!==void 0&&(P="success",m=sc(a==null?void 0:a.data,x,n),f=!0)}if(n.select&&m!==void 0&&!B)if(a&&m===(o==null?void 0:o.data)&&n.select===I(this,Ga))m=I(this,gs);else try{K(this,Ga,n.select),m=n.select(m),m=sc(a==null?void 0:a.data,m,n),K(this,gs,m),K(this,Nn,null)}catch(x){K(this,Nn,x)}I(this,Nn)&&(y=I(this,Nn),m=I(this,gs),g=Date.now(),P="error");const C=p.fetchStatus==="fetching",U=P==="pending",k=P==="error",D=U&&C,_=m!==void 0,h={status:P,fetchStatus:p.fetchStatus,isPending:U,isSuccess:P==="success",isError:k,isInitialLoading:D,isLoading:D,data:m,dataUpdatedAt:p.dataUpdatedAt,error:y,errorUpdatedAt:g,failureCount:p.fetchFailureCount,failureReason:p.fetchFailureReason,errorUpdateCount:p.errorUpdateCount,isFetched:p.dataUpdateCount>0||p.errorUpdateCount>0,isFetchedAfterMount:p.dataUpdateCount>l.dataUpdateCount||p.errorUpdateCount>l.errorUpdateCount,isFetching:C,isRefetching:C&&!U,isLoadingError:k&&!_,isPaused:p.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:k&&_,isStale:lc(t,n),refetch:this.refetch,promise:I(this,fn),isEnabled:xt(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const x=T=>{h.status==="error"?T.reject(h.error):h.data!==void 0&&T.resolve(h.data)},v=()=>{const T=K(this,fn,h.promise=oc());x(T)},E=I(this,fn);switch(E.status){case"pending":t.queryHash===r.queryHash&&x(E);break;case"fulfilled":(h.status==="error"||h.data!==E.value)&&v();break;case"rejected":(h.status!=="error"||h.error!==E.reason)&&v();break}}return h}updateResult(){const t=I(this,We),n=this.createResult(I(this,de),this.options);if(K(this,Ar,I(this,de).state),K(this,xs,this.options),I(this,Ar).data!==void 0&&K(this,ws,I(this,de)),Ja(n,t))return;K(this,We,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!I(this,Es).size)return!0;const o=new Set(a??I(this,Es));return this.options.throwOnError&&o.add("error"),Object.keys(I(this,We)).some(i=>{const c=i;return I(this,We)[c]!==t[c]&&o.has(c)})};ae(this,me,Wh).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&ae(this,me,Zu).call(this)}},rt=new WeakMap,de=new WeakMap,Ha=new WeakMap,We=new WeakMap,Ar=new WeakMap,xs=new WeakMap,fn=new WeakMap,Nn=new WeakMap,Ga=new WeakMap,gs=new WeakMap,ws=new WeakMap,Tr=new WeakMap,Sr=new WeakMap,_n=new WeakMap,Es=new WeakMap,me=new WeakSet,Va=function(t){ae(this,me,Yu).call(this);let n=I(this,de).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Ve)),n},Ku=function(){ae(this,me,Qu).call(this);const t=wn(this.options.staleTime,I(this,de));if(Xn||I(this,We).isStale||!ec(t))return;const r=Pd(I(this,We).dataUpdatedAt,t)+1;K(this,Tr,Wn.setTimeout(()=>{I(this,We).isStale||this.updateResult()},r))},Wu=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(I(this,de)):this.options.refetchInterval)??!1},Xu=function(t){ae(this,me,Ju).call(this),K(this,_n,t),!(Xn||xt(this.options.enabled,I(this,de))===!1||!ec(I(this,_n))||I(this,_n)===0)&&K(this,Sr,Wn.setInterval(()=>{(this.options.refetchIntervalInBackground||ac.isFocused())&&ae(this,me,Va).call(this)},I(this,_n)))},Zu=function(){ae(this,me,Ku).call(this),ae(this,me,Xu).call(this,ae(this,me,Wu).call(this))},Qu=function(){I(this,Tr)&&(Wn.clearTimeout(I(this,Tr)),K(this,Tr,void 0))},Ju=function(){I(this,Sr)&&(Wn.clearInterval(I(this,Sr)),K(this,Sr,void 0))},Yu=function(){const t=I(this,rt).getQueryCache().build(I(this,rt),this.options);if(t===I(this,de))return;const n=I(this,de);K(this,de,t),K(this,Ha,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Wh=function(t){Fe.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(I(this,We))}),I(this,rt).getQueryCache().notify({query:I(this,de),type:"observerResultsUpdated"})})},$h);function Db(e,t){return xt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function $d(e,t){return Db(e,t)||e.state.data!==void 0&&cc(e,t,t.refetchOnMount)}function cc(e,t,n){if(xt(t.enabled,e)!==!1&&wn(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&lc(e,t)}return!1}function Hd(e,t,n,r){return(e!==t||xt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&lc(e,n)}function lc(e,t){return xt(t.enabled,e)!==!1&&e.isStaleByTime(wn(t.staleTime,e))}function Mb(e,t){return!Ja(e.getCurrentResult(),t)}function Gd(e){return{onFetch:(t,n)=>{var d,p,f,m,y;const r=t.options,s=(f=(p=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:p.fetchMore)==null?void 0:f.direction,a=((m=t.state.data)==null?void 0:m.pages)||[],o=((y=t.state.data)==null?void 0:y.pageParams)||[];let i={pages:[],pageParams:[]},c=0;const l=async()=>{let g=!1;const P=U=>{Object.defineProperty(U,"signal",{enumerable:!0,get:()=>(t.signal.aborted?g=!0:t.signal.addEventListener("abort",()=>{g=!0}),t.signal)})},B=Od(t.options,t.fetchOptions),C=async(U,k,D)=>{if(g)return Promise.reject();if(k==null&&U.pages.length)return Promise.resolve(U);const N=(()=>{const v={client:t.client,queryKey:t.queryKey,pageParam:k,direction:D?"backward":"forward",meta:t.options.meta};return P(v),v})(),h=await B(N),{maxPages:b}=t.options,x=D?Tb:Ab;return{pages:x(U.pages,h,b),pageParams:x(U.pageParams,k,b)}};if(s&&a.length){const U=s==="backward",k=U?Nb:jd,D={pages:a,pageParams:o},_=k(r,D);i=await C(D,_,U)}else{const U=e??a.length;do{const k=c===0?o[0]??r.initialPageParam:jd(r,i);if(c>0&&k==null)break;i=await C(i,k),c++}while(c<U)}return i};t.options.persister?t.fetchFn=()=>{var g,P;return(P=(g=t.options).persister)==null?void 0:P.call(g,l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=l}}}function jd(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Nb(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var _b=(Hh=class extends _d{constructor(t){super();Z(this,Vt);Z(this,ja);Z(this,qt);Z(this,Xe);Z(this,Pr);K(this,ja,t.client),this.mutationId=t.mutationId,K(this,Xe,t.mutationCache),K(this,qt,[]),this.state=t.state||qd(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){I(this,qt).includes(t)||(I(this,qt).push(t),this.clearGcTimeout(),I(this,Xe).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){K(this,qt,I(this,qt).filter(n=>n!==t)),this.scheduleGc(),I(this,Xe).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){I(this,qt).length||(this.state.status==="pending"?this.scheduleGc():I(this,Xe).remove(this))}continue(){var t;return((t=I(this,Pr))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,i,c,l,d,p,f,m,y,g,P,B,C,U,k,D,_,N,h,b;const n=()=>{ae(this,Vt,Gn).call(this,{type:"continue"})},r={client:I(this,ja),meta:this.options.meta,mutationKey:this.options.mutationKey};K(this,Pr,Nd({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(x,v)=>{ae(this,Vt,Gn).call(this,{type:"failed",failureCount:x,error:v})},onPause:()=>{ae(this,Vt,Gn).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>I(this,Xe).canRun(this)}));const s=this.state.status==="pending",a=!I(this,Pr).canStart();try{if(s)n();else{ae(this,Vt,Gn).call(this,{type:"pending",variables:t,isPaused:a}),await((i=(o=I(this,Xe).config).onMutate)==null?void 0:i.call(o,t,this,r));const v=await((l=(c=this.options).onMutate)==null?void 0:l.call(c,t,r));v!==this.state.context&&ae(this,Vt,Gn).call(this,{type:"pending",context:v,variables:t,isPaused:a})}const x=await I(this,Pr).start();return await((p=(d=I(this,Xe).config).onSuccess)==null?void 0:p.call(d,x,t,this.state.context,this,r)),await((m=(f=this.options).onSuccess)==null?void 0:m.call(f,x,t,this.state.context,r)),await((g=(y=I(this,Xe).config).onSettled)==null?void 0:g.call(y,x,null,this.state.variables,this.state.context,this,r)),await((B=(P=this.options).onSettled)==null?void 0:B.call(P,x,null,t,this.state.context,r)),ae(this,Vt,Gn).call(this,{type:"success",data:x}),x}catch(x){try{throw await((U=(C=I(this,Xe).config).onError)==null?void 0:U.call(C,x,t,this.state.context,this,r)),await((D=(k=this.options).onError)==null?void 0:D.call(k,x,t,this.state.context,r)),await((N=(_=I(this,Xe).config).onSettled)==null?void 0:N.call(_,void 0,x,this.state.variables,this.state.context,this,r)),await((b=(h=this.options).onSettled)==null?void 0:b.call(h,void 0,x,t,this.state.context,r)),x}finally{ae(this,Vt,Gn).call(this,{type:"error",error:x})}}finally{I(this,Xe).runNext(this)}}},ja=new WeakMap,qt=new WeakMap,Xe=new WeakMap,Pr=new WeakMap,Vt=new WeakSet,Gn=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,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{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Fe.batch(()=>{I(this,qt).forEach(r=>{r.onMutationUpdate(t)}),I(this,Xe).notify({mutation:this,type:"updated",action:t})})},Hh);function qd(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var zb=(Gh=class extends Fr{constructor(t={}){super();Z(this,mn);Z(this,Mt);Z(this,qa);this.config=t,K(this,mn,new Set),K(this,Mt,new Map),K(this,qa,0)}build(t,n,r){const s=new _b({client:t,mutationCache:this,mutationId:++Mi(this,qa)._,options:t.defaultMutationOptions(n),state:r});return this.add(s),s}add(t){I(this,mn).add(t);const n=to(t);if(typeof n=="string"){const r=I(this,Mt).get(n);r?r.push(t):I(this,Mt).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(I(this,mn).delete(t)){const n=to(t);if(typeof n=="string"){const r=I(this,Mt).get(n);if(r)if(r.length>1){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}else r[0]===t&&I(this,Mt).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=to(t);if(typeof n=="string"){const r=I(this,Mt).get(n),s=r==null?void 0:r.find(a=>a.state.status==="pending");return!s||s===t}else return!0}runNext(t){var r;const n=to(t);if(typeof n=="string"){const s=(r=I(this,Mt).get(n))==null?void 0:r.find(a=>a!==t&&a.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Fe.batch(()=>{I(this,mn).forEach(t=>{this.notify({type:"removed",mutation:t})}),I(this,mn).clear(),I(this,Mt).clear()})}getAll(){return Array.from(I(this,mn))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Ud(n,r))}findAll(t={}){return this.getAll().filter(n=>Ud(t,n))}notify(t){Fe.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Fe.batch(()=>Promise.all(t.map(n=>n.continue().catch(Ve))))}},mn=new WeakMap,Mt=new WeakMap,qa=new WeakMap,Gh);function to(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Rb=(jh=class extends Fr{constructor(t,n){super();Z(this,yn);Z(this,hn);Z(this,zn);Z(this,st);Z(this,bn);K(this,hn,t),this.setOptions(n),this.bindMethods(),ae(this,yn,Ni).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var r;const n=this.options;this.options=I(this,hn).defaultMutationOptions(t),Ja(this.options,n)||I(this,hn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:I(this,st),observer:this}),n!=null&&n.mutationKey&&this.options.mutationKey&&Zn(n.mutationKey)!==Zn(this.options.mutationKey)?this.reset():((r=I(this,st))==null?void 0:r.state.status)==="pending"&&I(this,st).setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=I(this,st))==null||t.removeObserver(this)}onMutationUpdate(t){ae(this,yn,Ni).call(this),ae(this,yn,ed).call(this,t)}getCurrentResult(){return I(this,zn)}reset(){var t;(t=I(this,st))==null||t.removeObserver(this),K(this,st,void 0),ae(this,yn,Ni).call(this),ae(this,yn,ed).call(this)}mutate(t,n){var r;return K(this,bn,n),(r=I(this,st))==null||r.removeObserver(this),K(this,st,I(this,hn).getMutationCache().build(I(this,hn),this.options)),I(this,st).addObserver(this),I(this,st).execute(t)}},hn=new WeakMap,zn=new WeakMap,st=new WeakMap,bn=new WeakMap,yn=new WeakSet,Ni=function(){var n;const t=((n=I(this,st))==null?void 0:n.state)??qd();K(this,zn,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},ed=function(t){Fe.batch(()=>{var n,r,s,a,o,i,c,l;if(I(this,bn)&&this.hasListeners()){const d=I(this,zn).variables,p=I(this,zn).context,f={client:I(this,hn),meta:this.options.meta,mutationKey:this.options.mutationKey};(t==null?void 0:t.type)==="success"?((r=(n=I(this,bn)).onSuccess)==null||r.call(n,t.data,d,p,f),(a=(s=I(this,bn)).onSettled)==null||a.call(s,t.data,null,d,p,f)):(t==null?void 0:t.type)==="error"&&((i=(o=I(this,bn)).onError)==null||i.call(o,t.error,d,p,f),(l=(c=I(this,bn)).onSettled)==null||l.call(c,void 0,t.error,d,p,f))}this.listeners.forEach(d=>{d(I(this,zn))})})},jh),Lb=(qh=class extends Fr{constructor(t={}){super();Z(this,Kt);this.config=t,K(this,Kt,new Map)}build(t,n,r){const s=n.queryKey,a=n.queryHash??tc(s,n);let o=this.get(a);return o||(o=new Fb({client:t,queryKey:s,queryHash:a,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){I(this,Kt).has(t.queryHash)||(I(this,Kt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=I(this,Kt).get(t.queryHash);n&&(t.destroy(),n===t&&I(this,Kt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Fe.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return I(this,Kt).get(t)}getAll(){return[...I(this,Kt).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Bd(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Bd(t,r)):n}notify(t){Fe.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Fe.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Fe.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Kt=new WeakMap,qh),$b=(Vh=class{constructor(e={}){Z(this,Ce);Z(this,Rn);Z(this,Ln);Z(this,ks);Z(this,Cs);Z(this,$n);Z(this,vs);Z(this,As);K(this,Ce,e.queryCache||new Lb),K(this,Rn,e.mutationCache||new zb),K(this,Ln,e.defaultOptions||{}),K(this,ks,new Map),K(this,Cs,new Map),K(this,$n,0)}mount(){Mi(this,$n)._++,I(this,$n)===1&&(K(this,vs,ac.subscribe(async e=>{e&&(await this.resumePausedMutations(),I(this,Ce).onFocus())})),K(this,As,eo.subscribe(async e=>{e&&(await this.resumePausedMutations(),I(this,Ce).onOnline())})))}unmount(){var e,t;Mi(this,$n)._--,I(this,$n)===0&&((e=I(this,vs))==null||e.call(this),K(this,vs,void 0),(t=I(this,As))==null||t.call(this),K(this,As,void 0))}isFetching(e){return I(this,Ce).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return I(this,Rn).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=I(this,Ce).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=I(this,Ce).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(wn(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return I(this,Ce).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),s=I(this,Ce).get(r.queryHash),a=s==null?void 0:s.state.data,o=kb(t,a);if(o!==void 0)return I(this,Ce).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return Fe.batch(()=>I(this,Ce).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=I(this,Ce).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=I(this,Ce);Fe.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=I(this,Ce);return Fe.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Fe.batch(()=>I(this,Ce).findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(Ve).catch(Ve)}invalidateQueries(e,t={}){return Fe.batch(()=>(I(this,Ce).findAll(e).forEach(n=>{n.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 n={...t,cancelRefetch:t.cancelRefetch??!0},r=Fe.batch(()=>I(this,Ce).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let a=s.fetch(void 0,n);return n.throwOnError||(a=a.catch(Ve)),s.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(r).then(Ve)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=I(this,Ce).build(this,t);return n.isStaleByTime(wn(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ve).catch(Ve)}fetchInfiniteQuery(e){return e.behavior=Gd(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ve).catch(Ve)}ensureInfiniteQueryData(e){return e.behavior=Gd(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return eo.isOnline()?I(this,Rn).resumePausedMutations():Promise.resolve()}getQueryCache(){return I(this,Ce)}getMutationCache(){return I(this,Rn)}getDefaultOptions(){return I(this,Ln)}setDefaultOptions(e){K(this,Ln,e)}setQueryDefaults(e,t){I(this,ks).set(Zn(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...I(this,ks).values()],n={};return t.forEach(r=>{Ps(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){I(this,Cs).set(Zn(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...I(this,Cs).values()],n={};return t.forEach(r=>{Ps(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...I(this,Ln).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=tc(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===Ya&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...I(this,Ln).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){I(this,Ce).clear(),I(this,Rn).clear()}},Ce=new WeakMap,Rn=new WeakMap,Ln=new WeakMap,ks=new WeakMap,Cs=new WeakMap,$n=new WeakMap,vs=new WeakMap,As=new WeakMap,Vh),Vd=Ie.createContext(void 0),uc=e=>{const t=Ie.useContext(Vd);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Hb=({client:e,children:t})=>(Ie.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),se.jsx(Vd.Provider,{value:e,children:t})),Kd=Ie.createContext(!1),Gb=()=>Ie.useContext(Kd);Kd.Provider;function jb(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var qb=Ie.createContext(jb()),Vb=()=>Ie.useContext(qb),Kb=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},Wb=e=>{Ie.useEffect(()=>{e.clearReset()},[e])},Xb=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||Dd(n,[e.error,r])),Zb=e=>{if(e.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...s)=>n(r(...s)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Qb=(e,t)=>e.isLoading&&e.isFetching&&!t,Jb=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Wd=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Yb(e,t,n){var p,f,m,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 r=Gb(),s=Vb(),a=uc(),o=a.defaultQueryOptions(e);(f=(p=a.getDefaultOptions().queries)==null?void 0:p._experimental_beforeQuery)==null||f.call(p,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=r?"isRestoring":"optimistic",Zb(o),Kb(o,s),Wb(s);const i=!a.getQueryCache().get(o.queryHash),[c]=Ie.useState(()=>new t(a,o)),l=c.getOptimisticResult(o),d=!r&&e.subscribed!==!1;if(Ie.useSyncExternalStore(Ie.useCallback(P=>{const B=d?c.subscribe(Fe.batchCalls(P)):Ve;return c.updateResult(),B},[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),Ie.useEffect(()=>{c.setOptions(o)},[o,c]),Jb(o,l))throw Wd(o,c,s);if(Xb({result:l,errorResetBoundary:s,throwOnError:o.throwOnError,query:a.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw l.error;if((y=(m=a.getDefaultOptions().queries)==null?void 0:m._experimental_afterQuery)==null||y.call(m,o,l),o.experimental_prefetchInRender&&!Xn&&Qb(l,r)){const P=i?Wd(o,c,s):(g=a.getQueryCache().get(o.queryHash))==null?void 0:g.promise;P==null||P.catch(Ve).finally(()=>{c.updateResult()})}return o.notifyOnChangeProps?l:c.trackResult(l)}function ey(e,t){return Yb(e,Ob)}function Qt(e,t){const n=uc(),[r]=Ie.useState(()=>new Rb(n,e));Ie.useEffect(()=>{r.setOptions(e)},[r,e]);const s=Ie.useSyncExternalStore(Ie.useCallback(o=>r.subscribe(Fe.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=Ie.useCallback((o,i)=>{r.mutate(o,i).catch(Ve)},[r]);if(s.error&&Dd(r.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:a,mutateAsync:s.mutate}}const ty=L.createContext(null),dc={didCatch:!1,error:null};class ny extends L.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=dc}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){const{error:t}=this.state;if(t!==null){for(var n,r,s=arguments.length,a=new Array(s),o=0;o<s;o++)a[o]=arguments[o];(n=(r=this.props).onReset)===null||n===void 0||n.call(r,{args:a,reason:"imperative-api"}),this.setState(dc)}}componentDidCatch(t,n){var r,s;(r=(s=this.props).onError)===null||r===void 0||r.call(s,t,n)}componentDidUpdate(t,n){const{didCatch:r}=this.state,{resetKeys:s}=this.props;if(r&&n.error!==null&&ry(t.resetKeys,s)){var a,o;(a=(o=this.props).onReset)===null||a===void 0||a.call(o,{next:s,prev:t.resetKeys,reason:"keys"}),this.setState(dc)}}render(){const{children:t,fallbackRender:n,FallbackComponent:r,fallback:s}=this.props,{didCatch:a,error:o}=this.state;let i=t;if(a){const c={error:o,resetErrorBoundary:this.resetErrorBoundary};if(typeof n=="function")i=n(c);else if(r)i=L.createElement(r,c);else if(s!==void 0)i=s;else throw o}return L.createElement(ty.Provider,{value:{didCatch:a,error:o,resetErrorBoundary:this.resetErrorBoundary}},i)}}function ry(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((n,r)=>!Object.is(n,t[r]))}const Xd=e=>{let t;const n=new Set,r=(l,d)=>{const p=typeof l=="function"?l(t):l;if(!Object.is(p,t)){const f=t;t=d??(typeof p!="object"||p===null)?p:Object.assign({},t,p),n.forEach(m=>m(t,f))}},s=()=>t,i={setState:r,getState:s,getInitialState:()=>c,subscribe:l=>(n.add(l),()=>n.delete(l))},c=t=e(r,s,i);return i},sy=(e=>e?Xd(e):Xd),ay=e=>e;function oy(e,t=ay){const n=L.useSyncExternalStore(e.subscribe,L.useCallback(()=>t(e.getState()),[e,t]),L.useCallback(()=>t(e.getInitialState()),[e,t]));return L.useDebugValue(n),n}const Zd=e=>{const t=sy(e),n=r=>oy(t,r);return Object.assign(n,t),n},iy=(e=>e?Zd(e):Zd),no={},Qd={currentTime:Date.now(),swapExecutions:[no],swapExecutionIndex:0},re=iy((e,t)=>({state:Qd,updateState:n=>e(r=>({state:{...r.state,...n}})),updateSwapExecutionAtIndex:(n,r)=>e(s=>{const a=[...s.state.swapExecutions];return a[n]={...a[n]??no,...r},{state:{...s.state,swapExecutions:a}}}),resetSwapExecutionAtIndex:()=>e(n=>{const r=[...n.state.swapExecutions];return r[n.state.swapExecutionIndex]=no,{state:{...n.state,swapExecutions:r}}}),resetState:()=>{const n=t().state;e({state:{...Qd,currentTime:Date.now(),isMarketOrder:n.isMarketOrder,swapExecutions:[...n.swapExecutions,no],swapExecutionIndex:n.swapExecutionIndex+1}})}})),Bs=()=>{const e=re(a=>a.state.swapExecutionIndex),t=re(a=>a.state.swapExecutions[a.state.swapExecutionIndex]??{}),n=re(a=>a.updateSwapExecutionAtIndex),r=re(a=>a.resetSwapExecutionAtIndex),s=L.useCallback(a=>n(e,a),[n,e]);return L.useMemo(()=>({...t,update:s,resetSwap:r}),[t,s,r])};var At=(e=>(e[e.LOADING=1]="LOADING",e[e.SUCCESS=2]="SUCCESS",e[e.FAILED=3]="FAILED",e))(At||{}),En=(e=>(e.WRAP="wrap",e.APPROVE="approve",e.CREATE="create",e))(En||{});const cy="1.2.3";let Qe=class td extends Error{constructor(t,n={}){var o;const r=n.cause instanceof td?n.cause.details:(o=n.cause)!=null&&o.message?n.cause.message:n.details,s=n.cause instanceof td&&n.cause.docsPath||n.docsPath,a=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: https://abitype.dev${s}`]:[],...r?[`Details: ${r}`]:[],`Version: abitype@${cy}`].join(`
65
65
  `);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"}),n.cause&&(this.cause=n.cause),this.details=r,this.docsPath=s,this.metaMessages=n.metaMessages,this.shortMessage=t}};function Jt(e,t){const n=e.exec(t);return n==null?void 0:n.groups}const Jd=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Yd=/^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)?$/,ep=/^\(.+?\).*?$/,tp=/^tuple(?<array>(\[(\d*)\])*)$/;function pc(e){let t=e.type;if(tp.test(e.type)&&"components"in e){t="(";const n=e.components.length;for(let s=0;s<n;s++){const a=e.components[s];t+=pc(a),s<n-1&&(t+=", ")}const r=Jt(tp,e.type);return t+=`)${(r==null?void 0:r.array)||""}`,pc({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function Or(e){let t="";const n=e.length;for(let r=0;r<n;r++){const s=e[r];t+=pc(s),r!==n-1&&(t+=", ")}return t}function ro(e){var t;return e.type==="function"?`function ${e.name}(${Or(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${(t=e.outputs)!=null&&t.length?` returns (${Or(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${Or(e.inputs)})`:e.type==="error"?`error ${e.name}(${Or(e.inputs)})`:e.type==="constructor"?`constructor(${Or(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const np=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function ly(e){return np.test(e)}function uy(e){return Jt(np,e)}const rp=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function dy(e){return rp.test(e)}function py(e){return Jt(rp,e)}const sp=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function fy(e){return sp.test(e)}function my(e){return Jt(sp,e)}const ap=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function so(e){return ap.test(e)}function hy(e){return Jt(ap,e)}const op=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function by(e){return op.test(e)}function yy(e){return Jt(op,e)}const ip=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function xy(e){return ip.test(e)}function gy(e){return Jt(ip,e)}const wy=/^receive\(\) external payable$/;function Ey(e){return wy.test(e)}const cp=new Set(["memory","indexed","storage","calldata"]),ky=new Set(["indexed"]),fc=new Set(["calldata","memory","storage"]);class Cy extends Qe{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 vy extends Qe{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 Ay extends Qe{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 Ty extends Qe{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 Sy extends Qe{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class Py extends Qe{constructor({param:t,name:n}){super("Invalid ABI parameter.",{details:t,metaMessages:[`"${n}" 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 By extends Qe{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class Uy extends Qe{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${r}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class Iy extends Qe{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 Dr extends Qe{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class Fy extends Qe{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class Oy extends Qe{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 Dy extends Qe{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 My extends Qe{constructor({current:t,depth:n}){super("Unbalanced parentheses.",{metaMessages:[`"${t.trim()}" has too many ${n>0?"opening":"closing"} parentheses.`],details:`Depth "${n}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function Ny(e,t,n){let r="";if(n)for(const s of Object.entries(n)){if(!s)continue;let a="";for(const o of s[1])a+=`[${o.type}${o.name?`:${o.name}`:""}]`;r+=`(${s[0]}{${a}})`}return t?`${t}:${e}${r}`:`${e}${r}`}const mc=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 hc(e,t={}){if(fy(e))return _y(e,t);if(dy(e))return zy(e,t);if(ly(e))return Ry(e,t);if(by(e))return Ly(e,t);if(xy(e))return $y(e);if(Ey(e))return{type:"receive",stateMutability:"payable"};throw new Fy({signature:e})}function _y(e,t={}){const n=my(e);if(!n)throw new Dr({signature:e,type:"function"});const r=ot(n.parameters),s=[],a=r.length;for(let i=0;i<a;i++)s.push(Yt(r[i],{modifiers:fc,structs:t,type:"function"}));const o=[];if(n.returns){const i=ot(n.returns),c=i.length;for(let l=0;l<c;l++)o.push(Yt(i[l],{modifiers:fc,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:s,outputs:o}}function zy(e,t={}){const n=py(e);if(!n)throw new Dr({signature:e,type:"event"});const r=ot(n.parameters),s=[],a=r.length;for(let o=0;o<a;o++)s.push(Yt(r[o],{modifiers:ky,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:s}}function Ry(e,t={}){const n=uy(e);if(!n)throw new Dr({signature:e,type:"error"});const r=ot(n.parameters),s=[],a=r.length;for(let o=0;o<a;o++)s.push(Yt(r[o],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:s}}function Ly(e,t={}){const n=yy(e);if(!n)throw new Dr({signature:e,type:"constructor"});const r=ot(n.parameters),s=[],a=r.length;for(let o=0;o<a;o++)s.push(Yt(r[o],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:s}}function $y(e){const t=gy(e);if(!t)throw new Dr({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const Hy=/^(?<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$_]*))?$/,Gy=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,jy=/^u?int$/;function Yt(e,t){var p,f;const n=Ny(e,t==null?void 0:t.type,t==null?void 0:t.structs);if(mc.has(n))return mc.get(n);const r=ep.test(e),s=Jt(r?Gy:Hy,e);if(!s)throw new Sy({param:e});if(s.name&&Vy(s.name))throw new Py({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(r){c="tuple";const m=ot(s.type),y=[],g=m.length;for(let P=0;P<g;P++)y.push(Yt(m[P],{structs:i}));l={components:y}}else if(s.type in i)c="tuple",l={components:i[s.type]};else if(jy.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"&&!lp(c))throw new Ay({type:c});if(s.modifier){if(!((f=(p=t==null?void 0:t.modifiers)==null?void 0:p.has)!=null&&f.call(p,s.modifier)))throw new By({param:e,type:t==null?void 0:t.type,modifier:s.modifier});if(fc.has(s.modifier)&&!Ky(c,!!s.array))throw new Uy({param:e,type:t==null?void 0:t.type,modifier:s.modifier})}const d={type:`${c}${s.array??""}`,...a,...o,...l};return mc.set(n,d),d}function ot(e,t=[],n="",r=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 r===0?ot(i,[...t,n.trim()]):ot(i,t,`${n}${o}`,r);case"(":return ot(i,t,`${n}${o}`,r+1);case")":return ot(i,t,`${n}${o}`,r-1);default:return ot(i,t,`${n}${o}`,r)}}if(n==="")return t;if(r!==0)throw new My({current:n,depth:r});return t.push(n.trim()),t}function lp(e){return e==="address"||e==="bool"||e==="function"||e==="string"||Jd.test(e)||Yd.test(e)}const qy=/^(?: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 Vy(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||Jd.test(e)||Yd.test(e)||qy.test(e)}function Ky(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function bc(e){const t={},n=e.length;for(let o=0;o<n;o++){const i=e[o];if(!so(i))continue;const c=hy(i);if(!c)throw new Dr({signature:i,type:"struct"});const l=c.properties.split(";"),d=[],p=l.length;for(let f=0;f<p;f++){const y=l[f].trim();if(!y)continue;const g=Yt(y,{type:"struct"});d.push(g)}if(!d.length)throw new Oy({signature:i});t[c.name]=d}const r={},s=Object.entries(t),a=s.length;for(let o=0;o<a;o++){const[i,c]=s[o];r[i]=up(c,t)}return r}const Wy=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function up(e=[],t={},n=new Set){const r=[],s=e.length;for(let a=0;a<s;a++){const o=e[a];if(ep.test(o.type))r.push(o);else{const c=Jt(Wy,o.type);if(!(c!=null&&c.type))throw new Iy({abiParameter:o});const{array:l,type:d}=c;if(d in t){if(n.has(d))throw new Dy({type:d});r.push({...o,type:`tuple${l??""}`,components:up(t[d],t,new Set([...n,d]))})}else if(lp(d))r.push(o);else throw new vy({type:d})}}return r}function dp(e){const t=bc(e),n=[],r=e.length;for(let s=0;s<r;s++){const a=e[s];so(a)||n.push(hc(a,t))}return n}function pp(e){let t;if(typeof e=="string")t=hc(e);else{const n=bc(e),r=e.length;for(let s=0;s<r;s++){const a=e[s];if(!so(a)){t=hc(a,n);break}}}if(!t)throw new Cy({signature:e});return t}function fp(e){const t=[];if(typeof e=="string"){const n=ot(e),r=n.length;for(let s=0;s<r;s++)t.push(Yt(n[s],{modifiers:cp}))}else{const n=bc(e),r=e.length;for(let s=0;s<r;s++){const a=e[s];if(so(a))continue;const o=ot(a),i=o.length;for(let c=0;c<i;c++)t.push(Yt(o[c],{modifiers:cp,structs:n}))}}if(t.length===0)throw new Ty({params:e});return t}function W(e,t,n){const r=e[t.name];if(typeof r=="function")return r;const s=e[n];return typeof s=="function"?s:a=>t(e,a)}function Tt(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new c6(e.type);return`${e.name}(${ao(e.inputs,{includeName:t})})`}function ao(e,{includeName:t=!1}={}){return e?e.map(n=>Xy(n,{includeName:t})).join(t?", ":","):""}function Xy(e,{includeName:t}){return e.type.startsWith("tuple")?`(${ao(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function St(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function we(e){return St(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const mp="2.43.3";let Us={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${mp}`},z=class nd extends Error{constructor(t,n={}){var i;const r=(()=>{var c;return n.cause instanceof nd?n.cause.details:(c=n.cause)!=null&&c.message?n.cause.message:n.details})(),s=n.cause instanceof nd&&n.cause.docsPath||n.docsPath,a=(i=Us.getDocsUrl)==null?void 0:i.call(Us,{...n,docsPath:s}),o=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...a?[`Docs: ${a}`]:[],...r?[`Details: ${r}`]:[],...Us.version?[`Version: ${Us.version}`]:[]].join(`
66
66
  `);super(o,n.cause?{cause:n.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=r,this.docsPath=s,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=mp}walk(t){return hp(this,t)}};function hp(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?hp(e.cause,t):t?null:e}class Zy extends z{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(`
67
67
  `),{docsPath:t,name:"AbiConstructorNotFoundError"})}}class bp extends z{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": "1.1.10",
3
+ "version": "1.1.11",
4
4
  "description": "Spot React Components - React components for Spot SDK",
5
5
  "type": "module",
6
6
  "main": "./dist/spot-react.umd.cjs",