@orbs-network/spot-react 0.0.20 → 0.0.21
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.
- package/dist/{ccip-BsP3sOmP.js → ccip-DCn7SCg6.js} +1 -1
- package/dist/{index-JG9komnp.js → index-CTa7tQT1.js} +110 -22
- package/dist/package.json.d.ts +1 -1
- package/dist/spot-react.js +1 -1
- package/dist/spot-react.umd.cjs +2 -2
- package/dist/src/components/orders/order-preview.d.ts.map +1 -1
- package/dist/src/hooks/use-invert-trade-panel.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/spot-react.umd.cjs
CHANGED
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
dollarValueOut
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
`,extractResults:l=>{var d;return(((d=l.data)==null?void 0:d.orderFilleds)||[]).map(p=>({...p,timestamp:new Date(p.timestamp).getTime()}))}})};let P3=class extends Error{constructor(){super("No graph endpoint found"),this.name="NoGraphEndpointError"}};const I3=async({chainId:e,signal:t,page:n,limit:r,filters:a})=>{const s=await C3({chainId:e,signal:t,page:n,limit:r,filters:a}),[o,i]=await Promise.all([S3({chainId:e,orders:s,signal:t}),A3({chainId:e,orders:s,signal:t})]);return s.map(c=>{const l=o==null?void 0:o.filter(d=>d.TWAP_id===Number(c.Contract_id)&&za(d.exchange,c.exchange)&&za(d.twapAddress,c.twapAddress));return E3(c,e,l,B3(c,l||[],i))}).sort((c,l)=>l.createdAt-c.createdAt)},B3=(e,t,n)=>{var r;const a=(r=n==null?void 0:n.find(i=>i.twapId===e.Contract_id.toString()&&za(i.twapAddress,e.twapAddress)))==null?void 0:r.status,{filledSrcAmount:s}=Hh(t),o=jh(e.ask_srcAmount,s);return O3(o,e.ask_deadline*1e3,a)},jh=(e,t)=>{if(!t||!e)return 0;const n=le(t).dividedBy(e).toNumber();return n>=.99?100:n<=0?0:Number((n*100).toFixed(2))},O3=(e,t,n)=>e===100?tt.Completed:n==="CANCELED"?tt.Canceled:n==="COMPLETED"?tt.Completed:t>Date.now()?tt.Open:tt.Expired,Vh=async({signal:e,page:t,chainId:n,limit:r,config:a,account:s})=>(await Promise.all([a?I3({chainId:n,signal:e,page:t,limit:r,filters:{accounts:[s],configs:[a]}}):Promise.resolve([]),w3({chainId:n,signal:e,account:s})]).then(([o,i])=>[...o,...i])).sort((o,i)=>i.createdAt-o.createdAt),Wh=e=>{let t;const n=new Set,r=(l,d)=>{const p=typeof l=="function"?l(t):l;if(!Object.is(p,t)){const h=t;t=d??(typeof p!="object"||p===null)?p:Object.assign({},t,p),n.forEach(y=>y(t,h))}},a=()=>t,i={setState:r,getState:a,getInitialState:()=>c,subscribe:l=>(n.add(l),()=>n.delete(l))},c=t=e(r,a,i);return i},F3=(e=>e?Wh(e):Wh),U3=e=>e;function D3(e,t=U3){const n=N.useSyncExternalStore(e.subscribe,N.useCallback(()=>t(e.getState()),[e,t]),N.useCallback(()=>t(e.getInitialState()),[e,t]));return N.useDebugValue(n),n}const qh=e=>{const t=F3(e),n=r=>D3(t,r);return Object.assign(n,t),n},_3=(e=>e?qh(e):qh),Yh={disclaimerAccepted:!0,currentTime:Date.now(),swapExecution:{}},Q=_3((e,t)=>({state:Yh,updateState:n=>e(r=>({state:{...r.state,...n}})),updateSwapExecution:n=>e(r=>({state:{...r.state,swapExecution:{...r.state.swapExecution,...n}}})),resetState:()=>{e({state:{...Yh,currentTime:Date.now(),swapExecution:t().state.swapExecution,isMarketOrder:t().state.isMarketOrder}})}})),M3={version:"0.0.20"};var Ns=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(){}},N3={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},L3=(F5=class{constructor(){me(this,kr,N3);me(this,Ts,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&z(this,Ts)&&e!==z(this,kr)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:z(this,kr),provider:e}),ne(this,kr,e),process.env.NODE_ENV!=="production"&&ne(this,Ts,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&ne(this,Ts,!0),z(this,kr).setTimeout(e,t)}clearTimeout(e){z(this,kr).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&ne(this,Ts,!0),z(this,kr).setInterval(e,t)}clearInterval(e){z(this,kr).clearInterval(e)}},kr=new WeakMap,Ts=new WeakMap,F5),Ha=new L3;function z3(e){setTimeout(e,0)}var Ga=typeof window>"u"||"Deno"in globalThis;function Yt(){}function R3(e,t){return typeof e=="function"?e(t):e}function Pd(e){return typeof e=="number"&&e>=0&&e!==1/0}function Kh(e,t){return Math.max(e+(t||0)-Date.now(),0)}function ia(e,t){return typeof e=="function"?e(t):e}function Pn(e,t){return typeof e=="function"?e(t):e}function Zh(e,t){const{type:n="all",exact:r,fetchStatus:a,predicate:s,queryKey:o,stale:i}=e;if(o){if(r){if(t.queryHash!==Id(o,t.options))return!1}else if(!jo(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||a&&a!==t.state.fetchStatus||s&&!s(t))}function Xh(e,t){const{exact:n,status:r,predicate:a,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return!1;if(n){if(ja(t.options.mutationKey)!==ja(s))return!1}else if(!jo(t.options.mutationKey,s))return!1}return!(r&&t.state.status!==r||a&&!a(t))}function Id(e,t){return((t==null?void 0:t.queryKeyHashFn)||ja)(e)}function ja(e){return JSON.stringify(e,(t,n)=>Od(n)?Object.keys(n).sort().reduce((r,a)=>(r[a]=n[a],r),{}):n)}function jo(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>jo(e[n],t[n])):!1}var $3=Object.prototype.hasOwnProperty;function Bd(e,t){if(e===t)return e;const n=Qh(e)&&Qh(t);if(!n&&!(Od(e)&&Od(t)))return t;const a=(n?e:Object.keys(e)).length,s=n?t:Object.keys(t),o=s.length,i=n?new Array(o):{};let c=0;for(let l=0;l<o;l++){const d=n?l:s[l],p=e[d],h=t[d];if(p===h){i[d]=p,(n?l<a:$3.call(e,d))&&c++;continue}if(p===null||h===null||typeof p!="object"||typeof h!="object"){i[d]=h;continue}const y=Bd(p,h);i[d]=y,y===p&&c++}return a===o&&c===a?e:i}function jc(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 Qh(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Od(e){if(!Jh(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Jh(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Jh(e){return Object.prototype.toString.call(e)==="[object Object]"}function H3(e){return new Promise(t=>{Ha.setTimeout(t,e)})}function Fd(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 Bd(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 Bd(e,t)}return t}function G3(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function j3(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Vc=Symbol();function e1(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Vc&&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===Vc?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function t1(e,t){return typeof e=="function"?e(...t):!!e}var V3=(U5=class extends Ns{constructor(){super();me(this,Cs);me(this,Ia);me(this,Bo);ne(this,Bo,t=>{if(!Ga&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){z(this,Ia)||this.setEventListener(z(this,Bo))}onUnsubscribe(){var t;this.hasListeners()||((t=z(this,Ia))==null||t.call(this),ne(this,Ia,void 0))}setEventListener(t){var n;ne(this,Bo,t),(n=z(this,Ia))==null||n.call(this),ne(this,Ia,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){z(this,Cs)!==t&&(ne(this,Cs,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof z(this,Cs)=="boolean"?z(this,Cs):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Cs=new WeakMap,Ia=new WeakMap,Bo=new WeakMap,U5),Ud=new V3;function Dd(){let e,t;const n=new Promise((a,s)=>{e=a,t=s});n.status="pending",n.catch(()=>{});function r(a){Object.assign(n,a),delete n.resolve,delete n.reject}return n.resolve=a=>{r({status:"fulfilled",value:a}),e(a)},n.reject=a=>{r({status:"rejected",reason:a}),t(a)},n}var W3=z3;function q3(){let e=[],t=0,n=i=>{i()},r=i=>{i()},a=W3;const s=i=>{t?e.push(i):a(()=>{n(i)})},o=()=>{const i=e;e=[],i.length&&a(()=>{r(()=>{i.forEach(c=>{n(c)})})})};return{batch:i=>{let c;t++;try{c=i()}finally{t--,t||o()}return c},batchCalls:i=>(...c)=>{s(()=>{i(...c)})},schedule:s,setNotifyFunction:i=>{n=i},setBatchNotifyFunction:i=>{r=i},setScheduler:i=>{a=i}}}var Ct=q3(),Y3=(D5=class extends Ns{constructor(){super();me(this,Oo,!0);me(this,Ba);me(this,Fo);ne(this,Fo,t=>{if(!Ga&&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(){z(this,Ba)||this.setEventListener(z(this,Fo))}onUnsubscribe(){var t;this.hasListeners()||((t=z(this,Ba))==null||t.call(this),ne(this,Ba,void 0))}setEventListener(t){var n;ne(this,Fo,t),(n=z(this,Ba))==null||n.call(this),ne(this,Ba,t(this.setOnline.bind(this)))}setOnline(t){z(this,Oo)!==t&&(ne(this,Oo,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return z(this,Oo)}},Oo=new WeakMap,Ba=new WeakMap,Fo=new WeakMap,D5),Wc=new Y3;function K3(e){return Math.min(1e3*2**e,3e4)}function n1(e){return(e??"online")==="online"?Wc.isOnline():!0}var _d=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function r1(e){let t=!1,n=0,r;const a=Dd(),s=()=>a.status!=="pending",o=C=>{var I;if(!s()){const P=new _d(C);h(P),(I=e.onCancel)==null||I.call(e,P)}},i=()=>{t=!0},c=()=>{t=!1},l=()=>Ud.isFocused()&&(e.networkMode==="always"||Wc.isOnline())&&e.canRun(),d=()=>n1(e.networkMode)&&e.canRun(),p=C=>{s()||(r==null||r(),a.resolve(C))},h=C=>{s()||(r==null||r(),a.reject(C))},y=()=>new Promise(C=>{var I;r=P=>{(s()||l())&&C(P)},(I=e.onPause)==null||I.call(e)}).then(()=>{var C;r=void 0,s()||(C=e.onContinue)==null||C.call(e)}),E=()=>{if(s())return;let C;const I=n===0?e.initialPromise:void 0;try{C=I??e.fn()}catch(P){C=Promise.reject(P)}Promise.resolve(C).then(p).catch(P=>{var L;if(s())return;const v=e.retry??(Ga?0:3),U=e.retryDelay??K3,O=typeof U=="function"?U(n,P):U,M=v===!0||typeof v=="number"&&n<v||typeof v=="function"&&v(n,P);if(t||!M){h(P);return}n++,(L=e.onFail)==null||L.call(e,n,P),H3(O).then(()=>l()?void 0:y()).then(()=>{t?h(P):E()})})};return{promise:a,status:()=>a.status,cancel:o,continue:()=>(r==null||r(),a),cancelRetry:i,continueRetry:c,canStart:d,start:()=>(d()?E():y().then(E),a)}}var a1=(_5=class{constructor(){me(this,As)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Pd(this.gcTime)&&ne(this,As,Ha.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ga?1/0:300*1e3))}clearGcTimeout(){z(this,As)&&(Ha.clearTimeout(z(this,As)),ne(this,As,void 0))}},As=new WeakMap,_5),Z3=(M5=class extends a1{constructor(t){super();me(this,sr);me(this,Ss);me(this,Uo);me(this,zn);me(this,Ps);me(this,Dt);me(this,Fc);me(this,Is);ne(this,Is,!1),ne(this,Fc,t.defaultOptions),this.setOptions(t.options),this.observers=[],ne(this,Ps,t.client),ne(this,zn,z(this,Ps).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,ne(this,Ss,i1(this.options)),this.state=t.state??z(this,Ss),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=z(this,Dt))==null?void 0:t.promise}setOptions(t){if(this.options={...z(this,Fc),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=i1(this.options);n.data!==void 0&&(this.setState(o1(n.data,n.dataUpdatedAt)),ne(this,Ss,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&z(this,zn).remove(this)}setData(t,n){const r=Fd(this.state.data,t,this.options);return Oe(this,sr,aa).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){Oe(this,sr,aa).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,a;const n=(r=z(this,Dt))==null?void 0:r.promise;return(a=z(this,Dt))==null||a.cancel(t),n?n.then(Yt).catch(Yt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(z(this,Ss))}isActive(){return this.observers.some(t=>Pn(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Vc||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>ia(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:!Kh(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=z(this,Dt))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=z(this,Dt))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),z(this,zn).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(z(this,Dt)&&(z(this,Is)?z(this,Dt).cancel({revert:!0}):z(this,Dt).cancelRetry()),this.scheduleGc()),z(this,zn).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Oe(this,sr,aa).call(this,{type:"invalidate"})}async fetch(t,n){var c,l,d,p,h,y,E,C,I,P,v,U;if(this.state.fetchStatus!=="idle"&&((c=z(this,Dt))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(z(this,Dt))return z(this,Dt).continueRetry(),z(this,Dt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const O=this.observers.find(M=>M.options.queryFn);O&&this.setOptions(O.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,a=O=>{Object.defineProperty(O,"signal",{enumerable:!0,get:()=>(ne(this,Is,!0),r.signal)})},s=()=>{const O=e1(this.options,n),L=(()=>{const F={client:z(this,Ps),queryKey:this.queryKey,meta:this.meta};return a(F),F})();return ne(this,Is,!1),this.options.persister?this.options.persister(O,L,this):O(L)},i=(()=>{const O={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:z(this,Ps),state:this.state,fetchFn:s};return a(O),O})();(l=this.options.behavior)==null||l.onFetch(i,this),ne(this,Uo,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=i.fetchOptions)==null?void 0:d.meta))&&Oe(this,sr,aa).call(this,{type:"fetch",meta:(p=i.fetchOptions)==null?void 0:p.meta}),ne(this,Dt,r1({initialPromise:n==null?void 0:n.initialPromise,fn:i.fetchFn,onCancel:O=>{O instanceof _d&&O.revert&&this.setState({...z(this,Uo),fetchStatus:"idle"}),r.abort()},onFail:(O,M)=>{Oe(this,sr,aa).call(this,{type:"failed",failureCount:O,error:M})},onPause:()=>{Oe(this,sr,aa).call(this,{type:"pause"})},onContinue:()=>{Oe(this,sr,aa).call(this,{type:"continue"})},retry:i.options.retry,retryDelay:i.options.retryDelay,networkMode:i.options.networkMode,canRun:()=>!0}));try{const O=await z(this,Dt).start();if(O===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(O),(y=(h=z(this,zn).config).onSuccess)==null||y.call(h,O,this),(C=(E=z(this,zn).config).onSettled)==null||C.call(E,O,this.state.error,this),O}catch(O){if(O instanceof _d){if(O.silent)return z(this,Dt).promise;if(O.revert){if(this.state.data===void 0)throw O;return this.state.data}}throw Oe(this,sr,aa).call(this,{type:"error",error:O}),(P=(I=z(this,zn).config).onError)==null||P.call(I,O,this),(U=(v=z(this,zn).config).onSettled)==null||U.call(v,this.state.data,O,this),O}finally{this.scheduleGc()}}},Ss=new WeakMap,Uo=new WeakMap,zn=new WeakMap,Ps=new WeakMap,Dt=new WeakMap,Fc=new WeakMap,Is=new WeakMap,sr=new WeakSet,aa=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,...s1(r.data,this.options),fetchMeta:t.meta??null};case"success":const a={...r,...o1(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return ne(this,Uo,t.manual?a:void 0),a;case"error":const s=t.error;return{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Ct.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),z(this,zn).notify({query:this,type:"updated",action:t})})},M5);function s1(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:n1(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function o1(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function i1(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 X3=(N5=class extends Ns{constructor(t,n){super();me(this,qe);me(this,un);me(this,Ne);me(this,Uc);me(this,Xt);me(this,Bs);me(this,Do);me(this,Jr);me(this,Oa);me(this,Dc);me(this,_o);me(this,Mo);me(this,Os);me(this,Fs);me(this,Fa);me(this,No,new Set);this.options=n,ne(this,un,t),ne(this,Oa,null),ne(this,Jr,Dd()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(z(this,Ne).addObserver(this),c1(z(this,Ne),this.options)?Oe(this,qe,Nc).call(this):this.updateResult(),Oe(this,qe,Gm).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Md(z(this,Ne),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Md(z(this,Ne),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Oe(this,qe,jm).call(this),Oe(this,qe,Vm).call(this),z(this,Ne).removeObserver(this)}setOptions(t){const n=this.options,r=z(this,Ne);if(this.options=z(this,un).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Pn(this.options.enabled,z(this,Ne))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Oe(this,qe,Wm).call(this),z(this,Ne).setOptions(this.options),n._defaulted&&!jc(this.options,n)&&z(this,un).getQueryCache().notify({type:"observerOptionsUpdated",query:z(this,Ne),observer:this});const a=this.hasListeners();a&&l1(z(this,Ne),r,this.options,n)&&Oe(this,qe,Nc).call(this),this.updateResult(),a&&(z(this,Ne)!==r||Pn(this.options.enabled,z(this,Ne))!==Pn(n.enabled,z(this,Ne))||ia(this.options.staleTime,z(this,Ne))!==ia(n.staleTime,z(this,Ne)))&&Oe(this,qe,Rm).call(this);const s=Oe(this,qe,$m).call(this);a&&(z(this,Ne)!==r||Pn(this.options.enabled,z(this,Ne))!==Pn(n.enabled,z(this,Ne))||s!==z(this,Fa))&&Oe(this,qe,Hm).call(this,s)}getOptimisticResult(t){const n=z(this,un).getQueryCache().build(z(this,un),t),r=this.createResult(n,t);return J3(this,r)&&(ne(this,Xt,r),ne(this,Do,this.options),ne(this,Bs,z(this,Ne).state)),r}getCurrentResult(){return z(this,Xt)}trackResult(t,n){return new Proxy(t,{get:(r,a)=>(this.trackProp(a),n==null||n(a),a==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&z(this,Jr).status==="pending"&&z(this,Jr).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,a))})}trackProp(t){z(this,No).add(t)}getCurrentQuery(){return z(this,Ne)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=z(this,un).defaultQueryOptions(t),r=z(this,un).getQueryCache().build(z(this,un),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return Oe(this,qe,Nc).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),z(this,Xt)))}createResult(t,n){var f;const r=z(this,Ne),a=this.options,s=z(this,Xt),o=z(this,Bs),i=z(this,Do),l=t!==r?t.state:z(this,Uc),{state:d}=t;let p={...d},h=!1,y;if(n._optimisticResults){const b=this.hasListeners(),k=!b&&c1(t,n),x=b&&l1(t,r,n,a);(k||x)&&(p={...p,...s1(d.data,t.options)}),n._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:E,errorUpdatedAt:C,status:I}=p;y=p.data;let P=!1;if(n.placeholderData!==void 0&&y===void 0&&I==="pending"){let b;s!=null&&s.isPlaceholderData&&n.placeholderData===(i==null?void 0:i.placeholderData)?(b=s.data,P=!0):b=typeof n.placeholderData=="function"?n.placeholderData((f=z(this,Mo))==null?void 0:f.state.data,z(this,Mo)):n.placeholderData,b!==void 0&&(I="success",y=Fd(s==null?void 0:s.data,b,n),h=!0)}if(n.select&&y!==void 0&&!P)if(s&&y===(o==null?void 0:o.data)&&n.select===z(this,Dc))y=z(this,_o);else try{ne(this,Dc,n.select),y=n.select(y),y=Fd(s==null?void 0:s.data,y,n),ne(this,_o,y),ne(this,Oa,null)}catch(b){ne(this,Oa,b)}z(this,Oa)&&(E=z(this,Oa),y=z(this,_o),C=Date.now(),I="error");const v=p.fetchStatus==="fetching",U=I==="pending",O=I==="error",M=U&&v,L=y!==void 0,u={status:I,fetchStatus:p.fetchStatus,isPending:U,isSuccess:I==="success",isError:O,isInitialLoading:M,isLoading:M,data:y,dataUpdatedAt:p.dataUpdatedAt,error:E,errorUpdatedAt:C,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:v,isRefetching:v&&!U,isLoadingError:O&&!L,isPaused:p.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:O&&L,isStale:Nd(t,n),refetch:this.refetch,promise:z(this,Jr),isEnabled:Pn(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const b=T=>{u.status==="error"?T.reject(u.error):u.data!==void 0&&T.resolve(u.data)},k=()=>{const T=ne(this,Jr,u.promise=Dd());b(T)},x=z(this,Jr);switch(x.status){case"pending":t.queryHash===r.queryHash&&b(x);break;case"fulfilled":(u.status==="error"||u.data!==x.value)&&k();break;case"rejected":(u.status!=="error"||u.error!==x.reason)&&k();break}}return u}updateResult(){const t=z(this,Xt),n=this.createResult(z(this,Ne),this.options);if(ne(this,Bs,z(this,Ne).state),ne(this,Do,this.options),z(this,Bs).data!==void 0&&ne(this,Mo,z(this,Ne)),jc(n,t))return;ne(this,Xt,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:a}=this.options,s=typeof a=="function"?a():a;if(s==="all"||!s&&!z(this,No).size)return!0;const o=new Set(s??z(this,No));return this.options.throwOnError&&o.add("error"),Object.keys(z(this,Xt)).some(i=>{const c=i;return z(this,Xt)[c]!==t[c]&&o.has(c)})};Oe(this,qe,Z5).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Oe(this,qe,Gm).call(this)}},un=new WeakMap,Ne=new WeakMap,Uc=new WeakMap,Xt=new WeakMap,Bs=new WeakMap,Do=new WeakMap,Jr=new WeakMap,Oa=new WeakMap,Dc=new WeakMap,_o=new WeakMap,Mo=new WeakMap,Os=new WeakMap,Fs=new WeakMap,Fa=new WeakMap,No=new WeakMap,qe=new WeakSet,Nc=function(t){Oe(this,qe,Wm).call(this);let n=z(this,Ne).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Yt)),n},Rm=function(){Oe(this,qe,jm).call(this);const t=ia(this.options.staleTime,z(this,Ne));if(Ga||z(this,Xt).isStale||!Pd(t))return;const r=Kh(z(this,Xt).dataUpdatedAt,t)+1;ne(this,Os,Ha.setTimeout(()=>{z(this,Xt).isStale||this.updateResult()},r))},$m=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(z(this,Ne)):this.options.refetchInterval)??!1},Hm=function(t){Oe(this,qe,Vm).call(this),ne(this,Fa,t),!(Ga||Pn(this.options.enabled,z(this,Ne))===!1||!Pd(z(this,Fa))||z(this,Fa)===0)&&ne(this,Fs,Ha.setInterval(()=>{(this.options.refetchIntervalInBackground||Ud.isFocused())&&Oe(this,qe,Nc).call(this)},z(this,Fa)))},Gm=function(){Oe(this,qe,Rm).call(this),Oe(this,qe,Hm).call(this,Oe(this,qe,$m).call(this))},jm=function(){z(this,Os)&&(Ha.clearTimeout(z(this,Os)),ne(this,Os,void 0))},Vm=function(){z(this,Fs)&&(Ha.clearInterval(z(this,Fs)),ne(this,Fs,void 0))},Wm=function(){const t=z(this,un).getQueryCache().build(z(this,un),this.options);if(t===z(this,Ne))return;const n=z(this,Ne);ne(this,Ne,t),ne(this,Uc,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Z5=function(t){Ct.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(z(this,Xt))}),z(this,un).getQueryCache().notify({query:z(this,Ne),type:"observerResultsUpdated"})})},N5);function Q3(e,t){return Pn(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function c1(e,t){return Q3(e,t)||e.state.data!==void 0&&Md(e,t,t.refetchOnMount)}function Md(e,t,n){if(Pn(t.enabled,e)!==!1&&ia(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Nd(e,t)}return!1}function l1(e,t,n,r){return(e!==t||Pn(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Nd(e,n)}function Nd(e,t){return Pn(t.enabled,e)!==!1&&e.isStaleByTime(ia(t.staleTime,e))}function J3(e,t){return!jc(e.getCurrentResult(),t)}function u1(e){return{onFetch:(t,n)=>{var d,p,h,y,E;const r=t.options,a=(h=(p=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:p.fetchMore)==null?void 0:h.direction,s=((y=t.state.data)==null?void 0:y.pages)||[],o=((E=t.state.data)==null?void 0:E.pageParams)||[];let i={pages:[],pageParams:[]},c=0;const l=async()=>{let C=!1;const I=U=>{Object.defineProperty(U,"signal",{enumerable:!0,get:()=>(t.signal.aborted?C=!0:t.signal.addEventListener("abort",()=>{C=!0}),t.signal)})},P=e1(t.options,t.fetchOptions),v=async(U,O,M)=>{if(C)return Promise.reject();if(O==null&&U.pages.length)return Promise.resolve(U);const F=(()=>{const k={client:t.client,queryKey:t.queryKey,pageParam:O,direction:M?"backward":"forward",meta:t.options.meta};return I(k),k})(),u=await P(F),{maxPages:f}=t.options,b=M?j3:G3;return{pages:b(U.pages,u,f),pageParams:b(U.pageParams,O,f)}};if(a&&s.length){const U=a==="backward",O=U?e8:d1,M={pages:s,pageParams:o},L=O(r,M);i=await v(M,L,U)}else{const U=e??s.length;do{const O=c===0?o[0]??r.initialPageParam:d1(r,i);if(c>0&&O==null)break;i=await v(i,O),c++}while(c<U)}return i};t.options.persister?t.fetchFn=()=>{var C,I;return(I=(C=t.options).persister)==null?void 0:I.call(C,l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=l}}}function d1(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 e8(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 t8=(L5=class extends a1{constructor(t){super();me(this,Tr);me(this,_c);me(this,Er);me(this,Qt);me(this,Us);ne(this,_c,t.client),this.mutationId=t.mutationId,ne(this,Qt,t.mutationCache),ne(this,Er,[]),this.state=t.state||p1(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){z(this,Er).includes(t)||(z(this,Er).push(t),this.clearGcTimeout(),z(this,Qt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){ne(this,Er,z(this,Er).filter(n=>n!==t)),this.scheduleGc(),z(this,Qt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){z(this,Er).length||(this.state.status==="pending"?this.scheduleGc():z(this,Qt).remove(this))}continue(){var t;return((t=z(this,Us))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,i,c,l,d,p,h,y,E,C,I,P,v,U,O,M,L,F,u,f;const n=()=>{Oe(this,Tr,Na).call(this,{type:"continue"})},r={client:z(this,_c),meta:this.options.meta,mutationKey:this.options.mutationKey};ne(this,Us,r1({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(b,k)=>{Oe(this,Tr,Na).call(this,{type:"failed",failureCount:b,error:k})},onPause:()=>{Oe(this,Tr,Na).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>z(this,Qt).canRun(this)}));const a=this.state.status==="pending",s=!z(this,Us).canStart();try{if(a)n();else{Oe(this,Tr,Na).call(this,{type:"pending",variables:t,isPaused:s}),await((i=(o=z(this,Qt).config).onMutate)==null?void 0:i.call(o,t,this,r));const k=await((l=(c=this.options).onMutate)==null?void 0:l.call(c,t,r));k!==this.state.context&&Oe(this,Tr,Na).call(this,{type:"pending",context:k,variables:t,isPaused:s})}const b=await z(this,Us).start();return await((p=(d=z(this,Qt).config).onSuccess)==null?void 0:p.call(d,b,t,this.state.context,this,r)),await((y=(h=this.options).onSuccess)==null?void 0:y.call(h,b,t,this.state.context,r)),await((C=(E=z(this,Qt).config).onSettled)==null?void 0:C.call(E,b,null,this.state.variables,this.state.context,this,r)),await((P=(I=this.options).onSettled)==null?void 0:P.call(I,b,null,t,this.state.context,r)),Oe(this,Tr,Na).call(this,{type:"success",data:b}),b}catch(b){try{throw await((U=(v=z(this,Qt).config).onError)==null?void 0:U.call(v,b,t,this.state.context,this,r)),await((M=(O=this.options).onError)==null?void 0:M.call(O,b,t,this.state.context,r)),await((F=(L=z(this,Qt).config).onSettled)==null?void 0:F.call(L,void 0,b,this.state.variables,this.state.context,this,r)),await((f=(u=this.options).onSettled)==null?void 0:f.call(u,void 0,b,t,this.state.context,r)),b}finally{Oe(this,Tr,Na).call(this,{type:"error",error:b})}}finally{z(this,Qt).runNext(this)}}},_c=new WeakMap,Er=new WeakMap,Qt=new WeakMap,Us=new WeakMap,Tr=new WeakSet,Na=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),Ct.batch(()=>{z(this,Er).forEach(r=>{r.onMutationUpdate(t)}),z(this,Qt).notify({mutation:this,type:"updated",action:t})})},L5);function p1(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var n8=(z5=class extends Ns{constructor(t={}){super();me(this,ea);me(this,or);me(this,Mc);this.config=t,ne(this,ea,new Set),ne(this,or,new Map),ne(this,Mc,0)}build(t,n,r){const a=new t8({client:t,mutationCache:this,mutationId:++cd(this,Mc)._,options:t.defaultMutationOptions(n),state:r});return this.add(a),a}add(t){z(this,ea).add(t);const n=qc(t);if(typeof n=="string"){const r=z(this,or).get(n);r?r.push(t):z(this,or).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(z(this,ea).delete(t)){const n=qc(t);if(typeof n=="string"){const r=z(this,or).get(n);if(r)if(r.length>1){const a=r.indexOf(t);a!==-1&&r.splice(a,1)}else r[0]===t&&z(this,or).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=qc(t);if(typeof n=="string"){const r=z(this,or).get(n),a=r==null?void 0:r.find(s=>s.state.status==="pending");return!a||a===t}else return!0}runNext(t){var r;const n=qc(t);if(typeof n=="string"){const a=(r=z(this,or).get(n))==null?void 0:r.find(s=>s!==t&&s.state.isPaused);return(a==null?void 0:a.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Ct.batch(()=>{z(this,ea).forEach(t=>{this.notify({type:"removed",mutation:t})}),z(this,ea).clear(),z(this,or).clear()})}getAll(){return Array.from(z(this,ea))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Xh(n,r))}findAll(t={}){return this.getAll().filter(n=>Xh(t,n))}notify(t){Ct.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Ct.batch(()=>Promise.all(t.map(n=>n.continue().catch(Yt))))}},ea=new WeakMap,or=new WeakMap,Mc=new WeakMap,z5);function qc(e){var t;return(t=e.options.scope)==null?void 0:t.id}var r8=(R5=class extends Ns{constructor(t,n){super();me(this,ra);me(this,ta);me(this,Ua);me(this,dn);me(this,na);ne(this,ta,t),this.setOptions(n),this.bindMethods(),Oe(this,ra,ld).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=z(this,ta).defaultMutationOptions(t),jc(this.options,n)||z(this,ta).getMutationCache().notify({type:"observerOptionsUpdated",mutation:z(this,dn),observer:this}),n!=null&&n.mutationKey&&this.options.mutationKey&&ja(n.mutationKey)!==ja(this.options.mutationKey)?this.reset():((r=z(this,dn))==null?void 0:r.state.status)==="pending"&&z(this,dn).setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=z(this,dn))==null||t.removeObserver(this)}onMutationUpdate(t){Oe(this,ra,ld).call(this),Oe(this,ra,qm).call(this,t)}getCurrentResult(){return z(this,Ua)}reset(){var t;(t=z(this,dn))==null||t.removeObserver(this),ne(this,dn,void 0),Oe(this,ra,ld).call(this),Oe(this,ra,qm).call(this)}mutate(t,n){var r;return ne(this,na,n),(r=z(this,dn))==null||r.removeObserver(this),ne(this,dn,z(this,ta).getMutationCache().build(z(this,ta),this.options)),z(this,dn).addObserver(this),z(this,dn).execute(t)}},ta=new WeakMap,Ua=new WeakMap,dn=new WeakMap,na=new WeakMap,ra=new WeakSet,ld=function(){var n;const t=((n=z(this,dn))==null?void 0:n.state)??p1();ne(this,Ua,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},qm=function(t){Ct.batch(()=>{var n,r,a,s,o,i,c,l;if(z(this,na)&&this.hasListeners()){const d=z(this,Ua).variables,p=z(this,Ua).context,h={client:z(this,ta),meta:this.options.meta,mutationKey:this.options.mutationKey};(t==null?void 0:t.type)==="success"?((r=(n=z(this,na)).onSuccess)==null||r.call(n,t.data,d,p,h),(s=(a=z(this,na)).onSettled)==null||s.call(a,t.data,null,d,p,h)):(t==null?void 0:t.type)==="error"&&((i=(o=z(this,na)).onError)==null||i.call(o,t.error,d,p,h),(l=(c=z(this,na)).onSettled)==null||l.call(c,void 0,t.error,d,p,h))}this.listeners.forEach(d=>{d(z(this,Ua))})})},R5),a8=($5=class extends Ns{constructor(t={}){super();me(this,Cr);this.config=t,ne(this,Cr,new Map)}build(t,n,r){const a=n.queryKey,s=n.queryHash??Id(a,n);let o=this.get(s);return o||(o=new Z3({client:t,queryKey:a,queryHash:s,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(a)}),this.add(o)),o}add(t){z(this,Cr).has(t.queryHash)||(z(this,Cr).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=z(this,Cr).get(t.queryHash);n&&(t.destroy(),n===t&&z(this,Cr).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Ct.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return z(this,Cr).get(t)}getAll(){return[...z(this,Cr).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Zh(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Zh(t,r)):n}notify(t){Ct.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Ct.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Ct.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Cr=new WeakMap,$5),s8=(H5=class{constructor(e={}){me(this,bt);me(this,Da);me(this,_a);me(this,Lo);me(this,zo);me(this,Ma);me(this,Ro);me(this,$o);ne(this,bt,e.queryCache||new a8),ne(this,Da,e.mutationCache||new n8),ne(this,_a,e.defaultOptions||{}),ne(this,Lo,new Map),ne(this,zo,new Map),ne(this,Ma,0)}mount(){cd(this,Ma)._++,z(this,Ma)===1&&(ne(this,Ro,Ud.subscribe(async e=>{e&&(await this.resumePausedMutations(),z(this,bt).onFocus())})),ne(this,$o,Wc.subscribe(async e=>{e&&(await this.resumePausedMutations(),z(this,bt).onOnline())})))}unmount(){var e,t;cd(this,Ma)._--,z(this,Ma)===0&&((e=z(this,Ro))==null||e.call(this),ne(this,Ro,void 0),(t=z(this,$o))==null||t.call(this),ne(this,$o,void 0))}isFetching(e){return z(this,bt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return z(this,Da).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=z(this,bt).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=z(this,bt).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(ia(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return z(this,bt).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),a=z(this,bt).get(r.queryHash),s=a==null?void 0:a.state.data,o=R3(t,s);if(o!==void 0)return z(this,bt).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return Ct.batch(()=>z(this,bt).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=z(this,bt).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=z(this,bt);Ct.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=z(this,bt);return Ct.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Ct.batch(()=>z(this,bt).findAll(e).map(a=>a.cancel(n)));return Promise.all(r).then(Yt).catch(Yt)}invalidateQueries(e,t={}){return Ct.batch(()=>(z(this,bt).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=Ct.batch(()=>z(this,bt).findAll(e).filter(a=>!a.isDisabled()&&!a.isStatic()).map(a=>{let s=a.fetch(void 0,n);return n.throwOnError||(s=s.catch(Yt)),a.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(Yt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=z(this,bt).build(this,t);return n.isStaleByTime(ia(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Yt).catch(Yt)}fetchInfiniteQuery(e){return e.behavior=u1(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Yt).catch(Yt)}ensureInfiniteQueryData(e){return e.behavior=u1(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Wc.isOnline()?z(this,Da).resumePausedMutations():Promise.resolve()}getQueryCache(){return z(this,bt)}getMutationCache(){return z(this,Da)}getDefaultOptions(){return z(this,_a)}setDefaultOptions(e){ne(this,_a,e)}setQueryDefaults(e,t){z(this,Lo).set(ja(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...z(this,Lo).values()],n={};return t.forEach(r=>{jo(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){z(this,zo).set(ja(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...z(this,zo).values()],n={};return t.forEach(r=>{jo(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...z(this,_a).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Id(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===Vc&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...z(this,_a).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){z(this,bt).clear(),z(this,Da).clear()}},bt=new WeakMap,Da=new WeakMap,_a=new WeakMap,Lo=new WeakMap,zo=new WeakMap,Ma=new WeakMap,Ro=new WeakMap,$o=new WeakMap,H5),f1=vt.createContext(void 0),Vo=e=>{const t=vt.useContext(f1);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},o8=({client:e,children:t})=>(vt.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),_.jsx(f1.Provider,{value:e,children:t})),m1=vt.createContext(!1),i8=()=>vt.useContext(m1);m1.Provider;function c8(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var l8=vt.createContext(c8()),u8=()=>vt.useContext(l8),d8=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},p8=e=>{vt.useEffect(()=>{e.clearReset()},[e])},f8=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:a})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(a&&e.data===void 0||t1(n,[e.error,r])),m8=e=>{if(e.suspense){const n=a=>a==="static"?a:Math.max(a??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...a)=>n(r(...a)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},h8=(e,t)=>e.isLoading&&e.isFetching&&!t,b8=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,h1=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function y8(e,t,n){var p,h,y,E,C;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=i8(),a=u8(),s=Vo(),o=s.defaultQueryOptions(e);(h=(p=s.getDefaultOptions().queries)==null?void 0:p._experimental_beforeQuery)==null||h.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",m8(o),d8(o,a),p8(a);const i=!s.getQueryCache().get(o.queryHash),[c]=vt.useState(()=>new t(s,o)),l=c.getOptimisticResult(o),d=!r&&e.subscribed!==!1;if(vt.useSyncExternalStore(vt.useCallback(I=>{const P=d?c.subscribe(Ct.batchCalls(I)):Yt;return c.updateResult(),P},[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),vt.useEffect(()=>{c.setOptions(o)},[o,c]),b8(o,l))throw h1(o,c,a);if(f8({result:l,errorResetBoundary:a,throwOnError:o.throwOnError,query:s.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw l.error;if((E=(y=s.getDefaultOptions().queries)==null?void 0:y._experimental_afterQuery)==null||E.call(y,o,l),o.experimental_prefetchInRender&&!Ga&&h8(l,r)){const I=i?h1(o,c,a):(C=s.getQueryCache().get(o.queryHash))==null?void 0:C.promise;I==null||I.catch(Yt).finally(()=>{c.updateResult()})}return o.notifyOnChangeProps?l:c.trackResult(l)}function g8(e,t){return y8(e,X3)}function Pr(e,t){const n=Vo(),[r]=vt.useState(()=>new r8(n,e));vt.useEffect(()=>{r.setOptions(e)},[r,e]);const a=vt.useSyncExternalStore(vt.useCallback(o=>r.subscribe(Ct.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),s=vt.useCallback((o,i)=>{r.mutate(o,i).catch(Yt)},[r]);if(a.error&&t1(r.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:s,mutateAsync:a.mutate}}const x8=N.createContext(null),Ld={didCatch:!1,error:null};class w8 extends N.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Ld}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){const{error:t}=this.state;if(t!==null){for(var n,r,a=arguments.length,s=new Array(a),o=0;o<a;o++)s[o]=arguments[o];(n=(r=this.props).onReset)===null||n===void 0||n.call(r,{args:s,reason:"imperative-api"}),this.setState(Ld)}}componentDidCatch(t,n){var r,a;(r=(a=this.props).onError)===null||r===void 0||r.call(a,t,n)}componentDidUpdate(t,n){const{didCatch:r}=this.state,{resetKeys:a}=this.props;if(r&&n.error!==null&&v8(t.resetKeys,a)){var s,o;(s=(o=this.props).onReset)===null||s===void 0||s.call(o,{next:a,prev:t.resetKeys,reason:"keys"}),this.setState(Ld)}}render(){const{children:t,fallbackRender:n,FallbackComponent:r,fallback:a}=this.props,{didCatch:s,error:o}=this.state;let i=t;if(s){const c={error:o,resetErrorBoundary:this.resetErrorBoundary};if(typeof n=="function")i=n(c);else if(r)i=N.createElement(r,c);else if(a!==void 0)i=a;else throw o}return N.createElement(x8.Provider,{value:{didCatch:s,error:o,resetErrorBoundary:this.resetErrorBoundary}},i)}}function v8(){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]))}var k8=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,zd=Math.ceil,In=Math.floor,en="[BigNumber Error] ",b1=en+"Number primitive has more than 15 significant digits: ",Hn=1e14,Te=14,Rd=9007199254740991,$d=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],ca=1e7,Ot=1e9;function y1(e){var t,n,r,a=v.prototype={constructor:v,toString:null,valueOf:null},s=new v(1),o=20,i=4,c=-7,l=21,d=-1e7,p=1e7,h=!1,y=1,E=0,C={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},I="0123456789abcdefghijklmnopqrstuvwxyz",P=!0;function v(u,f){var b,k,x,T,B,g,w,S,A=this;if(!(A instanceof v))return new v(u,f);if(f==null){if(u&&u._isBigNumber===!0){A.s=u.s,!u.c||u.e>p?A.c=A.e=null:u.e<d?A.c=[A.e=0]:(A.e=u.e,A.c=u.c.slice());return}if((g=typeof u=="number")&&u*0==0){if(A.s=1/u<0?(u=-u,-1):1,u===~~u){for(T=0,B=u;B>=10;B/=10,T++);T>p?A.c=A.e=null:(A.e=T,A.c=[u]);return}S=String(u)}else{if(!k8.test(S=String(u)))return r(A,S,g);A.s=S.charCodeAt(0)==45?(S=S.slice(1),-1):1}(T=S.indexOf("."))>-1&&(S=S.replace(".","")),(B=S.search(/e/i))>0?(T<0&&(T=B),T+=+S.slice(B+1),S=S.substring(0,B)):T<0&&(T=S.length)}else{if(dt(f,2,I.length,"Base"),f==10&&P)return A=new v(u),L(A,o+A.e+1,i);if(S=String(u),g=typeof u=="number"){if(u*0!=0)return r(A,S,g,f);if(A.s=1/u<0?(S=S.slice(1),-1):1,v.DEBUG&&S.replace(/^0\.0*|\./,"").length>15)throw Error(b1+u)}else A.s=S.charCodeAt(0)===45?(S=S.slice(1),-1):1;for(b=I.slice(0,f),T=B=0,w=S.length;B<w;B++)if(b.indexOf(k=S.charAt(B))<0){if(k=="."){if(B>T){T=w;continue}}else if(!x&&(S==S.toUpperCase()&&(S=S.toLowerCase())||S==S.toLowerCase()&&(S=S.toUpperCase()))){x=!0,B=-1,T=0;continue}return r(A,String(u),g,f)}g=!1,S=n(S,f,10,A.s),(T=S.indexOf("."))>-1?S=S.replace(".",""):T=S.length}for(B=0;S.charCodeAt(B)===48;B++);for(w=S.length;S.charCodeAt(--w)===48;);if(S=S.slice(B,++w)){if(w-=B,g&&v.DEBUG&&w>15&&(u>Rd||u!==In(u)))throw Error(b1+A.s*u);if((T=T-B-1)>p)A.c=A.e=null;else if(T<d)A.c=[A.e=0];else{if(A.e=T,A.c=[],B=(T+1)%Te,T<0&&(B+=Te),B<w){for(B&&A.c.push(+S.slice(0,B)),w-=Te;B<w;)A.c.push(+S.slice(B,B+=Te));B=Te-(S=S.slice(B)).length}else B-=w;for(;B--;S+="0");A.c.push(+S)}}else A.c=[A.e=0]}v.clone=y1,v.ROUND_UP=0,v.ROUND_DOWN=1,v.ROUND_CEIL=2,v.ROUND_FLOOR=3,v.ROUND_HALF_UP=4,v.ROUND_HALF_DOWN=5,v.ROUND_HALF_EVEN=6,v.ROUND_HALF_CEIL=7,v.ROUND_HALF_FLOOR=8,v.EUCLID=9,v.config=v.set=function(u){var f,b;if(u!=null)if(typeof u=="object"){if(u.hasOwnProperty(f="DECIMAL_PLACES")&&(b=u[f],dt(b,0,Ot,f),o=b),u.hasOwnProperty(f="ROUNDING_MODE")&&(b=u[f],dt(b,0,8,f),i=b),u.hasOwnProperty(f="EXPONENTIAL_AT")&&(b=u[f],b&&b.pop?(dt(b[0],-Ot,0,f),dt(b[1],0,Ot,f),c=b[0],l=b[1]):(dt(b,-Ot,Ot,f),c=-(l=b<0?-b:b))),u.hasOwnProperty(f="RANGE"))if(b=u[f],b&&b.pop)dt(b[0],-Ot,-1,f),dt(b[1],1,Ot,f),d=b[0],p=b[1];else if(dt(b,-Ot,Ot,f),b)d=-(p=b<0?-b:b);else throw Error(en+f+" cannot be zero: "+b);if(u.hasOwnProperty(f="CRYPTO"))if(b=u[f],b===!!b)if(b)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))h=b;else throw h=!b,Error(en+"crypto unavailable");else h=b;else throw Error(en+f+" not true or false: "+b);if(u.hasOwnProperty(f="MODULO_MODE")&&(b=u[f],dt(b,0,9,f),y=b),u.hasOwnProperty(f="POW_PRECISION")&&(b=u[f],dt(b,0,Ot,f),E=b),u.hasOwnProperty(f="FORMAT"))if(b=u[f],typeof b=="object")C=b;else throw Error(en+f+" not an object: "+b);if(u.hasOwnProperty(f="ALPHABET"))if(b=u[f],typeof b=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(b))P=b.slice(0,10)=="0123456789",I=b;else throw Error(en+f+" invalid: "+b)}else throw Error(en+"Object expected: "+u);return{DECIMAL_PLACES:o,ROUNDING_MODE:i,EXPONENTIAL_AT:[c,l],RANGE:[d,p],CRYPTO:h,MODULO_MODE:y,POW_PRECISION:E,FORMAT:C,ALPHABET:I}},v.isBigNumber=function(u){if(!u||u._isBigNumber!==!0)return!1;if(!v.DEBUG)return!0;var f,b,k=u.c,x=u.e,T=u.s;e:if({}.toString.call(k)=="[object Array]"){if((T===1||T===-1)&&x>=-Ot&&x<=Ot&&x===In(x)){if(k[0]===0){if(x===0&&k.length===1)return!0;break e}if(f=(x+1)%Te,f<1&&(f+=Te),String(k[0]).length==f){for(f=0;f<k.length;f++)if(b=k[f],b<0||b>=Hn||b!==In(b))break e;if(b!==0)return!0}}}else if(k===null&&x===null&&(T===null||T===1||T===-1))return!0;throw Error(en+"Invalid BigNumber: "+u)},v.maximum=v.max=function(){return O(arguments,-1)},v.minimum=v.min=function(){return O(arguments,1)},v.random=(function(){var u=9007199254740992,f=Math.random()*u&2097151?function(){return In(Math.random()*u)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(b){var k,x,T,B,g,w=0,S=[],A=new v(s);if(b==null?b=o:dt(b,0,Ot),B=zd(b/Te),h)if(crypto.getRandomValues){for(k=crypto.getRandomValues(new Uint32Array(B*=2));w<B;)g=k[w]*131072+(k[w+1]>>>11),g>=9e15?(x=crypto.getRandomValues(new Uint32Array(2)),k[w]=x[0],k[w+1]=x[1]):(S.push(g%1e14),w+=2);w=B/2}else if(crypto.randomBytes){for(k=crypto.randomBytes(B*=7);w<B;)g=(k[w]&31)*281474976710656+k[w+1]*1099511627776+k[w+2]*4294967296+k[w+3]*16777216+(k[w+4]<<16)+(k[w+5]<<8)+k[w+6],g>=9e15?crypto.randomBytes(7).copy(k,w):(S.push(g%1e14),w+=7);w=B/7}else throw h=!1,Error(en+"crypto unavailable");if(!h)for(;w<B;)g=f(),g<9e15&&(S[w++]=g%1e14);for(B=S[--w],b%=Te,B&&b&&(g=$d[Te-b],S[w]=In(B/g)*g);S[w]===0;S.pop(),w--);if(w<0)S=[T=0];else{for(T=-1;S[0]===0;S.splice(0,1),T-=Te);for(w=1,g=S[0];g>=10;g/=10,w++);w<Te&&(T-=Te-w)}return A.e=T,A.c=S,A}})(),v.sum=function(){for(var u=1,f=arguments,b=new v(f[0]);u<f.length;)b=b.plus(f[u++]);return b},n=(function(){var u="0123456789";function f(b,k,x,T){for(var B,g=[0],w,S=0,A=b.length;S<A;){for(w=g.length;w--;g[w]*=k);for(g[0]+=T.indexOf(b.charAt(S++)),B=0;B<g.length;B++)g[B]>x-1&&(g[B+1]==null&&(g[B+1]=0),g[B+1]+=g[B]/x|0,g[B]%=x)}return g.reverse()}return function(b,k,x,T,B){var g,w,S,A,D,R,$,j,te=b.indexOf("."),ce=o,Y=i;for(te>=0&&(A=E,E=0,b=b.replace(".",""),j=new v(k),R=j.pow(b.length-te),E=A,j.c=f(Ir(On(R.c),R.e,"0"),10,x,u),j.e=j.c.length),$=f(b,k,x,B?(g=I,u):(g=u,I)),S=A=$.length;$[--A]==0;$.pop());if(!$[0])return g.charAt(0);if(te<0?--S:(R.c=$,R.e=S,R.s=T,R=t(R,j,ce,Y,x),$=R.c,D=R.r,S=R.e),w=S+ce+1,te=$[w],A=x/2,D=D||w<0||$[w+1]!=null,D=Y<4?(te!=null||D)&&(Y==0||Y==(R.s<0?3:2)):te>A||te==A&&(Y==4||D||Y==6&&$[w-1]&1||Y==(R.s<0?8:7)),w<1||!$[0])b=D?Ir(g.charAt(1),-ce,g.charAt(0)):g.charAt(0);else{if($.length=w,D)for(--x;++$[--w]>x;)$[w]=0,w||(++S,$=[1].concat($));for(A=$.length;!$[--A];);for(te=0,b="";te<=A;b+=g.charAt($[te++]));b=Ir(b,S,g.charAt(0))}return b}})(),t=(function(){function u(k,x,T){var B,g,w,S,A=0,D=k.length,R=x%ca,$=x/ca|0;for(k=k.slice();D--;)w=k[D]%ca,S=k[D]/ca|0,B=$*w+S*R,g=R*w+B%ca*ca+A,A=(g/T|0)+(B/ca|0)+$*S,k[D]=g%T;return A&&(k=[A].concat(k)),k}function f(k,x,T,B){var g,w;if(T!=B)w=T>B?1:-1;else for(g=w=0;g<T;g++)if(k[g]!=x[g]){w=k[g]>x[g]?1:-1;break}return w}function b(k,x,T,B){for(var g=0;T--;)k[T]-=g,g=k[T]<x[T]?1:0,k[T]=g*B+k[T]-x[T];for(;!k[0]&&k.length>1;k.splice(0,1));}return function(k,x,T,B,g){var w,S,A,D,R,$,j,te,ce,Y,J,ye,X,ve,Fe,Ae,Ye,ge=k.s==x.s?1:-1,fe=k.c,ae=x.c;if(!fe||!fe[0]||!ae||!ae[0])return new v(!k.s||!x.s||(fe?ae&&fe[0]==ae[0]:!ae)?NaN:fe&&fe[0]==0||!ae?ge*0:ge/0);for(te=new v(ge),ce=te.c=[],S=k.e-x.e,ge=T+S+1,g||(g=Hn,S=Bn(k.e/Te)-Bn(x.e/Te),ge=ge/Te|0),A=0;ae[A]==(fe[A]||0);A++);if(ae[A]>(fe[A]||0)&&S--,ge<0)ce.push(1),D=!0;else{for(ve=fe.length,Ae=ae.length,A=0,ge+=2,R=In(g/(ae[0]+1)),R>1&&(ae=u(ae,R,g),fe=u(fe,R,g),Ae=ae.length,ve=fe.length),X=Ae,Y=fe.slice(0,Ae),J=Y.length;J<Ae;Y[J++]=0);Ye=ae.slice(),Ye=[0].concat(Ye),Fe=ae[0],ae[1]>=g/2&&Fe++;do{if(R=0,w=f(ae,Y,Ae,J),w<0){if(ye=Y[0],Ae!=J&&(ye=ye*g+(Y[1]||0)),R=In(ye/Fe),R>1)for(R>=g&&(R=g-1),$=u(ae,R,g),j=$.length,J=Y.length;f($,Y,j,J)==1;)R--,b($,Ae<j?Ye:ae,j,g),j=$.length,w=1;else R==0&&(w=R=1),$=ae.slice(),j=$.length;if(j<J&&($=[0].concat($)),b(Y,$,J,g),J=Y.length,w==-1)for(;f(ae,Y,Ae,J)<1;)R++,b(Y,Ae<J?Ye:ae,J,g),J=Y.length}else w===0&&(R++,Y=[0]);ce[A++]=R,Y[0]?Y[J++]=fe[X]||0:(Y=[fe[X]],J=1)}while((X++<ve||Y[0]!=null)&&ge--);D=Y[0]!=null,ce[0]||ce.splice(0,1)}if(g==Hn){for(A=1,ge=ce[0];ge>=10;ge/=10,A++);L(te,T+(te.e=A+S*Te-1)+1,B,D)}else te.e=S,te.r=+D;return te}})();function U(u,f,b,k){var x,T,B,g,w;if(b==null?b=i:dt(b,0,8),!u.c)return u.toString();if(x=u.c[0],B=u.e,f==null)w=On(u.c),w=k==1||k==2&&(B<=c||B>=l)?Kc(w,B):Ir(w,B,"0");else if(u=L(new v(u),f,b),T=u.e,w=On(u.c),g=w.length,k==1||k==2&&(f<=T||T<=c)){for(;g<f;w+="0",g++);w=Kc(w,T)}else if(f-=B+(k===2&&T>B),w=Ir(w,T,"0"),T+1>g){if(--f>0)for(w+=".";f--;w+="0");}else if(f+=T-g,f>0)for(T+1==g&&(w+=".");f--;w+="0");return u.s<0&&x?"-"+w:w}function O(u,f){for(var b,k,x=1,T=new v(u[0]);x<u.length;x++)k=new v(u[x]),(!k.s||(b=Va(T,k))===f||b===0&&T.s===f)&&(T=k);return T}function M(u,f,b){for(var k=1,x=f.length;!f[--x];f.pop());for(x=f[0];x>=10;x/=10,k++);return(b=k+b*Te-1)>p?u.c=u.e=null:b<d?u.c=[u.e=0]:(u.e=b,u.c=f),u}r=(function(){var u=/^(-?)0([xbo])(?=\w[\w.]*$)/i,f=/^([^.]+)\.$/,b=/^\.([^.]+)$/,k=/^-?(Infinity|NaN)$/,x=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(T,B,g,w){var S,A=g?B:B.replace(x,"");if(k.test(A))T.s=isNaN(A)?null:A<0?-1:1;else{if(!g&&(A=A.replace(u,function(D,R,$){return S=($=$.toLowerCase())=="x"?16:$=="b"?2:8,!w||w==S?R:D}),w&&(S=w,A=A.replace(f,"$1").replace(b,"0.$1")),B!=A))return new v(A,S);if(v.DEBUG)throw Error(en+"Not a"+(w?" base "+w:"")+" number: "+B);T.s=null}T.c=T.e=null}})();function L(u,f,b,k){var x,T,B,g,w,S,A,D=u.c,R=$d;if(D){e:{for(x=1,g=D[0];g>=10;g/=10,x++);if(T=f-x,T<0)T+=Te,B=f,w=D[S=0],A=In(w/R[x-B-1]%10);else if(S=zd((T+1)/Te),S>=D.length)if(k){for(;D.length<=S;D.push(0));w=A=0,x=1,T%=Te,B=T-Te+1}else break e;else{for(w=g=D[S],x=1;g>=10;g/=10,x++);T%=Te,B=T-Te+x,A=B<0?0:In(w/R[x-B-1]%10)}if(k=k||f<0||D[S+1]!=null||(B<0?w:w%R[x-B-1]),k=b<4?(A||k)&&(b==0||b==(u.s<0?3:2)):A>5||A==5&&(b==4||k||b==6&&(T>0?B>0?w/R[x-B]:0:D[S-1])%10&1||b==(u.s<0?8:7)),f<1||!D[0])return D.length=0,k?(f-=u.e+1,D[0]=R[(Te-f%Te)%Te],u.e=-f||0):D[0]=u.e=0,u;if(T==0?(D.length=S,g=1,S--):(D.length=S+1,g=R[Te-T],D[S]=B>0?In(w/R[x-B]%R[B])*g:0),k)for(;;)if(S==0){for(T=1,B=D[0];B>=10;B/=10,T++);for(B=D[0]+=g,g=1;B>=10;B/=10,g++);T!=g&&(u.e++,D[0]==Hn&&(D[0]=1));break}else{if(D[S]+=g,D[S]!=Hn)break;D[S--]=0,g=1}for(T=D.length;D[--T]===0;D.pop());}u.e>p?u.c=u.e=null:u.e<d&&(u.c=[u.e=0])}return u}function F(u){var f,b=u.e;return b===null?u.toString():(f=On(u.c),f=b<=c||b>=l?Kc(f,b):Ir(f,b,"0"),u.s<0?"-"+f:f)}return a.absoluteValue=a.abs=function(){var u=new v(this);return u.s<0&&(u.s=1),u},a.comparedTo=function(u,f){return Va(this,new v(u,f))},a.decimalPlaces=a.dp=function(u,f){var b,k,x,T=this;if(u!=null)return dt(u,0,Ot),f==null?f=i:dt(f,0,8),L(new v(T),u+T.e+1,f);if(!(b=T.c))return null;if(k=((x=b.length-1)-Bn(this.e/Te))*Te,x=b[x])for(;x%10==0;x/=10,k--);return k<0&&(k=0),k},a.dividedBy=a.div=function(u,f){return t(this,new v(u,f),o,i)},a.dividedToIntegerBy=a.idiv=function(u,f){return t(this,new v(u,f),0,1)},a.exponentiatedBy=a.pow=function(u,f){var b,k,x,T,B,g,w,S,A,D=this;if(u=new v(u),u.c&&!u.isInteger())throw Error(en+"Exponent not an integer: "+F(u));if(f!=null&&(f=new v(f)),g=u.e>14,!D.c||!D.c[0]||D.c[0]==1&&!D.e&&D.c.length==1||!u.c||!u.c[0])return A=new v(Math.pow(+F(D),g?u.s*(2-Yc(u)):+F(u))),f?A.mod(f):A;if(w=u.s<0,f){if(f.c?!f.c[0]:!f.s)return new v(NaN);k=!w&&D.isInteger()&&f.isInteger(),k&&(D=D.mod(f))}else{if(u.e>9&&(D.e>0||D.e<-1||(D.e==0?D.c[0]>1||g&&D.c[1]>=24e7:D.c[0]<8e13||g&&D.c[0]<=9999975e7)))return T=D.s<0&&Yc(u)?-0:0,D.e>-1&&(T=1/T),new v(w?1/T:T);E&&(T=zd(E/Te+2))}for(g?(b=new v(.5),w&&(u.s=1),S=Yc(u)):(x=Math.abs(+F(u)),S=x%2),A=new v(s);;){if(S){if(A=A.times(D),!A.c)break;T?A.c.length>T&&(A.c.length=T):k&&(A=A.mod(f))}if(x){if(x=In(x/2),x===0)break;S=x%2}else if(u=u.times(b),L(u,u.e+1,1),u.e>14)S=Yc(u);else{if(x=+F(u),x===0)break;S=x%2}D=D.times(D),T?D.c&&D.c.length>T&&(D.c.length=T):k&&(D=D.mod(f))}return k?A:(w&&(A=s.div(A)),f?A.mod(f):T?L(A,E,i,B):A)},a.integerValue=function(u){var f=new v(this);return u==null?u=i:dt(u,0,8),L(f,f.e+1,u)},a.isEqualTo=a.eq=function(u,f){return Va(this,new v(u,f))===0},a.isFinite=function(){return!!this.c},a.isGreaterThan=a.gt=function(u,f){return Va(this,new v(u,f))>0},a.isGreaterThanOrEqualTo=a.gte=function(u,f){return(f=Va(this,new v(u,f)))===1||f===0},a.isInteger=function(){return!!this.c&&Bn(this.e/Te)>this.c.length-2},a.isLessThan=a.lt=function(u,f){return Va(this,new v(u,f))<0},a.isLessThanOrEqualTo=a.lte=function(u,f){return(f=Va(this,new v(u,f)))===-1||f===0},a.isNaN=function(){return!this.s},a.isNegative=function(){return this.s<0},a.isPositive=function(){return this.s>0},a.isZero=function(){return!!this.c&&this.c[0]==0},a.minus=function(u,f){var b,k,x,T,B=this,g=B.s;if(u=new v(u,f),f=u.s,!g||!f)return new v(NaN);if(g!=f)return u.s=-f,B.plus(u);var w=B.e/Te,S=u.e/Te,A=B.c,D=u.c;if(!w||!S){if(!A||!D)return A?(u.s=-f,u):new v(D?B:NaN);if(!A[0]||!D[0])return D[0]?(u.s=-f,u):new v(A[0]?B:i==3?-0:0)}if(w=Bn(w),S=Bn(S),A=A.slice(),g=w-S){for((T=g<0)?(g=-g,x=A):(S=w,x=D),x.reverse(),f=g;f--;x.push(0));x.reverse()}else for(k=(T=(g=A.length)<(f=D.length))?g:f,g=f=0;f<k;f++)if(A[f]!=D[f]){T=A[f]<D[f];break}if(T&&(x=A,A=D,D=x,u.s=-u.s),f=(k=D.length)-(b=A.length),f>0)for(;f--;A[b++]=0);for(f=Hn-1;k>g;){if(A[--k]<D[k]){for(b=k;b&&!A[--b];A[b]=f);--A[b],A[k]+=Hn}A[k]-=D[k]}for(;A[0]==0;A.splice(0,1),--S);return A[0]?M(u,A,S):(u.s=i==3?-1:1,u.c=[u.e=0],u)},a.modulo=a.mod=function(u,f){var b,k,x=this;return u=new v(u,f),!x.c||!u.s||u.c&&!u.c[0]?new v(NaN):!u.c||x.c&&!x.c[0]?new v(x):(y==9?(k=u.s,u.s=1,b=t(x,u,0,3),u.s=k,b.s*=k):b=t(x,u,0,y),u=x.minus(b.times(u)),!u.c[0]&&y==1&&(u.s=x.s),u)},a.multipliedBy=a.times=function(u,f){var b,k,x,T,B,g,w,S,A,D,R,$,j,te,ce,Y=this,J=Y.c,ye=(u=new v(u,f)).c;if(!J||!ye||!J[0]||!ye[0])return!Y.s||!u.s||J&&!J[0]&&!ye||ye&&!ye[0]&&!J?u.c=u.e=u.s=null:(u.s*=Y.s,!J||!ye?u.c=u.e=null:(u.c=[0],u.e=0)),u;for(k=Bn(Y.e/Te)+Bn(u.e/Te),u.s*=Y.s,w=J.length,D=ye.length,w<D&&(j=J,J=ye,ye=j,x=w,w=D,D=x),x=w+D,j=[];x--;j.push(0));for(te=Hn,ce=ca,x=D;--x>=0;){for(b=0,R=ye[x]%ce,$=ye[x]/ce|0,B=w,T=x+B;T>x;)S=J[--B]%ce,A=J[B]/ce|0,g=$*S+A*R,S=R*S+g%ce*ce+j[T]+b,b=(S/te|0)+(g/ce|0)+$*A,j[T--]=S%te;j[T]=b}return b?++k:j.splice(0,1),M(u,j,k)},a.negated=function(){var u=new v(this);return u.s=-u.s||null,u},a.plus=function(u,f){var b,k=this,x=k.s;if(u=new v(u,f),f=u.s,!x||!f)return new v(NaN);if(x!=f)return u.s=-f,k.minus(u);var T=k.e/Te,B=u.e/Te,g=k.c,w=u.c;if(!T||!B){if(!g||!w)return new v(x/0);if(!g[0]||!w[0])return w[0]?u:new v(g[0]?k:x*0)}if(T=Bn(T),B=Bn(B),g=g.slice(),x=T-B){for(x>0?(B=T,b=w):(x=-x,b=g),b.reverse();x--;b.push(0));b.reverse()}for(x=g.length,f=w.length,x-f<0&&(b=w,w=g,g=b,f=x),x=0;f;)x=(g[--f]=g[f]+w[f]+x)/Hn|0,g[f]=Hn===g[f]?0:g[f]%Hn;return x&&(g=[x].concat(g),++B),M(u,g,B)},a.precision=a.sd=function(u,f){var b,k,x,T=this;if(u!=null&&u!==!!u)return dt(u,1,Ot),f==null?f=i:dt(f,0,8),L(new v(T),u,f);if(!(b=T.c))return null;if(x=b.length-1,k=x*Te+1,x=b[x]){for(;x%10==0;x/=10,k--);for(x=b[0];x>=10;x/=10,k++);}return u&&T.e+1>k&&(k=T.e+1),k},a.shiftedBy=function(u){return dt(u,-Rd,Rd),this.times("1e"+u)},a.squareRoot=a.sqrt=function(){var u,f,b,k,x,T=this,B=T.c,g=T.s,w=T.e,S=o+4,A=new v("0.5");if(g!==1||!B||!B[0])return new v(!g||g<0&&(!B||B[0])?NaN:B?T:1/0);if(g=Math.sqrt(+F(T)),g==0||g==1/0?(f=On(B),(f.length+w)%2==0&&(f+="0"),g=Math.sqrt(+f),w=Bn((w+1)/2)-(w<0||w%2),g==1/0?f="5e"+w:(f=g.toExponential(),f=f.slice(0,f.indexOf("e")+1)+w),b=new v(f)):b=new v(g+""),b.c[0]){for(w=b.e,g=w+S,g<3&&(g=0);;)if(x=b,b=A.times(x.plus(t(T,x,S,1))),On(x.c).slice(0,g)===(f=On(b.c)).slice(0,g))if(b.e<w&&--g,f=f.slice(g-3,g+1),f=="9999"||!k&&f=="4999"){if(!k&&(L(x,x.e+o+2,0),x.times(x).eq(T))){b=x;break}S+=4,g+=4,k=1}else{(!+f||!+f.slice(1)&&f.charAt(0)=="5")&&(L(b,b.e+o+2,1),u=!b.times(b).eq(T));break}}return L(b,b.e+o+1,i,u)},a.toExponential=function(u,f){return u!=null&&(dt(u,0,Ot),u++),U(this,u,f,1)},a.toFixed=function(u,f){return u!=null&&(dt(u,0,Ot),u=u+this.e+1),U(this,u,f)},a.toFormat=function(u,f,b){var k,x=this;if(b==null)u!=null&&f&&typeof f=="object"?(b=f,f=null):u&&typeof u=="object"?(b=u,u=f=null):b=C;else if(typeof b!="object")throw Error(en+"Argument not an object: "+b);if(k=x.toFixed(u,f),x.c){var T,B=k.split("."),g=+b.groupSize,w=+b.secondaryGroupSize,S=b.groupSeparator||"",A=B[0],D=B[1],R=x.s<0,$=R?A.slice(1):A,j=$.length;if(w&&(T=g,g=w,w=T,j-=T),g>0&&j>0){for(T=j%g||g,A=$.substr(0,T);T<j;T+=g)A+=S+$.substr(T,g);w>0&&(A+=S+$.slice(T)),R&&(A="-"+A)}k=D?A+(b.decimalSeparator||"")+((w=+b.fractionGroupSize)?D.replace(new RegExp("\\d{"+w+"}\\B","g"),"$&"+(b.fractionGroupSeparator||"")):D):A}return(b.prefix||"")+k+(b.suffix||"")},a.toFraction=function(u){var f,b,k,x,T,B,g,w,S,A,D,R,$=this,j=$.c;if(u!=null&&(g=new v(u),!g.isInteger()&&(g.c||g.s!==1)||g.lt(s)))throw Error(en+"Argument "+(g.isInteger()?"out of range: ":"not an integer: ")+F(g));if(!j)return new v($);for(f=new v(s),S=b=new v(s),k=w=new v(s),R=On(j),T=f.e=R.length-$.e-1,f.c[0]=$d[(B=T%Te)<0?Te+B:B],u=!u||g.comparedTo(f)>0?T>0?f:S:g,B=p,p=1/0,g=new v(R),w.c[0]=0;A=t(g,f,0,1),x=b.plus(A.times(k)),x.comparedTo(u)!=1;)b=k,k=x,S=w.plus(A.times(x=S)),w=x,f=g.minus(A.times(x=f)),g=x;return x=t(u.minus(b),k,0,1),w=w.plus(x.times(S)),b=b.plus(x.times(k)),w.s=S.s=$.s,T=T*2,D=t(S,k,T,i).minus($).abs().comparedTo(t(w,b,T,i).minus($).abs())<1?[S,k]:[w,b],p=B,D},a.toNumber=function(){return+F(this)},a.toPrecision=function(u,f){return u!=null&&dt(u,1,Ot),U(this,u,f,2)},a.toString=function(u){var f,b=this,k=b.s,x=b.e;return x===null?k?(f="Infinity",k<0&&(f="-"+f)):f="NaN":(u==null?f=x<=c||x>=l?Kc(On(b.c),x):Ir(On(b.c),x,"0"):u===10&&P?(b=L(new v(b),o+x+1,i),f=Ir(On(b.c),b.e,"0")):(dt(u,2,I.length,"Base"),f=n(Ir(On(b.c),x,"0"),10,u,k,!0)),k<0&&b.c[0]&&(f="-"+f)),f},a.valueOf=a.toJSON=function(){return F(this)},a._isBigNumber=!0,a[Symbol.toStringTag]="BigNumber",a[Symbol.for("nodejs.util.inspect.custom")]=a.valueOf,e!=null&&v.set(e),v}function Bn(e){var t=e|0;return e>0||e===t?t:t-1}function On(e){for(var t,n,r=1,a=e.length,s=e[0]+"";r<a;){for(t=e[r++]+"",n=Te-t.length;n--;t="0"+t);s+=t}for(a=s.length;s.charCodeAt(--a)===48;);return s.slice(0,a+1||1)}function Va(e,t){var n,r,a=e.c,s=t.c,o=e.s,i=t.s,c=e.e,l=t.e;if(!o||!i)return null;if(n=a&&!a[0],r=s&&!s[0],n||r)return n?r?0:-i:o;if(o!=i)return o;if(n=o<0,r=c==l,!a||!s)return r?0:!a^n?1:-1;if(!r)return c>l^n?1:-1;for(i=(c=a.length)<(l=s.length)?c:l,o=0;o<i;o++)if(a[o]!=s[o])return a[o]>s[o]^n?1:-1;return c==l?0:c>l^n?1:-1}function dt(e,t,n,r){if(e<t||e>n||e!==In(e))throw Error(en+(r||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Yc(e){var t=e.c.length-1;return Bn(e.e/Te)==t&&e.c[t]%2!=0}function Kc(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function Ir(e,t,n){var r,a;if(t<0){for(a=n+".";++t;a+=n);e=a+e}else if(r=e.length,++t>r){for(a=n,t-=r;--t;a+=n);e+=a}else t<r&&(e=e.slice(0,t)+"."+e.slice(t));return e}var he=y1();(function(){try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".orbs_OrbsLogo{object-fit:contain;display:inline}.orbs_PoweredBy{border-radius:8px;margin-left:auto;margin-right:auto}.orbs_PoweredBy a{display:flex;align-items:center;justify-content:center;text-decoration:none;color:inherit}.orbs_PoweredBy span{font-size:14px}.orbs_PoweredBy .orbs_OrbsLogo{margin-left:6px;margin-right:6px;width:18px;height:18px}.orbs_Text{margin:0;padding:0}.orbs_Spinner{width:var(--size, 38px);height:var(--size, 38px);border:var(--border-width, 3px) solid var(--border-color, white);border-bottom-color:var(--bottom-border-color, rgba(255, 255, 255, .2));border-radius:50%;display:inline-block;box-sizing:border-box;animation:orbs_rotation 1s linear infinite}@keyframes orbs_rotation{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.orbs_TradeStepLayout{--layout-min-height: 220px;--layout-width: 100%;--layout-display: flex;--layout-direction: column;--layout-align: center;--layout-overflow: visible;display:var(--layout-display);flex-direction:var(--layout-direction);align-items:var(--layout-align);width:var(--layout-width);min-height:var(--layout-min-height);overflow:var(--layout-overflow)}.orbs_TradeStepLayoutBody{--body-gap: 20px;--body-margin-top: 30px;--body-width: 100%;--body-display: flex;--body-direction: column;--body-align: center;--body-overflow: visible;gap:var(--body-gap);align-items:var(--body-align);display:var(--body-display);flex-direction:var(--body-direction);width:var(--body-width);margin-top:var(--body-margin-top);overflow:var(--body-overflow)}.orbs_TradeStepLayoutHeader{--header-gap: 30px;--header-display: flex;--header-direction: column;--header-align: center;--header-justify: center;--header-overflow: visible;display:var(--header-display);flex-direction:var(--header-direction);align-items:var(--header-align);justify-content:var(--header-justify);gap:var(--header-gap);overflow:var(--header-overflow)}.orbs_TradeStepLayoutTitle{--title-font-size: 18px;--title-font-weight: 500;--title-line-height: normal;--title-color: inherit;--title-text-align: center;--title-margin: 0;--title-padding: 0;font-size:var(--title-font-size);font-weight:var(--title-font-weight);line-height:var(--title-line-height);color:var(--title-color);text-align:var(--title-text-align);margin:var(--title-margin);padding:var(--title-padding)}.orbs_StepIndicator{--indicator-display: flex;--indicator-align: center;--indicator-justify: flex-start;--indicator-height: 7px;--indicator-width: 120px;--indicator-border-radius: 999px;--indicator-bg-color: white;--indicator-margin-bottom: 20px;--indicator-position: relative;--indicator-overflow: hidden;--indicator-border: none;--indicator-box-shadow: none;display:var(--indicator-display);align-items:var(--indicator-align);justify-content:var(--indicator-justify);height:var(--indicator-height);width:var(--indicator-width);border-radius:var(--indicator-border-radius);overflow:var(--indicator-overflow);background-color:var(--indicator-bg-color);margin-bottom:var(--indicator-margin-bottom);position:var(--indicator-position);border:var(--indicator-border);box-shadow:var(--indicator-box-shadow)}.orbs_StepIndicatorLine{--line-height: 100%;--line-bg-color: black;--line-position: absolute;--line-top: 0;--line-left: 0;--line-right: 0;--line-bottom: 0;--line-transition: all .3s ease;--line-border-radius: inherit;--line-box-shadow: none;height:var(--line-height);background-color:var(--line-bg-color);position:var(--line-position);top:var(--line-top);left:var(--line-left);right:var(--line-right);bottom:var(--line-bottom);transition:var(--line-transition);border-radius:var(--line-border-radius);box-shadow:var(--line-box-shadow)}.orbs_TradeStepLayoutFooter{--footer-display: flex;--footer-align: center;--footer-justify: center;--footer-direction: column;--footer-margin-top: auto;--footer-padding-top: 30px;--footer-width: 100%;--footer-overflow: visible;--footer-border-top: none;display:var(--footer-display);align-items:var(--footer-align);justify-content:var(--footer-justify);flex-direction:var(--footer-direction);margin-top:var(--footer-margin-top);padding-top:var(--footer-padding-top);width:var(--footer-width);overflow:var(--footer-overflow);border-top:var(--footer-border-top)}.orbs_TradeStepLayoutFooter p{--footer-text-font-size: 15px;--footer-text-line-height: normal;--footer-text-color: inherit;--footer-text-margin: 0;--footer-text-padding: 0;font-size:var(--footer-text-font-size);line-height:var(--footer-text-line-height);color:var(--footer-text-color);margin:var(--footer-text-margin);padding:var(--footer-text-padding)}.orbs_TradeStepLayoutFooterLink{--link-color: inherit;--link-text-decoration: none;--link-font-size: 15px;--link-text-align: center;--link-margin: auto;--link-outline: none;--link-line-height: normal;--link-padding: 0;--link-transition: color .2s ease;--link-hover-color: inherit;--link-hover-text-decoration: underline;color:var(--link-color);text-decoration:var(--link-text-decoration);font-size:var(--link-font-size);text-align:var(--link-text-align);margin-left:var(--link-margin);margin-right:var(--link-margin);outline:var(--link-outline);line-height:var(--link-line-height);padding:var(--link-padding);transition:var(--link-transition)}.orbs_TradeStepLayoutFooterLink:hover{color:var(--link-hover-color);text-decoration:var(--link-hover-text-decoration)}.orbs_TradeStepLayoutSuccessIcon{--success-icon-display: flex;--success-icon-justify: center;--success-icon-align: center;--success-icon-width: 60px;--success-icon-height: 60px;--success-icon-border-radius: 50%;--success-icon-overflow: visible;--success-icon-bg-color: transparent;--success-icon-border: none;--success-icon-box-shadow: none;display:var(--success-icon-display);justify-content:var(--success-icon-justify);align-items:var(--success-icon-align);width:var(--success-icon-width);height:var(--success-icon-height);border-radius:var(--success-icon-border-radius);overflow:var(--success-icon-overflow);background-color:var(--success-icon-bg-color);border:var(--success-icon-border);box-shadow:var(--success-icon-box-shadow)}.orbs_TradeStepLayoutErrorIcon{--error-icon-width: 80px;--error-icon-height: 80px;--error-icon-display: flex;--error-icon-justify: center;--error-icon-align: center;--error-icon-overflow: visible;--error-icon-bg-color: transparent;--error-icon-border: none;--error-icon-box-shadow: none;width:var(--error-icon-width);height:var(--error-icon-height);display:var(--error-icon-display);justify-content:var(--error-icon-justify);align-items:var(--error-icon-align);overflow:var(--error-icon-overflow);background-color:var(--error-icon-bg-color);border:var(--error-icon-border);box-shadow:var(--error-icon-box-shadow)}.orbs_FailedContentMsg{font-size:22px;font-weight:500}.orbs_TradePreview{display:flex;align-items:center;justify-content:center;gap:8px;width:100%}.orbs_TradePreviewToken{display:flex;align-items:center;gap:6px;max-width:calc(50% - 30px)}.orbs_TradePreviewToken p{--token-font-size: 15px;--token-white-space: nowrap;--token-overflow: hidden;--token-text-overflow: ellipsis;--token-flex: 1;--token-margin: 0;--token-padding: 0;font-size:var(--token-font-size);white-space:var(--token-white-space);overflow:var(--token-overflow);text-overflow:var(--token-text-overflow);flex:var(--token-flex);margin:var(--token-margin)}.orbs_TradepPreviewIcon{width:22px;height:22px}.orbs_TradepPreviewLogo{width:24px;height:24px;border-radius:50%;overflow:hidden}.orbs_FlexRow{display:flex;flex-direction:row}.orbs_FlexColumn{display:flex;flex-direction:column}@keyframes orbs_skeletonAnimation{0%{opacity:.2}to{opacity:.4}}.orbs_SkeletonLoader{animation:orbs_skeletonAnimation 1s linear infinite alternate;background-color:#fff}.orbs_Main-wrapper{width:100%}.orbs_Main{width:100%;display:flex;flex-direction:column;gap:28px}.orbs_MainToken{display:flex;flex-direction:row;align-items:center;justify-content:space-between;width:100%;gap:8px}.orbs_MainTokenLeft{display:flex;flex-direction:column;align-items:flex-start;gap:8px}.orbs_MainTokenUsd{display:flex;align-items:center;gap:5px}.orbs_MainTokenUsd small{font-size:12px;opacity:.6}.orbs_MainContentLoader{width:100%;display:flex;gap:15px;align-items:center;margin-top:20px}.orbs_MainContentRectengularLoader{flex:1;height:20px;max-width:250px;border-radius:20px}.orbs_MainContentCircleLoader{width:30px;height:30px;border-radius:50%}.orbs_MainTokenLogo{--width: 40px;--height: 40px;width:var(--width);height:var(--height)}.orbs_MainTokenLogo img{width:100%;height:100%;object-fit:cover}.orbs_SwapFlow{display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%}.orbs_SwapFlow *{box-sizing:border-box}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();const Re=e=>`orbs_${e}`;function Wo({children:e,className:t=""}){return _.jsx("p",{className:`${t} ${Re("Text")}`,children:e})}const g1=N.createContext({});function E8({children:e,...t}){return _.jsx(g1.Provider,{value:t,children:e})}const cr=()=>N.useContext(g1);var At=(e=>(e[e.LOADING=1]="LOADING",e[e.SUCCESS=2]="SUCCESS",e[e.FAILED=3]="FAILED",e))(At||{});const T8=({className:e="",size:t=38,borderWidth:n=3,borderColor:r="white",bottomBorderColor:a="rgba(255, 255, 255, 0.2)"})=>{const s={"--size":`${t}px`,"--border-width":`${n}px`,"--border-color":r,"--bottom-border-color":a};return _.jsx("div",{className:`${Re("Spinner")} ${e}`,style:s})};function Zc({className:e="",body:t,footerLink:n,footerText:r,title:a,children:s}){return _.jsxs("div",{className:`${Re("TradeStepLayout")} ${e}`,children:[_.jsxs("div",{className:Re("TradeStepLayoutHeader"),children:[_.jsx(I8,{}),a&&_.jsx(Wo,{className:Re("TradeStepLayoutTitle"),children:a})]}),t&&_.jsx("div",{className:Re("TradeStepLayoutBody"),children:t}),_.jsx(C8,{link:n,text:r}),s]})}const C8=({link:e,text:t})=>{const{swapStatus:n}=cr();return!e&&!t?null:_.jsxs("div",{className:Re("TradeStepLayoutFooter"),children:[_.jsx(O8,{}),e?_.jsx(A8,{link:e,text:t}):n===At.FAILED?void 0:_.jsx(Wo,{children:t})]})},A8=({link:e,text:t})=>_.jsx("a",{target:"_blank",className:Re("TradeStepLayoutFooterLink"),href:e,children:t});function S8(){const{components:e}=cr();return e.SuccessIcon?e.SuccessIcon:_.jsxs("svg",{fill:"none",viewBox:"0 0 16 16",className:Re("TradeStepLayoutSuccessIcon"),children:[_.jsx("circle",{cx:"8",cy:"8",r:"7",strokeWidth:"1.5",stroke:"#00C853"}),_.jsx("path",{strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",stroke:"#00C853",d:"M5 8l2 2 4-4"})]})}function P8(){const{components:e}=cr();return e.FailedIcon?e.FailedIcon:_.jsxs("svg",{className:Re("TradeStepLayoutErrorIcon"),viewBox:"0 0 16 16",fill:"none",children:[_.jsx("circle",{cx:"8",cy:"8",r:"7",strokeWidth:"1.5",stroke:"#FF3D00"}),_.jsx("path",{strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",stroke:"#FF3D00",d:"M8 4v5M8 11h.01"})]})}const I8=()=>{const{swapStatus:e}=cr();return e===At.SUCCESS?_.jsx(S8,{}):e===At.FAILED?_.jsx(P8,{}):_.jsx(B8,{})},B8=()=>{const{components:e}=cr();return e.Loader?e.Loader:_.jsx(T8,{size:60,borderWidth:5,className:Re("TradeStepLayoutSpinner")})},O8=()=>{const{totalSteps:e,currentStepIndex:t=0,swapStatus:n}=cr();return n!==At.LOADING||e===1?null:_.jsx("div",{className:Re("StepIndicator"),children:_.jsx("div",{style:{width:`${100/(e||0)}%`,left:`${t*100/(e||0)}%`},className:Re("StepIndicatorLine")})})},F8=({error:e,footerLink:t,footerText:n})=>_.jsx(Zc,{footerLink:t,footerText:n,body:e||_.jsx("p",{className:Re("FailedContentMsg"),children:"Something went wrong"}),className:Re("FailedContent")});function U8(){return _.jsx("svg",{fill:"currentColor",viewBox:"0 0 16 16",className:Re("TradepPreviewIcon"),children:_.jsx("path",{fillRule:"evenodd",d:"M4 8a.5.5 0 01.5-.5h5.793L8.146 5.354a.5.5 0 11.708-.708l3 3a.5.5 0 010 .708l-3 3a.5.5 0 01-.708-.708L10.293 8.5H4.5A.5.5 0 014 8z"})})}const x1=({inTokenOnly:e})=>{const{inToken:t,outToken:n,inAmount:r,outAmount:a,components:s}=cr();return _.jsxs("div",{className:Re("TradePreview"),children:[_.jsx(w1,{token:t,amount:r,Logo:s==null?void 0:s.SrcTokenLogo}),!e&&_.jsxs(_.Fragment,{children:[_.jsx(U8,{}),_.jsx(w1,{token:n,amount:a,Logo:s==null?void 0:s.DstTokenLogo})]})]})},w1=({token:e,amount:t,Logo:n})=>_.jsxs("div",{className:Re("TradePreviewToken"),children:[n||_.jsx("img",{src:e==null?void 0:e.logoUrl,className:Re("TradepPreviewLogo"),alt:`${e==null?void 0:e.symbol} logo`}),_.jsxs(Wo,{children:[t," ",e==null?void 0:e.symbol]})]});function D8({title:e,footerLink:t,footerText:n,hideTokens:r}){return _.jsx(Zc,{title:e,className:Re("Success"),body:!r&&_.jsx(x1,{}),footerLink:t,footerText:n})}const v1=({$gap:e=10,$alignItems:t="flex-start",children:n,className:r="",customStyles:a={}})=>{const s={gap:`${e}px`,alignItems:t,width:"100%",...a};return _.jsx("div",{className:`${Re("FlexColumn")} ${r}`,style:s,children:n})};function k1({styles:e={},className:t=""}){return _.jsx("div",{style:e,className:`${Re("SkeletonLoader")} ${t}`})}const _8=()=>_.jsxs("div",{className:`${Re("MainContentLoader")}`,children:[_.jsx(k1,{className:`${Re("MainContentCircleLoader")}`}),_.jsx(k1,{className:`${Re("MainContentRectengularLoader")}`})]}),M8=({fromTitle:e,toTitle:t,inUsd:n,outUsd:r})=>{const{swapStatus:a,outAmount:s,inAmount:o,inToken:i,outToken:c,components:l,totalSteps:d}=cr(),p=_.jsx(T1,{fromTitle:e,inUsd:n,inToken:i,toTitle:t,outUsd:r,outToken:c,inAmount:o,outAmount:s,SrcTokenLogo:l.SrcTokenLogo,DstTokenLogo:l.DstTokenLogo});return a?d?_.jsx(N8,{}):_.jsxs(v1,{children:[p,_.jsx(_8,{})]}):_.jsx(v1,{children:p})},E1=({amount:e,token:t,usd:n,title:r,Logo:a})=>_.jsxs("div",{className:`${Re("MainToken")}`,children:[_.jsxs("div",{className:`${Re("MainTokenLeft")}`,children:[_.jsx(Wo,{className:`${Re("MainTokenTitle")}`,children:r}),_.jsx(Wo,{className:` ${Re("MainTokenAmount")}`,children:`${e&&Number(e)>0?e:""} ${(t==null?void 0:t.symbol)||""}`}),n&&_.jsx("div",{className:` ${Re("MainTokenUsd")}`,children:n})]}),a||_.jsx("div",{className:` ${Re("MainTokenLogo")}`,children:t!=null&&t.logoUrl?_.jsx("img",{src:t==null?void 0:t.logoUrl,alt:"Token logo"}):null})]});function N8(){const{currentStep:e}=cr();return e?_.jsx(Zc,{footerLink:e.footerLink,footerText:e.footerText,title:e.title,body:e.hideTokens?void 0:_.jsx(x1,{inTokenOnly:e==null?void 0:e.inTokenOnly})}):null}const T1=({fromTitle:e,inUsd:t,inToken:n,toTitle:r,outUsd:a,outToken:s,inAmount:o,outAmount:i,SrcTokenLogo:c,DstTokenLogo:l})=>_.jsxs("div",{className:`${Re("Main")}`,children:[_.jsx(E1,{title:e||"Swap from",usd:t,token:n,amount:o,Logo:c}),_.jsx(E1,{title:r||"Swap to",usd:a,token:s,amount:i,Logo:l})]}),la=e=>_.jsx(E8,{...e,children:_.jsx(L8,{})}),L8=()=>{const{swapStatus:e,components:t,className:n}=cr();return _.jsx("div",{className:`${Re("SwapFlow")} ${n}`,children:e===At.SUCCESS?t==null?void 0:t.Success:e===At.FAILED?t==null?void 0:t.Failed:t==null?void 0:t.Main})};la.Success=D8,la.Failed=F8,la.Main=M8,la.StepLayout=Zc;var Rt=(e=>(e[e.EMPTY_LIMIT_PRICE=0]="EMPTY_LIMIT_PRICE",e[e.MAX_CHUNKS=1]="MAX_CHUNKS",e[e.MIN_CHUNKS=2]="MIN_CHUNKS",e[e.MIN_TRADE_SIZE=3]="MIN_TRADE_SIZE",e[e.MAX_FILL_DELAY=4]="MAX_FILL_DELAY",e[e.MIN_FILL_DELAY=5]="MIN_FILL_DELAY",e[e.MAX_ORDER_DURATION=6]="MAX_ORDER_DURATION",e[e.MIN_ORDER_DURATION=7]="MIN_ORDER_DURATION",e[e.MISSING_LIMIT_PRICE=8]="MISSING_LIMIT_PRICE",e[e.STOP_LOSS_TRIGGER_PRICE_GREATER_THAN_MARKET_PRICE=9]="STOP_LOSS_TRIGGER_PRICE_GREATER_THAN_MARKET_PRICE",e[e.TRIGGER_LIMIT_PRICE_GREATER_THAN_TRIGGER_PRICE=10]="TRIGGER_LIMIT_PRICE_GREATER_THAN_TRIGGER_PRICE",e[e.TAKE_PROFIT_TRIGGER_PRICE_LESS_THAN_MARKET_PRICE=11]="TAKE_PROFIT_TRIGGER_PRICE_LESS_THAN_MARKET_PRICE",e[e.EMPTY_TRIGGER_PRICE=12]="EMPTY_TRIGGER_PRICE",e[e.INSUFFICIENT_BALANCE=13]="INSUFFICIENT_BALANCE",e[e.MAX_ORDER_SIZE=14]="MAX_ORDER_SIZE",e))(Rt||{}),Wa=(e=>(e.WRAP="wrap",e.APPROVE="approve",e.CREATE="create",e))(Wa||{});const z8=e=>e.replace(/,/g,""),R8=async e=>{if(!(navigator!=null&&navigator.clipboard))return console.warn("Clipboard not supported"),!1;try{return await navigator.clipboard.writeText(e),!0}catch(t){return console.warn("Copy failed",t),!1}},C1=e=>{if(!e)return"";const t=Math.floor(e/1e3),n=Math.floor(t/(1440*60)),r=Math.floor(t%(1440*60)/3600),a=Math.floor(t%3600/60),s=t%60,o=[];return n&&o.push(`${n} days `),r&&o.push(`${r} hours `),a&&o.push(`${a} minutes`),s&&o.push(`${s} seconds`),o.join(" ")},Hd=(e,t)=>e?`${e.substring(0,(t==null?void 0:t.start)||6)}...${e.substring(e.length-((t==null?void 0:t.end)||5))}`:"",$8=e=>{const t="An error occurred.";if(!e||!e.message)return t;try{return e.message.toLowerCase().indexOf("rejected")?"Transaction Rejected":t}catch{return t}};function qo(e,t=6,n=8){if(!e)return"";const r=e.startsWith("-")?"-":"",a=r?e.slice(1):e,[s,o=""]=a.split(".");if(!o||Number(o)===0)return r+s;if(s!=="0"){const h=o.slice(0,t).replace(/0+$/,""),y=h?"."+h:"";return r+s+y}const i=o.search(/[^0]/);if(i===-1||i+1>n)return"0";const c=o.slice(0,i),d=o.slice(i).slice(0,t).replace(/0+$/,"");return d?r+"0."+c+d:"0"}const Gd=e=>{var t,n,r,a;if(e!=null&&e.message)return((n=(t=e.message)==null?void 0:t.toLowerCase())==null?void 0:n.includes("rejected"))||((a=(r=e.message)==null?void 0:r.toLowerCase())==null?void 0:a.includes("denied"))},H8=e=>{switch(e){case _t.base.id:return 1e-4;default:return .01}},A1=(e,t,n)=>{if(!he(e.srcAmountFilled||0).gt(0)||!he(e.dstAmountFilled||0).gt(0))return"";const r=ir(t,e.srcAmountFilled),a=ir(n,e.dstAmountFilled);return he(a).div(r).toFixed()},S1=(e,t,n)=>{if(e.type===ft.TWAP_MARKET)return"";const r=ir(t,e.srcAmountPerTrade),a=ir(n,e.dstMinAmountPerTrade);return he(a).div(r).toFixed()},P1=(e,t)=>{const n=$a(t);return n&&Ra(e.address)?n.wToken:e};function I1(e){return e?e/864e5:0}function jd(e){return e?e/6e4:0}const G8=(e,t)=>e?ft.TWAP_MARKET:t===1?ft.LIMIT:ft.TWAP_LIMIT,Vd=(e,t,n)=>{const r=$a(n);return Ra((e==null?void 0:e.address)||"")&&za((t==null?void 0:t.address)||"",(r==null?void 0:r.wToken.address)||"")},Wd=(e,t,n)=>{const r=$a(n);return za((e==null?void 0:e.address)||"",(r==null?void 0:r.wToken.address)||"")&&Ra((t==null?void 0:t.address)||"")},Yo=(e,t)=>{if(!t)return"";const n=$a(t);return`${n==null?void 0:n.explorer}/tx/${e}`};function m(e){const t={formatters:void 0,fees:void 0,serializers:void 0,...e};function n(r){return a=>{const s=typeof a=="function"?a(r):a,o={...r,...s};return Object.assign(o,{extend:n(o)})}}return Object.assign(t,{extend:n(t)})}function j8(){return{}}const V8=m({id:16600,name:"0G Newton Testnet",nativeCurrency:{name:"A0GI",symbol:"A0GI",decimals:18},rpcUrls:{default:{http:["https://evmrpc-testnet.0g.ai"]}},blockExplorers:{default:{name:"0G BlockChain Explorer",url:"https://chainscan-newton.0g.ai"}},testnet:!0}),W8=m({id:16601,name:"0G Galileo Testnet",nativeCurrency:{name:"A0GI",symbol:"A0GI",decimals:18},rpcUrls:{default:{http:["https://evmrpc-testnet.0g.ai"]}},blockExplorers:{default:{name:"0G BlockChain Explorer",url:"https://chainscan-galileo.0g.ai"}},testnet:!0}),q8=m({id:16661,name:"0G Mainnet",nativeCurrency:{name:"0G",symbol:"0G",decimals:18},rpcUrls:{default:{http:["https://evmrpc.0g.ai"]}},blockExplorers:{default:{name:"0G BlockChain Explorer",url:"https://chainscan.0g.ai"}},testnet:!1}),Y8=m({id:16602,name:"0G Galileo Testnet",nativeCurrency:{name:"A0GI",symbol:"A0GI",decimals:18},rpcUrls:{default:{http:["https://evmrpc-testnet.0g.ai"]}},blockExplorers:{default:{name:"0G BlockChain Explorer",url:"https://chainscan-galileo.0g.ai"}},testnet:!0}),K8=m({id:995,name:"5ireChain",nativeCurrency:{name:"5ire Token",symbol:"5IRE",decimals:18},rpcUrls:{default:{http:["https://rpc.5ire.network"]}},blockExplorers:{default:{name:"5ireChain Mainnet Explorer",url:"https://5irescan.io/"}},testnet:!1}),Z8=m({id:179,name:"ABEY Mainnet",nativeCurrency:{name:"ABEY",symbol:"ABEY",decimals:18},rpcUrls:{default:{http:["https://rpc.abeychain.com"]}},blockExplorers:{default:{name:"Abey Scan",url:"https://abeyscan.com"}},testnet:!1}),B1="2.43.3";let Ko={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${B1}`},G=class Ym extends Error{constructor(t,n={}){var i;const r=(()=>{var c;return n.cause instanceof Ym?n.cause.details:(c=n.cause)!=null&&c.message?n.cause.message:n.details})(),a=n.cause instanceof Ym&&n.cause.docsPath||n.docsPath,s=(i=Ko.getDocsUrl)==null?void 0:i.call(Ko,{...n,docsPath:a}),o=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],...Ko.version?[`Version: ${Ko.version}`]:[]].join(`
|
|
64
|
+
`,extractResults:l=>{var d;return(((d=l.data)==null?void 0:d.orderFilleds)||[]).map(p=>({...p,timestamp:new Date(p.timestamp).getTime()}))}})};let P3=class extends Error{constructor(){super("No graph endpoint found"),this.name="NoGraphEndpointError"}};const I3=async({chainId:e,signal:t,page:n,limit:r,filters:a})=>{const s=await C3({chainId:e,signal:t,page:n,limit:r,filters:a}),[o,i]=await Promise.all([S3({chainId:e,orders:s,signal:t}),A3({chainId:e,orders:s,signal:t})]);return s.map(c=>{const l=o==null?void 0:o.filter(d=>d.TWAP_id===Number(c.Contract_id)&&za(d.exchange,c.exchange)&&za(d.twapAddress,c.twapAddress));return E3(c,e,l,B3(c,l||[],i))}).sort((c,l)=>l.createdAt-c.createdAt)},B3=(e,t,n)=>{var r;const a=(r=n==null?void 0:n.find(i=>i.twapId===e.Contract_id.toString()&&za(i.twapAddress,e.twapAddress)))==null?void 0:r.status,{filledSrcAmount:s}=Hh(t),o=jh(e.ask_srcAmount,s);return O3(o,e.ask_deadline*1e3,a)},jh=(e,t)=>{if(!t||!e)return 0;const n=le(t).dividedBy(e).toNumber();return n>=.99?100:n<=0?0:Number((n*100).toFixed(2))},O3=(e,t,n)=>e===100?tt.Completed:n==="CANCELED"?tt.Canceled:n==="COMPLETED"?tt.Completed:t>Date.now()?tt.Open:tt.Expired,Vh=async({signal:e,page:t,chainId:n,limit:r,config:a,account:s})=>(await Promise.all([a?I3({chainId:n,signal:e,page:t,limit:r,filters:{accounts:[s],configs:[a]}}):Promise.resolve([]),w3({chainId:n,signal:e,account:s})]).then(([o,i])=>[...o,...i])).sort((o,i)=>i.createdAt-o.createdAt),Wh=e=>{let t;const n=new Set,r=(l,d)=>{const p=typeof l=="function"?l(t):l;if(!Object.is(p,t)){const h=t;t=d??(typeof p!="object"||p===null)?p:Object.assign({},t,p),n.forEach(y=>y(t,h))}},a=()=>t,i={setState:r,getState:a,getInitialState:()=>c,subscribe:l=>(n.add(l),()=>n.delete(l))},c=t=e(r,a,i);return i},F3=(e=>e?Wh(e):Wh),U3=e=>e;function D3(e,t=U3){const n=N.useSyncExternalStore(e.subscribe,N.useCallback(()=>t(e.getState()),[e,t]),N.useCallback(()=>t(e.getInitialState()),[e,t]));return N.useDebugValue(n),n}const qh=e=>{const t=F3(e),n=r=>D3(t,r);return Object.assign(n,t),n},_3=(e=>e?qh(e):qh),Yh={disclaimerAccepted:!0,currentTime:Date.now(),swapExecution:{}},Q=_3((e,t)=>({state:Yh,updateState:n=>e(r=>({state:{...r.state,...n}})),updateSwapExecution:n=>e(r=>({state:{...r.state,swapExecution:{...r.state.swapExecution,...n}}})),resetState:()=>{e({state:{...Yh,currentTime:Date.now(),swapExecution:t().state.swapExecution,isMarketOrder:t().state.isMarketOrder}})}})),M3={version:"0.0.21"};var Ns=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(){}},N3={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},L3=(F5=class{constructor(){me(this,kr,N3);me(this,Ts,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&z(this,Ts)&&e!==z(this,kr)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:z(this,kr),provider:e}),ne(this,kr,e),process.env.NODE_ENV!=="production"&&ne(this,Ts,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&ne(this,Ts,!0),z(this,kr).setTimeout(e,t)}clearTimeout(e){z(this,kr).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&ne(this,Ts,!0),z(this,kr).setInterval(e,t)}clearInterval(e){z(this,kr).clearInterval(e)}},kr=new WeakMap,Ts=new WeakMap,F5),Ha=new L3;function z3(e){setTimeout(e,0)}var Ga=typeof window>"u"||"Deno"in globalThis;function Yt(){}function R3(e,t){return typeof e=="function"?e(t):e}function Pd(e){return typeof e=="number"&&e>=0&&e!==1/0}function Kh(e,t){return Math.max(e+(t||0)-Date.now(),0)}function ia(e,t){return typeof e=="function"?e(t):e}function Pn(e,t){return typeof e=="function"?e(t):e}function Zh(e,t){const{type:n="all",exact:r,fetchStatus:a,predicate:s,queryKey:o,stale:i}=e;if(o){if(r){if(t.queryHash!==Id(o,t.options))return!1}else if(!jo(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||a&&a!==t.state.fetchStatus||s&&!s(t))}function Xh(e,t){const{exact:n,status:r,predicate:a,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return!1;if(n){if(ja(t.options.mutationKey)!==ja(s))return!1}else if(!jo(t.options.mutationKey,s))return!1}return!(r&&t.state.status!==r||a&&!a(t))}function Id(e,t){return((t==null?void 0:t.queryKeyHashFn)||ja)(e)}function ja(e){return JSON.stringify(e,(t,n)=>Od(n)?Object.keys(n).sort().reduce((r,a)=>(r[a]=n[a],r),{}):n)}function jo(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>jo(e[n],t[n])):!1}var $3=Object.prototype.hasOwnProperty;function Bd(e,t){if(e===t)return e;const n=Qh(e)&&Qh(t);if(!n&&!(Od(e)&&Od(t)))return t;const a=(n?e:Object.keys(e)).length,s=n?t:Object.keys(t),o=s.length,i=n?new Array(o):{};let c=0;for(let l=0;l<o;l++){const d=n?l:s[l],p=e[d],h=t[d];if(p===h){i[d]=p,(n?l<a:$3.call(e,d))&&c++;continue}if(p===null||h===null||typeof p!="object"||typeof h!="object"){i[d]=h;continue}const y=Bd(p,h);i[d]=y,y===p&&c++}return a===o&&c===a?e:i}function jc(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 Qh(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Od(e){if(!Jh(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!Jh(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Jh(e){return Object.prototype.toString.call(e)==="[object Object]"}function H3(e){return new Promise(t=>{Ha.setTimeout(t,e)})}function Fd(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 Bd(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 Bd(e,t)}return t}function G3(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function j3(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Vc=Symbol();function e1(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Vc&&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===Vc?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function t1(e,t){return typeof e=="function"?e(...t):!!e}var V3=(U5=class extends Ns{constructor(){super();me(this,Cs);me(this,Ia);me(this,Bo);ne(this,Bo,t=>{if(!Ga&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){z(this,Ia)||this.setEventListener(z(this,Bo))}onUnsubscribe(){var t;this.hasListeners()||((t=z(this,Ia))==null||t.call(this),ne(this,Ia,void 0))}setEventListener(t){var n;ne(this,Bo,t),(n=z(this,Ia))==null||n.call(this),ne(this,Ia,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){z(this,Cs)!==t&&(ne(this,Cs,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof z(this,Cs)=="boolean"?z(this,Cs):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Cs=new WeakMap,Ia=new WeakMap,Bo=new WeakMap,U5),Ud=new V3;function Dd(){let e,t;const n=new Promise((a,s)=>{e=a,t=s});n.status="pending",n.catch(()=>{});function r(a){Object.assign(n,a),delete n.resolve,delete n.reject}return n.resolve=a=>{r({status:"fulfilled",value:a}),e(a)},n.reject=a=>{r({status:"rejected",reason:a}),t(a)},n}var W3=z3;function q3(){let e=[],t=0,n=i=>{i()},r=i=>{i()},a=W3;const s=i=>{t?e.push(i):a(()=>{n(i)})},o=()=>{const i=e;e=[],i.length&&a(()=>{r(()=>{i.forEach(c=>{n(c)})})})};return{batch:i=>{let c;t++;try{c=i()}finally{t--,t||o()}return c},batchCalls:i=>(...c)=>{s(()=>{i(...c)})},schedule:s,setNotifyFunction:i=>{n=i},setBatchNotifyFunction:i=>{r=i},setScheduler:i=>{a=i}}}var Ct=q3(),Y3=(D5=class extends Ns{constructor(){super();me(this,Oo,!0);me(this,Ba);me(this,Fo);ne(this,Fo,t=>{if(!Ga&&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(){z(this,Ba)||this.setEventListener(z(this,Fo))}onUnsubscribe(){var t;this.hasListeners()||((t=z(this,Ba))==null||t.call(this),ne(this,Ba,void 0))}setEventListener(t){var n;ne(this,Fo,t),(n=z(this,Ba))==null||n.call(this),ne(this,Ba,t(this.setOnline.bind(this)))}setOnline(t){z(this,Oo)!==t&&(ne(this,Oo,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return z(this,Oo)}},Oo=new WeakMap,Ba=new WeakMap,Fo=new WeakMap,D5),Wc=new Y3;function K3(e){return Math.min(1e3*2**e,3e4)}function n1(e){return(e??"online")==="online"?Wc.isOnline():!0}var _d=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function r1(e){let t=!1,n=0,r;const a=Dd(),s=()=>a.status!=="pending",o=C=>{var I;if(!s()){const P=new _d(C);h(P),(I=e.onCancel)==null||I.call(e,P)}},i=()=>{t=!0},c=()=>{t=!1},l=()=>Ud.isFocused()&&(e.networkMode==="always"||Wc.isOnline())&&e.canRun(),d=()=>n1(e.networkMode)&&e.canRun(),p=C=>{s()||(r==null||r(),a.resolve(C))},h=C=>{s()||(r==null||r(),a.reject(C))},y=()=>new Promise(C=>{var I;r=P=>{(s()||l())&&C(P)},(I=e.onPause)==null||I.call(e)}).then(()=>{var C;r=void 0,s()||(C=e.onContinue)==null||C.call(e)}),E=()=>{if(s())return;let C;const I=n===0?e.initialPromise:void 0;try{C=I??e.fn()}catch(P){C=Promise.reject(P)}Promise.resolve(C).then(p).catch(P=>{var L;if(s())return;const v=e.retry??(Ga?0:3),U=e.retryDelay??K3,O=typeof U=="function"?U(n,P):U,M=v===!0||typeof v=="number"&&n<v||typeof v=="function"&&v(n,P);if(t||!M){h(P);return}n++,(L=e.onFail)==null||L.call(e,n,P),H3(O).then(()=>l()?void 0:y()).then(()=>{t?h(P):E()})})};return{promise:a,status:()=>a.status,cancel:o,continue:()=>(r==null||r(),a),cancelRetry:i,continueRetry:c,canStart:d,start:()=>(d()?E():y().then(E),a)}}var a1=(_5=class{constructor(){me(this,As)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Pd(this.gcTime)&&ne(this,As,Ha.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ga?1/0:300*1e3))}clearGcTimeout(){z(this,As)&&(Ha.clearTimeout(z(this,As)),ne(this,As,void 0))}},As=new WeakMap,_5),Z3=(M5=class extends a1{constructor(t){super();me(this,sr);me(this,Ss);me(this,Uo);me(this,zn);me(this,Ps);me(this,Dt);me(this,Fc);me(this,Is);ne(this,Is,!1),ne(this,Fc,t.defaultOptions),this.setOptions(t.options),this.observers=[],ne(this,Ps,t.client),ne(this,zn,z(this,Ps).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,ne(this,Ss,i1(this.options)),this.state=t.state??z(this,Ss),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=z(this,Dt))==null?void 0:t.promise}setOptions(t){if(this.options={...z(this,Fc),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=i1(this.options);n.data!==void 0&&(this.setState(o1(n.data,n.dataUpdatedAt)),ne(this,Ss,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&z(this,zn).remove(this)}setData(t,n){const r=Fd(this.state.data,t,this.options);return Oe(this,sr,aa).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){Oe(this,sr,aa).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,a;const n=(r=z(this,Dt))==null?void 0:r.promise;return(a=z(this,Dt))==null||a.cancel(t),n?n.then(Yt).catch(Yt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(z(this,Ss))}isActive(){return this.observers.some(t=>Pn(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Vc||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>ia(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:!Kh(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=z(this,Dt))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=z(this,Dt))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),z(this,zn).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(z(this,Dt)&&(z(this,Is)?z(this,Dt).cancel({revert:!0}):z(this,Dt).cancelRetry()),this.scheduleGc()),z(this,zn).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Oe(this,sr,aa).call(this,{type:"invalidate"})}async fetch(t,n){var c,l,d,p,h,y,E,C,I,P,v,U;if(this.state.fetchStatus!=="idle"&&((c=z(this,Dt))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(z(this,Dt))return z(this,Dt).continueRetry(),z(this,Dt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const O=this.observers.find(M=>M.options.queryFn);O&&this.setOptions(O.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,a=O=>{Object.defineProperty(O,"signal",{enumerable:!0,get:()=>(ne(this,Is,!0),r.signal)})},s=()=>{const O=e1(this.options,n),L=(()=>{const F={client:z(this,Ps),queryKey:this.queryKey,meta:this.meta};return a(F),F})();return ne(this,Is,!1),this.options.persister?this.options.persister(O,L,this):O(L)},i=(()=>{const O={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:z(this,Ps),state:this.state,fetchFn:s};return a(O),O})();(l=this.options.behavior)==null||l.onFetch(i,this),ne(this,Uo,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=i.fetchOptions)==null?void 0:d.meta))&&Oe(this,sr,aa).call(this,{type:"fetch",meta:(p=i.fetchOptions)==null?void 0:p.meta}),ne(this,Dt,r1({initialPromise:n==null?void 0:n.initialPromise,fn:i.fetchFn,onCancel:O=>{O instanceof _d&&O.revert&&this.setState({...z(this,Uo),fetchStatus:"idle"}),r.abort()},onFail:(O,M)=>{Oe(this,sr,aa).call(this,{type:"failed",failureCount:O,error:M})},onPause:()=>{Oe(this,sr,aa).call(this,{type:"pause"})},onContinue:()=>{Oe(this,sr,aa).call(this,{type:"continue"})},retry:i.options.retry,retryDelay:i.options.retryDelay,networkMode:i.options.networkMode,canRun:()=>!0}));try{const O=await z(this,Dt).start();if(O===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(O),(y=(h=z(this,zn).config).onSuccess)==null||y.call(h,O,this),(C=(E=z(this,zn).config).onSettled)==null||C.call(E,O,this.state.error,this),O}catch(O){if(O instanceof _d){if(O.silent)return z(this,Dt).promise;if(O.revert){if(this.state.data===void 0)throw O;return this.state.data}}throw Oe(this,sr,aa).call(this,{type:"error",error:O}),(P=(I=z(this,zn).config).onError)==null||P.call(I,O,this),(U=(v=z(this,zn).config).onSettled)==null||U.call(v,this.state.data,O,this),O}finally{this.scheduleGc()}}},Ss=new WeakMap,Uo=new WeakMap,zn=new WeakMap,Ps=new WeakMap,Dt=new WeakMap,Fc=new WeakMap,Is=new WeakMap,sr=new WeakSet,aa=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,...s1(r.data,this.options),fetchMeta:t.meta??null};case"success":const a={...r,...o1(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return ne(this,Uo,t.manual?a:void 0),a;case"error":const s=t.error;return{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Ct.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),z(this,zn).notify({query:this,type:"updated",action:t})})},M5);function s1(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:n1(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function o1(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function i1(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 X3=(N5=class extends Ns{constructor(t,n){super();me(this,qe);me(this,un);me(this,Ne);me(this,Uc);me(this,Xt);me(this,Bs);me(this,Do);me(this,Jr);me(this,Oa);me(this,Dc);me(this,_o);me(this,Mo);me(this,Os);me(this,Fs);me(this,Fa);me(this,No,new Set);this.options=n,ne(this,un,t),ne(this,Oa,null),ne(this,Jr,Dd()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(z(this,Ne).addObserver(this),c1(z(this,Ne),this.options)?Oe(this,qe,Nc).call(this):this.updateResult(),Oe(this,qe,Gm).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Md(z(this,Ne),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Md(z(this,Ne),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Oe(this,qe,jm).call(this),Oe(this,qe,Vm).call(this),z(this,Ne).removeObserver(this)}setOptions(t){const n=this.options,r=z(this,Ne);if(this.options=z(this,un).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Pn(this.options.enabled,z(this,Ne))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Oe(this,qe,Wm).call(this),z(this,Ne).setOptions(this.options),n._defaulted&&!jc(this.options,n)&&z(this,un).getQueryCache().notify({type:"observerOptionsUpdated",query:z(this,Ne),observer:this});const a=this.hasListeners();a&&l1(z(this,Ne),r,this.options,n)&&Oe(this,qe,Nc).call(this),this.updateResult(),a&&(z(this,Ne)!==r||Pn(this.options.enabled,z(this,Ne))!==Pn(n.enabled,z(this,Ne))||ia(this.options.staleTime,z(this,Ne))!==ia(n.staleTime,z(this,Ne)))&&Oe(this,qe,Rm).call(this);const s=Oe(this,qe,$m).call(this);a&&(z(this,Ne)!==r||Pn(this.options.enabled,z(this,Ne))!==Pn(n.enabled,z(this,Ne))||s!==z(this,Fa))&&Oe(this,qe,Hm).call(this,s)}getOptimisticResult(t){const n=z(this,un).getQueryCache().build(z(this,un),t),r=this.createResult(n,t);return J3(this,r)&&(ne(this,Xt,r),ne(this,Do,this.options),ne(this,Bs,z(this,Ne).state)),r}getCurrentResult(){return z(this,Xt)}trackResult(t,n){return new Proxy(t,{get:(r,a)=>(this.trackProp(a),n==null||n(a),a==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&z(this,Jr).status==="pending"&&z(this,Jr).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,a))})}trackProp(t){z(this,No).add(t)}getCurrentQuery(){return z(this,Ne)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=z(this,un).defaultQueryOptions(t),r=z(this,un).getQueryCache().build(z(this,un),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return Oe(this,qe,Nc).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),z(this,Xt)))}createResult(t,n){var f;const r=z(this,Ne),a=this.options,s=z(this,Xt),o=z(this,Bs),i=z(this,Do),l=t!==r?t.state:z(this,Uc),{state:d}=t;let p={...d},h=!1,y;if(n._optimisticResults){const b=this.hasListeners(),k=!b&&c1(t,n),x=b&&l1(t,r,n,a);(k||x)&&(p={...p,...s1(d.data,t.options)}),n._optimisticResults==="isRestoring"&&(p.fetchStatus="idle")}let{error:E,errorUpdatedAt:C,status:I}=p;y=p.data;let P=!1;if(n.placeholderData!==void 0&&y===void 0&&I==="pending"){let b;s!=null&&s.isPlaceholderData&&n.placeholderData===(i==null?void 0:i.placeholderData)?(b=s.data,P=!0):b=typeof n.placeholderData=="function"?n.placeholderData((f=z(this,Mo))==null?void 0:f.state.data,z(this,Mo)):n.placeholderData,b!==void 0&&(I="success",y=Fd(s==null?void 0:s.data,b,n),h=!0)}if(n.select&&y!==void 0&&!P)if(s&&y===(o==null?void 0:o.data)&&n.select===z(this,Dc))y=z(this,_o);else try{ne(this,Dc,n.select),y=n.select(y),y=Fd(s==null?void 0:s.data,y,n),ne(this,_o,y),ne(this,Oa,null)}catch(b){ne(this,Oa,b)}z(this,Oa)&&(E=z(this,Oa),y=z(this,_o),C=Date.now(),I="error");const v=p.fetchStatus==="fetching",U=I==="pending",O=I==="error",M=U&&v,L=y!==void 0,u={status:I,fetchStatus:p.fetchStatus,isPending:U,isSuccess:I==="success",isError:O,isInitialLoading:M,isLoading:M,data:y,dataUpdatedAt:p.dataUpdatedAt,error:E,errorUpdatedAt:C,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:v,isRefetching:v&&!U,isLoadingError:O&&!L,isPaused:p.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:O&&L,isStale:Nd(t,n),refetch:this.refetch,promise:z(this,Jr),isEnabled:Pn(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const b=T=>{u.status==="error"?T.reject(u.error):u.data!==void 0&&T.resolve(u.data)},k=()=>{const T=ne(this,Jr,u.promise=Dd());b(T)},x=z(this,Jr);switch(x.status){case"pending":t.queryHash===r.queryHash&&b(x);break;case"fulfilled":(u.status==="error"||u.data!==x.value)&&k();break;case"rejected":(u.status!=="error"||u.error!==x.reason)&&k();break}}return u}updateResult(){const t=z(this,Xt),n=this.createResult(z(this,Ne),this.options);if(ne(this,Bs,z(this,Ne).state),ne(this,Do,this.options),z(this,Bs).data!==void 0&&ne(this,Mo,z(this,Ne)),jc(n,t))return;ne(this,Xt,n);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:a}=this.options,s=typeof a=="function"?a():a;if(s==="all"||!s&&!z(this,No).size)return!0;const o=new Set(s??z(this,No));return this.options.throwOnError&&o.add("error"),Object.keys(z(this,Xt)).some(i=>{const c=i;return z(this,Xt)[c]!==t[c]&&o.has(c)})};Oe(this,qe,Z5).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Oe(this,qe,Gm).call(this)}},un=new WeakMap,Ne=new WeakMap,Uc=new WeakMap,Xt=new WeakMap,Bs=new WeakMap,Do=new WeakMap,Jr=new WeakMap,Oa=new WeakMap,Dc=new WeakMap,_o=new WeakMap,Mo=new WeakMap,Os=new WeakMap,Fs=new WeakMap,Fa=new WeakMap,No=new WeakMap,qe=new WeakSet,Nc=function(t){Oe(this,qe,Wm).call(this);let n=z(this,Ne).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Yt)),n},Rm=function(){Oe(this,qe,jm).call(this);const t=ia(this.options.staleTime,z(this,Ne));if(Ga||z(this,Xt).isStale||!Pd(t))return;const r=Kh(z(this,Xt).dataUpdatedAt,t)+1;ne(this,Os,Ha.setTimeout(()=>{z(this,Xt).isStale||this.updateResult()},r))},$m=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(z(this,Ne)):this.options.refetchInterval)??!1},Hm=function(t){Oe(this,qe,Vm).call(this),ne(this,Fa,t),!(Ga||Pn(this.options.enabled,z(this,Ne))===!1||!Pd(z(this,Fa))||z(this,Fa)===0)&&ne(this,Fs,Ha.setInterval(()=>{(this.options.refetchIntervalInBackground||Ud.isFocused())&&Oe(this,qe,Nc).call(this)},z(this,Fa)))},Gm=function(){Oe(this,qe,Rm).call(this),Oe(this,qe,Hm).call(this,Oe(this,qe,$m).call(this))},jm=function(){z(this,Os)&&(Ha.clearTimeout(z(this,Os)),ne(this,Os,void 0))},Vm=function(){z(this,Fs)&&(Ha.clearInterval(z(this,Fs)),ne(this,Fs,void 0))},Wm=function(){const t=z(this,un).getQueryCache().build(z(this,un),this.options);if(t===z(this,Ne))return;const n=z(this,Ne);ne(this,Ne,t),ne(this,Uc,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Z5=function(t){Ct.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(z(this,Xt))}),z(this,un).getQueryCache().notify({query:z(this,Ne),type:"observerResultsUpdated"})})},N5);function Q3(e,t){return Pn(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function c1(e,t){return Q3(e,t)||e.state.data!==void 0&&Md(e,t,t.refetchOnMount)}function Md(e,t,n){if(Pn(t.enabled,e)!==!1&&ia(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Nd(e,t)}return!1}function l1(e,t,n,r){return(e!==t||Pn(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Nd(e,n)}function Nd(e,t){return Pn(t.enabled,e)!==!1&&e.isStaleByTime(ia(t.staleTime,e))}function J3(e,t){return!jc(e.getCurrentResult(),t)}function u1(e){return{onFetch:(t,n)=>{var d,p,h,y,E;const r=t.options,a=(h=(p=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:p.fetchMore)==null?void 0:h.direction,s=((y=t.state.data)==null?void 0:y.pages)||[],o=((E=t.state.data)==null?void 0:E.pageParams)||[];let i={pages:[],pageParams:[]},c=0;const l=async()=>{let C=!1;const I=U=>{Object.defineProperty(U,"signal",{enumerable:!0,get:()=>(t.signal.aborted?C=!0:t.signal.addEventListener("abort",()=>{C=!0}),t.signal)})},P=e1(t.options,t.fetchOptions),v=async(U,O,M)=>{if(C)return Promise.reject();if(O==null&&U.pages.length)return Promise.resolve(U);const F=(()=>{const k={client:t.client,queryKey:t.queryKey,pageParam:O,direction:M?"backward":"forward",meta:t.options.meta};return I(k),k})(),u=await P(F),{maxPages:f}=t.options,b=M?j3:G3;return{pages:b(U.pages,u,f),pageParams:b(U.pageParams,O,f)}};if(a&&s.length){const U=a==="backward",O=U?e8:d1,M={pages:s,pageParams:o},L=O(r,M);i=await v(M,L,U)}else{const U=e??s.length;do{const O=c===0?o[0]??r.initialPageParam:d1(r,i);if(c>0&&O==null)break;i=await v(i,O),c++}while(c<U)}return i};t.options.persister?t.fetchFn=()=>{var C,I;return(I=(C=t.options).persister)==null?void 0:I.call(C,l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=l}}}function d1(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 e8(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 t8=(L5=class extends a1{constructor(t){super();me(this,Tr);me(this,_c);me(this,Er);me(this,Qt);me(this,Us);ne(this,_c,t.client),this.mutationId=t.mutationId,ne(this,Qt,t.mutationCache),ne(this,Er,[]),this.state=t.state||p1(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){z(this,Er).includes(t)||(z(this,Er).push(t),this.clearGcTimeout(),z(this,Qt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){ne(this,Er,z(this,Er).filter(n=>n!==t)),this.scheduleGc(),z(this,Qt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){z(this,Er).length||(this.state.status==="pending"?this.scheduleGc():z(this,Qt).remove(this))}continue(){var t;return((t=z(this,Us))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,i,c,l,d,p,h,y,E,C,I,P,v,U,O,M,L,F,u,f;const n=()=>{Oe(this,Tr,Na).call(this,{type:"continue"})},r={client:z(this,_c),meta:this.options.meta,mutationKey:this.options.mutationKey};ne(this,Us,r1({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(b,k)=>{Oe(this,Tr,Na).call(this,{type:"failed",failureCount:b,error:k})},onPause:()=>{Oe(this,Tr,Na).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>z(this,Qt).canRun(this)}));const a=this.state.status==="pending",s=!z(this,Us).canStart();try{if(a)n();else{Oe(this,Tr,Na).call(this,{type:"pending",variables:t,isPaused:s}),await((i=(o=z(this,Qt).config).onMutate)==null?void 0:i.call(o,t,this,r));const k=await((l=(c=this.options).onMutate)==null?void 0:l.call(c,t,r));k!==this.state.context&&Oe(this,Tr,Na).call(this,{type:"pending",context:k,variables:t,isPaused:s})}const b=await z(this,Us).start();return await((p=(d=z(this,Qt).config).onSuccess)==null?void 0:p.call(d,b,t,this.state.context,this,r)),await((y=(h=this.options).onSuccess)==null?void 0:y.call(h,b,t,this.state.context,r)),await((C=(E=z(this,Qt).config).onSettled)==null?void 0:C.call(E,b,null,this.state.variables,this.state.context,this,r)),await((P=(I=this.options).onSettled)==null?void 0:P.call(I,b,null,t,this.state.context,r)),Oe(this,Tr,Na).call(this,{type:"success",data:b}),b}catch(b){try{throw await((U=(v=z(this,Qt).config).onError)==null?void 0:U.call(v,b,t,this.state.context,this,r)),await((M=(O=this.options).onError)==null?void 0:M.call(O,b,t,this.state.context,r)),await((F=(L=z(this,Qt).config).onSettled)==null?void 0:F.call(L,void 0,b,this.state.variables,this.state.context,this,r)),await((f=(u=this.options).onSettled)==null?void 0:f.call(u,void 0,b,t,this.state.context,r)),b}finally{Oe(this,Tr,Na).call(this,{type:"error",error:b})}}finally{z(this,Qt).runNext(this)}}},_c=new WeakMap,Er=new WeakMap,Qt=new WeakMap,Us=new WeakMap,Tr=new WeakSet,Na=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),Ct.batch(()=>{z(this,Er).forEach(r=>{r.onMutationUpdate(t)}),z(this,Qt).notify({mutation:this,type:"updated",action:t})})},L5);function p1(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var n8=(z5=class extends Ns{constructor(t={}){super();me(this,ea);me(this,or);me(this,Mc);this.config=t,ne(this,ea,new Set),ne(this,or,new Map),ne(this,Mc,0)}build(t,n,r){const a=new t8({client:t,mutationCache:this,mutationId:++cd(this,Mc)._,options:t.defaultMutationOptions(n),state:r});return this.add(a),a}add(t){z(this,ea).add(t);const n=qc(t);if(typeof n=="string"){const r=z(this,or).get(n);r?r.push(t):z(this,or).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(z(this,ea).delete(t)){const n=qc(t);if(typeof n=="string"){const r=z(this,or).get(n);if(r)if(r.length>1){const a=r.indexOf(t);a!==-1&&r.splice(a,1)}else r[0]===t&&z(this,or).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=qc(t);if(typeof n=="string"){const r=z(this,or).get(n),a=r==null?void 0:r.find(s=>s.state.status==="pending");return!a||a===t}else return!0}runNext(t){var r;const n=qc(t);if(typeof n=="string"){const a=(r=z(this,or).get(n))==null?void 0:r.find(s=>s!==t&&s.state.isPaused);return(a==null?void 0:a.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Ct.batch(()=>{z(this,ea).forEach(t=>{this.notify({type:"removed",mutation:t})}),z(this,ea).clear(),z(this,or).clear()})}getAll(){return Array.from(z(this,ea))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Xh(n,r))}findAll(t={}){return this.getAll().filter(n=>Xh(t,n))}notify(t){Ct.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Ct.batch(()=>Promise.all(t.map(n=>n.continue().catch(Yt))))}},ea=new WeakMap,or=new WeakMap,Mc=new WeakMap,z5);function qc(e){var t;return(t=e.options.scope)==null?void 0:t.id}var r8=(R5=class extends Ns{constructor(t,n){super();me(this,ra);me(this,ta);me(this,Ua);me(this,dn);me(this,na);ne(this,ta,t),this.setOptions(n),this.bindMethods(),Oe(this,ra,ld).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=z(this,ta).defaultMutationOptions(t),jc(this.options,n)||z(this,ta).getMutationCache().notify({type:"observerOptionsUpdated",mutation:z(this,dn),observer:this}),n!=null&&n.mutationKey&&this.options.mutationKey&&ja(n.mutationKey)!==ja(this.options.mutationKey)?this.reset():((r=z(this,dn))==null?void 0:r.state.status)==="pending"&&z(this,dn).setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=z(this,dn))==null||t.removeObserver(this)}onMutationUpdate(t){Oe(this,ra,ld).call(this),Oe(this,ra,qm).call(this,t)}getCurrentResult(){return z(this,Ua)}reset(){var t;(t=z(this,dn))==null||t.removeObserver(this),ne(this,dn,void 0),Oe(this,ra,ld).call(this),Oe(this,ra,qm).call(this)}mutate(t,n){var r;return ne(this,na,n),(r=z(this,dn))==null||r.removeObserver(this),ne(this,dn,z(this,ta).getMutationCache().build(z(this,ta),this.options)),z(this,dn).addObserver(this),z(this,dn).execute(t)}},ta=new WeakMap,Ua=new WeakMap,dn=new WeakMap,na=new WeakMap,ra=new WeakSet,ld=function(){var n;const t=((n=z(this,dn))==null?void 0:n.state)??p1();ne(this,Ua,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},qm=function(t){Ct.batch(()=>{var n,r,a,s,o,i,c,l;if(z(this,na)&&this.hasListeners()){const d=z(this,Ua).variables,p=z(this,Ua).context,h={client:z(this,ta),meta:this.options.meta,mutationKey:this.options.mutationKey};(t==null?void 0:t.type)==="success"?((r=(n=z(this,na)).onSuccess)==null||r.call(n,t.data,d,p,h),(s=(a=z(this,na)).onSettled)==null||s.call(a,t.data,null,d,p,h)):(t==null?void 0:t.type)==="error"&&((i=(o=z(this,na)).onError)==null||i.call(o,t.error,d,p,h),(l=(c=z(this,na)).onSettled)==null||l.call(c,void 0,t.error,d,p,h))}this.listeners.forEach(d=>{d(z(this,Ua))})})},R5),a8=($5=class extends Ns{constructor(t={}){super();me(this,Cr);this.config=t,ne(this,Cr,new Map)}build(t,n,r){const a=n.queryKey,s=n.queryHash??Id(a,n);let o=this.get(s);return o||(o=new Z3({client:t,queryKey:a,queryHash:s,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(a)}),this.add(o)),o}add(t){z(this,Cr).has(t.queryHash)||(z(this,Cr).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=z(this,Cr).get(t.queryHash);n&&(t.destroy(),n===t&&z(this,Cr).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Ct.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return z(this,Cr).get(t)}getAll(){return[...z(this,Cr).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Zh(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Zh(t,r)):n}notify(t){Ct.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Ct.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Ct.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Cr=new WeakMap,$5),s8=(H5=class{constructor(e={}){me(this,bt);me(this,Da);me(this,_a);me(this,Lo);me(this,zo);me(this,Ma);me(this,Ro);me(this,$o);ne(this,bt,e.queryCache||new a8),ne(this,Da,e.mutationCache||new n8),ne(this,_a,e.defaultOptions||{}),ne(this,Lo,new Map),ne(this,zo,new Map),ne(this,Ma,0)}mount(){cd(this,Ma)._++,z(this,Ma)===1&&(ne(this,Ro,Ud.subscribe(async e=>{e&&(await this.resumePausedMutations(),z(this,bt).onFocus())})),ne(this,$o,Wc.subscribe(async e=>{e&&(await this.resumePausedMutations(),z(this,bt).onOnline())})))}unmount(){var e,t;cd(this,Ma)._--,z(this,Ma)===0&&((e=z(this,Ro))==null||e.call(this),ne(this,Ro,void 0),(t=z(this,$o))==null||t.call(this),ne(this,$o,void 0))}isFetching(e){return z(this,bt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return z(this,Da).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=z(this,bt).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=z(this,bt).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(ia(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return z(this,bt).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),a=z(this,bt).get(r.queryHash),s=a==null?void 0:a.state.data,o=R3(t,s);if(o!==void 0)return z(this,bt).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return Ct.batch(()=>z(this,bt).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=z(this,bt).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=z(this,bt);Ct.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=z(this,bt);return Ct.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=Ct.batch(()=>z(this,bt).findAll(e).map(a=>a.cancel(n)));return Promise.all(r).then(Yt).catch(Yt)}invalidateQueries(e,t={}){return Ct.batch(()=>(z(this,bt).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=Ct.batch(()=>z(this,bt).findAll(e).filter(a=>!a.isDisabled()&&!a.isStatic()).map(a=>{let s=a.fetch(void 0,n);return n.throwOnError||(s=s.catch(Yt)),a.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(Yt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=z(this,bt).build(this,t);return n.isStaleByTime(ia(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Yt).catch(Yt)}fetchInfiniteQuery(e){return e.behavior=u1(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Yt).catch(Yt)}ensureInfiniteQueryData(e){return e.behavior=u1(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Wc.isOnline()?z(this,Da).resumePausedMutations():Promise.resolve()}getQueryCache(){return z(this,bt)}getMutationCache(){return z(this,Da)}getDefaultOptions(){return z(this,_a)}setDefaultOptions(e){ne(this,_a,e)}setQueryDefaults(e,t){z(this,Lo).set(ja(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...z(this,Lo).values()],n={};return t.forEach(r=>{jo(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){z(this,zo).set(ja(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...z(this,zo).values()],n={};return t.forEach(r=>{jo(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...z(this,_a).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Id(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===Vc&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...z(this,_a).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){z(this,bt).clear(),z(this,Da).clear()}},bt=new WeakMap,Da=new WeakMap,_a=new WeakMap,Lo=new WeakMap,zo=new WeakMap,Ma=new WeakMap,Ro=new WeakMap,$o=new WeakMap,H5),f1=vt.createContext(void 0),Vo=e=>{const t=vt.useContext(f1);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},o8=({client:e,children:t})=>(vt.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),_.jsx(f1.Provider,{value:e,children:t})),m1=vt.createContext(!1),i8=()=>vt.useContext(m1);m1.Provider;function c8(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var l8=vt.createContext(c8()),u8=()=>vt.useContext(l8),d8=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},p8=e=>{vt.useEffect(()=>{e.clearReset()},[e])},f8=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:a})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(a&&e.data===void 0||t1(n,[e.error,r])),m8=e=>{if(e.suspense){const n=a=>a==="static"?a:Math.max(a??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...a)=>n(r(...a)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},h8=(e,t)=>e.isLoading&&e.isFetching&&!t,b8=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,h1=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function y8(e,t,n){var p,h,y,E,C;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=i8(),a=u8(),s=Vo(),o=s.defaultQueryOptions(e);(h=(p=s.getDefaultOptions().queries)==null?void 0:p._experimental_beforeQuery)==null||h.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",m8(o),d8(o,a),p8(a);const i=!s.getQueryCache().get(o.queryHash),[c]=vt.useState(()=>new t(s,o)),l=c.getOptimisticResult(o),d=!r&&e.subscribed!==!1;if(vt.useSyncExternalStore(vt.useCallback(I=>{const P=d?c.subscribe(Ct.batchCalls(I)):Yt;return c.updateResult(),P},[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),vt.useEffect(()=>{c.setOptions(o)},[o,c]),b8(o,l))throw h1(o,c,a);if(f8({result:l,errorResetBoundary:a,throwOnError:o.throwOnError,query:s.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw l.error;if((E=(y=s.getDefaultOptions().queries)==null?void 0:y._experimental_afterQuery)==null||E.call(y,o,l),o.experimental_prefetchInRender&&!Ga&&h8(l,r)){const I=i?h1(o,c,a):(C=s.getQueryCache().get(o.queryHash))==null?void 0:C.promise;I==null||I.catch(Yt).finally(()=>{c.updateResult()})}return o.notifyOnChangeProps?l:c.trackResult(l)}function g8(e,t){return y8(e,X3)}function Pr(e,t){const n=Vo(),[r]=vt.useState(()=>new r8(n,e));vt.useEffect(()=>{r.setOptions(e)},[r,e]);const a=vt.useSyncExternalStore(vt.useCallback(o=>r.subscribe(Ct.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),s=vt.useCallback((o,i)=>{r.mutate(o,i).catch(Yt)},[r]);if(a.error&&t1(r.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:s,mutateAsync:a.mutate}}const x8=N.createContext(null),Ld={didCatch:!1,error:null};class w8 extends N.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Ld}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){const{error:t}=this.state;if(t!==null){for(var n,r,a=arguments.length,s=new Array(a),o=0;o<a;o++)s[o]=arguments[o];(n=(r=this.props).onReset)===null||n===void 0||n.call(r,{args:s,reason:"imperative-api"}),this.setState(Ld)}}componentDidCatch(t,n){var r,a;(r=(a=this.props).onError)===null||r===void 0||r.call(a,t,n)}componentDidUpdate(t,n){const{didCatch:r}=this.state,{resetKeys:a}=this.props;if(r&&n.error!==null&&v8(t.resetKeys,a)){var s,o;(s=(o=this.props).onReset)===null||s===void 0||s.call(o,{next:a,prev:t.resetKeys,reason:"keys"}),this.setState(Ld)}}render(){const{children:t,fallbackRender:n,FallbackComponent:r,fallback:a}=this.props,{didCatch:s,error:o}=this.state;let i=t;if(s){const c={error:o,resetErrorBoundary:this.resetErrorBoundary};if(typeof n=="function")i=n(c);else if(r)i=N.createElement(r,c);else if(a!==void 0)i=a;else throw o}return N.createElement(x8.Provider,{value:{didCatch:s,error:o,resetErrorBoundary:this.resetErrorBoundary}},i)}}function v8(){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]))}var k8=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,zd=Math.ceil,In=Math.floor,en="[BigNumber Error] ",b1=en+"Number primitive has more than 15 significant digits: ",Hn=1e14,Te=14,Rd=9007199254740991,$d=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],ca=1e7,Ot=1e9;function y1(e){var t,n,r,a=v.prototype={constructor:v,toString:null,valueOf:null},s=new v(1),o=20,i=4,c=-7,l=21,d=-1e7,p=1e7,h=!1,y=1,E=0,C={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},I="0123456789abcdefghijklmnopqrstuvwxyz",P=!0;function v(u,f){var b,k,x,T,B,g,w,S,A=this;if(!(A instanceof v))return new v(u,f);if(f==null){if(u&&u._isBigNumber===!0){A.s=u.s,!u.c||u.e>p?A.c=A.e=null:u.e<d?A.c=[A.e=0]:(A.e=u.e,A.c=u.c.slice());return}if((g=typeof u=="number")&&u*0==0){if(A.s=1/u<0?(u=-u,-1):1,u===~~u){for(T=0,B=u;B>=10;B/=10,T++);T>p?A.c=A.e=null:(A.e=T,A.c=[u]);return}S=String(u)}else{if(!k8.test(S=String(u)))return r(A,S,g);A.s=S.charCodeAt(0)==45?(S=S.slice(1),-1):1}(T=S.indexOf("."))>-1&&(S=S.replace(".","")),(B=S.search(/e/i))>0?(T<0&&(T=B),T+=+S.slice(B+1),S=S.substring(0,B)):T<0&&(T=S.length)}else{if(dt(f,2,I.length,"Base"),f==10&&P)return A=new v(u),L(A,o+A.e+1,i);if(S=String(u),g=typeof u=="number"){if(u*0!=0)return r(A,S,g,f);if(A.s=1/u<0?(S=S.slice(1),-1):1,v.DEBUG&&S.replace(/^0\.0*|\./,"").length>15)throw Error(b1+u)}else A.s=S.charCodeAt(0)===45?(S=S.slice(1),-1):1;for(b=I.slice(0,f),T=B=0,w=S.length;B<w;B++)if(b.indexOf(k=S.charAt(B))<0){if(k=="."){if(B>T){T=w;continue}}else if(!x&&(S==S.toUpperCase()&&(S=S.toLowerCase())||S==S.toLowerCase()&&(S=S.toUpperCase()))){x=!0,B=-1,T=0;continue}return r(A,String(u),g,f)}g=!1,S=n(S,f,10,A.s),(T=S.indexOf("."))>-1?S=S.replace(".",""):T=S.length}for(B=0;S.charCodeAt(B)===48;B++);for(w=S.length;S.charCodeAt(--w)===48;);if(S=S.slice(B,++w)){if(w-=B,g&&v.DEBUG&&w>15&&(u>Rd||u!==In(u)))throw Error(b1+A.s*u);if((T=T-B-1)>p)A.c=A.e=null;else if(T<d)A.c=[A.e=0];else{if(A.e=T,A.c=[],B=(T+1)%Te,T<0&&(B+=Te),B<w){for(B&&A.c.push(+S.slice(0,B)),w-=Te;B<w;)A.c.push(+S.slice(B,B+=Te));B=Te-(S=S.slice(B)).length}else B-=w;for(;B--;S+="0");A.c.push(+S)}}else A.c=[A.e=0]}v.clone=y1,v.ROUND_UP=0,v.ROUND_DOWN=1,v.ROUND_CEIL=2,v.ROUND_FLOOR=3,v.ROUND_HALF_UP=4,v.ROUND_HALF_DOWN=5,v.ROUND_HALF_EVEN=6,v.ROUND_HALF_CEIL=7,v.ROUND_HALF_FLOOR=8,v.EUCLID=9,v.config=v.set=function(u){var f,b;if(u!=null)if(typeof u=="object"){if(u.hasOwnProperty(f="DECIMAL_PLACES")&&(b=u[f],dt(b,0,Ot,f),o=b),u.hasOwnProperty(f="ROUNDING_MODE")&&(b=u[f],dt(b,0,8,f),i=b),u.hasOwnProperty(f="EXPONENTIAL_AT")&&(b=u[f],b&&b.pop?(dt(b[0],-Ot,0,f),dt(b[1],0,Ot,f),c=b[0],l=b[1]):(dt(b,-Ot,Ot,f),c=-(l=b<0?-b:b))),u.hasOwnProperty(f="RANGE"))if(b=u[f],b&&b.pop)dt(b[0],-Ot,-1,f),dt(b[1],1,Ot,f),d=b[0],p=b[1];else if(dt(b,-Ot,Ot,f),b)d=-(p=b<0?-b:b);else throw Error(en+f+" cannot be zero: "+b);if(u.hasOwnProperty(f="CRYPTO"))if(b=u[f],b===!!b)if(b)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))h=b;else throw h=!b,Error(en+"crypto unavailable");else h=b;else throw Error(en+f+" not true or false: "+b);if(u.hasOwnProperty(f="MODULO_MODE")&&(b=u[f],dt(b,0,9,f),y=b),u.hasOwnProperty(f="POW_PRECISION")&&(b=u[f],dt(b,0,Ot,f),E=b),u.hasOwnProperty(f="FORMAT"))if(b=u[f],typeof b=="object")C=b;else throw Error(en+f+" not an object: "+b);if(u.hasOwnProperty(f="ALPHABET"))if(b=u[f],typeof b=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(b))P=b.slice(0,10)=="0123456789",I=b;else throw Error(en+f+" invalid: "+b)}else throw Error(en+"Object expected: "+u);return{DECIMAL_PLACES:o,ROUNDING_MODE:i,EXPONENTIAL_AT:[c,l],RANGE:[d,p],CRYPTO:h,MODULO_MODE:y,POW_PRECISION:E,FORMAT:C,ALPHABET:I}},v.isBigNumber=function(u){if(!u||u._isBigNumber!==!0)return!1;if(!v.DEBUG)return!0;var f,b,k=u.c,x=u.e,T=u.s;e:if({}.toString.call(k)=="[object Array]"){if((T===1||T===-1)&&x>=-Ot&&x<=Ot&&x===In(x)){if(k[0]===0){if(x===0&&k.length===1)return!0;break e}if(f=(x+1)%Te,f<1&&(f+=Te),String(k[0]).length==f){for(f=0;f<k.length;f++)if(b=k[f],b<0||b>=Hn||b!==In(b))break e;if(b!==0)return!0}}}else if(k===null&&x===null&&(T===null||T===1||T===-1))return!0;throw Error(en+"Invalid BigNumber: "+u)},v.maximum=v.max=function(){return O(arguments,-1)},v.minimum=v.min=function(){return O(arguments,1)},v.random=(function(){var u=9007199254740992,f=Math.random()*u&2097151?function(){return In(Math.random()*u)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(b){var k,x,T,B,g,w=0,S=[],A=new v(s);if(b==null?b=o:dt(b,0,Ot),B=zd(b/Te),h)if(crypto.getRandomValues){for(k=crypto.getRandomValues(new Uint32Array(B*=2));w<B;)g=k[w]*131072+(k[w+1]>>>11),g>=9e15?(x=crypto.getRandomValues(new Uint32Array(2)),k[w]=x[0],k[w+1]=x[1]):(S.push(g%1e14),w+=2);w=B/2}else if(crypto.randomBytes){for(k=crypto.randomBytes(B*=7);w<B;)g=(k[w]&31)*281474976710656+k[w+1]*1099511627776+k[w+2]*4294967296+k[w+3]*16777216+(k[w+4]<<16)+(k[w+5]<<8)+k[w+6],g>=9e15?crypto.randomBytes(7).copy(k,w):(S.push(g%1e14),w+=7);w=B/7}else throw h=!1,Error(en+"crypto unavailable");if(!h)for(;w<B;)g=f(),g<9e15&&(S[w++]=g%1e14);for(B=S[--w],b%=Te,B&&b&&(g=$d[Te-b],S[w]=In(B/g)*g);S[w]===0;S.pop(),w--);if(w<0)S=[T=0];else{for(T=-1;S[0]===0;S.splice(0,1),T-=Te);for(w=1,g=S[0];g>=10;g/=10,w++);w<Te&&(T-=Te-w)}return A.e=T,A.c=S,A}})(),v.sum=function(){for(var u=1,f=arguments,b=new v(f[0]);u<f.length;)b=b.plus(f[u++]);return b},n=(function(){var u="0123456789";function f(b,k,x,T){for(var B,g=[0],w,S=0,A=b.length;S<A;){for(w=g.length;w--;g[w]*=k);for(g[0]+=T.indexOf(b.charAt(S++)),B=0;B<g.length;B++)g[B]>x-1&&(g[B+1]==null&&(g[B+1]=0),g[B+1]+=g[B]/x|0,g[B]%=x)}return g.reverse()}return function(b,k,x,T,B){var g,w,S,A,D,R,$,j,te=b.indexOf("."),ce=o,Y=i;for(te>=0&&(A=E,E=0,b=b.replace(".",""),j=new v(k),R=j.pow(b.length-te),E=A,j.c=f(Ir(On(R.c),R.e,"0"),10,x,u),j.e=j.c.length),$=f(b,k,x,B?(g=I,u):(g=u,I)),S=A=$.length;$[--A]==0;$.pop());if(!$[0])return g.charAt(0);if(te<0?--S:(R.c=$,R.e=S,R.s=T,R=t(R,j,ce,Y,x),$=R.c,D=R.r,S=R.e),w=S+ce+1,te=$[w],A=x/2,D=D||w<0||$[w+1]!=null,D=Y<4?(te!=null||D)&&(Y==0||Y==(R.s<0?3:2)):te>A||te==A&&(Y==4||D||Y==6&&$[w-1]&1||Y==(R.s<0?8:7)),w<1||!$[0])b=D?Ir(g.charAt(1),-ce,g.charAt(0)):g.charAt(0);else{if($.length=w,D)for(--x;++$[--w]>x;)$[w]=0,w||(++S,$=[1].concat($));for(A=$.length;!$[--A];);for(te=0,b="";te<=A;b+=g.charAt($[te++]));b=Ir(b,S,g.charAt(0))}return b}})(),t=(function(){function u(k,x,T){var B,g,w,S,A=0,D=k.length,R=x%ca,$=x/ca|0;for(k=k.slice();D--;)w=k[D]%ca,S=k[D]/ca|0,B=$*w+S*R,g=R*w+B%ca*ca+A,A=(g/T|0)+(B/ca|0)+$*S,k[D]=g%T;return A&&(k=[A].concat(k)),k}function f(k,x,T,B){var g,w;if(T!=B)w=T>B?1:-1;else for(g=w=0;g<T;g++)if(k[g]!=x[g]){w=k[g]>x[g]?1:-1;break}return w}function b(k,x,T,B){for(var g=0;T--;)k[T]-=g,g=k[T]<x[T]?1:0,k[T]=g*B+k[T]-x[T];for(;!k[0]&&k.length>1;k.splice(0,1));}return function(k,x,T,B,g){var w,S,A,D,R,$,j,te,ce,Y,J,ye,X,ve,Fe,Ae,Ye,ge=k.s==x.s?1:-1,fe=k.c,ae=x.c;if(!fe||!fe[0]||!ae||!ae[0])return new v(!k.s||!x.s||(fe?ae&&fe[0]==ae[0]:!ae)?NaN:fe&&fe[0]==0||!ae?ge*0:ge/0);for(te=new v(ge),ce=te.c=[],S=k.e-x.e,ge=T+S+1,g||(g=Hn,S=Bn(k.e/Te)-Bn(x.e/Te),ge=ge/Te|0),A=0;ae[A]==(fe[A]||0);A++);if(ae[A]>(fe[A]||0)&&S--,ge<0)ce.push(1),D=!0;else{for(ve=fe.length,Ae=ae.length,A=0,ge+=2,R=In(g/(ae[0]+1)),R>1&&(ae=u(ae,R,g),fe=u(fe,R,g),Ae=ae.length,ve=fe.length),X=Ae,Y=fe.slice(0,Ae),J=Y.length;J<Ae;Y[J++]=0);Ye=ae.slice(),Ye=[0].concat(Ye),Fe=ae[0],ae[1]>=g/2&&Fe++;do{if(R=0,w=f(ae,Y,Ae,J),w<0){if(ye=Y[0],Ae!=J&&(ye=ye*g+(Y[1]||0)),R=In(ye/Fe),R>1)for(R>=g&&(R=g-1),$=u(ae,R,g),j=$.length,J=Y.length;f($,Y,j,J)==1;)R--,b($,Ae<j?Ye:ae,j,g),j=$.length,w=1;else R==0&&(w=R=1),$=ae.slice(),j=$.length;if(j<J&&($=[0].concat($)),b(Y,$,J,g),J=Y.length,w==-1)for(;f(ae,Y,Ae,J)<1;)R++,b(Y,Ae<J?Ye:ae,J,g),J=Y.length}else w===0&&(R++,Y=[0]);ce[A++]=R,Y[0]?Y[J++]=fe[X]||0:(Y=[fe[X]],J=1)}while((X++<ve||Y[0]!=null)&&ge--);D=Y[0]!=null,ce[0]||ce.splice(0,1)}if(g==Hn){for(A=1,ge=ce[0];ge>=10;ge/=10,A++);L(te,T+(te.e=A+S*Te-1)+1,B,D)}else te.e=S,te.r=+D;return te}})();function U(u,f,b,k){var x,T,B,g,w;if(b==null?b=i:dt(b,0,8),!u.c)return u.toString();if(x=u.c[0],B=u.e,f==null)w=On(u.c),w=k==1||k==2&&(B<=c||B>=l)?Kc(w,B):Ir(w,B,"0");else if(u=L(new v(u),f,b),T=u.e,w=On(u.c),g=w.length,k==1||k==2&&(f<=T||T<=c)){for(;g<f;w+="0",g++);w=Kc(w,T)}else if(f-=B+(k===2&&T>B),w=Ir(w,T,"0"),T+1>g){if(--f>0)for(w+=".";f--;w+="0");}else if(f+=T-g,f>0)for(T+1==g&&(w+=".");f--;w+="0");return u.s<0&&x?"-"+w:w}function O(u,f){for(var b,k,x=1,T=new v(u[0]);x<u.length;x++)k=new v(u[x]),(!k.s||(b=Va(T,k))===f||b===0&&T.s===f)&&(T=k);return T}function M(u,f,b){for(var k=1,x=f.length;!f[--x];f.pop());for(x=f[0];x>=10;x/=10,k++);return(b=k+b*Te-1)>p?u.c=u.e=null:b<d?u.c=[u.e=0]:(u.e=b,u.c=f),u}r=(function(){var u=/^(-?)0([xbo])(?=\w[\w.]*$)/i,f=/^([^.]+)\.$/,b=/^\.([^.]+)$/,k=/^-?(Infinity|NaN)$/,x=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(T,B,g,w){var S,A=g?B:B.replace(x,"");if(k.test(A))T.s=isNaN(A)?null:A<0?-1:1;else{if(!g&&(A=A.replace(u,function(D,R,$){return S=($=$.toLowerCase())=="x"?16:$=="b"?2:8,!w||w==S?R:D}),w&&(S=w,A=A.replace(f,"$1").replace(b,"0.$1")),B!=A))return new v(A,S);if(v.DEBUG)throw Error(en+"Not a"+(w?" base "+w:"")+" number: "+B);T.s=null}T.c=T.e=null}})();function L(u,f,b,k){var x,T,B,g,w,S,A,D=u.c,R=$d;if(D){e:{for(x=1,g=D[0];g>=10;g/=10,x++);if(T=f-x,T<0)T+=Te,B=f,w=D[S=0],A=In(w/R[x-B-1]%10);else if(S=zd((T+1)/Te),S>=D.length)if(k){for(;D.length<=S;D.push(0));w=A=0,x=1,T%=Te,B=T-Te+1}else break e;else{for(w=g=D[S],x=1;g>=10;g/=10,x++);T%=Te,B=T-Te+x,A=B<0?0:In(w/R[x-B-1]%10)}if(k=k||f<0||D[S+1]!=null||(B<0?w:w%R[x-B-1]),k=b<4?(A||k)&&(b==0||b==(u.s<0?3:2)):A>5||A==5&&(b==4||k||b==6&&(T>0?B>0?w/R[x-B]:0:D[S-1])%10&1||b==(u.s<0?8:7)),f<1||!D[0])return D.length=0,k?(f-=u.e+1,D[0]=R[(Te-f%Te)%Te],u.e=-f||0):D[0]=u.e=0,u;if(T==0?(D.length=S,g=1,S--):(D.length=S+1,g=R[Te-T],D[S]=B>0?In(w/R[x-B]%R[B])*g:0),k)for(;;)if(S==0){for(T=1,B=D[0];B>=10;B/=10,T++);for(B=D[0]+=g,g=1;B>=10;B/=10,g++);T!=g&&(u.e++,D[0]==Hn&&(D[0]=1));break}else{if(D[S]+=g,D[S]!=Hn)break;D[S--]=0,g=1}for(T=D.length;D[--T]===0;D.pop());}u.e>p?u.c=u.e=null:u.e<d&&(u.c=[u.e=0])}return u}function F(u){var f,b=u.e;return b===null?u.toString():(f=On(u.c),f=b<=c||b>=l?Kc(f,b):Ir(f,b,"0"),u.s<0?"-"+f:f)}return a.absoluteValue=a.abs=function(){var u=new v(this);return u.s<0&&(u.s=1),u},a.comparedTo=function(u,f){return Va(this,new v(u,f))},a.decimalPlaces=a.dp=function(u,f){var b,k,x,T=this;if(u!=null)return dt(u,0,Ot),f==null?f=i:dt(f,0,8),L(new v(T),u+T.e+1,f);if(!(b=T.c))return null;if(k=((x=b.length-1)-Bn(this.e/Te))*Te,x=b[x])for(;x%10==0;x/=10,k--);return k<0&&(k=0),k},a.dividedBy=a.div=function(u,f){return t(this,new v(u,f),o,i)},a.dividedToIntegerBy=a.idiv=function(u,f){return t(this,new v(u,f),0,1)},a.exponentiatedBy=a.pow=function(u,f){var b,k,x,T,B,g,w,S,A,D=this;if(u=new v(u),u.c&&!u.isInteger())throw Error(en+"Exponent not an integer: "+F(u));if(f!=null&&(f=new v(f)),g=u.e>14,!D.c||!D.c[0]||D.c[0]==1&&!D.e&&D.c.length==1||!u.c||!u.c[0])return A=new v(Math.pow(+F(D),g?u.s*(2-Yc(u)):+F(u))),f?A.mod(f):A;if(w=u.s<0,f){if(f.c?!f.c[0]:!f.s)return new v(NaN);k=!w&&D.isInteger()&&f.isInteger(),k&&(D=D.mod(f))}else{if(u.e>9&&(D.e>0||D.e<-1||(D.e==0?D.c[0]>1||g&&D.c[1]>=24e7:D.c[0]<8e13||g&&D.c[0]<=9999975e7)))return T=D.s<0&&Yc(u)?-0:0,D.e>-1&&(T=1/T),new v(w?1/T:T);E&&(T=zd(E/Te+2))}for(g?(b=new v(.5),w&&(u.s=1),S=Yc(u)):(x=Math.abs(+F(u)),S=x%2),A=new v(s);;){if(S){if(A=A.times(D),!A.c)break;T?A.c.length>T&&(A.c.length=T):k&&(A=A.mod(f))}if(x){if(x=In(x/2),x===0)break;S=x%2}else if(u=u.times(b),L(u,u.e+1,1),u.e>14)S=Yc(u);else{if(x=+F(u),x===0)break;S=x%2}D=D.times(D),T?D.c&&D.c.length>T&&(D.c.length=T):k&&(D=D.mod(f))}return k?A:(w&&(A=s.div(A)),f?A.mod(f):T?L(A,E,i,B):A)},a.integerValue=function(u){var f=new v(this);return u==null?u=i:dt(u,0,8),L(f,f.e+1,u)},a.isEqualTo=a.eq=function(u,f){return Va(this,new v(u,f))===0},a.isFinite=function(){return!!this.c},a.isGreaterThan=a.gt=function(u,f){return Va(this,new v(u,f))>0},a.isGreaterThanOrEqualTo=a.gte=function(u,f){return(f=Va(this,new v(u,f)))===1||f===0},a.isInteger=function(){return!!this.c&&Bn(this.e/Te)>this.c.length-2},a.isLessThan=a.lt=function(u,f){return Va(this,new v(u,f))<0},a.isLessThanOrEqualTo=a.lte=function(u,f){return(f=Va(this,new v(u,f)))===-1||f===0},a.isNaN=function(){return!this.s},a.isNegative=function(){return this.s<0},a.isPositive=function(){return this.s>0},a.isZero=function(){return!!this.c&&this.c[0]==0},a.minus=function(u,f){var b,k,x,T,B=this,g=B.s;if(u=new v(u,f),f=u.s,!g||!f)return new v(NaN);if(g!=f)return u.s=-f,B.plus(u);var w=B.e/Te,S=u.e/Te,A=B.c,D=u.c;if(!w||!S){if(!A||!D)return A?(u.s=-f,u):new v(D?B:NaN);if(!A[0]||!D[0])return D[0]?(u.s=-f,u):new v(A[0]?B:i==3?-0:0)}if(w=Bn(w),S=Bn(S),A=A.slice(),g=w-S){for((T=g<0)?(g=-g,x=A):(S=w,x=D),x.reverse(),f=g;f--;x.push(0));x.reverse()}else for(k=(T=(g=A.length)<(f=D.length))?g:f,g=f=0;f<k;f++)if(A[f]!=D[f]){T=A[f]<D[f];break}if(T&&(x=A,A=D,D=x,u.s=-u.s),f=(k=D.length)-(b=A.length),f>0)for(;f--;A[b++]=0);for(f=Hn-1;k>g;){if(A[--k]<D[k]){for(b=k;b&&!A[--b];A[b]=f);--A[b],A[k]+=Hn}A[k]-=D[k]}for(;A[0]==0;A.splice(0,1),--S);return A[0]?M(u,A,S):(u.s=i==3?-1:1,u.c=[u.e=0],u)},a.modulo=a.mod=function(u,f){var b,k,x=this;return u=new v(u,f),!x.c||!u.s||u.c&&!u.c[0]?new v(NaN):!u.c||x.c&&!x.c[0]?new v(x):(y==9?(k=u.s,u.s=1,b=t(x,u,0,3),u.s=k,b.s*=k):b=t(x,u,0,y),u=x.minus(b.times(u)),!u.c[0]&&y==1&&(u.s=x.s),u)},a.multipliedBy=a.times=function(u,f){var b,k,x,T,B,g,w,S,A,D,R,$,j,te,ce,Y=this,J=Y.c,ye=(u=new v(u,f)).c;if(!J||!ye||!J[0]||!ye[0])return!Y.s||!u.s||J&&!J[0]&&!ye||ye&&!ye[0]&&!J?u.c=u.e=u.s=null:(u.s*=Y.s,!J||!ye?u.c=u.e=null:(u.c=[0],u.e=0)),u;for(k=Bn(Y.e/Te)+Bn(u.e/Te),u.s*=Y.s,w=J.length,D=ye.length,w<D&&(j=J,J=ye,ye=j,x=w,w=D,D=x),x=w+D,j=[];x--;j.push(0));for(te=Hn,ce=ca,x=D;--x>=0;){for(b=0,R=ye[x]%ce,$=ye[x]/ce|0,B=w,T=x+B;T>x;)S=J[--B]%ce,A=J[B]/ce|0,g=$*S+A*R,S=R*S+g%ce*ce+j[T]+b,b=(S/te|0)+(g/ce|0)+$*A,j[T--]=S%te;j[T]=b}return b?++k:j.splice(0,1),M(u,j,k)},a.negated=function(){var u=new v(this);return u.s=-u.s||null,u},a.plus=function(u,f){var b,k=this,x=k.s;if(u=new v(u,f),f=u.s,!x||!f)return new v(NaN);if(x!=f)return u.s=-f,k.minus(u);var T=k.e/Te,B=u.e/Te,g=k.c,w=u.c;if(!T||!B){if(!g||!w)return new v(x/0);if(!g[0]||!w[0])return w[0]?u:new v(g[0]?k:x*0)}if(T=Bn(T),B=Bn(B),g=g.slice(),x=T-B){for(x>0?(B=T,b=w):(x=-x,b=g),b.reverse();x--;b.push(0));b.reverse()}for(x=g.length,f=w.length,x-f<0&&(b=w,w=g,g=b,f=x),x=0;f;)x=(g[--f]=g[f]+w[f]+x)/Hn|0,g[f]=Hn===g[f]?0:g[f]%Hn;return x&&(g=[x].concat(g),++B),M(u,g,B)},a.precision=a.sd=function(u,f){var b,k,x,T=this;if(u!=null&&u!==!!u)return dt(u,1,Ot),f==null?f=i:dt(f,0,8),L(new v(T),u,f);if(!(b=T.c))return null;if(x=b.length-1,k=x*Te+1,x=b[x]){for(;x%10==0;x/=10,k--);for(x=b[0];x>=10;x/=10,k++);}return u&&T.e+1>k&&(k=T.e+1),k},a.shiftedBy=function(u){return dt(u,-Rd,Rd),this.times("1e"+u)},a.squareRoot=a.sqrt=function(){var u,f,b,k,x,T=this,B=T.c,g=T.s,w=T.e,S=o+4,A=new v("0.5");if(g!==1||!B||!B[0])return new v(!g||g<0&&(!B||B[0])?NaN:B?T:1/0);if(g=Math.sqrt(+F(T)),g==0||g==1/0?(f=On(B),(f.length+w)%2==0&&(f+="0"),g=Math.sqrt(+f),w=Bn((w+1)/2)-(w<0||w%2),g==1/0?f="5e"+w:(f=g.toExponential(),f=f.slice(0,f.indexOf("e")+1)+w),b=new v(f)):b=new v(g+""),b.c[0]){for(w=b.e,g=w+S,g<3&&(g=0);;)if(x=b,b=A.times(x.plus(t(T,x,S,1))),On(x.c).slice(0,g)===(f=On(b.c)).slice(0,g))if(b.e<w&&--g,f=f.slice(g-3,g+1),f=="9999"||!k&&f=="4999"){if(!k&&(L(x,x.e+o+2,0),x.times(x).eq(T))){b=x;break}S+=4,g+=4,k=1}else{(!+f||!+f.slice(1)&&f.charAt(0)=="5")&&(L(b,b.e+o+2,1),u=!b.times(b).eq(T));break}}return L(b,b.e+o+1,i,u)},a.toExponential=function(u,f){return u!=null&&(dt(u,0,Ot),u++),U(this,u,f,1)},a.toFixed=function(u,f){return u!=null&&(dt(u,0,Ot),u=u+this.e+1),U(this,u,f)},a.toFormat=function(u,f,b){var k,x=this;if(b==null)u!=null&&f&&typeof f=="object"?(b=f,f=null):u&&typeof u=="object"?(b=u,u=f=null):b=C;else if(typeof b!="object")throw Error(en+"Argument not an object: "+b);if(k=x.toFixed(u,f),x.c){var T,B=k.split("."),g=+b.groupSize,w=+b.secondaryGroupSize,S=b.groupSeparator||"",A=B[0],D=B[1],R=x.s<0,$=R?A.slice(1):A,j=$.length;if(w&&(T=g,g=w,w=T,j-=T),g>0&&j>0){for(T=j%g||g,A=$.substr(0,T);T<j;T+=g)A+=S+$.substr(T,g);w>0&&(A+=S+$.slice(T)),R&&(A="-"+A)}k=D?A+(b.decimalSeparator||"")+((w=+b.fractionGroupSize)?D.replace(new RegExp("\\d{"+w+"}\\B","g"),"$&"+(b.fractionGroupSeparator||"")):D):A}return(b.prefix||"")+k+(b.suffix||"")},a.toFraction=function(u){var f,b,k,x,T,B,g,w,S,A,D,R,$=this,j=$.c;if(u!=null&&(g=new v(u),!g.isInteger()&&(g.c||g.s!==1)||g.lt(s)))throw Error(en+"Argument "+(g.isInteger()?"out of range: ":"not an integer: ")+F(g));if(!j)return new v($);for(f=new v(s),S=b=new v(s),k=w=new v(s),R=On(j),T=f.e=R.length-$.e-1,f.c[0]=$d[(B=T%Te)<0?Te+B:B],u=!u||g.comparedTo(f)>0?T>0?f:S:g,B=p,p=1/0,g=new v(R),w.c[0]=0;A=t(g,f,0,1),x=b.plus(A.times(k)),x.comparedTo(u)!=1;)b=k,k=x,S=w.plus(A.times(x=S)),w=x,f=g.minus(A.times(x=f)),g=x;return x=t(u.minus(b),k,0,1),w=w.plus(x.times(S)),b=b.plus(x.times(k)),w.s=S.s=$.s,T=T*2,D=t(S,k,T,i).minus($).abs().comparedTo(t(w,b,T,i).minus($).abs())<1?[S,k]:[w,b],p=B,D},a.toNumber=function(){return+F(this)},a.toPrecision=function(u,f){return u!=null&&dt(u,1,Ot),U(this,u,f,2)},a.toString=function(u){var f,b=this,k=b.s,x=b.e;return x===null?k?(f="Infinity",k<0&&(f="-"+f)):f="NaN":(u==null?f=x<=c||x>=l?Kc(On(b.c),x):Ir(On(b.c),x,"0"):u===10&&P?(b=L(new v(b),o+x+1,i),f=Ir(On(b.c),b.e,"0")):(dt(u,2,I.length,"Base"),f=n(Ir(On(b.c),x,"0"),10,u,k,!0)),k<0&&b.c[0]&&(f="-"+f)),f},a.valueOf=a.toJSON=function(){return F(this)},a._isBigNumber=!0,a[Symbol.toStringTag]="BigNumber",a[Symbol.for("nodejs.util.inspect.custom")]=a.valueOf,e!=null&&v.set(e),v}function Bn(e){var t=e|0;return e>0||e===t?t:t-1}function On(e){for(var t,n,r=1,a=e.length,s=e[0]+"";r<a;){for(t=e[r++]+"",n=Te-t.length;n--;t="0"+t);s+=t}for(a=s.length;s.charCodeAt(--a)===48;);return s.slice(0,a+1||1)}function Va(e,t){var n,r,a=e.c,s=t.c,o=e.s,i=t.s,c=e.e,l=t.e;if(!o||!i)return null;if(n=a&&!a[0],r=s&&!s[0],n||r)return n?r?0:-i:o;if(o!=i)return o;if(n=o<0,r=c==l,!a||!s)return r?0:!a^n?1:-1;if(!r)return c>l^n?1:-1;for(i=(c=a.length)<(l=s.length)?c:l,o=0;o<i;o++)if(a[o]!=s[o])return a[o]>s[o]^n?1:-1;return c==l?0:c>l^n?1:-1}function dt(e,t,n,r){if(e<t||e>n||e!==In(e))throw Error(en+(r||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Yc(e){var t=e.c.length-1;return Bn(e.e/Te)==t&&e.c[t]%2!=0}function Kc(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function Ir(e,t,n){var r,a;if(t<0){for(a=n+".";++t;a+=n);e=a+e}else if(r=e.length,++t>r){for(a=n,t-=r;--t;a+=n);e+=a}else t<r&&(e=e.slice(0,t)+"."+e.slice(t));return e}var he=y1();(function(){try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".orbs_OrbsLogo{object-fit:contain;display:inline}.orbs_PoweredBy{border-radius:8px;margin-left:auto;margin-right:auto}.orbs_PoweredBy a{display:flex;align-items:center;justify-content:center;text-decoration:none;color:inherit}.orbs_PoweredBy span{font-size:14px}.orbs_PoweredBy .orbs_OrbsLogo{margin-left:6px;margin-right:6px;width:18px;height:18px}.orbs_Text{margin:0;padding:0}.orbs_Spinner{width:var(--size, 38px);height:var(--size, 38px);border:var(--border-width, 3px) solid var(--border-color, white);border-bottom-color:var(--bottom-border-color, rgba(255, 255, 255, .2));border-radius:50%;display:inline-block;box-sizing:border-box;animation:orbs_rotation 1s linear infinite}@keyframes orbs_rotation{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.orbs_TradeStepLayout{--layout-min-height: 220px;--layout-width: 100%;--layout-display: flex;--layout-direction: column;--layout-align: center;--layout-overflow: visible;display:var(--layout-display);flex-direction:var(--layout-direction);align-items:var(--layout-align);width:var(--layout-width);min-height:var(--layout-min-height);overflow:var(--layout-overflow)}.orbs_TradeStepLayoutBody{--body-gap: 20px;--body-margin-top: 30px;--body-width: 100%;--body-display: flex;--body-direction: column;--body-align: center;--body-overflow: visible;gap:var(--body-gap);align-items:var(--body-align);display:var(--body-display);flex-direction:var(--body-direction);width:var(--body-width);margin-top:var(--body-margin-top);overflow:var(--body-overflow)}.orbs_TradeStepLayoutHeader{--header-gap: 30px;--header-display: flex;--header-direction: column;--header-align: center;--header-justify: center;--header-overflow: visible;display:var(--header-display);flex-direction:var(--header-direction);align-items:var(--header-align);justify-content:var(--header-justify);gap:var(--header-gap);overflow:var(--header-overflow)}.orbs_TradeStepLayoutTitle{--title-font-size: 18px;--title-font-weight: 500;--title-line-height: normal;--title-color: inherit;--title-text-align: center;--title-margin: 0;--title-padding: 0;font-size:var(--title-font-size);font-weight:var(--title-font-weight);line-height:var(--title-line-height);color:var(--title-color);text-align:var(--title-text-align);margin:var(--title-margin);padding:var(--title-padding)}.orbs_StepIndicator{--indicator-display: flex;--indicator-align: center;--indicator-justify: flex-start;--indicator-height: 7px;--indicator-width: 120px;--indicator-border-radius: 999px;--indicator-bg-color: white;--indicator-margin-bottom: 20px;--indicator-position: relative;--indicator-overflow: hidden;--indicator-border: none;--indicator-box-shadow: none;display:var(--indicator-display);align-items:var(--indicator-align);justify-content:var(--indicator-justify);height:var(--indicator-height);width:var(--indicator-width);border-radius:var(--indicator-border-radius);overflow:var(--indicator-overflow);background-color:var(--indicator-bg-color);margin-bottom:var(--indicator-margin-bottom);position:var(--indicator-position);border:var(--indicator-border);box-shadow:var(--indicator-box-shadow)}.orbs_StepIndicatorLine{--line-height: 100%;--line-bg-color: black;--line-position: absolute;--line-top: 0;--line-left: 0;--line-right: 0;--line-bottom: 0;--line-transition: all .3s ease;--line-border-radius: inherit;--line-box-shadow: none;height:var(--line-height);background-color:var(--line-bg-color);position:var(--line-position);top:var(--line-top);left:var(--line-left);right:var(--line-right);bottom:var(--line-bottom);transition:var(--line-transition);border-radius:var(--line-border-radius);box-shadow:var(--line-box-shadow)}.orbs_TradeStepLayoutFooter{--footer-display: flex;--footer-align: center;--footer-justify: center;--footer-direction: column;--footer-margin-top: auto;--footer-padding-top: 30px;--footer-width: 100%;--footer-overflow: visible;--footer-border-top: none;display:var(--footer-display);align-items:var(--footer-align);justify-content:var(--footer-justify);flex-direction:var(--footer-direction);margin-top:var(--footer-margin-top);padding-top:var(--footer-padding-top);width:var(--footer-width);overflow:var(--footer-overflow);border-top:var(--footer-border-top)}.orbs_TradeStepLayoutFooter p{--footer-text-font-size: 15px;--footer-text-line-height: normal;--footer-text-color: inherit;--footer-text-margin: 0;--footer-text-padding: 0;font-size:var(--footer-text-font-size);line-height:var(--footer-text-line-height);color:var(--footer-text-color);margin:var(--footer-text-margin);padding:var(--footer-text-padding)}.orbs_TradeStepLayoutFooterLink{--link-color: inherit;--link-text-decoration: none;--link-font-size: 15px;--link-text-align: center;--link-margin: auto;--link-outline: none;--link-line-height: normal;--link-padding: 0;--link-transition: color .2s ease;--link-hover-color: inherit;--link-hover-text-decoration: underline;color:var(--link-color);text-decoration:var(--link-text-decoration);font-size:var(--link-font-size);text-align:var(--link-text-align);margin-left:var(--link-margin);margin-right:var(--link-margin);outline:var(--link-outline);line-height:var(--link-line-height);padding:var(--link-padding);transition:var(--link-transition)}.orbs_TradeStepLayoutFooterLink:hover{color:var(--link-hover-color);text-decoration:var(--link-hover-text-decoration)}.orbs_TradeStepLayoutSuccessIcon{--success-icon-display: flex;--success-icon-justify: center;--success-icon-align: center;--success-icon-width: 60px;--success-icon-height: 60px;--success-icon-border-radius: 50%;--success-icon-overflow: visible;--success-icon-bg-color: transparent;--success-icon-border: none;--success-icon-box-shadow: none;display:var(--success-icon-display);justify-content:var(--success-icon-justify);align-items:var(--success-icon-align);width:var(--success-icon-width);height:var(--success-icon-height);border-radius:var(--success-icon-border-radius);overflow:var(--success-icon-overflow);background-color:var(--success-icon-bg-color);border:var(--success-icon-border);box-shadow:var(--success-icon-box-shadow)}.orbs_TradeStepLayoutErrorIcon{--error-icon-width: 80px;--error-icon-height: 80px;--error-icon-display: flex;--error-icon-justify: center;--error-icon-align: center;--error-icon-overflow: visible;--error-icon-bg-color: transparent;--error-icon-border: none;--error-icon-box-shadow: none;width:var(--error-icon-width);height:var(--error-icon-height);display:var(--error-icon-display);justify-content:var(--error-icon-justify);align-items:var(--error-icon-align);overflow:var(--error-icon-overflow);background-color:var(--error-icon-bg-color);border:var(--error-icon-border);box-shadow:var(--error-icon-box-shadow)}.orbs_FailedContentMsg{font-size:22px;font-weight:500}.orbs_TradePreview{display:flex;align-items:center;justify-content:center;gap:8px;width:100%}.orbs_TradePreviewToken{display:flex;align-items:center;gap:6px;max-width:calc(50% - 30px)}.orbs_TradePreviewToken p{--token-font-size: 15px;--token-white-space: nowrap;--token-overflow: hidden;--token-text-overflow: ellipsis;--token-flex: 1;--token-margin: 0;--token-padding: 0;font-size:var(--token-font-size);white-space:var(--token-white-space);overflow:var(--token-overflow);text-overflow:var(--token-text-overflow);flex:var(--token-flex);margin:var(--token-margin)}.orbs_TradepPreviewIcon{width:22px;height:22px}.orbs_TradepPreviewLogo{width:24px;height:24px;border-radius:50%;overflow:hidden}.orbs_FlexRow{display:flex;flex-direction:row}.orbs_FlexColumn{display:flex;flex-direction:column}@keyframes orbs_skeletonAnimation{0%{opacity:.2}to{opacity:.4}}.orbs_SkeletonLoader{animation:orbs_skeletonAnimation 1s linear infinite alternate;background-color:#fff}.orbs_Main-wrapper{width:100%}.orbs_Main{width:100%;display:flex;flex-direction:column;gap:28px}.orbs_MainToken{display:flex;flex-direction:row;align-items:center;justify-content:space-between;width:100%;gap:8px}.orbs_MainTokenLeft{display:flex;flex-direction:column;align-items:flex-start;gap:8px}.orbs_MainTokenUsd{display:flex;align-items:center;gap:5px}.orbs_MainTokenUsd small{font-size:12px;opacity:.6}.orbs_MainContentLoader{width:100%;display:flex;gap:15px;align-items:center;margin-top:20px}.orbs_MainContentRectengularLoader{flex:1;height:20px;max-width:250px;border-radius:20px}.orbs_MainContentCircleLoader{width:30px;height:30px;border-radius:50%}.orbs_MainTokenLogo{--width: 40px;--height: 40px;width:var(--width);height:var(--height)}.orbs_MainTokenLogo img{width:100%;height:100%;object-fit:cover}.orbs_SwapFlow{display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%}.orbs_SwapFlow *{box-sizing:border-box}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();const Re=e=>`orbs_${e}`;function Wo({children:e,className:t=""}){return _.jsx("p",{className:`${t} ${Re("Text")}`,children:e})}const g1=N.createContext({});function E8({children:e,...t}){return _.jsx(g1.Provider,{value:t,children:e})}const cr=()=>N.useContext(g1);var At=(e=>(e[e.LOADING=1]="LOADING",e[e.SUCCESS=2]="SUCCESS",e[e.FAILED=3]="FAILED",e))(At||{});const T8=({className:e="",size:t=38,borderWidth:n=3,borderColor:r="white",bottomBorderColor:a="rgba(255, 255, 255, 0.2)"})=>{const s={"--size":`${t}px`,"--border-width":`${n}px`,"--border-color":r,"--bottom-border-color":a};return _.jsx("div",{className:`${Re("Spinner")} ${e}`,style:s})};function Zc({className:e="",body:t,footerLink:n,footerText:r,title:a,children:s}){return _.jsxs("div",{className:`${Re("TradeStepLayout")} ${e}`,children:[_.jsxs("div",{className:Re("TradeStepLayoutHeader"),children:[_.jsx(I8,{}),a&&_.jsx(Wo,{className:Re("TradeStepLayoutTitle"),children:a})]}),t&&_.jsx("div",{className:Re("TradeStepLayoutBody"),children:t}),_.jsx(C8,{link:n,text:r}),s]})}const C8=({link:e,text:t})=>{const{swapStatus:n}=cr();return!e&&!t?null:_.jsxs("div",{className:Re("TradeStepLayoutFooter"),children:[_.jsx(O8,{}),e?_.jsx(A8,{link:e,text:t}):n===At.FAILED?void 0:_.jsx(Wo,{children:t})]})},A8=({link:e,text:t})=>_.jsx("a",{target:"_blank",className:Re("TradeStepLayoutFooterLink"),href:e,children:t});function S8(){const{components:e}=cr();return e.SuccessIcon?e.SuccessIcon:_.jsxs("svg",{fill:"none",viewBox:"0 0 16 16",className:Re("TradeStepLayoutSuccessIcon"),children:[_.jsx("circle",{cx:"8",cy:"8",r:"7",strokeWidth:"1.5",stroke:"#00C853"}),_.jsx("path",{strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",stroke:"#00C853",d:"M5 8l2 2 4-4"})]})}function P8(){const{components:e}=cr();return e.FailedIcon?e.FailedIcon:_.jsxs("svg",{className:Re("TradeStepLayoutErrorIcon"),viewBox:"0 0 16 16",fill:"none",children:[_.jsx("circle",{cx:"8",cy:"8",r:"7",strokeWidth:"1.5",stroke:"#FF3D00"}),_.jsx("path",{strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",stroke:"#FF3D00",d:"M8 4v5M8 11h.01"})]})}const I8=()=>{const{swapStatus:e}=cr();return e===At.SUCCESS?_.jsx(S8,{}):e===At.FAILED?_.jsx(P8,{}):_.jsx(B8,{})},B8=()=>{const{components:e}=cr();return e.Loader?e.Loader:_.jsx(T8,{size:60,borderWidth:5,className:Re("TradeStepLayoutSpinner")})},O8=()=>{const{totalSteps:e,currentStepIndex:t=0,swapStatus:n}=cr();return n!==At.LOADING||e===1?null:_.jsx("div",{className:Re("StepIndicator"),children:_.jsx("div",{style:{width:`${100/(e||0)}%`,left:`${t*100/(e||0)}%`},className:Re("StepIndicatorLine")})})},F8=({error:e,footerLink:t,footerText:n})=>_.jsx(Zc,{footerLink:t,footerText:n,body:e||_.jsx("p",{className:Re("FailedContentMsg"),children:"Something went wrong"}),className:Re("FailedContent")});function U8(){return _.jsx("svg",{fill:"currentColor",viewBox:"0 0 16 16",className:Re("TradepPreviewIcon"),children:_.jsx("path",{fillRule:"evenodd",d:"M4 8a.5.5 0 01.5-.5h5.793L8.146 5.354a.5.5 0 11.708-.708l3 3a.5.5 0 010 .708l-3 3a.5.5 0 01-.708-.708L10.293 8.5H4.5A.5.5 0 014 8z"})})}const x1=({inTokenOnly:e})=>{const{inToken:t,outToken:n,inAmount:r,outAmount:a,components:s}=cr();return _.jsxs("div",{className:Re("TradePreview"),children:[_.jsx(w1,{token:t,amount:r,Logo:s==null?void 0:s.SrcTokenLogo}),!e&&_.jsxs(_.Fragment,{children:[_.jsx(U8,{}),_.jsx(w1,{token:n,amount:a,Logo:s==null?void 0:s.DstTokenLogo})]})]})},w1=({token:e,amount:t,Logo:n})=>_.jsxs("div",{className:Re("TradePreviewToken"),children:[n||_.jsx("img",{src:e==null?void 0:e.logoUrl,className:Re("TradepPreviewLogo"),alt:`${e==null?void 0:e.symbol} logo`}),_.jsxs(Wo,{children:[t," ",e==null?void 0:e.symbol]})]});function D8({title:e,footerLink:t,footerText:n,hideTokens:r}){return _.jsx(Zc,{title:e,className:Re("Success"),body:!r&&_.jsx(x1,{}),footerLink:t,footerText:n})}const v1=({$gap:e=10,$alignItems:t="flex-start",children:n,className:r="",customStyles:a={}})=>{const s={gap:`${e}px`,alignItems:t,width:"100%",...a};return _.jsx("div",{className:`${Re("FlexColumn")} ${r}`,style:s,children:n})};function k1({styles:e={},className:t=""}){return _.jsx("div",{style:e,className:`${Re("SkeletonLoader")} ${t}`})}const _8=()=>_.jsxs("div",{className:`${Re("MainContentLoader")}`,children:[_.jsx(k1,{className:`${Re("MainContentCircleLoader")}`}),_.jsx(k1,{className:`${Re("MainContentRectengularLoader")}`})]}),M8=({fromTitle:e,toTitle:t,inUsd:n,outUsd:r})=>{const{swapStatus:a,outAmount:s,inAmount:o,inToken:i,outToken:c,components:l,totalSteps:d}=cr(),p=_.jsx(T1,{fromTitle:e,inUsd:n,inToken:i,toTitle:t,outUsd:r,outToken:c,inAmount:o,outAmount:s,SrcTokenLogo:l.SrcTokenLogo,DstTokenLogo:l.DstTokenLogo});return a?d?_.jsx(N8,{}):_.jsxs(v1,{children:[p,_.jsx(_8,{})]}):_.jsx(v1,{children:p})},E1=({amount:e,token:t,usd:n,title:r,Logo:a})=>_.jsxs("div",{className:`${Re("MainToken")}`,children:[_.jsxs("div",{className:`${Re("MainTokenLeft")}`,children:[_.jsx(Wo,{className:`${Re("MainTokenTitle")}`,children:r}),_.jsx(Wo,{className:` ${Re("MainTokenAmount")}`,children:`${e&&Number(e)>0?e:""} ${(t==null?void 0:t.symbol)||""}`}),n&&_.jsx("div",{className:` ${Re("MainTokenUsd")}`,children:n})]}),a||_.jsx("div",{className:` ${Re("MainTokenLogo")}`,children:t!=null&&t.logoUrl?_.jsx("img",{src:t==null?void 0:t.logoUrl,alt:"Token logo"}):null})]});function N8(){const{currentStep:e}=cr();return e?_.jsx(Zc,{footerLink:e.footerLink,footerText:e.footerText,title:e.title,body:e.hideTokens?void 0:_.jsx(x1,{inTokenOnly:e==null?void 0:e.inTokenOnly})}):null}const T1=({fromTitle:e,inUsd:t,inToken:n,toTitle:r,outUsd:a,outToken:s,inAmount:o,outAmount:i,SrcTokenLogo:c,DstTokenLogo:l})=>_.jsxs("div",{className:`${Re("Main")}`,children:[_.jsx(E1,{title:e||"Swap from",usd:t,token:n,amount:o,Logo:c}),_.jsx(E1,{title:r||"Swap to",usd:a,token:s,amount:i,Logo:l})]}),la=e=>_.jsx(E8,{...e,children:_.jsx(L8,{})}),L8=()=>{const{swapStatus:e,components:t,className:n}=cr();return _.jsx("div",{className:`${Re("SwapFlow")} ${n}`,children:e===At.SUCCESS?t==null?void 0:t.Success:e===At.FAILED?t==null?void 0:t.Failed:t==null?void 0:t.Main})};la.Success=D8,la.Failed=F8,la.Main=M8,la.StepLayout=Zc;var Rt=(e=>(e[e.EMPTY_LIMIT_PRICE=0]="EMPTY_LIMIT_PRICE",e[e.MAX_CHUNKS=1]="MAX_CHUNKS",e[e.MIN_CHUNKS=2]="MIN_CHUNKS",e[e.MIN_TRADE_SIZE=3]="MIN_TRADE_SIZE",e[e.MAX_FILL_DELAY=4]="MAX_FILL_DELAY",e[e.MIN_FILL_DELAY=5]="MIN_FILL_DELAY",e[e.MAX_ORDER_DURATION=6]="MAX_ORDER_DURATION",e[e.MIN_ORDER_DURATION=7]="MIN_ORDER_DURATION",e[e.MISSING_LIMIT_PRICE=8]="MISSING_LIMIT_PRICE",e[e.STOP_LOSS_TRIGGER_PRICE_GREATER_THAN_MARKET_PRICE=9]="STOP_LOSS_TRIGGER_PRICE_GREATER_THAN_MARKET_PRICE",e[e.TRIGGER_LIMIT_PRICE_GREATER_THAN_TRIGGER_PRICE=10]="TRIGGER_LIMIT_PRICE_GREATER_THAN_TRIGGER_PRICE",e[e.TAKE_PROFIT_TRIGGER_PRICE_LESS_THAN_MARKET_PRICE=11]="TAKE_PROFIT_TRIGGER_PRICE_LESS_THAN_MARKET_PRICE",e[e.EMPTY_TRIGGER_PRICE=12]="EMPTY_TRIGGER_PRICE",e[e.INSUFFICIENT_BALANCE=13]="INSUFFICIENT_BALANCE",e[e.MAX_ORDER_SIZE=14]="MAX_ORDER_SIZE",e))(Rt||{}),Wa=(e=>(e.WRAP="wrap",e.APPROVE="approve",e.CREATE="create",e))(Wa||{});const z8=e=>e.replace(/,/g,""),R8=async e=>{if(!(navigator!=null&&navigator.clipboard))return console.warn("Clipboard not supported"),!1;try{return await navigator.clipboard.writeText(e),!0}catch(t){return console.warn("Copy failed",t),!1}},C1=e=>{if(!e)return"";const t=Math.floor(e/1e3),n=Math.floor(t/(1440*60)),r=Math.floor(t%(1440*60)/3600),a=Math.floor(t%3600/60),s=t%60,o=[];return n&&o.push(`${n} days `),r&&o.push(`${r} hours `),a&&o.push(`${a} minutes`),s&&o.push(`${s} seconds`),o.join(" ")},Hd=(e,t)=>e?`${e.substring(0,(t==null?void 0:t.start)||6)}...${e.substring(e.length-((t==null?void 0:t.end)||5))}`:"",$8=e=>{const t="An error occurred.";if(!e||!e.message)return t;try{return e.message.toLowerCase().indexOf("rejected")?"Transaction Rejected":t}catch{return t}};function qo(e,t=6,n=8){if(!e)return"";const r=e.startsWith("-")?"-":"",a=r?e.slice(1):e,[s,o=""]=a.split(".");if(!o||Number(o)===0)return r+s;if(s!=="0"){const h=o.slice(0,t).replace(/0+$/,""),y=h?"."+h:"";return r+s+y}const i=o.search(/[^0]/);if(i===-1||i+1>n)return"0";const c=o.slice(0,i),d=o.slice(i).slice(0,t).replace(/0+$/,"");return d?r+"0."+c+d:"0"}const Gd=e=>{var t,n,r,a;if(e!=null&&e.message)return((n=(t=e.message)==null?void 0:t.toLowerCase())==null?void 0:n.includes("rejected"))||((a=(r=e.message)==null?void 0:r.toLowerCase())==null?void 0:a.includes("denied"))},H8=e=>{switch(e){case _t.base.id:return 1e-4;default:return .01}},A1=(e,t,n)=>{if(!he(e.srcAmountFilled||0).gt(0)||!he(e.dstAmountFilled||0).gt(0))return"";const r=ir(t,e.srcAmountFilled),a=ir(n,e.dstAmountFilled);return he(a).div(r).toFixed()},S1=(e,t,n)=>{if(e.type===ft.TWAP_MARKET)return"";const r=ir(t,e.srcAmountPerTrade),a=ir(n,e.dstMinAmountPerTrade);return he(a).div(r).toFixed()},P1=(e,t)=>{const n=$a(t);return n&&Ra(e.address)?n.wToken:e};function I1(e){return e?e/864e5:0}function jd(e){return e?e/6e4:0}const G8=(e,t)=>e?ft.TWAP_MARKET:t===1?ft.LIMIT:ft.TWAP_LIMIT,Vd=(e,t,n)=>{const r=$a(n);return Ra((e==null?void 0:e.address)||"")&&za((t==null?void 0:t.address)||"",(r==null?void 0:r.wToken.address)||"")},Wd=(e,t,n)=>{const r=$a(n);return za((e==null?void 0:e.address)||"",(r==null?void 0:r.wToken.address)||"")&&Ra((t==null?void 0:t.address)||"")},Yo=(e,t)=>{if(!t)return"";const n=$a(t);return`${n==null?void 0:n.explorer}/tx/${e}`};function m(e){const t={formatters:void 0,fees:void 0,serializers:void 0,...e};function n(r){return a=>{const s=typeof a=="function"?a(r):a,o={...r,...s};return Object.assign(o,{extend:n(o)})}}return Object.assign(t,{extend:n(t)})}function j8(){return{}}const V8=m({id:16600,name:"0G Newton Testnet",nativeCurrency:{name:"A0GI",symbol:"A0GI",decimals:18},rpcUrls:{default:{http:["https://evmrpc-testnet.0g.ai"]}},blockExplorers:{default:{name:"0G BlockChain Explorer",url:"https://chainscan-newton.0g.ai"}},testnet:!0}),W8=m({id:16601,name:"0G Galileo Testnet",nativeCurrency:{name:"A0GI",symbol:"A0GI",decimals:18},rpcUrls:{default:{http:["https://evmrpc-testnet.0g.ai"]}},blockExplorers:{default:{name:"0G BlockChain Explorer",url:"https://chainscan-galileo.0g.ai"}},testnet:!0}),q8=m({id:16661,name:"0G Mainnet",nativeCurrency:{name:"0G",symbol:"0G",decimals:18},rpcUrls:{default:{http:["https://evmrpc.0g.ai"]}},blockExplorers:{default:{name:"0G BlockChain Explorer",url:"https://chainscan.0g.ai"}},testnet:!1}),Y8=m({id:16602,name:"0G Galileo Testnet",nativeCurrency:{name:"A0GI",symbol:"A0GI",decimals:18},rpcUrls:{default:{http:["https://evmrpc-testnet.0g.ai"]}},blockExplorers:{default:{name:"0G BlockChain Explorer",url:"https://chainscan-galileo.0g.ai"}},testnet:!0}),K8=m({id:995,name:"5ireChain",nativeCurrency:{name:"5ire Token",symbol:"5IRE",decimals:18},rpcUrls:{default:{http:["https://rpc.5ire.network"]}},blockExplorers:{default:{name:"5ireChain Mainnet Explorer",url:"https://5irescan.io/"}},testnet:!1}),Z8=m({id:179,name:"ABEY Mainnet",nativeCurrency:{name:"ABEY",symbol:"ABEY",decimals:18},rpcUrls:{default:{http:["https://rpc.abeychain.com"]}},blockExplorers:{default:{name:"Abey Scan",url:"https://abeyscan.com"}},testnet:!1}),B1="2.43.3";let Ko={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${B1}`},G=class Ym extends Error{constructor(t,n={}){var i;const r=(()=>{var c;return n.cause instanceof Ym?n.cause.details:(c=n.cause)!=null&&c.message?n.cause.message:n.details})(),a=n.cause instanceof Ym&&n.cause.docsPath||n.docsPath,s=(i=Ko.getDocsUrl)==null?void 0:i.call(Ko,{...n,docsPath:a}),o=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],...Ko.version?[`Version: ${Ko.version}`]:[]].join(`
|
|
65
65
|
`);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=a,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=B1}walk(t){return O1(this,t)}};function O1(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?O1(e.cause,t):t?null:e}let F1=class extends G{constructor({max:t,min:n,signed:r,size:a,value:s}){super(`Number "${s}" is not in safe ${a?`${a*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}},X8=class extends G{constructor(t){super(`Bytes value "${t}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,{name:"InvalidBytesBooleanError"})}};class Q8 extends G{constructor(t){super(`Hex value "${t}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,{name:"InvalidHexBooleanError"})}}let J8=class extends G{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}};function Gn(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function pt(e){return Gn(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}function tn(e,{dir:t="left"}={}){let n=typeof e=="string"?e.replace("0x",""):e,r=0;for(let a=0;a<n.length-1&&n[t==="left"?a:n.length-a-1].toString()==="0";a++)r++;return n=t==="left"?n.slice(r):n.slice(0,n.length-r),typeof e=="string"?(n.length===1&&t==="right"&&(n=`${n}0`),`0x${n.length%2===1?`0${n}`:n}`):n}let U1=class extends G{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}},D1=class extends G{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}};class _1 extends G{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} is expected to be ${n} ${r} long, but is ${t} ${r} long.`,{name:"InvalidBytesLengthError"})}}function qa(e,{dir:t,size:n=32}={}){return typeof e=="string"?ua(e,{dir:t,size:n}):ev(e,{dir:t,size:n})}function ua(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new D1({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function ev(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new D1({size:e.length,targetSize:n,type:"bytes"});const r=new Uint8Array(n);for(let a=0;a<n;a++){const s=t==="right";r[s?a:n-a-1]=e[s?a:e.length-a-1]}return r}const tv=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function _e(e,t={}){return typeof e=="number"||typeof e=="bigint"?q(e,t):typeof e=="string"?Ls(e,t):typeof e=="boolean"?M1(e,t):Et(e,t)}function M1(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(jn(n,{size:t.size}),qa(n,{size:t.size})):n}function Et(e,t={}){let n="";for(let a=0;a<e.length;a++)n+=tv[e[a]];const r=`0x${n}`;return typeof t.size=="number"?(jn(r,{size:t.size}),qa(r,{dir:"right",size:t.size})):r}function q(e,t={}){const{signed:n,size:r}=t,a=BigInt(e);let s;r?n?s=(1n<<BigInt(r)*8n-1n)-1n:s=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof s=="bigint"&&n?-s-1n:0;if(s&&a>s||a<o){const c=typeof e=="bigint"?"n":"";throw new F1({max:s?`${s}${c}`:void 0,min:`${o}${c}`,signed:n,size:r,value:`${e}${c}`})}const i=`0x${(n&&a<0?(1n<<BigInt(r*8))+BigInt(a):a).toString(16)}`;return r?qa(i,{size:r}):i}const nv=new TextEncoder;function Ls(e,t={}){const n=nv.encode(e);return Et(n,t)}const rv=new TextEncoder;function Br(e,t={}){return typeof e=="number"||typeof e=="bigint"?sv(e,t):typeof e=="boolean"?av(e,t):Gn(e)?pn(e,t):Ya(e,t)}function av(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(jn(n,{size:t.size}),qa(n,{size:t.size})):n}const Or={zero:48,nine:57,A:65,F:70,a:97,f:102};function N1(e){if(e>=Or.zero&&e<=Or.nine)return e-Or.zero;if(e>=Or.A&&e<=Or.F)return e-(Or.A-10);if(e>=Or.a&&e<=Or.f)return e-(Or.a-10)}function pn(e,t={}){let n=e;t.size&&(jn(n,{size:t.size}),n=qa(n,{dir:"right",size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);const a=r.length/2,s=new Uint8Array(a);for(let o=0,i=0;o<a;o++){const c=N1(r.charCodeAt(i++)),l=N1(r.charCodeAt(i++));if(c===void 0||l===void 0)throw new G(`Invalid byte sequence ("${r[i-2]}${r[i-1]}" in "${r}").`);s[o]=c*16+l}return s}function sv(e,t){const n=q(e,t);return pn(n)}function Ya(e,t={}){const n=rv.encode(e);return typeof t.size=="number"?(jn(n,{size:t.size}),qa(n,{dir:"right",size:t.size})):n}function jn(e,{size:t}){if(pt(e)>t)throw new J8({givenSize:pt(e),maxSize:t})}function $e(e,t={}){const{signed:n}=t;t.size&&jn(e,{size:t.size});const r=BigInt(e);if(!n)return r;const a=(e.length-2)/2,s=(1n<<BigInt(a)*8n-1n)-1n;return r<=s?r:r-BigInt(`0x${"f".padStart(a*2,"f")}`)-1n}function ov(e,t={}){let n=e;if(t.size&&(jn(n,{size:t.size}),n=tn(n)),tn(n)==="0x00")return!1;if(tn(n)==="0x01")return!0;throw new Q8(n)}function fn(e,t={}){return Number($e(e,t))}function Xc(e,t){return({exclude:n,format:r})=>({exclude:n,format:(a,s)=>{const o=t(a,s);if(n)for(const i of n)delete o[i];return{...o,...r(a,s)}},type:e})}const L1={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function Ka(e,t){const n={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?fn(e.chainId):void 0,gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,maxFeePerBlobGas:e.maxFeePerBlobGas?BigInt(e.maxFeePerBlobGas):void 0,maxFeePerGas:e.maxFeePerGas?BigInt(e.maxFeePerGas):void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?BigInt(e.maxPriorityFeePerGas):void 0,nonce:e.nonce?fn(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?L1[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return e.authorizationList&&(n.authorizationList=iv(e.authorizationList)),n.yParity=(()=>{if(e.yParity)return Number(e.yParity);if(typeof n.v=="bigint"){if(n.v===0n||n.v===27n)return 0;if(n.v===1n||n.v===28n)return 1;if(n.v>=35n)return n.v%2n===0n?1:0}})(),n.type==="legacy"&&(delete n.accessList,delete n.maxFeePerBlobGas,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas,delete n.yParity),n.type==="eip2930"&&(delete n.maxFeePerBlobGas,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas),n.type==="eip1559"&&delete n.maxFeePerBlobGas,n}const Qc=Xc("transaction",Ka);function iv(e){return e.map(t=>({address:t.address,chainId:Number(t.chainId),nonce:Number(t.nonce),r:t.r,s:t.s,yParity:Number(t.yParity)}))}function qd(e,t){const n=(e.transactions??[]).map(r=>typeof r=="string"?r:Ka(r));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,blobGasUsed:e.blobGasUsed?BigInt(e.blobGasUsed):void 0,difficulty:e.difficulty?BigInt(e.difficulty):void 0,excessBlobGas:e.excessBlobGas?BigInt(e.excessBlobGas):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:n,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}const Yd=Xc("block",qd);function lr(e,{args:t,eventName:n}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,blockTimestamp:e.blockTimestamp?BigInt(e.blockTimestamp):e.blockTimestamp===null?null:void 0,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...n?{args:t,eventName:n}:{}}}const z1={"0x0":"reverted","0x1":"success"};function Jc(e,t){const n={...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map(r=>lr(r)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?fn(e.transactionIndex):null,status:e.status?z1[e.status]:null,type:e.type?L1[e.type]||e.type:null};return e.blobGasPrice&&(n.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(n.blobGasUsed=BigInt(e.blobGasUsed)),n}const Kd=Xc("transactionReceipt",Jc),cv={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function Vn(e,t){const n={};return typeof e.authorizationList<"u"&&(n.authorizationList=lv(e.authorizationList)),typeof e.accessList<"u"&&(n.accessList=e.accessList),typeof e.blobVersionedHashes<"u"&&(n.blobVersionedHashes=e.blobVersionedHashes),typeof e.blobs<"u"&&(typeof e.blobs[0]!="string"?n.blobs=e.blobs.map(r=>Et(r)):n.blobs=e.blobs),typeof e.data<"u"&&(n.data=e.data),e.account&&(n.from=e.account.address),typeof e.from<"u"&&(n.from=e.from),typeof e.gas<"u"&&(n.gas=q(e.gas)),typeof e.gasPrice<"u"&&(n.gasPrice=q(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(n.maxFeePerBlobGas=q(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(n.maxFeePerGas=q(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(n.maxPriorityFeePerGas=q(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(n.nonce=q(e.nonce)),typeof e.to<"u"&&(n.to=e.to),typeof e.type<"u"&&(n.type=cv[e.type]),typeof e.value<"u"&&(n.value=q(e.value)),n}const Zd=Xc("transactionRequest",Vn);function lv(e){return e.map(t=>({address:t.address,r:t.r?q(BigInt(t.r)):t.r,s:t.s?q(BigInt(t.s)):t.s,chainId:q(t.chainId),nonce:q(t.nonce),...typeof t.yParity<"u"?{yParity:q(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:q(t.v)}:{}}))}const uv=2n**16n-1n,Za=2n**256n-1n,Xd=50000n,R1=uv*32n,$1={block:Yd({format(e){var n;const t=(n=e.transactions)==null?void 0:n.map(r=>{var s;if(typeof r=="string")return r;const a=(s=$1.transaction)==null?void 0:s.format(r);return a.typeHex==="0x71"?a.type="eip712":a.typeHex==="0xff"&&(a.type="priority"),a});return{l1BatchNumber:e.l1BatchNumber?$e(e.l1BatchNumber):null,l1BatchTimestamp:e.l1BatchTimestamp?$e(e.l1BatchTimestamp):null,transactions:t}}}),transaction:Qc({format(e){const t={};return e.type==="0x71"?t.type="eip712":e.type==="0xff"&&(t.type="priority"),{...t,l1BatchNumber:e.l1BatchNumber?$e(e.l1BatchNumber):null,l1BatchTxIndex:e.l1BatchTxIndex?$e(e.l1BatchTxIndex):null}}}),transactionReceipt:Kd({format(e){return{l1BatchNumber:e.l1BatchNumber?$e(e.l1BatchNumber):null,l1BatchTxIndex:e.l1BatchTxIndex?$e(e.l1BatchTxIndex):null,logs:e.logs.map(t=>({...lr(t),l1BatchNumber:t.l1BatchNumber?$e(t.l1BatchNumber):null,transactionLogIndex:fn(t.transactionLogIndex),logType:t.logType})),l2ToL1Logs:e.l2ToL1Logs.map(t=>({blockNumber:$e(t.blockHash),blockHash:t.blockHash,l1BatchNumber:t.l1BatchNumber?$e(t.l1BatchNumber):null,transactionIndex:$e(t.transactionIndex),shardId:$e(t.shardId),isService:t.isService,sender:t.sender,key:t.key,value:t.value,transactionHash:t.transactionHash,logIndex:$e(t.logIndex)}))}}}),transactionRequest:Zd({exclude:["customSignature","factoryDeps","gasPerPubdata","paymaster","paymasterInput"],format(e){return e.gasPerPubdata||e.paymaster&&e.paymasterInput||e.factoryDeps||e.customSignature?{eip712Meta:{...e.gasPerPubdata?{gasPerPubdata:_e(e.gasPerPubdata)}:{gasPerPubdata:_e(Xd)},...e.paymaster&&e.paymasterInput?{paymasterParams:{paymaster:e.paymaster,paymasterInput:Array.from(pn(e.paymasterInput))}}:{},...e.factoryDeps?{factoryDeps:e.factoryDeps.map(t=>Array.from(pn(t)))}:{},...e.customSignature?{customSignature:Array.from(pn(e.customSignature))}:{}},type:"0x71"}:{}}})};function mn(e){return typeof e[0]=="string"?hn(e):dv(e)}function dv(e){let t=0;for(const a of e)t+=a.length;const n=new Uint8Array(t);let r=0;for(const a of e)n.set(a,r),r+=a.length;return n}function hn(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}let H1=class extends G{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}},G1=class extends G{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}},pv=class extends G{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}};const fv={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new pv({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new G1({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new H1({offset:e});const t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new H1({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const n=t??this.position;return this.assertPosition(n+e-1),this.bytes.subarray(n,n+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,e&255),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();const n=this.inspectBytes(e);return this.position+=t??e,n},readUint8(){this.assertReadLimit(),this._touch();const e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();const e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();const e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();const e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){const t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function Qd(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(fv);return n.bytes=e,n.dataView=new DataView(e.buffer??e,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function ur(e,t="hex"){const n=j1(e),r=Qd(new Uint8Array(n.length));return n.encode(r),t==="hex"?Et(r.bytes):r.bytes}function j1(e){return Array.isArray(e)?mv(e.map(t=>j1(t))):hv(e)}function mv(e){const t=e.reduce((a,s)=>a+s.length,0),n=V1(t);return{length:t<=55?1+t:1+n+t,encode(a){t<=55?a.pushByte(192+t):(a.pushByte(247+n),n===1?a.pushUint8(t):n===2?a.pushUint16(t):n===3?a.pushUint24(t):a.pushUint32(t));for(const{encode:s}of e)s(a)}}}function hv(e){const t=typeof e=="string"?pn(e):e,n=V1(t.length);return{length:t.length===1&&t[0]<128?1:t.length<=55?1+t.length:1+n+t.length,encode(a){t.length===1&&t[0]<128?a.pushBytes(t):t.length<=55?(a.pushByte(128+t.length),a.pushBytes(t)):(a.pushByte(183+n),n===1?a.pushUint8(t.length):n===2?a.pushUint16(t.length):n===3?a.pushUint24(t.length):a.pushUint32(t.length),a.pushBytes(t))}}}function V1(e){if(e<2**8)return 1;if(e<2**16)return 2;if(e<2**24)return 3;if(e<2**32)return 4;throw new G("Length is too large.")}const bv={gwei:9,wei:18},yv={ether:-9,wei:9};function W1(e,t){let n=e.toString();const r=n.startsWith("-");r&&(n=n.slice(1)),n=n.padStart(t,"0");let[a,s]=[n.slice(0,n.length-t),n.slice(n.length-t)];return s=s.replace(/(0+)$/,""),`${r?"-":""}${a||"0"}${s?`.${s}`:""}`}function Jd(e,t="wei"){return W1(e,bv[t])}function nn(e,t="wei"){return W1(e,yv[t])}function Zo(e){const t=Object.entries(e).map(([r,a])=>a===void 0||a===!1?null:[r,a]).filter(Boolean),n=t.reduce((r,[a])=>Math.max(r,a.length),0);return t.map(([r,a])=>` ${`${r}:`.padEnd(n+1)} ${a}`).join(`
|
|
66
66
|
`)}class gv extends G{constructor({v:t}){super(`Invalid \`v\` value "${t}". Expected 27 or 28.`,{name:"InvalidLegacyVError"})}}class xv extends G{constructor({transaction:t}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",Zo(t),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}let wv=class extends G{constructor({storageKey:t}){super(`Size for storage key "${t}" is invalid. Expected 32 bytes. Got ${Math.floor((t.length-2)/2)} bytes.`,{name:"InvalidStorageKeySizeError"})}};class vv extends G{constructor(t,{account:n,docsPath:r,chain:a,data:s,gas:o,gasPrice:i,maxFeePerGas:c,maxPriorityFeePerGas:l,nonce:d,to:p,value:h}){var E;const y=Zo({chain:a&&`${a==null?void 0:a.name} (id: ${a==null?void 0:a.id})`,from:n==null?void 0:n.address,to:p,value:typeof h<"u"&&`${Jd(h)} ${((E=a==null?void 0:a.nativeCurrency)==null?void 0:E.symbol)||"ETH"}`,data:s,gas:o,gasPrice:typeof i<"u"&&`${nn(i)} gwei`,maxFeePerGas:typeof c<"u"&&`${nn(c)} gwei`,maxPriorityFeePerGas:typeof l<"u"&&`${nn(l)} gwei`,nonce:d});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Request Arguments:",y].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class q1 extends G{constructor({blockHash:t,blockNumber:n,blockTag:r,hash:a,index:s}){let o="Transaction";r&&s!==void 0&&(o=`Transaction at block time "${r}" at index "${s}"`),t&&s!==void 0&&(o=`Transaction at block hash "${t}" at index "${s}"`),n&&s!==void 0&&(o=`Transaction at block number "${n}" at index "${s}"`),a&&(o=`Transaction with hash "${a}"`),super(`${o} could not be found.`,{name:"TransactionNotFoundError"})}}class Y1 extends G{constructor({hash:t}){super(`Transaction receipt with hash "${t}" could not be found. The Transaction may not be processed on a block yet.`,{name:"TransactionReceiptNotFoundError"})}}class K1 extends G{constructor({receipt:t}){super(`Transaction with hash "${t.transactionHash}" reverted.`,{metaMessages:['The receipt marked the transaction as "reverted". This could mean that the function on the contract you are trying to call threw an error.'," ","You can attempt to extract the revert reason by:","- calling the `simulateContract` or `simulateCalls` Action with the `abi` and `functionName` of the contract","- using the `call` Action with raw `data`"],name:"TransactionReceiptRevertedError"}),Object.defineProperty(this,"receipt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.receipt=t}}class kv extends G{constructor({hash:t}){super(`Timed out while waiting for transaction with hash "${t}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}}function Ev(e){if(!e||e.length===0)return[];const t=[];for(const n of e){const{chainId:r,nonce:a,...s}=n,o=n.address;t.push([r?_e(r):"0x",o,a?_e(a):"0x",...qs({},s)])}return t}function ep(e){const{kzg:t}=e,n=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),r=typeof e.blobs[0]=="string"?e.blobs.map(s=>pn(s)):e.blobs,a=[];for(const s of r)a.push(Uint8Array.from(t.blobToKzgCommitment(s)));return n==="bytes"?a:a.map(s=>Et(s))}function tp(e){const{kzg:t}=e,n=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),r=typeof e.blobs[0]=="string"?e.blobs.map(o=>pn(o)):e.blobs,a=typeof e.commitments[0]=="string"?e.commitments.map(o=>pn(o)):e.commitments,s=[];for(let o=0;o<r.length;o++){const i=r[o],c=a[o];s.push(Uint8Array.from(t.computeBlobKzgProof(i,c)))}return n==="bytes"?s:s.map(o=>Et(o))}const zs=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Tv(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Xo(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Xa(e,...t){if(!Tv(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function Cv(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Xo(e.outputLen),Xo(e.blockLen)}function Rs(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Z1(e,t){Xa(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Av(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function da(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function np(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function dr(e,t){return e<<32-t|e>>>t}const Sv=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Pv(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Iv(e){for(let t=0;t<e.length;t++)e[t]=Pv(e[t]);return e}const X1=Sv?e=>e:Iv;function Bv(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function el(e){return typeof e=="string"&&(e=Bv(e)),Xa(e),e}function Ov(...e){let t=0;for(let r=0;r<e.length;r++){const a=e[r];Xa(a),t+=a.length}const n=new Uint8Array(t);for(let r=0,a=0;r<e.length;r++){const s=e[r];n.set(s,a),a+=s.length}return n}class rp{}function tl(e){const t=r=>e().update(el(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Fv(e=32){if(zs&&typeof zs.getRandomValues=="function")return zs.getRandomValues(new Uint8Array(e));if(zs&&typeof zs.randomBytes=="function")return Uint8Array.from(zs.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}function Uv(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const a=BigInt(32),s=BigInt(4294967295),o=Number(n>>a&s),i=Number(n&s),c=r?4:0,l=r?0:4;e.setUint32(t+c,o,r),e.setUint32(t+l,i,r)}function Dv(e,t,n){return e&t^~e&n}function _v(e,t,n){return e&t^e&n^t&n}class Q1 extends rp{constructor(t,n,r,a){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=a,this.buffer=new Uint8Array(t),this.view=np(this.buffer)}update(t){Rs(this),t=el(t),Xa(t);const{view:n,buffer:r,blockLen:a}=this,s=t.length;for(let o=0;o<s;){const i=Math.min(a-this.pos,s-o);if(i===a){const c=np(t);for(;a<=s-o;o+=a)this.process(c,o);continue}r.set(t.subarray(o,o+i),this.pos),this.pos+=i,o+=i,this.pos===a&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Rs(this),Z1(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:a,isLE:s}=this;let{pos:o}=this;n[o++]=128,da(this.buffer.subarray(o)),this.padOffset>a-o&&(this.process(r,0),o=0);for(let p=o;p<a;p++)n[p]=0;Uv(r,a-8,BigInt(this.length*8),s),this.process(r,0);const i=np(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=c/4,d=this.get();if(l>d.length)throw new Error("_sha2: outputLen bigger than state");for(let p=0;p<l;p++)i.setUint32(4*p,d[p],s)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:a,finished:s,destroyed:o,pos:i}=this;return t.destroyed=o,t.finished=s,t.length=a,t.pos=i,a%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}}const pa=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),$t=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),Ht=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),nl=BigInt(2**32-1),J1=BigInt(32);function Mv(e,t=!1){return t?{h:Number(e&nl),l:Number(e>>J1&nl)}:{h:Number(e>>J1&nl)|0,l:Number(e&nl)|0}}function eb(e,t=!1){const n=e.length;let r=new Uint32Array(n),a=new Uint32Array(n);for(let s=0;s<n;s++){const{h:o,l:i}=Mv(e[s],t);[r[s],a[s]]=[o,i]}return[r,a]}const tb=(e,t,n)=>e>>>n,nb=(e,t,n)=>e<<32-n|t>>>n,$s=(e,t,n)=>e>>>n|t<<32-n,Hs=(e,t,n)=>e<<32-n|t>>>n,rl=(e,t,n)=>e<<64-n|t>>>n-32,al=(e,t,n)=>e>>>n-32|t<<64-n,Nv=(e,t,n)=>e<<n|t>>>32-n,Lv=(e,t,n)=>t<<n|e>>>32-n,zv=(e,t,n)=>t<<n-32|e>>>64-n,Rv=(e,t,n)=>e<<n-32|t>>>64-n;function Fr(e,t,n,r){const a=(t>>>0)+(r>>>0);return{h:e+n+(a/2**32|0)|0,l:a|0}}const $v=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),Hv=(e,t,n,r)=>t+n+r+(e/2**32|0)|0,Gv=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),jv=(e,t,n,r,a)=>t+n+r+a+(e/2**32|0)|0,Vv=(e,t,n,r,a)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(a>>>0),Wv=(e,t,n,r,a,s)=>t+n+r+a+s+(e/2**32|0)|0,qv=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),fa=new Uint32Array(64);class Yv extends Q1{constructor(t=32){super(64,t,8,!1),this.A=pa[0]|0,this.B=pa[1]|0,this.C=pa[2]|0,this.D=pa[3]|0,this.E=pa[4]|0,this.F=pa[5]|0,this.G=pa[6]|0,this.H=pa[7]|0}get(){const{A:t,B:n,C:r,D:a,E:s,F:o,G:i,H:c}=this;return[t,n,r,a,s,o,i,c]}set(t,n,r,a,s,o,i,c){this.A=t|0,this.B=n|0,this.C=r|0,this.D=a|0,this.E=s|0,this.F=o|0,this.G=i|0,this.H=c|0}process(t,n){for(let p=0;p<16;p++,n+=4)fa[p]=t.getUint32(n,!1);for(let p=16;p<64;p++){const h=fa[p-15],y=fa[p-2],E=dr(h,7)^dr(h,18)^h>>>3,C=dr(y,17)^dr(y,19)^y>>>10;fa[p]=C+fa[p-7]+E+fa[p-16]|0}let{A:r,B:a,C:s,D:o,E:i,F:c,G:l,H:d}=this;for(let p=0;p<64;p++){const h=dr(i,6)^dr(i,11)^dr(i,25),y=d+h+Dv(i,c,l)+qv[p]+fa[p]|0,C=(dr(r,2)^dr(r,13)^dr(r,22))+_v(r,a,s)|0;d=l,l=c,c=i,i=o+y|0,o=s,s=a,a=r,r=y+C|0}r=r+this.A|0,a=a+this.B|0,s=s+this.C|0,o=o+this.D|0,i=i+this.E|0,c=c+this.F|0,l=l+this.G|0,d=d+this.H|0,this.set(r,a,s,o,i,c,l,d)}roundClean(){da(fa)}destroy(){this.set(0,0,0,0,0,0,0,0),da(this.buffer)}}const rb=eb(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),Kv=rb[0],Zv=rb[1],ma=new Uint32Array(80),ha=new Uint32Array(80);class ab extends Q1{constructor(t=64){super(128,t,16,!1),this.Ah=Ht[0]|0,this.Al=Ht[1]|0,this.Bh=Ht[2]|0,this.Bl=Ht[3]|0,this.Ch=Ht[4]|0,this.Cl=Ht[5]|0,this.Dh=Ht[6]|0,this.Dl=Ht[7]|0,this.Eh=Ht[8]|0,this.El=Ht[9]|0,this.Fh=Ht[10]|0,this.Fl=Ht[11]|0,this.Gh=Ht[12]|0,this.Gl=Ht[13]|0,this.Hh=Ht[14]|0,this.Hl=Ht[15]|0}get(){const{Ah:t,Al:n,Bh:r,Bl:a,Ch:s,Cl:o,Dh:i,Dl:c,Eh:l,El:d,Fh:p,Fl:h,Gh:y,Gl:E,Hh:C,Hl:I}=this;return[t,n,r,a,s,o,i,c,l,d,p,h,y,E,C,I]}set(t,n,r,a,s,o,i,c,l,d,p,h,y,E,C,I){this.Ah=t|0,this.Al=n|0,this.Bh=r|0,this.Bl=a|0,this.Ch=s|0,this.Cl=o|0,this.Dh=i|0,this.Dl=c|0,this.Eh=l|0,this.El=d|0,this.Fh=p|0,this.Fl=h|0,this.Gh=y|0,this.Gl=E|0,this.Hh=C|0,this.Hl=I|0}process(t,n){for(let U=0;U<16;U++,n+=4)ma[U]=t.getUint32(n),ha[U]=t.getUint32(n+=4);for(let U=16;U<80;U++){const O=ma[U-15]|0,M=ha[U-15]|0,L=$s(O,M,1)^$s(O,M,8)^tb(O,M,7),F=Hs(O,M,1)^Hs(O,M,8)^nb(O,M,7),u=ma[U-2]|0,f=ha[U-2]|0,b=$s(u,f,19)^rl(u,f,61)^tb(u,f,6),k=Hs(u,f,19)^al(u,f,61)^nb(u,f,6),x=Gv(F,k,ha[U-7],ha[U-16]),T=jv(x,L,b,ma[U-7],ma[U-16]);ma[U]=T|0,ha[U]=x|0}let{Ah:r,Al:a,Bh:s,Bl:o,Ch:i,Cl:c,Dh:l,Dl:d,Eh:p,El:h,Fh:y,Fl:E,Gh:C,Gl:I,Hh:P,Hl:v}=this;for(let U=0;U<80;U++){const O=$s(p,h,14)^$s(p,h,18)^rl(p,h,41),M=Hs(p,h,14)^Hs(p,h,18)^al(p,h,41),L=p&y^~p&C,F=h&E^~h&I,u=Vv(v,M,F,Zv[U],ha[U]),f=Wv(u,P,O,L,Kv[U],ma[U]),b=u|0,k=$s(r,a,28)^rl(r,a,34)^rl(r,a,39),x=Hs(r,a,28)^al(r,a,34)^al(r,a,39),T=r&s^r&i^s&i,B=a&o^a&c^o&c;P=C|0,v=I|0,C=y|0,I=E|0,y=p|0,E=h|0,{h:p,l:h}=Fr(l|0,d|0,f|0,b|0),l=i|0,d=c|0,i=s|0,c=o|0,s=r|0,o=a|0;const g=$v(b,x,B);r=Hv(g,f,k,T),a=g|0}({h:r,l:a}=Fr(this.Ah|0,this.Al|0,r|0,a|0)),{h:s,l:o}=Fr(this.Bh|0,this.Bl|0,s|0,o|0),{h:i,l:c}=Fr(this.Ch|0,this.Cl|0,i|0,c|0),{h:l,l:d}=Fr(this.Dh|0,this.Dl|0,l|0,d|0),{h:p,l:h}=Fr(this.Eh|0,this.El|0,p|0,h|0),{h:y,l:E}=Fr(this.Fh|0,this.Fl|0,y|0,E|0),{h:C,l:I}=Fr(this.Gh|0,this.Gl|0,C|0,I|0),{h:P,l:v}=Fr(this.Hh|0,this.Hl|0,P|0,v|0),this.set(r,a,s,o,i,c,l,d,p,h,y,E,C,I,P,v)}roundClean(){da(ma,ha)}destroy(){da(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class Xv extends ab{constructor(){super(48),this.Ah=$t[0]|0,this.Al=$t[1]|0,this.Bh=$t[2]|0,this.Bl=$t[3]|0,this.Ch=$t[4]|0,this.Cl=$t[5]|0,this.Dh=$t[6]|0,this.Dl=$t[7]|0,this.Eh=$t[8]|0,this.El=$t[9]|0,this.Fh=$t[10]|0,this.Fl=$t[11]|0,this.Gh=$t[12]|0,this.Gl=$t[13]|0,this.Hh=$t[14]|0,this.Hl=$t[15]|0}}const ap=tl(()=>new Yv),Qv=tl(()=>new ab),Jv=tl(()=>new Xv),sb=ap;function ob(e,t){const n=t||"hex",r=sb(Gn(e,{strict:!1})?Br(e):e);return n==="bytes"?r:_e(r)}function ek(e){const{commitment:t,version:n=1}=e,r=e.to??(typeof t=="string"?"hex":"bytes"),a=ob(t,"bytes");return a.set([n],0),r==="bytes"?a:Et(a)}function ib(e){const{commitments:t,version:n}=e,r=e.to??(typeof t[0]=="string"?"hex":"bytes"),a=[];for(const s of t)a.push(ek({commitment:s,to:r,version:n}));return a}const cb=6,lb=32,sp=4096,ub=lb*sp,db=ub*cb-1-1*sp*cb,pb=1;class tk extends G{constructor({maxSize:t,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${t} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class fb extends G{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}class nk extends G{constructor({hash:t,size:n}){super(`Versioned hash "${t}" size is invalid.`,{metaMessages:["Expected: 32",`Received: ${n}`],name:"InvalidVersionedHashSizeError"})}}class rk extends G{constructor({hash:t,version:n}){super(`Versioned hash "${t}" version is invalid.`,{metaMessages:[`Expected: ${pb}`,`Received: ${n}`],name:"InvalidVersionedHashVersionError"})}}function ak(e){const t=e.to??(typeof e.data=="string"?"hex":"bytes"),n=typeof e.data=="string"?pn(e.data):e.data,r=pt(n);if(!r)throw new fb;if(r>db)throw new tk({maxSize:db,size:r});const a=[];let s=!0,o=0;for(;s;){const i=Qd(new Uint8Array(ub));let c=0;for(;c<sp;){const l=n.slice(o,o+(lb-1));if(i.pushByte(0),i.pushBytes(l),l.length<31){i.pushByte(128),s=!1;break}c++,o+=31}a.push(i)}return t==="bytes"?a.map(i=>i.bytes):a.map(i=>Et(i.bytes))}function mb(e){const{data:t,kzg:n,to:r}=e,a=e.blobs??ak({data:t,to:r}),s=e.commitments??ep({blobs:a,kzg:n,to:r}),o=e.proofs??tp({blobs:a,commitments:s,kzg:n,to:r}),i=[];for(let c=0;c<a.length;c++)i.push({blob:a[c],commitment:s[c],proof:o[c]});return i}let St=class extends G{constructor({address:t}){super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}};class op extends G{constructor({blockNumber:t,chain:n,contract:r}){super(`Chain "${n.name}" does not support contract "${r.name}".`,{metaMessages:["This could be due to any of the following:",...t&&r.blockCreated&&r.blockCreated>t?[`- The contract "${r.name}" was not deployed until block ${r.blockCreated} (current block ${t}).`]:[`- The chain does not have the contract "${r.name}" configured.`]],name:"ChainDoesNotSupportContract"})}}class sk extends G{constructor({chain:t,currentChainId:n}){super(`The current chain of the wallet (id: ${n}) does not match the target chain for the transaction (id: ${t.id} – ${t.name}).`,{metaMessages:[`Current Chain ID: ${n}`,`Expected Chain ID: ${t.id} – ${t.name}`],name:"ChainMismatchError"})}}class ok extends G{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join(`
|
|
67
67
|
`),{name:"ChainNotFoundError"})}}class hb extends G{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}let Gs=class extends G{constructor({chainId:t}){super(typeof t=="number"?`Chain ID "${t}" is invalid.`:"Chain ID is invalid.",{name:"InvalidChainIdError"})}};class js extends G{constructor({cause:t,message:n}={}){var a;const r=(a=n==null?void 0:n.replace("execution reverted: ",""))==null?void 0:a.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:t,name:"ExecutionRevertedError"})}}Object.defineProperty(js,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(js,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted|gas required exceeds allowance/});let ba=class extends G{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${nn(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t,name:"FeeCapTooHighError"})}};Object.defineProperty(ba,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class ip extends G{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${nn(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}}Object.defineProperty(ip,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class cp extends G{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}is higher than the next one expected.`,{cause:t,name:"NonceTooHighError"})}}Object.defineProperty(cp,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class lp extends G{constructor({cause:t,nonce:n}={}){super([`Nonce provided for the transaction ${n?`(${n}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(`
|
|
@@ -123,4 +123,4 @@ re.version="2.30.1",pR(rt),re.fn=K,re.min=eH,re.max=tH,re.now=nH,re.utc=mr,re.un
|
|
|
123
123
|
Prefix can't start with '-' when allowNegative is true.
|
|
124
124
|
prefix: `+a+`
|
|
125
125
|
allowNegative: `+s+`
|
|
126
|
-
`),s=!1),Object.assign(Object.assign({},e),{allowNegative:s})}function Pj(e){e=Sj(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var t=e.suffix,n=e.allowNegative,r=e.allowLeadingZeros,a=e.onKeyDown;a===void 0&&(a=nm);var s=e.onBlur;s===void 0&&(s=nm);var o=e.thousandSeparator,i=e.decimalScale,c=e.fixedDecimalScale,l=e.prefix;l===void 0&&(l="");var d=e.defaultValue,p=e.value,h=e.valueIsNumericString,y=e.onValueChange,E=pj(e,["decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","suffix","allowNegative","allowLeadingZeros","onKeyDown","onBlur","thousandSeparator","decimalScale","fixedDecimalScale","prefix","defaultValue","value","valueIsNumericString","onValueChange"]),C=ju(e),I=C.decimalSeparator,P=C.allowedDecimalSeparators,v=function(w){return lx(w,e)},U=function(w,S){return Cj(w,S,e)},O=Co(p)?d:p,M=h??Tj(O,l,t);Co(p)?Co(d)||(M=M||typeof d=="number"):M=M||typeof p=="number";var L=function(w){return rx(w)?w:(typeof w=="number"&&(w=ix(w)),M&&typeof i=="number"?cx(w,i,!!c):w)},F=vj(L(p),L(d),!!M,v,U,y),u=F[0],f=u.numAsString,b=u.formattedValue,k=F[1],x=function(w){var S=w.target,A=w.key,D=S.selectionStart,R=S.selectionEnd,$=S.value;if($===void 0&&($=""),(A==="Backspace"||A==="Delete")&&R<l.length){w.preventDefault();return}if(D!==R){a(w);return}A==="Backspace"&&$[0]==="-"&&D===l.length+1&&n&&yc(S,1),i&&c&&(A==="Backspace"&&$[D-1]===I?(yc(S,D-1),w.preventDefault()):A==="Delete"&&$[D]===I&&w.preventDefault()),P!=null&&P.includes(A)&&$[D]===I&&yc(S,D+1);var j=o===!0?",":o;A==="Backspace"&&$[D-1]===j&&yc(S,D-1),A==="Delete"&&$[D]===j&&yc(S,D+1),a(w)},T=function(w){var S=f;if(S.match(/\d/g)||(S=""),r||(S=gj(S)),c&&i&&(S=cx(S,i,c)),S!==f){var A=lx(S,e);k({formattedValue:A,value:S,floatValue:parseFloat(S)},{event:w,source:tm.event})}s(w)},B=function(w){return w===I?!0:nx(w)},g=function(w){var S=w.currentValue,A=w.lastValue,D=w.formattedValue,R=w.currentValueIndex,$=w.formattedValueIndex,j=S[R],te=D[$],ce=xj(A,S),Y=ce.to,J=function(ye){return U(ye).indexOf(".")+l.length};return p===0&&c&&i&&S[Y.start]===I&&J(S)<R&&J(D)>$?!1:R>=Y.start&&R<Y.end&&P&&P.includes(j)&&te===I?!0:j===te};return Object.assign(Object.assign({},E),{value:b,valueIsNumericString:!1,isValidInputCharacter:B,isCharacterSame:g,onValueChange:k,format:v,removeFormatting:U,getCaretBoundary:function(w){return Aj(w,e)},onKeyDown:x,onBlur:T})}const Vu=(e,t)=>N.useMemo(()=>Rc(e,t),[e,t]),tr=(e,t)=>N.useMemo(()=>ir(e,t),[e,t]),gc=()=>{const{chainId:e}=de();return N.useMemo(()=>$a(e),[e])},am=e=>{const t=gc();return N.useMemo(()=>{if(!(!e||!t))return Yo(e,t.id)},[e,t])},ys=(e,t)=>N.useMemo(()=>!e||!t||he(e||"0").isZero()||he(t||"0").isZero()?"":he(e||"0").times(t).toFixed(),[e,t]),Ij=()=>{const{srcToken:e,dstToken:t,chainId:n}=de();return N.useMemo(()=>Vd(e,t,n),[e,t,n])},Bj=()=>{const{srcToken:e,dstToken:t,chainId:n}=de();return N.useMemo(()=>Wd(e,t,n),[e,t,n])},Oj=()=>{const e=Ij(),t=Bj();return e||t},sm=e=>{const{overrides:t}=de();return N.useMemo(()=>t!=null&&t.dateFormat?t.dateFormat(e||0):re(e).format("DD/MM/YYYY HH:mm"),[e,t==null?void 0:t.dateFormat])};function Fj(){const{callbacks:e}=de();return N.useCallback(async t=>{var n;try{await navigator.clipboard.writeText(t),(n=e==null?void 0:e.onCopy)==null||n.call(e)}catch(r){console.error("Copy failed:",r)}},[e==null?void 0:e.onCopy])}const Uj=(e,t)=>N.useMemo(()=>qo(e==null?void 0:e.toString(),t),[e,t]),Ve=({value:e,decimalScale:t=3,prefix:n,suffix:r})=>{var c;const a=Uj(e,t),{overrides:s}=de(),o=s==null?void 0:s.numberFormat,i=Pj({allowLeadingZeros:!0,thousandSeparator:",",displayType:"text",value:a||"",decimalScale:18,prefix:n,suffix:r});return o?o(e||""):(c=i.value)==null?void 0:c.toString()},Dj={deadlineTooltip:"This is the date and time marking the end of the period which you have selected for your order to be executed.",tradeSizeTooltip:"The number of input tokens that will be removed from your balance and swapped for the output token in each individual trade.",totalTradesTooltip:"The total number of individual trades that will be scheduled as part of your order. Note that in limit orders, not all trades that are scheduled will be executed.",minDstAmountTooltip:" This is the minimum number of tokens that may be received. NOTE: This minimum only refers to executed trades. Some trades may not be executed if the limit price is higher than the available market prices and your order may only be partially filled.",marketPriceTooltip:"You have the option to set a “limit price” for your order. If you do not select this option, each trade in your order will execute at the available market price.",limitPriceTooltip:"Trades will only execute if the available market price is better than the limit price, potentially resulting in partial fills or orders remaining unfilled upon expiration.",outAmountLoading:"Fetching Quote...",maxDurationTooltip:"This is the time period during which the order will be active. Please note that orders may be completed earlier than this time, partially filled, or remain unfilled based on the specified parameters.",tradeIntervalTootlip:"The estimated time that will elapse between each trade in your order. Note that as this time includes an allowance of two minutes for bidder auction and block settlement, which cannot be predicted exactly, actual time may vary.",triggerPriceTooltip:"The price at which the order will be executed. If the market price is higher than the trigger price, the order will be executed at the market price.",placeOrder:"Place order",enterAmount:"Enter an amount",emptyLimitPrice:"Limit price is required",insufficientFunds:"Insufficient Balance",every:"Every",over:"Over",tradeInterval:"Trade interval",deadline:"Deadline",limitPrice:"Limit Price",finalExcecutionPrice:"Final execution price",marketPrice:"Market price",from:"From",to:"To (estimated)",Open:"Open",Completed:"Completed",Expired:"Expired",Canceled:"Canceled",minReceivedPerTrade:"Min. received per trade",triggerPricePerChunk:"Trigger Price per trade",maxChunksError:"Max. trades amount is {maxChunks}",minChunksError:"Min. trades amount is",minTradeSizeError:"Min. trade size is ${minTradeSize}",allOrders:"All",minFillDelayError:"Min. trade interval is {fillDelay}",maxFillDelayError:"Max. trade interval is {fillDelay}",recipient:"Recipient",marketOrderWarning:"Each individual trade in this order will be filled at the current market price at the time of execution.",limitPriceMessage:"Limit orders may not execute when the token's price is equal or close to the limit price, due to gas and standard swap fees.",limit:"Limit",maxDurationError:"Max. expiry is {duration}",minDurationError:"Min. expiry is {duration}",expiry:"Expiry",individualTradeSize:"Individual trade size",numberOfTrades:"No. of trades",AverageExecutionPrice:"Avg. execution price",twapMarket:"TWAP-market",twapLimit:"TWAP-limit",stopLoss:"Stop-loss",triggerPriceMarket:"Trigger Market Price ",triggerPriceLimit:"Trigger Limit Price ",takeProfit:"Take-profit",minReceived:"Min. received",minReceivedPerChunk:"Min. received per trade",noOrders:"No {status} Orders",noLiquidity:"No liquidity for this pair",excecutionSummary:"Execution summary",orderInfo:"Order info",wrapAction:"Wrap {symbol}",approveAction:"Approve {symbol}",createOrderAction:"Create {name} order",amountReceived:"Amount received",createdAt:"Created at",amountOut:"Amount out",status:"Status",progress:"Progress",minutes:"minutes",days:"days",tradeIntervalTitle:"Every",tradesAmountTitle:"Over",stopLossTooltip:"The trigger price at which your stop-loss order will be activated.",takeProfitTooltip:"The trigger price at which your take-profit order will be activated.",stopLossLabel:"Trigger Price",StopLossTriggerPriceError:"Trigger price must be less than market price",TakeProfitTriggerPriceError:"Trigger price must be greater than market price",triggerLimitPriceError:"Limit price must be less than trigger price",triggerPrice:"Trigger Price",tradePrice:"Trade Price",triggerMarketPriceDisclaimer:" In extreme market movements, slippage may occur and the executed price of the market order may be worse than the specified trigger price.",stopLossLimitPriceTooltip:"The stop loss order will execute at the specified limit price or better, once the stop price is triggered.",stopLossDurationTooltip:"This is the time period during which the order will be active. Please note that orders may be completed earlier than this time, or remain unfilled based on the specified parameters.",emptyTriggerPrice:"Trigger price is required",id:"ID",fees:"Fees {value}",version:"Version",maxOrderSizeError:"Max. trade size is {maxOrderSize} USD",viewOnExplorer:"View on explorer",proceedInWallet:"Proceed in wallet",wrapMsg:"Note: {symbol} was wrapped to {wSymbol}",createOrderActionSuccess:"{name} order placed"};function _j(e){let t=e;const n=/\{[^{}]*\}/g;for(;n.test(t);)t=t.replace(n,"");return t}const ze=()=>{const e=de();return N.useCallback((n,r)=>{var o,i;const a=(o=e.getTranslation)==null?void 0:o.call(e,n,r);if(a&&a!==n)return a;const s=((i=e.translations)==null?void 0:i[n])||Dj[n];return _j(s.replace(/{(\w+)}/g,(c,l)=>(r==null?void 0:r[l])||c))},[e.getTranslation,e.translations])},Wu=({value:e})=>{const t=Ve({value:e,decimalScale:2});return t?_.jsx("small",{className:"twap-order-details__detail-row-value-usd",children:` ($${t})`}):null},Mj=({deadline:e,label:t,tooltip:n})=>{const r=sm(e);return _.jsx(vn,{title:t,tooltip:n,children:r})},Nj=({price:e,dstToken:t,label:n,tooltip:r,usd:a})=>{const s=Ve({value:e});return he(e||0).isZero()?null:_.jsx(vn,{title:n,tooltip:r,children:_.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[`${s||"-"} ${t==null?void 0:t.symbol}`,_.jsx(Wu,{value:a})]})})},Lj=({price:e,dstToken:t,percentage:n,isMarketOrder:r})=>{const a=Ve({value:e}),s=ze();return r?null:_.jsx(vn,{title:s("limitPrice")||"",tooltip:s("limitPriceTooltip")||"",children:_.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[`${a||"-"} ${t==null?void 0:t.symbol}`,n&&_.jsx("small",{children:`(${n}%)`})]})})},zj=({tradeSize:e,srcToken:t,trades:n,label:r,tooltip:a})=>n===1?null:_.jsx(vn,{title:r,tooltip:a,children:`${e||"-"} ${(t==null?void 0:t.symbol)||""}`}),Rj=({dstToken:e,dstMinAmountOut:t,label:n,tooltip:r,usd:a})=>{const s=Ve({value:t});return he(t||0).isZero()?null:_.jsxs(vn,{title:n,tooltip:r,children:[`${t?s:"-"} ${e==null?void 0:e.symbol}`,_.jsx(Wu,{value:a})]})},$j=({trades:e,label:t,tooltip:n})=>e===1?null:_.jsx(vn,{title:t,tooltip:n,children:e}),Hj=()=>{var a;const e=ze(),{account:t}=de(),n=(a=gc())==null?void 0:a.explorer,r=Hd(t);return _.jsx(vn,{title:e("recipient")||"",children:n?_.jsx("a",{href:`${n}/address/${t}`,target:"_blank",children:r}):r})},Gj=({fillDelayMillis:e,chunks:t=0,label:n,tooltip:r})=>{const a=N.useMemo(()=>C1(e),[e]);return t===1?null:_.jsx(vn,{title:n,tooltip:r,children:a})},vn=({title:e,tooltip:t,children:n,className:r="",onClick:a,style:s})=>{const{components:o}=de(),i=o.Tooltip;return _.jsxs("div",{className:`${r} twap-order-details__detail-row`,onClick:a,style:s,children:[_.jsxs("div",{className:"twap-order-details__detail-row-label",children:[_.jsx("p",{className:"twap-order-details__detail-row-label-value",children:e}),t&&i&&_.jsx(i,{tooltipText:t})]}),_.jsx("div",{className:"twap-order-details__detail-row-value",children:n})]})},jj=({id:e})=>{const{components:t}=de(),n=t==null?void 0:t.Tooltip,r=Fj();return e.startsWith("0x")?_.jsx(vn,{title:"ID",onClick:()=>r(e),style:{cursor:"pointer"},children:n&&_.jsx(n,{tooltipText:e,children:_.jsxs("div",{className:"twap-order-details__detail-row-value-id",children:[_.jsx("p",{children:Hd(e)}),_.jsx(dR.AiOutlineCopy,{})]})})}):_.jsx(vn,{title:"ID",children:e})},Vj=({version:e})=>_.jsx(vn,{title:"Version",children:e});function Ce({children:e,className:t=""}){return _.jsx("div",{className:`${t} twap-order-details`,children:e})}const Wj=({children:e})=>e,qj=({fees:e,label:t,usd:n,dstTokenSymbol:r})=>{const a=Ve({value:e});return _.jsxs(vn,{title:t,children:[`${e?a:"-"} ${r}`,_.jsx(Wu,{value:n})]})};Ce.Deadline=Mj,Ce.Fees=qj,Ce.TradeSize=zj,Ce.MinDestAmount=Rj,Ce.TradesAmount=$j,Ce.Recipient=Hj,Ce.TradeInterval=Gj,Ce.DetailRow=vn,Ce.TriggerPrice=Nj,Ce.LimitPrice=Lj,Ce.OrderID=jj,Ce.Container=Wj,Ce.OrderVersion=Vj,Ce.USD=Wu;const om=()=>{const{publicClient:e}=de();return Pr({mutationFn:async t=>{if(!e)throw new Error("publicClient is not defined");const n=10;let r=0,a=1e3;for(;r<n;)try{return await e.waitForTransactionReceipt({hash:t,confirmations:2,retryDelay:a})}catch(s){if(r++,r>=n)throw new Error(`Failed after ${n} attempts: ${s}`);await new Promise(o=>setTimeout(o,a)),a*=2}}}).mutateAsync},ux=e=>{var c,l,d,p,h;const t=ze(),n=Ve({value:tr((c=e.srcToken)==null?void 0:c.decimals,e.srcAmount)}),r=Ve({value:tr((l=e.srcToken)==null?void 0:l.decimals,e.srcAmountPerTrade)}),a=Ve({value:tr((d=e.dstToken)==null?void 0:d.decimals,e.minDestAmountPerTrade&&he(e.minDestAmountPerTrade).lte(1)?"":e.minDestAmountPerTrade)}),s=Ve({value:tr((p=e.dstToken)==null?void 0:p.decimals,e.triggerPricePerTrade)}),o=Vu((h=e.dstToken)==null?void 0:h.decimals,e.limitPrice),i=Ve({value:e.limitPrice});return N.useMemo(()=>({data:{srcToken:e.srcToken,dstToken:e.dstToken,limitPrice:o,deadline:e.deadline,srcAmount:e.srcAmount,srcAmountPerTrade:e.srcAmountPerTrade,totalTrades:e.totalTrades,minDestAmountPerTrade:e.minDestAmountPerTrade,tradeInterval:e.tradeInterval,triggerPricePerTrade:e.triggerPricePerTrade,maker:e.maker},display:{limitPrice:{label:t("limitPrice"),value:i||""},deadline:{tooltip:t("deadlineTooltip"),label:t("deadline"),value:e.deadline||0},srcAmount:{label:t("amountOut"),value:n||"",token:e.srcToken},tradeSize:{tooltip:t("tradeSizeTooltip"),label:t("individualTradeSize"),value:r||"",token:e.srcToken},totalTrades:{tooltip:t("totalTradesTooltip"),label:t("numberOfTrades"),value:e.totalTrades||0},minDestAmountPerTrade:{tooltip:t("minDstAmountTooltip"),label:e.totalTrades&&e.totalTrades>1?t("minReceivedPerTrade"):t("minReceived"),value:a||"",token:e.dstToken},tradeInterval:{tooltip:t("tradeIntervalTootlip"),label:t("tradeInterval"),value:e.tradeInterval||0},triggerPricePerTrade:{tooltip:t("triggerPriceTooltip"),label:e.totalTrades&&e.totalTrades>1?t("triggerPricePerChunk"):t("triggerPrice"),value:s||"",token:e.dstToken},recipient:{label:t("recipient"),value:e.maker||""}}}),[e,t,n,r,a,s,i])},dx=e=>{const{orders:t}=qu(),{config:n,useToken:r}=de(),a=ze(),s=N.useMemo(()=>t==null?void 0:t.all.find(C=>C.id===e),[t,e])||{},o=px(s),i=r==null?void 0:r(s==null?void 0:s.srcTokenAddress),c=r==null?void 0:r(s==null?void 0:s.dstTokenAddress),l=Qj(i,c,s),d=Ve({value:Jj(i,c,s)}),p=Ve({value:tr(i==null?void 0:i.decimals,s==null?void 0:s.srcAmountFilled)}),h=Ve({value:tr(c==null?void 0:c.decimals,s==null?void 0:s.dstAmountFilled)}),y=Ve({value:s==null?void 0:s.progress,decimalScale:2}),E=ux({srcToken:i,dstToken:c,limitPrice:l,deadline:s==null?void 0:s.deadline,srcAmount:s==null?void 0:s.srcAmount,srcAmountPerTrade:s==null?void 0:s.srcAmountPerTrade,totalTrades:s==null?void 0:s.totalTradesAmount,minDestAmountPerTrade:s==null?void 0:s.dstMinAmountPerTrade,tradeInterval:(s==null?void 0:s.totalTradesAmount)===1||!s||!(n!=null&&n.twapConfig)?void 0:hd(s,n.twapConfig),triggerPricePerTrade:s==null?void 0:s.triggerPricePerTrade,maker:s==null?void 0:s.maker});return N.useMemo(()=>({original:s,...E,title:o,createdAt:{label:a("createdAt"),value:s==null?void 0:s.createdAt},id:{label:a("id"),value:s==null?void 0:s.id},amountInFilled:{label:a("amountOut"),value:p,token:i},amountOutFilled:{label:a("amountReceived"),value:h,token:c},progress:{label:a("progress"),value:y},excecutionPrice:{label:(s==null?void 0:s.totalTradesAmount)===1?a("finalExcecutionPrice"):a("AverageExecutionPrice"),value:d,sellToken:i,buyToken:c},version:{label:a("version"),value:s==null?void 0:s.version}}),[s,a,d,p,h,y,o,i,c,E])},px=e=>{const t=ze();return N.useMemo(()=>e?e.type===ft.TRIGGER_PRICE_MARKET?t("triggerPriceMarket"):e.type===ft.TRIGGER_PRICE_LIMIT?t("triggerPriceLimit"):e.type===ft.TWAP_MARKET?t("twapMarket"):e.type===ft.TWAP_LIMIT?t("twapLimit"):t("twapMarket"):t("twapMarket"),[t,e==null?void 0:e.type])},im=()=>{const{account:e,config:t,chainId:n}=de();return N.useMemo(()=>["useTwapOrderHistoryManager",e,t==null?void 0:t.partner,n],[e,t,n])},fx=()=>{const{account:e,config:t,chainId:n}=de(),r=`cancelled-orders-${e}-${t==null?void 0:t.partner}-${n}`,a=N.useCallback(()=>{const i=localStorage.getItem(r);return i?JSON.parse(i):[]},[r]),s=N.useCallback(i=>{const c=a();c.includes(i)||(c.push(i),localStorage.setItem(r,JSON.stringify(c)))},[a,r]),o=N.useCallback(i=>{const c=a().filter(l=>l!==i);localStorage.setItem(r,JSON.stringify(c))},[a,r]);return{getCancelledOrderIds:a,addCancelledOrderId:s,deleteCancelledOrderId:o}},Yj=()=>{const e=Vo(),{account:t}=de(),n=im();return N.useCallback(r=>{e.setQueryData(n,a=>a?a!=null&&a.some(s=>s.id===r.id)?a:[r,...a]:[r])},[e,n,t])},Kj=()=>{const e=Vo(),t=im(),n=fx();return N.useCallback(r=>{r.forEach(a=>{n.addCancelledOrderId(a)}),e.setQueryData(t,a=>a?a.map(s=>r.includes(s.id)?{...s,status:tt.Canceled}:s):[])},[e,t,n.addCancelledOrderId])},Zj=()=>{const{getCancelledOrderIds:e,deleteCancelledOrderId:t}=fx();return N.useCallback(n=>{const r=new Set(e());n.forEach((a,s)=>{r.has(a.id)&&(a.status!==tt.Canceled?(console.log(`Marking order as cancelled: ${a.id}`),n[s]={...a,status:tt.Canceled}):(console.log(`Removing cancelled ID for already-cancelled order: ${a.id}`),t(a.id)))})},[e,t])},Xj=()=>{const{account:e,config:t,chainId:n,callbacks:r,refetchBalances:a}=de(),s=im(),o=Vo(),i=Zj(),c=g8({enabled:!!(e&&n&&t),refetchInterval:tR,refetchOnWindowFocus:!0,retry:!1,staleTime:1/0,queryKey:s,queryFn:async({signal:l})=>{var E;const d=await Vh({signal:l,chainId:n,config:t==null?void 0:t.twapConfig,account:e});i(d);let p=!1;const h=o.getQueryData(s),y=[];return h&&h.forEach(C=>{var P;const I=d.find(v=>v.id===C.id);I&&I.progress!==C.progress&&(p=!0,y.push(I),I.status===tt.Completed&&((P=r==null?void 0:r.onOrderFilled)==null||P.call(r,I)))}),p&&((E=r==null?void 0:r.onOrdersProgressUpdate)==null||E.call(r,y),a==null||a()),d.map(C=>t!=null&&t.twapConfig?{...C,fillDelayMillis:hd(C,t.twapConfig)}:C)}});return{...c,isLoading:!!(e&&c.isLoading)}},qu=()=>{const{data:e,isLoading:t,error:n,refetch:r,isRefetching:a}=Xj(),{mutateAsync:s}=cm();return N.useMemo(()=>({orders:{all:e??[],open:Yu(e??[],tt.Open),completed:Yu(e??[],tt.Completed),expired:Yu(e??[],tt.Expired),canceled:Yu(e??[],tt.Canceled)},isLoading:t,error:n,refetch:()=>r().then(o=>o.data),cancelOrder:s,isRefetching:a}),[e,t,n,r,s,a])},mx=()=>{const e=Q(n=>n.state.orderHistoryStatusFilter),{orders:t}=qu();return N.useMemo(()=>e?t.all.filter(n=>n.status.toLowerCase()===e.toLowerCase())||[]:t.all,[e,t])},Yu=(e,t)=>e.filter(n=>n.status===t).sort((n,r)=>r.createdAt-n.createdAt),Qj=(e,t,n)=>N.useMemo(()=>{if(!(!e||!t||!n||n!=null&&n.isMarketPrice))return S1(n,e==null?void 0:e.decimals,t==null?void 0:t.decimals)},[n,e,t]),Jj=(e,t,n)=>N.useMemo(()=>{if(!(!e||!t||!n))return A1(n,e.decimals,t.decimals)},[n,e,t]),hx=()=>{const e=Q(n=>n.updateState),t=Q(n=>n.state.orderIdsToCancel);return N.useCallback(n=>{t!=null&&t.includes(n)?e({orderIdsToCancel:t==null?void 0:t.filter(r=>r!==n)}):e({orderIdsToCancel:[...t||[],n]})},[e,t])},eV=()=>{var F,u;const e=ze(),{orders:t,isLoading:n,refetch:r,isRefetching:a}=qu(),{mutateAsync:s,isPending:o}=cm(),i=mx(),c=Q(f=>f.updateState),l=Q(f=>f.state.orderHistoryStatusFilter),d=Q(f=>f.state.cancelOrdersMode),p=Q(f=>f.state.orderIdsToCancel),h=N.useCallback(f=>c({cancelOrdersMode:f,orderIdsToCancel:[]}),[c]),y=N.useCallback(()=>c({selectedOrderID:void 0}),[c]),E=N.useCallback(f=>s({orders:f}),[s]),C=N.useCallback(f=>c({orderHistoryStatusFilter:f}),[]),I=N.useMemo(()=>{const f=Object.keys(tt).map(b=>({text:b,value:b}));return[{text:e("allOrders"),value:""},...f]},[e]),P=hx(),v=Q(f=>f.state.selectedOrderID),U=dx(v),O=N.useMemo(()=>t.all.filter(f=>p==null?void 0:p.includes(f.id)),[t,p]),M=N.useCallback(()=>c({orderIdsToCancel:t.open.map(f=>f.id)}),[c,t]),L=N.useCallback(f=>s({orders:[f]}).then(b=>(b==null?void 0:b[0])||""),[s]);return{refetch:r,onHideSelectedOrder:y,onCancelOrders:E,onCancelOrder:L,onSelectStatus:C,onToggleCancelOrdersMode:h,onSelectOrder:P,isRefetching:a,orders:t,ordersToDisplay:i,isLoading:n,selectedOrder:v?U:void 0,openOrdersCount:((F=t==null?void 0:t.open)==null?void 0:F.length)||0,isCancelOrdersLoading:o,selectedStatus:l||((u=I[0])==null?void 0:u.value)||"",statuses:I,cancelOrdersMode:d,ordersToCancel:O,onSelectAllOrdersToCancel:M}},cm=()=>{const{account:e,walletClient:t,publicClient:n,config:r,callbacks:a,chainId:s}=de(),o=om(),i=Q(p=>p.updateState),c=Kj(),l=async p=>{mt.onCancelOrderRequest(p.map(h=>h.id.toString()),1);try{return(await Promise.all(p.map(y=>t.writeContract({account:e,address:y.twapAddress,abi:Qm,functionName:"cancel",args:[y.id],chain:t.chain}))))[0]}catch(h){throw mt.onCancelOrderError(h),h}},d=async p=>{var h;try{mt.onCancelOrderRequest(p.map(C=>C.hash),2);const y=await t.writeContract({account:e,address:r.repermit,abi:Zm,functionName:"cancel",args:[p.map(C=>C.hash)],chain:t.chain}),E=await o(y);if(!E)throw new Error("failed to get transaction receipt");if(E.status==="reverted")throw new Error("failed to cancel order");return mt.onCancelOrderSuccess(y),(h=a==null?void 0:a.onCancelOrderSuccess)==null||h.call(a,{orders:p,txHash:y,explorerUrl:Yo(y,s)}),E.transactionHash}catch(y){throw mt.onCancelOrderError(y),y}};return Pr({mutationFn:async({orders:p})=>{var h,y;if(!e||!t||!n||!r)throw new Error("missing required parameters");try{(h=a==null?void 0:a.onCancelOrderRequest)==null||h.call(a,p),i({cancelOrderStatus:At.LOADING,cancelOrderTxHash:void 0,cancelOrderError:void 0});const E=p.filter(v=>v.version===1),C=p.filter(v=>v.version===2),[I,P]=await Promise.all([E.length?l(E):Promise.resolve(""),C.length?d(C):Promise.resolve("")]);return i({cancelOrderStatus:At.SUCCESS,orderIdsToCancel:[]}),c(p.map(v=>v.id)),[...I||[],P]}catch(E){console.error("cancel order error",E),(y=a==null?void 0:a.onCancelOrderFailed)==null||y.call(a,E.message),Gd(E)?i({cancelOrderStatus:void 0}):(i({cancelOrderStatus:At.FAILED}),mt.onCancelOrderError(E))}}})},bx=N.createContext({}),jt=()=>N.useContext(bx),tV=()=>{const e=Q(c=>c.state.selectedOrderID),t=dx(e),n=ze(),[r,a]=N.useState("panel1"),{components:s}=de(),o=s.TokenLogo;N.useEffect(()=>{a("panel1")},[t.id.value]);const i=c=>{a(r===c?!1:c)};return t?_.jsx(bx.Provider,{value:{order:t},children:_.jsxs("div",{className:"twap-orders__selected-order",children:[_.jsx(T1,{SrcTokenLogo:o&&_.jsx(o,{token:t.data.srcToken}),DstTokenLogo:o&&_.jsx(o,{token:t.data.dstToken}),fromTitle:n("from"),inToken:t.data.srcToken,toTitle:n("to"),outToken:t.data.dstToken}),_.jsx(Ce.Container,{children:_.jsxs("div",{className:"twap-orders__selected-order-bottom",children:[_.jsxs("div",{className:"twap-orders__selected-order-accordions",children:[_.jsx(yx,{title:n("excecutionSummary"),onClick:()=>i("panel1"),expanded:r==="panel1",children:_.jsx(uV,{})}),_.jsx(yx,{title:n("orderInfo"),expanded:r==="panel2",onClick:()=>i("panel2"),children:_.jsx(nV,{})})]}),_.jsx(pV,{})]})})]})}):null},yx=({expanded:e,onClick:t,children:n,title:r})=>_.jsxs("div",{className:"twap-orders__selected-order-accordion",children:[_.jsxs("div",{onClick:t,className:"twap-orders__selected-order-accordion-trigger",children:[_.jsx("p",{children:r}),_.jsx(lR.IoIosArrowDown,{style:{transform:e?"rotate(180deg)":"rotate(0deg)"}})]}),e&&_.jsx("div",{className:"twap-orders__selected-order-accordion-details",children:n})]}),nV=()=>_.jsxs(Ce,{children:[_.jsx(lV,{}),_.jsx(fV,{}),_.jsx(oV,{}),_.jsx(mV,{}),_.jsx(rV,{}),_.jsx(aV,{}),_.jsx(sV,{}),_.jsx(iV,{}),_.jsx(cV,{}),_.jsx(xV,{}),_.jsx(Ce.Recipient,{})]}),rV=()=>{const{order:e}=jt();return _.jsx(Ce.TradeSize,{tradeSize:e.display.tradeSize.value,srcToken:e.data.srcToken,label:e.display.tradeSize.label,tooltip:e.display.tradeSize.tooltip,trades:e.display.totalTrades.value})},aV=()=>{const{order:e}=jt();return _.jsx(Ce.TradesAmount,{trades:e.display.totalTrades.value,label:e.display.totalTrades.label,tooltip:e.display.totalTrades.tooltip})},sV=()=>{const{order:e}=jt();return _.jsx(Ce.MinDestAmount,{dstToken:e.data.dstToken,dstMinAmountOut:e.display.minDestAmountPerTrade.value,label:e.display.minDestAmountPerTrade.label,tooltip:e.display.minDestAmountPerTrade.tooltip})},oV=()=>{const{order:e}=jt();return _.jsx(Ce.Deadline,{deadline:e.display.deadline.value,label:e.display.deadline.label,tooltip:e.display.deadline.tooltip})},iV=()=>{const{order:e}=jt();return _.jsx(Ce.TradeInterval,{fillDelayMillis:e.display.tradeInterval.value,chunks:e.display.totalTrades.value,label:e.display.tradeInterval.label,tooltip:e.display.tradeInterval.tooltip})},cV=()=>{const{order:e}=jt();return _.jsx(Ce.TriggerPrice,{dstToken:e.data.dstToken,price:e.display.triggerPricePerTrade.value,label:e.display.triggerPricePerTrade.label,tooltip:e.display.triggerPricePerTrade.tooltip})},lV=()=>{const{order:e}=jt();return _.jsx(Ce.OrderID,{id:e.id.value||""})},uV=()=>_.jsxs(Ce,{children:[_.jsx(yV,{}),_.jsx(hV,{}),_.jsx(dV,{}),_.jsx(gV,{}),_.jsx(wV,{})]}),dV=()=>{var n;const{order:e}=jt(),t=Ve({value:e.amountOutFilled.value,decimalScale:3});return e.amountOutFilled.value?_.jsx(Ce.DetailRow,{title:e.amountOutFilled.label,children:_.jsxs("p",{children:[t||"-"," ",(n=e.data.dstToken)==null?void 0:n.symbol]})}):null},pV=()=>{const{order:e}=jt(),{mutateAsync:t,isPending:n}=cm(),{components:r}=de(),a=r.Button,s=N.useCallback(async()=>{},[t,e]);return!e||e.original.status!==tt.Open||!a?null:_.jsx(a,{loading:n,onClick:s,disabled:n,className:"twap-cancel-order",children:"Cancel"})},fV=()=>{const{order:e}=jt(),t=ze(),n=sm(e.createdAt.value);return _.jsx(Ce.DetailRow,{title:t("createdAt")||"",children:_.jsx("p",{children:n})})},mV=()=>{var r;const{order:e}=jt(),t=ze(),n=Ve({value:e.display.srcAmount.value,decimalScale:3});return _.jsx(Ce.DetailRow,{title:t("amountOut")||"",children:_.jsxs("p",{children:[n||0," ",(r=e.data.srcToken)==null?void 0:r.symbol]})})},hV=()=>{var n;const{order:e}=jt(),t=Ve({value:e.amountInFilled.value,decimalScale:3});return _.jsx(Ce.DetailRow,{title:e.amountInFilled.label,children:_.jsxs("p",{children:[t||"-"," ",(n=e.data.srcToken)==null?void 0:n.symbol]})})},bV=()=>{const{order:e}=jt(),t=ze();return N.useMemo(()=>{switch(e.original.status){case tt.Open:return t("Open")||"";case tt.Completed:return t("Completed")||"";case tt.Expired:return t("Expired")||"";case tt.Canceled:return t("Canceled")||""}},[e.original.status,t])},yV=()=>{const e=ze(),t=bV();return _.jsx(Ce.DetailRow,{title:e("status")||"",children:_.jsx("p",{children:t})})},gV=()=>{const{order:e}=jt(),t=Ve({value:e.progress.value,decimalScale:2});return _.jsx(Ce.DetailRow,{title:e.progress.label,children:_.jsxs("p",{children:[t||0,"%"]})})},xV=()=>{const{order:e}=jt(),t=ze();return e.display.limitPrice.value?_.jsx(gx,{title:t("limitPrice")||"",price:e.display.limitPrice.value,srcToken:e.data.srcToken,dstToken:e.data.dstToken}):null},wV=()=>{const{order:e}=jt();return e.excecutionPrice.value?_.jsx(gx,{title:e.excecutionPrice.label,price:e.excecutionPrice.value,srcToken:e.data.srcToken,dstToken:e.data.dstToken}):null},gx=({price:e,srcToken:t,dstToken:n,title:r})=>{const a=Ve({value:e,decimalScale:3});return _.jsx(Ce.DetailRow,{title:r,children:he(e||0).isZero()?_.jsx("p",{children:"-"}):_.jsxs("p",{children:["1 ",t==null?void 0:t.symbol," = ",a," ",n==null?void 0:n.symbol]})})};var lm={},xx;function vV(){if(xx)return lm;xx=1;var e=ku.GenIcon;return lm.HiArrowRight=function(n){return e({tag:"svg",attr:{viewBox:"0 0 20 20",fill:"currentColor"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M10.293 3.293a1 1 0 011.414 0l6 6a1 1 0 010 1.414l-6 6a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-4.293-4.293a1 1 0 010-1.414z",clipRule:"evenodd"}}]})(n)},lm}var kV=vV();const Ku=0,Ca=1,Ao=2,wx=4;function vx(e){return()=>e}function EV(e){e()}function kx(e,t){return n=>e(t(n))}function Ex(e,t){return()=>e(t)}function TV(e,t){return n=>e(t,n)}function um(e){return e!==void 0}function CV(...e){return()=>{e.map(EV)}}function So(){}function Zu(e,t){return t(e),e}function AV(e,t){return t(e)}function at(...e){return e}function We(e,t){return e(Ca,t)}function Ie(e,t){e(Ku,t)}function dm(e){e(Ao)}function ct(e){return e(wx)}function pe(e,t){return We(e,TV(t,Ku))}function nr(e,t){const n=e(Ca,r=>{n(),t(r)});return n}function Tx(e){let t,n;return r=>a=>{t=a,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function Cx(e,t){return e===t}function st(e=Cx){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function xe(e){return t=>n=>{e(n)&&t(n)}}function se(e){return t=>kx(t,e)}function gr(e){return t=>()=>{t(e)}}function W(e,...t){const n=SV(...t);return(r,a)=>{switch(r){case Ao:dm(e);return;case Ca:return We(e,n(a))}}}function xr(e,t){return n=>r=>{n(t=e(t,r))}}function gs(e){return t=>n=>{e>0?e--:t(n)}}function Qr(e){let t=null,n;return r=>a=>{t=a,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function Be(...e){const t=new Array(e.length);let n=0,r=null;const a=Math.pow(2,e.length)-1;return e.forEach((s,o)=>{const i=Math.pow(2,o);We(s,c=>{const l=n;n=n|i,t[o]=c,l!==a&&n===a&&r&&(r(),r=null)})}),s=>o=>{const i=()=>{s([o].concat(t))};n===a?i():r=i}}function SV(...e){return t=>e.reduceRight(AV,t)}function PV(e){let t,n;const r=()=>t==null?void 0:t();return function(a,s){switch(a){case Ca:return s?n===s?void 0:(r(),n=s,t=We(e,s),t):(r(),So);case Ao:r(),n=null;return}}}function Z(e){let t=e;const n=Me();return(r,a)=>{switch(r){case Ku:t=a;break;case Ca:{a(t);break}case wx:return t}return n(r,a)}}function Vt(e,t){return Zu(Z(t),n=>pe(e,n))}function Me(){const e=[];return(t,n)=>{switch(t){case Ku:e.slice().forEach(r=>{r(n)});return;case Ao:e.splice(0,e.length);return;case Ca:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)}}}}function kn(e){return Zu(Me(),t=>pe(e,t))}function je(e,t=[],{singleton:n}={singleton:!0}){return{constructor:e,dependencies:t,id:IV(),singleton:n}}const IV=()=>Symbol();function BV(e){const t=new Map,n=({constructor:r,dependencies:a,id:s,singleton:o})=>{if(o&&t.has(s))return t.get(s);const i=r(a.map(c=>n(c)));return o&&t.set(s,i),i};return n(e)}function Tt(...e){const t=Me(),n=new Array(e.length);let r=0;const a=Math.pow(2,e.length)-1;return e.forEach((s,o)=>{const i=Math.pow(2,o);We(s,c=>{n[o]=c,r=r|i,r===a&&Ie(t,n)})}),function(s,o){switch(s){case Ao:{dm(t);return}case Ca:return r===a&&o(n),We(t,o)}}}function we(e,t=Cx){return W(e,st(t))}function pm(...e){return function(t,n){switch(t){case Ao:return;case Ca:return CV(...e.map(r=>We(r,n)))}}}var ln=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(ln||{});const OV={0:"debug",3:"error",1:"log",2:"warn"},FV=()=>typeof globalThis>"u"?window:globalThis,Aa=je(()=>{const e=Z(3);return{log:Z((t,n,r=1)=>{var a;const s=(a=FV().VIRTUOSO_LOG_LEVEL)!=null?a:ct(e);r>=s&&console[OV[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,n)}),logLevel:e}},[],{singleton:!0});function xs(e,t,n){return fm(e,t,n).callbackRef}function fm(e,t,n){const r=N.useRef(null);let a=o=>{};const s=N.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(o=>{const i=()=>{const c=o[0].target;c.offsetParent!==null&&e(c)};n?i():requestAnimationFrame(i)}):null,[e,n]);return a=o=>{o&&t?(s==null||s.observe(o),r.current=o):(r.current&&(s==null||s.unobserve(r.current)),r.current=null)},{callbackRef:a,ref:r}}function UV(e,t,n,r,a,s,o,i,c){const l=N.useCallback(d=>{const p=DV(d.children,t,i?"offsetWidth":"offsetHeight",a);let h=d.parentElement;for(;!h.dataset.virtuosoScroller;)h=h.parentElement;const y=h.lastElementChild.dataset.viewportType==="window";let E;y&&(E=h.ownerDocument.defaultView);const C=o?i?o.scrollLeft:o.scrollTop:y?i?E.scrollX||E.document.documentElement.scrollLeft:E.scrollY||E.document.documentElement.scrollTop:i?h.scrollLeft:h.scrollTop,I=o?i?o.scrollWidth:o.scrollHeight:y?i?E.document.documentElement.scrollWidth:E.document.documentElement.scrollHeight:i?h.scrollWidth:h.scrollHeight,P=o?i?o.offsetWidth:o.offsetHeight:y?i?E.innerWidth:E.innerHeight:i?h.offsetWidth:h.offsetHeight;r({scrollHeight:I,scrollTop:Math.max(C,0),viewportHeight:P}),s==null||s(i?Ax("column-gap",getComputedStyle(d).columnGap,a):Ax("row-gap",getComputedStyle(d).rowGap,a)),p!==null&&e(p)},[e,t,a,s,o,r,i]);return fm(l,n,c)}function DV(e,t,n,r){const a=e.length;if(a===0)return null;const s=[];for(let o=0;o<a;o++){const i=e.item(o);if(i.dataset.index===void 0)continue;const c=parseInt(i.dataset.index),l=parseFloat(i.dataset.knownSize),d=t(i,n);if(d===0&&r("Zero-sized element, this should not happen",{child:i},ln.ERROR),d===l)continue;const p=s[s.length-1];s.length===0||p.size!==d||p.endIndex!==c-1?s.push({endIndex:c,size:d,startIndex:c}):s[s.length-1].endIndex++}return s}function Ax(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,ln.WARN),t==="normal"?0:parseInt(t??"0",10)}function Sx(e,t,n){const r=N.useRef(null),a=N.useCallback(c=>{if(!(c!=null&&c.offsetParent))return;const l=c.getBoundingClientRect(),d=l.width;let p,h;if(t){const y=t.getBoundingClientRect(),E=l.top-y.top;h=y.height-Math.max(0,E),p=E+t.scrollTop}else{const y=o.current.ownerDocument.defaultView;h=y.innerHeight-Math.max(0,l.top),p=l.top+y.scrollY}r.current={offsetTop:p,visibleHeight:h,visibleWidth:d},e(r.current)},[e,t]),{callbackRef:s,ref:o}=fm(a,!0,n),i=N.useCallback(()=>{a(o.current)},[a,o]);return N.useEffect(()=>{var c;if(t){t.addEventListener("scroll",i);const l=new ResizeObserver(()=>{requestAnimationFrame(i)});return l.observe(t),()=>{t.removeEventListener("scroll",i),l.unobserve(t)}}else{const l=(c=o.current)==null?void 0:c.ownerDocument.defaultView;return l==null||l.addEventListener("scroll",i),l==null||l.addEventListener("resize",i),()=>{l==null||l.removeEventListener("scroll",i),l==null||l.removeEventListener("resize",i)}}},[i,t,o]),s}const Zt=je(()=>{const e=Me(),t=Me(),n=Z(0),r=Me(),a=Z(0),s=Me(),o=Me(),i=Z(0),c=Z(0),l=Z(0),d=Z(0),p=Me(),h=Me(),y=Z(!1),E=Z(!1),C=Z(!1);return pe(W(e,se(({scrollTop:I})=>I)),t),pe(W(e,se(({scrollHeight:I})=>I)),o),pe(t,a),{deviation:n,fixedFooterHeight:l,fixedHeaderHeight:c,footerHeight:d,headerHeight:i,horizontalDirection:E,scrollBy:h,scrollContainerState:e,scrollHeight:o,scrollingInProgress:y,scrollTo:p,scrollTop:t,skipAnimationFrameInResizeObserver:C,smoothScrollTargetReached:r,statefulScrollTop:a,viewportHeight:s}},[],{singleton:!0}),xc={lvl:0};function Px(e,t){const n=e.length;if(n===0)return[];let{index:r,value:a}=t(e[0]);const s=[];for(let o=1;o<n;o++){const{index:i,value:c}=t(e[o]);s.push({end:i-1,start:r,value:a}),r=i,a=c}return s.push({end:1/0,start:r,value:a}),s}function Ze(e){return e===xc}function wc(e,t){if(!Ze(e))return t===e.k?e.v:t<e.k?wc(e.l,t):wc(e.r,t)}function rr(e,t,n="k"){if(Ze(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){const r=rr(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return rr(e.l,t,n)}function En(e,t,n){return Ze(e)?Ox(t,n,1):t===e.k?It(e,{k:t,v:n}):t<e.k?Fx(It(e,{l:En(e.l,t,n)})):Fx(It(e,{r:En(e.r,t,n)}))}function Po(){return xc}function Io(e,t,n){if(Ze(e))return[];const r=rr(e,t)[0];return _V(hm(e,r,n))}function mm(e,t){if(Ze(e))return xc;const{k:n,l:r,r:a}=e;if(t===n){if(Ze(r))return a;if(Ze(a))return r;{const[s,o]=Bx(r);return Xu(It(e,{k:s,l:Ix(r),v:o}))}}else return t<n?Xu(It(e,{l:mm(r,t)})):Xu(It(e,{r:mm(a,t)}))}function ws(e){return Ze(e)?[]:[...ws(e.l),{k:e.k,v:e.v},...ws(e.r)]}function hm(e,t,n){if(Ze(e))return[];const{k:r,l:a,r:s,v:o}=e;let i=[];return r>t&&(i=i.concat(hm(a,t,n))),r>=t&&r<=n&&i.push({k:r,v:o}),r<=n&&(i=i.concat(hm(s,t,n))),i}function Xu(e){const{l:t,lvl:n,r}=e;if(r.lvl>=n-1&&t.lvl>=n-1)return e;if(n>r.lvl+1){if(bm(t))return Ux(It(e,{lvl:n-1}));if(!Ze(t)&&!Ze(t.r))return It(t.r,{l:It(t,{r:t.r.l}),lvl:n,r:It(e,{l:t.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}else{if(bm(e))return ym(It(e,{lvl:n-1}));if(!Ze(r)&&!Ze(r.l)){const a=r.l,s=bm(a)?r.lvl-1:r.lvl;return It(a,{l:It(e,{lvl:n-1,r:a.l}),lvl:a.lvl+1,r:ym(It(r,{l:a.r,lvl:s}))})}else throw new Error("Unexpected empty nodes")}}function It(e,t){return Ox(t.k!==void 0?t.k:e.k,t.v!==void 0?t.v:e.v,t.lvl!==void 0?t.lvl:e.lvl,t.l!==void 0?t.l:e.l,t.r!==void 0?t.r:e.r)}function Ix(e){return Ze(e.r)?e.l:Xu(It(e,{r:Ix(e.r)}))}function bm(e){return Ze(e)||e.lvl>e.r.lvl}function Bx(e){return Ze(e.r)?[e.k,e.v]:Bx(e.r)}function Ox(e,t,n,r=xc,a=xc){return{k:e,l:r,lvl:n,r:a,v:t}}function Fx(e){return ym(Ux(e))}function Ux(e){const{l:t}=e;return!Ze(t)&&t.lvl===e.lvl?It(t,{r:It(e,{l:t.r})}):e}function ym(e){const{lvl:t,r:n}=e;return!Ze(n)&&!Ze(n.r)&&n.lvl===t&&n.r.lvl===t?It(n,{l:It(e,{r:n.l}),lvl:t+1}):e}function _V(e){return Px(e,({k:t,v:n})=>({index:t,value:n}))}function Dx(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function vc(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}const gm=je(()=>({recalcInProgress:Z(!1)}),[],{singleton:!0});function _x(e,t,n){return e[Qu(e,t,n)]}function Qu(e,t,n,r=0){let a=e.length-1;for(;r<=a;){const s=Math.floor((r+a)/2),o=e[s],i=n(o,t);if(i===0)return s;if(i===-1){if(a-r<2)return s-1;a=s-1}else{if(a===r)return s;r=s+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function MV(e,t,n,r){const a=Qu(e,t,r),s=Qu(e,n,r,a);return e.slice(a,s+1)}function Sa(e,t){return Math.round(e.getBoundingClientRect()[t])}function Ju(e){return!Ze(e.groupOffsetTree)}function xm({index:e},t){return t===e?0:t<e?-1:1}function NV(){return{groupIndices:[],groupOffsetTree:Po(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:Po()}}function LV(e,t){let n=Ze(e)?0:1/0;for(const r of t){const{endIndex:a,size:s,startIndex:o}=r;if(n=Math.min(n,o),Ze(e)){e=En(e,0,s);continue}const i=Io(e,o-1,a+1);if(i.some(VV(r)))continue;let c=!1,l=!1;for(const{end:d,start:p,value:h}of i)c?(a>=p||s===h)&&(e=mm(e,p)):(l=h!==s,c=!0),d>a&&a>=p&&h!==s&&(e=En(e,a+1,h));l&&(e=En(e,o,s))}return[e,n]}function zV(e){return typeof e.groupIndex<"u"}function RV({offset:e},t){return t===e?0:t<e?-1:1}function kc(e,t,n){if(t.length===0)return 0;const{index:r,offset:a,size:s}=_x(t,e,xm),o=e-r,i=s*o+(o-1)*n+a;return i>0?i+n:i}function Mx(e,t){if(!Ju(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function Nx(e,t,n){if(zV(e))return t.groupIndices[e.groupIndex]+1;{const r=e.index==="LAST"?n:e.index;let a=Mx(r,t);return a=Math.max(0,a,Math.min(n,a)),a}}function $V(e,t,n,r=0){return r>0&&(t=Math.max(t,_x(e,r,xm).offset)),Px(MV(e,t,n,RV),jV)}function HV(e,[t,n,r,a]){t.length>0&&r("received item sizes",t,ln.DEBUG);const s=e.sizeTree;let o=s,i=0;if(n.length>0&&Ze(s)&&t.length===2){const h=t[0].size,y=t[1].size;o=n.reduce((E,C)=>En(En(E,C,h),C+1,y),o)}else[o,i]=LV(o,t);if(o===s)return e;const{lastIndex:c,lastOffset:l,lastSize:d,offsetTree:p}=wm(e.offsetTree,i,o,a);return{groupIndices:n,groupOffsetTree:n.reduce((h,y)=>En(h,y,kc(y,p,a)),Po()),lastIndex:c,lastOffset:l,lastSize:d,offsetTree:p,sizeTree:o}}function GV(e){return ws(e).map(({k:t,v:n},r,a)=>{const s=a[r+1];return{endIndex:s?s.k-1:1/0,size:n,startIndex:t}})}function Lx(e,t){let n=0,r=0;for(;n<e;)n+=t[r+1]-t[r]-1,r++;return r-(n===e?0:1)}function wm(e,t,n,r){let a=e,s=0,o=0,i=0,c=0;if(t!==0){c=Qu(a,t-1,xm),i=a[c].offset;const l=rr(n,t-1);s=l[0],o=l[1],a.length&&a[c].size===rr(n,t)[1]&&(c-=1),a=a.slice(0,c+1)}else a=[];for(const{start:l,value:d}of Io(n,t,1/0)){const p=l-s,h=p*o+i+p*r;a.push({index:l,offset:h,size:d}),s=l,i=h,o=d}return{lastIndex:s,lastOffset:i,lastSize:o,offsetTree:a}}function jV(e){return{index:e.index,value:e}}function VV(e){const{endIndex:t,size:n,startIndex:r}=e;return a=>a.start===r&&(a.end===t||a.end===1/0)&&a.value===n}const WV={offsetHeight:"height",offsetWidth:"width"},wr=je(([{log:e},{recalcInProgress:t}])=>{const n=Me(),r=Me(),a=Vt(r,0),s=Me(),o=Me(),i=Z(0),c=Z([]),l=Z(void 0),d=Z(void 0),p=Z(void 0),h=Z(void 0),y=Z((F,u)=>Sa(F,WV[u])),E=Z(void 0),C=Z(0),I=NV(),P=Vt(W(n,Be(c,e,C),xr(HV,I),st()),I),v=Vt(W(c,st(),xr((F,u)=>({current:u,prev:F.current}),{current:[],prev:[]}),se(({prev:F})=>F)),[]);pe(W(c,xe(F=>F.length>0),Be(P,C),se(([F,u,f])=>{const b=F.reduce((k,x,T)=>En(k,x,kc(x,u.offsetTree,f)||T),Po());return{...u,groupIndices:F,groupOffsetTree:b}})),P),pe(W(r,Be(P),xe(([F,{lastIndex:u}])=>F<u),se(([F,{lastIndex:u,lastSize:f}])=>[{endIndex:u,size:f,startIndex:F}])),n),pe(l,d);const U=Vt(W(l,se(F=>F===void 0)),!0);pe(W(d,xe(F=>F!==void 0&&Ze(ct(P).sizeTree)),se(F=>{const u=ct(p),f=ct(c).length>0;return u?f?[{endIndex:0,size:u,startIndex:0},{endIndex:1,size:F,startIndex:1}]:[]:[{endIndex:0,size:F,startIndex:0}]})),n),pe(W(h,xe(F=>F!==void 0&&F.length>0&&Ze(ct(P).sizeTree)),se(F=>{const u=[];let f=F[0],b=0;for(let k=1;k<F.length;k++){const x=F[k];x!==f&&(u.push({endIndex:k-1,size:f,startIndex:b}),f=x,b=k)}return u.push({endIndex:F.length-1,size:f,startIndex:b}),u})),n),pe(W(c,Be(p,d),xe(([,F,u])=>F!==void 0&&u!==void 0),se(([F,u,f])=>{const b=[];for(let k=0;k<F.length;k++){const x=F[k],T=F[k+1];b.push({startIndex:x,endIndex:x,size:u}),T!==void 0&&b.push({startIndex:x+1,endIndex:T-1,size:f})}return b})),n);const O=kn(W(n,Be(P),xr(({sizes:F},[u,f])=>({changed:f!==F,sizes:f}),{changed:!1,sizes:I}),se(F=>F.changed)));We(W(i,xr((F,u)=>({diff:F.prev-u,prev:u}),{diff:0,prev:0}),se(F=>F.diff)),F=>{const{groupIndices:u}=ct(P);if(F>0)Ie(t,!0),Ie(s,F+Lx(F,u));else if(F<0){const f=ct(v);f.length>0&&(F-=Lx(-F,f)),Ie(o,F)}}),We(W(i,Be(e)),([F,u])=>{F<0&&u("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:i},ln.ERROR)});const M=kn(s);pe(W(s,Be(P),se(([F,u])=>{const f=u.groupIndices.length>0,b=[],k=u.lastSize;if(f){const x=wc(u.sizeTree,0);let T=0,B=0;for(;T<F;){const w=u.groupIndices[B],S=u.groupIndices.length===B+1?1/0:u.groupIndices[B+1]-w-1;b.push({endIndex:w,size:x,startIndex:w}),b.push({endIndex:w+1+S-1,size:k,startIndex:w+1}),B++,T+=S+1}const g=ws(u.sizeTree);return T!==F&&g.shift(),g.reduce((w,{k:S,v:A})=>{let D=w.ranges;return w.prevSize!==0&&(D=[...w.ranges,{endIndex:S+F-1,size:w.prevSize,startIndex:w.prevIndex}]),{prevIndex:S+F,prevSize:A,ranges:D}},{prevIndex:F,prevSize:0,ranges:b}).ranges}return ws(u.sizeTree).reduce((x,{k:T,v:B})=>({prevIndex:T+F,prevSize:B,ranges:[...x.ranges,{endIndex:T+F-1,size:x.prevSize,startIndex:x.prevIndex}]}),{prevIndex:0,prevSize:k,ranges:[]}).ranges})),n);const L=kn(W(o,Be(P,C),se(([F,{offsetTree:u},f])=>{const b=-F;return kc(b,u,f)})));return pe(W(o,Be(P,C),se(([F,u,f])=>{if(u.groupIndices.length>0){if(Ze(u.sizeTree))return u;let b=Po();const k=ct(v);let x=0,T=0,B=0;for(;x<-F;){B=k[T];const g=k[T+1]-B-1;T++,x+=g+1}if(b=ws(u.sizeTree).reduce((g,{k:w,v:S})=>En(g,Math.max(0,w+F),S),b),x!==-F){const g=wc(u.sizeTree,B);b=En(b,0,g);const w=rr(u.sizeTree,-F+1)[1];b=En(b,1,w)}return{...u,sizeTree:b,...wm(u.offsetTree,0,b,f)}}else{const b=ws(u.sizeTree).reduce((k,{k:x,v:T})=>En(k,Math.max(0,x+F),T),Po());return{...u,sizeTree:b,...wm(u.offsetTree,0,b,f)}}})),P),{beforeUnshiftWith:M,data:E,defaultItemSize:d,firstItemIndex:i,fixedItemSize:l,fixedGroupSize:p,gap:C,groupIndices:c,heightEstimates:h,itemSize:y,listRefresh:O,shiftWith:o,shiftWithOffset:L,sizeRanges:n,sizes:P,statefulTotalCount:a,totalCount:r,trackItemSizes:U,unshiftWith:s}},at(Aa,gm),{singleton:!0});function qV(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{groupIndices:[],totalCount:0})}const zx=je(([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:r,scrollTop:a}])=>{const s=Me(),o=Me(),i=kn(W(s,se(qV)));return pe(W(i,se(c=>c.totalCount)),n),pe(W(i,se(c=>c.groupIndices)),e),pe(W(Tt(a,t,r),xe(([c,l])=>Ju(l)),se(([c,l,d])=>rr(l.groupOffsetTree,Math.max(c-d,0),"v")[0]),st(),se(c=>[c])),o),{groupCounts:s,topItemsIndexes:o}},at(wr,Zt)),Pa=je(([{log:e}])=>{const t=Z(!1),n=kn(W(t,xe(r=>r),st()));return We(t,r=>{r&&ct(e)("props updated",{},ln.DEBUG)}),{didMount:n,propsReady:t}},at(Aa),{singleton:!0}),YV=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function Rx(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!YV)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const Ec=je(([{gap:e,listRefresh:t,sizes:n,totalCount:r},{fixedFooterHeight:a,fixedHeaderHeight:s,footerHeight:o,headerHeight:i,scrollingInProgress:c,scrollTo:l,smoothScrollTargetReached:d,viewportHeight:p},{log:h}])=>{const y=Me(),E=Me(),C=Z(0);let I=null,P=null,v=null;function U(){I&&(I(),I=null),v&&(v(),v=null),P&&(clearTimeout(P),P=null),Ie(c,!1)}return pe(W(y,Be(n,p,r,C,i,o,h),Be(e,s,a),se(([[O,M,L,F,u,f,b,k],x,T,B])=>{const g=Rx(O),{align:w,behavior:S,offset:A}=g,D=F-1,R=Nx(g,M,D);let $=kc(R,M.offsetTree,x)+f;w==="end"?($+=T+rr(M.sizeTree,R)[1]-L+B,R===D&&($+=b)):w==="center"?$+=(T+rr(M.sizeTree,R)[1]-L+B)/2:$-=u,A&&($+=A);const j=te=>{U(),te?(k("retrying to scroll to",{location:O},ln.DEBUG),Ie(y,O)):(Ie(E,!0),k("list did not change, scroll successful",{},ln.DEBUG))};if(U(),S==="smooth"){let te=!1;v=We(t,ce=>{te=te||ce}),I=nr(d,()=>{j(te)})}else I=nr(W(t,KV(150)),j);return P=setTimeout(()=>{U()},1200),Ie(c,!0),k("scrolling from index to",{behavior:S,index:R,top:$},ln.DEBUG),{behavior:S,top:$}})),l),{scrollTargetReached:E,scrollToIndex:y,topListHeight:C}},at(wr,Zt,Aa),{singleton:!0});function KV(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return r=>{r&&(t(!0),clearTimeout(n))}}}function vm(e,t){e==0?t():requestAnimationFrame(()=>{vm(e-1,t)})}function km(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}const Tc=je(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:a,scrollToIndex:s},{didMount:o}])=>{const i=Z(!0),c=Z(0),l=Z(!0);return pe(W(o,Be(c),xe(([d,p])=>!!p),gr(!1)),i),pe(W(o,Be(c),xe(([d,p])=>!!p),gr(!1)),l),We(W(Tt(t,o),Be(i,n,e,l),xe(([[,d],p,{sizeTree:h},y,E])=>d&&(!Ze(h)||um(y))&&!p&&!E),Be(c)),([,d])=>{nr(a,()=>{Ie(l,!0)}),vm(4,()=>{nr(r,()=>{Ie(i,!0)}),Ie(s,d)})}),{initialItemFinalLocationReached:l,initialTopMostItemIndex:c,scrolledToInitialItem:i}},at(wr,Zt,Ec,Pa),{singleton:!0});function $x(e,t){return Math.abs(e-t)<1.01}const Cc="up",Ac="down",ZV="none",XV={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},QV=0,Sc=je(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:a,viewportHeight:s}])=>{const o=Z(!1),i=Z(!0),c=Me(),l=Me(),d=Z(4),p=Z(QV),h=Vt(W(pm(W(we(a),gs(1),gr(!0)),W(we(a),gs(1),gr(!1),Tx(100))),st()),!1),y=Vt(W(pm(W(n,gr(!0)),W(n,gr(!1),Tx(200))),st()),!1);pe(W(Tt(we(a),we(p)),se(([v,U])=>v<=U),st()),i),pe(W(i,Qr(50)),l);const E=kn(W(Tt(r,we(s),we(t),we(e),we(d)),xr((v,[{scrollHeight:U,scrollTop:O},M,L,F,u])=>{const f=O+M-U>-u,b={scrollHeight:U,scrollTop:O,viewportHeight:M};if(f){let x,T;return O>v.state.scrollTop?(x="SCROLLED_DOWN",T=v.state.scrollTop-O):(x="SIZE_DECREASED",T=v.state.scrollTop-O||v.scrollTopDelta),{atBottom:!0,atBottomBecause:x,scrollTopDelta:T,state:b}}let k;return b.scrollHeight>v.state.scrollHeight?k="SIZE_INCREASED":M<v.state.viewportHeight?k="VIEWPORT_HEIGHT_DECREASING":O<v.state.scrollTop?k="SCROLLING_UPWARDS":k="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:k,state:b}},XV),st((v,U)=>v&&v.atBottom===U.atBottom))),C=Vt(W(r,xr((v,{scrollHeight:U,scrollTop:O,viewportHeight:M})=>{if($x(v.scrollHeight,U))return{changed:!1,jump:0,scrollHeight:U,scrollTop:O};{const L=U-(O+M)<1;return v.scrollTop!==O&&L?{changed:!0,jump:v.scrollTop-O,scrollHeight:U,scrollTop:O}:{changed:!0,jump:0,scrollHeight:U,scrollTop:O}}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),xe(v=>v.changed),se(v=>v.jump)),0);pe(W(E,se(v=>v.atBottom)),o),pe(W(o,Qr(50)),c);const I=Z(Ac);pe(W(r,se(({scrollTop:v})=>v),st(),xr((v,U)=>ct(y)?{direction:v.direction,prevScrollTop:U}:{direction:U<v.prevScrollTop?Cc:Ac,prevScrollTop:U},{direction:Ac,prevScrollTop:0}),se(v=>v.direction)),I),pe(W(r,Qr(50),gr(ZV)),I);const P=Z(0);return pe(W(h,xe(v=>!v),gr(0)),P),pe(W(a,Qr(100),Be(h),xe(([v,U])=>!!U),xr(([v,U],[O])=>[U,O],[0,0]),se(([v,U])=>U-v)),P),{atBottomState:E,atBottomStateChange:c,atBottomThreshold:d,atTopStateChange:l,atTopThreshold:p,isAtBottom:o,isAtTop:i,isScrolling:h,lastJumpDueToItemResize:C,scrollDirection:I,scrollVelocity:P}},at(Zt)),Pc="top",Ic="bottom",Hx="none";function Gx(e,t,n){return typeof e=="number"?n===Cc&&t===Pc||n===Ac&&t===Ic?e:0:n===Cc?t===Pc?e.main:e.reverse:t===Ic?e.main:e.reverse}function jx(e,t){var n;return typeof e=="number"?e:(n=e[t])!=null?n:0}const Em=je(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:a}])=>{const s=Me(),o=Z(0),i=Z(0),c=Z(0),l=Vt(W(Tt(we(r),we(a),we(n),we(s,vc),we(c),we(o),we(t),we(e),we(i)),se(([d,p,h,[y,E],C,I,P,v,U])=>{const O=d-v,M=I+P,L=Math.max(h-O,0);let F=Hx;const u=jx(U,Pc),f=jx(U,Ic);return y-=v,y+=h+P,E+=h+P,E-=v,y>d+M-u&&(F=Cc),E<d-L+p+f&&(F=Ac),F!==Hx?[Math.max(O-h-Gx(C,Pc,F)-u,0),O-L-P+p+Gx(C,Ic,F)+f]:null}),xe(d=>d!=null),st(vc)),[0,0]);return{increaseViewportBy:i,listBoundary:s,overscan:c,topListHeight:o,visibleRange:l}},at(Zt),{singleton:!0});function JV(e,t,n){if(Ju(t)){const r=Mx(e,t);return[{index:rr(t.groupOffsetTree,r)[0],offset:0,size:0},{data:n==null?void 0:n[0],index:r,offset:0,size:0}]}return[{data:n==null?void 0:n[0],index:e,offset:0,size:0}]}const Tm={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function ed(e,t,n,r,a,s){const{lastIndex:o,lastOffset:i,lastSize:c}=a;let l=0,d=0;if(e.length>0){l=e[0].offset;const C=e[e.length-1];d=C.offset+C.size}const p=n-o,h=i+p*c+(p-1)*r,y=l,E=h-d;return{bottom:d,firstItemIndex:s,items:Wx(e,a,s),offsetBottom:E,offsetTop:l,top:y,topItems:Wx(t,a,s),topListHeight:t.reduce((C,I)=>I.size+C,0),totalCount:n}}function Vx(e,t,n,r,a,s){let o=0;if(n.groupIndices.length>0)for(const d of n.groupIndices){if(d-o>=e)break;o++}const i=e+o,c=km(t,i),l=Array.from({length:i}).map((d,p)=>({data:s[p+c],index:p+c,offset:0,size:0}));return ed(l,[],i,a,n,r)}function Wx(e,t,n){if(e.length===0)return[];if(!Ju(t))return e.map(l=>({...l,index:l.index+n,originalIndex:l.index}));const r=e[0].index,a=e[e.length-1].index,s=[],o=Io(t.groupOffsetTree,r,a);let i,c=0;for(const l of e){(!i||i.end<l.index)&&(i=o.shift(),c=t.groupIndices.indexOf(i.start));let d;l.index===i.start?d={index:c,type:"group"}:d={groupIndex:c,index:l.index-(c+1)+n},s.push({...d,data:l.data,offset:l.offset,originalIndex:l.index,size:l.size})}return s}function qx(e,t){var n;return e===void 0?0:typeof e=="number"?e:(n=e[t])!=null?n:0}const vs=je(([{data:e,firstItemIndex:t,gap:n,sizes:r,totalCount:a},s,{listBoundary:o,topListHeight:i,visibleRange:c},{initialTopMostItemIndex:l,scrolledToInitialItem:d},{topListHeight:p},h,{didMount:y},{recalcInProgress:E}])=>{const C=Z([]),I=Z(0),P=Me(),v=Z(0);pe(s.topItemsIndexes,C);const U=Vt(W(Tt(y,E,we(c,vc),we(a),we(r),we(l),d,we(C),we(t),we(n),we(v),e),xe(([F,u,,f,,,,,,,,b])=>{const k=b&&b.length!==f;return F&&!u&&!k}),se(([,,[F,u],f,b,k,x,T,B,g,w,S])=>{var A,D,R,$;const j=b,{offsetTree:te,sizeTree:ce}=j,Y=ct(I);if(f===0)return{...Tm,totalCount:f};if(F===0&&u===0)return Y===0?{...Tm,totalCount:f}:Vx(Y,k,b,B,g,S||[]);if(Ze(ce))return Y>0?null:ed(JV(km(k,f),j,S),[],f,g,j,B);const J=[];if(T.length>0){const ge=T[0],fe=T[T.length-1];let ae=0;for(const Je of Io(ce,ge,fe)){const Xe=Je.value,et=Math.max(Je.start,ge),Rn=Math.min(Je.end,fe);for(let Nt=et;Nt<=Rn;Nt++)J.push({data:S==null?void 0:S[Nt],index:Nt,offset:ae,size:Xe}),ae+=Xe}}if(!x)return ed([],J,f,g,j,B);const ye=T.length>0?T[T.length-1]+1:0,X=$V(te,F,u,ye);if(X.length===0)return null;const ve=f-1,Fe=Zu([],ge=>{for(const fe of X){const ae=fe.value;let Je=ae.offset,Xe=fe.start;const et=ae.size;if(ae.offset<F){Xe+=Math.floor((F-ae.offset+g)/(et+g));const Nt=Xe-fe.start;Je+=Nt*et+Nt*g}Xe<ye&&(Je+=(ye-Xe)*et,Xe=ye);const Rn=Math.min(fe.end,ve);for(let Nt=Xe;Nt<=Rn&&!(Je>=u);Nt++)ge.push({data:S==null?void 0:S[Nt],index:Nt,offset:Je,size:et}),Je+=et+g}}),Ae=qx(w,Pc),Ye=qx(w,Ic);if(Fe.length>0&&(Ae>0||Ye>0)){const ge=Fe[0],fe=Fe[Fe.length-1];if(Ae>0&&ge.index>ye){const ae=Math.min(Ae,ge.index-ye),Je=[];let Xe=ge.offset;for(let et=ge.index-1;et>=ge.index-ae;et--){const Rn=(D=(A=Io(ce,et,et)[0])==null?void 0:A.value)!=null?D:ge.size;Xe-=Rn+g,Je.unshift({data:S==null?void 0:S[et],index:et,offset:Xe,size:Rn})}Fe.unshift(...Je)}if(Ye>0&&fe.index<ve){const ae=Math.min(Ye,ve-fe.index);let Je=fe.offset+fe.size+g;for(let Xe=fe.index+1;Xe<=fe.index+ae;Xe++){const et=($=(R=Io(ce,Xe,Xe)[0])==null?void 0:R.value)!=null?$:fe.size;Fe.push({data:S==null?void 0:S[Xe],index:Xe,offset:Je,size:et}),Je+=et+g}}}return ed(Fe,J,f,g,j,B)}),xe(F=>F!==null),st()),Tm);pe(W(e,xe(um),se(F=>F==null?void 0:F.length)),a),pe(W(U,se(F=>F.topListHeight)),p),pe(p,i),pe(W(U,se(F=>[F.top,F.bottom])),o),pe(W(U,se(F=>F.items)),P);const O=kn(W(U,xe(({items:F})=>F.length>0),Be(a,e),xe(([{items:F},u])=>F[F.length-1].originalIndex===u-1),se(([,F,u])=>[F-1,u]),st(vc),se(([F])=>F))),M=kn(W(U,Qr(200),xe(({items:F,topItems:u})=>F.length>0&&F[0].originalIndex===u.length),se(({items:F})=>F[0].index),st())),L=kn(W(U,xe(({items:F})=>F.length>0),se(({items:F})=>{let u=0,f=F.length-1;for(;F[u].type==="group"&&u<f;)u++;for(;F[f].type==="group"&&f>u;)f--;return{endIndex:F[f].index,startIndex:F[u].index}}),st(Dx)));return{endReached:O,initialItemCount:I,itemsRendered:P,listState:U,minOverscanItemCount:v,rangeChanged:L,startReached:M,topItemsIndexes:C,...h}},at(wr,zx,Em,Tc,Ec,Sc,Pa,gm),{singleton:!0}),Yx=je(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:a}])=>{const s=Me(),o=Vt(W(Tt(n,e,r,t,a),se(([i,c,l,d,p])=>i+c+l+d+p.offsetBottom+p.bottom)),0);return pe(we(o),s),{totalListHeight:o,totalListHeightChanged:s}},at(Zt,vs),{singleton:!0}),eW=je(([{viewportHeight:e},{totalListHeight:t}])=>{const n=Z(!1),r=Vt(W(Tt(n,e,t),xe(([a])=>a),se(([,a,s])=>Math.max(0,a-s)),Qr(0),st()),0);return{alignToBottom:n,paddingTopAddition:r}},at(Zt,Yx),{singleton:!0}),Kx=je(()=>({context:Z(null)})),tW=({itemBottom:e,itemTop:t,locationParams:{align:n,behavior:r,...a},viewportBottom:s,viewportTop:o})=>t<o?{...a,align:n??"start",behavior:r}:e>s?{...a,align:n??"end",behavior:r}:null,Zx=je(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:a,headerHeight:s,scrollingInProgress:o,scrollTop:i,viewportHeight:c},{scrollToIndex:l}])=>{const d=Me();return pe(W(d,Be(t,c,n,s,a,r,i),Be(e),se(([[p,h,y,E,C,I,P,v],U])=>{const{align:O,behavior:M,calculateViewLocation:L=tW,done:F,...u}=p,f=Nx(p,h,E-1),b=kc(f,h.offsetTree,U)+C+I,k=b+rr(h.sizeTree,f)[1],x=v+I,T=v+y-P,B=L({itemBottom:k,itemTop:b,locationParams:{align:O,behavior:M,...u},viewportBottom:T,viewportTop:x});return B?F&&nr(W(o,xe(g=>!g),gs(ct(o)?1:2)),F):F&&F(),B}),xe(p=>p!==null)),l),{scrollIntoView:d}},at(wr,Zt,Ec,vs,Aa),{singleton:!0});function Xx(e){return e?e==="smooth"?"smooth":"auto":!1}const nW=(e,t)=>typeof e=="function"?Xx(e(t)):t&&Xx(e),rW=je(([{listRefresh:e,totalCount:t,fixedItemSize:n,data:r},{atBottomState:a,isAtBottom:s},{scrollToIndex:o},{scrolledToInitialItem:i},{didMount:c,propsReady:l},{log:d},{scrollingInProgress:p},{context:h},{scrollIntoView:y}])=>{const E=Z(!1),C=Me();let I=null;function P(M){Ie(o,{align:"end",behavior:M,index:"LAST"})}We(W(Tt(W(we(t),gs(1)),c),Be(we(E),s,i,p),se(([[M,L],F,u,f,b])=>{let k=L&&f,x="auto";return k&&(x=nW(F,u||b),k=k&&!!x),{followOutputBehavior:x,shouldFollow:k,totalCount:M}}),xe(({shouldFollow:M})=>M)),({followOutputBehavior:M,totalCount:L})=>{I&&(I(),I=null),ct(n)?requestAnimationFrame(()=>{ct(d)("following output to ",{totalCount:L},ln.DEBUG),P(M)}):I=nr(e,()=>{ct(d)("following output to ",{totalCount:L},ln.DEBUG),P(M),I=null})});function v(M){const L=nr(a,F=>{M&&!F.atBottom&&F.notAtBottomBecause==="SIZE_INCREASED"&&!I&&(ct(d)("scrolling to bottom due to increased size",{},ln.DEBUG),P("auto"))});setTimeout(L,100)}We(W(Tt(we(E),t,l),xe(([M,,L])=>M&&L),xr(({value:M},[,L])=>({refreshed:M===L,value:L}),{refreshed:!1,value:0}),xe(({refreshed:M})=>M),Be(E,t)),([,M])=>{ct(i)&&v(M!==!1)}),We(C,()=>{v(ct(E)!==!1)}),We(Tt(we(E),a),([M,L])=>{M&&!L.atBottom&&L.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&P("auto")});const U=Z(null),O=Me();return pe(pm(W(we(r),se(M=>{var L;return(L=M==null?void 0:M.length)!=null?L:0})),W(we(t))),O),We(W(Tt(W(O,gs(1)),c),Be(we(U),i,p,h),se(([[M,L],F,u,f,b])=>L&&u&&(F==null?void 0:F({context:b,totalCount:M,scrollingInProgress:f}))),xe(M=>!!M),Qr(0)),M=>{I&&(I(),I=null),ct(n)?requestAnimationFrame(()=>{ct(d)("scrolling into view",{}),Ie(y,M)}):I=nr(e,()=>{ct(d)("scrolling into view",{}),Ie(y,M),I=null})}),{autoscrollToBottom:C,followOutput:E,scrollIntoViewOnChange:U}},at(wr,Sc,Ec,Tc,Pa,Aa,Zt,Kx,Zx)),aW=je(([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:a},{initialItemCount:s,listState:o},{didMount:i}])=>(pe(W(i,Be(s),xe(([,c])=>c!==0),Be(a,r,t,n,e),se(([[,c],l,d,p,h,y=[]])=>Vx(c,l,d,p,h,y))),o),{}),at(wr,Tc,vs,Pa),{singleton:!0}),sW=je(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=Z(0);return We(W(e,Be(r),xe(([,a])=>a!==0),se(([,a])=>({top:a}))),a=>{nr(W(n,gs(1),xe(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{Ie(t,a)})})}),{initialScrollTop:r}},at(Pa,Zt,vs),{singleton:!0}),Qx=je(([{scrollVelocity:e}])=>{const t=Z(!1),n=Me(),r=Z(!1);return pe(W(e,Be(r,t,n),xe(([a,s])=>!!s),se(([a,s,o,i])=>{const{enter:c,exit:l}=s;if(o){if(l(a,i))return!1}else if(c(a,i))return!0;return o}),st()),t),We(W(Tt(t,e,n),Be(r)),([[a,s,o],i])=>{a&&i&&i.change&&i.change(s,o)}),{isSeeking:t,scrollSeekConfiguration:r,scrollSeekRangeChanged:n,scrollVelocity:e}},at(Sc),{singleton:!0}),Cm=je(([{scrollContainerState:e,scrollTo:t}])=>{const n=Me(),r=Me(),a=Me(),s=Z(!1),o=Z(void 0);return pe(W(Tt(n,r),se(([{scrollHeight:i,scrollTop:c,viewportHeight:l},{offsetTop:d}])=>({scrollHeight:i,scrollTop:Math.max(0,c-d),viewportHeight:l}))),e),pe(W(t,Be(r),se(([i,{offsetTop:c}])=>({...i,top:i.top+c}))),a),{customScrollParent:o,useWindowScroll:s,windowScrollContainerState:n,windowScrollTo:a,windowViewportRect:r}},at(Zt)),oW=je(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:a},{didMount:s},{useWindowScroll:o,windowScrollContainerState:i,windowViewportRect:c}])=>{const l=Me(),d=Z(void 0),p=Z(null),h=Z(null);return pe(i,p),pe(c,h),We(W(l,Be(t,r,o,p,h,n)),([y,E,C,I,P,v,U])=>{const O=GV(E.sizeTree);I&&P!==null&&v!==null&&(C=P.scrollTop-v.offsetTop),C-=U,y({ranges:O,scrollTop:C})}),pe(W(d,xe(um),se(iW)),a),pe(W(s,Be(d),xe(([,y])=>y!==void 0),st(),se(([,y])=>y.ranges)),e),{getState:l,restoreStateFrom:d}},at(wr,Zt,Tc,Pa,Cm));function iW(e){return{align:"start",index:0,offset:e.scrollTop}}const cW=je(([{topItemsIndexes:e}])=>{const t=Z(0);return pe(W(t,xe(n=>n>=0),se(n=>Array.from({length:n}).map((r,a)=>a))),e),{topItemCount:t}},at(vs));function Jx(e){let t=!1,n;return()=>(t||(t=!0,n=e()),n)}const lW=Jx(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),uW=je(([{deviation:e,scrollBy:t,scrollingInProgress:n,scrollTop:r},{isAtBottom:a,isScrolling:s,lastJumpDueToItemResize:o,scrollDirection:i},{listState:c},{beforeUnshiftWith:l,gap:d,shiftWithOffset:p,sizes:h},{log:y},{recalcInProgress:E}])=>{const C=kn(W(c,Be(o),xr(([,P,v,U],[{bottom:O,items:M,offsetBottom:L,totalCount:F},u])=>{const f=O+L;let b=0;return v===F&&P.length>0&&M.length>0&&(M[0].originalIndex===0&&P[0].originalIndex===0||(b=f-U,b!==0&&(b+=u))),[b,M,F,f]},[0,[],0,0]),xe(([P])=>P!==0),Be(r,i,n,a,y,E),xe(([,P,v,U,,,O])=>!O&&!U&&P!==0&&v===Cc),se(([[P],,,,,v])=>(v("Upward scrolling compensation",{amount:P},ln.DEBUG),P))));function I(P){P>0?(Ie(t,{behavior:"auto",top:-P}),Ie(e,0)):(Ie(e,0),Ie(t,{behavior:"auto",top:-P}))}return We(W(C,Be(e,s)),([P,v,U])=>{U&&lW()?Ie(e,v-P):I(-P)}),We(W(Tt(Vt(s,!1),e,E),xe(([P,v,U])=>!P&&!U&&v!==0),se(([P,v])=>v),Qr(1)),I),pe(W(p,se(P=>({top:-P}))),t),We(W(l,Be(h,d),se(([P,{groupIndices:v,lastSize:U,sizeTree:O},M])=>{function L(F){return F*(U+M)}if(v.length===0)return L(P);{let F=0;const u=wc(O,0);let f=0,b=0;for(;f<P;){f++,F+=u;let k=v.length===b+1?1/0:v[b+1]-v[b]-1;f+k>P&&(F-=u,k=P-f+1),f+=k,F+=L(k),b++}return F}})),P=>{Ie(e,P),requestAnimationFrame(()=>{Ie(t,{top:P}),requestAnimationFrame(()=>{Ie(e,0),Ie(E,!1)})})}),{deviation:e}},at(Zt,Sc,vs,wr,Aa,gm)),dW=je(([e,t,n,r,a,s,o,i,c,l,d])=>({...e,...t,...n,...r,...a,...s,...o,...i,...c,...l,...d}),at(Em,aW,Pa,Qx,Yx,sW,eW,Cm,Zx,Aa,Kx)),e5=je(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,fixedGroupSize:a,gap:s,groupIndices:o,heightEstimates:i,itemSize:c,sizeRanges:l,sizes:d,statefulTotalCount:p,totalCount:h,trackItemSizes:y},{initialItemFinalLocationReached:E,initialTopMostItemIndex:C,scrolledToInitialItem:I},P,v,U,O,{scrollToIndex:M},L,{topItemCount:F},{groupCounts:u},f])=>{const{listState:b,minOverscanItemCount:k,topItemsIndexes:x,rangeChanged:T,...B}=O;return pe(T,f.scrollSeekRangeChanged),pe(W(f.windowViewportRect,se(g=>g.visibleHeight)),P.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:r,fixedGroupHeight:a,gap:s,groupCounts:u,heightEstimates:i,initialItemFinalLocationReached:E,initialTopMostItemIndex:C,scrolledToInitialItem:I,sizeRanges:l,topItemCount:F,topItemsIndexes:x,totalCount:h,...U,groupIndices:o,itemSize:c,listState:b,minOverscanItemCount:k,scrollToIndex:M,statefulTotalCount:p,trackItemSizes:y,rangeChanged:T,...B,...f,...P,sizes:d,...v}},at(wr,Tc,Zt,oW,rW,vs,Ec,uW,cW,zx,dW));function pW(e,t){const n={},r={};let a=0;const s=e.length;for(;a<s;)r[e[a]]=1,a+=1;for(const o in t)Object.hasOwn(r,o)||(n[o]=t[o]);return n}const td=typeof document<"u"?N.useLayoutEffect:N.useEffect;function t5(e,t,n){const r=Object.keys(t.required||{}),a=Object.keys(t.optional||{}),s=Object.keys(t.methods||{}),o=Object.keys(t.events||{}),i=N.createContext({});function c(I,P){I.propsReady&&Ie(I.propsReady,!1);for(const v of r){const U=I[t.required[v]];Ie(U,P[v])}for(const v of a)if(v in P){const U=I[t.optional[v]];Ie(U,P[v])}I.propsReady&&Ie(I.propsReady,!0)}function l(I){return s.reduce((P,v)=>(P[v]=U=>{const O=I[t.methods[v]];Ie(O,U)},P),{})}function d(I){return o.reduce((P,v)=>(P[v]=PV(I[t.events[v]]),P),{})}const p=N.forwardRef((I,P)=>{const{children:v,...U}=I,[O]=N.useState(()=>Zu(BV(e),F=>{c(F,U)})),[M]=N.useState(Ex(d,O));td(()=>{for(const F of o)F in U&&We(M[F],U[F]);return()=>{Object.values(M).map(dm)}},[U,M,O]),td(()=>{c(O,U)}),N.useImperativeHandle(P,vx(l(O)));const L=n;return _.jsx(i.Provider,{value:O,children:n?_.jsx(L,{...pW([...r,...a,...o],U),children:v}):v})}),h=I=>{const P=N.useContext(i);return N.useCallback(v=>{Ie(P[I],v)},[P,I])},y=I=>{const P=N.useContext(i)[I],v=N.useCallback(U=>We(P,U),[P]);return N.useSyncExternalStore(v,()=>ct(P),()=>ct(P))},E=I=>{const P=N.useContext(i)[I],[v,U]=N.useState(Ex(ct,P));return td(()=>We(P,O=>{O!==v&&U(vx(O))}),[P,v]),v},C=N.version.startsWith("18")?y:E;return{Component:p,useEmitter:(I,P)=>{const v=N.useContext(i)[I];td(()=>We(v,P),[P,v])},useEmitterValue:C,usePublisher:h}}const n5=N.createContext(void 0),r5=N.createContext(void 0),a5=typeof document<"u"?N.useLayoutEffect:N.useEffect;function Am(e){return"self"in e}function fW(e){return"body"in e}function s5(e,t,n,r=So,a,s){const o=N.useRef(null),i=N.useRef(null),c=N.useRef(null),l=N.useCallback(h=>{let y,E,C;const I=h.target;if(fW(I)||Am(I)){const v=Am(I)?I:I.defaultView;C=s?v.scrollX:v.scrollY,y=s?v.document.documentElement.scrollWidth:v.document.documentElement.scrollHeight,E=s?v.innerWidth:v.innerHeight}else C=s?I.scrollLeft:I.scrollTop,y=s?I.scrollWidth:I.scrollHeight,E=s?I.offsetWidth:I.offsetHeight;const P=()=>{e({scrollHeight:y,scrollTop:Math.max(C,0),viewportHeight:E})};h.suppressFlushSync?P():_s.flushSync(P),i.current!==null&&(C===i.current||C<=0||C===y-E)&&(i.current=null,t(!0),c.current&&(clearTimeout(c.current),c.current=null))},[e,t,s]);N.useEffect(()=>{const h=a||o.current;return r(a||o.current),l({suppressFlushSync:!0,target:h}),h.addEventListener("scroll",l,{passive:!0}),()=>{r(null),h.removeEventListener("scroll",l)}},[o,l,n,r,a]);function d(h){const y=o.current;if(!y||(s?"offsetWidth"in y&&y.offsetWidth===0:"offsetHeight"in y&&y.offsetHeight===0))return;const E=h.behavior==="smooth";let C,I,P;Am(y)?(I=Math.max(Sa(y.document.documentElement,s?"width":"height"),s?y.document.documentElement.scrollWidth:y.document.documentElement.scrollHeight),C=s?y.innerWidth:y.innerHeight,P=s?window.scrollX:window.scrollY):(I=y[s?"scrollWidth":"scrollHeight"],C=Sa(y,s?"width":"height"),P=y[s?"scrollLeft":"scrollTop"]);const v=I-C;if(h.top=Math.ceil(Math.max(Math.min(v,h.top),0)),$x(C,I)||h.top===P){e({scrollHeight:I,scrollTop:P,viewportHeight:C}),E&&t(!0);return}E?(i.current=h.top,c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{c.current=null,i.current=null,t(!0)},1e3)):i.current=null,s&&(h={behavior:h.behavior,left:h.top}),y.scrollTo(h)}function p(h){s&&(h={behavior:h.behavior,left:h.top}),o.current.scrollBy(h)}return{scrollByCallback:p,scrollerRef:o,scrollToCallback:d}}const Sm="-webkit-sticky",o5="sticky",Pm=Jx(()=>{if(typeof document>"u")return o5;const e=document.createElement("div");return e.style.position=Sm,e.style.position===Sm?Sm:o5});function Im(e){return e}const mW=je(()=>{const e=Z(i=>`Item ${i}`),t=Z(i=>`Group ${i}`),n=Z({}),r=Z(Im),a=Z("div"),s=Z(So),o=(i,c=null)=>Vt(W(n,se(l=>l[i]),st()),c);return{components:n,computeItemKey:r,EmptyPlaceholder:o("EmptyPlaceholder"),FooterComponent:o("Footer"),GroupComponent:o("Group","div"),groupContent:t,HeaderComponent:o("Header"),HeaderFooterTag:a,ItemComponent:o("Item","div"),itemContent:e,ListComponent:o("List","div"),ScrollerComponent:o("Scroller","div"),scrollerRef:s,ScrollSeekPlaceholder:o("ScrollSeekPlaceholder"),TopItemListComponent:o("TopItemList")}}),hW=je(([e,t])=>({...e,...t}),at(e5,mW)),bW=({height:e})=>_.jsx("div",{style:{height:e}}),yW={overflowAnchor:"none",position:Pm(),zIndex:1},i5={overflowAnchor:"none"},gW={...i5,display:"inline-block",height:"100%"},c5=N.memo(function({showTopList:e=!1}){const t=ke("listState"),n=Nn("sizeRanges"),r=ke("useWindowScroll"),a=ke("customScrollParent"),s=Nn("windowScrollContainerState"),o=Nn("scrollContainerState"),i=a||r?s:o,c=ke("itemContent"),l=ke("context"),d=ke("groupContent"),p=ke("trackItemSizes"),h=ke("itemSize"),y=ke("log"),E=Nn("gap"),C=ke("horizontalDirection"),{callbackRef:I}=UV(n,h,p,e?So:i,y,E,a,C,ke("skipAnimationFrameInResizeObserver")),[P,v]=N.useState(0);Bm("deviation",B=>{P!==B&&v(B)});const U=ke("EmptyPlaceholder"),O=ke("ScrollSeekPlaceholder")||bW,M=ke("ListComponent"),L=ke("ItemComponent"),F=ke("GroupComponent"),u=ke("computeItemKey"),f=ke("isSeeking"),b=ke("groupIndices").length>0,k=ke("alignToBottom"),x=ke("initialItemFinalLocationReached"),T=e?{}:{boxSizing:"border-box",...C?{display:"inline-block",height:"100%",marginLeft:P!==0?P:k?"auto":0,paddingLeft:t.offsetTop,paddingRight:t.offsetBottom,whiteSpace:"nowrap"}:{marginTop:P!==0?P:k?"auto":0,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...x?{}:{visibility:"hidden"}};return!e&&t.totalCount===0&&U?_.jsx(U,{...Wt(U,l)}):_.jsx(M,{...Wt(M,l),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:I,style:T,children:(e?t.topItems:t.items).map(B=>{const g=B.originalIndex,w=u(g+t.firstItemIndex,B.data,l);return f?N.createElement(O,{...Wt(O,l),height:B.size,index:B.index,key:w,type:B.type||"item",...B.type==="group"?{}:{groupIndex:B.groupIndex}}):B.type==="group"?N.createElement(F,{...Wt(F,l),"data-index":g,"data-item-index":B.index,"data-known-size":B.size,key:w,style:yW},d(B.index,l)):N.createElement(L,{...Wt(L,l),...kW(L,B.data),"data-index":g,"data-item-group-index":B.groupIndex,"data-item-index":B.index,"data-known-size":B.size,key:w,style:C?gW:i5},b?c(B.index,B.groupIndex,B.data,l):c(B.index,B.data,l))})})}),xW={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},wW={outline:"none",overflowX:"auto",position:"relative"},nd=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:{}}),vW={position:Pm(),top:0,width:"100%",zIndex:1};function Wt(e,t){if(typeof e!="string")return{context:t}}function kW(e,t){return{item:typeof e=="string"?void 0:t}}const EW=N.memo(function(){const e=ke("HeaderComponent"),t=Nn("headerHeight"),n=ke("HeaderFooterTag"),r=xs(N.useMemo(()=>s=>{t(Sa(s,"height"))},[t]),!0,ke("skipAnimationFrameInResizeObserver")),a=ke("context");return e?_.jsx(n,{ref:r,children:_.jsx(e,{...Wt(e,a)})}):null}),TW=N.memo(function(){const e=ke("FooterComponent"),t=Nn("footerHeight"),n=ke("HeaderFooterTag"),r=xs(N.useMemo(()=>s=>{t(Sa(s,"height"))},[t]),!0,ke("skipAnimationFrameInResizeObserver")),a=ke("context");return e?_.jsx(n,{ref:r,children:_.jsx(e,{...Wt(e,a)})}):null});function l5({useEmitter:e,useEmitterValue:t,usePublisher:n}){return N.memo(function({children:r,style:a,context:s,...o}){const i=n("scrollContainerState"),c=t("ScrollerComponent"),l=n("smoothScrollTargetReached"),d=t("scrollerRef"),p=t("horizontalDirection")||!1,{scrollByCallback:h,scrollerRef:y,scrollToCallback:E}=s5(i,l,c,d,void 0,p);return e("scrollTo",E),e("scrollBy",h),_.jsx(c,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:y,style:{...p?wW:xW,...a},tabIndex:0,...o,...Wt(c,s),children:r})})}function u5({useEmitter:e,useEmitterValue:t,usePublisher:n}){return N.memo(function({children:r,style:a,context:s,...o}){const i=n("windowScrollContainerState"),c=t("ScrollerComponent"),l=n("smoothScrollTargetReached"),d=t("totalListHeight"),p=t("deviation"),h=t("customScrollParent"),y=N.useRef(null),E=t("scrollerRef"),{scrollByCallback:C,scrollerRef:I,scrollToCallback:P}=s5(i,l,c,E,h);return a5(()=>{var v;return I.current=h||((v=y.current)==null?void 0:v.ownerDocument.defaultView),()=>{I.current=null}},[I,h]),e("windowScrollTo",P),e("scrollBy",C),_.jsx(c,{ref:y,"data-virtuoso-scroller":!0,style:{position:"relative",...a,...d!==0?{height:d+p}:{}},...o,...Wt(c,s),children:r})})}const CW=({children:e})=>{const t=N.useContext(n5),n=Nn("viewportHeight"),r=Nn("fixedItemHeight"),a=ke("alignToBottom"),s=ke("horizontalDirection"),o=N.useMemo(()=>kx(n,c=>Sa(c,s?"width":"height")),[n,s]),i=xs(o,!0,ke("skipAnimationFrameInResizeObserver"));return N.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),_.jsx("div",{"data-viewport-type":"element",ref:i,style:nd(a),children:e})},AW=({children:e})=>{const t=N.useContext(n5),n=Nn("windowViewportRect"),r=Nn("fixedItemHeight"),a=ke("customScrollParent"),s=Sx(n,a,ke("skipAnimationFrameInResizeObserver")),o=ke("alignToBottom");return N.useEffect(()=>{t&&(r(t.itemHeight),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),_.jsx("div",{"data-viewport-type":"window",ref:s,style:nd(o),children:e})},SW=({children:e})=>{const t=ke("TopItemListComponent")||"div",n=ke("headerHeight"),r={...vW,marginTop:`${n}px`},a=ke("context");return _.jsx(t,{style:r,...Wt(t,a),children:e})},PW=N.memo(function(e){const t=ke("useWindowScroll"),n=ke("topItemsIndexes").length>0,r=ke("customScrollParent"),a=ke("context");return _.jsxs(r||t?OW:BW,{...e,context:a,children:[n&&_.jsx(SW,{children:_.jsx(c5,{showTopList:!0})}),_.jsxs(r||t?AW:CW,{children:[_.jsx(EW,{}),_.jsx(c5,{}),_.jsx(TW,{})]})]})}),{Component:IW,useEmitter:Bm,useEmitterValue:ke,usePublisher:Nn}=t5(hW,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",minOverscanItemCount:"minOverscanItemCount",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedGroupHeight:"fixedGroupHeight",fixedItemHeight:"fixedItemHeight",heightEstimates:"heightEstimates",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"HeaderFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},PW),BW=l5({useEmitter:Bm,useEmitterValue:ke,usePublisher:Nn}),OW=u5({useEmitter:Bm,useEmitterValue:ke,usePublisher:Nn}),FW=IW;at(e5,je(()=>{const e=Z(l=>_.jsxs("td",{children:["Item $",l]})),t=Z(null),n=Z(l=>_.jsxs("td",{colSpan:1e3,children:["Group ",l]})),r=Z(null),a=Z(null),s=Z({}),o=Z(Im),i=Z(So),c=(l,d=null)=>Vt(W(s,se(p=>p[l]),st()),d);return{components:s,computeItemKey:o,context:t,EmptyPlaceholder:c("EmptyPlaceholder"),FillerRow:c("FillerRow"),fixedFooterContent:a,fixedHeaderContent:r,itemContent:e,groupContent:n,ScrollerComponent:c("Scroller","div"),scrollerRef:i,ScrollSeekPlaceholder:c("ScrollSeekPlaceholder"),TableBodyComponent:c("TableBody","tbody"),TableComponent:c("Table","table"),TableFooterComponent:c("TableFoot","tfoot"),TableHeadComponent:c("TableHead","thead"),TableRowComponent:c("TableRow","tr"),GroupComponent:c("Group","tr")}})),Pm();const d5={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},UW={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:p5,floor:rd,max:Bc,min:Om,round:f5}=Math;function m5(e,t,n){return Array.from({length:t-e+1}).map((r,a)=>({data:n===null?null:n[a+e],index:a+e}))}function DW(e){return{...UW,items:e}}function ad(e,t){return e&&e.width===t.width&&e.height===t.height}function _W(e,t){return e&&e.column===t.column&&e.row===t.row}const MW=je(([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:r},{footerHeight:a,headerHeight:s,scrollBy:o,scrollContainerState:i,scrollTo:c,scrollTop:l,smoothScrollTargetReached:d,viewportHeight:p},h,y,{didMount:E,propsReady:C},{customScrollParent:I,useWindowScroll:P,windowScrollContainerState:v,windowScrollTo:U,windowViewportRect:O},M])=>{const L=Z(0),F=Z(0),u=Z(d5),f=Z({height:0,width:0}),b=Z({height:0,width:0}),k=Me(),x=Me(),T=Z(0),B=Z(null),g=Z({column:0,row:0}),w=Me(),S=Me(),A=Z(!1),D=Z(0),R=Z(!0),$=Z(!1),j=Z(!1);We(W(E,Be(D),xe(([X,ve])=>!!ve)),()=>{Ie(R,!1)}),We(W(Tt(E,R,b,f,D,$),xe(([X,ve,Fe,Ae,,Ye])=>X&&!ve&&Fe.height!==0&&Ae.height!==0&&!Ye)),([,,,,X])=>{Ie($,!0),vm(1,()=>{Ie(k,X)}),nr(W(l),()=>{Ie(t,[0,0]),Ie(R,!0)})}),pe(W(S,xe(X=>X!=null&&X.scrollTop>0),gr(0)),F),We(W(E,Be(S),xe(([,X])=>X!=null)),([,X])=>{X&&(Ie(f,X.viewport),Ie(b,X.item),Ie(g,X.gap),X.scrollTop>0&&(Ie(A,!0),nr(W(l,gs(1)),ve=>{Ie(A,!1)}),Ie(c,{top:X.scrollTop})))}),pe(W(f,se(({height:X})=>X)),p),pe(W(Tt(we(f,ad),we(b,ad),we(g,(X,ve)=>X&&X.column===ve.column&&X.row===ve.row),we(l)),se(([X,ve,Fe,Ae])=>({gap:Fe,item:ve,scrollTop:Ae,viewport:X}))),w),pe(W(Tt(we(L),r,we(g,_W),we(b,ad),we(f,ad),we(B),we(F),we(A),we(R),we(D)),xe(([,,,,,,,X])=>!X),se(([X,[ve,Fe],Ae,Ye,ge,fe,ae,,Je,Xe])=>{const{column:et,row:Rn}=Ae,{height:Nt,width:Lm}=Ye,{width:G5}=ge;if(ae===0&&(X===0||G5===0))return d5;if(Lm===0){const Y5=km(Xe,X),jq=Y5+Math.max(ae-1,0);return DW(m5(Y5,jq,fe))}const id=h5(G5,Lm,et);let Ho,Ds;Je?ve===0&&Fe===0&&ae>0?(Ho=0,Ds=ae-1):(Ho=id*rd((ve+Rn)/(Nt+Rn)),Ds=id*p5((Fe+Rn)/(Nt+Rn))-1,Ds=Om(X-1,Bc(Ds,id-1)),Ho=Om(Ds,Bc(0,Ho))):(Ho=0,Ds=-1);const j5=m5(Ho,Ds,fe),{bottom:V5,top:W5}=b5(ge,Ae,Ye,j5),q5=p5(X/id),Gq=q5*Nt+(q5-1)*Rn-V5;return{bottom:V5,itemHeight:Nt,items:j5,itemWidth:Lm,offsetBottom:Gq,offsetTop:W5,top:W5}})),u),pe(W(B,xe(X=>X!==null),se(X=>X.length)),L),pe(W(Tt(f,b,u,g),xe(([X,ve,{items:Fe}])=>Fe.length>0&&ve.height!==0&&X.height!==0),se(([X,ve,{items:Fe},Ae])=>{const{bottom:Ye,top:ge}=b5(X,Ae,ve,Fe);return[ge,Ye]}),st(vc)),t);const te=Z(!1);pe(W(l,Be(te),se(([X,ve])=>ve||X!==0)),te);const ce=kn(W(Tt(u,L),xe(([{items:X}])=>X.length>0),Be(te),xe(([[X,ve],Fe])=>{const Ae=X.items[X.items.length-1].index===ve-1;return(Fe||X.bottom>0&&X.itemHeight>0&&X.offsetBottom===0&&X.items.length===ve)&&Ae}),se(([[,X]])=>X-1),st())),Y=kn(W(we(u),xe(({items:X})=>X.length>0&&X[0].index===0),gr(0),st())),J=kn(W(we(u),Be(A),xe(([{items:X},ve])=>X.length>0&&!ve),se(([{items:X}])=>({endIndex:X[X.length-1].index,startIndex:X[0].index})),st(Dx),Qr(0)));pe(J,y.scrollSeekRangeChanged),pe(W(k,Be(f,b,L,g),se(([X,ve,Fe,Ae,Ye])=>{const ge=Rx(X),{align:fe,behavior:ae,offset:Je}=ge;let Xe=ge.index;Xe==="LAST"&&(Xe=Ae-1),Xe=Bc(0,Xe,Om(Ae-1,Xe));let et=Fm(ve,Ye,Fe,Xe);return fe==="end"?et=f5(et-ve.height+Fe.height):fe==="center"&&(et=f5(et-ve.height/2+Fe.height/2)),Je&&(et+=Je),{behavior:ae,top:et}})),c);const ye=Vt(W(u,se(X=>X.offsetBottom+X.bottom)),0);return pe(W(O,se(X=>({height:X.visibleHeight,width:X.visibleWidth}))),f),{customScrollParent:I,data:B,deviation:T,footerHeight:a,gap:g,headerHeight:s,increaseViewportBy:e,initialItemCount:F,itemDimensions:b,overscan:n,restoreStateFrom:S,scrollBy:o,scrollContainerState:i,scrollHeight:x,scrollTo:c,scrollToIndex:k,scrollTop:l,smoothScrollTargetReached:d,totalCount:L,useWindowScroll:P,viewportDimensions:f,windowScrollContainerState:v,windowScrollTo:U,windowViewportRect:O,...y,gridState:u,horizontalDirection:j,initialTopMostItemIndex:D,totalListHeight:ye,...h,endReached:ce,propsReady:C,rangeChanged:J,startReached:Y,stateChanged:w,stateRestoreInProgress:A,...M}},at(Em,Zt,Sc,Qx,Pa,Cm,Aa));function h5(e,t,n){return Bc(1,rd((e+n)/(rd(t)+n)))}function b5(e,t,n,r){const{height:a}=n;if(a===void 0||r.length===0)return{bottom:0,top:0};const s=Fm(e,t,n,r[0].index);return{bottom:Fm(e,t,n,r[r.length-1].index)+a,top:s}}function Fm(e,t,n,r){const a=h5(e.width,n.width,t.column),s=rd(r/a),o=s*n.height+Bc(0,s-1)*t.row;return o>0?o+t.row:o}const NW=je(()=>{const e=Z(p=>`Item ${p}`),t=Z({}),n=Z(null),r=Z("virtuoso-grid-item"),a=Z("virtuoso-grid-list"),s=Z(Im),o=Z("div"),i=Z(So),c=(p,h=null)=>Vt(W(t,se(y=>y[p]),st()),h),l=Z(!1),d=Z(!1);return pe(we(d),l),{components:t,computeItemKey:s,context:n,FooterComponent:c("Footer"),HeaderComponent:c("Header"),headerFooterTag:o,itemClassName:r,ItemComponent:c("Item","div"),itemContent:e,listClassName:a,ListComponent:c("List","div"),readyStateChanged:l,reportReadyState:d,ScrollerComponent:c("Scroller","div"),scrollerRef:i,ScrollSeekPlaceholder:c("ScrollSeekPlaceholder","div")}}),LW=je(([e,t])=>({...e,...t}),at(MW,NW)),zW=N.memo(function(){const e=lt("gridState"),t=lt("listClassName"),n=lt("itemClassName"),r=lt("itemContent"),a=lt("computeItemKey"),s=lt("isSeeking"),o=Ln("scrollHeight"),i=lt("ItemComponent"),c=lt("ListComponent"),l=lt("ScrollSeekPlaceholder"),d=lt("context"),p=Ln("itemDimensions"),h=Ln("gap"),y=lt("log"),E=lt("stateRestoreInProgress"),C=Ln("reportReadyState"),I=xs(N.useMemo(()=>P=>{const v=P.parentElement.parentElement.scrollHeight;o(v);const U=P.firstChild;if(U){const{height:O,width:M}=U.getBoundingClientRect();p({height:O,width:M})}h({column:g5("column-gap",getComputedStyle(P).columnGap,y),row:g5("row-gap",getComputedStyle(P).rowGap,y)})},[o,p,h,y]),!0,!1);return a5(()=>{e.itemHeight>0&&e.itemWidth>0&&C(!0)},[e]),E?null:_.jsx(c,{className:t,ref:I,...Wt(c,d),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(P=>{const v=a(P.index,P.data,d);return s?_.jsx(l,{...Wt(l,d),height:e.itemHeight,index:P.index,width:e.itemWidth},v):N.createElement(i,{...Wt(i,d),className:n,"data-index":P.index,key:v},r(P.index,P.data,d))})})}),RW=N.memo(function(){const e=lt("HeaderComponent"),t=Ln("headerHeight"),n=lt("headerFooterTag"),r=xs(N.useMemo(()=>s=>{t(Sa(s,"height"))},[t]),!0,!1),a=lt("context");return e?_.jsx(n,{ref:r,children:_.jsx(e,{...Wt(e,a)})}):null}),$W=N.memo(function(){const e=lt("FooterComponent"),t=Ln("footerHeight"),n=lt("headerFooterTag"),r=xs(N.useMemo(()=>s=>{t(Sa(s,"height"))},[t]),!0,!1),a=lt("context");return e?_.jsx(n,{ref:r,children:_.jsx(e,{...Wt(e,a)})}):null}),HW=({children:e})=>{const t=N.useContext(r5),n=Ln("itemDimensions"),r=Ln("viewportDimensions"),a=xs(N.useMemo(()=>s=>{r(s.getBoundingClientRect())},[r]),!0,!1);return N.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),_.jsx("div",{ref:a,style:nd(!1),children:e})},GW=({children:e})=>{const t=N.useContext(r5),n=Ln("windowViewportRect"),r=Ln("itemDimensions"),a=lt("customScrollParent"),s=Sx(n,a,!1);return N.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),_.jsx("div",{ref:s,style:nd(!1),children:e})},jW=N.memo(function({...e}){const t=lt("useWindowScroll"),n=lt("customScrollParent"),r=n||t?WW:VW,a=n||t?GW:HW,s=lt("context");return _.jsx(r,{...e,...Wt(r,s),children:_.jsxs(a,{children:[_.jsx(RW,{}),_.jsx(zW,{}),_.jsx($W,{})]})})}),{useEmitter:y5,useEmitterValue:lt,usePublisher:Ln}=t5(LW,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},jW),VW=l5({useEmitter:y5,useEmitterValue:lt,usePublisher:Ln}),WW=u5({useEmitter:y5,useEmitterValue:lt,usePublisher:Ln});function g5(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,ln.WARN),t==="normal"?0:parseInt(t??"0",10)}var Um={},x5;function qW(){if(x5)return Um;x5=1;var e=ku.GenIcon;return Um.AiFillQuestionCircle=function(n){return e({tag:"svg",attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 708c-22.1 0-40-17.9-40-40s17.9-40 40-40 40 17.9 40 40-17.9 40-40 40zm62.9-219.5a48.3 48.3 0 0 0-30.9 44.8V620c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8v-21.5c0-23.1 6.7-45.9 19.9-64.9 12.9-18.6 30.9-32.8 52.1-40.9 34-13.1 56-41.6 56-72.7 0-44.1-43.1-80-96-80s-96 35.9-96 80v7.6c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V420c0-39.3 17.2-76 48.4-103.3C430.4 290.4 470 276 512 276s81.6 14.5 111.6 40.7C654.8 344 672 380.7 672 420c0 57.8-38.1 109.8-97.1 132.5z"}}]})(n)},Um}var YW=qW();function KW({logo:e,className:t="",style:n={},alt:r="Token logo"}){const[a,s]=N.useState(!1);return N.useEffect(()=>{s(!1)},[e]),e&&!a?_.jsx("img",{alt:r,style:n,onError:()=>s(!0),className:`twap-token-logo ${t}`,src:e}):_.jsx(YW.AiFillQuestionCircle,{style:{width:20,height:20},className:"twap-token-svg"})}const ZW=()=>_.jsx("div",{className:"twap-orders__loader",children:_.jsx("p",{children:"Loading..."})}),XW=()=>{const{isLoading:e}=qu(),t=mx(),n=Q(s=>s.state.orderIdsToCancel),r=Q(s=>s.state.cancelOrdersMode),a=hx();return _.jsx(_.Fragment,{children:e?_.jsx(ZW,{}):t!=null&&t.length?_.jsx("div",{className:`twap-orders__list ${r?"twap-orders__list-select-mode":""}`,children:_.jsx(FW,{style:{height:"100%"},data:t,itemContent:(s,o)=>_.jsx(QW,{cancelOrdersMode:!!r,selected:(n==null?void 0:n.includes(o.id))||!1,selectOrder:a,order:o},s)})}):_.jsx(JW,{})})},QW=({order:e,selectOrder:t,selected:n,cancelOrdersMode:r})=>{const a=Q(i=>i.updateState),s=vt.useCallback(()=>{a({selectedOrderID:e==null?void 0:e.id})},[a,e==null?void 0:e.id]),o=vt.useCallback(()=>{r?t(e==null?void 0:e.id):s()},[r,t,s,e==null?void 0:e.id]);return _.jsx("div",{className:`twap-orders__list-item twap-orders__list-item-${e.status} ${r?"twap-orders__list-item-select-mode":""} ${n?"twap-orders__list-item-selected":""}`,onClick:o,children:_.jsxs("div",{className:"twap-orders__list-item-content",children:[_.jsx(eq,{order:e}),_.jsx(tq,{value:e.progress||0}),_.jsxs("div",{className:"twap-orders__list-item-tokens",children:[_.jsx(w5,{address:e.srcTokenAddress}),_.jsx(kV.HiArrowRight,{className:"twap-orders__list-item-tokens-arrow"}),_.jsx(w5,{address:e.dstTokenAddress})]})]})})},JW=()=>{const e=Q(r=>r.state.orderHistoryStatusFilter),t=ze(),n=vt.useMemo(()=>e||"",[e]);return _.jsx("div",{className:"twap-orders__list-empty",children:_.jsx("p",{children:t("noOrders",{status:n})})})},eq=({order:e})=>{const t=e&&e.status,n=px(e),r=sm(e.createdAt);return _.jsxs("div",{className:"twap-orders__list-item-header",children:[_.jsxs("p",{className:"twap-orders__list-item-header-title",children:[n," ",_.jsx("span",{children:`(${r})`})]}),_.jsx("p",{className:"twap-orders__list-item-header-status",children:t})]})},w5=e=>{const{useToken:t,components:n}=de(),r=t==null?void 0:t(e.address);return _.jsx("div",{className:"twap-orders__list-item-token",children:r?_.jsxs(_.Fragment,{children:[_.jsx("div",{className:"twap-orders__list-item-token-logo",children:n.TokenLogo?_.jsx(n.TokenLogo,{token:r}):_.jsx(KW,{logo:r==null?void 0:r.logoUrl})}),_.jsx("p",{className:"twap-orders__list-item-token-symbol",children:r==null?void 0:r.symbol})]}):_.jsx("div",{})})};function tq(e){return _.jsxs("div",{className:"twap-orders__list-item-progress",children:[_.jsx("div",{className:"twap-orders__list-item-progress-bar",children:_.jsx("div",{className:"twap-orders__list-item-progress-bar-filled",style:{width:`${e.value}%`}})}),_.jsx("div",{className:"twap-orders__list-item-token-progress-label",children:_.jsx("p",{children:`${Math.round(e.value)}%`})})]})}const nq=()=>{const e=Q(n=>n.state.selectedOrderID),t=e!==void 0;return _.jsx("div",{className:`twap-orders ${e!==void 0?"twap-orders__show-selected":""}`,children:t?_.jsx(tV,{}):_.jsx(XW,{})})},rq=e=>{const t=ze(),{marketPrice:n}=de(),r=Q(s=>s.state.typedSrcAmount);return N.useMemo(()=>{const{isError:s,value:o}=Fh(e);if(!(!s||he(r||"0").isZero()||!n))return{type:Rt.MIN_FILL_DELAY,value:o,message:t("minFillDelayError",{fillDelay:`${jd(o)} ${t("minutes")}`})}},[e,t,r,n])},ks=()=>{const e=Q(a=>a.state.typedFillDelay),t=Q(a=>a.updateState),n=N.useMemo(()=>e||Hc,[e]),r=rq(n);return{fillDelay:n,onChange:N.useCallback(a=>t({typedFillDelay:a}),[t]),error:r}},aq=()=>{const{onChange:e,fillDelay:t,error:n}=ks(),r=ze(),a=N.useCallback(o=>e({unit:t.unit,value:Number(o)}),[e,t]),s=N.useCallback(o=>e({unit:o,value:t.value}),[e,t]);return{onInputChange:a,onUnitSelect:s,onChange:e,milliseconds:t.unit*t.value,fillDelay:t,error:n,label:r("tradeIntervalTitle"),tooltip:r("tradeIntervalTootlip")}},ar=()=>{const{srcToken:e}=de(),t=ze(),n=Q(s=>s.state.typedSrcAmount),a=Q(s=>s.state.acceptedSrcAmount)||n;return{amountWei:Vu(e==null?void 0:e.decimals,a),amountUI:a,error:he(a||0).isZero()?t("enterAmount"):void 0}},sq=(e,t)=>{const{module:n,srcUsd1Token:r,marketPrice:a,minChunkSizeUsd:s}=de(),o=ze(),i=Q(c=>c.state.typedSrcAmount);return N.useMemo(()=>{if(he(i||"0").isZero()||!a)return;if(!e)return{type:Rt.MIN_CHUNKS,value:1,message:`${o("minChunksError")} 1`};const{isError:c}=Dh(e,t,n);if(c)return{type:Rt.MAX_CHUNKS,value:t,message:o("maxChunksError",{maxChunks:`${t}`})};const{isError:l,value:d}=Uh(i||"",r||"",s||0);if(l)return{type:Rt.MIN_TRADE_SIZE,value:d,message:o("minTradeSizeError",{minTradeSize:`${d}`})}},[e,t,n,i,r,s,o,a])},vr=()=>{const{srcToken:e,srcUsd1Token:t,module:n,minChunkSizeUsd:r}=de(),a=Q(C=>C.state.typedChunks),s=ks().fillDelay,o=Q(C=>C.updateState),{amountWei:i,amountUI:c}=ar(),l=N.useMemo(()=>Eh(s,c||"",t||"",r||0),[c,t,r,s]),d=N.useMemo(()=>kh(l,n,a),[l,a,n]),p=N.useCallback(C=>o({typedChunks:C}),[o]),h=N.useMemo(()=>Ch(i||"",d),[i,d]),y=tr(e==null?void 0:e.decimals,h),E=N.useMemo(()=>t?he(y||"0").times(t||0).toString():"0",[y,t]);return{totalTrades:d,maxTrades:l,amountPerTradeUI:y,amountPerTradeWei:h,amountPerTradeUsd:E,onChange:p,error:sq(d,l)}},oq=()=>{const{srcToken:e,dstToken:t}=de(),n=ze(),{onChange:r,totalTrades:a,amountPerTradeUsd:s,amountPerTradeUI:o,error:i,maxTrades:c,amountPerTradeWei:l}=vr(),d=Ve({value:o}),p=Ve({value:s});return{error:i,maxTrades:c,totalTrades:a,amountPerTrade:d,amountPerTradeWei:l,onChange:r,label:n("tradesAmountTitle"),tooltip:n("totalTradesTooltip"),amountPerTradeUsd:p,fromToken:e,toToken:t}},iq=()=>{const{srcToken:e,dstToken:t,marketPrice:n}=de(),[r,a]=N.useState(!1),s=N.useMemo(()=>{if(he(n||"0").isZero()||!t)return"0";const o=ir(t==null?void 0:t.decimals,n);return r?he(1).div(o||0).toFixed():o},[r,n,e==null?void 0:e.decimals,t==null?void 0:t.decimals]);return{fromToken:r?t:e,toToken:r?e:t,price:Ve({value:s}),priceWei:Vu(t==null?void 0:t.decimals,n),onInvert:N.useCallback(()=>a(!r),[r])}},cq=e=>{const{module:t,marketPrice:n}=de(),r=ze();return N.useMemo(()=>{const a=Bh(t,e),s=Oh(e);if(n){if(a.isError)return{type:Rt.MAX_ORDER_DURATION,value:a.value,message:r("maxDurationError",{duration:`${Math.floor(I1(a.value)).toFixed(0)} ${r("days")}`})};if(s.isError)return{type:Rt.MIN_ORDER_DURATION,value:s.value,message:r("minDurationError",{duration:`${Math.floor(jd(s.value)).toFixed(0)} ${r("minutes")}`})}}},[e,r,t,n])},Dm=()=>{const{module:e}=de(),t=Q(i=>i.state.typedDuration),n=Q(i=>i.updateState),r=vr().totalTrades,a=ks().fillDelay,s=N.useMemo(()=>vh(e,r,a,t),[r,a,t,e]),o=cq(s);return{duration:s,setDuration:N.useCallback(i=>n({typedDuration:i}),[n]),error:o}},lq=()=>{const{module:e}=de(),t=ze(),{duration:n,setDuration:r,error:a}=Dm(),s=N.useCallback(c=>{r({unit:n.unit,value:Number(c)})},[r,n]),o=N.useCallback(c=>{r({unit:c,value:n.value})},[r,n]),i=N.useMemo(()=>e===Se.STOP_LOSS?t("stopLossDurationTooltip"):t("maxDurationTooltip"),[t,e]);return{duration:n,onChange:r,milliseconds:n.unit*n.value,onInputChange:s,onUnitSelect:o,label:t("expiry"),tooltip:i,error:a}},uq=()=>{const e=Q(a=>a.state.isMarketOrder),{module:t}=de(),n=ze(),r=t===Se.STOP_LOSS||t===Se.TAKE_PROFIT;return N.useMemo(()=>{if(!r)return{text:n(e?"marketOrderWarning":"limitPriceMessage"),url:"https://www.orbs.com/dtwap-and-dlimit-faq/"}},[e,n,r])},_m=()=>{const e=Q(n=>n.state.currentTime),t=Dm().duration;return N.useMemo(()=>Th(e,t),[e,t])},sd=()=>{const{srcToken:e,dstToken:t,marketPriceLoading:n}=de(),r=Q(l=>l.updateState),a=Q(l=>l.state.isInvertedTrade),s=Q(l=>l.state.typedTriggerPrice),o=Q(l=>l.state.typedLimitPrice),i=Q(l=>l.state.isMarketOrder);return{onInvert:N.useCallback(()=>{n||(s!==void 0&&r({typedTriggerPrice:he(1).div(s).toFixed()}),o!==void 0&&r({typedLimitPrice:he(1).div(o).toFixed()}),r({isInvertedTrade:!a}))},[r,a,s,o,n]),isInverted:a,fromToken:a?t:e,toToken:a?e:t,isMarketPrice:i}},v5=({typedValue:e,tokenDecimals:t=18,initialPrice:n="0",percentage:r,setValue:a,setPercentage:s})=>{const{srcUsd1Token:o,dstUsd1Token:i}=de(),{isInverted:c}=sd(),l=N.useMemo(()=>{if(e!==void 0){const C=c?he(e).isZero()?he(0):he(1).div(e):he(e);return Rc(t,C.toFixed())}if(r!==void 0&&he(n||"0").gt(0)&&!he(n||"0").isNaN()){const C=he(n||"0"),I=he(r||0).div(100);return C.plus(C.multipliedBy(I)).decimalPlaces(0).toFixed()}return he(n).gt(0)?n:""},[e,r,t,n,c]),d=N.useCallback(C=>{a(C),s(null)},[a,s]),p=N.useCallback(C=>{a(void 0),s(C)},[a,s]),h=N.useMemo(()=>{if(!n||he(n).isZero())return"";if(r!=null)return r;if(l){const C=he(n),P=he(l).minus(C).div(C).multipliedBy(100).decimalPlaces(2).toString();return he(P||"0").isZero()?"":P}return""},[l,n,r]),y=N.useMemo(()=>{let C="";if(e!==void 0)C=e;else{const I=ir(t,l);if(he(I||"0").isZero())return"";C=c?he(1).div(I).toFixed():I}return qo(C,6,t)},[e,t,l,c]),E=ys(c?o:i,y||"0");return{amountWei:he(l).isNaN()?"":l,amountUI:he(y).isNaN()?"":y,selectedPercentage:h,onChange:d,onPercentageChange:p,isInverted:c,usd:he(E).isNaN()?"":E}},dq=()=>{const{module:e}=de();return N.useMemo(()=>e===Se.STOP_LOSS?ph:fh,[e])},Mm=()=>{const{module:e}=de(),t=Q(n=>n.state.isMarketOrder);return N.useMemo(()=>e!==Se.STOP_LOSS&&e!==Se.TAKE_PROFIT||t?void 0:e===Se.STOP_LOSS?mh:hh,[e,t])},pq=(e="")=>{const{module:t,marketPrice:n}=de(),r=ze(),a=Q(s=>s.state.typedSrcAmount);return N.useMemo(()=>{if(he(a||"0").isZero()||!n||t!==Se.STOP_LOSS&&t!==Se.TAKE_PROFIT)return;const s=Ah(n||"",e||"",t);if(s!=null&&s.isError)return{type:Rt.STOP_LOSS_TRIGGER_PRICE_GREATER_THAN_MARKET_PRICE,value:s.value,message:r("StopLossTriggerPriceError")||""};const o=Sh(n||"",e||"",t);if(o!=null&&o.isError)return{type:Rt.TAKE_PROFIT_TRIGGER_PRICE_LESS_THAN_MARKET_PRICE,value:o.value,message:r("TakeProfitTriggerPriceError")||""};if(!e||he(e||0).isZero())return{type:Rt.EMPTY_TRIGGER_PRICE,value:e,message:r("emptyTriggerPrice")||""}},[n,e,t,r,a])},fq=e=>{const{srcToken:t,dstToken:n,module:r}=de(),a=vr().amountPerTradeWei,s=Q(i=>i.state.isMarketOrder),o=N.useMemo(()=>wh(r,a,e,(t==null?void 0:t.decimals)||0),[e,a,s,t==null?void 0:t.decimals,r]);return{amountWei:o,amountUI:tr((n==null?void 0:n.decimals)||0,o)}},Es=()=>{const{dstToken:e,marketPrice:t,module:n}=de(),r=Q(y=>y.updateState),a=dq(),s=Q(y=>y.state.triggerPricePercent),o=N.useCallback(y=>{r({triggerPricePercent:y})},[r]),i=s===void 0?a:s,c=n===Se.STOP_LOSS||n===Se.TAKE_PROFIT,l=v5({typedValue:Q(y=>y.state.typedTriggerPrice),percentage:i,tokenDecimals:e==null?void 0:e.decimals,initialPrice:c?t:void 0,setValue:N.useCallback(y=>r({typedTriggerPrice:y}),[r]),setPercentage:o}),d=pq(l.amountWei),{amountWei:p,amountUI:h}=fq(l.amountWei);return N.useMemo(()=>({...l,error:d,pricePerChunkWei:p,pricePerChunkUI:h}),[l,d,p,h])},mq=()=>{const{module:e,marketPrice:t,marketPriceLoading:n}=de(),r=ze(),{amountUI:a,onChange:s,onPercentageChange:o,usd:i,selectedPercentage:c,error:l}=Es(),d=Q(v=>v.state.isMarketOrder),p=Q(v=>v.updateState),{isInverted:h,onInvert:y,fromToken:E,toToken:C}=sd(),I=N.useCallback(()=>{p({triggerPricePercent:void 0,typedTriggerPrice:void 0})},[p]),P=e!==Se.STOP_LOSS&&e!==Se.TAKE_PROFIT;return{price:a,error:l,label:r("stopLossLabel"),tooltip:e===Se.STOP_LOSS?r("stopLossTooltip"):r("takeProfitTooltip"),onChange:s,onPercentageChange:o,percentage:c,isActive:!d,onReset:I,usd:i,fromToken:E,toToken:C,prefix:"",isLoading:n||!t,isInverted:h,hide:P,onInvert:y}},hq=e=>{const{module:t,marketPrice:n}=de(),r=ze(),{amountWei:a}=Es(),s=Q(i=>i.state.isMarketOrder),o=Q(i=>i.state.typedSrcAmount);return N.useMemo(()=>{if(he(o||"0").isZero()||!a||!n)return;const i=Ph(a,e,s,t),c=Ih(a,e,s,t);if(i!=null&&i.isError)return{type:Rt.TRIGGER_LIMIT_PRICE_GREATER_THAN_TRIGGER_PRICE,message:r("triggerLimitPriceError")||"",value:i.value};if(c!=null&&c.isError)return{type:Rt.TRIGGER_LIMIT_PRICE_GREATER_THAN_TRIGGER_PRICE,message:r("triggerLimitPriceError")||"",value:c.value};if(e&&he(e||0).isZero())return{type:Rt.MISSING_LIMIT_PRICE,message:r("emptyLimitPrice")||"",value:e||""}},[e,r,a,t,s,o,n])},od=()=>{const{dstToken:e,marketPrice:t,module:n}=de(),r=Q(l=>l.updateState),a=Mm(),s=Q(l=>l.state.limitPricePercent),o=s===void 0?a:s,i=v5({typedValue:Q(l=>l.state.typedLimitPrice),percentage:o,tokenDecimals:e==null?void 0:e.decimals,initialPrice:t,setValue:N.useCallback(l=>r({typedLimitPrice:l}),[r]),setPercentage:N.useCallback(l=>{r({limitPricePercent:l})},[r,n])}),c=hq(i.amountWei);return N.useMemo(()=>({...i,error:c}),[i,c])},bq=()=>{const{module:e}=de(),t=Q(i=>i.updateState),n=Q(i=>i.state.isMarketOrder),r=Mm(),a=Q(i=>i.state.triggerPricePercent)||0,s=e===Se.LIMIT,o=N.useCallback(()=>{!n&&e===Se.STOP_LOSS&&t({limitPricePercent:r}),t({isMarketOrder:!n})},[t,a,e,n,r]);return{isLimitPrice:!n,toggleLimitPrice:o,hide:s}},yq=()=>{const{module:e,marketPriceLoading:t}=de(),n=ze(),{amountUI:r,onChange:a,onPercentageChange:s,usd:o,selectedPercentage:i,error:c}=od(),l=Q(L=>L.state.isMarketOrder),d=Q(L=>L.updateState),p=Mm(),{isLimitPrice:h,toggleLimitPrice:y}=bq(),{triggerPricePercent:E}=Q(L=>L.state),{isInverted:C,onInvert:I,fromToken:P,toToken:v}=sd(),U=N.useMemo(()=>{if(!(e!==Se.STOP_LOSS&&e!==Se.TAKE_PROFIT||!l))return{text:n("triggerMarketPriceDisclaimer"),url:wd}},[E,n,e,l]),O=N.useCallback(()=>{d({typedLimitPrice:void 0}),d({limitPricePercent:p})},[d,e,p]),M=N.useMemo(()=>e===Se.STOP_LOSS?n("stopLossLimitPriceTooltip"):n("limitPriceTooltip"),[n,e]);return{price:r,error:c,warning:U,label:n("limitPrice"),tooltip:M,onChange:a,onPercentageChange:s,onReset:O,usd:o,fromToken:P,toToken:v,percentage:i,isInverted:C,isLoading:t,isLimitPrice:h,toggleLimitPrice:y,onInvert:I}},k5=()=>{const{module:e,marketPrice:t}=de(),n=od().amountWei,r=Es().amountWei,a=Q(s=>s.state.isMarketOrder);return e===Se.LIMIT||!a?n||"":e===Se.STOP_LOSS||e===Se.TAKE_PROFIT?r||"":t||""},Oc=()=>{const{srcToken:e,dstToken:t}=de(),n=k5(),r=ar().amountWei,a=N.useMemo(()=>gh(r||"",n,(e==null?void 0:e.decimals)||0),[r,n,e==null?void 0:e.decimals]);return{amountWei:a,amountUI:tr(t==null?void 0:t.decimals,a)}},Nm=()=>{const{srcToken:e,dstToken:t,dstUsd1Token:n}=de(),r=k5(),a=vr().amountPerTradeWei,s=Q(c=>c.state.isMarketOrder),o=N.useMemo(()=>xh(a,r,!!s,(e==null?void 0:e.decimals)||0),[a,r,s,e==null?void 0:e.decimals]),i=tr(t==null?void 0:t.decimals,o);return{amountWei:o,amountUI:i,usd:ys(i,n)}},gq=()=>{const{srcUsd1Token:e,dstUsd1Token:t}=de(),n=ar().amountUI,r=Oc().amountUI,a=ys(n,e),s=ys(r,t);return{srcAmountUsd:a,dstAmountUsd:s}},xq=()=>{const{fees:e,dstUsd1Token:t}=de(),{amountUI:n}=Oc(),r=N.useMemo(()=>!e||!n?"":he(n).multipliedBy(e).dividedBy(100).toFixed(),[n]);return{amount:Ve({value:r}),percent:Ve({value:e}),usd:ys(r,t)}},wq=()=>{const e=ar().amountUI,t=Oc().amountUI,n=N.useMemo(()=>he(t||0).dividedBy(e||0).toString(),[t,e]);return Ve({value:n,decimalScale:4})},E5=()=>{const{srcToken:e,dstToken:t,account:n}=de(),r=ze(),{amountWei:a}=ar(),{amountWei:s,usd:o}=Nm(),{totalTrades:i,amountPerTradeWei:c}=vr(),{amountWei:l,usd:d}=Es(),{fillDelay:p}=ks(),h=_m(),{amountUI:y,usd:E}=od(),{amount:C,percent:I,usd:P}=xq(),v=Ve({value:wq(),decimalScale:4}),{srcAmountUsd:U,dstAmountUsd:O}=gq(),M=ux({srcToken:e,dstToken:t,srcAmount:a,minDestAmountPerTrade:s,totalTrades:i,triggerPricePerTrade:l,deadline:h,srcAmountPerTrade:c,maker:n,tradeInterval:p.unit*p.value,limitPrice:y});return N.useMemo(()=>({...M,srcAmountUsd:U,dstAmountUsd:O,fee:{label:r("fees",{value:`${I}%`}),value:C,usd:P},display:{...M.display,minDestAmountPerTrade:{...M.display.minDestAmountPerTrade,usd:o},triggerPricePerTrade:{...M.display.triggerPricePerTrade,usd:d},limitPrice:{...M.display.limitPrice,usd:E}}}),[M,I,C,r,v,e,t,U,O,o,d,P,E])},T5=()=>{const{srcBalance:e}=de(),t=ze(),n=ar().amountWei;return N.useMemo(()=>{if(e&&he(n).gt(e))return{type:Rt.INSUFFICIENT_BALANCE,message:t("insufficientFunds"),value:e||""}},[e,n,t])};function C5(){const{marketPrice:e,marketPriceLoading:t}=de(),n=Q(d=>d.state.typedSrcAmount),r=T5(),{error:a}=Es(),{error:s}=od(),{error:o}=vr(),{error:i}=ks(),{error:c}=Dm(),l=N.useMemo(()=>Go("ignore-errors"),[]);if(!(he(e||0).isZero()||he(n||0).isZero()||t||l))return a||s||o||i||c||r}const A5=()=>{const{srcToken:e,dstToken:t,chainId:n,account:r,slippage:a,config:s}=de(),o=vr().amountPerTradeWei,i=ar().amountWei,c=_m(),l=Es().pricePerChunkWei,d=Nm().amountWei,p=ks().fillDelay,h=vr().totalTrades,y=a*100,E=!h||h===1?0:p.unit*p.value;return N.useMemo(()=>{var I;const C=Ra((e==null?void 0:e.address)||"")?(I=$a(n))==null?void 0:I.wToken.address:e==null?void 0:e.address;if(!(!C||!t||!n||!r||!c||!i||!s))return Mh({chainId:n,srcToken:C,dstToken:t.address,srcAmount:i,deadlineMillis:c,fillDelayMillis:E,slippage:y,account:r,srcAmountPerTrade:o,dstMinAmountPerTrade:d,triggerAmountPerTrade:l,config:s})},[e,t,n,r,i,c,o,l,y,d,p,h,s])},vq=()=>{var c;const{account:e,walletClient:t,overrides:n,refetchBalances:r,callbacks:a,chainId:s}=de(),o=(c=gc())==null?void 0:c.wToken,i=om();return Pr({mutationFn:async({onHash:l,srcAmountWei:d})=>{var y,E;if(!e)throw new Error("missing account");if(!t)throw new Error("missing walletClient");if(!o)throw new Error("tokenAddress is not defined");let p;mt.onWrapRequest(),(y=a==null?void 0:a.onWrapRequest)==null||y.call(a),n!=null&&n.wrap?p=await n.wrap(BigInt(d)):p=await t.writeContract({abi:Xm,functionName:"deposit",account:e,address:o.address,value:BigInt(d),chain:t.chain}),l==null||l(p);const h=await i(p);if(!h)throw new Error("failed to get transaction receipt");if(h.status==="reverted")throw new Error("failed to wrap token");return mt.onWrapSuccess(p),(E=a==null?void 0:a.onWrapSuccess)==null||E.call(a,{txHash:h.transactionHash,explorerUrl:Yo(h.transactionHash,s),amount:ir(o.decimals,d)}),r==null||r(),h},onError:l=>{throw mt.onWrapError(l),l}})},kq=()=>{const{account:e,walletClient:t,chainId:n,callbacks:r}=de(),a=A5(),s=Yj();return Pr({mutationFn:async()=>{var E,C,I,P;if(!e)throw new Error("missing account");if(!t)throw new Error("missing walletClient");if(!n)throw new Error("missing chainId");if(!a)throw new Error("rePermitOrderData is not defined");const{order:o,domain:i,types:c,primaryType:l}=a;mt.onSignOrderRequest(o),(E=r==null?void 0:r.onSignOrderRequest)==null||E.call(r),console.log({domain:i,types:c,primaryType:l,message:o,account:e}),console.log("Using domain:",i),console.log("Using types:",c),console.log("Order data to sign:",JSON.stringify(o,null,2)),console.log(`Account address: ${e}`);let d;try{d=await(t==null?void 0:t.signTypedData({domain:i,types:c,primaryType:l,message:o,account:e}))}catch(v){throw(C=r==null?void 0:r.onSignOrderError)==null||C.call(r,v.message),mt.onSignOrderError(v),v}mt.onSignOrderSuccess(d),(I=r==null?void 0:r.onSignOrderSuccess)==null||I.call(r,d);const p=Vz(d),h={v:q(p.v||0),r:p.r,s:p.s},y=await $h(o,h);return(P=r==null?void 0:r.onOrderCreated)==null||P.call(r,y),s(y),y}})},S5=()=>{const{account:e,publicClient:t,config:n}=de();return Pr({mutationFn:async({tokenAddress:r,srcAmountWei:a})=>{if(!t)throw new Error("missing publicClient");if(!e)throw new Error("missing account");if(!n)throw new Error("missing config");const s=await t.readContract({address:r,abi:Lg,functionName:"allowance",args:[e,n.repermit]}).then(i=>i.toString()),o=he(s||"0").lt(he(a).toString());return{allowance:s,approvalRequired:o}}})},Eq=()=>{const{account:e,walletClient:t,overrides:n,config:r,chainId:a,callbacks:s}=de(),o=om(),{mutateAsync:i}=S5();return Pr({onError:c=>{mt.onApproveError(c)},mutationFn:async({token:c,onHash:l,srcAmountWei:d})=>{var E,C;if(!e)throw new Error("missing account");if(!t)throw new Error("missing walletClient");if(!r)throw new Error("missing config");(E=s==null?void 0:s.onApproveRequest)==null||E.call(s),mt.onApproveRequest();let p;if(n!=null&&n.approveOrder?p=await n.approveOrder({tokenAddress:c.address,spenderAddress:r.repermit,amount:Za}):p=await t.writeContract({abi:Lg,functionName:"approve",account:e,address:c.address,args:[r.repermit,Za],chain:t.chain}),!p)throw new Error("failed to approve token");l(p);const h=await o(p);if(!h)throw new Error("failed to get transaction receipt");if(h.status==="reverted")throw new Error("failed to approve token");let y=!1;for(let I=0;I<3;I++){const{approvalRequired:P}=await i({tokenAddress:c.address,srcAmountWei:d});if(!P){y=!0;break}I<2&&await new Promise(v=>setTimeout(v,3e3))}if(!y)throw new Error(`Insufficient ${c.symbol} allowance to perform the swap. Please approve the token first.`);return mt.onApproveSuccess(h.transactionHash),(C=s==null?void 0:s.onApproveSuccess)==null||C.call(s,{txHash:h.transactionHash,explorerUrl:Yo(h.transactionHash,a),token:c,amount:ir(c.decimals,d)}),h}})},Tq=()=>{const{account:e,chainId:t,srcToken:n,dstToken:r,module:a,slippage:s}=de(),o=Es(),i=ar().amountWei,c=vr().amountPerTradeWei,l=_m(),d=ks().fillDelay,p=Nm().amountWei,h=Q(y=>y.state.isMarketOrder);return Pr({mutationFn:async()=>{mt.onRequestOrder({account:e,chainId:t,module:a,srcToken:n,dstToken:r,fromTokenAmount:i,srcChunkAmount:c,triggerPricePerTrade:o.pricePerChunkWei,deadline:l,fillDelay:d.unit*d.value,minDstAmountOutPerTrade:p,slippage:s,isMarketOrder:h||!1})}})};function Cq(e){const t=e.match(/,\s*code\s*:\s*(\d+)/i);return{message:e.replace(/^error\s*:/i,"").replace(/,\s*code\s*:\s*\d+/i,"").trim()||"",code:t?Number(t[1]):0}}const Aq=()=>{const{srcToken:e,dstToken:t,chainId:n,callbacks:r}=de(),a=Eq().mutateAsync,s=vq().mutateAsync,o=kq().mutateAsync,{mutateAsync:i}=S5(),c=Q(p=>p.updateSwapExecution),{amountWei:l}=ar(),d=Tq().mutate;return Pr({mutationFn:async()=>{var h,y;const p=Ra((e==null?void 0:e.address)||" ");try{if(!e)throw new Error("missing srcToken");if(!t)throw new Error("missing dstToken");if(!n)throw new Error("missing chainId");const E=P1(e,n);c({allowanceLoading:!0});const{approvalRequired:C}=await i({tokenAddress:E.address,srcAmountWei:l});let I=0,P=1;p&&P++,C&&P++,c({totalSteps:P,stepIndex:I,allowanceLoading:!1,status:At.LOADING}),d(),p&&(c({step:Wa.WRAP}),await s({onHash:U=>c({wrapTxHash:U}),srcAmountWei:l}),I++,c({stepIndex:I})),C&&(c({step:Wa.APPROVE}),await a({token:E,onHash:U=>c({approveTxHash:U}),srcAmountWei:l}),I++,c({stepIndex:I})),c({step:Wa.CREATE});const v=await o();return c({status:At.SUCCESS,orderId:v.id}),v}catch(E){if(Gd(E))(h=r==null?void 0:r.onSubmitOrderRejected)==null||h.call(r),c({step:void 0,status:void 0,stepIndex:void 0});else{const C=Cq(E.message);(y=r==null?void 0:r.onSubmitOrderFailed)==null||y.call(r,{message:C.message||"",code:C.code||0}),c({status:At.FAILED,error:{message:C.message||"",code:C.code||0}})}}}})},Sq=()=>{const{marketPrice:e,srcToken:t,dstToken:n,marketPriceLoading:r,srcBalance:a,srcUsd1Token:s,noLiquidity:o}=de(),i=ze(),c=Aq(),l=Q(u=>u.updateState),{amountUI:d,amountWei:p}=ar(),h=Q(u=>u.resetState),y=Q(u=>u.state.swapExecution),E=Q(u=>u.state.typedSrcAmount),C=r||he(s||"0").isZero()||a===void 0||he(e||"0").isZero(),I=!!(t&&n&&E&&C),P=C5(),v=N.useMemo(()=>o?i("noLiquidity"):he(E||"0").isZero()?i("enterAmount"):(P==null?void 0:P.type)===Rt.INSUFFICIENT_BALANCE?i("insufficientFunds"):i("placeOrder"),[P,i,E,o]),U=N.useCallback(()=>{(y==null?void 0:y.status)===At.SUCCESS&&(l({typedSrcAmount:""}),setTimeout(()=>{h()},1e3))},[y==null?void 0:y.status,h,l]),O=N.useCallback(()=>{(y==null?void 0:y.status)!==At.LOADING&&l({acceptedSrcAmount:void 0,acceptedMarketPrice:void 0,swapExecution:{srcToken:t,dstToken:n}})},[l,t,n]),M=Pr({mutationFn:async()=>(l({acceptedSrcAmount:d,acceptedMarketPrice:e}),await c.mutateAsync())}),L=N.useCallback(()=>M.mutateAsync(),[M]),F=E5();return N.useMemo(()=>({resetSwap:h,onCloseModal:U,onOpenModal:O,onSubmitOrder:L,...y,swapLoading:(y==null?void 0:y.status)===At.LOADING||(y==null?void 0:y.allowanceLoading),swapSubmitted:!!(y!=null&&y.status),order:F,srcAmountWei:p,srcAmount:p,openSubmitModalButton:{disabled:!!(P||o||I||he(E||"0").isZero()||!t||!n),text:v,loading:I}}),[y,t,n,F,h,U,O,L,v,I,P,o,E])},P5=(e,t)=>{const{marketPriceLoading:n,srcToken:r,dstToken:a,srcBalance:s,dstBalance:o}=de(),i=Q(O=>O.state.typedSrcAmount),c=Q(O=>O.updateState),{srcUsd1Token:l,dstUsd1Token:d}=de(),p=ys(i,l),h=ys(t,d),y=Oj(),E=e?r:a,C=tr(E==null?void 0:E.decimals,e?s:o),I=T5(),P=N.useCallback(O=>{e&&c({typedSrcAmount:O})},[c,e]),v=N.useCallback(()=>{e&&c({typedSrcAmount:qo(C,8)})},[c,e,C]),U=y||e?i:qo(t||"",8);return{balance:C,usd:e||y?p:h,value:U||"",valueWei:Vu(E==null?void 0:E.decimals,U),onChange:P,onMax:v,isLoading:i?e?!1:n:!1,token:E,isInsufficientBalance:e?I:void 0}},Pq=()=>P5(!0),Iq=()=>{const e=Oc().amountUI,t=Q(n=>n.state.typedSrcAmount);return P5(!1,t?e:"")},Bq=()=>{const e=Q(r=>r.state.isMarketOrder),t=Q(r=>r.updateState),n=N.useCallback(()=>{t({isMarketOrder:!e})},[t,e]);return{isMarketPrice:!e,togglePrice:n}},I5=N.createContext({}),Oq=({children:e,...t})=>_.jsx(I5.Provider,{value:t,children:e}),Fq=()=>N.useContext(I5),B5=()=>{var a,s;const e=ze(),{wrapTxHash:t,srcToken:n}=Q(o=>o.state.swapExecution),r=(s=(a=gc())==null?void 0:a.wToken)==null?void 0:s.symbol;return t?_.jsx("p",{className:"twap-error-wrap-msg",children:e("wrapMsg",{symbol:(n==null?void 0:n.symbol)||"",wSymbol:r||""})}):null},Uq=(e=!1,t=1)=>{const{module:n}=de(),r=ze();return N.useMemo(()=>n===Se.STOP_LOSS?r("stopLoss"):n===Se.TAKE_PROFIT?r("takeProfit"):r(e?"twapMarket":t===1?"limit":"twapLimit"),[r,n,e,t])},Dq=({price:e,dstTokenSymbol:t,label:n,usd:r})=>_.jsxs(Ce.DetailRow,{title:n,children:[`${e||"-"} ${t||""}`,_.jsx(Ce.USD,{value:r})]}),O5=()=>{const e=ze(),t=Q(s=>s.state.isMarketOrder),n=Q(s=>s.state.swapExecution.status),{totalTrades:r}=vr(),a=Uq(t,r);return n===At.SUCCESS?e("createOrderActionSuccess",{name:a}):e("createOrderAction",{name:a})},_q=()=>{const e=Q(E=>E.state.swapExecution.srcToken),t=ze(),{step:n,wrapTxHash:r,approveTxHash:a}=Q(E=>E.state.swapExecution),s=gc(),o=am(r),i=am(r),c=am(a),l=Q(E=>E.state.swapExecution.status),p=Ra((e==null?void 0:e.address)||"")?(s==null?void 0:s.native.symbol)||"":(e==null?void 0:e.symbol)||"",h=s==null?void 0:s.wToken.symbol,y=O5();return N.useMemo(()=>n===Wa.WRAP?{title:t("wrapAction",{symbol:p}),footerLink:o,footerText:t(o?"viewOnExplorer":"proceedInWallet")}:n===Wa.APPROVE?{title:t("approveAction",{symbol:p}),footerLink:c,footerText:t(c?"viewOnExplorer":"proceedInWallet")}:{title:y,footerText:l===At.LOADING?t("proceedInWallet"):void 0},[n,c,p,y,t,o,i,h,l])},Mq=({error:e})=>_.jsxs("div",{className:"twap-error",children:[_.jsx("h2",{className:"twap-error-title",children:"Transaction failed"}),(e==null?void 0:e.code)&&_.jsxs("p",{className:"twap-error-code",children:["Error code: ",e==null?void 0:e.code]}),_.jsx(B5,{})]});function Nq({error:e}){const{components:t}=de(),n=ze(),r=Q(o=>{var i;return(i=o.state.swapExecution)==null?void 0:i.wrapTxHash}),a=t.SubmitOrderErrorView,s=_.jsx(la.Failed,{error:_.jsx(Mq,{error:e}),footerLink:wd,footerText:n("viewOnExplorer")});return a?_.jsx(a,{wrapTxHash:r,error:e,children:s}):s}const Lq=()=>{const{components:e}=de(),t=Q(h=>h.state.swapExecution.srcToken),n=Q(h=>h.state.swapExecution.dstToken),{reviewDetails:r}=Fq(),a=ze(),s=Q(h=>{var y;return!!((y=h.state.swapExecution)!=null&&y.status)}),o=E5(),i=Ve({value:o.srcAmountUsd,decimalScale:2}),c=Ve({value:o.dstAmountUsd,decimalScale:2}),l=e.USD,d=e.SubmitOrderMainView,p=_.jsxs(_.Fragment,{children:[_.jsx(la.Main,{fromTitle:a("from"),toTitle:a("to"),inUsd:l?_.jsx(l,{value:o.srcAmountUsd,isLoading:!1}):`$${i}`,outUsd:l?_.jsx(l,{value:o.dstAmountUsd,isLoading:!1}):`$${c}`}),!s&&_.jsxs("div",{className:"twap-create-order-bottom",children:[_.jsx(Ce.Container,{children:_.jsxs("div",{className:"twap-create-order-details",children:[_.jsx(Ce.Deadline,{deadline:o.display.deadline.value,label:o.display.deadline.label,tooltip:o.display.deadline.tooltip||""}),_.jsx(Ce.TriggerPrice,{price:o.display.triggerPricePerTrade.value,dstToken:n,label:o.display.triggerPricePerTrade.label,tooltip:o.display.triggerPricePerTrade.tooltip||"",usd:o.display.triggerPricePerTrade.usd}),_.jsx(Dq,{price:o.display.limitPrice.value,dstTokenSymbol:n==null?void 0:n.symbol,label:o.display.limitPrice.label,usd:o.display.limitPrice.usd}),_.jsx(Ce.MinDestAmount,{dstToken:n,dstMinAmountOut:o.display.minDestAmountPerTrade.value,label:o.display.minDestAmountPerTrade.label,tooltip:o.display.minDestAmountPerTrade.tooltip||"",usd:o.display.minDestAmountPerTrade.usd}),_.jsx(Ce.TradeSize,{tradeSize:o.display.tradeSize.value,trades:o.display.totalTrades.value,srcToken:t,label:o.display.tradeSize.label,tooltip:o.display.tradeSize.tooltip}),_.jsx(Ce.TradesAmount,{trades:o.display.totalTrades.value,label:o.display.totalTrades.label,tooltip:o.display.totalTrades.tooltip}),_.jsx(Ce.TradeInterval,{chunks:o.display.totalTrades.value,fillDelayMillis:o.display.tradeInterval.value,label:o.display.tradeInterval.label,tooltip:o.display.tradeInterval.tooltip}),_.jsx(Ce.Recipient,{}),o.fee.value&&_.jsx(Ce.Fees,{fees:o.fee.value,label:o.fee.label,usd:o.fee.usd,dstTokenSymbol:n==null?void 0:n.symbol})]})}),r]})]});return d?_.jsx(d,{children:p}):p},zq=e=>{const{status:t,stepIndex:n,totalSteps:r,error:a}=Q(v=>v.state.swapExecution),{components:s}=de(),o=s.Spinner,i=s.SuccessIcon,c=s.ErrorIcon,l=s.TokenLogo,{srcToken:d,dstToken:p}=de(),h=ar().amountUI,y=Oc().amountUI,E=Ve({value:h,decimalScale:2}),C=Ve({value:y,decimalScale:2}),I=N.useMemo(()=>({symbol:d==null?void 0:d.symbol,logoUrl:d==null?void 0:d.logoUrl}),[d]),P=N.useMemo(()=>({symbol:p==null?void 0:p.symbol,logoUrl:p==null?void 0:p.logoUrl}),[p]);return _.jsx(Oq,{...e,children:_.jsx(la,{inAmount:E,outAmount:C,swapStatus:t,totalSteps:r,currentStep:_q(),currentStepIndex:n,inToken:I,outToken:P,components:{SrcTokenLogo:l&&_.jsx(l,{token:d}),DstTokenLogo:l&&_.jsx(l,{token:p}),Failed:_.jsx(Nq,{error:a}),Success:_.jsx(Rq,{}),Main:_.jsx(Lq,{}),Loader:o,SuccessIcon:i,FailedIcon:c}})})},Rq=()=>{const e=O5(),{components:t}=de(),n=Q(s=>s.state.swapExecution.orderId),r=t.SubmitOrderSuccessView,a=_.jsxs(_.Fragment,{children:[_.jsx(la.Success,{title:e}),_.jsx(B5,{})]});return r?_.jsx(r,{newOrderId:n,children:a}):a};Lh(M3.version);const $q=()=>{const e=Q(t=>t.updateState);return{amount:Q(t=>t.state.typedSrcAmount),reset:N.useCallback(()=>e({typedSrcAmount:""}),[e])}},Hq={SubmitOrderPanel:zq,Orders:nq};H.Components=Hq,H.Configs=Lt,H.DEFAULT_DURATION_OPTIONS=nR,H.DEFAULT_FILL_DELAY=Hc,H.DEFAULT_STOP_LOSS_LIMIT_PERCENTAGE=mh,H.DEFAULT_STOP_LOSS_PERCENTAGE=ph,H.DEFAULT_TAKE_PROFIT_LIMIT_PERCENTAGE=hh,H.DEFAULT_TAKE_PROFIT_PERCENTAGE=fh,H.DISCLAIMER_URL=a3,H.EIP712_TYPES=dh,H.ERC20_ABI=zw,H.EXCLUSIVITY_OVERRIDE_BPS=Jw,H.EXECUTOR_ABI=Lw,H.FEES=Qw,H.IWETH_ABI=Xm,H.InputErrors=Rt,H.LEGACY_EXCHANGES_MAP=lh,H.LENS_ABI=Rw,H.MAX_ORDER_DURATION_MILLIS=Ms,H.MIN_CHUNKS=Zw,H.MIN_FILL_DELAY_MILLIS=$c,H.MIN_FILL_DELAY_MINUTES=ah,H.MIN_ORDER_DURATION_MILLIS=xd,H.Module=Se,H.ORBS_LOGO=t3,H.ORBS_LOGO_FALLBACK=n3,H.ORBS_SLTP_FAQ_URL=e3,H.ORBS_TWAP_FAQ_URL=wd,H.ORBS_WEBSITE_URL=r3,H.OrderStatus=tt,H.OrderType=ft,H.PRICE_PROTECTION_SETTINGS=rR,H.Partners=Jm,H.QUERY_PARAMS=Gc,H.REACTOR_ABI=Nw,H.REPERMIT_ABI=Zm,H.REPERMIT_PRIMARY_TYPE=uh,H.SUGGEST_CHUNK_VALUE=Kw,H.SpotProvider=eR,H.Steps=Wa,H.SwapStatus=At,H.THE_GRAPH_ORDERS_API=oh,H.TWAP_ABI=Qm,H.TimeUnit=qt,H.amountBN=Rc,H.amountUi=ir,H.analytics=mt,H.buildRePermitOrderData=Mh,H.copy=R8,H.ensureWrappedToken=P1,H.eqIgnoreCase=za,H.fillDelayText=C1,H.formatDecimals=qo,H.getAccountOrders=Vh,H.getApiEndpoint=gd,H.getChunks=kh,H.getConfig=Ed,H.getDeadline=Th,H.getDestTokenAmount=gh,H.getDestTokenMinAmountPerChunk=xh,H.getDuration=vh,H.getEstimatedDelayBetweenChunksMillis=kd,H.getExplorerUrl=Yo,H.getMaxChunksError=Dh,H.getMaxFillDelayError=l3,H.getMaxOrderDurationError=Bh,H.getMaxPossibleChunks=Eh,H.getMinFillDelayError=Fh,H.getMinNativeBalance=H8,H.getMinOrderDurationError=Oh,H.getMinTradeSizeError=Uh,H.getMinimumDelayMinutes=c3,H.getNetwork=$a,H.getOrderExcecutionRate=A1,H.getOrderFillDelayMillis=hd,H.getOrderLimitPriceRate=S1,H.getOrderType=G8,H.getPartnerChains=qw,H.getPartnerIdentifier=zt,H.getPartners=_h,H.getQueryParam=Go,H.getSrcTokenChunkAmount=Ch,H.getStopLossLimitPriceError=Ph,H.getStopLossPriceError=Ah,H.getTakeProfitLimitPriceError=Ih,H.getTakeProfitPriceError=Sh,H.getTriggerPricePerChunk=wh,H.isNativeAddress=Ra,H.isTxRejected=Gd,H.makeElipsisAddress=Hd,H.maxUint256=Xw,H.millisToDays=I1,H.millisToMinutes=jd,H.nativeTokenAddresses=ch,H.networks=_t,H.parseError=$8,H.removeCommas=z8,H.setApiMode=Yw,H.setUIVersion=Lh,H.shouldUnwrapOnly=Wd,H.shouldWrapOnly=Vd,H.submitOrder=$h,H.useBuildRePermitOrderDataCallback=A5,H.useDisclaimerPanel=uq,H.useDstTokenPanel=Iq,H.useDurationPanel=lq,H.useFillDelayPanel=aq,H.useFormatNumber=Ve,H.useInputErrors=C5,H.useInvertTradePanel=sd,H.useLimitPricePanel=yq,H.useMarketPricePanel=iq,H.useOrderHistoryPanel=eV,H.useSrcTokenPanel=Pq,H.useSubmitSwapPanel=Sq,H.useTogglePricePanel=Bq,H.useTradesPanel=oq,H.useTriggerPricePanel=mq,H.useTypedSrcAmount=$q,H.zeroAddress=ih,Object.defineProperty(H,Symbol.toStringTag,{value:"Module"})}));
|
|
126
|
+
`),s=!1),Object.assign(Object.assign({},e),{allowNegative:s})}function Pj(e){e=Sj(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var t=e.suffix,n=e.allowNegative,r=e.allowLeadingZeros,a=e.onKeyDown;a===void 0&&(a=nm);var s=e.onBlur;s===void 0&&(s=nm);var o=e.thousandSeparator,i=e.decimalScale,c=e.fixedDecimalScale,l=e.prefix;l===void 0&&(l="");var d=e.defaultValue,p=e.value,h=e.valueIsNumericString,y=e.onValueChange,E=pj(e,["decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","suffix","allowNegative","allowLeadingZeros","onKeyDown","onBlur","thousandSeparator","decimalScale","fixedDecimalScale","prefix","defaultValue","value","valueIsNumericString","onValueChange"]),C=ju(e),I=C.decimalSeparator,P=C.allowedDecimalSeparators,v=function(w){return lx(w,e)},U=function(w,S){return Cj(w,S,e)},O=Co(p)?d:p,M=h??Tj(O,l,t);Co(p)?Co(d)||(M=M||typeof d=="number"):M=M||typeof p=="number";var L=function(w){return rx(w)?w:(typeof w=="number"&&(w=ix(w)),M&&typeof i=="number"?cx(w,i,!!c):w)},F=vj(L(p),L(d),!!M,v,U,y),u=F[0],f=u.numAsString,b=u.formattedValue,k=F[1],x=function(w){var S=w.target,A=w.key,D=S.selectionStart,R=S.selectionEnd,$=S.value;if($===void 0&&($=""),(A==="Backspace"||A==="Delete")&&R<l.length){w.preventDefault();return}if(D!==R){a(w);return}A==="Backspace"&&$[0]==="-"&&D===l.length+1&&n&&yc(S,1),i&&c&&(A==="Backspace"&&$[D-1]===I?(yc(S,D-1),w.preventDefault()):A==="Delete"&&$[D]===I&&w.preventDefault()),P!=null&&P.includes(A)&&$[D]===I&&yc(S,D+1);var j=o===!0?",":o;A==="Backspace"&&$[D-1]===j&&yc(S,D-1),A==="Delete"&&$[D]===j&&yc(S,D+1),a(w)},T=function(w){var S=f;if(S.match(/\d/g)||(S=""),r||(S=gj(S)),c&&i&&(S=cx(S,i,c)),S!==f){var A=lx(S,e);k({formattedValue:A,value:S,floatValue:parseFloat(S)},{event:w,source:tm.event})}s(w)},B=function(w){return w===I?!0:nx(w)},g=function(w){var S=w.currentValue,A=w.lastValue,D=w.formattedValue,R=w.currentValueIndex,$=w.formattedValueIndex,j=S[R],te=D[$],ce=xj(A,S),Y=ce.to,J=function(ye){return U(ye).indexOf(".")+l.length};return p===0&&c&&i&&S[Y.start]===I&&J(S)<R&&J(D)>$?!1:R>=Y.start&&R<Y.end&&P&&P.includes(j)&&te===I?!0:j===te};return Object.assign(Object.assign({},E),{value:b,valueIsNumericString:!1,isValidInputCharacter:B,isCharacterSame:g,onValueChange:k,format:v,removeFormatting:U,getCaretBoundary:function(w){return Aj(w,e)},onKeyDown:x,onBlur:T})}const Vu=(e,t)=>N.useMemo(()=>Rc(e,t),[e,t]),tr=(e,t)=>N.useMemo(()=>ir(e,t),[e,t]),gc=()=>{const{chainId:e}=de();return N.useMemo(()=>$a(e),[e])},am=e=>{const t=gc();return N.useMemo(()=>{if(!(!e||!t))return Yo(e,t.id)},[e,t])},ys=(e,t)=>N.useMemo(()=>!e||!t||he(e||"0").isZero()||he(t||"0").isZero()?"":he(e||"0").times(t).toFixed(),[e,t]),Ij=()=>{const{srcToken:e,dstToken:t,chainId:n}=de();return N.useMemo(()=>Vd(e,t,n),[e,t,n])},Bj=()=>{const{srcToken:e,dstToken:t,chainId:n}=de();return N.useMemo(()=>Wd(e,t,n),[e,t,n])},Oj=()=>{const e=Ij(),t=Bj();return e||t},sm=e=>{const{overrides:t}=de();return N.useMemo(()=>t!=null&&t.dateFormat?t.dateFormat(e||0):re(e).format("DD/MM/YYYY HH:mm"),[e,t==null?void 0:t.dateFormat])};function Fj(){const{callbacks:e}=de();return N.useCallback(async t=>{var n;try{await navigator.clipboard.writeText(t),(n=e==null?void 0:e.onCopy)==null||n.call(e)}catch(r){console.error("Copy failed:",r)}},[e==null?void 0:e.onCopy])}const Uj=(e,t)=>N.useMemo(()=>qo(e==null?void 0:e.toString(),t),[e,t]),Ve=({value:e,decimalScale:t=3,prefix:n,suffix:r})=>{var c;const a=Uj(e,t),{overrides:s}=de(),o=s==null?void 0:s.numberFormat,i=Pj({allowLeadingZeros:!0,thousandSeparator:",",displayType:"text",value:a||"",decimalScale:18,prefix:n,suffix:r});return o?o(e||""):(c=i.value)==null?void 0:c.toString()},Dj={deadlineTooltip:"This is the date and time marking the end of the period which you have selected for your order to be executed.",tradeSizeTooltip:"The number of input tokens that will be removed from your balance and swapped for the output token in each individual trade.",totalTradesTooltip:"The total number of individual trades that will be scheduled as part of your order. Note that in limit orders, not all trades that are scheduled will be executed.",minDstAmountTooltip:" This is the minimum number of tokens that may be received. NOTE: This minimum only refers to executed trades. Some trades may not be executed if the limit price is higher than the available market prices and your order may only be partially filled.",marketPriceTooltip:"You have the option to set a “limit price” for your order. If you do not select this option, each trade in your order will execute at the available market price.",limitPriceTooltip:"Trades will only execute if the available market price is better than the limit price, potentially resulting in partial fills or orders remaining unfilled upon expiration.",outAmountLoading:"Fetching Quote...",maxDurationTooltip:"This is the time period during which the order will be active. Please note that orders may be completed earlier than this time, partially filled, or remain unfilled based on the specified parameters.",tradeIntervalTootlip:"The estimated time that will elapse between each trade in your order. Note that as this time includes an allowance of two minutes for bidder auction and block settlement, which cannot be predicted exactly, actual time may vary.",triggerPriceTooltip:"The price at which the order will be executed. If the market price is higher than the trigger price, the order will be executed at the market price.",placeOrder:"Place order",enterAmount:"Enter an amount",emptyLimitPrice:"Limit price is required",insufficientFunds:"Insufficient Balance",every:"Every",over:"Over",tradeInterval:"Trade interval",deadline:"Deadline",limitPrice:"Limit Price",finalExcecutionPrice:"Final execution price",marketPrice:"Market price",from:"From",to:"To (estimated)",Open:"Open",Completed:"Completed",Expired:"Expired",Canceled:"Canceled",minReceivedPerTrade:"Min. received per trade",triggerPricePerChunk:"Trigger Price per trade",maxChunksError:"Max. trades amount is {maxChunks}",minChunksError:"Min. trades amount is",minTradeSizeError:"Min. trade size is ${minTradeSize}",allOrders:"All",minFillDelayError:"Min. trade interval is {fillDelay}",maxFillDelayError:"Max. trade interval is {fillDelay}",recipient:"Recipient",marketOrderWarning:"Each individual trade in this order will be filled at the current market price at the time of execution.",limitPriceMessage:"Limit orders may not execute when the token's price is equal or close to the limit price, due to gas and standard swap fees.",limit:"Limit",maxDurationError:"Max. expiry is {duration}",minDurationError:"Min. expiry is {duration}",expiry:"Expiry",individualTradeSize:"Individual trade size",numberOfTrades:"No. of trades",AverageExecutionPrice:"Avg. execution price",twapMarket:"TWAP-market",twapLimit:"TWAP-limit",stopLoss:"Stop-loss",triggerPriceMarket:"Trigger Market Price ",triggerPriceLimit:"Trigger Limit Price ",takeProfit:"Take-profit",minReceived:"Min. received",minReceivedPerChunk:"Min. received per trade",noOrders:"No {status} Orders",noLiquidity:"No liquidity for this pair",excecutionSummary:"Execution summary",orderInfo:"Order info",wrapAction:"Wrap {symbol}",approveAction:"Approve {symbol}",createOrderAction:"Create {name} order",amountReceived:"Amount received",createdAt:"Created at",amountOut:"Amount out",status:"Status",progress:"Progress",minutes:"minutes",days:"days",tradeIntervalTitle:"Every",tradesAmountTitle:"Over",stopLossTooltip:"The trigger price at which your stop-loss order will be activated.",takeProfitTooltip:"The trigger price at which your take-profit order will be activated.",stopLossLabel:"Trigger Price",StopLossTriggerPriceError:"Trigger price must be less than market price",TakeProfitTriggerPriceError:"Trigger price must be greater than market price",triggerLimitPriceError:"Limit price must be less than trigger price",triggerPrice:"Trigger Price",tradePrice:"Trade Price",triggerMarketPriceDisclaimer:" In extreme market movements, slippage may occur and the executed price of the market order may be worse than the specified trigger price.",stopLossLimitPriceTooltip:"The stop loss order will execute at the specified limit price or better, once the stop price is triggered.",stopLossDurationTooltip:"This is the time period during which the order will be active. Please note that orders may be completed earlier than this time, or remain unfilled based on the specified parameters.",emptyTriggerPrice:"Trigger price is required",id:"ID",fees:"Fees {value}",version:"Version",maxOrderSizeError:"Max. trade size is {maxOrderSize} USD",viewOnExplorer:"View on explorer",proceedInWallet:"Proceed in wallet",wrapMsg:"Note: {symbol} was wrapped to {wSymbol}",createOrderActionSuccess:"{name} order placed"};function _j(e){let t=e;const n=/\{[^{}]*\}/g;for(;n.test(t);)t=t.replace(n,"");return t}const ze=()=>{const e=de();return N.useCallback((n,r)=>{var o,i;const a=(o=e.getTranslation)==null?void 0:o.call(e,n,r);if(a&&a!==n)return a;const s=((i=e.translations)==null?void 0:i[n])||Dj[n];return _j(s.replace(/{(\w+)}/g,(c,l)=>(r==null?void 0:r[l])||c))},[e.getTranslation,e.translations])},Wu=({value:e})=>{const t=Ve({value:e,decimalScale:2});return t?_.jsx("small",{className:"twap-order-details__detail-row-value-usd",children:` ($${t})`}):null},Mj=({deadline:e,label:t,tooltip:n})=>{const r=sm(e);return _.jsx(vn,{title:t,tooltip:n,children:r})},Nj=({price:e,dstToken:t,label:n,tooltip:r,usd:a})=>{const s=Ve({value:e});return he(e||0).isZero()?null:_.jsx(vn,{title:n,tooltip:r,children:_.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[`${s||"-"} ${t==null?void 0:t.symbol}`,_.jsx(Wu,{value:a})]})})},Lj=({price:e,dstToken:t,percentage:n,isMarketOrder:r})=>{const a=Ve({value:e}),s=ze();return r?null:_.jsx(vn,{title:s("limitPrice")||"",tooltip:s("limitPriceTooltip")||"",children:_.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[`${a||"-"} ${t==null?void 0:t.symbol}`,n&&_.jsx("small",{children:`(${n}%)`})]})})},zj=({tradeSize:e,srcToken:t,trades:n,label:r,tooltip:a})=>n===1?null:_.jsx(vn,{title:r,tooltip:a,children:`${e||"-"} ${(t==null?void 0:t.symbol)||""}`}),Rj=({dstToken:e,dstMinAmountOut:t,label:n,tooltip:r,usd:a})=>{const s=Ve({value:t});return he(t||0).isZero()?null:_.jsxs(vn,{title:n,tooltip:r,children:[`${t?s:"-"} ${e==null?void 0:e.symbol}`,_.jsx(Wu,{value:a})]})},$j=({trades:e,label:t,tooltip:n})=>e===1?null:_.jsx(vn,{title:t,tooltip:n,children:e}),Hj=()=>{var a;const e=ze(),{account:t}=de(),n=(a=gc())==null?void 0:a.explorer,r=Hd(t);return _.jsx(vn,{title:e("recipient")||"",children:n?_.jsx("a",{href:`${n}/address/${t}`,target:"_blank",children:r}):r})},Gj=({fillDelayMillis:e,chunks:t=0,label:n,tooltip:r})=>{const a=N.useMemo(()=>C1(e),[e]);return t===1?null:_.jsx(vn,{title:n,tooltip:r,children:a})},vn=({title:e,tooltip:t,children:n,className:r="",onClick:a,style:s})=>{const{components:o}=de(),i=o.Tooltip;return _.jsxs("div",{className:`${r} twap-order-details__detail-row`,onClick:a,style:s,children:[_.jsxs("div",{className:"twap-order-details__detail-row-label",children:[_.jsx("p",{className:"twap-order-details__detail-row-label-value",children:e}),t&&i&&_.jsx(i,{tooltipText:t})]}),_.jsx("div",{className:"twap-order-details__detail-row-value",children:n})]})},jj=({id:e})=>{const{components:t}=de(),n=t==null?void 0:t.Tooltip,r=Fj();return e.startsWith("0x")?_.jsx(vn,{title:"ID",onClick:()=>r(e),style:{cursor:"pointer"},children:n&&_.jsx(n,{tooltipText:e,children:_.jsxs("div",{className:"twap-order-details__detail-row-value-id",children:[_.jsx("p",{children:Hd(e)}),_.jsx(dR.AiOutlineCopy,{})]})})}):_.jsx(vn,{title:"ID",children:e})},Vj=({version:e})=>_.jsx(vn,{title:"Version",children:e});function Ce({children:e,className:t=""}){return _.jsx("div",{className:`${t} twap-order-details`,children:e})}const Wj=({children:e})=>e,qj=({fees:e,label:t,usd:n,dstTokenSymbol:r})=>{const a=Ve({value:e});return _.jsxs(vn,{title:t,children:[`${e?a:"-"} ${r}`,_.jsx(Wu,{value:n})]})};Ce.Deadline=Mj,Ce.Fees=qj,Ce.TradeSize=zj,Ce.MinDestAmount=Rj,Ce.TradesAmount=$j,Ce.Recipient=Hj,Ce.TradeInterval=Gj,Ce.DetailRow=vn,Ce.TriggerPrice=Nj,Ce.LimitPrice=Lj,Ce.OrderID=jj,Ce.Container=Wj,Ce.OrderVersion=Vj,Ce.USD=Wu;const om=()=>{const{publicClient:e}=de();return Pr({mutationFn:async t=>{if(!e)throw new Error("publicClient is not defined");const n=10;let r=0,a=1e3;for(;r<n;)try{return await e.waitForTransactionReceipt({hash:t,confirmations:2,retryDelay:a})}catch(s){if(r++,r>=n)throw new Error(`Failed after ${n} attempts: ${s}`);await new Promise(o=>setTimeout(o,a)),a*=2}}}).mutateAsync},ux=e=>{var c,l,d,p,h;const t=ze(),n=Ve({value:tr((c=e.srcToken)==null?void 0:c.decimals,e.srcAmount)}),r=Ve({value:tr((l=e.srcToken)==null?void 0:l.decimals,e.srcAmountPerTrade)}),a=Ve({value:tr((d=e.dstToken)==null?void 0:d.decimals,e.minDestAmountPerTrade&&he(e.minDestAmountPerTrade).lte(1)?"":e.minDestAmountPerTrade)}),s=Ve({value:tr((p=e.dstToken)==null?void 0:p.decimals,e.triggerPricePerTrade)}),o=Vu((h=e.dstToken)==null?void 0:h.decimals,e.limitPrice),i=Ve({value:e.limitPrice});return N.useMemo(()=>({data:{srcToken:e.srcToken,dstToken:e.dstToken,limitPrice:o,deadline:e.deadline,srcAmount:e.srcAmount,srcAmountPerTrade:e.srcAmountPerTrade,totalTrades:e.totalTrades,minDestAmountPerTrade:e.minDestAmountPerTrade,tradeInterval:e.tradeInterval,triggerPricePerTrade:e.triggerPricePerTrade,maker:e.maker},display:{limitPrice:{label:t("limitPrice"),value:i||""},deadline:{tooltip:t("deadlineTooltip"),label:t("deadline"),value:e.deadline||0},srcAmount:{label:t("amountOut"),value:n||"",token:e.srcToken},tradeSize:{tooltip:t("tradeSizeTooltip"),label:t("individualTradeSize"),value:r||"",token:e.srcToken},totalTrades:{tooltip:t("totalTradesTooltip"),label:t("numberOfTrades"),value:e.totalTrades||0},minDestAmountPerTrade:{tooltip:t("minDstAmountTooltip"),label:e.totalTrades&&e.totalTrades>1?t("minReceivedPerTrade"):t("minReceived"),value:a||"",token:e.dstToken},tradeInterval:{tooltip:t("tradeIntervalTootlip"),label:t("tradeInterval"),value:e.tradeInterval||0},triggerPricePerTrade:{tooltip:t("triggerPriceTooltip"),label:e.totalTrades&&e.totalTrades>1?t("triggerPricePerChunk"):t("triggerPrice"),value:s||"",token:e.dstToken},recipient:{label:t("recipient"),value:e.maker||""}}}),[e,t,n,r,a,s,i])},dx=e=>{const{orders:t}=qu(),{config:n,useToken:r}=de(),a=ze(),s=N.useMemo(()=>t==null?void 0:t.all.find(C=>C.id===e),[t,e])||{},o=px(s),i=r==null?void 0:r(s==null?void 0:s.srcTokenAddress),c=r==null?void 0:r(s==null?void 0:s.dstTokenAddress),l=Qj(i,c,s),d=Ve({value:Jj(i,c,s)}),p=Ve({value:tr(i==null?void 0:i.decimals,s==null?void 0:s.srcAmountFilled)}),h=Ve({value:tr(c==null?void 0:c.decimals,s==null?void 0:s.dstAmountFilled)}),y=Ve({value:s==null?void 0:s.progress,decimalScale:2}),E=ux({srcToken:i,dstToken:c,limitPrice:l,deadline:s==null?void 0:s.deadline,srcAmount:s==null?void 0:s.srcAmount,srcAmountPerTrade:s==null?void 0:s.srcAmountPerTrade,totalTrades:s==null?void 0:s.totalTradesAmount,minDestAmountPerTrade:s==null?void 0:s.dstMinAmountPerTrade,tradeInterval:(s==null?void 0:s.totalTradesAmount)===1||!s||!(n!=null&&n.twapConfig)?void 0:hd(s,n.twapConfig),triggerPricePerTrade:s==null?void 0:s.triggerPricePerTrade,maker:s==null?void 0:s.maker});return N.useMemo(()=>({original:s,...E,title:o,createdAt:{label:a("createdAt"),value:s==null?void 0:s.createdAt},id:{label:a("id"),value:s==null?void 0:s.id},amountInFilled:{label:a("amountOut"),value:p,token:i},amountOutFilled:{label:a("amountReceived"),value:h,token:c},progress:{label:a("progress"),value:y},excecutionPrice:{label:(s==null?void 0:s.totalTradesAmount)===1?a("finalExcecutionPrice"):a("AverageExecutionPrice"),value:d,sellToken:i,buyToken:c},version:{label:a("version"),value:s==null?void 0:s.version}}),[s,a,d,p,h,y,o,i,c,E])},px=e=>{const t=ze();return N.useMemo(()=>e?e.type===ft.TRIGGER_PRICE_MARKET?t("triggerPriceMarket"):e.type===ft.TRIGGER_PRICE_LIMIT?t("triggerPriceLimit"):e.type===ft.TWAP_MARKET?t("twapMarket"):e.type===ft.TWAP_LIMIT?t("twapLimit"):t("twapMarket"):t("twapMarket"),[t,e==null?void 0:e.type])},im=()=>{const{account:e,config:t,chainId:n}=de();return N.useMemo(()=>["useTwapOrderHistoryManager",e,t==null?void 0:t.partner,n],[e,t,n])},fx=()=>{const{account:e,config:t,chainId:n}=de(),r=`cancelled-orders-${e}-${t==null?void 0:t.partner}-${n}`,a=N.useCallback(()=>{const i=localStorage.getItem(r);return i?JSON.parse(i):[]},[r]),s=N.useCallback(i=>{const c=a();c.includes(i)||(c.push(i),localStorage.setItem(r,JSON.stringify(c)))},[a,r]),o=N.useCallback(i=>{const c=a().filter(l=>l!==i);localStorage.setItem(r,JSON.stringify(c))},[a,r]);return{getCancelledOrderIds:a,addCancelledOrderId:s,deleteCancelledOrderId:o}},Yj=()=>{const e=Vo(),{account:t}=de(),n=im();return N.useCallback(r=>{e.setQueryData(n,a=>a?a!=null&&a.some(s=>s.id===r.id)?a:[r,...a]:[r])},[e,n,t])},Kj=()=>{const e=Vo(),t=im(),n=fx();return N.useCallback(r=>{r.forEach(a=>{n.addCancelledOrderId(a)}),e.setQueryData(t,a=>a?a.map(s=>r.includes(s.id)?{...s,status:tt.Canceled}:s):[])},[e,t,n.addCancelledOrderId])},Zj=()=>{const{getCancelledOrderIds:e,deleteCancelledOrderId:t}=fx();return N.useCallback(n=>{const r=new Set(e());n.forEach((a,s)=>{r.has(a.id)&&(a.status!==tt.Canceled?(console.log(`Marking order as cancelled: ${a.id}`),n[s]={...a,status:tt.Canceled}):(console.log(`Removing cancelled ID for already-cancelled order: ${a.id}`),t(a.id)))})},[e,t])},Xj=()=>{const{account:e,config:t,chainId:n,callbacks:r,refetchBalances:a}=de(),s=im(),o=Vo(),i=Zj(),c=g8({enabled:!!(e&&n&&t),refetchInterval:tR,refetchOnWindowFocus:!0,retry:!1,staleTime:1/0,queryKey:s,queryFn:async({signal:l})=>{var E;const d=await Vh({signal:l,chainId:n,config:t==null?void 0:t.twapConfig,account:e});i(d);let p=!1;const h=o.getQueryData(s),y=[];return h&&h.forEach(C=>{var P;const I=d.find(v=>v.id===C.id);I&&I.progress!==C.progress&&(p=!0,y.push(I),I.status===tt.Completed&&((P=r==null?void 0:r.onOrderFilled)==null||P.call(r,I)))}),p&&((E=r==null?void 0:r.onOrdersProgressUpdate)==null||E.call(r,y),a==null||a()),d.map(C=>t!=null&&t.twapConfig?{...C,fillDelayMillis:hd(C,t.twapConfig)}:C)}});return{...c,isLoading:!!(e&&c.isLoading)}},qu=()=>{const{data:e,isLoading:t,error:n,refetch:r,isRefetching:a}=Xj(),{mutateAsync:s}=cm();return N.useMemo(()=>({orders:{all:e??[],open:Yu(e??[],tt.Open),completed:Yu(e??[],tt.Completed),expired:Yu(e??[],tt.Expired),canceled:Yu(e??[],tt.Canceled)},isLoading:t,error:n,refetch:()=>r().then(o=>o.data),cancelOrder:s,isRefetching:a}),[e,t,n,r,s,a])},mx=()=>{const e=Q(n=>n.state.orderHistoryStatusFilter),{orders:t}=qu();return N.useMemo(()=>e?t.all.filter(n=>n.status.toLowerCase()===e.toLowerCase())||[]:t.all,[e,t])},Yu=(e,t)=>e.filter(n=>n.status===t).sort((n,r)=>r.createdAt-n.createdAt),Qj=(e,t,n)=>N.useMemo(()=>{if(!(!e||!t||!n||n!=null&&n.isMarketPrice))return S1(n,e==null?void 0:e.decimals,t==null?void 0:t.decimals)},[n,e,t]),Jj=(e,t,n)=>N.useMemo(()=>{if(!(!e||!t||!n))return A1(n,e.decimals,t.decimals)},[n,e,t]),hx=()=>{const e=Q(n=>n.updateState),t=Q(n=>n.state.orderIdsToCancel);return N.useCallback(n=>{t!=null&&t.includes(n)?e({orderIdsToCancel:t==null?void 0:t.filter(r=>r!==n)}):e({orderIdsToCancel:[...t||[],n]})},[e,t])},eV=()=>{var F,u;const e=ze(),{orders:t,isLoading:n,refetch:r,isRefetching:a}=qu(),{mutateAsync:s,isPending:o}=cm(),i=mx(),c=Q(f=>f.updateState),l=Q(f=>f.state.orderHistoryStatusFilter),d=Q(f=>f.state.cancelOrdersMode),p=Q(f=>f.state.orderIdsToCancel),h=N.useCallback(f=>c({cancelOrdersMode:f,orderIdsToCancel:[]}),[c]),y=N.useCallback(()=>c({selectedOrderID:void 0}),[c]),E=N.useCallback(f=>s({orders:f}),[s]),C=N.useCallback(f=>c({orderHistoryStatusFilter:f}),[]),I=N.useMemo(()=>{const f=Object.keys(tt).map(b=>({text:b,value:b}));return[{text:e("allOrders"),value:""},...f]},[e]),P=hx(),v=Q(f=>f.state.selectedOrderID),U=dx(v),O=N.useMemo(()=>t.all.filter(f=>p==null?void 0:p.includes(f.id)),[t,p]),M=N.useCallback(()=>c({orderIdsToCancel:t.open.map(f=>f.id)}),[c,t]),L=N.useCallback(f=>s({orders:[f]}).then(b=>(b==null?void 0:b[0])||""),[s]);return{refetch:r,onHideSelectedOrder:y,onCancelOrders:E,onCancelOrder:L,onSelectStatus:C,onToggleCancelOrdersMode:h,onSelectOrder:P,isRefetching:a,orders:t,ordersToDisplay:i,isLoading:n,selectedOrder:v?U:void 0,openOrdersCount:((F=t==null?void 0:t.open)==null?void 0:F.length)||0,isCancelOrdersLoading:o,selectedStatus:l||((u=I[0])==null?void 0:u.value)||"",statuses:I,cancelOrdersMode:d,ordersToCancel:O,onSelectAllOrdersToCancel:M}},cm=()=>{const{account:e,walletClient:t,publicClient:n,config:r,callbacks:a,chainId:s}=de(),o=om(),i=Q(p=>p.updateState),c=Kj(),l=async p=>{mt.onCancelOrderRequest(p.map(h=>h.id.toString()),1);try{return(await Promise.all(p.map(y=>t.writeContract({account:e,address:y.twapAddress,abi:Qm,functionName:"cancel",args:[y.id],chain:t.chain}))))[0]}catch(h){throw mt.onCancelOrderError(h),h}},d=async p=>{var h;try{mt.onCancelOrderRequest(p.map(C=>C.hash),2);const y=await t.writeContract({account:e,address:r.repermit,abi:Zm,functionName:"cancel",args:[p.map(C=>C.hash)],chain:t.chain}),E=await o(y);if(!E)throw new Error("failed to get transaction receipt");if(E.status==="reverted")throw new Error("failed to cancel order");return mt.onCancelOrderSuccess(y),(h=a==null?void 0:a.onCancelOrderSuccess)==null||h.call(a,{orders:p,txHash:y,explorerUrl:Yo(y,s)}),E.transactionHash}catch(y){throw mt.onCancelOrderError(y),y}};return Pr({mutationFn:async({orders:p})=>{var h,y;if(!e||!t||!n||!r)throw new Error("missing required parameters");try{(h=a==null?void 0:a.onCancelOrderRequest)==null||h.call(a,p),i({cancelOrderStatus:At.LOADING,cancelOrderTxHash:void 0,cancelOrderError:void 0});const E=p.filter(v=>v.version===1),C=p.filter(v=>v.version===2),[I,P]=await Promise.all([E.length?l(E):Promise.resolve(""),C.length?d(C):Promise.resolve("")]);return i({cancelOrderStatus:At.SUCCESS,orderIdsToCancel:[]}),c(p.map(v=>v.id)),[...I||[],P]}catch(E){console.error("cancel order error",E),(y=a==null?void 0:a.onCancelOrderFailed)==null||y.call(a,E.message),Gd(E)?i({cancelOrderStatus:void 0}):(i({cancelOrderStatus:At.FAILED}),mt.onCancelOrderError(E))}}})},bx=N.createContext({}),jt=()=>N.useContext(bx),tV=()=>{const e=Q(c=>c.state.selectedOrderID),t=dx(e),n=ze(),[r,a]=N.useState("panel1"),{components:s}=de(),o=s.TokenLogo;N.useEffect(()=>{a("panel1")},[t.id.value]);const i=c=>{a(r===c?!1:c)};return t?_.jsx(bx.Provider,{value:{order:t},children:_.jsxs("div",{className:"twap-orders__selected-order",children:[_.jsx(T1,{SrcTokenLogo:o&&_.jsx(o,{token:t.data.srcToken}),DstTokenLogo:o&&_.jsx(o,{token:t.data.dstToken}),fromTitle:n("from"),inToken:t.data.srcToken,toTitle:n("to"),outToken:t.data.dstToken}),_.jsx(Ce.Container,{children:_.jsxs("div",{className:"twap-orders__selected-order-bottom",children:[_.jsxs("div",{className:"twap-orders__selected-order-accordions",children:[_.jsx(yx,{title:n("excecutionSummary"),onClick:()=>i("panel1"),expanded:r==="panel1",children:_.jsx(uV,{})}),_.jsx(yx,{title:n("orderInfo"),expanded:r==="panel2",onClick:()=>i("panel2"),children:_.jsx(nV,{})})]}),_.jsx(pV,{})]})})]})}):null},yx=({expanded:e,onClick:t,children:n,title:r})=>_.jsxs("div",{className:"twap-orders__selected-order-accordion",children:[_.jsxs("div",{onClick:t,className:"twap-orders__selected-order-accordion-trigger",children:[_.jsx("p",{children:r}),_.jsx(lR.IoIosArrowDown,{style:{transform:e?"rotate(180deg)":"rotate(0deg)"}})]}),e&&_.jsx("div",{className:"twap-orders__selected-order-accordion-details",children:n})]}),nV=()=>_.jsxs(Ce,{children:[_.jsx(lV,{}),_.jsx(fV,{}),_.jsx(oV,{}),_.jsx(mV,{}),_.jsx(rV,{}),_.jsx(aV,{}),_.jsx(sV,{}),_.jsx(iV,{}),_.jsx(cV,{}),_.jsx(xV,{}),_.jsx(Ce.Recipient,{})]}),rV=()=>{const{order:e}=jt();return _.jsx(Ce.TradeSize,{tradeSize:e.display.tradeSize.value,srcToken:e.data.srcToken,label:e.display.tradeSize.label,tooltip:e.display.tradeSize.tooltip,trades:e.display.totalTrades.value})},aV=()=>{const{order:e}=jt();return _.jsx(Ce.TradesAmount,{trades:e.display.totalTrades.value,label:e.display.totalTrades.label,tooltip:e.display.totalTrades.tooltip})},sV=()=>{const{order:e}=jt();return _.jsx(Ce.MinDestAmount,{dstToken:e.data.dstToken,dstMinAmountOut:e.display.minDestAmountPerTrade.value,label:e.display.minDestAmountPerTrade.label,tooltip:e.display.minDestAmountPerTrade.tooltip})},oV=()=>{const{order:e}=jt();return _.jsx(Ce.Deadline,{deadline:e.display.deadline.value,label:e.display.deadline.label,tooltip:e.display.deadline.tooltip})},iV=()=>{const{order:e}=jt();return _.jsx(Ce.TradeInterval,{fillDelayMillis:e.display.tradeInterval.value,chunks:e.display.totalTrades.value,label:e.display.tradeInterval.label,tooltip:e.display.tradeInterval.tooltip})},cV=()=>{const{order:e}=jt();return _.jsx(Ce.TriggerPrice,{dstToken:e.data.dstToken,price:e.display.triggerPricePerTrade.value,label:e.display.triggerPricePerTrade.label,tooltip:e.display.triggerPricePerTrade.tooltip})},lV=()=>{const{order:e}=jt();return _.jsx(Ce.OrderID,{id:e.id.value||""})},uV=()=>_.jsxs(Ce,{children:[_.jsx(yV,{}),_.jsx(hV,{}),_.jsx(dV,{}),_.jsx(gV,{}),_.jsx(wV,{})]}),dV=()=>{var n;const{order:e}=jt(),t=Ve({value:e.amountOutFilled.value,decimalScale:3});return e.amountOutFilled.value?_.jsx(Ce.DetailRow,{title:e.amountOutFilled.label,children:_.jsxs("p",{children:[t||"-"," ",(n=e.data.dstToken)==null?void 0:n.symbol]})}):null},pV=()=>{const{order:e}=jt(),{mutateAsync:t,isPending:n}=cm(),{components:r}=de(),a=r.Button,s=N.useCallback(async()=>t({orders:[e.original]}),[t,e]);return!e||e.original.status!==tt.Open||!a?null:_.jsx(a,{loading:n,onClick:s,disabled:n,className:"twap-cancel-order",children:"Cancel"})},fV=()=>{const{order:e}=jt(),t=ze(),n=sm(e.createdAt.value);return _.jsx(Ce.DetailRow,{title:t("createdAt")||"",children:_.jsx("p",{children:n})})},mV=()=>{var r;const{order:e}=jt(),t=ze(),n=Ve({value:e.display.srcAmount.value,decimalScale:3});return _.jsx(Ce.DetailRow,{title:t("amountOut")||"",children:_.jsxs("p",{children:[n||0," ",(r=e.data.srcToken)==null?void 0:r.symbol]})})},hV=()=>{var n;const{order:e}=jt(),t=Ve({value:e.amountInFilled.value,decimalScale:3});return _.jsx(Ce.DetailRow,{title:e.amountInFilled.label,children:_.jsxs("p",{children:[t||"-"," ",(n=e.data.srcToken)==null?void 0:n.symbol]})})},bV=()=>{const{order:e}=jt(),t=ze();return N.useMemo(()=>{switch(e.original.status){case tt.Open:return t("Open")||"";case tt.Completed:return t("Completed")||"";case tt.Expired:return t("Expired")||"";case tt.Canceled:return t("Canceled")||""}},[e.original.status,t])},yV=()=>{const e=ze(),t=bV();return _.jsx(Ce.DetailRow,{title:e("status")||"",children:_.jsx("p",{children:t})})},gV=()=>{const{order:e}=jt(),t=Ve({value:e.progress.value,decimalScale:2});return _.jsx(Ce.DetailRow,{title:e.progress.label,children:_.jsxs("p",{children:[t||0,"%"]})})},xV=()=>{const{order:e}=jt(),t=ze();return e.display.limitPrice.value?_.jsx(gx,{title:t("limitPrice")||"",price:e.display.limitPrice.value,srcToken:e.data.srcToken,dstToken:e.data.dstToken}):null},wV=()=>{const{order:e}=jt();return e.excecutionPrice.value?_.jsx(gx,{title:e.excecutionPrice.label,price:e.excecutionPrice.value,srcToken:e.data.srcToken,dstToken:e.data.dstToken}):null},gx=({price:e,srcToken:t,dstToken:n,title:r})=>{const a=Ve({value:e,decimalScale:3});return _.jsx(Ce.DetailRow,{title:r,children:he(e||0).isZero()?_.jsx("p",{children:"-"}):_.jsxs("p",{children:["1 ",t==null?void 0:t.symbol," = ",a," ",n==null?void 0:n.symbol]})})};var lm={},xx;function vV(){if(xx)return lm;xx=1;var e=ku.GenIcon;return lm.HiArrowRight=function(n){return e({tag:"svg",attr:{viewBox:"0 0 20 20",fill:"currentColor"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M10.293 3.293a1 1 0 011.414 0l6 6a1 1 0 010 1.414l-6 6a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-4.293-4.293a1 1 0 010-1.414z",clipRule:"evenodd"}}]})(n)},lm}var kV=vV();const Ku=0,Ca=1,Ao=2,wx=4;function vx(e){return()=>e}function EV(e){e()}function kx(e,t){return n=>e(t(n))}function Ex(e,t){return()=>e(t)}function TV(e,t){return n=>e(t,n)}function um(e){return e!==void 0}function CV(...e){return()=>{e.map(EV)}}function So(){}function Zu(e,t){return t(e),e}function AV(e,t){return t(e)}function at(...e){return e}function We(e,t){return e(Ca,t)}function Ie(e,t){e(Ku,t)}function dm(e){e(Ao)}function ct(e){return e(wx)}function pe(e,t){return We(e,TV(t,Ku))}function nr(e,t){const n=e(Ca,r=>{n(),t(r)});return n}function Tx(e){let t,n;return r=>a=>{t=a,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function Cx(e,t){return e===t}function st(e=Cx){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function xe(e){return t=>n=>{e(n)&&t(n)}}function se(e){return t=>kx(t,e)}function gr(e){return t=>()=>{t(e)}}function W(e,...t){const n=SV(...t);return(r,a)=>{switch(r){case Ao:dm(e);return;case Ca:return We(e,n(a))}}}function xr(e,t){return n=>r=>{n(t=e(t,r))}}function gs(e){return t=>n=>{e>0?e--:t(n)}}function Qr(e){let t=null,n;return r=>a=>{t=a,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function Be(...e){const t=new Array(e.length);let n=0,r=null;const a=Math.pow(2,e.length)-1;return e.forEach((s,o)=>{const i=Math.pow(2,o);We(s,c=>{const l=n;n=n|i,t[o]=c,l!==a&&n===a&&r&&(r(),r=null)})}),s=>o=>{const i=()=>{s([o].concat(t))};n===a?i():r=i}}function SV(...e){return t=>e.reduceRight(AV,t)}function PV(e){let t,n;const r=()=>t==null?void 0:t();return function(a,s){switch(a){case Ca:return s?n===s?void 0:(r(),n=s,t=We(e,s),t):(r(),So);case Ao:r(),n=null;return}}}function Z(e){let t=e;const n=Me();return(r,a)=>{switch(r){case Ku:t=a;break;case Ca:{a(t);break}case wx:return t}return n(r,a)}}function Vt(e,t){return Zu(Z(t),n=>pe(e,n))}function Me(){const e=[];return(t,n)=>{switch(t){case Ku:e.slice().forEach(r=>{r(n)});return;case Ao:e.splice(0,e.length);return;case Ca:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)}}}}function kn(e){return Zu(Me(),t=>pe(e,t))}function je(e,t=[],{singleton:n}={singleton:!0}){return{constructor:e,dependencies:t,id:IV(),singleton:n}}const IV=()=>Symbol();function BV(e){const t=new Map,n=({constructor:r,dependencies:a,id:s,singleton:o})=>{if(o&&t.has(s))return t.get(s);const i=r(a.map(c=>n(c)));return o&&t.set(s,i),i};return n(e)}function Tt(...e){const t=Me(),n=new Array(e.length);let r=0;const a=Math.pow(2,e.length)-1;return e.forEach((s,o)=>{const i=Math.pow(2,o);We(s,c=>{n[o]=c,r=r|i,r===a&&Ie(t,n)})}),function(s,o){switch(s){case Ao:{dm(t);return}case Ca:return r===a&&o(n),We(t,o)}}}function we(e,t=Cx){return W(e,st(t))}function pm(...e){return function(t,n){switch(t){case Ao:return;case Ca:return CV(...e.map(r=>We(r,n)))}}}var ln=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(ln||{});const OV={0:"debug",3:"error",1:"log",2:"warn"},FV=()=>typeof globalThis>"u"?window:globalThis,Aa=je(()=>{const e=Z(3);return{log:Z((t,n,r=1)=>{var a;const s=(a=FV().VIRTUOSO_LOG_LEVEL)!=null?a:ct(e);r>=s&&console[OV[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,n)}),logLevel:e}},[],{singleton:!0});function xs(e,t,n){return fm(e,t,n).callbackRef}function fm(e,t,n){const r=N.useRef(null);let a=o=>{};const s=N.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(o=>{const i=()=>{const c=o[0].target;c.offsetParent!==null&&e(c)};n?i():requestAnimationFrame(i)}):null,[e,n]);return a=o=>{o&&t?(s==null||s.observe(o),r.current=o):(r.current&&(s==null||s.unobserve(r.current)),r.current=null)},{callbackRef:a,ref:r}}function UV(e,t,n,r,a,s,o,i,c){const l=N.useCallback(d=>{const p=DV(d.children,t,i?"offsetWidth":"offsetHeight",a);let h=d.parentElement;for(;!h.dataset.virtuosoScroller;)h=h.parentElement;const y=h.lastElementChild.dataset.viewportType==="window";let E;y&&(E=h.ownerDocument.defaultView);const C=o?i?o.scrollLeft:o.scrollTop:y?i?E.scrollX||E.document.documentElement.scrollLeft:E.scrollY||E.document.documentElement.scrollTop:i?h.scrollLeft:h.scrollTop,I=o?i?o.scrollWidth:o.scrollHeight:y?i?E.document.documentElement.scrollWidth:E.document.documentElement.scrollHeight:i?h.scrollWidth:h.scrollHeight,P=o?i?o.offsetWidth:o.offsetHeight:y?i?E.innerWidth:E.innerHeight:i?h.offsetWidth:h.offsetHeight;r({scrollHeight:I,scrollTop:Math.max(C,0),viewportHeight:P}),s==null||s(i?Ax("column-gap",getComputedStyle(d).columnGap,a):Ax("row-gap",getComputedStyle(d).rowGap,a)),p!==null&&e(p)},[e,t,a,s,o,r,i]);return fm(l,n,c)}function DV(e,t,n,r){const a=e.length;if(a===0)return null;const s=[];for(let o=0;o<a;o++){const i=e.item(o);if(i.dataset.index===void 0)continue;const c=parseInt(i.dataset.index),l=parseFloat(i.dataset.knownSize),d=t(i,n);if(d===0&&r("Zero-sized element, this should not happen",{child:i},ln.ERROR),d===l)continue;const p=s[s.length-1];s.length===0||p.size!==d||p.endIndex!==c-1?s.push({endIndex:c,size:d,startIndex:c}):s[s.length-1].endIndex++}return s}function Ax(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,ln.WARN),t==="normal"?0:parseInt(t??"0",10)}function Sx(e,t,n){const r=N.useRef(null),a=N.useCallback(c=>{if(!(c!=null&&c.offsetParent))return;const l=c.getBoundingClientRect(),d=l.width;let p,h;if(t){const y=t.getBoundingClientRect(),E=l.top-y.top;h=y.height-Math.max(0,E),p=E+t.scrollTop}else{const y=o.current.ownerDocument.defaultView;h=y.innerHeight-Math.max(0,l.top),p=l.top+y.scrollY}r.current={offsetTop:p,visibleHeight:h,visibleWidth:d},e(r.current)},[e,t]),{callbackRef:s,ref:o}=fm(a,!0,n),i=N.useCallback(()=>{a(o.current)},[a,o]);return N.useEffect(()=>{var c;if(t){t.addEventListener("scroll",i);const l=new ResizeObserver(()=>{requestAnimationFrame(i)});return l.observe(t),()=>{t.removeEventListener("scroll",i),l.unobserve(t)}}else{const l=(c=o.current)==null?void 0:c.ownerDocument.defaultView;return l==null||l.addEventListener("scroll",i),l==null||l.addEventListener("resize",i),()=>{l==null||l.removeEventListener("scroll",i),l==null||l.removeEventListener("resize",i)}}},[i,t,o]),s}const Zt=je(()=>{const e=Me(),t=Me(),n=Z(0),r=Me(),a=Z(0),s=Me(),o=Me(),i=Z(0),c=Z(0),l=Z(0),d=Z(0),p=Me(),h=Me(),y=Z(!1),E=Z(!1),C=Z(!1);return pe(W(e,se(({scrollTop:I})=>I)),t),pe(W(e,se(({scrollHeight:I})=>I)),o),pe(t,a),{deviation:n,fixedFooterHeight:l,fixedHeaderHeight:c,footerHeight:d,headerHeight:i,horizontalDirection:E,scrollBy:h,scrollContainerState:e,scrollHeight:o,scrollingInProgress:y,scrollTo:p,scrollTop:t,skipAnimationFrameInResizeObserver:C,smoothScrollTargetReached:r,statefulScrollTop:a,viewportHeight:s}},[],{singleton:!0}),xc={lvl:0};function Px(e,t){const n=e.length;if(n===0)return[];let{index:r,value:a}=t(e[0]);const s=[];for(let o=1;o<n;o++){const{index:i,value:c}=t(e[o]);s.push({end:i-1,start:r,value:a}),r=i,a=c}return s.push({end:1/0,start:r,value:a}),s}function Ze(e){return e===xc}function wc(e,t){if(!Ze(e))return t===e.k?e.v:t<e.k?wc(e.l,t):wc(e.r,t)}function rr(e,t,n="k"){if(Ze(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){const r=rr(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return rr(e.l,t,n)}function En(e,t,n){return Ze(e)?Ox(t,n,1):t===e.k?It(e,{k:t,v:n}):t<e.k?Fx(It(e,{l:En(e.l,t,n)})):Fx(It(e,{r:En(e.r,t,n)}))}function Po(){return xc}function Io(e,t,n){if(Ze(e))return[];const r=rr(e,t)[0];return _V(hm(e,r,n))}function mm(e,t){if(Ze(e))return xc;const{k:n,l:r,r:a}=e;if(t===n){if(Ze(r))return a;if(Ze(a))return r;{const[s,o]=Bx(r);return Xu(It(e,{k:s,l:Ix(r),v:o}))}}else return t<n?Xu(It(e,{l:mm(r,t)})):Xu(It(e,{r:mm(a,t)}))}function ws(e){return Ze(e)?[]:[...ws(e.l),{k:e.k,v:e.v},...ws(e.r)]}function hm(e,t,n){if(Ze(e))return[];const{k:r,l:a,r:s,v:o}=e;let i=[];return r>t&&(i=i.concat(hm(a,t,n))),r>=t&&r<=n&&i.push({k:r,v:o}),r<=n&&(i=i.concat(hm(s,t,n))),i}function Xu(e){const{l:t,lvl:n,r}=e;if(r.lvl>=n-1&&t.lvl>=n-1)return e;if(n>r.lvl+1){if(bm(t))return Ux(It(e,{lvl:n-1}));if(!Ze(t)&&!Ze(t.r))return It(t.r,{l:It(t,{r:t.r.l}),lvl:n,r:It(e,{l:t.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}else{if(bm(e))return ym(It(e,{lvl:n-1}));if(!Ze(r)&&!Ze(r.l)){const a=r.l,s=bm(a)?r.lvl-1:r.lvl;return It(a,{l:It(e,{lvl:n-1,r:a.l}),lvl:a.lvl+1,r:ym(It(r,{l:a.r,lvl:s}))})}else throw new Error("Unexpected empty nodes")}}function It(e,t){return Ox(t.k!==void 0?t.k:e.k,t.v!==void 0?t.v:e.v,t.lvl!==void 0?t.lvl:e.lvl,t.l!==void 0?t.l:e.l,t.r!==void 0?t.r:e.r)}function Ix(e){return Ze(e.r)?e.l:Xu(It(e,{r:Ix(e.r)}))}function bm(e){return Ze(e)||e.lvl>e.r.lvl}function Bx(e){return Ze(e.r)?[e.k,e.v]:Bx(e.r)}function Ox(e,t,n,r=xc,a=xc){return{k:e,l:r,lvl:n,r:a,v:t}}function Fx(e){return ym(Ux(e))}function Ux(e){const{l:t}=e;return!Ze(t)&&t.lvl===e.lvl?It(t,{r:It(e,{l:t.r})}):e}function ym(e){const{lvl:t,r:n}=e;return!Ze(n)&&!Ze(n.r)&&n.lvl===t&&n.r.lvl===t?It(n,{l:It(e,{r:n.l}),lvl:t+1}):e}function _V(e){return Px(e,({k:t,v:n})=>({index:t,value:n}))}function Dx(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function vc(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}const gm=je(()=>({recalcInProgress:Z(!1)}),[],{singleton:!0});function _x(e,t,n){return e[Qu(e,t,n)]}function Qu(e,t,n,r=0){let a=e.length-1;for(;r<=a;){const s=Math.floor((r+a)/2),o=e[s],i=n(o,t);if(i===0)return s;if(i===-1){if(a-r<2)return s-1;a=s-1}else{if(a===r)return s;r=s+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function MV(e,t,n,r){const a=Qu(e,t,r),s=Qu(e,n,r,a);return e.slice(a,s+1)}function Sa(e,t){return Math.round(e.getBoundingClientRect()[t])}function Ju(e){return!Ze(e.groupOffsetTree)}function xm({index:e},t){return t===e?0:t<e?-1:1}function NV(){return{groupIndices:[],groupOffsetTree:Po(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:Po()}}function LV(e,t){let n=Ze(e)?0:1/0;for(const r of t){const{endIndex:a,size:s,startIndex:o}=r;if(n=Math.min(n,o),Ze(e)){e=En(e,0,s);continue}const i=Io(e,o-1,a+1);if(i.some(VV(r)))continue;let c=!1,l=!1;for(const{end:d,start:p,value:h}of i)c?(a>=p||s===h)&&(e=mm(e,p)):(l=h!==s,c=!0),d>a&&a>=p&&h!==s&&(e=En(e,a+1,h));l&&(e=En(e,o,s))}return[e,n]}function zV(e){return typeof e.groupIndex<"u"}function RV({offset:e},t){return t===e?0:t<e?-1:1}function kc(e,t,n){if(t.length===0)return 0;const{index:r,offset:a,size:s}=_x(t,e,xm),o=e-r,i=s*o+(o-1)*n+a;return i>0?i+n:i}function Mx(e,t){if(!Ju(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function Nx(e,t,n){if(zV(e))return t.groupIndices[e.groupIndex]+1;{const r=e.index==="LAST"?n:e.index;let a=Mx(r,t);return a=Math.max(0,a,Math.min(n,a)),a}}function $V(e,t,n,r=0){return r>0&&(t=Math.max(t,_x(e,r,xm).offset)),Px(MV(e,t,n,RV),jV)}function HV(e,[t,n,r,a]){t.length>0&&r("received item sizes",t,ln.DEBUG);const s=e.sizeTree;let o=s,i=0;if(n.length>0&&Ze(s)&&t.length===2){const h=t[0].size,y=t[1].size;o=n.reduce((E,C)=>En(En(E,C,h),C+1,y),o)}else[o,i]=LV(o,t);if(o===s)return e;const{lastIndex:c,lastOffset:l,lastSize:d,offsetTree:p}=wm(e.offsetTree,i,o,a);return{groupIndices:n,groupOffsetTree:n.reduce((h,y)=>En(h,y,kc(y,p,a)),Po()),lastIndex:c,lastOffset:l,lastSize:d,offsetTree:p,sizeTree:o}}function GV(e){return ws(e).map(({k:t,v:n},r,a)=>{const s=a[r+1];return{endIndex:s?s.k-1:1/0,size:n,startIndex:t}})}function Lx(e,t){let n=0,r=0;for(;n<e;)n+=t[r+1]-t[r]-1,r++;return r-(n===e?0:1)}function wm(e,t,n,r){let a=e,s=0,o=0,i=0,c=0;if(t!==0){c=Qu(a,t-1,xm),i=a[c].offset;const l=rr(n,t-1);s=l[0],o=l[1],a.length&&a[c].size===rr(n,t)[1]&&(c-=1),a=a.slice(0,c+1)}else a=[];for(const{start:l,value:d}of Io(n,t,1/0)){const p=l-s,h=p*o+i+p*r;a.push({index:l,offset:h,size:d}),s=l,i=h,o=d}return{lastIndex:s,lastOffset:i,lastSize:o,offsetTree:a}}function jV(e){return{index:e.index,value:e}}function VV(e){const{endIndex:t,size:n,startIndex:r}=e;return a=>a.start===r&&(a.end===t||a.end===1/0)&&a.value===n}const WV={offsetHeight:"height",offsetWidth:"width"},wr=je(([{log:e},{recalcInProgress:t}])=>{const n=Me(),r=Me(),a=Vt(r,0),s=Me(),o=Me(),i=Z(0),c=Z([]),l=Z(void 0),d=Z(void 0),p=Z(void 0),h=Z(void 0),y=Z((F,u)=>Sa(F,WV[u])),E=Z(void 0),C=Z(0),I=NV(),P=Vt(W(n,Be(c,e,C),xr(HV,I),st()),I),v=Vt(W(c,st(),xr((F,u)=>({current:u,prev:F.current}),{current:[],prev:[]}),se(({prev:F})=>F)),[]);pe(W(c,xe(F=>F.length>0),Be(P,C),se(([F,u,f])=>{const b=F.reduce((k,x,T)=>En(k,x,kc(x,u.offsetTree,f)||T),Po());return{...u,groupIndices:F,groupOffsetTree:b}})),P),pe(W(r,Be(P),xe(([F,{lastIndex:u}])=>F<u),se(([F,{lastIndex:u,lastSize:f}])=>[{endIndex:u,size:f,startIndex:F}])),n),pe(l,d);const U=Vt(W(l,se(F=>F===void 0)),!0);pe(W(d,xe(F=>F!==void 0&&Ze(ct(P).sizeTree)),se(F=>{const u=ct(p),f=ct(c).length>0;return u?f?[{endIndex:0,size:u,startIndex:0},{endIndex:1,size:F,startIndex:1}]:[]:[{endIndex:0,size:F,startIndex:0}]})),n),pe(W(h,xe(F=>F!==void 0&&F.length>0&&Ze(ct(P).sizeTree)),se(F=>{const u=[];let f=F[0],b=0;for(let k=1;k<F.length;k++){const x=F[k];x!==f&&(u.push({endIndex:k-1,size:f,startIndex:b}),f=x,b=k)}return u.push({endIndex:F.length-1,size:f,startIndex:b}),u})),n),pe(W(c,Be(p,d),xe(([,F,u])=>F!==void 0&&u!==void 0),se(([F,u,f])=>{const b=[];for(let k=0;k<F.length;k++){const x=F[k],T=F[k+1];b.push({startIndex:x,endIndex:x,size:u}),T!==void 0&&b.push({startIndex:x+1,endIndex:T-1,size:f})}return b})),n);const O=kn(W(n,Be(P),xr(({sizes:F},[u,f])=>({changed:f!==F,sizes:f}),{changed:!1,sizes:I}),se(F=>F.changed)));We(W(i,xr((F,u)=>({diff:F.prev-u,prev:u}),{diff:0,prev:0}),se(F=>F.diff)),F=>{const{groupIndices:u}=ct(P);if(F>0)Ie(t,!0),Ie(s,F+Lx(F,u));else if(F<0){const f=ct(v);f.length>0&&(F-=Lx(-F,f)),Ie(o,F)}}),We(W(i,Be(e)),([F,u])=>{F<0&&u("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:i},ln.ERROR)});const M=kn(s);pe(W(s,Be(P),se(([F,u])=>{const f=u.groupIndices.length>0,b=[],k=u.lastSize;if(f){const x=wc(u.sizeTree,0);let T=0,B=0;for(;T<F;){const w=u.groupIndices[B],S=u.groupIndices.length===B+1?1/0:u.groupIndices[B+1]-w-1;b.push({endIndex:w,size:x,startIndex:w}),b.push({endIndex:w+1+S-1,size:k,startIndex:w+1}),B++,T+=S+1}const g=ws(u.sizeTree);return T!==F&&g.shift(),g.reduce((w,{k:S,v:A})=>{let D=w.ranges;return w.prevSize!==0&&(D=[...w.ranges,{endIndex:S+F-1,size:w.prevSize,startIndex:w.prevIndex}]),{prevIndex:S+F,prevSize:A,ranges:D}},{prevIndex:F,prevSize:0,ranges:b}).ranges}return ws(u.sizeTree).reduce((x,{k:T,v:B})=>({prevIndex:T+F,prevSize:B,ranges:[...x.ranges,{endIndex:T+F-1,size:x.prevSize,startIndex:x.prevIndex}]}),{prevIndex:0,prevSize:k,ranges:[]}).ranges})),n);const L=kn(W(o,Be(P,C),se(([F,{offsetTree:u},f])=>{const b=-F;return kc(b,u,f)})));return pe(W(o,Be(P,C),se(([F,u,f])=>{if(u.groupIndices.length>0){if(Ze(u.sizeTree))return u;let b=Po();const k=ct(v);let x=0,T=0,B=0;for(;x<-F;){B=k[T];const g=k[T+1]-B-1;T++,x+=g+1}if(b=ws(u.sizeTree).reduce((g,{k:w,v:S})=>En(g,Math.max(0,w+F),S),b),x!==-F){const g=wc(u.sizeTree,B);b=En(b,0,g);const w=rr(u.sizeTree,-F+1)[1];b=En(b,1,w)}return{...u,sizeTree:b,...wm(u.offsetTree,0,b,f)}}else{const b=ws(u.sizeTree).reduce((k,{k:x,v:T})=>En(k,Math.max(0,x+F),T),Po());return{...u,sizeTree:b,...wm(u.offsetTree,0,b,f)}}})),P),{beforeUnshiftWith:M,data:E,defaultItemSize:d,firstItemIndex:i,fixedItemSize:l,fixedGroupSize:p,gap:C,groupIndices:c,heightEstimates:h,itemSize:y,listRefresh:O,shiftWith:o,shiftWithOffset:L,sizeRanges:n,sizes:P,statefulTotalCount:a,totalCount:r,trackItemSizes:U,unshiftWith:s}},at(Aa,gm),{singleton:!0});function qV(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{groupIndices:[],totalCount:0})}const zx=je(([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:r,scrollTop:a}])=>{const s=Me(),o=Me(),i=kn(W(s,se(qV)));return pe(W(i,se(c=>c.totalCount)),n),pe(W(i,se(c=>c.groupIndices)),e),pe(W(Tt(a,t,r),xe(([c,l])=>Ju(l)),se(([c,l,d])=>rr(l.groupOffsetTree,Math.max(c-d,0),"v")[0]),st(),se(c=>[c])),o),{groupCounts:s,topItemsIndexes:o}},at(wr,Zt)),Pa=je(([{log:e}])=>{const t=Z(!1),n=kn(W(t,xe(r=>r),st()));return We(t,r=>{r&&ct(e)("props updated",{},ln.DEBUG)}),{didMount:n,propsReady:t}},at(Aa),{singleton:!0}),YV=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function Rx(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!YV)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const Ec=je(([{gap:e,listRefresh:t,sizes:n,totalCount:r},{fixedFooterHeight:a,fixedHeaderHeight:s,footerHeight:o,headerHeight:i,scrollingInProgress:c,scrollTo:l,smoothScrollTargetReached:d,viewportHeight:p},{log:h}])=>{const y=Me(),E=Me(),C=Z(0);let I=null,P=null,v=null;function U(){I&&(I(),I=null),v&&(v(),v=null),P&&(clearTimeout(P),P=null),Ie(c,!1)}return pe(W(y,Be(n,p,r,C,i,o,h),Be(e,s,a),se(([[O,M,L,F,u,f,b,k],x,T,B])=>{const g=Rx(O),{align:w,behavior:S,offset:A}=g,D=F-1,R=Nx(g,M,D);let $=kc(R,M.offsetTree,x)+f;w==="end"?($+=T+rr(M.sizeTree,R)[1]-L+B,R===D&&($+=b)):w==="center"?$+=(T+rr(M.sizeTree,R)[1]-L+B)/2:$-=u,A&&($+=A);const j=te=>{U(),te?(k("retrying to scroll to",{location:O},ln.DEBUG),Ie(y,O)):(Ie(E,!0),k("list did not change, scroll successful",{},ln.DEBUG))};if(U(),S==="smooth"){let te=!1;v=We(t,ce=>{te=te||ce}),I=nr(d,()=>{j(te)})}else I=nr(W(t,KV(150)),j);return P=setTimeout(()=>{U()},1200),Ie(c,!0),k("scrolling from index to",{behavior:S,index:R,top:$},ln.DEBUG),{behavior:S,top:$}})),l),{scrollTargetReached:E,scrollToIndex:y,topListHeight:C}},at(wr,Zt,Aa),{singleton:!0});function KV(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return r=>{r&&(t(!0),clearTimeout(n))}}}function vm(e,t){e==0?t():requestAnimationFrame(()=>{vm(e-1,t)})}function km(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}const Tc=je(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:a,scrollToIndex:s},{didMount:o}])=>{const i=Z(!0),c=Z(0),l=Z(!0);return pe(W(o,Be(c),xe(([d,p])=>!!p),gr(!1)),i),pe(W(o,Be(c),xe(([d,p])=>!!p),gr(!1)),l),We(W(Tt(t,o),Be(i,n,e,l),xe(([[,d],p,{sizeTree:h},y,E])=>d&&(!Ze(h)||um(y))&&!p&&!E),Be(c)),([,d])=>{nr(a,()=>{Ie(l,!0)}),vm(4,()=>{nr(r,()=>{Ie(i,!0)}),Ie(s,d)})}),{initialItemFinalLocationReached:l,initialTopMostItemIndex:c,scrolledToInitialItem:i}},at(wr,Zt,Ec,Pa),{singleton:!0});function $x(e,t){return Math.abs(e-t)<1.01}const Cc="up",Ac="down",ZV="none",XV={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},QV=0,Sc=je(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:a,viewportHeight:s}])=>{const o=Z(!1),i=Z(!0),c=Me(),l=Me(),d=Z(4),p=Z(QV),h=Vt(W(pm(W(we(a),gs(1),gr(!0)),W(we(a),gs(1),gr(!1),Tx(100))),st()),!1),y=Vt(W(pm(W(n,gr(!0)),W(n,gr(!1),Tx(200))),st()),!1);pe(W(Tt(we(a),we(p)),se(([v,U])=>v<=U),st()),i),pe(W(i,Qr(50)),l);const E=kn(W(Tt(r,we(s),we(t),we(e),we(d)),xr((v,[{scrollHeight:U,scrollTop:O},M,L,F,u])=>{const f=O+M-U>-u,b={scrollHeight:U,scrollTop:O,viewportHeight:M};if(f){let x,T;return O>v.state.scrollTop?(x="SCROLLED_DOWN",T=v.state.scrollTop-O):(x="SIZE_DECREASED",T=v.state.scrollTop-O||v.scrollTopDelta),{atBottom:!0,atBottomBecause:x,scrollTopDelta:T,state:b}}let k;return b.scrollHeight>v.state.scrollHeight?k="SIZE_INCREASED":M<v.state.viewportHeight?k="VIEWPORT_HEIGHT_DECREASING":O<v.state.scrollTop?k="SCROLLING_UPWARDS":k="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:k,state:b}},XV),st((v,U)=>v&&v.atBottom===U.atBottom))),C=Vt(W(r,xr((v,{scrollHeight:U,scrollTop:O,viewportHeight:M})=>{if($x(v.scrollHeight,U))return{changed:!1,jump:0,scrollHeight:U,scrollTop:O};{const L=U-(O+M)<1;return v.scrollTop!==O&&L?{changed:!0,jump:v.scrollTop-O,scrollHeight:U,scrollTop:O}:{changed:!0,jump:0,scrollHeight:U,scrollTop:O}}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),xe(v=>v.changed),se(v=>v.jump)),0);pe(W(E,se(v=>v.atBottom)),o),pe(W(o,Qr(50)),c);const I=Z(Ac);pe(W(r,se(({scrollTop:v})=>v),st(),xr((v,U)=>ct(y)?{direction:v.direction,prevScrollTop:U}:{direction:U<v.prevScrollTop?Cc:Ac,prevScrollTop:U},{direction:Ac,prevScrollTop:0}),se(v=>v.direction)),I),pe(W(r,Qr(50),gr(ZV)),I);const P=Z(0);return pe(W(h,xe(v=>!v),gr(0)),P),pe(W(a,Qr(100),Be(h),xe(([v,U])=>!!U),xr(([v,U],[O])=>[U,O],[0,0]),se(([v,U])=>U-v)),P),{atBottomState:E,atBottomStateChange:c,atBottomThreshold:d,atTopStateChange:l,atTopThreshold:p,isAtBottom:o,isAtTop:i,isScrolling:h,lastJumpDueToItemResize:C,scrollDirection:I,scrollVelocity:P}},at(Zt)),Pc="top",Ic="bottom",Hx="none";function Gx(e,t,n){return typeof e=="number"?n===Cc&&t===Pc||n===Ac&&t===Ic?e:0:n===Cc?t===Pc?e.main:e.reverse:t===Ic?e.main:e.reverse}function jx(e,t){var n;return typeof e=="number"?e:(n=e[t])!=null?n:0}const Em=je(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:a}])=>{const s=Me(),o=Z(0),i=Z(0),c=Z(0),l=Vt(W(Tt(we(r),we(a),we(n),we(s,vc),we(c),we(o),we(t),we(e),we(i)),se(([d,p,h,[y,E],C,I,P,v,U])=>{const O=d-v,M=I+P,L=Math.max(h-O,0);let F=Hx;const u=jx(U,Pc),f=jx(U,Ic);return y-=v,y+=h+P,E+=h+P,E-=v,y>d+M-u&&(F=Cc),E<d-L+p+f&&(F=Ac),F!==Hx?[Math.max(O-h-Gx(C,Pc,F)-u,0),O-L-P+p+Gx(C,Ic,F)+f]:null}),xe(d=>d!=null),st(vc)),[0,0]);return{increaseViewportBy:i,listBoundary:s,overscan:c,topListHeight:o,visibleRange:l}},at(Zt),{singleton:!0});function JV(e,t,n){if(Ju(t)){const r=Mx(e,t);return[{index:rr(t.groupOffsetTree,r)[0],offset:0,size:0},{data:n==null?void 0:n[0],index:r,offset:0,size:0}]}return[{data:n==null?void 0:n[0],index:e,offset:0,size:0}]}const Tm={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function ed(e,t,n,r,a,s){const{lastIndex:o,lastOffset:i,lastSize:c}=a;let l=0,d=0;if(e.length>0){l=e[0].offset;const C=e[e.length-1];d=C.offset+C.size}const p=n-o,h=i+p*c+(p-1)*r,y=l,E=h-d;return{bottom:d,firstItemIndex:s,items:Wx(e,a,s),offsetBottom:E,offsetTop:l,top:y,topItems:Wx(t,a,s),topListHeight:t.reduce((C,I)=>I.size+C,0),totalCount:n}}function Vx(e,t,n,r,a,s){let o=0;if(n.groupIndices.length>0)for(const d of n.groupIndices){if(d-o>=e)break;o++}const i=e+o,c=km(t,i),l=Array.from({length:i}).map((d,p)=>({data:s[p+c],index:p+c,offset:0,size:0}));return ed(l,[],i,a,n,r)}function Wx(e,t,n){if(e.length===0)return[];if(!Ju(t))return e.map(l=>({...l,index:l.index+n,originalIndex:l.index}));const r=e[0].index,a=e[e.length-1].index,s=[],o=Io(t.groupOffsetTree,r,a);let i,c=0;for(const l of e){(!i||i.end<l.index)&&(i=o.shift(),c=t.groupIndices.indexOf(i.start));let d;l.index===i.start?d={index:c,type:"group"}:d={groupIndex:c,index:l.index-(c+1)+n},s.push({...d,data:l.data,offset:l.offset,originalIndex:l.index,size:l.size})}return s}function qx(e,t){var n;return e===void 0?0:typeof e=="number"?e:(n=e[t])!=null?n:0}const vs=je(([{data:e,firstItemIndex:t,gap:n,sizes:r,totalCount:a},s,{listBoundary:o,topListHeight:i,visibleRange:c},{initialTopMostItemIndex:l,scrolledToInitialItem:d},{topListHeight:p},h,{didMount:y},{recalcInProgress:E}])=>{const C=Z([]),I=Z(0),P=Me(),v=Z(0);pe(s.topItemsIndexes,C);const U=Vt(W(Tt(y,E,we(c,vc),we(a),we(r),we(l),d,we(C),we(t),we(n),we(v),e),xe(([F,u,,f,,,,,,,,b])=>{const k=b&&b.length!==f;return F&&!u&&!k}),se(([,,[F,u],f,b,k,x,T,B,g,w,S])=>{var A,D,R,$;const j=b,{offsetTree:te,sizeTree:ce}=j,Y=ct(I);if(f===0)return{...Tm,totalCount:f};if(F===0&&u===0)return Y===0?{...Tm,totalCount:f}:Vx(Y,k,b,B,g,S||[]);if(Ze(ce))return Y>0?null:ed(JV(km(k,f),j,S),[],f,g,j,B);const J=[];if(T.length>0){const ge=T[0],fe=T[T.length-1];let ae=0;for(const Je of Io(ce,ge,fe)){const Xe=Je.value,et=Math.max(Je.start,ge),Rn=Math.min(Je.end,fe);for(let Nt=et;Nt<=Rn;Nt++)J.push({data:S==null?void 0:S[Nt],index:Nt,offset:ae,size:Xe}),ae+=Xe}}if(!x)return ed([],J,f,g,j,B);const ye=T.length>0?T[T.length-1]+1:0,X=$V(te,F,u,ye);if(X.length===0)return null;const ve=f-1,Fe=Zu([],ge=>{for(const fe of X){const ae=fe.value;let Je=ae.offset,Xe=fe.start;const et=ae.size;if(ae.offset<F){Xe+=Math.floor((F-ae.offset+g)/(et+g));const Nt=Xe-fe.start;Je+=Nt*et+Nt*g}Xe<ye&&(Je+=(ye-Xe)*et,Xe=ye);const Rn=Math.min(fe.end,ve);for(let Nt=Xe;Nt<=Rn&&!(Je>=u);Nt++)ge.push({data:S==null?void 0:S[Nt],index:Nt,offset:Je,size:et}),Je+=et+g}}),Ae=qx(w,Pc),Ye=qx(w,Ic);if(Fe.length>0&&(Ae>0||Ye>0)){const ge=Fe[0],fe=Fe[Fe.length-1];if(Ae>0&&ge.index>ye){const ae=Math.min(Ae,ge.index-ye),Je=[];let Xe=ge.offset;for(let et=ge.index-1;et>=ge.index-ae;et--){const Rn=(D=(A=Io(ce,et,et)[0])==null?void 0:A.value)!=null?D:ge.size;Xe-=Rn+g,Je.unshift({data:S==null?void 0:S[et],index:et,offset:Xe,size:Rn})}Fe.unshift(...Je)}if(Ye>0&&fe.index<ve){const ae=Math.min(Ye,ve-fe.index);let Je=fe.offset+fe.size+g;for(let Xe=fe.index+1;Xe<=fe.index+ae;Xe++){const et=($=(R=Io(ce,Xe,Xe)[0])==null?void 0:R.value)!=null?$:fe.size;Fe.push({data:S==null?void 0:S[Xe],index:Xe,offset:Je,size:et}),Je+=et+g}}}return ed(Fe,J,f,g,j,B)}),xe(F=>F!==null),st()),Tm);pe(W(e,xe(um),se(F=>F==null?void 0:F.length)),a),pe(W(U,se(F=>F.topListHeight)),p),pe(p,i),pe(W(U,se(F=>[F.top,F.bottom])),o),pe(W(U,se(F=>F.items)),P);const O=kn(W(U,xe(({items:F})=>F.length>0),Be(a,e),xe(([{items:F},u])=>F[F.length-1].originalIndex===u-1),se(([,F,u])=>[F-1,u]),st(vc),se(([F])=>F))),M=kn(W(U,Qr(200),xe(({items:F,topItems:u})=>F.length>0&&F[0].originalIndex===u.length),se(({items:F})=>F[0].index),st())),L=kn(W(U,xe(({items:F})=>F.length>0),se(({items:F})=>{let u=0,f=F.length-1;for(;F[u].type==="group"&&u<f;)u++;for(;F[f].type==="group"&&f>u;)f--;return{endIndex:F[f].index,startIndex:F[u].index}}),st(Dx)));return{endReached:O,initialItemCount:I,itemsRendered:P,listState:U,minOverscanItemCount:v,rangeChanged:L,startReached:M,topItemsIndexes:C,...h}},at(wr,zx,Em,Tc,Ec,Sc,Pa,gm),{singleton:!0}),Yx=je(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:a}])=>{const s=Me(),o=Vt(W(Tt(n,e,r,t,a),se(([i,c,l,d,p])=>i+c+l+d+p.offsetBottom+p.bottom)),0);return pe(we(o),s),{totalListHeight:o,totalListHeightChanged:s}},at(Zt,vs),{singleton:!0}),eW=je(([{viewportHeight:e},{totalListHeight:t}])=>{const n=Z(!1),r=Vt(W(Tt(n,e,t),xe(([a])=>a),se(([,a,s])=>Math.max(0,a-s)),Qr(0),st()),0);return{alignToBottom:n,paddingTopAddition:r}},at(Zt,Yx),{singleton:!0}),Kx=je(()=>({context:Z(null)})),tW=({itemBottom:e,itemTop:t,locationParams:{align:n,behavior:r,...a},viewportBottom:s,viewportTop:o})=>t<o?{...a,align:n??"start",behavior:r}:e>s?{...a,align:n??"end",behavior:r}:null,Zx=je(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:a,headerHeight:s,scrollingInProgress:o,scrollTop:i,viewportHeight:c},{scrollToIndex:l}])=>{const d=Me();return pe(W(d,Be(t,c,n,s,a,r,i),Be(e),se(([[p,h,y,E,C,I,P,v],U])=>{const{align:O,behavior:M,calculateViewLocation:L=tW,done:F,...u}=p,f=Nx(p,h,E-1),b=kc(f,h.offsetTree,U)+C+I,k=b+rr(h.sizeTree,f)[1],x=v+I,T=v+y-P,B=L({itemBottom:k,itemTop:b,locationParams:{align:O,behavior:M,...u},viewportBottom:T,viewportTop:x});return B?F&&nr(W(o,xe(g=>!g),gs(ct(o)?1:2)),F):F&&F(),B}),xe(p=>p!==null)),l),{scrollIntoView:d}},at(wr,Zt,Ec,vs,Aa),{singleton:!0});function Xx(e){return e?e==="smooth"?"smooth":"auto":!1}const nW=(e,t)=>typeof e=="function"?Xx(e(t)):t&&Xx(e),rW=je(([{listRefresh:e,totalCount:t,fixedItemSize:n,data:r},{atBottomState:a,isAtBottom:s},{scrollToIndex:o},{scrolledToInitialItem:i},{didMount:c,propsReady:l},{log:d},{scrollingInProgress:p},{context:h},{scrollIntoView:y}])=>{const E=Z(!1),C=Me();let I=null;function P(M){Ie(o,{align:"end",behavior:M,index:"LAST"})}We(W(Tt(W(we(t),gs(1)),c),Be(we(E),s,i,p),se(([[M,L],F,u,f,b])=>{let k=L&&f,x="auto";return k&&(x=nW(F,u||b),k=k&&!!x),{followOutputBehavior:x,shouldFollow:k,totalCount:M}}),xe(({shouldFollow:M})=>M)),({followOutputBehavior:M,totalCount:L})=>{I&&(I(),I=null),ct(n)?requestAnimationFrame(()=>{ct(d)("following output to ",{totalCount:L},ln.DEBUG),P(M)}):I=nr(e,()=>{ct(d)("following output to ",{totalCount:L},ln.DEBUG),P(M),I=null})});function v(M){const L=nr(a,F=>{M&&!F.atBottom&&F.notAtBottomBecause==="SIZE_INCREASED"&&!I&&(ct(d)("scrolling to bottom due to increased size",{},ln.DEBUG),P("auto"))});setTimeout(L,100)}We(W(Tt(we(E),t,l),xe(([M,,L])=>M&&L),xr(({value:M},[,L])=>({refreshed:M===L,value:L}),{refreshed:!1,value:0}),xe(({refreshed:M})=>M),Be(E,t)),([,M])=>{ct(i)&&v(M!==!1)}),We(C,()=>{v(ct(E)!==!1)}),We(Tt(we(E),a),([M,L])=>{M&&!L.atBottom&&L.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&P("auto")});const U=Z(null),O=Me();return pe(pm(W(we(r),se(M=>{var L;return(L=M==null?void 0:M.length)!=null?L:0})),W(we(t))),O),We(W(Tt(W(O,gs(1)),c),Be(we(U),i,p,h),se(([[M,L],F,u,f,b])=>L&&u&&(F==null?void 0:F({context:b,totalCount:M,scrollingInProgress:f}))),xe(M=>!!M),Qr(0)),M=>{I&&(I(),I=null),ct(n)?requestAnimationFrame(()=>{ct(d)("scrolling into view",{}),Ie(y,M)}):I=nr(e,()=>{ct(d)("scrolling into view",{}),Ie(y,M),I=null})}),{autoscrollToBottom:C,followOutput:E,scrollIntoViewOnChange:U}},at(wr,Sc,Ec,Tc,Pa,Aa,Zt,Kx,Zx)),aW=je(([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:a},{initialItemCount:s,listState:o},{didMount:i}])=>(pe(W(i,Be(s),xe(([,c])=>c!==0),Be(a,r,t,n,e),se(([[,c],l,d,p,h,y=[]])=>Vx(c,l,d,p,h,y))),o),{}),at(wr,Tc,vs,Pa),{singleton:!0}),sW=je(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=Z(0);return We(W(e,Be(r),xe(([,a])=>a!==0),se(([,a])=>({top:a}))),a=>{nr(W(n,gs(1),xe(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{Ie(t,a)})})}),{initialScrollTop:r}},at(Pa,Zt,vs),{singleton:!0}),Qx=je(([{scrollVelocity:e}])=>{const t=Z(!1),n=Me(),r=Z(!1);return pe(W(e,Be(r,t,n),xe(([a,s])=>!!s),se(([a,s,o,i])=>{const{enter:c,exit:l}=s;if(o){if(l(a,i))return!1}else if(c(a,i))return!0;return o}),st()),t),We(W(Tt(t,e,n),Be(r)),([[a,s,o],i])=>{a&&i&&i.change&&i.change(s,o)}),{isSeeking:t,scrollSeekConfiguration:r,scrollSeekRangeChanged:n,scrollVelocity:e}},at(Sc),{singleton:!0}),Cm=je(([{scrollContainerState:e,scrollTo:t}])=>{const n=Me(),r=Me(),a=Me(),s=Z(!1),o=Z(void 0);return pe(W(Tt(n,r),se(([{scrollHeight:i,scrollTop:c,viewportHeight:l},{offsetTop:d}])=>({scrollHeight:i,scrollTop:Math.max(0,c-d),viewportHeight:l}))),e),pe(W(t,Be(r),se(([i,{offsetTop:c}])=>({...i,top:i.top+c}))),a),{customScrollParent:o,useWindowScroll:s,windowScrollContainerState:n,windowScrollTo:a,windowViewportRect:r}},at(Zt)),oW=je(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:a},{didMount:s},{useWindowScroll:o,windowScrollContainerState:i,windowViewportRect:c}])=>{const l=Me(),d=Z(void 0),p=Z(null),h=Z(null);return pe(i,p),pe(c,h),We(W(l,Be(t,r,o,p,h,n)),([y,E,C,I,P,v,U])=>{const O=GV(E.sizeTree);I&&P!==null&&v!==null&&(C=P.scrollTop-v.offsetTop),C-=U,y({ranges:O,scrollTop:C})}),pe(W(d,xe(um),se(iW)),a),pe(W(s,Be(d),xe(([,y])=>y!==void 0),st(),se(([,y])=>y.ranges)),e),{getState:l,restoreStateFrom:d}},at(wr,Zt,Tc,Pa,Cm));function iW(e){return{align:"start",index:0,offset:e.scrollTop}}const cW=je(([{topItemsIndexes:e}])=>{const t=Z(0);return pe(W(t,xe(n=>n>=0),se(n=>Array.from({length:n}).map((r,a)=>a))),e),{topItemCount:t}},at(vs));function Jx(e){let t=!1,n;return()=>(t||(t=!0,n=e()),n)}const lW=Jx(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),uW=je(([{deviation:e,scrollBy:t,scrollingInProgress:n,scrollTop:r},{isAtBottom:a,isScrolling:s,lastJumpDueToItemResize:o,scrollDirection:i},{listState:c},{beforeUnshiftWith:l,gap:d,shiftWithOffset:p,sizes:h},{log:y},{recalcInProgress:E}])=>{const C=kn(W(c,Be(o),xr(([,P,v,U],[{bottom:O,items:M,offsetBottom:L,totalCount:F},u])=>{const f=O+L;let b=0;return v===F&&P.length>0&&M.length>0&&(M[0].originalIndex===0&&P[0].originalIndex===0||(b=f-U,b!==0&&(b+=u))),[b,M,F,f]},[0,[],0,0]),xe(([P])=>P!==0),Be(r,i,n,a,y,E),xe(([,P,v,U,,,O])=>!O&&!U&&P!==0&&v===Cc),se(([[P],,,,,v])=>(v("Upward scrolling compensation",{amount:P},ln.DEBUG),P))));function I(P){P>0?(Ie(t,{behavior:"auto",top:-P}),Ie(e,0)):(Ie(e,0),Ie(t,{behavior:"auto",top:-P}))}return We(W(C,Be(e,s)),([P,v,U])=>{U&&lW()?Ie(e,v-P):I(-P)}),We(W(Tt(Vt(s,!1),e,E),xe(([P,v,U])=>!P&&!U&&v!==0),se(([P,v])=>v),Qr(1)),I),pe(W(p,se(P=>({top:-P}))),t),We(W(l,Be(h,d),se(([P,{groupIndices:v,lastSize:U,sizeTree:O},M])=>{function L(F){return F*(U+M)}if(v.length===0)return L(P);{let F=0;const u=wc(O,0);let f=0,b=0;for(;f<P;){f++,F+=u;let k=v.length===b+1?1/0:v[b+1]-v[b]-1;f+k>P&&(F-=u,k=P-f+1),f+=k,F+=L(k),b++}return F}})),P=>{Ie(e,P),requestAnimationFrame(()=>{Ie(t,{top:P}),requestAnimationFrame(()=>{Ie(e,0),Ie(E,!1)})})}),{deviation:e}},at(Zt,Sc,vs,wr,Aa,gm)),dW=je(([e,t,n,r,a,s,o,i,c,l,d])=>({...e,...t,...n,...r,...a,...s,...o,...i,...c,...l,...d}),at(Em,aW,Pa,Qx,Yx,sW,eW,Cm,Zx,Aa,Kx)),e5=je(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,fixedGroupSize:a,gap:s,groupIndices:o,heightEstimates:i,itemSize:c,sizeRanges:l,sizes:d,statefulTotalCount:p,totalCount:h,trackItemSizes:y},{initialItemFinalLocationReached:E,initialTopMostItemIndex:C,scrolledToInitialItem:I},P,v,U,O,{scrollToIndex:M},L,{topItemCount:F},{groupCounts:u},f])=>{const{listState:b,minOverscanItemCount:k,topItemsIndexes:x,rangeChanged:T,...B}=O;return pe(T,f.scrollSeekRangeChanged),pe(W(f.windowViewportRect,se(g=>g.visibleHeight)),P.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:r,fixedGroupHeight:a,gap:s,groupCounts:u,heightEstimates:i,initialItemFinalLocationReached:E,initialTopMostItemIndex:C,scrolledToInitialItem:I,sizeRanges:l,topItemCount:F,topItemsIndexes:x,totalCount:h,...U,groupIndices:o,itemSize:c,listState:b,minOverscanItemCount:k,scrollToIndex:M,statefulTotalCount:p,trackItemSizes:y,rangeChanged:T,...B,...f,...P,sizes:d,...v}},at(wr,Tc,Zt,oW,rW,vs,Ec,uW,cW,zx,dW));function pW(e,t){const n={},r={};let a=0;const s=e.length;for(;a<s;)r[e[a]]=1,a+=1;for(const o in t)Object.hasOwn(r,o)||(n[o]=t[o]);return n}const td=typeof document<"u"?N.useLayoutEffect:N.useEffect;function t5(e,t,n){const r=Object.keys(t.required||{}),a=Object.keys(t.optional||{}),s=Object.keys(t.methods||{}),o=Object.keys(t.events||{}),i=N.createContext({});function c(I,P){I.propsReady&&Ie(I.propsReady,!1);for(const v of r){const U=I[t.required[v]];Ie(U,P[v])}for(const v of a)if(v in P){const U=I[t.optional[v]];Ie(U,P[v])}I.propsReady&&Ie(I.propsReady,!0)}function l(I){return s.reduce((P,v)=>(P[v]=U=>{const O=I[t.methods[v]];Ie(O,U)},P),{})}function d(I){return o.reduce((P,v)=>(P[v]=PV(I[t.events[v]]),P),{})}const p=N.forwardRef((I,P)=>{const{children:v,...U}=I,[O]=N.useState(()=>Zu(BV(e),F=>{c(F,U)})),[M]=N.useState(Ex(d,O));td(()=>{for(const F of o)F in U&&We(M[F],U[F]);return()=>{Object.values(M).map(dm)}},[U,M,O]),td(()=>{c(O,U)}),N.useImperativeHandle(P,vx(l(O)));const L=n;return _.jsx(i.Provider,{value:O,children:n?_.jsx(L,{...pW([...r,...a,...o],U),children:v}):v})}),h=I=>{const P=N.useContext(i);return N.useCallback(v=>{Ie(P[I],v)},[P,I])},y=I=>{const P=N.useContext(i)[I],v=N.useCallback(U=>We(P,U),[P]);return N.useSyncExternalStore(v,()=>ct(P),()=>ct(P))},E=I=>{const P=N.useContext(i)[I],[v,U]=N.useState(Ex(ct,P));return td(()=>We(P,O=>{O!==v&&U(vx(O))}),[P,v]),v},C=N.version.startsWith("18")?y:E;return{Component:p,useEmitter:(I,P)=>{const v=N.useContext(i)[I];td(()=>We(v,P),[P,v])},useEmitterValue:C,usePublisher:h}}const n5=N.createContext(void 0),r5=N.createContext(void 0),a5=typeof document<"u"?N.useLayoutEffect:N.useEffect;function Am(e){return"self"in e}function fW(e){return"body"in e}function s5(e,t,n,r=So,a,s){const o=N.useRef(null),i=N.useRef(null),c=N.useRef(null),l=N.useCallback(h=>{let y,E,C;const I=h.target;if(fW(I)||Am(I)){const v=Am(I)?I:I.defaultView;C=s?v.scrollX:v.scrollY,y=s?v.document.documentElement.scrollWidth:v.document.documentElement.scrollHeight,E=s?v.innerWidth:v.innerHeight}else C=s?I.scrollLeft:I.scrollTop,y=s?I.scrollWidth:I.scrollHeight,E=s?I.offsetWidth:I.offsetHeight;const P=()=>{e({scrollHeight:y,scrollTop:Math.max(C,0),viewportHeight:E})};h.suppressFlushSync?P():_s.flushSync(P),i.current!==null&&(C===i.current||C<=0||C===y-E)&&(i.current=null,t(!0),c.current&&(clearTimeout(c.current),c.current=null))},[e,t,s]);N.useEffect(()=>{const h=a||o.current;return r(a||o.current),l({suppressFlushSync:!0,target:h}),h.addEventListener("scroll",l,{passive:!0}),()=>{r(null),h.removeEventListener("scroll",l)}},[o,l,n,r,a]);function d(h){const y=o.current;if(!y||(s?"offsetWidth"in y&&y.offsetWidth===0:"offsetHeight"in y&&y.offsetHeight===0))return;const E=h.behavior==="smooth";let C,I,P;Am(y)?(I=Math.max(Sa(y.document.documentElement,s?"width":"height"),s?y.document.documentElement.scrollWidth:y.document.documentElement.scrollHeight),C=s?y.innerWidth:y.innerHeight,P=s?window.scrollX:window.scrollY):(I=y[s?"scrollWidth":"scrollHeight"],C=Sa(y,s?"width":"height"),P=y[s?"scrollLeft":"scrollTop"]);const v=I-C;if(h.top=Math.ceil(Math.max(Math.min(v,h.top),0)),$x(C,I)||h.top===P){e({scrollHeight:I,scrollTop:P,viewportHeight:C}),E&&t(!0);return}E?(i.current=h.top,c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{c.current=null,i.current=null,t(!0)},1e3)):i.current=null,s&&(h={behavior:h.behavior,left:h.top}),y.scrollTo(h)}function p(h){s&&(h={behavior:h.behavior,left:h.top}),o.current.scrollBy(h)}return{scrollByCallback:p,scrollerRef:o,scrollToCallback:d}}const Sm="-webkit-sticky",o5="sticky",Pm=Jx(()=>{if(typeof document>"u")return o5;const e=document.createElement("div");return e.style.position=Sm,e.style.position===Sm?Sm:o5});function Im(e){return e}const mW=je(()=>{const e=Z(i=>`Item ${i}`),t=Z(i=>`Group ${i}`),n=Z({}),r=Z(Im),a=Z("div"),s=Z(So),o=(i,c=null)=>Vt(W(n,se(l=>l[i]),st()),c);return{components:n,computeItemKey:r,EmptyPlaceholder:o("EmptyPlaceholder"),FooterComponent:o("Footer"),GroupComponent:o("Group","div"),groupContent:t,HeaderComponent:o("Header"),HeaderFooterTag:a,ItemComponent:o("Item","div"),itemContent:e,ListComponent:o("List","div"),ScrollerComponent:o("Scroller","div"),scrollerRef:s,ScrollSeekPlaceholder:o("ScrollSeekPlaceholder"),TopItemListComponent:o("TopItemList")}}),hW=je(([e,t])=>({...e,...t}),at(e5,mW)),bW=({height:e})=>_.jsx("div",{style:{height:e}}),yW={overflowAnchor:"none",position:Pm(),zIndex:1},i5={overflowAnchor:"none"},gW={...i5,display:"inline-block",height:"100%"},c5=N.memo(function({showTopList:e=!1}){const t=ke("listState"),n=Nn("sizeRanges"),r=ke("useWindowScroll"),a=ke("customScrollParent"),s=Nn("windowScrollContainerState"),o=Nn("scrollContainerState"),i=a||r?s:o,c=ke("itemContent"),l=ke("context"),d=ke("groupContent"),p=ke("trackItemSizes"),h=ke("itemSize"),y=ke("log"),E=Nn("gap"),C=ke("horizontalDirection"),{callbackRef:I}=UV(n,h,p,e?So:i,y,E,a,C,ke("skipAnimationFrameInResizeObserver")),[P,v]=N.useState(0);Bm("deviation",B=>{P!==B&&v(B)});const U=ke("EmptyPlaceholder"),O=ke("ScrollSeekPlaceholder")||bW,M=ke("ListComponent"),L=ke("ItemComponent"),F=ke("GroupComponent"),u=ke("computeItemKey"),f=ke("isSeeking"),b=ke("groupIndices").length>0,k=ke("alignToBottom"),x=ke("initialItemFinalLocationReached"),T=e?{}:{boxSizing:"border-box",...C?{display:"inline-block",height:"100%",marginLeft:P!==0?P:k?"auto":0,paddingLeft:t.offsetTop,paddingRight:t.offsetBottom,whiteSpace:"nowrap"}:{marginTop:P!==0?P:k?"auto":0,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...x?{}:{visibility:"hidden"}};return!e&&t.totalCount===0&&U?_.jsx(U,{...Wt(U,l)}):_.jsx(M,{...Wt(M,l),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:I,style:T,children:(e?t.topItems:t.items).map(B=>{const g=B.originalIndex,w=u(g+t.firstItemIndex,B.data,l);return f?N.createElement(O,{...Wt(O,l),height:B.size,index:B.index,key:w,type:B.type||"item",...B.type==="group"?{}:{groupIndex:B.groupIndex}}):B.type==="group"?N.createElement(F,{...Wt(F,l),"data-index":g,"data-item-index":B.index,"data-known-size":B.size,key:w,style:yW},d(B.index,l)):N.createElement(L,{...Wt(L,l),...kW(L,B.data),"data-index":g,"data-item-group-index":B.groupIndex,"data-item-index":B.index,"data-known-size":B.size,key:w,style:C?gW:i5},b?c(B.index,B.groupIndex,B.data,l):c(B.index,B.data,l))})})}),xW={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},wW={outline:"none",overflowX:"auto",position:"relative"},nd=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:{}}),vW={position:Pm(),top:0,width:"100%",zIndex:1};function Wt(e,t){if(typeof e!="string")return{context:t}}function kW(e,t){return{item:typeof e=="string"?void 0:t}}const EW=N.memo(function(){const e=ke("HeaderComponent"),t=Nn("headerHeight"),n=ke("HeaderFooterTag"),r=xs(N.useMemo(()=>s=>{t(Sa(s,"height"))},[t]),!0,ke("skipAnimationFrameInResizeObserver")),a=ke("context");return e?_.jsx(n,{ref:r,children:_.jsx(e,{...Wt(e,a)})}):null}),TW=N.memo(function(){const e=ke("FooterComponent"),t=Nn("footerHeight"),n=ke("HeaderFooterTag"),r=xs(N.useMemo(()=>s=>{t(Sa(s,"height"))},[t]),!0,ke("skipAnimationFrameInResizeObserver")),a=ke("context");return e?_.jsx(n,{ref:r,children:_.jsx(e,{...Wt(e,a)})}):null});function l5({useEmitter:e,useEmitterValue:t,usePublisher:n}){return N.memo(function({children:r,style:a,context:s,...o}){const i=n("scrollContainerState"),c=t("ScrollerComponent"),l=n("smoothScrollTargetReached"),d=t("scrollerRef"),p=t("horizontalDirection")||!1,{scrollByCallback:h,scrollerRef:y,scrollToCallback:E}=s5(i,l,c,d,void 0,p);return e("scrollTo",E),e("scrollBy",h),_.jsx(c,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:y,style:{...p?wW:xW,...a},tabIndex:0,...o,...Wt(c,s),children:r})})}function u5({useEmitter:e,useEmitterValue:t,usePublisher:n}){return N.memo(function({children:r,style:a,context:s,...o}){const i=n("windowScrollContainerState"),c=t("ScrollerComponent"),l=n("smoothScrollTargetReached"),d=t("totalListHeight"),p=t("deviation"),h=t("customScrollParent"),y=N.useRef(null),E=t("scrollerRef"),{scrollByCallback:C,scrollerRef:I,scrollToCallback:P}=s5(i,l,c,E,h);return a5(()=>{var v;return I.current=h||((v=y.current)==null?void 0:v.ownerDocument.defaultView),()=>{I.current=null}},[I,h]),e("windowScrollTo",P),e("scrollBy",C),_.jsx(c,{ref:y,"data-virtuoso-scroller":!0,style:{position:"relative",...a,...d!==0?{height:d+p}:{}},...o,...Wt(c,s),children:r})})}const CW=({children:e})=>{const t=N.useContext(n5),n=Nn("viewportHeight"),r=Nn("fixedItemHeight"),a=ke("alignToBottom"),s=ke("horizontalDirection"),o=N.useMemo(()=>kx(n,c=>Sa(c,s?"width":"height")),[n,s]),i=xs(o,!0,ke("skipAnimationFrameInResizeObserver"));return N.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),_.jsx("div",{"data-viewport-type":"element",ref:i,style:nd(a),children:e})},AW=({children:e})=>{const t=N.useContext(n5),n=Nn("windowViewportRect"),r=Nn("fixedItemHeight"),a=ke("customScrollParent"),s=Sx(n,a,ke("skipAnimationFrameInResizeObserver")),o=ke("alignToBottom");return N.useEffect(()=>{t&&(r(t.itemHeight),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),_.jsx("div",{"data-viewport-type":"window",ref:s,style:nd(o),children:e})},SW=({children:e})=>{const t=ke("TopItemListComponent")||"div",n=ke("headerHeight"),r={...vW,marginTop:`${n}px`},a=ke("context");return _.jsx(t,{style:r,...Wt(t,a),children:e})},PW=N.memo(function(e){const t=ke("useWindowScroll"),n=ke("topItemsIndexes").length>0,r=ke("customScrollParent"),a=ke("context");return _.jsxs(r||t?OW:BW,{...e,context:a,children:[n&&_.jsx(SW,{children:_.jsx(c5,{showTopList:!0})}),_.jsxs(r||t?AW:CW,{children:[_.jsx(EW,{}),_.jsx(c5,{}),_.jsx(TW,{})]})]})}),{Component:IW,useEmitter:Bm,useEmitterValue:ke,usePublisher:Nn}=t5(hW,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",minOverscanItemCount:"minOverscanItemCount",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedGroupHeight:"fixedGroupHeight",fixedItemHeight:"fixedItemHeight",heightEstimates:"heightEstimates",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"HeaderFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},PW),BW=l5({useEmitter:Bm,useEmitterValue:ke,usePublisher:Nn}),OW=u5({useEmitter:Bm,useEmitterValue:ke,usePublisher:Nn}),FW=IW;at(e5,je(()=>{const e=Z(l=>_.jsxs("td",{children:["Item $",l]})),t=Z(null),n=Z(l=>_.jsxs("td",{colSpan:1e3,children:["Group ",l]})),r=Z(null),a=Z(null),s=Z({}),o=Z(Im),i=Z(So),c=(l,d=null)=>Vt(W(s,se(p=>p[l]),st()),d);return{components:s,computeItemKey:o,context:t,EmptyPlaceholder:c("EmptyPlaceholder"),FillerRow:c("FillerRow"),fixedFooterContent:a,fixedHeaderContent:r,itemContent:e,groupContent:n,ScrollerComponent:c("Scroller","div"),scrollerRef:i,ScrollSeekPlaceholder:c("ScrollSeekPlaceholder"),TableBodyComponent:c("TableBody","tbody"),TableComponent:c("Table","table"),TableFooterComponent:c("TableFoot","tfoot"),TableHeadComponent:c("TableHead","thead"),TableRowComponent:c("TableRow","tr"),GroupComponent:c("Group","tr")}})),Pm();const d5={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},UW={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:p5,floor:rd,max:Bc,min:Om,round:f5}=Math;function m5(e,t,n){return Array.from({length:t-e+1}).map((r,a)=>({data:n===null?null:n[a+e],index:a+e}))}function DW(e){return{...UW,items:e}}function ad(e,t){return e&&e.width===t.width&&e.height===t.height}function _W(e,t){return e&&e.column===t.column&&e.row===t.row}const MW=je(([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:r},{footerHeight:a,headerHeight:s,scrollBy:o,scrollContainerState:i,scrollTo:c,scrollTop:l,smoothScrollTargetReached:d,viewportHeight:p},h,y,{didMount:E,propsReady:C},{customScrollParent:I,useWindowScroll:P,windowScrollContainerState:v,windowScrollTo:U,windowViewportRect:O},M])=>{const L=Z(0),F=Z(0),u=Z(d5),f=Z({height:0,width:0}),b=Z({height:0,width:0}),k=Me(),x=Me(),T=Z(0),B=Z(null),g=Z({column:0,row:0}),w=Me(),S=Me(),A=Z(!1),D=Z(0),R=Z(!0),$=Z(!1),j=Z(!1);We(W(E,Be(D),xe(([X,ve])=>!!ve)),()=>{Ie(R,!1)}),We(W(Tt(E,R,b,f,D,$),xe(([X,ve,Fe,Ae,,Ye])=>X&&!ve&&Fe.height!==0&&Ae.height!==0&&!Ye)),([,,,,X])=>{Ie($,!0),vm(1,()=>{Ie(k,X)}),nr(W(l),()=>{Ie(t,[0,0]),Ie(R,!0)})}),pe(W(S,xe(X=>X!=null&&X.scrollTop>0),gr(0)),F),We(W(E,Be(S),xe(([,X])=>X!=null)),([,X])=>{X&&(Ie(f,X.viewport),Ie(b,X.item),Ie(g,X.gap),X.scrollTop>0&&(Ie(A,!0),nr(W(l,gs(1)),ve=>{Ie(A,!1)}),Ie(c,{top:X.scrollTop})))}),pe(W(f,se(({height:X})=>X)),p),pe(W(Tt(we(f,ad),we(b,ad),we(g,(X,ve)=>X&&X.column===ve.column&&X.row===ve.row),we(l)),se(([X,ve,Fe,Ae])=>({gap:Fe,item:ve,scrollTop:Ae,viewport:X}))),w),pe(W(Tt(we(L),r,we(g,_W),we(b,ad),we(f,ad),we(B),we(F),we(A),we(R),we(D)),xe(([,,,,,,,X])=>!X),se(([X,[ve,Fe],Ae,Ye,ge,fe,ae,,Je,Xe])=>{const{column:et,row:Rn}=Ae,{height:Nt,width:Lm}=Ye,{width:G5}=ge;if(ae===0&&(X===0||G5===0))return d5;if(Lm===0){const Y5=km(Xe,X),jq=Y5+Math.max(ae-1,0);return DW(m5(Y5,jq,fe))}const id=h5(G5,Lm,et);let Ho,Ds;Je?ve===0&&Fe===0&&ae>0?(Ho=0,Ds=ae-1):(Ho=id*rd((ve+Rn)/(Nt+Rn)),Ds=id*p5((Fe+Rn)/(Nt+Rn))-1,Ds=Om(X-1,Bc(Ds,id-1)),Ho=Om(Ds,Bc(0,Ho))):(Ho=0,Ds=-1);const j5=m5(Ho,Ds,fe),{bottom:V5,top:W5}=b5(ge,Ae,Ye,j5),q5=p5(X/id),Gq=q5*Nt+(q5-1)*Rn-V5;return{bottom:V5,itemHeight:Nt,items:j5,itemWidth:Lm,offsetBottom:Gq,offsetTop:W5,top:W5}})),u),pe(W(B,xe(X=>X!==null),se(X=>X.length)),L),pe(W(Tt(f,b,u,g),xe(([X,ve,{items:Fe}])=>Fe.length>0&&ve.height!==0&&X.height!==0),se(([X,ve,{items:Fe},Ae])=>{const{bottom:Ye,top:ge}=b5(X,Ae,ve,Fe);return[ge,Ye]}),st(vc)),t);const te=Z(!1);pe(W(l,Be(te),se(([X,ve])=>ve||X!==0)),te);const ce=kn(W(Tt(u,L),xe(([{items:X}])=>X.length>0),Be(te),xe(([[X,ve],Fe])=>{const Ae=X.items[X.items.length-1].index===ve-1;return(Fe||X.bottom>0&&X.itemHeight>0&&X.offsetBottom===0&&X.items.length===ve)&&Ae}),se(([[,X]])=>X-1),st())),Y=kn(W(we(u),xe(({items:X})=>X.length>0&&X[0].index===0),gr(0),st())),J=kn(W(we(u),Be(A),xe(([{items:X},ve])=>X.length>0&&!ve),se(([{items:X}])=>({endIndex:X[X.length-1].index,startIndex:X[0].index})),st(Dx),Qr(0)));pe(J,y.scrollSeekRangeChanged),pe(W(k,Be(f,b,L,g),se(([X,ve,Fe,Ae,Ye])=>{const ge=Rx(X),{align:fe,behavior:ae,offset:Je}=ge;let Xe=ge.index;Xe==="LAST"&&(Xe=Ae-1),Xe=Bc(0,Xe,Om(Ae-1,Xe));let et=Fm(ve,Ye,Fe,Xe);return fe==="end"?et=f5(et-ve.height+Fe.height):fe==="center"&&(et=f5(et-ve.height/2+Fe.height/2)),Je&&(et+=Je),{behavior:ae,top:et}})),c);const ye=Vt(W(u,se(X=>X.offsetBottom+X.bottom)),0);return pe(W(O,se(X=>({height:X.visibleHeight,width:X.visibleWidth}))),f),{customScrollParent:I,data:B,deviation:T,footerHeight:a,gap:g,headerHeight:s,increaseViewportBy:e,initialItemCount:F,itemDimensions:b,overscan:n,restoreStateFrom:S,scrollBy:o,scrollContainerState:i,scrollHeight:x,scrollTo:c,scrollToIndex:k,scrollTop:l,smoothScrollTargetReached:d,totalCount:L,useWindowScroll:P,viewportDimensions:f,windowScrollContainerState:v,windowScrollTo:U,windowViewportRect:O,...y,gridState:u,horizontalDirection:j,initialTopMostItemIndex:D,totalListHeight:ye,...h,endReached:ce,propsReady:C,rangeChanged:J,startReached:Y,stateChanged:w,stateRestoreInProgress:A,...M}},at(Em,Zt,Sc,Qx,Pa,Cm,Aa));function h5(e,t,n){return Bc(1,rd((e+n)/(rd(t)+n)))}function b5(e,t,n,r){const{height:a}=n;if(a===void 0||r.length===0)return{bottom:0,top:0};const s=Fm(e,t,n,r[0].index);return{bottom:Fm(e,t,n,r[r.length-1].index)+a,top:s}}function Fm(e,t,n,r){const a=h5(e.width,n.width,t.column),s=rd(r/a),o=s*n.height+Bc(0,s-1)*t.row;return o>0?o+t.row:o}const NW=je(()=>{const e=Z(p=>`Item ${p}`),t=Z({}),n=Z(null),r=Z("virtuoso-grid-item"),a=Z("virtuoso-grid-list"),s=Z(Im),o=Z("div"),i=Z(So),c=(p,h=null)=>Vt(W(t,se(y=>y[p]),st()),h),l=Z(!1),d=Z(!1);return pe(we(d),l),{components:t,computeItemKey:s,context:n,FooterComponent:c("Footer"),HeaderComponent:c("Header"),headerFooterTag:o,itemClassName:r,ItemComponent:c("Item","div"),itemContent:e,listClassName:a,ListComponent:c("List","div"),readyStateChanged:l,reportReadyState:d,ScrollerComponent:c("Scroller","div"),scrollerRef:i,ScrollSeekPlaceholder:c("ScrollSeekPlaceholder","div")}}),LW=je(([e,t])=>({...e,...t}),at(MW,NW)),zW=N.memo(function(){const e=lt("gridState"),t=lt("listClassName"),n=lt("itemClassName"),r=lt("itemContent"),a=lt("computeItemKey"),s=lt("isSeeking"),o=Ln("scrollHeight"),i=lt("ItemComponent"),c=lt("ListComponent"),l=lt("ScrollSeekPlaceholder"),d=lt("context"),p=Ln("itemDimensions"),h=Ln("gap"),y=lt("log"),E=lt("stateRestoreInProgress"),C=Ln("reportReadyState"),I=xs(N.useMemo(()=>P=>{const v=P.parentElement.parentElement.scrollHeight;o(v);const U=P.firstChild;if(U){const{height:O,width:M}=U.getBoundingClientRect();p({height:O,width:M})}h({column:g5("column-gap",getComputedStyle(P).columnGap,y),row:g5("row-gap",getComputedStyle(P).rowGap,y)})},[o,p,h,y]),!0,!1);return a5(()=>{e.itemHeight>0&&e.itemWidth>0&&C(!0)},[e]),E?null:_.jsx(c,{className:t,ref:I,...Wt(c,d),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(P=>{const v=a(P.index,P.data,d);return s?_.jsx(l,{...Wt(l,d),height:e.itemHeight,index:P.index,width:e.itemWidth},v):N.createElement(i,{...Wt(i,d),className:n,"data-index":P.index,key:v},r(P.index,P.data,d))})})}),RW=N.memo(function(){const e=lt("HeaderComponent"),t=Ln("headerHeight"),n=lt("headerFooterTag"),r=xs(N.useMemo(()=>s=>{t(Sa(s,"height"))},[t]),!0,!1),a=lt("context");return e?_.jsx(n,{ref:r,children:_.jsx(e,{...Wt(e,a)})}):null}),$W=N.memo(function(){const e=lt("FooterComponent"),t=Ln("footerHeight"),n=lt("headerFooterTag"),r=xs(N.useMemo(()=>s=>{t(Sa(s,"height"))},[t]),!0,!1),a=lt("context");return e?_.jsx(n,{ref:r,children:_.jsx(e,{...Wt(e,a)})}):null}),HW=({children:e})=>{const t=N.useContext(r5),n=Ln("itemDimensions"),r=Ln("viewportDimensions"),a=xs(N.useMemo(()=>s=>{r(s.getBoundingClientRect())},[r]),!0,!1);return N.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),_.jsx("div",{ref:a,style:nd(!1),children:e})},GW=({children:e})=>{const t=N.useContext(r5),n=Ln("windowViewportRect"),r=Ln("itemDimensions"),a=lt("customScrollParent"),s=Sx(n,a,!1);return N.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),_.jsx("div",{ref:s,style:nd(!1),children:e})},jW=N.memo(function({...e}){const t=lt("useWindowScroll"),n=lt("customScrollParent"),r=n||t?WW:VW,a=n||t?GW:HW,s=lt("context");return _.jsx(r,{...e,...Wt(r,s),children:_.jsxs(a,{children:[_.jsx(RW,{}),_.jsx(zW,{}),_.jsx($W,{})]})})}),{useEmitter:y5,useEmitterValue:lt,usePublisher:Ln}=t5(LW,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},jW),VW=l5({useEmitter:y5,useEmitterValue:lt,usePublisher:Ln}),WW=u5({useEmitter:y5,useEmitterValue:lt,usePublisher:Ln});function g5(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,ln.WARN),t==="normal"?0:parseInt(t??"0",10)}var Um={},x5;function qW(){if(x5)return Um;x5=1;var e=ku.GenIcon;return Um.AiFillQuestionCircle=function(n){return e({tag:"svg",attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 708c-22.1 0-40-17.9-40-40s17.9-40 40-40 40 17.9 40 40-17.9 40-40 40zm62.9-219.5a48.3 48.3 0 0 0-30.9 44.8V620c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8v-21.5c0-23.1 6.7-45.9 19.9-64.9 12.9-18.6 30.9-32.8 52.1-40.9 34-13.1 56-41.6 56-72.7 0-44.1-43.1-80-96-80s-96 35.9-96 80v7.6c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V420c0-39.3 17.2-76 48.4-103.3C430.4 290.4 470 276 512 276s81.6 14.5 111.6 40.7C654.8 344 672 380.7 672 420c0 57.8-38.1 109.8-97.1 132.5z"}}]})(n)},Um}var YW=qW();function KW({logo:e,className:t="",style:n={},alt:r="Token logo"}){const[a,s]=N.useState(!1);return N.useEffect(()=>{s(!1)},[e]),e&&!a?_.jsx("img",{alt:r,style:n,onError:()=>s(!0),className:`twap-token-logo ${t}`,src:e}):_.jsx(YW.AiFillQuestionCircle,{style:{width:20,height:20},className:"twap-token-svg"})}const ZW=()=>_.jsx("div",{className:"twap-orders__loader",children:_.jsx("p",{children:"Loading..."})}),XW=()=>{const{isLoading:e}=qu(),t=mx(),n=Q(s=>s.state.orderIdsToCancel),r=Q(s=>s.state.cancelOrdersMode),a=hx();return _.jsx(_.Fragment,{children:e?_.jsx(ZW,{}):t!=null&&t.length?_.jsx("div",{className:`twap-orders__list ${r?"twap-orders__list-select-mode":""}`,children:_.jsx(FW,{style:{height:"100%"},data:t,itemContent:(s,o)=>_.jsx(QW,{cancelOrdersMode:!!r,selected:(n==null?void 0:n.includes(o.id))||!1,selectOrder:a,order:o},s)})}):_.jsx(JW,{})})},QW=({order:e,selectOrder:t,selected:n,cancelOrdersMode:r})=>{const a=Q(i=>i.updateState),s=vt.useCallback(()=>{a({selectedOrderID:e==null?void 0:e.id})},[a,e==null?void 0:e.id]),o=vt.useCallback(()=>{r?t(e==null?void 0:e.id):s()},[r,t,s,e==null?void 0:e.id]);return _.jsx("div",{className:`twap-orders__list-item twap-orders__list-item-${e.status} ${r?"twap-orders__list-item-select-mode":""} ${n?"twap-orders__list-item-selected":""}`,onClick:o,children:_.jsxs("div",{className:"twap-orders__list-item-content",children:[_.jsx(eq,{order:e}),_.jsx(tq,{value:e.progress||0}),_.jsxs("div",{className:"twap-orders__list-item-tokens",children:[_.jsx(w5,{address:e.srcTokenAddress}),_.jsx(kV.HiArrowRight,{className:"twap-orders__list-item-tokens-arrow"}),_.jsx(w5,{address:e.dstTokenAddress})]})]})})},JW=()=>{const e=Q(r=>r.state.orderHistoryStatusFilter),t=ze(),n=vt.useMemo(()=>e||"",[e]);return _.jsx("div",{className:"twap-orders__list-empty",children:_.jsx("p",{children:t("noOrders",{status:n})})})},eq=({order:e})=>{const t=e&&e.status,n=px(e),r=sm(e.createdAt);return _.jsxs("div",{className:"twap-orders__list-item-header",children:[_.jsxs("p",{className:"twap-orders__list-item-header-title",children:[n," ",_.jsx("span",{children:`(${r})`})]}),_.jsx("p",{className:"twap-orders__list-item-header-status",children:t})]})},w5=e=>{const{useToken:t,components:n}=de(),r=t==null?void 0:t(e.address);return _.jsx("div",{className:"twap-orders__list-item-token",children:r?_.jsxs(_.Fragment,{children:[_.jsx("div",{className:"twap-orders__list-item-token-logo",children:n.TokenLogo?_.jsx(n.TokenLogo,{token:r}):_.jsx(KW,{logo:r==null?void 0:r.logoUrl})}),_.jsx("p",{className:"twap-orders__list-item-token-symbol",children:r==null?void 0:r.symbol})]}):_.jsx("div",{})})};function tq(e){return _.jsxs("div",{className:"twap-orders__list-item-progress",children:[_.jsx("div",{className:"twap-orders__list-item-progress-bar",children:_.jsx("div",{className:"twap-orders__list-item-progress-bar-filled",style:{width:`${e.value}%`}})}),_.jsx("div",{className:"twap-orders__list-item-token-progress-label",children:_.jsx("p",{children:`${Math.round(e.value)}%`})})]})}const nq=()=>{const e=Q(n=>n.state.selectedOrderID),t=e!==void 0;return _.jsx("div",{className:`twap-orders ${e!==void 0?"twap-orders__show-selected":""}`,children:t?_.jsx(tV,{}):_.jsx(XW,{})})},rq=e=>{const t=ze(),{marketPrice:n}=de(),r=Q(s=>s.state.typedSrcAmount);return N.useMemo(()=>{const{isError:s,value:o}=Fh(e);if(!(!s||he(r||"0").isZero()||!n))return{type:Rt.MIN_FILL_DELAY,value:o,message:t("minFillDelayError",{fillDelay:`${jd(o)} ${t("minutes")}`})}},[e,t,r,n])},ks=()=>{const e=Q(a=>a.state.typedFillDelay),t=Q(a=>a.updateState),n=N.useMemo(()=>e||Hc,[e]),r=rq(n);return{fillDelay:n,onChange:N.useCallback(a=>t({typedFillDelay:a}),[t]),error:r}},aq=()=>{const{onChange:e,fillDelay:t,error:n}=ks(),r=ze(),a=N.useCallback(o=>e({unit:t.unit,value:Number(o)}),[e,t]),s=N.useCallback(o=>e({unit:o,value:t.value}),[e,t]);return{onInputChange:a,onUnitSelect:s,onChange:e,milliseconds:t.unit*t.value,fillDelay:t,error:n,label:r("tradeIntervalTitle"),tooltip:r("tradeIntervalTootlip")}},ar=()=>{const{srcToken:e}=de(),t=ze(),n=Q(s=>s.state.typedSrcAmount),a=Q(s=>s.state.acceptedSrcAmount)||n;return{amountWei:Vu(e==null?void 0:e.decimals,a),amountUI:a,error:he(a||0).isZero()?t("enterAmount"):void 0}},sq=(e,t)=>{const{module:n,srcUsd1Token:r,marketPrice:a,minChunkSizeUsd:s}=de(),o=ze(),i=Q(c=>c.state.typedSrcAmount);return N.useMemo(()=>{if(he(i||"0").isZero()||!a)return;if(!e)return{type:Rt.MIN_CHUNKS,value:1,message:`${o("minChunksError")} 1`};const{isError:c}=Dh(e,t,n);if(c)return{type:Rt.MAX_CHUNKS,value:t,message:o("maxChunksError",{maxChunks:`${t}`})};const{isError:l,value:d}=Uh(i||"",r||"",s||0);if(l)return{type:Rt.MIN_TRADE_SIZE,value:d,message:o("minTradeSizeError",{minTradeSize:`${d}`})}},[e,t,n,i,r,s,o,a])},vr=()=>{const{srcToken:e,srcUsd1Token:t,module:n,minChunkSizeUsd:r}=de(),a=Q(C=>C.state.typedChunks),s=ks().fillDelay,o=Q(C=>C.updateState),{amountWei:i,amountUI:c}=ar(),l=N.useMemo(()=>Eh(s,c||"",t||"",r||0),[c,t,r,s]),d=N.useMemo(()=>kh(l,n,a),[l,a,n]),p=N.useCallback(C=>o({typedChunks:C}),[o]),h=N.useMemo(()=>Ch(i||"",d),[i,d]),y=tr(e==null?void 0:e.decimals,h),E=N.useMemo(()=>t?he(y||"0").times(t||0).toString():"0",[y,t]);return{totalTrades:d,maxTrades:l,amountPerTradeUI:y,amountPerTradeWei:h,amountPerTradeUsd:E,onChange:p,error:sq(d,l)}},oq=()=>{const{srcToken:e,dstToken:t}=de(),n=ze(),{onChange:r,totalTrades:a,amountPerTradeUsd:s,amountPerTradeUI:o,error:i,maxTrades:c,amountPerTradeWei:l}=vr(),d=Ve({value:o}),p=Ve({value:s});return{error:i,maxTrades:c,totalTrades:a,amountPerTrade:d,amountPerTradeWei:l,onChange:r,label:n("tradesAmountTitle"),tooltip:n("totalTradesTooltip"),amountPerTradeUsd:p,fromToken:e,toToken:t}},iq=()=>{const{srcToken:e,dstToken:t,marketPrice:n}=de(),[r,a]=N.useState(!1),s=N.useMemo(()=>{if(he(n||"0").isZero()||!t)return"0";const o=ir(t==null?void 0:t.decimals,n);return r?he(1).div(o||0).toFixed():o},[r,n,e==null?void 0:e.decimals,t==null?void 0:t.decimals]);return{fromToken:r?t:e,toToken:r?e:t,price:Ve({value:s}),priceWei:Vu(t==null?void 0:t.decimals,n),onInvert:N.useCallback(()=>a(!r),[r])}},cq=e=>{const{module:t,marketPrice:n}=de(),r=ze();return N.useMemo(()=>{const a=Bh(t,e),s=Oh(e);if(n){if(a.isError)return{type:Rt.MAX_ORDER_DURATION,value:a.value,message:r("maxDurationError",{duration:`${Math.floor(I1(a.value)).toFixed(0)} ${r("days")}`})};if(s.isError)return{type:Rt.MIN_ORDER_DURATION,value:s.value,message:r("minDurationError",{duration:`${Math.floor(jd(s.value)).toFixed(0)} ${r("minutes")}`})}}},[e,r,t,n])},Dm=()=>{const{module:e}=de(),t=Q(i=>i.state.typedDuration),n=Q(i=>i.updateState),r=vr().totalTrades,a=ks().fillDelay,s=N.useMemo(()=>vh(e,r,a,t),[r,a,t,e]),o=cq(s);return{duration:s,setDuration:N.useCallback(i=>n({typedDuration:i}),[n]),error:o}},lq=()=>{const{module:e}=de(),t=ze(),{duration:n,setDuration:r,error:a}=Dm(),s=N.useCallback(c=>{r({unit:n.unit,value:Number(c)})},[r,n]),o=N.useCallback(c=>{r({unit:c,value:n.value})},[r,n]),i=N.useMemo(()=>e===Se.STOP_LOSS?t("stopLossDurationTooltip"):t("maxDurationTooltip"),[t,e]);return{duration:n,onChange:r,milliseconds:n.unit*n.value,onInputChange:s,onUnitSelect:o,label:t("expiry"),tooltip:i,error:a}},uq=()=>{const e=Q(a=>a.state.isMarketOrder),{module:t}=de(),n=ze(),r=t===Se.STOP_LOSS||t===Se.TAKE_PROFIT;return N.useMemo(()=>{if(!r)return{text:n(e?"marketOrderWarning":"limitPriceMessage"),url:"https://www.orbs.com/dtwap-and-dlimit-faq/"}},[e,n,r])},_m=()=>{const e=Q(n=>n.state.currentTime),t=Dm().duration;return N.useMemo(()=>Th(e,t),[e,t])},sd=()=>{const{srcToken:e,dstToken:t,marketPriceLoading:n}=de(),r=Q(l=>l.updateState),a=Q(l=>l.state.isInvertedTrade),s=Q(l=>l.state.typedTriggerPrice),o=Q(l=>l.state.typedLimitPrice),i=Q(l=>l.state.isMarketOrder);return{onInvert:N.useCallback(()=>{s!==void 0&&r({typedTriggerPrice:he(1).div(s).toFixed()}),o!==void 0&&r({typedLimitPrice:he(1).div(o).toFixed()}),r({isInvertedTrade:!a})},[r,a,s,o,n]),isInverted:a,fromToken:a?t:e,toToken:a?e:t,isMarketPrice:i}},v5=({typedValue:e,tokenDecimals:t=18,initialPrice:n="0",percentage:r,setValue:a,setPercentage:s})=>{const{srcUsd1Token:o,dstUsd1Token:i}=de(),{isInverted:c}=sd(),l=N.useMemo(()=>{if(e!==void 0){const C=c?he(e).isZero()?he(0):he(1).div(e):he(e);return Rc(t,C.toFixed())}if(r!==void 0&&he(n||"0").gt(0)&&!he(n||"0").isNaN()){const C=he(n||"0"),I=he(r||0).div(100);return C.plus(C.multipliedBy(I)).decimalPlaces(0).toFixed()}return he(n).gt(0)?n:""},[e,r,t,n,c]),d=N.useCallback(C=>{a(C),s(null)},[a,s]),p=N.useCallback(C=>{a(void 0),s(C)},[a,s]),h=N.useMemo(()=>{if(!n||he(n).isZero())return"";if(r!=null)return r;if(l){const C=he(n),P=he(l).minus(C).div(C).multipliedBy(100).decimalPlaces(2).toString();return he(P||"0").isZero()?"":P}return""},[l,n,r]),y=N.useMemo(()=>{let C="";if(e!==void 0)C=e;else{const I=ir(t,l);if(he(I||"0").isZero())return"";C=c?he(1).div(I).toFixed():I}return qo(C,6,t)},[e,t,l,c]),E=ys(c?o:i,y||"0");return{amountWei:he(l).isNaN()?"":l,amountUI:he(y).isNaN()?"":y,selectedPercentage:h,onChange:d,onPercentageChange:p,isInverted:c,usd:he(E).isNaN()?"":E}},dq=()=>{const{module:e}=de();return N.useMemo(()=>e===Se.STOP_LOSS?ph:fh,[e])},Mm=()=>{const{module:e}=de(),t=Q(n=>n.state.isMarketOrder);return N.useMemo(()=>e!==Se.STOP_LOSS&&e!==Se.TAKE_PROFIT||t?void 0:e===Se.STOP_LOSS?mh:hh,[e,t])},pq=(e="")=>{const{module:t,marketPrice:n}=de(),r=ze(),a=Q(s=>s.state.typedSrcAmount);return N.useMemo(()=>{if(he(a||"0").isZero()||!n||t!==Se.STOP_LOSS&&t!==Se.TAKE_PROFIT)return;const s=Ah(n||"",e||"",t);if(s!=null&&s.isError)return{type:Rt.STOP_LOSS_TRIGGER_PRICE_GREATER_THAN_MARKET_PRICE,value:s.value,message:r("StopLossTriggerPriceError")||""};const o=Sh(n||"",e||"",t);if(o!=null&&o.isError)return{type:Rt.TAKE_PROFIT_TRIGGER_PRICE_LESS_THAN_MARKET_PRICE,value:o.value,message:r("TakeProfitTriggerPriceError")||""};if(!e||he(e||0).isZero())return{type:Rt.EMPTY_TRIGGER_PRICE,value:e,message:r("emptyTriggerPrice")||""}},[n,e,t,r,a])},fq=e=>{const{srcToken:t,dstToken:n,module:r}=de(),a=vr().amountPerTradeWei,s=Q(i=>i.state.isMarketOrder),o=N.useMemo(()=>wh(r,a,e,(t==null?void 0:t.decimals)||0),[e,a,s,t==null?void 0:t.decimals,r]);return{amountWei:o,amountUI:tr((n==null?void 0:n.decimals)||0,o)}},Es=()=>{const{dstToken:e,marketPrice:t,module:n}=de(),r=Q(y=>y.updateState),a=dq(),s=Q(y=>y.state.triggerPricePercent),o=N.useCallback(y=>{r({triggerPricePercent:y})},[r]),i=s===void 0?a:s,c=n===Se.STOP_LOSS||n===Se.TAKE_PROFIT,l=v5({typedValue:Q(y=>y.state.typedTriggerPrice),percentage:i,tokenDecimals:e==null?void 0:e.decimals,initialPrice:c?t:void 0,setValue:N.useCallback(y=>r({typedTriggerPrice:y}),[r]),setPercentage:o}),d=pq(l.amountWei),{amountWei:p,amountUI:h}=fq(l.amountWei);return N.useMemo(()=>({...l,error:d,pricePerChunkWei:p,pricePerChunkUI:h}),[l,d,p,h])},mq=()=>{const{module:e,marketPrice:t,marketPriceLoading:n}=de(),r=ze(),{amountUI:a,onChange:s,onPercentageChange:o,usd:i,selectedPercentage:c,error:l}=Es(),d=Q(v=>v.state.isMarketOrder),p=Q(v=>v.updateState),{isInverted:h,onInvert:y,fromToken:E,toToken:C}=sd(),I=N.useCallback(()=>{p({triggerPricePercent:void 0,typedTriggerPrice:void 0})},[p]),P=e!==Se.STOP_LOSS&&e!==Se.TAKE_PROFIT;return{price:a,error:l,label:r("stopLossLabel"),tooltip:e===Se.STOP_LOSS?r("stopLossTooltip"):r("takeProfitTooltip"),onChange:s,onPercentageChange:o,percentage:c,isActive:!d,onReset:I,usd:i,fromToken:E,toToken:C,prefix:"",isLoading:n||!t,isInverted:h,hide:P,onInvert:y}},hq=e=>{const{module:t,marketPrice:n}=de(),r=ze(),{amountWei:a}=Es(),s=Q(i=>i.state.isMarketOrder),o=Q(i=>i.state.typedSrcAmount);return N.useMemo(()=>{if(he(o||"0").isZero()||!a||!n)return;const i=Ph(a,e,s,t),c=Ih(a,e,s,t);if(i!=null&&i.isError)return{type:Rt.TRIGGER_LIMIT_PRICE_GREATER_THAN_TRIGGER_PRICE,message:r("triggerLimitPriceError")||"",value:i.value};if(c!=null&&c.isError)return{type:Rt.TRIGGER_LIMIT_PRICE_GREATER_THAN_TRIGGER_PRICE,message:r("triggerLimitPriceError")||"",value:c.value};if(e&&he(e||0).isZero())return{type:Rt.MISSING_LIMIT_PRICE,message:r("emptyLimitPrice")||"",value:e||""}},[e,r,a,t,s,o,n])},od=()=>{const{dstToken:e,marketPrice:t,module:n}=de(),r=Q(l=>l.updateState),a=Mm(),s=Q(l=>l.state.limitPricePercent),o=s===void 0?a:s,i=v5({typedValue:Q(l=>l.state.typedLimitPrice),percentage:o,tokenDecimals:e==null?void 0:e.decimals,initialPrice:t,setValue:N.useCallback(l=>r({typedLimitPrice:l}),[r]),setPercentage:N.useCallback(l=>{r({limitPricePercent:l})},[r,n])}),c=hq(i.amountWei);return N.useMemo(()=>({...i,error:c}),[i,c])},bq=()=>{const{module:e}=de(),t=Q(i=>i.updateState),n=Q(i=>i.state.isMarketOrder),r=Mm(),a=Q(i=>i.state.triggerPricePercent)||0,s=e===Se.LIMIT,o=N.useCallback(()=>{!n&&e===Se.STOP_LOSS&&t({limitPricePercent:r}),t({isMarketOrder:!n})},[t,a,e,n,r]);return{isLimitPrice:!n,toggleLimitPrice:o,hide:s}},yq=()=>{const{module:e,marketPriceLoading:t}=de(),n=ze(),{amountUI:r,onChange:a,onPercentageChange:s,usd:o,selectedPercentage:i,error:c}=od(),l=Q(L=>L.state.isMarketOrder),d=Q(L=>L.updateState),p=Mm(),{isLimitPrice:h,toggleLimitPrice:y}=bq(),{triggerPricePercent:E}=Q(L=>L.state),{isInverted:C,onInvert:I,fromToken:P,toToken:v}=sd(),U=N.useMemo(()=>{if(!(e!==Se.STOP_LOSS&&e!==Se.TAKE_PROFIT||!l))return{text:n("triggerMarketPriceDisclaimer"),url:wd}},[E,n,e,l]),O=N.useCallback(()=>{d({typedLimitPrice:void 0}),d({limitPricePercent:p})},[d,e,p]),M=N.useMemo(()=>e===Se.STOP_LOSS?n("stopLossLimitPriceTooltip"):n("limitPriceTooltip"),[n,e]);return{price:r,error:c,warning:U,label:n("limitPrice"),tooltip:M,onChange:a,onPercentageChange:s,onReset:O,usd:o,fromToken:P,toToken:v,percentage:i,isInverted:C,isLoading:t,isLimitPrice:h,toggleLimitPrice:y,onInvert:I}},k5=()=>{const{module:e,marketPrice:t}=de(),n=od().amountWei,r=Es().amountWei,a=Q(s=>s.state.isMarketOrder);return e===Se.LIMIT||!a?n||"":e===Se.STOP_LOSS||e===Se.TAKE_PROFIT?r||"":t||""},Oc=()=>{const{srcToken:e,dstToken:t}=de(),n=k5(),r=ar().amountWei,a=N.useMemo(()=>gh(r||"",n,(e==null?void 0:e.decimals)||0),[r,n,e==null?void 0:e.decimals]);return{amountWei:a,amountUI:tr(t==null?void 0:t.decimals,a)}},Nm=()=>{const{srcToken:e,dstToken:t,dstUsd1Token:n}=de(),r=k5(),a=vr().amountPerTradeWei,s=Q(c=>c.state.isMarketOrder),o=N.useMemo(()=>xh(a,r,!!s,(e==null?void 0:e.decimals)||0),[a,r,s,e==null?void 0:e.decimals]),i=tr(t==null?void 0:t.decimals,o);return{amountWei:o,amountUI:i,usd:ys(i,n)}},gq=()=>{const{srcUsd1Token:e,dstUsd1Token:t}=de(),n=ar().amountUI,r=Oc().amountUI,a=ys(n,e),s=ys(r,t);return{srcAmountUsd:a,dstAmountUsd:s}},xq=()=>{const{fees:e,dstUsd1Token:t}=de(),{amountUI:n}=Oc(),r=N.useMemo(()=>!e||!n?"":he(n).multipliedBy(e).dividedBy(100).toFixed(),[n]);return{amount:Ve({value:r}),percent:Ve({value:e}),usd:ys(r,t)}},wq=()=>{const e=ar().amountUI,t=Oc().amountUI,n=N.useMemo(()=>he(t||0).dividedBy(e||0).toString(),[t,e]);return Ve({value:n,decimalScale:4})},E5=()=>{const{srcToken:e,dstToken:t,account:n}=de(),r=ze(),{amountWei:a}=ar(),{amountWei:s,usd:o}=Nm(),{totalTrades:i,amountPerTradeWei:c}=vr(),{amountWei:l,usd:d}=Es(),{fillDelay:p}=ks(),h=_m(),{amountUI:y,usd:E}=od(),{amount:C,percent:I,usd:P}=xq(),v=Ve({value:wq(),decimalScale:4}),{srcAmountUsd:U,dstAmountUsd:O}=gq(),M=ux({srcToken:e,dstToken:t,srcAmount:a,minDestAmountPerTrade:s,totalTrades:i,triggerPricePerTrade:l,deadline:h,srcAmountPerTrade:c,maker:n,tradeInterval:p.unit*p.value,limitPrice:y});return N.useMemo(()=>({...M,srcAmountUsd:U,dstAmountUsd:O,fee:{label:r("fees",{value:`${I}%`}),value:C,usd:P},display:{...M.display,minDestAmountPerTrade:{...M.display.minDestAmountPerTrade,usd:o},triggerPricePerTrade:{...M.display.triggerPricePerTrade,usd:d},limitPrice:{...M.display.limitPrice,usd:E}}}),[M,I,C,r,v,e,t,U,O,o,d,P,E])},T5=()=>{const{srcBalance:e}=de(),t=ze(),n=ar().amountWei;return N.useMemo(()=>{if(e&&he(n).gt(e))return{type:Rt.INSUFFICIENT_BALANCE,message:t("insufficientFunds"),value:e||""}},[e,n,t])};function C5(){const{marketPrice:e,marketPriceLoading:t}=de(),n=Q(d=>d.state.typedSrcAmount),r=T5(),{error:a}=Es(),{error:s}=od(),{error:o}=vr(),{error:i}=ks(),{error:c}=Dm(),l=N.useMemo(()=>Go("ignore-errors"),[]);if(!(he(e||0).isZero()||he(n||0).isZero()||t||l))return a||s||o||i||c||r}const A5=()=>{const{srcToken:e,dstToken:t,chainId:n,account:r,slippage:a,config:s}=de(),o=vr().amountPerTradeWei,i=ar().amountWei,c=_m(),l=Es().pricePerChunkWei,d=Nm().amountWei,p=ks().fillDelay,h=vr().totalTrades,y=a*100,E=!h||h===1?0:p.unit*p.value;return N.useMemo(()=>{var I;const C=Ra((e==null?void 0:e.address)||"")?(I=$a(n))==null?void 0:I.wToken.address:e==null?void 0:e.address;if(!(!C||!t||!n||!r||!c||!i||!s))return Mh({chainId:n,srcToken:C,dstToken:t.address,srcAmount:i,deadlineMillis:c,fillDelayMillis:E,slippage:y,account:r,srcAmountPerTrade:o,dstMinAmountPerTrade:d,triggerAmountPerTrade:l,config:s})},[e,t,n,r,i,c,o,l,y,d,p,h,s])},vq=()=>{var c;const{account:e,walletClient:t,overrides:n,refetchBalances:r,callbacks:a,chainId:s}=de(),o=(c=gc())==null?void 0:c.wToken,i=om();return Pr({mutationFn:async({onHash:l,srcAmountWei:d})=>{var y,E;if(!e)throw new Error("missing account");if(!t)throw new Error("missing walletClient");if(!o)throw new Error("tokenAddress is not defined");let p;mt.onWrapRequest(),(y=a==null?void 0:a.onWrapRequest)==null||y.call(a),n!=null&&n.wrap?p=await n.wrap(BigInt(d)):p=await t.writeContract({abi:Xm,functionName:"deposit",account:e,address:o.address,value:BigInt(d),chain:t.chain}),l==null||l(p);const h=await i(p);if(!h)throw new Error("failed to get transaction receipt");if(h.status==="reverted")throw new Error("failed to wrap token");return mt.onWrapSuccess(p),(E=a==null?void 0:a.onWrapSuccess)==null||E.call(a,{txHash:h.transactionHash,explorerUrl:Yo(h.transactionHash,s),amount:ir(o.decimals,d)}),r==null||r(),h},onError:l=>{throw mt.onWrapError(l),l}})},kq=()=>{const{account:e,walletClient:t,chainId:n,callbacks:r}=de(),a=A5(),s=Yj();return Pr({mutationFn:async()=>{var E,C,I,P;if(!e)throw new Error("missing account");if(!t)throw new Error("missing walletClient");if(!n)throw new Error("missing chainId");if(!a)throw new Error("rePermitOrderData is not defined");const{order:o,domain:i,types:c,primaryType:l}=a;mt.onSignOrderRequest(o),(E=r==null?void 0:r.onSignOrderRequest)==null||E.call(r),console.log({domain:i,types:c,primaryType:l,message:o,account:e}),console.log("Using domain:",i),console.log("Using types:",c),console.log("Order data to sign:",JSON.stringify(o,null,2)),console.log(`Account address: ${e}`);let d;try{d=await(t==null?void 0:t.signTypedData({domain:i,types:c,primaryType:l,message:o,account:e}))}catch(v){throw(C=r==null?void 0:r.onSignOrderError)==null||C.call(r,v.message),mt.onSignOrderError(v),v}mt.onSignOrderSuccess(d),(I=r==null?void 0:r.onSignOrderSuccess)==null||I.call(r,d);const p=Vz(d),h={v:q(p.v||0),r:p.r,s:p.s},y=await $h(o,h);return(P=r==null?void 0:r.onOrderCreated)==null||P.call(r,y),s(y),y}})},S5=()=>{const{account:e,publicClient:t,config:n}=de();return Pr({mutationFn:async({tokenAddress:r,srcAmountWei:a})=>{if(!t)throw new Error("missing publicClient");if(!e)throw new Error("missing account");if(!n)throw new Error("missing config");const s=await t.readContract({address:r,abi:Lg,functionName:"allowance",args:[e,n.repermit]}).then(i=>i.toString()),o=he(s||"0").lt(he(a).toString());return{allowance:s,approvalRequired:o}}})},Eq=()=>{const{account:e,walletClient:t,overrides:n,config:r,chainId:a,callbacks:s}=de(),o=om(),{mutateAsync:i}=S5();return Pr({onError:c=>{mt.onApproveError(c)},mutationFn:async({token:c,onHash:l,srcAmountWei:d})=>{var E,C;if(!e)throw new Error("missing account");if(!t)throw new Error("missing walletClient");if(!r)throw new Error("missing config");(E=s==null?void 0:s.onApproveRequest)==null||E.call(s),mt.onApproveRequest();let p;if(n!=null&&n.approveOrder?p=await n.approveOrder({tokenAddress:c.address,spenderAddress:r.repermit,amount:Za}):p=await t.writeContract({abi:Lg,functionName:"approve",account:e,address:c.address,args:[r.repermit,Za],chain:t.chain}),!p)throw new Error("failed to approve token");l(p);const h=await o(p);if(!h)throw new Error("failed to get transaction receipt");if(h.status==="reverted")throw new Error("failed to approve token");let y=!1;for(let I=0;I<3;I++){const{approvalRequired:P}=await i({tokenAddress:c.address,srcAmountWei:d});if(!P){y=!0;break}I<2&&await new Promise(v=>setTimeout(v,3e3))}if(!y)throw new Error(`Insufficient ${c.symbol} allowance to perform the swap. Please approve the token first.`);return mt.onApproveSuccess(h.transactionHash),(C=s==null?void 0:s.onApproveSuccess)==null||C.call(s,{txHash:h.transactionHash,explorerUrl:Yo(h.transactionHash,a),token:c,amount:ir(c.decimals,d)}),h}})},Tq=()=>{const{account:e,chainId:t,srcToken:n,dstToken:r,module:a,slippage:s}=de(),o=Es(),i=ar().amountWei,c=vr().amountPerTradeWei,l=_m(),d=ks().fillDelay,p=Nm().amountWei,h=Q(y=>y.state.isMarketOrder);return Pr({mutationFn:async()=>{mt.onRequestOrder({account:e,chainId:t,module:a,srcToken:n,dstToken:r,fromTokenAmount:i,srcChunkAmount:c,triggerPricePerTrade:o.pricePerChunkWei,deadline:l,fillDelay:d.unit*d.value,minDstAmountOutPerTrade:p,slippage:s,isMarketOrder:h||!1})}})};function Cq(e){const t=e.match(/,\s*code\s*:\s*(\d+)/i);return{message:e.replace(/^error\s*:/i,"").replace(/,\s*code\s*:\s*\d+/i,"").trim()||"",code:t?Number(t[1]):0}}const Aq=()=>{const{srcToken:e,dstToken:t,chainId:n,callbacks:r}=de(),a=Eq().mutateAsync,s=vq().mutateAsync,o=kq().mutateAsync,{mutateAsync:i}=S5(),c=Q(p=>p.updateSwapExecution),{amountWei:l}=ar(),d=Tq().mutate;return Pr({mutationFn:async()=>{var h,y;const p=Ra((e==null?void 0:e.address)||" ");try{if(!e)throw new Error("missing srcToken");if(!t)throw new Error("missing dstToken");if(!n)throw new Error("missing chainId");const E=P1(e,n);c({allowanceLoading:!0});const{approvalRequired:C}=await i({tokenAddress:E.address,srcAmountWei:l});let I=0,P=1;p&&P++,C&&P++,c({totalSteps:P,stepIndex:I,allowanceLoading:!1,status:At.LOADING}),d(),p&&(c({step:Wa.WRAP}),await s({onHash:U=>c({wrapTxHash:U}),srcAmountWei:l}),I++,c({stepIndex:I})),C&&(c({step:Wa.APPROVE}),await a({token:E,onHash:U=>c({approveTxHash:U}),srcAmountWei:l}),I++,c({stepIndex:I})),c({step:Wa.CREATE});const v=await o();return c({status:At.SUCCESS,orderId:v.id}),v}catch(E){if(Gd(E))(h=r==null?void 0:r.onSubmitOrderRejected)==null||h.call(r),c({step:void 0,status:void 0,stepIndex:void 0});else{const C=Cq(E.message);(y=r==null?void 0:r.onSubmitOrderFailed)==null||y.call(r,{message:C.message||"",code:C.code||0}),c({status:At.FAILED,error:{message:C.message||"",code:C.code||0}})}}}})},Sq=()=>{const{marketPrice:e,srcToken:t,dstToken:n,marketPriceLoading:r,srcBalance:a,srcUsd1Token:s,noLiquidity:o}=de(),i=ze(),c=Aq(),l=Q(u=>u.updateState),{amountUI:d,amountWei:p}=ar(),h=Q(u=>u.resetState),y=Q(u=>u.state.swapExecution),E=Q(u=>u.state.typedSrcAmount),C=r||he(s||"0").isZero()||a===void 0||he(e||"0").isZero(),I=!!(t&&n&&E&&C),P=C5(),v=N.useMemo(()=>o?i("noLiquidity"):he(E||"0").isZero()?i("enterAmount"):(P==null?void 0:P.type)===Rt.INSUFFICIENT_BALANCE?i("insufficientFunds"):i("placeOrder"),[P,i,E,o]),U=N.useCallback(()=>{(y==null?void 0:y.status)===At.SUCCESS&&(l({typedSrcAmount:""}),setTimeout(()=>{h()},1e3))},[y==null?void 0:y.status,h,l]),O=N.useCallback(()=>{(y==null?void 0:y.status)!==At.LOADING&&l({acceptedSrcAmount:void 0,acceptedMarketPrice:void 0,swapExecution:{srcToken:t,dstToken:n}})},[l,t,n]),M=Pr({mutationFn:async()=>(l({acceptedSrcAmount:d,acceptedMarketPrice:e}),await c.mutateAsync())}),L=N.useCallback(()=>M.mutateAsync(),[M]),F=E5();return N.useMemo(()=>({resetSwap:h,onCloseModal:U,onOpenModal:O,onSubmitOrder:L,...y,swapLoading:(y==null?void 0:y.status)===At.LOADING||(y==null?void 0:y.allowanceLoading),swapSubmitted:!!(y!=null&&y.status),order:F,srcAmountWei:p,srcAmount:p,openSubmitModalButton:{disabled:!!(P||o||I||he(E||"0").isZero()||!t||!n),text:v,loading:I}}),[y,t,n,F,h,U,O,L,v,I,P,o,E])},P5=(e,t)=>{const{marketPriceLoading:n,srcToken:r,dstToken:a,srcBalance:s,dstBalance:o}=de(),i=Q(O=>O.state.typedSrcAmount),c=Q(O=>O.updateState),{srcUsd1Token:l,dstUsd1Token:d}=de(),p=ys(i,l),h=ys(t,d),y=Oj(),E=e?r:a,C=tr(E==null?void 0:E.decimals,e?s:o),I=T5(),P=N.useCallback(O=>{e&&c({typedSrcAmount:O})},[c,e]),v=N.useCallback(()=>{e&&c({typedSrcAmount:qo(C,8)})},[c,e,C]),U=y||e?i:qo(t||"",8);return{balance:C,usd:e||y?p:h,value:U||"",valueWei:Vu(E==null?void 0:E.decimals,U),onChange:P,onMax:v,isLoading:i?e?!1:n:!1,token:E,isInsufficientBalance:e?I:void 0}},Pq=()=>P5(!0),Iq=()=>{const e=Oc().amountUI,t=Q(n=>n.state.typedSrcAmount);return P5(!1,t?e:"")},Bq=()=>{const e=Q(r=>r.state.isMarketOrder),t=Q(r=>r.updateState),n=N.useCallback(()=>{t({isMarketOrder:!e})},[t,e]);return{isMarketPrice:!e,togglePrice:n}},I5=N.createContext({}),Oq=({children:e,...t})=>_.jsx(I5.Provider,{value:t,children:e}),Fq=()=>N.useContext(I5),B5=()=>{var a,s;const e=ze(),{wrapTxHash:t,srcToken:n}=Q(o=>o.state.swapExecution),r=(s=(a=gc())==null?void 0:a.wToken)==null?void 0:s.symbol;return t?_.jsx("p",{className:"twap-error-wrap-msg",children:e("wrapMsg",{symbol:(n==null?void 0:n.symbol)||"",wSymbol:r||""})}):null},Uq=(e=!1,t=1)=>{const{module:n}=de(),r=ze();return N.useMemo(()=>n===Se.STOP_LOSS?r("stopLoss"):n===Se.TAKE_PROFIT?r("takeProfit"):r(e?"twapMarket":t===1?"limit":"twapLimit"),[r,n,e,t])},Dq=({price:e,dstTokenSymbol:t,label:n,usd:r})=>_.jsxs(Ce.DetailRow,{title:n,children:[`${e||"-"} ${t||""}`,_.jsx(Ce.USD,{value:r})]}),O5=()=>{const e=ze(),t=Q(s=>s.state.isMarketOrder),n=Q(s=>s.state.swapExecution.status),{totalTrades:r}=vr(),a=Uq(t,r);return n===At.SUCCESS?e("createOrderActionSuccess",{name:a}):e("createOrderAction",{name:a})},_q=()=>{const e=Q(E=>E.state.swapExecution.srcToken),t=ze(),{step:n,wrapTxHash:r,approveTxHash:a}=Q(E=>E.state.swapExecution),s=gc(),o=am(r),i=am(r),c=am(a),l=Q(E=>E.state.swapExecution.status),p=Ra((e==null?void 0:e.address)||"")?(s==null?void 0:s.native.symbol)||"":(e==null?void 0:e.symbol)||"",h=s==null?void 0:s.wToken.symbol,y=O5();return N.useMemo(()=>n===Wa.WRAP?{title:t("wrapAction",{symbol:p}),footerLink:o,footerText:t(o?"viewOnExplorer":"proceedInWallet")}:n===Wa.APPROVE?{title:t("approveAction",{symbol:p}),footerLink:c,footerText:t(c?"viewOnExplorer":"proceedInWallet")}:{title:y,footerText:l===At.LOADING?t("proceedInWallet"):void 0},[n,c,p,y,t,o,i,h,l])},Mq=({error:e})=>_.jsxs("div",{className:"twap-error",children:[_.jsx("h2",{className:"twap-error-title",children:"Transaction failed"}),(e==null?void 0:e.code)&&_.jsxs("p",{className:"twap-error-code",children:["Error code: ",e==null?void 0:e.code]}),_.jsx(B5,{})]});function Nq({error:e}){const{components:t}=de(),n=ze(),r=Q(o=>{var i;return(i=o.state.swapExecution)==null?void 0:i.wrapTxHash}),a=t.SubmitOrderErrorView,s=_.jsx(la.Failed,{error:_.jsx(Mq,{error:e}),footerLink:wd,footerText:n("viewOnExplorer")});return a?_.jsx(a,{wrapTxHash:r,error:e,children:s}):s}const Lq=()=>{const{components:e}=de(),t=Q(h=>h.state.swapExecution.srcToken),n=Q(h=>h.state.swapExecution.dstToken),{reviewDetails:r}=Fq(),a=ze(),s=Q(h=>{var y;return!!((y=h.state.swapExecution)!=null&&y.status)}),o=E5(),i=Ve({value:o.srcAmountUsd,decimalScale:2}),c=Ve({value:o.dstAmountUsd,decimalScale:2}),l=e.USD,d=e.SubmitOrderMainView,p=_.jsxs(_.Fragment,{children:[_.jsx(la.Main,{fromTitle:a("from"),toTitle:a("to"),inUsd:l?_.jsx(l,{value:o.srcAmountUsd,isLoading:!1}):`$${i}`,outUsd:l?_.jsx(l,{value:o.dstAmountUsd,isLoading:!1}):`$${c}`}),!s&&_.jsxs("div",{className:"twap-create-order-bottom",children:[_.jsx(Ce.Container,{children:_.jsxs("div",{className:"twap-create-order-details",children:[_.jsx(Ce.Deadline,{deadline:o.display.deadline.value,label:o.display.deadline.label,tooltip:o.display.deadline.tooltip||""}),_.jsx(Ce.TriggerPrice,{price:o.display.triggerPricePerTrade.value,dstToken:n,label:o.display.triggerPricePerTrade.label,tooltip:o.display.triggerPricePerTrade.tooltip||"",usd:o.display.triggerPricePerTrade.usd}),_.jsx(Dq,{price:o.display.limitPrice.value,dstTokenSymbol:n==null?void 0:n.symbol,label:o.display.limitPrice.label,usd:o.display.limitPrice.usd}),_.jsx(Ce.MinDestAmount,{dstToken:n,dstMinAmountOut:o.display.minDestAmountPerTrade.value,label:o.display.minDestAmountPerTrade.label,tooltip:o.display.minDestAmountPerTrade.tooltip||"",usd:o.display.minDestAmountPerTrade.usd}),_.jsx(Ce.TradeSize,{tradeSize:o.display.tradeSize.value,trades:o.display.totalTrades.value,srcToken:t,label:o.display.tradeSize.label,tooltip:o.display.tradeSize.tooltip}),_.jsx(Ce.TradesAmount,{trades:o.display.totalTrades.value,label:o.display.totalTrades.label,tooltip:o.display.totalTrades.tooltip}),_.jsx(Ce.TradeInterval,{chunks:o.display.totalTrades.value,fillDelayMillis:o.display.tradeInterval.value,label:o.display.tradeInterval.label,tooltip:o.display.tradeInterval.tooltip}),_.jsx(Ce.Recipient,{}),o.fee.value&&_.jsx(Ce.Fees,{fees:o.fee.value,label:o.fee.label,usd:o.fee.usd,dstTokenSymbol:n==null?void 0:n.symbol})]})}),r]})]});return d?_.jsx(d,{children:p}):p},zq=e=>{const{status:t,stepIndex:n,totalSteps:r,error:a}=Q(v=>v.state.swapExecution),{components:s}=de(),o=s.Spinner,i=s.SuccessIcon,c=s.ErrorIcon,l=s.TokenLogo,{srcToken:d,dstToken:p}=de(),h=ar().amountUI,y=Oc().amountUI,E=Ve({value:h,decimalScale:2}),C=Ve({value:y,decimalScale:2}),I=N.useMemo(()=>({symbol:d==null?void 0:d.symbol,logoUrl:d==null?void 0:d.logoUrl}),[d]),P=N.useMemo(()=>({symbol:p==null?void 0:p.symbol,logoUrl:p==null?void 0:p.logoUrl}),[p]);return _.jsx(Oq,{...e,children:_.jsx(la,{inAmount:E,outAmount:C,swapStatus:t,totalSteps:r,currentStep:_q(),currentStepIndex:n,inToken:I,outToken:P,components:{SrcTokenLogo:l&&_.jsx(l,{token:d}),DstTokenLogo:l&&_.jsx(l,{token:p}),Failed:_.jsx(Nq,{error:a}),Success:_.jsx(Rq,{}),Main:_.jsx(Lq,{}),Loader:o,SuccessIcon:i,FailedIcon:c}})})},Rq=()=>{const e=O5(),{components:t}=de(),n=Q(s=>s.state.swapExecution.orderId),r=t.SubmitOrderSuccessView,a=_.jsxs(_.Fragment,{children:[_.jsx(la.Success,{title:e}),_.jsx(B5,{})]});return r?_.jsx(r,{newOrderId:n,children:a}):a};Lh(M3.version);const $q=()=>{const e=Q(t=>t.updateState);return{amount:Q(t=>t.state.typedSrcAmount),reset:N.useCallback(()=>e({typedSrcAmount:""}),[e])}},Hq={SubmitOrderPanel:zq,Orders:nq};H.Components=Hq,H.Configs=Lt,H.DEFAULT_DURATION_OPTIONS=nR,H.DEFAULT_FILL_DELAY=Hc,H.DEFAULT_STOP_LOSS_LIMIT_PERCENTAGE=mh,H.DEFAULT_STOP_LOSS_PERCENTAGE=ph,H.DEFAULT_TAKE_PROFIT_LIMIT_PERCENTAGE=hh,H.DEFAULT_TAKE_PROFIT_PERCENTAGE=fh,H.DISCLAIMER_URL=a3,H.EIP712_TYPES=dh,H.ERC20_ABI=zw,H.EXCLUSIVITY_OVERRIDE_BPS=Jw,H.EXECUTOR_ABI=Lw,H.FEES=Qw,H.IWETH_ABI=Xm,H.InputErrors=Rt,H.LEGACY_EXCHANGES_MAP=lh,H.LENS_ABI=Rw,H.MAX_ORDER_DURATION_MILLIS=Ms,H.MIN_CHUNKS=Zw,H.MIN_FILL_DELAY_MILLIS=$c,H.MIN_FILL_DELAY_MINUTES=ah,H.MIN_ORDER_DURATION_MILLIS=xd,H.Module=Se,H.ORBS_LOGO=t3,H.ORBS_LOGO_FALLBACK=n3,H.ORBS_SLTP_FAQ_URL=e3,H.ORBS_TWAP_FAQ_URL=wd,H.ORBS_WEBSITE_URL=r3,H.OrderStatus=tt,H.OrderType=ft,H.PRICE_PROTECTION_SETTINGS=rR,H.Partners=Jm,H.QUERY_PARAMS=Gc,H.REACTOR_ABI=Nw,H.REPERMIT_ABI=Zm,H.REPERMIT_PRIMARY_TYPE=uh,H.SUGGEST_CHUNK_VALUE=Kw,H.SpotProvider=eR,H.Steps=Wa,H.SwapStatus=At,H.THE_GRAPH_ORDERS_API=oh,H.TWAP_ABI=Qm,H.TimeUnit=qt,H.amountBN=Rc,H.amountUi=ir,H.analytics=mt,H.buildRePermitOrderData=Mh,H.copy=R8,H.ensureWrappedToken=P1,H.eqIgnoreCase=za,H.fillDelayText=C1,H.formatDecimals=qo,H.getAccountOrders=Vh,H.getApiEndpoint=gd,H.getChunks=kh,H.getConfig=Ed,H.getDeadline=Th,H.getDestTokenAmount=gh,H.getDestTokenMinAmountPerChunk=xh,H.getDuration=vh,H.getEstimatedDelayBetweenChunksMillis=kd,H.getExplorerUrl=Yo,H.getMaxChunksError=Dh,H.getMaxFillDelayError=l3,H.getMaxOrderDurationError=Bh,H.getMaxPossibleChunks=Eh,H.getMinFillDelayError=Fh,H.getMinNativeBalance=H8,H.getMinOrderDurationError=Oh,H.getMinTradeSizeError=Uh,H.getMinimumDelayMinutes=c3,H.getNetwork=$a,H.getOrderExcecutionRate=A1,H.getOrderFillDelayMillis=hd,H.getOrderLimitPriceRate=S1,H.getOrderType=G8,H.getPartnerChains=qw,H.getPartnerIdentifier=zt,H.getPartners=_h,H.getQueryParam=Go,H.getSrcTokenChunkAmount=Ch,H.getStopLossLimitPriceError=Ph,H.getStopLossPriceError=Ah,H.getTakeProfitLimitPriceError=Ih,H.getTakeProfitPriceError=Sh,H.getTriggerPricePerChunk=wh,H.isNativeAddress=Ra,H.isTxRejected=Gd,H.makeElipsisAddress=Hd,H.maxUint256=Xw,H.millisToDays=I1,H.millisToMinutes=jd,H.nativeTokenAddresses=ch,H.networks=_t,H.parseError=$8,H.removeCommas=z8,H.setApiMode=Yw,H.setUIVersion=Lh,H.shouldUnwrapOnly=Wd,H.shouldWrapOnly=Vd,H.submitOrder=$h,H.useBuildRePermitOrderDataCallback=A5,H.useDisclaimerPanel=uq,H.useDstTokenPanel=Iq,H.useDurationPanel=lq,H.useFillDelayPanel=aq,H.useFormatNumber=Ve,H.useInputErrors=C5,H.useInvertTradePanel=sd,H.useLimitPricePanel=yq,H.useMarketPricePanel=iq,H.useOrderHistoryPanel=eV,H.useSrcTokenPanel=Pq,H.useSubmitSwapPanel=Sq,H.useTogglePricePanel=Bq,H.useTradesPanel=oq,H.useTriggerPricePanel=mq,H.useTypedSrcAmount=$q,H.zeroAddress=ih,Object.defineProperty(H,Symbol.toStringTag,{value:"Module"})}));
|